@mastra/core 1.2.1-alpha.0 → 1.3.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/CHANGELOG.md +341 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +2093 -262
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts +12 -3
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/index.cjs +18 -18
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/message-list.d.ts.map +1 -1
- package/dist/agent/types.d.ts +6 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts +3 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts +3 -1
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
- package/dist/base.cjs +2 -2
- package/dist/base.d.ts +13 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/cache/index.cjs +3 -3
- package/dist/cache/index.js +1 -1
- package/dist/{chunk-ENCTSDWC.js → chunk-2GWTJFVM.js} +2410 -1402
- package/dist/chunk-2GWTJFVM.js.map +1 -0
- package/dist/{chunk-OB4V67IX.cjs → chunk-2K5PNW2U.cjs} +4 -4
- package/dist/{chunk-OB4V67IX.cjs.map → chunk-2K5PNW2U.cjs.map} +1 -1
- package/dist/{chunk-VZXYBFCX.cjs → chunk-2P6DD7M5.cjs} +10 -10
- package/dist/{chunk-VZXYBFCX.cjs.map → chunk-2P6DD7M5.cjs.map} +1 -1
- package/dist/{chunk-Q2D7LERO.cjs → chunk-2VD5OGOT.cjs} +4 -4
- package/dist/{chunk-Q2D7LERO.cjs.map → chunk-2VD5OGOT.cjs.map} +1 -1
- package/dist/{chunk-2DMSFLJY.cjs → chunk-6TZKQI4R.cjs} +8 -8
- package/dist/chunk-6TZKQI4R.cjs.map +1 -0
- package/dist/{chunk-4NG7CKEG.js → chunk-6VGCVSP4.js} +3 -3
- package/dist/{chunk-4NG7CKEG.js.map → chunk-6VGCVSP4.js.map} +1 -1
- package/dist/{chunk-IIZF4W7B.cjs → chunk-7UWHFWST.cjs} +52 -5
- package/dist/chunk-7UWHFWST.cjs.map +1 -0
- package/dist/{chunk-VW7YQWDW.cjs → chunk-BFIOQFGF.cjs} +28 -2
- package/dist/chunk-BFIOQFGF.cjs.map +1 -0
- package/dist/{chunk-E3VFKTIA.js → chunk-BXLLXTT4.js} +2245 -179
- package/dist/chunk-BXLLXTT4.js.map +1 -0
- package/dist/{chunk-HMCXNOF6.cjs → chunk-CGPH7CMG.cjs} +2431 -1417
- package/dist/chunk-CGPH7CMG.cjs.map +1 -0
- package/dist/{chunk-GVLPTDJA.cjs → chunk-D5JZT6EK.cjs} +236 -63
- package/dist/chunk-D5JZT6EK.cjs.map +1 -0
- package/dist/{chunk-5SOS47PH.cjs → chunk-FLHFB23E.cjs} +454 -222
- package/dist/chunk-FLHFB23E.cjs.map +1 -0
- package/dist/{chunk-XCPEEIHI.cjs → chunk-GCTAD6B7.cjs} +3012 -927
- package/dist/chunk-GCTAD6B7.cjs.map +1 -0
- package/dist/{chunk-W3AQUG66.js → chunk-GIY5BINT.js} +4 -4
- package/dist/{chunk-W3AQUG66.js.map → chunk-GIY5BINT.js.map} +1 -1
- package/dist/{chunk-M6VFJX5A.js → chunk-GMSAGYTB.js} +3 -3
- package/dist/{chunk-M6VFJX5A.js.map → chunk-GMSAGYTB.js.map} +1 -1
- package/dist/{chunk-JRJJ5VQE.cjs → chunk-GZD6443M.cjs} +99 -55
- package/dist/chunk-GZD6443M.cjs.map +1 -0
- package/dist/{chunk-Z6NRYYOH.js → chunk-ILQXPZCD.js} +9 -4
- package/dist/chunk-ILQXPZCD.js.map +1 -0
- package/dist/{chunk-5YVR7B4R.js → chunk-JQNREL64.js} +29 -9
- package/dist/chunk-JQNREL64.js.map +1 -0
- package/dist/{chunk-QOFI2WBM.cjs → chunk-JU6K7UDX.cjs} +991 -229
- package/dist/chunk-JU6K7UDX.cjs.map +1 -0
- package/dist/{chunk-HN2MSTR6.cjs → chunk-KAJNBNWP.cjs} +283 -38
- package/dist/chunk-KAJNBNWP.cjs.map +1 -0
- package/dist/{chunk-MSWXEOZC.js → chunk-KL2JPSRX.js} +5 -5
- package/dist/chunk-KL2JPSRX.js.map +1 -0
- package/dist/{chunk-MQB7XFXP.js → chunk-LHRHOPUC.js} +3 -3
- package/dist/{chunk-MQB7XFXP.js.map → chunk-LHRHOPUC.js.map} +1 -1
- package/dist/{chunk-VX7UA3SO.js → chunk-MOOJ3H3C.js} +974 -217
- package/dist/chunk-MOOJ3H3C.js.map +1 -0
- package/dist/{chunk-HU2ONA2W.cjs → chunk-ON2KVIUJ.cjs} +17 -17
- package/dist/{chunk-HU2ONA2W.cjs.map → chunk-ON2KVIUJ.cjs.map} +1 -1
- package/dist/{chunk-I66TMZJ3.cjs → chunk-OOCEAC6U.cjs} +21 -18
- package/dist/chunk-OOCEAC6U.cjs.map +1 -0
- package/dist/{chunk-MNWW2R3U.js → chunk-OV7OOUUR.js} +90 -54
- package/dist/chunk-OV7OOUUR.js.map +1 -0
- package/dist/{chunk-C4WWWQHT.cjs → chunk-RO47SMI7.cjs} +23 -3
- package/dist/chunk-RO47SMI7.cjs.map +1 -0
- package/dist/{chunk-6FG6FU5Y.cjs → chunk-RQ56ZSIR.cjs} +4 -4
- package/dist/{chunk-6FG6FU5Y.cjs.map → chunk-RQ56ZSIR.cjs.map} +1 -1
- package/dist/{chunk-IW3BNL7A.js → chunk-RS6CZXGA.js} +50 -3
- package/dist/chunk-RS6CZXGA.js.map +1 -0
- package/dist/{chunk-AIJLACR2.js → chunk-S53FKKVL.js} +27 -3
- package/dist/chunk-S53FKKVL.js.map +1 -0
- package/dist/{chunk-G6E3QNJC.js → chunk-SBPPGJL6.js} +4078 -4333
- package/dist/chunk-SBPPGJL6.js.map +1 -0
- package/dist/{chunk-UZL4H5P2.cjs → chunk-SH4PCZ3X.cjs} +5375 -5648
- package/dist/chunk-SH4PCZ3X.cjs.map +1 -0
- package/dist/{chunk-ZWM2CAIM.js → chunk-STKNQDVA.js} +4 -4
- package/dist/{chunk-ZWM2CAIM.js.map → chunk-STKNQDVA.js.map} +1 -1
- package/dist/{chunk-A5QFWX67.cjs → chunk-U2CABSMC.cjs} +79 -59
- package/dist/chunk-U2CABSMC.cjs.map +1 -0
- package/dist/{chunk-7MDVYPWX.cjs → chunk-UE2G2LRP.cjs} +9 -4
- package/dist/chunk-UE2G2LRP.cjs.map +1 -0
- package/dist/{chunk-AUF6U2BL.js → chunk-VM25PDSW.js} +5 -5
- package/dist/{chunk-AUF6U2BL.js.map → chunk-VM25PDSW.js.map} +1 -1
- package/dist/{chunk-RXD5EGQF.js → chunk-VVD56FI4.js} +228 -55
- package/dist/chunk-VVD56FI4.js.map +1 -0
- package/dist/{chunk-JIT2OY3X.js → chunk-WCAFTXGK.js} +23 -3
- package/dist/chunk-WCAFTXGK.js.map +1 -0
- package/dist/{chunk-P62OJXQ4.js → chunk-WL3AW3YA.js} +282 -37
- package/dist/chunk-WL3AW3YA.js.map +1 -0
- package/dist/{chunk-YLODOPYM.cjs → chunk-XDD5V446.cjs} +4163 -5352
- package/dist/chunk-XDD5V446.cjs.map +1 -0
- package/dist/{chunk-B4M33FCS.cjs → chunk-XQVYEOI7.cjs} +7 -7
- package/dist/{chunk-B4M33FCS.cjs.map → chunk-XQVYEOI7.cjs.map} +1 -1
- package/dist/{chunk-BP2TSCBW.js → chunk-ZATLLPIH.js} +4391 -5561
- package/dist/chunk-ZATLLPIH.js.map +1 -0
- package/dist/{chunk-T6PRRKMW.js → chunk-ZHFM7HCQ.js} +9 -6
- package/dist/chunk-ZHFM7HCQ.js.map +1 -0
- package/dist/{chunk-WFUNLRQX.js → chunk-ZRUTE56J.js} +366 -134
- package/dist/chunk-ZRUTE56J.js.map +1 -0
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.js +1 -1
- package/dist/docs/SKILL.md +2 -9
- package/dist/docs/assets/SOURCE_MAP.json +399 -342
- package/dist/docs/references/docs-agents-agent-memory.md +45 -1
- package/dist/docs/references/docs-agents-network-approval.md +1 -1
- package/dist/docs/references/docs-agents-networks.md +3 -3
- package/dist/docs/references/docs-agents-overview.md +8 -0
- package/dist/docs/references/docs-agents-using-tools.md +82 -72
- package/dist/docs/references/docs-memory-observational-memory.md +11 -8
- package/dist/docs/references/docs-observability-overview.md +1 -1
- package/dist/docs/references/docs-observability-tracing-exporters-langsmith.md +70 -0
- package/dist/docs/references/docs-observability-tracing-overview.md +1 -1
- package/dist/docs/references/docs-server-middleware.md +0 -2
- package/dist/docs/references/docs-server-request-context.md +17 -0
- package/dist/docs/references/docs-workflows-agents-and-tools.md +2 -2
- package/dist/docs/references/docs-workflows-overview.md +1 -1
- package/dist/docs/references/docs-workspace-filesystem.md +2 -0
- package/dist/docs/references/docs-workspace-overview.md +3 -1
- package/dist/docs/references/docs-workspace-sandbox.md +2 -0
- package/dist/docs/references/docs-workspace-search.md +2 -0
- package/dist/docs/references/docs-workspace-skills.md +3 -1
- package/dist/docs/references/reference-agents-getTools.md +1 -6
- package/dist/docs/references/reference-agents-listAgents.md +1 -1
- package/dist/docs/references/reference-agents-network.md +0 -2
- package/dist/docs/references/reference-cli-mastra.md +29 -4
- package/dist/docs/references/reference-client-js-agents.md +1 -1
- package/dist/docs/references/reference-configuration.md +1 -1
- package/dist/docs/references/reference-core-getStoredAgentById.md +2 -2
- package/dist/docs/references/reference-core-listStoredAgents.md +1 -1
- package/dist/docs/references/reference-memory-observational-memory.md +2 -0
- package/dist/docs/references/reference-tools-mcp-client.md +0 -2
- package/dist/docs/references/reference-workflows-step.md +2 -0
- package/dist/docs/references/reference-workflows-workflow-methods-map.md +2 -2
- package/dist/docs/references/reference-workspace-filesystem.md +2 -0
- package/dist/docs/references/reference-workspace-local-filesystem.md +2 -0
- package/dist/docs/references/reference-workspace-local-sandbox.md +2 -0
- package/dist/docs/references/reference-workspace-sandbox.md +2 -0
- package/dist/docs/references/reference-workspace-workspace-class.md +2 -0
- package/dist/docs/references/reference.md +7 -2
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/types.d.ts +53 -48
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/evals/base.d.ts +15 -0
- package/dist/evals/base.d.ts.map +1 -1
- package/dist/evals/index.cjs +20 -20
- package/dist/evals/index.js +3 -3
- package/dist/evals/run/index.d.ts +3 -3
- package/dist/evals/run/index.d.ts.map +1 -1
- package/dist/evals/scoreTraces/index.cjs +5 -5
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/features/index.cjs +1 -1
- package/dist/features/index.cjs.map +1 -1
- package/dist/features/index.d.ts.map +1 -1
- package/dist/features/index.js +1 -1
- package/dist/features/index.js.map +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/integration/index.cjs +2 -2
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.cjs +16 -16
- package/dist/llm/index.js +5 -5
- package/dist/llm/model/gateways/constants.d.ts.map +1 -1
- package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts +1 -1
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +128 -10
- package/dist/llm/model/resolve-model.d.ts.map +1 -1
- package/dist/loop/index.cjs +12 -12
- package/dist/loop/index.js +1 -1
- package/dist/loop/network/index.d.ts +3 -3
- package/dist/loop/network/index.d.ts.map +1 -1
- package/dist/loop/network/run-command-tool.d.ts +1 -1
- package/dist/loop/types.d.ts +13 -0
- package/dist/loop/types.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/index.d.ts +9 -9
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +7 -7
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +3 -3
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts +9 -9
- package/dist/loop/workflows/schema.d.ts +12 -12
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts +91 -5
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +2 -2
- package/dist/mcp/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/memory/mock.d.ts.map +1 -1
- package/dist/memory/types.d.ts +128 -0
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/models-dev-FQVUTQ7L.js +3 -0
- package/dist/{models-dev-Z45JSLWD.js.map → models-dev-FQVUTQ7L.js.map} +1 -1
- package/dist/models-dev-PPIXUUCU.cjs +12 -0
- package/dist/{models-dev-OQKVMEIT.cjs.map → models-dev-PPIXUUCU.cjs.map} +1 -1
- package/dist/netlify-4RIKF7Y3.js +3 -0
- package/dist/{netlify-SSWMYSAX.js.map → netlify-4RIKF7Y3.js.map} +1 -1
- package/dist/netlify-V5F7JEJH.cjs +12 -0
- package/dist/{netlify-TXZZCT6N.cjs.map → netlify-V5F7JEJH.cjs.map} +1 -1
- package/dist/processors/index.cjs +41 -41
- package/dist/processors/index.js +1 -1
- package/dist/processors/step-schema.d.ts +44 -44
- package/dist/provider-registry-C6XCYX44.cjs +40 -0
- package/dist/{provider-registry-NR7FXV2Q.cjs.map → provider-registry-C6XCYX44.cjs.map} +1 -1
- package/dist/provider-registry-NWU4YFQW.js +3 -0
- package/dist/{provider-registry-RPOTQNHI.js.map → provider-registry-NWU4YFQW.js.map} +1 -1
- package/dist/provider-registry.json +278 -33
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +3 -3
- package/dist/server/index.js +1 -1
- package/dist/storage/base.d.ts +3 -1
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/constants.cjs +51 -19
- package/dist/storage/constants.d.ts +10 -2
- package/dist/storage/constants.d.ts.map +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/agents/base.d.ts +13 -164
- package/dist/storage/domains/agents/base.d.ts.map +1 -1
- package/dist/storage/domains/agents/index.d.ts +0 -1
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/agents/inmemory.d.ts +6 -10
- package/dist/storage/domains/agents/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/index.d.ts +3 -0
- package/dist/storage/domains/index.d.ts.map +1 -1
- package/dist/storage/domains/inmemory-db.d.ts +7 -1
- package/dist/storage/domains/inmemory-db.d.ts.map +1 -1
- package/dist/storage/domains/memory/base.d.ts +45 -5
- package/dist/storage/domains/memory/base.d.ts.map +1 -1
- package/dist/storage/domains/memory/inmemory.d.ts +7 -7
- package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/observability/types.d.ts +62 -62
- package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/prompt-blocks/base.d.ts +47 -0
- package/dist/storage/domains/prompt-blocks/base.d.ts.map +1 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts +3 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -0
- package/dist/storage/domains/prompt-blocks/inmemory.d.ts +31 -0
- package/dist/storage/domains/prompt-blocks/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/scorer-definitions/base.d.ts +47 -0
- package/dist/storage/domains/scorer-definitions/base.d.ts.map +1 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts +3 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -0
- package/dist/storage/domains/scorer-definitions/inmemory.d.ts +31 -0
- package/dist/storage/domains/scorer-definitions/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/versioned.d.ts +136 -0
- package/dist/storage/domains/versioned.d.ts.map +1 -0
- package/dist/storage/index.cjs +156 -104
- package/dist/storage/index.js +2 -2
- package/dist/storage/mock.d.ts.map +1 -1
- package/dist/storage/types.d.ts +481 -27
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/stream/MastraAgentNetworkStream.d.ts +1 -1
- package/dist/stream/MastraWorkflowStream.d.ts +1 -1
- package/dist/stream/RunOutput.d.ts +1 -1
- package/dist/stream/RunOutput.d.ts.map +1 -1
- package/dist/stream/base/output.d.ts +4 -0
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/index.cjs +11 -11
- package/dist/stream/index.js +2 -2
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.js +1 -1
- package/dist/tools/is-vercel-tool.cjs +2 -2
- package/dist/tools/is-vercel-tool.js +1 -1
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/tools/types.d.ts +15 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/validation.d.ts.map +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/types/zod-compat.d.ts +2 -2
- package/dist/types/zod-compat.d.ts.map +1 -1
- package/dist/utils/zod-utils.d.ts +19 -0
- package/dist/utils/zod-utils.d.ts.map +1 -1
- package/dist/utils.cjs +28 -28
- package/dist/utils.d.ts +7 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/vector/index.cjs +9 -9
- package/dist/vector/index.js +2 -2
- package/dist/voice/index.cjs +6 -6
- package/dist/voice/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/evented/step-executor.d.ts.map +1 -1
- package/dist/workflows/evented/workflow.d.ts +3 -1
- package/dist/workflows/evented/workflow.d.ts.map +1 -1
- package/dist/workflows/execution-engine.d.ts.map +1 -1
- package/dist/workflows/index.cjs +25 -25
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/step.d.ts +4 -3
- package/dist/workflows/step.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +2 -1
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +12 -4
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/dist/workspace/errors.d.ts +6 -0
- package/dist/workspace/errors.d.ts.map +1 -1
- package/dist/workspace/filesystem/composite-filesystem.d.ts +93 -0
- package/dist/workspace/filesystem/composite-filesystem.d.ts.map +1 -0
- package/dist/workspace/filesystem/filesystem.d.ts +35 -0
- package/dist/workspace/filesystem/filesystem.d.ts.map +1 -1
- package/dist/workspace/filesystem/index.d.ts +2 -0
- package/dist/workspace/filesystem/index.d.ts.map +1 -1
- package/dist/workspace/filesystem/local-filesystem.d.ts +9 -1
- package/dist/workspace/filesystem/local-filesystem.d.ts.map +1 -1
- package/dist/workspace/filesystem/mastra-filesystem.d.ts +92 -3
- package/dist/workspace/filesystem/mastra-filesystem.d.ts.map +1 -1
- package/dist/workspace/filesystem/mount.d.ts +34 -0
- package/dist/workspace/filesystem/mount.d.ts.map +1 -0
- package/dist/workspace/index.cjs +62 -34
- package/dist/workspace/index.d.ts +6 -2
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/lifecycle.d.ts +29 -0
- package/dist/workspace/lifecycle.d.ts.map +1 -1
- package/dist/workspace/sandbox/errors.d.ts +50 -0
- package/dist/workspace/sandbox/errors.d.ts.map +1 -0
- package/dist/workspace/sandbox/index.d.ts +3 -0
- package/dist/workspace/sandbox/index.d.ts.map +1 -1
- package/dist/workspace/sandbox/local-sandbox.d.ts +17 -2
- package/dist/workspace/sandbox/local-sandbox.d.ts.map +1 -1
- package/dist/workspace/sandbox/mastra-sandbox.d.ts +153 -6
- package/dist/workspace/sandbox/mastra-sandbox.d.ts.map +1 -1
- package/dist/workspace/sandbox/mount-manager.d.ts +195 -0
- package/dist/workspace/sandbox/mount-manager.d.ts.map +1 -0
- package/dist/workspace/sandbox/sandbox.d.ts +37 -84
- package/dist/workspace/sandbox/sandbox.d.ts.map +1 -1
- package/dist/workspace/sandbox/types.d.ts +92 -0
- package/dist/workspace/sandbox/types.d.ts.map +1 -0
- package/dist/workspace/tools/tools.d.ts.map +1 -1
- package/dist/workspace/tools/tree-formatter.d.ts.map +1 -1
- package/dist/workspace/workspace.d.ts +73 -3
- package/dist/workspace/workspace.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/llm/model/provider-types.generated.d.ts +128 -10
- package/dist/chunk-2DMSFLJY.cjs.map +0 -1
- package/dist/chunk-5SOS47PH.cjs.map +0 -1
- package/dist/chunk-5YVR7B4R.js.map +0 -1
- package/dist/chunk-7MDVYPWX.cjs.map +0 -1
- package/dist/chunk-A5QFWX67.cjs.map +0 -1
- package/dist/chunk-AIJLACR2.js.map +0 -1
- package/dist/chunk-BP2TSCBW.js.map +0 -1
- package/dist/chunk-C4WWWQHT.cjs.map +0 -1
- package/dist/chunk-E3VFKTIA.js.map +0 -1
- package/dist/chunk-ENCTSDWC.js.map +0 -1
- package/dist/chunk-G6E3QNJC.js.map +0 -1
- package/dist/chunk-GVLPTDJA.cjs.map +0 -1
- package/dist/chunk-HMCXNOF6.cjs.map +0 -1
- package/dist/chunk-HN2MSTR6.cjs.map +0 -1
- package/dist/chunk-I66TMZJ3.cjs.map +0 -1
- package/dist/chunk-IIZF4W7B.cjs.map +0 -1
- package/dist/chunk-IW3BNL7A.js.map +0 -1
- package/dist/chunk-JIT2OY3X.js.map +0 -1
- package/dist/chunk-JRJJ5VQE.cjs.map +0 -1
- package/dist/chunk-MNWW2R3U.js.map +0 -1
- package/dist/chunk-MSWXEOZC.js.map +0 -1
- package/dist/chunk-P62OJXQ4.js.map +0 -1
- package/dist/chunk-QOFI2WBM.cjs.map +0 -1
- package/dist/chunk-RXD5EGQF.js.map +0 -1
- package/dist/chunk-T6PRRKMW.js.map +0 -1
- package/dist/chunk-UZL4H5P2.cjs.map +0 -1
- package/dist/chunk-VW7YQWDW.cjs.map +0 -1
- package/dist/chunk-VX7UA3SO.js.map +0 -1
- package/dist/chunk-WFUNLRQX.js.map +0 -1
- package/dist/chunk-XCPEEIHI.cjs.map +0 -1
- package/dist/chunk-YLODOPYM.cjs.map +0 -1
- package/dist/chunk-Z6NRYYOH.js.map +0 -1
- package/dist/docs/references/docs-tools-mcp-advanced-usage.md +0 -143
- package/dist/docs/references/docs-tools-mcp-mcp-overview.md +0 -383
- package/dist/docs/references/docs-tools-mcp-overview.md +0 -78
- package/dist/docs/references/docs-workflows-input-data-mapping.md +0 -102
- package/dist/docs/references/reference-deployer-netlify.md +0 -14
- package/dist/docs/references/reference-deployer-vercel.md +0 -39
- package/dist/docs/references/reference-tools-client.md +0 -228
- package/dist/models-dev-OQKVMEIT.cjs +0 -12
- package/dist/models-dev-Z45JSLWD.js +0 -3
- package/dist/netlify-SSWMYSAX.js +0 -3
- package/dist/netlify-TXZZCT6N.cjs +0 -12
- package/dist/provider-registry-NR7FXV2Q.cjs +0 -40
- package/dist/provider-registry-RPOTQNHI.js +0 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkUE2G2LRP_cjs = require('./chunk-UE2G2LRP.cjs');
|
|
4
|
+
var chunkGZD6443M_cjs = require('./chunk-GZD6443M.cjs');
|
|
5
|
+
var chunkOOCEAC6U_cjs = require('./chunk-OOCEAC6U.cjs');
|
|
6
6
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkRO47SMI7_cjs = require('./chunk-RO47SMI7.cjs');
|
|
8
8
|
|
|
9
9
|
// src/storage/base.ts
|
|
10
10
|
function normalizePerPage(perPageInput, defaultValue) {
|
|
@@ -25,7 +25,7 @@ function calculatePagination(page, perPageInput, normalizedPerPage) {
|
|
|
25
25
|
perPage: perPageInput === false ? false : normalizedPerPage
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
var MastraCompositeStore = class extends
|
|
28
|
+
var MastraCompositeStore = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
29
29
|
hasInitialized = null;
|
|
30
30
|
shouldCacheInit = true;
|
|
31
31
|
id;
|
|
@@ -60,7 +60,9 @@ var MastraCompositeStore = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
60
60
|
workflows: domainOverrides.workflows ?? defaultStores?.workflows,
|
|
61
61
|
scores: domainOverrides.scores ?? defaultStores?.scores,
|
|
62
62
|
observability: domainOverrides.observability ?? defaultStores?.observability,
|
|
63
|
-
agents: domainOverrides.agents ?? defaultStores?.agents
|
|
63
|
+
agents: domainOverrides.agents ?? defaultStores?.agents,
|
|
64
|
+
promptBlocks: domainOverrides.promptBlocks ?? defaultStores?.promptBlocks,
|
|
65
|
+
scorerDefinitions: domainOverrides.scorerDefinitions ?? defaultStores?.scorerDefinitions
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
}
|
|
@@ -105,6 +107,12 @@ var MastraCompositeStore = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
105
107
|
if (this.stores?.agents) {
|
|
106
108
|
initTasks.push(this.stores.agents.init());
|
|
107
109
|
}
|
|
110
|
+
if (this.stores?.promptBlocks) {
|
|
111
|
+
initTasks.push(this.stores.promptBlocks.init());
|
|
112
|
+
}
|
|
113
|
+
if (this.stores?.scorerDefinitions) {
|
|
114
|
+
initTasks.push(this.stores.scorerDefinitions.init());
|
|
115
|
+
}
|
|
108
116
|
this.hasInitialized = Promise.all(initTasks).then(() => true);
|
|
109
117
|
await this.hasInitialized;
|
|
110
118
|
}
|
|
@@ -113,7 +121,7 @@ var MastraStorage = class extends MastraCompositeStore {
|
|
|
113
121
|
};
|
|
114
122
|
|
|
115
123
|
// src/storage/domains/base.ts
|
|
116
|
-
var StorageDomain = class extends
|
|
124
|
+
var StorageDomain = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
117
125
|
/**
|
|
118
126
|
* Initialize the storage domain.
|
|
119
127
|
* This should create any necessary tables/collections.
|
|
@@ -123,12 +131,12 @@ var StorageDomain = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
123
131
|
}
|
|
124
132
|
};
|
|
125
133
|
|
|
126
|
-
// src/storage/domains/
|
|
127
|
-
var
|
|
134
|
+
// src/storage/domains/versioned.ts
|
|
135
|
+
var ENTITY_ORDER_BY_SET = {
|
|
128
136
|
createdAt: true,
|
|
129
137
|
updatedAt: true
|
|
130
138
|
};
|
|
131
|
-
var
|
|
139
|
+
var SORT_DIRECTION_SET = {
|
|
132
140
|
ASC: true,
|
|
133
141
|
DESC: true
|
|
134
142
|
};
|
|
@@ -136,119 +144,106 @@ var VERSION_ORDER_BY_SET = {
|
|
|
136
144
|
versionNumber: true,
|
|
137
145
|
createdAt: true
|
|
138
146
|
};
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
147
|
+
var VersionedStorageDomain = class extends StorageDomain {
|
|
148
|
+
// ==========================================================================
|
|
149
|
+
// Concrete resolution methods
|
|
150
|
+
// ==========================================================================
|
|
151
|
+
/**
|
|
152
|
+
* Strips version metadata fields from a version row, leaving only snapshot config fields.
|
|
153
|
+
*/
|
|
154
|
+
extractSnapshotConfig(version) {
|
|
155
|
+
const result = {};
|
|
156
|
+
const metadataSet = new Set(this.versionMetadataFields);
|
|
157
|
+
for (const [key, value] of Object.entries(version)) {
|
|
158
|
+
if (!metadataSet.has(key)) {
|
|
159
|
+
result[key] = value;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
145
163
|
}
|
|
146
164
|
/**
|
|
147
|
-
*
|
|
148
|
-
* This is the preferred method for fetching stored agents as it ensures the returned
|
|
149
|
-
* configuration matches the active version.
|
|
150
|
-
*
|
|
151
|
-
* @param id - The unique identifier of the agent
|
|
152
|
-
* @returns The resolved agent (metadata + version config), or null if not found
|
|
165
|
+
* Resolves an entity by merging its thin record with the active (or latest) version config.
|
|
153
166
|
*/
|
|
154
|
-
async
|
|
155
|
-
const
|
|
156
|
-
if (!
|
|
167
|
+
async getByIdResolved(id) {
|
|
168
|
+
const entity = await this.getById(id);
|
|
169
|
+
if (!entity) {
|
|
157
170
|
return null;
|
|
158
171
|
}
|
|
172
|
+
return this.resolveEntity(entity);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Lists entities with version resolution.
|
|
176
|
+
*/
|
|
177
|
+
async listResolved(args) {
|
|
178
|
+
const result = await this.list(args);
|
|
179
|
+
const entities = result[this.listKey];
|
|
180
|
+
const resolved = await Promise.all(entities.map((entity) => this.resolveEntity(entity)));
|
|
181
|
+
return {
|
|
182
|
+
...result,
|
|
183
|
+
[this.listKey]: resolved
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Resolves a single entity by merging it with its active or latest version.
|
|
188
|
+
*/
|
|
189
|
+
async resolveEntity(entity) {
|
|
159
190
|
let version = null;
|
|
160
|
-
if (
|
|
161
|
-
version = await this.getVersion(
|
|
191
|
+
if (entity.activeVersionId) {
|
|
192
|
+
version = await this.getVersion(entity.activeVersionId);
|
|
162
193
|
if (!version) {
|
|
163
|
-
|
|
164
|
-
`
|
|
194
|
+
this.logger?.warn?.(
|
|
195
|
+
`Entity ${entity.id} has activeVersionId ${entity.activeVersionId} but version not found. Falling back to latest version.`
|
|
165
196
|
);
|
|
166
197
|
}
|
|
167
198
|
}
|
|
168
199
|
if (!version) {
|
|
169
|
-
version = await this.getLatestVersion(
|
|
200
|
+
version = await this.getLatestVersion(entity.id);
|
|
170
201
|
}
|
|
171
202
|
if (version) {
|
|
172
|
-
const
|
|
173
|
-
id: _versionId,
|
|
174
|
-
agentId: _agentId,
|
|
175
|
-
versionNumber: _versionNumber,
|
|
176
|
-
changedFields: _changedFields,
|
|
177
|
-
changeMessage: _changeMessage,
|
|
178
|
-
createdAt: _createdAt,
|
|
179
|
-
...snapshotConfig
|
|
180
|
-
} = version;
|
|
203
|
+
const snapshotConfig = this.extractSnapshotConfig(version);
|
|
181
204
|
return {
|
|
182
|
-
...
|
|
205
|
+
...entity,
|
|
183
206
|
...snapshotConfig
|
|
184
207
|
};
|
|
185
208
|
}
|
|
186
|
-
return
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Lists all agents with version resolution.
|
|
190
|
-
* For each agent that has an activeVersionId, the config is resolved from the version.
|
|
191
|
-
*
|
|
192
|
-
* @param args - Pagination and ordering options
|
|
193
|
-
* @returns Paginated list of resolved agents
|
|
194
|
-
*/
|
|
195
|
-
async listAgentsResolved(args) {
|
|
196
|
-
const result = await this.listAgents(args);
|
|
197
|
-
const resolvedAgents = await Promise.all(
|
|
198
|
-
result.agents.map(async (agent) => {
|
|
199
|
-
let version = null;
|
|
200
|
-
if (agent.activeVersionId) {
|
|
201
|
-
version = await this.getVersion(agent.activeVersionId);
|
|
202
|
-
}
|
|
203
|
-
if (!version) {
|
|
204
|
-
version = await this.getLatestVersion(agent.id);
|
|
205
|
-
}
|
|
206
|
-
if (version) {
|
|
207
|
-
const {
|
|
208
|
-
id: _versionId,
|
|
209
|
-
agentId: _agentId,
|
|
210
|
-
versionNumber: _versionNumber,
|
|
211
|
-
changedFields: _changedFields,
|
|
212
|
-
changeMessage: _changeMessage,
|
|
213
|
-
createdAt: _createdAt,
|
|
214
|
-
...snapshotConfig
|
|
215
|
-
} = version;
|
|
216
|
-
return {
|
|
217
|
-
...agent,
|
|
218
|
-
...snapshotConfig
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
return agent;
|
|
222
|
-
})
|
|
223
|
-
);
|
|
224
|
-
return {
|
|
225
|
-
...result,
|
|
226
|
-
agents: resolvedAgents
|
|
227
|
-
};
|
|
209
|
+
return entity;
|
|
228
210
|
}
|
|
229
211
|
// ==========================================================================
|
|
230
212
|
// Protected Helper Methods
|
|
231
213
|
// ==========================================================================
|
|
232
|
-
/**
|
|
233
|
-
* Parses orderBy input for consistent agent sorting behavior.
|
|
234
|
-
*/
|
|
235
214
|
parseOrderBy(orderBy, defaultDirection = "DESC") {
|
|
236
215
|
return {
|
|
237
|
-
field: orderBy?.field && orderBy.field in
|
|
238
|
-
direction: orderBy?.direction && orderBy.direction in
|
|
216
|
+
field: orderBy?.field && orderBy.field in ENTITY_ORDER_BY_SET ? orderBy.field : "createdAt",
|
|
217
|
+
direction: orderBy?.direction && orderBy.direction in SORT_DIRECTION_SET ? orderBy.direction : defaultDirection
|
|
239
218
|
};
|
|
240
219
|
}
|
|
241
|
-
/**
|
|
242
|
-
* Parses orderBy input for consistent version sorting behavior.
|
|
243
|
-
*/
|
|
244
220
|
parseVersionOrderBy(orderBy, defaultDirection = "DESC") {
|
|
245
221
|
return {
|
|
246
222
|
field: orderBy?.field && orderBy.field in VERSION_ORDER_BY_SET ? orderBy.field : "versionNumber",
|
|
247
|
-
direction: orderBy?.direction && orderBy.direction in
|
|
223
|
+
direction: orderBy?.direction && orderBy.direction in SORT_DIRECTION_SET ? orderBy.direction : defaultDirection
|
|
248
224
|
};
|
|
249
225
|
}
|
|
250
226
|
};
|
|
251
227
|
|
|
228
|
+
// src/storage/domains/agents/base.ts
|
|
229
|
+
var AgentsStorage = class extends VersionedStorageDomain {
|
|
230
|
+
listKey = "agents";
|
|
231
|
+
versionMetadataFields = [
|
|
232
|
+
"id",
|
|
233
|
+
"agentId",
|
|
234
|
+
"versionNumber",
|
|
235
|
+
"changedFields",
|
|
236
|
+
"changeMessage",
|
|
237
|
+
"createdAt"
|
|
238
|
+
];
|
|
239
|
+
constructor() {
|
|
240
|
+
super({
|
|
241
|
+
component: "STORAGE",
|
|
242
|
+
name: "AGENTS"
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
252
247
|
// src/storage/domains/agents/inmemory.ts
|
|
253
248
|
var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
254
249
|
db;
|
|
@@ -263,13 +258,14 @@ var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
|
263
258
|
// ==========================================================================
|
|
264
259
|
// Agent CRUD Methods
|
|
265
260
|
// ==========================================================================
|
|
266
|
-
async
|
|
267
|
-
this.logger.debug(`InMemoryAgentsStorage:
|
|
261
|
+
async getById(id) {
|
|
262
|
+
this.logger.debug(`InMemoryAgentsStorage: getById called for ${id}`);
|
|
268
263
|
const agent = this.db.agents.get(id);
|
|
269
264
|
return agent ? this.deepCopyAgent(agent) : null;
|
|
270
265
|
}
|
|
271
|
-
async
|
|
272
|
-
|
|
266
|
+
async create(input) {
|
|
267
|
+
const { agent } = input;
|
|
268
|
+
this.logger.debug(`InMemoryAgentsStorage: create called for ${agent.id}`);
|
|
273
269
|
if (this.db.agents.has(agent.id)) {
|
|
274
270
|
throw new Error(`Agent with id ${agent.id} already exists`);
|
|
275
271
|
}
|
|
@@ -296,8 +292,9 @@ var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
|
296
292
|
});
|
|
297
293
|
return this.deepCopyAgent(newAgent);
|
|
298
294
|
}
|
|
299
|
-
async
|
|
300
|
-
|
|
295
|
+
async update(input) {
|
|
296
|
+
const { id, ...updates } = input;
|
|
297
|
+
this.logger.debug(`InMemoryAgentsStorage: update called for ${id}`);
|
|
301
298
|
const existingAgent = this.db.agents.get(id);
|
|
302
299
|
if (!existingAgent) {
|
|
303
300
|
throw new Error(`Agent with id ${id} not found`);
|
|
@@ -345,36 +342,41 @@ var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
|
345
342
|
createdAt: _createdAt,
|
|
346
343
|
...latestConfig
|
|
347
344
|
} = latestVersion;
|
|
345
|
+
const sanitizedConfigFields = Object.fromEntries(
|
|
346
|
+
Object.entries(configFields).map(([key, value]) => [key, value === null ? void 0 : value])
|
|
347
|
+
);
|
|
348
348
|
const newConfig = {
|
|
349
349
|
...latestConfig,
|
|
350
|
-
...
|
|
350
|
+
...sanitizedConfigFields
|
|
351
351
|
};
|
|
352
352
|
const changedFields = configFieldNames.filter(
|
|
353
|
-
(field) => field in configFields && configFields[field] !== latestConfig[field]
|
|
353
|
+
(field) => field in configFields && JSON.stringify(configFields[field]) !== JSON.stringify(latestConfig[field])
|
|
354
354
|
);
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
355
|
+
if (changedFields.length > 0) {
|
|
356
|
+
const newVersionId = crypto.randomUUID();
|
|
357
|
+
const newVersionNumber = latestVersion.versionNumber + 1;
|
|
358
|
+
await this.createVersion({
|
|
359
|
+
id: newVersionId,
|
|
360
|
+
agentId: id,
|
|
361
|
+
versionNumber: newVersionNumber,
|
|
362
|
+
...newConfig,
|
|
363
|
+
changedFields,
|
|
364
|
+
changeMessage: `Updated ${changedFields.join(", ")}`
|
|
365
|
+
});
|
|
366
|
+
}
|
|
365
367
|
}
|
|
366
368
|
this.db.agents.set(id, updatedAgent);
|
|
367
369
|
return this.deepCopyAgent(updatedAgent);
|
|
368
370
|
}
|
|
369
|
-
async
|
|
370
|
-
this.logger.debug(`InMemoryAgentsStorage:
|
|
371
|
+
async delete(id) {
|
|
372
|
+
this.logger.debug(`InMemoryAgentsStorage: delete called for ${id}`);
|
|
371
373
|
this.db.agents.delete(id);
|
|
372
|
-
await this.
|
|
374
|
+
await this.deleteVersionsByParentId(id);
|
|
373
375
|
}
|
|
374
|
-
async
|
|
376
|
+
async list(args) {
|
|
375
377
|
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata } = args || {};
|
|
376
378
|
const { field, direction } = this.parseOrderBy(orderBy);
|
|
377
|
-
this.logger.debug(`InMemoryAgentsStorage:
|
|
379
|
+
this.logger.debug(`InMemoryAgentsStorage: list called`);
|
|
378
380
|
const perPage = normalizePerPage(perPageInput, 100);
|
|
379
381
|
if (page < 0) {
|
|
380
382
|
throw new Error("page must be >= 0");
|
|
@@ -390,7 +392,7 @@ var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
|
390
392
|
if (metadata && Object.keys(metadata).length > 0) {
|
|
391
393
|
agents = agents.filter((agent) => {
|
|
392
394
|
if (!agent.metadata) return false;
|
|
393
|
-
return Object.entries(metadata).every(([key, value]) =>
|
|
395
|
+
return Object.entries(metadata).every(([key, value]) => chunkOOCEAC6U_cjs.deepEqual(agent.metadata[key], value));
|
|
394
396
|
});
|
|
395
397
|
}
|
|
396
398
|
const sortedAgents = this.sortAgents(agents, field, direction);
|
|
@@ -480,11 +482,11 @@ var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
|
480
482
|
this.logger.debug(`InMemoryAgentsStorage: deleteVersion called for ${id}`);
|
|
481
483
|
this.db.agentVersions.delete(id);
|
|
482
484
|
}
|
|
483
|
-
async
|
|
484
|
-
this.logger.debug(`InMemoryAgentsStorage:
|
|
485
|
+
async deleteVersionsByParentId(entityId) {
|
|
486
|
+
this.logger.debug(`InMemoryAgentsStorage: deleteVersionsByParentId called for agent ${entityId}`);
|
|
485
487
|
const idsToDelete = [];
|
|
486
488
|
for (const [id, version] of this.db.agentVersions.entries()) {
|
|
487
|
-
if (version.agentId ===
|
|
489
|
+
if (version.agentId === entityId) {
|
|
488
490
|
idsToDelete.push(id);
|
|
489
491
|
}
|
|
490
492
|
}
|
|
@@ -518,20 +520,7 @@ var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
|
518
520
|
* Deep copy a version to prevent external mutation of stored data
|
|
519
521
|
*/
|
|
520
522
|
deepCopyVersion(version) {
|
|
521
|
-
return
|
|
522
|
-
...version,
|
|
523
|
-
model: { ...version.model },
|
|
524
|
-
tools: version.tools ? [...version.tools] : version.tools,
|
|
525
|
-
defaultOptions: version.defaultOptions ? { ...version.defaultOptions } : version.defaultOptions,
|
|
526
|
-
workflows: version.workflows ? [...version.workflows] : version.workflows,
|
|
527
|
-
agents: version.agents ? [...version.agents] : version.agents,
|
|
528
|
-
integrationTools: version.integrationTools ? [...version.integrationTools] : version.integrationTools,
|
|
529
|
-
inputProcessors: version.inputProcessors ? [...version.inputProcessors] : version.inputProcessors,
|
|
530
|
-
outputProcessors: version.outputProcessors ? [...version.outputProcessors] : version.outputProcessors,
|
|
531
|
-
memory: version.memory ? { ...version.memory } : version.memory,
|
|
532
|
-
scorers: version.scorers ? { ...version.scorers } : version.scorers,
|
|
533
|
-
changedFields: version.changedFields ? [...version.changedFields] : version.changedFields
|
|
534
|
-
};
|
|
523
|
+
return structuredClone(version);
|
|
535
524
|
}
|
|
536
525
|
sortAgents(agents, field, direction) {
|
|
537
526
|
return agents.sort((a, b) => {
|
|
@@ -566,6 +555,10 @@ var InMemoryDB = class {
|
|
|
566
555
|
traces = /* @__PURE__ */ new Map();
|
|
567
556
|
agents = /* @__PURE__ */ new Map();
|
|
568
557
|
agentVersions = /* @__PURE__ */ new Map();
|
|
558
|
+
promptBlocks = /* @__PURE__ */ new Map();
|
|
559
|
+
promptBlockVersions = /* @__PURE__ */ new Map();
|
|
560
|
+
scorerDefinitions = /* @__PURE__ */ new Map();
|
|
561
|
+
scorerDefinitionVersions = /* @__PURE__ */ new Map();
|
|
569
562
|
/** Observational memory records, keyed by resourceId, each holding array of records (generations) */
|
|
570
563
|
observationalMemory = /* @__PURE__ */ new Map();
|
|
571
564
|
/**
|
|
@@ -581,6 +574,10 @@ var InMemoryDB = class {
|
|
|
581
574
|
this.traces.clear();
|
|
582
575
|
this.agents.clear();
|
|
583
576
|
this.agentVersions.clear();
|
|
577
|
+
this.promptBlocks.clear();
|
|
578
|
+
this.promptBlockVersions.clear();
|
|
579
|
+
this.scorerDefinitions.clear();
|
|
580
|
+
this.scorerDefinitionVersions.clear();
|
|
584
581
|
this.observationalMemory.clear();
|
|
585
582
|
}
|
|
586
583
|
};
|
|
@@ -600,7 +597,7 @@ function safelyParseJSON(input) {
|
|
|
600
597
|
}
|
|
601
598
|
function transformRow(row, tableName, options = {}) {
|
|
602
599
|
const { preferredTimestampFields = {}, convertTimestamps = false, nullValuePattern, fieldMappings = {} } = options;
|
|
603
|
-
const tableSchema =
|
|
600
|
+
const tableSchema = chunkGZD6443M_cjs.TABLE_SCHEMAS[tableName];
|
|
604
601
|
const result = {};
|
|
605
602
|
for (const [key, columnSchema] of Object.entries(tableSchema)) {
|
|
606
603
|
const sourceKey = fieldMappings[key] ?? key;
|
|
@@ -631,7 +628,7 @@ function transformRow(row, tableName, options = {}) {
|
|
|
631
628
|
return result;
|
|
632
629
|
}
|
|
633
630
|
function transformScoreRow(row, options = {}) {
|
|
634
|
-
return transformRow(row,
|
|
631
|
+
return transformRow(row, chunkGZD6443M_cjs.TABLE_SCORERS, options);
|
|
635
632
|
}
|
|
636
633
|
function toUpperSnakeCase(str) {
|
|
637
634
|
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").toUpperCase().replace(/[^A-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
@@ -849,40 +846,29 @@ var MemoryStorage = class extends StorageDomain {
|
|
|
849
846
|
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
850
847
|
}
|
|
851
848
|
// ============================================
|
|
852
|
-
// Buffering Methods (
|
|
853
|
-
// These methods
|
|
854
|
-
// which has been disabled. Keeping commented for future reference.
|
|
849
|
+
// Buffering Methods (for async observation/reflection)
|
|
850
|
+
// These methods support async buffering when `bufferTokens` is configured.
|
|
855
851
|
// ============================================
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
// async markMessagesAsBuffering(_id: string, _messageIds: string[]): Promise<void> {
|
|
877
|
-
// throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
878
|
-
// }
|
|
879
|
-
// /**
|
|
880
|
-
// * Mark messages as buffered (observation complete but not active).
|
|
881
|
-
// * Moves messageIds from bufferingMessageIds → bufferedMessageIds.
|
|
882
|
-
// */
|
|
883
|
-
// async markMessagesAsBuffered(_id: string, _messageIds: string[]): Promise<void> {
|
|
884
|
-
// throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
885
|
-
// }
|
|
852
|
+
/**
|
|
853
|
+
* Update buffered observations.
|
|
854
|
+
* Called when observations are created asynchronously via `bufferTokens`.
|
|
855
|
+
*/
|
|
856
|
+
async updateBufferedObservations(_input) {
|
|
857
|
+
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Swap buffered observations to active.
|
|
861
|
+
* Atomic operation that:
|
|
862
|
+
* 1. Appends bufferedObservations → activeObservations (based on activationRatio)
|
|
863
|
+
* 2. Moves activated bufferedMessageIds → observedMessageIds
|
|
864
|
+
* 3. Keeps remaining buffered content if activationRatio < 100
|
|
865
|
+
* 4. Updates lastObservedAt
|
|
866
|
+
*
|
|
867
|
+
* Returns info about what was activated for UI feedback.
|
|
868
|
+
*/
|
|
869
|
+
async swapBufferedToActive(_input) {
|
|
870
|
+
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
871
|
+
}
|
|
886
872
|
/**
|
|
887
873
|
* Create a new generation from a reflection.
|
|
888
874
|
* Creates a new record with:
|
|
@@ -893,19 +879,21 @@ var MemoryStorage = class extends StorageDomain {
|
|
|
893
879
|
async createReflectionGeneration(_input) {
|
|
894
880
|
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
895
881
|
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
882
|
+
/**
|
|
883
|
+
* Update buffered reflection (async reflection in progress).
|
|
884
|
+
* Called when reflection runs asynchronously via `bufferTokens`.
|
|
885
|
+
*/
|
|
886
|
+
async updateBufferedReflection(_input) {
|
|
887
|
+
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Swap buffered reflection to active observations.
|
|
891
|
+
* Creates a new generation where activeObservations = bufferedReflection + unreflected observations.
|
|
892
|
+
* The `tokenCount` in input is the processor-computed token count for the combined content.
|
|
893
|
+
*/
|
|
894
|
+
async swapBufferedReflectionToActive(_input) {
|
|
895
|
+
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
896
|
+
}
|
|
909
897
|
/**
|
|
910
898
|
* Set the isReflecting flag.
|
|
911
899
|
*/
|
|
@@ -918,6 +906,23 @@ var MemoryStorage = class extends StorageDomain {
|
|
|
918
906
|
async setObservingFlag(_id, _isObserving) {
|
|
919
907
|
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
920
908
|
}
|
|
909
|
+
/**
|
|
910
|
+
* Set the isBufferingObservation flag and update lastBufferedAtTokens.
|
|
911
|
+
* Called when async observation buffering starts (true) or ends/fails (false).
|
|
912
|
+
* @param id - Record ID
|
|
913
|
+
* @param isBuffering - Whether buffering is in progress
|
|
914
|
+
* @param lastBufferedAtTokens - The pending token count at which this buffer was triggered (only set when isBuffering=true)
|
|
915
|
+
*/
|
|
916
|
+
async setBufferingObservationFlag(_id, _isBuffering, _lastBufferedAtTokens) {
|
|
917
|
+
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Set the isBufferingReflection flag.
|
|
921
|
+
* Called when async reflection buffering starts (true) or ends/fails (false).
|
|
922
|
+
*/
|
|
923
|
+
async setBufferingReflectionFlag(_id, _isBuffering) {
|
|
924
|
+
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
925
|
+
}
|
|
921
926
|
/**
|
|
922
927
|
* Clear all observational memory for a thread/resource.
|
|
923
928
|
* Removes all records and history.
|
|
@@ -926,11 +931,11 @@ var MemoryStorage = class extends StorageDomain {
|
|
|
926
931
|
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
927
932
|
}
|
|
928
933
|
/**
|
|
929
|
-
*
|
|
930
|
-
* Called
|
|
931
|
-
*
|
|
934
|
+
* Set the pending message token count.
|
|
935
|
+
* Called at the end of each OM processing step to persist the current
|
|
936
|
+
* context window token count so the UI can display it on page load.
|
|
932
937
|
*/
|
|
933
|
-
async
|
|
938
|
+
async setPendingMessageTokens(_id, _tokenCount) {
|
|
934
939
|
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
|
|
935
940
|
}
|
|
936
941
|
/**
|
|
@@ -1245,7 +1250,7 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
1245
1250
|
});
|
|
1246
1251
|
const total = messages.length;
|
|
1247
1252
|
const paginatedMessages = messages.slice(offset, offset + perPage);
|
|
1248
|
-
const list = new
|
|
1253
|
+
const list = new chunkUE2G2LRP_cjs.MessageList().add(
|
|
1249
1254
|
paginatedMessages.map((m) => this.parseStoredMessage(m)),
|
|
1250
1255
|
"memory"
|
|
1251
1256
|
);
|
|
@@ -1279,7 +1284,7 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
1279
1284
|
async listMessagesById({ messageIds }) {
|
|
1280
1285
|
this.logger.debug(`InMemoryMemory: listMessagesById called`);
|
|
1281
1286
|
const rawMessages = messageIds.map((id) => this.db.messages.get(id)).filter((message) => !!message);
|
|
1282
|
-
const list = new
|
|
1287
|
+
const list = new chunkUE2G2LRP_cjs.MessageList().add(
|
|
1283
1288
|
rawMessages.map((m) => this.parseStoredMessage(m)),
|
|
1284
1289
|
"memory"
|
|
1285
1290
|
);
|
|
@@ -1311,7 +1316,7 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
1311
1316
|
};
|
|
1312
1317
|
this.db.messages.set(key, storageMessage);
|
|
1313
1318
|
}
|
|
1314
|
-
const list = new
|
|
1319
|
+
const list = new chunkUE2G2LRP_cjs.MessageList().add(messages, "memory");
|
|
1315
1320
|
return { messages: list.get.all.db() };
|
|
1316
1321
|
}
|
|
1317
1322
|
async updateMessages(args) {
|
|
@@ -1615,6 +1620,10 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
1615
1620
|
// State flags
|
|
1616
1621
|
isReflecting: false,
|
|
1617
1622
|
isObserving: false,
|
|
1623
|
+
isBufferingObservation: false,
|
|
1624
|
+
isBufferingReflection: false,
|
|
1625
|
+
lastBufferedAtTokens: 0,
|
|
1626
|
+
lastBufferedAtTime: null,
|
|
1618
1627
|
// Configuration
|
|
1619
1628
|
config,
|
|
1620
1629
|
// Timezone used for observation date formatting
|
|
@@ -1643,46 +1652,114 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
1643
1652
|
}
|
|
1644
1653
|
}
|
|
1645
1654
|
async updateBufferedObservations(input) {
|
|
1646
|
-
const { id,
|
|
1655
|
+
const { id, chunk } = input;
|
|
1647
1656
|
const record = this.findObservationalMemoryRecordById(id);
|
|
1648
1657
|
if (!record) {
|
|
1649
1658
|
throw new Error(`Observational memory record not found: ${id}`);
|
|
1650
1659
|
}
|
|
1651
|
-
|
|
1660
|
+
const newChunk = {
|
|
1661
|
+
id: `ombuf-${crypto.randomUUID()}`,
|
|
1662
|
+
cycleId: chunk.cycleId,
|
|
1663
|
+
observations: chunk.observations,
|
|
1664
|
+
tokenCount: chunk.tokenCount,
|
|
1665
|
+
messageIds: chunk.messageIds,
|
|
1666
|
+
messageTokens: chunk.messageTokens,
|
|
1667
|
+
lastObservedAt: chunk.lastObservedAt,
|
|
1668
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
1669
|
+
suggestedContinuation: chunk.suggestedContinuation,
|
|
1670
|
+
currentTask: chunk.currentTask
|
|
1671
|
+
};
|
|
1672
|
+
const existingChunks = Array.isArray(record.bufferedObservationChunks) ? record.bufferedObservationChunks : [];
|
|
1673
|
+
record.bufferedObservationChunks = [...existingChunks, newChunk];
|
|
1674
|
+
if (input.lastBufferedAtTime) {
|
|
1675
|
+
record.lastBufferedAtTime = input.lastBufferedAtTime;
|
|
1676
|
+
}
|
|
1652
1677
|
record.updatedAt = /* @__PURE__ */ new Date();
|
|
1653
1678
|
}
|
|
1654
|
-
async swapBufferedToActive(
|
|
1679
|
+
async swapBufferedToActive(input) {
|
|
1680
|
+
const { id, activationRatio, lastObservedAt } = input;
|
|
1655
1681
|
const record = this.findObservationalMemoryRecordById(id);
|
|
1656
1682
|
if (!record) {
|
|
1657
1683
|
throw new Error(`Observational memory record not found: ${id}`);
|
|
1658
1684
|
}
|
|
1659
|
-
|
|
1660
|
-
|
|
1685
|
+
const chunks = Array.isArray(record.bufferedObservationChunks) ? record.bufferedObservationChunks : [];
|
|
1686
|
+
if (chunks.length === 0) {
|
|
1687
|
+
return {
|
|
1688
|
+
chunksActivated: 0,
|
|
1689
|
+
messageTokensActivated: 0,
|
|
1690
|
+
observationTokensActivated: 0,
|
|
1691
|
+
messagesActivated: 0,
|
|
1692
|
+
activatedCycleIds: [],
|
|
1693
|
+
activatedMessageIds: []
|
|
1694
|
+
};
|
|
1695
|
+
}
|
|
1696
|
+
const retentionFloor = input.messageTokensThreshold * (1 - activationRatio);
|
|
1697
|
+
const targetMessageTokens = Math.max(0, input.currentPendingTokens - retentionFloor);
|
|
1698
|
+
let cumulativeMessageTokens = 0;
|
|
1699
|
+
let bestBoundary = 0;
|
|
1700
|
+
let bestBoundaryMessageTokens = 0;
|
|
1701
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
1702
|
+
cumulativeMessageTokens += chunks[i].messageTokens ?? 0;
|
|
1703
|
+
const boundary = i + 1;
|
|
1704
|
+
const isUnder = cumulativeMessageTokens <= targetMessageTokens;
|
|
1705
|
+
const bestIsUnder = bestBoundaryMessageTokens <= targetMessageTokens;
|
|
1706
|
+
if (bestBoundary === 0) {
|
|
1707
|
+
bestBoundary = boundary;
|
|
1708
|
+
bestBoundaryMessageTokens = cumulativeMessageTokens;
|
|
1709
|
+
} else if (isUnder && !bestIsUnder) {
|
|
1710
|
+
bestBoundary = boundary;
|
|
1711
|
+
bestBoundaryMessageTokens = cumulativeMessageTokens;
|
|
1712
|
+
} else if (isUnder && bestIsUnder) {
|
|
1713
|
+
if (cumulativeMessageTokens > bestBoundaryMessageTokens) {
|
|
1714
|
+
bestBoundary = boundary;
|
|
1715
|
+
bestBoundaryMessageTokens = cumulativeMessageTokens;
|
|
1716
|
+
}
|
|
1717
|
+
} else if (!isUnder && !bestIsUnder) {
|
|
1718
|
+
if (cumulativeMessageTokens < bestBoundaryMessageTokens) {
|
|
1719
|
+
bestBoundary = boundary;
|
|
1720
|
+
bestBoundaryMessageTokens = cumulativeMessageTokens;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1661
1723
|
}
|
|
1724
|
+
const chunksToActivate = bestBoundary === 0 ? 1 : bestBoundary;
|
|
1725
|
+
const activatedChunks = chunks.slice(0, chunksToActivate);
|
|
1726
|
+
const remainingChunks = chunks.slice(chunksToActivate);
|
|
1727
|
+
const activatedContent = activatedChunks.map((c) => c.observations).join("\n\n");
|
|
1728
|
+
const activatedTokens = activatedChunks.reduce((sum, c) => sum + c.tokenCount, 0);
|
|
1729
|
+
const activatedMessageTokens = activatedChunks.reduce((sum, c) => sum + (c.messageTokens ?? 0), 0);
|
|
1730
|
+
const activatedMessageCount = activatedChunks.reduce((sum, c) => sum + c.messageIds.length, 0);
|
|
1731
|
+
const activatedCycleIds = activatedChunks.map((c) => c.cycleId).filter((id2) => !!id2);
|
|
1732
|
+
const activatedMessageIds = activatedChunks.flatMap((c) => c.messageIds);
|
|
1733
|
+
const latestChunk = activatedChunks[activatedChunks.length - 1];
|
|
1734
|
+
const derivedLastObservedAt = lastObservedAt ?? (latestChunk?.lastObservedAt ? new Date(latestChunk.lastObservedAt) : /* @__PURE__ */ new Date());
|
|
1662
1735
|
if (record.activeObservations) {
|
|
1663
1736
|
record.activeObservations = `${record.activeObservations}
|
|
1664
1737
|
|
|
1665
|
-
${
|
|
1738
|
+
${activatedContent}`;
|
|
1666
1739
|
} else {
|
|
1667
|
-
record.activeObservations =
|
|
1668
|
-
}
|
|
1669
|
-
record.bufferedObservations = void 0;
|
|
1670
|
-
record.lastObservedAt = /* @__PURE__ */ new Date();
|
|
1671
|
-
record.updatedAt = /* @__PURE__ */ new Date();
|
|
1672
|
-
}
|
|
1673
|
-
async markMessagesAsBuffering(id, _messageIds) {
|
|
1674
|
-
const record = this.findObservationalMemoryRecordById(id);
|
|
1675
|
-
if (!record) {
|
|
1676
|
-
throw new Error(`Observational memory record not found: ${id}`);
|
|
1677
|
-
}
|
|
1678
|
-
record.updatedAt = /* @__PURE__ */ new Date();
|
|
1679
|
-
}
|
|
1680
|
-
async markMessagesAsBuffered(id, _messageIds) {
|
|
1681
|
-
const record = this.findObservationalMemoryRecordById(id);
|
|
1682
|
-
if (!record) {
|
|
1683
|
-
throw new Error(`Observational memory record not found: ${id}`);
|
|
1740
|
+
record.activeObservations = activatedContent;
|
|
1684
1741
|
}
|
|
1742
|
+
record.observationTokenCount = (record.observationTokenCount ?? 0) + activatedTokens;
|
|
1743
|
+
record.pendingMessageTokens = Math.max(0, (record.pendingMessageTokens ?? 0) - activatedMessageTokens);
|
|
1744
|
+
record.bufferedObservationChunks = remainingChunks.length > 0 ? remainingChunks : void 0;
|
|
1745
|
+
record.lastObservedAt = derivedLastObservedAt;
|
|
1685
1746
|
record.updatedAt = /* @__PURE__ */ new Date();
|
|
1747
|
+
return {
|
|
1748
|
+
chunksActivated: activatedChunks.length,
|
|
1749
|
+
messageTokensActivated: activatedMessageTokens,
|
|
1750
|
+
observationTokensActivated: activatedTokens,
|
|
1751
|
+
messagesActivated: activatedMessageCount,
|
|
1752
|
+
activatedCycleIds,
|
|
1753
|
+
activatedMessageIds,
|
|
1754
|
+
observations: activatedContent,
|
|
1755
|
+
perChunk: activatedChunks.map((c) => ({
|
|
1756
|
+
cycleId: c.cycleId ?? "",
|
|
1757
|
+
messageTokens: c.messageTokens ?? 0,
|
|
1758
|
+
observationTokens: c.tokenCount,
|
|
1759
|
+
messageCount: c.messageIds.length,
|
|
1760
|
+
observations: c.observations
|
|
1761
|
+
}))
|
|
1762
|
+
};
|
|
1686
1763
|
}
|
|
1687
1764
|
async createReflectionGeneration(input) {
|
|
1688
1765
|
const { currentRecord, reflection, tokenCount } = input;
|
|
@@ -1707,6 +1784,10 @@ ${record.bufferedObservations}`;
|
|
|
1707
1784
|
pendingMessageTokens: 0,
|
|
1708
1785
|
isReflecting: false,
|
|
1709
1786
|
isObserving: false,
|
|
1787
|
+
isBufferingObservation: false,
|
|
1788
|
+
isBufferingReflection: false,
|
|
1789
|
+
lastBufferedAtTokens: 0,
|
|
1790
|
+
lastBufferedAtTime: null,
|
|
1710
1791
|
// Timezone used for observation date formatting
|
|
1711
1792
|
observedTimezone: currentRecord.observedTimezone,
|
|
1712
1793
|
// Extensible metadata (optional)
|
|
@@ -1716,29 +1797,48 @@ ${record.bufferedObservations}`;
|
|
|
1716
1797
|
this.db.observationalMemory.set(key, [newRecord, ...existing]);
|
|
1717
1798
|
return newRecord;
|
|
1718
1799
|
}
|
|
1719
|
-
async updateBufferedReflection(
|
|
1800
|
+
async updateBufferedReflection(input) {
|
|
1801
|
+
const { id, reflection, tokenCount, inputTokenCount, reflectedObservationLineCount } = input;
|
|
1720
1802
|
const record = this.findObservationalMemoryRecordById(id);
|
|
1721
1803
|
if (!record) {
|
|
1722
1804
|
throw new Error(`Observational memory record not found: ${id}`);
|
|
1723
1805
|
}
|
|
1724
|
-
record.bufferedReflection
|
|
1806
|
+
const existing = record.bufferedReflection || "";
|
|
1807
|
+
record.bufferedReflection = existing ? `${existing}
|
|
1808
|
+
|
|
1809
|
+
${reflection}` : reflection;
|
|
1810
|
+
record.bufferedReflectionTokens = (record.bufferedReflectionTokens || 0) + tokenCount;
|
|
1811
|
+
record.bufferedReflectionInputTokens = (record.bufferedReflectionInputTokens || 0) + inputTokenCount;
|
|
1812
|
+
record.reflectedObservationLineCount = reflectedObservationLineCount;
|
|
1725
1813
|
record.updatedAt = /* @__PURE__ */ new Date();
|
|
1726
1814
|
}
|
|
1727
|
-
async
|
|
1728
|
-
const
|
|
1815
|
+
async swapBufferedReflectionToActive(input) {
|
|
1816
|
+
const { currentRecord } = input;
|
|
1817
|
+
const record = this.findObservationalMemoryRecordById(currentRecord.id);
|
|
1729
1818
|
if (!record) {
|
|
1730
|
-
throw new Error(`Observational memory record not found: ${id}`);
|
|
1819
|
+
throw new Error(`Observational memory record not found: ${currentRecord.id}`);
|
|
1731
1820
|
}
|
|
1732
1821
|
if (!record.bufferedReflection) {
|
|
1733
1822
|
throw new Error("No buffered reflection to swap");
|
|
1734
1823
|
}
|
|
1824
|
+
const bufferedReflection = record.bufferedReflection;
|
|
1825
|
+
const reflectedLineCount = record.reflectedObservationLineCount ?? 0;
|
|
1826
|
+
const currentObservations = record.activeObservations ?? "";
|
|
1827
|
+
const allLines = currentObservations.split("\n");
|
|
1828
|
+
const unreflectedLines = allLines.slice(reflectedLineCount);
|
|
1829
|
+
const unreflectedContent = unreflectedLines.join("\n").trim();
|
|
1830
|
+
const newObservations = unreflectedContent ? `${bufferedReflection}
|
|
1831
|
+
|
|
1832
|
+
${unreflectedContent}` : bufferedReflection;
|
|
1735
1833
|
const newRecord = await this.createReflectionGeneration({
|
|
1736
1834
|
currentRecord: record,
|
|
1737
|
-
reflection:
|
|
1738
|
-
tokenCount:
|
|
1739
|
-
// Will be calculated by caller
|
|
1835
|
+
reflection: newObservations,
|
|
1836
|
+
tokenCount: input.tokenCount
|
|
1740
1837
|
});
|
|
1741
1838
|
record.bufferedReflection = void 0;
|
|
1839
|
+
record.bufferedReflectionTokens = void 0;
|
|
1840
|
+
record.bufferedReflectionInputTokens = void 0;
|
|
1841
|
+
record.reflectedObservationLineCount = void 0;
|
|
1742
1842
|
return newRecord;
|
|
1743
1843
|
}
|
|
1744
1844
|
async setReflectingFlag(id, isReflecting) {
|
|
@@ -1757,16 +1857,35 @@ ${record.bufferedObservations}`;
|
|
|
1757
1857
|
record.isObserving = isObserving;
|
|
1758
1858
|
record.updatedAt = /* @__PURE__ */ new Date();
|
|
1759
1859
|
}
|
|
1860
|
+
async setBufferingObservationFlag(id, isBuffering, lastBufferedAtTokens) {
|
|
1861
|
+
const record = this.findObservationalMemoryRecordById(id);
|
|
1862
|
+
if (!record) {
|
|
1863
|
+
throw new Error(`Observational memory record not found: ${id}`);
|
|
1864
|
+
}
|
|
1865
|
+
record.isBufferingObservation = isBuffering;
|
|
1866
|
+
if (lastBufferedAtTokens !== void 0) {
|
|
1867
|
+
record.lastBufferedAtTokens = lastBufferedAtTokens;
|
|
1868
|
+
}
|
|
1869
|
+
record.updatedAt = /* @__PURE__ */ new Date();
|
|
1870
|
+
}
|
|
1871
|
+
async setBufferingReflectionFlag(id, isBuffering) {
|
|
1872
|
+
const record = this.findObservationalMemoryRecordById(id);
|
|
1873
|
+
if (!record) {
|
|
1874
|
+
throw new Error(`Observational memory record not found: ${id}`);
|
|
1875
|
+
}
|
|
1876
|
+
record.isBufferingReflection = isBuffering;
|
|
1877
|
+
record.updatedAt = /* @__PURE__ */ new Date();
|
|
1878
|
+
}
|
|
1760
1879
|
async clearObservationalMemory(threadId, resourceId) {
|
|
1761
1880
|
const key = this.getObservationalMemoryKey(threadId, resourceId);
|
|
1762
1881
|
this.db.observationalMemory.delete(key);
|
|
1763
1882
|
}
|
|
1764
|
-
async
|
|
1883
|
+
async setPendingMessageTokens(id, tokenCount) {
|
|
1765
1884
|
const record = this.findObservationalMemoryRecordById(id);
|
|
1766
1885
|
if (!record) {
|
|
1767
1886
|
throw new Error(`Observational memory record not found: ${id}`);
|
|
1768
1887
|
}
|
|
1769
|
-
record.pendingMessageTokens =
|
|
1888
|
+
record.pendingMessageTokens = tokenCount;
|
|
1770
1889
|
record.updatedAt = /* @__PURE__ */ new Date();
|
|
1771
1890
|
}
|
|
1772
1891
|
/**
|
|
@@ -2038,7 +2157,7 @@ var ObservabilityInMemory = class extends ObservabilityStorage {
|
|
|
2038
2157
|
};
|
|
2039
2158
|
}
|
|
2040
2159
|
async listTraces(args) {
|
|
2041
|
-
const { filters, pagination, orderBy } =
|
|
2160
|
+
const { filters, pagination, orderBy } = chunkGZD6443M_cjs.listTracesArgsSchema.parse(args);
|
|
2042
2161
|
const matchingRootSpans = [];
|
|
2043
2162
|
for (const [, traceEntry] of this.db.traces) {
|
|
2044
2163
|
if (!traceEntry.rootSpan) continue;
|
|
@@ -2067,7 +2186,7 @@ var ObservabilityInMemory = class extends ObservabilityStorage {
|
|
|
2067
2186
|
const end = start + perPage;
|
|
2068
2187
|
const paged = matchingRootSpans.slice(start, end);
|
|
2069
2188
|
return {
|
|
2070
|
-
spans:
|
|
2189
|
+
spans: chunkGZD6443M_cjs.toTraceSpans(paged),
|
|
2071
2190
|
pagination: { total, page, perPage, hasMore: end < total }
|
|
2072
2191
|
};
|
|
2073
2192
|
}
|
|
@@ -2218,6 +2337,638 @@ var ObservabilityInMemory = class extends ObservabilityStorage {
|
|
|
2218
2337
|
}
|
|
2219
2338
|
};
|
|
2220
2339
|
|
|
2340
|
+
// src/storage/domains/prompt-blocks/base.ts
|
|
2341
|
+
var PromptBlocksStorage = class extends VersionedStorageDomain {
|
|
2342
|
+
listKey = "promptBlocks";
|
|
2343
|
+
versionMetadataFields = [
|
|
2344
|
+
"id",
|
|
2345
|
+
"blockId",
|
|
2346
|
+
"versionNumber",
|
|
2347
|
+
"changedFields",
|
|
2348
|
+
"changeMessage",
|
|
2349
|
+
"createdAt"
|
|
2350
|
+
];
|
|
2351
|
+
constructor() {
|
|
2352
|
+
super({
|
|
2353
|
+
component: "STORAGE",
|
|
2354
|
+
name: "PROMPT_BLOCKS"
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
};
|
|
2358
|
+
|
|
2359
|
+
// src/storage/domains/prompt-blocks/inmemory.ts
|
|
2360
|
+
var InMemoryPromptBlocksStorage = class extends PromptBlocksStorage {
|
|
2361
|
+
db;
|
|
2362
|
+
constructor({ db }) {
|
|
2363
|
+
super();
|
|
2364
|
+
this.db = db;
|
|
2365
|
+
}
|
|
2366
|
+
async dangerouslyClearAll() {
|
|
2367
|
+
this.db.promptBlocks.clear();
|
|
2368
|
+
this.db.promptBlockVersions.clear();
|
|
2369
|
+
}
|
|
2370
|
+
// ==========================================================================
|
|
2371
|
+
// Prompt Block CRUD Methods
|
|
2372
|
+
// ==========================================================================
|
|
2373
|
+
async getById(id) {
|
|
2374
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: getById called for ${id}`);
|
|
2375
|
+
const block = this.db.promptBlocks.get(id);
|
|
2376
|
+
return block ? this.deepCopyBlock(block) : null;
|
|
2377
|
+
}
|
|
2378
|
+
async create(input) {
|
|
2379
|
+
const { promptBlock } = input;
|
|
2380
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: create called for ${promptBlock.id}`);
|
|
2381
|
+
if (this.db.promptBlocks.has(promptBlock.id)) {
|
|
2382
|
+
throw new Error(`Prompt block with id ${promptBlock.id} already exists`);
|
|
2383
|
+
}
|
|
2384
|
+
const now = /* @__PURE__ */ new Date();
|
|
2385
|
+
const newBlock = {
|
|
2386
|
+
id: promptBlock.id,
|
|
2387
|
+
status: "draft",
|
|
2388
|
+
activeVersionId: void 0,
|
|
2389
|
+
authorId: promptBlock.authorId,
|
|
2390
|
+
metadata: promptBlock.metadata,
|
|
2391
|
+
createdAt: now,
|
|
2392
|
+
updatedAt: now
|
|
2393
|
+
};
|
|
2394
|
+
this.db.promptBlocks.set(promptBlock.id, newBlock);
|
|
2395
|
+
const { id: _id, authorId: _authorId, metadata: _metadata, ...snapshotConfig } = promptBlock;
|
|
2396
|
+
const versionId = crypto.randomUUID();
|
|
2397
|
+
await this.createVersion({
|
|
2398
|
+
id: versionId,
|
|
2399
|
+
blockId: promptBlock.id,
|
|
2400
|
+
versionNumber: 1,
|
|
2401
|
+
...snapshotConfig,
|
|
2402
|
+
changedFields: Object.keys(snapshotConfig),
|
|
2403
|
+
changeMessage: "Initial version"
|
|
2404
|
+
});
|
|
2405
|
+
return this.deepCopyBlock(newBlock);
|
|
2406
|
+
}
|
|
2407
|
+
async update(input) {
|
|
2408
|
+
const { id, ...updates } = input;
|
|
2409
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: update called for ${id}`);
|
|
2410
|
+
const existingBlock = this.db.promptBlocks.get(id);
|
|
2411
|
+
if (!existingBlock) {
|
|
2412
|
+
throw new Error(`Prompt block with id ${id} not found`);
|
|
2413
|
+
}
|
|
2414
|
+
const { authorId, activeVersionId, metadata, status, ...configFields } = updates;
|
|
2415
|
+
const configFieldNames = ["name", "description", "content", "rules"];
|
|
2416
|
+
const hasConfigUpdate = configFieldNames.some((field) => field in configFields);
|
|
2417
|
+
const updatedBlock = {
|
|
2418
|
+
...existingBlock,
|
|
2419
|
+
...authorId !== void 0 && { authorId },
|
|
2420
|
+
...activeVersionId !== void 0 && { activeVersionId },
|
|
2421
|
+
...status !== void 0 && { status },
|
|
2422
|
+
...metadata !== void 0 && {
|
|
2423
|
+
metadata: { ...existingBlock.metadata, ...metadata }
|
|
2424
|
+
},
|
|
2425
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
2426
|
+
};
|
|
2427
|
+
if (activeVersionId !== void 0) {
|
|
2428
|
+
updatedBlock.status = "published";
|
|
2429
|
+
}
|
|
2430
|
+
if (hasConfigUpdate) {
|
|
2431
|
+
const latestVersion = await this.getLatestVersion(id);
|
|
2432
|
+
if (!latestVersion) {
|
|
2433
|
+
throw new Error(`No versions found for prompt block ${id}`);
|
|
2434
|
+
}
|
|
2435
|
+
const {
|
|
2436
|
+
id: _versionId,
|
|
2437
|
+
blockId: _blockId,
|
|
2438
|
+
versionNumber: _versionNumber,
|
|
2439
|
+
changedFields: _changedFields,
|
|
2440
|
+
changeMessage: _changeMessage,
|
|
2441
|
+
createdAt: _createdAt,
|
|
2442
|
+
...latestConfig
|
|
2443
|
+
} = latestVersion;
|
|
2444
|
+
const newConfig = {
|
|
2445
|
+
...latestConfig,
|
|
2446
|
+
...configFields
|
|
2447
|
+
};
|
|
2448
|
+
const changedFields = configFieldNames.filter(
|
|
2449
|
+
(field) => field in configFields && JSON.stringify(configFields[field]) !== JSON.stringify(latestConfig[field])
|
|
2450
|
+
);
|
|
2451
|
+
if (changedFields.length > 0) {
|
|
2452
|
+
const newVersionId = crypto.randomUUID();
|
|
2453
|
+
const newVersionNumber = latestVersion.versionNumber + 1;
|
|
2454
|
+
await this.createVersion({
|
|
2455
|
+
id: newVersionId,
|
|
2456
|
+
blockId: id,
|
|
2457
|
+
versionNumber: newVersionNumber,
|
|
2458
|
+
...newConfig,
|
|
2459
|
+
changedFields,
|
|
2460
|
+
changeMessage: `Updated ${changedFields.join(", ")}`
|
|
2461
|
+
});
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
this.db.promptBlocks.set(id, updatedBlock);
|
|
2465
|
+
return this.deepCopyBlock(updatedBlock);
|
|
2466
|
+
}
|
|
2467
|
+
async delete(id) {
|
|
2468
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: delete called for ${id}`);
|
|
2469
|
+
this.db.promptBlocks.delete(id);
|
|
2470
|
+
await this.deleteVersionsByParentId(id);
|
|
2471
|
+
}
|
|
2472
|
+
async list(args) {
|
|
2473
|
+
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata } = args || {};
|
|
2474
|
+
const { field, direction } = this.parseOrderBy(orderBy);
|
|
2475
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: list called`);
|
|
2476
|
+
const perPage = normalizePerPage(perPageInput, 100);
|
|
2477
|
+
if (page < 0) {
|
|
2478
|
+
throw new Error("page must be >= 0");
|
|
2479
|
+
}
|
|
2480
|
+
const maxOffset = Number.MAX_SAFE_INTEGER / 2;
|
|
2481
|
+
if (page * perPage > maxOffset) {
|
|
2482
|
+
throw new Error("page value too large");
|
|
2483
|
+
}
|
|
2484
|
+
let blocks = Array.from(this.db.promptBlocks.values());
|
|
2485
|
+
if (authorId !== void 0) {
|
|
2486
|
+
blocks = blocks.filter((block) => block.authorId === authorId);
|
|
2487
|
+
}
|
|
2488
|
+
if (metadata && Object.keys(metadata).length > 0) {
|
|
2489
|
+
blocks = blocks.filter((block) => {
|
|
2490
|
+
if (!block.metadata) return false;
|
|
2491
|
+
return Object.entries(metadata).every(([key, value]) => chunkOOCEAC6U_cjs.deepEqual(block.metadata[key], value));
|
|
2492
|
+
});
|
|
2493
|
+
}
|
|
2494
|
+
const sortedBlocks = this.sortBlocks(blocks, field, direction);
|
|
2495
|
+
const clonedBlocks = sortedBlocks.map((block) => this.deepCopyBlock(block));
|
|
2496
|
+
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
2497
|
+
return {
|
|
2498
|
+
promptBlocks: clonedBlocks.slice(offset, offset + perPage),
|
|
2499
|
+
total: clonedBlocks.length,
|
|
2500
|
+
page,
|
|
2501
|
+
perPage: perPageForResponse,
|
|
2502
|
+
hasMore: offset + perPage < clonedBlocks.length
|
|
2503
|
+
};
|
|
2504
|
+
}
|
|
2505
|
+
// ==========================================================================
|
|
2506
|
+
// Prompt Block Version Methods
|
|
2507
|
+
// ==========================================================================
|
|
2508
|
+
async createVersion(input) {
|
|
2509
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: createVersion called for block ${input.blockId}`);
|
|
2510
|
+
if (this.db.promptBlockVersions.has(input.id)) {
|
|
2511
|
+
throw new Error(`Version with id ${input.id} already exists`);
|
|
2512
|
+
}
|
|
2513
|
+
for (const version2 of this.db.promptBlockVersions.values()) {
|
|
2514
|
+
if (version2.blockId === input.blockId && version2.versionNumber === input.versionNumber) {
|
|
2515
|
+
throw new Error(`Version number ${input.versionNumber} already exists for prompt block ${input.blockId}`);
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
const version = {
|
|
2519
|
+
...input,
|
|
2520
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
2521
|
+
};
|
|
2522
|
+
this.db.promptBlockVersions.set(input.id, this.deepCopyVersion(version));
|
|
2523
|
+
return this.deepCopyVersion(version);
|
|
2524
|
+
}
|
|
2525
|
+
async getVersion(id) {
|
|
2526
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: getVersion called for ${id}`);
|
|
2527
|
+
const version = this.db.promptBlockVersions.get(id);
|
|
2528
|
+
return version ? this.deepCopyVersion(version) : null;
|
|
2529
|
+
}
|
|
2530
|
+
async getVersionByNumber(blockId, versionNumber) {
|
|
2531
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: getVersionByNumber called for block ${blockId}, v${versionNumber}`);
|
|
2532
|
+
for (const version of this.db.promptBlockVersions.values()) {
|
|
2533
|
+
if (version.blockId === blockId && version.versionNumber === versionNumber) {
|
|
2534
|
+
return this.deepCopyVersion(version);
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
return null;
|
|
2538
|
+
}
|
|
2539
|
+
async getLatestVersion(blockId) {
|
|
2540
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: getLatestVersion called for block ${blockId}`);
|
|
2541
|
+
let latest = null;
|
|
2542
|
+
for (const version of this.db.promptBlockVersions.values()) {
|
|
2543
|
+
if (version.blockId === blockId) {
|
|
2544
|
+
if (!latest || version.versionNumber > latest.versionNumber) {
|
|
2545
|
+
latest = version;
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
return latest ? this.deepCopyVersion(latest) : null;
|
|
2550
|
+
}
|
|
2551
|
+
async listVersions(input) {
|
|
2552
|
+
const { blockId, page = 0, perPage: perPageInput, orderBy } = input;
|
|
2553
|
+
const { field, direction } = this.parseVersionOrderBy(orderBy);
|
|
2554
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: listVersions called for block ${blockId}`);
|
|
2555
|
+
const perPage = normalizePerPage(perPageInput, 20);
|
|
2556
|
+
if (page < 0) {
|
|
2557
|
+
throw new Error("page must be >= 0");
|
|
2558
|
+
}
|
|
2559
|
+
const maxOffset = Number.MAX_SAFE_INTEGER / 2;
|
|
2560
|
+
if (page * perPage > maxOffset) {
|
|
2561
|
+
throw new Error("page value too large");
|
|
2562
|
+
}
|
|
2563
|
+
let versions = Array.from(this.db.promptBlockVersions.values()).filter((v) => v.blockId === blockId);
|
|
2564
|
+
versions = this.sortVersions(versions, field, direction);
|
|
2565
|
+
const clonedVersions = versions.map((v) => this.deepCopyVersion(v));
|
|
2566
|
+
const total = clonedVersions.length;
|
|
2567
|
+
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
2568
|
+
const paginatedVersions = clonedVersions.slice(offset, offset + perPage);
|
|
2569
|
+
return {
|
|
2570
|
+
versions: paginatedVersions,
|
|
2571
|
+
total,
|
|
2572
|
+
page,
|
|
2573
|
+
perPage: perPageForResponse,
|
|
2574
|
+
hasMore: offset + perPage < total
|
|
2575
|
+
};
|
|
2576
|
+
}
|
|
2577
|
+
async deleteVersion(id) {
|
|
2578
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: deleteVersion called for ${id}`);
|
|
2579
|
+
this.db.promptBlockVersions.delete(id);
|
|
2580
|
+
}
|
|
2581
|
+
async deleteVersionsByParentId(entityId) {
|
|
2582
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: deleteVersionsByParentId called for block ${entityId}`);
|
|
2583
|
+
const idsToDelete = [];
|
|
2584
|
+
for (const [id, version] of this.db.promptBlockVersions.entries()) {
|
|
2585
|
+
if (version.blockId === entityId) {
|
|
2586
|
+
idsToDelete.push(id);
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
for (const id of idsToDelete) {
|
|
2590
|
+
this.db.promptBlockVersions.delete(id);
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
async countVersions(blockId) {
|
|
2594
|
+
this.logger.debug(`InMemoryPromptBlocksStorage: countVersions called for block ${blockId}`);
|
|
2595
|
+
let count = 0;
|
|
2596
|
+
for (const version of this.db.promptBlockVersions.values()) {
|
|
2597
|
+
if (version.blockId === blockId) {
|
|
2598
|
+
count++;
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
return count;
|
|
2602
|
+
}
|
|
2603
|
+
// ==========================================================================
|
|
2604
|
+
// Private Helper Methods
|
|
2605
|
+
// ==========================================================================
|
|
2606
|
+
deepCopyBlock(block) {
|
|
2607
|
+
return {
|
|
2608
|
+
...block,
|
|
2609
|
+
metadata: block.metadata ? { ...block.metadata } : block.metadata
|
|
2610
|
+
};
|
|
2611
|
+
}
|
|
2612
|
+
deepCopyVersion(version) {
|
|
2613
|
+
return {
|
|
2614
|
+
...version,
|
|
2615
|
+
rules: version.rules ? JSON.parse(JSON.stringify(version.rules)) : version.rules,
|
|
2616
|
+
changedFields: version.changedFields ? [...version.changedFields] : version.changedFields
|
|
2617
|
+
};
|
|
2618
|
+
}
|
|
2619
|
+
sortBlocks(blocks, field, direction) {
|
|
2620
|
+
return blocks.sort((a, b) => {
|
|
2621
|
+
const aValue = a[field].getTime();
|
|
2622
|
+
const bValue = b[field].getTime();
|
|
2623
|
+
return direction === "ASC" ? aValue - bValue : bValue - aValue;
|
|
2624
|
+
});
|
|
2625
|
+
}
|
|
2626
|
+
sortVersions(versions, field, direction) {
|
|
2627
|
+
return versions.sort((a, b) => {
|
|
2628
|
+
let aVal;
|
|
2629
|
+
let bVal;
|
|
2630
|
+
if (field === "createdAt") {
|
|
2631
|
+
aVal = a.createdAt.getTime();
|
|
2632
|
+
bVal = b.createdAt.getTime();
|
|
2633
|
+
} else {
|
|
2634
|
+
aVal = a.versionNumber;
|
|
2635
|
+
bVal = b.versionNumber;
|
|
2636
|
+
}
|
|
2637
|
+
return direction === "ASC" ? aVal - bVal : bVal - aVal;
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2640
|
+
};
|
|
2641
|
+
|
|
2642
|
+
// src/storage/domains/scorer-definitions/base.ts
|
|
2643
|
+
var ScorerDefinitionsStorage = class extends VersionedStorageDomain {
|
|
2644
|
+
listKey = "scorerDefinitions";
|
|
2645
|
+
versionMetadataFields = [
|
|
2646
|
+
"id",
|
|
2647
|
+
"scorerDefinitionId",
|
|
2648
|
+
"versionNumber",
|
|
2649
|
+
"changedFields",
|
|
2650
|
+
"changeMessage",
|
|
2651
|
+
"createdAt"
|
|
2652
|
+
];
|
|
2653
|
+
constructor() {
|
|
2654
|
+
super({
|
|
2655
|
+
component: "STORAGE",
|
|
2656
|
+
name: "SCORER_DEFINITIONS"
|
|
2657
|
+
});
|
|
2658
|
+
}
|
|
2659
|
+
};
|
|
2660
|
+
|
|
2661
|
+
// src/storage/domains/scorer-definitions/inmemory.ts
|
|
2662
|
+
var InMemoryScorerDefinitionsStorage = class extends ScorerDefinitionsStorage {
|
|
2663
|
+
db;
|
|
2664
|
+
constructor({ db }) {
|
|
2665
|
+
super();
|
|
2666
|
+
this.db = db;
|
|
2667
|
+
}
|
|
2668
|
+
async dangerouslyClearAll() {
|
|
2669
|
+
this.db.scorerDefinitions.clear();
|
|
2670
|
+
this.db.scorerDefinitionVersions.clear();
|
|
2671
|
+
}
|
|
2672
|
+
// ==========================================================================
|
|
2673
|
+
// Scorer Definition CRUD Methods
|
|
2674
|
+
// ==========================================================================
|
|
2675
|
+
async getById(id) {
|
|
2676
|
+
this.logger.debug(`InMemoryScorerDefinitionsStorage: getById called for ${id}`);
|
|
2677
|
+
const scorer = this.db.scorerDefinitions.get(id);
|
|
2678
|
+
return scorer ? this.deepCopyScorer(scorer) : null;
|
|
2679
|
+
}
|
|
2680
|
+
async create(input) {
|
|
2681
|
+
const { scorerDefinition } = input;
|
|
2682
|
+
this.logger.debug(`InMemoryScorerDefinitionsStorage: create called for ${scorerDefinition.id}`);
|
|
2683
|
+
if (this.db.scorerDefinitions.has(scorerDefinition.id)) {
|
|
2684
|
+
throw new Error(`Scorer definition with id ${scorerDefinition.id} already exists`);
|
|
2685
|
+
}
|
|
2686
|
+
const now = /* @__PURE__ */ new Date();
|
|
2687
|
+
const newScorer = {
|
|
2688
|
+
id: scorerDefinition.id,
|
|
2689
|
+
status: "draft",
|
|
2690
|
+
activeVersionId: void 0,
|
|
2691
|
+
authorId: scorerDefinition.authorId,
|
|
2692
|
+
metadata: scorerDefinition.metadata,
|
|
2693
|
+
createdAt: now,
|
|
2694
|
+
updatedAt: now
|
|
2695
|
+
};
|
|
2696
|
+
this.db.scorerDefinitions.set(scorerDefinition.id, newScorer);
|
|
2697
|
+
const { id: _id, authorId: _authorId, metadata: _metadata, ...snapshotConfig } = scorerDefinition;
|
|
2698
|
+
const versionId = crypto.randomUUID();
|
|
2699
|
+
await this.createVersion({
|
|
2700
|
+
id: versionId,
|
|
2701
|
+
scorerDefinitionId: scorerDefinition.id,
|
|
2702
|
+
versionNumber: 1,
|
|
2703
|
+
...snapshotConfig,
|
|
2704
|
+
changedFields: Object.keys(snapshotConfig),
|
|
2705
|
+
changeMessage: "Initial version"
|
|
2706
|
+
});
|
|
2707
|
+
return this.deepCopyScorer(newScorer);
|
|
2708
|
+
}
|
|
2709
|
+
async update(input) {
|
|
2710
|
+
const { id, ...updates } = input;
|
|
2711
|
+
this.logger.debug(`InMemoryScorerDefinitionsStorage: update called for ${id}`);
|
|
2712
|
+
const existingScorer = this.db.scorerDefinitions.get(id);
|
|
2713
|
+
if (!existingScorer) {
|
|
2714
|
+
throw new Error(`Scorer definition with id ${id} not found`);
|
|
2715
|
+
}
|
|
2716
|
+
const { authorId, activeVersionId, metadata, status, ...configFields } = updates;
|
|
2717
|
+
const configFieldNames = [
|
|
2718
|
+
"name",
|
|
2719
|
+
"description",
|
|
2720
|
+
"type",
|
|
2721
|
+
"model",
|
|
2722
|
+
"instructions",
|
|
2723
|
+
"scoreRange",
|
|
2724
|
+
"presetConfig",
|
|
2725
|
+
"defaultSampling"
|
|
2726
|
+
];
|
|
2727
|
+
const hasConfigUpdate = configFieldNames.some((field) => field in configFields);
|
|
2728
|
+
const updatedScorer = {
|
|
2729
|
+
...existingScorer,
|
|
2730
|
+
...authorId !== void 0 && { authorId },
|
|
2731
|
+
...activeVersionId !== void 0 && { activeVersionId },
|
|
2732
|
+
...status !== void 0 && { status },
|
|
2733
|
+
...metadata !== void 0 && {
|
|
2734
|
+
metadata: { ...existingScorer.metadata, ...metadata }
|
|
2735
|
+
},
|
|
2736
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
2737
|
+
};
|
|
2738
|
+
if (activeVersionId !== void 0) {
|
|
2739
|
+
updatedScorer.status = "published";
|
|
2740
|
+
}
|
|
2741
|
+
if (hasConfigUpdate) {
|
|
2742
|
+
const latestVersion = await this.getLatestVersion(id);
|
|
2743
|
+
if (!latestVersion) {
|
|
2744
|
+
throw new Error(`No versions found for scorer definition ${id}`);
|
|
2745
|
+
}
|
|
2746
|
+
const {
|
|
2747
|
+
id: _versionId,
|
|
2748
|
+
scorerDefinitionId: _scorerDefinitionId,
|
|
2749
|
+
versionNumber: _versionNumber,
|
|
2750
|
+
changedFields: _changedFields,
|
|
2751
|
+
changeMessage: _changeMessage,
|
|
2752
|
+
createdAt: _createdAt,
|
|
2753
|
+
...latestConfig
|
|
2754
|
+
} = latestVersion;
|
|
2755
|
+
const newConfig = {
|
|
2756
|
+
...latestConfig,
|
|
2757
|
+
...configFields
|
|
2758
|
+
};
|
|
2759
|
+
const changedFields = configFieldNames.filter(
|
|
2760
|
+
(field) => field in configFields && JSON.stringify(configFields[field]) !== JSON.stringify(latestConfig[field])
|
|
2761
|
+
);
|
|
2762
|
+
if (changedFields.length > 0) {
|
|
2763
|
+
const newVersionId = crypto.randomUUID();
|
|
2764
|
+
const newVersionNumber = latestVersion.versionNumber + 1;
|
|
2765
|
+
await this.createVersion({
|
|
2766
|
+
id: newVersionId,
|
|
2767
|
+
scorerDefinitionId: id,
|
|
2768
|
+
versionNumber: newVersionNumber,
|
|
2769
|
+
...newConfig,
|
|
2770
|
+
changedFields,
|
|
2771
|
+
changeMessage: `Updated ${changedFields.join(", ")}`
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
this.db.scorerDefinitions.set(id, updatedScorer);
|
|
2776
|
+
return this.deepCopyScorer(updatedScorer);
|
|
2777
|
+
}
|
|
2778
|
+
async delete(id) {
|
|
2779
|
+
this.logger.debug(`InMemoryScorerDefinitionsStorage: delete called for ${id}`);
|
|
2780
|
+
this.db.scorerDefinitions.delete(id);
|
|
2781
|
+
await this.deleteVersionsByParentId(id);
|
|
2782
|
+
}
|
|
2783
|
+
async list(args) {
|
|
2784
|
+
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata } = args || {};
|
|
2785
|
+
const { field, direction } = this.parseOrderBy(orderBy);
|
|
2786
|
+
this.logger.debug(`InMemoryScorerDefinitionsStorage: list called`);
|
|
2787
|
+
const perPage = normalizePerPage(perPageInput, 100);
|
|
2788
|
+
if (page < 0) {
|
|
2789
|
+
throw new Error("page must be >= 0");
|
|
2790
|
+
}
|
|
2791
|
+
const maxOffset = Number.MAX_SAFE_INTEGER / 2;
|
|
2792
|
+
if (page * perPage > maxOffset) {
|
|
2793
|
+
throw new Error("page value too large");
|
|
2794
|
+
}
|
|
2795
|
+
let scorers = Array.from(this.db.scorerDefinitions.values());
|
|
2796
|
+
if (authorId !== void 0) {
|
|
2797
|
+
scorers = scorers.filter((scorer) => scorer.authorId === authorId);
|
|
2798
|
+
}
|
|
2799
|
+
if (metadata && Object.keys(metadata).length > 0) {
|
|
2800
|
+
scorers = scorers.filter((scorer) => {
|
|
2801
|
+
if (!scorer.metadata) return false;
|
|
2802
|
+
return Object.entries(metadata).every(([key, value]) => chunkOOCEAC6U_cjs.deepEqual(scorer.metadata[key], value));
|
|
2803
|
+
});
|
|
2804
|
+
}
|
|
2805
|
+
const sortedScorers = this.sortScorers(scorers, field, direction);
|
|
2806
|
+
const clonedScorers = sortedScorers.map((scorer) => this.deepCopyScorer(scorer));
|
|
2807
|
+
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
2808
|
+
return {
|
|
2809
|
+
scorerDefinitions: clonedScorers.slice(offset, offset + perPage),
|
|
2810
|
+
total: clonedScorers.length,
|
|
2811
|
+
page,
|
|
2812
|
+
perPage: perPageForResponse,
|
|
2813
|
+
hasMore: offset + perPage < clonedScorers.length
|
|
2814
|
+
};
|
|
2815
|
+
}
|
|
2816
|
+
// ==========================================================================
|
|
2817
|
+
// Scorer Definition Version Methods
|
|
2818
|
+
// ==========================================================================
|
|
2819
|
+
async createVersion(input) {
|
|
2820
|
+
this.logger.debug(
|
|
2821
|
+
`InMemoryScorerDefinitionsStorage: createVersion called for scorer definition ${input.scorerDefinitionId}`
|
|
2822
|
+
);
|
|
2823
|
+
if (this.db.scorerDefinitionVersions.has(input.id)) {
|
|
2824
|
+
throw new Error(`Version with id ${input.id} already exists`);
|
|
2825
|
+
}
|
|
2826
|
+
for (const version2 of this.db.scorerDefinitionVersions.values()) {
|
|
2827
|
+
if (version2.scorerDefinitionId === input.scorerDefinitionId && version2.versionNumber === input.versionNumber) {
|
|
2828
|
+
throw new Error(
|
|
2829
|
+
`Version number ${input.versionNumber} already exists for scorer definition ${input.scorerDefinitionId}`
|
|
2830
|
+
);
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
const version = {
|
|
2834
|
+
...input,
|
|
2835
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
2836
|
+
};
|
|
2837
|
+
this.db.scorerDefinitionVersions.set(input.id, this.deepCopyVersion(version));
|
|
2838
|
+
return this.deepCopyVersion(version);
|
|
2839
|
+
}
|
|
2840
|
+
async getVersion(id) {
|
|
2841
|
+
this.logger.debug(`InMemoryScorerDefinitionsStorage: getVersion called for ${id}`);
|
|
2842
|
+
const version = this.db.scorerDefinitionVersions.get(id);
|
|
2843
|
+
return version ? this.deepCopyVersion(version) : null;
|
|
2844
|
+
}
|
|
2845
|
+
async getVersionByNumber(scorerDefinitionId, versionNumber) {
|
|
2846
|
+
this.logger.debug(
|
|
2847
|
+
`InMemoryScorerDefinitionsStorage: getVersionByNumber called for scorer definition ${scorerDefinitionId}, v${versionNumber}`
|
|
2848
|
+
);
|
|
2849
|
+
for (const version of this.db.scorerDefinitionVersions.values()) {
|
|
2850
|
+
if (version.scorerDefinitionId === scorerDefinitionId && version.versionNumber === versionNumber) {
|
|
2851
|
+
return this.deepCopyVersion(version);
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
return null;
|
|
2855
|
+
}
|
|
2856
|
+
async getLatestVersion(scorerDefinitionId) {
|
|
2857
|
+
this.logger.debug(
|
|
2858
|
+
`InMemoryScorerDefinitionsStorage: getLatestVersion called for scorer definition ${scorerDefinitionId}`
|
|
2859
|
+
);
|
|
2860
|
+
let latest = null;
|
|
2861
|
+
for (const version of this.db.scorerDefinitionVersions.values()) {
|
|
2862
|
+
if (version.scorerDefinitionId === scorerDefinitionId) {
|
|
2863
|
+
if (!latest || version.versionNumber > latest.versionNumber) {
|
|
2864
|
+
latest = version;
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
return latest ? this.deepCopyVersion(latest) : null;
|
|
2869
|
+
}
|
|
2870
|
+
async listVersions(input) {
|
|
2871
|
+
const { scorerDefinitionId, page = 0, perPage: perPageInput, orderBy } = input;
|
|
2872
|
+
const { field, direction } = this.parseVersionOrderBy(orderBy);
|
|
2873
|
+
this.logger.debug(
|
|
2874
|
+
`InMemoryScorerDefinitionsStorage: listVersions called for scorer definition ${scorerDefinitionId}`
|
|
2875
|
+
);
|
|
2876
|
+
const perPage = normalizePerPage(perPageInput, 20);
|
|
2877
|
+
if (page < 0) {
|
|
2878
|
+
throw new Error("page must be >= 0");
|
|
2879
|
+
}
|
|
2880
|
+
const maxOffset = Number.MAX_SAFE_INTEGER / 2;
|
|
2881
|
+
if (page * perPage > maxOffset) {
|
|
2882
|
+
throw new Error("page value too large");
|
|
2883
|
+
}
|
|
2884
|
+
let versions = Array.from(this.db.scorerDefinitionVersions.values()).filter(
|
|
2885
|
+
(v) => v.scorerDefinitionId === scorerDefinitionId
|
|
2886
|
+
);
|
|
2887
|
+
versions = this.sortVersions(versions, field, direction);
|
|
2888
|
+
const clonedVersions = versions.map((v) => this.deepCopyVersion(v));
|
|
2889
|
+
const total = clonedVersions.length;
|
|
2890
|
+
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
2891
|
+
const paginatedVersions = clonedVersions.slice(offset, offset + perPage);
|
|
2892
|
+
return {
|
|
2893
|
+
versions: paginatedVersions,
|
|
2894
|
+
total,
|
|
2895
|
+
page,
|
|
2896
|
+
perPage: perPageForResponse,
|
|
2897
|
+
hasMore: offset + perPage < total
|
|
2898
|
+
};
|
|
2899
|
+
}
|
|
2900
|
+
async deleteVersion(id) {
|
|
2901
|
+
this.logger.debug(`InMemoryScorerDefinitionsStorage: deleteVersion called for ${id}`);
|
|
2902
|
+
this.db.scorerDefinitionVersions.delete(id);
|
|
2903
|
+
}
|
|
2904
|
+
async deleteVersionsByParentId(entityId) {
|
|
2905
|
+
this.logger.debug(
|
|
2906
|
+
`InMemoryScorerDefinitionsStorage: deleteVersionsByParentId called for scorer definition ${entityId}`
|
|
2907
|
+
);
|
|
2908
|
+
const idsToDelete = [];
|
|
2909
|
+
for (const [id, version] of this.db.scorerDefinitionVersions.entries()) {
|
|
2910
|
+
if (version.scorerDefinitionId === entityId) {
|
|
2911
|
+
idsToDelete.push(id);
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
for (const id of idsToDelete) {
|
|
2915
|
+
this.db.scorerDefinitionVersions.delete(id);
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
async countVersions(scorerDefinitionId) {
|
|
2919
|
+
this.logger.debug(
|
|
2920
|
+
`InMemoryScorerDefinitionsStorage: countVersions called for scorer definition ${scorerDefinitionId}`
|
|
2921
|
+
);
|
|
2922
|
+
let count = 0;
|
|
2923
|
+
for (const version of this.db.scorerDefinitionVersions.values()) {
|
|
2924
|
+
if (version.scorerDefinitionId === scorerDefinitionId) {
|
|
2925
|
+
count++;
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
return count;
|
|
2929
|
+
}
|
|
2930
|
+
// ==========================================================================
|
|
2931
|
+
// Private Helper Methods
|
|
2932
|
+
// ==========================================================================
|
|
2933
|
+
deepCopyScorer(scorer) {
|
|
2934
|
+
return {
|
|
2935
|
+
...scorer,
|
|
2936
|
+
metadata: scorer.metadata ? { ...scorer.metadata } : scorer.metadata
|
|
2937
|
+
};
|
|
2938
|
+
}
|
|
2939
|
+
deepCopyVersion(version) {
|
|
2940
|
+
return {
|
|
2941
|
+
...version,
|
|
2942
|
+
model: version.model ? JSON.parse(JSON.stringify(version.model)) : version.model,
|
|
2943
|
+
scoreRange: version.scoreRange ? JSON.parse(JSON.stringify(version.scoreRange)) : version.scoreRange,
|
|
2944
|
+
presetConfig: version.presetConfig ? JSON.parse(JSON.stringify(version.presetConfig)) : version.presetConfig,
|
|
2945
|
+
defaultSampling: version.defaultSampling ? JSON.parse(JSON.stringify(version.defaultSampling)) : version.defaultSampling,
|
|
2946
|
+
changedFields: version.changedFields ? [...version.changedFields] : version.changedFields
|
|
2947
|
+
};
|
|
2948
|
+
}
|
|
2949
|
+
sortScorers(scorers, field, direction) {
|
|
2950
|
+
return scorers.sort((a, b) => {
|
|
2951
|
+
const aValue = a[field].getTime();
|
|
2952
|
+
const bValue = b[field].getTime();
|
|
2953
|
+
return direction === "ASC" ? aValue - bValue : bValue - aValue;
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
sortVersions(versions, field, direction) {
|
|
2957
|
+
return versions.sort((a, b) => {
|
|
2958
|
+
let aVal;
|
|
2959
|
+
let bVal;
|
|
2960
|
+
if (field === "createdAt") {
|
|
2961
|
+
aVal = a.createdAt.getTime();
|
|
2962
|
+
bVal = b.createdAt.getTime();
|
|
2963
|
+
} else {
|
|
2964
|
+
aVal = a.versionNumber;
|
|
2965
|
+
bVal = b.versionNumber;
|
|
2966
|
+
}
|
|
2967
|
+
return direction === "ASC" ? aVal - bVal : bVal - aVal;
|
|
2968
|
+
});
|
|
2969
|
+
}
|
|
2970
|
+
};
|
|
2971
|
+
|
|
2221
2972
|
// src/storage/domains/scores/base.ts
|
|
2222
2973
|
var ScoresStorage = class extends StorageDomain {
|
|
2223
2974
|
constructor() {
|
|
@@ -2640,7 +3391,9 @@ var InMemoryStore = class extends MastraCompositeStore {
|
|
|
2640
3391
|
workflows: new WorkflowsInMemory({ db: this.#db }),
|
|
2641
3392
|
scores: new ScoresInMemory({ db: this.#db }),
|
|
2642
3393
|
observability: new ObservabilityInMemory({ db: this.#db }),
|
|
2643
|
-
agents: new InMemoryAgentsStorage({ db: this.#db })
|
|
3394
|
+
agents: new InMemoryAgentsStorage({ db: this.#db }),
|
|
3395
|
+
promptBlocks: new InMemoryPromptBlocksStorage({ db: this.#db }),
|
|
3396
|
+
scorerDefinitions: new InMemoryScorerDefinitionsStorage({ db: this.#db })
|
|
2644
3397
|
};
|
|
2645
3398
|
}
|
|
2646
3399
|
/**
|
|
@@ -2655,7 +3408,7 @@ var InMemoryStore = class extends MastraCompositeStore {
|
|
|
2655
3408
|
var MockStore = InMemoryStore;
|
|
2656
3409
|
|
|
2657
3410
|
// src/storage/domains/operations/base.ts
|
|
2658
|
-
var StoreOperations = class extends
|
|
3411
|
+
var StoreOperations = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
2659
3412
|
constructor() {
|
|
2660
3413
|
super({
|
|
2661
3414
|
component: "STORAGE",
|
|
@@ -2775,7 +3528,11 @@ var StoreOperationsInMemory = class extends StoreOperations {
|
|
|
2775
3528
|
mastra_ai_spans: /* @__PURE__ */ new Map(),
|
|
2776
3529
|
mastra_agents: /* @__PURE__ */ new Map(),
|
|
2777
3530
|
mastra_agent_versions: /* @__PURE__ */ new Map(),
|
|
2778
|
-
mastra_observational_memory: /* @__PURE__ */ new Map()
|
|
3531
|
+
mastra_observational_memory: /* @__PURE__ */ new Map(),
|
|
3532
|
+
mastra_prompt_blocks: /* @__PURE__ */ new Map(),
|
|
3533
|
+
mastra_prompt_block_versions: /* @__PURE__ */ new Map(),
|
|
3534
|
+
mastra_scorer_definitions: /* @__PURE__ */ new Map(),
|
|
3535
|
+
mastra_scorer_definition_versions: /* @__PURE__ */ new Map()
|
|
2779
3536
|
};
|
|
2780
3537
|
}
|
|
2781
3538
|
getDatabase() {
|
|
@@ -2784,7 +3541,7 @@ var StoreOperationsInMemory = class extends StoreOperations {
|
|
|
2784
3541
|
async insert({ tableName, record }) {
|
|
2785
3542
|
const table = this.data[tableName];
|
|
2786
3543
|
let key = record.id;
|
|
2787
|
-
if ([
|
|
3544
|
+
if ([chunkGZD6443M_cjs.TABLE_WORKFLOW_SNAPSHOT].includes(tableName) && !record.id && record.run_id) {
|
|
2788
3545
|
key = record.workflow_name ? `${record.workflow_name}-${record.run_id}` : record.run_id;
|
|
2789
3546
|
record.id = key;
|
|
2790
3547
|
} else if (!record.id) {
|
|
@@ -2797,7 +3554,7 @@ var StoreOperationsInMemory = class extends StoreOperations {
|
|
|
2797
3554
|
const table = this.data[tableName];
|
|
2798
3555
|
for (const record of records) {
|
|
2799
3556
|
let key = record.id;
|
|
2800
|
-
if ([
|
|
3557
|
+
if ([chunkGZD6443M_cjs.TABLE_WORKFLOW_SNAPSHOT].includes(tableName) && !record.id && record.run_id) {
|
|
2801
3558
|
key = record.run_id;
|
|
2802
3559
|
record.id = key;
|
|
2803
3560
|
} else if (!record.id) {
|
|
@@ -2844,6 +3601,8 @@ exports.AgentsStorage = AgentsStorage;
|
|
|
2844
3601
|
exports.InMemoryAgentsStorage = InMemoryAgentsStorage;
|
|
2845
3602
|
exports.InMemoryDB = InMemoryDB;
|
|
2846
3603
|
exports.InMemoryMemory = InMemoryMemory;
|
|
3604
|
+
exports.InMemoryPromptBlocksStorage = InMemoryPromptBlocksStorage;
|
|
3605
|
+
exports.InMemoryScorerDefinitionsStorage = InMemoryScorerDefinitionsStorage;
|
|
2847
3606
|
exports.InMemoryStore = InMemoryStore;
|
|
2848
3607
|
exports.MastraCompositeStore = MastraCompositeStore;
|
|
2849
3608
|
exports.MastraStorage = MastraStorage;
|
|
@@ -2851,11 +3610,14 @@ exports.MemoryStorage = MemoryStorage;
|
|
|
2851
3610
|
exports.MockStore = MockStore;
|
|
2852
3611
|
exports.ObservabilityInMemory = ObservabilityInMemory;
|
|
2853
3612
|
exports.ObservabilityStorage = ObservabilityStorage;
|
|
3613
|
+
exports.PromptBlocksStorage = PromptBlocksStorage;
|
|
3614
|
+
exports.ScorerDefinitionsStorage = ScorerDefinitionsStorage;
|
|
2854
3615
|
exports.ScoresInMemory = ScoresInMemory;
|
|
2855
3616
|
exports.ScoresStorage = ScoresStorage;
|
|
2856
3617
|
exports.StorageDomain = StorageDomain;
|
|
2857
3618
|
exports.StoreOperations = StoreOperations;
|
|
2858
3619
|
exports.StoreOperationsInMemory = StoreOperationsInMemory;
|
|
3620
|
+
exports.VersionedStorageDomain = VersionedStorageDomain;
|
|
2859
3621
|
exports.WorkflowsInMemory = WorkflowsInMemory;
|
|
2860
3622
|
exports.WorkflowsStorage = WorkflowsStorage;
|
|
2861
3623
|
exports.calculatePagination = calculatePagination;
|
|
@@ -2873,5 +3635,5 @@ exports.safelyParseJSON = safelyParseJSON;
|
|
|
2873
3635
|
exports.serializeDate = serializeDate;
|
|
2874
3636
|
exports.transformRow = transformRow;
|
|
2875
3637
|
exports.transformScoreRow = transformScoreRow;
|
|
2876
|
-
//# sourceMappingURL=chunk-
|
|
2877
|
-
//# sourceMappingURL=chunk-
|
|
3638
|
+
//# sourceMappingURL=chunk-JU6K7UDX.cjs.map
|
|
3639
|
+
//# sourceMappingURL=chunk-JU6K7UDX.cjs.map
|