@dbx-tools/shared-mastra 0.3.44 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +15 -0
- package/lib/index.js +16 -0
- package/lib/src/feedback.d.ts +75 -0
- package/lib/src/feedback.js +77 -0
- package/lib/src/marker.d.ts +95 -0
- package/lib/src/marker.js +123 -0
- package/lib/src/override.d.ts +15 -0
- package/lib/src/override.js +16 -0
- package/lib/src/routes.d.ts +29 -0
- package/lib/src/routes.js +37 -0
- package/lib/src/thread.d.ts +19 -0
- package/lib/src/thread.js +20 -0
- package/lib/src/wire.d.ts +877 -0
- package/lib/src/wire.js +569 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +12 -8
|
@@ -0,0 +1,877 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-format contract for `@dbx-tools/appkit-mastra`: the
|
|
3
|
+
* dependency-free zod schemas + inferred types every consumer (the
|
|
4
|
+
* React client, browser bundles, the server plugin) shares.
|
|
5
|
+
*
|
|
6
|
+
* Kept free of `pg`, `fastembed`, and the Mastra runtime so the
|
|
7
|
+
* client can import these schemas without dragging in server-only
|
|
8
|
+
* dependencies. Three layers live here:
|
|
9
|
+
*
|
|
10
|
+
* 1. The descriptor published by `MastraPlugin.clientConfig()`
|
|
11
|
+
* plus the REST payloads its routes return (models, history,
|
|
12
|
+
* suggestions, chart embeds, statement data). The server
|
|
13
|
+
* derives every path from the plugin mount and publishes the
|
|
14
|
+
* resolved paths so the client composes URLs without
|
|
15
|
+
* hard-coding `/api/mastra` - rename the plugin and the client
|
|
16
|
+
* keeps working.
|
|
17
|
+
* 2. The `ctx.writer` event vocabulary: the wire-derived
|
|
18
|
+
* {@link GenieChatEvent}s from `@dbx-tools/genie-shared` plus
|
|
19
|
+
* the Mastra-only agent lifecycle events, unified as
|
|
20
|
+
* {@link GenieWriterEvent} so subscribers narrow both halves
|
|
21
|
+
* with a single `switch (event.type)`.
|
|
22
|
+
* 3. The Genie agent's workflow output shapes
|
|
23
|
+
* ({@link GenieAgentResult} and its summary / dataset items).
|
|
24
|
+
*
|
|
25
|
+
* The route segments live in the sibling `routes.ts`
|
|
26
|
+
* ({@link MASTRA_ROUTES}) and the embed-marker grammar in `marker.ts`,
|
|
27
|
+
* so this file stays purely declarative (schemas + inferred types).
|
|
28
|
+
* The browser client that drives these routes (`MastraPluginClient`)
|
|
29
|
+
* ships from `@dbx-tools/appkit-mastra-ui`.
|
|
30
|
+
*
|
|
31
|
+
* @module
|
|
32
|
+
*/
|
|
33
|
+
import { genieModel } from "@dbx-tools/shared-genie";
|
|
34
|
+
import { model } from "@dbx-tools/shared-model";
|
|
35
|
+
import { z } from "zod";
|
|
36
|
+
/**
|
|
37
|
+
* JSON-safe descriptor published by the Mastra plugin's
|
|
38
|
+
* `clientConfig()`.
|
|
39
|
+
*
|
|
40
|
+
* Only the irreducible data lives here: `basePath` (the one path the
|
|
41
|
+
* client can't otherwise know, since it encodes the plugin's mount
|
|
42
|
+
* name) plus the runtime agent roster. Every concrete endpoint URL is
|
|
43
|
+
* derived from `basePath` by the browser client
|
|
44
|
+
* (`MastraPluginClient`) using the shared {@link MASTRA_ROUTES}
|
|
45
|
+
* segments, so there's nothing to publish per-route.
|
|
46
|
+
*
|
|
47
|
+
* Fields:
|
|
48
|
+
* - `basePath`: plugin mount path. Always `/api/<pluginName>`. Feed
|
|
49
|
+
* it to `new MastraPluginClient(config)` (from
|
|
50
|
+
* `@dbx-tools/appkit-mastra-ui`) to get a typed client over every
|
|
51
|
+
* route plus the standard agent stream.
|
|
52
|
+
* - `defaultAgent`: agent id the client converses with when it
|
|
53
|
+
* doesn't name one.
|
|
54
|
+
* - `agents`: every registered agent id in registration order.
|
|
55
|
+
* - `feedbackEnabled`: whether the server can log user feedback to
|
|
56
|
+
* MLflow (MLflow tracing is configured). Drives whether the chat UI
|
|
57
|
+
* surfaces thumbs / comment controls. Defaults to `false` so a
|
|
58
|
+
* config published by an older server (without the field) parses
|
|
59
|
+
* cleanly to "off".
|
|
60
|
+
*/
|
|
61
|
+
export declare const MastraClientConfigSchema: z.ZodObject<{
|
|
62
|
+
basePath: z.ZodString;
|
|
63
|
+
defaultAgent: z.ZodString;
|
|
64
|
+
agents: z.ZodArray<z.ZodString>;
|
|
65
|
+
feedbackEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
export type MastraClientConfig = z.infer<typeof MastraClientConfigSchema>;
|
|
68
|
+
/**
|
|
69
|
+
* JSON payload returned by `GET ${basePath}/default-model[?agentId=]`. The
|
|
70
|
+
* static default model the agent resolves to when the client pins no model,
|
|
71
|
+
* as both the raw serving-endpoint `model` id and a `displayName` (the
|
|
72
|
+
* humanized label the picker shows). Both are `null` when the agent decides
|
|
73
|
+
* its model dynamically at call time (nothing static to advertise). Lets the
|
|
74
|
+
* picker label its default option WITHOUT waiting on the `/models` catalogue,
|
|
75
|
+
* so it never flashes a raw id on load. Kept off the static bootstrap
|
|
76
|
+
* `clientConfig` on purpose: it is per-agent and can be dynamic, so it is
|
|
77
|
+
* fetched like `/models`.
|
|
78
|
+
*/
|
|
79
|
+
export declare const DefaultModelResponseSchema: z.ZodObject<{
|
|
80
|
+
agentId: z.ZodString;
|
|
81
|
+
model: z.ZodNullable<z.ZodString>;
|
|
82
|
+
displayName: z.ZodNullable<z.ZodString>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
export type DefaultModelResponse = z.infer<typeof DefaultModelResponseSchema>;
|
|
85
|
+
/**
|
|
86
|
+
* JSON payload returned by `GET ${basePath}/models`. Wraps the shared
|
|
87
|
+
* {@link model.ServingEndpointSummarySchema} (re-exported from
|
|
88
|
+
* `@dbx-tools/shared-model`) so the catalogue
|
|
89
|
+
* descriptor has a single definition the client, server, and the
|
|
90
|
+
* standalone `@dbx-tools/model` toolkit all agree on.
|
|
91
|
+
*/
|
|
92
|
+
export declare const ServingEndpointsResponseSchema: z.ZodObject<{
|
|
93
|
+
endpoints: z.ZodArray<z.ZodObject<{
|
|
94
|
+
name: z.ZodString;
|
|
95
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
96
|
+
task: z.ZodOptional<z.ZodString>;
|
|
97
|
+
state: z.ZodOptional<z.ZodString>;
|
|
98
|
+
description: z.ZodOptional<z.ZodString>;
|
|
99
|
+
profile: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
quality: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
speed: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
cost: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
class: z.ZodOptional<z.ZodEnum<typeof model.ModelClass>>;
|
|
105
|
+
dimension: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
}, z.core.$strip>>;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
export type ServingEndpointsResponse = z.infer<typeof ServingEndpointsResponseSchema>;
|
|
109
|
+
/**
|
|
110
|
+
* Structural shape for an AI SDK V5 `UIMessage`. Defined locally
|
|
111
|
+
* so the shared types package stays dependency-free (no `ai`
|
|
112
|
+
* import). The runtime values returned by the `/history` endpoint
|
|
113
|
+
* are produced by `toAISdkV5Messages` and are 1:1 compatible with
|
|
114
|
+
* `UIMessage` from the `ai` package; clients can safely cast when
|
|
115
|
+
* needed.
|
|
116
|
+
*/
|
|
117
|
+
export declare const MastraHistoryUIMessageSchema: z.ZodObject<{
|
|
118
|
+
id: z.ZodString;
|
|
119
|
+
role: z.ZodEnum<{
|
|
120
|
+
system: "system";
|
|
121
|
+
user: "user";
|
|
122
|
+
assistant: "assistant";
|
|
123
|
+
}>;
|
|
124
|
+
parts: z.ZodReadonly<z.ZodArray<z.ZodUnknown>>;
|
|
125
|
+
metadata: z.ZodOptional<z.ZodUnknown>;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export type MastraHistoryUIMessage = z.infer<typeof MastraHistoryUIMessageSchema>;
|
|
128
|
+
/**
|
|
129
|
+
* JSON payload returned by `GET ${basePath}/history`.
|
|
130
|
+
*
|
|
131
|
+
* Fields:
|
|
132
|
+
* - `uiMessages`: page of UI-formatted messages, oldest -> newest.
|
|
133
|
+
* Always chronological regardless of the underlying pagination
|
|
134
|
+
* order so the client can prepend the array to the live
|
|
135
|
+
* transcript without sorting.
|
|
136
|
+
* - `page`: zero-indexed page that produced this response.
|
|
137
|
+
* - `perPage`: number of items requested per page.
|
|
138
|
+
* - `total`: total number of messages in the thread.
|
|
139
|
+
* - `hasMore`: true when at least one older page is still
|
|
140
|
+
* available.
|
|
141
|
+
*/
|
|
142
|
+
export declare const MastraHistoryResponseSchema: z.ZodObject<{
|
|
143
|
+
uiMessages: z.ZodArray<z.ZodObject<{
|
|
144
|
+
id: z.ZodString;
|
|
145
|
+
role: z.ZodEnum<{
|
|
146
|
+
system: "system";
|
|
147
|
+
user: "user";
|
|
148
|
+
assistant: "assistant";
|
|
149
|
+
}>;
|
|
150
|
+
parts: z.ZodReadonly<z.ZodArray<z.ZodUnknown>>;
|
|
151
|
+
metadata: z.ZodOptional<z.ZodUnknown>;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
page: z.ZodNumber;
|
|
154
|
+
perPage: z.ZodNumber;
|
|
155
|
+
total: z.ZodNumber;
|
|
156
|
+
hasMore: z.ZodBoolean;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
export type MastraHistoryResponse = z.infer<typeof MastraHistoryResponseSchema>;
|
|
159
|
+
/**
|
|
160
|
+
* JSON payload returned by `DELETE ${basePath}/history`. Deletes
|
|
161
|
+
* every persisted message + workflow snapshot tied to the caller's
|
|
162
|
+
* thread, so the next chat turn starts from a clean slate. The
|
|
163
|
+
* session cookie that anchors the thread id is preserved so the
|
|
164
|
+
* caller doesn't lose its identity - only the contents go away.
|
|
165
|
+
*
|
|
166
|
+
* `ok` is always `true` on success; the response object is kept
|
|
167
|
+
* as a struct (vs a bare 204) so future fields (e.g. `deletedAt`,
|
|
168
|
+
* `messages`) can be added without bumping the contract.
|
|
169
|
+
*
|
|
170
|
+
* Fields:
|
|
171
|
+
* - `ok`: literal `true` on success.
|
|
172
|
+
* - `agentId`: agent whose history was cleared.
|
|
173
|
+
* - `threadId`: thread id that was wiped.
|
|
174
|
+
* - `cleared`: number of messages the thread held before
|
|
175
|
+
* deletion. Useful for client-side "cleared 12 messages"
|
|
176
|
+
* toasts; `0` is reported when the thread was already empty
|
|
177
|
+
* (call is idempotent).
|
|
178
|
+
*/
|
|
179
|
+
export declare const MastraClearHistoryResponseSchema: z.ZodObject<{
|
|
180
|
+
ok: z.ZodLiteral<true>;
|
|
181
|
+
agentId: z.ZodString;
|
|
182
|
+
threadId: z.ZodString;
|
|
183
|
+
cleared: z.ZodNumber;
|
|
184
|
+
}, z.core.$strip>;
|
|
185
|
+
export type MastraClearHistoryResponse = z.infer<typeof MastraClearHistoryResponseSchema>;
|
|
186
|
+
/**
|
|
187
|
+
* A single conversation thread the resource (authenticated user) owns,
|
|
188
|
+
* as returned by `GET ${basePath}/threads`. Mirrors Mastra's
|
|
189
|
+
* `StorageThreadType` but with JSON-safe ISO-8601 timestamps (the wire
|
|
190
|
+
* can't carry `Date`).
|
|
191
|
+
*
|
|
192
|
+
* Fields:
|
|
193
|
+
* - `id`: thread id. Pass it back as the thread-selection header
|
|
194
|
+
* (`THREAD_ID_HEADER`) on a stream / history / delete call to act
|
|
195
|
+
* on this conversation.
|
|
196
|
+
* - `title`: human-readable title. Present once the agent's memory
|
|
197
|
+
* has auto-generated one (after the first turn); absent on a
|
|
198
|
+
* brand-new thread, so the UI falls back to a placeholder.
|
|
199
|
+
* - `resourceId`: owning resource (the user id). Always the caller's
|
|
200
|
+
* own resource - the list route filters by it server-side.
|
|
201
|
+
* - `createdAt` / `updatedAt`: ISO-8601 timestamps. `updatedAt` is
|
|
202
|
+
* the natural sort key for "most recent conversations first".
|
|
203
|
+
* - `metadata`: opaque thread metadata, passed through untouched.
|
|
204
|
+
*/
|
|
205
|
+
export declare const MastraThreadSchema: z.ZodObject<{
|
|
206
|
+
id: z.ZodString;
|
|
207
|
+
title: z.ZodOptional<z.ZodString>;
|
|
208
|
+
resourceId: z.ZodString;
|
|
209
|
+
createdAt: z.ZodString;
|
|
210
|
+
updatedAt: z.ZodString;
|
|
211
|
+
metadata: z.ZodOptional<z.ZodUnknown>;
|
|
212
|
+
}, z.core.$strip>;
|
|
213
|
+
export type MastraThread = z.infer<typeof MastraThreadSchema>;
|
|
214
|
+
/**
|
|
215
|
+
* JSON payload returned by `GET ${basePath}/threads`. One page of the
|
|
216
|
+
* caller's conversation threads, newest (`updatedAt` DESC) first.
|
|
217
|
+
*
|
|
218
|
+
* Fields:
|
|
219
|
+
* - `threads`: page of threads for the caller's resource.
|
|
220
|
+
* - `page`: zero-indexed page that produced this response.
|
|
221
|
+
* - `perPage`: number of items requested per page.
|
|
222
|
+
* - `total`: total number of threads the resource owns.
|
|
223
|
+
* - `hasMore`: true when at least one more page is available.
|
|
224
|
+
*/
|
|
225
|
+
export declare const MastraThreadsResponseSchema: z.ZodObject<{
|
|
226
|
+
threads: z.ZodArray<z.ZodObject<{
|
|
227
|
+
id: z.ZodString;
|
|
228
|
+
title: z.ZodOptional<z.ZodString>;
|
|
229
|
+
resourceId: z.ZodString;
|
|
230
|
+
createdAt: z.ZodString;
|
|
231
|
+
updatedAt: z.ZodString;
|
|
232
|
+
metadata: z.ZodOptional<z.ZodUnknown>;
|
|
233
|
+
}, z.core.$strip>>;
|
|
234
|
+
page: z.ZodNumber;
|
|
235
|
+
perPage: z.ZodNumber;
|
|
236
|
+
total: z.ZodNumber;
|
|
237
|
+
hasMore: z.ZodBoolean;
|
|
238
|
+
}, z.core.$strip>;
|
|
239
|
+
export type MastraThreadsResponse = z.infer<typeof MastraThreadsResponseSchema>;
|
|
240
|
+
/**
|
|
241
|
+
* JSON payload returned by `DELETE ${basePath}/threads` (thread id
|
|
242
|
+
* supplied via the thread-selection header / `threadId` query). Wipes
|
|
243
|
+
* the named thread and every message on it.
|
|
244
|
+
*
|
|
245
|
+
* Fields:
|
|
246
|
+
* - `ok`: literal `true` on success.
|
|
247
|
+
* - `agentId`: agent whose thread was deleted.
|
|
248
|
+
* - `threadId`: thread id that was removed.
|
|
249
|
+
* - `deleted`: `true` when a thread row existed and was removed,
|
|
250
|
+
* `false` when it was already gone (call is idempotent).
|
|
251
|
+
*/
|
|
252
|
+
export declare const MastraDeleteThreadResponseSchema: z.ZodObject<{
|
|
253
|
+
ok: z.ZodLiteral<true>;
|
|
254
|
+
agentId: z.ZodString;
|
|
255
|
+
threadId: z.ZodString;
|
|
256
|
+
deleted: z.ZodBoolean;
|
|
257
|
+
}, z.core.$strip>;
|
|
258
|
+
export type MastraDeleteThreadResponse = z.infer<typeof MastraDeleteThreadResponseSchema>;
|
|
259
|
+
/** Longest thread title the rename route accepts (trimmed server-side). */
|
|
260
|
+
export declare const MASTRA_THREAD_TITLE_MAX = 200;
|
|
261
|
+
/**
|
|
262
|
+
* JSON body for `PATCH ${basePath}/threads` (thread id supplied via the
|
|
263
|
+
* thread-selection header / `threadId` query). Renames a single
|
|
264
|
+
* conversation.
|
|
265
|
+
*
|
|
266
|
+
* Fields:
|
|
267
|
+
* - `title`: the new human-readable title. Trimmed and capped at
|
|
268
|
+
* {@link MASTRA_THREAD_TITLE_MAX} characters server-side; must be
|
|
269
|
+
* non-empty after trimming.
|
|
270
|
+
*/
|
|
271
|
+
export declare const MastraUpdateThreadRequestSchema: z.ZodObject<{
|
|
272
|
+
title: z.ZodString;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
export type MastraUpdateThreadRequest = z.infer<typeof MastraUpdateThreadRequestSchema>;
|
|
275
|
+
/**
|
|
276
|
+
* JSON payload returned by `PATCH ${basePath}/threads`. Echoes the
|
|
277
|
+
* renamed thread in its post-update wire shape so the client can reflect
|
|
278
|
+
* the new title without a re-fetch.
|
|
279
|
+
*
|
|
280
|
+
* Fields:
|
|
281
|
+
* - `ok`: literal `true` on success.
|
|
282
|
+
* - `agentId`: agent whose thread was renamed.
|
|
283
|
+
* - `thread`: the updated thread (carries the new `title`).
|
|
284
|
+
*/
|
|
285
|
+
export declare const MastraUpdateThreadResponseSchema: z.ZodObject<{
|
|
286
|
+
ok: z.ZodLiteral<true>;
|
|
287
|
+
agentId: z.ZodString;
|
|
288
|
+
thread: z.ZodObject<{
|
|
289
|
+
id: z.ZodString;
|
|
290
|
+
title: z.ZodOptional<z.ZodString>;
|
|
291
|
+
resourceId: z.ZodString;
|
|
292
|
+
createdAt: z.ZodString;
|
|
293
|
+
updatedAt: z.ZodString;
|
|
294
|
+
metadata: z.ZodOptional<z.ZodUnknown>;
|
|
295
|
+
}, z.core.$strip>;
|
|
296
|
+
}, z.core.$strip>;
|
|
297
|
+
export type MastraUpdateThreadResponse = z.infer<typeof MastraUpdateThreadResponseSchema>;
|
|
298
|
+
/**
|
|
299
|
+
* JSON payload returned by `GET ${basePath}/suggestions`.
|
|
300
|
+
*
|
|
301
|
+
* Carries the curated starter questions for an agent's Genie space -
|
|
302
|
+
* the `sample_questions` an author configured on the space, surfaced
|
|
303
|
+
* as one-tap prompts on the chat's empty state. `questions` is empty
|
|
304
|
+
* when the agent has no Genie space (or the space defines none), so
|
|
305
|
+
* the client renders nothing in that case rather than falling back to
|
|
306
|
+
* built-in example prompts.
|
|
307
|
+
*/
|
|
308
|
+
export declare const MastraSuggestionsResponseSchema: z.ZodObject<{
|
|
309
|
+
questions: z.ZodArray<z.ZodString>;
|
|
310
|
+
}, z.core.$strip>;
|
|
311
|
+
export type MastraSuggestionsResponse = z.infer<typeof MastraSuggestionsResponseSchema>;
|
|
312
|
+
/**
|
|
313
|
+
* Allowed chart types the planner can pick. Defined as a
|
|
314
|
+
* discriminated literal union so each variant carries its own
|
|
315
|
+
* `.describe()` clause - the server-side planner's prompt
|
|
316
|
+
* formatter walks `.options` to inline the descriptions into the
|
|
317
|
+
* model instructions, keeping the prompt in lock-step with the
|
|
318
|
+
* schema by construction. The runtime type is the plain string
|
|
319
|
+
* union (`"bar" | "line" | ...`), so consumers that just need a
|
|
320
|
+
* discriminator value behave the same as if it were a
|
|
321
|
+
* `z.enum([...])`.
|
|
322
|
+
*/
|
|
323
|
+
export declare const ChartTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"bar">, z.ZodLiteral<"line">, z.ZodLiteral<"area">, z.ZodLiteral<"scatter">, z.ZodLiteral<"pie">]>;
|
|
324
|
+
export type ChartType = z.infer<typeof ChartTypeSchema>;
|
|
325
|
+
/**
|
|
326
|
+
* Resolved chart plan a settled chart entry carries on its
|
|
327
|
+
* `result` field. `option` is the full Echarts spec; pass
|
|
328
|
+
* straight into `<ReactECharts option={...}>`.
|
|
329
|
+
*/
|
|
330
|
+
export declare const ChartResultSchema: z.ZodObject<{
|
|
331
|
+
chartType: z.ZodUnion<readonly [z.ZodLiteral<"bar">, z.ZodLiteral<"line">, z.ZodLiteral<"area">, z.ZodLiteral<"scatter">, z.ZodLiteral<"pie">]>;
|
|
332
|
+
option: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
333
|
+
}, z.core.$strip>;
|
|
334
|
+
export type ChartResult = z.infer<typeof ChartResultSchema>;
|
|
335
|
+
/**
|
|
336
|
+
* Wire-format AND server-side cache shape for a chart entry.
|
|
337
|
+
* Three lifecycle states inferred from the two optional fields
|
|
338
|
+
* (no discriminator needed):
|
|
339
|
+
*
|
|
340
|
+
* - `result` set -> chart is ready to render
|
|
341
|
+
* - `error` set -> planner / data fetch failed
|
|
342
|
+
* - both `result` and `error` unset -> still processing
|
|
343
|
+
*
|
|
344
|
+
* `option` is typed as a generic record so this package stays
|
|
345
|
+
* dependency-free of `echarts`. The server (`chart.ts`) imports
|
|
346
|
+
* this schema directly; the demo client polls the
|
|
347
|
+
* `/embed/chart/:id` route and parses responses against it.
|
|
348
|
+
*/
|
|
349
|
+
export declare const ChartSchema: z.ZodObject<{
|
|
350
|
+
chartId: z.ZodString;
|
|
351
|
+
error: z.ZodOptional<z.ZodString>;
|
|
352
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
353
|
+
chartType: z.ZodUnion<readonly [z.ZodLiteral<"bar">, z.ZodLiteral<"line">, z.ZodLiteral<"area">, z.ZodLiteral<"scatter">, z.ZodLiteral<"pie">]>;
|
|
354
|
+
option: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
355
|
+
}, z.core.$strip>>;
|
|
356
|
+
}, z.core.$strip>;
|
|
357
|
+
export type Chart = z.infer<typeof ChartSchema>;
|
|
358
|
+
/**
|
|
359
|
+
* Wire-format payload returned by `GET ${basePath}/embed/data/:id`.
|
|
360
|
+
*
|
|
361
|
+
* Mirrors the agent-side `get_statement` tool's output so the
|
|
362
|
+
* host UI and the LLM see the exact same shape for the same
|
|
363
|
+
* statement; the route is what resolves `[data:<statement_id>]`
|
|
364
|
+
* markers the agent embeds in prose.
|
|
365
|
+
*
|
|
366
|
+
* Fields:
|
|
367
|
+
* - `columns`: column names in declaration order.
|
|
368
|
+
* - `rows`: row records keyed by column name. Cell values are
|
|
369
|
+
* either coerced numbers or the original strings (Genie /
|
|
370
|
+
* Statement Execution returns every cell as `string | null`;
|
|
371
|
+
* numeric-looking cells are coerced server-side so the UI
|
|
372
|
+
* can format with `tabular-nums` without re-parsing).
|
|
373
|
+
* - `rowCount`: total row count upstream (independent of the
|
|
374
|
+
* `limit` cap). Compare against `rows.length` to detect
|
|
375
|
+
* truncation - `truncated` is the precomputed flag.
|
|
376
|
+
* - `truncated`: `true` when the server clipped rows to honor
|
|
377
|
+
* the route's row cap; the UI should surface a "showing N of
|
|
378
|
+
* M rows" affordance in that case.
|
|
379
|
+
*/
|
|
380
|
+
export declare const StatementDataSchema: z.ZodObject<{
|
|
381
|
+
columns: z.ZodArray<z.ZodString>;
|
|
382
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
383
|
+
rowCount: z.ZodNumber;
|
|
384
|
+
truncated: z.ZodBoolean;
|
|
385
|
+
}, z.core.$strip>;
|
|
386
|
+
export type StatementData = z.infer<typeof StatementDataSchema>;
|
|
387
|
+
/**
|
|
388
|
+
* The `ToolStream`-shaped writer the Mastra Genie agent and chart
|
|
389
|
+
* helpers publish events through. Defined here (vs imported from
|
|
390
|
+
* `@mastra/core`) so helpers in `@dbx-tools/appkit-mastra` can
|
|
391
|
+
* accept any object with a `.write` method without dragging
|
|
392
|
+
* Mastra's full `ToolStream` (and its agent / tool typings) into
|
|
393
|
+
* call sites. The actual Mastra `ctx.writer` is assignable to
|
|
394
|
+
* this shape so callers pass it straight through.
|
|
395
|
+
*
|
|
396
|
+
* Kept as a plain TypeScript interface (vs a zod schema) because
|
|
397
|
+
* the contract is a method - zod can only validate the shape via
|
|
398
|
+
* `z.custom`, which adds noise without buying any runtime check.
|
|
399
|
+
*/
|
|
400
|
+
export interface MastraWriter {
|
|
401
|
+
write: (chunk: unknown) => unknown;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Mastra-only lifecycle event: the Genie tool invocation started.
|
|
405
|
+
* Emitted immediately when the calling agent invokes the Genie
|
|
406
|
+
* tool, before any inner agent / wire activity, so the UI can
|
|
407
|
+
* pop a "Thinking..." pill the instant the model decides to
|
|
408
|
+
* delegate. `conversationId` / `messageId` are absent on this
|
|
409
|
+
* first emit (no Genie round-trip yet). Field names are
|
|
410
|
+
* camelCase (vs the snake_case wire events) to mirror the
|
|
411
|
+
* Genie agent's own internal data plumbing.
|
|
412
|
+
*/
|
|
413
|
+
export declare const StartedEventSchema: z.ZodObject<{
|
|
414
|
+
type: z.ZodLiteral<"started">;
|
|
415
|
+
spaceId: z.ZodString;
|
|
416
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
417
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
418
|
+
content: z.ZodString;
|
|
419
|
+
}, z.core.$strip>;
|
|
420
|
+
export type StartedEvent = z.infer<typeof StartedEventSchema>;
|
|
421
|
+
/**
|
|
422
|
+
* Mastra-only lifecycle event: one `ask_genie` invocation
|
|
423
|
+
* finished. Carries the hydrated `statementIds` (rows are fetched
|
|
424
|
+
* via `getStatement` separately) and Genie's final prose answer
|
|
425
|
+
* so the UI can move from "thinking" to "answered" without
|
|
426
|
+
* waiting for the Genie agent's whole reasoning loop to end.
|
|
427
|
+
*/
|
|
428
|
+
export declare const AskGenieDoneEventSchema: z.ZodObject<{
|
|
429
|
+
type: z.ZodLiteral<"ask_genie_done">;
|
|
430
|
+
spaceId: z.ZodString;
|
|
431
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
432
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
433
|
+
answer: z.ZodOptional<z.ZodString>;
|
|
434
|
+
statementIds: z.ZodArray<z.ZodString>;
|
|
435
|
+
status: z.ZodCustom<"ASKING_AI" | "CANCELLED" | "COMPLETED" | "EXECUTING_QUERY" | "FAILED" | "FETCHING_METADATA" | "FILTERING_CONTEXT" | "PENDING_WAREHOUSE" | "QUERY_RESULT_EXPIRED" | "SUBMITTED", "ASKING_AI" | "CANCELLED" | "COMPLETED" | "EXECUTING_QUERY" | "FAILED" | "FETCHING_METADATA" | "FILTERING_CONTEXT" | "PENDING_WAREHOUSE" | "QUERY_RESULT_EXPIRED" | "SUBMITTED">;
|
|
436
|
+
}, z.core.$strip>;
|
|
437
|
+
export type AskGenieDoneEvent = z.infer<typeof AskGenieDoneEventSchema>;
|
|
438
|
+
/**
|
|
439
|
+
* Mastra-only error event: terminal Genie agent / transport
|
|
440
|
+
* error. Genie's own `FAILED` / `CANCELLED` come through the
|
|
441
|
+
* wire's `result` event - this variant is for failures the wire
|
|
442
|
+
* can't represent (network, Genie agent crash, planner error,
|
|
443
|
+
* etc.) plus a UI-friendly mirror of `result` when the status is
|
|
444
|
+
* non-`COMPLETED`.
|
|
445
|
+
*/
|
|
446
|
+
export declare const MastraGenieErrorEventSchema: z.ZodObject<{
|
|
447
|
+
type: z.ZodLiteral<"error">;
|
|
448
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
449
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
450
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
451
|
+
error: z.ZodString;
|
|
452
|
+
}, z.core.$strip>;
|
|
453
|
+
export type MastraGenieErrorEvent = z.infer<typeof MastraGenieErrorEventSchema>;
|
|
454
|
+
/**
|
|
455
|
+
* Mastra-only lifecycle event: the inner Genie agent's
|
|
456
|
+
* structured-output coercion has landed. Fires once per Genie
|
|
457
|
+
* tool invocation, AFTER `agent.generate(...)` completes (i.e.
|
|
458
|
+
* the inner loop + Mastra's structuring pass have both
|
|
459
|
+
* finished) and BEFORE the wrapper hydrates each `data` item
|
|
460
|
+
* with a chart. Signals to the host UI that the agent has
|
|
461
|
+
* stopped reasoning and is moving into chart generation.
|
|
462
|
+
*
|
|
463
|
+
* The structuring pass itself is opaque (it runs inside
|
|
464
|
+
* Mastra's `agent.generate(...)` together with the tool loop)
|
|
465
|
+
* so this is the earliest hook we can offer; we can't fire a
|
|
466
|
+
* "summary started" event the way we fire `started`.
|
|
467
|
+
*/
|
|
468
|
+
export declare const SummaryEventSchema: z.ZodObject<{
|
|
469
|
+
type: z.ZodLiteral<"summary">;
|
|
470
|
+
spaceId: z.ZodString;
|
|
471
|
+
items: z.ZodNumber;
|
|
472
|
+
textItems: z.ZodNumber;
|
|
473
|
+
dataItems: z.ZodNumber;
|
|
474
|
+
}, z.core.$strip>;
|
|
475
|
+
export type SummaryEvent = z.infer<typeof SummaryEventSchema>;
|
|
476
|
+
/**
|
|
477
|
+
* Mastra-only event union. Each variant uses the same flat
|
|
478
|
+
* `{type, ...fields}` shape as {@link GenieChatEvent} so
|
|
479
|
+
* subscribers union both with a single `switch (event.type)`.
|
|
480
|
+
*/
|
|
481
|
+
export declare const GenieAgentEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
482
|
+
type: z.ZodLiteral<"started">;
|
|
483
|
+
spaceId: z.ZodString;
|
|
484
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
485
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
486
|
+
content: z.ZodString;
|
|
487
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
488
|
+
type: z.ZodLiteral<"ask_genie_done">;
|
|
489
|
+
spaceId: z.ZodString;
|
|
490
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
491
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
492
|
+
answer: z.ZodOptional<z.ZodString>;
|
|
493
|
+
statementIds: z.ZodArray<z.ZodString>;
|
|
494
|
+
status: z.ZodCustom<"ASKING_AI" | "CANCELLED" | "COMPLETED" | "EXECUTING_QUERY" | "FAILED" | "FETCHING_METADATA" | "FILTERING_CONTEXT" | "PENDING_WAREHOUSE" | "QUERY_RESULT_EXPIRED" | "SUBMITTED", "ASKING_AI" | "CANCELLED" | "COMPLETED" | "EXECUTING_QUERY" | "FAILED" | "FETCHING_METADATA" | "FILTERING_CONTEXT" | "PENDING_WAREHOUSE" | "QUERY_RESULT_EXPIRED" | "SUBMITTED">;
|
|
495
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
496
|
+
type: z.ZodLiteral<"error">;
|
|
497
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
498
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
499
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
500
|
+
error: z.ZodString;
|
|
501
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
502
|
+
type: z.ZodLiteral<"summary">;
|
|
503
|
+
spaceId: z.ZodString;
|
|
504
|
+
items: z.ZodNumber;
|
|
505
|
+
textItems: z.ZodNumber;
|
|
506
|
+
dataItems: z.ZodNumber;
|
|
507
|
+
}, z.core.$strip>], "type">;
|
|
508
|
+
export type GenieAgentEvent = z.infer<typeof GenieAgentEventSchema>;
|
|
509
|
+
/**
|
|
510
|
+
* The unified writer-event vocabulary subscribers see on
|
|
511
|
+
* `ctx.writer`: the wire-derived {@link GenieChatEvent} union
|
|
512
|
+
* **plus** Mastra-only events from {@link GenieAgentEvent}. Each
|
|
513
|
+
* variant is a flat `{type, ...fields}` object; consumers narrow
|
|
514
|
+
* on `type` and read fields inline - there is no payload wrapper
|
|
515
|
+
* and no writer-boundary translator.
|
|
516
|
+
*
|
|
517
|
+
* Composed via `z.union` (not `z.discriminatedUnion`) because
|
|
518
|
+
* both halves are themselves discriminated unions on the same
|
|
519
|
+
* `type` key.
|
|
520
|
+
*/
|
|
521
|
+
export declare const GenieWriterEventSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
522
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
523
|
+
space_id: z.ZodString;
|
|
524
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
525
|
+
type: z.ZodLiteral<"question">;
|
|
526
|
+
content: z.ZodString;
|
|
527
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
528
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
529
|
+
space_id: z.ZodString;
|
|
530
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
531
|
+
type: z.ZodLiteral<"message">;
|
|
532
|
+
message: z.ZodObject<{
|
|
533
|
+
content: z.ZodString;
|
|
534
|
+
conversation_id: z.ZodString;
|
|
535
|
+
created_timestamp: z.ZodOptional<z.ZodNumber>;
|
|
536
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
537
|
+
error: z.ZodOptional<z.ZodString>;
|
|
538
|
+
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION">, z.ZodLiteral<"CHAT_COMPLETION_CLIENT_EXCEPTION">, z.ZodLiteral<"CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION">, z.ZodLiteral<"CHAT_COMPLETION_NETWORK_EXCEPTION">, z.ZodLiteral<"CONTENT_FILTER_EXCEPTION">, z.ZodLiteral<"CONTEXT_EXCEEDED_EXCEPTION">, z.ZodLiteral<"COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION">, z.ZodLiteral<"COULD_NOT_GET_UC_SCHEMA_EXCEPTION">, z.ZodLiteral<"DEPLOYMENT_NOT_FOUND_EXCEPTION">, z.ZodLiteral<"DESCRIBE_QUERY_INVALID_SQL_ERROR">, z.ZodLiteral<"DESCRIBE_QUERY_TIMEOUT">, z.ZodLiteral<"DESCRIBE_QUERY_UNEXPECTED_FAILURE">, z.ZodLiteral<"EXCEEDED_MAX_TOKEN_LENGTH_EXCEPTION">, z.ZodLiteral<"FUNCTIONS_NOT_AVAILABLE_EXCEPTION">, z.ZodLiteral<"FUNCTION_ARGUMENTS_INVALID_EXCEPTION">, z.ZodLiteral<"FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION">, z.ZodLiteral<"FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION">, z.ZodLiteral<"FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION">, z.ZodLiteral<"GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION">, z.ZodLiteral<"GENERIC_CHAT_COMPLETION_EXCEPTION">, z.ZodLiteral<"GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION">, z.ZodLiteral<"GENERIC_SQL_EXEC_API_CALL_EXCEPTION">, z.ZodLiteral<"ILLEGAL_PARAMETER_DEFINITION_EXCEPTION">, z.ZodLiteral<"INTERNAL_CATALOG_ASSET_CREATION_FAILED_EXCEPTION">, z.ZodLiteral<"INTERNAL_CATALOG_ASSET_CREATION_ONGOING_EXCEPTION">, z.ZodLiteral<"INTERNAL_CATALOG_ASSET_CREATION_UNSUPPORTED_EXCEPTION">, z.ZodLiteral<"INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION">, z.ZodLiteral<"INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION">, z.ZodLiteral<"INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION">, z.ZodLiteral<"INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION">, z.ZodLiteral<"INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION">, z.ZodLiteral<"INVALID_CHAT_COMPLETION_JSON_EXCEPTION">, z.ZodLiteral<"INVALID_COMPLETION_REQUEST_EXCEPTION">, z.ZodLiteral<"INVALID_FUNCTION_CALL_EXCEPTION">, z.ZodLiteral<"INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION">, z.ZodLiteral<"INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION">, z.ZodLiteral<"INVALID_SQL_UNKNOWN_TABLE_EXCEPTION">, z.ZodLiteral<"INVALID_TABLE_IDENTIFIER_EXCEPTION">, z.ZodLiteral<"LOCAL_CONTEXT_EXCEEDED_EXCEPTION">, z.ZodLiteral<"MESSAGE_ATTACHMENT_TOO_LONG_ERROR">, z.ZodLiteral<"MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION">, z.ZodLiteral<"MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION">, z.ZodLiteral<"MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION">, z.ZodLiteral<"MISSING_SQL_QUERY_EXCEPTION">, z.ZodLiteral<"NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE">, z.ZodLiteral<"NO_QUERY_TO_VISUALIZE_EXCEPTION">, z.ZodLiteral<"NO_TABLES_TO_QUERY_EXCEPTION">, z.ZodLiteral<"RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION">, z.ZodLiteral<"RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION">, z.ZodLiteral<"REPLY_PROCESS_TIMEOUT_EXCEPTION">, z.ZodLiteral<"RETRYABLE_PROCESSING_EXCEPTION">, z.ZodLiteral<"SQL_EXECUTION_EXCEPTION">, z.ZodLiteral<"STOP_PROCESS_DUE_TO_AUTO_REGENERATE">, z.ZodLiteral<"TABLES_MISSING_EXCEPTION">, z.ZodLiteral<"TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION">, z.ZodLiteral<"TOO_MANY_TABLES_EXCEPTION">, z.ZodLiteral<"UNEXPECTED_REPLY_PROCESS_EXCEPTION">, z.ZodLiteral<"UNKNOWN_AI_MODEL">, z.ZodLiteral<"UNSUPPORTED_CONVERSATION_TYPE_EXCEPTION">, z.ZodLiteral<"WAREHOUSE_ACCESS_MISSING_EXCEPTION">, z.ZodLiteral<"WAREHOUSE_NOT_FOUND_EXCEPTION">]>>;
|
|
539
|
+
}, z.core.$strip>>;
|
|
540
|
+
feedback: z.ZodOptional<z.ZodObject<{
|
|
541
|
+
rating: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"NEGATIVE">, z.ZodLiteral<"NONE">, z.ZodLiteral<"POSITIVE">]>>;
|
|
542
|
+
}, z.core.$strip>>;
|
|
543
|
+
id: z.ZodString;
|
|
544
|
+
last_updated_timestamp: z.ZodOptional<z.ZodNumber>;
|
|
545
|
+
message_id: z.ZodString;
|
|
546
|
+
query_result: z.ZodOptional<z.ZodObject<{
|
|
547
|
+
is_truncated: z.ZodOptional<z.ZodBoolean>;
|
|
548
|
+
row_count: z.ZodOptional<z.ZodNumber>;
|
|
549
|
+
statement_id: z.ZodOptional<z.ZodString>;
|
|
550
|
+
statement_id_signature: z.ZodOptional<z.ZodString>;
|
|
551
|
+
}, z.core.$strip>>;
|
|
552
|
+
space_id: z.ZodString;
|
|
553
|
+
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ASKING_AI">, z.ZodLiteral<"CANCELLED">, z.ZodLiteral<"COMPLETED">, z.ZodLiteral<"EXECUTING_QUERY">, z.ZodLiteral<"FAILED">, z.ZodLiteral<"FETCHING_METADATA">, z.ZodLiteral<"FILTERING_CONTEXT">, z.ZodLiteral<"PENDING_WAREHOUSE">, z.ZodLiteral<"QUERY_RESULT_EXPIRED">, z.ZodLiteral<"SUBMITTED">]>>;
|
|
554
|
+
user_id: z.ZodOptional<z.ZodNumber>;
|
|
555
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
556
|
+
attachment_id: z.ZodOptional<z.ZodString>;
|
|
557
|
+
suggested_questions: z.ZodOptional<z.ZodObject<{
|
|
558
|
+
questions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
559
|
+
}, z.core.$strip>>;
|
|
560
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
561
|
+
content: z.ZodOptional<z.ZodString>;
|
|
562
|
+
id: z.ZodOptional<z.ZodString>;
|
|
563
|
+
purpose: z.ZodOptional<z.ZodLiteral<"FOLLOW_UP_QUESTION">>;
|
|
564
|
+
}, z.core.$strip>>;
|
|
565
|
+
query: z.ZodOptional<z.ZodObject<{
|
|
566
|
+
description: z.ZodOptional<z.ZodString>;
|
|
567
|
+
id: z.ZodOptional<z.ZodString>;
|
|
568
|
+
last_updated_timestamp: z.ZodOptional<z.ZodNumber>;
|
|
569
|
+
parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
570
|
+
keyword: z.ZodOptional<z.ZodString>;
|
|
571
|
+
sql_type: z.ZodOptional<z.ZodString>;
|
|
572
|
+
value: z.ZodOptional<z.ZodString>;
|
|
573
|
+
}, z.core.$strip>>>;
|
|
574
|
+
query: z.ZodOptional<z.ZodString>;
|
|
575
|
+
query_result_metadata: z.ZodOptional<z.ZodObject<{
|
|
576
|
+
is_truncated: z.ZodOptional<z.ZodBoolean>;
|
|
577
|
+
row_count: z.ZodOptional<z.ZodNumber>;
|
|
578
|
+
}, z.core.$strip>>;
|
|
579
|
+
statement_id: z.ZodOptional<z.ZodString>;
|
|
580
|
+
title: z.ZodOptional<z.ZodString>;
|
|
581
|
+
thoughts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
582
|
+
thought_type: z.ZodCustom<genieModel.GenieThoughtType, genieModel.GenieThoughtType>;
|
|
583
|
+
content: z.ZodString;
|
|
584
|
+
}, z.core.$strip>>>;
|
|
585
|
+
}, z.core.$strip>>;
|
|
586
|
+
attachment_type: z.ZodOptional<z.ZodCustom<genieModel.AttachmentType, genieModel.AttachmentType>>;
|
|
587
|
+
}, z.core.$strip>>>;
|
|
588
|
+
auto_regenerate_count: z.ZodOptional<z.ZodNumber>;
|
|
589
|
+
}, z.core.$strip>;
|
|
590
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
591
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
592
|
+
space_id: z.ZodString;
|
|
593
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
594
|
+
type: z.ZodLiteral<"status">;
|
|
595
|
+
status: z.ZodUnion<readonly [z.ZodLiteral<"ASKING_AI">, z.ZodLiteral<"CANCELLED">, z.ZodLiteral<"COMPLETED">, z.ZodLiteral<"EXECUTING_QUERY">, z.ZodLiteral<"FAILED">, z.ZodLiteral<"FETCHING_METADATA">, z.ZodLiteral<"FILTERING_CONTEXT">, z.ZodLiteral<"PENDING_WAREHOUSE">, z.ZodLiteral<"QUERY_RESULT_EXPIRED">, z.ZodLiteral<"SUBMITTED">]>;
|
|
596
|
+
previous_status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ASKING_AI">, z.ZodLiteral<"CANCELLED">, z.ZodLiteral<"COMPLETED">, z.ZodLiteral<"EXECUTING_QUERY">, z.ZodLiteral<"FAILED">, z.ZodLiteral<"FETCHING_METADATA">, z.ZodLiteral<"FILTERING_CONTEXT">, z.ZodLiteral<"PENDING_WAREHOUSE">, z.ZodLiteral<"QUERY_RESULT_EXPIRED">, z.ZodLiteral<"SUBMITTED">]>>;
|
|
597
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
598
|
+
space_id: z.ZodString;
|
|
599
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
600
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
601
|
+
attachment_id: z.ZodOptional<z.ZodString>;
|
|
602
|
+
type: z.ZodLiteral<"attachment">;
|
|
603
|
+
index: z.ZodNumber;
|
|
604
|
+
attachment_type: z.ZodCustom<genieModel.AttachmentType, genieModel.AttachmentType>;
|
|
605
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
606
|
+
space_id: z.ZodString;
|
|
607
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
608
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
609
|
+
attachment_id: z.ZodOptional<z.ZodString>;
|
|
610
|
+
type: z.ZodLiteral<"thinking">;
|
|
611
|
+
text: z.ZodString;
|
|
612
|
+
thought_type: z.ZodCustom<genieModel.GenieThoughtType, genieModel.GenieThoughtType>;
|
|
613
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
614
|
+
space_id: z.ZodString;
|
|
615
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
616
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
617
|
+
attachment_id: z.ZodOptional<z.ZodString>;
|
|
618
|
+
type: z.ZodLiteral<"text">;
|
|
619
|
+
text: z.ZodString;
|
|
620
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
621
|
+
space_id: z.ZodString;
|
|
622
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
623
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
624
|
+
attachment_id: z.ZodOptional<z.ZodString>;
|
|
625
|
+
type: z.ZodLiteral<"query">;
|
|
626
|
+
sql: z.ZodString;
|
|
627
|
+
title: z.ZodOptional<z.ZodString>;
|
|
628
|
+
description: z.ZodOptional<z.ZodString>;
|
|
629
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
630
|
+
space_id: z.ZodString;
|
|
631
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
632
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
633
|
+
attachment_id: z.ZodOptional<z.ZodString>;
|
|
634
|
+
type: z.ZodLiteral<"statement">;
|
|
635
|
+
statement_id: z.ZodString;
|
|
636
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
637
|
+
space_id: z.ZodString;
|
|
638
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
639
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
640
|
+
attachment_id: z.ZodOptional<z.ZodString>;
|
|
641
|
+
type: z.ZodLiteral<"rows">;
|
|
642
|
+
row_count: z.ZodNumber;
|
|
643
|
+
previous_row_count: z.ZodOptional<z.ZodNumber>;
|
|
644
|
+
statement_id: z.ZodOptional<z.ZodString>;
|
|
645
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
646
|
+
space_id: z.ZodString;
|
|
647
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
648
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
649
|
+
attachment_id: z.ZodOptional<z.ZodString>;
|
|
650
|
+
type: z.ZodLiteral<"suggested_questions">;
|
|
651
|
+
questions: z.ZodArray<z.ZodString>;
|
|
652
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
653
|
+
conversation_id: z.ZodOptional<z.ZodString>;
|
|
654
|
+
space_id: z.ZodString;
|
|
655
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
656
|
+
type: z.ZodLiteral<"result">;
|
|
657
|
+
status: z.ZodEnum<{
|
|
658
|
+
CANCELLED: "CANCELLED";
|
|
659
|
+
COMPLETED: "COMPLETED";
|
|
660
|
+
FAILED: "FAILED";
|
|
661
|
+
}>;
|
|
662
|
+
message: z.ZodObject<{
|
|
663
|
+
content: z.ZodString;
|
|
664
|
+
conversation_id: z.ZodString;
|
|
665
|
+
created_timestamp: z.ZodOptional<z.ZodNumber>;
|
|
666
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
667
|
+
error: z.ZodOptional<z.ZodString>;
|
|
668
|
+
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION">, z.ZodLiteral<"CHAT_COMPLETION_CLIENT_EXCEPTION">, z.ZodLiteral<"CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION">, z.ZodLiteral<"CHAT_COMPLETION_NETWORK_EXCEPTION">, z.ZodLiteral<"CONTENT_FILTER_EXCEPTION">, z.ZodLiteral<"CONTEXT_EXCEEDED_EXCEPTION">, z.ZodLiteral<"COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION">, z.ZodLiteral<"COULD_NOT_GET_UC_SCHEMA_EXCEPTION">, z.ZodLiteral<"DEPLOYMENT_NOT_FOUND_EXCEPTION">, z.ZodLiteral<"DESCRIBE_QUERY_INVALID_SQL_ERROR">, z.ZodLiteral<"DESCRIBE_QUERY_TIMEOUT">, z.ZodLiteral<"DESCRIBE_QUERY_UNEXPECTED_FAILURE">, z.ZodLiteral<"EXCEEDED_MAX_TOKEN_LENGTH_EXCEPTION">, z.ZodLiteral<"FUNCTIONS_NOT_AVAILABLE_EXCEPTION">, z.ZodLiteral<"FUNCTION_ARGUMENTS_INVALID_EXCEPTION">, z.ZodLiteral<"FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION">, z.ZodLiteral<"FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION">, z.ZodLiteral<"FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION">, z.ZodLiteral<"GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION">, z.ZodLiteral<"GENERIC_CHAT_COMPLETION_EXCEPTION">, z.ZodLiteral<"GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION">, z.ZodLiteral<"GENERIC_SQL_EXEC_API_CALL_EXCEPTION">, z.ZodLiteral<"ILLEGAL_PARAMETER_DEFINITION_EXCEPTION">, z.ZodLiteral<"INTERNAL_CATALOG_ASSET_CREATION_FAILED_EXCEPTION">, z.ZodLiteral<"INTERNAL_CATALOG_ASSET_CREATION_ONGOING_EXCEPTION">, z.ZodLiteral<"INTERNAL_CATALOG_ASSET_CREATION_UNSUPPORTED_EXCEPTION">, z.ZodLiteral<"INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION">, z.ZodLiteral<"INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION">, z.ZodLiteral<"INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION">, z.ZodLiteral<"INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION">, z.ZodLiteral<"INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION">, z.ZodLiteral<"INVALID_CHAT_COMPLETION_JSON_EXCEPTION">, z.ZodLiteral<"INVALID_COMPLETION_REQUEST_EXCEPTION">, z.ZodLiteral<"INVALID_FUNCTION_CALL_EXCEPTION">, z.ZodLiteral<"INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION">, z.ZodLiteral<"INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION">, z.ZodLiteral<"INVALID_SQL_UNKNOWN_TABLE_EXCEPTION">, z.ZodLiteral<"INVALID_TABLE_IDENTIFIER_EXCEPTION">, z.ZodLiteral<"LOCAL_CONTEXT_EXCEEDED_EXCEPTION">, z.ZodLiteral<"MESSAGE_ATTACHMENT_TOO_LONG_ERROR">, z.ZodLiteral<"MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION">, z.ZodLiteral<"MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION">, z.ZodLiteral<"MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION">, z.ZodLiteral<"MISSING_SQL_QUERY_EXCEPTION">, z.ZodLiteral<"NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE">, z.ZodLiteral<"NO_QUERY_TO_VISUALIZE_EXCEPTION">, z.ZodLiteral<"NO_TABLES_TO_QUERY_EXCEPTION">, z.ZodLiteral<"RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION">, z.ZodLiteral<"RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION">, z.ZodLiteral<"REPLY_PROCESS_TIMEOUT_EXCEPTION">, z.ZodLiteral<"RETRYABLE_PROCESSING_EXCEPTION">, z.ZodLiteral<"SQL_EXECUTION_EXCEPTION">, z.ZodLiteral<"STOP_PROCESS_DUE_TO_AUTO_REGENERATE">, z.ZodLiteral<"TABLES_MISSING_EXCEPTION">, z.ZodLiteral<"TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION">, z.ZodLiteral<"TOO_MANY_TABLES_EXCEPTION">, z.ZodLiteral<"UNEXPECTED_REPLY_PROCESS_EXCEPTION">, z.ZodLiteral<"UNKNOWN_AI_MODEL">, z.ZodLiteral<"UNSUPPORTED_CONVERSATION_TYPE_EXCEPTION">, z.ZodLiteral<"WAREHOUSE_ACCESS_MISSING_EXCEPTION">, z.ZodLiteral<"WAREHOUSE_NOT_FOUND_EXCEPTION">]>>;
|
|
669
|
+
}, z.core.$strip>>;
|
|
670
|
+
feedback: z.ZodOptional<z.ZodObject<{
|
|
671
|
+
rating: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"NEGATIVE">, z.ZodLiteral<"NONE">, z.ZodLiteral<"POSITIVE">]>>;
|
|
672
|
+
}, z.core.$strip>>;
|
|
673
|
+
id: z.ZodString;
|
|
674
|
+
last_updated_timestamp: z.ZodOptional<z.ZodNumber>;
|
|
675
|
+
message_id: z.ZodString;
|
|
676
|
+
query_result: z.ZodOptional<z.ZodObject<{
|
|
677
|
+
is_truncated: z.ZodOptional<z.ZodBoolean>;
|
|
678
|
+
row_count: z.ZodOptional<z.ZodNumber>;
|
|
679
|
+
statement_id: z.ZodOptional<z.ZodString>;
|
|
680
|
+
statement_id_signature: z.ZodOptional<z.ZodString>;
|
|
681
|
+
}, z.core.$strip>>;
|
|
682
|
+
space_id: z.ZodString;
|
|
683
|
+
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ASKING_AI">, z.ZodLiteral<"CANCELLED">, z.ZodLiteral<"COMPLETED">, z.ZodLiteral<"EXECUTING_QUERY">, z.ZodLiteral<"FAILED">, z.ZodLiteral<"FETCHING_METADATA">, z.ZodLiteral<"FILTERING_CONTEXT">, z.ZodLiteral<"PENDING_WAREHOUSE">, z.ZodLiteral<"QUERY_RESULT_EXPIRED">, z.ZodLiteral<"SUBMITTED">]>>;
|
|
684
|
+
user_id: z.ZodOptional<z.ZodNumber>;
|
|
685
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
686
|
+
attachment_id: z.ZodOptional<z.ZodString>;
|
|
687
|
+
suggested_questions: z.ZodOptional<z.ZodObject<{
|
|
688
|
+
questions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
689
|
+
}, z.core.$strip>>;
|
|
690
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
691
|
+
content: z.ZodOptional<z.ZodString>;
|
|
692
|
+
id: z.ZodOptional<z.ZodString>;
|
|
693
|
+
purpose: z.ZodOptional<z.ZodLiteral<"FOLLOW_UP_QUESTION">>;
|
|
694
|
+
}, z.core.$strip>>;
|
|
695
|
+
query: z.ZodOptional<z.ZodObject<{
|
|
696
|
+
description: z.ZodOptional<z.ZodString>;
|
|
697
|
+
id: z.ZodOptional<z.ZodString>;
|
|
698
|
+
last_updated_timestamp: z.ZodOptional<z.ZodNumber>;
|
|
699
|
+
parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
700
|
+
keyword: z.ZodOptional<z.ZodString>;
|
|
701
|
+
sql_type: z.ZodOptional<z.ZodString>;
|
|
702
|
+
value: z.ZodOptional<z.ZodString>;
|
|
703
|
+
}, z.core.$strip>>>;
|
|
704
|
+
query: z.ZodOptional<z.ZodString>;
|
|
705
|
+
query_result_metadata: z.ZodOptional<z.ZodObject<{
|
|
706
|
+
is_truncated: z.ZodOptional<z.ZodBoolean>;
|
|
707
|
+
row_count: z.ZodOptional<z.ZodNumber>;
|
|
708
|
+
}, z.core.$strip>>;
|
|
709
|
+
statement_id: z.ZodOptional<z.ZodString>;
|
|
710
|
+
title: z.ZodOptional<z.ZodString>;
|
|
711
|
+
thoughts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
712
|
+
thought_type: z.ZodCustom<genieModel.GenieThoughtType, genieModel.GenieThoughtType>;
|
|
713
|
+
content: z.ZodString;
|
|
714
|
+
}, z.core.$strip>>>;
|
|
715
|
+
}, z.core.$strip>>;
|
|
716
|
+
attachment_type: z.ZodOptional<z.ZodCustom<genieModel.AttachmentType, genieModel.AttachmentType>>;
|
|
717
|
+
}, z.core.$strip>>>;
|
|
718
|
+
auto_regenerate_count: z.ZodOptional<z.ZodNumber>;
|
|
719
|
+
}, z.core.$strip>;
|
|
720
|
+
}, z.core.$strip>], "type">, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
721
|
+
type: z.ZodLiteral<"started">;
|
|
722
|
+
spaceId: z.ZodString;
|
|
723
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
724
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
725
|
+
content: z.ZodString;
|
|
726
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
727
|
+
type: z.ZodLiteral<"ask_genie_done">;
|
|
728
|
+
spaceId: z.ZodString;
|
|
729
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
730
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
731
|
+
answer: z.ZodOptional<z.ZodString>;
|
|
732
|
+
statementIds: z.ZodArray<z.ZodString>;
|
|
733
|
+
status: z.ZodCustom<"ASKING_AI" | "CANCELLED" | "COMPLETED" | "EXECUTING_QUERY" | "FAILED" | "FETCHING_METADATA" | "FILTERING_CONTEXT" | "PENDING_WAREHOUSE" | "QUERY_RESULT_EXPIRED" | "SUBMITTED", "ASKING_AI" | "CANCELLED" | "COMPLETED" | "EXECUTING_QUERY" | "FAILED" | "FETCHING_METADATA" | "FILTERING_CONTEXT" | "PENDING_WAREHOUSE" | "QUERY_RESULT_EXPIRED" | "SUBMITTED">;
|
|
734
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
735
|
+
type: z.ZodLiteral<"error">;
|
|
736
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
737
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
738
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
739
|
+
error: z.ZodString;
|
|
740
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
741
|
+
type: z.ZodLiteral<"summary">;
|
|
742
|
+
spaceId: z.ZodString;
|
|
743
|
+
items: z.ZodNumber;
|
|
744
|
+
textItems: z.ZodNumber;
|
|
745
|
+
dataItems: z.ZodNumber;
|
|
746
|
+
}, z.core.$strip>], "type">]>;
|
|
747
|
+
export type GenieWriterEvent = z.infer<typeof GenieWriterEventSchema>;
|
|
748
|
+
/** Discriminator type for {@link GenieWriterEvent}. */
|
|
749
|
+
export type GenieWriterEventType = GenieWriterEvent["type"];
|
|
750
|
+
/**
|
|
751
|
+
* Tabular payload embedded in every {@link GenieSummaryItem}
|
|
752
|
+
* `visualize` dataset. Always present: hydrated by the workflow's
|
|
753
|
+
* agent step before the finalize step runs, so consumers can render
|
|
754
|
+
* a table fallback regardless of chart-planner outcome.
|
|
755
|
+
*
|
|
756
|
+
* Fields:
|
|
757
|
+
* - `columns`: column names in display order.
|
|
758
|
+
* - `rows`: tabular rows keyed by column name.
|
|
759
|
+
* - `rowCount`: total row count Genie reported (may exceed
|
|
760
|
+
* `rows.length` when the statement was truncated).
|
|
761
|
+
*/
|
|
762
|
+
export declare const GenieDatasetDataSchema: z.ZodObject<{
|
|
763
|
+
columns: z.ZodArray<z.ZodString>;
|
|
764
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
765
|
+
rowCount: z.ZodNumber;
|
|
766
|
+
}, z.core.$strip>;
|
|
767
|
+
export type GenieDatasetData = z.infer<typeof GenieDatasetDataSchema>;
|
|
768
|
+
/**
|
|
769
|
+
* Slim chart reference attached to a visualize dataset. Only
|
|
770
|
+
* present when planning succeeded.
|
|
771
|
+
*
|
|
772
|
+
* `option` is intentionally NOT included. The resolved Echarts
|
|
773
|
+
* spec lives off-band in the chart cache: the host UI fetches it
|
|
774
|
+
* by `chartId` from the plugin's embed route (derived from
|
|
775
|
+
* `basePath` + {@link MASTRA_ROUTES}.embed, i.e. `/embed/chart/:id`;
|
|
776
|
+
* see {@link Chart}). Embedding the full spec inline would
|
|
777
|
+
* inflate every dataset by several KB per chart and round-trip
|
|
778
|
+
* through the LLM context for zero benefit (the model only needs
|
|
779
|
+
* the `chartId` to place a `[chart:<chartId>]` marker in its
|
|
780
|
+
* reply).
|
|
781
|
+
*/
|
|
782
|
+
export declare const GenieDatasetChartSchema: z.ZodObject<{
|
|
783
|
+
chartId: z.ZodString;
|
|
784
|
+
chartType: z.ZodUnion<readonly [z.ZodLiteral<"bar">, z.ZodLiteral<"line">, z.ZodLiteral<"area">, z.ZodLiteral<"scatter">, z.ZodLiteral<"pie">]>;
|
|
785
|
+
}, z.core.$strip>;
|
|
786
|
+
export type GenieDatasetChart = z.infer<typeof GenieDatasetChartSchema>;
|
|
787
|
+
/**
|
|
788
|
+
* Dataset bundle attached to a {@link GenieSummaryItem} `visualize`
|
|
789
|
+
* item. `data` is always populated; `chart` is best-effort and
|
|
790
|
+
* absent when the workflow's chart-planner failed (timeout,
|
|
791
|
+
* malformed plan, abort) so the host UI can still render the
|
|
792
|
+
* underlying table.
|
|
793
|
+
*/
|
|
794
|
+
export declare const GenieDatasetSchema: z.ZodObject<{
|
|
795
|
+
data: z.ZodObject<{
|
|
796
|
+
columns: z.ZodArray<z.ZodString>;
|
|
797
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
798
|
+
rowCount: z.ZodNumber;
|
|
799
|
+
}, z.core.$strip>;
|
|
800
|
+
chart: z.ZodOptional<z.ZodObject<{
|
|
801
|
+
chartId: z.ZodString;
|
|
802
|
+
chartType: z.ZodUnion<readonly [z.ZodLiteral<"bar">, z.ZodLiteral<"line">, z.ZodLiteral<"area">, z.ZodLiteral<"scatter">, z.ZodLiteral<"pie">]>;
|
|
803
|
+
}, z.core.$strip>>;
|
|
804
|
+
}, z.core.$strip>;
|
|
805
|
+
export type GenieDataset = z.infer<typeof GenieDatasetSchema>;
|
|
806
|
+
/**
|
|
807
|
+
* One item inside the Genie workflow's final summary. The
|
|
808
|
+
* workflow produces a mixed sequence of:
|
|
809
|
+
*
|
|
810
|
+
* - `string`: a markdown paragraph (interpretation, callouts,
|
|
811
|
+
* transitions between data blocks).
|
|
812
|
+
* - `visualize`: a request from the agent step to visualize a
|
|
813
|
+
* specific Genie statement at this position in the prose.
|
|
814
|
+
* The finalize step hydrates `dataset.data` (rows from the
|
|
815
|
+
* matching `statementId`) and attaches `dataset.chart` after
|
|
816
|
+
* running the chart-planner. The agent NEVER picks the chart
|
|
817
|
+
* type - it only marks where a visualization belongs.
|
|
818
|
+
*
|
|
819
|
+
* The host UI walks the array in display order to compose the
|
|
820
|
+
* final assistant message.
|
|
821
|
+
*/
|
|
822
|
+
export declare const GenieSummaryItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
823
|
+
type: z.ZodLiteral<"string">;
|
|
824
|
+
text: z.ZodString;
|
|
825
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
826
|
+
type: z.ZodLiteral<"visualize">;
|
|
827
|
+
statementId: z.ZodString;
|
|
828
|
+
title: z.ZodOptional<z.ZodString>;
|
|
829
|
+
description: z.ZodOptional<z.ZodString>;
|
|
830
|
+
dataset: z.ZodObject<{
|
|
831
|
+
data: z.ZodObject<{
|
|
832
|
+
columns: z.ZodArray<z.ZodString>;
|
|
833
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
834
|
+
rowCount: z.ZodNumber;
|
|
835
|
+
}, z.core.$strip>;
|
|
836
|
+
chart: z.ZodOptional<z.ZodObject<{
|
|
837
|
+
chartId: z.ZodString;
|
|
838
|
+
chartType: z.ZodUnion<readonly [z.ZodLiteral<"bar">, z.ZodLiteral<"line">, z.ZodLiteral<"area">, z.ZodLiteral<"scatter">, z.ZodLiteral<"pie">]>;
|
|
839
|
+
}, z.core.$strip>>;
|
|
840
|
+
}, z.core.$strip>;
|
|
841
|
+
}, z.core.$strip>], "type">;
|
|
842
|
+
export type GenieSummaryItem = z.infer<typeof GenieSummaryItemSchema>;
|
|
843
|
+
/** Discriminator type for {@link GenieSummaryItem}. */
|
|
844
|
+
export type GenieSummaryItemType = GenieSummaryItem["type"];
|
|
845
|
+
/**
|
|
846
|
+
* The Genie agent's final output shape - what the calling agent's
|
|
847
|
+
* Genie tool returns to the calling LLM. The `summary` array is
|
|
848
|
+
* the user-facing renderable; `conversationId` lets the calling
|
|
849
|
+
* agent (or the UI) follow up in the same Genie thread on the
|
|
850
|
+
* next turn.
|
|
851
|
+
*/
|
|
852
|
+
export declare const GenieAgentResultSchema: z.ZodObject<{
|
|
853
|
+
spaceId: z.ZodString;
|
|
854
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
855
|
+
summary: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
856
|
+
type: z.ZodLiteral<"string">;
|
|
857
|
+
text: z.ZodString;
|
|
858
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
859
|
+
type: z.ZodLiteral<"visualize">;
|
|
860
|
+
statementId: z.ZodString;
|
|
861
|
+
title: z.ZodOptional<z.ZodString>;
|
|
862
|
+
description: z.ZodOptional<z.ZodString>;
|
|
863
|
+
dataset: z.ZodObject<{
|
|
864
|
+
data: z.ZodObject<{
|
|
865
|
+
columns: z.ZodArray<z.ZodString>;
|
|
866
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
867
|
+
rowCount: z.ZodNumber;
|
|
868
|
+
}, z.core.$strip>;
|
|
869
|
+
chart: z.ZodOptional<z.ZodObject<{
|
|
870
|
+
chartId: z.ZodString;
|
|
871
|
+
chartType: z.ZodUnion<readonly [z.ZodLiteral<"bar">, z.ZodLiteral<"line">, z.ZodLiteral<"area">, z.ZodLiteral<"scatter">, z.ZodLiteral<"pie">]>;
|
|
872
|
+
}, z.core.$strip>>;
|
|
873
|
+
}, z.core.$strip>;
|
|
874
|
+
}, z.core.$strip>], "type">>;
|
|
875
|
+
error: z.ZodOptional<z.ZodString>;
|
|
876
|
+
}, z.core.$strip>;
|
|
877
|
+
export type GenieAgentResult = z.infer<typeof GenieAgentResultSchema>;
|