@dbx-tools/appkit-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.
Files changed (56) hide show
  1. package/lib/index.d.ts +71 -0
  2. package/lib/index.js +56 -0
  3. package/lib/src/agents.d.ts +347 -0
  4. package/lib/src/agents.js +554 -0
  5. package/lib/src/chart.d.ts +192 -0
  6. package/lib/src/chart.js +638 -0
  7. package/lib/src/config.d.ts +479 -0
  8. package/lib/src/config.js +190 -0
  9. package/lib/src/defaults.d.ts +68 -0
  10. package/lib/src/defaults.js +107 -0
  11. package/lib/src/filesystems.d.ts +208 -0
  12. package/lib/src/filesystems.js +958 -0
  13. package/lib/src/genie.d.ts +166 -0
  14. package/lib/src/genie.js +969 -0
  15. package/lib/src/history.d.ts +97 -0
  16. package/lib/src/history.js +264 -0
  17. package/lib/src/mcp.d.ts +66 -0
  18. package/lib/src/mcp.js +65 -0
  19. package/lib/src/memory.d.ts +111 -0
  20. package/lib/src/memory.js +275 -0
  21. package/lib/src/mlflow.d.ts +63 -0
  22. package/lib/src/mlflow.js +117 -0
  23. package/lib/src/model.d.ts +62 -0
  24. package/lib/src/model.js +168 -0
  25. package/lib/src/observability.d.ts +81 -0
  26. package/lib/src/observability.js +98 -0
  27. package/lib/src/pagination.d.ts +23 -0
  28. package/lib/src/pagination.js +31 -0
  29. package/lib/src/plugin.d.ts +352 -0
  30. package/lib/src/plugin.js +1015 -0
  31. package/lib/src/processors.d.ts +62 -0
  32. package/lib/src/processors.js +162 -0
  33. package/lib/src/rest.d.ts +36 -0
  34. package/lib/src/rest.js +46 -0
  35. package/lib/src/server.d.ts +155 -0
  36. package/lib/src/server.js +336 -0
  37. package/lib/src/serving-sanitize.d.ts +104 -0
  38. package/lib/src/serving-sanitize.js +228 -0
  39. package/lib/src/serving.d.ts +61 -0
  40. package/lib/src/serving.js +78 -0
  41. package/lib/src/statement.d.ts +51 -0
  42. package/lib/src/statement.js +83 -0
  43. package/lib/src/storage-schema.d.ts +14 -0
  44. package/lib/src/storage-schema.js +34 -0
  45. package/lib/src/summarize.d.ts +70 -0
  46. package/lib/src/summarize.js +142 -0
  47. package/lib/src/threads.d.ts +109 -0
  48. package/lib/src/threads.js +301 -0
  49. package/lib/src/validation.d.ts +19 -0
  50. package/lib/src/validation.js +17 -0
  51. package/lib/src/workspaces.d.ts +68 -0
  52. package/lib/src/workspaces.js +246 -0
  53. package/lib/src/writer.d.ts +25 -0
  54. package/lib/src/writer.js +40 -0
  55. package/lib/tsconfig.tsbuildinfo +1 -0
  56. package/package.json +17 -13
@@ -0,0 +1,479 @@
1
+ /**
2
+ * Plugin configuration types and shared `RequestContext` keys.
3
+ *
4
+ * Owns the typed {@link MastraPluginConfig} (the plugin's slice of AppKit
5
+ * config) and {@link MASTRA_CONFIG_SCHEMA}, the JSON Schema the manifest
6
+ * publishes for it so scaffolding tools and agents can read the option set.
7
+ *
8
+ * Precedence per field is explicit plugin config, then the environment
9
+ * variable named on the field, then a built-in default.
10
+ *
11
+ * Kept in a leaf module so `plugin.ts`, `server.ts`, `model.ts`, and
12
+ * `memory.ts` can import them without creating a cycle.
13
+ *
14
+ * @module
15
+ */
16
+ import { type BasePluginConfig, type ConfigSchema } from "@databricks/appkit";
17
+ import { appkit } from "@dbx-tools/appkit";
18
+ import type { BrandContext } from "@dbx-tools/shared-core";
19
+ import type { AgentConfig } from "@mastra/core/agent";
20
+ import type { RequestContext } from "@mastra/core/request-context";
21
+ import type { PgVectorConfig, PostgresStoreConfig } from "@mastra/pg";
22
+ import type { MastraAgentDefinition, MastraTools } from "./agents.js";
23
+ import type { GenieSpacesConfig } from "./genie.js";
24
+ /**
25
+ * `RequestContext` key under which {@link MastraServer} stores the
26
+ * resolved AppKit user. `model.ts` reads it to mint user-scoped
27
+ * Databricks tokens.
28
+ */
29
+ export declare const MASTRA_USER_KEY = "mastra__user";
30
+ /**
31
+ * `RequestContext` keys for AppKit user metadata stamped by
32
+ * {@link MastraServer}. Surfaced as trace metadata via
33
+ * {@link TRACE_REQUEST_CONTEXT_KEYS} so traces are filterable by who
34
+ * issued the request without leaking the full user object.
35
+ */
36
+ export declare const MASTRA_USER_NAME_KEY = "mastra__userName";
37
+ export declare const MASTRA_USER_EMAIL_KEY = "mastra__userEmail";
38
+ /**
39
+ * `RequestContext` key for the per-HTTP-request id stamped by
40
+ * {@link MastraServer}. Reads `X-Request-Id` from the incoming
41
+ * headers when present (so an upstream load balancer / API gateway
42
+ * can keep its trace correlation), falls back to a freshly minted
43
+ * UUID. Echoed back on the response and surfaced on every span via
44
+ * {@link TRACE_REQUEST_CONTEXT_KEYS} so logs and traces share a
45
+ * join key.
46
+ */
47
+ export declare const MASTRA_REQUEST_ID_KEY = "mastra__requestId";
48
+ /**
49
+ * `RequestContext` key for OAuth scopes parsed from the forwarded
50
+ * access token by {@link MastraServer.configureRequestContextScopes}.
51
+ * Workspace mounts that touch Databricks workspace files require
52
+ * `workspace` or `all-apis` in this list.
53
+ */
54
+ export declare const MASTRA_SCOPES_KEY = "mastra__scopes";
55
+ /**
56
+ * Canonical list of `RequestContext` keys we want Mastra to extract
57
+ * as metadata on every observability span (agent runs, model calls,
58
+ * tool invocations, workflow steps).
59
+ *
60
+ * Mirrors {@link https://mastra.ai/docs/observability/tracing/overview#automatic-metadata-from-requestcontext}:
61
+ * passed verbatim into `Observability.configs[*].requestContextKeys`,
62
+ * so any key listed here is read from `RequestContext` at trace
63
+ * start and attached as scalar span metadata. Keep the set to plain
64
+ * scalars - never include {@link MASTRA_USER_KEY} (it carries the
65
+ * full AppKit execution context with a `WorkspaceClient` reference).
66
+ *
67
+ * Order is purely cosmetic; Mastra de-dupes internally.
68
+ */
69
+ export declare const TRACE_REQUEST_CONTEXT_KEYS: readonly string[];
70
+ /** AppKit execution context plus the canonical user id. */
71
+ export interface User {
72
+ id: string;
73
+ executionContext: appkit.ExecutionContextLike;
74
+ }
75
+ /**
76
+ * Canonical identity for an AppKit execution context: the OBO user id on a
77
+ * user-scoped call, the service principal id otherwise.
78
+ */
79
+ export declare function executionContextUserId(context: appkit.ExecutionContextLike): string;
80
+ /**
81
+ * Identity every per-user cache entry is namespaced under, so an OBO result
82
+ * cannot be read back by another caller.
83
+ *
84
+ * Prefers the {@link User} that {@link MastraServer} stamps on the request
85
+ * context. The MCP transport routes do not thread that context into tool
86
+ * execution, so those fall back to the ambient execution context (the active
87
+ * OBO scope, or the service principal).
88
+ */
89
+ export declare function resolveUserKey(requestContext?: RequestContext): string;
90
+ /** PgVector config with an optional Mastra store id. */
91
+ export type MastraMemoryConfig = PgVectorConfig & {
92
+ id?: string;
93
+ };
94
+ /**
95
+ * Fine-grained control for the optional MCP server exposure
96
+ * ({@link MastraPluginConfig.mcp}). Every field is optional; the object
97
+ * form only needs to set what differs from the defaults.
98
+ */
99
+ export interface MastraMcpConfig {
100
+ /**
101
+ * Server id used in the route path (`/mcp/<serverId>/...`) and as the
102
+ * MCP registry id. Defaults to the plugin's registered name.
103
+ */
104
+ serverId?: string;
105
+ /** Display name advertised over MCP. Defaults to `"<displayName> MCP"`. */
106
+ name?: string;
107
+ /** Semantic version advertised over MCP. Defaults to `"1.0.0"`. */
108
+ version?: string;
109
+ /** Optional human-readable description advertised over MCP. */
110
+ description?: string;
111
+ /**
112
+ * Expose every registered agent as an `ask_<agentId>` MCP tool.
113
+ * Defaults to `true` - this is the "leverage the Mastra agents over
114
+ * MCP" behavior most callers want.
115
+ */
116
+ agents?: boolean;
117
+ /**
118
+ * Also expose the plugin's ambient tools (the built-in `render_data`
119
+ * plus anything in `config.tools`) as MCP tools. Defaults to `false`:
120
+ * the ambient tools assume an in-process chat turn (they publish
121
+ * writer events the chat UI consumes), so they aren't useful to a
122
+ * standalone MCP client. Turn this on only when those tools are safe
123
+ * to call out-of-band.
124
+ */
125
+ tools?: boolean;
126
+ /**
127
+ * Extra tools to expose over MCP beyond the agent / ambient sets.
128
+ * Use this for tools written specifically for MCP consumers.
129
+ */
130
+ extraTools?: MastraTools;
131
+ }
132
+ /** Configuration accepted by the Mastra AppKit plugin. */
133
+ export interface MastraPluginConfig extends BasePluginConfig {
134
+ /** Mastra OpenAI-compatible provider id. Defaults to `"databricks"`; no env fallback. */
135
+ providerId?: string;
136
+ /**
137
+ * PostgresStore for Mastra threads/messages. `true` reuses the
138
+ * `lakebase` plugin's pool; an object opens a dedicated store.
139
+ */
140
+ storage?: boolean | PostgresStoreConfig;
141
+ /**
142
+ * PgVector store for Mastra memory recall. `true` reuses the
143
+ * `lakebase` plugin's pool; an object opens a dedicated store.
144
+ */
145
+ memory?: boolean | MastraMemoryConfig;
146
+ /**
147
+ * Code-defined agents. Accepts three shapes for convenience:
148
+ *
149
+ * - **Record**: `{ analyst: def, helper: def }` - keys become the
150
+ * registered ids and the first key is the default.
151
+ * - **Single definition**: `def` - registered under
152
+ * `slugify(def.name)` (or `"default"` when `name` is omitted) and
153
+ * automatically marked as the default agent.
154
+ * - **Array**: `[def1, def2]` - each registered under
155
+ * `slugify(def.name)` (or `agent_${i}` when `name` is omitted);
156
+ * the first entry is the default.
157
+ *
158
+ * Each entry becomes a Mastra `Agent` reachable at
159
+ * `/api/<plugin>/route/chat/<id>` (the chat route also matches
160
+ * `:agentId`). When `agents` is omitted entirely, the plugin
161
+ * registers a single built-in `default` analyst so the bare
162
+ * `mastra()` call still mounts a working chat endpoint.
163
+ *
164
+ * @example Single-agent shorthand
165
+ * ```ts
166
+ * mastra({
167
+ * agents: createAgent({ instructions: "..." }),
168
+ * });
169
+ * ```
170
+ *
171
+ * @example Array
172
+ * ```ts
173
+ * mastra({
174
+ * agents: [
175
+ * createAgent({ name: "analyst", instructions: "..." }),
176
+ * createAgent({ name: "helper", instructions: "..." }),
177
+ * ],
178
+ * });
179
+ * ```
180
+ *
181
+ * @example Record (explicit ids)
182
+ * ```ts
183
+ * mastra({
184
+ * agents: {
185
+ * analyst: createAgent({ instructions: "..." }),
186
+ * helper: createAgent({ instructions: "..." }),
187
+ * },
188
+ * defaultAgent: "analyst",
189
+ * });
190
+ * ```
191
+ */
192
+ agents?: Record<string, MastraAgentDefinition> | MastraAgentDefinition | MastraAgentDefinition[];
193
+ /**
194
+ * Ambient tools spread into every registered agent's tools record;
195
+ * per-agent tools win on key collision. Use for a small shared
196
+ * library; for per-agent tools set `agents[id].tools` instead.
197
+ */
198
+ tools?: MastraTools;
199
+ /**
200
+ * Agent id used when the client doesn't specify one (the bare,
201
+ * un-suffixed history / suggestions routes resolve to it).
202
+ * Defaults to the first key in `agents` (or `"default"` when
203
+ * `agents` is omitted). Must match an id in `agents` when both are
204
+ * set; a mismatch throws at setup with the available candidates.
205
+ */
206
+ defaultAgent?: string;
207
+ /**
208
+ * Plugin-level default model applied to every agent that omits its
209
+ * own `model`. Mirrors AppKit's `agents({ defaultModel })`.
210
+ *
211
+ * - `string`: shorthand for "use the OBO auto-resolver but swap the
212
+ * `modelId`" (e.g. `"databricks-claude-sonnet-4-6"`).
213
+ * - Any other Mastra `DynamicArgument<MastraModelConfig>`: passed
214
+ * through verbatim. Use this when you need full control over auth
215
+ * or `providerId`.
216
+ *
217
+ * Resolution order per agent: `def.model` → `defaultModel` →
218
+ * `DATABRICKS_SERVING_ENDPOINT_NAME` → built-in `/serving-endpoints`
219
+ * resolver.
220
+ */
221
+ defaultModel?: AgentConfig["model"] | string;
222
+ /**
223
+ * Fuzzy-match loose model names (`"claude sonnet"`) against the workspace's
224
+ * Model Serving endpoints. Defaults to `true`; no env fallback.
225
+ *
226
+ * Set `false` to require exact endpoint names everywhere.
227
+ */
228
+ modelFuzzyMatch?: boolean;
229
+ /**
230
+ * Fuse.js score threshold for the fuzzy matcher, 0 (exact) to 1 (anything).
231
+ * Defaults to `0.4`; no env fallback.
232
+ *
233
+ * Lower values reject loose matches; raise it if you have a sprawling
234
+ * endpoint catalogue with similar-looking names.
235
+ */
236
+ modelFuzzyThreshold?: number;
237
+ /**
238
+ * TTL for the in-memory serving-endpoints list cache, in milliseconds.
239
+ * Defaults to 5 minutes; no env fallback.
240
+ *
241
+ * The cache is per workspace host and shared across users; concurrent
242
+ * callers coalesce on a single in-flight fetch.
243
+ */
244
+ modelCacheTtlMs?: number;
245
+ /**
246
+ * Let clients pick the backing endpoint per request. Defaults to `true`;
247
+ * no env fallback.
248
+ *
249
+ * Reads the `X-Mastra-Model` header, the `?model=` query string, or a
250
+ * `model` body field, in that order. Disable when running multi-tenant
251
+ * where untrusted clients shouldn't choose the endpoint.
252
+ */
253
+ modelOverride?: boolean;
254
+ /**
255
+ * Priority-ordered list of endpoint names tried *first* when no
256
+ * agent / plugin / env / request-override model id is set, ahead of
257
+ * the dynamic score-classified catalogue. The resolver picks the
258
+ * first id that is actually present in the workspace's
259
+ * `/serving-endpoints` listing.
260
+ *
261
+ * When unset, resolution is driven by the live Foundation Model API
262
+ * `quality` / `speed` / `cost` scores: endpoints are classified into
263
+ * chat classes (`classifyEndpoints`) and walked best-first
264
+ * (ChatThinking -> ChatBalanced -> ChatFast), with the small built-in
265
+ * `FALLBACK_MODEL_IDS` list as the floor when the catalogue can't be
266
+ * read. Set this to
267
+ * pin a regulated workspace to an approved subset, or to put custom
268
+ * endpoints in front of the auto-classified catalogue.
269
+ */
270
+ defaultModelFallbacks?: readonly string[];
271
+ /**
272
+ * When `true` (default), every agent gets a built-in input
273
+ * processor that strips `chartId` fields from prior assistant
274
+ * tool-invocation results before they reach the model. This
275
+ * prevents the model from reusing turn-scoped chartIds it sees
276
+ * in memory recall (which would leave `[chart:<id>]` markers
277
+ * pointing at writer events that no longer exist).
278
+ *
279
+ * Set to `false` to opt out - useful if a non-default agent
280
+ * needs full visibility into prior chartIds (e.g. an audit
281
+ * agent reasoning about chart lineage).
282
+ */
283
+ stripStaleCharts?: boolean;
284
+ /**
285
+ * Style guardrails appended to every agent's `instructions` to curb
286
+ * common LLM-isms (em dashes, emojis, sycophantic openers, throwaway
287
+ * closers, excessive hedging).
288
+ *
289
+ * - `undefined` (default): use the built-in
290
+ * `DEFAULT_STYLE_INSTRUCTIONS` from `agents.ts`.
291
+ * - `string`: replace the default with the supplied block.
292
+ * - `false`: disable entirely (agents see only their bespoke
293
+ * `instructions`).
294
+ *
295
+ * Appended (not prepended) so the agent's role and rules come first
296
+ * and the style block leans on the model's recency bias.
297
+ */
298
+ styleInstructions?: string | false;
299
+ /**
300
+ * Genie spaces this plugin's agents can delegate to. One Mastra
301
+ * tool is registered per alias (`genie` for the well-known
302
+ * `default` alias, `genie_<alias>` otherwise). Each tool spins
303
+ * up a per-question Genie sub-agent that runs Databricks
304
+ * "agent mode" against the space, broadcasts wire events to the
305
+ * UI, fetches statement rows for non-empty results, and returns
306
+ * a `(string | data | chart)[]` summary the host UI renders
307
+ * inline.
308
+ *
309
+ * Entries accept either a full {@link GenieSpaceConfig} object
310
+ * or a bare `space_id` string when no extras are needed:
311
+ *
312
+ * ```ts
313
+ * mastra({
314
+ * genieSpaces: {
315
+ * default: "01ef0d3c0e1b1f4a8d2c3e4f5a6b7c8d",
316
+ * forecasts: { spaceId: "01ef...", hint: "weekly demand forecasts" },
317
+ * },
318
+ * });
319
+ * ```
320
+ *
321
+ * Reach the spaces from an agent's `tools(plugins)` callback via
322
+ * `plugins.genie?.toolkit()`; the resulting tools accept
323
+ * `{ content, conversationId? }` and return a hydrated summary.
324
+ *
325
+ * **Fallback discovery** (highest precedence first): if this
326
+ * field is omitted, the Genie agent also picks up spaces from
327
+ * (1) the AppKit `genie({ spaces: { ... } })` plugin instance
328
+ * when registered, and (2) the `DATABRICKS_GENIE_SPACE_ID`
329
+ * env var (registered under the `default` alias). This keeps
330
+ * existing AppKit deployments working without restating the
331
+ * spaces config in two places.
332
+ */
333
+ genieSpaces?: GenieSpacesConfig;
334
+ /**
335
+ * TTL for the in-memory Genie space metadata cache, in
336
+ * milliseconds. Defaults to 5 minutes. The Genie agent calls
337
+ * `client.genie.getSpace(...)` on every cold-start to get the
338
+ * title / description / warehouse id; cached responses skip the
339
+ * round-trip and concurrent callers coalesce on a single
340
+ * in-flight fetch. Drop to a smaller value when analysts are
341
+ * actively editing space metadata and you want changes visible
342
+ * within seconds; raise it to amortise the round-trip when
343
+ * space metadata is effectively frozen.
344
+ *
345
+ * Backed by AppKit's `CacheManager`, so the cache participates
346
+ * in telemetry spans (`cache.getOrExecute`) and benefits from
347
+ * Lakebase persistence when the `lakebase` plugin is wired up.
348
+ */
349
+ genieSpaceCacheTtlMs?: number;
350
+ /**
351
+ * Maximum LLM steps each agent gets per turn. One step = one
352
+ * round-trip to the underlying model (a tool call consumes a
353
+ * step, the final-text reply consumes one too). Applies to
354
+ * every agent registered through {@link MastraPluginConfig.agents}
355
+ * - per-agent overrides aren't surfaced yet because the same
356
+ * ceiling has been sufficient across every workload we've run.
357
+ *
358
+ * Defaults to {@link DEFAULT_AGENT_MAX_STEPS} (25), sized to fit
359
+ * a decomposed Genie turn (grounding + several `ask_genie` calls
360
+ * + `prepare_chart` per dataset + the final-text reply) with
361
+ * headroom for the model to chain a couple of follow-ups before
362
+ * answering. Mastra's own `agent.generate` default of 5 would
363
+ * cut multi-step orchestration off after 2-3 tool calls, so
364
+ * explicitly raising the ceiling here is what lets the
365
+ * agent-mode loop play out.
366
+ *
367
+ * Lower when an unusually slow or expensive model makes long
368
+ * turns unaffordable; raise for exploratory workloads that need
369
+ * to drill deep into a dataset within a single turn.
370
+ */
371
+ agentMaxSteps?: number;
372
+ /**
373
+ * Wire Mastra spans into AppKit's global OTel pipeline via
374
+ * `@mastra/otel-bridge`.
375
+ *
376
+ * - `undefined` (default, auto): on only when
377
+ * `OTEL_EXPORTER_OTLP_ENDPOINT` or
378
+ * `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` is set. When unset, the
379
+ * bridge is skipped so Mastra does not log
380
+ * `[OtelBridge] No OTEL span found` on the noop tracer.
381
+ * - `true`: force on even without an OTLP endpoint.
382
+ * - `false`: force off.
383
+ */
384
+ observability?: boolean;
385
+ /**
386
+ * Log user feedback (thumbs up/down + freeform comments) to MLflow as
387
+ * trace assessments, and surface the feedback controls in the chat UI.
388
+ *
389
+ * - `undefined` (default, auto): enabled only when MLflow tracing is
390
+ * wired - an OTLP exporter endpoint is set and an MLflow experiment
391
+ * is named (the same signals the observability pipeline needs to
392
+ * ship traces to MLflow). Otherwise off, since there'd be no trace
393
+ * to attach feedback to.
394
+ * - `true`: force on. Feedback controls show and writes are attempted
395
+ * regardless of env detection (use when the env is configured in a
396
+ * way the auto-probe doesn't recognize).
397
+ * - `false`: force off. No trace-id header, no feedback route, no UI.
398
+ *
399
+ * Feedback attaches to a turn's MLflow trace via the OpenTelemetry
400
+ * trace id the server stamps on each response; see `mlflow.ts`.
401
+ */
402
+ feedback?: boolean;
403
+ /**
404
+ * Expose the plugin's agents (and optionally tools) as a Mastra MCP
405
+ * server so external MCP clients - Claude Desktop, Cursor, the Mastra
406
+ * playground, or another agent - can call them over the standard MCP
407
+ * transports. Enabled by default (agents only): wrapping the
408
+ * already-registered agents costs nothing extra, so the endpoint is on
409
+ * out of the box; only the ambient tools (which assume an in-process
410
+ * chat turn) stay off unless explicitly opted in.
411
+ *
412
+ * - `undefined` (default) / `true`: expose every registered agent as
413
+ * an `ask_<agentId>` MCP tool under a server whose id is the plugin
414
+ * name.
415
+ * - `false`: no MCP endpoints.
416
+ * - {@link MastraMcpConfig}: fine-grained control over the server id,
417
+ * advertised metadata, and which agents / tools are exposed.
418
+ *
419
+ * When enabled, the stock Mastra MCP routes mount under the plugin's
420
+ * base path (no bespoke route is added - the server is handed to the
421
+ * `Mastra` instance via `mcpServers`, which `@mastra/express` serves):
422
+ *
423
+ * - Streamable HTTP: `POST /api/<plugin>/mcp/<serverId>/mcp`
424
+ * - SSE (legacy): `GET /api/<plugin>/mcp/<serverId>/sse`
425
+ * `POST /api/<plugin>/mcp/<serverId>/messages`
426
+ *
427
+ * Requests run under the same AppKit OBO scope as the chat routes, so
428
+ * an agent invoked over MCP resolves its model and tools as the
429
+ * calling user.
430
+ */
431
+ mcp?: boolean | MastraMcpConfig;
432
+ /**
433
+ * How much of the stock `@mastra/express` management API is reachable
434
+ * through the plugin mount. `@mastra/express` registers its full route
435
+ * table (agent inference plus admin / mutating routes: direct tool
436
+ * execution, workflow control, raw memory read/write, telemetry, logs,
437
+ * scores). AppKit already authenticates every request as the OBO user,
438
+ * but nothing there restricts *which* of those operations the browser
439
+ * client may invoke.
440
+ *
441
+ * - `"scoped"` (default): only the routes the chat client legitimately
442
+ * needs are dispatched to Mastra - agent inference
443
+ * (`stream` / `generate` / `network`), read-only agent metadata, this
444
+ * plugin's own OBO- and resource-scoped `/route/*` routes (history /
445
+ * threads), and, when {@link mcp} is enabled, the MCP transport.
446
+ * Everything else (tool execution, workflow control, raw memory,
447
+ * telemetry, logs, scores, and other mutations) is rejected with
448
+ * `403` before it reaches Mastra.
449
+ * - `"full"`: dispatch the entire stock Mastra API. Use only for a
450
+ * trusted first-party console that genuinely needs the management
451
+ * surface.
452
+ */
453
+ apiAccess?: "scoped" | "full";
454
+ /**
455
+ * Optional brand context applied to charts produced by the built-in
456
+ * `render_data` / `prepare_chart` tools. When set, the chart planner's
457
+ * Echarts output is themed with the brand's palette (series colors derived
458
+ * from `colors.primary` / `colors.accent`) and sans font
459
+ * (`typography.sans`) instead of Echarts' defaults. Omit for the default
460
+ * Echarts look.
461
+ *
462
+ * Pass the portable {@link BrandContext} shared across the UI and
463
+ * libraries (e.g. `brand.defaultBrandContext` from `@dbx-tools/shared-core`,
464
+ * or a customer brand) - the same object the email add-on and the UI
465
+ * `BrandProvider` consume, so a host themes charts, email, and UI from one
466
+ * source.
467
+ */
468
+ brand?: BrandContext;
469
+ }
470
+ /**
471
+ * JSON Schema published on the manifest's `config.schema`, mirroring the
472
+ * documented defaults and environment fallbacks of {@link MastraPluginConfig}.
473
+ *
474
+ * Covers the JSON-expressible options only. `agents`, `tools`, and a
475
+ * `defaultModel` passed as a Mastra `DynamicArgument` are code-defined
476
+ * (functions / class instances), so they carry no schema entry; the
477
+ * `defaultModel` property below describes its string form.
478
+ */
479
+ export declare const MASTRA_CONFIG_SCHEMA: ConfigSchema;