@mastra/server 1.29.2-alpha.0 → 1.30.0
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 +242 -0
- package/dist/{chunk-LWK57QIA.cjs → chunk-2CFH32YO.cjs} +5 -5
- package/dist/{chunk-LWK57QIA.cjs.map → chunk-2CFH32YO.cjs.map} +1 -1
- package/dist/{chunk-BR6MQNNL.js → chunk-2HVAN7FF.js} +12 -3
- package/dist/chunk-2HVAN7FF.js.map +1 -0
- package/dist/{chunk-QDNKVREO.js → chunk-2PF5ZR2Q.js} +9 -9
- package/dist/{chunk-QDNKVREO.js.map → chunk-2PF5ZR2Q.js.map} +1 -1
- package/dist/{chunk-HYI4ZAV7.js → chunk-43CWQ4M3.js} +8 -3
- package/dist/chunk-43CWQ4M3.js.map +1 -0
- package/dist/{chunk-JJT4GBDZ.js → chunk-4BSJHDYP.js} +3 -3
- package/dist/{chunk-JJT4GBDZ.js.map → chunk-4BSJHDYP.js.map} +1 -1
- package/dist/{chunk-X2XQFFXR.js → chunk-4GOK3PCO.js} +5 -5
- package/dist/{chunk-X2XQFFXR.js.map → chunk-4GOK3PCO.js.map} +1 -1
- package/dist/{chunk-4Y5P2GYV.js → chunk-4J4K36CU.js} +3 -3
- package/dist/{chunk-4Y5P2GYV.js.map → chunk-4J4K36CU.js.map} +1 -1
- package/dist/{chunk-RQXUPTUI.js → chunk-5OOYXBPG.js} +7 -3
- package/dist/chunk-5OOYXBPG.js.map +1 -0
- package/dist/{chunk-IO7PPBD4.js → chunk-DBPJYWAH.js} +47 -86
- package/dist/chunk-DBPJYWAH.js.map +1 -0
- package/dist/{chunk-W6TZ2TNY.cjs → chunk-DZZBC6UV.cjs} +7 -7
- package/dist/{chunk-W6TZ2TNY.cjs.map → chunk-DZZBC6UV.cjs.map} +1 -1
- package/dist/{chunk-I3BHHWHT.cjs → chunk-EFW6MWXU.cjs} +4 -2
- package/dist/chunk-EFW6MWXU.cjs.map +1 -0
- package/dist/{chunk-2Z5KJJDZ.js → chunk-EPM6ILRW.js} +14 -3
- package/dist/chunk-EPM6ILRW.js.map +1 -0
- package/dist/{chunk-HWK6K3DW.cjs → chunk-EQR4MMSL.cjs} +7 -7
- package/dist/{chunk-HWK6K3DW.cjs.map → chunk-EQR4MMSL.cjs.map} +1 -1
- package/dist/{chunk-VFHNACRY.js → chunk-FN4GIXQQ.js} +5 -5
- package/dist/{chunk-VFHNACRY.js.map → chunk-FN4GIXQQ.js.map} +1 -1
- package/dist/{chunk-YO7N5VOP.js → chunk-GEXJ4LPZ.js} +3 -3
- package/dist/{chunk-YO7N5VOP.js.map → chunk-GEXJ4LPZ.js.map} +1 -1
- package/dist/{chunk-XT6GKIYW.cjs → chunk-GUWIV3ZN.cjs} +9 -2
- package/dist/chunk-GUWIV3ZN.cjs.map +1 -0
- package/dist/{chunk-PSQNWPPT.cjs → chunk-H6NJWTER.cjs} +4 -4
- package/dist/{chunk-PSQNWPPT.cjs.map → chunk-H6NJWTER.cjs.map} +1 -1
- package/dist/{chunk-B5RUOKFI.cjs → chunk-HR4M27JP.cjs} +77 -77
- package/dist/{chunk-B5RUOKFI.cjs.map → chunk-HR4M27JP.cjs.map} +1 -1
- package/dist/{chunk-VLNRGJEM.js → chunk-JZNOIGOQ.js} +3 -3
- package/dist/{chunk-VLNRGJEM.js.map → chunk-JZNOIGOQ.js.map} +1 -1
- package/dist/{chunk-VR623NIZ.cjs → chunk-KI7TGMMV.cjs} +276 -160
- package/dist/chunk-KI7TGMMV.cjs.map +1 -0
- package/dist/{chunk-P7QF3UG4.js → chunk-KJLIMNMI.js} +3 -3
- package/dist/{chunk-P7QF3UG4.js.map → chunk-KJLIMNMI.js.map} +1 -1
- package/dist/{chunk-WC4RIS4D.js → chunk-KW2MZGRE.js} +3 -3
- package/dist/{chunk-WC4RIS4D.js.map → chunk-KW2MZGRE.js.map} +1 -1
- package/dist/{chunk-IA7PNRIA.cjs → chunk-LI3EL57Z.cjs} +11 -11
- package/dist/{chunk-IA7PNRIA.cjs.map → chunk-LI3EL57Z.cjs.map} +1 -1
- package/dist/{chunk-33WVA4ZN.cjs → chunk-LKS22ETT.cjs} +19 -19
- package/dist/{chunk-33WVA4ZN.cjs.map → chunk-LKS22ETT.cjs.map} +1 -1
- package/dist/{chunk-NO3V76EI.cjs → chunk-LY6Q36YN.cjs} +17 -17
- package/dist/{chunk-NO3V76EI.cjs.map → chunk-LY6Q36YN.cjs.map} +1 -1
- package/dist/{chunk-UOWUXTUO.cjs → chunk-NGYGE7QW.cjs} +27 -27
- package/dist/{chunk-UOWUXTUO.cjs.map → chunk-NGYGE7QW.cjs.map} +1 -1
- package/dist/{chunk-JVQ5EXNJ.js → chunk-OJRAH5VV.js} +4 -3
- package/dist/chunk-OJRAH5VV.js.map +1 -0
- package/dist/{chunk-JOC7WKJ2.cjs → chunk-ONPPBXWB.cjs} +48 -48
- package/dist/{chunk-JOC7WKJ2.cjs.map → chunk-ONPPBXWB.cjs.map} +1 -1
- package/dist/{chunk-QP5DRBMC.js → chunk-QL62CV5V.js} +5 -5
- package/dist/{chunk-QP5DRBMC.js.map → chunk-QL62CV5V.js.map} +1 -1
- package/dist/{chunk-6SUTXWOK.cjs → chunk-RPMBPQNO.cjs} +12 -3
- package/dist/chunk-RPMBPQNO.cjs.map +1 -0
- package/dist/{chunk-PRK4GVU6.js → chunk-RTD3NZ4G.js} +4 -4
- package/dist/{chunk-PRK4GVU6.js.map → chunk-RTD3NZ4G.js.map} +1 -1
- package/dist/{chunk-RPOKTN4O.cjs → chunk-SEAOI56Z.cjs} +7 -7
- package/dist/{chunk-RPOKTN4O.cjs.map → chunk-SEAOI56Z.cjs.map} +1 -1
- package/dist/{chunk-K33KUMJY.js → chunk-SSMLJV2K.js} +5 -5
- package/dist/{chunk-K33KUMJY.js.map → chunk-SSMLJV2K.js.map} +1 -1
- package/dist/{chunk-DIX6JWN4.cjs → chunk-TF7NSMHW.cjs} +7 -2
- package/dist/chunk-TF7NSMHW.cjs.map +1 -0
- package/dist/{chunk-B7SBAXEP.cjs → chunk-TKHLXCSZ.cjs} +7 -7
- package/dist/{chunk-B7SBAXEP.cjs.map → chunk-TKHLXCSZ.cjs.map} +1 -1
- package/dist/{chunk-JGHGC64S.cjs → chunk-UQLJDNXU.cjs} +4 -4
- package/dist/{chunk-JGHGC64S.cjs.map → chunk-UQLJDNXU.cjs.map} +1 -1
- package/dist/{chunk-YGQNINW7.js → chunk-UZRD3SEA.js} +146 -31
- package/dist/chunk-UZRD3SEA.js.map +1 -0
- package/dist/{chunk-O76KG2FC.js → chunk-VZNOKYP5.js} +3 -3
- package/dist/{chunk-O76KG2FC.js.map → chunk-VZNOKYP5.js.map} +1 -1
- package/dist/{chunk-5BXP7S4P.cjs → chunk-XG2VRXG5.cjs} +15 -4
- package/dist/chunk-XG2VRXG5.cjs.map +1 -0
- package/dist/{chunk-R4DZSQYI.cjs → chunk-Y2SA2JZT.cjs} +138 -177
- package/dist/chunk-Y2SA2JZT.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{observational-memory-JX7VDONY-AOV7JL6X.js → observational-memory-ZS2HJPUO-2ZBP2HCP.js} +3 -3
- package/dist/{observational-memory-JX7VDONY-AOV7JL6X.js.map → observational-memory-ZS2HJPUO-2ZBP2HCP.js.map} +1 -1
- package/dist/{observational-memory-JX7VDONY-6J77R6HH.cjs → observational-memory-ZS2HJPUO-472SI4TK.cjs} +26 -26
- package/dist/{observational-memory-JX7VDONY-6J77R6HH.cjs.map → observational-memory-ZS2HJPUO-472SI4TK.cjs.map} +1 -1
- package/dist/server/auth/helpers.d.ts.map +1 -1
- package/dist/server/auth/index.cjs +14 -14
- package/dist/server/auth/index.js +1 -1
- package/dist/server/constants.d.ts +1 -0
- package/dist/server/constants.d.ts.map +1 -1
- package/dist/server/handlers/a2a.cjs +10 -10
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agents.cjs +41 -37
- package/dist/server/handlers/agents.d.ts +14 -2
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/auth.cjs +11 -11
- package/dist/server/handlers/auth.js +1 -1
- package/dist/server/handlers/conversations.cjs +5 -5
- package/dist/server/handlers/conversations.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +27 -27
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/responses.cjs +4 -4
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/responses.storage.cjs +8 -8
- package/dist/server/handlers/responses.storage.js +1 -1
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +9 -9
- package/dist/server/handlers/utils.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.d.ts +2 -0
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +22 -22
- package/dist/server/handlers.js +11 -11
- package/dist/server/schemas/agents.d.ts +12 -0
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/index.cjs +69 -61
- package/dist/server/schemas/index.js +3 -3
- package/dist/server/schemas/workflows.d.ts +8 -0
- package/dist/server/schemas/workflows.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +136 -131
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.d.ts.map +1 -1
- package/dist/server/server-adapter/index.js +19 -14
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/agents.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/workflows.d.ts +2 -0
- package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-2Z5KJJDZ.js.map +0 -1
- package/dist/chunk-5BXP7S4P.cjs.map +0 -1
- package/dist/chunk-6SUTXWOK.cjs.map +0 -1
- package/dist/chunk-BR6MQNNL.js.map +0 -1
- package/dist/chunk-DIX6JWN4.cjs.map +0 -1
- package/dist/chunk-HYI4ZAV7.js.map +0 -1
- package/dist/chunk-I3BHHWHT.cjs.map +0 -1
- package/dist/chunk-IO7PPBD4.js.map +0 -1
- package/dist/chunk-JVQ5EXNJ.js.map +0 -1
- package/dist/chunk-R4DZSQYI.cjs.map +0 -1
- package/dist/chunk-RQXUPTUI.js.map +0 -1
- package/dist/chunk-VR623NIZ.cjs.map +0 -1
- package/dist/chunk-XT6GKIYW.cjs.map +0 -1
- package/dist/chunk-YGQNINW7.js.map +0 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkHXICAUTW_cjs = require('./chunk-HXICAUTW.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkGUWIV3ZN_cjs = require('./chunk-GUWIV3ZN.cjs');
|
|
5
5
|
var chunkYJQYJ5WD_cjs = require('./chunk-YJQYJ5WD.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunk2CFH32YO_cjs = require('./chunk-2CFH32YO.cjs');
|
|
7
|
+
var chunkEFW6MWXU_cjs = require('./chunk-EFW6MWXU.cjs');
|
|
8
8
|
var chunkWYLVJSGR_cjs = require('./chunk-WYLVJSGR.cjs');
|
|
9
9
|
var chunk5UKYK7YK_cjs = require('./chunk-5UKYK7YK.cjs');
|
|
10
10
|
var chunkB34S64RC_cjs = require('./chunk-B34S64RC.cjs');
|
|
11
11
|
var chunk64ITUOXI_cjs = require('./chunk-64ITUOXI.cjs');
|
|
12
12
|
var chunkO7I5CWRX_cjs = require('./chunk-O7I5CWRX.cjs');
|
|
13
13
|
var agent = require('@mastra/core/agent');
|
|
14
|
+
var durable = require('@mastra/core/agent/durable');
|
|
14
15
|
var di = require('@mastra/core/di');
|
|
15
16
|
var error = require('@mastra/core/error');
|
|
16
17
|
var llm = require('@mastra/core/llm');
|
|
@@ -36,6 +37,7 @@ chunkO7I5CWRX_cjs.__export(agents_exports, {
|
|
|
36
37
|
GET_AGENT_SKILL_ROUTE: () => GET_AGENT_SKILL_ROUTE,
|
|
37
38
|
GET_PROVIDERS_ROUTE: () => GET_PROVIDERS_ROUTE,
|
|
38
39
|
LIST_AGENTS_ROUTE: () => LIST_AGENTS_ROUTE,
|
|
40
|
+
OBSERVE_AGENT_STREAM_ROUTE: () => OBSERVE_AGENT_STREAM_ROUTE,
|
|
39
41
|
REORDER_AGENT_MODEL_LIST_ROUTE: () => REORDER_AGENT_MODEL_LIST_ROUTE,
|
|
40
42
|
RESET_AGENT_MODEL_ROUTE: () => RESET_AGENT_MODEL_ROUTE,
|
|
41
43
|
RESUME_STREAM_ROUTE: () => RESUME_STREAM_ROUTE,
|
|
@@ -197,47 +199,47 @@ async function getWorkspaceToolsFromAgent(agent, requestContext) {
|
|
|
197
199
|
requestContext: requestContext ? Object.fromEntries(requestContext.entries()) : {}
|
|
198
200
|
};
|
|
199
201
|
const isEnabled = async (toolName) => {
|
|
200
|
-
return (await
|
|
202
|
+
return (await chunkEFW6MWXU_cjs.resolveToolConfig(toolsConfig, toolName, configContext)).enabled;
|
|
201
203
|
};
|
|
202
204
|
if (workspace.filesystem) {
|
|
203
|
-
if (await isEnabled(
|
|
204
|
-
tools.push(
|
|
205
|
+
if (await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.READ_FILE)) {
|
|
206
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.READ_FILE);
|
|
205
207
|
}
|
|
206
|
-
if (await isEnabled(
|
|
207
|
-
tools.push(
|
|
208
|
+
if (await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.LIST_FILES)) {
|
|
209
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.LIST_FILES);
|
|
208
210
|
}
|
|
209
|
-
if (await isEnabled(
|
|
210
|
-
tools.push(
|
|
211
|
+
if (await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.FILE_STAT)) {
|
|
212
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.FILE_STAT);
|
|
211
213
|
}
|
|
212
214
|
if (!isReadOnly) {
|
|
213
|
-
if (await isEnabled(
|
|
214
|
-
tools.push(
|
|
215
|
+
if (await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.WRITE_FILE)) {
|
|
216
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.WRITE_FILE);
|
|
215
217
|
}
|
|
216
|
-
if (await isEnabled(
|
|
217
|
-
tools.push(
|
|
218
|
+
if (await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.EDIT_FILE)) {
|
|
219
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.EDIT_FILE);
|
|
218
220
|
}
|
|
219
|
-
if (await isEnabled(
|
|
220
|
-
tools.push(
|
|
221
|
+
if (await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.DELETE)) {
|
|
222
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.DELETE);
|
|
221
223
|
}
|
|
222
|
-
if (await isEnabled(
|
|
223
|
-
tools.push(
|
|
224
|
+
if (await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.MKDIR)) {
|
|
225
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.MKDIR);
|
|
224
226
|
}
|
|
225
227
|
}
|
|
226
|
-
if (await isEnabled(
|
|
227
|
-
tools.push(
|
|
228
|
+
if (await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.GREP)) {
|
|
229
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.FILESYSTEM.GREP);
|
|
228
230
|
}
|
|
229
231
|
}
|
|
230
232
|
if (workspace.canBM25 || workspace.canVector) {
|
|
231
|
-
if (await isEnabled(
|
|
232
|
-
tools.push(
|
|
233
|
+
if (await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.SEARCH.SEARCH)) {
|
|
234
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.SEARCH.SEARCH);
|
|
233
235
|
}
|
|
234
|
-
if (!isReadOnly && await isEnabled(
|
|
235
|
-
tools.push(
|
|
236
|
+
if (!isReadOnly && await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.SEARCH.INDEX)) {
|
|
237
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.SEARCH.INDEX);
|
|
236
238
|
}
|
|
237
239
|
}
|
|
238
240
|
if (workspace.sandbox) {
|
|
239
|
-
if (workspace.sandbox.executeCommand && await isEnabled(
|
|
240
|
-
tools.push(
|
|
241
|
+
if (workspace.sandbox.executeCommand && await isEnabled(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.SANDBOX.EXECUTE_COMMAND)) {
|
|
242
|
+
tools.push(chunkEFW6MWXU_cjs.WORKSPACE_TOOLS.SANDBOX.EXECUTE_COMMAND);
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
245
|
return tools;
|
|
@@ -418,17 +420,22 @@ async function formatAgentList({
|
|
|
418
420
|
hasDraft: !!(agent.toRawConfig()?.resolvedVersionId && agent.toRawConfig()?.activeVersionId && agent.toRawConfig().resolvedVersionId !== agent.toRawConfig().activeVersionId)
|
|
419
421
|
};
|
|
420
422
|
}
|
|
421
|
-
function extractVersionOptions(requestContext) {
|
|
423
|
+
function extractVersionOptions(requestContext, bodyRequestContext) {
|
|
422
424
|
const agentVersionId = requestContext?.get("agentVersionId");
|
|
423
425
|
if (typeof agentVersionId === "string" && agentVersionId) {
|
|
424
426
|
return { versionId: agentVersionId };
|
|
425
427
|
}
|
|
428
|
+
const bodyVersionId = bodyRequestContext?.agentVersionId;
|
|
429
|
+
if (typeof bodyVersionId === "string" && bodyVersionId) {
|
|
430
|
+
return { versionId: bodyVersionId };
|
|
431
|
+
}
|
|
426
432
|
return void 0;
|
|
427
433
|
}
|
|
428
434
|
async function getAgentFromSystem({
|
|
429
435
|
mastra,
|
|
430
436
|
agentId,
|
|
431
|
-
versionOptions
|
|
437
|
+
versionOptions,
|
|
438
|
+
requestContext
|
|
432
439
|
}) {
|
|
433
440
|
const logger = mastra.getLogger();
|
|
434
441
|
if (!agentId) {
|
|
@@ -461,7 +468,11 @@ async function getAgentFromSystem({
|
|
|
461
468
|
try {
|
|
462
469
|
const editorAgent = mastra.getEditor()?.agent;
|
|
463
470
|
if (editorAgent) {
|
|
464
|
-
agent = await editorAgent.applyStoredOverrides(
|
|
471
|
+
agent = await editorAgent.applyStoredOverrides(
|
|
472
|
+
agent,
|
|
473
|
+
versionOptions ?? { status: "published" },
|
|
474
|
+
requestContext
|
|
475
|
+
);
|
|
465
476
|
}
|
|
466
477
|
} catch (error) {
|
|
467
478
|
logger.debug("Error applying stored overrides to code agent", error);
|
|
@@ -597,7 +608,7 @@ var LIST_AGENTS_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
597
608
|
queryParamSchema: v4.z.object({
|
|
598
609
|
partial: v4.z.string().optional()
|
|
599
610
|
}),
|
|
600
|
-
responseSchema:
|
|
611
|
+
responseSchema: chunkGUWIV3ZN_cjs.listAgentsResponseSchema,
|
|
601
612
|
summary: "List all agents",
|
|
602
613
|
description: "Returns a list of all available agents in the system (both code-defined and stored)",
|
|
603
614
|
tags: ["Agents"],
|
|
@@ -614,7 +625,7 @@ var LIST_AGENTS_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
614
625
|
let mergedAgent = agent;
|
|
615
626
|
if (editor) {
|
|
616
627
|
try {
|
|
617
|
-
mergedAgent = await editor.agent.applyStoredOverrides(agent);
|
|
628
|
+
mergedAgent = await editor.agent.applyStoredOverrides(agent, void 0, requestContext);
|
|
618
629
|
} catch {
|
|
619
630
|
}
|
|
620
631
|
}
|
|
@@ -676,9 +687,9 @@ var GET_AGENT_BY_ID_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
676
687
|
method: "GET",
|
|
677
688
|
path: "/agents/:agentId",
|
|
678
689
|
responseType: "json",
|
|
679
|
-
pathParamSchema:
|
|
680
|
-
queryParamSchema:
|
|
681
|
-
responseSchema:
|
|
690
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
691
|
+
queryParamSchema: chunkGUWIV3ZN_cjs.agentVersionQuerySchema,
|
|
692
|
+
responseSchema: chunkGUWIV3ZN_cjs.serializedAgentSchema,
|
|
682
693
|
summary: "Get agent by ID",
|
|
683
694
|
description: "Returns details for a specific agent including configuration, tools, and memory settings. Use query params to control which stored config version is used for overrides: ?status=published (active version, default), ?status=draft (latest draft), or ?versionId=<id> (specific version). Use either status or versionId, not both.",
|
|
684
695
|
tags: ["Agents"],
|
|
@@ -687,7 +698,7 @@ var GET_AGENT_BY_ID_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
687
698
|
handler: async ({ agentId, mastra, requestContext, status, versionId }) => {
|
|
688
699
|
try {
|
|
689
700
|
const versionOptions = versionId ? { versionId } : status ? { status } : void 0;
|
|
690
|
-
const agent = await getAgentFromSystem({ mastra, agentId, versionOptions });
|
|
701
|
+
const agent = await getAgentFromSystem({ mastra, agentId, versionOptions, requestContext });
|
|
691
702
|
const isStudio = false;
|
|
692
703
|
const result = await formatAgent({
|
|
693
704
|
mastra,
|
|
@@ -705,7 +716,7 @@ var CLONE_AGENT_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
705
716
|
method: "POST",
|
|
706
717
|
path: "/agents/:agentId/clone",
|
|
707
718
|
responseType: "json",
|
|
708
|
-
pathParamSchema:
|
|
719
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
709
720
|
bodySchema: v4.z.object({
|
|
710
721
|
newId: v4.z.string().optional().describe("ID for the cloned agent. If not provided, derived from agent ID."),
|
|
711
722
|
newName: v4.z.string().optional().describe('Name for the cloned agent. Defaults to "{name} (Clone)".'),
|
|
@@ -746,9 +757,9 @@ var GENERATE_AGENT_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
746
757
|
method: "POST",
|
|
747
758
|
path: "/agents/:agentId/generate",
|
|
748
759
|
responseType: "json",
|
|
749
|
-
pathParamSchema:
|
|
750
|
-
bodySchema:
|
|
751
|
-
responseSchema:
|
|
760
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
761
|
+
bodySchema: chunkGUWIV3ZN_cjs.agentExecutionBodySchema,
|
|
762
|
+
responseSchema: chunkGUWIV3ZN_cjs.generateResponseSchema,
|
|
752
763
|
summary: "Generate agent response",
|
|
753
764
|
description: "Executes an agent with the provided messages and returns the complete response",
|
|
754
765
|
tags: ["Agents"],
|
|
@@ -756,14 +767,18 @@ var GENERATE_AGENT_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
756
767
|
requiresPermission: "agents:execute",
|
|
757
768
|
handler: async ({ agentId, mastra, abortSignal, requestContext: serverRequestContext, ...params }) => {
|
|
758
769
|
try {
|
|
770
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
771
|
+
const { messages, memory: memoryOption, requestContext: bodyRequestContext, versions, ...rest } = params;
|
|
772
|
+
chunk2CFH32YO_cjs.validateBody({ messages });
|
|
759
773
|
const agent = await getAgentFromSystem({
|
|
760
774
|
mastra,
|
|
761
775
|
agentId,
|
|
762
|
-
versionOptions: extractVersionOptions(
|
|
776
|
+
versionOptions: extractVersionOptions(
|
|
777
|
+
serverRequestContext,
|
|
778
|
+
bodyRequestContext
|
|
779
|
+
),
|
|
780
|
+
requestContext: serverRequestContext
|
|
763
781
|
});
|
|
764
|
-
chunkLWK57QIA_cjs.sanitizeBody(params, ["tools"]);
|
|
765
|
-
const { messages, memory: memoryOption, requestContext: bodyRequestContext, versions, ...rest } = params;
|
|
766
|
-
chunkLWK57QIA_cjs.validateBody({ messages });
|
|
767
782
|
if (bodyRequestContext && typeof bodyRequestContext === "object") {
|
|
768
783
|
for (const [key, value] of Object.entries(bodyRequestContext)) {
|
|
769
784
|
if (serverRequestContext.get(key) === void 0) {
|
|
@@ -775,13 +790,13 @@ var GENERATE_AGENT_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
775
790
|
let authorizedMemoryOption = memoryOption;
|
|
776
791
|
if (memoryOption) {
|
|
777
792
|
const clientThreadId = typeof memoryOption.thread === "string" ? memoryOption.thread : memoryOption.thread?.id;
|
|
778
|
-
const effectiveResourceId =
|
|
779
|
-
const effectiveThreadId =
|
|
793
|
+
const effectiveResourceId = chunk2CFH32YO_cjs.getEffectiveResourceId(serverRequestContext, memoryOption.resource);
|
|
794
|
+
const effectiveThreadId = chunk2CFH32YO_cjs.getEffectiveThreadId(serverRequestContext, clientThreadId);
|
|
780
795
|
if (effectiveThreadId && effectiveResourceId) {
|
|
781
796
|
const memoryInstance = await agent.getMemory({ requestContext: serverRequestContext });
|
|
782
797
|
if (memoryInstance) {
|
|
783
798
|
const thread = await memoryInstance.getThreadById({ threadId: effectiveThreadId });
|
|
784
|
-
await
|
|
799
|
+
await chunk2CFH32YO_cjs.validateThreadOwnership(thread, effectiveResourceId);
|
|
785
800
|
}
|
|
786
801
|
}
|
|
787
802
|
authorizedMemoryOption = {
|
|
@@ -808,9 +823,9 @@ var GENERATE_LEGACY_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
808
823
|
method: "POST",
|
|
809
824
|
path: "/agents/:agentId/generate-legacy",
|
|
810
825
|
responseType: "json",
|
|
811
|
-
pathParamSchema:
|
|
812
|
-
bodySchema:
|
|
813
|
-
responseSchema:
|
|
826
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
827
|
+
bodySchema: chunkGUWIV3ZN_cjs.agentExecutionLegacyBodySchema,
|
|
828
|
+
responseSchema: chunkGUWIV3ZN_cjs.generateResponseSchema,
|
|
814
829
|
summary: "[DEPRECATED] Generate with legacy format",
|
|
815
830
|
description: "Legacy endpoint for generating agent responses. Use /agents/:agentId/generate instead.",
|
|
816
831
|
tags: ["Agents", "Legacy"],
|
|
@@ -820,14 +835,15 @@ var GENERATE_LEGACY_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
820
835
|
const agent = await getAgentFromSystem({
|
|
821
836
|
mastra,
|
|
822
837
|
agentId,
|
|
823
|
-
versionOptions: extractVersionOptions(requestContext)
|
|
838
|
+
versionOptions: extractVersionOptions(requestContext),
|
|
839
|
+
requestContext
|
|
824
840
|
});
|
|
825
|
-
|
|
841
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
826
842
|
const { messages, resourceId, resourceid, threadId, ...rest } = params;
|
|
827
843
|
const clientResourceId = resourceId ?? resourceid;
|
|
828
|
-
const effectiveResourceId =
|
|
829
|
-
const effectiveThreadId =
|
|
830
|
-
|
|
844
|
+
const effectiveResourceId = chunk2CFH32YO_cjs.getEffectiveResourceId(requestContext, clientResourceId);
|
|
845
|
+
const effectiveThreadId = chunk2CFH32YO_cjs.getEffectiveThreadId(requestContext, threadId);
|
|
846
|
+
chunk2CFH32YO_cjs.validateBody({ messages });
|
|
831
847
|
if (effectiveThreadId && !effectiveResourceId || !effectiveThreadId && effectiveResourceId) {
|
|
832
848
|
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Both threadId or resourceId must be provided" });
|
|
833
849
|
}
|
|
@@ -835,7 +851,7 @@ var GENERATE_LEGACY_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
835
851
|
const memory = await agent.getMemory({ requestContext });
|
|
836
852
|
if (memory) {
|
|
837
853
|
const thread = await memory.getThreadById({ threadId: effectiveThreadId });
|
|
838
|
-
await
|
|
854
|
+
await chunk2CFH32YO_cjs.validateThreadOwnership(thread, effectiveResourceId);
|
|
839
855
|
}
|
|
840
856
|
}
|
|
841
857
|
const result = await agent.generateLegacy(messages, {
|
|
@@ -854,9 +870,9 @@ var STREAM_GENERATE_LEGACY_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
854
870
|
method: "POST",
|
|
855
871
|
path: "/agents/:agentId/stream-legacy",
|
|
856
872
|
responseType: "datastream-response",
|
|
857
|
-
pathParamSchema:
|
|
858
|
-
bodySchema:
|
|
859
|
-
responseSchema:
|
|
873
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
874
|
+
bodySchema: chunkGUWIV3ZN_cjs.agentExecutionLegacyBodySchema,
|
|
875
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
860
876
|
summary: "[DEPRECATED] Stream with legacy format",
|
|
861
877
|
description: "Legacy endpoint for streaming agent responses. Use /agents/:agentId/stream instead.",
|
|
862
878
|
tags: ["Agents", "Legacy"],
|
|
@@ -866,14 +882,15 @@ var STREAM_GENERATE_LEGACY_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
866
882
|
const agent = await getAgentFromSystem({
|
|
867
883
|
mastra,
|
|
868
884
|
agentId,
|
|
869
|
-
versionOptions: extractVersionOptions(requestContext)
|
|
885
|
+
versionOptions: extractVersionOptions(requestContext),
|
|
886
|
+
requestContext
|
|
870
887
|
});
|
|
871
|
-
|
|
888
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
872
889
|
const { messages, resourceId, resourceid, threadId, ...rest } = params;
|
|
873
890
|
const clientResourceId = resourceId ?? resourceid;
|
|
874
|
-
const effectiveResourceId =
|
|
875
|
-
const effectiveThreadId =
|
|
876
|
-
|
|
891
|
+
const effectiveResourceId = chunk2CFH32YO_cjs.getEffectiveResourceId(requestContext, clientResourceId);
|
|
892
|
+
const effectiveThreadId = chunk2CFH32YO_cjs.getEffectiveThreadId(requestContext, threadId);
|
|
893
|
+
chunk2CFH32YO_cjs.validateBody({ messages });
|
|
877
894
|
if (effectiveThreadId && !effectiveResourceId || !effectiveThreadId && effectiveResourceId) {
|
|
878
895
|
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Both threadId or resourceId must be provided" });
|
|
879
896
|
}
|
|
@@ -881,7 +898,7 @@ var STREAM_GENERATE_LEGACY_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
881
898
|
const memory = await agent.getMemory({ requestContext });
|
|
882
899
|
if (memory) {
|
|
883
900
|
const thread = await memory.getThreadById({ threadId: effectiveThreadId });
|
|
884
|
-
await
|
|
901
|
+
await chunk2CFH32YO_cjs.validateThreadOwnership(thread, effectiveResourceId);
|
|
885
902
|
}
|
|
886
903
|
}
|
|
887
904
|
const streamResult = await agent.streamLegacy(messages, {
|
|
@@ -907,7 +924,7 @@ var GET_PROVIDERS_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
907
924
|
method: "GET",
|
|
908
925
|
path: "/agents/providers",
|
|
909
926
|
responseType: "json",
|
|
910
|
-
responseSchema:
|
|
927
|
+
responseSchema: chunkGUWIV3ZN_cjs.providersResponseSchema,
|
|
911
928
|
summary: "List AI providers",
|
|
912
929
|
description: "Returns a list of all configured AI model providers",
|
|
913
930
|
tags: ["Agents"],
|
|
@@ -957,9 +974,9 @@ var GENERATE_AGENT_VNEXT_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
957
974
|
method: "POST",
|
|
958
975
|
path: "/agents/:agentId/generate/vnext",
|
|
959
976
|
responseType: "json",
|
|
960
|
-
pathParamSchema:
|
|
961
|
-
bodySchema:
|
|
962
|
-
responseSchema:
|
|
977
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
978
|
+
bodySchema: chunkGUWIV3ZN_cjs.agentExecutionBodySchema,
|
|
979
|
+
responseSchema: chunkGUWIV3ZN_cjs.generateResponseSchema,
|
|
963
980
|
summary: "Generate a response from an agent",
|
|
964
981
|
description: "Generate a response from an agent",
|
|
965
982
|
tags: ["Agents"],
|
|
@@ -971,9 +988,9 @@ var STREAM_GENERATE_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
971
988
|
path: "/agents/:agentId/stream",
|
|
972
989
|
responseType: "stream",
|
|
973
990
|
streamFormat: "sse",
|
|
974
|
-
pathParamSchema:
|
|
975
|
-
bodySchema:
|
|
976
|
-
responseSchema:
|
|
991
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
992
|
+
bodySchema: chunkGUWIV3ZN_cjs.agentExecutionBodySchema,
|
|
993
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
977
994
|
summary: "Stream agent response",
|
|
978
995
|
description: "Executes an agent with the provided messages and streams the response in real-time",
|
|
979
996
|
tags: ["Agents"],
|
|
@@ -981,14 +998,18 @@ var STREAM_GENERATE_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
981
998
|
requiresPermission: "agents:execute",
|
|
982
999
|
handler: async ({ mastra, agentId, abortSignal, requestContext: serverRequestContext, ...params }) => {
|
|
983
1000
|
try {
|
|
1001
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
1002
|
+
const { messages, memory: memoryOption, requestContext: bodyRequestContext, versions, ...rest } = params;
|
|
1003
|
+
chunk2CFH32YO_cjs.validateBody({ messages });
|
|
984
1004
|
const agent = await getAgentFromSystem({
|
|
985
1005
|
mastra,
|
|
986
1006
|
agentId,
|
|
987
|
-
versionOptions: extractVersionOptions(
|
|
1007
|
+
versionOptions: extractVersionOptions(
|
|
1008
|
+
serverRequestContext,
|
|
1009
|
+
bodyRequestContext
|
|
1010
|
+
),
|
|
1011
|
+
requestContext: serverRequestContext
|
|
988
1012
|
});
|
|
989
|
-
chunkLWK57QIA_cjs.sanitizeBody(params, ["tools"]);
|
|
990
|
-
const { messages, memory: memoryOption, requestContext: bodyRequestContext, versions, ...rest } = params;
|
|
991
|
-
chunkLWK57QIA_cjs.validateBody({ messages });
|
|
992
1013
|
if (bodyRequestContext && typeof bodyRequestContext === "object") {
|
|
993
1014
|
for (const [key, value] of Object.entries(bodyRequestContext)) {
|
|
994
1015
|
if (serverRequestContext.get(key) === void 0) {
|
|
@@ -1000,13 +1021,13 @@ var STREAM_GENERATE_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1000
1021
|
let authorizedMemoryOption = memoryOption;
|
|
1001
1022
|
if (memoryOption) {
|
|
1002
1023
|
const clientThreadId = typeof memoryOption.thread === "string" ? memoryOption.thread : memoryOption.thread?.id;
|
|
1003
|
-
const effectiveResourceId =
|
|
1004
|
-
const effectiveThreadId =
|
|
1024
|
+
const effectiveResourceId = chunk2CFH32YO_cjs.getEffectiveResourceId(serverRequestContext, memoryOption.resource);
|
|
1025
|
+
const effectiveThreadId = chunk2CFH32YO_cjs.getEffectiveThreadId(serverRequestContext, clientThreadId);
|
|
1005
1026
|
if (effectiveThreadId && effectiveResourceId) {
|
|
1006
1027
|
const memoryInstance = await agent.getMemory({ requestContext: serverRequestContext });
|
|
1007
1028
|
if (memoryInstance) {
|
|
1008
1029
|
const thread = await memoryInstance.getThreadById({ threadId: effectiveThreadId });
|
|
1009
|
-
await
|
|
1030
|
+
await chunk2CFH32YO_cjs.validateThreadOwnership(thread, effectiveResourceId);
|
|
1010
1031
|
}
|
|
1011
1032
|
}
|
|
1012
1033
|
authorizedMemoryOption = {
|
|
@@ -1034,9 +1055,9 @@ var STREAM_UNTIL_IDLE_GENERATE_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1034
1055
|
path: "/agents/:agentId/stream-until-idle",
|
|
1035
1056
|
responseType: "stream",
|
|
1036
1057
|
streamFormat: "sse",
|
|
1037
|
-
pathParamSchema:
|
|
1038
|
-
bodySchema:
|
|
1039
|
-
responseSchema:
|
|
1058
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1059
|
+
bodySchema: chunkGUWIV3ZN_cjs.streamUntilIdleBodySchema,
|
|
1060
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
1040
1061
|
summary: "Stream agent response until idle",
|
|
1041
1062
|
description: "Executes an agent with the provided messages and streams the response in real-time, also listens for background task completions and streams them in real-time",
|
|
1042
1063
|
tags: ["Agents"],
|
|
@@ -1044,14 +1065,18 @@ var STREAM_UNTIL_IDLE_GENERATE_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1044
1065
|
requiresPermission: "agents:execute",
|
|
1045
1066
|
handler: async ({ mastra, agentId, abortSignal, requestContext: serverRequestContext, ...params }) => {
|
|
1046
1067
|
try {
|
|
1068
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
1069
|
+
const { messages, memory: memoryOption, requestContext: bodyRequestContext, ...rest } = params;
|
|
1070
|
+
chunk2CFH32YO_cjs.validateBody({ messages });
|
|
1047
1071
|
const agent = await getAgentFromSystem({
|
|
1048
1072
|
mastra,
|
|
1049
1073
|
agentId,
|
|
1050
|
-
versionOptions: extractVersionOptions(
|
|
1074
|
+
versionOptions: extractVersionOptions(
|
|
1075
|
+
serverRequestContext,
|
|
1076
|
+
bodyRequestContext
|
|
1077
|
+
),
|
|
1078
|
+
requestContext: serverRequestContext
|
|
1051
1079
|
});
|
|
1052
|
-
chunkLWK57QIA_cjs.sanitizeBody(params, ["tools"]);
|
|
1053
|
-
const { messages, memory: memoryOption, requestContext: bodyRequestContext, ...rest } = params;
|
|
1054
|
-
chunkLWK57QIA_cjs.validateBody({ messages });
|
|
1055
1080
|
if (bodyRequestContext && typeof bodyRequestContext === "object") {
|
|
1056
1081
|
for (const [key, value] of Object.entries(bodyRequestContext)) {
|
|
1057
1082
|
if (serverRequestContext.get(key) === void 0) {
|
|
@@ -1062,13 +1087,13 @@ var STREAM_UNTIL_IDLE_GENERATE_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1062
1087
|
let authorizedMemoryOption = memoryOption;
|
|
1063
1088
|
if (memoryOption) {
|
|
1064
1089
|
const clientThreadId = typeof memoryOption.thread === "string" ? memoryOption.thread : memoryOption.thread?.id;
|
|
1065
|
-
const effectiveResourceId =
|
|
1066
|
-
const effectiveThreadId =
|
|
1090
|
+
const effectiveResourceId = chunk2CFH32YO_cjs.getEffectiveResourceId(serverRequestContext, memoryOption.resource);
|
|
1091
|
+
const effectiveThreadId = chunk2CFH32YO_cjs.getEffectiveThreadId(serverRequestContext, clientThreadId);
|
|
1067
1092
|
if (effectiveThreadId && effectiveResourceId) {
|
|
1068
1093
|
const memoryInstance = await agent.getMemory({ requestContext: serverRequestContext });
|
|
1069
1094
|
if (memoryInstance) {
|
|
1070
1095
|
const thread = await memoryInstance.getThreadById({ threadId: effectiveThreadId });
|
|
1071
|
-
await
|
|
1096
|
+
await chunk2CFH32YO_cjs.validateThreadOwnership(thread, effectiveResourceId);
|
|
1072
1097
|
}
|
|
1073
1098
|
}
|
|
1074
1099
|
authorizedMemoryOption = {
|
|
@@ -1095,9 +1120,9 @@ var STREAM_GENERATE_VNEXT_DEPRECATED_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1095
1120
|
method: "POST",
|
|
1096
1121
|
path: "/agents/:agentId/stream/vnext",
|
|
1097
1122
|
responseType: "stream",
|
|
1098
|
-
pathParamSchema:
|
|
1099
|
-
bodySchema:
|
|
1100
|
-
responseSchema:
|
|
1123
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1124
|
+
bodySchema: chunkGUWIV3ZN_cjs.agentExecutionBodySchema,
|
|
1125
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
1101
1126
|
summary: "Stream a response from an agent",
|
|
1102
1127
|
description: "[DEPRECATED] This endpoint is deprecated. Please use /stream instead.",
|
|
1103
1128
|
tags: ["Agents"],
|
|
@@ -1105,14 +1130,101 @@ var STREAM_GENERATE_VNEXT_DEPRECATED_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1105
1130
|
deprecated: true,
|
|
1106
1131
|
handler: STREAM_GENERATE_ROUTE.handler
|
|
1107
1132
|
});
|
|
1133
|
+
var OBSERVE_AGENT_STREAM_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
1134
|
+
method: "POST",
|
|
1135
|
+
path: "/agents/:agentId/observe",
|
|
1136
|
+
responseType: "stream",
|
|
1137
|
+
streamFormat: "sse",
|
|
1138
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1139
|
+
bodySchema: chunkGUWIV3ZN_cjs.observeAgentBodySchema,
|
|
1140
|
+
responseSchema: chunkGUWIV3ZN_cjs.observeAgentResponseSchema,
|
|
1141
|
+
summary: "Observe agent stream",
|
|
1142
|
+
description: "Reconnect to an existing agent stream to receive missed events. Supports position-based resume with offset for efficient reconnection.",
|
|
1143
|
+
tags: ["Agents", "Streaming"],
|
|
1144
|
+
requiresAuth: true,
|
|
1145
|
+
handler: async ({ mastra, agentId, runId, offset, abortSignal }) => {
|
|
1146
|
+
try {
|
|
1147
|
+
let cleanup2 = function(controller) {
|
|
1148
|
+
if (idleTimer) {
|
|
1149
|
+
clearTimeout(idleTimer);
|
|
1150
|
+
idleTimer = null;
|
|
1151
|
+
}
|
|
1152
|
+
if (handleEvent) {
|
|
1153
|
+
void pubsub.unsubscribe(topic, handleEvent);
|
|
1154
|
+
handleEvent = null;
|
|
1155
|
+
}
|
|
1156
|
+
try {
|
|
1157
|
+
controller.close();
|
|
1158
|
+
} catch {
|
|
1159
|
+
}
|
|
1160
|
+
}, resetIdleTimer2 = function(controller) {
|
|
1161
|
+
if (idleTimer) clearTimeout(idleTimer);
|
|
1162
|
+
idleTimer = setTimeout(() => cleanup2(controller), IDLE_TIMEOUT_MS);
|
|
1163
|
+
};
|
|
1164
|
+
const agent$1 = await getAgentFromSystem({ mastra, agentId });
|
|
1165
|
+
const agentPubsub = agent.isDurableAgentLike(agent$1) ? agent$1.pubsub : void 0;
|
|
1166
|
+
const pubsub = agentPubsub ?? mastra.pubsub;
|
|
1167
|
+
const topic = durable.AGENT_STREAM_TOPIC(runId);
|
|
1168
|
+
let handleEvent = null;
|
|
1169
|
+
let idleTimer = null;
|
|
1170
|
+
const IDLE_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
1171
|
+
const stream = new ReadableStream({
|
|
1172
|
+
start(controller) {
|
|
1173
|
+
if (abortSignal) {
|
|
1174
|
+
if (abortSignal.aborted) {
|
|
1175
|
+
cleanup2(controller);
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1178
|
+
abortSignal.addEventListener("abort", () => cleanup2(controller), { once: true });
|
|
1179
|
+
}
|
|
1180
|
+
resetIdleTimer2(controller);
|
|
1181
|
+
handleEvent = (event) => {
|
|
1182
|
+
const isTerminal = event.type === "finish" || event.type === "error";
|
|
1183
|
+
try {
|
|
1184
|
+
controller.enqueue(event);
|
|
1185
|
+
} catch {
|
|
1186
|
+
}
|
|
1187
|
+
if (isTerminal) {
|
|
1188
|
+
cleanup2(controller);
|
|
1189
|
+
} else {
|
|
1190
|
+
resetIdleTimer2(controller);
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
const subscribePromise = offset !== void 0 ? pubsub.subscribeFromOffset(topic, offset, handleEvent) : pubsub.subscribeWithReplay(topic, handleEvent);
|
|
1194
|
+
subscribePromise.catch((error) => {
|
|
1195
|
+
console.error(`[ObserveAgentStream] Failed to subscribe to ${topic}:`, error);
|
|
1196
|
+
if (idleTimer) {
|
|
1197
|
+
clearTimeout(idleTimer);
|
|
1198
|
+
idleTimer = null;
|
|
1199
|
+
}
|
|
1200
|
+
controller.error(error);
|
|
1201
|
+
});
|
|
1202
|
+
},
|
|
1203
|
+
cancel() {
|
|
1204
|
+
if (idleTimer) {
|
|
1205
|
+
clearTimeout(idleTimer);
|
|
1206
|
+
idleTimer = null;
|
|
1207
|
+
}
|
|
1208
|
+
if (handleEvent) {
|
|
1209
|
+
void pubsub.unsubscribe(topic, handleEvent);
|
|
1210
|
+
handleEvent = null;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1214
|
+
return stream;
|
|
1215
|
+
} catch (error) {
|
|
1216
|
+
return chunkB34S64RC_cjs.handleError(error, "error observing agent stream");
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1108
1220
|
var APPROVE_TOOL_CALL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
1109
1221
|
method: "POST",
|
|
1110
1222
|
path: "/agents/:agentId/approve-tool-call",
|
|
1111
1223
|
responseType: "stream",
|
|
1112
1224
|
streamFormat: "sse",
|
|
1113
|
-
pathParamSchema:
|
|
1114
|
-
bodySchema:
|
|
1115
|
-
responseSchema:
|
|
1225
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1226
|
+
bodySchema: chunkGUWIV3ZN_cjs.approveToolCallBodySchema,
|
|
1227
|
+
responseSchema: chunkGUWIV3ZN_cjs.toolCallResponseSchema,
|
|
1116
1228
|
summary: "Approve tool call",
|
|
1117
1229
|
description: "Approves a pending tool call and continues agent execution",
|
|
1118
1230
|
tags: ["Agents", "Tools"],
|
|
@@ -1130,7 +1242,7 @@ var APPROVE_TOOL_CALL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1130
1242
|
if (!params.toolCallId) {
|
|
1131
1243
|
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Tool call id is required" });
|
|
1132
1244
|
}
|
|
1133
|
-
|
|
1245
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
1134
1246
|
const streamResult = await agent.approveToolCall({
|
|
1135
1247
|
...params,
|
|
1136
1248
|
requestContext,
|
|
@@ -1147,9 +1259,9 @@ var DECLINE_TOOL_CALL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1147
1259
|
path: "/agents/:agentId/decline-tool-call",
|
|
1148
1260
|
responseType: "stream",
|
|
1149
1261
|
streamFormat: "sse",
|
|
1150
|
-
pathParamSchema:
|
|
1151
|
-
bodySchema:
|
|
1152
|
-
responseSchema:
|
|
1262
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1263
|
+
bodySchema: chunkGUWIV3ZN_cjs.declineToolCallBodySchema,
|
|
1264
|
+
responseSchema: chunkGUWIV3ZN_cjs.toolCallResponseSchema,
|
|
1153
1265
|
summary: "Decline tool call",
|
|
1154
1266
|
description: "Declines a pending tool call and continues agent execution without executing the tool",
|
|
1155
1267
|
tags: ["Agents", "Tools"],
|
|
@@ -1167,7 +1279,7 @@ var DECLINE_TOOL_CALL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1167
1279
|
if (!params.toolCallId) {
|
|
1168
1280
|
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Tool call id is required" });
|
|
1169
1281
|
}
|
|
1170
|
-
|
|
1282
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
1171
1283
|
const streamResult = await agent.declineToolCall({
|
|
1172
1284
|
...params,
|
|
1173
1285
|
requestContext,
|
|
@@ -1184,9 +1296,9 @@ var RESUME_STREAM_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1184
1296
|
path: "/agents/:agentId/resume-stream",
|
|
1185
1297
|
responseType: "stream",
|
|
1186
1298
|
streamFormat: "sse",
|
|
1187
|
-
pathParamSchema:
|
|
1188
|
-
bodySchema:
|
|
1189
|
-
responseSchema:
|
|
1299
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1300
|
+
bodySchema: chunkGUWIV3ZN_cjs.resumeStreamBodySchema,
|
|
1301
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
1190
1302
|
summary: "Resume agent stream",
|
|
1191
1303
|
description: "Resumes a suspended agent stream with custom resume data",
|
|
1192
1304
|
tags: ["Agents"],
|
|
@@ -1194,15 +1306,10 @@ var RESUME_STREAM_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1194
1306
|
requiresPermission: "agents:execute",
|
|
1195
1307
|
handler: async ({ mastra, agentId, abortSignal, requestContext: serverRequestContext, ...params }) => {
|
|
1196
1308
|
try {
|
|
1197
|
-
const agent = await getAgentFromSystem({
|
|
1198
|
-
mastra,
|
|
1199
|
-
agentId,
|
|
1200
|
-
versionOptions: extractVersionOptions(serverRequestContext)
|
|
1201
|
-
});
|
|
1202
1309
|
if (!params.runId) {
|
|
1203
1310
|
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run id is required" });
|
|
1204
1311
|
}
|
|
1205
|
-
|
|
1312
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
1206
1313
|
const {
|
|
1207
1314
|
resumeData,
|
|
1208
1315
|
runId,
|
|
@@ -1212,6 +1319,14 @@ var RESUME_STREAM_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1212
1319
|
versions,
|
|
1213
1320
|
...rest
|
|
1214
1321
|
} = params;
|
|
1322
|
+
const agent = await getAgentFromSystem({
|
|
1323
|
+
mastra,
|
|
1324
|
+
agentId,
|
|
1325
|
+
versionOptions: extractVersionOptions(
|
|
1326
|
+
serverRequestContext,
|
|
1327
|
+
bodyRequestContext
|
|
1328
|
+
)
|
|
1329
|
+
});
|
|
1215
1330
|
if (bodyRequestContext && typeof bodyRequestContext === "object") {
|
|
1216
1331
|
for (const [key, value] of Object.entries(bodyRequestContext)) {
|
|
1217
1332
|
if (serverRequestContext.get(key) === void 0) {
|
|
@@ -1222,13 +1337,13 @@ var RESUME_STREAM_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1222
1337
|
stashVersionOverrides(serverRequestContext, versions);
|
|
1223
1338
|
let authorizedMemoryOption = memoryOption;
|
|
1224
1339
|
const clientThreadId = typeof memoryOption?.thread === "string" ? memoryOption.thread : memoryOption?.thread?.id;
|
|
1225
|
-
const effectiveResourceId =
|
|
1226
|
-
const effectiveThreadId =
|
|
1340
|
+
const effectiveResourceId = chunk2CFH32YO_cjs.getEffectiveResourceId(serverRequestContext, memoryOption?.resource);
|
|
1341
|
+
const effectiveThreadId = chunk2CFH32YO_cjs.getEffectiveThreadId(serverRequestContext, clientThreadId);
|
|
1227
1342
|
if (effectiveThreadId && effectiveResourceId) {
|
|
1228
1343
|
const memoryInstance = await agent.getMemory({ requestContext: serverRequestContext });
|
|
1229
1344
|
if (memoryInstance) {
|
|
1230
1345
|
const thread = await memoryInstance.getThreadById({ threadId: effectiveThreadId });
|
|
1231
|
-
await
|
|
1346
|
+
await chunk2CFH32YO_cjs.validateThreadOwnership(thread, effectiveResourceId);
|
|
1232
1347
|
}
|
|
1233
1348
|
}
|
|
1234
1349
|
if (memoryOption || effectiveResourceId || effectiveThreadId) {
|
|
@@ -1240,7 +1355,7 @@ var RESUME_STREAM_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1240
1355
|
}
|
|
1241
1356
|
const workflowsStore = await mastra.getStorage()?.getStore("workflows");
|
|
1242
1357
|
const workflowRun = await workflowsStore?.getWorkflowRunById({ workflowName: "agentic-loop", runId });
|
|
1243
|
-
await
|
|
1358
|
+
await chunk2CFH32YO_cjs.validateRunOwnership(workflowRun, chunk2CFH32YO_cjs.getEffectiveResourceId(serverRequestContext, void 0));
|
|
1244
1359
|
const { structuredOutput, ...restOptions } = rest;
|
|
1245
1360
|
const options = {
|
|
1246
1361
|
runId,
|
|
@@ -1261,9 +1376,9 @@ var APPROVE_TOOL_CALL_GENERATE_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1261
1376
|
method: "POST",
|
|
1262
1377
|
path: "/agents/:agentId/approve-tool-call-generate",
|
|
1263
1378
|
responseType: "json",
|
|
1264
|
-
pathParamSchema:
|
|
1265
|
-
bodySchema:
|
|
1266
|
-
responseSchema:
|
|
1379
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1380
|
+
bodySchema: chunkGUWIV3ZN_cjs.approveToolCallBodySchema,
|
|
1381
|
+
responseSchema: chunkGUWIV3ZN_cjs.generateResponseSchema,
|
|
1267
1382
|
summary: "Approve tool call (non-streaming)",
|
|
1268
1383
|
description: "Approves a pending tool call and returns the complete response",
|
|
1269
1384
|
tags: ["Agents", "Tools"],
|
|
@@ -1281,7 +1396,7 @@ var APPROVE_TOOL_CALL_GENERATE_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1281
1396
|
if (!params.toolCallId) {
|
|
1282
1397
|
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Tool call id is required" });
|
|
1283
1398
|
}
|
|
1284
|
-
|
|
1399
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
1285
1400
|
const result = await agent.approveToolCallGenerate({
|
|
1286
1401
|
...params,
|
|
1287
1402
|
requestContext,
|
|
@@ -1297,9 +1412,9 @@ var DECLINE_TOOL_CALL_GENERATE_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1297
1412
|
method: "POST",
|
|
1298
1413
|
path: "/agents/:agentId/decline-tool-call-generate",
|
|
1299
1414
|
responseType: "json",
|
|
1300
|
-
pathParamSchema:
|
|
1301
|
-
bodySchema:
|
|
1302
|
-
responseSchema:
|
|
1415
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1416
|
+
bodySchema: chunkGUWIV3ZN_cjs.declineToolCallBodySchema,
|
|
1417
|
+
responseSchema: chunkGUWIV3ZN_cjs.generateResponseSchema,
|
|
1303
1418
|
summary: "Decline tool call (non-streaming)",
|
|
1304
1419
|
description: "Declines a pending tool call and returns the complete response",
|
|
1305
1420
|
tags: ["Agents", "Tools"],
|
|
@@ -1317,7 +1432,7 @@ var DECLINE_TOOL_CALL_GENERATE_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1317
1432
|
if (!params.toolCallId) {
|
|
1318
1433
|
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Tool call id is required" });
|
|
1319
1434
|
}
|
|
1320
|
-
|
|
1435
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
1321
1436
|
const result = await agent.declineToolCallGenerate({
|
|
1322
1437
|
...params,
|
|
1323
1438
|
requestContext,
|
|
@@ -1334,9 +1449,9 @@ var STREAM_NETWORK_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1334
1449
|
path: "/agents/:agentId/network",
|
|
1335
1450
|
responseType: "stream",
|
|
1336
1451
|
streamFormat: "sse",
|
|
1337
|
-
pathParamSchema:
|
|
1338
|
-
bodySchema:
|
|
1339
|
-
responseSchema:
|
|
1452
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1453
|
+
bodySchema: chunkGUWIV3ZN_cjs.agentExecutionBodySchema,
|
|
1454
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
1340
1455
|
summary: "Stream agent network",
|
|
1341
1456
|
description: "Executes an agent network with multiple agents and streams the response",
|
|
1342
1457
|
tags: ["Agents"],
|
|
@@ -1348,8 +1463,8 @@ var STREAM_NETWORK_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1348
1463
|
agentId,
|
|
1349
1464
|
versionOptions: extractVersionOptions(requestContext)
|
|
1350
1465
|
});
|
|
1351
|
-
|
|
1352
|
-
|
|
1466
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
1467
|
+
chunk2CFH32YO_cjs.validateBody({ messages });
|
|
1353
1468
|
const streamResult = await agent.network(messages, {
|
|
1354
1469
|
...params
|
|
1355
1470
|
});
|
|
@@ -1364,9 +1479,9 @@ var APPROVE_NETWORK_TOOL_CALL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1364
1479
|
path: "/agents/:agentId/approve-network-tool-call",
|
|
1365
1480
|
responseType: "stream",
|
|
1366
1481
|
streamFormat: "sse",
|
|
1367
|
-
pathParamSchema:
|
|
1368
|
-
bodySchema:
|
|
1369
|
-
responseSchema:
|
|
1482
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1483
|
+
bodySchema: chunkGUWIV3ZN_cjs.approveNetworkToolCallBodySchema,
|
|
1484
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
1370
1485
|
summary: "Approve network tool call",
|
|
1371
1486
|
description: "Approves a pending network tool call and continues network agent execution",
|
|
1372
1487
|
tags: ["Agents", "Tools"],
|
|
@@ -1381,7 +1496,7 @@ var APPROVE_NETWORK_TOOL_CALL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1381
1496
|
if (!params.runId) {
|
|
1382
1497
|
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run id is required" });
|
|
1383
1498
|
}
|
|
1384
|
-
|
|
1499
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
1385
1500
|
const streamResult = await agent.approveNetworkToolCall({
|
|
1386
1501
|
...params
|
|
1387
1502
|
});
|
|
@@ -1396,9 +1511,9 @@ var DECLINE_NETWORK_TOOL_CALL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1396
1511
|
path: "/agents/:agentId/decline-network-tool-call",
|
|
1397
1512
|
responseType: "stream",
|
|
1398
1513
|
streamFormat: "sse",
|
|
1399
|
-
pathParamSchema:
|
|
1400
|
-
bodySchema:
|
|
1401
|
-
responseSchema:
|
|
1514
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1515
|
+
bodySchema: chunkGUWIV3ZN_cjs.declineNetworkToolCallBodySchema,
|
|
1516
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
1402
1517
|
summary: "Decline network tool call",
|
|
1403
1518
|
description: "Declines a pending network tool call and continues network agent execution without executing the tool",
|
|
1404
1519
|
tags: ["Agents", "Tools"],
|
|
@@ -1413,7 +1528,7 @@ var DECLINE_NETWORK_TOOL_CALL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1413
1528
|
if (!params.runId) {
|
|
1414
1529
|
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run id is required" });
|
|
1415
1530
|
}
|
|
1416
|
-
|
|
1531
|
+
chunk2CFH32YO_cjs.sanitizeBody(params, ["tools"]);
|
|
1417
1532
|
const streamResult = await agent.declineNetworkToolCall({
|
|
1418
1533
|
...params
|
|
1419
1534
|
});
|
|
@@ -1427,9 +1542,9 @@ var UPDATE_AGENT_MODEL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1427
1542
|
method: "POST",
|
|
1428
1543
|
path: "/agents/:agentId/model",
|
|
1429
1544
|
responseType: "json",
|
|
1430
|
-
pathParamSchema:
|
|
1431
|
-
bodySchema:
|
|
1432
|
-
responseSchema:
|
|
1545
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1546
|
+
bodySchema: chunkGUWIV3ZN_cjs.updateAgentModelBodySchema,
|
|
1547
|
+
responseSchema: chunkGUWIV3ZN_cjs.modelManagementResponseSchema,
|
|
1433
1548
|
summary: "Update agent model",
|
|
1434
1549
|
description: "Updates the AI model used by the agent",
|
|
1435
1550
|
tags: ["Agents", "Models"],
|
|
@@ -1449,8 +1564,8 @@ var RESET_AGENT_MODEL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1449
1564
|
method: "POST",
|
|
1450
1565
|
path: "/agents/:agentId/model/reset",
|
|
1451
1566
|
responseType: "json",
|
|
1452
|
-
pathParamSchema:
|
|
1453
|
-
responseSchema:
|
|
1567
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1568
|
+
responseSchema: chunkGUWIV3ZN_cjs.modelManagementResponseSchema,
|
|
1454
1569
|
summary: "Reset agent model",
|
|
1455
1570
|
description: "Resets the agent model to its original configuration",
|
|
1456
1571
|
tags: ["Agents", "Models"],
|
|
@@ -1469,9 +1584,9 @@ var REORDER_AGENT_MODEL_LIST_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1469
1584
|
method: "POST",
|
|
1470
1585
|
path: "/agents/:agentId/models/reorder",
|
|
1471
1586
|
responseType: "json",
|
|
1472
|
-
pathParamSchema:
|
|
1473
|
-
bodySchema:
|
|
1474
|
-
responseSchema:
|
|
1587
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1588
|
+
bodySchema: chunkGUWIV3ZN_cjs.reorderAgentModelListBodySchema,
|
|
1589
|
+
responseSchema: chunkGUWIV3ZN_cjs.modelManagementResponseSchema,
|
|
1475
1590
|
summary: "Reorder agent model list",
|
|
1476
1591
|
description: "Reorders the model list for agents with multiple model configurations",
|
|
1477
1592
|
tags: ["Agents", "Models"],
|
|
@@ -1494,9 +1609,9 @@ var UPDATE_AGENT_MODEL_IN_MODEL_LIST_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1494
1609
|
method: "POST",
|
|
1495
1610
|
path: "/agents/:agentId/models/:modelConfigId",
|
|
1496
1611
|
responseType: "json",
|
|
1497
|
-
pathParamSchema:
|
|
1498
|
-
bodySchema:
|
|
1499
|
-
responseSchema:
|
|
1612
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.modelConfigIdPathParams,
|
|
1613
|
+
bodySchema: chunkGUWIV3ZN_cjs.updateAgentModelInModelListBodySchema,
|
|
1614
|
+
responseSchema: chunkGUWIV3ZN_cjs.modelManagementResponseSchema,
|
|
1500
1615
|
summary: "Update model in model list",
|
|
1501
1616
|
description: "Updates a specific model configuration in the agent model list",
|
|
1502
1617
|
tags: ["Agents", "Models"],
|
|
@@ -1597,9 +1712,9 @@ var ENHANCE_INSTRUCTIONS_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1597
1712
|
method: "POST",
|
|
1598
1713
|
path: "/agents/:agentId/instructions/enhance",
|
|
1599
1714
|
responseType: "json",
|
|
1600
|
-
pathParamSchema:
|
|
1601
|
-
bodySchema:
|
|
1602
|
-
responseSchema:
|
|
1715
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1716
|
+
bodySchema: chunkGUWIV3ZN_cjs.enhanceInstructionsBodySchema,
|
|
1717
|
+
responseSchema: chunkGUWIV3ZN_cjs.enhanceInstructionsResponseSchema,
|
|
1603
1718
|
summary: "Enhance agent instructions",
|
|
1604
1719
|
description: "Uses AI to enhance or modify agent instructions based on user feedback",
|
|
1605
1720
|
tags: ["Agents"],
|
|
@@ -1625,7 +1740,7 @@ Current: ${instructions}
|
|
|
1625
1740
|
${comment ? `User feedback: ${comment}` : ""}`,
|
|
1626
1741
|
{
|
|
1627
1742
|
structuredOutput: {
|
|
1628
|
-
schema:
|
|
1743
|
+
schema: chunkGUWIV3ZN_cjs.enhanceInstructionsResponseSchema
|
|
1629
1744
|
}
|
|
1630
1745
|
}
|
|
1631
1746
|
);
|
|
@@ -1639,9 +1754,9 @@ var STREAM_VNEXT_DEPRECATED_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1639
1754
|
method: "POST",
|
|
1640
1755
|
path: "/agents/:agentId/streamVNext",
|
|
1641
1756
|
responseType: "stream",
|
|
1642
|
-
pathParamSchema:
|
|
1643
|
-
bodySchema:
|
|
1644
|
-
responseSchema:
|
|
1757
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1758
|
+
bodySchema: chunkGUWIV3ZN_cjs.agentExecutionBodySchema,
|
|
1759
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
1645
1760
|
summary: "Stream a response from an agent",
|
|
1646
1761
|
description: "[DEPRECATED] This endpoint is deprecated. Please use /stream instead.",
|
|
1647
1762
|
tags: ["Agents"],
|
|
@@ -1655,9 +1770,9 @@ var STREAM_UI_MESSAGE_VNEXT_DEPRECATED_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1655
1770
|
method: "POST",
|
|
1656
1771
|
path: "/agents/:agentId/stream/vnext/ui",
|
|
1657
1772
|
responseType: "stream",
|
|
1658
|
-
pathParamSchema:
|
|
1659
|
-
bodySchema:
|
|
1660
|
-
responseSchema:
|
|
1773
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1774
|
+
bodySchema: chunkGUWIV3ZN_cjs.agentExecutionBodySchema,
|
|
1775
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
1661
1776
|
summary: "Stream UI messages from an agent",
|
|
1662
1777
|
description: "[DEPRECATED] This endpoint is deprecated. Please use the @mastra/ai-sdk package for uiMessage transformations",
|
|
1663
1778
|
tags: ["Agents"],
|
|
@@ -1680,9 +1795,9 @@ var STREAM_UI_MESSAGE_DEPRECATED_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1680
1795
|
method: "POST",
|
|
1681
1796
|
path: "/agents/:agentId/stream/ui",
|
|
1682
1797
|
responseType: "stream",
|
|
1683
|
-
pathParamSchema:
|
|
1684
|
-
bodySchema:
|
|
1685
|
-
responseSchema:
|
|
1798
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentIdPathParams,
|
|
1799
|
+
bodySchema: chunkGUWIV3ZN_cjs.agentExecutionBodySchema,
|
|
1800
|
+
responseSchema: chunkGUWIV3ZN_cjs.streamResponseSchema,
|
|
1686
1801
|
summary: "Stream UI messages from an agent",
|
|
1687
1802
|
description: "[DEPRECATED] This endpoint is deprecated. Please use the @mastra/ai-sdk package for uiMessage transformations",
|
|
1688
1803
|
tags: ["Agents"],
|
|
@@ -1694,7 +1809,7 @@ var GET_AGENT_SKILL_ROUTE = chunk5UKYK7YK_cjs.createRoute({
|
|
|
1694
1809
|
method: "GET",
|
|
1695
1810
|
path: "/agents/:agentId/skills/:skillName",
|
|
1696
1811
|
responseType: "json",
|
|
1697
|
-
pathParamSchema:
|
|
1812
|
+
pathParamSchema: chunkGUWIV3ZN_cjs.agentSkillPathParams,
|
|
1698
1813
|
queryParamSchema: chunkHXICAUTW_cjs.skillDisambiguationQuerySchema,
|
|
1699
1814
|
responseSchema: chunkHXICAUTW_cjs.getAgentSkillResponseSchema,
|
|
1700
1815
|
summary: "Get agent skill",
|
|
@@ -1749,6 +1864,7 @@ exports.GET_AGENT_BY_ID_ROUTE = GET_AGENT_BY_ID_ROUTE;
|
|
|
1749
1864
|
exports.GET_AGENT_SKILL_ROUTE = GET_AGENT_SKILL_ROUTE;
|
|
1750
1865
|
exports.GET_PROVIDERS_ROUTE = GET_PROVIDERS_ROUTE;
|
|
1751
1866
|
exports.LIST_AGENTS_ROUTE = LIST_AGENTS_ROUTE;
|
|
1867
|
+
exports.OBSERVE_AGENT_STREAM_ROUTE = OBSERVE_AGENT_STREAM_ROUTE;
|
|
1752
1868
|
exports.REORDER_AGENT_MODEL_LIST_ROUTE = REORDER_AGENT_MODEL_LIST_ROUTE;
|
|
1753
1869
|
exports.RESET_AGENT_MODEL_ROUTE = RESET_AGENT_MODEL_ROUTE;
|
|
1754
1870
|
exports.RESUME_STREAM_ROUTE = RESUME_STREAM_ROUTE;
|
|
@@ -1771,5 +1887,5 @@ exports.getSerializedProcessors = getSerializedProcessors;
|
|
|
1771
1887
|
exports.getSerializedSkillsFromAgent = getSerializedSkillsFromAgent;
|
|
1772
1888
|
exports.getWorkspaceToolsFromAgent = getWorkspaceToolsFromAgent;
|
|
1773
1889
|
exports.isProviderConnected = isProviderConnected;
|
|
1774
|
-
//# sourceMappingURL=chunk-
|
|
1775
|
-
//# sourceMappingURL=chunk-
|
|
1890
|
+
//# sourceMappingURL=chunk-KI7TGMMV.cjs.map
|
|
1891
|
+
//# sourceMappingURL=chunk-KI7TGMMV.cjs.map
|