@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
|
@@ -17,37 +17,35 @@ const processor = new PIIDetector({
|
|
|
17
17
|
|
|
18
18
|
## Constructor parameters
|
|
19
19
|
|
|
20
|
-
**options
|
|
20
|
+
**options** (`Options`): Configuration options for PII detection and redaction
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
**options.model** (`MastraModelConfig`): Model configuration for the detection agent
|
|
23
23
|
|
|
24
|
-
**
|
|
24
|
+
**options.detectionTypes** (`string[]`): PII types to detect. If not specified, uses default types
|
|
25
25
|
|
|
26
|
-
**
|
|
26
|
+
**options.threshold** (`number`): Confidence threshold for flagging (0-1). PII is flagged if any category score exceeds this threshold
|
|
27
27
|
|
|
28
|
-
**
|
|
28
|
+
**options.strategy** (`'block' | 'warn' | 'filter' | 'redact'`): Strategy when PII is detected: 'block' rejects with error, 'warn' logs warning but allows through, 'filter' removes flagged messages, 'redact' replaces PII with redacted versions
|
|
29
29
|
|
|
30
|
-
**
|
|
30
|
+
**options.redactionMethod** (`'mask' | 'hash' | 'remove' | 'placeholder'`): Redaction method for PII: 'mask' replaces with asterisks, 'hash' replaces with SHA256 hash, 'remove' removes entirely, 'placeholder' replaces with type placeholder
|
|
31
31
|
|
|
32
|
-
**
|
|
32
|
+
**options.instructions** (`string`): Custom detection instructions for the agent. If not provided, uses default instructions based on detection types
|
|
33
33
|
|
|
34
|
-
**
|
|
34
|
+
**options.includeDetections** (`boolean`): Whether to include detection details in logs. Useful for compliance auditing and debugging
|
|
35
35
|
|
|
36
|
-
**
|
|
36
|
+
**options.preserveFormat** (`boolean`): Whether to preserve PII format during redaction. When true, maintains structure like \*\*\*-\*\*-1234 for phone numbers
|
|
37
37
|
|
|
38
|
-
**
|
|
39
|
-
|
|
40
|
-
**providerOptions?:** (`ProviderOptions`): Provider-specific options passed to the internal detection agent. Use this to control model behavior like reasoning effort for thinking models (e.g., \`{ openai: { reasoningEffort: 'low' } }\`)
|
|
38
|
+
**options.providerOptions** (`ProviderOptions`): Provider-specific options passed to the internal detection agent. Use this to control model behavior like reasoning effort for thinking models (e.g., \`{ openai: { reasoningEffort: 'low' } }\`)
|
|
41
39
|
|
|
42
40
|
## Returns
|
|
43
41
|
|
|
44
|
-
**id
|
|
42
|
+
**id** (`string`): Processor identifier set to 'pii-detector'
|
|
45
43
|
|
|
46
|
-
**name
|
|
44
|
+
**name** (`string`): Optional processor display name
|
|
47
45
|
|
|
48
|
-
**processInput
|
|
46
|
+
**processInput** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never; tracingContext?: TracingContext }) => Promise<MastraDBMessage[]>`): Processes input messages to detect and redact PII before sending to LLM
|
|
49
47
|
|
|
50
|
-
**processOutputStream
|
|
48
|
+
**processOutputStream** (`(args: { part: ChunkType; streamParts: ChunkType[]; state: Record<string, any>; abort: (reason?: string) => never; tracingContext?: TracingContext }) => Promise<ChunkType | null | undefined>`): Processes streaming output parts to detect and redact PII during streaming
|
|
51
49
|
|
|
52
50
|
## Extended usage example
|
|
53
51
|
|
|
@@ -80,9 +80,9 @@ interface Processor<TId extends string = string> {
|
|
|
80
80
|
|
|
81
81
|
## Properties
|
|
82
82
|
|
|
83
|
-
**id
|
|
83
|
+
**id** (`string`): Unique identifier for the processor. Used for tracing and debugging.
|
|
84
84
|
|
|
85
|
-
**name
|
|
85
|
+
**name** (`string`): Optional display name for the processor. Falls back to id if not provided.
|
|
86
86
|
|
|
87
87
|
## Methods
|
|
88
88
|
|
|
@@ -96,29 +96,29 @@ processInput?(args: ProcessInputArgs): Promise<ProcessInputResult> | ProcessInpu
|
|
|
96
96
|
|
|
97
97
|
#### ProcessInputArgs
|
|
98
98
|
|
|
99
|
-
**messages
|
|
99
|
+
**messages** (`MastraDBMessage[]`): User and assistant messages to process (excludes system messages).
|
|
100
100
|
|
|
101
|
-
**systemMessages
|
|
101
|
+
**systemMessages** (`CoreMessage[]`): All system messages (agent instructions, memory context, user-provided). Can be modified and returned.
|
|
102
102
|
|
|
103
|
-
**messageList
|
|
103
|
+
**messageList** (`MessageList`): Full MessageList instance for advanced message management.
|
|
104
104
|
|
|
105
|
-
**abort
|
|
105
|
+
**abort** (`(reason?: string, options?: { retry?: boolean; metadata?: unknown }) => never`): Function to abort processing. Throws a TripWire error that stops execution. Pass \`retry: true\` to request the LLM retry the step with feedback.
|
|
106
106
|
|
|
107
|
-
**retryCount
|
|
107
|
+
**retryCount** (`number`): Number of times processors have triggered retry for this generation. Use this to limit retry attempts.
|
|
108
108
|
|
|
109
|
-
**tracingContext
|
|
109
|
+
**tracingContext** (`TracingContext`): Tracing context for observability.
|
|
110
110
|
|
|
111
|
-
**requestContext
|
|
111
|
+
**requestContext** (`RequestContext`): Request-scoped context with execution metadata like threadId and resourceId.
|
|
112
112
|
|
|
113
113
|
#### ProcessInputResult
|
|
114
114
|
|
|
115
115
|
The method can return one of three types:
|
|
116
116
|
|
|
117
|
-
**MastraDBMessage\[]
|
|
117
|
+
**MastraDBMessage\[]** (`array`): Transformed messages array. System messages remain unchanged.
|
|
118
118
|
|
|
119
|
-
**MessageList
|
|
119
|
+
**MessageList** (`MessageList`): The same messageList instance passed in. Indicates you've mutated it directly.
|
|
120
120
|
|
|
121
|
-
**{ messages, systemMessages }
|
|
121
|
+
**{ messages, systemMessages }** (`object`): Object with both transformed messages and modified system messages.
|
|
122
122
|
|
|
123
123
|
***
|
|
124
124
|
|
|
@@ -141,59 +141,59 @@ processInputStep?(args: ProcessInputStepArgs): ProcessorMessageResult;
|
|
|
141
141
|
|
|
142
142
|
#### ProcessInputStepArgs
|
|
143
143
|
|
|
144
|
-
**messages
|
|
144
|
+
**messages** (`MastraDBMessage[]`): All messages including tool calls and results from previous steps (read-only snapshot).
|
|
145
145
|
|
|
146
|
-
**messageList
|
|
146
|
+
**messageList** (`MessageList`): MessageList instance for managing messages. Can mutate directly or return in result.
|
|
147
147
|
|
|
148
|
-
**stepNumber
|
|
148
|
+
**stepNumber** (`number`): Current step number (0-indexed). Step 0 is the initial LLM call.
|
|
149
149
|
|
|
150
|
-
**steps
|
|
150
|
+
**steps** (`StepResult[]`): Results from previous steps, including text, toolCalls, and toolResults.
|
|
151
151
|
|
|
152
|
-
**systemMessages
|
|
152
|
+
**systemMessages** (`CoreMessage[]`): All system messages (read-only snapshot). Return in result to replace.
|
|
153
153
|
|
|
154
|
-
**model
|
|
154
|
+
**model** (`MastraLanguageModelV2`): Current model being used. Return a different model in result to switch.
|
|
155
155
|
|
|
156
|
-
**toolChoice
|
|
156
|
+
**toolChoice** (`ToolChoice`): Current tool choice setting ('auto', 'none', 'required', or specific tool).
|
|
157
157
|
|
|
158
|
-
**activeTools
|
|
158
|
+
**activeTools** (`string[]`): Currently active tool names. Return filtered array to limit tools.
|
|
159
159
|
|
|
160
|
-
**tools
|
|
160
|
+
**tools** (`ToolSet`): Current tools available for this step. Return in result to add/replace tools.
|
|
161
161
|
|
|
162
|
-
**providerOptions
|
|
162
|
+
**providerOptions** (`SharedV2ProviderOptions`): Provider-specific options (e.g., Anthropic cacheControl, OpenAI reasoningEffort).
|
|
163
163
|
|
|
164
|
-
**modelSettings
|
|
164
|
+
**modelSettings** (`CallSettings`): Model settings like temperature, maxTokens, topP.
|
|
165
165
|
|
|
166
|
-
**structuredOutput
|
|
166
|
+
**structuredOutput** (`StructuredOutputOptions`): Structured output configuration (schema, output mode). Return in result to modify.
|
|
167
167
|
|
|
168
|
-
**abort
|
|
168
|
+
**abort** (`(reason?: string) => never`): Function to abort processing.
|
|
169
169
|
|
|
170
|
-
**tracingContext
|
|
170
|
+
**tracingContext** (`TracingContext`): Tracing context for observability.
|
|
171
171
|
|
|
172
|
-
**requestContext
|
|
172
|
+
**requestContext** (`RequestContext`): Request-scoped context with execution metadata.
|
|
173
173
|
|
|
174
174
|
#### ProcessInputStepResult
|
|
175
175
|
|
|
176
176
|
The method can return any combination of these properties:
|
|
177
177
|
|
|
178
|
-
**model
|
|
178
|
+
**model** (`LanguageModelV2 | string`): Change the model for this step. Can be a model instance or router ID like 'openai/gpt-4o'.
|
|
179
179
|
|
|
180
|
-
**toolChoice
|
|
180
|
+
**toolChoice** (`ToolChoice`): Change tool selection behavior for this step.
|
|
181
181
|
|
|
182
|
-
**activeTools
|
|
182
|
+
**activeTools** (`string[]`): Filter which tools are available for this step.
|
|
183
183
|
|
|
184
|
-
**tools
|
|
184
|
+
**tools** (`ToolSet`): Replace or modify tools for this step. Use spread to merge: { tools: { ...tools, newTool } }.
|
|
185
185
|
|
|
186
|
-
**messages
|
|
186
|
+
**messages** (`MastraDBMessage[]`): Replace all messages. Cannot be used with messageList.
|
|
187
187
|
|
|
188
|
-
**messageList
|
|
188
|
+
**messageList** (`MessageList`): Return the same messageList instance (indicates you mutated it). Cannot be used with messages.
|
|
189
189
|
|
|
190
|
-
**systemMessages
|
|
190
|
+
**systemMessages** (`CoreMessage[]`): Replace all system messages for this step only.
|
|
191
191
|
|
|
192
|
-
**providerOptions
|
|
192
|
+
**providerOptions** (`SharedV2ProviderOptions`): Change provider-specific options for this step.
|
|
193
193
|
|
|
194
|
-
**modelSettings
|
|
194
|
+
**modelSettings** (`CallSettings`): Change model settings for this step.
|
|
195
195
|
|
|
196
|
-
**structuredOutput
|
|
196
|
+
**structuredOutput** (`StructuredOutputOptions`): Change structured output configuration for this step.
|
|
197
197
|
|
|
198
198
|
#### Processor chaining
|
|
199
199
|
|
|
@@ -232,21 +232,21 @@ processOutputStream?(args: ProcessOutputStreamArgs): Promise<ChunkType | null |
|
|
|
232
232
|
|
|
233
233
|
#### ProcessOutputStreamArgs
|
|
234
234
|
|
|
235
|
-
**part
|
|
235
|
+
**part** (`ChunkType`): The current stream chunk being processed.
|
|
236
236
|
|
|
237
|
-
**streamParts
|
|
237
|
+
**streamParts** (`ChunkType[]`): All chunks seen so far in the stream.
|
|
238
238
|
|
|
239
|
-
**state
|
|
239
|
+
**state** (`Record<string, unknown>`): Mutable state object that persists across chunks within a single stream.
|
|
240
240
|
|
|
241
|
-
**abort
|
|
241
|
+
**abort** (`(reason?: string) => never`): Function to abort the stream.
|
|
242
242
|
|
|
243
|
-
**messageList
|
|
243
|
+
**messageList** (`MessageList`): MessageList instance for accessing conversation history.
|
|
244
244
|
|
|
245
|
-
**tracingContext
|
|
245
|
+
**tracingContext** (`TracingContext`): Tracing context for observability.
|
|
246
246
|
|
|
247
|
-
**requestContext
|
|
247
|
+
**requestContext** (`RequestContext`): Request-scoped context with execution metadata.
|
|
248
248
|
|
|
249
|
-
**writer
|
|
249
|
+
**writer** (`ProcessorStreamWriter`): Stream writer for emitting custom data chunks back to the client. Call writer.custom() to emit data-\* typed chunks. Available during streaming.
|
|
250
250
|
|
|
251
251
|
#### Return value
|
|
252
252
|
|
|
@@ -265,17 +265,17 @@ processOutputResult?(args: ProcessOutputResultArgs): ProcessorMessageResult;
|
|
|
265
265
|
|
|
266
266
|
#### ProcessOutputResultArgs
|
|
267
267
|
|
|
268
|
-
**messages
|
|
268
|
+
**messages** (`MastraDBMessage[]`): The generated response messages.
|
|
269
269
|
|
|
270
|
-
**messageList
|
|
270
|
+
**messageList** (`MessageList`): MessageList instance for managing messages.
|
|
271
271
|
|
|
272
|
-
**abort
|
|
272
|
+
**abort** (`(reason?: string) => never`): Function to abort processing.
|
|
273
273
|
|
|
274
|
-
**tracingContext
|
|
274
|
+
**tracingContext** (`TracingContext`): Tracing context for observability.
|
|
275
275
|
|
|
276
|
-
**requestContext
|
|
276
|
+
**requestContext** (`RequestContext`): Request-scoped context with execution metadata.
|
|
277
277
|
|
|
278
|
-
**writer
|
|
278
|
+
**writer** (`ProcessorStreamWriter`): Stream writer for emitting custom data chunks back to the client. Call writer.custom() to emit data-\* typed chunks. Available during streaming.
|
|
279
279
|
|
|
280
280
|
***
|
|
281
281
|
|
|
@@ -289,27 +289,27 @@ processOutputStep?(args: ProcessOutputStepArgs): ProcessorMessageResult;
|
|
|
289
289
|
|
|
290
290
|
#### ProcessOutputStepArgs
|
|
291
291
|
|
|
292
|
-
**messages
|
|
292
|
+
**messages** (`MastraDBMessage[]`): All messages including the latest LLM response.
|
|
293
293
|
|
|
294
|
-
**messageList
|
|
294
|
+
**messageList** (`MessageList`): MessageList instance for managing messages.
|
|
295
295
|
|
|
296
|
-
**stepNumber
|
|
296
|
+
**stepNumber** (`number`): Current step number (0-indexed).
|
|
297
297
|
|
|
298
|
-
**finishReason
|
|
298
|
+
**finishReason** (`string`): The finish reason from the LLM (stop, tool-use, length, etc.).
|
|
299
299
|
|
|
300
|
-
**toolCalls
|
|
300
|
+
**toolCalls** (`ToolCallInfo[]`): Tool calls made in this step (if any).
|
|
301
301
|
|
|
302
|
-
**text
|
|
302
|
+
**text** (`string`): Generated text from this step.
|
|
303
303
|
|
|
304
|
-
**systemMessages
|
|
304
|
+
**systemMessages** (`CoreMessage[]`): All system messages for read/modify access.
|
|
305
305
|
|
|
306
|
-
**abort
|
|
306
|
+
**abort** (`(reason?: string, options?: { retry?: boolean; metadata?: unknown }) => never`): Function to abort processing. Pass \`retry: true\` to request the LLM retry the step.
|
|
307
307
|
|
|
308
|
-
**retryCount
|
|
308
|
+
**retryCount** (`number`): Number of times processors have triggered retry. Use this to limit retry attempts.
|
|
309
309
|
|
|
310
|
-
**tracingContext
|
|
310
|
+
**tracingContext** (`TracingContext`): Tracing context for observability.
|
|
311
311
|
|
|
312
|
-
**requestContext
|
|
312
|
+
**requestContext** (`RequestContext`): Request-scoped context with execution metadata.
|
|
313
313
|
|
|
314
314
|
#### Use cases
|
|
315
315
|
|
|
@@ -17,31 +17,29 @@ const processor = new PromptInjectionDetector({
|
|
|
17
17
|
|
|
18
18
|
## Constructor parameters
|
|
19
19
|
|
|
20
|
-
**options
|
|
20
|
+
**options** (`Options`): Configuration options for prompt injection detection
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
**options.model** (`MastraModelConfig`): Model configuration for the detection agent
|
|
23
23
|
|
|
24
|
-
**
|
|
24
|
+
**options.detectionTypes** (`string[]`): Detection types to check for. If not specified, uses default categories
|
|
25
25
|
|
|
26
|
-
**
|
|
26
|
+
**options.threshold** (`number`): Confidence threshold for flagging (0-1). Higher threshold = less sensitive to avoid false positives
|
|
27
27
|
|
|
28
|
-
**
|
|
28
|
+
**options.strategy** (`'block' | 'warn' | 'filter' | 'rewrite'`): Strategy when injection is detected: 'block' rejects with error, 'warn' logs warning but allows through, 'filter' removes flagged messages, 'rewrite' attempts to neutralize the injection
|
|
29
29
|
|
|
30
|
-
**
|
|
30
|
+
**options.instructions** (`string`): Custom detection instructions for the agent. If not provided, uses default instructions based on detection types
|
|
31
31
|
|
|
32
|
-
**
|
|
32
|
+
**options.includeScores** (`boolean`): Whether to include confidence scores in logs. Useful for tuning thresholds and debugging
|
|
33
33
|
|
|
34
|
-
**
|
|
35
|
-
|
|
36
|
-
**providerOptions?:** (`ProviderOptions`): Provider-specific options passed to the internal detection agent. Use this to control model behavior like reasoning effort for thinking models (e.g., \`{ openai: { reasoningEffort: 'low' } }\`)
|
|
34
|
+
**options.providerOptions** (`ProviderOptions`): Provider-specific options passed to the internal detection agent. Use this to control model behavior like reasoning effort for thinking models (e.g., \`{ openai: { reasoningEffort: 'low' } }\`)
|
|
37
35
|
|
|
38
36
|
## Returns
|
|
39
37
|
|
|
40
|
-
**id
|
|
38
|
+
**id** (`string`): Processor identifier set to 'prompt-injection-detector'
|
|
41
39
|
|
|
42
|
-
**name
|
|
40
|
+
**name** (`string`): Optional processor display name
|
|
43
41
|
|
|
44
|
-
**processInput
|
|
42
|
+
**processInput** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never; tracingContext?: TracingContext }) => Promise<MastraDBMessage[]>`): Processes input messages to detect prompt injection attempts before sending to LLM
|
|
45
43
|
|
|
46
44
|
## Extended usage example
|
|
47
45
|
|
|
@@ -20,37 +20,35 @@ const processor = new SemanticRecall({
|
|
|
20
20
|
|
|
21
21
|
## Constructor parameters
|
|
22
22
|
|
|
23
|
-
**options
|
|
23
|
+
**options** (`SemanticRecallOptions`): Configuration options for the semantic recall processor
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
**options.storage** (`MemoryStorage`): Storage instance for retrieving messages
|
|
26
26
|
|
|
27
|
-
**
|
|
27
|
+
**options.vector** (`MastraVector`): Vector store for semantic search
|
|
28
28
|
|
|
29
|
-
**
|
|
29
|
+
**options.embedder** (`MastraEmbeddingModel<string>`): Embedder for generating query embeddings
|
|
30
30
|
|
|
31
|
-
**
|
|
31
|
+
**options.topK** (`number`): Number of most similar messages to retrieve
|
|
32
32
|
|
|
33
|
-
**
|
|
33
|
+
**options.messageRange** (`number | { before: number; after: number }`): Number of context messages to include before/after each match. Can be a single number (same for both) or an object with separate values
|
|
34
34
|
|
|
35
|
-
**
|
|
35
|
+
**options.scope** (`'thread' | 'resource'`): Scope of semantic search. 'thread' searches within the current thread only. 'resource' searches across all threads for the resource
|
|
36
36
|
|
|
37
|
-
**
|
|
37
|
+
**options.threshold** (`number`): Minimum similarity score threshold (0-1). Messages below this threshold are filtered out
|
|
38
38
|
|
|
39
|
-
**
|
|
39
|
+
**options.indexName** (`string`): Index name for the vector store. If not provided, auto-generated based on embedder model
|
|
40
40
|
|
|
41
|
-
**
|
|
42
|
-
|
|
43
|
-
**logger?:** (`IMastraLogger`): Optional logger instance for structured logging
|
|
41
|
+
**options.logger** (`IMastraLogger`): Optional logger instance for structured logging
|
|
44
42
|
|
|
45
43
|
## Returns
|
|
46
44
|
|
|
47
|
-
**id
|
|
45
|
+
**id** (`string`): Processor identifier set to 'semantic-recall'
|
|
48
46
|
|
|
49
|
-
**name
|
|
47
|
+
**name** (`string`): Processor display name set to 'SemanticRecall'
|
|
50
48
|
|
|
51
|
-
**processInput
|
|
49
|
+
**processInput** (`(args: { messages: MastraDBMessage[]; messageList: MessageList; abort: (reason?: string) => never; tracingContext?: TracingContext; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Performs semantic search on historical messages and adds relevant context to the message list
|
|
52
50
|
|
|
53
|
-
**processOutputResult
|
|
51
|
+
**processOutputResult** (`(args: { messages: MastraDBMessage[]; messageList?: MessageList; abort: (reason?: string) => never; tracingContext?: TracingContext; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Creates embeddings for new messages to enable future semantic search
|
|
54
52
|
|
|
55
53
|
## Extended usage example
|
|
56
54
|
|
|
@@ -17,33 +17,31 @@ const processor = new SystemPromptScrubber({
|
|
|
17
17
|
|
|
18
18
|
## Constructor parameters
|
|
19
19
|
|
|
20
|
-
**options
|
|
20
|
+
**options** (`Options`): Configuration options for system prompt detection and handling
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
**options.model** (`MastraModelConfig`): Model configuration for the detection agent
|
|
23
23
|
|
|
24
|
-
**
|
|
24
|
+
**options.strategy** (`'block' | 'warn' | 'filter' | 'redact'`): Strategy when system prompts are detected: 'block' rejects with error, 'warn' logs warning but allows through, 'filter' removes flagged messages, 'redact' replaces with redacted versions
|
|
25
25
|
|
|
26
|
-
**
|
|
26
|
+
**options.customPatterns** (`string[]`): Custom patterns to detect system prompts (regex strings)
|
|
27
27
|
|
|
28
|
-
**
|
|
28
|
+
**options.includeDetections** (`boolean`): Whether to include detection details in warnings. Useful for debugging and monitoring
|
|
29
29
|
|
|
30
|
-
**
|
|
30
|
+
**options.instructions** (`string`): Custom instructions for the detection agent. If not provided, uses default instructions
|
|
31
31
|
|
|
32
|
-
**
|
|
32
|
+
**options.redactionMethod** (`'mask' | 'placeholder' | 'remove'`): Redaction method for system prompts: 'mask' replaces with asterisks, 'placeholder' replaces with placeholder text, 'remove' removes entirely
|
|
33
33
|
|
|
34
|
-
**
|
|
35
|
-
|
|
36
|
-
**placeholderText?:** (`string`): Custom placeholder text for redaction when redactionMethod is 'placeholder'
|
|
34
|
+
**options.placeholderText** (`string`): Custom placeholder text for redaction when redactionMethod is 'placeholder'
|
|
37
35
|
|
|
38
36
|
## Returns
|
|
39
37
|
|
|
40
|
-
**id
|
|
38
|
+
**id** (`string`): Processor identifier set to 'system-prompt-scrubber'
|
|
41
39
|
|
|
42
|
-
**name
|
|
40
|
+
**name** (`string`): Optional processor display name
|
|
43
41
|
|
|
44
|
-
**processOutputStream
|
|
42
|
+
**processOutputStream** (`(args: { part: ChunkType; streamParts: ChunkType[]; state: Record<string, any>; abort: (reason?: string) => never; tracingContext?: TracingContext }) => Promise<ChunkType | null>`): Processes streaming output parts to detect and handle system prompts during streaming
|
|
45
43
|
|
|
46
|
-
**processOutputResult
|
|
44
|
+
**processOutputResult** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never }) => Promise<MastraDBMessage[]>`): Processes final output results to detect and handle system prompts in non-streaming scenarios
|
|
47
45
|
|
|
48
46
|
## Extended usage example
|
|
49
47
|
|
|
@@ -19,31 +19,29 @@ const processor = new TokenLimiterProcessor({
|
|
|
19
19
|
|
|
20
20
|
## Constructor parameters
|
|
21
21
|
|
|
22
|
-
**options
|
|
22
|
+
**options** (`number | Options`): Either a simple number for token limit, or configuration options object
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
**options.limit** (`number`): Maximum number of tokens to allow in the response
|
|
25
25
|
|
|
26
|
-
**
|
|
26
|
+
**options.encoding** (`TiktokenBPE`): Optional encoding to use. Defaults to o200k\_base which is used by gpt-5.1
|
|
27
27
|
|
|
28
|
-
**
|
|
28
|
+
**options.strategy** (`'truncate' | 'abort'`): Strategy when token limit is reached: 'truncate' stops emitting chunks, 'abort' calls abort() to stop the stream
|
|
29
29
|
|
|
30
|
-
**
|
|
31
|
-
|
|
32
|
-
**countMode?:** (`'cumulative' | 'part'`): Whether to count tokens from the beginning of the stream or just the current part: 'cumulative' counts all tokens from start, 'part' only counts tokens in current part
|
|
30
|
+
**options.countMode** (`'cumulative' | 'part'`): Whether to count tokens from the beginning of the stream or just the current part: 'cumulative' counts all tokens from start, 'part' only counts tokens in current part
|
|
33
31
|
|
|
34
32
|
## Returns
|
|
35
33
|
|
|
36
|
-
**id
|
|
34
|
+
**id** (`string`): Processor identifier set to 'token-limiter'
|
|
37
35
|
|
|
38
|
-
**name
|
|
36
|
+
**name** (`string`): Optional processor display name
|
|
39
37
|
|
|
40
|
-
**processInput
|
|
38
|
+
**processInput** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never }) => Promise<MastraDBMessage[]>`): Filters input messages to fit within token limit, prioritizing recent messages while preserving system messages
|
|
41
39
|
|
|
42
|
-
**processOutputStream
|
|
40
|
+
**processOutputStream** (`(args: { part: ChunkType; streamParts: ChunkType[]; state: Record<string, any>; abort: (reason?: string) => never }) => Promise<ChunkType | null>`): Processes streaming output parts to limit token count during streaming
|
|
43
41
|
|
|
44
|
-
**processOutputResult
|
|
42
|
+
**processOutputResult** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never }) => Promise<MastraDBMessage[]>`): Processes final output results to limit token count in non-streaming scenarios
|
|
45
43
|
|
|
46
|
-
**getMaxTokens
|
|
44
|
+
**getMaxTokens** (`() => number`): Get the maximum token limit
|
|
47
45
|
|
|
48
46
|
## Error behavior
|
|
49
47
|
|
|
@@ -18,19 +18,17 @@ const filterSpecific = new ToolCallFilter({
|
|
|
18
18
|
|
|
19
19
|
## Constructor parameters
|
|
20
20
|
|
|
21
|
-
**options
|
|
21
|
+
**options** (`Options`): Configuration options for the tool call filter
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
**exclude?:** (`string[]`): List of specific tool names to exclude. If not provided or undefined, all tool calls are excluded
|
|
23
|
+
**options.exclude** (`string[]`): List of specific tool names to exclude. If not provided or undefined, all tool calls are excluded
|
|
26
24
|
|
|
27
25
|
## Returns
|
|
28
26
|
|
|
29
|
-
**id
|
|
27
|
+
**id** (`string`): Processor identifier set to 'tool-call-filter'
|
|
30
28
|
|
|
31
|
-
**name
|
|
29
|
+
**name** (`string`): Processor display name set to 'ToolCallFilter'
|
|
32
30
|
|
|
33
|
-
**processInput
|
|
31
|
+
**processInput** (`(args: { messages: MastraDBMessage[]; messageList: MessageList; abort: (reason?: string) => never; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Processes input messages to filter out tool calls and their results based on configuration
|
|
34
32
|
|
|
35
33
|
## Extended usage example
|
|
36
34
|
|
|
@@ -23,27 +23,25 @@ const toolSearch = new ToolSearchProcessor({
|
|
|
23
23
|
|
|
24
24
|
## Constructor parameters
|
|
25
25
|
|
|
26
|
-
**options
|
|
26
|
+
**options** (`ToolSearchProcessorOptions`): Configuration options for the tool search processor
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
**options.tools** (`Record<string, Tool>`): All tools that can be searched and loaded dynamically. These tools are not immediately available to the agent — they must be discovered via search and loaded on demand.
|
|
29
29
|
|
|
30
|
-
**
|
|
30
|
+
**options.search** (`{ topK?: number; minScore?: number }`): Configuration for the search behavior.
|
|
31
31
|
|
|
32
|
-
**search
|
|
32
|
+
**options.search.topK** (`number`): Maximum number of tools to return in search results.
|
|
33
33
|
|
|
34
|
-
**search.
|
|
34
|
+
**options.search.minScore** (`number`): Minimum relevance score (0-1) for including a tool in search results.
|
|
35
35
|
|
|
36
|
-
**
|
|
37
|
-
|
|
38
|
-
**ttl?:** (`number`): Time-to-live for thread state in milliseconds. After this duration of inactivity, thread state will be cleaned up. Set to 0 to disable cleanup.
|
|
36
|
+
**options.ttl** (`number`): Time-to-live for thread state in milliseconds. After this duration of inactivity, thread state will be cleaned up. Set to 0 to disable cleanup.
|
|
39
37
|
|
|
40
38
|
## Returns
|
|
41
39
|
|
|
42
|
-
**id
|
|
40
|
+
**id** (`string`): Processor identifier set to 'tool-search'
|
|
43
41
|
|
|
44
|
-
**name
|
|
42
|
+
**name** (`string`): Processor display name set to 'Tool Search Processor'
|
|
45
43
|
|
|
46
|
-
**processInputStep
|
|
44
|
+
**processInputStep** (`(args: ProcessInputStepArgs) => Promise<ProcessInputStepResult>`): Processes each step to inject search/load meta-tools and any previously loaded tools into the agent's tool set.
|
|
47
45
|
|
|
48
46
|
## Extended usage example
|
|
49
47
|
|
|
@@ -15,25 +15,23 @@ const processor = new UnicodeNormalizer({
|
|
|
15
15
|
|
|
16
16
|
## Constructor parameters
|
|
17
17
|
|
|
18
|
-
**options
|
|
18
|
+
**options** (`Options`): Configuration options for Unicode text normalization
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
**options.stripControlChars** (`boolean`): Whether to strip control characters. When enabled, removes control characters except , ,
|
|
21
21
|
|
|
22
|
-
**
|
|
22
|
+
**options.preserveEmojis** (`boolean`): Whether to preserve emojis. When disabled, emojis may be removed if they contain control characters
|
|
23
23
|
|
|
24
|
-
**
|
|
24
|
+
**options.collapseWhitespace** (`boolean`): Whether to collapse consecutive whitespace. When enabled, multiple spaces/tabs/newlines are collapsed to single instances
|
|
25
25
|
|
|
26
|
-
**
|
|
27
|
-
|
|
28
|
-
**trim?:** (`boolean`): Whether to trim leading and trailing whitespace
|
|
26
|
+
**options.trim** (`boolean`): Whether to trim leading and trailing whitespace
|
|
29
27
|
|
|
30
28
|
## Returns
|
|
31
29
|
|
|
32
|
-
**id
|
|
30
|
+
**id** (`string`): Processor identifier set to 'unicode-normalizer'
|
|
33
31
|
|
|
34
|
-
**name
|
|
32
|
+
**name** (`string`): Optional processor display name
|
|
35
33
|
|
|
36
|
-
**processInput
|
|
34
|
+
**processInput** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never }) => MastraDBMessage[]`): Processes input messages to normalize Unicode text
|
|
37
35
|
|
|
38
36
|
## Extended usage example
|
|
39
37
|
|