@mastra/core 1.87.0-alpha.18 → 1.87.0-alpha.19
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/@internal_ai-v6@0.0.99/dist/index.d.ts +2075 -123
- package/dist/_types/@internal_core@0.1.4/dist/knowledge-compat/index.d.ts +30 -3
- package/dist/agent/agent.d.ts +2 -4
- package/dist/agent/agent.types.d.ts +1 -0
- package/dist/agent/durable/index.cjs +86 -86
- package/dist/agent/durable/index.js +2 -2
- package/dist/agent/durable/run-registry.d.ts +54 -25
- package/dist/agent/index.cjs +16 -16
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.js +3 -3
- package/dist/agent/scopes.d.ts +8 -0
- package/dist/agent/types.d.ts +1 -0
- 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 +8 -1
- package/dist/agent-controller/index.cjs +3 -3
- package/dist/agent-controller/index.js +3 -3
- package/dist/{agent-controller-D_OKCLUP.cjs → agent-controller-DzOEhUjR.cjs} +39 -35
- package/dist/{agent-controller-UZNIM4h-.js → agent-controller-lBdNfcFi.js} +15 -11
- package/dist/{agent-skills-resolver-BMoCDoaK.cjs → agent-skills-resolver-2d8k7ioj.cjs} +134 -109
- package/dist/{agent-skills-resolver-CUEIMDbx.js → agent-skills-resolver-D2HktP6Y.js} +134 -109
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-CioDMzgY.js → background-tasks-DAu4WaCb.js} +1 -1
- package/dist/{background-tasks-CLWnX7SN.cjs → background-tasks-DOmQdBVn.cjs} +1 -1
- package/dist/browser/index.cjs +4 -4
- package/dist/browser/index.js +4 -4
- package/dist/{builder-BC4l-RN5.cjs → builder-BFcVEbX0.cjs} +3 -3
- package/dist/{builder-CQLqpQO_.js → builder-DHFtMW8D.js} +2 -2
- package/dist/capabilities/302ai.json +198 -198
- package/dist/capabilities/abacus.json +2 -96
- package/dist/capabilities/abliteratedllm.json +36 -36
- package/dist/capabilities/abliteration-ai.json +11 -11
- package/dist/capabilities/above.json +19 -19
- package/dist/capabilities/adaption.json +11 -11
- package/dist/capabilities/adzuki.json +32 -32
- package/dist/capabilities/agentrouter.json +12 -12
- package/dist/capabilities/agnes.json +4 -4
- package/dist/capabilities/ai-router.json +5 -5
- package/dist/capabilities/aiand.json +25 -25
- package/dist/capabilities/aigrow.json +13 -13
- package/dist/capabilities/aimlapi.json +144 -144
- package/dist/capabilities/aipg.json +2 -2
- package/dist/capabilities/aixy.json +24 -24
- package/dist/capabilities/aki-io.json +12 -12
- package/dist/capabilities/alibaba-cn.json +81 -126
- 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 +57 -53
- package/dist/capabilities/alibaba-token-plan.json +57 -53
- package/dist/capabilities/alibaba.json +76 -71
- package/dist/capabilities/ambient.json +14 -32
- package/dist/capabilities/amd-tokenlab.json +41 -0
- package/dist/capabilities/amd.json +8 -8
- package/dist/capabilities/anthropic.json +32 -56
- package/dist/capabilities/anyapi.json +47 -47
- package/dist/capabilities/apiko.json +5 -5
- package/dist/capabilities/arcee.json +5 -5
- package/dist/capabilities/augure.json +4 -4
- package/dist/capabilities/auriko.json +15 -15
- package/dist/capabilities/bailing.json +3 -3
- package/dist/capabilities/baseten.json +35 -35
- package/dist/capabilities/bee.json +5 -5
- package/dist/capabilities/berget.json +2 -35
- package/dist/capabilities/bothub.json +14 -14
- package/dist/capabilities/boundless.json +39 -39
- package/dist/capabilities/bumo.json +40 -40
- package/dist/capabilities/byteplus.json +28 -28
- package/dist/capabilities/cheapest-token.json +31 -31
- package/dist/capabilities/chutes.json +48 -17
- package/dist/capabilities/cline-pass.json +32 -45
- package/dist/capabilities/cloudcode.json +8 -8
- package/dist/capabilities/cloudferro-sherlock.json +4 -4
- package/dist/capabilities/cloudflare-workers-ai.json +17 -17
- package/dist/capabilities/commandcode.json +141 -156
- package/dist/capabilities/concentrate.json +289 -289
- package/dist/capabilities/cortecs.json +103 -103
- package/dist/capabilities/crossmodel.json +194 -194
- package/dist/capabilities/crusoe.json +18 -18
- package/dist/capabilities/daoxe.json +9 -9
- package/dist/capabilities/databricks.json +128 -128
- package/dist/capabilities/deepinfra.json +98 -94
- package/dist/capabilities/deepseek.json +4 -4
- package/dist/capabilities/digitalocean.json +114 -114
- package/dist/capabilities/dinference.json +1 -2
- package/dist/capabilities/dothoosh.json +26 -26
- package/dist/capabilities/doubleword.json +23 -23
- package/dist/capabilities/edenai.json +285 -285
- package/dist/capabilities/empiriolabs.json +176 -167
- package/dist/capabilities/engy.json +16 -16
- package/dist/capabilities/entrim.json +8 -8
- package/dist/capabilities/evroc.json +15 -15
- package/dist/capabilities/ezkielyna.json +10 -10
- package/dist/capabilities/fastrouter.json +93 -97
- package/dist/capabilities/fireworks-ai.json +85 -85
- package/dist/capabilities/fortytwo.json +4 -4
- package/dist/capabilities/freemodel.json +7 -51
- package/dist/capabilities/friendli.json +8 -8
- package/dist/capabilities/frogbot.json +95 -103
- package/dist/capabilities/gisoo.json +15 -15
- package/dist/capabilities/gmicloud.json +21 -21
- package/dist/capabilities/google.json +55 -55
- package/dist/capabilities/graphn.json +10 -10
- package/dist/capabilities/greenpt.json +35 -35
- package/dist/capabilities/groq.json +7 -20
- package/dist/capabilities/helicone.json +84 -86
- package/dist/capabilities/hetzner.json +4 -4
- package/dist/capabilities/hopper.json +2 -2
- package/dist/capabilities/hostinger-router.json +5 -5
- package/dist/capabilities/hpc-ai.json +8 -24
- package/dist/capabilities/huawei-maas.json +13 -13
- package/dist/capabilities/hubris.json +30 -30
- package/dist/capabilities/huggingface.json +86 -101
- package/dist/capabilities/hyper.json +24 -24
- package/dist/capabilities/impossibl.json +152 -199
- package/dist/capabilities/inceptron.json +8 -8
- package/dist/capabilities/inco.json +4 -21
- package/dist/capabilities/infer.json +16 -16
- package/dist/capabilities/inferall.json +2 -18
- package/dist/capabilities/inference-coop.json +6 -6
- package/dist/capabilities/inference.json +2 -11
- package/dist/capabilities/inferenceapis.json +24 -24
- package/dist/capabilities/infersia.json +13 -13
- package/dist/capabilities/inferx.json +3 -3
- package/dist/capabilities/infomaniak.json +3 -3
- package/dist/capabilities/io-net.json +6 -16
- package/dist/capabilities/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +42 -80
- package/dist/capabilities/jalapeno.json +11 -11
- package/dist/capabilities/jiekou.json +19 -167
- package/dist/capabilities/joingonka.json +4 -4
- package/dist/capabilities/jzstoken.json +54 -54
- package/dist/capabilities/keln.json +23 -23
- package/dist/capabilities/kenari.json +122 -130
- package/dist/capabilities/kilo.json +649 -647
- package/dist/capabilities/kimi-code-plan-cn.json +7 -7
- package/dist/capabilities/kimi-code-plan-global.json +7 -7
- package/dist/capabilities/kitani.json +4 -4
- package/dist/capabilities/klavo.json +24 -24
- package/dist/capabilities/korouter.json +32 -32
- package/dist/capabilities/kunavo.json +7 -7
- package/dist/capabilities/liquid.json +8 -8
- package/dist/capabilities/lithosai.json +3 -3
- package/dist/capabilities/llmgateway-providers.json +885 -893
- package/dist/capabilities/llmgateway.json +340 -340
- package/dist/capabilities/llmtr.json +16 -54
- package/dist/capabilities/lowrouter.json +61 -61
- package/dist/capabilities/lyceum.json +14 -14
- package/dist/capabilities/meganova.json +0 -1
- package/dist/capabilities/melious.json +14 -14
- package/dist/capabilities/merge-gateway.json +292 -292
- 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 +15 -31
- package/dist/capabilities/mixlayer.json +5 -5
- package/dist/capabilities/moark.json +0 -2
- package/dist/capabilities/modal.json +8 -8
- package/dist/capabilities/model-oracle-ai.json +19 -27
- package/dist/capabilities/modelis.json +14 -14
- package/dist/capabilities/modelscope.json +2 -2
- package/dist/capabilities/modular.json +11 -11
- package/dist/capabilities/moneo.json +7 -38
- package/dist/capabilities/moonshotai-cn.json +7 -7
- package/dist/capabilities/moonshotai.json +7 -7
- package/dist/capabilities/morph.json +13 -13
- package/dist/capabilities/munito-eu.json +8 -8
- package/dist/capabilities/munito.json +10 -10
- package/dist/capabilities/nan.json +31 -31
- package/dist/capabilities/nano-gpt.json +581 -603
- package/dist/capabilities/nearai.json +119 -119
- package/dist/capabilities/nebius.json +30 -31
- package/dist/capabilities/neon.json +132 -132
- package/dist/capabilities/neuralwatt.json +41 -41
- package/dist/capabilities/nokeep.json +5 -5
- package/dist/capabilities/novita-ai.json +113 -227
- package/dist/capabilities/nvidia.json +14 -82
- package/dist/capabilities/oathbreaker.json +2 -2
- package/dist/capabilities/obscurify.json +28 -28
- package/dist/capabilities/oci.json +4 -4
- package/dist/capabilities/ofox.json +270 -270
- package/dist/capabilities/ollama-cloud.json +53 -53
- package/dist/capabilities/openai.json +57 -57
- package/dist/capabilities/opencode-go.json +88 -90
- package/dist/capabilities/openreason.json +5 -5
- package/dist/capabilities/openrouter.json +574 -563
- package/dist/capabilities/opper.json +29 -34
- package/dist/capabilities/orcarouter.json +307 -367
- package/dist/capabilities/outerlabs.json +30 -30
- package/dist/capabilities/ovhcloud.json +19 -19
- package/dist/capabilities/pareto.json +2 -7
- package/dist/capabilities/perplexity-agent.json +47 -102
- package/dist/capabilities/perplexity.json +2 -2
- package/dist/capabilities/phala.json +35 -35
- package/dist/capabilities/pioneer.json +5 -122
- package/dist/capabilities/poe.json +130 -130
- package/dist/capabilities/poolside.json +2 -2
- package/dist/capabilities/powerspring.json +14 -14
- package/dist/capabilities/primalabs.json +12 -12
- package/dist/capabilities/prime.json +123 -115
- package/dist/capabilities/privatemode-ai.json +8 -36
- package/dist/capabilities/proxystacks.json +5 -5
- package/dist/capabilities/qihang-ai.json +3 -15
- package/dist/capabilities/qiniu-ai.json +13 -87
- package/dist/capabilities/refuseless.json +7 -14
- package/dist/capabilities/regolo-ai.json +9 -13
- package/dist/capabilities/requesty.json +202 -202
- package/dist/capabilities/routing-run.json +3 -40
- package/dist/capabilities/ruapi.json +21 -21
- package/dist/capabilities/runcrate.json +10 -10
- package/dist/capabilities/runinfra.json +16 -16
- package/dist/capabilities/sakana.json +3 -3
- package/dist/capabilities/sambanova.json +9 -9
- package/dist/capabilities/sandbase.json +20 -20
- package/dist/capabilities/sarvam.json +22 -13
- package/dist/capabilities/scaleway.json +18 -18
- package/dist/capabilities/scnet-token-plan.json +7 -7
- package/dist/capabilities/scx-ai.json +16 -32
- package/dist/capabilities/sensenova.json +12 -12
- package/dist/capabilities/siliconflow-cn.json +45 -97
- package/dist/capabilities/siliconflow.json +53 -53
- package/dist/capabilities/snowflake-cortex.json +26 -26
- package/dist/capabilities/sokkan.json +8 -20
- package/dist/capabilities/sparrowcodes.json +21 -21
- package/dist/capabilities/stackit.json +1 -2
- package/dist/capabilities/standardcompute.json +84 -120
- package/dist/capabilities/steadyrouter.json +41 -41
- package/dist/capabilities/stepfun-ai-step-plan.json +8 -8
- package/dist/capabilities/stepfun-ai.json +8 -8
- package/dist/capabilities/stepfun-step-plan.json +8 -8
- package/dist/capabilities/stepfun.json +8 -8
- package/dist/capabilities/stepping-stone.json +15 -15
- package/dist/capabilities/subconscious.json +2 -2
- package/dist/capabilities/superbot-gg.json +4 -4
- package/dist/capabilities/synthetic.json +8 -17
- package/dist/capabilities/synthorai.json +21 -21
- package/dist/capabilities/teamorouter.json +23 -23
- package/dist/capabilities/teapot-router.json +10 -10
- package/dist/capabilities/tencent-token-plan-intl.json +25 -25
- package/dist/capabilities/tencent-token-plan.json +38 -38
- package/dist/capabilities/tencent-tokenhub.json +46 -46
- package/dist/capabilities/tensorx.json +48 -48
- package/dist/capabilities/tenstorrent.json +4 -4
- package/dist/capabilities/the-grid-ai.json +29 -29
- package/dist/capabilities/thinkingmachines.json +71 -71
- package/dist/capabilities/tinfoil.json +8 -8
- package/dist/capabilities/toapis.json +3 -3
- package/dist/capabilities/togetherai.json +42 -42
- package/dist/capabilities/tokengo.json +21 -21
- package/dist/capabilities/tokenify.json +2 -2
- package/dist/capabilities/trustedrouter.json +5 -5
- package/dist/capabilities/trustedtokens.json +15 -15
- package/dist/capabilities/umans-ai-coding-plan.json +16 -16
- package/dist/capabilities/umans-ai.json +13 -13
- package/dist/capabilities/uncensuredai.json +4 -4
- package/dist/capabilities/unorouter.json +1 -22
- package/dist/capabilities/unrestricted.json +4 -20
- package/dist/capabilities/uplinkswitch.json +21 -21
- package/dist/capabilities/upstage.json +3 -15
- package/dist/capabilities/vancine.json +20 -20
- package/dist/capabilities/vercel.json +551 -551
- package/dist/capabilities/vivgrid.json +51 -131
- package/dist/capabilities/volcengine-coding-plan.json +29 -29
- package/dist/capabilities/volcengine.json +27 -27
- package/dist/capabilities/vultr.json +14 -67
- package/dist/capabilities/wafer.ai.json +17 -17
- package/dist/capabilities/wallaby.json +2 -2
- package/dist/capabilities/wally.json +12 -12
- package/dist/capabilities/wandb.json +21 -21
- package/dist/capabilities/watt.json +22 -22
- package/dist/capabilities/xai.json +5 -5
- 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 +30 -30
- package/dist/capabilities/zai-coding-plan.json +17 -17
- package/dist/capabilities/zai.json +31 -31
- package/dist/capabilities/zenifra.json +26 -26
- package/dist/capabilities/zenmux.json +190 -233
- package/dist/capabilities/zerogpu.json +8 -8
- package/dist/capabilities/zhipuai-coding-plan.json +3 -14
- package/dist/capabilities/zhipuai.json +30 -30
- package/dist/capabilities/zro.json +6 -6
- package/dist/channels/index.cjs +24 -24
- package/dist/channels/index.js +2 -2
- package/dist/{channels-Bemsws_d.js → channels-BBwgs50q.js} +2 -2
- package/dist/{channels-B7-KI9Ob.cjs → channels-CbhgGgQD.cjs} +6 -6
- package/dist/coding-agent/index.cjs +7 -7
- package/dist/coding-agent/index.js +4 -4
- package/dist/{constants-CFO8w780.cjs → constants-B2FVV_2e.cjs} +1 -1
- package/dist/{constants-CUv0mU2y.js → constants-Dro9fuhk.js} +1 -1
- package/dist/datasets/index.cjs +9 -9
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1147 -1142
- package/dist/docs/references/docs-agents-overview.md +9 -0
- package/dist/docs/references/docs-deployment-workers.md +1 -1
- package/dist/docs/references/docs-harness-background-tasks.md +8 -5
- package/dist/docs/references/docs-harness-durable-agents.md +1 -0
- package/dist/docs/references/docs-knowledge-search.md +1 -1
- package/dist/docs/references/docs-server-pubsub.md +1 -1
- package/dist/docs/references/docs-skills.md +4 -1
- package/dist/docs/references/docs-workflows-overview.md +2 -0
- package/dist/docs/references/reference-agents-createSkill.md +20 -1
- package/dist/docs/references/reference-knowledge-knowledge-tools.md +1 -2
- package/dist/docs/references/reference-observability-metrics-metrics-context.md +63 -3
- package/dist/docs/references/reference-pubsub-base.md +1 -1
- package/dist/docs/references/reference-pubsub-redis-streams.md +3 -5
- package/dist/docs/references/reference-pubsub-valkey-streams.md +2 -2
- package/dist/docs/references/reference-templates-overview.md +31 -1
- package/dist/docs/references/reference-workflows-run-methods-restart.md +2 -0
- package/dist/evals/index.cjs +13 -13
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +4 -4
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.js +1 -1
- package/dist/events/pubsub.d.ts +1 -3
- package/dist/{run-registry-Cu9CK7AR.js → execution-fence-B8yV_n51.js} +62508 -62052
- package/dist/{run-registry-CXeR1Qso.cjs → execution-fence-fqV6FGdV.cjs} +63621 -63153
- package/dist/harness/index.cjs +3 -3
- package/dist/harness/index.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/integration/index.cjs +1 -1
- package/dist/integration/index.js +1 -1
- package/dist/knowledge/index.cjs +163 -153
- package/dist/knowledge/index.js +18 -8
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/gateways/opencode-session-header.d.ts +28 -0
- package/dist/llm/model/provider-types.generated.d.ts +7412 -7795
- package/dist/llm/model/resolve-model.d.ts +1 -0
- package/dist/llm/model/shared.types.d.ts +1 -0
- package/dist/{llm-ZA8oIVog.cjs → llm-B7ul27Ay.cjs} +32 -14
- package/dist/{llm-DCoDWje0.js → llm-Cy3WZXgA.js} +32 -14
- package/dist/loop/index.cjs +15 -15
- package/dist/loop/index.js +2 -2
- package/dist/loop/server.cjs +1 -1
- package/dist/loop/server.js +1 -1
- package/dist/{manager-oP6iB_H-.cjs → manager-CY-RzZJL.cjs} +21 -19
- package/dist/{manager-DSbR85XK.js → manager-Dsub5fyz.js} +9 -7
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.d.ts +33 -4
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-FEJ-anIN.cjs → mastra-DXQUuwFl.cjs} +116 -67
- package/dist/{mastra-RgFRZ_Az.js → mastra-yjoYfTS5.js} +76 -27
- package/dist/memory/index.cjs +24 -24
- package/dist/memory/index.js +2 -2
- package/dist/memory/mock.d.ts +2 -3
- package/dist/{model-opyZwnK3.cjs → model-BARBpXDN.cjs} +2 -2
- package/dist/{model-DSBVKOW8.js → model-DauH8JTo.js} +2 -2
- package/dist/{netlify-BqMGvc2s.js → netlify-BNBtKR4Q.js} +86 -4
- package/dist/{netlify-DzturPW3.cjs → netlify-DGsETiFB.cjs} +97 -3
- package/dist/notifications/index.cjs +18 -18
- package/dist/notifications/index.js +2 -2
- package/dist/observability/index.cjs +1 -1
- package/dist/observability/index.js +1 -1
- package/dist/{observability-D7RNOAPx.js → observability-DPDWibyH.js} +648 -648
- package/dist/{output-helpers-DgsH4aTb.cjs → output-helpers-By5FbLpp.cjs} +71 -73
- package/dist/{output-helpers-CVzhy1Y0.js → output-helpers-k2-48ssH.js} +72 -74
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +65 -65
- package/dist/processors/index.js +2 -2
- package/dist/{provider-registry-BcG2ooFa.js → provider-registry-CfHy4Zhw.js} +21401 -22401
- package/dist/{provider-registry-BZw14X9M.cjs → provider-registry-Y6tbfFhH.cjs} +21401 -22401
- package/dist/provider-registry.json +21940 -22961
- package/dist/{registry-generator-BrzPSCHS.cjs → registry-generator-BEJ0APNc.cjs} +1 -1
- package/dist/{registry-generator-CA4YBIHo.js → registry-generator-DJiQAI8V.js} +1 -1
- package/dist/{rehydrate-CfS6KkCr.cjs → rehydrate-4Sl7D3kO.cjs} +14 -14
- package/dist/{rehydrate-Chuw5IrY.js → rehydrate-Da4_E_N8.js} +2 -2
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +2 -2
- package/dist/{signal-provider-BslnAjWG.js → signal-provider-B_mfW-J4.js} +1 -1
- package/dist/{signal-provider-BFAvh_AJ.cjs → signal-provider-D9gbevHN.cjs} +1 -1
- package/dist/signals/index.cjs +3 -3
- package/dist/signals/index.js +3 -3
- package/dist/{signals-CbmgVwL-.cjs → signals-BwDXGqxc.cjs} +2 -2
- package/dist/{signals-Clupx3jz.js → signals-TznxWfM3.js} +2 -2
- package/dist/skills/create-skill.d.ts +3 -0
- package/dist/skills/index.cjs +1 -1
- package/dist/skills/index.js +1 -1
- package/dist/skills/inline-skill-source.d.ts +5 -1
- package/dist/skills/types.d.ts +16 -1
- package/dist/{source-DYZMfjv3.js → source-B3He4_mz.js} +1 -1
- package/dist/{source-BC8Et5qZ.cjs → source-C_nWbqI0.cjs} +1 -1
- package/dist/{state-processor-B9kxpM53.js → state-processor-B_KsS82m.js} +1 -1
- package/dist/{state-processor-kRNZ38Nf.cjs → state-processor-DaSmhVUX.cjs} +1 -1
- package/dist/storage/constants.cjs +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/agents/index.cjs +1 -1
- package/dist/storage/domains/agents/index.js +1 -1
- package/dist/storage/domains/inmemory-db.d.ts +1 -1
- package/dist/storage/domains/knowledge/pages.d.ts +8 -1
- package/dist/storage/domains/memory/base.d.ts +19 -9
- package/dist/storage/domains/memory/inmemory.d.ts +4 -1
- package/dist/storage/domains/memory/queue-thread.d.ts +7 -1
- package/dist/storage/domains/workflows/base.d.ts +18 -5
- package/dist/storage/domains/workflows/inmemory.d.ts +3 -5
- package/dist/storage/domains/workflows/journal.d.ts +16 -1
- package/dist/storage/index.cjs +187 -186
- package/dist/storage/index.js +6 -6
- package/dist/storage/workflow-snapshot.d.ts +4 -0
- package/dist/storage/workflow-step-guard.d.ts +5 -0
- package/dist/stream/base/output.d.ts +1 -0
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-DTpp9Tk-.js → stream-BFhCDJvz.js} +18 -8
- package/dist/{stream-CiXZtgym.cjs → stream-CZy8XA_q.cjs} +23 -7
- package/dist/telemetry/index.cjs +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/test-utils/llm-mock.cjs +1 -1
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/{tool-Z3bykc1m.js → tool-DIFduuTw.js} +2 -5
- package/dist/{tool-CYlT2UA-.cjs → tool-Dn9WSDVn.cjs} +2 -5
- package/dist/tool-loop-agent/index.cjs +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/{tool-loop-agent-DtEg90Zj.cjs → tool-loop-agent-DifR6VLI.cjs} +4 -4
- package/dist/{tool-loop-agent-CqzgY98a.js → tool-loop-agent-SOpIJRws.js} +3 -3
- package/dist/{toolchecks-DrsZdc3S.js → toolchecks-CRAfUe9H.js} +1 -1
- package/dist/{toolchecks-MFU48cit.cjs → toolchecks-DbBsQGHW.cjs} +1 -1
- package/dist/tools/index.cjs +5 -5
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +5 -5
- package/dist/tools/is-vercel-tool.cjs +1 -1
- package/dist/tools/is-vercel-tool.js +1 -1
- package/dist/tools/tool.d.ts +2 -4
- package/dist/tools/types.d.ts +1 -0
- package/dist/{tools-BEYxowf0.cjs → tools-C2q0ougI.cjs} +1 -1
- package/dist/{tools-tPy2FwMI.js → tools-ybbz1YKg.js} +1 -1
- package/dist/{utils-B_y5EDSz.cjs → utils-BjFntMW_.cjs} +6 -5
- package/dist/{utils-tRzJ8Xfy.js → utils-DN_kWhH6.js} +6 -5
- package/dist/utils.cjs +3 -3
- package/dist/utils.js +3 -3
- package/dist/{validate-DpK_G9aa.cjs → validate-CBQ0dMBb.cjs} +1 -1
- package/dist/{validate-hFVBw9Sw.js → validate-KIBMWuyc.js} +1 -1
- package/dist/vector/index.cjs +8 -8
- package/dist/vector/index.js +1 -1
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/{worker-BFAw0uVe.js → worker-Bqg7bsxX.js} +8 -3
- package/dist/{worker-BhaB8pNL.cjs → worker-CJ_JYSy0.cjs} +3 -3
- package/dist/{worker-KkDudGwX.cjs → worker-Ct6E5_2p.cjs} +16 -11
- package/dist/{worker-m_uyOwiv.js → worker-DVM_pvH7.js} +2 -2
- package/dist/{workflow-Uroh6hlJ.js → workflow-BmShpn3p.js} +4 -4
- package/dist/{workflow-BwKfyvhR.cjs → workflow-DEAvg0pI.cjs} +8 -8
- package/dist/workflows/builder/index.cjs +1 -1
- package/dist/workflows/builder/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/evented/workflow-event-processor/index.d.ts +0 -2
- package/dist/workflows/evented/workflow.d.ts +2 -1
- package/dist/workflows/index.cjs +54 -54
- package/dist/workflows/index.js +4 -4
- package/dist/workflows/run-storage.d.ts +16 -1
- package/dist/workflows/types.d.ts +10 -0
- package/dist/workflows/workflow.d.ts +3 -1
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/{workspace-CzzrnE6Q.cjs → workspace-BQD4tcQi.cjs} +3 -3
- package/dist/{workspace-Ct2kAiDv.js → workspace-sqcfdZRR.js} +2 -2
- package/package.json +9 -8
- package/skills/mastra/SKILL.md +171 -0
- package/skills/mastra/references/common-errors.md +557 -0
- package/skills/mastra/references/core-concepts.md +21 -0
- package/skills/mastra/references/create-mastra.md +233 -0
- package/skills/mastra/references/embedded-docs.md +103 -0
- package/skills/mastra/references/feedback.md +69 -0
- package/skills/mastra/references/gateway.md +66 -0
- package/skills/mastra/references/mastra-api.md +222 -0
- package/skills/mastra/references/migration-guide.md +185 -0
- package/skills/mastra/references/model-selection.md +29 -0
- package/skills/mastra/references/platform.md +164 -0
- package/skills/mastra/references/remote-docs.md +193 -0
- package/skills/mastra/references/trace-query.md +150 -0
- package/skills/mastra/scripts/provider-registry.mjs +271 -0
- package/src/llm/model/provider-types.generated.d.ts +7412 -7795
- package/dist/{observability-B0R_D1PZ.cjs → observability-VaoaeadK.cjs} +647 -647
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import { l as BackgroundTaskManager } from "./background-tasks-
|
|
1
|
+
import { $c as createConcurrencyLimiter, Bc as createNestedRunParentStatusLookup, Bl as hasDurableExecution, Fo as getStorageSource, Fs as WorkflowEventProcessor, Hc as nestedRunRecoveryAction, Hl as isDurableAgentLike, Jc as WORKFLOW_RUN_LEASE_TTL_MS, Ll as assertDrainTimeout, Lr as dispatchDueNotifications, Ls as computeScheduleDefinitionHash, Ns as createStep, Po as augmentWithInit, Ps as createWorkflow, Rl as waitMs, Uc as nestedRunStatusOf, Vc as nestedRunParentOf, Xc as repeatAfterSettled, Yc as renewWorkflowLease, Zc as runFenceConflictOf, br as WorkflowsInMemory, bu as runOutsideRunFenceScope, el as normalizeConcurrency, i as agentThreadStreamRuntime, mt as __registerMastraCtor, n as getExecutionClaimScope, na as BackgroundTasksInMemory, oc as getActiveDurableAgentWorkflowExecutions, rc as abandonDurableAgentExecutions, sc as getExecutingInstances, tl as runWithConcurrency, u as createOnScorerHook, uc as isDurableAgentExecutionDetached, vr as InMemoryStore, yn as AgentChannels, zc as cancelNestedRun } from "./execution-fence-B8yV_n51.js";
|
|
2
|
+
import { l as BackgroundTaskManager } from "./background-tasks-DAu4WaCb.js";
|
|
3
3
|
import { t as InMemoryServerCache } from "./inmemory-BK3zLwvM.js";
|
|
4
|
-
import { t as DatasetsManager } from "./manager-
|
|
4
|
+
import { t as DatasetsManager } from "./manager-Dsub5fyz.js";
|
|
5
5
|
import { i as MastraError, n as ErrorDomain, t as ErrorCategory } from "./error-oh2DLsP2.js";
|
|
6
|
-
import {
|
|
6
|
+
import { d as isRunLocalTopic, v as EventEmitterPubSub } from "./output-helpers-k2-48ssH.js";
|
|
7
7
|
import { a as registerHook, r as deregisterHook } from "./hooks-Bth8Cjpj.js";
|
|
8
8
|
import { LicenseClient } from "./license/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import { l as defaultGateways } from "./llm-
|
|
9
|
+
import { g as getGatewayId } from "./netlify-BNBtKR4Q.js";
|
|
10
|
+
import { l as defaultGateways } from "./llm-Cy3WZXgA.js";
|
|
11
11
|
import { l as isAdaptableLogger, n as LogLevel, t as ConsoleLogger, u as noopLogger } from "./logger-BwbmRqfc.js";
|
|
12
12
|
import { DualLogger, createExportSuppressedLogger, isObservabilityExportSuppressed, resolveTraceFields } from "./logger/index.js";
|
|
13
13
|
import { c as fsAgentScheduleRowId, g as toEpochMs, h as computeNextFireAt, l as parseFsAgentScheduleRowId, m as computeNextFire, t as Schedules } from "./schedules-DZfSx-7P.js";
|
|
14
|
-
import {
|
|
14
|
+
import { D as noOpLoggerContext, E as NoOpObservability, O as noOpMetricsContext } from "./observability-DPDWibyH.js";
|
|
15
15
|
import { initContextStorage } from "./observability/context-storage.js";
|
|
16
16
|
import { f as resolveCurrentSpan } from "./utils-DU_pU5SK.js";
|
|
17
|
-
import {
|
|
17
|
+
import { u as RequestContext } from "./request-context-COnZHt2-.js";
|
|
18
|
+
import { r as InMemoryDB } from "./source-B3He4_mz.js";
|
|
18
19
|
import { r as trackFeatureUsage } from "./feature-telemetry-DdR8J_5o.js";
|
|
19
|
-
import { r as isToolLoopAgentLike, t as toolLoopAgentToMastraAgent } from "./tool-loop-agent-
|
|
20
|
+
import { r as isToolLoopAgentLike, t as toolLoopAgentToMastraAgent } from "./tool-loop-agent-SOpIJRws.js";
|
|
20
21
|
import { r as normalizeToolPayloadTransformPolicy } from "./payload-transform-Dj3HUeD4.js";
|
|
21
|
-
import { v as readPositiveIntEnv } from "./utils-
|
|
22
|
-
import { a as OrchestrationWorker, i as ORCHESTRATION_GROUP, n as BackgroundTaskWorker, r as SchedulerWorker } from "./worker-
|
|
23
|
-
import { n as normalizeWorkflowBuilderDefinition } from "./builder-
|
|
24
|
-
import { d as toJsonSchemaOrUndefined, p as collectNestedWorkflowIds, t as assertValidDynamicWorkflow } from "./validate-
|
|
25
|
-
import { t as rehydrateWorkflow } from "./rehydrate-
|
|
26
|
-
import {
|
|
22
|
+
import { v as readPositiveIntEnv } from "./utils-DN_kWhH6.js";
|
|
23
|
+
import { a as OrchestrationWorker, i as ORCHESTRATION_GROUP, n as BackgroundTaskWorker, r as SchedulerWorker } from "./worker-Bqg7bsxX.js";
|
|
24
|
+
import { n as normalizeWorkflowBuilderDefinition } from "./builder-DHFtMW8D.js";
|
|
25
|
+
import { d as toJsonSchemaOrUndefined, p as collectNestedWorkflowIds, t as assertValidDynamicWorkflow } from "./validate-KIBMWuyc.js";
|
|
26
|
+
import { t as rehydrateWorkflow } from "./rehydrate-Da4_E_N8.js";
|
|
27
|
+
import { Rn as createRunScope } from "./stream-BFhCDJvz.js";
|
|
27
28
|
import { z } from "zod/v4";
|
|
28
29
|
// src/notifications/workflow.ts
|
|
29
30
|
const NOTIFICATION_DISPATCH_WORKFLOW_ID = "__mastra_notification_dispatcher";
|
|
@@ -583,10 +584,7 @@ function isRecoveryRestartable(workflow) {
|
|
|
583
584
|
* });
|
|
584
585
|
* ```
|
|
585
586
|
*
|
|
586
|
-
* @see
|
|
587
|
-
* `@mastra/core/package.json` with your project's resolver or package-manager
|
|
588
|
-
* tooling, then read `dist/docs/SKILL.md` from that package root and follow its
|
|
589
|
-
* reference links. Use package-manager tools for virtual or archived packages.
|
|
587
|
+
* @see Docs for this @mastra/core version are bundled at node_modules/@mastra/core/dist/docs/SKILL.md. Read it before guessing APIs from these types.
|
|
590
588
|
*
|
|
591
589
|
* @see [Mastra documentation](https://mastra.ai/reference/core/mastra-class)
|
|
592
590
|
* if packaged docs are unavailable.
|
|
@@ -759,6 +757,8 @@ var Mastra = class Mastra {
|
|
|
759
757
|
#workflowEventProcessor;
|
|
760
758
|
#pushSubscription;
|
|
761
759
|
#inFlightPushEvents = /* @__PURE__ */ new Set();
|
|
760
|
+
#workflowEventConsumer;
|
|
761
|
+
#inFlightDelegatedEvents = /* @__PURE__ */ new Set();
|
|
762
762
|
#activeEventedRuns = /* @__PURE__ */ new Set();
|
|
763
763
|
#userEventSubscriptions = [];
|
|
764
764
|
#schedulerWakeSubscription;
|
|
@@ -1267,7 +1267,7 @@ var Mastra = class Mastra {
|
|
|
1267
1267
|
queueMicrotask(() => {
|
|
1268
1268
|
if (!this.#storageFallbackWarningPending) return;
|
|
1269
1269
|
this.#storageFallbackWarningPending = false;
|
|
1270
|
-
this.#logger?.warn("No `storage` configured on Mastra
|
|
1270
|
+
this.#logger?.warn("No `storage` configured on Mastra, using in-memory storage. Data is lost on restart. Fine for local development; for production see https://mastra.ai/docs/storage. To opt in and hide this warning, pass `storage: new InMemoryStore()` (import from `@mastra/core/storage`).");
|
|
1271
1271
|
});
|
|
1272
1272
|
}
|
|
1273
1273
|
this.#storageSource = getStorageSource(storage);
|
|
@@ -2874,7 +2874,7 @@ var Mastra = class Mastra {
|
|
|
2874
2874
|
*/
|
|
2875
2875
|
async __ensureExperimentWorkflow() {
|
|
2876
2876
|
if (this.__hasInternalWorkflow("__mastra-experiment")) return;
|
|
2877
|
-
const { buildExperimentWorkflow } = await import("./manager-
|
|
2877
|
+
const { buildExperimentWorkflow } = await import("./manager-Dsub5fyz.js").then((n) => n.b);
|
|
2878
2878
|
if (this.__hasInternalWorkflow("__mastra-experiment")) return;
|
|
2879
2879
|
this.__registerInternalWorkflow(buildExperimentWorkflow(), void 0, { distributed: true });
|
|
2880
2880
|
}
|
|
@@ -5075,7 +5075,7 @@ var Mastra = class Mastra {
|
|
|
5075
5075
|
if (!this.#workerFilter || this.#workerFilter.has("agent-schedule")) {
|
|
5076
5076
|
let agentScheduleWorker = this.#findAgentScheduleWorker();
|
|
5077
5077
|
if (!agentScheduleWorker) {
|
|
5078
|
-
const { AgentScheduleWorker } = await import("./worker-
|
|
5078
|
+
const { AgentScheduleWorker } = await import("./worker-DVM_pvH7.js");
|
|
5079
5079
|
agentScheduleWorker = new AgentScheduleWorker();
|
|
5080
5080
|
agentScheduleWorker.__registerMastra(this);
|
|
5081
5081
|
this.#workers.push(agentScheduleWorker);
|
|
@@ -5678,6 +5678,51 @@ var Mastra = class Mastra {
|
|
|
5678
5678
|
return this.#workflowEventProcessor.handle(event);
|
|
5679
5679
|
}
|
|
5680
5680
|
/**
|
|
5681
|
+
* Registers how this instance's workers run a workflow event while they are
|
|
5682
|
+
* consuming. Returns a release that unregisters it unless it was replaced.
|
|
5683
|
+
*
|
|
5684
|
+
* @internal
|
|
5685
|
+
*/
|
|
5686
|
+
__registerWorkflowEventConsumer(consumer) {
|
|
5687
|
+
this.#workflowEventConsumer = consumer;
|
|
5688
|
+
return () => {
|
|
5689
|
+
if (this.#workflowEventConsumer === consumer) this.#workflowEventConsumer = void 0;
|
|
5690
|
+
};
|
|
5691
|
+
}
|
|
5692
|
+
/**
|
|
5693
|
+
* Hands a workflow event to the instance in this process that is executing
|
|
5694
|
+
* its durable-agent run, when that is another instance whose workers are
|
|
5695
|
+
* consuming. Returns undefined when the caller should process the event.
|
|
5696
|
+
*
|
|
5697
|
+
* Mastra instances sharing an in-process pubsub join the same consumer
|
|
5698
|
+
* group, so any of them can receive a step of a run another one started.
|
|
5699
|
+
* Only the instance that started the run holds its live state (memory,
|
|
5700
|
+
* request-scoped tools, abort controller, call-time hooks); a sibling would
|
|
5701
|
+
* have to rebuild it from storage like a worker in another process. An
|
|
5702
|
+
* instance on another pubsub never received the run's events, so it is not
|
|
5703
|
+
* handed any.
|
|
5704
|
+
*
|
|
5705
|
+
* @internal
|
|
5706
|
+
*/
|
|
5707
|
+
__delegateWorkflowEvent(event) {
|
|
5708
|
+
if (!event.runId) return void 0;
|
|
5709
|
+
const context = new RequestContext(Object.entries(event.data?.requestContext ?? {}));
|
|
5710
|
+
const execution = getExecutionClaimScope(context, event.runId, event.data?.parentWorkflow);
|
|
5711
|
+
if (!execution) return void 0;
|
|
5712
|
+
const bus = this.#pubsub.__rawBus();
|
|
5713
|
+
const owner = getExecutingInstances(execution.runId, execution.claim.executionId).find((instance) => instance.#pubsub.__rawBus() === bus);
|
|
5714
|
+
if (!owner || owner === this) return void 0;
|
|
5715
|
+
return owner.#consumeDelegatedWorkflowEvent(event);
|
|
5716
|
+
}
|
|
5717
|
+
#consumeDelegatedWorkflowEvent(event) {
|
|
5718
|
+
const consumer = this.#workflowEventConsumer;
|
|
5719
|
+
if (!consumer) return void 0;
|
|
5720
|
+
const delivery = consumer(event);
|
|
5721
|
+
this.#inFlightDelegatedEvents.add(delivery);
|
|
5722
|
+
delivery.then(() => this.#inFlightDelegatedEvents.delete(delivery), () => this.#inFlightDelegatedEvents.delete(delivery));
|
|
5723
|
+
return delivery;
|
|
5724
|
+
}
|
|
5725
|
+
/**
|
|
5681
5726
|
* Initialize and start workers. If `name` is provided, starts only
|
|
5682
5727
|
* that worker. Otherwise starts all registered workers and subscribes
|
|
5683
5728
|
* user-defined event listeners.
|
|
@@ -5715,7 +5760,7 @@ var Mastra = class Mastra {
|
|
|
5715
5760
|
this.#workers.push(sw);
|
|
5716
5761
|
}
|
|
5717
5762
|
if (!this.#findAgentScheduleWorker()) {
|
|
5718
|
-
const { AgentScheduleWorker } = await import("./worker-
|
|
5763
|
+
const { AgentScheduleWorker } = await import("./worker-DVM_pvH7.js");
|
|
5719
5764
|
const asw = new AgentScheduleWorker();
|
|
5720
5765
|
asw.__registerMastra(this);
|
|
5721
5766
|
this.#workers.push(asw);
|
|
@@ -5788,11 +5833,12 @@ var Mastra = class Mastra {
|
|
|
5788
5833
|
if (nack) track(nack().catch((err) => this.#logger.error("Error nacking workflow event", err)));
|
|
5789
5834
|
return;
|
|
5790
5835
|
}
|
|
5791
|
-
|
|
5836
|
+
const delegated = this.__delegateWorkflowEvent(event);
|
|
5837
|
+
if (!delegated && wfId && rId && !this.#ownsWorkflow(wfId, rId, data?.parentWorkflow)) {
|
|
5792
5838
|
if (ack) track(ack().catch((err) => this.#logger?.error?.("Error acking skipped workflow event", err)));
|
|
5793
5839
|
return;
|
|
5794
5840
|
}
|
|
5795
|
-
const inFlight = this.handleWorkflowEvent(event).then((result) => {
|
|
5841
|
+
const inFlight = (delegated ?? this.handleWorkflowEvent(event)).then((result) => {
|
|
5796
5842
|
if (result.ok) {
|
|
5797
5843
|
if (ack) return ack().catch((err) => this.#logger?.error?.("Error acking workflow event in push subscription", err));
|
|
5798
5844
|
return;
|
|
@@ -5814,6 +5860,7 @@ var Mastra = class Mastra {
|
|
|
5814
5860
|
topic: "workflows",
|
|
5815
5861
|
cb
|
|
5816
5862
|
};
|
|
5863
|
+
this.__registerWorkflowEventConsumer((event) => this.handleWorkflowEvent(event));
|
|
5817
5864
|
}
|
|
5818
5865
|
}
|
|
5819
5866
|
/**
|
|
@@ -5887,12 +5934,14 @@ var Mastra = class Mastra {
|
|
|
5887
5934
|
await this.#releaseRecoveryLeader();
|
|
5888
5935
|
while (this.#schedulingWorkersStartPromise) await this.#schedulingWorkersStartPromise.catch(() => {});
|
|
5889
5936
|
while (this.#executionWorkersStartPromise) await this.#executionWorkersStartPromise.catch(() => {});
|
|
5937
|
+
this.#workflowEventConsumer = void 0;
|
|
5890
5938
|
for (const worker of [...this.#workers].reverse()) if (worker.isRunning) await worker.stop({ drainTimeout: remaining() });
|
|
5891
5939
|
if (this.#pushSubscription) {
|
|
5892
5940
|
await this.#pubsub.unsubscribe(this.#pushSubscription.topic, this.#pushSubscription.cb);
|
|
5893
5941
|
this.#pushSubscription = void 0;
|
|
5894
5942
|
}
|
|
5895
|
-
|
|
5943
|
+
const inFlightEvents = [...this.#inFlightPushEvents, ...this.#inFlightDelegatedEvents];
|
|
5944
|
+
if (inFlightEvents.length > 0) await this.#awaitBounded(Promise.allSettled(inFlightEvents), remaining(), `${inFlightEvents.length} in-flight workflow event(s)`);
|
|
5896
5945
|
for (const { topic, cb } of this.#userEventSubscriptions) await this.#pubsub.unsubscribe(topic, cb);
|
|
5897
5946
|
this.#userEventSubscriptions = [];
|
|
5898
5947
|
await this.#unwireSchedulerWakeSubscription();
|
|
@@ -6161,7 +6210,7 @@ var Mastra = class Mastra {
|
|
|
6161
6210
|
#syncGatewayRegistry() {
|
|
6162
6211
|
try {
|
|
6163
6212
|
if (process.env.MASTRA_DEV !== "true" && process.env.MASTRA_DEV !== "1") return;
|
|
6164
|
-
import("./provider-registry-
|
|
6213
|
+
import("./provider-registry-CfHy4Zhw.js").then((n) => n.d).then(async ({ GatewayRegistry }) => {
|
|
6165
6214
|
const registry = GatewayRegistry.getInstance();
|
|
6166
6215
|
const customGateways = Object.values(this.#gateways || {});
|
|
6167
6216
|
registry.registerCustomGateways(customGateways);
|
package/dist/memory/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const require_stream = require("../stream-CZy8XA_q.cjs");
|
|
3
|
+
const require_execution_fence = require("../execution-fence-fqV6FGdV.cjs");
|
|
4
4
|
const require_message_list = require("../message-list-C0F2sDNC.cjs");
|
|
5
5
|
exports.AUTHORED_USER_TURN = require_message_list.AUTHORED_USER_TURN;
|
|
6
|
-
exports.DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS =
|
|
7
|
-
exports.MESSAGE_EMBEDDING_CHARS_PER_TOKEN =
|
|
8
|
-
exports.MastraMemory =
|
|
9
|
-
exports.MemoryProcessor =
|
|
10
|
-
exports.MemoryRunState =
|
|
11
|
-
exports.MockMemory =
|
|
6
|
+
exports.DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS = require_execution_fence.DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS;
|
|
7
|
+
exports.MESSAGE_EMBEDDING_CHARS_PER_TOKEN = require_execution_fence.MESSAGE_EMBEDDING_CHARS_PER_TOKEN;
|
|
8
|
+
exports.MastraMemory = require_execution_fence.MastraMemory;
|
|
9
|
+
exports.MemoryProcessor = require_execution_fence.MemoryProcessor;
|
|
10
|
+
exports.MemoryRunState = require_execution_fence.MemoryRunState;
|
|
11
|
+
exports.MockMemory = require_execution_fence.MockMemory;
|
|
12
12
|
exports.SET_WORKING_MEMORY_TOOL_NAME = require_message_list.SET_WORKING_MEMORY_TOOL_NAME;
|
|
13
13
|
exports.SYSTEM_REMINDER_END_TAG = require_message_list.SYSTEM_REMINDER_END_TAG;
|
|
14
14
|
exports.SYSTEM_REMINDER_START_TAG = require_message_list.SYSTEM_REMINDER_START_TAG;
|
|
@@ -17,37 +17,37 @@ exports.UPDATE_WORKING_MEMORY_TOOL_NAME = require_message_list.UPDATE_WORKING_ME
|
|
|
17
17
|
exports.WORKING_MEMORY_END_TAG = require_message_list.WORKING_MEMORY_END_TAG;
|
|
18
18
|
exports.WORKING_MEMORY_START_TAG = require_message_list.WORKING_MEMORY_START_TAG;
|
|
19
19
|
exports.WORKING_MEMORY_TOOL_NAMES = require_message_list.WORKING_MEMORY_TOOL_NAMES;
|
|
20
|
-
exports.advanceMemoryTokenBoundary =
|
|
20
|
+
exports.advanceMemoryTokenBoundary = require_execution_fence.advanceMemoryTokenBoundary;
|
|
21
21
|
exports.asUserTurn = require_message_list.asUserTurn;
|
|
22
|
-
exports.buildMessageEmbeddingRows =
|
|
23
|
-
exports.chunkMessageText =
|
|
22
|
+
exports.buildMessageEmbeddingRows = require_execution_fence.buildMessageEmbeddingRows;
|
|
23
|
+
exports.chunkMessageText = require_execution_fence.chunkMessageText;
|
|
24
24
|
exports.escapeTurnMarkup = require_message_list.escapeTurnMarkup;
|
|
25
|
-
exports.extractMessageEmbeddingText =
|
|
25
|
+
exports.extractMessageEmbeddingText = require_execution_fence.extractMessageEmbeddingText;
|
|
26
26
|
exports.extractWorkingMemoryContent = require_message_list.extractWorkingMemoryContent;
|
|
27
27
|
exports.extractWorkingMemoryTags = require_message_list.extractWorkingMemoryTags;
|
|
28
|
-
exports.filterSystemReminderMessages =
|
|
29
|
-
exports.getMemoryRunState =
|
|
30
|
-
exports.getMemoryTokenBoundary =
|
|
28
|
+
exports.filterSystemReminderMessages = require_execution_fence.filterSystemReminderMessages;
|
|
29
|
+
exports.getMemoryRunState = require_execution_fence.getMemoryRunState;
|
|
30
|
+
exports.getMemoryTokenBoundary = require_execution_fence.getMemoryTokenBoundary;
|
|
31
31
|
exports.getThreadOMMetadata = require_stream.getThreadOMMetadata;
|
|
32
|
-
exports.groupLinkedToolMessages =
|
|
33
|
-
exports.isAfterMemoryTokenBoundary =
|
|
32
|
+
exports.groupLinkedToolMessages = require_execution_fence.groupLinkedToolMessages;
|
|
33
|
+
exports.isAfterMemoryTokenBoundary = require_execution_fence.isAfterMemoryTokenBoundary;
|
|
34
34
|
exports.isObservationalMemoryEnabled = require_stream.isObservationalMemoryEnabled;
|
|
35
|
-
exports.isSystemReminderMessage =
|
|
35
|
+
exports.isSystemReminderMessage = require_execution_fence.isSystemReminderMessage;
|
|
36
36
|
exports.isThreadTitlePinned = require_stream.isThreadTitlePinned;
|
|
37
37
|
exports.isWorkingMemoryToolName = require_message_list.isWorkingMemoryToolName;
|
|
38
|
-
exports.loadMessageHistory =
|
|
39
|
-
exports.memoryDefaultOptions =
|
|
38
|
+
exports.loadMessageHistory = require_execution_fence.loadMessageHistory;
|
|
39
|
+
exports.memoryDefaultOptions = require_execution_fence.memoryDefaultOptions;
|
|
40
40
|
exports.messageDeclaresAuthoredTurn = require_message_list.messageDeclaresAuthoredTurn;
|
|
41
|
-
exports.messageVectorId =
|
|
42
|
-
exports.normalizeMessageHistoryConfig =
|
|
41
|
+
exports.messageVectorId = require_execution_fence.messageVectorId;
|
|
42
|
+
exports.normalizeMessageHistoryConfig = require_execution_fence.normalizeMessageHistoryConfig;
|
|
43
43
|
exports.parseMemoryRequestContext = require_stream.parseMemoryRequestContext;
|
|
44
44
|
exports.removeSystemReminderTags = require_message_list.removeSystemReminderTags;
|
|
45
45
|
exports.removeWorkingMemoryTags = require_message_list.removeWorkingMemoryTags;
|
|
46
46
|
exports.removeWorkingMemoryToolInvocationParts = require_message_list.removeWorkingMemoryToolInvocationParts;
|
|
47
47
|
exports.removeWorkingMemoryToolInvocations = require_message_list.removeWorkingMemoryToolInvocations;
|
|
48
|
-
exports.resolveMaxChunkChars =
|
|
48
|
+
exports.resolveMaxChunkChars = require_execution_fence.resolveMaxChunkChars;
|
|
49
49
|
exports.sealTurnMarkup = require_message_list.sealTurnMarkup;
|
|
50
50
|
exports.sealUserTurnMessage = require_message_list.sealUserTurnMessage;
|
|
51
51
|
exports.setThreadOMMetadata = require_stream.setThreadOMMetadata;
|
|
52
52
|
exports.stripClientAuthoredTurnMarks = require_message_list.stripClientAuthoredTurnMarks;
|
|
53
|
-
exports.upsertMessageVectors =
|
|
53
|
+
exports.upsertMessageVectors = require_execution_fence.upsertMessageVectors;
|
package/dist/memory/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Jt as getThreadOMMetadata, Qt as setThreadOMMetadata, Xt as isThreadTitlePinned, Yt as isObservationalMemoryEnabled, Zt as parseMemoryRequestContext, qt as TITLE_PINNED_THREAD_METADATA_KEY } from "../stream-BFhCDJvz.js";
|
|
2
|
+
import { Ao as MemoryProcessor, Co as buildMessageEmbeddingRows, Do as resolveMaxChunkChars, Eo as messageVectorId, Jn as getMemoryRunState, Mo as filterSystemReminderMessages, No as isSystemReminderMessage, Oo as upsertMessageVectors, So as MESSAGE_EMBEDDING_CHARS_PER_TOKEN, To as extractMessageEmbeddingText, Yn as MockMemory, as as normalizeMessageHistoryConfig, es as groupLinkedToolMessages, is as isAfterMemoryTokenBoundary, jo as memoryDefaultOptions, ko as MastraMemory, ns as advanceMemoryTokenBoundary, qn as MemoryRunState, rs as getMemoryTokenBoundary, ts as loadMessageHistory, wo as chunkMessageText, xo as DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS } from "../execution-fence-B8yV_n51.js";
|
|
3
3
|
import { $ as AUTHORED_USER_TURN, C as extractWorkingMemoryTags, D as removeWorkingMemoryToolInvocationParts, E as removeWorkingMemoryTags, O as removeWorkingMemoryToolInvocations, S as extractWorkingMemoryContent, T as removeSystemReminderTags, _ as SYSTEM_REMINDER_START_TAG, at as stripClientAuthoredTurnMarks, b as WORKING_MEMORY_START_TAG, et as asUserTurn, g as SYSTEM_REMINDER_END_TAG, h as SET_WORKING_MEMORY_TOOL_NAME, it as sealUserTurnMessage, nt as messageDeclaresAuthoredTurn, rt as sealTurnMarkup, tt as escapeTurnMarkup, v as UPDATE_WORKING_MEMORY_TOOL_NAME, w as isWorkingMemoryToolName, x as WORKING_MEMORY_TOOL_NAMES, y as WORKING_MEMORY_END_TAG } from "../message-list-RgFlLrxG.js";
|
|
4
4
|
export { AUTHORED_USER_TURN, DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS, MESSAGE_EMBEDDING_CHARS_PER_TOKEN, MastraMemory, MemoryProcessor, MemoryRunState, MockMemory, SET_WORKING_MEMORY_TOOL_NAME, SYSTEM_REMINDER_END_TAG, SYSTEM_REMINDER_START_TAG, TITLE_PINNED_THREAD_METADATA_KEY, UPDATE_WORKING_MEMORY_TOOL_NAME, WORKING_MEMORY_END_TAG, WORKING_MEMORY_START_TAG, WORKING_MEMORY_TOOL_NAMES, advanceMemoryTokenBoundary, asUserTurn, buildMessageEmbeddingRows, chunkMessageText, escapeTurnMarkup, extractMessageEmbeddingText, extractWorkingMemoryContent, extractWorkingMemoryTags, filterSystemReminderMessages, getMemoryRunState, getMemoryTokenBoundary, getThreadOMMetadata, groupLinkedToolMessages, isAfterMemoryTokenBoundary, isObservationalMemoryEnabled, isSystemReminderMessage, isThreadTitlePinned, isWorkingMemoryToolName, loadMessageHistory, memoryDefaultOptions, messageDeclaresAuthoredTurn, messageVectorId, normalizeMessageHistoryConfig, parseMemoryRequestContext, removeSystemReminderTags, removeWorkingMemoryTags, removeWorkingMemoryToolInvocationParts, removeWorkingMemoryToolInvocations, resolveMaxChunkChars, sealTurnMarkup, sealUserTurnMessage, setThreadOMMetadata, stripClientAuthoredTurnMarks, upsertMessageVectors };
|
package/dist/memory/mock.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { MastraDBMessage } from '../agent/message-list/index.js';
|
|
2
2
|
import type { AgentSignalType } from '../agent/signals.js';
|
|
3
|
-
import type { MemoryStorage, StorageListMessagesInput, StorageListThreadsInput, StorageListThreadsOutput, StorageCloneThreadInput, StorageCloneThreadOutput, StorageCopyThreadOutput } from '../storage/index.js';
|
|
4
|
-
import { InMemoryStore } from '../storage/index.js';
|
|
3
|
+
import type { MastraCompositeStore, MemoryStorage, StorageListMessagesInput, StorageListThreadsInput, StorageListThreadsOutput, StorageCloneThreadInput, StorageCloneThreadOutput, StorageCopyThreadOutput } from '../storage/index.js';
|
|
5
4
|
import type { ToolAction } from '../tools/index.js';
|
|
6
5
|
import { MastraMemory } from './memory.js';
|
|
7
6
|
import type { StorageThreadType, MemoryConfigInternal, MessageDeleteInput, WorkingMemoryTemplate, SharedMemoryConfig } from './types.js';
|
|
8
7
|
export declare class MockMemory extends MastraMemory {
|
|
9
8
|
constructor({ storage, enableWorkingMemory, workingMemoryTemplate, enableMessageHistory, options, vector, embedder, embeddingDimension, }?: {
|
|
10
|
-
storage?:
|
|
9
|
+
storage?: MastraCompositeStore;
|
|
11
10
|
vector?: SharedMemoryConfig['vector'];
|
|
12
11
|
embedder?: SharedMemoryConfig['embedder'];
|
|
13
12
|
embeddingDimension?: number;
|
|
@@ -2,8 +2,8 @@ const require_dist = require("./dist-CXeCeeW7.cjs");
|
|
|
2
2
|
const require_base = require("./base-BIzR1D3_.cjs");
|
|
3
3
|
const require_error = require("./error-D90lJ6M7.cjs");
|
|
4
4
|
const require_utils = require("./utils-D-eNsgDM.cjs");
|
|
5
|
-
const require_observability = require("./observability-
|
|
6
|
-
const require_utils$1 = require("./utils-
|
|
5
|
+
const require_observability = require("./observability-VaoaeadK.cjs");
|
|
6
|
+
const require_utils$1 = require("./utils-BjFntMW_.cjs");
|
|
7
7
|
const require_zod_utils = require("./zod-utils-Cl5jw5N_.cjs");
|
|
8
8
|
let _mastra_schema_compat = require("@mastra/schema-compat");
|
|
9
9
|
let _mastra_schema_compat_schema = require("@mastra/schema-compat/schema");
|
|
@@ -2,9 +2,9 @@ import { a as output_exports, c as streamText, i as generateText, r as generateO
|
|
|
2
2
|
import { t as MastraBase } from "./base-CKLWBhDo.js";
|
|
3
3
|
import { i as MastraError, n as ErrorDomain, t as ErrorCategory } from "./error-oh2DLsP2.js";
|
|
4
4
|
import { n as executeWithContextSync, t as executeWithContext } from "./utils-DU_pU5SK.js";
|
|
5
|
-
import {
|
|
5
|
+
import { _ as resolveObservabilityContext } from "./observability-DPDWibyH.js";
|
|
6
6
|
import { isStandardSchemaWithJSON, standardSchemaToJSONSchema, toStandardSchema } from "./schema/index.js";
|
|
7
|
-
import { i as delay, u as isZodType$1 } from "./utils-
|
|
7
|
+
import { i as delay, u as isZodType$1 } from "./utils-DN_kWhH6.js";
|
|
8
8
|
import { i as isZodArray, t as getZodDef } from "./zod-utils-BDDS_mxU.js";
|
|
9
9
|
import { AnthropicSchemaCompatLayer, DeepSeekSchemaCompatLayer, GoogleSchemaCompatLayer, MetaSchemaCompatLayer, OpenAIReasoningSchemaCompatLayer, OpenAISchemaCompatLayer, applyCompatLayer, jsonSchema } from "@mastra/schema-compat";
|
|
10
10
|
// src/stream/aisdk/v4/usage.ts
|
|
@@ -4,6 +4,7 @@ import { r as createGatewayProvider } from "./dist-CufwpBZM-DK14Qe0Z.js";
|
|
|
4
4
|
import { t as InMemoryServerCache } from "./inmemory-BK3zLwvM.js";
|
|
5
5
|
import * as z4 from "zod/v4";
|
|
6
6
|
import { safeParseAsync, z } from "zod/v4";
|
|
7
|
+
import { randomUUID } from "crypto";
|
|
7
8
|
import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
8
9
|
import { config, toJSONSchema } from "zod/v4/core";
|
|
9
10
|
import en from "zod/v4/locales/en.js";
|
|
@@ -29125,7 +29126,7 @@ function createOpenRouter(options = {}) {
|
|
|
29125
29126
|
}
|
|
29126
29127
|
createOpenRouter({ compatibility: "strict" });
|
|
29127
29128
|
// src/llm/model/gateways/constants.ts
|
|
29128
|
-
const MASTRA_USER_AGENT = `mastra/1.87.0-alpha.
|
|
29129
|
+
const MASTRA_USER_AGENT = `mastra/1.87.0-alpha.19`;
|
|
29129
29130
|
const PROVIDERS_WITH_INSTALLED_PACKAGES = [
|
|
29130
29131
|
"anthropic",
|
|
29131
29132
|
"cerebras",
|
|
@@ -53821,6 +53822,87 @@ function parseModelRouterId(routerId, gatewayPrefix) {
|
|
|
53821
53822
|
modelId
|
|
53822
53823
|
};
|
|
53823
53824
|
}
|
|
53825
|
+
// src/llm/model/gateways/opencode-session-header.ts
|
|
53826
|
+
/**
|
|
53827
|
+
* OpenCode Go rejects inference requests that don't carry an `x-opencode-session`
|
|
53828
|
+
* header with a 400 `MissingSessionID` error, so Mastra fills it in automatically.
|
|
53829
|
+
*
|
|
53830
|
+
* Only a non-empty session value counts as an explicit session: an empty value is
|
|
53831
|
+
* unusable for the provider, so it is dropped rather than sent, and it never
|
|
53832
|
+
* suppresses the thread/UUID fallback or shadows a valid session added elsewhere.
|
|
53833
|
+
* The header is only applied to the exact `opencode-go` provider id. Plain
|
|
53834
|
+
* `opencode`, similarly prefixed custom providers and unrelated providers are left
|
|
53835
|
+
* untouched, as is the caller's User-Agent.
|
|
53836
|
+
*/
|
|
53837
|
+
const OPENCODE_GO_PROVIDER_ID = "opencode-go";
|
|
53838
|
+
const SESSION_HEADER = "x-opencode-session";
|
|
53839
|
+
const THREAD_ID_HEADER = "x-thread-id";
|
|
53840
|
+
/** First non-empty value for `name`, matched case-insensitively. */
|
|
53841
|
+
function getNonEmptyHeaderValue(headers, name) {
|
|
53842
|
+
const target = name.toLowerCase();
|
|
53843
|
+
for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === target && value) return value;
|
|
53844
|
+
}
|
|
53845
|
+
/**
|
|
53846
|
+
* Drops session entries whose value is empty, returning the input itself when there
|
|
53847
|
+
* is nothing to drop. An empty session value can never be used by OpenCode Go, and
|
|
53848
|
+
* leaving one in place would shadow a valid session that is merged in later.
|
|
53849
|
+
*/
|
|
53850
|
+
function dropEmptySessionValues(headers) {
|
|
53851
|
+
const emptyKeys = Object.keys(headers).filter((key) => key.toLowerCase() === SESSION_HEADER && !headers[key]);
|
|
53852
|
+
if (emptyKeys.length === 0) return headers;
|
|
53853
|
+
const next = { ...headers };
|
|
53854
|
+
for (const key of emptyKeys) delete next[key];
|
|
53855
|
+
return next;
|
|
53856
|
+
}
|
|
53857
|
+
function applyOpencodeSessionHeader(providerId, headers) {
|
|
53858
|
+
if (providerId !== OPENCODE_GO_PROVIDER_ID) return headers;
|
|
53859
|
+
const resolved = headers ?? {};
|
|
53860
|
+
if (getNonEmptyHeaderValue(resolved, SESSION_HEADER) !== void 0) {
|
|
53861
|
+
if (!Object.keys(resolved).some((key) => key.toLowerCase() === SESSION_HEADER && !resolved[key])) return resolved;
|
|
53862
|
+
const cleaned = {};
|
|
53863
|
+
for (const [key, value] of Object.entries(resolved)) {
|
|
53864
|
+
if (key.toLowerCase() === SESSION_HEADER && !value) continue;
|
|
53865
|
+
cleaned[key] = value;
|
|
53866
|
+
}
|
|
53867
|
+
return cleaned;
|
|
53868
|
+
}
|
|
53869
|
+
const threadId = getNonEmptyHeaderValue(resolved, THREAD_ID_HEADER);
|
|
53870
|
+
const next = {};
|
|
53871
|
+
for (const [key, value] of Object.entries(resolved)) {
|
|
53872
|
+
if (key.toLowerCase() === SESSION_HEADER) continue;
|
|
53873
|
+
next[key] = value;
|
|
53874
|
+
}
|
|
53875
|
+
next[SESSION_HEADER] = threadId || randomUUID();
|
|
53876
|
+
return next;
|
|
53877
|
+
}
|
|
53878
|
+
/**
|
|
53879
|
+
* Returns the call-time headers with an `x-opencode-session` for `opencode-go`
|
|
53880
|
+
* derived from the request's own `x-thread-id` (Core memory sends that header per
|
|
53881
|
+
* call, not per model resolution).
|
|
53882
|
+
*
|
|
53883
|
+
* A non-empty session in the call headers wins as-is. Empty session values are
|
|
53884
|
+
* dropped first: they are unusable, and one would otherwise shadow the session
|
|
53885
|
+
* already resolved from the model config. After that, a non-empty model-config
|
|
53886
|
+
* session is left to apply through the provider merge, a non-empty call-time thread
|
|
53887
|
+
* id supplies the session, and otherwise the headers are returned with only the
|
|
53888
|
+
* unusable empty session values removed.
|
|
53889
|
+
*
|
|
53890
|
+
* Neither input object is mutated, and inputs for any other provider are returned
|
|
53891
|
+
* unchanged.
|
|
53892
|
+
*/
|
|
53893
|
+
function applyOpencodeCallTimeSessionHeader(providerId, modelHeaders, callHeaders) {
|
|
53894
|
+
if (providerId !== OPENCODE_GO_PROVIDER_ID) return callHeaders;
|
|
53895
|
+
if (!callHeaders) return callHeaders;
|
|
53896
|
+
if (getNonEmptyHeaderValue(callHeaders, SESSION_HEADER) !== void 0) return dropEmptySessionValues(callHeaders);
|
|
53897
|
+
const base = dropEmptySessionValues(callHeaders);
|
|
53898
|
+
if (getNonEmptyHeaderValue(modelHeaders ?? {}, SESSION_HEADER) !== void 0) return base;
|
|
53899
|
+
const threadId = getNonEmptyHeaderValue(callHeaders, THREAD_ID_HEADER);
|
|
53900
|
+
if (!threadId) return base;
|
|
53901
|
+
return {
|
|
53902
|
+
...base,
|
|
53903
|
+
[SESSION_HEADER]: threadId
|
|
53904
|
+
};
|
|
53905
|
+
}
|
|
53824
53906
|
// src/llm/model/gateways/url-template.ts
|
|
53825
53907
|
function interpolateUrlTemplate(url, envVars) {
|
|
53826
53908
|
return url.replace(/\$\{([^}]+)\}/g, (_match, envVarName) => {
|
|
@@ -54015,10 +54097,10 @@ var ModelsDevGateway = class extends MastraModelGateway {
|
|
|
54015
54097
|
}
|
|
54016
54098
|
async resolveLanguageModel({ modelId, providerId, apiKey, headers }) {
|
|
54017
54099
|
const baseURL = this.buildUrl(`${providerId}/${modelId}`);
|
|
54018
|
-
const mastraHeaders = {
|
|
54100
|
+
const mastraHeaders = applyOpencodeSessionHeader(providerId, {
|
|
54019
54101
|
"User-Agent": MASTRA_USER_AGENT,
|
|
54020
54102
|
...headers
|
|
54021
|
-
};
|
|
54103
|
+
});
|
|
54022
54104
|
const override = this.providerConfigs[providerId]?.modelOverrides?.[modelId];
|
|
54023
54105
|
if (override?.shape === "responses") return createOpenAI$1({
|
|
54024
54106
|
apiKey,
|
|
@@ -54303,4 +54385,4 @@ var NetlifyGateway = class extends MastraModelGateway {
|
|
|
54303
54385
|
}
|
|
54304
54386
|
}
|
|
54305
54387
|
};
|
|
54306
|
-
export {
|
|
54388
|
+
export { createOpenAICompatible as C, createOpenAI$1 as S, hasAuthCredentials as _, interpolateUrlTemplate as a, MASTRA_GATEWAY_STREAM_TRANSPORT as b, parseModelRouterId as c, GATEWAY_AUTH_HEADER as d, MASTRA_USER_AGENT as f, getGatewayId as g, findGatewayForModel as h, models_dev_exports as i, createOpenAI as l, createAnthropic as m, netlify_exports as n, applyOpencodeCallTimeSessionHeader as o, createOpenRouter as p, ModelsDevGateway as r, applyOpencodeSessionHeader as s, NetlifyGateway as t, createGoogleGenerativeAI as u, shouldEnableGateway as v, EventSourceParserStream$1 as w, MastraModelGateway as x, getCapabilityFileName as y };
|
|
@@ -4,6 +4,7 @@ const require_dist_CufwpBZM = require("./dist-CufwpBZM-CwERFaas.cjs");
|
|
|
4
4
|
const require_inmemory = require("./inmemory-Dc86VWGB.cjs");
|
|
5
5
|
let zod_v4 = require("zod/v4");
|
|
6
6
|
zod_v4 = require_rolldown_runtime.__toESM(zod_v4, 1);
|
|
7
|
+
let crypto$1 = require("crypto");
|
|
7
8
|
let zod_v3 = require("zod/v3");
|
|
8
9
|
let zod_v4_core = require("zod/v4/core");
|
|
9
10
|
let zod_v4_locales_en_js = require("zod/v4/locales/en.js");
|
|
@@ -29126,7 +29127,7 @@ function createOpenRouter(options = {}) {
|
|
|
29126
29127
|
}
|
|
29127
29128
|
createOpenRouter({ compatibility: "strict" });
|
|
29128
29129
|
// src/llm/model/gateways/constants.ts
|
|
29129
|
-
const MASTRA_USER_AGENT = `mastra/1.87.0-alpha.
|
|
29130
|
+
const MASTRA_USER_AGENT = `mastra/1.87.0-alpha.19`;
|
|
29130
29131
|
const PROVIDERS_WITH_INSTALLED_PACKAGES = [
|
|
29131
29132
|
"anthropic",
|
|
29132
29133
|
"cerebras",
|
|
@@ -53822,6 +53823,87 @@ function parseModelRouterId(routerId, gatewayPrefix) {
|
|
|
53822
53823
|
modelId
|
|
53823
53824
|
};
|
|
53824
53825
|
}
|
|
53826
|
+
// src/llm/model/gateways/opencode-session-header.ts
|
|
53827
|
+
/**
|
|
53828
|
+
* OpenCode Go rejects inference requests that don't carry an `x-opencode-session`
|
|
53829
|
+
* header with a 400 `MissingSessionID` error, so Mastra fills it in automatically.
|
|
53830
|
+
*
|
|
53831
|
+
* Only a non-empty session value counts as an explicit session: an empty value is
|
|
53832
|
+
* unusable for the provider, so it is dropped rather than sent, and it never
|
|
53833
|
+
* suppresses the thread/UUID fallback or shadows a valid session added elsewhere.
|
|
53834
|
+
* The header is only applied to the exact `opencode-go` provider id. Plain
|
|
53835
|
+
* `opencode`, similarly prefixed custom providers and unrelated providers are left
|
|
53836
|
+
* untouched, as is the caller's User-Agent.
|
|
53837
|
+
*/
|
|
53838
|
+
const OPENCODE_GO_PROVIDER_ID = "opencode-go";
|
|
53839
|
+
const SESSION_HEADER = "x-opencode-session";
|
|
53840
|
+
const THREAD_ID_HEADER = "x-thread-id";
|
|
53841
|
+
/** First non-empty value for `name`, matched case-insensitively. */
|
|
53842
|
+
function getNonEmptyHeaderValue(headers, name) {
|
|
53843
|
+
const target = name.toLowerCase();
|
|
53844
|
+
for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === target && value) return value;
|
|
53845
|
+
}
|
|
53846
|
+
/**
|
|
53847
|
+
* Drops session entries whose value is empty, returning the input itself when there
|
|
53848
|
+
* is nothing to drop. An empty session value can never be used by OpenCode Go, and
|
|
53849
|
+
* leaving one in place would shadow a valid session that is merged in later.
|
|
53850
|
+
*/
|
|
53851
|
+
function dropEmptySessionValues(headers) {
|
|
53852
|
+
const emptyKeys = Object.keys(headers).filter((key) => key.toLowerCase() === SESSION_HEADER && !headers[key]);
|
|
53853
|
+
if (emptyKeys.length === 0) return headers;
|
|
53854
|
+
const next = { ...headers };
|
|
53855
|
+
for (const key of emptyKeys) delete next[key];
|
|
53856
|
+
return next;
|
|
53857
|
+
}
|
|
53858
|
+
function applyOpencodeSessionHeader(providerId, headers) {
|
|
53859
|
+
if (providerId !== OPENCODE_GO_PROVIDER_ID) return headers;
|
|
53860
|
+
const resolved = headers ?? {};
|
|
53861
|
+
if (getNonEmptyHeaderValue(resolved, SESSION_HEADER) !== void 0) {
|
|
53862
|
+
if (!Object.keys(resolved).some((key) => key.toLowerCase() === SESSION_HEADER && !resolved[key])) return resolved;
|
|
53863
|
+
const cleaned = {};
|
|
53864
|
+
for (const [key, value] of Object.entries(resolved)) {
|
|
53865
|
+
if (key.toLowerCase() === SESSION_HEADER && !value) continue;
|
|
53866
|
+
cleaned[key] = value;
|
|
53867
|
+
}
|
|
53868
|
+
return cleaned;
|
|
53869
|
+
}
|
|
53870
|
+
const threadId = getNonEmptyHeaderValue(resolved, THREAD_ID_HEADER);
|
|
53871
|
+
const next = {};
|
|
53872
|
+
for (const [key, value] of Object.entries(resolved)) {
|
|
53873
|
+
if (key.toLowerCase() === SESSION_HEADER) continue;
|
|
53874
|
+
next[key] = value;
|
|
53875
|
+
}
|
|
53876
|
+
next[SESSION_HEADER] = threadId || (0, crypto$1.randomUUID)();
|
|
53877
|
+
return next;
|
|
53878
|
+
}
|
|
53879
|
+
/**
|
|
53880
|
+
* Returns the call-time headers with an `x-opencode-session` for `opencode-go`
|
|
53881
|
+
* derived from the request's own `x-thread-id` (Core memory sends that header per
|
|
53882
|
+
* call, not per model resolution).
|
|
53883
|
+
*
|
|
53884
|
+
* A non-empty session in the call headers wins as-is. Empty session values are
|
|
53885
|
+
* dropped first: they are unusable, and one would otherwise shadow the session
|
|
53886
|
+
* already resolved from the model config. After that, a non-empty model-config
|
|
53887
|
+
* session is left to apply through the provider merge, a non-empty call-time thread
|
|
53888
|
+
* id supplies the session, and otherwise the headers are returned with only the
|
|
53889
|
+
* unusable empty session values removed.
|
|
53890
|
+
*
|
|
53891
|
+
* Neither input object is mutated, and inputs for any other provider are returned
|
|
53892
|
+
* unchanged.
|
|
53893
|
+
*/
|
|
53894
|
+
function applyOpencodeCallTimeSessionHeader(providerId, modelHeaders, callHeaders) {
|
|
53895
|
+
if (providerId !== OPENCODE_GO_PROVIDER_ID) return callHeaders;
|
|
53896
|
+
if (!callHeaders) return callHeaders;
|
|
53897
|
+
if (getNonEmptyHeaderValue(callHeaders, SESSION_HEADER) !== void 0) return dropEmptySessionValues(callHeaders);
|
|
53898
|
+
const base = dropEmptySessionValues(callHeaders);
|
|
53899
|
+
if (getNonEmptyHeaderValue(modelHeaders ?? {}, SESSION_HEADER) !== void 0) return base;
|
|
53900
|
+
const threadId = getNonEmptyHeaderValue(callHeaders, THREAD_ID_HEADER);
|
|
53901
|
+
if (!threadId) return base;
|
|
53902
|
+
return {
|
|
53903
|
+
...base,
|
|
53904
|
+
[SESSION_HEADER]: threadId
|
|
53905
|
+
};
|
|
53906
|
+
}
|
|
53825
53907
|
// src/llm/model/gateways/url-template.ts
|
|
53826
53908
|
function interpolateUrlTemplate(url, envVars) {
|
|
53827
53909
|
return url.replace(/\$\{([^}]+)\}/g, (_match, envVarName) => {
|
|
@@ -54016,10 +54098,10 @@ var ModelsDevGateway = class extends MastraModelGateway {
|
|
|
54016
54098
|
}
|
|
54017
54099
|
async resolveLanguageModel({ modelId, providerId, apiKey, headers }) {
|
|
54018
54100
|
const baseURL = this.buildUrl(`${providerId}/${modelId}`);
|
|
54019
|
-
const mastraHeaders = {
|
|
54101
|
+
const mastraHeaders = applyOpencodeSessionHeader(providerId, {
|
|
54020
54102
|
"User-Agent": MASTRA_USER_AGENT,
|
|
54021
54103
|
...headers
|
|
54022
|
-
};
|
|
54104
|
+
});
|
|
54023
54105
|
const override = this.providerConfigs[providerId]?.modelOverrides?.[modelId];
|
|
54024
54106
|
if (override?.shape === "responses") return createOpenAI$1({
|
|
54025
54107
|
apiKey,
|
|
@@ -54346,6 +54428,18 @@ Object.defineProperty(exports, "NetlifyGateway", {
|
|
|
54346
54428
|
return NetlifyGateway;
|
|
54347
54429
|
}
|
|
54348
54430
|
});
|
|
54431
|
+
Object.defineProperty(exports, "applyOpencodeCallTimeSessionHeader", {
|
|
54432
|
+
enumerable: true,
|
|
54433
|
+
get: function() {
|
|
54434
|
+
return applyOpencodeCallTimeSessionHeader;
|
|
54435
|
+
}
|
|
54436
|
+
});
|
|
54437
|
+
Object.defineProperty(exports, "applyOpencodeSessionHeader", {
|
|
54438
|
+
enumerable: true,
|
|
54439
|
+
get: function() {
|
|
54440
|
+
return applyOpencodeSessionHeader;
|
|
54441
|
+
}
|
|
54442
|
+
});
|
|
54349
54443
|
Object.defineProperty(exports, "createAnthropic", {
|
|
54350
54444
|
enumerable: true,
|
|
54351
54445
|
get: function() {
|