@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
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkRQ56ZSIR_cjs = require('./chunk-RQ56ZSIR.cjs');
|
|
4
4
|
var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
5
|
+
var chunkMEMYFFOL_cjs = require('./chunk-MEMYFFOL.cjs');
|
|
6
|
+
var chunk7AHCLTZZ_cjs = require('./chunk-7AHCLTZZ.cjs');
|
|
7
|
+
var chunkYZMSJKAK_cjs = require('./chunk-YZMSJKAK.cjs');
|
|
8
8
|
var chunkZIEQA3YP_cjs = require('./chunk-ZIEQA3YP.cjs');
|
|
9
9
|
var chunkPM3UIIBK_cjs = require('./chunk-PM3UIIBK.cjs');
|
|
10
10
|
var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var chunkPP4G2TZZ_cjs = require('./chunk-PP4G2TZZ.cjs');
|
|
12
|
+
var chunkOOTLMVNN_cjs = require('./chunk-OOTLMVNN.cjs');
|
|
13
13
|
var chunk6BJ7XHRH_cjs = require('./chunk-6BJ7XHRH.cjs');
|
|
14
14
|
var chunkOQDRPRKM_cjs = require('./chunk-OQDRPRKM.cjs');
|
|
15
|
-
var
|
|
15
|
+
var chunkGCRPNAAR_cjs = require('./chunk-GCRPNAAR.cjs');
|
|
16
16
|
var chunk4UOWNFAL_cjs = require('./chunk-4UOWNFAL.cjs');
|
|
17
|
-
var chunkKJBMTK5B_cjs = require('./chunk-KJBMTK5B.cjs');
|
|
18
|
-
var chunkD6HO5QAM_cjs = require('./chunk-D6HO5QAM.cjs');
|
|
19
|
-
var chunkVDKWYUGC_cjs = require('./chunk-VDKWYUGC.cjs');
|
|
20
17
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
18
|
+
var chunkKJBMTK5B_cjs = require('./chunk-KJBMTK5B.cjs');
|
|
19
|
+
var chunkM26GEN4C_cjs = require('./chunk-M26GEN4C.cjs');
|
|
20
|
+
var chunk5WBEMKE2_cjs = require('./chunk-5WBEMKE2.cjs');
|
|
21
21
|
var chunk4WQYXT2I_cjs = require('./chunk-4WQYXT2I.cjs');
|
|
22
22
|
var chunkRO47SMI7_cjs = require('./chunk-RO47SMI7.cjs');
|
|
23
23
|
var chunk7XAECHYL_cjs = require('./chunk-7XAECHYL.cjs');
|
|
@@ -1306,7 +1306,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1306
1306
|
writer
|
|
1307
1307
|
});
|
|
1308
1308
|
const mutations = messageList.stopRecording();
|
|
1309
|
-
if (result instanceof
|
|
1309
|
+
if (result instanceof chunkYZMSJKAK_cjs.MessageList) {
|
|
1310
1310
|
if (result !== messageList) {
|
|
1311
1311
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1312
1312
|
category: "USER",
|
|
@@ -1570,7 +1570,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1570
1570
|
retryCount
|
|
1571
1571
|
});
|
|
1572
1572
|
let mutations;
|
|
1573
|
-
if (result instanceof
|
|
1573
|
+
if (result instanceof chunkYZMSJKAK_cjs.MessageList) {
|
|
1574
1574
|
if (result !== messageList) {
|
|
1575
1575
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1576
1576
|
category: "USER",
|
|
@@ -1899,7 +1899,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1899
1899
|
writer
|
|
1900
1900
|
});
|
|
1901
1901
|
const mutations = messageList.stopRecording();
|
|
1902
|
-
if (result instanceof
|
|
1902
|
+
if (result instanceof chunkYZMSJKAK_cjs.MessageList) {
|
|
1903
1903
|
if (result !== messageList) {
|
|
1904
1904
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1905
1905
|
category: "USER",
|
|
@@ -1969,7 +1969,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1969
1969
|
processor,
|
|
1970
1970
|
stepNumber
|
|
1971
1971
|
}) {
|
|
1972
|
-
if (result instanceof
|
|
1972
|
+
if (result instanceof chunkYZMSJKAK_cjs.MessageList) {
|
|
1973
1973
|
if (result !== messageList) {
|
|
1974
1974
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1975
1975
|
category: "USER",
|
|
@@ -2004,7 +2004,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
2004
2004
|
}
|
|
2005
2005
|
const { model: _model, ...rest } = result;
|
|
2006
2006
|
if (result.model) {
|
|
2007
|
-
const resolvedModel = await
|
|
2007
|
+
const resolvedModel = await chunkPP4G2TZZ_cjs.resolveModelConfig(result.model);
|
|
2008
2008
|
const isSupported = isSupportedLanguageModel(resolvedModel);
|
|
2009
2009
|
if (!isSupported) {
|
|
2010
2010
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -3144,7 +3144,7 @@ var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
3144
3144
|
);
|
|
3145
3145
|
const responseMessages = self.messageList.get.response.aiV4.core();
|
|
3146
3146
|
const lastResponseMessage = responseMessages[responseMessages.length - 1];
|
|
3147
|
-
const outputText = lastResponseMessage ?
|
|
3147
|
+
const outputText = lastResponseMessage ? chunkYZMSJKAK_cjs.coreContentToString(lastResponseMessage.content) : "";
|
|
3148
3148
|
if (lastStep && outputText && outputText !== originalText) {
|
|
3149
3149
|
lastStep.text = outputText;
|
|
3150
3150
|
}
|
|
@@ -4479,7 +4479,7 @@ function convertMastraChunkToAISDKv5({
|
|
|
4479
4479
|
if (mode === "generate") {
|
|
4480
4480
|
return {
|
|
4481
4481
|
type: "file",
|
|
4482
|
-
file: new
|
|
4482
|
+
file: new chunkYZMSJKAK_cjs.DefaultGeneratedFile({
|
|
4483
4483
|
data: chunk.payload.data,
|
|
4484
4484
|
mediaType: chunk.payload.mimeType
|
|
4485
4485
|
})
|
|
@@ -4487,7 +4487,7 @@ function convertMastraChunkToAISDKv5({
|
|
|
4487
4487
|
}
|
|
4488
4488
|
return {
|
|
4489
4489
|
type: "file",
|
|
4490
|
-
file: new
|
|
4490
|
+
file: new chunkYZMSJKAK_cjs.DefaultGeneratedFileWithType({
|
|
4491
4491
|
data: chunk.payload.data,
|
|
4492
4492
|
mediaType: chunk.payload.mimeType
|
|
4493
4493
|
})
|
|
@@ -5073,7 +5073,7 @@ async function validateStepInput({
|
|
|
5073
5073
|
}) {
|
|
5074
5074
|
let inputData = prevOutput;
|
|
5075
5075
|
let validationError;
|
|
5076
|
-
if (validateInputs &&
|
|
5076
|
+
if (validateInputs && chunkGCRPNAAR_cjs.isZodType(step.inputSchema)) {
|
|
5077
5077
|
const inputSchema = step.inputSchema;
|
|
5078
5078
|
const validatedInput = await inputSchema.safeParseAsync(prevOutput);
|
|
5079
5079
|
if (!validatedInput.success) {
|
|
@@ -5102,7 +5102,7 @@ async function validateStepResumeData({ resumeData, step }) {
|
|
|
5102
5102
|
}
|
|
5103
5103
|
let validationError;
|
|
5104
5104
|
const resumeSchema = step.resumeSchema;
|
|
5105
|
-
if (resumeSchema &&
|
|
5105
|
+
if (resumeSchema && chunkGCRPNAAR_cjs.isZodType(resumeSchema)) {
|
|
5106
5106
|
const validatedResumeData = await resumeSchema.safeParseAsync(resumeData);
|
|
5107
5107
|
if (!validatedResumeData.success) {
|
|
5108
5108
|
const errors = getZodErrors(validatedResumeData.error);
|
|
@@ -5133,7 +5133,7 @@ async function validateStepSuspendData({
|
|
|
5133
5133
|
}
|
|
5134
5134
|
let validationError;
|
|
5135
5135
|
const suspendSchema = step.suspendSchema;
|
|
5136
|
-
if (suspendSchema && validateInputs &&
|
|
5136
|
+
if (suspendSchema && validateInputs && chunkGCRPNAAR_cjs.isZodType(suspendSchema)) {
|
|
5137
5137
|
const validatedSuspendData = await suspendSchema.safeParseAsync(suspendData);
|
|
5138
5138
|
if (!validatedSuspendData.success) {
|
|
5139
5139
|
const errors = getZodErrors(validatedSuspendData.error);
|
|
@@ -5164,7 +5164,7 @@ async function validateStepStateData({
|
|
|
5164
5164
|
}
|
|
5165
5165
|
let validationError;
|
|
5166
5166
|
const stateSchema = step.stateSchema;
|
|
5167
|
-
if (stateSchema && validateInputs &&
|
|
5167
|
+
if (stateSchema && validateInputs && chunkGCRPNAAR_cjs.isZodType(stateSchema)) {
|
|
5168
5168
|
const validatedStateData = await stateSchema.safeParseAsync(stateData);
|
|
5169
5169
|
if (!validatedStateData.success) {
|
|
5170
5170
|
const errors = getZodErrors(validatedStateData.error);
|
|
@@ -5183,7 +5183,7 @@ async function validateStepRequestContext({
|
|
|
5183
5183
|
}) {
|
|
5184
5184
|
let validationError;
|
|
5185
5185
|
const requestContextSchema = step.requestContextSchema;
|
|
5186
|
-
if (requestContextSchema && validateInputs &&
|
|
5186
|
+
if (requestContextSchema && validateInputs && chunkGCRPNAAR_cjs.isZodType(requestContextSchema)) {
|
|
5187
5187
|
const contextValues = requestContext?.all ?? {};
|
|
5188
5188
|
const validatedRequestContext = await requestContextSchema.safeParseAsync(contextValues);
|
|
5189
5189
|
if (!validatedRequestContext.success) {
|
|
@@ -5319,7 +5319,7 @@ var createTimeTravelExecutionParams = (params) => {
|
|
|
5319
5319
|
result = void 0;
|
|
5320
5320
|
}
|
|
5321
5321
|
if (result) {
|
|
5322
|
-
const formattedResult =
|
|
5322
|
+
const formattedResult = chunkGCRPNAAR_cjs.removeUndefinedValues(result);
|
|
5323
5323
|
stepResults[stepId] = formattedResult;
|
|
5324
5324
|
}
|
|
5325
5325
|
});
|
|
@@ -5877,7 +5877,7 @@ async function executeLoop(engine, params) {
|
|
|
5877
5877
|
options: {
|
|
5878
5878
|
type: "workflow_conditional_eval" /* WORKFLOW_CONDITIONAL_EVAL */,
|
|
5879
5879
|
name: `condition: '${entry.loopType}'`,
|
|
5880
|
-
input:
|
|
5880
|
+
input: chunkGCRPNAAR_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
|
|
5881
5881
|
attributes: {
|
|
5882
5882
|
conditionIndex: iteration
|
|
5883
5883
|
},
|
|
@@ -6279,7 +6279,7 @@ async function persistStepUpdate(engine, params) {
|
|
|
6279
6279
|
if (!shouldPersistSnapshot) {
|
|
6280
6280
|
return;
|
|
6281
6281
|
}
|
|
6282
|
-
const ctx = requestContext instanceof
|
|
6282
|
+
const ctx = requestContext instanceof chunk5WBEMKE2_cjs.RequestContext ? requestContext : new chunk5WBEMKE2_cjs.RequestContext(requestContext);
|
|
6283
6283
|
const requestContextObj = ctx.toJSON();
|
|
6284
6284
|
const workflowsStore = await engine.mastra?.getStorage()?.getStore("workflows");
|
|
6285
6285
|
await workflowsStore?.persistWorkflowSnapshot({
|
|
@@ -8122,10 +8122,10 @@ function isAgent(input) {
|
|
|
8122
8122
|
return input instanceof Agent;
|
|
8123
8123
|
}
|
|
8124
8124
|
function isToolStep(input) {
|
|
8125
|
-
return input instanceof
|
|
8125
|
+
return input instanceof chunkM26GEN4C_cjs.Tool;
|
|
8126
8126
|
}
|
|
8127
8127
|
function isStepParams(input) {
|
|
8128
|
-
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof
|
|
8128
|
+
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof chunkM26GEN4C_cjs.Tool);
|
|
8129
8129
|
}
|
|
8130
8130
|
function createStep(params, agentOrToolOptions) {
|
|
8131
8131
|
if (isAgent(params)) {
|
|
@@ -8466,7 +8466,7 @@ function createStepFromProcessor(processor) {
|
|
|
8466
8466
|
phase,
|
|
8467
8467
|
// Auto-create MessageList from messages if not provided
|
|
8468
8468
|
// This enables running processor workflows from the UI where messageList can't be serialized
|
|
8469
|
-
messageList: messageList ?? (Array.isArray(messages) ? new
|
|
8469
|
+
messageList: messageList ?? (Array.isArray(messages) ? new chunkYZMSJKAK_cjs.MessageList().add(messages, "input").addSystem(systemMessages ?? []) : void 0),
|
|
8470
8470
|
stepNumber,
|
|
8471
8471
|
systemMessages,
|
|
8472
8472
|
streamParts,
|
|
@@ -8520,7 +8520,7 @@ function createStepFromProcessor(processor) {
|
|
|
8520
8520
|
messageList: checkedMessageList,
|
|
8521
8521
|
systemMessages: systemMessages ?? []
|
|
8522
8522
|
});
|
|
8523
|
-
if (result instanceof
|
|
8523
|
+
if (result instanceof chunkYZMSJKAK_cjs.MessageList) {
|
|
8524
8524
|
if (result !== checkedMessageList) {
|
|
8525
8525
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
8526
8526
|
category: "USER" /* USER */,
|
|
@@ -8686,7 +8686,7 @@ function createStepFromProcessor(processor) {
|
|
|
8686
8686
|
messages,
|
|
8687
8687
|
messageList: passThrough.messageList
|
|
8688
8688
|
});
|
|
8689
|
-
if (result instanceof
|
|
8689
|
+
if (result instanceof chunkYZMSJKAK_cjs.MessageList) {
|
|
8690
8690
|
if (result !== passThrough.messageList) {
|
|
8691
8691
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
8692
8692
|
category: "USER" /* USER */,
|
|
@@ -8753,7 +8753,7 @@ function createStepFromProcessor(processor) {
|
|
|
8753
8753
|
systemMessages: systemMessages ?? [],
|
|
8754
8754
|
steps: steps ?? []
|
|
8755
8755
|
});
|
|
8756
|
-
if (result instanceof
|
|
8756
|
+
if (result instanceof chunkYZMSJKAK_cjs.MessageList) {
|
|
8757
8757
|
if (result !== checkedMessageList) {
|
|
8758
8758
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
8759
8759
|
category: "USER" /* USER */,
|
|
@@ -8821,7 +8821,7 @@ function cloneStep(step, opts) {
|
|
|
8821
8821
|
};
|
|
8822
8822
|
}
|
|
8823
8823
|
function isProcessor(obj) {
|
|
8824
|
-
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof
|
|
8824
|
+
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof chunkM26GEN4C_cjs.Tool) && (typeof obj.processInput === "function" || typeof obj.processInputStep === "function" || typeof obj.processOutputStream === "function" || typeof obj.processOutputResult === "function" || typeof obj.processOutputStep === "function");
|
|
8825
8825
|
}
|
|
8826
8826
|
function createWorkflow(params) {
|
|
8827
8827
|
return new Workflow(params);
|
|
@@ -9328,7 +9328,7 @@ var Workflow = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
9328
9328
|
return run;
|
|
9329
9329
|
}
|
|
9330
9330
|
async listScorers({
|
|
9331
|
-
requestContext = new
|
|
9331
|
+
requestContext = new chunk5WBEMKE2_cjs.RequestContext()
|
|
9332
9332
|
} = {}) {
|
|
9333
9333
|
const steps = this.steps;
|
|
9334
9334
|
if (!steps || Object.keys(steps).length === 0) {
|
|
@@ -9809,7 +9809,7 @@ var Run = class {
|
|
|
9809
9809
|
}
|
|
9810
9810
|
async _validateInput(inputData) {
|
|
9811
9811
|
let inputDataToUse = inputData;
|
|
9812
|
-
if (this.validateInputs && this.inputSchema &&
|
|
9812
|
+
if (this.validateInputs && this.inputSchema && chunkGCRPNAAR_cjs.isZodType(this.inputSchema)) {
|
|
9813
9813
|
const validatedInputData = await this.inputSchema.safeParseAsync(inputData);
|
|
9814
9814
|
if (!validatedInputData.success) {
|
|
9815
9815
|
const errors = getZodErrors(validatedInputData.error);
|
|
@@ -9823,7 +9823,7 @@ var Run = class {
|
|
|
9823
9823
|
let initialStateToUse = initialState;
|
|
9824
9824
|
if (this.validateInputs) {
|
|
9825
9825
|
let stateSchema = this.stateSchema;
|
|
9826
|
-
if (stateSchema &&
|
|
9826
|
+
if (stateSchema && chunkGCRPNAAR_cjs.isZodType(stateSchema)) {
|
|
9827
9827
|
const validatedInitialState = await stateSchema.safeParseAsync(initialState);
|
|
9828
9828
|
if (!validatedInitialState.success) {
|
|
9829
9829
|
const errors = getZodErrors(validatedInitialState.error);
|
|
@@ -9837,7 +9837,7 @@ var Run = class {
|
|
|
9837
9837
|
return initialStateToUse;
|
|
9838
9838
|
}
|
|
9839
9839
|
async _validateRequestContext(requestContext) {
|
|
9840
|
-
if (this.validateInputs && this.requestContextSchema &&
|
|
9840
|
+
if (this.validateInputs && this.requestContextSchema && chunkGCRPNAAR_cjs.isZodType(this.requestContextSchema)) {
|
|
9841
9841
|
const contextValues = requestContext?.all ?? {};
|
|
9842
9842
|
const validatedRequestContext = await this.requestContextSchema.safeParseAsync(contextValues);
|
|
9843
9843
|
if (!validatedRequestContext.success) {
|
|
@@ -9851,7 +9851,7 @@ var Run = class {
|
|
|
9851
9851
|
}
|
|
9852
9852
|
async _validateResumeData(resumeData, suspendedStep) {
|
|
9853
9853
|
let resumeDataToUse = resumeData;
|
|
9854
|
-
if (suspendedStep && suspendedStep.resumeSchema && this.validateInputs &&
|
|
9854
|
+
if (suspendedStep && suspendedStep.resumeSchema && this.validateInputs && chunkGCRPNAAR_cjs.isZodType(suspendedStep.resumeSchema)) {
|
|
9855
9855
|
const resumeSchema = suspendedStep.resumeSchema;
|
|
9856
9856
|
const validatedResumeData = await resumeSchema.safeParseAsync(resumeData);
|
|
9857
9857
|
if (!validatedResumeData.success) {
|
|
@@ -9864,7 +9864,7 @@ var Run = class {
|
|
|
9864
9864
|
}
|
|
9865
9865
|
async _validateTimetravelInputData(inputData, step) {
|
|
9866
9866
|
let inputDataToUse = inputData;
|
|
9867
|
-
if (step && step.inputSchema && this.validateInputs &&
|
|
9867
|
+
if (step && step.inputSchema && this.validateInputs && chunkGCRPNAAR_cjs.isZodType(step.inputSchema)) {
|
|
9868
9868
|
const inputSchema = step.inputSchema;
|
|
9869
9869
|
const validatedInputData = await inputSchema.safeParseAsync(inputData);
|
|
9870
9870
|
if (!validatedInputData.success) {
|
|
@@ -9919,7 +9919,7 @@ var Run = class {
|
|
|
9919
9919
|
initialState: initialStateToUse,
|
|
9920
9920
|
pubsub: this.pubsub,
|
|
9921
9921
|
retryConfig: this.retryConfig,
|
|
9922
|
-
requestContext: requestContext ?? new
|
|
9922
|
+
requestContext: requestContext ?? new chunk5WBEMKE2_cjs.RequestContext(),
|
|
9923
9923
|
abortController: this.abortController,
|
|
9924
9924
|
outputWriter,
|
|
9925
9925
|
workflowSpan,
|
|
@@ -10389,7 +10389,7 @@ var Run = class {
|
|
|
10389
10389
|
params.requestContext.delete("__mastraWorflowInputData");
|
|
10390
10390
|
}
|
|
10391
10391
|
const stepResults = { ...snapshot?.context ?? {}, input: requestContextInput ?? snapshot?.context?.input };
|
|
10392
|
-
const requestContextToUse = params.requestContext ?? new
|
|
10392
|
+
const requestContextToUse = params.requestContext ?? new chunk5WBEMKE2_cjs.RequestContext();
|
|
10393
10393
|
Object.entries(snapshot?.requestContext ?? {}).forEach(([key, value]) => {
|
|
10394
10394
|
if (!requestContextToUse.has(key)) {
|
|
10395
10395
|
requestContextToUse.set(key, value);
|
|
@@ -10504,7 +10504,7 @@ var Run = class {
|
|
|
10504
10504
|
state: snapshot.value,
|
|
10505
10505
|
stepExecutionPath: snapshot?.stepExecutionPath
|
|
10506
10506
|
};
|
|
10507
|
-
const requestContextToUse = requestContext ?? new
|
|
10507
|
+
const requestContextToUse = requestContext ?? new chunk5WBEMKE2_cjs.RequestContext();
|
|
10508
10508
|
for (const [key, value] of Object.entries(snapshot.requestContext ?? {})) {
|
|
10509
10509
|
if (!requestContextToUse.has(key)) {
|
|
10510
10510
|
requestContextToUse.set(key, value);
|
|
@@ -10599,7 +10599,7 @@ var Run = class {
|
|
|
10599
10599
|
graph: this.executionGraph,
|
|
10600
10600
|
perStep
|
|
10601
10601
|
});
|
|
10602
|
-
const requestContextToUse = requestContext ?? new
|
|
10602
|
+
const requestContextToUse = requestContext ?? new chunk5WBEMKE2_cjs.RequestContext();
|
|
10603
10603
|
for (const [key, value] of Object.entries(snapshot.requestContext ?? {})) {
|
|
10604
10604
|
if (!requestContextToUse.has(key)) {
|
|
10605
10605
|
requestContextToUse.set(key, value);
|
|
@@ -11111,7 +11111,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
11111
11111
|
}
|
|
11112
11112
|
});
|
|
11113
11113
|
}
|
|
11114
|
-
const resolvedModel = await
|
|
11114
|
+
const resolvedModel = await chunkPP4G2TZZ_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
|
|
11115
11115
|
const judge = new Agent({
|
|
11116
11116
|
id: "judge",
|
|
11117
11117
|
name: "judge",
|
|
@@ -12634,7 +12634,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
12634
12634
|
}
|
|
12635
12635
|
});
|
|
12636
12636
|
let transportResolver;
|
|
12637
|
-
if (currentStep.model instanceof
|
|
12637
|
+
if (currentStep.model instanceof chunkPP4G2TZZ_cjs.ModelRouterLanguageModel) {
|
|
12638
12638
|
const routerModel = currentStep.model;
|
|
12639
12639
|
transportResolver = () => routerModel._getStreamTransport();
|
|
12640
12640
|
}
|
|
@@ -13023,7 +13023,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
13023
13023
|
toolInvocation: {
|
|
13024
13024
|
state: "result",
|
|
13025
13025
|
toolCallId: toolCallErrorResult.toolCallId,
|
|
13026
|
-
toolName:
|
|
13026
|
+
toolName: chunkYZMSJKAK_cjs.sanitizeToolName(toolCallErrorResult.toolName),
|
|
13027
13027
|
args: toolCallErrorResult.args,
|
|
13028
13028
|
result: toolCallErrorResult.error?.message ?? toolCallErrorResult.error
|
|
13029
13029
|
},
|
|
@@ -13072,7 +13072,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
13072
13072
|
toolInvocation: {
|
|
13073
13073
|
state: "result",
|
|
13074
13074
|
toolCallId: toolCall.toolCallId,
|
|
13075
|
-
toolName:
|
|
13075
|
+
toolName: chunkYZMSJKAK_cjs.sanitizeToolName(toolCall.toolName),
|
|
13076
13076
|
args: toolCall.args,
|
|
13077
13077
|
result: toolCall.result
|
|
13078
13078
|
},
|
|
@@ -13098,7 +13098,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
13098
13098
|
toolInvocation: {
|
|
13099
13099
|
state: "result",
|
|
13100
13100
|
toolCallId: toolCall.toolCallId,
|
|
13101
|
-
toolName:
|
|
13101
|
+
toolName: chunkYZMSJKAK_cjs.sanitizeToolName(toolCall.toolName),
|
|
13102
13102
|
args: toolCall.args,
|
|
13103
13103
|
result: toolCall.result
|
|
13104
13104
|
},
|
|
@@ -13168,7 +13168,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
13168
13168
|
toolInvocation: {
|
|
13169
13169
|
state: "result",
|
|
13170
13170
|
toolCallId: toolCall.toolCallId,
|
|
13171
|
-
toolName:
|
|
13171
|
+
toolName: chunkYZMSJKAK_cjs.sanitizeToolName(toolCall.toolName),
|
|
13172
13172
|
args: toolCall.args,
|
|
13173
13173
|
result: toolCall.result
|
|
13174
13174
|
},
|
|
@@ -13194,7 +13194,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
13194
13194
|
toolInvocation: {
|
|
13195
13195
|
state: "result",
|
|
13196
13196
|
toolCallId: toolCall.toolCallId,
|
|
13197
|
-
toolName:
|
|
13197
|
+
toolName: chunkYZMSJKAK_cjs.sanitizeToolName(toolCall.toolName),
|
|
13198
13198
|
args: toolCall.args,
|
|
13199
13199
|
result: toolCall.result
|
|
13200
13200
|
},
|
|
@@ -13764,6 +13764,7 @@ function createAgenticLoopWorkflow(params) {
|
|
|
13764
13764
|
} = params;
|
|
13765
13765
|
const accumulatedSteps = [];
|
|
13766
13766
|
let previousContentLength = 0;
|
|
13767
|
+
let pendingFeedbackStop = false;
|
|
13767
13768
|
const agenticExecutionWorkflow = createAgenticExecutionWorkflow({
|
|
13768
13769
|
messageId,
|
|
13769
13770
|
models,
|
|
@@ -13794,6 +13795,10 @@ function createAgenticLoopWorkflow(params) {
|
|
|
13794
13795
|
}).dowhile(agenticExecutionWorkflow, async ({ inputData }) => {
|
|
13795
13796
|
const typedInputData = inputData;
|
|
13796
13797
|
let hasFinishedSteps = false;
|
|
13798
|
+
if (pendingFeedbackStop) {
|
|
13799
|
+
hasFinishedSteps = true;
|
|
13800
|
+
pendingFeedbackStop = false;
|
|
13801
|
+
}
|
|
13797
13802
|
const allContent = typedInputData.messages.nonUser.flatMap(
|
|
13798
13803
|
(message) => message.content
|
|
13799
13804
|
);
|
|
@@ -13838,7 +13843,7 @@ function createAgenticLoopWorkflow(params) {
|
|
|
13838
13843
|
})
|
|
13839
13844
|
);
|
|
13840
13845
|
const hasStopped = conditions.some((condition) => condition);
|
|
13841
|
-
hasFinishedSteps = hasStopped;
|
|
13846
|
+
hasFinishedSteps = hasFinishedSteps || hasStopped;
|
|
13842
13847
|
}
|
|
13843
13848
|
if (rest.onIterationComplete) {
|
|
13844
13849
|
const isFinal = !typedInputData.stepResult?.isContinued || hasFinishedSteps;
|
|
@@ -13869,10 +13874,7 @@ function createAgenticLoopWorkflow(params) {
|
|
|
13869
13874
|
try {
|
|
13870
13875
|
const iterationResult = await rest.onIterationComplete(iterationContext);
|
|
13871
13876
|
if (iterationResult) {
|
|
13872
|
-
if (iterationResult.
|
|
13873
|
-
hasFinishedSteps = true;
|
|
13874
|
-
}
|
|
13875
|
-
if (iterationResult.feedback && typedInputData.stepResult?.isContinued && !hasFinishedSteps) {
|
|
13877
|
+
if (iterationResult.feedback && typedInputData.stepResult?.isContinued) {
|
|
13876
13878
|
messageList.add(
|
|
13877
13879
|
{
|
|
13878
13880
|
id: rest.mastra?.generateId() || crypto2.randomUUID(),
|
|
@@ -13897,10 +13899,14 @@ function createAgenticLoopWorkflow(params) {
|
|
|
13897
13899
|
},
|
|
13898
13900
|
"response"
|
|
13899
13901
|
);
|
|
13900
|
-
if (iterationResult.continue
|
|
13902
|
+
if (iterationResult.continue === false) {
|
|
13903
|
+
pendingFeedbackStop = true;
|
|
13904
|
+
} else if (!hasFinishedSteps && rest.maxSteps && accumulatedSteps.length < rest.maxSteps) {
|
|
13901
13905
|
hasFinishedSteps = false;
|
|
13902
13906
|
typedInputData.stepResult.isContinued = true;
|
|
13903
13907
|
}
|
|
13908
|
+
} else if (iterationResult.continue === false && !hasFinishedSteps) {
|
|
13909
|
+
hasFinishedSteps = true;
|
|
13904
13910
|
}
|
|
13905
13911
|
}
|
|
13906
13912
|
} catch (error) {
|
|
@@ -14028,7 +14034,7 @@ function workflowLoopStream({
|
|
|
14028
14034
|
const run = await agenticLoopWorkflow.createRun({
|
|
14029
14035
|
runId
|
|
14030
14036
|
});
|
|
14031
|
-
const requestContext = rest.requestContext ?? new
|
|
14037
|
+
const requestContext = rest.requestContext ?? new chunk5WBEMKE2_cjs.RequestContext();
|
|
14032
14038
|
if (requireToolApproval) {
|
|
14033
14039
|
requestContext.set("__mastra_requireToolApproval", true);
|
|
14034
14040
|
}
|
|
@@ -14384,6 +14390,7 @@ var MastraLLMVNext = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
14384
14390
|
toolCallId,
|
|
14385
14391
|
messageList,
|
|
14386
14392
|
models: this.#models,
|
|
14393
|
+
logger: this.logger,
|
|
14387
14394
|
tools,
|
|
14388
14395
|
stopWhen: stopWhenToUse,
|
|
14389
14396
|
toolChoice,
|
|
@@ -14450,7 +14457,7 @@ var MastraLLMVNext = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
14450
14457
|
const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
|
|
14451
14458
|
if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
|
|
14452
14459
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
14453
|
-
await
|
|
14460
|
+
await chunkGCRPNAAR_cjs.delay(10 * 1e3);
|
|
14454
14461
|
}
|
|
14455
14462
|
},
|
|
14456
14463
|
onFinish: async (props) => {
|
|
@@ -14715,7 +14722,7 @@ async function prepareMemoryStep({
|
|
|
14715
14722
|
);
|
|
14716
14723
|
}
|
|
14717
14724
|
} else {
|
|
14718
|
-
const messageList = new
|
|
14725
|
+
const messageList = new chunkYZMSJKAK_cjs.MessageList({
|
|
14719
14726
|
threadId: thread?.id,
|
|
14720
14727
|
resourceId: thread?.resourceId
|
|
14721
14728
|
});
|
|
@@ -14772,7 +14779,7 @@ async function saveMessagesWithProcessors(memory, messages, processorRunner, con
|
|
|
14772
14779
|
await memory.saveMessages({ messages });
|
|
14773
14780
|
return;
|
|
14774
14781
|
}
|
|
14775
|
-
const messageList = new
|
|
14782
|
+
const messageList = new chunkYZMSJKAK_cjs.MessageList();
|
|
14776
14783
|
for (const msg of messages) {
|
|
14777
14784
|
messageList.add(msg, "response");
|
|
14778
14785
|
}
|
|
@@ -16210,7 +16217,7 @@ async function networkLoop({
|
|
|
16210
16217
|
"resumeData": "string"
|
|
16211
16218
|
}
|
|
16212
16219
|
`;
|
|
16213
|
-
const messageList = new
|
|
16220
|
+
const messageList = new chunkYZMSJKAK_cjs.MessageList();
|
|
16214
16221
|
messageList.addSystem(systemInstructions);
|
|
16215
16222
|
messageList.add(task, "user");
|
|
16216
16223
|
const result = llm.stream({
|
|
@@ -16626,6 +16633,8 @@ async function networkLoop({
|
|
|
16626
16633
|
}
|
|
16627
16634
|
});
|
|
16628
16635
|
}
|
|
16636
|
+
|
|
16637
|
+
// src/processors/processors/skills.ts
|
|
16629
16638
|
var SkillsProcessor = class {
|
|
16630
16639
|
id = "skills-processor";
|
|
16631
16640
|
name = "Skills Processor";
|
|
@@ -16633,8 +16642,6 @@ var SkillsProcessor = class {
|
|
|
16633
16642
|
_workspace;
|
|
16634
16643
|
/** Format for skill injection */
|
|
16635
16644
|
_format;
|
|
16636
|
-
/** Set of activated skill names */
|
|
16637
|
-
_activatedSkills = /* @__PURE__ */ new Set();
|
|
16638
16645
|
constructor(opts) {
|
|
16639
16646
|
this._workspace = opts.workspace;
|
|
16640
16647
|
this._format = opts.format ?? "xml";
|
|
@@ -16674,7 +16681,8 @@ var SkillsProcessor = class {
|
|
|
16674
16681
|
return skill.source.type;
|
|
16675
16682
|
}
|
|
16676
16683
|
/**
|
|
16677
|
-
* Format available skills metadata based on configured format
|
|
16684
|
+
* Format available skills metadata based on configured format.
|
|
16685
|
+
* Skills are sorted by name for deterministic output (prompt cache stability).
|
|
16678
16686
|
*/
|
|
16679
16687
|
async formatAvailableSkills() {
|
|
16680
16688
|
const skillsList = await this.skills?.list();
|
|
@@ -16683,6 +16691,7 @@ var SkillsProcessor = class {
|
|
|
16683
16691
|
}
|
|
16684
16692
|
const skillPromises = skillsList.map((meta) => this.skills?.get(meta.name));
|
|
16685
16693
|
const fullSkills = (await Promise.all(skillPromises)).filter((s) => s !== void 0);
|
|
16694
|
+
fullSkills.sort((a, b) => a.name.localeCompare(b.name));
|
|
16686
16695
|
switch (this._format) {
|
|
16687
16696
|
case "xml": {
|
|
16688
16697
|
const skillsXml = fullSkills.map(
|
|
@@ -16725,46 +16734,6 @@ ${skillsMd}`;
|
|
|
16725
16734
|
}
|
|
16726
16735
|
}
|
|
16727
16736
|
}
|
|
16728
|
-
/**
|
|
16729
|
-
* Format activated skills based on configured format
|
|
16730
|
-
*/
|
|
16731
|
-
async formatActivatedSkills() {
|
|
16732
|
-
const skillPromises = Array.from(this._activatedSkills).map((name) => this.skills?.get(name));
|
|
16733
|
-
const activatedSkillsList = (await Promise.all(skillPromises)).filter((s) => s !== void 0);
|
|
16734
|
-
if (activatedSkillsList.length === 0) {
|
|
16735
|
-
return "";
|
|
16736
|
-
}
|
|
16737
|
-
switch (this._format) {
|
|
16738
|
-
case "xml": {
|
|
16739
|
-
const skillInstructions = activatedSkillsList.map(
|
|
16740
|
-
(skill) => `# Skill: ${skill.name}
|
|
16741
|
-
Location: ${this.formatLocation(skill)}
|
|
16742
|
-
Source: ${this.formatSourceType(skill)}
|
|
16743
|
-
|
|
16744
|
-
${skill.instructions}`
|
|
16745
|
-
).join("\n\n---\n\n");
|
|
16746
|
-
return `<activated_skills>
|
|
16747
|
-
${skillInstructions}
|
|
16748
|
-
</activated_skills>`;
|
|
16749
|
-
}
|
|
16750
|
-
case "json":
|
|
16751
|
-
case "markdown": {
|
|
16752
|
-
const skillInstructions = activatedSkillsList.map(
|
|
16753
|
-
(skill) => `# Skill: ${skill.name}
|
|
16754
|
-
*Location: ${this.formatLocation(skill)} | Source: ${this.formatSourceType(skill)}*
|
|
16755
|
-
|
|
16756
|
-
${skill.instructions}`
|
|
16757
|
-
).join("\n\n---\n\n");
|
|
16758
|
-
return `# Activated Skills
|
|
16759
|
-
|
|
16760
|
-
${skillInstructions}`;
|
|
16761
|
-
}
|
|
16762
|
-
default: {
|
|
16763
|
-
const _exhaustive = this._format;
|
|
16764
|
-
return _exhaustive;
|
|
16765
|
-
}
|
|
16766
|
-
}
|
|
16767
|
-
}
|
|
16768
16737
|
/**
|
|
16769
16738
|
* Escape XML special characters
|
|
16770
16739
|
*/
|
|
@@ -16772,255 +16741,13 @@ ${skillInstructions}`;
|
|
|
16772
16741
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
16773
16742
|
}
|
|
16774
16743
|
// ===========================================================================
|
|
16775
|
-
//
|
|
16744
|
+
// processInputStep — system message injection only
|
|
16776
16745
|
// ===========================================================================
|
|
16777
16746
|
/**
|
|
16778
|
-
*
|
|
16779
|
-
|
|
16780
|
-
createSkillActivateTool() {
|
|
16781
|
-
const skills = this.skills;
|
|
16782
|
-
const activatedSkills = this._activatedSkills;
|
|
16783
|
-
return chunkD6HO5QAM_cjs.createTool({
|
|
16784
|
-
id: "skill-activate",
|
|
16785
|
-
description: "Activate a skill to load its full instructions. You should activate skills proactively when they are relevant to the user's request without asking for permission first.",
|
|
16786
|
-
inputSchema: z10__default.default.object({
|
|
16787
|
-
name: z10__default.default.string().describe("The name of the skill to activate")
|
|
16788
|
-
}),
|
|
16789
|
-
execute: async ({ name }) => {
|
|
16790
|
-
if (!skills) {
|
|
16791
|
-
return {
|
|
16792
|
-
success: false,
|
|
16793
|
-
message: "No skills configured"
|
|
16794
|
-
};
|
|
16795
|
-
}
|
|
16796
|
-
if (!await skills.has(name)) {
|
|
16797
|
-
const skillsList = await skills.list();
|
|
16798
|
-
const skillNames = skillsList.map((s) => s.name);
|
|
16799
|
-
return {
|
|
16800
|
-
success: false,
|
|
16801
|
-
message: `Skill "${name}" not found. Available skills: ${skillNames.join(", ")}`
|
|
16802
|
-
};
|
|
16803
|
-
}
|
|
16804
|
-
if (activatedSkills.has(name)) {
|
|
16805
|
-
return {
|
|
16806
|
-
success: true,
|
|
16807
|
-
message: `Skill "${name}" is already activated`
|
|
16808
|
-
};
|
|
16809
|
-
}
|
|
16810
|
-
activatedSkills.add(name);
|
|
16811
|
-
return {
|
|
16812
|
-
success: true,
|
|
16813
|
-
message: `Skill "${name}" activated successfully. The skill instructions are now available.`
|
|
16814
|
-
};
|
|
16815
|
-
}
|
|
16816
|
-
});
|
|
16817
|
-
}
|
|
16818
|
-
/**
|
|
16819
|
-
* Create skill-read-reference tool
|
|
16820
|
-
*/
|
|
16821
|
-
createSkillReadReferenceTool() {
|
|
16822
|
-
const skills = this.skills;
|
|
16823
|
-
const activatedSkills = this._activatedSkills;
|
|
16824
|
-
return chunkD6HO5QAM_cjs.createTool({
|
|
16825
|
-
id: "skill-read-reference",
|
|
16826
|
-
description: "Read a reference file from an activated skill. Optionally specify line range to read a portion of the file.",
|
|
16827
|
-
inputSchema: z10__default.default.object({
|
|
16828
|
-
skillName: z10__default.default.string().describe("The name of the activated skill"),
|
|
16829
|
-
referencePath: z10__default.default.string().describe(
|
|
16830
|
-
'Path to the reference file (relative to the skill root directory, e.g. "references/colors.md" or "docs/schema.md")'
|
|
16831
|
-
),
|
|
16832
|
-
startLine: z10__default.default.number().optional().describe("Starting line number (1-indexed). If omitted, starts from the beginning."),
|
|
16833
|
-
endLine: z10__default.default.number().optional().describe("Ending line number (1-indexed, inclusive). If omitted, reads to the end.")
|
|
16834
|
-
}),
|
|
16835
|
-
execute: async ({ skillName, referencePath, startLine, endLine }) => {
|
|
16836
|
-
if (!skills) {
|
|
16837
|
-
return {
|
|
16838
|
-
success: false,
|
|
16839
|
-
message: "No skills configured"
|
|
16840
|
-
};
|
|
16841
|
-
}
|
|
16842
|
-
if (!activatedSkills.has(skillName)) {
|
|
16843
|
-
return {
|
|
16844
|
-
success: false,
|
|
16845
|
-
message: `Skill "${skillName}" is not activated. Activate it first using skill-activate.`
|
|
16846
|
-
};
|
|
16847
|
-
}
|
|
16848
|
-
const fullContent = await skills.getReference(skillName, referencePath);
|
|
16849
|
-
if (fullContent === null) {
|
|
16850
|
-
const availableRefs = await skills.listReferences(skillName);
|
|
16851
|
-
return {
|
|
16852
|
-
success: false,
|
|
16853
|
-
message: `Reference file "${referencePath}" not found in skill "${skillName}". Available references: ${availableRefs.join(", ") || "none"}`
|
|
16854
|
-
};
|
|
16855
|
-
}
|
|
16856
|
-
const result = chunk4P35AVPE_cjs.extractLines(fullContent, startLine, endLine);
|
|
16857
|
-
return {
|
|
16858
|
-
success: true,
|
|
16859
|
-
content: result.content,
|
|
16860
|
-
lines: result.lines,
|
|
16861
|
-
totalLines: result.totalLines
|
|
16862
|
-
};
|
|
16863
|
-
}
|
|
16864
|
-
});
|
|
16865
|
-
}
|
|
16866
|
-
/**
|
|
16867
|
-
* Create skill-read-script tool
|
|
16868
|
-
*/
|
|
16869
|
-
createSkillReadScriptTool() {
|
|
16870
|
-
const skills = this.skills;
|
|
16871
|
-
const activatedSkills = this._activatedSkills;
|
|
16872
|
-
return chunkD6HO5QAM_cjs.createTool({
|
|
16873
|
-
id: "skill-read-script",
|
|
16874
|
-
description: "Read a script file from an activated skill. Scripts contain executable code. Optionally specify line range.",
|
|
16875
|
-
inputSchema: z10__default.default.object({
|
|
16876
|
-
skillName: z10__default.default.string().describe("The name of the activated skill"),
|
|
16877
|
-
scriptPath: z10__default.default.string().describe('Path to the script file (relative to the skill root directory, e.g. "scripts/run.sh")'),
|
|
16878
|
-
startLine: z10__default.default.number().optional().describe("Starting line number (1-indexed). If omitted, starts from the beginning."),
|
|
16879
|
-
endLine: z10__default.default.number().optional().describe("Ending line number (1-indexed, inclusive). If omitted, reads to the end.")
|
|
16880
|
-
}),
|
|
16881
|
-
execute: async ({ skillName, scriptPath, startLine, endLine }) => {
|
|
16882
|
-
if (!skills) {
|
|
16883
|
-
return {
|
|
16884
|
-
success: false,
|
|
16885
|
-
message: "No skills configured"
|
|
16886
|
-
};
|
|
16887
|
-
}
|
|
16888
|
-
if (!activatedSkills.has(skillName)) {
|
|
16889
|
-
return {
|
|
16890
|
-
success: false,
|
|
16891
|
-
message: `Skill "${skillName}" is not activated. Activate it first using skill-activate.`
|
|
16892
|
-
};
|
|
16893
|
-
}
|
|
16894
|
-
const fullContent = await skills.getScript(skillName, scriptPath);
|
|
16895
|
-
if (fullContent === null) {
|
|
16896
|
-
const availableScripts = await skills.listScripts(skillName);
|
|
16897
|
-
return {
|
|
16898
|
-
success: false,
|
|
16899
|
-
message: `Script file "${scriptPath}" not found in skill "${skillName}". Available scripts: ${availableScripts.join(", ") || "none"}`
|
|
16900
|
-
};
|
|
16901
|
-
}
|
|
16902
|
-
const result = chunk4P35AVPE_cjs.extractLines(fullContent, startLine, endLine);
|
|
16903
|
-
return {
|
|
16904
|
-
success: true,
|
|
16905
|
-
content: result.content,
|
|
16906
|
-
lines: result.lines,
|
|
16907
|
-
totalLines: result.totalLines
|
|
16908
|
-
};
|
|
16909
|
-
}
|
|
16910
|
-
});
|
|
16911
|
-
}
|
|
16912
|
-
/**
|
|
16913
|
-
* Create skill-read-asset tool
|
|
16747
|
+
* Process input step - inject available skills metadata into the system
|
|
16748
|
+
* message. Tools are provided by `Agent.listSkillTools()` instead.
|
|
16914
16749
|
*/
|
|
16915
|
-
|
|
16916
|
-
const skills = this.skills;
|
|
16917
|
-
const activatedSkills = this._activatedSkills;
|
|
16918
|
-
return chunkD6HO5QAM_cjs.createTool({
|
|
16919
|
-
id: "skill-read-asset",
|
|
16920
|
-
description: "Read an asset file from an activated skill. Assets include templates, data files, and other static resources. Binary files are returned as base64.",
|
|
16921
|
-
inputSchema: z10__default.default.object({
|
|
16922
|
-
skillName: z10__default.default.string().describe("The name of the activated skill"),
|
|
16923
|
-
assetPath: z10__default.default.string().describe('Path to the asset file (relative to the skill root directory, e.g. "assets/logo.png")')
|
|
16924
|
-
}),
|
|
16925
|
-
execute: async ({ skillName, assetPath }) => {
|
|
16926
|
-
if (!skills) {
|
|
16927
|
-
return {
|
|
16928
|
-
success: false,
|
|
16929
|
-
message: "No skills configured"
|
|
16930
|
-
};
|
|
16931
|
-
}
|
|
16932
|
-
if (!activatedSkills.has(skillName)) {
|
|
16933
|
-
return {
|
|
16934
|
-
success: false,
|
|
16935
|
-
message: `Skill "${skillName}" is not activated. Activate it first using skill-activate.`
|
|
16936
|
-
};
|
|
16937
|
-
}
|
|
16938
|
-
const content = await skills.getAsset(skillName, assetPath);
|
|
16939
|
-
if (content === null) {
|
|
16940
|
-
const availableAssets = await skills.listAssets(skillName);
|
|
16941
|
-
return {
|
|
16942
|
-
success: false,
|
|
16943
|
-
message: `Asset file "${assetPath}" not found in skill "${skillName}". Available assets: ${availableAssets.join(", ") || "none"}`
|
|
16944
|
-
};
|
|
16945
|
-
}
|
|
16946
|
-
try {
|
|
16947
|
-
const textContent = content.toString("utf-8");
|
|
16948
|
-
if (!textContent.slice(0, 1e3).includes("\0")) {
|
|
16949
|
-
return {
|
|
16950
|
-
success: true,
|
|
16951
|
-
content: textContent,
|
|
16952
|
-
encoding: "utf-8"
|
|
16953
|
-
};
|
|
16954
|
-
}
|
|
16955
|
-
} catch {
|
|
16956
|
-
}
|
|
16957
|
-
return {
|
|
16958
|
-
success: true,
|
|
16959
|
-
content: content.toString("base64"),
|
|
16960
|
-
encoding: "base64"
|
|
16961
|
-
};
|
|
16962
|
-
}
|
|
16963
|
-
});
|
|
16964
|
-
}
|
|
16965
|
-
/**
|
|
16966
|
-
* Create skill-search tool for searching across skill content
|
|
16967
|
-
*/
|
|
16968
|
-
createSkillSearchTool() {
|
|
16969
|
-
const skills = this.skills;
|
|
16970
|
-
return chunkD6HO5QAM_cjs.createTool({
|
|
16971
|
-
id: "skill-search",
|
|
16972
|
-
description: "Search across skill content to find relevant information. Useful when you need to find specific details within skills.",
|
|
16973
|
-
inputSchema: z10__default.default.object({
|
|
16974
|
-
query: z10__default.default.string().describe("The search query"),
|
|
16975
|
-
skillNames: z10__default.default.array(z10__default.default.string()).optional().describe("Optional list of skill names to search within"),
|
|
16976
|
-
topK: z10__default.default.number().optional().describe("Maximum number of results to return (default: 5)")
|
|
16977
|
-
}),
|
|
16978
|
-
execute: async ({ query, skillNames, topK }) => {
|
|
16979
|
-
if (!skills) {
|
|
16980
|
-
return {
|
|
16981
|
-
success: false,
|
|
16982
|
-
message: "No skills configured"
|
|
16983
|
-
};
|
|
16984
|
-
}
|
|
16985
|
-
const results = await skills.search(query, { topK, skillNames });
|
|
16986
|
-
if (results.length === 0) {
|
|
16987
|
-
return {
|
|
16988
|
-
success: true,
|
|
16989
|
-
message: "No results found",
|
|
16990
|
-
results: []
|
|
16991
|
-
};
|
|
16992
|
-
}
|
|
16993
|
-
return {
|
|
16994
|
-
success: true,
|
|
16995
|
-
results: results.map((r) => ({
|
|
16996
|
-
skillName: r.skillName,
|
|
16997
|
-
source: r.source,
|
|
16998
|
-
score: r.score,
|
|
16999
|
-
preview: r.content.substring(0, 200) + (r.content.length > 200 ? "..." : ""),
|
|
17000
|
-
lineRange: r.lineRange
|
|
17001
|
-
}))
|
|
17002
|
-
};
|
|
17003
|
-
}
|
|
17004
|
-
});
|
|
17005
|
-
}
|
|
17006
|
-
// ===========================================================================
|
|
17007
|
-
// Helpers
|
|
17008
|
-
// ===========================================================================
|
|
17009
|
-
/**
|
|
17010
|
-
* Mark a tool as never requiring approval.
|
|
17011
|
-
* Skill tools are internal plumbing and should bypass requireToolApproval.
|
|
17012
|
-
*/
|
|
17013
|
-
withNoApproval(tool2) {
|
|
17014
|
-
tool2.needsApprovalFn = () => false;
|
|
17015
|
-
return tool2;
|
|
17016
|
-
}
|
|
17017
|
-
// ===========================================================================
|
|
17018
|
-
// Processor Interface
|
|
17019
|
-
// ===========================================================================
|
|
17020
|
-
/**
|
|
17021
|
-
* Process input step - inject available skills and provide skill tools
|
|
17022
|
-
*/
|
|
17023
|
-
async processInputStep({ messageList, tools, stepNumber, requestContext }) {
|
|
16750
|
+
async processInputStep({ messageList, stepNumber, requestContext }) {
|
|
17024
16751
|
if (stepNumber === 0) {
|
|
17025
16752
|
await this.skills?.maybeRefresh({ requestContext });
|
|
17026
16753
|
}
|
|
@@ -17036,35 +16763,9 @@ ${skillInstructions}`;
|
|
|
17036
16763
|
}
|
|
17037
16764
|
messageList.addSystem({
|
|
17038
16765
|
role: "system",
|
|
17039
|
-
content: 'IMPORTANT: Skills are NOT tools. Do not call skill names directly. To use a skill, call the skill
|
|
16766
|
+
content: 'IMPORTANT: Skills are NOT tools. Do not call skill names directly as tool names. To use a skill, call the `skill` tool with the skill name as the "name" parameter. When a user asks about a topic covered by an available skill, activate it immediately without asking for permission first.'
|
|
17040
16767
|
});
|
|
17041
16768
|
}
|
|
17042
|
-
if (this._activatedSkills.size > 0) {
|
|
17043
|
-
const activatedSkillsMessage = await this.formatActivatedSkills();
|
|
17044
|
-
if (activatedSkillsMessage) {
|
|
17045
|
-
messageList.addSystem({
|
|
17046
|
-
role: "system",
|
|
17047
|
-
content: activatedSkillsMessage
|
|
17048
|
-
});
|
|
17049
|
-
}
|
|
17050
|
-
}
|
|
17051
|
-
const skillTools = {};
|
|
17052
|
-
if (hasSkills) {
|
|
17053
|
-
skillTools["skill-activate"] = this.withNoApproval(this.createSkillActivateTool());
|
|
17054
|
-
skillTools["skill-search"] = this.withNoApproval(this.createSkillSearchTool());
|
|
17055
|
-
}
|
|
17056
|
-
if (this._activatedSkills.size > 0) {
|
|
17057
|
-
skillTools["skill-read-reference"] = this.withNoApproval(this.createSkillReadReferenceTool());
|
|
17058
|
-
skillTools["skill-read-script"] = this.withNoApproval(this.createSkillReadScriptTool());
|
|
17059
|
-
skillTools["skill-read-asset"] = this.withNoApproval(this.createSkillReadAssetTool());
|
|
17060
|
-
}
|
|
17061
|
-
return {
|
|
17062
|
-
messageList,
|
|
17063
|
-
tools: {
|
|
17064
|
-
...tools,
|
|
17065
|
-
...skillTools
|
|
17066
|
-
}
|
|
17067
|
-
};
|
|
17068
16769
|
}
|
|
17069
16770
|
};
|
|
17070
16771
|
|
|
@@ -17173,7 +16874,7 @@ var AgentLegacyHandler = class {
|
|
|
17173
16874
|
methodType: methodType === "generate" ? "generateLegacy" : "streamLegacy",
|
|
17174
16875
|
memoryConfig
|
|
17175
16876
|
});
|
|
17176
|
-
let messageList = new
|
|
16877
|
+
let messageList = new chunkYZMSJKAK_cjs.MessageList({
|
|
17177
16878
|
threadId,
|
|
17178
16879
|
resourceId,
|
|
17179
16880
|
generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
|
|
@@ -17342,7 +17043,7 @@ var AgentLegacyHandler = class {
|
|
|
17342
17043
|
result: resToLog,
|
|
17343
17044
|
threadId
|
|
17344
17045
|
});
|
|
17345
|
-
const messageListResponses = new
|
|
17046
|
+
const messageListResponses = new chunkYZMSJKAK_cjs.MessageList({
|
|
17346
17047
|
threadId,
|
|
17347
17048
|
resourceId,
|
|
17348
17049
|
generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
|
|
@@ -17502,14 +17203,14 @@ var AgentLegacyHandler = class {
|
|
|
17502
17203
|
clientTools,
|
|
17503
17204
|
temperature,
|
|
17504
17205
|
toolChoice = "auto",
|
|
17505
|
-
requestContext = new
|
|
17206
|
+
requestContext = new chunk5WBEMKE2_cjs.RequestContext(),
|
|
17506
17207
|
tracingOptions,
|
|
17507
17208
|
savePerStep,
|
|
17508
17209
|
writableStream,
|
|
17509
17210
|
...args
|
|
17510
17211
|
} = options;
|
|
17511
|
-
const resourceIdFromContext = requestContext.get(
|
|
17512
|
-
const threadIdFromContext = requestContext.get(
|
|
17212
|
+
const resourceIdFromContext = requestContext.get(chunk5WBEMKE2_cjs.MASTRA_RESOURCE_ID_KEY);
|
|
17213
|
+
const threadIdFromContext = requestContext.get(chunk5WBEMKE2_cjs.MASTRA_THREAD_ID_KEY);
|
|
17513
17214
|
const threadFromArgs = threadIdFromContext ? { id: threadIdFromContext } : resolveThreadIdFromArgs({ threadId: args.threadId, memory: args.memory });
|
|
17514
17215
|
const resourceId = resourceIdFromContext || args.memory?.resource || resourceIdFromArgs;
|
|
17515
17216
|
const memoryConfig = args.memory?.options || memoryConfigFromArgs;
|
|
@@ -17710,7 +17411,7 @@ var AgentLegacyHandler = class {
|
|
|
17710
17411
|
"response"
|
|
17711
17412
|
);
|
|
17712
17413
|
const outputProcessorResult2 = await this.capabilities.__runOutputProcessors({
|
|
17713
|
-
requestContext: contextWithMemory || new
|
|
17414
|
+
requestContext: contextWithMemory || new chunk5WBEMKE2_cjs.RequestContext(),
|
|
17714
17415
|
...observabilityContext,
|
|
17715
17416
|
outputProcessorOverrides: finalOutputProcessors,
|
|
17716
17417
|
messageList
|
|
@@ -17799,7 +17500,7 @@ var AgentLegacyHandler = class {
|
|
|
17799
17500
|
"response"
|
|
17800
17501
|
);
|
|
17801
17502
|
const outputProcessorResult = await this.capabilities.__runOutputProcessors({
|
|
17802
|
-
requestContext: contextWithMemory || new
|
|
17503
|
+
requestContext: contextWithMemory || new chunk5WBEMKE2_cjs.RequestContext(),
|
|
17803
17504
|
...observabilityContext,
|
|
17804
17505
|
messageList
|
|
17805
17506
|
// Use the full message list with complete conversation history
|
|
@@ -18388,7 +18089,7 @@ var prepareToolsStepOutputSchema = z10.z.object({
|
|
|
18388
18089
|
var prepareMemoryStepOutputSchema = z10.z.object({
|
|
18389
18090
|
threadExists: z10.z.boolean(),
|
|
18390
18091
|
thread: storageThreadSchema.optional(),
|
|
18391
|
-
messageList: z10.z.instanceof(
|
|
18092
|
+
messageList: z10.z.instanceof(chunkYZMSJKAK_cjs.MessageList),
|
|
18392
18093
|
/** Shared processor states map that persists across loop iterations for both input and output processors */
|
|
18393
18094
|
processorStates: z10.z.instanceof(Map),
|
|
18394
18095
|
/** Tripwire data when input processor triggered abort */
|
|
@@ -18429,7 +18130,7 @@ function createPrepareMemoryStep({
|
|
|
18429
18130
|
execute: async ({ ...rest }) => {
|
|
18430
18131
|
const observabilityContext = chunk4UOWNFAL_cjs.resolveObservabilityContext(rest);
|
|
18431
18132
|
const thread = threadFromArgs;
|
|
18432
|
-
const messageList = new
|
|
18133
|
+
const messageList = new chunkYZMSJKAK_cjs.MessageList({
|
|
18433
18134
|
threadId: thread?.id,
|
|
18434
18135
|
resourceId,
|
|
18435
18136
|
generateMessageId: capabilities.generateMessageId,
|
|
@@ -18605,7 +18306,7 @@ function createStreamStep({
|
|
|
18605
18306
|
runId
|
|
18606
18307
|
});
|
|
18607
18308
|
const processors = validatedInputData.outputProcessors || (capabilities.outputProcessors ? typeof capabilities.outputProcessors === "function" ? await capabilities.outputProcessors({
|
|
18608
|
-
requestContext: validatedInputData.requestContext || new
|
|
18309
|
+
requestContext: validatedInputData.requestContext || new chunk5WBEMKE2_cjs.RequestContext()
|
|
18609
18310
|
}) : capabilities.outputProcessors : []);
|
|
18610
18311
|
const modelMethodType = getModelMethodFromAgentMethod(methodType);
|
|
18611
18312
|
const streamResult = capabilities.llm.stream({
|
|
@@ -18888,7 +18589,7 @@ var Agent = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
18888
18589
|
* @internal
|
|
18889
18590
|
*/
|
|
18890
18591
|
async getSkillsProcessors(configuredProcessors, requestContext) {
|
|
18891
|
-
const workspace = await this.getWorkspace({ requestContext: requestContext || new
|
|
18592
|
+
const workspace = await this.getWorkspace({ requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext() });
|
|
18892
18593
|
if (!workspace?.skills) {
|
|
18893
18594
|
return [];
|
|
18894
18595
|
}
|
|
@@ -18906,7 +18607,7 @@ var Agent = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
18906
18607
|
* @internal
|
|
18907
18608
|
*/
|
|
18908
18609
|
async getWorkspaceInstructionsProcessors(configuredProcessors, requestContext) {
|
|
18909
|
-
const workspace = await this.getWorkspace({ requestContext: requestContext || new
|
|
18610
|
+
const workspace = await this.getWorkspace({ requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext() });
|
|
18910
18611
|
if (!workspace) return [];
|
|
18911
18612
|
if (!workspace.filesystem && !workspace.sandbox) return [];
|
|
18912
18613
|
const hasProcessor = configuredProcessors.some(
|
|
@@ -18920,7 +18621,7 @@ var Agent = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
18920
18621
|
* Throws an error if validation fails.
|
|
18921
18622
|
*/
|
|
18922
18623
|
async #validateRequestContext(requestContext) {
|
|
18923
|
-
if (this.#requestContextSchema &&
|
|
18624
|
+
if (this.#requestContextSchema && chunkGCRPNAAR_cjs.isZodType(this.#requestContextSchema)) {
|
|
18924
18625
|
const contextValues = requestContext?.all ?? {};
|
|
18925
18626
|
const validatedRequestContext = await this.#requestContextSchema.safeParseAsync(contextValues);
|
|
18926
18627
|
if (!validatedRequestContext.success) {
|
|
@@ -18950,7 +18651,7 @@ ${errorMessages}`,
|
|
|
18950
18651
|
* console.log(Object.keys(agents)); // ['agent1', 'agent2']
|
|
18951
18652
|
* ```
|
|
18952
18653
|
*/
|
|
18953
|
-
listAgents({ requestContext = new
|
|
18654
|
+
listAgents({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
|
|
18954
18655
|
const agentsToUse = this.#agents ? typeof this.#agents === "function" ? this.#agents({ requestContext }) : this.#agents : {};
|
|
18955
18656
|
return resolveMaybePromise(agentsToUse, (agents) => {
|
|
18956
18657
|
if (!agents) {
|
|
@@ -19055,8 +18756,8 @@ ${errorMessages}`,
|
|
|
19055
18756
|
* @internal
|
|
19056
18757
|
*/
|
|
19057
18758
|
async listResolvedOutputProcessors(requestContext, configuredProcessorOverrides) {
|
|
19058
|
-
const configuredProcessors = configuredProcessorOverrides ? configuredProcessorOverrides : this.#outputProcessors ? typeof this.#outputProcessors === "function" ? await this.#outputProcessors({ requestContext: requestContext || new
|
|
19059
|
-
const memory = await this.getMemory({ requestContext: requestContext || new
|
|
18759
|
+
const configuredProcessors = configuredProcessorOverrides ? configuredProcessorOverrides : this.#outputProcessors ? typeof this.#outputProcessors === "function" ? await this.#outputProcessors({ requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext() }) : this.#outputProcessors : [];
|
|
18760
|
+
const memory = await this.getMemory({ requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext() });
|
|
19060
18761
|
const memoryProcessors = memory ? await memory.getOutputProcessors(configuredProcessors, requestContext) : [];
|
|
19061
18762
|
const allProcessors = [...configuredProcessors, ...memoryProcessors];
|
|
19062
18763
|
return this.combineProcessorsIntoWorkflow(allProcessors, `${this.id}-output-processor`);
|
|
@@ -19067,8 +18768,8 @@ ${errorMessages}`,
|
|
|
19067
18768
|
* @internal
|
|
19068
18769
|
*/
|
|
19069
18770
|
async listResolvedInputProcessors(requestContext, configuredProcessorOverrides) {
|
|
19070
|
-
const configuredProcessors = configuredProcessorOverrides ? configuredProcessorOverrides : this.#inputProcessors ? typeof this.#inputProcessors === "function" ? await this.#inputProcessors({ requestContext: requestContext || new
|
|
19071
|
-
const memory = await this.getMemory({ requestContext: requestContext || new
|
|
18771
|
+
const configuredProcessors = configuredProcessorOverrides ? configuredProcessorOverrides : this.#inputProcessors ? typeof this.#inputProcessors === "function" ? await this.#inputProcessors({ requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext() }) : this.#inputProcessors : [];
|
|
18772
|
+
const memory = await this.getMemory({ requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext() });
|
|
19072
18773
|
const memoryProcessors = memory ? await memory.getInputProcessors(configuredProcessors, requestContext) : [];
|
|
19073
18774
|
const workspaceProcessors = await this.getWorkspaceInstructionsProcessors(configuredProcessors, requestContext);
|
|
19074
18775
|
const skillsProcessors = await this.getSkillsProcessors(configuredProcessors, requestContext);
|
|
@@ -19101,7 +18802,7 @@ ${errorMessages}`,
|
|
|
19101
18802
|
* ```
|
|
19102
18803
|
*/
|
|
19103
18804
|
async resolveProcessorById(processorId, requestContext) {
|
|
19104
|
-
const ctx = requestContext || new
|
|
18805
|
+
const ctx = requestContext || new chunk5WBEMKE2_cjs.RequestContext();
|
|
19105
18806
|
const configuredInputProcessors = this.#inputProcessors ? typeof this.#inputProcessors === "function" ? await this.#inputProcessors({ requestContext: ctx }) : this.#inputProcessors : [];
|
|
19106
18807
|
const memory = await this.getMemory({ requestContext: ctx });
|
|
19107
18808
|
const memoryInputProcessors = memory ? await memory.getInputProcessors(configuredInputProcessors, ctx) : [];
|
|
@@ -19128,7 +18829,7 @@ ${errorMessages}`,
|
|
|
19128
18829
|
*/
|
|
19129
18830
|
async listConfiguredInputProcessors(requestContext) {
|
|
19130
18831
|
if (!this.#inputProcessors) return [];
|
|
19131
|
-
const configuredProcessors = typeof this.#inputProcessors === "function" ? await this.#inputProcessors({ requestContext: requestContext || new
|
|
18832
|
+
const configuredProcessors = typeof this.#inputProcessors === "function" ? await this.#inputProcessors({ requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext() }) : this.#inputProcessors;
|
|
19132
18833
|
return this.combineProcessorsIntoWorkflow(configuredProcessors, `${this.id}-configured-input-processor`);
|
|
19133
18834
|
}
|
|
19134
18835
|
/**
|
|
@@ -19140,7 +18841,7 @@ ${errorMessages}`,
|
|
|
19140
18841
|
*/
|
|
19141
18842
|
async listConfiguredOutputProcessors(requestContext) {
|
|
19142
18843
|
if (!this.#outputProcessors) return [];
|
|
19143
|
-
const configuredProcessors = typeof this.#outputProcessors === "function" ? await this.#outputProcessors({ requestContext: requestContext || new
|
|
18844
|
+
const configuredProcessors = typeof this.#outputProcessors === "function" ? await this.#outputProcessors({ requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext() }) : this.#outputProcessors;
|
|
19144
18845
|
return this.combineProcessorsIntoWorkflow(configuredProcessors, `${this.id}-configured-output-processor`);
|
|
19145
18846
|
}
|
|
19146
18847
|
/**
|
|
@@ -19149,7 +18850,7 @@ ${errorMessages}`,
|
|
|
19149
18850
|
* agent processor configuration to storage.
|
|
19150
18851
|
*/
|
|
19151
18852
|
async getConfiguredProcessorIds(requestContext) {
|
|
19152
|
-
const ctx = requestContext || new
|
|
18853
|
+
const ctx = requestContext || new chunk5WBEMKE2_cjs.RequestContext();
|
|
19153
18854
|
let inputProcessorIds = [];
|
|
19154
18855
|
if (this.#inputProcessors) {
|
|
19155
18856
|
const processors = typeof this.#inputProcessors === "function" ? await this.#inputProcessors({ requestContext: ctx }) : this.#inputProcessors;
|
|
@@ -19170,7 +18871,7 @@ ${errorMessages}`,
|
|
|
19170
18871
|
async getConfiguredProcessorWorkflows() {
|
|
19171
18872
|
const workflows = [];
|
|
19172
18873
|
if (this.#inputProcessors) {
|
|
19173
|
-
const inputProcessors = typeof this.#inputProcessors === "function" ? await this.#inputProcessors({ requestContext: new
|
|
18874
|
+
const inputProcessors = typeof this.#inputProcessors === "function" ? await this.#inputProcessors({ requestContext: new chunk5WBEMKE2_cjs.RequestContext() }) : this.#inputProcessors;
|
|
19174
18875
|
const combined = this.combineProcessorsIntoWorkflow(inputProcessors, `${this.id}-input-processor`);
|
|
19175
18876
|
for (const p of combined) {
|
|
19176
18877
|
if (isProcessorWorkflow(p)) {
|
|
@@ -19179,7 +18880,7 @@ ${errorMessages}`,
|
|
|
19179
18880
|
}
|
|
19180
18881
|
}
|
|
19181
18882
|
if (this.#outputProcessors) {
|
|
19182
|
-
const outputProcessors = typeof this.#outputProcessors === "function" ? await this.#outputProcessors({ requestContext: new
|
|
18883
|
+
const outputProcessors = typeof this.#outputProcessors === "function" ? await this.#outputProcessors({ requestContext: new chunk5WBEMKE2_cjs.RequestContext() }) : this.#outputProcessors;
|
|
19183
18884
|
const combined = this.combineProcessorsIntoWorkflow(outputProcessors, `${this.id}-output-processor`);
|
|
19184
18885
|
for (const p of combined) {
|
|
19185
18886
|
if (isProcessorWorkflow(p)) {
|
|
@@ -19214,7 +18915,7 @@ ${errorMessages}`,
|
|
|
19214
18915
|
* }
|
|
19215
18916
|
* ```
|
|
19216
18917
|
*/
|
|
19217
|
-
async getMemory({ requestContext = new
|
|
18918
|
+
async getMemory({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
|
|
19218
18919
|
if (!this.#memory) {
|
|
19219
18920
|
return void 0;
|
|
19220
18921
|
}
|
|
@@ -19277,7 +18978,7 @@ ${errorMessages}`,
|
|
|
19277
18978
|
* ```
|
|
19278
18979
|
*/
|
|
19279
18980
|
async getWorkspace({
|
|
19280
|
-
requestContext = new
|
|
18981
|
+
requestContext = new chunk5WBEMKE2_cjs.RequestContext()
|
|
19281
18982
|
} = {}) {
|
|
19282
18983
|
if (this.#workspace) {
|
|
19283
18984
|
if (typeof this.#workspace !== "function") {
|
|
@@ -19335,7 +19036,7 @@ ${errorMessages}`,
|
|
|
19335
19036
|
* ```
|
|
19336
19037
|
*/
|
|
19337
19038
|
async listWorkflows({
|
|
19338
|
-
requestContext = new
|
|
19039
|
+
requestContext = new chunk5WBEMKE2_cjs.RequestContext()
|
|
19339
19040
|
} = {}) {
|
|
19340
19041
|
let workflowRecord;
|
|
19341
19042
|
if (typeof this.#workflows === "function") {
|
|
@@ -19351,7 +19052,7 @@ ${errorMessages}`,
|
|
|
19351
19052
|
return workflowRecord;
|
|
19352
19053
|
}
|
|
19353
19054
|
async listScorers({
|
|
19354
|
-
requestContext = new
|
|
19055
|
+
requestContext = new chunk5WBEMKE2_cjs.RequestContext()
|
|
19355
19056
|
} = {}) {
|
|
19356
19057
|
if (typeof this.#scorers !== "function") {
|
|
19357
19058
|
return this.#scorers;
|
|
@@ -19406,7 +19107,7 @@ ${errorMessages}`,
|
|
|
19406
19107
|
* console.log(instructions); // 'You are a helpful assistant'
|
|
19407
19108
|
* ```
|
|
19408
19109
|
*/
|
|
19409
|
-
getInstructions({ requestContext = new
|
|
19110
|
+
getInstructions({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
|
|
19410
19111
|
if (typeof this.#instructions === "function") {
|
|
19411
19112
|
const result = this.#instructions({
|
|
19412
19113
|
requestContext,
|
|
@@ -19512,7 +19213,7 @@ ${errorMessages}`,
|
|
|
19512
19213
|
* ```
|
|
19513
19214
|
*/
|
|
19514
19215
|
getDefaultGenerateOptionsLegacy({
|
|
19515
|
-
requestContext = new
|
|
19216
|
+
requestContext = new chunk5WBEMKE2_cjs.RequestContext()
|
|
19516
19217
|
} = {}) {
|
|
19517
19218
|
if (typeof this.#defaultGenerateOptionsLegacy !== "function") {
|
|
19518
19219
|
return this.#defaultGenerateOptionsLegacy;
|
|
@@ -19547,7 +19248,7 @@ ${errorMessages}`,
|
|
|
19547
19248
|
* ```
|
|
19548
19249
|
*/
|
|
19549
19250
|
getDefaultStreamOptionsLegacy({
|
|
19550
|
-
requestContext = new
|
|
19251
|
+
requestContext = new chunk5WBEMKE2_cjs.RequestContext()
|
|
19551
19252
|
} = {}) {
|
|
19552
19253
|
if (typeof this.#defaultStreamOptionsLegacy !== "function") {
|
|
19553
19254
|
return this.#defaultStreamOptionsLegacy;
|
|
@@ -19581,7 +19282,7 @@ ${errorMessages}`,
|
|
|
19581
19282
|
* console.log(options.maxSteps); // 5
|
|
19582
19283
|
* ```
|
|
19583
19284
|
*/
|
|
19584
|
-
getDefaultOptions({ requestContext = new
|
|
19285
|
+
getDefaultOptions({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
|
|
19585
19286
|
if (typeof this.#defaultOptions !== "function") {
|
|
19586
19287
|
return this.#defaultOptions;
|
|
19587
19288
|
}
|
|
@@ -19617,7 +19318,7 @@ ${errorMessages}`,
|
|
|
19617
19318
|
* console.log(options.completion?.scorers); // [testsScorer, buildScorer]
|
|
19618
19319
|
* ```
|
|
19619
19320
|
*/
|
|
19620
|
-
getDefaultNetworkOptions({ requestContext = new
|
|
19321
|
+
getDefaultNetworkOptions({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
|
|
19621
19322
|
if (typeof this.#defaultNetworkOptions !== "function") {
|
|
19622
19323
|
return this.#defaultNetworkOptions;
|
|
19623
19324
|
}
|
|
@@ -19650,9 +19351,9 @@ ${errorMessages}`,
|
|
|
19650
19351
|
* console.log(Object.keys(tools)); // ['calculator', 'weather']
|
|
19651
19352
|
* ```
|
|
19652
19353
|
*/
|
|
19653
|
-
listTools({ requestContext = new
|
|
19354
|
+
listTools({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
|
|
19654
19355
|
if (typeof this.#tools !== "function") {
|
|
19655
|
-
return
|
|
19356
|
+
return chunkGCRPNAAR_cjs.ensureToolProperties(this.#tools);
|
|
19656
19357
|
}
|
|
19657
19358
|
const result = this.#tools({
|
|
19658
19359
|
requestContext,
|
|
@@ -19673,7 +19374,7 @@ ${errorMessages}`,
|
|
|
19673
19374
|
this.logger.error(mastraError.toString());
|
|
19674
19375
|
throw mastraError;
|
|
19675
19376
|
}
|
|
19676
|
-
return
|
|
19377
|
+
return chunkGCRPNAAR_cjs.ensureToolProperties(tools);
|
|
19677
19378
|
});
|
|
19678
19379
|
}
|
|
19679
19380
|
/**
|
|
@@ -19688,7 +19389,7 @@ ${errorMessages}`,
|
|
|
19688
19389
|
* ```
|
|
19689
19390
|
*/
|
|
19690
19391
|
getLLM({
|
|
19691
|
-
requestContext = new
|
|
19392
|
+
requestContext = new chunk5WBEMKE2_cjs.RequestContext(),
|
|
19692
19393
|
model
|
|
19693
19394
|
} = {}) {
|
|
19694
19395
|
const modelToUse = this.getModel({ modelConfig: model, requestContext });
|
|
@@ -19705,7 +19406,7 @@ ${errorMessages}`,
|
|
|
19705
19406
|
});
|
|
19706
19407
|
});
|
|
19707
19408
|
} else {
|
|
19708
|
-
llm = new
|
|
19409
|
+
llm = new chunkOOTLMVNN_cjs.MastraLLMV1({
|
|
19709
19410
|
model: resolvedModel,
|
|
19710
19411
|
mastra: this.#mastra,
|
|
19711
19412
|
options: { tracingPolicy: this.#options?.tracingPolicy }
|
|
@@ -19730,7 +19431,7 @@ ${errorMessages}`,
|
|
|
19730
19431
|
*/
|
|
19731
19432
|
async resolveModelConfig(modelConfig, requestContext) {
|
|
19732
19433
|
try {
|
|
19733
|
-
return await
|
|
19434
|
+
return await chunkPP4G2TZZ_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
|
|
19734
19435
|
} catch (error) {
|
|
19735
19436
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
19736
19437
|
id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
|
|
@@ -19761,7 +19462,7 @@ ${errorMessages}`,
|
|
|
19761
19462
|
* ```
|
|
19762
19463
|
*/
|
|
19763
19464
|
getModel({
|
|
19764
|
-
requestContext = new
|
|
19465
|
+
requestContext = new chunk5WBEMKE2_cjs.RequestContext(),
|
|
19765
19466
|
modelConfig = this.model
|
|
19766
19467
|
} = {}) {
|
|
19767
19468
|
if (!Array.isArray(modelConfig)) return this.resolveModelConfig(modelConfig, requestContext);
|
|
@@ -19793,7 +19494,7 @@ ${errorMessages}`,
|
|
|
19793
19494
|
* }
|
|
19794
19495
|
* ```
|
|
19795
19496
|
*/
|
|
19796
|
-
async getModelList(requestContext = new
|
|
19497
|
+
async getModelList(requestContext = new chunk5WBEMKE2_cjs.RequestContext()) {
|
|
19797
19498
|
if (!Array.isArray(this.model)) {
|
|
19798
19499
|
return null;
|
|
19799
19500
|
}
|
|
@@ -19824,6 +19525,19 @@ ${errorMessages}`,
|
|
|
19824
19525
|
this.model = Array.isArray(this.#originalModel) ? [...this.#originalModel] : this.#originalModel;
|
|
19825
19526
|
this.logger.debug(`[Agents:${this.name}] Model reset to original.`, { model: this.model, name: this.name });
|
|
19826
19527
|
}
|
|
19528
|
+
/**
|
|
19529
|
+
* Returns a snapshot of the raw field values that may be overridden by stored config.
|
|
19530
|
+
* Used by the editor to save/restore code defaults externally.
|
|
19531
|
+
* @internal
|
|
19532
|
+
*/
|
|
19533
|
+
__getOverridableFields() {
|
|
19534
|
+
return {
|
|
19535
|
+
instructions: this.#instructions,
|
|
19536
|
+
model: this.model,
|
|
19537
|
+
tools: this.#tools,
|
|
19538
|
+
workspace: this.#workspace
|
|
19539
|
+
};
|
|
19540
|
+
}
|
|
19827
19541
|
reorderModels(modelIds) {
|
|
19828
19542
|
if (!Array.isArray(this.model)) {
|
|
19829
19543
|
this.logger.warn(`[Agents:${this.name}] model is not an array`);
|
|
@@ -19937,14 +19651,14 @@ ${errorMessages}`,
|
|
|
19937
19651
|
}
|
|
19938
19652
|
async generateTitleFromUserMessage({
|
|
19939
19653
|
message,
|
|
19940
|
-
requestContext = new
|
|
19654
|
+
requestContext = new chunk5WBEMKE2_cjs.RequestContext(),
|
|
19941
19655
|
model,
|
|
19942
19656
|
instructions,
|
|
19943
19657
|
...rest
|
|
19944
19658
|
}) {
|
|
19945
19659
|
const observabilityContext = chunk4UOWNFAL_cjs.resolveObservabilityContext(rest);
|
|
19946
19660
|
const llm = await this.getLLM({ requestContext, model });
|
|
19947
|
-
const normMessage = new
|
|
19661
|
+
const normMessage = new chunkYZMSJKAK_cjs.MessageList().add(message, "user").get.all.aiV5.ui().at(-1);
|
|
19948
19662
|
if (!normMessage) {
|
|
19949
19663
|
throw new Error(`Could not generate title from input ${JSON.stringify(message)}`);
|
|
19950
19664
|
}
|
|
@@ -19967,7 +19681,7 @@ ${errorMessages}`,
|
|
|
19967
19681
|
const systemInstructions = await this.resolveTitleInstructions(requestContext, instructions);
|
|
19968
19682
|
let text = "";
|
|
19969
19683
|
if (isSupportedLanguageModel(llm.getModel())) {
|
|
19970
|
-
const messageList = new
|
|
19684
|
+
const messageList = new chunkYZMSJKAK_cjs.MessageList().add(
|
|
19971
19685
|
[
|
|
19972
19686
|
{
|
|
19973
19687
|
role: "system",
|
|
@@ -20020,7 +19734,7 @@ ${errorMessages}`,
|
|
|
20020
19734
|
async genTitle(userMessage, requestContext, observabilityContext, model, instructions) {
|
|
20021
19735
|
try {
|
|
20022
19736
|
if (userMessage) {
|
|
20023
|
-
const normMessage = new
|
|
19737
|
+
const normMessage = new chunkYZMSJKAK_cjs.MessageList().add(userMessage, "user").get.all.ui().at(-1);
|
|
20024
19738
|
if (normMessage) {
|
|
20025
19739
|
return await this.generateTitleFromUserMessage({
|
|
20026
19740
|
message: normMessage,
|
|
@@ -20101,7 +19815,7 @@ ${errorMessages}`,
|
|
|
20101
19815
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20102
19816
|
requireApproval: toolObj.requireApproval
|
|
20103
19817
|
};
|
|
20104
|
-
const convertedToCoreTool =
|
|
19818
|
+
const convertedToCoreTool = chunkGCRPNAAR_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20105
19819
|
convertedMemoryTools[toolName] = convertedToCoreTool;
|
|
20106
19820
|
}
|
|
20107
19821
|
}
|
|
@@ -20130,7 +19844,7 @@ ${errorMessages}`,
|
|
|
20130
19844
|
if (!workspace) {
|
|
20131
19845
|
return convertedWorkspaceTools;
|
|
20132
19846
|
}
|
|
20133
|
-
const workspaceTools =
|
|
19847
|
+
const workspaceTools = chunkMEMYFFOL_cjs.createWorkspaceTools(workspace);
|
|
20134
19848
|
if (Object.keys(workspaceTools).length > 0) {
|
|
20135
19849
|
this.logger.debug(`[Agent:${this.name}] - Adding workspace tools: ${Object.keys(workspaceTools).join(", ")}`, {
|
|
20136
19850
|
runId
|
|
@@ -20151,12 +19865,65 @@ ${errorMessages}`,
|
|
|
20151
19865
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20152
19866
|
requireApproval: toolObj.requireApproval
|
|
20153
19867
|
};
|
|
20154
|
-
const convertedToCoreTool =
|
|
19868
|
+
const convertedToCoreTool = chunkGCRPNAAR_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20155
19869
|
convertedWorkspaceTools[toolName] = convertedToCoreTool;
|
|
20156
19870
|
}
|
|
20157
19871
|
}
|
|
20158
19872
|
return convertedWorkspaceTools;
|
|
20159
19873
|
}
|
|
19874
|
+
/**
|
|
19875
|
+
* Returns skill tools (skill, skill_search, skill_read) when the workspace
|
|
19876
|
+
* has skills configured. These are added at the Agent level (like workspace
|
|
19877
|
+
* tools) rather than inside a processor, so they persist across turns and
|
|
19878
|
+
* survive serialization across tool-approval pauses.
|
|
19879
|
+
* @internal
|
|
19880
|
+
*/
|
|
19881
|
+
async listSkillTools({
|
|
19882
|
+
runId,
|
|
19883
|
+
resourceId,
|
|
19884
|
+
threadId,
|
|
19885
|
+
requestContext,
|
|
19886
|
+
mastraProxy,
|
|
19887
|
+
autoResumeSuspendedTools,
|
|
19888
|
+
...rest
|
|
19889
|
+
}) {
|
|
19890
|
+
const observabilityContext = chunk4UOWNFAL_cjs.resolveObservabilityContext(rest);
|
|
19891
|
+
let convertedSkillTools = {};
|
|
19892
|
+
if (this._agentNetworkAppend) {
|
|
19893
|
+
return convertedSkillTools;
|
|
19894
|
+
}
|
|
19895
|
+
const workspace = await this.getWorkspace({ requestContext });
|
|
19896
|
+
if (!workspace?.skills) {
|
|
19897
|
+
return convertedSkillTools;
|
|
19898
|
+
}
|
|
19899
|
+
const skillTools = chunkMEMYFFOL_cjs.createSkillTools(workspace.skills);
|
|
19900
|
+
if (Object.keys(skillTools).length > 0) {
|
|
19901
|
+
this.logger.debug(`[Agent:${this.name}] - Adding skill tools: ${Object.keys(skillTools).join(", ")}`, {
|
|
19902
|
+
runId
|
|
19903
|
+
});
|
|
19904
|
+
for (const [toolName, tool2] of Object.entries(skillTools)) {
|
|
19905
|
+
const toolObj = tool2;
|
|
19906
|
+
const options = {
|
|
19907
|
+
name: toolName,
|
|
19908
|
+
runId,
|
|
19909
|
+
threadId,
|
|
19910
|
+
resourceId,
|
|
19911
|
+
logger: this.logger,
|
|
19912
|
+
mastra: mastraProxy,
|
|
19913
|
+
agentName: this.name,
|
|
19914
|
+
requestContext,
|
|
19915
|
+
...observabilityContext,
|
|
19916
|
+
model: await this.getModel({ requestContext }),
|
|
19917
|
+
tracingPolicy: this.#options?.tracingPolicy,
|
|
19918
|
+
requireApproval: false
|
|
19919
|
+
// Skill tools never require approval
|
|
19920
|
+
};
|
|
19921
|
+
const convertedToCoreTool = chunkGCRPNAAR_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
19922
|
+
convertedSkillTools[toolName] = convertedToCoreTool;
|
|
19923
|
+
}
|
|
19924
|
+
}
|
|
19925
|
+
return convertedSkillTools;
|
|
19926
|
+
}
|
|
20160
19927
|
/**
|
|
20161
19928
|
* Executes input processors on the message list before LLM processing.
|
|
20162
19929
|
* @internal
|
|
@@ -20364,7 +20131,7 @@ ${errorMessages}`,
|
|
|
20364
20131
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20365
20132
|
requireApproval: tool2.requireApproval
|
|
20366
20133
|
};
|
|
20367
|
-
return [k,
|
|
20134
|
+
return [k, chunkGCRPNAAR_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
|
|
20368
20135
|
})
|
|
20369
20136
|
);
|
|
20370
20137
|
const assignedToolEntriesConverted = Object.fromEntries(
|
|
@@ -20415,7 +20182,7 @@ ${errorMessages}`,
|
|
|
20415
20182
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20416
20183
|
requireApproval: toolObj.requireApproval
|
|
20417
20184
|
};
|
|
20418
|
-
const convertedToCoreTool =
|
|
20185
|
+
const convertedToCoreTool = chunkGCRPNAAR_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
|
|
20419
20186
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
20420
20187
|
}
|
|
20421
20188
|
}
|
|
@@ -20461,7 +20228,7 @@ ${errorMessages}`,
|
|
|
20461
20228
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20462
20229
|
requireApproval: tool2.requireApproval
|
|
20463
20230
|
};
|
|
20464
|
-
const convertedToCoreTool =
|
|
20231
|
+
const convertedToCoreTool = chunkGCRPNAAR_cjs.makeCoreTool(toolRest, options, "client-tool", autoResumeSuspendedTools);
|
|
20465
20232
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
20466
20233
|
}
|
|
20467
20234
|
}
|
|
@@ -20504,7 +20271,7 @@ ${errorMessages}`,
|
|
|
20504
20271
|
subAgentResourceId: z10.z.string().describe("The resource ID of the agent").optional()
|
|
20505
20272
|
});
|
|
20506
20273
|
const modelVersion = (await agent.getModel({ requestContext })).specificationVersion;
|
|
20507
|
-
const toolObj =
|
|
20274
|
+
const toolObj = chunkM26GEN4C_cjs.createTool({
|
|
20508
20275
|
id: `agent-${agentName}`,
|
|
20509
20276
|
description: agent.getDescription() || `Agent: ${agentName}`,
|
|
20510
20277
|
inputSchema: agentInputSchema,
|
|
@@ -21063,7 +20830,7 @@ ${effectiveInstructions}`;
|
|
|
21063
20830
|
...observabilityContext,
|
|
21064
20831
|
tracingPolicy: this.#options?.tracingPolicy
|
|
21065
20832
|
};
|
|
21066
|
-
convertedAgentTools[`agent-${agentName}`] =
|
|
20833
|
+
convertedAgentTools[`agent-${agentName}`] = chunkGCRPNAAR_cjs.makeCoreTool(
|
|
21067
20834
|
toolObj,
|
|
21068
20835
|
options,
|
|
21069
20836
|
void 0,
|
|
@@ -21096,7 +20863,7 @@ ${effectiveInstructions}`;
|
|
|
21096
20863
|
inputData: workflow.inputSchema ?? z10.z.object({}).passthrough(),
|
|
21097
20864
|
...workflow.stateSchema ? { initialState: workflow.stateSchema } : {}
|
|
21098
20865
|
});
|
|
21099
|
-
const toolObj =
|
|
20866
|
+
const toolObj = chunkM26GEN4C_cjs.createTool({
|
|
21100
20867
|
id: `workflow-${workflowName}`,
|
|
21101
20868
|
description: workflow.description || `Workflow: ${workflowName}`,
|
|
21102
20869
|
inputSchema: extendedInputSchema,
|
|
@@ -21257,7 +21024,7 @@ ${effectiveInstructions}`;
|
|
|
21257
21024
|
...observabilityContext,
|
|
21258
21025
|
tracingPolicy: this.#options?.tracingPolicy
|
|
21259
21026
|
};
|
|
21260
|
-
convertedWorkflowTools[`workflow-${workflowName}`] =
|
|
21027
|
+
convertedWorkflowTools[`workflow-${workflowName}`] = chunkGCRPNAAR_cjs.makeCoreTool(
|
|
21261
21028
|
toolObj,
|
|
21262
21029
|
options,
|
|
21263
21030
|
void 0,
|
|
@@ -21289,7 +21056,7 @@ ${effectiveInstructions}`;
|
|
|
21289
21056
|
let mastraProxy = void 0;
|
|
21290
21057
|
const logger = this.logger;
|
|
21291
21058
|
if (this.#mastra) {
|
|
21292
|
-
mastraProxy =
|
|
21059
|
+
mastraProxy = chunkGCRPNAAR_cjs.createMastraProxy({ mastra: this.#mastra, logger });
|
|
21293
21060
|
}
|
|
21294
21061
|
const assignedTools = await this.listAssignedTools({
|
|
21295
21062
|
runId,
|
|
@@ -21359,6 +21126,15 @@ ${effectiveInstructions}`;
|
|
|
21359
21126
|
mastraProxy,
|
|
21360
21127
|
autoResumeSuspendedTools
|
|
21361
21128
|
});
|
|
21129
|
+
const skillTools = await this.listSkillTools({
|
|
21130
|
+
runId,
|
|
21131
|
+
resourceId,
|
|
21132
|
+
threadId,
|
|
21133
|
+
requestContext,
|
|
21134
|
+
...observabilityContext,
|
|
21135
|
+
mastraProxy,
|
|
21136
|
+
autoResumeSuspendedTools
|
|
21137
|
+
});
|
|
21362
21138
|
const allTools = {
|
|
21363
21139
|
...assignedTools,
|
|
21364
21140
|
...memoryTools,
|
|
@@ -21366,7 +21142,8 @@ ${effectiveInstructions}`;
|
|
|
21366
21142
|
...clientSideTools,
|
|
21367
21143
|
...agentTools,
|
|
21368
21144
|
...workflowTools,
|
|
21369
|
-
...workspaceTools
|
|
21145
|
+
...workspaceTools,
|
|
21146
|
+
...skillTools
|
|
21370
21147
|
};
|
|
21371
21148
|
return this.formatTools(allTools);
|
|
21372
21149
|
}
|
|
@@ -21541,7 +21318,7 @@ ${effectiveInstructions}`;
|
|
|
21541
21318
|
throw mastraError;
|
|
21542
21319
|
}
|
|
21543
21320
|
let headers;
|
|
21544
|
-
if (resolvedModel instanceof
|
|
21321
|
+
if (resolvedModel instanceof chunkPP4G2TZZ_cjs.ModelRouterLanguageModel) {
|
|
21545
21322
|
headers = resolvedModel.config?.headers;
|
|
21546
21323
|
}
|
|
21547
21324
|
return [
|
|
@@ -21587,7 +21364,7 @@ ${effectiveInstructions}`;
|
|
|
21587
21364
|
throw mastraError;
|
|
21588
21365
|
}
|
|
21589
21366
|
let headers;
|
|
21590
|
-
if (model2 instanceof
|
|
21367
|
+
if (model2 instanceof chunkPP4G2TZZ_cjs.ModelRouterLanguageModel) {
|
|
21591
21368
|
headers = model2.config?.headers;
|
|
21592
21369
|
}
|
|
21593
21370
|
return {
|
|
@@ -21617,9 +21394,9 @@ ${effectiveInstructions}`;
|
|
|
21617
21394
|
}
|
|
21618
21395
|
}
|
|
21619
21396
|
}
|
|
21620
|
-
const requestContext = options.requestContext || new
|
|
21621
|
-
const resourceIdFromContext = requestContext.get(
|
|
21622
|
-
const threadIdFromContext = requestContext.get(
|
|
21397
|
+
const requestContext = options.requestContext || new chunk5WBEMKE2_cjs.RequestContext();
|
|
21398
|
+
const resourceIdFromContext = requestContext.get(chunk5WBEMKE2_cjs.MASTRA_RESOURCE_ID_KEY);
|
|
21399
|
+
const threadIdFromContext = requestContext.get(chunk5WBEMKE2_cjs.MASTRA_THREAD_ID_KEY);
|
|
21623
21400
|
const threadFromArgs = threadIdFromContext ? { id: threadIdFromContext } : resolveThreadIdFromArgs({
|
|
21624
21401
|
memory: {
|
|
21625
21402
|
...options.memory,
|
|
@@ -21645,7 +21422,7 @@ ${effectiveInstructions}`;
|
|
|
21645
21422
|
const targetProvider = structuredOutputModel.provider;
|
|
21646
21423
|
const targetModelId = structuredOutputModel.modelId;
|
|
21647
21424
|
if (targetProvider.includes("openai") || targetModelId.includes("openai")) {
|
|
21648
|
-
if (
|
|
21425
|
+
if (chunkGCRPNAAR_cjs.isZodType(options.structuredOutput.schema) && targetModelId) {
|
|
21649
21426
|
const modelInfo = {
|
|
21650
21427
|
provider: targetProvider,
|
|
21651
21428
|
modelId: targetModelId,
|
|
@@ -21914,7 +21691,7 @@ ${effectiveInstructions}`;
|
|
|
21914
21691
|
});
|
|
21915
21692
|
}
|
|
21916
21693
|
async network(messages, options) {
|
|
21917
|
-
const requestContextToUse = options?.requestContext || new
|
|
21694
|
+
const requestContextToUse = options?.requestContext || new chunk5WBEMKE2_cjs.RequestContext();
|
|
21918
21695
|
const defaultNetworkOptions = await this.getDefaultNetworkOptions({ requestContext: requestContextToUse });
|
|
21919
21696
|
const mergedOptions = {
|
|
21920
21697
|
...defaultNetworkOptions,
|
|
@@ -21924,8 +21701,8 @@ ${effectiveInstructions}`;
|
|
|
21924
21701
|
completion: { ...defaultNetworkOptions?.completion, ...options?.completion }
|
|
21925
21702
|
};
|
|
21926
21703
|
const runId = mergedOptions?.runId || this.#mastra?.generateId() || crypto2.randomUUID();
|
|
21927
|
-
const resourceIdFromContext = requestContextToUse.get(
|
|
21928
|
-
const threadIdFromContext = requestContextToUse.get(
|
|
21704
|
+
const resourceIdFromContext = requestContextToUse.get(chunk5WBEMKE2_cjs.MASTRA_RESOURCE_ID_KEY);
|
|
21705
|
+
const threadIdFromContext = requestContextToUse.get(chunk5WBEMKE2_cjs.MASTRA_THREAD_ID_KEY);
|
|
21929
21706
|
const threadId = threadIdFromContext || (typeof mergedOptions?.memory?.thread === "string" ? mergedOptions?.memory?.thread : mergedOptions?.memory?.thread?.id);
|
|
21930
21707
|
const resourceId = resourceIdFromContext || mergedOptions?.memory?.resource;
|
|
21931
21708
|
return await networkLoop({
|
|
@@ -21978,7 +21755,7 @@ ${effectiveInstructions}`;
|
|
|
21978
21755
|
*/
|
|
21979
21756
|
async resumeNetwork(resumeData, options) {
|
|
21980
21757
|
const runId = options.runId;
|
|
21981
|
-
const requestContextToUse = options?.requestContext || new
|
|
21758
|
+
const requestContextToUse = options?.requestContext || new chunk5WBEMKE2_cjs.RequestContext();
|
|
21982
21759
|
const defaultNetworkOptions = await this.getDefaultNetworkOptions({ requestContext: requestContextToUse });
|
|
21983
21760
|
const mergedOptions = {
|
|
21984
21761
|
...defaultNetworkOptions,
|
|
@@ -21987,8 +21764,8 @@ ${effectiveInstructions}`;
|
|
|
21987
21764
|
routing: { ...defaultNetworkOptions?.routing, ...options?.routing },
|
|
21988
21765
|
completion: { ...defaultNetworkOptions?.completion, ...options?.completion }
|
|
21989
21766
|
};
|
|
21990
|
-
const resourceIdFromContext = requestContextToUse.get(
|
|
21991
|
-
const threadIdFromContext = requestContextToUse.get(
|
|
21767
|
+
const resourceIdFromContext = requestContextToUse.get(chunk5WBEMKE2_cjs.MASTRA_RESOURCE_ID_KEY);
|
|
21768
|
+
const threadIdFromContext = requestContextToUse.get(chunk5WBEMKE2_cjs.MASTRA_THREAD_ID_KEY);
|
|
21992
21769
|
const threadId = threadIdFromContext || (typeof mergedOptions?.memory?.thread === "string" ? mergedOptions?.memory?.thread : mergedOptions?.memory?.thread?.id);
|
|
21993
21770
|
const resourceId = resourceIdFromContext || mergedOptions?.memory?.resource;
|
|
21994
21771
|
return await networkLoop({
|
|
@@ -22058,7 +21835,7 @@ ${effectiveInstructions}`;
|
|
|
22058
21835
|
const defaultOptions = await this.getDefaultOptions({
|
|
22059
21836
|
requestContext: options?.requestContext
|
|
22060
21837
|
});
|
|
22061
|
-
const mergedOptions =
|
|
21838
|
+
const mergedOptions = chunkGCRPNAAR_cjs.deepMerge(
|
|
22062
21839
|
defaultOptions,
|
|
22063
21840
|
options ?? {}
|
|
22064
21841
|
);
|
|
@@ -22112,7 +21889,7 @@ ${effectiveInstructions}`;
|
|
|
22112
21889
|
}
|
|
22113
21890
|
const fullOutput = await result.result.getFullOutput();
|
|
22114
21891
|
const error = fullOutput.error;
|
|
22115
|
-
if (
|
|
21892
|
+
if (error) {
|
|
22116
21893
|
throw error;
|
|
22117
21894
|
}
|
|
22118
21895
|
return fullOutput;
|
|
@@ -22122,7 +21899,7 @@ ${effectiveInstructions}`;
|
|
|
22122
21899
|
const defaultOptions = await this.getDefaultOptions({
|
|
22123
21900
|
requestContext: streamOptions?.requestContext
|
|
22124
21901
|
});
|
|
22125
|
-
const mergedOptions =
|
|
21902
|
+
const mergedOptions = chunkGCRPNAAR_cjs.deepMerge(
|
|
22126
21903
|
defaultOptions,
|
|
22127
21904
|
streamOptions ?? {}
|
|
22128
21905
|
);
|
|
@@ -22180,7 +21957,7 @@ ${effectiveInstructions}`;
|
|
|
22180
21957
|
const defaultOptions = await this.getDefaultOptions({
|
|
22181
21958
|
requestContext: streamOptions?.requestContext
|
|
22182
21959
|
});
|
|
22183
|
-
let mergedStreamOptions =
|
|
21960
|
+
let mergedStreamOptions = chunkGCRPNAAR_cjs.deepMerge(
|
|
22184
21961
|
defaultOptions,
|
|
22185
21962
|
streamOptions ?? {}
|
|
22186
21963
|
);
|
|
@@ -22254,7 +22031,7 @@ ${effectiveInstructions}`;
|
|
|
22254
22031
|
const defaultOptions = await this.getDefaultOptions({
|
|
22255
22032
|
requestContext: options?.requestContext
|
|
22256
22033
|
});
|
|
22257
|
-
const mergedOptions =
|
|
22034
|
+
const mergedOptions = chunkGCRPNAAR_cjs.deepMerge(
|
|
22258
22035
|
defaultOptions,
|
|
22259
22036
|
options ?? {}
|
|
22260
22037
|
);
|
|
@@ -22316,7 +22093,7 @@ ${effectiveInstructions}`;
|
|
|
22316
22093
|
}
|
|
22317
22094
|
const fullOutput = await result.result.getFullOutput();
|
|
22318
22095
|
const error = fullOutput.error;
|
|
22319
|
-
if (
|
|
22096
|
+
if (error) {
|
|
22320
22097
|
throw error;
|
|
22321
22098
|
}
|
|
22322
22099
|
return fullOutput;
|
|
@@ -24468,7 +24245,7 @@ var ToolSearchProcessor = class {
|
|
|
24468
24245
|
minScore: options.search?.minScore ?? 0
|
|
24469
24246
|
};
|
|
24470
24247
|
this.ttl = options.ttl ?? 36e5;
|
|
24471
|
-
this.bm25Index = new
|
|
24248
|
+
this.bm25Index = new chunkMEMYFFOL_cjs.BM25Index({}, TOOL_SEARCH_TOKENIZE_OPTIONS);
|
|
24472
24249
|
this.indexTools();
|
|
24473
24250
|
if (this.ttl > 0) {
|
|
24474
24251
|
this.scheduleCleanup();
|
|
@@ -24478,7 +24255,7 @@ var ToolSearchProcessor = class {
|
|
|
24478
24255
|
* Get the thread ID from the request context, or use 'default' as fallback.
|
|
24479
24256
|
*/
|
|
24480
24257
|
getThreadId(args) {
|
|
24481
|
-
return args.requestContext?.get(
|
|
24258
|
+
return args.requestContext?.get(chunk5WBEMKE2_cjs.MASTRA_THREAD_ID_KEY) || "default";
|
|
24482
24259
|
}
|
|
24483
24260
|
/**
|
|
24484
24261
|
* Get the set of loaded tool names for the current thread.
|
|
@@ -24633,7 +24410,7 @@ var ToolSearchProcessor = class {
|
|
|
24633
24410
|
messageList.addSystem(
|
|
24634
24411
|
"To discover available tools, call search_tools with a keyword query. To add a tool to the conversation, call load_tool with the tool name. Tools must be loaded before they can be used."
|
|
24635
24412
|
);
|
|
24636
|
-
const searchTool =
|
|
24413
|
+
const searchTool = chunkM26GEN4C_cjs.createTool({
|
|
24637
24414
|
id: "search_tools",
|
|
24638
24415
|
description: "Search for available tools by keyword. Use this when you need a capability you don't currently have. Returns a list of matching tools with their names and descriptions. After finding a useful tool, use load_tool to make it available.",
|
|
24639
24416
|
inputSchema: z10.z.object({
|
|
@@ -24663,7 +24440,7 @@ var ToolSearchProcessor = class {
|
|
|
24663
24440
|
};
|
|
24664
24441
|
}
|
|
24665
24442
|
});
|
|
24666
|
-
const loadTool =
|
|
24443
|
+
const loadTool = chunkM26GEN4C_cjs.createTool({
|
|
24667
24444
|
id: "load_tool",
|
|
24668
24445
|
description: "Load a specific tool into your context. Call this after finding a tool with search_tools. Once loaded, the tool will be available for use. Args: toolName - The exact name of the tool to load (from search results).",
|
|
24669
24446
|
inputSchema: z10.z.object({
|
|
@@ -25216,7 +24993,7 @@ var SemanticRecall = class {
|
|
|
25216
24993
|
*/
|
|
25217
24994
|
formatCrossThreadMessages(messages, currentThreadId) {
|
|
25218
24995
|
let result = ``;
|
|
25219
|
-
const v1Messages = new
|
|
24996
|
+
const v1Messages = new chunkYZMSJKAK_cjs.MessageList().add(messages, "memory").get.all.v1();
|
|
25220
24997
|
let lastYmd = null;
|
|
25221
24998
|
for (const msg of v1Messages) {
|
|
25222
24999
|
const date = msg.createdAt;
|
|
@@ -25658,7 +25435,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
25658
25435
|
);
|
|
25659
25436
|
}
|
|
25660
25437
|
if (typeof config.embedder === "string") {
|
|
25661
|
-
this.embedder = new
|
|
25438
|
+
this.embedder = new chunkPP4G2TZZ_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
25662
25439
|
} else {
|
|
25663
25440
|
this.embedder = config.embedder;
|
|
25664
25441
|
}
|
|
@@ -25697,7 +25474,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
25697
25474
|
}
|
|
25698
25475
|
setEmbedder(embedder, embedderOptions) {
|
|
25699
25476
|
if (typeof embedder === "string") {
|
|
25700
|
-
this.embedder = new
|
|
25477
|
+
this.embedder = new chunkPP4G2TZZ_cjs.ModelRouterEmbeddingModel(embedder);
|
|
25701
25478
|
} else {
|
|
25702
25479
|
this.embedder = embedder;
|
|
25703
25480
|
}
|
|
@@ -25793,7 +25570,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
25793
25570
|
"The threads.generateTitle option has been moved. Use the top-level generateTitle option instead."
|
|
25794
25571
|
);
|
|
25795
25572
|
}
|
|
25796
|
-
const mergedConfig =
|
|
25573
|
+
const mergedConfig = chunkGCRPNAAR_cjs.deepMerge(this.threadConfig, config || {});
|
|
25797
25574
|
if (typeof config?.workingMemory === "object" && config.workingMemory?.schema && typeof mergedConfig.workingMemory === "object") {
|
|
25798
25575
|
mergedConfig.workingMemory.schema = config.workingMemory.schema;
|
|
25799
25576
|
}
|
|
@@ -26143,7 +25920,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
26143
25920
|
} = {}) {
|
|
26144
25921
|
super({
|
|
26145
25922
|
name: "mock",
|
|
26146
|
-
storage: storage || new
|
|
25923
|
+
storage: storage || new chunk7AHCLTZZ_cjs.InMemoryStore(),
|
|
26147
25924
|
options: {
|
|
26148
25925
|
workingMemory: enableWorkingMemory ? { enabled: true, template: workingMemoryTemplate } : void 0,
|
|
26149
25926
|
lastMessages: enableMessageHistory ? 10 : void 0
|
|
@@ -26221,7 +25998,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
26221
25998
|
return {};
|
|
26222
25999
|
}
|
|
26223
26000
|
return {
|
|
26224
|
-
updateWorkingMemory:
|
|
26001
|
+
updateWorkingMemory: chunkM26GEN4C_cjs.createTool({
|
|
26225
26002
|
id: "update-working-memory",
|
|
26226
26003
|
description: `Update the working memory with new information. Any data not included will be overwritten.`,
|
|
26227
26004
|
inputSchema: z10__default.default.object({ memory: z10__default.default.string() }),
|
|
@@ -26453,5 +26230,5 @@ exports.validateStepRequestContext = validateStepRequestContext;
|
|
|
26453
26230
|
exports.validateStepResumeData = validateStepResumeData;
|
|
26454
26231
|
exports.validateStepStateData = validateStepStateData;
|
|
26455
26232
|
exports.validateStepSuspendData = validateStepSuspendData;
|
|
26456
|
-
//# sourceMappingURL=chunk-
|
|
26457
|
-
//# sourceMappingURL=chunk-
|
|
26233
|
+
//# sourceMappingURL=chunk-BCSVBOAN.cjs.map
|
|
26234
|
+
//# sourceMappingURL=chunk-BCSVBOAN.cjs.map
|