@mastra/server 1.0.0-beta.21 → 1.0.0-beta.23
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 +123 -0
- package/dist/{chunk-EZPXTOSM.cjs → chunk-63NFBEYY.cjs} +117 -64
- package/dist/chunk-63NFBEYY.cjs.map +1 -0
- package/dist/{chunk-F6CHEWZT.cjs → chunk-6MP2S6VI.cjs} +14 -14
- package/dist/{chunk-F6CHEWZT.cjs.map → chunk-6MP2S6VI.cjs.map} +1 -1
- package/dist/{chunk-R25YJP3Y.cjs → chunk-BRI4GUZ2.cjs} +18 -7
- package/dist/chunk-BRI4GUZ2.cjs.map +1 -0
- package/dist/{chunk-UST3FS67.cjs → chunk-BW3BLTCG.cjs} +39 -15
- package/dist/chunk-BW3BLTCG.cjs.map +1 -0
- package/dist/{chunk-V2BBRMP6.js → chunk-CGMTK3PI.js} +94 -11
- package/dist/chunk-CGMTK3PI.js.map +1 -0
- package/dist/{chunk-FBB2QKRV.js → chunk-DCEXXMOH.js} +3 -3
- package/dist/{chunk-FBB2QKRV.js.map → chunk-DCEXXMOH.js.map} +1 -1
- package/dist/{chunk-VEHQCZFU.js → chunk-FALSDBPK.js} +64 -13
- package/dist/chunk-FALSDBPK.js.map +1 -0
- package/dist/{chunk-OQVXRANI.js → chunk-H34VRYSF.js} +3 -3
- package/dist/{chunk-OQVXRANI.js.map → chunk-H34VRYSF.js.map} +1 -1
- package/dist/{chunk-NGPUSFSO.cjs → chunk-ILV5M6C7.cjs} +7 -7
- package/dist/{chunk-NGPUSFSO.cjs.map → chunk-ILV5M6C7.cjs.map} +1 -1
- package/dist/{chunk-3RAQVZUX.js → chunk-IVGQTL3T.js} +3 -3
- package/dist/{chunk-3RAQVZUX.js.map → chunk-IVGQTL3T.js.map} +1 -1
- package/dist/{chunk-H27ZCWUX.cjs → chunk-TENMF4X2.cjs} +130 -47
- package/dist/chunk-TENMF4X2.cjs.map +1 -0
- package/dist/{chunk-4TRYHC5Z.cjs → chunk-UK4FZWNW.cjs} +21 -21
- package/dist/{chunk-4TRYHC5Z.cjs.map → chunk-UK4FZWNW.cjs.map} +1 -1
- package/dist/{chunk-2UAI7X5P.js → chunk-VZ5UM5FQ.js} +39 -15
- package/dist/chunk-VZ5UM5FQ.js.map +1 -0
- package/dist/{chunk-6HKMJXTF.js → chunk-WLGJVDH4.js} +16 -8
- package/dist/chunk-WLGJVDH4.js.map +1 -0
- package/dist/docs/README.md +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/SOURCE_MAP.json +1 -1
- package/dist/docs/server/01-custom-adapters.md +5 -2
- package/dist/docs/server/02-reference.md +0 -9
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agents.cjs +32 -24
- package/dist/server/handlers/agents.d.ts +63 -79
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/memory.cjs +25 -25
- package/dist/server/handlers/memory.d.ts +48 -48
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability.d.ts +4 -4
- package/dist/server/handlers/observability.d.ts.map +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -8
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +24 -24
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +12 -12
- package/dist/server/handlers.js +6 -6
- package/dist/server/schemas/agents.d.ts +409 -6
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/memory.d.ts +48 -48
- package/dist/server/schemas/memory.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +99 -97
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.js +8 -6
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/redact.d.ts +2 -2
- package/dist/server/server-adapter/redact.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/agents.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-2UAI7X5P.js.map +0 -1
- package/dist/chunk-6HKMJXTF.js.map +0 -1
- package/dist/chunk-EZPXTOSM.cjs.map +0 -1
- package/dist/chunk-H27ZCWUX.cjs.map +0 -1
- package/dist/chunk-R25YJP3Y.cjs.map +0 -1
- package/dist/chunk-UST3FS67.cjs.map +0 -1
- package/dist/chunk-V2BBRMP6.js.map +0 -1
- package/dist/chunk-VEHQCZFU.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,128 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`c8417b4`](https://github.com/mastra-ai/mastra/commit/c8417b41d9f3486854dc7842d977fbe5e2166264), [`dd4f34c`](https://github.com/mastra-ai/mastra/commit/dd4f34c78cbae24063463475b0619575c415f9b8)]:
|
|
8
|
+
- @mastra/core@1.0.0-beta.23
|
|
9
|
+
|
|
10
|
+
## 1.0.0-beta.22
|
|
11
|
+
|
|
12
|
+
### Major Changes
|
|
13
|
+
|
|
14
|
+
- **Breaking Change**: Convert OUTPUT generic from `OutputSchema` constraint to plain generic ([#11741](https://github.com/mastra-ai/mastra/pull/11741))
|
|
15
|
+
|
|
16
|
+
This change removes the direct dependency on Zod typings in the public API by converting all `OUTPUT extends OutputSchema` generic constraints to plain `OUTPUT` generics throughout the codebase. This is preparation for moving to a standard schema approach.
|
|
17
|
+
- All generic type parameters previously constrained to `OutputSchema` (e.g., `<OUTPUT extends OutputSchema = undefined>`) are now plain generics with defaults (e.g., `<OUTPUT = undefined>`)
|
|
18
|
+
- Affects all public APIs including `Agent`, `MastraModelOutput`, `AgentExecutionOptions`, and stream/generate methods
|
|
19
|
+
- `InferSchemaOutput<OUTPUT>` replaced with `OUTPUT` throughout
|
|
20
|
+
- `PartialSchemaOutput<OUTPUT>` replaced with `Partial<OUTPUT>`
|
|
21
|
+
- Schema fields now use `NonNullable<OutputSchema<OUTPUT>>` instead of `OUTPUT` directly
|
|
22
|
+
- Added `FullOutput<OUTPUT>` type representing complete output with all fields
|
|
23
|
+
- Added `AgentExecutionOptionsBase<OUTPUT>` type
|
|
24
|
+
- `getFullOutput()` method now returns `Promise<FullOutput<OUTPUT>>`
|
|
25
|
+
- `Agent` class now generic: `Agent<TAgentId, TTools, TOutput>`
|
|
26
|
+
- `agent.generate()` and `agent.stream()` methods have updated signatures
|
|
27
|
+
- `MastraModelOutput<OUTPUT>` no longer requires `OutputSchema` constraint
|
|
28
|
+
- Network route and streaming APIs updated to use plain OUTPUT generic
|
|
29
|
+
|
|
30
|
+
**Before:**
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
const output = await agent.generate<z.ZodType>({
|
|
34
|
+
messages: [...],
|
|
35
|
+
structuredOutput: { schema: mySchema }
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
**After:**
|
|
39
|
+
const output = await agent.generate<z.infer<typeof mySchema>>({
|
|
40
|
+
messages: [...],
|
|
41
|
+
structuredOutput: { schema: mySchema }
|
|
42
|
+
});
|
|
43
|
+
// Or rely on type inference:
|
|
44
|
+
const output = await agent.generate({
|
|
45
|
+
messages: [...],
|
|
46
|
+
structuredOutput: { schema: mySchema }
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Removes the deprecated `threadId` and `resourceId` options from `AgentExecutionOptions`. These have been deprecated for months in favour of the `memory` option. ([#11897](https://github.com/mastra-ai/mastra/pull/11897))
|
|
54
|
+
|
|
55
|
+
### Breaking Changes
|
|
56
|
+
|
|
57
|
+
#### `@mastra/core`
|
|
58
|
+
|
|
59
|
+
The `threadId` and `resourceId` options have been removed from `agent.generate()` and `agent.stream()`. Use the `memory` option instead:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
// Before
|
|
63
|
+
await agent.stream('Hello', {
|
|
64
|
+
threadId: 'thread-123',
|
|
65
|
+
resourceId: 'user-456',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// After
|
|
69
|
+
await agent.stream('Hello', {
|
|
70
|
+
memory: {
|
|
71
|
+
thread: 'thread-123',
|
|
72
|
+
resource: 'user-456',
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### `@mastra/server`
|
|
78
|
+
|
|
79
|
+
The `threadId`, `resourceId`, and `resourceid` fields have been removed from the main agent execution body schema. The server now expects the `memory` option format in request bodies. Legacy routes (`/api/agents/:agentId/generate-legacy` and `/api/agents/:agentId/stream-legacy`) continue to support the deprecated fields.
|
|
80
|
+
|
|
81
|
+
#### `@mastra/react`
|
|
82
|
+
|
|
83
|
+
The `useChat` hook now internally converts `threadId` to the `memory` option format when making API calls. No changes needed in component code - the hook handles the conversion automatically.
|
|
84
|
+
|
|
85
|
+
#### `@mastra/client-js`
|
|
86
|
+
|
|
87
|
+
When using the client SDK agent methods, use the `memory` option instead of `threadId`/`resourceId`:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const agent = client.getAgent('my-agent');
|
|
91
|
+
|
|
92
|
+
// Before
|
|
93
|
+
await agent.generate({
|
|
94
|
+
messages: [...],
|
|
95
|
+
threadId: 'thread-123',
|
|
96
|
+
resourceId: 'user-456',
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// After
|
|
100
|
+
await agent.generate({
|
|
101
|
+
messages: [...],
|
|
102
|
+
memory: {
|
|
103
|
+
thread: 'thread-123',
|
|
104
|
+
resource: 'user-456',
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
- Fixed orderBy query parameter parsing for memory endpoints. The listMessages and listThreads endpoints now correctly parse orderBy when passed as a JSON string in URL query parameters, matching the existing behavior for include and filter parameters. ([#11767](https://github.com/mastra-ai/mastra/pull/11767))
|
|
110
|
+
|
|
111
|
+
- Add human-in-the-loop (HITL) support to agent networks ([#11678](https://github.com/mastra-ai/mastra/pull/11678))
|
|
112
|
+
- Add suspend/resume capabilities to agent network
|
|
113
|
+
- Enable auto-resume for suspended network execution via `autoResumeSuspendedTools`
|
|
114
|
+
|
|
115
|
+
`agent.resumeNetwork`, `agent.approveNetworkToolCall`, `agent.declineNetworkToolCall`
|
|
116
|
+
|
|
117
|
+
- Fix 'Memory is not initialized' error in playground for agents with sub-agents but no memory ([#11780](https://github.com/mastra-ai/mastra/pull/11780))
|
|
118
|
+
|
|
119
|
+
When using agents with sub-agents (e.g., agent networks) but no memory configured, the playground UI would log HTTPException errors when fetching messages for sub-agents without memory.
|
|
120
|
+
|
|
121
|
+
Changed GET /api/memory/threads/:threadId/messages to return empty messages `{ messages: [], uiMessages: [] }` instead of throwing 400 error when memory is not configured for the requested agent.
|
|
122
|
+
|
|
123
|
+
- Updated dependencies [[`ebae12a`](https://github.com/mastra-ai/mastra/commit/ebae12a2dd0212e75478981053b148a2c246962d), [`c61a0a5`](https://github.com/mastra-ai/mastra/commit/c61a0a5de4904c88fd8b3718bc26d1be1c2ec6e7), [`69136e7`](https://github.com/mastra-ai/mastra/commit/69136e748e32f57297728a4e0f9a75988462f1a7), [`449aed2`](https://github.com/mastra-ai/mastra/commit/449aed2ba9d507b75bf93d427646ea94f734dfd1), [`eb648a2`](https://github.com/mastra-ai/mastra/commit/eb648a2cc1728f7678768dd70cd77619b448dab9), [`0131105`](https://github.com/mastra-ai/mastra/commit/0131105532e83bdcbb73352fc7d0879eebf140dc), [`9d5059e`](https://github.com/mastra-ai/mastra/commit/9d5059eae810829935fb08e81a9bb7ecd5b144a7), [`ef756c6`](https://github.com/mastra-ai/mastra/commit/ef756c65f82d16531c43f49a27290a416611e526), [`b00ccd3`](https://github.com/mastra-ai/mastra/commit/b00ccd325ebd5d9e37e34dd0a105caae67eb568f), [`3bdfa75`](https://github.com/mastra-ai/mastra/commit/3bdfa7507a91db66f176ba8221aa28dd546e464a), [`e770de9`](https://github.com/mastra-ai/mastra/commit/e770de941a287a49b1964d44db5a5763d19890a6), [`52e2716`](https://github.com/mastra-ai/mastra/commit/52e2716b42df6eff443de72360ae83e86ec23993), [`27b4040`](https://github.com/mastra-ai/mastra/commit/27b4040bfa1a95d92546f420a02a626b1419a1d6), [`610a70b`](https://github.com/mastra-ai/mastra/commit/610a70bdad282079f0c630e0d7bb284578f20151), [`8dc7f55`](https://github.com/mastra-ai/mastra/commit/8dc7f55900395771da851dc7d78d53ae84fe34ec), [`8379099`](https://github.com/mastra-ai/mastra/commit/8379099fc467af6bef54dd7f80c9bd75bf8bbddf), [`8c0ec25`](https://github.com/mastra-ai/mastra/commit/8c0ec25646c8a7df253ed1e5ff4863a0d3f1316c), [`ff4d9a6`](https://github.com/mastra-ai/mastra/commit/ff4d9a6704fc87b31a380a76ed22736fdedbba5a), [`69821ef`](https://github.com/mastra-ai/mastra/commit/69821ef806482e2c44e2197ac0b050c3fe3a5285), [`1ed5716`](https://github.com/mastra-ai/mastra/commit/1ed5716830867b3774c4a1b43cc0d82935f32b96), [`4186bdd`](https://github.com/mastra-ai/mastra/commit/4186bdd00731305726fa06adba0b076a1d50b49f), [`7aaf973`](https://github.com/mastra-ai/mastra/commit/7aaf973f83fbbe9521f1f9e7a4fd99b8de464617)]:
|
|
124
|
+
- @mastra/core@1.0.0-beta.22
|
|
125
|
+
|
|
3
126
|
## 1.0.0-beta.21
|
|
4
127
|
|
|
5
128
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk5W4RPVTK_cjs = require('./chunk-5W4RPVTK.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkBRI4GUZ2_cjs = require('./chunk-BRI4GUZ2.cjs');
|
|
5
5
|
var chunkGU4EWMZB_cjs = require('./chunk-GU4EWMZB.cjs');
|
|
6
6
|
var chunkAVRO3FIN_cjs = require('./chunk-AVRO3FIN.cjs');
|
|
7
7
|
var chunkSUKFO7UM_cjs = require('./chunk-SUKFO7UM.cjs');
|
|
@@ -16,7 +16,9 @@ var zod = require('zod');
|
|
|
16
16
|
// src/server/handlers/agents.ts
|
|
17
17
|
var agents_exports = {};
|
|
18
18
|
chunkO7I5CWRX_cjs.__export(agents_exports, {
|
|
19
|
+
APPROVE_NETWORK_TOOL_CALL_ROUTE: () => APPROVE_NETWORK_TOOL_CALL_ROUTE,
|
|
19
20
|
APPROVE_TOOL_CALL_ROUTE: () => APPROVE_TOOL_CALL_ROUTE,
|
|
21
|
+
DECLINE_NETWORK_TOOL_CALL_ROUTE: () => DECLINE_NETWORK_TOOL_CALL_ROUTE,
|
|
20
22
|
DECLINE_TOOL_CALL_ROUTE: () => DECLINE_TOOL_CALL_ROUTE,
|
|
21
23
|
ENHANCE_INSTRUCTIONS_ROUTE: () => ENHANCE_INSTRUCTIONS_ROUTE,
|
|
22
24
|
GENERATE_AGENT_ROUTE: () => GENERATE_AGENT_ROUTE,
|
|
@@ -310,7 +312,7 @@ var LIST_AGENTS_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
310
312
|
queryParamSchema: zod.z.object({
|
|
311
313
|
partial: zod.z.string().optional()
|
|
312
314
|
}),
|
|
313
|
-
responseSchema:
|
|
315
|
+
responseSchema: chunkBRI4GUZ2_cjs.listAgentsResponseSchema,
|
|
314
316
|
summary: "List all agents",
|
|
315
317
|
description: "Returns a list of all available agents in the system",
|
|
316
318
|
tags: ["Agents"],
|
|
@@ -340,8 +342,8 @@ var GET_AGENT_BY_ID_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
340
342
|
method: "GET",
|
|
341
343
|
path: "/api/agents/:agentId",
|
|
342
344
|
responseType: "json",
|
|
343
|
-
pathParamSchema:
|
|
344
|
-
responseSchema:
|
|
345
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
346
|
+
responseSchema: chunkBRI4GUZ2_cjs.serializedAgentSchema,
|
|
345
347
|
summary: "Get agent by ID",
|
|
346
348
|
description: "Returns details for a specific agent including configuration, tools, and memory settings",
|
|
347
349
|
tags: ["Agents"],
|
|
@@ -365,9 +367,9 @@ var GENERATE_AGENT_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
365
367
|
method: "POST",
|
|
366
368
|
path: "/api/agents/:agentId/generate",
|
|
367
369
|
responseType: "json",
|
|
368
|
-
pathParamSchema:
|
|
369
|
-
bodySchema:
|
|
370
|
-
responseSchema:
|
|
370
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
371
|
+
bodySchema: chunkBRI4GUZ2_cjs.agentExecutionBodySchema,
|
|
372
|
+
responseSchema: chunkBRI4GUZ2_cjs.generateResponseSchema,
|
|
371
373
|
summary: "Generate agent response",
|
|
372
374
|
description: "Executes an agent with the provided messages and returns the complete response",
|
|
373
375
|
tags: ["Agents"],
|
|
@@ -391,9 +393,9 @@ var GENERATE_LEGACY_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
391
393
|
method: "POST",
|
|
392
394
|
path: "/api/agents/:agentId/generate-legacy",
|
|
393
395
|
responseType: "json",
|
|
394
|
-
pathParamSchema:
|
|
395
|
-
bodySchema:
|
|
396
|
-
responseSchema:
|
|
396
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
397
|
+
bodySchema: chunkBRI4GUZ2_cjs.agentExecutionLegacyBodySchema,
|
|
398
|
+
responseSchema: chunkBRI4GUZ2_cjs.generateResponseSchema,
|
|
397
399
|
summary: "[DEPRECATED] Generate with legacy format",
|
|
398
400
|
description: "Legacy endpoint for generating agent responses. Use /api/agents/:agentId/generate instead.",
|
|
399
401
|
tags: ["Agents", "Legacy"],
|
|
@@ -423,9 +425,9 @@ var STREAM_GENERATE_LEGACY_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
423
425
|
method: "POST",
|
|
424
426
|
path: "/api/agents/:agentId/stream-legacy",
|
|
425
427
|
responseType: "datastream-response",
|
|
426
|
-
pathParamSchema:
|
|
427
|
-
bodySchema:
|
|
428
|
-
responseSchema:
|
|
428
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
429
|
+
bodySchema: chunkBRI4GUZ2_cjs.agentExecutionLegacyBodySchema,
|
|
430
|
+
responseSchema: chunkBRI4GUZ2_cjs.streamResponseSchema,
|
|
429
431
|
summary: "[DEPRECATED] Stream with legacy format",
|
|
430
432
|
description: "Legacy endpoint for streaming agent responses. Use /api/agents/:agentId/stream instead.",
|
|
431
433
|
tags: ["Agents", "Legacy"],
|
|
@@ -469,7 +471,7 @@ var GET_PROVIDERS_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
469
471
|
method: "GET",
|
|
470
472
|
path: "/api/agents/providers",
|
|
471
473
|
responseType: "json",
|
|
472
|
-
responseSchema:
|
|
474
|
+
responseSchema: chunkBRI4GUZ2_cjs.providersResponseSchema,
|
|
473
475
|
summary: "List AI providers",
|
|
474
476
|
description: "Returns a list of all configured AI model providers",
|
|
475
477
|
tags: ["Agents"],
|
|
@@ -498,9 +500,9 @@ var GENERATE_AGENT_VNEXT_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
498
500
|
method: "POST",
|
|
499
501
|
path: "/api/agents/:agentId/generate/vnext",
|
|
500
502
|
responseType: "json",
|
|
501
|
-
pathParamSchema:
|
|
502
|
-
bodySchema:
|
|
503
|
-
responseSchema:
|
|
503
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
504
|
+
bodySchema: chunkBRI4GUZ2_cjs.agentExecutionBodySchema,
|
|
505
|
+
responseSchema: chunkBRI4GUZ2_cjs.generateResponseSchema,
|
|
504
506
|
summary: "Generate a response from an agent",
|
|
505
507
|
description: "Generate a response from an agent",
|
|
506
508
|
tags: ["Agents"],
|
|
@@ -511,9 +513,9 @@ var STREAM_GENERATE_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
511
513
|
path: "/api/agents/:agentId/stream",
|
|
512
514
|
responseType: "stream",
|
|
513
515
|
streamFormat: "sse",
|
|
514
|
-
pathParamSchema:
|
|
515
|
-
bodySchema:
|
|
516
|
-
responseSchema:
|
|
516
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
517
|
+
bodySchema: chunkBRI4GUZ2_cjs.agentExecutionBodySchema,
|
|
518
|
+
responseSchema: chunkBRI4GUZ2_cjs.streamResponseSchema,
|
|
517
519
|
summary: "Stream agent response",
|
|
518
520
|
description: "Executes an agent with the provided messages and streams the response in real-time",
|
|
519
521
|
tags: ["Agents"],
|
|
@@ -537,9 +539,9 @@ var STREAM_GENERATE_VNEXT_DEPRECATED_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
537
539
|
method: "POST",
|
|
538
540
|
path: "/api/agents/:agentId/stream/vnext",
|
|
539
541
|
responseType: "stream",
|
|
540
|
-
pathParamSchema:
|
|
541
|
-
bodySchema:
|
|
542
|
-
responseSchema:
|
|
542
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
543
|
+
bodySchema: chunkBRI4GUZ2_cjs.agentExecutionBodySchema,
|
|
544
|
+
responseSchema: chunkBRI4GUZ2_cjs.streamResponseSchema,
|
|
543
545
|
summary: "Stream a response from an agent",
|
|
544
546
|
description: "[DEPRECATED] This endpoint is deprecated. Please use /stream instead.",
|
|
545
547
|
tags: ["Agents"],
|
|
@@ -551,9 +553,9 @@ var APPROVE_TOOL_CALL_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
551
553
|
path: "/api/agents/:agentId/approve-tool-call",
|
|
552
554
|
responseType: "stream",
|
|
553
555
|
streamFormat: "sse",
|
|
554
|
-
pathParamSchema:
|
|
555
|
-
bodySchema:
|
|
556
|
-
responseSchema:
|
|
556
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
557
|
+
bodySchema: chunkBRI4GUZ2_cjs.approveToolCallBodySchema,
|
|
558
|
+
responseSchema: chunkBRI4GUZ2_cjs.toolCallResponseSchema,
|
|
557
559
|
summary: "Approve tool call",
|
|
558
560
|
description: "Approves a pending tool call and continues agent execution",
|
|
559
561
|
tags: ["Agents", "Tools"],
|
|
@@ -582,9 +584,9 @@ var DECLINE_TOOL_CALL_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
582
584
|
path: "/api/agents/:agentId/decline-tool-call",
|
|
583
585
|
responseType: "stream",
|
|
584
586
|
streamFormat: "sse",
|
|
585
|
-
pathParamSchema:
|
|
586
|
-
bodySchema:
|
|
587
|
-
responseSchema:
|
|
587
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
588
|
+
bodySchema: chunkBRI4GUZ2_cjs.declineToolCallBodySchema,
|
|
589
|
+
responseSchema: chunkBRI4GUZ2_cjs.toolCallResponseSchema,
|
|
588
590
|
summary: "Decline tool call",
|
|
589
591
|
description: "Declines a pending tool call and continues agent execution without executing the tool",
|
|
590
592
|
tags: ["Agents", "Tools"],
|
|
@@ -613,9 +615,9 @@ var STREAM_NETWORK_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
613
615
|
path: "/api/agents/:agentId/network",
|
|
614
616
|
responseType: "stream",
|
|
615
617
|
streamFormat: "sse",
|
|
616
|
-
pathParamSchema:
|
|
617
|
-
bodySchema:
|
|
618
|
-
responseSchema:
|
|
618
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
619
|
+
bodySchema: chunkBRI4GUZ2_cjs.agentExecutionBodySchema,
|
|
620
|
+
responseSchema: chunkBRI4GUZ2_cjs.streamResponseSchema,
|
|
619
621
|
summary: "Stream agent network",
|
|
620
622
|
description: "Executes an agent network with multiple agents and streams the response",
|
|
621
623
|
tags: ["Agents"],
|
|
@@ -625,12 +627,7 @@ var STREAM_NETWORK_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
625
627
|
chunk5W4RPVTK_cjs.sanitizeBody(params, ["tools"]);
|
|
626
628
|
chunk5W4RPVTK_cjs.validateBody({ messages });
|
|
627
629
|
const streamResult = await agent.network(messages, {
|
|
628
|
-
...params
|
|
629
|
-
memory: {
|
|
630
|
-
thread: params.thread ?? params.threadId ?? "",
|
|
631
|
-
resource: params.resourceId ?? "",
|
|
632
|
-
options: params.memory?.options ?? {}
|
|
633
|
-
}
|
|
630
|
+
...params
|
|
634
631
|
});
|
|
635
632
|
return streamResult;
|
|
636
633
|
} catch (error) {
|
|
@@ -638,13 +635,67 @@ var STREAM_NETWORK_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
638
635
|
}
|
|
639
636
|
}
|
|
640
637
|
});
|
|
638
|
+
var APPROVE_NETWORK_TOOL_CALL_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
639
|
+
method: "POST",
|
|
640
|
+
path: "/api/agents/:agentId/approve-network-tool-call",
|
|
641
|
+
responseType: "stream",
|
|
642
|
+
streamFormat: "sse",
|
|
643
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
644
|
+
bodySchema: chunkBRI4GUZ2_cjs.approveNetworkToolCallBodySchema,
|
|
645
|
+
responseSchema: chunkBRI4GUZ2_cjs.streamResponseSchema,
|
|
646
|
+
summary: "Approve network tool call",
|
|
647
|
+
description: "Approves a pending network tool call and continues network agent execution",
|
|
648
|
+
tags: ["Agents", "Tools"],
|
|
649
|
+
handler: async ({ mastra, agentId, ...params }) => {
|
|
650
|
+
try {
|
|
651
|
+
const agent = await getAgentFromSystem({ mastra, agentId });
|
|
652
|
+
if (!params.runId) {
|
|
653
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run id is required" });
|
|
654
|
+
}
|
|
655
|
+
chunk5W4RPVTK_cjs.sanitizeBody(params, ["tools"]);
|
|
656
|
+
const streamResult = await agent.approveNetworkToolCall({
|
|
657
|
+
...params
|
|
658
|
+
});
|
|
659
|
+
return streamResult;
|
|
660
|
+
} catch (error) {
|
|
661
|
+
return chunkSUKFO7UM_cjs.handleError(error, "error approving network tool call");
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
var DECLINE_NETWORK_TOOL_CALL_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
666
|
+
method: "POST",
|
|
667
|
+
path: "/api/agents/:agentId/decline-network-tool-call",
|
|
668
|
+
responseType: "stream",
|
|
669
|
+
streamFormat: "sse",
|
|
670
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
671
|
+
bodySchema: chunkBRI4GUZ2_cjs.declineNetworkToolCallBodySchema,
|
|
672
|
+
responseSchema: chunkBRI4GUZ2_cjs.streamResponseSchema,
|
|
673
|
+
summary: "Decline network tool call",
|
|
674
|
+
description: "Declines a pending network tool call and continues network agent execution without executing the tool",
|
|
675
|
+
tags: ["Agents", "Tools"],
|
|
676
|
+
handler: async ({ mastra, agentId, ...params }) => {
|
|
677
|
+
try {
|
|
678
|
+
const agent = await getAgentFromSystem({ mastra, agentId });
|
|
679
|
+
if (!params.runId) {
|
|
680
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run id is required" });
|
|
681
|
+
}
|
|
682
|
+
chunk5W4RPVTK_cjs.sanitizeBody(params, ["tools"]);
|
|
683
|
+
const streamResult = await agent.declineNetworkToolCall({
|
|
684
|
+
...params
|
|
685
|
+
});
|
|
686
|
+
return streamResult;
|
|
687
|
+
} catch (error) {
|
|
688
|
+
return chunkSUKFO7UM_cjs.handleError(error, "error declining network tool call");
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
});
|
|
641
692
|
var UPDATE_AGENT_MODEL_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
642
693
|
method: "POST",
|
|
643
694
|
path: "/api/agents/:agentId/model",
|
|
644
695
|
responseType: "json",
|
|
645
|
-
pathParamSchema:
|
|
646
|
-
bodySchema:
|
|
647
|
-
responseSchema:
|
|
696
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
697
|
+
bodySchema: chunkBRI4GUZ2_cjs.updateAgentModelBodySchema,
|
|
698
|
+
responseSchema: chunkBRI4GUZ2_cjs.modelManagementResponseSchema,
|
|
648
699
|
summary: "Update agent model",
|
|
649
700
|
description: "Updates the AI model used by the agent",
|
|
650
701
|
tags: ["Agents", "Models"],
|
|
@@ -663,8 +714,8 @@ var RESET_AGENT_MODEL_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
663
714
|
method: "POST",
|
|
664
715
|
path: "/api/agents/:agentId/model/reset",
|
|
665
716
|
responseType: "json",
|
|
666
|
-
pathParamSchema:
|
|
667
|
-
responseSchema:
|
|
717
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
718
|
+
responseSchema: chunkBRI4GUZ2_cjs.modelManagementResponseSchema,
|
|
668
719
|
summary: "Reset agent model",
|
|
669
720
|
description: "Resets the agent model to its original configuration",
|
|
670
721
|
tags: ["Agents", "Models"],
|
|
@@ -682,9 +733,9 @@ var REORDER_AGENT_MODEL_LIST_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
682
733
|
method: "POST",
|
|
683
734
|
path: "/api/agents/:agentId/models/reorder",
|
|
684
735
|
responseType: "json",
|
|
685
|
-
pathParamSchema:
|
|
686
|
-
bodySchema:
|
|
687
|
-
responseSchema:
|
|
736
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
737
|
+
bodySchema: chunkBRI4GUZ2_cjs.reorderAgentModelListBodySchema,
|
|
738
|
+
responseSchema: chunkBRI4GUZ2_cjs.modelManagementResponseSchema,
|
|
688
739
|
summary: "Reorder agent model list",
|
|
689
740
|
description: "Reorders the model list for agents with multiple model configurations",
|
|
690
741
|
tags: ["Agents", "Models"],
|
|
@@ -706,9 +757,9 @@ var UPDATE_AGENT_MODEL_IN_MODEL_LIST_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
706
757
|
method: "POST",
|
|
707
758
|
path: "/api/agents/:agentId/models/:modelConfigId",
|
|
708
759
|
responseType: "json",
|
|
709
|
-
pathParamSchema:
|
|
710
|
-
bodySchema:
|
|
711
|
-
responseSchema:
|
|
760
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.modelConfigIdPathParams,
|
|
761
|
+
bodySchema: chunkBRI4GUZ2_cjs.updateAgentModelInModelListBodySchema,
|
|
762
|
+
responseSchema: chunkBRI4GUZ2_cjs.modelManagementResponseSchema,
|
|
712
763
|
summary: "Update model in model list",
|
|
713
764
|
description: "Updates a specific model configuration in the agent model list",
|
|
714
765
|
tags: ["Agents", "Models"],
|
|
@@ -810,9 +861,9 @@ var ENHANCE_INSTRUCTIONS_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
810
861
|
method: "POST",
|
|
811
862
|
path: "/api/agents/:agentId/instructions/enhance",
|
|
812
863
|
responseType: "json",
|
|
813
|
-
pathParamSchema:
|
|
814
|
-
bodySchema:
|
|
815
|
-
responseSchema:
|
|
864
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
865
|
+
bodySchema: chunkBRI4GUZ2_cjs.enhanceInstructionsBodySchema,
|
|
866
|
+
responseSchema: chunkBRI4GUZ2_cjs.enhanceInstructionsResponseSchema,
|
|
816
867
|
summary: "Enhance agent instructions",
|
|
817
868
|
description: "Uses AI to enhance or modify agent instructions based on user feedback",
|
|
818
869
|
tags: ["Agents"],
|
|
@@ -837,7 +888,7 @@ Current: ${instructions}
|
|
|
837
888
|
${comment ? `User feedback: ${comment}` : ""}`,
|
|
838
889
|
{
|
|
839
890
|
structuredOutput: {
|
|
840
|
-
schema:
|
|
891
|
+
schema: chunkBRI4GUZ2_cjs.enhanceInstructionsResponseSchema
|
|
841
892
|
}
|
|
842
893
|
}
|
|
843
894
|
);
|
|
@@ -851,9 +902,9 @@ var STREAM_VNEXT_DEPRECATED_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
851
902
|
method: "POST",
|
|
852
903
|
path: "/api/agents/:agentId/streamVNext",
|
|
853
904
|
responseType: "stream",
|
|
854
|
-
pathParamSchema:
|
|
855
|
-
bodySchema:
|
|
856
|
-
responseSchema:
|
|
905
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
906
|
+
bodySchema: chunkBRI4GUZ2_cjs.agentExecutionBodySchema,
|
|
907
|
+
responseSchema: chunkBRI4GUZ2_cjs.streamResponseSchema,
|
|
857
908
|
summary: "Stream a response from an agent",
|
|
858
909
|
description: "[DEPRECATED] This endpoint is deprecated. Please use /stream instead.",
|
|
859
910
|
tags: ["Agents"],
|
|
@@ -866,9 +917,9 @@ var STREAM_UI_MESSAGE_VNEXT_DEPRECATED_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
866
917
|
method: "POST",
|
|
867
918
|
path: "/api/agents/:agentId/stream/vnext/ui",
|
|
868
919
|
responseType: "stream",
|
|
869
|
-
pathParamSchema:
|
|
870
|
-
bodySchema:
|
|
871
|
-
responseSchema:
|
|
920
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
921
|
+
bodySchema: chunkBRI4GUZ2_cjs.agentExecutionBodySchema,
|
|
922
|
+
responseSchema: chunkBRI4GUZ2_cjs.streamResponseSchema,
|
|
872
923
|
summary: "Stream UI messages from an agent",
|
|
873
924
|
description: "[DEPRECATED] This endpoint is deprecated. Please use the @mastra/ai-sdk package for uiMessage transformations",
|
|
874
925
|
tags: ["Agents"],
|
|
@@ -890,9 +941,9 @@ var STREAM_UI_MESSAGE_DEPRECATED_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
890
941
|
method: "POST",
|
|
891
942
|
path: "/api/agents/:agentId/stream/ui",
|
|
892
943
|
responseType: "stream",
|
|
893
|
-
pathParamSchema:
|
|
894
|
-
bodySchema:
|
|
895
|
-
responseSchema:
|
|
944
|
+
pathParamSchema: chunkBRI4GUZ2_cjs.agentIdPathParams,
|
|
945
|
+
bodySchema: chunkBRI4GUZ2_cjs.agentExecutionBodySchema,
|
|
946
|
+
responseSchema: chunkBRI4GUZ2_cjs.streamResponseSchema,
|
|
896
947
|
summary: "Stream UI messages from an agent",
|
|
897
948
|
description: "[DEPRECATED] This endpoint is deprecated. Please use the @mastra/ai-sdk package for uiMessage transformations",
|
|
898
949
|
tags: ["Agents"],
|
|
@@ -900,7 +951,9 @@ var STREAM_UI_MESSAGE_DEPRECATED_ROUTE = chunkAVRO3FIN_cjs.createRoute({
|
|
|
900
951
|
handler: STREAM_UI_MESSAGE_VNEXT_DEPRECATED_ROUTE.handler
|
|
901
952
|
});
|
|
902
953
|
|
|
954
|
+
exports.APPROVE_NETWORK_TOOL_CALL_ROUTE = APPROVE_NETWORK_TOOL_CALL_ROUTE;
|
|
903
955
|
exports.APPROVE_TOOL_CALL_ROUTE = APPROVE_TOOL_CALL_ROUTE;
|
|
956
|
+
exports.DECLINE_NETWORK_TOOL_CALL_ROUTE = DECLINE_NETWORK_TOOL_CALL_ROUTE;
|
|
904
957
|
exports.DECLINE_TOOL_CALL_ROUTE = DECLINE_TOOL_CALL_ROUTE;
|
|
905
958
|
exports.ENHANCE_INSTRUCTIONS_ROUTE = ENHANCE_INSTRUCTIONS_ROUTE;
|
|
906
959
|
exports.GENERATE_AGENT_ROUTE = GENERATE_AGENT_ROUTE;
|
|
@@ -924,5 +977,5 @@ exports.agents_exports = agents_exports;
|
|
|
924
977
|
exports.getAgentFromSystem = getAgentFromSystem;
|
|
925
978
|
exports.getSerializedAgentTools = getSerializedAgentTools;
|
|
926
979
|
exports.getSerializedProcessors = getSerializedProcessors;
|
|
927
|
-
//# sourceMappingURL=chunk-
|
|
928
|
-
//# sourceMappingURL=chunk-
|
|
980
|
+
//# sourceMappingURL=chunk-63NFBEYY.cjs.map
|
|
981
|
+
//# sourceMappingURL=chunk-63NFBEYY.cjs.map
|