@dbx-tools/shared-genie 0.6.211 → 0.6.213

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.
@@ -46,7 +46,6 @@ import * as dashboards from "./dashboards.ts";
46
46
  // engine's codegen from the upstream `.d.ts`. Alias the handful Genie extends so
47
47
  // the widened schemas below read against short, local names.
48
48
  const {
49
- messageStatusSchema: MessageStatusSchema,
50
49
  genieAttachmentSchema: SDKGenieAttachmentSchema,
51
50
  genieMessageSchema: SDKGenieMessageSchema,
52
51
  genieQueryAttachmentSchema: SDKGenieQueryAttachmentSchema,
@@ -61,9 +60,8 @@ const {
61
60
  */
62
61
  export type MessageStatus = dashboards.MessageStatus;
63
62
 
64
- // Re-export the SDK's `MessageStatus` schema so callers can parse a
65
- // raw status without reaching back into the generated namespace.
66
- export { MessageStatusSchema };
63
+ /** Runtime validator for a raw Genie message status from the generated SDK contract. */
64
+ export const MessageStatusSchema = dashboards.messageStatusSchema;
67
65
 
68
66
  /* ----------------------------- thoughts ---------------------------- */
69
67
 
@@ -104,6 +102,7 @@ export const GenieThoughtSchema = z.object({
104
102
  thought_type: z.custom<GenieThoughtType>((v) => typeof v === "string"),
105
103
  content: z.string(),
106
104
  });
105
+ /** One typed reasoning entry attached to a Genie query. */
107
106
  export type GenieThought = z.infer<typeof GenieThoughtSchema>;
108
107
 
109
108
  /* ----------------------- attachment discriminator ---------------------- */
@@ -128,7 +127,9 @@ export const ATTACHMENT_TYPES = [
128
127
  "text",
129
128
  "suggested_questions",
130
129
  ] as const satisfies readonly string[];
130
+ /** Attachment discriminator values understood by this package version. */
131
131
  export type KnownAttachmentType = (typeof ATTACHMENT_TYPES)[number];
132
+ /** Forward-compatible attachment discriminator, including future Genie values. */
132
133
  export type AttachmentType = KnownAttachmentType | (string & {});
133
134
 
134
135
  /* ------------------- widened wire schemas + types ------------------ */
@@ -144,6 +145,7 @@ export type AttachmentType = KnownAttachmentType | (string & {});
144
145
  export const GenieQueryAttachmentSchema = SDKGenieQueryAttachmentSchema.extend({
145
146
  thoughts: z.array(GenieThoughtSchema).optional(),
146
147
  });
148
+ /** Query attachment widened with Genie's streamed reasoning thoughts. */
147
149
  export type GenieQueryAttachment = z.infer<typeof GenieQueryAttachmentSchema>;
148
150
 
149
151
  /**
@@ -158,10 +160,15 @@ export type GenieQueryAttachment = z.infer<typeof GenieQueryAttachmentSchema>;
158
160
  export type GenieTextAttachmentPurpose =
159
161
  "FOLLOW_UP_QUESTION" | "TEXT_ATTACHMENT_PURPOSE_ANSWER" | (string & {});
160
162
 
161
- /** Text attachment schema widened for forward-compatible purpose values. */
163
+ /**
164
+ * Text attachment widened for forward-compatible purpose values and optional
165
+ * Agent Mode table metadata.
166
+ */
162
167
  export const GenieTextAttachmentSchema = dashboards.textAttachmentSchema.extend({
163
168
  purpose: z.custom<GenieTextAttachmentPurpose>((value) => typeof value === "string").optional(),
169
+ metadata: z.unknown().optional(),
164
170
  });
171
+ /** Narrative text attachment, including its optional semantic purpose. */
165
172
  export type GenieTextAttachment = z.infer<typeof GenieTextAttachmentSchema>;
166
173
 
167
174
  /**
@@ -189,6 +196,7 @@ export const GenieAttachmentSchema = SDKGenieAttachmentSchema.extend({
189
196
  text: GenieTextAttachmentSchema.optional(),
190
197
  attachment_type: z.custom<AttachmentType>((v) => typeof v === "string").optional(),
191
198
  });
199
+ /** Genie message attachment with an optional computed discriminator. */
192
200
  export type GenieAttachment = z.infer<typeof GenieAttachmentSchema>;
193
201
 
194
202
  /**
@@ -211,6 +219,7 @@ export const GenieMessageSchema = SDKGenieMessageSchema.extend({
211
219
  attachments: z.array(GenieAttachmentSchema).optional(),
212
220
  auto_regenerate_count: z.number().optional(),
213
221
  });
222
+ /** Genie message snapshot widened with typed attachments and regeneration count. */
214
223
  export type GenieMessage = z.infer<typeof GenieMessageSchema>;
215
224
 
216
225
  /**
@@ -225,6 +234,7 @@ export type GenieMessage = z.infer<typeof GenieMessageSchema>;
225
234
  * attachments and not the surrounding message envelope.
226
235
  */
227
236
  export const GenieResponseSchema = GenieMessageSchema.transform((m) => m.attachments ?? []);
237
+ /** Normalized attachment array extracted from a Genie message response. */
228
238
  export type GenieResponse = z.infer<typeof GenieResponseSchema>;
229
239
 
230
240
  /**
@@ -247,6 +257,7 @@ export const GenieSpaceSchema = SDKGenieSpaceSchema.extend({
247
257
  "The contents of the Genie Space in serialized string form. This field is excluded in List Genie spaces responses. This field provides the structure of the JSON string that represents the space's layout and components.",
248
258
  ),
249
259
  });
260
+ /** Genie space metadata with the identifiers required by chat consumers. */
250
261
  export type GenieSpace = z.infer<typeof GenieSpaceSchema>;
251
262
 
252
263
  /* ------------------------ terminal helpers ------------------------- */
@@ -257,6 +268,7 @@ export type GenieSpace = z.infer<typeof GenieSpaceSchema>;
257
268
  * statuses.
258
269
  */
259
270
  export const TERMINAL_STATUSES = ["COMPLETED", "FAILED", "CANCELLED"] as const;
271
+ /** Message status that ends a Genie turn and produces a final result event. */
260
272
  export type TerminalStatus = (typeof TERMINAL_STATUSES)[number];
261
273
 
262
274
  /** Narrow `MessageStatus | undefined` to a {@link TerminalStatus}. */
@@ -345,6 +357,7 @@ export const GenieChatLocationSchema = z.object({
345
357
  message_id: z.string().optional(),
346
358
  attachment_id: z.string().optional(),
347
359
  });
360
+ /** Conversation, message, and attachment coordinates shared by attachment events. */
348
361
  export type GenieChatLocation = z.infer<typeof GenieChatLocationSchema>;
349
362
 
350
363
  /**
@@ -372,6 +385,7 @@ export const QuestionEventSchema = GenieChatLocationSchema.omit({
372
385
  type: z.literal("question"),
373
386
  content: z.string(),
374
387
  });
388
+ /** Initial event carrying the user's question after Genie assigns a message id. */
375
389
  export type QuestionEvent = z.infer<typeof QuestionEventSchema>;
376
390
 
377
391
  /**
@@ -387,6 +401,7 @@ export const MessageEventSchema = GenieChatLocationSchema.omit({
387
401
  type: z.literal("message"),
388
402
  message: GenieMessageSchema,
389
403
  });
404
+ /** Raw Genie message snapshot emitted on every poll iteration. */
390
405
  export type MessageEvent = z.infer<typeof MessageEventSchema>;
391
406
 
392
407
  /**
@@ -402,6 +417,7 @@ export const StatusEventSchema = GenieChatLocationSchema.omit({
402
417
  status: MessageStatusSchema,
403
418
  previous_status: MessageStatusSchema.optional(),
404
419
  });
420
+ /** Message-status transition, including the previous status when available. */
405
421
  export type StatusEvent = z.infer<typeof StatusEventSchema>;
406
422
 
407
423
  /**
@@ -416,6 +432,7 @@ export const AttachmentEventSchema = GenieChatLocationSchema.extend({
416
432
  index: z.number(),
417
433
  attachment_type: z.custom<AttachmentType>((v) => typeof v === "string"),
418
434
  });
435
+ /** Event emitted when a new typed attachment appears on the message. */
419
436
  export type AttachmentEvent = z.infer<typeof AttachmentEventSchema>;
420
437
 
421
438
  /**
@@ -431,6 +448,7 @@ export const ThinkingEventSchema = GenieChatLocationSchema.extend({
431
448
  text: z.string(),
432
449
  thought_type: z.custom<GenieThoughtType>((v) => typeof v === "string"),
433
450
  });
451
+ /** Incremental Genie reasoning event derived from query thoughts. */
434
452
  export type ThinkingEvent = z.infer<typeof ThinkingEventSchema>;
435
453
 
436
454
  /**
@@ -442,6 +460,7 @@ export const TextEventSchema = GenieChatLocationSchema.extend({
442
460
  type: z.literal("text"),
443
461
  text: z.string(),
444
462
  });
463
+ /** Narrative answer fragment emitted from a Genie text attachment. */
445
464
  export type TextEvent = z.infer<typeof TextEventSchema>;
446
465
 
447
466
  /**
@@ -458,6 +477,7 @@ export const QueryEventSchema = GenieChatLocationSchema.extend({
458
477
  title: z.string().optional(),
459
478
  description: z.string().optional(),
460
479
  });
480
+ /** Finalized or rewritten SQL emitted for a Genie query attachment. */
461
481
  export type QueryEvent = z.infer<typeof QueryEventSchema>;
462
482
 
463
483
  /**
@@ -471,6 +491,7 @@ export const StatementEventSchema = GenieChatLocationSchema.extend({
471
491
  type: z.literal("statement"),
472
492
  statement_id: z.string(),
473
493
  });
494
+ /** Event indicating that a query received an executable statement id. */
474
495
  export type StatementEvent = z.infer<typeof StatementEventSchema>;
475
496
 
476
497
  /**
@@ -485,6 +506,7 @@ export const RowsEventSchema = GenieChatLocationSchema.extend({
485
506
  previous_row_count: z.number().optional(),
486
507
  statement_id: z.string().optional(),
487
508
  });
509
+ /** Row-count transition for a Genie query result. */
488
510
  export type RowsEvent = z.infer<typeof RowsEventSchema>;
489
511
 
490
512
  /**
@@ -496,6 +518,7 @@ export const SuggestedQuestionsEventSchema = GenieChatLocationSchema.extend({
496
518
  type: z.literal("suggested_questions"),
497
519
  questions: z.array(z.string()),
498
520
  });
521
+ /** Follow-up question list emitted when Genie adds or rewrites suggestions. */
499
522
  export type SuggestedQuestionsEvent = z.infer<typeof SuggestedQuestionsEventSchema>;
500
523
 
501
524
  /**
@@ -511,6 +534,7 @@ export const ResultEventSchema = GenieChatLocationSchema.omit({
511
534
  status: z.enum(TERMINAL_STATUSES),
512
535
  message: GenieMessageSchema,
513
536
  });
537
+ /** Final event for a Genie turn, carrying its terminal status and message snapshot. */
514
538
  export type ResultEvent = z.infer<typeof ResultEventSchema>;
515
539
 
516
540
  /**
@@ -560,6 +584,7 @@ export const GenieChatEventSchema = z.discriminatedUnion("type", [
560
584
  SuggestedQuestionsEventSchema,
561
585
  ResultEventSchema,
562
586
  ]);
587
+ /** Ordered event union yielded by `genieEventChat`; failures are thrown, not emitted. */
563
588
  export type GenieChatEvent = z.infer<typeof GenieChatEventSchema>;
564
589
 
565
590
  /** Discriminator type for {@link GenieChatEvent}. */