kaijibot 2026.8.20 → 2026.8.21
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-BA4i4CO6.js +202 -0
- package/dist/abort-cutoff.runtime-140Dy9Z_.js +20 -0
- package/dist/abort-cutoff.runtime.js +1 -1
- package/dist/abort-primitives-DqU6syXA.js +93 -0
- package/dist/abort.runtime-D2xd_Jxq.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/account-action-gate-w2MQyrck.js +114 -0
- package/dist/acp-cli-lUerPOt4.js +2171 -0
- package/dist/acp-spawn-CKu5HWZd.js +1024 -0
- package/dist/acp-stateful-target-driver-DNcDMame.js +88 -0
- package/dist/action-agents-bNO5zlxQ.js +67 -0
- package/dist/action-focus-BQH1yzA9.js +124 -0
- package/dist/action-help-Copk6G3d.js +7 -0
- package/dist/action-info-BUV_zoSU.js +58 -0
- package/dist/action-kill-BMDz9l_U.js +33 -0
- package/dist/action-list-CxkulhYF.js +21 -0
- package/dist/action-log-D0K9-YCV.js +30 -0
- package/dist/action-send-B8ggJVwC.js +39 -0
- package/dist/action-spawn-D9kSXA_K.js +46 -0
- package/dist/action-unfocus-bI4VBonB.js +28 -0
- package/dist/agent-CdxQT19_.js +2 -0
- package/dist/agent-command-Bu_cXSEL.js +1479 -0
- package/dist/agent-list-CPYyofv7.js +67 -0
- package/dist/agent-runner-utils--p6HAP6k.js +202 -0
- package/dist/agent-runner.runtime-BossnlL1.js +2825 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agents/auth-profiles.runtime.js +1 -1
- package/dist/agents/model-catalog.runtime.js +1 -1
- package/dist/agents/models-config.runtime.js +1 -1
- package/dist/agents/pi-model-discovery-runtime.js +1 -1
- package/dist/agents-DA2-qNUI.js +887 -0
- package/dist/agents-DaKVGj9F.js +5 -0
- package/dist/allow-from-p586L6ne.js +164 -0
- package/dist/anthropic-cache-control-payload-N8EtT94O.js +28 -0
- package/dist/anthropic-payload-policy-D6dpwqVe.js +136 -0
- package/dist/anthropic-vertex-stream-CrF-fPgb.js +5666 -0
- package/dist/api-BPByI3-X.js +2 -0
- package/dist/api-BvFPt7b2.js +19 -0
- package/dist/api-C6IdzdoP.js +5 -0
- package/dist/api-CSOm-O9I.js +5 -0
- package/dist/api-ChQfiSmG.js +4 -0
- package/dist/api-Cm3n-2Iw.js +3 -0
- package/dist/api-CqBQhm6r.js +2 -0
- package/dist/api-D7SjdU34.js +4 -0
- package/dist/api-D7qSjVDS.js +3 -0
- package/dist/api-DbRoXBTn.js +45 -0
- package/dist/api-_HshnS5J.js +35 -0
- package/dist/apply-G86rau7x.js +493 -0
- package/dist/apply.runtime-BoYc09wu.js +166 -0
- package/dist/apply.runtime-Dmh02lO-.js +2 -0
- package/dist/apply.runtime.js +1 -1
- package/dist/approval-gateway-resolver-bdX78er-.js +58 -0
- package/dist/approval-gateway-runtime-CJm68vrp.js +2 -0
- package/dist/approval-handler-runtime-CT08B2_a.js +439 -0
- package/dist/approval-native-helpers-DagoPLtW.js +33 -0
- package/dist/approval-native-runtime-CN4meUkM.js +709 -0
- package/dist/approval-renderers-CnmO8wke.js +64 -0
- package/dist/asr-Cz-FH-3c.js +196 -0
- package/dist/audit-Cbfv4nmn.js +885 -0
- package/dist/audit-extra.async-DQv_s9K0.js +847 -0
- package/dist/audit.deep.runtime-CAPtrWg1.js +2 -0
- package/dist/audit.deep.runtime.js +1 -1
- package/dist/audit.nondeep.runtime-HUJ6INiD.js +859 -0
- package/dist/audit.nondeep.runtime.js +1 -1
- package/dist/audit.runtime-CAKbHyXK.js +7 -0
- package/dist/audit.runtime.js +1 -1
- package/dist/auth-CRAwpkC_.js +181 -0
- package/dist/auth-choice-Bhps2D29.js +3 -0
- package/dist/auth-choice-kMIs0xTd.js +71 -0
- package/dist/auth-choice-vRXPONqL.js +353 -0
- package/dist/auth-choice.apply-helpers-D6x2bWVB.js +2 -0
- package/dist/auth-profiles.runtime.js +1 -1
- package/dist/binding-routing-C6_mrNEN.js +50 -0
- package/dist/binding-targets-Cq2e7wRT.js +99 -0
- package/dist/block-streaming-BTtPFYsM.js +103 -0
- package/dist/bootstrap-files-DsmC0cJP.js +206 -0
- package/dist/bridge-server-Co3awCAM.js +103 -0
- package/dist/browser-node-runtime-D8xut4fJ.js +12 -0
- package/dist/browser-open-BzpYLaas.js +94 -0
- package/dist/browser-runtime-BBkGI01q.js +377 -0
- package/dist/browser-security-runtime-CzhzXJ8D.js +10 -0
- package/dist/browser-setup-tools-CD_s48fd.js +12 -0
- package/dist/btw-command-Bgn_NviR.js +17 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +4 -4
- package/dist/bundled/session-memory/handler.js +3 -3
- package/dist/call-CiUZqjsN.js +2 -0
- package/dist/call-k_nZXTJ3.js +495 -0
- package/dist/call.runtime-CZI7yxSF.js +2 -0
- package/dist/call.runtime.js +1 -1
- package/dist/capability-cli-CIm_YhHH.js +1357 -0
- package/dist/catalog-provider-Ch4CMHLl.js +40 -0
- package/dist/cdp.helpers-BVl3YwYe.js +372 -0
- package/dist/channel-config-helpers-BO9yY1Zu.js +462 -0
- package/dist/channel-core-BB7pTANC.js +5 -0
- package/dist/channel-feedback-c7a-Gb7w.js +259 -0
- package/dist/channel-plugin-resolution-DHgXIZV6.js +146 -0
- package/dist/channel-policy-DO-ZWErE.js +270 -0
- package/dist/channel-reply-pipeline-2KImYC85.js +26 -0
- package/dist/channel-runtime-Bqn7zFyT.js +6 -0
- package/dist/channel.runtime-2WY9MkoH.js +399 -0
- package/dist/channel.runtime.js +1 -1
- package/dist/channels-D66hRVnR.js +1147 -0
- package/dist/channels-cli-0DjAVaKh.js +248 -0
- package/dist/chat-Fv3LkEfF.js +213 -0
- package/dist/chat-history-text-CZhwQ5__.js +42 -0
- package/dist/chrome-CEE9kYYR.js +1080 -0
- package/dist/chrome.executables-Dp7W-RgV.js +550 -0
- package/dist/chunk-B9X-O7Vw.js +267 -0
- package/dist/clack-prompter-BSVVLa7H.js +113 -0
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/cli-BsNkLoFI.js +57 -0
- package/dist/cli-DQH9X5IE.js +2 -0
- package/dist/cli-DuoVlLKx.js +154 -0
- package/dist/cli-auth-seam-BrijKBRQ.js +14 -0
- package/dist/cli-backend-CIs4F7ip.js +66 -0
- package/dist/cli-migration-CVktTGRI.js +127 -0
- package/dist/cli-runner-12iECISR.js +1662 -0
- package/dist/cli-runner.runtime-C5noDuQ-.js +3 -0
- package/dist/cli-runner.runtime-YrAg_h19.js +2 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-runtime-wB1rYZco.js +3 -0
- package/dist/cli-shared-BUW2okV2.js +142 -0
- package/dist/cli-startup-metadata.json +1 -1
- package/dist/cli.runtime-Bhxt80sB.js +819 -0
- package/dist/cli.runtime.js +1 -1
- package/dist/client-bootstrap-BWo-ZK_j.js +28 -0
- package/dist/command-auth-Dlrd5CYD.js +75 -0
- package/dist/command-config-resolution-B8pxzh3W.js +2 -0
- package/dist/command-config-resolution-BXSCDJTh.js +23 -0
- package/dist/command-detection-DFlZHBMC.js +50 -0
- package/dist/command-execution-startup-DYXpKpvc.js +269 -0
- package/dist/command-format-JYoGhCek.js +2 -0
- package/dist/command-registry-BF51N12E.js +3 -0
- package/dist/command-registry-BqpfCBbW.js +113 -0
- package/dist/command-secret-gateway-DuuctECr.js +528 -0
- package/dist/command-status-builders-CnD1rvYb.js +145 -0
- package/dist/commands-acp-DiLJUV45.js +1017 -0
- package/dist/commands-compact.runtime-BOM8PsWH.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-context-C-jRwdK3.js +34 -0
- package/dist/commands-core.runtime-CH_aGeT-.js +2 -0
- package/dist/commands-core.runtime.js +1 -1
- package/dist/commands-handlers.runtime-Ca6xoeW5.js +3762 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-models-CRURuXR-.js +306 -0
- package/dist/commands-registry-CJw_6JDj.js +295 -0
- package/dist/commands-registry.runtime-78mbU8Il.js +2 -0
- package/dist/commands-registry.runtime.js +1 -1
- package/dist/commands-reset-hooks-D3RzsOIn.js +129 -0
- package/dist/commands-status-Cufj4x2j.js +223 -0
- package/dist/commands-status.runtime-C8Nz4Glk.js +2 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-DjhcmoRT.js +3 -0
- package/dist/commands-subagents-control.runtime-s_DYQWfW.js +2 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands.runtime-ChfYOBeV.js +103 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/comment-shared-DFEZzqhH.js +40 -0
- package/dist/compact-DEsHFhEL.js +11324 -0
- package/dist/compact.runtime-BzLFUSmk.js +7 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-CiWtzUFQ.js +2 -0
- package/dist/completion-cli-h3zgpXGM.js +468 -0
- package/dist/config-Bd1PtH4x.js +166 -0
- package/dist/config-cli-BiEmyiRa.js +948 -0
- package/dist/config-defaults-Bw9wwyo1.js +163 -0
- package/dist/config-guard-BGGjXg_Y.js +94 -0
- package/dist/config-runtime-Bvdi0W59.js +14 -0
- package/dist/config-validation-BDeuMlc1.js +279 -0
- package/dist/configure-CUSDnrHs.js +2 -0
- package/dist/configure-FDqT3i_9.js +1162 -0
- package/dist/connection-auth-7izNv08V.js +30 -0
- package/dist/context-B2wCjR9D.js +249 -0
- package/dist/context-n8ANhlMJ.js +2 -0
- package/dist/context-visibility-d6FHLhsq.js +14 -0
- package/dist/context-writer-COhxMkVz.js +290 -0
- package/dist/control-auth-Csa4b5CR.js +122 -0
- package/dist/control-ui-links-tILfT2Ek.js +70 -0
- package/dist/conversation-id-d7KXWjzV.js +140 -0
- package/dist/conversation-runtime-D-YmpVS2.js +31 -0
- package/dist/core-8TPCsNB-.js +210 -0
- package/dist/cron-cli-C5ok2iVK.js +637 -0
- package/dist/daemon-cli-Cr_y38yv.js +476 -0
- package/dist/daemon-install-CrhzPiZ-.js +70 -0
- package/dist/delegate-r3VqUt34.js +61 -0
- package/dist/deliver-Cuu36rnv.js +3 -0
- package/dist/deliver-SAyi_F0e.js +782 -0
- package/dist/deliver-runtime-DKv9J6QE.js +2 -0
- package/dist/delivery-outbound.runtime-DDoInTnF.js +6 -0
- package/dist/delivery-outbound.runtime.js +1 -1
- package/dist/delivery-queue-CWi3kUit.js +372 -0
- package/dist/delivery-queue-ecSu6ZNL.js +2 -0
- package/dist/device-bootstrap---geQnCr.js +4 -0
- package/dist/device-bootstrap-BEWox6at.js +248 -0
- package/dist/device-bootstrap-profile-BR1NnTGX.js +36 -0
- package/dist/device-identity-huL1Exh1.js +2 -0
- package/dist/device-pairing-DSkkI5A-.js +600 -0
- package/dist/devices-cli-BUAuMOOj.js +336 -0
- package/dist/diagnostics-Bh0Gbi4L.js +33 -0
- package/dist/diagnostics-BsUG_otQ.js +2 -0
- package/dist/direct-dm-D_7_vKGq.js +139 -0
- package/dist/directive-handling.fast-lane-C91i_iZm.js +2 -0
- package/dist/directive-handling.fast-lane-F7l0XNwG.js +64 -0
- package/dist/directive-handling.impl-8RAWZiZE.js +659 -0
- package/dist/directive-handling.impl-BxAIWFS-.js +2 -0
- package/dist/directive-handling.parse-B3O0CfXY.js +376 -0
- package/dist/directive-handling.persist-QXt7GHcD.js +139 -0
- package/dist/directive-handling.persist.runtime-CPPm2qYQ.js +2 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/directive-handling.shared-C5ywsGJd.js +159 -0
- package/dist/directory-cli-D9v1dSPr.js +240 -0
- package/dist/dispatch-DoyBs65s.js +1126 -0
- package/dist/dispatch-acp-Dz8rU6t9.js +969 -0
- package/dist/dispatch-acp-command-bypass-CJ5xdqXR.js +38 -0
- package/dist/dispatch-acp-manager.runtime-tPUGDjl3.js +3 -0
- package/dist/dispatch-acp-manager.runtime.js +1 -1
- package/dist/dispatch-acp-media.runtime-rwYN3ewY.js +3 -0
- package/dist/dispatch-acp-media.runtime.js +1 -1
- package/dist/dispatch-acp-session.runtime-C9nyGih8.js +2 -0
- package/dist/dispatch-acp-session.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-Co-JFuKU.js +19 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/docker-TZx6u2PT.js +826 -0
- package/dist/doctor-completion-C46W5KI7.js +90 -0
- package/dist/doctor-config-preflight-B_UDrFsE.js +148 -0
- package/dist/doctor-config-preflight-DtvhOeuT.js +2 -0
- package/dist/doctor-state-migrations-Cd3yfnI1.js +2 -0
- package/dist/doctor-state-migrations-D3qorqjy.js +3 -0
- package/dist/drive-C2mxxJx5.js +718 -0
- package/dist/embedding-provider-C5S1sxvR.js +129 -0
- package/dist/embedding-provider-CNDA2uD3.js +26 -0
- package/dist/embedding-provider-CdVS1B85.js +33 -0
- package/dist/engine-CKgZ1obQ.js +82 -0
- package/dist/engine-embeddings-Bt1bTxtw.js +1489 -0
- package/dist/entry-capabilities-DrciJZn1.js +89 -0
- package/dist/entry.js +1 -1
- package/dist/exec-approval-forwarder.runtime-Dpa8Gi_P.js +3 -0
- package/dist/exec-approval-forwarder.runtime.js +1 -1
- package/dist/exec-approval-session-target-BYtddDF5.js +165 -0
- package/dist/exec-approvals-cli-BuOJPaPp.js +485 -0
- package/dist/exec-defaults-B5egc-6t.js +1440 -0
- package/dist/extensionAPI.js +5 -5
- 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/replay-policy.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 +3 -3
- 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 +4 -4
- 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 +4 -4
- package/dist/extensions/browser/browser-control-auth.js +1 -1
- package/dist/extensions/browser/browser-doctor.js +5 -5
- 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 +2 -2
- package/dist/extensions/browser/browser-runtime-api.js +12 -12
- 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 +13 -13
- package/dist/extensions/browser/setup-api.js +2 -2
- package/dist/extensions/browser/test-support.js +1 -1
- 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 +9 -9
- 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 +4 -4
- package/dist/extensions/deepinfra/api.js +8 -8
- package/dist/extensions/deepinfra/embedding-provider.js +2 -2
- package/dist/extensions/deepinfra/image-generation-provider.js +1 -1
- package/dist/extensions/deepinfra/index.js +9 -9
- package/dist/extensions/deepinfra/media-models.js +2 -2
- package/dist/extensions/deepinfra/media-understanding-provider.js +1 -1
- package/dist/extensions/deepinfra/memory-embedding-adapter.js +1 -1
- package/dist/extensions/deepinfra/onboard.js +2 -2
- package/dist/extensions/deepinfra/provider-catalog.js +1 -1
- package/dist/extensions/deepinfra/provider-models.js +1 -1
- package/dist/extensions/deepinfra/speech-provider.js +1 -1
- package/dist/extensions/deepinfra/video-generation-provider.js +1 -1
- package/dist/extensions/deepseek/index.js +3 -3
- package/dist/extensions/device-pair/api.js +6 -6
- package/dist/extensions/device-pair/index.js +9 -9
- 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/exa/index.js +4 -4
- package/dist/extensions/feishu/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/feishu/api.js +21 -21
- package/dist/extensions/feishu/contract-api.js +2 -2
- package/dist/extensions/feishu/runtime-api.js +4 -4
- 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 +4 -4
- package/dist/extensions/fireworks/stream.js +1 -1
- package/dist/extensions/github-copilot/api.js +1 -1
- package/dist/extensions/github-copilot/index.js +5 -5
- 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 +4 -4
- package/dist/extensions/github-copilot/replay-policy.js +1 -1
- package/dist/extensions/github-copilot/stream.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/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.http.js +1 -1
- package/dist/extensions/google/oauth.js +2 -2
- package/dist/extensions/google/oauth.project.js +1 -1
- 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-contract-api.js +1 -1
- package/dist/extensions/google/web-search-provider.js +1 -1
- package/dist/extensions/gradium/index.js +1 -1
- package/dist/extensions/gradium/speech-provider.js +1 -1
- package/dist/extensions/gradium/tts.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 +2 -2
- package/dist/extensions/image-generation-core/runtime-api.js +2 -2
- package/dist/extensions/kilocode/api.js +2 -2
- package/dist/extensions/kilocode/index.js +8 -8
- 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 +4 -4
- package/dist/extensions/kindle-portal/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/knowledge-wiki/index.js +2 -2
- package/dist/extensions/litellm/index.js +1 -1
- package/dist/extensions/llm-task/index.js +1 -1
- package/dist/extensions/lmstudio/api.js +4 -4
- package/dist/extensions/lmstudio/index.js +3 -3
- 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 +12 -12
- package/dist/extensions/memory-core/manager-runtime.js +1 -1
- package/dist/extensions/memory-core/runtime-api.js +5 -5
- package/dist/extensions/memory-lancedb/cli-metadata.js +1 -1
- package/dist/extensions/memory-lancedb/index.js +3 -3
- 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-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/video-generation-provider.js +1 -1
- package/dist/extensions/minimax/web-search-contract-api.js +1 -1
- package/dist/extensions/minimax/web-search-provider.js +1 -1
- package/dist/extensions/mistral/embedding-provider.js +1 -1
- package/dist/extensions/mistral/index.js +3 -3
- package/dist/extensions/mistral/media-understanding-provider.js +1 -1
- package/dist/extensions/mistral/memory-embedding-adapter.js +3 -3
- package/dist/extensions/mistral/provider-compat.js +1 -1
- package/dist/extensions/mistral/test-api.js +1 -1
- package/dist/extensions/moonshot/api.js +3 -3
- package/dist/extensions/moonshot/index.js +9 -9
- 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-contract-api.js +1 -1
- package/dist/extensions/moonshot/web-search-provider.js +1 -1
- package/dist/extensions/nvidia/index.js +1 -1
- package/dist/extensions/ollama/api.js +4 -4
- package/dist/extensions/ollama/index.js +8 -8
- package/dist/extensions/ollama/provider-discovery.js +1 -1
- package/dist/extensions/ollama/runtime-api.js +2 -2
- package/dist/extensions/ollama/web-search-contract-api.js +1 -1
- package/dist/extensions/ollama/web-search-provider.js +1 -1
- package/dist/extensions/openai/api.js +3 -3
- package/dist/extensions/openai/image-generation-provider.js +1 -1
- package/dist/extensions/openai/index.js +9 -9
- 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-cli-auth.js +1 -1
- package/dist/extensions/openai/openai-codex-provider.js +1 -1
- package/dist/extensions/openai/openai-codex-provider.runtime.js +2 -2
- 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 +8 -8
- package/dist/extensions/openai/shared.js +3 -3
- package/dist/extensions/openai/speech-provider.js +1 -1
- package/dist/extensions/openai/test-api.js +5 -5
- package/dist/extensions/openai/transport-policy.js +1 -1
- package/dist/extensions/openai/video-generation-provider.js +1 -1
- package/dist/extensions/opencode/index.js +4 -4
- package/dist/extensions/opencode-go/index.js +3 -3
- package/dist/extensions/openrouter/api.js +2 -2
- 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/music-generation-provider.js +1 -1
- package/dist/extensions/openrouter/stream.js +1 -1
- package/dist/extensions/openrouter/test-api.js +3 -3
- package/dist/extensions/openrouter/video-generation-provider.js +6 -6
- 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/index.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/sherpa-speech/asr.js +1 -1
- package/dist/extensions/sherpa-speech/engine.js +1 -1
- package/dist/extensions/sherpa-speech/index.js +1 -1
- package/dist/extensions/speech-core/api.js +3 -3
- package/dist/extensions/speech-core/runtime-api.js +5 -5
- package/dist/extensions/stepfun/index.js +2 -2
- package/dist/extensions/talk-voice/index.js +2 -2
- package/dist/extensions/tavily/index.js +5 -5
- package/dist/extensions/together/index.js +1 -1
- package/dist/extensions/together/video-generation-provider.js +4 -4
- package/dist/extensions/venice/api.js +3 -3
- package/dist/extensions/venice/index.js +6 -6
- 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 +2 -2
- package/dist/extensions/vercel-ai-gateway/index.js +2 -2
- package/dist/extensions/vercel-ai-gateway/models.js +1 -1
- package/dist/extensions/vercel-ai-gateway/provider-catalog.js +1 -1
- package/dist/extensions/volcengine/index.js +2 -2
- package/dist/extensions/vydra/image-generation-provider.js +1 -1
- package/dist/extensions/vydra/index.js +5 -5
- 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 +4 -4
- package/dist/extensions/webhooks/runtime-api.js +1 -1
- package/dist/extensions/wechat/api.js +3 -3
- package/dist/extensions/xai/api.js +6 -6
- package/dist/extensions/xai/code-execution.js +5 -5
- package/dist/extensions/xai/index.js +14 -14
- package/dist/extensions/xai/model-definitions.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-contract-api.js +1 -1
- package/dist/extensions/xai/web-search.js +1 -1
- package/dist/extensions/xai/x-search.js +5 -5
- package/dist/extensions/xiaomi/index.js +1 -1
- package/dist/extensions/zai/index.js +7 -7
- package/dist/extensions/zai/media-understanding-provider.js +1 -1
- package/dist/extensions/zai/test-api.js +1 -1
- package/dist/extra-params-Bfdm7Piq.js +295 -0
- package/dist/fetch-4HO0k3hc.js +65 -0
- package/dist/fetch-guard-BWtRcc5b.js +224 -0
- package/dist/fetch-jNI8hIPZ.js +256 -0
- package/dist/format-KzNAm6y6.js +245 -0
- package/dist/fragment-collector-DEW1fwlc.js +189 -0
- package/dist/gateway-CR7RtTbI.js +2 -0
- package/dist/gateway-CuQC7wph.js +119 -0
- package/dist/gateway-cli-CWHsIpm8.js +1532 -0
- package/dist/gateway-install-token-CcpoWcqs.js +284 -0
- package/dist/gateway-lock-B4umteJZ.js +238 -0
- package/dist/gateway-rpc-Do_3fQSm.js +14 -0
- package/dist/gateway-rpc.runtime-C4kzyrJj.js +23 -0
- package/dist/gateway-rpc.runtime.js +1 -1
- package/dist/gemini-cli-provider-YULRMcs8.js +106 -0
- package/dist/gemini-web-search-provider-D_QJZMM3.js +167 -0
- package/dist/get-reply-from-config.runtime-BpdriKtr.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/group-policy-BxTxJeKP.js +202 -0
- package/dist/health-B5YmS_bW.js +2 -0
- package/dist/health-CQ4zXQ-2.js +579 -0
- package/dist/heartbeat-B1UJqney.js +184 -0
- package/dist/heartbeat-runner--rVDmB2Z.js +1365 -0
- package/dist/heartbeat-runner-CwtXIPI-.js +4 -0
- package/dist/heartbeat-runner.runtime-D_5UeAsX.js +2 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/heartbeat-summary-Cf17FCYf.js +58 -0
- package/dist/heartbeat-visibility-BpEZ4Xf-.js +86 -0
- package/dist/hooks-cli-BGDBJqzt.js +364 -0
- package/dist/identity-Bwhl61jK.js +30 -0
- package/dist/identity-avatar-Bu5l4dFW.js +87 -0
- package/dist/image-DiK7kcmJ.js +152 -0
- package/dist/image-generation-core-Cwutmg_V.js +17 -0
- package/dist/image-generation-core.auth.runtime-DA7XD5V2.js +2 -0
- package/dist/image-generation-core.auth.runtime.js +1 -1
- package/dist/image-generation-provider-B-0SxnvJ.js +280 -0
- package/dist/image-generation-provider-B-UW3NU_.js +94 -0
- package/dist/image-generation-provider-BR1_oIU4.js +130 -0
- package/dist/image-generation-provider-BvAaZO7K.js +86 -0
- package/dist/image-generation-provider-CnGMLnE9.js +163 -0
- package/dist/image-generation-provider-DHvw6TSJ.js +136 -0
- package/dist/image-generation-runtime-DCWf9P6F.js +2 -0
- package/dist/image-runtime-DGNzvqkb.js +7 -0
- package/dist/images-BwT2L5zh.js +586 -0
- package/dist/inbound-reply-dispatch-DgEqNffL.js +73 -0
- package/dist/inbound.runtime-CloYEZJO.js +4 -0
- package/dist/inbound.runtime-DLbKJWOY.js +3 -0
- package/dist/inbound.runtime.js +1 -1
- package/dist/index.js +2 -2
- package/dist/infra-runtime-DE-Vi3Dn.js +25 -0
- package/dist/ingest-DbZJju1a.js +842 -0
- package/dist/ingest-Dyj9M3ZM.js +2 -0
- package/dist/input-files-tzSehEsO.js +252 -0
- package/dist/inspect-_4i1jBjC.js +2 -0
- package/dist/inspect-dprTBmSB.js +282 -0
- package/dist/issue-format-CoEMThLD.js +2 -0
- package/dist/kaijibot-tools-Df_9YJcO.js +9434 -0
- package/dist/kaijibot-tools.runtime-CZId-V1O.js +2 -0
- package/dist/kaijibot-tools.runtime.js +1 -1
- package/dist/kill-tree-DerqhtJm.js +2 -0
- package/dist/kimi-web-search-provider-DunVVASJ.js +308 -0
- package/dist/launchd-Bh7KL8au.js +556 -0
- package/dist/library-BqMFzJMy.js +45 -0
- package/dist/lifecycle-core-DD_IXtH-.js +422 -0
- package/dist/list.runtime-DU0ctAjd.js +12 -0
- package/dist/list.runtime-DXWlaAJq.js +9 -0
- package/dist/list.runtime.js +1 -1
- package/dist/llm-engine-CMR9RxLA.js +1792 -0
- package/dist/llm-engine-VKRjaGY_.js +2 -0
- package/dist/llm-extractor-BCPvoWmb.js +445 -0
- package/dist/llm-slug-generator.js +2 -2
- package/dist/login-Dex1JqnY.js +108 -0
- package/dist/logs-cli-BZFJyrsk.js +264 -0
- package/dist/logs-cli.runtime-bBS2Sbi6.js +2 -0
- package/dist/logs-cli.runtime.js +1 -1
- package/dist/manager-BmS2ofc4.js +2049 -0
- package/dist/manager-CabVEPeE.js +3314 -0
- package/dist/markdown-tables-DyVly8kN.js +51 -0
- package/dist/mcp-cli-DGrmbpsu.js +733 -0
- package/dist/media-models-Dw0Y1LxG.js +49 -0
- package/dist/media-runtime-CAa8uHqv.js +312 -0
- package/dist/media-understanding-D_VRj6xY.js +83 -0
- package/dist/media-understanding-provider-B9Jfjq6L.js +13 -0
- package/dist/media-understanding-provider-BWksuEBw.js +30 -0
- package/dist/media-understanding-provider-Bhtq5Kpe.js +14 -0
- package/dist/media-understanding-provider-BzsmDAMk.js +67 -0
- package/dist/media-understanding-provider-C6_6yxvP.js +123 -0
- package/dist/media-understanding-provider-CdRlAb9s.js +18 -0
- package/dist/media-understanding-provider-D5m-2RW8.js +21 -0
- package/dist/media-understanding-provider-PmVmfI6p.js +112 -0
- package/dist/media-understanding-provider-cmLTPd8x.js +18 -0
- package/dist/media-understanding-provider-nPxfFv8l.js +37 -0
- package/dist/media-understanding-provider-yp9gxov6.js +69 -0
- package/dist/media-understanding-runtime-Bu7m-lVs.js +2 -0
- package/dist/memory-5jlpYBqx.js +242 -0
- package/dist/memory-BFKl6oSn.js +3 -0
- package/dist/memory-core-host-engine-embeddings-p06288xV.js +2 -0
- package/dist/memory-core-host-runtime-cli-BnvAiNzO.js +9 -0
- package/dist/memory-core-host-runtime-core-CnVg69Uw.js +8 -0
- package/dist/memory-embedding-adapter-Cux48Bvk.js +33 -0
- package/dist/memory-index-DSbV_yD0.js +2 -0
- package/dist/memory-index-EFkCRTeh.js +514 -0
- package/dist/message-CMCdNyAT.js +223 -0
- package/dist/message-action-runner-CG2CcWaS.js +1628 -0
- package/dist/message-action-runner-DUZQ7nmt.js +2 -0
- package/dist/message.gateway.runtime-COLMRCv4.js +2 -0
- package/dist/message.gateway.runtime.js +1 -1
- package/dist/method-scopes-BNjBMlqM.js +2883 -0
- package/dist/minimax-vlm-D1DbVSjC.js +183 -0
- package/dist/minimax-web-search-provider-BzgvahXM.js +165 -0
- package/dist/mmr-Clamw4uq.js +146 -0
- package/dist/model-CJIbRRp9.js +630 -0
- package/dist/model-auth-BQpkMtoP.js +427 -0
- package/dist/model-auth-env-BWJjZ_uc.js +53 -0
- package/dist/model-auth-env-CZXe-GO2.js +2 -0
- package/dist/model-auth-label-dLSkL9EI.js +45 -0
- package/dist/model-catalog-DgqowW_L.js +204 -0
- package/dist/model-definitions-BOTIDDWJ.js +258 -0
- package/dist/model-definitions-mx0Ogg9X.js +74 -0
- package/dist/model-discovery-live.runtime-D2J8zvfK.js +419 -0
- package/dist/model-discovery-live.runtime.js +1 -1
- package/dist/model-discovery-modelsdev-BKijFiV8.js +174 -0
- package/dist/model-picker-B4SuA28P.js +3 -0
- package/dist/model-picker-buwrc8kM.js +500 -0
- package/dist/model-picker.runtime-DXgS2Rab.js +15 -0
- package/dist/model-picker.runtime.js +1 -1
- package/dist/model-selection-CBuo2hSg.js +381 -0
- package/dist/models-BmveqjOE.js +126 -0
- package/dist/models-BucP8NI1.js +760 -0
- package/dist/models-C4-eAnR7.js +157 -0
- package/dist/models-DMLYOe4h.js +2 -0
- package/dist/models-DNNfkS3j.js +2584 -0
- package/dist/models-D_V6hTy-.js +166 -0
- package/dist/models-DkiHZi9S.js +47 -0
- package/dist/models-OhM18fW_.js +555 -0
- package/dist/models-cli-CfvtZXPd.js +198 -0
- package/dist/models-config-BLMZzgfx.js +900 -0
- package/dist/models-config.providers.secrets-rjdH8T5l.js +299 -0
- package/dist/models.fetch-D1o7sMO8.js +518 -0
- package/dist/monitor-CJdL31iS.js +4435 -0
- package/dist/monitor-DB732mUY.js +1023 -0
- package/dist/music-generation-provider-BrUTQBmG.js +169 -0
- package/dist/music-generation-provider-D6aYWSSm.js +238 -0
- package/dist/music-generation-provider-dpX_Oiuw.js +142 -0
- package/dist/node-cli-BSrC37hh.js +2374 -0
- package/dist/node-command-policy-J_sy6jJz.js +205 -0
- package/dist/node-service-Bz1OVtIc.js +69 -0
- package/dist/nodes-cli-uwgDIsqv.js +1046 -0
- package/dist/nodes-screen-EQaXZCHa.js +216 -0
- package/dist/nodes-utils-ChvZvxK1.js +196 -0
- package/dist/nodes.helpers-WGb2Q8DZ.js +34 -0
- package/dist/normalize-reply-B7T9vV8x.js +72 -0
- package/dist/note-9YcA8RtG.js +110 -0
- package/dist/notify-C9-q0Rdu.js +305 -0
- package/dist/oauth-CVAbqwnx.js +152 -0
- package/dist/oauth-RbN-L8pg.js +57 -0
- package/dist/oauth-token-shared-CCzflFLG.js +28 -0
- package/dist/oauth.credentials-BeCOUsTe.js +165 -0
- package/dist/oauth.flow-C2PFyq_h.js +122 -0
- package/dist/oauth.http-BgZeCfvj.js +23 -0
- package/dist/oauth.project-jFMmutMJ.js +123 -0
- package/dist/oauth.settings-CBmYrmAk.js +44 -0
- package/dist/oauth.token-DSow_5Ie.js +43 -0
- package/dist/onboard-8SmAjhIH.js +67 -0
- package/dist/onboard-B-ZJptUZ.js +25 -0
- package/dist/onboard-Beu-mw_-.js +29 -0
- package/dist/onboard-BzUrcgZ5.js +25 -0
- package/dist/onboard-CPuf8esc.js +25 -0
- package/dist/onboard-CR4uUkKJ.js +36 -0
- package/dist/onboard-CTfex1XR2.js +58 -0
- package/dist/onboard-Cksl3HNo.js +54 -0
- package/dist/onboard-D-ccZlbM.js +312 -0
- package/dist/onboard-DHXNhsF7.js +621 -0
- package/dist/onboard-Dd6X5k1s.js +25 -0
- package/dist/onboard-custom-9KIp_ybR.js +647 -0
- package/dist/onboard-custom-CbXUFVN6.js +2 -0
- package/dist/onboard-helpers-BFknCN7m.js +223 -0
- package/dist/onboard-helpers-DSJ_xWpL.js +5 -0
- package/dist/onboard-remote-C28pAu4b.js +193 -0
- package/dist/onboard-remote-DQxyE18D.js +2 -0
- package/dist/onboard-skills-B642NK1o.js +2 -0
- package/dist/onboard-skills-CI4B6Kx5.js +134 -0
- package/dist/openai-codex-auth-identity-PqpqYz4a.js +45 -0
- package/dist/openai-codex-cli-auth-cFTkwXjR.js +57 -0
- package/dist/openai-codex-provider-DjUpM_l9.js +299 -0
- package/dist/openai-codex-shared-o0pq7UkS.js +6 -0
- package/dist/openai-provider-ChZN4Q0c.js +283 -0
- package/dist/openai-transport-stream-DXBBlxJ9.js +1632 -0
- package/dist/operator-approvals-client-RJESCyw4.js +68 -0
- package/dist/outbound-runtime-Bhs-eGEn.js +2 -0
- package/dist/pair-command-approve-5Jr6xo-1.js +34 -0
- package/dist/parse-DH0T3Cu9.js +168 -0
- package/dist/perplexity-web-search-provider-DqEogUCL.js +92 -0
- package/dist/perplexity-web-search-provider.runtime-Clsvb0kX.js +332 -0
- package/dist/perplexity-web-search-provider.runtime-bOr3A0b4.js +2 -0
- package/dist/perplexity-web-search-provider.runtime.js +1 -1
- package/dist/perplexity-web-search-provider.shared-DzXnzvHH.js +73 -0
- package/dist/persistent-bindings.lifecycle-CjXEQUMz.js +94 -0
- package/dist/pi-embedded-Cp3OIZy9.js +2 -0
- package/dist/pi-embedded-DJN2vlNF.js +6 -0
- package/dist/pi-embedded-runner-DXHhhGRS.js +8348 -0
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime-D1jUEg-R.js +23 -0
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime.js +1 -1
- package/dist/pi-embedded-utils-CtraRgVx.js +212 -0
- package/dist/pi-embedded.runtime-DQPfEvkF.js +5 -0
- package/dist/pi-embedded.runtime.js +1 -1
- package/dist/pi-model-discovery-B9q9ykaA.js +232 -0
- package/dist/plugin-enabled-CMdiRqJS.js +71 -0
- package/dist/plugin-registration-BhPJI7wp.js +23 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/account-core.js +2 -2
- package/dist/plugin-sdk/account-helpers.js +1 -1
- package/dist/plugin-sdk/account-resolution.js +2 -2
- 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 +8 -8
- package/dist/plugin-sdk/agent-runtime.js +11 -11
- package/dist/plugin-sdk/allow-from.js +1 -1
- package/dist/plugin-sdk/approval-gateway-runtime.js +2 -2
- package/dist/plugin-sdk/approval-handler-runtime.js +3 -3
- package/dist/plugin-sdk/approval-native-runtime.js +2 -2
- package/dist/plugin-sdk/approval-reply-runtime.js +1 -1
- package/dist/plugin-sdk/approval-runtime.js +5 -5
- package/dist/plugin-sdk/browser-node-runtime.js +5 -5
- package/dist/plugin-sdk/browser-security-runtime.js +2 -2
- package/dist/plugin-sdk/browser-setup-tools.js +3 -3
- package/dist/plugin-sdk/browser-support.js +10 -10
- package/dist/plugin-sdk/channel-config-helpers.js +1 -1
- package/dist/plugin-sdk/channel-config-writes.js +1 -1
- package/dist/plugin-sdk/channel-core.js +2 -2
- package/dist/plugin-sdk/channel-feedback.js +2 -2
- package/dist/plugin-sdk/channel-inbound.js +4 -4
- package/dist/plugin-sdk/channel-message.js +2 -2
- package/dist/plugin-sdk/channel-policy.js +2 -2
- package/dist/plugin-sdk/channel-reply-pipeline.js +2 -2
- package/dist/plugin-sdk/channel-runtime.js +4 -4
- package/dist/plugin-sdk/channel-setup.js +1 -1
- package/dist/plugin-sdk/cli-runtime.js +2 -2
- package/dist/plugin-sdk/command-auth-native.js +1 -1
- package/dist/plugin-sdk/command-auth.js +6 -6
- package/dist/plugin-sdk/command-detection.js +1 -1
- package/dist/plugin-sdk/command-status.js +1 -1
- package/dist/plugin-sdk/command-surface.js +1 -1
- package/dist/plugin-sdk/compat.js +5 -5
- package/dist/plugin-sdk/config-mutation.js +1 -1
- package/dist/plugin-sdk/config-runtime.js +8 -8
- 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 +4 -4
- package/dist/plugin-sdk/device-bootstrap.js +4 -4
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/extension-shared.js +1 -1
- package/dist/plugin-sdk/feishu.js +5 -5
- package/dist/plugin-sdk/fetch-runtime.js +2 -2
- package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
- package/dist/plugin-sdk/gateway-runtime.js +2 -2
- package/dist/plugin-sdk/generate-text.js +1 -1
- package/dist/plugin-sdk/image-generation-core.js +2 -2
- package/dist/plugin-sdk/image-generation-runtime.js +2 -2
- 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 +16 -16
- package/dist/plugin-sdk/markdown-table-runtime.js +1 -1
- package/dist/plugin-sdk/media-generation-runtime-shared.js +1 -1
- package/dist/plugin-sdk/media-generation-runtime.js +1 -1
- package/dist/plugin-sdk/media-runtime.js +7 -7
- 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-engine-embeddings.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-foundation.js +1 -1
- package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
- package/dist/plugin-sdk/memory-core-host-runtime-core.js +2 -2
- package/dist/plugin-sdk/memory-core.js +4 -4
- package/dist/plugin-sdk/memory-host-core.js +2 -2
- package/dist/plugin-sdk/models-provider-runtime.js +1 -1
- package/dist/plugin-sdk/native-command-registry.js +1 -1
- package/dist/plugin-sdk/outbound-media.js +2 -2
- package/dist/plugin-sdk/outbound-runtime.js +2 -2
- package/dist/plugin-sdk/plugin-test-runtime.js +2 -2
- package/dist/plugin-sdk/provider-auth-api-key.js +3 -3
- package/dist/plugin-sdk/provider-auth-login.js +1 -1
- package/dist/plugin-sdk/provider-auth-runtime.js +4 -4
- package/dist/plugin-sdk/provider-auth.js +6 -6
- package/dist/plugin-sdk/provider-catalog-shared.js +1 -1
- package/dist/plugin-sdk/provider-entry.js +1 -1
- package/dist/plugin-sdk/provider-http.js +3 -3
- package/dist/plugin-sdk/provider-model-shared.js +2 -2
- package/dist/plugin-sdk/provider-stream-family.js +5 -5
- package/dist/plugin-sdk/provider-stream-shared.js +3 -3
- package/dist/plugin-sdk/provider-stream.js +4 -4
- package/dist/plugin-sdk/provider-test-contracts.js +1 -1
- package/dist/plugin-sdk/provider-tools.js +1 -1
- package/dist/plugin-sdk/provider-transport-runtime.js +2 -2
- package/dist/plugin-sdk/provider-web-fetch.js +1 -1
- package/dist/plugin-sdk/provider-web-search-config-contract.js +2 -2
- package/dist/plugin-sdk/provider-web-search-contract.js +2 -2
- package/dist/plugin-sdk/provider-web-search.js +4 -4
- package/dist/plugin-sdk/provider-zai-endpoint.js +1 -1
- package/dist/plugin-sdk/reply-chunking.js +2 -2
- package/dist/plugin-sdk/reply-dispatch-runtime.js +2 -2
- package/dist/plugin-sdk/reply-runtime.js +13 -13
- package/dist/plugin-sdk/retry-runtime.js +2 -2
- package/dist/plugin-sdk/routing.js +1 -1
- package/dist/plugin-sdk/runtime-env.js +5 -5
- package/dist/plugin-sdk/runtime-secret-resolution.js +1 -1
- package/dist/plugin-sdk/runtime.js +2 -2
- package/dist/plugin-sdk/sandbox.js +2 -2
- package/dist/plugin-sdk/session-store-runtime.js +2 -2
- package/dist/plugin-sdk/setup-runtime.js +1 -1
- package/dist/plugin-sdk/setup-tools.js +2 -2
- package/dist/plugin-sdk/setup.js +3 -3
- package/dist/plugin-sdk/simple-completion-runtime.js +2 -2
- package/dist/plugin-sdk/skill-commands-runtime.js +1 -1
- package/dist/plugin-sdk/speech-core.js +2 -2
- package/dist/plugin-sdk/speech.js +1 -1
- package/dist/plugin-sdk/src/config/sessions/transcript.d.ts +5 -0
- package/dist/plugin-sdk/src/infra/heartbeat-degeneration-guard.d.ts +31 -0
- package/dist/plugin-sdk/src/infra/heartbeat-events.d.ts +6 -0
- package/dist/plugin-sdk/ssrf-runtime.js +2 -2
- package/dist/plugin-sdk/testing.js +4 -4
- package/dist/plugin-sdk/text-runtime.js +4 -4
- package/dist/plugin-sdk/text-utility-runtime.js +1 -1
- package/dist/plugin-sdk/video-generation-core.js +1 -1
- package/dist/plugin-sdk/video-generation-runtime.js +1 -1
- package/dist/plugin-sdk/video-generation.js +1 -1
- package/dist/plugin-sdk/web-media.js +2 -2
- package/dist/plugin-service-31XQtuZr.js +2494 -0
- package/dist/plugins/runtime/index.js +1 -1
- package/dist/plugins-cli-20A8dYUN.js +576 -0
- package/dist/plugins-update-command-D0Iv4BPb.js +1009 -0
- package/dist/policy-BEVsx7jw.js +172 -0
- package/dist/ports-CwmEcxRS.js +433 -0
- package/dist/ports-Dr-FwKZD.js +263 -0
- package/dist/preemptive-compaction-DlRJt7Zq.js +430 -0
- package/dist/proactive-scheduler-B3w5rW0h.js +1444 -0
- package/dist/probe-BY1GUZvs.js +178 -0
- package/dist/probe-CCTEVLB2.js +54 -0
- package/dist/probe-CcQ1ucSE.js +2 -0
- package/dist/probe-DcSW0ngD.js +426 -0
- package/dist/probe-auth-C7DjgU_m.js +69 -0
- package/dist/probe-auth-Cfwc8qaj.js +3 -0
- package/dist/program-E_Dt_QTp.js +111 -0
- package/dist/prompt-overlay-DsEnjhTn.js +72 -0
- package/dist/prompt-select-styled-Dtw90p2J.js +5305 -0
- package/dist/provider-api-key-auth-CerNsquw.js +113 -0
- package/dist/provider-api-key-auth.runtime-B0BpFkRm.js +14 -0
- package/dist/provider-api-key-auth.runtime.js +1 -1
- package/dist/provider-auth-DwgUXcgu.js +36 -0
- package/dist/provider-auth-api-key-BQfXwqgU.js +5 -0
- package/dist/provider-auth-choice-BKxMQwxd.js +134 -0
- package/dist/provider-auth-choice-preference-DeDdHlsY.js +62 -0
- package/dist/provider-auth-input-BfXB22nt.js +117 -0
- package/dist/provider-auth-login-BYMTrXdl.js +8 -0
- package/dist/provider-auth-login.runtime-CCwO-k5h.js +206 -0
- package/dist/provider-auth-login.runtime.js +1 -1
- package/dist/provider-auth-runtime-p93v7b23.js +36 -0
- package/dist/provider-catalog-BA7O6Faq.js +18 -0
- package/dist/provider-catalog-BZJt3Ew2.js +75 -0
- package/dist/provider-catalog-CjNAbR9b.js +12 -0
- package/dist/provider-catalog-CpTP4D3p.js +56 -0
- package/dist/provider-catalog-CzVEmVzS.js +11 -0
- package/dist/provider-catalog-D1iJW59q.js +11 -0
- package/dist/provider-catalog-Dc48HHhB.js +11 -0
- package/dist/provider-catalog-KHD3te_R.js +61 -0
- package/dist/provider-catalog-jKq2UIeG.js +17 -0
- package/dist/provider-catalog-pmlFBXYr.js +26 -0
- package/dist/provider-catalog-shared-Cra7j-_m.js +104 -0
- package/dist/provider-catalog-xzYpukvK.js +13 -0
- package/dist/provider-compat-CCwXKQGq.js +37 -0
- package/dist/provider-discovery-DubIrc_R.js +2 -0
- package/dist/provider-dispatcher-Dl07uV70.js +22 -0
- package/dist/provider-entry-DkwXZuZY.js +97 -0
- package/dist/provider-http-CHFd_hrC.js +26 -0
- package/dist/provider-iVtrs6XY.js +70 -0
- package/dist/provider-model-shared-CxQysvS-.js +171 -0
- package/dist/provider-models-B3FlcSqf.js +225 -0
- package/dist/provider-models-B63rx638.js +22 -0
- package/dist/provider-models-BXMZj2p1.js +119 -0
- package/dist/provider-models-Bq_MZ0xR.js +35 -0
- package/dist/provider-models-CsUYkHTw.js +116 -0
- package/dist/provider-models-DCvjBHoV.js +169 -0
- package/dist/provider-openai-codex-oauth-tls-DbmKevdp.js +99 -0
- package/dist/provider-registration-DkqLtXSj.js +57 -0
- package/dist/provider-registration-vrLHkywc.js +238 -0
- package/dist/provider-stream-DTbeHqKf.js +285 -0
- package/dist/provider-stream-family-Cz7SHqeS.js +2 -0
- package/dist/provider-stream-shared-CTpijFfV.js +80 -0
- package/dist/provider-tools-X4kNlvXF.js +332 -0
- package/dist/provider-usage-4x0im5xP.js +3 -0
- package/dist/provider-usage-CdkW3Bkb.js +289 -0
- package/dist/provider-web-search-CyGNmODH.js +55 -0
- package/dist/provider-web-search-contract-BEZzFHD8.js +12 -0
- package/dist/provider-web-search-contract-fields-DNH2_b3H.js +38 -0
- package/dist/proxy-stream-wrappers-BcJuaE24.js +480 -0
- package/dist/push-apns-CO3sqbX3.js +1061 -0
- package/dist/pw-ai-DEf5tZLp.js +2268 -0
- package/dist/qmd-manager-CrqmeTuY.js +1799 -0
- package/dist/qr-cli-g_Pkqstu.js +359 -0
- package/dist/qr-image-DcG1bUox.js +2 -0
- package/dist/queue-BveCZpTb.js +636 -0
- package/dist/realtime-provider-shared-BIili3oc.js +21 -0
- package/dist/realtime-transcription-provider-DqEHy_Jr.js +180 -0
- package/dist/realtime-voice-provider-Dau1KlKK.js +342 -0
- package/dist/record-shared-CC55xbFE.js +10 -0
- package/dist/region-CPFmncMW.js +74 -0
- package/dist/register.agent-D5el253o.js +241 -0
- package/dist/register.configure-DeqUaelp.js +15 -0
- package/dist/register.maintenance-Dv5x9ZE6.js +443 -0
- package/dist/register.message-e2Pbh8A_.js +601 -0
- package/dist/register.onboard-COuTKpAw.js +83 -0
- package/dist/register.runtime-BjOIl4eF.js +81 -0
- package/dist/register.runtime-BzJ6RkQN.js +343 -0
- package/dist/register.runtime.js +1 -1
- package/dist/register.setup-DQYY7K4K.js +104 -0
- package/dist/register.status-health-sessions-CXNGQh_O.js +1211 -0
- package/dist/register.subclis-B6uy_ogx.js +232 -0
- package/dist/register.subclis-Cmdrfiej.js +3 -0
- package/dist/remote-env-DU45InJB.js +12 -0
- package/dist/replay-policy-BKyiI8sk.js +10 -0
- package/dist/replay-policy-C6igC4nS.js +8 -0
- package/dist/reply-Bd8ShNWW.js +3523 -0
- package/dist/reply-payloads-CFKnBOGu.js +78 -0
- package/dist/reply-prefix-D43zayDn.js +33 -0
- package/dist/reply.runtime-ByKwE5dg.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/resolve-CSTOvc_c.js +280 -0
- package/dist/restart-C0QhPXk1.js +454 -0
- package/dist/restart-handoff-Dd9C10Ns.js +2 -0
- package/dist/restart-health-BAtQdyZh.js +203 -0
- package/dist/restart-health-CnQMSvvJ.js +2 -0
- package/dist/restart-stale-pids-CiBNQGrr.js +529 -0
- package/dist/retry-C1lmuHl8.js +76 -0
- package/dist/retry-policy-B_7wH7D2.js +58 -0
- package/dist/route-reply-CXZFXlfK.js +141 -0
- package/dist/route-reply.runtime-BK8V9NEg.js +2 -0
- package/dist/route-reply.runtime.js +1 -1
- package/dist/rpc-f0OkPaI1.js +61 -0
- package/dist/rpc.runtime-BQ78T_pB.js +21 -0
- package/dist/rpc.runtime.js +1 -1
- package/dist/run-main-CkwrrhfI.js +453 -0
- package/dist/run-wait-B4pXPLkF.js +118 -0
- package/dist/runner-BSA9M_M9.js +1497 -0
- package/dist/runtime-C18YgW822.js +242 -0
- package/dist/runtime-C3OJQ1Xd.js +200 -0
- package/dist/runtime-CDNVtwVk.js +72 -0
- package/dist/runtime-CMNHfJtF.js +725 -0
- package/dist/runtime-C_o_otMV.js +355 -0
- package/dist/runtime-CiJWy5Ce.js +9 -0
- package/dist/runtime-Di50Fr1z.js +191 -0
- package/dist/runtime-W3qG5LHM.js +2 -0
- package/dist/runtime-api-Bx7nlc4w.js +12 -0
- package/dist/runtime-api-DCNC_FTy2.js +2 -0
- package/dist/runtime-api-_Z8MjR0l.js +3 -0
- package/dist/runtime-embedded-pi.runtime-Cv0MW9ps.js +3 -0
- package/dist/runtime-embedded-pi.runtime.js +1 -1
- package/dist/runtime-env-BeD13rEG.js +9 -0
- package/dist/runtime-internal-DclGtT-e.js +2 -0
- package/dist/runtime-model-auth.runtime-Bjl23_fr.js +39 -0
- package/dist/runtime-model-auth.runtime.js +1 -1
- package/dist/runtime-oEwr_zQb.js +107 -0
- package/dist/runtime-plugins-CwWhqXLJ.js +69 -0
- package/dist/runtime-prepare.runtime-Bi-YD5R-.js +80 -0
- package/dist/runtime-prepare.runtime.js +1 -1
- package/dist/runtime-provider-CSEDbSxr.js +21 -0
- package/dist/runtime-shared-BxJFDFe6.js +249 -0
- package/dist/runtime-taskflow-RwpXng2l.js +250 -0
- package/dist/runtime-web-channel-plugin-Bw74Ar_q.js +215 -0
- package/dist/runtime-web-tools-CEaAGeYr.js +1467 -0
- package/dist/sandbox-BC2XUWcW.js +4 -0
- package/dist/sandbox-cli-ain0MYTB.js +447 -0
- package/dist/sandbox-epLgxWBQ.js +2586 -0
- package/dist/schtasks-CL3tJAH5.js +785 -0
- package/dist/secrets-cli-iLwRZbRt.js +2114 -0
- package/dist/security-audit-DfrokBuq.js +34 -0
- package/dist/security-cli-BqsMM550.js +486 -0
- package/dist/semantic-dedup-BBpIPaSV.js +95 -0
- package/dist/send-C5LHdZqP.js +993 -0
- package/dist/send-media-Df0E2Z_m.js +2123 -0
- package/dist/server-2CD2yd73.js +13 -0
- package/dist/server-B44RMlVT.js +77 -0
- package/dist/server-context-SulhWpXY.js +4164 -0
- package/dist/server-methods-BPzzX5VC.js +11937 -0
- package/dist/server-middleware-WQzQIrD4.js +110 -0
- package/dist/server-node-events-Ug_Atc7G.js +451 -0
- package/dist/server.impl-InfVdwPj.js +19765 -0
- package/dist/service-CK-XuLCu.js +132 -0
- package/dist/service-D9X-uqEA.js +2 -0
- package/dist/service-audit-BQx1zTWD.js +2 -0
- package/dist/service-audit-CQC1FeD7.js +254 -0
- package/dist/session-B5RmIL21.js +48 -0
- package/dist/session-archive.runtime-B1x5wHBw.js +2 -0
- package/dist/session-archive.runtime.js +1 -1
- package/dist/session-conversation-CFty7VTc.js +27 -0
- package/dist/session-cost-usage-CckjvorH.js +2 -0
- package/dist/session-cost-usage-DMRjhi4B.js +648 -0
- package/dist/session-file-DGJqy_ea.js +44 -0
- package/dist/session-key-D-jBcxEp.js +65 -0
- package/dist/session-meta-BijZlLS3.js +109 -0
- package/dist/session-override-1YQHEAlz.js +103 -0
- package/dist/session-reset-model.runtime-CEWrfXLr.js +120 -0
- package/dist/session-reset-model.runtime.js +1 -1
- package/dist/session-reset-service-Dphtb16d.js +474 -0
- package/dist/session-subagent-reactivation.runtime-CF4aqSpn.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-tab-registry-DG9SGi0I.js +553 -0
- package/dist/session-updates-BRFvmIoC.js +234 -0
- package/dist/session-updates.runtime-CiHARWGr.js +2 -0
- package/dist/session-updates.runtime.js +1 -1
- package/dist/session-utils-Cai4P9ih.js +930 -0
- package/dist/session-utils.fs-DV8bxCEw.js +537 -0
- package/dist/sessions-BTcXDmCA.js +2 -0
- package/dist/sessions-CyYVTseV.js +45 -0
- package/dist/sessions-Fb0ep3uj.js +231 -0
- package/dist/sessions.runtime-BGyynSR4.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/setup-CjEjg8Ci.js +505 -0
- package/dist/setup-D-ypxGnK.js +329 -0
- package/dist/setup-DjympYIJ.js +15 -0
- package/dist/setup-binary-BKTpThn7.js +2 -0
- package/dist/setup-surface-QaubzT60.js +586 -0
- package/dist/setup-tools-6s2MNbj0.js +4 -0
- package/dist/setup-wizard-proxy-BscKn1FO.js +139 -0
- package/dist/setup.finalize-B3MWkUF9.js +436 -0
- package/dist/setup.gateway-config-BdK0tA_r.js +246 -0
- package/dist/shared-0JcWj8-R.js +224 -0
- package/dist/shared-BAqqhcWT.js +127 -0
- package/dist/shared-BOd3OCF0.js +36 -0
- package/dist/shared-D5_A7-ng.js +219 -0
- package/dist/shared-DICWV0-6.js +218 -0
- package/dist/shared-DiGX-JK8.js +137 -0
- package/dist/shared-DktX3NHd.js +175 -0
- package/dist/shared-runtime-BltNIfGY.js +7 -0
- package/dist/short-term-promotion-CT1zdD1r.js +1631 -0
- package/dist/simple-completion-runtime-CZyp8rJ3.js +131 -0
- package/dist/simple-completion-transport-BWyoXghG.js +32 -0
- package/dist/skill-commands-BC_2IdwF.js +82 -0
- package/dist/skill-commands.runtime-BP6BnOeq.js +2 -0
- package/dist/skill-commands.runtime.js +1 -1
- package/dist/skills-install-CHUWYiLs.js +822 -0
- package/dist/speech-core-aXx4I3sB.js +126 -0
- package/dist/speech-provider-B2yBILHX.js +101 -0
- package/dist/speech-provider-BTBQ5VOv.js +103 -0
- package/dist/speech-provider-BciszvJf.js +184 -0
- package/dist/speech-provider-BoQDEC_Y.js +167 -0
- package/dist/speech-provider-C-wTEx8k.js +182 -0
- package/dist/speech-provider-DYJcz4pW.js +39 -0
- package/dist/ssh-tunnel-B-uzzPcH.js +2 -0
- package/dist/ssh-tunnel-Bu9s0zUo.js +159 -0
- package/dist/ssrf-runtime-D1skzXnx.js +6 -0
- package/dist/stage-sandbox-media.runtime-DhlTQjXA.js +230 -0
- package/dist/stage-sandbox-media.runtime.js +1 -1
- package/dist/standalone-generate-BRvNW_O7.js +2 -0
- package/dist/standalone-generate-CDfZss4x.js +217 -0
- package/dist/state-migrations-BNib6l8O.js +823 -0
- package/dist/status-8clcfnN0.js +473 -0
- package/dist/status-CNcOKUs2.js +500 -0
- package/dist/status-D1l9Tu3s.js +399 -0
- package/dist/status-P3bvFirO.js +3 -0
- package/dist/status-TmH9qSMG.js +2 -0
- package/dist/status-all-BeyVXDNT.js +495 -0
- package/dist/status-json-Cj42CVZZ.js +14 -0
- package/dist/status-json-command-DWk5RiyN.js +92 -0
- package/dist/status-runtime-shared-orzti3tZ.js +271 -0
- package/dist/status.agent-local-BEtIuLEr.js +58 -0
- package/dist/status.command.text-runtime-B-tNLc3T.js +15 -0
- package/dist/status.format-VfGIeDvx.js +60 -0
- package/dist/status.gateway-connection.runtime-BrkaJ2f5.js +2 -0
- package/dist/status.gateway-connection.runtime.js +1 -1
- package/dist/status.gateway-probe-BwuiZk1h.js +16 -0
- package/dist/status.scan-DegSjLE2.js +62 -0
- package/dist/status.scan-overview-CrSELCru.js +395 -0
- package/dist/status.scan.fast-json-Bm5lN6IK.js +2 -0
- package/dist/status.scan.fast-json-Ch2Zw813.js +128 -0
- package/dist/status.scan.runtime-D-LvzBYN.js +417 -0
- package/dist/status.scan.runtime.js +1 -1
- package/dist/status.summary-OB-43Bvk.js +2 -0
- package/dist/status.summary-gJukahkb.js +209 -0
- package/dist/status.update-BFj-9E8m.js +79 -0
- package/dist/status.update-DYICl5t8.js +2 -0
- package/dist/store-D_vXZ7m9.js +1112 -0
- package/dist/store.runtime-6eaZtPq6.js +2 -0
- package/dist/store.runtime.js +1 -1
- package/dist/stream-B84y4XQY.js +76 -0
- package/dist/stream-BgcqyefI.js +649 -0
- package/dist/stream-C_VJaXT6.js +26 -0
- package/dist/stream-D5lrRuHb.js +129 -0
- package/dist/stream-DXG7L3j5.js +27 -0
- package/dist/stream-UtEiCziE.js +153 -0
- package/dist/stream-wrappers-B7-5gN0i.js +144 -0
- package/dist/strip-inbound-meta-BSHFFiJd.js +155 -0
- package/dist/subagent-announce.registry.runtime-R2bop0gW.js +3 -0
- package/dist/subagent-announce.registry.runtime.js +1 -1
- package/dist/subagent-control-UyMtkJwo.js +485 -0
- package/dist/subagent-followup.runtime-bTK0TymS.js +68 -0
- package/dist/subagent-followup.runtime.js +1 -1
- package/dist/subagent-list-c0JKZR0g.js +168 -0
- package/dist/subagent-orphan-recovery-CSEzwva5.js +214 -0
- package/dist/subagent-registry-Be219RP1.js +2889 -0
- package/dist/subagent-registry-read-IQtTTWj3.js +57 -0
- package/dist/subagent-registry-runtime-Dk57Y91p.js +2 -0
- package/dist/subagent-registry.runtime-D6h_BK2i.js +3 -0
- package/dist/subagent-registry.runtime.js +1 -1
- package/dist/subagent-spawn-BeyYZuFf.js +782 -0
- package/dist/subagents-format-ZcZBg1Vh.js +629 -0
- package/dist/supervisor-DVGQ2rPX.js +737 -0
- package/dist/system-cli-_3czEwa7.js +60 -0
- package/dist/system-prompt-BBrWR8Ef.js +711 -0
- package/dist/system-prompt-Dc6Xr30m.js +2 -0
- package/dist/system-prompt-cache-boundary-BqVZ8lnu.js +25 -0
- package/dist/system-run-command-W-wf2HqZ.js +300 -0
- package/dist/systemd-BeYwG5kN.js +591 -0
- package/dist/systemd-hints-BpWajEeA.js +76 -0
- package/dist/systemd-linger-DsTUkfUn.js +68 -0
- package/dist/systemd-linger-X-aDLDla.js +2 -0
- package/dist/tables-BGTNKk6h.js +832 -0
- package/dist/tailscale-status-CCyq-VvN.js +72 -0
- package/dist/targets-BN0-h0GJ.js +300 -0
- package/dist/targets-CXrDP8_l.js +595 -0
- package/dist/targets.runtime-BvBk-CQ8.js +2 -0
- package/dist/targets.runtime.js +1 -1
- package/dist/task-executor-DNUNtRg8.js +350 -0
- package/dist/task-owner-access--E5Vkg9U.js +48 -0
- package/dist/task-registry-COE-B6MO.js +2346 -0
- package/dist/task-registry-control.runtime-BzsTfRw1.js +3 -0
- package/dist/task-registry-control.runtime.js +1 -1
- package/dist/task-registry-delivery-runtime-Cv6xz8KP.js +2 -0
- package/dist/task-registry-delivery-runtime-DSfcd2LA.js +3 -0
- package/dist/task-registry.maintenance-Bhd9abl9.js +2 -0
- package/dist/task-registry.maintenance-W3lTkY0l.js +425 -0
- package/dist/testing-CQ_-oCQB.js +441 -0
- package/dist/text-report-BgqWDKJR.js +587 -0
- package/dist/text-runtime-asv4kIxS.js +313 -0
- package/dist/thread-bindings-BCRWofo_.js +223 -0
- package/dist/tool-auth-shared-BWZwTobX.js +53 -0
- package/dist/tool-config-shared-BleK697I.js +19 -0
- package/dist/tool-schema-runtime-DZsW_KR4.js +1892 -0
- package/dist/tools-effective-inventory-SB9JwX-y.js +152 -0
- package/dist/tools.runtime-J5rhfXQp.js +4 -0
- package/dist/tools.runtime.js +1 -1
- package/dist/transcript-B8bIvyol.js +2 -0
- package/dist/transcript-CxdKo8Wl.js +222 -0
- package/dist/transcript-DxWx6dVc.js +233 -0
- package/dist/transcript.runtime-CmBnobSv.js +2 -0
- package/dist/transcript.runtime.js +1 -1
- package/dist/transport-policy-BGfaKNz0.js +75 -0
- package/dist/transport-ready-MwpvBxBB.js +36 -0
- package/dist/tts-C1GyTLOi.js +31 -0
- package/dist/tts-JSdoZrZA.js +40 -0
- package/dist/tui-Cqdp1x16.js +4018 -0
- package/dist/tui-cli-BC4O3H6r.js +31 -0
- package/dist/typing-mode-BoJYxUas.js +84 -0
- package/dist/undici-global-dispatcher-BLnQvRel.js +99 -0
- package/dist/update-BrD8yWSp.js +1253 -0
- package/dist/update-check-gcnsxBqT.js +431 -0
- package/dist/update-cli-BzaCTuax.js +1779 -0
- package/dist/update-runner-Cvxezvhf.js +1492 -0
- package/dist/usage-CG1Nshi3.js +71 -0
- package/dist/usage-format-DQTT4pqY.js +507 -0
- package/dist/usage-format-sR4xu0xw.js +2 -0
- package/dist/utils-CBnbWiRL.js +189 -0
- package/dist/video-generation-CksImGdK.js +167 -0
- package/dist/video-generation-provider-7YR4_ldd.js +171 -0
- package/dist/video-generation-provider-AlAZkYIW.js +181 -0
- package/dist/video-generation-provider-BEqi4pUJ.js +104 -0
- package/dist/video-generation-provider-CraaZaR7.js +77 -0
- package/dist/video-generation-provider-CuvO2Hzh.js +246 -0
- package/dist/video-generation-provider-D-t16ACe.js +240 -0
- package/dist/video-generation-provider-DeowxvLt.js +233 -0
- package/dist/video-generation-provider-HbOZ3qzI.js +227 -0
- package/dist/video-generation-provider-_apx1yFE.js +263 -0
- package/dist/video-generation-provider-bvpb6cdV.js +64 -0
- package/dist/video-http-DRLB0lIA.js +29 -0
- package/dist/video-model-catalog-BE5LhQSo.js +187 -0
- package/dist/web-media-BYZC5tOg.js +330 -0
- package/dist/web-media-DKpK9EDb.js +2 -0
- package/dist/web-search-DSDz1iyf.js +221 -0
- package/dist/web-search-provider-DnYRRBVM.js +155 -0
- package/dist/web-search-provider-common-B9jozd8T.js +206 -0
- package/dist/web-search-provider-config-DCqeS6ct.js +52 -0
- package/dist/web-shared--44LWgiH.js +414 -0
- package/dist/x-search-shared-DKPdPR5_.js +109 -0
- package/docs/platforms/termux.md +3 -3
- package/package.json +1 -1
- package/dist/abort-D8E9Viul.js +0 -202
- package/dist/abort-cutoff.runtime-buOT5TQ9.js +0 -20
- package/dist/abort-primitives-B6Qmun6I.js +0 -93
- package/dist/abort.runtime-DBAOcoA0.js +0 -2
- package/dist/account-action-gate-BT_vXl45.js +0 -114
- package/dist/acp-cli-CK-PaZW1.js +0 -2171
- package/dist/acp-spawn-DREGP-Dg.js +0 -1024
- package/dist/acp-stateful-target-driver-BCNEZ0qY.js +0 -88
- package/dist/action-agents-Bghuxxiu.js +0 -67
- package/dist/action-focus-DsDsKPpt.js +0 -124
- package/dist/action-help-Dea7LzSX.js +0 -7
- package/dist/action-info-BeSnrfUx.js +0 -58
- package/dist/action-kill-A8Gm3ASV.js +0 -33
- package/dist/action-list-BkyeGY4Y.js +0 -21
- package/dist/action-log-C-PshBJC.js +0 -30
- package/dist/action-send-B7O-Cyik.js +0 -39
- package/dist/action-spawn-0DHhLXka.js +0 -46
- package/dist/action-unfocus-DQ3mnyh6.js +0 -28
- package/dist/agent-ChCFDEkx.js +0 -2
- package/dist/agent-command-HwJps2h3.js +0 -1479
- package/dist/agent-list-3PG6_Efg.js +0 -67
- package/dist/agent-runner-utils-dAUhMPP0.js +0 -202
- package/dist/agent-runner.runtime-BvOJ3ms5.js +0 -2825
- package/dist/agents-DGs1CWL1.js +0 -5
- package/dist/agents-R-PuEDKr.js +0 -887
- package/dist/allow-from-REaY_RBI.js +0 -164
- package/dist/anthropic-cache-control-payload-CvmvKgnD.js +0 -28
- package/dist/anthropic-payload-policy-CANcBjYh.js +0 -136
- package/dist/anthropic-vertex-stream-BOdy5JqE.js +0 -5666
- package/dist/api-BChlvn8B.js +0 -5
- package/dist/api-BEM__kGA.js +0 -4
- package/dist/api-BQr2q6_t.js +0 -4
- package/dist/api-BzKZ27N_.js +0 -2
- package/dist/api-C7GkbUyn.js +0 -35
- package/dist/api-Cbv-utnp.js +0 -45
- package/dist/api-Csv5YmWm.js +0 -3
- package/dist/api-CvN3buT5.js +0 -3
- package/dist/api-D7OkY2ha.js +0 -5
- package/dist/api-D7cDr4c5.js +0 -19
- package/dist/api-Df793QOm.js +0 -2
- package/dist/apply-DG2_D6J9.js +0 -493
- package/dist/apply.runtime-4Oo5FMhm.js +0 -166
- package/dist/apply.runtime-O1GHmKzQ.js +0 -2
- package/dist/approval-gateway-resolver-By95iflu.js +0 -58
- package/dist/approval-gateway-runtime-C_2l5m0E.js +0 -2
- package/dist/approval-handler-runtime-BcIBxW0i.js +0 -439
- package/dist/approval-native-helpers-Dy60ZISZ.js +0 -33
- package/dist/approval-native-runtime-zPzOoZlr.js +0 -709
- package/dist/approval-renderers-oIQzoEfU.js +0 -64
- package/dist/asr-ChZCFIGe.js +0 -195
- package/dist/audit-DfEhlnGH.js +0 -885
- package/dist/audit-extra.async-B-_wy7Tg.js +0 -847
- package/dist/audit.deep.runtime-CqfZhQYQ.js +0 -2
- package/dist/audit.nondeep.runtime-BEYvNUL0.js +0 -859
- package/dist/audit.runtime-BZIKjR29.js +0 -7
- package/dist/auth-B4RCO9pL.js +0 -181
- package/dist/auth-choice-BKccwE1z.js +0 -353
- package/dist/auth-choice-BjfYwU59.js +0 -71
- package/dist/auth-choice-D5arr50x.js +0 -3
- package/dist/auth-choice.apply-helpers-Bte42LAy.js +0 -2
- package/dist/binding-routing-BOSLYF1b.js +0 -50
- package/dist/binding-targets-JPaoc1qf.js +0 -99
- package/dist/block-streaming-CEz8_YvV.js +0 -103
- package/dist/bootstrap-files-MSqLqaFY.js +0 -206
- package/dist/bridge-server-vuRzCH3N.js +0 -103
- package/dist/browser-node-runtime-C3g2gsaZ.js +0 -12
- package/dist/browser-open-BP0tUM0r.js +0 -94
- package/dist/browser-runtime-BF4n8YQ5.js +0 -377
- package/dist/browser-security-runtime-Ci12HfND.js +0 -10
- package/dist/browser-setup-tools-6xFifQZE.js +0 -12
- package/dist/btw-command-YUgszbXM.js +0 -17
- package/dist/call-5P034-jt.js +0 -495
- package/dist/call-BUDlcDxf.js +0 -2
- package/dist/call.runtime-DUm_Bttq.js +0 -2
- package/dist/capability-cli-Dedr9-5P.js +0 -1357
- package/dist/catalog-provider-B6R9uezh.js +0 -40
- package/dist/cdp.helpers-BIDb2U4E.js +0 -372
- package/dist/channel-config-helpers-XmE0KJZk.js +0 -462
- package/dist/channel-core-CjiYN8RW.js +0 -5
- package/dist/channel-feedback-1aAUqgjY.js +0 -259
- package/dist/channel-plugin-resolution-CN215YtG.js +0 -146
- package/dist/channel-policy-B4aZ_llS.js +0 -270
- package/dist/channel-reply-pipeline-CKLpE2fN.js +0 -26
- package/dist/channel-runtime-B5LPKA4v.js +0 -6
- package/dist/channel.runtime-dnBq2L1v.js +0 -399
- package/dist/channels-CYG1q9PH.js +0 -1147
- package/dist/channels-cli-BoG2L78B.js +0 -248
- package/dist/chat-DnjpEdFB.js +0 -213
- package/dist/chat-history-text-BzdTyI1F.js +0 -42
- package/dist/chrome-e2X2vBVg.js +0 -1080
- package/dist/chrome.executables-CnUVYt-H.js +0 -550
- package/dist/chunk-DgPObAqu.js +0 -267
- package/dist/clack-prompter-BWIrYn8q.js +0 -113
- package/dist/cli-CMvRUMSs.js +0 -154
- package/dist/cli-CYvUljnp.js +0 -57
- package/dist/cli-Cw69q4uo.js +0 -2
- package/dist/cli-auth-seam-BL5t2dya.js +0 -14
- package/dist/cli-backend-Cykx4ud8.js +0 -66
- package/dist/cli-migration-CSx1vbkG.js +0 -127
- package/dist/cli-runner-No9Uhffw.js +0 -1662
- package/dist/cli-runner.runtime-COquWuXM.js +0 -3
- package/dist/cli-runner.runtime-egfGJUTe.js +0 -2
- package/dist/cli-runtime-BTdQg8Pm.js +0 -3
- package/dist/cli-shared-DkBvc2Y5.js +0 -142
- package/dist/cli.runtime-djxOgvtS.js +0 -819
- package/dist/client-bootstrap-Dyqi3fZr.js +0 -28
- package/dist/command-auth-D6uvRaCj.js +0 -75
- package/dist/command-config-resolution-2RDsbHMM.js +0 -2
- package/dist/command-config-resolution-DRvqZFqh.js +0 -23
- package/dist/command-detection-q0CJzVXY.js +0 -50
- package/dist/command-execution-startup-BZH7rNOz.js +0 -269
- package/dist/command-format-BNut7VFf.js +0 -2
- package/dist/command-registry-BsP1NxvH.js +0 -3
- package/dist/command-registry-YDJgbbaF.js +0 -113
- package/dist/command-secret-gateway-DFgAUeer.js +0 -528
- package/dist/command-status-builders-DykmScCm.js +0 -145
- package/dist/commands-acp-BblekZyF.js +0 -1017
- package/dist/commands-compact.runtime-CjyTQ5zv.js +0 -10
- package/dist/commands-context-B5MBVGe2.js +0 -34
- package/dist/commands-core.runtime-CnZNxnAO.js +0 -2
- package/dist/commands-handlers.runtime-DDqt62Dn.js +0 -3762
- package/dist/commands-models-DTev55uI.js +0 -306
- package/dist/commands-registry-vcJhtPD2.js +0 -295
- package/dist/commands-registry.runtime-CgwuBxnW.js +0 -2
- package/dist/commands-reset-hooks-BTmweR6W.js +0 -129
- package/dist/commands-status-DkWx-VSd.js +0 -223
- package/dist/commands-status.runtime-B6nbPpK_.js +0 -2
- package/dist/commands-subagents-control.runtime-B3F_rMws.js +0 -3
- package/dist/commands-subagents-control.runtime-D7PSJsuS.js +0 -2
- package/dist/commands.runtime-D0Qr8f98.js +0 -103
- package/dist/comment-shared-C3tQmrNA.js +0 -40
- package/dist/compact-DBa1TeO8.js +0 -11324
- package/dist/compact.runtime-DLdGjZpf.js +0 -7
- package/dist/completion-cli-CywOElFT.js +0 -468
- package/dist/completion-cli-DK-0MXVG.js +0 -2
- package/dist/config-CYhAmlA1.js +0 -166
- package/dist/config-cli-Cd2yLD4r.js +0 -948
- package/dist/config-defaults-ClVNRdCi.js +0 -163
- package/dist/config-guard-C-3SAUrc.js +0 -94
- package/dist/config-runtime-ofeq3zSi.js +0 -14
- package/dist/config-validation-6s7vNOEX.js +0 -279
- package/dist/configure-C-7Lttr2.js +0 -2
- package/dist/configure-D_7K9hWl.js +0 -1162
- package/dist/connection-auth-47Ob5Igi.js +0 -30
- package/dist/context-6q3_7y5g.js +0 -249
- package/dist/context-BEEy1M1I.js +0 -2
- package/dist/context-visibility-2p0h1zWp.js +0 -14
- package/dist/context-writer-CwqLN0tS.js +0 -290
- package/dist/control-auth-BIgC7VS3.js +0 -122
- package/dist/control-ui-links-DEuG_GSl.js +0 -70
- package/dist/conversation-id-Ztzvbgi8.js +0 -140
- package/dist/conversation-runtime-DdIJJiVg.js +0 -31
- package/dist/core-BNu-9utc.js +0 -210
- package/dist/cron-cli-DRRlvCJ_.js +0 -637
- package/dist/daemon-cli-B9FyFrQ6.js +0 -476
- package/dist/daemon-install-TThZ0lbE.js +0 -70
- package/dist/delegate-Cw2paU9j.js +0 -61
- package/dist/deliver-C5UOgw2b.js +0 -3
- package/dist/deliver-DrIu_P0l.js +0 -782
- package/dist/deliver-runtime-Bc7cK2WN.js +0 -2
- package/dist/delivery-outbound.runtime-BjOSpQD-.js +0 -6
- package/dist/delivery-queue-B19gpiaY.js +0 -372
- package/dist/delivery-queue-Cu4I41c4.js +0 -2
- package/dist/device-bootstrap-D8veEU4x.js +0 -4
- package/dist/device-bootstrap-DyTx6egK.js +0 -248
- package/dist/device-bootstrap-profile-I2zbsVdf.js +0 -36
- package/dist/device-identity-HSVRQkzQ.js +0 -2
- package/dist/device-pairing-BCo5v6N5.js +0 -600
- package/dist/devices-cli-CLWd-IeZ.js +0 -336
- package/dist/diagnostics-DPXDETG1.js +0 -2
- package/dist/diagnostics-QjuefiNT.js +0 -33
- package/dist/direct-dm-CNgsDTy-.js +0 -139
- package/dist/directive-handling.fast-lane-BD5lnzxN.js +0 -2
- package/dist/directive-handling.fast-lane-BTy2s6gs.js +0 -64
- package/dist/directive-handling.impl-CX9FZ-B9.js +0 -2
- package/dist/directive-handling.impl-RaR111-L.js +0 -659
- package/dist/directive-handling.parse-DoJ6BVS3.js +0 -376
- package/dist/directive-handling.persist-BLK-h7OI.js +0 -139
- package/dist/directive-handling.persist.runtime-BzAa2gYU.js +0 -2
- package/dist/directive-handling.shared-D1rGNZt5.js +0 -159
- package/dist/directory-cli-C7aTBxHk.js +0 -240
- package/dist/dispatch-DZk7ttx4.js +0 -1126
- package/dist/dispatch-acp-command-bypass-CASB-Big.js +0 -38
- package/dist/dispatch-acp-fiE-20qf.js +0 -969
- package/dist/dispatch-acp-manager.runtime-CXbLrETb.js +0 -3
- package/dist/dispatch-acp-media.runtime-DBNkTr9w.js +0 -3
- package/dist/dispatch-acp-session.runtime-C37eUPyo.js +0 -2
- package/dist/dispatch-acp.runtime-DNcxyRdr.js +0 -19
- package/dist/docker-WeeHs5I_.js +0 -826
- package/dist/doctor-completion-BndMTWBa.js +0 -90
- package/dist/doctor-config-preflight-CSR8GR_C.js +0 -148
- package/dist/doctor-config-preflight-uNP9xifp.js +0 -2
- package/dist/doctor-state-migrations-Cx5F1a8u.js +0 -3
- package/dist/doctor-state-migrations-Dfz-deYl.js +0 -2
- package/dist/drive-DBvfSweP.js +0 -718
- package/dist/embedding-provider-CFWlEX1d.js +0 -26
- package/dist/embedding-provider-CIycGLf5.js +0 -33
- package/dist/embedding-provider-CWndQr_-.js +0 -129
- package/dist/engine-DP8OY9SI.js +0 -82
- package/dist/engine-embeddings-UKC8SpiN.js +0 -1489
- package/dist/entry-capabilities-E73Yz1yg.js +0 -89
- package/dist/exec-approval-forwarder.runtime-B2duci0j.js +0 -3
- package/dist/exec-approval-session-target-B9-fNjez.js +0 -165
- package/dist/exec-approvals-cli-DLdT3aSv.js +0 -485
- package/dist/exec-defaults-VRp473Sn.js +0 -1440
- package/dist/extra-params-CTzuV0V2.js +0 -295
- package/dist/fetch-DnGnGfIj.js +0 -65
- package/dist/fetch-PlNhlY1D.js +0 -256
- package/dist/fetch-guard-DjigeYAg.js +0 -224
- package/dist/format-DqUmaubt.js +0 -245
- package/dist/fragment-collector-PpItYLA6.js +0 -189
- package/dist/gateway-DML9FbXS.js +0 -2
- package/dist/gateway-cli-DVL048Zj.js +0 -1532
- package/dist/gateway-install-token-BamWepdY.js +0 -284
- package/dist/gateway-lock-CYNSW8aZ.js +0 -238
- package/dist/gateway-mGyPIOuQ.js +0 -119
- package/dist/gateway-rpc-CyLUAd7r.js +0 -14
- package/dist/gateway-rpc.runtime-DK8N4h7v.js +0 -23
- package/dist/gemini-cli-provider-CS_UZ3WR.js +0 -106
- package/dist/gemini-web-search-provider-DL5e-EZn.js +0 -167
- package/dist/get-reply-from-config.runtime-D64zRtWj.js +0 -2
- package/dist/group-policy-F3YMiMAb.js +0 -202
- package/dist/health-4aL9xNMP.js +0 -579
- package/dist/health-DdFGarRx.js +0 -2
- package/dist/heartbeat-OI7GfQHK.js +0 -184
- package/dist/heartbeat-runner-Duz5xcLR.js +0 -1289
- package/dist/heartbeat-runner-aaEswJ0B.js +0 -4
- package/dist/heartbeat-runner.runtime-D_qxPkdL.js +0 -2
- package/dist/heartbeat-summary-Brqv8KYX.js +0 -58
- package/dist/heartbeat-visibility-D03CCH71.js +0 -81
- package/dist/hooks-cli-BzctiLUS.js +0 -364
- package/dist/identity-Bxp0hRpo.js +0 -30
- package/dist/identity-avatar-Di47l4kX.js +0 -87
- package/dist/image-B7CPx51h.js +0 -152
- package/dist/image-generation-core-Q4HhEwJY.js +0 -17
- package/dist/image-generation-core.auth.runtime-Bb2j1_UK.js +0 -2
- package/dist/image-generation-provider-0fSo5h6u.js +0 -136
- package/dist/image-generation-provider-CvFrycEI.js +0 -86
- package/dist/image-generation-provider-DA9kPptM.js +0 -163
- package/dist/image-generation-provider-DF7Y6NGy.js +0 -130
- package/dist/image-generation-provider-DTBiXZGp.js +0 -280
- package/dist/image-generation-provider-xgflECGv.js +0 -94
- package/dist/image-generation-runtime-ovbXa2gS.js +0 -2
- package/dist/image-runtime-LoZZdTXn.js +0 -7
- package/dist/images-DKmW2P-z.js +0 -586
- package/dist/inbound-reply-dispatch-C9NpDPnv.js +0 -73
- package/dist/inbound.runtime-CjLChnR7.js +0 -4
- package/dist/inbound.runtime-hVoRWxJ7.js +0 -3
- package/dist/infra-runtime-C8p_6KK_.js +0 -25
- package/dist/ingest-CdJaLY6Q.js +0 -2
- package/dist/ingest-e1icVEK-.js +0 -842
- package/dist/input-files-CT4CpkOx.js +0 -252
- package/dist/inspect-DOgFXMYn.js +0 -2
- package/dist/inspect-Ysjfnqlj.js +0 -282
- package/dist/issue-format-DjVI0gtD.js +0 -2
- package/dist/kaijibot-tools-rpqkBcQN.js +0 -9434
- package/dist/kaijibot-tools.runtime-BfIawT2J.js +0 -2
- package/dist/kill-tree-0Qfa0fPs.js +0 -2
- package/dist/kimi-web-search-provider-CEDoiAGa.js +0 -308
- package/dist/launchd-upj2lSvL.js +0 -556
- package/dist/library-DbtNtgzd.js +0 -45
- package/dist/lifecycle-core-QhQwW6wK.js +0 -422
- package/dist/list.runtime-DfPgbfBV.js +0 -9
- package/dist/list.runtime-X8TKiP_H.js +0 -12
- package/dist/llm-engine-B-oDIukn.js +0 -2
- package/dist/llm-engine-qg7Gd_hc.js +0 -1792
- package/dist/llm-extractor-CU3Bv_HG.js +0 -445
- package/dist/login-DVTUoRIz.js +0 -108
- package/dist/logs-cli-CaPofk7V.js +0 -264
- package/dist/logs-cli.runtime-DbvBADru.js +0 -2
- package/dist/manager-Dgu69d8y.js +0 -3314
- package/dist/manager-DwHThjE2.js +0 -2049
- package/dist/markdown-tables-DQxQ2v3M.js +0 -51
- package/dist/mcp-cli-CbzoZsr0.js +0 -733
- package/dist/media-models-CuHKr-jc.js +0 -49
- package/dist/media-runtime-bKQT2hiX.js +0 -312
- package/dist/media-understanding-BH3AUOGs.js +0 -83
- package/dist/media-understanding-provider-74lVtrOy.js +0 -69
- package/dist/media-understanding-provider-8BsFirXn.js +0 -18
- package/dist/media-understanding-provider-BP6_w_P_.js +0 -67
- package/dist/media-understanding-provider-BpQmj7qs.js +0 -21
- package/dist/media-understanding-provider-BycEDsFD.js +0 -123
- package/dist/media-understanding-provider-C84Ved45.js +0 -14
- package/dist/media-understanding-provider-CK_eMz1X.js +0 -37
- package/dist/media-understanding-provider-DaSwJ4pP.js +0 -18
- package/dist/media-understanding-provider-Dbs2lNmG.js +0 -112
- package/dist/media-understanding-provider-DqLVMGtn.js +0 -30
- package/dist/media-understanding-provider-QqsNUSwt.js +0 -13
- package/dist/media-understanding-runtime-BZA_6tIW.js +0 -2
- package/dist/memory-DEFXUqME.js +0 -3
- package/dist/memory-VUm9E4xZ.js +0 -242
- package/dist/memory-core-host-engine-embeddings-DT26N-48.js +0 -2
- package/dist/memory-core-host-runtime-cli-ByvpXhTk.js +0 -9
- package/dist/memory-core-host-runtime-core-49LtYnDz.js +0 -8
- package/dist/memory-embedding-adapter-BhBdY21w.js +0 -33
- package/dist/memory-index-D1k6rjci.js +0 -2
- package/dist/memory-index-DGv1BQqr.js +0 -514
- package/dist/message-DktPWsWA.js +0 -223
- package/dist/message-action-runner-D5h5Bbhw.js +0 -2
- package/dist/message-action-runner-ezKz_h2P.js +0 -1628
- package/dist/message.gateway.runtime-ZPAymL77.js +0 -2
- package/dist/method-scopes-Dj9nhnXI.js +0 -2883
- package/dist/minimax-vlm-CtLVue6p.js +0 -183
- package/dist/minimax-web-search-provider-Cd-P4xbp.js +0 -165
- package/dist/mmr-CYI_i9v5.js +0 -146
- package/dist/model-B_-8Dp2m.js +0 -630
- package/dist/model-auth-HL2aJaae.js +0 -427
- package/dist/model-auth-env-Ckzim7ba.js +0 -2
- package/dist/model-auth-env-qNUE5jbD.js +0 -53
- package/dist/model-auth-label-BcJD9v1K.js +0 -45
- package/dist/model-catalog-Bkr4CqDm.js +0 -204
- package/dist/model-definitions-D1o_PR5n.js +0 -258
- package/dist/model-definitions-DJm7w6s6.js +0 -74
- package/dist/model-discovery-live.runtime-Ct-IkaF1.js +0 -419
- package/dist/model-discovery-modelsdev-B_Cpy5zK.js +0 -174
- package/dist/model-picker-B-xpoNbr.js +0 -500
- package/dist/model-picker-R0G2MgB_.js +0 -3
- package/dist/model-picker.runtime-BYwcAdzp.js +0 -15
- package/dist/model-selection-BheFUUQH.js +0 -381
- package/dist/models-BEEXc36p.js +0 -166
- package/dist/models-BPkdENoW.js +0 -2
- package/dist/models-BX49tVvV.js +0 -555
- package/dist/models-C03H7fA8.js +0 -157
- package/dist/models-D7VoP8nw.js +0 -760
- package/dist/models-DtHue44_.js +0 -47
- package/dist/models-HYQ1KAk_.js +0 -126
- package/dist/models-cli-BbXVjf9R.js +0 -198
- package/dist/models-config-B85vfu4p.js +0 -900
- package/dist/models-config.providers.secrets-CpQyoJal.js +0 -299
- package/dist/models-xp1rDutG.js +0 -2584
- package/dist/models.fetch-4YMjSao8.js +0 -518
- package/dist/monitor-BRNovC_Y.js +0 -1023
- package/dist/monitor-CKCVK6S4.js +0 -4435
- package/dist/music-generation-provider-BYL9HM9M.js +0 -238
- package/dist/music-generation-provider-BxTgkF9N.js +0 -142
- package/dist/music-generation-provider-CIJ6A211.js +0 -169
- package/dist/node-cli-Btl_VPq-.js +0 -2374
- package/dist/node-command-policy-NrFO7Yy5.js +0 -205
- package/dist/node-service-C5TgmiSv.js +0 -69
- package/dist/nodes-cli-BV6_k5Dm.js +0 -1046
- package/dist/nodes-screen-DXF9W1E2.js +0 -216
- package/dist/nodes-utils-C50A34ps.js +0 -196
- package/dist/nodes.helpers--U8G3EK-.js +0 -34
- package/dist/normalize-reply-lOvnPpkZ.js +0 -72
- package/dist/note-C-MCr2CR.js +0 -110
- package/dist/notify-CQt_pnIb.js +0 -305
- package/dist/oauth-BiAql40W.js +0 -152
- package/dist/oauth-Ca6vDvKF.js +0 -57
- package/dist/oauth-token-shared-2mBrCAD0.js +0 -28
- package/dist/oauth.credentials-CZ0vMrEi.js +0 -165
- package/dist/oauth.flow-DYTskRLV.js +0 -122
- package/dist/oauth.http-BWxW_gXO.js +0 -23
- package/dist/oauth.project-Cb5OEIsJ.js +0 -123
- package/dist/oauth.settings-CDxrRPQK.js +0 -44
- package/dist/oauth.token-Bru4bLzC.js +0 -43
- package/dist/onboard-C1B08y2Y.js +0 -25
- package/dist/onboard-CJdBVSv3.js +0 -25
- package/dist/onboard-CtbzdbPe.js +0 -312
- package/dist/onboard-DBdkbwl4.js +0 -621
- package/dist/onboard-DBjMgyJ9.js +0 -25
- package/dist/onboard-DIMihTCh.js +0 -36
- package/dist/onboard-DVhexP5q.js +0 -54
- package/dist/onboard-DVnq8yjP.js +0 -25
- package/dist/onboard-DX6XRus52.js +0 -58
- package/dist/onboard-D_Vx-9lK.js +0 -29
- package/dist/onboard-R8-I3hmu.js +0 -67
- package/dist/onboard-custom-BGpsNoJc.js +0 -647
- package/dist/onboard-custom-BHvw3fAA.js +0 -2
- package/dist/onboard-helpers-BeAYS2Qq.js +0 -223
- package/dist/onboard-helpers-CKb-ZP-L.js +0 -5
- package/dist/onboard-remote-BTBfReZD.js +0 -2
- package/dist/onboard-remote-DX0VcrI6.js +0 -193
- package/dist/onboard-skills-CZi8Ky26.js +0 -134
- package/dist/onboard-skills-DLC4BbyM.js +0 -2
- package/dist/openai-codex-auth-identity-ASruZ_P2.js +0 -45
- package/dist/openai-codex-cli-auth-Bt_S0j_c.js +0 -57
- package/dist/openai-codex-provider-BouOhpJB.js +0 -299
- package/dist/openai-codex-shared-DedETK99.js +0 -6
- package/dist/openai-provider-Jci9fP5i.js +0 -283
- package/dist/openai-transport-stream-DJo_5UPR.js +0 -1632
- package/dist/operator-approvals-client-D_up6Wq0.js +0 -68
- package/dist/outbound-runtime-DhL6nVw0.js +0 -2
- package/dist/pair-command-approve-DUMQ1lrT.js +0 -34
- package/dist/parse-DLTK-NVk.js +0 -168
- package/dist/perplexity-web-search-provider-uU3my6N4.js +0 -92
- package/dist/perplexity-web-search-provider.runtime-4zsB5_nx.js +0 -2
- package/dist/perplexity-web-search-provider.runtime-C7OOMB_b.js +0 -332
- package/dist/perplexity-web-search-provider.shared-BXQXODBs.js +0 -73
- package/dist/persistent-bindings.lifecycle-Du2uuiGS.js +0 -94
- package/dist/pi-embedded-C4xYML3_.js +0 -6
- package/dist/pi-embedded-Cbug4fLp.js +0 -2
- package/dist/pi-embedded-runner-CjJ1OH7H.js +0 -8348
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime-qoJmuaC3.js +0 -23
- package/dist/pi-embedded-utils-qmoBiSxI.js +0 -212
- package/dist/pi-embedded.runtime-PZWkJVMG.js +0 -5
- package/dist/pi-model-discovery-BhWyylI9.js +0 -232
- package/dist/plugin-enabled-BNJoHRI0.js +0 -71
- package/dist/plugin-registration-CdgdKLdK.js +0 -23
- package/dist/plugin-service-BjwQ0UnC.js +0 -2494
- package/dist/plugins-cli-Inx9NBeP.js +0 -576
- package/dist/plugins-update-command-DCBmHAcw.js +0 -1009
- package/dist/policy-C_NvSQ7D.js +0 -172
- package/dist/ports-2fHnkw5y.js +0 -433
- package/dist/ports-NdA63CHy.js +0 -263
- package/dist/preemptive-compaction-B2i0-LZS.js +0 -430
- package/dist/proactive-scheduler-CMe3amTs.js +0 -1444
- package/dist/probe-C5X2xHFS.js +0 -2
- package/dist/probe-D0gXnUmv.js +0 -426
- package/dist/probe-DwQLQHpB.js +0 -178
- package/dist/probe-aZFpBShN.js +0 -54
- package/dist/probe-auth-0-Td92Qd.js +0 -69
- package/dist/probe-auth-Zwhwfcyg.js +0 -3
- package/dist/program-DKVfTrYP.js +0 -111
- package/dist/prompt-overlay-BvX2tpcA.js +0 -72
- package/dist/prompt-select-styled-Cacsr7x1.js +0 -5305
- package/dist/provider-CWw9unv5.js +0 -70
- package/dist/provider-api-key-auth-DDqs17y7.js +0 -113
- package/dist/provider-api-key-auth.runtime-DFOWhO8H.js +0 -14
- package/dist/provider-auth-D28-DXtL.js +0 -36
- package/dist/provider-auth-api-key-BlUb_Gw8.js +0 -5
- package/dist/provider-auth-choice--RwbO1el.js +0 -134
- package/dist/provider-auth-choice-preference-Bay-KWTs.js +0 -62
- package/dist/provider-auth-input-Duh7v6fc.js +0 -117
- package/dist/provider-auth-login-CqDuosT-.js +0 -8
- package/dist/provider-auth-login.runtime-1ovWzWaE.js +0 -206
- package/dist/provider-auth-runtime-Bep_6xgO.js +0 -36
- package/dist/provider-catalog-B1UHTZ2J.js +0 -56
- package/dist/provider-catalog-BETTnkqQ.js +0 -11
- package/dist/provider-catalog-BgCSPWtg.js +0 -11
- package/dist/provider-catalog-COSwNV9M.js +0 -61
- package/dist/provider-catalog-CVtyzqed.js +0 -17
- package/dist/provider-catalog-D87LxNms.js +0 -26
- package/dist/provider-catalog-DUa_pOgJ.js +0 -75
- package/dist/provider-catalog-_qlQKmNX.js +0 -13
- package/dist/provider-catalog-fRX7Kwpd.js +0 -12
- package/dist/provider-catalog-fjbp4-73.js +0 -11
- package/dist/provider-catalog-kLIlcQiR.js +0 -18
- package/dist/provider-catalog-shared-CUCxLlCb.js +0 -104
- package/dist/provider-compat-CFb-paAS.js +0 -37
- package/dist/provider-discovery-D9udizRd.js +0 -2
- package/dist/provider-dispatcher-CICWLOwX.js +0 -22
- package/dist/provider-entry-D_0kX9WL.js +0 -97
- package/dist/provider-http-CCWzhnsk.js +0 -26
- package/dist/provider-model-shared-TaFcxfzp.js +0 -171
- package/dist/provider-models-3mIjIjQp.js +0 -22
- package/dist/provider-models-CvYgNrs5.js +0 -225
- package/dist/provider-models-D3D1lxRx.js +0 -169
- package/dist/provider-models-DACMEf7B.js +0 -116
- package/dist/provider-models-DoU8PeBb.js +0 -119
- package/dist/provider-models-gP-2JH8n.js +0 -35
- package/dist/provider-openai-codex-oauth-tls-CmSkuSt5.js +0 -99
- package/dist/provider-registration-CbWstPtp.js +0 -238
- package/dist/provider-registration-iGHQBjjx.js +0 -57
- package/dist/provider-stream-BwKmnNvt.js +0 -285
- package/dist/provider-stream-family-CuZuVwyU.js +0 -2
- package/dist/provider-stream-shared-DiqyLpmc.js +0 -80
- package/dist/provider-tools-C8ePitIe.js +0 -332
- package/dist/provider-usage-AerKfwcb.js +0 -289
- package/dist/provider-usage-B1OEBtrp.js +0 -3
- package/dist/provider-web-search-DNrh74o2.js +0 -55
- package/dist/provider-web-search-contract-CD7a3E_j.js +0 -12
- package/dist/provider-web-search-contract-fields-CZpi7HIW.js +0 -38
- package/dist/proxy-stream-wrappers-C_X_spRH.js +0 -480
- package/dist/push-apns-CHUTf5fh.js +0 -1061
- package/dist/pw-ai-DPV1q8xc.js +0 -2268
- package/dist/qmd-manager-Dlyrllit.js +0 -1799
- package/dist/qr-cli-Dxp3C4eA.js +0 -359
- package/dist/qr-image-BqQWAdsz.js +0 -2
- package/dist/queue-B6wGsjBh.js +0 -636
- package/dist/realtime-provider-shared-CjyMmm-x.js +0 -21
- package/dist/realtime-transcription-provider-C3KDEeGw.js +0 -180
- package/dist/realtime-voice-provider-WpxiXAqx.js +0 -342
- package/dist/record-shared-B1JngQ0O.js +0 -10
- package/dist/region-eNoH-aE8.js +0 -74
- package/dist/register.agent-DjEMzHSM.js +0 -241
- package/dist/register.configure-VpDjmPim.js +0 -15
- package/dist/register.maintenance-Bfd-BrEw.js +0 -443
- package/dist/register.message-BUAWvHEW.js +0 -601
- package/dist/register.onboard-D8DOKdFA.js +0 -83
- package/dist/register.runtime-BnPl3ouC.js +0 -343
- package/dist/register.runtime-C3VwoQaW.js +0 -81
- package/dist/register.setup-ED3BxpQA.js +0 -104
- package/dist/register.status-health-sessions-C0kPqTo8.js +0 -1211
- package/dist/register.subclis-BGrRMx_K.js +0 -3
- package/dist/register.subclis-BgdtMdC4.js +0 -232
- package/dist/remote-env-BAi-jql2.js +0 -12
- package/dist/replay-policy-COnD0YJl.js +0 -8
- package/dist/replay-policy-D4RdgaIZ.js +0 -10
- package/dist/reply-B9iku3Vu.js +0 -3523
- package/dist/reply-payloads-DaWnvZFb.js +0 -78
- package/dist/reply-prefix-D_x6MM3Q.js +0 -33
- package/dist/reply.runtime-DC_qTxWc.js +0 -2
- package/dist/resolve-D3giEZj4.js +0 -280
- package/dist/restart-handoff-lV2xM09Z.js +0 -2
- package/dist/restart-health-35eesagj.js +0 -203
- package/dist/restart-health-BotG9-Zg.js +0 -2
- package/dist/restart-pf6Zqlgl.js +0 -454
- package/dist/restart-stale-pids-DCtlWGBh.js +0 -529
- package/dist/retry-DSboRh9T.js +0 -76
- package/dist/retry-policy-CkDNftgh.js +0 -58
- package/dist/route-reply-BFcr1fvj.js +0 -141
- package/dist/route-reply.runtime-HOUK8uDO.js +0 -2
- package/dist/rpc-CQwfsySN.js +0 -61
- package/dist/rpc.runtime-DiwjuRBV.js +0 -21
- package/dist/run-main-OjNMZyXa.js +0 -453
- package/dist/run-wait-DMiGPgPf.js +0 -118
- package/dist/runner-B--qu6Qm.js +0 -1497
- package/dist/runtime-BJ0UokoN.js +0 -2
- package/dist/runtime-BSuZXVXq.js +0 -355
- package/dist/runtime-B_DKJsuG.js +0 -725
- package/dist/runtime-CI87-tZg.js +0 -191
- package/dist/runtime-Cc6PgJbr.js +0 -107
- package/dist/runtime-DGF3I3_g.js +0 -9
- package/dist/runtime-Dfvvcuic.js +0 -72
- package/dist/runtime-TNNT_OrI.js +0 -200
- package/dist/runtime-YH3CE4eQ2.js +0 -242
- package/dist/runtime-api-B5xKNnZ9.js +0 -12
- package/dist/runtime-api-CMG5-b6Q2.js +0 -2
- package/dist/runtime-api-ChFdpsKY.js +0 -3
- package/dist/runtime-embedded-pi.runtime-BszFlzTt.js +0 -3
- package/dist/runtime-env-Clh0MW-d.js +0 -9
- package/dist/runtime-internal-CoQKvsS_.js +0 -2
- package/dist/runtime-model-auth.runtime-Cya-LuWL.js +0 -39
- package/dist/runtime-plugins-DNdpXSxM.js +0 -69
- package/dist/runtime-prepare.runtime-CayOPY9P.js +0 -80
- package/dist/runtime-provider-C-L4QipI.js +0 -21
- package/dist/runtime-shared-Dy_2RXMm.js +0 -249
- package/dist/runtime-taskflow-N2ChOWcS.js +0 -250
- package/dist/runtime-web-channel-plugin-C8CjwZRm.js +0 -215
- package/dist/runtime-web-tools-BvAG0LO3.js +0 -1467
- package/dist/sandbox-Bbc-GWm9.js +0 -2586
- package/dist/sandbox-CSOc5tM4.js +0 -4
- package/dist/sandbox-cli-CT-AarMn.js +0 -447
- package/dist/schtasks-jmQncr1-.js +0 -785
- package/dist/secrets-cli-D1EGuqKu.js +0 -2114
- package/dist/security-audit-BeFqdMin.js +0 -34
- package/dist/security-cli-DbD2JBGF.js +0 -486
- package/dist/semantic-dedup-CZxiDAfb.js +0 -95
- package/dist/send-CGF-mKH3.js +0 -993
- package/dist/send-media-BCm-tPYM.js +0 -2123
- package/dist/server-BWwUuJYL.js +0 -77
- package/dist/server-cBkUNKnZ.js +0 -13
- package/dist/server-context-D_30U_XN.js +0 -4164
- package/dist/server-methods-Bs4pJXUR.js +0 -11937
- package/dist/server-middleware-Dr3VqWzc.js +0 -110
- package/dist/server-node-events-DVfmqVwQ.js +0 -451
- package/dist/server.impl-BJbVZ0t9.js +0 -19765
- package/dist/service-BI1Vz4Xe.js +0 -132
- package/dist/service-CHv4oM_x.js +0 -2
- package/dist/service-audit-DUt5vf5G.js +0 -254
- package/dist/service-audit-VJKA2Zjk.js +0 -2
- package/dist/session-SfhQH5KQ.js +0 -48
- package/dist/session-archive.runtime-B8CG4Ram.js +0 -2
- package/dist/session-conversation-l2xHTnMN.js +0 -27
- package/dist/session-cost-usage-BKZY5nPZ.js +0 -2
- package/dist/session-cost-usage-CmX6miDz.js +0 -648
- package/dist/session-file-CL6lkGa1.js +0 -44
- package/dist/session-key-BmBQ4szp.js +0 -65
- package/dist/session-meta-BR5xK9t1.js +0 -109
- package/dist/session-override-BKrEVfnV.js +0 -103
- package/dist/session-reset-model.runtime-Buk5p4ha.js +0 -120
- package/dist/session-reset-service-BVvvwdRa.js +0 -474
- package/dist/session-subagent-reactivation.runtime-BZNsC5wr.js +0 -2
- package/dist/session-tab-registry-XSWB4W6w.js +0 -553
- package/dist/session-updates-BteiRNzh.js +0 -234
- package/dist/session-updates.runtime-D2XSr1UE.js +0 -2
- package/dist/session-utils-B-CMvBgt.js +0 -930
- package/dist/session-utils.fs-CYcamwPP.js +0 -537
- package/dist/sessions-B5jygaWj.js +0 -231
- package/dist/sessions-BD7awYpY.js +0 -45
- package/dist/sessions-BzM5kMV8.js +0 -2
- package/dist/sessions.runtime-oTrbiPRt.js +0 -2
- package/dist/setup-BoZjwU6i.js +0 -505
- package/dist/setup-DQ_xc449.js +0 -329
- package/dist/setup-Dm1kEe1b.js +0 -15
- package/dist/setup-binary-BJMUy4FP.js +0 -2
- package/dist/setup-surface-D8PAGJCT.js +0 -586
- package/dist/setup-tools-B1DDAQcl.js +0 -4
- package/dist/setup-wizard-proxy-CXecAj2f.js +0 -139
- package/dist/setup.finalize-DYg55WnG.js +0 -436
- package/dist/setup.gateway-config-DWNIMpld.js +0 -246
- package/dist/shared-B1VFlQTd.js +0 -218
- package/dist/shared-B5czq-MF.js +0 -175
- package/dist/shared-BQt90p2U.js +0 -36
- package/dist/shared-CIgFLTPv.js +0 -127
- package/dist/shared-CQhbwWcx.js +0 -219
- package/dist/shared-DDPpwpbe.js +0 -137
- package/dist/shared-DyzdPKTA.js +0 -224
- package/dist/shared-runtime-D-MybTye.js +0 -7
- package/dist/short-term-promotion-Dj0a8ugl.js +0 -1631
- package/dist/simple-completion-runtime-BFLs1pEi.js +0 -131
- package/dist/simple-completion-transport-RE6NPD4B.js +0 -32
- package/dist/skill-commands-CskrC_3W.js +0 -82
- package/dist/skill-commands.runtime-BQvrQPdi.js +0 -2
- package/dist/skills-install-Dg0hrLqC.js +0 -822
- package/dist/speech-core-Dg6E-HQH.js +0 -126
- package/dist/speech-provider-B8AJ3snZ.js +0 -103
- package/dist/speech-provider-B9cT4Gjm.js +0 -39
- package/dist/speech-provider-Bi2E3iv8.js +0 -182
- package/dist/speech-provider-CZSo12LO.js +0 -101
- package/dist/speech-provider-Cj9cz2XB.js +0 -184
- package/dist/speech-provider-R64i_C4Y.js +0 -167
- package/dist/ssh-tunnel-dSVKikW0.js +0 -159
- package/dist/ssh-tunnel-tfx0yANN.js +0 -2
- package/dist/ssrf-runtime-CGgU7d_A.js +0 -6
- package/dist/stage-sandbox-media.runtime-vS4_gqco.js +0 -230
- package/dist/standalone-generate-CEVB92OE.js +0 -217
- package/dist/standalone-generate-EPaOZgrf.js +0 -2
- package/dist/state-migrations-uFpgm1mQ.js +0 -823
- package/dist/status-BLvCM5Ba.js +0 -399
- package/dist/status-CjZEGpOn.js +0 -500
- package/dist/status-CtGb77xh.js +0 -473
- package/dist/status-DeOg-kac.js +0 -2
- package/dist/status-all-CUUt2uLK.js +0 -495
- package/dist/status-json-CKZoUDkl.js +0 -14
- package/dist/status-json-command-BZpfq-t-.js +0 -92
- package/dist/status-runtime-shared-3yS4P9VD.js +0 -271
- package/dist/status-scF4idaf.js +0 -3
- package/dist/status.agent-local-BjZrgfxM.js +0 -58
- package/dist/status.command.text-runtime-BJVN8JqQ.js +0 -15
- package/dist/status.format-BB7s3jni.js +0 -60
- package/dist/status.gateway-connection.runtime-Cdh_gMsz.js +0 -2
- package/dist/status.gateway-probe-Bx2GQ9TU.js +0 -16
- package/dist/status.scan-XFmv1sO8.js +0 -62
- package/dist/status.scan-overview-yDUTiScm.js +0 -395
- package/dist/status.scan.fast-json-CyTKi1z8.js +0 -128
- package/dist/status.scan.fast-json-FEegP0m5.js +0 -2
- package/dist/status.scan.runtime-DPX-O1i4.js +0 -417
- package/dist/status.summary-CLyVQFLP.js +0 -2
- package/dist/status.summary-DYD-kVqt.js +0 -209
- package/dist/status.update-D0v2dhjh.js +0 -2
- package/dist/status.update-fG9weCeY.js +0 -79
- package/dist/store-CB8cC8s0.js +0 -1112
- package/dist/store.runtime-ItAjV6eb.js +0 -2
- package/dist/stream-BPDfd8e1.js +0 -129
- package/dist/stream-BmplokBX.js +0 -649
- package/dist/stream-CxHR78zN.js +0 -26
- package/dist/stream-DBSqjZK_.js +0 -153
- package/dist/stream-DnQfYsj6.js +0 -27
- package/dist/stream-W2dOHnSg.js +0 -76
- package/dist/stream-wrappers-DarIRPWz.js +0 -144
- package/dist/strip-inbound-meta-BltI8kVf.js +0 -155
- package/dist/subagent-announce.registry.runtime-B2pfZw2p.js +0 -3
- package/dist/subagent-control-BTb1NZKm.js +0 -485
- package/dist/subagent-followup.runtime-CxXMev7H.js +0 -68
- package/dist/subagent-list-CU2DlTNj.js +0 -168
- package/dist/subagent-orphan-recovery-lqdIgbEP.js +0 -214
- package/dist/subagent-registry-apNqP8Xn.js +0 -2889
- package/dist/subagent-registry-read-C8xgeh3J.js +0 -57
- package/dist/subagent-registry-runtime-lzitxvG1.js +0 -2
- package/dist/subagent-registry.runtime-DMnY4uWu.js +0 -3
- package/dist/subagent-spawn-lUENqxqV.js +0 -782
- package/dist/subagents-format-CAP1ruPY.js +0 -629
- package/dist/supervisor-DLgjrm-c.js +0 -737
- package/dist/system-cli-BCgDARtJ.js +0 -60
- package/dist/system-prompt-C414pRhO.js +0 -2
- package/dist/system-prompt-T5mXJ7TP.js +0 -711
- package/dist/system-prompt-cache-boundary-NtELRwVL.js +0 -25
- package/dist/system-run-command-DKJXglyj.js +0 -300
- package/dist/systemd-CuaTSaBa.js +0 -591
- package/dist/systemd-hints-B_h09Mzm.js +0 -76
- package/dist/systemd-linger-BA63Qx3W.js +0 -2
- package/dist/systemd-linger-DQ03a1ek.js +0 -68
- package/dist/tables-DFdELq_3.js +0 -832
- package/dist/tailscale-status-PTtL7jnj.js +0 -72
- package/dist/targets-CRHINrER.js +0 -300
- package/dist/targets-UyRPOuj6.js +0 -595
- package/dist/targets.runtime-vvzN_6WM.js +0 -2
- package/dist/task-executor-CtuKi2TZ.js +0 -350
- package/dist/task-owner-access-DhSShXSw.js +0 -48
- package/dist/task-registry-control.runtime-CsUj_KYA.js +0 -3
- package/dist/task-registry-delivery-runtime-Dic6aaTy.js +0 -3
- package/dist/task-registry-delivery-runtime-DtH77Z_E.js +0 -2
- package/dist/task-registry-tECWk779.js +0 -2346
- package/dist/task-registry.maintenance-Du91FMxz.js +0 -2
- package/dist/task-registry.maintenance-IBRK-koK.js +0 -425
- package/dist/testing-DyM4-o2f.js +0 -441
- package/dist/text-report-BEzLSDXl.js +0 -587
- package/dist/text-runtime-CjATQur1.js +0 -313
- package/dist/thread-bindings-BuyhU9E1.js +0 -223
- package/dist/tool-auth-shared-CPke5dxM.js +0 -53
- package/dist/tool-config-shared-DT9mUxpt.js +0 -19
- package/dist/tool-schema-runtime-DTZlFcMR.js +0 -1892
- package/dist/tools-effective-inventory-B16Ib7bd.js +0 -152
- package/dist/tools.runtime-B6sF2TBH.js +0 -4
- package/dist/transcript-0fLDbW8-.js +0 -222
- package/dist/transcript-B3chs9GK.js +0 -191
- package/dist/transcript-DQsKeQyR.js +0 -2
- package/dist/transcript.runtime-Bz9gTz-q.js +0 -2
- package/dist/transport-policy-BLTAZ-oe.js +0 -75
- package/dist/transport-ready-CjD7QFVT.js +0 -36
- package/dist/tts-BKZmS4xr.js +0 -40
- package/dist/tts-BObT55hT.js +0 -31
- package/dist/tui-B9QEI36P.js +0 -4018
- package/dist/tui-cli-D0ST19K6.js +0 -31
- package/dist/typing-mode-BueK7uiv.js +0 -84
- package/dist/undici-global-dispatcher-eRWmqD02.js +0 -99
- package/dist/update-Bhmi2Spr.js +0 -1253
- package/dist/update-check-JM7VVIJX.js +0 -431
- package/dist/update-cli-BlJMXLUZ.js +0 -1779
- package/dist/update-runner-BhQ8gYeg.js +0 -1492
- package/dist/usage-AvsukxPf.js +0 -71
- package/dist/usage-format-CiHAOGUv.js +0 -2
- package/dist/usage-format-DEkEYT6G.js +0 -507
- package/dist/utils-BwORcPSF.js +0 -189
- package/dist/video-generation-D4NjX7OM.js +0 -167
- package/dist/video-generation-provider--Hl1nMjg.js +0 -233
- package/dist/video-generation-provider-BYmO0XfA.js +0 -104
- package/dist/video-generation-provider-CTlDBaAN.js +0 -240
- package/dist/video-generation-provider-Cx3N6a-k.js +0 -263
- package/dist/video-generation-provider-CxAzTS6S.js +0 -181
- package/dist/video-generation-provider-D2-wBkk8.js +0 -246
- package/dist/video-generation-provider-DhD2Xpwp.js +0 -64
- package/dist/video-generation-provider-Dp7jqb8H.js +0 -77
- package/dist/video-generation-provider-WfRVn7Nn.js +0 -227
- package/dist/video-generation-provider-lCyC0SPc.js +0 -171
- package/dist/video-http-CqiFyKro.js +0 -29
- package/dist/video-model-catalog-Dujyv6aJ.js +0 -187
- package/dist/web-media-B770i-06.js +0 -2
- package/dist/web-media-CfbPpWDK.js +0 -330
- package/dist/web-search-C7rRmaDZ.js +0 -221
- package/dist/web-search-provider-DXmbjaIP.js +0 -155
- package/dist/web-search-provider-common-DxHMfm5S.js +0 -206
- package/dist/web-search-provider-config-DopQHA3M.js +0 -52
- package/dist/web-shared-BQmfD1uO.js +0 -414
- package/dist/x-search-shared-C-MC18vi.js +0 -109
- /package/dist/{account-lookup-44DR0qFz.js → account-lookup-DvZ7IbyB.js} +0 -0
- /package/dist/{auth-profiles.runtime-CeH05HY2.js → auth-profiles.runtime-CNNciZQU.js} +0 -0
- /package/dist/{backoff-CoEL_G0O.js → backoff-D10eQVn6.js} +0 -0
- /package/dist/{chat-envelope-C8CaVGEc.js → chat-envelope-C14DhfdY.js} +0 -0
- /package/dist/{chat-message-content-BmiUVjys.js → chat-message-content-N9aXPKj0.js} +0 -0
- /package/dist/{commands-H3Ab0eU8.js → commands-BNMz19sX.js} +0 -0
- /package/dist/{control-ui-shared-upny-T3O.js → control-ui-shared-Bdc3sIMw.js} +0 -0
- /package/dist/{detect-binary-BF7GWFFn.js → detect-binary-DykWiFpV.js} +0 -0
- /package/dist/{device-auth-ChMjC2OY.js → device-auth-Co78c3Fk.js} +0 -0
- /package/dist/{device-identity-CnWSzhCW.js → device-identity-BbqzkeXB.js} +0 -0
- /package/dist/{device-metadata-normalization-BCk_oevU.js → device-metadata-normalization-_VVweA-R.js} +0 -0
- /package/dist/{directive-tags-C-tVOPf_.js → directive-tags-DISVLDCp.js} +0 -0
- /package/dist/{exec-file-CMG8z0ly.js → exec-file-CJGGCNuX.js} +0 -0
- /package/dist/{fetch-timeout-BAjBTvFf.js → fetch-timeout-BCovYv8d.js} +0 -0
- /package/dist/{fingerprint-vRPYSVrE.js → fingerprint-Dl8U2WD6.js} +0 -0
- /package/dist/{identity-BtgZsd-F.js → identity-Dplh_aWR.js} +0 -0
- /package/dist/{input-provenance-CqVg_UvP.js → input-provenance-DXlFriXS.js} +0 -0
- /package/dist/{issue-format-BJCe7wW8.js → issue-format-CxtLa4Cu.js} +0 -0
- /package/dist/{kill-tree-cyGT7uvN.js → kill-tree-DCyfVQx0.js} +0 -0
- /package/dist/{model-auth-markers-CrDTQj4i.js → model-auth-markers-BR92KCie.js} +0 -0
- /package/dist/{model-auth-runtime-shared-Dlg_9I8x.js → model-auth-runtime-shared-7sMIRCy3.js} +0 -0
- /package/dist/{number-coercion-D1JCit9l.js → number-coercion-Cmu1aJr8.js} +0 -0
- /package/dist/{plugin-approvals-D2nSmWGQ.js → plugin-approvals-BVOH9uWd.js} +0 -0
- /package/dist/{plugin-web-search-config-CM7ac77h.js → plugin-web-search-config-Vy4SBasR.js} +0 -0
- /package/dist/{ports-lsof-rC3_YG8t.js → ports-lsof-C7nTF2Et.js} +0 -0
- /package/dist/{ports-probe-CKr2RdYw.js → ports-probe-BFA3MD3-.js} +0 -0
- /package/dist/{prompt-cache-stability-DdwE3HeP.js → prompt-cache-stability-CgXAu47S.js} +0 -0
- /package/dist/{prompt-style-BCo80D6m.js → prompt-style-BCVDnx1C.js} +0 -0
- /package/dist/{provider-discovery-RmybjjET.js → provider-discovery-DfcBjamA.js} +0 -0
- /package/dist/{provider-model-compat-CsF2NGa6.js → provider-model-compat-DfOMY_2L.js} +0 -0
- /package/dist/{restart-handoff-B3HMjoAC.js → restart-handoff-CUig5xgo.js} +0 -0
- /package/dist/{runtime-parse-D4az8KIY.js → runtime-parse-DYEtqXT6.js} +0 -0
- /package/dist/{runtime-status-Di5Hf2P6.js → runtime-status-Cph8qA_2.js} +0 -0
- /package/dist/{schtasks-exec-BgQqxhbL.js → schtasks-exec-wK5FEC9N.js} +0 -0
- /package/dist/{session-transcript-files.fs-CTjDzbyc.js → session-transcript-files.fs-98DIXUOq.js} +0 -0
- /package/dist/{subagent-registry-state-zLMA_MzM.js → subagent-registry-state-CjRrrVgp.js} +0 -0
- /package/dist/{subagent-session-metrics-BgoCTpFX.js → subagent-session-metrics-8IQoh3DH.js} +0 -0
- /package/dist/{targets-DOJmrCN8.js → targets-uT1GHLfz.js} +0 -0
- /package/dist/{thread-info-BvQiu1xr.js → thread-info-DjVKrfI6.js} +0 -0
- /package/dist/{tokens-DIzGgGwL.js → tokens-CB2-NTu5.js} +0 -0
- /package/dist/{transcript-events-BC4_m8-c.js → transcript-events-B4kB35M0.js} +0 -0
- /package/dist/{transcript-mirror-BlMhpuHP.js → transcript-mirror-BQwPaEwA.js} +0 -0
- /package/dist/{wsl-DQ0RgjjQ.js → wsl-084fnhGP.js} +0 -0
- /package/dist/{zod-parse-Cu9hgbVC.js → zod-parse-DRCmgWgX.js} +0 -0
package/dist/manager-Dgu69d8y.js
DELETED
|
@@ -1,3314 +0,0 @@
|
|
|
1
|
-
import { i as normalizeLowercaseStringOrEmpty } from "./string-coerce-xZwG7Dq8.js";
|
|
2
|
-
import { r as formatErrorMessage } from "./errors-Ez4cKI2Y.js";
|
|
3
|
-
import { b as truncateUtf16Safe, m as resolveUserPath } from "./utils-C8dt4mi-.js";
|
|
4
|
-
import { t as createSubsystemLogger } from "./subsystem-BikUf0BS.js";
|
|
5
|
-
import { n as resolveGlobalSingleton } from "./global-singleton-DSEXPThW.js";
|
|
6
|
-
import { a as resolveAgentDir, p as resolveAgentWorkspaceDir } from "./agent-scope-z3lpbLWu.js";
|
|
7
|
-
import { t as getProviderEnvVars } from "./provider-env-vars-CCNAnvw1.js";
|
|
8
|
-
import { c as resolveSessionTranscriptsDirForAgent } from "./paths-DrQr2my6.js";
|
|
9
|
-
import { n as onSessionTranscriptUpdate } from "./transcript-events-BC4_m8-c.js";
|
|
10
|
-
import { i as getMemoryMultimodalExtensions, r as classifyMemoryMultimodalPath, t as buildCaseInsensitiveExtensionGlob } from "./multimodal-wvoT0UA9.js";
|
|
11
|
-
import { n as listMemoryEmbeddingProviders, r as listRegisteredMemoryEmbeddingProviderAdapters, t as getMemoryEmbeddingProvider } from "./memory-embedding-provider-runtime-rD89o-fZ.js";
|
|
12
|
-
import { t as resolveMemorySearchConfig } from "./memory-search-BR_QeLiB.js";
|
|
13
|
-
import { t as extractKeywords } from "./query-expansion-DZmPTJZ2.js";
|
|
14
|
-
import "./text-runtime-CjATQur1.js";
|
|
15
|
-
import "./error-runtime-CjdJMgGl.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-TCZa_GcL.js";
|
|
17
|
-
import { r as readMemoryFile } from "./backend-config-CLRxp1xK.js";
|
|
18
|
-
import { C as buildGeminiEmbeddingRequest, S as DEFAULT_GEMINI_EMBEDDING_MODEL, _ as DEFAULT_LMSTUDIO_EMBEDDING_MODEL, a as runOpenAiEmbeddingBatches, c as createLocalEmbeddingProvider, d as DEFAULT_OPENAI_EMBEDDING_MODEL, f as createOpenAiEmbeddingProvider, g as createMistralEmbeddingProvider, h as DEFAULT_MISTRAL_EMBEDDING_MODEL, i as OPENAI_BATCH_ENDPOINT, l as DEFAULT_VOYAGE_EMBEDDING_MODEL, n as enforceEmbeddingMaxInputTokens, o as runGeminiEmbeddingBatches, r as runVoyageEmbeddingBatches, s as DEFAULT_LOCAL_MODEL, u as createVoyageEmbeddingProvider, v as createLmstudioEmbeddingProvider, w as createGeminiEmbeddingProvider } from "./engine-embeddings-UKC8SpiN.js";
|
|
19
|
-
import "./memory-core-host-engine-embeddings-DT26N-48.js";
|
|
20
|
-
import "./memory-core-host-engine-foundation-DHbdNLgZ.js";
|
|
21
|
-
import { i as sessionPathForFile, r as listSessionFilesForAgent, t as buildSessionEntry } from "./session-files-df0MVPzf.js";
|
|
22
|
-
import "./memory-core-host-engine-qmd-CZXRycnv.js";
|
|
23
|
-
import { n as loadSqliteVecExtension, r as ensureMemoryIndexSchema, t as requireNodeSqlite } from "./engine-storage-B9QalbVC.js";
|
|
24
|
-
import "./memory-core-host-engine-storage-JditWiSB.js";
|
|
25
|
-
import "./provider-env-vars-yCHiZMoj.js";
|
|
26
|
-
import { n as applyMMRToHybridResults, t as DEFAULT_MMR_CONFIG } from "./mmr-CYI_i9v5.js";
|
|
27
|
-
import { n as deduplicateBySimilarity, t as DEFAULT_SEMANTIC_DEDUP_CONFIG } from "./semantic-dedup-CZxiDAfb.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 && params.provider !== null && !meta.vectorDims || (meta.ftsTokenizer ?? "porter") !== (params.ftsTokenizer ?? "porter");
|
|
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
|
-
hasVectorTable() {
|
|
1169
|
-
return this.db.prepare(`SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?`).get(VECTOR_TABLE$2) !== void 0;
|
|
1170
|
-
}
|
|
1171
|
-
buildSourceFilter(alias) {
|
|
1172
|
-
const sources = Array.from(this.sources);
|
|
1173
|
-
if (sources.length === 0) return {
|
|
1174
|
-
sql: "",
|
|
1175
|
-
params: []
|
|
1176
|
-
};
|
|
1177
|
-
return {
|
|
1178
|
-
sql: ` AND ${alias ? `${alias}.source` : "source"} IN (${sources.map(() => "?").join(", ")})`,
|
|
1179
|
-
params: sources
|
|
1180
|
-
};
|
|
1181
|
-
}
|
|
1182
|
-
openDatabase() {
|
|
1183
|
-
return openMemoryDatabaseAtPath(resolveUserPath(this.settings.store.path), this.settings.store.vector.enabled);
|
|
1184
|
-
}
|
|
1185
|
-
seedEmbeddingCache(sourceDb) {
|
|
1186
|
-
if (!this.cache.enabled) return;
|
|
1187
|
-
try {
|
|
1188
|
-
const rows = sourceDb.prepare(`SELECT provider, model, provider_key, hash, embedding, dims, updated_at FROM ${EMBEDDING_CACHE_TABLE$2}`).all();
|
|
1189
|
-
if (!rows.length) return;
|
|
1190
|
-
const insert = this.db.prepare(`INSERT INTO ${EMBEDDING_CACHE_TABLE$2} (provider, model, provider_key, hash, embedding, dims, updated_at)
|
|
1191
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
1192
|
-
ON CONFLICT(provider, model, provider_key, hash) DO UPDATE SET
|
|
1193
|
-
embedding=excluded.embedding,
|
|
1194
|
-
dims=excluded.dims,
|
|
1195
|
-
updated_at=excluded.updated_at`);
|
|
1196
|
-
this.db.exec("BEGIN");
|
|
1197
|
-
for (const row of rows) insert.run(row.provider, row.model, row.provider_key, row.hash, row.embedding, row.dims, row.updated_at);
|
|
1198
|
-
this.db.exec("COMMIT");
|
|
1199
|
-
} catch (err) {
|
|
1200
|
-
try {
|
|
1201
|
-
this.db.exec("ROLLBACK");
|
|
1202
|
-
} catch {}
|
|
1203
|
-
throw err;
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
ensureSchema() {
|
|
1207
|
-
const result = ensureMemoryIndexSchema({
|
|
1208
|
-
db: this.db,
|
|
1209
|
-
embeddingCacheTable: EMBEDDING_CACHE_TABLE$2,
|
|
1210
|
-
cacheEnabled: this.cache.enabled,
|
|
1211
|
-
ftsTable: FTS_TABLE$2,
|
|
1212
|
-
ftsEnabled: this.fts.enabled,
|
|
1213
|
-
ftsTokenizer: this.settings.store.fts.tokenizer
|
|
1214
|
-
});
|
|
1215
|
-
this.fts.available = result.ftsAvailable;
|
|
1216
|
-
if (result.ftsError) {
|
|
1217
|
-
this.fts.loadError = result.ftsError;
|
|
1218
|
-
if (this.fts.enabled) log$3.warn(`fts unavailable: ${result.ftsError}`);
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
ensureWatcher() {
|
|
1222
|
-
if (!this.sources.has("memory") || !this.settings.sync.watch || this.watcher) return;
|
|
1223
|
-
const watchPaths = new Set([
|
|
1224
|
-
path.join(this.workspaceDir, "MEMORY.md"),
|
|
1225
|
-
path.join(this.workspaceDir, "memory.md"),
|
|
1226
|
-
path.join(this.workspaceDir, "memory")
|
|
1227
|
-
]);
|
|
1228
|
-
const additionalPaths = normalizeExtraMemoryPaths(this.workspaceDir, this.settings.extraPaths);
|
|
1229
|
-
for (const entry of additionalPaths) try {
|
|
1230
|
-
const stat = fs.lstatSync(entry);
|
|
1231
|
-
if (stat.isSymbolicLink()) continue;
|
|
1232
|
-
if (stat.isDirectory()) {
|
|
1233
|
-
watchPaths.add(path.join(entry, "**", "*.md"));
|
|
1234
|
-
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)));
|
|
1235
|
-
continue;
|
|
1236
|
-
}
|
|
1237
|
-
if (stat.isFile() && (normalizeLowercaseStringOrEmpty(entry).endsWith(".md") || classifyMemoryMultimodalPath(entry, this.settings.multimodal) !== null)) watchPaths.add(entry);
|
|
1238
|
-
} catch {}
|
|
1239
|
-
this.watcher = chokidar.watch(Array.from(watchPaths), {
|
|
1240
|
-
ignoreInitial: true,
|
|
1241
|
-
ignored: (watchPath, stats) => shouldIgnoreMemoryWatchPath(watchPath, stats, this.settings.multimodal),
|
|
1242
|
-
awaitWriteFinish: {
|
|
1243
|
-
stabilityThreshold: this.settings.sync.watchDebounceMs,
|
|
1244
|
-
pollInterval: 100
|
|
1245
|
-
}
|
|
1246
|
-
});
|
|
1247
|
-
const markDirty = () => {
|
|
1248
|
-
this.dirty = true;
|
|
1249
|
-
this.scheduleWatchSync();
|
|
1250
|
-
};
|
|
1251
|
-
this.watcher.on("add", markDirty);
|
|
1252
|
-
this.watcher.on("change", markDirty);
|
|
1253
|
-
this.watcher.on("unlink", markDirty);
|
|
1254
|
-
}
|
|
1255
|
-
ensureSessionListener() {
|
|
1256
|
-
if (!this.sources.has("sessions") || this.sessionUnsubscribe) return;
|
|
1257
|
-
this.sessionUnsubscribe = onSessionTranscriptUpdate((update) => {
|
|
1258
|
-
if (this.closed) return;
|
|
1259
|
-
const sessionFile = update.sessionFile;
|
|
1260
|
-
if (!this.isSessionFileForAgent(sessionFile)) return;
|
|
1261
|
-
this.scheduleSessionDirty(sessionFile);
|
|
1262
|
-
});
|
|
1263
|
-
}
|
|
1264
|
-
scheduleSessionDirty(sessionFile) {
|
|
1265
|
-
this.sessionPendingFiles.add(sessionFile);
|
|
1266
|
-
if (this.sessionWatchTimer) return;
|
|
1267
|
-
this.sessionWatchTimer = setTimeout(() => {
|
|
1268
|
-
this.sessionWatchTimer = null;
|
|
1269
|
-
this.processSessionDeltaBatch().catch((err) => {
|
|
1270
|
-
log$3.warn(`memory session delta failed: ${String(err)}`);
|
|
1271
|
-
});
|
|
1272
|
-
}, SESSION_DIRTY_DEBOUNCE_MS);
|
|
1273
|
-
}
|
|
1274
|
-
async processSessionDeltaBatch() {
|
|
1275
|
-
if (this.sessionPendingFiles.size === 0) return;
|
|
1276
|
-
const pending = Array.from(this.sessionPendingFiles);
|
|
1277
|
-
this.sessionPendingFiles.clear();
|
|
1278
|
-
let shouldSync = false;
|
|
1279
|
-
for (const sessionFile of pending) {
|
|
1280
|
-
const delta = await this.updateSessionDelta(sessionFile);
|
|
1281
|
-
if (!delta) continue;
|
|
1282
|
-
const bytesThreshold = delta.deltaBytes;
|
|
1283
|
-
const messagesThreshold = delta.deltaMessages;
|
|
1284
|
-
const bytesHit = bytesThreshold <= 0 ? delta.pendingBytes > 0 : delta.pendingBytes >= bytesThreshold;
|
|
1285
|
-
const messagesHit = messagesThreshold <= 0 ? delta.pendingMessages > 0 : delta.pendingMessages >= messagesThreshold;
|
|
1286
|
-
if (!bytesHit && !messagesHit) continue;
|
|
1287
|
-
this.sessionsDirtyFiles.add(sessionFile);
|
|
1288
|
-
this.sessionsDirty = true;
|
|
1289
|
-
delta.pendingBytes = bytesThreshold > 0 ? Math.max(0, delta.pendingBytes - bytesThreshold) : 0;
|
|
1290
|
-
delta.pendingMessages = messagesThreshold > 0 ? Math.max(0, delta.pendingMessages - messagesThreshold) : 0;
|
|
1291
|
-
shouldSync = true;
|
|
1292
|
-
}
|
|
1293
|
-
if (shouldSync) this.sync({ reason: "session-delta" }).catch((err) => {
|
|
1294
|
-
log$3.warn(`memory sync failed (session-delta): ${String(err)}`);
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
|
-
async updateSessionDelta(sessionFile) {
|
|
1298
|
-
const thresholds = this.settings.sync.sessions;
|
|
1299
|
-
if (!thresholds) return null;
|
|
1300
|
-
let stat;
|
|
1301
|
-
try {
|
|
1302
|
-
stat = await fs$1.stat(sessionFile);
|
|
1303
|
-
} catch {
|
|
1304
|
-
return null;
|
|
1305
|
-
}
|
|
1306
|
-
const size = stat.size;
|
|
1307
|
-
let state = this.sessionDeltas.get(sessionFile);
|
|
1308
|
-
if (!state) {
|
|
1309
|
-
state = {
|
|
1310
|
-
lastSize: 0,
|
|
1311
|
-
pendingBytes: 0,
|
|
1312
|
-
pendingMessages: 0
|
|
1313
|
-
};
|
|
1314
|
-
this.sessionDeltas.set(sessionFile, state);
|
|
1315
|
-
}
|
|
1316
|
-
const deltaBytes = Math.max(0, size - state.lastSize);
|
|
1317
|
-
if (deltaBytes === 0 && size === state.lastSize) return {
|
|
1318
|
-
deltaBytes: thresholds.deltaBytes,
|
|
1319
|
-
deltaMessages: thresholds.deltaMessages,
|
|
1320
|
-
pendingBytes: state.pendingBytes,
|
|
1321
|
-
pendingMessages: state.pendingMessages
|
|
1322
|
-
};
|
|
1323
|
-
if (size < state.lastSize) {
|
|
1324
|
-
state.lastSize = size;
|
|
1325
|
-
state.pendingBytes += size;
|
|
1326
|
-
if (thresholds.deltaMessages > 0 && (thresholds.deltaBytes <= 0 || state.pendingBytes < thresholds.deltaBytes)) state.pendingMessages += await this.countNewlines(sessionFile, 0, size);
|
|
1327
|
-
} else {
|
|
1328
|
-
state.pendingBytes += deltaBytes;
|
|
1329
|
-
if (thresholds.deltaMessages > 0 && (thresholds.deltaBytes <= 0 || state.pendingBytes < thresholds.deltaBytes)) state.pendingMessages += await this.countNewlines(sessionFile, state.lastSize, size);
|
|
1330
|
-
state.lastSize = size;
|
|
1331
|
-
}
|
|
1332
|
-
this.sessionDeltas.set(sessionFile, state);
|
|
1333
|
-
return {
|
|
1334
|
-
deltaBytes: thresholds.deltaBytes,
|
|
1335
|
-
deltaMessages: thresholds.deltaMessages,
|
|
1336
|
-
pendingBytes: state.pendingBytes,
|
|
1337
|
-
pendingMessages: state.pendingMessages
|
|
1338
|
-
};
|
|
1339
|
-
}
|
|
1340
|
-
async countNewlines(absPath, start, end) {
|
|
1341
|
-
if (end <= start) return 0;
|
|
1342
|
-
let handle;
|
|
1343
|
-
try {
|
|
1344
|
-
handle = await fs$1.open(absPath, "r");
|
|
1345
|
-
} catch (err) {
|
|
1346
|
-
if (isFileMissingError(err)) return 0;
|
|
1347
|
-
throw err;
|
|
1348
|
-
}
|
|
1349
|
-
try {
|
|
1350
|
-
let offset = start;
|
|
1351
|
-
let count = 0;
|
|
1352
|
-
const buffer = Buffer.alloc(SESSION_DELTA_READ_CHUNK_BYTES);
|
|
1353
|
-
while (offset < end) {
|
|
1354
|
-
const toRead = Math.min(buffer.length, end - offset);
|
|
1355
|
-
const { bytesRead } = await handle.read(buffer, 0, toRead, offset);
|
|
1356
|
-
if (bytesRead <= 0) break;
|
|
1357
|
-
for (let i = 0; i < bytesRead; i += 1) if (buffer[i] === 10) count += 1;
|
|
1358
|
-
offset += bytesRead;
|
|
1359
|
-
}
|
|
1360
|
-
return count;
|
|
1361
|
-
} finally {
|
|
1362
|
-
await handle.close();
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
resetSessionDelta(absPath, size) {
|
|
1366
|
-
const state = this.sessionDeltas.get(absPath);
|
|
1367
|
-
if (!state) return;
|
|
1368
|
-
state.lastSize = size;
|
|
1369
|
-
state.pendingBytes = 0;
|
|
1370
|
-
state.pendingMessages = 0;
|
|
1371
|
-
}
|
|
1372
|
-
isSessionFileForAgent(sessionFile) {
|
|
1373
|
-
if (!sessionFile) return false;
|
|
1374
|
-
const sessionsDir = resolveSessionTranscriptsDirForAgent(this.agentId);
|
|
1375
|
-
const resolvedFile = path.resolve(sessionFile);
|
|
1376
|
-
const resolvedDir = path.resolve(sessionsDir);
|
|
1377
|
-
return resolvedFile.startsWith(`${resolvedDir}${path.sep}`);
|
|
1378
|
-
}
|
|
1379
|
-
normalizeTargetSessionFiles(sessionFiles) {
|
|
1380
|
-
if (!sessionFiles || sessionFiles.length === 0) return null;
|
|
1381
|
-
const normalized = /* @__PURE__ */ new Set();
|
|
1382
|
-
for (const sessionFile of sessionFiles) {
|
|
1383
|
-
const trimmed = sessionFile.trim();
|
|
1384
|
-
if (!trimmed) continue;
|
|
1385
|
-
const resolved = path.resolve(trimmed);
|
|
1386
|
-
if (this.isSessionFileForAgent(resolved)) normalized.add(resolved);
|
|
1387
|
-
}
|
|
1388
|
-
return normalized.size > 0 ? normalized : null;
|
|
1389
|
-
}
|
|
1390
|
-
ensureIntervalSync() {
|
|
1391
|
-
const minutes = this.settings.sync.intervalMinutes;
|
|
1392
|
-
if (!minutes || minutes <= 0 || this.intervalTimer) return;
|
|
1393
|
-
const ms = minutes * 60 * 1e3;
|
|
1394
|
-
this.intervalTimer = setInterval(() => {
|
|
1395
|
-
runDetachedMemorySync(() => this.sync({ reason: "interval" }), "interval");
|
|
1396
|
-
}, ms);
|
|
1397
|
-
}
|
|
1398
|
-
scheduleWatchSync() {
|
|
1399
|
-
if (!this.sources.has("memory") || !this.settings.sync.watch) return;
|
|
1400
|
-
if (this.watchTimer) clearTimeout(this.watchTimer);
|
|
1401
|
-
this.watchTimer = setTimeout(() => {
|
|
1402
|
-
this.watchTimer = null;
|
|
1403
|
-
runDetachedMemorySync(() => this.sync({ reason: "watch" }), "watch");
|
|
1404
|
-
}, this.settings.sync.watchDebounceMs);
|
|
1405
|
-
}
|
|
1406
|
-
shouldSyncSessions(params, needsFullReindex = false) {
|
|
1407
|
-
return shouldSyncSessionsForReindex({
|
|
1408
|
-
hasSessionSource: this.sources.has("sessions"),
|
|
1409
|
-
sessionsDirty: this.sessionsDirty,
|
|
1410
|
-
dirtySessionFileCount: this.sessionsDirtyFiles.size,
|
|
1411
|
-
sync: params,
|
|
1412
|
-
needsFullReindex
|
|
1413
|
-
});
|
|
1414
|
-
}
|
|
1415
|
-
async syncMemoryFiles(params) {
|
|
1416
|
-
const deleteFileByPathAndSource = this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`);
|
|
1417
|
-
const deleteChunksByPathAndSource = this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`);
|
|
1418
|
-
const deleteVectorRowsByPathAndSource = this.vector.enabled && this.vector.available && this.hasVectorTable() ? this.db.prepare(`DELETE FROM ${VECTOR_TABLE$2} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`) : null;
|
|
1419
|
-
const deleteFtsRowsByPathAndSource = this.fts.enabled && this.fts.available ? this.db.prepare(`DELETE FROM ${FTS_TABLE$2} WHERE path = ? AND source = ?`) : null;
|
|
1420
|
-
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);
|
|
1421
|
-
log$3.debug("memory sync: indexing memory files", {
|
|
1422
|
-
files: fileEntries.length,
|
|
1423
|
-
needsFullReindex: params.needsFullReindex,
|
|
1424
|
-
batch: this.batch.enabled,
|
|
1425
|
-
concurrency: this.getIndexConcurrency()
|
|
1426
|
-
});
|
|
1427
|
-
const existingState = loadMemorySourceFileState({
|
|
1428
|
-
db: this.db,
|
|
1429
|
-
source: "memory"
|
|
1430
|
-
});
|
|
1431
|
-
const existingRows = existingState.rows;
|
|
1432
|
-
const existingHashes = existingState.hashes;
|
|
1433
|
-
const activePaths = new Set(fileEntries.map((entry) => entry.path));
|
|
1434
|
-
if (params.progress) {
|
|
1435
|
-
params.progress.total += fileEntries.length;
|
|
1436
|
-
params.progress.report({
|
|
1437
|
-
completed: params.progress.completed,
|
|
1438
|
-
total: params.progress.total,
|
|
1439
|
-
label: this.batch.enabled ? "Indexing memory files (batch)..." : "Indexing memory files…"
|
|
1440
|
-
});
|
|
1441
|
-
}
|
|
1442
|
-
await runWithConcurrency(fileEntries.map((entry) => async () => {
|
|
1443
|
-
if (!params.needsFullReindex && existingHashes.get(entry.path) === entry.hash) {
|
|
1444
|
-
if (params.progress) {
|
|
1445
|
-
params.progress.completed += 1;
|
|
1446
|
-
params.progress.report({
|
|
1447
|
-
completed: params.progress.completed,
|
|
1448
|
-
total: params.progress.total
|
|
1449
|
-
});
|
|
1450
|
-
}
|
|
1451
|
-
return;
|
|
1452
|
-
}
|
|
1453
|
-
await this.indexFile(entry, { source: "memory" });
|
|
1454
|
-
if (params.progress) {
|
|
1455
|
-
params.progress.completed += 1;
|
|
1456
|
-
params.progress.report({
|
|
1457
|
-
completed: params.progress.completed,
|
|
1458
|
-
total: params.progress.total
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
}), this.getIndexConcurrency());
|
|
1462
|
-
for (const stale of existingRows) {
|
|
1463
|
-
if (activePaths.has(stale.path)) continue;
|
|
1464
|
-
deleteFileByPathAndSource.run(stale.path, "memory");
|
|
1465
|
-
if (deleteVectorRowsByPathAndSource) try {
|
|
1466
|
-
deleteVectorRowsByPathAndSource.run(stale.path, "memory");
|
|
1467
|
-
} catch {}
|
|
1468
|
-
deleteChunksByPathAndSource.run(stale.path, "memory");
|
|
1469
|
-
if (deleteFtsRowsByPathAndSource) try {
|
|
1470
|
-
deleteFtsRowsByPathAndSource.run(stale.path, "memory");
|
|
1471
|
-
} catch {}
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
async syncSessionFiles(params) {
|
|
1475
|
-
const deleteFileByPathAndSource = this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`);
|
|
1476
|
-
const deleteChunksByPathAndSource = this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`);
|
|
1477
|
-
const deleteVectorRowsByPathAndSource = this.vector.enabled && this.vector.available && this.hasVectorTable() ? this.db.prepare(`DELETE FROM ${VECTOR_TABLE$2} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`) : null;
|
|
1478
|
-
const deleteFtsRowsByPathSourceAndModel = this.fts.enabled && this.fts.available ? this.db.prepare(`DELETE FROM ${FTS_TABLE$2} WHERE path = ? AND source = ? AND model = ?`) : null;
|
|
1479
|
-
const targetSessionFiles = params.needsFullReindex ? null : this.normalizeTargetSessionFiles(params.targetSessionFiles);
|
|
1480
|
-
const files = targetSessionFiles ? Array.from(targetSessionFiles) : await listSessionFilesForAgent(this.agentId);
|
|
1481
|
-
const { activePaths, existingRows, existingHashes, indexAll } = resolveMemorySessionSyncPlan({
|
|
1482
|
-
needsFullReindex: params.needsFullReindex,
|
|
1483
|
-
files,
|
|
1484
|
-
targetSessionFiles,
|
|
1485
|
-
sessionsDirtyFiles: this.sessionsDirtyFiles,
|
|
1486
|
-
existingRows: targetSessionFiles ? null : loadMemorySourceFileState({
|
|
1487
|
-
db: this.db,
|
|
1488
|
-
source: "sessions"
|
|
1489
|
-
}).rows,
|
|
1490
|
-
sessionPathForFile
|
|
1491
|
-
});
|
|
1492
|
-
log$3.debug("memory sync: indexing session files", {
|
|
1493
|
-
files: files.length,
|
|
1494
|
-
indexAll,
|
|
1495
|
-
dirtyFiles: this.sessionsDirtyFiles.size,
|
|
1496
|
-
targetedFiles: targetSessionFiles?.size ?? 0,
|
|
1497
|
-
batch: this.batch.enabled,
|
|
1498
|
-
concurrency: this.getIndexConcurrency()
|
|
1499
|
-
});
|
|
1500
|
-
if (params.progress) {
|
|
1501
|
-
params.progress.total += files.length;
|
|
1502
|
-
params.progress.report({
|
|
1503
|
-
completed: params.progress.completed,
|
|
1504
|
-
total: params.progress.total,
|
|
1505
|
-
label: this.batch.enabled ? "Indexing session files (batch)..." : "Indexing session files…"
|
|
1506
|
-
});
|
|
1507
|
-
}
|
|
1508
|
-
await runWithConcurrency(files.map((absPath) => async () => {
|
|
1509
|
-
if (!indexAll && !this.sessionsDirtyFiles.has(absPath)) {
|
|
1510
|
-
if (params.progress) {
|
|
1511
|
-
params.progress.completed += 1;
|
|
1512
|
-
params.progress.report({
|
|
1513
|
-
completed: params.progress.completed,
|
|
1514
|
-
total: params.progress.total
|
|
1515
|
-
});
|
|
1516
|
-
}
|
|
1517
|
-
return;
|
|
1518
|
-
}
|
|
1519
|
-
const entry = await buildSessionEntry(absPath);
|
|
1520
|
-
if (!entry) {
|
|
1521
|
-
if (params.progress) {
|
|
1522
|
-
params.progress.completed += 1;
|
|
1523
|
-
params.progress.report({
|
|
1524
|
-
completed: params.progress.completed,
|
|
1525
|
-
total: params.progress.total
|
|
1526
|
-
});
|
|
1527
|
-
}
|
|
1528
|
-
return;
|
|
1529
|
-
}
|
|
1530
|
-
const existingHash = resolveMemorySourceExistingHash({
|
|
1531
|
-
db: this.db,
|
|
1532
|
-
source: "sessions",
|
|
1533
|
-
path: entry.path,
|
|
1534
|
-
existingHashes
|
|
1535
|
-
});
|
|
1536
|
-
if (!params.needsFullReindex && existingHash === entry.hash) {
|
|
1537
|
-
if (params.progress) {
|
|
1538
|
-
params.progress.completed += 1;
|
|
1539
|
-
params.progress.report({
|
|
1540
|
-
completed: params.progress.completed,
|
|
1541
|
-
total: params.progress.total
|
|
1542
|
-
});
|
|
1543
|
-
}
|
|
1544
|
-
this.resetSessionDelta(absPath, entry.size);
|
|
1545
|
-
return;
|
|
1546
|
-
}
|
|
1547
|
-
await this.indexFile(entry, {
|
|
1548
|
-
source: "sessions",
|
|
1549
|
-
content: entry.content
|
|
1550
|
-
});
|
|
1551
|
-
this.resetSessionDelta(absPath, entry.size);
|
|
1552
|
-
if (params.progress) {
|
|
1553
|
-
params.progress.completed += 1;
|
|
1554
|
-
params.progress.report({
|
|
1555
|
-
completed: params.progress.completed,
|
|
1556
|
-
total: params.progress.total
|
|
1557
|
-
});
|
|
1558
|
-
}
|
|
1559
|
-
}), this.getIndexConcurrency());
|
|
1560
|
-
if (activePaths === null) return;
|
|
1561
|
-
for (const stale of existingRows ?? []) {
|
|
1562
|
-
if (activePaths.has(stale.path)) continue;
|
|
1563
|
-
deleteFileByPathAndSource.run(stale.path, "sessions");
|
|
1564
|
-
if (deleteVectorRowsByPathAndSource) try {
|
|
1565
|
-
deleteVectorRowsByPathAndSource.run(stale.path, "sessions");
|
|
1566
|
-
} catch {}
|
|
1567
|
-
deleteChunksByPathAndSource.run(stale.path, "sessions");
|
|
1568
|
-
if (deleteFtsRowsByPathSourceAndModel) try {
|
|
1569
|
-
deleteFtsRowsByPathSourceAndModel.run(stale.path, "sessions", this.provider?.model ?? "fts-only");
|
|
1570
|
-
} catch {}
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
createSyncProgress(onProgress) {
|
|
1574
|
-
const state = {
|
|
1575
|
-
completed: 0,
|
|
1576
|
-
total: 0,
|
|
1577
|
-
label: void 0,
|
|
1578
|
-
report: (update) => {
|
|
1579
|
-
if (update.label) state.label = update.label;
|
|
1580
|
-
const label = update.total > 0 && state.label ? `${state.label} ${update.completed}/${update.total}` : state.label;
|
|
1581
|
-
onProgress({
|
|
1582
|
-
completed: update.completed,
|
|
1583
|
-
total: update.total,
|
|
1584
|
-
label
|
|
1585
|
-
});
|
|
1586
|
-
}
|
|
1587
|
-
};
|
|
1588
|
-
return state;
|
|
1589
|
-
}
|
|
1590
|
-
async runSync(params) {
|
|
1591
|
-
const progress = params?.progress ? this.createSyncProgress(params.progress) : void 0;
|
|
1592
|
-
if (progress) progress.report({
|
|
1593
|
-
completed: progress.completed,
|
|
1594
|
-
total: progress.total,
|
|
1595
|
-
label: "Loading vector extension…"
|
|
1596
|
-
});
|
|
1597
|
-
const vectorReady = await this.ensureVectorReady();
|
|
1598
|
-
const meta = this.readMeta();
|
|
1599
|
-
const configuredSources = resolveConfiguredSourcesForMeta(this.sources);
|
|
1600
|
-
const configuredScopeHash = resolveConfiguredScopeHash({
|
|
1601
|
-
workspaceDir: this.workspaceDir,
|
|
1602
|
-
extraPaths: this.settings.extraPaths,
|
|
1603
|
-
multimodal: {
|
|
1604
|
-
enabled: this.settings.multimodal.enabled,
|
|
1605
|
-
modalities: this.settings.multimodal.modalities,
|
|
1606
|
-
maxFileBytes: this.settings.multimodal.maxFileBytes
|
|
1607
|
-
}
|
|
1608
|
-
});
|
|
1609
|
-
const targetSessionFiles = this.normalizeTargetSessionFiles(params?.sessionFiles);
|
|
1610
|
-
const hasTargetSessionFiles = targetSessionFiles !== null;
|
|
1611
|
-
const targetedSessionSync = await runMemoryTargetedSessionSync({
|
|
1612
|
-
hasSessionSource: this.sources.has("sessions"),
|
|
1613
|
-
targetSessionFiles,
|
|
1614
|
-
reason: params?.reason,
|
|
1615
|
-
progress: progress ?? void 0,
|
|
1616
|
-
useUnsafeReindex: process.env.OPENCLAW_TEST_FAST === "1" && process.env.OPENCLAW_TEST_MEMORY_UNSAFE_REINDEX === "1",
|
|
1617
|
-
sessionsDirtyFiles: this.sessionsDirtyFiles,
|
|
1618
|
-
syncSessionFiles: async (targetedParams) => {
|
|
1619
|
-
await this.syncSessionFiles(targetedParams);
|
|
1620
|
-
},
|
|
1621
|
-
shouldFallbackOnError: (message) => this.shouldFallbackOnError(message),
|
|
1622
|
-
activateFallbackProvider: async (reason) => await this.activateFallbackProvider(reason),
|
|
1623
|
-
runSafeReindex: async (reindexParams) => {
|
|
1624
|
-
await this.runSafeReindex(reindexParams);
|
|
1625
|
-
},
|
|
1626
|
-
runUnsafeReindex: async (reindexParams) => {
|
|
1627
|
-
await this.runUnsafeReindex(reindexParams);
|
|
1628
|
-
}
|
|
1629
|
-
});
|
|
1630
|
-
if (targetedSessionSync.handled) {
|
|
1631
|
-
this.sessionsDirty = targetedSessionSync.sessionsDirty;
|
|
1632
|
-
return;
|
|
1633
|
-
}
|
|
1634
|
-
const needsFullReindex = params?.force && !hasTargetSessionFiles || shouldRunFullMemoryReindex({
|
|
1635
|
-
meta,
|
|
1636
|
-
provider: this.provider ? {
|
|
1637
|
-
id: this.provider.id,
|
|
1638
|
-
model: this.provider.model
|
|
1639
|
-
} : null,
|
|
1640
|
-
providerKey: this.providerKey ?? void 0,
|
|
1641
|
-
configuredSources,
|
|
1642
|
-
configuredScopeHash,
|
|
1643
|
-
chunkTokens: this.settings.chunking.tokens,
|
|
1644
|
-
chunkOverlap: this.settings.chunking.overlap,
|
|
1645
|
-
vectorReady,
|
|
1646
|
-
ftsTokenizer: this.settings.store.fts.tokenizer
|
|
1647
|
-
});
|
|
1648
|
-
try {
|
|
1649
|
-
if (needsFullReindex) {
|
|
1650
|
-
if (process.env.OPENCLAW_TEST_FAST === "1" && process.env.OPENCLAW_TEST_MEMORY_UNSAFE_REINDEX === "1") await this.runUnsafeReindex({
|
|
1651
|
-
reason: params?.reason,
|
|
1652
|
-
force: params?.force,
|
|
1653
|
-
progress: progress ?? void 0
|
|
1654
|
-
});
|
|
1655
|
-
else await this.runSafeReindex({
|
|
1656
|
-
reason: params?.reason,
|
|
1657
|
-
force: params?.force,
|
|
1658
|
-
progress: progress ?? void 0
|
|
1659
|
-
});
|
|
1660
|
-
return;
|
|
1661
|
-
}
|
|
1662
|
-
const shouldSyncMemory = this.sources.has("memory") && (!hasTargetSessionFiles && params?.force || needsFullReindex || this.dirty);
|
|
1663
|
-
const shouldSyncSessions = this.shouldSyncSessions(params, needsFullReindex);
|
|
1664
|
-
if (shouldSyncMemory) {
|
|
1665
|
-
await this.syncMemoryFiles({
|
|
1666
|
-
needsFullReindex,
|
|
1667
|
-
progress: progress ?? void 0
|
|
1668
|
-
});
|
|
1669
|
-
this.dirty = false;
|
|
1670
|
-
}
|
|
1671
|
-
if (shouldSyncSessions) {
|
|
1672
|
-
await this.syncSessionFiles({
|
|
1673
|
-
needsFullReindex,
|
|
1674
|
-
targetSessionFiles: targetSessionFiles ? Array.from(targetSessionFiles) : void 0,
|
|
1675
|
-
progress: progress ?? void 0
|
|
1676
|
-
});
|
|
1677
|
-
this.sessionsDirty = false;
|
|
1678
|
-
this.sessionsDirtyFiles.clear();
|
|
1679
|
-
} else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
|
|
1680
|
-
else this.sessionsDirty = false;
|
|
1681
|
-
} catch (err) {
|
|
1682
|
-
const reason = formatErrorMessage(err);
|
|
1683
|
-
if (this.shouldFallbackOnError(reason) && await this.activateFallbackProvider(reason)) {
|
|
1684
|
-
await this.runSafeReindex({
|
|
1685
|
-
reason: params?.reason ?? "fallback",
|
|
1686
|
-
force: true,
|
|
1687
|
-
progress: progress ?? void 0
|
|
1688
|
-
});
|
|
1689
|
-
return;
|
|
1690
|
-
}
|
|
1691
|
-
throw err;
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
shouldFallbackOnError(message) {
|
|
1695
|
-
return /embedding|embeddings|batch/i.test(message);
|
|
1696
|
-
}
|
|
1697
|
-
resolveBatchConfig() {
|
|
1698
|
-
const batch = this.settings.remote?.batch;
|
|
1699
|
-
return {
|
|
1700
|
-
enabled: Boolean(batch?.enabled && this.provider && this.providerRuntime?.batchEmbed),
|
|
1701
|
-
wait: batch?.wait ?? true,
|
|
1702
|
-
concurrency: Math.max(1, batch?.concurrency ?? 2),
|
|
1703
|
-
pollIntervalMs: batch?.pollIntervalMs ?? 2e3,
|
|
1704
|
-
timeoutMs: (batch?.timeoutMinutes ?? 60) * 60 * 1e3
|
|
1705
|
-
};
|
|
1706
|
-
}
|
|
1707
|
-
async activateFallbackProvider(reason) {
|
|
1708
|
-
const fallbackRequest = resolveMemoryFallbackProviderRequest({
|
|
1709
|
-
cfg: this.cfg,
|
|
1710
|
-
settings: this.settings,
|
|
1711
|
-
currentProviderId: this.provider?.id ?? null
|
|
1712
|
-
});
|
|
1713
|
-
if (!fallbackRequest || !this.provider) return false;
|
|
1714
|
-
if (this.fallbackFrom) return false;
|
|
1715
|
-
const fallbackFrom = this.provider.id;
|
|
1716
|
-
const fallbackResult = await createEmbeddingProvider({
|
|
1717
|
-
config: this.cfg,
|
|
1718
|
-
agentDir: resolveAgentDir(this.cfg, this.agentId),
|
|
1719
|
-
...fallbackRequest
|
|
1720
|
-
});
|
|
1721
|
-
const fallbackState = applyMemoryFallbackProviderState({
|
|
1722
|
-
current: {
|
|
1723
|
-
provider: this.provider,
|
|
1724
|
-
fallbackFrom: this.fallbackFrom,
|
|
1725
|
-
fallbackReason: this.fallbackReason,
|
|
1726
|
-
providerUnavailableReason: void 0,
|
|
1727
|
-
providerRuntime: this.providerRuntime
|
|
1728
|
-
},
|
|
1729
|
-
fallbackFrom,
|
|
1730
|
-
reason,
|
|
1731
|
-
result: fallbackResult
|
|
1732
|
-
});
|
|
1733
|
-
this.fallbackFrom = fallbackState.fallbackFrom;
|
|
1734
|
-
this.fallbackReason = fallbackState.fallbackReason;
|
|
1735
|
-
this.provider = fallbackState.provider;
|
|
1736
|
-
this.providerRuntime = fallbackState.providerRuntime;
|
|
1737
|
-
this.providerKey = this.computeProviderKey();
|
|
1738
|
-
this.batch = this.resolveBatchConfig();
|
|
1739
|
-
log$3.warn(`memory embeddings: switched to fallback provider (${fallbackRequest.provider})`, { reason });
|
|
1740
|
-
return true;
|
|
1741
|
-
}
|
|
1742
|
-
async runSafeReindex(params) {
|
|
1743
|
-
const dbPath = resolveUserPath(this.settings.store.path);
|
|
1744
|
-
const tempDbPath = `${dbPath}.tmp-${randomUUID()}`;
|
|
1745
|
-
const tempDb = openMemoryDatabaseAtPath(tempDbPath, this.settings.store.vector.enabled);
|
|
1746
|
-
const originalDb = this.db;
|
|
1747
|
-
let originalDbClosed = false;
|
|
1748
|
-
const originalState = {
|
|
1749
|
-
ftsAvailable: this.fts.available,
|
|
1750
|
-
ftsError: this.fts.loadError,
|
|
1751
|
-
vectorAvailable: this.vector.available,
|
|
1752
|
-
vectorLoadError: this.vector.loadError,
|
|
1753
|
-
vectorDims: this.vector.dims,
|
|
1754
|
-
vectorReady: this.vectorReady
|
|
1755
|
-
};
|
|
1756
|
-
const restoreOriginalState = () => {
|
|
1757
|
-
if (originalDbClosed) this.db = openMemoryDatabaseAtPath(dbPath, this.settings.store.vector.enabled);
|
|
1758
|
-
else this.db = originalDb;
|
|
1759
|
-
this.fts.available = originalState.ftsAvailable;
|
|
1760
|
-
this.fts.loadError = originalState.ftsError;
|
|
1761
|
-
this.vector.available = originalDbClosed ? null : originalState.vectorAvailable;
|
|
1762
|
-
this.vector.loadError = originalState.vectorLoadError;
|
|
1763
|
-
this.vector.dims = originalState.vectorDims;
|
|
1764
|
-
this.vectorReady = originalDbClosed ? null : originalState.vectorReady;
|
|
1765
|
-
};
|
|
1766
|
-
this.db = tempDb;
|
|
1767
|
-
this.lastMetaSerialized = null;
|
|
1768
|
-
this.vectorReady = null;
|
|
1769
|
-
this.vector.available = null;
|
|
1770
|
-
this.vector.loadError = void 0;
|
|
1771
|
-
this.vector.dims = void 0;
|
|
1772
|
-
this.fts.available = false;
|
|
1773
|
-
this.fts.loadError = void 0;
|
|
1774
|
-
this.ensureSchema();
|
|
1775
|
-
let nextMeta = null;
|
|
1776
|
-
try {
|
|
1777
|
-
nextMeta = await runMemoryAtomicReindex({
|
|
1778
|
-
targetPath: dbPath,
|
|
1779
|
-
tempPath: tempDbPath,
|
|
1780
|
-
build: async () => {
|
|
1781
|
-
this.seedEmbeddingCache(originalDb);
|
|
1782
|
-
const shouldSyncMemory = this.sources.has("memory");
|
|
1783
|
-
const shouldSyncSessions = this.shouldSyncSessions({
|
|
1784
|
-
reason: params.reason,
|
|
1785
|
-
force: params.force
|
|
1786
|
-
}, true);
|
|
1787
|
-
if (shouldSyncMemory) {
|
|
1788
|
-
await this.syncMemoryFiles({
|
|
1789
|
-
needsFullReindex: true,
|
|
1790
|
-
progress: params.progress
|
|
1791
|
-
});
|
|
1792
|
-
this.dirty = false;
|
|
1793
|
-
}
|
|
1794
|
-
if (shouldSyncSessions) {
|
|
1795
|
-
await this.syncSessionFiles({
|
|
1796
|
-
needsFullReindex: true,
|
|
1797
|
-
progress: params.progress
|
|
1798
|
-
});
|
|
1799
|
-
this.sessionsDirty = false;
|
|
1800
|
-
this.sessionsDirtyFiles.clear();
|
|
1801
|
-
} else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
|
|
1802
|
-
else this.sessionsDirty = false;
|
|
1803
|
-
const meta = {
|
|
1804
|
-
model: this.provider?.model ?? "fts-only",
|
|
1805
|
-
provider: this.provider?.id ?? "none",
|
|
1806
|
-
providerKey: this.providerKey,
|
|
1807
|
-
sources: resolveConfiguredSourcesForMeta(this.sources),
|
|
1808
|
-
scopeHash: resolveConfiguredScopeHash({
|
|
1809
|
-
workspaceDir: this.workspaceDir,
|
|
1810
|
-
extraPaths: this.settings.extraPaths,
|
|
1811
|
-
multimodal: {
|
|
1812
|
-
enabled: this.settings.multimodal.enabled,
|
|
1813
|
-
modalities: this.settings.multimodal.modalities,
|
|
1814
|
-
maxFileBytes: this.settings.multimodal.maxFileBytes
|
|
1815
|
-
}
|
|
1816
|
-
}),
|
|
1817
|
-
chunkTokens: this.settings.chunking.tokens,
|
|
1818
|
-
chunkOverlap: this.settings.chunking.overlap,
|
|
1819
|
-
ftsTokenizer: this.settings.store.fts.tokenizer
|
|
1820
|
-
};
|
|
1821
|
-
if (this.vector.available && this.vector.dims) meta.vectorDims = this.vector.dims;
|
|
1822
|
-
this.writeMeta(meta);
|
|
1823
|
-
this.pruneEmbeddingCacheIfNeeded?.();
|
|
1824
|
-
this.db.close();
|
|
1825
|
-
originalDb.close();
|
|
1826
|
-
originalDbClosed = true;
|
|
1827
|
-
return meta;
|
|
1828
|
-
}
|
|
1829
|
-
});
|
|
1830
|
-
this.db = openMemoryDatabaseAtPath(dbPath, this.settings.store.vector.enabled);
|
|
1831
|
-
this.lastMetaSerialized = null;
|
|
1832
|
-
this.vectorReady = null;
|
|
1833
|
-
this.vector.available = null;
|
|
1834
|
-
this.vector.loadError = void 0;
|
|
1835
|
-
this.ensureSchema();
|
|
1836
|
-
this.vector.dims = nextMeta?.vectorDims;
|
|
1837
|
-
} catch (err) {
|
|
1838
|
-
try {
|
|
1839
|
-
this.db.close();
|
|
1840
|
-
} catch {}
|
|
1841
|
-
restoreOriginalState();
|
|
1842
|
-
throw err;
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
async runUnsafeReindex(params) {
|
|
1846
|
-
this.resetIndex();
|
|
1847
|
-
const shouldSyncMemory = this.sources.has("memory");
|
|
1848
|
-
const shouldSyncSessions = this.shouldSyncSessions({
|
|
1849
|
-
reason: params.reason,
|
|
1850
|
-
force: params.force
|
|
1851
|
-
}, true);
|
|
1852
|
-
if (shouldSyncMemory) {
|
|
1853
|
-
await this.syncMemoryFiles({
|
|
1854
|
-
needsFullReindex: true,
|
|
1855
|
-
progress: params.progress
|
|
1856
|
-
});
|
|
1857
|
-
this.dirty = false;
|
|
1858
|
-
}
|
|
1859
|
-
if (shouldSyncSessions) {
|
|
1860
|
-
await this.syncSessionFiles({
|
|
1861
|
-
needsFullReindex: true,
|
|
1862
|
-
progress: params.progress
|
|
1863
|
-
});
|
|
1864
|
-
this.sessionsDirty = false;
|
|
1865
|
-
this.sessionsDirtyFiles.clear();
|
|
1866
|
-
} else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
|
|
1867
|
-
else this.sessionsDirty = false;
|
|
1868
|
-
const nextMeta = {
|
|
1869
|
-
model: this.provider?.model ?? "fts-only",
|
|
1870
|
-
provider: this.provider?.id ?? "none",
|
|
1871
|
-
providerKey: this.providerKey,
|
|
1872
|
-
sources: resolveConfiguredSourcesForMeta(this.sources),
|
|
1873
|
-
scopeHash: resolveConfiguredScopeHash({
|
|
1874
|
-
workspaceDir: this.workspaceDir,
|
|
1875
|
-
extraPaths: this.settings.extraPaths,
|
|
1876
|
-
multimodal: {
|
|
1877
|
-
enabled: this.settings.multimodal.enabled,
|
|
1878
|
-
modalities: this.settings.multimodal.modalities,
|
|
1879
|
-
maxFileBytes: this.settings.multimodal.maxFileBytes
|
|
1880
|
-
}
|
|
1881
|
-
}),
|
|
1882
|
-
chunkTokens: this.settings.chunking.tokens,
|
|
1883
|
-
chunkOverlap: this.settings.chunking.overlap,
|
|
1884
|
-
ftsTokenizer: this.settings.store.fts.tokenizer
|
|
1885
|
-
};
|
|
1886
|
-
if (this.vector.available && this.vector.dims) nextMeta.vectorDims = this.vector.dims;
|
|
1887
|
-
this.writeMeta(nextMeta);
|
|
1888
|
-
this.pruneEmbeddingCacheIfNeeded?.();
|
|
1889
|
-
}
|
|
1890
|
-
resetIndex() {
|
|
1891
|
-
this.db.exec(`DELETE FROM files`);
|
|
1892
|
-
this.db.exec(`DELETE FROM chunks`);
|
|
1893
|
-
if (this.fts.enabled && this.fts.available) try {
|
|
1894
|
-
this.db.exec(`DROP TABLE IF EXISTS ${FTS_TABLE$2}`);
|
|
1895
|
-
} catch {}
|
|
1896
|
-
this.ensureSchema();
|
|
1897
|
-
this.dropVectorTable();
|
|
1898
|
-
this.vector.dims = void 0;
|
|
1899
|
-
this.sessionsDirtyFiles.clear();
|
|
1900
|
-
}
|
|
1901
|
-
readMeta() {
|
|
1902
|
-
const row = this.db.prepare(`SELECT value FROM meta WHERE key = ?`).get(META_KEY);
|
|
1903
|
-
if (!row?.value) {
|
|
1904
|
-
this.lastMetaSerialized = null;
|
|
1905
|
-
return null;
|
|
1906
|
-
}
|
|
1907
|
-
try {
|
|
1908
|
-
const parsed = JSON.parse(row.value);
|
|
1909
|
-
this.lastMetaSerialized = row.value;
|
|
1910
|
-
return parsed;
|
|
1911
|
-
} catch {
|
|
1912
|
-
this.lastMetaSerialized = null;
|
|
1913
|
-
return null;
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
writeMeta(meta) {
|
|
1917
|
-
const value = JSON.stringify(meta);
|
|
1918
|
-
if (this.lastMetaSerialized === value) return;
|
|
1919
|
-
this.db.prepare(`INSERT INTO meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value`).run(META_KEY, value);
|
|
1920
|
-
this.lastMetaSerialized = value;
|
|
1921
|
-
}
|
|
1922
|
-
};
|
|
1923
|
-
//#endregion
|
|
1924
|
-
//#region extensions/memory-core/src/memory/manager-vector-write.ts
|
|
1925
|
-
const vectorToBlob$1 = (embedding) => Buffer.from(new Float32Array(embedding).buffer);
|
|
1926
|
-
function replaceMemoryVectorRow(params) {
|
|
1927
|
-
const tableName = params.tableName ?? "chunks_vec";
|
|
1928
|
-
try {
|
|
1929
|
-
params.db.prepare(`DELETE FROM ${tableName} WHERE id = ?`).run(params.id);
|
|
1930
|
-
} catch {}
|
|
1931
|
-
params.db.prepare(`INSERT INTO ${tableName} (id, embedding) VALUES (?, ?)`).run(params.id, vectorToBlob$1(params.embedding));
|
|
1932
|
-
}
|
|
1933
|
-
//#endregion
|
|
1934
|
-
//#region extensions/memory-core/src/memory/manager-embedding-ops.ts
|
|
1935
|
-
const VECTOR_TABLE$1 = "chunks_vec";
|
|
1936
|
-
const FTS_TABLE$1 = "chunks_fts";
|
|
1937
|
-
const EMBEDDING_CACHE_TABLE$1 = "embedding_cache";
|
|
1938
|
-
const EMBEDDING_BATCH_MAX_TOKENS = 8e3;
|
|
1939
|
-
const EMBEDDING_INDEX_CONCURRENCY = 4;
|
|
1940
|
-
const EMBEDDING_RETRY_MAX_ATTEMPTS = 3;
|
|
1941
|
-
const EMBEDDING_RETRY_BASE_DELAY_MS = 500;
|
|
1942
|
-
const EMBEDDING_RETRY_MAX_DELAY_MS = 8e3;
|
|
1943
|
-
const EMBEDDING_QUERY_TIMEOUT_REMOTE_MS = 6e4;
|
|
1944
|
-
const EMBEDDING_QUERY_TIMEOUT_LOCAL_MS = 5 * 6e4;
|
|
1945
|
-
const EMBEDDING_BATCH_TIMEOUT_REMOTE_MS = 2 * 6e4;
|
|
1946
|
-
const EMBEDDING_BATCH_TIMEOUT_LOCAL_MS = 10 * 6e4;
|
|
1947
|
-
const log$2 = createSubsystemLogger("memory");
|
|
1948
|
-
var MemoryManagerEmbeddingOps = class extends MemoryManagerSyncOps {
|
|
1949
|
-
pruneEmbeddingCacheIfNeeded() {
|
|
1950
|
-
if (!this.cache.enabled) return;
|
|
1951
|
-
const max = this.cache.maxEntries;
|
|
1952
|
-
if (!max || max <= 0) return;
|
|
1953
|
-
const count = this.db.prepare(`SELECT COUNT(*) as c FROM ${EMBEDDING_CACHE_TABLE$1}`).get()?.c ?? 0;
|
|
1954
|
-
if (count <= max) return;
|
|
1955
|
-
const excess = count - max;
|
|
1956
|
-
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);
|
|
1957
|
-
}
|
|
1958
|
-
async embedChunksInBatches(chunks) {
|
|
1959
|
-
if (chunks.length === 0) return [];
|
|
1960
|
-
const { embeddings, missing } = this.collectCachedEmbeddings(chunks);
|
|
1961
|
-
if (missing.length === 0) return embeddings;
|
|
1962
|
-
const batches = buildMemoryEmbeddingBatches(missing.map((m) => m.chunk), EMBEDDING_BATCH_MAX_TOKENS);
|
|
1963
|
-
const toCache = [];
|
|
1964
|
-
const provider = this.provider;
|
|
1965
|
-
if (!provider) throw new Error("Cannot embed batch in FTS-only mode (no embedding provider)");
|
|
1966
|
-
let cursor = 0;
|
|
1967
|
-
for (const batch of batches) {
|
|
1968
|
-
const inputs = buildTextEmbeddingInputs(batch);
|
|
1969
|
-
const hasStructuredInputs = inputs.some((input) => hasNonTextEmbeddingParts(input));
|
|
1970
|
-
if (hasStructuredInputs && !provider.embedBatchInputs) throw new Error(`Embedding provider "${provider.id}" does not support multimodal memory inputs.`);
|
|
1971
|
-
const batchEmbeddings = hasStructuredInputs ? await this.embedBatchInputsWithRetry(inputs) : await this.embedBatchWithRetry(batch.map((chunk) => chunk.text));
|
|
1972
|
-
for (let i = 0; i < batch.length; i += 1) {
|
|
1973
|
-
const item = missing[cursor + i];
|
|
1974
|
-
const embedding = batchEmbeddings[i] ?? [];
|
|
1975
|
-
if (item) {
|
|
1976
|
-
embeddings[item.index] = embedding;
|
|
1977
|
-
toCache.push({
|
|
1978
|
-
hash: item.chunk.hash,
|
|
1979
|
-
embedding
|
|
1980
|
-
});
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
cursor += batch.length;
|
|
1984
|
-
}
|
|
1985
|
-
upsertMemoryEmbeddingCache({
|
|
1986
|
-
db: this.db,
|
|
1987
|
-
enabled: this.cache.enabled,
|
|
1988
|
-
provider: this.provider,
|
|
1989
|
-
providerKey: this.providerKey,
|
|
1990
|
-
entries: toCache,
|
|
1991
|
-
tableName: EMBEDDING_CACHE_TABLE$1
|
|
1992
|
-
});
|
|
1993
|
-
return embeddings;
|
|
1994
|
-
}
|
|
1995
|
-
computeProviderKey() {
|
|
1996
|
-
if (!this.provider) return hashText(JSON.stringify({
|
|
1997
|
-
provider: "none",
|
|
1998
|
-
model: "fts-only"
|
|
1999
|
-
}));
|
|
2000
|
-
if (this.providerRuntime?.cacheKeyData) return hashText(JSON.stringify(this.providerRuntime.cacheKeyData));
|
|
2001
|
-
return hashText(JSON.stringify({
|
|
2002
|
-
provider: this.provider.id,
|
|
2003
|
-
model: this.provider.model
|
|
2004
|
-
}));
|
|
2005
|
-
}
|
|
2006
|
-
buildBatchDebug(source, chunks) {
|
|
2007
|
-
return (message, data) => log$2.debug(message, data ? {
|
|
2008
|
-
...data,
|
|
2009
|
-
source,
|
|
2010
|
-
chunks: chunks.length
|
|
2011
|
-
} : {
|
|
2012
|
-
source,
|
|
2013
|
-
chunks: chunks.length
|
|
2014
|
-
});
|
|
2015
|
-
}
|
|
2016
|
-
async embedChunksWithBatch(chunks, _entry, source) {
|
|
2017
|
-
const provider = this.provider;
|
|
2018
|
-
const batchEmbed = this.providerRuntime?.batchEmbed;
|
|
2019
|
-
if (!provider || !batchEmbed) return this.embedChunksInBatches(chunks);
|
|
2020
|
-
if (chunks.length === 0) return [];
|
|
2021
|
-
const { embeddings, missing } = this.collectCachedEmbeddings(chunks);
|
|
2022
|
-
if (missing.length === 0) return embeddings;
|
|
2023
|
-
const missingChunks = missing.map((item) => item.chunk);
|
|
2024
|
-
const batchResult = await this.runBatchWithFallback({
|
|
2025
|
-
provider: provider.id,
|
|
2026
|
-
run: async () => await batchEmbed({
|
|
2027
|
-
agentId: this.agentId,
|
|
2028
|
-
chunks: missingChunks,
|
|
2029
|
-
wait: this.batch.wait,
|
|
2030
|
-
concurrency: this.batch.concurrency,
|
|
2031
|
-
pollIntervalMs: this.batch.pollIntervalMs,
|
|
2032
|
-
timeoutMs: this.batch.timeoutMs,
|
|
2033
|
-
debug: this.buildBatchDebug(source, chunks)
|
|
2034
|
-
}),
|
|
2035
|
-
fallback: async () => await this.embedChunksInBatches(chunks)
|
|
2036
|
-
});
|
|
2037
|
-
if (!batchResult) return this.embedChunksInBatches(chunks);
|
|
2038
|
-
const toCache = [];
|
|
2039
|
-
for (let index = 0; index < missing.length; index += 1) {
|
|
2040
|
-
const item = missing[index];
|
|
2041
|
-
const embedding = batchResult[index] ?? [];
|
|
2042
|
-
if (!item) continue;
|
|
2043
|
-
embeddings[item.index] = embedding;
|
|
2044
|
-
toCache.push({
|
|
2045
|
-
hash: item.chunk.hash,
|
|
2046
|
-
embedding
|
|
2047
|
-
});
|
|
2048
|
-
}
|
|
2049
|
-
upsertMemoryEmbeddingCache({
|
|
2050
|
-
db: this.db,
|
|
2051
|
-
enabled: this.cache.enabled,
|
|
2052
|
-
provider,
|
|
2053
|
-
providerKey: this.providerKey,
|
|
2054
|
-
entries: toCache,
|
|
2055
|
-
tableName: EMBEDDING_CACHE_TABLE$1
|
|
2056
|
-
});
|
|
2057
|
-
return embeddings;
|
|
2058
|
-
}
|
|
2059
|
-
collectCachedEmbeddings(chunks) {
|
|
2060
|
-
return collectMemoryCachedEmbeddings({
|
|
2061
|
-
chunks,
|
|
2062
|
-
cached: loadMemoryEmbeddingCache({
|
|
2063
|
-
db: this.db,
|
|
2064
|
-
enabled: this.cache.enabled,
|
|
2065
|
-
provider: this.provider,
|
|
2066
|
-
providerKey: this.providerKey,
|
|
2067
|
-
hashes: chunks.map((chunk) => chunk.hash),
|
|
2068
|
-
tableName: EMBEDDING_CACHE_TABLE$1
|
|
2069
|
-
})
|
|
2070
|
-
});
|
|
2071
|
-
}
|
|
2072
|
-
async embedBatchWithRetry(texts) {
|
|
2073
|
-
if (texts.length === 0) return [];
|
|
2074
|
-
const provider = this.provider;
|
|
2075
|
-
if (!provider) throw new Error("Cannot embed batch in FTS-only mode (no embedding provider)");
|
|
2076
|
-
return await runMemoryEmbeddingRetryLoop({
|
|
2077
|
-
run: async () => {
|
|
2078
|
-
const timeoutMs = this.resolveEmbeddingTimeout("batch");
|
|
2079
|
-
log$2.debug("memory embeddings: batch start", {
|
|
2080
|
-
provider: provider.id,
|
|
2081
|
-
items: texts.length,
|
|
2082
|
-
timeoutMs
|
|
2083
|
-
});
|
|
2084
|
-
return await this.withTimeout(provider.embedBatch(texts), timeoutMs, `memory embeddings batch timed out after ${Math.round(timeoutMs / 1e3)}s`);
|
|
2085
|
-
},
|
|
2086
|
-
isRetryable: isRetryableMemoryEmbeddingError,
|
|
2087
|
-
waitForRetry: async (delayMs) => {
|
|
2088
|
-
await this.waitForEmbeddingRetry(delayMs, "retrying");
|
|
2089
|
-
},
|
|
2090
|
-
maxAttempts: EMBEDDING_RETRY_MAX_ATTEMPTS,
|
|
2091
|
-
baseDelayMs: EMBEDDING_RETRY_BASE_DELAY_MS
|
|
2092
|
-
});
|
|
2093
|
-
}
|
|
2094
|
-
async embedBatchInputsWithRetry(inputs) {
|
|
2095
|
-
if (inputs.length === 0) return [];
|
|
2096
|
-
const provider = this.provider;
|
|
2097
|
-
const embedBatchInputs = provider?.embedBatchInputs;
|
|
2098
|
-
if (!embedBatchInputs) return await this.embedBatchWithRetry(inputs.map((input) => input.text));
|
|
2099
|
-
return await runMemoryEmbeddingRetryLoop({
|
|
2100
|
-
run: async () => {
|
|
2101
|
-
const timeoutMs = this.resolveEmbeddingTimeout("batch");
|
|
2102
|
-
log$2.debug("memory embeddings: structured batch start", {
|
|
2103
|
-
provider: provider.id,
|
|
2104
|
-
items: inputs.length,
|
|
2105
|
-
timeoutMs
|
|
2106
|
-
});
|
|
2107
|
-
return await this.withTimeout(embedBatchInputs(inputs), timeoutMs, `memory embeddings batch timed out after ${Math.round(timeoutMs / 1e3)}s`);
|
|
2108
|
-
},
|
|
2109
|
-
isRetryable: isRetryableMemoryEmbeddingError,
|
|
2110
|
-
waitForRetry: async (delayMs) => {
|
|
2111
|
-
await this.waitForEmbeddingRetry(delayMs, "retrying structured batch");
|
|
2112
|
-
},
|
|
2113
|
-
maxAttempts: EMBEDDING_RETRY_MAX_ATTEMPTS,
|
|
2114
|
-
baseDelayMs: EMBEDDING_RETRY_BASE_DELAY_MS
|
|
2115
|
-
});
|
|
2116
|
-
}
|
|
2117
|
-
async waitForEmbeddingRetry(delayMs, action) {
|
|
2118
|
-
const waitMs = resolveMemoryEmbeddingRetryDelay(delayMs, Math.random(), EMBEDDING_RETRY_MAX_DELAY_MS);
|
|
2119
|
-
log$2.warn(`memory embeddings rate limited; ${action} in ${waitMs}ms`);
|
|
2120
|
-
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
|
2121
|
-
}
|
|
2122
|
-
resolveEmbeddingTimeout(kind) {
|
|
2123
|
-
const isLocal = this.provider?.id === "local";
|
|
2124
|
-
if (kind === "query") return isLocal ? EMBEDDING_QUERY_TIMEOUT_LOCAL_MS : EMBEDDING_QUERY_TIMEOUT_REMOTE_MS;
|
|
2125
|
-
return isLocal ? EMBEDDING_BATCH_TIMEOUT_LOCAL_MS : EMBEDDING_BATCH_TIMEOUT_REMOTE_MS;
|
|
2126
|
-
}
|
|
2127
|
-
async embedQueryWithTimeout(text) {
|
|
2128
|
-
if (!this.provider) throw new Error("Cannot embed query in FTS-only mode (no embedding provider)");
|
|
2129
|
-
const timeoutMs = this.resolveEmbeddingTimeout("query");
|
|
2130
|
-
log$2.debug("memory embeddings: query start", {
|
|
2131
|
-
provider: this.provider.id,
|
|
2132
|
-
timeoutMs
|
|
2133
|
-
});
|
|
2134
|
-
return await this.withTimeout(this.provider.embedQuery(text), timeoutMs, `memory embeddings query timed out after ${Math.round(timeoutMs / 1e3)}s`);
|
|
2135
|
-
}
|
|
2136
|
-
async withTimeout(promise, timeoutMs, message) {
|
|
2137
|
-
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) return await promise;
|
|
2138
|
-
let timer = null;
|
|
2139
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
2140
|
-
timer = setTimeout(() => reject(new Error(message)), timeoutMs);
|
|
2141
|
-
});
|
|
2142
|
-
try {
|
|
2143
|
-
return await Promise.race([promise, timeoutPromise]);
|
|
2144
|
-
} finally {
|
|
2145
|
-
if (timer) clearTimeout(timer);
|
|
2146
|
-
}
|
|
2147
|
-
}
|
|
2148
|
-
async withBatchFailureLock(fn) {
|
|
2149
|
-
let release;
|
|
2150
|
-
const wait = this.batchFailureLock;
|
|
2151
|
-
this.batchFailureLock = new Promise((resolve) => {
|
|
2152
|
-
release = resolve;
|
|
2153
|
-
});
|
|
2154
|
-
await wait;
|
|
2155
|
-
try {
|
|
2156
|
-
return await fn();
|
|
2157
|
-
} finally {
|
|
2158
|
-
release();
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
async resetBatchFailureCount() {
|
|
2162
|
-
await this.withBatchFailureLock(async () => {
|
|
2163
|
-
if (this.batchFailureCount > 0) log$2.debug("memory embeddings: batch recovered; resetting failure count");
|
|
2164
|
-
const nextState = resetMemoryBatchFailureState({
|
|
2165
|
-
enabled: this.batch.enabled,
|
|
2166
|
-
count: this.batchFailureCount,
|
|
2167
|
-
lastError: this.batchFailureLastError,
|
|
2168
|
-
lastProvider: this.batchFailureLastProvider
|
|
2169
|
-
});
|
|
2170
|
-
this.batch.enabled = nextState.enabled;
|
|
2171
|
-
this.batchFailureCount = nextState.count;
|
|
2172
|
-
this.batchFailureLastError = nextState.lastError;
|
|
2173
|
-
this.batchFailureLastProvider = nextState.lastProvider;
|
|
2174
|
-
});
|
|
2175
|
-
}
|
|
2176
|
-
async recordBatchFailure(params) {
|
|
2177
|
-
return await this.withBatchFailureLock(async () => {
|
|
2178
|
-
if (!this.batch.enabled) return {
|
|
2179
|
-
disabled: true,
|
|
2180
|
-
count: this.batchFailureCount
|
|
2181
|
-
};
|
|
2182
|
-
const nextState = recordMemoryBatchFailure({
|
|
2183
|
-
enabled: this.batch.enabled,
|
|
2184
|
-
count: this.batchFailureCount,
|
|
2185
|
-
lastError: this.batchFailureLastError,
|
|
2186
|
-
lastProvider: this.batchFailureLastProvider
|
|
2187
|
-
}, params);
|
|
2188
|
-
this.batch.enabled = nextState.enabled;
|
|
2189
|
-
this.batchFailureCount = nextState.count;
|
|
2190
|
-
this.batchFailureLastError = nextState.lastError;
|
|
2191
|
-
this.batchFailureLastProvider = nextState.lastProvider;
|
|
2192
|
-
return {
|
|
2193
|
-
disabled: !nextState.enabled,
|
|
2194
|
-
count: nextState.count
|
|
2195
|
-
};
|
|
2196
|
-
});
|
|
2197
|
-
}
|
|
2198
|
-
isBatchTimeoutError(message) {
|
|
2199
|
-
return /timed out|timeout/i.test(message);
|
|
2200
|
-
}
|
|
2201
|
-
async runBatchWithTimeoutRetry(params) {
|
|
2202
|
-
try {
|
|
2203
|
-
return await params.run();
|
|
2204
|
-
} catch (err) {
|
|
2205
|
-
const message = formatErrorMessage(err);
|
|
2206
|
-
if (this.isBatchTimeoutError(message)) {
|
|
2207
|
-
log$2.warn(`memory embeddings: ${params.provider} batch timed out; retrying once`);
|
|
2208
|
-
try {
|
|
2209
|
-
return await params.run();
|
|
2210
|
-
} catch (retryErr) {
|
|
2211
|
-
retryErr.batchAttempts = 2;
|
|
2212
|
-
throw retryErr;
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
throw err;
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
async runBatchWithFallback(params) {
|
|
2219
|
-
if (!this.batch.enabled) return await params.fallback();
|
|
2220
|
-
try {
|
|
2221
|
-
const result = await this.runBatchWithTimeoutRetry({
|
|
2222
|
-
provider: params.provider,
|
|
2223
|
-
run: params.run
|
|
2224
|
-
});
|
|
2225
|
-
await this.resetBatchFailureCount();
|
|
2226
|
-
return result;
|
|
2227
|
-
} catch (err) {
|
|
2228
|
-
const message = formatErrorMessage(err);
|
|
2229
|
-
const attempts = err.batchAttempts ?? 1;
|
|
2230
|
-
const forceDisable = /asyncBatchEmbedContent not available/i.test(message);
|
|
2231
|
-
const failure = await this.recordBatchFailure({
|
|
2232
|
-
provider: params.provider,
|
|
2233
|
-
message,
|
|
2234
|
-
attempts,
|
|
2235
|
-
forceDisable
|
|
2236
|
-
});
|
|
2237
|
-
const suffix = failure.disabled ? "disabling batch" : "keeping batch enabled";
|
|
2238
|
-
log$2.warn(`memory embeddings: ${params.provider} batch failed (${failure.count}/2); ${suffix}; falling back to non-batch embeddings: ${message}`);
|
|
2239
|
-
return await params.fallback();
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2242
|
-
getIndexConcurrency() {
|
|
2243
|
-
return this.batch.enabled ? this.batch.concurrency : EMBEDDING_INDEX_CONCURRENCY;
|
|
2244
|
-
}
|
|
2245
|
-
clearIndexedFileData(pathname, source) {
|
|
2246
|
-
if (this.vector.enabled) try {
|
|
2247
|
-
this.db.prepare(`DELETE FROM ${VECTOR_TABLE$1} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`).run(pathname, source);
|
|
2248
|
-
} catch {}
|
|
2249
|
-
if (this.fts.enabled && this.fts.available) try {
|
|
2250
|
-
deleteMemoryFtsRows({
|
|
2251
|
-
db: this.db,
|
|
2252
|
-
tableName: FTS_TABLE$1,
|
|
2253
|
-
path: pathname,
|
|
2254
|
-
source,
|
|
2255
|
-
currentModel: this.provider?.model
|
|
2256
|
-
});
|
|
2257
|
-
} catch {}
|
|
2258
|
-
this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`).run(pathname, source);
|
|
2259
|
-
}
|
|
2260
|
-
upsertFileRecord(entry, source) {
|
|
2261
|
-
this.db.prepare(`INSERT INTO files (path, source, hash, mtime, size) VALUES (?, ?, ?, ?, ?)
|
|
2262
|
-
ON CONFLICT(path) DO UPDATE SET
|
|
2263
|
-
source=excluded.source,
|
|
2264
|
-
hash=excluded.hash,
|
|
2265
|
-
mtime=excluded.mtime,
|
|
2266
|
-
size=excluded.size`).run(entry.path, source, entry.hash, entry.mtimeMs, entry.size);
|
|
2267
|
-
}
|
|
2268
|
-
deleteFileRecord(pathname, source) {
|
|
2269
|
-
this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`).run(pathname, source);
|
|
2270
|
-
}
|
|
2271
|
-
/**
|
|
2272
|
-
* Write chunks (and optional embeddings) for a file into the index.
|
|
2273
|
-
* Handles both the chunks table, the vector table, and the FTS table.
|
|
2274
|
-
* Pass an empty embeddings array to skip vector writes (FTS-only mode).
|
|
2275
|
-
*/
|
|
2276
|
-
writeChunks(entry, source, model, chunks, embeddings, vectorReady) {
|
|
2277
|
-
const now = Date.now();
|
|
2278
|
-
this.clearIndexedFileData(entry.path, source);
|
|
2279
|
-
for (let i = 0; i < chunks.length; i++) {
|
|
2280
|
-
const chunk = chunks[i];
|
|
2281
|
-
const embedding = embeddings[i] ?? [];
|
|
2282
|
-
const id = hashText(`${source}:${entry.path}:${chunk.startLine}:${chunk.endLine}:${chunk.hash}:${model}`);
|
|
2283
|
-
this.db.prepare(`INSERT INTO chunks (id, path, source, start_line, end_line, hash, model, text, embedding, updated_at)
|
|
2284
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
2285
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
2286
|
-
hash=excluded.hash,
|
|
2287
|
-
model=excluded.model,
|
|
2288
|
-
text=excluded.text,
|
|
2289
|
-
embedding=excluded.embedding,
|
|
2290
|
-
updated_at=excluded.updated_at`).run(id, entry.path, source, chunk.startLine, chunk.endLine, chunk.hash, model, chunk.text, JSON.stringify(embedding), now);
|
|
2291
|
-
if (vectorReady && embedding.length > 0) replaceMemoryVectorRow({
|
|
2292
|
-
db: this.db,
|
|
2293
|
-
tableName: VECTOR_TABLE$1,
|
|
2294
|
-
id,
|
|
2295
|
-
embedding
|
|
2296
|
-
});
|
|
2297
|
-
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);
|
|
2298
|
-
}
|
|
2299
|
-
if (vectorReady) this.lastVectorDegradationWarnKey = void 0;
|
|
2300
|
-
if (this.vector.enabled && !vectorReady && chunks.length > 0) {
|
|
2301
|
-
const errDetail = this.vector.loadError ? `: ${this.vector.loadError}` : "";
|
|
2302
|
-
if (this.lastVectorDegradationWarnKey !== errDetail) {
|
|
2303
|
-
this.lastVectorDegradationWarnKey = errDetail;
|
|
2304
|
-
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.`);
|
|
2305
|
-
} else log$2.debug(`chunks written without vector embeddings (${entry.path}); sqlite-vec unavailable${errDetail}`);
|
|
2306
|
-
}
|
|
2307
|
-
this.upsertFileRecord(entry, source);
|
|
2308
|
-
}
|
|
2309
|
-
async indexFile(entry, options) {
|
|
2310
|
-
if (!this.provider) {
|
|
2311
|
-
if ("kind" in entry && entry.kind === "multimodal") return;
|
|
2312
|
-
const chunks = filterNonEmptyMemoryChunks(chunkMarkdown(options.content ?? await fs$1.readFile(entry.absPath, "utf-8"), this.settings.chunking));
|
|
2313
|
-
if (options.source === "sessions" && "lineMap" in entry) remapChunkLines(chunks, entry.lineMap);
|
|
2314
|
-
this.writeChunks(entry, options.source, "fts-only", chunks, [], false);
|
|
2315
|
-
return;
|
|
2316
|
-
}
|
|
2317
|
-
let chunks;
|
|
2318
|
-
let structuredInputBytes;
|
|
2319
|
-
if ("kind" in entry && entry.kind === "multimodal") {
|
|
2320
|
-
if (!this.provider) {
|
|
2321
|
-
log$2.debug("Skipping multimodal indexing in FTS-only mode", {
|
|
2322
|
-
path: entry.path,
|
|
2323
|
-
source: options.source
|
|
2324
|
-
});
|
|
2325
|
-
this.clearIndexedFileData(entry.path, options.source);
|
|
2326
|
-
this.upsertFileRecord(entry, options.source);
|
|
2327
|
-
return;
|
|
2328
|
-
}
|
|
2329
|
-
const multimodalChunk = await buildMultimodalChunkForIndexing(entry);
|
|
2330
|
-
if (!multimodalChunk) {
|
|
2331
|
-
this.clearIndexedFileData(entry.path, options.source);
|
|
2332
|
-
this.deleteFileRecord(entry.path, options.source);
|
|
2333
|
-
return;
|
|
2334
|
-
}
|
|
2335
|
-
structuredInputBytes = multimodalChunk.structuredInputBytes;
|
|
2336
|
-
chunks = [multimodalChunk.chunk];
|
|
2337
|
-
} else {
|
|
2338
|
-
const baseChunks = filterNonEmptyMemoryChunks(chunkMarkdown(options.content ?? await fs$1.readFile(entry.absPath, "utf-8"), this.settings.chunking));
|
|
2339
|
-
chunks = this.provider ? enforceEmbeddingMaxInputTokens(this.provider, baseChunks, EMBEDDING_BATCH_MAX_TOKENS) : baseChunks;
|
|
2340
|
-
if (options.source === "sessions" && "lineMap" in entry) remapChunkLines(chunks, entry.lineMap);
|
|
2341
|
-
}
|
|
2342
|
-
if (!this.provider) {
|
|
2343
|
-
this.writeChunks(entry, options.source, "fts-only", chunks, [], false);
|
|
2344
|
-
return;
|
|
2345
|
-
}
|
|
2346
|
-
let embeddings;
|
|
2347
|
-
try {
|
|
2348
|
-
embeddings = this.batch.enabled ? await this.embedChunksWithBatch(chunks, entry, options.source) : await this.embedChunksInBatches(chunks);
|
|
2349
|
-
} catch (err) {
|
|
2350
|
-
const message = formatErrorMessage(err);
|
|
2351
|
-
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)) {
|
|
2352
|
-
log$2.warn("memory embeddings: skipping multimodal file rejected as too large", {
|
|
2353
|
-
path: entry.path,
|
|
2354
|
-
bytes: structuredInputBytes,
|
|
2355
|
-
provider: this.provider.id,
|
|
2356
|
-
model: this.provider.model,
|
|
2357
|
-
error: message
|
|
2358
|
-
});
|
|
2359
|
-
this.clearIndexedFileData(entry.path, options.source);
|
|
2360
|
-
this.upsertFileRecord(entry, options.source);
|
|
2361
|
-
return;
|
|
2362
|
-
}
|
|
2363
|
-
throw err;
|
|
2364
|
-
}
|
|
2365
|
-
const sample = embeddings.find((embedding) => embedding.length > 0);
|
|
2366
|
-
const vectorReady = sample ? await this.ensureVectorReady(sample.length) : false;
|
|
2367
|
-
this.writeChunks(entry, options.source, this.provider.model, chunks, embeddings, vectorReady);
|
|
2368
|
-
}
|
|
2369
|
-
};
|
|
2370
|
-
//#endregion
|
|
2371
|
-
//#region extensions/memory-core/src/memory/manager-search-preflight.ts
|
|
2372
|
-
function resolveMemorySearchPreflight(params) {
|
|
2373
|
-
const normalizedQuery = params.query.trim();
|
|
2374
|
-
if (!normalizedQuery) return {
|
|
2375
|
-
normalizedQuery,
|
|
2376
|
-
shouldInitializeProvider: false,
|
|
2377
|
-
shouldSearch: false
|
|
2378
|
-
};
|
|
2379
|
-
if (!params.hasIndexedContent) return {
|
|
2380
|
-
normalizedQuery,
|
|
2381
|
-
shouldInitializeProvider: false,
|
|
2382
|
-
shouldSearch: false
|
|
2383
|
-
};
|
|
2384
|
-
return {
|
|
2385
|
-
normalizedQuery,
|
|
2386
|
-
shouldInitializeProvider: true,
|
|
2387
|
-
shouldSearch: true
|
|
2388
|
-
};
|
|
2389
|
-
}
|
|
2390
|
-
//#endregion
|
|
2391
|
-
//#region extensions/memory-core/src/memory/manager-search.ts
|
|
2392
|
-
const vectorToBlob = (embedding) => Buffer.from(new Float32Array(embedding).buffer);
|
|
2393
|
-
const FTS_QUERY_TOKEN_RE = /[\p{L}\p{N}_]+/gu;
|
|
2394
|
-
const SHORT_CJK_TRIGRAM_RE = /[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af\u3131-\u3163]/u;
|
|
2395
|
-
function normalizeSearchTokens(raw) {
|
|
2396
|
-
return raw.match(FTS_QUERY_TOKEN_RE)?.map((token) => token.trim().toLowerCase()).filter(Boolean) ?? [];
|
|
2397
|
-
}
|
|
2398
|
-
function scoreFallbackKeywordResult(params) {
|
|
2399
|
-
const queryTokens = [...new Set(normalizeSearchTokens(params.query))];
|
|
2400
|
-
if (queryTokens.length === 0) return params.ftsScore;
|
|
2401
|
-
const textTokens = normalizeSearchTokens(params.text);
|
|
2402
|
-
const textTokenSet = new Set(textTokens);
|
|
2403
|
-
const pathLower = params.path.toLowerCase();
|
|
2404
|
-
const overlap = queryTokens.filter((token) => textTokenSet.has(token)).length;
|
|
2405
|
-
const uniqueQueryOverlap = overlap / Math.max(new Set(queryTokens).size, 1);
|
|
2406
|
-
const density = overlap / Math.max(textTokenSet.size, 1);
|
|
2407
|
-
const pathBoost = queryTokens.reduce((score, token) => score + (pathLower.includes(token) ? .18 : 0), 0);
|
|
2408
|
-
const textLengthBoost = Math.min(params.text.length / 160, .18);
|
|
2409
|
-
const lexicalBoost = uniqueQueryOverlap * .45 + density * .2 + pathBoost + textLengthBoost;
|
|
2410
|
-
return Math.min(1, params.ftsScore + lexicalBoost);
|
|
2411
|
-
}
|
|
2412
|
-
function escapeLikePattern(term) {
|
|
2413
|
-
return term.replaceAll("\\", "\\\\").replaceAll("%", "\\%").replaceAll("_", "\\_");
|
|
2414
|
-
}
|
|
2415
|
-
function buildMatchQueryFromTerms(terms) {
|
|
2416
|
-
if (terms.length === 0) return null;
|
|
2417
|
-
return terms.map((term) => `"${term.replaceAll("\"", "")}"`).join(" AND ");
|
|
2418
|
-
}
|
|
2419
|
-
function planKeywordSearch(params) {
|
|
2420
|
-
if (params.ftsTokenizer !== "trigram") return {
|
|
2421
|
-
matchQuery: params.buildFtsQuery(params.query),
|
|
2422
|
-
substringTerms: []
|
|
2423
|
-
};
|
|
2424
|
-
const tokens = params.query.match(FTS_QUERY_TOKEN_RE)?.map((token) => token.trim()).filter(Boolean) ?? [];
|
|
2425
|
-
if (tokens.length === 0) return {
|
|
2426
|
-
matchQuery: null,
|
|
2427
|
-
substringTerms: []
|
|
2428
|
-
};
|
|
2429
|
-
const matchTerms = [];
|
|
2430
|
-
const substringTerms = [];
|
|
2431
|
-
for (const token of tokens) {
|
|
2432
|
-
if (SHORT_CJK_TRIGRAM_RE.test(token) && Array.from(token).length < 3) {
|
|
2433
|
-
substringTerms.push(token);
|
|
2434
|
-
continue;
|
|
2435
|
-
}
|
|
2436
|
-
matchTerms.push(token);
|
|
2437
|
-
}
|
|
2438
|
-
return {
|
|
2439
|
-
matchQuery: buildMatchQueryFromTerms(matchTerms),
|
|
2440
|
-
substringTerms
|
|
2441
|
-
};
|
|
2442
|
-
}
|
|
2443
|
-
async function searchVector(params) {
|
|
2444
|
-
if (params.queryVec.length === 0 || params.limit <= 0) return [];
|
|
2445
|
-
if (await params.ensureVectorReady(params.queryVec.length)) return params.db.prepare(`SELECT c.id, c.path, c.start_line, c.end_line, c.text,
|
|
2446
|
-
c.source,
|
|
2447
|
-
vec_distance_cosine(v.embedding, ?) AS dist
|
|
2448
|
-
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) => ({
|
|
2449
|
-
id: row.id,
|
|
2450
|
-
path: row.path,
|
|
2451
|
-
startLine: row.start_line,
|
|
2452
|
-
endLine: row.end_line,
|
|
2453
|
-
score: 1 - row.dist,
|
|
2454
|
-
snippet: truncateUtf16Safe(row.text, params.snippetMaxChars),
|
|
2455
|
-
source: row.source
|
|
2456
|
-
}));
|
|
2457
|
-
if (countChunks(params.db, params.providerModel, params.sourceFilterChunks) > 1e3) return [];
|
|
2458
|
-
return listChunks({
|
|
2459
|
-
db: params.db,
|
|
2460
|
-
providerModel: params.providerModel,
|
|
2461
|
-
sourceFilter: params.sourceFilterChunks
|
|
2462
|
-
}).map((chunk) => ({
|
|
2463
|
-
chunk,
|
|
2464
|
-
score: cosineSimilarity(params.queryVec, chunk.embedding)
|
|
2465
|
-
})).filter((entry) => Number.isFinite(entry.score)).toSorted((a, b) => b.score - a.score).slice(0, params.limit).map((entry) => ({
|
|
2466
|
-
id: entry.chunk.id,
|
|
2467
|
-
path: entry.chunk.path,
|
|
2468
|
-
startLine: entry.chunk.startLine,
|
|
2469
|
-
endLine: entry.chunk.endLine,
|
|
2470
|
-
score: entry.score,
|
|
2471
|
-
snippet: truncateUtf16Safe(entry.chunk.text, params.snippetMaxChars),
|
|
2472
|
-
source: entry.chunk.source
|
|
2473
|
-
}));
|
|
2474
|
-
}
|
|
2475
|
-
function countChunks(db, providerModel, sourceFilter) {
|
|
2476
|
-
return db.prepare(`SELECT COUNT(*) as c FROM chunks WHERE model = ?${sourceFilter.sql}`).get(providerModel, ...sourceFilter.params)?.c ?? 0;
|
|
2477
|
-
}
|
|
2478
|
-
function listChunks(params) {
|
|
2479
|
-
return params.db.prepare(`SELECT id, path, start_line, end_line, text, embedding, source
|
|
2480
|
-
FROM chunks
|
|
2481
|
-
WHERE model = ?${params.sourceFilter.sql}`).all(params.providerModel, ...params.sourceFilter.params).map((row) => ({
|
|
2482
|
-
id: row.id,
|
|
2483
|
-
path: row.path,
|
|
2484
|
-
startLine: row.start_line,
|
|
2485
|
-
endLine: row.end_line,
|
|
2486
|
-
text: row.text,
|
|
2487
|
-
embedding: parseEmbedding(row.embedding),
|
|
2488
|
-
source: row.source
|
|
2489
|
-
}));
|
|
2490
|
-
}
|
|
2491
|
-
async function searchKeyword(params) {
|
|
2492
|
-
if (params.limit <= 0) return [];
|
|
2493
|
-
const plan = planKeywordSearch({
|
|
2494
|
-
query: params.query,
|
|
2495
|
-
ftsTokenizer: params.ftsTokenizer,
|
|
2496
|
-
buildFtsQuery: params.buildFtsQuery
|
|
2497
|
-
});
|
|
2498
|
-
if (!plan.matchQuery && plan.substringTerms.length === 0) return [];
|
|
2499
|
-
const modelClause = params.providerModel ? " AND model = ?" : "";
|
|
2500
|
-
const modelParams = params.providerModel ? [params.providerModel] : [];
|
|
2501
|
-
const substringClause = plan.substringTerms.map(() => " AND text LIKE ? ESCAPE '\\'").join("");
|
|
2502
|
-
const substringParams = plan.substringTerms.map((term) => `%${escapeLikePattern(term)}%`);
|
|
2503
|
-
const whereClause = plan.matchQuery ? `${params.ftsTable} MATCH ?${substringClause}${modelClause}${params.sourceFilter.sql}` : `1=1${substringClause}${modelClause}${params.sourceFilter.sql}`;
|
|
2504
|
-
const queryParams = [
|
|
2505
|
-
...plan.matchQuery ? [plan.matchQuery] : [],
|
|
2506
|
-
...substringParams,
|
|
2507
|
-
...modelParams,
|
|
2508
|
-
...params.sourceFilter.params,
|
|
2509
|
-
params.limit
|
|
2510
|
-
];
|
|
2511
|
-
const rankExpression = plan.matchQuery ? `bm25(${params.ftsTable})` : "0";
|
|
2512
|
-
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) => {
|
|
2513
|
-
const textScore = plan.matchQuery ? params.bm25RankToScore(row.rank) : 1;
|
|
2514
|
-
const score = params.boostFallbackRanking ? scoreFallbackKeywordResult({
|
|
2515
|
-
query: params.query,
|
|
2516
|
-
path: row.path,
|
|
2517
|
-
text: row.text,
|
|
2518
|
-
ftsScore: textScore
|
|
2519
|
-
}) : textScore;
|
|
2520
|
-
return {
|
|
2521
|
-
id: row.id,
|
|
2522
|
-
path: row.path,
|
|
2523
|
-
startLine: row.start_line,
|
|
2524
|
-
endLine: row.end_line,
|
|
2525
|
-
score,
|
|
2526
|
-
textScore,
|
|
2527
|
-
snippet: truncateUtf16Safe(row.text, params.snippetMaxChars),
|
|
2528
|
-
source: row.source
|
|
2529
|
-
};
|
|
2530
|
-
});
|
|
2531
|
-
}
|
|
2532
|
-
//#endregion
|
|
2533
|
-
//#region extensions/memory-core/src/memory/manager-status-state.ts
|
|
2534
|
-
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";
|
|
2535
|
-
function resolveInitialMemoryDirty(params) {
|
|
2536
|
-
return params.hasMemorySource && (params.statusOnly ? !params.hasIndexedMeta : true);
|
|
2537
|
-
}
|
|
2538
|
-
function resolveStatusProviderInfo(params) {
|
|
2539
|
-
if (params.provider) return {
|
|
2540
|
-
provider: params.provider.id,
|
|
2541
|
-
model: params.provider.model,
|
|
2542
|
-
searchMode: "hybrid"
|
|
2543
|
-
};
|
|
2544
|
-
if (params.providerInitialized) return {
|
|
2545
|
-
provider: "none",
|
|
2546
|
-
model: void 0,
|
|
2547
|
-
searchMode: "fts-only"
|
|
2548
|
-
};
|
|
2549
|
-
return {
|
|
2550
|
-
provider: params.requestedProvider,
|
|
2551
|
-
model: params.configuredModel || void 0,
|
|
2552
|
-
searchMode: "hybrid"
|
|
2553
|
-
};
|
|
2554
|
-
}
|
|
2555
|
-
function collectMemoryStatusAggregate(params) {
|
|
2556
|
-
const sources = Array.from(params.sources);
|
|
2557
|
-
const bySource = /* @__PURE__ */ new Map();
|
|
2558
|
-
for (const source of sources) bySource.set(source, {
|
|
2559
|
-
files: 0,
|
|
2560
|
-
chunks: 0
|
|
2561
|
-
});
|
|
2562
|
-
const sourceFilterSql = params.sourceFilterSql ?? "";
|
|
2563
|
-
const sourceFilterParams = params.sourceFilterParams ?? [];
|
|
2564
|
-
const aggregateRows = params.db.prepare(MEMORY_STATUS_AGGREGATE_SQL.replaceAll("__FILTER__", sourceFilterSql)).all(...sourceFilterParams, ...sourceFilterParams);
|
|
2565
|
-
let files = 0;
|
|
2566
|
-
let chunks = 0;
|
|
2567
|
-
for (const row of aggregateRows) {
|
|
2568
|
-
const count = row.c ?? 0;
|
|
2569
|
-
const entry = bySource.get(row.source) ?? {
|
|
2570
|
-
files: 0,
|
|
2571
|
-
chunks: 0
|
|
2572
|
-
};
|
|
2573
|
-
if (row.kind === "files") {
|
|
2574
|
-
entry.files = count;
|
|
2575
|
-
files += count;
|
|
2576
|
-
} else {
|
|
2577
|
-
entry.chunks = count;
|
|
2578
|
-
chunks += count;
|
|
2579
|
-
}
|
|
2580
|
-
bySource.set(row.source, entry);
|
|
2581
|
-
}
|
|
2582
|
-
return {
|
|
2583
|
-
files,
|
|
2584
|
-
chunks,
|
|
2585
|
-
sourceCounts: sources.map((source) => Object.assign({ source }, bySource.get(source)))
|
|
2586
|
-
};
|
|
2587
|
-
}
|
|
2588
|
-
//#endregion
|
|
2589
|
-
//#region extensions/memory-core/src/memory/manager-sync-control.ts
|
|
2590
|
-
const log$1 = createSubsystemLogger("memory");
|
|
2591
|
-
function isMemoryReadonlyDbError(err) {
|
|
2592
|
-
const readonlyPattern = /attempt to write a readonly database|database is read-only|SQLITE_READONLY/i;
|
|
2593
|
-
const messages = /* @__PURE__ */ new Set();
|
|
2594
|
-
const pushValue = (value) => {
|
|
2595
|
-
if (typeof value !== "string") return;
|
|
2596
|
-
const normalized = value.trim();
|
|
2597
|
-
if (!normalized) return;
|
|
2598
|
-
messages.add(normalized);
|
|
2599
|
-
};
|
|
2600
|
-
pushValue(formatErrorMessage(err));
|
|
2601
|
-
if (err && typeof err === "object") {
|
|
2602
|
-
const record = err;
|
|
2603
|
-
pushValue(record.message);
|
|
2604
|
-
pushValue(record.code);
|
|
2605
|
-
pushValue(record.name);
|
|
2606
|
-
if (record.cause && typeof record.cause === "object") {
|
|
2607
|
-
const cause = record.cause;
|
|
2608
|
-
pushValue(cause.message);
|
|
2609
|
-
pushValue(cause.code);
|
|
2610
|
-
pushValue(cause.name);
|
|
2611
|
-
}
|
|
2612
|
-
}
|
|
2613
|
-
return [...messages].some((value) => readonlyPattern.test(value));
|
|
2614
|
-
}
|
|
2615
|
-
function extractMemoryErrorReason(err) {
|
|
2616
|
-
if (err instanceof Error && err.message.trim()) return err.message;
|
|
2617
|
-
if (err && typeof err === "object") {
|
|
2618
|
-
const record = err;
|
|
2619
|
-
if (typeof record.message === "string" && record.message.trim()) return record.message;
|
|
2620
|
-
if (typeof record.code === "string" && record.code.trim()) return record.code;
|
|
2621
|
-
}
|
|
2622
|
-
return String(err);
|
|
2623
|
-
}
|
|
2624
|
-
async function runMemorySyncWithReadonlyRecovery(state, params) {
|
|
2625
|
-
try {
|
|
2626
|
-
await state.runSync(params);
|
|
2627
|
-
return;
|
|
2628
|
-
} catch (err) {
|
|
2629
|
-
if (!isMemoryReadonlyDbError(err) || state.closed) throw err;
|
|
2630
|
-
const reason = extractMemoryErrorReason(err);
|
|
2631
|
-
state.readonlyRecoveryAttempts += 1;
|
|
2632
|
-
state.readonlyRecoveryLastError = reason;
|
|
2633
|
-
log$1.warn(`memory sync readonly handle detected; reopening sqlite connection`, { reason });
|
|
2634
|
-
try {
|
|
2635
|
-
state.db.close();
|
|
2636
|
-
} catch {}
|
|
2637
|
-
state.db = state.openDatabase();
|
|
2638
|
-
state.vectorReady = null;
|
|
2639
|
-
state.vector.available = null;
|
|
2640
|
-
state.vector.loadError = void 0;
|
|
2641
|
-
state.ensureSchema();
|
|
2642
|
-
const meta = state.readMeta();
|
|
2643
|
-
state.vector.dims = meta?.vectorDims;
|
|
2644
|
-
try {
|
|
2645
|
-
await state.runSync(params);
|
|
2646
|
-
state.readonlyRecoverySuccesses += 1;
|
|
2647
|
-
} catch (retryErr) {
|
|
2648
|
-
state.readonlyRecoveryFailures += 1;
|
|
2649
|
-
throw retryErr;
|
|
2650
|
-
}
|
|
2651
|
-
}
|
|
2652
|
-
}
|
|
2653
|
-
function enqueueMemoryTargetedSessionSync(state, sessionFiles) {
|
|
2654
|
-
const queuedSessionFiles = state.getQueuedSessionFiles();
|
|
2655
|
-
for (const sessionFile of sessionFiles ?? []) {
|
|
2656
|
-
const trimmed = sessionFile.trim();
|
|
2657
|
-
if (trimmed) queuedSessionFiles.add(trimmed);
|
|
2658
|
-
}
|
|
2659
|
-
if (queuedSessionFiles.size === 0) return state.getSyncing() ?? Promise.resolve();
|
|
2660
|
-
if (!state.getQueuedSessionSync()) state.setQueuedSessionSync((async () => {
|
|
2661
|
-
try {
|
|
2662
|
-
await state.getSyncing()?.catch(() => void 0);
|
|
2663
|
-
while (!state.isClosed() && state.getQueuedSessionFiles().size > 0) {
|
|
2664
|
-
const pendingSessionFiles = Array.from(state.getQueuedSessionFiles());
|
|
2665
|
-
state.getQueuedSessionFiles().clear();
|
|
2666
|
-
await state.sync({
|
|
2667
|
-
reason: "queued-session-files",
|
|
2668
|
-
sessionFiles: pendingSessionFiles
|
|
2669
|
-
});
|
|
2670
|
-
}
|
|
2671
|
-
} finally {
|
|
2672
|
-
state.setQueuedSessionSync(null);
|
|
2673
|
-
}
|
|
2674
|
-
})());
|
|
2675
|
-
return state.getQueuedSessionSync() ?? Promise.resolve();
|
|
2676
|
-
}
|
|
2677
|
-
//#endregion
|
|
2678
|
-
//#region extensions/memory-core/src/memory/recall-verify.ts
|
|
2679
|
-
const DEFAULT_RECALL_VERIFY_CONFIG = {
|
|
2680
|
-
enabled: false,
|
|
2681
|
-
fuzzyWindow: 20
|
|
2682
|
-
};
|
|
2683
|
-
function normalizeForComparison(text) {
|
|
2684
|
-
return text.trim().replaceAll(/\s+/g, " ");
|
|
2685
|
-
}
|
|
2686
|
-
/**
|
|
2687
|
-
* Verify search results by re-reading source files and checking that snippets
|
|
2688
|
-
* still exist at the claimed line ranges.
|
|
2689
|
-
*
|
|
2690
|
-
* When `config.enabled` is false (the default), every result is returned with
|
|
2691
|
-
* `verified: true` — the caller trusts the index.
|
|
2692
|
-
*
|
|
2693
|
-
* When enabled, each result goes through:
|
|
2694
|
-
* 1. Read the source file.
|
|
2695
|
-
* 2. Compare the snippet at the claimed range (whitespace-normalized).
|
|
2696
|
-
* 3. If not found, slide a window of the same height within ±`fuzzyWindow`.
|
|
2697
|
-
* 4. Return corrected `actualStartLine` / `actualEndLine` when relocated.
|
|
2698
|
-
*/
|
|
2699
|
-
async function verifySearchResults(results, fileReader, config = {}) {
|
|
2700
|
-
const resolved = {
|
|
2701
|
-
enabled: config.enabled ?? DEFAULT_RECALL_VERIFY_CONFIG.enabled,
|
|
2702
|
-
fuzzyWindow: config.fuzzyWindow ?? DEFAULT_RECALL_VERIFY_CONFIG.fuzzyWindow
|
|
2703
|
-
};
|
|
2704
|
-
if (!resolved.enabled) return results.map((r) => ({
|
|
2705
|
-
...r,
|
|
2706
|
-
verified: true
|
|
2707
|
-
}));
|
|
2708
|
-
const verified = [];
|
|
2709
|
-
for (const result of results) {
|
|
2710
|
-
const content = await fileReader.readFile(result.path);
|
|
2711
|
-
if (content === null) {
|
|
2712
|
-
verified.push({
|
|
2713
|
-
...result,
|
|
2714
|
-
verified: false
|
|
2715
|
-
});
|
|
2716
|
-
continue;
|
|
2717
|
-
}
|
|
2718
|
-
const lines = content.split("\n");
|
|
2719
|
-
const snippetNorm = normalizeForComparison(result.snippet);
|
|
2720
|
-
const rangeHeight = result.endLine - result.startLine + 1;
|
|
2721
|
-
if (normalizeForComparison(lines.slice(result.startLine - 1, result.endLine).join("\n")).includes(snippetNorm)) {
|
|
2722
|
-
verified.push({
|
|
2723
|
-
...result,
|
|
2724
|
-
verified: true
|
|
2725
|
-
});
|
|
2726
|
-
continue;
|
|
2727
|
-
}
|
|
2728
|
-
const searchStart = Math.max(1, result.startLine - resolved.fuzzyWindow);
|
|
2729
|
-
const searchEnd = Math.min(lines.length, result.endLine + resolved.fuzzyWindow);
|
|
2730
|
-
let found = false;
|
|
2731
|
-
for (let pos = searchStart; pos + rangeHeight - 1 <= searchEnd; pos++) if (normalizeForComparison(lines.slice(pos - 1, pos - 1 + rangeHeight).join("\n")).includes(snippetNorm)) {
|
|
2732
|
-
verified.push({
|
|
2733
|
-
...result,
|
|
2734
|
-
verified: true,
|
|
2735
|
-
actualStartLine: pos,
|
|
2736
|
-
actualEndLine: pos + rangeHeight - 1
|
|
2737
|
-
});
|
|
2738
|
-
found = true;
|
|
2739
|
-
break;
|
|
2740
|
-
}
|
|
2741
|
-
if (!found) verified.push({
|
|
2742
|
-
...result,
|
|
2743
|
-
verified: false
|
|
2744
|
-
});
|
|
2745
|
-
}
|
|
2746
|
-
return verified;
|
|
2747
|
-
}
|
|
2748
|
-
//#endregion
|
|
2749
|
-
//#region extensions/memory-core/src/memory/manager.ts
|
|
2750
|
-
const SNIPPET_MAX_CHARS = 700;
|
|
2751
|
-
const VECTOR_TABLE = "chunks_vec";
|
|
2752
|
-
const FTS_TABLE = "chunks_fts";
|
|
2753
|
-
const EMBEDDING_CACHE_TABLE = "embedding_cache";
|
|
2754
|
-
const MEMORY_INDEX_MANAGER_CACHE_KEY = Symbol.for("kaijibot.memoryIndexManagerCache");
|
|
2755
|
-
const log = createSubsystemLogger("memory");
|
|
2756
|
-
const { cache: INDEX_CACHE, pending: INDEX_CACHE_PENDING } = resolveSingletonManagedCache(MEMORY_INDEX_MANAGER_CACHE_KEY);
|
|
2757
|
-
async function closeAllMemoryIndexManagers() {
|
|
2758
|
-
await closeManagedCacheEntries({
|
|
2759
|
-
cache: INDEX_CACHE,
|
|
2760
|
-
pending: INDEX_CACHE_PENDING,
|
|
2761
|
-
onCloseError: (err) => {
|
|
2762
|
-
log.warn(`failed to close memory index manager: ${String(err)}`);
|
|
2763
|
-
}
|
|
2764
|
-
});
|
|
2765
|
-
}
|
|
2766
|
-
var MemoryIndexManager = class MemoryIndexManager extends MemoryManagerEmbeddingOps {
|
|
2767
|
-
static async loadProviderResult(params) {
|
|
2768
|
-
return await createEmbeddingProvider({
|
|
2769
|
-
config: params.cfg,
|
|
2770
|
-
agentDir: resolveAgentDir(params.cfg, params.agentId),
|
|
2771
|
-
...resolveMemoryPrimaryProviderRequest({ settings: params.settings })
|
|
2772
|
-
});
|
|
2773
|
-
}
|
|
2774
|
-
static async get(params) {
|
|
2775
|
-
const { cfg, agentId } = params;
|
|
2776
|
-
const settings = resolveMemorySearchConfig(cfg, agentId);
|
|
2777
|
-
if (!settings) return null;
|
|
2778
|
-
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
|
2779
|
-
const purpose = params.purpose === "status" ? "status" : "default";
|
|
2780
|
-
const key = `${agentId}:${workspaceDir}:${JSON.stringify(settings)}:${purpose}`;
|
|
2781
|
-
return await getOrCreateManagedCacheEntry({
|
|
2782
|
-
cache: INDEX_CACHE,
|
|
2783
|
-
pending: INDEX_CACHE_PENDING,
|
|
2784
|
-
key,
|
|
2785
|
-
bypassCache: params.purpose === "status",
|
|
2786
|
-
create: async () => new MemoryIndexManager({
|
|
2787
|
-
cacheKey: key,
|
|
2788
|
-
cfg,
|
|
2789
|
-
agentId,
|
|
2790
|
-
workspaceDir,
|
|
2791
|
-
settings,
|
|
2792
|
-
purpose: params.purpose
|
|
2793
|
-
})
|
|
2794
|
-
});
|
|
2795
|
-
}
|
|
2796
|
-
constructor(params) {
|
|
2797
|
-
super();
|
|
2798
|
-
this.providerInitPromise = null;
|
|
2799
|
-
this.providerInitialized = false;
|
|
2800
|
-
this.batchFailureCount = 0;
|
|
2801
|
-
this.batchFailureLock = Promise.resolve();
|
|
2802
|
-
this.vectorReady = null;
|
|
2803
|
-
this.watcher = null;
|
|
2804
|
-
this.watchTimer = null;
|
|
2805
|
-
this.sessionWatchTimer = null;
|
|
2806
|
-
this.sessionUnsubscribe = null;
|
|
2807
|
-
this.intervalTimer = null;
|
|
2808
|
-
this.closed = false;
|
|
2809
|
-
this.dirty = false;
|
|
2810
|
-
this.sessionsDirty = false;
|
|
2811
|
-
this.sessionsDirtyFiles = /* @__PURE__ */ new Set();
|
|
2812
|
-
this.sessionPendingFiles = /* @__PURE__ */ new Set();
|
|
2813
|
-
this.sessionDeltas = /* @__PURE__ */ new Map();
|
|
2814
|
-
this.sessionWarm = /* @__PURE__ */ new Set();
|
|
2815
|
-
this.syncing = null;
|
|
2816
|
-
this.queuedSessionFiles = /* @__PURE__ */ new Set();
|
|
2817
|
-
this.queuedSessionSync = null;
|
|
2818
|
-
this.readonlyRecoveryAttempts = 0;
|
|
2819
|
-
this.readonlyRecoverySuccesses = 0;
|
|
2820
|
-
this.readonlyRecoveryFailures = 0;
|
|
2821
|
-
this.cacheKey = params.cacheKey;
|
|
2822
|
-
this.cfg = params.cfg;
|
|
2823
|
-
this.agentId = params.agentId;
|
|
2824
|
-
this.workspaceDir = params.workspaceDir;
|
|
2825
|
-
this.settings = params.settings;
|
|
2826
|
-
this.provider = null;
|
|
2827
|
-
this.requestedProvider = params.settings.provider;
|
|
2828
|
-
if (params.providerResult) this.applyProviderResult(params.providerResult);
|
|
2829
|
-
this.sources = new Set(params.settings.sources);
|
|
2830
|
-
this.db = this.openDatabase();
|
|
2831
|
-
this.providerKey = this.computeProviderKey();
|
|
2832
|
-
this.cache = {
|
|
2833
|
-
enabled: params.settings.cache.enabled,
|
|
2834
|
-
maxEntries: params.settings.cache.maxEntries
|
|
2835
|
-
};
|
|
2836
|
-
this.fts = {
|
|
2837
|
-
enabled: params.settings.query.hybrid.enabled,
|
|
2838
|
-
available: false
|
|
2839
|
-
};
|
|
2840
|
-
this.ensureSchema();
|
|
2841
|
-
this.vector = {
|
|
2842
|
-
enabled: params.settings.store.vector.enabled,
|
|
2843
|
-
available: null,
|
|
2844
|
-
extensionPath: params.settings.store.vector.extensionPath
|
|
2845
|
-
};
|
|
2846
|
-
const meta = this.readMeta();
|
|
2847
|
-
if (meta?.vectorDims) this.vector.dims = meta.vectorDims;
|
|
2848
|
-
const statusOnly = params.purpose === "status";
|
|
2849
|
-
if (!statusOnly) {
|
|
2850
|
-
this.ensureWatcher();
|
|
2851
|
-
this.ensureSessionListener();
|
|
2852
|
-
this.ensureIntervalSync();
|
|
2853
|
-
}
|
|
2854
|
-
this.dirty = resolveInitialMemoryDirty({
|
|
2855
|
-
hasMemorySource: this.sources.has("memory"),
|
|
2856
|
-
statusOnly,
|
|
2857
|
-
hasIndexedMeta: Boolean(meta)
|
|
2858
|
-
});
|
|
2859
|
-
this.batch = this.resolveBatchConfig();
|
|
2860
|
-
}
|
|
2861
|
-
applyProviderResult(providerResult) {
|
|
2862
|
-
const providerState = resolveMemoryProviderState(providerResult);
|
|
2863
|
-
this.provider = providerState.provider;
|
|
2864
|
-
this.fallbackFrom = providerState.fallbackFrom;
|
|
2865
|
-
this.fallbackReason = providerState.fallbackReason;
|
|
2866
|
-
this.providerUnavailableReason = providerState.providerUnavailableReason;
|
|
2867
|
-
this.providerRuntime = providerState.providerRuntime;
|
|
2868
|
-
this.providerInitialized = true;
|
|
2869
|
-
}
|
|
2870
|
-
async ensureProviderInitialized() {
|
|
2871
|
-
if (this.providerInitialized) return;
|
|
2872
|
-
if (!this.providerInitPromise) this.providerInitPromise = (async () => {
|
|
2873
|
-
const providerResult = await MemoryIndexManager.loadProviderResult({
|
|
2874
|
-
cfg: this.cfg,
|
|
2875
|
-
agentId: this.agentId,
|
|
2876
|
-
settings: this.settings
|
|
2877
|
-
});
|
|
2878
|
-
this.applyProviderResult(providerResult);
|
|
2879
|
-
this.providerKey = this.computeProviderKey();
|
|
2880
|
-
this.batch = this.resolveBatchConfig();
|
|
2881
|
-
})();
|
|
2882
|
-
try {
|
|
2883
|
-
await this.providerInitPromise;
|
|
2884
|
-
} finally {
|
|
2885
|
-
if (this.providerInitialized) this.providerInitPromise = null;
|
|
2886
|
-
}
|
|
2887
|
-
}
|
|
2888
|
-
async warmSession(sessionKey) {
|
|
2889
|
-
if (!this.settings.sync.onSessionStart) return;
|
|
2890
|
-
const key = sessionKey?.trim() || "";
|
|
2891
|
-
if (key && this.sessionWarm.has(key)) return;
|
|
2892
|
-
this.sync({ reason: "session-start" }).catch((err) => {
|
|
2893
|
-
log.warn(`memory sync failed (session-start): ${String(err)}`);
|
|
2894
|
-
});
|
|
2895
|
-
if (key) this.sessionWarm.add(key);
|
|
2896
|
-
}
|
|
2897
|
-
async search(query, opts) {
|
|
2898
|
-
opts?.onDebug?.({ backend: "builtin" });
|
|
2899
|
-
let hasIndexedContent = this.hasIndexedContent();
|
|
2900
|
-
if (!hasIndexedContent) {
|
|
2901
|
-
try {
|
|
2902
|
-
await this.sync({
|
|
2903
|
-
reason: "search",
|
|
2904
|
-
force: true
|
|
2905
|
-
});
|
|
2906
|
-
} catch (err) {
|
|
2907
|
-
log.warn(`memory sync failed (search-bootstrap): ${String(err)}`);
|
|
2908
|
-
}
|
|
2909
|
-
hasIndexedContent = this.hasIndexedContent();
|
|
2910
|
-
}
|
|
2911
|
-
const preflight = resolveMemorySearchPreflight({
|
|
2912
|
-
query,
|
|
2913
|
-
hasIndexedContent
|
|
2914
|
-
});
|
|
2915
|
-
if (!preflight.shouldSearch) return [];
|
|
2916
|
-
const cleaned = preflight.normalizedQuery;
|
|
2917
|
-
this.warmSession(opts?.sessionKey);
|
|
2918
|
-
startAsyncSearchSync({
|
|
2919
|
-
enabled: this.settings.sync.onSearch,
|
|
2920
|
-
dirty: this.dirty,
|
|
2921
|
-
sessionsDirty: this.sessionsDirty,
|
|
2922
|
-
sync: async (params) => await this.sync(params),
|
|
2923
|
-
onError: (err) => {
|
|
2924
|
-
log.warn(`memory sync failed (search): ${String(err)}`);
|
|
2925
|
-
}
|
|
2926
|
-
});
|
|
2927
|
-
if (preflight.shouldInitializeProvider) await this.ensureProviderInitialized();
|
|
2928
|
-
const minScore = opts?.minScore ?? this.settings.query.minScore;
|
|
2929
|
-
const maxResults = opts?.maxResults ?? this.settings.query.maxResults;
|
|
2930
|
-
const hybrid = this.settings.query.hybrid;
|
|
2931
|
-
const candidates = Math.min(200, Math.max(1, Math.floor(maxResults * hybrid.candidateMultiplier)));
|
|
2932
|
-
if (!this.provider) {
|
|
2933
|
-
if (!this.fts.enabled || !this.fts.available) {
|
|
2934
|
-
log.warn("memory search: no provider and FTS unavailable");
|
|
2935
|
-
return [];
|
|
2936
|
-
}
|
|
2937
|
-
const fullQueryResults = await this.searchKeyword(cleaned, candidates, { boostFallbackRanking: true }).catch(() => []);
|
|
2938
|
-
const resultSets = fullQueryResults.length > 0 ? [fullQueryResults] : await Promise.all((() => {
|
|
2939
|
-
const keywords = extractKeywords(cleaned, { ftsTokenizer: this.settings.store.fts.tokenizer });
|
|
2940
|
-
return (keywords.length > 0 ? keywords : [cleaned]).map((term) => this.searchKeyword(term, candidates, { boostFallbackRanking: true }).catch(() => []));
|
|
2941
|
-
})());
|
|
2942
|
-
const seenIds = /* @__PURE__ */ new Map();
|
|
2943
|
-
for (const results of resultSets) for (const result of results) {
|
|
2944
|
-
const existing = seenIds.get(result.id);
|
|
2945
|
-
if (!existing || result.score > existing.score) seenIds.set(result.id, result);
|
|
2946
|
-
}
|
|
2947
|
-
const sorted = (await applyTemporalDecayToHybridResults({
|
|
2948
|
-
results: [...seenIds.values()],
|
|
2949
|
-
temporalDecay: hybrid.temporalDecay,
|
|
2950
|
-
workspaceDir: this.workspaceDir
|
|
2951
|
-
})).toSorted((a, b) => b.score - a.score);
|
|
2952
|
-
const ftsResults = this.selectScoredResults(sorted, maxResults, minScore, 0);
|
|
2953
|
-
return await this.applyVerification(ftsResults);
|
|
2954
|
-
}
|
|
2955
|
-
const keywordResults = hybrid.enabled && this.fts.enabled && this.fts.available ? await this.searchKeyword(cleaned, candidates).catch(() => []) : [];
|
|
2956
|
-
const queryVec = await this.embedQueryWithTimeout(cleaned);
|
|
2957
|
-
const vectorResults = queryVec.some((v) => v !== 0) ? await this.searchVector(queryVec, candidates).catch(() => []) : [];
|
|
2958
|
-
if (!hybrid.enabled || !this.fts.enabled || !this.fts.available) {
|
|
2959
|
-
const vecResults = vectorResults.filter((entry) => entry.score >= minScore).slice(0, maxResults);
|
|
2960
|
-
return await this.applyVerification(vecResults);
|
|
2961
|
-
}
|
|
2962
|
-
const merged = await this.mergeHybridResults({
|
|
2963
|
-
vector: vectorResults,
|
|
2964
|
-
keyword: keywordResults,
|
|
2965
|
-
vectorWeight: hybrid.vectorWeight,
|
|
2966
|
-
textWeight: hybrid.textWeight,
|
|
2967
|
-
mmr: hybrid.mmr,
|
|
2968
|
-
temporalDecay: hybrid.temporalDecay
|
|
2969
|
-
});
|
|
2970
|
-
const strict = merged.filter((entry) => entry.score >= minScore);
|
|
2971
|
-
if (strict.length > 0 || keywordResults.length === 0) {
|
|
2972
|
-
const strictResults = strict.slice(0, maxResults);
|
|
2973
|
-
return await this.applyVerification(strictResults);
|
|
2974
|
-
}
|
|
2975
|
-
const relaxedMinScore = Math.min(minScore, hybrid.textWeight);
|
|
2976
|
-
const keywordKeys = new Set(keywordResults.map((entry) => `${entry.source}:${entry.path}:${entry.startLine}:${entry.endLine}`));
|
|
2977
|
-
const hybridResults = this.selectScoredResults(merged.filter((entry) => keywordKeys.has(`${entry.source}:${entry.path}:${entry.startLine}:${entry.endLine}`)), maxResults, minScore, relaxedMinScore);
|
|
2978
|
-
return await this.applyVerification(hybridResults);
|
|
2979
|
-
}
|
|
2980
|
-
selectScoredResults(results, maxResults, minScore, relaxedMinScore = minScore) {
|
|
2981
|
-
const strict = results.filter((entry) => entry.score >= minScore);
|
|
2982
|
-
if (strict.length > 0) return strict.slice(0, maxResults);
|
|
2983
|
-
return results.filter((entry) => entry.score >= relaxedMinScore).slice(0, maxResults);
|
|
2984
|
-
}
|
|
2985
|
-
async applyVerification(results) {
|
|
2986
|
-
const verifyConfig = this.settings.query.verify;
|
|
2987
|
-
if (!verifyConfig?.enabled) return results;
|
|
2988
|
-
return (await verifySearchResults(results, { readFile: async (relPath) => {
|
|
2989
|
-
try {
|
|
2990
|
-
const fullPath = path.join(this.workspaceDir, relPath);
|
|
2991
|
-
return await fs$1.readFile(fullPath, "utf-8");
|
|
2992
|
-
} catch {
|
|
2993
|
-
return null;
|
|
2994
|
-
}
|
|
2995
|
-
} }, verifyConfig)).filter((r) => r.verified).map((r) => ({
|
|
2996
|
-
path: r.path,
|
|
2997
|
-
startLine: r.actualStartLine ?? r.startLine,
|
|
2998
|
-
endLine: r.actualEndLine ?? r.endLine,
|
|
2999
|
-
score: r.score,
|
|
3000
|
-
snippet: r.snippet,
|
|
3001
|
-
source: r.source,
|
|
3002
|
-
citation: r.citation
|
|
3003
|
-
}));
|
|
3004
|
-
}
|
|
3005
|
-
hasIndexedContent() {
|
|
3006
|
-
if (this.db.prepare(`SELECT 1 as found FROM chunks LIMIT 1`).get()?.found === 1) return true;
|
|
3007
|
-
if (!this.fts.enabled || !this.fts.available) return false;
|
|
3008
|
-
return this.db.prepare(`SELECT 1 as found FROM ${FTS_TABLE} LIMIT 1`).get()?.found === 1;
|
|
3009
|
-
}
|
|
3010
|
-
async searchVector(queryVec, limit) {
|
|
3011
|
-
if (!this.provider) return [];
|
|
3012
|
-
return (await searchVector({
|
|
3013
|
-
db: this.db,
|
|
3014
|
-
vectorTable: VECTOR_TABLE,
|
|
3015
|
-
providerModel: this.provider.model,
|
|
3016
|
-
queryVec,
|
|
3017
|
-
limit,
|
|
3018
|
-
snippetMaxChars: SNIPPET_MAX_CHARS,
|
|
3019
|
-
ensureVectorReady: async (dimensions) => await this.ensureVectorReady(dimensions),
|
|
3020
|
-
sourceFilterVec: this.buildSourceFilter("c"),
|
|
3021
|
-
sourceFilterChunks: this.buildSourceFilter()
|
|
3022
|
-
})).map((entry) => entry);
|
|
3023
|
-
}
|
|
3024
|
-
buildFtsQuery(raw) {
|
|
3025
|
-
return buildFtsQuery(raw);
|
|
3026
|
-
}
|
|
3027
|
-
async searchKeyword(query, limit, options) {
|
|
3028
|
-
if (!this.fts.enabled || !this.fts.available) return [];
|
|
3029
|
-
const sourceFilter = this.buildSourceFilter();
|
|
3030
|
-
const providerModel = this.provider?.model;
|
|
3031
|
-
return (await searchKeyword({
|
|
3032
|
-
db: this.db,
|
|
3033
|
-
ftsTable: FTS_TABLE,
|
|
3034
|
-
providerModel,
|
|
3035
|
-
query,
|
|
3036
|
-
ftsTokenizer: this.settings.store.fts.tokenizer,
|
|
3037
|
-
limit,
|
|
3038
|
-
snippetMaxChars: SNIPPET_MAX_CHARS,
|
|
3039
|
-
sourceFilter,
|
|
3040
|
-
buildFtsQuery: (raw) => this.buildFtsQuery(raw),
|
|
3041
|
-
bm25RankToScore,
|
|
3042
|
-
boostFallbackRanking: options?.boostFallbackRanking
|
|
3043
|
-
})).map((entry) => entry);
|
|
3044
|
-
}
|
|
3045
|
-
mergeHybridResults(params) {
|
|
3046
|
-
return mergeHybridResults({
|
|
3047
|
-
vector: params.vector.map((r) => ({
|
|
3048
|
-
id: r.id,
|
|
3049
|
-
path: r.path,
|
|
3050
|
-
startLine: r.startLine,
|
|
3051
|
-
endLine: r.endLine,
|
|
3052
|
-
source: r.source,
|
|
3053
|
-
snippet: r.snippet,
|
|
3054
|
-
vectorScore: r.score
|
|
3055
|
-
})),
|
|
3056
|
-
keyword: params.keyword.map((r) => ({
|
|
3057
|
-
id: r.id,
|
|
3058
|
-
path: r.path,
|
|
3059
|
-
startLine: r.startLine,
|
|
3060
|
-
endLine: r.endLine,
|
|
3061
|
-
source: r.source,
|
|
3062
|
-
snippet: r.snippet,
|
|
3063
|
-
textScore: r.textScore
|
|
3064
|
-
})),
|
|
3065
|
-
vectorWeight: params.vectorWeight,
|
|
3066
|
-
textWeight: params.textWeight,
|
|
3067
|
-
mmr: params.mmr,
|
|
3068
|
-
temporalDecay: params.temporalDecay,
|
|
3069
|
-
workspaceDir: this.workspaceDir
|
|
3070
|
-
}).then((entries) => entries.map((entry) => entry));
|
|
3071
|
-
}
|
|
3072
|
-
async sync(params) {
|
|
3073
|
-
if (this.closed) return;
|
|
3074
|
-
await this.ensureProviderInitialized();
|
|
3075
|
-
if (this.syncing) {
|
|
3076
|
-
if (params?.sessionFiles?.some((sessionFile) => sessionFile.trim().length > 0)) return this.enqueueTargetedSessionSync(params.sessionFiles);
|
|
3077
|
-
return this.syncing;
|
|
3078
|
-
}
|
|
3079
|
-
this.syncing = this.runSyncWithReadonlyRecovery(params).finally(() => {
|
|
3080
|
-
this.syncing = null;
|
|
3081
|
-
});
|
|
3082
|
-
return this.syncing ?? Promise.resolve();
|
|
3083
|
-
}
|
|
3084
|
-
enqueueTargetedSessionSync(sessionFiles) {
|
|
3085
|
-
return enqueueMemoryTargetedSessionSync({
|
|
3086
|
-
isClosed: () => this.closed,
|
|
3087
|
-
getSyncing: () => this.syncing,
|
|
3088
|
-
getQueuedSessionFiles: () => this.queuedSessionFiles,
|
|
3089
|
-
getQueuedSessionSync: () => this.queuedSessionSync,
|
|
3090
|
-
setQueuedSessionSync: (value) => {
|
|
3091
|
-
this.queuedSessionSync = value;
|
|
3092
|
-
},
|
|
3093
|
-
sync: async (params) => await this.sync(params)
|
|
3094
|
-
}, sessionFiles);
|
|
3095
|
-
}
|
|
3096
|
-
isReadonlyDbError(err) {
|
|
3097
|
-
return isMemoryReadonlyDbError(err);
|
|
3098
|
-
}
|
|
3099
|
-
extractErrorReason(err) {
|
|
3100
|
-
return extractMemoryErrorReason(err);
|
|
3101
|
-
}
|
|
3102
|
-
async runSyncWithReadonlyRecovery(params) {
|
|
3103
|
-
const getClosed = () => this.closed;
|
|
3104
|
-
const getDb = () => this.db;
|
|
3105
|
-
const setDb = (value) => {
|
|
3106
|
-
this.db = value;
|
|
3107
|
-
};
|
|
3108
|
-
const getVectorReady = () => this.vectorReady;
|
|
3109
|
-
const setVectorReady = (value) => {
|
|
3110
|
-
this.vectorReady = value;
|
|
3111
|
-
};
|
|
3112
|
-
const getReadonlyRecoveryAttempts = () => this.readonlyRecoveryAttempts;
|
|
3113
|
-
const setReadonlyRecoveryAttempts = (value) => {
|
|
3114
|
-
this.readonlyRecoveryAttempts = value;
|
|
3115
|
-
};
|
|
3116
|
-
const getReadonlyRecoverySuccesses = () => this.readonlyRecoverySuccesses;
|
|
3117
|
-
const setReadonlyRecoverySuccesses = (value) => {
|
|
3118
|
-
this.readonlyRecoverySuccesses = value;
|
|
3119
|
-
};
|
|
3120
|
-
const getReadonlyRecoveryFailures = () => this.readonlyRecoveryFailures;
|
|
3121
|
-
const setReadonlyRecoveryFailures = (value) => {
|
|
3122
|
-
this.readonlyRecoveryFailures = value;
|
|
3123
|
-
};
|
|
3124
|
-
const getReadonlyRecoveryLastError = () => this.readonlyRecoveryLastError;
|
|
3125
|
-
const setReadonlyRecoveryLastError = (value) => {
|
|
3126
|
-
this.readonlyRecoveryLastError = value;
|
|
3127
|
-
};
|
|
3128
|
-
await runMemorySyncWithReadonlyRecovery({
|
|
3129
|
-
get closed() {
|
|
3130
|
-
return getClosed();
|
|
3131
|
-
},
|
|
3132
|
-
get db() {
|
|
3133
|
-
return getDb();
|
|
3134
|
-
},
|
|
3135
|
-
set db(value) {
|
|
3136
|
-
setDb(value);
|
|
3137
|
-
},
|
|
3138
|
-
get vectorReady() {
|
|
3139
|
-
return getVectorReady();
|
|
3140
|
-
},
|
|
3141
|
-
set vectorReady(value) {
|
|
3142
|
-
setVectorReady(value);
|
|
3143
|
-
},
|
|
3144
|
-
vector: this.vector,
|
|
3145
|
-
get readonlyRecoveryAttempts() {
|
|
3146
|
-
return getReadonlyRecoveryAttempts();
|
|
3147
|
-
},
|
|
3148
|
-
set readonlyRecoveryAttempts(value) {
|
|
3149
|
-
setReadonlyRecoveryAttempts(value);
|
|
3150
|
-
},
|
|
3151
|
-
get readonlyRecoverySuccesses() {
|
|
3152
|
-
return getReadonlyRecoverySuccesses();
|
|
3153
|
-
},
|
|
3154
|
-
set readonlyRecoverySuccesses(value) {
|
|
3155
|
-
setReadonlyRecoverySuccesses(value);
|
|
3156
|
-
},
|
|
3157
|
-
get readonlyRecoveryFailures() {
|
|
3158
|
-
return getReadonlyRecoveryFailures();
|
|
3159
|
-
},
|
|
3160
|
-
set readonlyRecoveryFailures(value) {
|
|
3161
|
-
setReadonlyRecoveryFailures(value);
|
|
3162
|
-
},
|
|
3163
|
-
get readonlyRecoveryLastError() {
|
|
3164
|
-
return getReadonlyRecoveryLastError();
|
|
3165
|
-
},
|
|
3166
|
-
set readonlyRecoveryLastError(value) {
|
|
3167
|
-
setReadonlyRecoveryLastError(value);
|
|
3168
|
-
},
|
|
3169
|
-
runSync: (nextParams) => this.runSync(nextParams),
|
|
3170
|
-
openDatabase: () => this.openDatabase(),
|
|
3171
|
-
ensureSchema: () => this.ensureSchema(),
|
|
3172
|
-
readMeta: () => this.readMeta() ?? void 0
|
|
3173
|
-
}, params);
|
|
3174
|
-
}
|
|
3175
|
-
async readFile(params) {
|
|
3176
|
-
return await readMemoryFile({
|
|
3177
|
-
workspaceDir: this.workspaceDir,
|
|
3178
|
-
extraPaths: this.settings.extraPaths,
|
|
3179
|
-
relPath: params.relPath,
|
|
3180
|
-
from: params.from,
|
|
3181
|
-
lines: params.lines
|
|
3182
|
-
});
|
|
3183
|
-
}
|
|
3184
|
-
status() {
|
|
3185
|
-
const sourceFilter = this.buildSourceFilter();
|
|
3186
|
-
const aggregateState = collectMemoryStatusAggregate({
|
|
3187
|
-
db: { prepare: (sql) => ({ all: (...args) => this.db.prepare(sql).all(...args) }) },
|
|
3188
|
-
sources: this.sources,
|
|
3189
|
-
sourceFilterSql: sourceFilter.sql,
|
|
3190
|
-
sourceFilterParams: sourceFilter.params
|
|
3191
|
-
});
|
|
3192
|
-
const providerInfo = resolveStatusProviderInfo({
|
|
3193
|
-
provider: this.provider,
|
|
3194
|
-
providerInitialized: this.providerInitialized,
|
|
3195
|
-
requestedProvider: this.requestedProvider,
|
|
3196
|
-
configuredModel: this.settings.model || void 0
|
|
3197
|
-
});
|
|
3198
|
-
return {
|
|
3199
|
-
backend: "builtin",
|
|
3200
|
-
files: aggregateState.files,
|
|
3201
|
-
chunks: aggregateState.chunks,
|
|
3202
|
-
dirty: this.dirty || this.sessionsDirty,
|
|
3203
|
-
workspaceDir: this.workspaceDir,
|
|
3204
|
-
dbPath: this.settings.store.path,
|
|
3205
|
-
provider: providerInfo.provider,
|
|
3206
|
-
model: providerInfo.model,
|
|
3207
|
-
requestedProvider: this.requestedProvider,
|
|
3208
|
-
sources: Array.from(this.sources),
|
|
3209
|
-
extraPaths: this.settings.extraPaths,
|
|
3210
|
-
sourceCounts: aggregateState.sourceCounts,
|
|
3211
|
-
cache: this.cache.enabled ? {
|
|
3212
|
-
enabled: true,
|
|
3213
|
-
entries: this.db.prepare(`SELECT COUNT(*) as c FROM ${EMBEDDING_CACHE_TABLE}`).get()?.c ?? 0,
|
|
3214
|
-
maxEntries: this.cache.maxEntries
|
|
3215
|
-
} : {
|
|
3216
|
-
enabled: false,
|
|
3217
|
-
maxEntries: this.cache.maxEntries
|
|
3218
|
-
},
|
|
3219
|
-
fts: {
|
|
3220
|
-
enabled: this.fts.enabled,
|
|
3221
|
-
available: this.fts.available,
|
|
3222
|
-
error: this.fts.loadError
|
|
3223
|
-
},
|
|
3224
|
-
fallback: this.fallbackReason ? {
|
|
3225
|
-
from: this.fallbackFrom ?? "local",
|
|
3226
|
-
reason: this.fallbackReason
|
|
3227
|
-
} : void 0,
|
|
3228
|
-
vector: {
|
|
3229
|
-
enabled: this.vector.enabled,
|
|
3230
|
-
available: this.vector.available ?? void 0,
|
|
3231
|
-
extensionPath: this.vector.extensionPath,
|
|
3232
|
-
loadError: this.vector.loadError,
|
|
3233
|
-
dims: this.vector.dims
|
|
3234
|
-
},
|
|
3235
|
-
batch: {
|
|
3236
|
-
enabled: this.batch.enabled,
|
|
3237
|
-
failures: this.batchFailureCount,
|
|
3238
|
-
limit: 2,
|
|
3239
|
-
wait: this.batch.wait,
|
|
3240
|
-
concurrency: this.batch.concurrency,
|
|
3241
|
-
pollIntervalMs: this.batch.pollIntervalMs,
|
|
3242
|
-
timeoutMs: this.batch.timeoutMs,
|
|
3243
|
-
lastError: this.batchFailureLastError,
|
|
3244
|
-
lastProvider: this.batchFailureLastProvider
|
|
3245
|
-
},
|
|
3246
|
-
custom: {
|
|
3247
|
-
searchMode: providerInfo.searchMode,
|
|
3248
|
-
providerUnavailableReason: this.providerUnavailableReason,
|
|
3249
|
-
readonlyRecovery: {
|
|
3250
|
-
attempts: this.readonlyRecoveryAttempts,
|
|
3251
|
-
successes: this.readonlyRecoverySuccesses,
|
|
3252
|
-
failures: this.readonlyRecoveryFailures,
|
|
3253
|
-
lastError: this.readonlyRecoveryLastError
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
};
|
|
3257
|
-
}
|
|
3258
|
-
async probeVectorAvailability() {
|
|
3259
|
-
if (!this.vector.enabled) return false;
|
|
3260
|
-
await this.ensureProviderInitialized();
|
|
3261
|
-
if (!this.provider) return false;
|
|
3262
|
-
return this.ensureVectorReady();
|
|
3263
|
-
}
|
|
3264
|
-
async probeEmbeddingAvailability() {
|
|
3265
|
-
await this.ensureProviderInitialized();
|
|
3266
|
-
if (!this.provider) return {
|
|
3267
|
-
ok: false,
|
|
3268
|
-
error: this.providerUnavailableReason ?? "No embedding provider available (FTS-only mode)"
|
|
3269
|
-
};
|
|
3270
|
-
try {
|
|
3271
|
-
await this.embedBatchWithRetry(["ping"]);
|
|
3272
|
-
return { ok: true };
|
|
3273
|
-
} catch (err) {
|
|
3274
|
-
return {
|
|
3275
|
-
ok: false,
|
|
3276
|
-
error: formatErrorMessage(err)
|
|
3277
|
-
};
|
|
3278
|
-
}
|
|
3279
|
-
}
|
|
3280
|
-
async close() {
|
|
3281
|
-
if (this.closed) return;
|
|
3282
|
-
this.closed = true;
|
|
3283
|
-
const pendingSync = this.syncing;
|
|
3284
|
-
const pendingProviderInit = this.providerInitPromise;
|
|
3285
|
-
if (this.watchTimer) {
|
|
3286
|
-
clearTimeout(this.watchTimer);
|
|
3287
|
-
this.watchTimer = null;
|
|
3288
|
-
}
|
|
3289
|
-
if (this.sessionWatchTimer) {
|
|
3290
|
-
clearTimeout(this.sessionWatchTimer);
|
|
3291
|
-
this.sessionWatchTimer = null;
|
|
3292
|
-
}
|
|
3293
|
-
if (this.intervalTimer) {
|
|
3294
|
-
clearInterval(this.intervalTimer);
|
|
3295
|
-
this.intervalTimer = null;
|
|
3296
|
-
}
|
|
3297
|
-
if (this.watcher) {
|
|
3298
|
-
await this.watcher.close();
|
|
3299
|
-
this.watcher = null;
|
|
3300
|
-
}
|
|
3301
|
-
if (this.sessionUnsubscribe) {
|
|
3302
|
-
this.sessionUnsubscribe();
|
|
3303
|
-
this.sessionUnsubscribe = null;
|
|
3304
|
-
}
|
|
3305
|
-
await awaitPendingManagerWork({
|
|
3306
|
-
pendingSync,
|
|
3307
|
-
pendingProviderInit
|
|
3308
|
-
});
|
|
3309
|
-
this.db.close();
|
|
3310
|
-
INDEX_CACHE.delete(this.cacheKey);
|
|
3311
|
-
}
|
|
3312
|
-
};
|
|
3313
|
-
//#endregion
|
|
3314
|
-
export { listBuiltinAutoSelectMemoryEmbeddingProviderDoctorMetadata as a, getBuiltinMemoryEmbeddingProviderDoctorMetadata as i, closeAllMemoryIndexManagers as n, registerBuiltInMemoryEmbeddingProviders as o, createEmbeddingProvider as r, MemoryIndexManager as t };
|