@dremio/js-sdk 0.52.0 → 0.53.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/cloud/ai/AIResource.d.ts +90 -0
- package/dist/enterprise/ai/AIResource.d.ts +90 -0
- package/dist/enterprise/ai/chat/chatEventSchema.d.ts +27 -0
- package/dist/enterprise/ai/chat/chatEventSchema.js +24 -0
- package/dist/enterprise/ai/chat/chatEventSchema.js.map +1 -1
- package/dist/enterprise/ai/conversations/AgentConversation.d.ts +30 -0
- package/dist/enterprise/ai/conversations/createConversationMachine.d.ts +90 -0
- package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.d.ts +15 -0
- package/dist-iife/cloud.js +24 -0
- package/dist-iife/enterprise.js +24 -0
- package/package.json +1 -1
|
@@ -158,6 +158,21 @@ export declare class AIResource {
|
|
|
158
158
|
chunkType: "interrupt";
|
|
159
159
|
};
|
|
160
160
|
role: "agent";
|
|
161
|
+
} | {
|
|
162
|
+
conversationId: string;
|
|
163
|
+
modelName: string;
|
|
164
|
+
modelProviderId: string;
|
|
165
|
+
runId: string;
|
|
166
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
167
|
+
id: string;
|
|
168
|
+
content: {
|
|
169
|
+
chunkType: "jobUpdate";
|
|
170
|
+
jobId: string;
|
|
171
|
+
jobState: string;
|
|
172
|
+
toolExecutionId: string;
|
|
173
|
+
toolName: string;
|
|
174
|
+
};
|
|
175
|
+
role: "agent";
|
|
161
176
|
} | {
|
|
162
177
|
conversationId: string;
|
|
163
178
|
modelName: string;
|
|
@@ -277,6 +292,21 @@ export declare class AIResource {
|
|
|
277
292
|
chunkType: "interrupt";
|
|
278
293
|
};
|
|
279
294
|
role: "agent";
|
|
295
|
+
} | {
|
|
296
|
+
conversationId: string;
|
|
297
|
+
modelName: string;
|
|
298
|
+
modelProviderId: string;
|
|
299
|
+
runId: string;
|
|
300
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
301
|
+
id: string;
|
|
302
|
+
content: {
|
|
303
|
+
chunkType: "jobUpdate";
|
|
304
|
+
jobId: string;
|
|
305
|
+
jobState: string;
|
|
306
|
+
toolExecutionId: string;
|
|
307
|
+
toolName: string;
|
|
308
|
+
};
|
|
309
|
+
role: "agent";
|
|
280
310
|
} | {
|
|
281
311
|
conversationId: string;
|
|
282
312
|
modelName: string;
|
|
@@ -403,6 +433,21 @@ export declare class AIResource {
|
|
|
403
433
|
chunkType: "interrupt";
|
|
404
434
|
};
|
|
405
435
|
role: "agent";
|
|
436
|
+
} | {
|
|
437
|
+
conversationId: string;
|
|
438
|
+
modelName: string;
|
|
439
|
+
modelProviderId: string;
|
|
440
|
+
runId: string;
|
|
441
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
442
|
+
id: string;
|
|
443
|
+
content: {
|
|
444
|
+
chunkType: "jobUpdate";
|
|
445
|
+
jobId: string;
|
|
446
|
+
jobState: string;
|
|
447
|
+
toolExecutionId: string;
|
|
448
|
+
toolName: string;
|
|
449
|
+
};
|
|
450
|
+
role: "agent";
|
|
406
451
|
} | {
|
|
407
452
|
conversationId: string;
|
|
408
453
|
modelName: string;
|
|
@@ -546,6 +591,21 @@ export declare class AIResource {
|
|
|
546
591
|
chunkType: "interrupt";
|
|
547
592
|
};
|
|
548
593
|
role: "agent";
|
|
594
|
+
} | {
|
|
595
|
+
conversationId: string;
|
|
596
|
+
modelName: string;
|
|
597
|
+
modelProviderId: string;
|
|
598
|
+
runId: string;
|
|
599
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
600
|
+
id: string;
|
|
601
|
+
content: {
|
|
602
|
+
chunkType: "jobUpdate";
|
|
603
|
+
jobId: string;
|
|
604
|
+
jobState: string;
|
|
605
|
+
toolExecutionId: string;
|
|
606
|
+
toolName: string;
|
|
607
|
+
};
|
|
608
|
+
role: "agent";
|
|
549
609
|
} | {
|
|
550
610
|
conversationId: string;
|
|
551
611
|
modelName: string;
|
|
@@ -669,6 +729,21 @@ export declare class AIResource {
|
|
|
669
729
|
chunkType: "interrupt";
|
|
670
730
|
};
|
|
671
731
|
role: "agent";
|
|
732
|
+
} | {
|
|
733
|
+
conversationId: string;
|
|
734
|
+
modelName: string;
|
|
735
|
+
modelProviderId: string;
|
|
736
|
+
runId: string;
|
|
737
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
738
|
+
id: string;
|
|
739
|
+
content: {
|
|
740
|
+
chunkType: "jobUpdate";
|
|
741
|
+
jobId: string;
|
|
742
|
+
jobState: string;
|
|
743
|
+
toolExecutionId: string;
|
|
744
|
+
toolName: string;
|
|
745
|
+
};
|
|
746
|
+
role: "agent";
|
|
672
747
|
} | {
|
|
673
748
|
conversationId: string;
|
|
674
749
|
modelName: string;
|
|
@@ -807,6 +882,21 @@ export declare class AIResource {
|
|
|
807
882
|
chunkType: "interrupt";
|
|
808
883
|
};
|
|
809
884
|
role: "agent";
|
|
885
|
+
} | {
|
|
886
|
+
conversationId: string;
|
|
887
|
+
modelName: string;
|
|
888
|
+
modelProviderId: string;
|
|
889
|
+
runId: string;
|
|
890
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
891
|
+
id: string;
|
|
892
|
+
content: {
|
|
893
|
+
chunkType: "jobUpdate";
|
|
894
|
+
jobId: string;
|
|
895
|
+
jobState: string;
|
|
896
|
+
toolExecutionId: string;
|
|
897
|
+
toolName: string;
|
|
898
|
+
};
|
|
899
|
+
role: "agent";
|
|
810
900
|
} | {
|
|
811
901
|
conversationId: string;
|
|
812
902
|
modelName: string;
|
|
@@ -100,6 +100,21 @@ export declare class AIResource {
|
|
|
100
100
|
chunkType: "interrupt";
|
|
101
101
|
};
|
|
102
102
|
role: "agent";
|
|
103
|
+
} | {
|
|
104
|
+
conversationId: string;
|
|
105
|
+
modelName: string;
|
|
106
|
+
modelProviderId: string;
|
|
107
|
+
runId: string;
|
|
108
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
109
|
+
id: string;
|
|
110
|
+
content: {
|
|
111
|
+
chunkType: "jobUpdate";
|
|
112
|
+
jobId: string;
|
|
113
|
+
jobState: string;
|
|
114
|
+
toolExecutionId: string;
|
|
115
|
+
toolName: string;
|
|
116
|
+
};
|
|
117
|
+
role: "agent";
|
|
103
118
|
} | {
|
|
104
119
|
conversationId: string;
|
|
105
120
|
modelName: string;
|
|
@@ -219,6 +234,21 @@ export declare class AIResource {
|
|
|
219
234
|
chunkType: "interrupt";
|
|
220
235
|
};
|
|
221
236
|
role: "agent";
|
|
237
|
+
} | {
|
|
238
|
+
conversationId: string;
|
|
239
|
+
modelName: string;
|
|
240
|
+
modelProviderId: string;
|
|
241
|
+
runId: string;
|
|
242
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
243
|
+
id: string;
|
|
244
|
+
content: {
|
|
245
|
+
chunkType: "jobUpdate";
|
|
246
|
+
jobId: string;
|
|
247
|
+
jobState: string;
|
|
248
|
+
toolExecutionId: string;
|
|
249
|
+
toolName: string;
|
|
250
|
+
};
|
|
251
|
+
role: "agent";
|
|
222
252
|
} | {
|
|
223
253
|
conversationId: string;
|
|
224
254
|
modelName: string;
|
|
@@ -345,6 +375,21 @@ export declare class AIResource {
|
|
|
345
375
|
chunkType: "interrupt";
|
|
346
376
|
};
|
|
347
377
|
role: "agent";
|
|
378
|
+
} | {
|
|
379
|
+
conversationId: string;
|
|
380
|
+
modelName: string;
|
|
381
|
+
modelProviderId: string;
|
|
382
|
+
runId: string;
|
|
383
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
384
|
+
id: string;
|
|
385
|
+
content: {
|
|
386
|
+
chunkType: "jobUpdate";
|
|
387
|
+
jobId: string;
|
|
388
|
+
jobState: string;
|
|
389
|
+
toolExecutionId: string;
|
|
390
|
+
toolName: string;
|
|
391
|
+
};
|
|
392
|
+
role: "agent";
|
|
348
393
|
} | {
|
|
349
394
|
conversationId: string;
|
|
350
395
|
modelName: string;
|
|
@@ -488,6 +533,21 @@ export declare class AIResource {
|
|
|
488
533
|
chunkType: "interrupt";
|
|
489
534
|
};
|
|
490
535
|
role: "agent";
|
|
536
|
+
} | {
|
|
537
|
+
conversationId: string;
|
|
538
|
+
modelName: string;
|
|
539
|
+
modelProviderId: string;
|
|
540
|
+
runId: string;
|
|
541
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
542
|
+
id: string;
|
|
543
|
+
content: {
|
|
544
|
+
chunkType: "jobUpdate";
|
|
545
|
+
jobId: string;
|
|
546
|
+
jobState: string;
|
|
547
|
+
toolExecutionId: string;
|
|
548
|
+
toolName: string;
|
|
549
|
+
};
|
|
550
|
+
role: "agent";
|
|
491
551
|
} | {
|
|
492
552
|
conversationId: string;
|
|
493
553
|
modelName: string;
|
|
@@ -611,6 +671,21 @@ export declare class AIResource {
|
|
|
611
671
|
chunkType: "interrupt";
|
|
612
672
|
};
|
|
613
673
|
role: "agent";
|
|
674
|
+
} | {
|
|
675
|
+
conversationId: string;
|
|
676
|
+
modelName: string;
|
|
677
|
+
modelProviderId: string;
|
|
678
|
+
runId: string;
|
|
679
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
680
|
+
id: string;
|
|
681
|
+
content: {
|
|
682
|
+
chunkType: "jobUpdate";
|
|
683
|
+
jobId: string;
|
|
684
|
+
jobState: string;
|
|
685
|
+
toolExecutionId: string;
|
|
686
|
+
toolName: string;
|
|
687
|
+
};
|
|
688
|
+
role: "agent";
|
|
614
689
|
} | {
|
|
615
690
|
conversationId: string;
|
|
616
691
|
modelName: string;
|
|
@@ -749,6 +824,21 @@ export declare class AIResource {
|
|
|
749
824
|
chunkType: "interrupt";
|
|
750
825
|
};
|
|
751
826
|
role: "agent";
|
|
827
|
+
} | {
|
|
828
|
+
conversationId: string;
|
|
829
|
+
modelName: string;
|
|
830
|
+
modelProviderId: string;
|
|
831
|
+
runId: string;
|
|
832
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
833
|
+
id: string;
|
|
834
|
+
content: {
|
|
835
|
+
chunkType: "jobUpdate";
|
|
836
|
+
jobId: string;
|
|
837
|
+
jobState: string;
|
|
838
|
+
toolExecutionId: string;
|
|
839
|
+
toolName: string;
|
|
840
|
+
};
|
|
841
|
+
role: "agent";
|
|
752
842
|
} | {
|
|
753
843
|
conversationId: string;
|
|
754
844
|
modelName: string;
|
|
@@ -86,6 +86,18 @@ export declare const chatEventCodec: z.ZodMiniCodec<z.ZodMiniDiscriminatedUnion<
|
|
|
86
86
|
modelName: z.ZodMiniString<string>;
|
|
87
87
|
modelProviderId: z.ZodMiniString<string>;
|
|
88
88
|
runId: z.ZodMiniString<string>;
|
|
89
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
90
|
+
chunkType: z.ZodMiniLiteral<"jobUpdate">;
|
|
91
|
+
jobId: z.ZodMiniString<string>;
|
|
92
|
+
jobState: z.ZodMiniString<string>;
|
|
93
|
+
toolExecutionId: z.ZodMiniString<string>;
|
|
94
|
+
toolName: z.ZodMiniString<string>;
|
|
95
|
+
conversationId: z.ZodMiniString<string>;
|
|
96
|
+
createdAt: z.ZodMiniString<string>;
|
|
97
|
+
messageId: z.ZodMiniString<string>;
|
|
98
|
+
modelName: z.ZodMiniString<string>;
|
|
99
|
+
modelProviderId: z.ZodMiniString<string>;
|
|
100
|
+
runId: z.ZodMiniString<string>;
|
|
89
101
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
90
102
|
chunkType: z.ZodMiniLiteral<"model">;
|
|
91
103
|
name: z.ZodMiniString<string>;
|
|
@@ -178,6 +190,21 @@ export declare const chatEventCodec: z.ZodMiniCodec<z.ZodMiniDiscriminatedUnion<
|
|
|
178
190
|
chunkType: z.ZodMiniLiteral<"interrupt">;
|
|
179
191
|
}, z.core.$strip>;
|
|
180
192
|
role: z.ZodMiniLiteral<"agent">;
|
|
193
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
194
|
+
conversationId: z.ZodMiniString<string>;
|
|
195
|
+
modelName: z.ZodMiniString<string>;
|
|
196
|
+
modelProviderId: z.ZodMiniString<string>;
|
|
197
|
+
runId: z.ZodMiniString<string>;
|
|
198
|
+
createdAt: z.ZodMiniCustom<Temporal.Instant, Temporal.Instant>;
|
|
199
|
+
id: z.ZodMiniString<string>;
|
|
200
|
+
content: z.ZodMiniObject<{
|
|
201
|
+
chunkType: z.ZodMiniLiteral<"jobUpdate">;
|
|
202
|
+
jobId: z.ZodMiniString<string>;
|
|
203
|
+
jobState: z.ZodMiniString<string>;
|
|
204
|
+
toolExecutionId: z.ZodMiniString<string>;
|
|
205
|
+
toolName: z.ZodMiniString<string>;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
role: z.ZodMiniLiteral<"agent">;
|
|
181
208
|
}, z.core.$strict>, z.ZodMiniObject<{
|
|
182
209
|
conversationId: z.ZodMiniString<string>;
|
|
183
210
|
modelName: z.ZodMiniString<string>;
|
|
@@ -86,6 +86,13 @@ const toolResponseChunkSchema = z.object({
|
|
|
86
86
|
name: z.string(),
|
|
87
87
|
result: z.record(z.string(), z.unknown()),
|
|
88
88
|
});
|
|
89
|
+
const jobUpdateChunkSchema = z.object({
|
|
90
|
+
chunkType: z.literal("jobUpdate"),
|
|
91
|
+
jobId: z.string(),
|
|
92
|
+
jobState: z.string(),
|
|
93
|
+
toolExecutionId: z.string(),
|
|
94
|
+
toolName: z.string(),
|
|
95
|
+
});
|
|
89
96
|
const userMessageChunkSchema = z.object({
|
|
90
97
|
chunkType: z.literal("userMessage"),
|
|
91
98
|
text: z.string(),
|
|
@@ -110,6 +117,7 @@ const chatEventInputSchema = z.discriminatedUnion("chunkType", [
|
|
|
110
117
|
z.extend(endOfStreamChunkSchema, chatEventSharedSchema),
|
|
111
118
|
z.extend(interruptChunkSchema, chatEventSharedSchema),
|
|
112
119
|
z.extend(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
120
|
+
z.extend(jobUpdateChunkSchema, chatEventSharedSchema),
|
|
113
121
|
z.extend(modelChunkSchema, chatEventSharedSchema),
|
|
114
122
|
z.extend(toolRequestChunkSchema, chatEventSharedSchema),
|
|
115
123
|
z.extend(toolResponseChunkSchema, chatEventSharedSchema),
|
|
@@ -133,6 +141,10 @@ const chatEventOutputSchema = z.union([
|
|
|
133
141
|
content: interruptChunkSchema,
|
|
134
142
|
role: z.literal("agent"),
|
|
135
143
|
}),
|
|
144
|
+
z.extend(chatEventOutputSharedSchema, {
|
|
145
|
+
content: jobUpdateChunkSchema,
|
|
146
|
+
role: z.literal("agent"),
|
|
147
|
+
}),
|
|
136
148
|
z.extend(chatEventOutputSharedSchema, { content: modelChunkSchema, role: z.literal("agent") }),
|
|
137
149
|
z.extend(chatEventOutputSharedSchema, {
|
|
138
150
|
content: toolRequestChunkSchema,
|
|
@@ -194,6 +206,18 @@ export const chatEventCodec = z.codec(chatEventInputSchema, chatEventOutputSchem
|
|
|
194
206
|
},
|
|
195
207
|
role: "agent",
|
|
196
208
|
};
|
|
209
|
+
case "jobUpdate":
|
|
210
|
+
return {
|
|
211
|
+
...sharedProperties,
|
|
212
|
+
content: {
|
|
213
|
+
chunkType: "jobUpdate",
|
|
214
|
+
jobId: v.jobId,
|
|
215
|
+
jobState: v.jobState,
|
|
216
|
+
toolExecutionId: v.toolExecutionId,
|
|
217
|
+
toolName: v.toolName,
|
|
218
|
+
},
|
|
219
|
+
role: "agent",
|
|
220
|
+
};
|
|
197
221
|
case "model":
|
|
198
222
|
return {
|
|
199
223
|
...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,EAA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AAE,CAAC,CAAC,eAAe;qBACnC;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,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 errorChunkV2Schema = z.object({\n chunkType: z.literal(\"error\"),\n message: z.string().check(z.trim(), z.minLength(2)),\n type: z.string(),\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 interruptChunkSchema = z.object({\n chunkType: z.literal(\"interrupt\"),\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 z.extend(errorChunkV2Schema, chatEventSharedSchema),\n z.extend(endOfStreamChunkSchema, chatEventSharedSchema),\n z.extend(interruptChunkSchema, 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: errorChunkV2Schema, role: z.literal(\"agent\") }),\n z.extend(chatEventOutputSharedSchema, {\n content: endOfStreamChunkSchema,\n role: z.literal(\"agent\"),\n }),\n z.extend(chatEventOutputSharedSchema, {\n content: interruptChunkSchema,\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 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 \"error\":\n return {\n ...sharedProperties,\n content: {\n chunkType: \"error\",\n message: v.message,\n type: v.type,\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 \"interrupt\":\n return {\n ...sharedProperties,\n content: {\n chunkType: \"interrupt\",\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 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;IACr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AAC,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 errorChunkV2Schema = z.object({\n chunkType: z.literal(\"error\"),\n message: z.string().check(z.trim(), z.minLength(2)),\n type: z.string(),\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 interruptChunkSchema = z.object({\n chunkType: z.literal(\"interrupt\"),\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 jobUpdateChunkSchema = z.object({\n chunkType: z.literal(\"jobUpdate\"),\n jobId: z.string(),\n jobState: z.string(),\n toolExecutionId: z.string(),\n toolName: z.string(),\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 z.extend(errorChunkV2Schema, chatEventSharedSchema),\n z.extend(endOfStreamChunkSchema, chatEventSharedSchema),\n z.extend(interruptChunkSchema, chatEventSharedSchema),\n z.extend(conversationUpdateChunkSchema, chatEventSharedSchema),\n z.extend(jobUpdateChunkSchema, 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: errorChunkV2Schema, role: z.literal(\"agent\") }),\n z.extend(chatEventOutputSharedSchema, {\n content: endOfStreamChunkSchema,\n role: z.literal(\"agent\"),\n }),\n z.extend(chatEventOutputSharedSchema, {\n content: interruptChunkSchema,\n role: z.literal(\"agent\"),\n }),\n z.extend(chatEventOutputSharedSchema, {\n content: jobUpdateChunkSchema,\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 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 \"error\":\n return {\n ...sharedProperties,\n content: {\n chunkType: \"error\",\n message: v.message,\n type: v.type,\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 \"interrupt\":\n return {\n ...sharedProperties,\n content: {\n chunkType: \"interrupt\",\n },\n role: \"agent\",\n } as const satisfies z.output<typeof chatEventOutputSchema>;\n case \"jobUpdate\":\n return {\n ...sharedProperties,\n content: {\n chunkType: \"jobUpdate\",\n jobId: v.jobId,\n jobState: v.jobState,\n toolExecutionId: v.toolExecutionId,\n toolName: v.toolName,\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 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"]}
|
|
@@ -81,6 +81,21 @@ export declare class AgentConversation implements AgentConversationProperties {
|
|
|
81
81
|
chunkType: "interrupt";
|
|
82
82
|
};
|
|
83
83
|
role: "agent";
|
|
84
|
+
} | {
|
|
85
|
+
conversationId: string;
|
|
86
|
+
modelName: string;
|
|
87
|
+
modelProviderId: string;
|
|
88
|
+
runId: string;
|
|
89
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
90
|
+
id: string;
|
|
91
|
+
content: {
|
|
92
|
+
chunkType: "jobUpdate";
|
|
93
|
+
jobId: string;
|
|
94
|
+
jobState: string;
|
|
95
|
+
toolExecutionId: string;
|
|
96
|
+
toolName: string;
|
|
97
|
+
};
|
|
98
|
+
role: "agent";
|
|
84
99
|
} | {
|
|
85
100
|
conversationId: string;
|
|
86
101
|
modelName: string;
|
|
@@ -186,6 +201,21 @@ export declare class AgentConversation implements AgentConversationProperties {
|
|
|
186
201
|
chunkType: "interrupt";
|
|
187
202
|
};
|
|
188
203
|
role: "agent";
|
|
204
|
+
} | {
|
|
205
|
+
conversationId: string;
|
|
206
|
+
modelName: string;
|
|
207
|
+
modelProviderId: string;
|
|
208
|
+
runId: string;
|
|
209
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
210
|
+
id: string;
|
|
211
|
+
content: {
|
|
212
|
+
chunkType: "jobUpdate";
|
|
213
|
+
jobId: string;
|
|
214
|
+
jobState: string;
|
|
215
|
+
toolExecutionId: string;
|
|
216
|
+
toolName: string;
|
|
217
|
+
};
|
|
218
|
+
role: "agent";
|
|
189
219
|
} | {
|
|
190
220
|
conversationId: string;
|
|
191
221
|
modelName: string;
|
|
@@ -116,6 +116,21 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
116
116
|
chunkType: "interrupt";
|
|
117
117
|
};
|
|
118
118
|
role: "agent";
|
|
119
|
+
} | {
|
|
120
|
+
conversationId: string;
|
|
121
|
+
modelName: string;
|
|
122
|
+
modelProviderId: string;
|
|
123
|
+
runId: string;
|
|
124
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
125
|
+
id: string;
|
|
126
|
+
content: {
|
|
127
|
+
chunkType: "jobUpdate";
|
|
128
|
+
jobId: string;
|
|
129
|
+
jobState: string;
|
|
130
|
+
toolExecutionId: string;
|
|
131
|
+
toolName: string;
|
|
132
|
+
};
|
|
133
|
+
role: "agent";
|
|
119
134
|
} | {
|
|
120
135
|
conversationId: string;
|
|
121
136
|
modelName: string;
|
|
@@ -235,6 +250,21 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
235
250
|
chunkType: "interrupt";
|
|
236
251
|
};
|
|
237
252
|
role: "agent";
|
|
253
|
+
} | {
|
|
254
|
+
conversationId: string;
|
|
255
|
+
modelName: string;
|
|
256
|
+
modelProviderId: string;
|
|
257
|
+
runId: string;
|
|
258
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
259
|
+
id: string;
|
|
260
|
+
content: {
|
|
261
|
+
chunkType: "jobUpdate";
|
|
262
|
+
jobId: string;
|
|
263
|
+
jobState: string;
|
|
264
|
+
toolExecutionId: string;
|
|
265
|
+
toolName: string;
|
|
266
|
+
};
|
|
267
|
+
role: "agent";
|
|
238
268
|
} | {
|
|
239
269
|
conversationId: string;
|
|
240
270
|
modelName: string;
|
|
@@ -361,6 +391,21 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
361
391
|
chunkType: "interrupt";
|
|
362
392
|
};
|
|
363
393
|
role: "agent";
|
|
394
|
+
} | {
|
|
395
|
+
conversationId: string;
|
|
396
|
+
modelName: string;
|
|
397
|
+
modelProviderId: string;
|
|
398
|
+
runId: string;
|
|
399
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
400
|
+
id: string;
|
|
401
|
+
content: {
|
|
402
|
+
chunkType: "jobUpdate";
|
|
403
|
+
jobId: string;
|
|
404
|
+
jobState: string;
|
|
405
|
+
toolExecutionId: string;
|
|
406
|
+
toolName: string;
|
|
407
|
+
};
|
|
408
|
+
role: "agent";
|
|
364
409
|
} | {
|
|
365
410
|
conversationId: string;
|
|
366
411
|
modelName: string;
|
|
@@ -504,6 +549,21 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
504
549
|
chunkType: "interrupt";
|
|
505
550
|
};
|
|
506
551
|
role: "agent";
|
|
552
|
+
} | {
|
|
553
|
+
conversationId: string;
|
|
554
|
+
modelName: string;
|
|
555
|
+
modelProviderId: string;
|
|
556
|
+
runId: string;
|
|
557
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
558
|
+
id: string;
|
|
559
|
+
content: {
|
|
560
|
+
chunkType: "jobUpdate";
|
|
561
|
+
jobId: string;
|
|
562
|
+
jobState: string;
|
|
563
|
+
toolExecutionId: string;
|
|
564
|
+
toolName: string;
|
|
565
|
+
};
|
|
566
|
+
role: "agent";
|
|
507
567
|
} | {
|
|
508
568
|
conversationId: string;
|
|
509
569
|
modelName: string;
|
|
@@ -627,6 +687,21 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
627
687
|
chunkType: "interrupt";
|
|
628
688
|
};
|
|
629
689
|
role: "agent";
|
|
690
|
+
} | {
|
|
691
|
+
conversationId: string;
|
|
692
|
+
modelName: string;
|
|
693
|
+
modelProviderId: string;
|
|
694
|
+
runId: string;
|
|
695
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
696
|
+
id: string;
|
|
697
|
+
content: {
|
|
698
|
+
chunkType: "jobUpdate";
|
|
699
|
+
jobId: string;
|
|
700
|
+
jobState: string;
|
|
701
|
+
toolExecutionId: string;
|
|
702
|
+
toolName: string;
|
|
703
|
+
};
|
|
704
|
+
role: "agent";
|
|
630
705
|
} | {
|
|
631
706
|
conversationId: string;
|
|
632
707
|
modelName: string;
|
|
@@ -765,6 +840,21 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
765
840
|
chunkType: "interrupt";
|
|
766
841
|
};
|
|
767
842
|
role: "agent";
|
|
843
|
+
} | {
|
|
844
|
+
conversationId: string;
|
|
845
|
+
modelName: string;
|
|
846
|
+
modelProviderId: string;
|
|
847
|
+
runId: string;
|
|
848
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
849
|
+
id: string;
|
|
850
|
+
content: {
|
|
851
|
+
chunkType: "jobUpdate";
|
|
852
|
+
jobId: string;
|
|
853
|
+
jobState: string;
|
|
854
|
+
toolExecutionId: string;
|
|
855
|
+
toolName: string;
|
|
856
|
+
};
|
|
857
|
+
role: "agent";
|
|
768
858
|
} | {
|
|
769
859
|
conversationId: string;
|
|
770
860
|
modelName: string;
|
|
@@ -53,6 +53,21 @@ export declare const retrieveConversationHistory: (config: SonarV4Config) => (id
|
|
|
53
53
|
chunkType: "interrupt";
|
|
54
54
|
};
|
|
55
55
|
role: "agent";
|
|
56
|
+
} | {
|
|
57
|
+
conversationId: string;
|
|
58
|
+
modelName: string;
|
|
59
|
+
modelProviderId: string;
|
|
60
|
+
runId: string;
|
|
61
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
62
|
+
id: string;
|
|
63
|
+
content: {
|
|
64
|
+
chunkType: "jobUpdate";
|
|
65
|
+
jobId: string;
|
|
66
|
+
jobState: string;
|
|
67
|
+
toolExecutionId: string;
|
|
68
|
+
toolName: string;
|
|
69
|
+
};
|
|
70
|
+
role: "agent";
|
|
56
71
|
} | {
|
|
57
72
|
conversationId: string;
|
|
58
73
|
modelName: string;
|
package/dist-iife/cloud.js
CHANGED
|
@@ -16961,6 +16961,13 @@ var DremioCloud = (() => {
|
|
|
16961
16961
|
name: string2(),
|
|
16962
16962
|
result: record(string2(), unknown())
|
|
16963
16963
|
});
|
|
16964
|
+
var jobUpdateChunkSchema = object({
|
|
16965
|
+
chunkType: literal("jobUpdate"),
|
|
16966
|
+
jobId: string2(),
|
|
16967
|
+
jobState: string2(),
|
|
16968
|
+
toolExecutionId: string2(),
|
|
16969
|
+
toolName: string2()
|
|
16970
|
+
});
|
|
16964
16971
|
var userMessageChunkSchema = object({
|
|
16965
16972
|
chunkType: literal("userMessage"),
|
|
16966
16973
|
text: string2()
|
|
@@ -16976,6 +16983,7 @@ var DremioCloud = (() => {
|
|
|
16976
16983
|
extend2(endOfStreamChunkSchema, chatEventSharedSchema),
|
|
16977
16984
|
extend2(interruptChunkSchema, chatEventSharedSchema),
|
|
16978
16985
|
extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
16986
|
+
extend2(jobUpdateChunkSchema, chatEventSharedSchema),
|
|
16979
16987
|
extend2(modelChunkSchema, chatEventSharedSchema),
|
|
16980
16988
|
extend2(toolRequestChunkSchema, chatEventSharedSchema),
|
|
16981
16989
|
extend2(toolResponseChunkSchema, chatEventSharedSchema),
|
|
@@ -16999,6 +17007,10 @@ var DremioCloud = (() => {
|
|
|
16999
17007
|
content: interruptChunkSchema,
|
|
17000
17008
|
role: literal("agent")
|
|
17001
17009
|
}),
|
|
17010
|
+
extend2(chatEventOutputSharedSchema, {
|
|
17011
|
+
content: jobUpdateChunkSchema,
|
|
17012
|
+
role: literal("agent")
|
|
17013
|
+
}),
|
|
17002
17014
|
extend2(chatEventOutputSharedSchema, { content: modelChunkSchema, role: literal("agent") }),
|
|
17003
17015
|
extend2(chatEventOutputSharedSchema, {
|
|
17004
17016
|
content: toolRequestChunkSchema,
|
|
@@ -17060,6 +17072,18 @@ var DremioCloud = (() => {
|
|
|
17060
17072
|
},
|
|
17061
17073
|
role: "agent"
|
|
17062
17074
|
};
|
|
17075
|
+
case "jobUpdate":
|
|
17076
|
+
return {
|
|
17077
|
+
...sharedProperties,
|
|
17078
|
+
content: {
|
|
17079
|
+
chunkType: "jobUpdate",
|
|
17080
|
+
jobId: v2.jobId,
|
|
17081
|
+
jobState: v2.jobState,
|
|
17082
|
+
toolExecutionId: v2.toolExecutionId,
|
|
17083
|
+
toolName: v2.toolName
|
|
17084
|
+
},
|
|
17085
|
+
role: "agent"
|
|
17086
|
+
};
|
|
17063
17087
|
case "model":
|
|
17064
17088
|
return {
|
|
17065
17089
|
...sharedProperties,
|
package/dist-iife/enterprise.js
CHANGED
|
@@ -16082,6 +16082,13 @@ var DremioEnterprise = (() => {
|
|
|
16082
16082
|
name: string2(),
|
|
16083
16083
|
result: record(string2(), unknown())
|
|
16084
16084
|
});
|
|
16085
|
+
var jobUpdateChunkSchema = object({
|
|
16086
|
+
chunkType: literal("jobUpdate"),
|
|
16087
|
+
jobId: string2(),
|
|
16088
|
+
jobState: string2(),
|
|
16089
|
+
toolExecutionId: string2(),
|
|
16090
|
+
toolName: string2()
|
|
16091
|
+
});
|
|
16085
16092
|
var userMessageChunkSchema = object({
|
|
16086
16093
|
chunkType: literal("userMessage"),
|
|
16087
16094
|
text: string2()
|
|
@@ -16097,6 +16104,7 @@ var DremioEnterprise = (() => {
|
|
|
16097
16104
|
extend2(endOfStreamChunkSchema, chatEventSharedSchema),
|
|
16098
16105
|
extend2(interruptChunkSchema, chatEventSharedSchema),
|
|
16099
16106
|
extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
16107
|
+
extend2(jobUpdateChunkSchema, chatEventSharedSchema),
|
|
16100
16108
|
extend2(modelChunkSchema, chatEventSharedSchema),
|
|
16101
16109
|
extend2(toolRequestChunkSchema, chatEventSharedSchema),
|
|
16102
16110
|
extend2(toolResponseChunkSchema, chatEventSharedSchema),
|
|
@@ -16120,6 +16128,10 @@ var DremioEnterprise = (() => {
|
|
|
16120
16128
|
content: interruptChunkSchema,
|
|
16121
16129
|
role: literal("agent")
|
|
16122
16130
|
}),
|
|
16131
|
+
extend2(chatEventOutputSharedSchema, {
|
|
16132
|
+
content: jobUpdateChunkSchema,
|
|
16133
|
+
role: literal("agent")
|
|
16134
|
+
}),
|
|
16123
16135
|
extend2(chatEventOutputSharedSchema, { content: modelChunkSchema, role: literal("agent") }),
|
|
16124
16136
|
extend2(chatEventOutputSharedSchema, {
|
|
16125
16137
|
content: toolRequestChunkSchema,
|
|
@@ -16181,6 +16193,18 @@ var DremioEnterprise = (() => {
|
|
|
16181
16193
|
},
|
|
16182
16194
|
role: "agent"
|
|
16183
16195
|
};
|
|
16196
|
+
case "jobUpdate":
|
|
16197
|
+
return {
|
|
16198
|
+
...sharedProperties,
|
|
16199
|
+
content: {
|
|
16200
|
+
chunkType: "jobUpdate",
|
|
16201
|
+
jobId: v2.jobId,
|
|
16202
|
+
jobState: v2.jobState,
|
|
16203
|
+
toolExecutionId: v2.toolExecutionId,
|
|
16204
|
+
toolName: v2.toolName
|
|
16205
|
+
},
|
|
16206
|
+
role: "agent"
|
|
16207
|
+
};
|
|
16184
16208
|
case "model":
|
|
16185
16209
|
return {
|
|
16186
16210
|
...sharedProperties,
|