@dbx-tools/shared-mastra 0.6.210 → 0.6.212
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/LICENSE +202 -0
- package/index.ts +4 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +4 -2
- package/lib/src/feedback.d.ts +3 -0
- package/lib/src/feedback.js +1 -1
- package/lib/src/stream.d.ts +162 -0
- package/lib/src/stream.js +134 -0
- package/lib/src/wire.d.ts +27 -0
- package/lib/src/wire.js +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/feedback.ts +3 -0
- package/src/stream.ts +162 -0
- package/src/wire.ts +27 -0
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbx-tools/shared-mastra",
|
|
3
|
+
"description": "Browser-safe contracts for the AppKit Mastra plugin",
|
|
3
4
|
"repository": {
|
|
4
5
|
"type": "git",
|
|
5
6
|
"url": "git+https://github.com/reggie-db/dbx-tools.git",
|
|
@@ -23,13 +24,12 @@
|
|
|
23
24
|
"typescript": "^5.9.3"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@dbx-tools/shared-
|
|
27
|
-
"@dbx-tools/shared-
|
|
28
|
-
"@dbx-tools/shared-model": "0.6.210",
|
|
27
|
+
"@dbx-tools/shared-genie": "0.6.212",
|
|
28
|
+
"@dbx-tools/shared-model": "0.6.212",
|
|
29
29
|
"zod": "4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"main": "./lib/index.js",
|
|
32
|
-
"license": "
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public",
|
|
35
35
|
"main": "./lib/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"./package.json": "./package.json"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
"version": "0.6.
|
|
45
|
+
"version": "0.6.212",
|
|
46
46
|
"types": "./lib/index.d.ts",
|
|
47
47
|
"type": "module",
|
|
48
48
|
"exports": {
|
package/src/feedback.ts
CHANGED
|
@@ -40,6 +40,7 @@ export const DEFAULT_COMMENT_NAME = "user_comment";
|
|
|
40
40
|
* when no thumbs value is present).
|
|
41
41
|
*/
|
|
42
42
|
export const MastraFeedbackValueSchema = z.union([z.boolean(), z.number(), z.string()]);
|
|
43
|
+
/** Value recorded on the MLflow assessment for a Mastra turn. */
|
|
43
44
|
export type MastraFeedbackValue = z.infer<typeof MastraFeedbackValueSchema>;
|
|
44
45
|
|
|
45
46
|
/**
|
|
@@ -67,6 +68,7 @@ export const MastraFeedbackRequestSchema = z
|
|
|
67
68
|
.refine((v) => v.value !== undefined || (v.comment?.trim().length ?? 0) > 0, {
|
|
68
69
|
message: "feedback requires a value or a non-empty comment",
|
|
69
70
|
});
|
|
71
|
+
/** Validated request body accepted by the Mastra feedback route. */
|
|
70
72
|
export type MastraFeedbackRequest = z.infer<typeof MastraFeedbackRequestSchema>;
|
|
71
73
|
|
|
72
74
|
/**
|
|
@@ -83,4 +85,5 @@ export const MastraFeedbackResponseSchema = z.object({
|
|
|
83
85
|
ok: z.boolean(),
|
|
84
86
|
assessmentId: z.string().optional(),
|
|
85
87
|
});
|
|
88
|
+
/** Feedback-route result, including the assessment id when MLflow accepted it. */
|
|
86
89
|
export type MastraFeedbackResponse = z.infer<typeof MastraFeedbackResponseSchema>;
|
package/src/stream.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-validated Mastra agent stream chunks shared by browser clients.
|
|
3
|
+
*
|
|
4
|
+
* Known event names are strict about the payload fields the UI consumes, so a
|
|
5
|
+
* malformed upstream chunk fails before it reaches a state reducer. Unknown
|
|
6
|
+
* event names remain forward-compatible through an explicit `unknown` variant
|
|
7
|
+
* that preserves the original event name and payload.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
|
|
14
|
+
const runFields = {
|
|
15
|
+
runId: z.string().min(1).optional(),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const EmptyStreamChunkSchema = <Type extends string>(type: Type) =>
|
|
19
|
+
z
|
|
20
|
+
.object({
|
|
21
|
+
type: z.literal(type),
|
|
22
|
+
payload: z.unknown().optional(),
|
|
23
|
+
...runFields,
|
|
24
|
+
})
|
|
25
|
+
.passthrough();
|
|
26
|
+
|
|
27
|
+
const TextDeltaStreamChunkSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
type: z.literal("text-delta"),
|
|
30
|
+
payload: z.object({ text: z.string() }).passthrough(),
|
|
31
|
+
...runFields,
|
|
32
|
+
})
|
|
33
|
+
.passthrough();
|
|
34
|
+
|
|
35
|
+
const ReasoningDeltaStreamChunkSchema = z
|
|
36
|
+
.object({
|
|
37
|
+
type: z.literal("reasoning-delta"),
|
|
38
|
+
payload: z.object({ text: z.string() }).passthrough(),
|
|
39
|
+
...runFields,
|
|
40
|
+
})
|
|
41
|
+
.passthrough();
|
|
42
|
+
|
|
43
|
+
const ToolCallStreamChunkSchema = z
|
|
44
|
+
.object({
|
|
45
|
+
type: z.literal("tool-call"),
|
|
46
|
+
payload: z
|
|
47
|
+
.object({
|
|
48
|
+
toolCallId: z.string().min(1),
|
|
49
|
+
toolName: z.string().min(1),
|
|
50
|
+
args: z.unknown().optional(),
|
|
51
|
+
})
|
|
52
|
+
.passthrough(),
|
|
53
|
+
...runFields,
|
|
54
|
+
})
|
|
55
|
+
.passthrough();
|
|
56
|
+
|
|
57
|
+
const ToolCallApprovalStreamChunkSchema = z
|
|
58
|
+
.object({
|
|
59
|
+
type: z.literal("tool-call-approval"),
|
|
60
|
+
payload: z
|
|
61
|
+
.object({
|
|
62
|
+
toolCallId: z.string().min(1),
|
|
63
|
+
toolName: z.string().min(1),
|
|
64
|
+
args: z.unknown().optional(),
|
|
65
|
+
runId: z.string().min(1).optional(),
|
|
66
|
+
})
|
|
67
|
+
.passthrough(),
|
|
68
|
+
...runFields,
|
|
69
|
+
})
|
|
70
|
+
.passthrough();
|
|
71
|
+
|
|
72
|
+
const ToolTerminalStreamChunkSchema = <Type extends "tool-result" | "tool-error">(type: Type) =>
|
|
73
|
+
z
|
|
74
|
+
.object({
|
|
75
|
+
type: z.literal(type),
|
|
76
|
+
payload: z.object({ toolCallId: z.string().min(1) }).passthrough(),
|
|
77
|
+
...runFields,
|
|
78
|
+
})
|
|
79
|
+
.passthrough();
|
|
80
|
+
|
|
81
|
+
const ToolOutputStreamChunkSchema = z
|
|
82
|
+
.object({
|
|
83
|
+
type: z.literal("tool-output"),
|
|
84
|
+
payload: z
|
|
85
|
+
.object({
|
|
86
|
+
toolCallId: z.string().min(1),
|
|
87
|
+
output: z.unknown(),
|
|
88
|
+
})
|
|
89
|
+
.passthrough(),
|
|
90
|
+
...runFields,
|
|
91
|
+
})
|
|
92
|
+
.passthrough();
|
|
93
|
+
|
|
94
|
+
const ErrorStreamChunkSchema = z
|
|
95
|
+
.object({
|
|
96
|
+
type: z.literal("error"),
|
|
97
|
+
payload: z
|
|
98
|
+
.object({
|
|
99
|
+
error: z.string().optional(),
|
|
100
|
+
message: z.string().optional(),
|
|
101
|
+
})
|
|
102
|
+
.passthrough()
|
|
103
|
+
.optional(),
|
|
104
|
+
...runFields,
|
|
105
|
+
})
|
|
106
|
+
.passthrough();
|
|
107
|
+
|
|
108
|
+
/** Known Mastra events consumed by the chat UI. */
|
|
109
|
+
export const KnownMastraStreamChunkSchema = z.discriminatedUnion("type", [
|
|
110
|
+
EmptyStreamChunkSchema("text-start"),
|
|
111
|
+
TextDeltaStreamChunkSchema,
|
|
112
|
+
EmptyStreamChunkSchema("text-end"),
|
|
113
|
+
ReasoningDeltaStreamChunkSchema,
|
|
114
|
+
ToolCallStreamChunkSchema,
|
|
115
|
+
ToolCallApprovalStreamChunkSchema,
|
|
116
|
+
ToolTerminalStreamChunkSchema("tool-result"),
|
|
117
|
+
ToolTerminalStreamChunkSchema("tool-error"),
|
|
118
|
+
ToolOutputStreamChunkSchema,
|
|
119
|
+
ErrorStreamChunkSchema,
|
|
120
|
+
]);
|
|
121
|
+
|
|
122
|
+
/** A validated stream event whose name this client version does not consume. */
|
|
123
|
+
export type UnknownMastraStreamChunk = {
|
|
124
|
+
type: "unknown";
|
|
125
|
+
eventType: string;
|
|
126
|
+
payload?: unknown;
|
|
127
|
+
runId?: string;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const knownEventTypes: ReadonlySet<string> = new Set(
|
|
131
|
+
KnownMastraStreamChunkSchema.options.map((option) => option.shape.type.value),
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const UnknownMastraStreamChunkSchema = z
|
|
135
|
+
.object({
|
|
136
|
+
type: z.string().min(1),
|
|
137
|
+
payload: z.unknown().optional(),
|
|
138
|
+
...runFields,
|
|
139
|
+
})
|
|
140
|
+
.passthrough()
|
|
141
|
+
.refine((chunk) => !knownEventTypes.has(chunk.type), {
|
|
142
|
+
path: ["type"],
|
|
143
|
+
message: "known stream event has an invalid payload",
|
|
144
|
+
})
|
|
145
|
+
.transform((chunk): UnknownMastraStreamChunk => ({
|
|
146
|
+
type: "unknown",
|
|
147
|
+
eventType: chunk.type,
|
|
148
|
+
...(chunk.payload !== undefined ? { payload: chunk.payload } : {}),
|
|
149
|
+
...(chunk.runId !== undefined ? { runId: chunk.runId } : {}),
|
|
150
|
+
}));
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Complete validated stream union. Known events retain their discriminant;
|
|
154
|
+
* future event names normalize to the explicit `unknown` variant.
|
|
155
|
+
*/
|
|
156
|
+
export const MastraStreamChunkSchema = z.union([
|
|
157
|
+
KnownMastraStreamChunkSchema,
|
|
158
|
+
UnknownMastraStreamChunkSchema,
|
|
159
|
+
]);
|
|
160
|
+
|
|
161
|
+
/** One runtime-validated event from a Mastra agent SSE stream. */
|
|
162
|
+
export type MastraStreamChunk = z.output<typeof MastraStreamChunkSchema>;
|
package/src/wire.ts
CHANGED
|
@@ -75,6 +75,7 @@ export const MastraClientConfigSchema = z.object({
|
|
|
75
75
|
feedbackEnabled: z.boolean().default(false),
|
|
76
76
|
chatAlwaysAvailable: z.boolean().default(false),
|
|
77
77
|
});
|
|
78
|
+
/** Browser-safe Mastra plugin descriptor used to construct route and stream clients. */
|
|
78
79
|
export type MastraClientConfig = z.infer<typeof MastraClientConfigSchema>;
|
|
79
80
|
|
|
80
81
|
/**
|
|
@@ -93,6 +94,7 @@ export const DefaultModelResponseSchema = z.object({
|
|
|
93
94
|
model: z.string().nullable(),
|
|
94
95
|
displayName: z.string().nullable(),
|
|
95
96
|
});
|
|
97
|
+
/** Response identifying the model currently selected as the plugin default. */
|
|
96
98
|
export type DefaultModelResponse = z.infer<typeof DefaultModelResponseSchema>;
|
|
97
99
|
|
|
98
100
|
/* ---------------------------- model catalogue ---------------------------- */
|
|
@@ -107,6 +109,7 @@ export type DefaultModelResponse = z.infer<typeof DefaultModelResponseSchema>;
|
|
|
107
109
|
export const ServingEndpointsResponseSchema = z.object({
|
|
108
110
|
endpoints: z.array(model.ServingEndpointSummarySchema),
|
|
109
111
|
});
|
|
112
|
+
/** Available Databricks serving endpoints returned by the Mastra model route. */
|
|
110
113
|
export type ServingEndpointsResponse = z.infer<typeof ServingEndpointsResponseSchema>;
|
|
111
114
|
|
|
112
115
|
/* ----------------------------- chat history ----------------------------- */
|
|
@@ -125,6 +128,7 @@ export const MastraHistoryUIMessageSchema = z.object({
|
|
|
125
128
|
parts: z.array(z.unknown()).readonly(),
|
|
126
129
|
metadata: z.unknown().optional(),
|
|
127
130
|
});
|
|
131
|
+
/** Persisted chat message normalized into the browser UI message contract. */
|
|
128
132
|
export type MastraHistoryUIMessage = z.infer<typeof MastraHistoryUIMessageSchema>;
|
|
129
133
|
|
|
130
134
|
/**
|
|
@@ -148,6 +152,7 @@ export const MastraHistoryResponseSchema = z.object({
|
|
|
148
152
|
total: z.number(),
|
|
149
153
|
hasMore: z.boolean(),
|
|
150
154
|
});
|
|
155
|
+
/** One cursor page of normalized messages for a Mastra thread. */
|
|
151
156
|
export type MastraHistoryResponse = z.infer<typeof MastraHistoryResponseSchema>;
|
|
152
157
|
|
|
153
158
|
/**
|
|
@@ -176,6 +181,7 @@ export const MastraClearHistoryResponseSchema = z.object({
|
|
|
176
181
|
threadId: z.string(),
|
|
177
182
|
cleared: z.number(),
|
|
178
183
|
});
|
|
184
|
+
/** Result of clearing the messages owned by one Mastra thread. */
|
|
179
185
|
export type MastraClearHistoryResponse = z.infer<typeof MastraClearHistoryResponseSchema>;
|
|
180
186
|
|
|
181
187
|
/* -------------------------------- threads -------------------------------- */
|
|
@@ -207,6 +213,7 @@ export const MastraThreadSchema = z.object({
|
|
|
207
213
|
updatedAt: z.string(),
|
|
208
214
|
metadata: z.unknown().optional(),
|
|
209
215
|
});
|
|
216
|
+
/** User-visible thread metadata, separate from the thread's message history. */
|
|
210
217
|
export type MastraThread = z.infer<typeof MastraThreadSchema>;
|
|
211
218
|
|
|
212
219
|
/**
|
|
@@ -227,6 +234,7 @@ export const MastraThreadsResponseSchema = z.object({
|
|
|
227
234
|
total: z.number(),
|
|
228
235
|
hasMore: z.boolean(),
|
|
229
236
|
});
|
|
237
|
+
/** One cursor page of Mastra threads owned by the active resource. */
|
|
230
238
|
export type MastraThreadsResponse = z.infer<typeof MastraThreadsResponseSchema>;
|
|
231
239
|
|
|
232
240
|
/**
|
|
@@ -247,6 +255,7 @@ export const MastraDeleteThreadResponseSchema = z.object({
|
|
|
247
255
|
threadId: z.string(),
|
|
248
256
|
deleted: z.boolean(),
|
|
249
257
|
});
|
|
258
|
+
/** Result of deleting one thread and its associated memory records. */
|
|
250
259
|
export type MastraDeleteThreadResponse = z.infer<typeof MastraDeleteThreadResponseSchema>;
|
|
251
260
|
|
|
252
261
|
/** Longest thread title the rename route accepts (trimmed server-side). */
|
|
@@ -265,6 +274,7 @@ export const MASTRA_THREAD_TITLE_MAX = 200;
|
|
|
265
274
|
export const MastraUpdateThreadRequestSchema = z.object({
|
|
266
275
|
title: z.string().trim().min(1).max(MASTRA_THREAD_TITLE_MAX),
|
|
267
276
|
});
|
|
277
|
+
/** Validated mutable fields accepted when renaming a Mastra thread. */
|
|
268
278
|
export type MastraUpdateThreadRequest = z.infer<typeof MastraUpdateThreadRequestSchema>;
|
|
269
279
|
|
|
270
280
|
/**
|
|
@@ -282,6 +292,7 @@ export const MastraUpdateThreadResponseSchema = z.object({
|
|
|
282
292
|
agentId: z.string(),
|
|
283
293
|
thread: MastraThreadSchema,
|
|
284
294
|
});
|
|
295
|
+
/** Updated thread returned after a successful rename. */
|
|
285
296
|
export type MastraUpdateThreadResponse = z.infer<typeof MastraUpdateThreadResponseSchema>;
|
|
286
297
|
|
|
287
298
|
/* ------------------------------ suggestions ------------------------------ */
|
|
@@ -299,6 +310,7 @@ export type MastraUpdateThreadResponse = z.infer<typeof MastraUpdateThreadRespon
|
|
|
299
310
|
export const MastraSuggestionsResponseSchema = z.object({
|
|
300
311
|
questions: z.array(z.string()),
|
|
301
312
|
});
|
|
313
|
+
/** Follow-up prompts suggested for the current agent and thread context. */
|
|
302
314
|
export type MastraSuggestionsResponse = z.infer<typeof MastraSuggestionsResponseSchema>;
|
|
303
315
|
|
|
304
316
|
/* --------------------------------- charts --------------------------------- */
|
|
@@ -373,6 +385,7 @@ export const ChartTypeSchema = z
|
|
|
373
385
|
),
|
|
374
386
|
])
|
|
375
387
|
.describe("The chart shape that best matches the data and intent.");
|
|
388
|
+
/** Supported chart family selected by the server-side chart planner. */
|
|
376
389
|
export type ChartType = z.infer<typeof ChartTypeSchema>;
|
|
377
390
|
|
|
378
391
|
/**
|
|
@@ -388,6 +401,7 @@ export const ChartResultSchema = z.object({
|
|
|
388
401
|
"Fully-resolved Echarts `EChartsOption` JSON for this chart - drop directly into an Echarts instance (or `<ReactECharts option={...} />`) without further processing. Includes title / tooltip / legend / grid / axis / series defaults already merged in.",
|
|
389
402
|
),
|
|
390
403
|
});
|
|
404
|
+
/** Render-ready chart plan stored behind a chart embed identifier. */
|
|
391
405
|
export type ChartResult = z.infer<typeof ChartResultSchema>;
|
|
392
406
|
|
|
393
407
|
/**
|
|
@@ -420,6 +434,7 @@ export const ChartSchema = z.object({
|
|
|
420
434
|
"Resolved chart plan. Absent while processing and when the run errored.",
|
|
421
435
|
),
|
|
422
436
|
});
|
|
437
|
+
/** Pollable chart-cache entry representing pending, successful, or failed planning. */
|
|
423
438
|
export type Chart = z.infer<typeof ChartSchema>;
|
|
424
439
|
|
|
425
440
|
/* ------------------------------- statements ------------------------------- */
|
|
@@ -452,6 +467,7 @@ export const StatementDataSchema = z.object({
|
|
|
452
467
|
rowCount: z.number(),
|
|
453
468
|
truncated: z.boolean(),
|
|
454
469
|
});
|
|
470
|
+
/** Tabular statement payload resolved from a `[data:<statement_id>]` embed marker. */
|
|
455
471
|
export type StatementData = z.infer<typeof StatementDataSchema>;
|
|
456
472
|
|
|
457
473
|
/* ----------------------------- writer surface ---------------------------- */
|
|
@@ -503,6 +519,7 @@ export const StartedEventSchema = z.object({
|
|
|
503
519
|
/** Question the Genie agent sent to Genie. */
|
|
504
520
|
content: z.string(),
|
|
505
521
|
});
|
|
522
|
+
/** Immediate lifecycle event emitted when an `ask_genie` invocation begins. */
|
|
506
523
|
export type StartedEvent = z.infer<typeof StartedEventSchema>;
|
|
507
524
|
|
|
508
525
|
/**
|
|
@@ -530,6 +547,7 @@ export const AskGenieDoneEventSchema = z.object({
|
|
|
530
547
|
*/
|
|
531
548
|
status: z.custom<MessageStatus>((v) => typeof v === "string"),
|
|
532
549
|
});
|
|
550
|
+
/** Completion event for one `ask_genie` invocation, including its terminal status. */
|
|
533
551
|
export type AskGenieDoneEvent = z.infer<typeof AskGenieDoneEventSchema>;
|
|
534
552
|
|
|
535
553
|
/**
|
|
@@ -547,6 +565,7 @@ export const MastraGenieErrorEventSchema = z.object({
|
|
|
547
565
|
messageId: z.string().optional(),
|
|
548
566
|
error: z.string(),
|
|
549
567
|
});
|
|
568
|
+
/** Mastra-side failure event for errors outside Genie's normal terminal result. */
|
|
550
569
|
export type MastraGenieErrorEvent = z.infer<typeof MastraGenieErrorEventSchema>;
|
|
551
570
|
|
|
552
571
|
/**
|
|
@@ -577,6 +596,7 @@ export const SummaryEventSchema = z.object({
|
|
|
577
596
|
*/
|
|
578
597
|
dataItems: z.number().int().nonnegative(),
|
|
579
598
|
});
|
|
599
|
+
/** Lifecycle event emitted before summary data items are hydrated into charts. */
|
|
580
600
|
export type SummaryEvent = z.infer<typeof SummaryEventSchema>;
|
|
581
601
|
|
|
582
602
|
/**
|
|
@@ -590,6 +610,7 @@ export const GenieAgentEventSchema = z.discriminatedUnion("type", [
|
|
|
590
610
|
MastraGenieErrorEventSchema,
|
|
591
611
|
SummaryEventSchema,
|
|
592
612
|
]);
|
|
613
|
+
/** Mastra-owned lifecycle events layered on top of Genie's wire event stream. */
|
|
593
614
|
export type GenieAgentEvent = z.infer<typeof GenieAgentEventSchema>;
|
|
594
615
|
|
|
595
616
|
/**
|
|
@@ -608,6 +629,7 @@ export const GenieWriterEventSchema = z.union([
|
|
|
608
629
|
genieModel.GenieChatEventSchema,
|
|
609
630
|
GenieAgentEventSchema,
|
|
610
631
|
]);
|
|
632
|
+
/** Complete event vocabulary written by the Mastra Genie integration. */
|
|
611
633
|
export type GenieWriterEvent = z.infer<typeof GenieWriterEventSchema>;
|
|
612
634
|
|
|
613
635
|
/** Discriminator type for {@link GenieWriterEvent}. */
|
|
@@ -632,6 +654,7 @@ export const GenieDatasetDataSchema = z.object({
|
|
|
632
654
|
rows: z.array(z.record(z.string(), z.unknown())),
|
|
633
655
|
rowCount: z.number(),
|
|
634
656
|
});
|
|
657
|
+
/** Hydrated tabular data that always backs a Genie visualization item. */
|
|
635
658
|
export type GenieDatasetData = z.infer<typeof GenieDatasetDataSchema>;
|
|
636
659
|
|
|
637
660
|
/**
|
|
@@ -652,6 +675,7 @@ export const GenieDatasetChartSchema = z.object({
|
|
|
652
675
|
chartId: z.string(),
|
|
653
676
|
chartType: ChartTypeSchema,
|
|
654
677
|
});
|
|
678
|
+
/** Lightweight reference to a chart plan stored in the Mastra chart cache. */
|
|
655
679
|
export type GenieDatasetChart = z.infer<typeof GenieDatasetChartSchema>;
|
|
656
680
|
|
|
657
681
|
/**
|
|
@@ -665,6 +689,7 @@ export const GenieDatasetSchema = z.object({
|
|
|
665
689
|
data: GenieDatasetDataSchema,
|
|
666
690
|
chart: GenieDatasetChartSchema.optional(),
|
|
667
691
|
});
|
|
692
|
+
/** Visualization dataset with required table data and an optional planned chart. */
|
|
668
693
|
export type GenieDataset = z.infer<typeof GenieDatasetSchema>;
|
|
669
694
|
|
|
670
695
|
/**
|
|
@@ -696,6 +721,7 @@ export const GenieSummaryItemSchema = z.discriminatedUnion("type", [
|
|
|
696
721
|
dataset: GenieDatasetSchema,
|
|
697
722
|
}),
|
|
698
723
|
]);
|
|
724
|
+
/** Ordered prose or visualization item in the Genie agent's final summary. */
|
|
699
725
|
export type GenieSummaryItem = z.infer<typeof GenieSummaryItemSchema>;
|
|
700
726
|
|
|
701
727
|
/** Discriminator type for {@link GenieSummaryItem}. */
|
|
@@ -714,4 +740,5 @@ export const GenieAgentResultSchema = z.object({
|
|
|
714
740
|
summary: z.array(GenieSummaryItemSchema),
|
|
715
741
|
error: z.string().optional(),
|
|
716
742
|
});
|
|
743
|
+
/** Final renderable output returned by the Genie agent tool to its caller. */
|
|
717
744
|
export type GenieAgentResult = z.infer<typeof GenieAgentResultSchema>;
|