@dbx-tools/appkit-mastra 0.1.12 → 0.1.14
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/README.md +303 -637
- package/index.ts +46 -38
- package/package.json +58 -43
- package/src/agents.ts +224 -66
- package/src/chart.ts +531 -429
- package/src/config.ts +270 -19
- package/src/filesystems.ts +1090 -0
- package/src/genie.ts +1000 -660
- package/src/history.ts +166 -79
- package/src/mcp.ts +105 -0
- package/src/memory.ts +119 -81
- package/src/mlflow.ts +149 -0
- package/src/model.ts +75 -408
- package/src/observability.ts +144 -0
- package/src/pagination.ts +34 -0
- package/src/plugin.ts +566 -59
- package/src/processors.ts +168 -0
- package/src/rest.ts +67 -0
- package/src/server.ts +232 -45
- package/src/serving-sanitize.ts +167 -0
- package/src/serving.ts +27 -243
- package/src/statement.ts +89 -0
- package/src/storage-schema.ts +41 -0
- package/src/summarize.ts +176 -0
- package/src/threads.ts +338 -0
- package/src/workspaces.ts +346 -0
- package/src/writer.ts +44 -0
- package/tsconfig.json +41 -0
- package/dist/index.d.ts +0 -20
- package/dist/index.js +0 -20
- package/dist/src/agents.d.ts +0 -306
- package/dist/src/agents.js +0 -403
- package/dist/src/chart.d.ts +0 -170
- package/dist/src/chart.js +0 -491
- package/dist/src/config.d.ts +0 -183
- package/dist/src/config.js +0 -12
- package/dist/src/genie.d.ts +0 -131
- package/dist/src/genie.js +0 -630
- package/dist/src/history.d.ts +0 -67
- package/dist/src/history.js +0 -172
- package/dist/src/memory.d.ts +0 -79
- package/dist/src/memory.js +0 -210
- package/dist/src/model.d.ts +0 -159
- package/dist/src/model.js +0 -427
- package/dist/src/plugin.d.ts +0 -130
- package/dist/src/plugin.js +0 -261
- package/dist/src/processors/strip-stale-charts.d.ts +0 -29
- package/dist/src/processors/strip-stale-charts.js +0 -96
- package/dist/src/server.d.ts +0 -46
- package/dist/src/server.js +0 -123
- package/dist/src/serving.d.ts +0 -156
- package/dist/src/serving.js +0 -231
- package/dist/src/tools/email.d.ts +0 -74
- package/dist/src/tools/email.js +0 -122
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/src/processors/strip-stale-charts.ts +0 -105
- package/src/tools/email.ts +0 -147
package/dist/src/genie.d.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mastra tool wrappers around the AppKit `genie` plugin's exports.
|
|
3
|
-
*
|
|
4
|
-
* One `sendMessage` tool is registered per configured space alias so
|
|
5
|
-
* the LLM picks the space by tool selection (the description bakes the
|
|
6
|
-
* alias in). `getConversation` is registered once, taking `alias` as a
|
|
7
|
-
* parameter.
|
|
8
|
-
*
|
|
9
|
-
* All Genie payload types are inferred from the public `genie` factory
|
|
10
|
-
* (`genie().plugin` constructor → `exports()` return type), so any
|
|
11
|
-
* upstream change in `@databricks/appkit` flows in automatically.
|
|
12
|
-
*
|
|
13
|
-
* As Genie streams its long-running events (`FETCHING_METADATA` →
|
|
14
|
-
* `ASKING_AI` → `EXECUTING_QUERY` → `COMPLETED`, plus SQL text and
|
|
15
|
-
* follow-ups in `message_result.attachments`), the tool forwards a
|
|
16
|
-
* normalised {@link GenieProgress} discriminated union out through
|
|
17
|
-
* `ctx.writer` so the client can render an incremental loading pill.
|
|
18
|
-
* Row payloads from `query_result` are intentionally discarded - the
|
|
19
|
-
* LLM never sees rows, and charts come from the separate
|
|
20
|
-
* `render_data` tool when the model decides one is useful.
|
|
21
|
-
*/
|
|
22
|
-
import { genie } from "@databricks/appkit";
|
|
23
|
-
import { createTool } from "@mastra/core/tools";
|
|
24
|
-
import type { MastraPluginConfig } from "./config.js";
|
|
25
|
-
/** Live AppKit `GeniePlugin` instance. */
|
|
26
|
-
export type GeniePluginInstance = InstanceType<ReturnType<typeof genie>["plugin"]>;
|
|
27
|
-
/** Full `exports()` shape of the AppKit `genie` plugin. */
|
|
28
|
-
export type GenieExports = ReturnType<GeniePluginInstance["exports"]>;
|
|
29
|
-
/**
|
|
30
|
-
* Stream event yielded by `genie.exports().sendMessage`. Discriminated
|
|
31
|
-
* by `type` (`"message_start" | "status" | "message_result" |
|
|
32
|
-
* "query_result" | "error" | "history_info"`).
|
|
33
|
-
*/
|
|
34
|
-
export type GenieStreamEvent = ReturnType<GenieExports["sendMessage"]> extends AsyncGenerator<infer E> ? E : never;
|
|
35
|
-
/** Conversation history returned by `genie.exports().getConversation`. */
|
|
36
|
-
export type GenieConversation = Awaited<ReturnType<GenieExports["getConversation"]>>;
|
|
37
|
-
/**
|
|
38
|
-
* Normalised progress event surfaced to the UI as a Mastra
|
|
39
|
-
* `tool-output` chunk. Loading pill events (`started`, `status`,
|
|
40
|
-
* `sql`, `suggested`, `error`) are pure UI metadata and never reach
|
|
41
|
-
* the LLM.
|
|
42
|
-
*
|
|
43
|
-
* The `chart` variant is the wire shape emitted by
|
|
44
|
-
* {@link emitChartWithPlanning} (used by both this Genie
|
|
45
|
-
* draining loop and the system-level `render_data` tool). All
|
|
46
|
-
* fields except `chartId` are optional because two events per
|
|
47
|
-
* chartId arrive on the wire: the first carries the rows
|
|
48
|
-
* (`title` + `description?` + `data`); the second, on planner
|
|
49
|
-
* success, carries just the resolved Echarts spec (`option`).
|
|
50
|
-
* The host UI's `<ChartSlot>` merges them by `chartId`.
|
|
51
|
-
*/
|
|
52
|
-
export type GenieProgress = {
|
|
53
|
-
kind: "started";
|
|
54
|
-
conversationId: string;
|
|
55
|
-
messageId: string;
|
|
56
|
-
spaceId: string;
|
|
57
|
-
} | {
|
|
58
|
-
kind: "status";
|
|
59
|
-
status: string;
|
|
60
|
-
label: string;
|
|
61
|
-
} | {
|
|
62
|
-
kind: "sql";
|
|
63
|
-
sql: string;
|
|
64
|
-
title?: string;
|
|
65
|
-
description?: string;
|
|
66
|
-
statementId?: string;
|
|
67
|
-
} | {
|
|
68
|
-
kind: "chart";
|
|
69
|
-
chartId: string;
|
|
70
|
-
title?: string;
|
|
71
|
-
description?: string;
|
|
72
|
-
data?: Array<Record<string, unknown>>;
|
|
73
|
-
option?: Record<string, unknown>;
|
|
74
|
-
} | {
|
|
75
|
-
kind: "text";
|
|
76
|
-
content: string;
|
|
77
|
-
} | {
|
|
78
|
-
kind: "suggested";
|
|
79
|
-
questions: string[];
|
|
80
|
-
} | {
|
|
81
|
-
kind: "error";
|
|
82
|
-
error: string;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Default tool name for a wired Genie alias. The well-known `default`
|
|
86
|
-
* alias collapses to `genie`; everything else gets a `genie_` prefix so
|
|
87
|
-
* multiple spaces stay disambiguated when an agent has more than one
|
|
88
|
-
* wired. Matches the `genie` / `genie_<alias>` naming used elsewhere in
|
|
89
|
-
* dbx-tools AppKit demos.
|
|
90
|
-
*/
|
|
91
|
-
export declare function defaultGenieToolName(alias: string): string;
|
|
92
|
-
/**
|
|
93
|
-
* Build one `sendMessage` tool per configured Genie alias plus a single
|
|
94
|
-
* `getConversation` tool. Returns a record keyed by tool id, ready to
|
|
95
|
-
* spread into an `Agent`'s `tools` map.
|
|
96
|
-
*
|
|
97
|
-
* `config` must be the active plugin config; Genie's
|
|
98
|
-
* `query_result` events are routed through
|
|
99
|
-
* {@link emitChartWithPlanning} which uses it to resolve the
|
|
100
|
-
* chart-planner's model.
|
|
101
|
-
*/
|
|
102
|
-
export declare function buildGenieTools(opts: {
|
|
103
|
-
aliases: string[];
|
|
104
|
-
exports: GenieExports;
|
|
105
|
-
config: MastraPluginConfig;
|
|
106
|
-
signal?: AbortSignal;
|
|
107
|
-
}): Record<string, ReturnType<typeof createTool>>;
|
|
108
|
-
/**
|
|
109
|
-
* Toolkit provider built from a live AppKit `GeniePlugin` instance.
|
|
110
|
-
* Returned by {@link buildGenieProvider} so that
|
|
111
|
-
* `plugins.genie?.toolkit()` inside an agent's `tools(plugins)` callback
|
|
112
|
-
* resolves to the streaming-aware {@link buildGenieTools} record instead
|
|
113
|
-
* of the AppKit default (which does one blocking call per tool with no
|
|
114
|
-
* mid-flight events).
|
|
115
|
-
*
|
|
116
|
-
* The returned `toolkit()` reads alias names off the plugin's
|
|
117
|
-
* `getAgentTools()` registry (each entry is `${alias}.sendMessage` or
|
|
118
|
-
* `${alias}.getConversation`), then mints one `sendMessage` tool per
|
|
119
|
-
* alias plus a shared `getConversation`. `sendMessage` / `getConversation`
|
|
120
|
-
* are bound back to the plugin instance so they keep their `this`
|
|
121
|
-
* (they are class methods, not free functions).
|
|
122
|
-
*
|
|
123
|
-
* `_opts` is accepted but unused for now - the streaming tools are an
|
|
124
|
-
* all-or-nothing bundle. Wire `only` / `except` / `prefix` / `rename`
|
|
125
|
-
* later if a caller needs them.
|
|
126
|
-
*/
|
|
127
|
-
export declare function buildGenieProvider(plugin: GeniePluginInstance, opts: {
|
|
128
|
-
config: MastraPluginConfig;
|
|
129
|
-
}): {
|
|
130
|
-
toolkit(opts?: unknown): Record<string, ReturnType<typeof createTool>>;
|
|
131
|
-
};
|