@mastra/server 1.83.0-alpha.1 → 1.83.0-alpha.2
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-CQlJ-SZr.js → a2a-D3996OEF.js} +2 -2
- package/dist/{a2a-CQlJ-SZr.js.map → a2a-D3996OEF.js.map} +1 -1
- package/dist/{a2a-mDspNbWX.cjs → a2a-EGLeyLjI.cjs} +2 -2
- package/dist/{a2a-mDspNbWX.cjs.map → a2a-EGLeyLjI.cjs.map} +1 -1
- package/dist/{agents-CMEeZr5y.cjs → agents-B4-yvYFU.cjs} +32 -31
- package/dist/agents-B4-yvYFU.cjs.map +1 -0
- package/dist/{agents-DXlVewzD.js → agents-CLE3kITm.js} +32 -31
- package/dist/agents-CLE3kITm.js.map +1 -0
- package/dist/{api-schema-manifest-DOuSq4rG.js → api-schema-manifest-m9VMkNih.js} +2 -2
- package/dist/{api-schema-manifest-DOuSq4rG.js.map → api-schema-manifest-m9VMkNih.js.map} +1 -1
- package/dist/{api-schema-manifest-BKnghL_k.cjs → api-schema-manifest-zVIP5lY6.cjs} +2 -2
- package/dist/{api-schema-manifest-BKnghL_k.cjs.map → api-schema-manifest-zVIP5lY6.cjs.map} +1 -1
- package/dist/{conversations-CFj4BnNb.cjs → conversations-C2_kgBVu.cjs} +2 -2
- package/dist/{conversations-CFj4BnNb.cjs.map → conversations-C2_kgBVu.cjs.map} +1 -1
- package/dist/{conversations-DjTKtaUi.js → conversations-Dl6909lT.js} +2 -2
- package/dist/{conversations-DjTKtaUi.js.map → conversations-Dl6909lT.js.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{editor-builder-o9xJHa96.js → editor-builder-XP9obiam.js} +2 -2
- package/dist/{editor-builder-o9xJHa96.js.map → editor-builder-XP9obiam.js.map} +1 -1
- package/dist/{editor-builder-CBBZxQhO.cjs → editor-builder-o8LOkCe1.cjs} +2 -2
- package/dist/{editor-builder-CBBZxQhO.cjs.map → editor-builder-o8LOkCe1.cjs.map} +1 -1
- package/dist/{plans-DVx9N2re.js → plans-DImsIR2v.js} +2 -2
- package/dist/{plans-DVx9N2re.js.map → plans-DImsIR2v.js.map} +1 -1
- package/dist/{plans-CQijj_Am.cjs → plans-jHcOmxx2.cjs} +2 -2
- package/dist/{plans-CQijj_Am.cjs.map → plans-jHcOmxx2.cjs.map} +1 -1
- package/dist/{responses-NM-kLq8b.js → responses-B-5RuNWh.js} +2 -2
- package/dist/{responses-NM-kLq8b.js.map → responses-B-5RuNWh.js.map} +1 -1
- package/dist/{responses-DYGS0aiI.cjs → responses-DuSPxtip.cjs} +2 -2
- package/dist/{responses-DYGS0aiI.cjs.map → responses-DuSPxtip.cjs.map} +1 -1
- package/dist/{routes-CWrdLnBc.cjs → routes-BAn-IJa1.cjs} +9 -9
- package/dist/{routes-CWrdLnBc.cjs.map → routes-BAn-IJa1.cjs.map} +1 -1
- package/dist/{routes-B2XGdvlv.js → routes-BUczFZCF.js} +9 -9
- package/dist/{routes-B2XGdvlv.js.map → routes-BUczFZCF.js.map} +1 -1
- package/dist/{scores-DTVV_OaX.js → scores-D0d1KZaB.js} +2 -2
- package/dist/{scores-DTVV_OaX.js.map → scores-D0d1KZaB.js.map} +1 -1
- package/dist/{scores-CWx6H3Z8.cjs → scores-sijeq4-F.cjs} +2 -2
- package/dist/{scores-CWx6H3Z8.cjs.map → scores-sijeq4-F.cjs.map} +1 -1
- package/dist/server/handlers/a2a.cjs +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agents.cjs +1 -1
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/conversations.cjs +1 -1
- package/dist/server/handlers/conversations.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/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/scores.cjs +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/stored-agent-favorites.cjs +1 -1
- package/dist/server/handlers/stored-agent-favorites.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +1 -1
- package/dist/server/handlers/stored-agents.js +1 -1
- package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
- package/dist/server/handlers/stored-skill-favorites.js +1 -1
- 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/tools.cjs +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers.cjs +7 -7
- package/dist/server/handlers.js +7 -7
- package/dist/server/server-adapter/index.cjs +1 -1
- package/dist/server/server-adapter/index.js +1 -1
- package/dist/{tools-7O8cd_4u.cjs → tools-DF2XAjMu.cjs} +2 -2
- package/dist/{tools-7O8cd_4u.cjs.map → tools-DF2XAjMu.cjs.map} +1 -1
- package/dist/{tools-Bf3vq-HD.js → tools-FukgyRS8.js} +2 -2
- package/dist/{tools-Bf3vq-HD.js.map → tools-FukgyRS8.js.map} +1 -1
- package/package.json +2 -2
- package/dist/agents-CMEeZr5y.cjs.map +0 -1
- package/dist/agents-DXlVewzD.js.map +0 -1
|
@@ -1803,17 +1803,21 @@ async function authorizeDurableRun({ mastra, agent, runId, requestContext, permi
|
|
|
1803
1803
|
return "ok";
|
|
1804
1804
|
}
|
|
1805
1805
|
/**
|
|
1806
|
-
*
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
*
|
|
1806
|
+
* The ownership policy for observing (`MEMORY_READ`) and aborting
|
|
1807
|
+
* (`MEMORY_WRITE`) a run: the caller must own the run and have `permission` on
|
|
1808
|
+
* its thread. Throws 403 when access is denied and 503 when ownership cannot be
|
|
1809
|
+
* read. Returns undefined when the run is unknown, expired, or its owner cannot
|
|
1810
|
+
* be verified; the caller decides how to report that.
|
|
1811
|
+
*
|
|
1812
|
+
* Plain runs are checked against their shared run record. Durable runs are
|
|
1813
|
+
* checked against their workflow rows; observers may also use the owner the
|
|
1814
|
+
* agent tracks in this process, which outlives the run so finished runs can be
|
|
1815
|
+
* replayed. Aborts never use it, so a finished run is not reported stopped.
|
|
1811
1816
|
*/
|
|
1812
|
-
async function
|
|
1813
|
-
const permission = require_utils$1.MastraFGAPermissions.MEMORY_READ;
|
|
1817
|
+
async function authorizeRunAccess({ mastra, agent, runId, requestContext, permission }) {
|
|
1814
1818
|
if (!(0, _mastra_core_agent.isDurableAgentLike)(agent)) {
|
|
1815
1819
|
const record = await getPlainRunRecord(agent, runId);
|
|
1816
|
-
if (!record)
|
|
1820
|
+
if (!record) return void 0;
|
|
1817
1821
|
await authorizeRunOwner({
|
|
1818
1822
|
mastra,
|
|
1819
1823
|
agent,
|
|
@@ -1821,10 +1825,10 @@ async function authorizeRunObservation({ mastra, agent, runId, requestContext })
|
|
|
1821
1825
|
requestContext,
|
|
1822
1826
|
permission
|
|
1823
1827
|
});
|
|
1824
|
-
return;
|
|
1828
|
+
return record;
|
|
1825
1829
|
}
|
|
1826
1830
|
const getOwner = agent.__getRunOwner;
|
|
1827
|
-
const owner = typeof getOwner === "function" ? getOwner.call(agent, runId) : void 0;
|
|
1831
|
+
const owner = permission === require_utils$1.MastraFGAPermissions.MEMORY_READ && typeof getOwner === "function" ? getOwner.call(agent, runId) : void 0;
|
|
1828
1832
|
if (owner) {
|
|
1829
1833
|
await authorizeRunOwner({
|
|
1830
1834
|
mastra,
|
|
@@ -1833,15 +1837,15 @@ async function authorizeRunObservation({ mastra, agent, runId, requestContext })
|
|
|
1833
1837
|
requestContext,
|
|
1834
1838
|
permission
|
|
1835
1839
|
});
|
|
1836
|
-
return;
|
|
1840
|
+
return {};
|
|
1837
1841
|
}
|
|
1838
|
-
|
|
1842
|
+
return await authorizeDurableRun({
|
|
1839
1843
|
mastra,
|
|
1840
1844
|
agent,
|
|
1841
1845
|
runId,
|
|
1842
1846
|
requestContext,
|
|
1843
1847
|
permission
|
|
1844
|
-
})
|
|
1848
|
+
}) === "ok" ? {} : void 0;
|
|
1845
1849
|
}
|
|
1846
1850
|
const ABORT_AGENT_RUN_ROUTE = require_route_builder.createRoute({
|
|
1847
1851
|
method: "POST",
|
|
@@ -1864,26 +1868,22 @@ const ABORT_AGENT_RUN_ROUTE = require_route_builder.createRoute({
|
|
|
1864
1868
|
if (!(0, _mastra_core_agent.isDurableAgentLike)(agent)) {
|
|
1865
1869
|
const resumable = agent;
|
|
1866
1870
|
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" });
|
|
1867
|
-
const record = await getPlainRunRecord(agent, runId);
|
|
1868
|
-
if (!record) throw new require_http_exception.HTTPException(404, { message: "Run not found" });
|
|
1869
|
-
await authorizeRunOwner({
|
|
1870
|
-
mastra,
|
|
1871
|
-
agent,
|
|
1872
|
-
owner: record,
|
|
1873
|
-
requestContext,
|
|
1874
|
-
permission: require_utils$1.MastraFGAPermissions.MEMORY_WRITE
|
|
1875
|
-
});
|
|
1876
|
-
if (record.status === "finished") return { aborted: false };
|
|
1877
|
-
if (typeof resumable.__abortRunAcknowledged === "function") return { aborted: await resumable.__abortRunAcknowledged.call(agent, runId) };
|
|
1878
|
-
return { aborted: agent.abortRunStream(runId) };
|
|
1879
1871
|
}
|
|
1880
|
-
|
|
1872
|
+
const run = await authorizeRunAccess({
|
|
1881
1873
|
mastra,
|
|
1882
1874
|
agent,
|
|
1883
1875
|
runId,
|
|
1884
1876
|
requestContext,
|
|
1885
1877
|
permission: require_utils$1.MastraFGAPermissions.MEMORY_WRITE
|
|
1886
|
-
})
|
|
1878
|
+
});
|
|
1879
|
+
if (!(0, _mastra_core_agent.isDurableAgentLike)(agent)) {
|
|
1880
|
+
if (!run) throw new require_http_exception.HTTPException(404, { message: "Run not found" });
|
|
1881
|
+
if (run.status === "finished") return { aborted: false };
|
|
1882
|
+
const resumable = agent;
|
|
1883
|
+
if (typeof resumable.__abortRunAcknowledged === "function") return { aborted: await resumable.__abortRunAcknowledged.call(agent, runId) };
|
|
1884
|
+
return { aborted: agent.abortRunStream(runId) };
|
|
1885
|
+
}
|
|
1886
|
+
if (!run) return { aborted: false };
|
|
1887
1887
|
if (typeof agent.__abortRunAcknowledged === "function") return { aborted: await agent.__abortRunAcknowledged(runId) };
|
|
1888
1888
|
return { aborted: await agent.abortRunStream(runId) };
|
|
1889
1889
|
} catch (error) {
|
|
@@ -2191,12 +2191,13 @@ const OBSERVE_AGENT_STREAM_ROUTE = require_route_builder.createRoute({
|
|
|
2191
2191
|
agentId,
|
|
2192
2192
|
requestContext
|
|
2193
2193
|
});
|
|
2194
|
-
await
|
|
2194
|
+
if (!await authorizeRunAccess({
|
|
2195
2195
|
mastra,
|
|
2196
2196
|
agent,
|
|
2197
2197
|
runId,
|
|
2198
|
-
requestContext
|
|
2199
|
-
|
|
2198
|
+
requestContext,
|
|
2199
|
+
permission: require_utils$1.MastraFGAPermissions.MEMORY_READ
|
|
2200
|
+
})) throw new require_http_exception.HTTPException(404, { message: "Run not found" });
|
|
2200
2201
|
const durableAgent = (0, _mastra_core_agent.isDurableAgentLike)(agent) ? agent : void 0;
|
|
2201
2202
|
const pubsub = durableAgent?.pubsub ?? getAgentStreamPubSub(agent) ?? mastra.pubsub;
|
|
2202
2203
|
const topic = (0, _mastra_core_agent_durable.AGENT_STREAM_TOPIC)(runId);
|
|
@@ -3541,4 +3542,4 @@ Object.defineProperty(exports, "isProviderConnected", {
|
|
|
3541
3542
|
}
|
|
3542
3543
|
});
|
|
3543
3544
|
|
|
3544
|
-
//# sourceMappingURL=agents-
|
|
3545
|
+
//# sourceMappingURL=agents-B4-yvYFU.cjs.map
|