@dremio/js-sdk 0.45.5 → 0.46.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.
@@ -88,16 +88,7 @@ export declare class AIResource {
88
88
  message: UserChatMessage;
89
89
  modelName?: string | undefined;
90
90
  modelProviderId?: string | undefined;
91
- }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
92
- createdAt: import("temporal-polyfill").Temporal.Instant;
93
- currentRunId: string | null;
94
- id: string;
95
- modelName: string | null;
96
- modelProviderId: string | null;
97
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
98
- tag: string;
99
- title: string | null;
100
- }, {
91
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("../../enterprise/interfaces.ts").AgentConversation, {
101
92
  conversationId: string;
102
93
  }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
103
94
  data: ({
@@ -123,6 +114,7 @@ export declare class AIResource {
123
114
  content: {
124
115
  chunkType: "error";
125
116
  message: string;
117
+ type: string;
126
118
  };
127
119
  role: "agent";
128
120
  } | {
@@ -207,16 +199,7 @@ export declare class AIResource {
207
199
  }, {
208
200
  conversationId: string;
209
201
  }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
210
- conversation: {
211
- createdAt: import("temporal-polyfill").Temporal.Instant;
212
- currentRunId: string | null;
213
- id: string;
214
- modelName: string | null;
215
- modelProviderId: string | null;
216
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
217
- tag: string;
218
- title: string | null;
219
- };
202
+ conversation: import("../../enterprise/interfaces.ts").AgentConversation;
220
203
  history: {
221
204
  data: ({
222
205
  conversationId: string;
@@ -241,6 +224,7 @@ export declare class AIResource {
241
224
  content: {
242
225
  chunkType: "error";
243
226
  message: string;
227
+ type: string;
244
228
  };
245
229
  role: "agent";
246
230
  } | {
@@ -366,6 +350,7 @@ export declare class AIResource {
366
350
  content: {
367
351
  chunkType: "error";
368
352
  message: string;
353
+ type: string;
369
354
  };
370
355
  role: "agent";
371
356
  } | {
@@ -460,16 +445,7 @@ export declare class AIResource {
460
445
  id: string | undefined;
461
446
  } | {
462
447
  src: "retrieveConversation";
463
- logic: import("xstate").PromiseActorLogic<{
464
- createdAt: import("temporal-polyfill").Temporal.Instant;
465
- currentRunId: string | null;
466
- id: string;
467
- modelName: string | null;
468
- modelProviderId: string | null;
469
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
470
- tag: string;
471
- title: string | null;
472
- }, {
448
+ logic: import("xstate").PromiseActorLogic<import("../../enterprise/interfaces.ts").AgentConversation, {
473
449
  conversationId: string;
474
450
  }, import("xstate").EventObject>;
475
451
  id: string | undefined;
@@ -499,6 +475,7 @@ export declare class AIResource {
499
475
  content: {
500
476
  chunkType: "error";
501
477
  message: string;
478
+ type: string;
502
479
  };
503
480
  role: "agent";
504
481
  } | {
@@ -587,16 +564,7 @@ export declare class AIResource {
587
564
  } | {
588
565
  src: "retrieveState";
589
566
  logic: import("xstate").PromiseActorLogic<{
590
- conversation: {
591
- createdAt: import("temporal-polyfill").Temporal.Instant;
592
- currentRunId: string | null;
593
- id: string;
594
- modelName: string | null;
595
- modelProviderId: string | null;
596
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
597
- tag: string;
598
- title: string | null;
599
- };
567
+ conversation: import("../../enterprise/interfaces.ts").AgentConversation;
600
568
  history: {
601
569
  data: ({
602
570
  conversationId: string;
@@ -621,6 +589,7 @@ export declare class AIResource {
621
589
  content: {
622
590
  chunkType: "error";
623
591
  message: string;
592
+ type: string;
624
593
  };
625
594
  role: "agent";
626
595
  } | {
@@ -758,6 +727,7 @@ export declare class AIResource {
758
727
  content: {
759
728
  chunkType: "error";
760
729
  message: string;
730
+ type: string;
761
731
  };
762
732
  role: "agent";
763
733
  } | {
@@ -874,14 +844,32 @@ export declare class AIResource {
874
844
  }>;
875
845
  createConversation(body: z.input<typeof createConversationCodec>): import("ts-results-es").AsyncResult<import("../../enterprise/interfaces.ts").AgentConversation, HttpError>;
876
846
  listConversations(): {
877
- data({ signal }?: SignalParam): AsyncGenerator<import("../../enterprise/interfaces.ts").AgentConversation, void, unknown>;
847
+ data({ signal }?: SignalParam): AsyncGenerator<import("ts-results-es").Ok<import("../../enterprise/interfaces.ts").AgentConversation> | import("ts-results-es").Err<z.core.$ZodError<{
848
+ createdAt: import("temporal-polyfill").Temporal.Instant;
849
+ currentRunId: string | null;
850
+ id: string;
851
+ modelName: string | null;
852
+ modelProviderId: string | null;
853
+ modifiedAt: import("temporal-polyfill").Temporal.Instant;
854
+ tag: string;
855
+ title: string | null;
856
+ }>>, void, unknown>;
878
857
  getPage: (params: {
879
858
  maxResults: number;
880
859
  }, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
881
- data: import("../../enterprise/interfaces.ts").AgentConversation[];
860
+ data: (import("ts-results-es").Ok<import("../../enterprise/interfaces.ts").AgentConversation> | import("ts-results-es").Err<z.core.$ZodError<{
861
+ createdAt: import("temporal-polyfill").Temporal.Instant;
862
+ currentRunId: string | null;
863
+ id: string;
864
+ modelName: string | null;
865
+ modelProviderId: string | null;
866
+ modifiedAt: import("temporal-polyfill").Temporal.Instant;
867
+ tag: string;
868
+ title: string | null;
869
+ }>>)[];
882
870
  }, HttpError>;
883
871
  };
884
- retrieveConversation(id: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<{
872
+ retrieveConversation(id: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<import("../../enterprise/interfaces.ts").AgentConversation, HttpError | import("zod").ZodError<{
885
873
  createdAt: import("temporal-polyfill").Temporal.Instant;
886
874
  currentRunId: string | null;
887
875
  id: string;
@@ -890,7 +878,7 @@ export declare class AIResource {
890
878
  modifiedAt: import("temporal-polyfill").Temporal.Instant;
891
879
  tag: string;
892
880
  title: string | null;
893
- }, HttpError>;
881
+ }>>;
894
882
  retrieveConversationHistory(id: string): {
895
883
  data(): AsyncGenerator<ChatEvent, void, HttpError>;
896
884
  };
@@ -30,16 +30,7 @@ export declare class AIResource {
30
30
  message: UserChatMessage;
31
31
  modelName?: string | undefined;
32
32
  modelProviderId?: string | undefined;
33
- }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
34
- createdAt: import("temporal-polyfill").Temporal.Instant;
35
- currentRunId: string | null;
36
- id: string;
37
- modelName: string | null;
38
- modelProviderId: string | null;
39
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
40
- tag: string;
41
- title: string | null;
42
- }, {
33
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<AgentConversation, {
43
34
  conversationId: string;
44
35
  }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
45
36
  data: ({
@@ -65,6 +56,7 @@ export declare class AIResource {
65
56
  content: {
66
57
  chunkType: "error";
67
58
  message: string;
59
+ type: string;
68
60
  };
69
61
  role: "agent";
70
62
  } | {
@@ -149,16 +141,7 @@ export declare class AIResource {
149
141
  }, {
150
142
  conversationId: string;
151
143
  }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
152
- conversation: {
153
- createdAt: import("temporal-polyfill").Temporal.Instant;
154
- currentRunId: string | null;
155
- id: string;
156
- modelName: string | null;
157
- modelProviderId: string | null;
158
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
159
- tag: string;
160
- title: string | null;
161
- };
144
+ conversation: AgentConversation;
162
145
  history: {
163
146
  data: ({
164
147
  conversationId: string;
@@ -183,6 +166,7 @@ export declare class AIResource {
183
166
  content: {
184
167
  chunkType: "error";
185
168
  message: string;
169
+ type: string;
186
170
  };
187
171
  role: "agent";
188
172
  } | {
@@ -308,6 +292,7 @@ export declare class AIResource {
308
292
  content: {
309
293
  chunkType: "error";
310
294
  message: string;
295
+ type: string;
311
296
  };
312
297
  role: "agent";
313
298
  } | {
@@ -402,16 +387,7 @@ export declare class AIResource {
402
387
  id: string | undefined;
403
388
  } | {
404
389
  src: "retrieveConversation";
405
- logic: import("xstate").PromiseActorLogic<{
406
- createdAt: import("temporal-polyfill").Temporal.Instant;
407
- currentRunId: string | null;
408
- id: string;
409
- modelName: string | null;
410
- modelProviderId: string | null;
411
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
412
- tag: string;
413
- title: string | null;
414
- }, {
390
+ logic: import("xstate").PromiseActorLogic<AgentConversation, {
415
391
  conversationId: string;
416
392
  }, import("xstate").EventObject>;
417
393
  id: string | undefined;
@@ -441,6 +417,7 @@ export declare class AIResource {
441
417
  content: {
442
418
  chunkType: "error";
443
419
  message: string;
420
+ type: string;
444
421
  };
445
422
  role: "agent";
446
423
  } | {
@@ -529,16 +506,7 @@ export declare class AIResource {
529
506
  } | {
530
507
  src: "retrieveState";
531
508
  logic: import("xstate").PromiseActorLogic<{
532
- conversation: {
533
- createdAt: import("temporal-polyfill").Temporal.Instant;
534
- currentRunId: string | null;
535
- id: string;
536
- modelName: string | null;
537
- modelProviderId: string | null;
538
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
539
- tag: string;
540
- title: string | null;
541
- };
509
+ conversation: AgentConversation;
542
510
  history: {
543
511
  data: ({
544
512
  conversationId: string;
@@ -563,6 +531,7 @@ export declare class AIResource {
563
531
  content: {
564
532
  chunkType: "error";
565
533
  message: string;
534
+ type: string;
566
535
  };
567
536
  role: "agent";
568
537
  } | {
@@ -700,6 +669,7 @@ export declare class AIResource {
700
669
  content: {
701
670
  chunkType: "error";
702
671
  message: string;
672
+ type: string;
703
673
  };
704
674
  role: "agent";
705
675
  } | {
@@ -817,11 +787,29 @@ export declare class AIResource {
817
787
  createConversation(body: z.input<typeof createConversationCodec>): import("ts-results-es").AsyncResult<AgentConversation, HttpError>;
818
788
  createModelProvider(properties: z.output<typeof modelProviderCreateCodec>): import("ts-results-es").AsyncResult<ModelProvider, HttpError>;
819
789
  listConversations(): {
820
- data({ signal }?: SignalParam): AsyncGenerator<AgentConversation, void, unknown>;
790
+ data({ signal }?: SignalParam): AsyncGenerator<import("ts-results-es").Ok<AgentConversation> | import("ts-results-es").Err<z.core.$ZodError<{
791
+ createdAt: import("temporal-polyfill").Temporal.Instant;
792
+ currentRunId: string | null;
793
+ id: string;
794
+ modelName: string | null;
795
+ modelProviderId: string | null;
796
+ modifiedAt: import("temporal-polyfill").Temporal.Instant;
797
+ tag: string;
798
+ title: string | null;
799
+ }>>, void, unknown>;
821
800
  getPage: (params: {
822
801
  maxResults: number;
823
802
  }, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
824
- data: AgentConversation[];
803
+ data: (import("ts-results-es").Ok<AgentConversation> | import("ts-results-es").Err<z.core.$ZodError<{
804
+ createdAt: import("temporal-polyfill").Temporal.Instant;
805
+ currentRunId: string | null;
806
+ id: string;
807
+ modelName: string | null;
808
+ modelProviderId: string | null;
809
+ modifiedAt: import("temporal-polyfill").Temporal.Instant;
810
+ tag: string;
811
+ title: string | null;
812
+ }>>)[];
825
813
  }, HttpError>;
826
814
  };
827
815
  listModelProviders(): {
@@ -934,7 +922,16 @@ export declare class AIResource {
934
922
  name: string;
935
923
  isRecommended: boolean;
936
924
  }>, HttpError>;
937
- retrieveConversation(id: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<AgentConversation, HttpError>;
925
+ retrieveConversation(id: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<AgentConversation, HttpError | import("zod").ZodError<{
926
+ createdAt: import("temporal-polyfill").Temporal.Instant;
927
+ currentRunId: string | null;
928
+ id: string;
929
+ modelName: string | null;
930
+ modelProviderId: string | null;
931
+ modifiedAt: import("temporal-polyfill").Temporal.Instant;
932
+ tag: string;
933
+ title: string | null;
934
+ }>>;
938
935
  retrieveConversationHistory(id: string): {
939
936
  data(): AsyncGenerator<ChatEvent, void, HttpError>;
940
937
  };
@@ -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
- errorChunkSchema,
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: errorChunkSchema, role: z.literal("agent") }),
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,GAAG;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACrD,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC3D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CACtD,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAG;IAC5B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,eAAe,EAAE,CAAC,CAA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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,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AC,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"]}
@@ -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
  } | {
@@ -8,7 +8,7 @@ export declare const conversationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
8
8
  modelProviderId: z.ZodMiniOptional<z.ZodMiniString<string>>;
9
9
  modifiedAt: z.iso.ZodMiniISODateTime;
10
10
  tag: z.ZodMiniString<string>;
11
- title: z.ZodMiniNullable<z.ZodMiniString<string>>;
11
+ title: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
12
12
  }, z.core.$strip>, z.ZodMiniObject<{
13
13
  createdAt: z.ZodMiniCustom<Temporal.Instant, Temporal.Instant>;
14
14
  currentRunId: z.ZodMiniNullable<z.ZodMiniString<string>>;
@@ -23,7 +23,7 @@ export const conversationPropertiesCodec = z.codec(z.object({
23
23
  modelProviderId: z.optional(z.string()),
24
24
  modifiedAt: z.iso.datetime(),
25
25
  tag: z.string(),
26
- title: z.nullable(z.string()),
26
+ title: z.optional(z.nullable(z.string())),
27
27
  }), z.object({
28
28
  createdAt: z.instanceof(Temporal.Instant),
29
29
  currentRunId: z.nullable(z.string()),
@@ -43,7 +43,7 @@ export const conversationPropertiesCodec = z.codec(z.object({
43
43
  modelProviderId: v.modelProviderId || null,
44
44
  modifiedAt: Temporal.Instant.from(v.modifiedAt),
45
45
  tag: v.tag,
46
- title: v.title,
46
+ title: v.title || null,
47
47
  };
48
48
  },
49
49
  encode(v) {
@@ -1 +1 @@
1
- {"version":3,"file":"conversationPropertiesCodec.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/conversations/conversationPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAChD,CAAC,CAAC,MAAM,CAAC;IACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC3B,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC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,EAAE,CAAC,CAAC,KAAK;SACf,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,CAAC;QACN,OAAO;YACL,cAAc,EAAE,CAAC,CAAC,EAAE;YACpB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE;YACjC,YAAY,EAAE,CAAC,CAAC,YAAY,IAAI,SAAS;YACzC,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,SAAS;YACnC,eAAe,EAAE,CAAC,CAAC,eAAe,IAAI,SAAS;YAC/C,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE;YACnC,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,KAAK,EAAE,CAAC,CAAC,KAAK;SACf,CAAC;IACJ,CAAC;CACF,CACF,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\nexport const conversationPropertiesCodec = z.codec(\n z.object({\n conversationId: z.string(),\n createdAt: z.iso.datetime(),\n currentRunId: z.optional(z.string()),\n modelName: z.optional(z.string()),\n modelProviderId: z.optional(z.string()),\n modifiedAt: z.iso.datetime(),\n tag: z.string(),\n title: z.nullable(z.string()),\n }),\n z.object({\n createdAt: z.instanceof(Temporal.Instant),\n currentRunId: z.nullable(z.string()),\n id: z.string(),\n modelName: z.nullable(z.string()),\n modelProviderId: z.nullable(z.string()),\n modifiedAt: z.instanceof(Temporal.Instant),\n tag: z.string(),\n title: z.nullable(z.string()),\n }),\n {\n decode(v) {\n return {\n createdAt: Temporal.Instant.from(v.createdAt),\n currentRunId: v.currentRunId || null,\n id: v.conversationId,\n modelName: v.modelName || null,\n modelProviderId: v.modelProviderId || null,\n modifiedAt: Temporal.Instant.from(v.modifiedAt),\n tag: v.tag,\n title: v.title,\n };\n },\n encode(v) {\n return {\n conversationId: v.id,\n createdAt: v.createdAt.toString(),\n currentRunId: v.currentRunId || undefined,\n modelName: v.modelName || undefined,\n modelProviderId: v.modelProviderId || undefined,\n modifiedAt: v.modifiedAt.toString(),\n tag: v.tag,\n title: v.title,\n };\n },\n },\n);\n\nexport type ConversationEntity = z.input<typeof conversationPropertiesCodec>;\n"]}
1
+ {"version":3,"file":"conversationPropertiesCodec.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/conversations/conversationPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAChD,CAAC,CAAC,MAAM,CAAC;IACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC3B,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACvC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC5B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;CAC1C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EAAE,CAAC,CAAC,SAAS,IAAI,SAAS;YACnC,eAAe,EAAE,CAAC,CAAC,eAAe,IAAI,SAAS;YAC/C,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE;YACnC,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,KAAK,EAAE,CAAC,CAAC,KAAK;SACf,CAAC;IACJ,CAAC;CACF,CACF,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\nexport const conversationPropertiesCodec = z.codec(\n z.object({\n conversationId: z.string(),\n createdAt: z.iso.datetime(),\n currentRunId: z.optional(z.string()),\n modelName: z.optional(z.string()),\n modelProviderId: z.optional(z.string()),\n modifiedAt: z.iso.datetime(),\n tag: z.string(),\n title: z.optional(z.nullable(z.string())),\n }),\n z.object({\n createdAt: z.instanceof(Temporal.Instant),\n currentRunId: z.nullable(z.string()),\n id: z.string(),\n modelName: z.nullable(z.string()),\n modelProviderId: z.nullable(z.string()),\n modifiedAt: z.instanceof(Temporal.Instant),\n tag: z.string(),\n title: z.nullable(z.string()),\n }),\n {\n decode(v) {\n return {\n createdAt: Temporal.Instant.from(v.createdAt),\n currentRunId: v.currentRunId || null,\n id: v.conversationId,\n modelName: v.modelName || null,\n modelProviderId: v.modelProviderId || null,\n modifiedAt: Temporal.Instant.from(v.modifiedAt),\n tag: v.tag,\n title: v.title || null,\n };\n },\n encode(v) {\n return {\n conversationId: v.id,\n createdAt: v.createdAt.toString(),\n currentRunId: v.currentRunId || undefined,\n modelName: v.modelName || undefined,\n modelProviderId: v.modelProviderId || undefined,\n modifiedAt: v.modifiedAt.toString(),\n tag: v.tag,\n title: v.title,\n };\n },\n },\n);\n\nexport type ConversationEntity = z.input<typeof conversationPropertiesCodec>;\n"]}
@@ -48,16 +48,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
48
48
  message: UserChatMessage;
49
49
  modelName?: string | undefined;
50
50
  modelProviderId?: string | undefined;
51
- }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
52
- createdAt: import("temporal-polyfill").Temporal.Instant;
53
- currentRunId: string | null;
54
- id: string;
55
- modelName: string | null;
56
- modelProviderId: string | null;
57
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
58
- tag: string;
59
- title: string | null;
60
- }, {
51
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<AgentConversation, {
61
52
  conversationId: string;
62
53
  }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
63
54
  data: ({
@@ -83,6 +74,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
83
74
  content: {
84
75
  chunkType: "error";
85
76
  message: string;
77
+ type: string;
86
78
  };
87
79
  role: "agent";
88
80
  } | {
@@ -167,16 +159,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
167
159
  }, {
168
160
  conversationId: string;
169
161
  }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
170
- conversation: {
171
- createdAt: import("temporal-polyfill").Temporal.Instant;
172
- currentRunId: string | null;
173
- id: string;
174
- modelName: string | null;
175
- modelProviderId: string | null;
176
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
177
- tag: string;
178
- title: string | null;
179
- };
162
+ conversation: AgentConversation;
180
163
  history: {
181
164
  data: ({
182
165
  conversationId: string;
@@ -201,6 +184,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
201
184
  content: {
202
185
  chunkType: "error";
203
186
  message: string;
187
+ type: string;
204
188
  };
205
189
  role: "agent";
206
190
  } | {
@@ -326,6 +310,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
326
310
  content: {
327
311
  chunkType: "error";
328
312
  message: string;
313
+ type: string;
329
314
  };
330
315
  role: "agent";
331
316
  } | {
@@ -420,16 +405,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
420
405
  id: string | undefined;
421
406
  } | {
422
407
  src: "retrieveConversation";
423
- logic: import("xstate").PromiseActorLogic<{
424
- createdAt: import("temporal-polyfill").Temporal.Instant;
425
- currentRunId: string | null;
426
- id: string;
427
- modelName: string | null;
428
- modelProviderId: string | null;
429
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
430
- tag: string;
431
- title: string | null;
432
- }, {
408
+ logic: import("xstate").PromiseActorLogic<AgentConversation, {
433
409
  conversationId: string;
434
410
  }, import("xstate").EventObject>;
435
411
  id: string | undefined;
@@ -459,6 +435,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
459
435
  content: {
460
436
  chunkType: "error";
461
437
  message: string;
438
+ type: string;
462
439
  };
463
440
  role: "agent";
464
441
  } | {
@@ -547,16 +524,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
547
524
  } | {
548
525
  src: "retrieveState";
549
526
  logic: import("xstate").PromiseActorLogic<{
550
- conversation: {
551
- createdAt: import("temporal-polyfill").Temporal.Instant;
552
- currentRunId: string | null;
553
- id: string;
554
- modelName: string | null;
555
- modelProviderId: string | null;
556
- modifiedAt: import("temporal-polyfill").Temporal.Instant;
557
- tag: string;
558
- title: string | null;
559
- };
527
+ conversation: AgentConversation;
560
528
  history: {
561
529
  data: ({
562
530
  conversationId: string;
@@ -581,6 +549,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
581
549
  content: {
582
550
  chunkType: "error";
583
551
  message: string;
552
+ type: string;
584
553
  };
585
554
  role: "agent";
586
555
  } | {
@@ -718,6 +687,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
718
687
  content: {
719
688
  chunkType: "error";
720
689
  message: string;
690
+ type: string;
721
691
  };
722
692
  role: "agent";
723
693
  } | {
@@ -1,8 +1,19 @@
1
+ import * as z from "zod/mini";
1
2
  import type { SonarV4Config } from "../../../../common/Config.ts";
2
3
  import type { SignalParam } from "../../../../common/Params.ts";
3
4
  import { AgentConversation } from "../AgentConversation.ts";
5
+ import { Err, Ok } from "ts-results-es";
4
6
  export declare const listConversations: (config: SonarV4Config) => (params: {
5
7
  maxResults: number;
6
8
  }, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
7
- data: AgentConversation[];
9
+ data: (Ok<AgentConversation> | Err<z.core.$ZodError<{
10
+ createdAt: import("temporal-polyfill").Temporal.Instant;
11
+ currentRunId: string | null;
12
+ id: string;
13
+ modelName: string | null;
14
+ modelProviderId: string | null;
15
+ modifiedAt: import("temporal-polyfill").Temporal.Instant;
16
+ tag: string;
17
+ title: string | null;
18
+ }>>)[];
8
19
  }, import("../../../index.ts").HttpError>;
@@ -16,15 +16,20 @@
16
16
  import * as z from "zod/mini";
17
17
  import { AgentConversation } from "../AgentConversation.js";
18
18
  import { conversationPropertiesCodec, } from "../conversationPropertiesCodec.js";
19
+ import { Err, Ok } from "ts-results-es";
19
20
  export const listConversations = (config) => function listConversations(params, { signal } = {}) {
20
21
  return config
21
22
  .sonarV4Request(`agent/conversations?${new URLSearchParams({ maxResults: String(params.maxResults) }).toString()}`, { signal })
22
23
  .map((res) => res.json())
23
- .map((response) => {
24
- return {
25
- ...response,
26
- data: response.data.map((entity) => new AgentConversation(config, z.decode(conversationPropertiesCodec, entity))),
27
- };
28
- });
24
+ .map((response) => ({
25
+ ...response,
26
+ data: response.data.map((entity) => {
27
+ const decodeResult = z.safeDecode(conversationPropertiesCodec, entity);
28
+ if (!decodeResult.success) {
29
+ return Err(decodeResult.error);
30
+ }
31
+ return Ok(new AgentConversation(config, decodeResult.data));
32
+ }),
33
+ }));
29
34
  };
30
35
  //# sourceMappingURL=listConversations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"listConversations.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/listConversations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,2BAA2B,GAE5B,MAAM,mCAAmC,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAqB,EAAE,EAAE,CACzD,SAAS,iBAAiB,CAAC,MAA8B,EAAE,EAAE,MAAM,KAAkB,EAAE;IACrF,OAAO,MAAM;SACV,cAAc,CACb,uBAAuB,IAAI,eAAe,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,EAClG,EAAE,MAAM,EAAE,CACX;SACA,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA6C,CAAC;SACnE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChB,OAAO;YACL,GAAG,QAAQ;YACX,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CACrB,CAAC,MAAM,EAAE,EAAE,CACT,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAC/E;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,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 * as z from \"zod/mini\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport type { SignalParam } from \"../../../../common/Params.ts\";\nimport { AgentConversation } from \"../AgentConversation.ts\";\nimport {\n conversationPropertiesCodec,\n type ConversationEntity,\n} from \"../conversationPropertiesCodec.ts\";\n\nexport const listConversations = (config: SonarV4Config) =>\n function listConversations(params: { maxResults: number }, { signal }: SignalParam = {}) {\n return config\n .sonarV4Request(\n `agent/conversations?${new URLSearchParams({ maxResults: String(params.maxResults) }).toString()}`,\n { signal },\n )\n .map((res) => res.json() as Promise<{ data: ConversationEntity[] }>)\n .map((response) => {\n return {\n ...response,\n data: response.data.map(\n (entity) =>\n new AgentConversation(config, z.decode(conversationPropertiesCodec, entity)),\n ),\n };\n });\n };\n"]}
1
+ {"version":3,"file":"listConversations.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/listConversations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,2BAA2B,GAE5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAqB,EAAE,EAAE,CACzD,SAAS,iBAAiB,CAAC,MAA8B,EAAE,EAAE,MAAM,KAAkB,EAAE;IACrF,OAAO,MAAM;SACV,cAAc,CACb,uBAAuB,IAAI,eAAe,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,EAClG,EAAE,MAAM,EAAE,CACX;SACA,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA6C,CAAC;SACnE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClB,GAAG,QAAQ;QACX,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACjC,MAAM,YAAY,GAAG,CAAC,CAAC,UAAU,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;YAEvE,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC1B,OAAO,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC;YAED,OAAO,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC;KACH,CAAC,CAAC,CAAC;AACR,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 * as z from \"zod/mini\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport type { SignalParam } from \"../../../../common/Params.ts\";\nimport { AgentConversation } from \"../AgentConversation.ts\";\nimport {\n conversationPropertiesCodec,\n type ConversationEntity,\n} from \"../conversationPropertiesCodec.ts\";\nimport { Err, Ok } from \"ts-results-es\";\n\nexport const listConversations = (config: SonarV4Config) =>\n function listConversations(params: { maxResults: number }, { signal }: SignalParam = {}) {\n return config\n .sonarV4Request(\n `agent/conversations?${new URLSearchParams({ maxResults: String(params.maxResults) }).toString()}`,\n { signal },\n )\n .map((res) => res.json() as Promise<{ data: ConversationEntity[] }>)\n .map((response) => ({\n ...response,\n data: response.data.map((entity) => {\n const decodeResult = z.safeDecode(conversationPropertiesCodec, entity);\n\n if (!decodeResult.success) {\n return Err(decodeResult.error);\n }\n\n return Ok(new AgentConversation(config, decodeResult.data));\n }),\n }));\n };\n"]}
@@ -1,6 +1,8 @@
1
+ import z from "zod";
1
2
  import type { SonarV4Config } from "../../../../common/Config.ts";
2
3
  import type { SignalParam } from "../../../../common/Params.ts";
3
- export declare const retrieveConversation: (config: SonarV4Config) => (id: string, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
4
+ import { AgentConversation } from "../AgentConversation.ts";
5
+ export declare const retrieveConversation: (config: SonarV4Config) => (id: string, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<AgentConversation, import("../../../index.ts").HttpError | z.ZodError<{
4
6
  createdAt: import("temporal-polyfill").Temporal.Instant;
5
7
  currentRunId: string | null;
6
8
  id: string;
@@ -9,4 +11,4 @@ export declare const retrieveConversation: (config: SonarV4Config) => (id: strin
9
11
  modifiedAt: import("temporal-polyfill").Temporal.Instant;
10
12
  tag: string;
11
13
  title: string | null;
12
- }, import("../../../index.ts").HttpError>;
14
+ }>>;
@@ -15,6 +15,8 @@
15
15
  */
16
16
  import z from "zod";
17
17
  import { conversationPropertiesCodec } from "../conversationPropertiesCodec.js";
18
+ import { Err, Ok } from "ts-results-es";
19
+ import { AgentConversation } from "../AgentConversation.js";
18
20
  export const retrieveConversation = (config) => function retrieveConversation(id, { signal } = {}) {
19
21
  return config
20
22
  .sonarV4Request(`agent/conversations/${id}`, {
@@ -24,6 +26,12 @@ export const retrieveConversation = (config) => function retrieveConversation(id
24
26
  signal,
25
27
  })
26
28
  .map((res) => res.json())
27
- .map((entity) => z.decode(conversationPropertiesCodec, entity));
29
+ .andThen((entity) => {
30
+ const decodeResult = z.safeDecode(conversationPropertiesCodec, entity);
31
+ if (!decodeResult.success) {
32
+ return Err(decodeResult.error);
33
+ }
34
+ return Ok(new AgentConversation(config, decodeResult.data));
35
+ });
28
36
  };
29
37
  //# sourceMappingURL=retrieveConversation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"retrieveConversation.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/retrieveConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAqB,EAAE,EAAE,CAC5D,SAAS,oBAAoB,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;IACpE,OAAO,MAAM;SACV,cAAc,CAAC,uBAAuB,EAAE,EAAE,EAAE;QAC3C,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;SAC3B;QACD,MAAM;KACP,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;SAChF,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC;AACpE,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 z from \"zod\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport type { SignalParam } from \"../../../../common/Params.ts\";\nimport { conversationPropertiesCodec } from \"../conversationPropertiesCodec.ts\";\n\nexport const retrieveConversation = (config: SonarV4Config) =>\n function retrieveConversation(id: string, { signal }: SignalParam = {}) {\n return config\n .sonarV4Request(`agent/conversations/${id}`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof conversationPropertiesCodec>>)\n .map((entity) => z.decode(conversationPropertiesCodec, entity));\n };\n"]}
1
+ {"version":3,"file":"retrieveConversation.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/retrieveConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAqB,EAAE,EAAE,CAC5D,SAAS,oBAAoB,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;IACpE,OAAO,MAAM;SACV,cAAc,CAAC,uBAAuB,EAAE,EAAE,EAAE;QAC3C,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;SAC3B;QACD,MAAM;KACP,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;SAChF,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAClB,MAAM,YAAY,GAAG,CAAC,CAAC,UAAU,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;QAEvE,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC1B,OAAO,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACP,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 z from \"zod\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport type { SignalParam } from \"../../../../common/Params.ts\";\nimport { conversationPropertiesCodec } from \"../conversationPropertiesCodec.ts\";\nimport { Err, Ok } from \"ts-results-es\";\nimport { AgentConversation } from \"../AgentConversation.ts\";\n\nexport const retrieveConversation = (config: SonarV4Config) =>\n function retrieveConversation(id: string, { signal }: SignalParam = {}) {\n return config\n .sonarV4Request(`agent/conversations/${id}`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof conversationPropertiesCodec>>)\n .andThen((entity) => {\n const decodeResult = z.safeDecode(conversationPropertiesCodec, entity);\n\n if (!decodeResult.success) {\n return Err(decodeResult.error);\n }\n\n return Ok(new AgentConversation(config, decodeResult.data));\n });\n };\n"]}
@@ -24,6 +24,7 @@ export declare const retrieveConversationHistory: (config: SonarV4Config) => (id
24
24
  content: {
25
25
  chunkType: "error";
26
26
  message: string;
27
+ type: string;
27
28
  };
28
29
  role: "agent";
29
30
  } | {
@@ -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
- errorChunkSchema,
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: errorChunkSchema, role: literal("agent") }),
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,
@@ -24632,7 +24631,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
24632
24631
  modelProviderId: optional(string2()),
24633
24632
  modifiedAt: iso_exports.datetime(),
24634
24633
  tag: string2(),
24635
- title: nullable(string2())
24634
+ title: optional(nullable(string2()))
24636
24635
  }), object({
24637
24636
  createdAt: _instanceof(Xn.Instant),
24638
24637
  currentRunId: nullable(string2()),
@@ -24652,7 +24651,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
24652
24651
  modelProviderId: v2.modelProviderId || null,
24653
24652
  modifiedAt: Xn.Instant.from(v2.modifiedAt),
24654
24653
  tag: v2.tag,
24655
- title: v2.title
24654
+ title: v2.title || null
24656
24655
  };
24657
24656
  },
24658
24657
  encode(v2) {
@@ -27483,7 +27482,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
27483
27482
  Accept: "application/json"
27484
27483
  },
27485
27484
  signal
27486
- }).map((res) => res.json()).map((entity) => zod_default.decode(conversationPropertiesCodec, entity));
27485
+ }).map((res) => res.json()).andThen((entity) => {
27486
+ const decodeResult = zod_default.safeDecode(conversationPropertiesCodec, entity);
27487
+ if (!decodeResult.success) {
27488
+ return Err(decodeResult.error);
27489
+ }
27490
+ return Ok(new AgentConversation(config3, decodeResult.data));
27491
+ });
27487
27492
  };
27488
27493
 
27489
27494
  // dist/enterprise/ai/conversations/AgentConversation.js
@@ -27632,12 +27637,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
27632
27637
 
27633
27638
  // dist/enterprise/ai/conversations/methods/listConversations.js
27634
27639
  var listConversations = (config3) => function listConversations2(params, { signal } = {}) {
27635
- return config3.sonarV4Request(`agent/conversations?${new URLSearchParams({ maxResults: String(params.maxResults) }).toString()}`, { signal }).map((res) => res.json()).map((response) => {
27636
- return {
27637
- ...response,
27638
- data: response.data.map((entity) => new AgentConversation(config3, decode(conversationPropertiesCodec, entity)))
27639
- };
27640
- });
27640
+ return config3.sonarV4Request(`agent/conversations?${new URLSearchParams({ maxResults: String(params.maxResults) }).toString()}`, { signal }).map((res) => res.json()).map((response) => ({
27641
+ ...response,
27642
+ data: response.data.map((entity) => {
27643
+ const decodeResult = safeDecode(conversationPropertiesCodec, entity);
27644
+ if (!decodeResult.success) {
27645
+ return Err(decodeResult.error);
27646
+ }
27647
+ return Ok(new AgentConversation(config3, decodeResult.data));
27648
+ })
27649
+ }));
27641
27650
  };
27642
27651
 
27643
27652
  // node_modules/.pnpm/xstate@5.26.0/node_modules/xstate/dev/dist/xstate-dev.esm.js
@@ -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
- errorChunkSchema,
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: errorChunkSchema, role: literal("agent") }),
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,
@@ -25295,7 +25294,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25295
25294
  modelProviderId: optional(string2()),
25296
25295
  modifiedAt: iso_exports.datetime(),
25297
25296
  tag: string2(),
25298
- title: nullable(string2())
25297
+ title: optional(nullable(string2()))
25299
25298
  }), object({
25300
25299
  createdAt: _instanceof(Xn.Instant),
25301
25300
  currentRunId: nullable(string2()),
@@ -25315,7 +25314,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25315
25314
  modelProviderId: v2.modelProviderId || null,
25316
25315
  modifiedAt: Xn.Instant.from(v2.modifiedAt),
25317
25316
  tag: v2.tag,
25318
- title: v2.title
25317
+ title: v2.title || null
25319
25318
  };
25320
25319
  },
25321
25320
  encode(v2) {
@@ -28189,7 +28188,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
28189
28188
  Accept: "application/json"
28190
28189
  },
28191
28190
  signal
28192
- }).map((res) => res.json()).map((entity) => zod_default.decode(conversationPropertiesCodec, entity));
28191
+ }).map((res) => res.json()).andThen((entity) => {
28192
+ const decodeResult = zod_default.safeDecode(conversationPropertiesCodec, entity);
28193
+ if (!decodeResult.success) {
28194
+ return Err(decodeResult.error);
28195
+ }
28196
+ return Ok(new AgentConversation(config3, decodeResult.data));
28197
+ });
28193
28198
  };
28194
28199
 
28195
28200
  // dist/enterprise/ai/conversations/AgentConversation.js
@@ -28338,12 +28343,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
28338
28343
 
28339
28344
  // dist/enterprise/ai/conversations/methods/listConversations.js
28340
28345
  var listConversations = (config3) => function listConversations2(params, { signal } = {}) {
28341
- return config3.sonarV4Request(`agent/conversations?${new URLSearchParams({ maxResults: String(params.maxResults) }).toString()}`, { signal }).map((res) => res.json()).map((response) => {
28342
- return {
28343
- ...response,
28344
- data: response.data.map((entity) => new AgentConversation(config3, decode(conversationPropertiesCodec, entity)))
28345
- };
28346
- });
28346
+ return config3.sonarV4Request(`agent/conversations?${new URLSearchParams({ maxResults: String(params.maxResults) }).toString()}`, { signal }).map((res) => res.json()).map((response) => ({
28347
+ ...response,
28348
+ data: response.data.map((entity) => {
28349
+ const decodeResult = safeDecode(conversationPropertiesCodec, entity);
28350
+ if (!decodeResult.success) {
28351
+ return Err(decodeResult.error);
28352
+ }
28353
+ return Ok(new AgentConversation(config3, decodeResult.data));
28354
+ })
28355
+ }));
28347
28356
  };
28348
28357
 
28349
28358
  // node_modules/.pnpm/xstate@5.26.0/node_modules/xstate/dev/dist/xstate-dev.esm.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dremio/js-sdk",
3
- "version": "0.45.5",
3
+ "version": "0.46.0",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",