@mastra/server 1.86.0-alpha.6 → 1.86.0-alpha.8
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-BFN2C8f2.js → a2a-BfWMjFe2.js} +1 -1
- package/dist/{a2a-DlEIsCZz.cjs → a2a-DQIwTZyo.cjs} +1 -1
- package/dist/{agent-builder-Bd6qGrt6.js → agent-builder-DpuK5-6A.js} +2 -2
- package/dist/{agent-builder-Bz1beuPE.cjs → agent-builder-NSemjs4B.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-DiQ_L6BU.cjs → agents-BO1mcMDf.cjs} +31 -9
- package/dist/{agents-BMdbohgU.js → agents-YvaBPFiS.js} +31 -9
- package/dist/{api-schema-manifest-BuAf53GH.cjs → api-schema-manifest-016lHJO2.cjs} +1 -1
- package/dist/{api-schema-manifest-CsefW4Vv.js → api-schema-manifest-CAZsA5Lk.js} +1 -1
- package/dist/{catalogue-CAIZ08il.cjs → catalogue-Cf7Zz7zb.cjs} +11 -11
- package/dist/{catalogue-BtSLF1p2.js → catalogue-DN4dvU88.js} +11 -11
- package/dist/{conversations-Dzpv_Cgt.js → conversations-4ZO0Pjvk.js} +1 -1
- package/dist/{conversations-6v0VCbif.cjs → conversations-BaYtooZZ.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-Bz6gINFc.js +1 -0
- package/dist/{dist-C5rwoPuL.cjs → dist-DaRCrkAU.cjs} +514 -238
- package/dist/{dist-C0Das1QD.cjs → dist-uiPbWl5E.cjs} +1 -1
- package/dist/{dist-Czbww9cr.js → dist-yny1avqv.js} +514 -238
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +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-Cx9ZiHBw.cjs → editor-builder-ChYG8YTs.cjs} +1 -1
- package/dist/{editor-builder-DpNB1W4s.js → editor-builder-CwsIbd0F.js} +1 -1
- 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-BoUO4vWD.js → plans-CbR8EDiT.js} +1 -1
- package/dist/{plans-DYNE2s8s.cjs → plans-k3UN9Nd1.cjs} +1 -1
- package/dist/probe-image-size-DZvSdjzK.js +13297 -0
- package/dist/probe-image-size-z8zXmjaH.cjs +13304 -0
- package/dist/{responses-ByDnfqlJ.cjs → responses-B-BKx236.cjs} +1 -1
- package/dist/{responses-CGv4KFQ3.js → responses-Blzxy0XP.js} +1 -1
- package/dist/{routes-C0TLNOPH.js → routes-D-I2voQe.js} +16 -16
- package/dist/{routes-BLjObOVE.cjs → routes-jiZyt9kU.cjs} +16 -16
- 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-EVbkxGHy.cjs → scores-BikU9phm.cjs} +1 -1
- package/dist/{scores-CqNF-thA.js → scores-DAv6Uisq.js} +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 +1 -1
- package/dist/server/handlers/auth.js +1 -1
- 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/favorites-enrichment.cjs +1 -1
- package/dist/server/handlers/favorites-enrichment.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/datasets.d.ts +3 -0
- package/dist/server/schemas/index.cjs +6 -6
- package/dist/server/schemas/index.js +6 -6
- 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-BkAKl970.cjs → server-adapter-BB2Lw2Ig.cjs} +4 -4
- package/dist/{server-adapter-CxMHZZAv.js → server-adapter-CMJcvkpD.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-D07qyAT0.cjs → tools-CoamSJif.cjs} +1 -1
- package/dist/{tools-CZmeb9MB.js → tools-DsSk01Ti.js} +1 -1
- package/dist/{voice-BNwHCtxv.js → voice-BFh2Zx5m.js} +1 -1
- package/dist/{voice-DN72TM58.cjs → voice-CquR7YyA.cjs} +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-C_7xKME1.js +0 -1
- package/dist/probe-image-size-C0BvSeqt.js +0 -13297
- package/dist/probe-image-size-DQsyQSUh.cjs +0 -13304
|
@@ -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-YvaBPFiS.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-BO1mcMDf.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-yny1avqv.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-DaRCrkAU.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 @@ 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");
|
|
@@ -295,8 +295,28 @@ const DURABLE_SNAPSHOT_WAIT_INTERVAL_MS = 25;
|
|
|
295
295
|
function getDurableLoopWorkflowName(agent) {
|
|
296
296
|
return agent.durableLoopWorkflowName ?? _mastra_core_agent_durable.DurableStepIds.AGENTIC_LOOP;
|
|
297
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Whether the agent's runs execute on a durable engine and persist durable-loop snapshots:
|
|
300
|
+
* legacy wrappers, or a native Agent whose execution engine is durable/evented. Structural
|
|
301
|
+
* so agents from another `@mastra/core` copy are still recognized.
|
|
302
|
+
*/
|
|
303
|
+
function hasDurableExecution(agent) {
|
|
304
|
+
if ((0, _mastra_core_agent.isDurableAgentLike)(agent)) return true;
|
|
305
|
+
const native = agent;
|
|
306
|
+
return typeof native.__hasDurableExecution === "function" && native.__hasDurableExecution();
|
|
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
|
+
}
|
|
298
318
|
async function validateDurableToolCallAccess({ mastra, agent, runId, toolCallId, requestContext, threadId, abortSignal }) {
|
|
299
|
-
if (!(
|
|
319
|
+
if (!hasDurableExecution(agent)) return;
|
|
300
320
|
const workflowsStore = await mastra.getStorage()?.getStore("workflows");
|
|
301
321
|
if (!workflowsStore) throw new require_http_exception.HTTPException(403, { message: "Access denied: durable run belongs to a different resource" });
|
|
302
322
|
const workflowName = getDurableLoopWorkflowName(agent);
|
|
@@ -378,7 +398,7 @@ async function authorizeRunOwner({ mastra, agent, owner, requestContext, permiss
|
|
|
378
398
|
}
|
|
379
399
|
/** Whether the agent publishes its runs, so a closed HTTP reader can detach instead of aborting. */
|
|
380
400
|
function hasResumableStreams(agent) {
|
|
381
|
-
if ((
|
|
401
|
+
if (hasDurableExecution(agent)) return true;
|
|
382
402
|
const resumable = agent;
|
|
383
403
|
return typeof resumable.hasResumableStreams === "function" && resumable.hasResumableStreams();
|
|
384
404
|
}
|
|
@@ -1917,7 +1937,7 @@ async function authorizeDurableRun({ mastra, agent, runId, requestContext, permi
|
|
|
1917
1937
|
* Aborts never use them, so a finished run is not reported stopped.
|
|
1918
1938
|
*/
|
|
1919
1939
|
async function authorizeRunAccess({ mastra, agent, runId, requestContext, permission }) {
|
|
1920
|
-
if (!(
|
|
1940
|
+
if (!hasDurableExecution(agent)) {
|
|
1921
1941
|
const record = await getPlainRunRecord(agent, runId);
|
|
1922
1942
|
if (!record) return void 0;
|
|
1923
1943
|
await authorizeRunOwner({
|
|
@@ -1986,7 +2006,8 @@ const ABORT_AGENT_RUN_ROUTE = require_route_builder.createRoute({
|
|
|
1986
2006
|
agentId,
|
|
1987
2007
|
requestContext
|
|
1988
2008
|
});
|
|
1989
|
-
|
|
2009
|
+
const durable = hasDurableExecution(agent);
|
|
2010
|
+
if (!durable) {
|
|
1990
2011
|
const resumable = agent;
|
|
1991
2012
|
if (typeof resumable.__getRunRecord !== "function" && typeof resumable.__getPublishedRunOwner !== "function" || !hasResumableStreams(agent)) throw new require_http_exception.HTTPException(501, { message: "Run-scoped cancellation requires a durable agent or an agent with resumable streams" });
|
|
1992
2013
|
}
|
|
@@ -1997,7 +2018,7 @@ const ABORT_AGENT_RUN_ROUTE = require_route_builder.createRoute({
|
|
|
1997
2018
|
requestContext,
|
|
1998
2019
|
permission: require_utils$1.MastraFGAPermissions.MEMORY_WRITE
|
|
1999
2020
|
});
|
|
2000
|
-
if (!
|
|
2021
|
+
if (!durable) {
|
|
2001
2022
|
if (!run) throw new require_http_exception.HTTPException(404, { message: "Run not found" });
|
|
2002
2023
|
if (run.status === "finished") return { aborted: false };
|
|
2003
2024
|
const resumable = agent;
|
|
@@ -2322,10 +2343,11 @@ const OBSERVE_AGENT_STREAM_ROUTE = require_route_builder.createRoute({
|
|
|
2322
2343
|
permission: require_utils$1.MastraFGAPermissions.MEMORY_READ
|
|
2323
2344
|
})) throw new require_http_exception.HTTPException(404, { message: "Run not found" });
|
|
2324
2345
|
const durableAgent = (0, _mastra_core_agent.isDurableAgentLike)(agent) ? agent : void 0;
|
|
2346
|
+
const fencedAgent = ownsRunStreamHook(agent) && (usesDurableEngine(agent) ?? durableAgent) ? agent : void 0;
|
|
2325
2347
|
const pubsub = durableAgent?.pubsub ?? getAgentStreamPubSub(agent) ?? mastra.pubsub;
|
|
2326
2348
|
const topic = (0, _mastra_core_agent_durable.AGENT_STREAM_TOPIC)(runId);
|
|
2327
2349
|
const subscribe = (onEvent, onComplete) => {
|
|
2328
|
-
if (typeof
|
|
2350
|
+
if (typeof fencedAgent?.__subscribeToRunStream === "function") return fencedAgent.__subscribeToRunStream(runId, {
|
|
2329
2351
|
offset,
|
|
2330
2352
|
onComplete
|
|
2331
2353
|
}, onEvent);
|
|
@@ -2554,7 +2576,7 @@ const LIST_SUSPENDED_RUNS_ROUTE = require_route_builder.createRoute({
|
|
|
2554
2576
|
queryParamSchema: require_agents.listSuspendedRunsQuerySchema,
|
|
2555
2577
|
responseSchema: require_agents.listSuspendedRunsResponseSchema,
|
|
2556
2578
|
summary: "List suspended runs",
|
|
2557
|
-
description: "Lists suspended agent runs from storage
|
|
2579
|
+
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.",
|
|
2558
2580
|
tags: ["Agents", "Tools"],
|
|
2559
2581
|
requiresAuth: true,
|
|
2560
2582
|
handler: async ({ mastra, agentId, requestContext, ...query }) => {
|
|
@@ -2763,7 +2785,7 @@ const RECOVER_ROUTE = require_route_builder.createRoute({
|
|
|
2763
2785
|
versionOptions,
|
|
2764
2786
|
requestContext: serverRequestContext
|
|
2765
2787
|
});
|
|
2766
|
-
if (!(
|
|
2788
|
+
if (!hasDurableExecution(agent)) throw new require_http_exception.HTTPException(400, { message: "Agent does not support recover. Only agents on a durable or evented execution engine can recover runs." });
|
|
2767
2789
|
const workflowRun = await (await mastra.getStorage()?.getStore("workflows"))?.getWorkflowRunById({
|
|
2768
2790
|
workflowName: getDurableLoopWorkflowName(agent),
|
|
2769
2791
|
runId
|
|
@@ -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";
|
|
@@ -295,8 +295,28 @@ const DURABLE_SNAPSHOT_WAIT_INTERVAL_MS = 25;
|
|
|
295
295
|
function getDurableLoopWorkflowName(agent) {
|
|
296
296
|
return agent.durableLoopWorkflowName ?? DurableStepIds.AGENTIC_LOOP;
|
|
297
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Whether the agent's runs execute on a durable engine and persist durable-loop snapshots:
|
|
300
|
+
* legacy wrappers, or a native Agent whose execution engine is durable/evented. Structural
|
|
301
|
+
* so agents from another `@mastra/core` copy are still recognized.
|
|
302
|
+
*/
|
|
303
|
+
function hasDurableExecution(agent) {
|
|
304
|
+
if (isDurableAgentLike(agent)) return true;
|
|
305
|
+
const native = agent;
|
|
306
|
+
return typeof native.__hasDurableExecution === "function" && native.__hasDurableExecution();
|
|
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
|
+
}
|
|
298
318
|
async function validateDurableToolCallAccess({ mastra, agent, runId, toolCallId, requestContext, threadId, abortSignal }) {
|
|
299
|
-
if (!
|
|
319
|
+
if (!hasDurableExecution(agent)) return;
|
|
300
320
|
const workflowsStore = await mastra.getStorage()?.getStore("workflows");
|
|
301
321
|
if (!workflowsStore) throw new HTTPException(403, { message: "Access denied: durable run belongs to a different resource" });
|
|
302
322
|
const workflowName = getDurableLoopWorkflowName(agent);
|
|
@@ -378,7 +398,7 @@ async function authorizeRunOwner({ mastra, agent, owner, requestContext, permiss
|
|
|
378
398
|
}
|
|
379
399
|
/** Whether the agent publishes its runs, so a closed HTTP reader can detach instead of aborting. */
|
|
380
400
|
function hasResumableStreams(agent) {
|
|
381
|
-
if (
|
|
401
|
+
if (hasDurableExecution(agent)) return true;
|
|
382
402
|
const resumable = agent;
|
|
383
403
|
return typeof resumable.hasResumableStreams === "function" && resumable.hasResumableStreams();
|
|
384
404
|
}
|
|
@@ -1917,7 +1937,7 @@ async function authorizeDurableRun({ mastra, agent, runId, requestContext, permi
|
|
|
1917
1937
|
* Aborts never use them, so a finished run is not reported stopped.
|
|
1918
1938
|
*/
|
|
1919
1939
|
async function authorizeRunAccess({ mastra, agent, runId, requestContext, permission }) {
|
|
1920
|
-
if (!
|
|
1940
|
+
if (!hasDurableExecution(agent)) {
|
|
1921
1941
|
const record = await getPlainRunRecord(agent, runId);
|
|
1922
1942
|
if (!record) return void 0;
|
|
1923
1943
|
await authorizeRunOwner({
|
|
@@ -1986,7 +2006,8 @@ const ABORT_AGENT_RUN_ROUTE = createRoute({
|
|
|
1986
2006
|
agentId,
|
|
1987
2007
|
requestContext
|
|
1988
2008
|
});
|
|
1989
|
-
|
|
2009
|
+
const durable = hasDurableExecution(agent);
|
|
2010
|
+
if (!durable) {
|
|
1990
2011
|
const resumable = agent;
|
|
1991
2012
|
if (typeof resumable.__getRunRecord !== "function" && typeof resumable.__getPublishedRunOwner !== "function" || !hasResumableStreams(agent)) throw new HTTPException(501, { message: "Run-scoped cancellation requires a durable agent or an agent with resumable streams" });
|
|
1992
2013
|
}
|
|
@@ -1997,7 +2018,7 @@ const ABORT_AGENT_RUN_ROUTE = createRoute({
|
|
|
1997
2018
|
requestContext,
|
|
1998
2019
|
permission: MastraFGAPermissions.MEMORY_WRITE
|
|
1999
2020
|
});
|
|
2000
|
-
if (!
|
|
2021
|
+
if (!durable) {
|
|
2001
2022
|
if (!run) throw new HTTPException(404, { message: "Run not found" });
|
|
2002
2023
|
if (run.status === "finished") return { aborted: false };
|
|
2003
2024
|
const resumable = agent;
|
|
@@ -2322,10 +2343,11 @@ const OBSERVE_AGENT_STREAM_ROUTE = createRoute({
|
|
|
2322
2343
|
permission: MastraFGAPermissions.MEMORY_READ
|
|
2323
2344
|
})) throw new HTTPException(404, { message: "Run not found" });
|
|
2324
2345
|
const durableAgent = isDurableAgentLike(agent) ? agent : void 0;
|
|
2346
|
+
const fencedAgent = ownsRunStreamHook(agent) && (usesDurableEngine(agent) ?? durableAgent) ? agent : void 0;
|
|
2325
2347
|
const pubsub = durableAgent?.pubsub ?? getAgentStreamPubSub(agent) ?? mastra.pubsub;
|
|
2326
2348
|
const topic = AGENT_STREAM_TOPIC(runId);
|
|
2327
2349
|
const subscribe = (onEvent, onComplete) => {
|
|
2328
|
-
if (typeof
|
|
2350
|
+
if (typeof fencedAgent?.__subscribeToRunStream === "function") return fencedAgent.__subscribeToRunStream(runId, {
|
|
2329
2351
|
offset,
|
|
2330
2352
|
onComplete
|
|
2331
2353
|
}, onEvent);
|
|
@@ -2554,7 +2576,7 @@ const LIST_SUSPENDED_RUNS_ROUTE = createRoute({
|
|
|
2554
2576
|
queryParamSchema: listSuspendedRunsQuerySchema,
|
|
2555
2577
|
responseSchema: listSuspendedRunsResponseSchema,
|
|
2556
2578
|
summary: "List suspended runs",
|
|
2557
|
-
description: "Lists suspended agent runs from storage
|
|
2579
|
+
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.",
|
|
2558
2580
|
tags: ["Agents", "Tools"],
|
|
2559
2581
|
requiresAuth: true,
|
|
2560
2582
|
handler: async ({ mastra, agentId, requestContext, ...query }) => {
|
|
@@ -2763,7 +2785,7 @@ const RECOVER_ROUTE = createRoute({
|
|
|
2763
2785
|
versionOptions,
|
|
2764
2786
|
requestContext: serverRequestContext
|
|
2765
2787
|
});
|
|
2766
|
-
if (!
|
|
2788
|
+
if (!hasDurableExecution(agent)) throw new HTTPException(400, { message: "Agent does not support recover. Only agents on a durable or evented execution engine can recover runs." });
|
|
2767
2789
|
const workflowRun = await (await mastra.getStorage()?.getStore("workflows"))?.getWorkflowRunById({
|
|
2768
2790
|
workflowName: getDurableLoopWorkflowName(agent),
|
|
2769
2791
|
runId
|
|
@@ -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-jiZyt9kU.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;
|
|
@@ -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-D-I2voQe.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,18 +1,18 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-10nMEhjP.cjs");
|
|
2
2
|
const require_schema_TQPB_dl2 = require("./schema-TQPB_dl2-CJX1q58F.cjs");
|
|
3
3
|
require("./constants-CyNbINin.cjs");
|
|
4
|
-
const require_agents = require("./agents-
|
|
5
|
-
const require_tools = require("./tools-
|
|
6
|
-
const require_workflows = require("./workflows-
|
|
7
|
-
const require_server_adapter = require("./server-adapter-
|
|
8
|
-
const require_routes = require("./routes-
|
|
4
|
+
const require_agents = require("./agents-BO1mcMDf.cjs");
|
|
5
|
+
const require_tools = require("./tools-CoamSJif.cjs");
|
|
6
|
+
const require_workflows = require("./workflows-CHKSHV4f.cjs");
|
|
7
|
+
const require_server_adapter = require("./server-adapter-BB2Lw2Ig.cjs");
|
|
8
|
+
const require_routes = require("./routes-jiZyt9kU.cjs");
|
|
9
9
|
require("./utils-DQJOBnMo.cjs");
|
|
10
10
|
const require_memory = require("./memory-4Izw-l6v.cjs");
|
|
11
|
-
const require_observability = require("./observability-
|
|
11
|
+
const require_observability = require("./observability-zNA_CVaz.cjs");
|
|
12
12
|
const require_observability_new_endpoints = require("./observability-new-endpoints-iRwQxqwY.cjs");
|
|
13
|
-
const require_editor_builder = require("./editor-builder-
|
|
13
|
+
const require_editor_builder = require("./editor-builder-ChYG8YTs.cjs");
|
|
14
14
|
const require_server_handlers_stored_agents = require("./server/handlers/stored-agents.cjs");
|
|
15
|
-
const require_stored_agents = require("./stored-agents-
|
|
15
|
+
const require_stored_agents = require("./stored-agents-BS4_LGSs.cjs");
|
|
16
16
|
let _mastra_core_error = require("@mastra/core/error");
|
|
17
17
|
let _mastra_core_tools = require("@mastra/core/tools");
|
|
18
18
|
let _mastra_core_storage = require("@mastra/core/storage");
|
|
@@ -369,13 +369,13 @@ async function addMemoryTools(kit) {
|
|
|
369
369
|
}, signal));
|
|
370
370
|
}
|
|
371
371
|
// src/server/mcp/toolsets/observability-summary.ts
|
|
372
|
-
const DETAILS = "Call get_trace with a traceId for its span tree, and get_span for a span
|
|
372
|
+
const DETAILS = "Call get_trace with a traceId for its span tree, and get_span for a span\u2019s full input and output.";
|
|
373
373
|
const isRow = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
374
374
|
const rowsOf = (output, key) => Array.isArray(output[key]) ? output[key].filter(isRow) : [];
|
|
375
375
|
const text = (value, max) => {
|
|
376
376
|
if (typeof value !== "string" || !value) return void 0;
|
|
377
377
|
const line = value.replace(/\s+/g, " ").trim();
|
|
378
|
-
return line.length > max ? `${line.slice(0, max)}
|
|
378
|
+
return line.length > max ? `${line.slice(0, max)}\u2026` : line;
|
|
379
379
|
};
|
|
380
380
|
function duration(row) {
|
|
381
381
|
if (typeof row.durationMs === "number") return `${row.durationMs}ms`;
|
|
@@ -752,7 +752,7 @@ function addObservabilityTools(kit) {
|
|
|
752
752
|
require_observability_new_endpoints.GET_METRIC_LABEL_KEYS,
|
|
753
753
|
require_observability_new_endpoints.GET_METRIC_LABEL_VALUES
|
|
754
754
|
], object({
|
|
755
|
-
metricName: str("List the label keys of this metric (or, with labelKey, one label
|
|
755
|
+
metricName: str("List the label keys of this metric (or, with labelKey, one label\u2019s values)."),
|
|
756
756
|
labelKey: str("With metricName, list the values of this label."),
|
|
757
757
|
prefix: str("Only names or values starting with this."),
|
|
758
758
|
limit: {
|