@mastra/core 1.86.0-alpha.7 → 1.86.0-alpha.9
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 +363 -0
- package/dist/a2a/index.cjs +1 -1
- package/dist/a2a/index.js +1 -1
- package/dist/agent/agent.d.ts +72 -1
- package/dist/agent/agent.types.d.ts +30 -2
- package/dist/agent/durable/create-evented-agent.d.ts +6 -0
- package/dist/agent/durable/durable-agent.d.ts +1 -15
- package/dist/agent/durable/index.cjs +7 -26
- package/dist/agent/durable/index.js +7 -26
- package/dist/agent/durable/preparation.d.ts +2 -0
- package/dist/agent/durable/utils/resolve-runtime.d.ts +9 -0
- package/dist/agent/durable/workflows/durable-loop-builder.d.ts +4 -0
- package/dist/agent/durable/workflows/finalize-run.d.ts +3 -1
- package/dist/agent/durable/workflows/steps/llm-execution.d.ts +1 -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/message-list.d.ts +11 -0
- package/dist/agent/message-list/utils/provider-compat.d.ts +1 -0
- package/dist/agent/request-context-snapshot.d.ts +1 -1
- package/dist/agent/streams/types.d.ts +10 -0
- package/dist/agent/thread-stream-runtime.d.ts +5 -0
- package/dist/agent/types.d.ts +25 -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-K5vHtqfO.cjs → agent-controller-CrQ9OF80.cjs} +8 -8
- package/dist/{agent-controller-Cf3_IuY8.js → agent-controller-SSlKzE6A.js} +8 -8
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-DqnQMfuf.cjs → background-tasks-BDrYBis-.cjs} +5 -3
- package/dist/{background-tasks-BgpX1P_s.js → background-tasks-BnJfNLFo.js} +5 -3
- package/dist/browser/index.cjs +2 -2
- package/dist/browser/index.js +2 -2
- package/dist/{builder-x295GDL6.js → builder-Cl-0BWkh.js} +2 -2
- package/dist/{builder-D8Osghdo.cjs → builder-Cw8u3pPl.cjs} +2 -2
- package/dist/capabilities/302ai.json +192 -192
- package/dist/capabilities/abliteratedllm.json +34 -34
- package/dist/capabilities/abliteration-ai.json +11 -11
- package/dist/capabilities/above.json +17 -17
- package/dist/capabilities/adaption.json +12 -12
- package/dist/capabilities/adzuki.json +30 -30
- package/dist/capabilities/agentrouter.json +10 -10
- package/dist/capabilities/agnes.json +4 -4
- package/dist/capabilities/ai-router.json +9 -9
- package/dist/capabilities/aiand.json +19 -11
- package/dist/capabilities/aigrow.json +11 -11
- package/dist/capabilities/aimlapi.json +146 -149
- package/dist/capabilities/aipg.json +2 -2
- package/dist/capabilities/aixy.json +14 -14
- package/dist/capabilities/aki-io.json +11 -11
- package/dist/capabilities/alibaba-cn.json +128 -109
- package/dist/capabilities/alibaba-coding-plan-cn.json +7 -19
- package/dist/capabilities/alibaba-coding-plan.json +7 -19
- package/dist/capabilities/alibaba-token-plan-cn.json +49 -67
- package/dist/capabilities/alibaba-token-plan.json +51 -69
- package/dist/capabilities/alibaba.json +71 -118
- package/dist/capabilities/ambient.json +14 -14
- package/dist/capabilities/amd.json +11 -11
- package/dist/capabilities/anthropic.json +48 -48
- package/dist/capabilities/anyapi.json +18 -18
- package/dist/capabilities/apiko.json +2 -2
- package/dist/capabilities/arcee.json +10 -10
- package/dist/capabilities/augure.json +6 -6
- package/dist/capabilities/auriko.json +20 -20
- package/dist/capabilities/bailing.json +5 -5
- package/dist/capabilities/baseten.json +46 -16
- package/dist/capabilities/bee.json +5 -5
- package/dist/capabilities/berget.json +4 -4
- package/dist/capabilities/bothub.json +16 -16
- package/dist/capabilities/boundless.json +36 -36
- package/dist/capabilities/bumo.json +40 -40
- package/dist/capabilities/byteplus.json +32 -32
- package/dist/capabilities/cerebras.json +4 -4
- package/dist/capabilities/cheapaimodel.json +5 -5
- package/dist/capabilities/cheapest-token.json +24 -24
- package/dist/capabilities/chutes.json +9 -9
- package/dist/capabilities/cline-pass.json +37 -37
- package/dist/capabilities/cloudcode.json +4 -4
- package/dist/capabilities/cloudflare-workers-ai.json +24 -24
- package/dist/capabilities/commandcode.json +152 -152
- package/dist/capabilities/concentrate.json +290 -266
- package/dist/capabilities/cortecs.json +105 -105
- package/dist/capabilities/crossmodel.json +160 -160
- package/dist/capabilities/crusoe.json +10 -10
- package/dist/capabilities/daoxe.json +7 -7
- package/dist/capabilities/databricks.json +318 -62
- package/dist/capabilities/deepinfra.json +73 -129
- package/dist/capabilities/deepseek.json +2 -2
- package/dist/capabilities/digitalocean.json +114 -114
- package/dist/capabilities/dothoosh.json +28 -28
- package/dist/capabilities/doubleword.json +24 -24
- package/dist/capabilities/edenai.json +458 -458
- package/dist/capabilities/empiriolabs.json +166 -166
- package/dist/capabilities/engy.json +20 -20
- package/dist/capabilities/evroc.json +8 -8
- package/dist/capabilities/ezkielyna.json +8 -8
- package/dist/capabilities/fastrouter.json +85 -85
- package/dist/capabilities/fireworks-ai.json +107 -44
- package/dist/capabilities/freemodel.json +23 -23
- package/dist/capabilities/friendli.json +9 -9
- package/dist/capabilities/frogbot.json +94 -94
- package/dist/capabilities/gisoo.json +16 -16
- package/dist/capabilities/gmicloud.json +17 -17
- package/dist/capabilities/google.json +57 -57
- package/dist/capabilities/graphn.json +10 -10
- package/dist/capabilities/greenpt.json +36 -36
- package/dist/capabilities/groq.json +2 -2
- package/dist/capabilities/helicone.json +68 -68
- package/dist/capabilities/hopper.json +2 -2
- package/dist/capabilities/hostinger-router.json +12 -12
- package/dist/capabilities/hpc-ai.json +13 -13
- package/dist/capabilities/huawei-maas.json +17 -17
- package/dist/capabilities/hubris.json +30 -30
- package/dist/capabilities/huggingface.json +193 -37
- package/dist/capabilities/hyper.json +23 -23
- package/dist/capabilities/impossibl.json +140 -140
- package/dist/capabilities/inception.json +2 -2
- package/dist/capabilities/inceptron.json +4 -4
- package/dist/capabilities/inco.json +3 -3
- package/dist/capabilities/infer.json +15 -15
- package/dist/capabilities/inferall.json +10 -10
- package/dist/capabilities/inference-coop.json +9 -9
- package/dist/capabilities/inferenceapis.json +9 -9
- package/dist/capabilities/inferris.json +3 -3
- package/dist/capabilities/infersia.json +2 -2
- package/dist/capabilities/inferx.json +3 -3
- package/dist/capabilities/infomaniak.json +4 -4
- package/dist/capabilities/io-net.json +2 -2
- package/dist/capabilities/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +60 -60
- package/dist/capabilities/jad-ai.json +3 -3
- package/dist/capabilities/jalapeno.json +12 -12
- package/dist/capabilities/jiekou.json +63 -63
- package/dist/capabilities/jzstoken.json +50 -50
- package/dist/capabilities/keln.json +14 -21
- package/dist/capabilities/kenari.json +123 -120
- package/dist/capabilities/kilo.json +622 -647
- package/dist/capabilities/kimi-code-plan-cn.json +5 -5
- package/dist/capabilities/kimi-code-plan-global.json +5 -5
- package/dist/capabilities/kitani.json +6 -6
- package/dist/capabilities/klavo.json +18 -18
- package/dist/capabilities/korouter.json +29 -29
- package/dist/capabilities/kunavo.json +10 -10
- package/dist/capabilities/liquid.json +11 -11
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +932 -905
- package/dist/capabilities/llmgateway.json +336 -336
- package/dist/capabilities/llmtr.json +22 -22
- package/dist/capabilities/logits.json +2 -2
- package/dist/capabilities/longcat.json +2 -7
- package/dist/capabilities/lowrouter.json +54 -54
- package/dist/capabilities/lyceum.json +12 -12
- package/dist/capabilities/melious.json +13 -13
- package/dist/capabilities/merge-gateway.json +260 -260
- package/dist/capabilities/meta.json +7 -7
- package/dist/capabilities/mistral.json +20 -20
- package/dist/capabilities/mixlayer.json +4 -4
- package/dist/capabilities/modal.json +10 -10
- package/dist/capabilities/model-oracle-ai.json +25 -25
- package/dist/capabilities/modelis.json +20 -20
- package/dist/capabilities/modular.json +6 -6
- package/dist/capabilities/moneo.json +16 -16
- package/dist/capabilities/moonshotai-cn.json +7 -7
- package/dist/capabilities/moonshotai.json +7 -7
- package/dist/capabilities/morph.json +11 -11
- package/dist/capabilities/munito-eu.json +6 -6
- package/dist/capabilities/munito.json +6 -6
- package/dist/capabilities/nan.json +27 -27
- package/dist/capabilities/nano-gpt.json +578 -578
- package/dist/capabilities/nearai.json +84 -84
- package/dist/capabilities/nebius.json +37 -28
- package/dist/capabilities/neon.json +126 -126
- package/dist/capabilities/neuralwatt.json +41 -41
- package/dist/capabilities/nokeep.json +4 -4
- package/dist/capabilities/novita-ai.json +154 -154
- package/dist/capabilities/nvidia.json +35 -35
- package/dist/capabilities/oathbreaker.json +2 -2
- package/dist/capabilities/obscurify.json +32 -32
- package/dist/capabilities/oci.json +7 -7
- package/dist/capabilities/ofox.json +357 -357
- package/dist/capabilities/ollama-cloud.json +56 -56
- package/dist/capabilities/openai.json +51 -51
- package/dist/capabilities/opencode-go.json +85 -84
- package/dist/capabilities/openrouter.json +542 -567
- package/dist/capabilities/opper.json +30 -24
- package/dist/capabilities/orcarouter.json +236 -236
- package/dist/capabilities/outerlabs.json +32 -32
- package/dist/capabilities/ovhcloud.json +7 -7
- package/dist/capabilities/pareto.json +6 -6
- package/dist/capabilities/pendra.json +4 -4
- package/dist/capabilities/perplexity-agent.json +61 -61
- package/dist/capabilities/phala.json +34 -34
- package/dist/capabilities/pioneer.json +30 -30
- package/dist/capabilities/poe.json +136 -136
- package/dist/capabilities/powerspring.json +13 -13
- package/dist/capabilities/primalabs.json +10 -10
- package/dist/capabilities/prime.json +124 -107
- package/dist/capabilities/privatemode-ai.json +14 -14
- package/dist/capabilities/proxystacks.json +6 -6
- package/dist/capabilities/qiniu-ai.json +16 -16
- package/dist/capabilities/refuseless.json +6 -6
- package/dist/capabilities/regolo-ai.json +6 -6
- package/dist/capabilities/requesty.json +172 -172
- package/dist/capabilities/ruapi.json +17 -17
- package/dist/capabilities/runcrate.json +5 -5
- package/dist/capabilities/runinfra.json +13 -13
- package/dist/capabilities/sakana.json +6 -6
- package/dist/capabilities/sambanova.json +9 -9
- package/dist/capabilities/sandbase.json +27 -27
- package/dist/capabilities/sarvam.json +12 -12
- package/dist/capabilities/scaleway.json +14 -14
- package/dist/capabilities/scnet-token-plan.json +9 -9
- package/dist/capabilities/scx-ai.json +26 -26
- package/dist/capabilities/sensenova.json +12 -12
- package/dist/capabilities/siliconflow-cn.json +49 -49
- package/dist/capabilities/siliconflow.json +46 -46
- package/dist/capabilities/snowflake-cortex.json +20 -20
- package/dist/capabilities/sokkan.json +7 -7
- package/dist/capabilities/sparrowcodes.json +25 -25
- package/dist/capabilities/standardcompute.json +102 -102
- package/dist/capabilities/steadyrouter.json +40 -40
- package/dist/capabilities/stepfun-ai-step-plan.json +6 -6
- package/dist/capabilities/stepfun-ai.json +15 -8
- package/dist/capabilities/stepfun-step-plan.json +15 -8
- package/dist/capabilities/stepfun.json +15 -8
- package/dist/capabilities/stepping-stone.json +16 -16
- package/dist/capabilities/synthetic.json +13 -13
- package/dist/capabilities/synthorai.json +19 -19
- package/dist/capabilities/teamorouter.json +24 -24
- package/dist/capabilities/teapot-router.json +13 -13
- package/dist/capabilities/tencent-coding-plan.json +1 -23
- package/dist/capabilities/tencent-token-plan.json +60 -23
- package/dist/capabilities/tencent-tokenhub.json +182 -7
- package/dist/capabilities/tensorx.json +50 -50
- package/dist/capabilities/tenstorrent.json +6 -6
- package/dist/capabilities/the-grid-ai.json +28 -28
- package/dist/capabilities/thinkingmachines.json +72 -55
- package/dist/capabilities/tinfoil.json +13 -13
- package/dist/capabilities/toapis.json +2 -2
- package/dist/capabilities/togetherai.json +54 -83
- package/dist/capabilities/tokengo.json +25 -25
- package/dist/capabilities/tokenify.json +9 -9
- package/dist/capabilities/trustedrouter.json +4 -4
- package/dist/capabilities/trustedtokens.json +17 -17
- package/dist/capabilities/umans-ai-coding-plan.json +13 -13
- package/dist/capabilities/umans-ai.json +10 -10
- package/dist/capabilities/unrestricted.json +6 -6
- package/dist/capabilities/uplinkswitch.json +21 -21
- package/dist/capabilities/upstage.json +4 -4
- package/dist/capabilities/vancine.json +23 -23
- package/dist/capabilities/vercel.json +540 -527
- package/dist/capabilities/vivgrid.json +80 -80
- package/dist/capabilities/volcengine-coding-plan.json +24 -54
- package/dist/capabilities/volcengine.json +55 -60
- package/dist/capabilities/vultr.json +24 -24
- package/dist/capabilities/wafer.ai.json +19 -19
- package/dist/capabilities/wallaby.json +5 -5
- package/dist/capabilities/wally.json +11 -11
- package/dist/capabilities/wandb.json +21 -21
- package/dist/capabilities/watt.json +24 -24
- package/dist/capabilities/xai.json +7 -7
- package/dist/capabilities/xiaomi-token-plan-ams.json +2 -12
- package/dist/capabilities/xiaomi-token-plan-cn.json +2 -12
- package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -12
- package/dist/capabilities/xiaomi.json +3 -25
- package/dist/capabilities/xpersona.json +13 -13
- package/dist/capabilities/xxapi.json +31 -31
- package/dist/capabilities/zai-coding-plan.json +18 -18
- package/dist/capabilities/zai.json +49 -26
- package/dist/capabilities/zenifra.json +26 -26
- package/dist/capabilities/zenmux.json +205 -205
- package/dist/capabilities/zerogpu.json +11 -11
- package/dist/capabilities/zhipuai-coding-plan.json +6 -6
- package/dist/capabilities/zhipuai.json +39 -24
- package/dist/capabilities/zro.json +6 -6
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/{channels-Dx4jiXeK.js → channels-Cz1y3W6u.js} +1 -1
- package/dist/{channels-q6qnuRNV.cjs → channels-DQg4v_gm.cjs} +1 -1
- package/dist/coding-agent/index.cjs +2 -2
- package/dist/coding-agent/index.js +2 -2
- package/dist/datasets/dataset.d.ts +13 -6
- package/dist/datasets/experiment/durable.d.ts +16 -0
- package/dist/datasets/experiment/index.d.ts +2 -1
- package/dist/datasets/experiment/item.d.ts +26 -4
- package/dist/datasets/experiment/retries.d.ts +18 -0
- package/dist/datasets/experiment/types.d.ts +18 -0
- package/dist/datasets/experiment/workflow-id.d.ts +7 -0
- package/dist/datasets/experiment/workflow.d.ts +74 -0
- package/dist/datasets/index.cjs +3 -2
- package/dist/datasets/index.d.ts +2 -1
- package/dist/datasets/index.js +3 -3
- package/dist/docs/SKILL.md +4 -3
- package/dist/docs/assets/SOURCE_MAP.json +928 -903
- package/dist/docs/references/docs-deployment-workers.md +1 -1
- package/dist/docs/references/docs-evals-experiments.md +29 -1
- package/dist/docs/references/docs-harness-background-tasks.md +4 -1
- package/dist/docs/references/docs-harness-durable-agents.md +9 -5
- package/dist/docs/references/docs-knowledge-agents-and-tools.md +1 -0
- package/dist/docs/references/docs-knowledge-importers.md +195 -0
- package/dist/docs/references/docs-knowledge-load-your-content.md +2 -2
- package/dist/docs/references/docs-knowledge-overview.md +1 -1
- package/dist/docs/references/docs-mastra-platform-observability-overview.md +1 -1
- package/dist/docs/references/docs-sandbox-filesystem.md +1 -1
- package/dist/docs/references/docs-server-pubsub.md +51 -8
- package/dist/docs/references/docs-signals-running-across-processes.md +2 -0
- package/dist/docs/references/docs-signals-thread-streams.md +1 -1
- package/dist/docs/references/docs-studio-auth.md +54 -7
- package/dist/docs/references/docs-workflows-overview.md +1 -1
- package/dist/docs/references/docs-workflows-scheduled-workflows.md +1 -1
- package/dist/docs/references/integrations-auth-clerk.md +48 -4
- package/dist/docs/references/integrations-channels-slack.md +4 -2
- package/dist/docs/references/integrations.md +6 -0
- package/dist/docs/references/reference-agents-agent.md +3 -1
- package/dist/docs/references/reference-agents-channels.md +116 -27
- package/dist/docs/references/reference-agents-durable-agent.md +12 -4
- package/dist/docs/references/reference-auth-clerk.md +21 -1
- package/dist/docs/references/reference-datasets-runExperimentItem.md +13 -1
- package/dist/docs/references/reference-datasets-startExperimentAsync.md +3 -1
- package/dist/docs/references/reference-editor-mastra-editor.md +3 -1
- package/dist/docs/references/reference-knowledge-knowledge-class.md +13 -6
- package/dist/docs/references/reference-knowledge-knowledge-tools.md +43 -20
- package/dist/docs/references/reference-memory-observational-memory.md +2 -2
- package/dist/docs/references/reference-processors-moderation-processor.md +2 -2
- package/dist/docs/references/reference-pubsub-base.md +5 -1
- package/dist/docs/references/reference-pubsub-event-emitter.md +2 -0
- package/dist/docs/references/reference-pubsub-redis-streams.md +1 -1
- package/dist/docs/references/reference-pubsub-unix-socket-pubsub.md +2 -0
- package/dist/docs/references/reference-streaming-ChunkType.md +3 -3
- package/dist/docs/references/reference-workers-overview.md +1 -1
- package/dist/docs/references/reference-workflows-run-methods-start.md +23 -0
- package/dist/docs/references/reference-workflows-run-methods-timeTravel.md +4 -0
- package/dist/docs/references/reference-workflows-run.md +1 -1
- package/dist/docs/references/reference-workspace-local-sandbox.md +2 -0
- package/dist/error/index.cjs +1 -1
- package/dist/error/index.js +1 -1
- package/dist/{error-C9d_24w-.js → error-BLwEXqOK.js} +2 -2
- package/dist/{error-BRQf2ku0.cjs → error-BdEvO8za.cjs} +2 -2
- 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/events/caching-pubsub.d.ts +1 -0
- package/dist/events/event-emitter/index.d.ts +12 -5
- package/dist/events/index.cjs +15 -1
- package/dist/events/index.js +15 -1
- package/dist/events/pubsub.d.ts +29 -0
- package/dist/events/reach.d.ts +11 -0
- package/dist/events/unix-socket-pubsub.d.ts +14 -0
- package/dist/features/index.cjs +1 -0
- package/dist/features/index.js +1 -0
- package/dist/{filesystem-B5X-5G0x.js → filesystem-B8ad6kAW.js} +1 -1
- package/dist/{filesystem-BDSpwBke.cjs → filesystem-BB5YWXH-.cjs} +1 -1
- package/dist/{filesystem-DzM9pcQ8.js → filesystem-BDHUxbHn.js} +1 -1
- package/dist/{filesystem-B0AZrbj8.cjs → filesystem-BP5yz5LG.cjs} +1 -1
- package/dist/{filesystem-BsdkC311.js → filesystem-B_afSgYk.js} +1 -1
- package/dist/{filesystem-C-cyJfi1.cjs → filesystem-BaOJOc-V.cjs} +1 -1
- package/dist/{filesystem-B3s0WRud.js → filesystem-BhYgU8qg.js} +1 -1
- package/dist/{filesystem-DzfqVTO_.js → filesystem-CLBVmR5j.js} +1 -1
- package/dist/{filesystem-CEbD_77-.cjs → filesystem-Cgxc2a_-.cjs} +1 -1
- package/dist/{filesystem-Cv79mHRk.js → filesystem-ClBOBoDc.js} +1 -1
- package/dist/{filesystem-DsCQiBl2.cjs → filesystem-DVVecqZt.cjs} +1 -1
- package/dist/{filesystem-CUAgLugE.cjs → filesystem-Fpsu7e24.cjs} +1 -1
- package/dist/{filesystem-versioned-Bijb_p9l.js → filesystem-versioned-BL1ojJLo.js} +1 -1
- package/dist/{filesystem-versioned-DZGyPbNC.cjs → filesystem-versioned-BavRtYWJ.cjs} +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/config.d.ts +10 -0
- package/dist/knowledge/host-writes.d.ts +10 -0
- package/dist/knowledge/importers/conformance.d.ts +25 -0
- package/dist/knowledge/importers/define.d.ts +204 -0
- package/dist/knowledge/importers/host.d.ts +143 -0
- package/dist/knowledge/importers/index.d.ts +12 -0
- package/dist/knowledge/importers/local-host.d.ts +106 -0
- package/dist/knowledge/importers/manifest.d.ts +25 -0
- package/dist/knowledge/importers/runner.d.ts +61 -0
- package/dist/knowledge/importers/sink.d.ts +105 -0
- package/dist/knowledge/importers/types.d.ts +144 -0
- package/dist/knowledge/index.cjs +2715 -8
- package/dist/knowledge/index.d.ts +54 -4
- package/dist/knowledge/index.js +2692 -9
- package/dist/knowledge/instructions.d.ts +1 -1
- package/dist/knowledge/links.d.ts +8 -0
- package/dist/knowledge/pinned-state-processor.d.ts +5 -0
- package/dist/knowledge/pinned.d.ts +4 -1
- package/dist/knowledge/scope-runtime.d.ts +10 -0
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/provider-types.generated.d.ts +7812 -7831
- package/dist/llm/model/shared.types.d.ts +31 -0
- package/dist/{llm-CsQuqKPc.cjs → llm-8Av3mSjD.cjs} +2 -2
- package/dist/{llm-DnXK3Pmw.js → llm-B5A5cwJr.js} +2 -2
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +2 -2
- package/dist/{manager-BsghM-UL.js → manager-DfWQCJUK.js} +460 -94
- package/dist/{manager-DwFnIrI6.cjs → manager-sv35JY-z.cjs} +476 -92
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.d.ts +13 -0
- package/dist/mastra/index.js +1 -1
- package/dist/mastra/resolve-agent.d.ts +3 -1
- package/dist/{mastra-B8i1UDZs.js → mastra-CigBrT7X.js} +32 -23
- package/dist/{mastra-Cn5NC6Es.cjs → mastra-D4hvfuxX.cjs} +34 -25
- package/dist/memory/index.cjs +3 -3
- package/dist/memory/index.js +3 -3
- package/dist/{message-list-DPXPXvin.cjs → message-list-Cj0Sq_JP.cjs} +63 -8
- package/dist/{message-list-DEuRl82K.js → message-list-KRbg-TnI.js} +63 -8
- package/dist/{model-CNPfry_X.cjs → model-BK93CMtl.cjs} +1 -1
- package/dist/{model-CsOcWMUt.js → model-CYtXw861.js} +1 -1
- package/dist/{netlify-C-83Fxus.cjs → netlify-BAnn3ouY.cjs} +1 -1
- package/dist/{netlify-C-OpNSGp.js → netlify-CuI1ZrwR.js} +1 -1
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/{output-helpers-JL-HeCbT.cjs → output-helpers-1Zu4Vt9C.cjs} +68 -25
- package/dist/{output-helpers-D4II19No.js → output-helpers-CedRCE17.js} +69 -26
- package/dist/processor-provider/index.cjs +1 -1
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/abort-signal-scope.d.ts +6 -0
- package/dist/processors/index.cjs +2 -2
- package/dist/processors/index.js +2 -2
- package/dist/{provider-registry-9O-H9osy.cjs → provider-registry-BwuI_IpT.cjs} +21690 -21811
- package/dist/{provider-registry-RZ8EgSe8.js → provider-registry-CmQLzLF_.js} +21690 -21811
- package/dist/provider-registry.json +22113 -22215
- package/dist/{registry-generator-e8sltJls.js → registry-generator-C17V4WfG.js} +1 -1
- package/dist/{registry-generator-DxCX-FiO.cjs → registry-generator-C_0ae7Ce.cjs} +1 -1
- package/dist/{rehydrate-B-wrAN7C.cjs → rehydrate-CDQ4dOYj.cjs} +2 -2
- package/dist/{rehydrate-D3fPgJwp.js → rehydrate-PnaVawGX.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-5_LQBGn_.cjs → run-registry-BmckDVBk.cjs} +1698 -497
- package/dist/{run-registry-DC03XLeZ.js → run-registry-BwEcwYlU.js} +1614 -467
- package/dist/{source-DDwx-87N.cjs → source-BVOi8Xhp.cjs} +1 -1
- package/dist/{source-Did_2XQc.js → source-fNa6u1kH.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/knowledge/base.d.ts +72 -0
- package/dist/storage/domains/knowledge/importers-inmemory.d.ts +146 -0
- package/dist/storage/domains/knowledge/importers.d.ts +287 -0
- package/dist/storage/domains/knowledge/index.d.ts +1 -0
- package/dist/storage/domains/knowledge/inmemory.d.ts +12 -0
- package/dist/storage/domains/knowledge/pages-inmemory.d.ts +12 -1
- package/dist/storage/domains/knowledge/pages.d.ts +25 -7
- package/dist/storage/domains/mcp-clients/index.cjs +1 -1
- package/dist/storage/domains/mcp-clients/index.js +1 -1
- package/dist/storage/domains/mcp-servers/index.cjs +1 -1
- package/dist/storage/domains/mcp-servers/index.js +1 -1
- package/dist/storage/domains/prompt-blocks/index.cjs +1 -1
- package/dist/storage/domains/prompt-blocks/index.js +1 -1
- package/dist/storage/domains/scorer-definitions/index.cjs +1 -1
- package/dist/storage/domains/scorer-definitions/index.js +1 -1
- package/dist/storage/domains/skills/index.cjs +1 -1
- package/dist/storage/domains/skills/index.js +1 -1
- package/dist/storage/domains/workspaces/index.cjs +1 -1
- package/dist/storage/domains/workspaces/index.js +1 -1
- package/dist/storage/index.cjs +15 -10
- package/dist/storage/index.js +11 -11
- package/dist/stream/base/output.d.ts +59 -15
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/stream/types.d.ts +24 -2
- package/dist/{stream-4aNIw_TQ.cjs → stream-0kdqBOOn.cjs} +64 -9
- package/dist/{stream-CJUm6EAH.js → stream-D1y9GzoD.js} +29 -10
- 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-FEEwHfmg.js → tool-loop-agent-BdjWGVIb.js} +4 -4
- package/dist/{tool-loop-agent-Dn0QCB9n.cjs → tool-loop-agent-kWaZAT6Q.cjs} +4 -4
- package/dist/tools/types.d.ts +27 -1
- package/dist/{utils-DY01hxVd.cjs → utils-BKUCaZ12.cjs} +1 -1
- package/dist/{utils-Bd_y1_a-.js → utils-GHY3hmLx.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-CX0yQo_q.js → validate-CB-q-R2F.js} +1 -1
- package/dist/{validate-CuB_1Zd3.cjs → validate-De92squ7.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-CbaSmip-.cjs → worker-BbWPQuPR.cjs} +2 -2
- package/dist/{worker-B80xkcKG.js → worker-C3u_xzY2.js} +2 -2
- package/dist/{worker-GsGIxPMa.cjs → worker-CAKvQj9_.cjs} +2 -2
- package/dist/{worker-DSEfMPmq.js → worker-Kwm8EKcj.js} +2 -2
- package/dist/{workflow-CnBPXTpv.cjs → workflow-CSjXeNcR.cjs} +4 -4
- package/dist/{workflow-CZHY_C85.js → workflow-CVmI1Sw-.js} +4 -4
- 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/evented/setup-warning.d.ts +18 -0
- package/dist/workflows/evented/workflow-event-processor/run-status.d.ts +37 -0
- package/dist/workflows/evented/workflow.d.ts +10 -0
- package/dist/workflows/index.cjs +4 -4
- package/dist/workflows/index.js +4 -4
- package/dist/workflows/workflow.d.ts +6 -1
- package/dist/workspace/filesystem/filesystem.d.ts +5 -0
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/sandbox/local-sandbox.d.ts +16 -7
- package/dist/workspace/sandbox/native-sandbox/types.d.ts +11 -1
- package/dist/{workspace-D7TIleIt.js → workspace-DY2Nxiyi.js} +235 -34
- package/dist/{workspace-D2drutNg.cjs → workspace-X2RHJZU9.cjs} +235 -34
- package/package.json +7 -7
- package/src/llm/model/provider-types.generated.d.ts +7812 -7831
|
@@ -43,7 +43,7 @@ The agent gets 42 Clerk tools, with keys such as `clerk_assign_organization_role
|
|
|
43
43
|
|
|
44
44
|
## Server authentication
|
|
45
45
|
|
|
46
|
-
The `@mastra/auth-clerk` package
|
|
46
|
+
The `@mastra/auth-clerk` package verifies Clerk-issued tokens for API requests and supports [Studio authentication](https://mastra.ai/docs/studio/auth) through OAuth single sign-on (SSO) with encrypted session cookies. Configure it under `server.auth` for API authentication or under `studio.auth` for separate Studio authentication.
|
|
47
47
|
|
|
48
48
|
### Prerequisites
|
|
49
49
|
|
|
@@ -102,13 +102,57 @@ export const mastra = new Mastra({
|
|
|
102
102
|
})
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
> **Note:** The default `authorizeUser` method allows all authenticated users. To customize user authorization, provide a custom `authorizeUser` function when constructing the provider.
|
|
105
|
+
> **Note:** The default `authorizeUser` method allows all authenticated users unless `organizationId` or `organizationSlug` restricts access to members of one organization. To customize user authorization, provide a custom `authorizeUser` function when constructing the provider.
|
|
106
106
|
>
|
|
107
107
|
> Visit [MastraAuthClerk](https://mastra.ai/reference/auth/clerk) for all available configuration options.
|
|
108
108
|
|
|
109
|
+
### Studio SSO
|
|
110
|
+
|
|
111
|
+
Clerk can act as the OAuth identity provider for Studio. The publishable key, secret key, and JWKS URI used for API authentication don't enable the Studio SSO flow on their own. You also need an OAuth client ID and secret.
|
|
112
|
+
|
|
113
|
+
1. In the Clerk Dashboard, create an OAuth application and obtain its client ID and client secret. You can leave **Require PKCE** enabled: Mastra sends an S256 challenge and the matching verifier automatically.
|
|
114
|
+
2. Register your Mastra server's SSO callback URL with the OAuth application. For a local server with the default API prefix, use `http://localhost:4111/api/auth/sso/callback`. In production, use the server's public HTTPS origin and configured API prefix.
|
|
115
|
+
3. Add the following environment variables alongside the Clerk credentials from [Prerequisites](#prerequisites):
|
|
116
|
+
|
|
117
|
+
```env
|
|
118
|
+
CLERK_OAUTH_CLIENT_ID=your-oauth-client-id
|
|
119
|
+
CLERK_OAUTH_CLIENT_SECRET=your-oauth-client-secret
|
|
120
|
+
CLERK_COOKIE_PASSWORD=replace-with-a-random-secret-at-least-32-characters-long
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Use a stable, random cookie password of at least 32 characters. If omitted, Mastra generates a password, so sessions won't survive restarts. Share the same password across replicas and keep it server-side.
|
|
124
|
+
|
|
125
|
+
Configure Clerk under `studio.auth` to require sign-in for Studio without adding authentication to ordinary API requests:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import { Mastra } from '@mastra/core'
|
|
129
|
+
import { MastraAuthClerk } from '@mastra/auth-clerk'
|
|
130
|
+
|
|
131
|
+
export const mastra = new Mastra({
|
|
132
|
+
studio: {
|
|
133
|
+
auth: new MastraAuthClerk({
|
|
134
|
+
publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
|
|
135
|
+
secretKey: process.env.CLERK_SECRET_KEY,
|
|
136
|
+
jwksUri: process.env.CLERK_JWKS_URI,
|
|
137
|
+
oauthClientId: process.env.CLERK_OAUTH_CLIENT_ID,
|
|
138
|
+
oauthClientSecret: process.env.CLERK_OAUTH_CLIENT_SECRET,
|
|
139
|
+
session: {
|
|
140
|
+
cookiePassword: process.env.CLERK_COOKIE_PASSWORD,
|
|
141
|
+
},
|
|
142
|
+
}),
|
|
143
|
+
},
|
|
144
|
+
})
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Open Studio in a signed-out browser session and select **Sign in with Clerk**. After signing in, confirm that Clerk redirects to the Mastra callback and that Mastra sets an encrypted session cookie before returning you to Studio. You don't need to manually pass an API token for this login flow. Follow [Verify authentication](https://mastra.ai/docs/studio/auth) to check signed-out requests and direct API access too.
|
|
148
|
+
|
|
149
|
+
> **Warning:** This example leaves ordinary API requests unauthenticated. A Studio login screen doesn't prevent callers from accessing those endpoints directly. Configure `server.auth` too if your API needs protection. See [Separate Studio and API authentication](https://mastra.ai/docs/studio/auth).
|
|
150
|
+
|
|
151
|
+
To use Clerk for both Studio and API authentication, move this provider configuration to `server.auth` and leave `studio.auth` unset. For production Studio SSO, see the [EE license requirements](https://mastra.ai/docs/license).
|
|
152
|
+
|
|
109
153
|
### Client-side setup
|
|
110
154
|
|
|
111
|
-
|
|
155
|
+
For direct API requests protected by `server.auth`, retrieve the access token from Clerk on the client side and pass it to your Mastra requests.
|
|
112
156
|
|
|
113
157
|
#### Retrieving the access token
|
|
114
158
|
|
|
@@ -133,7 +177,7 @@ Refer to the [Clerk documentation](https://clerk.com/docs) for more information.
|
|
|
133
177
|
|
|
134
178
|
### Configuring `MastraClient`
|
|
135
179
|
|
|
136
|
-
When
|
|
180
|
+
When Clerk is configured under `server.auth`, requests to protected API routes made with `MastraClient` must include a valid Clerk access token in the `Authorization` header:
|
|
137
181
|
|
|
138
182
|
```typescript
|
|
139
183
|
import { MastraClient } from '@mastra/client-js'
|
|
@@ -58,7 +58,7 @@ Your server needs a public URL that Slack can reach for webhook delivery and OAu
|
|
|
58
58
|
|
|
59
59
|
1. Open [Slack apps](https://api.slack.com/apps), then open **Your App Configuration Tokens**.
|
|
60
60
|
|
|
61
|
-
2. Generate an app configuration token for the workspace where the agent will run.
|
|
61
|
+
2. Generate an app configuration token for the workspace where the agent will run. Slack shows an access token (`xoxe.xoxp-1-...`) that expires in 12 hours, followed by a refresh token (`xoxe-1-...`). Copy the refresh token. Mastra rotates it after you connect, so don't use it anywhere else.
|
|
62
62
|
|
|
63
63
|
3. Run `mastra connect add slack-channels` and complete the authorization flow. The platform stores and rotates the configuration credential.
|
|
64
64
|
|
|
@@ -79,10 +79,12 @@ Your server needs a public URL that Slack can reach for webhook delivery and OAu
|
|
|
79
79
|
|
|
80
80
|
5. Start your Mastra application.
|
|
81
81
|
|
|
82
|
-
6. In Studio, connect the Slack channel to an agent. Mastra creates a Slack app and returns an authorization URL. Open it, choose the workspace, and approve the bot scopes.
|
|
82
|
+
6. In Studio, connect the Slack channel to an agent. The Connect page on the Mastra platform only stores the connection, so you link it to an agent in Studio. Mastra creates a Slack app and returns an authorization URL. Open it, choose the workspace, and approve the bot scopes.
|
|
83
83
|
|
|
84
84
|
The [default Slack manifest](https://mastra.ai/reference/channels/slack-provider) lists the requested scopes and event subscriptions.
|
|
85
85
|
|
|
86
|
+
To let the agent post structured cards with tables, charts, and fields, see [Generative UI cards](https://mastra.ai/reference/agents/channels).
|
|
87
|
+
|
|
86
88
|
## Self-managed setup
|
|
87
89
|
|
|
88
90
|
Create a Slack app yourself and store its credentials in your Mastra environment. Use this path for agent chat when you want to control the Slack app directly.
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
- [Gmail](https://mastra.ai/integrations/email-calendar/google-mail)
|
|
21
21
|
- [Google Calendar](https://mastra.ai/integrations/email-calendar/google-calendar)
|
|
22
22
|
- [Microsoft Outlook](https://mastra.ai/integrations/email-calendar/outlook)
|
|
23
|
+
- [SendGrid](https://mastra.ai/integrations/email-calendar/sendgrid)
|
|
23
24
|
|
|
24
25
|
## Documents
|
|
25
26
|
|
|
@@ -129,8 +130,10 @@
|
|
|
129
130
|
|
|
130
131
|
## Tools
|
|
131
132
|
|
|
133
|
+
- [Anthropic](https://mastra.ai/integrations/tools/anthropic)
|
|
132
134
|
- [Bright Data](https://mastra.ai/integrations/tools/brightdata)
|
|
133
135
|
- [Firecrawl](https://mastra.ai/integrations/tools/firecrawl)
|
|
136
|
+
- [GitLab](https://mastra.ai/integrations/tools/gitlab)
|
|
134
137
|
- [Parallel](https://mastra.ai/integrations/tools/parallel)
|
|
135
138
|
- [Perplexity](https://mastra.ai/integrations/tools/perplexity)
|
|
136
139
|
- [Sanity Context](https://mastra.ai/integrations/tools/sanity-context)
|
|
@@ -223,7 +226,10 @@
|
|
|
223
226
|
## Other providers
|
|
224
227
|
|
|
225
228
|
- [Canva](https://mastra.ai/integrations/other/canva)
|
|
229
|
+
- [Cloudflare Workers](https://mastra.ai/integrations/other/cloudflare-workers)
|
|
230
|
+
- [Digits](https://mastra.ai/integrations/other/digits)
|
|
226
231
|
- [Fireflies.ai](https://mastra.ai/integrations/other/fireflies)
|
|
232
|
+
- [Google Analytics](https://mastra.ai/integrations/other/google-analytics)
|
|
227
233
|
- [incident.io](https://mastra.ai/integrations/other/incident-io)
|
|
228
234
|
- [Resend](https://mastra.ai/integrations/other/resend)
|
|
229
235
|
- [Robinhood](https://mastra.ai/integrations/other/robinhood)
|
|
@@ -432,6 +432,8 @@ const result = await agent.sendNotificationSignal(
|
|
|
432
432
|
|
|
433
433
|
**options.ifIdle** (`object`): Controls what happens when the target thread is idle.
|
|
434
434
|
|
|
435
|
+
**options.ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): What to do when the notification signal reaches an idle thread. Defaults to wake. persist is stored on the record, so a deferred or summarized delivery also persists without waking the thread. A summary covering several records persists only when every record asked to persist.
|
|
436
|
+
|
|
435
437
|
**options.ifIdle.streamOptions** (`AgentExecutionOptions`): Options for the stream that starts when an immediate notification wakes an idle thread.
|
|
436
438
|
|
|
437
439
|
Returns `{ record: NotificationRecord, decision: NotificationDeliveryDecision, runId?: string, signal?: CreatedAgentSignal, persisted?: Promise<void>, accepted?: Promise<SendAgentSignalAccepted> }`. `record` is the stored inbox record. `decision` is the delivery-policy result. `signal` and `runId` are present when ingress emits a signal immediately, including the immediate summary emitted for active high-priority notifications. `persisted` is present when the emitted signal is persisted without waking an idle thread. `accepted` is present when a signal is emitted and resolves at decision-time, once Mastra decides what to do with it: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run, or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` on the accepted result is present only on `wake` and `deliver`. On the `wake` action, `output` is the agent stream for in-process consumption.
|
|
@@ -601,7 +603,7 @@ Returns an `AgentThreadSubscription` object with these members:
|
|
|
601
603
|
|
|
602
604
|
**requestContextSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for validating request context values. When provided, the context is validated at the start of generate() or stream(), throwing a MastraError if validation fails.
|
|
603
605
|
|
|
604
|
-
**durable** (`boolean |
|
|
606
|
+
**durable** (`boolean | AgentStreamsConfig`): Publishes run events for observe() and reconnecting clients. Set executionEngine to "default" or "evented" for checkpointed execution, or false for the plain loop. Explicit agent settings override Mastra.durable defaults, and the engine is fixed at registration or first execution. Pass durable: false to opt out of publication and inherited defaults. Native streams keep MastraModelOutput APIs. See Native agent execution.
|
|
605
607
|
|
|
606
608
|
**editor** (`false | { instructions?: boolean; tools?: boolean | { description?: boolean }; model?: boolean }`): Controls which fields the editor can override for this code-defined agent. Omit to allow editing instructions and tools. See Editor overrides below.
|
|
607
609
|
|
|
@@ -15,10 +15,10 @@ import { Agent } from '@mastra/core/agent'
|
|
|
15
15
|
import { createSlackAdapter } from '@chat-adapter/slack'
|
|
16
16
|
import { createDiscordAdapter } from '@chat-adapter/discord'
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
id: '
|
|
20
|
-
name: '
|
|
21
|
-
instructions: 'You are a helpful
|
|
18
|
+
const agent = new Agent({
|
|
19
|
+
id: 'channels-agent',
|
|
20
|
+
name: 'Channels Agent',
|
|
21
|
+
instructions: 'You are a helpful assistant.',
|
|
22
22
|
model: 'openai/gpt-6.1-sol',
|
|
23
23
|
channels: {
|
|
24
24
|
adapters: {
|
|
@@ -236,7 +236,7 @@ const agent = new Agent({
|
|
|
236
236
|
|
|
237
237
|
> **Experimental:** `generativeUI` is experimental and may change in a minor release.
|
|
238
238
|
|
|
239
|
-
Set `generativeUI: true` on
|
|
239
|
+
Set `generativeUI: true` on Slack to let the agent post structured cards (status summaries, key/value fields, tables, charts, images, and link buttons) instead of long markdown replies. Install the optional peer first:
|
|
240
240
|
|
|
241
241
|
**npm**:
|
|
242
242
|
|
|
@@ -266,24 +266,46 @@ bun add @json-render/chat
|
|
|
266
266
|
|
|
267
267
|
`@mastra/core` loads `@json-render/chat` at runtime, so `mastra build` and `mastra deploy` don't pick it up on their own. Add it to [`bundler.dynamicPackages`](https://mastra.ai/reference/core/mastra-class) so it's included in the build output:
|
|
268
268
|
|
|
269
|
+
```typescript
|
|
270
|
+
export const mastra = new Mastra({
|
|
271
|
+
// ...
|
|
272
|
+
bundler: { dynamicPackages: ['@json-render/chat'] },
|
|
273
|
+
})
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Runs on Slack then get a `render_card` tool. The tool call itself isn't rendered as a tool card.
|
|
277
|
+
|
|
278
|
+
### Enable with Mastra Connect
|
|
279
|
+
|
|
280
|
+
When Slack chat runs through [Mastra Connect](https://mastra.ai/integrations/channels/slack), set `generativeUI` in the Slack provider options. `channels()` forwards `providerOptions` to [`SlackProvider`](https://mastra.ai/reference/channels/slack-provider):
|
|
281
|
+
|
|
269
282
|
```typescript
|
|
270
283
|
import { Mastra } from '@mastra/core'
|
|
271
|
-
import {
|
|
284
|
+
import { channels } from '@mastra/connect'
|
|
272
285
|
|
|
273
286
|
export const mastra = new Mastra({
|
|
274
|
-
|
|
287
|
+
// ...
|
|
288
|
+
channels: await channels({
|
|
289
|
+
providers: { slack: { providerOptions: { generativeUI: true } } },
|
|
290
|
+
}),
|
|
275
291
|
bundler: { dynamicPackages: ['@json-render/chat'] },
|
|
276
292
|
})
|
|
277
293
|
```
|
|
278
294
|
|
|
295
|
+
The agent doesn't need `channels.adapters`. Connect the Slack channel to the agent in Studio.
|
|
296
|
+
|
|
297
|
+
### Enable with `createSlackAdapter()`
|
|
298
|
+
|
|
299
|
+
When you manage your own Slack app with the [self-managed setup](https://mastra.ai/integrations/channels/slack), set `generativeUI` on the agent's Slack adapter instead:
|
|
300
|
+
|
|
279
301
|
```typescript
|
|
280
302
|
import { Agent } from '@mastra/core/agent'
|
|
281
303
|
import { createSlackAdapter } from '@chat-adapter/slack'
|
|
282
304
|
|
|
283
|
-
|
|
284
|
-
id: '
|
|
285
|
-
name: '
|
|
286
|
-
instructions: '
|
|
305
|
+
const agent = new Agent({
|
|
306
|
+
id: 'generative-ui-agent',
|
|
307
|
+
name: 'Generative UI Agent',
|
|
308
|
+
instructions: '...',
|
|
287
309
|
model: 'openai/gpt-6.1-sol',
|
|
288
310
|
channels: {
|
|
289
311
|
adapters: {
|
|
@@ -293,21 +315,54 @@ export const supportAgent = new Agent({
|
|
|
293
315
|
})
|
|
294
316
|
```
|
|
295
317
|
|
|
296
|
-
|
|
318
|
+
### Card spec
|
|
297
319
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
320
|
+
The agent passes `render_card` a [json-render](https://json-render.dev/docs) spec. See the json-render docs for the spec format and components. Image URLs, including a `Card` `imageUrl`, must be public HTTPS images that Slack can fetch.
|
|
321
|
+
|
|
322
|
+
The tool returns `{ ok: true, messageId }` once the card is posted. When the spec is invalid or exceeds the [Slack limits](#slack-card-limits), it returns `{ ok: false, issues }` without posting, so the agent can fix the spec and call it again. When Slack rejects the post, it returns `{ ok: false, error }`.
|
|
323
|
+
|
|
324
|
+
### Agent instructions
|
|
325
|
+
|
|
326
|
+
A generic prompt usually produces only a basic table or chart. Name the components the agent should use and when to use them. When `render_card` returns issues, agents also tend to simplify the card by dropping images or fields instead of fixing the spec, so tell the agent to keep every component:
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
import { Agent } from '@mastra/core/agent'
|
|
330
|
+
|
|
331
|
+
const agent = new Agent({
|
|
332
|
+
id: 'generative-ui-agent',
|
|
333
|
+
name: 'Generative UI Agent',
|
|
334
|
+
instructions: `You are a support assistant for an internal deploy service.
|
|
335
|
+
|
|
336
|
+
Use render_card for status updates and reports. Start each card with a Card that has a title.
|
|
337
|
+
- Use Fields and Field for key facts such as environment, version, and owner.
|
|
338
|
+
- Use a Table for lists of items and a Chart for trends over time.
|
|
339
|
+
- Use an Image only when you have a public HTTPS image URL.
|
|
340
|
+
- Put links to dashboards or logs in LinkButton elements inside Actions.
|
|
341
|
+
|
|
342
|
+
If render_card returns issues, fix the spec and call it again. Keep every component you planned, including images and fields. Don't remove content to make the card pass.`,
|
|
343
|
+
model: 'openai/gpt-6.1-sol',
|
|
344
|
+
})
|
|
308
345
|
```
|
|
309
346
|
|
|
310
|
-
|
|
347
|
+
### How cards look in Slack
|
|
348
|
+
|
|
349
|
+
`@chat-adapter/slack` renders a `Card` as a header block and a context block, followed by the blocks for its children. It doesn't use Slack's [card block](https://docs.slack.dev/reference/block-kit/blocks/card-block), so the card has no visible container or border around it.
|
|
350
|
+
|
|
351
|
+
### Slack card limits
|
|
352
|
+
|
|
353
|
+
`render_card` checks these limits before posting. The Slack adapter would otherwise turn an oversized chart or table into plain text.
|
|
354
|
+
|
|
355
|
+
| Element | Limit per card |
|
|
356
|
+
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
357
|
+
| Table | 1 table, up to 100 rows, 20 columns, and 10,000 characters of cell text |
|
|
358
|
+
| Fields | 10 `Field` elements per `Fields` group |
|
|
359
|
+
| Chart | 2 charts, each with up to 20 points and 12 series. Titles and axis labels up to 50 characters. Category and series names up to 20 characters and unique |
|
|
360
|
+
|
|
361
|
+
### Not supported yet
|
|
362
|
+
|
|
363
|
+
- Interactive `Button` elements. Cards can only link out with `LinkButton`.
|
|
364
|
+
- Streaming cards. A card is posted once, after the agent calls `render_card`.
|
|
365
|
+
- Adapters other than Slack. `generativeUI` is ignored on them.
|
|
311
366
|
|
|
312
367
|
## Custom typing status
|
|
313
368
|
|
|
@@ -341,6 +396,23 @@ const agent = new Agent({
|
|
|
341
396
|
})
|
|
342
397
|
```
|
|
343
398
|
|
|
399
|
+
With [Mastra Connect](https://mastra.ai/integrations/channels/slack), pass the function in the Slack provider options:
|
|
400
|
+
|
|
401
|
+
```typescript
|
|
402
|
+
import type { TypingStatusFn } from '@mastra/core/channels'
|
|
403
|
+
|
|
404
|
+
const typingStatus: TypingStatusFn = (chunk, ctx) => {
|
|
405
|
+
// ...
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export const mastra = new Mastra({
|
|
409
|
+
// ...
|
|
410
|
+
channels: await channels({
|
|
411
|
+
providers: { slack: { providerOptions: { typingStatus } } },
|
|
412
|
+
}),
|
|
413
|
+
})
|
|
414
|
+
```
|
|
415
|
+
|
|
344
416
|
## Handlers
|
|
345
417
|
|
|
346
418
|
Override built-in event handlers. Each handler can be:
|
|
@@ -374,6 +446,23 @@ const agent = new Agent({
|
|
|
374
446
|
})
|
|
375
447
|
```
|
|
376
448
|
|
|
449
|
+
With [Mastra Connect](https://mastra.ai/integrations/channels/slack), pass `handlers` in the Slack provider options instead. They apply to every agent connected to Slack:
|
|
450
|
+
|
|
451
|
+
```typescript
|
|
452
|
+
import type { ChannelHandlers } from '@mastra/core/channels'
|
|
453
|
+
|
|
454
|
+
const handlers: ChannelHandlers = {
|
|
455
|
+
// ...
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export const mastra = new Mastra({
|
|
459
|
+
// ...
|
|
460
|
+
channels: await channels({
|
|
461
|
+
providers: { slack: { providerOptions: { handlers } } },
|
|
462
|
+
}),
|
|
463
|
+
})
|
|
464
|
+
```
|
|
465
|
+
|
|
377
466
|
**onDirectMessage** (`ChannelHandler | false`): Called when the bot receives a direct message.
|
|
378
467
|
|
|
379
468
|
**onMention** (`ChannelHandler | false`): Called when the bot is @mentioned in a channel or thread.
|
|
@@ -605,10 +694,10 @@ import { Agent } from '@mastra/core/agent'
|
|
|
605
694
|
import { createChannelTools } from '@mastra/core/channels'
|
|
606
695
|
import { createSlackAdapter } from '@chat-adapter/slack'
|
|
607
696
|
|
|
608
|
-
|
|
609
|
-
id: '
|
|
610
|
-
name: '
|
|
611
|
-
instructions: 'You are a helpful
|
|
697
|
+
const agent = new Agent({
|
|
698
|
+
id: 'channel-tools-agent',
|
|
699
|
+
name: 'Channel Tools Agent',
|
|
700
|
+
instructions: 'You are a helpful assistant.',
|
|
612
701
|
model: 'openai/gpt-6.1-sol',
|
|
613
702
|
tools: {
|
|
614
703
|
...(await createChannelTools({ channels: 'selected', channelIds: ['slack:C0123ABC'] })),
|
|
@@ -53,7 +53,7 @@ const agent = new Agent({
|
|
|
53
53
|
name: 'Support agent',
|
|
54
54
|
instructions: 'Help customers with their orders.',
|
|
55
55
|
model: 'openai/gpt-6.1-sol',
|
|
56
|
-
durable: { executionEngine: 'default' },
|
|
56
|
+
durable: { executionEngine: 'default', maxSteps: 8, storageVersion: 2 },
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
const output: AgentStreamOutput = await agent.stream('Where is my order?')
|
|
@@ -63,11 +63,17 @@ output.cleanup?.()
|
|
|
63
63
|
|
|
64
64
|
Both engines checkpoint each step. Use `'default'` to run on the default in-process engine, `'evented'` to run on workers over pubsub, or `false` for the plain agent loop, which doesn't checkpoint. Evented execution falls back to in-process durable execution when the agent has no Mastra host, or when the host's workflows store doesn't support concurrent updates. A host with no workflows store keeps evented execution.
|
|
65
65
|
|
|
66
|
-
Set `Mastra.durable.executionEngine` to provide a default for agents registered through `agents` or `addAgent()`. An agent's explicit setting takes precedence. The engine selection is fixed
|
|
66
|
+
Set `Mastra.durable.executionEngine` to provide a default for agents registered through `agents` or `addAgent()`. An agent's explicit setting takes precedence. The native engine selection is fixed for the lifetime of the agent instance once it registers or first executes. Editor forks keep that selection. A wrapper factory chooses the engine for calls made through the wrapper without changing the underlying agent's selection.
|
|
67
67
|
|
|
68
|
-
Native `stream()` and `resumeStream()` return `MastraModelOutput`. When durable execution is selected, the output also carries `abort()`, `cleanup()`, `threadId`, and `resourceId`.
|
|
68
|
+
Native `stream()` and `resumeStream()` return `MastraModelOutput`. When durable execution is selected, the output also carries `abort()`, `cleanup()`, `threadId`, and `resourceId`. Use `AgentStreamOutput` to access those optional fields. The public signatures for `stream()`, `resumeStream()`, and the tool approval and decline helpers remain typed as `MastraModelOutput`. `getFullOutput()` returns the usual `FullOutput`, without those lifecycle controls. `generate()` keeps its usual result shape. The wrapper factories keep returning `DurableAgentStreamResult`, whose model output is in `.output`.
|
|
69
69
|
|
|
70
|
-
`durable: true` enables resumable-stream publication and inherits any Mastra execution default. `durable: false` opts out of both publication and inherited execution defaults. Without a Mastra execution default, neither boolean form enables checkpoint execution. Set `executionEngine` explicitly to select an execution backend.
|
|
70
|
+
`durable: true` enables resumable-stream publication and inherits any Mastra execution default. `durable: false` opts out of both publication and inherited execution defaults. Without a Mastra execution default, neither boolean form enables checkpoint execution. Set `executionEngine` explicitly to select an execution backend.
|
|
71
|
+
|
|
72
|
+
- `durable.maxSteps` sets the agent's durable step limit. A call's `maxSteps` takes precedence over `defaultOptions.maxSteps`, which takes precedence over `durable.maxSteps`. If none is set, the limit is five steps.
|
|
73
|
+
- `durable.storageVersion` is experimental and defaults to `1`, which saves a full snapshot. Version `2` saves only what changed using the run journal. On a workflow store without journal support, Mastra logs a warning and starts new runs on version `1`. Existing runs keep the version they started with.
|
|
74
|
+
- `durable.shouldPersistSnapshot` controls [which checkpoints are saved](https://mastra.ai/docs/harness/durable-agents). Set `recovery.durableAgents: 'auto'` on `Mastra` to save running checkpoints under the default policy and recover orphaned runs on restart.
|
|
75
|
+
|
|
76
|
+
Before switching engines, stop accepting new runs and let existing runs finish on their original engine. Resolve suspended runs there too. Don't rely on the new engine to resume or recover runs started by the old one.
|
|
71
77
|
|
|
72
78
|
## `createDurableAgent(options)`
|
|
73
79
|
|
|
@@ -105,6 +111,8 @@ Returns: `DurableAgent`
|
|
|
105
111
|
|
|
106
112
|
Wraps an `Agent` with fire-and-forget durable execution on the built-in evented workflow engine. Like `createDurableAgent`, it returns a result you stream from, but the run is started without being awaited: events on the Mastra instance's PubSub drive execution independently of the caller. Register the agent on a `Mastra` instance with storage to get evented execution; without one, the agent falls back to the default in-process engine and logs a warning. It doesn't accept `id` or `name` overrides.
|
|
107
113
|
|
|
114
|
+
An evented agent runs in one process on any PubSub backend. Running its steps on several processes needs a backend that redelivers unacknowledged events and a storage adapter with workflow step guards. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
115
|
+
|
|
108
116
|
```typescript
|
|
109
117
|
import { createEventedAgent } from '@mastra/core/agent/durable'
|
|
110
118
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# MastraAuthClerk class
|
|
6
6
|
|
|
7
|
-
The `MastraAuthClerk` class
|
|
7
|
+
The `MastraAuthClerk` class verifies Clerk-issued JWT tokens and supports Studio single sign-on (SSO) through OAuth with encrypted session cookies. Use `server.auth` for API authentication or `studio.auth` for separate Studio authentication. See [Clerk Studio SSO](https://mastra.ai/integrations/auth/clerk) for setup instructions.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -49,12 +49,32 @@ The authenticated user's `id` is the token's `id` claim, or its `sub` claim when
|
|
|
49
49
|
|
|
50
50
|
## Constructor parameters
|
|
51
51
|
|
|
52
|
+
`publishableKey`, `secretKey`, and `jwksUri` must each be supplied either as a constructor option or through the corresponding environment variable. They're optional as arguments, not as credentials. Construction throws if any of the three is missing. Studio SSO additionally requires both `oauthClientId` and `oauthClientSecret`.
|
|
53
|
+
|
|
52
54
|
**publishableKey** (`string`): Your Clerk publishable key. Can be found in your Clerk Dashboard under API Keys. (Default: `process.env.CLERK_PUBLISHABLE_KEY`)
|
|
53
55
|
|
|
54
56
|
**secretKey** (`string`): Your Clerk secret key. Used for server-side authentication and token verification. (Default: `process.env.CLERK_SECRET_KEY`)
|
|
55
57
|
|
|
56
58
|
**jwksUri** (`string`): The JWKS URI from your Clerk application. Used to verify JWT signatures. (Default: `process.env.CLERK_JWKS_URI`)
|
|
57
59
|
|
|
60
|
+
**oauthClientId** (`string`): Clerk OAuth application client ID. Required together with oauthClientSecret to enable Studio SSO. (Default: `process.env.CLERK_OAUTH_CLIENT_ID`)
|
|
61
|
+
|
|
62
|
+
**oauthClientSecret** (`string`): Clerk OAuth application client secret. Required together with oauthClientId to enable Studio SSO. (Default: `process.env.CLERK_OAUTH_CLIENT_SECRET`)
|
|
63
|
+
|
|
64
|
+
**redirectUri** (`string`): Fallback OAuth callback URI when getLoginUrl is called without a redirect URI. The Mastra SSO route supplies its callback URI, which must be registered with Clerk. (Default: `process.env.CLERK_OAUTH_REDIRECT_URI`)
|
|
65
|
+
|
|
66
|
+
**scopes** (`string[]`): OAuth scopes requested during SSO login. (Default: `['openid', 'profile', 'email']`)
|
|
67
|
+
|
|
68
|
+
**session** (`MastraAuthClerkSessionOptions`): Encrypted session cookie configuration for Studio SSO.
|
|
69
|
+
|
|
70
|
+
**session.cookieName** (`string`): Name of the session cookie.
|
|
71
|
+
|
|
72
|
+
**session.cookieMaxAge** (`number`): Session cookie lifetime in seconds.
|
|
73
|
+
|
|
74
|
+
**session.cookiePassword** (`string`): Password for encrypting sessions and signing OAuth state. Must be at least 32 characters when SSO is enabled. If omitted, a generated password is used and sessions do not survive restarts. Use the same password across replicas.
|
|
75
|
+
|
|
76
|
+
**session.secureCookies** (`boolean`): Set the Secure flag on session cookies.
|
|
77
|
+
|
|
58
78
|
**organizationId** (`string`): Restrict login to members of a single Clerk organization, identified by its ID. Users who are not members of this organization are denied access. (Default: `process.env.CLERK_ORGANIZATION_ID`)
|
|
59
79
|
|
|
60
80
|
**organizationSlug** (`string`): Restrict login to members of a single Clerk organization, identified by its slug. Users who are not members of this organization are denied access. (Default: `process.env.CLERK_ORGANIZATION_SLUG`)
|
|
@@ -30,7 +30,9 @@ console.log(result.output)
|
|
|
30
30
|
console.log(scores)
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Each call executes the item
|
|
33
|
+
Each call executes the item once, retrying up to `maxRetries` times when you pass it, and you pass run options such as `agentModel` or `itemTimeout` on every call because the experiment record doesn't store them.
|
|
34
|
+
|
|
35
|
+
Calling it on a target-less experiment throws `EXPERIMENT_HAS_NO_TARGET`. Use [`submitExperimentResult()`](https://mastra.ai/reference/datasets/submitExperimentResult) for those. Calls after finalization throw `EXPERIMENT_ALREADY_FINALIZED`, and an `itemId` that isn't visible at the pinned dataset version throws `DATASET_ITEM_NOT_FOUND`.
|
|
34
36
|
|
|
35
37
|
## Parameters
|
|
36
38
|
|
|
@@ -42,6 +44,16 @@ Each call executes the item exactly once, with no internal retry loop. Calling i
|
|
|
42
44
|
|
|
43
45
|
**requestContext** (`Record<string, unknown>`): Request context merged with the item's own request context (item values win).
|
|
44
46
|
|
|
47
|
+
**agentModel** (`string | object`): Model to run an agent target with, instead of the agent's own model. Accepts the same values as agentModel in \`startExperiment()\`. Throws for non-agent targets.
|
|
48
|
+
|
|
49
|
+
**itemTimeout** (`number`): Timeout in milliseconds for the item, covering every retry. A timed-out item records an error and isn't retried.
|
|
50
|
+
|
|
51
|
+
**maxRetries** (`number`): Retries after a failed execution. Defaults to 0. Uses exponential backoff. Aborts, timeouts, and tool mock errors aren't retried. The result row records retryCount.
|
|
52
|
+
|
|
53
|
+
**unmockedToolPolicy** (`'allow' | 'deny'`): Handling for agent tool calls that the item's toolMocks don't declare. Defaults to 'allow'. The item's own unmockedToolPolicy wins.
|
|
54
|
+
|
|
55
|
+
**versions** (`VersionOverrides`): Version overrides for sub-agents the target delegates to.
|
|
56
|
+
|
|
45
57
|
## Returns
|
|
46
58
|
|
|
47
59
|
**result** (`Promise<object>`): The persisted result and its scores.
|
|
@@ -34,7 +34,9 @@ console.log(`Current status: ${experiment.status}`)
|
|
|
34
34
|
|
|
35
35
|
## Parameters
|
|
36
36
|
|
|
37
|
-
Takes the same `StartExperimentConfig` as [`dataset.startExperiment()`](https://mastra.ai/reference/datasets/startExperiment)
|
|
37
|
+
Takes the same `StartExperimentConfig` as [`dataset.startExperiment()`](https://mastra.ai/reference/datasets/startExperiment), plus `durable`.
|
|
38
|
+
|
|
39
|
+
**durable** (`boolean`): Runs the experiment as an evented workflow with one step per item, so a stopped process doesn't leave it running. Needs workers and a pubsub that redelivers events, such as Redis Streams. Only serializable options are allowed: other options throw EXPERIMENT_NOT_DURABLE before anything is created. See Durable experiments.
|
|
38
40
|
|
|
39
41
|
When `persistence.experiments` is set to `'none'`, `startExperimentAsync()` doesn't persist an experiment record, progress updates, or item results. Score persistence remains controlled separately by `persistence.scores`. Without an experiment event observer, the run is fire-and-forget, and the experiment API can't report whether it completed or failed.
|
|
40
42
|
|
|
@@ -178,7 +178,7 @@ All namespaces extend a shared CRUD base class, so they expose the same `create`
|
|
|
178
178
|
|
|
179
179
|
### Agent namespace examples
|
|
180
180
|
|
|
181
|
-
Create a stored override for an existing code-defined agent:
|
|
181
|
+
Create a stored override for an existing code-defined agent. Use the code agent's `id`. The `name`, `instructions`, and `model` fields are required, so pass them even when they match the code agent:
|
|
182
182
|
|
|
183
183
|
```typescript
|
|
184
184
|
import { mastra } from '../mastra'
|
|
@@ -187,7 +187,9 @@ const editor = mastra.getEditor()!
|
|
|
187
187
|
|
|
188
188
|
await editor.agent.create({
|
|
189
189
|
id: 'support-agent',
|
|
190
|
+
name: 'Support agent',
|
|
190
191
|
instructions: 'You are a friendly support agent for Acme.',
|
|
192
|
+
model: { provider: 'openai', name: 'gpt-5.6' },
|
|
191
193
|
tools: {
|
|
192
194
|
search_kb: { description: 'Search the Acme knowledge base' },
|
|
193
195
|
},
|
|
@@ -42,7 +42,7 @@ export const knowledge = new Knowledge({
|
|
|
42
42
|
|
|
43
43
|
**storage** (`MastraCompositeStore`): Storage adapter. Without it, Knowledge uses the storage of the Mastra instance it is registered on.
|
|
44
44
|
|
|
45
|
-
**tools** (`boolean | { read?: boolean | { maxTokens?: number }; write?: boolean }`): Tools an attached agent gets. true gives all
|
|
45
|
+
**tools** (`boolean | { read?: boolean | { maxTokens?: number }; write?: boolean }`): Tools an attached agent gets. true gives all six: knowledge_list, knowledge_search, knowledge_read, knowledge_activity, knowledge_page and knowledge_note. { read: true } gives the first four. { write: true } gives the last two. { read: { maxTokens } } turns on read and caps each knowledge_read body or match result, each knowledge_list result, and each knowledge_activity result, at maxTokens: 1,000 by default, at least 100. See Read pages. (Default: `false`)
|
|
46
46
|
|
|
47
47
|
**pinnedContext** (`boolean | { maxPins?: number; maxTokens?: number }`): Pinned pages delivered to an attached agent every turn, plus the knowledge_pin tool. Needs Memory. maxPins defaults to 20 and maxTokens to 500, with no maximum. See Pinned context. (Default: `false`)
|
|
48
48
|
|
|
@@ -77,7 +77,7 @@ Returns the Knowledge tools for explicit wiring, such as an agent that isn't att
|
|
|
77
77
|
|
|
78
78
|
```typescript
|
|
79
79
|
const tools = knowledge.createTools({ write: false })
|
|
80
|
-
// knowledge_list, knowledge_search, knowledge_read
|
|
80
|
+
// knowledge_list, knowledge_search, knowledge_read, knowledge_activity
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
`principals` fixes the scope addresses every call acts as, for a host that runs the tools outside an agent run, such as an MCP server acting for an external agent. Each address must match a declared scope type, the store's declarations included. A call made with one that doesn't is refused. `createTools()` throws only for an empty list. The call's own run scopes are then ignored, and access follows the scope rules for these principals. Set them from the host's own authentication, never from the request. `author` is recorded on writes made through these tools.
|
|
@@ -94,13 +94,13 @@ const tools = knowledge.createTools({
|
|
|
94
94
|
#### `getPinnedContext()`
|
|
95
95
|
|
|
96
96
|
```typescript
|
|
97
|
-
getPinnedContext(options: { principals: readonly string[] }): Promise<KnowledgePinnedEntry[]>
|
|
97
|
+
getPinnedContext(options: { principals: readonly string[]; read?: boolean }): Promise<KnowledgePinnedEntry[]>
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
Returns the pinned pages a caller holding `principals` receives, rendered as an agent run receives them: only pages it can read, within the instance's pin budget. Use it beside `createTools({ principals })` when a host serves Knowledge outside an agent run. Throws for an empty list or an undeclared principal.
|
|
100
|
+
Returns the pinned pages a caller holding `principals` receives, rendered as an agent run receives them: only pages it can read, within the instance's pin budget. Use it beside `createTools({ principals })` when a host serves Knowledge outside an agent run, and pass the same `read` as that call (default: the instance's `tools.read`) so entries point at `knowledge_read` and `knowledge_list` only when the caller has them. Throws for an empty list or an undeclared principal.
|
|
101
101
|
|
|
102
102
|
```typescript
|
|
103
|
-
const pins = await knowledge.getPinnedContext({ principals: ['agent:claude-code'] })
|
|
103
|
+
const pins = await knowledge.getPinnedContext({ principals: ['agent:claude-code'], read: true })
|
|
104
104
|
// [{ id, text, name, scope }]
|
|
105
105
|
```
|
|
106
106
|
|
|
@@ -209,11 +209,18 @@ Creates or updates the page at `path` (keys joined by `/`, such as `guides/insta
|
|
|
209
209
|
#### `removePage()`
|
|
210
210
|
|
|
211
211
|
```typescript
|
|
212
|
-
removePage(input: {
|
|
212
|
+
removePage(input: {
|
|
213
|
+
scope: string
|
|
214
|
+
path: string
|
|
215
|
+
author?: string
|
|
216
|
+
expected?: { id: string; version: number }
|
|
217
|
+
}): Promise<KnowledgePage | null>
|
|
213
218
|
```
|
|
214
219
|
|
|
215
220
|
Removes the page at `path` and resolves to it, or to `null` when no page is there. Throws `"<scope>#<path>" has child pages; remove them first.` for a page with children, and `"<scope>#<path>" is declared in config; change the scope's pages to remove it.` for a template page. Throws without retrying when another write changed the page first.
|
|
216
221
|
|
|
222
|
+
Pass `expected`, the page's `id` and `version` as you read it, to remove only that page. If the page at `path` is a different page or another version, or nothing is there, the call throws `KnowledgeConflictError` and removes nothing. The same applies when another write changes or removes the page during the call.
|
|
223
|
+
|
|
217
224
|
#### `movePage()`
|
|
218
225
|
|
|
219
226
|
```typescript
|