@metad/contracts 3.7.0 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metad/contracts",
3
- "version": "3.7.0",
3
+ "version": "3.8.1",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,5 +13,9 @@
13
13
  "docs": "yarn typedoc --out ./.docs"
14
14
  },
15
15
  "module": "./index.esm.js",
16
- "main": "./index.cjs.js"
16
+ "main": "./index.cjs.js",
17
+ "dependencies": {
18
+ "@a2ui/lit": "^0.8.1",
19
+ "@xpert-ai/chatkit-types": "^0.0.12"
20
+ }
17
21
  }
@@ -1,22 +1,27 @@
1
1
  import { BaseMessage } from '@langchain/core/messages';
2
2
  import { RunnableConfig } from '@langchain/core/runnables';
3
+ import { TMessageContentComplex } from '@xpert-ai/chatkit-types';
3
4
  import { Subscriber } from 'rxjs';
4
5
  import { TWorkflowVarGroup } from '../ai/xpert-workflow.model';
5
- import { TMessageContentComplex } from '../ai/chat-message.model';
6
- import { I18nObject } from '../types';
7
- import { TXpertGraph, TXpertTeamNode } from '../ai/xpert.model';
6
+ import { TXpertGraph } from '../ai/xpert.model';
7
+ import { IXpertAgent } from '../ai/xpert-agent.model';
8
8
  /**
9
9
  * @deprecated can use getCurrentTaskInput instead?
10
10
  */
11
11
  export declare const CONTEXT_VARIABLE_CURRENTSTATE = "currentState";
12
12
  export declare const STATE_VARIABLE_SYS = "sys";
13
- export declare const STATE_VARIABLE_HUMAN = "human";
14
13
  export declare const GRAPH_NODE_SUMMARIZE_CONVERSATION = "summarize_conversation";
15
14
  export declare const GRAPH_NODE_TITLE_CONVERSATION = "title_conversation";
16
15
  export declare const STATE_VARIABLE_FILES = "files";
17
16
  export declare const STATE_VARIABLE_INPUT = "input";
18
17
  export declare const STATE_SYS_VOLUME = "volume";
18
+ /**
19
+ * Workspace path in sandbox environment
20
+ */
19
21
  export declare const STATE_SYS_WORKSPACE_PATH = "workspace_path";
22
+ /**
23
+ * URL for workspace files in sandbox environment
24
+ */
20
25
  export declare const STATE_SYS_WORKSPACE_URL = "workspace_url";
21
26
  export declare const STATE_VARIABLE_TITLE_CHANNEL: string;
22
27
  export type TMessageChannel = {
@@ -25,6 +30,11 @@ export type TMessageChannel = {
25
30
  summary?: string;
26
31
  error?: string | null;
27
32
  };
33
+ export type TSandboxConfigurable = {
34
+ provider?: string;
35
+ workingDirectory?: string;
36
+ backend?: unknown;
37
+ };
28
38
  export type TAgentRunnableConfigurable = {
29
39
  /**
30
40
  * Thread id
@@ -50,64 +60,29 @@ export type TAgentRunnableConfigurable = {
50
60
  * Execution id of agent workflow node
51
61
  */
52
62
  executionId: string;
63
+ /**
64
+ * Sandbox backend context
65
+ */
66
+ sandbox?: TSandboxConfigurable;
53
67
  signal?: AbortSignal;
54
68
  };
69
+ /**
70
+ * @deprecated use import { type ToolCall } from '@langchain/core/messages/tool';
71
+ */
55
72
  export type TToolCall = {
56
73
  id?: string;
57
74
  name: string;
58
75
  type?: 'tool_call';
59
76
  args: Record<string, any>;
60
77
  };
78
+ export declare function channelName(name: string): string;
79
+ export declare function messageContentText(content: string | TMessageContentComplex): any;
61
80
  /**
81
+ * Get workspace folder for sandbox from runnable configurable
62
82
  *
63
- * Example:
64
- *
65
- * ```typescript
66
- * const result = interrupt<TInterruptMessage<{ name: string }>, { projectId: string }>({
67
- * category: 'BI',
68
- * type: 'switch_project',
69
- * title: {
70
- * en_US: 'Switch project',
71
- * zh_Hans: '切换项目'
72
- * },
73
- * message: {
74
- * en_US: 'Please select a project or create a new one',
75
- * zh_Hans: '请选择或创建一个新的项目'
76
- * },
77
- * data: { name: '' }
78
- * })
79
- * ```
83
+ * @param configurable
84
+ * @returns
80
85
  */
81
- export type TInterruptMessage<T = unknown> = {
82
- /**
83
- * Major categories of interrupt components
84
- */
85
- category: 'BI';
86
- /**
87
- * The specific type of interactive component
88
- */
89
- type: string;
90
- /**
91
- * Title of the interrupt component
92
- */
93
- title: string | I18nObject;
94
- /**
95
- * Message content of the interrupt component
96
- */
97
- message: string | I18nObject;
98
- /**
99
- * Additional data
100
- */
101
- data?: T;
102
- };
103
- export type TInterruptCommand = {
104
- resume?: any;
105
- update?: any;
106
- toolCalls?: TToolCall[];
107
- agentKey?: string;
108
- };
109
- export declare function channelName(name: string): string;
110
- export declare function messageContentText(content: string | TMessageContentComplex): any;
111
86
  export declare function getWorkspaceFromRunnable(configurable: TAgentRunnableConfigurable): {
112
87
  type?: 'project' | 'conversation';
113
88
  id?: string;
@@ -148,4 +123,45 @@ export declare function getAgentVarGroup(key: string, graph: TXpertGraph): TWork
148
123
  * @param agentKey
149
124
  */
150
125
  export declare function getSwarmPartners(graph: TXpertGraph, agentKey: string, partners: string[], leaderKey?: string): string[];
151
- export declare function getWorkflowTriggers(graph: TXpertGraph, from: string): TXpertTeamNode[];
126
+ export declare function getWorkflowTriggers(graph: TXpertGraph, from: string): ((import("../ai/xpert.model").TXpertTeamNodeBase & {
127
+ type: "agent";
128
+ } & {
129
+ entity: IXpertAgent;
130
+ }) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
131
+ type: "knowledge";
132
+ } & {
133
+ entity: import("..").IKnowledgebase;
134
+ }) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
135
+ type: "toolset";
136
+ } & {
137
+ entity: import("..").IXpertToolset;
138
+ }) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
139
+ type: "xpert";
140
+ } & {
141
+ entity: import("../ai/xpert.model").IXpert;
142
+ nodes?: ((import("../ai/xpert.model").TXpertTeamNodeBase & {
143
+ type: "agent";
144
+ } & {
145
+ entity: IXpertAgent;
146
+ }) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
147
+ type: "knowledge";
148
+ } & {
149
+ entity: import("..").IKnowledgebase;
150
+ }) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
151
+ type: "toolset";
152
+ } & {
153
+ entity: import("..").IXpertToolset;
154
+ }) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
155
+ type: "xpert";
156
+ } & any) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
157
+ type: "workflow";
158
+ } & {
159
+ entity: import("../ai/xpert-workflow.model").IWorkflowNode;
160
+ }))[];
161
+ connections?: import("../ai/xpert.model").TXpertTeamConnection[];
162
+ expanded?: boolean;
163
+ }) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
164
+ type: "workflow";
165
+ } & {
166
+ entity: import("../ai/xpert-workflow.model").IWorkflowNode;
167
+ }))[];
@@ -3,3 +3,4 @@ export * from './token';
3
3
  export * from './graph';
4
4
  export * from './utils';
5
5
  export * from './variables';
6
+ export * from './interrupt';
@@ -0,0 +1,51 @@
1
+ import { I18nObject } from '../types';
2
+ export type TInterrupt<T = unknown> = {
3
+ id?: string;
4
+ value?: T;
5
+ when?: 'during';
6
+ resumable?: boolean;
7
+ ns?: string[];
8
+ };
9
+ /**
10
+ *
11
+ * Example:
12
+ *
13
+ * ```typescript
14
+ * const result = interrupt<TInterruptMessage<{ name: string }>, { projectId: string }>({
15
+ * category: 'BI',
16
+ * type: 'switch_project',
17
+ * title: {
18
+ * en_US: 'Switch project',
19
+ * zh_Hans: '切换项目'
20
+ * },
21
+ * message: {
22
+ * en_US: 'Please select a project or create a new one',
23
+ * zh_Hans: '请选择或创建一个新的项目'
24
+ * },
25
+ * data: { name: '' }
26
+ * })
27
+ * ```
28
+ */
29
+ export type TInterruptMessage<T = unknown> = {
30
+ /**
31
+ * Major categories of interrupt components
32
+ */
33
+ category: 'BI';
34
+ /**
35
+ * The specific type of interactive component
36
+ */
37
+ type: string;
38
+ /**
39
+ * Title of the interrupt component
40
+ */
41
+ title: string | I18nObject;
42
+ /**
43
+ * Message content of the interrupt component
44
+ */
45
+ message: string | I18nObject;
46
+ /**
47
+ * Additional data
48
+ */
49
+ data?: T;
50
+ };
51
+ export declare function isInterruptMessage(obj: unknown): obj is TInterruptMessage;
@@ -1,4 +1,4 @@
1
- import { AiModelTypeEnum } from '../agent/';
1
+ import { AiModelTypeEnum } from '../agent/index';
2
2
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
3
3
  import { I18nObject } from '../types';
4
4
  import { ICopilot } from './copilot.model';
@@ -1,62 +1,24 @@
1
- import { MessageContentImageUrl, MessageType } from '@langchain/core/messages';
1
+ import { MessageType } from '@langchain/core/messages';
2
2
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
3
3
  import { IChatConversation } from './chat.model';
4
4
  import { LongTermMemoryTypeEnum } from './xpert.model';
5
5
  import { XpertAgentExecutionStatusEnum } from './xpert-agent-execution.model';
6
6
  import { JSONValue } from '../core.model';
7
7
  import { IStorageFile } from '../storage-file.model';
8
+ import { TChatMessageStep, TMessageContent, TMessageContentReasoning } from '@xpert-ai/chatkit-types';
8
9
  export type TSummaryJob = Record<LongTermMemoryTypeEnum, {
9
10
  jobId: number | string;
10
11
  status: string;
11
12
  progress?: number;
12
13
  memoryKey?: string;
13
14
  }>;
14
- /**
15
- * Message step type: determines the type of canvas
16
- */
17
- /**
18
- * Category of step message: determines the display components of computer use
19
- */
20
- export declare enum ChatMessageStepCategory {
21
- /**
22
- * List of items: urls, files, etc.
23
- */
24
- List = "list",
25
- /**
26
- * Websearch results
27
- */
28
- WebSearch = "web_search",
29
- /**
30
- * Files list
31
- */
32
- Files = "files",
33
- /**
34
- * View a file
35
- */
36
- File = "file",
37
- /**
38
- * Program Execution
39
- */
40
- Program = "program",
41
- /**
42
- * Iframe
43
- */
44
- Iframe = "iframe",
45
- Memory = "memory",
46
- Tasks = "tasks",
47
- /**
48
- * Knowledges (knowledge base retriever results)
49
- */
50
- Knowledges = "knowledges"
51
- }
52
- /**
53
- * Step message type, in canvas and ai message.
54
- */
55
- export type TChatMessageStep<T = any> = TMessageComponent<TMessageComponentStep<T>>;
56
15
  /**
57
16
  * Chat message entity type
58
17
  */
59
18
  export interface IChatMessage extends IBasePerTenantAndOrganizationEntityModel, Omit<Omit<CopilotBaseMessage, 'createdAt'>, 'id'> {
19
+ parent?: IChatMessage | null;
20
+ children?: IChatMessage[];
21
+ parentId?: string | null;
60
22
  /**
61
23
  * Files
62
24
  */
@@ -90,7 +52,7 @@ export type ChatMessageStatusEnum = XpertAgentExecutionStatusEnum | 'thinking' |
90
52
  * BaseMessage or AIMessage in Langchain.js
91
53
  */
92
54
  export interface CopilotBaseMessage {
93
- id: string;
55
+ id?: string;
94
56
  createdAt?: Date;
95
57
  role: CopilotMessageType;
96
58
  /**
@@ -124,98 +86,6 @@ export type CopilotChatMessage = CopilotBaseMessage & {
124
86
  export interface CopilotMessageGroup extends CopilotBaseMessage {
125
87
  messages?: CopilotChatMessage[];
126
88
  }
127
- /**
128
- * Similar to {@link MessageContentText} | {@link MessageContentImageUrl}, which together form {@link MessageContentComplex}
129
- */
130
- export type TMessageContentComponent<T extends object = object> = {
131
- id: string;
132
- type: 'component';
133
- data: TMessageComponent<T>;
134
- xpertName?: string;
135
- agentKey?: string;
136
- };
137
- /**
138
- * Defines the data type of the sub-message of `component` type in the message `content` {@link MessageContentComplex}
139
- */
140
- export type TMessageComponent<T extends object = object> = T & {
141
- id?: string;
142
- category: 'Dashboard' | 'Computer' | 'Tool';
143
- type?: string;
144
- created_date?: Date | string;
145
- };
146
- export type TMessageContentText = {
147
- id?: string;
148
- xpertName?: string;
149
- agentKey?: string;
150
- type: "text";
151
- text: string;
152
- };
153
- export type TMessageContentMemory = {
154
- id?: string;
155
- agentKey?: string;
156
- type: "memory";
157
- data: any[];
158
- };
159
- export type TMessageContentReasoning = {
160
- id?: string;
161
- xpertName?: string;
162
- agentKey?: string;
163
- type: "reasoning";
164
- text: string;
165
- };
166
- /**
167
- * Enhance {@link MessageContentComplex} in Langchain.js
168
- */
169
- export type TMessageContentComplex = (TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentMemory | (Record<string, any> & {
170
- type?: "text" | "image_url" | string;
171
- }) | (Record<string, any> & {
172
- type?: never;
173
- })) & {
174
- id?: string;
175
- xpertName?: string;
176
- agentKey?: string;
177
- created_date?: Date | string;
178
- };
179
- /**
180
- * Enhance {@link MessageContent} in Langchain.js
181
- */
182
- export type TMessageContent = string | TMessageContentComplex[];
183
- export type TMessageComponentIframe = {
184
- type: 'iframe';
185
- title: string;
186
- url?: string;
187
- data?: {
188
- url?: string;
189
- };
190
- };
191
- export type TMessageComponentStep<T = JSONValue> = {
192
- type: ChatMessageStepCategory;
193
- toolset: string;
194
- toolset_id: string;
195
- tool?: string;
196
- title: string;
197
- message: string;
198
- status: 'success' | 'fail' | 'running';
199
- created_date: Date | string;
200
- end_date: Date | string;
201
- error?: string;
202
- data?: T;
203
- input?: any;
204
- output?: string;
205
- artifact?: any;
206
- };
207
- /**
208
- * Data type for chat event message
209
- */
210
- export type TChatEventMessage = {
211
- type?: string;
212
- title?: string;
213
- message?: string;
214
- status?: 'success' | 'fail' | 'running';
215
- created_date?: Date | string;
216
- end_date?: Date | string;
217
- error?: string;
218
- };
219
89
  /**
220
90
  * @deprecated use content in message
221
91
  */
@@ -7,7 +7,8 @@ import { IXpertAgent } from './xpert-agent.model';
7
7
  import { IXpertProject } from './xpert-project.model';
8
8
  import { IStorageFile } from '../storage-file.model';
9
9
  import { IXpertTask } from './xpert-task.model';
10
- import { TInterruptMessage, TToolCall } from '../agent';
10
+ import { TToolCall } from '../agent';
11
+ import { TInterrupt } from '../agent/interrupt';
11
12
  export type TChatConversationOptions = {
12
13
  parameters?: {
13
14
  input?: string;
@@ -29,12 +30,7 @@ export type TSensitiveOperation = {
29
30
  messageId?: string;
30
31
  tasks?: {
31
32
  name: string;
32
- interrupts: {
33
- value?: TInterruptMessage;
34
- when?: "during";
35
- resumable?: boolean;
36
- ns?: string[];
37
- }[];
33
+ interrupts: TInterrupt[];
38
34
  type?: TToolCallType;
39
35
  info?: {
40
36
  name: string;
@@ -22,5 +22,9 @@ export type TCopilotModel = {
22
22
  options?: TCopilotModelOptions;
23
23
  };
24
24
  export type TCopilotModelOptions = {
25
+ /**
26
+ * Max input context size of selected model
27
+ */
28
+ context_size?: number;
25
29
  [key: string]: any;
26
30
  };
@@ -3,6 +3,7 @@ import { IOrganization } from '../organization.model';
3
3
  import { IUser } from '../user.model';
4
4
  import { AiProvider } from './ai.model';
5
5
  import { ICopilot, TCopilotTokenUsage } from './copilot.model';
6
+ export declare const USAGE_HOUR_FORMAT = "yyyy-MM-dd HH";
6
7
  /**
7
8
  *
8
9
  */
@@ -13,6 +14,12 @@ export interface ICopilotUser extends IBasePerTenantAndOrganizationEntityModel,
13
14
  copilot?: ICopilot;
14
15
  userId?: string;
15
16
  user?: IUser;
17
+ xpertId?: string;
18
+ /**
19
+ * Usage hour in format 'yyyy-MM-dd HH' {@link USAGE_HOUR_FORMAT}
20
+ */
21
+ usageHour: string;
22
+ threadId: string;
16
23
  provider?: AiProvider | string;
17
24
  model?: string;
18
25
  tokenTotalUsed?: number;
package/src/ai/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from '@xpert-ai/chatkit-types';
1
2
  export * from './ai-model.model';
2
3
  export * from './ai.model';
3
4
  export * from './chat.model';
@@ -40,3 +41,5 @@ export * from './knowledge-retrieval-log.model';
40
41
  export * from './knowledge-doc-chunk.model';
41
42
  export * from './skill.model';
42
43
  export * from './middleware.model';
44
+ export * from './sandbox';
45
+ export * from './message-content.utils';
@@ -0,0 +1,52 @@
1
+ import { TMessageContent, TMessageContentComplex } from '@xpert-ai/chatkit-types';
2
+ import { CopilotChatMessage } from './chat-message.model';
3
+ export type TMessageJoinHint = 'none' | 'space' | 'line' | 'paragraph';
4
+ export type TMessageAppendContext = {
5
+ source?: string;
6
+ streamId?: string;
7
+ joinHint?: TMessageJoinHint;
8
+ };
9
+ export type TAppendMessageContentOptions = TMessageAppendContext & {
10
+ previous?: TMessageAppendContext | null;
11
+ };
12
+ export type TResolveMessageAppendContextOptions = {
13
+ previous?: TMessageAppendContext | null;
14
+ incoming: string | TMessageContentComplex;
15
+ fallbackSource?: string;
16
+ fallbackStreamId?: string;
17
+ };
18
+ export type TResolvedMessageAppendContext = {
19
+ appendContext: TMessageAppendContext;
20
+ messageContext: TMessageAppendContext;
21
+ };
22
+ export type TMessageAppendContextTracker = {
23
+ resolve: (options: Omit<TResolveMessageAppendContextOptions, 'previous'>) => TResolvedMessageAppendContext;
24
+ reset: () => void;
25
+ current: () => TMessageAppendContext | null;
26
+ };
27
+ export declare function inferMessageAppendContext(content: string | TMessageContentComplex, fallbackSource?: string): TMessageAppendContext;
28
+ export declare function resolveMessageAppendContext(options: TResolveMessageAppendContextOptions): TResolvedMessageAppendContext;
29
+ /**
30
+ * Stateful helper for streaming append.
31
+ *
32
+ * It keeps the previous append context and resolves the current one, so callers
33
+ * can avoid passing `previous` manually for every chunk and still get stable
34
+ * join behavior (for example, same source + same stream -> `joinHint: 'none'`).
35
+ *
36
+ * Call `reset()` at turn/session boundaries to prevent cross-turn contamination.
37
+ */
38
+ export declare function createMessageAppendContextTracker(initial?: TMessageAppendContext | null): TMessageAppendContextTracker;
39
+ /**
40
+ * Append one incoming chunk into a chat message in place.
41
+ *
42
+ * Behavior:
43
+ * - Keeps `aiMessage` object reference stable (caller may hold this object).
44
+ * - Updates message properties with new references (`content`/`reasoning` arrays)
45
+ * so UI change detection that relies on reference changes can react reliably.
46
+ * - Applies context-aware merge rules for text/reasoning/component chunks.
47
+ * - `previous` must be supplied by caller when same-stream join inference is needed.
48
+ */
49
+ export declare function appendMessageContent(aiMessage: CopilotChatMessage, incoming: string | TMessageContentComplex, context?: TAppendMessageContentOptions): void;
50
+ export declare function appendMessagePlainText(accumulator: string, incoming: string | TMessageContentComplex, context?: TMessageAppendContext): string;
51
+ export declare function stringifyMessageContent(content: TMessageContent | TMessageContentComplex): string;
52
+ export declare function filterMessageText(content: TMessageContent | TMessageContentComplex): string;
@@ -6,7 +6,12 @@ export interface IWFNMiddleware extends IWorkflowNode {
6
6
  type: WorkflowNodeTypeEnum.MIDDLEWARE;
7
7
  provider: string;
8
8
  options?: Record<string, any>;
9
+ tools?: Record<string, TMiddlewareToolConfig | boolean>;
9
10
  }
11
+ export type TMiddlewareToolConfig = {
12
+ enabled?: boolean;
13
+ };
14
+ export declare function isMiddlewareToolEnabled(config?: TMiddlewareToolConfig | boolean): boolean;
10
15
  export declare function genXpertMiddlewareKey(): string;
11
16
  export type TAgentMiddlewareMeta = {
12
17
  name: string;
@@ -0,0 +1,6 @@
1
+ import { I18nObject, IconDefinition } from "../types";
2
+ export type TSandboxProviderMeta = {
3
+ name: I18nObject;
4
+ description?: I18nObject;
5
+ icon: IconDefinition;
6
+ };
package/src/ai/types.d.ts CHANGED
@@ -59,6 +59,12 @@ type JsonSchema7Meta = {
59
59
  * Additional inputs for the Custom UI component
60
60
  */
61
61
  inputs?: Record<string, unknown>;
62
+ /**
63
+ * Whether this component supports selecting LangGraph state variables
64
+ */
65
+ variable?: boolean;
66
+ enumLabels?: Record<string, I18nObject | string>;
67
+ styles?: Record<string, string>;
62
68
  };
63
69
  };
64
70
  export type JsonSchemaObjectType = {
@@ -1,3 +1,4 @@
1
+ import { STATE_VARIABLE_HUMAN, TChatRequestHuman, TInterruptCommand } from '@xpert-ai/chatkit-types';
1
2
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
2
3
  import { ICopilotModel, TCopilotModel } from './copilot-model.model';
3
4
  import { IKnowledgebase, TKBRecallParams } from './knowledgebase.model';
@@ -6,7 +7,6 @@ import { IXpertToolset } from './xpert-toolset.model';
6
7
  import { IXpert, TXpertParameter } from './xpert.model';
7
8
  import { TVariableAssigner } from './xpert-workflow.model';
8
9
  import { TErrorHandling } from './types';
9
- import { TInterruptCommand } from '../agent';
10
10
  export type TXpertAgent = {
11
11
  key: string;
12
12
  name?: string;
@@ -140,19 +140,13 @@ export type TXpertAgentOptions = {
140
140
  */
141
141
  structuredOutputMethod?: "functionCalling" | "jsonMode" | "jsonSchema" | string;
142
142
  /**
143
- * Vision config of agent
143
+ * @deprecated use attachment
144
144
  */
145
- vision?: {
146
- enabled?: boolean;
147
- /**
148
- * Variable name that store the list of files to be understood
149
- */
150
- variable?: string;
151
- /**
152
- * Image resolution for vision tasks
153
- */
154
- resolution?: 'high' | 'low';
155
- };
145
+ vision?: TXpertAgentVision;
146
+ /**
147
+ * Attachment config of agent
148
+ */
149
+ attachment?: TXpertAgentAttachment;
156
150
  /**
157
151
  * Config of middlewares for agent
158
152
  */
@@ -160,6 +154,23 @@ export type TXpertAgentOptions = {
160
154
  order: string[];
161
155
  };
162
156
  };
157
+ export type TXpertAgentVision = {
158
+ enabled?: boolean;
159
+ /**
160
+ * Variable name that store the list of files to be understood
161
+ */
162
+ variable?: string;
163
+ /**
164
+ * Image resolution for vision tasks
165
+ */
166
+ resolution?: 'high' | 'low';
167
+ };
168
+ export type TXpertAgentAttachment = TXpertAgentVision & {
169
+ /**
170
+ * Max number of files to be processed
171
+ */
172
+ maxNum?: number;
173
+ };
163
174
  export type TAgentPromptTemplate = {
164
175
  id: string;
165
176
  role: 'ai' | 'human';
@@ -179,10 +190,17 @@ export type TAgentOutputVariable = TXpertParameter & {
179
190
  * @deprecated use TChatRequest
180
191
  */
181
192
  export type TChatAgentParams = {
182
- input: {
193
+ /**
194
+ * @deprecated use state instead
195
+ */
196
+ input?: {
183
197
  input?: string;
184
198
  [key: string]: unknown;
185
199
  };
200
+ state: {
201
+ [STATE_VARIABLE_HUMAN]: TChatRequestHuman;
202
+ [key: string]: any;
203
+ };
186
204
  agentKey: string;
187
205
  xpertId: string;
188
206
  executionId?: string;