kaijibot 2026.6.21 → 2026.6.22
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/.buildstamp +1 -1
- package/dist/abort-CxZY3nsr.js +202 -0
- package/dist/abort-cutoff.runtime-D5FOsnYW.js +20 -0
- package/dist/abort-cutoff.runtime.js +1 -1
- package/dist/abort.runtime-DfIOyW8M.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/acp-cli-CGXRdw_k.js +2171 -0
- package/dist/acp-spawn-DKbKvPuU.js +1023 -0
- package/dist/acp-stateful-target-driver-WeMIyQR2.js +87 -0
- package/dist/action-agents-Dw33v5ym.js +67 -0
- package/dist/action-focus-BTLYwzxx.js +124 -0
- package/dist/action-help-DjgRJFg3.js +7 -0
- package/dist/action-info-6xDvEX0Q.js +58 -0
- package/dist/action-kill-DtQoZS29.js +33 -0
- package/dist/action-list-ClDeI7iE.js +21 -0
- package/dist/action-log-DSosstuh.js +30 -0
- package/dist/action-send-Vh1BuuNd.js +39 -0
- package/dist/action-spawn-B08ssbZ3.js +46 -0
- package/dist/action-unfocus-CEw-Ww9k.js +28 -0
- package/dist/agent-BXBykpuI.js +2 -0
- package/dist/agent-command-CUB1Qm88.js +1479 -0
- package/dist/agent-runner-utils-DN7nVODy.js +202 -0
- package/dist/agent-runner.runtime-DVXE9zZ9.js +2825 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agents/model-catalog.runtime.js +1 -1
- package/dist/agents-BqqSOUcc.js +887 -0
- package/dist/agents-CVsWMDVp.js +5 -0
- package/dist/api--VGwAnD8.js +3 -0
- package/dist/api-6V55tozK.js +5 -0
- package/dist/api-B6ziqa7E.js +5 -0
- package/dist/api-C4yFynS8.js +2 -0
- package/dist/api-CT1XstLQ.js +4 -0
- package/dist/api-CgLK0Nl9.js +45 -0
- package/dist/api-CkSziYo8.js +4 -0
- package/dist/api-CmDVoeIs.js +2 -0
- package/dist/api-CziR8HhH.js +35 -0
- package/dist/api-D85vczn8.js +2 -0
- package/dist/api-DlP6Jt7i.js +3 -0
- package/dist/api-DvwX5wEJ.js +16 -0
- package/dist/api-cZen2Qw8.js +44 -0
- package/dist/api-gQ5luSlW.js +19 -0
- package/dist/apply-DQD25Xw1.js +493 -0
- package/dist/apply.runtime-BUedp4X6.js +166 -0
- package/dist/apply.runtime-CUOWwc5E.js +2 -0
- package/dist/apply.runtime.js +1 -1
- package/dist/audit-channel.collect.runtime.js +1 -1
- package/dist/audit-extra.async-UlJ9dtlX.js +847 -0
- package/dist/audit-u9caRELf.js +885 -0
- package/dist/audit.deep.runtime-DV71Wkn_.js +2 -0
- package/dist/audit.deep.runtime.js +1 -1
- package/dist/audit.nondeep.runtime-DOxcit3s.js +859 -0
- package/dist/audit.nondeep.runtime.js +1 -1
- package/dist/audit.runtime-CkaC5K-V.js +7 -0
- package/dist/audit.runtime.js +1 -1
- package/dist/auth-BtFIcjkK.js +181 -0
- package/dist/auth-choice-BDu6h5u6.js +353 -0
- package/dist/auth-choice-ChZMk5hI.js +3 -0
- package/dist/auth-choice-oYsuPPg8.js +71 -0
- package/dist/auth-choice-options-kLAihnil.js +104 -0
- package/dist/auth-choice-prompt-C6XJsZ_j.js +2 -0
- package/dist/auth-choice-prompt-sWGu0fT8.js +36 -0
- package/dist/auth-choice.plugin-providers.runtime.js +1 -1
- package/dist/auto-disable-B57JdBwe.js +69 -0
- package/dist/auto-disable-CmJfHDbk.js +2 -0
- package/dist/banner-BLSO_rVb.js +290 -0
- package/dist/banner-Bq8rH7x0.js +2 -0
- package/dist/binding-routing-CUqlgYnB.js +50 -0
- package/dist/binding-targets-r1FCdNWk.js +99 -0
- package/dist/bridge-server-DBiqLRkF.js +103 -0
- package/dist/browser-node-runtime-CaV_umAQ.js +12 -0
- package/dist/browser-runtime-a3vYRS_q.js +377 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +3 -3
- package/dist/bundled/bootstrap-extra-files/handler.js +1 -1
- package/dist/bundled/session-memory/handler.js +3 -3
- package/dist/call.runtime.js +1 -1
- package/dist/capability-cli-5gQaEAHR.js +1350 -0
- package/dist/catalog-provider-DtmYtDqx.js +40 -0
- package/dist/cdp.helpers-C6bHP7D_.js +372 -0
- package/dist/channel-core-CmBBxIyB.js +5 -0
- package/dist/channel-plugin-resolution-CmsYI1my.js +146 -0
- package/dist/channel-selection.runtime.js +1 -1
- package/dist/channel.runtime-CVJx87rS.js +399 -0
- package/dist/channel.runtime.js +1 -1
- package/dist/channels-DSyzN9z5.js +1146 -0
- package/dist/channels-cli-CyaVWu4s.js +247 -0
- package/dist/chat-fHuZdqCl.js +213 -0
- package/dist/chrome-DMEt4NXy.js +1080 -0
- package/dist/chrome.executables-B9jFs6UO.js +541 -0
- package/dist/clawbot-cli-mwz1sM6a.js +9 -0
- package/dist/clawhub-D05ayw3D.js +400 -0
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/cli-8zsU8vEs.js +191 -0
- package/dist/cli-Bi46ARiq.js +57 -0
- package/dist/cli-By89kZva.js +154 -0
- package/dist/cli-C746a0v5.js +2 -0
- package/dist/cli-auth-seam-BTvzapW1.js +14 -0
- package/dist/cli-backend-lsjr78tt.js +66 -0
- package/dist/cli-migration-DcoLYfHA.js +127 -0
- package/dist/cli-pyy2tVYy.js +2 -0
- package/dist/cli-runner-CdYSI1Cq.js +1661 -0
- package/dist/cli-runner.runtime-DAabHOxt.js +3 -0
- package/dist/cli-runner.runtime-DVi1zg9k.js +2 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-shared-DFDLtvnu.js +142 -0
- package/dist/cli-startup-metadata.json +2 -2
- package/dist/cli.runtime-Cz1t2jpS.js +819 -0
- package/dist/cli.runtime.js +1 -1
- package/dist/collector-DrX56GKv.js +378 -0
- package/dist/collector-Shnn0RWR.js +2 -0
- package/dist/command-config-resolution-CZpMVpIs.js +2 -0
- package/dist/command-config-resolution-CcNutmmy.js +23 -0
- package/dist/command-execution-startup-BQsvV7-V.js +269 -0
- package/dist/command-poll-backoff.runtime.js +1 -1
- package/dist/command-queue-BfrVf4dr.js +260 -0
- package/dist/command-registry-9kQrd6fb.js +108 -0
- package/dist/command-registry-Bdx4B3wy.js +3 -0
- package/dist/command-secret-gateway-DxVWgQ4Q.js +528 -0
- package/dist/commands-acp-DBpRNdkG.js +1017 -0
- package/dist/commands-compact.runtime-BxRaheVf.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-core.runtime-DoUzOeqH.js +2 -0
- package/dist/commands-core.runtime.js +1 -1
- package/dist/commands-handlers.runtime-CscK2Pgm.js +3762 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-models-DqYeVT69.js +306 -0
- package/dist/commands-registry.runtime.js +1 -1
- package/dist/commands-reset-hooks-CRAAqkiL.js +129 -0
- package/dist/commands-status-D8ZaMIRi.js +223 -0
- package/dist/commands-status.runtime-BtUfa8Vo.js +2 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-3mseouWV.js +2 -0
- package/dist/commands-subagents-control.runtime-C7Ew7ep6.js +3 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands.runtime-BJ_5rAYe.js +103 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/comment-shared-yDp8Dd41.js +40 -0
- package/dist/compact-k1PfNa6G.js +11322 -0
- package/dist/compact.runtime-cKbXZ_kZ.js +7 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-DUy1xq5t.js +2 -0
- package/dist/completion-cli-TT57JQFZ.js +464 -0
- package/dist/config-Bza6q-tk.js +107 -0
- package/dist/config-CAd-vFQh.js +2 -0
- package/dist/config-CpSlb4Mg.js +166 -0
- package/dist/config-CwRPACbU.js +136 -0
- package/dist/config-cli-_8Iokq8y.js +947 -0
- package/dist/config-defaults-Bjf5n5HI.js +163 -0
- package/dist/config-guard-CfF5-yEi.js +94 -0
- package/dist/config-runtime-BNDhHDpw.js +14 -0
- package/dist/config-validation-BhhUrU16.js +279 -0
- package/dist/configure-CQyw8lzJ.js +1159 -0
- package/dist/configure-qodb2db7.js +2 -0
- package/dist/context-writer-AquXRiMC.js +286 -0
- package/dist/control-auth-CBhIsAGb.js +122 -0
- package/dist/conversation-id-BpHFaBiM.js +140 -0
- package/dist/conversation-runtime-CV7B9eh2.js +31 -0
- package/dist/core-Dhps3xfM.js +210 -0
- package/dist/core-command-descriptors-ByQEHYvG.js +106 -0
- package/dist/cron-cli-CZI77HtC.js +637 -0
- package/dist/curator-CqSJZrlY.js +586 -0
- package/dist/daemon-cli-BdP5r4bR.js +416 -0
- package/dist/daemon-install-C8jNe_d9.js +63 -0
- package/dist/delegate-BLZcdNc7.js +61 -0
- package/dist/deliver-BZKHu27h.js +3 -0
- package/dist/deliver-C_JUBT2Q.js +782 -0
- package/dist/deliver-runtime-BlUTLk1h.js +2 -0
- package/dist/delivery-outbound.runtime-Dx5f5V4o.js +6 -0
- package/dist/delivery-outbound.runtime.js +1 -1
- package/dist/delivery-queue-BEM44EtF.js +372 -0
- package/dist/delivery-queue-DtcoyE2W.js +2 -0
- package/dist/detect-B4AtZ1VF.js +113 -0
- package/dist/devices-cli-BwUXV1ns.js +329 -0
- package/dist/diagnostic-B9b_3vaL.js +311 -0
- package/dist/direct-dm-06KHJO-9.js +139 -0
- package/dist/directive-handling.fast-lane-BAXtkU2a.js +64 -0
- package/dist/directive-handling.fast-lane-cbiyzgY6.js +2 -0
- package/dist/directive-handling.impl-DXbCFQNy.js +2 -0
- package/dist/directive-handling.impl-DscJlWrJ.js +659 -0
- package/dist/directive-handling.parse-BjPmnlrf.js +376 -0
- package/dist/directive-handling.persist-CR8atm5a.js +139 -0
- package/dist/directive-handling.persist.runtime-BD4hf46l.js +2 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/directive-handling.shared-CBO8J9ho.js +159 -0
- package/dist/directory-cli-jmT5IFyz.js +239 -0
- package/dist/dispatch-D0nF0fyZ.js +1041 -0
- package/dist/dispatch-acp-DkXjplxI.js +969 -0
- package/dist/dispatch-acp-manager.runtime-BatYBoZJ.js +3 -0
- package/dist/dispatch-acp-manager.runtime.js +1 -1
- package/dist/dispatch-acp-media.runtime-ij81_4Nz.js +3 -0
- package/dist/dispatch-acp-media.runtime.js +1 -1
- package/dist/dispatch-acp-session.runtime-BuR_lKDu.js +2 -0
- package/dist/dispatch-acp-session.runtime.js +1 -1
- package/dist/dispatch-acp-tts.runtime-7dlcj_x_.js +3 -0
- package/dist/dispatch-acp-tts.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-DD9eCP-b.js +19 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/dns-cli-RO2WqQHr.js +192 -0
- package/dist/doctor-completion-5vnr7sel.js +90 -0
- package/dist/doctor-config-preflight-6FaPZK61.js +148 -0
- package/dist/doctor-config-preflight-CTYLYtZw.js +2 -0
- package/dist/doctor-state-migrations-BvJBqBwP.js +2 -0
- package/dist/doctor-state-migrations-CH2rs-LR.js +3 -0
- package/dist/drive-D8QfYZ4p.js +750 -0
- package/dist/embedding-provider-Bj7KsQ8q.js +129 -0
- package/dist/engine-BY6K0Vfe.js +72 -0
- package/dist/entry-capabilities-BSz58Ocn.js +89 -0
- package/dist/entry.js +5 -5
- package/dist/env-overrides.runtime.js +1 -1
- package/dist/exec-approval-forwarder.runtime-D5JousLd.js +3 -0
- package/dist/exec-approval-forwarder.runtime.js +1 -1
- package/dist/exec-approvals-cli-C63N8e4p.js +484 -0
- package/dist/exec-defaults-BWTMcQ8O.js +1440 -0
- package/dist/extensionAPI.js +4 -4
- package/dist/extensions/alibaba/index.js +1 -1
- package/dist/extensions/alibaba/video-generation-provider.js +1 -1
- package/dist/extensions/anthropic/api.js +2 -2
- package/dist/extensions/anthropic/cli-auth-seam.js +1 -1
- package/dist/extensions/anthropic/cli-backend-api.js +2 -2
- package/dist/extensions/anthropic/cli-backend.js +1 -1
- package/dist/extensions/anthropic/cli-migration.js +1 -1
- package/dist/extensions/anthropic/cli-shared.js +1 -1
- package/dist/extensions/anthropic/config-defaults.js +1 -1
- package/dist/extensions/anthropic/contract-api.js +1 -1
- package/dist/extensions/anthropic/index.js +1 -1
- package/dist/extensions/anthropic/media-understanding-provider.js +1 -1
- package/dist/extensions/anthropic/provider-policy-api.js +1 -1
- package/dist/extensions/anthropic/register.runtime.js +1 -1
- package/dist/extensions/anthropic/setup-api.js +1 -1
- package/dist/extensions/anthropic/stream-wrappers.js +1 -1
- package/dist/extensions/anthropic/test-api.js +3 -3
- package/dist/extensions/anthropic-vertex/api.js +3 -3
- package/dist/extensions/anthropic-vertex/index.js +2 -2
- package/dist/extensions/anthropic-vertex/provider-catalog.js +1 -1
- package/dist/extensions/anthropic-vertex/region.js +1 -1
- package/dist/extensions/anthropic-vertex/setup-api.js +1 -1
- package/dist/extensions/arcee/index.js +2 -2
- package/dist/extensions/browser/browser-bridge.js +1 -1
- package/dist/extensions/browser/browser-cdp.js +1 -1
- package/dist/extensions/browser/browser-config.js +3 -3
- package/dist/extensions/browser/browser-control-auth.js +1 -1
- package/dist/extensions/browser/browser-doctor.js +3 -3
- package/dist/extensions/browser/browser-host-inspection.js +1 -1
- package/dist/extensions/browser/browser-maintenance.js +2 -2
- package/dist/extensions/browser/browser-profiles.js +1 -1
- package/dist/extensions/browser/browser-runtime-api.js +11 -11
- package/dist/extensions/browser/index.js +1 -1
- package/dist/extensions/browser/plugin-registration.js +1 -1
- package/dist/extensions/browser/register.runtime.js +3 -3
- package/dist/extensions/browser/runtime-api.js +12 -12
- package/dist/extensions/browser/setup-api.js +2 -2
- package/dist/extensions/browser/test-support.js +2 -2
- package/dist/extensions/byteplus/index.js +3 -3
- package/dist/extensions/byteplus/video-generation-provider.js +1 -1
- package/dist/extensions/cerebras/index.js +1 -1
- package/dist/extensions/chutes/api.js +3 -3
- package/dist/extensions/chutes/index.js +8 -8
- package/dist/extensions/chutes/models.js +1 -1
- package/dist/extensions/chutes/onboard.js +2 -2
- package/dist/extensions/chutes/provider-catalog.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/api.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/catalog-provider.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/index.js +3 -3
- package/dist/extensions/deepinfra/api.js +2 -2
- package/dist/extensions/deepinfra/index.js +2 -2
- package/dist/extensions/deepinfra/media-understanding-provider.js +1 -1
- package/dist/extensions/deepinfra/video-generation-provider.js +1 -1
- package/dist/extensions/deepseek/index.js +1 -1
- package/dist/extensions/device-pair/api.js +2 -2
- package/dist/extensions/device-pair/index.js +5 -5
- package/dist/extensions/device-pair/notify.js +1 -1
- package/dist/extensions/device-pair/pair-command-approve.js +1 -1
- package/dist/extensions/device-pair/qr-image.js +2 -2
- package/dist/extensions/diffs/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/diffs/index.js +1 -1
- package/dist/extensions/diffs/node_modules/.package-lock.json +3 -3
- package/dist/extensions/diffs/node_modules/typebox/build/compile/validator.d.mts +2 -7
- package/dist/extensions/diffs/node_modules/typebox/build/compile/validator.mjs +6 -36
- package/dist/extensions/diffs/node_modules/typebox/build/error/errors.d.mts +1 -7
- package/dist/extensions/diffs/node_modules/typebox/build/guard/emit.d.mts +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/guard/emit.mjs +0 -8
- package/dist/extensions/diffs/node_modules/typebox/build/guard/guard.d.mts +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/guard/guard.mjs +0 -8
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/schema.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/type.mjs +14 -18
- package/dist/extensions/diffs/node_modules/typebox/build/schema/types/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/schema/types/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
- package/dist/extensions/diffs/node_modules/typebox/build/system/memory/clone.mjs +72 -26
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/with.d.mts +0 -10
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/with.mjs +0 -8
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/check.d.mts +1 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/check.mjs +9 -15
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +1 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +4 -2
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/instantiate.d.mts +7 -12
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/instantiate.mjs +60 -66
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +1 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +4 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/extends_left.d.mts +1 -7
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/extends_left.mjs +23 -32
- package/dist/extensions/diffs/node_modules/typebox/build/type/script/mapping.d.mts +0 -12
- package/dist/extensions/diffs/node_modules/typebox/build/type/script/mapping.mjs +21 -25
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/_refine.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/_refine.mjs +1 -2
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/index.d.mts +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/index.mjs +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/static.d.mts +1 -5
- package/dist/extensions/diffs/node_modules/typebox/build/typebox.d.mts +2 -7
- package/dist/extensions/diffs/node_modules/typebox/build/typebox.mjs +2 -7
- package/dist/extensions/diffs/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
- package/dist/extensions/diffs/node_modules/typebox/build/value/clone/clone.mjs +1 -86
- package/dist/extensions/diffs/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_type.mjs +23 -31
- package/dist/extensions/diffs/node_modules/typebox/build/value/default/from_type.mjs +8 -10
- package/dist/extensions/diffs/node_modules/typebox/build/value/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/value/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/value/repair/from_type.mjs +2 -12
- package/dist/extensions/diffs/node_modules/typebox/build/value/value.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/value/value.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/package.json +1 -1
- package/dist/extensions/diffs/node_modules/typebox/readme.md +1 -1
- package/dist/extensions/exa/index.js +1 -1
- package/dist/extensions/feishu/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/feishu/api.js +16 -16
- package/dist/extensions/feishu/contract-api.js +2 -2
- package/dist/extensions/feishu/node_modules/.package-lock.json +3 -3
- package/dist/extensions/feishu/node_modules/typebox/build/compile/validator.d.mts +2 -7
- package/dist/extensions/feishu/node_modules/typebox/build/compile/validator.mjs +6 -36
- package/dist/extensions/feishu/node_modules/typebox/build/error/errors.d.mts +1 -7
- package/dist/extensions/feishu/node_modules/typebox/build/guard/emit.d.mts +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/guard/emit.mjs +0 -8
- package/dist/extensions/feishu/node_modules/typebox/build/guard/guard.d.mts +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/guard/guard.mjs +0 -8
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/schema.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/type.mjs +14 -18
- package/dist/extensions/feishu/node_modules/typebox/build/schema/types/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/schema/types/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
- package/dist/extensions/feishu/node_modules/typebox/build/system/memory/clone.mjs +72 -26
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/with.d.mts +0 -10
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/with.mjs +0 -8
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/check.d.mts +1 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/check.mjs +9 -15
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +1 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +4 -2
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/instantiate.d.mts +7 -12
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/instantiate.mjs +60 -66
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +1 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +4 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/extends_left.d.mts +1 -7
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/extends_left.mjs +23 -32
- package/dist/extensions/feishu/node_modules/typebox/build/type/script/mapping.d.mts +0 -12
- package/dist/extensions/feishu/node_modules/typebox/build/type/script/mapping.mjs +21 -25
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/_refine.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/_refine.mjs +1 -2
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/index.d.mts +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/index.mjs +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/static.d.mts +1 -5
- package/dist/extensions/feishu/node_modules/typebox/build/typebox.d.mts +2 -7
- package/dist/extensions/feishu/node_modules/typebox/build/typebox.mjs +2 -7
- package/dist/extensions/feishu/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
- package/dist/extensions/feishu/node_modules/typebox/build/value/clone/clone.mjs +1 -86
- package/dist/extensions/feishu/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_type.mjs +23 -31
- package/dist/extensions/feishu/node_modules/typebox/build/value/default/from_type.mjs +8 -10
- package/dist/extensions/feishu/node_modules/typebox/build/value/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/value/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/value/repair/from_type.mjs +2 -12
- package/dist/extensions/feishu/node_modules/typebox/build/value/value.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/value/value.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/package.json +1 -1
- package/dist/extensions/feishu/node_modules/typebox/readme.md +1 -1
- package/dist/extensions/feishu/runtime-api.js +2 -2
- package/dist/extensions/feishu/security-contract-api.js +1 -1
- package/dist/extensions/feishu/session-key-api.js +1 -1
- package/dist/extensions/feishu/setup-api.js +1 -1
- package/dist/extensions/fireworks/index.js +1 -1
- package/dist/extensions/github-copilot/api.js +1 -1
- package/dist/extensions/github-copilot/index.js +4 -4
- package/dist/extensions/github-copilot/login.js +1 -1
- package/dist/extensions/github-copilot/models-defaults.js +1 -1
- package/dist/extensions/github-copilot/models.js +1 -1
- package/dist/extensions/github-copilot/register.runtime.js +3 -3
- package/dist/extensions/github-copilot/replay-policy.js +1 -1
- package/dist/extensions/google/api.js +1 -1
- package/dist/extensions/google/gemini-cli-provider.js +1 -1
- package/dist/extensions/google/google-shared.test-helpers.js +1 -1
- package/dist/extensions/google/image-generation-provider.js +1 -1
- package/dist/extensions/google/index.js +5 -5
- package/dist/extensions/google/media-understanding-provider.js +1 -1
- package/dist/extensions/google/music-generation-provider.js +1 -1
- package/dist/extensions/google/oauth-token-shared.js +1 -1
- package/dist/extensions/google/oauth.credentials.js +1 -1
- package/dist/extensions/google/oauth.flow.js +1 -1
- package/dist/extensions/google/oauth.js +2 -2
- package/dist/extensions/google/oauth.runtime.js +1 -1
- package/dist/extensions/google/oauth.settings.js +1 -1
- package/dist/extensions/google/oauth.token.js +1 -1
- package/dist/extensions/google/provider-models.js +1 -1
- package/dist/extensions/google/provider-registration.js +1 -1
- package/dist/extensions/google/runtime-api.js +2 -2
- package/dist/extensions/google/test-api.js +2 -2
- package/dist/extensions/google/video-generation-provider.js +1 -1
- package/dist/extensions/google/web-search-provider.js +1 -1
- package/dist/extensions/groq/index.js +1 -1
- package/dist/extensions/groq/media-understanding-provider.js +1 -1
- package/dist/extensions/groq/test-api.js +1 -1
- package/dist/extensions/huggingface/api.js +3 -3
- package/dist/extensions/huggingface/index.js +3 -3
- package/dist/extensions/huggingface/models.js +1 -1
- package/dist/extensions/huggingface/onboard.js +1 -1
- package/dist/extensions/huggingface/provider-catalog.js +2 -2
- package/dist/extensions/image-generation-core/api.js +1 -1
- package/dist/extensions/kilocode/api.js +2 -2
- package/dist/extensions/kilocode/index.js +4 -4
- package/dist/extensions/kilocode/onboard.js +2 -2
- package/dist/extensions/kilocode/provider-catalog.js +1 -1
- package/dist/extensions/kilocode/provider-models.js +1 -1
- package/dist/extensions/kilocode/shared.js +1 -1
- package/dist/extensions/kimi-coding/index.js +3 -3
- package/dist/extensions/knowledge-wiki/index.js +26 -12
- package/dist/extensions/knowledge-wiki/kaijibot.plugin.json +2 -1
- package/dist/extensions/litellm/api.js +1 -1
- package/dist/extensions/litellm/index.js +3 -3
- package/dist/extensions/litellm/onboard.js +1 -1
- package/dist/extensions/litellm/provider-catalog.js +1 -1
- package/dist/extensions/llm-task/api.js +1 -1
- package/dist/extensions/llm-task/index.js +2 -2
- package/dist/extensions/lmstudio/api.js +2 -2
- package/dist/extensions/lmstudio/index.js +2 -2
- package/dist/extensions/lmstudio/runtime-api.js +1 -1
- package/dist/extensions/media-understanding-core/runtime-api.js +2 -2
- package/dist/extensions/memory-core/cli-metadata.js +2 -2
- package/dist/extensions/memory-core/index.js +13 -13
- package/dist/extensions/memory-core/manager-runtime.js +1 -1
- package/dist/extensions/memory-core/runtime-api.js +4 -4
- package/dist/extensions/memory-lancedb/api.js +1 -1
- package/dist/extensions/memory-lancedb/cli-metadata.js +1 -1
- package/dist/extensions/memory-lancedb/config.js +1 -1
- package/dist/extensions/memory-lancedb/index.js +4 -4
- package/dist/extensions/memory-lancedb/lancedb-runtime.js +1 -1
- package/dist/extensions/microsoft/index.js +1 -1
- package/dist/extensions/microsoft/speech-provider.js +1 -1
- package/dist/extensions/microsoft/test-api.js +1 -1
- package/dist/extensions/microsoft/tts.js +1 -1
- package/dist/extensions/microsoft-foundry/auth.js +1 -1
- package/dist/extensions/microsoft-foundry/cli.js +1 -1
- package/dist/extensions/microsoft-foundry/index.js +1 -1
- package/dist/extensions/microsoft-foundry/onboard.js +2 -2
- package/dist/extensions/microsoft-foundry/provider.js +1 -1
- package/dist/extensions/microsoft-foundry/runtime.js +1 -1
- package/dist/extensions/microsoft-foundry/shared-runtime.js +2 -2
- package/dist/extensions/microsoft-foundry/shared.js +1 -1
- package/dist/extensions/minimax/api.js +5 -5
- package/dist/extensions/minimax/image-generation-provider.js +1 -1
- package/dist/extensions/minimax/index.js +7 -7
- package/dist/extensions/minimax/media-understanding-provider.js +1 -1
- package/dist/extensions/minimax/model-definitions.js +1 -1
- package/dist/extensions/minimax/music-generation-provider.js +1 -1
- package/dist/extensions/minimax/oauth.js +1 -1
- package/dist/extensions/minimax/oauth.runtime.js +1 -1
- package/dist/extensions/minimax/onboard.js +1 -1
- package/dist/extensions/minimax/provider-catalog.js +1 -1
- package/dist/extensions/minimax/provider-http.test-helpers.js +1 -1
- package/dist/extensions/minimax/provider-models.js +1 -1
- package/dist/extensions/minimax/provider-registration.js +1 -1
- package/dist/extensions/minimax/speech-provider.js +1 -1
- package/dist/extensions/minimax/test-api.js +2 -2
- package/dist/extensions/minimax/tts.js +1 -1
- package/dist/extensions/minimax/video-generation-provider.js +1 -1
- package/dist/extensions/minimax/web-search-provider.js +1 -1
- package/dist/extensions/mistral/api.js +4 -4
- package/dist/extensions/mistral/embedding-provider.js +1 -1
- package/dist/extensions/mistral/index.js +6 -6
- package/dist/extensions/mistral/media-understanding-provider.js +1 -1
- package/dist/extensions/mistral/memory-embedding-adapter.js +1 -1
- package/dist/extensions/mistral/model-definitions.js +1 -1
- package/dist/extensions/mistral/onboard.js +1 -1
- package/dist/extensions/mistral/provider-catalog.js +1 -1
- package/dist/extensions/mistral/provider-compat.js +1 -1
- package/dist/extensions/mistral/realtime-transcription-provider.js +1 -1
- package/dist/extensions/mistral/test-api.js +2 -2
- package/dist/extensions/moonshot/api.js +3 -3
- package/dist/extensions/moonshot/index.js +6 -6
- package/dist/extensions/moonshot/media-understanding-provider.js +1 -1
- package/dist/extensions/moonshot/onboard.js +1 -1
- package/dist/extensions/moonshot/provider-catalog.js +1 -1
- package/dist/extensions/moonshot/test-api.js +2 -2
- package/dist/extensions/moonshot/web-search-provider.js +1 -1
- package/dist/extensions/nvidia/api.js +1 -1
- package/dist/extensions/nvidia/index.js +2 -2
- package/dist/extensions/nvidia/provider-catalog.js +1 -1
- package/dist/extensions/ollama/api.js +4 -4
- package/dist/extensions/ollama/index.js +7 -7
- package/dist/extensions/ollama/provider-discovery.js +1 -1
- package/dist/extensions/ollama/runtime-api.js +2 -2
- package/dist/extensions/ollama/web-search-provider.js +1 -1
- package/dist/extensions/open-prose/runtime-api.js +1 -1
- package/dist/extensions/openai/api.js +5 -5
- package/dist/extensions/openai/cli-backend.js +1 -1
- package/dist/extensions/openai/default-models.js +1 -1
- package/dist/extensions/openai/image-generation-provider.js +1 -1
- package/dist/extensions/openai/index.js +10 -10
- package/dist/extensions/openai/media-understanding-provider.js +1 -1
- package/dist/extensions/openai/openai-codex-auth-identity.js +1 -1
- package/dist/extensions/openai/openai-codex-catalog.js +1 -1
- package/dist/extensions/openai/openai-codex-cli-auth.js +1 -1
- package/dist/extensions/openai/openai-codex-provider.js +1 -1
- package/dist/extensions/openai/openai-codex-shared.js +1 -1
- package/dist/extensions/openai/openai-provider.js +1 -1
- package/dist/extensions/openai/prompt-overlay.js +1 -1
- package/dist/extensions/openai/realtime-provider-shared.js +1 -1
- package/dist/extensions/openai/realtime-transcription-provider.js +1 -1
- package/dist/extensions/openai/realtime-voice-provider.js +1 -1
- package/dist/extensions/openai/register.runtime.js +9 -9
- package/dist/extensions/openai/replay-policy.js +1 -1
- package/dist/extensions/openai/setup-api.js +1 -1
- package/dist/extensions/openai/shared.js +1 -1
- package/dist/extensions/openai/speech-provider.js +1 -1
- package/dist/extensions/openai/test-api.js +6 -6
- package/dist/extensions/openai/transport-policy.js +1 -1
- package/dist/extensions/openai/tts.js +1 -1
- package/dist/extensions/openai/video-generation-provider.js +1 -1
- package/dist/extensions/opencode/api.js +2 -2
- package/dist/extensions/opencode/index.js +4 -4
- package/dist/extensions/opencode/onboard.js +1 -1
- package/dist/extensions/opencode-go/api.js +2 -2
- package/dist/extensions/opencode-go/index.js +3 -3
- package/dist/extensions/opencode-go/onboard.js +1 -1
- package/dist/extensions/openrouter/api.js +5 -5
- package/dist/extensions/openrouter/image-generation-provider.js +1 -1
- package/dist/extensions/openrouter/index.js +8 -8
- package/dist/extensions/openrouter/media-understanding-provider.js +1 -1
- package/dist/extensions/openrouter/models.js +1 -1
- package/dist/extensions/openrouter/music-generation-provider.js +1 -1
- package/dist/extensions/openrouter/onboard.js +1 -1
- package/dist/extensions/openrouter/provider-catalog.js +1 -1
- package/dist/extensions/openrouter/provider-policy-api.js +1 -1
- package/dist/extensions/openrouter/speech-provider.js +1 -1
- package/dist/extensions/openrouter/stream.js +1 -1
- package/dist/extensions/openrouter/test-api.js +4 -4
- package/dist/extensions/openrouter/thinking-policy.js +1 -1
- package/dist/extensions/openrouter/video-generation-provider.js +4 -4
- package/dist/extensions/openrouter/video-http.js +1 -1
- package/dist/extensions/openrouter/video-model-catalog.js +1 -1
- package/dist/extensions/openshell/index.js +4 -4
- package/dist/extensions/perplexity/index.js +1 -1
- package/dist/extensions/perplexity/test-api.js +1 -1
- package/dist/extensions/perplexity/web-search-contract-api.js +1 -1
- package/dist/extensions/perplexity/web-search-provider.js +1 -1
- package/dist/extensions/qianfan/api.js +2 -2
- package/dist/extensions/qianfan/index.js +3 -3
- package/dist/extensions/qianfan/onboard.js +1 -1
- package/dist/extensions/qianfan/provider-catalog.js +1 -1
- package/dist/extensions/qwen/api.js +4 -4
- package/dist/extensions/qwen/index.js +8 -8
- package/dist/extensions/qwen/media-understanding-provider.js +1 -1
- package/dist/extensions/qwen/model-definitions.js +1 -1
- package/dist/extensions/qwen/models.js +1 -1
- package/dist/extensions/qwen/onboard.js +1 -1
- package/dist/extensions/qwen/provider-catalog.js +1 -1
- package/dist/extensions/qwen/stream.js +1 -1
- package/dist/extensions/qwen/test-api.js +2 -2
- package/dist/extensions/qwen/video-generation-provider.js +1 -1
- package/dist/extensions/runway/index.js +1 -1
- package/dist/extensions/runway/video-generation-provider.js +1 -1
- package/dist/extensions/sglang/api.js +3 -3
- package/dist/extensions/sglang/defaults.js +1 -1
- package/dist/extensions/sglang/index.js +3 -3
- package/dist/extensions/sglang/models.js +1 -1
- package/dist/extensions/speech-core/api.js +1 -1
- package/dist/extensions/speech-core/runtime-api.js +3 -3
- package/dist/extensions/stepfun/index.js +4 -4
- package/dist/extensions/stepfun/onboard.js +1 -1
- package/dist/extensions/stepfun/provider-catalog.js +1 -1
- package/dist/extensions/talk-voice/api.js +1 -1
- package/dist/extensions/talk-voice/index.js +2 -2
- package/dist/extensions/tavily/index.js +1 -1
- package/dist/extensions/together/api.js +3 -3
- package/dist/extensions/together/index.js +3 -3
- package/dist/extensions/together/models.js +1 -1
- package/dist/extensions/together/onboard.js +1 -1
- package/dist/extensions/together/provider-catalog.js +1 -1
- package/dist/extensions/together/video-generation-provider.js +2 -2
- package/dist/extensions/venice/api.js +3 -3
- package/dist/extensions/venice/index.js +5 -5
- package/dist/extensions/venice/models.js +1 -1
- package/dist/extensions/venice/onboard.js +2 -2
- package/dist/extensions/venice/provider-catalog.js +1 -1
- package/dist/extensions/vercel-ai-gateway/api.js +3 -3
- package/dist/extensions/vercel-ai-gateway/index.js +3 -3
- package/dist/extensions/vercel-ai-gateway/models.js +1 -1
- package/dist/extensions/vercel-ai-gateway/onboard.js +1 -1
- package/dist/extensions/vercel-ai-gateway/provider-catalog.js +1 -1
- package/dist/extensions/vllm/api.js +3 -3
- package/dist/extensions/vllm/defaults.js +1 -1
- package/dist/extensions/vllm/index.js +3 -3
- package/dist/extensions/vllm/models.js +1 -1
- package/dist/extensions/vllm/register.runtime.js +3 -3
- package/dist/extensions/volcengine/api.js +2 -2
- package/dist/extensions/volcengine/index.js +4 -4
- package/dist/extensions/volcengine/models.js +1 -1
- package/dist/extensions/volcengine/provider-catalog.js +1 -1
- package/dist/extensions/vydra/image-generation-provider.js +1 -1
- package/dist/extensions/vydra/index.js +6 -6
- package/dist/extensions/vydra/onboard.js +1 -1
- package/dist/extensions/vydra/shared.js +1 -1
- package/dist/extensions/vydra/speech-provider.js +1 -1
- package/dist/extensions/vydra/video-generation-provider.js +1 -1
- package/dist/extensions/webhooks/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/webhooks/api.js +1 -1
- package/dist/extensions/webhooks/index.js +3 -3
- package/dist/extensions/webhooks/runtime-api.js +1 -1
- package/dist/extensions/xai/api.js +5 -5
- package/dist/extensions/xai/code-execution.js +4 -4
- package/dist/extensions/xai/index.js +11 -11
- package/dist/extensions/xai/model-definitions.js +1 -1
- package/dist/extensions/xai/model-id.js +1 -1
- package/dist/extensions/xai/onboard.js +1 -1
- package/dist/extensions/xai/provider-catalog.js +1 -1
- package/dist/extensions/xai/provider-models.js +1 -1
- package/dist/extensions/xai/setup-api.js +1 -1
- package/dist/extensions/xai/stream.js +1 -1
- package/dist/extensions/xai/video-generation-provider.js +1 -1
- package/dist/extensions/xai/web-search.js +1 -1
- package/dist/extensions/xai/x-search-tool-shared.js +1 -1
- package/dist/extensions/xai/x-search.js +4 -4
- package/dist/extensions/xiaomi/api.js +2 -2
- package/dist/extensions/xiaomi/index.js +3 -3
- package/dist/extensions/xiaomi/onboard.js +1 -1
- package/dist/extensions/xiaomi/provider-catalog.js +1 -1
- package/dist/extensions/zai/api.js +3 -3
- package/dist/extensions/zai/detect.js +1 -1
- package/dist/extensions/zai/index.js +6 -6
- package/dist/extensions/zai/media-understanding-provider.js +1 -1
- package/dist/extensions/zai/model-definitions.js +1 -1
- package/dist/extensions/zai/onboard.js +1 -1
- package/dist/extensions/zai/runtime-api.js +1 -1
- package/dist/extensions/zai/test-api.js +1 -1
- package/dist/fragment-collector-MPWszaY5.js +189 -0
- package/dist/fragment-store-SR8Bo1em.js +218 -0
- package/dist/fragment-store-TRt-PDu_.js +2 -0
- package/dist/gateway-cli-Lc4_vwt0.js +1518 -0
- package/dist/gateway-discovery-targets-_JD1loMg.js +431 -0
- package/dist/gateway-install-token-DuMEOLtu.js +284 -0
- package/dist/gateway-rpc-JpewBoh5.js +14 -0
- package/dist/gateway-rpc.runtime.js +1 -1
- package/dist/gateway-secret-options-DIWh0avy.js +38 -0
- package/dist/gemini-cli-provider-DJmyF3F1.js +106 -0
- package/dist/gemini-web-search-provider-cXSR-qZm.js +167 -0
- package/dist/get-reply-from-config.runtime-dgpM1fFS.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/git-commit-D50Y5N45.js +2 -0
- package/dist/groups.runtime.js +1 -1
- package/dist/hard-trigger-DRIZJ_PJ.js +98 -0
- package/dist/health-BF4wCwJ7.js +2 -0
- package/dist/health-DuV85G9Q.js +579 -0
- package/dist/heartbeat-runner-CIQHWCd1.js +1209 -0
- package/dist/heartbeat-runner-DMXeqQSX.js +4 -0
- package/dist/heartbeat-runner.runtime-DSMkYfFM.js +2 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/help-Byb6TFWt.js +81 -0
- package/dist/hooks-cli-DnhC5miz.js +354 -0
- package/dist/hooks-status-7gNHQOXj.js +86 -0
- package/dist/image-generation-core-DgBQ7yxF.js +17 -0
- package/dist/image-generation-core.auth.runtime.js +1 -1
- package/dist/image-generation-provider-BKlDd4sX.js +130 -0
- package/dist/image-generation-provider-BVJFZnGv.js +136 -0
- package/dist/image-generation-provider-C4zaGMAe.js +279 -0
- package/dist/image-generation-provider-CYdLui77.js +94 -0
- package/dist/image-generation-provider-vw6Mifhx.js +163 -0
- package/dist/image-runtime-B76ETuEi.js +7 -0
- package/dist/inbound-reply-dispatch-DcaeKmuz.js +73 -0
- package/dist/inbound.runtime-DzuOEHYA.js +4 -0
- package/dist/inbound.runtime-ImqdTVOI.js +3 -0
- package/dist/inbound.runtime.js +1 -1
- package/dist/index.js +2 -2
- package/dist/ingest-BNyXzldJ.js +842 -0
- package/dist/ingest-C35XEC_T.js +2 -0
- package/dist/install-BdauYB9u.js +662 -0
- package/dist/install-security-scan-ZoCtjNeN.js +22 -0
- package/dist/install-security-scan.runtime-B1sRhkiV.js +299 -0
- package/dist/install-security-scan.runtime.js +1 -1
- package/dist/install-skills-CQnadGky.js +70 -0
- package/dist/install.runtime-QcrQsqdQ.js +12 -0
- package/dist/install.runtime-zgelN4-_.js +27 -0
- package/dist/install.runtime.js +1 -1
- package/dist/kaijibot-tools-Dl2qUSAS.js +9233 -0
- package/dist/kaijibot-tools.runtime-BuTXGJaj.js +2 -0
- package/dist/kaijibot-tools.runtime.js +1 -1
- package/dist/kimi-web-search-provider-OUDV-0Ow.js +308 -0
- package/dist/lancedb-runtime-DyHQv3-S.js +201 -0
- package/dist/library-Dhl58R3p.js +45 -0
- package/dist/list.runtime-CeH-Xrnd.js +9 -0
- package/dist/list.runtime-FnCw60Xk.js +12 -0
- package/dist/list.runtime.js +1 -1
- package/dist/llm-draft-generator-Be49MQGG.js +567 -0
- package/dist/llm-draft-generator-DEhC2yYf.js +2 -0
- package/dist/llm-engine-BFepNvS0.js +2 -0
- package/dist/llm-engine-BNOxcQrz.js +1829 -0
- package/dist/llm-slug-generator.js +2 -2
- package/dist/login-DAPUtXft.js +108 -0
- package/dist/logs-cli-Dee6SLM_.js +264 -0
- package/dist/logs-cli.runtime.js +1 -1
- package/dist/manager-ZJ_EZtK4.js +2048 -0
- package/dist/manager-czo1q1sv.js +3301 -0
- package/dist/mcp-cli-BjG2nOiR.js +723 -0
- package/dist/media-runtime-CGXSFOdW.js +312 -0
- package/dist/media-understanding-CEFjui05.js +83 -0
- package/dist/media-understanding-provider-2LeNsCXQ.js +13 -0
- package/dist/media-understanding-provider-AxZChB3Q.js +14 -0
- package/dist/media-understanding-provider-B8KTGMNt.js +67 -0
- package/dist/media-understanding-provider-BhfBs6XJ.js +37 -0
- package/dist/media-understanding-provider-By7-KDWp.js +112 -0
- package/dist/media-understanding-provider-CJvPSRD_.js +18 -0
- package/dist/media-understanding-provider-CeDiKBMV.js +21 -0
- package/dist/media-understanding-provider-Cflmzkbe.js +18 -0
- package/dist/media-understanding-provider-D0G4SyRE.js +69 -0
- package/dist/media-understanding-provider-D5w0Ycf_.js +30 -0
- package/dist/media-understanding-provider-RWVVnBkv.js +123 -0
- package/dist/media-understanding-runtime-DrGfjXfY.js +2 -0
- package/dist/memory-C89wZkq_.js +3 -0
- package/dist/memory-core-host-runtime-cli-D5QiXWY7.js +9 -0
- package/dist/memory-host-search.runtime.js +1 -1
- package/dist/memory-index-B4acWB-F.js +514 -0
- package/dist/memory-index-Ci_IEkkP.js +2 -0
- package/dist/memory-kGhz1aad.js +242 -0
- package/dist/memory-repair-CXOPaLj_.js +2 -0
- package/dist/message-VnqF7FPQ.js +223 -0
- package/dist/message-action-runner-D1JKJNCt.js +1628 -0
- package/dist/message-action-runner-sNr7cRbq.js +2 -0
- package/dist/message.config.runtime.js +1 -1
- package/dist/message.gateway.runtime.js +1 -1
- package/dist/metadata-registry-loader-FpYi7huO.js +2 -0
- package/dist/minimax-web-search-provider-B80wlL3J.js +165 -0
- package/dist/mmr-BUVQm7ma.js +146 -0
- package/dist/model-catalog-BGubK2PO.js +157 -0
- package/dist/model-definitions-6-ZRKXxZ.js +74 -0
- package/dist/model-definitions-BGyaoan5.js +258 -0
- package/dist/model-definitions-CcSMc0tQ.js +28 -0
- package/dist/model-picker-BFYJZOu-.js +490 -0
- package/dist/model-picker-DU3_Nbi5.js +3 -0
- package/dist/model-picker.runtime-CMM8ER27.js +15 -0
- package/dist/model-picker.runtime.js +1 -1
- package/dist/model-selection-Beb96cml.js +381 -0
- package/dist/model-suppression.runtime.js +1 -1
- package/dist/models-B86OciCd.js +47 -0
- package/dist/models-BNG4ZStW.js +18 -0
- package/dist/models-Bw6Q27IA.js +555 -0
- package/dist/models-CUBw1avj.js +18 -0
- package/dist/models-CwtKbjMZ.js +157 -0
- package/dist/models-DUOR6dY_.js +760 -0
- package/dist/models-DltDSCEF.js +19 -0
- package/dist/models-EzdNn5lr.js +2 -0
- package/dist/models-cWV4E77X.js +2584 -0
- package/dist/models-cli-CSnvqJzN.js +197 -0
- package/dist/models.fetch-CmkgmRli.js +518 -0
- package/dist/monitor-Cy4MsZcL.js +4435 -0
- package/dist/music-generation-provider-IKtFX3pf.js +169 -0
- package/dist/music-generation-provider-qXzAqm-8.js +238 -0
- package/dist/music-generation-provider-x1vHpdDc.js +142 -0
- package/dist/node-cli-U7yaSPh3.js +2362 -0
- package/dist/nodes-cli-CsrUwJmw.js +1046 -0
- package/dist/notify-DnKv7zGy.js +305 -0
- package/dist/oauth-BU9Kg4J4.js +57 -0
- package/dist/oauth-D9z3vVZZ.js +152 -0
- package/dist/oauth-token-shared-C2vJuJJA.js +28 -0
- package/dist/oauth.credentials-BDOOigYJ.js +165 -0
- package/dist/oauth.flow-Bi3XRwXD.js +122 -0
- package/dist/oauth.settings-BRN2Sz6R.js +44 -0
- package/dist/oauth.token-CASx9EQP.js +43 -0
- package/dist/onboard-4eXQ1KyP.js +29 -0
- package/dist/onboard-8UfovJuH.js +48 -0
- package/dist/onboard-BEkTYzmT.js +25 -0
- package/dist/onboard-BFu8lV32.js +312 -0
- package/dist/onboard-BICzWILe.js +36 -0
- package/dist/onboard-BOUcR8be.js +621 -0
- package/dist/onboard-BcoQSNQW.js +25 -0
- package/dist/onboard-BuBPPxds.js +26 -0
- package/dist/onboard-CX7hnr8D.js +39 -0
- package/dist/onboard-CXfC1yg8.js +67 -0
- package/dist/onboard-CbymSfBU.js +58 -0
- package/dist/onboard-DGyDRLc3.js +29 -0
- package/dist/onboard-DK-jzfWx.js +22 -0
- package/dist/onboard-DVWKadpJ.js +34 -0
- package/dist/onboard-DoIWd2We.js +25 -0
- package/dist/onboard-Ez4QGniV2.js +54 -0
- package/dist/onboard-channels-BILGE-i9.js +2 -0
- package/dist/onboard-channels-MuLliRf5.js +1260 -0
- package/dist/onboard-config-Byvc0oUh.js +2 -0
- package/dist/onboard-custom-CLaOD_BI.js +2 -0
- package/dist/onboard-custom-CbRHjDNL.js +647 -0
- package/dist/onboard-helpers-BJhCcI9U.js +223 -0
- package/dist/onboard-helpers-CMvJfZTX.js +5 -0
- package/dist/onboard-hooks-BfXdgHQj.js +35 -0
- package/dist/onboard-remote-B0KquzSo.js +193 -0
- package/dist/onboard-remote-B7vnhLj3.js +2 -0
- package/dist/onboard-search-BLjfhCPG.js +324 -0
- package/dist/onboard-skills-CkO8UvfF.js +134 -0
- package/dist/onboard-skills-D9ML0g4M.js +2 -0
- package/dist/openai-codex-auth-identity-DSKWx0wS.js +45 -0
- package/dist/openai-codex-cli-auth-DzOuQekO.js +57 -0
- package/dist/openai-codex-provider-DmVwiyKq.js +299 -0
- package/dist/openai-codex-shared-DGT1w6Uz.js +6 -0
- package/dist/openai-provider-SnRU2x3L.js +283 -0
- package/dist/openclaw-migrator-BQWk325M.js +2 -0
- package/dist/pair-command-approve-DdHdrhCK.js +34 -0
- package/dist/pairing-cli-B57ZjuC5.js +117 -0
- package/dist/perplexity-web-search-provider-BbeQ3_8w.js +92 -0
- package/dist/perplexity-web-search-provider.runtime-BtpRxkdq.js +332 -0
- package/dist/perplexity-web-search-provider.runtime-Dt4WauP_.js +2 -0
- package/dist/perplexity-web-search-provider.runtime.js +1 -1
- package/dist/persistent-bindings.lifecycle-BevP5OlU.js +94 -0
- package/dist/pi-embedded-BbJAO5yK.js +6 -0
- package/dist/pi-embedded-runner-DZaBmFzW.js +8346 -0
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime-CfHAZp-z.js +23 -0
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime.js +1 -1
- package/dist/pi-embedded-tQf0HjTv.js +2 -0
- package/dist/pi-embedded.runtime-B9ZAb_RR.js +5 -0
- package/dist/pi-embedded.runtime.js +1 -1
- package/dist/pi-tools.before-tool-call.runtime-BqDR-_03.js +354 -0
- package/dist/pi-tools.before-tool-call.runtime.js +1 -1
- package/dist/plugin-enabled-B2DgsAtk.js +71 -0
- package/dist/plugin-install-BjOxLVHm.js +227 -0
- package/dist/plugin-install-CLGT8Lak.js +2 -0
- package/dist/plugin-install-config-policy-CZTvkRR9.js +137 -0
- package/dist/plugin-install-plan-CySOZ7mU.js +50 -0
- package/dist/plugin-registration-CfKqWKnW.js +23 -0
- package/dist/plugin-registry-C1mIFpCz.js +2 -0
- package/dist/plugin-registry-igF4eBbt.js +3 -0
- package/dist/plugin-registry-loader-BUYJrGoS.js +22 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
- package/dist/plugin-sdk/acp-runtime.js +3 -3
- package/dist/plugin-sdk/agent-harness-runtime.js +4 -4
- package/dist/plugin-sdk/agent-runtime.js +2 -2
- package/dist/plugin-sdk/browser-node-runtime.js +2 -2
- package/dist/plugin-sdk/browser-support.js +2 -2
- package/dist/plugin-sdk/channel-core.js +2 -2
- package/dist/plugin-sdk/channel-inbound.js +3 -3
- package/dist/plugin-sdk/command-auth.js +3 -3
- package/dist/plugin-sdk/compat.js +1 -1
- package/dist/plugin-sdk/config-runtime.js +3 -3
- package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
- package/dist/plugin-sdk/conversation-runtime.js +4 -4
- package/dist/plugin-sdk/core.js +3 -3
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
- package/dist/plugin-sdk/image-generation-core.js +1 -1
- package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/infra-runtime.js +1 -1
- package/dist/plugin-sdk/media-runtime.js +5 -5
- package/dist/plugin-sdk/media-understanding-runtime.js +2 -2
- package/dist/plugin-sdk/media-understanding.js +2 -2
- package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
- package/dist/plugin-sdk/memory-core.js +2 -2
- package/dist/plugin-sdk/memory-host-search.js +1 -1
- package/dist/plugin-sdk/models-provider-runtime.js +1 -1
- package/dist/plugin-sdk/plugin-test-contracts.js +1 -1
- package/dist/plugin-sdk/plugin-test-runtime.js +1 -1
- package/dist/plugin-sdk/provider-auth-api-key.js +2 -2
- package/dist/plugin-sdk/provider-auth-login.js +1 -1
- package/dist/plugin-sdk/provider-auth.js +2 -2
- package/dist/plugin-sdk/provider-entry.js +1 -1
- package/dist/plugin-sdk/provider-http-test-mocks.js +1 -1
- package/dist/plugin-sdk/provider-test-contracts.js +1 -1
- package/dist/plugin-sdk/reply-dispatch-runtime.js +1 -1
- package/dist/plugin-sdk/reply-runtime.js +4 -4
- package/dist/plugin-sdk/runtime-doctor.js +1 -1
- package/dist/plugin-sdk/runtime-secret-resolution.js +1 -1
- package/dist/plugin-sdk/runtime.js +3 -3
- package/dist/plugin-sdk/sandbox.js +2 -2
- package/dist/plugin-sdk/session-store-runtime.js +2 -2
- package/dist/plugin-sdk/skill-commands-runtime.js +1 -1
- package/dist/plugin-sdk/test-env.js +1 -1
- package/dist/plugin-sdk/testing.js +4 -4
- package/dist/plugin-sdk/text-runtime.js +2 -2
- package/dist/plugin-service-Dozf9cCQ.js +2494 -0
- package/dist/plugins/runtime/index.js +1 -1
- package/dist/plugins-cli-DQjn2ytT.js +566 -0
- package/dist/plugins-command-helpers-Bq2ECLcC.js +117 -0
- package/dist/plugins-install-persist-chKkbZiL.js +121 -0
- package/dist/plugins-update-command-CmzP42fb.js +1008 -0
- package/dist/policy-BsszCKEI.js +172 -0
- package/dist/preemptive-compaction-CVDrUhXK.js +430 -0
- package/dist/proactive-scheduler-tMSsCjDZ.js +1311 -0
- package/dist/probe-Kqo7OqQF.js +426 -0
- package/dist/probe-auth-BJ3yckIw.js +3 -0
- package/dist/program-DFP-Y-n2.js +111 -0
- package/dist/program-context-6irSsyF2.js +2 -0
- package/dist/prompt-overlay-BEhj9P_7.js +72 -0
- package/dist/prompt-select-styled-sDck0Qqt.js +5299 -0
- package/dist/provider-CeNuW2fv.js +70 -0
- package/dist/provider-api-key-auth-URznqBcK.js +113 -0
- package/dist/provider-api-key-auth.runtime.js +1 -1
- package/dist/provider-auth-6QHap3yT.js +36 -0
- package/dist/provider-auth-api-key-LiKYWj18.js +5 -0
- package/dist/provider-auth-choice-Dos9S6zz.js +134 -0
- package/dist/provider-auth-choice-preference-CT90SYMg.js +62 -0
- package/dist/provider-auth-login-CxyguwXg.js +8 -0
- package/dist/provider-auth-login.runtime-CcwpVvy3.js +206 -0
- package/dist/provider-auth-login.runtime.js +1 -1
- package/dist/provider-catalog-5ZYAb8dU.js +11 -0
- package/dist/provider-catalog-B4PQf5FY.js +12 -0
- package/dist/provider-catalog-BDZO2k2i.js +18 -0
- package/dist/provider-catalog-BfLspzSz.js +11 -0
- package/dist/provider-catalog-CVTCMT4G.js +11 -0
- package/dist/provider-catalog-CsAe-lZz.js +11 -0
- package/dist/provider-catalog-DHN9L06H.js +61 -0
- package/dist/provider-catalog-DIJbow9j.js +26 -0
- package/dist/provider-catalog-DWOeklon.js +16 -0
- package/dist/provider-catalog-FJLanWNs.js +16 -0
- package/dist/provider-catalog-High_lTQ.js +13 -0
- package/dist/provider-catalog-n-gU9Nae.js +56 -0
- package/dist/provider-catalog-wB54CKl2.js +17 -0
- package/dist/provider-compat-luZe7x7D.js +37 -0
- package/dist/provider-dispatcher-BXUvUURc.js +22 -0
- package/dist/provider-entry-DTu3iGNy.js +97 -0
- package/dist/provider-flow-0fivwh2g.js +66 -0
- package/dist/provider-models-BLjQcHNo.js +35 -0
- package/dist/provider-models-CLzRFNLI.js +116 -0
- package/dist/provider-models-K_luQ9zn.js +119 -0
- package/dist/provider-registration-CCkbZbdG.js +238 -0
- package/dist/provider-registration-COl5A7qb.js +57 -0
- package/dist/push-apns-8kAU9XsA.js +1013 -0
- package/dist/pw-ai-BNM0ufGa.js +2268 -0
- package/dist/qmd-manager-jB94G-JS.js +1799 -0
- package/dist/qr-cli-6tySRB_t.js +2 -0
- package/dist/qr-cli-CIhINSCH.js +359 -0
- package/dist/qr-image-D0nYZ-TN.js +2 -0
- package/dist/queue-BjJj4JaJ.js +636 -0
- package/dist/realtime-provider-shared-DW8GAMAi.js +21 -0
- package/dist/realtime-transcription-provider-5PlTLQxo.js +180 -0
- package/dist/realtime-voice-provider-Rl-_1Ycr.js +342 -0
- package/dist/record-shared-7rP3Bc1p.js +10 -0
- package/dist/region-BMo8YuB-.js +74 -0
- package/dist/register-command-groups-BoiHpzbo.js +121 -0
- package/dist/register.agent-CMlgjTUp.js +241 -0
- package/dist/register.configure-D2PnybVp.js +15 -0
- package/dist/register.maintenance-Cx1bo75e.js +438 -0
- package/dist/register.message-CX4jxOsU.js +601 -0
- package/dist/register.migrate-BSWEPPJq.js +195 -0
- package/dist/register.onboard-D204MxI8.js +79 -0
- package/dist/register.runtime-BHO4Mi1q.js +343 -0
- package/dist/register.runtime-CVCoeVMv.js +81 -0
- package/dist/register.runtime.js +1 -1
- package/dist/register.setup-B4Satuvx.js +104 -0
- package/dist/register.status-health-sessions-CFmAM_xF.js +1210 -0
- package/dist/register.subclis-BXqnDdhF.js +237 -0
- package/dist/register.subclis-BZeyeBpg.js +3 -0
- package/dist/replay-policy-DDo0U5gR.js +8 -0
- package/dist/reply-DOkWfPrg.js +3498 -0
- package/dist/reply-payloads-dedupe.runtime.js +1 -1
- package/dist/reply.runtime-7BWsyeU3.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/resolve-BF5HlfJ2.js +280 -0
- package/dist/root-help-Do6N50zy.js +44 -0
- package/dist/route-reply-CxLiVUHW.js +141 -0
- package/dist/route-reply.runtime-WJUFT71F.js +2 -0
- package/dist/route-reply.runtime.js +1 -1
- package/dist/rpc-DaMAO4N5.js +61 -0
- package/dist/rpc.runtime.js +1 -1
- package/dist/run-main-i1Lwkfhp.js +452 -0
- package/dist/runner-BhfpNH-y.js +1497 -0
- package/dist/runs-Dtgg0O85.js +495 -0
- package/dist/runtime-BkiJ7uXt.js +725 -0
- package/dist/runtime-DMH3YN2r.js +200 -0
- package/dist/runtime-Dbujl_K6.js +72 -0
- package/dist/runtime-api-CyQJnTq5.js +3 -0
- package/dist/runtime-api-DTGmvXqo.js +2 -0
- package/dist/runtime-api-XhgZNDDz.js +12 -0
- package/dist/runtime-embedded-pi.runtime-2IY46Gqk.js +3 -0
- package/dist/runtime-embedded-pi.runtime.js +1 -1
- package/dist/runtime-hZStyXlw.js +9 -0
- package/dist/runtime-iikVqZe4.js +107 -0
- package/dist/runtime-internal-ezWrk6r4.js +2 -0
- package/dist/runtime-manifest.runtime.js +1 -1
- package/dist/runtime-model-auth.runtime.js +1 -1
- package/dist/runtime-plugins-Db6kuYci.js +69 -0
- package/dist/runtime-prepare.runtime-Cwi1gPe8.js +80 -0
- package/dist/runtime-prepare.runtime.js +1 -1
- package/dist/runtime-provider-FNR5p8dE.js +21 -0
- package/dist/runtime-registry-loader-B2uTAkcu.js +2 -0
- package/dist/runtime-registry-loader-BSSFfiA2.js +58 -0
- package/dist/runtime-taskflow-BNYQSKvj.js +250 -0
- package/dist/runtime-web-tools-C2G_nK0L.js +1467 -0
- package/dist/runtime-web-tools-fallback.runtime.js +1 -1
- package/dist/runtime-web-tools-manifest.runtime.js +1 -1
- package/dist/runtime-web-tools-public-artifacts.runtime.js +1 -1
- package/dist/runtime-xrE2MaAG.js +2 -0
- package/dist/sandbox-BvT5A1gq.js +2586 -0
- package/dist/sandbox-DcIgRqKW.js +4 -0
- package/dist/sandbox-cli-6nhldN9E.js +446 -0
- package/dist/secrets-cli-Cvl-P5yr.js +2099 -0
- package/dist/security-audit-BeGlFXMY.js +34 -0
- package/dist/security-cli-oVahjZR_.js +486 -0
- package/dist/semantic-dedup-CA-I7Ukf.js +95 -0
- package/dist/send-D85zCCtz.js +993 -0
- package/dist/server-A5MuFop-.js +13 -0
- package/dist/server-BeEiCBG9.js +77 -0
- package/dist/server-context-COXRgV8p.js +4164 -0
- package/dist/server-methods-CXboJZ1n.js +11666 -0
- package/dist/server-middleware-4ESC7-Sf.js +110 -0
- package/dist/server-node-events-CBlxJH3f.js +451 -0
- package/dist/server.impl-DZDIujUx.js +19517 -0
- package/dist/session-CA0A9yxZ.js +48 -0
- package/dist/session-archive.runtime.js +1 -1
- package/dist/session-conversation-BECTi25r.js +27 -0
- package/dist/session-file-B8YnZYnE.js +44 -0
- package/dist/session-fork.runtime.js +1 -1
- package/dist/session-key-DlOZb3y8.js +65 -0
- package/dist/session-meta-Mc12pE_f.js +109 -0
- package/dist/session-override-BOCk8YTE.js +103 -0
- package/dist/session-reset-model.runtime-Dd8V_Qvt.js +120 -0
- package/dist/session-reset-model.runtime.js +1 -1
- package/dist/session-reset-service-Di0Ge9fM.js +473 -0
- package/dist/session-subagent-reactivation.runtime-Cj6XCKz6.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-tab-registry-DGfXa1gc.js +553 -0
- package/dist/session-updates-D3PEvDgu.js +234 -0
- package/dist/session-updates.runtime-CkHjMzfc.js +2 -0
- package/dist/session-updates.runtime.js +1 -1
- package/dist/session-utils-D1IfM96V.js +915 -0
- package/dist/sessions-CEUVpAYU.js +2 -0
- package/dist/sessions-CoYhbu6F.js +45 -0
- package/dist/sessions-Dr45TPx1.js +226 -0
- package/dist/sessions.runtime-3gC3AX8f.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/setup-CuKFik4t.js +496 -0
- package/dist/setup-DAJzkyY_.js +329 -0
- package/dist/setup-surface-Df7BhHSW.js +586 -0
- package/dist/setup.finalize-DhoSjlM4.js +432 -0
- package/dist/setup.gateway-config-B52nJix9.js +246 -0
- package/dist/shared-BYZv0yT8.js +218 -0
- package/dist/shared-D0v2yZO3.js +224 -0
- package/dist/shared-DNpedGYM.js +175 -0
- package/dist/shared-rD1K1AE-.js +36 -0
- package/dist/shared-runtime-C_5NHgLY.js +7 -0
- package/dist/short-term-promotion-BVTlPjVr.js +1631 -0
- package/dist/skill-commands-DRwVp1wc.js +82 -0
- package/dist/skill-commands.runtime-BKbablWg.js +2 -0
- package/dist/skill-commands.runtime.js +1 -1
- package/dist/skill-lifecycle-rVTllkZP.js +105 -0
- package/dist/skill-quality-gate-DHgd48qD.js +127 -0
- package/dist/skill-usage-tracker-B7aHh_Ob.js +31 -0
- package/dist/skills-cli-KHLSIaYT.js +370 -0
- package/dist/skills-install-Bi0q12q3.js +822 -0
- package/dist/speech-provider-BKPgfWII.js +103 -0
- package/dist/speech-provider-CqKVL2PU.js +184 -0
- package/dist/speech-provider-DaDkiNqQ.js +182 -0
- package/dist/speech-provider-DzPBhJrM.js +43 -0
- package/dist/speech-provider-vPL2J1om.js +167 -0
- package/dist/stage-sandbox-media.runtime-BKwxztks.js +230 -0
- package/dist/stage-sandbox-media.runtime.js +1 -1
- package/dist/state-dir-env-BwtlM2-b.js +156 -0
- package/dist/state-migrations-yqQW8QaA.js +822 -0
- package/dist/status-B1w-wvI5.js +278 -0
- package/dist/status-BhC5yy0h.js +479 -0
- package/dist/status-BnKPMpvt.js +473 -0
- package/dist/status-CRKDtvgH.js +391 -0
- package/dist/status-D9-BPbMq.js +3 -0
- package/dist/status-DuipKIlm.js +2 -0
- package/dist/status-I6cSEcXL.js +2 -0
- package/dist/status-all-dJ4Cgy30.js +487 -0
- package/dist/status-json-7SU-gA25.js +14 -0
- package/dist/status-json-command-SjLpkj4G.js +84 -0
- package/dist/status-runtime-shared-DAXwrfRv.js +254 -0
- package/dist/status.command.text-runtime-DBq5ztDE.js +15 -0
- package/dist/status.gateway-connection.runtime.js +1 -1
- package/dist/status.gateway-probe-BMXgnQZz.js +16 -0
- package/dist/status.link-channel-Co7PKXYC.js +35 -0
- package/dist/status.node-mode-BskByQcM.js +2 -0
- package/dist/status.node-mode-MNP21t-j.js +32 -0
- package/dist/status.scan-86I4Stxm.js +62 -0
- package/dist/status.scan-overview-CL7c8JQD.js +395 -0
- package/dist/status.scan.deps.runtime.js +1 -1
- package/dist/status.scan.fast-json-C3Kd8f32.js +128 -0
- package/dist/status.scan.fast-json-DLYIlSmm.js +2 -0
- package/dist/status.scan.runtime-D7E5Jl1o.js +417 -0
- package/dist/status.scan.runtime.js +1 -1
- package/dist/status.summary-0CUmMOwK.js +209 -0
- package/dist/status.summary-Bc7FVtbT.js +2 -0
- package/dist/store-DEIAq0ow.js +190 -0
- package/dist/store-Dv1w50zD.js +1112 -0
- package/dist/store.runtime-CMb32WnT.js +2 -0
- package/dist/store.runtime.js +1 -1
- package/dist/stream-CV2RD2-m.js +153 -0
- package/dist/stream-DcD1NqBt.js +649 -0
- package/dist/stream-wrappers-C7tDdQmU.js +144 -0
- package/dist/subagent-announce.registry.runtime-BN09hP9S.js +3 -0
- package/dist/subagent-announce.registry.runtime.js +1 -1
- package/dist/subagent-control-g8gumjoW.js +485 -0
- package/dist/subagent-followup.runtime-D8_8y-bE.js +68 -0
- package/dist/subagent-followup.runtime.js +1 -1
- package/dist/subagent-list-BQadcXKp.js +168 -0
- package/dist/subagent-orphan-recovery-DKtl7-gN.js +214 -0
- package/dist/subagent-registry-CgA-7Sw0.js +2888 -0
- package/dist/subagent-registry-runtime-U36TYYp-.js +2 -0
- package/dist/subagent-registry.runtime-BG_04MZ8.js +3 -0
- package/dist/subagent-registry.runtime.js +1 -1
- package/dist/subagent-spawn-C-lFCaZU.js +781 -0
- package/dist/subagents-format-L-LSiKRw.js +628 -0
- package/dist/subcli-descriptors-BhcmMAKP.js +173 -0
- package/dist/supervisor-D0ax5pz4.js +737 -0
- package/dist/supervisor-log.runtime.js +1 -1
- package/dist/system-cli-R67ndVvg.js +59 -0
- package/dist/systemd-linger-BGik3fP6.js +2 -0
- package/dist/targets-fPlUpwy5.js +594 -0
- package/dist/targets.runtime.js +1 -1
- package/dist/task-executor-C5OqCdJT.js +350 -0
- package/dist/task-owner-access-DUUqFfrD.js +48 -0
- package/dist/task-registry-BLiMD4oJ.js +2346 -0
- package/dist/task-registry-control.runtime-r5niRcNj.js +3 -0
- package/dist/task-registry-control.runtime.js +1 -1
- package/dist/task-registry-delivery-runtime-IKmxWzoW.js +3 -0
- package/dist/task-registry-delivery-runtime-OKU7m4ZJ.js +2 -0
- package/dist/task-registry.maintenance-BD6d9fLw.js +425 -0
- package/dist/task-registry.maintenance-BWULaP2e.js +2 -0
- package/dist/test.DNmyFkvJ-NRc14Xgm.js +13549 -0
- package/dist/testing-CaQDWPX6.js +441 -0
- package/dist/text-report-B1SlZa6w.js +587 -0
- package/dist/text-runtime-CNganbWZ.js +313 -0
- package/dist/thinking-policy-Cvv8S99b.js +25 -0
- package/dist/thread-bindings-1wsoDY-O.js +223 -0
- package/dist/tool-auth-shared-C6gQslQe.js +53 -0
- package/dist/tool-config-shared-RmlkWteZ.js +19 -0
- package/dist/tool-schema-runtime-CNP7lov-.js +1892 -0
- package/dist/tools-effective-inventory-D2LiEd3k.js +152 -0
- package/dist/tools.runtime-dLGMSI3J.js +4 -0
- package/dist/tools.runtime.js +1 -1
- package/dist/topic-types-DbuGFU7y.js +176 -0
- package/dist/topic-types-zRlULO3k.js +2 -0
- package/dist/transcript-DYzzYksv.js +191 -0
- package/dist/transcript.runtime-ChFgiLq_.js +2 -0
- package/dist/transcript.runtime.js +1 -1
- package/dist/transport-policy-BHGu-DSE.js +75 -0
- package/dist/tts-lKPaxyDc.js +31 -0
- package/dist/tts.runtime-DLCeTRap.js +3 -0
- package/dist/tts.runtime.js +1 -1
- package/dist/tui-1ksaisKX.js +4017 -0
- package/dist/tui-cli-B809Ui8G.js +31 -0
- package/dist/uninstall-CG2Twdr_.js +172 -0
- package/dist/update-3rFnCBJG.js +1253 -0
- package/dist/update-cli-S6D0vMUi.js +1763 -0
- package/dist/update-runner-Cp7B-UEq.js +1490 -0
- package/dist/video-generation-provider-4GrzW0iH.js +240 -0
- package/dist/video-generation-provider-BFzOwA12.js +77 -0
- package/dist/video-generation-provider-BIqj5J7G.js +227 -0
- package/dist/video-generation-provider-BrpGBUIA.js +64 -0
- package/dist/video-generation-provider-Bww0w9Vg.js +263 -0
- package/dist/video-generation-provider-CAqz-_cR.js +246 -0
- package/dist/video-generation-provider-DVgCz9i4.js +181 -0
- package/dist/video-generation-provider-_ge0iP27.js +233 -0
- package/dist/video-generation-provider-cMUD_fls.js +104 -0
- package/dist/video-generation-provider-m9cCpntw.js +171 -0
- package/dist/video-model-catalog-CyWIvCKl.js +187 -0
- package/dist/web-search-BtwmRrNq.js +221 -0
- package/dist/web-search-provider-BpVY1JYn.js +155 -0
- package/dist/webhooks-cli-BGIp-CI4.js +321 -0
- package/dist/workspace-B5a0KS0o.js +306 -0
- package/dist/x-search-shared-lXehAzFd.js +109 -0
- package/package.json +1 -1
- package/dist/abort-BAZ4Ebr2.js +0 -202
- package/dist/abort-cutoff.runtime-igWwDxEw.js +0 -20
- package/dist/abort.runtime-DcpaA7X3.js +0 -2
- package/dist/acp-cli-fDFv0ZXk.js +0 -2171
- package/dist/acp-spawn-DMdjDkJ5.js +0 -1023
- package/dist/acp-stateful-target-driver-D5xSz_pT.js +0 -87
- package/dist/action-agents-qdK1hUqZ.js +0 -67
- package/dist/action-focus-CdznyCxX.js +0 -124
- package/dist/action-help-BXDtyZ9B.js +0 -7
- package/dist/action-info-DeYigB1U.js +0 -58
- package/dist/action-kill-BYYddQgx.js +0 -33
- package/dist/action-list-DCUxXaqg.js +0 -21
- package/dist/action-log-ta83LqJ5.js +0 -30
- package/dist/action-send-BwBxb6AI.js +0 -39
- package/dist/action-spawn-CDGEb2hC.js +0 -46
- package/dist/action-unfocus-MTpGUzeN.js +0 -28
- package/dist/agent-5S4TqcpJ.js +0 -2
- package/dist/agent-command-DYyWnBzs.js +0 -1479
- package/dist/agent-runner-utils-rqbgwfQ0.js +0 -202
- package/dist/agent-runner.runtime-CTRf_5bQ.js +0 -2825
- package/dist/agents-CfpAO55S.js +0 -887
- package/dist/agents-D-ZmUSjz.js +0 -5
- package/dist/api-C5y5vg1n.js +0 -35
- package/dist/api-CepvsESp.js +0 -5
- package/dist/api-CxsUi6pI.js +0 -4
- package/dist/api-D-WxCS9o.js +0 -16
- package/dist/api-D0KNG-Ur.js +0 -3
- package/dist/api-D2Ik6_Ws.js +0 -4
- package/dist/api-D2RppWnw.js +0 -3
- package/dist/api-DSlHQbdg.js +0 -2
- package/dist/api-DZMhnnQa.js +0 -2
- package/dist/api-Do7V2W5w.js +0 -5
- package/dist/api-Dzb-44IA.js +0 -45
- package/dist/api-Nut6qdm_.js +0 -2
- package/dist/api-YOeD914m.js +0 -19
- package/dist/api-uhRvZWia.js +0 -44
- package/dist/apply-BVSjDVZt.js +0 -493
- package/dist/apply.runtime-BHaqP4o2.js +0 -2
- package/dist/apply.runtime-CGLynFYo.js +0 -166
- package/dist/audit-D0PNQf9m.js +0 -885
- package/dist/audit-extra.async-fyXymls3.js +0 -847
- package/dist/audit.deep.runtime-T3-fGhge.js +0 -2
- package/dist/audit.nondeep.runtime-D-CVblWF.js +0 -859
- package/dist/audit.runtime-CjBqFqlt.js +0 -7
- package/dist/auth-CeX7bu-Z.js +0 -181
- package/dist/auth-choice-D5Gw60Q0.js +0 -3
- package/dist/auth-choice-DEMT93N0.js +0 -71
- package/dist/auth-choice-ilal0OWZ.js +0 -353
- package/dist/auth-choice-options-BwW-zFH5.js +0 -104
- package/dist/auth-choice-prompt--rfX_gS3.js +0 -2
- package/dist/auth-choice-prompt-X5e5PeD9.js +0 -36
- package/dist/auto-disable-BIMG7Fjd.js +0 -69
- package/dist/auto-disable-C-48B0tK.js +0 -2
- package/dist/banner-B6HSrIeR.js +0 -2
- package/dist/banner-Dd3dApUc.js +0 -290
- package/dist/binding-routing-cuSlltgJ.js +0 -50
- package/dist/binding-targets-Cx48IZQc.js +0 -99
- package/dist/bridge-server-CRtklB7G.js +0 -103
- package/dist/browser-node-runtime-BwLBwW3b.js +0 -12
- package/dist/browser-runtime-DjH_OV90.js +0 -377
- package/dist/capability-cli-KFyLj819.js +0 -1350
- package/dist/catalog-provider-B4tNRXms.js +0 -40
- package/dist/cdp.helpers-01EoG2KI.js +0 -372
- package/dist/channel-core-D1nci65b.js +0 -5
- package/dist/channel-plugin-resolution-xTnpOtic.js +0 -146
- package/dist/channel.runtime-DadpArDu.js +0 -399
- package/dist/channels-6yreyEBs.js +0 -1146
- package/dist/channels-cli-bimz2bUo.js +0 -247
- package/dist/chat-BFMiUu-G.js +0 -213
- package/dist/chrome-WA-FdKve.js +0 -1080
- package/dist/chrome.executables-BlV3kIfY.js +0 -541
- package/dist/clawbot-cli-BLdu0IQ8.js +0 -9
- package/dist/clawhub-BuLRhTNF.js +0 -400
- package/dist/cli-CDdqVrBY.js +0 -2
- package/dist/cli-DOuRcnxP.js +0 -2
- package/dist/cli-DgwVAGNK.js +0 -154
- package/dist/cli-DkIGpSHw.js +0 -57
- package/dist/cli-auth-seam-ynlvw1N6.js +0 -14
- package/dist/cli-backend-6x4Q-WdC.js +0 -66
- package/dist/cli-geEuOB-I.js +0 -191
- package/dist/cli-migration-ChII14Ro.js +0 -127
- package/dist/cli-runner-B1EhBITN.js +0 -1661
- package/dist/cli-runner.runtime-Boum-j7F.js +0 -3
- package/dist/cli-runner.runtime-h-ixiuX9.js +0 -2
- package/dist/cli-shared-Bz_H1_nP.js +0 -142
- package/dist/cli.runtime-D9B-1X3E.js +0 -819
- package/dist/collector-CkXyPwuF.js +0 -378
- package/dist/collector-Fmz7hWGE.js +0 -2
- package/dist/command-config-resolution-C7qsfOyi.js +0 -23
- package/dist/command-config-resolution-DaAgReAg.js +0 -2
- package/dist/command-execution-startup-BBpnISEp.js +0 -269
- package/dist/command-queue-BCnBBdS2.js +0 -260
- package/dist/command-registry-BXxYFSZD.js +0 -3
- package/dist/command-registry-CWHMKAbU.js +0 -108
- package/dist/command-secret-gateway-B-nb52Yw.js +0 -528
- package/dist/commands-acp-B6t0636h.js +0 -1017
- package/dist/commands-compact.runtime-Bs4Jrohf.js +0 -10
- package/dist/commands-core.runtime-uSBWVpXt.js +0 -2
- package/dist/commands-handlers.runtime-i2DbzlBK.js +0 -3762
- package/dist/commands-models-iSG3asW2.js +0 -306
- package/dist/commands-reset-hooks-CRo29fjd.js +0 -129
- package/dist/commands-status-CDGtgSo_.js +0 -223
- package/dist/commands-status.runtime-VMRV_4zg.js +0 -2
- package/dist/commands-subagents-control.runtime-B8wUjfcG.js +0 -3
- package/dist/commands-subagents-control.runtime-DlZEcLMM.js +0 -2
- package/dist/commands.runtime-faXcqJ1G.js +0 -103
- package/dist/comment-shared-CZcHHaVj.js +0 -40
- package/dist/compact-CJd53VDB.js +0 -11322
- package/dist/compact.runtime-BM5uCK5R.js +0 -7
- package/dist/completion-cli-CYgAzE_f.js +0 -2
- package/dist/completion-cli-W2b6VuQY.js +0 -464
- package/dist/config-B3ly_OWp.js +0 -2
- package/dist/config-BZWQh368.js +0 -136
- package/dist/config-CAo3Ki55.js +0 -101
- package/dist/config-DHTe4Ity.js +0 -166
- package/dist/config-cli-W3JjPbd5.js +0 -947
- package/dist/config-defaults-BQ8HCUkk.js +0 -163
- package/dist/config-guard-BWis2bnW.js +0 -94
- package/dist/config-runtime-Buoon-Hh.js +0 -14
- package/dist/config-validation-DiYgptBq.js +0 -279
- package/dist/configure-Bza-h92_.js +0 -1159
- package/dist/configure-DBn0SJq4.js +0 -2
- package/dist/context-writer-vqAKHKCE.js +0 -286
- package/dist/control-auth-OK_tGODq.js +0 -122
- package/dist/conversation-id-CRxR5h1M.js +0 -140
- package/dist/conversation-runtime-BijGAsoO.js +0 -31
- package/dist/core-DgA4TZVZ.js +0 -210
- package/dist/core-command-descriptors-CLSA5Moa.js +0 -106
- package/dist/cron-cli-Dm_zUhf-.js +0 -637
- package/dist/curator-BPSUUSGi.js +0 -586
- package/dist/daemon-cli-DZEJkmJ3.js +0 -416
- package/dist/daemon-install--tdrtKs3.js +0 -63
- package/dist/delegate-UEuflcXA.js +0 -61
- package/dist/deliver-BALTiw7q.js +0 -782
- package/dist/deliver-D0l9CtEc.js +0 -3
- package/dist/deliver-runtime-Dq4JvMOl.js +0 -2
- package/dist/delivery-outbound.runtime-CWIWrBQ9.js +0 -6
- package/dist/delivery-queue--ayb_Pk_.js +0 -2
- package/dist/delivery-queue-BwVoZNGI.js +0 -372
- package/dist/detect-BgviB4L6.js +0 -113
- package/dist/devices-cli-BdpXHC-r.js +0 -329
- package/dist/diagnostic-IuQCudMt.js +0 -311
- package/dist/direct-dm-DJMPWBuI.js +0 -139
- package/dist/directive-handling.fast-lane-f0CLC4-E.js +0 -2
- package/dist/directive-handling.fast-lane-sh0YnNSx.js +0 -64
- package/dist/directive-handling.impl-B7o2ov0i.js +0 -2
- package/dist/directive-handling.impl-a0yZtzf0.js +0 -659
- package/dist/directive-handling.parse-UrrfLTt9.js +0 -376
- package/dist/directive-handling.persist-DMdCGdJo.js +0 -139
- package/dist/directive-handling.persist.runtime-Bj-oQrrf.js +0 -2
- package/dist/directive-handling.shared-B3kBVf8z.js +0 -159
- package/dist/directory-cli-Dd1zPBaO.js +0 -239
- package/dist/dispatch-acp-D_6seEb3.js +0 -969
- package/dist/dispatch-acp-manager.runtime-CblPKuWP.js +0 -3
- package/dist/dispatch-acp-media.runtime-jQ51iwVZ.js +0 -3
- package/dist/dispatch-acp-session.runtime-CztwPJU8.js +0 -2
- package/dist/dispatch-acp-tts.runtime-CYwftiQH.js +0 -3
- package/dist/dispatch-acp.runtime-CslN35Tv.js +0 -19
- package/dist/dispatch-rlOjKp0R.js +0 -1041
- package/dist/dns-cli-oGpuQf5e.js +0 -192
- package/dist/doctor-completion-DzuKPgxo.js +0 -90
- package/dist/doctor-config-preflight-BvbXh8XL.js +0 -2
- package/dist/doctor-config-preflight-gAI_GeuH.js +0 -148
- package/dist/doctor-state-migrations-BVYC3Dnw.js +0 -2
- package/dist/doctor-state-migrations-Bb5ljS8B.js +0 -3
- package/dist/drive-C-EcQpgt.js +0 -750
- package/dist/embedding-provider-p9lV_6yT.js +0 -129
- package/dist/engine-lzlFl9eS.js +0 -72
- package/dist/entry-capabilities-C4wBXlqX.js +0 -89
- package/dist/exec-approval-forwarder.runtime-pAraMyEv.js +0 -3
- package/dist/exec-approvals-cli-DFRUYivK.js +0 -484
- package/dist/exec-defaults-DiLurRDC.js +0 -1440
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
- package/dist/extensions/diffs/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
- package/dist/extensions/diffs/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/awaited.mjs +0 -15
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/awaited/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/awaited/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/promise.mjs +0 -9
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/base.d.mts +0 -50
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/base.mjs +0 -84
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/iterator.mjs +0 -28
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/promise.d.mts +0 -21
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/promise.mjs +0 -29
- package/dist/extensions/diffs/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_base.mjs +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/default/from_base.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/error.mjs +0 -6
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
- package/dist/extensions/diffs/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
- package/dist/extensions/feishu/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
- package/dist/extensions/feishu/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/awaited.mjs +0 -15
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/awaited/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/awaited/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/promise.mjs +0 -9
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/base.d.mts +0 -50
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/base.mjs +0 -84
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/iterator.mjs +0 -28
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/promise.d.mts +0 -21
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/promise.mjs +0 -29
- package/dist/extensions/feishu/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_base.mjs +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/default/from_base.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/error.mjs +0 -6
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
- package/dist/extensions/feishu/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
- package/dist/fragment-collector-BCPVxm0P.js +0 -189
- package/dist/fragment-store-9TxXgGV-.js +0 -218
- package/dist/fragment-store-BHYVqNjU.js +0 -2
- package/dist/gateway-cli-Apcziann.js +0 -1518
- package/dist/gateway-discovery-targets-B_svEsZh.js +0 -431
- package/dist/gateway-install-token-DYyEiJEM.js +0 -284
- package/dist/gateway-rpc-rkIqagFK.js +0 -14
- package/dist/gateway-secret-options-DqYvLFrh.js +0 -38
- package/dist/gemini-cli-provider-D_Q97B93.js +0 -106
- package/dist/gemini-web-search-provider-C5AqCOHg.js +0 -167
- package/dist/get-reply-from-config.runtime-yQ65D-BO.js +0 -2
- package/dist/git-commit-CYrjhrEv.js +0 -2
- package/dist/hard-trigger-CWQ1TzAM.js +0 -98
- package/dist/health-C-3mkxI4.js +0 -2
- package/dist/health-Jkvh_gy_.js +0 -579
- package/dist/heartbeat-runner-COZgAa6a.js +0 -4
- package/dist/heartbeat-runner-c-hruBTy.js +0 -1209
- package/dist/heartbeat-runner.runtime-CGjPrCRu.js +0 -2
- package/dist/help-ChHRacYd.js +0 -81
- package/dist/hooks-cli-Be0aA_p5.js +0 -354
- package/dist/hooks-status-y8H2HWQf.js +0 -86
- package/dist/image-generation-core-DmsyCN1n.js +0 -17
- package/dist/image-generation-provider-BV6Pfe-s.js +0 -136
- package/dist/image-generation-provider-BlMt8X7X.js +0 -94
- package/dist/image-generation-provider-BoAxEAD_.js +0 -130
- package/dist/image-generation-provider-CrsgbMNJ.js +0 -163
- package/dist/image-generation-provider-ppz9PIhB.js +0 -279
- package/dist/image-runtime-DHMm2iiA.js +0 -7
- package/dist/inbound-reply-dispatch-D4pxE_PL.js +0 -73
- package/dist/inbound.runtime-CgrGH800.js +0 -4
- package/dist/inbound.runtime-ddIkY_PP.js +0 -3
- package/dist/ingest-CUZSOIc_.js +0 -2
- package/dist/ingest-DAxhsmxh.js +0 -691
- package/dist/install-3w_mg2Qx.js +0 -662
- package/dist/install-security-scan-C-6bE5h5.js +0 -22
- package/dist/install-security-scan.runtime-B_GzpPuC.js +0 -299
- package/dist/install-skills-YwdSU6-H.js +0 -70
- package/dist/install.runtime-B-r9-spQ.js +0 -27
- package/dist/install.runtime-Cy-vGIfI.js +0 -12
- package/dist/kaijibot-tools-oT0CsNSN.js +0 -9233
- package/dist/kaijibot-tools.runtime-SmBrfYIG.js +0 -2
- package/dist/kimi-web-search-provider-CH8BxsLJ.js +0 -308
- package/dist/lancedb-runtime-SvOqB09K.js +0 -201
- package/dist/library-BAFScIar.js +0 -45
- package/dist/list.runtime-CpyEd39c.js +0 -9
- package/dist/list.runtime-DC4mjmHx.js +0 -12
- package/dist/llm-draft-generator-DCqJ5qYk.js +0 -567
- package/dist/llm-draft-generator-DRAYzsiM.js +0 -2
- package/dist/llm-engine-BFVOaalJ.js +0 -1829
- package/dist/llm-engine-Bi8xqCtn.js +0 -2
- package/dist/login-D-oLC3GG.js +0 -108
- package/dist/logs-cli-DWeiHJ3L.js +0 -264
- package/dist/manager-CO5bSnH2.js +0 -3301
- package/dist/manager-Mv-1Vint.js +0 -2048
- package/dist/mcp-cli-D-6e6tc4.js +0 -723
- package/dist/media-runtime-vNPB_wvw.js +0 -312
- package/dist/media-understanding-LgBsXLVI.js +0 -83
- package/dist/media-understanding-provider-BOjajU5r.js +0 -18
- package/dist/media-understanding-provider-BTwJ_UWh.js +0 -112
- package/dist/media-understanding-provider-BXCpgh96.js +0 -13
- package/dist/media-understanding-provider-B_nfix0N.js +0 -30
- package/dist/media-understanding-provider-C6Wlc9vT.js +0 -21
- package/dist/media-understanding-provider-CvCuZ9SC.js +0 -14
- package/dist/media-understanding-provider-D7M3-aQh.js +0 -67
- package/dist/media-understanding-provider-DcEr1WSL.js +0 -123
- package/dist/media-understanding-provider-Ph7rGWKI.js +0 -37
- package/dist/media-understanding-provider-Wri695dH.js +0 -69
- package/dist/media-understanding-provider-um6kxSmK.js +0 -18
- package/dist/media-understanding-runtime-DJKuKxY0.js +0 -2
- package/dist/memory-B1XoiBa2.js +0 -3
- package/dist/memory-CYhHObg6.js +0 -242
- package/dist/memory-core-host-runtime-cli-DKoKyS93.js +0 -9
- package/dist/memory-index-BJqUmQXm.js +0 -2
- package/dist/memory-index-BUBt9yHK.js +0 -514
- package/dist/memory-repair-BhB6W5xm.js +0 -2
- package/dist/message-DVdUnIlB.js +0 -223
- package/dist/message-action-runner-QfFvL3oa.js +0 -2
- package/dist/message-action-runner-Y7yazXbD.js +0 -1628
- package/dist/metadata-registry-loader-DWwP6rZg.js +0 -2
- package/dist/minimax-web-search-provider-QCTjMoVf.js +0 -165
- package/dist/mmr-B1GMktQo.js +0 -146
- package/dist/model-catalog-CA2IsB6Z.js +0 -157
- package/dist/model-definitions-BNLayQ7G.js +0 -74
- package/dist/model-definitions-DejSv-w8.js +0 -28
- package/dist/model-definitions-DhIGF3DB.js +0 -258
- package/dist/model-picker-BoTUAvyS.js +0 -3
- package/dist/model-picker-zTMq5U_r.js +0 -490
- package/dist/model-picker.runtime-COHk6fb4.js +0 -15
- package/dist/model-selection-FnwgRfx6.js +0 -381
- package/dist/models-3LfDzypw.js +0 -2584
- package/dist/models-8gXAOc0J.js +0 -555
- package/dist/models-BQ8ZS754.js +0 -18
- package/dist/models-BXgvHura.js +0 -760
- package/dist/models-BdrRvR0O.js +0 -157
- package/dist/models-Be6rN_97.js +0 -19
- package/dist/models-CgvFbxD_.js +0 -47
- package/dist/models-Dq3fePTE.js +0 -18
- package/dist/models-_CdIkMJJ.js +0 -2
- package/dist/models-cli-ChSB3jod.js +0 -197
- package/dist/models.fetch-BlOH1ObL.js +0 -518
- package/dist/monitor-SKMOYue_.js +0 -4435
- package/dist/music-generation-provider-CAgLx7IH.js +0 -169
- package/dist/music-generation-provider-CWV2efO0.js +0 -142
- package/dist/music-generation-provider-tvRm1diG.js +0 -238
- package/dist/node-cli-CnQUquRc.js +0 -2362
- package/dist/nodes-cli-k8tVMKp0.js +0 -1046
- package/dist/notify-Da_SjUtR.js +0 -305
- package/dist/oauth-BgpHp4DM.js +0 -152
- package/dist/oauth-CnJkK1xf.js +0 -57
- package/dist/oauth-token-shared-GMxqYtaF.js +0 -28
- package/dist/oauth.credentials-Bz3A0tpU.js +0 -165
- package/dist/oauth.flow-C1pBobyI.js +0 -122
- package/dist/oauth.settings-DO5ybG8C.js +0 -44
- package/dist/oauth.token-BiOjbfIt.js +0 -43
- package/dist/onboard-4cz1qQ_A.js +0 -25
- package/dist/onboard-BDsdPtMZ.js +0 -25
- package/dist/onboard-BMwN-mJd.js +0 -29
- package/dist/onboard-BdGGek2m.js +0 -26
- package/dist/onboard-BfesemW3.js +0 -34
- package/dist/onboard-C5lGFfDY.js +0 -39
- package/dist/onboard-CNrLUedN.js +0 -25
- package/dist/onboard-CR_sdI-6.js +0 -29
- package/dist/onboard-CpyvClpQ.js +0 -621
- package/dist/onboard-CuviKb6n2.js +0 -54
- package/dist/onboard-D2FOrkio.js +0 -67
- package/dist/onboard-DAt-DAZJ.js +0 -22
- package/dist/onboard-DIurCAm9.js +0 -36
- package/dist/onboard-DJZmbiCZ.js +0 -58
- package/dist/onboard-NUWGhXYK.js +0 -48
- package/dist/onboard-_zwmdns7.js +0 -312
- package/dist/onboard-channels-8xjH4Rxx.js +0 -2
- package/dist/onboard-channels-C5YcSaTV.js +0 -1260
- package/dist/onboard-config-BPXiaYYN.js +0 -2
- package/dist/onboard-custom-CbvrlqwN.js +0 -2
- package/dist/onboard-custom-DpGZWCkE.js +0 -647
- package/dist/onboard-helpers-BkgpYw91.js +0 -223
- package/dist/onboard-helpers-DNXP1va5.js +0 -5
- package/dist/onboard-hooks-DBikJ6h9.js +0 -35
- package/dist/onboard-remote-CGGcjWRI.js +0 -193
- package/dist/onboard-remote-CjC2kFSP.js +0 -2
- package/dist/onboard-search-_eepOkzc.js +0 -324
- package/dist/onboard-skills-BhHUGPqh.js +0 -2
- package/dist/onboard-skills-CEzVQ_WL.js +0 -134
- package/dist/openai-codex-auth-identity-D-KQbSyQ.js +0 -45
- package/dist/openai-codex-cli-auth-CuaNZ-Xi.js +0 -57
- package/dist/openai-codex-provider-CbIKBwnQ.js +0 -299
- package/dist/openai-codex-shared-C17lyOLN.js +0 -6
- package/dist/openai-provider-CgI6oZZJ.js +0 -283
- package/dist/openclaw-migrator-ulNNIw-g.js +0 -2
- package/dist/pair-command-approve-B6cPcRmP.js +0 -34
- package/dist/pairing-cli-Dopy7pMf.js +0 -117
- package/dist/perplexity-web-search-provider-CLfCz5ll.js +0 -92
- package/dist/perplexity-web-search-provider.runtime-BlBBCnh1.js +0 -332
- package/dist/perplexity-web-search-provider.runtime-F_tn1b70.js +0 -2
- package/dist/persistent-bindings.lifecycle-4Sj3YvH6.js +0 -94
- package/dist/pi-embedded-CXUV32ut.js +0 -2
- package/dist/pi-embedded-DoNNtCWr.js +0 -6
- package/dist/pi-embedded-runner-Dq4lYjca.js +0 -8346
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime-Ca5o8DbU.js +0 -23
- package/dist/pi-embedded.runtime-BCRJuvse.js +0 -5
- package/dist/pi-tools.before-tool-call.runtime-B6HYOE8c.js +0 -354
- package/dist/plugin-enabled-CKRm8wtW.js +0 -71
- package/dist/plugin-install-CybWKOIa.js +0 -2
- package/dist/plugin-install-config-policy-DTrvBgla.js +0 -137
- package/dist/plugin-install-oAl4Yczg.js +0 -227
- package/dist/plugin-install-plan-DLIR_ZqM.js +0 -50
- package/dist/plugin-registration-BmV1gqZB.js +0 -23
- package/dist/plugin-registry-1Rq5Tmvl.js +0 -3
- package/dist/plugin-registry-DL8pf5Mp.js +0 -2
- package/dist/plugin-registry-loader-CAAg3dpS.js +0 -22
- package/dist/plugin-service-CK4Rim4g.js +0 -2494
- package/dist/plugins-cli-CjQt0z09.js +0 -566
- package/dist/plugins-command-helpers-AJAozWnL.js +0 -117
- package/dist/plugins-install-persist-Dj-wP3UP.js +0 -121
- package/dist/plugins-update-command-DfAN1qbt.js +0 -1008
- package/dist/policy-B_C91HSo.js +0 -172
- package/dist/preemptive-compaction-DHty3miI.js +0 -430
- package/dist/proactive-scheduler-BQynqyS0.js +0 -1287
- package/dist/probe-CASgRLVo.js +0 -426
- package/dist/probe-auth-Crs0lOpZ.js +0 -3
- package/dist/program-BlfK81FP.js +0 -111
- package/dist/program-context-BgeVW_T_.js +0 -2
- package/dist/prompt-overlay-v0MJ0MCL.js +0 -72
- package/dist/prompt-select-styled-Dzmrxj1a.js +0 -5299
- package/dist/provider-BilPcosq.js +0 -70
- package/dist/provider-api-key-auth-CgLB-D5X.js +0 -113
- package/dist/provider-auth-DBykvpJk.js +0 -36
- package/dist/provider-auth-api-key-BFqSZqff.js +0 -5
- package/dist/provider-auth-choice-mXKWNw2A.js +0 -134
- package/dist/provider-auth-choice-preference-C8geLQZU.js +0 -62
- package/dist/provider-auth-login-C8nHiSGB.js +0 -8
- package/dist/provider-auth-login.runtime-Bw7qvsMK.js +0 -206
- package/dist/provider-catalog-BLuW7xxm.js +0 -18
- package/dist/provider-catalog-Ba8jbbQC.js +0 -11
- package/dist/provider-catalog-BezjZlH4.js +0 -11
- package/dist/provider-catalog-Bzs0kPzn.js +0 -13
- package/dist/provider-catalog-CXItaIYb.js +0 -11
- package/dist/provider-catalog-CaVK2dyj.js +0 -12
- package/dist/provider-catalog-CcWsqYpE.js +0 -61
- package/dist/provider-catalog-CksVg6Lz.js +0 -16
- package/dist/provider-catalog-CvVlJ7h-.js +0 -26
- package/dist/provider-catalog-Dh9jKgh9.js +0 -56
- package/dist/provider-catalog-Dm1dfTk-.js +0 -11
- package/dist/provider-catalog-DqcQOA4Z.js +0 -17
- package/dist/provider-catalog-pqamOkUm.js +0 -16
- package/dist/provider-compat-D9qDQQMG.js +0 -37
- package/dist/provider-dispatcher-C3XfRHRF.js +0 -22
- package/dist/provider-entry-zMxxN1fH.js +0 -97
- package/dist/provider-flow-ao7lxs66.js +0 -66
- package/dist/provider-models-CuPoy-A4.js +0 -119
- package/dist/provider-models-DU2n84FS.js +0 -116
- package/dist/provider-models-jw0IBHgS.js +0 -35
- package/dist/provider-registration-6GPZtKMt.js +0 -57
- package/dist/provider-registration-CjmTFGKf.js +0 -238
- package/dist/push-apns-Bzrexlse.js +0 -1013
- package/dist/pw-ai-C7JdV54y.js +0 -2268
- package/dist/qmd-manager-T2BUCG7n.js +0 -1799
- package/dist/qr-cli-B_e_0-SF.js +0 -359
- package/dist/qr-cli-rxc0H2Mk.js +0 -2
- package/dist/qr-image-BYACGRPv.js +0 -2
- package/dist/queue-CF6El_UA.js +0 -636
- package/dist/realtime-provider-shared-Yd1KkPvt.js +0 -21
- package/dist/realtime-transcription-provider-DwmEvubU.js +0 -180
- package/dist/realtime-voice-provider-T861rzVh.js +0 -342
- package/dist/record-shared-BKxprVFr.js +0 -10
- package/dist/region--gybyKDE.js +0 -74
- package/dist/register-command-groups-1_FI6ux5.js +0 -121
- package/dist/register.agent-Bhv7o14f.js +0 -241
- package/dist/register.configure-Bix6QVEo.js +0 -15
- package/dist/register.maintenance-Bw2Dbvb6.js +0 -438
- package/dist/register.message-PxnL8FCg.js +0 -601
- package/dist/register.migrate-DLiZYeE7.js +0 -195
- package/dist/register.onboard-CfOvvN5q.js +0 -79
- package/dist/register.runtime--HXgNnrv.js +0 -343
- package/dist/register.runtime-DJaq2P7l.js +0 -81
- package/dist/register.setup-B0IYNZZy.js +0 -104
- package/dist/register.status-health-sessions-5Avwn_Rh.js +0 -1210
- package/dist/register.subclis-Bhqe4RNX.js +0 -3
- package/dist/register.subclis-CwyReoC0.js +0 -237
- package/dist/replay-policy-DRHPdlTy.js +0 -8
- package/dist/reply-DsQGSqHM.js +0 -3498
- package/dist/reply.runtime-BoEhxvtc.js +0 -2
- package/dist/resolve-vsY3RgCu.js +0 -280
- package/dist/root-help-C9EaUEol.js +0 -44
- package/dist/route-reply-yzqZEMM1.js +0 -141
- package/dist/route-reply.runtime-Dn_gMZjY.js +0 -2
- package/dist/rpc-DZksOtsP.js +0 -61
- package/dist/run-main-29gZWc8b.js +0 -452
- package/dist/runner-W6n2pkfJ.js +0 -1497
- package/dist/runs-OzLk07t4.js +0 -495
- package/dist/runtime-CGl5K_IU.js +0 -72
- package/dist/runtime-D0vBMNhQ.js +0 -2
- package/dist/runtime-DFgQhIdO.js +0 -725
- package/dist/runtime-DKfK_AD5.js +0 -107
- package/dist/runtime-DyrhCUAq.js +0 -200
- package/dist/runtime-api-BDFg7VKM.js +0 -2
- package/dist/runtime-api-BWcPxjgR.js +0 -3
- package/dist/runtime-api-C1USU1Xg.js +0 -12
- package/dist/runtime-embedded-pi.runtime-CMNGvq_M.js +0 -3
- package/dist/runtime-internal-BjxS9kh1.js +0 -2
- package/dist/runtime-plugins-BrjMM_2S.js +0 -69
- package/dist/runtime-prepare.runtime-C5uhgIL5.js +0 -80
- package/dist/runtime-provider-Bd6DTZcR.js +0 -21
- package/dist/runtime-qvUIWcEn.js +0 -9
- package/dist/runtime-registry-loader-DC_zdtAM.js +0 -58
- package/dist/runtime-registry-loader-ZJtMVrYf.js +0 -2
- package/dist/runtime-taskflow-DkJ0OEcb.js +0 -250
- package/dist/runtime-web-tools-Caph1Q8W.js +0 -1467
- package/dist/sandbox-BPefFVsD.js +0 -2586
- package/dist/sandbox-VqaevbKP.js +0 -4
- package/dist/sandbox-cli-Dmz8tNOk.js +0 -446
- package/dist/secrets-cli-DjJm5KkT.js +0 -2099
- package/dist/security-audit-sGsom2f1.js +0 -34
- package/dist/security-cli-2B9RasP6.js +0 -486
- package/dist/semantic-dedup-I5wMh6pu.js +0 -95
- package/dist/send-CHJpeuAq.js +0 -993
- package/dist/server-Cf1sUtlR.js +0 -13
- package/dist/server-ChrBeFtC.js +0 -77
- package/dist/server-context-C9DshDZM.js +0 -4164
- package/dist/server-methods-42GWgP-w.js +0 -11666
- package/dist/server-middleware-DpGttIke.js +0 -110
- package/dist/server-node-events-LXraw8n1.js +0 -451
- package/dist/server.impl-DcCSaFuL.js +0 -19522
- package/dist/session-DB-oGCus.js +0 -48
- package/dist/session-conversation-BVC-IDB-.js +0 -27
- package/dist/session-file-DcogHTZ9.js +0 -44
- package/dist/session-key-BeN4V5Ps.js +0 -65
- package/dist/session-meta-B2LNjKYp.js +0 -109
- package/dist/session-override-DT7hcbx1.js +0 -103
- package/dist/session-reset-model.runtime-DKJSQ8Rr.js +0 -120
- package/dist/session-reset-service-DFqsF-Zh.js +0 -473
- package/dist/session-subagent-reactivation.runtime-yj_xOXm2.js +0 -2
- package/dist/session-tab-registry-C5JZRgsa.js +0 -553
- package/dist/session-updates-Z-4cmoh_.js +0 -234
- package/dist/session-updates.runtime-Co08h535.js +0 -2
- package/dist/session-utils-Cxgqr7-c.js +0 -915
- package/dist/sessions-BgcN8F-X.js +0 -226
- package/dist/sessions-Ciwd_Ht8.js +0 -2
- package/dist/sessions-DE-AO5Jk.js +0 -45
- package/dist/sessions.runtime-CG1opxuM.js +0 -2
- package/dist/setup-BysllKEA.js +0 -496
- package/dist/setup-ayo63KAb.js +0 -329
- package/dist/setup-surface-DbrOe3E8.js +0 -586
- package/dist/setup.finalize-DhLR2yO4.js +0 -432
- package/dist/setup.gateway-config-Df2_Em8i.js +0 -246
- package/dist/shared-B-rMwdad.js +0 -218
- package/dist/shared-BWdSBVdK.js +0 -224
- package/dist/shared-BX9blqPL.js +0 -36
- package/dist/shared-C_-wWbDm.js +0 -175
- package/dist/shared-runtime-rz9t-KLz.js +0 -7
- package/dist/short-term-promotion-FgE_Jnib.js +0 -1631
- package/dist/skill-commands-FgYq8X4R.js +0 -82
- package/dist/skill-commands.runtime-CUJDRqa1.js +0 -2
- package/dist/skill-lifecycle-BVV6fXSs.js +0 -105
- package/dist/skill-quality-gate-4pWY82-e.js +0 -127
- package/dist/skill-usage-tracker-BxM2RLxT.js +0 -31
- package/dist/skills-cli-LwJDf23u.js +0 -370
- package/dist/skills-install-CkncHLZo.js +0 -822
- package/dist/speech-provider-CMtHMx9Y.js +0 -182
- package/dist/speech-provider-DczkEjhR.js +0 -103
- package/dist/speech-provider-Mv_D3qiG.js +0 -43
- package/dist/speech-provider-US8CydoJ.js +0 -167
- package/dist/speech-provider-WWkc6FaL.js +0 -184
- package/dist/stage-sandbox-media.runtime-D71Kd4Ch.js +0 -230
- package/dist/state-dir-env-DYjPXVYi.js +0 -156
- package/dist/state-migrations-B6uRvX1P.js +0 -822
- package/dist/status-BBFiEAa-.js +0 -391
- package/dist/status-CcJcQrD4.js +0 -479
- package/dist/status-CoxoUT8_.js +0 -473
- package/dist/status-DNCnieP0.js +0 -2
- package/dist/status-DpqurBP_.js +0 -3
- package/dist/status-OQhsSx2y.js +0 -2
- package/dist/status-all-CMnGLf_-.js +0 -487
- package/dist/status-json-LKYWmcM2.js +0 -14
- package/dist/status-json-command-ChpTTpoM.js +0 -84
- package/dist/status-runtime-shared-D-NmIA_0.js +0 -254
- package/dist/status-wtlbmlzi.js +0 -278
- package/dist/status.command.text-runtime-B-0GXh3N.js +0 -15
- package/dist/status.gateway-probe-Bqtogs2U.js +0 -16
- package/dist/status.link-channel-BPe4GfI5.js +0 -35
- package/dist/status.node-mode-Chn_dsMR.js +0 -32
- package/dist/status.node-mode-CqkA7hYz.js +0 -2
- package/dist/status.scan-Cwao8eXh.js +0 -62
- package/dist/status.scan-overview-_YjgtE8T.js +0 -395
- package/dist/status.scan.fast-json-BDSAZ_0A.js +0 -128
- package/dist/status.scan.fast-json-D0XMZbbT.js +0 -2
- package/dist/status.scan.runtime-KroF5nhu.js +0 -417
- package/dist/status.summary-CdBWpLqd.js +0 -2
- package/dist/status.summary-jy2zyMVD.js +0 -209
- package/dist/store-BAOUBmZQ.js +0 -190
- package/dist/store-Da7djjD4.js +0 -1112
- package/dist/store.runtime-abrTHLrz.js +0 -2
- package/dist/stream-DTFokQkL.js +0 -153
- package/dist/stream-DjBbXFCo.js +0 -649
- package/dist/stream-wrappers-DyQzM00M.js +0 -144
- package/dist/subagent-announce.registry.runtime-BABRFSMF.js +0 -3
- package/dist/subagent-control-D2OSqmZ7.js +0 -485
- package/dist/subagent-followup.runtime-DTNKCe5w.js +0 -68
- package/dist/subagent-list-MAV67Sxm.js +0 -168
- package/dist/subagent-orphan-recovery-Kzzz2mgk.js +0 -214
- package/dist/subagent-registry-CTAMEje4.js +0 -2888
- package/dist/subagent-registry-runtime-CP_a8qhv.js +0 -2
- package/dist/subagent-registry.runtime-DeC3RNRE.js +0 -3
- package/dist/subagent-spawn-C5uY3sfO.js +0 -781
- package/dist/subagents-format-D73DetCG.js +0 -628
- package/dist/subcli-descriptors-DlMSW5i6.js +0 -173
- package/dist/supervisor-BahyZDOz.js +0 -737
- package/dist/system-cli-Dt32QC1G.js +0 -59
- package/dist/systemd-linger-3DzEUocY.js +0 -2
- package/dist/targets-CnJhw62V.js +0 -594
- package/dist/task-executor-BBNtTTy3.js +0 -350
- package/dist/task-owner-access-CnjSqyDU.js +0 -48
- package/dist/task-registry-BEFL1tD7.js +0 -2346
- package/dist/task-registry-control.runtime-Dgk5Yb4X.js +0 -3
- package/dist/task-registry-delivery-runtime-BiITP8us.js +0 -2
- package/dist/task-registry-delivery-runtime-V0EObe7x.js +0 -3
- package/dist/task-registry.maintenance-CRGVNmNv.js +0 -2
- package/dist/task-registry.maintenance-E1MKWD6e.js +0 -425
- package/dist/test.DNmyFkvJ-DJRLm6sy.js +0 -13549
- package/dist/testing-ehflWoVg.js +0 -441
- package/dist/text-report-XuvHwHc9.js +0 -587
- package/dist/text-runtime-DsiP7VdZ.js +0 -313
- package/dist/thinking-policy-ZVmg-bUw.js +0 -25
- package/dist/thread-bindings-BCS_rM9y.js +0 -223
- package/dist/tool-auth-shared-DdmOv578.js +0 -53
- package/dist/tool-config-shared-CP5dDyyW.js +0 -19
- package/dist/tool-schema-runtime-BjWzmAN3.js +0 -1892
- package/dist/tools-effective-inventory-Dy07SBEL.js +0 -152
- package/dist/tools.runtime-DImY1euX.js +0 -4
- package/dist/topic-types-BXXY5uZL.js +0 -176
- package/dist/topic-types-CDaB_YbE.js +0 -2
- package/dist/transcript-CF5_OBmp.js +0 -191
- package/dist/transcript.runtime-D5nr49Ef.js +0 -2
- package/dist/transport-policy-w54T42K4.js +0 -75
- package/dist/tts-zh6pvJpM.js +0 -31
- package/dist/tts.runtime-CWxkpW7l.js +0 -3
- package/dist/tui-cli-Ci0sIDB1.js +0 -31
- package/dist/tui-h4YVnTtv.js +0 -4017
- package/dist/uninstall-D37a24rS.js +0 -172
- package/dist/update-Y8g3ecTl.js +0 -1253
- package/dist/update-cli-D3D_lWB1.js +0 -1763
- package/dist/update-runner-YEixuUNC.js +0 -1490
- package/dist/vault--pPeoJoM.js +0 -64
- package/dist/vault-ETiei3jF.js +0 -2
- package/dist/video-generation-provider-BfYPJ2X3.js +0 -227
- package/dist/video-generation-provider-BhdoE2LB.js +0 -77
- package/dist/video-generation-provider-BltQBaCu.js +0 -171
- package/dist/video-generation-provider-C6Y4MTBa.js +0 -233
- package/dist/video-generation-provider-CPMWGfJj.js +0 -64
- package/dist/video-generation-provider-CTEKMPLy.js +0 -240
- package/dist/video-generation-provider-CcCvv3LR.js +0 -104
- package/dist/video-generation-provider-CpGtTNnb.js +0 -246
- package/dist/video-generation-provider-CvpbK0Tj.js +0 -263
- package/dist/video-generation-provider-PvbMacjT.js +0 -181
- package/dist/video-model-catalog-Cp71BhF6.js +0 -187
- package/dist/web-search-DP15ZlNE.js +0 -221
- package/dist/web-search-provider-CpRV6QJI.js +0 -155
- package/dist/webhooks-cli-DdLGU5xA.js +0 -321
- package/dist/workspace-BpzmLImG.js +0 -306
- package/dist/x-search-shared-D-L79ilT.js +0 -109
- /package/dist/{api-BFKI2NNn.js → api-B6g0B-IG.js} +0 -0
- /package/dist/{api-BhPfvHfo.js → api-B_5tuRF_.js} +0 -0
- /package/dist/{api-BUpga5J-.js → api-ChDERchn.js} +0 -0
- /package/dist/{api-B1PE6fwA.js → api-DiGfNOT2.js} +0 -0
- /package/dist/{api-DkqAFzSg.js → api-O7zsDPPJ.js} +0 -0
- /package/dist/{audit-channel.collect.runtime-CaPqFh87.js → audit-channel.collect.runtime-CUn9BMvq.js} +0 -0
- /package/dist/{audit-log-C8WDD3D1.js → audit-log-pMArHIEh.js} +0 -0
- /package/dist/{auth-choice-legacy-waB0iFpm.js → auth-choice-legacy-BM0vn9R-.js} +0 -0
- /package/dist/{auth-choice.apply-helpers-BvYl7HR5.js → auth-choice.apply-helpers-Bw9wToYL.js} +0 -0
- /package/dist/{auth-choice.plugin-providers.runtime-PpyhN_80.js → auth-choice.plugin-providers.runtime-BZseWyNy.js} +0 -0
- /package/dist/{auth-surface-resolution-BZLSPNTs.js → auth-surface-resolution-CrQGM9Cp.js} +0 -0
- /package/dist/{auto-recall-B1PCG6uf.js → auto-recall-B_bK8mCh.js} +0 -0
- /package/dist/{block-reply-pipeline-B79ibtIR.js → block-reply-pipeline-Dq4aLNqX.js} +0 -0
- /package/dist/{call.runtime-BwcZkbkG.js → call.runtime-DVcVSdEu.js} +0 -0
- /package/dist/{channel-account-context-BNzGuw03.js → channel-account-context-D0WBO2Yx.js} +0 -0
- /package/dist/{channel-options-dCZOcBUc.js → channel-options-plNrATBP.js} +0 -0
- /package/dist/{channel-plugin-ids-jLxAn1L5.js → channel-plugin-ids-CscSLyjB.js} +0 -0
- /package/dist/{channel-selection.runtime-rS6hNp6w.js → channel-selection.runtime-Dd9_LxxA.js} +0 -0
- /package/dist/{channels-status-issues-QT-v4vzD.js → channels-status-issues-byWfP2WG.js} +0 -0
- /package/dist/{clack-prompter-BarukVw2.js → clack-prompter-OiJwdy5r.js} +0 -0
- /package/dist/{cli-backend-CNk0L0wa.js → cli-backend-CdM4Rh6F.js} +0 -0
- /package/dist/{close-reason-nz_ERN9v.js → close-reason-CI_g9IO0.js} +0 -0
- /package/dist/{cognitive-delivery-B8bSjIL2.js → cognitive-delivery-B5TbScd2.js} +0 -0
- /package/dist/{command-poll-backoff.runtime-DDWZcsnF.js → command-poll-backoff.runtime-CFRUBpul.js} +0 -0
- /package/dist/{command-registration-policy-CVzf9lZy.js → command-registration-policy-Bp03ya2T.js} +0 -0
- /package/dist/{commands-registry.runtime-CThK_6yQ.js → commands-registry.runtime-C9vjMKif.js} +0 -0
- /package/dist/{config-DCqmbAmi.js → config-DWP1lSic.js} +0 -0
- /package/dist/{config-BXvOgFjS.js → config-GpqmqI37.js} +0 -0
- /package/dist/{config-value-C7bZPr1X.js → config-value-1FzBpid8.js} +0 -0
- /package/dist/{consolidation-userid-BtKeSaAs.js → consolidation-userid-Di0Sgxnz.js} +0 -0
- /package/dist/{dangerous-tools-Cwuv7WFD.js → dangerous-tools-C6SsOcC4.js} +0 -0
- /package/dist/{default-models-CTHi5V4f.js → default-models-DxJmcrq7.js} +0 -0
- /package/dist/{defaults-CwPgGXAk.js → defaults-DWxSBxL9.js} +0 -0
- /package/dist/{defaults-BQA1GDhJ.js → defaults-UyycRG_v.js} +0 -0
- /package/dist/{dispatch-acp-command-bypass-imK9PCdQ.js → dispatch-acp-command-bypass-B9NMLuX9.js} +0 -0
- /package/dist/{docs-cli-Dv1RQsBb.js → docs-cli-DDIF10fG.js} +0 -0
- /package/dist/{dotenv-CmO55tnC.js → dotenv-DPb0MMoy.js} +0 -0
- /package/dist/{embedding-provider-BYQlcbTv.js → embedding-provider-BiItBepR.js} +0 -0
- /package/dist/{env-overrides.runtime-BbiEI7F8.js → env-overrides.runtime-BtBGU8bb.js} +0 -0
- /package/dist/{exec-approvals-effective-MiJpVS3B.js → exec-approvals-effective-C4m2WXg-.js} +0 -0
- /package/dist/{extractor-Dc5z0hMf.js → extractor-B-CDYBJx.js} +0 -0
- /package/dist/{fallback-state-D3l8zuca.js → fallback-state-C-BXNQDE.js} +0 -0
- /package/dist/{fragment-types-B8q-zg6v.js → fragment-types-3NSFX3fG.js} +0 -0
- /package/dist/{frontmatter-XYZsyLoY.js → frontmatter-CMd6M3iu.js} +0 -0
- /package/dist/{gateway-lock-BkhPbe1x.js → gateway-lock-B4lxvDfZ.js} +0 -0
- /package/dist/{gateway-presence-C7ZKme5I.js → gateway-presence-D2Ad8otD.js} +0 -0
- /package/dist/{gateway-rpc.runtime-mL0HdmjE.js → gateway-rpc.runtime-eZMYTrLe.js} +0 -0
- /package/dist/{gaxios-fetch-compat-jL2xxHMj.js → gaxios-fetch-compat-DvraiCww.js} +0 -0
- /package/dist/{git-commit-XJxkSBCC.js → git-commit-BIx8__jW.js} +0 -0
- /package/dist/{gmail-setup-utils-DjHySRPr.js → gmail-setup-utils-Jqi6TbIM.js} +0 -0
- /package/dist/{groups.runtime-BFrnryp_.js → groups.runtime-BmbQxpi-.js} +0 -0
- /package/dist/{health-format-lG7x3cNF.js → health-format-CPlFnpEc.js} +0 -0
- /package/dist/{helpers-5EtzqHah.js → helpers-q3dUkuqz.js} +0 -0
- /package/dist/{hooks-policy-DudtxOUW.js → hooks-policy-Bmv6J1kh.js} +0 -0
- /package/dist/{image-v-_YZCwf.js → image-De5xRFlj.js} +0 -0
- /package/dist/{image-generation-core.auth.runtime-BN813D6r.js → image-generation-core.auth.runtime-BGoZ9htm.js} +0 -0
- /package/dist/{includes-scan-DpxlIONl.js → includes-scan-9AWKrWlU.js} +0 -0
- /package/dist/{info-scan-source-DnaROGLQ.js → info-scan-source-JX82stxX.js} +0 -0
- /package/dist/{input-files-DgrhtMjl.js → input-files-CnyTkGg0.js} +0 -0
- /package/dist/{install-target-BX2Crr_Y.js → install-target-9iPjuY88.js} +0 -0
- /package/dist/{installs-DbMRUEa5.js → installs-30EmXCK0.js} +0 -0
- /package/dist/{ipv4-Lxd0AUyd.js → ipv4-Ddm_keVD.js} +0 -0
- /package/dist/{json-mode-DXOGRndc.js → json-mode-Be3c80wJ.js} +0 -0
- /package/dist/{kaijibot.plugin-BhXQfURP.js → kaijibot.plugin-DzS9VUni.js} +0 -0
- /package/dist/{kaijibot.plugin-CtsiVmAP.js → kaijibot.plugin-xVZah2G8.js} +0 -0
- /package/dist/{lifecycle-B9_XEJMF.js → lifecycle-DwLKRe0M.js} +0 -0
- /package/dist/{llm-extractor-bvGxU-9w.js → llm-extractor-CssLZel9.js} +0 -0
- /package/dist/{llm-key-probe-DBxS-6MP.js → llm-key-probe-BH61J04k.js} +0 -0
- /package/dist/{local-date-DXS-3gnV.js → local-date-Dx9LHstd.js} +0 -0
- /package/dist/{logs-cli.runtime-DjFXprX7.js → logs-cli.runtime-DCwDBoHH.js} +0 -0
- /package/dist/{magic-string.es-DBWRzyEr.js → magic-string.es-JqU65QWY.js} +0 -0
- /package/dist/{memory-host-search.runtime-D1s9jwc9.js → memory-host-search.runtime-BKu5Oyo8.js} +0 -0
- /package/dist/{memory-repair-RLio0mfn.js → memory-repair-DONaxvFd.js} +0 -0
- /package/dist/{message.config.runtime-m-HYPbwu.js → message.config.runtime-CbnMOfHF.js} +0 -0
- /package/dist/{message.gateway.runtime-ypqgoSHq.js → message.gateway.runtime-B93AumDT.js} +0 -0
- /package/dist/{metadata-registry-loader-BiXHJddm.js → metadata-registry-loader-Dgk5UBMT.js} +0 -0
- /package/dist/{model-definitions-CqVPpHiG.js → model-definitions-JcfBkTza.js} +0 -0
- /package/dist/{model-id-cnFVogsJ.js → model-id-D1Wk8S2O.js} +0 -0
- /package/dist/{model-param-b-WFgsRlGS.js → model-param-b-B7-mzaOP.js} +0 -0
- /package/dist/{model-suppression.runtime-Cc9MfXhr.js → model-suppression.runtime-Bb9ypkGZ.js} +0 -0
- /package/dist/{models-CGB1Gmfi.js → models--eT1kpdv.js} +0 -0
- /package/dist/{models-DnnqdU39.js → models-CI5KSADc.js} +0 -0
- /package/dist/{models-Cuivu-zg.js → models-D56ZxCfo.js} +0 -0
- /package/dist/{models-JQFu1Rq9.js → models-N8WgRXKT.js} +0 -0
- /package/dist/{oauth-refresh-failure-Bf74s_bF.js → oauth-refresh-failure-DWFIDvjh.js} +0 -0
- /package/dist/{onboard-DQP5yP_h.js → onboard-C36W-uR9.js} +0 -0
- /package/dist/{onboard-BaA-_42k.js → onboard-C5_C5Dgl.js} +0 -0
- /package/dist/{onboard-2v_escld.js → onboard-DDG1-mJG.js} +0 -0
- /package/dist/{onboard-UHJyYUjC.js → onboard-DJoyh-Z8.js} +0 -0
- /package/dist/{onboard-AGZDUqWC.js → onboard-DSxroSTN.js} +0 -0
- /package/dist/{onboard-KTOtavc-.js → onboard-b6hp3tPS.js} +0 -0
- /package/dist/{onboard-config-BXe45WpU.js → onboard-config-Lh_yB7dL.js} +0 -0
- /package/dist/{openai-codex-catalog-DQgPnnGt.js → openai-codex-catalog-DD_VIQlG.js} +0 -0
- /package/dist/{openclaw-migrator-DUfsOWq9.js → openclaw-migrator-CaGcuTUZ.js} +0 -0
- /package/dist/{package-update-utils-D9AkQosZ.js → package-update-utils-Yv076eAO.js} +0 -0
- /package/dist/{parse-log-line-B4l-DSpE.js → parse-log-line-BIaXQg_P.js} +0 -0
- /package/dist/{path-env-CoRBKA1C.js → path-env-Dk2a_giL.js} +0 -0
- /package/dist/{perplexity-web-search-provider.shared-o8SEWE6d.js → perplexity-web-search-provider.shared-65M7qer4.js} +0 -0
- /package/dist/{persona-change-source-sZfR2-3I.js → persona-change-source-QUczl_FE.js} +0 -0
- /package/dist/{ports-BrD2WgKB.js → ports-Qs7MEJp6.js} +0 -0
- /package/dist/{preference-learner-Dd-MkiXx.js → preference-learner-BoMWQ_UT.js} +0 -0
- /package/dist/{probe-70HRGl4a.js → probe-BvHudo6i.js} +0 -0
- /package/dist/{probe-auth-BQSPI8E3.js → probe-auth-DhX7blo2.js} +0 -0
- /package/dist/{probe-target-DD7FyREr.js → probe-target-BeTB7wVs.js} +0 -0
- /package/dist/{program-context-BcxnUK0Z.js → program-context-B9uUWtK2.js} +0 -0
- /package/dist/{provider-api-key-auth.runtime-HSJGnSmr.js → provider-api-key-auth.runtime-N653FDIT.js} +0 -0
- /package/dist/{provider-auth-choice-helpers-CcPOjvnI.js → provider-auth-choice-helpers-ChvFgjfz.js} +0 -0
- /package/dist/{provider-auth-guidance-ChSkQI-k.js → provider-auth-guidance-Ctl6x9Du.js} +0 -0
- /package/dist/{provider-catalog-145O7qu0.js → provider-catalog-BDAFvO45.js} +0 -0
- /package/dist/{provider-catalog-BV3gdu3r.js → provider-catalog-CO-sQSae.js} +0 -0
- /package/dist/{provider-catalog-BWbMEO1u.js → provider-catalog-D34gpSgG.js} +0 -0
- /package/dist/{provider-catalog-CmraKltl.js → provider-catalog-Dwp85UjM.js} +0 -0
- /package/dist/{provider-catalog-CGGu1xY7.js → provider-catalog-NxTI5xr-.js} +0 -0
- /package/dist/{provider-catalog-BwaMk_71.js → provider-catalog-dX-9JR2_.js} +0 -0
- /package/dist/{provider-models-Cj2Dj2Eb.js → provider-models-BS_NZn6m.js} +0 -0
- /package/dist/{provider-models-yFLzb_gM.js → provider-models-BrE46jCo2.js} +0 -0
- /package/dist/{provider-oauth-flow-Dwldw3m9.js → provider-oauth-flow-CdiPoFwM.js} +0 -0
- /package/dist/{provider-openai-codex-oauth-tls-B5spv5ZL.js → provider-openai-codex-oauth-tls-Dd7Khxm1.js} +0 -0
- /package/dist/{qa-cli-CHZ17YNo.js → qa-cli-BTEZmDBl.js} +0 -0
- /package/dist/{realtime-transcription-provider-CaGqiqi5.js → realtime-transcription-provider-DKVD0xK4.js} +0 -0
- /package/dist/{register.backup-DEGba8yV.js → register.backup-BsTZm_ln.js} +0 -0
- /package/dist/{remote-env-XoAdM3lK.js → remote-env-DlSMoBM9.js} +0 -0
- /package/dist/{replay-policy-Cz4vCd2t.js → replay-policy-DBCcSA9H.js} +0 -0
- /package/dist/{reply-payloads-dedupe.runtime-DHqFOSfO.js → reply-payloads-dedupe.runtime-DoaNG4lo.js} +0 -0
- /package/dist/{resolve-pBPj3wEy.js → resolve-D1pCHyvv.js} +0 -0
- /package/dist/{responses-tool-shared-CjK_9Hne.js → responses-tool-shared-DHcb1dPQ.js} +0 -0
- /package/dist/{root-help-metadata-CHfvsXBe.js → root-help-metadata-Drx7dB2u.js} +0 -0
- /package/dist/{rpc.runtime-DvvupI-T.js → rpc.runtime-DUWYp4eO.js} +0 -0
- /package/dist/{runtime-api-BzmBrFf3.js → runtime-api-CUPLCkbC.js} +0 -0
- /package/dist/{runtime-manifest.runtime-T4MgRCzw.js → runtime-manifest.runtime-CT5Jdegq.js} +0 -0
- /package/dist/{runtime-model-auth.runtime-DkBcOdwA.js → runtime-model-auth.runtime-C1QVotRO.js} +0 -0
- /package/dist/{runtime-web-channel-plugin-CSkwa3oV.js → runtime-web-channel-plugin-B_jKtF5_.js} +0 -0
- /package/dist/{runtime-web-tools-fallback.runtime-Cl479qhm.js → runtime-web-tools-fallback.runtime-vvVY2hzf.js} +0 -0
- /package/dist/{runtime-web-tools-manifest.runtime-BsrsHIeH.js → runtime-web-tools-manifest.runtime-q4FwzQyo.js} +0 -0
- /package/dist/{runtime-web-tools-public-artifacts.runtime--NfpoCOF.js → runtime-web-tools-public-artifacts.runtime-DH1OendY.js} +0 -0
- /package/dist/{schedule-10eqkliM.js → schedule-B0pphiI5.js} +0 -0
- /package/dist/{secret-file-yoaT8Z2N.js → secret-file-CZYHVmYt.js} +0 -0
- /package/dist/{session-archive.runtime-CoAMhBxN.js → session-archive.runtime-DMp_Mux1.js} +0 -0
- /package/dist/{session-fork.runtime-CZDDfV7c.js → session-fork.runtime--xGBhpew.js} +0 -0
- /package/dist/{setup.plugin-config-B6erjihE.js → setup.plugin-config-DcRd-H0v.js} +0 -0
- /package/dist/{setup.secret-input-BR7Y2Hg1.js → setup.secret-input-NrcTToqs.js} +0 -0
- /package/dist/{skill-draft-generator-C8zPLkD-.js → skill-draft-generator-m9nku0CK.js} +0 -0
- /package/dist/{skill-reviewer-ZeuLRxUy.js → skill-reviewer-BzUB5yY8.js} +0 -0
- /package/dist/{skill-scanner-C3hWfmOb.js → skill-scanner-BlxMlpUH.js} +0 -0
- /package/dist/{skill-writer-DNOmOldW.js → skill-writer-C43S6Lsi.js} +0 -0
- /package/dist/{soul-cli-Co0KcdP3.js → soul-cli-Bb2iCP9P.js} +0 -0
- /package/dist/{ssh-config-m0F_3hKh.js → ssh-config-BA1Y7a8V.js} +0 -0
- /package/dist/{status-config-DbtvFlek.js → status-config-IryaKgaK.js} +0 -0
- /package/dist/{status.agent-local-BNfQnBBE.js → status.agent-local-VigNjFn5.js} +0 -0
- /package/dist/{status.gateway-connection.runtime-eEPv-X0Z.js → status.gateway-connection.runtime-YZTKQZGP.js} +0 -0
- /package/dist/{status.scan.deps.runtime-BAPi7Dm4.js → status.scan.deps.runtime-d3HueyxP.js} +0 -0
- /package/dist/{store-CeTaOlf7.js → store-C-kqItww.js} +0 -0
- /package/dist/{store-DE9I_z-U.js → store-CioZN-iH.js} +0 -0
- /package/dist/{store-BFeUim-y.js → store-Dji_Mahl.js} +0 -0
- /package/dist/{stream-BoFx9-PE.js → stream-BENwbELC.js} +0 -0
- /package/dist/{stream-Bb3o_iaj.js → stream-C2mX5-8a.js} +0 -0
- /package/dist/{subagent-followup-hints-DSxKx2h5.js → subagent-followup-hints-BSNsTYsF.js} +0 -0
- /package/dist/{supervisor-log.runtime-CtoSv_g7.js → supervisor-log.runtime-BSystMWy.js} +0 -0
- /package/dist/{systemd-linger-BeOkR_jw.js → systemd-linger-p1W5Ka5U.js} +0 -0
- /package/dist/{table-B8RObGt5.js → table-UVJgHZWO.js} +0 -0
- /package/dist/{targets.runtime-BTOlvIZi.js → targets.runtime-Dy1_53At.js} +0 -0
- /package/dist/{task-registry.audit.shared-D1VOvgzO.js → task-registry.audit.shared-Bzuti1TG.js} +0 -0
- /package/dist/{text-similarity-DIRFELa3.js → text-similarity-BLCcuUbL.js} +0 -0
- /package/dist/{trust-calculator-lCRAZCPt.js → trust-calculator-CEYEccNS.js} +0 -0
- /package/dist/{tts-CUq9yK2z.js → tts-CKB2MJSq.js} +0 -0
- /package/dist/{tts-B0_QVtVV.js → tts-y10rjplW.js} +0 -0
- /package/dist/{tts.runtime-DIBAMvsb.js → tts.runtime-DJhcLC3T.js} +0 -0
- /package/dist/{types-CNJErmew.js → types-Cl5KlDxs.js} +0 -0
- /package/dist/{video-http-BlHIyytb.js → video-http-lbLggCxb.js} +0 -0
- /package/dist/{widearea-dns-BWrAD9S6.js → widearea-dns-DYys1Z7C.js} +0 -0
- /package/dist/{x-search-tool-shared-Cxa0ul0H.js → x-search-tool-shared-Dy7MMhpV.js} +0 -0
|
@@ -0,0 +1,3301 @@
|
|
|
1
|
+
import { r as formatErrorMessage } from "./errors-CGMew-1w.js";
|
|
2
|
+
import { i as normalizeLowercaseStringOrEmpty } from "./string-coerce-CIT1-v_a.js";
|
|
3
|
+
import { b as truncateUtf16Safe, m as resolveUserPath } from "./utils-CE5zxr9Z.js";
|
|
4
|
+
import { t as createSubsystemLogger } from "./subsystem-qDUB67UD.js";
|
|
5
|
+
import { n as resolveGlobalSingleton } from "./global-singleton-Bq6e5lAP.js";
|
|
6
|
+
import { a as resolveAgentDir, p as resolveAgentWorkspaceDir } from "./agent-scope-DfuA1KpS.js";
|
|
7
|
+
import { t as getProviderEnvVars } from "./provider-env-vars-BuWvbGAb.js";
|
|
8
|
+
import { c as resolveSessionTranscriptsDirForAgent } from "./paths-DRORteAV.js";
|
|
9
|
+
import { n as onSessionTranscriptUpdate } from "./transcript-events-D3cOzr3J.js";
|
|
10
|
+
import { i as getMemoryMultimodalExtensions, r as classifyMemoryMultimodalPath, t as buildCaseInsensitiveExtensionGlob } from "./multimodal-Tq-0NlDi.js";
|
|
11
|
+
import { n as listMemoryEmbeddingProviders, r as listRegisteredMemoryEmbeddingProviderAdapters, t as getMemoryEmbeddingProvider } from "./memory-embedding-provider-runtime-CwF5VeLL.js";
|
|
12
|
+
import { t as resolveMemorySearchConfig } from "./memory-search-B_DOngih.js";
|
|
13
|
+
import { t as extractKeywords } from "./query-expansion-BfzIbuMC.js";
|
|
14
|
+
import "./text-runtime-CNganbWZ.js";
|
|
15
|
+
import "./error-runtime-CrTS5qIB.js";
|
|
16
|
+
import { a as ensureDir, c as listMemoryFiles, d as remapChunkLines, f as runWithConcurrency, h as hasNonTextEmbeddingParts, i as cosineSimilarity, l as normalizeExtraMemoryPaths, n as buildMultimodalChunkForIndexing, o as hashText, p as isFileMissingError, r as chunkMarkdown, t as buildFileEntry, u as parseEmbedding } from "./internal-DyV0UNik.js";
|
|
17
|
+
import { r as readMemoryFile } from "./backend-config-D_Z1xzV0.js";
|
|
18
|
+
import { _ as createLmstudioEmbeddingProvider, a as runGeminiEmbeddingBatches, b as createGeminiEmbeddingProvider, c as DEFAULT_VOYAGE_EMBEDDING_MODEL, d as createOpenAiEmbeddingProvider, g as DEFAULT_LMSTUDIO_EMBEDDING_MODEL, h as createMistralEmbeddingProvider, i as runOpenAiEmbeddingBatches, l as createVoyageEmbeddingProvider, m as DEFAULT_MISTRAL_EMBEDDING_MODEL, n as runVoyageEmbeddingBatches, o as DEFAULT_LOCAL_MODEL, r as OPENAI_BATCH_ENDPOINT, s as createLocalEmbeddingProvider, t as enforceEmbeddingMaxInputTokens, u as DEFAULT_OPENAI_EMBEDDING_MODEL, v as DEFAULT_GEMINI_EMBEDDING_MODEL, y as buildGeminiEmbeddingRequest } from "./engine-embeddings-DebJAEES.js";
|
|
19
|
+
import "./memory-core-host-engine-embeddings-C1TI_dtC.js";
|
|
20
|
+
import "./memory-core-host-engine-foundation-BG5ku8Rl.js";
|
|
21
|
+
import { i as sessionPathForFile, r as listSessionFilesForAgent, t as buildSessionEntry } from "./session-files-CA82WOIU.js";
|
|
22
|
+
import "./memory-core-host-engine-qmd-Bm3dtD44.js";
|
|
23
|
+
import { n as loadSqliteVecExtension, r as ensureMemoryIndexSchema, t as requireNodeSqlite } from "./engine-storage-2d7AVVci.js";
|
|
24
|
+
import "./memory-core-host-engine-storage-CjGGFWHH.js";
|
|
25
|
+
import "./provider-env-vars-Cfec38uE.js";
|
|
26
|
+
import { n as applyMMRToHybridResults, t as DEFAULT_MMR_CONFIG } from "./mmr-BUVQm7ma.js";
|
|
27
|
+
import { n as deduplicateBySimilarity, t as DEFAULT_SEMANTIC_DEDUP_CONFIG } from "./semantic-dedup-CA-I7Ukf.js";
|
|
28
|
+
import fs from "node:fs";
|
|
29
|
+
import path from "node:path";
|
|
30
|
+
import fs$1 from "node:fs/promises";
|
|
31
|
+
import { randomUUID } from "node:crypto";
|
|
32
|
+
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
33
|
+
import chokidar from "chokidar";
|
|
34
|
+
//#region extensions/memory-core/src/memory/provider-adapter-registration.ts
|
|
35
|
+
function filterUnregisteredMemoryEmbeddingProviderAdapters(params) {
|
|
36
|
+
const existingIds = new Set(params.registeredAdapters.map((adapter) => adapter.id));
|
|
37
|
+
return params.builtinAdapters.filter((adapter) => !existingIds.has(adapter.id));
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region extensions/memory-core/src/memory/provider-adapters.ts
|
|
41
|
+
function isMissingApiKeyError(err) {
|
|
42
|
+
return formatErrorMessage(err).includes("No API key found for provider");
|
|
43
|
+
}
|
|
44
|
+
function sanitizeHeaders(headers, excludedHeaderNames) {
|
|
45
|
+
const excluded = new Set(excludedHeaderNames.map((name) => normalizeLowercaseStringOrEmpty(name)));
|
|
46
|
+
return Object.entries(headers).filter(([key]) => !excluded.has(normalizeLowercaseStringOrEmpty(key))).toSorted(([a], [b]) => a.localeCompare(b)).map(([key, value]) => [key, value]);
|
|
47
|
+
}
|
|
48
|
+
function mapBatchEmbeddingsByIndex(byCustomId, count) {
|
|
49
|
+
const embeddings = [];
|
|
50
|
+
for (let index = 0; index < count; index += 1) embeddings.push(byCustomId.get(String(index)) ?? []);
|
|
51
|
+
return embeddings;
|
|
52
|
+
}
|
|
53
|
+
function isNodeLlamaCppMissing(err) {
|
|
54
|
+
if (!(err instanceof Error)) return false;
|
|
55
|
+
return err.code === "ERR_MODULE_NOT_FOUND" && err.message.includes("node-llama-cpp");
|
|
56
|
+
}
|
|
57
|
+
function formatLocalSetupError(err) {
|
|
58
|
+
const detail = formatErrorMessage(err);
|
|
59
|
+
const missing = isNodeLlamaCppMissing(err);
|
|
60
|
+
return [
|
|
61
|
+
"Local embeddings unavailable.",
|
|
62
|
+
missing ? "Reason: optional dependency node-llama-cpp is missing (or failed to install)." : detail ? `Reason: ${detail}` : void 0,
|
|
63
|
+
missing && detail ? `Detail: ${detail}` : null,
|
|
64
|
+
"To enable local embeddings:",
|
|
65
|
+
"1) Use Node 24 (recommended for installs/updates; Node 22 LTS, currently 22.14+, remains supported)",
|
|
66
|
+
missing ? "2) Reinstall KaijiBot (this should install node-llama-cpp): npm i -g kaijibot@latest" : null,
|
|
67
|
+
"3) If you use pnpm: pnpm approve-builds (select node-llama-cpp), then pnpm rebuild node-llama-cpp",
|
|
68
|
+
...[
|
|
69
|
+
"openai",
|
|
70
|
+
"gemini",
|
|
71
|
+
"voyage",
|
|
72
|
+
"mistral"
|
|
73
|
+
].map((provider) => `Or set agents.defaults.memorySearch.provider = "${provider}" (remote).`)
|
|
74
|
+
].filter(Boolean).join("\n");
|
|
75
|
+
}
|
|
76
|
+
function canAutoSelectLocal(modelPath) {
|
|
77
|
+
const trimmed = modelPath?.trim();
|
|
78
|
+
if (!trimmed) return false;
|
|
79
|
+
if (/^(hf:|https?:)/i.test(trimmed)) return false;
|
|
80
|
+
const resolved = resolveUserPath(trimmed);
|
|
81
|
+
try {
|
|
82
|
+
return fs.statSync(resolved).isFile();
|
|
83
|
+
} catch {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function supportsGeminiMultimodalEmbeddings(model) {
|
|
88
|
+
return model.trim().replace(/^models\//, "").replace(/^(gemini|google)\//, "") === "gemini-embedding-2-preview";
|
|
89
|
+
}
|
|
90
|
+
function resolveMemoryEmbeddingAuthProviderId(providerId) {
|
|
91
|
+
return providerId === "gemini" ? "google" : providerId;
|
|
92
|
+
}
|
|
93
|
+
const builtinMemoryEmbeddingProviderAdapters = [
|
|
94
|
+
{
|
|
95
|
+
id: "local",
|
|
96
|
+
defaultModel: DEFAULT_LOCAL_MODEL,
|
|
97
|
+
transport: "local",
|
|
98
|
+
autoSelectPriority: 10,
|
|
99
|
+
formatSetupError: formatLocalSetupError,
|
|
100
|
+
shouldContinueAutoSelection: () => true,
|
|
101
|
+
create: async (options) => {
|
|
102
|
+
const provider = await createLocalEmbeddingProvider({
|
|
103
|
+
...options,
|
|
104
|
+
provider: "local",
|
|
105
|
+
fallback: "none"
|
|
106
|
+
});
|
|
107
|
+
return {
|
|
108
|
+
provider,
|
|
109
|
+
runtime: {
|
|
110
|
+
id: "local",
|
|
111
|
+
cacheKeyData: {
|
|
112
|
+
provider: "local",
|
|
113
|
+
model: provider.model
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "openai",
|
|
121
|
+
defaultModel: DEFAULT_OPENAI_EMBEDDING_MODEL,
|
|
122
|
+
transport: "remote",
|
|
123
|
+
autoSelectPriority: 20,
|
|
124
|
+
allowExplicitWhenConfiguredAuto: true,
|
|
125
|
+
shouldContinueAutoSelection: isMissingApiKeyError,
|
|
126
|
+
create: async (options) => {
|
|
127
|
+
const { provider, client } = await createOpenAiEmbeddingProvider({
|
|
128
|
+
...options,
|
|
129
|
+
provider: "openai",
|
|
130
|
+
fallback: "none"
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
provider,
|
|
134
|
+
runtime: {
|
|
135
|
+
id: "openai",
|
|
136
|
+
cacheKeyData: {
|
|
137
|
+
provider: "openai",
|
|
138
|
+
baseUrl: client.baseUrl,
|
|
139
|
+
model: client.model,
|
|
140
|
+
headers: sanitizeHeaders(client.headers, ["authorization"])
|
|
141
|
+
},
|
|
142
|
+
batchEmbed: async (batch) => {
|
|
143
|
+
return mapBatchEmbeddingsByIndex(await runOpenAiEmbeddingBatches({
|
|
144
|
+
openAi: client,
|
|
145
|
+
agentId: batch.agentId,
|
|
146
|
+
requests: batch.chunks.map((chunk, index) => ({
|
|
147
|
+
custom_id: String(index),
|
|
148
|
+
method: "POST",
|
|
149
|
+
url: OPENAI_BATCH_ENDPOINT,
|
|
150
|
+
body: {
|
|
151
|
+
model: client.model,
|
|
152
|
+
input: chunk.text
|
|
153
|
+
}
|
|
154
|
+
})),
|
|
155
|
+
wait: batch.wait,
|
|
156
|
+
concurrency: batch.concurrency,
|
|
157
|
+
pollIntervalMs: batch.pollIntervalMs,
|
|
158
|
+
timeoutMs: batch.timeoutMs,
|
|
159
|
+
debug: batch.debug
|
|
160
|
+
}), batch.chunks.length);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
id: "gemini",
|
|
168
|
+
defaultModel: DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
169
|
+
transport: "remote",
|
|
170
|
+
autoSelectPriority: 30,
|
|
171
|
+
allowExplicitWhenConfiguredAuto: true,
|
|
172
|
+
supportsMultimodalEmbeddings: ({ model }) => supportsGeminiMultimodalEmbeddings(model),
|
|
173
|
+
shouldContinueAutoSelection: isMissingApiKeyError,
|
|
174
|
+
create: async (options) => {
|
|
175
|
+
const { provider, client } = await createGeminiEmbeddingProvider({
|
|
176
|
+
...options,
|
|
177
|
+
provider: "gemini",
|
|
178
|
+
fallback: "none"
|
|
179
|
+
});
|
|
180
|
+
return {
|
|
181
|
+
provider,
|
|
182
|
+
runtime: {
|
|
183
|
+
id: "gemini",
|
|
184
|
+
cacheKeyData: {
|
|
185
|
+
provider: "gemini",
|
|
186
|
+
baseUrl: client.baseUrl,
|
|
187
|
+
model: client.model,
|
|
188
|
+
outputDimensionality: client.outputDimensionality,
|
|
189
|
+
headers: sanitizeHeaders(client.headers, ["authorization", "x-goog-api-key"])
|
|
190
|
+
},
|
|
191
|
+
batchEmbed: async (batch) => {
|
|
192
|
+
if (batch.chunks.some((chunk) => hasNonTextEmbeddingParts(chunk.embeddingInput))) return null;
|
|
193
|
+
return mapBatchEmbeddingsByIndex(await runGeminiEmbeddingBatches({
|
|
194
|
+
gemini: client,
|
|
195
|
+
agentId: batch.agentId,
|
|
196
|
+
requests: batch.chunks.map((chunk, index) => ({
|
|
197
|
+
custom_id: String(index),
|
|
198
|
+
request: buildGeminiEmbeddingRequest({
|
|
199
|
+
input: chunk.embeddingInput ?? { text: chunk.text },
|
|
200
|
+
taskType: "RETRIEVAL_DOCUMENT",
|
|
201
|
+
modelPath: client.modelPath,
|
|
202
|
+
outputDimensionality: client.outputDimensionality
|
|
203
|
+
})
|
|
204
|
+
})),
|
|
205
|
+
wait: batch.wait,
|
|
206
|
+
concurrency: batch.concurrency,
|
|
207
|
+
pollIntervalMs: batch.pollIntervalMs,
|
|
208
|
+
timeoutMs: batch.timeoutMs,
|
|
209
|
+
debug: batch.debug
|
|
210
|
+
}), batch.chunks.length);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: "voyage",
|
|
218
|
+
defaultModel: DEFAULT_VOYAGE_EMBEDDING_MODEL,
|
|
219
|
+
transport: "remote",
|
|
220
|
+
autoSelectPriority: 40,
|
|
221
|
+
allowExplicitWhenConfiguredAuto: true,
|
|
222
|
+
shouldContinueAutoSelection: isMissingApiKeyError,
|
|
223
|
+
create: async (options) => {
|
|
224
|
+
const { provider, client } = await createVoyageEmbeddingProvider({
|
|
225
|
+
...options,
|
|
226
|
+
provider: "voyage",
|
|
227
|
+
fallback: "none"
|
|
228
|
+
});
|
|
229
|
+
return {
|
|
230
|
+
provider,
|
|
231
|
+
runtime: {
|
|
232
|
+
id: "voyage",
|
|
233
|
+
batchEmbed: async (batch) => {
|
|
234
|
+
return mapBatchEmbeddingsByIndex(await runVoyageEmbeddingBatches({
|
|
235
|
+
client,
|
|
236
|
+
agentId: batch.agentId,
|
|
237
|
+
requests: batch.chunks.map((chunk, index) => ({
|
|
238
|
+
custom_id: String(index),
|
|
239
|
+
body: { input: chunk.text }
|
|
240
|
+
})),
|
|
241
|
+
wait: batch.wait,
|
|
242
|
+
concurrency: batch.concurrency,
|
|
243
|
+
pollIntervalMs: batch.pollIntervalMs,
|
|
244
|
+
timeoutMs: batch.timeoutMs,
|
|
245
|
+
debug: batch.debug
|
|
246
|
+
}), batch.chunks.length);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
id: "mistral",
|
|
254
|
+
defaultModel: DEFAULT_MISTRAL_EMBEDDING_MODEL,
|
|
255
|
+
transport: "remote",
|
|
256
|
+
autoSelectPriority: 50,
|
|
257
|
+
allowExplicitWhenConfiguredAuto: true,
|
|
258
|
+
shouldContinueAutoSelection: isMissingApiKeyError,
|
|
259
|
+
create: async (options) => {
|
|
260
|
+
const { provider, client } = await createMistralEmbeddingProvider({
|
|
261
|
+
...options,
|
|
262
|
+
provider: "mistral",
|
|
263
|
+
fallback: "none"
|
|
264
|
+
});
|
|
265
|
+
return {
|
|
266
|
+
provider,
|
|
267
|
+
runtime: {
|
|
268
|
+
id: "mistral",
|
|
269
|
+
cacheKeyData: {
|
|
270
|
+
provider: "mistral",
|
|
271
|
+
model: client.model
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: "lmstudio",
|
|
279
|
+
defaultModel: DEFAULT_LMSTUDIO_EMBEDDING_MODEL,
|
|
280
|
+
transport: "remote",
|
|
281
|
+
create: async (options) => {
|
|
282
|
+
const { provider, client } = await createLmstudioEmbeddingProvider({
|
|
283
|
+
...options,
|
|
284
|
+
provider: "lmstudio",
|
|
285
|
+
fallback: "none"
|
|
286
|
+
});
|
|
287
|
+
return {
|
|
288
|
+
provider,
|
|
289
|
+
runtime: {
|
|
290
|
+
id: "lmstudio",
|
|
291
|
+
cacheKeyData: {
|
|
292
|
+
provider: "lmstudio",
|
|
293
|
+
baseUrl: client.baseUrl,
|
|
294
|
+
model: client.model,
|
|
295
|
+
headers: sanitizeHeaders(client.headers, ["authorization"])
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
];
|
|
302
|
+
const builtinMemoryEmbeddingProviderAdapterById = new Map(builtinMemoryEmbeddingProviderAdapters.map((adapter) => [adapter.id, adapter]));
|
|
303
|
+
function getBuiltinMemoryEmbeddingProviderAdapter(id) {
|
|
304
|
+
return builtinMemoryEmbeddingProviderAdapterById.get(id);
|
|
305
|
+
}
|
|
306
|
+
function registerBuiltInMemoryEmbeddingProviders(register) {
|
|
307
|
+
for (const adapter of filterUnregisteredMemoryEmbeddingProviderAdapters({
|
|
308
|
+
builtinAdapters: builtinMemoryEmbeddingProviderAdapters,
|
|
309
|
+
registeredAdapters: listRegisteredMemoryEmbeddingProviderAdapters()
|
|
310
|
+
})) register.registerMemoryEmbeddingProvider(adapter);
|
|
311
|
+
}
|
|
312
|
+
function getBuiltinMemoryEmbeddingProviderDoctorMetadata(providerId) {
|
|
313
|
+
const adapter = getBuiltinMemoryEmbeddingProviderAdapter(providerId);
|
|
314
|
+
if (!adapter) return null;
|
|
315
|
+
const authProviderId = resolveMemoryEmbeddingAuthProviderId(adapter.id);
|
|
316
|
+
return {
|
|
317
|
+
providerId: adapter.id,
|
|
318
|
+
authProviderId,
|
|
319
|
+
envVars: getProviderEnvVars(authProviderId),
|
|
320
|
+
transport: adapter.transport === "local" ? "local" : "remote",
|
|
321
|
+
autoSelectPriority: adapter.autoSelectPriority
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function listBuiltinAutoSelectMemoryEmbeddingProviderDoctorMetadata() {
|
|
325
|
+
return builtinMemoryEmbeddingProviderAdapters.filter((adapter) => typeof adapter.autoSelectPriority === "number").toSorted((a, b) => (a.autoSelectPriority ?? 0) - (b.autoSelectPriority ?? 0)).map((adapter) => ({
|
|
326
|
+
providerId: adapter.id,
|
|
327
|
+
authProviderId: resolveMemoryEmbeddingAuthProviderId(adapter.id),
|
|
328
|
+
envVars: getProviderEnvVars(resolveMemoryEmbeddingAuthProviderId(adapter.id)),
|
|
329
|
+
transport: adapter.transport === "local" ? "local" : "remote",
|
|
330
|
+
autoSelectPriority: adapter.autoSelectPriority
|
|
331
|
+
}));
|
|
332
|
+
}
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region extensions/memory-core/src/memory/embeddings.ts
|
|
335
|
+
function formatProviderError(adapter, err) {
|
|
336
|
+
return adapter.formatSetupError?.(err) ?? formatErrorMessage(err);
|
|
337
|
+
}
|
|
338
|
+
function shouldContinueAutoSelection(adapter, err) {
|
|
339
|
+
return adapter.shouldContinueAutoSelection?.(err) ?? false;
|
|
340
|
+
}
|
|
341
|
+
function getAdapter(id, config) {
|
|
342
|
+
const adapter = getMemoryEmbeddingProvider(id, config);
|
|
343
|
+
if (!adapter) throw new Error(`Unknown memory embedding provider: ${id}`);
|
|
344
|
+
return adapter;
|
|
345
|
+
}
|
|
346
|
+
function listAutoSelectAdapters(options) {
|
|
347
|
+
return listMemoryEmbeddingProviders(options.config).filter((adapter) => typeof adapter.autoSelectPriority === "number").filter((adapter) => adapter.id === "local" ? canAutoSelectLocal(options.local?.modelPath) : true).toSorted((a, b) => (a.autoSelectPriority ?? Number.MAX_SAFE_INTEGER) - (b.autoSelectPriority ?? Number.MAX_SAFE_INTEGER));
|
|
348
|
+
}
|
|
349
|
+
function resolveProviderModel(adapter, requestedModel) {
|
|
350
|
+
const trimmed = requestedModel.trim();
|
|
351
|
+
if (trimmed) return trimmed;
|
|
352
|
+
return adapter.defaultModel ?? "";
|
|
353
|
+
}
|
|
354
|
+
function resolveEmbeddingProviderFallbackModel(providerId, fallbackSourceModel, config) {
|
|
355
|
+
return getMemoryEmbeddingProvider(providerId, config)?.defaultModel ?? fallbackSourceModel;
|
|
356
|
+
}
|
|
357
|
+
async function createWithAdapter(adapter, options) {
|
|
358
|
+
const result = await adapter.create({
|
|
359
|
+
...options,
|
|
360
|
+
model: resolveProviderModel(adapter, options.model)
|
|
361
|
+
});
|
|
362
|
+
return {
|
|
363
|
+
provider: result.provider,
|
|
364
|
+
requestedProvider: options.provider,
|
|
365
|
+
runtime: result.runtime
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
async function createEmbeddingProvider(options) {
|
|
369
|
+
if (options.provider === "auto") {
|
|
370
|
+
const reasons = [];
|
|
371
|
+
for (const adapter of listAutoSelectAdapters(options)) try {
|
|
372
|
+
return {
|
|
373
|
+
...await createWithAdapter(adapter, {
|
|
374
|
+
...options,
|
|
375
|
+
provider: adapter.id
|
|
376
|
+
}),
|
|
377
|
+
requestedProvider: "auto"
|
|
378
|
+
};
|
|
379
|
+
} catch (err) {
|
|
380
|
+
const message = formatProviderError(adapter, err);
|
|
381
|
+
if (shouldContinueAutoSelection(adapter, err)) {
|
|
382
|
+
reasons.push(message);
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
const wrapped = new Error(message);
|
|
386
|
+
wrapped.cause = err;
|
|
387
|
+
throw wrapped;
|
|
388
|
+
}
|
|
389
|
+
return {
|
|
390
|
+
provider: null,
|
|
391
|
+
requestedProvider: "auto",
|
|
392
|
+
providerUnavailableReason: reasons.length > 0 ? reasons.join("\n\n") : "No embeddings provider available."
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
const primaryAdapter = getAdapter(options.provider, options.config);
|
|
396
|
+
try {
|
|
397
|
+
return await createWithAdapter(primaryAdapter, options);
|
|
398
|
+
} catch (primaryErr) {
|
|
399
|
+
const reason = formatProviderError(primaryAdapter, primaryErr);
|
|
400
|
+
if (options.fallback && options.fallback !== "none" && options.fallback !== options.provider) {
|
|
401
|
+
const fallbackAdapter = getAdapter(options.fallback, options.config);
|
|
402
|
+
try {
|
|
403
|
+
return {
|
|
404
|
+
...await createWithAdapter(fallbackAdapter, {
|
|
405
|
+
...options,
|
|
406
|
+
provider: options.fallback
|
|
407
|
+
}),
|
|
408
|
+
requestedProvider: options.provider,
|
|
409
|
+
fallbackFrom: options.provider,
|
|
410
|
+
fallbackReason: reason
|
|
411
|
+
};
|
|
412
|
+
} catch (fallbackErr) {
|
|
413
|
+
const fallbackReason = formatProviderError(fallbackAdapter, fallbackErr);
|
|
414
|
+
const wrapped = /* @__PURE__ */ new Error(`${reason}\n\nFallback to ${options.fallback} failed: ${fallbackReason}`);
|
|
415
|
+
wrapped.cause = primaryErr;
|
|
416
|
+
throw wrapped;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
const wrapped = new Error(reason);
|
|
420
|
+
wrapped.cause = primaryErr;
|
|
421
|
+
throw wrapped;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region extensions/memory-core/src/memory/temporal-decay.ts
|
|
426
|
+
const DEFAULT_TEMPORAL_DECAY_CONFIG = {
|
|
427
|
+
enabled: false,
|
|
428
|
+
halfLifeDays: 30
|
|
429
|
+
};
|
|
430
|
+
const DAY_MS = 1440 * 60 * 1e3;
|
|
431
|
+
const DATED_MEMORY_PATH_RE = /(?:^|\/)memory\/(\d{4})-(\d{2})-(\d{2})\.md$/;
|
|
432
|
+
function toDecayLambda(halfLifeDays) {
|
|
433
|
+
if (!Number.isFinite(halfLifeDays) || halfLifeDays <= 0) return 0;
|
|
434
|
+
return Math.LN2 / halfLifeDays;
|
|
435
|
+
}
|
|
436
|
+
function calculateTemporalDecayMultiplier(params) {
|
|
437
|
+
const lambda = toDecayLambda(params.halfLifeDays);
|
|
438
|
+
const clampedAge = Math.max(0, params.ageInDays);
|
|
439
|
+
if (lambda <= 0 || !Number.isFinite(clampedAge)) return 1;
|
|
440
|
+
return Math.exp(-lambda * clampedAge);
|
|
441
|
+
}
|
|
442
|
+
function applyTemporalDecayToScore(params) {
|
|
443
|
+
return params.score * calculateTemporalDecayMultiplier(params);
|
|
444
|
+
}
|
|
445
|
+
function parseMemoryDateFromPath(filePath) {
|
|
446
|
+
const normalized = filePath.replaceAll("\\", "/").replace(/^\.\//, "");
|
|
447
|
+
const match = DATED_MEMORY_PATH_RE.exec(normalized);
|
|
448
|
+
if (!match) return null;
|
|
449
|
+
const year = Number(match[1]);
|
|
450
|
+
const month = Number(match[2]);
|
|
451
|
+
const day = Number(match[3]);
|
|
452
|
+
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) return null;
|
|
453
|
+
const timestamp = Date.UTC(year, month - 1, day);
|
|
454
|
+
const parsed = new Date(timestamp);
|
|
455
|
+
if (parsed.getUTCFullYear() !== year || parsed.getUTCMonth() !== month - 1 || parsed.getUTCDate() !== day) return null;
|
|
456
|
+
return parsed;
|
|
457
|
+
}
|
|
458
|
+
function isEvergreenMemoryPath(filePath) {
|
|
459
|
+
const normalized = filePath.replaceAll("\\", "/").replace(/^\.\//, "");
|
|
460
|
+
if (normalized === "MEMORY.md" || normalized === "memory.md") return true;
|
|
461
|
+
if (!normalized.startsWith("memory/")) return false;
|
|
462
|
+
return !DATED_MEMORY_PATH_RE.test(normalized);
|
|
463
|
+
}
|
|
464
|
+
async function extractTimestamp(params) {
|
|
465
|
+
const fromPath = parseMemoryDateFromPath(params.filePath);
|
|
466
|
+
if (fromPath) return fromPath;
|
|
467
|
+
if (params.source === "memory" && isEvergreenMemoryPath(params.filePath)) return null;
|
|
468
|
+
if (!params.workspaceDir) return null;
|
|
469
|
+
const absolutePath = path.isAbsolute(params.filePath) ? params.filePath : path.resolve(params.workspaceDir, params.filePath);
|
|
470
|
+
try {
|
|
471
|
+
const stat = await fs$1.stat(absolutePath);
|
|
472
|
+
if (!Number.isFinite(stat.mtimeMs)) return null;
|
|
473
|
+
return new Date(stat.mtimeMs);
|
|
474
|
+
} catch {
|
|
475
|
+
return null;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
function ageInDaysFromTimestamp(timestamp, nowMs) {
|
|
479
|
+
return Math.max(0, nowMs - timestamp.getTime()) / DAY_MS;
|
|
480
|
+
}
|
|
481
|
+
async function applyTemporalDecayToHybridResults(params) {
|
|
482
|
+
const config = {
|
|
483
|
+
...DEFAULT_TEMPORAL_DECAY_CONFIG,
|
|
484
|
+
...params.temporalDecay
|
|
485
|
+
};
|
|
486
|
+
if (!config.enabled) return [...params.results];
|
|
487
|
+
const nowMs = params.nowMs ?? Date.now();
|
|
488
|
+
const timestampPromiseCache = /* @__PURE__ */ new Map();
|
|
489
|
+
return Promise.all(params.results.map(async (entry) => {
|
|
490
|
+
const cacheKey = `${entry.source}:${entry.path}`;
|
|
491
|
+
let timestampPromise = timestampPromiseCache.get(cacheKey);
|
|
492
|
+
if (!timestampPromise) {
|
|
493
|
+
timestampPromise = extractTimestamp({
|
|
494
|
+
filePath: entry.path,
|
|
495
|
+
source: entry.source,
|
|
496
|
+
workspaceDir: params.workspaceDir
|
|
497
|
+
});
|
|
498
|
+
timestampPromiseCache.set(cacheKey, timestampPromise);
|
|
499
|
+
}
|
|
500
|
+
const timestamp = await timestampPromise;
|
|
501
|
+
if (!timestamp) return entry;
|
|
502
|
+
const decayedScore = applyTemporalDecayToScore({
|
|
503
|
+
score: entry.score,
|
|
504
|
+
ageInDays: ageInDaysFromTimestamp(timestamp, nowMs),
|
|
505
|
+
halfLifeDays: config.halfLifeDays
|
|
506
|
+
});
|
|
507
|
+
return {
|
|
508
|
+
...entry,
|
|
509
|
+
score: decayedScore
|
|
510
|
+
};
|
|
511
|
+
}));
|
|
512
|
+
}
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region extensions/memory-core/src/memory/hybrid.ts
|
|
515
|
+
function buildFtsQuery(raw) {
|
|
516
|
+
const tokens = raw.match(/[\p{L}\p{N}_]+/gu)?.map((t) => t.trim()).filter(Boolean) ?? [];
|
|
517
|
+
if (tokens.length === 0) return null;
|
|
518
|
+
return tokens.map((t) => `"${t.replaceAll("\"", "")}"`).join(" AND ");
|
|
519
|
+
}
|
|
520
|
+
function bm25RankToScore(rank) {
|
|
521
|
+
if (!Number.isFinite(rank)) return 1 / 1e3;
|
|
522
|
+
if (rank < 0) {
|
|
523
|
+
const relevance = -rank;
|
|
524
|
+
return relevance / (1 + relevance);
|
|
525
|
+
}
|
|
526
|
+
return 1 / (1 + rank);
|
|
527
|
+
}
|
|
528
|
+
async function mergeHybridResults(params) {
|
|
529
|
+
const byId = /* @__PURE__ */ new Map();
|
|
530
|
+
for (const r of params.vector) byId.set(r.id, {
|
|
531
|
+
id: r.id,
|
|
532
|
+
path: r.path,
|
|
533
|
+
startLine: r.startLine,
|
|
534
|
+
endLine: r.endLine,
|
|
535
|
+
source: r.source,
|
|
536
|
+
snippet: r.snippet,
|
|
537
|
+
vectorScore: r.vectorScore,
|
|
538
|
+
textScore: 0
|
|
539
|
+
});
|
|
540
|
+
for (const r of params.keyword) {
|
|
541
|
+
const existing = byId.get(r.id);
|
|
542
|
+
if (existing) {
|
|
543
|
+
existing.textScore = r.textScore;
|
|
544
|
+
if (r.snippet && r.snippet.length > 0) existing.snippet = r.snippet;
|
|
545
|
+
} else byId.set(r.id, {
|
|
546
|
+
id: r.id,
|
|
547
|
+
path: r.path,
|
|
548
|
+
startLine: r.startLine,
|
|
549
|
+
endLine: r.endLine,
|
|
550
|
+
source: r.source,
|
|
551
|
+
snippet: r.snippet,
|
|
552
|
+
vectorScore: 0,
|
|
553
|
+
textScore: r.textScore
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
const sorted = (await applyTemporalDecayToHybridResults({
|
|
557
|
+
results: Array.from(byId.values()).map((entry) => {
|
|
558
|
+
const score = params.vectorWeight * entry.vectorScore + params.textWeight * entry.textScore;
|
|
559
|
+
return {
|
|
560
|
+
path: entry.path,
|
|
561
|
+
startLine: entry.startLine,
|
|
562
|
+
endLine: entry.endLine,
|
|
563
|
+
score,
|
|
564
|
+
snippet: entry.snippet,
|
|
565
|
+
source: entry.source
|
|
566
|
+
};
|
|
567
|
+
}),
|
|
568
|
+
temporalDecay: {
|
|
569
|
+
...DEFAULT_TEMPORAL_DECAY_CONFIG,
|
|
570
|
+
...params.temporalDecay
|
|
571
|
+
},
|
|
572
|
+
workspaceDir: params.workspaceDir,
|
|
573
|
+
nowMs: params.nowMs
|
|
574
|
+
})).toSorted((a, b) => b.score - a.score);
|
|
575
|
+
const dedupConfig = {
|
|
576
|
+
...DEFAULT_SEMANTIC_DEDUP_CONFIG,
|
|
577
|
+
...params.semanticDedup
|
|
578
|
+
};
|
|
579
|
+
const afterDedup = dedupConfig.enabled ? (() => {
|
|
580
|
+
const dedupedItems = deduplicateBySimilarity(sorted.map((r, i) => ({
|
|
581
|
+
id: `${r.path}:${r.startLine}:${i}`,
|
|
582
|
+
score: r.score,
|
|
583
|
+
content: r.snippet
|
|
584
|
+
})), dedupConfig);
|
|
585
|
+
const keptIds = new Set(dedupedItems.map((d) => d.id));
|
|
586
|
+
return sorted.filter((_, i) => keptIds.has(`${_.path}:${_.startLine}:${i}`));
|
|
587
|
+
})() : sorted;
|
|
588
|
+
const mmrConfig = {
|
|
589
|
+
...DEFAULT_MMR_CONFIG,
|
|
590
|
+
...params.mmr
|
|
591
|
+
};
|
|
592
|
+
if (mmrConfig.enabled) return applyMMRToHybridResults(afterDedup, mmrConfig);
|
|
593
|
+
return afterDedup;
|
|
594
|
+
}
|
|
595
|
+
//#endregion
|
|
596
|
+
//#region extensions/memory-core/src/memory/manager-async-state.ts
|
|
597
|
+
function startAsyncSearchSync(params) {
|
|
598
|
+
if (!params.enabled || !params.dirty && !params.sessionsDirty) return;
|
|
599
|
+
params.sync({ reason: "search" }).catch((err) => {
|
|
600
|
+
params.onError(err);
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
async function awaitPendingManagerWork(params) {
|
|
604
|
+
if (params.pendingSync) try {
|
|
605
|
+
await params.pendingSync;
|
|
606
|
+
} catch {}
|
|
607
|
+
if (params.pendingProviderInit) try {
|
|
608
|
+
await params.pendingProviderInit;
|
|
609
|
+
} catch {}
|
|
610
|
+
}
|
|
611
|
+
function resetMemoryBatchFailureState(state) {
|
|
612
|
+
return {
|
|
613
|
+
...state,
|
|
614
|
+
count: 0,
|
|
615
|
+
lastError: void 0,
|
|
616
|
+
lastProvider: void 0
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
function recordMemoryBatchFailure(state, params) {
|
|
620
|
+
if (!state.enabled) return state;
|
|
621
|
+
const increment = params.forceDisable ? 2 : Math.max(1, params.attempts ?? 1);
|
|
622
|
+
const count = state.count + increment;
|
|
623
|
+
return {
|
|
624
|
+
enabled: !(params.forceDisable || count >= 2),
|
|
625
|
+
count,
|
|
626
|
+
lastError: params.message,
|
|
627
|
+
lastProvider: params.provider
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region extensions/memory-core/src/memory/manager-cache.ts
|
|
632
|
+
function resolveSingletonManagedCache(cacheKey) {
|
|
633
|
+
return resolveGlobalSingleton(cacheKey, () => ({
|
|
634
|
+
cache: /* @__PURE__ */ new Map(),
|
|
635
|
+
pending: /* @__PURE__ */ new Map()
|
|
636
|
+
}));
|
|
637
|
+
}
|
|
638
|
+
async function getOrCreateManagedCacheEntry(params) {
|
|
639
|
+
if (params.bypassCache) return await params.create();
|
|
640
|
+
const existing = params.cache.get(params.key);
|
|
641
|
+
if (existing) return existing;
|
|
642
|
+
const pending = params.pending.get(params.key);
|
|
643
|
+
if (pending) return pending;
|
|
644
|
+
const createPromise = (async () => {
|
|
645
|
+
const refreshed = params.cache.get(params.key);
|
|
646
|
+
if (refreshed) return refreshed;
|
|
647
|
+
const entry = await params.create();
|
|
648
|
+
params.cache.set(params.key, entry);
|
|
649
|
+
return entry;
|
|
650
|
+
})();
|
|
651
|
+
params.pending.set(params.key, createPromise);
|
|
652
|
+
try {
|
|
653
|
+
return await createPromise;
|
|
654
|
+
} finally {
|
|
655
|
+
if (params.pending.get(params.key) === createPromise) params.pending.delete(params.key);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
async function closeManagedCacheEntries(params) {
|
|
659
|
+
const pending = Array.from(params.pending.values());
|
|
660
|
+
if (pending.length > 0) await Promise.allSettled(pending);
|
|
661
|
+
const entries = Array.from(params.cache.values());
|
|
662
|
+
params.cache.clear();
|
|
663
|
+
for (const entry of entries) {
|
|
664
|
+
if (typeof entry.close !== "function") continue;
|
|
665
|
+
try {
|
|
666
|
+
await entry.close();
|
|
667
|
+
} catch (err) {
|
|
668
|
+
params.onCloseError?.(err);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
//#endregion
|
|
673
|
+
//#region extensions/memory-core/src/memory/manager-embedding-cache.ts
|
|
674
|
+
function loadMemoryEmbeddingCache(params) {
|
|
675
|
+
const provider = params.provider;
|
|
676
|
+
if (!params.enabled || !provider || !params.providerKey || params.hashes.length === 0) return /* @__PURE__ */ new Map();
|
|
677
|
+
const unique = [];
|
|
678
|
+
const seen = /* @__PURE__ */ new Set();
|
|
679
|
+
for (const hash of params.hashes) {
|
|
680
|
+
if (!hash || seen.has(hash)) continue;
|
|
681
|
+
seen.add(hash);
|
|
682
|
+
unique.push(hash);
|
|
683
|
+
}
|
|
684
|
+
if (unique.length === 0) return /* @__PURE__ */ new Map();
|
|
685
|
+
const tableName = params.tableName ?? "embedding_cache";
|
|
686
|
+
const out = /* @__PURE__ */ new Map();
|
|
687
|
+
const baseParams = [
|
|
688
|
+
provider.id,
|
|
689
|
+
provider.model,
|
|
690
|
+
params.providerKey
|
|
691
|
+
];
|
|
692
|
+
const batchSize = 400;
|
|
693
|
+
for (let start = 0; start < unique.length; start += batchSize) {
|
|
694
|
+
const batch = unique.slice(start, start + batchSize);
|
|
695
|
+
const placeholders = batch.map(() => "?").join(", ");
|
|
696
|
+
const rows = params.db.prepare(`SELECT hash, embedding FROM ${tableName}\n WHERE provider = ? AND model = ? AND provider_key = ? AND hash IN (${placeholders})`).all(...baseParams, ...batch);
|
|
697
|
+
for (const row of rows) out.set(row.hash, parseEmbedding(row.embedding));
|
|
698
|
+
}
|
|
699
|
+
return out;
|
|
700
|
+
}
|
|
701
|
+
function upsertMemoryEmbeddingCache(params) {
|
|
702
|
+
const provider = params.provider;
|
|
703
|
+
if (!params.enabled || !provider || !params.providerKey || params.entries.length === 0) return;
|
|
704
|
+
const tableName = params.tableName ?? "embedding_cache";
|
|
705
|
+
const now = params.now ?? Date.now();
|
|
706
|
+
const stmt = params.db.prepare(`INSERT INTO ${tableName} (provider, model, provider_key, hash, embedding, dims, updated_at)\n VALUES (?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT(provider, model, provider_key, hash) DO UPDATE SET\n embedding=excluded.embedding,\n dims=excluded.dims,\n updated_at=excluded.updated_at`);
|
|
707
|
+
for (const entry of params.entries) {
|
|
708
|
+
const embedding = entry.embedding ?? [];
|
|
709
|
+
stmt.run(provider.id, provider.model, params.providerKey, entry.hash, JSON.stringify(embedding), embedding.length, now);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
function collectMemoryCachedEmbeddings(params) {
|
|
713
|
+
const embeddings = Array.from({ length: params.chunks.length }, () => []);
|
|
714
|
+
const missing = [];
|
|
715
|
+
for (let index = 0; index < params.chunks.length; index += 1) {
|
|
716
|
+
const chunk = params.chunks[index];
|
|
717
|
+
const hit = chunk?.hash ? params.cached.get(chunk.hash) : void 0;
|
|
718
|
+
if (hit && hit.length > 0) embeddings[index] = hit;
|
|
719
|
+
else if (chunk) missing.push({
|
|
720
|
+
index,
|
|
721
|
+
chunk
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
return {
|
|
725
|
+
embeddings,
|
|
726
|
+
missing
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region extensions/memory-core/src/memory/manager-embedding-policy.ts
|
|
731
|
+
function estimateUtf8Bytes(text) {
|
|
732
|
+
if (!text) return 0;
|
|
733
|
+
return Buffer.byteLength(text, "utf8");
|
|
734
|
+
}
|
|
735
|
+
function estimateStructuredEmbeddingInputBytes(input) {
|
|
736
|
+
if (!input.parts?.length) return estimateUtf8Bytes(input.text);
|
|
737
|
+
let total = 0;
|
|
738
|
+
for (const part of input.parts) if (part.type === "text") total += estimateUtf8Bytes(part.text);
|
|
739
|
+
else {
|
|
740
|
+
total += estimateUtf8Bytes(part.mimeType);
|
|
741
|
+
total += estimateUtf8Bytes(part.data);
|
|
742
|
+
}
|
|
743
|
+
return total;
|
|
744
|
+
}
|
|
745
|
+
function filterNonEmptyMemoryChunks(chunks) {
|
|
746
|
+
return chunks.filter((chunk) => chunk.text.trim().length > 0);
|
|
747
|
+
}
|
|
748
|
+
function buildMemoryEmbeddingBatches(chunks, maxTokens) {
|
|
749
|
+
const batches = [];
|
|
750
|
+
let current = [];
|
|
751
|
+
let currentTokens = 0;
|
|
752
|
+
for (const chunk of chunks) {
|
|
753
|
+
const estimate = chunk.embeddingInput ? estimateStructuredEmbeddingInputBytes(chunk.embeddingInput) : estimateUtf8Bytes(chunk.text);
|
|
754
|
+
if (current.length > 0 && currentTokens + estimate > maxTokens) {
|
|
755
|
+
batches.push(current);
|
|
756
|
+
current = [];
|
|
757
|
+
currentTokens = 0;
|
|
758
|
+
}
|
|
759
|
+
if (current.length === 0 && estimate > maxTokens) {
|
|
760
|
+
batches.push([chunk]);
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
current.push(chunk);
|
|
764
|
+
currentTokens += estimate;
|
|
765
|
+
}
|
|
766
|
+
if (current.length > 0) batches.push(current);
|
|
767
|
+
return batches;
|
|
768
|
+
}
|
|
769
|
+
function isRetryableMemoryEmbeddingError(message) {
|
|
770
|
+
return /(rate[_ ]limit|too many requests|429|resource has been exhausted|5\d\d|cloudflare|tokens per day)/i.test(message);
|
|
771
|
+
}
|
|
772
|
+
function resolveMemoryEmbeddingRetryDelay(delayMs, randomValue, maxDelayMs) {
|
|
773
|
+
return Math.min(maxDelayMs, Math.round(delayMs * (1 + randomValue * .2)));
|
|
774
|
+
}
|
|
775
|
+
async function runMemoryEmbeddingRetryLoop(params) {
|
|
776
|
+
let attempt = 0;
|
|
777
|
+
let delayMs = params.baseDelayMs;
|
|
778
|
+
while (true) try {
|
|
779
|
+
return await params.run();
|
|
780
|
+
} catch (err) {
|
|
781
|
+
const message = formatErrorMessage(err);
|
|
782
|
+
if (!params.isRetryable(message) || attempt >= params.maxAttempts) throw err;
|
|
783
|
+
await params.waitForRetry(delayMs);
|
|
784
|
+
delayMs *= 2;
|
|
785
|
+
attempt += 1;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
function buildTextEmbeddingInputs(chunks) {
|
|
789
|
+
return chunks.map((chunk) => chunk.embeddingInput ?? { text: chunk.text });
|
|
790
|
+
}
|
|
791
|
+
//#endregion
|
|
792
|
+
//#region extensions/memory-core/src/memory/manager-fts-state.ts
|
|
793
|
+
function deleteMemoryFtsRows(params) {
|
|
794
|
+
const tableName = params.tableName ?? "chunks_fts";
|
|
795
|
+
if (params.currentModel) {
|
|
796
|
+
params.db.prepare(`DELETE FROM ${tableName} WHERE path = ? AND source = ? AND model = ?`).run(params.path, params.source, params.currentModel);
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
params.db.prepare(`DELETE FROM ${tableName} WHERE path = ? AND source = ?`).run(params.path, params.source);
|
|
800
|
+
}
|
|
801
|
+
//#endregion
|
|
802
|
+
//#region extensions/memory-core/src/memory/manager-atomic-reindex.ts
|
|
803
|
+
const defaultFileOps = {
|
|
804
|
+
rename: fs$1.rename,
|
|
805
|
+
rm: fs$1.rm,
|
|
806
|
+
wait: setTimeout$1
|
|
807
|
+
};
|
|
808
|
+
const transientFileErrorCodes = new Set([
|
|
809
|
+
"EBUSY",
|
|
810
|
+
"EPERM",
|
|
811
|
+
"EACCES"
|
|
812
|
+
]);
|
|
813
|
+
const defaultMaxRenameAttempts = 6;
|
|
814
|
+
const defaultRenameRetryDelayMs = 25;
|
|
815
|
+
const defaultMaxRemoveAttempts = 10;
|
|
816
|
+
const defaultRemoveRetryDelayMs = 50;
|
|
817
|
+
function isTransientFileError(err) {
|
|
818
|
+
return transientFileErrorCodes.has(err.code ?? "");
|
|
819
|
+
}
|
|
820
|
+
function resolveMemoryIndexFileOptions(options = {}) {
|
|
821
|
+
return {
|
|
822
|
+
fileOps: options.fileOps ?? defaultFileOps,
|
|
823
|
+
maxRenameAttempts: Math.max(1, options.maxRenameAttempts ?? defaultMaxRenameAttempts),
|
|
824
|
+
renameRetryDelayMs: options.renameRetryDelayMs ?? defaultRenameRetryDelayMs,
|
|
825
|
+
maxRemoveAttempts: Math.max(1, options.maxRemoveAttempts ?? defaultMaxRemoveAttempts),
|
|
826
|
+
removeRetryDelayMs: options.removeRetryDelayMs ?? defaultRemoveRetryDelayMs
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
async function renameWithRetry(source, target, options) {
|
|
830
|
+
for (let attempt = 1; attempt <= options.maxRenameAttempts; attempt++) try {
|
|
831
|
+
await options.fileOps.rename(source, target);
|
|
832
|
+
return;
|
|
833
|
+
} catch (err) {
|
|
834
|
+
if (err.code === "ENOENT") return;
|
|
835
|
+
if (!isTransientFileError(err) || attempt === options.maxRenameAttempts) throw err;
|
|
836
|
+
await options.fileOps.wait(options.renameRetryDelayMs * attempt);
|
|
837
|
+
}
|
|
838
|
+
throw new Error("rename retry loop exited unexpectedly");
|
|
839
|
+
}
|
|
840
|
+
async function moveMemoryIndexFiles(sourceBase, targetBase, options = {}) {
|
|
841
|
+
const resolvedOptions = resolveMemoryIndexFileOptions(options);
|
|
842
|
+
for (const suffix of [
|
|
843
|
+
"",
|
|
844
|
+
"-wal",
|
|
845
|
+
"-shm"
|
|
846
|
+
]) await renameWithRetry(`${sourceBase}${suffix}`, `${targetBase}${suffix}`, resolvedOptions);
|
|
847
|
+
}
|
|
848
|
+
async function rmWithRetry(path, options) {
|
|
849
|
+
for (let attempt = 1; attempt <= options.maxRemoveAttempts; attempt++) try {
|
|
850
|
+
await options.fileOps.rm(path, { force: true });
|
|
851
|
+
return;
|
|
852
|
+
} catch (err) {
|
|
853
|
+
if (err.code === "ENOENT") return;
|
|
854
|
+
if (!isTransientFileError(err) || attempt === options.maxRemoveAttempts) throw err;
|
|
855
|
+
await options.fileOps.wait(options.removeRetryDelayMs * attempt);
|
|
856
|
+
}
|
|
857
|
+
throw new Error("rm retry loop exited unexpectedly");
|
|
858
|
+
}
|
|
859
|
+
async function removeMemoryIndexFiles(basePath, options = {}) {
|
|
860
|
+
const resolvedOptions = resolveMemoryIndexFileOptions(options);
|
|
861
|
+
for (const suffix of [
|
|
862
|
+
"",
|
|
863
|
+
"-wal",
|
|
864
|
+
"-shm"
|
|
865
|
+
]) await rmWithRetry(`${basePath}${suffix}`, resolvedOptions);
|
|
866
|
+
}
|
|
867
|
+
async function swapMemoryIndexFiles(targetPath, tempPath) {
|
|
868
|
+
const backupPath = `${targetPath}.backup-${randomUUID()}`;
|
|
869
|
+
await moveMemoryIndexFiles(targetPath, backupPath);
|
|
870
|
+
try {
|
|
871
|
+
await moveMemoryIndexFiles(tempPath, targetPath);
|
|
872
|
+
} catch (err) {
|
|
873
|
+
await moveMemoryIndexFiles(backupPath, targetPath);
|
|
874
|
+
throw err;
|
|
875
|
+
}
|
|
876
|
+
await removeMemoryIndexFiles(backupPath);
|
|
877
|
+
}
|
|
878
|
+
async function runMemoryAtomicReindex(params) {
|
|
879
|
+
try {
|
|
880
|
+
const result = await params.build();
|
|
881
|
+
await swapMemoryIndexFiles(params.targetPath, params.tempPath);
|
|
882
|
+
return result;
|
|
883
|
+
} catch (err) {
|
|
884
|
+
try {
|
|
885
|
+
await params.beforeTempCleanup?.();
|
|
886
|
+
await removeMemoryIndexFiles(params.tempPath, params.fileOptions);
|
|
887
|
+
} catch (cleanupErr) {
|
|
888
|
+
throw new AggregateError([err, cleanupErr], "memory atomic reindex failed and temp cleanup failed", { cause: cleanupErr });
|
|
889
|
+
}
|
|
890
|
+
throw err;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region extensions/memory-core/src/memory/manager-db.ts
|
|
895
|
+
function openMemoryDatabaseAtPath(dbPath, allowExtension) {
|
|
896
|
+
ensureDir(path.dirname(dbPath));
|
|
897
|
+
const { DatabaseSync } = requireNodeSqlite();
|
|
898
|
+
const db = new DatabaseSync(dbPath, { allowExtension });
|
|
899
|
+
db.exec("PRAGMA busy_timeout = 5000");
|
|
900
|
+
return db;
|
|
901
|
+
}
|
|
902
|
+
//#endregion
|
|
903
|
+
//#region extensions/memory-core/src/memory/manager-provider-state.ts
|
|
904
|
+
function resolveMemoryPrimaryProviderRequest(params) {
|
|
905
|
+
return {
|
|
906
|
+
provider: params.settings.provider,
|
|
907
|
+
model: params.settings.model,
|
|
908
|
+
remote: params.settings.remote,
|
|
909
|
+
outputDimensionality: params.settings.outputDimensionality,
|
|
910
|
+
fallback: params.settings.fallback,
|
|
911
|
+
local: params.settings.local
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
function resolveMemoryProviderState(result) {
|
|
915
|
+
return {
|
|
916
|
+
provider: result.provider,
|
|
917
|
+
fallbackFrom: result.fallbackFrom,
|
|
918
|
+
fallbackReason: result.fallbackReason,
|
|
919
|
+
providerUnavailableReason: result.providerUnavailableReason,
|
|
920
|
+
providerRuntime: result.runtime
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
function applyMemoryFallbackProviderState(params) {
|
|
924
|
+
return {
|
|
925
|
+
...params.current,
|
|
926
|
+
fallbackFrom: params.fallbackFrom,
|
|
927
|
+
fallbackReason: params.reason,
|
|
928
|
+
provider: params.result.provider,
|
|
929
|
+
providerRuntime: params.result.runtime
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
function resolveMemoryFallbackProviderRequest(params) {
|
|
933
|
+
const fallback = params.settings.fallback;
|
|
934
|
+
if (!fallback || fallback === "none" || !params.currentProviderId || fallback === params.currentProviderId) return null;
|
|
935
|
+
return {
|
|
936
|
+
provider: fallback,
|
|
937
|
+
model: resolveEmbeddingProviderFallbackModel(fallback, params.settings.model, params.cfg),
|
|
938
|
+
remote: params.settings.remote,
|
|
939
|
+
outputDimensionality: params.settings.outputDimensionality,
|
|
940
|
+
fallback: "none",
|
|
941
|
+
local: params.settings.local
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region extensions/memory-core/src/memory/manager-reindex-state.ts
|
|
946
|
+
function resolveConfiguredSourcesForMeta(sources) {
|
|
947
|
+
const normalized = Array.from(sources).filter((source) => source === "memory" || source === "sessions").toSorted();
|
|
948
|
+
return normalized.length > 0 ? normalized : ["memory"];
|
|
949
|
+
}
|
|
950
|
+
function normalizeMetaSources(meta) {
|
|
951
|
+
if (!Array.isArray(meta.sources)) return ["memory"];
|
|
952
|
+
const normalized = Array.from(new Set(meta.sources.filter((source) => source === "memory" || source === "sessions"))).toSorted();
|
|
953
|
+
return normalized.length > 0 ? normalized : ["memory"];
|
|
954
|
+
}
|
|
955
|
+
function configuredMetaSourcesDiffer(params) {
|
|
956
|
+
const metaSources = normalizeMetaSources(params.meta);
|
|
957
|
+
if (metaSources.length !== params.configuredSources.length) return true;
|
|
958
|
+
return metaSources.some((source, index) => source !== params.configuredSources[index]);
|
|
959
|
+
}
|
|
960
|
+
function resolveConfiguredScopeHash(params) {
|
|
961
|
+
const extraPaths = normalizeExtraMemoryPaths(params.workspaceDir, params.extraPaths).map((value) => value.replace(/\\/g, "/")).toSorted();
|
|
962
|
+
return hashText(JSON.stringify({
|
|
963
|
+
extraPaths,
|
|
964
|
+
multimodal: {
|
|
965
|
+
enabled: params.multimodal.enabled,
|
|
966
|
+
modalities: [...params.multimodal.modalities].toSorted(),
|
|
967
|
+
maxFileBytes: params.multimodal.maxFileBytes
|
|
968
|
+
}
|
|
969
|
+
}));
|
|
970
|
+
}
|
|
971
|
+
function shouldRunFullMemoryReindex(params) {
|
|
972
|
+
const { meta } = params;
|
|
973
|
+
return !meta || (params.provider ? meta.model !== params.provider.model : meta.model !== "fts-only") || (params.provider ? meta.provider !== params.provider.id : meta.provider !== "none") || meta.providerKey !== params.providerKey || configuredMetaSourcesDiffer({
|
|
974
|
+
meta,
|
|
975
|
+
configuredSources: params.configuredSources
|
|
976
|
+
}) || meta.scopeHash !== params.configuredScopeHash || meta.chunkTokens !== params.chunkTokens || meta.chunkOverlap !== params.chunkOverlap || params.vectorReady && !meta.vectorDims || (meta.ftsTokenizer ?? "unicode61") !== params.ftsTokenizer;
|
|
977
|
+
}
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region extensions/memory-core/src/memory/manager-session-reindex.ts
|
|
980
|
+
function shouldSyncSessionsForReindex(params) {
|
|
981
|
+
if (!params.hasSessionSource) return false;
|
|
982
|
+
if (params.sync?.sessionFiles?.some((sessionFile) => sessionFile.trim().length > 0)) return true;
|
|
983
|
+
if (params.sync?.force) return true;
|
|
984
|
+
if (params.needsFullReindex) return true;
|
|
985
|
+
const reason = params.sync?.reason;
|
|
986
|
+
if (reason === "session-start" || reason === "watch") return false;
|
|
987
|
+
return params.sessionsDirty && params.dirtySessionFileCount > 0;
|
|
988
|
+
}
|
|
989
|
+
//#endregion
|
|
990
|
+
//#region extensions/memory-core/src/memory/manager-session-sync-state.ts
|
|
991
|
+
function resolveMemorySessionSyncPlan(params) {
|
|
992
|
+
const activePaths = params.targetSessionFiles ? null : new Set(params.files.map((file) => params.sessionPathForFile(file)));
|
|
993
|
+
const existingRows = activePaths === null ? null : params.existingRows ?? [];
|
|
994
|
+
return {
|
|
995
|
+
activePaths,
|
|
996
|
+
existingRows,
|
|
997
|
+
existingHashes: existingRows ? new Map(existingRows.map((row) => [row.path, row.hash])) : null,
|
|
998
|
+
indexAll: params.needsFullReindex || Boolean(params.targetSessionFiles) || params.sessionsDirtyFiles.size === 0
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region extensions/memory-core/src/memory/manager-source-state.ts
|
|
1003
|
+
const MEMORY_SOURCE_FILE_STATE_SQL = `SELECT path, hash FROM files WHERE source = ?`;
|
|
1004
|
+
const MEMORY_SOURCE_FILE_HASH_SQL = `SELECT hash FROM files WHERE path = ? AND source = ?`;
|
|
1005
|
+
function loadMemorySourceFileState(params) {
|
|
1006
|
+
const normalizedRows = params.db.prepare(MEMORY_SOURCE_FILE_STATE_SQL).all(params.source) ?? [];
|
|
1007
|
+
return {
|
|
1008
|
+
rows: normalizedRows,
|
|
1009
|
+
hashes: new Map(normalizedRows.map((row) => [row.path, row.hash]))
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
function resolveMemorySourceExistingHash(params) {
|
|
1013
|
+
if (params.existingHashes) return params.existingHashes.get(params.path);
|
|
1014
|
+
return params.db.prepare(MEMORY_SOURCE_FILE_HASH_SQL).get(params.path, params.source)?.hash;
|
|
1015
|
+
}
|
|
1016
|
+
//#endregion
|
|
1017
|
+
//#region extensions/memory-core/src/memory/manager-targeted-sync.ts
|
|
1018
|
+
function clearMemorySyncedSessionFiles(params) {
|
|
1019
|
+
if (!params.targetSessionFiles) params.sessionsDirtyFiles.clear();
|
|
1020
|
+
else for (const targetSessionFile of params.targetSessionFiles) params.sessionsDirtyFiles.delete(targetSessionFile);
|
|
1021
|
+
return params.sessionsDirtyFiles.size > 0;
|
|
1022
|
+
}
|
|
1023
|
+
async function runMemoryTargetedSessionSync(params) {
|
|
1024
|
+
if (!params.hasSessionSource || !params.targetSessionFiles) return {
|
|
1025
|
+
handled: false,
|
|
1026
|
+
sessionsDirty: params.sessionsDirtyFiles.size > 0
|
|
1027
|
+
};
|
|
1028
|
+
try {
|
|
1029
|
+
await params.syncSessionFiles({
|
|
1030
|
+
needsFullReindex: false,
|
|
1031
|
+
targetSessionFiles: Array.from(params.targetSessionFiles),
|
|
1032
|
+
progress: params.progress
|
|
1033
|
+
});
|
|
1034
|
+
return {
|
|
1035
|
+
handled: true,
|
|
1036
|
+
sessionsDirty: clearMemorySyncedSessionFiles({
|
|
1037
|
+
sessionsDirtyFiles: params.sessionsDirtyFiles,
|
|
1038
|
+
targetSessionFiles: params.targetSessionFiles
|
|
1039
|
+
})
|
|
1040
|
+
};
|
|
1041
|
+
} catch (err) {
|
|
1042
|
+
const reason = formatErrorMessage(err);
|
|
1043
|
+
if (!(params.shouldFallbackOnError(reason) && await params.activateFallbackProvider(reason))) throw err;
|
|
1044
|
+
const reindexParams = {
|
|
1045
|
+
reason: params.reason,
|
|
1046
|
+
force: true,
|
|
1047
|
+
progress: params.progress
|
|
1048
|
+
};
|
|
1049
|
+
if (params.useUnsafeReindex) await params.runUnsafeReindex(reindexParams);
|
|
1050
|
+
else await params.runSafeReindex(reindexParams);
|
|
1051
|
+
return {
|
|
1052
|
+
handled: true,
|
|
1053
|
+
sessionsDirty: params.sessionsDirtyFiles.size > 0
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
//#endregion
|
|
1058
|
+
//#region extensions/memory-core/src/memory/manager-sync-ops.ts
|
|
1059
|
+
const META_KEY = "memory_index_meta_v1";
|
|
1060
|
+
const VECTOR_TABLE$2 = "chunks_vec";
|
|
1061
|
+
const FTS_TABLE$2 = "chunks_fts";
|
|
1062
|
+
const EMBEDDING_CACHE_TABLE$2 = "embedding_cache";
|
|
1063
|
+
const SESSION_DIRTY_DEBOUNCE_MS = 5e3;
|
|
1064
|
+
const SESSION_DELTA_READ_CHUNK_BYTES = 64 * 1024;
|
|
1065
|
+
const VECTOR_LOAD_TIMEOUT_MS = 3e4;
|
|
1066
|
+
const IGNORED_MEMORY_WATCH_DIR_NAMES = new Set([
|
|
1067
|
+
".git",
|
|
1068
|
+
"node_modules",
|
|
1069
|
+
".pnpm-store",
|
|
1070
|
+
".venv",
|
|
1071
|
+
"venv",
|
|
1072
|
+
".tox",
|
|
1073
|
+
"__pycache__"
|
|
1074
|
+
]);
|
|
1075
|
+
const log$3 = createSubsystemLogger("memory");
|
|
1076
|
+
function shouldIgnoreMemoryWatchPath(watchPath, stats, multimodalSettings) {
|
|
1077
|
+
const normalized = path.normalize(watchPath);
|
|
1078
|
+
if (normalized.split(path.sep).map((segment) => normalizeLowercaseStringOrEmpty(segment)).some((segment) => IGNORED_MEMORY_WATCH_DIR_NAMES.has(segment))) return true;
|
|
1079
|
+
if (stats?.isDirectory?.()) return false;
|
|
1080
|
+
const extension = normalizeLowercaseStringOrEmpty(path.extname(normalized));
|
|
1081
|
+
if (extension.length === 0 || extension === ".md") return false;
|
|
1082
|
+
if (!multimodalSettings) return true;
|
|
1083
|
+
return classifyMemoryMultimodalPath(normalized, multimodalSettings) === null;
|
|
1084
|
+
}
|
|
1085
|
+
function runDetachedMemorySync(sync, reason) {
|
|
1086
|
+
sync().catch((err) => {
|
|
1087
|
+
log$3.warn(`memory sync failed (${reason}): ${String(err)}`);
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
var MemoryManagerSyncOps = class {
|
|
1091
|
+
constructor() {
|
|
1092
|
+
this.provider = null;
|
|
1093
|
+
this.sources = /* @__PURE__ */ new Set();
|
|
1094
|
+
this.providerKey = null;
|
|
1095
|
+
this.fts = {
|
|
1096
|
+
enabled: false,
|
|
1097
|
+
available: false
|
|
1098
|
+
};
|
|
1099
|
+
this.vectorReady = null;
|
|
1100
|
+
this.watcher = null;
|
|
1101
|
+
this.watchTimer = null;
|
|
1102
|
+
this.sessionWatchTimer = null;
|
|
1103
|
+
this.sessionUnsubscribe = null;
|
|
1104
|
+
this.intervalTimer = null;
|
|
1105
|
+
this.closed = false;
|
|
1106
|
+
this.dirty = false;
|
|
1107
|
+
this.sessionsDirty = false;
|
|
1108
|
+
this.sessionsDirtyFiles = /* @__PURE__ */ new Set();
|
|
1109
|
+
this.sessionPendingFiles = /* @__PURE__ */ new Set();
|
|
1110
|
+
this.sessionDeltas = /* @__PURE__ */ new Map();
|
|
1111
|
+
this.lastMetaSerialized = null;
|
|
1112
|
+
}
|
|
1113
|
+
async ensureVectorReady(dimensions) {
|
|
1114
|
+
if (!this.vector.enabled) return false;
|
|
1115
|
+
if (!this.vectorReady) this.vectorReady = this.withTimeout(this.loadVectorExtension(), VECTOR_LOAD_TIMEOUT_MS, `sqlite-vec load timed out after ${Math.round(VECTOR_LOAD_TIMEOUT_MS / 1e3)}s`);
|
|
1116
|
+
let ready = false;
|
|
1117
|
+
try {
|
|
1118
|
+
ready = await this.vectorReady || false;
|
|
1119
|
+
} catch (err) {
|
|
1120
|
+
const message = formatErrorMessage(err);
|
|
1121
|
+
this.vector.available = false;
|
|
1122
|
+
this.vector.loadError = message;
|
|
1123
|
+
this.vectorReady = null;
|
|
1124
|
+
log$3.warn(`sqlite-vec unavailable: ${message}`);
|
|
1125
|
+
return false;
|
|
1126
|
+
}
|
|
1127
|
+
if (ready && typeof dimensions === "number" && dimensions > 0) this.ensureVectorTable(dimensions);
|
|
1128
|
+
return ready;
|
|
1129
|
+
}
|
|
1130
|
+
async loadVectorExtension() {
|
|
1131
|
+
if (this.vector.available !== null) return this.vector.available;
|
|
1132
|
+
if (!this.vector.enabled) {
|
|
1133
|
+
this.vector.available = false;
|
|
1134
|
+
return false;
|
|
1135
|
+
}
|
|
1136
|
+
try {
|
|
1137
|
+
const resolvedPath = this.vector.extensionPath?.trim() ? resolveUserPath(this.vector.extensionPath) : void 0;
|
|
1138
|
+
const loaded = await loadSqliteVecExtension({
|
|
1139
|
+
db: this.db,
|
|
1140
|
+
extensionPath: resolvedPath
|
|
1141
|
+
});
|
|
1142
|
+
if (!loaded.ok) throw new Error(loaded.error ?? "unknown sqlite-vec load error");
|
|
1143
|
+
this.vector.extensionPath = loaded.extensionPath;
|
|
1144
|
+
this.vector.available = true;
|
|
1145
|
+
return true;
|
|
1146
|
+
} catch (err) {
|
|
1147
|
+
const message = formatErrorMessage(err);
|
|
1148
|
+
this.vector.available = false;
|
|
1149
|
+
this.vector.loadError = message;
|
|
1150
|
+
log$3.warn(`sqlite-vec unavailable: ${message}`);
|
|
1151
|
+
return false;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
ensureVectorTable(dimensions) {
|
|
1155
|
+
if (this.vector.dims === dimensions) return;
|
|
1156
|
+
if (this.vector.dims && this.vector.dims !== dimensions) this.dropVectorTable();
|
|
1157
|
+
this.db.exec(`CREATE VIRTUAL TABLE IF NOT EXISTS ${VECTOR_TABLE$2} USING vec0(\n id TEXT PRIMARY KEY,\n embedding FLOAT[${dimensions}]\n)`);
|
|
1158
|
+
this.vector.dims = dimensions;
|
|
1159
|
+
}
|
|
1160
|
+
dropVectorTable() {
|
|
1161
|
+
try {
|
|
1162
|
+
this.db.exec(`DROP TABLE IF EXISTS ${VECTOR_TABLE$2}`);
|
|
1163
|
+
} catch (err) {
|
|
1164
|
+
const message = formatErrorMessage(err);
|
|
1165
|
+
log$3.debug(`Failed to drop ${VECTOR_TABLE$2}: ${message}`);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
buildSourceFilter(alias) {
|
|
1169
|
+
const sources = Array.from(this.sources);
|
|
1170
|
+
if (sources.length === 0) return {
|
|
1171
|
+
sql: "",
|
|
1172
|
+
params: []
|
|
1173
|
+
};
|
|
1174
|
+
return {
|
|
1175
|
+
sql: ` AND ${alias ? `${alias}.source` : "source"} IN (${sources.map(() => "?").join(", ")})`,
|
|
1176
|
+
params: sources
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
openDatabase() {
|
|
1180
|
+
return openMemoryDatabaseAtPath(resolveUserPath(this.settings.store.path), this.settings.store.vector.enabled);
|
|
1181
|
+
}
|
|
1182
|
+
seedEmbeddingCache(sourceDb) {
|
|
1183
|
+
if (!this.cache.enabled) return;
|
|
1184
|
+
try {
|
|
1185
|
+
const rows = sourceDb.prepare(`SELECT provider, model, provider_key, hash, embedding, dims, updated_at FROM ${EMBEDDING_CACHE_TABLE$2}`).all();
|
|
1186
|
+
if (!rows.length) return;
|
|
1187
|
+
const insert = this.db.prepare(`INSERT INTO ${EMBEDDING_CACHE_TABLE$2} (provider, model, provider_key, hash, embedding, dims, updated_at)
|
|
1188
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
1189
|
+
ON CONFLICT(provider, model, provider_key, hash) DO UPDATE SET
|
|
1190
|
+
embedding=excluded.embedding,
|
|
1191
|
+
dims=excluded.dims,
|
|
1192
|
+
updated_at=excluded.updated_at`);
|
|
1193
|
+
this.db.exec("BEGIN");
|
|
1194
|
+
for (const row of rows) insert.run(row.provider, row.model, row.provider_key, row.hash, row.embedding, row.dims, row.updated_at);
|
|
1195
|
+
this.db.exec("COMMIT");
|
|
1196
|
+
} catch (err) {
|
|
1197
|
+
try {
|
|
1198
|
+
this.db.exec("ROLLBACK");
|
|
1199
|
+
} catch {}
|
|
1200
|
+
throw err;
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
ensureSchema() {
|
|
1204
|
+
const result = ensureMemoryIndexSchema({
|
|
1205
|
+
db: this.db,
|
|
1206
|
+
embeddingCacheTable: EMBEDDING_CACHE_TABLE$2,
|
|
1207
|
+
cacheEnabled: this.cache.enabled,
|
|
1208
|
+
ftsTable: FTS_TABLE$2,
|
|
1209
|
+
ftsEnabled: this.fts.enabled,
|
|
1210
|
+
ftsTokenizer: this.settings.store.fts.tokenizer
|
|
1211
|
+
});
|
|
1212
|
+
this.fts.available = result.ftsAvailable;
|
|
1213
|
+
if (result.ftsError) {
|
|
1214
|
+
this.fts.loadError = result.ftsError;
|
|
1215
|
+
if (this.fts.enabled) log$3.warn(`fts unavailable: ${result.ftsError}`);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
ensureWatcher() {
|
|
1219
|
+
if (!this.sources.has("memory") || !this.settings.sync.watch || this.watcher) return;
|
|
1220
|
+
const watchPaths = new Set([
|
|
1221
|
+
path.join(this.workspaceDir, "MEMORY.md"),
|
|
1222
|
+
path.join(this.workspaceDir, "memory.md"),
|
|
1223
|
+
path.join(this.workspaceDir, "memory")
|
|
1224
|
+
]);
|
|
1225
|
+
const additionalPaths = normalizeExtraMemoryPaths(this.workspaceDir, this.settings.extraPaths);
|
|
1226
|
+
for (const entry of additionalPaths) try {
|
|
1227
|
+
const stat = fs.lstatSync(entry);
|
|
1228
|
+
if (stat.isSymbolicLink()) continue;
|
|
1229
|
+
if (stat.isDirectory()) {
|
|
1230
|
+
watchPaths.add(path.join(entry, "**", "*.md"));
|
|
1231
|
+
if (this.settings.multimodal.enabled) for (const modality of this.settings.multimodal.modalities) for (const extension of getMemoryMultimodalExtensions(modality)) watchPaths.add(path.join(entry, "**", buildCaseInsensitiveExtensionGlob(extension)));
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
if (stat.isFile() && (normalizeLowercaseStringOrEmpty(entry).endsWith(".md") || classifyMemoryMultimodalPath(entry, this.settings.multimodal) !== null)) watchPaths.add(entry);
|
|
1235
|
+
} catch {}
|
|
1236
|
+
this.watcher = chokidar.watch(Array.from(watchPaths), {
|
|
1237
|
+
ignoreInitial: true,
|
|
1238
|
+
ignored: (watchPath, stats) => shouldIgnoreMemoryWatchPath(watchPath, stats, this.settings.multimodal),
|
|
1239
|
+
awaitWriteFinish: {
|
|
1240
|
+
stabilityThreshold: this.settings.sync.watchDebounceMs,
|
|
1241
|
+
pollInterval: 100
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
const markDirty = () => {
|
|
1245
|
+
this.dirty = true;
|
|
1246
|
+
this.scheduleWatchSync();
|
|
1247
|
+
};
|
|
1248
|
+
this.watcher.on("add", markDirty);
|
|
1249
|
+
this.watcher.on("change", markDirty);
|
|
1250
|
+
this.watcher.on("unlink", markDirty);
|
|
1251
|
+
}
|
|
1252
|
+
ensureSessionListener() {
|
|
1253
|
+
if (!this.sources.has("sessions") || this.sessionUnsubscribe) return;
|
|
1254
|
+
this.sessionUnsubscribe = onSessionTranscriptUpdate((update) => {
|
|
1255
|
+
if (this.closed) return;
|
|
1256
|
+
const sessionFile = update.sessionFile;
|
|
1257
|
+
if (!this.isSessionFileForAgent(sessionFile)) return;
|
|
1258
|
+
this.scheduleSessionDirty(sessionFile);
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
scheduleSessionDirty(sessionFile) {
|
|
1262
|
+
this.sessionPendingFiles.add(sessionFile);
|
|
1263
|
+
if (this.sessionWatchTimer) return;
|
|
1264
|
+
this.sessionWatchTimer = setTimeout(() => {
|
|
1265
|
+
this.sessionWatchTimer = null;
|
|
1266
|
+
this.processSessionDeltaBatch().catch((err) => {
|
|
1267
|
+
log$3.warn(`memory session delta failed: ${String(err)}`);
|
|
1268
|
+
});
|
|
1269
|
+
}, SESSION_DIRTY_DEBOUNCE_MS);
|
|
1270
|
+
}
|
|
1271
|
+
async processSessionDeltaBatch() {
|
|
1272
|
+
if (this.sessionPendingFiles.size === 0) return;
|
|
1273
|
+
const pending = Array.from(this.sessionPendingFiles);
|
|
1274
|
+
this.sessionPendingFiles.clear();
|
|
1275
|
+
let shouldSync = false;
|
|
1276
|
+
for (const sessionFile of pending) {
|
|
1277
|
+
const delta = await this.updateSessionDelta(sessionFile);
|
|
1278
|
+
if (!delta) continue;
|
|
1279
|
+
const bytesThreshold = delta.deltaBytes;
|
|
1280
|
+
const messagesThreshold = delta.deltaMessages;
|
|
1281
|
+
const bytesHit = bytesThreshold <= 0 ? delta.pendingBytes > 0 : delta.pendingBytes >= bytesThreshold;
|
|
1282
|
+
const messagesHit = messagesThreshold <= 0 ? delta.pendingMessages > 0 : delta.pendingMessages >= messagesThreshold;
|
|
1283
|
+
if (!bytesHit && !messagesHit) continue;
|
|
1284
|
+
this.sessionsDirtyFiles.add(sessionFile);
|
|
1285
|
+
this.sessionsDirty = true;
|
|
1286
|
+
delta.pendingBytes = bytesThreshold > 0 ? Math.max(0, delta.pendingBytes - bytesThreshold) : 0;
|
|
1287
|
+
delta.pendingMessages = messagesThreshold > 0 ? Math.max(0, delta.pendingMessages - messagesThreshold) : 0;
|
|
1288
|
+
shouldSync = true;
|
|
1289
|
+
}
|
|
1290
|
+
if (shouldSync) this.sync({ reason: "session-delta" }).catch((err) => {
|
|
1291
|
+
log$3.warn(`memory sync failed (session-delta): ${String(err)}`);
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
async updateSessionDelta(sessionFile) {
|
|
1295
|
+
const thresholds = this.settings.sync.sessions;
|
|
1296
|
+
if (!thresholds) return null;
|
|
1297
|
+
let stat;
|
|
1298
|
+
try {
|
|
1299
|
+
stat = await fs$1.stat(sessionFile);
|
|
1300
|
+
} catch {
|
|
1301
|
+
return null;
|
|
1302
|
+
}
|
|
1303
|
+
const size = stat.size;
|
|
1304
|
+
let state = this.sessionDeltas.get(sessionFile);
|
|
1305
|
+
if (!state) {
|
|
1306
|
+
state = {
|
|
1307
|
+
lastSize: 0,
|
|
1308
|
+
pendingBytes: 0,
|
|
1309
|
+
pendingMessages: 0
|
|
1310
|
+
};
|
|
1311
|
+
this.sessionDeltas.set(sessionFile, state);
|
|
1312
|
+
}
|
|
1313
|
+
const deltaBytes = Math.max(0, size - state.lastSize);
|
|
1314
|
+
if (deltaBytes === 0 && size === state.lastSize) return {
|
|
1315
|
+
deltaBytes: thresholds.deltaBytes,
|
|
1316
|
+
deltaMessages: thresholds.deltaMessages,
|
|
1317
|
+
pendingBytes: state.pendingBytes,
|
|
1318
|
+
pendingMessages: state.pendingMessages
|
|
1319
|
+
};
|
|
1320
|
+
if (size < state.lastSize) {
|
|
1321
|
+
state.lastSize = size;
|
|
1322
|
+
state.pendingBytes += size;
|
|
1323
|
+
if (thresholds.deltaMessages > 0 && (thresholds.deltaBytes <= 0 || state.pendingBytes < thresholds.deltaBytes)) state.pendingMessages += await this.countNewlines(sessionFile, 0, size);
|
|
1324
|
+
} else {
|
|
1325
|
+
state.pendingBytes += deltaBytes;
|
|
1326
|
+
if (thresholds.deltaMessages > 0 && (thresholds.deltaBytes <= 0 || state.pendingBytes < thresholds.deltaBytes)) state.pendingMessages += await this.countNewlines(sessionFile, state.lastSize, size);
|
|
1327
|
+
state.lastSize = size;
|
|
1328
|
+
}
|
|
1329
|
+
this.sessionDeltas.set(sessionFile, state);
|
|
1330
|
+
return {
|
|
1331
|
+
deltaBytes: thresholds.deltaBytes,
|
|
1332
|
+
deltaMessages: thresholds.deltaMessages,
|
|
1333
|
+
pendingBytes: state.pendingBytes,
|
|
1334
|
+
pendingMessages: state.pendingMessages
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
async countNewlines(absPath, start, end) {
|
|
1338
|
+
if (end <= start) return 0;
|
|
1339
|
+
let handle;
|
|
1340
|
+
try {
|
|
1341
|
+
handle = await fs$1.open(absPath, "r");
|
|
1342
|
+
} catch (err) {
|
|
1343
|
+
if (isFileMissingError(err)) return 0;
|
|
1344
|
+
throw err;
|
|
1345
|
+
}
|
|
1346
|
+
try {
|
|
1347
|
+
let offset = start;
|
|
1348
|
+
let count = 0;
|
|
1349
|
+
const buffer = Buffer.alloc(SESSION_DELTA_READ_CHUNK_BYTES);
|
|
1350
|
+
while (offset < end) {
|
|
1351
|
+
const toRead = Math.min(buffer.length, end - offset);
|
|
1352
|
+
const { bytesRead } = await handle.read(buffer, 0, toRead, offset);
|
|
1353
|
+
if (bytesRead <= 0) break;
|
|
1354
|
+
for (let i = 0; i < bytesRead; i += 1) if (buffer[i] === 10) count += 1;
|
|
1355
|
+
offset += bytesRead;
|
|
1356
|
+
}
|
|
1357
|
+
return count;
|
|
1358
|
+
} finally {
|
|
1359
|
+
await handle.close();
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
resetSessionDelta(absPath, size) {
|
|
1363
|
+
const state = this.sessionDeltas.get(absPath);
|
|
1364
|
+
if (!state) return;
|
|
1365
|
+
state.lastSize = size;
|
|
1366
|
+
state.pendingBytes = 0;
|
|
1367
|
+
state.pendingMessages = 0;
|
|
1368
|
+
}
|
|
1369
|
+
isSessionFileForAgent(sessionFile) {
|
|
1370
|
+
if (!sessionFile) return false;
|
|
1371
|
+
const sessionsDir = resolveSessionTranscriptsDirForAgent(this.agentId);
|
|
1372
|
+
const resolvedFile = path.resolve(sessionFile);
|
|
1373
|
+
const resolvedDir = path.resolve(sessionsDir);
|
|
1374
|
+
return resolvedFile.startsWith(`${resolvedDir}${path.sep}`);
|
|
1375
|
+
}
|
|
1376
|
+
normalizeTargetSessionFiles(sessionFiles) {
|
|
1377
|
+
if (!sessionFiles || sessionFiles.length === 0) return null;
|
|
1378
|
+
const normalized = /* @__PURE__ */ new Set();
|
|
1379
|
+
for (const sessionFile of sessionFiles) {
|
|
1380
|
+
const trimmed = sessionFile.trim();
|
|
1381
|
+
if (!trimmed) continue;
|
|
1382
|
+
const resolved = path.resolve(trimmed);
|
|
1383
|
+
if (this.isSessionFileForAgent(resolved)) normalized.add(resolved);
|
|
1384
|
+
}
|
|
1385
|
+
return normalized.size > 0 ? normalized : null;
|
|
1386
|
+
}
|
|
1387
|
+
ensureIntervalSync() {
|
|
1388
|
+
const minutes = this.settings.sync.intervalMinutes;
|
|
1389
|
+
if (!minutes || minutes <= 0 || this.intervalTimer) return;
|
|
1390
|
+
const ms = minutes * 60 * 1e3;
|
|
1391
|
+
this.intervalTimer = setInterval(() => {
|
|
1392
|
+
runDetachedMemorySync(() => this.sync({ reason: "interval" }), "interval");
|
|
1393
|
+
}, ms);
|
|
1394
|
+
}
|
|
1395
|
+
scheduleWatchSync() {
|
|
1396
|
+
if (!this.sources.has("memory") || !this.settings.sync.watch) return;
|
|
1397
|
+
if (this.watchTimer) clearTimeout(this.watchTimer);
|
|
1398
|
+
this.watchTimer = setTimeout(() => {
|
|
1399
|
+
this.watchTimer = null;
|
|
1400
|
+
runDetachedMemorySync(() => this.sync({ reason: "watch" }), "watch");
|
|
1401
|
+
}, this.settings.sync.watchDebounceMs);
|
|
1402
|
+
}
|
|
1403
|
+
shouldSyncSessions(params, needsFullReindex = false) {
|
|
1404
|
+
return shouldSyncSessionsForReindex({
|
|
1405
|
+
hasSessionSource: this.sources.has("sessions"),
|
|
1406
|
+
sessionsDirty: this.sessionsDirty,
|
|
1407
|
+
dirtySessionFileCount: this.sessionsDirtyFiles.size,
|
|
1408
|
+
sync: params,
|
|
1409
|
+
needsFullReindex
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
async syncMemoryFiles(params) {
|
|
1413
|
+
const deleteFileByPathAndSource = this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`);
|
|
1414
|
+
const deleteChunksByPathAndSource = this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`);
|
|
1415
|
+
const deleteVectorRowsByPathAndSource = this.vector.enabled && this.vector.available ? this.db.prepare(`DELETE FROM ${VECTOR_TABLE$2} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`) : null;
|
|
1416
|
+
const deleteFtsRowsByPathAndSource = this.fts.enabled && this.fts.available ? this.db.prepare(`DELETE FROM ${FTS_TABLE$2} WHERE path = ? AND source = ?`) : null;
|
|
1417
|
+
const fileEntries = (await runWithConcurrency((await listMemoryFiles(this.workspaceDir, this.settings.extraPaths, this.settings.multimodal)).map((file) => async () => await buildFileEntry(file, this.workspaceDir, this.settings.multimodal)), this.getIndexConcurrency())).filter((entry) => entry !== null);
|
|
1418
|
+
log$3.debug("memory sync: indexing memory files", {
|
|
1419
|
+
files: fileEntries.length,
|
|
1420
|
+
needsFullReindex: params.needsFullReindex,
|
|
1421
|
+
batch: this.batch.enabled,
|
|
1422
|
+
concurrency: this.getIndexConcurrency()
|
|
1423
|
+
});
|
|
1424
|
+
const existingState = loadMemorySourceFileState({
|
|
1425
|
+
db: this.db,
|
|
1426
|
+
source: "memory"
|
|
1427
|
+
});
|
|
1428
|
+
const existingRows = existingState.rows;
|
|
1429
|
+
const existingHashes = existingState.hashes;
|
|
1430
|
+
const activePaths = new Set(fileEntries.map((entry) => entry.path));
|
|
1431
|
+
if (params.progress) {
|
|
1432
|
+
params.progress.total += fileEntries.length;
|
|
1433
|
+
params.progress.report({
|
|
1434
|
+
completed: params.progress.completed,
|
|
1435
|
+
total: params.progress.total,
|
|
1436
|
+
label: this.batch.enabled ? "Indexing memory files (batch)..." : "Indexing memory files…"
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
await runWithConcurrency(fileEntries.map((entry) => async () => {
|
|
1440
|
+
if (!params.needsFullReindex && existingHashes.get(entry.path) === entry.hash) {
|
|
1441
|
+
if (params.progress) {
|
|
1442
|
+
params.progress.completed += 1;
|
|
1443
|
+
params.progress.report({
|
|
1444
|
+
completed: params.progress.completed,
|
|
1445
|
+
total: params.progress.total
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
await this.indexFile(entry, { source: "memory" });
|
|
1451
|
+
if (params.progress) {
|
|
1452
|
+
params.progress.completed += 1;
|
|
1453
|
+
params.progress.report({
|
|
1454
|
+
completed: params.progress.completed,
|
|
1455
|
+
total: params.progress.total
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
}), this.getIndexConcurrency());
|
|
1459
|
+
for (const stale of existingRows) {
|
|
1460
|
+
if (activePaths.has(stale.path)) continue;
|
|
1461
|
+
deleteFileByPathAndSource.run(stale.path, "memory");
|
|
1462
|
+
if (deleteVectorRowsByPathAndSource) try {
|
|
1463
|
+
deleteVectorRowsByPathAndSource.run(stale.path, "memory");
|
|
1464
|
+
} catch {}
|
|
1465
|
+
deleteChunksByPathAndSource.run(stale.path, "memory");
|
|
1466
|
+
if (deleteFtsRowsByPathAndSource) try {
|
|
1467
|
+
deleteFtsRowsByPathAndSource.run(stale.path, "memory");
|
|
1468
|
+
} catch {}
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
async syncSessionFiles(params) {
|
|
1472
|
+
const deleteFileByPathAndSource = this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`);
|
|
1473
|
+
const deleteChunksByPathAndSource = this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`);
|
|
1474
|
+
const deleteVectorRowsByPathAndSource = this.vector.enabled && this.vector.available ? this.db.prepare(`DELETE FROM ${VECTOR_TABLE$2} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`) : null;
|
|
1475
|
+
const deleteFtsRowsByPathSourceAndModel = this.fts.enabled && this.fts.available ? this.db.prepare(`DELETE FROM ${FTS_TABLE$2} WHERE path = ? AND source = ? AND model = ?`) : null;
|
|
1476
|
+
const targetSessionFiles = params.needsFullReindex ? null : this.normalizeTargetSessionFiles(params.targetSessionFiles);
|
|
1477
|
+
const files = targetSessionFiles ? Array.from(targetSessionFiles) : await listSessionFilesForAgent(this.agentId);
|
|
1478
|
+
const { activePaths, existingRows, existingHashes, indexAll } = resolveMemorySessionSyncPlan({
|
|
1479
|
+
needsFullReindex: params.needsFullReindex,
|
|
1480
|
+
files,
|
|
1481
|
+
targetSessionFiles,
|
|
1482
|
+
sessionsDirtyFiles: this.sessionsDirtyFiles,
|
|
1483
|
+
existingRows: targetSessionFiles ? null : loadMemorySourceFileState({
|
|
1484
|
+
db: this.db,
|
|
1485
|
+
source: "sessions"
|
|
1486
|
+
}).rows,
|
|
1487
|
+
sessionPathForFile
|
|
1488
|
+
});
|
|
1489
|
+
log$3.debug("memory sync: indexing session files", {
|
|
1490
|
+
files: files.length,
|
|
1491
|
+
indexAll,
|
|
1492
|
+
dirtyFiles: this.sessionsDirtyFiles.size,
|
|
1493
|
+
targetedFiles: targetSessionFiles?.size ?? 0,
|
|
1494
|
+
batch: this.batch.enabled,
|
|
1495
|
+
concurrency: this.getIndexConcurrency()
|
|
1496
|
+
});
|
|
1497
|
+
if (params.progress) {
|
|
1498
|
+
params.progress.total += files.length;
|
|
1499
|
+
params.progress.report({
|
|
1500
|
+
completed: params.progress.completed,
|
|
1501
|
+
total: params.progress.total,
|
|
1502
|
+
label: this.batch.enabled ? "Indexing session files (batch)..." : "Indexing session files…"
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
await runWithConcurrency(files.map((absPath) => async () => {
|
|
1506
|
+
if (!indexAll && !this.sessionsDirtyFiles.has(absPath)) {
|
|
1507
|
+
if (params.progress) {
|
|
1508
|
+
params.progress.completed += 1;
|
|
1509
|
+
params.progress.report({
|
|
1510
|
+
completed: params.progress.completed,
|
|
1511
|
+
total: params.progress.total
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
const entry = await buildSessionEntry(absPath);
|
|
1517
|
+
if (!entry) {
|
|
1518
|
+
if (params.progress) {
|
|
1519
|
+
params.progress.completed += 1;
|
|
1520
|
+
params.progress.report({
|
|
1521
|
+
completed: params.progress.completed,
|
|
1522
|
+
total: params.progress.total
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
const existingHash = resolveMemorySourceExistingHash({
|
|
1528
|
+
db: this.db,
|
|
1529
|
+
source: "sessions",
|
|
1530
|
+
path: entry.path,
|
|
1531
|
+
existingHashes
|
|
1532
|
+
});
|
|
1533
|
+
if (!params.needsFullReindex && existingHash === entry.hash) {
|
|
1534
|
+
if (params.progress) {
|
|
1535
|
+
params.progress.completed += 1;
|
|
1536
|
+
params.progress.report({
|
|
1537
|
+
completed: params.progress.completed,
|
|
1538
|
+
total: params.progress.total
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
this.resetSessionDelta(absPath, entry.size);
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
await this.indexFile(entry, {
|
|
1545
|
+
source: "sessions",
|
|
1546
|
+
content: entry.content
|
|
1547
|
+
});
|
|
1548
|
+
this.resetSessionDelta(absPath, entry.size);
|
|
1549
|
+
if (params.progress) {
|
|
1550
|
+
params.progress.completed += 1;
|
|
1551
|
+
params.progress.report({
|
|
1552
|
+
completed: params.progress.completed,
|
|
1553
|
+
total: params.progress.total
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
}), this.getIndexConcurrency());
|
|
1557
|
+
if (activePaths === null) return;
|
|
1558
|
+
for (const stale of existingRows ?? []) {
|
|
1559
|
+
if (activePaths.has(stale.path)) continue;
|
|
1560
|
+
deleteFileByPathAndSource.run(stale.path, "sessions");
|
|
1561
|
+
if (deleteVectorRowsByPathAndSource) try {
|
|
1562
|
+
deleteVectorRowsByPathAndSource.run(stale.path, "sessions");
|
|
1563
|
+
} catch {}
|
|
1564
|
+
deleteChunksByPathAndSource.run(stale.path, "sessions");
|
|
1565
|
+
if (deleteFtsRowsByPathSourceAndModel) try {
|
|
1566
|
+
deleteFtsRowsByPathSourceAndModel.run(stale.path, "sessions", this.provider?.model ?? "fts-only");
|
|
1567
|
+
} catch {}
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
createSyncProgress(onProgress) {
|
|
1571
|
+
const state = {
|
|
1572
|
+
completed: 0,
|
|
1573
|
+
total: 0,
|
|
1574
|
+
label: void 0,
|
|
1575
|
+
report: (update) => {
|
|
1576
|
+
if (update.label) state.label = update.label;
|
|
1577
|
+
const label = update.total > 0 && state.label ? `${state.label} ${update.completed}/${update.total}` : state.label;
|
|
1578
|
+
onProgress({
|
|
1579
|
+
completed: update.completed,
|
|
1580
|
+
total: update.total,
|
|
1581
|
+
label
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1585
|
+
return state;
|
|
1586
|
+
}
|
|
1587
|
+
async runSync(params) {
|
|
1588
|
+
const progress = params?.progress ? this.createSyncProgress(params.progress) : void 0;
|
|
1589
|
+
if (progress) progress.report({
|
|
1590
|
+
completed: progress.completed,
|
|
1591
|
+
total: progress.total,
|
|
1592
|
+
label: "Loading vector extension…"
|
|
1593
|
+
});
|
|
1594
|
+
const vectorReady = await this.ensureVectorReady();
|
|
1595
|
+
const meta = this.readMeta();
|
|
1596
|
+
const configuredSources = resolveConfiguredSourcesForMeta(this.sources);
|
|
1597
|
+
const configuredScopeHash = resolveConfiguredScopeHash({
|
|
1598
|
+
workspaceDir: this.workspaceDir,
|
|
1599
|
+
extraPaths: this.settings.extraPaths,
|
|
1600
|
+
multimodal: {
|
|
1601
|
+
enabled: this.settings.multimodal.enabled,
|
|
1602
|
+
modalities: this.settings.multimodal.modalities,
|
|
1603
|
+
maxFileBytes: this.settings.multimodal.maxFileBytes
|
|
1604
|
+
}
|
|
1605
|
+
});
|
|
1606
|
+
const targetSessionFiles = this.normalizeTargetSessionFiles(params?.sessionFiles);
|
|
1607
|
+
const hasTargetSessionFiles = targetSessionFiles !== null;
|
|
1608
|
+
const targetedSessionSync = await runMemoryTargetedSessionSync({
|
|
1609
|
+
hasSessionSource: this.sources.has("sessions"),
|
|
1610
|
+
targetSessionFiles,
|
|
1611
|
+
reason: params?.reason,
|
|
1612
|
+
progress: progress ?? void 0,
|
|
1613
|
+
useUnsafeReindex: process.env.OPENCLAW_TEST_FAST === "1" && process.env.OPENCLAW_TEST_MEMORY_UNSAFE_REINDEX === "1",
|
|
1614
|
+
sessionsDirtyFiles: this.sessionsDirtyFiles,
|
|
1615
|
+
syncSessionFiles: async (targetedParams) => {
|
|
1616
|
+
await this.syncSessionFiles(targetedParams);
|
|
1617
|
+
},
|
|
1618
|
+
shouldFallbackOnError: (message) => this.shouldFallbackOnError(message),
|
|
1619
|
+
activateFallbackProvider: async (reason) => await this.activateFallbackProvider(reason),
|
|
1620
|
+
runSafeReindex: async (reindexParams) => {
|
|
1621
|
+
await this.runSafeReindex(reindexParams);
|
|
1622
|
+
},
|
|
1623
|
+
runUnsafeReindex: async (reindexParams) => {
|
|
1624
|
+
await this.runUnsafeReindex(reindexParams);
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
if (targetedSessionSync.handled) {
|
|
1628
|
+
this.sessionsDirty = targetedSessionSync.sessionsDirty;
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
const needsFullReindex = params?.force && !hasTargetSessionFiles || shouldRunFullMemoryReindex({
|
|
1632
|
+
meta,
|
|
1633
|
+
provider: this.provider ? {
|
|
1634
|
+
id: this.provider.id,
|
|
1635
|
+
model: this.provider.model
|
|
1636
|
+
} : null,
|
|
1637
|
+
providerKey: this.providerKey ?? void 0,
|
|
1638
|
+
configuredSources,
|
|
1639
|
+
configuredScopeHash,
|
|
1640
|
+
chunkTokens: this.settings.chunking.tokens,
|
|
1641
|
+
chunkOverlap: this.settings.chunking.overlap,
|
|
1642
|
+
vectorReady,
|
|
1643
|
+
ftsTokenizer: this.settings.store.fts.tokenizer
|
|
1644
|
+
});
|
|
1645
|
+
try {
|
|
1646
|
+
if (needsFullReindex) {
|
|
1647
|
+
if (process.env.OPENCLAW_TEST_FAST === "1" && process.env.OPENCLAW_TEST_MEMORY_UNSAFE_REINDEX === "1") await this.runUnsafeReindex({
|
|
1648
|
+
reason: params?.reason,
|
|
1649
|
+
force: params?.force,
|
|
1650
|
+
progress: progress ?? void 0
|
|
1651
|
+
});
|
|
1652
|
+
else await this.runSafeReindex({
|
|
1653
|
+
reason: params?.reason,
|
|
1654
|
+
force: params?.force,
|
|
1655
|
+
progress: progress ?? void 0
|
|
1656
|
+
});
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
const shouldSyncMemory = this.sources.has("memory") && (!hasTargetSessionFiles && params?.force || needsFullReindex || this.dirty);
|
|
1660
|
+
const shouldSyncSessions = this.shouldSyncSessions(params, needsFullReindex);
|
|
1661
|
+
if (shouldSyncMemory) {
|
|
1662
|
+
await this.syncMemoryFiles({
|
|
1663
|
+
needsFullReindex,
|
|
1664
|
+
progress: progress ?? void 0
|
|
1665
|
+
});
|
|
1666
|
+
this.dirty = false;
|
|
1667
|
+
}
|
|
1668
|
+
if (shouldSyncSessions) {
|
|
1669
|
+
await this.syncSessionFiles({
|
|
1670
|
+
needsFullReindex,
|
|
1671
|
+
targetSessionFiles: targetSessionFiles ? Array.from(targetSessionFiles) : void 0,
|
|
1672
|
+
progress: progress ?? void 0
|
|
1673
|
+
});
|
|
1674
|
+
this.sessionsDirty = false;
|
|
1675
|
+
this.sessionsDirtyFiles.clear();
|
|
1676
|
+
} else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
|
|
1677
|
+
else this.sessionsDirty = false;
|
|
1678
|
+
} catch (err) {
|
|
1679
|
+
const reason = formatErrorMessage(err);
|
|
1680
|
+
if (this.shouldFallbackOnError(reason) && await this.activateFallbackProvider(reason)) {
|
|
1681
|
+
await this.runSafeReindex({
|
|
1682
|
+
reason: params?.reason ?? "fallback",
|
|
1683
|
+
force: true,
|
|
1684
|
+
progress: progress ?? void 0
|
|
1685
|
+
});
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
throw err;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
shouldFallbackOnError(message) {
|
|
1692
|
+
return /embedding|embeddings|batch/i.test(message);
|
|
1693
|
+
}
|
|
1694
|
+
resolveBatchConfig() {
|
|
1695
|
+
const batch = this.settings.remote?.batch;
|
|
1696
|
+
return {
|
|
1697
|
+
enabled: Boolean(batch?.enabled && this.provider && this.providerRuntime?.batchEmbed),
|
|
1698
|
+
wait: batch?.wait ?? true,
|
|
1699
|
+
concurrency: Math.max(1, batch?.concurrency ?? 2),
|
|
1700
|
+
pollIntervalMs: batch?.pollIntervalMs ?? 2e3,
|
|
1701
|
+
timeoutMs: (batch?.timeoutMinutes ?? 60) * 60 * 1e3
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
1704
|
+
async activateFallbackProvider(reason) {
|
|
1705
|
+
const fallbackRequest = resolveMemoryFallbackProviderRequest({
|
|
1706
|
+
cfg: this.cfg,
|
|
1707
|
+
settings: this.settings,
|
|
1708
|
+
currentProviderId: this.provider?.id ?? null
|
|
1709
|
+
});
|
|
1710
|
+
if (!fallbackRequest || !this.provider) return false;
|
|
1711
|
+
if (this.fallbackFrom) return false;
|
|
1712
|
+
const fallbackFrom = this.provider.id;
|
|
1713
|
+
const fallbackResult = await createEmbeddingProvider({
|
|
1714
|
+
config: this.cfg,
|
|
1715
|
+
agentDir: resolveAgentDir(this.cfg, this.agentId),
|
|
1716
|
+
...fallbackRequest
|
|
1717
|
+
});
|
|
1718
|
+
const fallbackState = applyMemoryFallbackProviderState({
|
|
1719
|
+
current: {
|
|
1720
|
+
provider: this.provider,
|
|
1721
|
+
fallbackFrom: this.fallbackFrom,
|
|
1722
|
+
fallbackReason: this.fallbackReason,
|
|
1723
|
+
providerUnavailableReason: void 0,
|
|
1724
|
+
providerRuntime: this.providerRuntime
|
|
1725
|
+
},
|
|
1726
|
+
fallbackFrom,
|
|
1727
|
+
reason,
|
|
1728
|
+
result: fallbackResult
|
|
1729
|
+
});
|
|
1730
|
+
this.fallbackFrom = fallbackState.fallbackFrom;
|
|
1731
|
+
this.fallbackReason = fallbackState.fallbackReason;
|
|
1732
|
+
this.provider = fallbackState.provider;
|
|
1733
|
+
this.providerRuntime = fallbackState.providerRuntime;
|
|
1734
|
+
this.providerKey = this.computeProviderKey();
|
|
1735
|
+
this.batch = this.resolveBatchConfig();
|
|
1736
|
+
log$3.warn(`memory embeddings: switched to fallback provider (${fallbackRequest.provider})`, { reason });
|
|
1737
|
+
return true;
|
|
1738
|
+
}
|
|
1739
|
+
async runSafeReindex(params) {
|
|
1740
|
+
const dbPath = resolveUserPath(this.settings.store.path);
|
|
1741
|
+
const tempDbPath = `${dbPath}.tmp-${randomUUID()}`;
|
|
1742
|
+
const tempDb = openMemoryDatabaseAtPath(tempDbPath, this.settings.store.vector.enabled);
|
|
1743
|
+
const originalDb = this.db;
|
|
1744
|
+
let originalDbClosed = false;
|
|
1745
|
+
const originalState = {
|
|
1746
|
+
ftsAvailable: this.fts.available,
|
|
1747
|
+
ftsError: this.fts.loadError,
|
|
1748
|
+
vectorAvailable: this.vector.available,
|
|
1749
|
+
vectorLoadError: this.vector.loadError,
|
|
1750
|
+
vectorDims: this.vector.dims,
|
|
1751
|
+
vectorReady: this.vectorReady
|
|
1752
|
+
};
|
|
1753
|
+
const restoreOriginalState = () => {
|
|
1754
|
+
if (originalDbClosed) this.db = openMemoryDatabaseAtPath(dbPath, this.settings.store.vector.enabled);
|
|
1755
|
+
else this.db = originalDb;
|
|
1756
|
+
this.fts.available = originalState.ftsAvailable;
|
|
1757
|
+
this.fts.loadError = originalState.ftsError;
|
|
1758
|
+
this.vector.available = originalDbClosed ? null : originalState.vectorAvailable;
|
|
1759
|
+
this.vector.loadError = originalState.vectorLoadError;
|
|
1760
|
+
this.vector.dims = originalState.vectorDims;
|
|
1761
|
+
this.vectorReady = originalDbClosed ? null : originalState.vectorReady;
|
|
1762
|
+
};
|
|
1763
|
+
this.db = tempDb;
|
|
1764
|
+
this.vectorReady = null;
|
|
1765
|
+
this.vector.available = null;
|
|
1766
|
+
this.vector.loadError = void 0;
|
|
1767
|
+
this.vector.dims = void 0;
|
|
1768
|
+
this.fts.available = false;
|
|
1769
|
+
this.fts.loadError = void 0;
|
|
1770
|
+
this.ensureSchema();
|
|
1771
|
+
let nextMeta = null;
|
|
1772
|
+
try {
|
|
1773
|
+
nextMeta = await runMemoryAtomicReindex({
|
|
1774
|
+
targetPath: dbPath,
|
|
1775
|
+
tempPath: tempDbPath,
|
|
1776
|
+
build: async () => {
|
|
1777
|
+
this.seedEmbeddingCache(originalDb);
|
|
1778
|
+
const shouldSyncMemory = this.sources.has("memory");
|
|
1779
|
+
const shouldSyncSessions = this.shouldSyncSessions({
|
|
1780
|
+
reason: params.reason,
|
|
1781
|
+
force: params.force
|
|
1782
|
+
}, true);
|
|
1783
|
+
if (shouldSyncMemory) {
|
|
1784
|
+
await this.syncMemoryFiles({
|
|
1785
|
+
needsFullReindex: true,
|
|
1786
|
+
progress: params.progress
|
|
1787
|
+
});
|
|
1788
|
+
this.dirty = false;
|
|
1789
|
+
}
|
|
1790
|
+
if (shouldSyncSessions) {
|
|
1791
|
+
await this.syncSessionFiles({
|
|
1792
|
+
needsFullReindex: true,
|
|
1793
|
+
progress: params.progress
|
|
1794
|
+
});
|
|
1795
|
+
this.sessionsDirty = false;
|
|
1796
|
+
this.sessionsDirtyFiles.clear();
|
|
1797
|
+
} else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
|
|
1798
|
+
else this.sessionsDirty = false;
|
|
1799
|
+
const meta = {
|
|
1800
|
+
model: this.provider?.model ?? "fts-only",
|
|
1801
|
+
provider: this.provider?.id ?? "none",
|
|
1802
|
+
providerKey: this.providerKey,
|
|
1803
|
+
sources: resolveConfiguredSourcesForMeta(this.sources),
|
|
1804
|
+
scopeHash: resolveConfiguredScopeHash({
|
|
1805
|
+
workspaceDir: this.workspaceDir,
|
|
1806
|
+
extraPaths: this.settings.extraPaths,
|
|
1807
|
+
multimodal: {
|
|
1808
|
+
enabled: this.settings.multimodal.enabled,
|
|
1809
|
+
modalities: this.settings.multimodal.modalities,
|
|
1810
|
+
maxFileBytes: this.settings.multimodal.maxFileBytes
|
|
1811
|
+
}
|
|
1812
|
+
}),
|
|
1813
|
+
chunkTokens: this.settings.chunking.tokens,
|
|
1814
|
+
chunkOverlap: this.settings.chunking.overlap,
|
|
1815
|
+
ftsTokenizer: this.settings.store.fts.tokenizer
|
|
1816
|
+
};
|
|
1817
|
+
if (this.vector.available && this.vector.dims) meta.vectorDims = this.vector.dims;
|
|
1818
|
+
this.writeMeta(meta);
|
|
1819
|
+
this.pruneEmbeddingCacheIfNeeded?.();
|
|
1820
|
+
this.db.close();
|
|
1821
|
+
originalDb.close();
|
|
1822
|
+
originalDbClosed = true;
|
|
1823
|
+
return meta;
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
1826
|
+
this.db = openMemoryDatabaseAtPath(dbPath, this.settings.store.vector.enabled);
|
|
1827
|
+
this.vectorReady = null;
|
|
1828
|
+
this.vector.available = null;
|
|
1829
|
+
this.vector.loadError = void 0;
|
|
1830
|
+
this.ensureSchema();
|
|
1831
|
+
this.vector.dims = nextMeta?.vectorDims;
|
|
1832
|
+
} catch (err) {
|
|
1833
|
+
try {
|
|
1834
|
+
this.db.close();
|
|
1835
|
+
} catch {}
|
|
1836
|
+
restoreOriginalState();
|
|
1837
|
+
throw err;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
async runUnsafeReindex(params) {
|
|
1841
|
+
this.resetIndex();
|
|
1842
|
+
const shouldSyncMemory = this.sources.has("memory");
|
|
1843
|
+
const shouldSyncSessions = this.shouldSyncSessions({
|
|
1844
|
+
reason: params.reason,
|
|
1845
|
+
force: params.force
|
|
1846
|
+
}, true);
|
|
1847
|
+
if (shouldSyncMemory) {
|
|
1848
|
+
await this.syncMemoryFiles({
|
|
1849
|
+
needsFullReindex: true,
|
|
1850
|
+
progress: params.progress
|
|
1851
|
+
});
|
|
1852
|
+
this.dirty = false;
|
|
1853
|
+
}
|
|
1854
|
+
if (shouldSyncSessions) {
|
|
1855
|
+
await this.syncSessionFiles({
|
|
1856
|
+
needsFullReindex: true,
|
|
1857
|
+
progress: params.progress
|
|
1858
|
+
});
|
|
1859
|
+
this.sessionsDirty = false;
|
|
1860
|
+
this.sessionsDirtyFiles.clear();
|
|
1861
|
+
} else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
|
|
1862
|
+
else this.sessionsDirty = false;
|
|
1863
|
+
const nextMeta = {
|
|
1864
|
+
model: this.provider?.model ?? "fts-only",
|
|
1865
|
+
provider: this.provider?.id ?? "none",
|
|
1866
|
+
providerKey: this.providerKey,
|
|
1867
|
+
sources: resolveConfiguredSourcesForMeta(this.sources),
|
|
1868
|
+
scopeHash: resolveConfiguredScopeHash({
|
|
1869
|
+
workspaceDir: this.workspaceDir,
|
|
1870
|
+
extraPaths: this.settings.extraPaths,
|
|
1871
|
+
multimodal: {
|
|
1872
|
+
enabled: this.settings.multimodal.enabled,
|
|
1873
|
+
modalities: this.settings.multimodal.modalities,
|
|
1874
|
+
maxFileBytes: this.settings.multimodal.maxFileBytes
|
|
1875
|
+
}
|
|
1876
|
+
}),
|
|
1877
|
+
chunkTokens: this.settings.chunking.tokens,
|
|
1878
|
+
chunkOverlap: this.settings.chunking.overlap,
|
|
1879
|
+
ftsTokenizer: this.settings.store.fts.tokenizer
|
|
1880
|
+
};
|
|
1881
|
+
if (this.vector.available && this.vector.dims) nextMeta.vectorDims = this.vector.dims;
|
|
1882
|
+
this.writeMeta(nextMeta);
|
|
1883
|
+
this.pruneEmbeddingCacheIfNeeded?.();
|
|
1884
|
+
}
|
|
1885
|
+
resetIndex() {
|
|
1886
|
+
this.db.exec(`DELETE FROM files`);
|
|
1887
|
+
this.db.exec(`DELETE FROM chunks`);
|
|
1888
|
+
if (this.fts.enabled && this.fts.available) try {
|
|
1889
|
+
this.db.exec(`DROP TABLE IF EXISTS ${FTS_TABLE$2}`);
|
|
1890
|
+
} catch {}
|
|
1891
|
+
this.ensureSchema();
|
|
1892
|
+
this.dropVectorTable();
|
|
1893
|
+
this.vector.dims = void 0;
|
|
1894
|
+
this.sessionsDirtyFiles.clear();
|
|
1895
|
+
}
|
|
1896
|
+
readMeta() {
|
|
1897
|
+
const row = this.db.prepare(`SELECT value FROM meta WHERE key = ?`).get(META_KEY);
|
|
1898
|
+
if (!row?.value) {
|
|
1899
|
+
this.lastMetaSerialized = null;
|
|
1900
|
+
return null;
|
|
1901
|
+
}
|
|
1902
|
+
try {
|
|
1903
|
+
const parsed = JSON.parse(row.value);
|
|
1904
|
+
this.lastMetaSerialized = row.value;
|
|
1905
|
+
return parsed;
|
|
1906
|
+
} catch {
|
|
1907
|
+
this.lastMetaSerialized = null;
|
|
1908
|
+
return null;
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
writeMeta(meta) {
|
|
1912
|
+
const value = JSON.stringify(meta);
|
|
1913
|
+
if (this.lastMetaSerialized === value) return;
|
|
1914
|
+
this.db.prepare(`INSERT INTO meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value`).run(META_KEY, value);
|
|
1915
|
+
this.lastMetaSerialized = value;
|
|
1916
|
+
}
|
|
1917
|
+
};
|
|
1918
|
+
//#endregion
|
|
1919
|
+
//#region extensions/memory-core/src/memory/manager-vector-write.ts
|
|
1920
|
+
const vectorToBlob$1 = (embedding) => Buffer.from(new Float32Array(embedding).buffer);
|
|
1921
|
+
function replaceMemoryVectorRow(params) {
|
|
1922
|
+
const tableName = params.tableName ?? "chunks_vec";
|
|
1923
|
+
try {
|
|
1924
|
+
params.db.prepare(`DELETE FROM ${tableName} WHERE id = ?`).run(params.id);
|
|
1925
|
+
} catch {}
|
|
1926
|
+
params.db.prepare(`INSERT INTO ${tableName} (id, embedding) VALUES (?, ?)`).run(params.id, vectorToBlob$1(params.embedding));
|
|
1927
|
+
}
|
|
1928
|
+
//#endregion
|
|
1929
|
+
//#region extensions/memory-core/src/memory/manager-embedding-ops.ts
|
|
1930
|
+
const VECTOR_TABLE$1 = "chunks_vec";
|
|
1931
|
+
const FTS_TABLE$1 = "chunks_fts";
|
|
1932
|
+
const EMBEDDING_CACHE_TABLE$1 = "embedding_cache";
|
|
1933
|
+
const EMBEDDING_BATCH_MAX_TOKENS = 8e3;
|
|
1934
|
+
const EMBEDDING_INDEX_CONCURRENCY = 4;
|
|
1935
|
+
const EMBEDDING_RETRY_MAX_ATTEMPTS = 3;
|
|
1936
|
+
const EMBEDDING_RETRY_BASE_DELAY_MS = 500;
|
|
1937
|
+
const EMBEDDING_RETRY_MAX_DELAY_MS = 8e3;
|
|
1938
|
+
const EMBEDDING_QUERY_TIMEOUT_REMOTE_MS = 6e4;
|
|
1939
|
+
const EMBEDDING_QUERY_TIMEOUT_LOCAL_MS = 5 * 6e4;
|
|
1940
|
+
const EMBEDDING_BATCH_TIMEOUT_REMOTE_MS = 2 * 6e4;
|
|
1941
|
+
const EMBEDDING_BATCH_TIMEOUT_LOCAL_MS = 10 * 6e4;
|
|
1942
|
+
const log$2 = createSubsystemLogger("memory");
|
|
1943
|
+
var MemoryManagerEmbeddingOps = class extends MemoryManagerSyncOps {
|
|
1944
|
+
pruneEmbeddingCacheIfNeeded() {
|
|
1945
|
+
if (!this.cache.enabled) return;
|
|
1946
|
+
const max = this.cache.maxEntries;
|
|
1947
|
+
if (!max || max <= 0) return;
|
|
1948
|
+
const count = this.db.prepare(`SELECT COUNT(*) as c FROM ${EMBEDDING_CACHE_TABLE$1}`).get()?.c ?? 0;
|
|
1949
|
+
if (count <= max) return;
|
|
1950
|
+
const excess = count - max;
|
|
1951
|
+
this.db.prepare(`DELETE FROM ${EMBEDDING_CACHE_TABLE$1}\n WHERE rowid IN (\n SELECT rowid FROM ${EMBEDDING_CACHE_TABLE$1}\n ORDER BY updated_at ASC\n LIMIT ?\n )`).run(excess);
|
|
1952
|
+
}
|
|
1953
|
+
async embedChunksInBatches(chunks) {
|
|
1954
|
+
if (chunks.length === 0) return [];
|
|
1955
|
+
const { embeddings, missing } = this.collectCachedEmbeddings(chunks);
|
|
1956
|
+
if (missing.length === 0) return embeddings;
|
|
1957
|
+
const batches = buildMemoryEmbeddingBatches(missing.map((m) => m.chunk), EMBEDDING_BATCH_MAX_TOKENS);
|
|
1958
|
+
const toCache = [];
|
|
1959
|
+
const provider = this.provider;
|
|
1960
|
+
if (!provider) throw new Error("Cannot embed batch in FTS-only mode (no embedding provider)");
|
|
1961
|
+
let cursor = 0;
|
|
1962
|
+
for (const batch of batches) {
|
|
1963
|
+
const inputs = buildTextEmbeddingInputs(batch);
|
|
1964
|
+
const hasStructuredInputs = inputs.some((input) => hasNonTextEmbeddingParts(input));
|
|
1965
|
+
if (hasStructuredInputs && !provider.embedBatchInputs) throw new Error(`Embedding provider "${provider.id}" does not support multimodal memory inputs.`);
|
|
1966
|
+
const batchEmbeddings = hasStructuredInputs ? await this.embedBatchInputsWithRetry(inputs) : await this.embedBatchWithRetry(batch.map((chunk) => chunk.text));
|
|
1967
|
+
for (let i = 0; i < batch.length; i += 1) {
|
|
1968
|
+
const item = missing[cursor + i];
|
|
1969
|
+
const embedding = batchEmbeddings[i] ?? [];
|
|
1970
|
+
if (item) {
|
|
1971
|
+
embeddings[item.index] = embedding;
|
|
1972
|
+
toCache.push({
|
|
1973
|
+
hash: item.chunk.hash,
|
|
1974
|
+
embedding
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
cursor += batch.length;
|
|
1979
|
+
}
|
|
1980
|
+
upsertMemoryEmbeddingCache({
|
|
1981
|
+
db: this.db,
|
|
1982
|
+
enabled: this.cache.enabled,
|
|
1983
|
+
provider: this.provider,
|
|
1984
|
+
providerKey: this.providerKey,
|
|
1985
|
+
entries: toCache,
|
|
1986
|
+
tableName: EMBEDDING_CACHE_TABLE$1
|
|
1987
|
+
});
|
|
1988
|
+
return embeddings;
|
|
1989
|
+
}
|
|
1990
|
+
computeProviderKey() {
|
|
1991
|
+
if (!this.provider) return hashText(JSON.stringify({
|
|
1992
|
+
provider: "none",
|
|
1993
|
+
model: "fts-only"
|
|
1994
|
+
}));
|
|
1995
|
+
if (this.providerRuntime?.cacheKeyData) return hashText(JSON.stringify(this.providerRuntime.cacheKeyData));
|
|
1996
|
+
return hashText(JSON.stringify({
|
|
1997
|
+
provider: this.provider.id,
|
|
1998
|
+
model: this.provider.model
|
|
1999
|
+
}));
|
|
2000
|
+
}
|
|
2001
|
+
buildBatchDebug(source, chunks) {
|
|
2002
|
+
return (message, data) => log$2.debug(message, data ? {
|
|
2003
|
+
...data,
|
|
2004
|
+
source,
|
|
2005
|
+
chunks: chunks.length
|
|
2006
|
+
} : {
|
|
2007
|
+
source,
|
|
2008
|
+
chunks: chunks.length
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
async embedChunksWithBatch(chunks, _entry, source) {
|
|
2012
|
+
const provider = this.provider;
|
|
2013
|
+
const batchEmbed = this.providerRuntime?.batchEmbed;
|
|
2014
|
+
if (!provider || !batchEmbed) return this.embedChunksInBatches(chunks);
|
|
2015
|
+
if (chunks.length === 0) return [];
|
|
2016
|
+
const { embeddings, missing } = this.collectCachedEmbeddings(chunks);
|
|
2017
|
+
if (missing.length === 0) return embeddings;
|
|
2018
|
+
const missingChunks = missing.map((item) => item.chunk);
|
|
2019
|
+
const batchResult = await this.runBatchWithFallback({
|
|
2020
|
+
provider: provider.id,
|
|
2021
|
+
run: async () => await batchEmbed({
|
|
2022
|
+
agentId: this.agentId,
|
|
2023
|
+
chunks: missingChunks,
|
|
2024
|
+
wait: this.batch.wait,
|
|
2025
|
+
concurrency: this.batch.concurrency,
|
|
2026
|
+
pollIntervalMs: this.batch.pollIntervalMs,
|
|
2027
|
+
timeoutMs: this.batch.timeoutMs,
|
|
2028
|
+
debug: this.buildBatchDebug(source, chunks)
|
|
2029
|
+
}),
|
|
2030
|
+
fallback: async () => await this.embedChunksInBatches(chunks)
|
|
2031
|
+
});
|
|
2032
|
+
if (!batchResult) return this.embedChunksInBatches(chunks);
|
|
2033
|
+
const toCache = [];
|
|
2034
|
+
for (let index = 0; index < missing.length; index += 1) {
|
|
2035
|
+
const item = missing[index];
|
|
2036
|
+
const embedding = batchResult[index] ?? [];
|
|
2037
|
+
if (!item) continue;
|
|
2038
|
+
embeddings[item.index] = embedding;
|
|
2039
|
+
toCache.push({
|
|
2040
|
+
hash: item.chunk.hash,
|
|
2041
|
+
embedding
|
|
2042
|
+
});
|
|
2043
|
+
}
|
|
2044
|
+
upsertMemoryEmbeddingCache({
|
|
2045
|
+
db: this.db,
|
|
2046
|
+
enabled: this.cache.enabled,
|
|
2047
|
+
provider,
|
|
2048
|
+
providerKey: this.providerKey,
|
|
2049
|
+
entries: toCache,
|
|
2050
|
+
tableName: EMBEDDING_CACHE_TABLE$1
|
|
2051
|
+
});
|
|
2052
|
+
return embeddings;
|
|
2053
|
+
}
|
|
2054
|
+
collectCachedEmbeddings(chunks) {
|
|
2055
|
+
return collectMemoryCachedEmbeddings({
|
|
2056
|
+
chunks,
|
|
2057
|
+
cached: loadMemoryEmbeddingCache({
|
|
2058
|
+
db: this.db,
|
|
2059
|
+
enabled: this.cache.enabled,
|
|
2060
|
+
provider: this.provider,
|
|
2061
|
+
providerKey: this.providerKey,
|
|
2062
|
+
hashes: chunks.map((chunk) => chunk.hash),
|
|
2063
|
+
tableName: EMBEDDING_CACHE_TABLE$1
|
|
2064
|
+
})
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
async embedBatchWithRetry(texts) {
|
|
2068
|
+
if (texts.length === 0) return [];
|
|
2069
|
+
const provider = this.provider;
|
|
2070
|
+
if (!provider) throw new Error("Cannot embed batch in FTS-only mode (no embedding provider)");
|
|
2071
|
+
return await runMemoryEmbeddingRetryLoop({
|
|
2072
|
+
run: async () => {
|
|
2073
|
+
const timeoutMs = this.resolveEmbeddingTimeout("batch");
|
|
2074
|
+
log$2.debug("memory embeddings: batch start", {
|
|
2075
|
+
provider: provider.id,
|
|
2076
|
+
items: texts.length,
|
|
2077
|
+
timeoutMs
|
|
2078
|
+
});
|
|
2079
|
+
return await this.withTimeout(provider.embedBatch(texts), timeoutMs, `memory embeddings batch timed out after ${Math.round(timeoutMs / 1e3)}s`);
|
|
2080
|
+
},
|
|
2081
|
+
isRetryable: isRetryableMemoryEmbeddingError,
|
|
2082
|
+
waitForRetry: async (delayMs) => {
|
|
2083
|
+
await this.waitForEmbeddingRetry(delayMs, "retrying");
|
|
2084
|
+
},
|
|
2085
|
+
maxAttempts: EMBEDDING_RETRY_MAX_ATTEMPTS,
|
|
2086
|
+
baseDelayMs: EMBEDDING_RETRY_BASE_DELAY_MS
|
|
2087
|
+
});
|
|
2088
|
+
}
|
|
2089
|
+
async embedBatchInputsWithRetry(inputs) {
|
|
2090
|
+
if (inputs.length === 0) return [];
|
|
2091
|
+
const provider = this.provider;
|
|
2092
|
+
const embedBatchInputs = provider?.embedBatchInputs;
|
|
2093
|
+
if (!embedBatchInputs) return await this.embedBatchWithRetry(inputs.map((input) => input.text));
|
|
2094
|
+
return await runMemoryEmbeddingRetryLoop({
|
|
2095
|
+
run: async () => {
|
|
2096
|
+
const timeoutMs = this.resolveEmbeddingTimeout("batch");
|
|
2097
|
+
log$2.debug("memory embeddings: structured batch start", {
|
|
2098
|
+
provider: provider.id,
|
|
2099
|
+
items: inputs.length,
|
|
2100
|
+
timeoutMs
|
|
2101
|
+
});
|
|
2102
|
+
return await this.withTimeout(embedBatchInputs(inputs), timeoutMs, `memory embeddings batch timed out after ${Math.round(timeoutMs / 1e3)}s`);
|
|
2103
|
+
},
|
|
2104
|
+
isRetryable: isRetryableMemoryEmbeddingError,
|
|
2105
|
+
waitForRetry: async (delayMs) => {
|
|
2106
|
+
await this.waitForEmbeddingRetry(delayMs, "retrying structured batch");
|
|
2107
|
+
},
|
|
2108
|
+
maxAttempts: EMBEDDING_RETRY_MAX_ATTEMPTS,
|
|
2109
|
+
baseDelayMs: EMBEDDING_RETRY_BASE_DELAY_MS
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2112
|
+
async waitForEmbeddingRetry(delayMs, action) {
|
|
2113
|
+
const waitMs = resolveMemoryEmbeddingRetryDelay(delayMs, Math.random(), EMBEDDING_RETRY_MAX_DELAY_MS);
|
|
2114
|
+
log$2.warn(`memory embeddings rate limited; ${action} in ${waitMs}ms`);
|
|
2115
|
+
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
|
2116
|
+
}
|
|
2117
|
+
resolveEmbeddingTimeout(kind) {
|
|
2118
|
+
const isLocal = this.provider?.id === "local";
|
|
2119
|
+
if (kind === "query") return isLocal ? EMBEDDING_QUERY_TIMEOUT_LOCAL_MS : EMBEDDING_QUERY_TIMEOUT_REMOTE_MS;
|
|
2120
|
+
return isLocal ? EMBEDDING_BATCH_TIMEOUT_LOCAL_MS : EMBEDDING_BATCH_TIMEOUT_REMOTE_MS;
|
|
2121
|
+
}
|
|
2122
|
+
async embedQueryWithTimeout(text) {
|
|
2123
|
+
if (!this.provider) throw new Error("Cannot embed query in FTS-only mode (no embedding provider)");
|
|
2124
|
+
const timeoutMs = this.resolveEmbeddingTimeout("query");
|
|
2125
|
+
log$2.debug("memory embeddings: query start", {
|
|
2126
|
+
provider: this.provider.id,
|
|
2127
|
+
timeoutMs
|
|
2128
|
+
});
|
|
2129
|
+
return await this.withTimeout(this.provider.embedQuery(text), timeoutMs, `memory embeddings query timed out after ${Math.round(timeoutMs / 1e3)}s`);
|
|
2130
|
+
}
|
|
2131
|
+
async withTimeout(promise, timeoutMs, message) {
|
|
2132
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) return await promise;
|
|
2133
|
+
let timer = null;
|
|
2134
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
2135
|
+
timer = setTimeout(() => reject(new Error(message)), timeoutMs);
|
|
2136
|
+
});
|
|
2137
|
+
try {
|
|
2138
|
+
return await Promise.race([promise, timeoutPromise]);
|
|
2139
|
+
} finally {
|
|
2140
|
+
if (timer) clearTimeout(timer);
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
async withBatchFailureLock(fn) {
|
|
2144
|
+
let release;
|
|
2145
|
+
const wait = this.batchFailureLock;
|
|
2146
|
+
this.batchFailureLock = new Promise((resolve) => {
|
|
2147
|
+
release = resolve;
|
|
2148
|
+
});
|
|
2149
|
+
await wait;
|
|
2150
|
+
try {
|
|
2151
|
+
return await fn();
|
|
2152
|
+
} finally {
|
|
2153
|
+
release();
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
async resetBatchFailureCount() {
|
|
2157
|
+
await this.withBatchFailureLock(async () => {
|
|
2158
|
+
if (this.batchFailureCount > 0) log$2.debug("memory embeddings: batch recovered; resetting failure count");
|
|
2159
|
+
const nextState = resetMemoryBatchFailureState({
|
|
2160
|
+
enabled: this.batch.enabled,
|
|
2161
|
+
count: this.batchFailureCount,
|
|
2162
|
+
lastError: this.batchFailureLastError,
|
|
2163
|
+
lastProvider: this.batchFailureLastProvider
|
|
2164
|
+
});
|
|
2165
|
+
this.batch.enabled = nextState.enabled;
|
|
2166
|
+
this.batchFailureCount = nextState.count;
|
|
2167
|
+
this.batchFailureLastError = nextState.lastError;
|
|
2168
|
+
this.batchFailureLastProvider = nextState.lastProvider;
|
|
2169
|
+
});
|
|
2170
|
+
}
|
|
2171
|
+
async recordBatchFailure(params) {
|
|
2172
|
+
return await this.withBatchFailureLock(async () => {
|
|
2173
|
+
if (!this.batch.enabled) return {
|
|
2174
|
+
disabled: true,
|
|
2175
|
+
count: this.batchFailureCount
|
|
2176
|
+
};
|
|
2177
|
+
const nextState = recordMemoryBatchFailure({
|
|
2178
|
+
enabled: this.batch.enabled,
|
|
2179
|
+
count: this.batchFailureCount,
|
|
2180
|
+
lastError: this.batchFailureLastError,
|
|
2181
|
+
lastProvider: this.batchFailureLastProvider
|
|
2182
|
+
}, params);
|
|
2183
|
+
this.batch.enabled = nextState.enabled;
|
|
2184
|
+
this.batchFailureCount = nextState.count;
|
|
2185
|
+
this.batchFailureLastError = nextState.lastError;
|
|
2186
|
+
this.batchFailureLastProvider = nextState.lastProvider;
|
|
2187
|
+
return {
|
|
2188
|
+
disabled: !nextState.enabled,
|
|
2189
|
+
count: nextState.count
|
|
2190
|
+
};
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
isBatchTimeoutError(message) {
|
|
2194
|
+
return /timed out|timeout/i.test(message);
|
|
2195
|
+
}
|
|
2196
|
+
async runBatchWithTimeoutRetry(params) {
|
|
2197
|
+
try {
|
|
2198
|
+
return await params.run();
|
|
2199
|
+
} catch (err) {
|
|
2200
|
+
const message = formatErrorMessage(err);
|
|
2201
|
+
if (this.isBatchTimeoutError(message)) {
|
|
2202
|
+
log$2.warn(`memory embeddings: ${params.provider} batch timed out; retrying once`);
|
|
2203
|
+
try {
|
|
2204
|
+
return await params.run();
|
|
2205
|
+
} catch (retryErr) {
|
|
2206
|
+
retryErr.batchAttempts = 2;
|
|
2207
|
+
throw retryErr;
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
throw err;
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
async runBatchWithFallback(params) {
|
|
2214
|
+
if (!this.batch.enabled) return await params.fallback();
|
|
2215
|
+
try {
|
|
2216
|
+
const result = await this.runBatchWithTimeoutRetry({
|
|
2217
|
+
provider: params.provider,
|
|
2218
|
+
run: params.run
|
|
2219
|
+
});
|
|
2220
|
+
await this.resetBatchFailureCount();
|
|
2221
|
+
return result;
|
|
2222
|
+
} catch (err) {
|
|
2223
|
+
const message = formatErrorMessage(err);
|
|
2224
|
+
const attempts = err.batchAttempts ?? 1;
|
|
2225
|
+
const forceDisable = /asyncBatchEmbedContent not available/i.test(message);
|
|
2226
|
+
const failure = await this.recordBatchFailure({
|
|
2227
|
+
provider: params.provider,
|
|
2228
|
+
message,
|
|
2229
|
+
attempts,
|
|
2230
|
+
forceDisable
|
|
2231
|
+
});
|
|
2232
|
+
const suffix = failure.disabled ? "disabling batch" : "keeping batch enabled";
|
|
2233
|
+
log$2.warn(`memory embeddings: ${params.provider} batch failed (${failure.count}/2); ${suffix}; falling back to non-batch embeddings: ${message}`);
|
|
2234
|
+
return await params.fallback();
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
getIndexConcurrency() {
|
|
2238
|
+
return this.batch.enabled ? this.batch.concurrency : EMBEDDING_INDEX_CONCURRENCY;
|
|
2239
|
+
}
|
|
2240
|
+
clearIndexedFileData(pathname, source) {
|
|
2241
|
+
if (this.vector.enabled) try {
|
|
2242
|
+
this.db.prepare(`DELETE FROM ${VECTOR_TABLE$1} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`).run(pathname, source);
|
|
2243
|
+
} catch {}
|
|
2244
|
+
if (this.fts.enabled && this.fts.available) try {
|
|
2245
|
+
deleteMemoryFtsRows({
|
|
2246
|
+
db: this.db,
|
|
2247
|
+
tableName: FTS_TABLE$1,
|
|
2248
|
+
path: pathname,
|
|
2249
|
+
source,
|
|
2250
|
+
currentModel: this.provider?.model
|
|
2251
|
+
});
|
|
2252
|
+
} catch {}
|
|
2253
|
+
this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`).run(pathname, source);
|
|
2254
|
+
}
|
|
2255
|
+
upsertFileRecord(entry, source) {
|
|
2256
|
+
this.db.prepare(`INSERT INTO files (path, source, hash, mtime, size) VALUES (?, ?, ?, ?, ?)
|
|
2257
|
+
ON CONFLICT(path) DO UPDATE SET
|
|
2258
|
+
source=excluded.source,
|
|
2259
|
+
hash=excluded.hash,
|
|
2260
|
+
mtime=excluded.mtime,
|
|
2261
|
+
size=excluded.size`).run(entry.path, source, entry.hash, entry.mtimeMs, entry.size);
|
|
2262
|
+
}
|
|
2263
|
+
deleteFileRecord(pathname, source) {
|
|
2264
|
+
this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`).run(pathname, source);
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* Write chunks (and optional embeddings) for a file into the index.
|
|
2268
|
+
* Handles both the chunks table, the vector table, and the FTS table.
|
|
2269
|
+
* Pass an empty embeddings array to skip vector writes (FTS-only mode).
|
|
2270
|
+
*/
|
|
2271
|
+
writeChunks(entry, source, model, chunks, embeddings, vectorReady) {
|
|
2272
|
+
const now = Date.now();
|
|
2273
|
+
this.clearIndexedFileData(entry.path, source);
|
|
2274
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
2275
|
+
const chunk = chunks[i];
|
|
2276
|
+
const embedding = embeddings[i] ?? [];
|
|
2277
|
+
const id = hashText(`${source}:${entry.path}:${chunk.startLine}:${chunk.endLine}:${chunk.hash}:${model}`);
|
|
2278
|
+
this.db.prepare(`INSERT INTO chunks (id, path, source, start_line, end_line, hash, model, text, embedding, updated_at)
|
|
2279
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
2280
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
2281
|
+
hash=excluded.hash,
|
|
2282
|
+
model=excluded.model,
|
|
2283
|
+
text=excluded.text,
|
|
2284
|
+
embedding=excluded.embedding,
|
|
2285
|
+
updated_at=excluded.updated_at`).run(id, entry.path, source, chunk.startLine, chunk.endLine, chunk.hash, model, chunk.text, JSON.stringify(embedding), now);
|
|
2286
|
+
if (vectorReady && embedding.length > 0) replaceMemoryVectorRow({
|
|
2287
|
+
db: this.db,
|
|
2288
|
+
tableName: VECTOR_TABLE$1,
|
|
2289
|
+
id,
|
|
2290
|
+
embedding
|
|
2291
|
+
});
|
|
2292
|
+
if (this.fts.enabled && this.fts.available) this.db.prepare(`INSERT INTO ${FTS_TABLE$1} (text, id, path, source, model, start_line, end_line)\n VALUES (?, ?, ?, ?, ?, ?, ?)`).run(chunk.text, id, entry.path, source, model, chunk.startLine, chunk.endLine);
|
|
2293
|
+
}
|
|
2294
|
+
if (this.vector.enabled && !vectorReady && chunks.length > 0) {
|
|
2295
|
+
const errDetail = this.vector.loadError ? `: ${this.vector.loadError}` : "";
|
|
2296
|
+
log$2.warn(`chunks written for ${entry.path} without vector embeddings — chunks_vec not updated (sqlite-vec unavailable${errDetail}). Vector recall degraded for this file.`);
|
|
2297
|
+
}
|
|
2298
|
+
this.upsertFileRecord(entry, source);
|
|
2299
|
+
}
|
|
2300
|
+
async indexFile(entry, options) {
|
|
2301
|
+
if (!this.provider) {
|
|
2302
|
+
if ("kind" in entry && entry.kind === "multimodal") return;
|
|
2303
|
+
const chunks = filterNonEmptyMemoryChunks(chunkMarkdown(options.content ?? await fs$1.readFile(entry.absPath, "utf-8"), this.settings.chunking));
|
|
2304
|
+
if (options.source === "sessions" && "lineMap" in entry) remapChunkLines(chunks, entry.lineMap);
|
|
2305
|
+
this.writeChunks(entry, options.source, "fts-only", chunks, [], false);
|
|
2306
|
+
return;
|
|
2307
|
+
}
|
|
2308
|
+
let chunks;
|
|
2309
|
+
let structuredInputBytes;
|
|
2310
|
+
if ("kind" in entry && entry.kind === "multimodal") {
|
|
2311
|
+
if (!this.provider) {
|
|
2312
|
+
log$2.debug("Skipping multimodal indexing in FTS-only mode", {
|
|
2313
|
+
path: entry.path,
|
|
2314
|
+
source: options.source
|
|
2315
|
+
});
|
|
2316
|
+
this.clearIndexedFileData(entry.path, options.source);
|
|
2317
|
+
this.upsertFileRecord(entry, options.source);
|
|
2318
|
+
return;
|
|
2319
|
+
}
|
|
2320
|
+
const multimodalChunk = await buildMultimodalChunkForIndexing(entry);
|
|
2321
|
+
if (!multimodalChunk) {
|
|
2322
|
+
this.clearIndexedFileData(entry.path, options.source);
|
|
2323
|
+
this.deleteFileRecord(entry.path, options.source);
|
|
2324
|
+
return;
|
|
2325
|
+
}
|
|
2326
|
+
structuredInputBytes = multimodalChunk.structuredInputBytes;
|
|
2327
|
+
chunks = [multimodalChunk.chunk];
|
|
2328
|
+
} else {
|
|
2329
|
+
const baseChunks = filterNonEmptyMemoryChunks(chunkMarkdown(options.content ?? await fs$1.readFile(entry.absPath, "utf-8"), this.settings.chunking));
|
|
2330
|
+
chunks = this.provider ? enforceEmbeddingMaxInputTokens(this.provider, baseChunks, EMBEDDING_BATCH_MAX_TOKENS) : baseChunks;
|
|
2331
|
+
if (options.source === "sessions" && "lineMap" in entry) remapChunkLines(chunks, entry.lineMap);
|
|
2332
|
+
}
|
|
2333
|
+
if (!this.provider) {
|
|
2334
|
+
this.writeChunks(entry, options.source, "fts-only", chunks, [], false);
|
|
2335
|
+
return;
|
|
2336
|
+
}
|
|
2337
|
+
let embeddings;
|
|
2338
|
+
try {
|
|
2339
|
+
embeddings = this.batch.enabled ? await this.embedChunksWithBatch(chunks, entry, options.source) : await this.embedChunksInBatches(chunks);
|
|
2340
|
+
} catch (err) {
|
|
2341
|
+
const message = formatErrorMessage(err);
|
|
2342
|
+
if ("kind" in entry && entry.kind === "multimodal" && /(413|payload too large|request too large|input too large|too many tokens|input limit|request size)/i.test(message)) {
|
|
2343
|
+
log$2.warn("memory embeddings: skipping multimodal file rejected as too large", {
|
|
2344
|
+
path: entry.path,
|
|
2345
|
+
bytes: structuredInputBytes,
|
|
2346
|
+
provider: this.provider.id,
|
|
2347
|
+
model: this.provider.model,
|
|
2348
|
+
error: message
|
|
2349
|
+
});
|
|
2350
|
+
this.clearIndexedFileData(entry.path, options.source);
|
|
2351
|
+
this.upsertFileRecord(entry, options.source);
|
|
2352
|
+
return;
|
|
2353
|
+
}
|
|
2354
|
+
throw err;
|
|
2355
|
+
}
|
|
2356
|
+
const sample = embeddings.find((embedding) => embedding.length > 0);
|
|
2357
|
+
const vectorReady = sample ? await this.ensureVectorReady(sample.length) : false;
|
|
2358
|
+
this.writeChunks(entry, options.source, this.provider.model, chunks, embeddings, vectorReady);
|
|
2359
|
+
}
|
|
2360
|
+
};
|
|
2361
|
+
//#endregion
|
|
2362
|
+
//#region extensions/memory-core/src/memory/manager-search-preflight.ts
|
|
2363
|
+
function resolveMemorySearchPreflight(params) {
|
|
2364
|
+
const normalizedQuery = params.query.trim();
|
|
2365
|
+
if (!normalizedQuery) return {
|
|
2366
|
+
normalizedQuery,
|
|
2367
|
+
shouldInitializeProvider: false,
|
|
2368
|
+
shouldSearch: false
|
|
2369
|
+
};
|
|
2370
|
+
if (!params.hasIndexedContent) return {
|
|
2371
|
+
normalizedQuery,
|
|
2372
|
+
shouldInitializeProvider: false,
|
|
2373
|
+
shouldSearch: false
|
|
2374
|
+
};
|
|
2375
|
+
return {
|
|
2376
|
+
normalizedQuery,
|
|
2377
|
+
shouldInitializeProvider: true,
|
|
2378
|
+
shouldSearch: true
|
|
2379
|
+
};
|
|
2380
|
+
}
|
|
2381
|
+
//#endregion
|
|
2382
|
+
//#region extensions/memory-core/src/memory/manager-search.ts
|
|
2383
|
+
const vectorToBlob = (embedding) => Buffer.from(new Float32Array(embedding).buffer);
|
|
2384
|
+
const FTS_QUERY_TOKEN_RE = /[\p{L}\p{N}_]+/gu;
|
|
2385
|
+
const SHORT_CJK_TRIGRAM_RE = /[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af\u3131-\u3163]/u;
|
|
2386
|
+
function normalizeSearchTokens(raw) {
|
|
2387
|
+
return raw.match(FTS_QUERY_TOKEN_RE)?.map((token) => token.trim().toLowerCase()).filter(Boolean) ?? [];
|
|
2388
|
+
}
|
|
2389
|
+
function scoreFallbackKeywordResult(params) {
|
|
2390
|
+
const queryTokens = [...new Set(normalizeSearchTokens(params.query))];
|
|
2391
|
+
if (queryTokens.length === 0) return params.ftsScore;
|
|
2392
|
+
const textTokens = normalizeSearchTokens(params.text);
|
|
2393
|
+
const textTokenSet = new Set(textTokens);
|
|
2394
|
+
const pathLower = params.path.toLowerCase();
|
|
2395
|
+
const overlap = queryTokens.filter((token) => textTokenSet.has(token)).length;
|
|
2396
|
+
const uniqueQueryOverlap = overlap / Math.max(new Set(queryTokens).size, 1);
|
|
2397
|
+
const density = overlap / Math.max(textTokenSet.size, 1);
|
|
2398
|
+
const pathBoost = queryTokens.reduce((score, token) => score + (pathLower.includes(token) ? .18 : 0), 0);
|
|
2399
|
+
const textLengthBoost = Math.min(params.text.length / 160, .18);
|
|
2400
|
+
const lexicalBoost = uniqueQueryOverlap * .45 + density * .2 + pathBoost + textLengthBoost;
|
|
2401
|
+
return Math.min(1, params.ftsScore + lexicalBoost);
|
|
2402
|
+
}
|
|
2403
|
+
function escapeLikePattern(term) {
|
|
2404
|
+
return term.replaceAll("\\", "\\\\").replaceAll("%", "\\%").replaceAll("_", "\\_");
|
|
2405
|
+
}
|
|
2406
|
+
function buildMatchQueryFromTerms(terms) {
|
|
2407
|
+
if (terms.length === 0) return null;
|
|
2408
|
+
return terms.map((term) => `"${term.replaceAll("\"", "")}"`).join(" AND ");
|
|
2409
|
+
}
|
|
2410
|
+
function planKeywordSearch(params) {
|
|
2411
|
+
if (params.ftsTokenizer !== "trigram") return {
|
|
2412
|
+
matchQuery: params.buildFtsQuery(params.query),
|
|
2413
|
+
substringTerms: []
|
|
2414
|
+
};
|
|
2415
|
+
const tokens = params.query.match(FTS_QUERY_TOKEN_RE)?.map((token) => token.trim()).filter(Boolean) ?? [];
|
|
2416
|
+
if (tokens.length === 0) return {
|
|
2417
|
+
matchQuery: null,
|
|
2418
|
+
substringTerms: []
|
|
2419
|
+
};
|
|
2420
|
+
const matchTerms = [];
|
|
2421
|
+
const substringTerms = [];
|
|
2422
|
+
for (const token of tokens) {
|
|
2423
|
+
if (SHORT_CJK_TRIGRAM_RE.test(token) && Array.from(token).length < 3) {
|
|
2424
|
+
substringTerms.push(token);
|
|
2425
|
+
continue;
|
|
2426
|
+
}
|
|
2427
|
+
matchTerms.push(token);
|
|
2428
|
+
}
|
|
2429
|
+
return {
|
|
2430
|
+
matchQuery: buildMatchQueryFromTerms(matchTerms),
|
|
2431
|
+
substringTerms
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
async function searchVector(params) {
|
|
2435
|
+
if (params.queryVec.length === 0 || params.limit <= 0) return [];
|
|
2436
|
+
if (await params.ensureVectorReady(params.queryVec.length)) return params.db.prepare(`SELECT c.id, c.path, c.start_line, c.end_line, c.text,
|
|
2437
|
+
c.source,
|
|
2438
|
+
vec_distance_cosine(v.embedding, ?) AS dist
|
|
2439
|
+
FROM ${params.vectorTable} v\n JOIN chunks c ON c.id = v.id\n WHERE c.model = ?${params.sourceFilterVec.sql}\n ORDER BY dist ASC\n LIMIT ?`).all(vectorToBlob(params.queryVec), params.providerModel, ...params.sourceFilterVec.params, params.limit).map((row) => ({
|
|
2440
|
+
id: row.id,
|
|
2441
|
+
path: row.path,
|
|
2442
|
+
startLine: row.start_line,
|
|
2443
|
+
endLine: row.end_line,
|
|
2444
|
+
score: 1 - row.dist,
|
|
2445
|
+
snippet: truncateUtf16Safe(row.text, params.snippetMaxChars),
|
|
2446
|
+
source: row.source
|
|
2447
|
+
}));
|
|
2448
|
+
return listChunks({
|
|
2449
|
+
db: params.db,
|
|
2450
|
+
providerModel: params.providerModel,
|
|
2451
|
+
sourceFilter: params.sourceFilterChunks
|
|
2452
|
+
}).map((chunk) => ({
|
|
2453
|
+
chunk,
|
|
2454
|
+
score: cosineSimilarity(params.queryVec, chunk.embedding)
|
|
2455
|
+
})).filter((entry) => Number.isFinite(entry.score)).toSorted((a, b) => b.score - a.score).slice(0, params.limit).map((entry) => ({
|
|
2456
|
+
id: entry.chunk.id,
|
|
2457
|
+
path: entry.chunk.path,
|
|
2458
|
+
startLine: entry.chunk.startLine,
|
|
2459
|
+
endLine: entry.chunk.endLine,
|
|
2460
|
+
score: entry.score,
|
|
2461
|
+
snippet: truncateUtf16Safe(entry.chunk.text, params.snippetMaxChars),
|
|
2462
|
+
source: entry.chunk.source
|
|
2463
|
+
}));
|
|
2464
|
+
}
|
|
2465
|
+
function listChunks(params) {
|
|
2466
|
+
return params.db.prepare(`SELECT id, path, start_line, end_line, text, embedding, source
|
|
2467
|
+
FROM chunks
|
|
2468
|
+
WHERE model = ?${params.sourceFilter.sql}`).all(params.providerModel, ...params.sourceFilter.params).map((row) => ({
|
|
2469
|
+
id: row.id,
|
|
2470
|
+
path: row.path,
|
|
2471
|
+
startLine: row.start_line,
|
|
2472
|
+
endLine: row.end_line,
|
|
2473
|
+
text: row.text,
|
|
2474
|
+
embedding: parseEmbedding(row.embedding),
|
|
2475
|
+
source: row.source
|
|
2476
|
+
}));
|
|
2477
|
+
}
|
|
2478
|
+
async function searchKeyword(params) {
|
|
2479
|
+
if (params.limit <= 0) return [];
|
|
2480
|
+
const plan = planKeywordSearch({
|
|
2481
|
+
query: params.query,
|
|
2482
|
+
ftsTokenizer: params.ftsTokenizer,
|
|
2483
|
+
buildFtsQuery: params.buildFtsQuery
|
|
2484
|
+
});
|
|
2485
|
+
if (!plan.matchQuery && plan.substringTerms.length === 0) return [];
|
|
2486
|
+
const modelClause = params.providerModel ? " AND model = ?" : "";
|
|
2487
|
+
const modelParams = params.providerModel ? [params.providerModel] : [];
|
|
2488
|
+
const substringClause = plan.substringTerms.map(() => " AND text LIKE ? ESCAPE '\\'").join("");
|
|
2489
|
+
const substringParams = plan.substringTerms.map((term) => `%${escapeLikePattern(term)}%`);
|
|
2490
|
+
const whereClause = plan.matchQuery ? `${params.ftsTable} MATCH ?${substringClause}${modelClause}${params.sourceFilter.sql}` : `1=1${substringClause}${modelClause}${params.sourceFilter.sql}`;
|
|
2491
|
+
const queryParams = [
|
|
2492
|
+
...plan.matchQuery ? [plan.matchQuery] : [],
|
|
2493
|
+
...substringParams,
|
|
2494
|
+
...modelParams,
|
|
2495
|
+
...params.sourceFilter.params,
|
|
2496
|
+
params.limit
|
|
2497
|
+
];
|
|
2498
|
+
const rankExpression = plan.matchQuery ? `bm25(${params.ftsTable})` : "0";
|
|
2499
|
+
return params.db.prepare(`SELECT id, path, source, start_line, end_line, text,\n ${rankExpression} AS rank\n FROM ${params.ftsTable}\n WHERE ${whereClause}\n ORDER BY rank ASC\n LIMIT ?`).all(...queryParams).map((row) => {
|
|
2500
|
+
const textScore = plan.matchQuery ? params.bm25RankToScore(row.rank) : 1;
|
|
2501
|
+
const score = params.boostFallbackRanking ? scoreFallbackKeywordResult({
|
|
2502
|
+
query: params.query,
|
|
2503
|
+
path: row.path,
|
|
2504
|
+
text: row.text,
|
|
2505
|
+
ftsScore: textScore
|
|
2506
|
+
}) : textScore;
|
|
2507
|
+
return {
|
|
2508
|
+
id: row.id,
|
|
2509
|
+
path: row.path,
|
|
2510
|
+
startLine: row.start_line,
|
|
2511
|
+
endLine: row.end_line,
|
|
2512
|
+
score,
|
|
2513
|
+
textScore,
|
|
2514
|
+
snippet: truncateUtf16Safe(row.text, params.snippetMaxChars),
|
|
2515
|
+
source: row.source
|
|
2516
|
+
};
|
|
2517
|
+
});
|
|
2518
|
+
}
|
|
2519
|
+
//#endregion
|
|
2520
|
+
//#region extensions/memory-core/src/memory/manager-status-state.ts
|
|
2521
|
+
const MEMORY_STATUS_AGGREGATE_SQL = "SELECT 'files' AS kind, source, COUNT(*) as c FROM files WHERE 1=1__FILTER__ GROUP BY source\nUNION ALL\nSELECT 'chunks' AS kind, source, COUNT(*) as c FROM chunks WHERE 1=1__FILTER__ GROUP BY source";
|
|
2522
|
+
function resolveInitialMemoryDirty(params) {
|
|
2523
|
+
return params.hasMemorySource && (params.statusOnly ? !params.hasIndexedMeta : true);
|
|
2524
|
+
}
|
|
2525
|
+
function resolveStatusProviderInfo(params) {
|
|
2526
|
+
if (params.provider) return {
|
|
2527
|
+
provider: params.provider.id,
|
|
2528
|
+
model: params.provider.model,
|
|
2529
|
+
searchMode: "hybrid"
|
|
2530
|
+
};
|
|
2531
|
+
if (params.providerInitialized) return {
|
|
2532
|
+
provider: "none",
|
|
2533
|
+
model: void 0,
|
|
2534
|
+
searchMode: "fts-only"
|
|
2535
|
+
};
|
|
2536
|
+
return {
|
|
2537
|
+
provider: params.requestedProvider,
|
|
2538
|
+
model: params.configuredModel || void 0,
|
|
2539
|
+
searchMode: "hybrid"
|
|
2540
|
+
};
|
|
2541
|
+
}
|
|
2542
|
+
function collectMemoryStatusAggregate(params) {
|
|
2543
|
+
const sources = Array.from(params.sources);
|
|
2544
|
+
const bySource = /* @__PURE__ */ new Map();
|
|
2545
|
+
for (const source of sources) bySource.set(source, {
|
|
2546
|
+
files: 0,
|
|
2547
|
+
chunks: 0
|
|
2548
|
+
});
|
|
2549
|
+
const sourceFilterSql = params.sourceFilterSql ?? "";
|
|
2550
|
+
const sourceFilterParams = params.sourceFilterParams ?? [];
|
|
2551
|
+
const aggregateRows = params.db.prepare(MEMORY_STATUS_AGGREGATE_SQL.replaceAll("__FILTER__", sourceFilterSql)).all(...sourceFilterParams, ...sourceFilterParams);
|
|
2552
|
+
let files = 0;
|
|
2553
|
+
let chunks = 0;
|
|
2554
|
+
for (const row of aggregateRows) {
|
|
2555
|
+
const count = row.c ?? 0;
|
|
2556
|
+
const entry = bySource.get(row.source) ?? {
|
|
2557
|
+
files: 0,
|
|
2558
|
+
chunks: 0
|
|
2559
|
+
};
|
|
2560
|
+
if (row.kind === "files") {
|
|
2561
|
+
entry.files = count;
|
|
2562
|
+
files += count;
|
|
2563
|
+
} else {
|
|
2564
|
+
entry.chunks = count;
|
|
2565
|
+
chunks += count;
|
|
2566
|
+
}
|
|
2567
|
+
bySource.set(row.source, entry);
|
|
2568
|
+
}
|
|
2569
|
+
return {
|
|
2570
|
+
files,
|
|
2571
|
+
chunks,
|
|
2572
|
+
sourceCounts: sources.map((source) => Object.assign({ source }, bySource.get(source)))
|
|
2573
|
+
};
|
|
2574
|
+
}
|
|
2575
|
+
//#endregion
|
|
2576
|
+
//#region extensions/memory-core/src/memory/manager-sync-control.ts
|
|
2577
|
+
const log$1 = createSubsystemLogger("memory");
|
|
2578
|
+
function isMemoryReadonlyDbError(err) {
|
|
2579
|
+
const readonlyPattern = /attempt to write a readonly database|database is read-only|SQLITE_READONLY/i;
|
|
2580
|
+
const messages = /* @__PURE__ */ new Set();
|
|
2581
|
+
const pushValue = (value) => {
|
|
2582
|
+
if (typeof value !== "string") return;
|
|
2583
|
+
const normalized = value.trim();
|
|
2584
|
+
if (!normalized) return;
|
|
2585
|
+
messages.add(normalized);
|
|
2586
|
+
};
|
|
2587
|
+
pushValue(formatErrorMessage(err));
|
|
2588
|
+
if (err && typeof err === "object") {
|
|
2589
|
+
const record = err;
|
|
2590
|
+
pushValue(record.message);
|
|
2591
|
+
pushValue(record.code);
|
|
2592
|
+
pushValue(record.name);
|
|
2593
|
+
if (record.cause && typeof record.cause === "object") {
|
|
2594
|
+
const cause = record.cause;
|
|
2595
|
+
pushValue(cause.message);
|
|
2596
|
+
pushValue(cause.code);
|
|
2597
|
+
pushValue(cause.name);
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
return [...messages].some((value) => readonlyPattern.test(value));
|
|
2601
|
+
}
|
|
2602
|
+
function extractMemoryErrorReason(err) {
|
|
2603
|
+
if (err instanceof Error && err.message.trim()) return err.message;
|
|
2604
|
+
if (err && typeof err === "object") {
|
|
2605
|
+
const record = err;
|
|
2606
|
+
if (typeof record.message === "string" && record.message.trim()) return record.message;
|
|
2607
|
+
if (typeof record.code === "string" && record.code.trim()) return record.code;
|
|
2608
|
+
}
|
|
2609
|
+
return String(err);
|
|
2610
|
+
}
|
|
2611
|
+
async function runMemorySyncWithReadonlyRecovery(state, params) {
|
|
2612
|
+
try {
|
|
2613
|
+
await state.runSync(params);
|
|
2614
|
+
return;
|
|
2615
|
+
} catch (err) {
|
|
2616
|
+
if (!isMemoryReadonlyDbError(err) || state.closed) throw err;
|
|
2617
|
+
const reason = extractMemoryErrorReason(err);
|
|
2618
|
+
state.readonlyRecoveryAttempts += 1;
|
|
2619
|
+
state.readonlyRecoveryLastError = reason;
|
|
2620
|
+
log$1.warn(`memory sync readonly handle detected; reopening sqlite connection`, { reason });
|
|
2621
|
+
try {
|
|
2622
|
+
state.db.close();
|
|
2623
|
+
} catch {}
|
|
2624
|
+
state.db = state.openDatabase();
|
|
2625
|
+
state.vectorReady = null;
|
|
2626
|
+
state.vector.available = null;
|
|
2627
|
+
state.vector.loadError = void 0;
|
|
2628
|
+
state.ensureSchema();
|
|
2629
|
+
const meta = state.readMeta();
|
|
2630
|
+
state.vector.dims = meta?.vectorDims;
|
|
2631
|
+
try {
|
|
2632
|
+
await state.runSync(params);
|
|
2633
|
+
state.readonlyRecoverySuccesses += 1;
|
|
2634
|
+
} catch (retryErr) {
|
|
2635
|
+
state.readonlyRecoveryFailures += 1;
|
|
2636
|
+
throw retryErr;
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
function enqueueMemoryTargetedSessionSync(state, sessionFiles) {
|
|
2641
|
+
const queuedSessionFiles = state.getQueuedSessionFiles();
|
|
2642
|
+
for (const sessionFile of sessionFiles ?? []) {
|
|
2643
|
+
const trimmed = sessionFile.trim();
|
|
2644
|
+
if (trimmed) queuedSessionFiles.add(trimmed);
|
|
2645
|
+
}
|
|
2646
|
+
if (queuedSessionFiles.size === 0) return state.getSyncing() ?? Promise.resolve();
|
|
2647
|
+
if (!state.getQueuedSessionSync()) state.setQueuedSessionSync((async () => {
|
|
2648
|
+
try {
|
|
2649
|
+
await state.getSyncing()?.catch(() => void 0);
|
|
2650
|
+
while (!state.isClosed() && state.getQueuedSessionFiles().size > 0) {
|
|
2651
|
+
const pendingSessionFiles = Array.from(state.getQueuedSessionFiles());
|
|
2652
|
+
state.getQueuedSessionFiles().clear();
|
|
2653
|
+
await state.sync({
|
|
2654
|
+
reason: "queued-session-files",
|
|
2655
|
+
sessionFiles: pendingSessionFiles
|
|
2656
|
+
});
|
|
2657
|
+
}
|
|
2658
|
+
} finally {
|
|
2659
|
+
state.setQueuedSessionSync(null);
|
|
2660
|
+
}
|
|
2661
|
+
})());
|
|
2662
|
+
return state.getQueuedSessionSync() ?? Promise.resolve();
|
|
2663
|
+
}
|
|
2664
|
+
//#endregion
|
|
2665
|
+
//#region extensions/memory-core/src/memory/recall-verify.ts
|
|
2666
|
+
const DEFAULT_RECALL_VERIFY_CONFIG = {
|
|
2667
|
+
enabled: false,
|
|
2668
|
+
fuzzyWindow: 20
|
|
2669
|
+
};
|
|
2670
|
+
function normalizeForComparison(text) {
|
|
2671
|
+
return text.trim().replaceAll(/\s+/g, " ");
|
|
2672
|
+
}
|
|
2673
|
+
/**
|
|
2674
|
+
* Verify search results by re-reading source files and checking that snippets
|
|
2675
|
+
* still exist at the claimed line ranges.
|
|
2676
|
+
*
|
|
2677
|
+
* When `config.enabled` is false (the default), every result is returned with
|
|
2678
|
+
* `verified: true` — the caller trusts the index.
|
|
2679
|
+
*
|
|
2680
|
+
* When enabled, each result goes through:
|
|
2681
|
+
* 1. Read the source file.
|
|
2682
|
+
* 2. Compare the snippet at the claimed range (whitespace-normalized).
|
|
2683
|
+
* 3. If not found, slide a window of the same height within ±`fuzzyWindow`.
|
|
2684
|
+
* 4. Return corrected `actualStartLine` / `actualEndLine` when relocated.
|
|
2685
|
+
*/
|
|
2686
|
+
async function verifySearchResults(results, fileReader, config = {}) {
|
|
2687
|
+
const resolved = {
|
|
2688
|
+
enabled: config.enabled ?? DEFAULT_RECALL_VERIFY_CONFIG.enabled,
|
|
2689
|
+
fuzzyWindow: config.fuzzyWindow ?? DEFAULT_RECALL_VERIFY_CONFIG.fuzzyWindow
|
|
2690
|
+
};
|
|
2691
|
+
if (!resolved.enabled) return results.map((r) => ({
|
|
2692
|
+
...r,
|
|
2693
|
+
verified: true
|
|
2694
|
+
}));
|
|
2695
|
+
const verified = [];
|
|
2696
|
+
for (const result of results) {
|
|
2697
|
+
const content = await fileReader.readFile(result.path);
|
|
2698
|
+
if (content === null) {
|
|
2699
|
+
verified.push({
|
|
2700
|
+
...result,
|
|
2701
|
+
verified: false
|
|
2702
|
+
});
|
|
2703
|
+
continue;
|
|
2704
|
+
}
|
|
2705
|
+
const lines = content.split("\n");
|
|
2706
|
+
const snippetNorm = normalizeForComparison(result.snippet);
|
|
2707
|
+
const rangeHeight = result.endLine - result.startLine + 1;
|
|
2708
|
+
if (normalizeForComparison(lines.slice(result.startLine - 1, result.endLine).join("\n")).includes(snippetNorm)) {
|
|
2709
|
+
verified.push({
|
|
2710
|
+
...result,
|
|
2711
|
+
verified: true
|
|
2712
|
+
});
|
|
2713
|
+
continue;
|
|
2714
|
+
}
|
|
2715
|
+
const searchStart = Math.max(1, result.startLine - resolved.fuzzyWindow);
|
|
2716
|
+
const searchEnd = Math.min(lines.length, result.endLine + resolved.fuzzyWindow);
|
|
2717
|
+
let found = false;
|
|
2718
|
+
for (let pos = searchStart; pos + rangeHeight - 1 <= searchEnd; pos++) if (normalizeForComparison(lines.slice(pos - 1, pos - 1 + rangeHeight).join("\n")).includes(snippetNorm)) {
|
|
2719
|
+
verified.push({
|
|
2720
|
+
...result,
|
|
2721
|
+
verified: true,
|
|
2722
|
+
actualStartLine: pos,
|
|
2723
|
+
actualEndLine: pos + rangeHeight - 1
|
|
2724
|
+
});
|
|
2725
|
+
found = true;
|
|
2726
|
+
break;
|
|
2727
|
+
}
|
|
2728
|
+
if (!found) verified.push({
|
|
2729
|
+
...result,
|
|
2730
|
+
verified: false
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
return verified;
|
|
2734
|
+
}
|
|
2735
|
+
//#endregion
|
|
2736
|
+
//#region extensions/memory-core/src/memory/manager.ts
|
|
2737
|
+
const SNIPPET_MAX_CHARS = 700;
|
|
2738
|
+
const VECTOR_TABLE = "chunks_vec";
|
|
2739
|
+
const FTS_TABLE = "chunks_fts";
|
|
2740
|
+
const EMBEDDING_CACHE_TABLE = "embedding_cache";
|
|
2741
|
+
const MEMORY_INDEX_MANAGER_CACHE_KEY = Symbol.for("kaijibot.memoryIndexManagerCache");
|
|
2742
|
+
const log = createSubsystemLogger("memory");
|
|
2743
|
+
const { cache: INDEX_CACHE, pending: INDEX_CACHE_PENDING } = resolveSingletonManagedCache(MEMORY_INDEX_MANAGER_CACHE_KEY);
|
|
2744
|
+
async function closeAllMemoryIndexManagers() {
|
|
2745
|
+
await closeManagedCacheEntries({
|
|
2746
|
+
cache: INDEX_CACHE,
|
|
2747
|
+
pending: INDEX_CACHE_PENDING,
|
|
2748
|
+
onCloseError: (err) => {
|
|
2749
|
+
log.warn(`failed to close memory index manager: ${String(err)}`);
|
|
2750
|
+
}
|
|
2751
|
+
});
|
|
2752
|
+
}
|
|
2753
|
+
var MemoryIndexManager = class MemoryIndexManager extends MemoryManagerEmbeddingOps {
|
|
2754
|
+
static async loadProviderResult(params) {
|
|
2755
|
+
return await createEmbeddingProvider({
|
|
2756
|
+
config: params.cfg,
|
|
2757
|
+
agentDir: resolveAgentDir(params.cfg, params.agentId),
|
|
2758
|
+
...resolveMemoryPrimaryProviderRequest({ settings: params.settings })
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2761
|
+
static async get(params) {
|
|
2762
|
+
const { cfg, agentId } = params;
|
|
2763
|
+
const settings = resolveMemorySearchConfig(cfg, agentId);
|
|
2764
|
+
if (!settings) return null;
|
|
2765
|
+
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
|
2766
|
+
const purpose = params.purpose === "status" ? "status" : "default";
|
|
2767
|
+
const key = `${agentId}:${workspaceDir}:${JSON.stringify(settings)}:${purpose}`;
|
|
2768
|
+
return await getOrCreateManagedCacheEntry({
|
|
2769
|
+
cache: INDEX_CACHE,
|
|
2770
|
+
pending: INDEX_CACHE_PENDING,
|
|
2771
|
+
key,
|
|
2772
|
+
bypassCache: params.purpose === "status",
|
|
2773
|
+
create: async () => new MemoryIndexManager({
|
|
2774
|
+
cacheKey: key,
|
|
2775
|
+
cfg,
|
|
2776
|
+
agentId,
|
|
2777
|
+
workspaceDir,
|
|
2778
|
+
settings,
|
|
2779
|
+
purpose: params.purpose
|
|
2780
|
+
})
|
|
2781
|
+
});
|
|
2782
|
+
}
|
|
2783
|
+
constructor(params) {
|
|
2784
|
+
super();
|
|
2785
|
+
this.providerInitPromise = null;
|
|
2786
|
+
this.providerInitialized = false;
|
|
2787
|
+
this.batchFailureCount = 0;
|
|
2788
|
+
this.batchFailureLock = Promise.resolve();
|
|
2789
|
+
this.vectorReady = null;
|
|
2790
|
+
this.watcher = null;
|
|
2791
|
+
this.watchTimer = null;
|
|
2792
|
+
this.sessionWatchTimer = null;
|
|
2793
|
+
this.sessionUnsubscribe = null;
|
|
2794
|
+
this.intervalTimer = null;
|
|
2795
|
+
this.closed = false;
|
|
2796
|
+
this.dirty = false;
|
|
2797
|
+
this.sessionsDirty = false;
|
|
2798
|
+
this.sessionsDirtyFiles = /* @__PURE__ */ new Set();
|
|
2799
|
+
this.sessionPendingFiles = /* @__PURE__ */ new Set();
|
|
2800
|
+
this.sessionDeltas = /* @__PURE__ */ new Map();
|
|
2801
|
+
this.sessionWarm = /* @__PURE__ */ new Set();
|
|
2802
|
+
this.syncing = null;
|
|
2803
|
+
this.queuedSessionFiles = /* @__PURE__ */ new Set();
|
|
2804
|
+
this.queuedSessionSync = null;
|
|
2805
|
+
this.readonlyRecoveryAttempts = 0;
|
|
2806
|
+
this.readonlyRecoverySuccesses = 0;
|
|
2807
|
+
this.readonlyRecoveryFailures = 0;
|
|
2808
|
+
this.cacheKey = params.cacheKey;
|
|
2809
|
+
this.cfg = params.cfg;
|
|
2810
|
+
this.agentId = params.agentId;
|
|
2811
|
+
this.workspaceDir = params.workspaceDir;
|
|
2812
|
+
this.settings = params.settings;
|
|
2813
|
+
this.provider = null;
|
|
2814
|
+
this.requestedProvider = params.settings.provider;
|
|
2815
|
+
if (params.providerResult) this.applyProviderResult(params.providerResult);
|
|
2816
|
+
this.sources = new Set(params.settings.sources);
|
|
2817
|
+
this.db = this.openDatabase();
|
|
2818
|
+
this.providerKey = this.computeProviderKey();
|
|
2819
|
+
this.cache = {
|
|
2820
|
+
enabled: params.settings.cache.enabled,
|
|
2821
|
+
maxEntries: params.settings.cache.maxEntries
|
|
2822
|
+
};
|
|
2823
|
+
this.fts = {
|
|
2824
|
+
enabled: params.settings.query.hybrid.enabled,
|
|
2825
|
+
available: false
|
|
2826
|
+
};
|
|
2827
|
+
this.ensureSchema();
|
|
2828
|
+
this.vector = {
|
|
2829
|
+
enabled: params.settings.store.vector.enabled,
|
|
2830
|
+
available: null,
|
|
2831
|
+
extensionPath: params.settings.store.vector.extensionPath
|
|
2832
|
+
};
|
|
2833
|
+
const meta = this.readMeta();
|
|
2834
|
+
if (meta?.vectorDims) this.vector.dims = meta.vectorDims;
|
|
2835
|
+
const statusOnly = params.purpose === "status";
|
|
2836
|
+
if (!statusOnly) {
|
|
2837
|
+
this.ensureWatcher();
|
|
2838
|
+
this.ensureSessionListener();
|
|
2839
|
+
this.ensureIntervalSync();
|
|
2840
|
+
}
|
|
2841
|
+
this.dirty = resolveInitialMemoryDirty({
|
|
2842
|
+
hasMemorySource: this.sources.has("memory"),
|
|
2843
|
+
statusOnly,
|
|
2844
|
+
hasIndexedMeta: Boolean(meta)
|
|
2845
|
+
});
|
|
2846
|
+
this.batch = this.resolveBatchConfig();
|
|
2847
|
+
}
|
|
2848
|
+
applyProviderResult(providerResult) {
|
|
2849
|
+
const providerState = resolveMemoryProviderState(providerResult);
|
|
2850
|
+
this.provider = providerState.provider;
|
|
2851
|
+
this.fallbackFrom = providerState.fallbackFrom;
|
|
2852
|
+
this.fallbackReason = providerState.fallbackReason;
|
|
2853
|
+
this.providerUnavailableReason = providerState.providerUnavailableReason;
|
|
2854
|
+
this.providerRuntime = providerState.providerRuntime;
|
|
2855
|
+
this.providerInitialized = true;
|
|
2856
|
+
}
|
|
2857
|
+
async ensureProviderInitialized() {
|
|
2858
|
+
if (this.providerInitialized) return;
|
|
2859
|
+
if (!this.providerInitPromise) this.providerInitPromise = (async () => {
|
|
2860
|
+
const providerResult = await MemoryIndexManager.loadProviderResult({
|
|
2861
|
+
cfg: this.cfg,
|
|
2862
|
+
agentId: this.agentId,
|
|
2863
|
+
settings: this.settings
|
|
2864
|
+
});
|
|
2865
|
+
this.applyProviderResult(providerResult);
|
|
2866
|
+
this.providerKey = this.computeProviderKey();
|
|
2867
|
+
this.batch = this.resolveBatchConfig();
|
|
2868
|
+
})();
|
|
2869
|
+
try {
|
|
2870
|
+
await this.providerInitPromise;
|
|
2871
|
+
} finally {
|
|
2872
|
+
if (this.providerInitialized) this.providerInitPromise = null;
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
async warmSession(sessionKey) {
|
|
2876
|
+
if (!this.settings.sync.onSessionStart) return;
|
|
2877
|
+
const key = sessionKey?.trim() || "";
|
|
2878
|
+
if (key && this.sessionWarm.has(key)) return;
|
|
2879
|
+
this.sync({ reason: "session-start" }).catch((err) => {
|
|
2880
|
+
log.warn(`memory sync failed (session-start): ${String(err)}`);
|
|
2881
|
+
});
|
|
2882
|
+
if (key) this.sessionWarm.add(key);
|
|
2883
|
+
}
|
|
2884
|
+
async search(query, opts) {
|
|
2885
|
+
opts?.onDebug?.({ backend: "builtin" });
|
|
2886
|
+
let hasIndexedContent = this.hasIndexedContent();
|
|
2887
|
+
if (!hasIndexedContent) {
|
|
2888
|
+
try {
|
|
2889
|
+
await this.sync({
|
|
2890
|
+
reason: "search",
|
|
2891
|
+
force: true
|
|
2892
|
+
});
|
|
2893
|
+
} catch (err) {
|
|
2894
|
+
log.warn(`memory sync failed (search-bootstrap): ${String(err)}`);
|
|
2895
|
+
}
|
|
2896
|
+
hasIndexedContent = this.hasIndexedContent();
|
|
2897
|
+
}
|
|
2898
|
+
const preflight = resolveMemorySearchPreflight({
|
|
2899
|
+
query,
|
|
2900
|
+
hasIndexedContent
|
|
2901
|
+
});
|
|
2902
|
+
if (!preflight.shouldSearch) return [];
|
|
2903
|
+
const cleaned = preflight.normalizedQuery;
|
|
2904
|
+
this.warmSession(opts?.sessionKey);
|
|
2905
|
+
startAsyncSearchSync({
|
|
2906
|
+
enabled: this.settings.sync.onSearch,
|
|
2907
|
+
dirty: this.dirty,
|
|
2908
|
+
sessionsDirty: this.sessionsDirty,
|
|
2909
|
+
sync: async (params) => await this.sync(params),
|
|
2910
|
+
onError: (err) => {
|
|
2911
|
+
log.warn(`memory sync failed (search): ${String(err)}`);
|
|
2912
|
+
}
|
|
2913
|
+
});
|
|
2914
|
+
if (preflight.shouldInitializeProvider) await this.ensureProviderInitialized();
|
|
2915
|
+
const minScore = opts?.minScore ?? this.settings.query.minScore;
|
|
2916
|
+
const maxResults = opts?.maxResults ?? this.settings.query.maxResults;
|
|
2917
|
+
const hybrid = this.settings.query.hybrid;
|
|
2918
|
+
const candidates = Math.min(200, Math.max(1, Math.floor(maxResults * hybrid.candidateMultiplier)));
|
|
2919
|
+
if (!this.provider) {
|
|
2920
|
+
if (!this.fts.enabled || !this.fts.available) {
|
|
2921
|
+
log.warn("memory search: no provider and FTS unavailable");
|
|
2922
|
+
return [];
|
|
2923
|
+
}
|
|
2924
|
+
const fullQueryResults = await this.searchKeyword(cleaned, candidates, { boostFallbackRanking: true }).catch(() => []);
|
|
2925
|
+
const resultSets = fullQueryResults.length > 0 ? [fullQueryResults] : await Promise.all((() => {
|
|
2926
|
+
const keywords = extractKeywords(cleaned, { ftsTokenizer: this.settings.store.fts.tokenizer });
|
|
2927
|
+
return (keywords.length > 0 ? keywords : [cleaned]).map((term) => this.searchKeyword(term, candidates, { boostFallbackRanking: true }).catch(() => []));
|
|
2928
|
+
})());
|
|
2929
|
+
const seenIds = /* @__PURE__ */ new Map();
|
|
2930
|
+
for (const results of resultSets) for (const result of results) {
|
|
2931
|
+
const existing = seenIds.get(result.id);
|
|
2932
|
+
if (!existing || result.score > existing.score) seenIds.set(result.id, result);
|
|
2933
|
+
}
|
|
2934
|
+
const sorted = (await applyTemporalDecayToHybridResults({
|
|
2935
|
+
results: [...seenIds.values()],
|
|
2936
|
+
temporalDecay: hybrid.temporalDecay,
|
|
2937
|
+
workspaceDir: this.workspaceDir
|
|
2938
|
+
})).toSorted((a, b) => b.score - a.score);
|
|
2939
|
+
const ftsResults = this.selectScoredResults(sorted, maxResults, minScore, 0);
|
|
2940
|
+
return await this.applyVerification(ftsResults);
|
|
2941
|
+
}
|
|
2942
|
+
const keywordResults = hybrid.enabled && this.fts.enabled && this.fts.available ? await this.searchKeyword(cleaned, candidates).catch(() => []) : [];
|
|
2943
|
+
const queryVec = await this.embedQueryWithTimeout(cleaned);
|
|
2944
|
+
const vectorResults = queryVec.some((v) => v !== 0) ? await this.searchVector(queryVec, candidates).catch(() => []) : [];
|
|
2945
|
+
if (!hybrid.enabled || !this.fts.enabled || !this.fts.available) {
|
|
2946
|
+
const vecResults = vectorResults.filter((entry) => entry.score >= minScore).slice(0, maxResults);
|
|
2947
|
+
return await this.applyVerification(vecResults);
|
|
2948
|
+
}
|
|
2949
|
+
const merged = await this.mergeHybridResults({
|
|
2950
|
+
vector: vectorResults,
|
|
2951
|
+
keyword: keywordResults,
|
|
2952
|
+
vectorWeight: hybrid.vectorWeight,
|
|
2953
|
+
textWeight: hybrid.textWeight,
|
|
2954
|
+
mmr: hybrid.mmr,
|
|
2955
|
+
temporalDecay: hybrid.temporalDecay
|
|
2956
|
+
});
|
|
2957
|
+
const strict = merged.filter((entry) => entry.score >= minScore);
|
|
2958
|
+
if (strict.length > 0 || keywordResults.length === 0) {
|
|
2959
|
+
const strictResults = strict.slice(0, maxResults);
|
|
2960
|
+
return await this.applyVerification(strictResults);
|
|
2961
|
+
}
|
|
2962
|
+
const relaxedMinScore = Math.min(minScore, hybrid.textWeight);
|
|
2963
|
+
const keywordKeys = new Set(keywordResults.map((entry) => `${entry.source}:${entry.path}:${entry.startLine}:${entry.endLine}`));
|
|
2964
|
+
const hybridResults = this.selectScoredResults(merged.filter((entry) => keywordKeys.has(`${entry.source}:${entry.path}:${entry.startLine}:${entry.endLine}`)), maxResults, minScore, relaxedMinScore);
|
|
2965
|
+
return await this.applyVerification(hybridResults);
|
|
2966
|
+
}
|
|
2967
|
+
selectScoredResults(results, maxResults, minScore, relaxedMinScore = minScore) {
|
|
2968
|
+
const strict = results.filter((entry) => entry.score >= minScore);
|
|
2969
|
+
if (strict.length > 0) return strict.slice(0, maxResults);
|
|
2970
|
+
return results.filter((entry) => entry.score >= relaxedMinScore).slice(0, maxResults);
|
|
2971
|
+
}
|
|
2972
|
+
async applyVerification(results) {
|
|
2973
|
+
const verifyConfig = this.settings.query.verify;
|
|
2974
|
+
if (!verifyConfig?.enabled) return results;
|
|
2975
|
+
return (await verifySearchResults(results, { readFile: async (relPath) => {
|
|
2976
|
+
try {
|
|
2977
|
+
const fullPath = path.join(this.workspaceDir, relPath);
|
|
2978
|
+
return await fs$1.readFile(fullPath, "utf-8");
|
|
2979
|
+
} catch {
|
|
2980
|
+
return null;
|
|
2981
|
+
}
|
|
2982
|
+
} }, verifyConfig)).filter((r) => r.verified).map((r) => ({
|
|
2983
|
+
path: r.path,
|
|
2984
|
+
startLine: r.actualStartLine ?? r.startLine,
|
|
2985
|
+
endLine: r.actualEndLine ?? r.endLine,
|
|
2986
|
+
score: r.score,
|
|
2987
|
+
snippet: r.snippet,
|
|
2988
|
+
source: r.source,
|
|
2989
|
+
citation: r.citation
|
|
2990
|
+
}));
|
|
2991
|
+
}
|
|
2992
|
+
hasIndexedContent() {
|
|
2993
|
+
if (this.db.prepare(`SELECT 1 as found FROM chunks LIMIT 1`).get()?.found === 1) return true;
|
|
2994
|
+
if (!this.fts.enabled || !this.fts.available) return false;
|
|
2995
|
+
return this.db.prepare(`SELECT 1 as found FROM ${FTS_TABLE} LIMIT 1`).get()?.found === 1;
|
|
2996
|
+
}
|
|
2997
|
+
async searchVector(queryVec, limit) {
|
|
2998
|
+
if (!this.provider) return [];
|
|
2999
|
+
return (await searchVector({
|
|
3000
|
+
db: this.db,
|
|
3001
|
+
vectorTable: VECTOR_TABLE,
|
|
3002
|
+
providerModel: this.provider.model,
|
|
3003
|
+
queryVec,
|
|
3004
|
+
limit,
|
|
3005
|
+
snippetMaxChars: SNIPPET_MAX_CHARS,
|
|
3006
|
+
ensureVectorReady: async (dimensions) => await this.ensureVectorReady(dimensions),
|
|
3007
|
+
sourceFilterVec: this.buildSourceFilter("c"),
|
|
3008
|
+
sourceFilterChunks: this.buildSourceFilter()
|
|
3009
|
+
})).map((entry) => entry);
|
|
3010
|
+
}
|
|
3011
|
+
buildFtsQuery(raw) {
|
|
3012
|
+
return buildFtsQuery(raw);
|
|
3013
|
+
}
|
|
3014
|
+
async searchKeyword(query, limit, options) {
|
|
3015
|
+
if (!this.fts.enabled || !this.fts.available) return [];
|
|
3016
|
+
const sourceFilter = this.buildSourceFilter();
|
|
3017
|
+
const providerModel = this.provider?.model;
|
|
3018
|
+
return (await searchKeyword({
|
|
3019
|
+
db: this.db,
|
|
3020
|
+
ftsTable: FTS_TABLE,
|
|
3021
|
+
providerModel,
|
|
3022
|
+
query,
|
|
3023
|
+
ftsTokenizer: this.settings.store.fts.tokenizer,
|
|
3024
|
+
limit,
|
|
3025
|
+
snippetMaxChars: SNIPPET_MAX_CHARS,
|
|
3026
|
+
sourceFilter,
|
|
3027
|
+
buildFtsQuery: (raw) => this.buildFtsQuery(raw),
|
|
3028
|
+
bm25RankToScore,
|
|
3029
|
+
boostFallbackRanking: options?.boostFallbackRanking
|
|
3030
|
+
})).map((entry) => entry);
|
|
3031
|
+
}
|
|
3032
|
+
mergeHybridResults(params) {
|
|
3033
|
+
return mergeHybridResults({
|
|
3034
|
+
vector: params.vector.map((r) => ({
|
|
3035
|
+
id: r.id,
|
|
3036
|
+
path: r.path,
|
|
3037
|
+
startLine: r.startLine,
|
|
3038
|
+
endLine: r.endLine,
|
|
3039
|
+
source: r.source,
|
|
3040
|
+
snippet: r.snippet,
|
|
3041
|
+
vectorScore: r.score
|
|
3042
|
+
})),
|
|
3043
|
+
keyword: params.keyword.map((r) => ({
|
|
3044
|
+
id: r.id,
|
|
3045
|
+
path: r.path,
|
|
3046
|
+
startLine: r.startLine,
|
|
3047
|
+
endLine: r.endLine,
|
|
3048
|
+
source: r.source,
|
|
3049
|
+
snippet: r.snippet,
|
|
3050
|
+
textScore: r.textScore
|
|
3051
|
+
})),
|
|
3052
|
+
vectorWeight: params.vectorWeight,
|
|
3053
|
+
textWeight: params.textWeight,
|
|
3054
|
+
mmr: params.mmr,
|
|
3055
|
+
temporalDecay: params.temporalDecay,
|
|
3056
|
+
workspaceDir: this.workspaceDir
|
|
3057
|
+
}).then((entries) => entries.map((entry) => entry));
|
|
3058
|
+
}
|
|
3059
|
+
async sync(params) {
|
|
3060
|
+
if (this.closed) return;
|
|
3061
|
+
await this.ensureProviderInitialized();
|
|
3062
|
+
if (this.syncing) {
|
|
3063
|
+
if (params?.sessionFiles?.some((sessionFile) => sessionFile.trim().length > 0)) return this.enqueueTargetedSessionSync(params.sessionFiles);
|
|
3064
|
+
return this.syncing;
|
|
3065
|
+
}
|
|
3066
|
+
this.syncing = this.runSyncWithReadonlyRecovery(params).finally(() => {
|
|
3067
|
+
this.syncing = null;
|
|
3068
|
+
});
|
|
3069
|
+
return this.syncing ?? Promise.resolve();
|
|
3070
|
+
}
|
|
3071
|
+
enqueueTargetedSessionSync(sessionFiles) {
|
|
3072
|
+
return enqueueMemoryTargetedSessionSync({
|
|
3073
|
+
isClosed: () => this.closed,
|
|
3074
|
+
getSyncing: () => this.syncing,
|
|
3075
|
+
getQueuedSessionFiles: () => this.queuedSessionFiles,
|
|
3076
|
+
getQueuedSessionSync: () => this.queuedSessionSync,
|
|
3077
|
+
setQueuedSessionSync: (value) => {
|
|
3078
|
+
this.queuedSessionSync = value;
|
|
3079
|
+
},
|
|
3080
|
+
sync: async (params) => await this.sync(params)
|
|
3081
|
+
}, sessionFiles);
|
|
3082
|
+
}
|
|
3083
|
+
isReadonlyDbError(err) {
|
|
3084
|
+
return isMemoryReadonlyDbError(err);
|
|
3085
|
+
}
|
|
3086
|
+
extractErrorReason(err) {
|
|
3087
|
+
return extractMemoryErrorReason(err);
|
|
3088
|
+
}
|
|
3089
|
+
async runSyncWithReadonlyRecovery(params) {
|
|
3090
|
+
const getClosed = () => this.closed;
|
|
3091
|
+
const getDb = () => this.db;
|
|
3092
|
+
const setDb = (value) => {
|
|
3093
|
+
this.db = value;
|
|
3094
|
+
};
|
|
3095
|
+
const getVectorReady = () => this.vectorReady;
|
|
3096
|
+
const setVectorReady = (value) => {
|
|
3097
|
+
this.vectorReady = value;
|
|
3098
|
+
};
|
|
3099
|
+
const getReadonlyRecoveryAttempts = () => this.readonlyRecoveryAttempts;
|
|
3100
|
+
const setReadonlyRecoveryAttempts = (value) => {
|
|
3101
|
+
this.readonlyRecoveryAttempts = value;
|
|
3102
|
+
};
|
|
3103
|
+
const getReadonlyRecoverySuccesses = () => this.readonlyRecoverySuccesses;
|
|
3104
|
+
const setReadonlyRecoverySuccesses = (value) => {
|
|
3105
|
+
this.readonlyRecoverySuccesses = value;
|
|
3106
|
+
};
|
|
3107
|
+
const getReadonlyRecoveryFailures = () => this.readonlyRecoveryFailures;
|
|
3108
|
+
const setReadonlyRecoveryFailures = (value) => {
|
|
3109
|
+
this.readonlyRecoveryFailures = value;
|
|
3110
|
+
};
|
|
3111
|
+
const getReadonlyRecoveryLastError = () => this.readonlyRecoveryLastError;
|
|
3112
|
+
const setReadonlyRecoveryLastError = (value) => {
|
|
3113
|
+
this.readonlyRecoveryLastError = value;
|
|
3114
|
+
};
|
|
3115
|
+
await runMemorySyncWithReadonlyRecovery({
|
|
3116
|
+
get closed() {
|
|
3117
|
+
return getClosed();
|
|
3118
|
+
},
|
|
3119
|
+
get db() {
|
|
3120
|
+
return getDb();
|
|
3121
|
+
},
|
|
3122
|
+
set db(value) {
|
|
3123
|
+
setDb(value);
|
|
3124
|
+
},
|
|
3125
|
+
get vectorReady() {
|
|
3126
|
+
return getVectorReady();
|
|
3127
|
+
},
|
|
3128
|
+
set vectorReady(value) {
|
|
3129
|
+
setVectorReady(value);
|
|
3130
|
+
},
|
|
3131
|
+
vector: this.vector,
|
|
3132
|
+
get readonlyRecoveryAttempts() {
|
|
3133
|
+
return getReadonlyRecoveryAttempts();
|
|
3134
|
+
},
|
|
3135
|
+
set readonlyRecoveryAttempts(value) {
|
|
3136
|
+
setReadonlyRecoveryAttempts(value);
|
|
3137
|
+
},
|
|
3138
|
+
get readonlyRecoverySuccesses() {
|
|
3139
|
+
return getReadonlyRecoverySuccesses();
|
|
3140
|
+
},
|
|
3141
|
+
set readonlyRecoverySuccesses(value) {
|
|
3142
|
+
setReadonlyRecoverySuccesses(value);
|
|
3143
|
+
},
|
|
3144
|
+
get readonlyRecoveryFailures() {
|
|
3145
|
+
return getReadonlyRecoveryFailures();
|
|
3146
|
+
},
|
|
3147
|
+
set readonlyRecoveryFailures(value) {
|
|
3148
|
+
setReadonlyRecoveryFailures(value);
|
|
3149
|
+
},
|
|
3150
|
+
get readonlyRecoveryLastError() {
|
|
3151
|
+
return getReadonlyRecoveryLastError();
|
|
3152
|
+
},
|
|
3153
|
+
set readonlyRecoveryLastError(value) {
|
|
3154
|
+
setReadonlyRecoveryLastError(value);
|
|
3155
|
+
},
|
|
3156
|
+
runSync: (nextParams) => this.runSync(nextParams),
|
|
3157
|
+
openDatabase: () => this.openDatabase(),
|
|
3158
|
+
ensureSchema: () => this.ensureSchema(),
|
|
3159
|
+
readMeta: () => this.readMeta() ?? void 0
|
|
3160
|
+
}, params);
|
|
3161
|
+
}
|
|
3162
|
+
async readFile(params) {
|
|
3163
|
+
return await readMemoryFile({
|
|
3164
|
+
workspaceDir: this.workspaceDir,
|
|
3165
|
+
extraPaths: this.settings.extraPaths,
|
|
3166
|
+
relPath: params.relPath,
|
|
3167
|
+
from: params.from,
|
|
3168
|
+
lines: params.lines
|
|
3169
|
+
});
|
|
3170
|
+
}
|
|
3171
|
+
status() {
|
|
3172
|
+
const sourceFilter = this.buildSourceFilter();
|
|
3173
|
+
const aggregateState = collectMemoryStatusAggregate({
|
|
3174
|
+
db: { prepare: (sql) => ({ all: (...args) => this.db.prepare(sql).all(...args) }) },
|
|
3175
|
+
sources: this.sources,
|
|
3176
|
+
sourceFilterSql: sourceFilter.sql,
|
|
3177
|
+
sourceFilterParams: sourceFilter.params
|
|
3178
|
+
});
|
|
3179
|
+
const providerInfo = resolveStatusProviderInfo({
|
|
3180
|
+
provider: this.provider,
|
|
3181
|
+
providerInitialized: this.providerInitialized,
|
|
3182
|
+
requestedProvider: this.requestedProvider,
|
|
3183
|
+
configuredModel: this.settings.model || void 0
|
|
3184
|
+
});
|
|
3185
|
+
return {
|
|
3186
|
+
backend: "builtin",
|
|
3187
|
+
files: aggregateState.files,
|
|
3188
|
+
chunks: aggregateState.chunks,
|
|
3189
|
+
dirty: this.dirty || this.sessionsDirty,
|
|
3190
|
+
workspaceDir: this.workspaceDir,
|
|
3191
|
+
dbPath: this.settings.store.path,
|
|
3192
|
+
provider: providerInfo.provider,
|
|
3193
|
+
model: providerInfo.model,
|
|
3194
|
+
requestedProvider: this.requestedProvider,
|
|
3195
|
+
sources: Array.from(this.sources),
|
|
3196
|
+
extraPaths: this.settings.extraPaths,
|
|
3197
|
+
sourceCounts: aggregateState.sourceCounts,
|
|
3198
|
+
cache: this.cache.enabled ? {
|
|
3199
|
+
enabled: true,
|
|
3200
|
+
entries: this.db.prepare(`SELECT COUNT(*) as c FROM ${EMBEDDING_CACHE_TABLE}`).get()?.c ?? 0,
|
|
3201
|
+
maxEntries: this.cache.maxEntries
|
|
3202
|
+
} : {
|
|
3203
|
+
enabled: false,
|
|
3204
|
+
maxEntries: this.cache.maxEntries
|
|
3205
|
+
},
|
|
3206
|
+
fts: {
|
|
3207
|
+
enabled: this.fts.enabled,
|
|
3208
|
+
available: this.fts.available,
|
|
3209
|
+
error: this.fts.loadError
|
|
3210
|
+
},
|
|
3211
|
+
fallback: this.fallbackReason ? {
|
|
3212
|
+
from: this.fallbackFrom ?? "local",
|
|
3213
|
+
reason: this.fallbackReason
|
|
3214
|
+
} : void 0,
|
|
3215
|
+
vector: {
|
|
3216
|
+
enabled: this.vector.enabled,
|
|
3217
|
+
available: this.vector.available ?? void 0,
|
|
3218
|
+
extensionPath: this.vector.extensionPath,
|
|
3219
|
+
loadError: this.vector.loadError,
|
|
3220
|
+
dims: this.vector.dims
|
|
3221
|
+
},
|
|
3222
|
+
batch: {
|
|
3223
|
+
enabled: this.batch.enabled,
|
|
3224
|
+
failures: this.batchFailureCount,
|
|
3225
|
+
limit: 2,
|
|
3226
|
+
wait: this.batch.wait,
|
|
3227
|
+
concurrency: this.batch.concurrency,
|
|
3228
|
+
pollIntervalMs: this.batch.pollIntervalMs,
|
|
3229
|
+
timeoutMs: this.batch.timeoutMs,
|
|
3230
|
+
lastError: this.batchFailureLastError,
|
|
3231
|
+
lastProvider: this.batchFailureLastProvider
|
|
3232
|
+
},
|
|
3233
|
+
custom: {
|
|
3234
|
+
searchMode: providerInfo.searchMode,
|
|
3235
|
+
providerUnavailableReason: this.providerUnavailableReason,
|
|
3236
|
+
readonlyRecovery: {
|
|
3237
|
+
attempts: this.readonlyRecoveryAttempts,
|
|
3238
|
+
successes: this.readonlyRecoverySuccesses,
|
|
3239
|
+
failures: this.readonlyRecoveryFailures,
|
|
3240
|
+
lastError: this.readonlyRecoveryLastError
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
};
|
|
3244
|
+
}
|
|
3245
|
+
async probeVectorAvailability() {
|
|
3246
|
+
if (!this.vector.enabled) return false;
|
|
3247
|
+
await this.ensureProviderInitialized();
|
|
3248
|
+
if (!this.provider) return false;
|
|
3249
|
+
return this.ensureVectorReady();
|
|
3250
|
+
}
|
|
3251
|
+
async probeEmbeddingAvailability() {
|
|
3252
|
+
await this.ensureProviderInitialized();
|
|
3253
|
+
if (!this.provider) return {
|
|
3254
|
+
ok: false,
|
|
3255
|
+
error: this.providerUnavailableReason ?? "No embedding provider available (FTS-only mode)"
|
|
3256
|
+
};
|
|
3257
|
+
try {
|
|
3258
|
+
await this.embedBatchWithRetry(["ping"]);
|
|
3259
|
+
return { ok: true };
|
|
3260
|
+
} catch (err) {
|
|
3261
|
+
return {
|
|
3262
|
+
ok: false,
|
|
3263
|
+
error: formatErrorMessage(err)
|
|
3264
|
+
};
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
async close() {
|
|
3268
|
+
if (this.closed) return;
|
|
3269
|
+
this.closed = true;
|
|
3270
|
+
const pendingSync = this.syncing;
|
|
3271
|
+
const pendingProviderInit = this.providerInitPromise;
|
|
3272
|
+
if (this.watchTimer) {
|
|
3273
|
+
clearTimeout(this.watchTimer);
|
|
3274
|
+
this.watchTimer = null;
|
|
3275
|
+
}
|
|
3276
|
+
if (this.sessionWatchTimer) {
|
|
3277
|
+
clearTimeout(this.sessionWatchTimer);
|
|
3278
|
+
this.sessionWatchTimer = null;
|
|
3279
|
+
}
|
|
3280
|
+
if (this.intervalTimer) {
|
|
3281
|
+
clearInterval(this.intervalTimer);
|
|
3282
|
+
this.intervalTimer = null;
|
|
3283
|
+
}
|
|
3284
|
+
if (this.watcher) {
|
|
3285
|
+
await this.watcher.close();
|
|
3286
|
+
this.watcher = null;
|
|
3287
|
+
}
|
|
3288
|
+
if (this.sessionUnsubscribe) {
|
|
3289
|
+
this.sessionUnsubscribe();
|
|
3290
|
+
this.sessionUnsubscribe = null;
|
|
3291
|
+
}
|
|
3292
|
+
await awaitPendingManagerWork({
|
|
3293
|
+
pendingSync,
|
|
3294
|
+
pendingProviderInit
|
|
3295
|
+
});
|
|
3296
|
+
this.db.close();
|
|
3297
|
+
INDEX_CACHE.delete(this.cacheKey);
|
|
3298
|
+
}
|
|
3299
|
+
};
|
|
3300
|
+
//#endregion
|
|
3301
|
+
export { listBuiltinAutoSelectMemoryEmbeddingProviderDoctorMetadata as a, getBuiltinMemoryEmbeddingProviderDoctorMetadata as i, closeAllMemoryIndexManagers as n, registerBuiltInMemoryEmbeddingProviders as o, createEmbeddingProvider as r, MemoryIndexManager as t };
|