@mastra/core 1.87.0-alpha.1 → 1.87.0-alpha.10
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/dist/_types/@ai-sdk_openai@4.0.106/dist/index.d.ts +2034 -0
- package/dist/_types/@ai-sdk_openai@4.0.106/package.json +1 -0
- package/dist/a2a/index.cjs +1 -1
- package/dist/a2a/index.js +1 -1
- package/dist/agent/agent.d.ts +3 -1
- package/dist/agent/durable/index.cjs +1 -1
- package/dist/agent/durable/index.js +1 -1
- package/dist/agent/durable/run-message-refs.d.ts +3 -2
- package/dist/agent/index.cjs +5 -4
- package/dist/agent/index.d.ts +2 -0
- package/dist/agent/index.js +5 -5
- package/dist/agent/merge-persona.d.ts +15 -0
- package/dist/agent/message-list/adapters/AIV5Adapter.d.ts +15 -1
- package/dist/agent/message-list/index.cjs +2 -2
- package/dist/agent/message-list/index.js +2 -2
- package/dist/agent/message-list/state/types.d.ts +5 -1
- package/dist/agent/message-list/types.d.ts +1 -1
- package/dist/agent/message-list/utils/provider-compat.d.ts +9 -1
- package/dist/agent-builder/ee/index.cjs +1 -1
- package/dist/agent-builder/ee/index.js +1 -1
- package/dist/agent-controller/agent-controller.d.ts +6 -0
- package/dist/agent-controller/index.cjs +2 -2
- package/dist/agent-controller/index.js +2 -2
- package/dist/agent-controller/worker-run-binding.d.ts +15 -0
- package/dist/{agent-controller-C1bK0CXm.js → agent-controller--gKWI81G.js} +50 -8
- package/dist/{agent-controller-BTIxiD1u.cjs → agent-controller-BolLBwDm.cjs} +50 -8
- package/dist/background-tasks/index.cjs +2 -1
- package/dist/background-tasks/index.d.ts +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/background-tasks/resolve-config.d.ts +30 -1
- package/dist/background-tasks/system-prompt.d.ts +8 -2
- package/dist/background-tasks/types.d.ts +47 -1
- package/dist/{background-tasks-BbVsBghi.js → background-tasks-CgzXjBfE.js} +156 -33
- package/dist/{background-tasks-CVl6e0Jo.cjs → background-tasks-DYtlijQ1.cjs} +167 -32
- package/dist/browser/index.cjs +2 -2
- package/dist/browser/index.js +2 -2
- package/dist/{builder-BRJPSTig.cjs → builder-Dz-g-9CZ.cjs} +2 -2
- package/dist/{builder-C8XzrtBQ.js → builder-emNPaIaC.js} +2 -2
- package/dist/capabilities/302ai.json +202 -202
- package/dist/capabilities/abliteratedllm.json +39 -30
- package/dist/capabilities/abliteration-ai.json +9 -9
- package/dist/capabilities/above.json +20 -20
- package/dist/capabilities/adaption.json +16 -16
- package/dist/capabilities/adzuki.json +24 -24
- package/dist/capabilities/agentrouter.json +6 -6
- package/dist/capabilities/agnes.json +2 -2
- package/dist/capabilities/ai-router.json +9 -9
- package/dist/capabilities/aiand.json +25 -25
- package/dist/capabilities/aigrow.json +14 -14
- package/dist/capabilities/aimlapi.json +140 -143
- package/dist/capabilities/aixy.json +15 -15
- package/dist/capabilities/aki-io.json +16 -16
- package/dist/capabilities/alibaba-cn.json +98 -92
- package/dist/capabilities/alibaba-coding-plan-cn.json +4 -4
- package/dist/capabilities/alibaba-coding-plan.json +4 -4
- package/dist/capabilities/alibaba-token-plan-cn.json +54 -54
- package/dist/capabilities/alibaba-token-plan.json +54 -54
- package/dist/capabilities/alibaba.json +100 -66
- package/dist/capabilities/ambient.json +17 -10
- package/dist/capabilities/amd.json +9 -9
- package/dist/capabilities/anthropic.json +47 -47
- package/dist/capabilities/anyapi.json +13 -13
- package/dist/capabilities/apiko.json +5 -5
- package/dist/capabilities/arcee.json +6 -6
- package/dist/capabilities/augure.json +7 -7
- package/dist/capabilities/auriko.json +15 -15
- package/dist/capabilities/bailing.json +3 -3
- package/dist/capabilities/baseten.json +34 -34
- package/dist/capabilities/bee.json +4 -4
- package/dist/capabilities/berget.json +16 -3
- package/dist/capabilities/bothub.json +12 -12
- package/dist/capabilities/boundless.json +37 -37
- package/dist/capabilities/bumo.json +42 -42
- package/dist/capabilities/byteplus.json +27 -27
- package/dist/capabilities/cerebras.json +4 -4
- package/dist/capabilities/cheapaimodel.json +8 -8
- package/dist/capabilities/cheapest-token.json +31 -31
- package/dist/capabilities/chutes.json +10 -10
- package/dist/capabilities/claudinio.json +10 -1
- package/dist/capabilities/cline-pass.json +38 -38
- package/dist/capabilities/cloudcode.json +7 -14
- package/dist/capabilities/cloudflare-workers-ai.json +15 -15
- package/dist/capabilities/commandcode.json +124 -124
- package/dist/capabilities/concentrate.json +275 -292
- package/dist/capabilities/cortecs.json +107 -107
- package/dist/capabilities/crossmodel.json +180 -180
- package/dist/capabilities/crusoe.json +34 -5
- package/dist/capabilities/daoxe.json +8 -8
- package/dist/capabilities/databricks.json +127 -127
- package/dist/capabilities/deepinfra.json +102 -93
- package/dist/capabilities/deepseek.json +4 -4
- package/dist/capabilities/digitalocean.json +114 -114
- package/dist/capabilities/dothoosh.json +28 -28
- package/dist/capabilities/doubleword.json +25 -25
- package/dist/capabilities/edenai.json +283 -295
- package/dist/capabilities/empiriolabs.json +173 -173
- package/dist/capabilities/engy.json +18 -18
- package/dist/capabilities/entrim.json +2 -2
- package/dist/capabilities/evroc.json +14 -14
- package/dist/capabilities/ezkielyna.json +6 -6
- package/dist/capabilities/fastrouter.json +71 -71
- package/dist/capabilities/fireworks-ai.json +132 -71
- package/dist/capabilities/fortytwo.json +9 -3
- package/dist/capabilities/freemodel.json +12 -12
- package/dist/capabilities/friendli.json +8 -8
- package/dist/capabilities/frogbot.json +96 -96
- package/dist/capabilities/gisoo.json +18 -18
- package/dist/capabilities/gmicloud.json +22 -22
- package/dist/capabilities/google.json +54 -54
- package/dist/capabilities/graphn.json +16 -16
- package/dist/capabilities/greenpt.json +35 -35
- package/dist/capabilities/groq.json +2 -2
- package/dist/capabilities/helicone.json +78 -78
- package/dist/capabilities/hetzner.json +35 -3
- package/dist/capabilities/hopper.json +2 -2
- package/dist/capabilities/hostinger-router.json +14 -14
- package/dist/capabilities/hpc-ai.json +10 -10
- package/dist/capabilities/huawei-maas.json +15 -15
- package/dist/capabilities/hubris.json +29 -29
- package/dist/capabilities/huggingface.json +105 -155
- package/dist/capabilities/hyper.json +21 -29
- package/dist/capabilities/impossibl.json +144 -144
- package/dist/capabilities/inception.json +2 -2
- package/dist/capabilities/inceptron.json +6 -6
- package/dist/capabilities/inco.json +4 -4
- package/dist/capabilities/infer.json +20 -20
- package/dist/capabilities/inferall.json +11 -11
- package/dist/capabilities/inference-coop.json +12 -12
- package/dist/capabilities/inferenceapis.json +18 -18
- package/dist/capabilities/inferris.json +3 -3
- package/dist/capabilities/infersia.json +12 -12
- package/dist/capabilities/infomaniak.json +2 -2
- package/dist/capabilities/io-net.json +2 -2
- package/dist/capabilities/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +57 -57
- package/dist/capabilities/jad-ai.json +3 -3
- package/dist/capabilities/jalapeno.json +12 -12
- package/dist/capabilities/jiekou.json +63 -63
- package/dist/capabilities/jzstoken.json +52 -53
- package/dist/capabilities/keln.json +21 -21
- package/dist/capabilities/kenari.json +120 -128
- package/dist/capabilities/kilo.json +597 -601
- package/dist/capabilities/kimi-code-plan-cn.json +9 -9
- package/dist/capabilities/kimi-code-plan-global.json +9 -9
- package/dist/capabilities/kitani.json +6 -6
- package/dist/capabilities/klavo.json +18 -18
- package/dist/capabilities/korouter.json +35 -35
- package/dist/capabilities/kunavo.json +9 -9
- package/dist/capabilities/liquid.json +10 -10
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +959 -890
- package/dist/capabilities/llmgateway.json +344 -343
- package/dist/capabilities/llmtr.json +24 -24
- package/dist/capabilities/lowrouter.json +60 -60
- package/dist/capabilities/lyceum.json +18 -10
- package/dist/capabilities/melious.json +14 -14
- package/dist/capabilities/merge-gateway.json +266 -265
- package/dist/capabilities/meta.json +11 -11
- package/dist/capabilities/minimax-cn-coding-plan.json +2 -2
- package/dist/capabilities/minimax-cn.json +5 -5
- package/dist/capabilities/minimax-coding-plan.json +2 -2
- package/dist/capabilities/minimax.json +5 -5
- package/dist/capabilities/mistral.json +22 -22
- package/dist/capabilities/mixlayer.json +5 -5
- package/dist/capabilities/modal.json +7 -7
- package/dist/capabilities/model-oracle-ai.json +27 -27
- package/dist/capabilities/modelis.json +20 -20
- package/dist/capabilities/modular.json +25 -3
- package/dist/capabilities/moneo.json +6 -6
- package/dist/capabilities/moonshotai-cn.json +5 -5
- package/dist/capabilities/moonshotai.json +5 -5
- package/dist/capabilities/morph.json +16 -16
- package/dist/capabilities/munito-eu.json +8 -8
- package/dist/capabilities/munito.json +8 -8
- package/dist/capabilities/nan.json +25 -25
- package/dist/capabilities/nano-gpt.json +577 -564
- package/dist/capabilities/nearai.json +87 -87
- package/dist/capabilities/nebius.json +32 -32
- package/dist/capabilities/neon.json +123 -123
- package/dist/capabilities/neuralwatt.json +37 -37
- package/dist/capabilities/nokeep.json +5 -5
- package/dist/capabilities/novita-ai.json +144 -144
- package/dist/capabilities/nvidia.json +40 -23
- package/dist/capabilities/oathbreaker.json +24 -1
- package/dist/capabilities/obscurify.json +22 -22
- package/dist/capabilities/oci.json +8 -8
- package/dist/capabilities/ofox.json +306 -306
- package/dist/capabilities/ollama-cloud.json +61 -61
- package/dist/capabilities/openai.json +53 -53
- package/dist/capabilities/opencode-go.json +88 -88
- package/dist/capabilities/openreason.json +5 -5
- package/dist/capabilities/openrouter.json +507 -497
- package/dist/capabilities/opper.json +26 -26
- package/dist/capabilities/orcarouter.json +203 -203
- package/dist/capabilities/outerlabs.json +27 -27
- package/dist/capabilities/ovhcloud.json +21 -21
- package/dist/capabilities/pareto.json +5 -5
- package/dist/capabilities/perplexity-agent.json +61 -61
- package/dist/capabilities/perplexity.json +2 -2
- package/dist/capabilities/phala.json +27 -27
- package/dist/capabilities/pioneer.json +28 -28
- package/dist/capabilities/poe.json +123 -123
- package/dist/capabilities/poolside.json +3 -3
- package/dist/capabilities/powerspring.json +12 -12
- package/dist/capabilities/primalabs.json +7 -7
- package/dist/capabilities/prime.json +117 -107
- package/dist/capabilities/privatemode-ai.json +12 -12
- package/dist/capabilities/proxystacks.json +3 -3
- package/dist/capabilities/qiniu-ai.json +15 -15
- package/dist/capabilities/refuseless.json +8 -8
- package/dist/capabilities/regolo-ai.json +8 -8
- package/dist/capabilities/requesty.json +384 -169
- package/dist/capabilities/ruapi.json +36 -20
- package/dist/capabilities/runcrate.json +7 -7
- package/dist/capabilities/runinfra.json +10 -10
- package/dist/capabilities/sakana.json +5 -5
- package/dist/capabilities/sambanova.json +6 -6
- package/dist/capabilities/sandbase.json +24 -24
- package/dist/capabilities/sarvam.json +11 -11
- package/dist/capabilities/scaleway.json +19 -19
- package/dist/capabilities/scnet-token-plan.json +11 -11
- package/dist/capabilities/scx-ai.json +31 -31
- package/dist/capabilities/sensenova.json +14 -14
- package/dist/capabilities/siliconflow-cn.json +41 -41
- package/dist/capabilities/siliconflow.json +53 -53
- package/dist/capabilities/snowflake-cortex.json +18 -18
- package/dist/capabilities/sokkan.json +4 -4
- package/dist/capabilities/sparrowcodes.json +18 -18
- package/dist/capabilities/standardcompute.json +84 -84
- package/dist/capabilities/steadyrouter.json +41 -41
- package/dist/capabilities/stepfun-ai-step-plan.json +5 -5
- package/dist/capabilities/stepfun-ai.json +5 -5
- package/dist/capabilities/stepfun-step-plan.json +5 -5
- package/dist/capabilities/stepfun.json +5 -5
- package/dist/capabilities/stepping-stone.json +11 -11
- package/dist/capabilities/synthetic.json +14 -14
- package/dist/capabilities/synthorai.json +25 -25
- package/dist/capabilities/teamorouter.json +20 -20
- package/dist/capabilities/teapot-router.json +14 -14
- package/dist/capabilities/tencent-token-plan-intl.json +126 -0
- package/dist/capabilities/tencent-token-plan.json +36 -36
- package/dist/capabilities/tencent-tokenhub.json +54 -39
- package/dist/capabilities/tensorx.json +43 -43
- package/dist/capabilities/tenstorrent.json +6 -6
- package/dist/capabilities/the-grid-ai.json +28 -28
- package/dist/capabilities/thinkingmachines.json +73 -73
- package/dist/capabilities/tinfoil.json +10 -10
- package/dist/capabilities/toapis.json +3 -3
- package/dist/capabilities/togetherai.json +48 -48
- package/dist/capabilities/tokengo.json +17 -17
- package/dist/capabilities/tokenify.json +10 -10
- package/dist/capabilities/tokenwatt.json +10 -2
- package/dist/capabilities/trustedrouter.json +7 -7
- package/dist/capabilities/trustedtokens.json +13 -13
- package/dist/capabilities/umans-ai-coding-plan.json +14 -14
- package/dist/capabilities/umans-ai.json +12 -12
- package/dist/capabilities/uncensuredai.json +2 -2
- package/dist/capabilities/unrestricted.json +8 -8
- package/dist/capabilities/uplinkswitch.json +20 -20
- package/dist/capabilities/upstage.json +6 -6
- package/dist/capabilities/vancine.json +21 -21
- package/dist/capabilities/vercel.json +508 -505
- package/dist/capabilities/vivgrid.json +84 -75
- package/dist/capabilities/volcengine-coding-plan.json +28 -28
- package/dist/capabilities/volcengine.json +29 -28
- package/dist/capabilities/vultr.json +28 -28
- package/dist/capabilities/wafer.ai.json +17 -17
- package/dist/capabilities/wally.json +12 -12
- package/dist/capabilities/wandb.json +16 -16
- package/dist/capabilities/watt.json +21 -21
- package/dist/capabilities/xai.json +7 -7
- package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-cn.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
- package/dist/capabilities/xiaomi.json +2 -2
- package/dist/capabilities/xpersona.json +13 -13
- package/dist/capabilities/xxapi.json +26 -26
- package/dist/capabilities/zai-coding-plan.json +20 -20
- package/dist/capabilities/zai.json +34 -34
- package/dist/capabilities/zenifra.json +31 -31
- package/dist/capabilities/zenmux.json +178 -178
- package/dist/capabilities/zerogpu.json +12 -12
- package/dist/capabilities/zhipuai-coding-plan.json +8 -8
- package/dist/capabilities/zhipuai.json +30 -30
- package/dist/capabilities/zro.json +3 -3
- package/dist/channels/agent-channels.d.ts +22 -0
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/channels/output-processor.d.ts +12 -0
- package/dist/channels/state-adapter.d.ts +3 -1
- package/dist/channels/stream-helpers.d.ts +17 -0
- package/dist/{channels-Cl-pRrWB.cjs → channels-BVnDIsZS.cjs} +1 -1
- package/dist/{channels-DegTNzaq.js → channels-CndspFXP.js} +1 -1
- package/dist/coding-agent/index.cjs +2 -2
- package/dist/coding-agent/index.js +2 -2
- package/dist/{constants-B9ZDvXZ4.cjs → constants-Bou0hEgY.cjs} +4 -0
- package/dist/{constants-BmdTvEYN.js → constants-CFWgIaqA.js} +4 -0
- package/dist/datasets/experiment/scorer.d.ts +16 -5
- package/dist/datasets/index.cjs +2 -2
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +1070 -1055
- package/dist/docs/references/docs-agents-code-mode.md +36 -0
- package/dist/docs/references/docs-agents-networks.md +1 -1
- package/dist/docs/references/docs-agents-tools.md +6 -0
- package/dist/docs/references/docs-auth-simple-auth.md +8 -8
- package/dist/docs/references/docs-browser.md +3 -1
- package/dist/docs/references/docs-evals-custom-scorers.md +1 -1
- package/dist/docs/references/docs-harness-background-tasks.md +38 -0
- package/dist/docs/references/docs-knowledge-agents-and-tools.md +2 -0
- package/dist/docs/references/docs-mastra-platform-observability-overview.md +3 -189
- package/dist/docs/references/docs-memory-message-history.md +25 -0
- package/dist/docs/references/docs-sandbox-lsp.md +5 -6
- package/dist/docs/references/docs-sandbox-overview.md +20 -0
- package/dist/docs/references/docs-sandbox-skills.md +2 -0
- package/dist/docs/references/docs-signals-sending-signals.md +1 -1
- package/dist/docs/references/integrations.md +1 -0
- package/dist/docs/references/reference-agent-controller-session.md +1 -1
- package/dist/docs/references/reference-agents-generate.md +1 -1
- package/dist/docs/references/reference-agents-network.md +1 -1
- package/dist/docs/references/reference-configuration.md +8 -8
- package/dist/docs/references/reference-core-getWorkspaceById.md +37 -0
- package/dist/docs/references/reference-evals-create-scorer.md +5 -5
- package/dist/docs/references/reference-evals-run-evals.md +1 -1
- package/dist/docs/references/reference-knowledge-knowledge-tools.md +3 -3
- package/dist/docs/references/reference-manual-install.md +1 -1
- package/dist/docs/references/reference-memory-observational-memory.md +8 -0
- package/dist/docs/references/reference-observability-tracing-interfaces.md +10 -6
- package/dist/docs/references/reference-processors-processor-interface.md +3 -2
- package/dist/docs/references/reference-processors-system-prompt-scrubber.md +1 -1
- package/dist/docs/references/reference-processors-tool-search-processor.md +3 -3
- package/dist/docs/references/reference-pubsub-base.md +5 -3
- package/dist/docs/references/reference-pubsub-caching-pubsub.md +3 -1
- package/dist/docs/references/reference-storage-overview.md +1 -1
- package/dist/docs/references/reference-storage-retention.md +20 -20
- package/dist/docs/references/reference-tools-create-code-mode.md +22 -0
- package/dist/docs/references/reference-tools-vector-query-tool.md +8 -0
- package/dist/docs/references/reference-voice-overview.md +11 -26
- package/dist/docs/references/reference-voice-speech-to-speech.md +1 -1
- package/dist/docs/references/reference-voice-voice.listen.md +1 -0
- package/dist/docs/references/reference-voice-voice.speak.md +1 -3
- package/dist/docs/references/reference-workspace-factory-sandbox.md +6 -6
- package/dist/docs/references/reference-workspace-sandbox.md +14 -0
- package/dist/docs/references/reference.md +1 -0
- package/dist/evals/index.cjs +2 -2
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +2 -2
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.js +1 -1
- package/dist/harness/index.cjs +2 -2
- package/dist/harness/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/agent-scopes.d.ts +17 -0
- package/dist/knowledge/declarations.d.ts +2 -0
- package/dist/knowledge/held-scopes-state-processor.d.ts +50 -0
- package/dist/knowledge/importers/host.d.ts +7 -1
- package/dist/knowledge/importers/runner.d.ts +12 -0
- package/dist/knowledge/importers/types.d.ts +4 -0
- package/dist/knowledge/index.cjs +209 -38
- package/dist/knowledge/index.d.ts +12 -2
- package/dist/knowledge/index.js +208 -39
- package/dist/knowledge/page-tools.d.ts +23 -0
- package/dist/knowledge/pinned-state-processor.d.ts +2 -2
- package/dist/knowledge/run.d.ts +5 -0
- package/dist/knowledge/scope-runtime.d.ts +6 -0
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/base.types.d.ts +3 -1
- package/dist/llm/model/mastra-gateway-provider-tools.d.ts +9 -6
- package/dist/llm/model/model.d.ts +1 -1
- package/dist/llm/model/model.loop.d.ts +1 -1
- package/dist/llm/model/model.loop.types.d.ts +3 -1
- package/dist/llm/model/provider-options.d.ts +4 -3
- package/dist/llm/model/provider-types.generated.d.ts +7657 -7592
- package/dist/{llm-BKxlS9Kk.cjs → llm-B1semiTO.cjs} +38 -78
- package/dist/{llm-CMkzIFAk.js → llm-CytL7cpw.js} +38 -78
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/{manager-CasaT35Q.cjs → manager-BwyfS4ha.cjs} +106 -35
- package/dist/{manager-C-eQXmRq.js → manager-DnTzA9GL.js} +106 -35
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-5EEmN3Ok.js → mastra-DTkZPpch.js} +17 -17
- package/dist/{mastra-C7Tj4U8c.cjs → mastra-Dj35Lj_J.cjs} +17 -17
- package/dist/memory/index.cjs +3 -3
- package/dist/memory/index.js +3 -3
- package/dist/{message-list-wI71UGxk.js → message-list-BGm1DCiG.js} +230 -129
- package/dist/{message-list-DfN9mWeN.cjs → message-list-vR3uLAHL.cjs} +230 -129
- package/dist/{model-DCLUL-8a.js → model-DyQ07rPH.js} +4 -3
- package/dist/{model-9HA-W0tg.cjs → model-eDfetuno.cjs} +4 -3
- package/dist/{netlify-Cq3H-A9I.cjs → netlify-BC4v7Ufv.cjs} +41364 -30461
- package/dist/{netlify-DaWURNSU.js → netlify-BUvdxfHe.js} +41361 -30464
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/observability/types/tracing.d.ts +1 -1
- package/dist/processor-provider/index.cjs +1 -1
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +2 -2
- package/dist/processors/index.js +2 -2
- package/dist/processors/processors/tool-search.d.ts +2 -2
- package/dist/processors/runner.d.ts +12 -0
- package/dist/{provider-registry-a649fS5r.cjs → provider-registry-Bn01gq9y.cjs} +21872 -21660
- package/dist/{provider-registry-DWixjFX7.js → provider-registry-CP_5SNiw.js} +21873 -21661
- package/dist/provider-registry.json +22748 -22596
- package/dist/{registry-generator-BYJC7p8M.js → registry-generator-CDPyxbzt.js} +1 -1
- package/dist/{registry-generator-BuKC7UKd.cjs → registry-generator-CNFKGRFQ.cjs} +1 -1
- package/dist/{rehydrate-DPhmASM6.js → rehydrate-CnGNY2zq.js} +2 -2
- package/dist/{rehydrate-DR2_WAz2.cjs → rehydrate-DExpzlNS.cjs} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-D3X7XvUL.js → run-registry-BL_kKvFE.js} +724 -125
- package/dist/{run-registry-oUNF6szW.cjs → run-registry-CibQoN6K.cjs} +766 -125
- package/dist/storage/constants.cjs +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/knowledge/base.d.ts +16 -1
- package/dist/storage/domains/knowledge/importers-inmemory.d.ts +1 -0
- package/dist/storage/domains/knowledge/importers.d.ts +8 -0
- package/dist/storage/domains/knowledge/inmemory.d.ts +1 -0
- package/dist/storage/domains/knowledge/pages-inmemory.d.ts +5 -1
- package/dist/storage/index.cjs +3 -3
- package/dist/storage/index.js +3 -3
- package/dist/storage/types.d.ts +8 -0
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-DoZ6F41o.js → stream-1DGoEkG2.js} +37 -14
- package/dist/{stream-DQC1vpvl.cjs → stream-D_7tMaJe.cjs} +37 -14
- package/dist/test-utils/llm-mock.cjs +1 -1
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/{to-prompt-B9eZo2U5.cjs → to-prompt-CG-LyaBY.cjs} +9 -0
- package/dist/{to-prompt-BsDtVXrf.js → to-prompt-CMlVGYxC.js} +9 -0
- package/dist/tool-loop-agent/index.cjs +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/{tool-loop-agent-C9YkvDRd.js → tool-loop-agent-BXya_RYj.js} +4 -4
- package/dist/{tool-loop-agent-Cy4NDOMS.cjs → tool-loop-agent-CLB1r3X3.cjs} +4 -4
- package/dist/tools/code-mode/index.d.ts +2 -0
- package/dist/tools/code-mode/log-collector.d.ts +49 -0
- package/dist/tools/code-mode/types.d.ts +71 -0
- package/dist/tools/index.cjs +3 -1
- package/dist/tools/index.js +2 -2
- package/dist/{tools-CGF5Ik6j.cjs → tools-BEYxowf0.cjs} +429 -61
- package/dist/{tools-CDfyMpzN.js → tools-tPy2FwMI.js} +418 -62
- package/dist/{utils-Bs2IYyOb.cjs → utils-B-KOMA_Q.cjs} +7 -6
- package/dist/{utils-9JyiKu5r.js → utils-C55ZdVaj.js} +7 -6
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-8j0phWFV.js → validate-BDfYr72F.js} +1 -1
- package/dist/{validate-BE3mVxVy.cjs → validate-CmZhnsmX.cjs} +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +2 -2
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/worker/workers/orchestration-worker.d.ts +1 -0
- package/dist/{worker-BfWFqSH2.js → worker-BG1rw_dg.js} +5 -5
- package/dist/{worker-BiK1kfMa.cjs → worker-BoybIUTI.cjs} +10 -4
- package/dist/{worker-DIRdEwih.js → worker-CuK2RaC0.js} +2 -2
- package/dist/{worker-DwdgU6E9.cjs → worker-D2B-x7Le.cjs} +2 -2
- package/dist/{workflow-ni-keg2i.js → workflow-Bt09PcH1.js} +3 -3
- package/dist/{workflow-CxQMcTbT.cjs → workflow-CTKqeRXU.cjs} +3 -3
- package/dist/workflows/builder/index.cjs +1 -1
- package/dist/workflows/builder/index.js +1 -1
- package/dist/workflows/evented/index.cjs +1 -1
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +4 -4
- package/dist/workflows/index.js +4 -4
- package/dist/workflows/step.d.ts +2 -0
- package/dist/workflows/workflow.d.ts +2 -0
- package/dist/workspace/index.cjs +3 -1
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +2 -2
- package/dist/workspace/lsp/manager.d.ts +19 -4
- package/dist/workspace/sandbox/mastra-sandbox.d.ts +17 -0
- package/dist/workspace/sandbox/teardown-context.d.ts +74 -0
- package/dist/workspace/tools/index.d.ts +1 -0
- package/dist/workspace/tools/media.d.ts +20 -1
- package/dist/workspace/tools/recreate-sandbox.d.ts +24 -0
- package/dist/{workspace-X2RHJZU9.cjs → workspace-C8Zo5_qK.cjs} +387 -109
- package/dist/{workspace-DY2Nxiyi.js → workspace-DOAil8mG.js} +376 -110
- package/package.json +8 -8
- package/src/llm/model/provider-types.generated.d.ts +7657 -7592
|
@@ -4,18 +4,18 @@ import { t as MastraBase } from "./base-CKLWBhDo.js";
|
|
|
4
4
|
import { A as compactStopReasonContext, D as agentLoopTermination, O as executionFailureTermination, S as resolveObservabilityContext, b as wrapMastra, i as subtractReportedUsage, k as tripwireTermination, n as extractUsageMetrics, r as isUsageIncomplete, t as calculateObservedUsage, x as createObservabilityContext, y as unwrapMastraTracingProxy } from "./observability-D7RNOAPx.js";
|
|
5
5
|
import { a as MastraNonRetryableError, i as MastraError, n as ErrorDomain, o as getErrorFromUnknown, t as ErrorCategory } from "./error-oh2DLsP2.js";
|
|
6
6
|
import { a as classifyProviderError, l as describeProviderError, t as recordTerminalErrorMessage, u as readProviderErrorDetails } from "./error-BC9Au-22.js";
|
|
7
|
-
import { $ as resolveProcessorSpanAttributes, $t as computeModelOutputProviderMetadata, A as OUTPUT_STREAM_HOOK_DURATION_KEY_PREFIX, An as safeError, B as ProviderHistoryCompat, Bt as summarizeStepResult, C as markChunkOutputProcessed, Cn as isMastraTimeoutError, Ct as resolveTemplate, D as asJsonSchema, Dn as MastraModelInput, Dt as getStepResult, E as isStructuredOutputError, Et as validateTemplate, F as findOwnModelStepSpan, Ft as materializeState, G as REPROCESS_PART_KEY, Gt as patchState, Ht as applyStatePatch, It as materializeWorkflowRun, J as summarizeActiveToolsForSpan, Jt as isObservationalMemoryEnabled$1, K as takeHeldParts, L as isTrailingAssistantGuardContinuation, Lt as pickStateKeys, M as ProcessorState, Mn as createRunScopeKey, Mt as applyStateColumnsWrite, N as endOutputStreamSpanAtStepEnd, Nt as isStateCheckpointDue, O as getResponseFormat, On as safeClose, Ot as getStepResultAsync, P as endOutputStreamSpanOutsideStep, Pt as latestStepResults, Q as summarizeToolChoiceForSpan, Qt as commitToolResult, R as needsTrailingAssistantGuard, Rt as stateBaseOf, S as stampChunkProducedAt, Sn as guardStreamWithAbort, T as escapeUnescapedControlCharsInJsonStrings, Tn as settledOrElapsed, Tt as traverseMappingPath, Vt as unusedStateEntries, W as FLUSH_HELD_PARTS_KEY, Wt as diffStateAsJson, X as summarizeProcessorResultForSpan, Xt as parseMemoryRequestContext, Y as summarizeProcessorModelForSpan, Z as summarizeProcessorToolsForSpan, _ as reconcileBufferedStepTexts, _n as DEADLINE_SAVE_WAIT_MS, _t as collectMappingStepRefs, a as convertFullStreamChunkToMastra, an as withAgentWorkflowToolMarker, at as RunJournal, b as resolveProcessorWriterMessageId, bn as getAbortReason, bt as resolveStepOutputs, c as WorkflowRunOutput, cn as isProcessorWorkflow, ct as hydrateStepResults, d as MastraModelOutput, dn as resolveThreadIdFromArgs, dt as loadStepResults, en as hasToolResultProcessor, et as resolveProcessorSpanName, f as clearStepPartIndexes, fn as supportedLanguageModelSpecifications, ft as loadedStepResults, g as persistProcessorDataChunk, gn as DEADLINE_SAVE_CLAIM_HOLD_MS, gt as stubStepResult, h as findStepPartBoundaries, hn as applyStateSignal, ht as storageV2StepResultAccessors, in as snapshotToolResult, it as PROCESSOR_ABORT_SIGNAL, j as ProcessorRunner, jn as createRunScope, k as isSignalChunkExcluded, kn as safeEnqueue, kt as getSnapshotMemoryInfo, l as TripWire, ln as isSupportedLanguageModel, lt as isStepResultStub, m as findIterationOffsetInParts, mn as tryStreamWithJsonFallback, mt as residentStepResultsLoader, nn as readModelOutput, nt as PROCESSOR_LATE_SIGNAL_SINK, on as normalizeModelOutput, ot as buildStepResultAccessors, p as createDestructurableOutput, pn as tryGenerateWithJsonFallback, pt as residentStepResults, q as withoutHeldContent, rn as resolveModelOutputAfterToolResultProcessors, rt as createProcessorSendSignal, s as MastraAgentNetworkStream, sn as validationErrorModelOutput, st as getHydratedStepResult, tn as latestProcessedModelOutput, tt as toProcessorSpanPhase, u as getModelOutputForTripwire, un as resolveSuspendedToolRunId, ut as lazyStepResults, v as resolveMessageText, vn as MastraTimeoutError, vt as collectPredicateStepRefs, w as createOutputHandler, wn as raceAgainstAbort, wt as templateReadsState, x as getChunkProducedAt, xn as guardStreamUntilMatch, xt as stepRefId, y as resolveOutputMessageSkippingCompletionChecks, yn as createTimeoutAbortSignal, yt as predicateReadsState, z as removeTrailingAssistantGuardContinuations, zt as stateColumnsWrite } from "./stream-
|
|
7
|
+
import { $ as resolveProcessorSpanAttributes, $t as computeModelOutputProviderMetadata, A as OUTPUT_STREAM_HOOK_DURATION_KEY_PREFIX, An as safeError, B as ProviderHistoryCompat, Bt as summarizeStepResult, C as markChunkOutputProcessed, Cn as isMastraTimeoutError, Ct as resolveTemplate, D as asJsonSchema, Dn as MastraModelInput, Dt as getStepResult, E as isStructuredOutputError, Et as validateTemplate, F as findOwnModelStepSpan, Ft as materializeState, G as REPROCESS_PART_KEY, Gt as patchState, Ht as applyStatePatch, It as materializeWorkflowRun, J as summarizeActiveToolsForSpan, Jt as isObservationalMemoryEnabled$1, K as takeHeldParts, L as isTrailingAssistantGuardContinuation, Lt as pickStateKeys, M as ProcessorState, Mn as createRunScopeKey, Mt as applyStateColumnsWrite, N as endOutputStreamSpanAtStepEnd, Nt as isStateCheckpointDue, O as getResponseFormat, On as safeClose, Ot as getStepResultAsync, P as endOutputStreamSpanOutsideStep, Pt as latestStepResults, Q as summarizeToolChoiceForSpan, Qt as commitToolResult, R as needsTrailingAssistantGuard, Rt as stateBaseOf, S as stampChunkProducedAt, Sn as guardStreamWithAbort, T as escapeUnescapedControlCharsInJsonStrings, Tn as settledOrElapsed, Tt as traverseMappingPath, Vt as unusedStateEntries, W as FLUSH_HELD_PARTS_KEY, Wt as diffStateAsJson, X as summarizeProcessorResultForSpan, Xt as parseMemoryRequestContext, Y as summarizeProcessorModelForSpan, Z as summarizeProcessorToolsForSpan, _ as reconcileBufferedStepTexts, _n as DEADLINE_SAVE_WAIT_MS, _t as collectMappingStepRefs, a as convertFullStreamChunkToMastra, an as withAgentWorkflowToolMarker, at as RunJournal, b as resolveProcessorWriterMessageId, bn as getAbortReason, bt as resolveStepOutputs, c as WorkflowRunOutput, cn as isProcessorWorkflow, ct as hydrateStepResults, d as MastraModelOutput, dn as resolveThreadIdFromArgs, dt as loadStepResults, en as hasToolResultProcessor, et as resolveProcessorSpanName, f as clearStepPartIndexes, fn as supportedLanguageModelSpecifications, ft as loadedStepResults, g as persistProcessorDataChunk, gn as DEADLINE_SAVE_CLAIM_HOLD_MS, gt as stubStepResult, h as findStepPartBoundaries, hn as applyStateSignal, ht as storageV2StepResultAccessors, in as snapshotToolResult, it as PROCESSOR_ABORT_SIGNAL, j as ProcessorRunner, jn as createRunScope, k as isSignalChunkExcluded, kn as safeEnqueue, kt as getSnapshotMemoryInfo, l as TripWire, ln as isSupportedLanguageModel, lt as isStepResultStub, m as findIterationOffsetInParts, mn as tryStreamWithJsonFallback, mt as residentStepResultsLoader, nn as readModelOutput, nt as PROCESSOR_LATE_SIGNAL_SINK, on as normalizeModelOutput, ot as buildStepResultAccessors, p as createDestructurableOutput, pn as tryGenerateWithJsonFallback, pt as residentStepResults, q as withoutHeldContent, rn as resolveModelOutputAfterToolResultProcessors, rt as createProcessorSendSignal, s as MastraAgentNetworkStream, sn as validationErrorModelOutput, st as getHydratedStepResult, tn as latestProcessedModelOutput, tt as toProcessorSpanPhase, u as getModelOutputForTripwire, un as resolveSuspendedToolRunId, ut as lazyStepResults, v as resolveMessageText, vn as MastraTimeoutError, vt as collectPredicateStepRefs, w as createOutputHandler, wn as raceAgainstAbort, wt as templateReadsState, x as getChunkProducedAt, xn as guardStreamUntilMatch, xt as stepRefId, y as resolveOutputMessageSkippingCompletionChecks, yn as createTimeoutAbortSignal, yt as predicateReadsState, z as removeTrailingAssistantGuardContinuations, zt as stateColumnsWrite } from "./stream-1DGoEkG2.js";
|
|
8
8
|
import { c as MASTRA_THREAD_ID_KEY, d as isReservedRequestContextKey, f as mergeVersionOverrides$1, l as MASTRA_VERSIONS_KEY, n as MASTRA_AUTH_TOKEN_KEY, o as MASTRA_RESOURCE_ID_KEY, p as withoutLiveRequestKeys, r as MASTRA_INHERITED_MEMORY_KEY, s as MASTRA_SCOPES_KEY, t as MASTRA_CONTINUATION_TOOL_CALL_IDS_KEY, u as RequestContext } from "./request-context-COnZHt2-.js";
|
|
9
9
|
import { S as withAck, _ as serializeError$1, h as stripModelSnapshots, n as PublisherQueueLimitError, p as slimNestedAgentChunks, r as CachingPubSub, t as DefaultStepResult, u as isRunLocalTopic, v as EventEmitterPubSub, x as isLeaseProvider, y as NoopLeaseProvider } from "./output-helpers-CVzhy1Y0.js";
|
|
10
|
-
import { A as stableStringify$1, E as removeWorkingMemoryTags, P as embed$3, Z as preserveResponseItemIdsOnMerge, a as isTerminalToolInvocationState, c as withUnavailableAttachmentUrls, d as aiV5UIMessagesToAIV5ModelMessages, f as coreContentToString, i as isClientToolInvocationUpdate, l as isDownloadAssetsError, m as filterMessagesForPersistence, n as MessageList, ot as normalizeToolOutput, p as messagesAreEqual, r as advancesToolInvocationState, s as unavailableAttachmentPlaceholder, t as convertMessages, u as MessageMerger } from "./message-list-
|
|
10
|
+
import { A as stableStringify$1, E as removeWorkingMemoryTags, P as embed$3, Z as preserveResponseItemIdsOnMerge, a as isTerminalToolInvocationState, c as withUnavailableAttachmentUrls, d as aiV5UIMessagesToAIV5ModelMessages, f as coreContentToString, i as isClientToolInvocationUpdate, l as isDownloadAssetsError, m as filterMessagesForPersistence, n as MessageList, ot as normalizeToolOutput, p as messagesAreEqual, r as advancesToolInvocationState, s as unavailableAttachmentPlaceholder, t as convertMessages, u as MessageMerger } from "./message-list-BGm1DCiG.js";
|
|
11
11
|
import { Bt as listScoresArgsSchema, Ft as listLogsArgsSchema, Lt as listMetricsArgsSchema, Nt as listFeedbackArgsSchema, t as EntityType } from "./storage-Cc50aQAp.js";
|
|
12
12
|
import { a as getOrCreateSpan, f as resolveCurrentSpan, l as getTimeToFirstChunkMs, n as executeWithContextSync, o as getResumeTracingContext, p as resolveExportedSpanId, s as getRootExportSpan, t as executeWithContext, u as getWorkflowResumeTracingContext } from "./utils-DU_pU5SK.js";
|
|
13
13
|
import { i as setSpanErrorOrigin, n as getSpanErrorOrigin } from "./error-count-BH-rJW7q.js";
|
|
14
|
-
import { a as ModelRouterLanguageModel, d as attachModelStreamTransport, f as isDataChunk, i as resolveModelConfig, n as ModelRouterEmbeddingModel, o as resolveApiProviderId, p as readModelStreamTransport } from "./llm-
|
|
14
|
+
import { a as ModelRouterLanguageModel, d as attachModelStreamTransport, f as isDataChunk, i as resolveModelConfig, n as ModelRouterEmbeddingModel, o as resolveApiProviderId, p as readModelStreamTransport } from "./llm-CytL7cpw.js";
|
|
15
15
|
import { a as withToolPayloadTransformMetadata, i as transformToolPayloadForTargets, n as hasTransformedToolPayload, o as withToolPayloadTransformProviderMetadata, r as normalizeToolPayloadTransformPolicy, t as getTransformedToolPayload } from "./payload-transform-Dj3HUeD4.js";
|
|
16
16
|
import { boundedStringify, ensureSerializable, safeStringify } from "./utils/safe-stringify.js";
|
|
17
17
|
import { d as signalSpanAttributes, h as signalToXmlMarkup, l as mastraDBMessageToSignal, n as createSignal, o as isMastraSignalMessage, s as isTransientSignalMessage, u as resolveDeliveryAttributes } from "./signals-CqR_iWkg.js";
|
|
18
|
-
import { h as resolveFilePartMediaTypeAndData, m as parseDataUri, o as categorizeFileData } from "./to-prompt-
|
|
18
|
+
import { h as resolveFilePartMediaTypeAndData, m as parseDataUri, o as categorizeFileData } from "./to-prompt-CMlVGYxC.js";
|
|
19
19
|
import { c as parsePartialJson, h as tool$1, m as generateId$1, p as asSchema$1, r as embed$4, u as APICallError$1 } from "./dist-TPVqg8oV.js";
|
|
20
20
|
import { n as embed$5 } from "./dist-D3cKCUe-.js";
|
|
21
21
|
import { t as deepEqual$3 } from "./deep-equal-d1xU02ag.js";
|
|
@@ -24,13 +24,13 @@ import { _ as getRequestContextInputValues, a as getModelFacingValidationError,
|
|
|
24
24
|
import { a as isApprovalExempt, c as isProviderDefinedTool, d as markAgentWorkflowTool, f as markApprovalExempt, l as isProviderTool, n as getNeedsApprovalFn, o as isBuiltBeforeApproval, r as getProviderToolName, s as isMastraTool, t as getBeforeApprovalFn } from "./toolchecks-DrsZdc3S.js";
|
|
25
25
|
import { a as waitDelay, i as getRetryAfterMs, n as DEFAULT_MAX_RETRY_AFTER_MS, r as clampDelayMs } from "./fetchWithRetry-DFSvpYDT.js";
|
|
26
26
|
import { i as hasFreeFormObject } from "./model-DS-b2R-R.js";
|
|
27
|
-
import { c as modelSupportsStructuredOutput, l as modelSupportsTemperature } from "./provider-registry-
|
|
27
|
+
import { c as modelSupportsStructuredOutput, l as modelSupportsTemperature } from "./provider-registry-CP_5SNiw.js";
|
|
28
28
|
import { t as InMemoryServerCache } from "./inmemory-BK3zLwvM.js";
|
|
29
29
|
import { n as resolveDynamicArgument, t as getRequestUser } from "./dynamic-argument-BzPK3qPN.js";
|
|
30
|
-
import { t as MastraLLMV1 } from "./model-
|
|
31
|
-
import { A as eagerToolCallDidNotExecute, D as EagerToolExecutionCoordinator, E as EAGER_TOOL_EXECUTION_MARKER, F as hasRunningRunStep, I as isRunStepActive, L as setRunLeaseFence, M as isEagerlyExecutableToolCall, N as TOOL_ABORT_NOTICE, O as EagerToolExecutionNotRun, P as clearRunLeaseFence, R as startRunStep, S as selectFields, T as EAGER_TOOL_BAILOUT, a as ensureToolProperties, b as removeUndefinedValues, d as makeCoreTool, i as delay$1, j as eagerToolCallSuspensionIntent, k as eagerToolCallAlreadyAnnouncedInput, n as createMastraProxy, o as generateEmptyFromSchema, p as makeProcessorCoreTool, r as deepMerge$1, v as readPositiveIntEnv, w as EAGER_TOOL_ABORT_SIGNAL, y as rebindProcessorTools, z as whenRunStepsSettle } from "./utils-
|
|
30
|
+
import { t as MastraLLMV1 } from "./model-DyQ07rPH.js";
|
|
31
|
+
import { A as eagerToolCallDidNotExecute, D as EagerToolExecutionCoordinator, E as EAGER_TOOL_EXECUTION_MARKER, F as hasRunningRunStep, I as isRunStepActive, L as setRunLeaseFence, M as isEagerlyExecutableToolCall, N as TOOL_ABORT_NOTICE, O as EagerToolExecutionNotRun, P as clearRunLeaseFence, R as startRunStep, S as selectFields, T as EAGER_TOOL_BAILOUT, a as ensureToolProperties, b as removeUndefinedValues, d as makeCoreTool, i as delay$1, j as eagerToolCallSuspensionIntent, k as eagerToolCallAlreadyAnnouncedInput, n as createMastraProxy, o as generateEmptyFromSchema, p as makeProcessorCoreTool, r as deepMerge$1, v as readPositiveIntEnv, w as EAGER_TOOL_ABORT_SIGNAL, y as rebindProcessorTools, z as whenRunStepsSettle } from "./utils-C55ZdVaj.js";
|
|
32
32
|
import { h as getWorkflowFGAResourceId, i as MastraFGAPermissions, y as requireFGA } from "./ee-iTj2bRDt-By_B9ngH.js";
|
|
33
|
-
import {
|
|
33
|
+
import { c as createBackgroundTask, o as resolveBackgroundConfig, s as sanitizeToolArguments, t as generateBackgroundTaskSystemPrompt } from "./background-tasks-CgzXjBfE.js";
|
|
34
34
|
import { t as ToolStream } from "./stream-D9JOykz7.js";
|
|
35
35
|
import { MISSING, collectInvalidPredicatePaths, createPredicateEvaluator, derivePredicateLabel, normalizePredicatePath, walk } from "./predicate/index.js";
|
|
36
36
|
import { Classifier } from "./classifier/index.js";
|
|
@@ -39,11 +39,11 @@ import { HAND_BACK_STATE_SYMBOL, PARENT_STATE_SYMBOL, PUBSUB_SYMBOL, STREAM_FORM
|
|
|
39
39
|
import { i as executeHook } from "./hooks-Bth8Cjpj.js";
|
|
40
40
|
import { o as assertValidScheduleDefinition, v as validateScheduleTiming } from "./schedules-DZfSx-7P.js";
|
|
41
41
|
import { A as writeObjective, D as readObjective, O as resolveEffectiveGoalSettings, T as formatGoalBudgetPausedReason, _ as clearCachedGoalObjective, b as GOAL_SCORER_ID, g as cacheGoalObjective, k as resolveGoalStore, w as clearObjective, x as GOAL_SCORE_WAITING } from "./state-processor-B9kxpM53.js";
|
|
42
|
-
import { An as computeTraceStatus, Cr as extractTrajectory, Dr as saveScorePayloadSchema, It as TABLE_SCHEMAS, Lt as TABLE_SCORERS, Nn as extractBranchSpans, Pn as getBranchArgsSchema, Qn as listTracesArgsSchema, Sr as withBufferedReflectionVerified, Tr as extractWorkflowTrajectory, Yn as listBranchesArgsSchema, _r as isAppendOnlySince, ar as spanRecordSchema, br as maxObservationCursor, cr as toTraceSpans, gn as BRANCH_SPAN_TYPE_SET, gr as compareObservationalMemoryHeadOrder, hr as assertActiveObservationsApplied, or as toLightSpanRecord, pn as matchesExpectedWorkflowStatus, qn as isPreviewTruncated, sr as toTraceSpan, vn as TraceStatus, vr as isBufferedChunkCoveredByCursor, wr as extractTrajectoryFromTrace, xr as planReflectionGenerationText, yr as isBufferedReflectionUnchangedSince } from "./constants-
|
|
42
|
+
import { An as computeTraceStatus, Cr as extractTrajectory, Dr as saveScorePayloadSchema, It as TABLE_SCHEMAS, Lt as TABLE_SCORERS, Nn as extractBranchSpans, Pn as getBranchArgsSchema, Qn as listTracesArgsSchema, Sr as withBufferedReflectionVerified, Tr as extractWorkflowTrajectory, Yn as listBranchesArgsSchema, _r as isAppendOnlySince, ar as spanRecordSchema, br as maxObservationCursor, cr as toTraceSpans, gn as BRANCH_SPAN_TYPE_SET, gr as compareObservationalMemoryHeadOrder, hr as assertActiveObservationsApplied, or as toLightSpanRecord, pn as matchesExpectedWorkflowStatus, qn as isPreviewTruncated, sr as toTraceSpan, vn as TraceStatus, vr as isBufferedChunkCoveredByCursor, wr as extractTrajectoryFromTrace, xr as planReflectionGenerationText, yr as isBufferedReflectionUnchangedSince } from "./constants-CFWgIaqA.js";
|
|
43
43
|
import { t as GoalSignalProvider } from "./signal-provider-BslnAjWG.js";
|
|
44
44
|
import { t as slugify } from "./slugify-BUNmb-Ga.js";
|
|
45
|
-
import {
|
|
46
|
-
import { i as normalizeWebSearchProvider, n as createWebSearchProviderTool, r as isWebSearchTool } from "./tools-
|
|
45
|
+
import { F as LocalSandbox, at as evaluateReadRecord, c as Workspace, dt as WORKSPACE_TOOLS, g as resolveToolConfig, gt as shellQuote, h as createWorkspaceTools, ht as sliceByTokens, l as createSkillTools, lt as CompositeFilesystem, mt as estimateTokenCount, ot as normalizeReadTrackerPath, pt as sliceByTokensSafe, st as LocalFilesystem } from "./workspace-DOAil8mG.js";
|
|
46
|
+
import { i as normalizeWebSearchProvider, n as createWebSearchProviderTool, r as isWebSearchTool } from "./tools-tPy2FwMI.js";
|
|
47
47
|
import { D as BM25Index, O as tokenize } from "./workspace-skills-38OY32_b.js";
|
|
48
48
|
import { f as calculatePagination, g as InMemoryThreadStateStorage, h as resolveListOrderBy, m as normalizePerPage, p as compareByField, s as StorageDomain, u as MastraCompositeStore } from "./filesystem-versioned-BL1ojJLo.js";
|
|
49
49
|
import { coreFeatures } from "./features/index.js";
|
|
@@ -65,11 +65,11 @@ import { ReadableStream as ReadableStream$1, TransformStream as TransformStream$
|
|
|
65
65
|
import { injectJsonInstructionIntoMessages, isAbortError } from "@ai-sdk/provider-utils-v6";
|
|
66
66
|
import { z as z$1 } from "zod";
|
|
67
67
|
import { createHash, randomUUID } from "crypto";
|
|
68
|
+
import { config, toJSONSchema } from "zod/v4/core";
|
|
69
|
+
import en from "zod/v4/locales/en.js";
|
|
68
70
|
import { prepareJsonSchemaForOpenAIStrictMode, wrapSchemaWithNullTransform } from "@mastra/schema-compat";
|
|
69
71
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
|
|
70
72
|
import { dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep, win32 } from "path";
|
|
71
|
-
import { config, toJSONSchema } from "zod/v4/core";
|
|
72
|
-
import en from "zod/v4/locales/en.js";
|
|
73
73
|
import { jsonSchemaToZod } from "@mastra/schema-compat/json-to-zod";
|
|
74
74
|
import { AsyncLocalStorage } from "async_hooks";
|
|
75
75
|
import fastq from "fastq";
|
|
@@ -7613,6 +7613,7 @@ function createStepFromProcessor$1(processor) {
|
|
|
7613
7613
|
};
|
|
7614
7614
|
const step = {
|
|
7615
7615
|
id: `processor:${processor.id}`,
|
|
7616
|
+
processorId: processor.id,
|
|
7616
7617
|
description: processor.name ?? `Processor ${processor.id}`,
|
|
7617
7618
|
inputSchema: toStandardSchema(ProcessorStepInputSchema),
|
|
7618
7619
|
outputSchema: toStandardSchema(ProcessorStepOutputSchema),
|
|
@@ -8258,7 +8259,8 @@ function cloneStep$1(step, opts) {
|
|
|
8258
8259
|
retries: step.retries,
|
|
8259
8260
|
scorers: step.scorers,
|
|
8260
8261
|
component: step.component,
|
|
8261
|
-
metadata: step.metadata
|
|
8262
|
+
metadata: step.metadata,
|
|
8263
|
+
processorId: step.processorId
|
|
8262
8264
|
};
|
|
8263
8265
|
}
|
|
8264
8266
|
/**
|
|
@@ -11708,6 +11710,21 @@ function warnUnsupportedEventedSetup(mastra, workflowsStore) {
|
|
|
11708
11710
|
warnedHosts.add(mastra);
|
|
11709
11711
|
mastra.getLogger()?.warn(`Evented workflows and agents aren't supported on several processes with this setup: ${missing}. See ${DOCS_URL}`);
|
|
11710
11712
|
}
|
|
11713
|
+
// src/agent-controller/worker-run-binding.ts
|
|
11714
|
+
const CONTROLLER_RUN_BINDING_KEY = "mastra__controllerRunBinding";
|
|
11715
|
+
const controllerRunBindingSchema = z.object({
|
|
11716
|
+
controllerId: z.string().min(1),
|
|
11717
|
+
agentId: z.string().min(1),
|
|
11718
|
+
sessionId: z.string().min(1),
|
|
11719
|
+
ownerId: z.string(),
|
|
11720
|
+
resourceId: z.string().min(1),
|
|
11721
|
+
threadId: z.string().min(1),
|
|
11722
|
+
modeId: z.string().min(1)
|
|
11723
|
+
});
|
|
11724
|
+
const restoredWorkerControllerContexts = /* @__PURE__ */ new WeakSet();
|
|
11725
|
+
function isRestoredWorkerControllerContext(value) {
|
|
11726
|
+
return typeof value === "object" && value !== null && restoredWorkerControllerContexts.has(value);
|
|
11727
|
+
}
|
|
11711
11728
|
// src/agent/scopes.ts
|
|
11712
11729
|
/**
|
|
11713
11730
|
* Scope types Memory reads as the run's identity. Every other scope type is
|
|
@@ -11996,6 +12013,7 @@ function snapshotRequestContextEntries(requestContext, onEntryOmitted) {
|
|
|
11996
12013
|
if (key === "mastra__versions") continue;
|
|
11997
12014
|
if (key === "mastra__durableExecutions") continue;
|
|
11998
12015
|
if (key === "mastra__durableSegments") continue;
|
|
12016
|
+
if (key === "__mastra_chat_channel_render") continue;
|
|
11999
12017
|
const json = boundedStringify(value);
|
|
12000
12018
|
if (json === void 0) {
|
|
12001
12019
|
onEntryOmitted?.();
|
|
@@ -12022,6 +12040,8 @@ function restoreRequestContext(entries, runLevel, liveRunContext) {
|
|
|
12022
12040
|
if (liveRunContext) return liveRunContext;
|
|
12023
12041
|
if (entries) {
|
|
12024
12042
|
const restored = new RequestContext([...Object.entries(withoutLiveRequestKeys(entries)), ...liveRequestEntries(runLevel)]);
|
|
12043
|
+
const controller = runLevel?.get("controller");
|
|
12044
|
+
if (isRestoredWorkerControllerContext(controller)) restored.set("controller", controller);
|
|
12025
12045
|
restoreRunAgentScopes(restored);
|
|
12026
12046
|
return restored;
|
|
12027
12047
|
}
|
|
@@ -15485,7 +15505,8 @@ var StepExecutor = class extends MastraBase {
|
|
|
15485
15505
|
return storageV2StepResultAccessors((step) => getHydratedStepResult(stepResults, step, hydrate));
|
|
15486
15506
|
}
|
|
15487
15507
|
async execute(params) {
|
|
15488
|
-
const { entry, stepResults, runId,
|
|
15508
|
+
const { entry, stepResults, runId, retryCount = 0, perStep } = params;
|
|
15509
|
+
let { requestContext } = params;
|
|
15489
15510
|
const stepId = getEntryId(entry);
|
|
15490
15511
|
const errorAttemptId = `${runId}:${stepId}:${params.foreachIdx ?? ""}:attempt:${retryCount}`;
|
|
15491
15512
|
const schemas = getEntrySchemas(entry, this.mastra);
|
|
@@ -15541,6 +15562,18 @@ var StepExecutor = class extends MastraBase {
|
|
|
15541
15562
|
const stepTracingContext = workflowStepSpan ? { currentSpan: workflowStepSpan } : params.tracingContext ?? {};
|
|
15542
15563
|
try {
|
|
15543
15564
|
if (validationError) throw validationError;
|
|
15565
|
+
if (params.workflowId === DurableStepIds.AGENTIC_LOOP || params.workflowId === DurableStepIds.AGENTIC_EXECUTION) {
|
|
15566
|
+
const live = requestContext.get("controller");
|
|
15567
|
+
const initial = stepResults.input;
|
|
15568
|
+
const binding = initial?.requestContextEntries?.[CONTROLLER_RUN_BINDING_KEY];
|
|
15569
|
+
if (initial && binding !== void 0 && typeof live?.getState !== "function") {
|
|
15570
|
+
const parsed = controllerRunBindingSchema.parse(binding);
|
|
15571
|
+
if (initial.agentId !== parsed.agentId || initial.state?.threadId !== parsed.threadId || initial.state.resourceId !== parsed.resourceId) throw new Error("Controller binding does not match this durable run");
|
|
15572
|
+
const controller = this.mastra?.getAgentControllerById(parsed.controllerId);
|
|
15573
|
+
if (!controller) throw new Error("Controller is not registered on this worker");
|
|
15574
|
+
requestContext = await controller.__restoreWorkerRequestContext(requestContext, parsed, abortController.signal, initial.runId);
|
|
15575
|
+
}
|
|
15576
|
+
}
|
|
15544
15577
|
const callId = globalThis.crypto.randomUUID();
|
|
15545
15578
|
const outputWriter = this.createOutputWriter(runId);
|
|
15546
15579
|
const stepOutput = await executeWithContext({
|
|
@@ -21337,7 +21370,8 @@ function cloneStep(step, opts) {
|
|
|
21337
21370
|
retries: step.retries,
|
|
21338
21371
|
scorers: step.scorers,
|
|
21339
21372
|
metadata: step.metadata,
|
|
21340
|
-
component: step.component
|
|
21373
|
+
component: step.component,
|
|
21374
|
+
processorId: step.processorId
|
|
21341
21375
|
};
|
|
21342
21376
|
}
|
|
21343
21377
|
function isToolStep(input) {
|
|
@@ -21597,6 +21631,7 @@ function createStepFromProcessor(processor) {
|
|
|
21597
21631
|
};
|
|
21598
21632
|
return {
|
|
21599
21633
|
id: `processor:${processor.id}`,
|
|
21634
|
+
processorId: processor.id,
|
|
21600
21635
|
description: processor.name ?? `Processor ${processor.id}`,
|
|
21601
21636
|
inputSchema: toStandardSchema(ProcessorStepSchema),
|
|
21602
21637
|
outputSchema: toStandardSchema(ProcessorStepOutputSchema),
|
|
@@ -27746,12 +27781,14 @@ async function partitionMessages(messagesDescending, limits, tokenCounter, initi
|
|
|
27746
27781
|
if (maxTokens !== void 0 && !tokenCounter) throw new Error("A token counter is required to load token-limited message history");
|
|
27747
27782
|
let messageCount = 0;
|
|
27748
27783
|
let tokenCount = initialTokens;
|
|
27784
|
+
let loadedTokens = initialTokens;
|
|
27749
27785
|
let reachedLimit = false;
|
|
27750
27786
|
let overflowReason;
|
|
27751
27787
|
const retainedIds = /* @__PURE__ */ new Set();
|
|
27752
27788
|
for (const group of groupLinkedToolMessages(messagesDescending)) {
|
|
27753
27789
|
let groupTokens = 0;
|
|
27754
27790
|
if (tokenCounter) for (const message of group) groupTokens += await tokenCounter.countMessage(message);
|
|
27791
|
+
loadedTokens += groupTokens;
|
|
27755
27792
|
const exceedsMessageLimit = limits.maxMessages !== void 0 && messageCount + group.length > limits.maxMessages;
|
|
27756
27793
|
const exceedsTokenLimit = maxTokens !== void 0 && tokenCount + groupTokens > maxTokens;
|
|
27757
27794
|
if (reachedLimit || exceedsMessageLimit || exceedsTokenLimit) {
|
|
@@ -27766,7 +27803,8 @@ async function partitionMessages(messagesDescending, limits, tokenCounter, initi
|
|
|
27766
27803
|
return {
|
|
27767
27804
|
messages: messagesDescending.filter((message) => retainedIds.has(message.id)).reverse(),
|
|
27768
27805
|
overflow: messagesDescending.filter((message) => !retainedIds.has(message.id)).reverse(),
|
|
27769
|
-
overflowReason
|
|
27806
|
+
overflowReason,
|
|
27807
|
+
loadedTokens
|
|
27770
27808
|
};
|
|
27771
27809
|
}
|
|
27772
27810
|
function laterDate(left, right) {
|
|
@@ -27828,15 +27866,15 @@ async function loadMessageHistory(args) {
|
|
|
27828
27866
|
const newestOverflow = partitioned.overflow.at(-1);
|
|
27829
27867
|
if (newestOverflow) cutoffTimestamp = newestOverflow.createdAt.getTime();
|
|
27830
27868
|
const oldestTimestamp = result.messages.at(-1)?.createdAt.getTime();
|
|
27831
|
-
const crossedCutoff = cutoffTimestamp !== void 0 && oldestTimestamp !== void 0 && oldestTimestamp < cutoffTimestamp;
|
|
27869
|
+
const crossedCutoff = cutoffTimestamp !== void 0 && oldestTimestamp !== void 0 && oldestTimestamp < cutoffTimestamp && (!args.includeOverflow || partitioned.overflowReason !== "tokens" || partitioned.loadedTokens > (args.maxTokens ?? 0));
|
|
27832
27870
|
const reachedBoundary = args.boundary !== void 0 && oldestTimestamp !== void 0 && oldestTimestamp < new Date(args.boundary.createdAt).getTime();
|
|
27833
|
-
if (!result.hasMore || crossedCutoff || reachedBoundary || result.messages.length === 0) return
|
|
27871
|
+
if (!result.hasMore || crossedCutoff || reachedBoundary || result.messages.length === 0) return {
|
|
27834
27872
|
messages: partitioned.messages,
|
|
27835
|
-
overflow: []
|
|
27873
|
+
overflow: args.includeOverflow && partitioned.overflowReason === "tokens" ? partitioned.overflow : []
|
|
27836
27874
|
};
|
|
27837
|
-
if (oldestTimestamp === void 0) return
|
|
27875
|
+
if (oldestTimestamp === void 0) return {
|
|
27838
27876
|
messages: partitioned.messages,
|
|
27839
|
-
overflow: []
|
|
27877
|
+
overflow: args.includeOverflow && partitioned.overflowReason === "tokens" ? partitioned.overflow : []
|
|
27840
27878
|
};
|
|
27841
27879
|
if (end?.getTime() === oldestTimestamp && added === 0) page++;
|
|
27842
27880
|
else {
|
|
@@ -30331,19 +30369,24 @@ var ToolSearchProcessor = class {
|
|
|
30331
30369
|
});
|
|
30332
30370
|
}
|
|
30333
30371
|
async processInputStep(args) {
|
|
30334
|
-
const { tools, messageList } = args;
|
|
30372
|
+
const { tools, messageList, activeTools } = args;
|
|
30335
30373
|
const catalog = this.catalogForStep(tools);
|
|
30336
30374
|
const storeContext = this.makeStoreContext(args);
|
|
30337
30375
|
const loadedToolNames = await this.store.getLoadedNames(storeContext);
|
|
30338
30376
|
const autoLoad = this.searchConfig.autoLoad;
|
|
30339
|
-
|
|
30340
|
-
|
|
30377
|
+
const searchAvailable = !activeTools || activeTools.includes("search_tools");
|
|
30378
|
+
const loadAvailable = !autoLoad && (!activeTools || activeTools.includes("load_tool"));
|
|
30379
|
+
const instructionParts = [];
|
|
30380
|
+
if (searchAvailable) instructionParts.push(autoLoad ? "To discover available tools, call search_tools with a keyword query. Matching tools are loaded automatically and become available on your next turn \u2014 there is no separate load step. After searching, use the tool directly." : "To discover available tools, call search_tools with a keyword query.");
|
|
30381
|
+
if (loadAvailable) instructionParts.push("To add one or more tools to the conversation, call load_tool with a toolName or toolNames array. Tools must be loaded before they can be used.");
|
|
30382
|
+
if (instructionParts.length > 0) messageList.addSystem(instructionParts.join(" "));
|
|
30383
|
+
if (this.injectCatalog && (autoLoad ? searchAvailable : loadAvailable)) {
|
|
30341
30384
|
const catalogList = await this.formatCatalog(catalog, args.requestContext);
|
|
30342
|
-
if (catalogList) messageList.addSystem((autoLoad ? "The following tools are available. Call search_tools with a keyword to load one \u2014 matching tools are loaded automatically and become available on your next turn." : "The following tools are available to load. Call load_tool with a toolName or toolNames array to add one or more before using them \u2014 no search step is required. search_tools is also available if you need to rediscover tools by keyword.") + "\n\nAvailable tools:\n" + catalogList);
|
|
30385
|
+
if (catalogList) messageList.addSystem((autoLoad ? "The following tools are available. Call search_tools with a keyword to load one \u2014 matching tools are loaded automatically and become available on your next turn." : "The following tools are available to load. Call load_tool with a toolName or toolNames array to add one or more before using them \u2014 no search step is required." + (searchAvailable ? " search_tools is also available if you need to rediscover tools by keyword." : "")) + "\n\nAvailable tools:\n" + catalogList);
|
|
30343
30386
|
}
|
|
30344
30387
|
const searchTool = createTool({
|
|
30345
30388
|
id: "search_tools",
|
|
30346
|
-
description: autoLoad ? "Search for available tools by keyword. Use this when you need a capability you don't currently have. Returns a list of matching tools, which are loaded automatically and become available on your next turn \u2014 no separate load step is required." : "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.",
|
|
30389
|
+
description: autoLoad ? "Search for available tools by keyword. Use this when you need a capability you don't currently have. Returns a list of matching tools, which are loaded automatically and become available on your next turn \u2014 no separate load step is required." : "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." + (loadAvailable ? " After finding a useful tool, use load_tool to make it available." : ""),
|
|
30347
30390
|
inputSchema: z.object({ query: z.string().describe("Search keywords (e.g., \"weather\", \"github issue\", \"database query\")") }),
|
|
30348
30391
|
outputSchema: z.object({
|
|
30349
30392
|
results: z.array(z.object({
|
|
@@ -30373,13 +30416,13 @@ var ToolSearchProcessor = class {
|
|
|
30373
30416
|
}
|
|
30374
30417
|
return {
|
|
30375
30418
|
results,
|
|
30376
|
-
message: `Found ${results.length} tool(s). Use load_tool with an exact toolName or a toolNames array to make them available.`
|
|
30419
|
+
message: loadAvailable ? `Found ${results.length} tool(s). Use load_tool with an exact toolName or a toolNames array to make them available.` : `Found ${results.length} tool(s): ${results.map((r) => r.name).join(", ")}.`
|
|
30377
30420
|
};
|
|
30378
30421
|
}
|
|
30379
30422
|
});
|
|
30380
30423
|
const loadTool = createTool({
|
|
30381
30424
|
id: "load_tool",
|
|
30382
|
-
description: "Load one or more tools into your context. Call this after finding tools with search_tools. Once loaded, tools will be available for use. Pass a single toolName or an array of toolNames to load multiple tools at once.",
|
|
30425
|
+
description: "Load one or more tools into your context. " + (searchAvailable ? "Call this after finding tools with search_tools. " : "") + "Once loaded, tools will be available for use. Pass a single toolName or an array of toolNames to load multiple tools at once.",
|
|
30383
30426
|
inputSchema: z.object({
|
|
30384
30427
|
toolName: z.string().optional().describe("The exact name of a tool to load (from search results)"),
|
|
30385
30428
|
toolNames: z.array(z.string()).optional().describe("Array of exact tool names to load in one call (from search results)")
|
|
@@ -30436,7 +30479,7 @@ var ToolSearchProcessor = class {
|
|
|
30436
30479
|
const suggestions = await this.getSuggestedToolNames(catalog, name, args.requestContext);
|
|
30437
30480
|
let message = `Tool "${name}" not found.`;
|
|
30438
30481
|
if (suggestions.length > 0) message += ` Did you mean: ${suggestions.slice(0, 3).join(", ")}?`;
|
|
30439
|
-
else message += " Use search_tools to find available tools.";
|
|
30482
|
+
else if (searchAvailable) message += " Use search_tools to find available tools.";
|
|
30440
30483
|
return {
|
|
30441
30484
|
success: false,
|
|
30442
30485
|
message,
|
|
@@ -30470,8 +30513,8 @@ var ToolSearchProcessor = class {
|
|
|
30470
30513
|
});
|
|
30471
30514
|
const loadedTools = await this.getLoadedTools(catalog, loadedToolNames, args.requestContext);
|
|
30472
30515
|
return { tools: {
|
|
30473
|
-
search_tools: searchTool,
|
|
30474
|
-
...
|
|
30516
|
+
...searchAvailable ? { search_tools: searchTool } : {},
|
|
30517
|
+
...loadAvailable ? { load_tool: loadTool } : {},
|
|
30475
30518
|
...this.includeResolvedTools ? unsearchableResolvedTools(tools) : tools ?? {},
|
|
30476
30519
|
...loadedTools
|
|
30477
30520
|
} };
|
|
@@ -30833,7 +30876,7 @@ var SkillSearchProcessor = class {
|
|
|
30833
30876
|
return this.cleanupStaleState();
|
|
30834
30877
|
}
|
|
30835
30878
|
async processInputStep(args) {
|
|
30836
|
-
const { tools, messageList } = args;
|
|
30879
|
+
const { tools, messageList, activeTools } = args;
|
|
30837
30880
|
const threadId = this.getThreadId(args);
|
|
30838
30881
|
const threadState = this.getThreadState(threadId);
|
|
30839
30882
|
const configuredSkills = this.skills;
|
|
@@ -30843,10 +30886,18 @@ var SkillSearchProcessor = class {
|
|
|
30843
30886
|
if (this.blockingRefresh) await skills.maybeRefresh({ requestContext: args.requestContext })?.catch(this.warnRefreshFailed);
|
|
30844
30887
|
else skills.maybeRefresh({ requestContext: args.requestContext })?.catch(this.warnRefreshFailed);
|
|
30845
30888
|
}
|
|
30846
|
-
|
|
30889
|
+
const searchAvailable = !activeTools || activeTools.includes("search_skills");
|
|
30890
|
+
const loadAvailable = !activeTools || activeTools.includes("load_skill");
|
|
30891
|
+
const instructionParts = [];
|
|
30892
|
+
if (searchAvailable) instructionParts.push("To discover available skills, call search_skills with a keyword query.");
|
|
30893
|
+
if (loadAvailable) instructionParts.push("To load a skill's instructions, call load_skill with the skill name.");
|
|
30894
|
+
if (instructionParts.length > 0) {
|
|
30895
|
+
instructionParts.push("Loaded skills provide context and instructions for the conversation.");
|
|
30896
|
+
messageList.addSystem(instructionParts.join(" "));
|
|
30897
|
+
}
|
|
30847
30898
|
const searchSkillTool = createTool({
|
|
30848
30899
|
id: "search_skills",
|
|
30849
|
-
description: "Search for available skills by keyword. Returns a list of matching skills with their names and descriptions. After finding a useful skill, use load_skill to load its instructions.",
|
|
30900
|
+
description: "Search for available skills by keyword. Returns a list of matching skills with their names and descriptions." + (loadAvailable ? " After finding a useful skill, use load_skill to load its instructions." : ""),
|
|
30850
30901
|
inputSchema: z.object({ query: z.string().trim().min(1, "Query is required").describe("Search keywords (e.g., \"api design\", \"testing\", \"deployment\")") }),
|
|
30851
30902
|
outputSchema: z.object({
|
|
30852
30903
|
results: z.array(z.object({
|
|
@@ -30883,13 +30934,13 @@ var SkillSearchProcessor = class {
|
|
|
30883
30934
|
});
|
|
30884
30935
|
return {
|
|
30885
30936
|
results,
|
|
30886
|
-
message: `Found ${results.length} skill(s). Use load_skill with the exact skill name to load its instructions.`
|
|
30937
|
+
message: loadAvailable ? `Found ${results.length} skill(s). Use load_skill with the exact skill name to load its instructions.` : `Found ${results.length} skill(s): ${results.map((r) => r.name).join(", ")}.`
|
|
30887
30938
|
};
|
|
30888
30939
|
}
|
|
30889
30940
|
});
|
|
30890
30941
|
const loadSkillTool = createTool({
|
|
30891
30942
|
id: "load_skill",
|
|
30892
|
-
description: "Load a skill's full instructions into the conversation. Call this after finding a skill with search_skills. The skill's instructions will be available as context.",
|
|
30943
|
+
description: "Load a skill's full instructions into the conversation. " + (searchAvailable ? "Call this after finding a skill with search_skills. " : "") + "The skill's instructions will be available as context.",
|
|
30893
30944
|
inputSchema: z.object({ skillName: z.string().describe("The exact name of the skill to load (from search results)") }),
|
|
30894
30945
|
outputSchema: z.object({
|
|
30895
30946
|
success: z.boolean(),
|
|
@@ -30907,7 +30958,7 @@ var SkillSearchProcessor = class {
|
|
|
30907
30958
|
const suggestions = (await skills.list()).filter((s) => s.name.toLowerCase().includes(skillName.toLowerCase()) || skillName.toLowerCase().includes(s.name.toLowerCase())).slice(0, 3);
|
|
30908
30959
|
let message = `Skill "${skillName}" not found.`;
|
|
30909
30960
|
if (suggestions.length > 0) message += ` Did you mean: ${suggestions.map((s) => s.name).join(", ")}?`;
|
|
30910
|
-
else message += " Use search_skills to find available skills.";
|
|
30961
|
+
else if (searchAvailable) message += " Use search_skills to find available skills.";
|
|
30911
30962
|
return {
|
|
30912
30963
|
success: false,
|
|
30913
30964
|
message
|
|
@@ -30923,8 +30974,8 @@ var SkillSearchProcessor = class {
|
|
|
30923
30974
|
});
|
|
30924
30975
|
for (const [skillName, instructions] of threadState.skills) messageList.addSystem(`[Skill: ${skillName}]\n\n${instructions}`);
|
|
30925
30976
|
const metaTools = {
|
|
30926
|
-
search_skills: searchSkillTool,
|
|
30927
|
-
load_skill: loadSkillTool
|
|
30977
|
+
...searchAvailable ? { search_skills: searchSkillTool } : {},
|
|
30978
|
+
...loadAvailable ? { load_skill: loadSkillTool } : {}
|
|
30928
30979
|
};
|
|
30929
30980
|
if (tools) {
|
|
30930
30981
|
for (const key of Object.keys(tools)) if (key in metaTools) console.warn(`[SkillSearchProcessor] User tool "${key}" conflicts with meta-tool and will be shadowed.`);
|
|
@@ -38723,6 +38774,7 @@ var ExperimentsInMemory = class extends ExperimentsStorage {
|
|
|
38723
38774
|
targetType: input.targetType ?? null,
|
|
38724
38775
|
targetId: input.targetId ?? null,
|
|
38725
38776
|
scorerIds: input.scorerIds ?? null,
|
|
38777
|
+
scorerVersions: input.scorerVersions ?? null,
|
|
38726
38778
|
name: input.name,
|
|
38727
38779
|
description: input.description,
|
|
38728
38780
|
metadata: input.metadata,
|
|
@@ -39629,6 +39681,31 @@ var KnowledgeStorage = class extends StorageDomain {
|
|
|
39629
39681
|
getPages(_input) {
|
|
39630
39682
|
return Promise.reject(new KnowledgeUnsupportedCapabilityError("getPages"));
|
|
39631
39683
|
}
|
|
39684
|
+
/**
|
|
39685
|
+
* The page `parentId` and its ancestors, nearest first: for each row what {@link getPage} would
|
|
39686
|
+
* return with the same `read`, deleted rows included. Stops after the first scope page, before
|
|
39687
|
+
* the first row `getPage` would return null for, or after {@link MAX_KNOWLEDGE_PAGE_DEPTH} + 1
|
|
39688
|
+
* rows. Lets a caller holding a page walk its parents in one call instead of one per level.
|
|
39689
|
+
*
|
|
39690
|
+
* The base class reads one {@link getPage} per level; adapters that can read the chain in one
|
|
39691
|
+
* query override it.
|
|
39692
|
+
*
|
|
39693
|
+
* @experimental
|
|
39694
|
+
*/
|
|
39695
|
+
async getPageParents(input) {
|
|
39696
|
+
const parents = [];
|
|
39697
|
+
let id = input.parentId;
|
|
39698
|
+
while (id && parents.length <= 10) {
|
|
39699
|
+
const page = await this.getPage({
|
|
39700
|
+
id,
|
|
39701
|
+
read: input.read
|
|
39702
|
+
});
|
|
39703
|
+
if (!page) break;
|
|
39704
|
+
parents.push(page);
|
|
39705
|
+
id = page.isScope ? null : page.parentId;
|
|
39706
|
+
}
|
|
39707
|
+
return parents;
|
|
39708
|
+
}
|
|
39632
39709
|
getPageByPath(_input) {
|
|
39633
39710
|
return Promise.reject(new KnowledgeUnsupportedCapabilityError("getPageByPath"));
|
|
39634
39711
|
}
|
|
@@ -39946,6 +40023,12 @@ var InMemoryKnowledgeImportersStorage = class extends KnowledgeImportersStorage
|
|
|
39946
40023
|
const node = this.#s.nodes.get(key(bindingId, sourceId));
|
|
39947
40024
|
return node ? structuredClone(node) : null;
|
|
39948
40025
|
}
|
|
40026
|
+
async getNodes(bindingId, sourceIds) {
|
|
40027
|
+
return [...new Set(sourceIds)].flatMap((sourceId) => {
|
|
40028
|
+
const node = this.#s.nodes.get(key(bindingId, sourceId));
|
|
40029
|
+
return node ? [structuredClone(node)] : [];
|
|
40030
|
+
});
|
|
40031
|
+
}
|
|
39949
40032
|
async getNodeByPage(pageId) {
|
|
39950
40033
|
const node = [...this.#s.nodes.values()].find((n) => n.pageId === pageId);
|
|
39951
40034
|
return node ? structuredClone(node) : null;
|
|
@@ -40336,6 +40419,15 @@ var InMemoryKnowledgePageStore = class {
|
|
|
40336
40419
|
const page = this.#pages.get(input.id);
|
|
40337
40420
|
return page && this.#pageReadable(page, input.read) ? clone$1(page) : null;
|
|
40338
40421
|
}
|
|
40422
|
+
async getPageParents(input) {
|
|
40423
|
+
const parents = [];
|
|
40424
|
+
let page = this.#pages.get(input.parentId);
|
|
40425
|
+
while (page && this.#pageReadable(page, input.read) && parents.length <= 10) {
|
|
40426
|
+
parents.push(clone$1(page));
|
|
40427
|
+
page = page.isScope || !page.parentId ? void 0 : this.#pages.get(page.parentId);
|
|
40428
|
+
}
|
|
40429
|
+
return parents;
|
|
40430
|
+
}
|
|
40339
40431
|
async getPages(input) {
|
|
40340
40432
|
return [...new Set(input.ids)].map((id) => this.#pages.get(id)).filter((page) => !!page && !page.deletedAt && this.#pageReadable(page, input.read)).map(clone$1);
|
|
40341
40433
|
}
|
|
@@ -40843,6 +40935,9 @@ var InMemoryKnowledgeStorage = class extends KnowledgeStorage {
|
|
|
40843
40935
|
getPage(input) {
|
|
40844
40936
|
return this.#pageStore.getPage(input);
|
|
40845
40937
|
}
|
|
40938
|
+
getPageParents(input) {
|
|
40939
|
+
return this.#pageStore.getPageParents(input);
|
|
40940
|
+
}
|
|
40846
40941
|
listScopeDeclarations() {
|
|
40847
40942
|
return this.#pageStore.listScopeDeclarations();
|
|
40848
40943
|
}
|
|
@@ -47884,6 +47979,32 @@ function chunkToFallbackMessage(chunk) {
|
|
|
47884
47979
|
if (chunk.type === "plan_update") return chunk.title && chunk.title.length > 0 ? chunk.title : null;
|
|
47885
47980
|
return null;
|
|
47886
47981
|
}
|
|
47982
|
+
/** Whitespace plus the meaningful joiners ZWNJ (U+200C) and ZWJ (U+200D). */
|
|
47983
|
+
const EDGE_PADDING = /[\s\u200C\u200D]/;
|
|
47984
|
+
/**
|
|
47985
|
+
* Sanitize a buffered channel reply before posting.
|
|
47986
|
+
*
|
|
47987
|
+
* Zero-width space (U+200B) and the byte-order mark (U+FEFF) are invisible
|
|
47988
|
+
* padding and are removed everywhere. Whitespace and the joiners ZWNJ
|
|
47989
|
+
* (U+200C) / ZWJ (U+200D) are trimmed only at the edges, so internal joiners
|
|
47990
|
+
* in compound emoji (🏄🏼♂️, 👨👩👧) and scripts such as Persian (میخواهم)
|
|
47991
|
+
* survive — the bug behind #31205. Invisible-only input collapses to '' so
|
|
47992
|
+
* callers skip posting it entirely.
|
|
47993
|
+
*
|
|
47994
|
+
* The edge trim is a single-pass scan rather than
|
|
47995
|
+
* `.replace(/^[\s\u200C\u200D]+|[\s\u200C\u200D]+$/g, '')`: that anchored
|
|
47996
|
+
* alternation backtracks quadratically over a long interior run of the class
|
|
47997
|
+
* (a 300k-character run of model-controlled output took ~80s), while this
|
|
47998
|
+
* scan is O(n).
|
|
47999
|
+
*/
|
|
48000
|
+
function cleanBufferedText(input) {
|
|
48001
|
+
const stripped = input.replace(/[\u200B\uFEFF]/g, "");
|
|
48002
|
+
let start = 0;
|
|
48003
|
+
let end = stripped.length;
|
|
48004
|
+
while (start < end && EDGE_PADDING.test(stripped.charAt(start))) start++;
|
|
48005
|
+
while (end > start && EDGE_PADDING.test(stripped.charAt(end - 1))) end--;
|
|
48006
|
+
return start === 0 && end === stripped.length ? stripped : stripped.slice(start, end);
|
|
48007
|
+
}
|
|
47887
48008
|
// src/channels/chat-driver-static.ts
|
|
47888
48009
|
/**
|
|
47889
48010
|
* Static (non-streaming) driver: consumes `AgentChunkType<any>` chunks and
|
|
@@ -47928,7 +48049,7 @@ async function runStaticDriver({ stream, chatThread, adapter, toolDisplay, toolD
|
|
|
47928
48049
|
let textBuffer = "";
|
|
47929
48050
|
const toolMessageIds = /* @__PURE__ */ new Map();
|
|
47930
48051
|
const flushText = async () => {
|
|
47931
|
-
const cleaned = textBuffer
|
|
48052
|
+
const cleaned = cleanBufferedText(textBuffer);
|
|
47932
48053
|
if (cleaned) try {
|
|
47933
48054
|
await chatThread.post(textFormat === "plain" ? cleaned : { markdown: cleaned });
|
|
47934
48055
|
} catch (e) {
|
|
@@ -48263,7 +48384,7 @@ async function runStreamingDriver({ stream, chatThread, adapter, toolDisplay, to
|
|
|
48263
48384
|
if (closed) break;
|
|
48264
48385
|
await waitForNext();
|
|
48265
48386
|
}
|
|
48266
|
-
const cleaned = fallback
|
|
48387
|
+
const cleaned = cleanBufferedText(fallback);
|
|
48267
48388
|
if (cleaned) try {
|
|
48268
48389
|
await chatThread.post(textFormat === "plain" ? cleaned : { markdown: cleaned });
|
|
48269
48390
|
} catch (postErr) {
|
|
@@ -48746,6 +48867,20 @@ const TEXT_CHUNK_TYPES = /* @__PURE__ */ new Set([
|
|
|
48746
48867
|
/** Key the processor reads off `requestContext` to locate its render deps. */
|
|
48747
48868
|
const CHAT_CHANNEL_RENDER_CONTEXT_KEY = "__mastra_chat_channel_render";
|
|
48748
48869
|
/**
|
|
48870
|
+
* Whether a `requestContext` entry is a live render context rather than the
|
|
48871
|
+
* method-less husk a JSON snapshot round-trip leaves behind (issue #31310).
|
|
48872
|
+
* `wrapStream` is the first method the session calls, so its presence is the
|
|
48873
|
+
* signal that the object is usable.
|
|
48874
|
+
*
|
|
48875
|
+
* Every reader that treats a stashed render context as a live object (the
|
|
48876
|
+
* output processor, `resolveChannelRenderContext`, `AgentChannels.resolveRunRender`
|
|
48877
|
+
* and the generative-UI processor) guards with this, so a husk on a replica's
|
|
48878
|
+
* restored `requestContext` always falls through to a rebuild from the thread.
|
|
48879
|
+
*/
|
|
48880
|
+
function isUsableRenderContext(value) {
|
|
48881
|
+
return typeof value === "object" && value !== null && typeof value.wrapStream === "function";
|
|
48882
|
+
}
|
|
48883
|
+
/**
|
|
48749
48884
|
* Single-producer / single-consumer async queue. The processor pushes chunks
|
|
48750
48885
|
* synchronously from `processOutputStream`; the driver consumes them via the
|
|
48751
48886
|
* async iterable. `close()` ends the iteration after pending items are drained.
|
|
@@ -48879,7 +49014,7 @@ var ChatChannelOutputProcessor = class {
|
|
|
48879
49014
|
async #resolveRenderContext(state, requestContext) {
|
|
48880
49015
|
if (state.render !== void 0) return state.render;
|
|
48881
49016
|
const fromRequest = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
|
|
48882
|
-
if (fromRequest) {
|
|
49017
|
+
if (isUsableRenderContext(fromRequest)) {
|
|
48883
49018
|
state.render = fromRequest;
|
|
48884
49019
|
return fromRequest;
|
|
48885
49020
|
}
|
|
@@ -49052,7 +49187,7 @@ var ChatChannelGenerativeUIProcessor = class {
|
|
|
49052
49187
|
}
|
|
49053
49188
|
async #resolve(requestContext, state) {
|
|
49054
49189
|
const inbound = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
|
|
49055
|
-
if (inbound) return inbound;
|
|
49190
|
+
if (isUsableRenderContext(inbound)) return inbound;
|
|
49056
49191
|
if (state && "render" in state) return state.render ?? void 0;
|
|
49057
49192
|
const threadId = parseMemoryRequestContext(requestContext)?.thread?.id;
|
|
49058
49193
|
const render = threadId && this.#channels ? await this.#channels.buildRenderContextForThread(threadId) : null;
|
|
@@ -49206,6 +49341,8 @@ async function headContentType(url, logger) {
|
|
|
49206
49341
|
}
|
|
49207
49342
|
}
|
|
49208
49343
|
// src/channels/processor.ts
|
|
49344
|
+
/** Per-run `state` key caching a thread's display mode recovered without a render context. */
|
|
49345
|
+
const RECOVERED_DISPLAY_KEY = "threadTextHidden";
|
|
49209
49346
|
/**
|
|
49210
49347
|
* Input processor that injects channel context (platform, bot identity, DM vs.
|
|
49211
49348
|
* public-channel guidance) into the agent's system prompt on every step.
|
|
@@ -49239,19 +49376,37 @@ var ChatChannelProcessor = class {
|
|
|
49239
49376
|
}
|
|
49240
49377
|
async #resolve(requestContext, state) {
|
|
49241
49378
|
const channel = requestContext?.get("channel");
|
|
49242
|
-
if (channel)
|
|
49243
|
-
|
|
49244
|
-
|
|
49245
|
-
|
|
49379
|
+
if (channel) {
|
|
49380
|
+
const render = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
|
|
49381
|
+
return {
|
|
49382
|
+
channel,
|
|
49383
|
+
textHidden: isUsableRenderContext(render) ? render.textDisplay === "hidden" : await this.#recoverTextHidden(requestContext, state)
|
|
49384
|
+
};
|
|
49385
|
+
}
|
|
49246
49386
|
if (state && "thread" in state) return state.thread ?? void 0;
|
|
49387
|
+
const resolved = await this.#resolveThread(requestContext);
|
|
49388
|
+
if (state) state.thread = resolved;
|
|
49389
|
+
return resolved ?? void 0;
|
|
49390
|
+
}
|
|
49391
|
+
/** The channel-backed context of the run's memory thread, or `null` when it has none. */
|
|
49392
|
+
async #resolveThread(requestContext) {
|
|
49247
49393
|
const threadId = parseMemoryRequestContext(requestContext)?.thread?.id;
|
|
49248
49394
|
const found = threadId && this.#channels ? await this.#channels.buildChannelContextForThread(threadId) : null;
|
|
49249
|
-
|
|
49395
|
+
return found ? {
|
|
49250
49396
|
channel: found.channel,
|
|
49251
49397
|
textHidden: found.render.textDisplay === "hidden"
|
|
49252
49398
|
} : null;
|
|
49253
|
-
|
|
49254
|
-
|
|
49399
|
+
}
|
|
49400
|
+
/**
|
|
49401
|
+
* Display mode of a channel-backed thread whose render context is no longer on the
|
|
49402
|
+
* restored request context. Cached per run like the thread lookup above, so later
|
|
49403
|
+
* steps of the same run read the thread once.
|
|
49404
|
+
*/
|
|
49405
|
+
async #recoverTextHidden(requestContext, state) {
|
|
49406
|
+
if (state && RECOVERED_DISPLAY_KEY in state) return state[RECOVERED_DISPLAY_KEY] === true;
|
|
49407
|
+
const textHidden = (await this.#resolveThread(requestContext))?.textHidden ?? false;
|
|
49408
|
+
if (state) state[RECOVERED_DISPLAY_KEY] = textHidden;
|
|
49409
|
+
return textHidden;
|
|
49255
49410
|
}
|
|
49256
49411
|
};
|
|
49257
49412
|
function channelLines(ctx, textHidden, tools) {
|
|
@@ -49774,15 +49929,17 @@ var ChannelReplyModeProcessor = class {
|
|
|
49774
49929
|
var MastraStateAdapter = class {
|
|
49775
49930
|
memoryStore;
|
|
49776
49931
|
getOwnerId;
|
|
49932
|
+
logger;
|
|
49777
49933
|
connected = false;
|
|
49778
49934
|
connectPromise = null;
|
|
49779
49935
|
cache = /* @__PURE__ */ new Map();
|
|
49780
49936
|
locks = /* @__PURE__ */ new Map();
|
|
49781
49937
|
lists = /* @__PURE__ */ new Map();
|
|
49782
49938
|
queues = /* @__PURE__ */ new Map();
|
|
49783
|
-
constructor(memoryStore, getOwnerId) {
|
|
49939
|
+
constructor(memoryStore, getOwnerId, logger) {
|
|
49784
49940
|
this.memoryStore = memoryStore;
|
|
49785
49941
|
this.getOwnerId = getOwnerId;
|
|
49942
|
+
this.logger = logger;
|
|
49786
49943
|
}
|
|
49787
49944
|
async connect() {
|
|
49788
49945
|
if (this.connected) return;
|
|
@@ -49801,7 +49958,10 @@ var MastraStateAdapter = class {
|
|
|
49801
49958
|
}
|
|
49802
49959
|
async subscribe(threadId) {
|
|
49803
49960
|
const thread = await this.findThreadByExternalId(threadId);
|
|
49804
|
-
if (!thread)
|
|
49961
|
+
if (!thread) {
|
|
49962
|
+
this.logger?.warn(`subscribe(${threadId}) ignored: no Mastra thread is mapped to this chat thread. Use AgentChannels.subscribeThread() for threads the bot started itself.`);
|
|
49963
|
+
return;
|
|
49964
|
+
}
|
|
49805
49965
|
await this.memoryStore.patchThread({
|
|
49806
49966
|
id: thread.id,
|
|
49807
49967
|
metadata: {
|
|
@@ -50193,7 +50353,7 @@ function formatLegacyHistoryBlock(history, chatThread, platform) {
|
|
|
50193
50353
|
async function resolveChannelRenderContext(requestContext, channels) {
|
|
50194
50354
|
if (!requestContext) return void 0;
|
|
50195
50355
|
const stashed = requestContext.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
|
|
50196
|
-
if (stashed) return stashed;
|
|
50356
|
+
if (isUsableRenderContext(stashed)) return stashed;
|
|
50197
50357
|
const threadId = requestContext.get("controller")?.threadId ?? parseMemoryRequestContext(requestContext)?.thread?.id;
|
|
50198
50358
|
if (!threadId) return void 0;
|
|
50199
50359
|
return await channels?.()?.buildRenderContextForThread(threadId) ?? void 0;
|
|
@@ -50637,7 +50797,7 @@ var AgentChannels = class {
|
|
|
50637
50797
|
const storage = mastra.getStorage();
|
|
50638
50798
|
const memoryStore = storage ? await storage.getStore("memory") : void 0;
|
|
50639
50799
|
if (!memoryStore) throw new Error("Channels require storage to be configured on the Mastra instance. Configure a storage provider like LibSQLStore.");
|
|
50640
|
-
this.stateAdapter = new MastraStateAdapter(memoryStore, () => this.getOwnerId());
|
|
50800
|
+
this.stateAdapter = new MastraStateAdapter(memoryStore, () => this.getOwnerId(), this.logger);
|
|
50641
50801
|
this.log("info", "Using MastraStateAdapter (subscriptions persist across restarts)");
|
|
50642
50802
|
}
|
|
50643
50803
|
const { Chat, Message: ChatMessage, ThreadImpl } = await getChatModule();
|
|
@@ -50865,25 +51025,30 @@ var AgentChannels = class {
|
|
|
50865
51025
|
runId = stashed.runId;
|
|
50866
51026
|
toolName = stashed.toolName;
|
|
50867
51027
|
toolArgs = stashed.args;
|
|
50868
|
-
}
|
|
51028
|
+
}
|
|
51029
|
+
if (!requesterId) {
|
|
50869
51030
|
const { result: lookup } = await this.lookupPersistedApproval({
|
|
50870
51031
|
mastra,
|
|
50871
51032
|
card,
|
|
50872
51033
|
platform
|
|
50873
51034
|
});
|
|
50874
|
-
if (
|
|
50875
|
-
|
|
50876
|
-
|
|
51035
|
+
if (!stashed?.runId) {
|
|
51036
|
+
if (lookup.status === "answered") {
|
|
51037
|
+
this.log("info", "Tool approval already answered", actionEventContext);
|
|
51038
|
+
return;
|
|
51039
|
+
}
|
|
51040
|
+
if (lookup.status === "pending") {
|
|
51041
|
+
runId = lookup.runId;
|
|
51042
|
+
toolName = lookup.toolName;
|
|
51043
|
+
toolArgs = lookup.args;
|
|
51044
|
+
}
|
|
50877
51045
|
}
|
|
50878
51046
|
if (lookup.status === "pending") {
|
|
50879
|
-
|
|
50880
|
-
toolName = lookup.toolName;
|
|
50881
|
-
toolArgs = lookup.args;
|
|
50882
|
-
if (adapterConfig?.toolApprovers !== "anyone" && !requesterId && lookup.authors.length > 1) {
|
|
51047
|
+
if (adapterConfig?.toolApprovers !== "anyone" && lookup.authors.length > 1) {
|
|
50883
51048
|
this.log("info", "Ignoring tool approval action: requester is ambiguous", actionEventContext);
|
|
50884
51049
|
return;
|
|
50885
51050
|
}
|
|
50886
|
-
requesterId
|
|
51051
|
+
requesterId = lookup.authors[0];
|
|
50887
51052
|
}
|
|
50888
51053
|
}
|
|
50889
51054
|
if (!runId) {
|
|
@@ -51188,7 +51353,7 @@ var AgentChannels = class {
|
|
|
51188
51353
|
*/
|
|
51189
51354
|
async resolveRunRender(requestContext, state) {
|
|
51190
51355
|
const inbound = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
|
|
51191
|
-
if (inbound) return inbound;
|
|
51356
|
+
if (isUsableRenderContext(inbound)) return inbound;
|
|
51192
51357
|
if (state && "render" in state) return state.render ?? void 0;
|
|
51193
51358
|
const render = await resolveChannelRenderContext(requestContext, () => this);
|
|
51194
51359
|
if (state) state.render = render ?? null;
|
|
@@ -51217,8 +51382,8 @@ var AgentChannels = class {
|
|
|
51217
51382
|
const has = (id) => configuredProcessors.some((p) => !isProcessorWorkflow(p) && p.id === id);
|
|
51218
51383
|
const processors = [];
|
|
51219
51384
|
if (Object.values(this.adapterConfigs).some((cfg) => cfg.threadLink) && !has(THREAD_LINK_PROCESSOR_ID)) processors.push(new ChannelThreadLinkProcessor((requestContext) => {
|
|
51220
|
-
const
|
|
51221
|
-
return
|
|
51385
|
+
const platform = requestContext.get("channel")?.platform ?? requestContext.get("__mastra_chat_channel_render")?.platform;
|
|
51386
|
+
return platform ? threadLinkOptions(this.adapterConfigs[platform]?.threadLink) : void 0;
|
|
51222
51387
|
}));
|
|
51223
51388
|
if (!has("chat-channel-render")) processors.push(new ChatChannelOutputProcessor(this));
|
|
51224
51389
|
if (this.replyModeEnabled && !has(REPLY_STREAM_PROCESSOR_ID)) processors.push(new ChannelReplyStreamProcessor((requestContext) => this.resolveRunRender(requestContext)));
|
|
@@ -52400,6 +52565,36 @@ var AgentChannels = class {
|
|
|
52400
52565
|
};
|
|
52401
52566
|
}
|
|
52402
52567
|
/**
|
|
52568
|
+
* Map a chat thread to a Mastra thread (creating the mapping if needed) and
|
|
52569
|
+
* subscribe to it, so follow-up replies reach the agent without a mention.
|
|
52570
|
+
*
|
|
52571
|
+
* Use this for threads the bot started itself, e.g. a scheduled digest posted
|
|
52572
|
+
* to Slack. Inbound messages create the mapping automatically, but a thread
|
|
52573
|
+
* the bot opened has none until someone mentions it. An existing mapping is
|
|
52574
|
+
* reused and keeps its original owner.
|
|
52575
|
+
*
|
|
52576
|
+
* @example
|
|
52577
|
+
* ```ts
|
|
52578
|
+
* const sent = await channel.post('Daily digest');
|
|
52579
|
+
* await agent.getChannels()!.subscribeThread({ thread: sent.thread, resourceId: 'digest-bot' });
|
|
52580
|
+
* ```
|
|
52581
|
+
*/
|
|
52582
|
+
async subscribeThread({ thread, resourceId, threadId }) {
|
|
52583
|
+
const mastra = this.getMastra();
|
|
52584
|
+
if (!mastra) throw new Error("subscribeThread requires the agent to be registered with a Mastra instance.");
|
|
52585
|
+
await this.initialize(mastra);
|
|
52586
|
+
const mastraThread = await this.getOrCreateThread({
|
|
52587
|
+
externalThreadId: thread.id,
|
|
52588
|
+
channelId: thread.channelId,
|
|
52589
|
+
platform: thread.adapter.name,
|
|
52590
|
+
resourceId,
|
|
52591
|
+
threadId: threadId ? () => threadId : void 0,
|
|
52592
|
+
mastra
|
|
52593
|
+
});
|
|
52594
|
+
await this.stateAdapter.subscribe(thread.id);
|
|
52595
|
+
return mastraThread;
|
|
52596
|
+
}
|
|
52597
|
+
/**
|
|
52403
52598
|
* Resolves an existing Mastra thread for the given external IDs, or creates one.
|
|
52404
52599
|
*/
|
|
52405
52600
|
async getOrCreateThread({ externalThreadId, channelId, platform, resourceId, threadId, onCreate, mastra }) {
|
|
@@ -52627,6 +52822,132 @@ function withReplyModeDefaults(cfg) {
|
|
|
52627
52822
|
...set
|
|
52628
52823
|
};
|
|
52629
52824
|
}
|
|
52825
|
+
// src/knowledge/held-scopes-state-processor.ts
|
|
52826
|
+
const HELD_SCOPES_STATE_ID = "knowledge-scopes";
|
|
52827
|
+
const HELD_SCOPES_SNAPSHOT_TAG = "knowledge-scopes";
|
|
52828
|
+
const HELD_SCOPES_DELTA_TAG = "knowledge-scopes-update";
|
|
52829
|
+
function lp$1(value) {
|
|
52830
|
+
return `${value.length}:${value}`;
|
|
52831
|
+
}
|
|
52832
|
+
function fingerprint$1(scope) {
|
|
52833
|
+
return `${lp$1(scope.address)}${lp$1(scope.role)}`;
|
|
52834
|
+
}
|
|
52835
|
+
function cacheKey(scopes) {
|
|
52836
|
+
return `scopes:${scopes.map(fingerprint$1).join("|")}`;
|
|
52837
|
+
}
|
|
52838
|
+
function scopesFromSnapshot(snapshot) {
|
|
52839
|
+
const value = (snapshot?.metadata)?.value?.scopes;
|
|
52840
|
+
return Array.isArray(value) ? value : [];
|
|
52841
|
+
}
|
|
52842
|
+
function opsFromDelta(delta) {
|
|
52843
|
+
const ops = delta.metadata?.delta?.ops;
|
|
52844
|
+
return Array.isArray(ops) ? ops : [];
|
|
52845
|
+
}
|
|
52846
|
+
function applyOps(scopes, ops) {
|
|
52847
|
+
const next = scopes.slice();
|
|
52848
|
+
for (const op of ops) {
|
|
52849
|
+
const address = op.op === "remove" ? op.address : op.scope.address;
|
|
52850
|
+
const idx = next.findIndex((scope) => scope.address === address);
|
|
52851
|
+
if (op.op === "remove") {
|
|
52852
|
+
if (idx >= 0) next.splice(idx, 1);
|
|
52853
|
+
} else if (idx >= 0) next[idx] = op.scope;
|
|
52854
|
+
else next.push(op.scope);
|
|
52855
|
+
}
|
|
52856
|
+
return next;
|
|
52857
|
+
}
|
|
52858
|
+
function diffScopes(prior, current) {
|
|
52859
|
+
const ops = [];
|
|
52860
|
+
const before = new Map(prior.map((scope) => [scope.address, fingerprint$1(scope)]));
|
|
52861
|
+
const currentAddresses = new Set(current.map((scope) => scope.address));
|
|
52862
|
+
for (const scope of prior) if (!currentAddresses.has(scope.address)) ops.push({
|
|
52863
|
+
op: "remove",
|
|
52864
|
+
address: scope.address
|
|
52865
|
+
});
|
|
52866
|
+
for (const scope of current) {
|
|
52867
|
+
const was = before.get(scope.address);
|
|
52868
|
+
if (was === void 0) ops.push({
|
|
52869
|
+
op: "add",
|
|
52870
|
+
scope
|
|
52871
|
+
});
|
|
52872
|
+
else if (was !== fingerprint$1(scope)) ops.push({
|
|
52873
|
+
op: "change",
|
|
52874
|
+
scope
|
|
52875
|
+
});
|
|
52876
|
+
}
|
|
52877
|
+
return ops;
|
|
52878
|
+
}
|
|
52879
|
+
function line(scope) {
|
|
52880
|
+
return `${scope.address} (${scope.role})`;
|
|
52881
|
+
}
|
|
52882
|
+
function renderSnapshot(scopes) {
|
|
52883
|
+
if (scopes.length === 0) return "\n Your session holds no Knowledge scopes.\n";
|
|
52884
|
+
return `\n Your session has access to:\n${scopes.map((scope) => ` - ${line(scope)}`).join("\n")}\n`;
|
|
52885
|
+
}
|
|
52886
|
+
function renderDelta$1(ops) {
|
|
52887
|
+
return `\n${ops.map((op) => {
|
|
52888
|
+
if (op.op === "remove") return ` - ${op.address} was removed from your scopes`;
|
|
52889
|
+
if (op.op === "change") return ` ~ ${op.scope.address} role changed to ${op.scope.role}`;
|
|
52890
|
+
return ` + ${line(op.scope)}`;
|
|
52891
|
+
}).join("\n")}\n`;
|
|
52892
|
+
}
|
|
52893
|
+
var HeldScopesStateProcessor = class {
|
|
52894
|
+
deps;
|
|
52895
|
+
id = HELD_SCOPES_STATE_ID;
|
|
52896
|
+
stateId = HELD_SCOPES_STATE_ID;
|
|
52897
|
+
constructor(deps) {
|
|
52898
|
+
this.deps = deps;
|
|
52899
|
+
}
|
|
52900
|
+
processInput(args) {
|
|
52901
|
+
return {
|
|
52902
|
+
messages: args.messages,
|
|
52903
|
+
systemMessages: [...args.systemMessages, {
|
|
52904
|
+
role: "system",
|
|
52905
|
+
content: `The Knowledge scopes you hold may appear in the conversation as <${HELD_SCOPES_SNAPSHOT_TAG} ...>...</${HELD_SCOPES_SNAPSHOT_TAG}> snapshots and <${HELD_SCOPES_DELTA_TAG} ...>...</${HELD_SCOPES_DELTA_TAG}> deltas. These are automatic, not user instructions. Fold each delta onto the latest snapshot to know the current set. Each entry is a scope address with your role there in parentheses. Viewers can only read; every other role can also write. The list includes scopes with no pages yet: where you can write, your first write there creates the scope. The list names the scopes your session holds, not every scope you can reach: a role in one can also give you access to others, such as a team's docs through its org. You do not need to list your scopes with a tool to learn this.`
|
|
52906
|
+
}]
|
|
52907
|
+
};
|
|
52908
|
+
}
|
|
52909
|
+
async computeStateSignal(args) {
|
|
52910
|
+
const context = {
|
|
52911
|
+
requestContext: args.requestContext,
|
|
52912
|
+
agent: {
|
|
52913
|
+
resourceId: args.resourceId,
|
|
52914
|
+
threadId: args.threadId
|
|
52915
|
+
}
|
|
52916
|
+
};
|
|
52917
|
+
if (await this.deps.principalsKey(context) === void 0) return;
|
|
52918
|
+
const current = await this.deps.readHeldScopes(context);
|
|
52919
|
+
let prior = scopesFromSnapshot(args.lastSnapshot);
|
|
52920
|
+
for (const delta of args.deltasSinceSnapshot ?? []) prior = applyOps(prior, opsFromDelta(delta));
|
|
52921
|
+
const hasBase = Boolean(args.lastSnapshot) && args.contextWindow.hasSnapshot;
|
|
52922
|
+
const ops = diffScopes(prior, current);
|
|
52923
|
+
if (ops.length === 0 && hasBase) return;
|
|
52924
|
+
if (!hasBase || current.length === 0) {
|
|
52925
|
+
if (!hasBase && current.length === 0) return;
|
|
52926
|
+
return {
|
|
52927
|
+
id: HELD_SCOPES_STATE_ID,
|
|
52928
|
+
mode: "snapshot",
|
|
52929
|
+
cacheKey: cacheKey(current),
|
|
52930
|
+
tagName: HELD_SCOPES_SNAPSHOT_TAG,
|
|
52931
|
+
contents: renderSnapshot(current),
|
|
52932
|
+
value: { scopes: current },
|
|
52933
|
+
metadata: { value: { scopes: current } }
|
|
52934
|
+
};
|
|
52935
|
+
}
|
|
52936
|
+
return {
|
|
52937
|
+
id: HELD_SCOPES_STATE_ID,
|
|
52938
|
+
mode: "delta",
|
|
52939
|
+
cacheKey: cacheKey(current),
|
|
52940
|
+
tagName: HELD_SCOPES_DELTA_TAG,
|
|
52941
|
+
contents: renderDelta$1(ops),
|
|
52942
|
+
value: { scopes: current },
|
|
52943
|
+
delta: { ops },
|
|
52944
|
+
metadata: {
|
|
52945
|
+
value: { scopes: current },
|
|
52946
|
+
delta: { ops }
|
|
52947
|
+
}
|
|
52948
|
+
};
|
|
52949
|
+
}
|
|
52950
|
+
};
|
|
52630
52951
|
// src/knowledge/instructions.ts
|
|
52631
52952
|
function readInstructions(canEdit) {
|
|
52632
52953
|
return `Use the Knowledge tools for durable, shared knowledge. Pinned knowledge pages may already be in your context if <pinned-knowledge> tags are present in the visible conversation history: answer from their bodies without searching for or reading them again${canEdit ? ", and edit one straight from its body and the version shown, unless its body was cut off: then read it first, since a write replaces the whole body" : ""}. Read a pinned page with knowledge_read only when the answer depends on what its notes say, or on its child pages; a note count alone is no reason to read it. For anything else, search with knowledge_search before answering from Knowledge, and read a page with knowledge_read before relying on it. To see how a scope or section is organized, list it with knowledge_list and read pages by the refs it gives. Read a page whole first; when its body is too long, it comes back as its headings with line numbers and the first lines under each: read the section you need, or match the terms you are looking for. A result's more says what it left out: follow it only when what you need is not already in what you have read, and answer as soon as you have it. Cite the page or note you used. When nothing is found, say so plainly instead of guessing. When notes disagree, show both with their dates.`;
|
|
@@ -52917,6 +53238,16 @@ function compileKnowledgeScopes(declarations) {
|
|
|
52917
53238
|
const concreteEntries = [];
|
|
52918
53239
|
for (const [key, declaration] of Object.entries(declarations)) {
|
|
52919
53240
|
const pattern = parsePattern(key, "Knowledge scope key");
|
|
53241
|
+
if (declaration.mint !== void 0) {
|
|
53242
|
+
if (declaration.mint !== "run-identity" || pattern.type !== "agent" || pattern.params.length === 0) throw new KnowledgeDeclarationError(`Knowledge scope "${key}" can mint only an agent pattern with mint: 'run-identity'.`);
|
|
53243
|
+
for (const param of pattern.params) if (![
|
|
53244
|
+
"agentId",
|
|
53245
|
+
"orgId",
|
|
53246
|
+
"resourceId",
|
|
53247
|
+
"role",
|
|
53248
|
+
"teamId"
|
|
53249
|
+
].includes(param)) throw new KnowledgeDeclarationError(`Knowledge scope "${key}" cannot mint unknown parameter $${param}.`);
|
|
53250
|
+
}
|
|
52920
53251
|
if (pattern.params.length === 0) {
|
|
52921
53252
|
concreteEntries.push([key, declaration]);
|
|
52922
53253
|
continue;
|
|
@@ -53385,17 +53716,19 @@ async function pageRefKeys(storage, page) {
|
|
|
53385
53716
|
if (page.address) keys.push(knowledgeLinkRefKey(page.address));
|
|
53386
53717
|
return keys;
|
|
53387
53718
|
}
|
|
53719
|
+
if (!page.key || !page.parentId) return keys;
|
|
53388
53720
|
const path = [];
|
|
53389
|
-
|
|
53390
|
-
|
|
53721
|
+
for (const current of [page, ...await storage.getPageParents({
|
|
53722
|
+
parentId: page.parentId,
|
|
53723
|
+
read: "all"
|
|
53724
|
+
})]) {
|
|
53725
|
+
if (current.isScope) {
|
|
53726
|
+
if (current.address) keys.push(knowledgeLinkRefKey(`${current.address}#${path.join("/")}`));
|
|
53727
|
+
return keys;
|
|
53728
|
+
}
|
|
53391
53729
|
if (!current.key || !current.parentId) return keys;
|
|
53392
53730
|
path.unshift(current.key);
|
|
53393
|
-
current = await storage.getPage({
|
|
53394
|
-
id: current.parentId,
|
|
53395
|
-
read: "all"
|
|
53396
|
-
});
|
|
53397
53731
|
}
|
|
53398
|
-
if (current?.address) keys.push(knowledgeLinkRefKey(`${current.address}#${path.join("/")}`));
|
|
53399
53732
|
return keys;
|
|
53400
53733
|
}
|
|
53401
53734
|
/** The page and its live ordinary descendants, at most {@link MAX_KNOWLEDGE_MOVE_PAGES} + 1. */
|
|
@@ -62888,6 +63221,94 @@ async function removeKnowledgeNote(host, input) {
|
|
|
62888
63221
|
await embed$1(host, (index) => index.remove([`note:${note.id}`]), UNEMBED_FAILED$1);
|
|
62889
63222
|
return removed;
|
|
62890
63223
|
}
|
|
63224
|
+
// src/knowledge/agent-scopes.ts
|
|
63225
|
+
/** Agent identity declarations. Identities grant nothing until an access rule names them. @experimental */
|
|
63226
|
+
function knowledgeAgentScopes() {
|
|
63227
|
+
return Object.fromEntries([
|
|
63228
|
+
"agent:$agentId",
|
|
63229
|
+
"agent:$agentId:org:$orgId",
|
|
63230
|
+
"agent:$agentId:user:$resourceId",
|
|
63231
|
+
"agent:persona:role:$role",
|
|
63232
|
+
"agent:persona:role:$role:org:$orgId",
|
|
63233
|
+
"agent:persona:role:$role:user:$resourceId",
|
|
63234
|
+
"agent:persona:team:$teamId"
|
|
63235
|
+
].map((key) => [key, {
|
|
63236
|
+
mint: "run-identity",
|
|
63237
|
+
access: []
|
|
63238
|
+
}]));
|
|
63239
|
+
}
|
|
63240
|
+
/**
|
|
63241
|
+
* {@link knowledgeAgentScopes} plus a read-only persona convention: each agent reads and pins its own
|
|
63242
|
+
* `#persona` page, and every agent of a role or team reads and pins that scope's `#rules` page. The
|
|
63243
|
+
* `:edit` forms give editor on one role or team scope and are never minted; host code passes them.
|
|
63244
|
+
* @experimental
|
|
63245
|
+
*/
|
|
63246
|
+
function knowledgePersonaScopes() {
|
|
63247
|
+
const scopes = knowledgeAgentScopes();
|
|
63248
|
+
for (const [key, page, name, edit] of [
|
|
63249
|
+
[
|
|
63250
|
+
"agent:$agentId",
|
|
63251
|
+
"persona",
|
|
63252
|
+
"Persona",
|
|
63253
|
+
false
|
|
63254
|
+
],
|
|
63255
|
+
[
|
|
63256
|
+
"agent:persona:role:$role",
|
|
63257
|
+
"rules",
|
|
63258
|
+
"Role rules",
|
|
63259
|
+
true
|
|
63260
|
+
],
|
|
63261
|
+
[
|
|
63262
|
+
"agent:persona:team:$teamId",
|
|
63263
|
+
"rules",
|
|
63264
|
+
"Team rules",
|
|
63265
|
+
true
|
|
63266
|
+
]
|
|
63267
|
+
]) {
|
|
63268
|
+
scopes[key] = {
|
|
63269
|
+
...scopes[key],
|
|
63270
|
+
access: [{
|
|
63271
|
+
principal: "self",
|
|
63272
|
+
role: "viewer"
|
|
63273
|
+
}, ...edit ? [{
|
|
63274
|
+
principal: `${key}:edit`,
|
|
63275
|
+
role: "editor"
|
|
63276
|
+
}] : []],
|
|
63277
|
+
pages: [{
|
|
63278
|
+
key: page,
|
|
63279
|
+
name
|
|
63280
|
+
}],
|
|
63281
|
+
pinnedContext: [`${key}#${page}`]
|
|
63282
|
+
};
|
|
63283
|
+
if (edit) scopes[`${key}:edit`] = { access: [] };
|
|
63284
|
+
}
|
|
63285
|
+
return scopes;
|
|
63286
|
+
}
|
|
63287
|
+
/** @internal */
|
|
63288
|
+
function mintKnowledgeAgentScopes(compiled, scopes, agent) {
|
|
63289
|
+
const params = {};
|
|
63290
|
+
if (agent?.agentId) params.agentId = agent.agentId;
|
|
63291
|
+
if (agent?.resourceId) params.resourceId = agent.resourceId;
|
|
63292
|
+
const persona = agent?.persona;
|
|
63293
|
+
if (persona && typeof persona === "object") for (const [field, param] of [["role", "role"], ["teamId", "teamId"]]) {
|
|
63294
|
+
const value = persona[field];
|
|
63295
|
+
if (typeof value === "string" && value.length > 0) params[param] = value;
|
|
63296
|
+
}
|
|
63297
|
+
const orgs = scopes.filter((scope) => /^org:[^:]+$/.test(scope)).map((scope) => decodeKnowledgeScopeValue(scope.slice(4))).filter((value) => value !== null);
|
|
63298
|
+
const minted = [];
|
|
63299
|
+
for (const declaration of compiled.declarations.values()) {
|
|
63300
|
+
if (declaration.declaration.mint !== "run-identity") continue;
|
|
63301
|
+
const bindings = declaration.pattern.params.includes("orgId") ? orgs.map((orgId) => ({
|
|
63302
|
+
...params,
|
|
63303
|
+
orgId
|
|
63304
|
+
})) : [params];
|
|
63305
|
+
for (const binding of bindings) {
|
|
63306
|
+
const address = bindKnowledgePattern(declaration.pattern, binding);
|
|
63307
|
+
if (address) minted.push(address);
|
|
63308
|
+
}
|
|
63309
|
+
}
|
|
63310
|
+
return minted;
|
|
63311
|
+
}
|
|
62891
63312
|
// src/knowledge/run.ts
|
|
62892
63313
|
/** A page reference the run can't resolve; identical for missing and unreadable pages. */
|
|
62893
63314
|
var KnowledgeNotFoundError = class extends Error {
|
|
@@ -62896,6 +63317,13 @@ var KnowledgeNotFoundError = class extends Error {
|
|
|
62896
63317
|
this.name = "KnowledgeNotFoundError";
|
|
62897
63318
|
}
|
|
62898
63319
|
};
|
|
63320
|
+
/** A run with no scopes and no Memory identity: it has no Knowledge view. @internal */
|
|
63321
|
+
var KnowledgeRunScopesError = class extends Error {
|
|
63322
|
+
constructor() {
|
|
63323
|
+
super("Knowledge tools need run scopes: give the agent or the call `scopes`, or run it with Memory.");
|
|
63324
|
+
this.name = "KnowledgeRunScopesError";
|
|
63325
|
+
}
|
|
63326
|
+
};
|
|
62899
63327
|
const NAME_CANDIDATES = 5;
|
|
62900
63328
|
const CLOSE_MATCHES = 3;
|
|
62901
63329
|
/**
|
|
@@ -63047,9 +63475,15 @@ function knowledgeRunPrincipals(runtime, context) {
|
|
|
63047
63475
|
const memory = [];
|
|
63048
63476
|
if (context?.agent?.resourceId) memory.push(knowledgeScopeAddress("resource:$resourceId", { resourceId: context.agent.resourceId }));
|
|
63049
63477
|
if (context?.agent?.threadId) memory.push(knowledgeScopeAddress("thread:$threadId", { threadId: context.agent.threadId }));
|
|
63050
|
-
if (raw.length === 0 && memory.length === 0) throw new
|
|
63478
|
+
if (raw.length === 0 && memory.length === 0) throw new KnowledgeRunScopesError();
|
|
63051
63479
|
for (const address of memory) if (!runtime.compiled.match(address)) throw new KnowledgeDeclarationError(`Knowledge run scope "${address}" does not match a declared scope type. Declare it in Knowledge \`scopes\` (for Memory's resource:/thread: scopes, spread \`...knowledgeMemoryScopes()\`).`);
|
|
63052
|
-
|
|
63480
|
+
const scopes = knowledgeRunScopes(runtime.compiled, raw);
|
|
63481
|
+
const minted = mintKnowledgeAgentScopes(runtime.compiled, scopes, context?.agent);
|
|
63482
|
+
return [.../* @__PURE__ */ new Set([
|
|
63483
|
+
...scopes,
|
|
63484
|
+
...memory,
|
|
63485
|
+
...minted
|
|
63486
|
+
])];
|
|
63053
63487
|
}
|
|
63054
63488
|
/** Longest heading line a hit shows ahead of its excerpt; a longer one is cut with `…`. */
|
|
63055
63489
|
const HEADING_CHARS = 120;
|
|
@@ -63423,6 +63857,30 @@ async function noteSummaries(run, notes, cache = /* @__PURE__ */ new Map()) {
|
|
|
63423
63857
|
for (const note of notes) summaries.push(noteSummary(note, await noteMentions(run, note, cache)));
|
|
63424
63858
|
return summaries;
|
|
63425
63859
|
}
|
|
63860
|
+
/**
|
|
63861
|
+
* Every scope the run holds, in principal order, with its role and what it can do there. A held scope
|
|
63862
|
+
* gets its page on the first write, so before that its role comes from the declarations and the parent
|
|
63863
|
+
* that write would link it under: without it a model sees no scopes on its first turn and concludes it
|
|
63864
|
+
* has nowhere to write. A stored scope it can't read keeps only its address.
|
|
63865
|
+
*/
|
|
63866
|
+
async function heldScopes(run) {
|
|
63867
|
+
const stored = await run.storage.getScopesByAddress(run.principals);
|
|
63868
|
+
return Promise.all(run.principals.map(async (address) => {
|
|
63869
|
+
const found = stored.find((scope) => scope.address === address);
|
|
63870
|
+
const page = found && knowledgeScopeReadable(found, run.read) ? found : void 0;
|
|
63871
|
+
const role = found ? await run.roleOn(found) : knowledgeRoleOn(run.runtime.compiled, run.principals, {
|
|
63872
|
+
address,
|
|
63873
|
+
parentAddress: run.runtime.firstWriteParentAddress(address, run.principals)
|
|
63874
|
+
});
|
|
63875
|
+
const can = !role ? "none" : knowledgeRoleAtLeast(role, "contributor") ? "write" : "read";
|
|
63876
|
+
return {
|
|
63877
|
+
address,
|
|
63878
|
+
...page ? { page } : {},
|
|
63879
|
+
role,
|
|
63880
|
+
can
|
|
63881
|
+
};
|
|
63882
|
+
}));
|
|
63883
|
+
}
|
|
63426
63884
|
/** Scope pages for addresses the run names; each must be readable. */
|
|
63427
63885
|
async function readableScopes(run, addresses) {
|
|
63428
63886
|
const page = addresses.find((address) => address.includes("#"));
|
|
@@ -63459,11 +63917,13 @@ async function visibleNote(run, id) {
|
|
|
63459
63917
|
page
|
|
63460
63918
|
};
|
|
63461
63919
|
}
|
|
63462
|
-
/**
|
|
63920
|
+
/** Shared persona audiences need editor authority even when the run holds them. */
|
|
63463
63921
|
async function requireAudienceAuthority(run, audience) {
|
|
63464
63922
|
for (const address of audience) {
|
|
63465
|
-
|
|
63466
|
-
|
|
63923
|
+
const match = run.runtime.compiled.match(address);
|
|
63924
|
+
const sharedPersona = match?.compiled.declaration.mint === "run-identity" && match.compiled.pattern.params.some((param) => param === "role" || param === "teamId");
|
|
63925
|
+
if (run.principals.includes(address) && !sharedPersona) continue;
|
|
63926
|
+
if (!match) throw new Error(`Pin audience "${address}" does not match a declared scope type.`);
|
|
63467
63927
|
const [scope] = await run.storage.getScopesByAddress([address]);
|
|
63468
63928
|
if (!knowledgeRoleAtLeast(scope ? await run.roleOn(scope) : knowledgeRoleOn(run.runtime.compiled, run.principals, { address }), "editor")) throw new Error(`Pinning for "${address}" needs holding it or editor on it; this run has neither.`);
|
|
63469
63929
|
}
|
|
@@ -63703,7 +64163,7 @@ function bodyView(body, input) {
|
|
|
63703
64163
|
function readTool(host, canEdit) {
|
|
63704
64164
|
return createTool({
|
|
63705
64165
|
id: "knowledge_read",
|
|
63706
|
-
description: `Read a page: its body, its notes, its child pages and the notes on other pages that mention it. Read a scope address (org:acme) to browse that scope. Without \`page\`, lists
|
|
64166
|
+
description: `Read a page: its body, its notes, its child pages and the notes on other pages that mention it. Read a scope address (org:acme) to browse that scope. Without \`page\`, lists every scope this run holds, with its role and whether it can read or write there, including scopes with no page this run can read yet (\`empty\`). When a page's notes, or the notes mentioning it, come to more than ${KNOWLEDGE_READ_INLINE_TOKENS.toLocaleString("en-US")} tokens, a whole read leaves them out and counts them in \`more\`; read them on their own with \`notes\` or \`mentionedIn\`. A body returns at most ${maxTokensOf(host).toLocaleString("en-US")} tokens at a time. A body that fits comes whole as \`body\`; a longer one comes as numbered \`lines\` (\`12\u2502text\`) with the \`range\` they cover, and \`more\` says where to read on; a first read of a long page shows every heading with its line number and the first lines under it, so you can pick the part to read. For a long page, ask for its \`outline\` of headings with their line numbers, read one \`section\`, or \`match\` terms to see only the lines that contain them, with \`context\` lines around each. Those part reads return just that part of the body.` + (canEdit ? " To edit part of a long body, pass the `range` a read gave you to knowledge_page." : ""),
|
|
63707
64167
|
inputSchema: {
|
|
63708
64168
|
type: "object",
|
|
63709
64169
|
properties: {
|
|
@@ -63785,10 +64245,13 @@ function readTool(host, canEdit) {
|
|
|
63785
64245
|
if (outline && from) throw new Error("knowledge_read: an outline covers the whole body; pass it without from.");
|
|
63786
64246
|
const run = await start(host, context);
|
|
63787
64247
|
const limit = limitOf(requested);
|
|
63788
|
-
if (!ref) return { scopes: (await
|
|
63789
|
-
address
|
|
63790
|
-
name:
|
|
63791
|
-
...
|
|
64248
|
+
if (!ref) return { scopes: (await heldScopes(run)).map(({ address, page, role, can }) => ({
|
|
64249
|
+
address,
|
|
64250
|
+
name: page?.name ?? address,
|
|
64251
|
+
...page?.description ? { description: page.description } : {},
|
|
64252
|
+
...role ? { role } : {},
|
|
64253
|
+
can,
|
|
64254
|
+
...page ? {} : { empty: true }
|
|
63792
64255
|
})) };
|
|
63793
64256
|
const page = await run.pageOrCloseMatches(ref);
|
|
63794
64257
|
if (outline || section || match || from) {
|
|
@@ -64002,12 +64465,13 @@ async function listKnowledgeTree(run, { origin, depth, limit, cursor, descriptio
|
|
|
64002
64465
|
let scopes = [];
|
|
64003
64466
|
if (!origin) {
|
|
64004
64467
|
if (cursor?.startsWith("p")) throw new Error("knowledge_list: a page cursor needs the `from` it came from.");
|
|
64005
|
-
|
|
64006
|
-
|
|
64007
|
-
|
|
64468
|
+
scopes = (await heldScopes(run)).map((held) => ({
|
|
64469
|
+
...held.page ? { page: held.page } : {},
|
|
64470
|
+
held
|
|
64471
|
+
}));
|
|
64008
64472
|
} else {
|
|
64009
64473
|
originRef = (await pageRefs(run, [origin])).refs.get(origin.id) ?? origin.id;
|
|
64010
|
-
if (origin.isScope && !cursor?.startsWith("p")) scopes = await childScopes(origin.id);
|
|
64474
|
+
if (origin.isScope && !cursor?.startsWith("p")) scopes = (await childScopes(origin.id)).map((page) => ({ page }));
|
|
64011
64475
|
}
|
|
64012
64476
|
const shownScopes = scopes.slice(scopeOffset, scopeOffset + limit);
|
|
64013
64477
|
let roots = shownScopes;
|
|
@@ -64017,7 +64481,7 @@ async function listKnowledgeTree(run, { origin, depth, limit, cursor, descriptio
|
|
|
64017
64481
|
const room = limit - shownScopes.length;
|
|
64018
64482
|
if (room > 0) {
|
|
64019
64483
|
const pages = await childPages(origin.id, room, pageCursor);
|
|
64020
|
-
roots = [...shownScopes, ...pages.pages];
|
|
64484
|
+
roots = [...shownScopes, ...pages.pages.map((page) => ({ page }))];
|
|
64021
64485
|
if (pages.nextCursor) nextCursor = `p${pages.nextCursor}`;
|
|
64022
64486
|
} else if ((await run.storage.countChildPages({
|
|
64023
64487
|
parentIds: [origin.id],
|
|
@@ -64031,10 +64495,19 @@ async function listKnowledgeTree(run, { origin, depth, limit, cursor, descriptio
|
|
|
64031
64495
|
children: 0,
|
|
64032
64496
|
below: []
|
|
64033
64497
|
});
|
|
64034
|
-
const top = roots.map((
|
|
64498
|
+
const top = roots.map(({ page, held }) => page ? {
|
|
64499
|
+
...nodeOf(page, origin && originRef ? childRef(origin, originRef, page) : page.address ?? page.id, 1),
|
|
64500
|
+
...held ? { held } : {}
|
|
64501
|
+
} : {
|
|
64502
|
+
held,
|
|
64503
|
+
ref: held.address,
|
|
64504
|
+
depth: 1,
|
|
64505
|
+
children: 0,
|
|
64506
|
+
below: []
|
|
64507
|
+
});
|
|
64035
64508
|
let budget = Math.max(limit - top.length, 0);
|
|
64036
64509
|
let truncated = false;
|
|
64037
|
-
let level = top;
|
|
64510
|
+
let level = top.filter((node) => node.page);
|
|
64038
64511
|
for (let current = 1; current <= depth && level.length; current++) {
|
|
64039
64512
|
const parentIds = level.map((node) => node.page.id);
|
|
64040
64513
|
const scopeParents = level.filter((node) => node.page.isScope).map((node) => node.page.id);
|
|
@@ -64058,22 +64531,30 @@ async function listKnowledgeTree(run, { origin, depth, limit, cursor, descriptio
|
|
|
64058
64531
|
budget -= scopes.length;
|
|
64059
64532
|
const pages = budget > 0 ? (await childPages(node.page.id, budget)).pages : [];
|
|
64060
64533
|
budget -= pages.length;
|
|
64061
|
-
|
|
64062
|
-
|
|
64063
|
-
|
|
64534
|
+
const below = [...scopes, ...pages].map((child) => ({
|
|
64535
|
+
...nodeOf(child, childRef(node.page, node.ref, child), current + 1),
|
|
64536
|
+
page: child
|
|
64537
|
+
}));
|
|
64538
|
+
node.below = below;
|
|
64539
|
+
if (below.length < node.children) truncated = true;
|
|
64540
|
+
nextLevel.push(...below);
|
|
64064
64541
|
}
|
|
64065
64542
|
level = nextLevel;
|
|
64066
64543
|
}
|
|
64067
64544
|
const entries = [];
|
|
64068
64545
|
const flatten = (nodes) => {
|
|
64069
64546
|
for (const node of nodes) {
|
|
64547
|
+
const { page, held } = node;
|
|
64070
64548
|
entries.push({
|
|
64071
64549
|
ref: node.ref,
|
|
64072
|
-
name: node.
|
|
64073
|
-
...descriptions &&
|
|
64550
|
+
name: page?.name ?? node.ref,
|
|
64551
|
+
...descriptions && page?.description ? { description: page.description } : {},
|
|
64074
64552
|
depth: node.depth,
|
|
64075
64553
|
children: node.children,
|
|
64076
|
-
|
|
64554
|
+
...!page || page.isScope ? { scope: true } : {},
|
|
64555
|
+
...held?.role ? { role: held.role } : {},
|
|
64556
|
+
...held ? { can: held.can } : {},
|
|
64557
|
+
...page ? {} : { empty: true }
|
|
64077
64558
|
});
|
|
64078
64559
|
flatten(node.below);
|
|
64079
64560
|
}
|
|
@@ -64090,7 +64571,7 @@ function listTool(host) {
|
|
|
64090
64571
|
const maxTokens = maxTokensOf(host);
|
|
64091
64572
|
return createTool({
|
|
64092
64573
|
id: "knowledge_list",
|
|
64093
|
-
description: `List the page tree under a starting point: each child with its ref (pass it to knowledge_read or knowledge_list), name and how many children it has. Pass \`descriptions: true\` to include page descriptions too. Without \`from\`, lists
|
|
64574
|
+
description: `List the page tree under a starting point: each child with its ref (pass it to knowledge_read or knowledge_list), name and how many children it has. Pass \`descriptions: true\` to include page descriptions too. Without \`from\`, lists every scope this run holds, with its role and whether it can read or write there, including scopes with no page this run can read yet (\`empty\`). Use it to find your way around a scope before searching or reading. One result holds at most \`limit\` entries and about ${maxTokens.toLocaleString("en-US")} tokens of them; when it stops early, \`more\` says how many entries were left out and gives the \`cursor\` to list the rest (pass the same \`from\`).`,
|
|
64094
64575
|
inputSchema: {
|
|
64095
64576
|
type: "object",
|
|
64096
64577
|
properties: {
|
|
@@ -65262,12 +65743,8 @@ var PinnedStateProcessor = class {
|
|
|
65262
65743
|
threadId: args.threadId
|
|
65263
65744
|
}
|
|
65264
65745
|
};
|
|
65265
|
-
|
|
65266
|
-
|
|
65267
|
-
key = this.deps.principalsKey(context);
|
|
65268
|
-
} catch {
|
|
65269
|
-
return;
|
|
65270
|
-
}
|
|
65746
|
+
const key = await this.deps.principalsKey(context);
|
|
65747
|
+
if (key === void 0) return void 0;
|
|
65271
65748
|
if (memo && memo.key === key && stepNumber > memo.atStep) return memo.entries;
|
|
65272
65749
|
const entries = await this.deps.readPins(context);
|
|
65273
65750
|
args.requestContext?.set?.(MEMO_KEY, {
|
|
@@ -67187,7 +67664,7 @@ var MastraLLMVNext = class extends MastraBase {
|
|
|
67187
67664
|
content: messages
|
|
67188
67665
|
}];
|
|
67189
67666
|
}
|
|
67190
|
-
stream({ resumeContext, runId, stopWhen, maxSteps, tools = {}, modelSettings, toolChoice = "auto", threadId, resourceId, structuredOutput, options, inputProcessors, llmRequestInputProcessors, outputProcessors, errorProcessors, hasConfiguredErrorProcessors, returnScorerData, providerOptions, messageList, requireToolApproval, toolCallConcurrency, eagerToolExecution, streamPublisher, _internal, onTracingTripwire, onTracingTerminalError, tracingScope = createRunScope(), agentId, agentVersionId, resolvedScopes, agentName, toolCallId, requestContext, actor, mcp, methodType, includeRawChunks, experimentalTransform, hideSignals, autoResumeSuspendedTools, maxProcessorRetries, processorStates, activeTools, isTaskComplete, goal, onIterationComplete, workspace, agentRunSpan, agent, ...rest }) {
|
|
67667
|
+
stream({ resumeContext, runId, stopWhen, maxSteps, tools = {}, modelSettings, toolChoice = "auto", threadId, resourceId, structuredOutput, options, inputProcessors, llmRequestInputProcessors, outputProcessors, errorProcessors, hasConfiguredErrorProcessors, returnScorerData, providerOptions, messageList, requireToolApproval, toolCallConcurrency, eagerToolExecution, streamPublisher, _internal, onTracingTripwire, onTracingTerminalError, tracingScope = createRunScope(), agentId, agentVersionId, resolvedScopes, agentName, toolCallId, requestContext, actor, mcp, methodType, includeRawChunks, experimentalTransform, hideSignals, autoResumeSuspendedTools, maxProcessorRetries, processorStates, activeTools, isTaskComplete, goal, onIterationComplete, workspace, agentRunSpan, agent, resultType, ...rest }) {
|
|
67191
67668
|
const observabilityContext = resolveObservabilityContext(rest);
|
|
67192
67669
|
let stopWhenToUse;
|
|
67193
67670
|
if (maxSteps && typeof maxSteps === "number") {
|
|
@@ -67213,7 +67690,8 @@ var MastraLLMVNext = class extends MastraBase {
|
|
|
67213
67690
|
provider: firstModel.provider,
|
|
67214
67691
|
streaming: true,
|
|
67215
67692
|
parameters: modelSettings,
|
|
67216
|
-
...toolDefinitions ? { tools: toolDefinitions } : {}
|
|
67693
|
+
...toolDefinitions ? { tools: toolDefinitions } : {},
|
|
67694
|
+
...resultType ? { resultType } : {}
|
|
67217
67695
|
},
|
|
67218
67696
|
metadata: {
|
|
67219
67697
|
runId,
|
|
@@ -73565,8 +74043,9 @@ function releaseRunMessageRefs(runId) {
|
|
|
73565
74043
|
/**
|
|
73566
74044
|
* A `SaveQueueManager` `onSaved` callback that records the rows a run saved,
|
|
73567
74045
|
* so its persisted transcript references them instead of repeating them. Only
|
|
73568
|
-
* runs that store refs hold an entry (the
|
|
73569
|
-
* for other runs, or landing after the
|
|
74046
|
+
* runs that store refs hold an entry (created before the run saves its input,
|
|
74047
|
+
* else by the transcript store), so saves for other runs, or landing after the
|
|
74048
|
+
* run released its entry, are not kept.
|
|
73570
74049
|
*/
|
|
73571
74050
|
function recordRunSavedMessages(runId) {
|
|
73572
74051
|
return (rows) => {
|
|
@@ -73588,6 +74067,15 @@ function recordRunSavedMessages(runId) {
|
|
|
73588
74067
|
};
|
|
73589
74068
|
}
|
|
73590
74069
|
// src/agent/durable/utils/resolve-runtime.ts
|
|
74070
|
+
async function restoreWorkerToolsets(mastra, context, names) {
|
|
74071
|
+
const controller = context.get("controller");
|
|
74072
|
+
if (!isRestoredWorkerControllerContext(controller) || !names?.length) return;
|
|
74073
|
+
const toolsets = await mastra.getAgentControllerById(controller.controllerId)?.__restoreWorkerToolsets(context);
|
|
74074
|
+
if (!toolsets) return;
|
|
74075
|
+
const allowed = new Set(names);
|
|
74076
|
+
for (const [key, tools] of Object.entries(toolsets)) if (tools) toolsets[key] = Object.fromEntries(Object.entries(tools).filter(([name]) => allowed.has(name)));
|
|
74077
|
+
return toolsets;
|
|
74078
|
+
}
|
|
73591
74079
|
/**
|
|
73592
74080
|
* Build a SaveQueueManager for a run's memory, or `undefined` when no memory
|
|
73593
74081
|
* is configured. Shared by `resolveRuntimeDependencies` and
|
|
@@ -73750,6 +74238,7 @@ async function resolveRuntimeDependencies(options) {
|
|
|
73750
74238
|
backgroundTasks = resolveBackgroundTasks(mastra, agent, input.options);
|
|
73751
74239
|
tools = await agent.getToolsForExecution({
|
|
73752
74240
|
runId,
|
|
74241
|
+
toolsets: await restoreWorkerToolsets(mastra, resolveRequestContext, input.options?.toolsetToolNames),
|
|
73753
74242
|
threadId: input.state.threadId,
|
|
73754
74243
|
resourceId: input.state.resourceId,
|
|
73755
74244
|
requestContext: resolveRequestContext,
|
|
@@ -73871,6 +74360,7 @@ async function rebuildRunToolsFromMastra(options) {
|
|
|
73871
74360
|
const backgroundTasks = resolveBackgroundTasks(mastra, agent, execOptions);
|
|
73872
74361
|
const tools = await agent.getToolsForExecution({
|
|
73873
74362
|
runId,
|
|
74363
|
+
toolsets: await restoreWorkerToolsets(mastra, resolveRequestContext, execOptions?.toolsetToolNames),
|
|
73874
74364
|
threadId: state.threadId,
|
|
73875
74365
|
resourceId: state.resourceId,
|
|
73876
74366
|
requestContext: resolveRequestContext,
|
|
@@ -74340,7 +74830,11 @@ function mergeRequestContextForFinalization(entries, fallback, liveRunContext) {
|
|
|
74340
74830
|
if (liveRunContext) return liveRunContext;
|
|
74341
74831
|
if (!entries) return fallback ?? new RequestContext();
|
|
74342
74832
|
const restored = new RequestContext(fallback?.entries());
|
|
74343
|
-
|
|
74833
|
+
const controller = fallback?.get("controller");
|
|
74834
|
+
for (const [key, value] of Object.entries(withoutLiveRequestKeys(entries))) {
|
|
74835
|
+
if (key === "controller" && isRestoredWorkerControllerContext(controller)) continue;
|
|
74836
|
+
restored.set(key, value);
|
|
74837
|
+
}
|
|
74344
74838
|
restoreRunAgentScopes(restored);
|
|
74345
74839
|
return restored;
|
|
74346
74840
|
}
|
|
@@ -74381,6 +74875,7 @@ async function runDurableFinishSideEffects({ runId, initData, messageListState,
|
|
|
74381
74875
|
...initData,
|
|
74382
74876
|
messageListState
|
|
74383
74877
|
},
|
|
74878
|
+
requestContext,
|
|
74384
74879
|
logger: effectiveLogger
|
|
74385
74880
|
});
|
|
74386
74881
|
rebuiltSaveQueueManager = resolved.saveQueueManager;
|
|
@@ -76385,6 +76880,15 @@ function buildMessagesFromChunks({ chunks, messageId, responseModelMetadata, too
|
|
|
76385
76880
|
});
|
|
76386
76881
|
break;
|
|
76387
76882
|
}
|
|
76883
|
+
case "custom": {
|
|
76884
|
+
const p = chunk.payload;
|
|
76885
|
+
parts.push({
|
|
76886
|
+
type: "custom",
|
|
76887
|
+
kind: p.kind,
|
|
76888
|
+
...p.providerMetadata ? { providerMetadata: p.providerMetadata } : {}
|
|
76889
|
+
});
|
|
76890
|
+
break;
|
|
76891
|
+
}
|
|
76388
76892
|
case "tool-call": {
|
|
76389
76893
|
const p = chunk.payload;
|
|
76390
76894
|
const toolDef = tools?.[p.toolName] || findProviderToolByName(tools, p.toolName);
|
|
@@ -79924,6 +80428,12 @@ function createDurableToolCallStep() {
|
|
|
79924
80428
|
error
|
|
79925
80429
|
};
|
|
79926
80430
|
}
|
|
80431
|
+
if (typeof args === "object" && args !== null) args = sanitizeToolArguments({
|
|
80432
|
+
args,
|
|
80433
|
+
toolName,
|
|
80434
|
+
toolConfig: tool?.backgroundConfig,
|
|
80435
|
+
agentConfig: registryEntry?.backgroundTasksConfig
|
|
80436
|
+
});
|
|
79927
80437
|
const saveQueueManager = registryEntry?.saveQueueManager ?? rebuiltSaveQueueManager;
|
|
79928
80438
|
const memory = registryEntry?.memory ?? rebuiltMemory;
|
|
79929
80439
|
const workspace = registryEntry?.workspace ?? rebuiltWorkspace;
|
|
@@ -83719,15 +84229,21 @@ async function persistDurableRunInput(runId, workflowInput, mastra, beforeSave)
|
|
|
83719
84229
|
await beforeSave();
|
|
83720
84230
|
}
|
|
83721
84231
|
const inputCopy = entry.messageList.clone();
|
|
83722
|
-
|
|
83723
|
-
|
|
83724
|
-
|
|
83725
|
-
|
|
83726
|
-
|
|
83727
|
-
|
|
83728
|
-
|
|
83729
|
-
|
|
83730
|
-
|
|
84232
|
+
if (state.fixedMemory) getRunMessageRefs(runId);
|
|
84233
|
+
try {
|
|
84234
|
+
await entry.saveQueueManager.flushMessages(inputCopy, state.threadId, state.memoryConfig, {
|
|
84235
|
+
throwOnError: true,
|
|
84236
|
+
beforePersist: () => assertExecutionOwned({
|
|
84237
|
+
runId,
|
|
84238
|
+
agentId: workflowInput.agentId,
|
|
84239
|
+
mastra,
|
|
84240
|
+
requestContext
|
|
84241
|
+
})
|
|
84242
|
+
});
|
|
84243
|
+
} catch (error) {
|
|
84244
|
+
if (state.fixedMemory) releaseRunMessageRefs(runId);
|
|
84245
|
+
throw error;
|
|
84246
|
+
}
|
|
83731
84247
|
const embedded = entry.messageList.getEmbeddedMessages();
|
|
83732
84248
|
for (const [messageId, textHash] of inputCopy.getEmbeddedMessages()) embedded.set(messageId, textHash);
|
|
83733
84249
|
}
|
|
@@ -84054,7 +84570,7 @@ async function prepareForDurableExecution(options) {
|
|
|
84054
84570
|
});
|
|
84055
84571
|
let tripwireData;
|
|
84056
84572
|
if (inputProcessors.length > 0) try {
|
|
84057
|
-
const { ProcessorRunner } = await import("./stream-
|
|
84573
|
+
const { ProcessorRunner } = await import("./stream-1DGoEkG2.js").then((n) => n.I);
|
|
84058
84574
|
await new ProcessorRunner({
|
|
84059
84575
|
inputProcessors,
|
|
84060
84576
|
outputProcessors,
|
|
@@ -86814,6 +87330,11 @@ var Agent = class Agent extends MastraBase {
|
|
|
86814
87330
|
const processors = [];
|
|
86815
87331
|
const instructions = knowledge.getInstructions();
|
|
86816
87332
|
if (instructions && !configuredIds.has("knowledge-instructions-processor")) processors.push(new KnowledgeInstructionsProcessor(instructions));
|
|
87333
|
+
const toolGroups = knowledge.__toolGroups;
|
|
87334
|
+
if (hasMemory && (toolGroups.read || toolGroups.write) && !hasConfiguredProcessor(configuredProcessors, (processor) => processor.id === "knowledge-scopes")) processors.push(new HeldScopesStateProcessor({
|
|
87335
|
+
principalsKey: (context) => knowledge.__principalsKey(context),
|
|
87336
|
+
readHeldScopes: (context) => knowledge.__heldScopes(context)
|
|
87337
|
+
}));
|
|
86817
87338
|
if (knowledge.pinnedContextEnabled && !configuredIds.has("knowledge")) {
|
|
86818
87339
|
if (!hasMemory) {
|
|
86819
87340
|
if (!this.#warnedPinsWithoutMemory) {
|
|
@@ -86822,9 +87343,26 @@ var Agent = class Agent extends MastraBase {
|
|
|
86822
87343
|
}
|
|
86823
87344
|
return processors;
|
|
86824
87345
|
}
|
|
87346
|
+
const contexts = /* @__PURE__ */ new WeakMap();
|
|
87347
|
+
const pinContext = (context) => {
|
|
87348
|
+
let resolved = contexts.get(context);
|
|
87349
|
+
if (!resolved) {
|
|
87350
|
+
const requestContext = context.requestContext instanceof RequestContext ? context.requestContext : void 0;
|
|
87351
|
+
resolved = this.resolveKnowledgePersona(knowledge, requestContext).then((persona) => ({
|
|
87352
|
+
...context,
|
|
87353
|
+
agent: {
|
|
87354
|
+
...context.agent,
|
|
87355
|
+
agentId: this.id,
|
|
87356
|
+
persona
|
|
87357
|
+
}
|
|
87358
|
+
}));
|
|
87359
|
+
contexts.set(context, resolved);
|
|
87360
|
+
}
|
|
87361
|
+
return resolved;
|
|
87362
|
+
};
|
|
86825
87363
|
processors.push(new PinnedStateProcessor({
|
|
86826
|
-
principalsKey: (context) => knowledge.__principalsKey(context),
|
|
86827
|
-
readPins: (context) => knowledge.__deliveredPins(context),
|
|
87364
|
+
principalsKey: async (context) => knowledge.__principalsKey(await pinContext(context)),
|
|
87365
|
+
readPins: async (context) => knowledge.__deliveredPins(await pinContext(context)),
|
|
86828
87366
|
...knowledge.__toolGroups
|
|
86829
87367
|
}));
|
|
86830
87368
|
}
|
|
@@ -87781,7 +88319,8 @@ var Agent = class Agent extends MastraBase {
|
|
|
87781
88319
|
}
|
|
87782
88320
|
/**
|
|
87783
88321
|
* Gets the metadata for this agent, resolving function-based metadata if necessary.
|
|
87784
|
-
* Metadata is a classification bag for clients
|
|
88322
|
+
* Metadata is a classification bag for clients. The agent runtime reads only `metadata.persona`, to mint
|
|
88323
|
+
* Knowledge persona scopes; it reads nothing else in metadata.
|
|
87785
88324
|
*
|
|
87786
88325
|
* @example
|
|
87787
88326
|
* ```typescript
|
|
@@ -88519,11 +89058,13 @@ var Agent = class Agent extends MastraBase {
|
|
|
88519
89058
|
...observabilityContext,
|
|
88520
89059
|
messageList,
|
|
88521
89060
|
agentId: this.id,
|
|
88522
|
-
agentName: this.name
|
|
89061
|
+
agentName: this.name,
|
|
89062
|
+
resultType: "title_generation"
|
|
88523
89063
|
}).text;
|
|
88524
89064
|
} else text = (await llm.__text({
|
|
88525
89065
|
requestContext,
|
|
88526
89066
|
...observabilityContext,
|
|
89067
|
+
resultType: "title_generation",
|
|
88527
89068
|
messages: [{
|
|
88528
89069
|
role: "system",
|
|
88529
89070
|
content: systemInstructions
|
|
@@ -88670,10 +89211,34 @@ var Agent = class Agent extends MastraBase {
|
|
|
88670
89211
|
backgroundConfig: tool.background,
|
|
88671
89212
|
agentBackgroundConfig: this.#backgroundTasks
|
|
88672
89213
|
};
|
|
88673
|
-
|
|
89214
|
+
const execute = tool.execute;
|
|
89215
|
+
const agentTool = execute ? {
|
|
89216
|
+
...tool,
|
|
89217
|
+
execute: async (input, context) => {
|
|
89218
|
+
const persona = await this.resolveKnowledgePersona(knowledge, requestContext);
|
|
89219
|
+
const runContext = {
|
|
89220
|
+
...context,
|
|
89221
|
+
agent: context?.agent ? {
|
|
89222
|
+
...context.agent,
|
|
89223
|
+
agentId: this.id,
|
|
89224
|
+
persona
|
|
89225
|
+
} : void 0
|
|
89226
|
+
};
|
|
89227
|
+
return execute(input, runContext);
|
|
89228
|
+
}
|
|
89229
|
+
} : tool;
|
|
89230
|
+
converted[toolName] = makeCoreTool(agentTool, options, void 0, autoResumeSuspendedTools, backgroundTaskEnabled);
|
|
88674
89231
|
}
|
|
88675
89232
|
return converted;
|
|
88676
89233
|
}
|
|
89234
|
+
async resolveKnowledgePersona(knowledge, requestContext) {
|
|
89235
|
+
if (!await knowledge.__needsAgentPersona()) return void 0;
|
|
89236
|
+
try {
|
|
89237
|
+
return (await this.getMetadata({ requestContext }))?.persona;
|
|
89238
|
+
} catch {
|
|
89239
|
+
return;
|
|
89240
|
+
}
|
|
89241
|
+
}
|
|
88677
89242
|
/**
|
|
88678
89243
|
* Lists workspace tools if a workspace is configured.
|
|
88679
89244
|
* @internal
|
|
@@ -96414,6 +96979,29 @@ var Agent = class Agent extends MastraBase {
|
|
|
96414
96979
|
};
|
|
96415
96980
|
}
|
|
96416
96981
|
};
|
|
96982
|
+
// src/agent/merge-persona.ts
|
|
96983
|
+
function merge(metadata, persona) {
|
|
96984
|
+
const code = metadata?.persona;
|
|
96985
|
+
const base = code && typeof code === "object" && !Array.isArray(code) ? code : {};
|
|
96986
|
+
const set = Object.fromEntries(Object.entries(persona).filter(([, value]) => value !== void 0));
|
|
96987
|
+
return {
|
|
96988
|
+
...metadata,
|
|
96989
|
+
persona: {
|
|
96990
|
+
...base,
|
|
96991
|
+
...set
|
|
96992
|
+
}
|
|
96993
|
+
};
|
|
96994
|
+
}
|
|
96995
|
+
/**
|
|
96996
|
+
* Overrides an Agent's `metadata.persona` field by field: a field `persona` sets wins, a field it leaves
|
|
96997
|
+
* unset keeps the code's value, and keys outside `persona` stay as they are. Function-form metadata is
|
|
96998
|
+
* wrapped so the override applies to whatever it resolves to.
|
|
96999
|
+
* @experimental
|
|
97000
|
+
*/
|
|
97001
|
+
function mergeAgentPersona(metadata, persona) {
|
|
97002
|
+
if (typeof metadata !== "function") return merge(metadata, persona);
|
|
97003
|
+
return async (context) => merge(await metadata(context), persona);
|
|
97004
|
+
}
|
|
96417
97005
|
// ../_internal-core/dist/fs-routing/index.js
|
|
96418
97006
|
/**
|
|
96419
97007
|
* Maximum nesting depth for declared subagents. A top-level agent is depth 0;
|
|
@@ -103080,6 +103668,12 @@ function createToolCallStep({ tools, messageList, options, outputWriter, control
|
|
|
103080
103668
|
args = argsFromInput;
|
|
103081
103669
|
resumeDataFromArgs = resumeDataFromInput;
|
|
103082
103670
|
}
|
|
103671
|
+
if (typeof args === "object" && args !== null) args = sanitizeToolArguments({
|
|
103672
|
+
args,
|
|
103673
|
+
toolName: inputData.toolName,
|
|
103674
|
+
toolConfig: tool?.backgroundConfig,
|
|
103675
|
+
agentConfig: readScoped(scopeCtx, AGENT_BACKGROUND_CONFIG_KEY, "agentBackgroundConfig")
|
|
103676
|
+
});
|
|
103083
103677
|
const resumeData = resumeDataFromArgs ?? workflowResumeData;
|
|
103084
103678
|
const isResumeToolCall = resumeDataFromArgs != null;
|
|
103085
103679
|
const approvalVerdicts = readScoped(scopeCtx, TOOL_APPROVAL_VERDICTS_KEY, "toolApprovalVerdicts");
|
|
@@ -107910,6 +108504,11 @@ var AgentThreadStreamRuntime = class {
|
|
|
107910
108504
|
record.lifecycle = "completed";
|
|
107911
108505
|
this.#clearSuspendedRun(state, record.runId);
|
|
107912
108506
|
state.threadRunsByStreamId.delete(record.streamId);
|
|
108507
|
+
if (state.threadRunsById.get(record.runId) === record) for (const [streamId, other] of state.threadRunsByStreamId) {
|
|
108508
|
+
if (other.runId !== record.runId || other.lifecycle !== "suspended") continue;
|
|
108509
|
+
state.threadRunsByStreamId.delete(streamId);
|
|
108510
|
+
state.watchedThreadStreamIds.delete(streamId);
|
|
108511
|
+
}
|
|
107913
108512
|
if (state.threadRunsById.get(record.runId) === record) {
|
|
107914
108513
|
state.threadRunsById.delete(record.runId);
|
|
107915
108514
|
state.threadKeysByRunId.delete(record.runId);
|
|
@@ -110686,4 +111285,4 @@ var ExtendedRunRegistry = class extends RunRegistry {
|
|
|
110686
111285
|
this.#memoryInfo.clear();
|
|
110687
111286
|
}
|
|
110688
111287
|
};
|
|
110689
|
-
export { createDurableBackgroundTaskCheckStep as $, createSpanQueryPreview as $a, createRestartExecutionParams as $c, DatasetItemIdentityConflictError as $i, RUN_FENCING_NOT_SUPPORTED_ERROR_ID as $l, SemanticRecall as $n, SkillsProcessor as $o, notificationSummarySignalMetadata as $r, emitStepFinishEvent as $s, knowledgeDeliveredPins as $t, agentInstructions as A, transformRow as Aa, DefaultExecutionEngine as Ac, MAX_KNOWLEDGE_PAGE_BODY_LINKS as Ai, ImagePartSchema as Al, resolveWaitUntil as An, DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS as Ao, WorkflowsInMemory as Ar, StreamErrorRetryProcessor as As, readRunDeadline as At, createDurableAgenticWorkflow as B, THREAD_QUERY_MAX_LIMIT as Ba, normalizeConcurrency as Bc, knowledgeLinkRefKey as Bi, ProcessorStepInputSchema as Bl, renderBuiltInToolEvent as Bn, memoryDefaultOptions as Bo, ScoresInMemory as Br, cloneStep as Bs, formatCompletionFeedback as Bt, MastraScorer as C, getSqlType as Ca, predicateToCondition as Cc, parseKnowledgeWikilinks as Ci, assertDrainTimeout as Cl, knowledgeRunScopes as Cn, serializeSpanAttributes as Co, StoreOperations as Cr, UnicodeNormalizer as Cs, liveSegmentSpan as Ct, isNotScorable as D, safelyParseJSON as Da, nestedRunParentOf as Dc, KnowledgePageKeyConflictError as Di, hasResumableStreams as Dl, encodeKnowledgeScopeId as Dn, FactoryStorage as Do, FilesystemDB as Dr, UnsupportedFileHandler as Ds, runResumeDurableStreamUntilIdle as Dt, filterRun as E, parseDuration as Ea, createNestedRunParentStatusLookup as Ec, KnowledgePageHasChildrenError as Ei, hasDurableExecution as El, decodeKnowledgeScopeId as En, ObservabilityStorage as Eo, FilesystemStore as Er, isMalformedFunctionCallError as Es, runDurableStreamUntilIdle as Et, normalizeResumeGenerateArgs as F, tracePageIdSchema as Fa, renewWorkflowLease as Fc, MAX_KNOWLEDGE_PAGE_LIST_LIMIT as Fi, ProcessorMessageContentSchema as Fl, ChannelThreadLinkProcessor as Fn, messageVectorId as Fo, mergeWorkflowStepResult as Fr, cloneWorkflow as Fs, pruneAgentLoopSnapshot as Ft, createWorkflowInput as G, threadQueryResponseSchema as Ga, createStepFromTool as Gc, parseKnowledgePageRef as Gi, StepStartPartSchema as Gl, DEFAULT_CHANNEL_TOOLS_SETTINGS as Gn, createBackgroundWorkSignalProcessor as Go, InMemoryNotificationsStorage as Gr, StepExecutor as Gs, runChecks as Gt, createDurableIsTaskCompleteStep as H, planThreadRowsQuery as Ha, createMappingStep as Hc, knowledgePinDepth as Hi, ProcessorStepSchema as Hl, CONTINUE_RUN_MESSAGE as Hn, isSystemReminderMessage as Ho, InMemorySchedulesStorage as Hr, createStep as Hs, formatValidationFeedback as Ht, prepareForDurableExecution as I, tracePageNodeSchema as Ia, repeatAfterSettled as Ic, MAX_KNOWLEDGE_PIN_LIST_DEPTH as Ii, ProcessorMessageSchema as Il, NEW_CHANNEL_THREAD_KEY as In, resolveMaxChunkChars as Io, InMemoryWorkflowDefinitionsStorage as Ir, createEventedWorkflow as Is, DEFAULT_TOOL_DECLINE_REASON as It, serializeModelConfig as J, SPAN_QUERY_MAX_CURSOR_BYTES as Ja, abortableSleep as Jc, HarnessStorage as Ji, isAgentCompatible as Jl, createChannelTools as Jn, RESPONSE_CACHE_CONTEXT_KEY as Jo, createNotificationSignal as Jr, diffResponseMessages as Js, runStreamCompletionScorers as Jt, serializeDurableOptions as K, threadQueryRowSchema as Ka, RESUME_SNAPSHOT_POLL_INTERVAL_MS as Kc, KnowledgeInvalidCursorError as Ki, TextPartSchema as Kl, channelToolScopeResolver as Kn, CyberRefusalHandler as Ko, NotificationsStorage as Kr, computeScheduleDefinitionHash as Ks, runCompletionScorers as Kt, applyReservedMemoryContextKeys as L, tracePageRequestSchema as La, runFenceConflictOf as Lc, assertKnowledgeNoteTextWithinBound as Li, ProcessorOutputResultPhaseSchema as Ll, markNewChannelThread as Ln, upsertMessageVectors as Lo, WorkflowDefinitionsStorage as Lr, createWorkflow as Ls, resolveDeclineReason as Lt, MAX_FS_SUBAGENT_DEPTH as M, validateStorageMetadataFilter as Ma, evaluateScoringPredicate as Mc, MAX_KNOWLEDGE_PAGE_DESCRIPTION_TOKENS as Mi, MessagePartSchema as Ml, resolveChannelRenderContext as Mn, buildMessageEmbeddingRows as Mo, WorkflowsStorage as Mr, isRetryableOpenAIResponsesStreamError as Ms, getRunStreamSlot as Mt, AGENT_RESUME_CLAIM_STALE_MS as N, TracePageError as Na, validateScoringPredicate as Nc, MAX_KNOWLEDGE_PAGE_LINKS as Ni, ProcessorInputPhaseSchema as Nl, MastraStateAdapter as Nn, chunkMessageText as No, createEmptyWorkflowSnapshot as Nr, PrefillErrorHandler as Ns, getScopeStreamSlot as Nt, notScorable as O, serializeDate as Oa, nestedRunRecoveryAction as Oc, MAX_KNOWLEDGE_MOVE_PAGES as Oi, isDurableAgentLike as Ol, buildKnowledgeInstructions as On, FactoryStorageDomain as Oo, InMemoryStore as Or, FileUploadProcessor as Os, RUN_DEADLINE_KEY as Ot, Agent as P, readTracePage as Pa, WORKFLOW_RUN_LEASE_TTL_MS as Pc, MAX_KNOWLEDGE_PAGE_LINK_REF_LENGTH as Pi, ProcessorInputStepPhaseSchema as Pl, REPLY_TOOL_NAME as Pn, extractMessageEmbeddingText as Po, mergeStepResult as Pr, getGoalActivityDurationMs as Ps, untilIdleHandlesBackgroundTask as Pt, isSpanChunk as Q, buildSpanQueryResponse as Qa, createDeprecationProxy as Qc, DatasetsStorage as Qi, RUN_FENCE_CONFLICT_ERROR_ID as Ql, MemoryInputFilter as Qn, SkillSearchProcessor as Qo, notificationSummaryContents as Qr, emitFinishEvent as Qs, PINNED_READ_MEMO_KEY as Qt, persistDurableRunInput as R, tracePageResponseSchema as Ra, ExecutionEngine as Rc, assertKnowledgePageDescriptionWithinBound as Ri, ProcessorOutputStepPhaseSchema as Rl, ChatChannelProcessor as Rn, MastraMemory as Ro, InMemoryToolProviderConnectionsStorage as Rr, EventedRun as Rs, getServerSideFallbackInfo as Rt, createClassifierScorer as S, getDefaultValue as Sa, mapVariable as Sc, inspectKnowledgeSchema as Si, getEntryWorkflow as Sl, knowledgeMemoryScopes as Sn, getStringOrNull as So, StoreOperationsInMemory as Sr, ModerationProcessor as Ss, endFailedSegmentSpans as St, createScorer as T, jsonValueEquals as Ta, cancelNestedRun as Tc, KnowledgePageDepthError as Ti, workflowTermination as Tl, strongerKnowledgeRole as Tn, ObservabilityInMemory as To, createGitHubSourceControlProviderFromEnv as Tr, defaultStabilityErrorProcessors as Ts, segmentSpanData as Tt, createDurableLLMMappingStep as U, threadQueryIdentitySchema as Ua, createStepFromAgent$1 as Uc, knowledgePositionBetween as Ui, ReasoningPartSchema as Ul, formatToolApproval as Un, augmentWithInit as Uo, SchedulesStorage as Ur, createWorkflow$1 as Us, generateFinalResult as Ut, createDurableGoalStep as V, encodeThreadQueryCursor as Va, runWithConcurrency as Vc, knowledgePagePath as Vi, ProcessorStepOutputSchema as Vl, CONTINUE_RUN_ACTION_ID as Vn, filterSystemReminderMessages as Vo, ScoresStorage as Vr, cloneWorkflow$1 as Vs, formatStreamCompletionFeedback as Vt, createDurableToolCallStep as W, threadQueryRequestSchema as Wa, createStepFromClassifier as Wc, knowledgeScopeReadable as Wi, SourcePartSchema as Wl, ChannelSessionRejectedError as Wn, getStorageSource as Wo, normalizeScheduleTarget as Wr, WorkflowEventProcessor as Ws, generateStructuredFinalResult as Wt, createDurableLLMExecutionStep as X, SPAN_QUERY_MAX_PREVIEW_CHARACTERS as Xa, assertTimeTravelGraphMatchesSnapshot as Xc, ExperimentsStorage as Xi, assertWorkflowStepGuard as Xl, toChatLogger as Xn, buildResponseCacheKey as Xo, notificationSignalAttributes as Xr, emitChunkEvent as Xs, loop as Xt, serializeToolsMetadata as Y, SPAN_QUERY_MAX_LIMIT as Ya, applyStateDelta as Yc, ExperimentsInMemory as Yi, WorkflowStepConflictError as Yl, resolveChannelToolsSettings as Yn, ResponseCache as Yo, createNotificationSummarySignal as Yr, emitAbortEvent as Ys, runValidation as Yt, MessagePartSpans as Z, SPAN_QUERY_ORDER_FIELDS as Za, cleanStepResult as Zc, DatasetsInMemory as Zi, isWorkflowStepConflictError as Zl, BaseProcessor as Zn, WorkspaceInstructionsProcessor as Zo, notificationSignalMetadata as Zr, emitErrorEvent as Zs, validateModelTimeoutSettings as Zt, describeNonSuccessFinishReason as _, createStorageErrorId as _a, Run as _c, KnowledgeStorage as _i, validateStepResumeData as _l, knowledgeAccessGrants as _n, buildLogRecord as _o, knowledgeScopeKey as _r, ClassifierProcessor as _s, resolveTool$1 as _t, deleteRunRegistryEntry as a, SchemaUpdateValidationError as aa, subscribeToAbortRequests as ac, resolveNotificationDeliveryDecision as ai, getSingleStepEntryId as al, removeKnowledgeNote as an, spanQueryIdentityKey as ao, MockMemory as ar, CostGuardProcessor as as, baseDurableAgenticInputSchema as at, resolveRunFence as au, createOnScorerHook as b, ensureDate as ba, createStep$1 as bc, assertKnowledgeSchemaCompatible as bi, waitForSuspendedSnapshot as bl, KnowledgeDeclarationError as bn, buildUpdateSpanRecord as bo, knowledgeVisibleScopeKeys as br, PIIDetector as bs, createDurableAgentStream as bt, getRunRegistryEntry as c, ChannelsStorage as ca, DurableAgentDefaults as cc, InMemoryKnowledgeStorage as ci, isEntryFinished as cl, upsertKnowledgePage as cn, spanQueryResponseSchema as co, MAX_KNOWLEDGE_SCOPE_TAGS as cr, TokenLimiterProcessor as cs, modelConfigSchema as ct, setRunFenceContext as cu, setRunRegistryEntry as d, BackgroundTasksInMemory as da, AGENT_STREAM_TOPIC as dc, KnowledgeImportersStorage as di, omitPriorSuspensionFields as dl, KnowledgeLinkRefreshIncompleteError as dn, encodeTraceQueryDeltaCursor as do, assertKnowledgeRecordTextWithinBound as dr, advanceMemoryTokenBoundary as ds, runDurableFinishSideEffects as dt, SchemaValidator as ea, emitStepStartEvent as ec, summarizeNotifications as ei, createTimeTravelExecutionParams as el, buildKnowledgePageTools as en, encodeSpanQueryCursor as eo, globalEmbeddingCache as er, formatSkillsCatalog as es, resolveDurableToolCallConcurrency as et, RunFenceConflictError as eu, takeRunScorerInstances as f, BackgroundTasksStorage as fa, AgentControlEventTypes as fc, KNOWLEDGE_STORAGE_CONTRACT_VERSION as fi, resolveForeachConcurrency as fl, knowledgeSubtree as fn, getTraceQueryDeltaWatermark as fo, assertKnowledgeScopeWithinCeiling as fr, getMemoryTokenBoundary as fs, loadRunStoredMessages as ft, AGENTIC_LOOP_WORKFLOW_ID as g, runRetentionBatches as ga, getStepEntry as gc, KnowledgeSchemaResetRequiredError as gi, validateStepRequestContext as gl, updateKnowledgeLinks as gn, buildFeedbackRecord as go, isKnowledgeScopeVisible as gr, ModelSelectionProcessor as gs, resolveRuntimeDependencies as gt, AGENTIC_EXECUTION_WORKFLOW_ID as h, retentionCutoffMs as ha, getNestedWorkflow as hc, KnowledgeNotFoundError$1 as hi, validateStepInput as hl, syncKnowledgePageBodyLinks as hn, buildCreateSpanRecord as ho, expandKnowledgeScope as hr, BatchPartsProcessor as hs, resolveModel as ht, abandonDurableAgentExecutions as i, UnsupportedSchemaPatternError as ia, requestAcknowledgedAbort as ic, resolveDeliveryFailureUpdate as ii, getResumeLabelsByStepId as il, moveKnowledgePage as in, spanQueryCostSchema as io, getMemoryRunState as ir, RegexFilterProcessor as is, accumulatedUsageSchema as it, matchesRunFence as iu, assembleAgentFromFsEntry as j, transformScoreRow as ja, SCORING_PREDICATE_ROOTS as jc, MAX_KNOWLEDGE_PAGE_DEPTH as ji, MessageContentSchema as jl, defaultTypingStatus as jn, MESSAGE_EMBEDDING_CHARS_PER_TOKEN as jo, cloneRunData as jr, isBadRequestError as js, __registerMastraCtor as jt, agentConfig as k, storageMessageMatchesMetadataFilter as ka, nestedRunStatusOf as kc, MAX_KNOWLEDGE_NOTE_TOKENS as ki, FilePartSchema as kl, AgentChannels as kn, UniqueViolationError as ko, MockStore as kr, FILE_UPLOAD_ERROR_CODES as ks, ensureRemoteAbortListener as kt, globalRunRegistry as l, InMemoryBlobStore as la, DurableStepIds as lc, KnowledgeImporterBindingConflictError as li, isSingleStepEntry as ll, KnowledgeSemanticIndex as ln, spanQueryRowSchema as lo, assertKnowledgeCeilingRaised as lr, groupLinkedToolMessages as ls, modelListEntrySchema as lt, agentThreadStreamRuntime as m, resolveRetentionTargets as ma, EventedExecutionEngine as mc, KnowledgeConflictError as mi, setLongTimeout as ml, reindexKnowledgeLinks as mn, planTraceQuery as mo, createKnowledgeNodeCursor as mr, normalizeMessageHistoryConfig as ms, resolveInternalState as mt, ExtendedRunRegistry as n, createValidator as na, AgentStreamBus as nc, MAX_NOTIFICATION_DELIVERY_ATTEMPTS as ni, defineStateAccessors as nl, knowledgeRunPrincipals as nn, planSpanQuery as no, MessageHistory as nr, AgentsMDInjector as ns, calculateAccumulatedUsage as nt, currentRunGeneration as nu, endRunSpansWithError as o, SchemaValidationError as oa, createRunAbortController as oc, InMemoryMemory as oi, getStepIds as ol, removeKnowledgePage as on, spanQueryIdentitySchema as oo, MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH as or, TokenCostControl as os, baseIterationStateSchema as ot, runFencingNotSupportedError as ou, AgentThreadLeaseLostError as p, executeRetentionPrune as pa, AgentStreamEventTypes as pc, KNOWLEDGE_STORAGE_SCHEMA_VERSION as pi, runCountDeprecationMessage as pl, refreshKnowledgeLinksTo as pn, planThreadQuery as po, canonicalizeKnowledgeScope as pr, isAfterMemoryTokenBoundary as ps, rebuildRunToolsFromMastra as pt, serializeDurableState as q, SPAN_QUERY_MAX_COST_METRICS as qa, RESUME_SNAPSHOT_WAIT_STATUSES as qc, InMemoryHarness as qi, ToolInvocationPartSchema as ql, createChannelToolScope as qn, DEFAULT_RESPONSE_CACHE_TTL_SECONDS as qo, dispatchDueNotifications as qr, __resetExecutionFencesForTests as qs, runDefaultCompletionCheck as qt, RunRegistry as r, getSchemaValidator as ra, publishAbortRequest as rc, defaultNotificationDeliveryDecision as ri, getRestartStartIndex as rl, addKnowledgeNote as rn, resolveSpanQueryCost as ro, MemoryRunState as rr, ToolCallFilter as rs, createBaseIterationStateUpdate as rt, isRunFenceConflictError as ru, getActiveDurableAgentWorkflowExecutions as s, InMemoryChannelsStorage as sa, DURABLE_STOP_WHEN_ERROR_ID as sc, MemoryStorage as si, hydrateSerializedStepErrors as sl, updateKnowledgeNote as sn, spanQueryRequestSchema as so, MAX_KNOWLEDGE_RECORD_TEXT_LENGTH as sr, SystemPromptScrubber as ss, durableAgenticOutputSchema as st, runOutsideRunFenceScope as su, DURABLE_CONTEXT_SEGMENT_KEY as t, assertSupportedPatterns as ta, emitSuspendedEvent as tc, readNotificationRoutingRequirement as ti, defineLazyWriter as tl, KnowledgeRun as tn, parseSpanQueryRequest as to, WorkingMemory as tr, ToolSearchProcessor as ts, buildStepRecord as tt, coverNestedRun as tu, isDurableAgentExecutionDetached as u, BlobStore as ua, AGENT_CONTROL_TOPIC as uc, KnowledgeImporterRunStateError as ui, omitPriorCompletionFields as ul, embed$2 as un, encodeTraceQueryCursor as uo, assertKnowledgeDescriptionWithinBound as ur, loadMessageHistory as us, executeDurableAgentScorers as ut, runEvals as v, createStoreErrorId as va, Workflow as vc, KnowledgeTransactionDeadlineError as vi, validateStepStateData as vl, knowledgeReadScopeFor as vn, buildMetricRecord as vo, knowledgeSemanticDocumentId as vr, StructuredOutputProcessor as vs, toolRequiresApproval as vt, ScorerRunError as w, hasErrorCode as wa, evaluatePredicate as wc, KnowledgeMoveTooLargeError as wi, waitMs as wl, knowledgeScopeAddress as wn, toEntityType as wo, GitHubSourceControlProvider as wr, STABILITY_ERROR_PROCESSOR_IDS as ws, segmentEndedBySuspension as wt, validateAndSaveScore as x, filterByDateRange as xa, isProcessor$1 as xc, createKnowledgeUlid as xi, getEntryId as xl, compileKnowledgeScopes as xn, getObjectOrNull as xo, parseKnowledgeNodeCursor as xr, PromptInjectionDetector as xs, carrySegmentSpans as xt, flushBeforeTraceRead as y, createVectorErrorId as ya, cloneStep$1 as yc, KnowledgeUnsupportedCapabilityError as yi, validateStepSuspendData as yl, knowledgeRoleOn as yn, buildScoreRecord as yo, knowledgeSemanticIdempotencyKey as yr, LanguageDetector as ys, resolveAgentById as yt, detachFullStreamOnEnd as z, THREAD_QUERY_DEFAULT_LIMIT as za, createConcurrencyLimiter as zc, canonicalKnowledgeName as zi, ProcessorOutputStreamPhaseSchema as zl, CHAT_CHANNEL_RENDER_CONTEXT_KEY as zn, MemoryProcessor as zo, ToolProviderConnectionsStorage as zr, EventedWorkflow as zs, formatCheckFeedback as zt };
|
|
111288
|
+
export { isSpanChunk as $, SPAN_QUERY_MAX_CURSOR_BYTES as $a, RESUME_SNAPSHOT_POLL_INTERVAL_MS as $c, HarnessStorage as $i, TextPartSchema as $l, createChannelTools as $n, RESPONSE_CACHE_CONTEXT_KEY as $o, createNotificationSignal as $r, diffResponseMessages as $s, PINNED_READ_MEMO_KEY as $t, agentInstructions as A, jsonValueEquals as Aa, predicateToCondition as Ac, KnowledgePageDepthError as Ai, assertDrainTimeout as Al, strongerKnowledgeRole as An, ObservabilityInMemory as Ao, createGitHubSourceControlProviderFromEnv as Ar, defaultStabilityErrorProcessors as As, ensureRemoteAbortListener as At, detachFullStreamOnEnd as B, tracePageIdSchema as Ba, validateScoringPredicate as Bc, MAX_KNOWLEDGE_PAGE_LIST_LIMIT as Bi, ProcessorInputPhaseSchema as Bl, ChannelThreadLinkProcessor as Bn, messageVectorId as Bo, mergeWorkflowStepResult as Br, cloneWorkflow as Bs, formatCheckFeedback as Bt, MastraScorer as C, createStoreErrorId as Ca, getStepEntry as Cc, KnowledgeTransactionDeadlineError as Ci, validateStepRequestContext as Cl, knowledgeReadScopeFor as Cn, buildMetricRecord as Co, knowledgeSemanticDocumentId as Cr, StructuredOutputProcessor as Cs, endFailedSegmentSpans as Ct, isNotScorable as D, getDefaultValue as Da, createStep$1 as Dc, inspectKnowledgeSchema as Di, waitForSuspendedSnapshot as Dl, knowledgeMemoryScopes as Dn, getStringOrNull as Do, StoreOperationsInMemory as Dr, ModerationProcessor as Ds, runDurableStreamUntilIdle as Dt, filterRun as E, filterByDateRange as Ea, cloneStep$1 as Ec, createKnowledgeUlid as Ei, validateStepSuspendData as El, compileKnowledgeScopes as En, getObjectOrNull as Eo, parseKnowledgeNodeCursor as Er, PromptInjectionDetector as Es, segmentSpanData as Et, Agent as F, transformRow as Fa, nestedRunRecoveryAction as Fc, MAX_KNOWLEDGE_PAGE_BODY_LINKS as Fi, isDurableAgentLike as Fl, resolveWaitUntil as Fn, DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS as Fo, WorkflowsInMemory as Fr, StreamErrorRetryProcessor as Fs, untilIdleHandlesBackgroundTask as Ft, createDurableToolCallStep as G, THREAD_QUERY_MAX_LIMIT as Ga, ExecutionEngine as Gc, knowledgeLinkRefKey as Gi, ProcessorOutputStepPhaseSchema as Gl, renderBuiltInToolEvent as Gn, memoryDefaultOptions as Go, ScoresInMemory as Gr, cloneStep as Gs, generateStructuredFinalResult as Gt, createDurableGoalStep as H, tracePageRequestSchema as Ha, renewWorkflowLease as Hc, assertKnowledgeNoteTextWithinBound as Hi, ProcessorMessageContentSchema as Hl, markNewChannelThread as Hn, upsertMessageVectors as Ho, WorkflowDefinitionsStorage as Hr, createWorkflow as Hs, formatStreamCompletionFeedback as Ht, normalizeResumeGenerateArgs as I, transformScoreRow as Ia, nestedRunStatusOf as Ic, MAX_KNOWLEDGE_PAGE_DEPTH as Ii, FilePartSchema as Il, defaultTypingStatus as In, MESSAGE_EMBEDDING_CHARS_PER_TOKEN as Io, cloneRunData as Ir, isBadRequestError as Is, pruneAgentLoopSnapshot as It, serializeDurableState as J, threadQueryIdentitySchema as Ja, runWithConcurrency as Jc, knowledgePositionBetween as Ji, ProcessorStepOutputSchema as Jl, formatToolApproval as Jn, augmentWithInit as Jo, SchedulesStorage as Jr, createWorkflow$1 as Js, runDefaultCompletionCheck as Jt, createWorkflowInput as K, encodeThreadQueryCursor as Ka, createConcurrencyLimiter as Kc, knowledgePagePath as Ki, ProcessorOutputStreamPhaseSchema as Kl, CONTINUE_RUN_ACTION_ID as Kn, filterSystemReminderMessages as Ko, ScoresStorage as Kr, cloneWorkflow$1 as Ks, runChecks as Kt, prepareForDurableExecution as L, validateStorageMetadataFilter as La, DefaultExecutionEngine as Lc, MAX_KNOWLEDGE_PAGE_DESCRIPTION_TOKENS as Li, ImagePartSchema as Ll, resolveChannelRenderContext as Ln, buildMessageEmbeddingRows as Lo, WorkflowsStorage as Lr, isRetryableOpenAIResponsesStreamError as Ls, DEFAULT_TOOL_DECLINE_REASON as Lt, MAX_FS_SUBAGENT_DEPTH as M, safelyParseJSON as Ma, cancelNestedRun as Mc, KnowledgePageKeyConflictError as Mi, workflowTermination as Ml, encodeKnowledgeScopeId as Mn, FactoryStorage as Mo, FilesystemDB as Mr, UnsupportedFileHandler as Ms, __registerMastraCtor as Mt, mergeAgentPersona as N, serializeDate as Na, createNestedRunParentStatusLookup as Nc, MAX_KNOWLEDGE_MOVE_PAGES as Ni, hasDurableExecution as Nl, buildKnowledgeInstructions as Nn, FactoryStorageDomain as No, InMemoryStore as Nr, FileUploadProcessor as Ns, getRunStreamSlot as Nt, notScorable as O, getSqlType as Oa, isProcessor$1 as Oc, parseKnowledgeWikilinks as Oi, getEntryId as Ol, knowledgeRunScopes as On, serializeSpanAttributes as Oo, StoreOperations as Or, UnicodeNormalizer as Os, runResumeDurableStreamUntilIdle as Ot, AGENT_RESUME_CLAIM_STALE_MS as P, storageMessageMatchesMetadataFilter as Pa, nestedRunParentOf as Pc, MAX_KNOWLEDGE_NOTE_TOKENS as Pi, hasResumableStreams as Pl, AgentChannels as Pn, UniqueViolationError as Po, MockStore as Pr, FILE_UPLOAD_ERROR_CODES as Ps, getScopeStreamSlot as Pt, MessagePartSpans as Q, SPAN_QUERY_MAX_COST_METRICS as Qa, createStepFromTool as Qc, InMemoryHarness as Qi, StepStartPartSchema as Ql, createChannelToolScope as Qn, DEFAULT_RESPONSE_CACHE_TTL_SECONDS as Qo, dispatchDueNotifications as Qr, __resetExecutionFencesForTests as Qs, validateModelTimeoutSettings as Qt, applyReservedMemoryContextKeys as R, TracePageError as Ra, SCORING_PREDICATE_ROOTS as Rc, MAX_KNOWLEDGE_PAGE_LINKS as Ri, MessageContentSchema as Rl, MastraStateAdapter as Rn, chunkMessageText as Ro, createEmptyWorkflowSnapshot as Rr, PrefillErrorHandler as Rs, resolveDeclineReason as Rt, createClassifierScorer as S, createStorageErrorId as Sa, getNestedWorkflow as Sc, KnowledgeStorage as Si, validateStepInput as Sl, knowledgeAccessGrants as Sn, buildLogRecord as So, knowledgeScopeKey as Sr, ClassifierProcessor as Ss, carrySegmentSpans as St, createScorer as T, ensureDate as Ta, Workflow as Tc, assertKnowledgeSchemaCompatible as Ti, validateStepStateData as Tl, KnowledgeDeclarationError as Tn, buildUpdateSpanRecord as To, knowledgeVisibleScopeKeys as Tr, PIIDetector as Ts, segmentEndedBySuspension as Tt, createDurableIsTaskCompleteStep as U, tracePageResponseSchema as Ua, repeatAfterSettled as Uc, assertKnowledgePageDescriptionWithinBound as Ui, ProcessorMessageSchema as Ul, ChatChannelProcessor as Un, MastraMemory as Uo, InMemoryToolProviderConnectionsStorage as Ur, EventedRun as Us, formatValidationFeedback as Ut, createDurableAgenticWorkflow as V, tracePageNodeSchema as Va, WORKFLOW_RUN_LEASE_TTL_MS as Vc, MAX_KNOWLEDGE_PIN_LIST_DEPTH as Vi, ProcessorInputStepPhaseSchema as Vl, NEW_CHANNEL_THREAD_KEY as Vn, resolveMaxChunkChars as Vo, InMemoryWorkflowDefinitionsStorage as Vr, createEventedWorkflow as Vs, formatCompletionFeedback as Vt, createDurableLLMMappingStep as W, THREAD_QUERY_DEFAULT_LIMIT as Wa, runFenceConflictOf as Wc, canonicalKnowledgeName as Wi, ProcessorOutputResultPhaseSchema as Wl, CHAT_CHANNEL_RENDER_CONTEXT_KEY as Wn, MemoryProcessor as Wo, ToolProviderConnectionsStorage as Wr, EventedWorkflow as Ws, generateFinalResult as Wt, serializeToolsMetadata as X, threadQueryResponseSchema as Xa, createStepFromAgent$1 as Xc, parseKnowledgePageRef as Xi, ReasoningPartSchema as Xl, DEFAULT_CHANNEL_TOOLS_SETTINGS as Xn, createBackgroundWorkSignalProcessor as Xo, InMemoryNotificationsStorage as Xr, StepExecutor as Xs, runValidation as Xt, serializeModelConfig as Y, threadQueryRequestSchema as Ya, createMappingStep as Yc, knowledgeScopeReadable as Yi, ProcessorStepSchema as Yl, ChannelSessionRejectedError as Yn, getStorageSource as Yo, normalizeScheduleTarget as Yr, WorkflowEventProcessor as Ys, runStreamCompletionScorers as Yt, createDurableLLMExecutionStep as Z, threadQueryRowSchema as Za, createStepFromClassifier as Zc, KnowledgeInvalidCursorError as Zi, SourcePartSchema as Zl, channelToolScopeResolver as Zn, CyberRefusalHandler as Zo, NotificationsStorage as Zr, computeScheduleDefinitionHash as Zs, loop as Zt, describeNonSuccessFinishReason as _, BackgroundTasksStorage as _a, AgentControlEventTypes as _c, KNOWLEDGE_STORAGE_CONTRACT_VERSION as _i, omitPriorCompletionFields as _l, knowledgeSubtree as _n, getTraceQueryDeltaWatermark as _o, assertKnowledgeScopeWithinCeiling as _r, getMemoryTokenBoundary as _s, resolveRuntimeDependencies as _t, deleteRunRegistryEntry as a, SchemaValidator as aa, emitStepStartEvent as ac, summarizeNotifications as ai, createDeprecationProxy as al, knowledgeRunPrincipals as an, encodeSpanQueryCursor as ao, globalEmbeddingCache as ar, formatSkillsCatalog as as, accumulatedUsageSchema as at, RUN_FENCE_CONFLICT_ERROR_ID as au, createOnScorerHook as b, retentionCutoffMs as ba, restoredWorkerControllerContexts as bc, KnowledgeNotFoundError$1 as bi, runCountDeprecationMessage as bl, syncKnowledgePageBodyLinks as bn, buildCreateSpanRecord as bo, expandKnowledgeScope as br, BatchPartsProcessor as bs, resolveAgentById as bt, getRunRegistryEntry as c, getSchemaValidator as ca, publishAbortRequest as cc, defaultNotificationDeliveryDecision as ci, defineLazyWriter as cl, addKnowledgeNote as cn, resolveSpanQueryCost as co, MemoryRunState as cr, ToolCallFilter as cs, durableAgenticOutputSchema as ct, coverNestedRun as cu, setRunRegistryEntry as d, SchemaValidationError as da, createRunAbortController as dc, InMemoryMemory as di, getResumeLabelsByStepId as dl, removeKnowledgePage as dn, spanQueryIdentitySchema as do, MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH as dr, TokenCostControl as ds, executeDurableAgentScorers as dt, matchesRunFence as du, ExperimentsInMemory as ea, emitAbortEvent as ec, createNotificationSummarySignal as ei, RESUME_SNAPSHOT_WAIT_STATUSES as el, knowledgeDeliveredPins as en, SPAN_QUERY_MAX_LIMIT as eo, resolveChannelToolsSettings as er, ResponseCache as es, createDurableBackgroundTaskCheckStep as et, ToolInvocationPartSchema as eu, takeRunScorerInstances as f, InMemoryChannelsStorage as fa, DURABLE_STOP_WHEN_ERROR_ID as fc, MemoryStorage as fi, getSingleStepEntryId as fl, updateKnowledgeNote as fn, spanQueryRequestSchema as fo, MAX_KNOWLEDGE_RECORD_TEXT_LENGTH as fr, SystemPromptScrubber as fs, runDurableFinishSideEffects as ft, resolveRunFence as fu, AGENTIC_LOOP_WORKFLOW_ID as g, BackgroundTasksInMemory as ga, AGENT_STREAM_TOPIC as gc, KnowledgeImportersStorage as gi, isSingleStepEntry as gl, KnowledgeLinkRefreshIncompleteError as gn, encodeTraceQueryDeltaCursor as go, assertKnowledgeRecordTextWithinBound as gr, advanceMemoryTokenBoundary as gs, resolveModel as gt, AGENTIC_EXECUTION_WORKFLOW_ID as h, BlobStore as ha, AGENT_CONTROL_TOPIC as hc, KnowledgeImporterRunStateError as hi, isEntryFinished as hl, embed$2 as hn, encodeTraceQueryCursor as ho, assertKnowledgeDescriptionWithinBound as hr, loadMessageHistory as hs, resolveInternalState as ht, setRunFenceContext as hu, abandonDurableAgentExecutions as i, DatasetItemIdentityConflictError as ia, emitStepFinishEvent as ic, notificationSummarySignalMetadata as ii, cleanStepResult as il, KnowledgeRunScopesError as in, createSpanQueryPreview as io, SemanticRecall as ir, SkillsProcessor as is, createBaseIterationStateUpdate as it, isWorkflowStepConflictError as iu, assembleAgentFromFsEntry as j, parseDuration as ja, evaluatePredicate as jc, KnowledgePageHasChildrenError as ji, waitMs as jl, decodeKnowledgeScopeId as jn, ObservabilityStorage as jo, FilesystemStore as jr, isMalformedFunctionCallError as js, readRunDeadline as jt, agentConfig as k, hasErrorCode as ka, mapVariable as kc, KnowledgeMoveTooLargeError as ki, getEntryWorkflow as kl, knowledgeScopeAddress as kn, toEntityType as ko, GitHubSourceControlProvider as kr, STABILITY_ERROR_PROCESSOR_IDS as ks, RUN_DEADLINE_KEY as kt, globalRunRegistry as l, UnsupportedSchemaPatternError as la, requestAcknowledgedAbort as lc, resolveDeliveryFailureUpdate as li, defineStateAccessors as ll, moveKnowledgePage as ln, spanQueryCostSchema as lo, getMemoryRunState as lr, RegexFilterProcessor as ls, modelConfigSchema as lt, currentRunGeneration as lu, agentThreadStreamRuntime as m, InMemoryBlobStore as ma, DurableStepIds as mc, KnowledgeImporterBindingConflictError as mi, hydrateSerializedStepErrors as ml, KnowledgeSemanticIndex as mn, spanQueryRowSchema as mo, assertKnowledgeCeilingRaised as mr, groupLinkedToolMessages as ms, rebuildRunToolsFromMastra as mt, runOutsideRunFenceScope as mu, ExtendedRunRegistry as n, DatasetsInMemory as na, emitErrorEvent as nc, notificationSignalMetadata as ni, applyStateDelta as nl, heldScopes as nn, SPAN_QUERY_ORDER_FIELDS as no, BaseProcessor as nr, WorkspaceInstructionsProcessor as ns, buildStepRecord as nt, WorkflowStepConflictError as nu, endRunSpansWithError as o, assertSupportedPatterns as oa, emitSuspendedEvent as oc, readNotificationRoutingRequirement as oi, createRestartExecutionParams as ol, knowledgeAgentScopes as on, parseSpanQueryRequest as oo, WorkingMemory as or, ToolSearchProcessor as os, baseDurableAgenticInputSchema as ot, RUN_FENCING_NOT_SUPPORTED_ERROR_ID as ou, AgentThreadLeaseLostError as p, ChannelsStorage as pa, DurableAgentDefaults as pc, InMemoryKnowledgeStorage as pi, getStepIds as pl, upsertKnowledgePage as pn, spanQueryResponseSchema as po, MAX_KNOWLEDGE_SCOPE_TAGS as pr, TokenLimiterProcessor as ps, loadRunStoredMessages as pt, runFencingNotSupportedError as pu, serializeDurableOptions as q, planThreadRowsQuery as qa, normalizeConcurrency as qc, knowledgePinDepth as qi, ProcessorStepInputSchema as ql, CONTINUE_RUN_MESSAGE as qn, isSystemReminderMessage as qo, InMemorySchedulesStorage as qr, createStep as qs, runCompletionScorers as qt, RunRegistry as r, DatasetsStorage as ra, emitFinishEvent as rc, notificationSummaryContents as ri, assertTimeTravelGraphMatchesSnapshot as rl, KnowledgeRun as rn, buildSpanQueryResponse as ro, MemoryInputFilter as rr, SkillSearchProcessor as rs, calculateAccumulatedUsage as rt, assertWorkflowStepGuard as ru, getActiveDurableAgentWorkflowExecutions as s, createValidator as sa, AgentStreamBus as sc, MAX_NOTIFICATION_DELIVERY_ATTEMPTS as si, createTimeTravelExecutionParams as sl, knowledgePersonaScopes as sn, planSpanQuery as so, MessageHistory as sr, AgentsMDInjector as ss, baseIterationStateSchema as st, RunFenceConflictError as su, DURABLE_CONTEXT_SEGMENT_KEY as t, ExperimentsStorage as ta, emitChunkEvent as tc, notificationSignalAttributes as ti, abortableSleep as tl, buildKnowledgePageTools as tn, SPAN_QUERY_MAX_PREVIEW_CHARACTERS as to, toChatLogger as tr, buildResponseCacheKey as ts, resolveDurableToolCallConcurrency as tt, isAgentCompatible as tu, isDurableAgentExecutionDetached as u, SchemaUpdateValidationError as ua, subscribeToAbortRequests as uc, resolveNotificationDeliveryDecision as ui, getRestartStartIndex as ul, removeKnowledgeNote as un, spanQueryIdentityKey as uo, MockMemory as ur, CostGuardProcessor as us, modelListEntrySchema as ut, isRunFenceConflictError as uu, runEvals as v, executeRetentionPrune as va, AgentStreamEventTypes as vc, KNOWLEDGE_STORAGE_SCHEMA_VERSION as vi, omitPriorSuspensionFields as vl, refreshKnowledgeLinksTo as vn, planThreadQuery as vo, canonicalizeKnowledgeScope as vr, isAfterMemoryTokenBoundary as vs, resolveTool$1 as vt, ScorerRunError as w, createVectorErrorId as wa, Run as wc, KnowledgeUnsupportedCapabilityError as wi, validateStepResumeData as wl, knowledgeRoleOn as wn, buildScoreRecord as wo, knowledgeSemanticIdempotencyKey as wr, LanguageDetector as ws, liveSegmentSpan as wt, validateAndSaveScore as x, runRetentionBatches as xa, EventedExecutionEngine as xc, KnowledgeSchemaResetRequiredError as xi, setLongTimeout as xl, updateKnowledgeLinks as xn, buildFeedbackRecord as xo, isKnowledgeScopeVisible as xr, ModelSelectionProcessor as xs, createDurableAgentStream as xt, flushBeforeTraceRead as y, resolveRetentionTargets as ya, CONTROLLER_RUN_BINDING_KEY as yc, KnowledgeConflictError as yi, resolveForeachConcurrency as yl, reindexKnowledgeLinks as yn, planTraceQuery as yo, createKnowledgeNodeCursor as yr, normalizeMessageHistoryConfig as ys, toolRequiresApproval as yt, persistDurableRunInput as z, readTracePage as za, evaluateScoringPredicate as zc, MAX_KNOWLEDGE_PAGE_LINK_REF_LENGTH as zi, MessagePartSchema as zl, REPLY_TOOL_NAME as zn, extractMessageEmbeddingText as zo, mergeStepResult as zr, getGoalActivityDurationMs as zs, getServerSideFallbackInfo as zt };
|