@mastra/server 1.86.0-alpha.7 → 1.86.0-alpha.9
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/dist/{a2a-WPGF38fX.js → a2a-CY7rgzPe.js} +1 -1
- package/dist/{a2a-vSZkdSRE.cjs → a2a-DwjvHqcb.cjs} +1 -1
- package/dist/{agent-builder-C4AIqOxt.js → agent-builder-DHnNRROR.js} +2 -2
- package/dist/{agent-builder-dZlRNj1k.cjs → agent-builder-anRH1X35.cjs} +2 -2
- package/dist/{agent-controller-BHJDvCaS.cjs → agent-controller-BP-CFfsg.cjs} +9 -9
- package/dist/{agent-controller-NRR6SK66.js → agent-controller-CzKnfKkw.js} +9 -9
- package/dist/{agent-versions-CwWhEoU5.cjs → agent-versions-0q4KKmLv.cjs} +12 -12
- package/dist/{agent-versions-DfcKpYNW.js → agent-versions-Pml6WNbA.js} +12 -12
- package/dist/{agents-272TP94y.js → agents-CAXsXenf.js} +32 -3
- package/dist/{agents-mjQZV5tv.cjs → agents-GHhuyz5x.cjs} +32 -3
- package/dist/{api-schema-manifest-BjhiTdNv.js → api-schema-manifest-4PK1dBWt.js} +1 -1
- package/dist/{api-schema-manifest-DVkepK_s.cjs → api-schema-manifest-CX16hC7V.cjs} +1 -1
- package/dist/{auth-CM5AgF9l.cjs → auth-BR7vRIrY.cjs} +5 -3
- package/dist/{auth-CjT_a76k.js → auth-ChZ3dUvo.js} +5 -3
- package/dist/{catalogue-DH64Duv-.js → catalogue-BOzHZ1xt.js} +11 -11
- package/dist/{catalogue-BTE9b_mr.cjs → catalogue-DNy7Fog6.cjs} +11 -11
- package/dist/{conversations-CXyaNjLR.js → conversations-BjD8wOc3.js} +1 -1
- package/dist/{conversations-BWA_---j.cjs → conversations-CgogBOHO.cjs} +1 -1
- package/dist/{datasets-C1XJLHN8.js → datasets-CYdtUF8e.js} +4 -1
- package/dist/{datasets-hqDd4IUN.cjs → datasets-CZRqni0N.cjs} +4 -1
- package/dist/dist-BWVxgpEw.js +1 -0
- package/dist/{dist-DGwsCtT4.cjs → dist-Brw_H26B.cjs} +521 -286
- package/dist/{dist-CSffo32A.cjs → dist-C5_WGwU1.cjs} +1 -1
- package/dist/{dist-Bp1bObAq.js → dist-NBGkHBIE.js} +521 -286
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-knowledge-overview.md +1 -1
- package/dist/docs/references/reference-observability-tracing-advanced-queries.md +20 -0
- package/dist/{dynamic-workflows-DPgV6qtS.cjs → dynamic-workflows-CEKdGcSr.cjs} +4 -4
- package/dist/{dynamic-workflows-DmkCJ4Lp.js → dynamic-workflows-DF9X_oDG.js} +4 -4
- package/dist/{editor-builder-BayzCprJ.js → editor-builder-BRzXnsRW.js} +1 -1
- package/dist/{editor-builder-BS2xogE_.cjs → editor-builder-G1ub9j0s.cjs} +1 -1
- package/dist/{knowledge-DL03nbSW.cjs → knowledge-B3768ERP.cjs} +1 -0
- package/dist/{knowledge-DAqUHFK5.js → knowledge-wqC0nrmu.js} +1 -0
- package/dist/{observability-zr7LDCQG.js → observability-URaJnI_U.js} +1 -1
- package/dist/{observability-Cn4P60P4.cjs → observability-zNA_CVaz.cjs} +1 -1
- package/dist/{plans-xGwuiZUd.js → plans-DGC1grMp.js} +1 -1
- package/dist/{plans-Bes_LVgv.cjs → plans-kA8E3Auv.cjs} +1 -1
- package/dist/probe-image-size-ntJyQKKB.cjs +13304 -0
- package/dist/probe-image-size-zXQBlFaQ.js +13297 -0
- package/dist/{responses-CwQO5y2X.js → responses--nGf7l3O.js} +1 -1
- package/dist/{responses-BH567IZf.cjs → responses-B4GDz-Nm.cjs} +1 -1
- package/dist/{routes-CrBCJmjc.js → routes-BZVlqLly.js} +17 -17
- package/dist/{routes-6p-xrUIq.cjs → routes-vuZLexcc.cjs} +17 -17
- package/dist/{schedules-0ceTSdBB.cjs → schedules-CwL28Eca.cjs} +4 -4
- package/dist/{schedules-D_VfFdAH.js → schedules-RWgPeypN.js} +4 -4
- package/dist/{scorer-versions-Bhdvt-cX.cjs → scorer-versions-DK-PGj7-.cjs} +1 -1
- package/dist/{scorer-versions-DhT7Lj33.js → scorer-versions-oJoK2Exw.js} +1 -1
- package/dist/{scores-ksmJiJnJ.js → scores-Biv7XGW_.js} +1 -1
- package/dist/{scores-CXNkN7Bn.cjs → scores-D0Qq7TfU.cjs} +1 -1
- package/dist/server/handlers/a2a.cjs +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agent-controller.cjs +1 -1
- package/dist/server/handlers/agent-controller.js +1 -1
- package/dist/server/handlers/agent-versions.cjs +1 -1
- package/dist/server/handlers/agent-versions.js +1 -1
- package/dist/server/handlers/agents.cjs +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/auth.cjs +7 -3
- package/dist/server/handlers/auth.d.ts +12 -4
- package/dist/server/handlers/auth.js +7 -3
- package/dist/server/handlers/conversations.cjs +1 -1
- package/dist/server/handlers/conversations.js +1 -1
- package/dist/server/handlers/datasets.cjs +16 -11
- package/dist/server/handlers/datasets.d.ts +6 -0
- package/dist/server/handlers/datasets.js +16 -11
- package/dist/server/handlers/dynamic-workflows.cjs +1 -1
- package/dist/server/handlers/dynamic-workflows.js +1 -1
- package/dist/server/handlers/editor-builder.cjs +1 -1
- package/dist/server/handlers/editor-builder.js +1 -1
- package/dist/server/handlers/error.cjs +1 -1
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/favorites-enrichment.cjs +1 -1
- package/dist/server/handlers/favorites-enrichment.js +1 -1
- package/dist/server/handlers/knowledge.cjs +1 -1
- package/dist/server/handlers/knowledge.js +1 -1
- package/dist/server/handlers/observability.cjs +1 -1
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/plans.cjs +1 -1
- package/dist/server/handlers/plans.js +1 -1
- package/dist/server/handlers/responses.cjs +1 -1
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/schedules.cjs +1 -1
- package/dist/server/handlers/schedules.js +1 -1
- package/dist/server/handlers/scorer-versions.cjs +1 -1
- package/dist/server/handlers/scorer-versions.js +1 -1
- package/dist/server/handlers/scores.cjs +1 -1
- 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 +3 -3
- package/dist/server/handlers/stored-agents.cjs +2 -2
- package/dist/server/handlers/stored-agents.js +2 -2
- package/dist/server/handlers/stored-scorers.cjs +1 -1
- package/dist/server/handlers/stored-scorers.js +1 -1
- package/dist/server/handlers/stored-skill-favorites.cjs +2 -2
- package/dist/server/handlers/stored-skill-favorites.js +2 -2
- package/dist/server/handlers/stored-skills.cjs +1 -1
- package/dist/server/handlers/stored-skills.js +1 -1
- package/dist/server/handlers/system.cjs +1 -1
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tool-providers.cjs +2 -2
- package/dist/server/handlers/tool-providers.js +2 -2
- package/dist/server/handlers/tools.cjs +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/voice.cjs +1 -1
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +12 -12
- package/dist/server/handlers.js +12 -12
- package/dist/server/schemas/auth.d.ts +3 -1
- package/dist/server/schemas/datasets.d.ts +3 -0
- package/dist/server/schemas/index.cjs +7 -7
- package/dist/server/schemas/index.js +7 -7
- package/dist/server/server-adapter/index.cjs +3 -3
- package/dist/server/server-adapter/index.js +3 -3
- package/dist/server/server-adapter/routes/datasets.d.ts +6 -0
- package/dist/{server-adapter-Ceag3til.cjs → server-adapter-CurME3ch.cjs} +4 -4
- package/dist/{server-adapter-BGOi-s7x.js → server-adapter-h8YRQXAC.js} +4 -4
- package/dist/{stored-agents-m0Knvv29.cjs → stored-agents-BS4_LGSs.cjs} +32 -32
- package/dist/{stored-agents-DmN_pIIl.js → stored-agents-DcyDMKP2.js} +32 -32
- package/dist/{stored-scorers-2F2k6XSx.js → stored-scorers-Bdz_5k57.js} +1 -1
- package/dist/{stored-scorers-iM2Qq9Nh.cjs → stored-scorers-D8YYszOj.cjs} +1 -1
- package/dist/{tool-providers-Cq3vFqgE.js → tool-providers-BN2Ni06Z.js} +2 -2
- package/dist/{tool-providers-BVwRJTtB.cjs → tool-providers-BeiSkVHu.cjs} +2 -2
- package/dist/{tools-DLZ7go-n.cjs → tools-By0RVh_O.cjs} +1 -1
- package/dist/{tools-CY44YtDW.js → tools-C3KBdlil.js} +1 -1
- package/dist/{voice-NaerSeVQ.cjs → voice-CESew8Fc.cjs} +1 -1
- package/dist/{voice-DTjrAgqg.js → voice-PfxY_vQg.js} +1 -1
- package/dist/{workflows-gIKukZ1O.cjs → workflows-CHKSHV4f.cjs} +33 -0
- package/dist/{workflows-D3QrUMfm.js → workflows-D5bfbang.js} +33 -0
- package/package.json +3 -3
- package/dist/dist-Bn0zFASI.js +0 -1
- package/dist/probe-image-size-BR5MlnnJ.cjs +0 -13304
- package/dist/probe-image-size-DBCcUUw_.js +0 -13297
|
@@ -3,7 +3,7 @@ import { a as agentCardV1ResponseSchema, i as agentCardResponseSchema, o as agen
|
|
|
3
3
|
import { TaskStoreVersionConflictError } from "./server/a2a/store.js";
|
|
4
4
|
import { n as createRoute } from "./route-builder-Dz18c3qm.js";
|
|
5
5
|
import { r as convertInstructionsToString } from "./utils-C2VRtQjI.js";
|
|
6
|
-
import { G as getAgentFromSystem } from "./agents-
|
|
6
|
+
import { G as getAgentFromSystem } from "./agents-CAXsXenf.js";
|
|
7
7
|
import { getPublicOrigin } from "./server/handlers/auth.js";
|
|
8
8
|
import { z } from "zod/v4";
|
|
9
9
|
import { isDeepStrictEqual } from "util";
|
|
@@ -3,7 +3,7 @@ const require_a2a = require("./a2a-BsBYrosr.cjs");
|
|
|
3
3
|
const require_server_a2a_store = require("./server/a2a/store.cjs");
|
|
4
4
|
const require_route_builder = require("./route-builder-DjTBxSZN.cjs");
|
|
5
5
|
const require_utils = require("./utils-DQJOBnMo.cjs");
|
|
6
|
-
const require_agents = require("./agents-
|
|
6
|
+
const require_agents = require("./agents-GHhuyz5x.cjs");
|
|
7
7
|
const require_server_handlers_auth = require("./server/handlers/auth.cjs");
|
|
8
8
|
let zod_v4 = require("zod/v4");
|
|
9
9
|
let util = require("util");
|
|
@@ -7,7 +7,7 @@ import { o as optionalRunIdSchema, u as runIdSchema } from "./common-J-yUnHk9.js
|
|
|
7
7
|
import { n as createRoute } from "./route-builder-Dz18c3qm.js";
|
|
8
8
|
import { t as WorkflowRegistry } from "./utils-C2VRtQjI.js";
|
|
9
9
|
import { handleError } from "./server/handlers/error.js";
|
|
10
|
-
import { C as STREAM_LEGACY_WORKFLOW_ROUTE, S as START_WORKFLOW_RUN_ROUTE, _ as RESUME_ASYNC_WORKFLOW_ROUTE, a as GET_WORKFLOW_BY_ID_ROUTE, b as RESUME_WORKFLOW_ROUTE, c as LIST_WORKFLOW_RUNS_ROUTE, d as OBSERVE_STREAM_WORKFLOW_ROUTE, n as CREATE_WORKFLOW_RUN_ROUTE, o as GET_WORKFLOW_RUN_BY_ID_ROUTE, s as LIST_WORKFLOWS_ROUTE, t as CANCEL_WORKFLOW_RUN_ROUTE, u as OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE, v as RESUME_NO_WAIT_WORKFLOW_ROUTE, w as STREAM_WORKFLOW_ROUTE, x as START_ASYNC_WORKFLOW_ROUTE, y as RESUME_STREAM_WORKFLOW_ROUTE } from "./workflows-
|
|
10
|
+
import { C as STREAM_LEGACY_WORKFLOW_ROUTE, S as START_WORKFLOW_RUN_ROUTE, _ as RESUME_ASYNC_WORKFLOW_ROUTE, a as GET_WORKFLOW_BY_ID_ROUTE, b as RESUME_WORKFLOW_ROUTE, c as LIST_WORKFLOW_RUNS_ROUTE, d as OBSERVE_STREAM_WORKFLOW_ROUTE, n as CREATE_WORKFLOW_RUN_ROUTE, o as GET_WORKFLOW_RUN_BY_ID_ROUTE, s as LIST_WORKFLOWS_ROUTE, t as CANCEL_WORKFLOW_RUN_ROUTE, u as OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE, v as RESUME_NO_WAIT_WORKFLOW_ROUTE, w as STREAM_WORKFLOW_ROUTE, x as START_ASYNC_WORKFLOW_ROUTE, y as RESUME_STREAM_WORKFLOW_ROUTE } from "./workflows-D5bfbang.js";
|
|
11
11
|
// src/server/handlers/agent-builder.ts
|
|
12
12
|
var agent_builder_exports = /* @__PURE__ */ __exportAll({
|
|
13
13
|
CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE: () => CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE,
|
|
@@ -30,7 +30,7 @@ var agent_builder_exports = /* @__PURE__ */ __exportAll({
|
|
|
30
30
|
let createAgentBuilderWorkflowsPromise;
|
|
31
31
|
const agentBuilderWorkflowsByMastra = /* @__PURE__ */ new WeakMap();
|
|
32
32
|
async function registerAgentBuilderWorkflows(mastra) {
|
|
33
|
-
createAgentBuilderWorkflowsPromise ??= import("./dist-
|
|
33
|
+
createAgentBuilderWorkflowsPromise ??= import("./dist-NBGkHBIE.js").then((mod) => mod.createAgentBuilderWorkflows);
|
|
34
34
|
const create = await createAgentBuilderWorkflowsPromise;
|
|
35
35
|
let agentBuilderWorkflows = agentBuilderWorkflowsByMastra.get(mastra);
|
|
36
36
|
if (!agentBuilderWorkflows) {
|
|
@@ -7,7 +7,7 @@ const require_common = require("./common-D5XxSuvu.cjs");
|
|
|
7
7
|
const require_route_builder = require("./route-builder-DjTBxSZN.cjs");
|
|
8
8
|
const require_utils = require("./utils-DQJOBnMo.cjs");
|
|
9
9
|
const require_server_handlers_error = require("./server/handlers/error.cjs");
|
|
10
|
-
const require_workflows$1 = require("./workflows-
|
|
10
|
+
const require_workflows$1 = require("./workflows-CHKSHV4f.cjs");
|
|
11
11
|
// src/server/handlers/agent-builder.ts
|
|
12
12
|
var agent_builder_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
13
13
|
CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE: () => CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE,
|
|
@@ -30,7 +30,7 @@ var agent_builder_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll
|
|
|
30
30
|
let createAgentBuilderWorkflowsPromise;
|
|
31
31
|
const agentBuilderWorkflowsByMastra = /* @__PURE__ */ new WeakMap();
|
|
32
32
|
async function registerAgentBuilderWorkflows(mastra) {
|
|
33
|
-
createAgentBuilderWorkflowsPromise ??= Promise.resolve().then(() => require("./dist-
|
|
33
|
+
createAgentBuilderWorkflowsPromise ??= Promise.resolve().then(() => require("./dist-Brw_H26B.cjs")).then((mod) => mod.createAgentBuilderWorkflows);
|
|
34
34
|
const create = await createAgentBuilderWorkflowsPromise;
|
|
35
35
|
let agentBuilderWorkflows = agentBuilderWorkflowsByMastra.get(mastra);
|
|
36
36
|
if (!agentBuilderWorkflows) {
|
|
@@ -775,7 +775,7 @@ const STREAM_AGENT_CONTROLLER_SESSION_ROUTE = require_route_builder.createRoute(
|
|
|
775
775
|
sseFlushOnConnect: true,
|
|
776
776
|
pathParamSchema: sessionPathParams,
|
|
777
777
|
summary: "Stream controller session events",
|
|
778
|
-
description: "Subscribes to a session
|
|
778
|
+
description: "Subscribes to a session\u2019s event bus and streams events to the client over SSE.",
|
|
779
779
|
tags: ["AgentController", "Streaming"],
|
|
780
780
|
requiresAuth: true,
|
|
781
781
|
requiresPermission: "agent-controller:read",
|
|
@@ -921,7 +921,7 @@ const SEND_AGENT_CONTROLLER_MESSAGE_ROUTE = require_route_builder.createRoute({
|
|
|
921
921
|
bodySchema: sendMessageBodySchema,
|
|
922
922
|
responseSchema: ackResponseSchema,
|
|
923
923
|
summary: "Send a message to a controller session",
|
|
924
|
-
description: "Sends a user message to the session. The reply streams as events on the session
|
|
924
|
+
description: "Sends a user message to the session. The reply streams as events on the session\u2019s SSE stream.",
|
|
925
925
|
tags: ["AgentController", "Streaming"],
|
|
926
926
|
requiresAuth: true,
|
|
927
927
|
requiresPermission: "agent-controller:execute",
|
|
@@ -1340,7 +1340,7 @@ const LIST_AGENT_CONTROLLER_THREADS_ROUTE = require_route_builder.createRoute({
|
|
|
1340
1340
|
queryParamSchema: listThreadsQuerySchema,
|
|
1341
1341
|
responseSchema: listThreadsResponseSchema,
|
|
1342
1342
|
summary: "List session threads",
|
|
1343
|
-
description: "Lists every thread of the session
|
|
1343
|
+
description: "Lists every thread of the session\u2019s resource (not only the session\u2019s own threads), most-recently-updated first. Pass `limit` to return only the newest N (e.g. for a sidebar). Pass `tags` (a JSON-encoded object) to scope the list to threads matching every tag \u2014 e.g. `{ projectPath }` so git worktrees sharing a resourceId each see only their own threads.",
|
|
1344
1344
|
tags: ["AgentController"],
|
|
1345
1345
|
requiresAuth: true,
|
|
1346
1346
|
requiresPermission: "agent-controller:read",
|
|
@@ -1404,7 +1404,7 @@ const SEND_AGENT_CONTROLLER_NOTIFICATION_ROUTE = require_route_builder.createRou
|
|
|
1404
1404
|
runId: zod_v4.z.string().optional()
|
|
1405
1405
|
}),
|
|
1406
1406
|
summary: "Send a notification signal to a session",
|
|
1407
|
-
description: "Delivers a notification to the session
|
|
1407
|
+
description: "Delivers a notification to the session\u2019s current agent/thread. The agent\u2019s delivery policy determines whether the notification wakes an idle thread, is summarised, or is persisted for later.",
|
|
1408
1408
|
tags: ["AgentController"],
|
|
1409
1409
|
requiresAuth: true,
|
|
1410
1410
|
requiresPermission: "agent-controller:execute",
|
|
@@ -1702,7 +1702,7 @@ const GET_AGENT_CONTROLLER_OM_RECORD_ROUTE = require_route_builder.createRoute({
|
|
|
1702
1702
|
pathParamSchema: sessionPathParams,
|
|
1703
1703
|
responseSchema: omRecordResponseSchema,
|
|
1704
1704
|
summary: "Get observational memory record",
|
|
1705
|
-
description: "Returns the current observational memory record for the session
|
|
1705
|
+
description: "Returns the current observational memory record for the session\u2019s thread/resource.",
|
|
1706
1706
|
tags: ["AgentController"],
|
|
1707
1707
|
requiresAuth: true,
|
|
1708
1708
|
requiresPermission: "agent-controller:read",
|
|
@@ -1725,7 +1725,7 @@ const SET_AGENT_CONTROLLER_RESOURCE_ID_ROUTE = require_route_builder.createRoute
|
|
|
1725
1725
|
bodySchema: zod_v4.z.object({ newResourceId: zod_v4.z.string() }),
|
|
1726
1726
|
responseSchema: ackResponseSchema,
|
|
1727
1727
|
summary: "Change the session resource ID",
|
|
1728
|
-
description: "Updates the session
|
|
1728
|
+
description: "Updates the session\u2019s resource identity (e.g. when a user logs in).",
|
|
1729
1729
|
tags: ["AgentController"],
|
|
1730
1730
|
requiresAuth: true,
|
|
1731
1731
|
requiresPermission: "agent-controller:execute",
|
|
@@ -1803,7 +1803,7 @@ const GET_AGENT_CONTROLLER_GOAL_ROUTE = require_route_builder.createRoute({
|
|
|
1803
1803
|
pathParamSchema: sessionPathParams,
|
|
1804
1804
|
responseSchema: goalResponseSchema,
|
|
1805
1805
|
summary: "Get the current goal",
|
|
1806
|
-
description: "Returns the active/paused/done goal objective for the session
|
|
1806
|
+
description: "Returns the active/paused/done goal objective for the session\u2019s thread, if any.",
|
|
1807
1807
|
tags: ["AgentController", "Goals"],
|
|
1808
1808
|
requiresAuth: true,
|
|
1809
1809
|
requiresPermission: "agent-controller:read",
|
|
@@ -1828,7 +1828,7 @@ const SET_AGENT_CONTROLLER_GOAL_ROUTE = require_route_builder.createRoute({
|
|
|
1828
1828
|
bodySchema: setGoalBodySchema,
|
|
1829
1829
|
responseSchema: goalResponseSchema,
|
|
1830
1830
|
summary: "Set a goal",
|
|
1831
|
-
description: "Sets a new objective for the session
|
|
1831
|
+
description: "Sets a new objective for the session\u2019s thread. The agent\u2019s in-loop goal judge evaluates progress after each turn.",
|
|
1832
1832
|
tags: ["AgentController", "Goals"],
|
|
1833
1833
|
requiresAuth: true,
|
|
1834
1834
|
requiresPermission: "agent-controller:execute",
|
|
@@ -1887,7 +1887,7 @@ const CLEAR_AGENT_CONTROLLER_GOAL_ROUTE = require_route_builder.createRoute({
|
|
|
1887
1887
|
pathParamSchema: sessionPathParams,
|
|
1888
1888
|
responseSchema: ackResponseSchema,
|
|
1889
1889
|
summary: "Clear the goal",
|
|
1890
|
-
description: "Removes the active goal from the session
|
|
1890
|
+
description: "Removes the active goal from the session\u2019s thread.",
|
|
1891
1891
|
tags: ["AgentController", "Goals"],
|
|
1892
1892
|
requiresAuth: true,
|
|
1893
1893
|
requiresPermission: "agent-controller:execute",
|
|
@@ -775,7 +775,7 @@ const STREAM_AGENT_CONTROLLER_SESSION_ROUTE = createRoute({
|
|
|
775
775
|
sseFlushOnConnect: true,
|
|
776
776
|
pathParamSchema: sessionPathParams,
|
|
777
777
|
summary: "Stream controller session events",
|
|
778
|
-
description: "Subscribes to a session
|
|
778
|
+
description: "Subscribes to a session\u2019s event bus and streams events to the client over SSE.",
|
|
779
779
|
tags: ["AgentController", "Streaming"],
|
|
780
780
|
requiresAuth: true,
|
|
781
781
|
requiresPermission: "agent-controller:read",
|
|
@@ -921,7 +921,7 @@ const SEND_AGENT_CONTROLLER_MESSAGE_ROUTE = createRoute({
|
|
|
921
921
|
bodySchema: sendMessageBodySchema,
|
|
922
922
|
responseSchema: ackResponseSchema,
|
|
923
923
|
summary: "Send a message to a controller session",
|
|
924
|
-
description: "Sends a user message to the session. The reply streams as events on the session
|
|
924
|
+
description: "Sends a user message to the session. The reply streams as events on the session\u2019s SSE stream.",
|
|
925
925
|
tags: ["AgentController", "Streaming"],
|
|
926
926
|
requiresAuth: true,
|
|
927
927
|
requiresPermission: "agent-controller:execute",
|
|
@@ -1340,7 +1340,7 @@ const LIST_AGENT_CONTROLLER_THREADS_ROUTE = createRoute({
|
|
|
1340
1340
|
queryParamSchema: listThreadsQuerySchema,
|
|
1341
1341
|
responseSchema: listThreadsResponseSchema,
|
|
1342
1342
|
summary: "List session threads",
|
|
1343
|
-
description: "Lists every thread of the session
|
|
1343
|
+
description: "Lists every thread of the session\u2019s resource (not only the session\u2019s own threads), most-recently-updated first. Pass `limit` to return only the newest N (e.g. for a sidebar). Pass `tags` (a JSON-encoded object) to scope the list to threads matching every tag \u2014 e.g. `{ projectPath }` so git worktrees sharing a resourceId each see only their own threads.",
|
|
1344
1344
|
tags: ["AgentController"],
|
|
1345
1345
|
requiresAuth: true,
|
|
1346
1346
|
requiresPermission: "agent-controller:read",
|
|
@@ -1404,7 +1404,7 @@ const SEND_AGENT_CONTROLLER_NOTIFICATION_ROUTE = createRoute({
|
|
|
1404
1404
|
runId: z.string().optional()
|
|
1405
1405
|
}),
|
|
1406
1406
|
summary: "Send a notification signal to a session",
|
|
1407
|
-
description: "Delivers a notification to the session
|
|
1407
|
+
description: "Delivers a notification to the session\u2019s current agent/thread. The agent\u2019s delivery policy determines whether the notification wakes an idle thread, is summarised, or is persisted for later.",
|
|
1408
1408
|
tags: ["AgentController"],
|
|
1409
1409
|
requiresAuth: true,
|
|
1410
1410
|
requiresPermission: "agent-controller:execute",
|
|
@@ -1702,7 +1702,7 @@ const GET_AGENT_CONTROLLER_OM_RECORD_ROUTE = createRoute({
|
|
|
1702
1702
|
pathParamSchema: sessionPathParams,
|
|
1703
1703
|
responseSchema: omRecordResponseSchema,
|
|
1704
1704
|
summary: "Get observational memory record",
|
|
1705
|
-
description: "Returns the current observational memory record for the session
|
|
1705
|
+
description: "Returns the current observational memory record for the session\u2019s thread/resource.",
|
|
1706
1706
|
tags: ["AgentController"],
|
|
1707
1707
|
requiresAuth: true,
|
|
1708
1708
|
requiresPermission: "agent-controller:read",
|
|
@@ -1725,7 +1725,7 @@ const SET_AGENT_CONTROLLER_RESOURCE_ID_ROUTE = createRoute({
|
|
|
1725
1725
|
bodySchema: z.object({ newResourceId: z.string() }),
|
|
1726
1726
|
responseSchema: ackResponseSchema,
|
|
1727
1727
|
summary: "Change the session resource ID",
|
|
1728
|
-
description: "Updates the session
|
|
1728
|
+
description: "Updates the session\u2019s resource identity (e.g. when a user logs in).",
|
|
1729
1729
|
tags: ["AgentController"],
|
|
1730
1730
|
requiresAuth: true,
|
|
1731
1731
|
requiresPermission: "agent-controller:execute",
|
|
@@ -1803,7 +1803,7 @@ const GET_AGENT_CONTROLLER_GOAL_ROUTE = createRoute({
|
|
|
1803
1803
|
pathParamSchema: sessionPathParams,
|
|
1804
1804
|
responseSchema: goalResponseSchema,
|
|
1805
1805
|
summary: "Get the current goal",
|
|
1806
|
-
description: "Returns the active/paused/done goal objective for the session
|
|
1806
|
+
description: "Returns the active/paused/done goal objective for the session\u2019s thread, if any.",
|
|
1807
1807
|
tags: ["AgentController", "Goals"],
|
|
1808
1808
|
requiresAuth: true,
|
|
1809
1809
|
requiresPermission: "agent-controller:read",
|
|
@@ -1828,7 +1828,7 @@ const SET_AGENT_CONTROLLER_GOAL_ROUTE = createRoute({
|
|
|
1828
1828
|
bodySchema: setGoalBodySchema,
|
|
1829
1829
|
responseSchema: goalResponseSchema,
|
|
1830
1830
|
summary: "Set a goal",
|
|
1831
|
-
description: "Sets a new objective for the session
|
|
1831
|
+
description: "Sets a new objective for the session\u2019s thread. The agent\u2019s in-loop goal judge evaluates progress after each turn.",
|
|
1832
1832
|
tags: ["AgentController", "Goals"],
|
|
1833
1833
|
requiresAuth: true,
|
|
1834
1834
|
requiresPermission: "agent-controller:execute",
|
|
@@ -1887,7 +1887,7 @@ const CLEAR_AGENT_CONTROLLER_GOAL_ROUTE = createRoute({
|
|
|
1887
1887
|
pathParamSchema: sessionPathParams,
|
|
1888
1888
|
responseSchema: ackResponseSchema,
|
|
1889
1889
|
summary: "Clear the goal",
|
|
1890
|
-
description: "Removes the active goal from the session
|
|
1890
|
+
description: "Removes the active goal from the session\u2019s thread.",
|
|
1891
1891
|
tags: ["AgentController", "Goals"],
|
|
1892
1892
|
requiresAuth: true,
|
|
1893
1893
|
requiresPermission: "agent-controller:execute",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_default_options = require("./default-options-DRN81WEQ.cjs");
|
|
2
|
-
const require_stored_agents = require("./stored-agents-
|
|
2
|
+
const require_stored_agents = require("./stored-agents-BS4_LGSs.cjs");
|
|
3
3
|
const require_version_common = require("./version-common-Cc0STXl9.cjs");
|
|
4
4
|
let zod_v4 = require("zod/v4");
|
|
5
5
|
// src/server/schemas/agent-versions.ts
|
|
@@ -27,17 +27,17 @@ const agentVersionSchema = zod_v4.z.object({
|
|
|
27
27
|
name: zod_v4.z.string().describe("Name of the agent"),
|
|
28
28
|
description: zod_v4.z.string().optional().describe("Description of the agent"),
|
|
29
29
|
instructions: require_stored_agents.instructionsSchema,
|
|
30
|
-
model: require_stored_agents.conditionalFieldSchema(require_stored_agents.modelConfigSchema).describe("Model configuration
|
|
31
|
-
tools: require_stored_agents.conditionalFieldSchema(require_stored_agents.toolsConfigSchema).optional().describe("Tool keys mapped to per-tool config
|
|
32
|
-
defaultOptions: require_stored_agents.conditionalFieldSchema(require_default_options.defaultOptionsSchema).optional().describe("Default options for generate/stream calls
|
|
33
|
-
workflows: require_stored_agents.conditionalFieldSchema(zod_v4.z.record(zod_v4.z.string(), require_stored_agents.toolConfigSchema)).optional().describe("Workflow keys with optional per-workflow config
|
|
34
|
-
agents: require_stored_agents.conditionalFieldSchema(zod_v4.z.record(zod_v4.z.string(), require_stored_agents.toolConfigSchema)).optional().describe("Agent keys with optional per-agent config
|
|
35
|
-
integrationTools: require_stored_agents.conditionalFieldSchema(zod_v4.z.record(zod_v4.z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of tool provider IDs to their tool configurations
|
|
36
|
-
mcpClients: require_stored_agents.conditionalFieldSchema(zod_v4.z.record(zod_v4.z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of stored MCP client IDs to their tool configurations
|
|
37
|
-
inputProcessors: require_stored_agents.conditionalFieldSchema(require_stored_agents.storedProcessorGraphSchema).optional().describe("Input processor graph
|
|
38
|
-
outputProcessors: require_stored_agents.conditionalFieldSchema(require_stored_agents.storedProcessorGraphSchema).optional().describe("Output processor graph
|
|
39
|
-
memory: require_stored_agents.conditionalFieldSchema(require_stored_agents.storedMemoryRefSchema).optional().describe("Memory: registered memory reference or inline config
|
|
40
|
-
scorers: require_stored_agents.conditionalFieldSchema(zod_v4.z.record(zod_v4.z.string(), require_stored_agents.scorerConfigSchema)).optional().describe("Scorer keys with optional sampling config
|
|
30
|
+
model: require_stored_agents.conditionalFieldSchema(require_stored_agents.modelConfigSchema).describe("Model configuration \u2014 static value or array of conditional variants"),
|
|
31
|
+
tools: require_stored_agents.conditionalFieldSchema(require_stored_agents.toolsConfigSchema).optional().describe("Tool keys mapped to per-tool config \u2014 static or conditional"),
|
|
32
|
+
defaultOptions: require_stored_agents.conditionalFieldSchema(require_default_options.defaultOptionsSchema).optional().describe("Default options for generate/stream calls \u2014 static or conditional"),
|
|
33
|
+
workflows: require_stored_agents.conditionalFieldSchema(zod_v4.z.record(zod_v4.z.string(), require_stored_agents.toolConfigSchema)).optional().describe("Workflow keys with optional per-workflow config \u2014 static or conditional"),
|
|
34
|
+
agents: require_stored_agents.conditionalFieldSchema(zod_v4.z.record(zod_v4.z.string(), require_stored_agents.toolConfigSchema)).optional().describe("Agent keys with optional per-agent config \u2014 static or conditional"),
|
|
35
|
+
integrationTools: require_stored_agents.conditionalFieldSchema(zod_v4.z.record(zod_v4.z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of tool provider IDs to their tool configurations \u2014 static or conditional"),
|
|
36
|
+
mcpClients: require_stored_agents.conditionalFieldSchema(zod_v4.z.record(zod_v4.z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of stored MCP client IDs to their tool configurations \u2014 static or conditional"),
|
|
37
|
+
inputProcessors: require_stored_agents.conditionalFieldSchema(require_stored_agents.storedProcessorGraphSchema).optional().describe("Input processor graph \u2014 static or conditional"),
|
|
38
|
+
outputProcessors: require_stored_agents.conditionalFieldSchema(require_stored_agents.storedProcessorGraphSchema).optional().describe("Output processor graph \u2014 static or conditional"),
|
|
39
|
+
memory: require_stored_agents.conditionalFieldSchema(require_stored_agents.storedMemoryRefSchema).optional().describe("Memory: registered memory reference or inline config \u2014 static or conditional"),
|
|
40
|
+
scorers: require_stored_agents.conditionalFieldSchema(zod_v4.z.record(zod_v4.z.string(), require_stored_agents.scorerConfigSchema)).optional().describe("Scorer keys with optional sampling config \u2014 static or conditional"),
|
|
41
41
|
requestContextSchema: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.unknown()).optional().describe("JSON Schema defining valid request context variables"),
|
|
42
42
|
changedFields: zod_v4.z.array(zod_v4.z.string()).optional().describe("Array of field names that changed from the previous version"),
|
|
43
43
|
changeMessage: zod_v4.z.string().optional().describe("Optional message describing the changes"),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as defaultOptionsSchema } from "./default-options-Dir6CKnE.js";
|
|
2
|
-
import { D as toolsConfigSchema, E as toolConfigSchema, I as storedMemoryRefSchema, T as storedProcessorGraphSchema, f as modelConfigSchema, l as instructionsSchema, t as conditionalFieldSchema, x as scorerConfigSchema } from "./stored-agents-
|
|
2
|
+
import { D as toolsConfigSchema, E as toolConfigSchema, I as storedMemoryRefSchema, T as storedProcessorGraphSchema, f as modelConfigSchema, l as instructionsSchema, t as conditionalFieldSchema, x as scorerConfigSchema } from "./stored-agents-DcyDMKP2.js";
|
|
3
3
|
import { i as createListVersionsResponseSchema, r as createCompareVersionsResponseSchema } from "./version-common-BLTDO88f.js";
|
|
4
4
|
import { z } from "zod/v4";
|
|
5
5
|
// src/server/schemas/agent-versions.ts
|
|
@@ -27,17 +27,17 @@ const agentVersionSchema = z.object({
|
|
|
27
27
|
name: z.string().describe("Name of the agent"),
|
|
28
28
|
description: z.string().optional().describe("Description of the agent"),
|
|
29
29
|
instructions: instructionsSchema,
|
|
30
|
-
model: conditionalFieldSchema(modelConfigSchema).describe("Model configuration
|
|
31
|
-
tools: conditionalFieldSchema(toolsConfigSchema).optional().describe("Tool keys mapped to per-tool config
|
|
32
|
-
defaultOptions: conditionalFieldSchema(defaultOptionsSchema).optional().describe("Default options for generate/stream calls
|
|
33
|
-
workflows: conditionalFieldSchema(z.record(z.string(), toolConfigSchema)).optional().describe("Workflow keys with optional per-workflow config
|
|
34
|
-
agents: conditionalFieldSchema(z.record(z.string(), toolConfigSchema)).optional().describe("Agent keys with optional per-agent config
|
|
35
|
-
integrationTools: conditionalFieldSchema(z.record(z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of tool provider IDs to their tool configurations
|
|
36
|
-
mcpClients: conditionalFieldSchema(z.record(z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of stored MCP client IDs to their tool configurations
|
|
37
|
-
inputProcessors: conditionalFieldSchema(storedProcessorGraphSchema).optional().describe("Input processor graph
|
|
38
|
-
outputProcessors: conditionalFieldSchema(storedProcessorGraphSchema).optional().describe("Output processor graph
|
|
39
|
-
memory: conditionalFieldSchema(storedMemoryRefSchema).optional().describe("Memory: registered memory reference or inline config
|
|
40
|
-
scorers: conditionalFieldSchema(z.record(z.string(), scorerConfigSchema)).optional().describe("Scorer keys with optional sampling config
|
|
30
|
+
model: conditionalFieldSchema(modelConfigSchema).describe("Model configuration \u2014 static value or array of conditional variants"),
|
|
31
|
+
tools: conditionalFieldSchema(toolsConfigSchema).optional().describe("Tool keys mapped to per-tool config \u2014 static or conditional"),
|
|
32
|
+
defaultOptions: conditionalFieldSchema(defaultOptionsSchema).optional().describe("Default options for generate/stream calls \u2014 static or conditional"),
|
|
33
|
+
workflows: conditionalFieldSchema(z.record(z.string(), toolConfigSchema)).optional().describe("Workflow keys with optional per-workflow config \u2014 static or conditional"),
|
|
34
|
+
agents: conditionalFieldSchema(z.record(z.string(), toolConfigSchema)).optional().describe("Agent keys with optional per-agent config \u2014 static or conditional"),
|
|
35
|
+
integrationTools: conditionalFieldSchema(z.record(z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of tool provider IDs to their tool configurations \u2014 static or conditional"),
|
|
36
|
+
mcpClients: conditionalFieldSchema(z.record(z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of stored MCP client IDs to their tool configurations \u2014 static or conditional"),
|
|
37
|
+
inputProcessors: conditionalFieldSchema(storedProcessorGraphSchema).optional().describe("Input processor graph \u2014 static or conditional"),
|
|
38
|
+
outputProcessors: conditionalFieldSchema(storedProcessorGraphSchema).optional().describe("Output processor graph \u2014 static or conditional"),
|
|
39
|
+
memory: conditionalFieldSchema(storedMemoryRefSchema).optional().describe("Memory: registered memory reference or inline config \u2014 static or conditional"),
|
|
40
|
+
scorers: conditionalFieldSchema(z.record(z.string(), scorerConfigSchema)).optional().describe("Scorer keys with optional sampling config \u2014 static or conditional"),
|
|
41
41
|
requestContextSchema: z.record(z.string(), z.unknown()).optional().describe("JSON Schema defining valid request context variables"),
|
|
42
42
|
changedFields: z.array(z.string()).optional().describe("Array of field names that changed from the previous version"),
|
|
43
43
|
changeMessage: z.string().optional().describe("Optional message describing the changes"),
|
|
@@ -5,7 +5,7 @@ import { n as standardSchemaToJSONSchema, r as toStandardSchema } from "./schema
|
|
|
5
5
|
import { _ as MastraFGAPermissions, a as getEffectiveThreadId, c as mergeBodyRequestContext, d as requireEffectiveResourceId, f as sanitizeBody, g as validateThreadOwnership, h as validateRunOwnership, i as getEffectiveResourceId, m as validateBody, n as enforceThreadAccess, o as getHandlerFGAProvider, p as stripClientCredentialHeaders, r as getContextResourceId, t as applyEffectiveThreadId } from "./utils-CvYihOoy.js";
|
|
6
6
|
import { t as HTTPException } from "./http-exception-CzaWkxMl.js";
|
|
7
7
|
import { $ as toolCallResponseSchema, A as observeAgentBodySchema, B as sendAgentMessageBodySchema, C as generateResponseSchema, E as listSuspendedRunsResponseSchema, F as queueAgentSignalBodySchema, G as serializedAgentSchema, H as sendToolApprovalBodySchema, I as recoverBodySchema, L as reorderAgentModelListBodySchema, N as providersResponseSchema, O as modelConfigIdPathParams, P as queueAgentMessageBodySchema, Q as subscribeAgentThreadBodySchema, R as resumeStreamBodySchema, T as listSuspendedRunsQuerySchema, U as sendToolApprovalResponseSchema, V as sendAgentSignalBodySchema, X as streamResponseSchema, Z as streamUntilIdleBodySchema, _ as declineToolCallBodySchema, a as agentIdPathParams, c as agentRunPathParams, d as agentVersionQuerySchema, f as approveNetworkToolCallBodySchema, g as declineNetworkToolCallBodySchema, h as cancelPendingAgentSignalsResponseSchema, i as agentExecutionLegacyBodySchema, j as observeAgentResponseSchema, k as modelManagementResponseSchema, l as agentSkillPathParams, m as cancelPendingAgentSignalsBodySchema, n as abortAgentThreadResponseSchema, nt as updateAgentModelInModelListBodySchema, p as approveToolCallBodySchema, r as agentExecutionBodySchema, t as abortAgentThreadBodySchema, tt as updateAgentModelBodySchema, v as enhanceInstructionsBodySchema, w as listAgentsResponseSchema, y as enhanceInstructionsResponseSchema, z as resumeStreamUntilIdleBodySchema } from "./agents-B0OpLdbp.js";
|
|
8
|
-
import { r as createStoredAgentResponseSchema } from "./stored-agents-
|
|
8
|
+
import { r as createStoredAgentResponseSchema } from "./stored-agents-DcyDMKP2.js";
|
|
9
9
|
import { O as skillDisambiguationQuerySchema, h as getAgentSkillResponseSchema } from "./workspace-DBDA3UQl.js";
|
|
10
10
|
import { n as createRoute } from "./route-builder-Dz18c3qm.js";
|
|
11
11
|
import { assertStoredAgentAccess } from "./server/handlers/agent-access.js";
|
|
@@ -305,6 +305,16 @@ function hasDurableExecution(agent) {
|
|
|
305
305
|
const native = agent;
|
|
306
306
|
return typeof native.__hasDurableExecution === "function" && native.__hasDurableExecution();
|
|
307
307
|
}
|
|
308
|
+
function usesDurableEngine(agent) {
|
|
309
|
+
const native = agent;
|
|
310
|
+
return typeof native.__hasDurableExecution === "function" ? native.__hasDurableExecution() : void 0;
|
|
311
|
+
}
|
|
312
|
+
/** A forwarding proxy can expose the wrapped agent's hook without implementing it itself. */
|
|
313
|
+
function ownsRunStreamHook(agent) {
|
|
314
|
+
const key = "__subscribeToRunStream";
|
|
315
|
+
const prototype = Object.getPrototypeOf(agent);
|
|
316
|
+
return Object.hasOwn(agent, key) || prototype !== null && key in prototype;
|
|
317
|
+
}
|
|
308
318
|
async function validateDurableToolCallAccess({ mastra, agent, runId, toolCallId, requestContext, threadId, abortSignal }) {
|
|
309
319
|
if (!hasDurableExecution(agent)) return;
|
|
310
320
|
const workflowsStore = await mastra.getStorage()?.getStore("workflows");
|
|
@@ -1621,6 +1631,22 @@ const sendAgentSignalResponseSchema = z.object({
|
|
|
1621
1631
|
signal: z.unknown().optional()
|
|
1622
1632
|
});
|
|
1623
1633
|
/**
|
|
1634
|
+
* A `runId` target sends input to the thread that run is on, not the caller's, so the caller
|
|
1635
|
+
* must be allowed to act on that run under `validateRunOwnership`: with
|
|
1636
|
+
* `mapUserToResourceId`, a resource-scoped caller may only name its own runs and an unscoped
|
|
1637
|
+
* caller needs an FGA provider. A `runId` this process doesn't track can only reach the
|
|
1638
|
+
* caller's own thread, which `threadId` names and the thread check covers. Without a
|
|
1639
|
+
* `threadId`, a scoped caller gets the same denial whether or not the run exists, so the route
|
|
1640
|
+
* doesn't confirm live run ids.
|
|
1641
|
+
*/
|
|
1642
|
+
async function validateSignalRunOwnership(mastra, agent, runId, threadId, requestContext) {
|
|
1643
|
+
const contextResourceId = getContextResourceId(requestContext);
|
|
1644
|
+
const runtimeAgent = agent;
|
|
1645
|
+
const runTarget = typeof runtimeAgent.getThreadRunTarget === "function" ? runtimeAgent.getThreadRunTarget(runId) : runtimeAgent.listActiveThreadRuns?.().find((run) => run.runId === runId);
|
|
1646
|
+
if (runTarget) await validateRunOwnership(runTarget, contextResourceId, mastra, requestContext);
|
|
1647
|
+
else if (contextResourceId && !threadId) throw new HTTPException(403, { message: "Access denied: workflow run belongs to a different resource" });
|
|
1648
|
+
}
|
|
1649
|
+
/**
|
|
1624
1650
|
* Maps a rejected `result.accepted` (signal/message routing) to an HTTP error.
|
|
1625
1651
|
*
|
|
1626
1652
|
* `accepted` only rejects on a setup/misconfig failure surfaced before the run
|
|
@@ -1683,6 +1709,7 @@ const SEND_AGENT_SIGNAL_ROUTE = createRoute({
|
|
|
1683
1709
|
if (typeof agent.sendSignal !== "function") throw new HTTPException(501, { message: "agent signals are not supported by this Mastra core version" });
|
|
1684
1710
|
const agentSignal = signal;
|
|
1685
1711
|
if (runId) {
|
|
1712
|
+
await validateSignalRunOwnership(mastra, agent, runId, effectiveThreadId, serverRequestContext);
|
|
1686
1713
|
const result = await agent.sendSignal(agentSignal, {
|
|
1687
1714
|
runId,
|
|
1688
1715
|
...effectiveResourceId ? { resourceId: effectiveResourceId } : {},
|
|
@@ -1753,6 +1780,7 @@ async function handleAgentMessageRoute({ mastra, agentId, requestContext: server
|
|
|
1753
1780
|
}
|
|
1754
1781
|
if (typeof agent[methodName] !== "function") throw new HTTPException(501, { message: `agent ${methodName} is not supported by this Mastra core version` });
|
|
1755
1782
|
if (runId) {
|
|
1783
|
+
await validateSignalRunOwnership(mastra, agent, runId, effectiveThreadId, serverRequestContext);
|
|
1756
1784
|
const result = await invoke(agent, {
|
|
1757
1785
|
runId,
|
|
1758
1786
|
...effectiveResourceId ? { resourceId: effectiveResourceId } : {},
|
|
@@ -2333,10 +2361,11 @@ const OBSERVE_AGENT_STREAM_ROUTE = createRoute({
|
|
|
2333
2361
|
permission: MastraFGAPermissions.MEMORY_READ
|
|
2334
2362
|
})) throw new HTTPException(404, { message: "Run not found" });
|
|
2335
2363
|
const durableAgent = isDurableAgentLike(agent) ? agent : void 0;
|
|
2364
|
+
const fencedAgent = ownsRunStreamHook(agent) && (usesDurableEngine(agent) ?? durableAgent) ? agent : void 0;
|
|
2336
2365
|
const pubsub = durableAgent?.pubsub ?? getAgentStreamPubSub(agent) ?? mastra.pubsub;
|
|
2337
2366
|
const topic = AGENT_STREAM_TOPIC(runId);
|
|
2338
2367
|
const subscribe = (onEvent, onComplete) => {
|
|
2339
|
-
if (typeof
|
|
2368
|
+
if (typeof fencedAgent?.__subscribeToRunStream === "function") return fencedAgent.__subscribeToRunStream(runId, {
|
|
2340
2369
|
offset,
|
|
2341
2370
|
onComplete
|
|
2342
2371
|
}, onEvent);
|
|
@@ -2565,7 +2594,7 @@ const LIST_SUSPENDED_RUNS_ROUTE = createRoute({
|
|
|
2565
2594
|
queryParamSchema: listSuspendedRunsQuerySchema,
|
|
2566
2595
|
responseSchema: listSuspendedRunsResponseSchema,
|
|
2567
2596
|
summary: "List suspended runs",
|
|
2568
|
-
description: "Lists suspended agent runs from storage
|
|
2597
|
+
description: "Lists suspended agent runs from storage \u2014 runs waiting on a tool-call approval or on a tool that suspended. Works after a server restart and across instances.",
|
|
2569
2598
|
tags: ["Agents", "Tools"],
|
|
2570
2599
|
requiresAuth: true,
|
|
2571
2600
|
handler: async ({ mastra, agentId, requestContext, ...query }) => {
|
|
@@ -5,7 +5,7 @@ const require_schema_TQPB_dl2 = require("./schema-TQPB_dl2-CJX1q58F.cjs");
|
|
|
5
5
|
const require_utils$1 = require("./utils-j29NB2ZJ.cjs");
|
|
6
6
|
const require_http_exception = require("./http-exception-Co3MbFUf.cjs");
|
|
7
7
|
const require_agents = require("./agents-CH_G37hG.cjs");
|
|
8
|
-
const require_stored_agents = require("./stored-agents-
|
|
8
|
+
const require_stored_agents = require("./stored-agents-BS4_LGSs.cjs");
|
|
9
9
|
const require_workspace = require("./workspace-C5BBUatQ.cjs");
|
|
10
10
|
const require_route_builder = require("./route-builder-DjTBxSZN.cjs");
|
|
11
11
|
const require_server_handlers_agent_access = require("./server/handlers/agent-access.cjs");
|
|
@@ -305,6 +305,16 @@ function hasDurableExecution(agent) {
|
|
|
305
305
|
const native = agent;
|
|
306
306
|
return typeof native.__hasDurableExecution === "function" && native.__hasDurableExecution();
|
|
307
307
|
}
|
|
308
|
+
function usesDurableEngine(agent) {
|
|
309
|
+
const native = agent;
|
|
310
|
+
return typeof native.__hasDurableExecution === "function" ? native.__hasDurableExecution() : void 0;
|
|
311
|
+
}
|
|
312
|
+
/** A forwarding proxy can expose the wrapped agent's hook without implementing it itself. */
|
|
313
|
+
function ownsRunStreamHook(agent) {
|
|
314
|
+
const key = "__subscribeToRunStream";
|
|
315
|
+
const prototype = Object.getPrototypeOf(agent);
|
|
316
|
+
return Object.hasOwn(agent, key) || prototype !== null && key in prototype;
|
|
317
|
+
}
|
|
308
318
|
async function validateDurableToolCallAccess({ mastra, agent, runId, toolCallId, requestContext, threadId, abortSignal }) {
|
|
309
319
|
if (!hasDurableExecution(agent)) return;
|
|
310
320
|
const workflowsStore = await mastra.getStorage()?.getStore("workflows");
|
|
@@ -1621,6 +1631,22 @@ const sendAgentSignalResponseSchema = zod_v4.z.object({
|
|
|
1621
1631
|
signal: zod_v4.z.unknown().optional()
|
|
1622
1632
|
});
|
|
1623
1633
|
/**
|
|
1634
|
+
* A `runId` target sends input to the thread that run is on, not the caller's, so the caller
|
|
1635
|
+
* must be allowed to act on that run under `validateRunOwnership`: with
|
|
1636
|
+
* `mapUserToResourceId`, a resource-scoped caller may only name its own runs and an unscoped
|
|
1637
|
+
* caller needs an FGA provider. A `runId` this process doesn't track can only reach the
|
|
1638
|
+
* caller's own thread, which `threadId` names and the thread check covers. Without a
|
|
1639
|
+
* `threadId`, a scoped caller gets the same denial whether or not the run exists, so the route
|
|
1640
|
+
* doesn't confirm live run ids.
|
|
1641
|
+
*/
|
|
1642
|
+
async function validateSignalRunOwnership(mastra, agent, runId, threadId, requestContext) {
|
|
1643
|
+
const contextResourceId = require_utils$1.getContextResourceId(requestContext);
|
|
1644
|
+
const runtimeAgent = agent;
|
|
1645
|
+
const runTarget = typeof runtimeAgent.getThreadRunTarget === "function" ? runtimeAgent.getThreadRunTarget(runId) : runtimeAgent.listActiveThreadRuns?.().find((run) => run.runId === runId);
|
|
1646
|
+
if (runTarget) await require_utils$1.validateRunOwnership(runTarget, contextResourceId, mastra, requestContext);
|
|
1647
|
+
else if (contextResourceId && !threadId) throw new require_http_exception.HTTPException(403, { message: "Access denied: workflow run belongs to a different resource" });
|
|
1648
|
+
}
|
|
1649
|
+
/**
|
|
1624
1650
|
* Maps a rejected `result.accepted` (signal/message routing) to an HTTP error.
|
|
1625
1651
|
*
|
|
1626
1652
|
* `accepted` only rejects on a setup/misconfig failure surfaced before the run
|
|
@@ -1683,6 +1709,7 @@ const SEND_AGENT_SIGNAL_ROUTE = require_route_builder.createRoute({
|
|
|
1683
1709
|
if (typeof agent.sendSignal !== "function") throw new require_http_exception.HTTPException(501, { message: "agent signals are not supported by this Mastra core version" });
|
|
1684
1710
|
const agentSignal = signal;
|
|
1685
1711
|
if (runId) {
|
|
1712
|
+
await validateSignalRunOwnership(mastra, agent, runId, effectiveThreadId, serverRequestContext);
|
|
1686
1713
|
const result = await agent.sendSignal(agentSignal, {
|
|
1687
1714
|
runId,
|
|
1688
1715
|
...effectiveResourceId ? { resourceId: effectiveResourceId } : {},
|
|
@@ -1753,6 +1780,7 @@ async function handleAgentMessageRoute({ mastra, agentId, requestContext: server
|
|
|
1753
1780
|
}
|
|
1754
1781
|
if (typeof agent[methodName] !== "function") throw new require_http_exception.HTTPException(501, { message: `agent ${methodName} is not supported by this Mastra core version` });
|
|
1755
1782
|
if (runId) {
|
|
1783
|
+
await validateSignalRunOwnership(mastra, agent, runId, effectiveThreadId, serverRequestContext);
|
|
1756
1784
|
const result = await invoke(agent, {
|
|
1757
1785
|
runId,
|
|
1758
1786
|
...effectiveResourceId ? { resourceId: effectiveResourceId } : {},
|
|
@@ -2333,10 +2361,11 @@ const OBSERVE_AGENT_STREAM_ROUTE = require_route_builder.createRoute({
|
|
|
2333
2361
|
permission: require_utils$1.MastraFGAPermissions.MEMORY_READ
|
|
2334
2362
|
})) throw new require_http_exception.HTTPException(404, { message: "Run not found" });
|
|
2335
2363
|
const durableAgent = (0, _mastra_core_agent.isDurableAgentLike)(agent) ? agent : void 0;
|
|
2364
|
+
const fencedAgent = ownsRunStreamHook(agent) && (usesDurableEngine(agent) ?? durableAgent) ? agent : void 0;
|
|
2336
2365
|
const pubsub = durableAgent?.pubsub ?? getAgentStreamPubSub(agent) ?? mastra.pubsub;
|
|
2337
2366
|
const topic = (0, _mastra_core_agent_durable.AGENT_STREAM_TOPIC)(runId);
|
|
2338
2367
|
const subscribe = (onEvent, onComplete) => {
|
|
2339
|
-
if (typeof
|
|
2368
|
+
if (typeof fencedAgent?.__subscribeToRunStream === "function") return fencedAgent.__subscribeToRunStream(runId, {
|
|
2340
2369
|
offset,
|
|
2341
2370
|
onComplete
|
|
2342
2371
|
}, onEvent);
|
|
@@ -2565,7 +2594,7 @@ const LIST_SUSPENDED_RUNS_ROUTE = require_route_builder.createRoute({
|
|
|
2565
2594
|
queryParamSchema: require_agents.listSuspendedRunsQuerySchema,
|
|
2566
2595
|
responseSchema: require_agents.listSuspendedRunsResponseSchema,
|
|
2567
2596
|
summary: "List suspended runs",
|
|
2568
|
-
description: "Lists suspended agent runs from storage
|
|
2597
|
+
description: "Lists suspended agent runs from storage \u2014 runs waiting on a tool-call approval or on a tool that suspended. Works after a server restart and across instances.",
|
|
2569
2598
|
tags: ["Agents", "Tools"],
|
|
2570
2599
|
requiresAuth: true,
|
|
2571
2600
|
handler: async ({ mastra, agentId, requestContext, ...query }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as schemaToJsonSchema } from "./route-builder-Dz18c3qm.js";
|
|
2
|
-
import { r as SERVER_ROUTES } from "./routes-
|
|
2
|
+
import { r as SERVER_ROUTES } from "./routes-BZVlqLly.js";
|
|
3
3
|
// src/server/server-adapter/api-schema-manifest.ts
|
|
4
4
|
function convertSchema(schema, io) {
|
|
5
5
|
return schema ? schemaToJsonSchema(schema, io) : void 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./rolldown-runtime-10nMEhjP.cjs");
|
|
2
2
|
const require_route_builder = require("./route-builder-DjTBxSZN.cjs");
|
|
3
|
-
const require_routes = require("./routes-
|
|
3
|
+
const require_routes = require("./routes-vuZLexcc.cjs");
|
|
4
4
|
// src/server/server-adapter/api-schema-manifest.ts
|
|
5
5
|
function convertSchema(schema, io) {
|
|
6
6
|
return schema ? require_route_builder.schemaToJsonSchema(schema, io) : void 0;
|
|
@@ -46,9 +46,11 @@ const authenticatedCapabilitiesSchema = publicCapabilitiesSchema.extend({
|
|
|
46
46
|
const capabilitiesResponseSchema = zod_v4.z.union([authenticatedCapabilitiesSchema, publicCapabilitiesSchema]);
|
|
47
47
|
const ssoLoginQuerySchema = zod_v4.z.object({ redirect_uri: zod_v4.z.string().optional() });
|
|
48
48
|
const ssoCallbackQuerySchema = zod_v4.z.object({
|
|
49
|
-
code: zod_v4.z.string(),
|
|
50
|
-
state: zod_v4.z.string().optional()
|
|
51
|
-
|
|
49
|
+
code: zod_v4.z.string().min(1).optional(),
|
|
50
|
+
state: zod_v4.z.string().optional(),
|
|
51
|
+
error: zod_v4.z.string().min(1).max(64).optional(),
|
|
52
|
+
error_description: zod_v4.z.string().max(256).optional()
|
|
53
|
+
}).refine((query) => Boolean(query.code) !== Boolean(query.error), { message: "Expected either an authorization code or an OAuth error, but not both" });
|
|
52
54
|
const ssoLoginResponseSchema = zod_v4.z.object({ url: zod_v4.z.string() });
|
|
53
55
|
const ssoCallbackResponseSchema = zod_v4.z.object({
|
|
54
56
|
success: zod_v4.z.boolean(),
|
|
@@ -46,9 +46,11 @@ const authenticatedCapabilitiesSchema = publicCapabilitiesSchema.extend({
|
|
|
46
46
|
const capabilitiesResponseSchema = z.union([authenticatedCapabilitiesSchema, publicCapabilitiesSchema]);
|
|
47
47
|
const ssoLoginQuerySchema = z.object({ redirect_uri: z.string().optional() });
|
|
48
48
|
const ssoCallbackQuerySchema = z.object({
|
|
49
|
-
code: z.string(),
|
|
50
|
-
state: z.string().optional()
|
|
51
|
-
|
|
49
|
+
code: z.string().min(1).optional(),
|
|
50
|
+
state: z.string().optional(),
|
|
51
|
+
error: z.string().min(1).max(64).optional(),
|
|
52
|
+
error_description: z.string().max(256).optional()
|
|
53
|
+
}).refine((query) => Boolean(query.code) !== Boolean(query.error), { message: "Expected either an authorization code or an OAuth error, but not both" });
|
|
52
54
|
const ssoLoginResponseSchema = z.object({ url: z.string() });
|
|
53
55
|
const ssoCallbackResponseSchema = z.object({
|
|
54
56
|
success: z.boolean(),
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { n as standardSchemaToJSONSchema, r as toStandardSchema } from "./schema-TQPB_dl2-CCzMcdDx.js";
|
|
2
2
|
import "./constants-C1ASuP4t.js";
|
|
3
|
-
import { G as getAgentFromSystem, f as GENERATE_AGENT_ROUTE, h as GET_AGENT_BY_ID_ROUTE, v as LIST_AGENTS_ROUTE } from "./agents-
|
|
4
|
-
import { a as LIST_TOOLS_ROUTE, i as GET_TOOL_BY_ID_ROUTE, n as EXECUTE_TOOL_ROUTE, o as findTool } from "./tools-
|
|
5
|
-
import { _ as RESUME_ASYNC_WORKFLOW_ROUTE, a as GET_WORKFLOW_BY_ID_ROUTE, k as listWorkflowsFromSystem, o as GET_WORKFLOW_RUN_BY_ID_ROUTE, s as LIST_WORKFLOWS_ROUTE, t as CANCEL_WORKFLOW_RUN_ROUTE, x as START_ASYNC_WORKFLOW_ROUTE } from "./workflows-
|
|
6
|
-
import { o as checkRouteRBAC, r as authorizeRoute, s as dispatchRoute } from "./server-adapter-
|
|
7
|
-
import { c as getBuiltinMCPCapabilities, s as getEffectivePermission } from "./routes-
|
|
3
|
+
import { G as getAgentFromSystem, f as GENERATE_AGENT_ROUTE, h as GET_AGENT_BY_ID_ROUTE, v as LIST_AGENTS_ROUTE } from "./agents-CAXsXenf.js";
|
|
4
|
+
import { a as LIST_TOOLS_ROUTE, i as GET_TOOL_BY_ID_ROUTE, n as EXECUTE_TOOL_ROUTE, o as findTool } from "./tools-C3KBdlil.js";
|
|
5
|
+
import { _ as RESUME_ASYNC_WORKFLOW_ROUTE, a as GET_WORKFLOW_BY_ID_ROUTE, k as listWorkflowsFromSystem, o as GET_WORKFLOW_RUN_BY_ID_ROUTE, s as LIST_WORKFLOWS_ROUTE, t as CANCEL_WORKFLOW_RUN_ROUTE, x as START_ASYNC_WORKFLOW_ROUTE } from "./workflows-D5bfbang.js";
|
|
6
|
+
import { o as checkRouteRBAC, r as authorizeRoute, s as dispatchRoute } from "./server-adapter-h8YRQXAC.js";
|
|
7
|
+
import { c as getBuiltinMCPCapabilities, s as getEffectivePermission } from "./routes-BZVlqLly.js";
|
|
8
8
|
import "./utils-C2VRtQjI.js";
|
|
9
9
|
import { E as UPDATE_THREAD_ROUTE, b as LIST_THREADS_ROUTE, d as GET_MEMORY_STATUS_ROUTE, f as GET_OBSERVATIONAL_MEMORY_ROUTE, g as GET_WORKING_MEMORY_ROUTE, h as GET_THREAD_BY_ID_ROUTE, i as CREATE_THREAD_ROUTE, l as GET_MEMORY_CONFIG_ROUTE, n as CLONE_THREAD_ROUTE, p as GET_RESOURCE_WORKING_MEMORY_ROUTE, t as AWAIT_BUFFER_STATUS_ROUTE, v as LIST_MESSAGES_ROUTE } from "./memory-03B4pe3w.js";
|
|
10
|
-
import { a as GET_TRACE_ROUTE, i as GET_TRACE_LIGHT_ROUTE, o as GET_TRACE_TRAJECTORY_ROUTE, r as GET_SPAN_ROUTE, u as LIST_TRACES_ROUTE } from "./observability-
|
|
10
|
+
import { a as GET_TRACE_ROUTE, i as GET_TRACE_LIGHT_ROUTE, o as GET_TRACE_TRAJECTORY_ROUTE, r as GET_SPAN_ROUTE, u as LIST_TRACES_ROUTE } from "./observability-URaJnI_U.js";
|
|
11
11
|
import { A as GET_TRACE_QUERY_FIELDS, D as GET_SCORE_TIME_SERIES, E as GET_SCORE_PERCENTILES, F as LIST_SCORES, L as QUERY_SPANS, M as LIST_FEEDBACK, N as LIST_LOGS, O as GET_SERVICE_NAMES, R as QUERY_THREADS, S as GET_METRIC_TIME_SERIES, T as GET_SCORE_BREAKDOWN, _ as GET_METRIC_BREAKDOWN, b as GET_METRIC_NAMES, c as GET_ENTITY_NAMES, f as GET_FEEDBACK_AGGREGATE, g as GET_METRIC_AGGREGATE, h as GET_FEEDBACK_TIME_SERIES, j as GET_TRACE_QUERY_VALUES, k as GET_TAGS, l as GET_ENTITY_TYPES, m as GET_FEEDBACK_PERCENTILES, n as AGGREGATE_TRACES, p as GET_FEEDBACK_BREAKDOWN, s as GET_CAPABILITIES, t as AGGREGATE_SPANS, u as GET_ENVIRONMENTS, v as GET_METRIC_LABEL_KEYS, w as GET_SCORE_AGGREGATE, x as GET_METRIC_PERCENTILES, y as GET_METRIC_LABEL_VALUES, z as QUERY_TRACES } from "./observability-new-endpoints-vj6FaEcm.js";
|
|
12
|
-
import { t as GET_EDITOR_BUILDER_AVAILABLE_MODELS_ROUTE } from "./editor-builder-
|
|
12
|
+
import { t as GET_EDITOR_BUILDER_AVAILABLE_MODELS_ROUTE } from "./editor-builder-BRzXnsRW.js";
|
|
13
13
|
import { CREATE_STORED_AGENT_ROUTE, GET_STORED_AGENT_ROUTE, LIST_STORED_AGENTS_ROUTE, UPDATE_STORED_AGENT_ROUTE } from "./server/handlers/stored-agents.js";
|
|
14
|
-
import { O as updateStoredAgentBodySchema, n as createStoredAgentBodySchema } from "./stored-agents-
|
|
14
|
+
import { O as updateStoredAgentBodySchema, n as createStoredAgentBodySchema } from "./stored-agents-DcyDMKP2.js";
|
|
15
15
|
import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
|
|
16
16
|
import { createTool } from "@mastra/core/tools";
|
|
17
17
|
import * as coreStorage from "@mastra/core/storage";
|
|
@@ -367,13 +367,13 @@ async function addMemoryTools(kit) {
|
|
|
367
367
|
}, signal));
|
|
368
368
|
}
|
|
369
369
|
// src/server/mcp/toolsets/observability-summary.ts
|
|
370
|
-
const DETAILS = "Call get_trace with a traceId for its span tree, and get_span for a span
|
|
370
|
+
const DETAILS = "Call get_trace with a traceId for its span tree, and get_span for a span\u2019s full input and output.";
|
|
371
371
|
const isRow = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
372
372
|
const rowsOf = (output, key) => Array.isArray(output[key]) ? output[key].filter(isRow) : [];
|
|
373
373
|
const text = (value, max) => {
|
|
374
374
|
if (typeof value !== "string" || !value) return void 0;
|
|
375
375
|
const line = value.replace(/\s+/g, " ").trim();
|
|
376
|
-
return line.length > max ? `${line.slice(0, max)}
|
|
376
|
+
return line.length > max ? `${line.slice(0, max)}\u2026` : line;
|
|
377
377
|
};
|
|
378
378
|
function duration(row) {
|
|
379
379
|
if (typeof row.durationMs === "number") return `${row.durationMs}ms`;
|
|
@@ -750,7 +750,7 @@ function addObservabilityTools(kit) {
|
|
|
750
750
|
GET_METRIC_LABEL_KEYS,
|
|
751
751
|
GET_METRIC_LABEL_VALUES
|
|
752
752
|
], object({
|
|
753
|
-
metricName: str("List the label keys of this metric (or, with labelKey, one label
|
|
753
|
+
metricName: str("List the label keys of this metric (or, with labelKey, one label\u2019s values)."),
|
|
754
754
|
labelKey: str("With metricName, list the values of this label."),
|
|
755
755
|
prefix: str("Only names or values starting with this."),
|
|
756
756
|
limit: {
|