@dbx-tools/appkit-mastra 0.3.1 → 0.3.2
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/package.json +10 -10
- package/src/agents.ts +12 -2
- package/src/plugin.ts +16 -1
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/appkit": "0.3.
|
|
31
|
-
"@dbx-tools/
|
|
32
|
-
"@dbx-tools/genie": "0.3.
|
|
33
|
-
"@dbx-tools/
|
|
34
|
-
"@dbx-tools/
|
|
35
|
-
"@dbx-tools/
|
|
36
|
-
"@dbx-tools/shared-genie": "0.3.
|
|
37
|
-
"@dbx-tools/shared-mastra": "0.3.
|
|
38
|
-
"@dbx-tools/shared-model": "0.3.
|
|
30
|
+
"@dbx-tools/appkit": "0.3.2",
|
|
31
|
+
"@dbx-tools/databricks": "0.3.2",
|
|
32
|
+
"@dbx-tools/genie": "0.3.2",
|
|
33
|
+
"@dbx-tools/model": "0.3.2",
|
|
34
|
+
"@dbx-tools/core": "0.3.2",
|
|
35
|
+
"@dbx-tools/shared-core": "0.3.2",
|
|
36
|
+
"@dbx-tools/shared-genie": "0.3.2",
|
|
37
|
+
"@dbx-tools/shared-mastra": "0.3.2",
|
|
38
|
+
"@dbx-tools/shared-model": "0.3.2"
|
|
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.2",
|
|
46
46
|
"types": "index.ts",
|
|
47
47
|
"type": "module",
|
|
48
48
|
"exports": {
|
package/src/agents.ts
CHANGED
|
@@ -328,6 +328,13 @@ export type MastraMemoryConfigOverride = DistributiveOmit<PgVectorConfig, "id">
|
|
|
328
328
|
export interface BuiltAgents {
|
|
329
329
|
agents: Record<string, Agent>;
|
|
330
330
|
defaultAgentId: string;
|
|
331
|
+
/**
|
|
332
|
+
* Static default serving-endpoint id per agent id, as resolved by
|
|
333
|
+
* {@link describeAgentDefaultModel}. `"<dynamic>"` when the model is a
|
|
334
|
+
* function decided at call time. Surfaced so `clientConfig()` can label
|
|
335
|
+
* the picker's "Server default" option with the real endpoint.
|
|
336
|
+
*/
|
|
337
|
+
defaultModels: Record<string, string>;
|
|
331
338
|
/**
|
|
332
339
|
* Ambient tools shared across every agent (the built-in system tools
|
|
333
340
|
* spread with `config.tools`). Surfaced so the optional MCP server
|
|
@@ -469,6 +476,7 @@ export async function buildAgents(opts: {
|
|
|
469
476
|
...(config.stripStaleCharts === false ? [] : [stripStaleChartsProcessor]),
|
|
470
477
|
];
|
|
471
478
|
const agents: Record<string, Agent> = {};
|
|
479
|
+
const defaultModels: Record<string, string> = {};
|
|
472
480
|
const approvalGatedByAgent: Array<{ agentId: string; toolIds: string[] }> = [];
|
|
473
481
|
|
|
474
482
|
for (const [id, def] of Object.entries(definitions)) {
|
|
@@ -502,10 +510,12 @@ export async function buildAgents(opts: {
|
|
|
502
510
|
// *static* default; per-request overrides (header / query /
|
|
503
511
|
// body) and the workspace-catalogue fuzzy match still apply at
|
|
504
512
|
// call time.
|
|
513
|
+
const defaultModel = describeAgentDefaultModel(config, def);
|
|
514
|
+
defaultModels[id] = defaultModel;
|
|
505
515
|
log.info("agent registered", {
|
|
506
516
|
id,
|
|
507
517
|
name: def.name ?? id,
|
|
508
|
-
defaultModel
|
|
518
|
+
defaultModel,
|
|
509
519
|
tools: Object.keys(tools),
|
|
510
520
|
});
|
|
511
521
|
}
|
|
@@ -519,7 +529,7 @@ export async function buildAgents(opts: {
|
|
|
519
529
|
assertApprovalGatedToolsHaveStorage(approvalGatedByAgent, memoryBuilder);
|
|
520
530
|
|
|
521
531
|
log.info("agents ready", { ids, defaultAgentId });
|
|
522
|
-
return { agents, defaultAgentId, ambientTools };
|
|
532
|
+
return { agents, defaultAgentId, defaultModels, ambientTools };
|
|
523
533
|
}
|
|
524
534
|
|
|
525
535
|
/**
|
package/src/plugin.ts
CHANGED
|
@@ -76,7 +76,7 @@ import { attachRoutePatchMiddleware, isMastraRequestAllowed, MastraServer } from
|
|
|
76
76
|
import { resolveServingConfig } from "./serving";
|
|
77
77
|
import { fetchStatementData, STATEMENT_ROW_CAP } from "./statement";
|
|
78
78
|
import { threadsRoute } from "./threads";
|
|
79
|
-
import { error, log } from "@dbx-tools/shared-core";
|
|
79
|
+
import { error, log, string } from "@dbx-tools/shared-core";
|
|
80
80
|
import { plugin } from "@dbx-tools/appkit";
|
|
81
81
|
|
|
82
82
|
const GENIE_MANIFEST = plugin.data(genie).plugin.manifest;
|
|
@@ -318,6 +318,20 @@ export class MastraPlugin extends Plugin<MastraPluginConfig> {
|
|
|
318
318
|
.catch(next);
|
|
319
319
|
});
|
|
320
320
|
|
|
321
|
+
// `GET /default-model[?agentId=]` reports the static serving-endpoint id
|
|
322
|
+
// an agent falls back to when the client pins no model, so the picker can
|
|
323
|
+
// name its "Server default" option. Agent-scoped (defaults to the default
|
|
324
|
+
// agent); `model` is null when the agent has no static default (a dynamic,
|
|
325
|
+
// call-time model) or the agent id is unknown. Registered before the
|
|
326
|
+
// catch-all, same as `/models`.
|
|
327
|
+
router.get(routes.MASTRA_ROUTES.defaultModel, (req, res) => {
|
|
328
|
+
const requested = string.firstNonEmpty(req.query["agentId"]);
|
|
329
|
+
const agentId = requested ?? this.built?.defaultAgentId ?? FALLBACK_AGENT_ID;
|
|
330
|
+
const model = this.built?.defaultModels[agentId];
|
|
331
|
+
// `"<dynamic>"` (a call-time function) has no fixed id to advertise.
|
|
332
|
+
res.json({ agentId, model: model && model !== "<dynamic>" ? model : null });
|
|
333
|
+
});
|
|
334
|
+
|
|
321
335
|
// `GET /embed/:type/:id` is the single resolver for every embed
|
|
322
336
|
// marker the agent emits in prose (`[chart:<id>]`,
|
|
323
337
|
// `[data:<id>]`, ...). `:type` selects a resolver from the
|
|
@@ -746,6 +760,7 @@ export class MastraPlugin extends Plugin<MastraPluginConfig> {
|
|
|
746
760
|
"/route/history",
|
|
747
761
|
"/route/threads",
|
|
748
762
|
"/models",
|
|
763
|
+
"/default-model",
|
|
749
764
|
"/suggestions",
|
|
750
765
|
"/route/feedback",
|
|
751
766
|
"/embed/:type/:id",
|