@dbx-tools/shared-mastra 0.3.3 → 0.3.5

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 CHANGED
@@ -10,7 +10,8 @@ selection fields, and Mastra response schemas used by
10
10
  Key features:
11
11
 
12
12
  - Route constants for the AppKit-Mastra client surface, including history,
13
- threads, suggestions, model lists, embeds, and feedback.
13
+ threads, suggestions, model lists, the per-agent default-model lookup,
14
+ embeds, and feedback.
14
15
  - Header/query/body constants for thread selection and model override requests.
15
16
  - Embed-marker parsing for delayed chart and statement-data payloads in
16
17
  streaming assistant text.
@@ -28,7 +29,7 @@ const config = wire.MastraClientConfigSchema.parse(await response.json());
28
29
  ```
29
30
 
30
31
  `wire.MastraClientConfigSchema` describes the plugin-published client config:
31
- mount path, default agent, feedback enablement, and MCP route details. Use it to
32
+ mount path, default agent, the agent roster, and feedback enablement. Use it to
32
33
  bootstrap a UI without hard-coding server paths.
33
34
 
34
35
  ## Use Route Constants
@@ -41,7 +42,8 @@ const threadsUrl = `${basePath}${routes.MASTRA_ROUTES.threads}`;
41
42
  ```
42
43
 
43
44
  `routes.MASTRA_ROUTES` keeps client fetch calls aligned with plugin route names
44
- for history, threads, models, suggestions, feedback, and embeds.
45
+ for history, threads, models, the default-model lookup, suggestions, feedback,
46
+ and embeds.
45
47
 
46
48
  ## Select Threads And Models
47
49
 
package/package.json CHANGED
@@ -12,16 +12,16 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "zod": "^4.3.6",
15
- "@dbx-tools/shared-core": "0.3.3",
16
- "@dbx-tools/shared-model": "0.3.3",
17
- "@dbx-tools/shared-genie": "0.3.3"
15
+ "@dbx-tools/shared-core": "0.3.5",
16
+ "@dbx-tools/shared-genie": "0.3.5",
17
+ "@dbx-tools/shared-model": "0.3.5"
18
18
  },
19
19
  "main": "index.ts",
20
20
  "license": "UNLICENSED",
21
21
  "publishConfig": {
22
22
  "access": "public"
23
23
  },
24
- "version": "0.3.3",
24
+ "version": "0.3.5",
25
25
  "types": "index.ts",
26
26
  "type": "module",
27
27
  "exports": {
package/src/routes.ts CHANGED
@@ -5,9 +5,9 @@
5
5
  * `@dbx-tools/appkit-mastra-ui`) so a relayout - or a rename of a
6
6
  * sub-path - is a one-line change here and the two can never drift.
7
7
  *
8
- * The agent-scoped segments (`history`, `threads`, `suggestions`) take
9
- * an optional `/:agentId` suffix; the default agent uses the bare
10
- * segment. Conversation streaming itself rides the standard Mastra
8
+ * The agent-scoped segments (`history`, `threads`, `suggestions`,
9
+ * `defaultModel`) take an optional `/:agentId` suffix; the default agent
10
+ * uses the bare segment. Conversation streaming itself rides the standard Mastra
11
11
  * agent routes (`@mastra/client-js`'s `getAgent(id).stream()`), so
12
12
  * there's no chat segment here.
13
13
  *
@@ -22,11 +22,13 @@ export const MASTRA_ROUTES = {
22
22
  feedback: "/route/feedback",
23
23
  suggestions: "/suggestions",
24
24
  models: "/models",
25
- // The serving-endpoint id an agent falls back to when the client pins no
26
- // model. Agent-scoped via an optional `?agentId=`; the default agent is
27
- // used when omitted. Returns `{ agentId, model }` where `model` is null
28
- // when the agent resolves its model dynamically at call time (nothing
29
- // static to advertise). Lets the picker label its "Server default" option.
25
+ // The static serving-endpoint an agent falls back to when the client pins
26
+ // no model. Agent-scoped like `history`/`threads`/`suggestions` via an
27
+ // optional `/:agentId` suffix; the default agent uses the bare segment.
28
+ // Returns `{ agentId, model, displayName }` where `model` and `displayName`
29
+ // are null when the agent resolves its model dynamically at call time
30
+ // (nothing static to advertise). Lets the picker label its default option
31
+ // with the humanized model name.
30
32
  defaultModel: "/default-model",
31
33
  embed: "/embed",
32
34
  } as const;
package/src/wire.ts CHANGED
@@ -70,15 +70,19 @@ export type MastraClientConfig = z.infer<typeof MastraClientConfigSchema>;
70
70
 
71
71
  /**
72
72
  * JSON payload returned by `GET ${basePath}/default-model[?agentId=]`. The
73
- * static default serving-endpoint id the agent resolves to when the client
74
- * pins no model, or `null` when the agent decides its model dynamically at
75
- * call time (nothing static to advertise). Lets the picker name its "Server
76
- * default" option. Kept off the static bootstrap `clientConfig` on purpose:
77
- * it is per-agent and can be dynamic, so it is fetched like `/models`.
73
+ * static default model the agent resolves to when the client pins no model,
74
+ * as both the raw serving-endpoint `model` id and a `displayName` (the
75
+ * humanized label the picker shows). Both are `null` when the agent decides
76
+ * its model dynamically at call time (nothing static to advertise). Lets the
77
+ * picker label its default option WITHOUT waiting on the `/models` catalogue,
78
+ * so it never flashes a raw id on load. Kept off the static bootstrap
79
+ * `clientConfig` on purpose: it is per-agent and can be dynamic, so it is
80
+ * fetched like `/models`.
78
81
  */
79
82
  export const DefaultModelResponseSchema = z.object({
80
83
  agentId: z.string(),
81
84
  model: z.string().nullable(),
85
+ displayName: z.string().nullable(),
82
86
  });
83
87
  export type DefaultModelResponse = z.infer<typeof DefaultModelResponseSchema>;
84
88
 
@@ -587,8 +591,9 @@ export type GenieDatasetData = z.infer<typeof GenieDatasetDataSchema>;
587
591
  *
588
592
  * `option` is intentionally NOT included. The resolved Echarts
589
593
  * spec lives off-band in the chart cache: the host UI fetches it
590
- * by `chartId` via `${MastraClientConfig.embedPathTemplate}`
591
- * (`/embed/chart/:id`, see {@link Chart}). Embedding the full spec inline would
594
+ * by `chartId` from the plugin's embed route (derived from
595
+ * `basePath` + {@link MASTRA_ROUTES}.embed, i.e. `/embed/chart/:id`;
596
+ * see {@link Chart}). Embedding the full spec inline would
592
597
  * inflate every dataset by several KB per chart and round-trip
593
598
  * through the LLM context for zero benefit (the model only needs
594
599
  * the `chartId` to place a `[chart:<chartId>]` marker in its