@mastra/core 1.88.0-alpha.0 → 1.88.0-alpha.2
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 +17 -1
- package/dist/agent/durable/index.cjs +1 -1
- package/dist/agent/durable/index.js +1 -1
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.js +2 -2
- 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/model-catalog-cache.d.ts +9 -5
- package/dist/agent-controller/session.d.ts +17 -0
- package/dist/{agent-controller-NQKYmY0W.cjs → agent-controller-Bt7DwpZy.cjs} +57 -53
- package/dist/{agent-controller-CQDCmsFD.js → agent-controller-CFNkjF3l.js} +57 -53
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-B7UygDdO.js → background-tasks-DJHuKMQC.js} +1 -1
- package/dist/{background-tasks-CeARf1DK.cjs → background-tasks-DbPzYpIZ.cjs} +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/{builder-Dmf04g9P.cjs → builder-961mB1xC.cjs} +2 -2
- package/dist/{builder-CpAEmMdR.js → builder-BD6HtwKv.js} +2 -2
- package/dist/capabilities/302ai.json +200 -200
- package/dist/capabilities/abliteratedllm.json +37 -37
- package/dist/capabilities/abliteration-ai.json +9 -9
- package/dist/capabilities/above.json +22 -22
- package/dist/capabilities/adaption.json +13 -13
- package/dist/capabilities/adzuki.json +22 -22
- package/dist/capabilities/agentrouter.json +10 -10
- package/dist/capabilities/agnes.json +3 -3
- package/dist/capabilities/ai-router.json +7 -7
- package/dist/capabilities/aiand.json +22 -23
- package/dist/capabilities/aigrow.json +14 -14
- package/dist/capabilities/aimlapi.json +149 -158
- package/dist/capabilities/aixy.json +28 -28
- package/dist/capabilities/aki-io.json +12 -12
- package/dist/capabilities/alibaba-cn.json +99 -99
- package/dist/capabilities/alibaba-coding-plan-cn.json +4 -4
- package/dist/capabilities/alibaba-coding-plan.json +4 -4
- package/dist/capabilities/alibaba-token-plan-cn.json +55 -55
- package/dist/capabilities/alibaba-token-plan.json +56 -56
- package/dist/capabilities/alibaba.json +77 -77
- package/dist/capabilities/ambient.json +7 -7
- package/dist/capabilities/amd-tokenlab.json +5 -5
- package/dist/capabilities/amd.json +6 -6
- package/dist/capabilities/anthropic.json +31 -31
- package/dist/capabilities/anyapi.json +47 -47
- package/dist/capabilities/apiko.json +5 -5
- package/dist/capabilities/arcee.json +4 -4
- package/dist/capabilities/augure.json +5 -5
- package/dist/capabilities/auriko.json +21 -21
- package/dist/capabilities/bailing.json +5 -5
- package/dist/capabilities/baseten.json +34 -34
- package/dist/capabilities/bee.json +2 -2
- package/dist/capabilities/bothub.json +15 -15
- package/dist/capabilities/boundless.json +39 -39
- package/dist/capabilities/bumo.json +38 -38
- package/dist/capabilities/byteplus.json +26 -26
- package/dist/capabilities/cheapaimodel.json +7 -7
- package/dist/capabilities/cheapest-token.json +32 -32
- package/dist/capabilities/chutes.json +33 -33
- package/dist/capabilities/cline-pass.json +37 -37
- package/dist/capabilities/cloudcode.json +8 -8
- package/dist/capabilities/cloudflare-ai-gateway.json +716 -0
- package/dist/capabilities/cloudflare-workers-ai.json +12 -12
- package/dist/capabilities/cohere.json +67 -0
- package/dist/capabilities/commandcode.json +146 -146
- package/dist/capabilities/concentrate.json +281 -281
- package/dist/capabilities/cortecs.json +103 -103
- package/dist/capabilities/crossmodel.json +190 -190
- package/dist/capabilities/crusoe.json +11 -11
- package/dist/capabilities/daoxe.json +9 -9
- package/dist/capabilities/databricks.json +133 -133
- package/dist/capabilities/deepinfra.json +96 -96
- package/dist/capabilities/deepseek.json +3 -3
- package/dist/capabilities/digitalocean.json +115 -115
- package/dist/capabilities/dothoosh.json +34 -34
- package/dist/capabilities/doubleword.json +30 -30
- package/dist/capabilities/edenai.json +288 -279
- package/dist/capabilities/empiriolabs.json +187 -178
- package/dist/capabilities/engy.json +22 -22
- package/dist/capabilities/entrim.json +6 -6
- package/dist/capabilities/evroc.json +15 -15
- package/dist/capabilities/ezkielyna.json +10 -10
- package/dist/capabilities/fastrouter.json +90 -90
- package/dist/capabilities/fireworks-ai.json +93 -82
- package/dist/capabilities/freemodel.json +8 -8
- package/dist/capabilities/friendli.json +8 -8
- package/dist/capabilities/frogbot.json +87 -87
- package/dist/capabilities/gisoo.json +18 -18
- package/dist/capabilities/gmicloud.json +16 -16
- package/dist/capabilities/google.json +59 -59
- package/dist/capabilities/graphn.json +10 -10
- package/dist/capabilities/greenpt.json +32 -32
- package/dist/capabilities/helicone.json +80 -80
- package/dist/capabilities/hetzner.json +5 -5
- package/dist/capabilities/hostinger-router.json +11 -11
- package/dist/capabilities/hpc-ai.json +8 -8
- package/dist/capabilities/huawei-maas.json +15 -15
- package/dist/capabilities/hubris.json +26 -26
- package/dist/capabilities/huggingface.json +93 -85
- package/dist/capabilities/hyper.json +23 -23
- package/dist/capabilities/impossibl.json +153 -153
- package/dist/capabilities/inceptron.json +8 -8
- package/dist/capabilities/inco.json +3 -3
- package/dist/capabilities/infer.json +16 -16
- package/dist/capabilities/inferall.json +6 -6
- package/dist/capabilities/inference-coop.json +15 -15
- package/dist/capabilities/inferenceapis.json +25 -25
- package/dist/capabilities/inferris.json +3 -3
- package/dist/capabilities/infersia.json +9 -9
- package/dist/capabilities/inferx.json +2 -2
- package/dist/capabilities/infomaniak.json +2 -2
- package/dist/capabilities/iteracompute.json +44 -44
- package/dist/capabilities/jalapeno.json +11 -11
- package/dist/capabilities/jiekou.json +31 -31
- package/dist/capabilities/joingonka.json +4 -4
- package/dist/capabilities/jzstoken.json +49 -49
- package/dist/capabilities/keln.json +23 -23
- package/dist/capabilities/kenari.json +125 -125
- package/dist/capabilities/kilo.json +667 -626
- package/dist/capabilities/kimchi.json +16 -16
- package/dist/capabilities/kimi-code-plan-cn.json +6 -6
- package/dist/capabilities/kimi-code-plan-global.json +6 -6
- package/dist/capabilities/kitani.json +6 -6
- package/dist/capabilities/klavo.json +26 -26
- package/dist/capabilities/korouter.json +34 -34
- package/dist/capabilities/kunavo.json +6 -6
- package/dist/capabilities/liquid.json +11 -11
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +933 -931
- package/dist/capabilities/llmgateway.json +350 -348
- package/dist/capabilities/llmtr.json +20 -20
- package/dist/capabilities/lowrouter.json +62 -62
- package/dist/capabilities/lyceum.json +13 -13
- package/dist/capabilities/melious.json +12 -12
- package/dist/capabilities/merge-gateway.json +296 -296
- package/dist/capabilities/meta.json +10 -10
- package/dist/capabilities/minimax-cn-coding-plan.json +5 -5
- package/dist/capabilities/minimax-cn.json +5 -5
- package/dist/capabilities/minimax-coding-plan.json +5 -5
- package/dist/capabilities/minimax.json +5 -5
- package/dist/capabilities/mistral.json +22 -14
- package/dist/capabilities/mixlayer.json +5 -5
- package/dist/capabilities/modal.json +10 -10
- package/dist/capabilities/model-oracle-ai.json +21 -21
- package/dist/capabilities/modelis.json +20 -20
- package/dist/capabilities/modelscope.json +2 -2
- package/dist/capabilities/modular.json +12 -12
- package/dist/capabilities/moneo.json +6 -6
- package/dist/capabilities/moonshotai-cn.json +7 -7
- package/dist/capabilities/moonshotai.json +7 -7
- package/dist/capabilities/morph.json +12 -12
- package/dist/capabilities/munito-eu.json +6 -6
- package/dist/capabilities/munito.json +8 -8
- package/dist/capabilities/nan.json +25 -25
- package/dist/capabilities/nano-gpt.json +585 -571
- package/dist/capabilities/nearai.json +112 -112
- package/dist/capabilities/nebius.json +36 -36
- package/dist/capabilities/neon.json +123 -123
- package/dist/capabilities/neuralwatt.json +41 -41
- package/dist/capabilities/nokeep.json +5 -5
- package/dist/capabilities/novita-ai.json +127 -127
- package/dist/capabilities/nvidia.json +16 -16
- package/dist/capabilities/oathbreaker.json +4 -4
- package/dist/capabilities/obscurify.json +31 -31
- package/dist/capabilities/oci.json +5 -5
- package/dist/capabilities/ofox.json +252 -252
- package/dist/capabilities/ollama-cloud.json +55 -55
- package/dist/capabilities/openai.json +54 -54
- package/dist/capabilities/opencode-go.json +109 -93
- package/dist/capabilities/openreason.json +4 -4
- package/dist/capabilities/openrouter.json +529 -529
- package/dist/capabilities/opper.json +27 -27
- package/dist/capabilities/orcarouter.json +263 -263
- package/dist/capabilities/outerlabs.json +30 -30
- package/dist/capabilities/ovhcloud.json +18 -18
- package/dist/capabilities/pareto.json +4 -4
- package/dist/capabilities/pendra.json +4 -4
- package/dist/capabilities/perplexity-agent.json +64 -64
- package/dist/capabilities/perplexity.json +2 -2
- package/dist/capabilities/phala.json +37 -37
- package/dist/capabilities/pioneer.json +2 -2
- package/dist/capabilities/poe.json +140 -140
- package/dist/capabilities/powerspring.json +11 -11
- package/dist/capabilities/primalabs.json +6 -6
- package/dist/capabilities/prime.json +119 -119
- package/dist/capabilities/privatemode-ai.json +7 -7
- package/dist/capabilities/proxystacks.json +3 -3
- package/dist/capabilities/qiniu-ai.json +11 -11
- package/dist/capabilities/refuseless.json +9 -9
- package/dist/capabilities/regolo-ai.json +9 -9
- package/dist/capabilities/requesty.json +201 -201
- package/dist/capabilities/ruapi.json +25 -25
- package/dist/capabilities/runcrate.json +15 -15
- package/dist/capabilities/runinfra.json +17 -17
- package/dist/capabilities/sakana.json +7 -7
- package/dist/capabilities/sambanova.json +5 -5
- package/dist/capabilities/sandbase.json +32 -32
- package/dist/capabilities/sarvam.json +9 -9
- package/dist/capabilities/scaleway.json +14 -14
- package/dist/capabilities/scnet-token-plan.json +4 -4
- package/dist/capabilities/scx-ai.json +21 -21
- package/dist/capabilities/sensenova.json +13 -13
- package/dist/capabilities/siliconflow-cn.json +56 -56
- package/dist/capabilities/siliconflow.json +63 -63
- package/dist/capabilities/snowflake-cortex.json +27 -27
- package/dist/capabilities/sokkan.json +2 -2
- package/dist/capabilities/sparrowcodes.json +18 -18
- package/dist/capabilities/standardcompute.json +83 -83
- package/dist/capabilities/steadyrouter.json +46 -46
- package/dist/capabilities/stepfun-ai-step-plan.json +8 -8
- package/dist/capabilities/stepfun-ai.json +8 -8
- package/dist/capabilities/stepfun-step-plan.json +8 -8
- package/dist/capabilities/stepfun.json +8 -8
- package/dist/capabilities/stepping-stone.json +21 -21
- package/dist/capabilities/subconscious.json +2 -2
- package/dist/capabilities/synthetic.json +12 -12
- package/dist/capabilities/synthorai.json +22 -22
- package/dist/capabilities/teamorouter.json +24 -24
- package/dist/capabilities/teapot-router.json +8 -8
- package/dist/capabilities/tencent-token-plan-intl.json +24 -24
- package/dist/capabilities/tencent-token-plan.json +35 -35
- package/dist/capabilities/tencent-tokenhub.json +50 -50
- package/dist/capabilities/tensorx.json +47 -47
- package/dist/capabilities/the-grid-ai.json +26 -26
- package/dist/capabilities/thinkingmachines.json +77 -77
- package/dist/capabilities/tinfoil.json +13 -13
- package/dist/capabilities/toapis.json +3 -3
- package/dist/capabilities/togetherai.json +58 -58
- package/dist/capabilities/tokengo.json +27 -27
- package/dist/capabilities/tokenharbor.json +216 -216
- package/dist/capabilities/tokenify.json +9 -9
- package/dist/capabilities/trustedrouter.json +7 -7
- package/dist/capabilities/trustedtokens.json +13 -13
- package/dist/capabilities/umans-ai-coding-plan.json +14 -14
- package/dist/capabilities/umans-ai.json +11 -11
- package/dist/capabilities/uncensuredai.json +4 -4
- package/dist/capabilities/unrestricted.json +4 -4
- package/dist/capabilities/uplinkswitch.json +22 -22
- package/dist/capabilities/vancine.json +20 -20
- package/dist/capabilities/vercel.json +594 -590
- package/dist/capabilities/verda.json +4 -4
- package/dist/capabilities/vivgrid.json +68 -68
- package/dist/capabilities/volcengine-coding-plan.json +29 -29
- package/dist/capabilities/volcengine.json +22 -22
- package/dist/capabilities/vultr.json +19 -19
- package/dist/capabilities/wafer.ai.json +19 -19
- package/dist/capabilities/wallaby.json +4 -4
- package/dist/capabilities/wally.json +11 -11
- package/dist/capabilities/wandb.json +21 -21
- package/dist/capabilities/watt.json +25 -25
- package/dist/capabilities/xai.json +6 -6
- package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-cn.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
- package/dist/capabilities/xiaomi.json +2 -2
- package/dist/capabilities/xpersona.json +13 -13
- package/dist/capabilities/xxapi.json +28 -28
- package/dist/capabilities/zai-coding-plan.json +11 -11
- package/dist/capabilities/zai.json +31 -31
- package/dist/capabilities/zenifra.json +30 -30
- package/dist/capabilities/zenmux.json +175 -175
- package/dist/capabilities/zerogpu.json +9 -9
- package/dist/capabilities/zhipuai-coding-plan.json +3 -3
- package/dist/capabilities/zhipuai.json +33 -33
- package/dist/capabilities/zro.json +4 -4
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/{channels-BQ--aLCA.js → channels-Dn6LqqK1.js} +1 -1
- package/dist/{channels-CTCBsS5M.cjs → channels-dYHpz7m2.cjs} +1 -1
- package/dist/coding-agent/index.cjs +1 -1
- package/dist/coding-agent/index.js +1 -1
- package/dist/{constants-Dro9fuhk.js → constants-C2Q-ZI5d.js} +6 -0
- package/dist/{constants-B2FVV_2e.cjs → constants-DPHwzvan.cjs} +6 -0
- package/dist/datasets/index.cjs +2 -2
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1079 -1074
- package/dist/docs/references/docs-channels.md +42 -1
- package/dist/docs/references/docs-develop.md +2 -0
- package/dist/docs/references/docs-evals-experiments.md +2 -0
- package/dist/docs/references/docs-guides-build-an-eval-loop.md +5 -1
- package/dist/docs/references/docs-guides-overview.md +2 -1
- package/dist/docs/references/docs-knowledge-importers.md +11 -1
- package/dist/docs/references/docs-knowledge-scopes-and-access.md +26 -0
- package/dist/docs/references/docs-mastra-platform-observability-overview.md +60 -0
- package/dist/docs/references/docs-memory-message-history.md +24 -16
- package/dist/docs/references/docs-memory-overview.md +21 -17
- package/dist/docs/references/docs-sandbox-overview.md +12 -10
- package/dist/docs/references/docs-workflows-control-flow.md +20 -0
- package/dist/docs/references/integrations-observability-arthur.md +1 -1
- package/dist/docs/references/reference-agent-controller-agent-controller-class.md +1 -1
- package/dist/docs/references/reference-agent-controller-session.md +9 -0
- package/dist/docs/references/reference-knowledge-knowledge-class.md +1 -1
- package/dist/docs/references/reference-knowledge-knowledge-tools.md +1 -1
- package/dist/docs/references/reference-observability-tracing-bridges-datadog.md +12 -11
- package/dist/docs/references/reference-processors-processor-interface.md +1 -1
- package/dist/docs/references/reference-storage-overview.md +1 -1
- package/dist/docs/references/reference-voice-overview.md +0 -27
- package/dist/docs/references/reference-workflows-step.md +1 -1
- package/dist/docs/references/reference-workspace-workspace-class.md +3 -1
- package/dist/evals/index.cjs +2 -2
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +2 -2
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/{execution-fence-C8Q0wWkG.cjs → execution-fence-CHI1L6Gw.cjs} +284 -97
- package/dist/{execution-fence-DGFyUV5h.js → execution-fence-P1uj8uB8.js} +273 -98
- package/dist/harness/index.cjs +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/importers/local-host.d.ts +2 -1
- package/dist/knowledge/importers/sink.d.ts +6 -0
- package/dist/knowledge/importers/types.d.ts +5 -0
- package/dist/knowledge/index.cjs +105 -20
- package/dist/knowledge/index.js +105 -21
- package/dist/knowledge/links.d.ts +19 -6
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/gateways/mastra.d.ts +19 -0
- package/dist/llm/model/gateways/refreshing-cache.d.ts +52 -0
- package/dist/llm/model/gateways/url-template.d.ts +3 -1
- package/dist/llm/model/provider-types.generated.d.ts +7693 -7570
- package/dist/{llm-YNjDFSui.js → llm-D4BaXbwZ.js} +4 -3
- package/dist/{llm-RIAYOAtD.cjs → llm-DqcaZBHM.cjs} +4 -3
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/loop/workflows/agentic-execution/background-task-check-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/goal-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/is-task-complete-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +2 -0
- package/dist/loop/workflows/schema.d.ts +13 -0
- package/dist/{manager-DZhtdV6Q.js → manager-BAs1D8t9.js} +3 -3
- package/dist/{manager-Y-jYcS7T.cjs → manager-Do9PPiEw.cjs} +3 -3
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-BJ54VxOO.js → mastra-CaLISVUE.js} +16 -16
- package/dist/{mastra-B2-HBq1-.cjs → mastra-DWCqC_6c.cjs} +16 -16
- package/dist/memory/index.cjs +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{model-lzZPXaEV.cjs → model-DAcaPIyq.cjs} +1 -1
- package/dist/{model-cS3d5rmF.js → model-DafU-uar.js} +1 -1
- package/dist/{netlify-1lti1j4Z.cjs → netlify-1Nz6N3ej.cjs} +29 -13
- package/dist/{netlify-ClBjc0Xg.js → netlify-CUG0Ko81.js} +29 -13
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/processor-provider/index.cjs +1 -1
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +2 -2
- package/dist/processors/index.js +2 -2
- package/dist/{provider-registry-C_XQJvu2.js → provider-registry-BjBiRMhs.js} +22121 -21683
- package/dist/{provider-registry-C6jd3Uxi.cjs → provider-registry-D_cE6sCW.cjs} +22132 -21676
- package/dist/provider-registry.json +21981 -21714
- package/dist/{registry-generator-DBrTbThj.js → registry-generator-VDBSUg0k.js} +1 -1
- package/dist/{registry-generator-BYdAlox6.cjs → registry-generator-ji57sjZC.cjs} +1 -1
- package/dist/{rehydrate-BtwY0ima.cjs → rehydrate-BOhDMI4r.cjs} +2 -2
- package/dist/{rehydrate-4xHubfOY.js → rehydrate-Do67YKWz.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/storage/constants.cjs +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/knowledge/base.d.ts +11 -0
- package/dist/storage/domains/knowledge/inmemory.d.ts +1 -0
- package/dist/storage/domains/knowledge/pages-inmemory.d.ts +4 -0
- package/dist/storage/domains/knowledge/pages.d.ts +1 -1
- package/dist/storage/domains/observability/tracing.d.ts +12 -0
- package/dist/storage/index.cjs +4 -3
- package/dist/storage/index.js +4 -4
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-H_wVxqdK.js → stream-DlzW_BXE.js} +1 -1
- package/dist/{stream-DqKDB3nL.cjs → stream-HM3ei83E.cjs} +1 -1
- 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-DvZcOxWe.js → tool-loop-agent-BBlEpcl4.js} +3 -3
- package/dist/{tool-loop-agent-D4gSdYuN.cjs → tool-loop-agent-CLyS2mqD.cjs} +3 -3
- package/dist/{utils-Dd4m7z13.cjs → utils-CYmtHkJO.cjs} +1 -1
- package/dist/{utils-h5k_ChdS.js → utils-DlBS4OO7.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-DQB9spZ1.js → validate-C7Ltq3EW.js} +1 -1
- package/dist/{validate-u6_TUYSo.cjs → validate-CPda0kNf.cjs} +1 -1
- package/dist/vector/index.cjs +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/{worker-0F7Nukyf.cjs → worker-BTLxhv5x.cjs} +2 -2
- package/dist/{worker-DmUkyJY_.js → worker-C75s75rt.js} +2 -2
- package/dist/{worker-DWOK2M_5.js → worker-CcLWNaev.js} +2 -2
- package/dist/{worker-D-cq8McN.cjs → worker-DkqCjpGQ.cjs} +2 -2
- package/dist/{workflow-DXE15e-w.cjs → workflow-BFlBk2d6.cjs} +3 -3
- package/dist/{workflow-DamOke3z.js → workflow-Dq4584lm.js} +3 -3
- package/dist/workflows/builder/index.cjs +1 -1
- package/dist/workflows/builder/index.js +1 -1
- package/dist/workflows/evented/index.cjs +1 -1
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +4 -4
- package/dist/workflows/index.js +4 -4
- package/dist/workspace/tools/media.d.ts +2 -2
- package/package.json +6 -6
- package/src/llm/model/provider-types.generated.d.ts +7693 -7570
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-DaSmhVUX.cjs");
|
|
3
3
|
const require_tools = require("../tools-DZoVfKPl.cjs");
|
|
4
|
-
const require_agent_controller = require("../agent-controller-
|
|
4
|
+
const require_agent_controller = require("../agent-controller-Bt7DwpZy.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-B_KsS82m.js";
|
|
2
2
|
import { o as askUserTool, t as submitPlanTool } from "../tools-FwJyNoyg.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-CFNkjF3l.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-CaLISVUE.js";
|
|
@@ -28,7 +28,8 @@ export interface LocalKnowledgeImporterHostOptions {
|
|
|
28
28
|
/**
|
|
29
29
|
* Wall-clock budget for one flush's settle slice; it stops before the next node once this has
|
|
30
30
|
* passed. Default 10 seconds, well inside `flushBudgetMs`. Settle work is also capped at 200
|
|
31
|
-
* nodes examined and 50 moves per flush.
|
|
31
|
+
* nodes examined and 50 moves per flush. At 0 or less nothing settles, and a run doesn't chain
|
|
32
|
+
* for linking pages a flush left to re-resolve.
|
|
32
33
|
*/
|
|
33
34
|
settleBudgetMs?: number;
|
|
34
35
|
/**
|
|
@@ -48,6 +48,8 @@ export interface KnowledgeImportSinkResult {
|
|
|
48
48
|
fallback?: string;
|
|
49
49
|
/** Set when the store can't change page keys, so it refused items placed by `path`. */
|
|
50
50
|
pathsUnsupported?: true;
|
|
51
|
+
/** How many linking pages' links this flush re-resolved in batches, its settle slice included; absent when none. */
|
|
52
|
+
linksRepaired?: number;
|
|
51
53
|
}
|
|
52
54
|
/** Bounds for one settle slice (O3 §C, §C′): a slice never drains everything. */
|
|
53
55
|
export interface KnowledgeImportSettleBudget {
|
|
@@ -61,6 +63,8 @@ export interface KnowledgeImportSettleBudget {
|
|
|
61
63
|
until: number;
|
|
62
64
|
/** Called as the slice starts, so a host can tell a timeout while settling from one before it. */
|
|
63
65
|
onStart?: () => void;
|
|
66
|
+
/** The binding's state as the host read it for this flush, so the slice needn't read it again. */
|
|
67
|
+
state?: Record<string, string>;
|
|
64
68
|
}
|
|
65
69
|
export interface KnowledgeImportSettleResult {
|
|
66
70
|
/** The pass isn't through the binding's unsettled nodes: another slice should run. */
|
|
@@ -71,6 +75,8 @@ export interface KnowledgeImportSettleResult {
|
|
|
71
75
|
settled: number;
|
|
72
76
|
/** The slice ran from the first unsettled node, so it saw every repair queued before it started. */
|
|
73
77
|
fromStart: boolean;
|
|
78
|
+
/** Linking pages still waiting for their links to be re-resolved, past this flush's link budget. */
|
|
79
|
+
linksPending?: number;
|
|
74
80
|
}
|
|
75
81
|
/**
|
|
76
82
|
* Host state key another binding's flush sets, to a fresh value, when it queues link repairs on
|
|
@@ -87,6 +87,11 @@ export interface KnowledgeImporterFlushReceipt extends Omit<KnowledgeImportCount
|
|
|
87
87
|
* allows; each does one bounded slice. Stored with the receipt, so a replay returns the same value.
|
|
88
88
|
*/
|
|
89
89
|
pending?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* How many pages that link to pages this run changed still wait for their links to be re-resolved,
|
|
92
|
+
* when some do. A flush re-resolves up to 1,000; the host chains another run while any are left.
|
|
93
|
+
*/
|
|
94
|
+
linksPending?: number;
|
|
90
95
|
/**
|
|
91
96
|
* Why the host saved this flush op by op instead of in one batch, when it did. Diagnostics only:
|
|
92
97
|
* the end state is the same either way. The run's counts add `fallbacks: 1` for each such flush.
|
package/dist/knowledge/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_base = require("../base-BIzR1D3_.cjs");
|
|
3
|
-
const require_execution_fence = require("../execution-fence-
|
|
3
|
+
const require_execution_fence = require("../execution-fence-CHI1L6Gw.cjs");
|
|
4
4
|
const require_tool = require("../tool-Dn9WSDVn.cjs");
|
|
5
5
|
const require_workspace = require("../workspace-BQD4tcQi.cjs");
|
|
6
6
|
let crypto = require("crypto");
|
|
@@ -2098,6 +2098,12 @@ const originalBodyNotePrefix = (pageId) => `knowledge-import-original:${pageId}`
|
|
|
2098
2098
|
const KNOWLEDGE_IMPORT_SETTLE_RESTART_KEY = "mastra:settle:restart";
|
|
2099
2099
|
/** The {@link KNOWLEDGE_IMPORT_SETTLE_RESTART_KEY} value the binding's settling last started over for. */
|
|
2100
2100
|
const KNOWLEDGE_IMPORT_SETTLE_SEEN_KEY = "mastra:settle:seen";
|
|
2101
|
+
/**
|
|
2102
|
+
* Host state key holding the pages, as a JSON array of ids in id order, whose body links a batched
|
|
2103
|
+
* link repair left for later: more pages linked to what a flush wrote than one flush rewrites. Each
|
|
2104
|
+
* settle slice rewrites some from their bodies as they are then, until none are left.
|
|
2105
|
+
*/
|
|
2106
|
+
const KNOWLEDGE_IMPORT_LINKS_PENDING_KEY = "mastra:links:pending";
|
|
2101
2107
|
/** An unresolved link as the node map lists it, with its label. */
|
|
2102
2108
|
const encodeLink = (link) => JSON.stringify([link.sourceId, link.rel]);
|
|
2103
2109
|
const LINKS_HEADING = "Links:";
|
|
@@ -2275,6 +2281,8 @@ async function applyKnowledgeImportFlush(input) {
|
|
|
2275
2281
|
const { binding, scope, provenance } = input;
|
|
2276
2282
|
let { storage, importers } = input;
|
|
2277
2283
|
let overlay = null;
|
|
2284
|
+
let linkBudget = require_execution_fence.MAX_KNOWLEDGE_LINK_REPAIR_SOURCES;
|
|
2285
|
+
let linksDeferred = 0;
|
|
2278
2286
|
/**
|
|
2279
2287
|
* Link-index work for a written page: a sync of its body links, then maybe a refresh of the links to
|
|
2280
2288
|
* it. Run now, or after the batched write in one repair when deciding over the working copy.
|
|
@@ -2322,15 +2330,7 @@ async function applyKnowledgeImportFlush(input) {
|
|
|
2322
2330
|
});
|
|
2323
2331
|
return false;
|
|
2324
2332
|
});
|
|
2325
|
-
if (ops.length === 0 && !
|
|
2326
|
-
if (input.settle) result.settle = {
|
|
2327
|
-
pending: false,
|
|
2328
|
-
cursor: null,
|
|
2329
|
-
settled: 0,
|
|
2330
|
-
fromStart: false
|
|
2331
|
-
};
|
|
2332
|
-
return result;
|
|
2333
|
-
}
|
|
2333
|
+
if (ops.length === 0 && !input.settle) return result;
|
|
2334
2334
|
const keyPath = async (page) => {
|
|
2335
2335
|
const keys = [];
|
|
2336
2336
|
const ids = [];
|
|
@@ -3258,17 +3258,88 @@ async function applyKnowledgeImportFlush(input) {
|
|
|
3258
3258
|
}
|
|
3259
3259
|
}
|
|
3260
3260
|
if (input.settle) {
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3261
|
+
const links = await settleLinks(input.settle);
|
|
3262
|
+
if (anchor) input.settle.onStart?.();
|
|
3263
|
+
const deferredBefore = linksDeferred;
|
|
3264
|
+
const settled = anchor ? await settle(input.settle, anchor.page) : {
|
|
3265
3265
|
pending: false,
|
|
3266
3266
|
cursor: null,
|
|
3267
3267
|
settled: 0,
|
|
3268
3268
|
fromStart: false
|
|
3269
3269
|
};
|
|
3270
|
+
const left = linksDeferred !== deferredBefore ? linksDeferred : links.left;
|
|
3271
|
+
result.settle = {
|
|
3272
|
+
...settled,
|
|
3273
|
+
pending: settled.pending || left > 0,
|
|
3274
|
+
settled: settled.settled + links.settled,
|
|
3275
|
+
...left ? { linksPending: left } : {}
|
|
3276
|
+
};
|
|
3270
3277
|
}
|
|
3278
|
+
if (linkBudget < 1e3) result.linksRepaired = require_execution_fence.MAX_KNOWLEDGE_LINK_REPAIR_SOURCES - linkBudget;
|
|
3271
3279
|
return result;
|
|
3280
|
+
/** Adds `pageIds` to the binding's pages waiting for their links to be re-resolved. */
|
|
3281
|
+
async function deferLinkRepairs(store, pageIds) {
|
|
3282
|
+
const state = await store.getState(binding.id);
|
|
3283
|
+
const waiting = new Set(state[KNOWLEDGE_IMPORT_LINKS_PENDING_KEY] ? JSON.parse(state[KNOWLEDGE_IMPORT_LINKS_PENDING_KEY]) : []);
|
|
3284
|
+
for (const id of pageIds) waiting.add(id);
|
|
3285
|
+
await store.setState(binding.id, { [KNOWLEDGE_IMPORT_LINKS_PENDING_KEY]: JSON.stringify([...waiting].sort()) });
|
|
3286
|
+
return waiting.size;
|
|
3287
|
+
}
|
|
3288
|
+
/**
|
|
3289
|
+
* Re-resolves, from their bodies as they are now, the waiting pages this flush's link budget still
|
|
3290
|
+
* covers, before the slice's time is up, and counts the ones left.
|
|
3291
|
+
*/
|
|
3292
|
+
async function settleLinks(budget) {
|
|
3293
|
+
if (!require_execution_fence.canRepairKnowledgeLinksInBatch(input.storage)) return {
|
|
3294
|
+
left: 0,
|
|
3295
|
+
settled: 0
|
|
3296
|
+
};
|
|
3297
|
+
if (linksDeferred) return {
|
|
3298
|
+
left: linksDeferred,
|
|
3299
|
+
settled: 0
|
|
3300
|
+
};
|
|
3301
|
+
const state = budget.state ?? await input.importers.getState(binding.id);
|
|
3302
|
+
const waiting = state[KNOWLEDGE_IMPORT_LINKS_PENDING_KEY] ? JSON.parse(state[KNOWLEDGE_IMPORT_LINKS_PENDING_KEY]) : [];
|
|
3303
|
+
if (!waiting.length) return {
|
|
3304
|
+
left: 0,
|
|
3305
|
+
settled: 0
|
|
3306
|
+
};
|
|
3307
|
+
if (linkBudget <= 0 || Date.now() >= budget.until) return {
|
|
3308
|
+
left: waiting.length,
|
|
3309
|
+
settled: 0
|
|
3310
|
+
};
|
|
3311
|
+
budget.onStart?.();
|
|
3312
|
+
let done = 0;
|
|
3313
|
+
const deferred = [];
|
|
3314
|
+
while (done < Math.min(waiting.length, linkBudget)) {
|
|
3315
|
+
if (done > 0 && Date.now() >= budget.until) break;
|
|
3316
|
+
const batch = waiting.slice(done, Math.min(done + 100, linkBudget));
|
|
3317
|
+
const pages = await input.storage.getPages({
|
|
3318
|
+
ids: batch,
|
|
3319
|
+
read: "all"
|
|
3320
|
+
});
|
|
3321
|
+
const found = new Set(pages.map((page) => page.id));
|
|
3322
|
+
const gone = batch.filter((id) => !found.has(id));
|
|
3323
|
+
if (gone.length) await input.storage.applyPageWrites({ writes: gone.map((pageId) => ({
|
|
3324
|
+
op: "replace-links",
|
|
3325
|
+
pageId,
|
|
3326
|
+
links: []
|
|
3327
|
+
})) });
|
|
3328
|
+
const repaired = await require_execution_fence.repairKnowledgeLinks(input.storage, {
|
|
3329
|
+
synced: pages,
|
|
3330
|
+
refreshed: []
|
|
3331
|
+
}, { limit: linkBudget - done });
|
|
3332
|
+
deferred.push(...repaired.deferred);
|
|
3333
|
+
done += batch.length;
|
|
3334
|
+
}
|
|
3335
|
+
linkBudget -= done;
|
|
3336
|
+
const left = [...deferred, ...waiting.slice(done)];
|
|
3337
|
+
await input.importers.setState(binding.id, { [KNOWLEDGE_IMPORT_LINKS_PENDING_KEY]: left.length ? JSON.stringify(left) : "" });
|
|
3338
|
+
return {
|
|
3339
|
+
left: left.length,
|
|
3340
|
+
settled: done
|
|
3341
|
+
};
|
|
3342
|
+
}
|
|
3272
3343
|
/**
|
|
3273
3344
|
* Decides every op over a working copy (overlay.ts) and writes what they decided in a few
|
|
3274
3345
|
* set-based statements, all in one savepoint (batched-flush plan v3.1). Returns why it fell back,
|
|
@@ -3412,10 +3483,14 @@ async function applyKnowledgeImportFlush(input) {
|
|
|
3412
3483
|
};
|
|
3413
3484
|
const before = structuredClone(result);
|
|
3414
3485
|
const deferredBefore = deferredLinkers;
|
|
3486
|
+
const linkBudgetBefore = linkBudget;
|
|
3487
|
+
const linksDeferredBefore = linksDeferred;
|
|
3415
3488
|
const reset = () => {
|
|
3416
3489
|
const copy = structuredClone(before);
|
|
3417
3490
|
Object.assign(result, copy);
|
|
3418
3491
|
deferredLinkers = deferredBefore;
|
|
3492
|
+
linkBudget = linkBudgetBefore;
|
|
3493
|
+
linksDeferred = linksDeferredBefore;
|
|
3419
3494
|
};
|
|
3420
3495
|
const missing = emptyImportOverlayMissing();
|
|
3421
3496
|
let locked = /* @__PURE__ */ new Set();
|
|
@@ -3478,13 +3553,15 @@ async function applyKnowledgeImportFlush(input) {
|
|
|
3478
3553
|
throw new BatchFallback(`node writes: ${error.name}`);
|
|
3479
3554
|
}
|
|
3480
3555
|
try {
|
|
3481
|
-
await require_execution_fence.repairKnowledgeLinks(real.storage, {
|
|
3556
|
+
const repaired = await require_execution_fence.repairKnowledgeLinks(real.storage, {
|
|
3482
3557
|
synced: working.links.flatMap((work) => "sync" in work ? [work.sync] : []),
|
|
3483
3558
|
refreshed: working.links.flatMap((work) => "refresh" in work ? [{
|
|
3484
3559
|
page: work.refresh,
|
|
3485
3560
|
withDescendants: work.withDescendants
|
|
3486
3561
|
}] : [])
|
|
3487
|
-
});
|
|
3562
|
+
}, { limit: linkBudget });
|
|
3563
|
+
linkBudget -= repaired.rewritten;
|
|
3564
|
+
if (repaired.deferred.length) linksDeferred = await deferLinkRepairs(real.importers, repaired.deferred);
|
|
3488
3565
|
} catch (error) {
|
|
3489
3566
|
if (error instanceof require_execution_fence.KnowledgeLinkRepairUnsupportedError) throw new BatchFallback(error.reason);
|
|
3490
3567
|
if (error instanceof require_execution_fence.KnowledgeUnsupportedCapabilityError) throw new BatchFallback(`link repair: ${error.name}`);
|
|
@@ -4187,6 +4264,7 @@ const hostFinish = (run, code) => {
|
|
|
4187
4264
|
function createLocalKnowledgeImporterHost(writer, options) {
|
|
4188
4265
|
const author = options.author ?? ((binding) => `importer:${binding.id}`);
|
|
4189
4266
|
const leaseMs = options.leaseMs;
|
|
4267
|
+
const settleBudgetMs = options.settleBudgetMs ?? DEFAULT_SETTLE_BUDGET_MS;
|
|
4190
4268
|
/** The clock leases are judged by: the store's under `leaseMs`, else this process's. */
|
|
4191
4269
|
const clock = async (importers) => leaseMs !== void 0 ? importers.now() : /* @__PURE__ */ new Date();
|
|
4192
4270
|
/** Why a running run is no longer live at `now`, or null while it is. */
|
|
@@ -4460,10 +4538,11 @@ function createLocalKnowledgeImporterHost(writer, options) {
|
|
|
4460
4538
|
after: restarting ? null : hostState[SETTLE_CURSOR_KEY] || null,
|
|
4461
4539
|
candidates: Math.max(1, SETTLE_CANDIDATES >> timeouts),
|
|
4462
4540
|
moves: SETTLE_MOVES,
|
|
4463
|
-
until: Math.min(Date.now() +
|
|
4541
|
+
until: Math.min(Date.now() + settleBudgetMs, deadlineAt),
|
|
4464
4542
|
onStart: () => {
|
|
4465
4543
|
settling = true;
|
|
4466
|
-
}
|
|
4544
|
+
},
|
|
4545
|
+
state: hostState
|
|
4467
4546
|
} } : {}
|
|
4468
4547
|
});
|
|
4469
4548
|
if (applied.fallback) fallbackWarning = `Knowledge importer: flush ${flush.seq} of run ${run.id} saved op by op instead of batched (${applied.fallback})`;
|
|
@@ -4489,6 +4568,7 @@ function createLocalKnowledgeImporterHost(writer, options) {
|
|
|
4489
4568
|
...applied.counts,
|
|
4490
4569
|
refused: applied.refused,
|
|
4491
4570
|
pending: settled?.pending ?? false,
|
|
4571
|
+
...settled?.linksPending ? { linksPending: settled.linksPending } : {},
|
|
4492
4572
|
...applied.fallback ? { fallback: applied.fallback } : {}
|
|
4493
4573
|
};
|
|
4494
4574
|
await importers.recordFlush({
|
|
@@ -4501,6 +4581,7 @@ function createLocalKnowledgeImporterHost(writer, options) {
|
|
|
4501
4581
|
...applied.counts,
|
|
4502
4582
|
refused: applied.refused.length,
|
|
4503
4583
|
settled: settled?.settled ?? 0,
|
|
4584
|
+
...applied.linksRepaired ? { linksRepaired: applied.linksRepaired } : {},
|
|
4504
4585
|
...applied.fallback ? { fallbacks: 1 } : {}
|
|
4505
4586
|
}
|
|
4506
4587
|
});
|
|
@@ -4643,10 +4724,13 @@ function createLocalKnowledgeImporterHost(writer, options) {
|
|
|
4643
4724
|
});
|
|
4644
4725
|
return runReceipt(canceled);
|
|
4645
4726
|
}
|
|
4646
|
-
const
|
|
4727
|
+
const lastReceipt = (run.lastSeq > 0 ? await importers.getFlush(run.id, run.generation, run.lastSeq) : null)?.receipt;
|
|
4728
|
+
const pending = lastReceipt?.pending === true;
|
|
4729
|
+
const linksPending = (lastReceipt?.linksPending ?? 0) > 0;
|
|
4647
4730
|
const binding = await importers.getBinding(run.bindingId);
|
|
4648
4731
|
const gaveUp = !!binding && settleTimeouts(await importers.getState(binding.id), run.id) >= SETTLE_MAX_TIMEOUTS;
|
|
4649
|
-
const
|
|
4732
|
+
const linksRepaired = (run.counts.linksRepaired ?? 0) > 0;
|
|
4733
|
+
const chain = normalized.backlog || normalized.outcome === "succeeded" && pending && !gaveUp && ((run.counts.settled ?? 0) > 0 || linksPending && linksRepaired && settleBudgetMs > 0);
|
|
4650
4734
|
const finished = await importers.finishRun({
|
|
4651
4735
|
runId: run.id,
|
|
4652
4736
|
generation: request.generation,
|
|
@@ -6375,6 +6459,7 @@ exports.KnowledgeImporterSettingsError = KnowledgeImporterSettingsError;
|
|
|
6375
6459
|
exports.KnowledgeImporterSourceError = KnowledgeImporterSourceError;
|
|
6376
6460
|
exports.KnowledgeImportersStorage = require_execution_fence.KnowledgeImportersStorage;
|
|
6377
6461
|
exports.KnowledgeInvalidCursorError = require_execution_fence.KnowledgeInvalidCursorError;
|
|
6462
|
+
exports.KnowledgeInvalidSearchError = require_execution_fence.KnowledgeInvalidSearchError;
|
|
6378
6463
|
exports.KnowledgeMoveTooLargeError = require_execution_fence.KnowledgeMoveTooLargeError;
|
|
6379
6464
|
exports.KnowledgeNotFoundError = require_execution_fence.KnowledgeNotFoundError;
|
|
6380
6465
|
exports.KnowledgePageDepthError = require_execution_fence.KnowledgePageDepthError;
|
package/dist/knowledge/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as MastraBase } from "../base-CKLWBhDo.js";
|
|
2
|
-
import { $n as
|
|
2
|
+
import { $n as MAX_KNOWLEDGE_SCOPE_TAGS, $r as InMemoryKnowledgeStorage, $t as KnowledgeLinkRepairUnsupportedError, Ai as canonicalKnowledgeName, Bt as KnowledgeRunScopesError, Ci as MAX_KNOWLEDGE_PAGE_DESCRIPTION_TOKENS, Di as MAX_KNOWLEDGE_PIN_LIST_DEPTH, Ei as MAX_KNOWLEDGE_PAGE_LIST_LIMIT, Fi as knowledgeScopeReadable, Ft as PINNED_READ_MEMO_KEY, Gt as moveKnowledgePage, Ht as knowledgeAgentScopes, Ii as parseKnowledgePageRef, Io as augmentWithInit, It as knowledgeDeliveredPins, Jt as updateKnowledgeNote, Kt as removeKnowledgeNote, Li as KnowledgeInvalidCursorError, Lo as getStorageSource, Lt as buildKnowledgePageTools, Mi as knowledgePagePath, Ni as knowledgePinDepth, Oi as assertKnowledgeNoteTextWithinBound, Pi as knowledgePositionBetween, Qn as MAX_KNOWLEDGE_RECORD_TEXT_LENGTH, Qt as KnowledgeLinkRefreshIncompleteError, Ri as KnowledgeInvalidSearchError, Rt as heldScopes, Si as MAX_KNOWLEDGE_PAGE_DEPTH, Ti as MAX_KNOWLEDGE_PAGE_LINK_REF_LENGTH, Ut as knowledgePersonaScopes, Vt as knowledgeRunPrincipals, Wt as addKnowledgeNote, Xt as KnowledgeSemanticIndex, Yt as upsertKnowledgePage, Zn as MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH, _i as KnowledgePageHasChildrenError, _n as decodeKnowledgeScopeId, ai as KnowledgeConflictError, an as repairKnowledgeLinks, ar as createKnowledgeNodeCursor, bi as MAX_KNOWLEDGE_NOTE_TOKENS, ci as KnowledgeStorage, cn as knowledgeAccessGrants, cr as knowledgeScopeKey, di as assertKnowledgeSchemaCompatible, dn as KnowledgeDeclarationError, dr as knowledgeVisibleScopeKeys, ei as KnowledgeImporterBindingConflictError, en as MAX_KNOWLEDGE_LINK_REPAIR_SOURCES, er as assertKnowledgeCeilingRaised, fi as createKnowledgeUlid, fn as compileKnowledgeScopes, fr as parseKnowledgeNodeCursor, gi as KnowledgePageDepthError, gn as strongerKnowledgeRole, hi as KnowledgeMoveTooLargeError, hn as knowledgeScopeAddress, ii as KNOWLEDGE_STORAGE_SCHEMA_VERSION, in as reindexKnowledgeLinks, ir as canonicalizeKnowledgeScope, ji as knowledgeLinkRefKey, ki as assertKnowledgePageDescriptionWithinBound, li as KnowledgeTransactionDeadlineError, ln as knowledgeReadScopeFor, lr as knowledgeSemanticDocumentId, mi as parseKnowledgeWikilinks, mn as knowledgeRunScopes, ni as KnowledgeImportersStorage, nn as knowledgeSubtree, nr as assertKnowledgeRecordTextWithinBound, oi as KnowledgeNotFoundError, on as syncKnowledgePageBodyLinks, or as expandKnowledgeScope, pi as inspectKnowledgeSchema, pn as knowledgeMemoryScopes, qt as removeKnowledgePage, ri as KNOWLEDGE_STORAGE_CONTRACT_VERSION, rn as refreshKnowledgeLinksTo, rr as assertKnowledgeScopeWithinCeiling, si as KnowledgeSchemaResetRequiredError, sn as updateKnowledgeLinks, sr as isKnowledgeScopeVisible, ti as KnowledgeImporterRunStateError, tn as canRepairKnowledgeLinksInBatch, tr as assertKnowledgeDescriptionWithinBound, ui as KnowledgeUnsupportedCapabilityError, un as knowledgeRoleOn, ur as knowledgeSemanticIdempotencyKey, vi as KnowledgePageKeyConflictError, vn as encodeKnowledgeScopeId, wi as MAX_KNOWLEDGE_PAGE_LINKS, xi as MAX_KNOWLEDGE_PAGE_BODY_LINKS, yi as MAX_KNOWLEDGE_MOVE_PAGES, yn as buildKnowledgeInstructions, zi as knowledgePageKeyProblem, zt as KnowledgeRun } from "../execution-fence-P1uj8uB8.js";
|
|
3
3
|
import { standardSchemaToJSONSchema, toStandardSchema } from "../schema/index.js";
|
|
4
4
|
import { i as createStandardSchemaIssuesError } from "../tool-DIFduuTw.js";
|
|
5
5
|
import { mt as estimateTokenCount } from "../workspace-sqcfdZRR.js";
|
|
@@ -2097,6 +2097,12 @@ const originalBodyNotePrefix = (pageId) => `knowledge-import-original:${pageId}`
|
|
|
2097
2097
|
const KNOWLEDGE_IMPORT_SETTLE_RESTART_KEY = "mastra:settle:restart";
|
|
2098
2098
|
/** The {@link KNOWLEDGE_IMPORT_SETTLE_RESTART_KEY} value the binding's settling last started over for. */
|
|
2099
2099
|
const KNOWLEDGE_IMPORT_SETTLE_SEEN_KEY = "mastra:settle:seen";
|
|
2100
|
+
/**
|
|
2101
|
+
* Host state key holding the pages, as a JSON array of ids in id order, whose body links a batched
|
|
2102
|
+
* link repair left for later: more pages linked to what a flush wrote than one flush rewrites. Each
|
|
2103
|
+
* settle slice rewrites some from their bodies as they are then, until none are left.
|
|
2104
|
+
*/
|
|
2105
|
+
const KNOWLEDGE_IMPORT_LINKS_PENDING_KEY = "mastra:links:pending";
|
|
2100
2106
|
/** An unresolved link as the node map lists it, with its label. */
|
|
2101
2107
|
const encodeLink = (link) => JSON.stringify([link.sourceId, link.rel]);
|
|
2102
2108
|
const LINKS_HEADING = "Links:";
|
|
@@ -2274,6 +2280,8 @@ async function applyKnowledgeImportFlush(input) {
|
|
|
2274
2280
|
const { binding, scope, provenance } = input;
|
|
2275
2281
|
let { storage, importers } = input;
|
|
2276
2282
|
let overlay = null;
|
|
2283
|
+
let linkBudget = MAX_KNOWLEDGE_LINK_REPAIR_SOURCES;
|
|
2284
|
+
let linksDeferred = 0;
|
|
2277
2285
|
/**
|
|
2278
2286
|
* Link-index work for a written page: a sync of its body links, then maybe a refresh of the links to
|
|
2279
2287
|
* it. Run now, or after the batched write in one repair when deciding over the working copy.
|
|
@@ -2321,15 +2329,7 @@ async function applyKnowledgeImportFlush(input) {
|
|
|
2321
2329
|
});
|
|
2322
2330
|
return false;
|
|
2323
2331
|
});
|
|
2324
|
-
if (ops.length === 0 && !
|
|
2325
|
-
if (input.settle) result.settle = {
|
|
2326
|
-
pending: false,
|
|
2327
|
-
cursor: null,
|
|
2328
|
-
settled: 0,
|
|
2329
|
-
fromStart: false
|
|
2330
|
-
};
|
|
2331
|
-
return result;
|
|
2332
|
-
}
|
|
2332
|
+
if (ops.length === 0 && !input.settle) return result;
|
|
2333
2333
|
const keyPath = async (page) => {
|
|
2334
2334
|
const keys = [];
|
|
2335
2335
|
const ids = [];
|
|
@@ -3257,17 +3257,88 @@ async function applyKnowledgeImportFlush(input) {
|
|
|
3257
3257
|
}
|
|
3258
3258
|
}
|
|
3259
3259
|
if (input.settle) {
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3260
|
+
const links = await settleLinks(input.settle);
|
|
3261
|
+
if (anchor) input.settle.onStart?.();
|
|
3262
|
+
const deferredBefore = linksDeferred;
|
|
3263
|
+
const settled = anchor ? await settle(input.settle, anchor.page) : {
|
|
3264
3264
|
pending: false,
|
|
3265
3265
|
cursor: null,
|
|
3266
3266
|
settled: 0,
|
|
3267
3267
|
fromStart: false
|
|
3268
3268
|
};
|
|
3269
|
+
const left = linksDeferred !== deferredBefore ? linksDeferred : links.left;
|
|
3270
|
+
result.settle = {
|
|
3271
|
+
...settled,
|
|
3272
|
+
pending: settled.pending || left > 0,
|
|
3273
|
+
settled: settled.settled + links.settled,
|
|
3274
|
+
...left ? { linksPending: left } : {}
|
|
3275
|
+
};
|
|
3269
3276
|
}
|
|
3277
|
+
if (linkBudget < 1e3) result.linksRepaired = MAX_KNOWLEDGE_LINK_REPAIR_SOURCES - linkBudget;
|
|
3270
3278
|
return result;
|
|
3279
|
+
/** Adds `pageIds` to the binding's pages waiting for their links to be re-resolved. */
|
|
3280
|
+
async function deferLinkRepairs(store, pageIds) {
|
|
3281
|
+
const state = await store.getState(binding.id);
|
|
3282
|
+
const waiting = new Set(state[KNOWLEDGE_IMPORT_LINKS_PENDING_KEY] ? JSON.parse(state[KNOWLEDGE_IMPORT_LINKS_PENDING_KEY]) : []);
|
|
3283
|
+
for (const id of pageIds) waiting.add(id);
|
|
3284
|
+
await store.setState(binding.id, { [KNOWLEDGE_IMPORT_LINKS_PENDING_KEY]: JSON.stringify([...waiting].sort()) });
|
|
3285
|
+
return waiting.size;
|
|
3286
|
+
}
|
|
3287
|
+
/**
|
|
3288
|
+
* Re-resolves, from their bodies as they are now, the waiting pages this flush's link budget still
|
|
3289
|
+
* covers, before the slice's time is up, and counts the ones left.
|
|
3290
|
+
*/
|
|
3291
|
+
async function settleLinks(budget) {
|
|
3292
|
+
if (!canRepairKnowledgeLinksInBatch(input.storage)) return {
|
|
3293
|
+
left: 0,
|
|
3294
|
+
settled: 0
|
|
3295
|
+
};
|
|
3296
|
+
if (linksDeferred) return {
|
|
3297
|
+
left: linksDeferred,
|
|
3298
|
+
settled: 0
|
|
3299
|
+
};
|
|
3300
|
+
const state = budget.state ?? await input.importers.getState(binding.id);
|
|
3301
|
+
const waiting = state[KNOWLEDGE_IMPORT_LINKS_PENDING_KEY] ? JSON.parse(state[KNOWLEDGE_IMPORT_LINKS_PENDING_KEY]) : [];
|
|
3302
|
+
if (!waiting.length) return {
|
|
3303
|
+
left: 0,
|
|
3304
|
+
settled: 0
|
|
3305
|
+
};
|
|
3306
|
+
if (linkBudget <= 0 || Date.now() >= budget.until) return {
|
|
3307
|
+
left: waiting.length,
|
|
3308
|
+
settled: 0
|
|
3309
|
+
};
|
|
3310
|
+
budget.onStart?.();
|
|
3311
|
+
let done = 0;
|
|
3312
|
+
const deferred = [];
|
|
3313
|
+
while (done < Math.min(waiting.length, linkBudget)) {
|
|
3314
|
+
if (done > 0 && Date.now() >= budget.until) break;
|
|
3315
|
+
const batch = waiting.slice(done, Math.min(done + 100, linkBudget));
|
|
3316
|
+
const pages = await input.storage.getPages({
|
|
3317
|
+
ids: batch,
|
|
3318
|
+
read: "all"
|
|
3319
|
+
});
|
|
3320
|
+
const found = new Set(pages.map((page) => page.id));
|
|
3321
|
+
const gone = batch.filter((id) => !found.has(id));
|
|
3322
|
+
if (gone.length) await input.storage.applyPageWrites({ writes: gone.map((pageId) => ({
|
|
3323
|
+
op: "replace-links",
|
|
3324
|
+
pageId,
|
|
3325
|
+
links: []
|
|
3326
|
+
})) });
|
|
3327
|
+
const repaired = await repairKnowledgeLinks(input.storage, {
|
|
3328
|
+
synced: pages,
|
|
3329
|
+
refreshed: []
|
|
3330
|
+
}, { limit: linkBudget - done });
|
|
3331
|
+
deferred.push(...repaired.deferred);
|
|
3332
|
+
done += batch.length;
|
|
3333
|
+
}
|
|
3334
|
+
linkBudget -= done;
|
|
3335
|
+
const left = [...deferred, ...waiting.slice(done)];
|
|
3336
|
+
await input.importers.setState(binding.id, { [KNOWLEDGE_IMPORT_LINKS_PENDING_KEY]: left.length ? JSON.stringify(left) : "" });
|
|
3337
|
+
return {
|
|
3338
|
+
left: left.length,
|
|
3339
|
+
settled: done
|
|
3340
|
+
};
|
|
3341
|
+
}
|
|
3271
3342
|
/**
|
|
3272
3343
|
* Decides every op over a working copy (overlay.ts) and writes what they decided in a few
|
|
3273
3344
|
* set-based statements, all in one savepoint (batched-flush plan v3.1). Returns why it fell back,
|
|
@@ -3411,10 +3482,14 @@ async function applyKnowledgeImportFlush(input) {
|
|
|
3411
3482
|
};
|
|
3412
3483
|
const before = structuredClone(result);
|
|
3413
3484
|
const deferredBefore = deferredLinkers;
|
|
3485
|
+
const linkBudgetBefore = linkBudget;
|
|
3486
|
+
const linksDeferredBefore = linksDeferred;
|
|
3414
3487
|
const reset = () => {
|
|
3415
3488
|
const copy = structuredClone(before);
|
|
3416
3489
|
Object.assign(result, copy);
|
|
3417
3490
|
deferredLinkers = deferredBefore;
|
|
3491
|
+
linkBudget = linkBudgetBefore;
|
|
3492
|
+
linksDeferred = linksDeferredBefore;
|
|
3418
3493
|
};
|
|
3419
3494
|
const missing = emptyImportOverlayMissing();
|
|
3420
3495
|
let locked = /* @__PURE__ */ new Set();
|
|
@@ -3477,13 +3552,15 @@ async function applyKnowledgeImportFlush(input) {
|
|
|
3477
3552
|
throw new BatchFallback(`node writes: ${error.name}`);
|
|
3478
3553
|
}
|
|
3479
3554
|
try {
|
|
3480
|
-
await repairKnowledgeLinks(real.storage, {
|
|
3555
|
+
const repaired = await repairKnowledgeLinks(real.storage, {
|
|
3481
3556
|
synced: working.links.flatMap((work) => "sync" in work ? [work.sync] : []),
|
|
3482
3557
|
refreshed: working.links.flatMap((work) => "refresh" in work ? [{
|
|
3483
3558
|
page: work.refresh,
|
|
3484
3559
|
withDescendants: work.withDescendants
|
|
3485
3560
|
}] : [])
|
|
3486
|
-
});
|
|
3561
|
+
}, { limit: linkBudget });
|
|
3562
|
+
linkBudget -= repaired.rewritten;
|
|
3563
|
+
if (repaired.deferred.length) linksDeferred = await deferLinkRepairs(real.importers, repaired.deferred);
|
|
3487
3564
|
} catch (error) {
|
|
3488
3565
|
if (error instanceof KnowledgeLinkRepairUnsupportedError) throw new BatchFallback(error.reason);
|
|
3489
3566
|
if (error instanceof KnowledgeUnsupportedCapabilityError) throw new BatchFallback(`link repair: ${error.name}`);
|
|
@@ -4186,6 +4263,7 @@ const hostFinish = (run, code) => {
|
|
|
4186
4263
|
function createLocalKnowledgeImporterHost(writer, options) {
|
|
4187
4264
|
const author = options.author ?? ((binding) => `importer:${binding.id}`);
|
|
4188
4265
|
const leaseMs = options.leaseMs;
|
|
4266
|
+
const settleBudgetMs = options.settleBudgetMs ?? DEFAULT_SETTLE_BUDGET_MS;
|
|
4189
4267
|
/** The clock leases are judged by: the store's under `leaseMs`, else this process's. */
|
|
4190
4268
|
const clock = async (importers) => leaseMs !== void 0 ? importers.now() : /* @__PURE__ */ new Date();
|
|
4191
4269
|
/** Why a running run is no longer live at `now`, or null while it is. */
|
|
@@ -4459,10 +4537,11 @@ function createLocalKnowledgeImporterHost(writer, options) {
|
|
|
4459
4537
|
after: restarting ? null : hostState[SETTLE_CURSOR_KEY] || null,
|
|
4460
4538
|
candidates: Math.max(1, SETTLE_CANDIDATES >> timeouts),
|
|
4461
4539
|
moves: SETTLE_MOVES,
|
|
4462
|
-
until: Math.min(Date.now() +
|
|
4540
|
+
until: Math.min(Date.now() + settleBudgetMs, deadlineAt),
|
|
4463
4541
|
onStart: () => {
|
|
4464
4542
|
settling = true;
|
|
4465
|
-
}
|
|
4543
|
+
},
|
|
4544
|
+
state: hostState
|
|
4466
4545
|
} } : {}
|
|
4467
4546
|
});
|
|
4468
4547
|
if (applied.fallback) fallbackWarning = `Knowledge importer: flush ${flush.seq} of run ${run.id} saved op by op instead of batched (${applied.fallback})`;
|
|
@@ -4488,6 +4567,7 @@ function createLocalKnowledgeImporterHost(writer, options) {
|
|
|
4488
4567
|
...applied.counts,
|
|
4489
4568
|
refused: applied.refused,
|
|
4490
4569
|
pending: settled?.pending ?? false,
|
|
4570
|
+
...settled?.linksPending ? { linksPending: settled.linksPending } : {},
|
|
4491
4571
|
...applied.fallback ? { fallback: applied.fallback } : {}
|
|
4492
4572
|
};
|
|
4493
4573
|
await importers.recordFlush({
|
|
@@ -4500,6 +4580,7 @@ function createLocalKnowledgeImporterHost(writer, options) {
|
|
|
4500
4580
|
...applied.counts,
|
|
4501
4581
|
refused: applied.refused.length,
|
|
4502
4582
|
settled: settled?.settled ?? 0,
|
|
4583
|
+
...applied.linksRepaired ? { linksRepaired: applied.linksRepaired } : {},
|
|
4503
4584
|
...applied.fallback ? { fallbacks: 1 } : {}
|
|
4504
4585
|
}
|
|
4505
4586
|
});
|
|
@@ -4642,10 +4723,13 @@ function createLocalKnowledgeImporterHost(writer, options) {
|
|
|
4642
4723
|
});
|
|
4643
4724
|
return runReceipt(canceled);
|
|
4644
4725
|
}
|
|
4645
|
-
const
|
|
4726
|
+
const lastReceipt = (run.lastSeq > 0 ? await importers.getFlush(run.id, run.generation, run.lastSeq) : null)?.receipt;
|
|
4727
|
+
const pending = lastReceipt?.pending === true;
|
|
4728
|
+
const linksPending = (lastReceipt?.linksPending ?? 0) > 0;
|
|
4646
4729
|
const binding = await importers.getBinding(run.bindingId);
|
|
4647
4730
|
const gaveUp = !!binding && settleTimeouts(await importers.getState(binding.id), run.id) >= SETTLE_MAX_TIMEOUTS;
|
|
4648
|
-
const
|
|
4731
|
+
const linksRepaired = (run.counts.linksRepaired ?? 0) > 0;
|
|
4732
|
+
const chain = normalized.backlog || normalized.outcome === "succeeded" && pending && !gaveUp && ((run.counts.settled ?? 0) > 0 || linksPending && linksRepaired && settleBudgetMs > 0);
|
|
4649
4733
|
const finished = await importers.finishRun({
|
|
4650
4734
|
runId: run.id,
|
|
4651
4735
|
generation: request.generation,
|
|
@@ -6353,4 +6437,4 @@ var Knowledge = class extends MastraBase {
|
|
|
6353
6437
|
function createKnowledgeImporterHost(knowledge, options) {
|
|
6354
6438
|
return createLocalKnowledgeImporterHost(hostWriterOf(knowledge), options);
|
|
6355
6439
|
}
|
|
6356
|
-
export { DEFAULT_KNOWLEDGE_PAGE_GRAPH_LIMITS, InMemoryKnowledgeStorage, KNOWLEDGE_IMPORTER_ERROR_CODES, REMOVED_PARENT_BODY as KNOWLEDGE_IMPORT_REMOVED_PARENT_BODY, KNOWLEDGE_STORAGE_CONTRACT_VERSION, KNOWLEDGE_STORAGE_SCHEMA_VERSION, Knowledge, KnowledgeConflictError, KnowledgeDeclarationError, KnowledgeImporter, KnowledgeImporterBase, KnowledgeImporterBindingConflictError, KnowledgeImporterCredentialsError, KnowledgeImporterDefinitionError, KnowledgeImporterHostConflictError, KnowledgeImporterHostError, KnowledgeImporterRunStateError, KnowledgeImporterSettingsError, KnowledgeImporterSourceError, KnowledgeImportersStorage, KnowledgeInvalidCursorError, KnowledgeMoveTooLargeError, KnowledgeNotFoundError, KnowledgePageDepthError, KnowledgePageHasChildrenError, KnowledgePageKeyConflictError, KnowledgeSchemaResetRequiredError, KnowledgeStorage, KnowledgeTransactionDeadlineError, KnowledgeUnsupportedCapabilityError, MAX_KNOWLEDGE_EXPLORER_PAGE_LINKS, MAX_KNOWLEDGE_LINK_COUNT_PAGES, MAX_KNOWLEDGE_MOVE_PAGES, MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH, MAX_KNOWLEDGE_NOTE_TOKENS, MAX_KNOWLEDGE_PAGE_BODY_LINKS, MAX_KNOWLEDGE_PAGE_DEPTH, MAX_KNOWLEDGE_PAGE_DESCRIPTION_TOKENS, MAX_KNOWLEDGE_PAGE_LINKS, MAX_KNOWLEDGE_PAGE_LINK_REF_LENGTH, MAX_KNOWLEDGE_PAGE_LIST_LIMIT, MAX_KNOWLEDGE_PIN_LIST_DEPTH, MAX_KNOWLEDGE_RECORD_TEXT_LENGTH, MAX_KNOWLEDGE_SCOPE_TAGS, assertKnowledgeCeilingRaised, assertKnowledgeDescriptionWithinBound, assertKnowledgeNoteTextWithinBound, assertKnowledgePageDescriptionWithinBound, assertKnowledgeRecordTextWithinBound, assertKnowledgeSchemaCompatible, assertKnowledgeScopeWithinCeiling, canonicalJson, canonicalKnowledgeName, canonicalizeKnowledgeScope, createKnowledgeImporterHost, createKnowledgeNodeCursor, createKnowledgeUlid, decodeKnowledgeScopeId, encodeKnowledgeScopeId, expandKnowledgeScope, importerHostConformance, inspectKnowledgeSchema, isKnowledgeScopeVisible, knowledgeAgentScopes, knowledgeImportKey, knowledgeImporterFlushDigest, knowledgeImporterRegistry, knowledgeLinkRefKey, knowledgeMemoryScopes, knowledgePagePath, knowledgePersonaScopes, knowledgePinDepth, knowledgePositionBetween, knowledgeScopeAddress, knowledgeScopeKey, knowledgeScopeReadable, knowledgeSemanticDocumentId, knowledgeSemanticIdempotencyKey, knowledgeVisibleScopeKeys, listKnowledgeTreeChildren, normalizeKnowledgeImporterFinish, parseKnowledgeImporterFlushBody, parseKnowledgeNodeCursor, parseKnowledgePageRef, parseKnowledgeWikilinks, readKnowledgePage, readKnowledgePageActivity, readKnowledgePageGraph, readKnowledgePageLinkCounts, readKnowledgePageLinks, readKnowledgeScopeGrants, runKnowledgeImport, searchKnowledgeExplorerPages };
|
|
6440
|
+
export { DEFAULT_KNOWLEDGE_PAGE_GRAPH_LIMITS, InMemoryKnowledgeStorage, KNOWLEDGE_IMPORTER_ERROR_CODES, REMOVED_PARENT_BODY as KNOWLEDGE_IMPORT_REMOVED_PARENT_BODY, KNOWLEDGE_STORAGE_CONTRACT_VERSION, KNOWLEDGE_STORAGE_SCHEMA_VERSION, Knowledge, KnowledgeConflictError, KnowledgeDeclarationError, KnowledgeImporter, KnowledgeImporterBase, KnowledgeImporterBindingConflictError, KnowledgeImporterCredentialsError, KnowledgeImporterDefinitionError, KnowledgeImporterHostConflictError, KnowledgeImporterHostError, KnowledgeImporterRunStateError, KnowledgeImporterSettingsError, KnowledgeImporterSourceError, KnowledgeImportersStorage, KnowledgeInvalidCursorError, KnowledgeInvalidSearchError, KnowledgeMoveTooLargeError, KnowledgeNotFoundError, KnowledgePageDepthError, KnowledgePageHasChildrenError, KnowledgePageKeyConflictError, KnowledgeSchemaResetRequiredError, KnowledgeStorage, KnowledgeTransactionDeadlineError, KnowledgeUnsupportedCapabilityError, MAX_KNOWLEDGE_EXPLORER_PAGE_LINKS, MAX_KNOWLEDGE_LINK_COUNT_PAGES, MAX_KNOWLEDGE_MOVE_PAGES, MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH, MAX_KNOWLEDGE_NOTE_TOKENS, MAX_KNOWLEDGE_PAGE_BODY_LINKS, MAX_KNOWLEDGE_PAGE_DEPTH, MAX_KNOWLEDGE_PAGE_DESCRIPTION_TOKENS, MAX_KNOWLEDGE_PAGE_LINKS, MAX_KNOWLEDGE_PAGE_LINK_REF_LENGTH, MAX_KNOWLEDGE_PAGE_LIST_LIMIT, MAX_KNOWLEDGE_PIN_LIST_DEPTH, MAX_KNOWLEDGE_RECORD_TEXT_LENGTH, MAX_KNOWLEDGE_SCOPE_TAGS, assertKnowledgeCeilingRaised, assertKnowledgeDescriptionWithinBound, assertKnowledgeNoteTextWithinBound, assertKnowledgePageDescriptionWithinBound, assertKnowledgeRecordTextWithinBound, assertKnowledgeSchemaCompatible, assertKnowledgeScopeWithinCeiling, canonicalJson, canonicalKnowledgeName, canonicalizeKnowledgeScope, createKnowledgeImporterHost, createKnowledgeNodeCursor, createKnowledgeUlid, decodeKnowledgeScopeId, encodeKnowledgeScopeId, expandKnowledgeScope, importerHostConformance, inspectKnowledgeSchema, isKnowledgeScopeVisible, knowledgeAgentScopes, knowledgeImportKey, knowledgeImporterFlushDigest, knowledgeImporterRegistry, knowledgeLinkRefKey, knowledgeMemoryScopes, knowledgePagePath, knowledgePersonaScopes, knowledgePinDepth, knowledgePositionBetween, knowledgeScopeAddress, knowledgeScopeKey, knowledgeScopeReadable, knowledgeSemanticDocumentId, knowledgeSemanticIdempotencyKey, knowledgeVisibleScopeKeys, listKnowledgeTreeChildren, normalizeKnowledgeImporterFinish, parseKnowledgeImporterFlushBody, parseKnowledgeNodeCursor, parseKnowledgePageRef, parseKnowledgeWikilinks, readKnowledgePage, readKnowledgePageActivity, readKnowledgePageGraph, readKnowledgePageLinkCounts, readKnowledgePageLinks, readKnowledgeScopeGrants, runKnowledgeImport, searchKnowledgeExplorerPages };
|
|
@@ -32,6 +32,11 @@ export declare const MAX_KNOWLEDGE_LINK_REFRESH_SOURCES = 100;
|
|
|
32
32
|
* their targets until `knowledge.reindexLinks()` runs; the write reports it.
|
|
33
33
|
*/
|
|
34
34
|
export declare const MAX_KNOWLEDGE_LINK_REFRESH_NAMESAKES: number;
|
|
35
|
+
/**
|
|
36
|
+
* Most linking pages one batched {@link repairKnowledgeLinks} re-resolves by default, in chunks of
|
|
37
|
+
* {@link MAX_KNOWLEDGE_LINK_REFRESH_SOURCES}; it hands back the rest for the caller to repair later.
|
|
38
|
+
*/
|
|
39
|
+
export declare const MAX_KNOWLEDGE_LINK_REPAIR_SOURCES = 1000;
|
|
35
40
|
/**
|
|
36
41
|
* A link refresh that landed but stopped at {@link MAX_KNOWLEDGE_LINK_REFRESH_SOURCES} linking pages
|
|
37
42
|
* or {@link MAX_KNOWLEDGE_LINK_REFRESH_NAMESAKES} namesakes: the rest keep their links until they're
|
|
@@ -59,8 +64,8 @@ export declare function updateKnowledgeLinks(warn: ((message: string) => void) |
|
|
|
59
64
|
export declare function reindexKnowledgeLinks(storage: KnowledgeStorage): Promise<number>;
|
|
60
65
|
/**
|
|
61
66
|
* A batched link repair that would stop at a cap the op-by-op refreshes enforce one write at a time
|
|
62
|
-
* (
|
|
63
|
-
*
|
|
67
|
+
* (namesakes, subtree size): the caller saves op by op instead, so the caps apply exactly as they do
|
|
68
|
+
* there.
|
|
64
69
|
*/
|
|
65
70
|
export declare class KnowledgeLinkRepairUnsupportedError extends Error {
|
|
66
71
|
readonly reason: string;
|
|
@@ -79,10 +84,18 @@ export interface KnowledgeLinkRepair {
|
|
|
79
84
|
}
|
|
80
85
|
/**
|
|
81
86
|
* Every {@link syncKnowledgePageBodyLinks} and {@link refreshKnowledgeLinksTo} of a flush, run once
|
|
82
|
-
* over the store as the flush left it,
|
|
83
|
-
*
|
|
84
|
-
*
|
|
87
|
+
* over the store as the flush left it, a few statements per chunk of up to
|
|
88
|
+
* {@link MAX_KNOWLEDGE_LINK_REFRESH_SOURCES} pages: each page's links come out as they do when the
|
|
89
|
+
* calls run one after another after the writes. Linking pages past `limit` (default
|
|
90
|
+
* {@link MAX_KNOWLEDGE_LINK_REPAIR_SOURCES}), in page id order, keep their links and come back in
|
|
91
|
+
* `deferred`; the synced pages are always written. Throws {@link KnowledgeLinkRepairUnsupportedError},
|
|
92
|
+
* having written nothing, when a namesake or subtree cap could bite.
|
|
85
93
|
*/
|
|
86
|
-
export declare function repairKnowledgeLinks(storage: KnowledgeStorage, repair: KnowledgeLinkRepair
|
|
94
|
+
export declare function repairKnowledgeLinks(storage: KnowledgeStorage, repair: KnowledgeLinkRepair, options?: {
|
|
95
|
+
limit?: number;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
rewritten: number;
|
|
98
|
+
deferred: string[];
|
|
99
|
+
}>;
|
|
87
100
|
export {};
|
|
88
101
|
//# sourceMappingURL=links.d.ts.map
|
package/dist/llm/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_llm = require("../llm-
|
|
3
|
-
const require_netlify = require("../netlify-
|
|
4
|
-
const require_provider_registry = require("../provider-registry-
|
|
2
|
+
const require_llm = require("../llm-DqcaZBHM.cjs");
|
|
3
|
+
const require_netlify = require("../netlify-1Nz6N3ej.cjs");
|
|
4
|
+
const require_provider_registry = require("../provider-registry-D_cE6sCW.cjs");
|
|
5
5
|
exports.AzureOpenAIGateway = require_llm.AzureOpenAIGateway;
|
|
6
6
|
exports.EMBEDDING_MODELS = require_llm.EMBEDDING_MODELS;
|
|
7
7
|
exports.GATEWAY_AUTH_HEADER = require_netlify.GATEWAY_AUTH_HEADER;
|
package/dist/llm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ModelRouterLanguageModel, c as AzureOpenAIGateway, i as resolveModelConfig, l as defaultGateways, n as ModelRouterEmbeddingModel, r as resolveModelAuth, t as EMBEDDING_MODELS } from "../llm-
|
|
2
|
-
import { d as GATEWAY_AUTH_HEADER, g as getGatewayId, h as findGatewayForModel, r as ModelsDevGateway, t as NetlifyGateway, x as MastraModelGateway } from "../netlify-
|
|
3
|
-
import { c as modelSupportsStructuredOutput, f as MastraGateway, i as getProviderConfig, l as modelSupportsTemperature, n as PROVIDER_REGISTRY, r as getModelReasoningOptions, s as modelSupportsAttachments, t as GatewayRegistry, u as parseModelString } from "../provider-registry-
|
|
1
|
+
import { a as ModelRouterLanguageModel, c as AzureOpenAIGateway, i as resolveModelConfig, l as defaultGateways, n as ModelRouterEmbeddingModel, r as resolveModelAuth, t as EMBEDDING_MODELS } from "../llm-D4BaXbwZ.js";
|
|
2
|
+
import { d as GATEWAY_AUTH_HEADER, g as getGatewayId, h as findGatewayForModel, r as ModelsDevGateway, t as NetlifyGateway, x as MastraModelGateway } from "../netlify-CUG0Ko81.js";
|
|
3
|
+
import { c as modelSupportsStructuredOutput, f as MastraGateway, i as getProviderConfig, l as modelSupportsTemperature, n as PROVIDER_REGISTRY, r as getModelReasoningOptions, s as modelSupportsAttachments, t as GatewayRegistry, u as parseModelString } from "../provider-registry-BjBiRMhs.js";
|
|
4
4
|
export { AzureOpenAIGateway, EMBEDDING_MODELS, GATEWAY_AUTH_HEADER, GatewayRegistry, MastraGateway, MastraModelGateway, ModelRouterEmbeddingModel, ModelRouterLanguageModel, ModelsDevGateway, NetlifyGateway, PROVIDER_REGISTRY, defaultGateways, findGatewayForModel, getGatewayId, getModelReasoningOptions, getProviderConfig, modelSupportsAttachments, modelSupportsStructuredOutput, modelSupportsTemperature, parseModelString, resolveModelAuth, resolveModelConfig };
|