@mastra/core 1.4.0 → 1.5.0-alpha.1
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 +368 -0
- package/dist/agent/agent.d.ts +3 -2
- 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/conversion/output-converter.d.ts.map +1 -1
- package/dist/agent/message-list/index.cjs +18 -18
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/merge/MessageMerger.d.ts.map +1 -1
- package/dist/agent/message-list/message-list.d.ts.map +1 -1
- package/dist/agent/types.d.ts +2 -2
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts +1 -0
- package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +1 -0
- package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/schema.d.ts +8 -0
- package/dist/agent/workflows/prepare-stream/schema.d.ts.map +1 -1
- package/dist/{chunk-Y3TQ52UE.js → chunk-33TGTTTS.js} +4 -3
- package/dist/chunk-33TGTTTS.js.map +1 -0
- package/dist/{chunk-3X3CZUXI.js → chunk-3KJW4EMO.js} +660 -206
- package/dist/chunk-3KJW4EMO.js.map +1 -0
- package/dist/{chunk-YNNJLLFN.cjs → chunk-3YMDR4OL.cjs} +661 -207
- package/dist/chunk-3YMDR4OL.cjs.map +1 -0
- package/dist/{chunk-NJ7TL3LQ.js → chunk-5EOLBHHS.js} +26 -15
- package/dist/chunk-5EOLBHHS.js.map +1 -0
- package/dist/{chunk-RZ4CIIZR.js → chunk-6DUTLERJ.js} +4 -4
- package/dist/{chunk-RZ4CIIZR.js.map → chunk-6DUTLERJ.js.map} +1 -1
- package/dist/{chunk-VTE2OBKS.cjs → chunk-A6EWCOGA.cjs} +417 -77
- package/dist/chunk-A6EWCOGA.cjs.map +1 -0
- package/dist/{chunk-4XSAZPPS.js → chunk-A7V2NSY3.js} +313 -137
- package/dist/chunk-A7V2NSY3.js.map +1 -0
- package/dist/{chunk-FLPEGTEK.js → chunk-AIRMLZ43.js} +5 -5
- package/dist/{chunk-FLPEGTEK.js.map → chunk-AIRMLZ43.js.map} +1 -1
- package/dist/{chunk-DBSVT6AR.cjs → chunk-BKQAP27M.cjs} +9 -9
- package/dist/{chunk-DBSVT6AR.cjs.map → chunk-BKQAP27M.cjs.map} +1 -1
- package/dist/{chunk-RS6CZXGA.js → chunk-BQHWJLXU.js} +15 -4
- package/dist/chunk-BQHWJLXU.js.map +1 -0
- package/dist/{chunk-V2MLGA7T.js → chunk-CXVMDV2B.js} +417 -78
- package/dist/chunk-CXVMDV2B.js.map +1 -0
- package/dist/{chunk-NKYWDNCI.cjs → chunk-E2FHTXAI.cjs} +7 -7
- package/dist/{chunk-NKYWDNCI.cjs.map → chunk-E2FHTXAI.cjs.map} +1 -1
- package/dist/{chunk-7UWHFWST.cjs → chunk-EAZ6YDCQ.cjs} +15 -3
- package/dist/chunk-EAZ6YDCQ.cjs.map +1 -0
- package/dist/{chunk-64WGYTQK.cjs → chunk-FTBLAVTF.cjs} +55 -55
- package/dist/{chunk-64WGYTQK.cjs.map → chunk-FTBLAVTF.cjs.map} +1 -1
- package/dist/{chunk-4EHGOATH.js → chunk-FZ5DRHKE.js} +1337 -547
- package/dist/chunk-FZ5DRHKE.js.map +1 -0
- package/dist/{chunk-4TQ4EBYX.js → chunk-GEDGDKQ6.js} +9 -9
- package/dist/chunk-GEDGDKQ6.js.map +1 -0
- package/dist/{chunk-QTTWRCB5.js → chunk-I3AWF54W.js} +5 -5
- package/dist/{chunk-QTTWRCB5.js.map → chunk-I3AWF54W.js.map} +1 -1
- package/dist/{chunk-U2HKJZCI.js → chunk-IBNCZTNQ.js} +6 -6
- package/dist/{chunk-U2HKJZCI.js.map → chunk-IBNCZTNQ.js.map} +1 -1
- package/dist/{chunk-3JVFFAJX.cjs → chunk-IJIE3ZID.cjs} +27 -16
- package/dist/chunk-IJIE3ZID.cjs.map +1 -0
- package/dist/{chunk-NZG2JAKS.cjs → chunk-JWG272ZZ.cjs} +19 -19
- package/dist/chunk-JWG272ZZ.cjs.map +1 -0
- package/dist/{chunk-BP7VYTOP.cjs → chunk-JZ6TH4HQ.cjs} +954 -401
- package/dist/chunk-JZ6TH4HQ.cjs.map +1 -0
- package/dist/{chunk-SU5APAM6.cjs → chunk-KNXZ7KYL.cjs} +94 -6
- package/dist/chunk-KNXZ7KYL.cjs.map +1 -0
- package/dist/{chunk-CYUP7QWT.cjs → chunk-KRAGJ433.cjs} +4 -3
- package/dist/chunk-KRAGJ433.cjs.map +1 -0
- package/dist/{chunk-XDD5V446.cjs → chunk-MDC6VYA6.cjs} +6 -2
- package/dist/{chunk-XDD5V446.cjs.map → chunk-MDC6VYA6.cjs.map} +1 -1
- package/dist/{chunk-AXHBJ4GX.js → chunk-NN26FSKL.js} +10 -8
- package/dist/chunk-NN26FSKL.js.map +1 -0
- package/dist/{chunk-AY6DBRS3.js → chunk-OHLVZVIK.js} +36 -2
- package/dist/chunk-OHLVZVIK.js.map +1 -0
- package/dist/{chunk-5Q5Y34SS.js → chunk-PECKKR4C.js} +4 -4
- package/dist/{chunk-5Q5Y34SS.js.map → chunk-PECKKR4C.js.map} +1 -1
- package/dist/{chunk-HYRYTTMT.cjs → chunk-PHHJLGZU.cjs} +9 -9
- package/dist/{chunk-HYRYTTMT.cjs.map → chunk-PHHJLGZU.cjs.map} +1 -1
- package/dist/{chunk-65PHUUMF.cjs → chunk-QDH6MVJ7.cjs} +24 -22
- package/dist/chunk-QDH6MVJ7.cjs.map +1 -0
- package/dist/{chunk-VD5YA6RH.cjs → chunk-QSN5KQXZ.cjs} +18 -18
- package/dist/{chunk-VD5YA6RH.cjs.map → chunk-QSN5KQXZ.cjs.map} +1 -1
- package/dist/{chunk-4IJ4UDZX.cjs → chunk-RH2K66O2.cjs} +399 -223
- package/dist/chunk-RH2K66O2.cjs.map +1 -0
- package/dist/{chunk-4KFEMXTV.cjs → chunk-S4VVZI4E.cjs} +1361 -546
- package/dist/chunk-S4VVZI4E.cjs.map +1 -0
- package/dist/{chunk-ZATLLPIH.js → chunk-TPDMP7OD.js} +6 -2
- package/dist/chunk-TPDMP7OD.js.map +1 -0
- package/dist/{chunk-PS5ONCXY.js → chunk-UZFGMMKU.js} +82 -4
- package/dist/chunk-UZFGMMKU.js.map +1 -0
- package/dist/{chunk-7NKUSQEV.js → chunk-YIN5F7VO.js} +936 -389
- package/dist/chunk-YIN5F7VO.js.map +1 -0
- package/dist/{chunk-CZ4NQANZ.cjs → chunk-YW54RH77.cjs} +36 -2
- package/dist/chunk-YW54RH77.cjs.map +1 -0
- package/dist/datasets/experiment/executor.d.ts.map +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +27 -1
- package/dist/docs/assets/SOURCE_MAP.json +463 -389
- package/dist/docs/references/docs-agents-processors.md +52 -0
- package/dist/docs/references/docs-observability-datasets-overview.md +188 -0
- package/dist/docs/references/docs-observability-datasets-running-experiments.md +266 -0
- package/dist/docs/references/docs-observability-tracing-exporters-cloud.md +7 -4
- package/dist/docs/references/reference-agents-generate.md +1 -1
- package/dist/docs/references/reference-configuration.md +3 -4
- package/dist/docs/references/reference-datasets-addItem.md +35 -0
- package/dist/docs/references/reference-datasets-addItems.md +33 -0
- package/dist/docs/references/reference-datasets-compareExperiments.md +48 -0
- package/dist/docs/references/reference-datasets-create.md +49 -0
- package/dist/docs/references/reference-datasets-dataset.md +78 -0
- package/dist/docs/references/reference-datasets-datasets-manager.md +84 -0
- package/dist/docs/references/reference-datasets-delete.md +23 -0
- package/dist/docs/references/reference-datasets-deleteExperiment.md +25 -0
- package/dist/docs/references/reference-datasets-deleteItem.md +25 -0
- package/dist/docs/references/reference-datasets-deleteItems.md +27 -0
- package/dist/docs/references/reference-datasets-get.md +29 -0
- package/dist/docs/references/reference-datasets-getDetails.md +45 -0
- package/dist/docs/references/reference-datasets-getExperiment.md +28 -0
- package/dist/docs/references/reference-datasets-getItem.md +31 -0
- package/dist/docs/references/reference-datasets-getItemHistory.md +29 -0
- package/dist/docs/references/reference-datasets-list.md +29 -0
- package/dist/docs/references/reference-datasets-listExperimentResults.md +37 -0
- package/dist/docs/references/reference-datasets-listExperiments.md +31 -0
- package/dist/docs/references/reference-datasets-listItems.md +44 -0
- package/dist/docs/references/reference-datasets-listVersions.md +31 -0
- package/dist/docs/references/reference-datasets-startExperiment.md +60 -0
- package/dist/docs/references/reference-datasets-startExperimentAsync.md +41 -0
- package/dist/docs/references/reference-datasets-update.md +46 -0
- package/dist/docs/references/reference-datasets-updateItem.md +36 -0
- package/dist/docs/references/reference-memory-observational-memory.md +36 -0
- package/dist/docs/references/reference-processors-processor-interface.md +4 -0
- package/dist/docs/references/reference-tools-create-tool.md +1 -1
- package/dist/docs/references/reference.md +24 -0
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/types.d.ts +108 -2
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/evals/index.cjs +20 -20
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +5 -5
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/harness/harness.d.ts +281 -0
- package/dist/harness/harness.d.ts.map +1 -0
- package/dist/harness/index.cjs +1728 -0
- package/dist/harness/index.cjs.map +1 -0
- package/dist/harness/index.d.ts +4 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +1723 -0
- package/dist/harness/index.js.map +1 -0
- package/dist/harness/tools.d.ts +65 -0
- package/dist/harness/tools.d.ts.map +1 -0
- package/dist/harness/types.d.ts +561 -0
- package/dist/harness/types.d.ts.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/integration/index.cjs +2 -2
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.cjs +20 -20
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/gateways/constants.d.ts.map +1 -1
- package/dist/llm/model/gateways/models-dev.d.ts +2 -3
- package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +312 -93
- package/dist/loop/index.cjs +12 -12
- package/dist/loop/index.js +1 -1
- package/dist/loop/network/index.d.ts.map +1 -1
- package/dist/loop/test-utils/options.d.ts.map +1 -1
- package/dist/loop/test-utils/tools.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/loop/workflows/stream.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts +3 -3
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/memory/memory.d.ts +10 -0
- package/dist/memory/memory.d.ts.map +1 -1
- package/dist/memory/types.d.ts +24 -0
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/models-dev-BW2GAM3K.cjs +12 -0
- package/dist/{models-dev-PPIXUUCU.cjs.map → models-dev-BW2GAM3K.cjs.map} +1 -1
- package/dist/models-dev-MDI5E2YA.js +3 -0
- package/dist/{models-dev-FQVUTQ7L.js.map → models-dev-MDI5E2YA.js.map} +1 -1
- package/dist/observability/index.cjs +11 -11
- package/dist/observability/index.js +1 -1
- package/dist/observability/utils.d.ts.map +1 -1
- package/dist/processors/index.cjs +41 -41
- package/dist/processors/index.js +1 -1
- package/dist/processors/processors/skills.d.ts +5 -0
- package/dist/processors/processors/skills.d.ts.map +1 -1
- package/dist/processors/runner.d.ts +2 -2
- package/dist/processors/runner.d.ts.map +1 -1
- package/dist/processors/step-schema.d.ts +218 -49453
- package/dist/processors/step-schema.d.ts.map +1 -1
- package/dist/provider-registry-4PH2JPIA.cjs +40 -0
- package/dist/{provider-registry-6LZAGQET.cjs.map → provider-registry-4PH2JPIA.cjs.map} +1 -1
- package/dist/provider-registry-VEJ3PN4S.js +3 -0
- package/dist/{provider-registry-QUNT7S55.js.map → provider-registry-VEJ3PN4S.js.map} +1 -1
- package/dist/provider-registry.json +657 -203
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/server/composite-auth.d.ts.map +1 -1
- package/dist/server/index.cjs +6 -1
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +6 -1
- package/dist/server/index.js.map +1 -1
- package/dist/storage/base.d.ts +4 -1
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/constants.cjs +82 -42
- package/dist/storage/constants.d.ts +11 -1
- package/dist/storage/constants.d.ts.map +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/agents/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/blobs/base.d.ts +47 -0
- package/dist/storage/domains/blobs/base.d.ts.map +1 -0
- package/dist/storage/domains/blobs/index.d.ts +3 -0
- package/dist/storage/domains/blobs/index.d.ts.map +1 -0
- package/dist/storage/domains/blobs/inmemory.d.ts +17 -0
- package/dist/storage/domains/blobs/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/datasets/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/mcp-clients/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/prompt-blocks/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/scorer-definitions/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/skills/base.d.ts +47 -0
- package/dist/storage/domains/skills/base.d.ts.map +1 -0
- package/dist/storage/domains/skills/index.d.ts +3 -0
- package/dist/storage/domains/skills/index.d.ts.map +1 -0
- package/dist/storage/domains/skills/inmemory.d.ts +31 -0
- package/dist/storage/domains/skills/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/versioned.d.ts +12 -3
- package/dist/storage/domains/versioned.d.ts.map +1 -1
- package/dist/storage/domains/workspaces/base.d.ts +47 -0
- package/dist/storage/domains/workspaces/base.d.ts.map +1 -0
- package/dist/storage/domains/workspaces/index.d.ts +3 -0
- package/dist/storage/domains/workspaces/index.d.ts.map +1 -0
- package/dist/storage/domains/workspaces/inmemory.d.ts +31 -0
- package/dist/storage/domains/workspaces/inmemory.d.ts.map +1 -0
- package/dist/storage/index.cjs +202 -138
- package/dist/storage/index.js +2 -2
- package/dist/storage/mock.d.ts.map +1 -1
- package/dist/storage/types.d.ts +422 -12
- package/dist/storage/types.d.ts.map +1 -1
- 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 +8 -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/tool.d.ts +13 -0
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/toolchecks.d.ts.map +1 -1
- package/dist/tools/types.d.ts +24 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/types/zod-compat.d.ts +27 -6
- package/dist/types/zod-compat.d.ts.map +1 -1
- package/dist/utils.cjs +23 -23
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +12 -12
- package/dist/vector/index.js +2 -2
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/handlers/entry.d.ts.map +1 -1
- package/dist/workflows/index.cjs +25 -25
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/workflow.d.ts +2 -2
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/dist/workspace/constants/index.d.ts +1 -0
- package/dist/workspace/constants/index.d.ts.map +1 -1
- package/dist/workspace/errors.d.ts +3 -0
- package/dist/workspace/errors.d.ts.map +1 -1
- package/dist/workspace/filesystem/composite-filesystem.d.ts +75 -6
- package/dist/workspace/filesystem/composite-filesystem.d.ts.map +1 -1
- package/dist/workspace/filesystem/local-filesystem.d.ts +42 -0
- package/dist/workspace/filesystem/local-filesystem.d.ts.map +1 -1
- package/dist/workspace/glob.d.ts +61 -0
- package/dist/workspace/glob.d.ts.map +1 -0
- package/dist/workspace/index.cjs +133 -41
- package/dist/workspace/index.d.ts +8 -1
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/sandbox/local-sandbox.d.ts.map +1 -1
- package/dist/workspace/skills/composite-versioned-skill-source.d.ts +44 -0
- package/dist/workspace/skills/composite-versioned-skill-source.d.ts.map +1 -0
- package/dist/workspace/skills/index.d.ts +3 -0
- package/dist/workspace/skills/index.d.ts.map +1 -1
- package/dist/workspace/skills/local-skill-source.d.ts.map +1 -1
- package/dist/workspace/skills/publish.d.ts +34 -0
- package/dist/workspace/skills/publish.d.ts.map +1 -0
- package/dist/workspace/skills/skill-source.d.ts +2 -0
- package/dist/workspace/skills/skill-source.d.ts.map +1 -1
- package/dist/workspace/skills/types.d.ts +16 -0
- package/dist/workspace/skills/types.d.ts.map +1 -1
- package/dist/workspace/skills/versioned-skill-source.d.ts +20 -0
- package/dist/workspace/skills/versioned-skill-source.d.ts.map +1 -0
- package/dist/workspace/skills/workspace-skills.d.ts +5 -0
- package/dist/workspace/skills/workspace-skills.d.ts.map +1 -1
- package/dist/workspace/tools/delete-file.d.ts +5 -0
- package/dist/workspace/tools/delete-file.d.ts.map +1 -0
- package/dist/workspace/tools/edit-file.d.ts +7 -0
- package/dist/workspace/tools/edit-file.d.ts.map +1 -0
- package/dist/workspace/tools/execute-command.d.ts +7 -0
- package/dist/workspace/tools/execute-command.d.ts.map +1 -0
- package/dist/workspace/tools/file-stat.d.ts +4 -0
- package/dist/workspace/tools/file-stat.d.ts.map +1 -0
- package/dist/workspace/tools/grep.d.ts +9 -0
- package/dist/workspace/tools/grep.d.ts.map +1 -0
- package/dist/workspace/tools/helpers.d.ts +36 -0
- package/dist/workspace/tools/helpers.d.ts.map +1 -0
- package/dist/workspace/tools/index-content.d.ts +6 -0
- package/dist/workspace/tools/index-content.d.ts.map +1 -0
- package/dist/workspace/tools/index.d.ts +13 -1
- package/dist/workspace/tools/index.d.ts.map +1 -1
- package/dist/workspace/tools/list-files.d.ts +10 -0
- package/dist/workspace/tools/list-files.d.ts.map +1 -0
- package/dist/workspace/tools/mkdir.d.ts +5 -0
- package/dist/workspace/tools/mkdir.d.ts.map +1 -0
- package/dist/workspace/tools/read-file.d.ts +8 -0
- package/dist/workspace/tools/read-file.d.ts.map +1 -0
- package/dist/workspace/tools/search.d.ts +7 -0
- package/dist/workspace/tools/search.d.ts.map +1 -0
- package/dist/workspace/tools/tools.d.ts +5 -7
- package/dist/workspace/tools/tools.d.ts.map +1 -1
- package/dist/workspace/tools/tree-formatter.d.ts +2 -0
- package/dist/workspace/tools/tree-formatter.d.ts.map +1 -1
- package/dist/workspace/tools/write-file.d.ts +6 -0
- package/dist/workspace/tools/write-file.d.ts.map +1 -0
- package/dist/workspace/workspace.d.ts +56 -10
- package/dist/workspace/workspace.d.ts.map +1 -1
- package/harness.d.ts +1 -0
- package/package.json +8 -6
- package/src/llm/model/provider-types.generated.d.ts +312 -93
- package/dist/chunk-3JVFFAJX.cjs.map +0 -1
- package/dist/chunk-3X3CZUXI.js.map +0 -1
- package/dist/chunk-4EHGOATH.js.map +0 -1
- package/dist/chunk-4IJ4UDZX.cjs.map +0 -1
- package/dist/chunk-4KFEMXTV.cjs.map +0 -1
- package/dist/chunk-4TQ4EBYX.js.map +0 -1
- package/dist/chunk-4XSAZPPS.js.map +0 -1
- package/dist/chunk-65PHUUMF.cjs.map +0 -1
- package/dist/chunk-7NKUSQEV.js.map +0 -1
- package/dist/chunk-7UWHFWST.cjs.map +0 -1
- package/dist/chunk-AXHBJ4GX.js.map +0 -1
- package/dist/chunk-AY6DBRS3.js.map +0 -1
- package/dist/chunk-BP7VYTOP.cjs.map +0 -1
- package/dist/chunk-CYUP7QWT.cjs.map +0 -1
- package/dist/chunk-CZ4NQANZ.cjs.map +0 -1
- package/dist/chunk-NJ7TL3LQ.js.map +0 -1
- package/dist/chunk-NZG2JAKS.cjs.map +0 -1
- package/dist/chunk-PS5ONCXY.js.map +0 -1
- package/dist/chunk-RS6CZXGA.js.map +0 -1
- package/dist/chunk-SU5APAM6.cjs.map +0 -1
- package/dist/chunk-V2MLGA7T.js.map +0 -1
- package/dist/chunk-VTE2OBKS.cjs.map +0 -1
- package/dist/chunk-Y3TQ52UE.js.map +0 -1
- package/dist/chunk-YNNJLLFN.cjs.map +0 -1
- package/dist/chunk-ZATLLPIH.js.map +0 -1
- package/dist/models-dev-FQVUTQ7L.js +0 -3
- package/dist/models-dev-PPIXUUCU.cjs +0 -12
- package/dist/provider-registry-6LZAGQET.cjs +0 -40
- package/dist/provider-registry-QUNT7S55.js +0 -3
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkYW54RH77_cjs = require('./chunk-YW54RH77.cjs');
|
|
4
|
+
var chunkKNXZ7KYL_cjs = require('./chunk-KNXZ7KYL.cjs');
|
|
5
|
+
var chunkQDH6MVJ7_cjs = require('./chunk-QDH6MVJ7.cjs');
|
|
6
6
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
7
7
|
var chunkRO47SMI7_cjs = require('./chunk-RO47SMI7.cjs');
|
|
8
|
+
var crypto$1 = require('crypto');
|
|
8
9
|
var jsonToZod = require('@mastra/schema-compat/json-to-zod');
|
|
9
10
|
var zod = require('zod');
|
|
10
11
|
|
|
@@ -67,7 +68,9 @@ var MastraCompositeStore = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
67
68
|
experiments: domainOverrides.experiments ?? defaultStores?.experiments,
|
|
68
69
|
promptBlocks: domainOverrides.promptBlocks ?? defaultStores?.promptBlocks,
|
|
69
70
|
scorerDefinitions: domainOverrides.scorerDefinitions ?? defaultStores?.scorerDefinitions,
|
|
70
|
-
mcpClients: domainOverrides.mcpClients ?? defaultStores?.mcpClients
|
|
71
|
+
mcpClients: domainOverrides.mcpClients ?? defaultStores?.mcpClients,
|
|
72
|
+
workspaces: domainOverrides.workspaces ?? defaultStores?.workspaces,
|
|
73
|
+
skills: domainOverrides.skills ?? defaultStores?.skills
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
76
|
}
|
|
@@ -127,6 +130,15 @@ var MastraCompositeStore = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
127
130
|
if (this.stores?.mcpClients) {
|
|
128
131
|
initTasks.push(this.stores.mcpClients.init());
|
|
129
132
|
}
|
|
133
|
+
if (this.stores?.workspaces) {
|
|
134
|
+
initTasks.push(this.stores.workspaces.init());
|
|
135
|
+
}
|
|
136
|
+
if (this.stores?.skills) {
|
|
137
|
+
initTasks.push(this.stores.skills.init());
|
|
138
|
+
}
|
|
139
|
+
if (this.stores?.blobs) {
|
|
140
|
+
initTasks.push(this.stores.blobs.init());
|
|
141
|
+
}
|
|
130
142
|
this.hasInitialized = Promise.all(initTasks).then(() => true);
|
|
131
143
|
await this.hasInitialized;
|
|
132
144
|
}
|
|
@@ -176,22 +188,28 @@ var VersionedStorageDomain = class extends StorageDomain {
|
|
|
176
188
|
return result;
|
|
177
189
|
}
|
|
178
190
|
/**
|
|
179
|
-
* Resolves an entity by merging its thin record with the active
|
|
191
|
+
* Resolves an entity by merging its thin record with the active or latest version config.
|
|
192
|
+
* Pass `{ status: 'draft' }` to resolve with the latest version instead of the active one.
|
|
180
193
|
*/
|
|
181
|
-
async getByIdResolved(id) {
|
|
194
|
+
async getByIdResolved(id, options) {
|
|
182
195
|
const entity = await this.getById(id);
|
|
183
196
|
if (!entity) {
|
|
184
197
|
return null;
|
|
185
198
|
}
|
|
186
|
-
return this.resolveEntity(entity);
|
|
199
|
+
return this.resolveEntity(entity, options);
|
|
187
200
|
}
|
|
188
201
|
/**
|
|
189
202
|
* Lists entities with version resolution.
|
|
203
|
+
* When `status` is `'draft'`, each entity is resolved with its latest version.
|
|
204
|
+
* When `status` is `'published'` (default), each entity is resolved with its active version.
|
|
190
205
|
*/
|
|
191
206
|
async listResolved(args) {
|
|
192
207
|
const result = await this.list(args);
|
|
208
|
+
const status = args?.status;
|
|
193
209
|
const entities = result[this.listKey];
|
|
194
|
-
const resolved = await Promise.all(
|
|
210
|
+
const resolved = await Promise.all(
|
|
211
|
+
entities.map((entity) => this.resolveEntity(entity, { status }))
|
|
212
|
+
);
|
|
195
213
|
return {
|
|
196
214
|
...result,
|
|
197
215
|
[this.listKey]: resolved
|
|
@@ -199,25 +217,33 @@ var VersionedStorageDomain = class extends StorageDomain {
|
|
|
199
217
|
}
|
|
200
218
|
/**
|
|
201
219
|
* Resolves a single entity by merging it with its active or latest version.
|
|
220
|
+
* - `status: 'published'` (default) — use activeVersionId, fall back to latest.
|
|
221
|
+
* - `status: 'draft'` — always use the latest version.
|
|
202
222
|
*/
|
|
203
|
-
async resolveEntity(entity) {
|
|
223
|
+
async resolveEntity(entity, options) {
|
|
224
|
+
const status = options?.status || "published";
|
|
204
225
|
let version = null;
|
|
205
|
-
if (
|
|
206
|
-
version = await this.
|
|
226
|
+
if (status === "draft") {
|
|
227
|
+
version = await this.getLatestVersion(entity.id);
|
|
228
|
+
} else {
|
|
229
|
+
if (entity.activeVersionId) {
|
|
230
|
+
version = await this.getVersion(entity.activeVersionId);
|
|
231
|
+
if (!version) {
|
|
232
|
+
this.logger?.warn?.(
|
|
233
|
+
`Entity ${entity.id} has activeVersionId ${entity.activeVersionId} but version not found. Falling back to latest version.`
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
207
237
|
if (!version) {
|
|
208
|
-
this.
|
|
209
|
-
`Entity ${entity.id} has activeVersionId ${entity.activeVersionId} but version not found. Falling back to latest version.`
|
|
210
|
-
);
|
|
238
|
+
version = await this.getLatestVersion(entity.id);
|
|
211
239
|
}
|
|
212
240
|
}
|
|
213
|
-
if (!version) {
|
|
214
|
-
version = await this.getLatestVersion(entity.id);
|
|
215
|
-
}
|
|
216
241
|
if (version) {
|
|
217
242
|
const snapshotConfig = this.extractSnapshotConfig(version);
|
|
218
243
|
return {
|
|
219
244
|
...entity,
|
|
220
|
-
...snapshotConfig
|
|
245
|
+
...snapshotConfig,
|
|
246
|
+
resolvedVersionId: version.id
|
|
221
247
|
};
|
|
222
248
|
}
|
|
223
249
|
return entity;
|
|
@@ -313,25 +339,7 @@ var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
|
313
339
|
if (!existingAgent) {
|
|
314
340
|
throw new Error(`Agent with id ${id} not found`);
|
|
315
341
|
}
|
|
316
|
-
const { authorId, activeVersionId, metadata,
|
|
317
|
-
const configFieldNames = [
|
|
318
|
-
"name",
|
|
319
|
-
"description",
|
|
320
|
-
"instructions",
|
|
321
|
-
"model",
|
|
322
|
-
"tools",
|
|
323
|
-
"defaultOptions",
|
|
324
|
-
"workflows",
|
|
325
|
-
"agents",
|
|
326
|
-
"integrationTools",
|
|
327
|
-
"inputProcessors",
|
|
328
|
-
"outputProcessors",
|
|
329
|
-
"memory",
|
|
330
|
-
"scorers",
|
|
331
|
-
"mcpClients",
|
|
332
|
-
"requestContextSchema"
|
|
333
|
-
];
|
|
334
|
-
const hasConfigUpdate = configFieldNames.some((field) => field in configFields);
|
|
342
|
+
const { authorId, activeVersionId, metadata, status } = updates;
|
|
335
343
|
const updatedAgent = {
|
|
336
344
|
...existingAgent,
|
|
337
345
|
...authorId !== void 0 && { authorId },
|
|
@@ -339,48 +347,9 @@ var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
|
339
347
|
...metadata !== void 0 && {
|
|
340
348
|
metadata: { ...existingAgent.metadata, ...metadata }
|
|
341
349
|
},
|
|
350
|
+
...status !== void 0 && { status },
|
|
342
351
|
updatedAt: /* @__PURE__ */ new Date()
|
|
343
352
|
};
|
|
344
|
-
if (activeVersionId !== void 0) {
|
|
345
|
-
updatedAgent.status = "published";
|
|
346
|
-
}
|
|
347
|
-
if (hasConfigUpdate) {
|
|
348
|
-
const latestVersion = await this.getLatestVersion(id);
|
|
349
|
-
if (!latestVersion) {
|
|
350
|
-
throw new Error(`No versions found for agent ${id}`);
|
|
351
|
-
}
|
|
352
|
-
const {
|
|
353
|
-
id: _versionId,
|
|
354
|
-
agentId: _agentId,
|
|
355
|
-
versionNumber: _versionNumber,
|
|
356
|
-
changedFields: _changedFields,
|
|
357
|
-
changeMessage: _changeMessage,
|
|
358
|
-
createdAt: _createdAt,
|
|
359
|
-
...latestConfig
|
|
360
|
-
} = latestVersion;
|
|
361
|
-
const sanitizedConfigFields = Object.fromEntries(
|
|
362
|
-
Object.entries(configFields).map(([key, value]) => [key, value === null ? void 0 : value])
|
|
363
|
-
);
|
|
364
|
-
const newConfig = {
|
|
365
|
-
...latestConfig,
|
|
366
|
-
...sanitizedConfigFields
|
|
367
|
-
};
|
|
368
|
-
const changedFields = configFieldNames.filter(
|
|
369
|
-
(field) => field in configFields && JSON.stringify(configFields[field]) !== JSON.stringify(latestConfig[field])
|
|
370
|
-
);
|
|
371
|
-
if (changedFields.length > 0) {
|
|
372
|
-
const newVersionId = crypto.randomUUID();
|
|
373
|
-
const newVersionNumber = latestVersion.versionNumber + 1;
|
|
374
|
-
await this.createVersion({
|
|
375
|
-
id: newVersionId,
|
|
376
|
-
agentId: id,
|
|
377
|
-
versionNumber: newVersionNumber,
|
|
378
|
-
...newConfig,
|
|
379
|
-
changedFields,
|
|
380
|
-
changeMessage: `Updated ${changedFields.join(", ")}`
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
353
|
this.db.agents.set(id, updatedAgent);
|
|
385
354
|
return this.deepCopyAgent(updatedAgent);
|
|
386
355
|
}
|
|
@@ -390,7 +359,7 @@ var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
|
390
359
|
await this.deleteVersionsByParentId(id);
|
|
391
360
|
}
|
|
392
361
|
async list(args) {
|
|
393
|
-
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata } = args || {};
|
|
362
|
+
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata, status } = args || {};
|
|
394
363
|
const { field, direction } = this.parseOrderBy(orderBy);
|
|
395
364
|
this.logger.debug(`InMemoryAgentsStorage: list called`);
|
|
396
365
|
const perPage = normalizePerPage(perPageInput, 100);
|
|
@@ -402,13 +371,16 @@ var InMemoryAgentsStorage = class extends AgentsStorage {
|
|
|
402
371
|
throw new Error("page value too large");
|
|
403
372
|
}
|
|
404
373
|
let agents = Array.from(this.db.agents.values());
|
|
374
|
+
if (status) {
|
|
375
|
+
agents = agents.filter((agent) => agent.status === status);
|
|
376
|
+
}
|
|
405
377
|
if (authorId !== void 0) {
|
|
406
378
|
agents = agents.filter((agent) => agent.authorId === authorId);
|
|
407
379
|
}
|
|
408
380
|
if (metadata && Object.keys(metadata).length > 0) {
|
|
409
381
|
agents = agents.filter((agent) => {
|
|
410
382
|
if (!agent.metadata) return false;
|
|
411
|
-
return Object.entries(metadata).every(([key, value]) =>
|
|
383
|
+
return Object.entries(metadata).every(([key, value]) => chunkQDH6MVJ7_cjs.deepEqual(agent.metadata[key], value));
|
|
412
384
|
});
|
|
413
385
|
}
|
|
414
386
|
const sortedAgents = this.sortAgents(agents, field, direction);
|
|
@@ -577,6 +549,10 @@ var InMemoryDB = class {
|
|
|
577
549
|
scorerDefinitionVersions = /* @__PURE__ */ new Map();
|
|
578
550
|
mcpClients = /* @__PURE__ */ new Map();
|
|
579
551
|
mcpClientVersions = /* @__PURE__ */ new Map();
|
|
552
|
+
workspaces = /* @__PURE__ */ new Map();
|
|
553
|
+
workspaceVersions = /* @__PURE__ */ new Map();
|
|
554
|
+
skills = /* @__PURE__ */ new Map();
|
|
555
|
+
skillVersions = /* @__PURE__ */ new Map();
|
|
580
556
|
/** Observational memory records, keyed by resourceId, each holding array of records (generations) */
|
|
581
557
|
observationalMemory = /* @__PURE__ */ new Map();
|
|
582
558
|
// Dataset domain maps
|
|
@@ -605,6 +581,10 @@ var InMemoryDB = class {
|
|
|
605
581
|
this.scorerDefinitionVersions.clear();
|
|
606
582
|
this.mcpClients.clear();
|
|
607
583
|
this.mcpClientVersions.clear();
|
|
584
|
+
this.workspaces.clear();
|
|
585
|
+
this.workspaceVersions.clear();
|
|
586
|
+
this.skills.clear();
|
|
587
|
+
this.skillVersions.clear();
|
|
608
588
|
this.observationalMemory.clear();
|
|
609
589
|
this.datasets.clear();
|
|
610
590
|
this.datasetItems.clear();
|
|
@@ -688,9 +668,7 @@ var InMemoryMCPClientsStorage = class extends MCPClientsStorage {
|
|
|
688
668
|
if (!existingConfig) {
|
|
689
669
|
throw new Error(`MCP client with id ${id} not found`);
|
|
690
670
|
}
|
|
691
|
-
const { authorId, activeVersionId, metadata, status
|
|
692
|
-
const configFieldNames = ["name", "description", "servers"];
|
|
693
|
-
const hasConfigUpdate = configFieldNames.some((field) => field in configFields);
|
|
671
|
+
const { authorId, activeVersionId, metadata, status } = updates;
|
|
694
672
|
const updatedConfig = {
|
|
695
673
|
...existingConfig,
|
|
696
674
|
...authorId !== void 0 && { authorId },
|
|
@@ -701,43 +679,6 @@ var InMemoryMCPClientsStorage = class extends MCPClientsStorage {
|
|
|
701
679
|
},
|
|
702
680
|
updatedAt: /* @__PURE__ */ new Date()
|
|
703
681
|
};
|
|
704
|
-
if (activeVersionId !== void 0 && status === void 0) {
|
|
705
|
-
updatedConfig.status = "published";
|
|
706
|
-
}
|
|
707
|
-
if (hasConfigUpdate) {
|
|
708
|
-
const latestVersion = await this.getLatestVersion(id);
|
|
709
|
-
if (!latestVersion) {
|
|
710
|
-
throw new Error(`No versions found for MCP client ${id}`);
|
|
711
|
-
}
|
|
712
|
-
const {
|
|
713
|
-
id: _versionId,
|
|
714
|
-
mcpClientId: _mcpClientId,
|
|
715
|
-
versionNumber: _versionNumber,
|
|
716
|
-
changedFields: _changedFields,
|
|
717
|
-
changeMessage: _changeMessage,
|
|
718
|
-
createdAt: _createdAt,
|
|
719
|
-
...latestConfig
|
|
720
|
-
} = latestVersion;
|
|
721
|
-
const newConfig = {
|
|
722
|
-
...latestConfig,
|
|
723
|
-
...configFields
|
|
724
|
-
};
|
|
725
|
-
const changedFields = configFieldNames.filter(
|
|
726
|
-
(field) => field in configFields && JSON.stringify(configFields[field]) !== JSON.stringify(latestConfig[field])
|
|
727
|
-
);
|
|
728
|
-
if (changedFields.length > 0) {
|
|
729
|
-
const newVersionId = crypto.randomUUID();
|
|
730
|
-
const newVersionNumber = latestVersion.versionNumber + 1;
|
|
731
|
-
await this.createVersion({
|
|
732
|
-
id: newVersionId,
|
|
733
|
-
mcpClientId: id,
|
|
734
|
-
versionNumber: newVersionNumber,
|
|
735
|
-
...newConfig,
|
|
736
|
-
changedFields,
|
|
737
|
-
changeMessage: `Updated ${changedFields.join(", ")}`
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
682
|
this.db.mcpClients.set(id, updatedConfig);
|
|
742
683
|
return this.deepCopyConfig(updatedConfig);
|
|
743
684
|
}
|
|
@@ -747,7 +688,7 @@ var InMemoryMCPClientsStorage = class extends MCPClientsStorage {
|
|
|
747
688
|
await this.deleteVersionsByParentId(id);
|
|
748
689
|
}
|
|
749
690
|
async list(args) {
|
|
750
|
-
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata } = args || {};
|
|
691
|
+
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata, status } = args || {};
|
|
751
692
|
const { field, direction } = this.parseOrderBy(orderBy);
|
|
752
693
|
this.logger.debug(`InMemoryMCPClientsStorage: list called`);
|
|
753
694
|
const perPage = normalizePerPage(perPageInput, 100);
|
|
@@ -759,13 +700,16 @@ var InMemoryMCPClientsStorage = class extends MCPClientsStorage {
|
|
|
759
700
|
throw new Error("page value too large");
|
|
760
701
|
}
|
|
761
702
|
let configs = Array.from(this.db.mcpClients.values());
|
|
703
|
+
if (status) {
|
|
704
|
+
configs = configs.filter((config) => config.status === status);
|
|
705
|
+
}
|
|
762
706
|
if (authorId !== void 0) {
|
|
763
707
|
configs = configs.filter((config) => config.authorId === authorId);
|
|
764
708
|
}
|
|
765
709
|
if (metadata && Object.keys(metadata).length > 0) {
|
|
766
710
|
configs = configs.filter((config) => {
|
|
767
711
|
if (!config.metadata) return false;
|
|
768
|
-
return Object.entries(metadata).every(([key, value]) =>
|
|
712
|
+
return Object.entries(metadata).every(([key, value]) => chunkQDH6MVJ7_cjs.deepEqual(config.metadata[key], value));
|
|
769
713
|
});
|
|
770
714
|
}
|
|
771
715
|
const sortedConfigs = this.sortConfigs(configs, field, direction);
|
|
@@ -933,7 +877,7 @@ function safelyParseJSON(input) {
|
|
|
933
877
|
}
|
|
934
878
|
function transformRow(row, tableName, options = {}) {
|
|
935
879
|
const { preferredTimestampFields = {}, convertTimestamps = false, nullValuePattern, fieldMappings = {} } = options;
|
|
936
|
-
const tableSchema =
|
|
880
|
+
const tableSchema = chunkKNXZ7KYL_cjs.TABLE_SCHEMAS[tableName];
|
|
937
881
|
const result = {};
|
|
938
882
|
for (const [key, columnSchema] of Object.entries(tableSchema)) {
|
|
939
883
|
const sourceKey = fieldMappings[key] ?? key;
|
|
@@ -964,7 +908,7 @@ function transformRow(row, tableName, options = {}) {
|
|
|
964
908
|
return result;
|
|
965
909
|
}
|
|
966
910
|
function transformScoreRow(row, options = {}) {
|
|
967
|
-
return transformRow(row,
|
|
911
|
+
return transformRow(row, chunkKNXZ7KYL_cjs.TABLE_SCORERS, options);
|
|
968
912
|
}
|
|
969
913
|
function toUpperSnakeCase(str) {
|
|
970
914
|
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, "");
|
|
@@ -1586,7 +1530,7 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
1586
1530
|
});
|
|
1587
1531
|
const total = messages.length;
|
|
1588
1532
|
const paginatedMessages = messages.slice(offset, offset + perPage);
|
|
1589
|
-
const list = new
|
|
1533
|
+
const list = new chunkYW54RH77_cjs.MessageList().add(
|
|
1590
1534
|
paginatedMessages.map((m) => this.parseStoredMessage(m)),
|
|
1591
1535
|
"memory"
|
|
1592
1536
|
);
|
|
@@ -1620,7 +1564,7 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
1620
1564
|
async listMessagesById({ messageIds }) {
|
|
1621
1565
|
this.logger.debug(`InMemoryMemory: listMessagesById called`);
|
|
1622
1566
|
const rawMessages = messageIds.map((id) => this.db.messages.get(id)).filter((message) => !!message);
|
|
1623
|
-
const list = new
|
|
1567
|
+
const list = new chunkYW54RH77_cjs.MessageList().add(
|
|
1624
1568
|
rawMessages.map((m) => this.parseStoredMessage(m)),
|
|
1625
1569
|
"memory"
|
|
1626
1570
|
);
|
|
@@ -1652,7 +1596,7 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
1652
1596
|
};
|
|
1653
1597
|
this.db.messages.set(key, storageMessage);
|
|
1654
1598
|
}
|
|
1655
|
-
const list = new
|
|
1599
|
+
const list = new chunkYW54RH77_cjs.MessageList().add(messages, "memory");
|
|
1656
1600
|
return { messages: list.get.all.db() };
|
|
1657
1601
|
}
|
|
1658
1602
|
async updateMessages(args) {
|
|
@@ -2493,7 +2437,7 @@ var ObservabilityInMemory = class extends ObservabilityStorage {
|
|
|
2493
2437
|
};
|
|
2494
2438
|
}
|
|
2495
2439
|
async listTraces(args) {
|
|
2496
|
-
const { filters, pagination, orderBy } =
|
|
2440
|
+
const { filters, pagination, orderBy } = chunkKNXZ7KYL_cjs.listTracesArgsSchema.parse(args);
|
|
2497
2441
|
const matchingRootSpans = [];
|
|
2498
2442
|
for (const [, traceEntry] of this.db.traces) {
|
|
2499
2443
|
if (!traceEntry.rootSpan) continue;
|
|
@@ -2522,7 +2466,7 @@ var ObservabilityInMemory = class extends ObservabilityStorage {
|
|
|
2522
2466
|
const end = start + perPage;
|
|
2523
2467
|
const paged = matchingRootSpans.slice(start, end);
|
|
2524
2468
|
return {
|
|
2525
|
-
spans:
|
|
2469
|
+
spans: chunkKNXZ7KYL_cjs.toTraceSpans(paged),
|
|
2526
2470
|
pagination: { total, page, perPage, hasMore: end < total }
|
|
2527
2471
|
};
|
|
2528
2472
|
}
|
|
@@ -2747,9 +2691,7 @@ var InMemoryPromptBlocksStorage = class extends PromptBlocksStorage {
|
|
|
2747
2691
|
if (!existingBlock) {
|
|
2748
2692
|
throw new Error(`Prompt block with id ${id} not found`);
|
|
2749
2693
|
}
|
|
2750
|
-
const { authorId, activeVersionId, metadata, status
|
|
2751
|
-
const configFieldNames = ["name", "description", "content", "rules"];
|
|
2752
|
-
const hasConfigUpdate = configFieldNames.some((field) => field in configFields);
|
|
2694
|
+
const { authorId, activeVersionId, metadata, status } = updates;
|
|
2753
2695
|
const updatedBlock = {
|
|
2754
2696
|
...existingBlock,
|
|
2755
2697
|
...authorId !== void 0 && { authorId },
|
|
@@ -2760,43 +2702,6 @@ var InMemoryPromptBlocksStorage = class extends PromptBlocksStorage {
|
|
|
2760
2702
|
},
|
|
2761
2703
|
updatedAt: /* @__PURE__ */ new Date()
|
|
2762
2704
|
};
|
|
2763
|
-
if (activeVersionId !== void 0) {
|
|
2764
|
-
updatedBlock.status = "published";
|
|
2765
|
-
}
|
|
2766
|
-
if (hasConfigUpdate) {
|
|
2767
|
-
const latestVersion = await this.getLatestVersion(id);
|
|
2768
|
-
if (!latestVersion) {
|
|
2769
|
-
throw new Error(`No versions found for prompt block ${id}`);
|
|
2770
|
-
}
|
|
2771
|
-
const {
|
|
2772
|
-
id: _versionId,
|
|
2773
|
-
blockId: _blockId,
|
|
2774
|
-
versionNumber: _versionNumber,
|
|
2775
|
-
changedFields: _changedFields,
|
|
2776
|
-
changeMessage: _changeMessage,
|
|
2777
|
-
createdAt: _createdAt,
|
|
2778
|
-
...latestConfig
|
|
2779
|
-
} = latestVersion;
|
|
2780
|
-
const newConfig = {
|
|
2781
|
-
...latestConfig,
|
|
2782
|
-
...configFields
|
|
2783
|
-
};
|
|
2784
|
-
const changedFields = configFieldNames.filter(
|
|
2785
|
-
(field) => field in configFields && JSON.stringify(configFields[field]) !== JSON.stringify(latestConfig[field])
|
|
2786
|
-
);
|
|
2787
|
-
if (changedFields.length > 0) {
|
|
2788
|
-
const newVersionId = crypto.randomUUID();
|
|
2789
|
-
const newVersionNumber = latestVersion.versionNumber + 1;
|
|
2790
|
-
await this.createVersion({
|
|
2791
|
-
id: newVersionId,
|
|
2792
|
-
blockId: id,
|
|
2793
|
-
versionNumber: newVersionNumber,
|
|
2794
|
-
...newConfig,
|
|
2795
|
-
changedFields,
|
|
2796
|
-
changeMessage: `Updated ${changedFields.join(", ")}`
|
|
2797
|
-
});
|
|
2798
|
-
}
|
|
2799
|
-
}
|
|
2800
2705
|
this.db.promptBlocks.set(id, updatedBlock);
|
|
2801
2706
|
return this.deepCopyBlock(updatedBlock);
|
|
2802
2707
|
}
|
|
@@ -2806,7 +2711,7 @@ var InMemoryPromptBlocksStorage = class extends PromptBlocksStorage {
|
|
|
2806
2711
|
await this.deleteVersionsByParentId(id);
|
|
2807
2712
|
}
|
|
2808
2713
|
async list(args) {
|
|
2809
|
-
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata } = args || {};
|
|
2714
|
+
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata, status } = args || {};
|
|
2810
2715
|
const { field, direction } = this.parseOrderBy(orderBy);
|
|
2811
2716
|
this.logger.debug(`InMemoryPromptBlocksStorage: list called`);
|
|
2812
2717
|
const perPage = normalizePerPage(perPageInput, 100);
|
|
@@ -2818,13 +2723,16 @@ var InMemoryPromptBlocksStorage = class extends PromptBlocksStorage {
|
|
|
2818
2723
|
throw new Error("page value too large");
|
|
2819
2724
|
}
|
|
2820
2725
|
let blocks = Array.from(this.db.promptBlocks.values());
|
|
2726
|
+
if (status) {
|
|
2727
|
+
blocks = blocks.filter((block) => block.status === status);
|
|
2728
|
+
}
|
|
2821
2729
|
if (authorId !== void 0) {
|
|
2822
2730
|
blocks = blocks.filter((block) => block.authorId === authorId);
|
|
2823
2731
|
}
|
|
2824
2732
|
if (metadata && Object.keys(metadata).length > 0) {
|
|
2825
2733
|
blocks = blocks.filter((block) => {
|
|
2826
2734
|
if (!block.metadata) return false;
|
|
2827
|
-
return Object.entries(metadata).every(([key, value]) =>
|
|
2735
|
+
return Object.entries(metadata).every(([key, value]) => chunkQDH6MVJ7_cjs.deepEqual(block.metadata[key], value));
|
|
2828
2736
|
});
|
|
2829
2737
|
}
|
|
2830
2738
|
const sortedBlocks = this.sortBlocks(blocks, field, direction);
|
|
@@ -3049,18 +2957,7 @@ var InMemoryScorerDefinitionsStorage = class extends ScorerDefinitionsStorage {
|
|
|
3049
2957
|
if (!existingScorer) {
|
|
3050
2958
|
throw new Error(`Scorer definition with id ${id} not found`);
|
|
3051
2959
|
}
|
|
3052
|
-
const { authorId, activeVersionId, metadata, status
|
|
3053
|
-
const configFieldNames = [
|
|
3054
|
-
"name",
|
|
3055
|
-
"description",
|
|
3056
|
-
"type",
|
|
3057
|
-
"model",
|
|
3058
|
-
"instructions",
|
|
3059
|
-
"scoreRange",
|
|
3060
|
-
"presetConfig",
|
|
3061
|
-
"defaultSampling"
|
|
3062
|
-
];
|
|
3063
|
-
const hasConfigUpdate = configFieldNames.some((field) => field in configFields);
|
|
2960
|
+
const { authorId, activeVersionId, metadata, status } = updates;
|
|
3064
2961
|
const updatedScorer = {
|
|
3065
2962
|
...existingScorer,
|
|
3066
2963
|
...authorId !== void 0 && { authorId },
|
|
@@ -3071,43 +2968,6 @@ var InMemoryScorerDefinitionsStorage = class extends ScorerDefinitionsStorage {
|
|
|
3071
2968
|
},
|
|
3072
2969
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3073
2970
|
};
|
|
3074
|
-
if (activeVersionId !== void 0) {
|
|
3075
|
-
updatedScorer.status = "published";
|
|
3076
|
-
}
|
|
3077
|
-
if (hasConfigUpdate) {
|
|
3078
|
-
const latestVersion = await this.getLatestVersion(id);
|
|
3079
|
-
if (!latestVersion) {
|
|
3080
|
-
throw new Error(`No versions found for scorer definition ${id}`);
|
|
3081
|
-
}
|
|
3082
|
-
const {
|
|
3083
|
-
id: _versionId,
|
|
3084
|
-
scorerDefinitionId: _scorerDefinitionId,
|
|
3085
|
-
versionNumber: _versionNumber,
|
|
3086
|
-
changedFields: _changedFields,
|
|
3087
|
-
changeMessage: _changeMessage,
|
|
3088
|
-
createdAt: _createdAt,
|
|
3089
|
-
...latestConfig
|
|
3090
|
-
} = latestVersion;
|
|
3091
|
-
const newConfig = {
|
|
3092
|
-
...latestConfig,
|
|
3093
|
-
...configFields
|
|
3094
|
-
};
|
|
3095
|
-
const changedFields = configFieldNames.filter(
|
|
3096
|
-
(field) => field in configFields && JSON.stringify(configFields[field]) !== JSON.stringify(latestConfig[field])
|
|
3097
|
-
);
|
|
3098
|
-
if (changedFields.length > 0) {
|
|
3099
|
-
const newVersionId = crypto.randomUUID();
|
|
3100
|
-
const newVersionNumber = latestVersion.versionNumber + 1;
|
|
3101
|
-
await this.createVersion({
|
|
3102
|
-
id: newVersionId,
|
|
3103
|
-
scorerDefinitionId: id,
|
|
3104
|
-
versionNumber: newVersionNumber,
|
|
3105
|
-
...newConfig,
|
|
3106
|
-
changedFields,
|
|
3107
|
-
changeMessage: `Updated ${changedFields.join(", ")}`
|
|
3108
|
-
});
|
|
3109
|
-
}
|
|
3110
|
-
}
|
|
3111
2971
|
this.db.scorerDefinitions.set(id, updatedScorer);
|
|
3112
2972
|
return this.deepCopyScorer(updatedScorer);
|
|
3113
2973
|
}
|
|
@@ -3117,7 +2977,7 @@ var InMemoryScorerDefinitionsStorage = class extends ScorerDefinitionsStorage {
|
|
|
3117
2977
|
await this.deleteVersionsByParentId(id);
|
|
3118
2978
|
}
|
|
3119
2979
|
async list(args) {
|
|
3120
|
-
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata } = args || {};
|
|
2980
|
+
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata, status } = args || {};
|
|
3121
2981
|
const { field, direction } = this.parseOrderBy(orderBy);
|
|
3122
2982
|
this.logger.debug(`InMemoryScorerDefinitionsStorage: list called`);
|
|
3123
2983
|
const perPage = normalizePerPage(perPageInput, 100);
|
|
@@ -3129,13 +2989,16 @@ var InMemoryScorerDefinitionsStorage = class extends ScorerDefinitionsStorage {
|
|
|
3129
2989
|
throw new Error("page value too large");
|
|
3130
2990
|
}
|
|
3131
2991
|
let scorers = Array.from(this.db.scorerDefinitions.values());
|
|
2992
|
+
if (status) {
|
|
2993
|
+
scorers = scorers.filter((scorer) => scorer.status === status);
|
|
2994
|
+
}
|
|
3132
2995
|
if (authorId !== void 0) {
|
|
3133
2996
|
scorers = scorers.filter((scorer) => scorer.authorId === authorId);
|
|
3134
2997
|
}
|
|
3135
2998
|
if (metadata && Object.keys(metadata).length > 0) {
|
|
3136
2999
|
scorers = scorers.filter((scorer) => {
|
|
3137
3000
|
if (!scorer.metadata) return false;
|
|
3138
|
-
return Object.entries(metadata).every(([key, value]) =>
|
|
3001
|
+
return Object.entries(metadata).every(([key, value]) => chunkQDH6MVJ7_cjs.deepEqual(scorer.metadata[key], value));
|
|
3139
3002
|
});
|
|
3140
3003
|
}
|
|
3141
3004
|
const sortedScorers = this.sortScorers(scorers, field, direction);
|
|
@@ -3448,84 +3311,393 @@ var ScoresInMemory = class extends ScoresStorage {
|
|
|
3448
3311
|
}
|
|
3449
3312
|
};
|
|
3450
3313
|
|
|
3451
|
-
// src/
|
|
3452
|
-
var
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3314
|
+
// src/storage/domains/skills/base.ts
|
|
3315
|
+
var SkillsStorage = class extends VersionedStorageDomain {
|
|
3316
|
+
listKey = "skills";
|
|
3317
|
+
versionMetadataFields = [
|
|
3318
|
+
"id",
|
|
3319
|
+
"skillId",
|
|
3320
|
+
"versionNumber",
|
|
3321
|
+
"changedFields",
|
|
3322
|
+
"changeMessage",
|
|
3323
|
+
"createdAt"
|
|
3324
|
+
];
|
|
3462
3325
|
constructor() {
|
|
3463
3326
|
super({
|
|
3464
3327
|
component: "STORAGE",
|
|
3465
|
-
name: "
|
|
3328
|
+
name: "SKILLS"
|
|
3466
3329
|
});
|
|
3467
3330
|
}
|
|
3468
3331
|
};
|
|
3469
3332
|
|
|
3470
|
-
// src/storage/domains/
|
|
3471
|
-
var
|
|
3333
|
+
// src/storage/domains/skills/inmemory.ts
|
|
3334
|
+
var InMemorySkillsStorage = class extends SkillsStorage {
|
|
3472
3335
|
db;
|
|
3473
3336
|
constructor({ db }) {
|
|
3474
3337
|
super();
|
|
3475
3338
|
this.db = db;
|
|
3476
3339
|
}
|
|
3477
3340
|
async dangerouslyClearAll() {
|
|
3478
|
-
this.db.
|
|
3341
|
+
this.db.skills.clear();
|
|
3342
|
+
this.db.skillVersions.clear();
|
|
3479
3343
|
}
|
|
3480
|
-
|
|
3481
|
-
|
|
3344
|
+
// ==========================================================================
|
|
3345
|
+
// Skill CRUD Methods
|
|
3346
|
+
// ==========================================================================
|
|
3347
|
+
async getById(id) {
|
|
3348
|
+
this.logger.debug(`InMemorySkillsStorage: getById called for ${id}`);
|
|
3349
|
+
const config = this.db.skills.get(id);
|
|
3350
|
+
return config ? this.deepCopyConfig(config) : null;
|
|
3482
3351
|
}
|
|
3483
|
-
async
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
requestContext
|
|
3489
|
-
}) {
|
|
3490
|
-
this.logger.debug(`WorkflowsInMemory: updateWorkflowResults called for ${workflowName} ${runId} ${stepId}`, result);
|
|
3491
|
-
const key = this.getWorkflowKey(workflowName, runId);
|
|
3492
|
-
const run = this.db.workflows.get(key);
|
|
3493
|
-
if (!run) {
|
|
3494
|
-
return {};
|
|
3352
|
+
async create(input) {
|
|
3353
|
+
const { skill } = input;
|
|
3354
|
+
this.logger.debug(`InMemorySkillsStorage: create called for ${skill.id}`);
|
|
3355
|
+
if (this.db.skills.has(skill.id)) {
|
|
3356
|
+
throw new Error(`Skill with id ${skill.id} already exists`);
|
|
3495
3357
|
}
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3358
|
+
const now = /* @__PURE__ */ new Date();
|
|
3359
|
+
const newConfig = {
|
|
3360
|
+
id: skill.id,
|
|
3361
|
+
status: "draft",
|
|
3362
|
+
activeVersionId: void 0,
|
|
3363
|
+
authorId: skill.authorId,
|
|
3364
|
+
createdAt: now,
|
|
3365
|
+
updatedAt: now
|
|
3366
|
+
};
|
|
3367
|
+
this.db.skills.set(skill.id, newConfig);
|
|
3368
|
+
const { id: _id, authorId: _authorId, ...snapshotConfig } = skill;
|
|
3369
|
+
const versionId = crypto$1.randomUUID();
|
|
3370
|
+
try {
|
|
3371
|
+
await this.createVersion({
|
|
3372
|
+
id: versionId,
|
|
3373
|
+
skillId: skill.id,
|
|
3374
|
+
versionNumber: 1,
|
|
3375
|
+
...snapshotConfig,
|
|
3376
|
+
changedFields: Object.keys(snapshotConfig),
|
|
3377
|
+
changeMessage: "Initial version"
|
|
3514
3378
|
});
|
|
3515
|
-
}
|
|
3516
|
-
|
|
3379
|
+
} catch (error) {
|
|
3380
|
+
this.db.skills.delete(skill.id);
|
|
3381
|
+
throw error;
|
|
3517
3382
|
}
|
|
3518
|
-
|
|
3519
|
-
|
|
3383
|
+
return this.deepCopyConfig(newConfig);
|
|
3384
|
+
}
|
|
3385
|
+
async update(input) {
|
|
3386
|
+
const { id, ...updates } = input;
|
|
3387
|
+
this.logger.debug(`InMemorySkillsStorage: update called for ${id}`);
|
|
3388
|
+
const existingConfig = this.db.skills.get(id);
|
|
3389
|
+
if (!existingConfig) {
|
|
3390
|
+
throw new Error(`Skill with id ${id} not found`);
|
|
3520
3391
|
}
|
|
3521
|
-
const
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3392
|
+
const { authorId, activeVersionId, status, ...configFields } = updates;
|
|
3393
|
+
const configFieldNames = [
|
|
3394
|
+
"name",
|
|
3395
|
+
"description",
|
|
3396
|
+
"instructions",
|
|
3397
|
+
"license",
|
|
3398
|
+
"compatibility",
|
|
3399
|
+
"source",
|
|
3400
|
+
"references",
|
|
3401
|
+
"scripts",
|
|
3402
|
+
"assets",
|
|
3403
|
+
"metadata",
|
|
3404
|
+
"tree"
|
|
3405
|
+
];
|
|
3406
|
+
const hasConfigUpdate = configFieldNames.some((field) => field in configFields);
|
|
3407
|
+
const updatedConfig = {
|
|
3408
|
+
...existingConfig,
|
|
3409
|
+
...authorId !== void 0 && { authorId },
|
|
3410
|
+
...activeVersionId !== void 0 && { activeVersionId },
|
|
3411
|
+
...status !== void 0 && { status },
|
|
3412
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
3413
|
+
};
|
|
3414
|
+
if (activeVersionId !== void 0 && status === void 0) {
|
|
3415
|
+
updatedConfig.status = "published";
|
|
3416
|
+
}
|
|
3417
|
+
if (hasConfigUpdate) {
|
|
3418
|
+
const latestVersion = await this.getLatestVersion(id);
|
|
3419
|
+
if (!latestVersion) {
|
|
3420
|
+
throw new Error(`No versions found for skill ${id}`);
|
|
3421
|
+
}
|
|
3422
|
+
const {
|
|
3423
|
+
id: _versionId,
|
|
3424
|
+
skillId: _skillId,
|
|
3425
|
+
versionNumber: _versionNumber,
|
|
3426
|
+
changedFields: _changedFields,
|
|
3427
|
+
changeMessage: _changeMessage,
|
|
3428
|
+
createdAt: _createdAt,
|
|
3429
|
+
...latestConfig
|
|
3430
|
+
} = latestVersion;
|
|
3431
|
+
const newConfig = {
|
|
3432
|
+
...latestConfig,
|
|
3433
|
+
...configFields
|
|
3434
|
+
};
|
|
3435
|
+
const changedFields = configFieldNames.filter(
|
|
3436
|
+
(field) => field in configFields && JSON.stringify(configFields[field]) !== JSON.stringify(latestConfig[field])
|
|
3437
|
+
);
|
|
3438
|
+
if (changedFields.length > 0) {
|
|
3439
|
+
const newVersionId = crypto$1.randomUUID();
|
|
3440
|
+
const newVersionNumber = latestVersion.versionNumber + 1;
|
|
3441
|
+
await this.createVersion({
|
|
3442
|
+
id: newVersionId,
|
|
3443
|
+
skillId: id,
|
|
3444
|
+
versionNumber: newVersionNumber,
|
|
3445
|
+
...newConfig,
|
|
3446
|
+
changedFields,
|
|
3447
|
+
changeMessage: `Updated ${changedFields.join(", ")}`
|
|
3448
|
+
});
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
this.db.skills.set(id, updatedConfig);
|
|
3452
|
+
return this.deepCopyConfig(updatedConfig);
|
|
3453
|
+
}
|
|
3454
|
+
async delete(id) {
|
|
3455
|
+
this.logger.debug(`InMemorySkillsStorage: delete called for ${id}`);
|
|
3456
|
+
this.db.skills.delete(id);
|
|
3457
|
+
await this.deleteVersionsByParentId(id);
|
|
3458
|
+
}
|
|
3459
|
+
async list(args) {
|
|
3460
|
+
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata } = args || {};
|
|
3461
|
+
const { field, direction } = this.parseOrderBy(orderBy);
|
|
3462
|
+
this.logger.debug(`InMemorySkillsStorage: list called`);
|
|
3463
|
+
const perPage = normalizePerPage(perPageInput, 100);
|
|
3464
|
+
if (page < 0) {
|
|
3465
|
+
throw new Error("page must be >= 0");
|
|
3466
|
+
}
|
|
3467
|
+
const maxOffset = Number.MAX_SAFE_INTEGER / 2;
|
|
3468
|
+
if (page * perPage > maxOffset) {
|
|
3469
|
+
throw new Error("page value too large");
|
|
3470
|
+
}
|
|
3471
|
+
let configs = Array.from(this.db.skills.values());
|
|
3472
|
+
if (authorId !== void 0) {
|
|
3473
|
+
configs = configs.filter((config) => config.authorId === authorId);
|
|
3474
|
+
}
|
|
3475
|
+
if (metadata && Object.keys(metadata).length > 0) {
|
|
3476
|
+
configs = configs.filter((_config) => {
|
|
3477
|
+
return false;
|
|
3478
|
+
});
|
|
3479
|
+
}
|
|
3480
|
+
const sortedConfigs = this.sortConfigs(configs, field, direction);
|
|
3481
|
+
const clonedConfigs = sortedConfigs.map((config) => this.deepCopyConfig(config));
|
|
3482
|
+
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
3483
|
+
return {
|
|
3484
|
+
skills: clonedConfigs.slice(offset, offset + perPage),
|
|
3485
|
+
total: clonedConfigs.length,
|
|
3486
|
+
page,
|
|
3487
|
+
perPage: perPageForResponse,
|
|
3488
|
+
hasMore: offset + perPage < clonedConfigs.length
|
|
3489
|
+
};
|
|
3490
|
+
}
|
|
3491
|
+
// ==========================================================================
|
|
3492
|
+
// Skill Version Methods
|
|
3493
|
+
// ==========================================================================
|
|
3494
|
+
async createVersion(input) {
|
|
3495
|
+
this.logger.debug(`InMemorySkillsStorage: createVersion called for skill ${input.skillId}`);
|
|
3496
|
+
if (this.db.skillVersions.has(input.id)) {
|
|
3497
|
+
throw new Error(`Version with id ${input.id} already exists`);
|
|
3498
|
+
}
|
|
3499
|
+
for (const version2 of this.db.skillVersions.values()) {
|
|
3500
|
+
if (version2.skillId === input.skillId && version2.versionNumber === input.versionNumber) {
|
|
3501
|
+
throw new Error(`Version number ${input.versionNumber} already exists for skill ${input.skillId}`);
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
const version = {
|
|
3505
|
+
...input,
|
|
3506
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
3507
|
+
};
|
|
3508
|
+
this.db.skillVersions.set(input.id, this.deepCopyVersion(version));
|
|
3509
|
+
return this.deepCopyVersion(version);
|
|
3510
|
+
}
|
|
3511
|
+
async getVersion(id) {
|
|
3512
|
+
this.logger.debug(`InMemorySkillsStorage: getVersion called for ${id}`);
|
|
3513
|
+
const version = this.db.skillVersions.get(id);
|
|
3514
|
+
return version ? this.deepCopyVersion(version) : null;
|
|
3515
|
+
}
|
|
3516
|
+
async getVersionByNumber(skillId, versionNumber) {
|
|
3517
|
+
this.logger.debug(`InMemorySkillsStorage: getVersionByNumber called for skill ${skillId}, v${versionNumber}`);
|
|
3518
|
+
for (const version of this.db.skillVersions.values()) {
|
|
3519
|
+
if (version.skillId === skillId && version.versionNumber === versionNumber) {
|
|
3520
|
+
return this.deepCopyVersion(version);
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
return null;
|
|
3524
|
+
}
|
|
3525
|
+
async getLatestVersion(skillId) {
|
|
3526
|
+
this.logger.debug(`InMemorySkillsStorage: getLatestVersion called for skill ${skillId}`);
|
|
3527
|
+
let latest = null;
|
|
3528
|
+
for (const version of this.db.skillVersions.values()) {
|
|
3529
|
+
if (version.skillId === skillId) {
|
|
3530
|
+
if (!latest || version.versionNumber > latest.versionNumber) {
|
|
3531
|
+
latest = version;
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
return latest ? this.deepCopyVersion(latest) : null;
|
|
3536
|
+
}
|
|
3537
|
+
async listVersions(input) {
|
|
3538
|
+
const { skillId, page = 0, perPage: perPageInput, orderBy } = input;
|
|
3539
|
+
const { field, direction } = this.parseVersionOrderBy(orderBy);
|
|
3540
|
+
this.logger.debug(`InMemorySkillsStorage: listVersions called for skill ${skillId}`);
|
|
3541
|
+
const perPage = normalizePerPage(perPageInput, 20);
|
|
3542
|
+
if (page < 0) {
|
|
3543
|
+
throw new Error("page must be >= 0");
|
|
3544
|
+
}
|
|
3545
|
+
const maxOffset = Number.MAX_SAFE_INTEGER / 2;
|
|
3546
|
+
if (page * perPage > maxOffset) {
|
|
3547
|
+
throw new Error("page value too large");
|
|
3548
|
+
}
|
|
3549
|
+
let versions = Array.from(this.db.skillVersions.values()).filter((v) => v.skillId === skillId);
|
|
3550
|
+
versions = this.sortVersions(versions, field, direction);
|
|
3551
|
+
const clonedVersions = versions.map((v) => this.deepCopyVersion(v));
|
|
3552
|
+
const total = clonedVersions.length;
|
|
3553
|
+
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
3554
|
+
const paginatedVersions = clonedVersions.slice(offset, offset + perPage);
|
|
3555
|
+
return {
|
|
3556
|
+
versions: paginatedVersions,
|
|
3557
|
+
total,
|
|
3558
|
+
page,
|
|
3559
|
+
perPage: perPageForResponse,
|
|
3560
|
+
hasMore: offset + perPage < total
|
|
3561
|
+
};
|
|
3562
|
+
}
|
|
3563
|
+
async deleteVersion(id) {
|
|
3564
|
+
this.logger.debug(`InMemorySkillsStorage: deleteVersion called for ${id}`);
|
|
3565
|
+
this.db.skillVersions.delete(id);
|
|
3566
|
+
}
|
|
3567
|
+
async deleteVersionsByParentId(entityId) {
|
|
3568
|
+
this.logger.debug(`InMemorySkillsStorage: deleteVersionsByParentId called for skill ${entityId}`);
|
|
3569
|
+
const idsToDelete = [];
|
|
3570
|
+
for (const [id, version] of this.db.skillVersions.entries()) {
|
|
3571
|
+
if (version.skillId === entityId) {
|
|
3572
|
+
idsToDelete.push(id);
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
for (const id of idsToDelete) {
|
|
3576
|
+
this.db.skillVersions.delete(id);
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
async countVersions(skillId) {
|
|
3580
|
+
this.logger.debug(`InMemorySkillsStorage: countVersions called for skill ${skillId}`);
|
|
3581
|
+
let count = 0;
|
|
3582
|
+
for (const version of this.db.skillVersions.values()) {
|
|
3583
|
+
if (version.skillId === skillId) {
|
|
3584
|
+
count++;
|
|
3585
|
+
}
|
|
3586
|
+
}
|
|
3587
|
+
return count;
|
|
3588
|
+
}
|
|
3589
|
+
// ==========================================================================
|
|
3590
|
+
// Private Helper Methods
|
|
3591
|
+
// ==========================================================================
|
|
3592
|
+
deepCopyConfig(config) {
|
|
3593
|
+
return {
|
|
3594
|
+
...config
|
|
3595
|
+
};
|
|
3596
|
+
}
|
|
3597
|
+
deepCopyVersion(version) {
|
|
3598
|
+
return structuredClone(version);
|
|
3599
|
+
}
|
|
3600
|
+
sortConfigs(configs, field, direction) {
|
|
3601
|
+
return configs.sort((a, b) => {
|
|
3602
|
+
const aValue = a[field].getTime();
|
|
3603
|
+
const bValue = b[field].getTime();
|
|
3604
|
+
return direction === "ASC" ? aValue - bValue : bValue - aValue;
|
|
3605
|
+
});
|
|
3606
|
+
}
|
|
3607
|
+
sortVersions(versions, field, direction) {
|
|
3608
|
+
return versions.sort((a, b) => {
|
|
3609
|
+
let aVal;
|
|
3610
|
+
let bVal;
|
|
3611
|
+
if (field === "createdAt") {
|
|
3612
|
+
aVal = a.createdAt.getTime();
|
|
3613
|
+
bVal = b.createdAt.getTime();
|
|
3614
|
+
} else {
|
|
3615
|
+
aVal = a.versionNumber;
|
|
3616
|
+
bVal = b.versionNumber;
|
|
3617
|
+
}
|
|
3618
|
+
return direction === "ASC" ? aVal - bVal : bVal - aVal;
|
|
3619
|
+
});
|
|
3620
|
+
}
|
|
3621
|
+
};
|
|
3622
|
+
|
|
3623
|
+
// src/workflows/evented/types.ts
|
|
3624
|
+
var PENDING_MARKER_KEY = "__mastra_pending__";
|
|
3625
|
+
function createPendingMarker() {
|
|
3626
|
+
return { [PENDING_MARKER_KEY]: true };
|
|
3627
|
+
}
|
|
3628
|
+
function isPendingMarker(val) {
|
|
3629
|
+
return val !== null && typeof val === "object" && PENDING_MARKER_KEY in val && val[PENDING_MARKER_KEY] === true;
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3632
|
+
// src/storage/domains/workflows/base.ts
|
|
3633
|
+
var WorkflowsStorage = class extends StorageDomain {
|
|
3634
|
+
constructor() {
|
|
3635
|
+
super({
|
|
3636
|
+
component: "STORAGE",
|
|
3637
|
+
name: "WORKFLOWS"
|
|
3638
|
+
});
|
|
3639
|
+
}
|
|
3640
|
+
};
|
|
3641
|
+
|
|
3642
|
+
// src/storage/domains/workflows/inmemory.ts
|
|
3643
|
+
var WorkflowsInMemory = class extends WorkflowsStorage {
|
|
3644
|
+
db;
|
|
3645
|
+
constructor({ db }) {
|
|
3646
|
+
super();
|
|
3647
|
+
this.db = db;
|
|
3648
|
+
}
|
|
3649
|
+
async dangerouslyClearAll() {
|
|
3650
|
+
this.db.workflows.clear();
|
|
3651
|
+
}
|
|
3652
|
+
getWorkflowKey(workflowName, runId) {
|
|
3653
|
+
return `${workflowName}-${runId}`;
|
|
3654
|
+
}
|
|
3655
|
+
async updateWorkflowResults({
|
|
3656
|
+
workflowName,
|
|
3657
|
+
runId,
|
|
3658
|
+
stepId,
|
|
3659
|
+
result,
|
|
3660
|
+
requestContext
|
|
3661
|
+
}) {
|
|
3662
|
+
this.logger.debug(`WorkflowsInMemory: updateWorkflowResults called for ${workflowName} ${runId} ${stepId}`, result);
|
|
3663
|
+
const key = this.getWorkflowKey(workflowName, runId);
|
|
3664
|
+
const run = this.db.workflows.get(key);
|
|
3665
|
+
if (!run) {
|
|
3666
|
+
return {};
|
|
3667
|
+
}
|
|
3668
|
+
let snapshot;
|
|
3669
|
+
if (!run.snapshot) {
|
|
3670
|
+
snapshot = {
|
|
3671
|
+
context: {},
|
|
3672
|
+
activePaths: [],
|
|
3673
|
+
activeStepsPath: {},
|
|
3674
|
+
timestamp: Date.now(),
|
|
3675
|
+
suspendedPaths: {},
|
|
3676
|
+
resumeLabels: {},
|
|
3677
|
+
serializedStepGraph: [],
|
|
3678
|
+
value: {},
|
|
3679
|
+
waitingPaths: {},
|
|
3680
|
+
status: "pending",
|
|
3681
|
+
runId: run.run_id
|
|
3682
|
+
};
|
|
3683
|
+
this.db.workflows.set(key, {
|
|
3684
|
+
...run,
|
|
3685
|
+
snapshot
|
|
3686
|
+
});
|
|
3687
|
+
} else {
|
|
3688
|
+
snapshot = typeof run.snapshot === "string" ? JSON.parse(run.snapshot) : run.snapshot;
|
|
3689
|
+
}
|
|
3690
|
+
if (!snapshot || !snapshot?.context) {
|
|
3691
|
+
throw new Error(`Snapshot not found for runId ${runId}`);
|
|
3692
|
+
}
|
|
3693
|
+
const existingResult = snapshot.context[stepId];
|
|
3694
|
+
if (existingResult && "output" in existingResult && Array.isArray(existingResult.output) && result && typeof result === "object" && "output" in result && Array.isArray(result.output)) {
|
|
3695
|
+
const existingOutput = existingResult.output;
|
|
3696
|
+
const newOutput = result.output;
|
|
3697
|
+
const mergedOutput = [...existingOutput];
|
|
3698
|
+
for (let i = 0; i < Math.max(existingOutput.length, newOutput.length); i++) {
|
|
3699
|
+
if (i < newOutput.length) {
|
|
3700
|
+
const newVal = newOutput[i];
|
|
3529
3701
|
if (isPendingMarker(newVal)) {
|
|
3530
3702
|
mergedOutput[i] = null;
|
|
3531
3703
|
} else if (newVal !== null) {
|
|
@@ -3580,132 +3752,443 @@ var WorkflowsInMemory = class extends WorkflowsStorage {
|
|
|
3580
3752
|
} else {
|
|
3581
3753
|
snapshot = typeof run.snapshot === "string" ? JSON.parse(run.snapshot) : run.snapshot;
|
|
3582
3754
|
}
|
|
3583
|
-
if (!snapshot || !snapshot?.context) {
|
|
3584
|
-
throw new Error(`Snapshot not found for runId ${runId}`);
|
|
3755
|
+
if (!snapshot || !snapshot?.context) {
|
|
3756
|
+
throw new Error(`Snapshot not found for runId ${runId}`);
|
|
3757
|
+
}
|
|
3758
|
+
snapshot = { ...snapshot, ...opts };
|
|
3759
|
+
this.db.workflows.set(key, {
|
|
3760
|
+
...run,
|
|
3761
|
+
snapshot
|
|
3762
|
+
});
|
|
3763
|
+
return snapshot;
|
|
3764
|
+
}
|
|
3765
|
+
async persistWorkflowSnapshot({
|
|
3766
|
+
workflowName,
|
|
3767
|
+
runId,
|
|
3768
|
+
resourceId,
|
|
3769
|
+
snapshot,
|
|
3770
|
+
createdAt,
|
|
3771
|
+
updatedAt
|
|
3772
|
+
}) {
|
|
3773
|
+
const key = this.getWorkflowKey(workflowName, runId);
|
|
3774
|
+
const now = /* @__PURE__ */ new Date();
|
|
3775
|
+
const data = {
|
|
3776
|
+
workflow_name: workflowName,
|
|
3777
|
+
run_id: runId,
|
|
3778
|
+
resourceId,
|
|
3779
|
+
snapshot,
|
|
3780
|
+
createdAt: createdAt ?? now,
|
|
3781
|
+
updatedAt: updatedAt ?? now
|
|
3782
|
+
};
|
|
3783
|
+
this.db.workflows.set(key, data);
|
|
3784
|
+
}
|
|
3785
|
+
async loadWorkflowSnapshot({
|
|
3786
|
+
workflowName,
|
|
3787
|
+
runId
|
|
3788
|
+
}) {
|
|
3789
|
+
this.logger.debug("Loading workflow snapshot", { workflowName, runId });
|
|
3790
|
+
const key = this.getWorkflowKey(workflowName, runId);
|
|
3791
|
+
const run = this.db.workflows.get(key);
|
|
3792
|
+
if (!run) {
|
|
3793
|
+
return null;
|
|
3794
|
+
}
|
|
3795
|
+
const snapshot = typeof run.snapshot === "string" ? JSON.parse(run.snapshot) : run.snapshot;
|
|
3796
|
+
return snapshot ? JSON.parse(JSON.stringify(snapshot)) : null;
|
|
3797
|
+
}
|
|
3798
|
+
async listWorkflowRuns({
|
|
3799
|
+
workflowName,
|
|
3800
|
+
fromDate,
|
|
3801
|
+
toDate,
|
|
3802
|
+
perPage,
|
|
3803
|
+
page,
|
|
3804
|
+
resourceId,
|
|
3805
|
+
status
|
|
3806
|
+
} = {}) {
|
|
3807
|
+
if (page !== void 0 && page < 0) {
|
|
3808
|
+
throw new Error("page must be >= 0");
|
|
3809
|
+
}
|
|
3810
|
+
let runs = Array.from(this.db.workflows.values());
|
|
3811
|
+
if (workflowName) runs = runs.filter((run) => run.workflow_name === workflowName);
|
|
3812
|
+
if (status) {
|
|
3813
|
+
runs = runs.filter((run) => {
|
|
3814
|
+
let snapshot = run?.snapshot;
|
|
3815
|
+
if (!snapshot) {
|
|
3816
|
+
return false;
|
|
3817
|
+
}
|
|
3818
|
+
if (typeof snapshot === "string") {
|
|
3819
|
+
try {
|
|
3820
|
+
snapshot = JSON.parse(snapshot);
|
|
3821
|
+
} catch {
|
|
3822
|
+
return false;
|
|
3823
|
+
}
|
|
3824
|
+
} else {
|
|
3825
|
+
snapshot = JSON.parse(JSON.stringify(snapshot));
|
|
3826
|
+
}
|
|
3827
|
+
return snapshot.status === status;
|
|
3828
|
+
});
|
|
3829
|
+
}
|
|
3830
|
+
if (fromDate && toDate) {
|
|
3831
|
+
runs = runs.filter(
|
|
3832
|
+
(run) => new Date(run.createdAt).getTime() >= fromDate.getTime() && new Date(run.createdAt).getTime() <= toDate.getTime()
|
|
3833
|
+
);
|
|
3834
|
+
} else if (fromDate) {
|
|
3835
|
+
runs = runs.filter((run) => new Date(run.createdAt).getTime() >= fromDate.getTime());
|
|
3836
|
+
} else if (toDate) {
|
|
3837
|
+
runs = runs.filter((run) => new Date(run.createdAt).getTime() <= toDate.getTime());
|
|
3838
|
+
}
|
|
3839
|
+
if (resourceId) runs = runs.filter((run) => run.resourceId === resourceId);
|
|
3840
|
+
const total = runs.length;
|
|
3841
|
+
runs.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
3842
|
+
if (perPage !== void 0 && page !== void 0) {
|
|
3843
|
+
const normalizedPerPage = normalizePerPage(perPage, Number.MAX_SAFE_INTEGER);
|
|
3844
|
+
const offset = page * normalizedPerPage;
|
|
3845
|
+
const start = offset;
|
|
3846
|
+
const end = start + normalizedPerPage;
|
|
3847
|
+
runs = runs.slice(start, end);
|
|
3848
|
+
}
|
|
3849
|
+
const parsedRuns = runs.map((run) => ({
|
|
3850
|
+
...run,
|
|
3851
|
+
snapshot: typeof run.snapshot === "string" ? JSON.parse(run.snapshot) : JSON.parse(JSON.stringify(run.snapshot)),
|
|
3852
|
+
createdAt: new Date(run.createdAt),
|
|
3853
|
+
updatedAt: new Date(run.updatedAt),
|
|
3854
|
+
runId: run.run_id,
|
|
3855
|
+
workflowName: run.workflow_name,
|
|
3856
|
+
resourceId: run.resourceId
|
|
3857
|
+
}));
|
|
3858
|
+
return { runs: parsedRuns, total };
|
|
3859
|
+
}
|
|
3860
|
+
async getWorkflowRunById({
|
|
3861
|
+
runId,
|
|
3862
|
+
workflowName
|
|
3863
|
+
}) {
|
|
3864
|
+
const runs = Array.from(this.db.workflows.values()).filter((r) => r.run_id === runId);
|
|
3865
|
+
let run = runs.find((r) => r.workflow_name === workflowName);
|
|
3866
|
+
if (!run) return null;
|
|
3867
|
+
const parsedRun = {
|
|
3868
|
+
...run,
|
|
3869
|
+
snapshot: typeof run.snapshot === "string" ? JSON.parse(run.snapshot) : JSON.parse(JSON.stringify(run.snapshot)),
|
|
3870
|
+
createdAt: new Date(run.createdAt),
|
|
3871
|
+
updatedAt: new Date(run.updatedAt),
|
|
3872
|
+
runId: run.run_id,
|
|
3873
|
+
workflowName: run.workflow_name,
|
|
3874
|
+
resourceId: run.resourceId
|
|
3875
|
+
};
|
|
3876
|
+
return parsedRun;
|
|
3877
|
+
}
|
|
3878
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
3879
|
+
const key = this.getWorkflowKey(workflowName, runId);
|
|
3880
|
+
this.db.workflows.delete(key);
|
|
3881
|
+
}
|
|
3882
|
+
};
|
|
3883
|
+
|
|
3884
|
+
// src/storage/domains/workspaces/base.ts
|
|
3885
|
+
var WorkspacesStorage = class extends VersionedStorageDomain {
|
|
3886
|
+
listKey = "workspaces";
|
|
3887
|
+
versionMetadataFields = [
|
|
3888
|
+
"id",
|
|
3889
|
+
"workspaceId",
|
|
3890
|
+
"versionNumber",
|
|
3891
|
+
"changedFields",
|
|
3892
|
+
"changeMessage",
|
|
3893
|
+
"createdAt"
|
|
3894
|
+
];
|
|
3895
|
+
constructor() {
|
|
3896
|
+
super({
|
|
3897
|
+
component: "STORAGE",
|
|
3898
|
+
name: "WORKSPACES"
|
|
3899
|
+
});
|
|
3900
|
+
}
|
|
3901
|
+
};
|
|
3902
|
+
|
|
3903
|
+
// src/storage/domains/workspaces/inmemory.ts
|
|
3904
|
+
var InMemoryWorkspacesStorage = class extends WorkspacesStorage {
|
|
3905
|
+
db;
|
|
3906
|
+
constructor({ db }) {
|
|
3907
|
+
super();
|
|
3908
|
+
this.db = db;
|
|
3909
|
+
}
|
|
3910
|
+
async dangerouslyClearAll() {
|
|
3911
|
+
this.db.workspaces.clear();
|
|
3912
|
+
this.db.workspaceVersions.clear();
|
|
3913
|
+
}
|
|
3914
|
+
// ==========================================================================
|
|
3915
|
+
// Workspace CRUD Methods
|
|
3916
|
+
// ==========================================================================
|
|
3917
|
+
async getById(id) {
|
|
3918
|
+
this.logger.debug(`InMemoryWorkspacesStorage: getById called for ${id}`);
|
|
3919
|
+
const config = this.db.workspaces.get(id);
|
|
3920
|
+
return config ? this.deepCopyConfig(config) : null;
|
|
3921
|
+
}
|
|
3922
|
+
async create(input) {
|
|
3923
|
+
const { workspace } = input;
|
|
3924
|
+
this.logger.debug(`InMemoryWorkspacesStorage: create called for ${workspace.id}`);
|
|
3925
|
+
if (this.db.workspaces.has(workspace.id)) {
|
|
3926
|
+
throw new Error(`Workspace with id ${workspace.id} already exists`);
|
|
3927
|
+
}
|
|
3928
|
+
const now = /* @__PURE__ */ new Date();
|
|
3929
|
+
const newConfig = {
|
|
3930
|
+
id: workspace.id,
|
|
3931
|
+
status: "draft",
|
|
3932
|
+
activeVersionId: void 0,
|
|
3933
|
+
authorId: workspace.authorId,
|
|
3934
|
+
metadata: workspace.metadata,
|
|
3935
|
+
createdAt: now,
|
|
3936
|
+
updatedAt: now
|
|
3937
|
+
};
|
|
3938
|
+
this.db.workspaces.set(workspace.id, newConfig);
|
|
3939
|
+
const { id: _id, authorId: _authorId, metadata: _metadata, ...snapshotConfig } = workspace;
|
|
3940
|
+
const versionId = crypto.randomUUID();
|
|
3941
|
+
await this.createVersion({
|
|
3942
|
+
id: versionId,
|
|
3943
|
+
workspaceId: workspace.id,
|
|
3944
|
+
versionNumber: 1,
|
|
3945
|
+
...snapshotConfig,
|
|
3946
|
+
changedFields: Object.keys(snapshotConfig),
|
|
3947
|
+
changeMessage: "Initial version"
|
|
3948
|
+
});
|
|
3949
|
+
return this.deepCopyConfig(newConfig);
|
|
3950
|
+
}
|
|
3951
|
+
async update(input) {
|
|
3952
|
+
const { id, ...updates } = input;
|
|
3953
|
+
this.logger.debug(`InMemoryWorkspacesStorage: update called for ${id}`);
|
|
3954
|
+
const existingConfig = this.db.workspaces.get(id);
|
|
3955
|
+
if (!existingConfig) {
|
|
3956
|
+
throw new Error(`Workspace with id ${id} not found`);
|
|
3957
|
+
}
|
|
3958
|
+
const { authorId, activeVersionId, metadata, status, ...configFields } = updates;
|
|
3959
|
+
const configFieldNames = [
|
|
3960
|
+
"name",
|
|
3961
|
+
"description",
|
|
3962
|
+
"filesystem",
|
|
3963
|
+
"sandbox",
|
|
3964
|
+
"mounts",
|
|
3965
|
+
"search",
|
|
3966
|
+
"skills",
|
|
3967
|
+
"tools",
|
|
3968
|
+
"autoSync",
|
|
3969
|
+
"operationTimeout"
|
|
3970
|
+
];
|
|
3971
|
+
const hasConfigUpdate = configFieldNames.some((field) => field in configFields);
|
|
3972
|
+
const updatedConfig = {
|
|
3973
|
+
...existingConfig,
|
|
3974
|
+
...authorId !== void 0 && { authorId },
|
|
3975
|
+
...activeVersionId !== void 0 && { activeVersionId },
|
|
3976
|
+
...status !== void 0 && { status },
|
|
3977
|
+
...metadata !== void 0 && {
|
|
3978
|
+
metadata: { ...existingConfig.metadata, ...metadata }
|
|
3979
|
+
},
|
|
3980
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
3981
|
+
};
|
|
3982
|
+
if (activeVersionId !== void 0 && status === void 0) {
|
|
3983
|
+
updatedConfig.status = "published";
|
|
3984
|
+
}
|
|
3985
|
+
if (hasConfigUpdate) {
|
|
3986
|
+
const latestVersion = await this.getLatestVersion(id);
|
|
3987
|
+
if (!latestVersion) {
|
|
3988
|
+
throw new Error(`No versions found for workspace ${id}`);
|
|
3989
|
+
}
|
|
3990
|
+
const {
|
|
3991
|
+
id: _versionId,
|
|
3992
|
+
workspaceId: _workspaceId,
|
|
3993
|
+
versionNumber: _versionNumber,
|
|
3994
|
+
changedFields: _changedFields,
|
|
3995
|
+
changeMessage: _changeMessage,
|
|
3996
|
+
createdAt: _createdAt,
|
|
3997
|
+
...latestConfig
|
|
3998
|
+
} = latestVersion;
|
|
3999
|
+
const newConfig = {
|
|
4000
|
+
...latestConfig,
|
|
4001
|
+
...configFields
|
|
4002
|
+
};
|
|
4003
|
+
const changedFields = configFieldNames.filter(
|
|
4004
|
+
(field) => field in configFields && JSON.stringify(configFields[field]) !== JSON.stringify(latestConfig[field])
|
|
4005
|
+
);
|
|
4006
|
+
if (changedFields.length > 0) {
|
|
4007
|
+
const newVersionId = crypto.randomUUID();
|
|
4008
|
+
const newVersionNumber = latestVersion.versionNumber + 1;
|
|
4009
|
+
await this.createVersion({
|
|
4010
|
+
id: newVersionId,
|
|
4011
|
+
workspaceId: id,
|
|
4012
|
+
versionNumber: newVersionNumber,
|
|
4013
|
+
...newConfig,
|
|
4014
|
+
changedFields,
|
|
4015
|
+
changeMessage: `Updated ${changedFields.join(", ")}`
|
|
4016
|
+
});
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
this.db.workspaces.set(id, updatedConfig);
|
|
4020
|
+
return this.deepCopyConfig(updatedConfig);
|
|
4021
|
+
}
|
|
4022
|
+
async delete(id) {
|
|
4023
|
+
this.logger.debug(`InMemoryWorkspacesStorage: delete called for ${id}`);
|
|
4024
|
+
this.db.workspaces.delete(id);
|
|
4025
|
+
await this.deleteVersionsByParentId(id);
|
|
4026
|
+
}
|
|
4027
|
+
async list(args) {
|
|
4028
|
+
const { page = 0, perPage: perPageInput, orderBy, authorId, metadata } = args || {};
|
|
4029
|
+
const { field, direction } = this.parseOrderBy(orderBy);
|
|
4030
|
+
this.logger.debug(`InMemoryWorkspacesStorage: list called`);
|
|
4031
|
+
const perPage = normalizePerPage(perPageInput, 100);
|
|
4032
|
+
if (page < 0) {
|
|
4033
|
+
throw new Error("page must be >= 0");
|
|
4034
|
+
}
|
|
4035
|
+
const maxOffset = Number.MAX_SAFE_INTEGER / 2;
|
|
4036
|
+
if (page * perPage > maxOffset) {
|
|
4037
|
+
throw new Error("page value too large");
|
|
3585
4038
|
}
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
4039
|
+
let configs = Array.from(this.db.workspaces.values());
|
|
4040
|
+
if (authorId !== void 0) {
|
|
4041
|
+
configs = configs.filter((config) => config.authorId === authorId);
|
|
4042
|
+
}
|
|
4043
|
+
if (metadata && Object.keys(metadata).length > 0) {
|
|
4044
|
+
configs = configs.filter((config) => {
|
|
4045
|
+
if (!config.metadata) return false;
|
|
4046
|
+
return Object.entries(metadata).every(([key, value]) => chunkQDH6MVJ7_cjs.deepEqual(config.metadata[key], value));
|
|
4047
|
+
});
|
|
4048
|
+
}
|
|
4049
|
+
const sortedConfigs = this.sortConfigs(configs, field, direction);
|
|
4050
|
+
const clonedConfigs = sortedConfigs.map((config) => this.deepCopyConfig(config));
|
|
4051
|
+
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
4052
|
+
return {
|
|
4053
|
+
workspaces: clonedConfigs.slice(offset, offset + perPage),
|
|
4054
|
+
total: clonedConfigs.length,
|
|
4055
|
+
page,
|
|
4056
|
+
perPage: perPageForResponse,
|
|
4057
|
+
hasMore: offset + perPage < clonedConfigs.length
|
|
4058
|
+
};
|
|
3592
4059
|
}
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
const
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
createdAt:
|
|
3609
|
-
updatedAt: updatedAt ?? now
|
|
4060
|
+
// ==========================================================================
|
|
4061
|
+
// Workspace Version Methods
|
|
4062
|
+
// ==========================================================================
|
|
4063
|
+
async createVersion(input) {
|
|
4064
|
+
this.logger.debug(`InMemoryWorkspacesStorage: createVersion called for workspace ${input.workspaceId}`);
|
|
4065
|
+
if (this.db.workspaceVersions.has(input.id)) {
|
|
4066
|
+
throw new Error(`Version with id ${input.id} already exists`);
|
|
4067
|
+
}
|
|
4068
|
+
for (const version2 of this.db.workspaceVersions.values()) {
|
|
4069
|
+
if (version2.workspaceId === input.workspaceId && version2.versionNumber === input.versionNumber) {
|
|
4070
|
+
throw new Error(`Version number ${input.versionNumber} already exists for workspace ${input.workspaceId}`);
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
const version = {
|
|
4074
|
+
...input,
|
|
4075
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
3610
4076
|
};
|
|
3611
|
-
this.db.
|
|
4077
|
+
this.db.workspaceVersions.set(input.id, this.deepCopyVersion(version));
|
|
4078
|
+
return this.deepCopyVersion(version);
|
|
3612
4079
|
}
|
|
3613
|
-
async
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
4080
|
+
async getVersion(id) {
|
|
4081
|
+
this.logger.debug(`InMemoryWorkspacesStorage: getVersion called for ${id}`);
|
|
4082
|
+
const version = this.db.workspaceVersions.get(id);
|
|
4083
|
+
return version ? this.deepCopyVersion(version) : null;
|
|
4084
|
+
}
|
|
4085
|
+
async getVersionByNumber(workspaceId, versionNumber) {
|
|
4086
|
+
this.logger.debug(
|
|
4087
|
+
`InMemoryWorkspacesStorage: getVersionByNumber called for workspace ${workspaceId}, v${versionNumber}`
|
|
4088
|
+
);
|
|
4089
|
+
for (const version of this.db.workspaceVersions.values()) {
|
|
4090
|
+
if (version.workspaceId === workspaceId && version.versionNumber === versionNumber) {
|
|
4091
|
+
return this.deepCopyVersion(version);
|
|
4092
|
+
}
|
|
3622
4093
|
}
|
|
3623
|
-
|
|
3624
|
-
return snapshot ? JSON.parse(JSON.stringify(snapshot)) : null;
|
|
4094
|
+
return null;
|
|
3625
4095
|
}
|
|
3626
|
-
async
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
4096
|
+
async getLatestVersion(workspaceId) {
|
|
4097
|
+
this.logger.debug(`InMemoryWorkspacesStorage: getLatestVersion called for workspace ${workspaceId}`);
|
|
4098
|
+
let latest = null;
|
|
4099
|
+
for (const version of this.db.workspaceVersions.values()) {
|
|
4100
|
+
if (version.workspaceId === workspaceId) {
|
|
4101
|
+
if (!latest || version.versionNumber > latest.versionNumber) {
|
|
4102
|
+
latest = version;
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
return latest ? this.deepCopyVersion(latest) : null;
|
|
4107
|
+
}
|
|
4108
|
+
async listVersions(input) {
|
|
4109
|
+
const { workspaceId, page = 0, perPage: perPageInput, orderBy } = input;
|
|
4110
|
+
const { field, direction } = this.parseVersionOrderBy(orderBy);
|
|
4111
|
+
this.logger.debug(`InMemoryWorkspacesStorage: listVersions called for workspace ${workspaceId}`);
|
|
4112
|
+
const perPage = normalizePerPage(perPageInput, 20);
|
|
4113
|
+
if (page < 0) {
|
|
3636
4114
|
throw new Error("page must be >= 0");
|
|
3637
4115
|
}
|
|
3638
|
-
|
|
3639
|
-
if (
|
|
3640
|
-
|
|
3641
|
-
runs = runs.filter((run) => {
|
|
3642
|
-
let snapshot = run?.snapshot;
|
|
3643
|
-
if (!snapshot) {
|
|
3644
|
-
return false;
|
|
3645
|
-
}
|
|
3646
|
-
if (typeof snapshot === "string") {
|
|
3647
|
-
try {
|
|
3648
|
-
snapshot = JSON.parse(snapshot);
|
|
3649
|
-
} catch {
|
|
3650
|
-
return false;
|
|
3651
|
-
}
|
|
3652
|
-
} else {
|
|
3653
|
-
snapshot = JSON.parse(JSON.stringify(snapshot));
|
|
3654
|
-
}
|
|
3655
|
-
return snapshot.status === status;
|
|
3656
|
-
});
|
|
4116
|
+
const maxOffset = Number.MAX_SAFE_INTEGER / 2;
|
|
4117
|
+
if (page * perPage > maxOffset) {
|
|
4118
|
+
throw new Error("page value too large");
|
|
3657
4119
|
}
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
}
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
4120
|
+
let versions = Array.from(this.db.workspaceVersions.values()).filter((v) => v.workspaceId === workspaceId);
|
|
4121
|
+
versions = this.sortVersions(versions, field, direction);
|
|
4122
|
+
const clonedVersions = versions.map((v) => this.deepCopyVersion(v));
|
|
4123
|
+
const total = clonedVersions.length;
|
|
4124
|
+
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
4125
|
+
const paginatedVersions = clonedVersions.slice(offset, offset + perPage);
|
|
4126
|
+
return {
|
|
4127
|
+
versions: paginatedVersions,
|
|
4128
|
+
total,
|
|
4129
|
+
page,
|
|
4130
|
+
perPage: perPageForResponse,
|
|
4131
|
+
hasMore: offset + perPage < total
|
|
4132
|
+
};
|
|
4133
|
+
}
|
|
4134
|
+
async deleteVersion(id) {
|
|
4135
|
+
this.logger.debug(`InMemoryWorkspacesStorage: deleteVersion called for ${id}`);
|
|
4136
|
+
this.db.workspaceVersions.delete(id);
|
|
4137
|
+
}
|
|
4138
|
+
async deleteVersionsByParentId(entityId) {
|
|
4139
|
+
this.logger.debug(`InMemoryWorkspacesStorage: deleteVersionsByParentId called for workspace ${entityId}`);
|
|
4140
|
+
const idsToDelete = [];
|
|
4141
|
+
for (const [id, version] of this.db.workspaceVersions.entries()) {
|
|
4142
|
+
if (version.workspaceId === entityId) {
|
|
4143
|
+
idsToDelete.push(id);
|
|
4144
|
+
}
|
|
3666
4145
|
}
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
runs.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
3670
|
-
if (perPage !== void 0 && page !== void 0) {
|
|
3671
|
-
const normalizedPerPage = normalizePerPage(perPage, Number.MAX_SAFE_INTEGER);
|
|
3672
|
-
const offset = page * normalizedPerPage;
|
|
3673
|
-
const start = offset;
|
|
3674
|
-
const end = start + normalizedPerPage;
|
|
3675
|
-
runs = runs.slice(start, end);
|
|
4146
|
+
for (const id of idsToDelete) {
|
|
4147
|
+
this.db.workspaceVersions.delete(id);
|
|
3676
4148
|
}
|
|
3677
|
-
const parsedRuns = runs.map((run) => ({
|
|
3678
|
-
...run,
|
|
3679
|
-
snapshot: typeof run.snapshot === "string" ? JSON.parse(run.snapshot) : JSON.parse(JSON.stringify(run.snapshot)),
|
|
3680
|
-
createdAt: new Date(run.createdAt),
|
|
3681
|
-
updatedAt: new Date(run.updatedAt),
|
|
3682
|
-
runId: run.run_id,
|
|
3683
|
-
workflowName: run.workflow_name,
|
|
3684
|
-
resourceId: run.resourceId
|
|
3685
|
-
}));
|
|
3686
|
-
return { runs: parsedRuns, total };
|
|
3687
4149
|
}
|
|
3688
|
-
async
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
4150
|
+
async countVersions(workspaceId) {
|
|
4151
|
+
this.logger.debug(`InMemoryWorkspacesStorage: countVersions called for workspace ${workspaceId}`);
|
|
4152
|
+
let count = 0;
|
|
4153
|
+
for (const version of this.db.workspaceVersions.values()) {
|
|
4154
|
+
if (version.workspaceId === workspaceId) {
|
|
4155
|
+
count++;
|
|
4156
|
+
}
|
|
4157
|
+
}
|
|
4158
|
+
return count;
|
|
4159
|
+
}
|
|
4160
|
+
// ==========================================================================
|
|
4161
|
+
// Private Helper Methods
|
|
4162
|
+
// ==========================================================================
|
|
4163
|
+
deepCopyConfig(config) {
|
|
4164
|
+
return {
|
|
4165
|
+
...config,
|
|
4166
|
+
metadata: config.metadata ? { ...config.metadata } : config.metadata
|
|
3703
4167
|
};
|
|
3704
|
-
return parsedRun;
|
|
3705
4168
|
}
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
4169
|
+
deepCopyVersion(version) {
|
|
4170
|
+
return structuredClone(version);
|
|
4171
|
+
}
|
|
4172
|
+
sortConfigs(configs, field, direction) {
|
|
4173
|
+
return configs.sort((a, b) => {
|
|
4174
|
+
const aValue = a[field].getTime();
|
|
4175
|
+
const bValue = b[field].getTime();
|
|
4176
|
+
return direction === "ASC" ? aValue - bValue : bValue - aValue;
|
|
4177
|
+
});
|
|
4178
|
+
}
|
|
4179
|
+
sortVersions(versions, field, direction) {
|
|
4180
|
+
return versions.sort((a, b) => {
|
|
4181
|
+
let aVal;
|
|
4182
|
+
let bVal;
|
|
4183
|
+
if (field === "createdAt") {
|
|
4184
|
+
aVal = a.createdAt.getTime();
|
|
4185
|
+
bVal = b.createdAt.getTime();
|
|
4186
|
+
} else {
|
|
4187
|
+
aVal = a.versionNumber;
|
|
4188
|
+
bVal = b.versionNumber;
|
|
4189
|
+
}
|
|
4190
|
+
return direction === "ASC" ? aVal - bVal : bVal - aVal;
|
|
4191
|
+
});
|
|
3709
4192
|
}
|
|
3710
4193
|
};
|
|
3711
4194
|
|
|
@@ -3730,7 +4213,9 @@ var InMemoryStore = class extends MastraCompositeStore {
|
|
|
3730
4213
|
agents: new InMemoryAgentsStorage({ db: this.#db }),
|
|
3731
4214
|
promptBlocks: new InMemoryPromptBlocksStorage({ db: this.#db }),
|
|
3732
4215
|
scorerDefinitions: new InMemoryScorerDefinitionsStorage({ db: this.#db }),
|
|
3733
|
-
mcpClients: new InMemoryMCPClientsStorage({ db: this.#db })
|
|
4216
|
+
mcpClients: new InMemoryMCPClientsStorage({ db: this.#db }),
|
|
4217
|
+
workspaces: new InMemoryWorkspacesStorage({ db: this.#db }),
|
|
4218
|
+
skills: new InMemorySkillsStorage({ db: this.#db })
|
|
3734
4219
|
};
|
|
3735
4220
|
}
|
|
3736
4221
|
/**
|
|
@@ -3744,6 +4229,55 @@ var InMemoryStore = class extends MastraCompositeStore {
|
|
|
3744
4229
|
};
|
|
3745
4230
|
var MockStore = InMemoryStore;
|
|
3746
4231
|
|
|
4232
|
+
// src/storage/domains/blobs/base.ts
|
|
4233
|
+
var BlobStore = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
4234
|
+
constructor() {
|
|
4235
|
+
super({
|
|
4236
|
+
component: "STORAGE",
|
|
4237
|
+
name: "BLOBS"
|
|
4238
|
+
});
|
|
4239
|
+
}
|
|
4240
|
+
};
|
|
4241
|
+
|
|
4242
|
+
// src/storage/domains/blobs/inmemory.ts
|
|
4243
|
+
var InMemoryBlobStore = class extends BlobStore {
|
|
4244
|
+
#blobs = /* @__PURE__ */ new Map();
|
|
4245
|
+
async init() {
|
|
4246
|
+
}
|
|
4247
|
+
async put(entry) {
|
|
4248
|
+
if (!this.#blobs.has(entry.hash)) {
|
|
4249
|
+
this.#blobs.set(entry.hash, entry);
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
async get(hash) {
|
|
4253
|
+
return this.#blobs.get(hash) ?? null;
|
|
4254
|
+
}
|
|
4255
|
+
async has(hash) {
|
|
4256
|
+
return this.#blobs.has(hash);
|
|
4257
|
+
}
|
|
4258
|
+
async delete(hash) {
|
|
4259
|
+
return this.#blobs.delete(hash);
|
|
4260
|
+
}
|
|
4261
|
+
async putMany(entries) {
|
|
4262
|
+
for (const entry of entries) {
|
|
4263
|
+
await this.put(entry);
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
async getMany(hashes) {
|
|
4267
|
+
const result = /* @__PURE__ */ new Map();
|
|
4268
|
+
for (const hash of hashes) {
|
|
4269
|
+
const blob = this.#blobs.get(hash);
|
|
4270
|
+
if (blob) {
|
|
4271
|
+
result.set(hash, blob);
|
|
4272
|
+
}
|
|
4273
|
+
}
|
|
4274
|
+
return result;
|
|
4275
|
+
}
|
|
4276
|
+
async dangerouslyClearAll() {
|
|
4277
|
+
this.#blobs.clear();
|
|
4278
|
+
}
|
|
4279
|
+
};
|
|
4280
|
+
|
|
3747
4281
|
// src/storage/domains/operations/base.ts
|
|
3748
4282
|
var StoreOperations = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
3749
4283
|
constructor() {
|
|
@@ -3872,6 +4406,11 @@ var StoreOperationsInMemory = class extends StoreOperations {
|
|
|
3872
4406
|
mastra_scorer_definition_versions: /* @__PURE__ */ new Map(),
|
|
3873
4407
|
mastra_mcp_clients: /* @__PURE__ */ new Map(),
|
|
3874
4408
|
mastra_mcp_client_versions: /* @__PURE__ */ new Map(),
|
|
4409
|
+
mastra_workspaces: /* @__PURE__ */ new Map(),
|
|
4410
|
+
mastra_workspace_versions: /* @__PURE__ */ new Map(),
|
|
4411
|
+
mastra_skills: /* @__PURE__ */ new Map(),
|
|
4412
|
+
mastra_skill_versions: /* @__PURE__ */ new Map(),
|
|
4413
|
+
mastra_skill_blobs: /* @__PURE__ */ new Map(),
|
|
3875
4414
|
mastra_datasets: /* @__PURE__ */ new Map(),
|
|
3876
4415
|
mastra_dataset_items: /* @__PURE__ */ new Map(),
|
|
3877
4416
|
mastra_dataset_versions: /* @__PURE__ */ new Map(),
|
|
@@ -3885,7 +4424,7 @@ var StoreOperationsInMemory = class extends StoreOperations {
|
|
|
3885
4424
|
async insert({ tableName, record }) {
|
|
3886
4425
|
const table = this.data[tableName];
|
|
3887
4426
|
let key = record.id;
|
|
3888
|
-
if ([
|
|
4427
|
+
if ([chunkKNXZ7KYL_cjs.TABLE_WORKFLOW_SNAPSHOT].includes(tableName) && !record.id && record.run_id) {
|
|
3889
4428
|
key = record.workflow_name ? `${record.workflow_name}-${record.run_id}` : record.run_id;
|
|
3890
4429
|
record.id = key;
|
|
3891
4430
|
} else if (!record.id) {
|
|
@@ -3898,7 +4437,7 @@ var StoreOperationsInMemory = class extends StoreOperations {
|
|
|
3898
4437
|
const table = this.data[tableName];
|
|
3899
4438
|
for (const record of records) {
|
|
3900
4439
|
let key = record.id;
|
|
3901
|
-
if ([
|
|
4440
|
+
if ([chunkKNXZ7KYL_cjs.TABLE_WORKFLOW_SNAPSHOT].includes(tableName) && !record.id && record.run_id) {
|
|
3902
4441
|
key = record.run_id;
|
|
3903
4442
|
record.id = key;
|
|
3904
4443
|
} else if (!record.id) {
|
|
@@ -4189,6 +4728,13 @@ function toDatasetItem(row) {
|
|
|
4189
4728
|
updatedAt: row.updatedAt
|
|
4190
4729
|
};
|
|
4191
4730
|
}
|
|
4731
|
+
function toDatasetRecord(record) {
|
|
4732
|
+
return {
|
|
4733
|
+
...record,
|
|
4734
|
+
inputSchema: record.inputSchema ?? void 0,
|
|
4735
|
+
groundTruthSchema: record.groundTruthSchema ?? void 0
|
|
4736
|
+
};
|
|
4737
|
+
}
|
|
4192
4738
|
var DatasetsInMemory = class extends DatasetsStorage {
|
|
4193
4739
|
db;
|
|
4194
4740
|
constructor({ db }) {
|
|
@@ -4216,10 +4762,11 @@ var DatasetsInMemory = class extends DatasetsStorage {
|
|
|
4216
4762
|
updatedAt: now
|
|
4217
4763
|
};
|
|
4218
4764
|
this.db.datasets.set(id, dataset);
|
|
4219
|
-
return dataset;
|
|
4765
|
+
return toDatasetRecord(dataset);
|
|
4220
4766
|
}
|
|
4221
4767
|
async getDatasetById({ id }) {
|
|
4222
|
-
|
|
4768
|
+
const record = this.db.datasets.get(id);
|
|
4769
|
+
return record ? toDatasetRecord(record) : null;
|
|
4223
4770
|
}
|
|
4224
4771
|
async _doUpdateDataset(args) {
|
|
4225
4772
|
const existing = this.db.datasets.get(args.id);
|
|
@@ -4236,7 +4783,7 @@ var DatasetsInMemory = class extends DatasetsStorage {
|
|
|
4236
4783
|
updatedAt: /* @__PURE__ */ new Date()
|
|
4237
4784
|
};
|
|
4238
4785
|
this.db.datasets.set(args.id, updated);
|
|
4239
|
-
return updated;
|
|
4786
|
+
return toDatasetRecord(updated);
|
|
4240
4787
|
}
|
|
4241
4788
|
async deleteDataset({ id }) {
|
|
4242
4789
|
for (const [itemId, rows] of this.db.datasetItems) {
|
|
@@ -4264,7 +4811,7 @@ var DatasetsInMemory = class extends DatasetsStorage {
|
|
|
4264
4811
|
const { offset: start, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
4265
4812
|
const end = perPageInput === false ? datasets.length : start + perPage;
|
|
4266
4813
|
return {
|
|
4267
|
-
datasets: datasets.slice(start, end),
|
|
4814
|
+
datasets: datasets.slice(start, end).map(toDatasetRecord),
|
|
4268
4815
|
pagination: {
|
|
4269
4816
|
total: datasets.length,
|
|
4270
4817
|
page,
|
|
@@ -4682,17 +5229,21 @@ var ExperimentsInMemory = class extends ExperimentsStorage {
|
|
|
4682
5229
|
};
|
|
4683
5230
|
|
|
4684
5231
|
exports.AgentsStorage = AgentsStorage;
|
|
5232
|
+
exports.BlobStore = BlobStore;
|
|
4685
5233
|
exports.DatasetsInMemory = DatasetsInMemory;
|
|
4686
5234
|
exports.DatasetsStorage = DatasetsStorage;
|
|
4687
5235
|
exports.ExperimentsInMemory = ExperimentsInMemory;
|
|
4688
5236
|
exports.ExperimentsStorage = ExperimentsStorage;
|
|
4689
5237
|
exports.InMemoryAgentsStorage = InMemoryAgentsStorage;
|
|
5238
|
+
exports.InMemoryBlobStore = InMemoryBlobStore;
|
|
4690
5239
|
exports.InMemoryDB = InMemoryDB;
|
|
4691
5240
|
exports.InMemoryMCPClientsStorage = InMemoryMCPClientsStorage;
|
|
4692
5241
|
exports.InMemoryMemory = InMemoryMemory;
|
|
4693
5242
|
exports.InMemoryPromptBlocksStorage = InMemoryPromptBlocksStorage;
|
|
4694
5243
|
exports.InMemoryScorerDefinitionsStorage = InMemoryScorerDefinitionsStorage;
|
|
5244
|
+
exports.InMemorySkillsStorage = InMemorySkillsStorage;
|
|
4695
5245
|
exports.InMemoryStore = InMemoryStore;
|
|
5246
|
+
exports.InMemoryWorkspacesStorage = InMemoryWorkspacesStorage;
|
|
4696
5247
|
exports.MCPClientsStorage = MCPClientsStorage;
|
|
4697
5248
|
exports.MastraCompositeStore = MastraCompositeStore;
|
|
4698
5249
|
exports.MastraStorage = MastraStorage;
|
|
@@ -4707,12 +5258,14 @@ exports.SchemaValidator = SchemaValidator;
|
|
|
4707
5258
|
exports.ScorerDefinitionsStorage = ScorerDefinitionsStorage;
|
|
4708
5259
|
exports.ScoresInMemory = ScoresInMemory;
|
|
4709
5260
|
exports.ScoresStorage = ScoresStorage;
|
|
5261
|
+
exports.SkillsStorage = SkillsStorage;
|
|
4710
5262
|
exports.StorageDomain = StorageDomain;
|
|
4711
5263
|
exports.StoreOperations = StoreOperations;
|
|
4712
5264
|
exports.StoreOperationsInMemory = StoreOperationsInMemory;
|
|
4713
5265
|
exports.VersionedStorageDomain = VersionedStorageDomain;
|
|
4714
5266
|
exports.WorkflowsInMemory = WorkflowsInMemory;
|
|
4715
5267
|
exports.WorkflowsStorage = WorkflowsStorage;
|
|
5268
|
+
exports.WorkspacesStorage = WorkspacesStorage;
|
|
4716
5269
|
exports.calculatePagination = calculatePagination;
|
|
4717
5270
|
exports.createPendingMarker = createPendingMarker;
|
|
4718
5271
|
exports.createStorageErrorId = createStorageErrorId;
|
|
@@ -4730,5 +5283,5 @@ exports.safelyParseJSON = safelyParseJSON;
|
|
|
4730
5283
|
exports.serializeDate = serializeDate;
|
|
4731
5284
|
exports.transformRow = transformRow;
|
|
4732
5285
|
exports.transformScoreRow = transformScoreRow;
|
|
4733
|
-
//# sourceMappingURL=chunk-
|
|
4734
|
-
//# sourceMappingURL=chunk-
|
|
5286
|
+
//# sourceMappingURL=chunk-JZ6TH4HQ.cjs.map
|
|
5287
|
+
//# sourceMappingURL=chunk-JZ6TH4HQ.cjs.map
|