@mastra/server 1.79.0-alpha.3 → 1.79.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/schemas.d.ts +3 -1
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/util.d.ts +2 -0
- package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-v6/dist/index.d.ts +95 -1095
- package/dist/{a2a-D5CGFO8W.cjs → a2a-BSJETR5U.cjs} +3 -3
- package/dist/a2a-BSJETR5U.cjs.map +1 -0
- package/dist/{a2a-Dg3ylOKc.js → a2a-hc5lDJCh.js} +3 -3
- package/dist/{a2a-D5CGFO8W.cjs.map → a2a-hc5lDJCh.js.map} +1 -1
- package/dist/{agents-D9vpLghy.cjs → agents-BgeSrhey.cjs} +2 -1
- package/dist/agents-BgeSrhey.cjs.map +1 -0
- package/dist/{agents-DNWDET4U.js → agents-wamaX7m2.js} +2 -1
- package/dist/agents-wamaX7m2.js.map +1 -0
- package/dist/{api-schema-manifest-CI0gyTVi.cjs → api-schema-manifest-BIpRlCSx.cjs} +9 -3
- package/dist/api-schema-manifest-BIpRlCSx.cjs.map +1 -0
- package/dist/{api-schema-manifest-BgWM-O7K.js → api-schema-manifest-Zr5wt6oZ.js} +9 -3
- package/dist/api-schema-manifest-Zr5wt6oZ.js.map +1 -0
- package/dist/{background-tasks-BbYzMhlD.cjs → background-tasks-B-OILmJH.cjs} +3 -3
- package/dist/{background-tasks-BbYzMhlD.cjs.map → background-tasks-B-OILmJH.cjs.map} +1 -1
- package/dist/{background-tasks-zvlIcbhg.js → background-tasks-xOB2d8x6.js} +3 -3
- package/dist/{background-tasks-zvlIcbhg.js.map → background-tasks-xOB2d8x6.js.map} +1 -1
- package/dist/{builder-registry-1GwmVVwr.js → builder-registry-BvLWRDhU.js} +3 -3
- package/dist/{builder-registry-1GwmVVwr.js.map → builder-registry-BvLWRDhU.js.map} +1 -1
- package/dist/{builder-registry-DagCZI4A.cjs → builder-registry-DMTPXlGU.cjs} +3 -3
- package/dist/{builder-registry-DagCZI4A.cjs.map → builder-registry-DMTPXlGU.cjs.map} +1 -1
- package/dist/{channels-5J7CTFyY.cjs → channels-B0IpCxzk.cjs} +2 -2
- package/dist/{channels-5J7CTFyY.cjs.map → channels-B0IpCxzk.cjs.map} +1 -1
- package/dist/{channels-B3aoI-f1.js → channels-CmWBm-JB.js} +2 -2
- package/dist/{channels-B3aoI-f1.js.map → channels-CmWBm-JB.js.map} +1 -1
- package/dist/{dist-D5O8s1u2.cjs → dist-3FPW9nVj.cjs} +3 -3
- package/dist/{dist-D5O8s1u2.cjs.map → dist-3FPW9nVj.cjs.map} +1 -1
- package/dist/{dist-Bw2XgCSY.cjs → dist-B5OwHWTo.cjs} +3 -3
- package/dist/{dist-Bw2XgCSY.cjs.map → dist-B5OwHWTo.cjs.map} +1 -1
- package/dist/{dist-C5TZXkhS.js → dist-B_bet8uz.js} +2 -2
- package/dist/{dist-C5TZXkhS.js.map → dist-B_bet8uz.js.map} +1 -1
- package/dist/{dist-CWqDEEO3.cjs → dist-Bi2UyBDO.cjs} +582 -880
- package/dist/{dist-B07TBQpE.js.map → dist-Bi2UyBDO.cjs.map} +1 -1
- package/dist/{dist-8fx1_bLF.js → dist-BwYL7Ykb.js} +3 -3
- package/dist/{dist-8fx1_bLF.js.map → dist-BwYL7Ykb.js.map} +1 -1
- package/dist/{dist-_RnqhYfY.js → dist-BxMmGD3n.js} +3 -3
- package/dist/{dist-_RnqhYfY.js.map → dist-BxMmGD3n.js.map} +1 -1
- package/dist/{dist-D1oSHJhK.js → dist-CBRJax5e.js} +3 -3
- package/dist/{dist-D1oSHJhK.js.map → dist-CBRJax5e.js.map} +1 -1
- package/dist/{dist-D5mpJHHH.cjs → dist-CQ3FSKT-.cjs} +3 -3
- package/dist/{dist-D5mpJHHH.cjs.map → dist-CQ3FSKT-.cjs.map} +1 -1
- package/dist/{dist-B07TBQpE.js → dist-CSVQ5lzr.js} +583 -881
- package/dist/dist-CSVQ5lzr.js.map +1 -0
- package/dist/{dist-CgemVduI.cjs → dist-DC1Pewf5.cjs} +4 -4
- package/dist/{dist-CgemVduI.cjs.map → dist-DC1Pewf5.cjs.map} +1 -1
- package/dist/{dist-BCTqy9i3.js → dist-DOWsEmo6.js} +4 -4
- package/dist/{dist-BCTqy9i3.js.map → dist-DOWsEmo6.js.map} +1 -1
- package/dist/{dist-Bz4l8I_x.js → dist-DcoIg_tp.js} +3 -3
- package/dist/{dist-Bz4l8I_x.js.map → dist-DcoIg_tp.js.map} +1 -1
- package/dist/{dist-UACuV_1t.cjs → dist-UKEksCGq.cjs} +3 -3
- package/dist/{dist-UACuV_1t.cjs.map → dist-UKEksCGq.cjs.map} +1 -1
- package/dist/{dist-tYOY8gEs.cjs → dist-rDRetJVY.cjs} +2 -2
- package/dist/{dist-tYOY8gEs.cjs.map → dist-rDRetJVY.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-observability-tracing-trace-query.md +39 -10
- package/dist/{dynamic-workflows-BL3eD0zL.cjs → dynamic-workflows-BVW4SyS5.cjs} +2 -2
- package/dist/{dynamic-workflows-BL3eD0zL.cjs.map → dynamic-workflows-BVW4SyS5.cjs.map} +1 -1
- package/dist/{dynamic-workflows-BJfoQMo8.js → dynamic-workflows-CE-xM2NQ.js} +2 -2
- package/dist/{dynamic-workflows-BJfoQMo8.js.map → dynamic-workflows-CE-xM2NQ.js.map} +1 -1
- package/dist/{editor-builder-BOmAPurW.cjs → editor-builder-C2dwLp86.cjs} +3 -3
- package/dist/{editor-builder-BOmAPurW.cjs.map → editor-builder-C2dwLp86.cjs.map} +1 -1
- package/dist/{editor-builder-DHqCWGd2.js → editor-builder-C5xHbYcZ.js} +2 -2
- package/dist/{editor-builder-DHqCWGd2.js.map → editor-builder-C5xHbYcZ.js.map} +1 -1
- package/dist/{editor-builder-DqHKoEDx.cjs → editor-builder-CP7URDqM.cjs} +2 -2
- package/dist/{editor-builder-DqHKoEDx.cjs.map → editor-builder-CP7URDqM.cjs.map} +1 -1
- package/dist/{editor-builder-CeLVu_FT.js → editor-builder-DdZk963o.js} +3 -3
- package/dist/{editor-builder-CeLVu_FT.js.map → editor-builder-DdZk963o.js.map} +1 -1
- package/dist/{observability-new-endpoints-BKFVVMTS.cjs → observability-new-endpoints-CXbVKROm.cjs} +74 -17
- package/dist/observability-new-endpoints-CXbVKROm.cjs.map +1 -0
- package/dist/{observability-new-endpoints-C5VO7nLK.js → observability-new-endpoints-JxqtW8f5.js} +75 -18
- package/dist/observability-new-endpoints-JxqtW8f5.js.map +1 -0
- package/dist/{route-builder-lBil8Cvo.js → route-builder-DzUGCSQT.js} +3 -3
- package/dist/{route-builder-lBil8Cvo.js.map → route-builder-DzUGCSQT.js.map} +1 -1
- package/dist/{route-builder-2yrD15TL.cjs → route-builder-TBkBU65d.cjs} +3 -3
- package/dist/{route-builder-2yrD15TL.cjs.map → route-builder-TBkBU65d.cjs.map} +1 -1
- package/dist/{routes-CeX9JLW2.cjs → routes-C5zubsU0.cjs} +11 -11
- package/dist/{routes-CeX9JLW2.cjs.map → routes-C5zubsU0.cjs.map} +1 -1
- package/dist/{routes-CMj-3iyu.js → routes-DrxGo6Ug.js} +11 -11
- package/dist/{routes-CMj-3iyu.js.map → routes-DrxGo6Ug.js.map} +1 -1
- package/dist/{schedules-B0g72u5Y.cjs → schedules-55nFQfsJ.cjs} +3 -3
- package/dist/{schedules-B0g72u5Y.cjs.map → schedules-55nFQfsJ.cjs.map} +1 -1
- package/dist/{schedules-CrAmZ2gu.js → schedules-DxDUE8Fb.js} +3 -3
- package/dist/{schedules-CrAmZ2gu.js.map → schedules-DxDUE8Fb.js.map} +1 -1
- package/dist/schema-Drf2W04o.js +2 -0
- package/dist/schema-EQanefYq.cjs +1 -0
- package/dist/{schema-e0VHpMt0-BS9KHnuT.cjs → schema-e0VHpMt0-C0452jOk.cjs} +2 -2
- package/dist/{schema-e0VHpMt0-BS9KHnuT.cjs.map → schema-e0VHpMt0-C0452jOk.cjs.map} +1 -1
- package/dist/{schema-e0VHpMt0-CvPvLS06.js → schema-e0VHpMt0-CVP5Hnxy.js} +2 -2
- package/dist/{schema-e0VHpMt0-CvPvLS06.js.map → schema-e0VHpMt0-CVP5Hnxy.js.map} +1 -1
- package/dist/server/a2a/tasks.d.ts +2 -2
- package/dist/server/a2a/tasks.d.ts.map +1 -1
- package/dist/server/handlers/a2a.cjs +1 -1
- package/dist/server/handlers/a2a.d.ts +2 -2
- package/dist/server/handlers/a2a.d.ts.map +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +4 -4
- package/dist/server/handlers/agent-builder.js +4 -4
- package/dist/server/handlers/agent-controller.cjs +35 -5
- package/dist/server/handlers/agent-controller.cjs.map +1 -1
- package/dist/server/handlers/agent-controller.d.ts.map +1 -1
- package/dist/server/handlers/agent-controller.js +35 -5
- package/dist/server/handlers/agent-controller.js.map +1 -1
- package/dist/server/handlers/agent-versions.cjs +2 -2
- package/dist/server/handlers/agent-versions.js +2 -2
- package/dist/server/handlers/agents.cjs +17 -13
- package/dist/server/handlers/agents.cjs.map +1 -1
- package/dist/server/handlers/agents.d.ts +6 -0
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +17 -13
- package/dist/server/handlers/agents.js.map +1 -1
- package/dist/server/handlers/auth.cjs +1 -1
- package/dist/server/handlers/auth.js +1 -1
- package/dist/server/handlers/background-tasks.cjs +1 -1
- package/dist/server/handlers/background-tasks.js +1 -1
- package/dist/server/handlers/builder-registry.cjs +1 -1
- package/dist/server/handlers/builder-registry.js +1 -1
- package/dist/server/handlers/channels.cjs +1 -1
- package/dist/server/handlers/channels.js +1 -1
- package/dist/server/handlers/conversations.cjs +2 -2
- package/dist/server/handlers/conversations.js +2 -2
- package/dist/server/handlers/datasets.cjs +1 -1
- package/dist/server/handlers/datasets.js +1 -1
- 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 +7 -5
- package/dist/server/handlers/error.cjs.map +1 -1
- package/dist/server/handlers/error.d.ts.map +1 -1
- package/dist/server/handlers/error.js +7 -5
- package/dist/server/handlers/error.js.map +1 -1
- package/dist/server/handlers/favorites-enrichment.cjs +1 -1
- package/dist/server/handlers/favorites-enrichment.js +1 -1
- package/dist/server/handlers/logs.cjs +2 -2
- package/dist/server/handlers/logs.js +2 -2
- package/dist/server/handlers/mcp-client-versions.cjs +3 -3
- package/dist/server/handlers/mcp-client-versions.js +3 -3
- package/dist/server/handlers/mcp.cjs +1 -1
- package/dist/server/handlers/mcp.js +1 -1
- package/dist/server/handlers/memory.cjs +2 -2
- package/dist/server/handlers/memory.js +2 -2
- package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
- package/dist/server/handlers/observability-new-endpoints.d.ts +335 -31
- package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
- package/dist/server/handlers/observability-new-endpoints.js +1 -1
- package/dist/server/handlers/observability-shared.cjs +73 -9
- package/dist/server/handlers/observability-shared.cjs.map +1 -1
- package/dist/server/handlers/observability-shared.d.ts +25 -1
- package/dist/server/handlers/observability-shared.d.ts.map +1 -1
- package/dist/server/handlers/observability-shared.js +68 -10
- package/dist/server/handlers/observability-shared.js.map +1 -1
- package/dist/server/handlers/observability.cjs +2 -2
- package/dist/server/handlers/observability.js +2 -2
- package/dist/server/handlers/plans.cjs +3 -3
- package/dist/server/handlers/plans.js +3 -3
- package/dist/server/handlers/processor-providers.cjs +1 -1
- package/dist/server/handlers/processor-providers.js +1 -1
- package/dist/server/handlers/processors.cjs +1 -1
- package/dist/server/handlers/processors.js +1 -1
- package/dist/server/handlers/prompt-block-versions.cjs +3 -3
- package/dist/server/handlers/prompt-block-versions.js +3 -3
- package/dist/server/handlers/responses.cjs +2 -2
- package/dist/server/handlers/responses.js +2 -2
- package/dist/server/handlers/responses.storage.cjs +1 -1
- package/dist/server/handlers/responses.storage.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 +3 -3
- package/dist/server/handlers/scorer-versions.js +3 -3
- 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 +3 -3
- package/dist/server/handlers/stored-agents.js +3 -3
- package/dist/server/handlers/stored-mcp-clients.cjs +3 -3
- package/dist/server/handlers/stored-mcp-clients.js +3 -3
- package/dist/server/handlers/stored-prompt-blocks.cjs +3 -3
- package/dist/server/handlers/stored-prompt-blocks.js +3 -3
- package/dist/server/handlers/stored-scorers.cjs +3 -3
- package/dist/server/handlers/stored-scorers.js +3 -3
- package/dist/server/handlers/stored-skill-favorites.cjs +4 -4
- package/dist/server/handlers/stored-skill-favorites.js +4 -4
- package/dist/server/handlers/stored-skills.cjs +4 -4
- package/dist/server/handlers/stored-skills.js +4 -4
- package/dist/server/handlers/stored-workspaces.cjs +2 -2
- package/dist/server/handlers/stored-workspaces.js +2 -2
- package/dist/server/handlers/system.cjs +3 -3
- package/dist/server/handlers/system.d.ts +6 -0
- package/dist/server/handlers/system.d.ts.map +1 -1
- package/dist/server/handlers/system.js +3 -3
- package/dist/server/handlers/tool-providers.cjs +1 -1
- package/dist/server/handlers/tool-providers.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +6 -6
- package/dist/server/handlers/utils.cjs +2 -1
- package/dist/server/handlers/utils.d.ts +9 -0
- package/dist/server/handlers/utils.d.ts.map +1 -1
- package/dist/server/handlers/utils.js +2 -2
- package/dist/server/handlers/validate-agent-instructions.cjs +1 -1
- package/dist/server/handlers/validate-agent-instructions.js +1 -1
- package/dist/server/handlers/vector.cjs +1 -1
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/workflow-builder.cjs +1 -1
- package/dist/server/handlers/workflow-builder.d.ts.map +1 -1
- package/dist/server/handlers/workflow-builder.js +1 -1
- package/dist/server/handlers/workflows.cjs +4 -4
- package/dist/server/handlers/workflows.js +4 -4
- package/dist/server/handlers/workspace.cjs +1 -1
- package/dist/server/handlers/workspace.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +2 -2
- package/dist/server/schemas/agents.d.ts +3 -0
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/index.cjs +4 -4
- package/dist/server/schemas/index.js +4 -4
- package/dist/server/schemas/system.d.ts +6 -0
- package/dist/server/schemas/system.d.ts.map +1 -1
- package/dist/server/server-adapter/api-schema-manifest.d.ts +2 -0
- package/dist/server/server-adapter/api-schema-manifest.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +3 -3
- package/dist/server/server-adapter/index.js +3 -3
- package/dist/server/server-adapter/routes/observability.d.ts +167 -15
- package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/system.d.ts +6 -0
- package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
- package/dist/{system-MGpkVA20.js → system-CiAOa3RO.js} +4 -1
- package/dist/system-CiAOa3RO.js.map +1 -0
- package/dist/{system-DY6UweSl.cjs → system-wG9idyeI.cjs} +4 -1
- package/dist/system-wG9idyeI.cjs.map +1 -0
- package/dist/{utils-D5DHrO3K.js → utils-BBJlS81s.js} +19 -2
- package/dist/{utils-D5DHrO3K.js.map → utils-BBJlS81s.js.map} +1 -1
- package/dist/{utils-tmrFs-gf.js → utils-DCAUeb6M.js} +3 -3
- package/dist/{utils-tmrFs-gf.js.map → utils-DCAUeb6M.js.map} +1 -1
- package/dist/{utils-BZdnPmsW.cjs → utils-DCgeTrq2.cjs} +3 -3
- package/dist/{utils-BZdnPmsW.cjs.map → utils-DCgeTrq2.cjs.map} +1 -1
- package/dist/{utils-CczRcgHQ.cjs → utils-Du-EpvDs.cjs} +24 -1
- package/dist/{utils-CczRcgHQ.cjs.map → utils-Du-EpvDs.cjs.map} +1 -1
- package/dist/{workflow-builder-DJ0eeJuG.js → workflow-builder-Dr6Rm3gH.js} +6 -6
- package/dist/workflow-builder-Dr6Rm3gH.js.map +1 -0
- package/dist/{workflow-builder-DdSutoga.cjs → workflow-builder-Dx24RhD3.cjs} +6 -6
- package/dist/workflow-builder-Dx24RhD3.cjs.map +1 -0
- package/package.json +10 -11
- package/dist/a2a-Dg3ylOKc.js.map +0 -1
- package/dist/agents-D9vpLghy.cjs.map +0 -1
- package/dist/agents-DNWDET4U.js.map +0 -1
- package/dist/api-schema-manifest-BgWM-O7K.js.map +0 -1
- package/dist/api-schema-manifest-CI0gyTVi.cjs.map +0 -1
- package/dist/dist-CWqDEEO3.cjs.map +0 -1
- package/dist/observability-new-endpoints-BKFVVMTS.cjs.map +0 -1
- package/dist/observability-new-endpoints-C5VO7nLK.js.map +0 -1
- package/dist/schema-BVcoNfni.cjs +0 -1
- package/dist/schema-Xxr5X5Je.js +0 -2
- package/dist/system-DY6UweSl.cjs.map +0 -1
- package/dist/system-MGpkVA20.js.map +0 -1
- package/dist/workflow-builder-DJ0eeJuG.js.map +0 -1
- package/dist/workflow-builder-DdSutoga.cjs.map +0 -1
|
@@ -317,6 +317,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
317
317
|
entityType: string | null;
|
|
318
318
|
environment: string | null;
|
|
319
319
|
status: "error" | "success";
|
|
320
|
+
timeToFirstChunkMs?: number | null | undefined;
|
|
320
321
|
}[];
|
|
321
322
|
page: {
|
|
322
323
|
next: string | null;
|
|
@@ -341,6 +342,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
341
342
|
entityType: string | null;
|
|
342
343
|
environment: string | null;
|
|
343
344
|
status: "error" | "success";
|
|
345
|
+
timeToFirstChunkMs?: number | null | undefined;
|
|
344
346
|
}[];
|
|
345
347
|
pagination: {
|
|
346
348
|
total: number;
|
|
@@ -369,6 +371,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
369
371
|
entityType: string | null;
|
|
370
372
|
environment: string | null;
|
|
371
373
|
status: "error" | "success";
|
|
374
|
+
timeToFirstChunkMs?: number | null | undefined;
|
|
372
375
|
}[];
|
|
373
376
|
delta: {
|
|
374
377
|
limit: number;
|
|
@@ -446,6 +449,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
446
449
|
error: "error";
|
|
447
450
|
success: "success";
|
|
448
451
|
}>;
|
|
452
|
+
timeToFirstChunkMs: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
449
453
|
}, import("zod/v4/core").$strict>>;
|
|
450
454
|
page: import("zod").ZodObject<{
|
|
451
455
|
next: import("zod").ZodNullable<import("zod").ZodString>;
|
|
@@ -473,6 +477,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
473
477
|
error: "error";
|
|
474
478
|
success: "success";
|
|
475
479
|
}>;
|
|
480
|
+
timeToFirstChunkMs: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
476
481
|
}, import("zod/v4/core").$strict>>;
|
|
477
482
|
pagination: import("zod").ZodObject<{
|
|
478
483
|
total: import("zod").ZodNumber;
|
|
@@ -504,6 +509,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
504
509
|
error: "error";
|
|
505
510
|
success: "success";
|
|
506
511
|
}>;
|
|
512
|
+
timeToFirstChunkMs: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
507
513
|
}, import("zod/v4/core").$strict>>;
|
|
508
514
|
delta: import("zod").ZodObject<{
|
|
509
515
|
limit: import("zod").ZodNumber;
|
|
@@ -653,22 +659,86 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
653
659
|
responseType: "json";
|
|
654
660
|
streamFormat?: 'sse' | 'stream';
|
|
655
661
|
sseFlushOnConnect?: boolean;
|
|
656
|
-
handler(params: {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
from:
|
|
660
|
-
to:
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
662
|
+
handler(params: import(".").InferParams<undefined, undefined, import("zod").ZodUnion<readonly [import("zod").ZodPreprocess<import("zod").ZodObject<{
|
|
663
|
+
timeRange: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
664
|
+
traces: import("zod").ZodObject<{
|
|
665
|
+
from: import("zod").ZodString;
|
|
666
|
+
to: import("zod").ZodString;
|
|
667
|
+
}, import("zod/v4/core").$strict>;
|
|
668
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
669
|
+
threads: import("zod").ZodObject<{
|
|
670
|
+
from: import("zod").ZodString;
|
|
671
|
+
to: import("zod").ZodString;
|
|
672
|
+
field: import("zod").ZodEnum<{
|
|
673
|
+
endedAt: "endedAt";
|
|
674
|
+
startedAt: "startedAt";
|
|
675
|
+
}>;
|
|
676
|
+
}, import("zod/v4/core").$strict>;
|
|
677
|
+
}, import("zod/v4/core").$strict>]>;
|
|
678
|
+
where: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/storage").TraceQueryScalarPredicate, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/storage").TraceQueryScalarPredicate, unknown>>>;
|
|
679
|
+
orderBy: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
680
|
+
field: import("zod").ZodEnum<{
|
|
681
|
+
endedAt: "endedAt";
|
|
682
|
+
startedAt: "startedAt";
|
|
683
|
+
}>;
|
|
684
|
+
direction: import("zod").ZodEnum<{
|
|
685
|
+
asc: "asc";
|
|
686
|
+
desc: "desc";
|
|
687
|
+
}>;
|
|
688
|
+
}, import("zod/v4/core").$strict>>>;
|
|
689
|
+
page: import("zod").ZodDefault<import("zod").ZodObject<{
|
|
690
|
+
limit: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
691
|
+
after: import("zod").ZodOptional<import("zod").ZodString>;
|
|
692
|
+
}, import("zod/v4/core").$strict>>;
|
|
693
|
+
}, import("zod/v4/core").$strict>, unknown>, import("zod").ZodPreprocess<import("zod").ZodObject<{
|
|
694
|
+
traces: import("zod").ZodObject<{
|
|
695
|
+
timeRange: import("zod").ZodObject<{
|
|
696
|
+
from: import("zod").ZodString;
|
|
697
|
+
to: import("zod").ZodString;
|
|
698
|
+
}, import("zod/v4/core").$strict>;
|
|
699
|
+
where: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/storage").TraceQueryPredicate, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/storage").TraceQueryPredicate, unknown>>>;
|
|
700
|
+
}, import("zod/v4/core").$strict>;
|
|
701
|
+
where: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/storage").ThreadPredicate, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/storage").ThreadPredicate, unknown>>>;
|
|
702
|
+
page: import("zod").ZodDefault<import("zod").ZodObject<{
|
|
703
|
+
limit: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
704
|
+
after: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
705
|
+
}, import("zod/v4/core").$strict>>;
|
|
706
|
+
}, import("zod/v4/core").$strict>, unknown>]>> & import(".").ServerContext): Promise<{
|
|
707
|
+
threads: {
|
|
708
|
+
threadId: string;
|
|
709
|
+
}[];
|
|
665
710
|
page: {
|
|
666
|
-
|
|
667
|
-
after?: string | null | undefined;
|
|
711
|
+
next: string | null;
|
|
668
712
|
};
|
|
669
|
-
}
|
|
713
|
+
} | {
|
|
670
714
|
threads: {
|
|
715
|
+
organizationId: string | null;
|
|
671
716
|
threadId: string;
|
|
717
|
+
firstTraceId: string;
|
|
718
|
+
lastTraceId: string;
|
|
719
|
+
resourceId: string | null;
|
|
720
|
+
userId: string | null;
|
|
721
|
+
entityType: string | null;
|
|
722
|
+
entityId: string | null;
|
|
723
|
+
entityName: string | null;
|
|
724
|
+
entityVersionId: string | null;
|
|
725
|
+
runId: string | null;
|
|
726
|
+
sessionId: string | null;
|
|
727
|
+
requestId: string | null;
|
|
728
|
+
serviceName: string | null;
|
|
729
|
+
experimentId: string | null;
|
|
730
|
+
environment: string | null;
|
|
731
|
+
executionSource: string | null;
|
|
732
|
+
status: "error" | "success";
|
|
733
|
+
startedAt: string;
|
|
734
|
+
endedAt: string;
|
|
735
|
+
timeToFirstChunkMs: number | null;
|
|
736
|
+
inputPreview: string | null;
|
|
737
|
+
outputPreview: string | null;
|
|
738
|
+
errorPreview: string | null;
|
|
739
|
+
traceCount: number;
|
|
740
|
+
model: string | null;
|
|
741
|
+
provider: string | null;
|
|
672
742
|
}[];
|
|
673
743
|
page: {
|
|
674
744
|
next: string | null;
|
|
@@ -684,7 +754,38 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
684
754
|
requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
|
|
685
755
|
fga?: import("@mastra/core/auth").FGARouteConfig;
|
|
686
756
|
onValidationError?: import("@mastra/core/server").ValidationErrorHook;
|
|
687
|
-
readonly __schemas?: import(".").RouteSchemas<undefined, undefined, import("zod").ZodPreprocess<import("zod").ZodObject<{
|
|
757
|
+
readonly __schemas?: import(".").RouteSchemas<undefined, undefined, import("zod").ZodUnion<readonly [import("zod").ZodPreprocess<import("zod").ZodObject<{
|
|
758
|
+
timeRange: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
759
|
+
traces: import("zod").ZodObject<{
|
|
760
|
+
from: import("zod").ZodString;
|
|
761
|
+
to: import("zod").ZodString;
|
|
762
|
+
}, import("zod/v4/core").$strict>;
|
|
763
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
764
|
+
threads: import("zod").ZodObject<{
|
|
765
|
+
from: import("zod").ZodString;
|
|
766
|
+
to: import("zod").ZodString;
|
|
767
|
+
field: import("zod").ZodEnum<{
|
|
768
|
+
endedAt: "endedAt";
|
|
769
|
+
startedAt: "startedAt";
|
|
770
|
+
}>;
|
|
771
|
+
}, import("zod/v4/core").$strict>;
|
|
772
|
+
}, import("zod/v4/core").$strict>]>;
|
|
773
|
+
where: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/storage").TraceQueryScalarPredicate, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/storage").TraceQueryScalarPredicate, unknown>>>;
|
|
774
|
+
orderBy: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
775
|
+
field: import("zod").ZodEnum<{
|
|
776
|
+
endedAt: "endedAt";
|
|
777
|
+
startedAt: "startedAt";
|
|
778
|
+
}>;
|
|
779
|
+
direction: import("zod").ZodEnum<{
|
|
780
|
+
asc: "asc";
|
|
781
|
+
desc: "desc";
|
|
782
|
+
}>;
|
|
783
|
+
}, import("zod/v4/core").$strict>>>;
|
|
784
|
+
page: import("zod").ZodDefault<import("zod").ZodObject<{
|
|
785
|
+
limit: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
786
|
+
after: import("zod").ZodOptional<import("zod").ZodString>;
|
|
787
|
+
}, import("zod/v4/core").$strict>>;
|
|
788
|
+
}, import("zod/v4/core").$strict>, unknown>, import("zod").ZodPreprocess<import("zod").ZodObject<{
|
|
688
789
|
traces: import("zod").ZodObject<{
|
|
689
790
|
timeRange: import("zod").ZodObject<{
|
|
690
791
|
from: import("zod").ZodString;
|
|
@@ -697,14 +798,57 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
697
798
|
limit: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
698
799
|
after: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
699
800
|
}, import("zod/v4/core").$strict>>;
|
|
700
|
-
}, import("zod/v4/core").$strict>, unknown>, import("zod").ZodObject<{
|
|
801
|
+
}, import("zod/v4/core").$strict>, unknown>]>, import("zod").ZodObject<{
|
|
701
802
|
threads: import("zod").ZodArray<import("zod").ZodObject<{
|
|
702
803
|
threadId: import("zod").ZodString;
|
|
703
804
|
}, import("zod/v4/core").$strict>>;
|
|
704
805
|
page: import("zod").ZodObject<{
|
|
705
806
|
next: import("zod").ZodNullable<import("zod").ZodString>;
|
|
706
807
|
}, import("zod/v4/core").$strict>;
|
|
707
|
-
}, import("zod/v4/core").$strict
|
|
808
|
+
}, import("zod/v4/core").$strict> | import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
809
|
+
threads: import("zod").ZodArray<import("zod").ZodObject<{
|
|
810
|
+
organizationId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
811
|
+
threadId: import("zod").ZodString;
|
|
812
|
+
firstTraceId: import("zod").ZodString;
|
|
813
|
+
lastTraceId: import("zod").ZodString;
|
|
814
|
+
resourceId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
815
|
+
userId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
816
|
+
entityType: import("zod").ZodNullable<import("zod").ZodString>;
|
|
817
|
+
entityId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
818
|
+
entityName: import("zod").ZodNullable<import("zod").ZodString>;
|
|
819
|
+
entityVersionId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
820
|
+
runId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
821
|
+
sessionId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
822
|
+
requestId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
823
|
+
serviceName: import("zod").ZodNullable<import("zod").ZodString>;
|
|
824
|
+
experimentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
825
|
+
environment: import("zod").ZodNullable<import("zod").ZodString>;
|
|
826
|
+
executionSource: import("zod").ZodNullable<import("zod").ZodString>;
|
|
827
|
+
status: import("zod").ZodEnum<{
|
|
828
|
+
error: "error";
|
|
829
|
+
success: "success";
|
|
830
|
+
}>;
|
|
831
|
+
startedAt: import("zod").ZodString;
|
|
832
|
+
endedAt: import("zod").ZodString;
|
|
833
|
+
timeToFirstChunkMs: import("zod").ZodNullable<import("zod").ZodNumber>;
|
|
834
|
+
inputPreview: import("zod").ZodNullable<import("zod").ZodString>;
|
|
835
|
+
outputPreview: import("zod").ZodNullable<import("zod").ZodString>;
|
|
836
|
+
errorPreview: import("zod").ZodNullable<import("zod").ZodString>;
|
|
837
|
+
traceCount: import("zod").ZodNumber;
|
|
838
|
+
model: import("zod").ZodNullable<import("zod").ZodString>;
|
|
839
|
+
provider: import("zod").ZodNullable<import("zod").ZodString>;
|
|
840
|
+
}, import("zod/v4/core").$strict>>;
|
|
841
|
+
page: import("zod").ZodObject<{
|
|
842
|
+
next: import("zod").ZodNullable<import("zod").ZodString>;
|
|
843
|
+
}, import("zod/v4/core").$strict>;
|
|
844
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
845
|
+
threads: import("zod").ZodArray<import("zod").ZodObject<{
|
|
846
|
+
threadId: import("zod").ZodString;
|
|
847
|
+
}, import("zod/v4/core").$strict>>;
|
|
848
|
+
page: import("zod").ZodObject<{
|
|
849
|
+
next: import("zod").ZodNullable<import("zod").ZodString>;
|
|
850
|
+
}, import("zod/v4/core").$strict>;
|
|
851
|
+
}, import("zod/v4/core").$strict>]>> | undefined;
|
|
708
852
|
} & {
|
|
709
853
|
readonly _mastraSchemaRoute: true;
|
|
710
854
|
}, Omit<import("@mastra/core/server").ApiRoute, "createHandler" | "handler" | "method" | "openapi" | "path"> & {
|
|
@@ -766,6 +910,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
766
910
|
inputPreview: string | null;
|
|
767
911
|
outputPreview: string | null;
|
|
768
912
|
errorPreview: string | null;
|
|
913
|
+
timeToFirstChunkMs?: number | null | undefined;
|
|
769
914
|
}[];
|
|
770
915
|
page: {
|
|
771
916
|
next: string | null;
|
|
@@ -843,6 +988,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
843
988
|
inputPreview: import("zod").ZodNullable<import("zod").ZodString>;
|
|
844
989
|
outputPreview: import("zod").ZodNullable<import("zod").ZodString>;
|
|
845
990
|
errorPreview: import("zod").ZodNullable<import("zod").ZodString>;
|
|
991
|
+
timeToFirstChunkMs: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
846
992
|
}, import("zod/v4/core").$strict>>;
|
|
847
993
|
page: import("zod").ZodObject<{
|
|
848
994
|
next: import("zod").ZodNullable<import("zod").ZodString>;
|
|
@@ -3901,10 +4047,13 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
3901
4047
|
traceQuery: boolean;
|
|
3902
4048
|
traceQueryRootDuration: boolean;
|
|
3903
4049
|
traceQueryContextIds: boolean;
|
|
4050
|
+
traceQueryTimeToFirstChunk: boolean;
|
|
4051
|
+
traceQueryRootSpanFields: boolean;
|
|
3904
4052
|
traceQueryDiscovery: boolean;
|
|
3905
4053
|
traceQueryTenantScope: boolean;
|
|
3906
4054
|
traceAggregate: boolean;
|
|
3907
4055
|
threadQuery: boolean;
|
|
4056
|
+
threadQueryRows: boolean;
|
|
3908
4057
|
spanQuery: boolean;
|
|
3909
4058
|
traceRetentionDays?: number | undefined;
|
|
3910
4059
|
feedback: boolean;
|
|
@@ -3937,10 +4086,13 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
|
|
|
3937
4086
|
traceQuery: import("zod").ZodBoolean;
|
|
3938
4087
|
traceQueryRootDuration: import("zod").ZodBoolean;
|
|
3939
4088
|
traceQueryContextIds: import("zod").ZodBoolean;
|
|
4089
|
+
traceQueryTimeToFirstChunk: import("zod").ZodBoolean;
|
|
4090
|
+
traceQueryRootSpanFields: import("zod").ZodBoolean;
|
|
3940
4091
|
traceQueryDiscovery: import("zod").ZodBoolean;
|
|
3941
4092
|
traceQueryTenantScope: import("zod").ZodBoolean;
|
|
3942
4093
|
traceAggregate: import("zod").ZodBoolean;
|
|
3943
4094
|
threadQuery: import("zod").ZodBoolean;
|
|
4095
|
+
threadQueryRows: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
3944
4096
|
spanQuery: import("zod").ZodBoolean;
|
|
3945
4097
|
traceRetentionDays: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
3946
4098
|
feedback: import("zod").ZodBoolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/observability.ts"],"names":[],"mappings":"AAqDA,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/observability.ts"],"names":[],"mappings":"AAqDA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDvB,CAAC"}
|
|
@@ -48,10 +48,13 @@ export declare const SYSTEM_ROUTES: readonly [Omit<import("@mastra/core/server")
|
|
|
48
48
|
traceQuery: boolean;
|
|
49
49
|
traceQueryRootDuration: boolean;
|
|
50
50
|
traceQueryContextIds: boolean;
|
|
51
|
+
traceQueryTimeToFirstChunk: boolean;
|
|
52
|
+
traceQueryRootSpanFields: boolean;
|
|
51
53
|
traceQueryDiscovery: boolean;
|
|
52
54
|
traceQueryTenantScope: boolean;
|
|
53
55
|
traceAggregate: boolean;
|
|
54
56
|
threadQuery: boolean;
|
|
57
|
+
threadQueryRows: boolean;
|
|
55
58
|
spanQuery: boolean;
|
|
56
59
|
traceRetentionDays?: number | undefined;
|
|
57
60
|
feedback: boolean;
|
|
@@ -118,10 +121,13 @@ export declare const SYSTEM_ROUTES: readonly [Omit<import("@mastra/core/server")
|
|
|
118
121
|
traceQuery: import("zod").ZodBoolean;
|
|
119
122
|
traceQueryRootDuration: import("zod").ZodBoolean;
|
|
120
123
|
traceQueryContextIds: import("zod").ZodBoolean;
|
|
124
|
+
traceQueryTimeToFirstChunk: import("zod").ZodBoolean;
|
|
125
|
+
traceQueryRootSpanFields: import("zod").ZodBoolean;
|
|
121
126
|
traceQueryDiscovery: import("zod").ZodBoolean;
|
|
122
127
|
traceQueryTenantScope: import("zod").ZodBoolean;
|
|
123
128
|
traceAggregate: import("zod").ZodBoolean;
|
|
124
129
|
threadQuery: import("zod").ZodBoolean;
|
|
130
|
+
threadQueryRows: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
125
131
|
spanQuery: import("zod").ZodBoolean;
|
|
126
132
|
traceRetentionDays: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
127
133
|
feedback: import("zod").ZodBoolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/system.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/system.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA6D,CAAC"}
|
|
@@ -30,10 +30,13 @@ const observabilityStorageCapabilitiesSchema = z.object({
|
|
|
30
30
|
traceQuery: z.boolean().describe("Advanced trace queries (POST /observability/traces/query). When false, list traces with GET /observability/traces/light instead."),
|
|
31
31
|
traceQueryRootDuration: z.boolean().describe("`durationMs` predicates in trace and thread queries"),
|
|
32
32
|
traceQueryContextIds: z.boolean().describe("`runId`, `sessionId`, `userId` and `organizationId` predicates in trace and thread queries"),
|
|
33
|
+
traceQueryTimeToFirstChunk: z.boolean().describe("`timeToFirstChunkMs` in trace and span query results, and predicates on it in trace, thread and span queries"),
|
|
34
|
+
traceQueryRootSpanFields: z.boolean().describe("Root span `name` and `spanType` in trace-scope predicates, aggregate `groupBy` and `countDistinct`"),
|
|
33
35
|
traceQueryDiscovery: z.boolean().describe("Trace query field discovery (POST /observability/traces/query/fields and /values)"),
|
|
34
36
|
traceQueryTenantScope: z.boolean().describe("Trusted tenant scoping of trace and thread queries"),
|
|
35
37
|
traceAggregate: z.boolean().describe("Trace aggregation (POST /observability/traces/aggregate). Unlike `traceQuery`, clients should treat a missing value as unavailable."),
|
|
36
38
|
threadQuery: z.boolean().describe("Advanced thread queries (POST /observability/threads/query)"),
|
|
39
|
+
threadQueryRows: z.boolean().default(false).describe("Full-history thread rows with activity windows, filters and sorting. Treat a missing value as unavailable."),
|
|
37
40
|
spanQuery: z.boolean().describe("Span queries (POST /observability/spans/query)"),
|
|
38
41
|
traceRetentionDays: z.number().int().positive().optional().describe("Days of traces the store keeps. Older traces are gone, so clients can stop users from picking dates before them. Omitted when the store does not report a limit."),
|
|
39
42
|
feedback: z.boolean().describe("Feedback endpoints (/observability/feedback and /observability/feedback/*). Unsupported feedback routes return 501.")
|
|
@@ -105,4 +108,4 @@ const apiSchemaManifestResponseSchema = z.object({
|
|
|
105
108
|
//#endregion
|
|
106
109
|
export { editorSourceSchema as a, observabilityRuntimeStrategySchema as c, editorSourceCapabilitiesSchema as i, observabilityStorageCapabilitiesSchema as l, apiSchemaManifestRouteSchema as n, mastraPackageSchema as o, apiSchemaResponseShapeSchema as r, observabilityDiscoveryCapabilitiesSchema as s, apiSchemaManifestResponseSchema as t, systemPackagesResponseSchema as u };
|
|
107
110
|
|
|
108
|
-
//# sourceMappingURL=system-
|
|
111
|
+
//# sourceMappingURL=system-CiAOa3RO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-CiAOa3RO.js","names":[],"sources":["../src/server/schemas/system.ts"],"sourcesContent":["import { z } from 'zod/v4';\n\nexport const mastraPackageSchema = z.object({\n name: z.string(),\n version: z.string(),\n});\n\nexport const observabilityRuntimeStrategySchema = z.enum([\n 'realtime',\n 'batch-with-updates',\n 'insert-only',\n 'event-sourced',\n]);\n\nexport const observabilityDiscoveryCapabilitiesSchema = z.object({\n entityTypes: z.boolean().describe('GET /observability/discovery/entity-types'),\n entityNames: z.boolean().describe('GET /observability/discovery/entity-names'),\n serviceNames: z.boolean().describe('GET /observability/discovery/service-names'),\n environments: z.boolean().describe('GET /observability/discovery/environments'),\n tags: z.boolean().describe('GET /observability/discovery/tags'),\n metrics: z.boolean().describe('GET /observability/discovery/metric-names, metric-label-keys and metric-label-values'),\n});\n\n/**\n * Optional observability APIs the configured observability store can serve.\n * Omitted when no observability store is configured.\n */\nexport const observabilityStorageCapabilitiesSchema = z.object({\n metrics: z.boolean().describe('Metrics endpoints (/observability/metrics and /observability/metrics/*)'),\n logs: z.boolean().describe('Logs endpoint (GET /observability/logs)'),\n discovery: observabilityDiscoveryCapabilitiesSchema.describe(\n 'Filter discovery endpoints. Unsupported discovery routes return empty results.',\n ),\n deltaPolling: z.boolean().describe(\"Cursor-based `mode: 'delta'` polling on observability list endpoints\"),\n traceQuery: z\n .boolean()\n .describe(\n 'Advanced trace queries (POST /observability/traces/query). When false, list traces with GET /observability/traces/light instead.',\n ),\n traceQueryRootDuration: z.boolean().describe('`durationMs` predicates in trace and thread queries'),\n traceQueryContextIds: z\n .boolean()\n .describe('`runId`, `sessionId`, `userId` and `organizationId` predicates in trace and thread queries'),\n traceQueryTimeToFirstChunk: z\n .boolean()\n .describe(\n '`timeToFirstChunkMs` in trace and span query results, and predicates on it in trace, thread and span queries',\n ),\n traceQueryRootSpanFields: z\n .boolean()\n .describe('Root span `name` and `spanType` in trace-scope predicates, aggregate `groupBy` and `countDistinct`'),\n traceQueryDiscovery: z\n .boolean()\n .describe('Trace query field discovery (POST /observability/traces/query/fields and /values)'),\n traceQueryTenantScope: z.boolean().describe('Trusted tenant scoping of trace and thread queries'),\n traceAggregate: z\n .boolean()\n .describe(\n 'Trace aggregation (POST /observability/traces/aggregate). Unlike `traceQuery`, clients should treat a missing value as unavailable.',\n ),\n threadQuery: z.boolean().describe('Advanced thread queries (POST /observability/threads/query)'),\n threadQueryRows: z\n .boolean()\n .default(false)\n .describe(\n 'Full-history thread rows with activity windows, filters and sorting. Treat a missing value as unavailable.',\n ),\n spanQuery: z.boolean().describe('Span queries (POST /observability/spans/query)'),\n traceRetentionDays: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Days of traces the store keeps. Older traces are gone, so clients can stop users from picking dates before them. Omitted when the store does not report a limit.',\n ),\n feedback: z\n .boolean()\n .describe(\n 'Feedback endpoints (/observability/feedback and /observability/feedback/*). Unsupported feedback routes return 501.',\n ),\n});\n\nexport const editorSourceSchema = z.enum(['code', 'db']);\n\nexport const editorSourceCapabilitiesSchema = z.object({\n source: editorSourceSchema,\n storage: z.enum(['database', 'filesystem', 'source-provider', 'unavailable']),\n provider: z\n .object({\n id: z.string(),\n displayName: z.string(),\n })\n .optional(),\n canSave: z.boolean(),\n canOpenChangeRequest: z.boolean(),\n unavailableReason: z.string().optional(),\n});\n\nexport const systemPackagesResponseSchema = z.object({\n packages: z.array(mastraPackageSchema),\n isDev: z.boolean(),\n cmsEnabled: z.boolean(),\n /** Whether the default LiveKit connection-details route is registered — not whether credentials or a worker exist. */\n liveKitConnectionRouteEnabled: z.boolean(),\n /** True when the default LiveKit trace recording review route is registered. */\n liveKitRecordingRouteEnabled: z.boolean().optional(),\n /**\n * The editor's configured source, when set. `'code'` swaps Studio's\n * Save/Publish UI for Download JSON + Open PR. `'db'` keeps the standard\n * Save/Publish flow. Omitted when the editor has no explicit source.\n */\n editorSource: editorSourceSchema.optional(),\n editorSourceCapabilities: editorSourceCapabilitiesSchema.optional(),\n observabilityEnabled: z.boolean(),\n storageType: z.string().optional(),\n observabilityStorageType: z.string().optional(),\n observabilityStorageCapabilities: observabilityStorageCapabilitiesSchema.optional(),\n observabilityRuntimeStrategy: observabilityRuntimeStrategySchema.optional(),\n});\n\nconst jsonSchemaRecordSchema = z.record(z.string(), z.unknown());\n\nexport const apiSchemaResponseShapeSchema = z.object({\n kind: z.enum(['array', 'record', 'object-property', 'single', 'unknown']),\n listProperty: z.string().optional(),\n paginationProperty: z.string().optional(),\n});\n\nexport const apiSchemaManifestRouteSchema = z.object({\n method: z.string(),\n path: z.string(),\n responseType: z.string(),\n pathParamSchema: jsonSchemaRecordSchema.optional(),\n queryParamSchema: jsonSchemaRecordSchema.optional(),\n bodySchema: jsonSchemaRecordSchema.optional(),\n responseSchema: jsonSchemaRecordSchema.optional(),\n responseShape: apiSchemaResponseShapeSchema,\n});\n\nexport const apiSchemaManifestResponseSchema = z.object({\n version: z.literal(1),\n routes: z.array(apiSchemaManifestRouteSchema),\n});\n\nexport type MastraPackage = z.infer<typeof mastraPackageSchema>;\nexport type SystemPackagesResponse = z.infer<typeof systemPackagesResponseSchema>;\n"],"mappings":";;AAEA,MAAa,sBAAsB,EAAE,OAAO;CAC1C,MAAM,EAAE,OAAO;CACf,SAAS,EAAE,OAAO;AACpB,CAAC;AAED,MAAa,qCAAqC,EAAE,KAAK;CACvD;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,2CAA2C,EAAE,OAAO;CAC/D,aAAa,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC7E,aAAa,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC7E,cAAc,EAAE,QAAQ,CAAC,CAAC,SAAS,4CAA4C;CAC/E,cAAc,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC9E,MAAM,EAAE,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EAAE,MAAM,4BAA4B;AAC9C,CAAC"}
|
|
@@ -30,10 +30,13 @@ const observabilityStorageCapabilitiesSchema = zod_v4.z.object({
|
|
|
30
30
|
traceQuery: zod_v4.z.boolean().describe("Advanced trace queries (POST /observability/traces/query). When false, list traces with GET /observability/traces/light instead."),
|
|
31
31
|
traceQueryRootDuration: zod_v4.z.boolean().describe("`durationMs` predicates in trace and thread queries"),
|
|
32
32
|
traceQueryContextIds: zod_v4.z.boolean().describe("`runId`, `sessionId`, `userId` and `organizationId` predicates in trace and thread queries"),
|
|
33
|
+
traceQueryTimeToFirstChunk: zod_v4.z.boolean().describe("`timeToFirstChunkMs` in trace and span query results, and predicates on it in trace, thread and span queries"),
|
|
34
|
+
traceQueryRootSpanFields: zod_v4.z.boolean().describe("Root span `name` and `spanType` in trace-scope predicates, aggregate `groupBy` and `countDistinct`"),
|
|
33
35
|
traceQueryDiscovery: zod_v4.z.boolean().describe("Trace query field discovery (POST /observability/traces/query/fields and /values)"),
|
|
34
36
|
traceQueryTenantScope: zod_v4.z.boolean().describe("Trusted tenant scoping of trace and thread queries"),
|
|
35
37
|
traceAggregate: zod_v4.z.boolean().describe("Trace aggregation (POST /observability/traces/aggregate). Unlike `traceQuery`, clients should treat a missing value as unavailable."),
|
|
36
38
|
threadQuery: zod_v4.z.boolean().describe("Advanced thread queries (POST /observability/threads/query)"),
|
|
39
|
+
threadQueryRows: zod_v4.z.boolean().default(false).describe("Full-history thread rows with activity windows, filters and sorting. Treat a missing value as unavailable."),
|
|
37
40
|
spanQuery: zod_v4.z.boolean().describe("Span queries (POST /observability/spans/query)"),
|
|
38
41
|
traceRetentionDays: zod_v4.z.number().int().positive().optional().describe("Days of traces the store keeps. Older traces are gone, so clients can stop users from picking dates before them. Omitted when the store does not report a limit."),
|
|
39
42
|
feedback: zod_v4.z.boolean().describe("Feedback endpoints (/observability/feedback and /observability/feedback/*). Unsupported feedback routes return 501.")
|
|
@@ -164,4 +167,4 @@ Object.defineProperty(exports, "systemPackagesResponseSchema", {
|
|
|
164
167
|
}
|
|
165
168
|
});
|
|
166
169
|
|
|
167
|
-
//# sourceMappingURL=system-
|
|
170
|
+
//# sourceMappingURL=system-wG9idyeI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-wG9idyeI.cjs","names":["z"],"sources":["../src/server/schemas/system.ts"],"sourcesContent":["import { z } from 'zod/v4';\n\nexport const mastraPackageSchema = z.object({\n name: z.string(),\n version: z.string(),\n});\n\nexport const observabilityRuntimeStrategySchema = z.enum([\n 'realtime',\n 'batch-with-updates',\n 'insert-only',\n 'event-sourced',\n]);\n\nexport const observabilityDiscoveryCapabilitiesSchema = z.object({\n entityTypes: z.boolean().describe('GET /observability/discovery/entity-types'),\n entityNames: z.boolean().describe('GET /observability/discovery/entity-names'),\n serviceNames: z.boolean().describe('GET /observability/discovery/service-names'),\n environments: z.boolean().describe('GET /observability/discovery/environments'),\n tags: z.boolean().describe('GET /observability/discovery/tags'),\n metrics: z.boolean().describe('GET /observability/discovery/metric-names, metric-label-keys and metric-label-values'),\n});\n\n/**\n * Optional observability APIs the configured observability store can serve.\n * Omitted when no observability store is configured.\n */\nexport const observabilityStorageCapabilitiesSchema = z.object({\n metrics: z.boolean().describe('Metrics endpoints (/observability/metrics and /observability/metrics/*)'),\n logs: z.boolean().describe('Logs endpoint (GET /observability/logs)'),\n discovery: observabilityDiscoveryCapabilitiesSchema.describe(\n 'Filter discovery endpoints. Unsupported discovery routes return empty results.',\n ),\n deltaPolling: z.boolean().describe(\"Cursor-based `mode: 'delta'` polling on observability list endpoints\"),\n traceQuery: z\n .boolean()\n .describe(\n 'Advanced trace queries (POST /observability/traces/query). When false, list traces with GET /observability/traces/light instead.',\n ),\n traceQueryRootDuration: z.boolean().describe('`durationMs` predicates in trace and thread queries'),\n traceQueryContextIds: z\n .boolean()\n .describe('`runId`, `sessionId`, `userId` and `organizationId` predicates in trace and thread queries'),\n traceQueryTimeToFirstChunk: z\n .boolean()\n .describe(\n '`timeToFirstChunkMs` in trace and span query results, and predicates on it in trace, thread and span queries',\n ),\n traceQueryRootSpanFields: z\n .boolean()\n .describe('Root span `name` and `spanType` in trace-scope predicates, aggregate `groupBy` and `countDistinct`'),\n traceQueryDiscovery: z\n .boolean()\n .describe('Trace query field discovery (POST /observability/traces/query/fields and /values)'),\n traceQueryTenantScope: z.boolean().describe('Trusted tenant scoping of trace and thread queries'),\n traceAggregate: z\n .boolean()\n .describe(\n 'Trace aggregation (POST /observability/traces/aggregate). Unlike `traceQuery`, clients should treat a missing value as unavailable.',\n ),\n threadQuery: z.boolean().describe('Advanced thread queries (POST /observability/threads/query)'),\n threadQueryRows: z\n .boolean()\n .default(false)\n .describe(\n 'Full-history thread rows with activity windows, filters and sorting. Treat a missing value as unavailable.',\n ),\n spanQuery: z.boolean().describe('Span queries (POST /observability/spans/query)'),\n traceRetentionDays: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Days of traces the store keeps. Older traces are gone, so clients can stop users from picking dates before them. Omitted when the store does not report a limit.',\n ),\n feedback: z\n .boolean()\n .describe(\n 'Feedback endpoints (/observability/feedback and /observability/feedback/*). Unsupported feedback routes return 501.',\n ),\n});\n\nexport const editorSourceSchema = z.enum(['code', 'db']);\n\nexport const editorSourceCapabilitiesSchema = z.object({\n source: editorSourceSchema,\n storage: z.enum(['database', 'filesystem', 'source-provider', 'unavailable']),\n provider: z\n .object({\n id: z.string(),\n displayName: z.string(),\n })\n .optional(),\n canSave: z.boolean(),\n canOpenChangeRequest: z.boolean(),\n unavailableReason: z.string().optional(),\n});\n\nexport const systemPackagesResponseSchema = z.object({\n packages: z.array(mastraPackageSchema),\n isDev: z.boolean(),\n cmsEnabled: z.boolean(),\n /** Whether the default LiveKit connection-details route is registered — not whether credentials or a worker exist. */\n liveKitConnectionRouteEnabled: z.boolean(),\n /** True when the default LiveKit trace recording review route is registered. */\n liveKitRecordingRouteEnabled: z.boolean().optional(),\n /**\n * The editor's configured source, when set. `'code'` swaps Studio's\n * Save/Publish UI for Download JSON + Open PR. `'db'` keeps the standard\n * Save/Publish flow. Omitted when the editor has no explicit source.\n */\n editorSource: editorSourceSchema.optional(),\n editorSourceCapabilities: editorSourceCapabilitiesSchema.optional(),\n observabilityEnabled: z.boolean(),\n storageType: z.string().optional(),\n observabilityStorageType: z.string().optional(),\n observabilityStorageCapabilities: observabilityStorageCapabilitiesSchema.optional(),\n observabilityRuntimeStrategy: observabilityRuntimeStrategySchema.optional(),\n});\n\nconst jsonSchemaRecordSchema = z.record(z.string(), z.unknown());\n\nexport const apiSchemaResponseShapeSchema = z.object({\n kind: z.enum(['array', 'record', 'object-property', 'single', 'unknown']),\n listProperty: z.string().optional(),\n paginationProperty: z.string().optional(),\n});\n\nexport const apiSchemaManifestRouteSchema = z.object({\n method: z.string(),\n path: z.string(),\n responseType: z.string(),\n pathParamSchema: jsonSchemaRecordSchema.optional(),\n queryParamSchema: jsonSchemaRecordSchema.optional(),\n bodySchema: jsonSchemaRecordSchema.optional(),\n responseSchema: jsonSchemaRecordSchema.optional(),\n responseShape: apiSchemaResponseShapeSchema,\n});\n\nexport const apiSchemaManifestResponseSchema = z.object({\n version: z.literal(1),\n routes: z.array(apiSchemaManifestRouteSchema),\n});\n\nexport type MastraPackage = z.infer<typeof mastraPackageSchema>;\nexport type SystemPackagesResponse = z.infer<typeof systemPackagesResponseSchema>;\n"],"mappings":";;AAEA,MAAa,sBAAsBA,OAAAA,EAAE,OAAO;CAC1C,MAAMA,OAAAA,EAAE,OAAO;CACf,SAASA,OAAAA,EAAE,OAAO;AACpB,CAAC;AAED,MAAa,qCAAqCA,OAAAA,EAAE,KAAK;CACvD;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,2CAA2CA,OAAAA,EAAE,OAAO;CAC/D,aAAaA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC7E,aAAaA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC7E,cAAcA,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AA,EAAE,KAAK;EAAC;EAAS;EAAU;EAAmB;EAAU;CAAS,CAAC;CACxE,cAAcA,OAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,oBAAoBA,OAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;AAC1C,CAAC;AAED,MAAa,+BAA+BA,OAAAA,EAAE,OAAO;CACnD,QAAQA,OAAAA,EAAE,OAAO;CACjB,MAAMA,OAAAA,EAAE,OAAO;CACf,cAAcA,OAAAA,EAAE,OAAO;CACvB,iBAAiB,uBAAuB,SAAS;CACjD,kBAAkB,uBAAuB,SAAS;CAClD,YAAY,uBAAuB,SAAS;CAC5C,gBAAgB,uBAAuB,SAAS;CAChD,eAAe;AACjB,CAAC;AAED,MAAa,kCAAkCA,OAAAA,EAAE,OAAO;CACtD,SAASA,OAAAA,EAAE,QAAQ,CAAC;CACpB,QAAQA,OAAAA,EAAE,MAAM,4BAA4B;AAC9C,CAAC"}
|
|
@@ -162,6 +162,23 @@ function getEffectiveThreadId(requestContext, clientThreadId) {
|
|
|
162
162
|
return requestContext?.get("mastra__threadId") || clientThreadId;
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
+
* Applies the effective threadId to a client memory thread option. Object
|
|
166
|
+
* threads keep their other fields (metadata, title, ...) so they reach thread
|
|
167
|
+
* creation; a client-supplied resourceId is dropped because the server decides
|
|
168
|
+
* the resource.
|
|
169
|
+
*/
|
|
170
|
+
function applyEffectiveThreadId(thread, effectiveThreadId) {
|
|
171
|
+
if (!effectiveThreadId) return thread;
|
|
172
|
+
if (thread && typeof thread === "object") {
|
|
173
|
+
const { resourceId: _resourceId, ...fields } = thread;
|
|
174
|
+
return {
|
|
175
|
+
...fields,
|
|
176
|
+
id: effectiveThreadId
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
return effectiveThreadId;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
165
182
|
* Validates that a thread belongs to the specified resourceId.
|
|
166
183
|
* Throws 403 if the thread exists but belongs to a different resource.
|
|
167
184
|
* Threads with no resourceId are accessible to all (shared threads).
|
|
@@ -211,6 +228,6 @@ async function validateRunOwnership(run, effectiveResourceId, mastra) {
|
|
|
211
228
|
if (!server?.fga) throw new HTTPException(403, { message: "Access denied: unscoped workflow run access requires explicit authorization. Configure an FGA provider to authorize privileged run access." });
|
|
212
229
|
}
|
|
213
230
|
//#endregion
|
|
214
|
-
export {
|
|
231
|
+
export { getEffectiveThreadId as a, parseFilters as c, sanitizeBody as d, stripClientCredentialHeaders as f, MastraFGAPermissions as g, validateThreadOwnership as h, getEffectiveResourceId as i, parsePerPage as l, validateRunOwnership as m, enforceThreadAccess as n, getPublicWorkflowById as o, validateBody as p, getContextResourceId as r, mergeBodyRequestContext as s, applyEffectiveThreadId as t, requireEffectiveResourceId as u };
|
|
215
232
|
|
|
216
|
-
//# sourceMappingURL=utils-
|
|
233
|
+
//# sourceMappingURL=utils-BBJlS81s.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-D5DHrO3K.js","names":[],"sources":["../src/server/fga-permissions.ts","../src/server/handlers/utils.ts"],"sourcesContent":["/**\n * Safe re-export of `MastraFGAPermissions` from `@mastra/core/auth/ee`.\n *\n * Why this shim exists:\n * `MastraFGAPermissions` was introduced in `@mastra/core@1.32.0`. Earlier\n * versions of `@mastra/core` ship `@mastra/core/auth/ee` but do not export\n * this constant. A direct named import (`import { MastraFGAPermissions }\n * from '@mastra/core/auth/ee'`) fails at ESM link time when this version\n * of `@mastra/server` is paired with `@mastra/core < 1.32.0`, taking the\n * entire user bundle down before any code runs.\n *\n * A namespace import tolerates missing names — `ns.MissingExport` is just\n * `undefined`, no link-time error. We then expose the permission map.\n *\n * Fallback values:\n * If the consuming `@mastra/core` does not export `MastraFGAPermissions`,\n * we substitute a hardcoded map of the canonical permission strings used\n * by routes in `@mastra/server`. This preserves the explicit RBAC\n * permission overrides those routes already had as string literals in\n * `@mastra/server@1.31.0` (e.g. `requiresPermission: \"agents:execute\"`\n * on `/v1/responses`). Without this fallback, `requiresPermission` would\n * be `undefined` on old core and the auth layer would derive the wrong\n * permission from the route path (e.g. `v1:write` instead of\n * `agents:execute`), breaking RBAC users who upgrade `@mastra/server`\n * but stay on `@mastra/core@1.31.0`.\n *\n * Once the consuming `@mastra/core` is on `1.32.0+` the values are real\n * and behaviour is identical to a direct named import.\n */\n\nimport * as authEE from '@mastra/core/auth/ee';\n\n// Canonical strings for the FGA permission keys actually referenced by\n// `@mastra/server` source. Mirrors `MastraFGAPermissions` in\n// `@mastra/core@1.32.0+` for these specific keys, and matches the string\n// literals previously hardcoded on the same routes in `@mastra/server@1.31.0`.\nconst FALLBACK_PERMISSIONS = {\n AGENTS_CREATE: 'agents:create',\n AGENTS_DELETE: 'agents:delete',\n AGENTS_EXECUTE: 'agents:execute',\n AGENTS_READ: 'agents:read',\n MEMORY_DELETE: 'memory:delete',\n MEMORY_READ: 'memory:read',\n MEMORY_WRITE: 'memory:write',\n TOOLS_EXECUTE: 'tools:execute',\n TOOLS_READ: 'tools:read',\n STORED_WORKFLOWS_READ: 'stored-workflows:read',\n STORED_WORKFLOWS_WRITE: 'stored-workflows:write',\n WORKFLOWS_EXECUTE: 'workflows:execute',\n WORKFLOWS_READ: 'workflows:read',\n} as const;\n\nconst realPermissions = (authEE as any).MastraFGAPermissions;\n\n// Typed as `any` on purpose: consumers of `@mastra/server` may run their\n// typecheck against a `@mastra/core` that doesn't export `MastraFGAPermissions`\n// (anything < 1.32.0). Pinning to the real type would push that name into the\n// emitted `.d.ts` and break downstream typecheck. `any` lets the property\n// accesses (`MastraFGAPermissions.AGENTS_READ`) flow through cleanly on every\n// supported core.\nexport const MastraFGAPermissions: any =\n realPermissions && Object.keys(realPermissions).length > 0 ? realPermissions : FALLBACK_PERMISSIONS;\n","import type { Mastra } from '@mastra/core';\nimport type { MastraFGAPermissionInput } from '@mastra/core/auth/ee';\nimport type { RequestContext } from '@mastra/core/di';\nimport { MastraMemory } from '@mastra/core/memory';\nimport type { Workflow } from '@mastra/core/workflows';\nimport { MASTRA_RESOURCE_ID_KEY, MASTRA_THREAD_ID_KEY, isReservedRequestContextKey } from '../constants';\nimport { MastraFGAPermissions } from '../fga-permissions';\nimport { HTTPException } from '../http-exception';\n\n/**\n * Resolves a workflow by id or registration key from the set Mastra exposes\n * publicly. Unlike `mastra.getWorkflowById`, this excludes hidden internal\n * workflows (e.g. a durable agent's backing loop), which must never be\n * runnable through HTTP routes.\n */\nexport function getPublicWorkflowById(mastra: Mastra, workflowId: string): Workflow | undefined {\n const workflows = mastra.listWorkflows();\n return (\n Object.values(workflows).find(workflow => workflow.id === workflowId) ??\n (Object.hasOwn(workflows, workflowId) ? workflows[workflowId] : undefined)\n );\n}\n\n// Validation helper\nexport function validateBody(body: Record<string, unknown>) {\n const errorResponse = Object.entries(body).reduce<Record<string, string>>((acc, [key, value]) => {\n if (!value) {\n acc[key] = `Argument \"${key}\" is required`;\n }\n return acc;\n }, {});\n\n if (Object.keys(errorResponse).length > 0) {\n throw new HTTPException(400, { message: Object.values(errorResponse)[0] });\n }\n}\n\n/**\n * sanitizes the body by removing disallowed keys.\n * @param body body to sanitize\n * @param disallowedKeys keys to remove from the body\n */\nexport function sanitizeBody(body: Record<string, unknown>, disallowedKeys: string[]) {\n for (const key of disallowedKeys) {\n if (key in body) {\n delete body[key];\n }\n }\n}\n\nconst CREDENTIAL_HEADER_NAMES = new Set([\n 'authorization',\n 'proxy-authorization',\n 'x-api-key',\n 'api-key',\n 'x-goog-api-key',\n 'cookie',\n]);\n\n/**\n * Removes credential-bearing headers from client-supplied `modelSettings.headers`\n * so a caller's own auth (e.g. the app's bearer token) can never override the\n * provider credential configured on the server. Non-credential headers are kept.\n */\nexport function stripClientCredentialHeaders(body: Record<string, unknown>) {\n const modelSettings = body.modelSettings;\n if (!modelSettings || typeof modelSettings !== 'object') return;\n const headers = (modelSettings as { headers?: unknown }).headers;\n if (!headers || typeof headers !== 'object') return;\n\n const kept = Object.fromEntries(\n Object.entries(headers).filter(([name]) => !CREDENTIAL_HEADER_NAMES.has(name.toLowerCase())),\n );\n body.modelSettings = { ...modelSettings, headers: kept };\n}\n\nexport function parsePerPage(\n value: string | undefined,\n defaultValue: number = 100,\n max: number = 1000,\n): number | false {\n const normalized = (value || '').trim().toLowerCase();\n // Handle explicit false to bypass pagination\n if (normalized === 'false') {\n return false;\n }\n const parsed = parseInt(value || String(defaultValue), 10);\n if (isNaN(parsed)) return defaultValue;\n return Math.min(max, Math.max(1, parsed));\n}\n\n/**\n * Parses filter query parameters into a key-value object.\n */\nexport function parseFilters(filters: string | string[] | undefined): Record<string, string> | undefined {\n if (!filters) return undefined;\n\n return Object.fromEntries(\n (Array.isArray(filters) ? filters : [filters]).map((attr: string) => {\n const [key, ...valueParts] = attr.split(':');\n const value = valueParts.join(':'); // ✅ Handles colons in values\n return [key, value];\n }),\n );\n}\n\n/**\n * Merges a body-supplied requestContext into the trusted server RequestContext.\n * The server context is authoritative: reserved keys are skipped and body values\n * only fill keys the server context has not already set.\n */\nexport function mergeBodyRequestContext(serverRequestContext: RequestContext, bodyRequestContext: unknown): void {\n if (!bodyRequestContext || typeof bodyRequestContext !== 'object') {\n return;\n }\n\n for (const [key, value] of Object.entries(bodyRequestContext)) {\n if (isReservedRequestContextKey(key)) continue;\n if (serverRequestContext.get(key) === undefined) {\n serverRequestContext.set(key, value);\n }\n }\n}\n\n// ============================================================================\n// Authorization Utilities\n// ============================================================================\n\n/**\n * Gets the effective resourceId, preferring the reserved key from requestContext\n * over client-provided values for security.\n */\nexport function getEffectiveResourceId(\n requestContext: RequestContext | undefined,\n clientResourceId: string | undefined,\n): string | undefined {\n const contextResourceId = requestContext?.get(MASTRA_RESOURCE_ID_KEY) as string | undefined;\n return contextResourceId || clientResourceId;\n}\n\n/**\n * Returns the resource id resolved from the request context alone (set via\n * `mapUserToResourceId` or the `x-resource-id` header), ignoring any\n * client-provided value. Its presence indicates a resource-scoped caller;\n * its absence indicates a privileged/service context.\n */\nexport function getContextResourceId(requestContext: RequestContext | undefined): string | undefined {\n return requestContext?.get(MASTRA_RESOURCE_ID_KEY) as string | undefined;\n}\n\n/**\n * Ensures a memory request has a resolvable resource ID. The body's\n * `memory.resource` is optional so authenticated setups can rely on the\n * server-derived resource ID (MASTRA_RESOURCE_ID_KEY set via mapUserToResourceId).\n * When neither the body nor the request context provides one, reject with a\n * clear 400 instead of failing deep inside agent execution.\n */\nexport function requireEffectiveResourceId(\n effectiveResourceId: string | undefined,\n): asserts effectiveResourceId is string {\n if (!effectiveResourceId) {\n throw new HTTPException(400, {\n message:\n 'A resource ID is required when using memory. Provide memory.resource in the request body, or configure server auth with mapUserToResourceId to derive it from the authenticated user.',\n });\n }\n}\n\n/**\n * Gets the effective threadId, preferring the reserved key from requestContext\n * over client-provided values for security.\n */\nexport function getEffectiveThreadId(\n requestContext: RequestContext | undefined,\n clientThreadId: string | undefined,\n): string | undefined {\n const contextThreadId = requestContext?.get(MASTRA_THREAD_ID_KEY) as string | undefined;\n return contextThreadId || clientThreadId;\n}\n\n/**\n * Validates that a thread belongs to the specified resourceId.\n * Throws 403 if the thread exists but belongs to a different resource.\n * Threads with no resourceId are accessible to all (shared threads).\n */\nexport async function validateThreadOwnership(\n thread: { resourceId?: string | null } | null | undefined,\n effectiveResourceId: string | undefined,\n): Promise<void> {\n if (thread && effectiveResourceId && thread.resourceId && thread.resourceId !== effectiveResourceId) {\n throw new HTTPException(403, { message: 'Access denied: thread belongs to a different resource' });\n }\n}\n\n/**\n * Validates both coarse resource ownership and fine-grained thread access.\n * FGA enforcement is a no-op when no FGA provider is configured.\n */\nexport async function enforceThreadAccess({\n mastra,\n requestContext,\n threadId,\n thread,\n effectiveResourceId,\n permission = MastraFGAPermissions.MEMORY_READ,\n}: {\n mastra: any;\n requestContext?: RequestContext;\n threadId: string;\n thread?: { resourceId?: string | null } | null;\n effectiveResourceId?: string;\n permission?: MastraFGAPermissionInput;\n}): Promise<void> {\n await validateThreadOwnership(thread, effectiveResourceId);\n\n const fgaProvider = mastra?.getServer?.()?.fga;\n if (!fgaProvider) {\n return;\n }\n\n const user = requestContext?.get('user');\n if (!user || typeof user !== 'object') {\n throw new HTTPException(403, { message: 'FGA authorization denied: authenticated user is required' });\n }\n\n await MastraMemory.checkThreadFGA({\n mastra,\n user: user as { id: string; [key: string]: unknown },\n threadId,\n resourceId: thread?.resourceId ?? effectiveResourceId,\n requestContext,\n permission,\n });\n}\n\n/**\n * Validates that a caller may act on a workflow run.\n *\n * Without `server.auth.mapUserToResourceId` there is no tenancy model, and only a mismatch\n * between two present resource ids is denied. With a mapper, a resource-scoped caller may only\n * act on runs it owns (an owner-less run is not its run). An unscoped caller is a\n * privileged/service context (see getContextResourceId), but that privilege is only granted when\n * an FGA provider authorizes the route; otherwise it is refused rather than granted implicitly,\n * as on the thread-transfer route.\n */\nexport async function validateRunOwnership(\n run: { resourceId?: string | null } | null | undefined,\n effectiveResourceId: string | undefined,\n mastra?: { getServer?: () => { auth?: unknown; fga?: unknown } | undefined },\n): Promise<void> {\n if (!run) return;\n const server = mastra?.getServer?.();\n const tenancy =\n typeof (server?.auth as { mapUserToResourceId?: unknown } | undefined)?.mapUserToResourceId === 'function';\n if (!tenancy) {\n if (effectiveResourceId && run.resourceId && run.resourceId !== effectiveResourceId) {\n throw new HTTPException(403, { message: 'Access denied: workflow run belongs to a different resource' });\n }\n return;\n }\n if (effectiveResourceId) {\n if (run.resourceId !== effectiveResourceId) {\n throw new HTTPException(403, { message: 'Access denied: workflow run belongs to a different resource' });\n }\n return;\n }\n if (!server?.fga) {\n throw new HTTPException(403, {\n message:\n 'Access denied: unscoped workflow run access requires explicit authorization. Configure an FGA provider to authorize privileged run access.',\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,uBAAuB;CAC3B,eAAe;CACf,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,eAAe;CACf,aAAa;CACb,cAAc;CACd,eAAe;CACf,YAAY;CACZ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;;;;;AAOA,eAAsB,wBACpB,QACA,qBACe;CACf,IAAI,UAAU,uBAAuB,OAAO,cAAc,OAAO,eAAe,qBAC9E,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,wDAAwD,CAAC;AAErG;;;;;AAMA,eAAsB,oBAAoB,EACxC,QACA,gBACA,UACA,QACA,qBACA,aAAa,qBAAqB,eAQlB;CAChB,MAAM,wBAAwB,QAAQ,mBAAmB;CAGzD,IAAI,CADgB,QAAQ,YAAY,CAAC,EAAE,KAEzC;CAGF,MAAM,OAAO,gBAAgB,IAAI,MAAM;CACvC,IAAI,CAAC,QAAQ,OAAO,SAAS,UAC3B,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,2DAA2D,CAAC;CAGtG,MAAM,aAAa,eAAe;EAChC;EACM;EACN;EACA,YAAY,QAAQ,cAAc;EAClC;EACA;CACF,CAAC;AACH;;;;;;;;;;;AAYA,eAAsB,qBACpB,KACA,qBACA,QACe;CACf,IAAI,CAAC,KAAK;CACV,MAAM,SAAS,QAAQ,YAAY;CAGnC,IAAI,EADF,QAAQ,QAAQ,KAAA,EAAwD,wBAAwB,aACpF;EACZ,IAAI,uBAAuB,IAAI,cAAc,IAAI,eAAe,qBAC9D,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,8DAA8D,CAAC;EAEzG;CACF;CACA,IAAI,qBAAqB;EACvB,IAAI,IAAI,eAAe,qBACrB,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,8DAA8D,CAAC;EAEzG;CACF;CACA,IAAI,CAAC,QAAQ,KACX,MAAM,IAAI,cAAc,KAAK,EAC3B,SACE,6IACJ,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"file":"utils-BBJlS81s.js","names":[],"sources":["../src/server/fga-permissions.ts","../src/server/handlers/utils.ts"],"sourcesContent":["/**\n * Safe re-export of `MastraFGAPermissions` from `@mastra/core/auth/ee`.\n *\n * Why this shim exists:\n * `MastraFGAPermissions` was introduced in `@mastra/core@1.32.0`. Earlier\n * versions of `@mastra/core` ship `@mastra/core/auth/ee` but do not export\n * this constant. A direct named import (`import { MastraFGAPermissions }\n * from '@mastra/core/auth/ee'`) fails at ESM link time when this version\n * of `@mastra/server` is paired with `@mastra/core < 1.32.0`, taking the\n * entire user bundle down before any code runs.\n *\n * A namespace import tolerates missing names — `ns.MissingExport` is just\n * `undefined`, no link-time error. We then expose the permission map.\n *\n * Fallback values:\n * If the consuming `@mastra/core` does not export `MastraFGAPermissions`,\n * we substitute a hardcoded map of the canonical permission strings used\n * by routes in `@mastra/server`. This preserves the explicit RBAC\n * permission overrides those routes already had as string literals in\n * `@mastra/server@1.31.0` (e.g. `requiresPermission: \"agents:execute\"`\n * on `/v1/responses`). Without this fallback, `requiresPermission` would\n * be `undefined` on old core and the auth layer would derive the wrong\n * permission from the route path (e.g. `v1:write` instead of\n * `agents:execute`), breaking RBAC users who upgrade `@mastra/server`\n * but stay on `@mastra/core@1.31.0`.\n *\n * Once the consuming `@mastra/core` is on `1.32.0+` the values are real\n * and behaviour is identical to a direct named import.\n */\n\nimport * as authEE from '@mastra/core/auth/ee';\n\n// Canonical strings for the FGA permission keys actually referenced by\n// `@mastra/server` source. Mirrors `MastraFGAPermissions` in\n// `@mastra/core@1.32.0+` for these specific keys, and matches the string\n// literals previously hardcoded on the same routes in `@mastra/server@1.31.0`.\nconst FALLBACK_PERMISSIONS = {\n AGENTS_CREATE: 'agents:create',\n AGENTS_DELETE: 'agents:delete',\n AGENTS_EXECUTE: 'agents:execute',\n AGENTS_READ: 'agents:read',\n MEMORY_DELETE: 'memory:delete',\n MEMORY_READ: 'memory:read',\n MEMORY_WRITE: 'memory:write',\n TOOLS_EXECUTE: 'tools:execute',\n TOOLS_READ: 'tools:read',\n STORED_WORKFLOWS_READ: 'stored-workflows:read',\n STORED_WORKFLOWS_WRITE: 'stored-workflows:write',\n WORKFLOWS_EXECUTE: 'workflows:execute',\n WORKFLOWS_READ: 'workflows:read',\n} as const;\n\nconst realPermissions = (authEE as any).MastraFGAPermissions;\n\n// Typed as `any` on purpose: consumers of `@mastra/server` may run their\n// typecheck against a `@mastra/core` that doesn't export `MastraFGAPermissions`\n// (anything < 1.32.0). Pinning to the real type would push that name into the\n// emitted `.d.ts` and break downstream typecheck. `any` lets the property\n// accesses (`MastraFGAPermissions.AGENTS_READ`) flow through cleanly on every\n// supported core.\nexport const MastraFGAPermissions: any =\n realPermissions && Object.keys(realPermissions).length > 0 ? realPermissions : FALLBACK_PERMISSIONS;\n","import type { Mastra } from '@mastra/core';\nimport type { MastraFGAPermissionInput } from '@mastra/core/auth/ee';\nimport type { RequestContext } from '@mastra/core/di';\nimport { MastraMemory } from '@mastra/core/memory';\nimport type { Workflow } from '@mastra/core/workflows';\nimport { MASTRA_RESOURCE_ID_KEY, MASTRA_THREAD_ID_KEY, isReservedRequestContextKey } from '../constants';\nimport { MastraFGAPermissions } from '../fga-permissions';\nimport { HTTPException } from '../http-exception';\n\n/**\n * Resolves a workflow by id or registration key from the set Mastra exposes\n * publicly. Unlike `mastra.getWorkflowById`, this excludes hidden internal\n * workflows (e.g. a durable agent's backing loop), which must never be\n * runnable through HTTP routes.\n */\nexport function getPublicWorkflowById(mastra: Mastra, workflowId: string): Workflow | undefined {\n const workflows = mastra.listWorkflows();\n return (\n Object.values(workflows).find(workflow => workflow.id === workflowId) ??\n (Object.hasOwn(workflows, workflowId) ? workflows[workflowId] : undefined)\n );\n}\n\n// Validation helper\nexport function validateBody(body: Record<string, unknown>) {\n const errorResponse = Object.entries(body).reduce<Record<string, string>>((acc, [key, value]) => {\n if (!value) {\n acc[key] = `Argument \"${key}\" is required`;\n }\n return acc;\n }, {});\n\n if (Object.keys(errorResponse).length > 0) {\n throw new HTTPException(400, { message: Object.values(errorResponse)[0] });\n }\n}\n\n/**\n * sanitizes the body by removing disallowed keys.\n * @param body body to sanitize\n * @param disallowedKeys keys to remove from the body\n */\nexport function sanitizeBody(body: Record<string, unknown>, disallowedKeys: string[]) {\n for (const key of disallowedKeys) {\n if (key in body) {\n delete body[key];\n }\n }\n}\n\nconst CREDENTIAL_HEADER_NAMES = new Set([\n 'authorization',\n 'proxy-authorization',\n 'x-api-key',\n 'api-key',\n 'x-goog-api-key',\n 'cookie',\n]);\n\n/**\n * Removes credential-bearing headers from client-supplied `modelSettings.headers`\n * so a caller's own auth (e.g. the app's bearer token) can never override the\n * provider credential configured on the server. Non-credential headers are kept.\n */\nexport function stripClientCredentialHeaders(body: Record<string, unknown>) {\n const modelSettings = body.modelSettings;\n if (!modelSettings || typeof modelSettings !== 'object') return;\n const headers = (modelSettings as { headers?: unknown }).headers;\n if (!headers || typeof headers !== 'object') return;\n\n const kept = Object.fromEntries(\n Object.entries(headers).filter(([name]) => !CREDENTIAL_HEADER_NAMES.has(name.toLowerCase())),\n );\n body.modelSettings = { ...modelSettings, headers: kept };\n}\n\nexport function parsePerPage(\n value: string | undefined,\n defaultValue: number = 100,\n max: number = 1000,\n): number | false {\n const normalized = (value || '').trim().toLowerCase();\n // Handle explicit false to bypass pagination\n if (normalized === 'false') {\n return false;\n }\n const parsed = parseInt(value || String(defaultValue), 10);\n if (isNaN(parsed)) return defaultValue;\n return Math.min(max, Math.max(1, parsed));\n}\n\n/**\n * Parses filter query parameters into a key-value object.\n */\nexport function parseFilters(filters: string | string[] | undefined): Record<string, string> | undefined {\n if (!filters) return undefined;\n\n return Object.fromEntries(\n (Array.isArray(filters) ? filters : [filters]).map((attr: string) => {\n const [key, ...valueParts] = attr.split(':');\n const value = valueParts.join(':'); // ✅ Handles colons in values\n return [key, value];\n }),\n );\n}\n\n/**\n * Merges a body-supplied requestContext into the trusted server RequestContext.\n * The server context is authoritative: reserved keys are skipped and body values\n * only fill keys the server context has not already set.\n */\nexport function mergeBodyRequestContext(serverRequestContext: RequestContext, bodyRequestContext: unknown): void {\n if (!bodyRequestContext || typeof bodyRequestContext !== 'object') {\n return;\n }\n\n for (const [key, value] of Object.entries(bodyRequestContext)) {\n if (isReservedRequestContextKey(key)) continue;\n if (serverRequestContext.get(key) === undefined) {\n serverRequestContext.set(key, value);\n }\n }\n}\n\n// ============================================================================\n// Authorization Utilities\n// ============================================================================\n\n/**\n * Gets the effective resourceId, preferring the reserved key from requestContext\n * over client-provided values for security.\n */\nexport function getEffectiveResourceId(\n requestContext: RequestContext | undefined,\n clientResourceId: string | undefined,\n): string | undefined {\n const contextResourceId = requestContext?.get(MASTRA_RESOURCE_ID_KEY) as string | undefined;\n return contextResourceId || clientResourceId;\n}\n\n/**\n * Returns the resource id resolved from the request context alone (set via\n * `mapUserToResourceId` or the `x-resource-id` header), ignoring any\n * client-provided value. Its presence indicates a resource-scoped caller;\n * its absence indicates a privileged/service context.\n */\nexport function getContextResourceId(requestContext: RequestContext | undefined): string | undefined {\n return requestContext?.get(MASTRA_RESOURCE_ID_KEY) as string | undefined;\n}\n\n/**\n * Ensures a memory request has a resolvable resource ID. The body's\n * `memory.resource` is optional so authenticated setups can rely on the\n * server-derived resource ID (MASTRA_RESOURCE_ID_KEY set via mapUserToResourceId).\n * When neither the body nor the request context provides one, reject with a\n * clear 400 instead of failing deep inside agent execution.\n */\nexport function requireEffectiveResourceId(\n effectiveResourceId: string | undefined,\n): asserts effectiveResourceId is string {\n if (!effectiveResourceId) {\n throw new HTTPException(400, {\n message:\n 'A resource ID is required when using memory. Provide memory.resource in the request body, or configure server auth with mapUserToResourceId to derive it from the authenticated user.',\n });\n }\n}\n\n/**\n * Gets the effective threadId, preferring the reserved key from requestContext\n * over client-provided values for security.\n */\nexport function getEffectiveThreadId(\n requestContext: RequestContext | undefined,\n clientThreadId: string | undefined,\n): string | undefined {\n const contextThreadId = requestContext?.get(MASTRA_THREAD_ID_KEY) as string | undefined;\n return contextThreadId || clientThreadId;\n}\n\n/**\n * Applies the effective threadId to a client memory thread option. Object\n * threads keep their other fields (metadata, title, ...) so they reach thread\n * creation; a client-supplied resourceId is dropped because the server decides\n * the resource.\n */\nexport function applyEffectiveThreadId<T extends string | { id: string } | undefined>(\n thread: T,\n effectiveThreadId: string | undefined,\n): T | string {\n if (!effectiveThreadId) return thread;\n if (thread && typeof thread === 'object') {\n const { resourceId: _resourceId, ...fields } = thread as { id: string; resourceId?: unknown };\n return { ...fields, id: effectiveThreadId } as T;\n }\n return effectiveThreadId;\n}\n\n/**\n * Validates that a thread belongs to the specified resourceId.\n * Throws 403 if the thread exists but belongs to a different resource.\n * Threads with no resourceId are accessible to all (shared threads).\n */\nexport async function validateThreadOwnership(\n thread: { resourceId?: string | null } | null | undefined,\n effectiveResourceId: string | undefined,\n): Promise<void> {\n if (thread && effectiveResourceId && thread.resourceId && thread.resourceId !== effectiveResourceId) {\n throw new HTTPException(403, { message: 'Access denied: thread belongs to a different resource' });\n }\n}\n\n/**\n * Validates both coarse resource ownership and fine-grained thread access.\n * FGA enforcement is a no-op when no FGA provider is configured.\n */\nexport async function enforceThreadAccess({\n mastra,\n requestContext,\n threadId,\n thread,\n effectiveResourceId,\n permission = MastraFGAPermissions.MEMORY_READ,\n}: {\n mastra: any;\n requestContext?: RequestContext;\n threadId: string;\n thread?: { resourceId?: string | null } | null;\n effectiveResourceId?: string;\n permission?: MastraFGAPermissionInput;\n}): Promise<void> {\n await validateThreadOwnership(thread, effectiveResourceId);\n\n const fgaProvider = mastra?.getServer?.()?.fga;\n if (!fgaProvider) {\n return;\n }\n\n const user = requestContext?.get('user');\n if (!user || typeof user !== 'object') {\n throw new HTTPException(403, { message: 'FGA authorization denied: authenticated user is required' });\n }\n\n await MastraMemory.checkThreadFGA({\n mastra,\n user: user as { id: string; [key: string]: unknown },\n threadId,\n resourceId: thread?.resourceId ?? effectiveResourceId,\n requestContext,\n permission,\n });\n}\n\n/**\n * Validates that a caller may act on a workflow run.\n *\n * Without `server.auth.mapUserToResourceId` there is no tenancy model, and only a mismatch\n * between two present resource ids is denied. With a mapper, a resource-scoped caller may only\n * act on runs it owns (an owner-less run is not its run). An unscoped caller is a\n * privileged/service context (see getContextResourceId), but that privilege is only granted when\n * an FGA provider authorizes the route; otherwise it is refused rather than granted implicitly,\n * as on the thread-transfer route.\n */\nexport async function validateRunOwnership(\n run: { resourceId?: string | null } | null | undefined,\n effectiveResourceId: string | undefined,\n mastra?: { getServer?: () => { auth?: unknown; fga?: unknown } | undefined },\n): Promise<void> {\n if (!run) return;\n const server = mastra?.getServer?.();\n const tenancy =\n typeof (server?.auth as { mapUserToResourceId?: unknown } | undefined)?.mapUserToResourceId === 'function';\n if (!tenancy) {\n if (effectiveResourceId && run.resourceId && run.resourceId !== effectiveResourceId) {\n throw new HTTPException(403, { message: 'Access denied: workflow run belongs to a different resource' });\n }\n return;\n }\n if (effectiveResourceId) {\n if (run.resourceId !== effectiveResourceId) {\n throw new HTTPException(403, { message: 'Access denied: workflow run belongs to a different resource' });\n }\n return;\n }\n if (!server?.fga) {\n throw new HTTPException(403, {\n message:\n 'Access denied: unscoped workflow run access requires explicit authorization. Configure an FGA provider to authorize privileged run access.',\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,uBAAuB;CAC3B,eAAe;CACf,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,eAAe;CACf,aAAa;CACb,cAAc;CACd,eAAe;CACf,YAAY;CACZ,uBAAuB;CACvB,wBAAwB;CACxB,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAM,kBAAmB,OAAe;AAQxC,MAAa,uBACX,mBAAmB,OAAO,KAAK,eAAe,CAAC,CAAC,SAAS,IAAI,kBAAkB;;;;;;;;;AC9CjF,SAAgB,sBAAsB,QAAgB,YAA0C;CAC9F,MAAM,YAAY,OAAO,cAAc;CACvC,OACE,OAAO,OAAO,SAAS,CAAC,CAAC,MAAK,aAAY,SAAS,OAAO,UAAU,MACnE,OAAO,OAAO,WAAW,UAAU,IAAI,UAAU,cAAc,KAAA;AAEpE;AAGA,SAAgB,aAAa,MAA+B;CAC1D,MAAM,gBAAgB,OAAO,QAAQ,IAAI,CAAC,CAAC,QAAgC,KAAK,CAAC,KAAK,WAAW;EA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GzD,IAAI,CADgB,QAAQ,YAAY,CAAC,EAAE,KAEzC;CAGF,MAAM,OAAO,gBAAgB,IAAI,MAAM;CACvC,IAAI,CAAC,QAAQ,OAAO,SAAS,UAC3B,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,2DAA2D,CAAC;CAGtG,MAAM,aAAa,eAAe;EAChC;EACM;EACN;EACA,YAAY,QAAQ,cAAc;EAClC;EACA;CACF,CAAC;AACH;;;;;;;;;;;AAYA,eAAsB,qBACpB,KACA,qBACA,QACe;CACf,IAAI,CAAC,KAAK;CACV,MAAM,SAAS,QAAQ,YAAY;CAGnC,IAAI,EADF,QAAQ,QAAQ,KAAA,EAAwD,wBAAwB,aACpF;EACZ,IAAI,uBAAuB,IAAI,cAAc,IAAI,eAAe,qBAC9D,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,8DAA8D,CAAC;EAEzG;CACF;CACA,IAAI,qBAAqB;EACvB,IAAI,IAAI,eAAe,qBACrB,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,8DAA8D,CAAC;EAEzG;CACF;CACA,IAAI,CAAC,QAAQ,KACX,MAAM,IAAI,cAAc,KAAK,EAC3B,SACE,6IACJ,CAAC;AAEL"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as HTTPException } from "./http-exception-CyfxZB6W.js";
|
|
2
|
-
import { n as standardSchemaToJSONSchema, r as toStandardSchema } from "./schema-e0VHpMt0-
|
|
3
|
-
import "./schema-
|
|
2
|
+
import { n as standardSchemaToJSONSchema, r as toStandardSchema } from "./schema-e0VHpMt0-CVP5Hnxy.js";
|
|
3
|
+
import "./schema-Drf2W04o.js";
|
|
4
4
|
import { o as MASTRA_RESOURCE_ID_KEY } from "./constants-DazK_RZj.js";
|
|
5
5
|
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/superjson/2.2.6/b5fefaeae5105e92d752f15cd158913d848e5075a9f80278488919f0941a70dd/node_modules/superjson/dist/double-indexed-kv.js
|
|
6
6
|
var DoubleIndexedKV = class {
|
|
@@ -907,4 +907,4 @@ function convertInstructionsToString(message) {
|
|
|
907
907
|
//#endregion
|
|
908
908
|
export { getWorkflowInfo as a, toSlug as c, getStoredResourceScope as i, stringify as l, assertStoredResourceScope as n, normalizeRoutePath as o, convertInstructionsToString as r, scopeStoredResourceMetadata as s, WorkflowRegistry as t };
|
|
909
909
|
|
|
910
|
-
//# sourceMappingURL=utils-
|
|
910
|
+
//# sourceMappingURL=utils-DCAUeb6M.js.map
|