@dremio/js-sdk 0.45.5 → 0.45.6
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 +6 -0
- package/dist/enterprise/ai/AIResource.d.ts +6 -0
- package/dist/enterprise/ai/chat/chatEventSchema.d.ts +8 -8
- package/dist/enterprise/ai/chat/chatEventSchema.js +17 -18
- package/dist/enterprise/ai/chat/chatEventSchema.js.map +1 -1
- package/dist/enterprise/ai/conversations/AgentConversation.d.ts +2 -0
- package/dist/enterprise/ai/conversations/createConversationMachine.d.ts +6 -0
- package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.d.ts +1 -0
- package/dist-iife/cloud.js +17 -18
- package/dist-iife/enterprise.js +17 -18
- package/package.json +1 -1
|
@@ -123,6 +123,7 @@ export declare class AIResource {
|
|
|
123
123
|
content: {
|
|
124
124
|
chunkType: "error";
|
|
125
125
|
message: string;
|
|
126
|
+
type: string;
|
|
126
127
|
};
|
|
127
128
|
role: "agent";
|
|
128
129
|
} | {
|
|
@@ -241,6 +242,7 @@ export declare class AIResource {
|
|
|
241
242
|
content: {
|
|
242
243
|
chunkType: "error";
|
|
243
244
|
message: string;
|
|
245
|
+
type: string;
|
|
244
246
|
};
|
|
245
247
|
role: "agent";
|
|
246
248
|
} | {
|
|
@@ -366,6 +368,7 @@ export declare class AIResource {
|
|
|
366
368
|
content: {
|
|
367
369
|
chunkType: "error";
|
|
368
370
|
message: string;
|
|
371
|
+
type: string;
|
|
369
372
|
};
|
|
370
373
|
role: "agent";
|
|
371
374
|
} | {
|
|
@@ -499,6 +502,7 @@ export declare class AIResource {
|
|
|
499
502
|
content: {
|
|
500
503
|
chunkType: "error";
|
|
501
504
|
message: string;
|
|
505
|
+
type: string;
|
|
502
506
|
};
|
|
503
507
|
role: "agent";
|
|
504
508
|
} | {
|
|
@@ -621,6 +625,7 @@ export declare class AIResource {
|
|
|
621
625
|
content: {
|
|
622
626
|
chunkType: "error";
|
|
623
627
|
message: string;
|
|
628
|
+
type: string;
|
|
624
629
|
};
|
|
625
630
|
role: "agent";
|
|
626
631
|
} | {
|
|
@@ -758,6 +763,7 @@ export declare class AIResource {
|
|
|
758
763
|
content: {
|
|
759
764
|
chunkType: "error";
|
|
760
765
|
message: string;
|
|
766
|
+
type: string;
|
|
761
767
|
};
|
|
762
768
|
role: "agent";
|
|
763
769
|
} | {
|
|
@@ -65,6 +65,7 @@ export declare class AIResource {
|
|
|
65
65
|
content: {
|
|
66
66
|
chunkType: "error";
|
|
67
67
|
message: string;
|
|
68
|
+
type: string;
|
|
68
69
|
};
|
|
69
70
|
role: "agent";
|
|
70
71
|
} | {
|
|
@@ -183,6 +184,7 @@ export declare class AIResource {
|
|
|
183
184
|
content: {
|
|
184
185
|
chunkType: "error";
|
|
185
186
|
message: string;
|
|
187
|
+
type: string;
|
|
186
188
|
};
|
|
187
189
|
role: "agent";
|
|
188
190
|
} | {
|
|
@@ -308,6 +310,7 @@ export declare class AIResource {
|
|
|
308
310
|
content: {
|
|
309
311
|
chunkType: "error";
|
|
310
312
|
message: string;
|
|
313
|
+
type: string;
|
|
311
314
|
};
|
|
312
315
|
role: "agent";
|
|
313
316
|
} | {
|
|
@@ -441,6 +444,7 @@ export declare class AIResource {
|
|
|
441
444
|
content: {
|
|
442
445
|
chunkType: "error";
|
|
443
446
|
message: string;
|
|
447
|
+
type: string;
|
|
444
448
|
};
|
|
445
449
|
role: "agent";
|
|
446
450
|
} | {
|
|
@@ -563,6 +567,7 @@ export declare class AIResource {
|
|
|
563
567
|
content: {
|
|
564
568
|
chunkType: "error";
|
|
565
569
|
message: string;
|
|
570
|
+
type: string;
|
|
566
571
|
};
|
|
567
572
|
role: "agent";
|
|
568
573
|
} | {
|
|
@@ -700,6 +705,7 @@ export declare class AIResource {
|
|
|
700
705
|
content: {
|
|
701
706
|
chunkType: "error";
|
|
702
707
|
message: string;
|
|
708
|
+
type: string;
|
|
703
709
|
};
|
|
704
710
|
role: "agent";
|
|
705
711
|
} | {
|
|
@@ -52,11 +52,14 @@ export declare const chatEventV1Schema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniOb
|
|
|
52
52
|
export type ChatEventV1 = z.infer<typeof chatEventV1Schema>;
|
|
53
53
|
export declare const chatEventCodec: z.ZodMiniCodec<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
54
54
|
chunkType: z.ZodMiniLiteral<"error">;
|
|
55
|
-
/**
|
|
56
|
-
* If the message is not present or very short, it won't be useful to show
|
|
57
|
-
* anyways, so the parser should throw to the generic response error handler.
|
|
58
|
-
*/
|
|
59
55
|
message: z.ZodMiniString<string>;
|
|
56
|
+
type: z.ZodMiniString<string>;
|
|
57
|
+
conversationId: z.ZodMiniString<string>;
|
|
58
|
+
createdAt: z.ZodMiniString<string>;
|
|
59
|
+
messageId: z.ZodMiniString<string>;
|
|
60
|
+
modelName: z.ZodMiniString<string>;
|
|
61
|
+
modelProviderId: z.ZodMiniString<string>;
|
|
62
|
+
runId: z.ZodMiniString<string>;
|
|
60
63
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
61
64
|
chunkType: z.ZodMiniLiteral<"endOfStream">;
|
|
62
65
|
conversationId: z.ZodMiniString<string>;
|
|
@@ -149,11 +152,8 @@ export declare const chatEventCodec: z.ZodMiniCodec<z.ZodMiniDiscriminatedUnion<
|
|
|
149
152
|
id: z.ZodMiniString<string>;
|
|
150
153
|
content: z.ZodMiniObject<{
|
|
151
154
|
chunkType: z.ZodMiniLiteral<"error">;
|
|
152
|
-
/**
|
|
153
|
-
* If the message is not present or very short, it won't be useful to show
|
|
154
|
-
* anyways, so the parser should throw to the generic response error handler.
|
|
155
|
-
*/
|
|
156
155
|
message: z.ZodMiniString<string>;
|
|
156
|
+
type: z.ZodMiniString<string>;
|
|
157
157
|
}, z.core.$strip>;
|
|
158
158
|
role: z.ZodMiniLiteral<"agent">;
|
|
159
159
|
}, z.core.$strict>, z.ZodMiniObject<{
|
|
@@ -44,6 +44,11 @@ const errorChunkSchema = z.object({
|
|
|
44
44
|
*/
|
|
45
45
|
message: z.string().check(z.trim(), z.minLength(2)),
|
|
46
46
|
});
|
|
47
|
+
const errorChunkV2Schema = z.object({
|
|
48
|
+
chunkType: z.literal("error"),
|
|
49
|
+
message: z.string().check(z.trim(), z.minLength(2)),
|
|
50
|
+
type: z.string(),
|
|
51
|
+
});
|
|
47
52
|
const conversationUpdateChunkSchema = z.object({
|
|
48
53
|
chunkType: z.literal("conversationUpdate"),
|
|
49
54
|
summary: z.optional(z.string()),
|
|
@@ -101,7 +106,7 @@ export const chatEventV1Schema = z.discriminatedUnion("chunkType", [
|
|
|
101
106
|
z.extend(toolResponseChunkSchema, chatEventV1SharedSchema),
|
|
102
107
|
]);
|
|
103
108
|
const chatEventInputSchema = z.discriminatedUnion("chunkType", [
|
|
104
|
-
|
|
109
|
+
z.extend(errorChunkV2Schema, chatEventSharedSchema),
|
|
105
110
|
z.extend(endOfStreamChunkSchema, chatEventSharedSchema),
|
|
106
111
|
z.extend(interruptChunkSchema, chatEventSharedSchema),
|
|
107
112
|
z.extend(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
@@ -119,7 +124,7 @@ const chatEventOutputSchema = z.union([
|
|
|
119
124
|
content: conversationUpdateChunkSchema,
|
|
120
125
|
role: z.literal("agent"),
|
|
121
126
|
}),
|
|
122
|
-
z.extend(chatEventOutputSharedSchema, { content:
|
|
127
|
+
z.extend(chatEventOutputSharedSchema, { content: errorChunkV2Schema, role: z.literal("agent") }),
|
|
123
128
|
z.extend(chatEventOutputSharedSchema, {
|
|
124
129
|
content: endOfStreamChunkSchema,
|
|
125
130
|
role: z.literal("agent"),
|
|
@@ -144,21 +149,6 @@ const chatEventOutputSchema = z.union([
|
|
|
144
149
|
]);
|
|
145
150
|
export const chatEventCodec = z.codec(chatEventInputSchema, chatEventOutputSchema, {
|
|
146
151
|
decode(v) {
|
|
147
|
-
if (v.chunkType === "error") {
|
|
148
|
-
return {
|
|
149
|
-
content: {
|
|
150
|
-
chunkType: "error",
|
|
151
|
-
message: v.message,
|
|
152
|
-
},
|
|
153
|
-
conversationId: "",
|
|
154
|
-
createdAt: Temporal.Now.instant(),
|
|
155
|
-
id: "",
|
|
156
|
-
modelName: "",
|
|
157
|
-
modelProviderId: "",
|
|
158
|
-
role: "agent",
|
|
159
|
-
runId: "",
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
152
|
const sharedProperties = {
|
|
163
153
|
conversationId: v.conversationId,
|
|
164
154
|
createdAt: Temporal.Instant.from(v.createdAt),
|
|
@@ -178,6 +168,16 @@ export const chatEventCodec = z.codec(chatEventInputSchema, chatEventOutputSchem
|
|
|
178
168
|
},
|
|
179
169
|
role: "agent",
|
|
180
170
|
};
|
|
171
|
+
case "error":
|
|
172
|
+
return {
|
|
173
|
+
...sharedProperties,
|
|
174
|
+
content: {
|
|
175
|
+
chunkType: "error",
|
|
176
|
+
message: v.message,
|
|
177
|
+
type: v.type,
|
|
178
|
+
},
|
|
179
|
+
role: "agent",
|
|
180
|
+
};
|
|
181
181
|
case "endOfStream":
|
|
182
182
|
return {
|
|
183
183
|
...sharedProperties,
|
|
@@ -239,7 +239,6 @@ export const chatEventCodec = z.codec(chatEventInputSchema, chatEventOutputSchem
|
|
|
239
239
|
},
|
|
240
240
|
encode(v) {
|
|
241
241
|
return {
|
|
242
|
-
//@ts-ignore
|
|
243
242
|
conversationId: v.conversationId,
|
|
244
243
|
createdAt: v.createdAt.toString(),
|
|
245
244
|
messageId: v.id,
|
|
@@ -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,GAA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AO,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 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 errorChunkSchema,\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: errorChunkSchema, 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 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 \"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 //@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,EA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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"]}
|
|
@@ -56,6 +56,7 @@ export declare class AgentConversation implements AgentConversationProperties {
|
|
|
56
56
|
content: {
|
|
57
57
|
chunkType: "error";
|
|
58
58
|
message: string;
|
|
59
|
+
type: string;
|
|
59
60
|
};
|
|
60
61
|
role: "agent";
|
|
61
62
|
} | {
|
|
@@ -160,6 +161,7 @@ export declare class AgentConversation implements AgentConversationProperties {
|
|
|
160
161
|
content: {
|
|
161
162
|
chunkType: "error";
|
|
162
163
|
message: string;
|
|
164
|
+
type: string;
|
|
163
165
|
};
|
|
164
166
|
role: "agent";
|
|
165
167
|
} | {
|
|
@@ -83,6 +83,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
83
83
|
content: {
|
|
84
84
|
chunkType: "error";
|
|
85
85
|
message: string;
|
|
86
|
+
type: string;
|
|
86
87
|
};
|
|
87
88
|
role: "agent";
|
|
88
89
|
} | {
|
|
@@ -201,6 +202,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
201
202
|
content: {
|
|
202
203
|
chunkType: "error";
|
|
203
204
|
message: string;
|
|
205
|
+
type: string;
|
|
204
206
|
};
|
|
205
207
|
role: "agent";
|
|
206
208
|
} | {
|
|
@@ -326,6 +328,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
326
328
|
content: {
|
|
327
329
|
chunkType: "error";
|
|
328
330
|
message: string;
|
|
331
|
+
type: string;
|
|
329
332
|
};
|
|
330
333
|
role: "agent";
|
|
331
334
|
} | {
|
|
@@ -459,6 +462,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
459
462
|
content: {
|
|
460
463
|
chunkType: "error";
|
|
461
464
|
message: string;
|
|
465
|
+
type: string;
|
|
462
466
|
};
|
|
463
467
|
role: "agent";
|
|
464
468
|
} | {
|
|
@@ -581,6 +585,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
581
585
|
content: {
|
|
582
586
|
chunkType: "error";
|
|
583
587
|
message: string;
|
|
588
|
+
type: string;
|
|
584
589
|
};
|
|
585
590
|
role: "agent";
|
|
586
591
|
} | {
|
|
@@ -718,6 +723,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
718
723
|
content: {
|
|
719
724
|
chunkType: "error";
|
|
720
725
|
message: string;
|
|
726
|
+
type: string;
|
|
721
727
|
};
|
|
722
728
|
role: "agent";
|
|
723
729
|
} | {
|
package/dist-iife/cloud.js
CHANGED
|
@@ -23885,6 +23885,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23885
23885
|
*/
|
|
23886
23886
|
message: string2().check(_trim(), _minLength(2))
|
|
23887
23887
|
});
|
|
23888
|
+
var errorChunkV2Schema = object({
|
|
23889
|
+
chunkType: literal("error"),
|
|
23890
|
+
message: string2().check(_trim(), _minLength(2)),
|
|
23891
|
+
type: string2()
|
|
23892
|
+
});
|
|
23888
23893
|
var conversationUpdateChunkSchema = object({
|
|
23889
23894
|
chunkType: literal("conversationUpdate"),
|
|
23890
23895
|
summary: optional(string2()),
|
|
@@ -23933,7 +23938,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23933
23938
|
extend2(toolResponseChunkSchema, chatEventV1SharedSchema)
|
|
23934
23939
|
]);
|
|
23935
23940
|
var chatEventInputSchema = discriminatedUnion("chunkType", [
|
|
23936
|
-
|
|
23941
|
+
extend2(errorChunkV2Schema, chatEventSharedSchema),
|
|
23937
23942
|
extend2(endOfStreamChunkSchema, chatEventSharedSchema),
|
|
23938
23943
|
extend2(interruptChunkSchema, chatEventSharedSchema),
|
|
23939
23944
|
extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
@@ -23951,7 +23956,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23951
23956
|
content: conversationUpdateChunkSchema,
|
|
23952
23957
|
role: literal("agent")
|
|
23953
23958
|
}),
|
|
23954
|
-
extend2(chatEventOutputSharedSchema, { content:
|
|
23959
|
+
extend2(chatEventOutputSharedSchema, { content: errorChunkV2Schema, role: literal("agent") }),
|
|
23955
23960
|
extend2(chatEventOutputSharedSchema, {
|
|
23956
23961
|
content: endOfStreamChunkSchema,
|
|
23957
23962
|
role: literal("agent")
|
|
@@ -23976,21 +23981,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23976
23981
|
]);
|
|
23977
23982
|
var chatEventCodec = codec(chatEventInputSchema, chatEventOutputSchema, {
|
|
23978
23983
|
decode(v2) {
|
|
23979
|
-
if (v2.chunkType === "error") {
|
|
23980
|
-
return {
|
|
23981
|
-
content: {
|
|
23982
|
-
chunkType: "error",
|
|
23983
|
-
message: v2.message
|
|
23984
|
-
},
|
|
23985
|
-
conversationId: "",
|
|
23986
|
-
createdAt: Xn.Now.instant(),
|
|
23987
|
-
id: "",
|
|
23988
|
-
modelName: "",
|
|
23989
|
-
modelProviderId: "",
|
|
23990
|
-
role: "agent",
|
|
23991
|
-
runId: ""
|
|
23992
|
-
};
|
|
23993
|
-
}
|
|
23994
23984
|
const sharedProperties = {
|
|
23995
23985
|
conversationId: v2.conversationId,
|
|
23996
23986
|
createdAt: Xn.Instant.from(v2.createdAt),
|
|
@@ -24010,6 +24000,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24010
24000
|
},
|
|
24011
24001
|
role: "agent"
|
|
24012
24002
|
};
|
|
24003
|
+
case "error":
|
|
24004
|
+
return {
|
|
24005
|
+
...sharedProperties,
|
|
24006
|
+
content: {
|
|
24007
|
+
chunkType: "error",
|
|
24008
|
+
message: v2.message,
|
|
24009
|
+
type: v2.type
|
|
24010
|
+
},
|
|
24011
|
+
role: "agent"
|
|
24012
|
+
};
|
|
24013
24013
|
case "endOfStream":
|
|
24014
24014
|
return {
|
|
24015
24015
|
...sharedProperties,
|
|
@@ -24071,7 +24071,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24071
24071
|
},
|
|
24072
24072
|
encode(v2) {
|
|
24073
24073
|
return {
|
|
24074
|
-
//@ts-ignore
|
|
24075
24074
|
conversationId: v2.conversationId,
|
|
24076
24075
|
createdAt: v2.createdAt.toString(),
|
|
24077
24076
|
messageId: v2.id,
|
package/dist-iife/enterprise.js
CHANGED
|
@@ -24940,6 +24940,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24940
24940
|
*/
|
|
24941
24941
|
message: string2().check(_trim(), _minLength(2))
|
|
24942
24942
|
});
|
|
24943
|
+
var errorChunkV2Schema = object({
|
|
24944
|
+
chunkType: literal("error"),
|
|
24945
|
+
message: string2().check(_trim(), _minLength(2)),
|
|
24946
|
+
type: string2()
|
|
24947
|
+
});
|
|
24943
24948
|
var conversationUpdateChunkSchema = object({
|
|
24944
24949
|
chunkType: literal("conversationUpdate"),
|
|
24945
24950
|
summary: optional(string2()),
|
|
@@ -24988,7 +24993,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24988
24993
|
extend2(toolResponseChunkSchema, chatEventV1SharedSchema)
|
|
24989
24994
|
]);
|
|
24990
24995
|
var chatEventInputSchema = discriminatedUnion("chunkType", [
|
|
24991
|
-
|
|
24996
|
+
extend2(errorChunkV2Schema, chatEventSharedSchema),
|
|
24992
24997
|
extend2(endOfStreamChunkSchema, chatEventSharedSchema),
|
|
24993
24998
|
extend2(interruptChunkSchema, chatEventSharedSchema),
|
|
24994
24999
|
extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
@@ -25006,7 +25011,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25006
25011
|
content: conversationUpdateChunkSchema,
|
|
25007
25012
|
role: literal("agent")
|
|
25008
25013
|
}),
|
|
25009
|
-
extend2(chatEventOutputSharedSchema, { content:
|
|
25014
|
+
extend2(chatEventOutputSharedSchema, { content: errorChunkV2Schema, role: literal("agent") }),
|
|
25010
25015
|
extend2(chatEventOutputSharedSchema, {
|
|
25011
25016
|
content: endOfStreamChunkSchema,
|
|
25012
25017
|
role: literal("agent")
|
|
@@ -25031,21 +25036,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25031
25036
|
]);
|
|
25032
25037
|
var chatEventCodec = codec(chatEventInputSchema, chatEventOutputSchema, {
|
|
25033
25038
|
decode(v2) {
|
|
25034
|
-
if (v2.chunkType === "error") {
|
|
25035
|
-
return {
|
|
25036
|
-
content: {
|
|
25037
|
-
chunkType: "error",
|
|
25038
|
-
message: v2.message
|
|
25039
|
-
},
|
|
25040
|
-
conversationId: "",
|
|
25041
|
-
createdAt: Xn.Now.instant(),
|
|
25042
|
-
id: "",
|
|
25043
|
-
modelName: "",
|
|
25044
|
-
modelProviderId: "",
|
|
25045
|
-
role: "agent",
|
|
25046
|
-
runId: ""
|
|
25047
|
-
};
|
|
25048
|
-
}
|
|
25049
25039
|
const sharedProperties = {
|
|
25050
25040
|
conversationId: v2.conversationId,
|
|
25051
25041
|
createdAt: Xn.Instant.from(v2.createdAt),
|
|
@@ -25065,6 +25055,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25065
25055
|
},
|
|
25066
25056
|
role: "agent"
|
|
25067
25057
|
};
|
|
25058
|
+
case "error":
|
|
25059
|
+
return {
|
|
25060
|
+
...sharedProperties,
|
|
25061
|
+
content: {
|
|
25062
|
+
chunkType: "error",
|
|
25063
|
+
message: v2.message,
|
|
25064
|
+
type: v2.type
|
|
25065
|
+
},
|
|
25066
|
+
role: "agent"
|
|
25067
|
+
};
|
|
25068
25068
|
case "endOfStream":
|
|
25069
25069
|
return {
|
|
25070
25070
|
...sharedProperties,
|
|
@@ -25126,7 +25126,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25126
25126
|
},
|
|
25127
25127
|
encode(v2) {
|
|
25128
25128
|
return {
|
|
25129
|
-
//@ts-ignore
|
|
25130
25129
|
conversationId: v2.conversationId,
|
|
25131
25130
|
createdAt: v2.createdAt.toString(),
|
|
25132
25131
|
messageId: v2.id,
|