@mastra/server 1.0.0-beta.10 → 1.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/README.md +2 -2
- package/dist/{chunk-PUSD37LD.cjs → chunk-3XI22UQR.cjs} +4 -3
- package/dist/chunk-3XI22UQR.cjs.map +1 -0
- package/dist/{chunk-7HX4V5Y6.cjs → chunk-4MNOLEZO.cjs} +22767 -18491
- package/dist/chunk-4MNOLEZO.cjs.map +1 -0
- package/dist/{chunk-WVAQXM6W.cjs → chunk-4TDHAYN7.cjs} +26 -18
- package/dist/chunk-4TDHAYN7.cjs.map +1 -0
- package/dist/{chunk-7N3PD4SV.js → chunk-6V57U52D.js} +3 -3
- package/dist/{chunk-7N3PD4SV.js.map → chunk-6V57U52D.js.map} +1 -1
- package/dist/{chunk-R56K77E2.cjs → chunk-7KOS32XA.cjs} +175 -57
- package/dist/chunk-7KOS32XA.cjs.map +1 -0
- package/dist/{chunk-C3D3X2L5.cjs → chunk-7O3KPUJ4.cjs} +5 -5
- package/dist/{chunk-C3D3X2L5.cjs.map → chunk-7O3KPUJ4.cjs.map} +1 -1
- package/dist/chunk-AZIH2QEC.js +83 -0
- package/dist/chunk-AZIH2QEC.js.map +1 -0
- package/dist/{chunk-LPM6BBAX.cjs → chunk-BMLUV4BH.cjs} +2 -53
- package/dist/chunk-BMLUV4BH.cjs.map +1 -0
- package/dist/{chunk-X4QMPCTP.cjs → chunk-BMYZ4DO6.cjs} +12 -2
- package/dist/chunk-BMYZ4DO6.cjs.map +1 -0
- package/dist/{chunk-DHWPHLGF.cjs → chunk-BNGT3NIC.cjs} +14 -14
- package/dist/{chunk-DHWPHLGF.cjs.map → chunk-BNGT3NIC.cjs.map} +1 -1
- package/dist/{chunk-ESZ6V5WB.cjs → chunk-C3UIIRAT.cjs} +8 -4
- package/dist/chunk-C3UIIRAT.cjs.map +1 -0
- package/dist/{chunk-YP34EWWK.js → chunk-DVSCJECS.js} +11 -14
- package/dist/chunk-DVSCJECS.js.map +1 -0
- package/dist/{chunk-4W2SM6CG.js → chunk-DW3WE4M4.js} +14 -58
- package/dist/chunk-DW3WE4M4.js.map +1 -0
- package/dist/{chunk-RQK4FQUD.js → chunk-E646Y4FQ.js} +3 -45
- package/dist/chunk-E646Y4FQ.js.map +1 -0
- package/dist/{chunk-AWBBXA36.js → chunk-EEORY4VR.js} +22072 -17796
- package/dist/chunk-EEORY4VR.js.map +1 -0
- package/dist/chunk-EUBTCHQC.js +83 -0
- package/dist/chunk-EUBTCHQC.js.map +1 -0
- package/dist/chunk-FWSKVWS7.cjs +88 -0
- package/dist/chunk-FWSKVWS7.cjs.map +1 -0
- package/dist/{chunk-2PLXW4ZX.cjs → chunk-K73YS7YB.cjs} +74 -74
- package/dist/{chunk-2PLXW4ZX.cjs.map → chunk-K73YS7YB.cjs.map} +1 -1
- package/dist/{chunk-CT5VG7NT.js → chunk-KEXR53KI.js} +3 -3
- package/dist/{chunk-CT5VG7NT.js.map → chunk-KEXR53KI.js.map} +1 -1
- package/dist/{chunk-WE4USCF3.js → chunk-KPSSRYGH.js} +11 -3
- package/dist/{chunk-X4QMPCTP.cjs.map → chunk-KPSSRYGH.js.map} +1 -1
- package/dist/{chunk-V272B7RM.cjs → chunk-LKTCAPBD.cjs} +15 -18
- package/dist/chunk-LKTCAPBD.cjs.map +1 -0
- package/dist/{chunk-US6Y5RLR.cjs → chunk-LQSZ4FJJ.cjs} +21 -21
- package/dist/{chunk-US6Y5RLR.cjs.map → chunk-LQSZ4FJJ.cjs.map} +1 -1
- package/dist/{chunk-UTIOKR5C.js → chunk-MQLS6Z7A.js} +8 -4
- package/dist/chunk-MQLS6Z7A.js.map +1 -0
- package/dist/{chunk-FPCGLPLJ.cjs → chunk-P3H4AZKI.cjs} +17 -62
- package/dist/chunk-P3H4AZKI.cjs.map +1 -0
- package/dist/chunk-Q7NPRJRV.cjs +88 -0
- package/dist/chunk-Q7NPRJRV.cjs.map +1 -0
- package/dist/{chunk-QNVYGEJ4.js → chunk-SRQY5IWD.js} +3 -3
- package/dist/{chunk-QNVYGEJ4.js.map → chunk-SRQY5IWD.js.map} +1 -1
- package/dist/{chunk-ZULZ2752.js → chunk-SV4AUWGY.js} +3 -3
- package/dist/{chunk-ZULZ2752.js.map → chunk-SV4AUWGY.js.map} +1 -1
- package/dist/{chunk-Q6SVIZLX.js → chunk-UWRAKVAJ.js} +124 -7
- package/dist/chunk-UWRAKVAJ.js.map +1 -0
- package/dist/{chunk-6YWE7UPT.js → chunk-WBLT2HL3.js} +4 -3
- package/dist/chunk-WBLT2HL3.js.map +1 -0
- package/dist/{chunk-DG3INBBQ.js → chunk-YD5BSLPJ.js} +18 -10
- package/dist/chunk-YD5BSLPJ.js.map +1 -0
- package/dist/dist-2J26LQO2.cjs +16 -0
- package/dist/{dist-P4MXBQ3U.cjs.map → dist-2J26LQO2.cjs.map} +1 -1
- package/dist/{dist-X7XR3M3Z.js → dist-4CMHRWC4.js} +3 -3
- package/dist/{dist-X7XR3M3Z.js.map → dist-4CMHRWC4.js.map} +1 -1
- package/dist/{dist-PQZUVLPC.js → dist-AEJONJSS.js} +3 -3
- package/dist/{dist-PQZUVLPC.js.map → dist-AEJONJSS.js.map} +1 -1
- package/dist/{dist-G2BYZJOC.cjs → dist-AF7EUPXA.cjs} +28 -28
- package/dist/{dist-G2BYZJOC.cjs.map → dist-AF7EUPXA.cjs.map} +1 -1
- package/dist/dist-MEN73GGI.js +3 -0
- package/dist/{dist-YREX2TJT.js.map → dist-MEN73GGI.js.map} +1 -1
- package/dist/{dist-FZYCV3VB.cjs → dist-NVXXJWBO.cjs} +26 -26
- package/dist/{dist-FZYCV3VB.cjs.map → dist-NVXXJWBO.cjs.map} +1 -1
- package/dist/{dist-RFMYFILX.cjs → dist-Q2ST4SUQ.cjs} +30 -30
- package/dist/{dist-RFMYFILX.cjs.map → dist-Q2ST4SUQ.cjs.map} +1 -1
- package/dist/{dist-XVBSOGFK.js → dist-TE7XRSWH.js} +3 -3
- package/dist/{dist-XVBSOGFK.js.map → dist-TE7XRSWH.js.map} +1 -1
- package/dist/{dist-R7WYX6LC.js → dist-VPYZNWNG.js} +3 -3
- package/dist/{dist-R7WYX6LC.js.map → dist-VPYZNWNG.js.map} +1 -1
- package/dist/{dist-4MVGNSRL.cjs → dist-Y5SYUVLY.cjs} +20 -20
- package/dist/{dist-4MVGNSRL.cjs.map → dist-Y5SYUVLY.cjs.map} +1 -1
- package/dist/server/handlers/a2a.cjs +9 -9
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +19 -19
- package/dist/server/handlers/agent-builder.d.ts +23 -6
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agents.cjs +27 -23
- package/dist/server/handlers/agents.d.ts +23 -3
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/memory.cjs +24 -24
- package/dist/server/handlers/memory.d.ts +20 -20
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -8
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +27 -27
- package/dist/server/handlers/workflows.d.ts +35 -9
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +14 -14
- package/dist/server/handlers.js +7 -7
- package/dist/server/schemas/agent-builder.d.ts +9 -0
- package/dist/server/schemas/agent-builder.d.ts.map +1 -1
- package/dist/server/schemas/agents.d.ts +26 -0
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/memory.d.ts +20 -20
- package/dist/server/schemas/memory.d.ts.map +1 -1
- package/dist/server/schemas/workflows.d.ts +36 -7
- package/dist/server/schemas/workflows.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +109 -105
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.d.ts +3 -3
- package/dist/server/server-adapter/index.d.ts.map +1 -1
- package/dist/server/server-adapter/index.js +12 -8
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/agents.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/index.d.ts +2 -2
- package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
- package/dist/server/utils.d.ts.map +1 -1
- package/dist/{token-VFONFWVS.cjs → token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs} +11 -12
- package/dist/token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs.map +1 -0
- package/dist/{token-JGA3ZWAN.js → token-6GSAFR2W-KVDFAJ2M-LNX5VF3I.js} +8 -8
- package/dist/token-6GSAFR2W-KVDFAJ2M-LNX5VF3I.js.map +1 -0
- package/dist/{token-ZOD6YIQ3.cjs → token-6GSAFR2W-KVDFAJ2M-SDYXODLX.cjs} +11 -11
- package/dist/token-6GSAFR2W-KVDFAJ2M-SDYXODLX.cjs.map +1 -0
- package/dist/{token-GVZ7HRD7.js → token-6GSAFR2W-KVDFAJ2M-VW443KIA.js} +8 -9
- package/dist/token-6GSAFR2W-KVDFAJ2M-VW443KIA.js.map +1 -0
- package/dist/token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs +10 -0
- package/dist/token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs.map +1 -0
- package/dist/token-util-NEHG7TUY-DJYRKLRD-BSQMRUEW.js +8 -0
- package/dist/token-util-NEHG7TUY-DJYRKLRD-BSQMRUEW.js.map +1 -0
- package/dist/token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js +8 -0
- package/dist/token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js.map +1 -0
- package/dist/token-util-NEHG7TUY-DJYRKLRD-MFJRDVVF.cjs +10 -0
- package/dist/token-util-NEHG7TUY-DJYRKLRD-MFJRDVVF.cjs.map +1 -0
- package/package.json +4 -5
- package/dist/chunk-4W2SM6CG.js.map +0 -1
- package/dist/chunk-6YWE7UPT.js.map +0 -1
- package/dist/chunk-7HX4V5Y6.cjs.map +0 -1
- package/dist/chunk-AWBBXA36.js.map +0 -1
- package/dist/chunk-DG3INBBQ.js.map +0 -1
- package/dist/chunk-ER3QM7DD.js +0 -46
- package/dist/chunk-ER3QM7DD.js.map +0 -1
- package/dist/chunk-ESZ6V5WB.cjs.map +0 -1
- package/dist/chunk-FPCGLPLJ.cjs.map +0 -1
- package/dist/chunk-LPM6BBAX.cjs.map +0 -1
- package/dist/chunk-PUSD37LD.cjs.map +0 -1
- package/dist/chunk-Q6SVIZLX.js.map +0 -1
- package/dist/chunk-R56K77E2.cjs.map +0 -1
- package/dist/chunk-RQK4FQUD.js.map +0 -1
- package/dist/chunk-UTIOKR5C.js.map +0 -1
- package/dist/chunk-V272B7RM.cjs.map +0 -1
- package/dist/chunk-WE4USCF3.js.map +0 -1
- package/dist/chunk-WVAQXM6W.cjs.map +0 -1
- package/dist/chunk-XQPJ63ZD.cjs +0 -48
- package/dist/chunk-XQPJ63ZD.cjs.map +0 -1
- package/dist/chunk-YP34EWWK.js.map +0 -1
- package/dist/dist-P4MXBQ3U.cjs +0 -16
- package/dist/dist-YREX2TJT.js +0 -3
- package/dist/token-GVZ7HRD7.js.map +0 -1
- package/dist/token-JGA3ZWAN.js.map +0 -1
- package/dist/token-VFONFWVS.cjs.map +0 -1
- package/dist/token-ZOD6YIQ3.cjs.map +0 -1
- package/dist/token-util-7R2ZFIXO.js +0 -7
- package/dist/token-util-7R2ZFIXO.js.map +0 -1
- package/dist/token-util-BLJZJDBZ.cjs +0 -9
- package/dist/token-util-BLJZJDBZ.cjs.map +0 -1
- package/dist/token-util-VGZUWSNR.cjs +0 -9
- package/dist/token-util-VGZUWSNR.cjs.map +0 -1
- package/dist/token-util-VKTPZLSE.js +0 -7
- package/dist/token-util-VKTPZLSE.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`919a22b`](https://github.com/mastra-ai/mastra/commit/919a22b25876f9ed5891efe5facbe682c30ff497)]:
|
|
8
|
+
- @mastra/core@1.0.0-beta.13
|
|
9
|
+
|
|
10
|
+
## 1.0.0-beta.12
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Add resourceId to workflow routes ([#11166](https://github.com/mastra-ai/mastra/pull/11166))
|
|
15
|
+
|
|
16
|
+
- Fix MastraServer.tools typing to accept tools with input schemas ([`5118f38`](https://github.com/mastra-ai/mastra/commit/5118f384a70b1166012fde3b901f3227870b1009))
|
|
17
|
+
|
|
18
|
+
Fixes issue #11185 where `MastraServer.tools` was rejecting tools created with `createTool({ inputSchema })`. Changed the tools property type from `Record<string, Tool>` to `ToolsInput` to accept tools with any schema types (input, output, or none), as well as Vercel AI SDK tools and provider-defined tools.
|
|
19
|
+
|
|
20
|
+
Tools created with `createTool({ inputSchema: z.object(...) })` now work without TypeScript errors.
|
|
21
|
+
|
|
22
|
+
- Remove deprecated playground-only prompt generation handler (functionality moved to @mastra/server) ([#11074](https://github.com/mastra-ai/mastra/pull/11074))
|
|
23
|
+
|
|
24
|
+
Improve prompt enhancement UX: show toast errors when enhancement fails, disable button when no model has a configured API key, and prevent users from disabling all models in the model list
|
|
25
|
+
|
|
26
|
+
Add missing `/api/agents/:agentId/instructions/enhance` endpoint that was referenced by `@mastra/client-js` and `@mastra/playground-ui`
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`d5ed981`](https://github.com/mastra-ai/mastra/commit/d5ed981c8701c1b8a27a5f35a9a2f7d9244e695f), [`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808), [`932d63d`](https://github.com/mastra-ai/mastra/commit/932d63dd51be9c8bf1e00e3671fe65606c6fb9cd), [`b760b73`](https://github.com/mastra-ai/mastra/commit/b760b731aca7c8a3f041f61d57a7f125ae9cb215), [`695a621`](https://github.com/mastra-ai/mastra/commit/695a621528bdabeb87f83c2277cf2bb084c7f2b4), [`2b459f4`](https://github.com/mastra-ai/mastra/commit/2b459f466fd91688eeb2a44801dc23f7f8a887ab), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`09e4bae`](https://github.com/mastra-ai/mastra/commit/09e4bae18dd5357d2ae078a4a95a2af32168ab08), [`24b76d8`](https://github.com/mastra-ai/mastra/commit/24b76d8e17656269c8ed09a0c038adb9cc2ae95a), [`243a823`](https://github.com/mastra-ai/mastra/commit/243a8239c5906f5c94e4f78b54676793f7510ae3), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`c61fac3`](https://github.com/mastra-ai/mastra/commit/c61fac3add96f0dcce0208c07415279e2537eb62), [`6f14f70`](https://github.com/mastra-ai/mastra/commit/6f14f706ccaaf81b69544b6c1b75ab66a41e5317), [`09e4bae`](https://github.com/mastra-ai/mastra/commit/09e4bae18dd5357d2ae078a4a95a2af32168ab08), [`4524734`](https://github.com/mastra-ai/mastra/commit/45247343e384717a7c8404296275c56201d6470f), [`2a53598`](https://github.com/mastra-ai/mastra/commit/2a53598c6d8cfeb904a7fc74e57e526d751c8fa6), [`c7cd3c7`](https://github.com/mastra-ai/mastra/commit/c7cd3c7a187d7aaf79e2ca139de328bf609a14b4), [`847c212`](https://github.com/mastra-ai/mastra/commit/847c212caba7df0d6f2fc756b494ac3c75c3720d), [`6f941c4`](https://github.com/mastra-ai/mastra/commit/6f941c438ca5f578619788acc7608fc2e23bd176)]:
|
|
29
|
+
- @mastra/core@1.0.0-beta.12
|
|
30
|
+
|
|
31
|
+
## 1.0.0-beta.11
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Fix type safety for message ordering - restrict `orderBy` to only accept `'createdAt'` field ([#11069](https://github.com/mastra-ai/mastra/pull/11069))
|
|
36
|
+
|
|
37
|
+
Messages don't have an `updatedAt` field, but the previous type allowed ordering by it, which would return empty results. This change adds compile-time type safety by making `StorageOrderBy` generic and restricting `StorageListMessagesInput.orderBy` to only accept `'createdAt'`. The API validation schemas have also been updated to reject invalid orderBy values at runtime.
|
|
38
|
+
|
|
39
|
+
- Support new Workflow tripwire run status. Tripwires that are thrown from within a workflow will now bubble up and return a graceful state with information about tripwires. ([#10947](https://github.com/mastra-ai/mastra/pull/10947))
|
|
40
|
+
|
|
41
|
+
When a workflow contains an agent step that triggers a tripwire, the workflow returns with `status: 'tripwire'` and includes tripwire details:
|
|
42
|
+
|
|
43
|
+
```typescript showLineNumbers copy
|
|
44
|
+
const run = await workflow.createRun();
|
|
45
|
+
const result = await run.start({ inputData: { message: 'Hello' } });
|
|
46
|
+
|
|
47
|
+
if (result.status === 'tripwire') {
|
|
48
|
+
console.log('Workflow terminated by tripwire:', result.tripwire?.reason);
|
|
49
|
+
console.log('Processor ID:', result.tripwire?.processorId);
|
|
50
|
+
console.log('Retry requested:', result.tripwire?.retry);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Adds new UI state for tripwire in agent chat and workflow UI.
|
|
55
|
+
|
|
56
|
+
This is distinct from `status: 'failed'` which indicates an unexpected error. A tripwire status means a processor intentionally stopped execution (e.g., for content moderation).
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [[`38380b6`](https://github.com/mastra-ai/mastra/commit/38380b60fca905824bdf6b43df307a58efb1aa15), [`798d0c7`](https://github.com/mastra-ai/mastra/commit/798d0c740232653b1d754870e6b43a55c364ffe2), [`ffe84d5`](https://github.com/mastra-ai/mastra/commit/ffe84d54f3b0f85167fe977efd027dba027eb998), [`2c212e7`](https://github.com/mastra-ai/mastra/commit/2c212e704c90e2db83d4109e62c03f0f6ebd2667), [`4ca4306`](https://github.com/mastra-ai/mastra/commit/4ca430614daa5fa04730205a302a43bf4accfe9f), [`3bf6c5f`](https://github.com/mastra-ai/mastra/commit/3bf6c5f104c25226cd84e0c77f9dec15f2cac2db)]:
|
|
59
|
+
- @mastra/core@1.0.0-beta.11
|
|
60
|
+
|
|
3
61
|
## 1.0.0-beta.10
|
|
4
62
|
|
|
5
63
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -23,12 +23,12 @@ import { mastra } from './mastra-instance';
|
|
|
23
23
|
|
|
24
24
|
const app = new Hono();
|
|
25
25
|
|
|
26
|
-
app.get('/mastra/agents', ctx => handlers.agents.listAgentsHandler({ mastra,
|
|
26
|
+
app.get('/mastra/agents', ctx => handlers.agents.listAgentsHandler({ mastra, requestContext: ctx }));
|
|
27
27
|
app.post('/mastra/agents/:id/generate', async ctx => {
|
|
28
28
|
const body = await ctx.req.json();
|
|
29
29
|
return handlers.agents.generateHandler({
|
|
30
30
|
mastra,
|
|
31
|
-
|
|
31
|
+
requestContext: ctx,
|
|
32
32
|
agentId: ctx.req.param('id'),
|
|
33
33
|
body,
|
|
34
34
|
});
|
|
@@ -56,7 +56,8 @@ function getWorkflowInfo(workflow, partial = false) {
|
|
|
56
56
|
stepGraph: workflow.serializedStepGraph,
|
|
57
57
|
inputSchema: workflow.inputSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(workflow.inputSchema)) : void 0,
|
|
58
58
|
outputSchema: workflow.outputSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(workflow.outputSchema)) : void 0,
|
|
59
|
-
options: workflow.options
|
|
59
|
+
options: workflow.options,
|
|
60
|
+
isProcessorWorkflow: workflow.type === "processor"
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
var WorkflowRegistry = class {
|
|
@@ -143,5 +144,5 @@ function convertInstructionsToString(message) {
|
|
|
143
144
|
exports.WorkflowRegistry = WorkflowRegistry;
|
|
144
145
|
exports.convertInstructionsToString = convertInstructionsToString;
|
|
145
146
|
exports.getWorkflowInfo = getWorkflowInfo;
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
147
|
-
//# sourceMappingURL=chunk-
|
|
147
|
+
//# sourceMappingURL=chunk-3XI22UQR.cjs.map
|
|
148
|
+
//# sourceMappingURL=chunk-3XI22UQR.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/utils.ts"],"names":["stringify","zodToJsonSchema"],"mappings":";;;;;AAMA,SAAS,QAAA,CAAS,OAA0C,IAAA,EAAe;AACzE,EAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,CAAE,MAAA,CAAY,CAAC,GAAA,EAAK,CAAC,GAAA,EAAK,IAAI,CAAA,KAAM;AAC7D,IAAA,MAAM,UAAU,IAAA,GAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA,GAAK,GAAA;AAC1C,IAAA,GAAA,CAAI,OAAO,CAAA,GAAI;AAAA,MACb,IAAI,IAAA,CAAK,EAAA;AAAA,MACT,aAAa,IAAA,CAAK,WAAA;AAAA,MAClB,WAAA,EAAa,KAAK,WAAA,GAAcA,2BAAA,CAAUC,0BAAgB,IAAA,CAAK,WAAW,CAAC,CAAA,GAAI,MAAA;AAAA,MAC/E,YAAA,EAAc,KAAK,YAAA,GAAeD,2BAAA,CAAUC,0BAAgB,IAAA,CAAK,YAAY,CAAC,CAAA,GAAI,MAAA;AAAA,MAClF,YAAA,EAAc,KAAK,YAAA,GAAeD,2BAAA,CAAUC,0BAAgB,IAAA,CAAK,YAAY,CAAC,CAAA,GAAI,MAAA;AAAA,MAClF,aAAA,EAAe,KAAK,aAAA,GAAgBD,2BAAA,CAAUC,0BAAgB,IAAA,CAAK,aAAa,CAAC,CAAA,GAAI,MAAA;AAAA,MACrF,UAAA,EAAY,KAAK,SAAA,KAAc,UAAA;AAA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,EAAS;AACZ,IAAA,OAAO,EAAA;AAAA,EACT;AAEA,EAAA,IAAI,OAAO,YAAY,QAAA,EAAU;AAC/B,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,OAAO,CAAA,EAAG;AAC1B,IAAA,OAAO,OAAA,CACJ,IAAI,CAAA,CAAA,KAAK;AACR,MAAA,IAAI,OAAO,MAAM,QAAA,EAAU;AACzB,QAAA,OAAO,CAAA;AAAA,MACT;AAEA,MAAA,OAAO,OAAO,CAAA,CAAE,OAAA,KAAY,QAAA,GAAW,EAAE,OAAA,GAAU,EAAA;AAAA,IACrD,CAAC,CAAA,CACA,MAAA,CAAO,aAAW,OAAO,CAAA,CACzB,KAAK,IAAI,CAAA;AAAA,EACd;AAGA,EAAA,OAAO,OAAO,OAAA,CAAQ,OAAA,KAAY,QAAA,GAAW,QAAQ,OAAA,GAAU,EAAA;AACjE","file":"chunk-3XI22UQR.cjs","sourcesContent":["import type { Mastra } from '@mastra/core';\nimport type { SystemMessage } from '@mastra/core/llm';\nimport { zodToJsonSchema } from '@mastra/core/utils/zod-to-json';\nimport type { StepWithComponent, Workflow, WorkflowInfo } from '@mastra/core/workflows';\nimport { stringify } from 'superjson';\n\nfunction getSteps(steps: Record<string, StepWithComponent>, path?: string) {\n return Object.entries(steps).reduce<any>((acc, [key, step]) => {\n const fullKey = path ? `${path}.${key}` : key;\n acc[fullKey] = {\n id: step.id,\n description: step.description,\n inputSchema: step.inputSchema ? stringify(zodToJsonSchema(step.inputSchema)) : undefined,\n outputSchema: step.outputSchema ? stringify(zodToJsonSchema(step.outputSchema)) : undefined,\n resumeSchema: step.resumeSchema ? stringify(zodToJsonSchema(step.resumeSchema)) : undefined,\n suspendSchema: step.suspendSchema ? stringify(zodToJsonSchema(step.suspendSchema)) : undefined,\n isWorkflow: step.component === 'WORKFLOW',\n component: step.component,\n };\n\n if (step.component === 'WORKFLOW' && step.steps) {\n const nestedSteps = getSteps(step.steps, fullKey) || {};\n acc = { ...acc, ...nestedSteps };\n }\n\n return acc;\n }, {});\n}\n\nexport function getWorkflowInfo(workflow: Workflow, partial: boolean = false): WorkflowInfo {\n if (partial) {\n // Return minimal info in partial mode\n return {\n name: workflow.name,\n description: workflow.description,\n stepCount: Object.keys(workflow.steps).length,\n stepGraph: workflow.serializedStepGraph,\n options: workflow.options,\n steps: {},\n allSteps: {},\n inputSchema: undefined,\n outputSchema: undefined,\n } as WorkflowInfo;\n }\n\n return {\n name: workflow.name,\n description: workflow.description,\n steps: Object.entries(workflow.steps).reduce<any>((acc, [key, step]) => {\n acc[key] = {\n id: step.id,\n description: step.description,\n inputSchema: step.inputSchema ? stringify(zodToJsonSchema(step.inputSchema)) : undefined,\n outputSchema: step.outputSchema ? stringify(zodToJsonSchema(step.outputSchema)) : undefined,\n resumeSchema: step.resumeSchema ? stringify(zodToJsonSchema(step.resumeSchema)) : undefined,\n suspendSchema: step.suspendSchema ? stringify(zodToJsonSchema(step.suspendSchema)) : undefined,\n component: step.component,\n };\n return acc;\n }, {}),\n allSteps: getSteps(workflow.steps) || {},\n stepGraph: workflow.serializedStepGraph,\n inputSchema: workflow.inputSchema ? stringify(zodToJsonSchema(workflow.inputSchema)) : undefined,\n outputSchema: workflow.outputSchema ? stringify(zodToJsonSchema(workflow.outputSchema)) : undefined,\n options: workflow.options,\n isProcessorWorkflow: workflow.type === 'processor',\n };\n}\n\n/**\n * Workflow Registry for temporarily registering additional workflows\n * that are not part of the user's Mastra instance (e.g., internal template workflows)\n */\nexport class WorkflowRegistry {\n private static additionalWorkflows: Record<string, Workflow> = {};\n\n /**\n * Register a workflow temporarily\n */\n static registerTemporaryWorkflow(id: string, workflow: Workflow): void {\n this.additionalWorkflows[id] = workflow;\n }\n\n /**\n * Register all workflows from map\n */\n static registerTemporaryWorkflows(\n workflows: Record<string, Workflow>,\n mastra?: Mastra<any, any, any, any, any, any, any, any, any>,\n ): void {\n for (const [id, workflow] of Object.entries(workflows)) {\n // Register Mastra instance with the workflow if provided\n if (mastra) {\n workflow.__registerMastra(mastra);\n workflow.__registerPrimitives({\n logger: mastra.getLogger(),\n storage: mastra.getStorage(),\n agents: mastra.listAgents(),\n tts: mastra.getTTS(),\n vectors: mastra.listVectors(),\n });\n }\n this.additionalWorkflows[id] = workflow;\n }\n }\n\n /**\n * Get a workflow by ID from the registry (returns undefined if not found)\n */\n static getWorkflow(workflowId: string): Workflow | undefined {\n return this.additionalWorkflows[workflowId];\n }\n\n /**\n * Get all workflows from the registry\n */\n static getAllWorkflows(): Record<string, Workflow> {\n return { ...this.additionalWorkflows };\n }\n\n /**\n * Clean up a temporary workflow\n */\n static cleanupTemporaryWorkflow(workflowId: string): void {\n delete this.additionalWorkflows[workflowId];\n }\n /**\n * Clean up all registered workflows\n */\n static cleanup(): void {\n // Clear all workflows (since we register all agent-builder workflows each time)\n this.additionalWorkflows = {};\n }\n\n /**\n * Check if a workflow ID is a valid agent-builder workflow\n */\n static isAgentBuilderWorkflow(workflowId: string): boolean {\n return workflowId in this.additionalWorkflows;\n }\n\n /**\n * Get all registered temporary workflow IDs (for debugging)\n */\n static getRegisteredWorkflowIds(): string[] {\n return Object.keys(this.additionalWorkflows);\n }\n}\n\nexport function convertInstructionsToString(message: SystemMessage): string {\n if (!message) {\n return '';\n }\n\n if (typeof message === 'string') {\n return message;\n }\n\n if (Array.isArray(message)) {\n return message\n .map(m => {\n if (typeof m === 'string') {\n return m;\n }\n // Safely extract content from message objects\n return typeof m.content === 'string' ? m.content : '';\n })\n .filter(content => content) // Remove empty strings\n .join('\\n');\n }\n\n // Handle single message object - safely extract content\n return typeof message.content === 'string' ? message.content : '';\n}\n"]}
|