@mastra/core 1.9.0 → 1.10.0
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 +202 -0
- package/dist/agent/agent.d.ts +22 -3
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/index.cjs +18 -18
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/message-list.d.ts.map +1 -1
- package/dist/{chunk-IOY7Y5GV.js → chunk-3VVNJPTO.js} +602 -187
- package/dist/chunk-3VVNJPTO.js.map +1 -0
- package/dist/{chunk-VDKWYUGC.cjs → chunk-5WBEMKE2.cjs} +7 -3
- package/dist/chunk-5WBEMKE2.cjs.map +1 -0
- package/dist/{chunk-H5S4PS44.cjs → chunk-76Q75VI4.cjs} +602 -187
- package/dist/chunk-76Q75VI4.cjs.map +1 -0
- package/dist/{chunk-ZBESCKPX.cjs → chunk-7AHCLTZZ.cjs} +1572 -36
- package/dist/chunk-7AHCLTZZ.cjs.map +1 -0
- package/dist/{chunk-SEKQJ447.js → chunk-ACAILOJE.js} +166 -68
- package/dist/chunk-ACAILOJE.js.map +1 -0
- package/dist/{chunk-YIJZBU54.cjs → chunk-BCSVBOAN.cjs} +240 -463
- package/dist/chunk-BCSVBOAN.cjs.map +1 -0
- package/dist/{chunk-ZVWVQ6MG.js → chunk-CY4ZWL2X.js} +8 -3
- package/dist/chunk-CY4ZWL2X.js.map +1 -0
- package/dist/{chunk-ET7GXCHS.js → chunk-DIKRJVK6.js} +5 -5
- package/dist/{chunk-ET7GXCHS.js.map → chunk-DIKRJVK6.js.map} +1 -1
- package/dist/{chunk-P6ZX7OKT.cjs → chunk-E6I5LBDM.cjs} +7 -7
- package/dist/{chunk-P6ZX7OKT.cjs.map → chunk-E6I5LBDM.cjs.map} +1 -1
- package/dist/{chunk-BFV3GSGS.js → chunk-FT5Q6XTK.js} +1546 -22
- package/dist/chunk-FT5Q6XTK.js.map +1 -0
- package/dist/{chunk-K54LFB4P.js → chunk-FXOWXS4O.js} +3 -3
- package/dist/{chunk-K54LFB4P.js.map → chunk-FXOWXS4O.js.map} +1 -1
- package/dist/{chunk-QNXY3J6B.cjs → chunk-GCRPNAAR.cjs} +22 -19
- package/dist/chunk-GCRPNAAR.cjs.map +1 -0
- package/dist/{chunk-5M3RMO7U.js → chunk-GTA5BKXZ.js} +8 -8
- package/dist/{chunk-5M3RMO7U.js.map → chunk-GTA5BKXZ.js.map} +1 -1
- package/dist/{chunk-G5R2755Q.cjs → chunk-HAIQ57YB.cjs} +53 -20
- package/dist/chunk-HAIQ57YB.cjs.map +1 -0
- package/dist/{chunk-3ZBLD2Y4.cjs → chunk-HH76UOJL.cjs} +2 -2
- package/dist/{chunk-3ZBLD2Y4.cjs.map → chunk-HH76UOJL.cjs.map} +1 -1
- package/dist/{chunk-HAGCXIBX.cjs → chunk-HNYQITSV.cjs} +9 -9
- package/dist/{chunk-HAGCXIBX.cjs.map → chunk-HNYQITSV.cjs.map} +1 -1
- package/dist/{chunk-GJTLWOKJ.js → chunk-HQA3IBLZ.js} +51 -18
- package/dist/chunk-HQA3IBLZ.js.map +1 -0
- package/dist/{chunk-4BXXAZ75.js → chunk-HQTHWVAK.js} +15 -7
- package/dist/chunk-HQTHWVAK.js.map +1 -0
- package/dist/{chunk-CCLV5CAA.js → chunk-JGOH7RWL.js} +7 -3
- package/dist/chunk-JGOH7RWL.js.map +1 -0
- package/dist/{chunk-Y6TGIUGL.js → chunk-LSF5WJ6G.js} +2 -2
- package/dist/{chunk-Y6TGIUGL.js.map → chunk-LSF5WJ6G.js.map} +1 -1
- package/dist/{chunk-D6HO5QAM.cjs → chunk-M26GEN4C.cjs} +14 -9
- package/dist/chunk-M26GEN4C.cjs.map +1 -0
- package/dist/{chunk-4P35AVPE.cjs → chunk-MEMYFFOL.cjs} +256 -157
- package/dist/chunk-MEMYFFOL.cjs.map +1 -0
- package/dist/{chunk-BQ355Z3O.js → chunk-NUZWQA4J.js} +4 -4
- package/dist/{chunk-BQ355Z3O.js.map → chunk-NUZWQA4J.js.map} +1 -1
- package/dist/{chunk-JIRB5LX4.js → chunk-OHX36YXF.js} +5 -3
- package/dist/chunk-OHX36YXF.js.map +1 -0
- package/dist/{chunk-PKORY4ZZ.cjs → chunk-OOTLMVNN.cjs} +107 -7
- package/dist/chunk-OOTLMVNN.cjs.map +1 -0
- package/dist/{chunk-D4M6E4OQ.cjs → chunk-OWZ6QT24.cjs} +16 -8
- package/dist/chunk-OWZ6QT24.cjs.map +1 -0
- package/dist/{chunk-6OHS6ZQ3.js → chunk-PDJCIONR.js} +8 -8
- package/dist/{chunk-6OHS6ZQ3.js.map → chunk-PDJCIONR.js.map} +1 -1
- package/dist/{chunk-WU2P7XOU.cjs → chunk-PP4G2TZZ.cjs} +20 -20
- package/dist/{chunk-WU2P7XOU.cjs.map → chunk-PP4G2TZZ.cjs.map} +1 -1
- package/dist/{chunk-VWAK25TU.js → chunk-SBBWRNZA.js} +10 -7
- package/dist/chunk-SBBWRNZA.js.map +1 -0
- package/dist/{chunk-TU4YMXOQ.js → chunk-TJIFNVPX.js} +6 -6
- package/dist/{chunk-TU4YMXOQ.js.map → chunk-TJIFNVPX.js.map} +1 -1
- package/dist/{chunk-V5YNS2QO.cjs → chunk-XJNQHPBJ.cjs} +15 -15
- package/dist/{chunk-V5YNS2QO.cjs.map → chunk-XJNQHPBJ.cjs.map} +1 -1
- package/dist/{chunk-MVYP55NA.js → chunk-YC6Z75K2.js} +113 -336
- package/dist/chunk-YC6Z75K2.js.map +1 -0
- package/dist/{chunk-3ZF7IC6Q.cjs → chunk-YZMSJKAK.cjs} +5 -3
- package/dist/chunk-YZMSJKAK.cjs.map +1 -0
- package/dist/{chunk-L3WDI7HP.cjs → chunk-Z2X5VTYJ.cjs} +65 -65
- package/dist/{chunk-L3WDI7HP.cjs.map → chunk-Z2X5VTYJ.cjs.map} +1 -1
- package/dist/{chunk-BN5MV2QK.cjs → chunk-Z52OAJ73.cjs} +4 -4
- package/dist/{chunk-BN5MV2QK.cjs.map → chunk-Z52OAJ73.cjs.map} +1 -1
- package/dist/{chunk-WYPSC6CO.js → chunk-ZBU6P4JV.js} +104 -4
- package/dist/chunk-ZBU6P4JV.js.map +1 -0
- package/dist/datasets/experiment/index.d.ts.map +1 -1
- package/dist/datasets/experiment/scorer.d.ts.map +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/di/index.cjs +4 -4
- package/dist/di/index.js +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +443 -384
- package/dist/docs/references/docs-agents-agent-approval.md +61 -31
- package/dist/docs/references/docs-agents-supervisor-agents.md +1 -1
- package/dist/docs/references/docs-memory-observational-memory.md +9 -0
- package/dist/docs/references/docs-memory-semantic-recall.md +17 -1
- package/dist/docs/references/docs-workspace-skills.md +7 -5
- package/dist/docs/references/reference-agents-agent.md +20 -20
- package/dist/docs/references/reference-agents-generate.md +200 -66
- package/dist/docs/references/reference-agents-generateLegacy.md +77 -35
- package/dist/docs/references/reference-agents-getDefaultGenerateOptions.md +4 -6
- package/dist/docs/references/reference-agents-getDefaultOptions.md +4 -6
- package/dist/docs/references/reference-agents-getDefaultStreamOptions.md +4 -6
- package/dist/docs/references/reference-agents-getDescription.md +1 -1
- package/dist/docs/references/reference-agents-getInstructions.md +4 -6
- package/dist/docs/references/reference-agents-getLLM.md +6 -8
- package/dist/docs/references/reference-agents-getMemory.md +4 -6
- package/dist/docs/references/reference-agents-getModel.md +4 -6
- package/dist/docs/references/reference-agents-getTools.md +5 -7
- package/dist/docs/references/reference-agents-getVoice.md +4 -6
- package/dist/docs/references/reference-agents-listAgents.md +4 -6
- package/dist/docs/references/reference-agents-listScorers.md +4 -6
- package/dist/docs/references/reference-agents-listTools.md +4 -6
- package/dist/docs/references/reference-agents-listWorkflows.md +4 -6
- package/dist/docs/references/reference-agents-network.md +69 -23
- package/dist/docs/references/reference-ai-sdk-chat-route.md +7 -7
- package/dist/docs/references/reference-ai-sdk-network-route.md +3 -3
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-stream.md +9 -9
- package/dist/docs/references/reference-ai-sdk-with-mastra.md +12 -12
- package/dist/docs/references/reference-ai-sdk-workflow-route.md +3 -3
- package/dist/docs/references/reference-auth-auth0.md +6 -6
- package/dist/docs/references/reference-auth-clerk.md +5 -5
- package/dist/docs/references/reference-auth-firebase.md +7 -7
- package/dist/docs/references/reference-auth-jwt.md +1 -1
- package/dist/docs/references/reference-auth-supabase.md +4 -4
- package/dist/docs/references/reference-auth-workos.md +6 -6
- package/dist/docs/references/reference-core-addGateway.md +2 -2
- package/dist/docs/references/reference-core-getAgent.md +2 -2
- package/dist/docs/references/reference-core-getAgentById.md +2 -2
- package/dist/docs/references/reference-core-getDeployer.md +1 -1
- package/dist/docs/references/reference-core-getGateway.md +2 -2
- package/dist/docs/references/reference-core-getGatewayById.md +2 -2
- package/dist/docs/references/reference-core-getLogger.md +1 -1
- package/dist/docs/references/reference-core-getMCPServer.md +2 -2
- package/dist/docs/references/reference-core-getMCPServerById.md +3 -3
- package/dist/docs/references/reference-core-getMemory.md +2 -2
- package/dist/docs/references/reference-core-getScorer.md +2 -2
- package/dist/docs/references/reference-core-getScorerById.md +2 -2
- package/dist/docs/references/reference-core-getServer.md +1 -1
- package/dist/docs/references/reference-core-getStorage.md +1 -1
- package/dist/docs/references/reference-core-getStoredAgentById.md +18 -20
- package/dist/docs/references/reference-core-getTelemetry.md +1 -1
- package/dist/docs/references/reference-core-getVector.md +2 -2
- package/dist/docs/references/reference-core-getWorkflow.md +3 -3
- package/dist/docs/references/reference-core-listAgents.md +1 -1
- package/dist/docs/references/reference-core-listGateways.md +1 -1
- package/dist/docs/references/reference-core-listLogs.md +9 -11
- package/dist/docs/references/reference-core-listLogsByRunId.md +9 -9
- package/dist/docs/references/reference-core-listMCPServers.md +1 -1
- package/dist/docs/references/reference-core-listMemory.md +1 -1
- package/dist/docs/references/reference-core-listScorers.md +1 -1
- package/dist/docs/references/reference-core-listStoredAgents.md +9 -11
- package/dist/docs/references/reference-core-listVectors.md +1 -1
- package/dist/docs/references/reference-core-listWorkflows.md +2 -2
- package/dist/docs/references/reference-core-mastra-class.md +17 -17
- package/dist/docs/references/reference-core-mastra-model-gateway.md +15 -15
- package/dist/docs/references/reference-core-setLogger.md +2 -4
- package/dist/docs/references/reference-core-setStorage.md +1 -1
- package/dist/docs/references/reference-datasets-addItem.md +20 -4
- package/dist/docs/references/reference-datasets-addItems.md +8 -2
- package/dist/docs/references/reference-datasets-compareExperiments.md +15 -3
- package/dist/docs/references/reference-datasets-create.md +6 -6
- package/dist/docs/references/reference-datasets-dataset.md +1 -1
- package/dist/docs/references/reference-datasets-delete.md +2 -2
- package/dist/docs/references/reference-datasets-deleteExperiment.md +2 -2
- package/dist/docs/references/reference-datasets-deleteItem.md +2 -2
- package/dist/docs/references/reference-datasets-deleteItems.md +2 -2
- package/dist/docs/references/reference-datasets-get.md +2 -2
- package/dist/docs/references/reference-datasets-getDetails.md +9 -9
- package/dist/docs/references/reference-datasets-getExperiment.md +2 -2
- package/dist/docs/references/reference-datasets-getItem.md +3 -3
- package/dist/docs/references/reference-datasets-getItemHistory.md +22 -2
- package/dist/docs/references/reference-datasets-list.md +7 -3
- package/dist/docs/references/reference-datasets-listExperimentResults.md +34 -4
- package/dist/docs/references/reference-datasets-listExperiments.md +41 -3
- package/dist/docs/references/reference-datasets-listItems.md +18 -6
- package/dist/docs/references/reference-datasets-listVersions.md +23 -3
- package/dist/docs/references/reference-datasets-startExperiment.md +62 -12
- package/dist/docs/references/reference-datasets-startExperimentAsync.md +5 -1
- package/dist/docs/references/reference-datasets-update.md +6 -6
- package/dist/docs/references/reference-datasets-updateItem.md +5 -5
- package/dist/docs/references/reference-evals-answer-relevancy.md +11 -11
- package/dist/docs/references/reference-evals-answer-similarity.md +17 -19
- package/dist/docs/references/reference-evals-bias.md +10 -10
- package/dist/docs/references/reference-evals-completeness.md +3 -3
- package/dist/docs/references/reference-evals-content-similarity.md +6 -6
- package/dist/docs/references/reference-evals-context-precision.md +4 -4
- package/dist/docs/references/reference-evals-create-scorer.md +47 -49
- package/dist/docs/references/reference-evals-faithfulness.md +11 -11
- package/dist/docs/references/reference-evals-hallucination.md +17 -21
- package/dist/docs/references/reference-evals-keyword-coverage.md +4 -4
- package/dist/docs/references/reference-evals-mastra-scorer.md +14 -14
- package/dist/docs/references/reference-evals-run-evals.md +16 -16
- package/dist/docs/references/reference-evals-scorer-utils.md +3 -3
- package/dist/docs/references/reference-evals-textual-difference.md +3 -3
- package/dist/docs/references/reference-evals-tone-consistency.md +3 -3
- package/dist/docs/references/reference-evals-toxicity.md +8 -8
- package/dist/docs/references/reference-harness-harness-class.md +34 -42
- package/dist/docs/references/reference-logging-pino-logger.md +5 -5
- package/dist/docs/references/reference-memory-deleteMessages.md +2 -2
- package/dist/docs/references/reference-memory-memory-class.md +12 -14
- package/dist/docs/references/reference-memory-observational-memory.md +102 -94
- package/dist/docs/references/reference-observability-tracing-configuration.md +27 -10
- package/dist/docs/references/reference-observability-tracing-exporters-console-exporter.md +4 -7
- package/dist/docs/references/reference-processors-batch-parts-processor.md +8 -10
- package/dist/docs/references/reference-processors-language-detector.md +14 -16
- package/dist/docs/references/reference-processors-message-history-processor.md +7 -9
- package/dist/docs/references/reference-processors-moderation-processor.md +13 -15
- package/dist/docs/references/reference-processors-pii-detector.md +14 -16
- package/dist/docs/references/reference-processors-processor-interface.md +62 -62
- package/dist/docs/references/reference-processors-prompt-injection-detector.md +11 -13
- package/dist/docs/references/reference-processors-semantic-recall-processor.md +14 -16
- package/dist/docs/references/reference-processors-system-prompt-scrubber.md +12 -14
- package/dist/docs/references/reference-processors-token-limiter-processor.md +11 -13
- package/dist/docs/references/reference-processors-tool-call-filter.md +5 -7
- package/dist/docs/references/reference-processors-tool-search-processor.md +9 -11
- package/dist/docs/references/reference-processors-unicode-normalizer.md +8 -10
- package/dist/docs/references/reference-processors-working-memory-processor.md +14 -18
- package/dist/docs/references/reference-rag-database-config.md +11 -7
- package/dist/docs/references/reference-rag-embeddings.md +12 -12
- package/dist/docs/references/reference-server-mastra-server.md +10 -10
- package/dist/docs/references/reference-server-register-api-route.md +13 -13
- package/dist/docs/references/reference-storage-cloudflare-d1.md +5 -5
- package/dist/docs/references/reference-storage-composite.md +9 -9
- package/dist/docs/references/reference-storage-lance.md +3 -3
- package/dist/docs/references/reference-storage-libsql.md +2 -2
- package/dist/docs/references/reference-storage-mongodb.md +5 -5
- package/dist/docs/references/reference-storage-mssql.md +2 -2
- package/dist/docs/references/reference-storage-postgresql.md +25 -25
- package/dist/docs/references/reference-storage-upstash.md +3 -3
- package/dist/docs/references/reference-streaming-ChunkType.md +251 -59
- package/dist/docs/references/reference-streaming-agents-MastraModelOutput.md +86 -16
- package/dist/docs/references/reference-streaming-agents-streamLegacy.md +79 -39
- package/dist/docs/references/reference-streaming-workflows-resumeStream.md +18 -8
- package/dist/docs/references/reference-streaming-workflows-stream.md +21 -9
- package/dist/docs/references/reference-streaming-workflows-timeTravelStream.md +4 -4
- package/dist/docs/references/reference-tools-create-tool.md +25 -21
- package/dist/docs/references/reference-tools-graph-rag-tool.md +16 -18
- package/dist/docs/references/reference-tools-mcp-client.md +38 -27
- package/dist/docs/references/reference-tools-mcp-server.md +45 -45
- package/dist/docs/references/reference-tools-vector-query-tool.md +34 -22
- package/dist/docs/references/reference-vectors-libsql.md +31 -31
- package/dist/docs/references/reference-vectors-mongodb.md +32 -32
- package/dist/docs/references/reference-vectors-pg.md +60 -44
- package/dist/docs/references/reference-vectors-upstash.md +25 -25
- package/dist/docs/references/reference-voice-composite-voice.md +10 -10
- package/dist/docs/references/reference-voice-mastra-voice.md +20 -20
- package/dist/docs/references/reference-voice-voice.addInstructions.md +1 -1
- package/dist/docs/references/reference-voice-voice.addTools.md +1 -1
- package/dist/docs/references/reference-voice-voice.connect.md +3 -3
- package/dist/docs/references/reference-voice-voice.events.md +11 -11
- package/dist/docs/references/reference-voice-voice.listen.md +9 -9
- package/dist/docs/references/reference-voice-voice.on.md +2 -2
- package/dist/docs/references/reference-voice-voice.speak.md +11 -11
- package/dist/docs/references/reference-workflows-run-methods-cancel.md +2 -2
- package/dist/docs/references/reference-workflows-run-methods-restart.md +17 -5
- package/dist/docs/references/reference-workflows-run-methods-resume.md +23 -9
- package/dist/docs/references/reference-workflows-run-methods-start.md +22 -8
- package/dist/docs/references/reference-workflows-run-methods-startAsync.md +12 -6
- package/dist/docs/references/reference-workflows-run-methods-timeTravel.md +29 -13
- package/dist/docs/references/reference-workflows-run.md +12 -12
- package/dist/docs/references/reference-workflows-step.md +24 -26
- package/dist/docs/references/reference-workflows-workflow-methods-branch.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-commit.md +1 -1
- package/dist/docs/references/reference-workflows-workflow-methods-create-run.md +4 -4
- package/dist/docs/references/reference-workflows-workflow-methods-dountil.md +3 -3
- package/dist/docs/references/reference-workflows-workflow-methods-dowhile.md +3 -3
- package/dist/docs/references/reference-workflows-workflow-methods-foreach.md +9 -9
- package/dist/docs/references/reference-workflows-workflow-methods-map.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-parallel.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-sleep.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-sleepUntil.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-then.md +2 -2
- package/dist/docs/references/reference-workflows-workflow.md +40 -50
- package/dist/docs/references/reference-workspace-filesystem.md +22 -22
- package/dist/docs/references/reference-workspace-local-filesystem.md +35 -35
- package/dist/docs/references/reference-workspace-local-sandbox.md +26 -26
- package/dist/docs/references/reference-workspace-sandbox.md +8 -8
- package/dist/docs/references/reference-workspace-workspace-class.md +30 -34
- package/dist/editor/types.d.ts +1 -0
- 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.map +1 -1
- package/dist/harness/index.cjs +25 -21
- package/dist/harness/index.cjs.map +1 -1
- package/dist/harness/index.js +15 -11
- package/dist/harness/index.js.map +1 -1
- 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 +12 -12
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/model.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +5 -1
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-2FJK72J2.cjs +12 -0
- package/dist/{models-dev-UVWCKPA2.cjs.map → models-dev-2FJK72J2.cjs.map} +1 -1
- package/dist/models-dev-CMQG6EMO.js +3 -0
- package/dist/{models-dev-W3LXZTEB.js.map → models-dev-CMQG6EMO.js.map} +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +42 -42
- package/dist/processors/index.js +1 -1
- package/dist/processors/processors/skills.d.ts +9 -42
- package/dist/processors/processors/skills.d.ts.map +1 -1
- package/dist/provider-registry-EHOAWHFE.cjs +40 -0
- package/dist/{provider-registry-4HLP2JRR.cjs.map → provider-registry-EHOAWHFE.cjs.map} +1 -1
- package/dist/provider-registry-LVP6T63V.js +3 -0
- package/dist/{provider-registry-K3DWQSMH.js.map → provider-registry-LVP6T63V.js.map} +1 -1
- package/dist/provider-registry.json +12 -4
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/request-context/index.cjs +4 -4
- package/dist/request-context/index.d.ts.map +1 -1
- package/dist/request-context/index.js +1 -1
- package/dist/storage/base.d.ts +34 -1
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/constants.cjs +56 -56
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/agents/filesystem.d.ts +28 -0
- package/dist/storage/domains/agents/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/agents/index.d.ts +1 -0
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/experiments/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/mcp-clients/filesystem.d.ts +28 -0
- package/dist/storage/domains/mcp-clients/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/mcp-clients/index.d.ts +1 -0
- package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -1
- package/dist/storage/domains/mcp-servers/filesystem.d.ts +28 -0
- package/dist/storage/domains/mcp-servers/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/mcp-servers/index.d.ts +1 -0
- package/dist/storage/domains/mcp-servers/index.d.ts.map +1 -1
- package/dist/storage/domains/prompt-blocks/filesystem.d.ts +28 -0
- package/dist/storage/domains/prompt-blocks/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts +1 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -1
- package/dist/storage/domains/scorer-definitions/filesystem.d.ts +28 -0
- package/dist/storage/domains/scorer-definitions/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts +1 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -1
- package/dist/storage/domains/skills/filesystem.d.ts +28 -0
- package/dist/storage/domains/skills/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/skills/index.d.ts +1 -0
- package/dist/storage/domains/skills/index.d.ts.map +1 -1
- package/dist/storage/domains/workspaces/filesystem.d.ts +28 -0
- package/dist/storage/domains/workspaces/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/workspaces/index.d.ts +1 -0
- package/dist/storage/domains/workspaces/index.d.ts.map +1 -1
- package/dist/storage/filesystem-db.d.ts +82 -0
- package/dist/storage/filesystem-db.d.ts.map +1 -0
- package/dist/storage/filesystem-versioned.d.ts +148 -0
- package/dist/storage/filesystem-versioned.d.ts.map +1 -0
- package/dist/storage/filesystem.d.ts +39 -0
- package/dist/storage/filesystem.d.ts.map +1 -0
- package/dist/storage/git-history.d.ts +68 -0
- package/dist/storage/git-history.d.ts.map +1 -0
- package/dist/storage/index.cjs +208 -160
- package/dist/storage/index.d.ts +4 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -2
- package/dist/storage/types.d.ts +1 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/stream/RunOutput.d.ts +1 -1
- package/dist/stream/aisdk/v5/output-helpers.d.ts +6 -6
- package/dist/stream/base/output.d.ts +3 -3
- package/dist/stream/base/schema.d.ts +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 +6 -6
- 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 +6 -0
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +27 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils.cjs +23 -23
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +9 -9
- 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/index.cjs +25 -25
- package/dist/workflows/index.js +1 -1
- package/dist/workspace/index.cjs +70 -66
- package/dist/workspace/index.d.ts +1 -0
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/sandbox/execa.d.ts +9 -0
- package/dist/workspace/sandbox/execa.d.ts.map +1 -0
- package/dist/workspace/sandbox/local-process-manager.d.ts.map +1 -1
- package/dist/workspace/skills/index.d.ts +1 -0
- package/dist/workspace/skills/index.d.ts.map +1 -1
- package/dist/workspace/skills/tools.d.ts +36 -0
- package/dist/workspace/skills/tools.d.ts.map +1 -0
- package/dist/workspace/tools/execute-command.d.ts.map +1 -1
- package/dist/workspace/tools/output-helpers.d.ts +4 -3
- package/dist/workspace/tools/output-helpers.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/llm/model/provider-types.generated.d.ts +5 -1
- package/dist/chunk-3ZF7IC6Q.cjs.map +0 -1
- package/dist/chunk-4BXXAZ75.js.map +0 -1
- package/dist/chunk-4P35AVPE.cjs.map +0 -1
- package/dist/chunk-BFV3GSGS.js.map +0 -1
- package/dist/chunk-CCLV5CAA.js.map +0 -1
- package/dist/chunk-D4M6E4OQ.cjs.map +0 -1
- package/dist/chunk-D6HO5QAM.cjs.map +0 -1
- package/dist/chunk-G5R2755Q.cjs.map +0 -1
- package/dist/chunk-GJTLWOKJ.js.map +0 -1
- package/dist/chunk-H5S4PS44.cjs.map +0 -1
- package/dist/chunk-IOY7Y5GV.js.map +0 -1
- package/dist/chunk-JIRB5LX4.js.map +0 -1
- package/dist/chunk-MVYP55NA.js.map +0 -1
- package/dist/chunk-PKORY4ZZ.cjs.map +0 -1
- package/dist/chunk-QNXY3J6B.cjs.map +0 -1
- package/dist/chunk-SEKQJ447.js.map +0 -1
- package/dist/chunk-VDKWYUGC.cjs.map +0 -1
- package/dist/chunk-VWAK25TU.js.map +0 -1
- package/dist/chunk-WYPSC6CO.js.map +0 -1
- package/dist/chunk-YIJZBU54.cjs.map +0 -1
- package/dist/chunk-ZBESCKPX.cjs.map +0 -1
- package/dist/chunk-ZVWVQ6MG.js.map +0 -1
- package/dist/models-dev-UVWCKPA2.cjs +0 -12
- package/dist/models-dev-W3LXZTEB.js +0 -3
- package/dist/provider-registry-4HLP2JRR.cjs +0 -40
- package/dist/provider-registry-K3DWQSMH.js +0 -3
|
@@ -21,87 +21,77 @@ export const workflow = createWorkflow({
|
|
|
21
21
|
|
|
22
22
|
## Constructor parameters
|
|
23
23
|
|
|
24
|
-
**id
|
|
24
|
+
**id** (`string`): Unique identifier for the workflow
|
|
25
25
|
|
|
26
|
-
**inputSchema
|
|
26
|
+
**inputSchema** (`z.ZodType<any>`): Zod schema defining the input structure for the workflow
|
|
27
27
|
|
|
28
|
-
**outputSchema
|
|
28
|
+
**outputSchema** (`z.ZodType<any>`): Zod schema defining the output structure for the workflow
|
|
29
29
|
|
|
30
|
-
**stateSchema
|
|
30
|
+
**stateSchema** (`z.ZodObject<any>`): Optional Zod schema for the workflow state. Automatically injected when using Mastra's state system. If not specified, type is 'any'.
|
|
31
31
|
|
|
32
|
-
**requestContextSchema
|
|
32
|
+
**requestContextSchema** (`z.ZodType<any>`): Zod schema for validating request context values. When provided, the context is validated at the start of run.start(), throwing an error if validation fails.
|
|
33
33
|
|
|
34
|
-
**options
|
|
34
|
+
**options** (`WorkflowOptions`): Optional options for the workflow
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
**options.tracingPolicy** (`TracingPolicy`): Optional tracing policy for the workflow
|
|
37
37
|
|
|
38
|
-
**
|
|
38
|
+
**options.validateInputs** (`boolean`): Optional flag to determine whether to validate the workflow inputs. This also applies default values from zodSchemas on the workflow/step input/resume data. If input/resume data validation fails on start/resume, the workflow will not start/resume, it throws an error instead. If input data validation fails on a step execution, the step fails, causing the workflow to fail and the error is returned.
|
|
39
39
|
|
|
40
|
-
**
|
|
40
|
+
**options.shouldPersistSnapshot** (`(params: { stepResults: Record<string, StepResult<any, any, any, any>>; workflowStatus: WorkflowRunStatus }) => boolean`): Optional flag to determine whether to persist the workflow snapshot
|
|
41
41
|
|
|
42
|
-
**
|
|
42
|
+
**options.onFinish** (`(result: WorkflowFinishCallbackResult) => void | Promise<void>`): Callback invoked when workflow completes with any status (success, failed, suspended, tripwire). Receives the workflow result including status, output, error, and step results. Errors thrown in this callback are caught and logged, not propagated.
|
|
43
43
|
|
|
44
|
-
**onFinish
|
|
44
|
+
**options.onFinish.status** (`WorkflowRunStatus`): The workflow status: 'success', 'failed', 'suspended', or 'tripwire'
|
|
45
45
|
|
|
46
|
-
**
|
|
46
|
+
**options.onFinish.result** (`any`): The workflow output (when status is 'success')
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
**options.onFinish.error** (`SerializedError`): Error details (when status is 'failed')
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
**options.onFinish.steps** (`Record<string, StepResult>`): Individual step results with their status and output
|
|
51
51
|
|
|
52
|
-
**
|
|
52
|
+
**options.onFinish.tripwire** (`StepTripwireInfo`): Tripwire information (when status is 'tripwire')
|
|
53
53
|
|
|
54
|
-
**
|
|
54
|
+
**options.onFinish.runId** (`string`): The unique identifier for this workflow run
|
|
55
55
|
|
|
56
|
-
**
|
|
56
|
+
**options.onFinish.workflowId** (`string`): The workflow's identifier
|
|
57
57
|
|
|
58
|
-
**
|
|
58
|
+
**options.onFinish.resourceId** (`string`): Optional resource identifier (if provided when creating the run)
|
|
59
59
|
|
|
60
|
-
**
|
|
60
|
+
**options.onFinish.getInitData** (`() => any`): Function that returns the initial input data passed to the workflow
|
|
61
61
|
|
|
62
|
-
**
|
|
62
|
+
**options.onFinish.mastra** (`Mastra`): The Mastra instance (if workflow is registered with Mastra)
|
|
63
63
|
|
|
64
|
-
**
|
|
64
|
+
**options.onFinish.requestContext** (`RequestContext`): Request-scoped context data
|
|
65
65
|
|
|
66
|
-
**
|
|
66
|
+
**options.onFinish.logger** (`IMastraLogger`): The workflow's logger instance
|
|
67
67
|
|
|
68
|
-
**
|
|
68
|
+
**options.onFinish.state** (`Record<string, any>`): The workflow's current state object
|
|
69
69
|
|
|
70
|
-
**
|
|
70
|
+
**options.onError** (`(errorInfo: WorkflowErrorCallbackInfo) => void | Promise<void>`): Callback invoked only when workflow fails (failed or tripwire status). Receives error details and step results. Errors thrown in this callback are caught and logged, not propagated.
|
|
71
71
|
|
|
72
|
-
**
|
|
72
|
+
**options.onError.status** (`'failed' | 'tripwire'`): The workflow status (either 'failed' or 'tripwire')
|
|
73
73
|
|
|
74
|
-
**
|
|
74
|
+
**options.onError.error** (`SerializedError`): Error details
|
|
75
75
|
|
|
76
|
-
**
|
|
76
|
+
**options.onError.steps** (`Record<string, StepResult>`): Individual step results with their status and output
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
**options.onError.tripwire** (`StepTripwireInfo`): Tripwire information (when status is 'tripwire')
|
|
79
79
|
|
|
80
|
-
The
|
|
80
|
+
**options.onError.runId** (`string`): The unique identifier for this workflow run
|
|
81
81
|
|
|
82
|
-
**
|
|
82
|
+
**options.onError.workflowId** (`string`): The workflow's identifier
|
|
83
83
|
|
|
84
|
-
**
|
|
84
|
+
**options.onError.resourceId** (`string`): Optional resource identifier (if provided when creating the run)
|
|
85
85
|
|
|
86
|
-
**
|
|
86
|
+
**options.onError.getInitData** (`() => any`): Function that returns the initial input data passed to the workflow
|
|
87
87
|
|
|
88
|
-
**
|
|
88
|
+
**options.onError.mastra** (`Mastra`): The Mastra instance (if workflow is registered with Mastra)
|
|
89
89
|
|
|
90
|
-
**
|
|
90
|
+
**options.onError.requestContext** (`RequestContext`): Request-scoped context data
|
|
91
91
|
|
|
92
|
-
**
|
|
92
|
+
**options.onError.logger** (`IMastraLogger`): The workflow's logger instance
|
|
93
93
|
|
|
94
|
-
**
|
|
95
|
-
|
|
96
|
-
**getInitData:** (`() => any`): Function that returns the initial input data passed to the workflow
|
|
97
|
-
|
|
98
|
-
**mastra?:** (`Mastra`): The Mastra instance (if workflow is registered with Mastra)
|
|
99
|
-
|
|
100
|
-
**requestContext:** (`RequestContext`): Request-scoped context data
|
|
101
|
-
|
|
102
|
-
**logger:** (`IMastraLogger`): The workflow's logger instance
|
|
103
|
-
|
|
104
|
-
**state:** (`Record<string, any>`): The workflow's current state object
|
|
94
|
+
**options.onError.state** (`Record<string, any>`): The workflow's current state object
|
|
105
95
|
|
|
106
96
|
## Running with initial state
|
|
107
97
|
|
|
@@ -125,13 +115,13 @@ The `initialState` object should match the structure defined in the workflow's `
|
|
|
125
115
|
|
|
126
116
|
A workflow's `status` indicates its current execution state. The possible values are:
|
|
127
117
|
|
|
128
|
-
**success
|
|
118
|
+
**success** (`string`): All steps finished executing successfully, with a valid result output
|
|
129
119
|
|
|
130
|
-
**failed
|
|
120
|
+
**failed** (`string`): Workflow encountered an error during execution, with error details available
|
|
131
121
|
|
|
132
|
-
**suspended
|
|
122
|
+
**suspended** (`string`): Workflow execution is paused waiting for resume, with suspended step information
|
|
133
123
|
|
|
134
|
-
**tripwire
|
|
124
|
+
**tripwire** (`string`): Workflow was terminated by a processor tripwire. This occurs when an agent step within the workflow triggers a tripwire (e.g., content was blocked by a guardrail). The tripwire information is available on the result.
|
|
135
125
|
|
|
136
126
|
### Handling tripwire status
|
|
137
127
|
|
|
@@ -17,9 +17,9 @@ const buffer = await filesystem.readFile('/image.png', { encoding: 'binary' })
|
|
|
17
17
|
|
|
18
18
|
**Parameters:**
|
|
19
19
|
|
|
20
|
-
**path
|
|
20
|
+
**path** (`string`): File path relative to basePath
|
|
21
21
|
|
|
22
|
-
**options.encoding
|
|
22
|
+
**options.encoding** (`'utf-8' | 'binary'`): Text or binary encoding (Default: `'utf-8'`)
|
|
23
23
|
|
|
24
24
|
**Returns:** `Promise<string | Buffer>`
|
|
25
25
|
|
|
@@ -34,13 +34,13 @@ await filesystem.writeFile('/nested/path/file.md', content, { recursive: true })
|
|
|
34
34
|
|
|
35
35
|
**Parameters:**
|
|
36
36
|
|
|
37
|
-
**path
|
|
37
|
+
**path** (`string`): File path relative to basePath
|
|
38
38
|
|
|
39
|
-
**content
|
|
39
|
+
**content** (`string | Buffer`): File content
|
|
40
40
|
|
|
41
|
-
**options.recursive
|
|
41
|
+
**options.recursive** (`boolean`): Create parent directories if they don't exist (Default: `false`)
|
|
42
42
|
|
|
43
|
-
**options.overwrite
|
|
43
|
+
**options.overwrite** (`boolean`): Overwrite existing file (Default: `true`)
|
|
44
44
|
|
|
45
45
|
### `deleteFile(path, options?)`
|
|
46
46
|
|
|
@@ -53,9 +53,9 @@ await filesystem.deleteFile('/docs/maybe.md', { force: true }) // Don't throw if
|
|
|
53
53
|
|
|
54
54
|
**Parameters:**
|
|
55
55
|
|
|
56
|
-
**path
|
|
56
|
+
**path** (`string`): File path
|
|
57
57
|
|
|
58
|
-
**options.force
|
|
58
|
+
**options.force** (`boolean`): Don't throw error if file doesn't exist (Default: `false`)
|
|
59
59
|
|
|
60
60
|
### `appendFile(path, content)`
|
|
61
61
|
|
|
@@ -67,9 +67,9 @@ await filesystem.appendFile('/logs/app.log', 'New log entry\n')
|
|
|
67
67
|
|
|
68
68
|
**Parameters:**
|
|
69
69
|
|
|
70
|
-
**path
|
|
70
|
+
**path** (`string`): File path
|
|
71
71
|
|
|
72
|
-
**content
|
|
72
|
+
**content** (`string | Buffer`): Content to append
|
|
73
73
|
|
|
74
74
|
### `copyFile(src, dest, options?)`
|
|
75
75
|
|
|
@@ -81,11 +81,11 @@ await filesystem.copyFile('/docs/template.md', '/docs/new-doc.md')
|
|
|
81
81
|
|
|
82
82
|
**Parameters:**
|
|
83
83
|
|
|
84
|
-
**src
|
|
84
|
+
**src** (`string`): Source file path
|
|
85
85
|
|
|
86
|
-
**dest
|
|
86
|
+
**dest** (`string`): Destination file path
|
|
87
87
|
|
|
88
|
-
**options.overwrite
|
|
88
|
+
**options.overwrite** (`boolean`): Overwrite destination if it exists (Default: `true`)
|
|
89
89
|
|
|
90
90
|
### `moveFile(src, dest, options?)`
|
|
91
91
|
|
|
@@ -97,11 +97,11 @@ await filesystem.moveFile('/docs/draft.md', '/docs/final.md')
|
|
|
97
97
|
|
|
98
98
|
**Parameters:**
|
|
99
99
|
|
|
100
|
-
**src
|
|
100
|
+
**src** (`string`): Source file path
|
|
101
101
|
|
|
102
|
-
**dest
|
|
102
|
+
**dest** (`string`): Destination file path
|
|
103
103
|
|
|
104
|
-
**options.overwrite
|
|
104
|
+
**options.overwrite** (`boolean`): Overwrite destination if it exists (Default: `true`)
|
|
105
105
|
|
|
106
106
|
### `readdir(path, options?)`
|
|
107
107
|
|
|
@@ -135,9 +135,9 @@ await filesystem.mkdir('/deeply/nested/path', { recursive: true })
|
|
|
135
135
|
|
|
136
136
|
**Parameters:**
|
|
137
137
|
|
|
138
|
-
**path
|
|
138
|
+
**path** (`string`): Directory path
|
|
139
139
|
|
|
140
|
-
**options.recursive
|
|
140
|
+
**options.recursive** (`boolean`): Create parent directories (Default: `false`)
|
|
141
141
|
|
|
142
142
|
### `rmdir(path, options?)`
|
|
143
143
|
|
|
@@ -150,11 +150,11 @@ await filesystem.rmdir('/docs/nested', { recursive: true })
|
|
|
150
150
|
|
|
151
151
|
**Parameters:**
|
|
152
152
|
|
|
153
|
-
**path
|
|
153
|
+
**path** (`string`): Directory path
|
|
154
154
|
|
|
155
|
-
**options.recursive
|
|
155
|
+
**options.recursive** (`boolean`): Remove contents recursively (Default: `false`)
|
|
156
156
|
|
|
157
|
-
**options.force
|
|
157
|
+
**options.force** (`boolean`): Don't throw if directory doesn't exist (Default: `false`)
|
|
158
158
|
|
|
159
159
|
### `exists(path)`
|
|
160
160
|
|
|
@@ -245,7 +245,7 @@ const instructions = filesystem.getInstructions?.()
|
|
|
245
245
|
|
|
246
246
|
**Parameters:**
|
|
247
247
|
|
|
248
|
-
**opts.requestContext
|
|
248
|
+
**opts.requestContext** (`RequestContext`): Forwarded to the \`instructions\` function if one was provided in the constructor.
|
|
249
249
|
|
|
250
250
|
**Returns:** `string`
|
|
251
251
|
|
|
@@ -32,31 +32,31 @@ const response = await agent.generate('List all files in the workspace')
|
|
|
32
32
|
|
|
33
33
|
## Constructor parameters
|
|
34
34
|
|
|
35
|
-
**basePath
|
|
35
|
+
**basePath** (`string`): Base directory path on disk. All file paths are resolved relative to this directory.
|
|
36
36
|
|
|
37
|
-
**id
|
|
37
|
+
**id** (`string`): Unique identifier for this filesystem instance (Default: `Auto-generated`)
|
|
38
38
|
|
|
39
|
-
**contained
|
|
39
|
+
**contained** (`boolean`): When true, all file operations are restricted to stay within basePath. Prevents path traversal attacks and symlink escapes. See \[containment]\(/docs/workspace/filesystem#containment). (Default: `true`)
|
|
40
40
|
|
|
41
|
-
**allowedPaths
|
|
41
|
+
**allowedPaths** (`string[]`): Additional absolute paths that are allowed beyond basePath. Useful with \`contained: true\` to grant access to specific directories without disabling containment entirely. Paths are resolved to absolute paths. (Default: `[]`)
|
|
42
42
|
|
|
43
|
-
**instructions
|
|
43
|
+
**instructions** (`string | ((opts: { defaultInstructions: string; requestContext?: RequestContext }) => string)`): Custom instructions that override the default instructions returned by getInstructions(). Pass a string to fully replace them, or a function to extend them with access to the current requestContext for per-request customization.
|
|
44
44
|
|
|
45
|
-
**readOnly
|
|
45
|
+
**readOnly** (`boolean`): When true, all write operations are blocked. Read operations are still allowed. (Default: `false`)
|
|
46
46
|
|
|
47
47
|
## Properties
|
|
48
48
|
|
|
49
|
-
**id
|
|
49
|
+
**id** (`string`): Filesystem instance identifier
|
|
50
50
|
|
|
51
|
-
**name
|
|
51
|
+
**name** (`string`): Provider name ('LocalFilesystem')
|
|
52
52
|
|
|
53
|
-
**provider
|
|
53
|
+
**provider** (`string`): Provider identifier ('local')
|
|
54
54
|
|
|
55
|
-
**basePath
|
|
55
|
+
**basePath** (`string`): The absolute base path on disk
|
|
56
56
|
|
|
57
|
-
**readOnly
|
|
57
|
+
**readOnly** (`boolean | undefined`): Whether the filesystem is in read-only mode
|
|
58
58
|
|
|
59
|
-
**allowedPaths
|
|
59
|
+
**allowedPaths** (`readonly string[]`): Current set of additional allowed paths (absolute, resolved). These paths are permitted beyond basePath when containment is enabled.
|
|
60
60
|
|
|
61
61
|
## Methods
|
|
62
62
|
|
|
@@ -101,7 +101,7 @@ filesystem.setAllowedPaths([])
|
|
|
101
101
|
|
|
102
102
|
**Parameters:**
|
|
103
103
|
|
|
104
|
-
**pathsOrUpdater
|
|
104
|
+
**pathsOrUpdater** (`string[] | ((current: readonly string[]) => string[])`): New allowed paths array or updater function receiving current paths
|
|
105
105
|
|
|
106
106
|
### `readFile(path, options?)`
|
|
107
107
|
|
|
@@ -114,9 +114,9 @@ const buffer = await filesystem.readFile('/image.png', { encoding: 'binary' })
|
|
|
114
114
|
|
|
115
115
|
**Parameters:**
|
|
116
116
|
|
|
117
|
-
**path
|
|
117
|
+
**path** (`string`): File path relative to basePath
|
|
118
118
|
|
|
119
|
-
**options.encoding
|
|
119
|
+
**options.encoding** (`'utf-8' | 'binary'`): Text or binary encoding (Default: `'utf-8'`)
|
|
120
120
|
|
|
121
121
|
### `writeFile(path, content, options?)`
|
|
122
122
|
|
|
@@ -129,13 +129,13 @@ await filesystem.writeFile('/nested/path/file.md', content, { recursive: true })
|
|
|
129
129
|
|
|
130
130
|
**Parameters:**
|
|
131
131
|
|
|
132
|
-
**path
|
|
132
|
+
**path** (`string`): File path relative to basePath
|
|
133
133
|
|
|
134
|
-
**content
|
|
134
|
+
**content** (`string | Buffer`): File content
|
|
135
135
|
|
|
136
|
-
**options.recursive
|
|
136
|
+
**options.recursive** (`boolean`): Create parent directories if they don't exist (Default: `false`)
|
|
137
137
|
|
|
138
|
-
**options.overwrite
|
|
138
|
+
**options.overwrite** (`boolean`): Overwrite existing file (Default: `true`)
|
|
139
139
|
|
|
140
140
|
### `appendFile(path, content)`
|
|
141
141
|
|
|
@@ -147,9 +147,9 @@ await filesystem.appendFile('/logs/app.log', 'New log entry\n')
|
|
|
147
147
|
|
|
148
148
|
**Parameters:**
|
|
149
149
|
|
|
150
|
-
**path
|
|
150
|
+
**path** (`string`): File path relative to basePath
|
|
151
151
|
|
|
152
|
-
**content
|
|
152
|
+
**content** (`string | Buffer`): Content to append
|
|
153
153
|
|
|
154
154
|
### `deleteFile(path, options?)`
|
|
155
155
|
|
|
@@ -162,9 +162,9 @@ await filesystem.deleteFile('/docs/maybe.md', { force: true }) // Don't throw if
|
|
|
162
162
|
|
|
163
163
|
**Parameters:**
|
|
164
164
|
|
|
165
|
-
**path
|
|
165
|
+
**path** (`string`): File path
|
|
166
166
|
|
|
167
|
-
**options.force
|
|
167
|
+
**options.force** (`boolean`): Don't throw error if file doesn't exist (Default: `false`)
|
|
168
168
|
|
|
169
169
|
### `copyFile(src, dest, options?)`
|
|
170
170
|
|
|
@@ -177,11 +177,11 @@ await filesystem.copyFile('/src/config.json', '/backup/config.json', { overwrite
|
|
|
177
177
|
|
|
178
178
|
**Parameters:**
|
|
179
179
|
|
|
180
|
-
**src
|
|
180
|
+
**src** (`string`): Source file path
|
|
181
181
|
|
|
182
|
-
**dest
|
|
182
|
+
**dest** (`string`): Destination file path
|
|
183
183
|
|
|
184
|
-
**options.overwrite
|
|
184
|
+
**options.overwrite** (`boolean`): Overwrite destination if it exists (Default: `true`)
|
|
185
185
|
|
|
186
186
|
### `moveFile(src, dest, options?)`
|
|
187
187
|
|
|
@@ -194,11 +194,11 @@ await filesystem.moveFile('/temp/upload.txt', '/files/document.txt')
|
|
|
194
194
|
|
|
195
195
|
**Parameters:**
|
|
196
196
|
|
|
197
|
-
**src
|
|
197
|
+
**src** (`string`): Source file path
|
|
198
198
|
|
|
199
|
-
**dest
|
|
199
|
+
**dest** (`string`): Destination file path
|
|
200
200
|
|
|
201
|
-
**options.overwrite
|
|
201
|
+
**options.overwrite** (`boolean`): Overwrite destination if it exists (Default: `true`)
|
|
202
202
|
|
|
203
203
|
### `mkdir(path, options?)`
|
|
204
204
|
|
|
@@ -211,9 +211,9 @@ await filesystem.mkdir('/deeply/nested/path', { recursive: true })
|
|
|
211
211
|
|
|
212
212
|
**Parameters:**
|
|
213
213
|
|
|
214
|
-
**path
|
|
214
|
+
**path** (`string`): Directory path
|
|
215
215
|
|
|
216
|
-
**options.recursive
|
|
216
|
+
**options.recursive** (`boolean`): Create parent directories (Default: `false`)
|
|
217
217
|
|
|
218
218
|
### `rmdir(path, options?)`
|
|
219
219
|
|
|
@@ -226,11 +226,11 @@ await filesystem.rmdir('/docs/nested', { recursive: true })
|
|
|
226
226
|
|
|
227
227
|
**Parameters:**
|
|
228
228
|
|
|
229
|
-
**path
|
|
229
|
+
**path** (`string`): Directory path
|
|
230
230
|
|
|
231
|
-
**options.recursive
|
|
231
|
+
**options.recursive** (`boolean`): Remove contents recursively (Default: `false`)
|
|
232
232
|
|
|
233
|
-
**options.force
|
|
233
|
+
**options.force** (`boolean`): Don't throw if directory doesn't exist (Default: `false`)
|
|
234
234
|
|
|
235
235
|
### `readdir(path, options?)`
|
|
236
236
|
|
|
@@ -284,7 +284,7 @@ const instructions = filesystem.getInstructions({ requestContext })
|
|
|
284
284
|
|
|
285
285
|
**Parameters:**
|
|
286
286
|
|
|
287
|
-
**opts.requestContext
|
|
287
|
+
**opts.requestContext** (`RequestContext`): Forwarded to the \`instructions\` function if one was provided in the constructor.
|
|
288
288
|
|
|
289
289
|
**Returns:** `string`
|
|
290
290
|
|
|
@@ -40,47 +40,47 @@ const response = await agent.generate('Run npm install')
|
|
|
40
40
|
|
|
41
41
|
## Constructor parameters
|
|
42
42
|
|
|
43
|
-
**id
|
|
43
|
+
**id** (`string`): Unique identifier for this sandbox instance (Default: `Auto-generated`)
|
|
44
44
|
|
|
45
|
-
**workingDirectory
|
|
45
|
+
**workingDirectory** (`string`): Directory for command execution. Defaults to .sandbox/ in process.cwd() for isolation from seatbelt profiles. (Default: `process.cwd()/.sandbox/`)
|
|
46
46
|
|
|
47
|
-
**env
|
|
47
|
+
**env** (`NodeJS.ProcessEnv`): Environment variables to set. PATH is included by default unless overridden.
|
|
48
48
|
|
|
49
|
-
**timeout
|
|
49
|
+
**timeout** (`number`): Default timeout for operations in milliseconds (Default: `30000`)
|
|
50
50
|
|
|
51
|
-
**isolation
|
|
51
|
+
**isolation** (`'none' | 'seatbelt' | 'bwrap'`): Native OS sandboxing backend. 'seatbelt' for macOS, 'bwrap' for Linux. (Default: `'none'`)
|
|
52
52
|
|
|
53
|
-
**instructions
|
|
53
|
+
**instructions** (`string | ((opts: { defaultInstructions: string; requestContext?: RequestContext }) => string)`): Custom instructions that override the default instructions returned by getInstructions(). Pass a string to fully replace them, or a function to extend them with access to the current requestContext for per-request customization.
|
|
54
54
|
|
|
55
|
-
**nativeSandbox
|
|
55
|
+
**nativeSandbox** (`NativeSandboxConfig`): Configuration for native sandboxing (see NativeSandboxConfig below).
|
|
56
56
|
|
|
57
57
|
## NativeSandboxConfig
|
|
58
58
|
|
|
59
59
|
Configuration options for native OS sandboxing (used with `isolation: 'seatbelt'` or `'bwrap'`).
|
|
60
60
|
|
|
61
|
-
**allowNetwork
|
|
61
|
+
**allowNetwork** (`boolean`): Allow network access from sandboxed commands. (Default: `false`)
|
|
62
62
|
|
|
63
|
-
**readOnlyPaths
|
|
63
|
+
**readOnlyPaths** (`string[]`): Additional paths to allow read-only access (system paths are always readable).
|
|
64
64
|
|
|
65
|
-
**readWritePaths
|
|
65
|
+
**readWritePaths** (`string[]`): Additional paths to allow read-write access beyond the workspace directory.
|
|
66
66
|
|
|
67
|
-
**seatbeltProfilePath
|
|
67
|
+
**seatbeltProfilePath** (`string`): Path to a custom seatbelt profile file (macOS only). If the file exists, it's used; if not, a default profile is generated and written to this path.
|
|
68
68
|
|
|
69
|
-
**bwrapArgs
|
|
69
|
+
**bwrapArgs** (`string[]`): Additional arguments to pass to bwrap (Linux only).
|
|
70
70
|
|
|
71
|
-
**allowSystemBinaries
|
|
71
|
+
**allowSystemBinaries** (`boolean`): Allow read access to standard system binary paths (/bin, /usr/bin, etc.). (Default: `true`)
|
|
72
72
|
|
|
73
73
|
## Properties
|
|
74
74
|
|
|
75
|
-
**id
|
|
75
|
+
**id** (`string`): Sandbox instance identifier
|
|
76
76
|
|
|
77
|
-
**name
|
|
77
|
+
**name** (`string`): Provider name ('LocalSandbox')
|
|
78
78
|
|
|
79
|
-
**provider
|
|
79
|
+
**provider** (`string`): Provider identifier ('local')
|
|
80
80
|
|
|
81
|
-
**status
|
|
81
|
+
**status** (`ProviderStatus`): 'starting' | 'running' | 'stopped' | 'error'
|
|
82
82
|
|
|
83
|
-
**workingDirectory
|
|
83
|
+
**workingDirectory** (`string`): The configured working directory
|
|
84
84
|
|
|
85
85
|
## Methods
|
|
86
86
|
|
|
@@ -135,19 +135,19 @@ const installResult = await sandbox.executeCommand('npm', ['install', 'lodash'],
|
|
|
135
135
|
|
|
136
136
|
**Parameters:**
|
|
137
137
|
|
|
138
|
-
**command
|
|
138
|
+
**command** (`string`): Command to execute
|
|
139
139
|
|
|
140
|
-
**args
|
|
140
|
+
**args** (`string[]`): Command arguments
|
|
141
141
|
|
|
142
|
-
**options.timeout
|
|
142
|
+
**options.timeout** (`number`): Execution timeout in milliseconds
|
|
143
143
|
|
|
144
|
-
**options.cwd
|
|
144
|
+
**options.cwd** (`string`): Working directory for the command
|
|
145
145
|
|
|
146
|
-
**options.env
|
|
146
|
+
**options.env** (`Record<string, string>`): Additional environment variables
|
|
147
147
|
|
|
148
|
-
**options.onStdout
|
|
148
|
+
**options.onStdout** (`(data: string) => void`): Callback for stdout streaming
|
|
149
149
|
|
|
150
|
-
**options.onStderr
|
|
150
|
+
**options.onStderr** (`(data: string) => void`): Callback for stderr streaming
|
|
151
151
|
|
|
152
152
|
### `getInfo()`
|
|
153
153
|
|
|
@@ -175,7 +175,7 @@ const instructions = sandbox.getInstructions({ requestContext })
|
|
|
175
175
|
|
|
176
176
|
**Parameters:**
|
|
177
177
|
|
|
178
|
-
**opts.requestContext
|
|
178
|
+
**opts.requestContext** (`RequestContext`): Forwarded to the \`instructions\` function if one was provided in the constructor.
|
|
179
179
|
|
|
180
180
|
**Returns:** `string`
|
|
181
181
|
|
|
@@ -43,19 +43,19 @@ const result = await sandbox.executeCommand('npm', ['install', 'lodash'])
|
|
|
43
43
|
|
|
44
44
|
**Parameters:**
|
|
45
45
|
|
|
46
|
-
**command
|
|
46
|
+
**command** (`string`): Command to execute
|
|
47
47
|
|
|
48
|
-
**args
|
|
48
|
+
**args** (`string[]`): Command arguments
|
|
49
49
|
|
|
50
|
-
**options.timeout
|
|
50
|
+
**options.timeout** (`number`): Execution timeout in milliseconds
|
|
51
51
|
|
|
52
|
-
**options.cwd
|
|
52
|
+
**options.cwd** (`string`): Working directory for the command
|
|
53
53
|
|
|
54
|
-
**options.env
|
|
54
|
+
**options.env** (`Record<string, string>`): Additional environment variables
|
|
55
55
|
|
|
56
|
-
**options.onStdout
|
|
56
|
+
**options.onStdout** (`(data: string) => void`): Callback for stdout streaming
|
|
57
57
|
|
|
58
|
-
**options.onStderr
|
|
58
|
+
**options.onStderr** (`(data: string) => void`): Callback for stderr streaming
|
|
59
59
|
|
|
60
60
|
### `getInfo()`
|
|
61
61
|
|
|
@@ -77,7 +77,7 @@ const instructions = sandbox.getInstructions?.()
|
|
|
77
77
|
|
|
78
78
|
**Parameters:**
|
|
79
79
|
|
|
80
|
-
**opts.requestContext
|
|
80
|
+
**opts.requestContext** (`RequestContext`): Forwarded to the \`instructions\` function if one was provided in the constructor.
|
|
81
81
|
|
|
82
82
|
**Returns:** `string`
|
|
83
83
|
|