@dremio/js-sdk 0.43.1 → 0.45.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/README.md +0 -1
- package/dist/cloud/ai/AIResource.d.ts +76 -1
- package/dist/enterprise/ai/AIResource.d.ts +76 -1
- package/dist/enterprise/ai/chat/chatEventSchema.d.ts +19 -0
- package/dist/enterprise/ai/chat/chatEventSchema.js +16 -0
- package/dist/enterprise/ai/chat/chatEventSchema.js.map +1 -1
- package/dist/enterprise/ai/conversations/AgentConversation.d.ts +22 -0
- package/dist/enterprise/ai/conversations/createConversationMachine.d.ts +88 -1
- package/dist/enterprise/ai/conversations/createConversationMachine.js +59 -33
- package/dist/enterprise/ai/conversations/createConversationMachine.js.map +1 -1
- package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.d.ts +11 -0
- package/dist/enterprise/ai/conversations/reduceChatEvents.d.ts +1 -1
- package/dist/enterprise/ai/conversations/reduceChatEvents.js +8 -0
- package/dist/enterprise/ai/conversations/reduceChatEvents.js.map +1 -1
- package/dist-iife/cloud.js +81 -31
- package/dist-iife/enterprise.js +81 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,6 +125,17 @@ export declare class AIResource {
|
|
|
125
125
|
message: string;
|
|
126
126
|
};
|
|
127
127
|
role: "agent";
|
|
128
|
+
} | {
|
|
129
|
+
conversationId: string;
|
|
130
|
+
modelName: string;
|
|
131
|
+
modelProviderId: string;
|
|
132
|
+
runId: string;
|
|
133
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
134
|
+
id: string;
|
|
135
|
+
content: {
|
|
136
|
+
chunkType: "endOfStream";
|
|
137
|
+
};
|
|
138
|
+
role: "agent";
|
|
128
139
|
} | {
|
|
129
140
|
conversationId: string;
|
|
130
141
|
modelName: string;
|
|
@@ -221,6 +232,17 @@ export declare class AIResource {
|
|
|
221
232
|
message: string;
|
|
222
233
|
};
|
|
223
234
|
role: "agent";
|
|
235
|
+
} | {
|
|
236
|
+
conversationId: string;
|
|
237
|
+
modelName: string;
|
|
238
|
+
modelProviderId: string;
|
|
239
|
+
runId: string;
|
|
240
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
241
|
+
id: string;
|
|
242
|
+
content: {
|
|
243
|
+
chunkType: "endOfStream";
|
|
244
|
+
};
|
|
245
|
+
role: "agent";
|
|
224
246
|
} | {
|
|
225
247
|
conversationId: string;
|
|
226
248
|
modelName: string;
|
|
@@ -324,6 +346,17 @@ export declare class AIResource {
|
|
|
324
346
|
message: string;
|
|
325
347
|
};
|
|
326
348
|
role: "agent";
|
|
349
|
+
} | {
|
|
350
|
+
conversationId: string;
|
|
351
|
+
modelName: string;
|
|
352
|
+
modelProviderId: string;
|
|
353
|
+
runId: string;
|
|
354
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
355
|
+
id: string;
|
|
356
|
+
content: {
|
|
357
|
+
chunkType: "endOfStream";
|
|
358
|
+
};
|
|
359
|
+
role: "agent";
|
|
327
360
|
} | {
|
|
328
361
|
conversationId: string;
|
|
329
362
|
modelName: string;
|
|
@@ -435,6 +468,17 @@ export declare class AIResource {
|
|
|
435
468
|
message: string;
|
|
436
469
|
};
|
|
437
470
|
role: "agent";
|
|
471
|
+
} | {
|
|
472
|
+
conversationId: string;
|
|
473
|
+
modelName: string;
|
|
474
|
+
modelProviderId: string;
|
|
475
|
+
runId: string;
|
|
476
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
477
|
+
id: string;
|
|
478
|
+
content: {
|
|
479
|
+
chunkType: "endOfStream";
|
|
480
|
+
};
|
|
481
|
+
role: "agent";
|
|
438
482
|
} | {
|
|
439
483
|
conversationId: string;
|
|
440
484
|
modelName: string;
|
|
@@ -535,6 +579,17 @@ export declare class AIResource {
|
|
|
535
579
|
message: string;
|
|
536
580
|
};
|
|
537
581
|
role: "agent";
|
|
582
|
+
} | {
|
|
583
|
+
conversationId: string;
|
|
584
|
+
modelName: string;
|
|
585
|
+
modelProviderId: string;
|
|
586
|
+
runId: string;
|
|
587
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
588
|
+
id: string;
|
|
589
|
+
content: {
|
|
590
|
+
chunkType: "endOfStream";
|
|
591
|
+
};
|
|
592
|
+
role: "agent";
|
|
538
593
|
} | {
|
|
539
594
|
conversationId: string;
|
|
540
595
|
modelName: string;
|
|
@@ -650,6 +705,17 @@ export declare class AIResource {
|
|
|
650
705
|
message: string;
|
|
651
706
|
};
|
|
652
707
|
role: "agent";
|
|
708
|
+
} | {
|
|
709
|
+
conversationId: string;
|
|
710
|
+
modelName: string;
|
|
711
|
+
modelProviderId: string;
|
|
712
|
+
runId: string;
|
|
713
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
714
|
+
id: string;
|
|
715
|
+
content: {
|
|
716
|
+
chunkType: "endOfStream";
|
|
717
|
+
};
|
|
718
|
+
role: "agent";
|
|
653
719
|
} | {
|
|
654
720
|
conversationId: string;
|
|
655
721
|
modelName: string;
|
|
@@ -713,7 +779,16 @@ export declare class AIResource {
|
|
|
713
779
|
id: string | undefined;
|
|
714
780
|
}, never, never, never, "uninitialized" | "creating_conversation" | "retrieving_history" | "idle" | "submitting_message" | "retrieve_history_failed" | "submitting_message_failed" | {
|
|
715
781
|
streaming: "monitoring_replies" | "stopping";
|
|
716
|
-
}, string, import("../../enterprise/ai/conversations/createConversationMachine.ts").ConversationMachineInput, import("xstate").NonReducibleUnknown,
|
|
782
|
+
}, string, import("../../enterprise/ai/conversations/createConversationMachine.ts").ConversationMachineInput, import("xstate").NonReducibleUnknown, {
|
|
783
|
+
type: "apiError";
|
|
784
|
+
error: HttpError;
|
|
785
|
+
} | {
|
|
786
|
+
type: "chatEventReceived";
|
|
787
|
+
chatEvent: ChatEvent;
|
|
788
|
+
} | {
|
|
789
|
+
type: "conversationCreated";
|
|
790
|
+
id: string;
|
|
791
|
+
}, import("xstate").MetaObject, {
|
|
717
792
|
id: "agentConversation";
|
|
718
793
|
states: {
|
|
719
794
|
readonly creating_conversation: {};
|
|
@@ -67,6 +67,17 @@ export declare class AIResource {
|
|
|
67
67
|
message: string;
|
|
68
68
|
};
|
|
69
69
|
role: "agent";
|
|
70
|
+
} | {
|
|
71
|
+
conversationId: string;
|
|
72
|
+
modelName: string;
|
|
73
|
+
modelProviderId: string;
|
|
74
|
+
runId: string;
|
|
75
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
76
|
+
id: string;
|
|
77
|
+
content: {
|
|
78
|
+
chunkType: "endOfStream";
|
|
79
|
+
};
|
|
80
|
+
role: "agent";
|
|
70
81
|
} | {
|
|
71
82
|
conversationId: string;
|
|
72
83
|
modelName: string;
|
|
@@ -163,6 +174,17 @@ export declare class AIResource {
|
|
|
163
174
|
message: string;
|
|
164
175
|
};
|
|
165
176
|
role: "agent";
|
|
177
|
+
} | {
|
|
178
|
+
conversationId: string;
|
|
179
|
+
modelName: string;
|
|
180
|
+
modelProviderId: string;
|
|
181
|
+
runId: string;
|
|
182
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
183
|
+
id: string;
|
|
184
|
+
content: {
|
|
185
|
+
chunkType: "endOfStream";
|
|
186
|
+
};
|
|
187
|
+
role: "agent";
|
|
166
188
|
} | {
|
|
167
189
|
conversationId: string;
|
|
168
190
|
modelName: string;
|
|
@@ -266,6 +288,17 @@ export declare class AIResource {
|
|
|
266
288
|
message: string;
|
|
267
289
|
};
|
|
268
290
|
role: "agent";
|
|
291
|
+
} | {
|
|
292
|
+
conversationId: string;
|
|
293
|
+
modelName: string;
|
|
294
|
+
modelProviderId: string;
|
|
295
|
+
runId: string;
|
|
296
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
297
|
+
id: string;
|
|
298
|
+
content: {
|
|
299
|
+
chunkType: "endOfStream";
|
|
300
|
+
};
|
|
301
|
+
role: "agent";
|
|
269
302
|
} | {
|
|
270
303
|
conversationId: string;
|
|
271
304
|
modelName: string;
|
|
@@ -377,6 +410,17 @@ export declare class AIResource {
|
|
|
377
410
|
message: string;
|
|
378
411
|
};
|
|
379
412
|
role: "agent";
|
|
413
|
+
} | {
|
|
414
|
+
conversationId: string;
|
|
415
|
+
modelName: string;
|
|
416
|
+
modelProviderId: string;
|
|
417
|
+
runId: string;
|
|
418
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
419
|
+
id: string;
|
|
420
|
+
content: {
|
|
421
|
+
chunkType: "endOfStream";
|
|
422
|
+
};
|
|
423
|
+
role: "agent";
|
|
380
424
|
} | {
|
|
381
425
|
conversationId: string;
|
|
382
426
|
modelName: string;
|
|
@@ -477,6 +521,17 @@ export declare class AIResource {
|
|
|
477
521
|
message: string;
|
|
478
522
|
};
|
|
479
523
|
role: "agent";
|
|
524
|
+
} | {
|
|
525
|
+
conversationId: string;
|
|
526
|
+
modelName: string;
|
|
527
|
+
modelProviderId: string;
|
|
528
|
+
runId: string;
|
|
529
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
530
|
+
id: string;
|
|
531
|
+
content: {
|
|
532
|
+
chunkType: "endOfStream";
|
|
533
|
+
};
|
|
534
|
+
role: "agent";
|
|
480
535
|
} | {
|
|
481
536
|
conversationId: string;
|
|
482
537
|
modelName: string;
|
|
@@ -592,6 +647,17 @@ export declare class AIResource {
|
|
|
592
647
|
message: string;
|
|
593
648
|
};
|
|
594
649
|
role: "agent";
|
|
650
|
+
} | {
|
|
651
|
+
conversationId: string;
|
|
652
|
+
modelName: string;
|
|
653
|
+
modelProviderId: string;
|
|
654
|
+
runId: string;
|
|
655
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
656
|
+
id: string;
|
|
657
|
+
content: {
|
|
658
|
+
chunkType: "endOfStream";
|
|
659
|
+
};
|
|
660
|
+
role: "agent";
|
|
595
661
|
} | {
|
|
596
662
|
conversationId: string;
|
|
597
663
|
modelName: string;
|
|
@@ -655,7 +721,16 @@ export declare class AIResource {
|
|
|
655
721
|
id: string | undefined;
|
|
656
722
|
}, never, never, never, "uninitialized" | "creating_conversation" | "retrieving_history" | "idle" | "submitting_message" | "retrieve_history_failed" | "submitting_message_failed" | {
|
|
657
723
|
streaming: "monitoring_replies" | "stopping";
|
|
658
|
-
}, string, import("./conversations/createConversationMachine.ts").ConversationMachineInput, import("xstate").NonReducibleUnknown,
|
|
724
|
+
}, string, import("./conversations/createConversationMachine.ts").ConversationMachineInput, import("xstate").NonReducibleUnknown, {
|
|
725
|
+
type: "apiError";
|
|
726
|
+
error: HttpError;
|
|
727
|
+
} | {
|
|
728
|
+
type: "chatEventReceived";
|
|
729
|
+
chatEvent: ChatEvent;
|
|
730
|
+
} | {
|
|
731
|
+
type: "conversationCreated";
|
|
732
|
+
id: string;
|
|
733
|
+
}, import("xstate").MetaObject, {
|
|
659
734
|
id: "agentConversation";
|
|
660
735
|
states: {
|
|
661
736
|
readonly creating_conversation: {};
|
|
@@ -57,6 +57,14 @@ export declare const chatEventCodec: z.ZodMiniCodec<z.ZodMiniDiscriminatedUnion<
|
|
|
57
57
|
* anyways, so the parser should throw to the generic response error handler.
|
|
58
58
|
*/
|
|
59
59
|
message: z.ZodMiniString<string>;
|
|
60
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
61
|
+
chunkType: z.ZodMiniLiteral<"endOfStream">;
|
|
62
|
+
conversationId: z.ZodMiniString<string>;
|
|
63
|
+
createdAt: z.ZodMiniString<string>;
|
|
64
|
+
messageId: z.ZodMiniString<string>;
|
|
65
|
+
modelName: z.ZodMiniString<string>;
|
|
66
|
+
modelProviderId: z.ZodMiniString<string>;
|
|
67
|
+
runId: z.ZodMiniString<string>;
|
|
60
68
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
61
69
|
chunkType: z.ZodMiniLiteral<"conversationUpdate">;
|
|
62
70
|
summary: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -140,6 +148,17 @@ export declare const chatEventCodec: z.ZodMiniCodec<z.ZodMiniDiscriminatedUnion<
|
|
|
140
148
|
message: z.ZodMiniString<string>;
|
|
141
149
|
}, z.core.$strip>;
|
|
142
150
|
role: z.ZodMiniLiteral<"agent">;
|
|
151
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
152
|
+
conversationId: z.ZodMiniString<string>;
|
|
153
|
+
modelName: z.ZodMiniString<string>;
|
|
154
|
+
modelProviderId: z.ZodMiniString<string>;
|
|
155
|
+
runId: z.ZodMiniString<string>;
|
|
156
|
+
createdAt: z.ZodMiniCustom<Temporal.Instant, Temporal.Instant>;
|
|
157
|
+
id: z.ZodMiniString<string>;
|
|
158
|
+
content: z.ZodMiniObject<{
|
|
159
|
+
chunkType: z.ZodMiniLiteral<"endOfStream">;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
role: z.ZodMiniLiteral<"agent">;
|
|
143
162
|
}, z.core.$strict>, z.ZodMiniObject<{
|
|
144
163
|
conversationId: z.ZodMiniString<string>;
|
|
145
164
|
modelName: z.ZodMiniString<string>;
|
|
@@ -49,6 +49,9 @@ const conversationUpdateChunkSchema = z.object({
|
|
|
49
49
|
summary: z.optional(z.string()),
|
|
50
50
|
title: z.optional(z.string()),
|
|
51
51
|
});
|
|
52
|
+
const endOfStreamChunkSchema = z.object({
|
|
53
|
+
chunkType: z.literal("endOfStream"),
|
|
54
|
+
});
|
|
52
55
|
const modelChunkSchema = z.object({
|
|
53
56
|
chunkType: z.literal("model"),
|
|
54
57
|
name: z.string().check(z.trim(), z.minLength(1)),
|
|
@@ -96,6 +99,7 @@ export const chatEventV1Schema = z.discriminatedUnion("chunkType", [
|
|
|
96
99
|
]);
|
|
97
100
|
const chatEventInputSchema = z.discriminatedUnion("chunkType", [
|
|
98
101
|
errorChunkSchema,
|
|
102
|
+
z.extend(endOfStreamChunkSchema, chatEventSharedSchema),
|
|
99
103
|
z.extend(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
100
104
|
z.extend(modelChunkSchema, chatEventSharedSchema),
|
|
101
105
|
z.extend(toolRequestChunkSchema, chatEventSharedSchema),
|
|
@@ -112,6 +116,10 @@ const chatEventOutputSchema = z.union([
|
|
|
112
116
|
role: z.literal("agent"),
|
|
113
117
|
}),
|
|
114
118
|
z.extend(chatEventOutputSharedSchema, { content: errorChunkSchema, role: z.literal("agent") }),
|
|
119
|
+
z.extend(chatEventOutputSharedSchema, {
|
|
120
|
+
content: endOfStreamChunkSchema,
|
|
121
|
+
role: z.literal("agent"),
|
|
122
|
+
}),
|
|
115
123
|
z.extend(chatEventOutputSharedSchema, { content: modelChunkSchema, role: z.literal("agent") }),
|
|
116
124
|
z.extend(chatEventOutputSharedSchema, {
|
|
117
125
|
content: toolRequestChunkSchema,
|
|
@@ -162,6 +170,14 @@ export const chatEventCodec = z.codec(chatEventInputSchema, chatEventOutputSchem
|
|
|
162
170
|
},
|
|
163
171
|
role: "agent",
|
|
164
172
|
};
|
|
173
|
+
case "endOfStream":
|
|
174
|
+
return {
|
|
175
|
+
...sharedProperties,
|
|
176
|
+
content: {
|
|
177
|
+
chunkType: "endOfStream",
|
|
178
|
+
},
|
|
179
|
+
role: "agent",
|
|
180
|
+
};
|
|
165
181
|
case "model":
|
|
166
182
|
return {
|
|
167
183
|
...sharedProperties,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatEventSchema.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/chat/chatEventSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B;;;GAGG;AACH,MAAM,uBAAuB,GAAG;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,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BACnC;oBACD,IAAI,EAAE,OAAO;iBAC4C,CAAC;YAC9D,KAAK,cAAc;gBACjB,OAAO;oBACL,GAAG,gBAAgB;oBACnB,OAAO,EAAE;wBACP,MAAM,EAAE,CAAC,CAAC,MAAM;wBAChB,SAAS,EAAE,cAAc;wBACzB,UAAU,EAAE,CAAC,CAAC,UAAU;wBACxB,IAAI,EAAE,CAAC,CAAC,IAAI;wBACZ,MAAM,EAAE,CAAC,CAAC,MAAM;qBACjB;oBACD,IAAI,EAAE,OAAO;iBAC4C,CAAC;YAC9D,KAAK,aAAa;gBAChB,OAAO;oBACL,GAAG,gBAAgB;oBACnB,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;oBACnD,IAAI,EAAE,MAAM;iBAC6C,CAAC;QAChE,CAAC;IACH,CAAC;IACD,MAAM,CAAC,CAAC;QACN,OAAO;YACL,YAAY;YACZ,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE;YACjC,SAAS,EAAE,CAAC,CAAC,EAAE;YACf,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,eAAe,EAAE,CAAC,CAAC,eAAe;YAClC,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,GAAG,CAAC,CAAC,OAAO;SAC2C,CAAC;IAC5D,CAAC;CACF,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Temporal } from \"temporal-polyfill\";\nimport * as z from \"zod/mini\";\n\n/**\n * Shared chat event fields for all responses (except error response)\n * @deprecated\n */\nconst chatEventV1SharedSchema = {\n createdAt: z.string().check(z.iso.datetime()),\n modelName: z.string().check(z.trim(), z.minLength(1)),\n modelProviderId: z.string().check(z.trim(), z.minLength(1)),\n sessionId: z.string().check(z.trim(), z.minLength(1)),\n};\n\n/**\n * Shared chat event fields for all responses (except error response)\n */\nconst chatEventSharedSchema = {\n conversationId: z.string(),\n createdAt: z.string().check(z.iso.datetime()),\n messageId: z.string(),\n modelName: z.string(),\n modelProviderId: z.string(),\n runId: z.string(),\n};\n\nconst errorChunkSchema = z.object({\n chunkType: z.literal(\"error\"),\n /**\n * If the message is not present or very short, it won't be useful to show\n * anyways, so the parser should throw to the generic response error handler.\n */\n message: z.string().check(z.trim(), z.minLength(2)),\n});\n\nconst conversationUpdateChunkSchema = z.object({\n chunkType: z.literal(\"conversationUpdate\"),\n summary: z.optional(z.string()),\n title: z.optional(z.string()),\n});\n\nconst modelChunkSchema = z.object({\n chunkType: z.literal(\"model\"),\n name: z.string().check(z.trim(), z.minLength(1)),\n /**\n * It's useful to indicate (to the type system) that the result contents\n * at this stage can only be data (de)serializable from JSON. Because\n * model responses can vary depending on runtime flags and edition, we can\n * leave this field generic and refine it more precisely in later stages.\n */\n result: z.record(z.string(), z.unknown()),\n});\n\nconst toolRequestChunkSchema = z.object({\n arguments: z.record(z.string(), z.unknown()),\n callId: z.string().check(z.trim(), z.minLength(1)),\n chunkType: z.literal(\"toolRequest\"),\n commentary: z.optional(z.string()),\n name: z.string(),\n summarizedTitle: z.optional(z.string()),\n});\n\nconst toolResponseChunkSchema = z.object({\n callId: z.string(),\n chunkType: z.literal(\"toolResponse\"),\n commentary: z.optional(z.string()),\n name: z.string(),\n result: z.record(z.string(), z.unknown()),\n});\n\nconst userMessageChunkSchema = z.object({\n chunkType: z.literal(\"userMessage\"),\n text: z.string(),\n});\n\n/**\n * Captures all of the possible chunks of data that the Agent can reply\n * with. We're lenient to extra/unexpected fields being present (`z.object`\n * instead of `z.strictObject`), but for the fields that are expected,\n * we validate that they match the most general type category they belong in.\n * For example, it's good enough to validate that the `callId` is a string\n * for type safety -- we don't need to verify that it's also a `z.uuid()`.\n * @deprecated\n */\nexport const chatEventV1Schema = z.discriminatedUnion(\"chunkType\", [\n errorChunkSchema,\n z.extend(modelChunkSchema, chatEventV1SharedSchema),\n z.extend(toolRequestChunkSchema, chatEventV1SharedSchema),\n z.extend(toolResponseChunkSchema, chatEventV1SharedSchema),\n]);\n\n/**\n * @deprecated\n */\nexport type ChatEventV1 = z.infer<typeof chatEventV1Schema>;\n\nconst chatEventInputSchema = z.discriminatedUnion(\"chunkType\", [\n errorChunkSchema,\n z.extend(conversationUpdateChunkSchema, chatEventSharedSchema),\n z.extend(modelChunkSchema, chatEventSharedSchema),\n z.extend(toolRequestChunkSchema, chatEventSharedSchema),\n z.extend(toolResponseChunkSchema, chatEventSharedSchema),\n z.extend(userMessageChunkSchema, chatEventSharedSchema),\n]);\n\nconst chatEventOutputSharedSchema = z.extend(\n z.omit(z.strictObject(chatEventSharedSchema), { createdAt: true, messageId: true }),\n {\n createdAt: z.instanceof(Temporal.Instant),\n id: z.string(),\n },\n);\n\nconst chatEventOutputSchema = z.union([\n z.extend(chatEventOutputSharedSchema, {\n content: conversationUpdateChunkSchema,\n role: z.literal(\"agent\"),\n }),\n z.extend(chatEventOutputSharedSchema, { content: errorChunkSchema, role: z.literal(\"agent\") }),\n z.extend(chatEventOutputSharedSchema, { content: modelChunkSchema, role: z.literal(\"agent\") }),\n z.extend(chatEventOutputSharedSchema, {\n content: toolRequestChunkSchema,\n role: z.literal(\"agent\"),\n }),\n z.extend(chatEventOutputSharedSchema, {\n content: toolResponseChunkSchema,\n role: z.literal(\"agent\"),\n }),\n z.extend(chatEventOutputSharedSchema, {\n content: userMessageChunkSchema,\n role: z.literal(\"user\"),\n }),\n]);\n\nexport const chatEventCodec = z.codec(chatEventInputSchema, chatEventOutputSchema, {\n decode(v) {\n if (v.chunkType === \"error\") {\n return {\n content: {\n chunkType: \"error\",\n message: v.message,\n },\n conversationId: \"\",\n createdAt: Temporal.Now.instant(),\n id: \"\",\n modelName: \"\",\n modelProviderId: \"\",\n role: \"agent\",\n runId: \"\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n }\n\n const sharedProperties = {\n conversationId: v.conversationId,\n createdAt: Temporal.Instant.from(v.createdAt),\n id: v.messageId,\n modelName: v.modelName,\n modelProviderId: v.modelProviderId,\n runId: v.runId,\n } as const satisfies Omit<z.output<typeof chatEventOutputSchema>, \"content\" | \"role\">;\n\n switch (v.chunkType) {\n case \"conversationUpdate\":\n return {\n ...sharedProperties,\n content: {\n chunkType: \"conversationUpdate\",\n summary: v.summary,\n title: v.title,\n },\n role: \"agent\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n case \"model\":\n return {\n ...sharedProperties,\n content: {\n chunkType: \"model\",\n name: v.name,\n result: v.result,\n },\n role: \"agent\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n case \"toolRequest\":\n return {\n ...sharedProperties,\n content: {\n arguments: v.arguments,\n callId: v.callId,\n chunkType: \"toolRequest\",\n commentary: v.commentary,\n name: v.name,\n summarizedTitle: v.summarizedTitle,\n },\n role: \"agent\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n case \"toolResponse\":\n return {\n ...sharedProperties,\n content: {\n callId: v.callId,\n chunkType: \"toolResponse\",\n commentary: v.commentary,\n name: v.name,\n result: v.result,\n },\n role: \"agent\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n case \"userMessage\":\n return {\n ...sharedProperties,\n content: { chunkType: \"userMessage\", text: v.text },\n role: \"user\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n }\n },\n encode(v) {\n return {\n //@ts-ignore\n conversationId: v.conversationId,\n createdAt: v.createdAt.toString(),\n messageId: v.id,\n modelName: v.modelName,\n modelProviderId: v.modelProviderId,\n runId: v.runId,\n ...v.content,\n } as const satisfies z.infer<typeof chatEventInputSchema>;\n },\n});\n\nexport type ChatEvent = z.output<typeof chatEventCodec>;\nexport type ChatEventWithChunkType<T extends z.input<typeof chatEventCodec>[\"chunkType\"]> = Extract<\n ChatEvent,\n { content: { chunkType: T } }\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"chatEventSchema.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/chat/chatEventSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B;;;GAGG;AACH,MAAM,uBAAuB,GAAG;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACrD,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC3D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CACtD,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAG;IAC5B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,eAAe,EAAE,CAAC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AAM;wBAChB,SAAS,EAAE,cAAc;wBACzB,UAAU,EAAE,CAAC,CAAC,UAAU;wBACxB,IAAI,EAAE,CAAC,CAAC,IAAI;wBACZ,MAAM,EAAE,CAAC,CAAC,MAAM;qBACjB;oBACD,IAAI,EAAE,OAAO;iBAC4C,CAAC;YAC9D,KAAK,aAAa;gBAChB,OAAO;oBACL,GAAG,gBAAgB;oBACnB,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;oBACnD,IAAI,EAAE,MAAM;iBAC6C,CAAC;QAChE,CAAC;IACH,CAAC;IACD,MAAM,CAAC,CAAC;QACN,OAAO;YACL,YAAY;YACZ,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE;YACjC,SAAS,EAAE,CAAC,CAAC,EAAE;YACf,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,eAAe,EAAE,CAAC,CAAC,eAAe;YAClC,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,GAAG,CAAC,CAAC,OAAO;SAC2C,CAAC;IAC5D,CAAC;CACF,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Temporal } from \"temporal-polyfill\";\nimport * as z from \"zod/mini\";\n\n/**\n * Shared chat event fields for all responses (except error response)\n * @deprecated\n */\nconst chatEventV1SharedSchema = {\n createdAt: z.string().check(z.iso.datetime()),\n modelName: z.string().check(z.trim(), z.minLength(1)),\n modelProviderId: z.string().check(z.trim(), z.minLength(1)),\n sessionId: z.string().check(z.trim(), z.minLength(1)),\n};\n\n/**\n * Shared chat event fields for all responses (except error response)\n */\nconst chatEventSharedSchema = {\n conversationId: z.string(),\n createdAt: z.string().check(z.iso.datetime()),\n messageId: z.string(),\n modelName: z.string(),\n modelProviderId: z.string(),\n runId: z.string(),\n};\n\nconst errorChunkSchema = z.object({\n chunkType: z.literal(\"error\"),\n /**\n * If the message is not present or very short, it won't be useful to show\n * anyways, so the parser should throw to the generic response error handler.\n */\n message: z.string().check(z.trim(), z.minLength(2)),\n});\n\nconst conversationUpdateChunkSchema = z.object({\n chunkType: z.literal(\"conversationUpdate\"),\n summary: z.optional(z.string()),\n title: z.optional(z.string()),\n});\n\nconst endOfStreamChunkSchema = z.object({\n chunkType: z.literal(\"endOfStream\"),\n});\n\nconst modelChunkSchema = z.object({\n chunkType: z.literal(\"model\"),\n name: z.string().check(z.trim(), z.minLength(1)),\n /**\n * It's useful to indicate (to the type system) that the result contents\n * at this stage can only be data (de)serializable from JSON. Because\n * model responses can vary depending on runtime flags and edition, we can\n * leave this field generic and refine it more precisely in later stages.\n */\n result: z.record(z.string(), z.unknown()),\n});\n\nconst toolRequestChunkSchema = z.object({\n arguments: z.record(z.string(), z.unknown()),\n callId: z.string().check(z.trim(), z.minLength(1)),\n chunkType: z.literal(\"toolRequest\"),\n commentary: z.optional(z.string()),\n name: z.string(),\n summarizedTitle: z.optional(z.string()),\n});\n\nconst toolResponseChunkSchema = z.object({\n callId: z.string(),\n chunkType: z.literal(\"toolResponse\"),\n commentary: z.optional(z.string()),\n name: z.string(),\n result: z.record(z.string(), z.unknown()),\n});\n\nconst userMessageChunkSchema = z.object({\n chunkType: z.literal(\"userMessage\"),\n text: z.string(),\n});\n\n/**\n * Captures all of the possible chunks of data that the Agent can reply\n * with. We're lenient to extra/unexpected fields being present (`z.object`\n * instead of `z.strictObject`), but for the fields that are expected,\n * we validate that they match the most general type category they belong in.\n * For example, it's good enough to validate that the `callId` is a string\n * for type safety -- we don't need to verify that it's also a `z.uuid()`.\n * @deprecated\n */\nexport const chatEventV1Schema = z.discriminatedUnion(\"chunkType\", [\n errorChunkSchema,\n z.extend(modelChunkSchema, chatEventV1SharedSchema),\n z.extend(toolRequestChunkSchema, chatEventV1SharedSchema),\n z.extend(toolResponseChunkSchema, chatEventV1SharedSchema),\n]);\n\n/**\n * @deprecated\n */\nexport type ChatEventV1 = z.infer<typeof chatEventV1Schema>;\n\nconst chatEventInputSchema = z.discriminatedUnion(\"chunkType\", [\n errorChunkSchema,\n z.extend(endOfStreamChunkSchema, chatEventSharedSchema),\n z.extend(conversationUpdateChunkSchema, chatEventSharedSchema),\n z.extend(modelChunkSchema, chatEventSharedSchema),\n z.extend(toolRequestChunkSchema, chatEventSharedSchema),\n z.extend(toolResponseChunkSchema, chatEventSharedSchema),\n z.extend(userMessageChunkSchema, chatEventSharedSchema),\n]);\n\nconst chatEventOutputSharedSchema = z.extend(\n z.omit(z.strictObject(chatEventSharedSchema), { createdAt: true, messageId: true }),\n {\n createdAt: z.instanceof(Temporal.Instant),\n id: z.string(),\n },\n);\n\nconst chatEventOutputSchema = z.union([\n z.extend(chatEventOutputSharedSchema, {\n content: conversationUpdateChunkSchema,\n role: z.literal(\"agent\"),\n }),\n z.extend(chatEventOutputSharedSchema, { content: errorChunkSchema, role: z.literal(\"agent\") }),\n z.extend(chatEventOutputSharedSchema, {\n content: endOfStreamChunkSchema,\n role: z.literal(\"agent\"),\n }),\n z.extend(chatEventOutputSharedSchema, { content: modelChunkSchema, role: z.literal(\"agent\") }),\n z.extend(chatEventOutputSharedSchema, {\n content: toolRequestChunkSchema,\n role: z.literal(\"agent\"),\n }),\n z.extend(chatEventOutputSharedSchema, {\n content: toolResponseChunkSchema,\n role: z.literal(\"agent\"),\n }),\n z.extend(chatEventOutputSharedSchema, {\n content: userMessageChunkSchema,\n role: z.literal(\"user\"),\n }),\n]);\n\nexport const chatEventCodec = z.codec(chatEventInputSchema, chatEventOutputSchema, {\n decode(v) {\n if (v.chunkType === \"error\") {\n return {\n content: {\n chunkType: \"error\",\n message: v.message,\n },\n conversationId: \"\",\n createdAt: Temporal.Now.instant(),\n id: \"\",\n modelName: \"\",\n modelProviderId: \"\",\n role: \"agent\",\n runId: \"\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n }\n\n const sharedProperties = {\n conversationId: v.conversationId,\n createdAt: Temporal.Instant.from(v.createdAt),\n id: v.messageId,\n modelName: v.modelName,\n modelProviderId: v.modelProviderId,\n runId: v.runId,\n } as const satisfies Omit<z.output<typeof chatEventOutputSchema>, \"content\" | \"role\">;\n\n switch (v.chunkType) {\n case \"conversationUpdate\":\n return {\n ...sharedProperties,\n content: {\n chunkType: \"conversationUpdate\",\n summary: v.summary,\n title: v.title,\n },\n role: \"agent\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n case \"endOfStream\":\n return {\n ...sharedProperties,\n content: {\n chunkType: \"endOfStream\",\n },\n role: \"agent\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n case \"model\":\n return {\n ...sharedProperties,\n content: {\n chunkType: \"model\",\n name: v.name,\n result: v.result,\n },\n role: \"agent\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n case \"toolRequest\":\n return {\n ...sharedProperties,\n content: {\n arguments: v.arguments,\n callId: v.callId,\n chunkType: \"toolRequest\",\n commentary: v.commentary,\n name: v.name,\n summarizedTitle: v.summarizedTitle,\n },\n role: \"agent\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n case \"toolResponse\":\n return {\n ...sharedProperties,\n content: {\n callId: v.callId,\n chunkType: \"toolResponse\",\n commentary: v.commentary,\n name: v.name,\n result: v.result,\n },\n role: \"agent\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n case \"userMessage\":\n return {\n ...sharedProperties,\n content: { chunkType: \"userMessage\", text: v.text },\n role: \"user\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n }\n },\n encode(v) {\n return {\n //@ts-ignore\n conversationId: v.conversationId,\n createdAt: v.createdAt.toString(),\n messageId: v.id,\n modelName: v.modelName,\n modelProviderId: v.modelProviderId,\n runId: v.runId,\n ...v.content,\n } as const satisfies z.infer<typeof chatEventInputSchema>;\n },\n});\n\nexport type ChatEvent = z.output<typeof chatEventCodec>;\nexport type ChatEventWithChunkType<T extends z.input<typeof chatEventCodec>[\"chunkType\"]> = Extract<\n ChatEvent,\n { content: { chunkType: T } }\n>;\n"]}
|
|
@@ -58,6 +58,17 @@ export declare class AgentConversation implements AgentConversationProperties {
|
|
|
58
58
|
message: string;
|
|
59
59
|
};
|
|
60
60
|
role: "agent";
|
|
61
|
+
} | {
|
|
62
|
+
conversationId: string;
|
|
63
|
+
modelName: string;
|
|
64
|
+
modelProviderId: string;
|
|
65
|
+
runId: string;
|
|
66
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
67
|
+
id: string;
|
|
68
|
+
content: {
|
|
69
|
+
chunkType: "endOfStream";
|
|
70
|
+
};
|
|
71
|
+
role: "agent";
|
|
61
72
|
} | {
|
|
62
73
|
conversationId: string;
|
|
63
74
|
modelName: string;
|
|
@@ -140,6 +151,17 @@ export declare class AgentConversation implements AgentConversationProperties {
|
|
|
140
151
|
message: string;
|
|
141
152
|
};
|
|
142
153
|
role: "agent";
|
|
154
|
+
} | {
|
|
155
|
+
conversationId: string;
|
|
156
|
+
modelName: string;
|
|
157
|
+
modelProviderId: string;
|
|
158
|
+
runId: string;
|
|
159
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
160
|
+
id: string;
|
|
161
|
+
content: {
|
|
162
|
+
chunkType: "endOfStream";
|
|
163
|
+
};
|
|
164
|
+
role: "agent";
|
|
143
165
|
} | {
|
|
144
166
|
conversationId: string;
|
|
145
167
|
modelName: string;
|
|
@@ -2,6 +2,8 @@ import type { UserChatMessage } from "../chat/UserChatMessage.ts";
|
|
|
2
2
|
import { AgentConversation } from "./AgentConversation.ts";
|
|
3
3
|
import type { ConversationExchange } from "./reduceChatEvents.ts";
|
|
4
4
|
import type { SonarV4Config } from "../../../common/Config.ts";
|
|
5
|
+
import { type ChatEvent } from "../chat/chatEventSchema.ts";
|
|
6
|
+
import type { HttpError } from "../../../common/HttpError.ts";
|
|
5
7
|
export type ConversationMachineInput = {
|
|
6
8
|
conversationId: string | null;
|
|
7
9
|
};
|
|
@@ -22,6 +24,16 @@ export type ConversationMachineEvents = {
|
|
|
22
24
|
} | {
|
|
23
25
|
type: "REFRESH_HISTORY";
|
|
24
26
|
};
|
|
27
|
+
export type ConversationMachineEmitted = {
|
|
28
|
+
type: "apiError";
|
|
29
|
+
error: HttpError;
|
|
30
|
+
} | {
|
|
31
|
+
type: "chatEventReceived";
|
|
32
|
+
chatEvent: ChatEvent;
|
|
33
|
+
} | {
|
|
34
|
+
type: "conversationCreated";
|
|
35
|
+
id: string;
|
|
36
|
+
};
|
|
25
37
|
export declare const createConversationMachine: (config: SonarV4Config) => import("xstate").StateMachine<ConversationMachineContext, {
|
|
26
38
|
type: "STOP_RUN";
|
|
27
39
|
} | {
|
|
@@ -73,6 +85,17 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
73
85
|
message: string;
|
|
74
86
|
};
|
|
75
87
|
role: "agent";
|
|
88
|
+
} | {
|
|
89
|
+
conversationId: string;
|
|
90
|
+
modelName: string;
|
|
91
|
+
modelProviderId: string;
|
|
92
|
+
runId: string;
|
|
93
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
94
|
+
id: string;
|
|
95
|
+
content: {
|
|
96
|
+
chunkType: "endOfStream";
|
|
97
|
+
};
|
|
98
|
+
role: "agent";
|
|
76
99
|
} | {
|
|
77
100
|
conversationId: string;
|
|
78
101
|
modelName: string;
|
|
@@ -169,6 +192,17 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
169
192
|
message: string;
|
|
170
193
|
};
|
|
171
194
|
role: "agent";
|
|
195
|
+
} | {
|
|
196
|
+
conversationId: string;
|
|
197
|
+
modelName: string;
|
|
198
|
+
modelProviderId: string;
|
|
199
|
+
runId: string;
|
|
200
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
201
|
+
id: string;
|
|
202
|
+
content: {
|
|
203
|
+
chunkType: "endOfStream";
|
|
204
|
+
};
|
|
205
|
+
role: "agent";
|
|
172
206
|
} | {
|
|
173
207
|
conversationId: string;
|
|
174
208
|
modelName: string;
|
|
@@ -272,6 +306,17 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
272
306
|
message: string;
|
|
273
307
|
};
|
|
274
308
|
role: "agent";
|
|
309
|
+
} | {
|
|
310
|
+
conversationId: string;
|
|
311
|
+
modelName: string;
|
|
312
|
+
modelProviderId: string;
|
|
313
|
+
runId: string;
|
|
314
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
315
|
+
id: string;
|
|
316
|
+
content: {
|
|
317
|
+
chunkType: "endOfStream";
|
|
318
|
+
};
|
|
319
|
+
role: "agent";
|
|
275
320
|
} | {
|
|
276
321
|
conversationId: string;
|
|
277
322
|
modelName: string;
|
|
@@ -383,6 +428,17 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
383
428
|
message: string;
|
|
384
429
|
};
|
|
385
430
|
role: "agent";
|
|
431
|
+
} | {
|
|
432
|
+
conversationId: string;
|
|
433
|
+
modelName: string;
|
|
434
|
+
modelProviderId: string;
|
|
435
|
+
runId: string;
|
|
436
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
437
|
+
id: string;
|
|
438
|
+
content: {
|
|
439
|
+
chunkType: "endOfStream";
|
|
440
|
+
};
|
|
441
|
+
role: "agent";
|
|
386
442
|
} | {
|
|
387
443
|
conversationId: string;
|
|
388
444
|
modelName: string;
|
|
@@ -483,6 +539,17 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
483
539
|
message: string;
|
|
484
540
|
};
|
|
485
541
|
role: "agent";
|
|
542
|
+
} | {
|
|
543
|
+
conversationId: string;
|
|
544
|
+
modelName: string;
|
|
545
|
+
modelProviderId: string;
|
|
546
|
+
runId: string;
|
|
547
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
548
|
+
id: string;
|
|
549
|
+
content: {
|
|
550
|
+
chunkType: "endOfStream";
|
|
551
|
+
};
|
|
552
|
+
role: "agent";
|
|
486
553
|
} | {
|
|
487
554
|
conversationId: string;
|
|
488
555
|
modelName: string;
|
|
@@ -598,6 +665,17 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
598
665
|
message: string;
|
|
599
666
|
};
|
|
600
667
|
role: "agent";
|
|
668
|
+
} | {
|
|
669
|
+
conversationId: string;
|
|
670
|
+
modelName: string;
|
|
671
|
+
modelProviderId: string;
|
|
672
|
+
runId: string;
|
|
673
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
674
|
+
id: string;
|
|
675
|
+
content: {
|
|
676
|
+
chunkType: "endOfStream";
|
|
677
|
+
};
|
|
678
|
+
role: "agent";
|
|
601
679
|
} | {
|
|
602
680
|
conversationId: string;
|
|
603
681
|
modelName: string;
|
|
@@ -661,7 +739,16 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
661
739
|
id: string | undefined;
|
|
662
740
|
}, never, never, never, "uninitialized" | "creating_conversation" | "retrieving_history" | "idle" | "submitting_message" | "retrieve_history_failed" | "submitting_message_failed" | {
|
|
663
741
|
streaming: "monitoring_replies" | "stopping";
|
|
664
|
-
}, string, ConversationMachineInput, import("xstate").NonReducibleUnknown,
|
|
742
|
+
}, string, ConversationMachineInput, import("xstate").NonReducibleUnknown, {
|
|
743
|
+
type: "apiError";
|
|
744
|
+
error: HttpError;
|
|
745
|
+
} | {
|
|
746
|
+
type: "chatEventReceived";
|
|
747
|
+
chatEvent: ChatEvent;
|
|
748
|
+
} | {
|
|
749
|
+
type: "conversationCreated";
|
|
750
|
+
id: string;
|
|
751
|
+
}, import("xstate").MetaObject, {
|
|
665
752
|
id: "agentConversation";
|
|
666
753
|
states: {
|
|
667
754
|
readonly creating_conversation: {};
|