@mastra/core 1.87.0-alpha.10 → 1.87.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/@internal_core@0.1.4/dist/knowledge-compat/index.d.ts +49 -0
- package/dist/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/session.d.ts +11 -1
- package/dist/{agent-controller--gKWI81G.js → agent-controller-BrRzZy4-.js} +21 -12
- package/dist/{agent-controller-BolLBwDm.cjs → agent-controller-DKI-d-np.cjs} +21 -12
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-CgzXjBfE.js → background-tasks-CDP3Pgeu.js} +1 -1
- package/dist/{background-tasks-DYtlijQ1.cjs → background-tasks-CDgdfRmB.cjs} +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/{builder-Dz-g-9CZ.cjs → builder-Bs4CtyqT.cjs} +2 -2
- package/dist/{builder-emNPaIaC.js → builder-DuT0Iqb5.js} +2 -2
- package/dist/capabilities/302ai.json +201 -201
- package/dist/capabilities/abliteratedllm.json +38 -38
- package/dist/capabilities/abliteration-ai.json +4 -4
- package/dist/capabilities/above.json +19 -19
- package/dist/capabilities/adaption.json +13 -13
- package/dist/capabilities/adzuki.json +30 -30
- package/dist/capabilities/agentrouter.json +12 -12
- package/dist/capabilities/agnes.json +2 -2
- package/dist/capabilities/ai-router.json +4 -4
- package/dist/capabilities/aiand.json +23 -23
- package/dist/capabilities/aigrow.json +9 -9
- package/dist/capabilities/aimlapi.json +153 -153
- package/dist/capabilities/aipg.json +2 -2
- package/dist/capabilities/aixy.json +22 -22
- package/dist/capabilities/aki-io.json +10 -10
- package/dist/capabilities/alibaba-cn.json +99 -99
- package/dist/capabilities/alibaba-coding-plan-cn.json +6 -6
- package/dist/capabilities/alibaba-coding-plan.json +6 -6
- package/dist/capabilities/alibaba-token-plan-cn.json +51 -51
- package/dist/capabilities/alibaba-token-plan.json +52 -52
- package/dist/capabilities/alibaba.json +73 -73
- package/dist/capabilities/ambient.json +17 -17
- package/dist/capabilities/amd.json +10 -10
- package/dist/capabilities/anthropic.json +41 -41
- package/dist/capabilities/anyapi.json +47 -47
- package/dist/capabilities/apiko.json +4 -4
- package/dist/capabilities/arcee.json +11 -11
- package/dist/capabilities/augure.json +6 -6
- package/dist/capabilities/auriko.json +18 -18
- package/dist/capabilities/bailing.json +4 -4
- package/dist/capabilities/baseten.json +33 -33
- package/dist/capabilities/bee.json +5 -5
- package/dist/capabilities/berget.json +6 -6
- package/dist/capabilities/bothub.json +10 -10
- package/dist/capabilities/boundless.json +34 -34
- package/dist/capabilities/bumo.json +43 -43
- package/dist/capabilities/byteplus.json +31 -31
- package/dist/capabilities/cheapaimodel.json +5 -5
- package/dist/capabilities/cheapest-token.json +27 -27
- package/dist/capabilities/chutes.json +10 -10
- package/dist/capabilities/clarifai.json +2 -2
- package/dist/capabilities/cline-pass.json +37 -37
- package/dist/capabilities/cloudcode.json +8 -8
- package/dist/capabilities/cloudferro-sherlock.json +4 -4
- package/dist/capabilities/cloudflare-workers-ai.json +17 -17
- package/dist/capabilities/commandcode.json +151 -151
- package/dist/capabilities/concentrate.json +277 -269
- package/dist/capabilities/cortecs.json +108 -108
- package/dist/capabilities/crossmodel.json +172 -172
- package/dist/capabilities/crusoe.json +16 -16
- package/dist/capabilities/daoxe.json +8 -8
- package/dist/capabilities/databricks.json +128 -128
- package/dist/capabilities/deepinfra.json +97 -91
- package/dist/capabilities/deepseek.json +3 -3
- package/dist/capabilities/digitalocean.json +113 -113
- package/dist/capabilities/dothoosh.json +23 -23
- package/dist/capabilities/doubleword.json +27 -27
- package/dist/capabilities/edenai.json +279 -279
- package/dist/capabilities/empiriolabs.json +160 -160
- package/dist/capabilities/engy.json +20 -20
- package/dist/capabilities/entrim.json +8 -8
- package/dist/capabilities/evroc.json +18 -18
- package/dist/capabilities/ezkielyna.json +11 -11
- package/dist/capabilities/fastrouter.json +87 -87
- package/dist/capabilities/fireworks-ai.json +83 -83
- package/dist/capabilities/freemodel.json +19 -19
- package/dist/capabilities/friendli.json +7 -7
- package/dist/capabilities/frogbot.json +88 -88
- package/dist/capabilities/gisoo.json +18 -18
- package/dist/capabilities/gmicloud.json +20 -20
- package/dist/capabilities/google.json +55 -55
- package/dist/capabilities/graphn.json +6 -6
- package/dist/capabilities/greenpt.json +34 -34
- package/dist/capabilities/helicone.json +81 -81
- package/dist/capabilities/hetzner.json +5 -5
- package/dist/capabilities/hopper.json +2 -2
- package/dist/capabilities/hostinger-router.json +10 -10
- package/dist/capabilities/hpc-ai.json +11 -11
- package/dist/capabilities/huawei-maas.json +15 -15
- package/dist/capabilities/hubris.json +31 -31
- package/dist/capabilities/huggingface.json +93 -85
- package/dist/capabilities/humain.json +2 -2
- package/dist/capabilities/hyper.json +27 -27
- package/dist/capabilities/impossibl.json +165 -165
- package/dist/capabilities/inception.json +3 -3
- package/dist/capabilities/inceptron.json +8 -8
- package/dist/capabilities/inco.json +5 -5
- package/dist/capabilities/infer.json +13 -13
- package/dist/capabilities/inferall.json +6 -6
- package/dist/capabilities/inference-coop.json +15 -15
- package/dist/capabilities/inferenceapis.json +20 -20
- package/dist/capabilities/inferris.json +3 -3
- package/dist/capabilities/infersia.json +8 -8
- package/dist/capabilities/infomaniak.json +4 -4
- package/dist/capabilities/io-net.json +5 -5
- package/dist/capabilities/iteracompute.json +29 -29
- package/dist/capabilities/jad-ai.json +3 -3
- package/dist/capabilities/jalapeno.json +11 -11
- package/dist/capabilities/jiekou.json +61 -61
- package/dist/capabilities/joingonka.json +4 -4
- package/dist/capabilities/jzstoken.json +57 -57
- package/dist/capabilities/keln.json +23 -23
- package/dist/capabilities/kenari.json +121 -121
- package/dist/capabilities/kilo.json +615 -615
- 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 +4 -4
- package/dist/capabilities/klavo.json +13 -13
- package/dist/capabilities/korouter.json +29 -29
- package/dist/capabilities/kunavo.json +2 -2
- package/dist/capabilities/liquid.json +10 -10
- package/dist/capabilities/lithosai.json +3 -3
- package/dist/capabilities/llmgateway-providers.json +926 -926
- package/dist/capabilities/llmgateway.json +330 -330
- package/dist/capabilities/llmtr.json +26 -26
- package/dist/capabilities/logits.json +2 -2
- package/dist/capabilities/longcat.json +2 -2
- package/dist/capabilities/lowrouter.json +65 -65
- package/dist/capabilities/lyceum.json +8 -8
- package/dist/capabilities/melious.json +9 -9
- package/dist/capabilities/merge-gateway.json +269 -269
- package/dist/capabilities/meta.json +8 -8
- package/dist/capabilities/mistral.json +19 -19
- package/dist/capabilities/mixlayer.json +4 -4
- package/dist/capabilities/modal.json +11 -11
- package/dist/capabilities/model-oracle-ai.json +24 -24
- package/dist/capabilities/modelis.json +23 -23
- package/dist/capabilities/modelscope.json +2 -2
- package/dist/capabilities/modular.json +13 -13
- package/dist/capabilities/moneo.json +8 -8
- package/dist/capabilities/moonshotai-cn.json +6 -6
- package/dist/capabilities/moonshotai.json +6 -6
- package/dist/capabilities/morph.json +15 -15
- package/dist/capabilities/munito-eu.json +8 -8
- package/dist/capabilities/munito.json +10 -10
- package/dist/capabilities/nan.json +28 -28
- package/dist/capabilities/nano-gpt.json +578 -578
- package/dist/capabilities/nearai.json +106 -106
- package/dist/capabilities/nebius.json +32 -32
- package/dist/capabilities/neon.json +121 -121
- package/dist/capabilities/neuralwatt.json +40 -40
- package/dist/capabilities/nokeep.json +4 -4
- package/dist/capabilities/novita-ai.json +148 -148
- package/dist/capabilities/nvidia.json +44 -44
- package/dist/capabilities/oathbreaker.json +5 -5
- package/dist/capabilities/obscurify.json +24 -24
- package/dist/capabilities/oci.json +6 -6
- package/dist/capabilities/ofox.json +349 -349
- package/dist/capabilities/ollama-cloud.json +54 -54
- package/dist/capabilities/openai.json +59 -59
- package/dist/capabilities/opencode-go.json +84 -84
- package/dist/capabilities/openrouter.json +538 -539
- package/dist/capabilities/opper.json +25 -25
- package/dist/capabilities/orcarouter.json +206 -206
- package/dist/capabilities/outerlabs.json +28 -28
- package/dist/capabilities/ovhcloud.json +19 -19
- package/dist/capabilities/pareto.json +5 -5
- package/dist/capabilities/pendra.json +4 -4
- package/dist/capabilities/perplexity-agent.json +62 -62
- package/dist/capabilities/phala.json +20 -20
- package/dist/capabilities/pioneer.json +32 -32
- package/dist/capabilities/poe.json +131 -131
- package/dist/capabilities/poolside.json +2 -2
- package/dist/capabilities/powerspring.json +11 -11
- package/dist/capabilities/primalabs.json +7 -7
- package/dist/capabilities/prime.json +112 -112
- package/dist/capabilities/privatemode-ai.json +11 -11
- package/dist/capabilities/proxystacks.json +6 -6
- package/dist/capabilities/qiniu-ai.json +14 -14
- package/dist/capabilities/refuseless.json +10 -10
- package/dist/capabilities/regolo-ai.json +5 -5
- package/dist/capabilities/requesty.json +259 -200
- package/dist/capabilities/ruapi.json +16 -16
- package/dist/capabilities/runcrate.json +15 -15
- package/dist/capabilities/runinfra.json +19 -19
- package/dist/capabilities/sakana.json +7 -7
- package/dist/capabilities/sandbase.json +21 -21
- package/dist/capabilities/sarvam.json +11 -11
- package/dist/capabilities/scaleway.json +16 -16
- package/dist/capabilities/scnet-token-plan.json +10 -10
- package/dist/capabilities/scx-ai.json +21 -21
- package/dist/capabilities/sensenova.json +15 -15
- package/dist/capabilities/siliconflow-cn.json +58 -58
- package/dist/capabilities/siliconflow.json +61 -61
- package/dist/capabilities/snowflake-cortex.json +18 -18
- package/dist/capabilities/sokkan.json +5 -5
- package/dist/capabilities/sparrowcodes.json +20 -20
- package/dist/capabilities/standardcompute.json +95 -95
- package/dist/capabilities/steadyrouter.json +33 -33
- package/dist/capabilities/stepfun-ai-step-plan.json +4 -4
- package/dist/capabilities/stepfun-ai.json +4 -4
- package/dist/capabilities/stepfun-step-plan.json +4 -4
- package/dist/capabilities/stepfun.json +4 -4
- package/dist/capabilities/stepping-stone.json +17 -17
- package/dist/capabilities/superbot-gg.json +4 -4
- package/dist/capabilities/synthetic.json +11 -11
- package/dist/capabilities/synthorai.json +23 -23
- package/dist/capabilities/teamorouter.json +22 -22
- package/dist/capabilities/teapot-router.json +15 -15
- package/dist/capabilities/tencent-token-plan-intl.json +22 -22
- package/dist/capabilities/tencent-token-plan.json +43 -43
- package/dist/capabilities/tencent-tokenhub.json +47 -47
- package/dist/capabilities/tensorx.json +37 -37
- package/dist/capabilities/tenstorrent.json +8 -8
- package/dist/capabilities/the-grid-ai.json +30 -30
- package/dist/capabilities/thinkingmachines.json +78 -78
- package/dist/capabilities/tinfoil.json +9 -9
- package/dist/capabilities/togetherai.json +55 -55
- package/dist/capabilities/tokengo.json +19 -19
- package/dist/capabilities/tokenify.json +2 -2
- package/dist/capabilities/trustedrouter.json +6 -6
- package/dist/capabilities/trustedtokens.json +17 -17
- package/dist/capabilities/umans-ai-coding-plan.json +14 -14
- package/dist/capabilities/umans-ai.json +10 -10
- package/dist/capabilities/uncensuredai.json +4 -4
- package/dist/capabilities/unrestricted.json +6 -6
- package/dist/capabilities/uplinkswitch.json +21 -21
- package/dist/capabilities/upstage.json +6 -6
- package/dist/capabilities/vancine.json +16 -16
- package/dist/capabilities/vercel.json +578 -578
- package/dist/capabilities/vivgrid.json +86 -86
- package/dist/capabilities/volcengine-coding-plan.json +26 -26
- package/dist/capabilities/volcengine.json +23 -23
- package/dist/capabilities/vultr.json +34 -34
- package/dist/capabilities/wafer.ai.json +17 -17
- package/dist/capabilities/wallaby.json +2 -2
- package/dist/capabilities/wally.json +13 -13
- package/dist/capabilities/wandb.json +21 -21
- package/dist/capabilities/watt.json +26 -26
- 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 +3 -3
- package/dist/capabilities/xpersona.json +12 -12
- package/dist/capabilities/xxapi.json +28 -28
- package/dist/capabilities/zai-coding-plan.json +18 -18
- package/dist/capabilities/zai.json +30 -30
- package/dist/capabilities/zenifra.json +31 -31
- package/dist/capabilities/zenmux.json +202 -202
- package/dist/capabilities/zerogpu.json +8 -8
- package/dist/capabilities/zhipuai-coding-plan.json +6 -6
- package/dist/capabilities/zhipuai.json +28 -28
- package/dist/capabilities/zro.json +4 -4
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/{channels-BVnDIsZS.cjs → channels-Bkd_v8M1.cjs} +1 -1
- package/dist/{channels-CndspFXP.js → channels-CkRMEIQ6.js} +1 -1
- package/dist/coding-agent/index.cjs +1 -1
- package/dist/coding-agent/index.js +1 -1
- 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 +570 -570
- package/dist/docs/references/reference-agent-controller-session.md +29 -1
- package/dist/evals/index.cjs +1 -1
- package/dist/evals/index.js +1 -1
- package/dist/evals/scoreTraces/index.cjs +1 -1
- package/dist/evals/scoreTraces/index.js +1 -1
- package/dist/harness/index.cjs +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/importers/overlay.d.ts +138 -0
- package/dist/knowledge/importers/sink.d.ts +6 -0
- package/dist/knowledge/importers/types.d.ts +5 -0
- package/dist/knowledge/index.cjs +1412 -139
- package/dist/knowledge/index.js +1412 -139
- package/dist/knowledge/links.d.ts +27 -0
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/provider-types.generated.d.ts +7619 -7605
- package/dist/{llm-B1semiTO.cjs → llm-DAw2eouV.cjs} +2 -2
- package/dist/{llm-CytL7cpw.js → llm-DFT5EKp4.js} +2 -2
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/{manager-DnTzA9GL.js → manager-DiDnvKLM.js} +2 -2
- package/dist/{manager-BwyfS4ha.cjs → manager-hxzEe4U5.cjs} +2 -2
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-Dj35Lj_J.cjs → mastra-1diaq68N.cjs} +16 -16
- package/dist/{mastra-DTkZPpch.js → mastra-BPaPxG5t.js} +16 -16
- package/dist/memory/index.cjs +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{model-DyQ07rPH.js → model-CUBZjm0T.js} +1 -1
- package/dist/{model-eDfetuno.cjs → model-DSMHJM3c.cjs} +1 -1
- package/dist/{netlify-BC4v7Ufv.cjs → netlify-C21T9ozJ.cjs} +1 -1
- package/dist/{netlify-BUvdxfHe.js → netlify-D1BKjns0.js} +1 -1
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/processor-provider/index.cjs +1 -1
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +2 -2
- package/dist/processors/index.js +2 -2
- package/dist/{provider-registry-CP_5SNiw.js → provider-registry-BAlFFX5o.js} +22725 -22697
- package/dist/{provider-registry-Bn01gq9y.cjs → provider-registry-ChojUVJa.cjs} +22725 -22697
- package/dist/provider-registry.json +22472 -22444
- package/dist/{registry-generator-CDPyxbzt.js → registry-generator-BbWSH6W4.js} +1 -1
- package/dist/{registry-generator-CNFKGRFQ.cjs → registry-generator-CAUL9Hek.cjs} +1 -1
- package/dist/{rehydrate-DExpzlNS.cjs → rehydrate-0xSq47n9.cjs} +2 -2
- package/dist/{rehydrate-CnGNY2zq.js → rehydrate-CzUnNFU6.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-CibQoN6K.cjs → run-registry-CrTsH9iL.cjs} +403 -11
- package/dist/{run-registry-BL_kKvFE.js → run-registry-DJT02z_9.js} +380 -12
- package/dist/storage/domains/knowledge/base.d.ts +86 -1
- package/dist/storage/domains/knowledge/importers-inmemory.d.ts +9 -0
- package/dist/storage/domains/knowledge/importers.d.ts +31 -0
- package/dist/storage/domains/knowledge/inmemory.d.ts +7 -0
- package/dist/storage/domains/knowledge/pages-inmemory.d.ts +31 -1
- package/dist/storage/domains/knowledge/pages.d.ts +74 -0
- package/dist/storage/index.cjs +2 -2
- package/dist/storage/index.js +2 -2
- package/dist/storage/types.d.ts +6 -0
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-1DGoEkG2.js → stream-CG9OooRx.js} +1 -1
- package/dist/{stream-D_7tMaJe.cjs → stream-CMKRczs4.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-CLB1r3X3.cjs → tool-loop-agent-14o3Z1qo.cjs} +3 -3
- package/dist/{tool-loop-agent-BXya_RYj.js → tool-loop-agent-Bi6z_q7o.js} +3 -3
- package/dist/{utils-B-KOMA_Q.cjs → utils-DkvbP8EA.cjs} +1 -1
- package/dist/{utils-C55ZdVaj.js → utils-Fag7YDBU.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-CmZhnsmX.cjs → validate-Bhrlve2E.cjs} +1 -1
- package/dist/{validate-BDfYr72F.js → validate-DLER0nlQ.js} +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-D2B-x7Le.cjs → worker-0gczpztM.cjs} +2 -2
- package/dist/{worker-BoybIUTI.cjs → worker-BwJyrFQN.cjs} +2 -2
- package/dist/{worker-BG1rw_dg.js → worker-D-em3hyS.js} +2 -2
- package/dist/{worker-CuK2RaC0.js → worker-leYV1Y91.js} +2 -2
- package/dist/{workflow-CTKqeRXU.cjs → workflow-DWdcEcxw.cjs} +3 -3
- package/dist/{workflow-Bt09PcH1.js → workflow-FikHVwog.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/package.json +8 -8
- package/src/llm/model/provider-types.generated.d.ts +7619 -7605
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as getCapabilityFileName, g as shouldEnableGateway, m as getGatewayId } from "./netlify-
|
|
1
|
+
import { _ as getCapabilityFileName, g as shouldEnableGateway, m as getGatewayId } from "./netlify-D1BKjns0.js";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import fs from "fs/promises";
|
|
4
4
|
// src/llm/model/registry-generator.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-BrhgMLW6.cjs");
|
|
2
|
-
const require_netlify = require("./netlify-
|
|
2
|
+
const require_netlify = require("./netlify-C21T9ozJ.cjs");
|
|
3
3
|
let path = require("path");
|
|
4
4
|
path = require_rolldown_runtime.__toESM(path, 1);
|
|
5
5
|
let fs_promises = require("fs/promises");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_run_registry = require("./run-registry-
|
|
1
|
+
const require_run_registry = require("./run-registry-CrTsH9iL.cjs");
|
|
2
2
|
const require_predicate_index = require("./predicate/index.cjs");
|
|
3
|
-
const require_validate = require("./validate-
|
|
3
|
+
const require_validate = require("./validate-Bhrlve2E.cjs");
|
|
4
4
|
let _mastra_schema_compat_schema = require("@mastra/schema-compat/schema");
|
|
5
5
|
// src/workflows/dynamic/serialize.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gs as createEventedWorkflow, Ks as createWorkflow, Nc as mapVariable, Pc as predicateToCondition, Ws as cloneWorkflow, el as createStepFromAgent, gl as getSingleStepEntryId, nl as createStepFromTool } from "./run-registry-DJT02z_9.js";
|
|
2
2
|
import { derivePredicateLabel } from "./predicate/index.js";
|
|
3
|
-
import { a as jsonSchemaToZod, l as parseMapConfig } from "./validate-
|
|
3
|
+
import { a as jsonSchemaToZod, l as parseMapConfig } from "./validate-DLER0nlQ.js";
|
|
4
4
|
import { standardSchemaToJSONSchema, toStandardSchema } from "./schema/index.js";
|
|
5
5
|
// src/workflows/dynamic/serialize.ts
|
|
6
6
|
/**
|
package/dist/relevance/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_run_registry = require("../run-registry-
|
|
3
|
-
const require_stream = require("../stream-
|
|
2
|
+
const require_run_registry = require("../run-registry-CrTsH9iL.cjs");
|
|
3
|
+
const require_stream = require("../stream-CMKRczs4.cjs");
|
|
4
4
|
// src/relevance/relevance-score-provider.ts
|
|
5
5
|
function createSimilarityPrompt(query, text) {
|
|
6
6
|
return `Rate the semantic similarity between the following the query and the text on a scale from 0 to 1 (decimals allowed), where 1 means exactly the same meaning and 0 means completely different:
|
package/dist/relevance/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as Agent } from "../run-registry-
|
|
2
|
-
import { ln as isSupportedLanguageModel } from "../stream-
|
|
1
|
+
import { F as Agent } from "../run-registry-DJT02z_9.js";
|
|
2
|
+
import { ln as isSupportedLanguageModel } from "../stream-CG9OooRx.js";
|
|
3
3
|
// src/relevance/relevance-score-provider.ts
|
|
4
4
|
function createSimilarityPrompt(query, text) {
|
|
5
5
|
return `Rate the semantic similarity between the following the query and the text on a scale from 0 to 1 (decimals allowed), where 1 means exactly the same meaning and 0 means completely different:
|
|
@@ -4,14 +4,14 @@ const require_base = require("./base-BIzR1D3_.cjs");
|
|
|
4
4
|
const require_observability = require("./observability-B0R_D1PZ.cjs");
|
|
5
5
|
const require_error = require("./error-D90lJ6M7.cjs");
|
|
6
6
|
const require_error$1 = require("./error-L1V4uUbd.cjs");
|
|
7
|
-
const require_stream = require("./stream-
|
|
7
|
+
const require_stream = require("./stream-CMKRczs4.cjs");
|
|
8
8
|
const require_request_context = require("./request-context-D9RXYCy8.cjs");
|
|
9
9
|
const require_output_helpers = require("./output-helpers-DgsH4aTb.cjs");
|
|
10
10
|
const require_message_list = require("./message-list-vR3uLAHL.cjs");
|
|
11
11
|
const require_storage = require("./storage-CfG0I2aF.cjs");
|
|
12
12
|
const require_utils = require("./utils-D-eNsgDM.cjs");
|
|
13
13
|
const require_error_count = require("./error-count-DeDpeWU2.cjs");
|
|
14
|
-
const require_llm = require("./llm-
|
|
14
|
+
const require_llm = require("./llm-DAw2eouV.cjs");
|
|
15
15
|
const require_payload_transform = require("./payload-transform-CWgnsO9w.cjs");
|
|
16
16
|
const require_utils_safe_stringify = require("./utils/safe-stringify.cjs");
|
|
17
17
|
const require_signals = require("./signals-CWxAMEmE.cjs");
|
|
@@ -23,13 +23,13 @@ const require_tool = require("./tool-CYlT2UA-.cjs");
|
|
|
23
23
|
const require_toolchecks = require("./toolchecks-MFU48cit.cjs");
|
|
24
24
|
const require_fetchWithRetry = require("./fetchWithRetry-f5k4p7_1.cjs");
|
|
25
25
|
const require_model = require("./model-jBymoqGa.cjs");
|
|
26
|
-
const require_provider_registry = require("./provider-registry-
|
|
26
|
+
const require_provider_registry = require("./provider-registry-ChojUVJa.cjs");
|
|
27
27
|
const require_inmemory = require("./inmemory-Dc86VWGB.cjs");
|
|
28
28
|
const require_dynamic_argument = require("./dynamic-argument-CUc1BBOS.cjs");
|
|
29
|
-
const require_model$1 = require("./model-
|
|
30
|
-
const require_utils$1 = require("./utils-
|
|
29
|
+
const require_model$1 = require("./model-DSMHJM3c.cjs");
|
|
30
|
+
const require_utils$1 = require("./utils-DkvbP8EA.cjs");
|
|
31
31
|
const require_ee_iTj2bRDt = require("./ee-iTj2bRDt-D3-QLGDF.cjs");
|
|
32
|
-
const require_background_tasks = require("./background-tasks-
|
|
32
|
+
const require_background_tasks = require("./background-tasks-CDgdfRmB.cjs");
|
|
33
33
|
const require_stream$1 = require("./stream-BGbj9jAU.cjs");
|
|
34
34
|
const require_predicate_index = require("./predicate/index.cjs");
|
|
35
35
|
const require_classifier_index = require("./classifier/index.cjs");
|
|
@@ -39202,6 +39202,29 @@ function knowledgePageKeyProblem(key) {
|
|
|
39202
39202
|
if (!key) return "Knowledge page key must not be empty";
|
|
39203
39203
|
if (/[/#%]/.test(key)) return `Knowledge page key "${key}" must not contain "/", "#" or "%"`;
|
|
39204
39204
|
}
|
|
39205
|
+
const isRowWrite = (write) => write.op === "create" || write.op === "update" || write.op === "move" || write.op === "delete";
|
|
39206
|
+
/**
|
|
39207
|
+
* Throws unless the batch holds `applyPageWrites`' first rule: at most one create, one move and one
|
|
39208
|
+
* delete per page, no create, update or move of a page the batch deletes, and at most one write
|
|
39209
|
+
* per note (stores apply note removals before additions, so two writes of one note can't keep
|
|
39210
|
+
* input order).
|
|
39211
|
+
*/
|
|
39212
|
+
function assertKnowledgePageWritesBatchable(writes) {
|
|
39213
|
+
const rows = /* @__PURE__ */ new Map();
|
|
39214
|
+
const notes = /* @__PURE__ */ new Map();
|
|
39215
|
+
for (const write of writes) {
|
|
39216
|
+
if (isRowWrite(write)) rows.set(write.id, [...rows.get(write.id) ?? [], write.op]);
|
|
39217
|
+
if ((write.op === "add-note" || write.op === "remove-note") && write.id !== void 0) {
|
|
39218
|
+
const seen = notes.get(write.id);
|
|
39219
|
+
if (seen !== void 0) throw new Error(`Knowledge page writes can't apply ${seen}, ${write.op} to note ${write.id} in one batch`);
|
|
39220
|
+
notes.set(write.id, write.op);
|
|
39221
|
+
}
|
|
39222
|
+
}
|
|
39223
|
+
for (const [id, ops] of rows) {
|
|
39224
|
+
const count = (op) => ops.filter((o) => o === op).length;
|
|
39225
|
+
if (count("create") > 1 || count("move") > 1 || count("delete") > 1 || count("delete") === 1 && ops.length > 1) throw new Error(`Knowledge page writes can't apply ${ops.join(", ")} to page ${id} in one batch`);
|
|
39226
|
+
}
|
|
39227
|
+
}
|
|
39205
39228
|
// src/storage/domains/knowledge/pages.ts
|
|
39206
39229
|
/**
|
|
39207
39230
|
* Knowledge storage contract, schema 4: pages, notes, stamps, mentions, body links and pins.
|
|
@@ -40039,6 +40062,10 @@ var InMemoryKnowledgeImportersStorage = class extends KnowledgeImportersStorage
|
|
|
40039
40062
|
const node = [...this.#s.nodes.values()].find((n) => n.pageId === pageId);
|
|
40040
40063
|
return node ? structuredClone(node) : null;
|
|
40041
40064
|
}
|
|
40065
|
+
async getNodesByPages(pageIds) {
|
|
40066
|
+
const pages = new Set(pageIds);
|
|
40067
|
+
return [...this.#s.nodes.values()].filter((n) => pages.has(n.pageId)).map((n) => structuredClone(n));
|
|
40068
|
+
}
|
|
40042
40069
|
async saveNode(node) {
|
|
40043
40070
|
const owner = [...this.#s.nodes.values()].find((n) => n.pageId === node.pageId);
|
|
40044
40071
|
if (owner && (owner.bindingId !== node.bindingId || owner.sourceId !== node.sourceId)) throw new Error(`Knowledge page ${node.pageId} is already mapped to another imported node`);
|
|
@@ -40050,6 +40077,22 @@ var InMemoryKnowledgeImportersStorage = class extends KnowledgeImportersStorage
|
|
|
40050
40077
|
async deleteNode(bindingId, sourceId) {
|
|
40051
40078
|
this.#s.nodes.delete(key(bindingId, sourceId));
|
|
40052
40079
|
}
|
|
40080
|
+
async writeNodes(input) {
|
|
40081
|
+
const next = new Map(this.#s.nodes);
|
|
40082
|
+
for (const d of input.deletes) next.delete(key(d.bindingId, d.sourceId));
|
|
40083
|
+
const updatedAt = /* @__PURE__ */ new Date();
|
|
40084
|
+
for (const node of input.saves) next.set(key(node.bindingId, node.sourceId), structuredClone({
|
|
40085
|
+
...node,
|
|
40086
|
+
updatedAt
|
|
40087
|
+
}));
|
|
40088
|
+
const byPage = /* @__PURE__ */ new Map();
|
|
40089
|
+
for (const [k, node] of next) {
|
|
40090
|
+
const other = byPage.get(node.pageId);
|
|
40091
|
+
if (other !== void 0 && other !== k) throw new Error(`Knowledge page ${node.pageId} is already mapped to another imported node`);
|
|
40092
|
+
byPage.set(node.pageId, k);
|
|
40093
|
+
}
|
|
40094
|
+
this.#s.nodes = next;
|
|
40095
|
+
}
|
|
40053
40096
|
async listNodes(bindingId, options = {}) {
|
|
40054
40097
|
const limit = options.limit ?? 500;
|
|
40055
40098
|
const nodes = [...this.#s.nodes.values()].filter((n) => n.bindingId === bindingId && (options.after === void 0 || byteOrder(n.sourceId, options.after) > 0) && (!options.unsettled || n.unsettled)).sort((a, b) => byteOrder(a.sourceId, b.sourceId));
|
|
@@ -40102,6 +40145,9 @@ var InMemoryKnowledgeImportersStorage = class extends KnowledgeImportersStorage
|
|
|
40102
40145
|
change: structuredClone(change)
|
|
40103
40146
|
});
|
|
40104
40147
|
}
|
|
40148
|
+
async recordRunChanges(changes) {
|
|
40149
|
+
for (const change of changes) await this.recordRunChange(change);
|
|
40150
|
+
}
|
|
40105
40151
|
async listRunChanges(runId, options = {}) {
|
|
40106
40152
|
const limit = options.limit ?? 500;
|
|
40107
40153
|
const after = options.after === void 0 ? 0 : Number(options.after);
|
|
@@ -40447,10 +40493,53 @@ var InMemoryKnowledgePageStore = class {
|
|
|
40447
40493
|
}
|
|
40448
40494
|
return page && this.#pageReadable(page, input.read) ? clone$1(page) : null;
|
|
40449
40495
|
}
|
|
40496
|
+
async getPageChains(input) {
|
|
40497
|
+
const ids = [...new Set(input.ids)];
|
|
40498
|
+
const chains = await Promise.all(ids.map((id) => this.getPageParents({
|
|
40499
|
+
parentId: id,
|
|
40500
|
+
read: input.read
|
|
40501
|
+
})));
|
|
40502
|
+
return Object.fromEntries(ids.map((id, i) => [id, chains[i]]));
|
|
40503
|
+
}
|
|
40504
|
+
async getPagesByPaths(input) {
|
|
40505
|
+
return Promise.all(input.paths.map((path) => this.getPageByPath({
|
|
40506
|
+
scopeId: input.scopeId,
|
|
40507
|
+
path,
|
|
40508
|
+
read: input.read
|
|
40509
|
+
})));
|
|
40510
|
+
}
|
|
40511
|
+
async getLastChildPositions(input) {
|
|
40512
|
+
return Object.fromEntries([...new Set(input.parentIds)].map((id) => [id, this.#children(id).sort(byPosition).at(-1)?.position ?? null]));
|
|
40513
|
+
}
|
|
40514
|
+
async getPageSubtrees(input) {
|
|
40515
|
+
const out = Object.fromEntries(input.rootIds.map((id) => [id, null]));
|
|
40516
|
+
for (const rootId of new Set(input.rootIds)) {
|
|
40517
|
+
const pages = [];
|
|
40518
|
+
for (let i = -1; i < pages.length && pages.length <= input.limit; i++) {
|
|
40519
|
+
const parentId = i < 0 ? rootId : pages[i].id;
|
|
40520
|
+
pages.push(...this.#children(parentId).filter((page) => !page.isScope));
|
|
40521
|
+
}
|
|
40522
|
+
out[rootId] = pages.length > input.limit ? null : pages.map(clone$1);
|
|
40523
|
+
}
|
|
40524
|
+
return out;
|
|
40525
|
+
}
|
|
40526
|
+
async listNotesByPages(input) {
|
|
40527
|
+
const notes = Object.fromEntries([...new Set(input.pageIds)].map((id) => [id, []]));
|
|
40528
|
+
for (const note of [...this.#notes.values()].sort(oldestFirst)) if (Object.hasOwn(notes, note.pageId) && !note.deletedAt && this.#noteVisible(note, input.read)) notes[note.pageId].push(clone$1(note));
|
|
40529
|
+
return notes;
|
|
40530
|
+
}
|
|
40450
40531
|
async findPagesByName(input) {
|
|
40451
40532
|
const name = canonicalKnowledgeName(input.name);
|
|
40452
40533
|
return [...this.#pages.values()].filter((page) => !page.deletedAt && canonicalKnowledgeName(page.name) === name && (input.scopeId === void 0 || page.scopeId === input.scopeId) && this.#pageReadable(page, input.read)).sort(newestFirst).slice(0, pageSize(input.limit)).map(clone$1);
|
|
40453
40534
|
}
|
|
40535
|
+
async findPagesByNames(input) {
|
|
40536
|
+
const names = [...new Set(input.names)];
|
|
40537
|
+
const found = await Promise.all(names.map((name) => this.findPagesByName({
|
|
40538
|
+
...input,
|
|
40539
|
+
name
|
|
40540
|
+
})));
|
|
40541
|
+
return Object.fromEntries(names.map((name, i) => [name, found[i]]));
|
|
40542
|
+
}
|
|
40454
40543
|
async listChildPages(input) {
|
|
40455
40544
|
const { items, nextCursor } = paginate(this.#children(input.parentId).filter((page) => !page.isScope && this.#pageReadable(page, input.read)).sort(byPosition), input.cursor, input.limit);
|
|
40456
40545
|
return {
|
|
@@ -40546,6 +40635,63 @@ var InMemoryKnowledgePageStore = class {
|
|
|
40546
40635
|
...nextCursor ? { nextCursor } : {}
|
|
40547
40636
|
};
|
|
40548
40637
|
}
|
|
40638
|
+
/** The single writes, one by one in input order; all undone if one fails. */
|
|
40639
|
+
async applyPageWrites(input) {
|
|
40640
|
+
assertKnowledgePageWritesBatchable(input.writes);
|
|
40641
|
+
const before = this.snapshot();
|
|
40642
|
+
try {
|
|
40643
|
+
for (const write of input.writes) switch (write.op) {
|
|
40644
|
+
case "create": {
|
|
40645
|
+
const { op: _op, scopeId: _scope, depth: _depth, ...create } = write;
|
|
40646
|
+
await this.createPage(create);
|
|
40647
|
+
break;
|
|
40648
|
+
}
|
|
40649
|
+
case "update": {
|
|
40650
|
+
const { op: _op, scopeId: _scope, ...update } = write;
|
|
40651
|
+
await this.updatePage(update);
|
|
40652
|
+
break;
|
|
40653
|
+
}
|
|
40654
|
+
case "move": {
|
|
40655
|
+
const { op: _op, scopeId: _scope, fromScopeId: _from, depth: _depth, ...move } = write;
|
|
40656
|
+
await this.movePage(move);
|
|
40657
|
+
break;
|
|
40658
|
+
}
|
|
40659
|
+
case "delete":
|
|
40660
|
+
await this.deletePage({
|
|
40661
|
+
id: write.id,
|
|
40662
|
+
expectedVersion: write.expectedVersion,
|
|
40663
|
+
deletedBy: write.deletedBy
|
|
40664
|
+
});
|
|
40665
|
+
break;
|
|
40666
|
+
case "add-note": {
|
|
40667
|
+
const { op: _op, scopeId: _scope, ...note } = write;
|
|
40668
|
+
await this.addNote(note);
|
|
40669
|
+
break;
|
|
40670
|
+
}
|
|
40671
|
+
case "remove-note": {
|
|
40672
|
+
const note = await this.getNote({
|
|
40673
|
+
id: write.id,
|
|
40674
|
+
read: "all",
|
|
40675
|
+
includeDeleted: true
|
|
40676
|
+
});
|
|
40677
|
+
if (note && note.pageId !== write.pageId) throw new KnowledgeConflictError(write.id);
|
|
40678
|
+
await this.removeNote({
|
|
40679
|
+
id: write.id,
|
|
40680
|
+
deletedBy: write.deletedBy,
|
|
40681
|
+
provenance: write.provenance
|
|
40682
|
+
});
|
|
40683
|
+
break;
|
|
40684
|
+
}
|
|
40685
|
+
case "replace-links": await this.replacePageBodyLinks({
|
|
40686
|
+
pageId: write.pageId,
|
|
40687
|
+
links: write.links
|
|
40688
|
+
});
|
|
40689
|
+
}
|
|
40690
|
+
} catch (error) {
|
|
40691
|
+
this.restore(before);
|
|
40692
|
+
throw error;
|
|
40693
|
+
}
|
|
40694
|
+
}
|
|
40549
40695
|
async createPage(input) {
|
|
40550
40696
|
const parent = this.#livePage(input.parentId);
|
|
40551
40697
|
const scopeId = parent.isScope ? parent.id : parent.scopeId;
|
|
@@ -40944,6 +41090,24 @@ var InMemoryKnowledgeStorage = class extends KnowledgeStorage {
|
|
|
40944
41090
|
getPageParents(input) {
|
|
40945
41091
|
return this.#pageStore.getPageParents(input);
|
|
40946
41092
|
}
|
|
41093
|
+
getPageChains(input) {
|
|
41094
|
+
return this.#pageStore.getPageChains(input);
|
|
41095
|
+
}
|
|
41096
|
+
getPagesByPaths(input) {
|
|
41097
|
+
return this.#pageStore.getPagesByPaths(input);
|
|
41098
|
+
}
|
|
41099
|
+
getLastChildPositions(input) {
|
|
41100
|
+
return this.#pageStore.getLastChildPositions(input);
|
|
41101
|
+
}
|
|
41102
|
+
getPageSubtrees(input) {
|
|
41103
|
+
return this.#pageStore.getPageSubtrees(input);
|
|
41104
|
+
}
|
|
41105
|
+
listNotesByPages(input) {
|
|
41106
|
+
return this.#pageStore.listNotesByPages(input);
|
|
41107
|
+
}
|
|
41108
|
+
applyPageWrites(input) {
|
|
41109
|
+
return this.#pageStore.applyPageWrites(input);
|
|
41110
|
+
}
|
|
40947
41111
|
listScopeDeclarations() {
|
|
40948
41112
|
return this.#pageStore.listScopeDeclarations();
|
|
40949
41113
|
}
|
|
@@ -40956,6 +41120,9 @@ var InMemoryKnowledgeStorage = class extends KnowledgeStorage {
|
|
|
40956
41120
|
getPageByPath(input) {
|
|
40957
41121
|
return this.#pageStore.getPageByPath(input);
|
|
40958
41122
|
}
|
|
41123
|
+
findPagesByNames(input) {
|
|
41124
|
+
return this.#pageStore.findPagesByNames(input);
|
|
41125
|
+
}
|
|
40959
41126
|
findPagesByName(input) {
|
|
40960
41127
|
return this.#pageStore.findPagesByName(input);
|
|
40961
41128
|
}
|
|
@@ -53717,6 +53884,13 @@ async function syncKnowledgePageBodyLinks(storage, page, resolver = new BodyLink
|
|
|
53717
53884
|
}
|
|
53718
53885
|
/** The ref keys a page answers to now: its id, name, scope address and `scope#key/key` path. */
|
|
53719
53886
|
async function pageRefKeys(storage, page) {
|
|
53887
|
+
return refKeysOf(page, !page.isScope && page.key && page.parentId ? await storage.getPageParents({
|
|
53888
|
+
parentId: page.parentId,
|
|
53889
|
+
read: "all"
|
|
53890
|
+
}) : []);
|
|
53891
|
+
}
|
|
53892
|
+
/** {@link pageRefKeys} from the page's parents as `getPageParents` gives them. */
|
|
53893
|
+
function refKeysOf(page, parents) {
|
|
53720
53894
|
const keys = [knowledgeLinkRefKey(page.id), knowledgeLinkRefKey(page.name)];
|
|
53721
53895
|
if (page.isScope) {
|
|
53722
53896
|
if (page.address) keys.push(knowledgeLinkRefKey(page.address));
|
|
@@ -53724,10 +53898,7 @@ async function pageRefKeys(storage, page) {
|
|
|
53724
53898
|
}
|
|
53725
53899
|
if (!page.key || !page.parentId) return keys;
|
|
53726
53900
|
const path = [];
|
|
53727
|
-
for (const current of [page, ...
|
|
53728
|
-
parentId: page.parentId,
|
|
53729
|
-
read: "all"
|
|
53730
|
-
})]) {
|
|
53901
|
+
for (const current of [page, ...parents]) {
|
|
53731
53902
|
if (current.isScope) {
|
|
53732
53903
|
if (current.address) keys.push(knowledgeLinkRefKey(`${current.address}#${path.join("/")}`));
|
|
53733
53904
|
return keys;
|
|
@@ -53876,6 +54047,203 @@ async function reindexKnowledgeLinks(storage) {
|
|
|
53876
54047
|
} while (cursor);
|
|
53877
54048
|
return count;
|
|
53878
54049
|
}
|
|
54050
|
+
/**
|
|
54051
|
+
* A batched link repair that would stop at a cap the op-by-op refreshes enforce one write at a time
|
|
54052
|
+
* (linking pages, namesakes, refs looked up, subtree size): the caller saves op by op instead, so the
|
|
54053
|
+
* caps apply exactly as they do there.
|
|
54054
|
+
*/
|
|
54055
|
+
var KnowledgeLinkRepairUnsupportedError = class extends Error {
|
|
54056
|
+
reason;
|
|
54057
|
+
constructor(reason) {
|
|
54058
|
+
super(`batched link repair: ${reason}`);
|
|
54059
|
+
this.reason = reason;
|
|
54060
|
+
this.name = "KnowledgeLinkRepairUnsupportedError";
|
|
54061
|
+
}
|
|
54062
|
+
};
|
|
54063
|
+
/** True when the store has every set-based read and write {@link repairKnowledgeLinks} uses. */
|
|
54064
|
+
function canRepairKnowledgeLinksInBatch(storage) {
|
|
54065
|
+
return !!(storage.getPageChains && storage.getPagesByPaths && storage.getPageSubtrees && storage.findPagesByNames && storage.applyPageWrites);
|
|
54066
|
+
}
|
|
54067
|
+
/**
|
|
54068
|
+
* Every {@link syncKnowledgePageBodyLinks} and {@link refreshKnowledgeLinksTo} of a flush, run once
|
|
54069
|
+
* over the store as the flush left it, in a fixed number of statements: each page's links come out
|
|
54070
|
+
* as they do when the calls run one after another after the writes. Throws
|
|
54071
|
+
* {@link KnowledgeLinkRepairUnsupportedError}, having written nothing, when a cap could bite.
|
|
54072
|
+
*/
|
|
54073
|
+
async function repairKnowledgeLinks(storage, repair) {
|
|
54074
|
+
const synced = new Map(repair.synced.map((page) => [page.id, page]));
|
|
54075
|
+
if (!synced.size && !repair.refreshed.length) return;
|
|
54076
|
+
const roots = repair.refreshed.filter((item) => item.withDescendants).map((item) => item.page.id);
|
|
54077
|
+
const subtrees = roots.length ? await storage.getPageSubtrees({
|
|
54078
|
+
rootIds: [...new Set(roots)],
|
|
54079
|
+
limit: 500
|
|
54080
|
+
}) : {};
|
|
54081
|
+
const affected = [];
|
|
54082
|
+
for (const { page, withDescendants } of repair.refreshed) {
|
|
54083
|
+
affected.push(page);
|
|
54084
|
+
if (!withDescendants) continue;
|
|
54085
|
+
const under = subtrees[page.id];
|
|
54086
|
+
if (!under) throw new KnowledgeLinkRepairUnsupportedError("a moved subtree past the move limit");
|
|
54087
|
+
affected.push(...under);
|
|
54088
|
+
}
|
|
54089
|
+
const parentIds = affected.flatMap((page) => !page.isScope && page.key && page.parentId ? [page.parentId] : []);
|
|
54090
|
+
const chains = parentIds.length ? await storage.getPageChains({
|
|
54091
|
+
ids: [...new Set(parentIds)],
|
|
54092
|
+
read: "all"
|
|
54093
|
+
}) : {};
|
|
54094
|
+
const refs = /* @__PURE__ */ new Set();
|
|
54095
|
+
const targets = new Set(affected.map((page) => page.id));
|
|
54096
|
+
const names = /* @__PURE__ */ new Set();
|
|
54097
|
+
for (const page of affected) {
|
|
54098
|
+
const parents = !page.isScope && page.key && page.parentId ? chains[page.parentId] ?? [] : [];
|
|
54099
|
+
for (const key of refKeysOf(page, parents)) refs.add(key);
|
|
54100
|
+
if (!page.deletedAt) names.add(page.name);
|
|
54101
|
+
}
|
|
54102
|
+
if (names.size) {
|
|
54103
|
+
const namesakes = await storage.findPagesByNames({
|
|
54104
|
+
names: [...names],
|
|
54105
|
+
read: "all",
|
|
54106
|
+
limit: 100
|
|
54107
|
+
});
|
|
54108
|
+
for (const found of Object.values(namesakes)) {
|
|
54109
|
+
if (found.length > MAX_KNOWLEDGE_LINK_REFRESH_NAMESAKES) throw new KnowledgeLinkRepairUnsupportedError("a name past the namesake limit");
|
|
54110
|
+
for (const namesake of found) targets.add(namesake.id);
|
|
54111
|
+
}
|
|
54112
|
+
}
|
|
54113
|
+
const sources = affected.length ? await storage.listPageBodyLinkSources({
|
|
54114
|
+
refs: [...refs],
|
|
54115
|
+
toPageIds: [...targets]
|
|
54116
|
+
}) : [];
|
|
54117
|
+
if (sources.length > 100) throw new KnowledgeLinkRepairUnsupportedError("linking pages past the refresh limit");
|
|
54118
|
+
const unread = sources.filter((id) => !synced.has(id));
|
|
54119
|
+
const live = new Map((unread.length ? await storage.getPages({
|
|
54120
|
+
ids: unread,
|
|
54121
|
+
read: "all"
|
|
54122
|
+
}) : []).map((page) => [page.id, page]));
|
|
54123
|
+
const rewrite = /* @__PURE__ */ new Map();
|
|
54124
|
+
for (const id of unread) rewrite.set(id, live.get(id) ?? null);
|
|
54125
|
+
for (const [id, page] of synced) rewrite.set(id, page);
|
|
54126
|
+
const wanted = /* @__PURE__ */ new Map();
|
|
54127
|
+
const lookups = [];
|
|
54128
|
+
const refreshing = new Set(sources);
|
|
54129
|
+
let looked = 0;
|
|
54130
|
+
for (const [id, page] of rewrite) {
|
|
54131
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
54132
|
+
if (page && !page.deletedAt) for (const [ref, count] of knowledgeBodyLinkRefs(page.body)) {
|
|
54133
|
+
const key = knowledgeLinkRefKey(ref);
|
|
54134
|
+
if (key.length > 512) continue;
|
|
54135
|
+
const entry = byKey.get(key);
|
|
54136
|
+
if (entry) entry.count += count;
|
|
54137
|
+
else byKey.set(key, {
|
|
54138
|
+
ref,
|
|
54139
|
+
count
|
|
54140
|
+
});
|
|
54141
|
+
}
|
|
54142
|
+
const entries = [...byKey];
|
|
54143
|
+
wanted.set(id, entries);
|
|
54144
|
+
if (page) for (const [, { ref }] of entries) lookups.push({
|
|
54145
|
+
ref,
|
|
54146
|
+
home: page.scopeId
|
|
54147
|
+
});
|
|
54148
|
+
if (refreshing.has(id)) looked += new Set(entries.map(([, { ref }]) => ref)).size;
|
|
54149
|
+
}
|
|
54150
|
+
if (looked >= 1e3) throw new KnowledgeLinkRepairUnsupportedError("refs looked up past the refresh limit");
|
|
54151
|
+
const resolved = await resolveKnowledgeBodyLinks(storage, lookups);
|
|
54152
|
+
await storage.applyPageWrites({ writes: [...wanted].map(([pageId, entries]) => {
|
|
54153
|
+
const home = rewrite.get(pageId)?.scopeId;
|
|
54154
|
+
return {
|
|
54155
|
+
op: "replace-links",
|
|
54156
|
+
pageId,
|
|
54157
|
+
links: entries.map(([key, { ref, count }]) => ({
|
|
54158
|
+
ref: key,
|
|
54159
|
+
toPageId: home === void 0 ? null : resolved.get(`${home}\u0000${ref}`) ?? null,
|
|
54160
|
+
count
|
|
54161
|
+
}))
|
|
54162
|
+
};
|
|
54163
|
+
}) });
|
|
54164
|
+
}
|
|
54165
|
+
/** What {@link BodyLinkResolver} answers for each `(home, ref)`, keyed `home\0ref`, in a fixed number of reads. */
|
|
54166
|
+
async function resolveKnowledgeBodyLinks(storage, lookups) {
|
|
54167
|
+
const answers = /* @__PURE__ */ new Map();
|
|
54168
|
+
if (!lookups.length) return answers;
|
|
54169
|
+
const keyOf = (home, ref) => `${home}\u0000${ref}`;
|
|
54170
|
+
const byId = new Set((await storage.getPages({
|
|
54171
|
+
ids: [...new Set(lookups.map((item) => item.ref))],
|
|
54172
|
+
read: "all"
|
|
54173
|
+
})).map((page) => page.id));
|
|
54174
|
+
const remaining = lookups.filter(({ ref, home }) => {
|
|
54175
|
+
if (!byId.has(ref)) return true;
|
|
54176
|
+
answers.set(keyOf(home, ref), ref);
|
|
54177
|
+
return false;
|
|
54178
|
+
});
|
|
54179
|
+
const paths = /* @__PURE__ */ new Map();
|
|
54180
|
+
const addresses = /* @__PURE__ */ new Set();
|
|
54181
|
+
for (const { ref } of remaining) if (ref.indexOf("#") > 0) {
|
|
54182
|
+
const parsed = parseKnowledgePageRef(ref);
|
|
54183
|
+
paths.set(ref, parsed);
|
|
54184
|
+
if (parsed) addresses.add(parsed.scope);
|
|
54185
|
+
} else addresses.add(ref);
|
|
54186
|
+
const scopes = /* @__PURE__ */ new Map();
|
|
54187
|
+
if (addresses.size) {
|
|
54188
|
+
for (const scope of await storage.getScopesByAddress([...addresses])) if (!scope.deletedAt && scope.address) scopes.set(scope.address, scope.id);
|
|
54189
|
+
}
|
|
54190
|
+
const pathsByScope = /* @__PURE__ */ new Map();
|
|
54191
|
+
for (const [ref, parsed] of paths) {
|
|
54192
|
+
const scopeId = parsed && scopes.get(parsed.scope);
|
|
54193
|
+
if (!scopeId) continue;
|
|
54194
|
+
if (!pathsByScope.has(scopeId)) pathsByScope.set(scopeId, /* @__PURE__ */ new Map());
|
|
54195
|
+
pathsByScope.get(scopeId).set(ref, parsed.path);
|
|
54196
|
+
}
|
|
54197
|
+
const pathAnswers = /* @__PURE__ */ new Map();
|
|
54198
|
+
for (const [scopeId, refs] of pathsByScope) {
|
|
54199
|
+
const found = await storage.getPagesByPaths({
|
|
54200
|
+
scopeId,
|
|
54201
|
+
paths: [...refs.values()],
|
|
54202
|
+
read: "all"
|
|
54203
|
+
});
|
|
54204
|
+
[...refs.keys()].forEach((ref, i) => pathAnswers.set(ref, found[i]?.id ?? null));
|
|
54205
|
+
}
|
|
54206
|
+
const namesByHome = /* @__PURE__ */ new Map();
|
|
54207
|
+
for (const { ref, home } of remaining) {
|
|
54208
|
+
if (paths.has(ref)) {
|
|
54209
|
+
answers.set(keyOf(home, ref), pathAnswers.get(ref) ?? null);
|
|
54210
|
+
continue;
|
|
54211
|
+
}
|
|
54212
|
+
const scopeId = scopes.get(ref);
|
|
54213
|
+
if (scopeId) {
|
|
54214
|
+
answers.set(keyOf(home, ref), scopeId);
|
|
54215
|
+
continue;
|
|
54216
|
+
}
|
|
54217
|
+
if (!namesByHome.has(home)) namesByHome.set(home, /* @__PURE__ */ new Set());
|
|
54218
|
+
namesByHome.get(home).add(ref);
|
|
54219
|
+
}
|
|
54220
|
+
const anywhere = /* @__PURE__ */ new Map();
|
|
54221
|
+
for (const [home, names] of namesByHome) {
|
|
54222
|
+
const found = await storage.findPagesByNames({
|
|
54223
|
+
names: [...names],
|
|
54224
|
+
read: "all",
|
|
54225
|
+
scopeId: home,
|
|
54226
|
+
limit: 2
|
|
54227
|
+
});
|
|
54228
|
+
for (const name of names) {
|
|
54229
|
+
const inHome = found[name] ?? [];
|
|
54230
|
+
if (inHome.length) answers.set(keyOf(home, name), inHome.length === 1 ? inHome[0].id : null);
|
|
54231
|
+
else anywhere.set(name, [...anywhere.get(name) ?? [], home]);
|
|
54232
|
+
}
|
|
54233
|
+
}
|
|
54234
|
+
if (anywhere.size) {
|
|
54235
|
+
const found = await storage.findPagesByNames({
|
|
54236
|
+
names: [...anywhere.keys()],
|
|
54237
|
+
read: "all",
|
|
54238
|
+
limit: 2
|
|
54239
|
+
});
|
|
54240
|
+
for (const [name, homes] of anywhere) {
|
|
54241
|
+
const pages = found[name] ?? [];
|
|
54242
|
+
for (const home of homes) answers.set(keyOf(home, name), pages.length === 1 ? pages[0].id : null);
|
|
54243
|
+
}
|
|
54244
|
+
}
|
|
54245
|
+
return answers;
|
|
54246
|
+
}
|
|
53879
54247
|
// ../_vendored/ai_v7/dist/dist-C-C3A1Ts.js
|
|
53880
54248
|
/**
|
|
53881
54249
|
* Symbol used for identifying AI SDK Error instances.
|
|
@@ -84576,7 +84944,7 @@ async function prepareForDurableExecution(options) {
|
|
|
84576
84944
|
});
|
|
84577
84945
|
let tripwireData;
|
|
84578
84946
|
if (inputProcessors.length > 0) try {
|
|
84579
|
-
const { ProcessorRunner } = await Promise.resolve().then(() => require("./stream-
|
|
84947
|
+
const { ProcessorRunner } = await Promise.resolve().then(() => require("./stream-CMKRczs4.cjs")).then((n) => n.runner_exports);
|
|
84580
84948
|
await new ProcessorRunner({
|
|
84581
84949
|
inputProcessors,
|
|
84582
84950
|
outputProcessors,
|
|
@@ -111747,6 +112115,12 @@ Object.defineProperty(exports, "KnowledgeLinkRefreshIncompleteError", {
|
|
|
111747
112115
|
return KnowledgeLinkRefreshIncompleteError;
|
|
111748
112116
|
}
|
|
111749
112117
|
});
|
|
112118
|
+
Object.defineProperty(exports, "KnowledgeLinkRepairUnsupportedError", {
|
|
112119
|
+
enumerable: true,
|
|
112120
|
+
get: function() {
|
|
112121
|
+
return KnowledgeLinkRepairUnsupportedError;
|
|
112122
|
+
}
|
|
112123
|
+
});
|
|
111750
112124
|
Object.defineProperty(exports, "KnowledgeMoveTooLargeError", {
|
|
111751
112125
|
enumerable: true,
|
|
111752
112126
|
get: function() {
|
|
@@ -112719,6 +113093,12 @@ Object.defineProperty(exports, "calculateAccumulatedUsage", {
|
|
|
112719
113093
|
return calculateAccumulatedUsage;
|
|
112720
113094
|
}
|
|
112721
113095
|
});
|
|
113096
|
+
Object.defineProperty(exports, "canRepairKnowledgeLinksInBatch", {
|
|
113097
|
+
enumerable: true,
|
|
113098
|
+
get: function() {
|
|
113099
|
+
return canRepairKnowledgeLinksInBatch;
|
|
113100
|
+
}
|
|
113101
|
+
});
|
|
112722
113102
|
Object.defineProperty(exports, "cancelNestedRun", {
|
|
112723
113103
|
enumerable: true,
|
|
112724
113104
|
get: function() {
|
|
@@ -113673,6 +114053,12 @@ Object.defineProperty(exports, "knowledgeMemoryScopes", {
|
|
|
113673
114053
|
return knowledgeMemoryScopes;
|
|
113674
114054
|
}
|
|
113675
114055
|
});
|
|
114056
|
+
Object.defineProperty(exports, "knowledgePageKeyProblem", {
|
|
114057
|
+
enumerable: true,
|
|
114058
|
+
get: function() {
|
|
114059
|
+
return knowledgePageKeyProblem;
|
|
114060
|
+
}
|
|
114061
|
+
});
|
|
113676
114062
|
Object.defineProperty(exports, "knowledgePagePath", {
|
|
113677
114063
|
enumerable: true,
|
|
113678
114064
|
get: function() {
|
|
@@ -114081,6 +114467,12 @@ Object.defineProperty(exports, "renewWorkflowLease", {
|
|
|
114081
114467
|
return renewWorkflowLease;
|
|
114082
114468
|
}
|
|
114083
114469
|
});
|
|
114470
|
+
Object.defineProperty(exports, "repairKnowledgeLinks", {
|
|
114471
|
+
enumerable: true,
|
|
114472
|
+
get: function() {
|
|
114473
|
+
return repairKnowledgeLinks;
|
|
114474
|
+
}
|
|
114475
|
+
});
|
|
114084
114476
|
Object.defineProperty(exports, "repeatAfterSettled", {
|
|
114085
114477
|
enumerable: true,
|
|
114086
114478
|
get: function() {
|