@dremio/js-sdk 0.52.0 → 0.54.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/Dremio.d.ts +2 -0
- package/dist/cloud/Dremio.js +3 -0
- package/dist/cloud/Dremio.js.map +1 -1
- package/dist/cloud/ai/AIResource.d.ts +90 -0
- package/dist/cloud/roles/Role.d.ts +19 -0
- package/dist/cloud/roles/Role.js +28 -0
- package/dist/cloud/roles/Role.js.map +1 -0
- package/dist/cloud/roles/RolesResource.d.ts +73 -0
- package/dist/cloud/roles/RolesResource.js +204 -0
- package/dist/cloud/roles/RolesResource.js.map +1 -0
- package/dist/cloud/users/User.d.ts +2 -0
- package/dist/cloud/users/User.js +4 -0
- package/dist/cloud/users/User.js.map +1 -1
- package/dist/cloud/users/userPropertiesCodec.d.ts +4 -0
- package/dist/cloud/users/userPropertiesCodec.js +8 -0
- package/dist/cloud/users/userPropertiesCodec.js.map +1 -1
- 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 +219 -2
- package/dist-iife/enterprise.js +24 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ export declare const identityTypeSchema: z.ZodMiniEnum<{
|
|
|
5
5
|
}>;
|
|
6
6
|
export declare const userPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
|
|
7
7
|
active: z.ZodMiniBoolean<boolean>;
|
|
8
|
+
description: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
8
9
|
firstName: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
9
10
|
id: z.ZodMiniString<string>;
|
|
10
11
|
identityType: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
@@ -13,7 +14,9 @@ export declare const userPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
|
|
|
13
14
|
}>>;
|
|
14
15
|
lastName: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
15
16
|
name: z.ZodMiniString<string>;
|
|
17
|
+
oauthClientId: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
16
18
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
19
|
+
description: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
17
20
|
email: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
18
21
|
familyName: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
19
22
|
givenName: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
@@ -22,6 +25,7 @@ export declare const userPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
|
|
|
22
25
|
REGULAR_USER: "REGULAR_USER";
|
|
23
26
|
SERVICE_USER: "SERVICE_USER";
|
|
24
27
|
}>>;
|
|
28
|
+
oauthClientId: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
25
29
|
status: z.ZodMiniEnum<{
|
|
26
30
|
ACTIVE: "ACTIVE";
|
|
27
31
|
INACTIVE: "INACTIVE";
|
|
@@ -17,28 +17,34 @@ import * as z from "zod/mini";
|
|
|
17
17
|
export const identityTypeSchema = z.enum(["REGULAR_USER", "SERVICE_USER"]);
|
|
18
18
|
const userPropertiesInSchema = z.object({
|
|
19
19
|
active: z.boolean(),
|
|
20
|
+
description: z.optional(z.nullable(z.string())),
|
|
20
21
|
firstName: z.optional(z.nullable(z.string())),
|
|
21
22
|
id: z.string().check(z.minLength(1)),
|
|
22
23
|
identityType: z.optional(identityTypeSchema),
|
|
23
24
|
lastName: z.optional(z.nullable(z.string())),
|
|
24
25
|
name: z.string(),
|
|
26
|
+
oauthClientId: z.optional(z.nullable(z.string())),
|
|
25
27
|
});
|
|
26
28
|
export const userPropertiesCodec = z.codec(userPropertiesInSchema, z.object({
|
|
29
|
+
description: z.nullable(z.string()),
|
|
27
30
|
email: z.nullable(z.string()),
|
|
28
31
|
familyName: z.nullable(z.string().check(z.trim())),
|
|
29
32
|
givenName: z.nullable(z.string().check(z.trim())),
|
|
30
33
|
id: z.string().check(z.minLength(1)),
|
|
31
34
|
identityType: z.optional(identityTypeSchema),
|
|
35
|
+
oauthClientId: z.nullable(z.string()),
|
|
32
36
|
status: z.enum(["ACTIVE", "INACTIVE"]),
|
|
33
37
|
username: z.string().check(z.trim(), z.minLength(1)),
|
|
34
38
|
}), {
|
|
35
39
|
decode(v) {
|
|
36
40
|
return {
|
|
41
|
+
description: v.description || null,
|
|
37
42
|
email: v.name || null,
|
|
38
43
|
familyName: v.lastName || null,
|
|
39
44
|
givenName: v.firstName || null,
|
|
40
45
|
id: v.id,
|
|
41
46
|
identityType: v.identityType,
|
|
47
|
+
oauthClientId: v.oauthClientId || null,
|
|
42
48
|
status: v.active ? "ACTIVE" : "INACTIVE",
|
|
43
49
|
username: v.name,
|
|
44
50
|
};
|
|
@@ -46,11 +52,13 @@ export const userPropertiesCodec = z.codec(userPropertiesInSchema, z.object({
|
|
|
46
52
|
encode(v) {
|
|
47
53
|
return {
|
|
48
54
|
active: v.status === "ACTIVE",
|
|
55
|
+
description: v.description || undefined,
|
|
49
56
|
firstName: v.givenName || undefined,
|
|
50
57
|
id: v.id,
|
|
51
58
|
identityType: v.identityType,
|
|
52
59
|
lastName: v.familyName || undefined,
|
|
53
60
|
name: v.username,
|
|
61
|
+
oauthClientId: v.oauthClientId || undefined,
|
|
54
62
|
};
|
|
55
63
|
},
|
|
56
64
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userPropertiesCodec.js","sourceRoot":"","sources":["../../../src/clo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* 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 * as z from \"zod/mini\";\n\nexport const identityTypeSchema = z.enum([\"REGULAR_USER\", \"SERVICE_USER\"]);\n\nconst userPropertiesInSchema = z.object({\n active: z.boolean(),\n description: z.optional(z.nullable(z.string())),\n firstName: z.optional(z.nullable(z.string())),\n id: z.string().check(z.minLength(1)),\n identityType: z.optional(identityTypeSchema),\n lastName: z.optional(z.nullable(z.string())),\n name: z.string(),\n oauthClientId: z.optional(z.nullable(z.string())),\n});\n\nexport const userPropertiesCodec = z.codec(\n userPropertiesInSchema,\n z.object({\n description: z.nullable(z.string()),\n email: z.nullable(z.string()),\n familyName: z.nullable(z.string().check(z.trim())),\n givenName: z.nullable(z.string().check(z.trim())),\n id: z.string().check(z.minLength(1)),\n identityType: z.optional(identityTypeSchema),\n oauthClientId: z.nullable(z.string()),\n status: z.enum([\"ACTIVE\", \"INACTIVE\"]),\n username: z.string().check(z.trim(), z.minLength(1)),\n }),\n {\n decode(v) {\n return {\n description: v.description || null,\n email: v.name || null,\n familyName: v.lastName || null,\n givenName: v.firstName || null,\n id: v.id,\n identityType: v.identityType,\n oauthClientId: v.oauthClientId || null,\n status: v.active ? (\"ACTIVE\" as const) : (\"INACTIVE\" as const),\n username: v.name,\n };\n },\n encode(v) {\n return {\n active: v.status === \"ACTIVE\",\n description: v.description || undefined,\n firstName: v.givenName || undefined,\n id: v.id,\n identityType: v.identityType,\n lastName: v.familyName || undefined,\n name: v.username,\n oauthClientId: v.oauthClientId || undefined,\n };\n },\n },\n);\n"]}
|
|
@@ -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;AA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AAE,CAAC,CAAC,SAAS;wBACtB,MAAM,EAAE,CAAC,CAAC,MAAM;wBAChB,SAAS,EAAE,aAAa;wBACxB,UAAU,EAAE,CAAC,CAAC,UAAU;wBACxB,IAAI,EAAE,CAAC,CAAC,IAAI;wBACZ,eAAe,EAAE,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,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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 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;
|