@xpert-ai/chatkit-types 0.1.0 → 0.2.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/dist/index.d.ts +136 -13
- package/dist/index.js +56 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -250,6 +250,17 @@ export declare type ChatKitEvents = {
|
|
|
250
250
|
}>;
|
|
251
251
|
};
|
|
252
252
|
|
|
253
|
+
export declare type ChatKitImageReference = ChatKitReferenceBase & {
|
|
254
|
+
type: 'image';
|
|
255
|
+
fileId?: string;
|
|
256
|
+
url?: string;
|
|
257
|
+
mimeType?: string;
|
|
258
|
+
name?: string;
|
|
259
|
+
size?: number;
|
|
260
|
+
width?: number;
|
|
261
|
+
height?: number;
|
|
262
|
+
};
|
|
263
|
+
|
|
253
264
|
export declare interface ChatkitMessage {
|
|
254
265
|
status?: string;
|
|
255
266
|
content: TMessageItems | string;
|
|
@@ -459,7 +470,7 @@ export declare type ChatKitQuoteReference = ChatKitReferenceBase & {
|
|
|
459
470
|
source?: string;
|
|
460
471
|
};
|
|
461
472
|
|
|
462
|
-
export declare type ChatKitReference = ChatKitCodeReference | ChatKitQuoteReference;
|
|
473
|
+
export declare type ChatKitReference = ChatKitCodeReference | ChatKitQuoteReference | ChatKitImageReference;
|
|
463
474
|
|
|
464
475
|
export declare type ChatKitReferenceBase = {
|
|
465
476
|
id?: string;
|
|
@@ -618,6 +629,12 @@ export declare type Checkbox = {
|
|
|
618
629
|
required?: boolean;
|
|
619
630
|
};
|
|
620
631
|
|
|
632
|
+
export declare type ClientToolInterrupt<TRequest extends ClientToolRequest = ClientToolRequest> = LangGraphInterrupt<TRequest>;
|
|
633
|
+
|
|
634
|
+
export declare type ClientToolInterruptPayload<TRequest extends ClientToolRequest = ClientToolRequest> = LangGraphInterruptPayload<TRequest>;
|
|
635
|
+
|
|
636
|
+
export declare type ClientToolInterruptTask<TRequest extends ClientToolRequest = ClientToolRequest> = LangGraphInterruptTask<TRequest>;
|
|
637
|
+
|
|
621
638
|
export declare interface ClientToolMessageInput {
|
|
622
639
|
content: unknown;
|
|
623
640
|
name?: string;
|
|
@@ -844,6 +861,9 @@ export declare type Input = {
|
|
|
844
861
|
|
|
845
862
|
/**
|
|
846
863
|
* When an interrupt occurs during task execution, the system generates an InterruptPayload.
|
|
864
|
+
*
|
|
865
|
+
* Ordinary tool-call interrupts use `toolCalls`; ChatKit client-tool middleware
|
|
866
|
+
* uses `clientToolCalls` so the UI can route those calls to the client.
|
|
847
867
|
```json
|
|
848
868
|
{
|
|
849
869
|
"type": "event",
|
|
@@ -877,19 +897,34 @@ export declare type Input = {
|
|
|
877
897
|
}
|
|
878
898
|
```
|
|
879
899
|
*/
|
|
880
|
-
export declare interface InterruptPayload {
|
|
881
|
-
tasks: Array<{
|
|
882
|
-
id: string;
|
|
883
|
-
name: string;
|
|
884
|
-
path: string[];
|
|
885
|
-
interrupts: Array<{
|
|
886
|
-
id: string;
|
|
887
|
-
value: ClientToolRequest;
|
|
888
|
-
}>;
|
|
889
|
-
}>;
|
|
900
|
+
export declare interface InterruptPayload extends LangGraphInterruptPayload<InterruptRequest> {
|
|
890
901
|
}
|
|
891
902
|
|
|
892
|
-
export declare
|
|
903
|
+
export declare type InterruptRequest = ToolCallRequest | ClientToolRequest;
|
|
904
|
+
|
|
905
|
+
export declare function isClientToolInterrupt(value: unknown): value is ClientToolInterrupt;
|
|
906
|
+
|
|
907
|
+
export declare function isClientToolInterruptPayload(value: unknown): value is ClientToolInterruptPayload;
|
|
908
|
+
|
|
909
|
+
export declare function isClientToolInterruptTask(value: unknown): value is ClientToolInterruptTask;
|
|
910
|
+
|
|
911
|
+
export declare function isClientToolRequest(value: unknown): value is ClientToolRequest;
|
|
912
|
+
|
|
913
|
+
export declare function isInterruptRequest(value: unknown): value is InterruptRequest;
|
|
914
|
+
|
|
915
|
+
export declare function isLangGraphInterrupt(value: unknown): value is LangGraphInterrupt;
|
|
916
|
+
|
|
917
|
+
export declare function isLangGraphInterruptPayload(value: unknown): value is LangGraphInterruptPayload;
|
|
918
|
+
|
|
919
|
+
export declare function isLangGraphInterruptTask(value: unknown): value is LangGraphInterruptTask;
|
|
920
|
+
|
|
921
|
+
export declare function isToolCallInterrupt(value: unknown): value is ToolCallInterrupt;
|
|
922
|
+
|
|
923
|
+
export declare function isToolCallInterruptPayload(value: unknown): value is ToolCallInterruptPayload;
|
|
924
|
+
|
|
925
|
+
export declare function isToolCallInterruptTask(value: unknown): value is ToolCallInterruptTask;
|
|
926
|
+
|
|
927
|
+
export declare function isToolCallRequest(value: unknown): value is ToolCallRequest;
|
|
893
928
|
|
|
894
929
|
declare type Justification = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly' | 'stretch';
|
|
895
930
|
|
|
@@ -905,6 +940,25 @@ export declare type Label = {
|
|
|
905
940
|
color?: string | ThemeColor;
|
|
906
941
|
};
|
|
907
942
|
|
|
943
|
+
export declare interface LangGraphInterrupt<TValue = unknown> {
|
|
944
|
+
id: string;
|
|
945
|
+
value: TValue;
|
|
946
|
+
when?: string;
|
|
947
|
+
resumable?: boolean;
|
|
948
|
+
ns?: string[];
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
export declare interface LangGraphInterruptPayload<TValue = unknown> {
|
|
952
|
+
tasks: Array<LangGraphInterruptTask<TValue>>;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
export declare interface LangGraphInterruptTask<TValue = unknown> {
|
|
956
|
+
id: string;
|
|
957
|
+
name: string;
|
|
958
|
+
path: Array<string | number>;
|
|
959
|
+
interrupts: Array<LangGraphInterrupt<TValue>>;
|
|
960
|
+
}
|
|
961
|
+
|
|
908
962
|
export declare type ListView = {
|
|
909
963
|
type: 'ListView';
|
|
910
964
|
key?: string;
|
|
@@ -979,6 +1033,50 @@ export declare type RadioGroup = {
|
|
|
979
1033
|
|
|
980
1034
|
declare type RadiusValue = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | 'full' | '100%' | 'none';
|
|
981
1035
|
|
|
1036
|
+
export declare const REQUEST_USER_INPUT_TOOL_NAME = "request_user_input";
|
|
1037
|
+
|
|
1038
|
+
export declare interface RequestUserInputAnswer {
|
|
1039
|
+
id: string;
|
|
1040
|
+
question: string;
|
|
1041
|
+
value: string;
|
|
1042
|
+
type: RequestUserInputAnswerType;
|
|
1043
|
+
label?: string;
|
|
1044
|
+
description?: string;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
export declare type RequestUserInputAnswerType = 'option' | 'other';
|
|
1048
|
+
|
|
1049
|
+
export declare interface RequestUserInputOption {
|
|
1050
|
+
label: string;
|
|
1051
|
+
description: string;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
export declare interface RequestUserInputParams {
|
|
1055
|
+
questions: RequestUserInputQuestion[];
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
export declare interface RequestUserInputQuestion {
|
|
1059
|
+
id: string;
|
|
1060
|
+
header: string;
|
|
1061
|
+
question: string;
|
|
1062
|
+
options: RequestUserInputOption[];
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
export declare interface RequestUserInputResult {
|
|
1066
|
+
answers: RequestUserInputAnswer[];
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
export declare type RequestUserInputToolArgs = RequestUserInputParams;
|
|
1070
|
+
|
|
1071
|
+
export declare type RequestUserInputToolCall = ToolCall & {
|
|
1072
|
+
name: RequestUserInputToolName;
|
|
1073
|
+
args: RequestUserInputToolArgs;
|
|
1074
|
+
id: string;
|
|
1075
|
+
type?: 'tool_call';
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1078
|
+
export declare type RequestUserInputToolName = typeof REQUEST_USER_INPUT_TOOL_NAME;
|
|
1079
|
+
|
|
982
1080
|
export declare type Row = {
|
|
983
1081
|
type: 'Row';
|
|
984
1082
|
key?: string;
|
|
@@ -1007,12 +1105,17 @@ export declare type Select = {
|
|
|
1007
1105
|
|
|
1008
1106
|
export declare type SendUserMessageParams = {
|
|
1009
1107
|
text?: string;
|
|
1108
|
+
content?: UserMessageContent[];
|
|
1010
1109
|
state?: Record<string, any>;
|
|
1011
1110
|
reply?: string;
|
|
1012
1111
|
attachments?: Attachment[];
|
|
1013
1112
|
newThread?: boolean;
|
|
1014
1113
|
references?: ChatKitReference[];
|
|
1015
1114
|
referenceComposition?: ChatKitReferenceCompositionMode;
|
|
1115
|
+
toolChoice?: ToolChoice;
|
|
1116
|
+
model?: string;
|
|
1117
|
+
planMode?: boolean;
|
|
1118
|
+
trigger?: WorkflowTriggerParams;
|
|
1016
1119
|
followUpMode?: 'default' | FollowUpBehavior;
|
|
1017
1120
|
};
|
|
1018
1121
|
|
|
@@ -1105,6 +1208,7 @@ export declare type TChatRequestHuman = {
|
|
|
1105
1208
|
files?: Partial<File>[];
|
|
1106
1209
|
references?: ChatKitReference[];
|
|
1107
1210
|
referenceComposition?: ChatKitReferenceCompositionMode;
|
|
1211
|
+
planMode?: boolean;
|
|
1108
1212
|
[key: string]: unknown;
|
|
1109
1213
|
};
|
|
1110
1214
|
|
|
@@ -1232,7 +1336,7 @@ export declare type TMessageComponentStep<T = unknown> = {
|
|
|
1232
1336
|
error?: string;
|
|
1233
1337
|
data?: T;
|
|
1234
1338
|
input?: any;
|
|
1235
|
-
output?:
|
|
1339
|
+
output?: unknown;
|
|
1236
1340
|
artifact?: any;
|
|
1237
1341
|
};
|
|
1238
1342
|
|
|
@@ -1310,6 +1414,18 @@ export declare type TMessageContentWidget = TMessageContentComponent<TMessageCom
|
|
|
1310
1414
|
|
|
1311
1415
|
export declare type TMessageItems = TMessageContentComplex[];
|
|
1312
1416
|
|
|
1417
|
+
export declare type ToolCallInterrupt<TRequest extends ToolCallRequest = ToolCallRequest> = LangGraphInterrupt<TRequest>;
|
|
1418
|
+
|
|
1419
|
+
export declare type ToolCallInterruptPayload<TRequest extends ToolCallRequest = ToolCallRequest> = LangGraphInterruptPayload<TRequest>;
|
|
1420
|
+
|
|
1421
|
+
export declare type ToolCallInterruptTask<TRequest extends ToolCallRequest = ToolCallRequest> = LangGraphInterruptTask<TRequest>;
|
|
1422
|
+
|
|
1423
|
+
export declare interface ToolCallRequest {
|
|
1424
|
+
toolCalls: ToolCall[];
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
export declare type ToolChoice = unknown;
|
|
1428
|
+
|
|
1313
1429
|
export declare type ToolOption = {
|
|
1314
1430
|
id: string;
|
|
1315
1431
|
/** Label displayed in the tool menu */
|
|
@@ -1361,6 +1477,8 @@ export declare type TThreadContextUsageMetrics = {
|
|
|
1361
1477
|
currency?: string | null;
|
|
1362
1478
|
};
|
|
1363
1479
|
|
|
1480
|
+
export declare type UserMessageContent = unknown;
|
|
1481
|
+
|
|
1364
1482
|
export declare type WidgetComponent = TextComponent | Title | Caption | Badge | Markdown | Box | Row | Col | Divider | Icon | Image_2 | Button | Checkbox | Spacer | Select | DatePicker | Form | Input | Label | RadioGroup | Textarea | Transition;
|
|
1365
1483
|
|
|
1366
1484
|
export declare type WidgetIcon = 'agent' | 'analytics' | 'atom' | 'batch' | 'bolt' | 'book-open' | 'book-closed' | 'book-clock' | 'bug' | 'calendar' | 'chart' | 'check' | 'check-circle' | 'check-circle-filled' | 'chevron-left' | 'chevron-right' | 'circle-question' | 'compass' | 'confetti' | 'cube' | 'desktop' | 'document' | 'dot' | 'dots-horizontal' | 'dots-vertical' | 'empty-circle' | 'external-link' | 'globe' | 'keys' | 'lab' | 'images' | 'info' | 'lifesaver' | 'lightbulb' | 'mail' | 'map-pin' | 'maps' | 'mobile' | 'name' | 'notebook' | 'notebook-pencil' | 'page-blank' | 'phone' | 'play' | 'plus' | 'profile' | 'profile-card' | 'reload' | 'star' | 'star-filled' | 'search' | 'sparkle' | 'sparkle-double' | 'square-code' | 'square-image' | 'square-text' | 'suitcase' | 'settings-slider' | 'user' | 'wreath' | 'write' | 'write-alt' | 'write-alt2';
|
|
@@ -1410,6 +1528,11 @@ declare type WidgetStatus = {
|
|
|
1410
1528
|
icon?: WidgetIcon;
|
|
1411
1529
|
};
|
|
1412
1530
|
|
|
1531
|
+
export declare type WorkflowTriggerParams = {
|
|
1532
|
+
name?: string;
|
|
1533
|
+
params?: Record<string, any>;
|
|
1534
|
+
} | Record<string, any>;
|
|
1535
|
+
|
|
1413
1536
|
/**
|
|
1414
1537
|
* A Web Component that serves as the entry point for a ChatKit integration.
|
|
1415
1538
|
* * @noInheritDoc
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,49 @@
|
|
|
1
1
|
import "@langchain/core/messages/tool";
|
|
2
2
|
import "@a2ui/lit/0.8";
|
|
3
|
+
const REQUEST_USER_INPUT_TOOL_NAME = "request_user_input";
|
|
4
|
+
function isRecord(value) {
|
|
5
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6
|
+
}
|
|
3
7
|
function isClientToolRequest(value) {
|
|
4
|
-
return value && Array.isArray(value.clientToolCalls);
|
|
8
|
+
return isRecord(value) && Array.isArray(value.clientToolCalls);
|
|
9
|
+
}
|
|
10
|
+
function isToolCallRequest(value) {
|
|
11
|
+
return isRecord(value) && Array.isArray(value.toolCalls);
|
|
12
|
+
}
|
|
13
|
+
function isInterruptRequest(value) {
|
|
14
|
+
return isToolCallRequest(value) || isClientToolRequest(value);
|
|
15
|
+
}
|
|
16
|
+
function isLangGraphInterrupt(value) {
|
|
17
|
+
return isRecord(value) && typeof value.id === "string" && Object.prototype.hasOwnProperty.call(value, "value");
|
|
18
|
+
}
|
|
19
|
+
function isLangGraphInterruptTask(value) {
|
|
20
|
+
if (!isRecord(value) || typeof value.id !== "string" || typeof value.name !== "string" || !Array.isArray(value.path) || !Array.isArray(value.interrupts)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return value.path.every(
|
|
24
|
+
(item) => typeof item === "string" || typeof item === "number"
|
|
25
|
+
) && value.interrupts.every(isLangGraphInterrupt);
|
|
26
|
+
}
|
|
27
|
+
function isLangGraphInterruptPayload(value) {
|
|
28
|
+
return isRecord(value) && Array.isArray(value.tasks) && value.tasks.every(isLangGraphInterruptTask);
|
|
29
|
+
}
|
|
30
|
+
function isClientToolInterrupt(value) {
|
|
31
|
+
return isLangGraphInterrupt(value) && isClientToolRequest(value.value);
|
|
32
|
+
}
|
|
33
|
+
function isClientToolInterruptTask(value) {
|
|
34
|
+
return isLangGraphInterruptTask(value) && value.interrupts.every(isClientToolInterrupt);
|
|
35
|
+
}
|
|
36
|
+
function isClientToolInterruptPayload(value) {
|
|
37
|
+
return isLangGraphInterruptPayload(value) && value.tasks.every(isClientToolInterruptTask);
|
|
38
|
+
}
|
|
39
|
+
function isToolCallInterrupt(value) {
|
|
40
|
+
return isLangGraphInterrupt(value) && isToolCallRequest(value.value);
|
|
41
|
+
}
|
|
42
|
+
function isToolCallInterruptTask(value) {
|
|
43
|
+
return isLangGraphInterruptTask(value) && value.interrupts.every(isToolCallInterrupt);
|
|
44
|
+
}
|
|
45
|
+
function isToolCallInterruptPayload(value) {
|
|
46
|
+
return isLangGraphInterruptPayload(value) && value.tasks.every(isToolCallInterruptTask);
|
|
5
47
|
}
|
|
6
48
|
var ChatMessageTypeEnum = /* @__PURE__ */ ((ChatMessageTypeEnum2) => {
|
|
7
49
|
ChatMessageTypeEnum2["MESSAGE"] = "message";
|
|
@@ -47,7 +89,19 @@ export {
|
|
|
47
89
|
ChatMessageEventTypeEnum,
|
|
48
90
|
ChatMessageStepCategory,
|
|
49
91
|
ChatMessageTypeEnum,
|
|
92
|
+
REQUEST_USER_INPUT_TOOL_NAME,
|
|
50
93
|
STATE_VARIABLE_HUMAN,
|
|
51
|
-
|
|
94
|
+
isClientToolInterrupt,
|
|
95
|
+
isClientToolInterruptPayload,
|
|
96
|
+
isClientToolInterruptTask,
|
|
97
|
+
isClientToolRequest,
|
|
98
|
+
isInterruptRequest,
|
|
99
|
+
isLangGraphInterrupt,
|
|
100
|
+
isLangGraphInterruptPayload,
|
|
101
|
+
isLangGraphInterruptTask,
|
|
102
|
+
isToolCallInterrupt,
|
|
103
|
+
isToolCallInterruptPayload,
|
|
104
|
+
isToolCallInterruptTask,
|
|
105
|
+
isToolCallRequest
|
|
52
106
|
};
|
|
53
107
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/interrupt.ts","../src/message.ts"],"sourcesContent":["import { type ToolCall } from '@langchain/core/messages/tool';\n\n/**\n * When an interrupt occurs during task execution, the system generates an InterruptPayload.\n```json\n{\n \"type\": \"event\",\n \"event\": \"on_interrupt\",\n \"data\": {\n \"tasks\": [\n {\n \"id\": \"9c4d2ac5-8808-5b6f-855c-4d48aa3d77a7\",\n \"name\": \"Middleware_wPzR2bIXqE_after_model\",\n \"path\": [\"__pregel_pull\", \"Middleware_wPzR2bIXqE_after_model\"],\n \"interrupts\": [\n {\n \"id\": \"b42f7887d65e57ed11cf08b8927763db\",\n \"value\": {\n \"toolCalls\": [\n {\n \"name\": \"getUserStation\",\n \"args\": {\n \"input\": \"Query the site selected by the user\"\n },\n \"id\": \"call_00_swcaUjIaACXOHHaZyNmQB3Vm\",\n \"type\": \"tool_call\"\n }\n ]\n }\n }\n ]\n }\n ]\n }\n}\n```\n */\nexport interface InterruptPayload {\n tasks: Array<{\n id: string;\n name: string;\n path: string[];\n interrupts: Array<{\n id: string;\n value: ClientToolRequest\n }>;\n }>;\n}\n\nexport interface ClientToolRequest {\n clientToolCalls: ToolCall[];\n}\n\nexport interface ClientToolMessageInput {\n content: unknown\n name?: string\n tool_call_id?: string\n status?: 'success' | 'error'\n artifact?: unknown\n}\n\nexport interface ClientToolResponse {\n toolMessages: ClientToolMessageInput[]\n}\n\nexport function isClientToolRequest(value: any): value is ClientToolRequest {\n return (\n value &&\n Array.isArray(value.clientToolCalls)\n );\n}","import type { ToolCall } from '@langchain/core/messages/tool';\nimport { Types } from '@a2ui/lit/0.8';\nimport type { FollowUpBehavior } from './options';\n\nexport enum ChatMessageTypeEnum {\n // LOG = 'log',\n MESSAGE = 'message',\n EVENT = 'event',\n}\n\n/**\n * https://js.langchain.com/docs/how_to/streaming/#event-reference\n */\nexport enum ChatMessageEventTypeEnum {\n ON_CONVERSATION_START = 'on_conversation_start',\n ON_CONVERSATION_END = 'on_conversation_end',\n ON_MESSAGE_START = 'on_message_start',\n ON_MESSAGE_END = 'on_message_end',\n ON_TOOL_START = 'on_tool_start',\n ON_TOOL_END = 'on_tool_end',\n ON_TOOL_ERROR = 'on_tool_error',\n /**\n * Step message in tool call\n */\n ON_TOOL_MESSAGE = 'on_tool_message',\n ON_AGENT_START = 'on_agent_start',\n ON_AGENT_END = 'on_agent_end',\n ON_RETRIEVER_START = 'on_retriever_start',\n ON_RETRIEVER_END = 'on_retriever_end',\n ON_RETRIEVER_ERROR = 'on_retriever_error',\n ON_INTERRUPT = 'on_interrupt',\n ON_ERROR = 'on_error',\n ON_CHAT_EVENT = 'on_chat_event',\n\n ON_CLIENT_EFFECT = 'on_client_effect',\n}\n\n/**\n * Encapsulate multi-agent message events\n */\nexport interface ChatEventEnvelope<T = unknown> {\n type: ChatMessageTypeEnum;\n event?: ChatMessageEventTypeEnum;\n tags: string[];\n data: T;\n}\n\n/**\n * Category of step message: determines the display components of computer use\n */\nexport enum ChatMessageStepCategory {\n /**\n * List of items: urls, files, etc.\n */\n List = 'list',\n /**\n * Websearch results\n */\n WebSearch = 'web_search',\n /**\n * Files list\n */\n Files = 'files',\n /**\n * View a file\n */\n File = 'file',\n /**\n * Program Execution\n */\n Program = 'program',\n /**\n * Iframe\n */\n Iframe = 'iframe',\n\n Memory = 'memory',\n\n Tasks = 'tasks',\n\n /**\n * Knowledges (knowledge base retriever results)\n */\n Knowledges = 'knowledges',\n}\n\n/**\n * Step message type, in canvas and ai message.\n */\nexport type TChatMessageStep<T = any> = TMessageComponent<\n TMessageComponentStep<T>\n>;\n\nexport type ImageDetail = 'auto' | 'low' | 'high';\nexport type MessageContentText = {\n type: 'text';\n text: string;\n};\nexport type MessageContentImageUrl = {\n type: 'image_url';\n image_url:\n | string\n | {\n url: string;\n detail?: ImageDetail;\n };\n};\n\n/**\n * Similar to {@link MessageContentText} | {@link MessageContentImageUrl}, which together form {@link MessageContentComplex}\n */\nexport type TMessageContentComponent<T extends object = object> = {\n id: string;\n type: 'component';\n data: TMessageComponent<T>;\n xpertName?: string;\n agentKey?: string;\n};\n\n/**\n * Defines the data type of the sub-message of `component` type in the message `content` {@link MessageContentComplex}\n */\nexport type TMessageComponent<T extends object = object> = T & {\n id?: string;\n category: 'Dashboard' | 'Computer' | 'Tool';\n type?: string;\n created_date?: Date | string;\n};\n\nexport type TMessageComponentWidgetItem = {\n name: string;\n config: Types.Surface;\n values?: Record<string, unknown>;\n};\n\nexport type TMessageComponentWidgetData = {\n type: 'Widget';\n mode?: string;\n widgets: TMessageComponentWidgetItem[];\n executionId?: string;\n};\n\nexport type TMessageComponentWidget =\n TMessageComponent<TMessageComponentWidgetData>;\n\nexport type TMessageContentWidget =\n TMessageContentComponent<TMessageComponentWidgetData>;\n\nexport type TMessageContentText = {\n id?: string;\n xpertName?: string;\n agentKey?: string;\n type: 'text';\n text: string;\n};\nexport type TMessageContentMemory = {\n id?: string;\n agentKey?: string;\n type: 'memory';\n data: any[];\n};\nexport type TMessageContentReasoning = {\n id?: string;\n xpertName?: string;\n agentKey?: string;\n type: 'reasoning';\n text: string;\n};\n/**\n * Enhance {@link MessageContentComplex} in Langchain.js\n */\nexport type TMessageContentComplex = (\n | TMessageContentText\n | TMessageContentReasoning\n | MessageContentImageUrl\n | TMessageContentComponent\n | TMessageContentMemory\n | (Record<string, any> & {\n type?: 'text' | 'image_url' | string;\n })\n | (Record<string, any> & {\n type?: never;\n })\n) & {\n id?: string;\n xpertName?: string;\n agentKey?: string;\n created_date?: Date | string;\n};\n\n/**\n * Enhance {@link MessageContent} in Langchain.js\n *\n * @deprecated use {@link TMessageItems} instead\n */\nexport type TMessageContent = string | TMessageContentComplex[];\n\nexport type TMessageComponentIframe = {\n type: 'iframe';\n title: string;\n url?: string;\n data?: {\n url?: string;\n };\n};\n\nexport type TMessageComponentStep<T = unknown> = {\n type: ChatMessageStepCategory;\n toolset: string;\n toolset_id: string;\n tool?: string;\n title: string;\n message: string;\n status: 'success' | 'fail' | 'running';\n created_date: Date | string;\n end_date: Date | string;\n error?: string;\n data?: T;\n input?: any;\n output?: string;\n artifact?: any;\n};\n\n/**\n * Data type for chat event message\n */\nexport type TChatEventMessage = {\n type?: string;\n title?: string;\n message?: string;\n status?: 'success' | 'fail' | 'running';\n created_date?: Date | string;\n end_date?: Date | string;\n error?: string;\n};\n\nexport interface ChatkitMessage {\n status?: string;\n content: TMessageItems | string;\n reasoning?: TMessageContentReasoning[];\n type: 'user' | 'assistant' | 'system' | 'tool' | 'event';\n id: string;\n followUpMode?: FollowUpBehavior;\n followUpStatus?: 'pending' | 'consumed' | 'canceled';\n targetExecutionId?: string | null;\n visibleAt?: string | Date | null;\n}\n\nexport type TMessageItems = TMessageContentComplex[];\n\nexport type ChatKitReferenceBase = {\n id?: string;\n label?: string;\n text: string;\n};\n\nexport type ChatKitCodeReference = ChatKitReferenceBase & {\n type: 'code';\n path: string;\n startLine: number;\n endLine: number;\n language?: string;\n taskId?: string;\n};\n\nexport type ChatKitQuoteReference = ChatKitReferenceBase & {\n type: 'quote';\n messageId?: string;\n source?: string;\n};\n\nexport type ChatKitReference = ChatKitCodeReference | ChatKitQuoteReference;\n\nexport type ChatKitReferenceCompositionMode = 'compose' | 'preserve';\n\nexport const STATE_VARIABLE_HUMAN = 'human';\n\n/**\n * Human input message, include parameters and attachments\n */\nexport type TChatRequestHuman = {\n input?: string;\n files?: Partial<File>[];\n references?: ChatKitReference[];\n referenceComposition?: ChatKitReferenceCompositionMode;\n [key: string]: unknown;\n};\n\n/**\n * Command to resume with streaming after human decision\n */\nexport type TInterruptCommand = {\n resume?: any;\n update?: any;\n toolCalls?: ToolCall[];\n agentKey?: string;\n};\n\nexport type TChatRequest = {\n /**\n * The human input, include parameters\n */\n input: TChatRequestHuman;\n /**\n * Custom graph state\n */\n state?: { [STATE_VARIABLE_HUMAN]: TChatRequestHuman } & Record<string, any>;\n agentKey?: string;\n projectId?: string;\n conversationId?: string;\n environmentId?: string;\n id?: string;\n executionId?: string;\n confirm?: boolean;\n command?: TInterruptCommand;\n retry?: boolean;\n followUpMode?: FollowUpBehavior;\n /**\n * PRO: Sandbox Environment Id\n * PRO: @description Sandbox environment ID to force using the specified container.\n */\n sandboxEnvironmentId?: string;\n};\n\n/**\n * Data type for client effect message\n */\nexport type TClientEeffectMessage = {\n name: string;\n args: Record<string, any>;\n tool_call_id?: string;\n agentKey?: string;\n created_date?: Date | string;\n};\n\n// Thread context usage\nexport type TThreadContextUsageMetrics = {\n contextTokens: number;\n inputTokens: number;\n outputTokens: number;\n totalTokens: number;\n embedTokens?: number;\n totalPrice?: number;\n currency?: string | null;\n};\n\nexport type TThreadContextUsageEvent = {\n type: 'thread_context_usage';\n threadId: string;\n runId: string | null;\n agentKey: string;\n updatedAt: string;\n usage: TThreadContextUsageMetrics;\n};\n\nexport const CHAT_EVENT_TYPE_FOLLOW_UP_CONSUMED = 'follow_up_consumed' as const;\n\nexport type TFollowUpConsumedEvent = TChatEventMessage & {\n type: typeof CHAT_EVENT_TYPE_FOLLOW_UP_CONSUMED;\n mode: 'queue' | 'steer';\n messageIds: string[];\n clientMessageIds?: string[];\n executionId?: string | null;\n visibleAt?: string | null;\n};\n"],"names":["ChatMessageTypeEnum","ChatMessageEventTypeEnum","ChatMessageStepCategory"],"mappings":";;AAiEO,SAAS,oBAAoB,OAAwC;AAC1E,SACE,SACA,MAAM,QAAQ,MAAM,eAAe;AAEvC;AClEO,IAAK,wCAAAA,yBAAL;AAELA,uBAAA,SAAA,IAAU;AACVA,uBAAA,OAAA,IAAQ;AAHE,SAAAA;AAAA,GAAA,uBAAA,CAAA,CAAA;AASL,IAAK,6CAAAC,8BAAL;AACLA,4BAAA,uBAAA,IAAwB;AACxBA,4BAAA,qBAAA,IAAsB;AACtBA,4BAAA,kBAAA,IAAmB;AACnBA,4BAAA,gBAAA,IAAiB;AACjBA,4BAAA,eAAA,IAAgB;AAChBA,4BAAA,aAAA,IAAc;AACdA,4BAAA,eAAA,IAAgB;AAIhBA,4BAAA,iBAAA,IAAkB;AAClBA,4BAAA,gBAAA,IAAiB;AACjBA,4BAAA,cAAA,IAAe;AACfA,4BAAA,oBAAA,IAAqB;AACrBA,4BAAA,kBAAA,IAAmB;AACnBA,4BAAA,oBAAA,IAAqB;AACrBA,4BAAA,cAAA,IAAe;AACfA,4BAAA,UAAA,IAAW;AACXA,4BAAA,eAAA,IAAgB;AAEhBA,4BAAA,kBAAA,IAAmB;AArBT,SAAAA;AAAA,GAAA,4BAAA,CAAA,CAAA;AAqCL,IAAK,4CAAAC,6BAAL;AAILA,2BAAA,MAAA,IAAO;AAIPA,2BAAA,WAAA,IAAY;AAIZA,2BAAA,OAAA,IAAQ;AAIRA,2BAAA,MAAA,IAAO;AAIPA,2BAAA,SAAA,IAAU;AAIVA,2BAAA,QAAA,IAAS;AAETA,2BAAA,QAAA,IAAS;AAETA,2BAAA,OAAA,IAAQ;AAKRA,2BAAA,YAAA,IAAa;AAjCH,SAAAA;AAAA,GAAA,2BAAA,CAAA,CAAA;AAiOL,MAAM,uBAAuB;AAgF7B,MAAM,qCAAqC;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/interrupt.ts","../src/message.ts"],"sourcesContent":["import { type ToolCall } from '@langchain/core/messages/tool';\n\nexport const REQUEST_USER_INPUT_TOOL_NAME = 'request_user_input';\nexport type RequestUserInputToolName = typeof REQUEST_USER_INPUT_TOOL_NAME;\n\nexport interface RequestUserInputOption {\n label: string;\n description: string;\n}\n\nexport interface RequestUserInputQuestion {\n id: string;\n header: string;\n question: string;\n options: RequestUserInputOption[];\n}\n\nexport interface RequestUserInputParams {\n questions: RequestUserInputQuestion[];\n}\n\nexport type RequestUserInputToolArgs = RequestUserInputParams;\n\nexport type RequestUserInputAnswerType = 'option' | 'other';\n\nexport interface RequestUserInputAnswer {\n id: string;\n question: string;\n value: string;\n type: RequestUserInputAnswerType;\n label?: string;\n description?: string;\n}\n\nexport interface RequestUserInputResult {\n answers: RequestUserInputAnswer[];\n}\n\nexport type RequestUserInputToolCall = ToolCall & {\n name: RequestUserInputToolName;\n args: RequestUserInputToolArgs;\n id: string;\n type?: 'tool_call';\n};\n\nexport interface ClientToolRequest {\n clientToolCalls: ToolCall[];\n}\n\nexport interface ToolCallRequest {\n toolCalls: ToolCall[];\n}\n\nexport type InterruptRequest = ToolCallRequest | ClientToolRequest;\n\nexport interface LangGraphInterrupt<TValue = unknown> {\n id: string;\n value: TValue;\n when?: string;\n resumable?: boolean;\n ns?: string[];\n}\n\nexport interface LangGraphInterruptTask<TValue = unknown> {\n id: string;\n name: string;\n path: Array<string | number>;\n interrupts: Array<LangGraphInterrupt<TValue>>;\n}\n\nexport interface LangGraphInterruptPayload<TValue = unknown> {\n tasks: Array<LangGraphInterruptTask<TValue>>;\n}\n\nexport type ClientToolInterrupt<\n TRequest extends ClientToolRequest = ClientToolRequest,\n> = LangGraphInterrupt<TRequest>;\n\nexport type ClientToolInterruptTask<\n TRequest extends ClientToolRequest = ClientToolRequest,\n> = LangGraphInterruptTask<TRequest>;\n\nexport type ClientToolInterruptPayload<\n TRequest extends ClientToolRequest = ClientToolRequest,\n> = LangGraphInterruptPayload<TRequest>;\n\nexport type ToolCallInterrupt<\n TRequest extends ToolCallRequest = ToolCallRequest,\n> = LangGraphInterrupt<TRequest>;\n\nexport type ToolCallInterruptTask<\n TRequest extends ToolCallRequest = ToolCallRequest,\n> = LangGraphInterruptTask<TRequest>;\n\nexport type ToolCallInterruptPayload<\n TRequest extends ToolCallRequest = ToolCallRequest,\n> = LangGraphInterruptPayload<TRequest>;\n\n/**\n * When an interrupt occurs during task execution, the system generates an InterruptPayload.\n *\n * Ordinary tool-call interrupts use `toolCalls`; ChatKit client-tool middleware\n * uses `clientToolCalls` so the UI can route those calls to the client.\n```json\n{\n \"type\": \"event\",\n \"event\": \"on_interrupt\",\n \"data\": {\n \"tasks\": [\n {\n \"id\": \"9c4d2ac5-8808-5b6f-855c-4d48aa3d77a7\",\n \"name\": \"Middleware_wPzR2bIXqE_after_model\",\n \"path\": [\"__pregel_pull\", \"Middleware_wPzR2bIXqE_after_model\"],\n \"interrupts\": [\n {\n \"id\": \"b42f7887d65e57ed11cf08b8927763db\",\n \"value\": {\n \"toolCalls\": [\n {\n \"name\": \"getUserStation\",\n \"args\": {\n \"input\": \"Query the site selected by the user\"\n },\n \"id\": \"call_00_swcaUjIaACXOHHaZyNmQB3Vm\",\n \"type\": \"tool_call\"\n }\n ]\n }\n }\n ]\n }\n ]\n }\n}\n```\n */\nexport interface InterruptPayload extends LangGraphInterruptPayload<InterruptRequest> {}\n\nexport interface ClientToolMessageInput {\n content: unknown;\n name?: string;\n tool_call_id?: string;\n status?: 'success' | 'error';\n artifact?: unknown;\n}\n\nexport interface ClientToolResponse {\n toolMessages: ClientToolMessageInput[];\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value);\n}\n\nexport function isClientToolRequest(\n value: unknown,\n): value is ClientToolRequest {\n return isRecord(value) && Array.isArray(value.clientToolCalls);\n}\n\nexport function isToolCallRequest(value: unknown): value is ToolCallRequest {\n return isRecord(value) && Array.isArray(value.toolCalls);\n}\n\nexport function isInterruptRequest(value: unknown): value is InterruptRequest {\n return isToolCallRequest(value) || isClientToolRequest(value);\n}\n\nexport function isLangGraphInterrupt(\n value: unknown,\n): value is LangGraphInterrupt {\n return (\n isRecord(value) &&\n typeof value.id === 'string' &&\n Object.prototype.hasOwnProperty.call(value, 'value')\n );\n}\n\nexport function isLangGraphInterruptTask(\n value: unknown,\n): value is LangGraphInterruptTask {\n if (\n !isRecord(value) ||\n typeof value.id !== 'string' ||\n typeof value.name !== 'string' ||\n !Array.isArray(value.path) ||\n !Array.isArray(value.interrupts)\n ) {\n return false;\n }\n\n return (\n value.path.every(\n (item) => typeof item === 'string' || typeof item === 'number',\n ) && value.interrupts.every(isLangGraphInterrupt)\n );\n}\n\nexport function isLangGraphInterruptPayload(\n value: unknown,\n): value is LangGraphInterruptPayload {\n return (\n isRecord(value) &&\n Array.isArray(value.tasks) &&\n value.tasks.every(isLangGraphInterruptTask)\n );\n}\n\nexport function isClientToolInterrupt(\n value: unknown,\n): value is ClientToolInterrupt {\n return isLangGraphInterrupt(value) && isClientToolRequest(value.value);\n}\n\nexport function isClientToolInterruptTask(\n value: unknown,\n): value is ClientToolInterruptTask {\n return (\n isLangGraphInterruptTask(value) &&\n value.interrupts.every(isClientToolInterrupt)\n );\n}\n\nexport function isClientToolInterruptPayload(\n value: unknown,\n): value is ClientToolInterruptPayload {\n return (\n isLangGraphInterruptPayload(value) &&\n value.tasks.every(isClientToolInterruptTask)\n );\n}\n\nexport function isToolCallInterrupt(\n value: unknown,\n): value is ToolCallInterrupt {\n return isLangGraphInterrupt(value) && isToolCallRequest(value.value);\n}\n\nexport function isToolCallInterruptTask(\n value: unknown,\n): value is ToolCallInterruptTask {\n return (\n isLangGraphInterruptTask(value) &&\n value.interrupts.every(isToolCallInterrupt)\n );\n}\n\nexport function isToolCallInterruptPayload(\n value: unknown,\n): value is ToolCallInterruptPayload {\n return (\n isLangGraphInterruptPayload(value) &&\n value.tasks.every(isToolCallInterruptTask)\n );\n}\n","import type { ToolCall } from '@langchain/core/messages/tool';\nimport { Types } from '@a2ui/lit/0.8';\nimport type { FollowUpBehavior } from './options';\n\nexport enum ChatMessageTypeEnum {\n // LOG = 'log',\n MESSAGE = 'message',\n EVENT = 'event',\n}\n\n/**\n * https://js.langchain.com/docs/how_to/streaming/#event-reference\n */\nexport enum ChatMessageEventTypeEnum {\n ON_CONVERSATION_START = 'on_conversation_start',\n ON_CONVERSATION_END = 'on_conversation_end',\n ON_MESSAGE_START = 'on_message_start',\n ON_MESSAGE_END = 'on_message_end',\n ON_TOOL_START = 'on_tool_start',\n ON_TOOL_END = 'on_tool_end',\n ON_TOOL_ERROR = 'on_tool_error',\n /**\n * Step message in tool call\n */\n ON_TOOL_MESSAGE = 'on_tool_message',\n ON_AGENT_START = 'on_agent_start',\n ON_AGENT_END = 'on_agent_end',\n ON_RETRIEVER_START = 'on_retriever_start',\n ON_RETRIEVER_END = 'on_retriever_end',\n ON_RETRIEVER_ERROR = 'on_retriever_error',\n ON_INTERRUPT = 'on_interrupt',\n ON_ERROR = 'on_error',\n ON_CHAT_EVENT = 'on_chat_event',\n\n ON_CLIENT_EFFECT = 'on_client_effect',\n}\n\n/**\n * Encapsulate multi-agent message events\n */\nexport interface ChatEventEnvelope<T = unknown> {\n type: ChatMessageTypeEnum;\n event?: ChatMessageEventTypeEnum;\n tags: string[];\n data: T;\n}\n\n/**\n * Category of step message: determines the display components of computer use\n */\nexport enum ChatMessageStepCategory {\n /**\n * List of items: urls, files, etc.\n */\n List = 'list',\n /**\n * Websearch results\n */\n WebSearch = 'web_search',\n /**\n * Files list\n */\n Files = 'files',\n /**\n * View a file\n */\n File = 'file',\n /**\n * Program Execution\n */\n Program = 'program',\n /**\n * Iframe\n */\n Iframe = 'iframe',\n\n Memory = 'memory',\n\n Tasks = 'tasks',\n\n /**\n * Knowledges (knowledge base retriever results)\n */\n Knowledges = 'knowledges',\n}\n\n/**\n * Step message type, in canvas and ai message.\n */\nexport type TChatMessageStep<T = any> = TMessageComponent<\n TMessageComponentStep<T>\n>;\n\nexport type ImageDetail = 'auto' | 'low' | 'high';\nexport type MessageContentText = {\n type: 'text';\n text: string;\n};\nexport type MessageContentImageUrl = {\n type: 'image_url';\n image_url:\n | string\n | {\n url: string;\n detail?: ImageDetail;\n };\n};\n\n/**\n * Similar to {@link MessageContentText} | {@link MessageContentImageUrl}, which together form {@link MessageContentComplex}\n */\nexport type TMessageContentComponent<T extends object = object> = {\n id: string;\n type: 'component';\n data: TMessageComponent<T>;\n xpertName?: string;\n agentKey?: string;\n};\n\n/**\n * Defines the data type of the sub-message of `component` type in the message `content` {@link MessageContentComplex}\n */\nexport type TMessageComponent<T extends object = object> = T & {\n id?: string;\n category: 'Dashboard' | 'Computer' | 'Tool';\n type?: string;\n created_date?: Date | string;\n};\n\nexport type TMessageComponentWidgetItem = {\n name: string;\n config: Types.Surface;\n values?: Record<string, unknown>;\n};\n\nexport type TMessageComponentWidgetData = {\n type: 'Widget';\n mode?: string;\n widgets: TMessageComponentWidgetItem[];\n executionId?: string;\n};\n\nexport type TMessageComponentWidget =\n TMessageComponent<TMessageComponentWidgetData>;\n\nexport type TMessageContentWidget =\n TMessageContentComponent<TMessageComponentWidgetData>;\n\nexport type TMessageContentText = {\n id?: string;\n xpertName?: string;\n agentKey?: string;\n type: 'text';\n text: string;\n};\nexport type TMessageContentMemory = {\n id?: string;\n agentKey?: string;\n type: 'memory';\n data: any[];\n};\nexport type TMessageContentReasoning = {\n id?: string;\n xpertName?: string;\n agentKey?: string;\n type: 'reasoning';\n text: string;\n};\n/**\n * Enhance {@link MessageContentComplex} in Langchain.js\n */\nexport type TMessageContentComplex = (\n | TMessageContentText\n | TMessageContentReasoning\n | MessageContentImageUrl\n | TMessageContentComponent\n | TMessageContentMemory\n | (Record<string, any> & {\n type?: 'text' | 'image_url' | string;\n })\n | (Record<string, any> & {\n type?: never;\n })\n) & {\n id?: string;\n xpertName?: string;\n agentKey?: string;\n created_date?: Date | string;\n};\n\n/**\n * Enhance {@link MessageContent} in Langchain.js\n *\n * @deprecated use {@link TMessageItems} instead\n */\nexport type TMessageContent = string | TMessageContentComplex[];\n\nexport type TMessageComponentIframe = {\n type: 'iframe';\n title: string;\n url?: string;\n data?: {\n url?: string;\n };\n};\n\nexport type TMessageComponentStep<T = unknown> = {\n type: ChatMessageStepCategory;\n toolset: string;\n toolset_id: string;\n tool?: string;\n title: string;\n message: string;\n status: 'success' | 'fail' | 'running';\n created_date: Date | string;\n end_date: Date | string;\n error?: string;\n data?: T;\n input?: any;\n output?: unknown;\n artifact?: any;\n};\n\n/**\n * Data type for chat event message\n */\nexport type TChatEventMessage = {\n type?: string;\n title?: string;\n message?: string;\n status?: 'success' | 'fail' | 'running';\n created_date?: Date | string;\n end_date?: Date | string;\n error?: string;\n};\n\nexport interface ChatkitMessage {\n status?: string;\n content: TMessageItems | string;\n reasoning?: TMessageContentReasoning[];\n type: 'user' | 'assistant' | 'system' | 'tool' | 'event';\n id: string;\n followUpMode?: FollowUpBehavior;\n followUpStatus?: 'pending' | 'consumed' | 'canceled';\n targetExecutionId?: string | null;\n visibleAt?: string | Date | null;\n}\n\nexport type TMessageItems = TMessageContentComplex[];\n\nexport type ChatKitReferenceBase = {\n id?: string;\n label?: string;\n text: string;\n};\n\nexport type ChatKitCodeReference = ChatKitReferenceBase & {\n type: 'code';\n path: string;\n startLine: number;\n endLine: number;\n language?: string;\n taskId?: string;\n};\n\nexport type ChatKitQuoteReference = ChatKitReferenceBase & {\n type: 'quote';\n messageId?: string;\n source?: string;\n};\n\nexport type ChatKitImageReference = ChatKitReferenceBase & {\n type: 'image';\n fileId?: string;\n url?: string;\n mimeType?: string;\n name?: string;\n size?: number;\n width?: number;\n height?: number;\n};\n\nexport type ChatKitReference =\n | ChatKitCodeReference\n | ChatKitQuoteReference\n | ChatKitImageReference;\n\nexport type ChatKitReferenceCompositionMode = 'compose' | 'preserve';\n\nexport const STATE_VARIABLE_HUMAN = 'human';\n\n/**\n * Human input message, include parameters and attachments\n */\nexport type TChatRequestHuman = {\n input?: string;\n files?: Partial<File>[];\n references?: ChatKitReference[];\n referenceComposition?: ChatKitReferenceCompositionMode;\n planMode?: boolean;\n [key: string]: unknown;\n};\n\n/**\n * Command to resume with streaming after human decision\n */\nexport type TInterruptCommand = {\n resume?: any;\n update?: any;\n toolCalls?: ToolCall[];\n agentKey?: string;\n};\n\nexport type TChatRequest = {\n /**\n * The human input, include parameters\n */\n input: TChatRequestHuman;\n /**\n * Custom graph state\n */\n state?: { [STATE_VARIABLE_HUMAN]: TChatRequestHuman } & Record<string, any>;\n agentKey?: string;\n projectId?: string;\n conversationId?: string;\n environmentId?: string;\n id?: string;\n executionId?: string;\n confirm?: boolean;\n command?: TInterruptCommand;\n retry?: boolean;\n followUpMode?: FollowUpBehavior;\n /**\n * PRO: Sandbox Environment Id\n * PRO: @description Sandbox environment ID to force using the specified container.\n */\n sandboxEnvironmentId?: string;\n};\n\n/**\n * Data type for client effect message\n */\nexport type TClientEeffectMessage = {\n name: string;\n args: Record<string, any>;\n tool_call_id?: string;\n agentKey?: string;\n created_date?: Date | string;\n};\n\n// Thread context usage\nexport type TThreadContextUsageMetrics = {\n contextTokens: number;\n inputTokens: number;\n outputTokens: number;\n totalTokens: number;\n embedTokens?: number;\n totalPrice?: number;\n currency?: string | null;\n};\n\nexport type TThreadContextUsageEvent = {\n type: 'thread_context_usage';\n threadId: string;\n runId: string | null;\n agentKey: string;\n updatedAt: string;\n usage: TThreadContextUsageMetrics;\n};\n\nexport const CHAT_EVENT_TYPE_FOLLOW_UP_CONSUMED = 'follow_up_consumed' as const;\n\nexport type TFollowUpConsumedEvent = TChatEventMessage & {\n type: typeof CHAT_EVENT_TYPE_FOLLOW_UP_CONSUMED;\n mode: 'queue' | 'steer';\n messageIds: string[];\n clientMessageIds?: string[];\n executionId?: string | null;\n visibleAt?: string | null;\n};\n"],"names":["ChatMessageTypeEnum","ChatMessageEventTypeEnum","ChatMessageStepCategory"],"mappings":"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"}
|