1+ import { MessageContent } from '@langchain/core/messages'
2+ import { IFileUpload } from '../../src/Interface'
3+
14export interface ILLMMessage {
25 role : 'system' | 'assistant' | 'user' | 'tool' | 'developer'
36 content : string
@@ -15,3 +18,143 @@ export interface IFlowState {
1518 key : string
1619 value : string
1720}
21+
22+ // ─── Image & artifact interfaces ─────────────────────────────────────────────
23+
24+ /** Tracks which content-array indices map back to stored files. */
25+ export interface IImageFileRef {
26+ index : number
27+ fileName : string
28+ mime : string
29+ }
30+
31+ /** An artifact produced by a model (image, file, etc.). */
32+ export interface IArtifact {
33+ type : string
34+ data : string
35+ }
36+
37+ /** A file annotation from container file citations. */
38+ export interface IFileAnnotation {
39+ filePath : string
40+ fileName : string
41+ }
42+
43+ /** Result of saving an image to storage. */
44+ export interface ISavedImageResult {
45+ filePath : string
46+ fileName : string
47+ totalSize : number
48+ }
49+
50+ /** Info about a saved inline image (for replacing base64 in content). */
51+ export interface ISavedInlineImage {
52+ filePath : string
53+ fileName : string
54+ mimeType : string
55+ }
56+
57+ // ─── Response metadata interfaces (LLM provider outputs) ─────────────────────
58+
59+ /** OpenAI image generation output item. */
60+ export interface IImageGenerationOutput {
61+ type : 'image_generation_call'
62+ id ?: string
63+ result : string
64+ output_format ?: string
65+ }
66+
67+ /** Gemini inline data item (image generation). */
68+ export interface IGeminiInlineData {
69+ type : 'gemini_inline_data'
70+ data : string
71+ mimeType : string
72+ }
73+
74+ /** OpenAI container file citation annotation. */
75+ export interface IContainerFileCitation {
76+ type : 'container_file_citation'
77+ container_id : string
78+ file_id : string
79+ filename : string
80+ }
81+
82+ /** A single content item within a response metadata output. */
83+ export interface IResponseOutputContent {
84+ annotations ?: IContainerFileCitation [ ]
85+ }
86+
87+ /** A single output item from response metadata. */
88+ export interface IResponseMetadataOutput {
89+ type : string
90+ content ?: IResponseOutputContent [ ]
91+ result ?: string
92+ id ?: string
93+ output_format ?: string
94+ }
95+
96+ /** Top-level response metadata shape from LLM providers. */
97+ export interface IResponseMetadata {
98+ output ?: IResponseMetadataOutput [ ]
99+ inlineData ?: IGeminiInlineData [ ]
100+ }
101+
102+ // ─── Message interfaces ──────────────────────────────────────────────────────
103+
104+ /** Model configuration for image handling. */
105+ export interface IModelImageConfig {
106+ allowImageUploads ?: boolean
107+ imageResolution ?: 'auto' | 'low' | 'high'
108+ }
109+
110+ /** Stored-file content item within a message content array. */
111+ export interface IStoredFileContent {
112+ type : 'stored-file'
113+ name : string
114+ mime : string
115+ imageResolution ?: string
116+ path ?: string
117+ }
118+
119+ /**
120+ * Additional kwargs attached to messages in agentflow.
121+ * Extends LangChain's `Record<string, unknown>` with known keys.
122+ */
123+ export interface IMessageAdditionalKwargs {
124+ artifacts ?: IArtifact [ ]
125+ fileAnnotations ?: IFileAnnotation [ ]
126+ usedTools ?: unknown [ ]
127+ fileUploads ?: string | IFileUpload [ ]
128+ _imageFileRefs ?: IImageFileRef [ ]
129+ [ key : string ] : unknown
130+ }
131+
132+ /**
133+ * Plain chat message as used in agentflow utils.
134+ * Compatible with LangChain's `MessageFieldWithRole` (which is `{role, content, name?} & Record<string, unknown>`).
135+ * The index signature ensures assignability to `BaseMessageLike`.
136+ */
137+ export interface IChatMessage {
138+ role : string
139+ content : MessageContent
140+ additional_kwargs ?: IMessageAdditionalKwargs
141+ _isTemporaryImageMessage ?: boolean
142+ [ key : string ] : unknown
143+ }
144+
145+ /** Image artifact extracted from an assistant message. */
146+ export interface IImageArtifact {
147+ name : string
148+ mime : string
149+ }
150+
151+ /** Content item in a multimodal message (superset of stored-file and image_url). */
152+ export interface IMultimodalContentItem {
153+ type : string
154+ name ?: string
155+ mime ?: string
156+ data ?: string
157+ imageResolution ?: string
158+ image_url ?: { url : string ; detail ?: string }
159+ [ key : string ] : unknown
160+ }
0 commit comments