@xpert-ai/chatkit-types 0.0.3 → 0.0.4
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/dist/index.d.ts +152 -89
- package/dist/index.js +797 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
|
+
import { ToolCall } from '@langchain/core/messages/tool';
|
|
2
|
+
|
|
1
3
|
export declare interface ChatkitMessage {
|
|
2
|
-
status?: string
|
|
3
|
-
content: TMessageItems
|
|
4
|
-
reasoning?: TMessageContentReasoning[]
|
|
5
|
-
type: 'user' | 'assistant' | 'system' | 'tool' | 'event'
|
|
6
|
-
id: string
|
|
4
|
+
status?: string;
|
|
5
|
+
content: TMessageItems;
|
|
6
|
+
reasoning?: TMessageContentReasoning[];
|
|
7
|
+
type: 'user' | 'assistant' | 'system' | 'tool' | 'event';
|
|
8
|
+
id: string;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* https://js.langchain.com/docs/how_to/streaming/#event-reference
|
|
11
13
|
*/
|
|
12
14
|
export declare enum ChatMessageEventTypeEnum {
|
|
13
|
-
ON_CONVERSATION_START =
|
|
14
|
-
ON_CONVERSATION_END =
|
|
15
|
-
ON_MESSAGE_START =
|
|
16
|
-
ON_MESSAGE_END =
|
|
17
|
-
ON_TOOL_START =
|
|
18
|
-
ON_TOOL_END =
|
|
19
|
-
ON_TOOL_ERROR =
|
|
15
|
+
ON_CONVERSATION_START = "on_conversation_start",
|
|
16
|
+
ON_CONVERSATION_END = "on_conversation_end",
|
|
17
|
+
ON_MESSAGE_START = "on_message_start",
|
|
18
|
+
ON_MESSAGE_END = "on_message_end",
|
|
19
|
+
ON_TOOL_START = "on_tool_start",
|
|
20
|
+
ON_TOOL_END = "on_tool_end",
|
|
21
|
+
ON_TOOL_ERROR = "on_tool_error",
|
|
20
22
|
/**
|
|
21
23
|
* Step message in tool call
|
|
22
24
|
*/
|
|
23
|
-
ON_TOOL_MESSAGE =
|
|
24
|
-
ON_AGENT_START =
|
|
25
|
-
ON_AGENT_END =
|
|
26
|
-
ON_RETRIEVER_START =
|
|
27
|
-
ON_RETRIEVER_END =
|
|
28
|
-
ON_RETRIEVER_ERROR =
|
|
29
|
-
ON_INTERRUPT =
|
|
30
|
-
ON_ERROR =
|
|
31
|
-
ON_CHAT_EVENT =
|
|
25
|
+
ON_TOOL_MESSAGE = "on_tool_message",
|
|
26
|
+
ON_AGENT_START = "on_agent_start",
|
|
27
|
+
ON_AGENT_END = "on_agent_end",
|
|
28
|
+
ON_RETRIEVER_START = "on_retriever_start",
|
|
29
|
+
ON_RETRIEVER_END = "on_retriever_end",
|
|
30
|
+
ON_RETRIEVER_ERROR = "on_retriever_error",
|
|
31
|
+
ON_INTERRUPT = "on_interrupt",
|
|
32
|
+
ON_ERROR = "on_error",
|
|
33
|
+
ON_CHAT_EVENT = "on_chat_event"
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
/**
|
|
@@ -38,46 +40,107 @@ export declare enum ChatMessageStepCategory {
|
|
|
38
40
|
/**
|
|
39
41
|
* List of items: urls, files, etc.
|
|
40
42
|
*/
|
|
41
|
-
List =
|
|
43
|
+
List = "list",
|
|
42
44
|
/**
|
|
43
45
|
* Websearch results
|
|
44
46
|
*/
|
|
45
|
-
WebSearch =
|
|
47
|
+
WebSearch = "web_search",
|
|
46
48
|
/**
|
|
47
49
|
* Files list
|
|
48
50
|
*/
|
|
49
|
-
Files =
|
|
51
|
+
Files = "files",
|
|
50
52
|
/**
|
|
51
53
|
* View a file
|
|
52
54
|
*/
|
|
53
|
-
File =
|
|
55
|
+
File = "file",
|
|
54
56
|
/**
|
|
55
57
|
* Program Execution
|
|
56
58
|
*/
|
|
57
|
-
Program =
|
|
59
|
+
Program = "program",
|
|
58
60
|
/**
|
|
59
61
|
* Iframe
|
|
60
62
|
*/
|
|
61
|
-
Iframe =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Tasks = 'tasks',
|
|
66
|
-
|
|
63
|
+
Iframe = "iframe",
|
|
64
|
+
Memory = "memory",
|
|
65
|
+
Tasks = "tasks",
|
|
67
66
|
/**
|
|
68
67
|
* Knowledges (knowledge base retriever results)
|
|
69
68
|
*/
|
|
70
|
-
Knowledges =
|
|
69
|
+
Knowledges = "knowledges"
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
export declare enum ChatMessageTypeEnum {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
MESSAGE = "message",
|
|
74
|
+
EVENT = "event"
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export declare interface ClientToolMessageInput {
|
|
78
|
+
content: unknown;
|
|
79
|
+
name?: string;
|
|
80
|
+
tool_call_id?: string;
|
|
81
|
+
status?: 'success' | 'error';
|
|
82
|
+
artifact?: unknown;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export declare interface ClientToolRequest {
|
|
86
|
+
clientToolCalls: ToolCall[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export declare interface ClientToolResponse {
|
|
90
|
+
toolMessages: ClientToolMessageInput[];
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
export declare type ImageDetail = "auto" | "low" | "high";
|
|
80
94
|
|
|
95
|
+
/**
|
|
96
|
+
* When an interrupt occurs during task execution, the system generates an InterruptPayload.
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"type": "event",
|
|
100
|
+
"event": "on_interrupt",
|
|
101
|
+
"data": {
|
|
102
|
+
"tasks": [
|
|
103
|
+
{
|
|
104
|
+
"id": "9c4d2ac5-8808-5b6f-855c-4d48aa3d77a7",
|
|
105
|
+
"name": "Middleware_wPzR2bIXqE_after_model",
|
|
106
|
+
"path": ["__pregel_pull", "Middleware_wPzR2bIXqE_after_model"],
|
|
107
|
+
"interrupts": [
|
|
108
|
+
{
|
|
109
|
+
"id": "b42f7887d65e57ed11cf08b8927763db",
|
|
110
|
+
"value": {
|
|
111
|
+
"toolCalls": [
|
|
112
|
+
{
|
|
113
|
+
"name": "getUserStation",
|
|
114
|
+
"args": {
|
|
115
|
+
"input": "Query the site selected by the user"
|
|
116
|
+
},
|
|
117
|
+
"id": "call_00_swcaUjIaACXOHHaZyNmQB3Vm",
|
|
118
|
+
"type": "tool_call"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
*/
|
|
130
|
+
export declare interface InterruptPayload {
|
|
131
|
+
tasks: Array<{
|
|
132
|
+
id: string;
|
|
133
|
+
name: string;
|
|
134
|
+
path: string[];
|
|
135
|
+
interrupts: Array<{
|
|
136
|
+
id: string;
|
|
137
|
+
value: ClientToolRequest;
|
|
138
|
+
}>;
|
|
139
|
+
}>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export declare function isClientToolRequest(value: any): value is ClientToolRequest;
|
|
143
|
+
|
|
81
144
|
export declare type MessageContentImageUrl = {
|
|
82
145
|
type: "image_url";
|
|
83
146
|
image_url: string | {
|
|
@@ -95,59 +158,59 @@ export declare type MessageContentText = {
|
|
|
95
158
|
* Data type for chat event message
|
|
96
159
|
*/
|
|
97
160
|
export declare type TChatEventMessage = {
|
|
98
|
-
type?: string
|
|
99
|
-
title?: string
|
|
100
|
-
message?: string
|
|
101
|
-
status?: 'success' | 'fail' | 'running'
|
|
102
|
-
created_date?: Date | string
|
|
103
|
-
end_date?: Date | string
|
|
104
|
-
error?: string
|
|
105
|
-
}
|
|
161
|
+
type?: string;
|
|
162
|
+
title?: string;
|
|
163
|
+
message?: string;
|
|
164
|
+
status?: 'success' | 'fail' | 'running';
|
|
165
|
+
created_date?: Date | string;
|
|
166
|
+
end_date?: Date | string;
|
|
167
|
+
error?: string;
|
|
168
|
+
};
|
|
106
169
|
|
|
107
170
|
/**
|
|
108
171
|
* Step message type, in canvas and ai message.
|
|
109
172
|
*/
|
|
110
|
-
export declare type TChatMessageStep<T = any> = TMessageComponent<TMessageComponentStep<T
|
|
173
|
+
export declare type TChatMessageStep<T = any> = TMessageComponent<TMessageComponentStep<T>>;
|
|
111
174
|
|
|
112
175
|
/**
|
|
113
176
|
* Defines the data type of the sub-message of `component` type in the message `content` {@link MessageContentComplex}
|
|
114
177
|
*/
|
|
115
178
|
export declare type TMessageComponent<T extends object = object> = T & {
|
|
116
|
-
id?: string
|
|
117
|
-
category: 'Dashboard' | 'Computer' | 'Tool'
|
|
118
|
-
type?: string
|
|
119
|
-
created_date?: Date | string
|
|
120
|
-
}
|
|
179
|
+
id?: string;
|
|
180
|
+
category: 'Dashboard' | 'Computer' | 'Tool';
|
|
181
|
+
type?: string;
|
|
182
|
+
created_date?: Date | string;
|
|
183
|
+
};
|
|
121
184
|
|
|
122
185
|
export declare type TMessageComponentIframe = {
|
|
123
|
-
type: 'iframe'
|
|
124
|
-
title: string
|
|
125
|
-
url?: string
|
|
186
|
+
type: 'iframe';
|
|
187
|
+
title: string;
|
|
188
|
+
url?: string;
|
|
126
189
|
data?: {
|
|
127
|
-
url?: string
|
|
128
|
-
}
|
|
129
|
-
}
|
|
190
|
+
url?: string;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
130
193
|
|
|
131
194
|
export declare type TMessageComponentStep<T = unknown> = {
|
|
132
|
-
type: ChatMessageStepCategory
|
|
133
|
-
toolset: string
|
|
134
|
-
toolset_id: string
|
|
135
|
-
tool?: string
|
|
136
|
-
title: string
|
|
137
|
-
message: string
|
|
138
|
-
status: 'success' | 'fail' | 'running'
|
|
139
|
-
created_date: Date | string
|
|
140
|
-
end_date: Date | string
|
|
141
|
-
error?: string
|
|
142
|
-
data?: T
|
|
143
|
-
input?: any
|
|
144
|
-
output?: string
|
|
145
|
-
artifact?: any
|
|
146
|
-
}
|
|
195
|
+
type: ChatMessageStepCategory;
|
|
196
|
+
toolset: string;
|
|
197
|
+
toolset_id: string;
|
|
198
|
+
tool?: string;
|
|
199
|
+
title: string;
|
|
200
|
+
message: string;
|
|
201
|
+
status: 'success' | 'fail' | 'running';
|
|
202
|
+
created_date: Date | string;
|
|
203
|
+
end_date: Date | string;
|
|
204
|
+
error?: string;
|
|
205
|
+
data?: T;
|
|
206
|
+
input?: any;
|
|
207
|
+
output?: string;
|
|
208
|
+
artifact?: any;
|
|
209
|
+
};
|
|
147
210
|
|
|
148
211
|
/**
|
|
149
212
|
* Enhance {@link MessageContent} in Langchain.js
|
|
150
|
-
*
|
|
213
|
+
*
|
|
151
214
|
* @deprecated use {@link TMessageItems} instead
|
|
152
215
|
*/
|
|
153
216
|
export declare type TMessageContent = string | TMessageContentComplex[];
|
|
@@ -160,42 +223,42 @@ export declare type TMessageContentComplex = (TMessageContentText | TMessageCont
|
|
|
160
223
|
}) | (Record<string, any> & {
|
|
161
224
|
type?: never;
|
|
162
225
|
})) & {
|
|
163
|
-
id?: string
|
|
164
|
-
xpertName?: string
|
|
226
|
+
id?: string;
|
|
227
|
+
xpertName?: string;
|
|
165
228
|
agentKey?: string;
|
|
166
|
-
created_date?: Date | string
|
|
167
|
-
}
|
|
229
|
+
created_date?: Date | string;
|
|
230
|
+
};
|
|
168
231
|
|
|
169
232
|
/**
|
|
170
233
|
* Similar to {@link MessageContentText} | {@link MessageContentImageUrl}, which together form {@link MessageContentComplex}
|
|
171
234
|
*/
|
|
172
235
|
export declare type TMessageContentComponent<T extends object = object> = {
|
|
173
|
-
id: string
|
|
174
|
-
type: 'component'
|
|
175
|
-
data: TMessageComponent<T
|
|
176
|
-
xpertName?: string
|
|
236
|
+
id: string;
|
|
237
|
+
type: 'component';
|
|
238
|
+
data: TMessageComponent<T>;
|
|
239
|
+
xpertName?: string;
|
|
177
240
|
agentKey?: string;
|
|
178
|
-
}
|
|
241
|
+
};
|
|
179
242
|
|
|
180
243
|
export declare type TMessageContentMemory = {
|
|
181
|
-
id?: string
|
|
182
|
-
agentKey?: string
|
|
244
|
+
id?: string;
|
|
245
|
+
agentKey?: string;
|
|
183
246
|
type: "memory";
|
|
184
247
|
data: any[];
|
|
185
248
|
};
|
|
186
249
|
|
|
187
250
|
export declare type TMessageContentReasoning = {
|
|
188
|
-
id?: string
|
|
189
|
-
xpertName?: string
|
|
190
|
-
agentKey?: string
|
|
251
|
+
id?: string;
|
|
252
|
+
xpertName?: string;
|
|
253
|
+
agentKey?: string;
|
|
191
254
|
type: "reasoning";
|
|
192
255
|
text: string;
|
|
193
256
|
};
|
|
194
257
|
|
|
195
258
|
export declare type TMessageContentText = {
|
|
196
|
-
id?: string
|
|
197
|
-
xpertName?: string
|
|
198
|
-
agentKey?: string
|
|
259
|
+
id?: string;
|
|
260
|
+
xpertName?: string;
|
|
261
|
+
agentKey?: string;
|
|
199
262
|
type: "text";
|
|
200
263
|
text: string;
|
|
201
264
|
};
|