@xpert-ai/chatkit-types 0.0.2 → 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.
@@ -0,0 +1,268 @@
1
+ import { ToolCall } from '@langchain/core/messages/tool';
2
+
3
+ export declare interface ChatkitMessage {
4
+ status?: string;
5
+ content: TMessageItems;
6
+ reasoning?: TMessageContentReasoning[];
7
+ type: 'user' | 'assistant' | 'system' | 'tool' | 'event';
8
+ id: string;
9
+ }
10
+
11
+ /**
12
+ * https://js.langchain.com/docs/how_to/streaming/#event-reference
13
+ */
14
+ export declare enum ChatMessageEventTypeEnum {
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",
22
+ /**
23
+ * Step message in tool call
24
+ */
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"
34
+ }
35
+
36
+ /**
37
+ * Category of step message: determines the display components of computer use
38
+ */
39
+ export declare enum ChatMessageStepCategory {
40
+ /**
41
+ * List of items: urls, files, etc.
42
+ */
43
+ List = "list",
44
+ /**
45
+ * Websearch results
46
+ */
47
+ WebSearch = "web_search",
48
+ /**
49
+ * Files list
50
+ */
51
+ Files = "files",
52
+ /**
53
+ * View a file
54
+ */
55
+ File = "file",
56
+ /**
57
+ * Program Execution
58
+ */
59
+ Program = "program",
60
+ /**
61
+ * Iframe
62
+ */
63
+ Iframe = "iframe",
64
+ Memory = "memory",
65
+ Tasks = "tasks",
66
+ /**
67
+ * Knowledges (knowledge base retriever results)
68
+ */
69
+ Knowledges = "knowledges"
70
+ }
71
+
72
+ export declare enum ChatMessageTypeEnum {
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[];
91
+ }
92
+
93
+ export declare type ImageDetail = "auto" | "low" | "high";
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
+
144
+ export declare type MessageContentImageUrl = {
145
+ type: "image_url";
146
+ image_url: string | {
147
+ url: string;
148
+ detail?: ImageDetail;
149
+ };
150
+ };
151
+
152
+ export declare type MessageContentText = {
153
+ type: "text";
154
+ text: string;
155
+ };
156
+
157
+ /**
158
+ * Data type for chat event message
159
+ */
160
+ export declare type TChatEventMessage = {
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
+ };
169
+
170
+ /**
171
+ * Step message type, in canvas and ai message.
172
+ */
173
+ export declare type TChatMessageStep<T = any> = TMessageComponent<TMessageComponentStep<T>>;
174
+
175
+ /**
176
+ * Defines the data type of the sub-message of `component` type in the message `content` {@link MessageContentComplex}
177
+ */
178
+ export declare type TMessageComponent<T extends object = object> = T & {
179
+ id?: string;
180
+ category: 'Dashboard' | 'Computer' | 'Tool';
181
+ type?: string;
182
+ created_date?: Date | string;
183
+ };
184
+
185
+ export declare type TMessageComponentIframe = {
186
+ type: 'iframe';
187
+ title: string;
188
+ url?: string;
189
+ data?: {
190
+ url?: string;
191
+ };
192
+ };
193
+
194
+ export declare type TMessageComponentStep<T = unknown> = {
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
+ };
210
+
211
+ /**
212
+ * Enhance {@link MessageContent} in Langchain.js
213
+ *
214
+ * @deprecated use {@link TMessageItems} instead
215
+ */
216
+ export declare type TMessageContent = string | TMessageContentComplex[];
217
+
218
+ /**
219
+ * Enhance {@link MessageContentComplex} in Langchain.js
220
+ */
221
+ export declare type TMessageContentComplex = (TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentMemory | (Record<string, any> & {
222
+ type?: "text" | "image_url" | string;
223
+ }) | (Record<string, any> & {
224
+ type?: never;
225
+ })) & {
226
+ id?: string;
227
+ xpertName?: string;
228
+ agentKey?: string;
229
+ created_date?: Date | string;
230
+ };
231
+
232
+ /**
233
+ * Similar to {@link MessageContentText} | {@link MessageContentImageUrl}, which together form {@link MessageContentComplex}
234
+ */
235
+ export declare type TMessageContentComponent<T extends object = object> = {
236
+ id: string;
237
+ type: 'component';
238
+ data: TMessageComponent<T>;
239
+ xpertName?: string;
240
+ agentKey?: string;
241
+ };
242
+
243
+ export declare type TMessageContentMemory = {
244
+ id?: string;
245
+ agentKey?: string;
246
+ type: "memory";
247
+ data: any[];
248
+ };
249
+
250
+ export declare type TMessageContentReasoning = {
251
+ id?: string;
252
+ xpertName?: string;
253
+ agentKey?: string;
254
+ type: "reasoning";
255
+ text: string;
256
+ };
257
+
258
+ export declare type TMessageContentText = {
259
+ id?: string;
260
+ xpertName?: string;
261
+ agentKey?: string;
262
+ type: "text";
263
+ text: string;
264
+ };
265
+
266
+ export declare type TMessageItems = TMessageContentComplex[];
267
+
268
+ export { }