@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
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Remote Docs Reference
|
|
2
|
+
|
|
3
|
+
How to look up current documentation from https://mastra.ai when local packages aren't available or you need conceptual guidance.
|
|
4
|
+
|
|
5
|
+
**Use this when:**
|
|
6
|
+
|
|
7
|
+
- Mastra packages aren't installed locally
|
|
8
|
+
- You need conceptual explanations or guides
|
|
9
|
+
- You want the latest documentation (may be ahead of installed version)
|
|
10
|
+
|
|
11
|
+
## Documentation site structure
|
|
12
|
+
|
|
13
|
+
Mastra docs are organized at **https://mastra.ai**:
|
|
14
|
+
|
|
15
|
+
- **Docs**: Core documentation covering concepts, features, and implementation details
|
|
16
|
+
- **Models**: Mastra provides a unified interface for working with LLMs across multiple providers
|
|
17
|
+
- **Guides**: Step-by-step tutorials for building specific applications
|
|
18
|
+
- **Reference**: API reference documentation
|
|
19
|
+
|
|
20
|
+
## Finding relevant documentation
|
|
21
|
+
|
|
22
|
+
### Method 1: Use llms.txt (Recommended)
|
|
23
|
+
|
|
24
|
+
The main llms.txt file provides an agent-friendly overview of all documentation: https://mastra.ai/llms.txt
|
|
25
|
+
|
|
26
|
+
This returns a structured markdown document with:
|
|
27
|
+
|
|
28
|
+
- Documentation organization and hierarchy
|
|
29
|
+
- All available topics and sections
|
|
30
|
+
- Direct links to relevant documentation
|
|
31
|
+
- Agent-optimized content structure
|
|
32
|
+
|
|
33
|
+
**Use this first** to understand what documentation is available and where to find specific topics.
|
|
34
|
+
|
|
35
|
+
### Method 2: Direct URL patterns
|
|
36
|
+
|
|
37
|
+
Documentation follows predictable URL patterns:
|
|
38
|
+
|
|
39
|
+
- Overview pages: `https://mastra.ai/docs/{topic}/overview`
|
|
40
|
+
- API reference: `https://mastra.ai/reference/{topic}/`
|
|
41
|
+
- Guides: `https://mastra.ai/guides/{topic}/`
|
|
42
|
+
|
|
43
|
+
**Examples:**
|
|
44
|
+
|
|
45
|
+
- `https://mastra.ai/docs/agents/overview`
|
|
46
|
+
- `https://mastra.ai/docs/workflows/overview`
|
|
47
|
+
- `https://mastra.ai/reference/workflows/workflow-methods/`
|
|
48
|
+
|
|
49
|
+
## Agent-friendly documentation
|
|
50
|
+
|
|
51
|
+
**Critical feature**: Send the `text-markdown` request header or add `.md` to any documentation URL to get clean, agent-friendly markdown.
|
|
52
|
+
|
|
53
|
+
### Standard URL:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
https://mastra.ai/reference/workflows/workflow-methods/then
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Agent-friendly URL (Markdown):
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
https://mastra.ai/reference/workflows/workflow-methods/then.md
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The `.md` version:
|
|
66
|
+
|
|
67
|
+
- Removes navigation, headers, footers
|
|
68
|
+
- Returns pure markdown content
|
|
69
|
+
- Optimized for LLM consumption
|
|
70
|
+
- Includes all code examples and explanations
|
|
71
|
+
|
|
72
|
+
## Lookup Workflow
|
|
73
|
+
|
|
74
|
+
### 1. Check the main documentation index
|
|
75
|
+
|
|
76
|
+
**Start here** to understand what's available:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
https://mastra.ai/llms.txt
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This provides:
|
|
83
|
+
|
|
84
|
+
- Complete documentation structure
|
|
85
|
+
- Available topics and sections
|
|
86
|
+
- Links to relevant documentation pages
|
|
87
|
+
|
|
88
|
+
### 2. Find relevant documentation
|
|
89
|
+
|
|
90
|
+
**Option A: Use information from llms.txt**
|
|
91
|
+
The main llms.txt will guide you to the right section.
|
|
92
|
+
|
|
93
|
+
**Option B: Construct URL directly**
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
https://mastra.ai/docs/{topic}/overview
|
|
97
|
+
https://mastra.ai/reference/{topic}/
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 3. Fetch agent-friendly version
|
|
101
|
+
|
|
102
|
+
Add `.md` to the end of any documentation URL:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
https://mastra.ai/reference/workflows/workflow-methods/then.md
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 4. Extract relevant information
|
|
109
|
+
|
|
110
|
+
The markdown will include:
|
|
111
|
+
|
|
112
|
+
- Function signatures
|
|
113
|
+
- Parameter descriptions
|
|
114
|
+
- Return types
|
|
115
|
+
- Usage examples
|
|
116
|
+
- Best practices
|
|
117
|
+
|
|
118
|
+
## Common documentation paths
|
|
119
|
+
|
|
120
|
+
### Agents
|
|
121
|
+
|
|
122
|
+
- Overview: `https://mastra.ai/docs/agents/overview`
|
|
123
|
+
- Creating agents: `https://mastra.ai/docs/agents/overview`
|
|
124
|
+
- Agent tools: `https://mastra.ai/docs/agents/tools`
|
|
125
|
+
- Memory: `https://mastra.ai/docs/memory/overview`
|
|
126
|
+
|
|
127
|
+
### Workflows
|
|
128
|
+
|
|
129
|
+
- Overview: `https://mastra.ai/docs/workflows/overview`
|
|
130
|
+
- Creating workflows: `https://mastra.ai/docs/workflows/overview`
|
|
131
|
+
- Workflow methods: `https://mastra.ai/reference/workflows/workflow-methods/`
|
|
132
|
+
|
|
133
|
+
### Tools
|
|
134
|
+
|
|
135
|
+
- Overview: `https://mastra.ai/docs/tools/overview`
|
|
136
|
+
- Creating tools: `https://mastra.ai/docs/agents/tools`
|
|
137
|
+
|
|
138
|
+
### Memory
|
|
139
|
+
|
|
140
|
+
- Overview: `https://mastra.ai/docs/memory/overview`
|
|
141
|
+
- Configuration: `https://mastra.ai/docs/memory/overview`
|
|
142
|
+
|
|
143
|
+
### RAG
|
|
144
|
+
|
|
145
|
+
- Overview: `https://mastra.ai/docs/rag/overview`
|
|
146
|
+
- Vector stores: `https://mastra.ai/reference/rag/vector-databases`
|
|
147
|
+
|
|
148
|
+
## Example: Looking up workflow .then() method
|
|
149
|
+
|
|
150
|
+
### 1. Check main documentation index
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
WebFetch({
|
|
154
|
+
url: "https://mastra.ai/llms.txt",
|
|
155
|
+
prompt: "Where can I find documentation about workflow methods like .then()?"
|
|
156
|
+
})
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
This will point you to the workflows reference section.
|
|
160
|
+
|
|
161
|
+
### 2. Fetch specific method documentation
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
https://mastra.ai/reference/workflows/workflow-methods/then.md
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 3. Use WebFetch tool
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
WebFetch({
|
|
171
|
+
url: "https://mastra.ai/reference/workflows/workflow-methods/then.md",
|
|
172
|
+
prompt: "What are the parameters for the .then() method and how do I use it?"
|
|
173
|
+
})
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## When to use remote vs embedded docs
|
|
177
|
+
|
|
178
|
+
| Situation | Use |
|
|
179
|
+
| -------------------------- | --------------------------------------------------- |
|
|
180
|
+
| Packages installed locally | **Embedded docs** (guaranteed version match) |
|
|
181
|
+
| Packages not installed | **Remote docs** |
|
|
182
|
+
| Need conceptual guides | **Remote docs** |
|
|
183
|
+
| Need exact API signatures | **Embedded docs** (if available) |
|
|
184
|
+
| Exploring new features | **Remote docs** (may be ahead of installed version) |
|
|
185
|
+
| Need working examples | **Both** (embedded for types, remote for guides) |
|
|
186
|
+
|
|
187
|
+
## Best practices
|
|
188
|
+
|
|
189
|
+
1. **Always use .md** for fetching documentation
|
|
190
|
+
2. **Check sitemap.xml** when unsure about URL structure
|
|
191
|
+
3. **Prefer embedded docs** when packages are installed (version accuracy)
|
|
192
|
+
4. **Use remote docs** for conceptual understanding and guides
|
|
193
|
+
5. **Combine both** for comprehensive understanding
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Query Traces and Spans
|
|
2
|
+
|
|
3
|
+
Use `mastra api trace query` when a normal trace list cannot express the required filters: recursive boolean predicates, related span conditions, metadata filters, ordering, or opaque cursor pagination.
|
|
4
|
+
|
|
5
|
+
## Command contract
|
|
6
|
+
|
|
7
|
+
The command sends `POST /api/observability/traces/query`. It uses the same target and credentials as other observability commands, including the EU host for EU projects (see [`mastra-api.md`](mastra-api.md#target-resolution)).
|
|
8
|
+
|
|
9
|
+
The inline JSON input is required. Before recommending the command, confirm that the installed CLI exposes it:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx mastra api trace query --help
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
After confirming availability, inspect the target server's current contract:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx mastra api trace query --schema
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use `--schema` to inspect the route's request/response shape and structural constraints. A route in the schema does not prove that the configured store supports every feature. Predicate paths are generic strings, so the schema also does not provide the context-specific field/operator matrix. Use the [canonical query reference](https://mastra.ai/reference/observability/tracing/advanced-queries) for fields, operators, optional capabilities, and limits. Do not infer valid predicates from storage columns. The target server's capabilities and validation determine what is available; a newer local CLI or Core checkout does not prove a deployed Platform server supports the same features.
|
|
22
|
+
|
|
23
|
+
Check the target's capabilities using the client SDK's `getObservabilityCapabilities()`: `traceQuery`, `spanQuery`, `traceAggregate`, and `spanAggregate` enable the four operations. These examples require a CLI exposing the relevant command and a server/store advertising its capability. Replace the example timestamps with a recent range containing the user's data. For Platform retention, follow the public [pricing page](https://mastra.ai/pricing); plan retention and API request validation limits are separate.
|
|
24
|
+
|
|
25
|
+
## Query workflow
|
|
26
|
+
|
|
27
|
+
1. Run `trace query --help` and verify that the installed CLI exposes the command.
|
|
28
|
+
1. Run `trace query --schema` against the intended target to inspect the route contract and structural constraints.
|
|
29
|
+
1. Build the smallest query that answers the question. `timeRange` is required; `from` is inclusive and `to` is exclusive.
|
|
30
|
+
1. Keep `page.limit` small while exploring and project lightweight results with `jq`.
|
|
31
|
+
1. If `data.page.next` is non-null, repeat the identical query with that value in `page.after`.
|
|
32
|
+
1. Use `trace get` or `trace span` to inspect evidence for selected trace IDs.
|
|
33
|
+
|
|
34
|
+
Query a time range:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx mastra api trace query \
|
|
38
|
+
'{"timeRange":{"from":"2026-08-01T00:00:00.000Z","to":"2026-08-08T00:00:00.000Z"},"page":{"limit":25}}' \
|
|
39
|
+
| jq '{traces: [.data.traces[] | {traceId, entityName, status, startedAt}], next: .data.page.next}'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Find traces containing a failed tool call. Conditions inside one `spans.some` clause must match the same span:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx mastra api trace query \
|
|
46
|
+
'{"timeRange":{"from":"2026-08-01T00:00:00.000Z","to":"2026-08-08T00:00:00.000Z"},"where":{"spans":{"some":{"op":"and","args":[{"op":"eq","left":{"path":"spanType"},"right":{"literal":"tool_call"}},{"op":"exists","path":"error"}]}}},"page":{"limit":25}}' \
|
|
47
|
+
| jq '{traces: .data.traces, next: .data.page.next}'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Pagination
|
|
51
|
+
|
|
52
|
+
Trace queries default to keyset pagination. Their CLI response remains nested under `data` so the pagination cursor is preserved:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"data": {
|
|
57
|
+
"traces": [],
|
|
58
|
+
"page": { "next": "opaque-cursor" }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Pass a non-null cursor back without decoding or modifying it:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx mastra api trace query \
|
|
67
|
+
'{"timeRange":{"from":"2026-08-01T00:00:00.000Z","to":"2026-08-08T00:00:00.000Z"},"page":{"limit":25,"after":"<page.next>"}}'
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
A cursor is bound to the accepted query and ordering. Do not change the time range, predicates, or ordering between pages. A mismatched cursor returns `409`; a malformed cursor returns `400`.
|
|
71
|
+
|
|
72
|
+
Trace queries also support numbered pages (`pagination`) and delta polling (`mode: "delta"`). These return `data.pagination` or `data.deltaCursor`/`data.delta.hasMore`, respectively. Do not combine pagination modes or interchange their cursors. Span queries support keyset pagination only. Follow the [pagination reference](https://mastra.ai/reference/observability/tracing/advanced-queries#pagination-and-errors) when choosing numbered pages or polling.
|
|
73
|
+
|
|
74
|
+
For errors, inspect the CLI error details. `422 TRACE_QUERY_INVALID` identifies invalid requests through issue codes and paths. `503 TRACE_QUERY_RESOURCE_LIMIT` or `504 TRACE_QUERY_EXECUTION_TIMEOUT` calls for a narrower time range or more selective filters; increasing the CLI timeout does not raise the database execution budget. See the canonical reference for operation-specific errors.
|
|
75
|
+
|
|
76
|
+
## Predicate semantics
|
|
77
|
+
|
|
78
|
+
- Compose predicates with `and`, `or`, and `not`.
|
|
79
|
+
- Use `some` when one related record must satisfy the complete nested predicate.
|
|
80
|
+
- Use `none` when no related record may satisfy the complete nested predicate. Traces with no related records also match `none`.
|
|
81
|
+
- Related span clauses correlate records by trace. Conditions in separate `spans.some` clauses can match different spans; put conditions in one clause when they must match the same span.
|
|
82
|
+
- String comparisons are exact and case-sensitive unless the canonical documentation states otherwise.
|
|
83
|
+
- The root `timeRange` filters the selected root span's start time; it does not independently constrain related-record timestamps.
|
|
84
|
+
- Query results are lightweight and do not embed matching spans. Fetch trace or span details after selecting candidates.
|
|
85
|
+
|
|
86
|
+
## Query spans
|
|
87
|
+
|
|
88
|
+
Use `mastra api span query` (`POST /api/observability/spans/query`) when the answer is a list of spans rather than traces: every failed tool call, or every run of one agent including runs nested under other agents or workflows. Trace query returns one row per trace and tests related spans through `spans.some` or `spans.none`; span query returns one row per completed span, and its `where` filters span fields directly (`spanType`, `name`, `status`, `entityName`, `durationMs`, `error`, …) with `and`/`or`/`not`. Do not wrap span predicates in `spans.some`.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx mastra api span query --help
|
|
92
|
+
npx mastra api span query --schema
|
|
93
|
+
npx mastra api span query \
|
|
94
|
+
'{"timeRange":{"from":"2026-08-07T00:00:00.000Z","to":"2026-08-08T00:00:00.000Z"},"where":{"op":"and","args":[{"op":"eq","left":{"path":"spanType"},"right":{"literal":"tool_call"}},{"op":"eq","left":{"path":"status"},"right":{"literal":"error"}}]},"page":{"limit":25}}' \
|
|
95
|
+
| jq '{spans: [.data.spans[] | {traceId, spanId, entityName, rootEntityName, errorPreview}], next: .data.page.next}'
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
For ordering, use a one-item array, such as `"orderBy":[{"field":"startedAt","direction":"desc"}]`. Paginate exactly like a keyset trace query: pass a non-null `data.page.next` unchanged as `page.after` with the same query. Span queries do not return a total count. Read the [span query reference](https://mastra.ai/reference/observability/tracing/advanced-queries#query-spans) for supported sort fields and response fields.
|
|
99
|
+
|
|
100
|
+
Check `capabilities.spanQuery` from the client SDK's `getObservabilityCapabilities()` before relying on span queries. Optional fields have separate capabilities, including `spanQueryContextFields`, `spanQueryModelFields`, and `spanQueryOutcomeFields`; consult the canonical reference for the exact fields each gates. Treat missing or false capabilities as unavailable. Missing values in a result may mean a field wasn't recorded or isn't supported, not that a run succeeded.
|
|
101
|
+
|
|
102
|
+
## Aggregate traces
|
|
103
|
+
|
|
104
|
+
Use `mastra api trace aggregate` (`POST /api/observability/traces/aggregate`) when the question asks for counts or measures rather than individual traces: error rate per agent, p95 latency per workflow, daily token usage or cost. It accepts the same `timeRange` and `where` selection as `trace query`, so the same predicate counts exactly the traces a query would list.
|
|
105
|
+
|
|
106
|
+
Confirm that the installed CLI exposes the command and that the target supports aggregation:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npx mastra api trace aggregate --help
|
|
110
|
+
npx mastra api trace aggregate --schema
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
From the client SDK, check `capabilities.traceAggregate` from `getObservabilityCapabilities()` before calling `aggregateTraces()`. A missing value means the server doesn't support aggregation; stores without it return `501 TRACE_AGGREGATE_UNSUPPORTED`.
|
|
114
|
+
|
|
115
|
+
Supply `timeRange` and `measures`; add `where`, `groupBy`, `interval`, `having`, `orderBy`, and `limit` as needed. Aggregate `orderBy` is one object, unlike the one-item array used by trace and span queries. Consult the [aggregate reference](https://mastra.ai/reference/observability/tracing/advanced-queries#aggregate-traces) for available dimensions, measures, and request limits.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npx mastra api trace aggregate \
|
|
119
|
+
'{"timeRange":{"from":"2026-08-01T00:00:00.000Z","to":"2026-08-08T00:00:00.000Z"},"where":{"op":"eq","left":{"path":"entityType"},"right":{"literal":"agent"}},"groupBy":["entityName"],"measures":["count","errorRate","duration.p95","cost.sum"],"orderBy":{"field":"errorRate","direction":"desc"},"limit":10}'
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Rows contain `dimensions` and `measures`, plus bucket and cost information when applicable. Report low `cost.coverage` as incomplete spend; don't present a `null` cost as zero. Aggregation isn't paginated: when `truncated` is `true`, narrow the selection instead of paging. Empty time buckets are omitted, not zero-filled. To see the traces behind a group, rerun `trace query` with the same selection plus the group's dimension values in `where`. For a null dimension, use the documented missing-value predicate rather than `eq` with a null literal.
|
|
123
|
+
|
|
124
|
+
## Aggregate spans
|
|
125
|
+
|
|
126
|
+
Use `mastra api span aggregate` (`POST /api/observability/spans/aggregate`) when measures should be computed per span rather than per trace. Trace aggregation rolls up each trace; span aggregation measures completed spans, including nested agent runs and tool calls. It selects the same spans as `span query` for the same `timeRange` and `where`, with one exception on ClickHouse: when a `spanType` predicate on branch span types (such as agent runs or tool calls) routes aggregation through the trace branches table, spans written before an upgrade from `@mastra/clickhouse` 1.4–1.6 are omitted, so `span query` can return more spans than the aggregate counts. Its request structure follows trace aggregation, but predicate and dimension fields follow the [span aggregation contract](https://mastra.ai/reference/observability/tracing/advanced-queries#aggregate-spans).
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npx mastra api span aggregate --help
|
|
130
|
+
npx mastra api span aggregate --schema
|
|
131
|
+
npx mastra api span aggregate \
|
|
132
|
+
'{"timeRange":{"from":"2026-08-01T00:00:00.000Z","to":"2026-08-08T00:00:00.000Z"},"where":{"op":"eq","left":{"path":"spanType"},"right":{"literal":"tool_call"}},"groupBy":["entityName"],"measures":["count","errorRate","duration.p95"],"orderBy":{"field":"errorRate","direction":"desc"},"limit":10}'
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Check `capabilities.spanAggregate` first; treat a missing or false value as unavailable. Unsupported stores return `501 SPAN_AGGREGATE_UNSUPPORTED`; a server without the route returns `404`. Like trace aggregation, results are not paginated: check `truncated` and narrow the selection when needed.
|
|
136
|
+
|
|
137
|
+
- Tokens and cost belong to the span that recorded them and are not rolled up to ancestors. Use trace aggregation for totals per trace; for span aggregation, select the spans recording usage before grouping by agent identity.
|
|
138
|
+
- Grouping or counting distinct values by `model` or `provider` requires `spanAggregateModelDimensions`. These dimensions read dedicated columns, not older attributes; older spans can group under `null`. Check the capability instead of assuming support from the CLI version.
|
|
139
|
+
|
|
140
|
+
## Choosing the command
|
|
141
|
+
|
|
142
|
+
- `trace list`: browse recent traces with simple list filters.
|
|
143
|
+
- `trace query`: select completed traces using complex, explicit predicates.
|
|
144
|
+
- `trace aggregate`: count completed traces and compute grouped measures over the same selection.
|
|
145
|
+
- `span query`: list completed spans, including nested ones, with span-field predicates.
|
|
146
|
+
- `span aggregate`: count spans and compute grouped measures by span fields.
|
|
147
|
+
- `trace get <traceId>`: inspect one selected trace.
|
|
148
|
+
- `trace span <traceId> <spanId>`: fetch one span in full.
|
|
149
|
+
|
|
150
|
+
These query and aggregate APIs return completed traces or spans only. The configured observability store must support the query API. If the server rejects a query that follows the current structural schema and canonical documentation as unsupported, report that limitation rather than falling back to an inaccurate client-side approximation.
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
4
|
+
import { join, dirname } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
function findRegistryPath() {
|
|
10
|
+
const rel = join('node_modules', '@mastra', 'core', 'dist', 'provider-registry.json');
|
|
11
|
+
// Resolve like Node does from the caller's directory first, so an app uses its own install.
|
|
12
|
+
const cwd = process.cwd();
|
|
13
|
+
for (let dir = cwd; ; dir = dirname(dir)) {
|
|
14
|
+
const candidate = join(dir, rel);
|
|
15
|
+
if (existsSync(candidate)) return candidate;
|
|
16
|
+
if (dirname(dir) === dir) break;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Fall back to walking up from the script location.
|
|
20
|
+
let dir = __dirname;
|
|
21
|
+
for (let i = 0; i < 10; i++) {
|
|
22
|
+
const p = join(dir, rel);
|
|
23
|
+
if (existsSync(p)) return p;
|
|
24
|
+
dir = dirname(dir);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Package managers with isolated linkers expose dependencies inside each workspace.
|
|
28
|
+
// The depth limit covers apps/* and packages/@scope/* layouts without walking a whole disk.
|
|
29
|
+
const maxSearchDepth = 4;
|
|
30
|
+
const matches = new Map();
|
|
31
|
+
const directoriesToSearch = [{ dir: cwd, depth: 0 }];
|
|
32
|
+
for (let index = 0; index < directoriesToSearch.length; index++) {
|
|
33
|
+
const { dir, depth } = directoriesToSearch[index];
|
|
34
|
+
const candidate = join(dir, rel);
|
|
35
|
+
if (existsSync(candidate)) {
|
|
36
|
+
const realPath = realpathSync(candidate);
|
|
37
|
+
if (!matches.has(realPath)) matches.set(realPath, candidate);
|
|
38
|
+
}
|
|
39
|
+
if (depth === maxSearchDepth) continue;
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
43
|
+
if (entry.isDirectory() && entry.name !== "node_modules" && !entry.name.startsWith(".")) {
|
|
44
|
+
directoriesToSearch.push({ dir: join(dir, entry.name), depth: depth + 1 });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} catch {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (matches.size > 1) {
|
|
53
|
+
console.error("Error: Multiple @mastra/core installations found:");
|
|
54
|
+
for (const path of matches.values()) console.error(` ${path}`);
|
|
55
|
+
console.error("Run this command from the application directory you intend to use.");
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return matches.values().next().value ?? join(cwd, rel);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function loadRegistry() {
|
|
63
|
+
const path = findRegistryPath();
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(readFileSync(path, "utf-8"));
|
|
66
|
+
} catch (e) {
|
|
67
|
+
console.error(`Error: Could not load provider registry at ${path}`);
|
|
68
|
+
console.error(e.message);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Extract version numbers from a model name for sorting.
|
|
75
|
+
* Returns an array of numeric segments, e.g. "gpt-5.4" → [5, 4].
|
|
76
|
+
* Handles dot-separated (3.5), hyphen-separated (3-7), and mixed formats.
|
|
77
|
+
* Models without detectable version numbers return null.
|
|
78
|
+
*/
|
|
79
|
+
function extractVersion(name) {
|
|
80
|
+
// Use named capture to grab version-like sequences along with their context.
|
|
81
|
+
// We capture digits separated by dots/hyphens, plus any trailing letter for filtering.
|
|
82
|
+
const regex = /(\d+(?:[.\-]\d+)*)([a-zA-Z])?/g;
|
|
83
|
+
const candidates = [];
|
|
84
|
+
let match;
|
|
85
|
+
while ((match = regex.exec(name)) !== null) {
|
|
86
|
+
const numStr = match[1];
|
|
87
|
+
const suffix = match[2] || "";
|
|
88
|
+
candidates.push({ numStr, suffix, index: match.index });
|
|
89
|
+
}
|
|
90
|
+
if (candidates.length === 0) return null;
|
|
91
|
+
|
|
92
|
+
// Process candidates: filter and clean up non-version parts
|
|
93
|
+
const processed = [];
|
|
94
|
+
for (const c of candidates) {
|
|
95
|
+
let parts = c.numStr.split(/[.\-]/).map(Number);
|
|
96
|
+
// If followed by a size suffix (b/B/k/K/m/M/t/T) — e.g. "8b", "70B", "1t" —
|
|
97
|
+
// strip the last numeric part (param count) but keep earlier parts as the version
|
|
98
|
+
if (/^[bBkKmMtT]$/.test(c.suffix)) {
|
|
99
|
+
parts = parts.slice(0, -1);
|
|
100
|
+
if (parts.length === 0) continue;
|
|
101
|
+
}
|
|
102
|
+
// Strip date-like segments (>= 2020 or YYYYMMDD-style 8-digit numbers)
|
|
103
|
+
parts = parts.filter((p) => p < 2020);
|
|
104
|
+
if (parts.length === 0) continue;
|
|
105
|
+
// Skip very large standalone numbers (parameter counts, IDs)
|
|
106
|
+
if (parts.length === 1 && parts[0] >= 100 && candidates.length > 1) continue;
|
|
107
|
+
// Skip trailing date-like patterns (MM-DD) in the latter half of the name
|
|
108
|
+
if (
|
|
109
|
+
parts.length === 2 &&
|
|
110
|
+
parts[0] >= 1 && parts[0] <= 12 &&
|
|
111
|
+
parts[1] >= 1 && parts[1] <= 31 &&
|
|
112
|
+
c.index > name.length / 2 &&
|
|
113
|
+
candidates.length > 1
|
|
114
|
+
) continue;
|
|
115
|
+
processed.push(parts);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (processed.length === 0) return null;
|
|
119
|
+
|
|
120
|
+
// Return the first valid version candidate (versions appear early in model names)
|
|
121
|
+
return processed[0];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function compareVersionsDesc(a, b) {
|
|
125
|
+
const va = extractVersion(a);
|
|
126
|
+
const vb = extractVersion(b);
|
|
127
|
+
|
|
128
|
+
// Models without versions go to the end
|
|
129
|
+
if (!va && !vb) return a.localeCompare(b);
|
|
130
|
+
if (!va) return 1;
|
|
131
|
+
if (!vb) return -1;
|
|
132
|
+
|
|
133
|
+
// Compare version tuples numerically, descending
|
|
134
|
+
const len = Math.max(va.length, vb.length);
|
|
135
|
+
for (let i = 0; i < len; i++) {
|
|
136
|
+
const ai = va[i] ?? 0;
|
|
137
|
+
const bi = vb[i] ?? 0;
|
|
138
|
+
if (bi !== ai) return bi - ai;
|
|
139
|
+
}
|
|
140
|
+
// Same version — secondary sort by full name descending
|
|
141
|
+
return b.localeCompare(a);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function printUsage() {
|
|
145
|
+
console.log(`Usage: provider-registry.mjs [options]
|
|
146
|
+
|
|
147
|
+
Options:
|
|
148
|
+
--list List all available model providers
|
|
149
|
+
--provider <name> List all models for a provider (sorted newest first)
|
|
150
|
+
--help Show this help message
|
|
151
|
+
|
|
152
|
+
Examples:
|
|
153
|
+
node provider-registry.mjs --list
|
|
154
|
+
node provider-registry.mjs --provider openai
|
|
155
|
+
node provider-registry.mjs --provider anthropic
|
|
156
|
+
node provider-registry.mjs --provider mastra
|
|
157
|
+
|
|
158
|
+
Mastra Gateway (--provider mastra) fetches the live model catalog used with v2 (msk-gateway-) keys and uses:
|
|
159
|
+
MASTRA_GATEWAY_API_KEY Gateway API key (optional for listing; may limit the list)
|
|
160
|
+
MASTRA_GATEWAY_URL Gateway base URL (default https://gateway-api.mastra.ai)`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function listProviders(registry) {
|
|
164
|
+
const entries = Object.entries(registry.providers)
|
|
165
|
+
.map(([key, val]) => ({ key, name: val.name || key }))
|
|
166
|
+
.sort((a, b) => a.key.localeCompare(b.key));
|
|
167
|
+
|
|
168
|
+
const maxKey = Math.max(...entries.map((e) => e.key.length));
|
|
169
|
+
const maxName = Math.max(...entries.map((e) => e.name.length));
|
|
170
|
+
|
|
171
|
+
console.log(`${"PROVIDER".padEnd(maxKey)} ${"NAME".padEnd(maxName)} MODELS`);
|
|
172
|
+
console.log(`${"─".repeat(maxKey)} ${"─".repeat(maxName)} ${"─".repeat(6)}`);
|
|
173
|
+
for (const entry of entries) {
|
|
174
|
+
const modelCount = registry.providers[entry.key].models.length;
|
|
175
|
+
console.log(`${entry.key.padEnd(maxKey)} ${entry.name.padEnd(maxName)} ${modelCount}`);
|
|
176
|
+
}
|
|
177
|
+
console.log(`\n${entries.length} providers`);
|
|
178
|
+
console.log(`\nMastra Gateway (mastra): run --provider mastra for its live catalog.`);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Mirrors MastraGateway in @mastra/core for v2 (msk-gateway-) keys: fetch /v1/models and keep chat models.
|
|
182
|
+
async function listGatewayModels() {
|
|
183
|
+
const raw = process.env.MASTRA_GATEWAY_URL ?? "https://gateway-api.mastra.ai";
|
|
184
|
+
// Loop instead of /\/+$/ to match core and avoid a quadratic regex on long runs of "/".
|
|
185
|
+
let end = raw.length;
|
|
186
|
+
while (end > 0 && raw[end - 1] === "/") end--;
|
|
187
|
+
const base = raw.slice(0, end).replace(/\/v1$/, "");
|
|
188
|
+
const key = process.env.MASTRA_GATEWAY_API_KEY;
|
|
189
|
+
|
|
190
|
+
let response;
|
|
191
|
+
try {
|
|
192
|
+
response = await fetch(`${base}/v1/models`, {
|
|
193
|
+
headers: key ? { Authorization: `Bearer ${key}` } : {},
|
|
194
|
+
signal: AbortSignal.timeout(10000),
|
|
195
|
+
});
|
|
196
|
+
} catch (e) {
|
|
197
|
+
console.error(`Error: Could not reach Mastra Gateway at ${base}: ${e.message}`);
|
|
198
|
+
process.exit(1);
|
|
199
|
+
}
|
|
200
|
+
if (!response.ok) {
|
|
201
|
+
const hint = response.status === 401 || response.status === 403 ? " Check MASTRA_GATEWAY_API_KEY." : "";
|
|
202
|
+
console.error(`Error: Gateway model catalog unavailable (HTTP ${response.status}).${hint}`);
|
|
203
|
+
process.exit(1);
|
|
204
|
+
}
|
|
205
|
+
let body;
|
|
206
|
+
try {
|
|
207
|
+
body = await response.json();
|
|
208
|
+
} catch {
|
|
209
|
+
body = null;
|
|
210
|
+
}
|
|
211
|
+
if (!body || !Array.isArray(body.data)) {
|
|
212
|
+
console.error("Error: Gateway model catalog has an invalid response");
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const models = body.data
|
|
217
|
+
.filter((item) => item && typeof item.id === "string" && Array.isArray(item.endpoints) && item.endpoints.includes("chat"))
|
|
218
|
+
.map((item) => item.id)
|
|
219
|
+
.sort((a, b) => a.localeCompare(b));
|
|
220
|
+
|
|
221
|
+
console.log(`Gateway — ${models.length} chat models (use as mastra/<provider>/<model>)\n`);
|
|
222
|
+
for (const model of models) console.log(` mastra/${model}`);
|
|
223
|
+
if (!key) console.error("\nNote: set MASTRA_GATEWAY_API_KEY to use these models; your key may limit the list.");
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function listModels(registry, providerName) {
|
|
227
|
+
const provider = registry.providers[providerName];
|
|
228
|
+
if (!provider) {
|
|
229
|
+
console.error(`Error: Provider "${providerName}" not found.`);
|
|
230
|
+
console.error(`Run with --list to see available providers.`);
|
|
231
|
+
process.exit(1);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const models = [...provider.models].sort(compareVersionsDesc);
|
|
235
|
+
|
|
236
|
+
console.log(`${provider.name || providerName} — ${models.length} models\n`);
|
|
237
|
+
for (const model of models) {
|
|
238
|
+
console.log(` ${model}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const args = process.argv.slice(2);
|
|
243
|
+
|
|
244
|
+
if (args.includes("--help") || args.length === 0) {
|
|
245
|
+
printUsage();
|
|
246
|
+
process.exit(0);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (args.includes("--list")) {
|
|
250
|
+
listProviders(loadRegistry());
|
|
251
|
+
process.exit(0);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const providerIdx = args.indexOf("--provider");
|
|
255
|
+
if (providerIdx !== -1) {
|
|
256
|
+
const name = args[providerIdx + 1];
|
|
257
|
+
if (!name) {
|
|
258
|
+
console.error("Error: --provider requires a provider name.");
|
|
259
|
+
process.exit(1);
|
|
260
|
+
}
|
|
261
|
+
if (name === "mastra") {
|
|
262
|
+
await listGatewayModels();
|
|
263
|
+
process.exit(0);
|
|
264
|
+
}
|
|
265
|
+
listModels(loadRegistry(), name);
|
|
266
|
+
process.exit(0);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
console.error("Error: Unknown arguments:", args.join(" "));
|
|
270
|
+
printUsage();
|
|
271
|
+
process.exit(1);
|