@mastra/core 1.87.0-alpha.10 → 1.87.0-alpha.12
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_core@0.1.4/dist/knowledge-compat/index.d.ts +49 -0
- package/dist/a2a/index.cjs +1 -1
- package/dist/a2a/index.js +1 -1
- package/dist/agent/durable/index.cjs +1 -1
- package/dist/agent/durable/index.js +1 -1
- package/dist/agent/durable/run-registry.d.ts +2 -0
- package/dist/agent/durable/types.d.ts +6 -0
- package/dist/agent/durable/utils/resolve-runtime.d.ts +5 -0
- package/dist/agent/index.cjs +3 -3
- package/dist/agent/index.js +3 -3
- package/dist/agent/message-list/index.cjs +1 -1
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/state/MessageStateManager.d.ts +5 -0
- package/dist/agent-builder/ee/index.cjs +1 -1
- package/dist/agent-builder/ee/index.js +1 -1
- package/dist/agent-controller/index.cjs +1 -1
- package/dist/agent-controller/index.js +1 -1
- package/dist/agent-controller/session.d.ts +11 -1
- package/dist/{agent-controller-BolLBwDm.cjs → agent-controller-BcN7r3yI.cjs} +40 -204
- package/dist/{agent-controller--gKWI81G.js → agent-controller-DfeTRuBc.js} +40 -204
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-CgzXjBfE.js → background-tasks-BcU--rXL.js} +1 -1
- package/dist/{background-tasks-DYtlijQ1.cjs → background-tasks-DRUHnQOk.cjs} +1 -1
- package/dist/browser/index.cjs +15 -6
- package/dist/browser/index.js +15 -6
- package/dist/browser/processor.d.ts +1 -0
- package/dist/{builder-Dz-g-9CZ.cjs → builder-Bufqrcz3.cjs} +2 -2
- package/dist/{builder-emNPaIaC.js → builder-TuIc5l7X.js} +2 -2
- package/dist/capabilities/302ai.json +201 -201
- package/dist/capabilities/abliteratedllm.json +34 -34
- package/dist/capabilities/abliteration-ai.json +11 -11
- package/dist/capabilities/above.json +22 -22
- package/dist/capabilities/adaption.json +13 -13
- package/dist/capabilities/adzuki.json +33 -33
- package/dist/capabilities/agentrouter.json +7 -7
- package/dist/capabilities/agnes.json +4 -4
- package/dist/capabilities/ai-router.json +8 -8
- package/dist/capabilities/aiand.json +22 -22
- package/dist/capabilities/aigrow.json +12 -12
- package/dist/capabilities/aimlapi.json +149 -149
- package/dist/capabilities/aixy.json +26 -26
- package/dist/capabilities/aki-io.json +12 -12
- package/dist/capabilities/alibaba-cn.json +93 -93
- package/dist/capabilities/alibaba-coding-plan-cn.json +5 -5
- package/dist/capabilities/alibaba-coding-plan.json +5 -5
- package/dist/capabilities/alibaba-token-plan-cn.json +37 -37
- package/dist/capabilities/alibaba-token-plan.json +40 -40
- package/dist/capabilities/alibaba.json +66 -66
- package/dist/capabilities/ambient.json +13 -13
- package/dist/capabilities/amd.json +11 -11
- package/dist/capabilities/anthropic.json +42 -42
- package/dist/capabilities/anyapi.json +47 -47
- package/dist/capabilities/apiko.json +5 -5
- package/dist/capabilities/arcee.json +11 -11
- package/dist/capabilities/augure.json +7 -7
- package/dist/capabilities/auriko.json +21 -21
- package/dist/capabilities/bailing.json +5 -5
- package/dist/capabilities/baseten.json +33 -33
- package/dist/capabilities/bee.json +4 -4
- package/dist/capabilities/berget.json +8 -8
- package/dist/capabilities/bothub.json +17 -17
- package/dist/capabilities/boundless.json +38 -38
- package/dist/capabilities/bumo.json +34 -34
- package/dist/capabilities/byteplus.json +24 -24
- package/dist/capabilities/cerebras.json +4 -4
- package/dist/capabilities/cheapaimodel.json +10 -10
- package/dist/capabilities/cheapest-token.json +28 -28
- package/dist/capabilities/chutes.json +7 -7
- package/dist/capabilities/cline-pass.json +35 -35
- package/dist/capabilities/cloudcode.json +7 -7
- package/dist/capabilities/cloudferro-sherlock.json +4 -4
- package/dist/capabilities/cloudflare-workers-ai.json +19 -19
- package/dist/capabilities/commandcode.json +149 -149
- package/dist/capabilities/concentrate.json +276 -268
- package/dist/capabilities/cortecs.json +104 -104
- package/dist/capabilities/crossmodel.json +179 -179
- package/dist/capabilities/crusoe.json +19 -19
- package/dist/capabilities/daoxe.json +6 -6
- package/dist/capabilities/databricks.json +124 -124
- package/dist/capabilities/deepinfra.json +89 -83
- package/dist/capabilities/deepseek.json +4 -4
- package/dist/capabilities/digitalocean.json +113 -113
- package/dist/capabilities/dothoosh.json +32 -32
- package/dist/capabilities/doubleword.json +25 -25
- package/dist/capabilities/edenai.json +286 -286
- package/dist/capabilities/empiriolabs.json +169 -169
- package/dist/capabilities/engy.json +16 -16
- package/dist/capabilities/entrim.json +8 -8
- package/dist/capabilities/evroc.json +12 -12
- package/dist/capabilities/ezkielyna.json +4 -4
- package/dist/capabilities/fastrouter.json +83 -83
- package/dist/capabilities/fireworks-ai.json +99 -99
- package/dist/capabilities/fortytwo.json +4 -4
- package/dist/capabilities/freemodel.json +22 -22
- package/dist/capabilities/friendli.json +8 -8
- package/dist/capabilities/frogbot.json +87 -87
- package/dist/capabilities/gisoo.json +17 -17
- package/dist/capabilities/gmicloud.json +21 -21
- package/dist/capabilities/google.json +58 -58
- package/dist/capabilities/graphn.json +8 -8
- package/dist/capabilities/greenpt.json +34 -34
- package/dist/capabilities/groq.json +9 -9
- package/dist/capabilities/helicone.json +87 -87
- package/dist/capabilities/hetzner.json +5 -5
- package/dist/capabilities/hostinger-router.json +10 -10
- package/dist/capabilities/hpc-ai.json +12 -12
- package/dist/capabilities/huawei-maas.json +15 -15
- package/dist/capabilities/hubris.json +32 -32
- package/dist/capabilities/huggingface.json +93 -85
- package/dist/capabilities/humain.json +2 -2
- package/dist/capabilities/hyper.json +23 -23
- package/dist/capabilities/impossibl.json +173 -173
- package/dist/capabilities/inceptron.json +8 -8
- package/dist/capabilities/inco.json +4 -4
- package/dist/capabilities/infer.json +14 -14
- package/dist/capabilities/inferall.json +9 -9
- package/dist/capabilities/inference-coop.json +9 -9
- package/dist/capabilities/inferenceapis.json +13 -13
- package/dist/capabilities/inferris.json +4 -4
- package/dist/capabilities/infersia.json +8 -8
- package/dist/capabilities/inferx.json +3 -3
- package/dist/capabilities/infomaniak.json +2 -2
- package/dist/capabilities/io-net.json +5 -5
- package/dist/capabilities/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +53 -53
- package/dist/capabilities/jad-ai.json +2 -2
- package/dist/capabilities/jalapeno.json +12 -12
- package/dist/capabilities/jiekou.json +67 -67
- package/dist/capabilities/joingonka.json +4 -4
- package/dist/capabilities/jzstoken.json +53 -53
- package/dist/capabilities/keln.json +21 -21
- package/dist/capabilities/kenari.json +132 -124
- package/dist/capabilities/kilo.json +604 -604
- 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 +6 -6
- package/dist/capabilities/klavo.json +21 -21
- package/dist/capabilities/korouter.json +30 -30
- package/dist/capabilities/kunavo.json +7 -7
- package/dist/capabilities/liquid.json +9 -9
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +944 -944
- package/dist/capabilities/llmgateway.json +340 -340
- package/dist/capabilities/llmtr.json +30 -30
- package/dist/capabilities/logits.json +2 -2
- package/dist/capabilities/longcat.json +2 -2
- package/dist/capabilities/lowrouter.json +60 -60
- package/dist/capabilities/lyceum.json +12 -12
- package/dist/capabilities/melious.json +8 -8
- package/dist/capabilities/merge-gateway.json +280 -280
- package/dist/capabilities/meta.json +7 -7
- package/dist/capabilities/mistral.json +18 -18
- package/dist/capabilities/mixlayer.json +5 -5
- package/dist/capabilities/modal.json +12 -12
- package/dist/capabilities/model-oracle-ai.json +25 -25
- package/dist/capabilities/modelis.json +21 -21
- package/dist/capabilities/modular.json +13 -13
- package/dist/capabilities/moneo.json +18 -18
- package/dist/capabilities/moonshotai-cn.json +7 -7
- package/dist/capabilities/moonshotai.json +7 -7
- package/dist/capabilities/morph.json +16 -16
- package/dist/capabilities/munito-eu.json +6 -6
- package/dist/capabilities/munito.json +10 -10
- package/dist/capabilities/nan.json +28 -28
- package/dist/capabilities/nano-gpt.json +566 -565
- package/dist/capabilities/nearai.json +96 -96
- package/dist/capabilities/nebius.json +32 -32
- package/dist/capabilities/neon.json +124 -124
- package/dist/capabilities/neuralwatt.json +36 -36
- package/dist/capabilities/nokeep.json +5 -5
- package/dist/capabilities/novita-ai.json +153 -153
- package/dist/capabilities/nvidia.json +35 -35
- package/dist/capabilities/oathbreaker.json +3 -3
- package/dist/capabilities/obscurify.json +27 -27
- package/dist/capabilities/oci.json +10 -10
- package/dist/capabilities/ofox.json +381 -381
- package/dist/capabilities/ollama-cloud.json +48 -48
- package/dist/capabilities/openai.json +59 -59
- package/dist/capabilities/opencode-go.json +91 -91
- package/dist/capabilities/openreason.json +5 -5
- package/dist/capabilities/openrouter.json +526 -527
- package/dist/capabilities/opper.json +29 -29
- package/dist/capabilities/orcarouter.json +228 -228
- package/dist/capabilities/outerlabs.json +30 -30
- package/dist/capabilities/ovhcloud.json +19 -19
- package/dist/capabilities/pareto.json +5 -5
- package/dist/capabilities/pendra.json +4 -4
- package/dist/capabilities/perplexity-agent.json +47 -47
- package/dist/capabilities/phala.json +30 -30
- package/dist/capabilities/pioneer.json +27 -27
- package/dist/capabilities/poe.json +133 -133
- package/dist/capabilities/poolside.json +2 -2
- package/dist/capabilities/powerspring.json +9 -9
- package/dist/capabilities/primalabs.json +9 -9
- package/dist/capabilities/prime.json +106 -106
- package/dist/capabilities/privatemode-ai.json +12 -12
- package/dist/capabilities/proxystacks.json +7 -7
- package/dist/capabilities/qiniu-ai.json +14 -14
- package/dist/capabilities/refuseless.json +8 -8
- package/dist/capabilities/regolo-ai.json +2 -2
- package/dist/capabilities/requesty.json +258 -199
- package/dist/capabilities/ruapi.json +21 -21
- package/dist/capabilities/runcrate.json +14 -14
- package/dist/capabilities/runinfra.json +18 -18
- package/dist/capabilities/sakana.json +6 -6
- package/dist/capabilities/sambanova.json +6 -6
- package/dist/capabilities/sandbase.json +22 -22
- package/dist/capabilities/sarvam.json +14 -14
- package/dist/capabilities/scaleway.json +16 -16
- package/dist/capabilities/scnet-token-plan.json +10 -10
- package/dist/capabilities/scx-ai.json +29 -29
- package/dist/capabilities/sensenova.json +12 -12
- package/dist/capabilities/siliconflow-cn.json +56 -56
- package/dist/capabilities/siliconflow.json +60 -60
- package/dist/capabilities/snowflake-cortex.json +20 -20
- package/dist/capabilities/sokkan.json +10 -10
- package/dist/capabilities/sparrowcodes.json +16 -16
- package/dist/capabilities/standardcompute.json +88 -88
- package/dist/capabilities/steadyrouter.json +35 -35
- package/dist/capabilities/stepfun-ai-step-plan.json +4 -4
- package/dist/capabilities/stepfun-ai.json +4 -4
- package/dist/capabilities/stepfun-step-plan.json +4 -4
- package/dist/capabilities/stepfun.json +4 -4
- package/dist/capabilities/stepping-stone.json +21 -21
- package/dist/capabilities/subconscious.json +2 -2
- package/dist/capabilities/superbot-gg.json +4 -4
- package/dist/capabilities/synthetic.json +10 -10
- package/dist/capabilities/synthorai.json +19 -19
- package/dist/capabilities/teamorouter.json +25 -25
- package/dist/capabilities/teapot-router.json +7 -7
- package/dist/capabilities/tencent-token-plan-intl.json +24 -24
- package/dist/capabilities/tencent-token-plan.json +40 -40
- package/dist/capabilities/tencent-tokenhub.json +47 -47
- package/dist/capabilities/tensorx.json +48 -48
- package/dist/capabilities/tenstorrent.json +8 -8
- package/dist/capabilities/the-grid-ai.json +28 -28
- package/dist/capabilities/thinkingmachines.json +39 -39
- package/dist/capabilities/tinfoil.json +14 -14
- package/dist/capabilities/toapis.json +2 -2
- package/dist/capabilities/togetherai.json +50 -50
- package/dist/capabilities/tokengo.json +19 -19
- package/dist/capabilities/tokenify.json +9 -9
- package/dist/capabilities/trustedrouter.json +7 -7
- package/dist/capabilities/trustedtokens.json +20 -20
- package/dist/capabilities/umans-ai-coding-plan.json +18 -18
- package/dist/capabilities/umans-ai.json +12 -12
- package/dist/capabilities/uncensuredai.json +4 -4
- package/dist/capabilities/unrestricted.json +8 -8
- package/dist/capabilities/uplinkswitch.json +22 -22
- package/dist/capabilities/upstage.json +6 -6
- package/dist/capabilities/vancine.json +15 -15
- package/dist/capabilities/vercel.json +546 -546
- package/dist/capabilities/vivgrid.json +84 -84
- package/dist/capabilities/volcengine-coding-plan.json +28 -28
- package/dist/capabilities/volcengine.json +29 -29
- package/dist/capabilities/vultr.json +31 -31
- package/dist/capabilities/wafer.ai.json +15 -15
- package/dist/capabilities/wallaby.json +2 -2
- package/dist/capabilities/wally.json +9 -9
- package/dist/capabilities/wandb.json +16 -16
- package/dist/capabilities/watt.json +22 -22
- package/dist/capabilities/xai.json +7 -7
- package/dist/capabilities/xiaomi.json +3 -3
- package/dist/capabilities/xpersona.json +11 -11
- package/dist/capabilities/xxapi.json +28 -28
- package/dist/capabilities/zai-coding-plan.json +12 -12
- package/dist/capabilities/zai.json +31 -31
- package/dist/capabilities/zenifra.json +26 -26
- package/dist/capabilities/zenmux.json +159 -159
- package/dist/capabilities/zerogpu.json +11 -11
- package/dist/capabilities/zhipuai-coding-plan.json +8 -8
- package/dist/capabilities/zhipuai.json +29 -29
- package/dist/capabilities/zro.json +7 -7
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/{channels-CndspFXP.js → channels-Cdsqdajh.js} +1 -1
- package/dist/{channels-BVnDIsZS.cjs → channels-MsOnUvU6.cjs} +1 -1
- package/dist/coding-agent/index.cjs +2 -2
- package/dist/coding-agent/index.js +2 -2
- package/dist/datasets/index.cjs +2 -2
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +609 -609
- package/dist/docs/references/reference-agent-controller-session.md +29 -1
- package/dist/docs/references/reference-memory-observational-memory.md +4 -0
- package/dist/docs/references/reference.md +1 -0
- package/dist/evals/index.cjs +1 -1
- package/dist/evals/index.js +1 -1
- package/dist/evals/scoreTraces/index.cjs +1 -1
- package/dist/evals/scoreTraces/index.js +1 -1
- package/dist/harness/index.cjs +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/importers/overlay.d.ts +138 -0
- package/dist/knowledge/importers/sink.d.ts +6 -0
- package/dist/knowledge/importers/types.d.ts +5 -0
- package/dist/knowledge/index.cjs +1412 -139
- package/dist/knowledge/index.js +1412 -139
- package/dist/knowledge/links.d.ts +27 -0
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/provider-types.generated.d.ts +7781 -7766
- package/dist/llm/reasoning/anthropic-thinking.d.ts +5 -0
- package/dist/llm/reasoning/gemini-thinking.d.ts +24 -0
- package/dist/llm/reasoning/index.cjs +389 -0
- package/dist/llm/reasoning/index.d.ts +8 -0
- package/dist/llm/reasoning/index.js +362 -0
- package/dist/llm/reasoning/model-fallback.d.ts +75 -0
- package/dist/llm/reasoning/model-ids.d.ts +5 -0
- package/dist/llm/reasoning/thinking-provider-options.d.ts +10 -0
- package/dist/llm/reasoning/thinking-request.d.ts +14 -0
- package/dist/llm/reasoning/thinking.d.ts +37 -0
- package/dist/{llm-B1semiTO.cjs → llm-CS6YY_IV.cjs} +2 -2
- package/dist/{llm-CytL7cpw.js → llm-zjtMQn7M.js} +2 -2
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/{manager-BwyfS4ha.cjs → manager-BU_lY6kl.cjs} +2 -2
- package/dist/{manager-DnTzA9GL.js → manager-Do0MENhH.js} +2 -2
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.d.ts +2 -0
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-DTkZPpch.js → mastra-C-1zIyS5.js} +22 -16
- package/dist/{mastra-Dj35Lj_J.cjs → mastra-DYVjsXTO.cjs} +22 -16
- package/dist/memory/index.cjs +3 -3
- package/dist/memory/index.js +3 -3
- package/dist/memory/om-events/index.cjs +189 -0
- package/dist/memory/om-events/index.d.ts +17 -0
- package/dist/memory/om-events/index.js +188 -0
- package/dist/{message-list-vR3uLAHL.cjs → message-list-C0F2sDNC.cjs} +3 -2
- package/dist/{message-list-BGm1DCiG.js → message-list-RgFlLrxG.js} +3 -2
- package/dist/{model-eDfetuno.cjs → model-DGFc1hw3.cjs} +1 -1
- package/dist/{model-DyQ07rPH.js → model-DIzIjDej.js} +1 -1
- package/dist/{netlify-BUvdxfHe.js → netlify-B9mLgxJs.js} +1 -1
- package/dist/{netlify-BC4v7Ufv.cjs → netlify-CyL6FNsw.cjs} +1 -1
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +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/{provider-registry-CP_5SNiw.js → provider-registry-DdQoO_jd.js} +22523 -22492
- package/dist/{provider-registry-Bn01gq9y.cjs → provider-registry-g9m_fyV8.cjs} +22523 -22492
- package/dist/provider-registry.json +22977 -22946
- package/dist/{registry-generator-CNFKGRFQ.cjs → registry-generator-At8J4ZOR.cjs} +1 -1
- package/dist/{registry-generator-CDPyxbzt.js → registry-generator-CX6Ev697.js} +1 -1
- package/dist/{rehydrate-DExpzlNS.cjs → rehydrate-BzD6UX8f.cjs} +2 -2
- package/dist/{rehydrate-CnGNY2zq.js → rehydrate-DEDxsr6E.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-BL_kKvFE.js → run-registry-D22IF5SK.js} +434 -26
- package/dist/{run-registry-CibQoN6K.cjs → run-registry-PiQTSx2Y.cjs} +457 -25
- package/dist/storage/domains/knowledge/base.d.ts +86 -1
- package/dist/storage/domains/knowledge/importers-inmemory.d.ts +9 -0
- package/dist/storage/domains/knowledge/importers.d.ts +31 -0
- package/dist/storage/domains/knowledge/inmemory.d.ts +7 -0
- package/dist/storage/domains/knowledge/pages-inmemory.d.ts +31 -1
- package/dist/storage/domains/knowledge/pages.d.ts +74 -0
- package/dist/storage/index.cjs +2 -2
- package/dist/storage/index.js +2 -2
- package/dist/storage/types.d.ts +6 -0
- package/dist/stream/base/output.d.ts +7 -0
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-D_7tMaJe.cjs → stream-BbPZavop.cjs} +36 -4
- package/dist/{stream-1DGoEkG2.js → stream-CoQTdzLm.js} +31 -5
- package/dist/test-utils/llm-mock.cjs +1 -1
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/{tool-loop-agent-CLB1r3X3.cjs → tool-loop-agent-8lyD6O4o.cjs} +4 -4
- package/dist/{tool-loop-agent-BXya_RYj.js → tool-loop-agent-DhQkNDaR.js} +4 -4
- package/dist/{utils-C55ZdVaj.js → utils-B-3lET9S.js} +1 -1
- package/dist/{utils-B-KOMA_Q.cjs → utils-DtmyBuBT.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-BDfYr72F.js → validate-CO4rWYyH.js} +1 -1
- package/dist/{validate-CmZhnsmX.cjs → validate-vucjWXcz.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-CuK2RaC0.js → worker-B6CpapAF.js} +2 -2
- package/dist/{worker-BoybIUTI.cjs → worker-BgifMkOw.cjs} +2 -2
- package/dist/{worker-BG1rw_dg.js → worker-CCpSrXBY.js} +2 -2
- package/dist/{worker-D2B-x7Le.cjs → worker-eUT7GgQ9.cjs} +2 -2
- package/dist/{workflow-Bt09PcH1.js → workflow-B4Tn58DD.js} +3 -3
- package/dist/{workflow-CTKqeRXU.cjs → workflow-BJSrGEEL.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/workspace/index.cjs +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/sandbox/local-sandbox.d.ts +11 -0
- package/dist/workspace/sandbox/sandbox.d.ts +2 -0
- package/dist/{workspace-C8Zo5_qK.cjs → workspace-C5lXteRU.cjs} +174 -12
- package/dist/{workspace-DOAil8mG.js → workspace-CnmmMou8.js} +174 -12
- package/llm/reasoning.d.ts +1 -0
- package/memory/om-events.d.ts +1 -0
- package/package.json +27 -7
- package/src/llm/model/provider-types.generated.d.ts +7781 -7766
|
@@ -3724,7 +3724,11 @@ var LocalProcessManager = class extends SandboxProcessManager {
|
|
|
3724
3724
|
...env
|
|
3725
3725
|
};
|
|
3726
3726
|
const directShell = isWindows && this.sandbox.isolation === "none" && invocation !== void 0 && /^(sh|sh\.exe)$/i.test(path.win32.basename(invocation.command)) && invocation.args[0] === "-c" && invocation.args.length >= 2;
|
|
3727
|
-
const
|
|
3727
|
+
const commandShell = this.sandbox.commandShell;
|
|
3728
|
+
const wrapped = commandShell ? {
|
|
3729
|
+
command: commandShell,
|
|
3730
|
+
args: ["-c", withRaisedOomScore(command)]
|
|
3731
|
+
} : directShell ? {
|
|
3728
3732
|
command: usesBash && /^sh(\.exe)?$/i.test(invocation.command) ? posixShell : invocation.command,
|
|
3729
3733
|
args: invocation.args
|
|
3730
3734
|
} : usesBash && invocation ? {
|
|
@@ -3754,7 +3758,7 @@ var LocalProcessManager = class extends SandboxProcessManager {
|
|
|
3754
3758
|
else execaOptions = {
|
|
3755
3759
|
...baseOptions,
|
|
3756
3760
|
detached: true,
|
|
3757
|
-
shell: this.sandbox.isolation === "none"
|
|
3761
|
+
shell: !commandShell && this.sandbox.isolation === "none"
|
|
3758
3762
|
};
|
|
3759
3763
|
const subprocess = (await getExeca())(wrapped.command, wrapped.args, execaOptions);
|
|
3760
3764
|
if (!subprocess.pid) {
|
|
@@ -4238,8 +4242,11 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
|
|
|
4238
4242
|
get workingDirectory() {
|
|
4239
4243
|
return this._workingDirectory;
|
|
4240
4244
|
}
|
|
4245
|
+
commandShell;
|
|
4246
|
+
nativePipefail;
|
|
4241
4247
|
constructor(options = {}) {
|
|
4242
4248
|
const requestedIsolation = options.isolation ?? "none";
|
|
4249
|
+
if (options.shell && (process.platform === "win32" || requestedIsolation !== "none" || !path.isAbsolute(options.shell.path))) throw new Error("LocalSandbox shell requires an absolute path and non-isolated Unix execution.");
|
|
4243
4250
|
if (requestedIsolation === "seatbelt" && process.platform === "win32") throw new IsolationUnavailableError("seatbelt", "Seatbelt isolation is only supported on macOS, not Windows.");
|
|
4244
4251
|
if (requestedIsolation !== "none" && !isIsolationAvailable(requestedIsolation)) throw new IsolationUnavailableError(requestedIsolation, detectIsolation().message);
|
|
4245
4252
|
super({
|
|
@@ -4266,6 +4273,8 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
|
|
|
4266
4273
|
this._initialReadWritePaths = new Set(this._nativeSandboxConfig.readWritePaths ?? []);
|
|
4267
4274
|
this._initialDenyWritePaths = new Set(this._nativeSandboxConfig.denyWritePaths ?? []);
|
|
4268
4275
|
this.isolation = requestedIsolation;
|
|
4276
|
+
this.commandShell = options.shell?.path;
|
|
4277
|
+
this.nativePipefail = options.shell?.nativePipefail;
|
|
4269
4278
|
this._instructionsOverride = options.instructions;
|
|
4270
4279
|
this._checkpointName = options.checkpointName;
|
|
4271
4280
|
this._seedCheckpointName = options.seedCheckpointName;
|
|
@@ -4288,6 +4297,10 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
|
|
|
4288
4297
|
env: options.env ?? this.env,
|
|
4289
4298
|
timeout: this.timeout,
|
|
4290
4299
|
isolation: this.isolation,
|
|
4300
|
+
shell: this.commandShell ? {
|
|
4301
|
+
path: this.commandShell,
|
|
4302
|
+
nativePipefail: this.nativePipefail
|
|
4303
|
+
} : void 0,
|
|
4291
4304
|
outputEncoding: this._outputEncoding,
|
|
4292
4305
|
nativeSandbox: {
|
|
4293
4306
|
...this._nativeSandboxConfig,
|
|
@@ -7270,19 +7283,167 @@ const executeCommandWithDescriptionAndBackgroundSchema = zod_v4.z.object({
|
|
|
7270
7283
|
...descriptionShape,
|
|
7271
7284
|
...executeCommandWithBackgroundSchema.shape
|
|
7272
7285
|
});
|
|
7286
|
+
const MAX_PIPEFAIL_DISPATCH_BYTES = 122880;
|
|
7273
7287
|
/** A command whose final pipeline stage is `tail`, e.g. `make test 2>&1 | tail -20`. */
|
|
7274
7288
|
const TRAILING_TAIL_PIPE = /(?:^|[^|])\|\s*tail(?:\s[^|;&]*)?$/;
|
|
7289
|
+
const OPAQUE_COMMANDS = /* @__PURE__ */ new Set([
|
|
7290
|
+
"if",
|
|
7291
|
+
"then",
|
|
7292
|
+
"elif",
|
|
7293
|
+
"else",
|
|
7294
|
+
"fi",
|
|
7295
|
+
"for",
|
|
7296
|
+
"while",
|
|
7297
|
+
"until",
|
|
7298
|
+
"do",
|
|
7299
|
+
"done",
|
|
7300
|
+
"case",
|
|
7301
|
+
"esac",
|
|
7302
|
+
"select",
|
|
7303
|
+
"function",
|
|
7304
|
+
"time",
|
|
7305
|
+
"coproc",
|
|
7306
|
+
"eval",
|
|
7307
|
+
".",
|
|
7308
|
+
"source",
|
|
7309
|
+
"alias",
|
|
7310
|
+
"unalias",
|
|
7311
|
+
"trap",
|
|
7312
|
+
"command",
|
|
7313
|
+
"builtin",
|
|
7314
|
+
"enable",
|
|
7315
|
+
"shopt",
|
|
7316
|
+
"local",
|
|
7317
|
+
"declare",
|
|
7318
|
+
"typeset",
|
|
7319
|
+
"readonly"
|
|
7320
|
+
]);
|
|
7321
|
+
/** Recognize only simple commands, list separators, and statically known redirections. */
|
|
7322
|
+
function findTailPipelineStages(src) {
|
|
7323
|
+
const redirection = /(\d*)(>>|>\||>&|<&|<>|[<>])/y;
|
|
7324
|
+
if (src.includes("__mastra_pf_")) return void 0;
|
|
7325
|
+
let stageStarts = [0];
|
|
7326
|
+
let commandName;
|
|
7327
|
+
let hasStage = false;
|
|
7328
|
+
let i = 0;
|
|
7329
|
+
while (i < src.length) {
|
|
7330
|
+
const c = src[i];
|
|
7331
|
+
if (c === " " || c === " ") {
|
|
7332
|
+
i++;
|
|
7333
|
+
continue;
|
|
7334
|
+
}
|
|
7335
|
+
if (c === "\n" && !hasStage) {
|
|
7336
|
+
i++;
|
|
7337
|
+
continue;
|
|
7338
|
+
}
|
|
7339
|
+
if (c === "|" || c === "&" || c === ";" || c === "\n") {
|
|
7340
|
+
if (!hasStage) return void 0;
|
|
7341
|
+
const next = src[i + 1];
|
|
7342
|
+
if (c === "&" && next !== "&" || c === "|" && next === "&" || c === ";" && next === ";") return;
|
|
7343
|
+
i += (c === "|" || c === "&") && next === c ? 2 : 1;
|
|
7344
|
+
if (c === "|" && next !== "|") stageStarts.push(i);
|
|
7345
|
+
else stageStarts = [i];
|
|
7346
|
+
commandName = void 0;
|
|
7347
|
+
hasStage = false;
|
|
7348
|
+
continue;
|
|
7349
|
+
}
|
|
7350
|
+
if ("#()".includes(c)) return void 0;
|
|
7351
|
+
redirection.lastIndex = i;
|
|
7352
|
+
const redirect = redirection.exec(src);
|
|
7353
|
+
if (redirect) {
|
|
7354
|
+
const [, fd, operator] = redirect;
|
|
7355
|
+
if (!/^[0-7]?$/.test(fd) || src.startsWith("<<", i + fd.length)) return void 0;
|
|
7356
|
+
i = redirection.lastIndex;
|
|
7357
|
+
while (src[i] === " " || src[i] === " ") i++;
|
|
7358
|
+
const end = scanSimpleWord(src, i);
|
|
7359
|
+
if (end === void 0 || end === i) return void 0;
|
|
7360
|
+
const target = src.slice(i, end);
|
|
7361
|
+
if (operator === ">&" || operator === "<&") {
|
|
7362
|
+
if (!/^[0-7-]$/.test(target)) return void 0;
|
|
7363
|
+
} else if (!/^[\w./-]+$/.test(target) || target.includes("/fd/")) return;
|
|
7364
|
+
i = end;
|
|
7365
|
+
hasStage = true;
|
|
7366
|
+
continue;
|
|
7367
|
+
}
|
|
7368
|
+
const end = scanSimpleWord(src, i);
|
|
7369
|
+
if (end === void 0 || end === i) return void 0;
|
|
7370
|
+
const word = src.slice(i, end);
|
|
7371
|
+
if (/^\{\w+\}$/.test(word) && (src[end] === ">" || src[end] === "<")) return void 0;
|
|
7372
|
+
if (!commandName && !/^[A-Za-z_]\w*=/.test(word)) {
|
|
7373
|
+
if (!/^(?::|[\w./-]+)$/.test(word) || OPAQUE_COMMANDS.has(word)) return void 0;
|
|
7374
|
+
commandName = word;
|
|
7375
|
+
} else if (commandName === "exec" || commandName === "set" && word !== "-e" && word !== "+e") return;
|
|
7376
|
+
hasStage = true;
|
|
7377
|
+
i = end;
|
|
7378
|
+
}
|
|
7379
|
+
if (stageStarts.length < 2 || commandName !== "tail") return void 0;
|
|
7380
|
+
return stageStarts.map((start, index) => ({
|
|
7381
|
+
start,
|
|
7382
|
+
end: index + 1 < stageStarts.length ? stageStarts[index + 1] - 1 : src.length
|
|
7383
|
+
}));
|
|
7384
|
+
}
|
|
7385
|
+
/**
|
|
7386
|
+
* Skip ordinary quotes, escapes and simple parameters, but not embedded shell programs. `$_` is not
|
|
7387
|
+
* simple: the stage wrapper runs a command first, so bash would expand it to the wrapper's argument.
|
|
7388
|
+
*/
|
|
7389
|
+
function scanSimpleWord(src, from) {
|
|
7390
|
+
const parameter = /\$(?:\{(?:[A-Za-z]\w*|_\w+|\d+|[?#!*@$-])\}|[A-Za-z]\w*|_\w+|[0-9?#!*@$-])/y;
|
|
7391
|
+
let doubleQuoted = false;
|
|
7392
|
+
for (let i = from; i < src.length; i++) {
|
|
7393
|
+
const c = src[i];
|
|
7394
|
+
if (!doubleQuoted && " \n;&|()<>".includes(c)) return i;
|
|
7395
|
+
if (c === "\"") doubleQuoted = !doubleQuoted;
|
|
7396
|
+
else if (c === "'" && !doubleQuoted) {
|
|
7397
|
+
i = src.indexOf("'", i + 1);
|
|
7398
|
+
if (i === -1) return void 0;
|
|
7399
|
+
} else if (c === "\\") {
|
|
7400
|
+
if (i + 1 === src.length || src[i + 1] === "\n") return void 0;
|
|
7401
|
+
i++;
|
|
7402
|
+
} else if (c === "`") return;
|
|
7403
|
+
else if (c === "$") {
|
|
7404
|
+
parameter.lastIndex = i;
|
|
7405
|
+
if (!parameter.test(src)) return void 0;
|
|
7406
|
+
i = parameter.lastIndex - 1;
|
|
7407
|
+
}
|
|
7408
|
+
}
|
|
7409
|
+
return doubleQuoted ? void 0 : src.length;
|
|
7410
|
+
}
|
|
7275
7411
|
/**
|
|
7276
7412
|
* POSIX shells report a pipeline's status from its last command, so `cmd | tail -N` exits 0 even
|
|
7277
|
-
* when `cmd` fails.
|
|
7278
|
-
*
|
|
7279
|
-
*
|
|
7280
|
-
*
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7413
|
+
* when `cmd` fails. For pipelines ending in `tail`, report the status of the last failing stage
|
|
7414
|
+
* instead, as `pipefail` does. `tail` reads all of its input, so upstream commands are not cut off
|
|
7415
|
+
* by SIGPIPE.
|
|
7416
|
+
*
|
|
7417
|
+
* On shells with native `pipefail`, run the original pipeline. On older dash, emulate it for
|
|
7418
|
+
* supported final pipelines by collecting upstream statuses on fd 9 and forwarding stdout on fd 8.
|
|
7419
|
+
* Only simple commands and static redirections are eligible. Compound syntax, runtime shell
|
|
7420
|
+
* interpretation, substitutions, and ambiguous or reserved file descriptors run unchanged after the
|
|
7421
|
+
* guard. Unknown launchers use an inline in-shell dispatch only when both branches fit.
|
|
7422
|
+
* Launchers known to lack pipefail need only one copy. If the generated script exceeds the
|
|
7423
|
+
* byte budget, leave the command unchanged after the native guard. Windows cmd.exe is unaffected.
|
|
7424
|
+
*/
|
|
7425
|
+
function reportUpstreamPipelineFailure(command, sandbox) {
|
|
7426
|
+
if (sandbox.provider === "local" && process.platform === "win32") return command;
|
|
7427
|
+
const trimmed = command.trimEnd();
|
|
7428
|
+
if (!TRAILING_TAIL_PIPE.test(trimmed.trim())) return command;
|
|
7429
|
+
const guard = "(set -o pipefail) 2>/dev/null && set -o pipefail; ";
|
|
7430
|
+
if (sandbox.nativePipefail === true) return "command set -o pipefail; " + command;
|
|
7431
|
+
const stages = findTailPipelineStages(trimmed);
|
|
7432
|
+
if (!stages) return guard + command;
|
|
7433
|
+
const before = trimmed.slice(0, stages[0].start);
|
|
7434
|
+
const after = command.slice(trimmed.length);
|
|
7435
|
+
const emulated = emulatePipefail(stages.map(({ start, end }) => trimmed.slice(start, end)));
|
|
7436
|
+
const separator = /^$|\s$/.test(before) ? "" : " ";
|
|
7437
|
+
const script = sandbox.nativePipefail === false ? guard + before + separator + emulated + after : "if (set -o pipefail) 2>/dev/null; then __mastra_pf_probe=0; set -o pipefail; else __mastra_pf_probe=$?; (exit \"$__mastra_pf_probe\") && :; fi; " + before + separator + "case \"$__mastra_pf_probe\" in 0) " + trimmed.slice(before.length) + " ;; *) " + emulated + " ;; esac" + after;
|
|
7438
|
+
return Buffer.byteLength(script) <= MAX_PIPEFAIL_DISPATCH_BYTES ? script : guard + command;
|
|
7439
|
+
}
|
|
7440
|
+
function emulatePipefail(stages) {
|
|
7441
|
+
const wrappedStages = stages.map((stage, index) => {
|
|
7442
|
+
const wrapped = `( command eval "$__mastra_pf_init" && :; ${stage} ) 8>&- 9>&-`;
|
|
7443
|
+
return index === stages.length - 1 ? wrapped : `{ ${wrapped}; command printf '${index + 1}:%s ' "$?" >&9; }`;
|
|
7444
|
+
});
|
|
7445
|
+
const rightToLeft = stages.slice(1).map((_, index) => stages.length - index - 1).join(" ");
|
|
7446
|
+
return `{ __mastra_pf_init="(exit \$?)"; case \$- in *e*) __mastra_pf_init="set -e; \$__mastra_pf_init";; esac; if { command exec 8>&1; } 2>/dev/null; then __mastra_pf_stdout=8; else __mastra_pf_stdout=-; fi; __mastra_pf_status=$(set +e; { ${wrappedStages.join(" | ")}; } 9>&1 >&"$__mastra_pf_stdout"); ( __mastra_pf_exit=$?; __mastra_pf_status=" $__mastra_pf_status"; for __mastra_pf_n in ${rightToLeft}; do __mastra_pf_key=" $__mastra_pf_n:"; __mastra_pf_value=\${__mastra_pf_status#*"$__mastra_pf_key"}; case $__mastra_pf_value in "$__mastra_pf_status") exit 125;; esac; __mastra_pf_code=\${__mastra_pf_value%% *}; case $__mastra_pf_code in [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) ;; *) exit 125;; esac; __mastra_pf_status=\${__mastra_pf_status%%"$__mastra_pf_key"*}\${__mastra_pf_value#"$__mastra_pf_code"}; [ "$__mastra_pf_exit" -ne 0 ] || __mastra_pf_exit=$__mastra_pf_code; done; [ "$__mastra_pf_status" = ' ' ] || exit 125; exit "$__mastra_pf_exit" ); } 8>&-`;
|
|
7286
7447
|
}
|
|
7287
7448
|
const ABORTED_COMMAND_NOTE = "Command aborted: the run was cancelled (by the user or system) while this command was running, so it was killed before it finished.";
|
|
7288
7449
|
const CANCELLED_RUN_NOTE = "The run was cancelled (by the user or system) while this command was running.";
|
|
@@ -7445,7 +7606,8 @@ async function executeCommand(input, context) {
|
|
|
7445
7606
|
const stderr = new RetainedOutputBuffer(DEFAULT_MAX_RETAINED_PROCESS_OUTPUT_BYTES);
|
|
7446
7607
|
let abortedWhenSettled = false;
|
|
7447
7608
|
try {
|
|
7448
|
-
const
|
|
7609
|
+
const script = reportUpstreamPipelineFailure(command, sandbox);
|
|
7610
|
+
const result = await sandbox.executeCommand(script, [], {
|
|
7449
7611
|
timeout: timeout ?? void 0,
|
|
7450
7612
|
cwd: effectiveCwd,
|
|
7451
7613
|
abortSignal: context?.abortSignal,
|
|
@@ -3719,7 +3719,11 @@ var LocalProcessManager = class extends SandboxProcessManager {
|
|
|
3719
3719
|
...env
|
|
3720
3720
|
};
|
|
3721
3721
|
const directShell = isWindows && this.sandbox.isolation === "none" && invocation !== void 0 && /^(sh|sh\.exe)$/i.test(nodePath.win32.basename(invocation.command)) && invocation.args[0] === "-c" && invocation.args.length >= 2;
|
|
3722
|
-
const
|
|
3722
|
+
const commandShell = this.sandbox.commandShell;
|
|
3723
|
+
const wrapped = commandShell ? {
|
|
3724
|
+
command: commandShell,
|
|
3725
|
+
args: ["-c", withRaisedOomScore(command)]
|
|
3726
|
+
} : directShell ? {
|
|
3723
3727
|
command: usesBash && /^sh(\.exe)?$/i.test(invocation.command) ? posixShell : invocation.command,
|
|
3724
3728
|
args: invocation.args
|
|
3725
3729
|
} : usesBash && invocation ? {
|
|
@@ -3749,7 +3753,7 @@ var LocalProcessManager = class extends SandboxProcessManager {
|
|
|
3749
3753
|
else execaOptions = {
|
|
3750
3754
|
...baseOptions,
|
|
3751
3755
|
detached: true,
|
|
3752
|
-
shell: this.sandbox.isolation === "none"
|
|
3756
|
+
shell: !commandShell && this.sandbox.isolation === "none"
|
|
3753
3757
|
};
|
|
3754
3758
|
const subprocess = (await getExeca())(wrapped.command, wrapped.args, execaOptions);
|
|
3755
3759
|
if (!subprocess.pid) {
|
|
@@ -4233,8 +4237,11 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
|
|
|
4233
4237
|
get workingDirectory() {
|
|
4234
4238
|
return this._workingDirectory;
|
|
4235
4239
|
}
|
|
4240
|
+
commandShell;
|
|
4241
|
+
nativePipefail;
|
|
4236
4242
|
constructor(options = {}) {
|
|
4237
4243
|
const requestedIsolation = options.isolation ?? "none";
|
|
4244
|
+
if (options.shell && (process.platform === "win32" || requestedIsolation !== "none" || !nodePath.isAbsolute(options.shell.path))) throw new Error("LocalSandbox shell requires an absolute path and non-isolated Unix execution.");
|
|
4238
4245
|
if (requestedIsolation === "seatbelt" && process.platform === "win32") throw new IsolationUnavailableError("seatbelt", "Seatbelt isolation is only supported on macOS, not Windows.");
|
|
4239
4246
|
if (requestedIsolation !== "none" && !isIsolationAvailable(requestedIsolation)) throw new IsolationUnavailableError(requestedIsolation, detectIsolation().message);
|
|
4240
4247
|
super({
|
|
@@ -4261,6 +4268,8 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
|
|
|
4261
4268
|
this._initialReadWritePaths = new Set(this._nativeSandboxConfig.readWritePaths ?? []);
|
|
4262
4269
|
this._initialDenyWritePaths = new Set(this._nativeSandboxConfig.denyWritePaths ?? []);
|
|
4263
4270
|
this.isolation = requestedIsolation;
|
|
4271
|
+
this.commandShell = options.shell?.path;
|
|
4272
|
+
this.nativePipefail = options.shell?.nativePipefail;
|
|
4264
4273
|
this._instructionsOverride = options.instructions;
|
|
4265
4274
|
this._checkpointName = options.checkpointName;
|
|
4266
4275
|
this._seedCheckpointName = options.seedCheckpointName;
|
|
@@ -4283,6 +4292,10 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
|
|
|
4283
4292
|
env: options.env ?? this.env,
|
|
4284
4293
|
timeout: this.timeout,
|
|
4285
4294
|
isolation: this.isolation,
|
|
4295
|
+
shell: this.commandShell ? {
|
|
4296
|
+
path: this.commandShell,
|
|
4297
|
+
nativePipefail: this.nativePipefail
|
|
4298
|
+
} : void 0,
|
|
4286
4299
|
outputEncoding: this._outputEncoding,
|
|
4287
4300
|
nativeSandbox: {
|
|
4288
4301
|
...this._nativeSandboxConfig,
|
|
@@ -7265,19 +7278,167 @@ const executeCommandWithDescriptionAndBackgroundSchema = z.object({
|
|
|
7265
7278
|
...descriptionShape,
|
|
7266
7279
|
...executeCommandWithBackgroundSchema.shape
|
|
7267
7280
|
});
|
|
7281
|
+
const MAX_PIPEFAIL_DISPATCH_BYTES = 122880;
|
|
7268
7282
|
/** A command whose final pipeline stage is `tail`, e.g. `make test 2>&1 | tail -20`. */
|
|
7269
7283
|
const TRAILING_TAIL_PIPE = /(?:^|[^|])\|\s*tail(?:\s[^|;&]*)?$/;
|
|
7284
|
+
const OPAQUE_COMMANDS = /* @__PURE__ */ new Set([
|
|
7285
|
+
"if",
|
|
7286
|
+
"then",
|
|
7287
|
+
"elif",
|
|
7288
|
+
"else",
|
|
7289
|
+
"fi",
|
|
7290
|
+
"for",
|
|
7291
|
+
"while",
|
|
7292
|
+
"until",
|
|
7293
|
+
"do",
|
|
7294
|
+
"done",
|
|
7295
|
+
"case",
|
|
7296
|
+
"esac",
|
|
7297
|
+
"select",
|
|
7298
|
+
"function",
|
|
7299
|
+
"time",
|
|
7300
|
+
"coproc",
|
|
7301
|
+
"eval",
|
|
7302
|
+
".",
|
|
7303
|
+
"source",
|
|
7304
|
+
"alias",
|
|
7305
|
+
"unalias",
|
|
7306
|
+
"trap",
|
|
7307
|
+
"command",
|
|
7308
|
+
"builtin",
|
|
7309
|
+
"enable",
|
|
7310
|
+
"shopt",
|
|
7311
|
+
"local",
|
|
7312
|
+
"declare",
|
|
7313
|
+
"typeset",
|
|
7314
|
+
"readonly"
|
|
7315
|
+
]);
|
|
7316
|
+
/** Recognize only simple commands, list separators, and statically known redirections. */
|
|
7317
|
+
function findTailPipelineStages(src) {
|
|
7318
|
+
const redirection = /(\d*)(>>|>\||>&|<&|<>|[<>])/y;
|
|
7319
|
+
if (src.includes("__mastra_pf_")) return void 0;
|
|
7320
|
+
let stageStarts = [0];
|
|
7321
|
+
let commandName;
|
|
7322
|
+
let hasStage = false;
|
|
7323
|
+
let i = 0;
|
|
7324
|
+
while (i < src.length) {
|
|
7325
|
+
const c = src[i];
|
|
7326
|
+
if (c === " " || c === " ") {
|
|
7327
|
+
i++;
|
|
7328
|
+
continue;
|
|
7329
|
+
}
|
|
7330
|
+
if (c === "\n" && !hasStage) {
|
|
7331
|
+
i++;
|
|
7332
|
+
continue;
|
|
7333
|
+
}
|
|
7334
|
+
if (c === "|" || c === "&" || c === ";" || c === "\n") {
|
|
7335
|
+
if (!hasStage) return void 0;
|
|
7336
|
+
const next = src[i + 1];
|
|
7337
|
+
if (c === "&" && next !== "&" || c === "|" && next === "&" || c === ";" && next === ";") return;
|
|
7338
|
+
i += (c === "|" || c === "&") && next === c ? 2 : 1;
|
|
7339
|
+
if (c === "|" && next !== "|") stageStarts.push(i);
|
|
7340
|
+
else stageStarts = [i];
|
|
7341
|
+
commandName = void 0;
|
|
7342
|
+
hasStage = false;
|
|
7343
|
+
continue;
|
|
7344
|
+
}
|
|
7345
|
+
if ("#()".includes(c)) return void 0;
|
|
7346
|
+
redirection.lastIndex = i;
|
|
7347
|
+
const redirect = redirection.exec(src);
|
|
7348
|
+
if (redirect) {
|
|
7349
|
+
const [, fd, operator] = redirect;
|
|
7350
|
+
if (!/^[0-7]?$/.test(fd) || src.startsWith("<<", i + fd.length)) return void 0;
|
|
7351
|
+
i = redirection.lastIndex;
|
|
7352
|
+
while (src[i] === " " || src[i] === " ") i++;
|
|
7353
|
+
const end = scanSimpleWord(src, i);
|
|
7354
|
+
if (end === void 0 || end === i) return void 0;
|
|
7355
|
+
const target = src.slice(i, end);
|
|
7356
|
+
if (operator === ">&" || operator === "<&") {
|
|
7357
|
+
if (!/^[0-7-]$/.test(target)) return void 0;
|
|
7358
|
+
} else if (!/^[\w./-]+$/.test(target) || target.includes("/fd/")) return;
|
|
7359
|
+
i = end;
|
|
7360
|
+
hasStage = true;
|
|
7361
|
+
continue;
|
|
7362
|
+
}
|
|
7363
|
+
const end = scanSimpleWord(src, i);
|
|
7364
|
+
if (end === void 0 || end === i) return void 0;
|
|
7365
|
+
const word = src.slice(i, end);
|
|
7366
|
+
if (/^\{\w+\}$/.test(word) && (src[end] === ">" || src[end] === "<")) return void 0;
|
|
7367
|
+
if (!commandName && !/^[A-Za-z_]\w*=/.test(word)) {
|
|
7368
|
+
if (!/^(?::|[\w./-]+)$/.test(word) || OPAQUE_COMMANDS.has(word)) return void 0;
|
|
7369
|
+
commandName = word;
|
|
7370
|
+
} else if (commandName === "exec" || commandName === "set" && word !== "-e" && word !== "+e") return;
|
|
7371
|
+
hasStage = true;
|
|
7372
|
+
i = end;
|
|
7373
|
+
}
|
|
7374
|
+
if (stageStarts.length < 2 || commandName !== "tail") return void 0;
|
|
7375
|
+
return stageStarts.map((start, index) => ({
|
|
7376
|
+
start,
|
|
7377
|
+
end: index + 1 < stageStarts.length ? stageStarts[index + 1] - 1 : src.length
|
|
7378
|
+
}));
|
|
7379
|
+
}
|
|
7380
|
+
/**
|
|
7381
|
+
* Skip ordinary quotes, escapes and simple parameters, but not embedded shell programs. `$_` is not
|
|
7382
|
+
* simple: the stage wrapper runs a command first, so bash would expand it to the wrapper's argument.
|
|
7383
|
+
*/
|
|
7384
|
+
function scanSimpleWord(src, from) {
|
|
7385
|
+
const parameter = /\$(?:\{(?:[A-Za-z]\w*|_\w+|\d+|[?#!*@$-])\}|[A-Za-z]\w*|_\w+|[0-9?#!*@$-])/y;
|
|
7386
|
+
let doubleQuoted = false;
|
|
7387
|
+
for (let i = from; i < src.length; i++) {
|
|
7388
|
+
const c = src[i];
|
|
7389
|
+
if (!doubleQuoted && " \n;&|()<>".includes(c)) return i;
|
|
7390
|
+
if (c === "\"") doubleQuoted = !doubleQuoted;
|
|
7391
|
+
else if (c === "'" && !doubleQuoted) {
|
|
7392
|
+
i = src.indexOf("'", i + 1);
|
|
7393
|
+
if (i === -1) return void 0;
|
|
7394
|
+
} else if (c === "\\") {
|
|
7395
|
+
if (i + 1 === src.length || src[i + 1] === "\n") return void 0;
|
|
7396
|
+
i++;
|
|
7397
|
+
} else if (c === "`") return;
|
|
7398
|
+
else if (c === "$") {
|
|
7399
|
+
parameter.lastIndex = i;
|
|
7400
|
+
if (!parameter.test(src)) return void 0;
|
|
7401
|
+
i = parameter.lastIndex - 1;
|
|
7402
|
+
}
|
|
7403
|
+
}
|
|
7404
|
+
return doubleQuoted ? void 0 : src.length;
|
|
7405
|
+
}
|
|
7270
7406
|
/**
|
|
7271
7407
|
* POSIX shells report a pipeline's status from its last command, so `cmd | tail -N` exits 0 even
|
|
7272
|
-
* when `cmd` fails.
|
|
7273
|
-
*
|
|
7274
|
-
*
|
|
7275
|
-
*
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7408
|
+
* when `cmd` fails. For pipelines ending in `tail`, report the status of the last failing stage
|
|
7409
|
+
* instead, as `pipefail` does. `tail` reads all of its input, so upstream commands are not cut off
|
|
7410
|
+
* by SIGPIPE.
|
|
7411
|
+
*
|
|
7412
|
+
* On shells with native `pipefail`, run the original pipeline. On older dash, emulate it for
|
|
7413
|
+
* supported final pipelines by collecting upstream statuses on fd 9 and forwarding stdout on fd 8.
|
|
7414
|
+
* Only simple commands and static redirections are eligible. Compound syntax, runtime shell
|
|
7415
|
+
* interpretation, substitutions, and ambiguous or reserved file descriptors run unchanged after the
|
|
7416
|
+
* guard. Unknown launchers use an inline in-shell dispatch only when both branches fit.
|
|
7417
|
+
* Launchers known to lack pipefail need only one copy. If the generated script exceeds the
|
|
7418
|
+
* byte budget, leave the command unchanged after the native guard. Windows cmd.exe is unaffected.
|
|
7419
|
+
*/
|
|
7420
|
+
function reportUpstreamPipelineFailure(command, sandbox) {
|
|
7421
|
+
if (sandbox.provider === "local" && process.platform === "win32") return command;
|
|
7422
|
+
const trimmed = command.trimEnd();
|
|
7423
|
+
if (!TRAILING_TAIL_PIPE.test(trimmed.trim())) return command;
|
|
7424
|
+
const guard = "(set -o pipefail) 2>/dev/null && set -o pipefail; ";
|
|
7425
|
+
if (sandbox.nativePipefail === true) return "command set -o pipefail; " + command;
|
|
7426
|
+
const stages = findTailPipelineStages(trimmed);
|
|
7427
|
+
if (!stages) return guard + command;
|
|
7428
|
+
const before = trimmed.slice(0, stages[0].start);
|
|
7429
|
+
const after = command.slice(trimmed.length);
|
|
7430
|
+
const emulated = emulatePipefail(stages.map(({ start, end }) => trimmed.slice(start, end)));
|
|
7431
|
+
const separator = /^$|\s$/.test(before) ? "" : " ";
|
|
7432
|
+
const script = sandbox.nativePipefail === false ? guard + before + separator + emulated + after : "if (set -o pipefail) 2>/dev/null; then __mastra_pf_probe=0; set -o pipefail; else __mastra_pf_probe=$?; (exit \"$__mastra_pf_probe\") && :; fi; " + before + separator + "case \"$__mastra_pf_probe\" in 0) " + trimmed.slice(before.length) + " ;; *) " + emulated + " ;; esac" + after;
|
|
7433
|
+
return Buffer.byteLength(script) <= MAX_PIPEFAIL_DISPATCH_BYTES ? script : guard + command;
|
|
7434
|
+
}
|
|
7435
|
+
function emulatePipefail(stages) {
|
|
7436
|
+
const wrappedStages = stages.map((stage, index) => {
|
|
7437
|
+
const wrapped = `( command eval "$__mastra_pf_init" && :; ${stage} ) 8>&- 9>&-`;
|
|
7438
|
+
return index === stages.length - 1 ? wrapped : `{ ${wrapped}; command printf '${index + 1}:%s ' "$?" >&9; }`;
|
|
7439
|
+
});
|
|
7440
|
+
const rightToLeft = stages.slice(1).map((_, index) => stages.length - index - 1).join(" ");
|
|
7441
|
+
return `{ __mastra_pf_init="(exit \$?)"; case \$- in *e*) __mastra_pf_init="set -e; \$__mastra_pf_init";; esac; if { command exec 8>&1; } 2>/dev/null; then __mastra_pf_stdout=8; else __mastra_pf_stdout=-; fi; __mastra_pf_status=$(set +e; { ${wrappedStages.join(" | ")}; } 9>&1 >&"$__mastra_pf_stdout"); ( __mastra_pf_exit=$?; __mastra_pf_status=" $__mastra_pf_status"; for __mastra_pf_n in ${rightToLeft}; do __mastra_pf_key=" $__mastra_pf_n:"; __mastra_pf_value=\${__mastra_pf_status#*"$__mastra_pf_key"}; case $__mastra_pf_value in "$__mastra_pf_status") exit 125;; esac; __mastra_pf_code=\${__mastra_pf_value%% *}; case $__mastra_pf_code in [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) ;; *) exit 125;; esac; __mastra_pf_status=\${__mastra_pf_status%%"$__mastra_pf_key"*}\${__mastra_pf_value#"$__mastra_pf_code"}; [ "$__mastra_pf_exit" -ne 0 ] || __mastra_pf_exit=$__mastra_pf_code; done; [ "$__mastra_pf_status" = ' ' ] || exit 125; exit "$__mastra_pf_exit" ); } 8>&-`;
|
|
7281
7442
|
}
|
|
7282
7443
|
const ABORTED_COMMAND_NOTE = "Command aborted: the run was cancelled (by the user or system) while this command was running, so it was killed before it finished.";
|
|
7283
7444
|
const CANCELLED_RUN_NOTE = "The run was cancelled (by the user or system) while this command was running.";
|
|
@@ -7440,7 +7601,8 @@ async function executeCommand(input, context) {
|
|
|
7440
7601
|
const stderr = new RetainedOutputBuffer(DEFAULT_MAX_RETAINED_PROCESS_OUTPUT_BYTES);
|
|
7441
7602
|
let abortedWhenSettled = false;
|
|
7442
7603
|
try {
|
|
7443
|
-
const
|
|
7604
|
+
const script = reportUpstreamPipelineFailure(command, sandbox);
|
|
7605
|
+
const result = await sandbox.executeCommand(script, [], {
|
|
7444
7606
|
timeout: timeout ?? void 0,
|
|
7445
7607
|
cwd: effectiveCwd,
|
|
7446
7608
|
abortSignal: context?.abortSignal,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../dist/llm/reasoning';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../dist/memory/om-events';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/core",
|
|
3
|
-
"version": "1.87.0-alpha.
|
|
3
|
+
"version": "1.87.0-alpha.12",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -331,6 +331,26 @@
|
|
|
331
331
|
"default": "./dist/llm/index.cjs"
|
|
332
332
|
}
|
|
333
333
|
},
|
|
334
|
+
"./llm/reasoning": {
|
|
335
|
+
"import": {
|
|
336
|
+
"types": "./dist/llm/reasoning/index.d.ts",
|
|
337
|
+
"default": "./dist/llm/reasoning/index.js"
|
|
338
|
+
},
|
|
339
|
+
"require": {
|
|
340
|
+
"types": "./dist/llm/reasoning/index.d.ts",
|
|
341
|
+
"default": "./dist/llm/reasoning/index.cjs"
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
"./memory/om-events": {
|
|
345
|
+
"import": {
|
|
346
|
+
"types": "./dist/memory/om-events/index.d.ts",
|
|
347
|
+
"default": "./dist/memory/om-events/index.js"
|
|
348
|
+
},
|
|
349
|
+
"require": {
|
|
350
|
+
"types": "./dist/memory/om-events/index.d.ts",
|
|
351
|
+
"default": "./dist/memory/om-events/index.cjs"
|
|
352
|
+
}
|
|
353
|
+
},
|
|
334
354
|
"./knowledge": {
|
|
335
355
|
"import": {
|
|
336
356
|
"types": "./dist/knowledge/index.d.ts",
|
|
@@ -966,19 +986,19 @@
|
|
|
966
986
|
"vscode-languageserver-protocol": "^3.18.5",
|
|
967
987
|
"zod": "^4.6.7",
|
|
968
988
|
"zod-v3": "npm:zod@3.25.76",
|
|
989
|
+
"@internal/ai-sdk-v5": "0.0.99",
|
|
969
990
|
"@internal/ai-sdk-v4": "0.0.99",
|
|
970
|
-
"@internal/auth": "0.0.40",
|
|
971
991
|
"@internal/ai-v6": "0.0.99",
|
|
972
|
-
"@internal/
|
|
973
|
-
"@internal/
|
|
974
|
-
"@internal/llm-recorder": "0.0.88",
|
|
992
|
+
"@internal/ai-v7": "0.0.99",
|
|
993
|
+
"@internal/auth": "0.0.40",
|
|
975
994
|
"@internal/external-types": "0.0.102",
|
|
976
995
|
"@internal/lint": "0.0.152",
|
|
996
|
+
"@internal/llm-recorder": "0.0.88",
|
|
977
997
|
"@internal/deployer": "0.0.5",
|
|
998
|
+
"@internal/types-builder": "0.0.127",
|
|
978
999
|
"@internal/test-utils": "0.0.88",
|
|
979
1000
|
"@internal/voice": "0.0.48",
|
|
980
|
-
"@internal/
|
|
981
|
-
"@internal/types-builder": "0.0.127"
|
|
1001
|
+
"@internal/core": "0.1.4"
|
|
982
1002
|
},
|
|
983
1003
|
"engines": {
|
|
984
1004
|
"node": ">=22.13.0"
|