@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_deep_equal = require("./deep-equal-TMDmByBC.cjs");
|
|
2
|
-
const require_filesystem_versioned = require("./filesystem-versioned-
|
|
2
|
+
const require_filesystem_versioned = require("./filesystem-versioned-BavRtYWJ.cjs");
|
|
3
3
|
// src/storage/domains/skills/base.ts
|
|
4
4
|
var SkillsStorage = class extends require_filesystem_versioned.VersionedStorageDomain {
|
|
5
5
|
listKey = "skills";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as deepEqual } from "./deep-equal-d1xU02ag.js";
|
|
2
|
-
import { f as calculatePagination, m as normalizePerPage, o as VersionedStorageDomain, t as FilesystemVersionedHelpers } from "./filesystem-versioned-
|
|
2
|
+
import { f as calculatePagination, m as normalizePerPage, o as VersionedStorageDomain, t as FilesystemVersionedHelpers } from "./filesystem-versioned-BL1ojJLo.js";
|
|
3
3
|
// src/storage/domains/skills/base.ts
|
|
4
4
|
var SkillsStorage = class extends VersionedStorageDomain {
|
|
5
5
|
listKey = "skills";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_deep_equal = require("./deep-equal-TMDmByBC.cjs");
|
|
2
|
-
const require_filesystem_versioned = require("./filesystem-versioned-
|
|
2
|
+
const require_filesystem_versioned = require("./filesystem-versioned-BavRtYWJ.cjs");
|
|
3
3
|
// src/storage/domains/scorer-definitions/base.ts
|
|
4
4
|
var ScorerDefinitionsStorage = class extends require_filesystem_versioned.VersionedStorageDomain {
|
|
5
5
|
listKey = "scorerDefinitions";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as deepEqual } from "./deep-equal-d1xU02ag.js";
|
|
2
|
-
import { f as calculatePagination, m as normalizePerPage, o as VersionedStorageDomain, t as FilesystemVersionedHelpers } from "./filesystem-versioned-
|
|
2
|
+
import { f as calculatePagination, m as normalizePerPage, o as VersionedStorageDomain, t as FilesystemVersionedHelpers } from "./filesystem-versioned-BL1ojJLo.js";
|
|
3
3
|
// src/storage/domains/workspaces/base.ts
|
|
4
4
|
var WorkspacesStorage = class extends VersionedStorageDomain {
|
|
5
5
|
listKey = "workspaces";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as deepEqual } from "./deep-equal-d1xU02ag.js";
|
|
2
|
-
import { f as calculatePagination, m as normalizePerPage, o as VersionedStorageDomain, t as FilesystemVersionedHelpers } from "./filesystem-versioned-
|
|
2
|
+
import { f as calculatePagination, m as normalizePerPage, o as VersionedStorageDomain, t as FilesystemVersionedHelpers } from "./filesystem-versioned-BL1ojJLo.js";
|
|
3
3
|
// src/storage/domains/prompt-blocks/base.ts
|
|
4
4
|
var PromptBlocksStorage = class extends VersionedStorageDomain {
|
|
5
5
|
listKey = "promptBlocks";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_deep_equal = require("./deep-equal-TMDmByBC.cjs");
|
|
2
|
-
const require_filesystem_versioned = require("./filesystem-versioned-
|
|
2
|
+
const require_filesystem_versioned = require("./filesystem-versioned-BavRtYWJ.cjs");
|
|
3
3
|
// src/storage/domains/prompt-blocks/base.ts
|
|
4
4
|
var PromptBlocksStorage = class extends require_filesystem_versioned.VersionedStorageDomain {
|
|
5
5
|
listKey = "promptBlocks";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as deepEqual } from "./deep-equal-d1xU02ag.js";
|
|
2
|
-
import { f as calculatePagination, m as normalizePerPage, o as VersionedStorageDomain, t as FilesystemVersionedHelpers } from "./filesystem-versioned-
|
|
2
|
+
import { f as calculatePagination, m as normalizePerPage, o as VersionedStorageDomain, t as FilesystemVersionedHelpers } from "./filesystem-versioned-BL1ojJLo.js";
|
|
3
3
|
// src/storage/domains/mcp-servers/base.ts
|
|
4
4
|
var MCPServersStorage = class extends VersionedStorageDomain {
|
|
5
5
|
listKey = "mcpServers";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_deep_equal = require("./deep-equal-TMDmByBC.cjs");
|
|
2
|
-
const require_filesystem_versioned = require("./filesystem-versioned-
|
|
2
|
+
const require_filesystem_versioned = require("./filesystem-versioned-BavRtYWJ.cjs");
|
|
3
3
|
// src/storage/domains/mcp-clients/base.ts
|
|
4
4
|
var MCPClientsStorage = class extends require_filesystem_versioned.VersionedStorageDomain {
|
|
5
5
|
listKey = "mcpClients";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_deep_equal = require("./deep-equal-TMDmByBC.cjs");
|
|
2
|
-
const require_filesystem_versioned = require("./filesystem-versioned-
|
|
2
|
+
const require_filesystem_versioned = require("./filesystem-versioned-BavRtYWJ.cjs");
|
|
3
3
|
// src/storage/domains/workspaces/base.ts
|
|
4
4
|
var WorkspacesStorage = class extends require_filesystem_versioned.VersionedStorageDomain {
|
|
5
5
|
listKey = "workspaces";
|
|
@@ -335,7 +335,7 @@ var MastraCompositeStore = class extends MastraBase {
|
|
|
335
335
|
if (!knowledge) return;
|
|
336
336
|
let initialization = knowledgeInitializations.get(knowledge);
|
|
337
337
|
if (!initialization) {
|
|
338
|
-
initialization = Promise.resolve().then(() => this.init()).then(() => knowledge.init()).catch((error) => {
|
|
338
|
+
initialization = Promise.resolve().then(() => this.init()).then(() => knowledge.init()).then(() => knowledge.importers?.init()).catch((error) => {
|
|
339
339
|
knowledgeInitializations.delete(knowledge);
|
|
340
340
|
throw error;
|
|
341
341
|
});
|
|
@@ -335,7 +335,7 @@ var MastraCompositeStore = class extends require_base.MastraBase {
|
|
|
335
335
|
if (!knowledge) return;
|
|
336
336
|
let initialization = knowledgeInitializations.get(knowledge);
|
|
337
337
|
if (!initialization) {
|
|
338
|
-
initialization = Promise.resolve().then(() => this.init()).then(() => knowledge.init()).catch((error) => {
|
|
338
|
+
initialization = Promise.resolve().then(() => this.init()).then(() => knowledge.init()).then(() => knowledge.importers?.init()).catch((error) => {
|
|
339
339
|
knowledgeInitializations.delete(knowledge);
|
|
340
340
|
throw error;
|
|
341
341
|
});
|
package/dist/harness/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_state_processor = require("../state-processor-kRNZ38Nf.cjs");
|
|
3
3
|
const require_tools = require("../tools-CGF5Ik6j.cjs");
|
|
4
|
-
const require_agent_controller = require("../agent-controller-
|
|
4
|
+
const require_agent_controller = require("../agent-controller-CrQ9OF80.cjs");
|
|
5
5
|
// src/harness/index.ts
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Backwards-compatibility entrypoint.
|
package/dist/harness/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { f as taskCheckTool, h as taskWriteTool, m as taskUpdateTool, o as assignTaskIds, p as taskCompleteTool } from "../state-processor-B9kxpM53.js";
|
|
2
2
|
import { s as askUserTool, t as submitPlanTool } from "../tools-CDfyMpzN.js";
|
|
3
|
-
import { a as Session, c as defaultDisplayState, l as defaultOMProgressState, n as parseSubagentMeta, t as AgentController } from "../agent-controller-
|
|
3
|
+
import { a as Session, c as defaultDisplayState, l as defaultOMProgressState, n as parseSubagentMeta, t as AgentController } from "../agent-controller-SSlKzE6A.js";
|
|
4
4
|
// src/harness/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Backwards-compatibility entrypoint.
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Mastra } from "./mastra-
|
|
1
|
+
export { t as Mastra } from "./mastra-CigBrT7X.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MastraCompositeStore } from '../storage/index.js';
|
|
2
2
|
import type { MastraEmbeddingModel, MastraEmbeddingOptions, MastraVector } from '../vector/index.js';
|
|
3
3
|
import type { KnowledgeScopeDeclarations } from './declarations.js';
|
|
4
|
+
import type { KnowledgeImporterBase } from './importers/index.js';
|
|
4
5
|
import type { KnowledgeInstructionsOption } from './instructions.js';
|
|
5
6
|
/** @experimental Knowledge APIs are experimental and may change without notice. */
|
|
6
7
|
export interface KnowledgeConfig {
|
|
@@ -51,5 +52,14 @@ export interface KnowledgeConfig {
|
|
|
51
52
|
};
|
|
52
53
|
/** Usage instructions added whenever Knowledge attaches tools. */
|
|
53
54
|
instructions?: KnowledgeInstructionsOption;
|
|
55
|
+
/**
|
|
56
|
+
* Importers this app runs against its own Knowledge storage: one instance per configured source,
|
|
57
|
+
* e.g. `[new HelpSpotImporter({ id: 'support', target: 'docs#support', settings, credentials })]`.
|
|
58
|
+
* Run one with `knowledge.importers.run(bindingId)`. Needs a storage adapter with importer
|
|
59
|
+
* support (PostgreSQL, LibSQL, in-memory).
|
|
60
|
+
*
|
|
61
|
+
* @experimental
|
|
62
|
+
*/
|
|
63
|
+
importers?: readonly KnowledgeImporterBase[];
|
|
54
64
|
}
|
|
55
65
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -47,6 +47,16 @@ export interface KnowledgeRemovePageInput {
|
|
|
47
47
|
scope: string;
|
|
48
48
|
path: string;
|
|
49
49
|
author?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The page as the caller read it, by id and version, as in {@link KnowledgeUpsertPageInput}. The
|
|
52
|
+
* call refuses unless `scope#path` holds that page at that version, and deletes it guarded by that
|
|
53
|
+
* version. If the page was edited, removed, or replaced by a new page at the same path, before or
|
|
54
|
+
* after the lookup, it throws `KnowledgeConflictError` and deletes nothing.
|
|
55
|
+
*/
|
|
56
|
+
expected?: {
|
|
57
|
+
id: string;
|
|
58
|
+
version: number;
|
|
59
|
+
};
|
|
50
60
|
}
|
|
51
61
|
/** @experimental */
|
|
52
62
|
export interface KnowledgeMovePageInput {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { KnowledgeImporterHost } from './host.js';
|
|
2
|
+
/**
|
|
3
|
+
* A host under test. Each case calls the factory for a fresh host whose `bindingId` exists, has no
|
|
4
|
+
* run going, and has never been flushed to.
|
|
5
|
+
* @experimental
|
|
6
|
+
*/
|
|
7
|
+
export interface KnowledgeImporterHostConformanceFixture {
|
|
8
|
+
host: KnowledgeImporterHost;
|
|
9
|
+
bindingId: string;
|
|
10
|
+
cleanup?: () => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
/** @experimental */
|
|
13
|
+
export interface KnowledgeImporterHostConformanceCase {
|
|
14
|
+
name: string;
|
|
15
|
+
run: () => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The protocol every {@link KnowledgeImporterHost} keeps, as framework-free cases: run each one as a
|
|
19
|
+
* test (`for (const c of importerHostConformance(factory)) it(c.name, c.run)`). A case throws when
|
|
20
|
+
* the host breaks the protocol. It checks only what the runner relies on (sequencing, digests,
|
|
21
|
+
* replay, generations, finish, heartbeat, state), not where pages land.
|
|
22
|
+
* @experimental
|
|
23
|
+
*/
|
|
24
|
+
export declare function importerHostConformance(factory: () => Promise<KnowledgeImporterHostConformanceFixture>): KnowledgeImporterHostConformanceCase[];
|
|
25
|
+
//# sourceMappingURL=conformance.d.ts.map
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { InferPublicSchema, PublicSchema } from '../../schema/index.js';
|
|
2
|
+
import type { KnowledgeImporterRunBinding } from './host.js';
|
|
3
|
+
import type { KnowledgeImporterManifest } from './manifest.js';
|
|
4
|
+
import type { KnowledgeImportDeclaration, KnowledgeImportItem } from './types.js';
|
|
5
|
+
/** @experimental */
|
|
6
|
+
export interface KnowledgeImporterCredentialSlot {
|
|
7
|
+
description: string;
|
|
8
|
+
/** Default true: the host never shows or logs the value. */
|
|
9
|
+
secret?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Buffered writes. They reach Knowledge in the next flush: when the buffer fills, when
|
|
13
|
+
* `state.set` is called, and when `import` returns. Await them, so a full buffer can flush.
|
|
14
|
+
*/
|
|
15
|
+
export interface KnowledgeImporterItems {
|
|
16
|
+
upsert(item: KnowledgeImportItem): Promise<void>;
|
|
17
|
+
declare(item: KnowledgeImportDeclaration): Promise<void>;
|
|
18
|
+
/** Only on a positive signal from the source (archived, trashed), never because an item was missing. */
|
|
19
|
+
remove(sourceId: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/** The importer's cursor store. Values are strings; keep them small. */
|
|
22
|
+
export interface KnowledgeImporterStateStore {
|
|
23
|
+
get(key: string): Promise<string | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Flushes the buffered items together with this value, so a saved cursor never covers items that
|
|
26
|
+
* didn't land. Refused once the run is canceled.
|
|
27
|
+
*/
|
|
28
|
+
set(key: string, value: string): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
/** @experimental */
|
|
31
|
+
export interface KnowledgeImporterContext<TSettings = unknown, TSlot extends string = string> {
|
|
32
|
+
/** Fires on cancel and at the hard deadline. Stop reading the source when it does. */
|
|
33
|
+
signal: AbortSignal;
|
|
34
|
+
binding: {
|
|
35
|
+
id: string;
|
|
36
|
+
target: string;
|
|
37
|
+
};
|
|
38
|
+
settings: TSettings;
|
|
39
|
+
/** Values for the definition's slots, supplied by the host at run start. */
|
|
40
|
+
credentials: Readonly<Record<TSlot, string>>;
|
|
41
|
+
/**
|
|
42
|
+
* The source fetch, bound to `signal`: the runner's `fetch` option, else the platform fetch. A
|
|
43
|
+
* signal passed in `init` is combined with `signal`, so either one aborts the fetch. It
|
|
44
|
+
* doesn't retry; on hosts that keep the credentials it may be a relay. A source's error status
|
|
45
|
+
* comes back as a response; throw `KnowledgeImporterSourceError` to fail the run with it.
|
|
46
|
+
*/
|
|
47
|
+
fetch: (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
48
|
+
state: KnowledgeImporterStateStore;
|
|
49
|
+
items: KnowledgeImporterItems;
|
|
50
|
+
/**
|
|
51
|
+
* This pass stopped at its own cap with more to read (its cursor is saved). The runner calls
|
|
52
|
+
* `import` again while the run has time, and the host may chain another run when it doesn't.
|
|
53
|
+
*/
|
|
54
|
+
reportBacklog(): void;
|
|
55
|
+
}
|
|
56
|
+
type SettingsOf<TSchema> = TSchema extends PublicSchema<any, any> ? InferPublicSchema<TSchema> : Record<string, never>;
|
|
57
|
+
/** The settings as a binding supplies them: the schema's input side, before defaults. */
|
|
58
|
+
type SettingsInputOf<TSchema> = TSchema extends {
|
|
59
|
+
_input: infer Input;
|
|
60
|
+
} ? Input : TSchema extends {
|
|
61
|
+
'~standard': {
|
|
62
|
+
types?: infer Types;
|
|
63
|
+
};
|
|
64
|
+
} ? NonNullable<Types> extends {
|
|
65
|
+
input: infer Input;
|
|
66
|
+
} ? Input : SettingsOf<TSchema> : SettingsOf<TSchema>;
|
|
67
|
+
/** What the class declares: `KnowledgeImporter({ ... })`. @experimental */
|
|
68
|
+
export interface KnowledgeImporterDefinitionInput<TSchema, TSlot extends string> {
|
|
69
|
+
/** Stable key: bindings and run history name the importer by it. Lowercase letters, digits, `-` and `_`. */
|
|
70
|
+
id: string;
|
|
71
|
+
label: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
/** An http(s) URL or a `data:image/` URI. */
|
|
74
|
+
iconUrl?: string;
|
|
75
|
+
settings?: TSchema;
|
|
76
|
+
credentials?: Record<TSlot, KnowledgeImporterCredentialSlot>;
|
|
77
|
+
}
|
|
78
|
+
/** The checked definition an importer class carries, read without constructing it. @experimental */
|
|
79
|
+
export interface KnowledgeImporterDefinition<TSettings = unknown, TSlot extends string = string> {
|
|
80
|
+
readonly id: string;
|
|
81
|
+
readonly label: string;
|
|
82
|
+
readonly description?: string;
|
|
83
|
+
readonly iconUrl?: string;
|
|
84
|
+
readonly credentials: Readonly<Record<TSlot, Required<KnowledgeImporterCredentialSlot>>>;
|
|
85
|
+
/** Validates a binding's settings against the definition's schema. */
|
|
86
|
+
parseSettings(value: unknown): Promise<TSettings>;
|
|
87
|
+
/** Checks a binding supplies exactly the declared slots, each a non-empty string. */
|
|
88
|
+
checkCredentials(values: Record<string, unknown> | undefined): Readonly<Record<TSlot, string>>;
|
|
89
|
+
toManifest(): KnowledgeImporterManifest;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* One configured source: where the importer writes and with what. Settings are checked against the
|
|
93
|
+
* schema when a run starts; credentials when the instance is constructed.
|
|
94
|
+
*
|
|
95
|
+
* @experimental
|
|
96
|
+
*/
|
|
97
|
+
export type KnowledgeImporterBindingInput<TInput = unknown, TSlot extends string = string> = {
|
|
98
|
+
/** Stable binding id: run history and page ownership key on it. Keep it when you edit the binding. */
|
|
99
|
+
id: string;
|
|
100
|
+
/** Where the pages go, `<scope>#<path>`. */
|
|
101
|
+
target: string;
|
|
102
|
+
} & ({} extends TInput ? {
|
|
103
|
+
settings?: TInput;
|
|
104
|
+
} : {
|
|
105
|
+
settings: TInput;
|
|
106
|
+
}) & ([TSlot] extends [never] ? {
|
|
107
|
+
credentials?: Record<string, never>;
|
|
108
|
+
} : {
|
|
109
|
+
credentials: Record<TSlot, string>;
|
|
110
|
+
});
|
|
111
|
+
/**
|
|
112
|
+
* The base every importer extends through {@link KnowledgeImporter}. An instance is one binding;
|
|
113
|
+
* `import` is called once per pass of a run.
|
|
114
|
+
*
|
|
115
|
+
* @experimental
|
|
116
|
+
*/
|
|
117
|
+
export declare abstract class KnowledgeImporterBase<TSettings = any, TSlot extends string = any, TInput = TSettings> {
|
|
118
|
+
/** What the instance was constructed with, as the host sees a binding. */
|
|
119
|
+
readonly binding: Readonly<KnowledgeImporterRunBinding>;
|
|
120
|
+
constructor(binding: KnowledgeImporterBindingInput<TInput, TSlot>);
|
|
121
|
+
/**
|
|
122
|
+
* Reads the source and writes items through `ctx.items`, saving a cursor with `ctx.state.set`.
|
|
123
|
+
* A full import and an incremental one are the same method: read the cursor, carry on from it.
|
|
124
|
+
*/
|
|
125
|
+
abstract import(ctx: KnowledgeImporterContext<TSettings, TSlot>): Promise<void>;
|
|
126
|
+
}
|
|
127
|
+
/** An importer class: what a host registers and constructs from a stored binding. @experimental */
|
|
128
|
+
export interface KnowledgeImporterClass<TSettings = any, TSlot extends string = any, TInput = any> {
|
|
129
|
+
new (binding: KnowledgeImporterBindingInput<TInput, TSlot>): KnowledgeImporterBase<TSettings, TSlot, TInput>;
|
|
130
|
+
readonly id: string;
|
|
131
|
+
readonly definition: KnowledgeImporterDefinition<TSettings, TSlot>;
|
|
132
|
+
toManifest(): KnowledgeImporterManifest;
|
|
133
|
+
}
|
|
134
|
+
/** A definition, a registry or a binding's settings or credentials are invalid. @experimental */
|
|
135
|
+
export declare class KnowledgeImporterDefinitionError extends Error {
|
|
136
|
+
constructor(message: string);
|
|
137
|
+
}
|
|
138
|
+
/** A binding's settings don't match the importer's schema (run error code `settings_invalid`). @experimental */
|
|
139
|
+
export declare class KnowledgeImporterSettingsError extends KnowledgeImporterDefinitionError {
|
|
140
|
+
readonly errors: {
|
|
141
|
+
path: string[];
|
|
142
|
+
message: string;
|
|
143
|
+
}[];
|
|
144
|
+
constructor(message: string, errors: {
|
|
145
|
+
path: string[];
|
|
146
|
+
message: string;
|
|
147
|
+
}[]);
|
|
148
|
+
}
|
|
149
|
+
/** A binding is missing a credential or supplies an undeclared one (run error code `credential_missing`). @experimental */
|
|
150
|
+
export declare class KnowledgeImporterCredentialsError extends KnowledgeImporterDefinitionError {
|
|
151
|
+
constructor(message: string);
|
|
152
|
+
}
|
|
153
|
+
/** The source answered with an error status. The runner maps the status to the run's error code. @experimental */
|
|
154
|
+
export declare class KnowledgeImporterSourceError extends Error {
|
|
155
|
+
readonly status: number;
|
|
156
|
+
constructor(message: string, status: number);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The host failed, not the source: a fetch proxy or relay, or a remote host's flush, heartbeat or
|
|
160
|
+
* finish. Never a sign an item is gone. `status` is the HTTP status when there was a response;
|
|
161
|
+
* absent for a network error. @experimental
|
|
162
|
+
*/
|
|
163
|
+
export declare class KnowledgeImporterHostError extends Error {
|
|
164
|
+
readonly status?: number | undefined;
|
|
165
|
+
constructor(message: string, status?: number | undefined);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The base class of an importer: code that reads a source and writes it into Knowledge as items.
|
|
169
|
+
* The class declares what it is (id, label, settings schema, credential slots); each instance is
|
|
170
|
+
* one binding (where it writes, with which settings and credentials).
|
|
171
|
+
*
|
|
172
|
+
* ```ts
|
|
173
|
+
* class HelpSpotImporter extends KnowledgeImporter({
|
|
174
|
+
* id: 'helpspot',
|
|
175
|
+
* label: 'HelpSpot',
|
|
176
|
+
* settings: z.object({ baseUrl: z.url() }),
|
|
177
|
+
* credentials: { apiKey: { description: 'HelpSpot API token' } },
|
|
178
|
+
* }) {
|
|
179
|
+
* async import(ctx) {
|
|
180
|
+
* // read ctx.state.get('cursor'), ctx.items.upsert(...), ctx.state.set('cursor', ...)
|
|
181
|
+
* }
|
|
182
|
+
* }
|
|
183
|
+
*
|
|
184
|
+
* new HelpSpotImporter({ id: 'support', target: 'docs#support', settings: { baseUrl }, credentials: { apiKey } });
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* Invalid declarations throw `KnowledgeImporterDefinitionError` here, not at the first run.
|
|
188
|
+
*
|
|
189
|
+
* @experimental
|
|
190
|
+
*/
|
|
191
|
+
export declare function KnowledgeImporter<TSchema extends PublicSchema<any, any> | undefined = undefined, TSlot extends string = never>(input: KnowledgeImporterDefinitionInput<TSchema, TSlot>): (abstract new (binding: KnowledgeImporterBindingInput<SettingsInputOf<TSchema>, TSlot>) => KnowledgeImporterBase<SettingsOf<TSchema>, TSlot, SettingsInputOf<TSchema>>) & {
|
|
192
|
+
readonly id: string;
|
|
193
|
+
readonly definition: KnowledgeImporterDefinition<SettingsOf<TSchema>, TSlot>;
|
|
194
|
+
toManifest(): KnowledgeImporterManifest;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Indexes importer classes by id, refusing two different classes with the same id. A host uses it
|
|
198
|
+
* to construct the instance a stored binding names.
|
|
199
|
+
*
|
|
200
|
+
* @experimental
|
|
201
|
+
*/
|
|
202
|
+
export declare function knowledgeImporterRegistry(importers: readonly KnowledgeImporterClass[]): ReadonlyMap<string, KnowledgeImporterClass>;
|
|
203
|
+
export {};
|
|
204
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { KnowledgeImporterFinishRequest, KnowledgeImporterFlush, KnowledgeImporterFlushReceipt, KnowledgeImporterOp, KnowledgeImporterRunReceipt, KnowledgeImporterState } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Run options from the host's trusted caller. A remote host may ignore them: its run ID, fire key
|
|
4
|
+
* and deadline come from the run it dispatched.
|
|
5
|
+
*/
|
|
6
|
+
export interface KnowledgeImporterStartRunOptions {
|
|
7
|
+
/** A caller-chosen run ID, e.g. the one a scheduler already recorded. */
|
|
8
|
+
runId?: string;
|
|
9
|
+
/** De-duplicates fires of one schedule tick, e.g. `${bindingId}:${scheduledAt}`. */
|
|
10
|
+
fireKey?: string;
|
|
11
|
+
/** Epoch ms after which the host refuses the run's flushes. */
|
|
12
|
+
deadline?: number;
|
|
13
|
+
}
|
|
14
|
+
export type KnowledgeImporterRunStart = {
|
|
15
|
+
status: 'started';
|
|
16
|
+
runId: string;
|
|
17
|
+
generation: number;
|
|
18
|
+
/** The state the last committed flush left. */
|
|
19
|
+
state: KnowledgeImporterState;
|
|
20
|
+
/** 0 before the first flush. */
|
|
21
|
+
lastSeq: number;
|
|
22
|
+
/**
|
|
23
|
+
* The binding as the host recorded it for this run. A remote host sends it because the app
|
|
24
|
+
* trusts only what the host returns here; the runner picks the importer from it.
|
|
25
|
+
*/
|
|
26
|
+
binding?: KnowledgeImporterRunBinding;
|
|
27
|
+
}
|
|
28
|
+
/** Another run of the binding is going; the host recorded this one as skipped. */
|
|
29
|
+
| {
|
|
30
|
+
status: 'skipped';
|
|
31
|
+
runId: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A run's binding as a host hands it over. The runner picks the definition by `importer`, checks
|
|
35
|
+
* `settings` with `parseSettings` (failure: `settings_invalid`) and `credentials` with
|
|
36
|
+
* `checkCredentials` (failure: `credential_missing`). Credential values are resolved by the host
|
|
37
|
+
* side in the app's own process; they never come from a remote server.
|
|
38
|
+
*/
|
|
39
|
+
export interface KnowledgeImporterRunBinding {
|
|
40
|
+
id: string;
|
|
41
|
+
/** The definition's id. */
|
|
42
|
+
importer: string;
|
|
43
|
+
/** `<scope>#<path>`. */
|
|
44
|
+
target: string;
|
|
45
|
+
settings: unknown;
|
|
46
|
+
credentials: Record<string, string>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The runner's only way to Knowledge. Core's local host applies flushes to the app's own storage;
|
|
50
|
+
* a remote host (hosted Knowledge) applies them on its server. Both must pass
|
|
51
|
+
* `importerHostConformance`.
|
|
52
|
+
*
|
|
53
|
+
* Rules every host keeps:
|
|
54
|
+
* - `flush` is all or nothing, and its `state` commits with its ops in one transaction.
|
|
55
|
+
* - A flush's seq is exactly the last committed seq + 1. The host recomputes the digest and refuses
|
|
56
|
+
* a mismatch before applying anything.
|
|
57
|
+
* - Flush replay identity is `(runId, generation, seq)`: the same digest returns the stored
|
|
58
|
+
* receipt and applies nothing; a different digest is refused.
|
|
59
|
+
* - `finishRun` needs `lastSeq` equal to the committed seq and is valid once. A replay whose
|
|
60
|
+
* normalized request (`normalizeKnowledgeImporterFinish`) equals the stored one returns the
|
|
61
|
+
* stored receipt; any other is refused, and the stored outcome doesn't change.
|
|
62
|
+
* - After a run ends (finished, canceled or expired) a new seq is refused, while an exact replay
|
|
63
|
+
* of a committed seq still returns its receipt.
|
|
64
|
+
* - Run counts are summed from flush receipts.
|
|
65
|
+
*
|
|
66
|
+
* Refusals throw `KnowledgeImporterHostConflictError`. Any other host failure throws
|
|
67
|
+
* `KnowledgeImporterHostError` with the HTTP status when there is one: the runner resends the same
|
|
68
|
+
* flush (same seq and digest) after a 5xx or a network error, and ends the run on any other.
|
|
69
|
+
*
|
|
70
|
+
* @experimental
|
|
71
|
+
*/
|
|
72
|
+
export interface KnowledgeImporterHost {
|
|
73
|
+
startRun(bindingId: string, options?: KnowledgeImporterStartRunOptions): Promise<KnowledgeImporterRunStart>;
|
|
74
|
+
flush(flush: KnowledgeImporterFlush): Promise<KnowledgeImporterFlushReceipt>;
|
|
75
|
+
/**
|
|
76
|
+
* Keeps the run alive; `cancel: true` tells the runner to stop without saving more state. A host
|
|
77
|
+
* that enforces a lease may instead refuse a heartbeat for a run it no longer holds, with
|
|
78
|
+
* `KnowledgeImporterHostConflictError` (`stale_generation` or `run_not_active`). The runner
|
|
79
|
+
* ignores a failed heartbeat; its next flush or finish gets the same refusal and ends the run.
|
|
80
|
+
*/
|
|
81
|
+
heartbeat(runId: string, generation: number): Promise<{
|
|
82
|
+
cancel: boolean;
|
|
83
|
+
}>;
|
|
84
|
+
finishRun(request: KnowledgeImporterFinishRequest): Promise<KnowledgeImporterRunReceipt>;
|
|
85
|
+
}
|
|
86
|
+
export type KnowledgeImporterHostConflictCode =
|
|
87
|
+
/** seq isn't the committed seq + 1, or finish's lastSeq isn't the committed seq. */
|
|
88
|
+
'seq_mismatch'
|
|
89
|
+
/** The digest doesn't match the flush's content, or a committed seq is replayed with other content. */
|
|
90
|
+
| 'digest_mismatch'
|
|
91
|
+
/** The run belongs to an older generation, or the binding's writer moved on. */
|
|
92
|
+
| 'stale_generation'
|
|
93
|
+
/** The run has ended, been canceled, expired or never started. */
|
|
94
|
+
| 'run_not_active'
|
|
95
|
+
/** A finish replay that differs from the recorded finish. */
|
|
96
|
+
| 'finish_mismatch';
|
|
97
|
+
/** A host refused a flush or a finish (409 over HTTP). Retrying the same request won't help. @experimental */
|
|
98
|
+
export declare class KnowledgeImporterHostConflictError extends Error {
|
|
99
|
+
readonly code: KnowledgeImporterHostConflictCode;
|
|
100
|
+
readonly status = 409;
|
|
101
|
+
constructor(code: KnowledgeImporterHostConflictCode, message: string);
|
|
102
|
+
}
|
|
103
|
+
export declare const KNOWLEDGE_IMPORTER_ERROR_CODES: readonly ["source_auth_failed", "source_unreachable", "source_rate_limited", "source_bad_response", "source_not_found", "settings_invalid", "credential_missing", "importer_missing_from_deploy", "importer_error", "stopped", "lease_expired", "deadline_exceeded"];
|
|
104
|
+
export type NormalizedKnowledgeImporterFinish = Omit<KnowledgeImporterRunReceipt, 'runId' | 'counts' | 'chain'>;
|
|
105
|
+
/**
|
|
106
|
+
* The finish request as a host stores and compares it: missing optional fields become null.
|
|
107
|
+
* Throws a TypeError for a request no host should accept.
|
|
108
|
+
*/
|
|
109
|
+
export declare function normalizeKnowledgeImporterFinish(request: KnowledgeImporterFinishRequest): NormalizedKnowledgeImporterFinish;
|
|
110
|
+
/**
|
|
111
|
+
* RFC 8785 (JCS) canonical JSON: object members sorted by UTF-16 code units, no whitespace, numbers
|
|
112
|
+
* and strings as ECMAScript serializes them. Members whose value is undefined are left out, as
|
|
113
|
+
* JSON.stringify leaves them out of what goes over the wire; array holes and undefined items are
|
|
114
|
+
* null, as JSON.stringify writes them. Strings with a lone UTF-16 surrogate are refused (RFC 8785
|
|
115
|
+
* §3.2.2.2).
|
|
116
|
+
*/
|
|
117
|
+
export declare function canonicalJson(value: unknown): string;
|
|
118
|
+
/**
|
|
119
|
+
* A flush's digest: lowercase hex SHA-256 of the canonical JSON of `{ ops, state }`, with an absent
|
|
120
|
+
* `state` as null. Runners send it; hosts recompute it from the body they received. The body is
|
|
121
|
+
* checked with `parseKnowledgeImporterFlushBody` first, so only payloads that survive a JSON round
|
|
122
|
+
* trip unchanged get a digest.
|
|
123
|
+
*/
|
|
124
|
+
export declare function knowledgeImporterFlushDigest(flush: {
|
|
125
|
+
ops: KnowledgeImporterOp[];
|
|
126
|
+
state?: KnowledgeImporterState;
|
|
127
|
+
}): Promise<string>;
|
|
128
|
+
/**
|
|
129
|
+
* Checks a flush body the way every host and runner must before hashing or applying it: known ops
|
|
130
|
+
* and fields only, strings where strings belong, no array holes, no lone surrogates, string-only
|
|
131
|
+
* state. Returns a copy with undefined optional fields left out, so what passes hashes the same
|
|
132
|
+
* before and after a JSON round trip. Throws a TypeError otherwise.
|
|
133
|
+
*
|
|
134
|
+
* @experimental
|
|
135
|
+
*/
|
|
136
|
+
export declare function parseKnowledgeImporterFlushBody(body: {
|
|
137
|
+
ops: unknown;
|
|
138
|
+
state?: unknown;
|
|
139
|
+
}): {
|
|
140
|
+
ops: KnowledgeImporterOp[];
|
|
141
|
+
state?: KnowledgeImporterState;
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type * from './types.js';
|
|
2
|
+
export type { KnowledgeImporterManifest } from './manifest.js';
|
|
3
|
+
export type { KnowledgeImporterHost, KnowledgeImporterHostConflictCode, KnowledgeImporterRunBinding, KnowledgeImporterRunStart, KnowledgeImporterStartRunOptions, NormalizedKnowledgeImporterFinish, } from './host.js';
|
|
4
|
+
export { KNOWLEDGE_IMPORTER_ERROR_CODES, KnowledgeImporterHostConflictError, canonicalJson, knowledgeImporterFlushDigest, normalizeKnowledgeImporterFinish, parseKnowledgeImporterFlushBody, } from './host.js';
|
|
5
|
+
export type { KnowledgeImporterBindingInput, KnowledgeImporterClass, KnowledgeImporterContext, KnowledgeImporterCredentialSlot, KnowledgeImporterDefinition, KnowledgeImporterDefinitionInput, KnowledgeImporterItems, KnowledgeImporterStateStore, } from './define.js';
|
|
6
|
+
export { KnowledgeImporter, KnowledgeImporterBase, KnowledgeImporterCredentialsError, KnowledgeImporterDefinitionError, KnowledgeImporterHostError, KnowledgeImporterSettingsError, KnowledgeImporterSourceError, knowledgeImporterRegistry, } from './define.js';
|
|
7
|
+
export type { RunKnowledgeImportOptions, RunKnowledgeImportResult } from './runner.js';
|
|
8
|
+
export { runKnowledgeImport } from './runner.js';
|
|
9
|
+
export { REMOVED_PARENT_BODY as KNOWLEDGE_IMPORT_REMOVED_PARENT_BODY, knowledgeImportKey } from './sink.js';
|
|
10
|
+
export type { KnowledgeImporterHostConformanceCase, KnowledgeImporterHostConformanceFixture } from './conformance.js';
|
|
11
|
+
export { importerHostConformance } from './conformance.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|