@dbx-tools/shared-genie 0.9.38 → 0.9.43

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.
@@ -87,20 +87,19 @@ export const MessageStatusSchema = dashboards.messageStatusSchema;
87
87
  * thought type doesn't break compilation; the four known types
88
88
  * still narrow correctly under `switch`.
89
89
  */
90
- export type GenieThoughtType =
91
- | "THOUGHT_TYPE_DESCRIPTION"
92
- | "THOUGHT_TYPE_DATA_SOURCING"
93
- | "THOUGHT_TYPE_STEPS"
94
- | "THOUGHT_TYPE_UNDERSTANDING"
95
- | (string & {});
90
+ export const GenieThoughtTypeSchema = z
91
+ .string()
92
+ .describe("Forward-compatible Genie reasoning thought type.");
93
+
94
+ export type GenieThoughtType = z.infer<typeof GenieThoughtTypeSchema>;
96
95
 
97
96
  /**
98
97
  * One reasoning step on a query attachment. See
99
98
  * {@link GenieThoughtType} for the known `thought_type` values.
100
99
  */
101
100
  export const GenieThoughtSchema = z.object({
102
- thought_type: z.custom<GenieThoughtType>((v) => typeof v === "string"),
103
- content: z.string(),
101
+ thought_type: GenieThoughtTypeSchema.describe("Kind of reasoning represented by this entry."),
102
+ content: z.string().describe("Reasoning text emitted for this thought."),
104
103
  });
105
104
  /** One typed reasoning entry attached to a Genie query. */
106
105
  export type GenieThought = z.infer<typeof GenieThoughtSchema>;
@@ -127,10 +126,18 @@ export const ATTACHMENT_TYPES = [
127
126
  "text",
128
127
  "suggested_questions",
129
128
  ] as const satisfies readonly string[];
130
- /** Attachment discriminator values understood by this package version. */
131
- export type KnownAttachmentType = (typeof ATTACHMENT_TYPES)[number];
132
- /** Forward-compatible attachment discriminator, including future Genie values. */
133
- export type AttachmentType = KnownAttachmentType | (string & {});
129
+
130
+ export const KnownAttachmentTypeSchema = z
131
+ .enum(ATTACHMENT_TYPES)
132
+ .describe("Attachment discriminator values understood by this package version.");
133
+
134
+ export type KnownAttachmentType = z.infer<typeof KnownAttachmentTypeSchema>;
135
+
136
+ export const AttachmentTypeSchema = z
137
+ .string()
138
+ .describe("Forward-compatible Genie attachment discriminator.");
139
+
140
+ export type AttachmentType = z.infer<typeof AttachmentTypeSchema>;
134
141
 
135
142
  /* ------------------- widened wire schemas + types ------------------ */
136
143
 
@@ -157,16 +164,19 @@ export type GenieQueryAttachment = z.infer<typeof GenieQueryAttachmentSchema>;
157
164
  * known values discoverable and accept future string values so an additive
158
165
  * server-side enum change cannot invalidate an otherwise complete message.
159
166
  */
160
- export type GenieTextAttachmentPurpose =
161
- "FOLLOW_UP_QUESTION" | "TEXT_ATTACHMENT_PURPOSE_ANSWER" | (string & {});
167
+ export const GenieTextAttachmentPurposeSchema = z
168
+ .string()
169
+ .describe("Forward-compatible semantic purpose for a Genie text attachment.");
170
+
171
+ export type GenieTextAttachmentPurpose = z.infer<typeof GenieTextAttachmentPurposeSchema>;
162
172
 
163
173
  /**
164
174
  * Text attachment widened for forward-compatible purpose values and optional
165
175
  * Agent Mode table metadata.
166
176
  */
167
177
  export const GenieTextAttachmentSchema = dashboards.textAttachmentSchema.extend({
168
- purpose: z.custom<GenieTextAttachmentPurpose>((value) => typeof value === "string").optional(),
169
- metadata: z.unknown().optional(),
178
+ purpose: GenieTextAttachmentPurposeSchema.optional(),
179
+ metadata: z.unknown().optional().describe("Agent Mode metadata attached to this text response."),
170
180
  });
171
181
  /** Narrative text attachment, including its optional semantic purpose. */
172
182
  export type GenieTextAttachment = z.infer<typeof GenieTextAttachmentSchema>;
@@ -194,7 +204,7 @@ export type GenieTextAttachment = z.infer<typeof GenieTextAttachmentSchema>;
194
204
  export const GenieAttachmentSchema = SDKGenieAttachmentSchema.extend({
195
205
  query: GenieQueryAttachmentSchema.optional(),
196
206
  text: GenieTextAttachmentSchema.optional(),
197
- attachment_type: z.custom<AttachmentType>((v) => typeof v === "string").optional(),
207
+ attachment_type: AttachmentTypeSchema.optional(),
198
208
  });
199
209
  /** Genie message attachment with an optional computed discriminator. */
200
210
  export type GenieAttachment = z.infer<typeof GenieAttachmentSchema>;
@@ -268,8 +278,12 @@ export type GenieSpace = z.infer<typeof GenieSpaceSchema>;
268
278
  * statuses.
269
279
  */
270
280
  export const TERMINAL_STATUSES = ["COMPLETED", "FAILED", "CANCELLED"] as const;
271
- /** Message status that ends a Genie turn and produces a final result event. */
272
- export type TerminalStatus = (typeof TERMINAL_STATUSES)[number];
281
+
282
+ export const TerminalStatusSchema = z
283
+ .enum(TERMINAL_STATUSES)
284
+ .describe("Message status that ends a Genie turn and produces a final result event.");
285
+
286
+ export type TerminalStatus = z.infer<typeof TerminalStatusSchema>;
273
287
 
274
288
  /** Narrow `MessageStatus | undefined` to a {@link TerminalStatus}. */
275
289
  export function isTerminalStatus(s: MessageStatus | undefined): s is TerminalStatus {
@@ -430,7 +444,7 @@ export type StatusEvent = z.infer<typeof StatusEventSchema>;
430
444
  export const AttachmentEventSchema = GenieChatLocationSchema.extend({
431
445
  type: z.literal("attachment"),
432
446
  index: z.number(),
433
- attachment_type: z.custom<AttachmentType>((v) => typeof v === "string"),
447
+ attachment_type: AttachmentTypeSchema,
434
448
  });
435
449
  /** Event emitted when a new typed attachment appears on the message. */
436
450
  export type AttachmentEvent = z.infer<typeof AttachmentEventSchema>;
@@ -446,7 +460,7 @@ export type AttachmentEvent = z.infer<typeof AttachmentEventSchema>;
446
460
  export const ThinkingEventSchema = GenieChatLocationSchema.extend({
447
461
  type: z.literal("thinking"),
448
462
  text: z.string(),
449
- thought_type: z.custom<GenieThoughtType>((v) => typeof v === "string"),
463
+ thought_type: GenieThoughtTypeSchema,
450
464
  });
451
465
  /** Incremental Genie reasoning event derived from query thoughts. */
452
466
  export type ThinkingEvent = z.infer<typeof ThinkingEventSchema>;
@@ -531,7 +545,7 @@ export const ResultEventSchema = GenieChatLocationSchema.omit({
531
545
  attachment_id: true,
532
546
  }).extend({
533
547
  type: z.literal("result"),
534
- status: z.enum(TERMINAL_STATUSES),
548
+ status: TerminalStatusSchema,
535
549
  message: GenieMessageSchema,
536
550
  });
537
551
  /** Final event for a Genie turn, carrying its terminal status and message snapshot. */