@metad/contracts 3.7.0 → 3.8.0
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/index.cjs.js +85 -70
- package/index.esm.js +71 -69
- package/package.json +6 -2
- package/src/agent/graph.d.ts +68 -52
- package/src/agent/index.d.ts +1 -0
- package/src/agent/interrupt.d.ts +51 -0
- package/src/ai/ai-model.model.d.ts +1 -1
- package/src/ai/chat-message.model.d.ts +5 -135
- package/src/ai/chat.model.d.ts +3 -7
- package/src/ai/copilot-model.model.d.ts +4 -0
- package/src/ai/copilot-user.model.d.ts +7 -0
- package/src/ai/index.d.ts +2 -0
- package/src/ai/middleware.model.d.ts +5 -0
- package/src/ai/sandbox.d.ts +6 -0
- package/src/ai/types.d.ts +6 -0
- package/src/ai/xpert-agent.model.d.ts +32 -14
- package/src/ai/xpert-workflow.model.d.ts +48 -4
- package/src/ai/xpert.model.d.ts +51 -100
- package/src/ai/xpert.utils.d.ts +7 -0
- package/src/integration/lark.d.ts +3 -9
- package/src/integration.model.d.ts +0 -5
- package/src/organization-contact.model.d.ts +0 -1
- package/src/organization.model.d.ts +0 -1
- package/src/plugin.d.ts +8 -0
- package/src/user.model.d.ts +2 -2
package/src/agent/graph.d.ts
CHANGED
|
@@ -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 {
|
|
6
|
-
import {
|
|
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
|
-
*
|
|
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):
|
|
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
|
+
}))[];
|
package/src/agent/index.d.ts
CHANGED
|
@@ -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,62 +1,24 @@
|
|
|
1
|
-
import {
|
|
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
|
*/
|
|
@@ -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
|
*/
|
package/src/ai/chat.model.d.ts
CHANGED
|
@@ -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 {
|
|
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;
|
|
@@ -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,4 @@ 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';
|
|
@@ -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;
|
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
|
-
*
|
|
143
|
+
* @deprecated use attachment
|
|
144
144
|
*/
|
|
145
|
-
vision?:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { I18nObject, IconDefinition } from "../types";
|
|
2
2
|
import { ICopilotModel } from "./copilot-model.model";
|
|
3
3
|
import { TKBRecallParams } from "./knowledgebase.model";
|
|
4
|
-
import { ApiAuthType, TErrorHandling, TXpertRefParameter } from "./types";
|
|
4
|
+
import { ApiAuthType, JsonSchemaObjectType, TErrorHandling, TXpertRefParameter } from "./types";
|
|
5
5
|
import { TKBRetrievalSettings, TStateVariable, TXpertParameter } from "./xpert.model";
|
|
6
6
|
export type TWorkflowNodeMeta = {
|
|
7
7
|
name: string;
|
|
8
8
|
label: I18nObject;
|
|
9
9
|
icon: IconDefinition;
|
|
10
|
-
configSchema:
|
|
10
|
+
configSchema: JsonSchemaObjectType;
|
|
11
11
|
};
|
|
12
12
|
export type TWorkflowTriggerMeta = TWorkflowNodeMeta;
|
|
13
13
|
export declare enum WorkflowNodeTypeEnum {
|
|
14
|
+
START = "start",
|
|
15
|
+
END = "end",
|
|
14
16
|
/**
|
|
15
17
|
* Trigger
|
|
16
18
|
*/
|
|
@@ -25,7 +27,11 @@ export declare enum WorkflowNodeTypeEnum {
|
|
|
25
27
|
IF_ELSE = "if-else",
|
|
26
28
|
LIST_OPERATOR = "list-operator",
|
|
27
29
|
VARIABLE_AGGREGATOR = "variable-aggregator",
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated use ITERATOR instead
|
|
32
|
+
*/
|
|
28
33
|
ITERATING = "iterating",
|
|
34
|
+
ITERATOR = "iterator",
|
|
29
35
|
HTTP = "http",
|
|
30
36
|
SUBFLOW = "subflow",
|
|
31
37
|
TOOL = "tool",
|
|
@@ -149,6 +155,31 @@ export interface IWFNVariableAggregator extends IWorkflowNode {
|
|
|
149
155
|
inputs: string[];
|
|
150
156
|
outputType: string;
|
|
151
157
|
}
|
|
158
|
+
export interface IWFNIterator extends IWorkflowNode {
|
|
159
|
+
type: WorkflowNodeTypeEnum.ITERATOR;
|
|
160
|
+
/**
|
|
161
|
+
* Variable name of input array in state
|
|
162
|
+
*/
|
|
163
|
+
inputVariable: string;
|
|
164
|
+
outputParams?: TXpertRefParameter[];
|
|
165
|
+
/**
|
|
166
|
+
* Execute in parallel, otherwise execute sequentially
|
|
167
|
+
*/
|
|
168
|
+
parallel?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Maximum number of parallel task
|
|
171
|
+
*/
|
|
172
|
+
maximum?: number;
|
|
173
|
+
/**
|
|
174
|
+
* - terminate: terminate on error
|
|
175
|
+
* - ignore: ignore error and continue
|
|
176
|
+
* - remove: remove error output
|
|
177
|
+
*/
|
|
178
|
+
errorMode?: 'terminate' | 'ignore' | 'remove';
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* @deprecated use IWFNIterator instead
|
|
182
|
+
*/
|
|
152
183
|
export interface IWFNIterating extends IWorkflowNode {
|
|
153
184
|
type: WorkflowNodeTypeEnum.ITERATING;
|
|
154
185
|
/**
|
|
@@ -173,10 +204,18 @@ export interface IWFNIterating extends IWorkflowNode {
|
|
|
173
204
|
errorMode?: 'terminate' | 'ignore' | 'remove';
|
|
174
205
|
}
|
|
175
206
|
/**
|
|
176
|
-
*
|
|
207
|
+
* @deprecated use `IteratorItemParameterName` instead
|
|
177
208
|
*/
|
|
178
209
|
export declare const IteratingItemParameterName = "$item";
|
|
210
|
+
/**
|
|
211
|
+
* @deprecated use `IteratorIndexParameterName` instead
|
|
212
|
+
*/
|
|
179
213
|
export declare const IteratingIndexParameterName = "$index";
|
|
214
|
+
/**
|
|
215
|
+
* The parameter name that represents the entire current element in array
|
|
216
|
+
*/
|
|
217
|
+
export declare const IteratorItemParameterName = "$item";
|
|
218
|
+
export declare const IteratorIndexParameterName = "$index";
|
|
180
219
|
export interface IWFNAnswer extends IWorkflowNode {
|
|
181
220
|
type: WorkflowNodeTypeEnum.ANSWER;
|
|
182
221
|
promptTemplate: string;
|
|
@@ -393,9 +432,14 @@ export declare function genListOperatorKey(): string;
|
|
|
393
432
|
export declare function genVariableAggregatorKey(): string;
|
|
394
433
|
export declare function genJSONStringifyKey(): string;
|
|
395
434
|
export declare function genJSONParseKey(): string;
|
|
435
|
+
export declare function genXpertIteratorKey(): string;
|
|
436
|
+
export declare function genXpertStartKey(key: string): string;
|
|
396
437
|
export declare function isAgentKey(key: string): boolean;
|
|
397
438
|
export declare function isRouterKey(key: string): boolean;
|
|
439
|
+
/**
|
|
440
|
+
* @deprecated use `isIteratorKey` instead
|
|
441
|
+
*/
|
|
398
442
|
export declare function isIteratingKey(key: string): boolean;
|
|
399
|
-
export declare function
|
|
443
|
+
export declare function isIteratorKey(key: string): boolean;
|
|
400
444
|
export declare function workflowNodeIdentifier(node: IWorkflowNode): string;
|
|
401
445
|
export {};
|