@dbx-tools/appkit-mastra 0.3.4 → 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 +7 -0
- package/package.json +10 -10
- package/src/agents.ts +3 -2
- package/src/plugin.ts +14 -9
package/README.md
CHANGED
|
@@ -278,6 +278,13 @@ Use `serving.extractModelOverride()` and `serving.resolveServingConfig()` when
|
|
|
278
278
|
building custom routes that should behave like the plugin's `/models` and stream
|
|
279
279
|
routes.
|
|
280
280
|
|
|
281
|
+
The plugin also serves `GET /default-model` (and `/default-model/:agentId`),
|
|
282
|
+
returning `{ agentId, model, displayName }` - the static serving-endpoint an
|
|
283
|
+
agent falls back to when the client pins no model, plus its humanized label.
|
|
284
|
+
`model` / `displayName` are `null` when the agent resolves its model
|
|
285
|
+
dynamically at call time. This lets a model picker label its default option
|
|
286
|
+
without waiting on the `/models` catalogue (so it never flashes a raw id).
|
|
287
|
+
|
|
281
288
|
## Threads, History, And Suggestions
|
|
282
289
|
|
|
283
290
|
When storage is enabled, the plugin provides route helpers and in-process
|
package/package.json
CHANGED
|
@@ -27,22 +27,22 @@
|
|
|
27
27
|
"@opentelemetry/api": "^1.9.1",
|
|
28
28
|
"pg": "^8.22.0",
|
|
29
29
|
"zod": "^4.3.6",
|
|
30
|
-
"@dbx-tools/
|
|
31
|
-
"@dbx-tools/
|
|
32
|
-
"@dbx-tools/
|
|
33
|
-
"@dbx-tools/
|
|
34
|
-
"@dbx-tools/model": "0.3.
|
|
35
|
-
"@dbx-tools/shared-
|
|
36
|
-
"@dbx-tools/shared-
|
|
37
|
-
"@dbx-tools/shared-
|
|
38
|
-
"@dbx-tools/shared-model": "0.3.
|
|
30
|
+
"@dbx-tools/appkit": "0.3.5",
|
|
31
|
+
"@dbx-tools/core": "0.3.5",
|
|
32
|
+
"@dbx-tools/genie": "0.3.5",
|
|
33
|
+
"@dbx-tools/databricks": "0.3.5",
|
|
34
|
+
"@dbx-tools/model": "0.3.5",
|
|
35
|
+
"@dbx-tools/shared-core": "0.3.5",
|
|
36
|
+
"@dbx-tools/shared-genie": "0.3.5",
|
|
37
|
+
"@dbx-tools/shared-mastra": "0.3.5",
|
|
38
|
+
"@dbx-tools/shared-model": "0.3.5"
|
|
39
39
|
},
|
|
40
40
|
"main": "index.ts",
|
|
41
41
|
"license": "UNLICENSED",
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"version": "0.3.
|
|
45
|
+
"version": "0.3.5",
|
|
46
46
|
"types": "index.ts",
|
|
47
47
|
"type": "module",
|
|
48
48
|
"exports": {
|
package/src/agents.ts
CHANGED
|
@@ -331,8 +331,9 @@ export interface BuiltAgents {
|
|
|
331
331
|
/**
|
|
332
332
|
* Static default serving-endpoint id per agent id, as resolved by
|
|
333
333
|
* {@link describeAgentDefaultModel}. `"<dynamic>"` when the model is a
|
|
334
|
-
* function decided at call time.
|
|
335
|
-
* the
|
|
334
|
+
* function decided at call time. Consumed by the plugin's
|
|
335
|
+
* `GET /default-model` route handler so the client's model picker can label
|
|
336
|
+
* its default option with the real endpoint's humanized name.
|
|
336
337
|
*/
|
|
337
338
|
defaultModels: Record<string, string>;
|
|
338
339
|
/**
|
package/src/plugin.ts
CHANGED
|
@@ -318,14 +318,17 @@ export class MastraPlugin extends Plugin<MastraPluginConfig> {
|
|
|
318
318
|
.catch(next);
|
|
319
319
|
});
|
|
320
320
|
|
|
321
|
-
// `GET /default-model
|
|
322
|
-
// an agent falls back to when the client pins no model,
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
|
|
328
|
-
|
|
321
|
+
// `GET /default-model` (and `/default-model/:agentId`) reports the static
|
|
322
|
+
// serving-endpoint an agent falls back to when the client pins no model,
|
|
323
|
+
// so the picker can label its default option with the model's humanized
|
|
324
|
+
// name. Agent-scoped via the optional `/:agentId` suffix (URL symmetry
|
|
325
|
+
// with the history / threads / suggestions routes), defaulting to the
|
|
326
|
+
// default agent. `model` / `displayName` are null when the agent has no
|
|
327
|
+
// static default (a dynamic, call-time model) or the agent id is unknown.
|
|
328
|
+
// Reads only in-memory build state, so it's synchronous and needs no OBO
|
|
329
|
+
// scoping. Registered before the catch-all, same as `/models`.
|
|
330
|
+
const handleDefaultModel = (req: express.Request, res: express.Response): void => {
|
|
331
|
+
const requested = string.firstNonEmpty(req.params["agentId"]);
|
|
329
332
|
const agentId = requested ?? this.built?.defaultAgentId ?? FALLBACK_AGENT_ID;
|
|
330
333
|
const raw = this.built?.defaultModels[agentId];
|
|
331
334
|
// `"<dynamic>"` (a call-time function) has no fixed id to advertise.
|
|
@@ -337,7 +340,9 @@ export class MastraPlugin extends Plugin<MastraPluginConfig> {
|
|
|
337
340
|
model,
|
|
338
341
|
displayName: model ? display.toModelDisplayName(model) : null,
|
|
339
342
|
});
|
|
340
|
-
}
|
|
343
|
+
};
|
|
344
|
+
router.get(routes.MASTRA_ROUTES.defaultModel, handleDefaultModel);
|
|
345
|
+
router.get(`${routes.MASTRA_ROUTES.defaultModel}/:agentId`, handleDefaultModel);
|
|
341
346
|
|
|
342
347
|
// `GET /embed/:type/:id` is the single resolver for every embed
|
|
343
348
|
// marker the agent emits in prose (`[chart:<id>]`,
|