@mastra/server 1.38.0-alpha.3 → 1.38.0-alpha.4
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/CHANGELOG.md +113 -0
- package/dist/{api-schema-manifest-DV7H6SLV.cjs → api-schema-manifest-JTQHOGKZ.cjs} +4 -4
- package/dist/{api-schema-manifest-DV7H6SLV.cjs.map → api-schema-manifest-JTQHOGKZ.cjs.map} +1 -1
- package/dist/{api-schema-manifest-2HZM3JT7.js → api-schema-manifest-MIQHCYPS.js} +3 -3
- package/dist/{api-schema-manifest-2HZM3JT7.js.map → api-schema-manifest-MIQHCYPS.js.map} +1 -1
- package/dist/{chunk-VJHJY3AS.js → chunk-234HJ3C3.js} +9 -30
- package/dist/chunk-234HJ3C3.js.map +1 -0
- package/dist/{chunk-YUTVYY3X.js → chunk-2DTOYQQ4.js} +3 -3
- package/dist/{chunk-YUTVYY3X.js.map → chunk-2DTOYQQ4.js.map} +1 -1
- package/dist/{chunk-FQIFYDKU.js → chunk-5SM6OBSO.js} +3 -3
- package/dist/{chunk-FQIFYDKU.js.map → chunk-5SM6OBSO.js.map} +1 -1
- package/dist/{chunk-2WUP6QIZ.cjs → chunk-65ZS7YK4.cjs} +5 -5
- package/dist/{chunk-2WUP6QIZ.cjs.map → chunk-65ZS7YK4.cjs.map} +1 -1
- package/dist/{chunk-TDAAXXUA.cjs → chunk-67X7UIDG.cjs} +9 -5
- package/dist/chunk-67X7UIDG.cjs.map +1 -0
- package/dist/chunk-6FHJAHQJ.cjs +234 -0
- package/dist/chunk-6FHJAHQJ.cjs.map +1 -0
- package/dist/{chunk-7N5OFQB3.cjs → chunk-6KPE7KSJ.cjs} +14 -14
- package/dist/{chunk-7N5OFQB3.cjs.map → chunk-6KPE7KSJ.cjs.map} +1 -1
- package/dist/{chunk-WQMMOPJQ.cjs → chunk-ANFNDHDM.cjs} +16 -16
- package/dist/{chunk-WQMMOPJQ.cjs.map → chunk-ANFNDHDM.cjs.map} +1 -1
- package/dist/{chunk-EFMN6TTT.js → chunk-APGJQAJ7.js} +3 -3
- package/dist/{chunk-EFMN6TTT.js.map → chunk-APGJQAJ7.js.map} +1 -1
- package/dist/{chunk-GII2QWIN.cjs → chunk-BO3KDJW5.cjs} +5 -5
- package/dist/{chunk-GII2QWIN.cjs.map → chunk-BO3KDJW5.cjs.map} +1 -1
- package/dist/{chunk-XHPUK2PC.cjs → chunk-CZM46CXF.cjs} +20 -20
- package/dist/{chunk-XHPUK2PC.cjs.map → chunk-CZM46CXF.cjs.map} +1 -1
- package/dist/chunk-DEYP5MF7.cjs +605 -0
- package/dist/chunk-DEYP5MF7.cjs.map +1 -0
- package/dist/{chunk-HNPFUM7G.js → chunk-EN3XZKLJ.js} +24 -16
- package/dist/chunk-EN3XZKLJ.js.map +1 -0
- package/dist/{chunk-3MCPTOLN.cjs → chunk-EQF2PRTA.cjs} +4 -4
- package/dist/{chunk-3MCPTOLN.cjs.map → chunk-EQF2PRTA.cjs.map} +1 -1
- package/dist/{chunk-PN3LDOLZ.js → chunk-FYCTKP2F.js} +9 -2
- package/dist/chunk-FYCTKP2F.js.map +1 -0
- package/dist/chunk-G7N4TLWZ.js +206 -0
- package/dist/chunk-G7N4TLWZ.js.map +1 -0
- package/dist/{chunk-TJ7OH3RN.cjs → chunk-HR5UNJF7.cjs} +3 -3
- package/dist/{chunk-TJ7OH3RN.cjs.map → chunk-HR5UNJF7.cjs.map} +1 -1
- package/dist/{chunk-HAT56AXO.cjs → chunk-JV2TL2NQ.cjs} +5 -5
- package/dist/{chunk-HAT56AXO.cjs.map → chunk-JV2TL2NQ.cjs.map} +1 -1
- package/dist/{chunk-FLBKRRNC.js → chunk-LJRCDF42.js} +3 -3
- package/dist/{chunk-FLBKRRNC.js.map → chunk-LJRCDF42.js.map} +1 -1
- package/dist/{chunk-NTXMKBCU.js → chunk-MCRZYWPS.js} +3 -3
- package/dist/{chunk-NTXMKBCU.js.map → chunk-MCRZYWPS.js.map} +1 -1
- package/dist/{chunk-QBMOXGFZ.js → chunk-MZ3EAJXG.js} +8 -4
- package/dist/chunk-MZ3EAJXG.js.map +1 -0
- package/dist/{chunk-6GNMUI4P.js → chunk-OGJFOIOH.js} +3 -3
- package/dist/{chunk-6GNMUI4P.js.map → chunk-OGJFOIOH.js.map} +1 -1
- package/dist/{chunk-C3E5C74L.cjs → chunk-OM7HESYA.cjs} +4 -4
- package/dist/{chunk-C3E5C74L.cjs.map → chunk-OM7HESYA.cjs.map} +1 -1
- package/dist/{chunk-R6CMAAEQ.js → chunk-PJI3MJPX.js} +3 -3
- package/dist/{chunk-R6CMAAEQ.js.map → chunk-PJI3MJPX.js.map} +1 -1
- package/dist/{chunk-N42WTSJL.cjs → chunk-Q5NDXAZ2.cjs} +104 -96
- package/dist/chunk-Q5NDXAZ2.cjs.map +1 -0
- package/dist/chunk-QB5CXFV7.js +592 -0
- package/dist/chunk-QB5CXFV7.js.map +1 -0
- package/dist/{chunk-3E2YDRGM.js → chunk-QCCJOLRZ.js} +3 -3
- package/dist/{chunk-3E2YDRGM.js.map → chunk-QCCJOLRZ.js.map} +1 -1
- package/dist/{chunk-X5NKEO7W.cjs → chunk-R6HOWZFY.cjs} +5 -5
- package/dist/{chunk-X5NKEO7W.cjs.map → chunk-R6HOWZFY.cjs.map} +1 -1
- package/dist/{chunk-OJ2LSGSK.js → chunk-R6SXN4ZF.js} +3 -3
- package/dist/{chunk-OJ2LSGSK.js.map → chunk-R6SXN4ZF.js.map} +1 -1
- package/dist/{chunk-MWJ6ISO7.cjs → chunk-RZ5J47R2.cjs} +4 -4
- package/dist/{chunk-MWJ6ISO7.cjs.map → chunk-RZ5J47R2.cjs.map} +1 -1
- package/dist/{chunk-QWT4ON3B.cjs → chunk-T254JS3B.cjs} +9 -2
- package/dist/chunk-T254JS3B.cjs.map +1 -0
- package/dist/{chunk-4FHOUNUN.js → chunk-TNRHBPDN.js} +3 -3
- package/dist/{chunk-4FHOUNUN.js.map → chunk-TNRHBPDN.js.map} +1 -1
- package/dist/{chunk-FYMY45UE.cjs → chunk-URLWJKB6.cjs} +15 -15
- package/dist/{chunk-FYMY45UE.cjs.map → chunk-URLWJKB6.cjs.map} +1 -1
- package/dist/{chunk-YF6SK4WY.cjs → chunk-UTBBNDFB.cjs} +22 -43
- package/dist/chunk-UTBBNDFB.cjs.map +1 -0
- package/dist/{chunk-3SSPJA4Y.js → chunk-UWETKNZ3.js} +3 -3
- package/dist/{chunk-3SSPJA4Y.js.map → chunk-UWETKNZ3.js.map} +1 -1
- package/dist/{chunk-ICYY6O53.cjs → chunk-VYDWPLTW.cjs} +4 -4
- package/dist/{chunk-ICYY6O53.cjs.map → chunk-VYDWPLTW.cjs.map} +1 -1
- package/dist/{chunk-LPB5BN2D.js → chunk-XVLL5IGQ.js} +3 -3
- package/dist/{chunk-LPB5BN2D.js.map → chunk-XVLL5IGQ.js.map} +1 -1
- package/dist/{chunk-VI7ODS36.js → chunk-ZIBWBUTB.js} +3 -3
- package/dist/{chunk-VI7ODS36.js.map → chunk-ZIBWBUTB.js.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/server/handlers/a2a.cjs +14 -14
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-versions.cjs +8 -8
- package/dist/server/handlers/agent-versions.js +1 -1
- package/dist/server/handlers/agents.cjs +43 -43
- package/dist/server/handlers/agents.d.ts +162 -0
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/conversations.cjs +5 -5
- package/dist/server/handlers/conversations.js +1 -1
- package/dist/server/handlers/responses.cjs +4 -4
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/scorer-versions.cjs +8 -8
- package/dist/server/handlers/scorer-versions.js +1 -1
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/stored-agent-favorites.cjs +3 -3
- package/dist/server/handlers/stored-agent-favorites.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +7 -7
- package/dist/server/handlers/stored-agents.d.ts +324 -0
- package/dist/server/handlers/stored-agents.d.ts.map +1 -1
- package/dist/server/handlers/stored-agents.js +1 -1
- package/dist/server/handlers/stored-scorers.cjs +6 -6
- package/dist/server/handlers/stored-scorers.js +1 -1
- package/dist/server/handlers/system.cjs +3 -3
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tool-providers.cjs +37 -5
- package/dist/server/handlers/tool-providers.d.ts +276 -4
- package/dist/server/handlers/tool-providers.d.ts.map +1 -1
- package/dist/server/handlers/tool-providers.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers.cjs +12 -12
- package/dist/server/handlers.js +6 -6
- package/dist/server/schemas/index.cjs +174 -94
- package/dist/server/schemas/index.js +5 -5
- package/dist/server/schemas/stored-agents.d.ts +904 -0
- package/dist/server/schemas/stored-agents.d.ts.map +1 -1
- package/dist/server/schemas/tool-providers.d.ts +207 -0
- package/dist/server/schemas/tool-providers.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +13 -13
- package/dist/server/server-adapter/index.js +2 -2
- package/dist/server/server-adapter/routes/tool-providers.d.ts +232 -1
- package/dist/server/server-adapter/routes/tool-providers.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-37G66LYP.cjs +0 -65
- package/dist/chunk-37G66LYP.cjs.map +0 -1
- package/dist/chunk-ACESWSVL.cjs +0 -131
- package/dist/chunk-ACESWSVL.cjs.map +0 -1
- package/dist/chunk-HNPFUM7G.js.map +0 -1
- package/dist/chunk-MXUQJDLY.js +0 -126
- package/dist/chunk-MXUQJDLY.js.map +0 -1
- package/dist/chunk-N42WTSJL.cjs.map +0 -1
- package/dist/chunk-NIKW5NHG.js +0 -57
- package/dist/chunk-NIKW5NHG.js.map +0 -1
- package/dist/chunk-PN3LDOLZ.js.map +0 -1
- package/dist/chunk-QBMOXGFZ.js.map +0 -1
- package/dist/chunk-QWT4ON3B.cjs.map +0 -1
- package/dist/chunk-TDAAXXUA.cjs.map +0 -1
- package/dist/chunk-VJHJY3AS.js.map +0 -1
- package/dist/chunk-YF6SK4WY.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,118 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
+
## 1.38.0-alpha.4
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added the v1 ToolProvider runtime, server routes, client SDK methods, and editor wiring that power OAuth-backed integrations on stored agents. ([#17248](https://github.com/mastra-ai/mastra/pull/17248))
|
|
8
|
+
|
|
9
|
+
**Stored agents can now pin OAuth connections per toolkit**
|
|
10
|
+
|
|
11
|
+
A stored agent's config accepts a new `toolProviders` shape that tells the runtime which connection to bind for each toolkit at execution time. Connections can be scoped per-author, shared across an org, or supplied by the caller.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
{
|
|
15
|
+
toolProviders: {
|
|
16
|
+
composio: {
|
|
17
|
+
connections: {
|
|
18
|
+
gmail: [{ kind: 'author', toolkit: 'gmail', connectionId: 'auth_abc', scope: 'per-author' }],
|
|
19
|
+
},
|
|
20
|
+
tools: {
|
|
21
|
+
GMAIL_FETCH_EMAILS: { toolkit: 'gmail' },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**New client SDK surface for managing connections**
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { MastraClient } from '@mastra/client-js';
|
|
32
|
+
|
|
33
|
+
const client = new MastraClient({ baseUrl: '…' });
|
|
34
|
+
const composio = client.toolProvider('composio');
|
|
35
|
+
|
|
36
|
+
const { items } = await composio.listConnections({ toolkit: 'gmail' });
|
|
37
|
+
await composio.disconnectConnection('auth_abc');
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**New `ToolProvider` interface for custom providers**
|
|
41
|
+
|
|
42
|
+
Providers implement a VNext surface (`listToolkitsVNext`, `listToolsVNext`, `resolveToolsVNext`) plus the auth round-trip (`authorize`, `getAuthStatus`, `listConnections`, `disconnectConnection`, `listConnectionFields`, `health`). The Composio provider has been rewritten on this surface; the older catalog methods remain as `@deprecated` shims for back-compat.
|
|
43
|
+
|
|
44
|
+
Connections list responses use `page`/`perPage` pagination, matching the rest of the server surface.
|
|
45
|
+
|
|
46
|
+
Both stored agents (`editor.agent.getById(...)`) and code-defined agents with stored overrides (`editor.agent.applyStoredOverrides(...)`) resolve `toolProviders` at request time, merging provider-resolved tools alongside code/registry/MCP/integration tools.
|
|
47
|
+
|
|
48
|
+
Stored agents that don't set `toolProviders` continue to work unchanged. The Studio/Builder UI ships separately.
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Hardened v1 ToolProvider connection routes and SDK forwarding. ([#17248](https://github.com/mastra-ai/mastra/pull/17248))
|
|
53
|
+
|
|
54
|
+
**Fail closed on unknown `connectionId`**
|
|
55
|
+
|
|
56
|
+
`DELETE /tool-providers/:providerId/connections/:connectionId` and
|
|
57
|
+
`GET …/usage` now return `403` when storage is configured but no persisted
|
|
58
|
+
row matches the supplied `connectionId` and the caller isn't an admin.
|
|
59
|
+
Previously these routes fell through to the caller's own `authorId`, which
|
|
60
|
+
let non-admin callers probe (and trigger provider-side `revokeConnection`
|
|
61
|
+
for) IDs that didn't belong to them.
|
|
62
|
+
|
|
63
|
+
**Aligned authorize label validation with stored label rules**
|
|
64
|
+
|
|
65
|
+
`POST /tool-providers/:providerId/authorize` now enforces the same label
|
|
66
|
+
rules the stored `toolProviders` config uses (`min(1)`, `max(32)`,
|
|
67
|
+
`/^[A-Za-z0-9 _-]+$/`). Labels that pass `authorize` are now guaranteed to
|
|
68
|
+
pass downstream stored-agent validation.
|
|
69
|
+
|
|
70
|
+
**SDK forwards `toolkit` on connection-scoped operations**
|
|
71
|
+
|
|
72
|
+
`@mastra/client-js`:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
await client.toolProviders.get('composio').disconnectConnection('ca_xxx', {
|
|
76
|
+
toolkit: 'gmail',
|
|
77
|
+
force: true,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const usage = await client.toolProviders.get('composio').getConnectionUsage('ca_xxx', { toolkit: 'gmail' });
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`disconnectConnection` now forwards `params.toolkit` (previously dropped)
|
|
84
|
+
and `getConnectionUsage` accepts an optional `{ toolkit }` parameter so
|
|
85
|
+
toolkit-scoped connection lookups disambiguate correctly server-side.
|
|
86
|
+
|
|
87
|
+
- Lazy-load `@mastra/core/tool-provider` inside the tool-provider handler so ([#17248](https://github.com/mastra-ai/mastra/pull/17248))
|
|
88
|
+
`@mastra/server` evaluates under any peer-compatible `@mastra/core` (peer floor
|
|
89
|
+
remains `>=1.34.0-0`). The handler no longer imports `SHARED_BUCKET_ID` or
|
|
90
|
+
`UnknownToolProviderError` at module load — `SHARED_BUCKET_ID` is mirrored as a
|
|
91
|
+
local literal (verified in lockstep with core via a regression test), and
|
|
92
|
+
`UnknownToolProviderError` is resolved via a cached `await import(...)` inside
|
|
93
|
+
`resolveProvider` so the real class identity is preserved for `instanceof`.
|
|
94
|
+
|
|
95
|
+
OSS users running `Mastra` without a `MastraEditor` are unaffected: every
|
|
96
|
+
tool-provider route still short-circuits with HTTP 500 "Editor is not
|
|
97
|
+
configured" via `requireEditor(...)` before any core/tool-provider value is
|
|
98
|
+
touched. Users with a `MastraEditor` already pull a compatible core
|
|
99
|
+
transitively through `@mastra/editor`. Tool-provider routes require the new
|
|
100
|
+
core exports at request time only — older cores surface a clear runtime error
|
|
101
|
+
instead of crashing the server at boot.
|
|
102
|
+
|
|
103
|
+
- Improved observability and error isolation in the v1 ToolProvider runtime. ([#17248](https://github.com/mastra-ai/mastra/pull/17248))
|
|
104
|
+
|
|
105
|
+
**Better visibility into connection-scope misconfiguration**
|
|
106
|
+
|
|
107
|
+
When an agent runs with a stored ToolProvider connection whose scope cannot be resolved from the request context, the runtime now logs a one-shot warning and falls back to a shared bucket instead of silently routing every caller to the same OAuth account. Multi-tenant deployments get a clear signal when their identity wiring isn't reaching the runtime.
|
|
108
|
+
|
|
109
|
+
**One bad toolkit no longer disables sibling providers**
|
|
110
|
+
|
|
111
|
+
If a provider returns more connections for a toolkit than its declared capabilities allow, the runtime now logs and skips that toolkit instead of throwing. Other providers and other toolkits on the same agent continue to resolve normally.
|
|
112
|
+
|
|
113
|
+
- Updated dependencies [[`50ed00c`](https://github.com/mastra-ai/mastra/commit/50ed00caa914a85969b33de83f26b48e328ef641), [`9283971`](https://github.com/mastra-ai/mastra/commit/928397157009b4aef4d5fdf3a0a273cb371beb55), [`0bf2d93`](https://github.com/mastra-ai/mastra/commit/0bf2d932d20e2936f2d9abb8c0a86e24fbc97ec6), [`94dfef6`](https://github.com/mastra-ai/mastra/commit/94dfef6e2bf19a88467ea3940afcbce88a433f0f), [`a122f79`](https://github.com/mastra-ai/mastra/commit/a122f79427ae225ec79c7b2ed46278da48d04b17), [`4c02027`](https://github.com/mastra-ai/mastra/commit/4c020277235eaa6b1dc957c90ad0639eef213992), [`6855012`](https://github.com/mastra-ai/mastra/commit/685501247cc4717506f3e89beed03509d63a5370), [`7fef31c`](https://github.com/mastra-ai/mastra/commit/7fef31c0d2a6d362a43a647a8a4f6ab893758a23), [`7fef31c`](https://github.com/mastra-ai/mastra/commit/7fef31c0d2a6d362a43a647a8a4f6ab893758a23)]:
|
|
114
|
+
- @mastra/core@1.38.0-alpha.4
|
|
115
|
+
|
|
3
116
|
## 1.38.0-alpha.3
|
|
4
117
|
|
|
5
118
|
### Minor Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQ5NDXAZ2_cjs = require('./chunk-Q5NDXAZ2.cjs');
|
|
4
4
|
var chunkRZR7PLFW_cjs = require('./chunk-RZR7PLFW.cjs');
|
|
5
5
|
|
|
6
6
|
// src/server/server-adapter/api-schema-manifest.ts
|
|
@@ -34,7 +34,7 @@ function inferResponseShape(responseSchema) {
|
|
|
34
34
|
function isManifestRoute(route) {
|
|
35
35
|
return route.responseType === "json" && !route.deprecated;
|
|
36
36
|
}
|
|
37
|
-
function buildApiSchemaManifest(routes =
|
|
37
|
+
function buildApiSchemaManifest(routes = chunkQ5NDXAZ2_cjs.SERVER_ROUTES) {
|
|
38
38
|
return {
|
|
39
39
|
version: 1,
|
|
40
40
|
routes: routes.filter(isManifestRoute).map((route) => {
|
|
@@ -54,5 +54,5 @@ function buildApiSchemaManifest(routes = chunkN42WTSJL_cjs.SERVER_ROUTES) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
exports.buildApiSchemaManifest = buildApiSchemaManifest;
|
|
57
|
-
//# sourceMappingURL=api-schema-manifest-
|
|
58
|
-
//# sourceMappingURL=api-schema-manifest-
|
|
57
|
+
//# sourceMappingURL=api-schema-manifest-JTQHOGKZ.cjs.map
|
|
58
|
+
//# sourceMappingURL=api-schema-manifest-JTQHOGKZ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"names":["schemaToJsonSchema","SERVER_ROUTES"],"mappings":";;;;;;AA2BA,SAAS,cAAc,MAAA,EAA4D;AACjF,EAAA,OAAO,MAAA,GAASA,oCAAA,CAAmB,MAAM,CAAA,GAAI,MAAA;AAC/C;AAEA,SAAS,aAAa,KAAA,EAAyC;AAC7D,EAAA,OAAO,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAAK,KAAA,GAAwB,MAAA;AAChG;AAEA,SAAS,WAAW,MAAA,EAAkE;AACpF,EAAA,MAAM,OAAO,MAAA,EAAQ,IAAA;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;AAEA,SAAS,gBAAgB,KAAA,EAA6B;AACpD,EAAA,OAAO,KAAA,CAAM,YAAA,KAAiB,MAAA,IAAU,CAAC,KAAA,CAAM,UAAA;AACjD;AAEO,SAAS,sBAAA,CAAuB,SAAiCC,+BAAA,EAAkC;AACxG,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,CAAA;AAAA,IACT,QAAQ,MAAA,CAAO,MAAA,CAAO,eAAe,CAAA,CAAE,IAAI,CAAA,KAAA,KAAS;AAClD,MAAA,MAAM,cAAA,GAAiB,aAAA,CAAc,KAAA,CAAM,cAAc,CAAA;AACzD,MAAA,OAAO;AAAA,QACL,QAAQ,KAAA,CAAM,MAAA;AAAA,QACd,MAAM,KAAA,CAAM,IAAA;AAAA,QACZ,cAAc,KAAA,CAAM,YAAA;AAAA,QACpB,eAAA,EAAiB,aAAA,CAAc,KAAA,CAAM,eAAe,CAAA;AAAA,QACpD,gBAAA,EAAkB,aAAA,CAAc,KAAA,CAAM,gBAAgB,CAAA;AAAA,QACtD,UAAA,EAAY,aAAA,CAAc,KAAA,CAAM,UAAU,CAAA;AAAA,QAC1C,cAAA;AAAA,QACA,aAAA,EAAe,mBAAmB,cAAc;AAAA,OAClD;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"api-schema-manifest-
|
|
1
|
+
{"version":3,"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"names":["schemaToJsonSchema","SERVER_ROUTES"],"mappings":";;;;;;AA2BA,SAAS,cAAc,MAAA,EAA4D;AACjF,EAAA,OAAO,MAAA,GAASA,oCAAA,CAAmB,MAAM,CAAA,GAAI,MAAA;AAC/C;AAEA,SAAS,aAAa,KAAA,EAAyC;AAC7D,EAAA,OAAO,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAAK,KAAA,GAAwB,MAAA;AAChG;AAEA,SAAS,WAAW,MAAA,EAAkE;AACpF,EAAA,MAAM,OAAO,MAAA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A,EAAS;AAC1B;AAEA,SAAS,gBAAgB,KAAA,EAA6B;AACpD,EAAA,OAAO,KAAA,CAAM,YAAA,KAAiB,MAAA,IAAU,CAAC,KAAA,CAAM,UAAA;AACjD;AAEO,SAAS,sBAAA,CAAuB,SAAiCC,+BAAA,EAAkC;AACxG,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,CAAA;AAAA,IACT,QAAQ,MAAA,CAAO,MAAA,CAAO,eAAe,CAAA,CAAE,IAAI,CAAA,KAAA,KAAS;AAClD,MAAA,MAAM,cAAA,GAAiB,aAAA,CAAc,KAAA,CAAM,cAAc,CAAA;AACzD,MAAA,OAAO;AAAA,QACL,QAAQ,KAAA,CAAM,MAAA;AAAA,QACd,MAAM,KAAA,CAAM,IAAA;AAAA,QACZ,cAAc,KAAA,CAAM,YAAA;AAAA,QACpB,eAAA,EAAiB,aAAA,CAAc,KAAA,CAAM,eAAe,CAAA;AAAA,QACpD,gBAAA,EAAkB,aAAA,CAAc,KAAA,CAAM,gBAAgB,CAAA;AAAA,QACtD,UAAA,EAAY,aAAA,CAAc,KAAA,CAAM,UAAU,CAAA;AAAA,QAC1C,cAAA;AAAA,QACA,aAAA,EAAe,mBAAmB,cAAc;AAAA,OAClD;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"api-schema-manifest-JTQHOGKZ.cjs","sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SERVER_ROUTES } from './chunk-
|
|
1
|
+
import { SERVER_ROUTES } from './chunk-EN3XZKLJ.js';
|
|
2
2
|
import { schemaToJsonSchema } from './chunk-YQL3TXSD.js';
|
|
3
3
|
|
|
4
4
|
// src/server/server-adapter/api-schema-manifest.ts
|
|
@@ -52,5 +52,5 @@ function buildApiSchemaManifest(routes = SERVER_ROUTES) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export { buildApiSchemaManifest };
|
|
55
|
-
//# sourceMappingURL=api-schema-manifest-
|
|
56
|
-
//# sourceMappingURL=api-schema-manifest-
|
|
55
|
+
//# sourceMappingURL=api-schema-manifest-MIQHCYPS.js.map
|
|
56
|
+
//# sourceMappingURL=api-schema-manifest-MIQHCYPS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"names":[],"mappings":";;;;AA2BA,SAAS,cAAc,MAAA,EAA4D;AACjF,EAAA,OAAO,MAAA,GAAS,kBAAA,CAAmB,MAAM,CAAA,GAAI,MAAA;AAC/C;AAEA,SAAS,aAAa,KAAA,EAAyC;AAC7D,EAAA,OAAO,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAAK,KAAA,GAAwB,MAAA;AAChG;AAEA,SAAS,WAAW,MAAA,EAAkE;AACpF,EAAA,MAAM,OAAO,MAAA,EAAQ,IAAA;AACrB,EAAA,OAAO,MAAM,OAAA,CAAQ,IAAI,IAAI,IAAA,CAAK,IAAA,CAAK,OAAO,CAAA,GAAI,IAAA;AACpD;AAEA,SAAS,mBAAmB,cAAA,EAAiE;AAC3F,EAAA,IAAI,CAAC,cAAA,EAAgB,OAAO,EAAE,MAAM,SAAA,EAAU;AAE9C,EAAA,MAAM,IAAA,GAAO,WAAW,cAAc,CAAA;AACtC,EAAA,IAAI,IAAA,KAAS,OAAA,EAAS,OAAO,EAAE,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iB,aAAA,CAAc,KAAA,CAAM,cAAc,CAAA;AACzD,MAAA,OAAO;AAAA,QACL,QAAQ,KAAA,CAAM,MAAA;AAAA,QACd,MAAM,KAAA,CAAM,IAAA;AAAA,QACZ,cAAc,KAAA,CAAM,YAAA;AAAA,QACpB,eAAA,EAAiB,aAAA,CAAc,KAAA,CAAM,eAAe,CAAA;AAAA,QACpD,gBAAA,EAAkB,aAAA,CAAc,KAAA,CAAM,gBAAgB,CAAA;AAAA,QACtD,UAAA,EAAY,aAAA,CAAc,KAAA,CAAM,UAAU,CAAA;AAAA,QAC1C,cAAA;AAAA,QACA,aAAA,EAAe,mBAAmB,cAAc;AAAA,OAClD;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"api-schema-manifest-MIQHCYPS.js","sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"]}
|
|
@@ -3,27 +3,12 @@ import { stripFavoriteFields, prepareFavoritesEnrichment, enrichOrStripFavorites
|
|
|
3
3
|
import { isBuilderFeatureEnabled } from './chunk-YX73TS6P.js';
|
|
4
4
|
import { resolveAuthorFilter, getCallerAuthorId, matchesAuthorFilter, assertReadAccess, assertWriteAccess } from './chunk-7U7OWTR2.js';
|
|
5
5
|
import { handleAutoVersioning } from './chunk-33QPJPK4.js';
|
|
6
|
-
import { listStoredAgentsResponseSchema, listStoredAgentsQuerySchema, getStoredAgentResponseSchema, storedAgentIdPathParams, createStoredAgentResponseSchema, createStoredAgentBodySchema, updateStoredAgentResponseSchema, updateStoredAgentBodySchema, deleteStoredAgentResponseSchema, previewInstructionsResponseSchema, previewInstructionsBodySchema } from './chunk-
|
|
6
|
+
import { listStoredAgentsResponseSchema, listStoredAgentsQuerySchema, getStoredAgentResponseSchema, storedAgentIdPathParams, createStoredAgentResponseSchema, createStoredAgentBodySchema, updateStoredAgentResponseSchema, updateStoredAgentBodySchema, deleteStoredAgentResponseSchema, previewInstructionsResponseSchema, previewInstructionsBodySchema } from './chunk-FYCTKP2F.js';
|
|
7
7
|
import { getStoredResourceScope, scopeStoredResourceMetadata, assertStoredResourceScope, toSlug } from './chunk-PLV74XAL.js';
|
|
8
8
|
import { statusQuerySchema } from './chunk-2YY3EMMS.js';
|
|
9
9
|
import { handleError } from './chunk-RJ5ZIUGX.js';
|
|
10
10
|
import { createRoute } from './chunk-YQL3TXSD.js';
|
|
11
11
|
import { HTTPException } from './chunk-6QWQZI4Q.js';
|
|
12
|
-
import { assertModelAllowed, builderToModelPolicy } from '@mastra/core/agent-builder/ee';
|
|
13
|
-
|
|
14
|
-
async function resolveBuilderModelPolicy(editor) {
|
|
15
|
-
if (!editor) return { active: false };
|
|
16
|
-
if (typeof editor.resolveBuilder !== "function") return { active: false };
|
|
17
|
-
if (typeof editor.hasEnabledBuilderConfig === "function" && !editor.hasEnabledBuilderConfig()) {
|
|
18
|
-
return { active: false };
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
const builder = await editor.resolveBuilder();
|
|
22
|
-
return builderToModelPolicy(builder);
|
|
23
|
-
} catch {
|
|
24
|
-
return { active: false };
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
12
|
|
|
28
13
|
// src/server/handlers/stored-agents.ts
|
|
29
14
|
async function resolveBrowserField(browser, mastra) {
|
|
@@ -53,6 +38,7 @@ var AGENT_SNAPSHOT_CONFIG_FIELDS = [
|
|
|
53
38
|
"workflows",
|
|
54
39
|
"agents",
|
|
55
40
|
"integrationTools",
|
|
41
|
+
"toolProviders",
|
|
56
42
|
"inputProcessors",
|
|
57
43
|
"outputProcessors",
|
|
58
44
|
"memory",
|
|
@@ -220,6 +206,7 @@ var CREATE_STORED_AGENT_ROUTE = createRoute({
|
|
|
220
206
|
workflows,
|
|
221
207
|
agents,
|
|
222
208
|
integrationTools,
|
|
209
|
+
toolProviders,
|
|
223
210
|
mcpClients,
|
|
224
211
|
inputProcessors,
|
|
225
212
|
outputProcessors,
|
|
@@ -252,12 +239,6 @@ var CREATE_STORED_AGENT_ROUTE = createRoute({
|
|
|
252
239
|
const authorId = getCallerAuthorId(requestContext) ?? void 0;
|
|
253
240
|
const visibility = authorId ? bodyVisibility ?? "private" : "public";
|
|
254
241
|
validateMetadataAvatarUrl(metadata);
|
|
255
|
-
if (model !== void 0) {
|
|
256
|
-
const policy = await resolveBuilderModelPolicy(mastra.getEditor?.());
|
|
257
|
-
if (policy.active) {
|
|
258
|
-
assertModelAllowed(policy.allowed, model);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
242
|
const resolvedBrowser = await resolveBrowserField(browser, mastra);
|
|
262
243
|
const input = {
|
|
263
244
|
id,
|
|
@@ -273,6 +254,7 @@ var CREATE_STORED_AGENT_ROUTE = createRoute({
|
|
|
273
254
|
workflows,
|
|
274
255
|
agents,
|
|
275
256
|
integrationTools,
|
|
257
|
+
toolProviders,
|
|
276
258
|
mcpClients,
|
|
277
259
|
inputProcessors,
|
|
278
260
|
outputProcessors,
|
|
@@ -338,6 +320,7 @@ var UPDATE_STORED_AGENT_ROUTE = createRoute({
|
|
|
338
320
|
workflows,
|
|
339
321
|
agents,
|
|
340
322
|
integrationTools,
|
|
323
|
+
toolProviders,
|
|
341
324
|
mcpClients,
|
|
342
325
|
inputProcessors,
|
|
343
326
|
outputProcessors,
|
|
@@ -375,12 +358,6 @@ var UPDATE_STORED_AGENT_ROUTE = createRoute({
|
|
|
375
358
|
validateMetadataAvatarUrl(metadata);
|
|
376
359
|
const callerAuthorId = getCallerAuthorId(requestContext) ?? void 0;
|
|
377
360
|
const resolvedVisibility = callerAuthorId ? visibility : visibility != null ? "public" : void 0;
|
|
378
|
-
if (model !== void 0) {
|
|
379
|
-
const policy = await resolveBuilderModelPolicy(mastra.getEditor?.());
|
|
380
|
-
if (policy.active) {
|
|
381
|
-
assertModelAllowed(policy.allowed, model);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
361
|
const resolvedBrowser = await resolveBrowserField(browser, mastra);
|
|
385
362
|
const scopedMetadata = metadata !== void 0 ? scopeStoredResourceMetadata({ ...existing.metadata ?? {}, ...metadata }, scope) : void 0;
|
|
386
363
|
const updatedAgent = await agentsStore.update({
|
|
@@ -397,6 +374,7 @@ var UPDATE_STORED_AGENT_ROUTE = createRoute({
|
|
|
397
374
|
workflows,
|
|
398
375
|
agents,
|
|
399
376
|
integrationTools,
|
|
377
|
+
toolProviders,
|
|
400
378
|
mcpClients,
|
|
401
379
|
inputProcessors,
|
|
402
380
|
outputProcessors,
|
|
@@ -417,6 +395,7 @@ var UPDATE_STORED_AGENT_ROUTE = createRoute({
|
|
|
417
395
|
workflows,
|
|
418
396
|
agents,
|
|
419
397
|
integrationTools,
|
|
398
|
+
toolProviders,
|
|
420
399
|
mcpClients,
|
|
421
400
|
inputProcessors,
|
|
422
401
|
outputProcessors,
|
|
@@ -536,5 +515,5 @@ var PREVIEW_INSTRUCTIONS_ROUTE = createRoute({
|
|
|
536
515
|
});
|
|
537
516
|
|
|
538
517
|
export { CREATE_STORED_AGENT_ROUTE, DELETE_STORED_AGENT_ROUTE, GET_STORED_AGENT_ROUTE, LIST_STORED_AGENTS_ROUTE, PREVIEW_INSTRUCTIONS_ROUTE, UPDATE_STORED_AGENT_ROUTE };
|
|
539
|
-
//# sourceMappingURL=chunk-
|
|
540
|
-
//# sourceMappingURL=chunk-
|
|
518
|
+
//# sourceMappingURL=chunk-234HJ3C3.js.map
|
|
519
|
+
//# sourceMappingURL=chunk-234HJ3C3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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AAA,IAAI,CAAC,MAAA,EAAQ;AACX,QAAA,MAAM,IAAI,aAAA,CAAc,GAAA,EAAK,EAAE,OAAA,EAAS,4BAA4B,CAAA;AAAA,MACtE;AAEA,MAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,MAAA,CAAO,QAAQ,MAAA,EAAQ,OAAA,IAAW,EAAE,CAAA;AAEhE,MAAA,OAAO,EAAE,MAAA,EAAO;AAAA,IAClB,SAAS,KAAA,EAAO;AACd,MAAA,OAAO,WAAA,CAAY,OAAO,+BAA+B,CAAA;AAAA,IAC3D;AAAA,EACF;AACF,CAAC","file":"chunk-234HJ3C3.js","sourcesContent":["import type { StorageCreateAgentInput, StorageUpdateAgentInput } from '@mastra/core/storage';\nimport type { z } from 'zod/v4';\n\nimport { HTTPException } from '../http-exception';\nimport {\n storedAgentIdPathParams,\n statusQuerySchema,\n listStoredAgentsQuerySchema,\n createStoredAgentBodySchema,\n updateStoredAgentBodySchema,\n listStoredAgentsResponseSchema,\n getStoredAgentResponseSchema,\n createStoredAgentResponseSchema,\n updateStoredAgentResponseSchema,\n deleteStoredAgentResponseSchema,\n previewInstructionsBodySchema,\n previewInstructionsResponseSchema,\n} from '../schemas/stored-agents';\nimport type { ServerRoute, RouteSchemas, InferParams } from '../server-adapter/routes';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope, scopeStoredResourceMetadata, toSlug } from '../utils';\n\nimport {\n assertReadAccess,\n assertWriteAccess,\n getCallerAuthorId,\n matchesAuthorFilter,\n resolveAuthorFilter,\n} from './authorship';\nimport { isBuilderFeatureEnabled } from './editor-builder';\nimport { handleError } from './error';\nimport { enrichOrStripFavorites, prepareFavoritesEnrichment, stripFavoriteFields } from './favorites-enrichment';\nimport { validateMetadataAvatarUrl } from './validate-avatar';\nimport { handleAutoVersioning } from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * Resolve a `browser` field that may be a boolean shorthand from the UI.\n * - `true` → look up the admin's builder default browser config\n * - `false` → `null` (explicit clear)\n * - object/null/undefined → pass through unchanged\n */\nasync function resolveBrowserField(browser: unknown, mastra: { getEditor?: () => unknown }): Promise<unknown> {\n if (browser === true) {\n const editor = mastra.getEditor?.() as any;\n const builder = await editor?.resolveBuilder?.();\n const defaultBrowser = builder?.getConfiguration?.()?.agent?.browser;\n if (!defaultBrowser) {\n console.warn(\n '[mastra:server] Browser enabled (browser: true) but no default browser config found ' +\n 'in builder configuration. The agent will be created/updated without browser access. ' +\n 'Set `editor.builder.configuration.agent.browser` to fix this.',\n );\n }\n return defaultBrowser ?? undefined;\n }\n if (browser === false) {\n return null;\n }\n return browser;\n}\n\nconst AGENT_SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'instructions',\n 'model',\n 'tools',\n 'defaultOptions',\n 'workflows',\n 'agents',\n 'integrationTools',\n 'toolProviders',\n 'inputProcessors',\n 'outputProcessors',\n 'memory',\n 'scorers',\n 'requestContextSchema',\n 'mcpClients',\n 'skills',\n 'workspace',\n 'browser',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/agents - List all stored agents\n */\nexport const LIST_STORED_AGENTS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents',\n responseType: 'json',\n queryParamSchema: listStoredAgentsQuerySchema,\n responseSchema: listStoredAgentsResponseSchema,\n summary: 'List stored agents',\n description: 'Returns a paginated list of all agents stored in the database',\n tags: ['Stored Agents'],\n requiresAuth: true,\n handler: async ({\n mastra,\n requestContext,\n page,\n perPage,\n orderBy,\n status,\n authorId,\n visibility,\n metadata,\n favoritedOnly,\n pinFavoritedFor,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Resolve the visibility scope for this caller. Non-owner queries for\n // another author return only that author's public rows; default lists\n // return the caller's rows plus legacy unowned records.\n const filter = resolveAuthorFilter({\n requestContext,\n resource: 'stored-agents',\n queryAuthorId: authorId,\n queryVisibility: visibility === 'public' ? 'public' : undefined,\n });\n\n const scope = await getStoredResourceScope(mastra, requestContext);\n const scopedMetadata = scopeStoredResourceMetadata(metadata, scope);\n\n const callerId = getCallerAuthorId(requestContext);\n const favoritesEnabled = await isBuilderFeatureEnabled(mastra, 'favorites');\n const honoredStarredOnly = favoritesEnabled && favoritedOnly === true;\n const favoriteSubjectId = pinFavoritedFor ?? callerId;\n\n // `?favoritedOnly=true`: fetch caller's favorited IDs, then refilter + recompute total.\n if (honoredStarredOnly) {\n const effectivePerPage: number = perPage ?? 100;\n if (!favoriteSubjectId) {\n return { agents: [], total: 0, page, perPage: effectivePerPage, hasMore: false };\n }\n const favoritesStore = await storage.getStore('favorites');\n if (!favoritesStore) {\n throw new HTTPException(500, { message: 'Favorites storage domain is not available' });\n }\n const starredIds = await favoritesStore.listFavoritedIds({ userId: favoriteSubjectId, entityType: 'agent' });\n if (starredIds.length === 0) {\n return { agents: [], total: 0, page, perPage: effectivePerPage, hasMore: false };\n }\n const allMatching = await agentsStore.listResolved({\n perPage: false,\n orderBy,\n status,\n authorId: filter.kind === 'exact' ? filter.authorId : undefined,\n metadata: scopedMetadata,\n entityIds: starredIds,\n });\n const visible = allMatching.agents.filter(record => matchesAuthorFilter(record, filter));\n const total = visible.length;\n const startIdx = effectivePerPage === 0 ? 0 : page * effectivePerPage;\n const endIdx = effectivePerPage === 0 ? 0 : startIdx + effectivePerPage;\n const sliced = effectivePerPage === 0 ? [] : visible.slice(startIdx, endIdx);\n const annotated = sliced.map(record => ({ ...record, isFavorited: true }));\n const hasMore = effectivePerPage > 0 && endIdx < total;\n return { agents: annotated, total, page, perPage: effectivePerPage, hasMore };\n }\n\n const result = await agentsStore.listResolved({\n page,\n perPage,\n orderBy,\n status,\n authorId: filter.kind === 'exact' ? filter.authorId : undefined,\n metadata: scopedMetadata,\n });\n\n // Post-filter to enforce ownership + visibility rules across all backends.\n // Storage adapters can only do an equality filter on authorId, so we apply\n // the ownedOrPublic / publicOnly logic here.\n // Note: `total` is left as the storage-reported count to keep pagination\n // math working. For `unrestricted` / `exact` filters nothing is removed.\n // For `ownedOrPublic` / `publicOnly`, downstream UIs should treat the\n // filter as a view over the caller's scope — an approximation is OK.\n const visibleAgents = result.agents.filter(record => matchesAuthorFilter(record, filter));\n\n if (!favoritesEnabled) {\n return { ...result, agents: visibleAgents.map(stripFavoriteFields) };\n }\n\n const enrichment = await prepareFavoritesEnrichment(\n mastra,\n requestContext,\n 'agent',\n visibleAgents.map(a => a.id),\n );\n const annotated = enrichment\n ? visibleAgents.map(record => ({ ...record, isFavorited: enrichment.starredIds.has(record.id) }))\n : visibleAgents.map(stripFavoriteFields);\n\n return { ...result, agents: annotated };\n } catch (error) {\n return handleError(error, 'Error listing stored agents');\n }\n },\n});\n\n/**\n * GET /stored/agents/:storedAgentId - Get a stored agent by ID\n */\nexport const GET_STORED_AGENT_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:storedAgentId',\n responseType: 'json',\n pathParamSchema: storedAgentIdPathParams,\n queryParamSchema: statusQuerySchema,\n responseSchema: getStoredAgentResponseSchema,\n summary: 'Get stored agent by ID',\n description:\n 'Returns a specific agent from storage by its unique identifier. Use ?status=draft to resolve with the latest (draft) version, or ?status=published (default) for the active published version.',\n tags: ['Stored Agents'],\n requiresAuth: true,\n handler: async ({ mastra, requestContext, storedAgentId, status }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n const agent = await agentsStore.getByIdResolved(storedAgentId, { status });\n\n if (!agent) {\n throw new HTTPException(404, { message: `Stored agent with id ${storedAgentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Throws 404 if the caller isn't the owner, admin, `stored-agents:read[:<id>]`\n // holder, and the record isn't public/legacy-unowned.\n assertReadAccess({ requestContext, resource: 'stored-agents', resourceId: storedAgentId, record: agent });\n\n return enrichOrStripFavorites(mastra, requestContext, 'agent', agent);\n } catch (error) {\n return handleError(error, 'Error getting stored agent');\n }\n },\n});\n\n/**\n * POST /stored/agents - Create a new stored agent\n */\nexport const CREATE_STORED_AGENT_ROUTE: ServerRoute<\n InferParams<undefined, undefined, typeof createStoredAgentBodySchema>,\n z.infer<typeof createStoredAgentResponseSchema>,\n 'json',\n RouteSchemas<undefined, undefined, typeof createStoredAgentBodySchema, typeof createStoredAgentResponseSchema>,\n 'POST',\n '/stored/agents'\n> = createRoute({\n method: 'POST',\n path: '/stored/agents',\n responseType: 'json',\n bodySchema: createStoredAgentBodySchema,\n responseSchema: createStoredAgentResponseSchema,\n summary: 'Create stored agent',\n description: 'Creates a new agent in storage with the provided configuration',\n tags: ['Stored Agents'],\n requiresAuth: true,\n handler: async ({\n mastra,\n requestContext,\n id: providedId,\n metadata,\n visibility: bodyVisibility,\n name,\n description,\n instructions,\n model,\n tools,\n defaultOptions,\n workflows,\n agents,\n integrationTools,\n toolProviders,\n mcpClients,\n inputProcessors,\n outputProcessors,\n memory,\n scorers,\n skills,\n workspace,\n browser,\n requestContextSchema,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Derive ID from name if not explicitly provided\n const id = providedId || toSlug(name);\n\n if (!id) {\n throw new HTTPException(400, {\n message: 'Could not derive agent ID from name. Please provide an explicit id.',\n });\n }\n\n // Check if agent with this ID already exists\n const existing = await agentsStore.getById(id);\n if (existing) {\n throw new HTTPException(409, { message: `Agent with id ${id} already exists` });\n }\n\n // Force authorId from the authenticated caller; ignore any body-provided value.\n // No owner = always public (no auth / no user context).\n // With an owner, respect the client's choice, defaulting to 'private'.\n const authorId = getCallerAuthorId(requestContext) ?? undefined;\n const visibility = authorId ? (bodyVisibility ?? 'private') : 'public';\n\n // Reject oversized avatar images before writing to storage.\n validateMetadataAvatarUrl(metadata);\n\n // Model policy enforcement is intentionally not done on save: each UI\n // surface gates its own model picker via ModelPolicyProvider, and the\n // policy is surface-scoped (builder vs editor). Re-introducing a single\n // server-side check here would either over-enforce on the editor or\n // under-enforce on the builder until per-surface enforcement lands.\n\n const resolvedBrowser = await resolveBrowserField(browser, mastra);\n\n const input = {\n id,\n authorId,\n visibility,\n metadata: scopeStoredResourceMetadata(metadata, await getStoredResourceScope(mastra, requestContext)),\n name,\n description,\n instructions,\n model,\n tools,\n defaultOptions,\n workflows,\n agents,\n integrationTools,\n toolProviders,\n mcpClients,\n inputProcessors,\n outputProcessors,\n memory,\n scorers,\n skills,\n workspace,\n browser: resolvedBrowser,\n requestContextSchema,\n } as StorageCreateAgentInput;\n\n // Use editor.agent.create() when available to apply builder defaults\n const editor = mastra.getEditor?.();\n if (editor) {\n await editor.agent.create(input);\n } else {\n // Fallback to direct storage create\n await agentsStore.create({ agent: input });\n }\n\n // Publish the initial version so the agent is immediately usable.\n // Without this, the thin record stays as status='draft' with activeVersionId=null,\n // which makes the agent unreachable via status='published' resolution.\n const { versions } = await agentsStore.listVersions({ agentId: id, perPage: 1 });\n const initialVersion = versions[0];\n if (initialVersion) {\n await agentsStore.update({\n id,\n activeVersionId: initialVersion.id,\n status: 'published',\n });\n editor?.agent.clearCache(id);\n }\n\n // Return the resolved agent (thin record + version config) using the newly published version\n const resolved = await agentsStore.getByIdResolved(id, { status: 'published' });\n if (!resolved) {\n throw new HTTPException(500, { message: 'Failed to resolve created agent' });\n }\n\n return enrichOrStripFavorites(mastra, requestContext, 'agent', resolved);\n } catch (error) {\n return handleError(error, 'Error creating stored agent');\n }\n },\n});\n\n/**\n * PATCH /stored/agents/:storedAgentId - Update a stored agent\n */\nexport const UPDATE_STORED_AGENT_ROUTE: ServerRoute<\n InferParams<typeof storedAgentIdPathParams, undefined, typeof updateStoredAgentBodySchema>,\n z.infer<typeof updateStoredAgentResponseSchema>,\n 'json',\n RouteSchemas<\n typeof storedAgentIdPathParams,\n undefined,\n typeof updateStoredAgentBodySchema,\n typeof updateStoredAgentResponseSchema\n >,\n 'PATCH',\n '/stored/agents/:storedAgentId'\n> = createRoute({\n method: 'PATCH',\n path: '/stored/agents/:storedAgentId',\n responseType: 'json',\n pathParamSchema: storedAgentIdPathParams,\n bodySchema: updateStoredAgentBodySchema,\n responseSchema: updateStoredAgentResponseSchema,\n summary: 'Update stored agent',\n description: 'Updates an existing agent in storage with the provided fields',\n tags: ['Stored Agents'],\n requiresAuth: true,\n handler: async ({\n mastra,\n requestContext,\n storedAgentId,\n // Metadata-level fields\n authorId,\n metadata,\n visibility,\n // Config fields (snapshot-level)\n name,\n description,\n instructions,\n model,\n tools,\n defaultOptions,\n workflows,\n agents,\n integrationTools,\n toolProviders,\n mcpClients,\n inputProcessors,\n outputProcessors,\n memory,\n scorers,\n skills,\n workspace,\n browser,\n requestContextSchema,\n // Version metadata\n changeMessage,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Check if agent exists\n const existing = await agentsStore.getById(storedAgentId);\n if (!existing) {\n throw new HTTPException(404, { message: `Stored agent with id ${storedAgentId} not found` });\n }\n const scope = await getStoredResourceScope(mastra, requestContext);\n assertStoredResourceScope(existing, scope);\n\n // Throws 404 if the caller isn't the owner, admin, or `agents:edit[:<id>]` holder.\n assertWriteAccess({\n requestContext,\n resource: 'stored-agents',\n resourceId: storedAgentId,\n action: 'edit',\n record: existing,\n });\n\n // Reject oversized avatar images before writing to storage.\n validateMetadataAvatarUrl(metadata);\n\n // No owner = always public, regardless of what the client sent.\n const callerAuthorId = getCallerAuthorId(requestContext) ?? undefined;\n const resolvedVisibility = callerAuthorId ? visibility : visibility != null ? 'public' : undefined;\n\n // Model policy enforcement is intentionally not done on save: each UI\n // surface gates its own model picker via ModelPolicyProvider, and the\n // policy is surface-scoped (builder vs editor). Re-introducing a single\n // server-side check here would either over-enforce on the editor or\n // under-enforce on the builder until per-surface enforcement lands.\n\n // Resolve boolean browser shorthand from the UI\n const resolvedBrowser = await resolveBrowserField(browser, mastra);\n\n const scopedMetadata =\n metadata !== undefined\n ? scopeStoredResourceMetadata({ ...(existing.metadata ?? {}), ...metadata }, scope)\n : undefined;\n\n // Update the agent with both metadata-level and config-level fields\n // The storage layer handles separating these into agent-record updates vs new-version creation\n // Cast needed because Zod's passthrough() output types don't exactly match the handwritten TS interfaces\n const updatedAgent = await agentsStore.update({\n id: storedAgentId,\n authorId,\n ...(scopedMetadata !== undefined ? { metadata: scopedMetadata } : {}),\n visibility: resolvedVisibility,\n name,\n description,\n instructions,\n model,\n tools,\n defaultOptions,\n workflows,\n agents,\n integrationTools,\n toolProviders,\n mcpClients,\n inputProcessors,\n outputProcessors,\n memory,\n scorers,\n skills,\n workspace,\n browser: resolvedBrowser,\n requestContextSchema,\n } as StorageUpdateAgentInput);\n\n // Build the snapshot config for auto-versioning comparison\n const configFields = {\n name,\n description,\n instructions,\n model,\n tools,\n defaultOptions,\n workflows,\n agents,\n integrationTools,\n toolProviders,\n mcpClients,\n inputProcessors,\n outputProcessors,\n memory,\n scorers,\n skills,\n workspace,\n browser: resolvedBrowser,\n requestContextSchema,\n };\n\n // Filter out undefined values to get only the config fields that were provided\n const providedConfigFields = Object.fromEntries(Object.entries(configFields).filter(([_, v]) => v !== undefined));\n\n // Handle auto-versioning with retry logic for race conditions\n // This creates a new version if there are meaningful config changes.\n const autoVersionResult = await handleAutoVersioning(\n agentsStore as unknown as VersionedStoreInterface,\n storedAgentId,\n 'agentId',\n AGENT_SNAPSHOT_CONFIG_FIELDS,\n existing,\n updatedAgent,\n providedConfigFields,\n changeMessage ? { changeMessage } : undefined,\n );\n\n if (!autoVersionResult) {\n throw new Error('handleAutoVersioning returned undefined');\n }\n\n // Auto-publish: activate the latest version so the update is immediately\n // visible in list views. The Agent Builder UI has no separate \"Publish\"\n // button, so without this every edit after creation would create orphaned\n // draft versions that never surface in the list.\n // When a proper publish flow ships, this block can be removed.\n if (autoVersionResult.versionCreated) {\n const { versions } = await agentsStore.listVersions({ agentId: storedAgentId, perPage: 1 });\n const latestVersion = versions[0];\n if (latestVersion) {\n await agentsStore.update({\n id: storedAgentId,\n activeVersionId: latestVersion.id,\n });\n }\n }\n\n // Clear the cached agent instance so the next request gets the updated config\n const editor = mastra.getEditor();\n if (editor) {\n editor.agent.clearCache(storedAgentId);\n }\n\n // Return the resolved agent with the latest version\n const resolved = await agentsStore.getByIdResolved(storedAgentId, { status: 'draft' });\n if (!resolved) {\n throw new HTTPException(500, { message: 'Failed to resolve updated agent' });\n }\n\n return enrichOrStripFavorites(mastra, requestContext, 'agent', resolved);\n } catch (error) {\n return handleError(error, 'Error updating stored agent');\n }\n },\n});\n\n/**\n * DELETE /stored/agents/:storedAgentId - Delete a stored agent\n */\nexport const DELETE_STORED_AGENT_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/agents/:storedAgentId',\n responseType: 'json',\n pathParamSchema: storedAgentIdPathParams,\n responseSchema: deleteStoredAgentResponseSchema,\n summary: 'Delete stored agent',\n description: 'Deletes an agent from storage by its unique identifier',\n tags: ['Stored Agents'],\n requiresAuth: true,\n handler: async ({ mastra, requestContext, storedAgentId }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Check if agent exists\n const existing = await agentsStore.getById(storedAgentId);\n if (!existing) {\n throw new HTTPException(404, { message: `Stored agent with id ${storedAgentId} not found` });\n }\n assertStoredResourceScope(existing, await getStoredResourceScope(mastra, requestContext));\n\n // Throws 404 if the caller isn't the owner, admin, or `agents:delete[:<id>]` holder.\n assertWriteAccess({\n requestContext,\n resource: 'stored-agents',\n resourceId: storedAgentId,\n action: 'delete',\n record: existing,\n });\n\n await agentsStore.delete(storedAgentId);\n\n // Cascade: drop any favorite rows referencing this agent so they don't\n // resurrect if the same id is reused. Failure must not abort the delete.\n try {\n const favoritesStore = await storage.getStore('favorites');\n await favoritesStore?.deleteFavoritesForEntity({ entityType: 'agent', entityId: storedAgentId });\n } catch (cascadeError) {\n mastra\n .getLogger?.()\n ?.warn?.('Failed to cascade-delete favorites for agent', { storedAgentId, error: cascadeError });\n }\n\n // Clear the cached agent instance\n mastra.getEditor()?.agent.clearCache(storedAgentId);\n\n return { success: true, message: `Agent ${storedAgentId} deleted successfully` };\n } catch (error) {\n return handleError(error, 'Error deleting stored agent');\n }\n },\n});\n\n/**\n * POST /stored/agents/preview-instructions - Preview resolved instructions\n */\nexport const PREVIEW_INSTRUCTIONS_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/preview-instructions',\n responseType: 'json',\n bodySchema: previewInstructionsBodySchema,\n responseSchema: previewInstructionsResponseSchema,\n summary: 'Preview resolved instructions',\n description:\n 'Resolves an array of instruction blocks against a request context, evaluating rules, fetching prompt block references, and rendering template variables. Returns the final concatenated instruction string.',\n tags: ['Stored Agents'],\n requiresAuth: true,\n handler: async ({ mastra, blocks, context }) => {\n try {\n const editor = mastra.getEditor();\n if (!editor) {\n throw new HTTPException(500, { message: 'Editor is not configured' });\n }\n\n const result = await editor.prompt.preview(blocks, context ?? {});\n\n return { result };\n } catch (error) {\n return handleError(error, 'Error previewing instructions');\n }\n },\n});\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createListVersionsResponseSchema, createCompareVersionsResponseSchema } from './chunk-3OQMTFIV.js';
|
|
2
|
-
import { toolConfigSchema, instructionsSchema, conditionalFieldSchema, scorerConfigSchema, serializedMemoryConfigSchema, storedProcessorGraphSchema, toolsConfigSchema, modelConfigSchema } from './chunk-
|
|
2
|
+
import { toolConfigSchema, instructionsSchema, conditionalFieldSchema, scorerConfigSchema, serializedMemoryConfigSchema, storedProcessorGraphSchema, toolsConfigSchema, modelConfigSchema } from './chunk-FYCTKP2F.js';
|
|
3
3
|
import { defaultOptionsSchema } from './chunk-TKP6FJQ3.js';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
@@ -57,5 +57,5 @@ var restoreVersionResponseSchema = agentVersionSchema.describe(
|
|
|
57
57
|
var compareVersionsResponseSchema = createCompareVersionsResponseSchema(agentVersionSchema);
|
|
58
58
|
|
|
59
59
|
export { agentVersionPathParams, agentVersionSchema, compareVersionsResponseSchema, createVersionResponseSchema, getVersionResponseSchema, listVersionsResponseSchema, restoreVersionResponseSchema, versionIdPathParams };
|
|
60
|
-
//# sourceMappingURL=chunk-
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-2DTOYQQ4.js.map
|
|
61
|
+
//# sourceMappingURL=chunk-2DTOYQQ4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/schemas/agent-versions.ts"],"names":[],"mappings":";;;;;AAuBA,IAAM,0BAAA,GAA6B,EAAE,MAAA,CAAO;AAAA,EAC1C,KAAA,EAAO,EAAE,MAAA,CAAO,CAAA,CAAE,QAAO,EAAG,gBAAgB,EAAE,QAAA;AAChD,CAAC,CAAA;AAmBM,IAAM,sBAAA,GAAyB,EAAE,MAAA,CAAO;AAAA,EAC7C,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,wCAAwC;AACvE,CAAC;AAKM,IAAM,mBAAA,GAAsB,EAAE,MAAA,CAAO;AAAA,EAC1C,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,wCAAwC,CAAA;AA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AS,+BAA+B;AAAA,GACpE;AACH;AAKO,IAAM,+BAA+B,kBAAA,CAAmB,QAAA;AAAA,EAC7D;AACF;AAKO,IAAM,6BAAA,GAET,oCAAoC,kBAAkB","file":"chunk-2DTOYQQ4.js","sourcesContent":["import { z } from 'zod/v4';\nimport { defaultOptionsSchema } from './default-options';\nimport { serializedMemoryConfigSchema } from './memory-config';\nimport {\n scorerConfigSchema,\n instructionsSchema,\n conditionalFieldSchema,\n modelConfigSchema,\n toolConfigSchema,\n toolsConfigSchema,\n storedProcessorGraphSchema,\n} from './stored-agents';\nimport {\n listVersionsQuerySchema,\n compareVersionsQuerySchema,\n createVersionBodySchema,\n activateVersionResponseSchema,\n deleteVersionResponseSchema,\n versionDiffEntrySchema,\n createListVersionsResponseSchema,\n createCompareVersionsResponseSchema,\n} from './version-common';\n\nconst mcpClientToolsConfigSchema = z.object({\n tools: z.record(z.string(), toolConfigSchema).optional(),\n});\n\n// Re-export shared schemas for backwards compat\nexport {\n listVersionsQuerySchema,\n compareVersionsQuerySchema,\n createVersionBodySchema,\n activateVersionResponseSchema,\n deleteVersionResponseSchema,\n versionDiffEntrySchema,\n};\n\n// ============================================================================\n// Path Parameter Schemas\n// ============================================================================\n\n/**\n * Path parameters for agent version routes\n */\nexport const agentVersionPathParams = z.object({\n agentId: z.string().describe('Unique identifier for the stored agent'),\n});\n\n/**\n * Path parameters for specific version routes\n */\nexport const versionIdPathParams = z.object({\n agentId: z.string().describe('Unique identifier for the stored agent'),\n versionId: z.string().describe('Unique identifier for the version (UUID)'),\n});\n\n// ============================================================================\n// Response Schemas\n// ============================================================================\n\n/**\n * Agent version object schema (full response)\n * Config fields are top-level on the version (no nested snapshot object).\n * Extends StorageAgentSnapshotType fields.\n */\nexport const agentVersionSchema = z.object({\n id: z.string().describe('Unique identifier for the version (UUID)'),\n agentId: z.string().describe('ID of the agent this version belongs to'),\n versionNumber: z.number().describe('Sequential version number (1, 2, 3, ...)'),\n // Top-level config fields (from StorageAgentSnapshotType)\n name: z.string().describe('Name of the agent'),\n description: z.string().optional().describe('Description of the agent'),\n instructions: instructionsSchema,\n model: conditionalFieldSchema(modelConfigSchema).describe(\n 'Model configuration — static value or array of conditional variants',\n ),\n tools: conditionalFieldSchema(toolsConfigSchema)\n .optional()\n .describe('Tool keys mapped to per-tool config — static or conditional'),\n defaultOptions: conditionalFieldSchema(defaultOptionsSchema)\n .optional()\n .describe('Default options for generate/stream calls — static or conditional'),\n workflows: conditionalFieldSchema(z.record(z.string(), toolConfigSchema))\n .optional()\n .describe('Workflow keys with optional per-workflow config — static or conditional'),\n agents: conditionalFieldSchema(z.record(z.string(), toolConfigSchema))\n .optional()\n .describe('Agent keys with optional per-agent config — static or conditional'),\n integrationTools: conditionalFieldSchema(z.record(z.string(), mcpClientToolsConfigSchema))\n .optional()\n .describe('Map of tool provider IDs to their tool configurations — static or conditional'),\n mcpClients: conditionalFieldSchema(z.record(z.string(), mcpClientToolsConfigSchema))\n .optional()\n .describe('Map of stored MCP client IDs to their tool configurations — static or conditional'),\n inputProcessors: conditionalFieldSchema(storedProcessorGraphSchema)\n .optional()\n .describe('Input processor graph — static or conditional'),\n outputProcessors: conditionalFieldSchema(storedProcessorGraphSchema)\n .optional()\n .describe('Output processor graph — static or conditional'),\n memory: conditionalFieldSchema(serializedMemoryConfigSchema)\n .optional()\n .describe('Memory configuration — static or conditional'),\n scorers: conditionalFieldSchema(z.record(z.string(), scorerConfigSchema))\n .optional()\n .describe('Scorer keys with optional sampling config — static or conditional'),\n requestContextSchema: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('JSON Schema defining valid request context variables'),\n // Version metadata fields\n changedFields: z.array(z.string()).optional().describe('Array of field names that changed from the previous version'),\n changeMessage: z.string().optional().describe('Optional message describing the changes'),\n createdAt: z.coerce.date().describe('When this version was created'),\n});\n\n/**\n * Response for GET /stored/agents/:agentId/versions\n */\nexport const listVersionsResponseSchema = createListVersionsResponseSchema(agentVersionSchema);\n\n/**\n * Response for GET /stored/agents/:agentId/versions/:versionId\n */\nexport const getVersionResponseSchema = agentVersionSchema;\n\n/**\n * Response for POST /stored/agents/:agentId/versions\n */\nexport const createVersionResponseSchema = agentVersionSchema.partial().merge(\n z.object({\n // These fields are always present in a version response\n id: z.string().describe('Unique identifier for the version (UUID)'),\n agentId: z.string().describe('ID of the agent this version belongs to'),\n versionNumber: z.number().describe('Sequential version number (1, 2, 3, ...)'),\n createdAt: z.coerce.date().describe('When this version was created'),\n }),\n);\n\n/**\n * Response for POST /stored/agents/:agentId/versions/:versionId/restore\n */\nexport const restoreVersionResponseSchema = agentVersionSchema.describe(\n 'The newly created version from the restored configuration',\n);\n\n/**\n * Response for GET /stored/agents/:agentId/versions/compare\n */\nexport const compareVersionsResponseSchema: ReturnType<\n typeof createCompareVersionsResponseSchema<typeof agentVersionSchema>\n> = createCompareVersionsResponseSchema(agentVersionSchema);\n"]}
|
|
@@ -13,7 +13,7 @@ var GET_API_SCHEMA_ROUTE = createRoute({
|
|
|
13
13
|
tags: ["System"],
|
|
14
14
|
requiresAuth: true,
|
|
15
15
|
handler: async () => {
|
|
16
|
-
const { buildApiSchemaManifest } = await import('./api-schema-manifest-
|
|
16
|
+
const { buildApiSchemaManifest } = await import('./api-schema-manifest-MIQHCYPS.js');
|
|
17
17
|
return buildApiSchemaManifest();
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -60,5 +60,5 @@ var GET_SYSTEM_PACKAGES_ROUTE = createRoute({
|
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
export { GET_API_SCHEMA_ROUTE, GET_SYSTEM_PACKAGES_ROUTE };
|
|
63
|
-
//# sourceMappingURL=chunk-
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
63
|
+
//# sourceMappingURL=chunk-5SM6OBSO.js.map
|
|
64
|
+
//# sourceMappingURL=chunk-5SM6OBSO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/handlers/system.ts"],"names":[],"mappings":";;;;;AAOO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,IAC3D;AAAA,EACF;AACF,CAAC","file":"chunk-5SM6OBSO.js","sourcesContent":["import { readFileSync } from 'node:fs';\n\nimport type { MastraPackage } from '../schemas/system';\nimport { apiSchemaManifestResponseSchema, systemPackagesResponseSchema } from '../schemas/system';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { handleError } from './error';\n\nexport const GET_API_SCHEMA_ROUTE = createRoute({\n method: 'GET',\n path: '/system/api-schema',\n responseType: 'json',\n responseSchema: apiSchemaManifestResponseSchema,\n summary: 'Get API schema manifest',\n description: 'Returns the route-contract-derived API schema manifest for the machine-readable CLI',\n tags: ['System'],\n requiresAuth: true,\n handler: async () => {\n // Dynamic import to avoid circular dependency issues\n const { buildApiSchemaManifest } = await import('../server-adapter/api-schema-manifest');\n return buildApiSchemaManifest();\n },\n});\n\nexport const GET_SYSTEM_PACKAGES_ROUTE = createRoute({\n method: 'GET',\n path: '/system/packages',\n responseType: 'json',\n responseSchema: systemPackagesResponseSchema,\n summary: 'Get installed Mastra packages',\n description: 'Returns a list of all installed Mastra packages and their versions from the project',\n tags: ['System'],\n requiresAuth: true,\n handler: async ({ mastra }) => {\n try {\n const packagesFilePath = process.env.MASTRA_PACKAGES_FILE;\n\n let packages: MastraPackage[] = [];\n\n if (packagesFilePath) {\n try {\n const fileContent = readFileSync(packagesFilePath, 'utf-8');\n packages = JSON.parse(fileContent);\n } catch {\n packages = [];\n }\n }\n\n const storage = mastra.getStorage();\n const storageType = storage?.name;\n const observabilityStorage = storage?.stores?.observability;\n const observabilityStorageType = observabilityStorage?.constructor.name;\n const observabilityRuntimeStrategy = observabilityStorage?.runtimeTracingStrategy;\n const observabilityEnabled = !!mastra.observability.getDefaultInstance();\n\n return {\n packages,\n isDev: process.env.MASTRA_DEV === 'true',\n cmsEnabled: !!mastra.getEditor(),\n observabilityEnabled,\n storageType,\n observabilityStorageType,\n observabilityRuntimeStrategy,\n };\n } catch (error) {\n return handleError(error, 'Error getting system packages');\n }\n },\n});\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkCXAJPAJ2_cjs = require('./chunk-CXAJPAJ2.cjs');
|
|
4
4
|
var chunkHARB3PEO_cjs = require('./chunk-HARB3PEO.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunk67X7UIDG_cjs = require('./chunk-67X7UIDG.cjs');
|
|
6
6
|
var chunkPPNPOLWL_cjs = require('./chunk-PPNPOLWL.cjs');
|
|
7
7
|
var chunkRZR7PLFW_cjs = require('./chunk-RZR7PLFW.cjs');
|
|
8
8
|
var chunkO7I5CWRX_cjs = require('./chunk-O7I5CWRX.cjs');
|
|
@@ -649,7 +649,7 @@ async function getAgentCardByIdHandler({
|
|
|
649
649
|
pushNotifications = false,
|
|
650
650
|
requestContext
|
|
651
651
|
}) {
|
|
652
|
-
const agent = await
|
|
652
|
+
const agent = await chunk67X7UIDG_cjs.getAgentFromSystem({ mastra, agentId });
|
|
653
653
|
const [instructions, tools] = await Promise.all([agent.getInstructions({ requestContext }), agent.listTools({ requestContext })]);
|
|
654
654
|
const agentCard = {
|
|
655
655
|
name: agent.id || agentId,
|
|
@@ -1490,7 +1490,7 @@ async function getAgentExecutionHandler({
|
|
|
1490
1490
|
logger,
|
|
1491
1491
|
abortSignal
|
|
1492
1492
|
}) {
|
|
1493
|
-
const agent = await
|
|
1493
|
+
const agent = await chunk67X7UIDG_cjs.getAgentFromSystem({ mastra, agentId });
|
|
1494
1494
|
const {
|
|
1495
1495
|
pushNotificationStore: resolvedPushNotificationStore,
|
|
1496
1496
|
pushNotificationSender: resolvedPushNotificationSender
|
|
@@ -1672,5 +1672,5 @@ exports.handleSetTaskPushNotificationConfig = handleSetTaskPushNotificationConfi
|
|
|
1672
1672
|
exports.handleTaskCancel = handleTaskCancel;
|
|
1673
1673
|
exports.handleTaskGet = handleTaskGet;
|
|
1674
1674
|
exports.handleTaskResubscribe = handleTaskResubscribe;
|
|
1675
|
-
//# sourceMappingURL=chunk-
|
|
1676
|
-
//# sourceMappingURL=chunk-
|
|
1675
|
+
//# sourceMappingURL=chunk-65ZS7YK4.cjs.map
|
|
1676
|
+
//# sourceMappingURL=chunk-65ZS7YK4.cjs.map
|