@fased/fased 0.1.41 → 0.1.42
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/acp/client.js +2 -2
- package/dist/acp/secret-file.js +2 -2
- package/dist/agents/agent-scope.js +2 -2
- package/dist/agents/apply-patch.js +8 -8
- package/dist/agents/auth-profiles/paths.js +2 -2
- package/dist/agents/auth-profiles/store.js +2 -2
- package/dist/agents/bash-tools.shared.js +2 -2
- package/dist/agents/cli-credentials.js +4 -4
- package/dist/agents/docs-path.js +3 -3
- package/dist/agents/embedded-pi-mcp.js +4 -4
- package/dist/agents/identity-avatar.js +3 -3
- package/dist/agents/identity-file.js +2 -2
- package/dist/agents/pi-embedded-subscribe.raw-stream.js +3 -3
- package/dist/agents/pi-extensions/compaction-safeguard.js +3 -3
- package/dist/agents/pi-model-discovery.js +6 -6
- package/dist/agents/pi-project-settings.js +3 -3
- package/dist/agents/sandbox/fs-bridge.js +2 -2
- package/dist/agents/session-dirs.js +4 -4
- package/dist/agents/session-write-lock.js +13 -13
- package/dist/agents/shell-utils.js +5 -5
- package/dist/agents/skills/bundled-dir.js +4 -4
- package/dist/agents/skills/local-loader.js +6 -6
- package/dist/agents/skills/plugin-skills.js +2 -2
- package/dist/agents/skills/workspace.js +13 -13
- package/dist/agents/skills-install-download.js +7 -7
- package/dist/agents/skills-install-plan.js +2 -2
- package/dist/agents/skills-install.js +2 -2
- package/dist/agents/skills-status.js +2 -2
- package/dist/agents/subagent-depth.js +2 -2
- package/dist/agents/system-prompt-params.js +2 -2
- package/dist/agents/workspace.js +22 -22
- package/dist/auto-reply/reply/agent-runner-execution.js +2 -2
- package/dist/auto-reply/reply/agent-runner.js +2 -2
- package/dist/auto-reply/reply/commands-export-session.js +7 -7
- package/dist/auto-reply/reply/post-compaction-audit.js +3 -3
- package/dist/auto-reply/reply/post-compaction-context.js +3 -3
- package/dist/auto-reply/reply/session.js +3 -3
- package/dist/auto-reply/skill-commands.js +3 -3
- package/dist/auto-reply/status.js +6 -6
- package/dist/brand.js +1 -1
- package/dist/browser/chrome.executables.js +3 -3
- package/dist/browser/chrome.js +3 -3
- package/dist/browser/chrome.profile-decoration.js +6 -6
- package/dist/browser/profiles-service.js +2 -2
- package/dist/browser/server-context.js +2 -2
- package/dist/browser/trash.js +4 -4
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/server.js +4 -4
- package/dist/capabilities/catalog.js +3 -3
- package/dist/channels/plugins/catalog.js +3 -3
- package/dist/cli/browser-cli-extension.js +6 -6
- package/dist/cli/command-format.js +2 -2
- package/dist/cli/cron-cli/register.cron-simple.js +2 -2
- package/dist/cli/dns-cli.js +9 -9
- package/dist/cli/gateway-cli/dev.js +5 -5
- package/dist/cli/gateway-cli/run.js +2 -2
- package/dist/cli/hooks-cli.js +5 -5
- package/dist/cli/memory-cli.js +7 -7
- package/dist/cli/nodes-media-utils.js +2 -2
- package/dist/cli/plugins-cli.js +8 -105
- package/dist/cli/plugins-doctor-cli.js +45 -0
- package/dist/cli/plugins-info-cli.js +50 -0
- package/dist/cli/plugins-status-cli.js +4 -0
- package/dist/cli/program/routes.js +38 -0
- package/dist/cli/secrets-cli.js +3 -3
- package/dist/cli/update-cli/update-command.js +91 -29
- package/dist/cli/windows-argv.js +2 -2
- package/dist/commands/dashboard-link.js +3 -3
- package/dist/commands/doctor-install.js +5 -5
- package/dist/commands/doctor-memory-search.js +2 -2
- package/dist/commands/doctor-platform-notes.js +2 -2
- package/dist/commands/doctor-sandbox.js +2 -2
- package/dist/commands/doctor-state-integrity.js +23 -23
- package/dist/commands/doctor-workspace.js +3 -3
- package/dist/commands/doctor.js +3 -3
- package/dist/commands/managed-up.js +2 -2
- package/dist/commands/onboard-auth.credentials.js +3 -3
- package/dist/commands/onboarding/plugin-install.js +2 -2
- package/dist/commands/sessions-cleanup.js +2 -2
- package/dist/commands/signal-install.js +6 -6
- package/dist/commands/status-all/channels.js +2 -2
- package/dist/commands/wallet.js +47 -47
- package/dist/config/cache-utils.js +2 -2
- package/dist/config/includes.js +5 -5
- package/dist/config/io.js +2 -2
- package/dist/config/legacy.migrations.part-3.js +25 -0
- package/dist/config/paths.js +3 -3
- package/dist/config/sat-runtime-ids.js +3 -3
- package/dist/config/sessions/disk-budget.js +6 -6
- package/dist/config/sessions/paths.js +2 -2
- package/dist/config/sessions/store.js +17 -17
- package/dist/config/sessions/transcript.js +4 -4
- package/dist/config/talk.js +2 -2
- package/dist/cron/service/store.js +2 -2
- package/dist/cron/store.js +6 -6
- package/dist/daemon/systemd-system.js +5 -5
- package/dist/discord/monitor/thread-bindings.state.js +2 -2
- package/dist/extensions/sat-mining/src/sat-bond-layout.js +9 -9
- package/dist/gateway/control-ui-boot-check.js +6 -6
- package/dist/gateway/control-ui-login.js +7 -7
- package/dist/gateway/control-ui.js +9 -9
- package/dist/gateway/hooks-mapping.js +4 -4
- package/dist/gateway/server-discovery.js +2 -2
- package/dist/gateway/server-http.js +4 -4
- package/dist/gateway/server-methods/chat.js +6 -6
- package/dist/gateway/server-methods/sessions.js +6 -6
- package/dist/gateway/server-methods/usage.js +2 -2
- package/dist/gateway/server-plugins.js +12 -0
- package/dist/gateway/server.impl.js +3 -3
- package/dist/gateway/session-compaction-checkpoints.js +4 -4
- package/dist/gateway/session-utils.fs.js +24 -24
- package/dist/gateway/session-utils.js +6 -6
- package/dist/hooks/bundled-dir.js +4 -4
- package/dist/hooks/gmail-setup-utils.js +6 -6
- package/dist/hooks/import-url.js +2 -2
- package/dist/hooks/loader.js +4 -4
- package/dist/hooks/workspace.js +7 -7
- package/dist/infra/archive.js +17 -17
- package/dist/infra/boundary-file-read.js +2 -2
- package/dist/infra/boundary-path.js +15 -15
- package/dist/infra/brew.js +2 -2
- package/dist/infra/control-ui-assets.js +14 -14
- package/dist/infra/device-auth-store.js +8 -8
- package/dist/infra/device-identity.js +8 -8
- package/dist/infra/dotenv.js +2 -2
- package/dist/infra/exec-approvals.js +8 -8
- package/dist/infra/exec-command-resolution.js +4 -4
- package/dist/infra/exec-safe-bin-trust.js +2 -2
- package/dist/infra/fased-root.js +5 -5
- package/dist/infra/fs-safe.js +14 -14
- package/dist/infra/gateway-lock.js +11 -11
- package/dist/infra/git-commit.js +5 -5
- package/dist/infra/git-root.js +4 -4
- package/dist/infra/hosted-runtime-artifact.js +43 -4
- package/dist/infra/is-main.js +2 -2
- package/dist/infra/json-file.js +7 -7
- package/dist/infra/outbound/delivery-queue.js +16 -16
- package/dist/infra/path-env.js +3 -3
- package/dist/infra/ports-lsof.js +4 -4
- package/dist/infra/provider-usage.auth.js +3 -3
- package/dist/infra/safe-open-sync.js +2 -2
- package/dist/infra/session-cost-usage.js +9 -9
- package/dist/infra/shell-env.js +2 -2
- package/dist/infra/state-migrations.fs.js +6 -6
- package/dist/infra/state-migrations.js +23 -23
- package/dist/infra/tmp-fased-dir.js +6 -6
- package/dist/infra/update-runner.js +235 -2
- package/dist/infra/widearea-dns.js +3 -3
- package/dist/infra/wsl.js +2 -2
- package/dist/light-plugin-doctor.js +1 -0
- package/dist/light-plugin-info.js +2 -0
- package/dist/light-update-precheck.js +1 -0
- package/dist/light-update-status.js +12 -0
- package/dist/line/accounts.js +2 -2
- package/dist/line/download.js +2 -2
- package/dist/logging/config.js +3 -3
- package/dist/logging/logger.js +7 -7
- package/dist/managed/federation.js +3 -3
- package/dist/managed/tunnel.js +3 -3
- package/dist/media/store.js +13 -13
- package/dist/media-understanding/runner.js +3 -3
- package/dist/memory/embeddings.js +2 -2
- package/dist/memory/internal.js +10 -10
- package/dist/memory/manager-sync-ops.js +7 -7
- package/dist/memory/repair-executor.js +17 -17
- package/dist/node-host/invoke-system-run-plan.js +8 -8
- package/dist/node-host/invoke.js +2 -2
- package/dist/node-host/runner.js +3 -3
- package/dist/pairing/pairing-store.js +3 -3
- package/dist/plugin-sdk/account-id.d.ts +2 -1
- package/dist/plugin-sdk/account-id.js +1 -32
- package/dist/plugin-sdk/accounts-Bz_2QZSt.js +305 -0
- package/dist/plugin-sdk/accounts-CuqIKU8X.js +84 -0
- package/dist/plugin-sdk/accounts-RHZyaB73.js +63 -0
- package/dist/plugin-sdk/actions-CysoQjk1.js +150 -0
- package/dist/plugin-sdk/active-listener-C5ALSs7Y.js +37 -0
- package/dist/plugin-sdk/agent-scope-BbgPlhtw.js +1372 -0
- package/dist/plugin-sdk/allow-list-yqasgPpz.js +479 -0
- package/dist/plugin-sdk/audio-preflight-XJNZUuhw.js +107 -0
- package/dist/plugin-sdk/audit-BFnu5TVB.js +90 -0
- package/dist/plugin-sdk/blocks-input-DdQwSVtP.js +30 -0
- package/dist/plugin-sdk/channel-access-BiWxa3LR.js +68 -0
- package/dist/plugin-sdk/channel-access-configure-gJvqbbXB.js +28 -0
- package/dist/plugin-sdk/channel-adapters.discord-g8Do3f5N.js +35 -0
- package/dist/plugin-sdk/channel-core-CMPoGCik.js +1 -0
- package/dist/plugin-sdk/channel-plugin-common.d.ts +5 -1
- package/dist/plugin-sdk/channel-plugin-common.js +18 -1014
- package/dist/plugin-sdk/chat-type-CK5stkc4.d.ts +4 -0
- package/dist/plugin-sdk/chunk-CuJIMshx.js +341 -0
- package/dist/plugin-sdk/chunk-items-me0j1xjK.js +34 -0
- package/dist/plugin-sdk/command-status.d.ts +20 -1
- package/dist/plugin-sdk/command-status.js +58 -47
- package/dist/plugin-sdk/commands-registry-DwQIFJmL.js +1337 -0
- package/dist/plugin-sdk/common-C90EHP1w.js +440 -0
- package/dist/plugin-sdk/config-DKNrb8oT.js +23271 -0
- package/dist/plugin-sdk/device-pair.d.ts +3 -1
- package/dist/plugin-sdk/device-pair.js +8 -840
- package/dist/plugin-sdk/device-pairing-J1IH1jFl.js +156 -0
- package/dist/plugin-sdk/diagnostic-C16gioN6.js +282 -0
- package/dist/plugin-sdk/directory-live-DK_83362.js +105 -0
- package/dist/plugin-sdk/directory-live-G7AN8y8N.js +88 -0
- package/dist/plugin-sdk/discord.d.ts +91 -1
- package/dist/plugin-sdk/discord.js +71 -3287
- package/dist/plugin-sdk/draft-stream-controls-DGYBMJYc.js +323 -0
- package/dist/plugin-sdk/exec-DQ8j4Fm3.js +230 -0
- package/dist/plugin-sdk/fetch-RV7QDF43.js +68 -0
- package/dist/plugin-sdk/fetch-guard-CxXvFYq5.js +168 -0
- package/dist/plugin-sdk/filesystem-manager-CeSmCA_A.js +188 -0
- package/dist/plugin-sdk/fs-safe-DztQeyQe.js +192 -0
- package/dist/plugin-sdk/group-mentions-DLOOve8d.d.ts +108 -0
- package/dist/plugin-sdk/guilds-n7MMnX1c.js +13 -0
- package/dist/plugin-sdk/handle-action-DkfMckah.js +1450 -0
- package/dist/plugin-sdk/helpers-C1pcZJsv.js +439 -0
- package/dist/plugin-sdk/image-ops-BSQmb-17.js +510 -0
- package/dist/plugin-sdk/index.d.ts +2575 -1
- package/dist/plugin-sdk/index.js +61 -782
- package/dist/plugin-sdk/ip-BkeyFRJr.js +181 -0
- package/dist/plugin-sdk/json-store.js +6 -6
- package/dist/plugin-sdk/links-D5ecKoG9.js +74 -0
- package/dist/plugin-sdk/logger-BbFvCoKk.js +48 -0
- package/dist/plugin-sdk/login-YbYyMkkE.js +61 -0
- package/dist/plugin-sdk/login-qr-DvJw8_2g.js +326 -0
- package/dist/plugin-sdk/manager-DQ1dH8OM.js +3792 -0
- package/dist/plugin-sdk/markdown-tables-DrB-IM8r.js +29 -0
- package/dist/plugin-sdk/media-D8pWjqEt.js +1137 -0
- package/dist/plugin-sdk/memory-search-DHSeU4pJ.js +242 -0
- package/dist/plugin-sdk/monitor-C7si_bKw.js +4539 -0
- package/dist/plugin-sdk/monitor-DUyt6cCK.js +7739 -0
- package/dist/plugin-sdk/openresponses-http-sYsdEjGP.js +923 -0
- package/dist/plugin-sdk/optional-runtime-dependency-Bt_3Yigu.js +41 -0
- package/dist/plugin-sdk/outbound-B5ukMdUv.js +224 -0
- package/dist/plugin-sdk/outbound-attachment-C9oadpUP.js +95 -0
- package/dist/plugin-sdk/pairing-message-B787pcJI.js +293 -0
- package/dist/plugin-sdk/pairing-message-C5m-8Evp.d.ts +46 -0
- package/dist/plugin-sdk/pairing-store-BdOcH_GA.js +437 -0
- package/dist/plugin-sdk/pairing-token-HQpaqod5.js +91 -0
- package/dist/plugin-sdk/path-alias-guards-BlIJ0AmG.js +43 -0
- package/dist/plugin-sdk/pi-embedded-runner-C6HkZJ5E.js +95517 -0
- package/dist/plugin-sdk/pi-model-discovery-DQdXL_-F.js +134 -0
- package/dist/plugin-sdk/pi-model-discovery-runtime-IwiWDCQ3.js +14 -0
- package/dist/plugin-sdk/probe-CJ6lN-jD.js +41 -0
- package/dist/plugin-sdk/probe-CvXWxzag.js +68 -0
- package/dist/plugin-sdk/probe-DO4M1Qd1.js +109 -0
- package/dist/plugin-sdk/probe-DbhD54Aw.js +89 -0
- package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +42 -1
- package/dist/plugin-sdk/pw-ai-BFHYmEIx.js +1931 -0
- package/dist/plugin-sdk/qmd-manager-D2LMB27z.js +1335 -0
- package/dist/plugin-sdk/query-expansion-BM7lmqaP.js +769 -0
- package/dist/plugin-sdk/replies-BPFt4O-j.js +107 -0
- package/dist/plugin-sdk/reply-prefix-CbPHNXlm.js +171 -0
- package/dist/plugin-sdk/resolve-channels-B-dUtZYa.js +4 -0
- package/dist/plugin-sdk/resolve-channels-sscr14hU.js +208 -0
- package/dist/plugin-sdk/resolve-outbound-target-BP_JscKT.js +40 -0
- package/dist/plugin-sdk/resolve-route-wp5xq4Ws.js +249 -0
- package/dist/plugin-sdk/resolve-users-B63RqPIO.js +118 -0
- package/dist/plugin-sdk/resolve-users-C1sjzEsV.js +125 -0
- package/dist/plugin-sdk/retry-policy-BTH89onl.js +70 -0
- package/dist/plugin-sdk/run-command-i_W6EFb1.d.ts +99 -0
- package/dist/plugin-sdk/runtime-BUpqjZNM.js +6821 -0
- package/dist/plugin-sdk/runtime-dependency-B5Fut2tT.js +2110 -0
- package/dist/plugin-sdk/sandbox-paths-fc-HFGJr.js +158 -0
- package/dist/plugin-sdk/sat-runtime.d.ts +932 -1
- package/dist/plugin-sdk/sat-runtime.js +23 -11815
- package/dist/plugin-sdk/send-CRI83FPV.js +1353 -0
- package/dist/plugin-sdk/send-DGUAXb2b.js +518 -0
- package/dist/plugin-sdk/send-DUp9GIX8.js +329 -0
- package/dist/plugin-sdk/send-DWB5HFdb.js +547 -0
- package/dist/plugin-sdk/send-zn5KBXIN.js +2250 -0
- package/dist/plugin-sdk/session-BLyxz03u.js +175 -0
- package/dist/plugin-sdk/session-key--_1zVBRB.d.ts +17 -0
- package/dist/plugin-sdk/shared-V35XNAbz.js +37 -0
- package/dist/plugin-sdk/skill-commands-DCnCOVR_.js +1514 -0
- package/dist/plugin-sdk/slack-CEoLScM7.js +3742 -0
- package/dist/plugin-sdk/slack-actions-Dwy-8Zg7.js +254 -0
- package/dist/plugin-sdk/slack.d.ts +73 -1
- package/dist/plugin-sdk/slack.js +28 -2568
- package/dist/plugin-sdk/ssrf-D_4q0mKh.js +209 -0
- package/dist/plugin-sdk/sticker-cache-PRfvBRnv.js +170 -0
- package/dist/plugin-sdk/tables-DX84FwPB.js +55 -0
- package/dist/plugin-sdk/tailscale-status-BGBRraZW.js +104 -0
- package/dist/plugin-sdk/targets-BgSHco9b.js +101 -0
- package/dist/plugin-sdk/targets-CuTZl1mO.js +79 -0
- package/dist/plugin-sdk/telegram-actions-D4PNLPEZ.js +319 -0
- package/dist/plugin-sdk/telegram.d.ts +39 -1
- package/dist/plugin-sdk/telegram.js +26 -2530
- package/dist/plugin-sdk/thread-bindings.lifecycle-DjpMLjhY.js +823 -0
- package/dist/plugin-sdk/thread-bindings.state-DYYR9qeT.js +643 -0
- package/dist/plugin-sdk/tmp-fased-dir-B-AAdaCr.d.ts +77 -0
- package/dist/plugin-sdk/tokens-Do_JU4Rh.js +21 -0
- package/dist/plugin-sdk/types-56R2vXgt.d.ts +3359 -0
- package/dist/plugin-sdk/types-CBCtqtMn.d.ts +54 -0
- package/dist/plugin-sdk/types-ZT0DGnls.d.ts +1795 -0
- package/dist/plugin-sdk/types.plugin-CvUiB3Kh.d.ts +4959 -0
- package/dist/plugin-sdk/ui-KGr1WRXC.js +33 -0
- package/dist/plugin-sdk/wallet-status-D9UVH6k9.js +11880 -0
- package/dist/plugin-sdk/web-CSpyzE3P.js +2238 -0
- package/dist/plugin-sdk/whatsapp-actions-DISRDbu1.js +92 -0
- package/dist/plugin-sdk/whatsapp-heartbeat-KM3lYpt-.js +70 -0
- package/dist/plugin-sdk/whatsapp.d.ts +239 -1
- package/dist/plugin-sdk/whatsapp.js +29 -2474
- package/dist/plugin-sdk/ws-CxmRDbD9.js +114 -0
- package/dist/plugin-sdk/wsl-Cw-xOsqF.js +554 -0
- package/dist/plugin-sdk/zod-schema.providers-core-FaYR6KdD.d.ts +1773 -0
- package/dist/plugins/bundled-dir.js +3 -3
- package/dist/plugins/discovery.js +11 -11
- package/dist/plugins/loader.js +13 -13
- package/dist/plugins/manifest-registry.js +2 -2
- package/dist/plugins/manifest.js +4 -4
- package/dist/plugins/path-safety.js +3 -3
- package/dist/plugins/status-cache.js +112 -0
- package/dist/plugins/status-manifest.js +61 -0
- package/dist/plugins/status.js +23 -2
- package/dist/plugins/update.js +3 -3
- package/dist/plugins/web-search-install-catalog.js +3 -3
- package/dist/secrets/apply.js +16 -16
- package/dist/secrets/audit.js +11 -11
- package/dist/secrets/shared.js +9 -9
- package/dist/security/scan-paths.js +2 -2
- package/dist/shared/config-eval.js +2 -2
- package/dist/shared/pid-alive.js +2 -2
- package/dist/tasks/standing-orders.js +5 -5
- package/dist/tasks/task-flow-registry.js +5 -5
- package/dist/tasks/task-registry.js +5 -5
- package/dist/tasks/workflow-definitions.js +6 -6
- package/dist/telegram/token.js +5 -5
- package/dist/utils.js +5 -5
- package/dist/wallet/local-socket-signer-broker.js +16 -16
- package/dist/wallet/providers/embedded-keystore-adapter.js +5 -5
- package/dist/wallet/providers/local-socket-signer-adapter.js +2 -2
- package/dist/wallet/wallet-approval-auth.js +5 -5
- package/dist/wallet/wallet-audit-log.js +5 -5
- package/dist/wallet/wallet-custody.js +21 -21
- package/dist/wallet/wallet-inbound-events.js +5 -5
- package/dist/wallet/wallet-observability.js +5 -5
- package/dist/wallet/wallet-policy.js +9 -9
- package/dist/wallet/wallet-provider-registry.js +7 -7
- package/dist/wallet/wallet-runtime-config.js +3 -3
- package/dist/wallet/wallet-secrets-store.js +22 -22
- package/dist/wallet/wallet-send-approvals.js +5 -5
- package/dist/wallet/wallet-settlement-links.js +5 -5
- package/dist/web/accounts.js +3 -3
- package/dist/web/auth-store.js +18 -18
- package/dist/web/session.js +4 -4
- package/dist/wizard/host-security-capability.js +2 -2
- package/dist/wizard/onboarding.gateway-config.js +0 -21
- package/dist/wizard/onboarding.host-security.js +7 -7
- package/dist/wizard/onboarding.js +7 -7
- package/dist/wizard/onboarding.wallet.js +44 -44
- package/extensions/acpx/package.json +1 -1
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/fased-federation/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +2 -2
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/sat-mining/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/synology-chat/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/package.json +1 -1
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/package.json +1 -1
- package/fased.mjs +29 -1
- package/package.json +6 -4
- package/dist/plugin-sdk/account-helpers-CMvQP0I-.js +0 -38
- package/dist/plugin-sdk/accounts-BJFheJNv.js +0 -62
- package/dist/plugin-sdk/accounts-BRbbLNW_.js +0 -76
- package/dist/plugin-sdk/accounts-BwkH5bTD.js +0 -304
- package/dist/plugin-sdk/accounts-COY-15zJ.js +0 -231
- package/dist/plugin-sdk/accounts-D7_p-Ivb.js +0 -62
- package/dist/plugin-sdk/accounts-DTdM1xcj.js +0 -76
- package/dist/plugin-sdk/accounts-RT6y7n3H.js +0 -304
- package/dist/plugin-sdk/actions-BrU_JMqM.js +0 -149
- package/dist/plugin-sdk/actions-CUdVHzeJ.js +0 -149
- package/dist/plugin-sdk/active-listener-CE8t5g6l.js +0 -37
- package/dist/plugin-sdk/active-listener-Dx1SEGDn.js +0 -37
- package/dist/plugin-sdk/agent-scope-BuTbywla.js +0 -1641
- package/dist/plugin-sdk/agent-scope-kIJqg5PA.js +0 -1641
- package/dist/plugin-sdk/allow-list-C9N6FKeC.js +0 -479
- package/dist/plugin-sdk/allow-list-CBtbuDI8.js +0 -473
- package/dist/plugin-sdk/allow-list-Cgjx0Mc-.js +0 -215
- package/dist/plugin-sdk/audio-preflight-Chxqjwxe.js +0 -96
- package/dist/plugin-sdk/audio-preflight-aupYKWfa.js +0 -96
- package/dist/plugin-sdk/audit-DxB2Kml5.js +0 -78
- package/dist/plugin-sdk/audit-sSeRDwJb.js +0 -78
- package/dist/plugin-sdk/channel-adapters.discord-Chc31YZN.js +0 -35
- package/dist/plugin-sdk/channel-adapters.discord-DXVW1q8n.js +0 -35
- package/dist/plugin-sdk/chat-type-CH3W-zKy.js +0 -11
- package/dist/plugin-sdk/chunk-KCxbJLsV.js +0 -341
- package/dist/plugin-sdk/chunk-M2d7r-Zt.js +0 -341
- package/dist/plugin-sdk/chunk-items-BDhRe_xU.js +0 -34
- package/dist/plugin-sdk/client-DP_eXDIO.js +0 -22
- package/dist/plugin-sdk/client-Dn_01zRN.js +0 -28
- package/dist/plugin-sdk/command-poll-backoff-q0xAK3nQ.js +0 -65
- package/dist/plugin-sdk/commands-registry-CdT-nl7v.js +0 -1337
- package/dist/plugin-sdk/commands-registry-DoWdYAJd.js +0 -1337
- package/dist/plugin-sdk/common-Cpw-vuuM.js +0 -440
- package/dist/plugin-sdk/common-DJWrErdE.js +0 -440
- package/dist/plugin-sdk/config-B6SjJFp-.js +0 -20435
- package/dist/plugin-sdk/config-BULEb5QB.js +0 -19698
- package/dist/plugin-sdk/config-C0qggNKQ.js +0 -20423
- package/dist/plugin-sdk/config-CgwTaper.js +0 -22905
- package/dist/plugin-sdk/config-DLVjQxOu.js +0 -20435
- package/dist/plugin-sdk/config-DgD5T-Ui.js +0 -20656
- package/dist/plugin-sdk/config-DtqAN2L3.js +0 -23249
- package/dist/plugin-sdk/conversation-label-CDH4rKMG.js +0 -36
- package/dist/plugin-sdk/date-time-BtRPVcm7.js +0 -120
- package/dist/plugin-sdk/diagnostic-CuhHqubd.js +0 -282
- package/dist/plugin-sdk/diagnostic-DpyvOvs2.js +0 -275
- package/dist/plugin-sdk/diagnostic-session-state-Zw87xFym.js +0 -59
- package/dist/plugin-sdk/directory-live-8umGGN7a.js +0 -88
- package/dist/plugin-sdk/directory-live-BC7oHcsY.js +0 -105
- package/dist/plugin-sdk/directory-live-BJgud06p.js +0 -105
- package/dist/plugin-sdk/directory-live-BxSH0XXX.js +0 -88
- package/dist/plugin-sdk/draft-stream-controls-Bfbhumzv.js +0 -323
- package/dist/plugin-sdk/draft-stream-controls-v_5gdUYG.js +0 -323
- package/dist/plugin-sdk/draft-stream-loop-B3uUPmuU.js +0 -81
- package/dist/plugin-sdk/extensions/sat-mining/src/config.d.ts +0 -117
- package/dist/plugin-sdk/extensions/sat-mining/src/hash-spec.d.ts +0 -58
- package/dist/plugin-sdk/extensions/sat-mining/src/rpc-read.d.ts +0 -648
- package/dist/plugin-sdk/extensions/sat-mining/src/sat-bond-layout.d.ts +0 -110
- package/dist/plugin-sdk/extensions/sat-mining/src/solana-submit.d.ts +0 -297
- package/dist/plugin-sdk/fetch-D70syO9t.js +0 -68
- package/dist/plugin-sdk/fetch-guard-BLdujDnt.js +0 -163
- package/dist/plugin-sdk/fetch-guard-DTKgMN9f.js +0 -163
- package/dist/plugin-sdk/fetch-headers-my7hgV2G.js +0 -26
- package/dist/plugin-sdk/fetch-timeout-l_6RdoMw.js +0 -43
- package/dist/plugin-sdk/fetch-xfeOsibm.js +0 -68
- package/dist/plugin-sdk/filesystem-manager-BEd8NKL9.js +0 -186
- package/dist/plugin-sdk/filesystem-manager-D-4lQ3Af.js +0 -186
- package/dist/plugin-sdk/fs-safe-BDnJzutp.js +0 -192
- package/dist/plugin-sdk/fs-safe-BPYS6-j1.js +0 -192
- package/dist/plugin-sdk/gateway-registry-w_Z-PHGf.js +0 -58
- package/dist/plugin-sdk/github-copilot-token-Djqpy66R.js +0 -127
- package/dist/plugin-sdk/globals-BtKmaIS3.js +0 -439
- package/dist/plugin-sdk/guilds-BdkvRFue.js +0 -13
- package/dist/plugin-sdk/guilds-DmzO7n0X.js +0 -13
- package/dist/plugin-sdk/guilds-iTYlgBat.js +0 -13
- package/dist/plugin-sdk/handle-action-B61D85yo.js +0 -1445
- package/dist/plugin-sdk/handle-action-CjcxGzQD.js +0 -1445
- package/dist/plugin-sdk/inbound-context-CeJDjLk-.js +0 -68
- package/dist/plugin-sdk/internal-DMTDEiDF.js +0 -247
- package/dist/plugin-sdk/ip-Ddk9SPR-.js +0 -47
- package/dist/plugin-sdk/login-CB_nCjX3.js +0 -61
- package/dist/plugin-sdk/login-CzUuDd1v.js +0 -61
- package/dist/plugin-sdk/login-YveoqEvH.js +0 -268
- package/dist/plugin-sdk/login-qr-D7MEpFza.js +0 -324
- package/dist/plugin-sdk/login-qr-DgxfBFVN.js +0 -324
- package/dist/plugin-sdk/manager-9see0IX5.js +0 -3792
- package/dist/plugin-sdk/manager-D2kZ0Cps.js +0 -3792
- package/dist/plugin-sdk/markdown-tables-CCSD52rA.js +0 -29
- package/dist/plugin-sdk/markdown-tables-DWUNvLrc.js +0 -29
- package/dist/plugin-sdk/media-C7YT4DeU.js +0 -1641
- package/dist/plugin-sdk/media-Cxw-xLGU.js +0 -1641
- package/dist/plugin-sdk/memory-search-B-0Fwnrp.js +0 -242
- package/dist/plugin-sdk/memory-search-J6AYuENR.js +0 -242
- package/dist/plugin-sdk/monitor-38DGeIwS.js +0 -4528
- package/dist/plugin-sdk/monitor-CYCSEVee.js +0 -7743
- package/dist/plugin-sdk/monitor-Ceu-Wayc.js +0 -4528
- package/dist/plugin-sdk/monitor-DCyBaUCs.js +0 -7728
- package/dist/plugin-sdk/openresponses-http-CCfimy89.js +0 -912
- package/dist/plugin-sdk/openresponses-http-DAL_9jE-.js +0 -912
- package/dist/plugin-sdk/optional-runtime-dependency-szS49voX.js +0 -426
- package/dist/plugin-sdk/outbound-BCxOxdi-.js +0 -224
- package/dist/plugin-sdk/outbound-JIwQbpRY.js +0 -224
- package/dist/plugin-sdk/outbound-attachment-C-jSFaEB.js +0 -94
- package/dist/plugin-sdk/outbound-attachment-D6tj5Y5H.js +0 -78
- package/dist/plugin-sdk/path-alias-guards-C76pC928.js +0 -43
- package/dist/plugin-sdk/path-alias-guards-CcQroDXQ.js +0 -43
- package/dist/plugin-sdk/paths-DTurNPnO.js +0 -158
- package/dist/plugin-sdk/paths-GdhK5mV_.js +0 -191
- package/dist/plugin-sdk/pi-embedded-runner-Dum71Tdo.js +0 -107134
- package/dist/plugin-sdk/pi-model-discovery-DadlvsZW.js +0 -134
- package/dist/plugin-sdk/pi-model-discovery-G2L8gMcs.js +0 -22703
- package/dist/plugin-sdk/pi-model-discovery-runtime-BpR1pe7K.js +0 -3
- package/dist/plugin-sdk/pi-model-discovery-runtime-C5ssE6EW.js +0 -127
- package/dist/plugin-sdk/pi-model-discovery-runtime-CQOauapl.js +0 -127
- package/dist/plugin-sdk/pi-model-discovery-runtime-DAaOPt64.js +0 -12
- package/dist/plugin-sdk/pi-model-discovery-runtime-DYfUuqPN.js +0 -127
- package/dist/plugin-sdk/pi-model-discovery-runtime-DyOIGBor.js +0 -127
- package/dist/plugin-sdk/pi-model-discovery-runtime-gd77b0UF.js +0 -12
- package/dist/plugin-sdk/pi-model-discovery-runtime-w4DRRv53.js +0 -128
- package/dist/plugin-sdk/pi-model-discovery-yifTIDIn.js +0 -134
- package/dist/plugin-sdk/polls-D0YNJBfc.js +0 -33
- package/dist/plugin-sdk/probe-0Xt6fbw2.js +0 -109
- package/dist/plugin-sdk/probe-1paqsAk5.js +0 -89
- package/dist/plugin-sdk/probe-BPYqD-cg.js +0 -68
- package/dist/plugin-sdk/probe-Ba4KG8Vi.js +0 -41
- package/dist/plugin-sdk/probe-BfzwvkxZ.js +0 -68
- package/dist/plugin-sdk/probe-CsFmvxbr.js +0 -89
- package/dist/plugin-sdk/probe-Dqx0N4uk.js +0 -109
- package/dist/plugin-sdk/probe-DrTulmwQ.js +0 -41
- package/dist/plugin-sdk/proxy-CV9uL4Wi.js +0 -16
- package/dist/plugin-sdk/pw-ai-SNCI9UXT.js +0 -1926
- package/dist/plugin-sdk/pw-ai-sH1Pi-Fh.js +0 -1926
- package/dist/plugin-sdk/qmd-manager-BfJXNhlO.js +0 -1333
- package/dist/plugin-sdk/qmd-manager-QNVr__Z6.js +0 -1333
- package/dist/plugin-sdk/qmd-scope-Cei2-7Q5.js +0 -78
- package/dist/plugin-sdk/query-expansion-DjJAUtDU.js +0 -769
- package/dist/plugin-sdk/query-expansion-VePrajug.js +0 -769
- package/dist/plugin-sdk/redact-Ck-wgswc.js +0 -188
- package/dist/plugin-sdk/redact-identifier-DdQO7P4_.js +0 -15
- package/dist/plugin-sdk/registry-DNkJsNsz.js +0 -6463
- package/dist/plugin-sdk/replies-fvzN5wnU.js +0 -107
- package/dist/plugin-sdk/replies-zebgZCHX.js +0 -107
- package/dist/plugin-sdk/reply-prefix-DqlCqHXT.js +0 -171
- package/dist/plugin-sdk/reply-prefix-Y14LY6Rn.js +0 -171
- package/dist/plugin-sdk/reply-reference-mUSl_ExV.js +0 -35
- package/dist/plugin-sdk/resolve-channels-CGCkchAo.js +0 -208
- package/dist/plugin-sdk/resolve-channels-CHkzoB7d.js +0 -4
- package/dist/plugin-sdk/resolve-channels-CIoMOUEH.js +0 -88
- package/dist/plugin-sdk/resolve-channels-CU3vZXOG.js +0 -4
- package/dist/plugin-sdk/resolve-channels-J5m_-ZOk.js +0 -208
- package/dist/plugin-sdk/resolve-channels-gIpOj1wt.js +0 -206
- package/dist/plugin-sdk/resolve-route-CNhTJG_2.js +0 -248
- package/dist/plugin-sdk/resolve-route-DO0WR4nB.js +0 -248
- package/dist/plugin-sdk/resolve-users-Bm78yvE3.js +0 -123
- package/dist/plugin-sdk/resolve-users-C0F3LQs2.js +0 -118
- package/dist/plugin-sdk/resolve-users-CTKaESmf.js +0 -116
- package/dist/plugin-sdk/resolve-users-Ct0fO5kP.js +0 -125
- package/dist/plugin-sdk/resolve-users-DlpsBzVS.js +0 -118
- package/dist/plugin-sdk/resolve-users-sv9og6yh.js +0 -125
- package/dist/plugin-sdk/resolve-utils-r6ef8mj8.js +0 -147
- package/dist/plugin-sdk/retry-CB29XXbz.js +0 -780
- package/dist/plugin-sdk/retry-Cq65ROXv.js +0 -77
- package/dist/plugin-sdk/retry-policy-BLYEgIwP.js +0 -70
- package/dist/plugin-sdk/retry-policy-sM01QZT2.js +0 -70
- package/dist/plugin-sdk/run-with-concurrency-CavAFhML.js +0 -42
- package/dist/plugin-sdk/runtime-BPyuAmka.js +0 -6577
- package/dist/plugin-sdk/runtime-dependency-B-1u41Ph.js +0 -2217
- package/dist/plugin-sdk/runtime-dependency-Csswyv5r.js +0 -2217
- package/dist/plugin-sdk/sandbox-paths-CkTERCrj.js +0 -158
- package/dist/plugin-sdk/sandbox-paths-DMnFyOaA.js +0 -158
- package/dist/plugin-sdk/secure-random-DLpYiUzR.js +0 -12
- package/dist/plugin-sdk/send-B09HRfHN.js +0 -1351
- package/dist/plugin-sdk/send-BBYcgXA4.js +0 -546
- package/dist/plugin-sdk/send-BQXQA81e.js +0 -2249
- package/dist/plugin-sdk/send-BzFdvD_i.js +0 -1351
- package/dist/plugin-sdk/send-C3u-F_8s.js +0 -2249
- package/dist/plugin-sdk/send-D3836_UN.js +0 -505
- package/dist/plugin-sdk/send-D7tr-EsH.js +0 -546
- package/dist/plugin-sdk/send-DRGzRdI3.js +0 -518
- package/dist/plugin-sdk/send-DfkPKz_0.js +0 -356
- package/dist/plugin-sdk/send-DsxFXrCO.js +0 -356
- package/dist/plugin-sdk/session-DG_bYisw.js +0 -175
- package/dist/plugin-sdk/session-EIStzK0E.js +0 -175
- package/dist/plugin-sdk/session-key-Bp3qq3bm.js +0 -228
- package/dist/plugin-sdk/skill-commands-CkgGmWBS.js +0 -1600
- package/dist/plugin-sdk/skill-commands-hyZA0LE3.js +0 -1571
- package/dist/plugin-sdk/slack-B0dLDyHM.js +0 -3731
- package/dist/plugin-sdk/slack-Dv4zCw-x.js +0 -3730
- package/dist/plugin-sdk/slack-actions-BQawWGTJ.js +0 -248
- package/dist/plugin-sdk/slack-actions-DDMszx56.js +0 -248
- package/dist/plugin-sdk/src/acp/acpx-mutating-wrapper-policy.d.ts +0 -35
- package/dist/plugin-sdk/src/acp/acpx-push-test-approval-contract.d.ts +0 -62
- package/dist/plugin-sdk/src/acp/acpx-push-test-execution-adapter.d.ts +0 -44
- package/dist/plugin-sdk/src/acp/control-plane/manager.core.d.ts +0 -74
- package/dist/plugin-sdk/src/acp/control-plane/manager.d.ts +0 -7
- package/dist/plugin-sdk/src/acp/control-plane/manager.identity-reconcile.d.ts +0 -23
- package/dist/plugin-sdk/src/acp/control-plane/manager.runtime-controls.d.ts +0 -14
- package/dist/plugin-sdk/src/acp/control-plane/manager.types.d.ts +0 -103
- package/dist/plugin-sdk/src/acp/control-plane/manager.utils.d.ts +0 -14
- package/dist/plugin-sdk/src/acp/control-plane/runtime-cache.d.ts +0 -38
- package/dist/plugin-sdk/src/acp/control-plane/runtime-options.d.ts +0 -23
- package/dist/plugin-sdk/src/acp/control-plane/session-actor-queue.d.ts +0 -8
- package/dist/plugin-sdk/src/acp/control-plane/spawn.d.ts +0 -25
- package/dist/plugin-sdk/src/acp/policy.d.ts +0 -10
- package/dist/plugin-sdk/src/acp/runtime/error-text.d.ts +0 -7
- package/dist/plugin-sdk/src/acp/runtime/errors.d.ts +0 -20
- package/dist/plugin-sdk/src/acp/runtime/registry.d.ts +0 -18
- package/dist/plugin-sdk/src/acp/runtime/session-identifiers.d.ts +0 -17
- package/dist/plugin-sdk/src/acp/runtime/session-identity.d.ts +0 -23
- package/dist/plugin-sdk/src/acp/runtime/session-meta.d.ts +0 -30
- package/dist/plugin-sdk/src/acp/runtime/types.d.ts +0 -102
- package/dist/plugin-sdk/src/acp/status-snapshot.d.ts +0 -54
- package/dist/plugin-sdk/src/agents/acp-spawn-parent-stream.d.ts +0 -20
- package/dist/plugin-sdk/src/agents/acp-spawn.d.ts +0 -39
- package/dist/plugin-sdk/src/agents/agent-model-providers.d.ts +0 -47
- package/dist/plugin-sdk/src/agents/agent-paths.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/agent-scope.d.ts +0 -71
- package/dist/plugin-sdk/src/agents/announce-idempotency.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/anthropic-payload-log.d.ts +0 -20
- package/dist/plugin-sdk/src/agents/api-key-rotation.d.ts +0 -22
- package/dist/plugin-sdk/src/agents/apply-patch-update.d.ts +0 -10
- package/dist/plugin-sdk/src/agents/apply-patch.d.ts +0 -35
- package/dist/plugin-sdk/src/agents/auth-health.d.ts +0 -40
- package/dist/plugin-sdk/src/agents/auth-profiles/constants.d.ts +0 -19
- package/dist/plugin-sdk/src/agents/auth-profiles/display.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/auth-profiles/doctor.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/auth-profiles/external-cli-sync.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/auth-profiles/oauth.d.ts +0 -14
- package/dist/plugin-sdk/src/agents/auth-profiles/order.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/auth-profiles/paths.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/auth-profiles/profiles.d.ts +0 -25
- package/dist/plugin-sdk/src/agents/auth-profiles/repair.d.ts +0 -14
- package/dist/plugin-sdk/src/agents/auth-profiles/session-override.d.ts +0 -19
- package/dist/plugin-sdk/src/agents/auth-profiles/store.d.ts +0 -24
- package/dist/plugin-sdk/src/agents/auth-profiles/types.d.ts +0 -65
- package/dist/plugin-sdk/src/agents/auth-profiles/usage.d.ts +0 -85
- package/dist/plugin-sdk/src/agents/auth-profiles.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/bash-process-registry.d.ts +0 -72
- package/dist/plugin-sdk/src/agents/bash-tools.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/bash-tools.exec-approval-followup.d.ts +0 -12
- package/dist/plugin-sdk/src/agents/bash-tools.exec-approval-request.d.ts +0 -70
- package/dist/plugin-sdk/src/agents/bash-tools.exec-host-gateway.d.ts +0 -34
- package/dist/plugin-sdk/src/agents/bash-tools.exec-host-node.d.ts +0 -26
- package/dist/plugin-sdk/src/agents/bash-tools.exec-host-shared.d.ts +0 -155
- package/dist/plugin-sdk/src/agents/bash-tools.exec-runtime.d.ts +0 -116
- package/dist/plugin-sdk/src/agents/bash-tools.exec-types.d.ts +0 -76
- package/dist/plugin-sdk/src/agents/bash-tools.exec.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/bash-tools.process.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/bash-tools.shared.d.ts +0 -56
- package/dist/plugin-sdk/src/agents/bootstrap-budget.d.ts +0 -87
- package/dist/plugin-sdk/src/agents/bootstrap-cache.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/bootstrap-files.d.ts +0 -32
- package/dist/plugin-sdk/src/agents/bootstrap-hooks.d.ts +0 -10
- package/dist/plugin-sdk/src/agents/byteplus-models.d.ts +0 -128
- package/dist/plugin-sdk/src/agents/cache-trace.d.ts +0 -49
- package/dist/plugin-sdk/src/agents/channel-tools.d.ts +0 -30
- package/dist/plugin-sdk/src/agents/chutes-models.d.ts +0 -25
- package/dist/plugin-sdk/src/agents/chutes-oauth.d.ts +0 -46
- package/dist/plugin-sdk/src/agents/cli-backends.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/cli-credentials.d.ts +0 -72
- package/dist/plugin-sdk/src/agents/cli-runner/helpers.d.ts +0 -72
- package/dist/plugin-sdk/src/agents/cli-runner/reliability.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/cli-runner.d.ts +0 -42
- package/dist/plugin-sdk/src/agents/cli-session.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/cli-watchdog-defaults.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/cloudflare-ai-gateway.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/command-poll-backoff.d.ts +0 -28
- package/dist/plugin-sdk/src/agents/compaction.d.ts +0 -72
- package/dist/plugin-sdk/src/agents/content-blocks.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/context-window-guard.d.ts +0 -25
- package/dist/plugin-sdk/src/agents/context.d.ts +0 -38
- package/dist/plugin-sdk/src/agents/current-model-catalog.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/current-time.d.ts +0 -17
- package/dist/plugin-sdk/src/agents/date-time.d.ts +0 -13
- package/dist/plugin-sdk/src/agents/defaults.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/docs-path.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/doubao-models.d.ts +0 -128
- package/dist/plugin-sdk/src/agents/embedded-pi-mcp.d.ts +0 -13
- package/dist/plugin-sdk/src/agents/exec-approval-result.d.ts +0 -21
- package/dist/plugin-sdk/src/agents/failover-error.d.ts +0 -33
- package/dist/plugin-sdk/src/agents/fased-tools.d.ts +0 -58
- package/dist/plugin-sdk/src/agents/glob-pattern.d.ts +0 -18
- package/dist/plugin-sdk/src/agents/huggingface-models.d.ts +0 -14
- package/dist/plugin-sdk/src/agents/identity-avatar.d.ts +0 -17
- package/dist/plugin-sdk/src/agents/identity-file.d.ts +0 -12
- package/dist/plugin-sdk/src/agents/identity.d.ts +0 -28
- package/dist/plugin-sdk/src/agents/image-sanitization.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/lanes.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/live-auth-keys.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/mcp-config-shared.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/mcp-http.d.ts +0 -19
- package/dist/plugin-sdk/src/agents/mcp-stdio.d.ts +0 -16
- package/dist/plugin-sdk/src/agents/mcp-transport-config.d.ts +0 -23
- package/dist/plugin-sdk/src/agents/mcp-transport.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/memory-search.d.ts +0 -80
- package/dist/plugin-sdk/src/agents/minimax-vlm.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/model-alias-lines.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/model-auth-label.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/model-auth.d.ts +0 -37
- package/dist/plugin-sdk/src/agents/model-catalog-access.d.ts +0 -30
- package/dist/plugin-sdk/src/agents/model-catalog-normalized.d.ts +0 -27
- package/dist/plugin-sdk/src/agents/model-catalog-source.d.ts +0 -41
- package/dist/plugin-sdk/src/agents/model-catalog-status.d.ts +0 -92
- package/dist/plugin-sdk/src/agents/model-catalog.d.ts +0 -35
- package/dist/plugin-sdk/src/agents/model-compat.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/model-fallback.d.ts +0 -54
- package/dist/plugin-sdk/src/agents/model-forward-compat.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/model-metadata.d.ts +0 -49
- package/dist/plugin-sdk/src/agents/model-ref-profile.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/model-selection.d.ts +0 -130
- package/dist/plugin-sdk/src/agents/models-config.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/models-config.providers.d.ts +0 -40
- package/dist/plugin-sdk/src/agents/opencode-zen-models.d.ts +0 -46
- package/dist/plugin-sdk/src/agents/owner-display.d.ts +0 -19
- package/dist/plugin-sdk/src/agents/payload-redaction.d.ts +0 -10
- package/dist/plugin-sdk/src/agents/pi-auth-credentials.d.ts +0 -16
- package/dist/plugin-sdk/src/agents/pi-bundle-mcp-materialize.d.ts +0 -12
- package/dist/plugin-sdk/src/agents/pi-bundle-mcp-names.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/pi-bundle-mcp-runtime.d.ts +0 -21
- package/dist/plugin-sdk/src/agents/pi-bundle-mcp-tools.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/pi-bundle-mcp-types.d.ts +0 -52
- package/dist/plugin-sdk/src/agents/pi-embedded-block-chunker.d.ts +0 -19
- package/dist/plugin-sdk/src/agents/pi-embedded-helpers/bootstrap.d.ts +0 -33
- package/dist/plugin-sdk/src/agents/pi-embedded-helpers/errors.d.ts +0 -70
- package/dist/plugin-sdk/src/agents/pi-embedded-helpers/google.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/pi-embedded-helpers/images.d.ts +0 -22
- package/dist/plugin-sdk/src/agents/pi-embedded-helpers/messaging-dedupe.d.ts +0 -10
- package/dist/plugin-sdk/src/agents/pi-embedded-helpers/openai.d.ts +0 -17
- package/dist/plugin-sdk/src/agents/pi-embedded-helpers/thinking.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/pi-embedded-helpers/turns.d.ts +0 -21
- package/dist/plugin-sdk/src/agents/pi-embedded-helpers/types.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/pi-embedded-helpers.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/pi-embedded-messaging.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/pi-embedded-payloads.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/abort.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/cache-ttl.d.ts +0 -17
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/compact.d.ts +0 -57
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/compaction-safety-timeout.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/extensions.d.ts +0 -12
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/extra-params.d.ts +0 -76
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/google.d.ts +0 -42
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/history.d.ts +0 -18
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/lanes.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/logger.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/model.d.ts +0 -30
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/attempt.d.ts +0 -30
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/compaction-timeout.d.ts +0 -20
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/history-image-prune.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/images.d.ts +0 -83
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/llm-idle-timeout.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/params.d.ts +0 -128
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/payloads.d.ts +0 -42
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/types.d.ts +0 -67
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/run.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/runs.d.ts +0 -32
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/sandbox-info.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/session-manager-cache.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/session-manager-init.d.ts +0 -17
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/system-prompt.d.ts +0 -55
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/thinking.d.ts +0 -17
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/tool-name-allowlist.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/tool-result-context-guard.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/tool-result-truncation.d.ts +0 -79
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/tool-split.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/types.d.ts +0 -95
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/utils.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/wait-for-idle-before-flush.d.ts +0 -14
- package/dist/plugin-sdk/src/agents/pi-embedded-runner.d.ts +0 -12
- package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.d.ts +0 -34
- package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.compaction.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.lifecycle.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.messages.d.ts +0 -16
- package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.tools.d.ts +0 -18
- package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.types.d.ts +0 -152
- package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.raw-stream.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.tools.d.ts +0 -20
- package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.types.d.ts +0 -45
- package/dist/plugin-sdk/src/agents/pi-embedded-utils.d.ts +0 -42
- package/dist/plugin-sdk/src/agents/pi-embedded.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/pi-extensions/compaction-safeguard-runtime.d.ts +0 -16
- package/dist/plugin-sdk/src/agents/pi-extensions/compaction-safeguard.d.ts +0 -22
- package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning/extension.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning/pruner.d.ts +0 -10
- package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning/runtime.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning/settings.d.ts +0 -44
- package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning/tools.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning.d.ts +0 -10
- package/dist/plugin-sdk/src/agents/pi-extensions/session-manager-runtime-registry.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/pi-model-discovery-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/pi-model-discovery.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/pi-project-settings.d.ts +0 -28
- package/dist/plugin-sdk/src/agents/pi-settings.d.ts +0 -45
- package/dist/plugin-sdk/src/agents/pi-tool-definition-adapter.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/pi-tools.abort.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/pi-tools.before-tool-call.d.ts +0 -31
- package/dist/plugin-sdk/src/agents/pi-tools.d.ts +0 -84
- package/dist/plugin-sdk/src/agents/pi-tools.policy.d.ts +0 -38
- package/dist/plugin-sdk/src/agents/pi-tools.read.d.ts +0 -61
- package/dist/plugin-sdk/src/agents/pi-tools.schema.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/pi-tools.types.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/prompt-cache-stability.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/provider-attribution.d.ts +0 -70
- package/dist/plugin-sdk/src/agents/provider-auth-aliases.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/provider-extension-catalog-index.d.ts +0 -37
- package/dist/plugin-sdk/src/agents/provider-extension-catalog-manifest.d.ts +0 -29
- package/dist/plugin-sdk/src/agents/provider-id.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/provider-request-config.d.ts +0 -194
- package/dist/plugin-sdk/src/agents/pty-dsr.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/pty-keys.d.ts +0 -14
- package/dist/plugin-sdk/src/agents/queued-file-writer.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/sandbox/backend.d.ts +0 -29
- package/dist/plugin-sdk/src/agents/sandbox/bind-spec.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/sandbox/browser-bridges.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/sandbox/browser.d.ts +0 -12
- package/dist/plugin-sdk/src/agents/sandbox/config-hash.d.ts +0 -18
- package/dist/plugin-sdk/src/agents/sandbox/config.d.ts +0 -32
- package/dist/plugin-sdk/src/agents/sandbox/constants.d.ts +0 -21
- package/dist/plugin-sdk/src/agents/sandbox/context.d.ts +0 -20
- package/dist/plugin-sdk/src/agents/sandbox/docker.d.ts +0 -48
- package/dist/plugin-sdk/src/agents/sandbox/fs-bridge.d.ts +0 -56
- package/dist/plugin-sdk/src/agents/sandbox/fs-paths.d.ts +0 -28
- package/dist/plugin-sdk/src/agents/sandbox/hash.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/sandbox/host-paths.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/sandbox/manage.d.ts +0 -13
- package/dist/plugin-sdk/src/agents/sandbox/network-mode.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/sandbox/novnc-auth.d.ts +0 -15
- package/dist/plugin-sdk/src/agents/sandbox/path-utils.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/sandbox/prune.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/sandbox/registry.d.ts +0 -31
- package/dist/plugin-sdk/src/agents/sandbox/runtime-status.d.ts +0 -18
- package/dist/plugin-sdk/src/agents/sandbox/sanitize-env-vars.d.ts +0 -14
- package/dist/plugin-sdk/src/agents/sandbox/shared.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/sandbox/tool-policy.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/sandbox/types.d.ts +0 -91
- package/dist/plugin-sdk/src/agents/sandbox/types.docker.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/sandbox/validate-sandbox-security.d.ts +0 -68
- package/dist/plugin-sdk/src/agents/sandbox/workspace.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/sandbox-media-paths.d.ts +0 -17
- package/dist/plugin-sdk/src/agents/sandbox-paths.d.ts +0 -24
- package/dist/plugin-sdk/src/agents/sandbox-tool-policy.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/sandbox.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/sanitize-for-prompt.d.ts +0 -21
- package/dist/plugin-sdk/src/agents/schema/clean-for-gemini.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/schema/typebox.d.ts +0 -14
- package/dist/plugin-sdk/src/agents/session-dirs.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/session-file-repair.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/session-slug.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/session-tool-result-guard-wrapper.d.ts +0 -19
- package/dist/plugin-sdk/src/agents/session-tool-result-guard.d.ts +0 -40
- package/dist/plugin-sdk/src/agents/session-transcript-repair.d.ts +0 -34
- package/dist/plugin-sdk/src/agents/session-write-lock.d.ts +0 -54
- package/dist/plugin-sdk/src/agents/shell-utils.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/skills/agent-filter.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/skills/bundled-context.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/skills/bundled-dir.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/skills/config.d.ts +0 -13
- package/dist/plugin-sdk/src/agents/skills/env-overrides.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/skills/filter.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/skills/frontmatter.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/skills/local-loader.d.ts +0 -13
- package/dist/plugin-sdk/src/agents/skills/plugin-skills.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/skills/refresh-state.d.ts +0 -15
- package/dist/plugin-sdk/src/agents/skills/refresh.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/skills/serialize.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/skills/skill-contract.d.ts +0 -27
- package/dist/plugin-sdk/src/agents/skills/source.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/skills/types.d.ts +0 -105
- package/dist/plugin-sdk/src/agents/skills/workspace.d.ts +0 -54
- package/dist/plugin-sdk/src/agents/skills-clawhub.d.ts +0 -150
- package/dist/plugin-sdk/src/agents/skills-install-plan.d.ts +0 -25
- package/dist/plugin-sdk/src/agents/skills-install-trust.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/skills-marketplace-policy.d.ts +0 -29
- package/dist/plugin-sdk/src/agents/skills-marketplace-scan.d.ts +0 -17
- package/dist/plugin-sdk/src/agents/skills-status.d.ts +0 -65
- package/dist/plugin-sdk/src/agents/skills.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/spawned-context.d.ts +0 -30
- package/dist/plugin-sdk/src/agents/stable-stringify.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/subagent-announce-dispatch.d.ts +0 -22
- package/dist/plugin-sdk/src/agents/subagent-announce-output.d.ts +0 -97
- package/dist/plugin-sdk/src/agents/subagent-announce-queue.d.ts +0 -24
- package/dist/plugin-sdk/src/agents/subagent-announce.d.ts +0 -51
- package/dist/plugin-sdk/src/agents/subagent-announce.runtime.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/subagent-depth.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/subagent-lifecycle-events.d.ts +0 -18
- package/dist/plugin-sdk/src/agents/subagent-registry-cleanup.d.ts +0 -25
- package/dist/plugin-sdk/src/agents/subagent-registry-completion.d.ts +0 -15
- package/dist/plugin-sdk/src/agents/subagent-registry-queries.d.ts +0 -17
- package/dist/plugin-sdk/src/agents/subagent-registry-state.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/subagent-registry.d.ts +0 -67
- package/dist/plugin-sdk/src/agents/subagent-registry.store.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/subagent-registry.types.d.ts +0 -62
- package/dist/plugin-sdk/src/agents/subagent-spawn.d.ts +0 -49
- package/dist/plugin-sdk/src/agents/synthetic-models.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/system-prompt-cache-boundary.d.ts +0 -10
- package/dist/plugin-sdk/src/agents/system-prompt-params.d.ts +0 -30
- package/dist/plugin-sdk/src/agents/system-prompt-report.d.ts +0 -22
- package/dist/plugin-sdk/src/agents/system-prompt.d.ts +0 -77
- package/dist/plugin-sdk/src/agents/timeout.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/together-models.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/tool-call-id.d.ts +0 -29
- package/dist/plugin-sdk/src/agents/tool-catalog.d.ts +0 -35
- package/dist/plugin-sdk/src/agents/tool-description-presets.d.ts +0 -15
- package/dist/plugin-sdk/src/agents/tool-description-summary.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/tool-display-common.d.ts +0 -70
- package/dist/plugin-sdk/src/agents/tool-display-config.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/tool-display-exec-shell.d.ts +0 -17
- package/dist/plugin-sdk/src/agents/tool-display-exec.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/tool-display.d.ts +0 -15
- package/dist/plugin-sdk/src/agents/tool-fs-policy.d.ts +0 -21
- package/dist/plugin-sdk/src/agents/tool-images.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/tool-loop-detection.d.ts +0 -55
- package/dist/plugin-sdk/src/agents/tool-mutation.d.ts +0 -14
- package/dist/plugin-sdk/src/agents/tool-policy-match.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/tool-policy-pipeline.d.ts +0 -32
- package/dist/plugin-sdk/src/agents/tool-policy-shared.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/tool-policy.d.ts +0 -35
- package/dist/plugin-sdk/src/agents/tool-summaries.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/tools/agent-step.d.ts +0 -23
- package/dist/plugin-sdk/src/agents/tools/agents-list-tool.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/tools/browser-tool.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/tools/browser-tool.schema.d.ts +0 -50
- package/dist/plugin-sdk/src/agents/tools/canvas-tool.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/tools/common.d.ts +0 -86
- package/dist/plugin-sdk/src/agents/tools/cron-tool.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/tools/diff-view-tool.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/tools/discord-actions-guild.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/tools/discord-actions-messaging.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/tools/discord-actions-moderation-shared.d.ts +0 -13
- package/dist/plugin-sdk/src/agents/tools/discord-actions-moderation.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/tools/discord-actions-presence.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/tools/discord-actions.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/tools/gateway-tool.d.ts +0 -14
- package/dist/plugin-sdk/src/agents/tools/gateway.d.ts +0 -20
- package/dist/plugin-sdk/src/agents/tools/image-tool.d.ts +0 -37
- package/dist/plugin-sdk/src/agents/tools/image-tool.helpers.d.ts +0 -21
- package/dist/plugin-sdk/src/agents/tools/marketplace-offer-draft-tool.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/tools/memory-tool.d.ts +0 -10
- package/dist/plugin-sdk/src/agents/tools/message-tool.d.ts +0 -26
- package/dist/plugin-sdk/src/agents/tools/mining-tool.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/tools/nodes-tool.d.ts +0 -13
- package/dist/plugin-sdk/src/agents/tools/nodes-utils.d.ts +0 -13
- package/dist/plugin-sdk/src/agents/tools/session-status-tool.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/tools/sessions-access.d.ts +0 -42
- package/dist/plugin-sdk/src/agents/tools/sessions-announce-target.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/tools/sessions-helpers.d.ts +0 -54
- package/dist/plugin-sdk/src/agents/tools/sessions-history-tool.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/tools/sessions-list-tool.d.ts +0 -11
- package/dist/plugin-sdk/src/agents/tools/sessions-resolution.d.ts +0 -67
- package/dist/plugin-sdk/src/agents/tools/sessions-send-helpers.d.ts +0 -34
- package/dist/plugin-sdk/src/agents/tools/sessions-send-tool.a2a.d.ts +0 -20
- package/dist/plugin-sdk/src/agents/tools/sessions-send-tool.d.ts +0 -13
- package/dist/plugin-sdk/src/agents/tools/sessions-spawn-tool.d.ts +0 -16
- package/dist/plugin-sdk/src/agents/tools/slack-actions.d.ts +0 -15
- package/dist/plugin-sdk/src/agents/tools/subagents-tool.d.ts +0 -4
- package/dist/plugin-sdk/src/agents/tools/telegram-actions.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/tools/tts-tool.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/tools/wallet-action-tool.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/tools/wallet-skill-policy.d.ts +0 -39
- package/dist/plugin-sdk/src/agents/tools/wallet-tool.d.ts +0 -9
- package/dist/plugin-sdk/src/agents/tools/web-fetch-utils.d.ts +0 -18
- package/dist/plugin-sdk/src/agents/tools/web-fetch-visibility.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/tools/web-fetch.d.ts +0 -25
- package/dist/plugin-sdk/src/agents/tools/web-guarded-fetch.d.ts +0 -12
- package/dist/plugin-sdk/src/agents/tools/web-search.d.ts +0 -148
- package/dist/plugin-sdk/src/agents/tools/web-shared.d.ts +0 -24
- package/dist/plugin-sdk/src/agents/tools/web-tools.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/tools/whatsapp-actions.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/tools/whatsapp-target-auth.d.ts +0 -10
- package/dist/plugin-sdk/src/agents/tools-effective-inventory.d.ts +0 -49
- package/dist/plugin-sdk/src/agents/trace-base.d.ts +0 -10
- package/dist/plugin-sdk/src/agents/transcript-policy.d.ts +0 -25
- package/dist/plugin-sdk/src/agents/usage.d.ts +0 -65
- package/dist/plugin-sdk/src/agents/venice-models.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/volc-models.shared.d.ts +0 -90
- package/dist/plugin-sdk/src/agents/workspace-dir.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/workspace-dirs.d.ts +0 -2
- package/dist/plugin-sdk/src/agents/workspace-run.d.ts +0 -18
- package/dist/plugin-sdk/src/agents/workspace-templates.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/workspace.d.ts +0 -45
- package/dist/plugin-sdk/src/auto-reply/chunk.d.ts +0 -45
- package/dist/plugin-sdk/src/auto-reply/command-auth.d.ts +0 -17
- package/dist/plugin-sdk/src/auto-reply/command-detection.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/commands-args.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/commands-registry.d.ts +0 -55
- package/dist/plugin-sdk/src/auto-reply/commands-registry.data.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/commands-registry.types.d.ts +0 -66
- package/dist/plugin-sdk/src/auto-reply/dispatch.d.ts +0 -32
- package/dist/plugin-sdk/src/auto-reply/envelope.d.ts +0 -58
- package/dist/plugin-sdk/src/auto-reply/fallback-state.d.ts +0 -55
- package/dist/plugin-sdk/src/auto-reply/group-activation.d.ts +0 -6
- package/dist/plugin-sdk/src/auto-reply/heartbeat-reply-payload.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/heartbeat.d.ts +0 -26
- package/dist/plugin-sdk/src/auto-reply/inbound-debounce.d.ts +0 -17
- package/dist/plugin-sdk/src/auto-reply/media-note.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/model-runtime.d.ts +0 -17
- package/dist/plugin-sdk/src/auto-reply/model.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/reply/abort-cutoff.d.ts +0 -28
- package/dist/plugin-sdk/src/auto-reply/reply/abort.d.ts +0 -33
- package/dist/plugin-sdk/src/auto-reply/reply/acp-projector.d.ts +0 -15
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-execution.d.ts +0 -59
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-helpers.d.ts +0 -15
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-memory.d.ts +0 -20
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-payloads.d.ts +0 -27
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-utils.d.ts +0 -148
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner.d.ts +0 -38
- package/dist/plugin-sdk/src/auto-reply/reply/bash-command.d.ts +0 -19
- package/dist/plugin-sdk/src/auto-reply/reply/block-reply-coalescer.d.ts +0 -15
- package/dist/plugin-sdk/src/auto-reply/reply/block-reply-pipeline.d.ts +0 -31
- package/dist/plugin-sdk/src/auto-reply/reply/block-streaming.d.ts +0 -36
- package/dist/plugin-sdk/src/auto-reply/reply/body.d.ts +0 -10
- package/dist/plugin-sdk/src/auto-reply/reply/command-gates.d.ts +0 -18
- package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/context.d.ts +0 -12
- package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/diagnostics.d.ts +0 -4
- package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/lifecycle.d.ts +0 -5
- package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/runtime-options.d.ts +0 -9
- package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/shared.d.ts +0 -97
- package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/targets.d.ts +0 -12
- package/dist/plugin-sdk/src/auto-reply/reply/commands-acp.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/commands-allowlist.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/commands-approve.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/commands-bash.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/commands-compact.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/commands-config.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-context-report.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-context.d.ts +0 -12
- package/dist/plugin-sdk/src/auto-reply/reply/commands-control.d.ts +0 -5
- package/dist/plugin-sdk/src/auto-reply/reply/commands-core.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/commands-export-session.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-info.d.ts +0 -11
- package/dist/plugin-sdk/src/auto-reply/reply/commands-models.d.ts +0 -36
- package/dist/plugin-sdk/src/auto-reply/reply/commands-plugin.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/commands-session-abort.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-session-store.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/commands-session.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/reply/commands-setunset-standard.d.ts +0 -10
- package/dist/plugin-sdk/src/auto-reply/reply/commands-setunset.d.ts +0 -34
- package/dist/plugin-sdk/src/auto-reply/reply/commands-slash-parse.d.ts +0 -24
- package/dist/plugin-sdk/src/auto-reply/reply/commands-status.d.ts +0 -26
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-agents.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-focus.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-help.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-info.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-kill.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-list.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-log.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-send.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-spawn.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-unfocus.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/shared.d.ts +0 -81
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents.d.ts +0 -4
- package/dist/plugin-sdk/src/auto-reply/reply/commands-system-prompt.d.ts +0 -14
- package/dist/plugin-sdk/src/auto-reply/reply/commands-tts.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/commands-types.d.ts +0 -63
- package/dist/plugin-sdk/src/auto-reply/reply/commands.d.ts +0 -4
- package/dist/plugin-sdk/src/auto-reply/reply/config-commands.d.ts +0 -15
- package/dist/plugin-sdk/src/auto-reply/reply/config-value.d.ts +0 -4
- package/dist/plugin-sdk/src/auto-reply/reply/debug-commands.d.ts +0 -16
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.auth.d.ts +0 -19
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.d.ts +0 -6
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.fast-lane.d.ts +0 -7
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.impl.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.levels.d.ts +0 -20
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.model-picker.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.model.d.ts +0 -44
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.params.d.ts +0 -51
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.parse.d.ts +0 -62
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.persist.d.ts +0 -37
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.queue-validation.d.ts +0 -10
- package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.shared.d.ts +0 -28
- package/dist/plugin-sdk/src/auto-reply/reply/directive-parsing.d.ts +0 -5
- package/dist/plugin-sdk/src/auto-reply/reply/directives.d.ts +0 -38
- package/dist/plugin-sdk/src/auto-reply/reply/dispatch-acp.d.ts +0 -30
- package/dist/plugin-sdk/src/auto-reply/reply/dispatch-from-config.d.ts +0 -16
- package/dist/plugin-sdk/src/auto-reply/reply/dispatcher-registry.d.ts +0 -24
- package/dist/plugin-sdk/src/auto-reply/reply/elevated-allowlist-matcher.d.ts +0 -20
- package/dist/plugin-sdk/src/auto-reply/reply/elevated-unavailable.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/reply/exec/directive.d.ts +0 -20
- package/dist/plugin-sdk/src/auto-reply/reply/exec.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/followup-runner.d.ts +0 -16
- package/dist/plugin-sdk/src/auto-reply/reply/get-reply-directives-apply.d.ts +0 -64
- package/dist/plugin-sdk/src/auto-reply/reply/get-reply-directives-utils.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/get-reply-directives.d.ts +0 -92
- package/dist/plugin-sdk/src/auto-reply/reply/get-reply-inline-actions.d.ts +0 -59
- package/dist/plugin-sdk/src/auto-reply/reply/get-reply-run.d.ts +0 -69
- package/dist/plugin-sdk/src/auto-reply/reply/get-reply.d.ts +0 -4
- package/dist/plugin-sdk/src/auto-reply/reply/groups.d.ts +0 -26
- package/dist/plugin-sdk/src/auto-reply/reply/history.d.ts +0 -72
- package/dist/plugin-sdk/src/auto-reply/reply/inbound-context.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/reply/inbound-dedupe.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/reply/inbound-meta.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/inbound-text.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/line-directives.d.ts +0 -22
- package/dist/plugin-sdk/src/auto-reply/reply/memory-flush.d.ts +0 -28
- package/dist/plugin-sdk/src/auto-reply/reply/mentions.d.ts +0 -19
- package/dist/plugin-sdk/src/auto-reply/reply/model-selection.d.ts +0 -67
- package/dist/plugin-sdk/src/auto-reply/reply/normalize-reply.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/origin-routing.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/post-compaction-audit.d.ts +0 -26
- package/dist/plugin-sdk/src/auto-reply/reply/post-compaction-context.d.ts +0 -12
- package/dist/plugin-sdk/src/auto-reply/reply/provider-dispatcher.d.ts +0 -19
- package/dist/plugin-sdk/src/auto-reply/reply/queue/cleanup.d.ts +0 -11
- package/dist/plugin-sdk/src/auto-reply/reply/queue/directive.d.ts +0 -15
- package/dist/plugin-sdk/src/auto-reply/reply/queue/drain.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/queue/enqueue.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/queue/normalize.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/queue/settings.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/queue/state.d.ts +0 -20
- package/dist/plugin-sdk/src/auto-reply/reply/queue/types.d.ts +0 -85
- package/dist/plugin-sdk/src/auto-reply/reply/queue-policy.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/reply/queue.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/reply/reply-delivery.d.ts +0 -27
- package/dist/plugin-sdk/src/auto-reply/reply/reply-directives.d.ts +0 -14
- package/dist/plugin-sdk/src/auto-reply/reply/reply-dispatcher.d.ts +0 -54
- package/dist/plugin-sdk/src/auto-reply/reply/reply-elevated.d.ts +0 -16
- package/dist/plugin-sdk/src/auto-reply/reply/reply-inline.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/reply/reply-payloads.d.ts +0 -27
- package/dist/plugin-sdk/src/auto-reply/reply/reply-reference.d.ts +0 -22
- package/dist/plugin-sdk/src/auto-reply/reply/reply-tags.d.ts +0 -6
- package/dist/plugin-sdk/src/auto-reply/reply/reply-threading.d.ts +0 -9
- package/dist/plugin-sdk/src/auto-reply/reply/response-prefix-template.d.ts +0 -51
- package/dist/plugin-sdk/src/auto-reply/reply/route-reply.d.ts +0 -56
- package/dist/plugin-sdk/src/auto-reply/reply/session-reset-model.d.ts +0 -24
- package/dist/plugin-sdk/src/auto-reply/reply/session-reset-prompt.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/session-run-accounting.d.ts +0 -12
- package/dist/plugin-sdk/src/auto-reply/reply/session-updates.d.ts +0 -34
- package/dist/plugin-sdk/src/auto-reply/reply/session-usage.d.ts +0 -21
- package/dist/plugin-sdk/src/auto-reply/reply/session.d.ts +0 -26
- package/dist/plugin-sdk/src/auto-reply/reply/stage-sandbox-media.d.ts +0 -9
- package/dist/plugin-sdk/src/auto-reply/reply/streaming-directives.d.ts +0 -10
- package/dist/plugin-sdk/src/auto-reply/reply/strip-inbound-meta.d.ts +0 -27
- package/dist/plugin-sdk/src/auto-reply/reply/subagents-utils.d.ts +0 -27
- package/dist/plugin-sdk/src/auto-reply/reply/typing-mode.d.ts +0 -30
- package/dist/plugin-sdk/src/auto-reply/reply/typing-policy.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/typing.d.ts +0 -18
- package/dist/plugin-sdk/src/auto-reply/reply/untrusted-context.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply.d.ts +0 -6
- package/dist/plugin-sdk/src/auto-reply/send-policy.d.ts +0 -6
- package/dist/plugin-sdk/src/auto-reply/skill-commands.d.ts +0 -19
- package/dist/plugin-sdk/src/auto-reply/status.d.ts +0 -60
- package/dist/plugin-sdk/src/auto-reply/templating.d.ts +0 -161
- package/dist/plugin-sdk/src/auto-reply/thinking.d.ts +0 -16
- package/dist/plugin-sdk/src/auto-reply/tokens.d.ts +0 -4
- package/dist/plugin-sdk/src/auto-reply/tool-meta.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/types.d.ts +0 -85
- package/dist/plugin-sdk/src/brand.d.ts +0 -6
- package/dist/plugin-sdk/src/browser/bridge-auth-registry.d.ts +0 -8
- package/dist/plugin-sdk/src/browser/bridge-server.d.ts +0 -19
- package/dist/plugin-sdk/src/browser/cdp.d.ts +0 -125
- package/dist/plugin-sdk/src/browser/cdp.helpers.d.ts +0 -13
- package/dist/plugin-sdk/src/browser/chrome.d.ts +0 -20
- package/dist/plugin-sdk/src/browser/chrome.executables.d.ts +0 -9
- package/dist/plugin-sdk/src/browser/chrome.profile-decoration.d.ts +0 -10
- package/dist/plugin-sdk/src/browser/client-actions-core.d.ts +0 -142
- package/dist/plugin-sdk/src/browser/client-actions-observe.d.ts +0 -68
- package/dist/plugin-sdk/src/browser/client-actions-state.d.ts +0 -90
- package/dist/plugin-sdk/src/browser/client-actions-types.d.ts +0 -18
- package/dist/plugin-sdk/src/browser/client-actions-url.d.ts +0 -2
- package/dist/plugin-sdk/src/browser/client-actions.d.ts +0 -4
- package/dist/plugin-sdk/src/browser/client-fetch.d.ts +0 -20
- package/dist/plugin-sdk/src/browser/client.d.ts +0 -147
- package/dist/plugin-sdk/src/browser/config.d.ts +0 -43
- package/dist/plugin-sdk/src/browser/constants.d.ts +0 -8
- package/dist/plugin-sdk/src/browser/control-auth.d.ts +0 -13
- package/dist/plugin-sdk/src/browser/control-service.d.ts +0 -5
- package/dist/plugin-sdk/src/browser/csrf.d.ts +0 -8
- package/dist/plugin-sdk/src/browser/extension-relay-auth.d.ts +0 -8
- package/dist/plugin-sdk/src/browser/extension-relay.d.ts +0 -15
- package/dist/plugin-sdk/src/browser/form-fields.d.ts +0 -8
- package/dist/plugin-sdk/src/browser/http-auth.d.ts +0 -5
- package/dist/plugin-sdk/src/browser/navigation-guard.d.ts +0 -21
- package/dist/plugin-sdk/src/browser/paths.d.ts +0 -61
- package/dist/plugin-sdk/src/browser/profiles-service.d.ts +0 -25
- package/dist/plugin-sdk/src/browser/profiles.d.ts +0 -30
- package/dist/plugin-sdk/src/browser/proxy-files.d.ts +0 -7
- package/dist/plugin-sdk/src/browser/pw-ai-module.d.ts +0 -6
- package/dist/plugin-sdk/src/browser/pw-ai-state.d.ts +0 -2
- package/dist/plugin-sdk/src/browser/pw-ai.d.ts +0 -2
- package/dist/plugin-sdk/src/browser/pw-role-snapshot.d.ts +0 -35
- package/dist/plugin-sdk/src/browser/pw-session.d.ts +0 -162
- package/dist/plugin-sdk/src/browser/pw-tools-core.activity.d.ts +0 -21
- package/dist/plugin-sdk/src/browser/pw-tools-core.d.ts +0 -8
- package/dist/plugin-sdk/src/browser/pw-tools-core.downloads.d.ts +0 -34
- package/dist/plugin-sdk/src/browser/pw-tools-core.interactions.d.ts +0 -114
- package/dist/plugin-sdk/src/browser/pw-tools-core.responses.d.ts +0 -13
- package/dist/plugin-sdk/src/browser/pw-tools-core.shared.d.ts +0 -6
- package/dist/plugin-sdk/src/browser/pw-tools-core.snapshot.d.ts +0 -66
- package/dist/plugin-sdk/src/browser/pw-tools-core.state.d.ts +0 -46
- package/dist/plugin-sdk/src/browser/pw-tools-core.storage.d.ts +0 -47
- package/dist/plugin-sdk/src/browser/pw-tools-core.trace.d.ts +0 -12
- package/dist/plugin-sdk/src/browser/resolved-config-refresh.d.ts +0 -12
- package/dist/plugin-sdk/src/browser/routes/agent.act.d.ts +0 -3
- package/dist/plugin-sdk/src/browser/routes/agent.act.download.d.ts +0 -3
- package/dist/plugin-sdk/src/browser/routes/agent.act.hooks.d.ts +0 -3
- package/dist/plugin-sdk/src/browser/routes/agent.act.shared.d.ts +0 -10
- package/dist/plugin-sdk/src/browser/routes/agent.d.ts +0 -3
- package/dist/plugin-sdk/src/browser/routes/agent.debug.d.ts +0 -3
- package/dist/plugin-sdk/src/browser/routes/agent.shared.d.ts +0 -37
- package/dist/plugin-sdk/src/browser/routes/agent.snapshot.d.ts +0 -3
- package/dist/plugin-sdk/src/browser/routes/agent.storage.d.ts +0 -14
- package/dist/plugin-sdk/src/browser/routes/basic.d.ts +0 -3
- package/dist/plugin-sdk/src/browser/routes/dispatcher.d.ts +0 -16
- package/dist/plugin-sdk/src/browser/routes/index.d.ts +0 -3
- package/dist/plugin-sdk/src/browser/routes/output-paths.d.ts +0 -10
- package/dist/plugin-sdk/src/browser/routes/path-output.d.ts +0 -1
- package/dist/plugin-sdk/src/browser/routes/tabs.d.ts +0 -3
- package/dist/plugin-sdk/src/browser/routes/types.d.ts +0 -20
- package/dist/plugin-sdk/src/browser/routes/utils.d.ts +0 -15
- package/dist/plugin-sdk/src/browser/runtime-dependency.d.ts +0 -3
- package/dist/plugin-sdk/src/browser/screenshot.d.ts +0 -9
- package/dist/plugin-sdk/src/browser/server-context.d.ts +0 -4
- package/dist/plugin-sdk/src/browser/server-context.types.d.ts +0 -65
- package/dist/plugin-sdk/src/browser/server-lifecycle.d.ts +0 -10
- package/dist/plugin-sdk/src/browser/server-middleware.d.ts +0 -6
- package/dist/plugin-sdk/src/browser/target-id.d.ts +0 -11
- package/dist/plugin-sdk/src/browser/trash.d.ts +0 -1
- package/dist/plugin-sdk/src/canvas-host/a2ui.d.ts +0 -6
- package/dist/plugin-sdk/src/canvas-host/file-resolver.d.ts +0 -3
- package/dist/plugin-sdk/src/canvas-host/server.d.ts +0 -36
- package/dist/plugin-sdk/src/channel-web.d.ts +0 -6
- package/dist/plugin-sdk/src/channels/account-snapshot-fields.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/account-summary.d.ts +0 -17
- package/dist/plugin-sdk/src/channels/ack-reactions.d.ts +0 -29
- package/dist/plugin-sdk/src/channels/allow-from.d.ts +0 -16
- package/dist/plugin-sdk/src/channels/allowlist-match.d.ts +0 -16
- package/dist/plugin-sdk/src/channels/allowlists/resolve-utils.d.ts +0 -33
- package/dist/plugin-sdk/src/channels/channel-config.d.ts +0 -39
- package/dist/plugin-sdk/src/channels/chat-type.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/command-gating.d.ts +0 -20
- package/dist/plugin-sdk/src/channels/conversation-label.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/dock.d.ts +0 -25
- package/dist/plugin-sdk/src/channels/draft-stream-controls.d.ts +0 -54
- package/dist/plugin-sdk/src/channels/draft-stream-loop.d.ts +0 -13
- package/dist/plugin-sdk/src/channels/ids.d.ts +0 -9
- package/dist/plugin-sdk/src/channels/location.d.ts +0 -21
- package/dist/plugin-sdk/src/channels/logging.d.ts +0 -20
- package/dist/plugin-sdk/src/channels/mention-gating.d.ts +0 -27
- package/dist/plugin-sdk/src/channels/model-overrides.d.ts +0 -18
- package/dist/plugin-sdk/src/channels/plugins/account-action-gate.d.ts +0 -5
- package/dist/plugin-sdk/src/channels/plugins/account-helpers.d.ts +0 -6
- package/dist/plugin-sdk/src/channels/plugins/actions/discord/handle-action.d.ts +0 -3
- package/dist/plugin-sdk/src/channels/plugins/actions/discord/handle-action.guild-admin.d.ts +0 -9
- package/dist/plugin-sdk/src/channels/plugins/actions/discord.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/actions/shared.d.ts +0 -7
- package/dist/plugin-sdk/src/channels/plugins/actions/signal.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/actions/telegram.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/agent-tools/whatsapp-login.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/allowlist-match.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/bluebubbles-actions.d.ts +0 -48
- package/dist/plugin-sdk/src/channels/plugins/catalog.d.ts +0 -50
- package/dist/plugin-sdk/src/channels/plugins/channel-config.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/config-helpers.d.ts +0 -14
- package/dist/plugin-sdk/src/channels/plugins/config-schema.d.ts +0 -3
- package/dist/plugin-sdk/src/channels/plugins/config-writes.d.ts +0 -7
- package/dist/plugin-sdk/src/channels/plugins/directory-config.d.ts +0 -16
- package/dist/plugin-sdk/src/channels/plugins/group-mentions.d.ts +0 -18
- package/dist/plugin-sdk/src/channels/plugins/helpers.d.ts +0 -8
- package/dist/plugin-sdk/src/channels/plugins/index.d.ts +0 -8
- package/dist/plugin-sdk/src/channels/plugins/media-limits.d.ts +0 -9
- package/dist/plugin-sdk/src/channels/plugins/media-payload.d.ts +0 -15
- package/dist/plugin-sdk/src/channels/plugins/message-action-names.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/message-actions.d.ts +0 -15
- package/dist/plugin-sdk/src/channels/plugins/normalize/discord.d.ts +0 -14
- package/dist/plugin-sdk/src/channels/plugins/normalize/imessage.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/normalize/shared.d.ts +0 -6
- package/dist/plugin-sdk/src/channels/plugins/normalize/signal.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/normalize/slack.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/normalize/telegram.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/normalize/whatsapp.d.ts +0 -3
- package/dist/plugin-sdk/src/channels/plugins/onboarding/channel-access-configure.d.ts +0 -21
- package/dist/plugin-sdk/src/channels/plugins/onboarding/channel-access.d.ts +0 -31
- package/dist/plugin-sdk/src/channels/plugins/onboarding/discord.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/onboarding/helpers.d.ts +0 -177
- package/dist/plugin-sdk/src/channels/plugins/onboarding/imessage.d.ts +0 -6
- package/dist/plugin-sdk/src/channels/plugins/onboarding/signal.d.ts +0 -7
- package/dist/plugin-sdk/src/channels/plugins/onboarding/slack.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/onboarding/telegram.d.ts +0 -4
- package/dist/plugin-sdk/src/channels/plugins/onboarding/whatsapp.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/onboarding-types.d.ts +0 -149
- package/dist/plugin-sdk/src/channels/plugins/outbound/load.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/pairing-message.d.ts +0 -1
- package/dist/plugin-sdk/src/channels/plugins/pairing.d.ts +0 -16
- package/dist/plugin-sdk/src/channels/plugins/registry-loader.d.ts +0 -5
- package/dist/plugin-sdk/src/channels/plugins/setup-helpers.d.ts +0 -21
- package/dist/plugin-sdk/src/channels/plugins/status-issues/bluebubbles.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/status-issues/discord.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/status-issues/shared.d.ts +0 -29
- package/dist/plugin-sdk/src/channels/plugins/status-issues/telegram.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/status-issues/whatsapp.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/types.adapters.d.ts +0 -294
- package/dist/plugin-sdk/src/channels/plugins/types.core.d.ts +0 -357
- package/dist/plugin-sdk/src/channels/plugins/types.d.ts +0 -6
- package/dist/plugin-sdk/src/channels/plugins/types.plugin.d.ts +0 -54
- package/dist/plugin-sdk/src/channels/plugins/whatsapp-heartbeat.d.ts +0 -11
- package/dist/plugin-sdk/src/channels/plugins/whatsapp-shared.d.ts +0 -5
- package/dist/plugin-sdk/src/channels/registry.d.ts +0 -12
- package/dist/plugin-sdk/src/channels/reply-prefix.d.ts +0 -24
- package/dist/plugin-sdk/src/channels/sender-label.d.ts +0 -9
- package/dist/plugin-sdk/src/channels/session.d.ts +0 -18
- package/dist/plugin-sdk/src/channels/status-reactions.d.ts +0 -62
- package/dist/plugin-sdk/src/channels/targets.d.ts +0 -42
- package/dist/plugin-sdk/src/channels/telegram/allow-from.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/telegram/api.d.ts +0 -5
- package/dist/plugin-sdk/src/channels/thread-bindings-messages.d.ts +0 -19
- package/dist/plugin-sdk/src/channels/thread-bindings-policy.d.ts +0 -68
- package/dist/plugin-sdk/src/channels/typing-lifecycle.d.ts +0 -12
- package/dist/plugin-sdk/src/channels/typing-start-guard.d.ts +0 -13
- package/dist/plugin-sdk/src/channels/typing.d.ts +0 -18
- package/dist/plugin-sdk/src/channels/web/index.d.ts +0 -1
- package/dist/plugin-sdk/src/cli/argv.d.ts +0 -17
- package/dist/plugin-sdk/src/cli/banner.d.ts +0 -11
- package/dist/plugin-sdk/src/cli/cli-name.d.ts +0 -3
- package/dist/plugin-sdk/src/cli/cli-utils.d.ts +0 -19
- package/dist/plugin-sdk/src/cli/command-format.d.ts +0 -1
- package/dist/plugin-sdk/src/cli/deps.d.ts +0 -18
- package/dist/plugin-sdk/src/cli/help-format.d.ts +0 -5
- package/dist/plugin-sdk/src/cli/memory-cli.d.ts +0 -21
- package/dist/plugin-sdk/src/cli/nodes-camera.d.ts +0 -38
- package/dist/plugin-sdk/src/cli/nodes-canvas.d.ts +0 -10
- package/dist/plugin-sdk/src/cli/nodes-media-utils.d.ts +0 -13
- package/dist/plugin-sdk/src/cli/nodes-run.d.ts +0 -3
- package/dist/plugin-sdk/src/cli/nodes-screen.d.ts +0 -18
- package/dist/plugin-sdk/src/cli/outbound-send-deps.d.ts +0 -4
- package/dist/plugin-sdk/src/cli/outbound-send-mapping.d.ts +0 -10
- package/dist/plugin-sdk/src/cli/parse-bytes.d.ts +0 -4
- package/dist/plugin-sdk/src/cli/parse-duration.d.ts +0 -4
- package/dist/plugin-sdk/src/cli/parse-timeout.d.ts +0 -1
- package/dist/plugin-sdk/src/cli/profile-utils.d.ts +0 -2
- package/dist/plugin-sdk/src/cli/progress.d.ts +0 -24
- package/dist/plugin-sdk/src/cli/prompt.d.ts +0 -1
- package/dist/plugin-sdk/src/cli/wait.d.ts +0 -1
- package/dist/plugin-sdk/src/commands/agent/attempt.d.ts +0 -39
- package/dist/plugin-sdk/src/commands/agent/delivery.d.ts +0 -21
- package/dist/plugin-sdk/src/commands/agent/lifecycle.d.ts +0 -17
- package/dist/plugin-sdk/src/commands/agent/run-context.d.ts +0 -2
- package/dist/plugin-sdk/src/commands/agent/session-store.d.ts +0 -17
- package/dist/plugin-sdk/src/commands/agent/session.d.ts +0 -33
- package/dist/plugin-sdk/src/commands/agent/strict-agentic-contract.d.ts +0 -44
- package/dist/plugin-sdk/src/commands/agent/types.d.ts +0 -77
- package/dist/plugin-sdk/src/commands/agent.d.ts +0 -7
- package/dist/plugin-sdk/src/commands/agents.config.d.ts +0 -42
- package/dist/plugin-sdk/src/commands/channel-account-context.d.ts +0 -10
- package/dist/plugin-sdk/src/commands/cleanup-utils.d.ts +0 -37
- package/dist/plugin-sdk/src/commands/daemon-runtime.d.ts +0 -8
- package/dist/plugin-sdk/src/commands/gateway-presence.d.ts +0 -7
- package/dist/plugin-sdk/src/commands/health.d.ts +0 -74
- package/dist/plugin-sdk/src/commands/hosted-dashboard-probe.d.ts +0 -40
- package/dist/plugin-sdk/src/commands/oauth-flow.d.ts +0 -21
- package/dist/plugin-sdk/src/commands/onboard-helpers.d.ts +0 -84
- package/dist/plugin-sdk/src/commands/onboard-types.d.ts +0 -119
- package/dist/plugin-sdk/src/commands/signal-install.d.ts +0 -30
- package/dist/plugin-sdk/src/commands/status-all/agents.d.ts +0 -16
- package/dist/plugin-sdk/src/commands/status-all/channels.d.ts +0 -19
- package/dist/plugin-sdk/src/commands/status-all/diagnosis.d.ts +0 -62
- package/dist/plugin-sdk/src/commands/status-all/format.d.ts +0 -7
- package/dist/plugin-sdk/src/commands/status-all/gateway.d.ts +0 -5
- package/dist/plugin-sdk/src/commands/status-all/report-lines.d.ts +0 -44
- package/dist/plugin-sdk/src/commands/status-all.d.ts +0 -4
- package/dist/plugin-sdk/src/commands/status.acpx-bridge.d.ts +0 -19
- package/dist/plugin-sdk/src/commands/status.agent-local.d.ts +0 -16
- package/dist/plugin-sdk/src/commands/status.command.d.ts +0 -9
- package/dist/plugin-sdk/src/commands/status.d.ts +0 -3
- package/dist/plugin-sdk/src/commands/status.daemon.d.ts +0 -9
- package/dist/plugin-sdk/src/commands/status.format.d.ts +0 -12
- package/dist/plugin-sdk/src/commands/status.gateway-probe.d.ts +0 -6
- package/dist/plugin-sdk/src/commands/status.link-channel.d.ts +0 -10
- package/dist/plugin-sdk/src/commands/status.scan.d.ts +0 -46
- package/dist/plugin-sdk/src/commands/status.strict-agentic.d.ts +0 -18
- package/dist/plugin-sdk/src/commands/status.summary.d.ts +0 -5
- package/dist/plugin-sdk/src/commands/status.types.d.ts +0 -67
- package/dist/plugin-sdk/src/commands/status.update.d.ts +0 -23
- package/dist/plugin-sdk/src/commands/text-format.d.ts +0 -1
- package/dist/plugin-sdk/src/commands/wallet.d.ts +0 -300
- package/dist/plugin-sdk/src/commands/xai-oauth.d.ts +0 -17
- package/dist/plugin-sdk/src/config/agent-dirs.d.ts +0 -14
- package/dist/plugin-sdk/src/config/agent-limits.d.ts +0 -6
- package/dist/plugin-sdk/src/config/backup-rotation.d.ts +0 -5
- package/dist/plugin-sdk/src/config/cache-utils.d.ts +0 -6
- package/dist/plugin-sdk/src/config/channel-capabilities.d.ts +0 -6
- package/dist/plugin-sdk/src/config/commands.d.ts +0 -25
- package/dist/plugin-sdk/src/config/config-paths.d.ts +0 -10
- package/dist/plugin-sdk/src/config/config.d.ts +0 -7
- package/dist/plugin-sdk/src/config/dangerous-name-matching.d.ts +0 -12
- package/dist/plugin-sdk/src/config/defaults.d.ts +0 -19
- package/dist/plugin-sdk/src/config/discord-preview-streaming.d.ts +0 -25
- package/dist/plugin-sdk/src/config/env-preserve.d.ts +0 -10
- package/dist/plugin-sdk/src/config/env-substitution.d.ts +0 -36
- package/dist/plugin-sdk/src/config/env-vars.d.ts +0 -6
- package/dist/plugin-sdk/src/config/group-policy.d.ts +0 -49
- package/dist/plugin-sdk/src/config/includes-scan.d.ts +0 -4
- package/dist/plugin-sdk/src/config/includes.d.ts +0 -43
- package/dist/plugin-sdk/src/config/io.d.ts +0 -63
- package/dist/plugin-sdk/src/config/legacy-migrate.d.ts +0 -5
- package/dist/plugin-sdk/src/config/legacy.d.ts +0 -6
- package/dist/plugin-sdk/src/config/legacy.migrations.d.ts +0 -1
- package/dist/plugin-sdk/src/config/legacy.migrations.part-1.d.ts +0 -2
- package/dist/plugin-sdk/src/config/legacy.migrations.part-2.d.ts +0 -2
- package/dist/plugin-sdk/src/config/legacy.migrations.part-3.d.ts +0 -2
- package/dist/plugin-sdk/src/config/legacy.rules.d.ts +0 -2
- package/dist/plugin-sdk/src/config/legacy.shared.d.ts +0 -19
- package/dist/plugin-sdk/src/config/markdown-tables.d.ts +0 -7
- package/dist/plugin-sdk/src/config/merge-config.d.ts +0 -7
- package/dist/plugin-sdk/src/config/merge-patch.d.ts +0 -5
- package/dist/plugin-sdk/src/config/model-input.d.ts +0 -11
- package/dist/plugin-sdk/src/config/normalize-exec-safe-bin.d.ts +0 -2
- package/dist/plugin-sdk/src/config/normalize-paths.d.ts +0 -8
- package/dist/plugin-sdk/src/config/paths.d.ts +0 -57
- package/dist/plugin-sdk/src/config/plugin-auto-enable.d.ts +0 -15
- package/dist/plugin-sdk/src/config/plugins-allowlist.d.ts +0 -12
- package/dist/plugin-sdk/src/config/port-defaults.d.ts +0 -13
- package/dist/plugin-sdk/src/config/prototype-keys.d.ts +0 -1
- package/dist/plugin-sdk/src/config/runtime-group-policy.d.ts +0 -56
- package/dist/plugin-sdk/src/config/runtime-overrides.d.ts +0 -15
- package/dist/plugin-sdk/src/config/sat-runtime-ids.d.ts +0 -23
- package/dist/plugin-sdk/src/config/sessions/artifacts.d.ts +0 -6
- package/dist/plugin-sdk/src/config/sessions/delivery-info.d.ts +0 -16
- package/dist/plugin-sdk/src/config/sessions/disk-budget.d.ts +0 -28
- package/dist/plugin-sdk/src/config/sessions/group.d.ts +0 -11
- package/dist/plugin-sdk/src/config/sessions/main-session.d.ts +0 -43
- package/dist/plugin-sdk/src/config/sessions/metadata.d.ts +0 -16
- package/dist/plugin-sdk/src/config/sessions/paths.d.ts +0 -21
- package/dist/plugin-sdk/src/config/sessions/reset.d.ts +0 -43
- package/dist/plugin-sdk/src/config/sessions/session-file.d.ts +0 -15
- package/dist/plugin-sdk/src/config/sessions/session-key.d.ts +0 -8
- package/dist/plugin-sdk/src/config/sessions/store.d.ts +0 -124
- package/dist/plugin-sdk/src/config/sessions/transcript.d.ts +0 -32
- package/dist/plugin-sdk/src/config/sessions/types.d.ts +0 -273
- package/dist/plugin-sdk/src/config/sessions.d.ts +0 -13
- package/dist/plugin-sdk/src/config/talk.d.ts +0 -22
- package/dist/plugin-sdk/src/config/telegram-custom-commands.d.ts +0 -24
- package/dist/plugin-sdk/src/config/types.acp.d.ts +0 -28
- package/dist/plugin-sdk/src/config/types.agent-defaults.d.ts +0 -322
- package/dist/plugin-sdk/src/config/types.agents-shared.d.ts +0 -53
- package/dist/plugin-sdk/src/config/types.agents.d.ts +0 -71
- package/dist/plugin-sdk/src/config/types.approvals.d.ts +0 -26
- package/dist/plugin-sdk/src/config/types.auth.d.ts +0 -34
- package/dist/plugin-sdk/src/config/types.base.d.ts +0 -227
- package/dist/plugin-sdk/src/config/types.browser.d.ts +0 -65
- package/dist/plugin-sdk/src/config/types.channel-messaging-common.d.ts +0 -44
- package/dist/plugin-sdk/src/config/types.channels.d.ts +0 -53
- package/dist/plugin-sdk/src/config/types.cron.d.ts +0 -26
- package/dist/plugin-sdk/src/config/types.d.ts +0 -35
- package/dist/plugin-sdk/src/config/types.discord.d.ts +0 -283
- package/dist/plugin-sdk/src/config/types.fased.d.ts +0 -134
- package/dist/plugin-sdk/src/config/types.federation.d.ts +0 -319
- package/dist/plugin-sdk/src/config/types.gateway.d.ts +0 -313
- package/dist/plugin-sdk/src/config/types.googlechat.d.ts +0 -110
- package/dist/plugin-sdk/src/config/types.hooks.d.ts +0 -141
- package/dist/plugin-sdk/src/config/types.imessage.d.ts +0 -77
- package/dist/plugin-sdk/src/config/types.installs.d.ts +0 -36
- package/dist/plugin-sdk/src/config/types.irc.d.ts +0 -54
- package/dist/plugin-sdk/src/config/types.mcp.d.ts +0 -5
- package/dist/plugin-sdk/src/config/types.memory.d.ts +0 -59
- package/dist/plugin-sdk/src/config/types.messages.d.ts +0 -151
- package/dist/plugin-sdk/src/config/types.models.d.ts +0 -70
- package/dist/plugin-sdk/src/config/types.msteams.d.ts +0 -110
- package/dist/plugin-sdk/src/config/types.node-host.d.ts +0 -10
- package/dist/plugin-sdk/src/config/types.plugins.d.ts +0 -48
- package/dist/plugin-sdk/src/config/types.queue.d.ts +0 -14
- package/dist/plugin-sdk/src/config/types.sandbox.d.ts +0 -97
- package/dist/plugin-sdk/src/config/types.secrets.d.ts +0 -67
- package/dist/plugin-sdk/src/config/types.signal.d.ts +0 -46
- package/dist/plugin-sdk/src/config/types.skills.d.ts +0 -47
- package/dist/plugin-sdk/src/config/types.slack.d.ts +0 -181
- package/dist/plugin-sdk/src/config/types.telegram.d.ts +0 -199
- package/dist/plugin-sdk/src/config/types.tools.d.ts +0 -637
- package/dist/plugin-sdk/src/config/types.tts.d.ts +0 -78
- package/dist/plugin-sdk/src/config/types.wallet.d.ts +0 -88
- package/dist/plugin-sdk/src/config/types.whatsapp.d.ts +0 -101
- package/dist/plugin-sdk/src/config/validation.d.ts +0 -37
- package/dist/plugin-sdk/src/config/version.d.ts +0 -9
- package/dist/plugin-sdk/src/config/zod-schema.agent-defaults.d.ts +0 -308
- package/dist/plugin-sdk/src/config/zod-schema.agent-model.d.ts +0 -24
- package/dist/plugin-sdk/src/config/zod-schema.agent-runtime.d.ts +0 -1439
- package/dist/plugin-sdk/src/config/zod-schema.agents.d.ts +0 -621
- package/dist/plugin-sdk/src/config/zod-schema.allowdeny.d.ts +0 -13
- package/dist/plugin-sdk/src/config/zod-schema.approvals.d.ts +0 -15
- package/dist/plugin-sdk/src/config/zod-schema.channels.d.ts +0 -6
- package/dist/plugin-sdk/src/config/zod-schema.core.d.ts +0 -926
- package/dist/plugin-sdk/src/config/zod-schema.d.ts +0 -4763
- package/dist/plugin-sdk/src/config/zod-schema.hooks.d.ts +0 -83
- package/dist/plugin-sdk/src/config/zod-schema.installs.d.ts +0 -38
- package/dist/plugin-sdk/src/config/zod-schema.providers-core.d.ts +0 -3785
- package/dist/plugin-sdk/src/config/zod-schema.providers-whatsapp.d.ts +0 -235
- package/dist/plugin-sdk/src/config/zod-schema.providers.d.ts +0 -2261
- package/dist/plugin-sdk/src/config/zod-schema.sensitive.d.ts +0 -2
- package/dist/plugin-sdk/src/config/zod-schema.session.d.ts +0 -237
- package/dist/plugin-sdk/src/context-engine/types.d.ts +0 -6
- package/dist/plugin-sdk/src/cron/access-block.d.ts +0 -22
- package/dist/plugin-sdk/src/cron/delivery.d.ts +0 -10
- package/dist/plugin-sdk/src/cron/graph-context.d.ts +0 -45
- package/dist/plugin-sdk/src/cron/legacy-delivery.d.ts +0 -3
- package/dist/plugin-sdk/src/cron/normalize.d.ts +0 -9
- package/dist/plugin-sdk/src/cron/parse.d.ts +0 -1
- package/dist/plugin-sdk/src/cron/payload-migration.d.ts +0 -3
- package/dist/plugin-sdk/src/cron/run-detail-format.d.ts +0 -28
- package/dist/plugin-sdk/src/cron/run-detail.d.ts +0 -95
- package/dist/plugin-sdk/src/cron/run-log.d.ts +0 -65
- package/dist/plugin-sdk/src/cron/schedule.d.ts +0 -2
- package/dist/plugin-sdk/src/cron/service/jobs.d.ts +0 -23
- package/dist/plugin-sdk/src/cron/service/locked.d.ts +0 -2
- package/dist/plugin-sdk/src/cron/service/normalize.d.ts +0 -18
- package/dist/plugin-sdk/src/cron/service/ops.d.ts +0 -152
- package/dist/plugin-sdk/src/cron/service/run-lease.d.ts +0 -15
- package/dist/plugin-sdk/src/cron/service/state.d.ts +0 -154
- package/dist/plugin-sdk/src/cron/service/store.d.ts +0 -9
- package/dist/plugin-sdk/src/cron/service/timeout-policy.d.ts +0 -13
- package/dist/plugin-sdk/src/cron/service/timer.d.ts +0 -80
- package/dist/plugin-sdk/src/cron/service.d.ts +0 -122
- package/dist/plugin-sdk/src/cron/session-reaper.d.ts +0 -35
- package/dist/plugin-sdk/src/cron/stagger.d.ts +0 -8
- package/dist/plugin-sdk/src/cron/store.d.ts +0 -6
- package/dist/plugin-sdk/src/cron/task-adaptive-routing.d.ts +0 -21
- package/dist/plugin-sdk/src/cron/task-evaluator.d.ts +0 -28
- package/dist/plugin-sdk/src/cron/task-model-roles.d.ts +0 -21
- package/dist/plugin-sdk/src/cron/task-planner.d.ts +0 -37
- package/dist/plugin-sdk/src/cron/task-run-queue.d.ts +0 -270
- package/dist/plugin-sdk/src/cron/trusted-sources.d.ts +0 -28
- package/dist/plugin-sdk/src/cron/types.d.ts +0 -673
- package/dist/plugin-sdk/src/cron/webhook-url.d.ts +0 -1
- package/dist/plugin-sdk/src/daemon/arg-split.d.ts +0 -4
- package/dist/plugin-sdk/src/daemon/cmd-argv.d.ts +0 -3
- package/dist/plugin-sdk/src/daemon/cmd-set.d.ts +0 -7
- package/dist/plugin-sdk/src/daemon/constants.d.ts +0 -63
- package/dist/plugin-sdk/src/daemon/diagnostics.d.ts +0 -1
- package/dist/plugin-sdk/src/daemon/exec-file.d.ts +0 -7
- package/dist/plugin-sdk/src/daemon/launchd-plist.d.ts +0 -15
- package/dist/plugin-sdk/src/daemon/launchd.d.ts +0 -49
- package/dist/plugin-sdk/src/daemon/node-service.d.ts +0 -2
- package/dist/plugin-sdk/src/daemon/output.d.ts +0 -8
- package/dist/plugin-sdk/src/daemon/paths.d.ts +0 -3
- package/dist/plugin-sdk/src/daemon/runtime-binary.d.ts +0 -2
- package/dist/plugin-sdk/src/daemon/runtime-parse.d.ts +0 -1
- package/dist/plugin-sdk/src/daemon/schtasks-exec.d.ts +0 -5
- package/dist/plugin-sdk/src/daemon/schtasks.d.ts +0 -18
- package/dist/plugin-sdk/src/daemon/service-runtime.d.ts +0 -13
- package/dist/plugin-sdk/src/daemon/service-types.d.ts +0 -32
- package/dist/plugin-sdk/src/daemon/service.d.ts +0 -16
- package/dist/plugin-sdk/src/daemon/systemd-linger.d.ts +0 -15
- package/dist/plugin-sdk/src/daemon/systemd-system.d.ts +0 -28
- package/dist/plugin-sdk/src/daemon/systemd-unit.d.ts +0 -7
- package/dist/plugin-sdk/src/daemon/systemd.d.ts +0 -32
- package/dist/plugin-sdk/src/discord/accounts.d.ts +0 -21
- package/dist/plugin-sdk/src/discord/api.d.ts +0 -11
- package/dist/plugin-sdk/src/discord/audit.d.ts +0 -29
- package/dist/plugin-sdk/src/discord/chunk.d.ts +0 -20
- package/dist/plugin-sdk/src/discord/client.d.ts +0 -21
- package/dist/plugin-sdk/src/discord/components-registry.d.ts +0 -16
- package/dist/plugin-sdk/src/discord/components.d.ts +0 -196
- package/dist/plugin-sdk/src/discord/directory-live.d.ts +0 -4
- package/dist/plugin-sdk/src/discord/draft-chunking.d.ts +0 -6
- package/dist/plugin-sdk/src/discord/draft-stream.d.ts +0 -21
- package/dist/plugin-sdk/src/discord/gateway-logging.d.ts +0 -8
- package/dist/plugin-sdk/src/discord/guilds.d.ts +0 -6
- package/dist/plugin-sdk/src/discord/monitor/agent-components.d.ts +0 -55
- package/dist/plugin-sdk/src/discord/monitor/allow-list.d.ts +0 -176
- package/dist/plugin-sdk/src/discord/monitor/commands.d.ts +0 -2
- package/dist/plugin-sdk/src/discord/monitor/exec-approvals.d.ts +0 -55
- package/dist/plugin-sdk/src/discord/monitor/format.d.ts +0 -13
- package/dist/plugin-sdk/src/discord/monitor/gateway-error-guard.d.ts +0 -6
- package/dist/plugin-sdk/src/discord/monitor/gateway-plugin.d.ts +0 -8
- package/dist/plugin-sdk/src/discord/monitor/gateway-registry.d.ts +0 -9
- package/dist/plugin-sdk/src/discord/monitor/listeners.d.ts +0 -50
- package/dist/plugin-sdk/src/discord/monitor/message-handler.d.ts +0 -5
- package/dist/plugin-sdk/src/discord/monitor/message-handler.preflight.d.ts +0 -14
- package/dist/plugin-sdk/src/discord/monitor/message-handler.preflight.types.d.ts +0 -96
- package/dist/plugin-sdk/src/discord/monitor/message-handler.process.d.ts +0 -2
- package/dist/plugin-sdk/src/discord/monitor/message-utils.d.ts +0 -44
- package/dist/plugin-sdk/src/discord/monitor/model-picker-preferences.d.ts +0 -18
- package/dist/plugin-sdk/src/discord/monitor/model-picker.d.ts +0 -117
- package/dist/plugin-sdk/src/discord/monitor/native-command.d.ts +0 -26
- package/dist/plugin-sdk/src/discord/monitor/presence-cache.d.ts +0 -9
- package/dist/plugin-sdk/src/discord/monitor/presence.d.ts +0 -5
- package/dist/plugin-sdk/src/discord/monitor/provider.allowlist.d.ts +0 -14
- package/dist/plugin-sdk/src/discord/monitor/provider.d.ts +0 -34
- package/dist/plugin-sdk/src/discord/monitor/provider.lifecycle.d.ts +0 -28
- package/dist/plugin-sdk/src/discord/monitor/reply-context.d.ts +0 -17
- package/dist/plugin-sdk/src/discord/monitor/reply-delivery.d.ts +0 -37
- package/dist/plugin-sdk/src/discord/monitor/rest-fetch.d.ts +0 -2
- package/dist/plugin-sdk/src/discord/monitor/sender-identity.d.ts +0 -31
- package/dist/plugin-sdk/src/discord/monitor/system-events.d.ts +0 -2
- package/dist/plugin-sdk/src/discord/monitor/thread-bindings.config.d.ts +0 -11
- package/dist/plugin-sdk/src/discord/monitor/thread-bindings.d.ts +0 -8
- package/dist/plugin-sdk/src/discord/monitor/thread-bindings.discord-api.d.ts +0 -36
- package/dist/plugin-sdk/src/discord/monitor/thread-bindings.lifecycle.d.ts +0 -46
- package/dist/plugin-sdk/src/discord/monitor/thread-bindings.manager.d.ts +0 -18
- package/dist/plugin-sdk/src/discord/monitor/thread-bindings.messages.d.ts +0 -1
- package/dist/plugin-sdk/src/discord/monitor/thread-bindings.persona.d.ts +0 -6
- package/dist/plugin-sdk/src/discord/monitor/thread-bindings.state.d.ts +0 -80
- package/dist/plugin-sdk/src/discord/monitor/thread-bindings.types.d.ts +0 -77
- package/dist/plugin-sdk/src/discord/monitor/threading.d.ts +0 -106
- package/dist/plugin-sdk/src/discord/monitor/typing.d.ts +0 -5
- package/dist/plugin-sdk/src/discord/monitor.d.ts +0 -10
- package/dist/plugin-sdk/src/discord/monitor.gateway.d.ts +0 -12
- package/dist/plugin-sdk/src/discord/pluralkit.d.ts +0 -26
- package/dist/plugin-sdk/src/discord/probe.d.ts +0 -28
- package/dist/plugin-sdk/src/discord/resolve-channels.d.ts +0 -15
- package/dist/plugin-sdk/src/discord/resolve-users.d.ts +0 -14
- package/dist/plugin-sdk/src/discord/send.channels.d.ts +0 -17
- package/dist/plugin-sdk/src/discord/send.components.d.ts +0 -17
- package/dist/plugin-sdk/src/discord/send.d.ts +0 -10
- package/dist/plugin-sdk/src/discord/send.emojis-stickers.d.ts +0 -4
- package/dist/plugin-sdk/src/discord/send.guild.d.ts +0 -24
- package/dist/plugin-sdk/src/discord/send.messages.d.ts +0 -20
- package/dist/plugin-sdk/src/discord/send.outbound.d.ts +0 -57
- package/dist/plugin-sdk/src/discord/send.permissions.d.ts +0 -20
- package/dist/plugin-sdk/src/discord/send.reactions.d.ts +0 -15
- package/dist/plugin-sdk/src/discord/send.shared.d.ts +0 -85
- package/dist/plugin-sdk/src/discord/send.types.d.ts +0 -144
- package/dist/plugin-sdk/src/discord/targets.d.ts +0 -18
- package/dist/plugin-sdk/src/discord/token.d.ts +0 -11
- package/dist/plugin-sdk/src/discord/ui.d.ts +0 -19
- package/dist/plugin-sdk/src/discord/voice/command.d.ts +0 -15
- package/dist/plugin-sdk/src/discord/voice/manager.d.ts +0 -52
- package/dist/plugin-sdk/src/discord/voice-message.d.ts +0 -50
- package/dist/plugin-sdk/src/federation/access-token.d.ts +0 -34
- package/dist/plugin-sdk/src/federation/attestation.d.ts +0 -37
- package/dist/plugin-sdk/src/federation/auto-connect.d.ts +0 -103
- package/dist/plugin-sdk/src/federation/marketplace-capability-adapter.d.ts +0 -31
- package/dist/plugin-sdk/src/federation/marketplace-chat-command.d.ts +0 -13
- package/dist/plugin-sdk/src/federation/marketplace-delivery.d.ts +0 -61
- package/dist/plugin-sdk/src/federation/marketplace-direct-payment.d.ts +0 -36
- package/dist/plugin-sdk/src/federation/marketplace-escrow.d.ts +0 -58
- package/dist/plugin-sdk/src/federation/marketplace-service-kinds.d.ts +0 -23
- package/dist/plugin-sdk/src/federation/marketplace-task-ledger.d.ts +0 -12
- package/dist/plugin-sdk/src/federation/offers.d.ts +0 -258
- package/dist/plugin-sdk/src/federation/runtime.d.ts +0 -14
- package/dist/plugin-sdk/src/federation/settlement-evidence.d.ts +0 -27
- package/dist/plugin-sdk/src/gateway/a2a-http.d.ts +0 -25
- package/dist/plugin-sdk/src/gateway/a2a-settlement.d.ts +0 -36
- package/dist/plugin-sdk/src/gateway/agent-event-assistant-text.d.ts +0 -2
- package/dist/plugin-sdk/src/gateway/agent-prompt.d.ts +0 -6
- package/dist/plugin-sdk/src/gateway/assistant-identity.d.ts +0 -13
- package/dist/plugin-sdk/src/gateway/auth-rate-limit.d.ts +0 -67
- package/dist/plugin-sdk/src/gateway/auth.d.ts +0 -63
- package/dist/plugin-sdk/src/gateway/call.d.ts +0 -82
- package/dist/plugin-sdk/src/gateway/canvas-capability.d.ts +0 -14
- package/dist/plugin-sdk/src/gateway/chat-abort.d.ts +0 -70
- package/dist/plugin-sdk/src/gateway/chat-sanitize.d.ts +0 -4
- package/dist/plugin-sdk/src/gateway/client.d.ts +0 -66
- package/dist/plugin-sdk/src/gateway/control-plane-audit.d.ts +0 -10
- package/dist/plugin-sdk/src/gateway/control-ui-boot-check.d.ts +0 -22
- package/dist/plugin-sdk/src/gateway/control-ui-contract.d.ts +0 -7
- package/dist/plugin-sdk/src/gateway/control-ui-csp.d.ts +0 -1
- package/dist/plugin-sdk/src/gateway/control-ui-login.d.ts +0 -115
- package/dist/plugin-sdk/src/gateway/control-ui-shared.d.ts +0 -9
- package/dist/plugin-sdk/src/gateway/control-ui.d.ts +0 -36
- package/dist/plugin-sdk/src/gateway/credentials.d.ts +0 -34
- package/dist/plugin-sdk/src/gateway/device-auth.d.ts +0 -17
- package/dist/plugin-sdk/src/gateway/exec-approval-manager.d.ts +0 -38
- package/dist/plugin-sdk/src/gateway/federation-http.d.ts +0 -7
- package/dist/plugin-sdk/src/gateway/federation-marketplace.d.ts +0 -90
- package/dist/plugin-sdk/src/gateway/fedify-http.d.ts +0 -5
- package/dist/plugin-sdk/src/gateway/gateway-identity.d.ts +0 -5
- package/dist/plugin-sdk/src/gateway/hooks-mapping.d.ts +0 -80
- package/dist/plugin-sdk/src/gateway/hooks.d.ts +0 -102
- package/dist/plugin-sdk/src/gateway/http-auth-helpers.d.ts +0 -11
- package/dist/plugin-sdk/src/gateway/http-common.d.ts +0 -21
- package/dist/plugin-sdk/src/gateway/http-endpoint-helpers.d.ts +0 -13
- package/dist/plugin-sdk/src/gateway/http-utils.d.ts +0 -15
- package/dist/plugin-sdk/src/gateway/internal-call-auth.d.ts +0 -3
- package/dist/plugin-sdk/src/gateway/method-scopes.d.ts +0 -22
- package/dist/plugin-sdk/src/gateway/mutating-admin-rpc-rate-limit.d.ts +0 -29
- package/dist/plugin-sdk/src/gateway/net.d.ts +0 -83
- package/dist/plugin-sdk/src/gateway/node-command-policy.d.ts +0 -14
- package/dist/plugin-sdk/src/gateway/node-registry.d.ts +0 -60
- package/dist/plugin-sdk/src/gateway/open-responses.schema.d.ts +0 -765
- package/dist/plugin-sdk/src/gateway/openai-http.d.ts +0 -12
- package/dist/plugin-sdk/src/gateway/openresponses-http.d.ts +0 -21
- package/dist/plugin-sdk/src/gateway/openresponses-prompt.d.ts +0 -5
- package/dist/plugin-sdk/src/gateway/probe-auth.d.ts +0 -9
- package/dist/plugin-sdk/src/gateway/probe.d.ts +0 -26
- package/dist/plugin-sdk/src/gateway/protocol/client-info.d.ts +0 -58
- package/dist/plugin-sdk/src/gateway/protocol/index.d.ts +0 -1048
- package/dist/plugin-sdk/src/gateway/protocol/schema/agent.d.ts +0 -91
- package/dist/plugin-sdk/src/gateway/protocol/schema/agents-models-skills.d.ts +0 -1400
- package/dist/plugin-sdk/src/gateway/protocol/schema/channels.d.ts +0 -158
- package/dist/plugin-sdk/src/gateway/protocol/schema/commands.d.ts +0 -68
- package/dist/plugin-sdk/src/gateway/protocol/schema/config.d.ts +0 -115
- package/dist/plugin-sdk/src/gateway/protocol/schema/cron.d.ts +0 -1551
- package/dist/plugin-sdk/src/gateway/protocol/schema/devices.d.ts +0 -42
- package/dist/plugin-sdk/src/gateway/protocol/schema/error-codes.d.ts +0 -15
- package/dist/plugin-sdk/src/gateway/protocol/schema/exec-approvals.d.ts +0 -182
- package/dist/plugin-sdk/src/gateway/protocol/schema/frames.d.ts +0 -168
- package/dist/plugin-sdk/src/gateway/protocol/schema/logs-chat.d.ts +0 -45
- package/dist/plugin-sdk/src/gateway/protocol/schema/nodes.d.ts +0 -85
- package/dist/plugin-sdk/src/gateway/protocol/schema/primitives.d.ts +0 -4
- package/dist/plugin-sdk/src/gateway/protocol/schema/protocol-schemas.d.ts +0 -3
- package/dist/plugin-sdk/src/gateway/protocol/schema/push.d.ts +0 -15
- package/dist/plugin-sdk/src/gateway/protocol/schema/sessions.d.ts +0 -134
- package/dist/plugin-sdk/src/gateway/protocol/schema/snapshot.d.ts +0 -69
- package/dist/plugin-sdk/src/gateway/protocol/schema/types.d.ts +0 -245
- package/dist/plugin-sdk/src/gateway/protocol/schema/wizard.d.ts +0 -86
- package/dist/plugin-sdk/src/gateway/protocol/schema.d.ts +0 -18
- package/dist/plugin-sdk/src/gateway/security-path.d.ts +0 -15
- package/dist/plugin-sdk/src/gateway/server/readiness.d.ts +0 -6
- package/dist/plugin-sdk/src/gateway/server/ws-types.d.ts +0 -12
- package/dist/plugin-sdk/src/gateway/server-broadcast.d.ts +0 -17
- package/dist/plugin-sdk/src/gateway/server-channels.d.ts +0 -26
- package/dist/plugin-sdk/src/gateway/server-constants.d.ts +0 -10
- package/dist/plugin-sdk/src/gateway/server-http.d.ts +0 -131
- package/dist/plugin-sdk/src/gateway/server-methods/commands.d.ts +0 -11
- package/dist/plugin-sdk/src/gateway/server-methods/mutating-admin-rpc-audit.d.ts +0 -41
- package/dist/plugin-sdk/src/gateway/server-methods/nodes.helpers.d.ts +0 -20
- package/dist/plugin-sdk/src/gateway/server-methods/push.d.ts +0 -2
- package/dist/plugin-sdk/src/gateway/server-methods/types.d.ts +0 -106
- package/dist/plugin-sdk/src/gateway/server-model-catalog.d.ts +0 -17
- package/dist/plugin-sdk/src/gateway/server-shared.d.ts +0 -7
- package/dist/plugin-sdk/src/gateway/server-startup-readiness.d.ts +0 -21
- package/dist/plugin-sdk/src/gateway/server-startup-trace.d.ts +0 -29
- package/dist/plugin-sdk/src/gateway/session-compaction-checkpoints.d.ts +0 -24
- package/dist/plugin-sdk/src/gateway/session-utils.d.ts +0 -80
- package/dist/plugin-sdk/src/gateway/session-utils.fs.d.ts +0 -48
- package/dist/plugin-sdk/src/gateway/session-utils.types.d.ts +0 -106
- package/dist/plugin-sdk/src/gateway/tools-invoke-http.d.ts +0 -10
- package/dist/plugin-sdk/src/gateway/update-status.d.ts +0 -27
- package/dist/plugin-sdk/src/gateway/ws-log.d.ts +0 -5
- package/dist/plugin-sdk/src/gateway/ws-logging.d.ts +0 -4
- package/dist/plugin-sdk/src/globals.d.ts +0 -11
- package/dist/plugin-sdk/src/hooks/config.d.ts +0 -11
- package/dist/plugin-sdk/src/hooks/frontmatter.d.ts +0 -5
- package/dist/plugin-sdk/src/hooks/internal-hooks.d.ts +0 -155
- package/dist/plugin-sdk/src/hooks/module-loader.d.ts +0 -18
- package/dist/plugin-sdk/src/hooks/types.d.ts +0 -62
- package/dist/plugin-sdk/src/image-generation/types.d.ts +0 -74
- package/dist/plugin-sdk/src/imessage/accounts.d.ts +0 -16
- package/dist/plugin-sdk/src/imessage/client.d.ts +0 -46
- package/dist/plugin-sdk/src/imessage/constants.d.ts +0 -2
- package/dist/plugin-sdk/src/imessage/monitor/abort-handler.d.ts +0 -9
- package/dist/plugin-sdk/src/imessage/monitor/deliver.d.ts +0 -14
- package/dist/plugin-sdk/src/imessage/monitor/echo-cache.d.ts +0 -9
- package/dist/plugin-sdk/src/imessage/monitor/inbound-processing.d.ts +0 -96
- package/dist/plugin-sdk/src/imessage/monitor/monitor-provider.d.ts +0 -7
- package/dist/plugin-sdk/src/imessage/monitor/parse-notification.d.ts +0 -2
- package/dist/plugin-sdk/src/imessage/monitor/runtime.d.ts +0 -4
- package/dist/plugin-sdk/src/imessage/monitor/types.d.ts +0 -37
- package/dist/plugin-sdk/src/imessage/monitor.d.ts +0 -2
- package/dist/plugin-sdk/src/imessage/probe.d.ts +0 -17
- package/dist/plugin-sdk/src/imessage/send.d.ts +0 -34
- package/dist/plugin-sdk/src/imessage/target-parsing-helpers.d.ts +0 -45
- package/dist/plugin-sdk/src/imessage/targets.d.ts +0 -40
- package/dist/plugin-sdk/src/infra/abort-signal.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/agent-events.d.ts +0 -24
- package/dist/plugin-sdk/src/infra/archive-path.d.ts +0 -12
- package/dist/plugin-sdk/src/infra/archive.d.ts +0 -46
- package/dist/plugin-sdk/src/infra/backoff.d.ts +0 -8
- package/dist/plugin-sdk/src/infra/binaries.d.ts +0 -3
- package/dist/plugin-sdk/src/infra/boundary-file-read.d.ts +0 -33
- package/dist/plugin-sdk/src/infra/boundary-path.d.ts +0 -38
- package/dist/plugin-sdk/src/infra/brew.d.ts +0 -8
- package/dist/plugin-sdk/src/infra/channel-activity.d.ts +0 -18
- package/dist/plugin-sdk/src/infra/channel-summary.d.ts +0 -6
- package/dist/plugin-sdk/src/infra/channels-status-issues.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/clawhub.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/control-ui-assets.d.ts +0 -32
- package/dist/plugin-sdk/src/infra/dedupe.d.ts +0 -12
- package/dist/plugin-sdk/src/infra/detect-package-manager.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/device-auth-store.d.ts +0 -19
- package/dist/plugin-sdk/src/infra/device-identity.d.ts +0 -13
- package/dist/plugin-sdk/src/infra/device-pairing.d.ts +0 -103
- package/dist/plugin-sdk/src/infra/diagnostic-events.d.ts +0 -140
- package/dist/plugin-sdk/src/infra/diagnostic-flags.d.ts +0 -4
- package/dist/plugin-sdk/src/infra/dotenv.d.ts +0 -13
- package/dist/plugin-sdk/src/infra/env.d.ts +0 -11
- package/dist/plugin-sdk/src/infra/errors.d.ts +0 -11
- package/dist/plugin-sdk/src/infra/exec-approval-reply.d.ts +0 -11
- package/dist/plugin-sdk/src/infra/exec-approval-surface.d.ts +0 -38
- package/dist/plugin-sdk/src/infra/exec-approvals-allowlist.d.ts +0 -69
- package/dist/plugin-sdk/src/infra/exec-approvals-analysis.d.ts +0 -78
- package/dist/plugin-sdk/src/infra/exec-approvals.d.ts +0 -147
- package/dist/plugin-sdk/src/infra/exec-command-resolution.d.ts +0 -45
- package/dist/plugin-sdk/src/infra/exec-obfuscation-detect.d.ts +0 -12
- package/dist/plugin-sdk/src/infra/exec-safe-bin-policy-profiles.d.ts +0 -24
- package/dist/plugin-sdk/src/infra/exec-safe-bin-policy-validator.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/exec-safe-bin-policy.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/exec-safe-bin-runtime-policy.d.ts +0 -25
- package/dist/plugin-sdk/src/infra/exec-safe-bin-trust.d.ts +0 -23
- package/dist/plugin-sdk/src/infra/exec-safety.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/exec-wrapper-resolution.d.ts +0 -48
- package/dist/plugin-sdk/src/infra/fased-exec-env.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/fased-root.d.ts +0 -10
- package/dist/plugin-sdk/src/infra/fasedhub.d.ts +0 -114
- package/dist/plugin-sdk/src/infra/fetch-headers.d.ts +0 -4
- package/dist/plugin-sdk/src/infra/fetch.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/file-identity.d.ts +0 -5
- package/dist/plugin-sdk/src/infra/file-lock.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/format-time/format-datetime.d.ts +0 -35
- package/dist/plugin-sdk/src/infra/format-time/format-duration.d.ts +0 -23
- package/dist/plugin-sdk/src/infra/format-time/format-relative.d.ts +0 -39
- package/dist/plugin-sdk/src/infra/fs-safe.d.ts +0 -43
- package/dist/plugin-sdk/src/infra/gemini-auth.d.ts +0 -16
- package/dist/plugin-sdk/src/infra/git-commit.d.ts +0 -4
- package/dist/plugin-sdk/src/infra/git-root.d.ts +0 -7
- package/dist/plugin-sdk/src/infra/hardlink-guards.d.ts +0 -6
- package/dist/plugin-sdk/src/infra/heartbeat-active-hours.d.ts +0 -5
- package/dist/plugin-sdk/src/infra/heartbeat-events-filter.d.ts +0 -8
- package/dist/plugin-sdk/src/infra/heartbeat-events.d.ts +0 -21
- package/dist/plugin-sdk/src/infra/heartbeat-reason.d.ts +0 -5
- package/dist/plugin-sdk/src/infra/heartbeat-runner.d.ts +0 -46
- package/dist/plugin-sdk/src/infra/heartbeat-visibility.d.ts +0 -17
- package/dist/plugin-sdk/src/infra/heartbeat-wake.d.ts +0 -32
- package/dist/plugin-sdk/src/infra/home-dir.d.ts +0 -7
- package/dist/plugin-sdk/src/infra/host-env-security.d.ts +0 -26
- package/dist/plugin-sdk/src/infra/http-body.d.ts +0 -46
- package/dist/plugin-sdk/src/infra/install-flow.d.ts +0 -24
- package/dist/plugin-sdk/src/infra/install-mode-options.d.ts +0 -20
- package/dist/plugin-sdk/src/infra/install-package-dir.d.ts +0 -19
- package/dist/plugin-sdk/src/infra/install-safe-path.d.ts +0 -14
- package/dist/plugin-sdk/src/infra/install-source-utils.d.ts +0 -32
- package/dist/plugin-sdk/src/infra/json-file.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/json-files.d.ts +0 -5
- package/dist/plugin-sdk/src/infra/jsonl-socket.d.ts +0 -6
- package/dist/plugin-sdk/src/infra/machine-name.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/map-size.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/net/fetch-guard.d.ts +0 -28
- package/dist/plugin-sdk/src/infra/net/hostname.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/net/ssrf.d.ts +0 -35
- package/dist/plugin-sdk/src/infra/node-commands.d.ts +0 -4
- package/dist/plugin-sdk/src/infra/node-pairing.d.ts +0 -65
- package/dist/plugin-sdk/src/infra/node-shell.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/npm-integrity.d.ts +0 -38
- package/dist/plugin-sdk/src/infra/npm-pack-install.d.ts +0 -56
- package/dist/plugin-sdk/src/infra/npm-registry-spec.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/optional-runtime-dependency.d.ts +0 -6
- package/dist/plugin-sdk/src/infra/os-summary.d.ts +0 -7
- package/dist/plugin-sdk/src/infra/outbound/abort.d.ts +0 -8
- package/dist/plugin-sdk/src/infra/outbound/agent-delivery.d.ts +0 -46
- package/dist/plugin-sdk/src/infra/outbound/best-effort-delivery.d.ts +0 -13
- package/dist/plugin-sdk/src/infra/outbound/bound-delivery-router.d.ts +0 -16
- package/dist/plugin-sdk/src/infra/outbound/channel-adapters.d.ts +0 -15
- package/dist/plugin-sdk/src/infra/outbound/channel-adapters.discord.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/outbound/channel-resolution.d.ts +0 -8
- package/dist/plugin-sdk/src/infra/outbound/channel-selection.d.ts +0 -11
- package/dist/plugin-sdk/src/infra/outbound/channel-target.d.ts +0 -6
- package/dist/plugin-sdk/src/infra/outbound/conversation-id.d.ts +0 -4
- package/dist/plugin-sdk/src/infra/outbound/deliver.d.ts +0 -80
- package/dist/plugin-sdk/src/infra/outbound/delivery-queue.d.ts +0 -85
- package/dist/plugin-sdk/src/infra/outbound/directory-cache.d.ts +0 -24
- package/dist/plugin-sdk/src/infra/outbound/envelope.d.ts +0 -16
- package/dist/plugin-sdk/src/infra/outbound/format.d.ts +0 -41
- package/dist/plugin-sdk/src/infra/outbound/identity.d.ts +0 -8
- package/dist/plugin-sdk/src/infra/outbound/message-action-params.d.ts +0 -54
- package/dist/plugin-sdk/src/infra/outbound/message-action-runner.d.ts +0 -81
- package/dist/plugin-sdk/src/infra/outbound/message-action-spec.d.ts +0 -5
- package/dist/plugin-sdk/src/infra/outbound/message.d.ts +0 -87
- package/dist/plugin-sdk/src/infra/outbound/outbound-policy.d.ts +0 -32
- package/dist/plugin-sdk/src/infra/outbound/outbound-send-service.d.ts +0 -74
- package/dist/plugin-sdk/src/infra/outbound/outbound-session.d.ts +0 -31
- package/dist/plugin-sdk/src/infra/outbound/payloads.d.ts +0 -18
- package/dist/plugin-sdk/src/infra/outbound/session-binding-service.d.ts +0 -89
- package/dist/plugin-sdk/src/infra/outbound/session-context.d.ts +0 -12
- package/dist/plugin-sdk/src/infra/outbound/target-errors.d.ts +0 -6
- package/dist/plugin-sdk/src/infra/outbound/target-normalization.d.ts +0 -4
- package/dist/plugin-sdk/src/infra/outbound/target-resolver.d.ts +0 -53
- package/dist/plugin-sdk/src/infra/outbound/targets.d.ts +0 -87
- package/dist/plugin-sdk/src/infra/outbound/tool-payload.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/pairing-files.d.ts +0 -23
- package/dist/plugin-sdk/src/infra/pairing-pending.d.ts +0 -13
- package/dist/plugin-sdk/src/infra/pairing-token.d.ts +0 -3
- package/dist/plugin-sdk/src/infra/path-alias-guards.d.ts +0 -18
- package/dist/plugin-sdk/src/infra/path-guards.d.ts +0 -5
- package/dist/plugin-sdk/src/infra/path-prepend.d.ts +0 -6
- package/dist/plugin-sdk/src/infra/path-safety.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/plain-object.d.ts +0 -4
- package/dist/plugin-sdk/src/infra/ports-format.d.ts +0 -5
- package/dist/plugin-sdk/src/infra/ports-inspect.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/ports-lsof.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/ports-probe.d.ts +0 -5
- package/dist/plugin-sdk/src/infra/ports-types.d.ts +0 -18
- package/dist/plugin-sdk/src/infra/ports.d.ts +0 -14
- package/dist/plugin-sdk/src/infra/prototype-keys.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/provider-usage.auth.d.ts +0 -11
- package/dist/plugin-sdk/src/infra/provider-usage.d.ts +0 -4
- package/dist/plugin-sdk/src/infra/provider-usage.fetch.claude.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/provider-usage.fetch.codex.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/provider-usage.fetch.copilot.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/provider-usage.fetch.d.ts +0 -6
- package/dist/plugin-sdk/src/infra/provider-usage.fetch.gemini.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/provider-usage.fetch.minimax.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/provider-usage.fetch.shared.d.ts +0 -12
- package/dist/plugin-sdk/src/infra/provider-usage.fetch.zai.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/provider-usage.format.d.ts +0 -13
- package/dist/plugin-sdk/src/infra/provider-usage.load.d.ts +0 -12
- package/dist/plugin-sdk/src/infra/provider-usage.shared.d.ts +0 -8
- package/dist/plugin-sdk/src/infra/provider-usage.types.d.ts +0 -17
- package/dist/plugin-sdk/src/infra/push-apns.d.ts +0 -83
- package/dist/plugin-sdk/src/infra/restart-sentinel.d.ts +0 -50
- package/dist/plugin-sdk/src/infra/restart-stale-pids.d.ts +0 -13
- package/dist/plugin-sdk/src/infra/restart.d.ts +0 -72
- package/dist/plugin-sdk/src/infra/retry-policy.d.ts +0 -25
- package/dist/plugin-sdk/src/infra/retry.d.ts +0 -21
- package/dist/plugin-sdk/src/infra/runtime-guard.d.ts +0 -21
- package/dist/plugin-sdk/src/infra/runtime-status.d.ts +0 -8
- package/dist/plugin-sdk/src/infra/safe-open-sync.d.ts +0 -23
- package/dist/plugin-sdk/src/infra/scp-host.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/secure-random.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/session-cost-usage.d.ts +0 -45
- package/dist/plugin-sdk/src/infra/session-cost-usage.types.d.ts +0 -153
- package/dist/plugin-sdk/src/infra/session-maintenance-warning.d.ts +0 -10
- package/dist/plugin-sdk/src/infra/shell-env.d.ts +0 -34
- package/dist/plugin-sdk/src/infra/skills-remote.d.ts +0 -25
- package/dist/plugin-sdk/src/infra/system-events.d.ts +0 -20
- package/dist/plugin-sdk/src/infra/system-message.d.ts +0 -3
- package/dist/plugin-sdk/src/infra/system-presence.d.ts +0 -45
- package/dist/plugin-sdk/src/infra/system-run-command.d.ts +0 -30
- package/dist/plugin-sdk/src/infra/tailnet.d.ts +0 -7
- package/dist/plugin-sdk/src/infra/tailscale.d.ts +0 -34
- package/dist/plugin-sdk/src/infra/tls/fingerprint.d.ts +0 -1
- package/dist/plugin-sdk/src/infra/tls/gateway.d.ts +0 -16
- package/dist/plugin-sdk/src/infra/tmp-fased-dir.d.ts +0 -20
- package/dist/plugin-sdk/src/infra/transport-ready.d.ts +0 -16
- package/dist/plugin-sdk/src/infra/unhandled-rejections.d.ts +0 -15
- package/dist/plugin-sdk/src/infra/update-channels.d.ts +0 -36
- package/dist/plugin-sdk/src/infra/update-check.d.ts +0 -69
- package/dist/plugin-sdk/src/infra/update-global.d.ts +0 -29
- package/dist/plugin-sdk/src/infra/warning-filter.d.ts +0 -7
- package/dist/plugin-sdk/src/infra/ws.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/wsl.d.ts +0 -11
- package/dist/plugin-sdk/src/line/accounts.d.ts +0 -10
- package/dist/plugin-sdk/src/line/actions.d.ts +0 -22
- package/dist/plugin-sdk/src/line/auto-reply-delivery.d.ts +0 -38
- package/dist/plugin-sdk/src/line/bot-access.d.ts +0 -17
- package/dist/plugin-sdk/src/line/bot-handlers.d.ts +0 -13
- package/dist/plugin-sdk/src/line/bot-message-context.d.ts +0 -118
- package/dist/plugin-sdk/src/line/bot.d.ts +0 -24
- package/dist/plugin-sdk/src/line/channel-access-token.d.ts +0 -4
- package/dist/plugin-sdk/src/line/config-schema.d.ts +0 -64
- package/dist/plugin-sdk/src/line/download.d.ts +0 -7
- package/dist/plugin-sdk/src/line/flex-templates/basic-cards.d.ts +0 -46
- package/dist/plugin-sdk/src/line/flex-templates/common.d.ts +0 -2
- package/dist/plugin-sdk/src/line/flex-templates/media-control-cards.d.ts +0 -73
- package/dist/plugin-sdk/src/line/flex-templates/message.d.ts +0 -6
- package/dist/plugin-sdk/src/line/flex-templates/schedule-cards.d.ts +0 -55
- package/dist/plugin-sdk/src/line/flex-templates/types.d.ts +0 -19
- package/dist/plugin-sdk/src/line/flex-templates.d.ts +0 -5
- package/dist/plugin-sdk/src/line/logging.d.ts +0 -2
- package/dist/plugin-sdk/src/line/markdown-to-line.d.ts +0 -72
- package/dist/plugin-sdk/src/line/monitor.d.ts +0 -28
- package/dist/plugin-sdk/src/line/probe.d.ts +0 -2
- package/dist/plugin-sdk/src/line/reply-chunks.d.ts +0 -24
- package/dist/plugin-sdk/src/line/send.d.ts +0 -91
- package/dist/plugin-sdk/src/line/signature.d.ts +0 -1
- package/dist/plugin-sdk/src/line/template-messages.d.ts +0 -100
- package/dist/plugin-sdk/src/line/types.d.ts +0 -113
- package/dist/plugin-sdk/src/line/webhook-node.d.ts +0 -15
- package/dist/plugin-sdk/src/line/webhook-utils.d.ts +0 -3
- package/dist/plugin-sdk/src/line/webhook.d.ts +0 -19
- package/dist/plugin-sdk/src/link-understanding/apply.d.ts +0 -10
- package/dist/plugin-sdk/src/link-understanding/defaults.d.ts +0 -2
- package/dist/plugin-sdk/src/link-understanding/detect.d.ts +0 -3
- package/dist/plugin-sdk/src/link-understanding/format.d.ts +0 -4
- package/dist/plugin-sdk/src/link-understanding/runner.d.ts +0 -13
- package/dist/plugin-sdk/src/logger.d.ts +0 -6
- package/dist/plugin-sdk/src/logging/config.d.ts +0 -4
- package/dist/plugin-sdk/src/logging/console.d.ts +0 -23
- package/dist/plugin-sdk/src/logging/diagnostic-session-state.d.ts +0 -30
- package/dist/plugin-sdk/src/logging/diagnostic-stability.d.ts +0 -85
- package/dist/plugin-sdk/src/logging/diagnostic.d.ts +0 -65
- package/dist/plugin-sdk/src/logging/env-log-level.d.ts +0 -2
- package/dist/plugin-sdk/src/logging/levels.d.ts +0 -5
- package/dist/plugin-sdk/src/logging/logger.d.ts +0 -44
- package/dist/plugin-sdk/src/logging/node-require.d.ts +0 -1
- package/dist/plugin-sdk/src/logging/redact-identifier.d.ts +0 -4
- package/dist/plugin-sdk/src/logging/redact.d.ts +0 -9
- package/dist/plugin-sdk/src/logging/state.d.ts +0 -19
- package/dist/plugin-sdk/src/logging/subsystem.d.ts +0 -18
- package/dist/plugin-sdk/src/logging/timestamps.d.ts +0 -1
- package/dist/plugin-sdk/src/logging.d.ts +0 -10
- package/dist/plugin-sdk/src/managed/federation.d.ts +0 -16
- package/dist/plugin-sdk/src/markdown/code-spans.d.ts +0 -10
- package/dist/plugin-sdk/src/markdown/fences.d.ts +0 -10
- package/dist/plugin-sdk/src/markdown/frontmatter.d.ts +0 -2
- package/dist/plugin-sdk/src/markdown/ir.d.ts +0 -32
- package/dist/plugin-sdk/src/markdown/render.d.ts +0 -18
- package/dist/plugin-sdk/src/markdown/tables.d.ts +0 -2
- package/dist/plugin-sdk/src/markdown/whatsapp.d.ts +0 -14
- package/dist/plugin-sdk/src/media/audio-tags.d.ts +0 -10
- package/dist/plugin-sdk/src/media/audio.d.ts +0 -19
- package/dist/plugin-sdk/src/media/base64.d.ts +0 -6
- package/dist/plugin-sdk/src/media/constants.d.ts +0 -7
- package/dist/plugin-sdk/src/media/fetch.d.ts +0 -24
- package/dist/plugin-sdk/src/media/image-ops.d.ts +0 -41
- package/dist/plugin-sdk/src/media/inbound-path-policy.d.ts +0 -18
- package/dist/plugin-sdk/src/media/input-files.d.ts +0 -95
- package/dist/plugin-sdk/src/media/local-roots.d.ts +0 -3
- package/dist/plugin-sdk/src/media/mime.d.ts +0 -16
- package/dist/plugin-sdk/src/media/outbound-attachment.d.ts +0 -6
- package/dist/plugin-sdk/src/media/parse.d.ts +0 -8
- package/dist/plugin-sdk/src/media/png-encode.d.ts +0 -8
- package/dist/plugin-sdk/src/media/read-response-with-limit.d.ts +0 -7
- package/dist/plugin-sdk/src/media/sniff-mime-from-base64.d.ts +0 -1
- package/dist/plugin-sdk/src/media/store.d.ts +0 -33
- package/dist/plugin-sdk/src/media-understanding/apply.d.ts +0 -19
- package/dist/plugin-sdk/src/media-understanding/attachments.d.ts +0 -49
- package/dist/plugin-sdk/src/media-understanding/audio-preflight.d.ts +0 -16
- package/dist/plugin-sdk/src/media-understanding/concurrency.d.ts +0 -1
- package/dist/plugin-sdk/src/media-understanding/defaults.d.ts +0 -14
- package/dist/plugin-sdk/src/media-understanding/errors.d.ts +0 -6
- package/dist/plugin-sdk/src/media-understanding/format.d.ts +0 -7
- package/dist/plugin-sdk/src/media-understanding/fs.d.ts +0 -1
- package/dist/plugin-sdk/src/media-understanding/output-extract.d.ts +0 -2
- package/dist/plugin-sdk/src/media-understanding/providers/anthropic/index.d.ts +0 -2
- package/dist/plugin-sdk/src/media-understanding/providers/deepgram/audio.d.ts +0 -4
- package/dist/plugin-sdk/src/media-understanding/providers/deepgram/index.d.ts +0 -2
- package/dist/plugin-sdk/src/media-understanding/providers/google/audio.d.ts +0 -3
- package/dist/plugin-sdk/src/media-understanding/providers/google/index.d.ts +0 -2
- package/dist/plugin-sdk/src/media-understanding/providers/google/inline-data.d.ts +0 -20
- package/dist/plugin-sdk/src/media-understanding/providers/google/video.d.ts +0 -3
- package/dist/plugin-sdk/src/media-understanding/providers/groq/index.d.ts +0 -2
- package/dist/plugin-sdk/src/media-understanding/providers/image.d.ts +0 -2
- package/dist/plugin-sdk/src/media-understanding/providers/index.d.ts +0 -4
- package/dist/plugin-sdk/src/media-understanding/providers/minimax/index.d.ts +0 -2
- package/dist/plugin-sdk/src/media-understanding/providers/mistral/index.d.ts +0 -2
- package/dist/plugin-sdk/src/media-understanding/providers/moonshot/index.d.ts +0 -2
- package/dist/plugin-sdk/src/media-understanding/providers/moonshot/video.d.ts +0 -3
- package/dist/plugin-sdk/src/media-understanding/providers/openai/audio.d.ts +0 -3
- package/dist/plugin-sdk/src/media-understanding/providers/openai/index.d.ts +0 -3
- package/dist/plugin-sdk/src/media-understanding/providers/shared.d.ts +0 -20
- package/dist/plugin-sdk/src/media-understanding/providers/zai/index.d.ts +0 -2
- package/dist/plugin-sdk/src/media-understanding/resolve.d.ts +0 -44
- package/dist/plugin-sdk/src/media-understanding/runner.d.ts +0 -39
- package/dist/plugin-sdk/src/media-understanding/runner.entries.d.ts +0 -33
- package/dist/plugin-sdk/src/media-understanding/scope.d.ts +0 -9
- package/dist/plugin-sdk/src/media-understanding/types.d.ts +0 -93
- package/dist/plugin-sdk/src/media-understanding/video.d.ts +0 -2
- package/dist/plugin-sdk/src/memory/backend-config.d.ts +0 -55
- package/dist/plugin-sdk/src/memory/batch-error-utils.d.ts +0 -15
- package/dist/plugin-sdk/src/memory/batch-gemini.d.ts +0 -51
- package/dist/plugin-sdk/src/memory/batch-http.d.ts +0 -8
- package/dist/plugin-sdk/src/memory/batch-openai.d.ts +0 -20
- package/dist/plugin-sdk/src/memory/batch-output.d.ts +0 -23
- package/dist/plugin-sdk/src/memory/batch-provider-common.d.ts +0 -9
- package/dist/plugin-sdk/src/memory/batch-runner.d.ts +0 -38
- package/dist/plugin-sdk/src/memory/batch-upload.d.ts +0 -6
- package/dist/plugin-sdk/src/memory/batch-utils.d.ts +0 -11
- package/dist/plugin-sdk/src/memory/batch-voyage.d.ts +0 -21
- package/dist/plugin-sdk/src/memory/embedding-chunk-limits.d.ts +0 -3
- package/dist/plugin-sdk/src/memory/embedding-input-limits.d.ts +0 -2
- package/dist/plugin-sdk/src/memory/embedding-model-limits.d.ts +0 -2
- package/dist/plugin-sdk/src/memory/embeddings-debug.d.ts +0 -1
- package/dist/plugin-sdk/src/memory/embeddings-gemini.d.ts +0 -16
- package/dist/plugin-sdk/src/memory/embeddings-mistral.d.ts +0 -15
- package/dist/plugin-sdk/src/memory/embeddings-openai.d.ts +0 -15
- package/dist/plugin-sdk/src/memory/embeddings-remote-client.d.ts +0 -12
- package/dist/plugin-sdk/src/memory/embeddings-remote-fetch.d.ts +0 -8
- package/dist/plugin-sdk/src/memory/embeddings-remote-provider.d.ts +0 -21
- package/dist/plugin-sdk/src/memory/embeddings-voyage.d.ts +0 -15
- package/dist/plugin-sdk/src/memory/embeddings.d.ts +0 -48
- package/dist/plugin-sdk/src/memory/filesystem-manager.d.ts +0 -38
- package/dist/plugin-sdk/src/memory/fs-utils.d.ts +0 -11
- package/dist/plugin-sdk/src/memory/hybrid.d.ts +0 -45
- package/dist/plugin-sdk/src/memory/index.d.ts +0 -4
- package/dist/plugin-sdk/src/memory/internal.d.ts +0 -38
- package/dist/plugin-sdk/src/memory/inventory.d.ts +0 -150
- package/dist/plugin-sdk/src/memory/manager-embedding-ops.d.ts +0 -42
- package/dist/plugin-sdk/src/memory/manager-search.d.ts +0 -60
- package/dist/plugin-sdk/src/memory/manager-sync-ops.d.ts +0 -137
- package/dist/plugin-sdk/src/memory/manager.d.ts +0 -111
- package/dist/plugin-sdk/src/memory/memory-schema.d.ts +0 -10
- package/dist/plugin-sdk/src/memory/mmr.d.ts +0 -62
- package/dist/plugin-sdk/src/memory/node-llama.d.ts +0 -8
- package/dist/plugin-sdk/src/memory/post-json.d.ts +0 -10
- package/dist/plugin-sdk/src/memory/qmd-manager.d.ts +0 -134
- package/dist/plugin-sdk/src/memory/qmd-query-parser.d.ts +0 -9
- package/dist/plugin-sdk/src/memory/qmd-scope.d.ts +0 -5
- package/dist/plugin-sdk/src/memory/query-expansion.d.ts +0 -40
- package/dist/plugin-sdk/src/memory/remote-http.d.ts +0 -9
- package/dist/plugin-sdk/src/memory/repair-audit-plan.d.ts +0 -68
- package/dist/plugin-sdk/src/memory/repair-cli-preview-contract.d.ts +0 -22
- package/dist/plugin-sdk/src/memory/repair-contracts.d.ts +0 -80
- package/dist/plugin-sdk/src/memory/repair-dashboard-preview-contract.d.ts +0 -65
- package/dist/plugin-sdk/src/memory/repair-execution-policy.d.ts +0 -36
- package/dist/plugin-sdk/src/memory/repair-execution-request-contract.d.ts +0 -43
- package/dist/plugin-sdk/src/memory/repair-executor-fs-safety-contract.d.ts +0 -33
- package/dist/plugin-sdk/src/memory/repair-executor-gate.d.ts +0 -27
- package/dist/plugin-sdk/src/memory/repair-executor-lock-contract.d.ts +0 -40
- package/dist/plugin-sdk/src/memory/repair-executor-result-contract.d.ts +0 -72
- package/dist/plugin-sdk/src/memory/repair-executor.d.ts +0 -60
- package/dist/plugin-sdk/src/memory/repair-preflight-cli-preview-contract.d.ts +0 -15
- package/dist/plugin-sdk/src/memory/repair-preflight-dashboard-preview-contract.d.ts +0 -50
- package/dist/plugin-sdk/src/memory/repair-preflight-pipeline-contract.d.ts +0 -35
- package/dist/plugin-sdk/src/memory/search-manager.d.ts +0 -11
- package/dist/plugin-sdk/src/memory/session-files.d.ts +0 -14
- package/dist/plugin-sdk/src/memory/sqlite-vec.d.ts +0 -9
- package/dist/plugin-sdk/src/memory/sqlite.d.ts +0 -1
- package/dist/plugin-sdk/src/memory/status-format.d.ts +0 -28
- package/dist/plugin-sdk/src/memory/temporal-decay.d.ts +0 -25
- package/dist/plugin-sdk/src/memory/types.d.ts +0 -94
- package/dist/plugin-sdk/src/mining/chat-command.d.ts +0 -19
- package/dist/plugin-sdk/src/mining/mainnet-sync.d.ts +0 -32
- package/dist/plugin-sdk/src/pairing/pairing-challenge.d.ts +0 -32
- package/dist/plugin-sdk/src/pairing/pairing-labels.d.ts +0 -2
- package/dist/plugin-sdk/src/pairing/pairing-messages.d.ts +0 -6
- package/dist/plugin-sdk/src/pairing/pairing-store.d.ts +0 -50
- package/dist/plugin-sdk/src/plugin-sdk/account-id.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/agent-media-payload.d.ts +0 -12
- package/dist/plugin-sdk/src/plugin-sdk/allow-from.d.ts +0 -32
- package/dist/plugin-sdk/src/plugin-sdk/channel-core.d.ts +0 -18
- package/dist/plugin-sdk/src/plugin-sdk/command-auth.d.ts +0 -27
- package/dist/plugin-sdk/src/plugin-sdk/config-paths.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/device-pair.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/discord.d.ts +0 -10
- package/dist/plugin-sdk/src/plugin-sdk/fetch-auth.d.ts +0 -13
- package/dist/plugin-sdk/src/plugin-sdk/file-lock.d.ts +0 -16
- package/dist/plugin-sdk/src/plugin-sdk/group-access.d.ts +0 -16
- package/dist/plugin-sdk/src/plugin-sdk/image-generation.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/index.d.ts +0 -163
- package/dist/plugin-sdk/src/plugin-sdk/json-store.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/onboarding.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/pairing-access.d.ts +0 -18
- package/dist/plugin-sdk/src/plugin-sdk/persistent-dedupe.d.ts +0 -20
- package/dist/plugin-sdk/src/plugin-sdk/provider-auth-result.d.ts +0 -14
- package/dist/plugin-sdk/src/plugin-sdk/realtime-transcription.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/realtime-voice.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/reply-payload.d.ts +0 -22
- package/dist/plugin-sdk/src/plugin-sdk/run-command.d.ts +0 -12
- package/dist/plugin-sdk/src/plugin-sdk/runtime.d.ts +0 -10
- package/dist/plugin-sdk/src/plugin-sdk/sat-runtime.d.ts +0 -32
- package/dist/plugin-sdk/src/plugin-sdk/slack-message-actions.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/slack.d.ts +0 -9
- package/dist/plugin-sdk/src/plugin-sdk/ssrf-policy.d.ts +0 -12
- package/dist/plugin-sdk/src/plugin-sdk/status-helpers.d.ts +0 -88
- package/dist/plugin-sdk/src/plugin-sdk/telegram.d.ts +0 -9
- package/dist/plugin-sdk/src/plugin-sdk/temp-path.d.ts +0 -12
- package/dist/plugin-sdk/src/plugin-sdk/text-chunking.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/tool-send.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/video-generation.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/webhook-path.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/webhook-targets.d.ts +0 -23
- package/dist/plugin-sdk/src/plugin-sdk/whatsapp.d.ts +0 -11
- package/dist/plugin-sdk/src/plugins/bundled-dir.d.ts +0 -7
- package/dist/plugin-sdk/src/plugins/capability-provider-runtime.d.ts +0 -9
- package/dist/plugin-sdk/src/plugins/commands.d.ts +0 -85
- package/dist/plugin-sdk/src/plugins/config-schema.d.ts +0 -2
- package/dist/plugin-sdk/src/plugins/config-state.d.ts +0 -86
- package/dist/plugin-sdk/src/plugins/discovery.d.ts +0 -25
- package/dist/plugin-sdk/src/plugins/hook-runner-global.d.ts +0 -37
- package/dist/plugin-sdk/src/plugins/hooks.d.ts +0 -55
- package/dist/plugin-sdk/src/plugins/http-path.d.ts +0 -1
- package/dist/plugin-sdk/src/plugins/http-registry.d.ts +0 -13
- package/dist/plugin-sdk/src/plugins/install.d.ts +0 -93
- package/dist/plugin-sdk/src/plugins/loader.d.ts +0 -35
- package/dist/plugin-sdk/src/plugins/logger.d.ts +0 -9
- package/dist/plugin-sdk/src/plugins/manifest-registry.d.ts +0 -53
- package/dist/plugin-sdk/src/plugins/manifest.d.ts +0 -136
- package/dist/plugin-sdk/src/plugins/memory-embedding-providers.d.ts +0 -15
- package/dist/plugin-sdk/src/plugins/min-host-version.d.ts +0 -28
- package/dist/plugin-sdk/src/plugins/package-extensions.d.ts +0 -23
- package/dist/plugin-sdk/src/plugins/path-safety.d.ts +0 -5
- package/dist/plugin-sdk/src/plugins/provider-discovery.d.ts +0 -13
- package/dist/plugin-sdk/src/plugins/provider-runtime.runtime.d.ts +0 -8
- package/dist/plugin-sdk/src/plugins/providers.d.ts +0 -28
- package/dist/plugin-sdk/src/plugins/registry.d.ts +0 -171
- package/dist/plugin-sdk/src/plugins/runtime/admin-rpc-helper.d.ts +0 -71
- package/dist/plugin-sdk/src/plugins/runtime/index.d.ts +0 -4
- package/dist/plugin-sdk/src/plugins/runtime/native-deps.d.ts +0 -8
- package/dist/plugin-sdk/src/plugins/runtime/scoped.d.ts +0 -6
- package/dist/plugin-sdk/src/plugins/runtime/session-read-helper.d.ts +0 -115
- package/dist/plugin-sdk/src/plugins/runtime/types.d.ts +0 -370
- package/dist/plugin-sdk/src/plugins/runtime.d.ts +0 -6
- package/dist/plugin-sdk/src/plugins/schema-validator.d.ts +0 -10
- package/dist/plugin-sdk/src/plugins/slots.d.ts +0 -24
- package/dist/plugin-sdk/src/plugins/tools.d.ts +0 -14
- package/dist/plugin-sdk/src/plugins/types.d.ts +0 -684
- package/dist/plugin-sdk/src/plugins/uninstall.d.ts +0 -45
- package/dist/plugin-sdk/src/polls.d.ts +0 -31
- package/dist/plugin-sdk/src/process/command-queue.d.ts +0 -63
- package/dist/plugin-sdk/src/process/exec.d.ts +0 -31
- package/dist/plugin-sdk/src/process/kill-tree.d.ts +0 -12
- package/dist/plugin-sdk/src/process/lanes.d.ts +0 -6
- package/dist/plugin-sdk/src/process/spawn-utils.d.ts +0 -26
- package/dist/plugin-sdk/src/process/supervisor/adapters/child.d.ts +0 -10
- package/dist/plugin-sdk/src/process/supervisor/adapters/env.d.ts +0 -1
- package/dist/plugin-sdk/src/process/supervisor/adapters/pty.d.ts +0 -11
- package/dist/plugin-sdk/src/process/supervisor/index.d.ts +0 -4
- package/dist/plugin-sdk/src/process/supervisor/registry.d.ts +0 -21
- package/dist/plugin-sdk/src/process/supervisor/supervisor.d.ts +0 -2
- package/dist/plugin-sdk/src/process/supervisor/types.d.ts +0 -92
- package/dist/plugin-sdk/src/project.d.ts +0 -3
- package/dist/plugin-sdk/src/providers/cloudflare-ai-gateway-shared.d.ts +0 -84
- package/dist/plugin-sdk/src/providers/github-copilot-models.d.ts +0 -5
- package/dist/plugin-sdk/src/providers/github-copilot-token.d.ts +0 -22
- package/dist/plugin-sdk/src/providers/health.d.ts +0 -15
- package/dist/plugin-sdk/src/providers/huggingface-models.d.ts +0 -47
- package/dist/plugin-sdk/src/providers/litellm-models.d.ts +0 -30
- package/dist/plugin-sdk/src/providers/opencode-zen-shared.d.ts +0 -7
- package/dist/plugin-sdk/src/providers/refreshed-model-capabilities.d.ts +0 -14
- package/dist/plugin-sdk/src/providers/registry.d.ts +0 -204
- package/dist/plugin-sdk/src/providers/synthetic-models.d.ts +0 -31
- package/dist/plugin-sdk/src/providers/together-models.d.ts +0 -38
- package/dist/plugin-sdk/src/providers/venice-models.d.ts +0 -175
- package/dist/plugin-sdk/src/providers/vercel-ai-gateway-models.d.ts +0 -113
- package/dist/plugin-sdk/src/providers/xiaomi-models.d.ts +0 -21
- package/dist/plugin-sdk/src/realtime-transcription/provider-registry.d.ts +0 -7
- package/dist/plugin-sdk/src/realtime-transcription/provider-types.d.ts +0 -26
- package/dist/plugin-sdk/src/realtime-voice/provider-registry.d.ts +0 -7
- package/dist/plugin-sdk/src/realtime-voice/provider-types.d.ts +0 -55
- package/dist/plugin-sdk/src/routing/account-id.d.ts +0 -3
- package/dist/plugin-sdk/src/routing/account-lookup.d.ts +0 -1
- package/dist/plugin-sdk/src/routing/bindings.d.ts +0 -11
- package/dist/plugin-sdk/src/routing/resolve-route.d.ts +0 -42
- package/dist/plugin-sdk/src/routing/session-key.d.ts +0 -48
- package/dist/plugin-sdk/src/runtime.d.ts +0 -7
- package/dist/plugin-sdk/src/secrets/json-pointer.d.ts +0 -6
- package/dist/plugin-sdk/src/secrets/ref-contract.d.ts +0 -19
- package/dist/plugin-sdk/src/secrets/resolve.d.ts +0 -15
- package/dist/plugin-sdk/src/secrets/runtime-web-tools.types.d.ts +0 -26
- package/dist/plugin-sdk/src/secrets/shared.d.ts +0 -7
- package/dist/plugin-sdk/src/security/audit-channel.d.ts +0 -7
- package/dist/plugin-sdk/src/security/audit-extra.async.d.ts +0 -47
- package/dist/plugin-sdk/src/security/audit-extra.d.ts +0 -10
- package/dist/plugin-sdk/src/security/audit-extra.sync.d.ts +0 -25
- package/dist/plugin-sdk/src/security/audit-fs.d.ts +0 -44
- package/dist/plugin-sdk/src/security/audit-tool-policy.d.ts +0 -1
- package/dist/plugin-sdk/src/security/audit.d.ts +0 -57
- package/dist/plugin-sdk/src/security/channel-metadata.d.ts +0 -6
- package/dist/plugin-sdk/src/security/dangerous-config-flags.d.ts +0 -2
- package/dist/plugin-sdk/src/security/dangerous-tools.d.ts +0 -12
- package/dist/plugin-sdk/src/security/dm-policy-shared.d.ts +0 -93
- package/dist/plugin-sdk/src/security/external-content.d.ts +0 -58
- package/dist/plugin-sdk/src/security/mutable-allowlist-detectors.d.ts +0 -6
- package/dist/plugin-sdk/src/security/safe-regex.d.ts +0 -2
- package/dist/plugin-sdk/src/security/scan-paths.d.ts +0 -5
- package/dist/plugin-sdk/src/security/secret-equal.d.ts +0 -1
- package/dist/plugin-sdk/src/security/skill-scanner.d.ts +0 -25
- package/dist/plugin-sdk/src/security/windows-acl.d.ts +0 -37
- package/dist/plugin-sdk/src/sessions/input-provenance.d.ts +0 -16
- package/dist/plugin-sdk/src/sessions/level-overrides.d.ts +0 -10
- package/dist/plugin-sdk/src/sessions/model-overrides.d.ts +0 -16
- package/dist/plugin-sdk/src/sessions/send-policy.d.ts +0 -11
- package/dist/plugin-sdk/src/sessions/session-key-utils.d.ts +0 -20
- package/dist/plugin-sdk/src/sessions/session-label.d.ts +0 -9
- package/dist/plugin-sdk/src/sessions/transcript-events.d.ts +0 -9
- package/dist/plugin-sdk/src/shared/avatar-policy.d.ts +0 -16
- package/dist/plugin-sdk/src/shared/chat-content.d.ts +0 -5
- package/dist/plugin-sdk/src/shared/chat-envelope.d.ts +0 -2
- package/dist/plugin-sdk/src/shared/config-eval.d.ts +0 -27
- package/dist/plugin-sdk/src/shared/device-auth.d.ts +0 -13
- package/dist/plugin-sdk/src/shared/entry-metadata.d.ts +0 -15
- package/dist/plugin-sdk/src/shared/entry-status.d.ts +0 -47
- package/dist/plugin-sdk/src/shared/frontmatter.d.ts +0 -24
- package/dist/plugin-sdk/src/shared/gateway-bind-url.d.ts +0 -14
- package/dist/plugin-sdk/src/shared/gateway-method-policy.d.ts +0 -8
- package/dist/plugin-sdk/src/shared/model-param-b.d.ts +0 -1
- package/dist/plugin-sdk/src/shared/model-thinking.d.ts +0 -31
- package/dist/plugin-sdk/src/shared/net/ip.d.ts +0 -20
- package/dist/plugin-sdk/src/shared/net/redact-sensitive-url.d.ts +0 -2
- package/dist/plugin-sdk/src/shared/node-list-parse.d.ts +0 -3
- package/dist/plugin-sdk/src/shared/node-list-types.d.ts +0 -48
- package/dist/plugin-sdk/src/shared/node-match.d.ts +0 -9
- package/dist/plugin-sdk/src/shared/operator-scope-compat.d.ts +0 -5
- package/dist/plugin-sdk/src/shared/pid-alive.d.ts +0 -1
- package/dist/plugin-sdk/src/shared/process-scoped-map.d.ts +0 -1
- package/dist/plugin-sdk/src/shared/requirements.d.ts +0 -80
- package/dist/plugin-sdk/src/shared/string-normalization.d.ts +0 -4
- package/dist/plugin-sdk/src/shared/subagents-format.d.ts +0 -15
- package/dist/plugin-sdk/src/shared/tailscale-status.d.ts +0 -8
- package/dist/plugin-sdk/src/shared/text/code-regions.d.ts +0 -6
- package/dist/plugin-sdk/src/shared/text/reasoning-tags.d.ts +0 -6
- package/dist/plugin-sdk/src/shared/text-chunking.d.ts +0 -1
- package/dist/plugin-sdk/src/signal/accounts.d.ts +0 -17
- package/dist/plugin-sdk/src/signal/client.d.ts +0 -32
- package/dist/plugin-sdk/src/signal/daemon.d.ts +0 -26
- package/dist/plugin-sdk/src/signal/format.d.ts +0 -17
- package/dist/plugin-sdk/src/signal/identity.d.ts +0 -24
- package/dist/plugin-sdk/src/signal/index.d.ts +0 -5
- package/dist/plugin-sdk/src/signal/monitor/access-policy.d.ts +0 -40
- package/dist/plugin-sdk/src/signal/monitor/event-handler.d.ts +0 -5
- package/dist/plugin-sdk/src/signal/monitor/event-handler.types.d.ts +0 -125
- package/dist/plugin-sdk/src/signal/monitor/mentions.d.ts +0 -2
- package/dist/plugin-sdk/src/signal/monitor.d.ts +0 -25
- package/dist/plugin-sdk/src/signal/probe.d.ts +0 -7
- package/dist/plugin-sdk/src/signal/reaction-level.d.ts +0 -17
- package/dist/plugin-sdk/src/signal/rpc-context.d.ts +0 -9
- package/dist/plugin-sdk/src/signal/send-reactions.d.ts +0 -32
- package/dist/plugin-sdk/src/signal/send.d.ts +0 -25
- package/dist/plugin-sdk/src/signal/sse-reconnect.d.ts +0 -13
- package/dist/plugin-sdk/src/slack/accounts.d.ts +0 -32
- package/dist/plugin-sdk/src/slack/actions.d.ts +0 -56
- package/dist/plugin-sdk/src/slack/blocks-fallback.d.ts +0 -2
- package/dist/plugin-sdk/src/slack/blocks-input.d.ts +0 -3
- package/dist/plugin-sdk/src/slack/channel-migration.d.ts +0 -20
- package/dist/plugin-sdk/src/slack/client.d.ts +0 -4
- package/dist/plugin-sdk/src/slack/directory-live.d.ts +0 -4
- package/dist/plugin-sdk/src/slack/draft-stream.d.ts +0 -25
- package/dist/plugin-sdk/src/slack/format.d.ts +0 -7
- package/dist/plugin-sdk/src/slack/http/index.d.ts +0 -1
- package/dist/plugin-sdk/src/slack/http/registry.d.ts +0 -12
- package/dist/plugin-sdk/src/slack/index.d.ts +0 -6
- package/dist/plugin-sdk/src/slack/message-actions.d.ts +0 -4
- package/dist/plugin-sdk/src/slack/modal-metadata.d.ts +0 -8
- package/dist/plugin-sdk/src/slack/monitor/allow-list.d.ts +0 -23
- package/dist/plugin-sdk/src/slack/monitor/auth.d.ts +0 -26
- package/dist/plugin-sdk/src/slack/monitor/channel-config.d.ts +0 -43
- package/dist/plugin-sdk/src/slack/monitor/commands.d.ts +0 -9
- package/dist/plugin-sdk/src/slack/monitor/context.d.ts +0 -104
- package/dist/plugin-sdk/src/slack/monitor/dm-auth.d.ts +0 -17
- package/dist/plugin-sdk/src/slack/monitor/events/channels.d.ts +0 -4
- package/dist/plugin-sdk/src/slack/monitor/events/interactions.d.ts +0 -4
- package/dist/plugin-sdk/src/slack/monitor/events/members.d.ts +0 -4
- package/dist/plugin-sdk/src/slack/monitor/events/messages.d.ts +0 -6
- package/dist/plugin-sdk/src/slack/monitor/events/pins.d.ts +0 -4
- package/dist/plugin-sdk/src/slack/monitor/events/reactions.d.ts +0 -4
- package/dist/plugin-sdk/src/slack/monitor/events/system-event-context.d.ts +0 -12
- package/dist/plugin-sdk/src/slack/monitor/events.d.ts +0 -8
- package/dist/plugin-sdk/src/slack/monitor/external-arg-menu-store.d.ts +0 -18
- package/dist/plugin-sdk/src/slack/monitor/media.d.ts +0 -66
- package/dist/plugin-sdk/src/slack/monitor/message-handler/dispatch.d.ts +0 -12
- package/dist/plugin-sdk/src/slack/monitor/message-handler/prepare.d.ts +0 -13
- package/dist/plugin-sdk/src/slack/monitor/message-handler/types.d.ts +0 -22
- package/dist/plugin-sdk/src/slack/monitor/message-handler.d.ts +0 -11
- package/dist/plugin-sdk/src/slack/monitor/mrkdwn.d.ts +0 -1
- package/dist/plugin-sdk/src/slack/monitor/policy.d.ts +0 -5
- package/dist/plugin-sdk/src/slack/monitor/provider.d.ts +0 -7
- package/dist/plugin-sdk/src/slack/monitor/replies.d.ts +0 -54
- package/dist/plugin-sdk/src/slack/monitor/room-context.d.ts +0 -14
- package/dist/plugin-sdk/src/slack/monitor/slash.d.ts +0 -6
- package/dist/plugin-sdk/src/slack/monitor/thread-resolution.d.ts +0 -12
- package/dist/plugin-sdk/src/slack/monitor/types.d.ts +0 -109
- package/dist/plugin-sdk/src/slack/monitor.d.ts +0 -5
- package/dist/plugin-sdk/src/slack/probe.d.ts +0 -14
- package/dist/plugin-sdk/src/slack/resolve-channels.d.ts +0 -19
- package/dist/plugin-sdk/src/slack/resolve-users.d.ts +0 -26
- package/dist/plugin-sdk/src/slack/send.d.ts +0 -22
- package/dist/plugin-sdk/src/slack/stream-mode.d.ts +0 -23
- package/dist/plugin-sdk/src/slack/streaming.d.ts +0 -72
- package/dist/plugin-sdk/src/slack/targets.d.ts +0 -7
- package/dist/plugin-sdk/src/slack/threading-tool-context.d.ts +0 -10
- package/dist/plugin-sdk/src/slack/threading.d.ts +0 -29
- package/dist/plugin-sdk/src/slack/token.d.ts +0 -3
- package/dist/plugin-sdk/src/slack/types.d.ts +0 -58
- package/dist/plugin-sdk/src/tasks/channel-task-ledger.d.ts +0 -9
- package/dist/plugin-sdk/src/tasks/task-executor.d.ts +0 -86
- package/dist/plugin-sdk/src/tasks/task-owner-access.d.ts +0 -12
- package/dist/plugin-sdk/src/tasks/task-registry.d.ts +0 -35
- package/dist/plugin-sdk/src/tasks/task-registry.types.d.ts +0 -114
- package/dist/plugin-sdk/src/tasks/task-status.d.ts +0 -11
- package/dist/plugin-sdk/src/telegram/accounts.d.ts +0 -21
- package/dist/plugin-sdk/src/telegram/allowed-updates.d.ts +0 -4
- package/dist/plugin-sdk/src/telegram/api-logging.d.ts +0 -11
- package/dist/plugin-sdk/src/telegram/audit.d.ts +0 -29
- package/dist/plugin-sdk/src/telegram/bot/delivery.d.ts +0 -35
- package/dist/plugin-sdk/src/telegram/bot/helpers.d.ts +0 -127
- package/dist/plugin-sdk/src/telegram/bot/types.d.ts +0 -28
- package/dist/plugin-sdk/src/telegram/bot-access.d.ts +0 -26
- package/dist/plugin-sdk/src/telegram/bot-handlers.d.ts +0 -2
- package/dist/plugin-sdk/src/telegram/bot-message-context.d.ts +0 -149
- package/dist/plugin-sdk/src/telegram/bot-message-dispatch.d.ts +0 -29
- package/dist/plugin-sdk/src/telegram/bot-message.d.ts +0 -20
- package/dist/plugin-sdk/src/telegram/bot-native-command-menu.d.ts +0 -33
- package/dist/plugin-sdk/src/telegram/bot-native-commands.d.ts +0 -58
- package/dist/plugin-sdk/src/telegram/bot-updates.d.ts +0 -31
- package/dist/plugin-sdk/src/telegram/bot.d.ts +0 -62
- package/dist/plugin-sdk/src/telegram/button-types.d.ts +0 -7
- package/dist/plugin-sdk/src/telegram/caption.d.ts +0 -5
- package/dist/plugin-sdk/src/telegram/dm-access.d.ts +0 -18
- package/dist/plugin-sdk/src/telegram/draft-stream.d.ts +0 -37
- package/dist/plugin-sdk/src/telegram/fetch.d.ts +0 -5
- package/dist/plugin-sdk/src/telegram/format.d.ts +0 -18
- package/dist/plugin-sdk/src/telegram/group-access.d.ts +0 -54
- package/dist/plugin-sdk/src/telegram/group-config-helpers.d.ts +0 -8
- package/dist/plugin-sdk/src/telegram/group-migration.d.ts +0 -20
- package/dist/plugin-sdk/src/telegram/inline-buttons.d.ts +0 -11
- package/dist/plugin-sdk/src/telegram/lane-delivery.d.ts +0 -56
- package/dist/plugin-sdk/src/telegram/model-buttons.d.ts +0 -63
- package/dist/plugin-sdk/src/telegram/monitor.d.ts +0 -19
- package/dist/plugin-sdk/src/telegram/network-config.d.ts +0 -33
- package/dist/plugin-sdk/src/telegram/network-errors.d.ts +0 -5
- package/dist/plugin-sdk/src/telegram/outbound-params.d.ts +0 -2
- package/dist/plugin-sdk/src/telegram/probe.d.ts +0 -17
- package/dist/plugin-sdk/src/telegram/proxy.d.ts +0 -1
- package/dist/plugin-sdk/src/telegram/reaction-level.d.ts +0 -11
- package/dist/plugin-sdk/src/telegram/reasoning-lane-coordinator.d.ts +0 -18
- package/dist/plugin-sdk/src/telegram/send.d.ts +0 -153
- package/dist/plugin-sdk/src/telegram/sendchataction-401-backoff.d.ts +0 -28
- package/dist/plugin-sdk/src/telegram/sent-message-cache.d.ts +0 -16
- package/dist/plugin-sdk/src/telegram/status-reaction-variants.d.ts +0 -21
- package/dist/plugin-sdk/src/telegram/sticker-cache.d.ts +0 -46
- package/dist/plugin-sdk/src/telegram/target-writeback.d.ts +0 -7
- package/dist/plugin-sdk/src/telegram/targets.d.ts +0 -11
- package/dist/plugin-sdk/src/telegram/token.d.ts +0 -13
- package/dist/plugin-sdk/src/telegram/update-offset-store.d.ts +0 -15
- package/dist/plugin-sdk/src/telegram/voice.d.ts +0 -16
- package/dist/plugin-sdk/src/telegram/webhook.d.ts +0 -20
- package/dist/plugin-sdk/src/terminal/ansi.d.ts +0 -2
- package/dist/plugin-sdk/src/terminal/health-style.d.ts +0 -1
- package/dist/plugin-sdk/src/terminal/links.d.ts +0 -6
- package/dist/plugin-sdk/src/terminal/palette.d.ts +0 -10
- package/dist/plugin-sdk/src/terminal/progress-line.d.ts +0 -3
- package/dist/plugin-sdk/src/terminal/prompt-style.d.ts +0 -6
- package/dist/plugin-sdk/src/terminal/restore.d.ts +0 -17
- package/dist/plugin-sdk/src/terminal/table.d.ts +0 -18
- package/dist/plugin-sdk/src/terminal/theme.d.ts +0 -18
- package/dist/plugin-sdk/src/tts/tts-core.d.ts +0 -52
- package/dist/plugin-sdk/src/tts/tts.d.ts +0 -194
- package/dist/plugin-sdk/src/utils/account-id.d.ts +0 -1
- package/dist/plugin-sdk/src/utils/boolean.d.ts +0 -5
- package/dist/plugin-sdk/src/utils/chunk-items.d.ts +0 -1
- package/dist/plugin-sdk/src/utils/delivery-context.d.ts +0 -29
- package/dist/plugin-sdk/src/utils/directive-tags.d.ts +0 -29
- package/dist/plugin-sdk/src/utils/fetch-timeout.d.ts +0 -13
- package/dist/plugin-sdk/src/utils/mask-api-key.d.ts +0 -1
- package/dist/plugin-sdk/src/utils/message-channel.d.ts +0 -27
- package/dist/plugin-sdk/src/utils/normalize-secret-input.d.ts +0 -11
- package/dist/plugin-sdk/src/utils/private-network-url.d.ts +0 -1
- package/dist/plugin-sdk/src/utils/provider-utils.d.ts +0 -9
- package/dist/plugin-sdk/src/utils/queue-helpers.d.ts +0 -80
- package/dist/plugin-sdk/src/utils/reaction-level.d.ts +0 -15
- package/dist/plugin-sdk/src/utils/run-with-concurrency.d.ts +0 -11
- package/dist/plugin-sdk/src/utils/safe-json.d.ts +0 -1
- package/dist/plugin-sdk/src/utils/shell-argv.d.ts +0 -1
- package/dist/plugin-sdk/src/utils/transcript-tools.d.ts +0 -8
- package/dist/plugin-sdk/src/utils/usage-format.d.ts +0 -26
- package/dist/plugin-sdk/src/utils/with-timeout.d.ts +0 -1
- package/dist/plugin-sdk/src/utils.d.ts +0 -63
- package/dist/plugin-sdk/src/version.d.ts +0 -8
- package/dist/plugin-sdk/src/video-generation/dashscope-compatible.d.ts +0 -45
- package/dist/plugin-sdk/src/video-generation/types.d.ts +0 -79
- package/dist/plugin-sdk/src/wallet/chat-command.d.ts +0 -17
- package/dist/plugin-sdk/src/wallet/local-socket-signer-broker.d.ts +0 -13
- package/dist/plugin-sdk/src/wallet/local-socket-signer-custody.d.ts +0 -35
- package/dist/plugin-sdk/src/wallet/local-socket-signer-protocol.d.ts +0 -191
- package/dist/plugin-sdk/src/wallet/providers/alchemy-adapter.d.ts +0 -29
- package/dist/plugin-sdk/src/wallet/providers/embedded-keystore-adapter.d.ts +0 -37
- package/dist/plugin-sdk/src/wallet/providers/local-socket-signer-adapter.d.ts +0 -44
- package/dist/plugin-sdk/src/wallet/providers/privy-adapter.d.ts +0 -31
- package/dist/plugin-sdk/src/wallet/providers/turnkey-adapter.d.ts +0 -33
- package/dist/plugin-sdk/src/wallet/solana-address.d.ts +0 -2
- package/dist/plugin-sdk/src/wallet/solana-assets.d.ts +0 -80
- package/dist/plugin-sdk/src/wallet/solana-bond-signing.d.ts +0 -20
- package/dist/plugin-sdk/src/wallet/solana-spl-transfer.d.ts +0 -33
- package/dist/plugin-sdk/src/wallet/solana-swap.d.ts +0 -93
- package/dist/plugin-sdk/src/wallet/solana-token-resolver.d.ts +0 -36
- package/dist/plugin-sdk/src/wallet/solana-transaction-inspection.d.ts +0 -16
- package/dist/plugin-sdk/src/wallet/solana-trigger.d.ts +0 -74
- package/dist/plugin-sdk/src/wallet/trade-chat-command.d.ts +0 -18
- package/dist/plugin-sdk/src/wallet/wallet-agent-selection.d.ts +0 -43
- package/dist/plugin-sdk/src/wallet/wallet-approval-auth.d.ts +0 -212
- package/dist/plugin-sdk/src/wallet/wallet-audit-log.d.ts +0 -18
- package/dist/plugin-sdk/src/wallet/wallet-canary.d.ts +0 -47
- package/dist/plugin-sdk/src/wallet/wallet-custody.d.ts +0 -313
- package/dist/plugin-sdk/src/wallet/wallet-inbound-events.d.ts +0 -88
- package/dist/plugin-sdk/src/wallet/wallet-observability.d.ts +0 -16
- package/dist/plugin-sdk/src/wallet/wallet-policy-simulation.d.ts +0 -61
- package/dist/plugin-sdk/src/wallet/wallet-policy.d.ts +0 -144
- package/dist/plugin-sdk/src/wallet/wallet-provider-adapter.d.ts +0 -111
- package/dist/plugin-sdk/src/wallet/wallet-provider-capabilities.d.ts +0 -51
- package/dist/plugin-sdk/src/wallet/wallet-provider-registry.d.ts +0 -128
- package/dist/plugin-sdk/src/wallet/wallet-provider-resolver.d.ts +0 -17
- package/dist/plugin-sdk/src/wallet/wallet-redaction.d.ts +0 -3
- package/dist/plugin-sdk/src/wallet/wallet-runtime-config.d.ts +0 -93
- package/dist/plugin-sdk/src/wallet/wallet-secrets-store.d.ts +0 -63
- package/dist/plugin-sdk/src/wallet/wallet-send-approvals.d.ts +0 -165
- package/dist/plugin-sdk/src/wallet/wallet-settlement-links.d.ts +0 -57
- package/dist/plugin-sdk/src/wallet/wallet-status.d.ts +0 -106
- package/dist/plugin-sdk/src/wallet/wallet-task-ledger.d.ts +0 -7
- package/dist/plugin-sdk/src/web/accounts.d.ts +0 -39
- package/dist/plugin-sdk/src/web/active-listener.d.ts +0 -26
- package/dist/plugin-sdk/src/web/auth-store.d.ts +0 -26
- package/dist/plugin-sdk/src/web/auto-reply/constants.d.ts +0 -1
- package/dist/plugin-sdk/src/web/auto-reply/deliver-reply.d.ts +0 -19
- package/dist/plugin-sdk/src/web/auto-reply/heartbeat-runner.d.ts +0 -20
- package/dist/plugin-sdk/src/web/auto-reply/loggers.d.ts +0 -4
- package/dist/plugin-sdk/src/web/auto-reply/mentions.d.ts +0 -19
- package/dist/plugin-sdk/src/web/auto-reply/monitor/ack-reaction.d.ts +0 -13
- package/dist/plugin-sdk/src/web/auto-reply/monitor/broadcast.d.ts +0 -16
- package/dist/plugin-sdk/src/web/auto-reply/monitor/commands.d.ts +0 -2
- package/dist/plugin-sdk/src/web/auto-reply/monitor/echo.d.ts +0 -17
- package/dist/plugin-sdk/src/web/auto-reply/monitor/group-activation.d.ts +0 -9
- package/dist/plugin-sdk/src/web/auto-reply/monitor/group-gating.d.ts +0 -33
- package/dist/plugin-sdk/src/web/auto-reply/monitor/group-members.d.ts +0 -6
- package/dist/plugin-sdk/src/web/auto-reply/monitor/last-route.d.ts +0 -15
- package/dist/plugin-sdk/src/web/auto-reply/monitor/message-line.d.ts +0 -11
- package/dist/plugin-sdk/src/web/auto-reply/monitor/on-message.d.ts +0 -24
- package/dist/plugin-sdk/src/web/auto-reply/monitor/peer.d.ts +0 -2
- package/dist/plugin-sdk/src/web/auto-reply/monitor/process-message.d.ts +0 -40
- package/dist/plugin-sdk/src/web/auto-reply/monitor.d.ts +0 -5
- package/dist/plugin-sdk/src/web/auto-reply/session-snapshot.d.ts +0 -17
- package/dist/plugin-sdk/src/web/auto-reply/types.d.ts +0 -30
- package/dist/plugin-sdk/src/web/auto-reply/util.d.ts +0 -2
- package/dist/plugin-sdk/src/web/auto-reply.d.ts +0 -1
- package/dist/plugin-sdk/src/web/auto-reply.impl.d.ts +0 -6
- package/dist/plugin-sdk/src/web/inbound/access-control.d.ts +0 -36
- package/dist/plugin-sdk/src/web/inbound/dedupe.d.ts +0 -2
- package/dist/plugin-sdk/src/web/inbound/extract.d.ts +0 -13
- package/dist/plugin-sdk/src/web/inbound/media.d.ts +0 -7
- package/dist/plugin-sdk/src/web/inbound/monitor.d.ts +0 -30
- package/dist/plugin-sdk/src/web/inbound/send-api.d.ts +0 -22
- package/dist/plugin-sdk/src/web/inbound/types.d.ts +0 -41
- package/dist/plugin-sdk/src/web/inbound.d.ts +0 -4
- package/dist/plugin-sdk/src/web/login-qr.d.ts +0 -19
- package/dist/plugin-sdk/src/web/login.d.ts +0 -3
- package/dist/plugin-sdk/src/web/media.d.ts +0 -43
- package/dist/plugin-sdk/src/web/outbound.d.ts +0 -25
- package/dist/plugin-sdk/src/web/qr-image.d.ts +0 -4
- package/dist/plugin-sdk/src/web/reconnect.d.ts +0 -12
- package/dist/plugin-sdk/src/web/session.d.ts +0 -14
- package/dist/plugin-sdk/src/web/vcard.d.ts +0 -6
- package/dist/plugin-sdk/src/whatsapp/normalize.d.ts +0 -6
- package/dist/plugin-sdk/src/whatsapp/resolve-outbound-target.d.ts +0 -12
- package/dist/plugin-sdk/src/wizard/onboarding.types.d.ts +0 -31
- package/dist/plugin-sdk/src/wizard/onboarding.wallet.d.ts +0 -45
- package/dist/plugin-sdk/src/wizard/prompts.d.ts +0 -45
- package/dist/plugin-sdk/src/wizard/session.d.ts +0 -42
- package/dist/plugin-sdk/ssrf-Cce6LubA.js +0 -421
- package/dist/plugin-sdk/ssrf-Cg5wg0v3.js +0 -4
- package/dist/plugin-sdk/status-B2vb7zNW.js +0 -106417
- package/dist/plugin-sdk/sticker-cache-C1vOWkzA.js +0 -170
- package/dist/plugin-sdk/sticker-cache-CJDzqowL.js +0 -170
- package/dist/plugin-sdk/subsystem-BmpnSVOu.js +0 -358
- package/dist/plugin-sdk/tables-BD7H5ug-.js +0 -55
- package/dist/plugin-sdk/tables-CJE8kB35.js +0 -55
- package/dist/plugin-sdk/target-errors-kz4lDpCF.js +0 -26
- package/dist/plugin-sdk/targets-4QTk4tTz.js +0 -45
- package/dist/plugin-sdk/targets-DmSpDM4F.js +0 -45
- package/dist/plugin-sdk/targets-cA134MEE.js +0 -101
- package/dist/plugin-sdk/targets-t1hbjHdJ.js +0 -101
- package/dist/plugin-sdk/telegram-actions-BoiC9J7L.js +0 -307
- package/dist/plugin-sdk/telegram-actions-CwAsKaNz.js +0 -307
- package/dist/plugin-sdk/thread-bindings.lifecycle-Djem8FWF.js +0 -737
- package/dist/plugin-sdk/thread-bindings.lifecycle-gmHv3hc7.js +0 -737
- package/dist/plugin-sdk/thread-bindings.state-CNT2vxm3.js +0 -643
- package/dist/plugin-sdk/thread-bindings.state-D8kN2X6H.js +0 -643
- package/dist/plugin-sdk/token-BWZYO8QR.js +0 -36
- package/dist/plugin-sdk/tokens-BK5rrwBB.js +0 -72
- package/dist/plugin-sdk/tokens-CQRTq-NN.js +0 -72
- package/dist/plugin-sdk/tool-loop-detection-Ci_YYA7P.js +0 -352
- package/dist/plugin-sdk/transcript-events-BJQWUdmU.js +0 -24
- package/dist/plugin-sdk/ui-7sxJ-x37.js +0 -33
- package/dist/plugin-sdk/ui-BQ-Vvq_c.js +0 -33
- package/dist/plugin-sdk/utils-LGKVujSU.js +0 -237
- package/dist/plugin-sdk/web-BjV7ROeA.js +0 -2226
- package/dist/plugin-sdk/web-DjTSgU98.js +0 -2226
- package/dist/plugin-sdk/whatsapp-actions-68Mfs2dJ.js +0 -123
- package/dist/plugin-sdk/whatsapp-actions-DRqtzvTO.js +0 -123
- package/dist/plugin-sdk/wsl-DcM2PgSS.js +0 -1016
- package/dist/plugin-sdk/wsl-PXrdWitE.js +0 -1016
- /package/dist/plugin-sdk/{channel-activity-Cf5sKkfd.js → channel-activity-B7MIaDei.js} +0 -0
- /package/dist/plugin-sdk/{client-DWTXscox.js → client-BTUzO_8g.js} +0 -0
- /package/dist/plugin-sdk/{command-poll-backoff-C2vOB38t.js → command-poll-backoff-CBq0jVRw.js} +0 -0
- /package/dist/plugin-sdk/{date-time-Bo5FVB7G.js → date-time-Bbp5JvNw.js} +0 -0
- /package/dist/plugin-sdk/{diagnostic-session-state-CT36_PCE.js → diagnostic-session-state-B-9PL5r7.js} +0 -0
- /package/dist/plugin-sdk/{draft-stream-loop-2KC6-8CG.js → draft-stream-loop-DZ1OAyye.js} +0 -0
- /package/dist/plugin-sdk/{fetch-headers-BTcaUCW6.js → fetch-headers-DvXyXtoI.js} +0 -0
- /package/dist/plugin-sdk/{fetch-timeout-Dyj5Y_Ss.js → fetch-timeout-jOIu9Xud.js} +0 -0
- /package/dist/plugin-sdk/{gateway-registry-CtUjFG3Q.js → gateway-registry-C-MTEdvG.js} +0 -0
- /package/dist/plugin-sdk/{inbound-context-Daf9i2Me.js → inbound-context-BNCTzgjG.js} +0 -0
- /package/dist/plugin-sdk/{internal-DFhCtnuk.js → internal-CC6TMTtc.js} +0 -0
- /package/dist/plugin-sdk/{media-payload-CcW51vQj.js → media-payload-DpYEcV-X.js} +0 -0
- /package/dist/plugin-sdk/{polls-B4cMiwMo.js → polls-Dy1NsYKT.js} +0 -0
- /package/dist/plugin-sdk/{proxy-CKQOQYAl.js → proxy-R5TjOIFS.js} +0 -0
- /package/dist/plugin-sdk/{qmd-scope-ubzoBMhc.js → qmd-scope-C9tRnohc.js} +0 -0
- /package/dist/plugin-sdk/{redact-identifier-BAD7jXcr.js → redact-identifier-CDvAeiFm.js} +0 -0
- /package/dist/plugin-sdk/{redact-sensitive-url-DK8OUExz.js → redact-sensitive-url-B0RJQqO7.js} +0 -0
- /package/dist/plugin-sdk/{render-C9LkRUhd.js → render-K7NwXvVu.js} +0 -0
- /package/dist/plugin-sdk/{reply-reference-DxIu2vr0.js → reply-reference-CWEIswqw.js} +0 -0
- /package/dist/plugin-sdk/{secure-random-CO1VkMEt.js → secure-random-C2EhANj2.js} +0 -0
- /package/dist/plugin-sdk/{target-errors-Dn4aykSV.js → target-errors-C0yNDbGS.js} +0 -0
- /package/dist/plugin-sdk/{tool-loop-detection-D6OX2-I9.js → tool-loop-detection-P5u2k0_f.js} +0 -0
- /package/dist/plugin-sdk/{with-timeout-DqkblR98.js → with-timeout-Dl513q34.js} +0 -0
|
@@ -1,3792 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { Lt as requireApiKey, Rt as resolveApiKeyForProvider, St as normalizeProviderId, Yn as formatErrorMessage, er as isTruthyEnvValue } from "./config-CgwTaper.js";
|
|
3
|
-
import { S as truncateUtf16Safe, h as resolveUserPath } from "./utils-LGKVujSU.js";
|
|
4
|
-
import { t as createSubsystemLogger } from "./subsystem-BmpnSVOu.js";
|
|
5
|
-
import { a as resolveAgentDir, l as resolveAgentWorkspaceDir } from "./agent-scope-BuTbywla.js";
|
|
6
|
-
import { t as redactSensitiveText } from "./redact-Ck-wgswc.js";
|
|
7
|
-
import { n as retryAsync } from "./retry-Cq65ROXv.js";
|
|
8
|
-
import { c as resolveSessionTranscriptsDirForAgent } from "./paths-DTurNPnO.js";
|
|
9
|
-
import { n as onSessionTranscriptUpdate } from "./transcript-events-BJQWUdmU.js";
|
|
10
|
-
import { s as importOptionalRuntimeDependency } from "./ssrf-Cce6LubA.js";
|
|
11
|
-
import { n as redactSensitiveUrlLikeString } from "./redact-sensitive-url-DK8OUExz.js";
|
|
12
|
-
import { t as fetchWithSsrFGuard } from "./fetch-guard-BLdujDnt.js";
|
|
13
|
-
import { t as resolveMemorySearchConfig } from "./memory-search-B-0Fwnrp.js";
|
|
14
|
-
import { a as hashText, c as normalizeExtraMemoryPaths, d as remapChunkLines, f as runWithConcurrency, i as ensureDir, m as statRegularFile, n as chunkMarkdown, o as isMemoryPath, p as isFileMissingError, r as cosineSimilarity, s as listMemoryFiles, t as buildFileEntry, u as parseEmbedding } from "./internal-DMTDEiDF.js";
|
|
15
|
-
import { a as sessionPathForFile, i as listSessionFilesForAgent, n as requireNodeSqlite, r as buildSessionEntry, t as extractKeywords } from "./query-expansion-DjJAUtDU.js";
|
|
16
|
-
import fs from "node:fs";
|
|
17
|
-
import { randomUUID } from "node:crypto";
|
|
18
|
-
import path from "node:path";
|
|
19
|
-
import fs$1 from "node:fs/promises";
|
|
20
|
-
import { Readable } from "node:stream";
|
|
21
|
-
import { createInterface } from "node:readline";
|
|
22
|
-
import chokidar from "chokidar";
|
|
23
|
-
|
|
24
|
-
//#region src/agents/live-auth-keys.ts
|
|
25
|
-
const KEY_SPLIT_RE = /[\s,;]+/g;
|
|
26
|
-
const GOOGLE_LIVE_SINGLE_KEY = "FASED_LIVE_GEMINI_KEY";
|
|
27
|
-
const PROVIDER_PREFIX_OVERRIDES = { google: "GEMINI" };
|
|
28
|
-
const PROVIDER_API_KEY_CONFIG = {
|
|
29
|
-
anthropic: {
|
|
30
|
-
liveSingle: "FASED_LIVE_ANTHROPIC_KEY",
|
|
31
|
-
listVar: "FASED_LIVE_ANTHROPIC_KEYS",
|
|
32
|
-
primaryVar: "ANTHROPIC_API_KEY",
|
|
33
|
-
prefixedVar: "ANTHROPIC_API_KEY_"
|
|
34
|
-
},
|
|
35
|
-
google: {
|
|
36
|
-
liveSingle: GOOGLE_LIVE_SINGLE_KEY,
|
|
37
|
-
listVar: "GEMINI_API_KEYS",
|
|
38
|
-
primaryVar: "GEMINI_API_KEY",
|
|
39
|
-
prefixedVar: "GEMINI_API_KEY_"
|
|
40
|
-
},
|
|
41
|
-
openai: {
|
|
42
|
-
liveSingle: "FASED_LIVE_OPENAI_KEY",
|
|
43
|
-
listVar: "OPENAI_API_KEYS",
|
|
44
|
-
primaryVar: "OPENAI_API_KEY",
|
|
45
|
-
prefixedVar: "OPENAI_API_KEY_"
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
function parseKeyList(raw) {
|
|
49
|
-
if (!raw) return [];
|
|
50
|
-
return raw.split(KEY_SPLIT_RE).map((value) => value.trim()).filter(Boolean);
|
|
51
|
-
}
|
|
52
|
-
function collectEnvPrefixedKeys(prefix) {
|
|
53
|
-
const keys = [];
|
|
54
|
-
for (const [name, value] of Object.entries(process.env)) {
|
|
55
|
-
if (!name.startsWith(prefix)) continue;
|
|
56
|
-
const trimmed = value?.trim();
|
|
57
|
-
if (!trimmed) continue;
|
|
58
|
-
keys.push(trimmed);
|
|
59
|
-
}
|
|
60
|
-
return keys;
|
|
61
|
-
}
|
|
62
|
-
function resolveProviderApiKeyConfig(provider) {
|
|
63
|
-
const normalized = normalizeProviderId(provider);
|
|
64
|
-
const custom = PROVIDER_API_KEY_CONFIG[normalized];
|
|
65
|
-
const base = PROVIDER_PREFIX_OVERRIDES[normalized] ?? normalized.toUpperCase().replace(/-/g, "_");
|
|
66
|
-
const liveSingle = custom?.liveSingle ?? `FASED_LIVE_${base}_KEY`;
|
|
67
|
-
const listVar = custom?.listVar ?? `${base}_API_KEYS`;
|
|
68
|
-
const primaryVar = custom?.primaryVar ?? `${base}_API_KEY`;
|
|
69
|
-
const prefixedVar = custom?.prefixedVar ?? `${base}_API_KEY_`;
|
|
70
|
-
if (normalized === "google") return {
|
|
71
|
-
liveSingle,
|
|
72
|
-
listVar,
|
|
73
|
-
primaryVar,
|
|
74
|
-
prefixedVar,
|
|
75
|
-
fallbackVars: ["GOOGLE_API_KEY"]
|
|
76
|
-
};
|
|
77
|
-
return {
|
|
78
|
-
liveSingle,
|
|
79
|
-
listVar,
|
|
80
|
-
primaryVar,
|
|
81
|
-
prefixedVar,
|
|
82
|
-
fallbackVars: []
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function collectProviderApiKeys(provider) {
|
|
86
|
-
const config = resolveProviderApiKeyConfig(provider);
|
|
87
|
-
const forcedSingle = config.liveSingle ? process.env[config.liveSingle]?.trim() : void 0;
|
|
88
|
-
if (forcedSingle) return [forcedSingle];
|
|
89
|
-
const fromList = parseKeyList(config.listVar ? process.env[config.listVar] : void 0);
|
|
90
|
-
const primary = config.primaryVar ? process.env[config.primaryVar]?.trim() : void 0;
|
|
91
|
-
const fromPrefixed = config.prefixedVar ? collectEnvPrefixedKeys(config.prefixedVar) : [];
|
|
92
|
-
const fallback = config.fallbackVars.map((envVar) => process.env[envVar]?.trim()).filter(Boolean);
|
|
93
|
-
const seen = /* @__PURE__ */ new Set();
|
|
94
|
-
const add = (value) => {
|
|
95
|
-
if (!value) return;
|
|
96
|
-
if (seen.has(value)) return;
|
|
97
|
-
seen.add(value);
|
|
98
|
-
};
|
|
99
|
-
for (const value of fromList) add(value);
|
|
100
|
-
add(primary);
|
|
101
|
-
for (const value of fromPrefixed) add(value);
|
|
102
|
-
for (const value of fallback) add(value);
|
|
103
|
-
return Array.from(seen);
|
|
104
|
-
}
|
|
105
|
-
function isApiKeyRateLimitError(message) {
|
|
106
|
-
const lower = message.toLowerCase();
|
|
107
|
-
if (lower.includes("rate_limit")) return true;
|
|
108
|
-
if (lower.includes("rate limit")) return true;
|
|
109
|
-
if (lower.includes("429")) return true;
|
|
110
|
-
if (lower.includes("quota exceeded") || lower.includes("quota_exceeded")) return true;
|
|
111
|
-
if (lower.includes("resource exhausted") || lower.includes("resource_exhausted")) return true;
|
|
112
|
-
if (lower.includes("too many requests")) return true;
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region src/agents/api-key-rotation.ts
|
|
118
|
-
function dedupeApiKeys(raw) {
|
|
119
|
-
const seen = /* @__PURE__ */ new Set();
|
|
120
|
-
const keys = [];
|
|
121
|
-
for (const value of raw) {
|
|
122
|
-
const apiKey = value.trim();
|
|
123
|
-
if (!apiKey || seen.has(apiKey)) continue;
|
|
124
|
-
seen.add(apiKey);
|
|
125
|
-
keys.push(apiKey);
|
|
126
|
-
}
|
|
127
|
-
return keys;
|
|
128
|
-
}
|
|
129
|
-
function collectProviderApiKeysForExecution(params) {
|
|
130
|
-
const { primaryApiKey, provider } = params;
|
|
131
|
-
return dedupeApiKeys([primaryApiKey?.trim() ?? "", ...collectProviderApiKeys(provider)]);
|
|
132
|
-
}
|
|
133
|
-
async function executeWithApiKeyRotation(params) {
|
|
134
|
-
const keys = dedupeApiKeys(params.apiKeys);
|
|
135
|
-
if (keys.length === 0) throw new Error(`No API keys configured for provider "${params.provider}".`);
|
|
136
|
-
let lastError;
|
|
137
|
-
for (let attempt = 0; attempt < keys.length; attempt += 1) {
|
|
138
|
-
const apiKey = keys[attempt];
|
|
139
|
-
try {
|
|
140
|
-
return await params.execute(apiKey);
|
|
141
|
-
} catch (error) {
|
|
142
|
-
lastError = error;
|
|
143
|
-
const message = formatErrorMessage(error);
|
|
144
|
-
if (!(params.shouldRetry ? params.shouldRetry({
|
|
145
|
-
apiKey,
|
|
146
|
-
error,
|
|
147
|
-
attempt,
|
|
148
|
-
message
|
|
149
|
-
}) : isApiKeyRateLimitError(message)) || attempt + 1 >= keys.length) break;
|
|
150
|
-
params.onRetry?.({
|
|
151
|
-
apiKey,
|
|
152
|
-
error,
|
|
153
|
-
attempt,
|
|
154
|
-
message
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (lastError === void 0) throw new Error(`Failed to run API request for ${params.provider}.`);
|
|
159
|
-
throw lastError;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
//#endregion
|
|
163
|
-
//#region src/infra/gemini-auth.ts
|
|
164
|
-
/**
|
|
165
|
-
* Shared Gemini authentication utilities.
|
|
166
|
-
*
|
|
167
|
-
* Supports both traditional API keys and OAuth JSON format.
|
|
168
|
-
*/
|
|
169
|
-
/**
|
|
170
|
-
* Parse Gemini API key and return appropriate auth headers.
|
|
171
|
-
*
|
|
172
|
-
* OAuth format: `{"token": "...", "projectId": "..."}`
|
|
173
|
-
*
|
|
174
|
-
* @param apiKey - Either a traditional API key string or OAuth JSON
|
|
175
|
-
* @returns Headers object with appropriate authentication
|
|
176
|
-
*/
|
|
177
|
-
function parseGeminiAuth(apiKey) {
|
|
178
|
-
if (apiKey.startsWith("{")) try {
|
|
179
|
-
const parsed = JSON.parse(apiKey);
|
|
180
|
-
if (typeof parsed.token === "string" && parsed.token) return { headers: {
|
|
181
|
-
Authorization: `Bearer ${parsed.token}`,
|
|
182
|
-
"Content-Type": "application/json"
|
|
183
|
-
} };
|
|
184
|
-
} catch {}
|
|
185
|
-
return { headers: {
|
|
186
|
-
"x-goog-api-key": apiKey,
|
|
187
|
-
"Content-Type": "application/json"
|
|
188
|
-
} };
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region src/memory/embeddings-debug.ts
|
|
193
|
-
const debugEmbeddings = isTruthyEnvValue(process.env.FASED_DEBUG_MEMORY_EMBEDDINGS);
|
|
194
|
-
const log$3 = createSubsystemLogger("memory/embeddings");
|
|
195
|
-
function debugEmbeddingsLog(message, meta) {
|
|
196
|
-
if (!debugEmbeddings) return;
|
|
197
|
-
const suffix = meta ? ` ${JSON.stringify(meta)}` : "";
|
|
198
|
-
log$3.raw(`${message}${suffix}`);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
//#endregion
|
|
202
|
-
//#region src/memory/remote-http.ts
|
|
203
|
-
function buildRemoteBaseUrlPolicy(baseUrl) {
|
|
204
|
-
const trimmed = baseUrl.trim();
|
|
205
|
-
if (!trimmed) return;
|
|
206
|
-
try {
|
|
207
|
-
const parsed = new URL(trimmed);
|
|
208
|
-
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return;
|
|
209
|
-
return { allowedHostnames: [parsed.hostname] };
|
|
210
|
-
} catch {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
async function withRemoteHttpResponse(params) {
|
|
215
|
-
const { response, release } = await fetchWithSsrFGuard({
|
|
216
|
-
url: params.url,
|
|
217
|
-
init: params.init,
|
|
218
|
-
policy: params.ssrfPolicy,
|
|
219
|
-
auditContext: params.auditContext ?? "memory-remote"
|
|
220
|
-
});
|
|
221
|
-
try {
|
|
222
|
-
return await params.onResponse(response);
|
|
223
|
-
} finally {
|
|
224
|
-
await release();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
//#endregion
|
|
229
|
-
//#region src/memory/embeddings-gemini.ts
|
|
230
|
-
const DEFAULT_GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
231
|
-
const DEFAULT_GEMINI_EMBEDDING_MODEL = "gemini-embedding-001";
|
|
232
|
-
const GEMINI_MAX_INPUT_TOKENS = { "text-embedding-004": 2048 };
|
|
233
|
-
function resolveRemoteApiKey(remoteApiKey) {
|
|
234
|
-
const trimmed = remoteApiKey?.trim();
|
|
235
|
-
if (!trimmed) return;
|
|
236
|
-
if (trimmed === "GOOGLE_API_KEY" || trimmed === "GEMINI_API_KEY") return process.env[trimmed]?.trim();
|
|
237
|
-
return trimmed;
|
|
238
|
-
}
|
|
239
|
-
function normalizeGeminiModel(model) {
|
|
240
|
-
const trimmed = model.trim();
|
|
241
|
-
if (!trimmed) return DEFAULT_GEMINI_EMBEDDING_MODEL;
|
|
242
|
-
const withoutPrefix = trimmed.replace(/^models\//, "");
|
|
243
|
-
if (withoutPrefix.startsWith("gemini/")) return withoutPrefix.slice(7);
|
|
244
|
-
if (withoutPrefix.startsWith("google/")) return withoutPrefix.slice(7);
|
|
245
|
-
return withoutPrefix;
|
|
246
|
-
}
|
|
247
|
-
function normalizeGeminiBaseUrl(raw) {
|
|
248
|
-
const trimmed = raw.replace(/\/+$/, "");
|
|
249
|
-
const openAiIndex = trimmed.indexOf("/openai");
|
|
250
|
-
if (openAiIndex > -1) return trimmed.slice(0, openAiIndex);
|
|
251
|
-
return trimmed;
|
|
252
|
-
}
|
|
253
|
-
function buildGeminiModelPath(model) {
|
|
254
|
-
return model.startsWith("models/") ? model : `models/${model}`;
|
|
255
|
-
}
|
|
256
|
-
async function createGeminiEmbeddingProvider(options) {
|
|
257
|
-
const client = await resolveGeminiEmbeddingClient(options);
|
|
258
|
-
const baseUrl = client.baseUrl.replace(/\/$/, "");
|
|
259
|
-
const embedUrl = `${baseUrl}/${client.modelPath}:embedContent`;
|
|
260
|
-
const batchUrl = `${baseUrl}/${client.modelPath}:batchEmbedContents`;
|
|
261
|
-
const fetchWithGeminiAuth = async (apiKey, endpoint, body) => {
|
|
262
|
-
const headers = {
|
|
263
|
-
...parseGeminiAuth(apiKey).headers,
|
|
264
|
-
...client.headers
|
|
265
|
-
};
|
|
266
|
-
return await withRemoteHttpResponse({
|
|
267
|
-
url: endpoint,
|
|
268
|
-
ssrfPolicy: client.ssrfPolicy,
|
|
269
|
-
init: {
|
|
270
|
-
method: "POST",
|
|
271
|
-
headers,
|
|
272
|
-
body: JSON.stringify(body)
|
|
273
|
-
},
|
|
274
|
-
onResponse: async (res) => {
|
|
275
|
-
if (!res.ok) {
|
|
276
|
-
const text = await res.text();
|
|
277
|
-
throw new Error(`gemini embeddings failed: ${res.status} ${text}`);
|
|
278
|
-
}
|
|
279
|
-
return await res.json();
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
const embedQuery = async (text) => {
|
|
284
|
-
if (!text.trim()) return [];
|
|
285
|
-
return (await executeWithApiKeyRotation({
|
|
286
|
-
provider: "google",
|
|
287
|
-
apiKeys: client.apiKeys,
|
|
288
|
-
execute: (apiKey) => fetchWithGeminiAuth(apiKey, embedUrl, {
|
|
289
|
-
content: { parts: [{ text }] },
|
|
290
|
-
taskType: "RETRIEVAL_QUERY"
|
|
291
|
-
})
|
|
292
|
-
})).embedding?.values ?? [];
|
|
293
|
-
};
|
|
294
|
-
const embedBatch = async (texts) => {
|
|
295
|
-
if (texts.length === 0) return [];
|
|
296
|
-
const requests = texts.map((text) => ({
|
|
297
|
-
model: client.modelPath,
|
|
298
|
-
content: { parts: [{ text }] },
|
|
299
|
-
taskType: "RETRIEVAL_DOCUMENT"
|
|
300
|
-
}));
|
|
301
|
-
const payload = await executeWithApiKeyRotation({
|
|
302
|
-
provider: "google",
|
|
303
|
-
apiKeys: client.apiKeys,
|
|
304
|
-
execute: (apiKey) => fetchWithGeminiAuth(apiKey, batchUrl, { requests })
|
|
305
|
-
});
|
|
306
|
-
const embeddings = Array.isArray(payload.embeddings) ? payload.embeddings : [];
|
|
307
|
-
return texts.map((_, index) => embeddings[index]?.values ?? []);
|
|
308
|
-
};
|
|
309
|
-
return {
|
|
310
|
-
provider: {
|
|
311
|
-
id: "gemini",
|
|
312
|
-
model: client.model,
|
|
313
|
-
maxInputTokens: GEMINI_MAX_INPUT_TOKENS[client.model],
|
|
314
|
-
embedQuery,
|
|
315
|
-
embedBatch
|
|
316
|
-
},
|
|
317
|
-
client
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
async function resolveGeminiEmbeddingClient(options) {
|
|
321
|
-
const remote = options.remote;
|
|
322
|
-
const remoteApiKey = resolveRemoteApiKey(remote?.apiKey);
|
|
323
|
-
const remoteBaseUrl = remote?.baseUrl?.trim();
|
|
324
|
-
const apiKey = remoteApiKey ? remoteApiKey : requireApiKey(await resolveApiKeyForProvider({
|
|
325
|
-
provider: "google",
|
|
326
|
-
cfg: options.config,
|
|
327
|
-
agentDir: options.agentDir
|
|
328
|
-
}), "google");
|
|
329
|
-
const providerConfig = options.config.models?.providers?.google;
|
|
330
|
-
const rawBaseUrl = remoteBaseUrl || providerConfig?.baseUrl?.trim() || DEFAULT_GEMINI_BASE_URL;
|
|
331
|
-
const baseUrl = normalizeGeminiBaseUrl(rawBaseUrl);
|
|
332
|
-
const ssrfPolicy = buildRemoteBaseUrlPolicy(baseUrl);
|
|
333
|
-
const headers = { ...Object.assign({}, providerConfig?.headers, remote?.headers) };
|
|
334
|
-
const apiKeys = collectProviderApiKeysForExecution({
|
|
335
|
-
provider: "google",
|
|
336
|
-
primaryApiKey: apiKey
|
|
337
|
-
});
|
|
338
|
-
const model = normalizeGeminiModel(options.model);
|
|
339
|
-
const modelPath = buildGeminiModelPath(model);
|
|
340
|
-
debugEmbeddingsLog("memory embeddings: gemini client", {
|
|
341
|
-
rawBaseUrl,
|
|
342
|
-
baseUrl,
|
|
343
|
-
model,
|
|
344
|
-
modelPath,
|
|
345
|
-
embedEndpoint: `${baseUrl}/${modelPath}:embedContent`,
|
|
346
|
-
batchEndpoint: `${baseUrl}/${modelPath}:batchEmbedContents`
|
|
347
|
-
});
|
|
348
|
-
return {
|
|
349
|
-
baseUrl,
|
|
350
|
-
headers,
|
|
351
|
-
ssrfPolicy,
|
|
352
|
-
model,
|
|
353
|
-
modelPath,
|
|
354
|
-
apiKeys
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
//#endregion
|
|
359
|
-
//#region src/memory/embeddings-remote-client.ts
|
|
360
|
-
async function resolveRemoteEmbeddingBearerClient(params) {
|
|
361
|
-
const remote = params.options.remote;
|
|
362
|
-
const remoteApiKey = remote?.apiKey?.trim();
|
|
363
|
-
const remoteBaseUrl = remote?.baseUrl?.trim();
|
|
364
|
-
const providerConfig = params.options.config.models?.providers?.[params.provider];
|
|
365
|
-
const apiKey = remoteApiKey ? remoteApiKey : requireApiKey(await resolveApiKeyForProvider({
|
|
366
|
-
provider: params.provider,
|
|
367
|
-
cfg: params.options.config,
|
|
368
|
-
agentDir: params.options.agentDir
|
|
369
|
-
}), params.provider);
|
|
370
|
-
const baseUrl = remoteBaseUrl || providerConfig?.baseUrl?.trim() || params.defaultBaseUrl;
|
|
371
|
-
const headerOverrides = Object.assign({}, providerConfig?.headers, remote?.headers);
|
|
372
|
-
return {
|
|
373
|
-
baseUrl,
|
|
374
|
-
headers: {
|
|
375
|
-
"Content-Type": "application/json",
|
|
376
|
-
Authorization: `Bearer ${apiKey}`,
|
|
377
|
-
...headerOverrides
|
|
378
|
-
},
|
|
379
|
-
ssrfPolicy: buildRemoteBaseUrlPolicy(baseUrl)
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
//#endregion
|
|
384
|
-
//#region src/memory/post-json.ts
|
|
385
|
-
function redactRemoteErrorText(text) {
|
|
386
|
-
return redactSensitiveText(redactSensitiveUrlLikeString(text), { mode: "tools" });
|
|
387
|
-
}
|
|
388
|
-
async function postJson(params) {
|
|
389
|
-
return await withRemoteHttpResponse({
|
|
390
|
-
url: params.url,
|
|
391
|
-
ssrfPolicy: params.ssrfPolicy,
|
|
392
|
-
init: {
|
|
393
|
-
method: "POST",
|
|
394
|
-
headers: params.headers,
|
|
395
|
-
body: JSON.stringify(params.body)
|
|
396
|
-
},
|
|
397
|
-
onResponse: async (res) => {
|
|
398
|
-
if (!res.ok) {
|
|
399
|
-
const text = redactRemoteErrorText(await res.text());
|
|
400
|
-
const err = /* @__PURE__ */ new Error(`${params.errorPrefix}: ${res.status} ${text}`);
|
|
401
|
-
if (params.attachStatus) err.status = res.status;
|
|
402
|
-
throw err;
|
|
403
|
-
}
|
|
404
|
-
return await params.parse(await res.json());
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
//#endregion
|
|
410
|
-
//#region src/memory/embeddings-remote-fetch.ts
|
|
411
|
-
async function fetchRemoteEmbeddingVectors(params) {
|
|
412
|
-
return await postJson({
|
|
413
|
-
url: params.url,
|
|
414
|
-
headers: params.headers,
|
|
415
|
-
ssrfPolicy: params.ssrfPolicy,
|
|
416
|
-
body: params.body,
|
|
417
|
-
errorPrefix: params.errorPrefix,
|
|
418
|
-
parse: (payload) => {
|
|
419
|
-
return (payload.data ?? []).map((entry) => entry.embedding ?? []);
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
//#endregion
|
|
425
|
-
//#region src/memory/embeddings-remote-provider.ts
|
|
426
|
-
function createRemoteEmbeddingProvider(params) {
|
|
427
|
-
const { client } = params;
|
|
428
|
-
const url = `${client.baseUrl.replace(/\/$/, "")}/embeddings`;
|
|
429
|
-
const embed = async (input) => {
|
|
430
|
-
if (input.length === 0) return [];
|
|
431
|
-
return await fetchRemoteEmbeddingVectors({
|
|
432
|
-
url,
|
|
433
|
-
headers: client.headers,
|
|
434
|
-
ssrfPolicy: client.ssrfPolicy,
|
|
435
|
-
body: {
|
|
436
|
-
model: client.model,
|
|
437
|
-
input
|
|
438
|
-
},
|
|
439
|
-
errorPrefix: params.errorPrefix
|
|
440
|
-
});
|
|
441
|
-
};
|
|
442
|
-
return {
|
|
443
|
-
id: params.id,
|
|
444
|
-
model: client.model,
|
|
445
|
-
...typeof params.maxInputTokens === "number" ? { maxInputTokens: params.maxInputTokens } : {},
|
|
446
|
-
embedQuery: async (text) => {
|
|
447
|
-
const [vec] = await embed([text]);
|
|
448
|
-
return vec ?? [];
|
|
449
|
-
},
|
|
450
|
-
embedBatch: embed
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
async function resolveRemoteEmbeddingClient(params) {
|
|
454
|
-
const { baseUrl, headers, ssrfPolicy } = await resolveRemoteEmbeddingBearerClient({
|
|
455
|
-
provider: params.provider,
|
|
456
|
-
options: params.options,
|
|
457
|
-
defaultBaseUrl: params.defaultBaseUrl
|
|
458
|
-
});
|
|
459
|
-
return {
|
|
460
|
-
baseUrl,
|
|
461
|
-
headers,
|
|
462
|
-
ssrfPolicy,
|
|
463
|
-
model: params.normalizeModel(params.options.model)
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
//#endregion
|
|
468
|
-
//#region src/memory/embeddings-mistral.ts
|
|
469
|
-
const DEFAULT_MISTRAL_EMBEDDING_MODEL = "mistral-embed";
|
|
470
|
-
const DEFAULT_MISTRAL_BASE_URL = "https://api.mistral.ai/v1";
|
|
471
|
-
function normalizeMistralModel(model) {
|
|
472
|
-
const trimmed = model.trim();
|
|
473
|
-
if (!trimmed) return DEFAULT_MISTRAL_EMBEDDING_MODEL;
|
|
474
|
-
if (trimmed.startsWith("mistral/")) return trimmed.slice(8);
|
|
475
|
-
return trimmed;
|
|
476
|
-
}
|
|
477
|
-
async function createMistralEmbeddingProvider(options) {
|
|
478
|
-
const client = await resolveMistralEmbeddingClient(options);
|
|
479
|
-
return {
|
|
480
|
-
provider: createRemoteEmbeddingProvider({
|
|
481
|
-
id: "mistral",
|
|
482
|
-
client,
|
|
483
|
-
errorPrefix: "mistral embeddings failed"
|
|
484
|
-
}),
|
|
485
|
-
client
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
async function resolveMistralEmbeddingClient(options) {
|
|
489
|
-
return await resolveRemoteEmbeddingClient({
|
|
490
|
-
provider: "mistral",
|
|
491
|
-
options,
|
|
492
|
-
defaultBaseUrl: DEFAULT_MISTRAL_BASE_URL,
|
|
493
|
-
normalizeModel: normalizeMistralModel
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
//#endregion
|
|
498
|
-
//#region src/memory/embeddings-openai.ts
|
|
499
|
-
const DEFAULT_OPENAI_EMBEDDING_MODEL = "text-embedding-3-small";
|
|
500
|
-
const DEFAULT_OPENAI_BASE_URL = "https://api.openai.com/v1";
|
|
501
|
-
const OPENAI_MAX_INPUT_TOKENS = {
|
|
502
|
-
"text-embedding-3-small": 8192,
|
|
503
|
-
"text-embedding-3-large": 8192,
|
|
504
|
-
"text-embedding-ada-002": 8191
|
|
505
|
-
};
|
|
506
|
-
function normalizeOpenAiModel(model) {
|
|
507
|
-
const trimmed = model.trim();
|
|
508
|
-
if (!trimmed) return DEFAULT_OPENAI_EMBEDDING_MODEL;
|
|
509
|
-
if (trimmed.startsWith("openai/")) return trimmed.slice(7);
|
|
510
|
-
return trimmed;
|
|
511
|
-
}
|
|
512
|
-
async function createOpenAiEmbeddingProvider(options) {
|
|
513
|
-
const client = await resolveOpenAiEmbeddingClient(options);
|
|
514
|
-
return {
|
|
515
|
-
provider: createRemoteEmbeddingProvider({
|
|
516
|
-
id: "openai",
|
|
517
|
-
client,
|
|
518
|
-
errorPrefix: "openai embeddings failed",
|
|
519
|
-
maxInputTokens: OPENAI_MAX_INPUT_TOKENS[client.model]
|
|
520
|
-
}),
|
|
521
|
-
client
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
async function resolveOpenAiEmbeddingClient(options) {
|
|
525
|
-
return await resolveRemoteEmbeddingClient({
|
|
526
|
-
provider: "openai",
|
|
527
|
-
options,
|
|
528
|
-
defaultBaseUrl: DEFAULT_OPENAI_BASE_URL,
|
|
529
|
-
normalizeModel: normalizeOpenAiModel
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
//#endregion
|
|
534
|
-
//#region src/memory/embeddings-voyage.ts
|
|
535
|
-
const DEFAULT_VOYAGE_EMBEDDING_MODEL = "voyage-4-large";
|
|
536
|
-
const DEFAULT_VOYAGE_BASE_URL = "https://api.voyageai.com/v1";
|
|
537
|
-
const VOYAGE_MAX_INPUT_TOKENS = {
|
|
538
|
-
"voyage-3": 32e3,
|
|
539
|
-
"voyage-3-lite": 16e3,
|
|
540
|
-
"voyage-code-3": 32e3
|
|
541
|
-
};
|
|
542
|
-
function normalizeVoyageModel(model) {
|
|
543
|
-
const trimmed = model.trim();
|
|
544
|
-
if (!trimmed) return DEFAULT_VOYAGE_EMBEDDING_MODEL;
|
|
545
|
-
if (trimmed.startsWith("voyage/")) return trimmed.slice(7);
|
|
546
|
-
return trimmed;
|
|
547
|
-
}
|
|
548
|
-
async function createVoyageEmbeddingProvider(options) {
|
|
549
|
-
const client = await resolveVoyageEmbeddingClient(options);
|
|
550
|
-
const url = `${client.baseUrl.replace(/\/$/, "")}/embeddings`;
|
|
551
|
-
const embed = async (input, input_type) => {
|
|
552
|
-
if (input.length === 0) return [];
|
|
553
|
-
const body = {
|
|
554
|
-
model: client.model,
|
|
555
|
-
input
|
|
556
|
-
};
|
|
557
|
-
if (input_type) body.input_type = input_type;
|
|
558
|
-
return await fetchRemoteEmbeddingVectors({
|
|
559
|
-
url,
|
|
560
|
-
headers: client.headers,
|
|
561
|
-
ssrfPolicy: client.ssrfPolicy,
|
|
562
|
-
body,
|
|
563
|
-
errorPrefix: "voyage embeddings failed"
|
|
564
|
-
});
|
|
565
|
-
};
|
|
566
|
-
return {
|
|
567
|
-
provider: {
|
|
568
|
-
id: "voyage",
|
|
569
|
-
model: client.model,
|
|
570
|
-
maxInputTokens: VOYAGE_MAX_INPUT_TOKENS[client.model],
|
|
571
|
-
embedQuery: async (text) => {
|
|
572
|
-
const [vec] = await embed([text], "query");
|
|
573
|
-
return vec ?? [];
|
|
574
|
-
},
|
|
575
|
-
embedBatch: async (texts) => embed(texts, "document")
|
|
576
|
-
},
|
|
577
|
-
client
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
async function resolveVoyageEmbeddingClient(options) {
|
|
581
|
-
const { baseUrl, headers, ssrfPolicy } = await resolveRemoteEmbeddingBearerClient({
|
|
582
|
-
provider: "voyage",
|
|
583
|
-
options,
|
|
584
|
-
defaultBaseUrl: DEFAULT_VOYAGE_BASE_URL
|
|
585
|
-
});
|
|
586
|
-
return {
|
|
587
|
-
baseUrl,
|
|
588
|
-
headers,
|
|
589
|
-
ssrfPolicy,
|
|
590
|
-
model: normalizeVoyageModel(options.model)
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
//#endregion
|
|
595
|
-
//#region src/memory/node-llama.ts
|
|
596
|
-
async function importNodeLlamaCpp() {
|
|
597
|
-
return import("node-llama-cpp");
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
//#endregion
|
|
601
|
-
//#region src/memory/embeddings.ts
|
|
602
|
-
function sanitizeAndNormalizeEmbedding(vec) {
|
|
603
|
-
const sanitized = vec.map((value) => Number.isFinite(value) ? value : 0);
|
|
604
|
-
const magnitude = Math.sqrt(sanitized.reduce((sum, value) => sum + value * value, 0));
|
|
605
|
-
if (magnitude < 1e-10) return sanitized;
|
|
606
|
-
return sanitized.map((value) => value / magnitude);
|
|
607
|
-
}
|
|
608
|
-
const REMOTE_EMBEDDING_PROVIDER_IDS = [
|
|
609
|
-
"openai",
|
|
610
|
-
"gemini",
|
|
611
|
-
"voyage",
|
|
612
|
-
"mistral"
|
|
613
|
-
];
|
|
614
|
-
const DEFAULT_LOCAL_MODEL = "hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf";
|
|
615
|
-
function canAutoSelectLocal(options) {
|
|
616
|
-
const modelPath = options.local?.modelPath?.trim();
|
|
617
|
-
if (!modelPath) return false;
|
|
618
|
-
if (/^(hf:|https?:)/i.test(modelPath)) return false;
|
|
619
|
-
const resolved = resolveUserPath(modelPath);
|
|
620
|
-
try {
|
|
621
|
-
return fs.statSync(resolved).isFile();
|
|
622
|
-
} catch {
|
|
623
|
-
return false;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
function isMissingApiKeyError(err) {
|
|
627
|
-
return formatErrorMessage(err).includes("No API key found for provider");
|
|
628
|
-
}
|
|
629
|
-
async function createLocalEmbeddingProvider(options) {
|
|
630
|
-
const modelPath = options.local?.modelPath?.trim() || DEFAULT_LOCAL_MODEL;
|
|
631
|
-
const modelCacheDir = options.local?.modelCacheDir?.trim();
|
|
632
|
-
const { getLlama, resolveModelFile, LlamaLogLevel } = await importNodeLlamaCpp();
|
|
633
|
-
let llama = null;
|
|
634
|
-
let embeddingModel = null;
|
|
635
|
-
let embeddingContext = null;
|
|
636
|
-
const ensureContext = async () => {
|
|
637
|
-
if (!llama) llama = await getLlama({ logLevel: LlamaLogLevel.error });
|
|
638
|
-
if (!embeddingModel) {
|
|
639
|
-
const resolved = await resolveModelFile(modelPath, modelCacheDir || void 0);
|
|
640
|
-
embeddingModel = await llama.loadModel({ modelPath: resolved });
|
|
641
|
-
}
|
|
642
|
-
if (!embeddingContext) embeddingContext = await embeddingModel.createEmbeddingContext();
|
|
643
|
-
return embeddingContext;
|
|
644
|
-
};
|
|
645
|
-
return {
|
|
646
|
-
id: "local",
|
|
647
|
-
model: modelPath,
|
|
648
|
-
embedQuery: async (text) => {
|
|
649
|
-
const embedding = await (await ensureContext()).getEmbeddingFor(text);
|
|
650
|
-
return sanitizeAndNormalizeEmbedding(Array.from(embedding.vector));
|
|
651
|
-
},
|
|
652
|
-
embedBatch: async (texts) => {
|
|
653
|
-
const ctx = await ensureContext();
|
|
654
|
-
return await Promise.all(texts.map(async (text) => {
|
|
655
|
-
const embedding = await ctx.getEmbeddingFor(text);
|
|
656
|
-
return sanitizeAndNormalizeEmbedding(Array.from(embedding.vector));
|
|
657
|
-
}));
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
async function createEmbeddingProvider(options) {
|
|
662
|
-
const requestedProvider = options.provider;
|
|
663
|
-
const fallback = options.fallback;
|
|
664
|
-
const createProvider = async (id) => {
|
|
665
|
-
if (id === "local") return { provider: await createLocalEmbeddingProvider(options) };
|
|
666
|
-
if (id === "gemini") {
|
|
667
|
-
const { provider, client } = await createGeminiEmbeddingProvider(options);
|
|
668
|
-
return {
|
|
669
|
-
provider,
|
|
670
|
-
gemini: client
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
if (id === "voyage") {
|
|
674
|
-
const { provider, client } = await createVoyageEmbeddingProvider(options);
|
|
675
|
-
return {
|
|
676
|
-
provider,
|
|
677
|
-
voyage: client
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
if (id === "mistral") {
|
|
681
|
-
const { provider, client } = await createMistralEmbeddingProvider(options);
|
|
682
|
-
return {
|
|
683
|
-
provider,
|
|
684
|
-
mistral: client
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
const { provider, client } = await createOpenAiEmbeddingProvider(options);
|
|
688
|
-
return {
|
|
689
|
-
provider,
|
|
690
|
-
openAi: client
|
|
691
|
-
};
|
|
692
|
-
};
|
|
693
|
-
const formatPrimaryError = (err, provider) => provider === "local" ? formatLocalSetupError(err) : formatErrorMessage(err);
|
|
694
|
-
if (requestedProvider === "auto") {
|
|
695
|
-
const missingKeyErrors = [];
|
|
696
|
-
let localError = null;
|
|
697
|
-
if (canAutoSelectLocal(options)) try {
|
|
698
|
-
return {
|
|
699
|
-
...await createProvider("local"),
|
|
700
|
-
requestedProvider
|
|
701
|
-
};
|
|
702
|
-
} catch (err) {
|
|
703
|
-
localError = formatLocalSetupError(err);
|
|
704
|
-
}
|
|
705
|
-
for (const provider of REMOTE_EMBEDDING_PROVIDER_IDS) try {
|
|
706
|
-
return {
|
|
707
|
-
...await createProvider(provider),
|
|
708
|
-
requestedProvider
|
|
709
|
-
};
|
|
710
|
-
} catch (err) {
|
|
711
|
-
const message = formatPrimaryError(err, provider);
|
|
712
|
-
if (isMissingApiKeyError(err)) {
|
|
713
|
-
missingKeyErrors.push(message);
|
|
714
|
-
continue;
|
|
715
|
-
}
|
|
716
|
-
const wrapped = new Error(message);
|
|
717
|
-
wrapped.cause = err;
|
|
718
|
-
throw wrapped;
|
|
719
|
-
}
|
|
720
|
-
const details = [...missingKeyErrors, localError].filter(Boolean);
|
|
721
|
-
return {
|
|
722
|
-
provider: null,
|
|
723
|
-
requestedProvider,
|
|
724
|
-
providerUnavailableReason: details.length > 0 ? details.join("\n\n") : "No embeddings provider available."
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
try {
|
|
728
|
-
return {
|
|
729
|
-
...await createProvider(requestedProvider),
|
|
730
|
-
requestedProvider
|
|
731
|
-
};
|
|
732
|
-
} catch (primaryErr) {
|
|
733
|
-
const reason = formatPrimaryError(primaryErr, requestedProvider);
|
|
734
|
-
if (fallback && fallback !== "none" && fallback !== requestedProvider) try {
|
|
735
|
-
return {
|
|
736
|
-
...await createProvider(fallback),
|
|
737
|
-
requestedProvider,
|
|
738
|
-
fallbackFrom: requestedProvider,
|
|
739
|
-
fallbackReason: reason
|
|
740
|
-
};
|
|
741
|
-
} catch (fallbackErr) {
|
|
742
|
-
const combinedReason = `${reason}\n\nFallback to ${fallback} failed: ${formatErrorMessage(fallbackErr)}`;
|
|
743
|
-
if (isMissingApiKeyError(primaryErr) && isMissingApiKeyError(fallbackErr)) return {
|
|
744
|
-
provider: null,
|
|
745
|
-
requestedProvider,
|
|
746
|
-
fallbackFrom: requestedProvider,
|
|
747
|
-
fallbackReason: reason,
|
|
748
|
-
providerUnavailableReason: combinedReason
|
|
749
|
-
};
|
|
750
|
-
const wrapped = new Error(combinedReason);
|
|
751
|
-
wrapped.cause = fallbackErr;
|
|
752
|
-
throw wrapped;
|
|
753
|
-
}
|
|
754
|
-
if (isMissingApiKeyError(primaryErr)) return {
|
|
755
|
-
provider: null,
|
|
756
|
-
requestedProvider,
|
|
757
|
-
providerUnavailableReason: reason
|
|
758
|
-
};
|
|
759
|
-
const wrapped = new Error(reason);
|
|
760
|
-
wrapped.cause = primaryErr;
|
|
761
|
-
throw wrapped;
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
function isNodeLlamaCppMissing(err) {
|
|
765
|
-
if (!(err instanceof Error)) return false;
|
|
766
|
-
if (err.code === "ERR_MODULE_NOT_FOUND") return err.message.includes("node-llama-cpp");
|
|
767
|
-
return false;
|
|
768
|
-
}
|
|
769
|
-
function formatLocalSetupError(err) {
|
|
770
|
-
const detail = formatErrorMessage(err);
|
|
771
|
-
const missing = isNodeLlamaCppMissing(err);
|
|
772
|
-
return [
|
|
773
|
-
"Local embeddings unavailable.",
|
|
774
|
-
missing ? "Reason: optional dependency node-llama-cpp is missing (or failed to install)." : detail ? `Reason: ${detail}` : void 0,
|
|
775
|
-
missing && detail ? `Detail: ${detail}` : null,
|
|
776
|
-
"To enable local embeddings:",
|
|
777
|
-
"1) Use Node 22 LTS (recommended for installs/updates)",
|
|
778
|
-
missing ? "2) Use a maintained source install and install the optional node-llama-cpp dependency" : null,
|
|
779
|
-
"3) With pnpm: pnpm approve-builds (select node-llama-cpp), then pnpm rebuild node-llama-cpp",
|
|
780
|
-
missing ? "The lightweight hosted runtime does not include this native add-on; use provider = \"ollama\" or a remote provider instead." : null,
|
|
781
|
-
...REMOTE_EMBEDDING_PROVIDER_IDS.map((provider) => `Or set agents.defaults.memorySearch.provider = "${provider}" (remote).`)
|
|
782
|
-
].filter(Boolean).join("\n");
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
//#endregion
|
|
786
|
-
//#region src/memory/mmr.ts
|
|
787
|
-
const DEFAULT_MMR_CONFIG = {
|
|
788
|
-
enabled: false,
|
|
789
|
-
lambda: .7
|
|
790
|
-
};
|
|
791
|
-
/**
|
|
792
|
-
* Tokenize text for Jaccard similarity computation.
|
|
793
|
-
* Extracts alphanumeric tokens and normalizes to lowercase.
|
|
794
|
-
*/
|
|
795
|
-
function tokenize(text) {
|
|
796
|
-
const tokens = text.toLowerCase().match(/[a-z0-9_]+/g) ?? [];
|
|
797
|
-
return new Set(tokens);
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* Compute Jaccard similarity between two token sets.
|
|
801
|
-
* Returns a value in [0, 1] where 1 means identical sets.
|
|
802
|
-
*/
|
|
803
|
-
function jaccardSimilarity(setA, setB) {
|
|
804
|
-
if (setA.size === 0 && setB.size === 0) return 1;
|
|
805
|
-
if (setA.size === 0 || setB.size === 0) return 0;
|
|
806
|
-
let intersectionSize = 0;
|
|
807
|
-
const smaller = setA.size <= setB.size ? setA : setB;
|
|
808
|
-
const larger = setA.size <= setB.size ? setB : setA;
|
|
809
|
-
for (const token of smaller) if (larger.has(token)) intersectionSize++;
|
|
810
|
-
const unionSize = setA.size + setB.size - intersectionSize;
|
|
811
|
-
return unionSize === 0 ? 0 : intersectionSize / unionSize;
|
|
812
|
-
}
|
|
813
|
-
/**
|
|
814
|
-
* Compute the maximum similarity between an item and all selected items.
|
|
815
|
-
*/
|
|
816
|
-
function maxSimilarityToSelected(item, selectedItems, tokenCache) {
|
|
817
|
-
if (selectedItems.length === 0) return 0;
|
|
818
|
-
let maxSim = 0;
|
|
819
|
-
const itemTokens = tokenCache.get(item.id) ?? tokenize(item.content);
|
|
820
|
-
for (const selected of selectedItems) {
|
|
821
|
-
const sim = jaccardSimilarity(itemTokens, tokenCache.get(selected.id) ?? tokenize(selected.content));
|
|
822
|
-
if (sim > maxSim) maxSim = sim;
|
|
823
|
-
}
|
|
824
|
-
return maxSim;
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Compute MMR score for a candidate item.
|
|
828
|
-
* MMR = λ * relevance - (1-λ) * max_similarity_to_selected
|
|
829
|
-
*/
|
|
830
|
-
function computeMMRScore(relevance, maxSimilarity, lambda) {
|
|
831
|
-
return lambda * relevance - (1 - lambda) * maxSimilarity;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Re-rank items using Maximal Marginal Relevance (MMR).
|
|
835
|
-
*
|
|
836
|
-
* The algorithm iteratively selects items that balance relevance with diversity:
|
|
837
|
-
* 1. Start with the highest-scoring item
|
|
838
|
-
* 2. For each remaining slot, select the item that maximizes the MMR score
|
|
839
|
-
* 3. MMR score = λ * relevance - (1-λ) * max_similarity_to_already_selected
|
|
840
|
-
*
|
|
841
|
-
* @param items - Items to re-rank, must have score and content
|
|
842
|
-
* @param config - MMR configuration (lambda, enabled)
|
|
843
|
-
* @returns Re-ranked items in MMR order
|
|
844
|
-
*/
|
|
845
|
-
function mmrRerank(items, config = {}) {
|
|
846
|
-
const { enabled = DEFAULT_MMR_CONFIG.enabled, lambda = DEFAULT_MMR_CONFIG.lambda } = config;
|
|
847
|
-
if (!enabled || items.length <= 1) return [...items];
|
|
848
|
-
const clampedLambda = Math.max(0, Math.min(1, lambda));
|
|
849
|
-
if (clampedLambda === 1) return [...items].toSorted((a, b) => b.score - a.score);
|
|
850
|
-
const tokenCache = /* @__PURE__ */ new Map();
|
|
851
|
-
for (const item of items) tokenCache.set(item.id, tokenize(item.content));
|
|
852
|
-
const maxScore = Math.max(...items.map((i) => i.score));
|
|
853
|
-
const minScore = Math.min(...items.map((i) => i.score));
|
|
854
|
-
const scoreRange = maxScore - minScore;
|
|
855
|
-
const normalizeScore = (score) => {
|
|
856
|
-
if (scoreRange === 0) return 1;
|
|
857
|
-
return (score - minScore) / scoreRange;
|
|
858
|
-
};
|
|
859
|
-
const selected = [];
|
|
860
|
-
const remaining = new Set(items);
|
|
861
|
-
while (remaining.size > 0) {
|
|
862
|
-
let bestItem = null;
|
|
863
|
-
let bestMMRScore = -Infinity;
|
|
864
|
-
for (const candidate of remaining) {
|
|
865
|
-
const mmrScore = computeMMRScore(normalizeScore(candidate.score), maxSimilarityToSelected(candidate, selected, tokenCache), clampedLambda);
|
|
866
|
-
if (mmrScore > bestMMRScore || mmrScore === bestMMRScore && candidate.score > (bestItem?.score ?? -Infinity)) {
|
|
867
|
-
bestMMRScore = mmrScore;
|
|
868
|
-
bestItem = candidate;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
if (bestItem) {
|
|
872
|
-
selected.push(bestItem);
|
|
873
|
-
remaining.delete(bestItem);
|
|
874
|
-
} else break;
|
|
875
|
-
}
|
|
876
|
-
return selected;
|
|
877
|
-
}
|
|
878
|
-
/**
|
|
879
|
-
* Apply MMR re-ranking to hybrid search results.
|
|
880
|
-
* Adapts the generic MMR function to work with the hybrid search result format.
|
|
881
|
-
*/
|
|
882
|
-
function applyMMRToHybridResults(results, config = {}) {
|
|
883
|
-
if (results.length === 0) return results;
|
|
884
|
-
const itemById = /* @__PURE__ */ new Map();
|
|
885
|
-
return mmrRerank(results.map((r, index) => {
|
|
886
|
-
const id = `${r.path}:${r.startLine}:${index}`;
|
|
887
|
-
itemById.set(id, r);
|
|
888
|
-
return {
|
|
889
|
-
id,
|
|
890
|
-
score: r.score,
|
|
891
|
-
content: r.snippet
|
|
892
|
-
};
|
|
893
|
-
}), config).map((item) => itemById.get(item.id));
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
//#endregion
|
|
897
|
-
//#region src/memory/temporal-decay.ts
|
|
898
|
-
const DEFAULT_TEMPORAL_DECAY_CONFIG = {
|
|
899
|
-
enabled: false,
|
|
900
|
-
halfLifeDays: 30
|
|
901
|
-
};
|
|
902
|
-
const DAY_MS = 1440 * 60 * 1e3;
|
|
903
|
-
const DATED_MEMORY_PATH_RE = /(?:^|\/)memory\/(\d{4})-(\d{2})-(\d{2})\.md$/;
|
|
904
|
-
function toDecayLambda(halfLifeDays) {
|
|
905
|
-
if (!Number.isFinite(halfLifeDays) || halfLifeDays <= 0) return 0;
|
|
906
|
-
return Math.LN2 / halfLifeDays;
|
|
907
|
-
}
|
|
908
|
-
function calculateTemporalDecayMultiplier(params) {
|
|
909
|
-
const lambda = toDecayLambda(params.halfLifeDays);
|
|
910
|
-
const clampedAge = Math.max(0, params.ageInDays);
|
|
911
|
-
if (lambda <= 0 || !Number.isFinite(clampedAge)) return 1;
|
|
912
|
-
return Math.exp(-lambda * clampedAge);
|
|
913
|
-
}
|
|
914
|
-
function applyTemporalDecayToScore(params) {
|
|
915
|
-
return params.score * calculateTemporalDecayMultiplier(params);
|
|
916
|
-
}
|
|
917
|
-
function parseMemoryDateFromPath(filePath) {
|
|
918
|
-
const normalized = filePath.replaceAll("\\", "/").replace(/^\.\//, "");
|
|
919
|
-
const match = DATED_MEMORY_PATH_RE.exec(normalized);
|
|
920
|
-
if (!match) return null;
|
|
921
|
-
const year = Number(match[1]);
|
|
922
|
-
const month = Number(match[2]);
|
|
923
|
-
const day = Number(match[3]);
|
|
924
|
-
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) return null;
|
|
925
|
-
const timestamp = Date.UTC(year, month - 1, day);
|
|
926
|
-
const parsed = new Date(timestamp);
|
|
927
|
-
if (parsed.getUTCFullYear() !== year || parsed.getUTCMonth() !== month - 1 || parsed.getUTCDate() !== day) return null;
|
|
928
|
-
return parsed;
|
|
929
|
-
}
|
|
930
|
-
function isEvergreenMemoryPath(filePath) {
|
|
931
|
-
const normalized = filePath.replaceAll("\\", "/").replace(/^\.\//, "");
|
|
932
|
-
if (normalized === "MEMORY.md" || normalized === "memory.md") return true;
|
|
933
|
-
if (!normalized.startsWith("memory/")) return false;
|
|
934
|
-
return !DATED_MEMORY_PATH_RE.test(normalized);
|
|
935
|
-
}
|
|
936
|
-
async function extractTimestamp(params) {
|
|
937
|
-
const fromPath = parseMemoryDateFromPath(params.filePath);
|
|
938
|
-
if (fromPath) return fromPath;
|
|
939
|
-
if (params.source === "memory" && isEvergreenMemoryPath(params.filePath)) return null;
|
|
940
|
-
if (!params.workspaceDir) return null;
|
|
941
|
-
const absolutePath = path.isAbsolute(params.filePath) ? params.filePath : path.resolve(params.workspaceDir, params.filePath);
|
|
942
|
-
try {
|
|
943
|
-
const stat = await fs$1.stat(absolutePath);
|
|
944
|
-
if (!Number.isFinite(stat.mtimeMs)) return null;
|
|
945
|
-
return new Date(stat.mtimeMs);
|
|
946
|
-
} catch {
|
|
947
|
-
return null;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
function ageInDaysFromTimestamp(timestamp, nowMs) {
|
|
951
|
-
return Math.max(0, nowMs - timestamp.getTime()) / DAY_MS;
|
|
952
|
-
}
|
|
953
|
-
async function applyTemporalDecayToHybridResults(params) {
|
|
954
|
-
const config = {
|
|
955
|
-
...DEFAULT_TEMPORAL_DECAY_CONFIG,
|
|
956
|
-
...params.temporalDecay
|
|
957
|
-
};
|
|
958
|
-
if (!config.enabled) return [...params.results];
|
|
959
|
-
const nowMs = params.nowMs ?? Date.now();
|
|
960
|
-
const timestampPromiseCache = /* @__PURE__ */ new Map();
|
|
961
|
-
return Promise.all(params.results.map(async (entry) => {
|
|
962
|
-
const cacheKey = `${entry.source}:${entry.path}`;
|
|
963
|
-
let timestampPromise = timestampPromiseCache.get(cacheKey);
|
|
964
|
-
if (!timestampPromise) {
|
|
965
|
-
timestampPromise = extractTimestamp({
|
|
966
|
-
filePath: entry.path,
|
|
967
|
-
source: entry.source,
|
|
968
|
-
workspaceDir: params.workspaceDir
|
|
969
|
-
});
|
|
970
|
-
timestampPromiseCache.set(cacheKey, timestampPromise);
|
|
971
|
-
}
|
|
972
|
-
const timestamp = await timestampPromise;
|
|
973
|
-
if (!timestamp) return entry;
|
|
974
|
-
const decayedScore = applyTemporalDecayToScore({
|
|
975
|
-
score: entry.score,
|
|
976
|
-
ageInDays: ageInDaysFromTimestamp(timestamp, nowMs),
|
|
977
|
-
halfLifeDays: config.halfLifeDays
|
|
978
|
-
});
|
|
979
|
-
return {
|
|
980
|
-
...entry,
|
|
981
|
-
score: decayedScore
|
|
982
|
-
};
|
|
983
|
-
}));
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
//#endregion
|
|
987
|
-
//#region src/memory/hybrid.ts
|
|
988
|
-
function buildFtsQuery(raw) {
|
|
989
|
-
const tokens = raw.match(/[\p{L}\p{N}_]+/gu)?.map((t) => t.trim()).filter(Boolean) ?? [];
|
|
990
|
-
if (tokens.length === 0) return null;
|
|
991
|
-
return tokens.map((t) => `"${t.replaceAll("\"", "")}"`).join(" AND ");
|
|
992
|
-
}
|
|
993
|
-
function bm25RankToScore(rank) {
|
|
994
|
-
return 1 / (1 + (Number.isFinite(rank) ? Math.max(0, rank) : 999));
|
|
995
|
-
}
|
|
996
|
-
async function mergeHybridResults(params) {
|
|
997
|
-
const byId = /* @__PURE__ */ new Map();
|
|
998
|
-
for (const r of params.vector) byId.set(r.id, {
|
|
999
|
-
id: r.id,
|
|
1000
|
-
path: r.path,
|
|
1001
|
-
startLine: r.startLine,
|
|
1002
|
-
endLine: r.endLine,
|
|
1003
|
-
source: r.source,
|
|
1004
|
-
snippet: r.snippet,
|
|
1005
|
-
vectorScore: r.vectorScore,
|
|
1006
|
-
textScore: 0
|
|
1007
|
-
});
|
|
1008
|
-
for (const r of params.keyword) {
|
|
1009
|
-
const existing = byId.get(r.id);
|
|
1010
|
-
if (existing) {
|
|
1011
|
-
existing.textScore = r.textScore;
|
|
1012
|
-
if (r.snippet && r.snippet.length > 0) existing.snippet = r.snippet;
|
|
1013
|
-
} else byId.set(r.id, {
|
|
1014
|
-
id: r.id,
|
|
1015
|
-
path: r.path,
|
|
1016
|
-
startLine: r.startLine,
|
|
1017
|
-
endLine: r.endLine,
|
|
1018
|
-
source: r.source,
|
|
1019
|
-
snippet: r.snippet,
|
|
1020
|
-
vectorScore: 0,
|
|
1021
|
-
textScore: r.textScore
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
const sorted = (await applyTemporalDecayToHybridResults({
|
|
1025
|
-
results: Array.from(byId.values()).map((entry) => {
|
|
1026
|
-
const score = params.vectorWeight * entry.vectorScore + params.textWeight * entry.textScore;
|
|
1027
|
-
return {
|
|
1028
|
-
path: entry.path,
|
|
1029
|
-
startLine: entry.startLine,
|
|
1030
|
-
endLine: entry.endLine,
|
|
1031
|
-
score,
|
|
1032
|
-
snippet: entry.snippet,
|
|
1033
|
-
source: entry.source
|
|
1034
|
-
};
|
|
1035
|
-
}),
|
|
1036
|
-
temporalDecay: {
|
|
1037
|
-
...DEFAULT_TEMPORAL_DECAY_CONFIG,
|
|
1038
|
-
...params.temporalDecay
|
|
1039
|
-
},
|
|
1040
|
-
workspaceDir: params.workspaceDir,
|
|
1041
|
-
nowMs: params.nowMs
|
|
1042
|
-
})).toSorted((a, b) => b.score - a.score);
|
|
1043
|
-
const mmrConfig = {
|
|
1044
|
-
...DEFAULT_MMR_CONFIG,
|
|
1045
|
-
...params.mmr
|
|
1046
|
-
};
|
|
1047
|
-
if (mmrConfig.enabled) return applyMMRToHybridResults(sorted, mmrConfig);
|
|
1048
|
-
return sorted;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
//#endregion
|
|
1052
|
-
//#region src/memory/batch-utils.ts
|
|
1053
|
-
function normalizeBatchBaseUrl(client) {
|
|
1054
|
-
return client.baseUrl?.replace(/\/$/, "") ?? "";
|
|
1055
|
-
}
|
|
1056
|
-
function buildBatchHeaders(client, params) {
|
|
1057
|
-
const headers = client.headers ? { ...client.headers } : {};
|
|
1058
|
-
if (params.json) {
|
|
1059
|
-
if (!headers["Content-Type"] && !headers["content-type"]) headers["Content-Type"] = "application/json";
|
|
1060
|
-
} else {
|
|
1061
|
-
delete headers["Content-Type"];
|
|
1062
|
-
delete headers["content-type"];
|
|
1063
|
-
}
|
|
1064
|
-
return headers;
|
|
1065
|
-
}
|
|
1066
|
-
function splitBatchRequests(requests, maxRequests) {
|
|
1067
|
-
if (requests.length <= maxRequests) return [requests];
|
|
1068
|
-
const groups = [];
|
|
1069
|
-
for (let i = 0; i < requests.length; i += maxRequests) groups.push(requests.slice(i, i + maxRequests));
|
|
1070
|
-
return groups;
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
//#endregion
|
|
1074
|
-
//#region src/memory/batch-runner.ts
|
|
1075
|
-
async function runEmbeddingBatchGroups(params) {
|
|
1076
|
-
if (params.requests.length === 0) return /* @__PURE__ */ new Map();
|
|
1077
|
-
const groups = splitBatchRequests(params.requests, params.maxRequests);
|
|
1078
|
-
const byCustomId = /* @__PURE__ */ new Map();
|
|
1079
|
-
const tasks = groups.map((group, groupIndex) => async () => {
|
|
1080
|
-
await params.runGroup({
|
|
1081
|
-
group,
|
|
1082
|
-
groupIndex,
|
|
1083
|
-
groups: groups.length,
|
|
1084
|
-
byCustomId
|
|
1085
|
-
});
|
|
1086
|
-
});
|
|
1087
|
-
params.debug?.(params.debugLabel, {
|
|
1088
|
-
requests: params.requests.length,
|
|
1089
|
-
groups: groups.length,
|
|
1090
|
-
wait: params.wait,
|
|
1091
|
-
concurrency: params.concurrency,
|
|
1092
|
-
pollIntervalMs: params.pollIntervalMs,
|
|
1093
|
-
timeoutMs: params.timeoutMs
|
|
1094
|
-
});
|
|
1095
|
-
await runWithConcurrency(tasks, params.concurrency);
|
|
1096
|
-
return byCustomId;
|
|
1097
|
-
}
|
|
1098
|
-
function buildEmbeddingBatchGroupOptions(params, options) {
|
|
1099
|
-
return {
|
|
1100
|
-
requests: params.requests,
|
|
1101
|
-
maxRequests: options.maxRequests,
|
|
1102
|
-
wait: params.wait,
|
|
1103
|
-
pollIntervalMs: params.pollIntervalMs,
|
|
1104
|
-
timeoutMs: params.timeoutMs,
|
|
1105
|
-
concurrency: params.concurrency,
|
|
1106
|
-
debug: params.debug,
|
|
1107
|
-
debugLabel: options.debugLabel
|
|
1108
|
-
};
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
//#endregion
|
|
1112
|
-
//#region src/memory/batch-gemini.ts
|
|
1113
|
-
const GEMINI_BATCH_MAX_REQUESTS = 5e4;
|
|
1114
|
-
function getGeminiUploadUrl(baseUrl) {
|
|
1115
|
-
if (baseUrl.includes("/v1beta")) return baseUrl.replace(/\/v1beta\/?$/, "/upload/v1beta");
|
|
1116
|
-
return `${baseUrl.replace(/\/$/, "")}/upload`;
|
|
1117
|
-
}
|
|
1118
|
-
function buildGeminiUploadBody(params) {
|
|
1119
|
-
const boundary = `fased-${hashText(params.displayName)}`;
|
|
1120
|
-
const jsonPart = JSON.stringify({ file: {
|
|
1121
|
-
displayName: params.displayName,
|
|
1122
|
-
mimeType: "application/jsonl"
|
|
1123
|
-
} });
|
|
1124
|
-
const delimiter = `--${boundary}\r\n`;
|
|
1125
|
-
const closeDelimiter = `--${boundary}--\r\n`;
|
|
1126
|
-
const parts = [
|
|
1127
|
-
`${delimiter}Content-Type: application/json; charset=UTF-8\r\n\r\n${jsonPart}\r\n`,
|
|
1128
|
-
`${delimiter}Content-Type: application/jsonl; charset=UTF-8\r\n\r\n${params.jsonl}\r\n`,
|
|
1129
|
-
closeDelimiter
|
|
1130
|
-
];
|
|
1131
|
-
return {
|
|
1132
|
-
body: new Blob([parts.join("")], { type: "multipart/related" }),
|
|
1133
|
-
contentType: `multipart/related; boundary=${boundary}`
|
|
1134
|
-
};
|
|
1135
|
-
}
|
|
1136
|
-
async function submitGeminiBatch(params) {
|
|
1137
|
-
const baseUrl = normalizeBatchBaseUrl(params.gemini);
|
|
1138
|
-
const uploadPayload = buildGeminiUploadBody({
|
|
1139
|
-
jsonl: params.requests.map((request) => JSON.stringify({
|
|
1140
|
-
key: request.custom_id,
|
|
1141
|
-
request: {
|
|
1142
|
-
content: request.content,
|
|
1143
|
-
task_type: request.taskType
|
|
1144
|
-
}
|
|
1145
|
-
})).join("\n"),
|
|
1146
|
-
displayName: `memory-embeddings-${hashText(String(Date.now()))}`
|
|
1147
|
-
});
|
|
1148
|
-
const uploadUrl = `${getGeminiUploadUrl(baseUrl)}/files?uploadType=multipart`;
|
|
1149
|
-
debugEmbeddingsLog("memory embeddings: gemini batch upload", {
|
|
1150
|
-
uploadUrl,
|
|
1151
|
-
baseUrl,
|
|
1152
|
-
requests: params.requests.length
|
|
1153
|
-
});
|
|
1154
|
-
const filePayload = await withRemoteHttpResponse({
|
|
1155
|
-
url: uploadUrl,
|
|
1156
|
-
ssrfPolicy: params.gemini.ssrfPolicy,
|
|
1157
|
-
init: {
|
|
1158
|
-
method: "POST",
|
|
1159
|
-
headers: {
|
|
1160
|
-
...buildBatchHeaders(params.gemini, { json: false }),
|
|
1161
|
-
"Content-Type": uploadPayload.contentType
|
|
1162
|
-
},
|
|
1163
|
-
body: uploadPayload.body
|
|
1164
|
-
},
|
|
1165
|
-
onResponse: async (fileRes) => {
|
|
1166
|
-
if (!fileRes.ok) {
|
|
1167
|
-
const text = await fileRes.text();
|
|
1168
|
-
throw new Error(`gemini batch file upload failed: ${fileRes.status} ${text}`);
|
|
1169
|
-
}
|
|
1170
|
-
return await fileRes.json();
|
|
1171
|
-
}
|
|
1172
|
-
});
|
|
1173
|
-
const fileId = filePayload.name ?? filePayload.file?.name;
|
|
1174
|
-
if (!fileId) throw new Error("gemini batch file upload failed: missing file id");
|
|
1175
|
-
const batchBody = { batch: {
|
|
1176
|
-
displayName: `memory-embeddings-${params.agentId}`,
|
|
1177
|
-
inputConfig: { file_name: fileId }
|
|
1178
|
-
} };
|
|
1179
|
-
const batchEndpoint = `${baseUrl}/${params.gemini.modelPath}:asyncBatchEmbedContent`;
|
|
1180
|
-
debugEmbeddingsLog("memory embeddings: gemini batch create", {
|
|
1181
|
-
batchEndpoint,
|
|
1182
|
-
fileId
|
|
1183
|
-
});
|
|
1184
|
-
return await withRemoteHttpResponse({
|
|
1185
|
-
url: batchEndpoint,
|
|
1186
|
-
ssrfPolicy: params.gemini.ssrfPolicy,
|
|
1187
|
-
init: {
|
|
1188
|
-
method: "POST",
|
|
1189
|
-
headers: buildBatchHeaders(params.gemini, { json: true }),
|
|
1190
|
-
body: JSON.stringify(batchBody)
|
|
1191
|
-
},
|
|
1192
|
-
onResponse: async (batchRes) => {
|
|
1193
|
-
if (batchRes.ok) return await batchRes.json();
|
|
1194
|
-
const text = await batchRes.text();
|
|
1195
|
-
if (batchRes.status === 404) throw new Error("gemini batch create failed: 404 (asyncBatchEmbedContent not available for this model/baseUrl). Disable remote.batch.enabled or switch providers.");
|
|
1196
|
-
throw new Error(`gemini batch create failed: ${batchRes.status} ${text}`);
|
|
1197
|
-
}
|
|
1198
|
-
});
|
|
1199
|
-
}
|
|
1200
|
-
async function fetchGeminiBatchStatus(params) {
|
|
1201
|
-
const statusUrl = `${normalizeBatchBaseUrl(params.gemini)}/${params.batchName.startsWith("batches/") ? params.batchName : `batches/${params.batchName}`}`;
|
|
1202
|
-
debugEmbeddingsLog("memory embeddings: gemini batch status", { statusUrl });
|
|
1203
|
-
return await withRemoteHttpResponse({
|
|
1204
|
-
url: statusUrl,
|
|
1205
|
-
ssrfPolicy: params.gemini.ssrfPolicy,
|
|
1206
|
-
init: { headers: buildBatchHeaders(params.gemini, { json: true }) },
|
|
1207
|
-
onResponse: async (res) => {
|
|
1208
|
-
if (!res.ok) {
|
|
1209
|
-
const text = await res.text();
|
|
1210
|
-
throw new Error(`gemini batch status failed: ${res.status} ${text}`);
|
|
1211
|
-
}
|
|
1212
|
-
return await res.json();
|
|
1213
|
-
}
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
async function fetchGeminiFileContent(params) {
|
|
1217
|
-
const downloadUrl = `${normalizeBatchBaseUrl(params.gemini)}/${params.fileId.startsWith("files/") ? params.fileId : `files/${params.fileId}`}:download`;
|
|
1218
|
-
debugEmbeddingsLog("memory embeddings: gemini batch download", { downloadUrl });
|
|
1219
|
-
return await withRemoteHttpResponse({
|
|
1220
|
-
url: downloadUrl,
|
|
1221
|
-
ssrfPolicy: params.gemini.ssrfPolicy,
|
|
1222
|
-
init: { headers: buildBatchHeaders(params.gemini, { json: true }) },
|
|
1223
|
-
onResponse: async (res) => {
|
|
1224
|
-
if (!res.ok) {
|
|
1225
|
-
const text = await res.text();
|
|
1226
|
-
throw new Error(`gemini batch file content failed: ${res.status} ${text}`);
|
|
1227
|
-
}
|
|
1228
|
-
return await res.text();
|
|
1229
|
-
}
|
|
1230
|
-
});
|
|
1231
|
-
}
|
|
1232
|
-
function parseGeminiBatchOutput(text) {
|
|
1233
|
-
if (!text.trim()) return [];
|
|
1234
|
-
return text.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => JSON.parse(line));
|
|
1235
|
-
}
|
|
1236
|
-
async function waitForGeminiBatch(params) {
|
|
1237
|
-
const start = Date.now();
|
|
1238
|
-
let current = params.initial;
|
|
1239
|
-
while (true) {
|
|
1240
|
-
const status = current ?? await fetchGeminiBatchStatus({
|
|
1241
|
-
gemini: params.gemini,
|
|
1242
|
-
batchName: params.batchName
|
|
1243
|
-
});
|
|
1244
|
-
const state = status.state ?? "UNKNOWN";
|
|
1245
|
-
if ([
|
|
1246
|
-
"SUCCEEDED",
|
|
1247
|
-
"COMPLETED",
|
|
1248
|
-
"DONE"
|
|
1249
|
-
].includes(state)) {
|
|
1250
|
-
const outputFileId = status.outputConfig?.file ?? status.outputConfig?.fileId ?? status.metadata?.output?.responsesFile;
|
|
1251
|
-
if (!outputFileId) throw new Error(`gemini batch ${params.batchName} completed without output file`);
|
|
1252
|
-
return { outputFileId };
|
|
1253
|
-
}
|
|
1254
|
-
if ([
|
|
1255
|
-
"FAILED",
|
|
1256
|
-
"CANCELLED",
|
|
1257
|
-
"CANCELED",
|
|
1258
|
-
"EXPIRED"
|
|
1259
|
-
].includes(state)) {
|
|
1260
|
-
const message = status.error?.message ?? "unknown error";
|
|
1261
|
-
throw new Error(`gemini batch ${params.batchName} ${state}: ${message}`);
|
|
1262
|
-
}
|
|
1263
|
-
if (!params.wait) throw new Error(`gemini batch ${params.batchName} still ${state}; wait disabled`);
|
|
1264
|
-
if (Date.now() - start > params.timeoutMs) throw new Error(`gemini batch ${params.batchName} timed out after ${params.timeoutMs}ms`);
|
|
1265
|
-
params.debug?.(`gemini batch ${params.batchName} ${state}; waiting ${params.pollIntervalMs}ms`);
|
|
1266
|
-
await new Promise((resolve) => setTimeout(resolve, params.pollIntervalMs));
|
|
1267
|
-
current = void 0;
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
async function runGeminiEmbeddingBatches(params) {
|
|
1271
|
-
return await runEmbeddingBatchGroups({
|
|
1272
|
-
...buildEmbeddingBatchGroupOptions(params, {
|
|
1273
|
-
maxRequests: GEMINI_BATCH_MAX_REQUESTS,
|
|
1274
|
-
debugLabel: "memory embeddings: gemini batch submit"
|
|
1275
|
-
}),
|
|
1276
|
-
runGroup: async ({ group, groupIndex, groups, byCustomId }) => {
|
|
1277
|
-
const batchInfo = await submitGeminiBatch({
|
|
1278
|
-
gemini: params.gemini,
|
|
1279
|
-
requests: group,
|
|
1280
|
-
agentId: params.agentId
|
|
1281
|
-
});
|
|
1282
|
-
const batchName = batchInfo.name ?? "";
|
|
1283
|
-
if (!batchName) throw new Error("gemini batch create failed: missing batch name");
|
|
1284
|
-
params.debug?.("memory embeddings: gemini batch created", {
|
|
1285
|
-
batchName,
|
|
1286
|
-
state: batchInfo.state,
|
|
1287
|
-
group: groupIndex + 1,
|
|
1288
|
-
groups,
|
|
1289
|
-
requests: group.length
|
|
1290
|
-
});
|
|
1291
|
-
if (!params.wait && batchInfo.state && ![
|
|
1292
|
-
"SUCCEEDED",
|
|
1293
|
-
"COMPLETED",
|
|
1294
|
-
"DONE"
|
|
1295
|
-
].includes(batchInfo.state)) throw new Error(`gemini batch ${batchName} submitted; enable remote.batch.wait to await completion`);
|
|
1296
|
-
const completed = batchInfo.state && [
|
|
1297
|
-
"SUCCEEDED",
|
|
1298
|
-
"COMPLETED",
|
|
1299
|
-
"DONE"
|
|
1300
|
-
].includes(batchInfo.state) ? { outputFileId: batchInfo.outputConfig?.file ?? batchInfo.outputConfig?.fileId ?? batchInfo.metadata?.output?.responsesFile ?? "" } : await waitForGeminiBatch({
|
|
1301
|
-
gemini: params.gemini,
|
|
1302
|
-
batchName,
|
|
1303
|
-
wait: params.wait,
|
|
1304
|
-
pollIntervalMs: params.pollIntervalMs,
|
|
1305
|
-
timeoutMs: params.timeoutMs,
|
|
1306
|
-
debug: params.debug,
|
|
1307
|
-
initial: batchInfo
|
|
1308
|
-
});
|
|
1309
|
-
if (!completed.outputFileId) throw new Error(`gemini batch ${batchName} completed without output file`);
|
|
1310
|
-
const outputLines = parseGeminiBatchOutput(await fetchGeminiFileContent({
|
|
1311
|
-
gemini: params.gemini,
|
|
1312
|
-
fileId: completed.outputFileId
|
|
1313
|
-
}));
|
|
1314
|
-
const errors = [];
|
|
1315
|
-
const remaining = new Set(group.map((request) => request.custom_id));
|
|
1316
|
-
for (const line of outputLines) {
|
|
1317
|
-
const customId = line.key ?? line.custom_id ?? line.request_id;
|
|
1318
|
-
if (!customId) continue;
|
|
1319
|
-
remaining.delete(customId);
|
|
1320
|
-
if (line.error?.message) {
|
|
1321
|
-
errors.push(`${customId}: ${line.error.message}`);
|
|
1322
|
-
continue;
|
|
1323
|
-
}
|
|
1324
|
-
if (line.response?.error?.message) {
|
|
1325
|
-
errors.push(`${customId}: ${line.response.error.message}`);
|
|
1326
|
-
continue;
|
|
1327
|
-
}
|
|
1328
|
-
const embedding = line.embedding?.values ?? line.response?.embedding?.values ?? [];
|
|
1329
|
-
if (embedding.length === 0) {
|
|
1330
|
-
errors.push(`${customId}: empty embedding`);
|
|
1331
|
-
continue;
|
|
1332
|
-
}
|
|
1333
|
-
byCustomId.set(customId, embedding);
|
|
1334
|
-
}
|
|
1335
|
-
if (errors.length > 0) throw new Error(`gemini batch ${batchName} failed: ${errors.join("; ")}`);
|
|
1336
|
-
if (remaining.size > 0) throw new Error(`gemini batch ${batchName} missing ${remaining.size} embedding responses`);
|
|
1337
|
-
}
|
|
1338
|
-
});
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
//#endregion
|
|
1342
|
-
//#region src/memory/batch-error-utils.ts
|
|
1343
|
-
function getResponseErrorMessage(line) {
|
|
1344
|
-
const body = line?.response?.body;
|
|
1345
|
-
if (typeof body === "string") return body || void 0;
|
|
1346
|
-
if (!body || typeof body !== "object") return;
|
|
1347
|
-
return typeof body.error?.message === "string" ? body.error.message : void 0;
|
|
1348
|
-
}
|
|
1349
|
-
function extractBatchErrorMessage(lines) {
|
|
1350
|
-
const first = lines.find((line) => line.error?.message || getResponseErrorMessage(line));
|
|
1351
|
-
return first?.error?.message ?? getResponseErrorMessage(first);
|
|
1352
|
-
}
|
|
1353
|
-
function formatUnavailableBatchError(err) {
|
|
1354
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1355
|
-
return message ? `error file unavailable: ${message}` : void 0;
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
//#endregion
|
|
1359
|
-
//#region src/memory/batch-http.ts
|
|
1360
|
-
async function postJsonWithRetry(params) {
|
|
1361
|
-
return await retryAsync(async () => {
|
|
1362
|
-
return await postJson({
|
|
1363
|
-
url: params.url,
|
|
1364
|
-
headers: params.headers,
|
|
1365
|
-
ssrfPolicy: params.ssrfPolicy,
|
|
1366
|
-
body: params.body,
|
|
1367
|
-
errorPrefix: params.errorPrefix,
|
|
1368
|
-
attachStatus: true,
|
|
1369
|
-
parse: async (payload) => payload
|
|
1370
|
-
});
|
|
1371
|
-
}, {
|
|
1372
|
-
attempts: 3,
|
|
1373
|
-
minDelayMs: 300,
|
|
1374
|
-
maxDelayMs: 2e3,
|
|
1375
|
-
jitter: .2,
|
|
1376
|
-
shouldRetry: (err) => {
|
|
1377
|
-
const status = err.status;
|
|
1378
|
-
return status === 429 || typeof status === "number" && status >= 500;
|
|
1379
|
-
}
|
|
1380
|
-
});
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
|
-
//#endregion
|
|
1384
|
-
//#region src/memory/batch-output.ts
|
|
1385
|
-
function applyEmbeddingBatchOutputLine(params) {
|
|
1386
|
-
const customId = params.line.custom_id;
|
|
1387
|
-
if (!customId) return;
|
|
1388
|
-
params.remaining.delete(customId);
|
|
1389
|
-
const errorMessage = params.line.error?.message;
|
|
1390
|
-
if (errorMessage) {
|
|
1391
|
-
params.errors.push(`${customId}: ${errorMessage}`);
|
|
1392
|
-
return;
|
|
1393
|
-
}
|
|
1394
|
-
const response = params.line.response;
|
|
1395
|
-
if ((response?.status_code ?? 0) >= 400) {
|
|
1396
|
-
const messageFromObject = response?.body && typeof response.body === "object" ? response.body.error?.message : void 0;
|
|
1397
|
-
const messageFromString = typeof response?.body === "string" ? response.body : void 0;
|
|
1398
|
-
params.errors.push(`${customId}: ${messageFromObject ?? messageFromString ?? "unknown error"}`);
|
|
1399
|
-
return;
|
|
1400
|
-
}
|
|
1401
|
-
const embedding = (response?.body && typeof response.body === "object" ? response.body.data ?? [] : [])[0]?.embedding ?? [];
|
|
1402
|
-
if (embedding.length === 0) {
|
|
1403
|
-
params.errors.push(`${customId}: empty embedding`);
|
|
1404
|
-
return;
|
|
1405
|
-
}
|
|
1406
|
-
params.byCustomId.set(customId, embedding);
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
//#endregion
|
|
1410
|
-
//#region src/memory/batch-provider-common.ts
|
|
1411
|
-
const EMBEDDING_BATCH_ENDPOINT = "/v1/embeddings";
|
|
1412
|
-
|
|
1413
|
-
//#endregion
|
|
1414
|
-
//#region src/memory/batch-upload.ts
|
|
1415
|
-
async function uploadBatchJsonlFile(params) {
|
|
1416
|
-
const baseUrl = normalizeBatchBaseUrl(params.client);
|
|
1417
|
-
const jsonl = params.requests.map((request) => JSON.stringify(request)).join("\n");
|
|
1418
|
-
const form = new FormData();
|
|
1419
|
-
form.append("purpose", "batch");
|
|
1420
|
-
form.append("file", new Blob([jsonl], { type: "application/jsonl" }), `memory-embeddings.${hashText(String(Date.now()))}.jsonl`);
|
|
1421
|
-
const filePayload = await withRemoteHttpResponse({
|
|
1422
|
-
url: `${baseUrl}/files`,
|
|
1423
|
-
ssrfPolicy: params.client.ssrfPolicy,
|
|
1424
|
-
init: {
|
|
1425
|
-
method: "POST",
|
|
1426
|
-
headers: buildBatchHeaders(params.client, { json: false }),
|
|
1427
|
-
body: form
|
|
1428
|
-
},
|
|
1429
|
-
onResponse: async (fileRes) => {
|
|
1430
|
-
if (!fileRes.ok) {
|
|
1431
|
-
const text = await fileRes.text();
|
|
1432
|
-
throw new Error(`${params.errorPrefix}: ${fileRes.status} ${text}`);
|
|
1433
|
-
}
|
|
1434
|
-
return await fileRes.json();
|
|
1435
|
-
}
|
|
1436
|
-
});
|
|
1437
|
-
if (!filePayload.id) throw new Error(`${params.errorPrefix}: missing file id`);
|
|
1438
|
-
return filePayload.id;
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
//#endregion
|
|
1442
|
-
//#region src/memory/batch-openai.ts
|
|
1443
|
-
const OPENAI_BATCH_ENDPOINT = EMBEDDING_BATCH_ENDPOINT;
|
|
1444
|
-
const OPENAI_BATCH_COMPLETION_WINDOW = "24h";
|
|
1445
|
-
const OPENAI_BATCH_MAX_REQUESTS = 5e4;
|
|
1446
|
-
async function submitOpenAiBatch(params) {
|
|
1447
|
-
const baseUrl = normalizeBatchBaseUrl(params.openAi);
|
|
1448
|
-
const inputFileId = await uploadBatchJsonlFile({
|
|
1449
|
-
client: params.openAi,
|
|
1450
|
-
requests: params.requests,
|
|
1451
|
-
errorPrefix: "openai batch file upload failed"
|
|
1452
|
-
});
|
|
1453
|
-
return await postJsonWithRetry({
|
|
1454
|
-
url: `${baseUrl}/batches`,
|
|
1455
|
-
headers: buildBatchHeaders(params.openAi, { json: true }),
|
|
1456
|
-
ssrfPolicy: params.openAi.ssrfPolicy,
|
|
1457
|
-
body: {
|
|
1458
|
-
input_file_id: inputFileId,
|
|
1459
|
-
endpoint: OPENAI_BATCH_ENDPOINT,
|
|
1460
|
-
completion_window: OPENAI_BATCH_COMPLETION_WINDOW,
|
|
1461
|
-
metadata: {
|
|
1462
|
-
source: "fased-memory",
|
|
1463
|
-
agent: params.agentId
|
|
1464
|
-
}
|
|
1465
|
-
},
|
|
1466
|
-
errorPrefix: "openai batch create failed"
|
|
1467
|
-
});
|
|
1468
|
-
}
|
|
1469
|
-
async function fetchOpenAiBatchStatus(params) {
|
|
1470
|
-
return await withRemoteHttpResponse({
|
|
1471
|
-
url: `${normalizeBatchBaseUrl(params.openAi)}/batches/${params.batchId}`,
|
|
1472
|
-
ssrfPolicy: params.openAi.ssrfPolicy,
|
|
1473
|
-
init: { headers: buildBatchHeaders(params.openAi, { json: true }) },
|
|
1474
|
-
onResponse: async (res) => {
|
|
1475
|
-
if (!res.ok) {
|
|
1476
|
-
const text = await res.text();
|
|
1477
|
-
throw new Error(`openai batch status failed: ${res.status} ${text}`);
|
|
1478
|
-
}
|
|
1479
|
-
return await res.json();
|
|
1480
|
-
}
|
|
1481
|
-
});
|
|
1482
|
-
}
|
|
1483
|
-
async function fetchOpenAiFileContent(params) {
|
|
1484
|
-
return await withRemoteHttpResponse({
|
|
1485
|
-
url: `${normalizeBatchBaseUrl(params.openAi)}/files/${params.fileId}/content`,
|
|
1486
|
-
ssrfPolicy: params.openAi.ssrfPolicy,
|
|
1487
|
-
init: { headers: buildBatchHeaders(params.openAi, { json: true }) },
|
|
1488
|
-
onResponse: async (res) => {
|
|
1489
|
-
if (!res.ok) {
|
|
1490
|
-
const text = await res.text();
|
|
1491
|
-
throw new Error(`openai batch file content failed: ${res.status} ${text}`);
|
|
1492
|
-
}
|
|
1493
|
-
return await res.text();
|
|
1494
|
-
}
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1497
|
-
function parseOpenAiBatchOutput(text) {
|
|
1498
|
-
if (!text.trim()) return [];
|
|
1499
|
-
return text.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => JSON.parse(line));
|
|
1500
|
-
}
|
|
1501
|
-
async function readOpenAiBatchError(params) {
|
|
1502
|
-
try {
|
|
1503
|
-
return extractBatchErrorMessage(parseOpenAiBatchOutput(await fetchOpenAiFileContent({
|
|
1504
|
-
openAi: params.openAi,
|
|
1505
|
-
fileId: params.errorFileId
|
|
1506
|
-
})));
|
|
1507
|
-
} catch (err) {
|
|
1508
|
-
return formatUnavailableBatchError(err);
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
async function waitForOpenAiBatch(params) {
|
|
1512
|
-
const start = Date.now();
|
|
1513
|
-
let current = params.initial;
|
|
1514
|
-
while (true) {
|
|
1515
|
-
const status = current ?? await fetchOpenAiBatchStatus({
|
|
1516
|
-
openAi: params.openAi,
|
|
1517
|
-
batchId: params.batchId
|
|
1518
|
-
});
|
|
1519
|
-
const state = status.status ?? "unknown";
|
|
1520
|
-
if (state === "completed") {
|
|
1521
|
-
if (!status.output_file_id) throw new Error(`openai batch ${params.batchId} completed without output file`);
|
|
1522
|
-
return {
|
|
1523
|
-
outputFileId: status.output_file_id,
|
|
1524
|
-
errorFileId: status.error_file_id ?? void 0
|
|
1525
|
-
};
|
|
1526
|
-
}
|
|
1527
|
-
if ([
|
|
1528
|
-
"failed",
|
|
1529
|
-
"expired",
|
|
1530
|
-
"cancelled",
|
|
1531
|
-
"canceled"
|
|
1532
|
-
].includes(state)) {
|
|
1533
|
-
const detail = status.error_file_id ? await readOpenAiBatchError({
|
|
1534
|
-
openAi: params.openAi,
|
|
1535
|
-
errorFileId: status.error_file_id
|
|
1536
|
-
}) : void 0;
|
|
1537
|
-
const suffix = detail ? `: ${detail}` : "";
|
|
1538
|
-
throw new Error(`openai batch ${params.batchId} ${state}${suffix}`);
|
|
1539
|
-
}
|
|
1540
|
-
if (!params.wait) throw new Error(`openai batch ${params.batchId} still ${state}; wait disabled`);
|
|
1541
|
-
if (Date.now() - start > params.timeoutMs) throw new Error(`openai batch ${params.batchId} timed out after ${params.timeoutMs}ms`);
|
|
1542
|
-
params.debug?.(`openai batch ${params.batchId} ${state}; waiting ${params.pollIntervalMs}ms`);
|
|
1543
|
-
await new Promise((resolve) => setTimeout(resolve, params.pollIntervalMs));
|
|
1544
|
-
current = void 0;
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
async function runOpenAiEmbeddingBatches(params) {
|
|
1548
|
-
return await runEmbeddingBatchGroups({
|
|
1549
|
-
...buildEmbeddingBatchGroupOptions(params, {
|
|
1550
|
-
maxRequests: OPENAI_BATCH_MAX_REQUESTS,
|
|
1551
|
-
debugLabel: "memory embeddings: openai batch submit"
|
|
1552
|
-
}),
|
|
1553
|
-
runGroup: async ({ group, groupIndex, groups, byCustomId }) => {
|
|
1554
|
-
const batchInfo = await submitOpenAiBatch({
|
|
1555
|
-
openAi: params.openAi,
|
|
1556
|
-
requests: group,
|
|
1557
|
-
agentId: params.agentId
|
|
1558
|
-
});
|
|
1559
|
-
if (!batchInfo.id) throw new Error("openai batch create failed: missing batch id");
|
|
1560
|
-
params.debug?.("memory embeddings: openai batch created", {
|
|
1561
|
-
batchId: batchInfo.id,
|
|
1562
|
-
status: batchInfo.status,
|
|
1563
|
-
group: groupIndex + 1,
|
|
1564
|
-
groups,
|
|
1565
|
-
requests: group.length
|
|
1566
|
-
});
|
|
1567
|
-
if (!params.wait && batchInfo.status !== "completed") throw new Error(`openai batch ${batchInfo.id} submitted; enable remote.batch.wait to await completion`);
|
|
1568
|
-
const completed = batchInfo.status === "completed" ? {
|
|
1569
|
-
outputFileId: batchInfo.output_file_id ?? "",
|
|
1570
|
-
errorFileId: batchInfo.error_file_id ?? void 0
|
|
1571
|
-
} : await waitForOpenAiBatch({
|
|
1572
|
-
openAi: params.openAi,
|
|
1573
|
-
batchId: batchInfo.id,
|
|
1574
|
-
wait: params.wait,
|
|
1575
|
-
pollIntervalMs: params.pollIntervalMs,
|
|
1576
|
-
timeoutMs: params.timeoutMs,
|
|
1577
|
-
debug: params.debug,
|
|
1578
|
-
initial: batchInfo
|
|
1579
|
-
});
|
|
1580
|
-
if (!completed.outputFileId) throw new Error(`openai batch ${batchInfo.id} completed without output file`);
|
|
1581
|
-
const outputLines = parseOpenAiBatchOutput(await fetchOpenAiFileContent({
|
|
1582
|
-
openAi: params.openAi,
|
|
1583
|
-
fileId: completed.outputFileId
|
|
1584
|
-
}));
|
|
1585
|
-
const errors = [];
|
|
1586
|
-
const remaining = new Set(group.map((request) => request.custom_id));
|
|
1587
|
-
for (const line of outputLines) applyEmbeddingBatchOutputLine({
|
|
1588
|
-
line,
|
|
1589
|
-
remaining,
|
|
1590
|
-
errors,
|
|
1591
|
-
byCustomId
|
|
1592
|
-
});
|
|
1593
|
-
if (errors.length > 0) throw new Error(`openai batch ${batchInfo.id} failed: ${errors.join("; ")}`);
|
|
1594
|
-
if (remaining.size > 0) throw new Error(`openai batch ${batchInfo.id} missing ${remaining.size} embedding responses`);
|
|
1595
|
-
}
|
|
1596
|
-
});
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
//#endregion
|
|
1600
|
-
//#region src/memory/batch-voyage.ts
|
|
1601
|
-
const VOYAGE_BATCH_ENDPOINT = EMBEDDING_BATCH_ENDPOINT;
|
|
1602
|
-
const VOYAGE_BATCH_COMPLETION_WINDOW = "12h";
|
|
1603
|
-
const VOYAGE_BATCH_MAX_REQUESTS = 5e4;
|
|
1604
|
-
async function submitVoyageBatch(params) {
|
|
1605
|
-
const baseUrl = normalizeBatchBaseUrl(params.client);
|
|
1606
|
-
const inputFileId = await uploadBatchJsonlFile({
|
|
1607
|
-
client: params.client,
|
|
1608
|
-
requests: params.requests,
|
|
1609
|
-
errorPrefix: "voyage batch file upload failed"
|
|
1610
|
-
});
|
|
1611
|
-
return await postJsonWithRetry({
|
|
1612
|
-
url: `${baseUrl}/batches`,
|
|
1613
|
-
headers: buildBatchHeaders(params.client, { json: true }),
|
|
1614
|
-
ssrfPolicy: params.client.ssrfPolicy,
|
|
1615
|
-
body: {
|
|
1616
|
-
input_file_id: inputFileId,
|
|
1617
|
-
endpoint: VOYAGE_BATCH_ENDPOINT,
|
|
1618
|
-
completion_window: VOYAGE_BATCH_COMPLETION_WINDOW,
|
|
1619
|
-
request_params: {
|
|
1620
|
-
model: params.client.model,
|
|
1621
|
-
input_type: "document"
|
|
1622
|
-
},
|
|
1623
|
-
metadata: {
|
|
1624
|
-
source: "fased-memory",
|
|
1625
|
-
agent: params.agentId
|
|
1626
|
-
}
|
|
1627
|
-
},
|
|
1628
|
-
errorPrefix: "voyage batch create failed"
|
|
1629
|
-
});
|
|
1630
|
-
}
|
|
1631
|
-
async function fetchVoyageBatchStatus(params) {
|
|
1632
|
-
return await withRemoteHttpResponse({
|
|
1633
|
-
url: `${normalizeBatchBaseUrl(params.client)}/batches/${params.batchId}`,
|
|
1634
|
-
ssrfPolicy: params.client.ssrfPolicy,
|
|
1635
|
-
init: { headers: buildBatchHeaders(params.client, { json: true }) },
|
|
1636
|
-
onResponse: async (res) => {
|
|
1637
|
-
if (!res.ok) {
|
|
1638
|
-
const text = await res.text();
|
|
1639
|
-
throw new Error(`voyage batch status failed: ${res.status} ${text}`);
|
|
1640
|
-
}
|
|
1641
|
-
return await res.json();
|
|
1642
|
-
}
|
|
1643
|
-
});
|
|
1644
|
-
}
|
|
1645
|
-
async function readVoyageBatchError(params) {
|
|
1646
|
-
try {
|
|
1647
|
-
return await withRemoteHttpResponse({
|
|
1648
|
-
url: `${normalizeBatchBaseUrl(params.client)}/files/${params.errorFileId}/content`,
|
|
1649
|
-
ssrfPolicy: params.client.ssrfPolicy,
|
|
1650
|
-
init: { headers: buildBatchHeaders(params.client, { json: true }) },
|
|
1651
|
-
onResponse: async (res) => {
|
|
1652
|
-
if (!res.ok) {
|
|
1653
|
-
const text = await res.text();
|
|
1654
|
-
throw new Error(`voyage batch error file content failed: ${res.status} ${text}`);
|
|
1655
|
-
}
|
|
1656
|
-
const text = await res.text();
|
|
1657
|
-
if (!text.trim()) return;
|
|
1658
|
-
return extractBatchErrorMessage(text.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => JSON.parse(line)));
|
|
1659
|
-
}
|
|
1660
|
-
});
|
|
1661
|
-
} catch (err) {
|
|
1662
|
-
return formatUnavailableBatchError(err);
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
async function waitForVoyageBatch(params) {
|
|
1666
|
-
const start = Date.now();
|
|
1667
|
-
let current = params.initial;
|
|
1668
|
-
while (true) {
|
|
1669
|
-
const status = current ?? await fetchVoyageBatchStatus({
|
|
1670
|
-
client: params.client,
|
|
1671
|
-
batchId: params.batchId
|
|
1672
|
-
});
|
|
1673
|
-
const state = status.status ?? "unknown";
|
|
1674
|
-
if (state === "completed") {
|
|
1675
|
-
if (!status.output_file_id) throw new Error(`voyage batch ${params.batchId} completed without output file`);
|
|
1676
|
-
return {
|
|
1677
|
-
outputFileId: status.output_file_id,
|
|
1678
|
-
errorFileId: status.error_file_id ?? void 0
|
|
1679
|
-
};
|
|
1680
|
-
}
|
|
1681
|
-
if ([
|
|
1682
|
-
"failed",
|
|
1683
|
-
"expired",
|
|
1684
|
-
"cancelled",
|
|
1685
|
-
"canceled"
|
|
1686
|
-
].includes(state)) {
|
|
1687
|
-
const detail = status.error_file_id ? await readVoyageBatchError({
|
|
1688
|
-
client: params.client,
|
|
1689
|
-
errorFileId: status.error_file_id
|
|
1690
|
-
}) : void 0;
|
|
1691
|
-
const suffix = detail ? `: ${detail}` : "";
|
|
1692
|
-
throw new Error(`voyage batch ${params.batchId} ${state}${suffix}`);
|
|
1693
|
-
}
|
|
1694
|
-
if (!params.wait) throw new Error(`voyage batch ${params.batchId} still ${state}; wait disabled`);
|
|
1695
|
-
if (Date.now() - start > params.timeoutMs) throw new Error(`voyage batch ${params.batchId} timed out after ${params.timeoutMs}ms`);
|
|
1696
|
-
params.debug?.(`voyage batch ${params.batchId} ${state}; waiting ${params.pollIntervalMs}ms`);
|
|
1697
|
-
await new Promise((resolve) => setTimeout(resolve, params.pollIntervalMs));
|
|
1698
|
-
current = void 0;
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
async function runVoyageEmbeddingBatches(params) {
|
|
1702
|
-
return await runEmbeddingBatchGroups({
|
|
1703
|
-
...buildEmbeddingBatchGroupOptions(params, {
|
|
1704
|
-
maxRequests: VOYAGE_BATCH_MAX_REQUESTS,
|
|
1705
|
-
debugLabel: "memory embeddings: voyage batch submit"
|
|
1706
|
-
}),
|
|
1707
|
-
runGroup: async ({ group, groupIndex, groups, byCustomId }) => {
|
|
1708
|
-
const batchInfo = await submitVoyageBatch({
|
|
1709
|
-
client: params.client,
|
|
1710
|
-
requests: group,
|
|
1711
|
-
agentId: params.agentId
|
|
1712
|
-
});
|
|
1713
|
-
if (!batchInfo.id) throw new Error("voyage batch create failed: missing batch id");
|
|
1714
|
-
params.debug?.("memory embeddings: voyage batch created", {
|
|
1715
|
-
batchId: batchInfo.id,
|
|
1716
|
-
status: batchInfo.status,
|
|
1717
|
-
group: groupIndex + 1,
|
|
1718
|
-
groups,
|
|
1719
|
-
requests: group.length
|
|
1720
|
-
});
|
|
1721
|
-
if (!params.wait && batchInfo.status !== "completed") throw new Error(`voyage batch ${batchInfo.id} submitted; enable remote.batch.wait to await completion`);
|
|
1722
|
-
const completed = batchInfo.status === "completed" ? {
|
|
1723
|
-
outputFileId: batchInfo.output_file_id ?? "",
|
|
1724
|
-
errorFileId: batchInfo.error_file_id ?? void 0
|
|
1725
|
-
} : await waitForVoyageBatch({
|
|
1726
|
-
client: params.client,
|
|
1727
|
-
batchId: batchInfo.id,
|
|
1728
|
-
wait: params.wait,
|
|
1729
|
-
pollIntervalMs: params.pollIntervalMs,
|
|
1730
|
-
timeoutMs: params.timeoutMs,
|
|
1731
|
-
debug: params.debug,
|
|
1732
|
-
initial: batchInfo
|
|
1733
|
-
});
|
|
1734
|
-
if (!completed.outputFileId) throw new Error(`voyage batch ${batchInfo.id} completed without output file`);
|
|
1735
|
-
const baseUrl = normalizeBatchBaseUrl(params.client);
|
|
1736
|
-
const errors = [];
|
|
1737
|
-
const remaining = new Set(group.map((request) => request.custom_id));
|
|
1738
|
-
await withRemoteHttpResponse({
|
|
1739
|
-
url: `${baseUrl}/files/${completed.outputFileId}/content`,
|
|
1740
|
-
ssrfPolicy: params.client.ssrfPolicy,
|
|
1741
|
-
init: { headers: buildBatchHeaders(params.client, { json: true }) },
|
|
1742
|
-
onResponse: async (contentRes) => {
|
|
1743
|
-
if (!contentRes.ok) {
|
|
1744
|
-
const text = await contentRes.text();
|
|
1745
|
-
throw new Error(`voyage batch file content failed: ${contentRes.status} ${text}`);
|
|
1746
|
-
}
|
|
1747
|
-
if (!contentRes.body) return;
|
|
1748
|
-
const reader = createInterface({
|
|
1749
|
-
input: Readable.fromWeb(contentRes.body),
|
|
1750
|
-
terminal: false
|
|
1751
|
-
});
|
|
1752
|
-
for await (const rawLine of reader) {
|
|
1753
|
-
if (!rawLine.trim()) continue;
|
|
1754
|
-
applyEmbeddingBatchOutputLine({
|
|
1755
|
-
line: JSON.parse(rawLine),
|
|
1756
|
-
remaining,
|
|
1757
|
-
errors,
|
|
1758
|
-
byCustomId
|
|
1759
|
-
});
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
});
|
|
1763
|
-
if (errors.length > 0) throw new Error(`voyage batch ${batchInfo.id} failed: ${errors.join("; ")}`);
|
|
1764
|
-
if (remaining.size > 0) throw new Error(`voyage batch ${batchInfo.id} missing ${remaining.size} embedding responses`);
|
|
1765
|
-
}
|
|
1766
|
-
});
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
//#endregion
|
|
1770
|
-
//#region src/memory/embedding-input-limits.ts
|
|
1771
|
-
function estimateUtf8Bytes(text) {
|
|
1772
|
-
if (!text) return 0;
|
|
1773
|
-
return Buffer.byteLength(text, "utf8");
|
|
1774
|
-
}
|
|
1775
|
-
function splitTextToUtf8ByteLimit(text, maxUtf8Bytes) {
|
|
1776
|
-
if (maxUtf8Bytes <= 0) return [text];
|
|
1777
|
-
if (estimateUtf8Bytes(text) <= maxUtf8Bytes) return [text];
|
|
1778
|
-
const parts = [];
|
|
1779
|
-
let cursor = 0;
|
|
1780
|
-
while (cursor < text.length) {
|
|
1781
|
-
let low = cursor + 1;
|
|
1782
|
-
let high = Math.min(text.length, cursor + maxUtf8Bytes);
|
|
1783
|
-
let best = cursor;
|
|
1784
|
-
while (low <= high) {
|
|
1785
|
-
const mid = Math.floor((low + high) / 2);
|
|
1786
|
-
if (estimateUtf8Bytes(text.slice(cursor, mid)) <= maxUtf8Bytes) {
|
|
1787
|
-
best = mid;
|
|
1788
|
-
low = mid + 1;
|
|
1789
|
-
} else high = mid - 1;
|
|
1790
|
-
}
|
|
1791
|
-
if (best <= cursor) best = Math.min(text.length, cursor + 1);
|
|
1792
|
-
if (best < text.length && best > cursor && text.charCodeAt(best - 1) >= 55296 && text.charCodeAt(best - 1) <= 56319 && text.charCodeAt(best) >= 56320 && text.charCodeAt(best) <= 57343) best -= 1;
|
|
1793
|
-
const part = text.slice(cursor, best);
|
|
1794
|
-
if (!part) break;
|
|
1795
|
-
parts.push(part);
|
|
1796
|
-
cursor = best;
|
|
1797
|
-
}
|
|
1798
|
-
return parts;
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
//#endregion
|
|
1802
|
-
//#region src/memory/embedding-model-limits.ts
|
|
1803
|
-
const DEFAULT_EMBEDDING_MAX_INPUT_TOKENS = 8192;
|
|
1804
|
-
const DEFAULT_LOCAL_EMBEDDING_MAX_INPUT_TOKENS = 2048;
|
|
1805
|
-
const KNOWN_EMBEDDING_MAX_INPUT_TOKENS = {
|
|
1806
|
-
"openai:text-embedding-3-small": 8192,
|
|
1807
|
-
"openai:text-embedding-3-large": 8192,
|
|
1808
|
-
"openai:text-embedding-ada-002": 8191,
|
|
1809
|
-
"gemini:text-embedding-004": 2048,
|
|
1810
|
-
"voyage:voyage-3": 32e3,
|
|
1811
|
-
"voyage:voyage-3-lite": 16e3,
|
|
1812
|
-
"voyage:voyage-code-3": 32e3
|
|
1813
|
-
};
|
|
1814
|
-
function resolveEmbeddingMaxInputTokens(provider) {
|
|
1815
|
-
if (typeof provider.maxInputTokens === "number") return provider.maxInputTokens;
|
|
1816
|
-
const known = KNOWN_EMBEDDING_MAX_INPUT_TOKENS[`${provider.id}:${provider.model}`.toLowerCase()];
|
|
1817
|
-
if (typeof known === "number") return known;
|
|
1818
|
-
if (provider.id.toLowerCase() === "gemini") return 2048;
|
|
1819
|
-
if (provider.id.toLowerCase() === "local") return DEFAULT_LOCAL_EMBEDDING_MAX_INPUT_TOKENS;
|
|
1820
|
-
return DEFAULT_EMBEDDING_MAX_INPUT_TOKENS;
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
//#endregion
|
|
1824
|
-
//#region src/memory/embedding-chunk-limits.ts
|
|
1825
|
-
function enforceEmbeddingMaxInputTokens(provider, chunks, hardMaxInputTokens) {
|
|
1826
|
-
const providerMaxInputTokens = resolveEmbeddingMaxInputTokens(provider);
|
|
1827
|
-
const maxInputTokens = typeof hardMaxInputTokens === "number" && hardMaxInputTokens > 0 ? Math.min(providerMaxInputTokens, hardMaxInputTokens) : providerMaxInputTokens;
|
|
1828
|
-
const out = [];
|
|
1829
|
-
for (const chunk of chunks) {
|
|
1830
|
-
if (estimateUtf8Bytes(chunk.text) <= maxInputTokens) {
|
|
1831
|
-
out.push(chunk);
|
|
1832
|
-
continue;
|
|
1833
|
-
}
|
|
1834
|
-
for (const text of splitTextToUtf8ByteLimit(chunk.text, maxInputTokens)) out.push({
|
|
1835
|
-
startLine: chunk.startLine,
|
|
1836
|
-
endLine: chunk.endLine,
|
|
1837
|
-
text,
|
|
1838
|
-
hash: hashText(text)
|
|
1839
|
-
});
|
|
1840
|
-
}
|
|
1841
|
-
return out;
|
|
1842
|
-
}
|
|
1843
|
-
|
|
1844
|
-
//#endregion
|
|
1845
|
-
//#region src/memory/memory-schema.ts
|
|
1846
|
-
function ensureMemoryIndexSchema(params) {
|
|
1847
|
-
params.db.exec(`
|
|
1848
|
-
CREATE TABLE IF NOT EXISTS meta (
|
|
1849
|
-
key TEXT PRIMARY KEY,
|
|
1850
|
-
value TEXT NOT NULL
|
|
1851
|
-
);
|
|
1852
|
-
`);
|
|
1853
|
-
params.db.exec(`
|
|
1854
|
-
CREATE TABLE IF NOT EXISTS files (
|
|
1855
|
-
path TEXT PRIMARY KEY,
|
|
1856
|
-
source TEXT NOT NULL DEFAULT 'memory',
|
|
1857
|
-
hash TEXT NOT NULL,
|
|
1858
|
-
mtime INTEGER NOT NULL,
|
|
1859
|
-
size INTEGER NOT NULL
|
|
1860
|
-
);
|
|
1861
|
-
`);
|
|
1862
|
-
params.db.exec(`
|
|
1863
|
-
CREATE TABLE IF NOT EXISTS chunks (
|
|
1864
|
-
id TEXT PRIMARY KEY,
|
|
1865
|
-
path TEXT NOT NULL,
|
|
1866
|
-
source TEXT NOT NULL DEFAULT 'memory',
|
|
1867
|
-
start_line INTEGER NOT NULL,
|
|
1868
|
-
end_line INTEGER NOT NULL,
|
|
1869
|
-
hash TEXT NOT NULL,
|
|
1870
|
-
model TEXT NOT NULL,
|
|
1871
|
-
text TEXT NOT NULL,
|
|
1872
|
-
embedding TEXT NOT NULL,
|
|
1873
|
-
updated_at INTEGER NOT NULL
|
|
1874
|
-
);
|
|
1875
|
-
`);
|
|
1876
|
-
params.db.exec(`
|
|
1877
|
-
CREATE TABLE IF NOT EXISTS ${params.embeddingCacheTable} (
|
|
1878
|
-
provider TEXT NOT NULL,
|
|
1879
|
-
model TEXT NOT NULL,
|
|
1880
|
-
provider_key TEXT NOT NULL,
|
|
1881
|
-
hash TEXT NOT NULL,
|
|
1882
|
-
embedding TEXT NOT NULL,
|
|
1883
|
-
dims INTEGER,
|
|
1884
|
-
updated_at INTEGER NOT NULL,
|
|
1885
|
-
PRIMARY KEY (provider, model, provider_key, hash)
|
|
1886
|
-
);
|
|
1887
|
-
`);
|
|
1888
|
-
params.db.exec(`CREATE INDEX IF NOT EXISTS idx_embedding_cache_updated_at ON ${params.embeddingCacheTable}(updated_at);`);
|
|
1889
|
-
let ftsAvailable = false;
|
|
1890
|
-
let ftsError;
|
|
1891
|
-
if (params.ftsEnabled) try {
|
|
1892
|
-
params.db.exec(`CREATE VIRTUAL TABLE IF NOT EXISTS ${params.ftsTable} USING fts5(\n text,\n id UNINDEXED,\n path UNINDEXED,\n source UNINDEXED,\n model UNINDEXED,\n start_line UNINDEXED,\n end_line UNINDEXED\n);`);
|
|
1893
|
-
ftsAvailable = true;
|
|
1894
|
-
} catch (err) {
|
|
1895
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1896
|
-
ftsAvailable = false;
|
|
1897
|
-
ftsError = message;
|
|
1898
|
-
}
|
|
1899
|
-
ensureColumn(params.db, "files", "source", "TEXT NOT NULL DEFAULT 'memory'");
|
|
1900
|
-
ensureColumn(params.db, "chunks", "source", "TEXT NOT NULL DEFAULT 'memory'");
|
|
1901
|
-
params.db.exec(`CREATE INDEX IF NOT EXISTS idx_chunks_path ON chunks(path);`);
|
|
1902
|
-
params.db.exec(`CREATE INDEX IF NOT EXISTS idx_chunks_source ON chunks(source);`);
|
|
1903
|
-
return {
|
|
1904
|
-
ftsAvailable,
|
|
1905
|
-
...ftsError ? { ftsError } : {}
|
|
1906
|
-
};
|
|
1907
|
-
}
|
|
1908
|
-
function ensureColumn(db, table, column, definition) {
|
|
1909
|
-
if (db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column)) return;
|
|
1910
|
-
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
//#endregion
|
|
1914
|
-
//#region src/memory/sqlite-vec.ts
|
|
1915
|
-
async function loadSqliteVecExtension(params) {
|
|
1916
|
-
try {
|
|
1917
|
-
const sqliteVec = await importOptionalRuntimeDependency({
|
|
1918
|
-
componentId: "local-memory-runtime",
|
|
1919
|
-
packageName: "@fased/local-memory-runtime",
|
|
1920
|
-
dependency: "sqlite-vec"
|
|
1921
|
-
});
|
|
1922
|
-
const resolvedPath = params.extensionPath?.trim() ? params.extensionPath.trim() : void 0;
|
|
1923
|
-
const extensionPath = resolvedPath ?? sqliteVec.getLoadablePath();
|
|
1924
|
-
params.db.enableLoadExtension(true);
|
|
1925
|
-
if (resolvedPath) params.db.loadExtension(extensionPath);
|
|
1926
|
-
else sqliteVec.load(params.db);
|
|
1927
|
-
return {
|
|
1928
|
-
ok: true,
|
|
1929
|
-
extensionPath
|
|
1930
|
-
};
|
|
1931
|
-
} catch (err) {
|
|
1932
|
-
return {
|
|
1933
|
-
ok: false,
|
|
1934
|
-
error: err instanceof Error ? err.message : String(err)
|
|
1935
|
-
};
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
//#endregion
|
|
1940
|
-
//#region src/memory/manager-sync-ops.ts
|
|
1941
|
-
const META_KEY = "memory_index_meta_v1";
|
|
1942
|
-
const VECTOR_TABLE$2 = "chunks_vec";
|
|
1943
|
-
const FTS_TABLE$2 = "chunks_fts";
|
|
1944
|
-
const EMBEDDING_CACHE_TABLE$2 = "embedding_cache";
|
|
1945
|
-
const SESSION_DIRTY_DEBOUNCE_MS = 5e3;
|
|
1946
|
-
const SESSION_DELTA_READ_CHUNK_BYTES = 64 * 1024;
|
|
1947
|
-
const VECTOR_LOAD_TIMEOUT_MS = 3e4;
|
|
1948
|
-
const IGNORED_MEMORY_WATCH_DIR_NAMES = new Set([
|
|
1949
|
-
".git",
|
|
1950
|
-
"node_modules",
|
|
1951
|
-
".pnpm-store",
|
|
1952
|
-
".venv",
|
|
1953
|
-
"venv",
|
|
1954
|
-
".tox",
|
|
1955
|
-
"__pycache__"
|
|
1956
|
-
]);
|
|
1957
|
-
const log$2 = createSubsystemLogger("memory");
|
|
1958
|
-
function shouldIgnoreMemoryWatchPath(watchPath) {
|
|
1959
|
-
return path.normalize(watchPath).split(path.sep).map((segment) => segment.trim().toLowerCase()).some((segment) => IGNORED_MEMORY_WATCH_DIR_NAMES.has(segment));
|
|
1960
|
-
}
|
|
1961
|
-
var MemoryManagerSyncOps = class {
|
|
1962
|
-
constructor() {
|
|
1963
|
-
this.provider = null;
|
|
1964
|
-
this.sources = /* @__PURE__ */ new Set();
|
|
1965
|
-
this.providerKey = null;
|
|
1966
|
-
this.fts = {
|
|
1967
|
-
enabled: false,
|
|
1968
|
-
available: false
|
|
1969
|
-
};
|
|
1970
|
-
this.vectorReady = null;
|
|
1971
|
-
this.watcher = null;
|
|
1972
|
-
this.watchTimer = null;
|
|
1973
|
-
this.sessionWatchTimer = null;
|
|
1974
|
-
this.sessionUnsubscribe = null;
|
|
1975
|
-
this.intervalTimer = null;
|
|
1976
|
-
this.closed = false;
|
|
1977
|
-
this.dirty = false;
|
|
1978
|
-
this.sessionsDirty = false;
|
|
1979
|
-
this.sessionsDirtyFiles = /* @__PURE__ */ new Set();
|
|
1980
|
-
this.sessionPendingFiles = /* @__PURE__ */ new Set();
|
|
1981
|
-
this.sessionDeltas = /* @__PURE__ */ new Map();
|
|
1982
|
-
}
|
|
1983
|
-
async ensureVectorReady(dimensions) {
|
|
1984
|
-
if (!this.vector.enabled) return false;
|
|
1985
|
-
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`);
|
|
1986
|
-
let ready = false;
|
|
1987
|
-
try {
|
|
1988
|
-
ready = await this.vectorReady || false;
|
|
1989
|
-
} catch (err) {
|
|
1990
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1991
|
-
this.vector.available = false;
|
|
1992
|
-
this.vector.loadError = message;
|
|
1993
|
-
this.vectorReady = null;
|
|
1994
|
-
log$2.warn(`sqlite-vec unavailable: ${message}`);
|
|
1995
|
-
return false;
|
|
1996
|
-
}
|
|
1997
|
-
if (ready && typeof dimensions === "number" && dimensions > 0) this.ensureVectorTable(dimensions);
|
|
1998
|
-
return ready;
|
|
1999
|
-
}
|
|
2000
|
-
async loadVectorExtension() {
|
|
2001
|
-
if (this.vector.available !== null) return this.vector.available;
|
|
2002
|
-
if (!this.vector.enabled) {
|
|
2003
|
-
this.vector.available = false;
|
|
2004
|
-
return false;
|
|
2005
|
-
}
|
|
2006
|
-
try {
|
|
2007
|
-
const resolvedPath = this.vector.extensionPath?.trim() ? resolveUserPath(this.vector.extensionPath) : void 0;
|
|
2008
|
-
const loaded = await loadSqliteVecExtension({
|
|
2009
|
-
db: this.db,
|
|
2010
|
-
extensionPath: resolvedPath
|
|
2011
|
-
});
|
|
2012
|
-
if (!loaded.ok) throw new Error(loaded.error ?? "unknown sqlite-vec load error");
|
|
2013
|
-
this.vector.extensionPath = loaded.extensionPath;
|
|
2014
|
-
this.vector.available = true;
|
|
2015
|
-
return true;
|
|
2016
|
-
} catch (err) {
|
|
2017
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
2018
|
-
this.vector.available = false;
|
|
2019
|
-
this.vector.loadError = message;
|
|
2020
|
-
log$2.warn(`sqlite-vec unavailable: ${message}`);
|
|
2021
|
-
return false;
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
ensureVectorTable(dimensions) {
|
|
2025
|
-
if (this.vector.dims === dimensions) return;
|
|
2026
|
-
if (this.vector.dims && this.vector.dims !== dimensions) this.dropVectorTable();
|
|
2027
|
-
this.db.exec(`CREATE VIRTUAL TABLE IF NOT EXISTS ${VECTOR_TABLE$2} USING vec0(\n id TEXT PRIMARY KEY,\n embedding FLOAT[${dimensions}]\n)`);
|
|
2028
|
-
this.vector.dims = dimensions;
|
|
2029
|
-
}
|
|
2030
|
-
dropVectorTable() {
|
|
2031
|
-
try {
|
|
2032
|
-
this.db.exec(`DROP TABLE IF EXISTS ${VECTOR_TABLE$2}`);
|
|
2033
|
-
} catch (err) {
|
|
2034
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
2035
|
-
log$2.debug(`Failed to drop ${VECTOR_TABLE$2}: ${message}`);
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
buildSourceFilter(alias) {
|
|
2039
|
-
const sources = Array.from(this.sources);
|
|
2040
|
-
if (sources.length === 0) return {
|
|
2041
|
-
sql: "",
|
|
2042
|
-
params: []
|
|
2043
|
-
};
|
|
2044
|
-
return {
|
|
2045
|
-
sql: ` AND ${alias ? `${alias}.source` : "source"} IN (${sources.map(() => "?").join(", ")})`,
|
|
2046
|
-
params: sources
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
|
-
openDatabase() {
|
|
2050
|
-
const dbPath = resolveUserPath(this.settings.store.path);
|
|
2051
|
-
return this.openDatabaseAtPath(dbPath);
|
|
2052
|
-
}
|
|
2053
|
-
openDatabaseAtPath(dbPath) {
|
|
2054
|
-
ensureDir(path.dirname(dbPath));
|
|
2055
|
-
const { DatabaseSync } = requireNodeSqlite();
|
|
2056
|
-
return new DatabaseSync(dbPath, { allowExtension: this.settings.store.vector.enabled });
|
|
2057
|
-
}
|
|
2058
|
-
seedEmbeddingCache(sourceDb) {
|
|
2059
|
-
if (!this.cache.enabled) return;
|
|
2060
|
-
try {
|
|
2061
|
-
const rows = sourceDb.prepare(`SELECT provider, model, provider_key, hash, embedding, dims, updated_at FROM ${EMBEDDING_CACHE_TABLE$2}`).all();
|
|
2062
|
-
if (!rows.length) return;
|
|
2063
|
-
const insert = this.db.prepare(`INSERT INTO ${EMBEDDING_CACHE_TABLE$2} (provider, model, provider_key, hash, embedding, dims, updated_at)
|
|
2064
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
2065
|
-
ON CONFLICT(provider, model, provider_key, hash) DO UPDATE SET
|
|
2066
|
-
embedding=excluded.embedding,
|
|
2067
|
-
dims=excluded.dims,
|
|
2068
|
-
updated_at=excluded.updated_at`);
|
|
2069
|
-
this.db.exec("BEGIN");
|
|
2070
|
-
for (const row of rows) insert.run(row.provider, row.model, row.provider_key, row.hash, row.embedding, row.dims, row.updated_at);
|
|
2071
|
-
this.db.exec("COMMIT");
|
|
2072
|
-
} catch (err) {
|
|
2073
|
-
try {
|
|
2074
|
-
this.db.exec("ROLLBACK");
|
|
2075
|
-
} catch {}
|
|
2076
|
-
throw err;
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
async swapIndexFiles(targetPath, tempPath) {
|
|
2080
|
-
const backupPath = `${targetPath}.backup-${randomUUID()}`;
|
|
2081
|
-
await this.moveIndexFiles(targetPath, backupPath);
|
|
2082
|
-
try {
|
|
2083
|
-
await this.moveIndexFiles(tempPath, targetPath);
|
|
2084
|
-
} catch (err) {
|
|
2085
|
-
await this.moveIndexFiles(backupPath, targetPath);
|
|
2086
|
-
throw err;
|
|
2087
|
-
}
|
|
2088
|
-
await this.removeIndexFiles(backupPath);
|
|
2089
|
-
}
|
|
2090
|
-
async moveIndexFiles(sourceBase, targetBase) {
|
|
2091
|
-
for (const suffix of [
|
|
2092
|
-
"",
|
|
2093
|
-
"-wal",
|
|
2094
|
-
"-shm"
|
|
2095
|
-
]) {
|
|
2096
|
-
const source = `${sourceBase}${suffix}`;
|
|
2097
|
-
const target = `${targetBase}${suffix}`;
|
|
2098
|
-
try {
|
|
2099
|
-
await fs$1.rename(source, target);
|
|
2100
|
-
} catch (err) {
|
|
2101
|
-
if (err.code !== "ENOENT") throw err;
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
}
|
|
2105
|
-
async removeIndexFiles(basePath) {
|
|
2106
|
-
await Promise.all([
|
|
2107
|
-
"",
|
|
2108
|
-
"-wal",
|
|
2109
|
-
"-shm"
|
|
2110
|
-
].map((suffix) => fs$1.rm(`${basePath}${suffix}`, { force: true })));
|
|
2111
|
-
}
|
|
2112
|
-
ensureSchema() {
|
|
2113
|
-
const result = ensureMemoryIndexSchema({
|
|
2114
|
-
db: this.db,
|
|
2115
|
-
embeddingCacheTable: EMBEDDING_CACHE_TABLE$2,
|
|
2116
|
-
ftsTable: FTS_TABLE$2,
|
|
2117
|
-
ftsEnabled: this.fts.enabled
|
|
2118
|
-
});
|
|
2119
|
-
this.fts.available = result.ftsAvailable;
|
|
2120
|
-
if (result.ftsError) {
|
|
2121
|
-
this.fts.loadError = result.ftsError;
|
|
2122
|
-
log$2.warn(`fts unavailable: ${result.ftsError}`);
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
ensureWatcher() {
|
|
2126
|
-
if (!this.sources.has("memory") || !this.settings.sync.watch || this.watcher) return;
|
|
2127
|
-
const watchPaths = new Set([
|
|
2128
|
-
path.join(this.workspaceDir, "MEMORY.md"),
|
|
2129
|
-
path.join(this.workspaceDir, "memory.md"),
|
|
2130
|
-
path.join(this.workspaceDir, "memory", "**", "*.md")
|
|
2131
|
-
]);
|
|
2132
|
-
const additionalPaths = normalizeExtraMemoryPaths(this.workspaceDir, this.settings.extraPaths);
|
|
2133
|
-
for (const entry of additionalPaths) try {
|
|
2134
|
-
const stat = fs.lstatSync(entry);
|
|
2135
|
-
if (stat.isSymbolicLink()) continue;
|
|
2136
|
-
if (stat.isDirectory()) {
|
|
2137
|
-
watchPaths.add(path.join(entry, "**", "*.md"));
|
|
2138
|
-
continue;
|
|
2139
|
-
}
|
|
2140
|
-
if (stat.isFile() && entry.toLowerCase().endsWith(".md")) watchPaths.add(entry);
|
|
2141
|
-
} catch {}
|
|
2142
|
-
this.watcher = chokidar.watch(Array.from(watchPaths), {
|
|
2143
|
-
ignoreInitial: true,
|
|
2144
|
-
ignored: (watchPath) => shouldIgnoreMemoryWatchPath(String(watchPath)),
|
|
2145
|
-
awaitWriteFinish: {
|
|
2146
|
-
stabilityThreshold: this.settings.sync.watchDebounceMs,
|
|
2147
|
-
pollInterval: 100
|
|
2148
|
-
}
|
|
2149
|
-
});
|
|
2150
|
-
const markDirty = () => {
|
|
2151
|
-
this.dirty = true;
|
|
2152
|
-
this.scheduleWatchSync();
|
|
2153
|
-
};
|
|
2154
|
-
this.watcher.on("add", markDirty);
|
|
2155
|
-
this.watcher.on("change", markDirty);
|
|
2156
|
-
this.watcher.on("unlink", markDirty);
|
|
2157
|
-
}
|
|
2158
|
-
ensureSessionListener() {
|
|
2159
|
-
if (!this.sources.has("sessions") || this.sessionUnsubscribe) return;
|
|
2160
|
-
this.sessionUnsubscribe = onSessionTranscriptUpdate((update) => {
|
|
2161
|
-
if (this.closed) return;
|
|
2162
|
-
const sessionFile = update.sessionFile;
|
|
2163
|
-
if (!this.isSessionFileForAgent(sessionFile)) return;
|
|
2164
|
-
this.scheduleSessionDirty(sessionFile);
|
|
2165
|
-
});
|
|
2166
|
-
}
|
|
2167
|
-
scheduleSessionDirty(sessionFile) {
|
|
2168
|
-
this.sessionPendingFiles.add(sessionFile);
|
|
2169
|
-
if (this.sessionWatchTimer) return;
|
|
2170
|
-
this.sessionWatchTimer = setTimeout(() => {
|
|
2171
|
-
this.sessionWatchTimer = null;
|
|
2172
|
-
this.processSessionDeltaBatch().catch((err) => {
|
|
2173
|
-
log$2.warn(`memory session delta failed: ${String(err)}`);
|
|
2174
|
-
});
|
|
2175
|
-
}, SESSION_DIRTY_DEBOUNCE_MS);
|
|
2176
|
-
}
|
|
2177
|
-
async processSessionDeltaBatch() {
|
|
2178
|
-
if (this.sessionPendingFiles.size === 0) return;
|
|
2179
|
-
const pending = Array.from(this.sessionPendingFiles);
|
|
2180
|
-
this.sessionPendingFiles.clear();
|
|
2181
|
-
let shouldSync = false;
|
|
2182
|
-
for (const sessionFile of pending) {
|
|
2183
|
-
const delta = await this.updateSessionDelta(sessionFile);
|
|
2184
|
-
if (!delta) continue;
|
|
2185
|
-
const bytesThreshold = delta.deltaBytes;
|
|
2186
|
-
const messagesThreshold = delta.deltaMessages;
|
|
2187
|
-
const bytesHit = bytesThreshold <= 0 ? delta.pendingBytes > 0 : delta.pendingBytes >= bytesThreshold;
|
|
2188
|
-
const messagesHit = messagesThreshold <= 0 ? delta.pendingMessages > 0 : delta.pendingMessages >= messagesThreshold;
|
|
2189
|
-
if (!bytesHit && !messagesHit) continue;
|
|
2190
|
-
this.sessionsDirtyFiles.add(sessionFile);
|
|
2191
|
-
this.sessionsDirty = true;
|
|
2192
|
-
delta.pendingBytes = bytesThreshold > 0 ? Math.max(0, delta.pendingBytes - bytesThreshold) : 0;
|
|
2193
|
-
delta.pendingMessages = messagesThreshold > 0 ? Math.max(0, delta.pendingMessages - messagesThreshold) : 0;
|
|
2194
|
-
shouldSync = true;
|
|
2195
|
-
}
|
|
2196
|
-
if (shouldSync) this.sync({ reason: "session-delta" }).catch((err) => {
|
|
2197
|
-
log$2.warn(`memory sync failed (session-delta): ${String(err)}`);
|
|
2198
|
-
});
|
|
2199
|
-
}
|
|
2200
|
-
async updateSessionDelta(sessionFile) {
|
|
2201
|
-
const thresholds = this.settings.sync.sessions;
|
|
2202
|
-
if (!thresholds) return null;
|
|
2203
|
-
let stat;
|
|
2204
|
-
try {
|
|
2205
|
-
stat = await fs$1.stat(sessionFile);
|
|
2206
|
-
} catch {
|
|
2207
|
-
return null;
|
|
2208
|
-
}
|
|
2209
|
-
const size = stat.size;
|
|
2210
|
-
let state = this.sessionDeltas.get(sessionFile);
|
|
2211
|
-
if (!state) {
|
|
2212
|
-
state = {
|
|
2213
|
-
lastSize: 0,
|
|
2214
|
-
pendingBytes: 0,
|
|
2215
|
-
pendingMessages: 0
|
|
2216
|
-
};
|
|
2217
|
-
this.sessionDeltas.set(sessionFile, state);
|
|
2218
|
-
}
|
|
2219
|
-
const deltaBytes = Math.max(0, size - state.lastSize);
|
|
2220
|
-
if (deltaBytes === 0 && size === state.lastSize) return {
|
|
2221
|
-
deltaBytes: thresholds.deltaBytes,
|
|
2222
|
-
deltaMessages: thresholds.deltaMessages,
|
|
2223
|
-
pendingBytes: state.pendingBytes,
|
|
2224
|
-
pendingMessages: state.pendingMessages
|
|
2225
|
-
};
|
|
2226
|
-
if (size < state.lastSize) {
|
|
2227
|
-
state.lastSize = size;
|
|
2228
|
-
state.pendingBytes += size;
|
|
2229
|
-
if (thresholds.deltaMessages > 0 && (thresholds.deltaBytes <= 0 || state.pendingBytes < thresholds.deltaBytes)) state.pendingMessages += await this.countNewlines(sessionFile, 0, size);
|
|
2230
|
-
} else {
|
|
2231
|
-
state.pendingBytes += deltaBytes;
|
|
2232
|
-
if (thresholds.deltaMessages > 0 && (thresholds.deltaBytes <= 0 || state.pendingBytes < thresholds.deltaBytes)) state.pendingMessages += await this.countNewlines(sessionFile, state.lastSize, size);
|
|
2233
|
-
state.lastSize = size;
|
|
2234
|
-
}
|
|
2235
|
-
this.sessionDeltas.set(sessionFile, state);
|
|
2236
|
-
return {
|
|
2237
|
-
deltaBytes: thresholds.deltaBytes,
|
|
2238
|
-
deltaMessages: thresholds.deltaMessages,
|
|
2239
|
-
pendingBytes: state.pendingBytes,
|
|
2240
|
-
pendingMessages: state.pendingMessages
|
|
2241
|
-
};
|
|
2242
|
-
}
|
|
2243
|
-
async countNewlines(absPath, start, end) {
|
|
2244
|
-
if (end <= start) return 0;
|
|
2245
|
-
let handle;
|
|
2246
|
-
try {
|
|
2247
|
-
handle = await fs$1.open(absPath, "r");
|
|
2248
|
-
} catch (err) {
|
|
2249
|
-
if (isFileMissingError(err)) return 0;
|
|
2250
|
-
throw err;
|
|
2251
|
-
}
|
|
2252
|
-
try {
|
|
2253
|
-
let offset = start;
|
|
2254
|
-
let count = 0;
|
|
2255
|
-
const buffer = Buffer.alloc(SESSION_DELTA_READ_CHUNK_BYTES);
|
|
2256
|
-
while (offset < end) {
|
|
2257
|
-
const toRead = Math.min(buffer.length, end - offset);
|
|
2258
|
-
const { bytesRead } = await handle.read(buffer, 0, toRead, offset);
|
|
2259
|
-
if (bytesRead <= 0) break;
|
|
2260
|
-
for (let i = 0; i < bytesRead; i += 1) if (buffer[i] === 10) count += 1;
|
|
2261
|
-
offset += bytesRead;
|
|
2262
|
-
}
|
|
2263
|
-
return count;
|
|
2264
|
-
} finally {
|
|
2265
|
-
await handle.close();
|
|
2266
|
-
}
|
|
2267
|
-
}
|
|
2268
|
-
resetSessionDelta(absPath, size) {
|
|
2269
|
-
const state = this.sessionDeltas.get(absPath);
|
|
2270
|
-
if (!state) return;
|
|
2271
|
-
state.lastSize = size;
|
|
2272
|
-
state.pendingBytes = 0;
|
|
2273
|
-
state.pendingMessages = 0;
|
|
2274
|
-
}
|
|
2275
|
-
isSessionFileForAgent(sessionFile) {
|
|
2276
|
-
if (!sessionFile) return false;
|
|
2277
|
-
const sessionsDir = resolveSessionTranscriptsDirForAgent(this.agentId);
|
|
2278
|
-
const resolvedFile = path.resolve(sessionFile);
|
|
2279
|
-
const resolvedDir = path.resolve(sessionsDir);
|
|
2280
|
-
return resolvedFile.startsWith(`${resolvedDir}${path.sep}`);
|
|
2281
|
-
}
|
|
2282
|
-
ensureIntervalSync() {
|
|
2283
|
-
const minutes = this.settings.sync.intervalMinutes;
|
|
2284
|
-
if (!minutes || minutes <= 0 || this.intervalTimer) return;
|
|
2285
|
-
const ms = minutes * 60 * 1e3;
|
|
2286
|
-
this.intervalTimer = setInterval(() => {
|
|
2287
|
-
this.sync({ reason: "interval" }).catch((err) => {
|
|
2288
|
-
log$2.warn(`memory sync failed (interval): ${String(err)}`);
|
|
2289
|
-
});
|
|
2290
|
-
}, ms);
|
|
2291
|
-
}
|
|
2292
|
-
scheduleWatchSync() {
|
|
2293
|
-
if (!this.sources.has("memory") || !this.settings.sync.watch) return;
|
|
2294
|
-
if (this.watchTimer) clearTimeout(this.watchTimer);
|
|
2295
|
-
this.watchTimer = setTimeout(() => {
|
|
2296
|
-
this.watchTimer = null;
|
|
2297
|
-
this.sync({ reason: "watch" }).catch((err) => {
|
|
2298
|
-
log$2.warn(`memory sync failed (watch): ${String(err)}`);
|
|
2299
|
-
});
|
|
2300
|
-
}, this.settings.sync.watchDebounceMs);
|
|
2301
|
-
}
|
|
2302
|
-
shouldSyncSessions(params, needsFullReindex = false) {
|
|
2303
|
-
if (!this.sources.has("sessions")) return false;
|
|
2304
|
-
if (params?.force) return true;
|
|
2305
|
-
const reason = params?.reason;
|
|
2306
|
-
if (reason === "session-start" || reason === "watch") return false;
|
|
2307
|
-
if (needsFullReindex) return true;
|
|
2308
|
-
return this.sessionsDirty && this.sessionsDirtyFiles.size > 0;
|
|
2309
|
-
}
|
|
2310
|
-
async syncMemoryFiles(params) {
|
|
2311
|
-
if (!this.provider) {
|
|
2312
|
-
log$2.debug("Skipping memory file sync in FTS-only mode (no embedding provider)");
|
|
2313
|
-
return;
|
|
2314
|
-
}
|
|
2315
|
-
const files = await listMemoryFiles(this.workspaceDir, this.settings.extraPaths);
|
|
2316
|
-
const fileEntries = (await Promise.all(files.map(async (file) => buildFileEntry(file, this.workspaceDir)))).filter((entry) => entry !== null);
|
|
2317
|
-
log$2.debug("memory sync: indexing memory files", {
|
|
2318
|
-
files: fileEntries.length,
|
|
2319
|
-
needsFullReindex: params.needsFullReindex,
|
|
2320
|
-
batch: this.batch.enabled,
|
|
2321
|
-
concurrency: this.getIndexConcurrency()
|
|
2322
|
-
});
|
|
2323
|
-
const activePaths = new Set(fileEntries.map((entry) => entry.path));
|
|
2324
|
-
if (params.progress) {
|
|
2325
|
-
params.progress.total += fileEntries.length;
|
|
2326
|
-
params.progress.report({
|
|
2327
|
-
completed: params.progress.completed,
|
|
2328
|
-
total: params.progress.total,
|
|
2329
|
-
label: this.batch.enabled ? "Indexing memory files (batch)..." : "Indexing memory files…"
|
|
2330
|
-
});
|
|
2331
|
-
}
|
|
2332
|
-
await runWithConcurrency(fileEntries.map((entry) => async () => {
|
|
2333
|
-
const record = this.db.prepare(`SELECT hash FROM files WHERE path = ? AND source = ?`).get(entry.path, "memory");
|
|
2334
|
-
if (!params.needsFullReindex && record?.hash === entry.hash) {
|
|
2335
|
-
if (params.progress) {
|
|
2336
|
-
params.progress.completed += 1;
|
|
2337
|
-
params.progress.report({
|
|
2338
|
-
completed: params.progress.completed,
|
|
2339
|
-
total: params.progress.total
|
|
2340
|
-
});
|
|
2341
|
-
}
|
|
2342
|
-
return;
|
|
2343
|
-
}
|
|
2344
|
-
await this.indexFile(entry, { source: "memory" });
|
|
2345
|
-
if (params.progress) {
|
|
2346
|
-
params.progress.completed += 1;
|
|
2347
|
-
params.progress.report({
|
|
2348
|
-
completed: params.progress.completed,
|
|
2349
|
-
total: params.progress.total
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2352
|
-
}), this.getIndexConcurrency());
|
|
2353
|
-
const staleRows = this.db.prepare(`SELECT path FROM files WHERE source = ?`).all("memory");
|
|
2354
|
-
for (const stale of staleRows) {
|
|
2355
|
-
if (activePaths.has(stale.path)) continue;
|
|
2356
|
-
this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`).run(stale.path, "memory");
|
|
2357
|
-
try {
|
|
2358
|
-
this.db.prepare(`DELETE FROM ${VECTOR_TABLE$2} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`).run(stale.path, "memory");
|
|
2359
|
-
} catch {}
|
|
2360
|
-
this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`).run(stale.path, "memory");
|
|
2361
|
-
if (this.fts.enabled && this.fts.available) try {
|
|
2362
|
-
this.db.prepare(`DELETE FROM ${FTS_TABLE$2} WHERE path = ? AND source = ? AND model = ?`).run(stale.path, "memory", this.provider.model);
|
|
2363
|
-
} catch {}
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
async syncSessionFiles(params) {
|
|
2367
|
-
if (!this.provider) {
|
|
2368
|
-
log$2.debug("Skipping session file sync in FTS-only mode (no embedding provider)");
|
|
2369
|
-
return;
|
|
2370
|
-
}
|
|
2371
|
-
const files = await listSessionFilesForAgent(this.agentId);
|
|
2372
|
-
const activePaths = new Set(files.map((file) => sessionPathForFile(file)));
|
|
2373
|
-
const indexAll = params.needsFullReindex || this.sessionsDirtyFiles.size === 0;
|
|
2374
|
-
log$2.debug("memory sync: indexing session files", {
|
|
2375
|
-
files: files.length,
|
|
2376
|
-
indexAll,
|
|
2377
|
-
dirtyFiles: this.sessionsDirtyFiles.size,
|
|
2378
|
-
batch: this.batch.enabled,
|
|
2379
|
-
concurrency: this.getIndexConcurrency()
|
|
2380
|
-
});
|
|
2381
|
-
if (params.progress) {
|
|
2382
|
-
params.progress.total += files.length;
|
|
2383
|
-
params.progress.report({
|
|
2384
|
-
completed: params.progress.completed,
|
|
2385
|
-
total: params.progress.total,
|
|
2386
|
-
label: this.batch.enabled ? "Indexing session files (batch)..." : "Indexing session files…"
|
|
2387
|
-
});
|
|
2388
|
-
}
|
|
2389
|
-
await runWithConcurrency(files.map((absPath) => async () => {
|
|
2390
|
-
if (!indexAll && !this.sessionsDirtyFiles.has(absPath)) {
|
|
2391
|
-
if (params.progress) {
|
|
2392
|
-
params.progress.completed += 1;
|
|
2393
|
-
params.progress.report({
|
|
2394
|
-
completed: params.progress.completed,
|
|
2395
|
-
total: params.progress.total
|
|
2396
|
-
});
|
|
2397
|
-
}
|
|
2398
|
-
return;
|
|
2399
|
-
}
|
|
2400
|
-
const entry = await buildSessionEntry(absPath);
|
|
2401
|
-
if (!entry) {
|
|
2402
|
-
if (params.progress) {
|
|
2403
|
-
params.progress.completed += 1;
|
|
2404
|
-
params.progress.report({
|
|
2405
|
-
completed: params.progress.completed,
|
|
2406
|
-
total: params.progress.total
|
|
2407
|
-
});
|
|
2408
|
-
}
|
|
2409
|
-
return;
|
|
2410
|
-
}
|
|
2411
|
-
const record = this.db.prepare(`SELECT hash FROM files WHERE path = ? AND source = ?`).get(entry.path, "sessions");
|
|
2412
|
-
if (!params.needsFullReindex && record?.hash === entry.hash) {
|
|
2413
|
-
if (params.progress) {
|
|
2414
|
-
params.progress.completed += 1;
|
|
2415
|
-
params.progress.report({
|
|
2416
|
-
completed: params.progress.completed,
|
|
2417
|
-
total: params.progress.total
|
|
2418
|
-
});
|
|
2419
|
-
}
|
|
2420
|
-
this.resetSessionDelta(absPath, entry.size);
|
|
2421
|
-
return;
|
|
2422
|
-
}
|
|
2423
|
-
await this.indexFile(entry, {
|
|
2424
|
-
source: "sessions",
|
|
2425
|
-
content: entry.content
|
|
2426
|
-
});
|
|
2427
|
-
this.resetSessionDelta(absPath, entry.size);
|
|
2428
|
-
if (params.progress) {
|
|
2429
|
-
params.progress.completed += 1;
|
|
2430
|
-
params.progress.report({
|
|
2431
|
-
completed: params.progress.completed,
|
|
2432
|
-
total: params.progress.total
|
|
2433
|
-
});
|
|
2434
|
-
}
|
|
2435
|
-
}), this.getIndexConcurrency());
|
|
2436
|
-
const staleRows = this.db.prepare(`SELECT path FROM files WHERE source = ?`).all("sessions");
|
|
2437
|
-
for (const stale of staleRows) {
|
|
2438
|
-
if (activePaths.has(stale.path)) continue;
|
|
2439
|
-
this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`).run(stale.path, "sessions");
|
|
2440
|
-
try {
|
|
2441
|
-
this.db.prepare(`DELETE FROM ${VECTOR_TABLE$2} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`).run(stale.path, "sessions");
|
|
2442
|
-
} catch {}
|
|
2443
|
-
this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`).run(stale.path, "sessions");
|
|
2444
|
-
if (this.fts.enabled && this.fts.available) try {
|
|
2445
|
-
this.db.prepare(`DELETE FROM ${FTS_TABLE$2} WHERE path = ? AND source = ? AND model = ?`).run(stale.path, "sessions", this.provider.model);
|
|
2446
|
-
} catch {}
|
|
2447
|
-
}
|
|
2448
|
-
}
|
|
2449
|
-
createSyncProgress(onProgress) {
|
|
2450
|
-
const state = {
|
|
2451
|
-
completed: 0,
|
|
2452
|
-
total: 0,
|
|
2453
|
-
label: void 0,
|
|
2454
|
-
report: (update) => {
|
|
2455
|
-
if (update.label) state.label = update.label;
|
|
2456
|
-
const label = update.total > 0 && state.label ? `${state.label} ${update.completed}/${update.total}` : state.label;
|
|
2457
|
-
onProgress({
|
|
2458
|
-
completed: update.completed,
|
|
2459
|
-
total: update.total,
|
|
2460
|
-
label
|
|
2461
|
-
});
|
|
2462
|
-
}
|
|
2463
|
-
};
|
|
2464
|
-
return state;
|
|
2465
|
-
}
|
|
2466
|
-
async runSync(params) {
|
|
2467
|
-
const progress = params?.progress ? this.createSyncProgress(params.progress) : void 0;
|
|
2468
|
-
if (progress) progress.report({
|
|
2469
|
-
completed: progress.completed,
|
|
2470
|
-
total: progress.total,
|
|
2471
|
-
label: "Loading vector extension…"
|
|
2472
|
-
});
|
|
2473
|
-
const vectorReady = await this.ensureVectorReady();
|
|
2474
|
-
const meta = this.readMeta();
|
|
2475
|
-
const configuredSources = this.resolveConfiguredSourcesForMeta();
|
|
2476
|
-
const needsFullReindex = params?.force || !meta || this.provider && meta.model !== this.provider.model || this.provider && meta.provider !== this.provider.id || meta.providerKey !== this.providerKey || this.metaSourcesDiffer(meta, configuredSources) || meta.chunkTokens !== this.settings.chunking.tokens || meta.chunkOverlap !== this.settings.chunking.overlap || vectorReady && !meta?.vectorDims;
|
|
2477
|
-
try {
|
|
2478
|
-
if (needsFullReindex) {
|
|
2479
|
-
if (process.env.FASED_TEST_FAST === "1" && process.env.FASED_TEST_MEMORY_UNSAFE_REINDEX === "1") await this.runUnsafeReindex({
|
|
2480
|
-
reason: params?.reason,
|
|
2481
|
-
force: params?.force,
|
|
2482
|
-
progress: progress ?? void 0
|
|
2483
|
-
});
|
|
2484
|
-
else await this.runSafeReindex({
|
|
2485
|
-
reason: params?.reason,
|
|
2486
|
-
force: params?.force,
|
|
2487
|
-
progress: progress ?? void 0
|
|
2488
|
-
});
|
|
2489
|
-
return;
|
|
2490
|
-
}
|
|
2491
|
-
const shouldSyncMemory = this.sources.has("memory") && (params?.force || needsFullReindex || this.dirty);
|
|
2492
|
-
const shouldSyncSessions = this.shouldSyncSessions(params, needsFullReindex);
|
|
2493
|
-
if (shouldSyncMemory) {
|
|
2494
|
-
await this.syncMemoryFiles({
|
|
2495
|
-
needsFullReindex,
|
|
2496
|
-
progress: progress ?? void 0
|
|
2497
|
-
});
|
|
2498
|
-
this.dirty = false;
|
|
2499
|
-
}
|
|
2500
|
-
if (shouldSyncSessions) {
|
|
2501
|
-
await this.syncSessionFiles({
|
|
2502
|
-
needsFullReindex,
|
|
2503
|
-
progress: progress ?? void 0
|
|
2504
|
-
});
|
|
2505
|
-
this.sessionsDirty = false;
|
|
2506
|
-
this.sessionsDirtyFiles.clear();
|
|
2507
|
-
} else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
|
|
2508
|
-
else this.sessionsDirty = false;
|
|
2509
|
-
} catch (err) {
|
|
2510
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
2511
|
-
if (this.shouldFallbackOnError(reason) && await this.activateFallbackProvider(reason)) {
|
|
2512
|
-
await this.runSafeReindex({
|
|
2513
|
-
reason: params?.reason ?? "fallback",
|
|
2514
|
-
force: true,
|
|
2515
|
-
progress: progress ?? void 0
|
|
2516
|
-
});
|
|
2517
|
-
return;
|
|
2518
|
-
}
|
|
2519
|
-
throw err;
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
shouldFallbackOnError(message) {
|
|
2523
|
-
return /embedding|embeddings|batch/i.test(message);
|
|
2524
|
-
}
|
|
2525
|
-
resolveBatchConfig() {
|
|
2526
|
-
const batch = this.settings.remote?.batch;
|
|
2527
|
-
return {
|
|
2528
|
-
enabled: Boolean(batch?.enabled && this.provider && (this.openAi && this.provider.id === "openai" || this.gemini && this.provider.id === "gemini" || this.voyage && this.provider.id === "voyage")),
|
|
2529
|
-
wait: batch?.wait ?? true,
|
|
2530
|
-
concurrency: Math.max(1, batch?.concurrency ?? 2),
|
|
2531
|
-
pollIntervalMs: batch?.pollIntervalMs ?? 2e3,
|
|
2532
|
-
timeoutMs: (batch?.timeoutMinutes ?? 60) * 60 * 1e3
|
|
2533
|
-
};
|
|
2534
|
-
}
|
|
2535
|
-
async activateFallbackProvider(reason) {
|
|
2536
|
-
const fallback = this.settings.fallback;
|
|
2537
|
-
if (!fallback || fallback === "none" || !this.provider || fallback === this.provider.id) return false;
|
|
2538
|
-
if (this.fallbackFrom) return false;
|
|
2539
|
-
const fallbackFrom = this.provider.id;
|
|
2540
|
-
const fallbackModel = fallback === "gemini" ? DEFAULT_GEMINI_EMBEDDING_MODEL : fallback === "openai" ? DEFAULT_OPENAI_EMBEDDING_MODEL : fallback === "voyage" ? DEFAULT_VOYAGE_EMBEDDING_MODEL : fallback === "mistral" ? DEFAULT_MISTRAL_EMBEDDING_MODEL : this.settings.model;
|
|
2541
|
-
const fallbackResult = await createEmbeddingProvider({
|
|
2542
|
-
config: this.cfg,
|
|
2543
|
-
agentDir: resolveAgentDir(this.cfg, this.agentId),
|
|
2544
|
-
provider: fallback,
|
|
2545
|
-
remote: this.settings.remote,
|
|
2546
|
-
model: fallbackModel,
|
|
2547
|
-
fallback: "none",
|
|
2548
|
-
local: this.settings.local
|
|
2549
|
-
});
|
|
2550
|
-
this.fallbackFrom = fallbackFrom;
|
|
2551
|
-
this.fallbackReason = reason;
|
|
2552
|
-
this.provider = fallbackResult.provider;
|
|
2553
|
-
this.openAi = fallbackResult.openAi;
|
|
2554
|
-
this.gemini = fallbackResult.gemini;
|
|
2555
|
-
this.voyage = fallbackResult.voyage;
|
|
2556
|
-
this.mistral = fallbackResult.mistral;
|
|
2557
|
-
this.providerKey = this.computeProviderKey();
|
|
2558
|
-
this.batch = this.resolveBatchConfig();
|
|
2559
|
-
log$2.warn(`memory embeddings: switched to fallback provider (${fallback})`, { reason });
|
|
2560
|
-
return true;
|
|
2561
|
-
}
|
|
2562
|
-
async runSafeReindex(params) {
|
|
2563
|
-
const dbPath = resolveUserPath(this.settings.store.path);
|
|
2564
|
-
const tempDbPath = `${dbPath}.tmp-${randomUUID()}`;
|
|
2565
|
-
const tempDb = this.openDatabaseAtPath(tempDbPath);
|
|
2566
|
-
const originalDb = this.db;
|
|
2567
|
-
let originalDbClosed = false;
|
|
2568
|
-
const originalState = {
|
|
2569
|
-
ftsAvailable: this.fts.available,
|
|
2570
|
-
ftsError: this.fts.loadError,
|
|
2571
|
-
vectorAvailable: this.vector.available,
|
|
2572
|
-
vectorLoadError: this.vector.loadError,
|
|
2573
|
-
vectorDims: this.vector.dims,
|
|
2574
|
-
vectorReady: this.vectorReady
|
|
2575
|
-
};
|
|
2576
|
-
const restoreOriginalState = () => {
|
|
2577
|
-
if (originalDbClosed) this.db = this.openDatabaseAtPath(dbPath);
|
|
2578
|
-
else this.db = originalDb;
|
|
2579
|
-
this.fts.available = originalState.ftsAvailable;
|
|
2580
|
-
this.fts.loadError = originalState.ftsError;
|
|
2581
|
-
this.vector.available = originalDbClosed ? null : originalState.vectorAvailable;
|
|
2582
|
-
this.vector.loadError = originalState.vectorLoadError;
|
|
2583
|
-
this.vector.dims = originalState.vectorDims;
|
|
2584
|
-
this.vectorReady = originalDbClosed ? null : originalState.vectorReady;
|
|
2585
|
-
};
|
|
2586
|
-
this.db = tempDb;
|
|
2587
|
-
this.vectorReady = null;
|
|
2588
|
-
this.vector.available = null;
|
|
2589
|
-
this.vector.loadError = void 0;
|
|
2590
|
-
this.vector.dims = void 0;
|
|
2591
|
-
this.fts.available = false;
|
|
2592
|
-
this.fts.loadError = void 0;
|
|
2593
|
-
this.ensureSchema();
|
|
2594
|
-
let nextMeta = null;
|
|
2595
|
-
try {
|
|
2596
|
-
this.seedEmbeddingCache(originalDb);
|
|
2597
|
-
const shouldSyncMemory = this.sources.has("memory");
|
|
2598
|
-
const shouldSyncSessions = this.shouldSyncSessions({
|
|
2599
|
-
reason: params.reason,
|
|
2600
|
-
force: params.force
|
|
2601
|
-
}, true);
|
|
2602
|
-
if (shouldSyncMemory) {
|
|
2603
|
-
await this.syncMemoryFiles({
|
|
2604
|
-
needsFullReindex: true,
|
|
2605
|
-
progress: params.progress
|
|
2606
|
-
});
|
|
2607
|
-
this.dirty = false;
|
|
2608
|
-
}
|
|
2609
|
-
if (shouldSyncSessions) {
|
|
2610
|
-
await this.syncSessionFiles({
|
|
2611
|
-
needsFullReindex: true,
|
|
2612
|
-
progress: params.progress
|
|
2613
|
-
});
|
|
2614
|
-
this.sessionsDirty = false;
|
|
2615
|
-
this.sessionsDirtyFiles.clear();
|
|
2616
|
-
} else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
|
|
2617
|
-
else this.sessionsDirty = false;
|
|
2618
|
-
nextMeta = {
|
|
2619
|
-
model: this.provider?.model ?? "fts-only",
|
|
2620
|
-
provider: this.provider?.id ?? "none",
|
|
2621
|
-
providerKey: this.providerKey,
|
|
2622
|
-
sources: this.resolveConfiguredSourcesForMeta(),
|
|
2623
|
-
chunkTokens: this.settings.chunking.tokens,
|
|
2624
|
-
chunkOverlap: this.settings.chunking.overlap
|
|
2625
|
-
};
|
|
2626
|
-
if (!nextMeta) throw new Error("Failed to compute memory index metadata for reindexing.");
|
|
2627
|
-
if (this.vector.available && this.vector.dims) nextMeta.vectorDims = this.vector.dims;
|
|
2628
|
-
this.writeMeta(nextMeta);
|
|
2629
|
-
this.pruneEmbeddingCacheIfNeeded?.();
|
|
2630
|
-
this.db.close();
|
|
2631
|
-
originalDb.close();
|
|
2632
|
-
originalDbClosed = true;
|
|
2633
|
-
await this.swapIndexFiles(dbPath, tempDbPath);
|
|
2634
|
-
this.db = this.openDatabaseAtPath(dbPath);
|
|
2635
|
-
this.vectorReady = null;
|
|
2636
|
-
this.vector.available = null;
|
|
2637
|
-
this.vector.loadError = void 0;
|
|
2638
|
-
this.ensureSchema();
|
|
2639
|
-
this.vector.dims = nextMeta?.vectorDims;
|
|
2640
|
-
} catch (err) {
|
|
2641
|
-
try {
|
|
2642
|
-
this.db.close();
|
|
2643
|
-
} catch {}
|
|
2644
|
-
await this.removeIndexFiles(tempDbPath);
|
|
2645
|
-
restoreOriginalState();
|
|
2646
|
-
throw err;
|
|
2647
|
-
}
|
|
2648
|
-
}
|
|
2649
|
-
async runUnsafeReindex(params) {
|
|
2650
|
-
this.resetIndex();
|
|
2651
|
-
const shouldSyncMemory = this.sources.has("memory");
|
|
2652
|
-
const shouldSyncSessions = this.shouldSyncSessions({
|
|
2653
|
-
reason: params.reason,
|
|
2654
|
-
force: params.force
|
|
2655
|
-
}, true);
|
|
2656
|
-
if (shouldSyncMemory) {
|
|
2657
|
-
await this.syncMemoryFiles({
|
|
2658
|
-
needsFullReindex: true,
|
|
2659
|
-
progress: params.progress
|
|
2660
|
-
});
|
|
2661
|
-
this.dirty = false;
|
|
2662
|
-
}
|
|
2663
|
-
if (shouldSyncSessions) {
|
|
2664
|
-
await this.syncSessionFiles({
|
|
2665
|
-
needsFullReindex: true,
|
|
2666
|
-
progress: params.progress
|
|
2667
|
-
});
|
|
2668
|
-
this.sessionsDirty = false;
|
|
2669
|
-
this.sessionsDirtyFiles.clear();
|
|
2670
|
-
} else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
|
|
2671
|
-
else this.sessionsDirty = false;
|
|
2672
|
-
const nextMeta = {
|
|
2673
|
-
model: this.provider?.model ?? "fts-only",
|
|
2674
|
-
provider: this.provider?.id ?? "none",
|
|
2675
|
-
providerKey: this.providerKey,
|
|
2676
|
-
sources: this.resolveConfiguredSourcesForMeta(),
|
|
2677
|
-
chunkTokens: this.settings.chunking.tokens,
|
|
2678
|
-
chunkOverlap: this.settings.chunking.overlap
|
|
2679
|
-
};
|
|
2680
|
-
if (this.vector.available && this.vector.dims) nextMeta.vectorDims = this.vector.dims;
|
|
2681
|
-
this.writeMeta(nextMeta);
|
|
2682
|
-
this.pruneEmbeddingCacheIfNeeded?.();
|
|
2683
|
-
}
|
|
2684
|
-
resetIndex() {
|
|
2685
|
-
this.db.exec(`DELETE FROM files`);
|
|
2686
|
-
this.db.exec(`DELETE FROM chunks`);
|
|
2687
|
-
if (this.fts.enabled && this.fts.available) try {
|
|
2688
|
-
this.db.exec(`DELETE FROM ${FTS_TABLE$2}`);
|
|
2689
|
-
} catch {}
|
|
2690
|
-
this.dropVectorTable();
|
|
2691
|
-
this.vector.dims = void 0;
|
|
2692
|
-
this.sessionsDirtyFiles.clear();
|
|
2693
|
-
}
|
|
2694
|
-
readMeta() {
|
|
2695
|
-
const row = this.db.prepare(`SELECT value FROM meta WHERE key = ?`).get(META_KEY);
|
|
2696
|
-
if (!row?.value) return null;
|
|
2697
|
-
try {
|
|
2698
|
-
return JSON.parse(row.value);
|
|
2699
|
-
} catch {
|
|
2700
|
-
return null;
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2703
|
-
writeMeta(meta) {
|
|
2704
|
-
const value = JSON.stringify(meta);
|
|
2705
|
-
this.db.prepare(`INSERT INTO meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value`).run(META_KEY, value);
|
|
2706
|
-
}
|
|
2707
|
-
resolveConfiguredSourcesForMeta() {
|
|
2708
|
-
const normalized = Array.from(this.sources).filter((source) => source === "memory" || source === "sessions").toSorted();
|
|
2709
|
-
return normalized.length > 0 ? normalized : ["memory"];
|
|
2710
|
-
}
|
|
2711
|
-
normalizeMetaSources(meta) {
|
|
2712
|
-
if (!Array.isArray(meta.sources)) return ["memory"];
|
|
2713
|
-
const normalized = Array.from(new Set(meta.sources.filter((source) => source === "memory" || source === "sessions"))).toSorted();
|
|
2714
|
-
return normalized.length > 0 ? normalized : ["memory"];
|
|
2715
|
-
}
|
|
2716
|
-
metaSourcesDiffer(meta, configuredSources) {
|
|
2717
|
-
const metaSources = this.normalizeMetaSources(meta);
|
|
2718
|
-
if (metaSources.length !== configuredSources.length) return true;
|
|
2719
|
-
return metaSources.some((source, index) => source !== configuredSources[index]);
|
|
2720
|
-
}
|
|
2721
|
-
};
|
|
2722
|
-
|
|
2723
|
-
//#endregion
|
|
2724
|
-
//#region src/memory/manager-embedding-ops.ts
|
|
2725
|
-
const VECTOR_TABLE$1 = "chunks_vec";
|
|
2726
|
-
const FTS_TABLE$1 = "chunks_fts";
|
|
2727
|
-
const EMBEDDING_CACHE_TABLE$1 = "embedding_cache";
|
|
2728
|
-
const EMBEDDING_BATCH_MAX_TOKENS = 8e3;
|
|
2729
|
-
const EMBEDDING_INDEX_CONCURRENCY = 4;
|
|
2730
|
-
const EMBEDDING_RETRY_MAX_ATTEMPTS = 3;
|
|
2731
|
-
const EMBEDDING_RETRY_BASE_DELAY_MS = 500;
|
|
2732
|
-
const EMBEDDING_RETRY_MAX_DELAY_MS = 8e3;
|
|
2733
|
-
const BATCH_FAILURE_LIMIT$1 = 2;
|
|
2734
|
-
const EMBEDDING_QUERY_TIMEOUT_REMOTE_MS = 6e4;
|
|
2735
|
-
const EMBEDDING_QUERY_TIMEOUT_LOCAL_MS = 5 * 6e4;
|
|
2736
|
-
const EMBEDDING_BATCH_TIMEOUT_REMOTE_MS = 2 * 6e4;
|
|
2737
|
-
const EMBEDDING_BATCH_TIMEOUT_LOCAL_MS = 10 * 6e4;
|
|
2738
|
-
const vectorToBlob$1 = (embedding) => Buffer.from(new Float32Array(embedding).buffer);
|
|
2739
|
-
const log$1 = createSubsystemLogger("memory");
|
|
2740
|
-
var MemoryManagerEmbeddingOps = class extends MemoryManagerSyncOps {
|
|
2741
|
-
buildEmbeddingBatches(chunks) {
|
|
2742
|
-
const batches = [];
|
|
2743
|
-
let current = [];
|
|
2744
|
-
let currentTokens = 0;
|
|
2745
|
-
for (const chunk of chunks) {
|
|
2746
|
-
const estimate = estimateUtf8Bytes(chunk.text);
|
|
2747
|
-
if (current.length > 0 && currentTokens + estimate > EMBEDDING_BATCH_MAX_TOKENS) {
|
|
2748
|
-
batches.push(current);
|
|
2749
|
-
current = [];
|
|
2750
|
-
currentTokens = 0;
|
|
2751
|
-
}
|
|
2752
|
-
if (current.length === 0 && estimate > EMBEDDING_BATCH_MAX_TOKENS) {
|
|
2753
|
-
batches.push([chunk]);
|
|
2754
|
-
continue;
|
|
2755
|
-
}
|
|
2756
|
-
current.push(chunk);
|
|
2757
|
-
currentTokens += estimate;
|
|
2758
|
-
}
|
|
2759
|
-
if (current.length > 0) batches.push(current);
|
|
2760
|
-
return batches;
|
|
2761
|
-
}
|
|
2762
|
-
loadEmbeddingCache(hashes) {
|
|
2763
|
-
if (!this.cache.enabled || !this.provider) return /* @__PURE__ */ new Map();
|
|
2764
|
-
if (hashes.length === 0) return /* @__PURE__ */ new Map();
|
|
2765
|
-
const unique = [];
|
|
2766
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2767
|
-
for (const hash of hashes) {
|
|
2768
|
-
if (!hash) continue;
|
|
2769
|
-
if (seen.has(hash)) continue;
|
|
2770
|
-
seen.add(hash);
|
|
2771
|
-
unique.push(hash);
|
|
2772
|
-
}
|
|
2773
|
-
if (unique.length === 0) return /* @__PURE__ */ new Map();
|
|
2774
|
-
const out = /* @__PURE__ */ new Map();
|
|
2775
|
-
const baseParams = [
|
|
2776
|
-
this.provider.id,
|
|
2777
|
-
this.provider.model,
|
|
2778
|
-
this.providerKey
|
|
2779
|
-
];
|
|
2780
|
-
const batchSize = 400;
|
|
2781
|
-
for (let start = 0; start < unique.length; start += batchSize) {
|
|
2782
|
-
const batch = unique.slice(start, start + batchSize);
|
|
2783
|
-
const placeholders = batch.map(() => "?").join(", ");
|
|
2784
|
-
const rows = this.db.prepare(`SELECT hash, embedding FROM ${EMBEDDING_CACHE_TABLE$1}\n WHERE provider = ? AND model = ? AND provider_key = ? AND hash IN (${placeholders})`).all(...baseParams, ...batch);
|
|
2785
|
-
for (const row of rows) out.set(row.hash, parseEmbedding(row.embedding));
|
|
2786
|
-
}
|
|
2787
|
-
return out;
|
|
2788
|
-
}
|
|
2789
|
-
upsertEmbeddingCache(entries) {
|
|
2790
|
-
if (!this.cache.enabled || !this.provider) return;
|
|
2791
|
-
if (entries.length === 0) return;
|
|
2792
|
-
const now = Date.now();
|
|
2793
|
-
const stmt = this.db.prepare(`INSERT INTO ${EMBEDDING_CACHE_TABLE$1} (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`);
|
|
2794
|
-
for (const entry of entries) {
|
|
2795
|
-
const embedding = entry.embedding ?? [];
|
|
2796
|
-
stmt.run(this.provider.id, this.provider.model, this.providerKey, entry.hash, JSON.stringify(embedding), embedding.length, now);
|
|
2797
|
-
}
|
|
2798
|
-
}
|
|
2799
|
-
pruneEmbeddingCacheIfNeeded() {
|
|
2800
|
-
if (!this.cache.enabled) return;
|
|
2801
|
-
const max = this.cache.maxEntries;
|
|
2802
|
-
if (!max || max <= 0) return;
|
|
2803
|
-
const count = this.db.prepare(`SELECT COUNT(*) as c FROM ${EMBEDDING_CACHE_TABLE$1}`).get()?.c ?? 0;
|
|
2804
|
-
if (count <= max) return;
|
|
2805
|
-
const excess = count - max;
|
|
2806
|
-
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);
|
|
2807
|
-
}
|
|
2808
|
-
async embedChunksInBatches(chunks) {
|
|
2809
|
-
if (chunks.length === 0) return [];
|
|
2810
|
-
const { embeddings, missing } = this.collectCachedEmbeddings(chunks);
|
|
2811
|
-
if (missing.length === 0) return embeddings;
|
|
2812
|
-
const missingChunks = missing.map((m) => m.chunk);
|
|
2813
|
-
const batches = this.buildEmbeddingBatches(missingChunks);
|
|
2814
|
-
const toCache = [];
|
|
2815
|
-
let cursor = 0;
|
|
2816
|
-
for (const batch of batches) {
|
|
2817
|
-
const batchEmbeddings = await this.embedBatchWithRetry(batch.map((chunk) => chunk.text));
|
|
2818
|
-
for (let i = 0; i < batch.length; i += 1) {
|
|
2819
|
-
const item = missing[cursor + i];
|
|
2820
|
-
const embedding = batchEmbeddings[i] ?? [];
|
|
2821
|
-
if (item) {
|
|
2822
|
-
embeddings[item.index] = embedding;
|
|
2823
|
-
toCache.push({
|
|
2824
|
-
hash: item.chunk.hash,
|
|
2825
|
-
embedding
|
|
2826
|
-
});
|
|
2827
|
-
}
|
|
2828
|
-
}
|
|
2829
|
-
cursor += batch.length;
|
|
2830
|
-
}
|
|
2831
|
-
this.upsertEmbeddingCache(toCache);
|
|
2832
|
-
return embeddings;
|
|
2833
|
-
}
|
|
2834
|
-
computeProviderKey() {
|
|
2835
|
-
if (!this.provider) return hashText(JSON.stringify({
|
|
2836
|
-
provider: "none",
|
|
2837
|
-
model: "fts-only"
|
|
2838
|
-
}));
|
|
2839
|
-
if (this.provider.id === "openai" && this.openAi) {
|
|
2840
|
-
const entries = Object.entries(this.openAi.headers).filter(([key]) => key.toLowerCase() !== "authorization").toSorted(([a], [b]) => a.localeCompare(b)).map(([key, value]) => [key, value]);
|
|
2841
|
-
return hashText(JSON.stringify({
|
|
2842
|
-
provider: "openai",
|
|
2843
|
-
baseUrl: this.openAi.baseUrl,
|
|
2844
|
-
model: this.openAi.model,
|
|
2845
|
-
headers: entries
|
|
2846
|
-
}));
|
|
2847
|
-
}
|
|
2848
|
-
if (this.provider.id === "gemini" && this.gemini) {
|
|
2849
|
-
const entries = Object.entries(this.gemini.headers).filter(([key]) => {
|
|
2850
|
-
const lower = key.toLowerCase();
|
|
2851
|
-
return lower !== "authorization" && lower !== "x-goog-api-key";
|
|
2852
|
-
}).toSorted(([a], [b]) => a.localeCompare(b)).map(([key, value]) => [key, value]);
|
|
2853
|
-
return hashText(JSON.stringify({
|
|
2854
|
-
provider: "gemini",
|
|
2855
|
-
baseUrl: this.gemini.baseUrl,
|
|
2856
|
-
model: this.gemini.model,
|
|
2857
|
-
headers: entries
|
|
2858
|
-
}));
|
|
2859
|
-
}
|
|
2860
|
-
return hashText(JSON.stringify({
|
|
2861
|
-
provider: this.provider.id,
|
|
2862
|
-
model: this.provider.model
|
|
2863
|
-
}));
|
|
2864
|
-
}
|
|
2865
|
-
async embedChunksWithBatch(chunks, entry, source) {
|
|
2866
|
-
if (!this.provider) return this.embedChunksInBatches(chunks);
|
|
2867
|
-
if (this.provider.id === "openai" && this.openAi) return this.embedChunksWithOpenAiBatch(chunks, entry, source);
|
|
2868
|
-
if (this.provider.id === "gemini" && this.gemini) return this.embedChunksWithGeminiBatch(chunks, entry, source);
|
|
2869
|
-
if (this.provider.id === "voyage" && this.voyage) return this.embedChunksWithVoyageBatch(chunks, entry, source);
|
|
2870
|
-
return this.embedChunksInBatches(chunks);
|
|
2871
|
-
}
|
|
2872
|
-
collectCachedEmbeddings(chunks) {
|
|
2873
|
-
const cached = this.loadEmbeddingCache(chunks.map((chunk) => chunk.hash));
|
|
2874
|
-
const embeddings = Array.from({ length: chunks.length }, () => []);
|
|
2875
|
-
const missing = [];
|
|
2876
|
-
for (let i = 0; i < chunks.length; i += 1) {
|
|
2877
|
-
const chunk = chunks[i];
|
|
2878
|
-
const hit = chunk?.hash ? cached.get(chunk.hash) : void 0;
|
|
2879
|
-
if (hit && hit.length > 0) embeddings[i] = hit;
|
|
2880
|
-
else if (chunk) missing.push({
|
|
2881
|
-
index: i,
|
|
2882
|
-
chunk
|
|
2883
|
-
});
|
|
2884
|
-
}
|
|
2885
|
-
return {
|
|
2886
|
-
embeddings,
|
|
2887
|
-
missing
|
|
2888
|
-
};
|
|
2889
|
-
}
|
|
2890
|
-
buildBatchCustomId(params) {
|
|
2891
|
-
return hashText(`${params.source}:${params.entry.path}:${params.chunk.startLine}:${params.chunk.endLine}:${params.chunk.hash}:${params.index}`);
|
|
2892
|
-
}
|
|
2893
|
-
buildBatchRequests(params) {
|
|
2894
|
-
const requests = [];
|
|
2895
|
-
const mapping = /* @__PURE__ */ new Map();
|
|
2896
|
-
for (const item of params.missing) {
|
|
2897
|
-
const chunk = item.chunk;
|
|
2898
|
-
const customId = this.buildBatchCustomId({
|
|
2899
|
-
source: params.source,
|
|
2900
|
-
entry: params.entry,
|
|
2901
|
-
chunk,
|
|
2902
|
-
index: item.index
|
|
2903
|
-
});
|
|
2904
|
-
mapping.set(customId, {
|
|
2905
|
-
index: item.index,
|
|
2906
|
-
hash: chunk.hash
|
|
2907
|
-
});
|
|
2908
|
-
const built = params.build(chunk);
|
|
2909
|
-
requests.push({
|
|
2910
|
-
custom_id: customId,
|
|
2911
|
-
...built
|
|
2912
|
-
});
|
|
2913
|
-
}
|
|
2914
|
-
return {
|
|
2915
|
-
requests,
|
|
2916
|
-
mapping
|
|
2917
|
-
};
|
|
2918
|
-
}
|
|
2919
|
-
applyBatchEmbeddings(params) {
|
|
2920
|
-
const toCache = [];
|
|
2921
|
-
for (const [customId, embedding] of params.byCustomId.entries()) {
|
|
2922
|
-
const mapped = params.mapping.get(customId);
|
|
2923
|
-
if (!mapped) continue;
|
|
2924
|
-
params.embeddings[mapped.index] = embedding;
|
|
2925
|
-
toCache.push({
|
|
2926
|
-
hash: mapped.hash,
|
|
2927
|
-
embedding
|
|
2928
|
-
});
|
|
2929
|
-
}
|
|
2930
|
-
this.upsertEmbeddingCache(toCache);
|
|
2931
|
-
}
|
|
2932
|
-
buildEmbeddingBatchRunnerOptions(params) {
|
|
2933
|
-
const { requests, chunks, source } = params;
|
|
2934
|
-
return {
|
|
2935
|
-
agentId: this.agentId,
|
|
2936
|
-
requests,
|
|
2937
|
-
wait: this.batch.wait,
|
|
2938
|
-
concurrency: this.batch.concurrency,
|
|
2939
|
-
pollIntervalMs: this.batch.pollIntervalMs,
|
|
2940
|
-
timeoutMs: this.batch.timeoutMs,
|
|
2941
|
-
debug: (message, data) => log$1.debug(message, data ? {
|
|
2942
|
-
...data,
|
|
2943
|
-
source,
|
|
2944
|
-
chunks: chunks.length
|
|
2945
|
-
} : {
|
|
2946
|
-
source,
|
|
2947
|
-
chunks: chunks.length
|
|
2948
|
-
})
|
|
2949
|
-
};
|
|
2950
|
-
}
|
|
2951
|
-
async embedChunksWithProviderBatch(params) {
|
|
2952
|
-
if (!params.enabled) return this.embedChunksInBatches(params.chunks);
|
|
2953
|
-
if (params.chunks.length === 0) return [];
|
|
2954
|
-
const { embeddings, missing } = this.collectCachedEmbeddings(params.chunks);
|
|
2955
|
-
if (missing.length === 0) return embeddings;
|
|
2956
|
-
const { requests, mapping } = this.buildBatchRequests({
|
|
2957
|
-
missing,
|
|
2958
|
-
entry: params.entry,
|
|
2959
|
-
source: params.source,
|
|
2960
|
-
build: params.buildRequest
|
|
2961
|
-
});
|
|
2962
|
-
const runnerOptions = this.buildEmbeddingBatchRunnerOptions({
|
|
2963
|
-
requests,
|
|
2964
|
-
chunks: params.chunks,
|
|
2965
|
-
source: params.source
|
|
2966
|
-
});
|
|
2967
|
-
const batchResult = await this.runBatchWithFallback({
|
|
2968
|
-
provider: params.provider,
|
|
2969
|
-
run: async () => await params.runBatch(runnerOptions),
|
|
2970
|
-
fallback: async () => await this.embedChunksInBatches(params.chunks)
|
|
2971
|
-
});
|
|
2972
|
-
if (Array.isArray(batchResult)) return batchResult;
|
|
2973
|
-
this.applyBatchEmbeddings({
|
|
2974
|
-
byCustomId: batchResult,
|
|
2975
|
-
mapping,
|
|
2976
|
-
embeddings
|
|
2977
|
-
});
|
|
2978
|
-
return embeddings;
|
|
2979
|
-
}
|
|
2980
|
-
async embedChunksWithVoyageBatch(chunks, entry, source) {
|
|
2981
|
-
const voyage = this.voyage;
|
|
2982
|
-
return await this.embedChunksWithProviderBatch({
|
|
2983
|
-
chunks,
|
|
2984
|
-
entry,
|
|
2985
|
-
source,
|
|
2986
|
-
provider: "voyage",
|
|
2987
|
-
enabled: Boolean(voyage),
|
|
2988
|
-
buildRequest: (chunk) => ({ body: { input: chunk.text } }),
|
|
2989
|
-
runBatch: async (runnerOptions) => await runVoyageEmbeddingBatches({
|
|
2990
|
-
client: voyage,
|
|
2991
|
-
...runnerOptions
|
|
2992
|
-
})
|
|
2993
|
-
});
|
|
2994
|
-
}
|
|
2995
|
-
async embedChunksWithOpenAiBatch(chunks, entry, source) {
|
|
2996
|
-
const openAi = this.openAi;
|
|
2997
|
-
return await this.embedChunksWithProviderBatch({
|
|
2998
|
-
chunks,
|
|
2999
|
-
entry,
|
|
3000
|
-
source,
|
|
3001
|
-
provider: "openai",
|
|
3002
|
-
enabled: Boolean(openAi),
|
|
3003
|
-
buildRequest: (chunk) => ({
|
|
3004
|
-
method: "POST",
|
|
3005
|
-
url: OPENAI_BATCH_ENDPOINT,
|
|
3006
|
-
body: {
|
|
3007
|
-
model: openAi?.model ?? this.provider?.model ?? "text-embedding-3-small",
|
|
3008
|
-
input: chunk.text
|
|
3009
|
-
}
|
|
3010
|
-
}),
|
|
3011
|
-
runBatch: async (runnerOptions) => await runOpenAiEmbeddingBatches({
|
|
3012
|
-
openAi,
|
|
3013
|
-
...runnerOptions
|
|
3014
|
-
})
|
|
3015
|
-
});
|
|
3016
|
-
}
|
|
3017
|
-
async embedChunksWithGeminiBatch(chunks, entry, source) {
|
|
3018
|
-
const gemini = this.gemini;
|
|
3019
|
-
return await this.embedChunksWithProviderBatch({
|
|
3020
|
-
chunks,
|
|
3021
|
-
entry,
|
|
3022
|
-
source,
|
|
3023
|
-
provider: "gemini",
|
|
3024
|
-
enabled: Boolean(gemini),
|
|
3025
|
-
buildRequest: (chunk) => ({
|
|
3026
|
-
content: { parts: [{ text: chunk.text }] },
|
|
3027
|
-
taskType: "RETRIEVAL_DOCUMENT"
|
|
3028
|
-
}),
|
|
3029
|
-
runBatch: async (runnerOptions) => await runGeminiEmbeddingBatches({
|
|
3030
|
-
gemini,
|
|
3031
|
-
...runnerOptions
|
|
3032
|
-
})
|
|
3033
|
-
});
|
|
3034
|
-
}
|
|
3035
|
-
async embedBatchWithRetry(texts) {
|
|
3036
|
-
if (texts.length === 0) return [];
|
|
3037
|
-
if (!this.provider) throw new Error("Cannot embed batch in FTS-only mode (no embedding provider)");
|
|
3038
|
-
let attempt = 0;
|
|
3039
|
-
let delayMs = EMBEDDING_RETRY_BASE_DELAY_MS;
|
|
3040
|
-
while (true) try {
|
|
3041
|
-
const timeoutMs = this.resolveEmbeddingTimeout("batch");
|
|
3042
|
-
log$1.debug("memory embeddings: batch start", {
|
|
3043
|
-
provider: this.provider.id,
|
|
3044
|
-
items: texts.length,
|
|
3045
|
-
timeoutMs
|
|
3046
|
-
});
|
|
3047
|
-
return await this.withTimeout(this.provider.embedBatch(texts), timeoutMs, `memory embeddings batch timed out after ${Math.round(timeoutMs / 1e3)}s`);
|
|
3048
|
-
} catch (err) {
|
|
3049
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
3050
|
-
if (!this.isRetryableEmbeddingError(message) || attempt >= EMBEDDING_RETRY_MAX_ATTEMPTS) throw err;
|
|
3051
|
-
const waitMs = Math.min(EMBEDDING_RETRY_MAX_DELAY_MS, Math.round(delayMs * (1 + Math.random() * .2)));
|
|
3052
|
-
log$1.warn(`memory embeddings rate limited; retrying in ${waitMs}ms`);
|
|
3053
|
-
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
|
3054
|
-
delayMs *= 2;
|
|
3055
|
-
attempt += 1;
|
|
3056
|
-
}
|
|
3057
|
-
}
|
|
3058
|
-
isRetryableEmbeddingError(message) {
|
|
3059
|
-
return /(rate[_ ]limit|too many requests|429|resource has been exhausted|5\d\d|cloudflare)/i.test(message);
|
|
3060
|
-
}
|
|
3061
|
-
resolveEmbeddingTimeout(kind) {
|
|
3062
|
-
const isLocal = this.provider?.id === "local";
|
|
3063
|
-
if (kind === "query") return isLocal ? EMBEDDING_QUERY_TIMEOUT_LOCAL_MS : EMBEDDING_QUERY_TIMEOUT_REMOTE_MS;
|
|
3064
|
-
return isLocal ? EMBEDDING_BATCH_TIMEOUT_LOCAL_MS : EMBEDDING_BATCH_TIMEOUT_REMOTE_MS;
|
|
3065
|
-
}
|
|
3066
|
-
async embedQueryWithTimeout(text) {
|
|
3067
|
-
if (!this.provider) throw new Error("Cannot embed query in FTS-only mode (no embedding provider)");
|
|
3068
|
-
const timeoutMs = this.resolveEmbeddingTimeout("query");
|
|
3069
|
-
log$1.debug("memory embeddings: query start", {
|
|
3070
|
-
provider: this.provider.id,
|
|
3071
|
-
timeoutMs
|
|
3072
|
-
});
|
|
3073
|
-
return await this.withTimeout(this.provider.embedQuery(text), timeoutMs, `memory embeddings query timed out after ${Math.round(timeoutMs / 1e3)}s`);
|
|
3074
|
-
}
|
|
3075
|
-
async withTimeout(promise, timeoutMs, message) {
|
|
3076
|
-
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) return await promise;
|
|
3077
|
-
let timer = null;
|
|
3078
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
3079
|
-
timer = setTimeout(() => reject(new Error(message)), timeoutMs);
|
|
3080
|
-
});
|
|
3081
|
-
try {
|
|
3082
|
-
return await Promise.race([promise, timeoutPromise]);
|
|
3083
|
-
} finally {
|
|
3084
|
-
if (timer) clearTimeout(timer);
|
|
3085
|
-
}
|
|
3086
|
-
}
|
|
3087
|
-
async withBatchFailureLock(fn) {
|
|
3088
|
-
let release;
|
|
3089
|
-
const wait = this.batchFailureLock;
|
|
3090
|
-
this.batchFailureLock = new Promise((resolve) => {
|
|
3091
|
-
release = resolve;
|
|
3092
|
-
});
|
|
3093
|
-
await wait;
|
|
3094
|
-
try {
|
|
3095
|
-
return await fn();
|
|
3096
|
-
} finally {
|
|
3097
|
-
release();
|
|
3098
|
-
}
|
|
3099
|
-
}
|
|
3100
|
-
async resetBatchFailureCount() {
|
|
3101
|
-
await this.withBatchFailureLock(async () => {
|
|
3102
|
-
if (this.batchFailureCount > 0) log$1.debug("memory embeddings: batch recovered; resetting failure count");
|
|
3103
|
-
this.batchFailureCount = 0;
|
|
3104
|
-
this.batchFailureLastError = void 0;
|
|
3105
|
-
this.batchFailureLastProvider = void 0;
|
|
3106
|
-
});
|
|
3107
|
-
}
|
|
3108
|
-
async recordBatchFailure(params) {
|
|
3109
|
-
return await this.withBatchFailureLock(async () => {
|
|
3110
|
-
if (!this.batch.enabled) return {
|
|
3111
|
-
disabled: true,
|
|
3112
|
-
count: this.batchFailureCount
|
|
3113
|
-
};
|
|
3114
|
-
const increment = params.forceDisable ? BATCH_FAILURE_LIMIT$1 : Math.max(1, params.attempts ?? 1);
|
|
3115
|
-
this.batchFailureCount += increment;
|
|
3116
|
-
this.batchFailureLastError = params.message;
|
|
3117
|
-
this.batchFailureLastProvider = params.provider;
|
|
3118
|
-
const disabled = params.forceDisable || this.batchFailureCount >= BATCH_FAILURE_LIMIT$1;
|
|
3119
|
-
if (disabled) this.batch.enabled = false;
|
|
3120
|
-
return {
|
|
3121
|
-
disabled,
|
|
3122
|
-
count: this.batchFailureCount
|
|
3123
|
-
};
|
|
3124
|
-
});
|
|
3125
|
-
}
|
|
3126
|
-
isBatchTimeoutError(message) {
|
|
3127
|
-
return /timed out|timeout/i.test(message);
|
|
3128
|
-
}
|
|
3129
|
-
async runBatchWithTimeoutRetry(params) {
|
|
3130
|
-
try {
|
|
3131
|
-
return await params.run();
|
|
3132
|
-
} catch (err) {
|
|
3133
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
3134
|
-
if (this.isBatchTimeoutError(message)) {
|
|
3135
|
-
log$1.warn(`memory embeddings: ${params.provider} batch timed out; retrying once`);
|
|
3136
|
-
try {
|
|
3137
|
-
return await params.run();
|
|
3138
|
-
} catch (retryErr) {
|
|
3139
|
-
retryErr.batchAttempts = 2;
|
|
3140
|
-
throw retryErr;
|
|
3141
|
-
}
|
|
3142
|
-
}
|
|
3143
|
-
throw err;
|
|
3144
|
-
}
|
|
3145
|
-
}
|
|
3146
|
-
async runBatchWithFallback(params) {
|
|
3147
|
-
if (!this.batch.enabled) return await params.fallback();
|
|
3148
|
-
try {
|
|
3149
|
-
const result = await this.runBatchWithTimeoutRetry({
|
|
3150
|
-
provider: params.provider,
|
|
3151
|
-
run: params.run
|
|
3152
|
-
});
|
|
3153
|
-
await this.resetBatchFailureCount();
|
|
3154
|
-
return result;
|
|
3155
|
-
} catch (err) {
|
|
3156
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
3157
|
-
const attempts = err.batchAttempts ?? 1;
|
|
3158
|
-
const forceDisable = /asyncBatchEmbedContent not available/i.test(message);
|
|
3159
|
-
const failure = await this.recordBatchFailure({
|
|
3160
|
-
provider: params.provider,
|
|
3161
|
-
message,
|
|
3162
|
-
attempts,
|
|
3163
|
-
forceDisable
|
|
3164
|
-
});
|
|
3165
|
-
const suffix = failure.disabled ? "disabling batch" : "keeping batch enabled";
|
|
3166
|
-
log$1.warn(`memory embeddings: ${params.provider} batch failed (${failure.count}/${BATCH_FAILURE_LIMIT$1}); ${suffix}; falling back to non-batch embeddings: ${message}`);
|
|
3167
|
-
return await params.fallback();
|
|
3168
|
-
}
|
|
3169
|
-
}
|
|
3170
|
-
getIndexConcurrency() {
|
|
3171
|
-
return this.batch.enabled ? this.batch.concurrency : EMBEDDING_INDEX_CONCURRENCY;
|
|
3172
|
-
}
|
|
3173
|
-
async indexFile(entry, options) {
|
|
3174
|
-
if (!this.provider) {
|
|
3175
|
-
log$1.debug("Skipping embedding indexing in FTS-only mode", {
|
|
3176
|
-
path: entry.path,
|
|
3177
|
-
source: options.source
|
|
3178
|
-
});
|
|
3179
|
-
return;
|
|
3180
|
-
}
|
|
3181
|
-
const content = options.content ?? await fs$1.readFile(entry.absPath, "utf-8");
|
|
3182
|
-
const chunks = enforceEmbeddingMaxInputTokens(this.provider, chunkMarkdown(content, this.settings.chunking).filter((chunk) => chunk.text.trim().length > 0), EMBEDDING_BATCH_MAX_TOKENS);
|
|
3183
|
-
if (options.source === "sessions" && "lineMap" in entry) remapChunkLines(chunks, entry.lineMap);
|
|
3184
|
-
const embeddings = this.batch.enabled ? await this.embedChunksWithBatch(chunks, entry, options.source) : await this.embedChunksInBatches(chunks);
|
|
3185
|
-
const sample = embeddings.find((embedding) => embedding.length > 0);
|
|
3186
|
-
const vectorReady = sample ? await this.ensureVectorReady(sample.length) : false;
|
|
3187
|
-
const now = Date.now();
|
|
3188
|
-
if (vectorReady) try {
|
|
3189
|
-
this.db.prepare(`DELETE FROM ${VECTOR_TABLE$1} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`).run(entry.path, options.source);
|
|
3190
|
-
} catch {}
|
|
3191
|
-
if (this.fts.enabled && this.fts.available) try {
|
|
3192
|
-
this.db.prepare(`DELETE FROM ${FTS_TABLE$1} WHERE path = ? AND source = ? AND model = ?`).run(entry.path, options.source, this.provider.model);
|
|
3193
|
-
} catch {}
|
|
3194
|
-
this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`).run(entry.path, options.source);
|
|
3195
|
-
for (let i = 0; i < chunks.length; i++) {
|
|
3196
|
-
const chunk = chunks[i];
|
|
3197
|
-
const embedding = embeddings[i] ?? [];
|
|
3198
|
-
const id = hashText(`${options.source}:${entry.path}:${chunk.startLine}:${chunk.endLine}:${chunk.hash}:${this.provider.model}`);
|
|
3199
|
-
this.db.prepare(`INSERT INTO chunks (id, path, source, start_line, end_line, hash, model, text, embedding, updated_at)
|
|
3200
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
3201
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
3202
|
-
hash=excluded.hash,
|
|
3203
|
-
model=excluded.model,
|
|
3204
|
-
text=excluded.text,
|
|
3205
|
-
embedding=excluded.embedding,
|
|
3206
|
-
updated_at=excluded.updated_at`).run(id, entry.path, options.source, chunk.startLine, chunk.endLine, chunk.hash, this.provider.model, chunk.text, JSON.stringify(embedding), now);
|
|
3207
|
-
if (vectorReady && embedding.length > 0) {
|
|
3208
|
-
try {
|
|
3209
|
-
this.db.prepare(`DELETE FROM ${VECTOR_TABLE$1} WHERE id = ?`).run(id);
|
|
3210
|
-
} catch {}
|
|
3211
|
-
this.db.prepare(`INSERT INTO ${VECTOR_TABLE$1} (id, embedding) VALUES (?, ?)`).run(id, vectorToBlob$1(embedding));
|
|
3212
|
-
}
|
|
3213
|
-
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, options.source, this.provider.model, chunk.startLine, chunk.endLine);
|
|
3214
|
-
}
|
|
3215
|
-
this.db.prepare(`INSERT INTO files (path, source, hash, mtime, size) VALUES (?, ?, ?, ?, ?)
|
|
3216
|
-
ON CONFLICT(path) DO UPDATE SET
|
|
3217
|
-
source=excluded.source,
|
|
3218
|
-
hash=excluded.hash,
|
|
3219
|
-
mtime=excluded.mtime,
|
|
3220
|
-
size=excluded.size`).run(entry.path, options.source, entry.hash, entry.mtimeMs, entry.size);
|
|
3221
|
-
}
|
|
3222
|
-
};
|
|
3223
|
-
|
|
3224
|
-
//#endregion
|
|
3225
|
-
//#region src/memory/manager-search.ts
|
|
3226
|
-
const vectorToBlob = (embedding) => Buffer.from(new Float32Array(embedding).buffer);
|
|
3227
|
-
async function searchVector(params) {
|
|
3228
|
-
if (params.queryVec.length === 0 || params.limit <= 0) return [];
|
|
3229
|
-
if (await params.ensureVectorReady(params.queryVec.length)) return params.db.prepare(`SELECT c.id, c.path, c.start_line, c.end_line, c.text,
|
|
3230
|
-
c.source,
|
|
3231
|
-
vec_distance_cosine(v.embedding, ?) AS dist
|
|
3232
|
-
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) => ({
|
|
3233
|
-
id: row.id,
|
|
3234
|
-
path: row.path,
|
|
3235
|
-
startLine: row.start_line,
|
|
3236
|
-
endLine: row.end_line,
|
|
3237
|
-
score: 1 - row.dist,
|
|
3238
|
-
snippet: truncateUtf16Safe(row.text, params.snippetMaxChars),
|
|
3239
|
-
source: row.source
|
|
3240
|
-
}));
|
|
3241
|
-
return listChunks({
|
|
3242
|
-
db: params.db,
|
|
3243
|
-
providerModel: params.providerModel,
|
|
3244
|
-
sourceFilter: params.sourceFilterChunks
|
|
3245
|
-
}).map((chunk) => ({
|
|
3246
|
-
chunk,
|
|
3247
|
-
score: cosineSimilarity(params.queryVec, chunk.embedding)
|
|
3248
|
-
})).filter((entry) => Number.isFinite(entry.score)).toSorted((a, b) => b.score - a.score).slice(0, params.limit).map((entry) => ({
|
|
3249
|
-
id: entry.chunk.id,
|
|
3250
|
-
path: entry.chunk.path,
|
|
3251
|
-
startLine: entry.chunk.startLine,
|
|
3252
|
-
endLine: entry.chunk.endLine,
|
|
3253
|
-
score: entry.score,
|
|
3254
|
-
snippet: truncateUtf16Safe(entry.chunk.text, params.snippetMaxChars),
|
|
3255
|
-
source: entry.chunk.source
|
|
3256
|
-
}));
|
|
3257
|
-
}
|
|
3258
|
-
function listChunks(params) {
|
|
3259
|
-
return params.db.prepare(`SELECT id, path, start_line, end_line, text, embedding, source
|
|
3260
|
-
FROM chunks
|
|
3261
|
-
WHERE model = ?${params.sourceFilter.sql}`).all(params.providerModel, ...params.sourceFilter.params).map((row) => ({
|
|
3262
|
-
id: row.id,
|
|
3263
|
-
path: row.path,
|
|
3264
|
-
startLine: row.start_line,
|
|
3265
|
-
endLine: row.end_line,
|
|
3266
|
-
text: row.text,
|
|
3267
|
-
embedding: parseEmbedding(row.embedding),
|
|
3268
|
-
source: row.source
|
|
3269
|
-
}));
|
|
3270
|
-
}
|
|
3271
|
-
async function searchKeyword(params) {
|
|
3272
|
-
if (params.limit <= 0) return [];
|
|
3273
|
-
const ftsQuery = params.buildFtsQuery(params.query);
|
|
3274
|
-
if (!ftsQuery) return [];
|
|
3275
|
-
const modelClause = params.providerModel ? " AND model = ?" : "";
|
|
3276
|
-
const modelParams = params.providerModel ? [params.providerModel] : [];
|
|
3277
|
-
return params.db.prepare(`SELECT id, path, source, start_line, end_line, text,\n bm25(${params.ftsTable}) AS rank\n FROM ${params.ftsTable}\n WHERE ${params.ftsTable} MATCH ?${modelClause}${params.sourceFilter.sql}\n ORDER BY rank ASC\n LIMIT ?`).all(ftsQuery, ...modelParams, ...params.sourceFilter.params, params.limit).map((row) => {
|
|
3278
|
-
const textScore = params.bm25RankToScore(row.rank);
|
|
3279
|
-
return {
|
|
3280
|
-
id: row.id,
|
|
3281
|
-
path: row.path,
|
|
3282
|
-
startLine: row.start_line,
|
|
3283
|
-
endLine: row.end_line,
|
|
3284
|
-
score: textScore,
|
|
3285
|
-
textScore,
|
|
3286
|
-
snippet: truncateUtf16Safe(row.text, params.snippetMaxChars),
|
|
3287
|
-
source: row.source
|
|
3288
|
-
};
|
|
3289
|
-
});
|
|
3290
|
-
}
|
|
3291
|
-
|
|
3292
|
-
//#endregion
|
|
3293
|
-
//#region src/memory/manager.ts
|
|
3294
|
-
var manager_exports = /* @__PURE__ */ __exportAll({ MemoryIndexManager: () => MemoryIndexManager });
|
|
3295
|
-
const SNIPPET_MAX_CHARS = 700;
|
|
3296
|
-
const VECTOR_TABLE = "chunks_vec";
|
|
3297
|
-
const FTS_TABLE = "chunks_fts";
|
|
3298
|
-
const EMBEDDING_CACHE_TABLE = "embedding_cache";
|
|
3299
|
-
const BATCH_FAILURE_LIMIT = 2;
|
|
3300
|
-
const log = createSubsystemLogger("memory");
|
|
3301
|
-
const INDEX_CACHE = /* @__PURE__ */ new Map();
|
|
3302
|
-
const INDEX_CACHE_PENDING = /* @__PURE__ */ new Map();
|
|
3303
|
-
var MemoryIndexManager = class MemoryIndexManager extends MemoryManagerEmbeddingOps {
|
|
3304
|
-
static async get(params) {
|
|
3305
|
-
const { cfg, agentId } = params;
|
|
3306
|
-
const settings = resolveMemorySearchConfig(cfg, agentId);
|
|
3307
|
-
if (!settings) return null;
|
|
3308
|
-
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
|
3309
|
-
const key = `${agentId}:${workspaceDir}:${JSON.stringify(settings)}`;
|
|
3310
|
-
const existing = INDEX_CACHE.get(key);
|
|
3311
|
-
if (existing) return existing;
|
|
3312
|
-
const pending = INDEX_CACHE_PENDING.get(key);
|
|
3313
|
-
if (pending) return pending;
|
|
3314
|
-
const createPromise = (async () => {
|
|
3315
|
-
const providerResult = await createEmbeddingProvider({
|
|
3316
|
-
config: cfg,
|
|
3317
|
-
agentDir: resolveAgentDir(cfg, agentId),
|
|
3318
|
-
provider: settings.provider,
|
|
3319
|
-
remote: settings.remote,
|
|
3320
|
-
model: settings.model,
|
|
3321
|
-
fallback: settings.fallback,
|
|
3322
|
-
local: settings.local
|
|
3323
|
-
});
|
|
3324
|
-
const refreshed = INDEX_CACHE.get(key);
|
|
3325
|
-
if (refreshed) return refreshed;
|
|
3326
|
-
const manager = new MemoryIndexManager({
|
|
3327
|
-
cacheKey: key,
|
|
3328
|
-
cfg,
|
|
3329
|
-
agentId,
|
|
3330
|
-
workspaceDir,
|
|
3331
|
-
settings,
|
|
3332
|
-
providerResult,
|
|
3333
|
-
purpose: params.purpose
|
|
3334
|
-
});
|
|
3335
|
-
INDEX_CACHE.set(key, manager);
|
|
3336
|
-
return manager;
|
|
3337
|
-
})();
|
|
3338
|
-
INDEX_CACHE_PENDING.set(key, createPromise);
|
|
3339
|
-
try {
|
|
3340
|
-
return await createPromise;
|
|
3341
|
-
} finally {
|
|
3342
|
-
if (INDEX_CACHE_PENDING.get(key) === createPromise) INDEX_CACHE_PENDING.delete(key);
|
|
3343
|
-
}
|
|
3344
|
-
}
|
|
3345
|
-
constructor(params) {
|
|
3346
|
-
super();
|
|
3347
|
-
this.batchFailureCount = 0;
|
|
3348
|
-
this.batchFailureLock = Promise.resolve();
|
|
3349
|
-
this.vectorReady = null;
|
|
3350
|
-
this.watcher = null;
|
|
3351
|
-
this.watchTimer = null;
|
|
3352
|
-
this.sessionWatchTimer = null;
|
|
3353
|
-
this.sessionUnsubscribe = null;
|
|
3354
|
-
this.intervalTimer = null;
|
|
3355
|
-
this.closed = false;
|
|
3356
|
-
this.dirty = false;
|
|
3357
|
-
this.sessionsDirty = false;
|
|
3358
|
-
this.sessionsDirtyFiles = /* @__PURE__ */ new Set();
|
|
3359
|
-
this.sessionPendingFiles = /* @__PURE__ */ new Set();
|
|
3360
|
-
this.sessionDeltas = /* @__PURE__ */ new Map();
|
|
3361
|
-
this.sessionWarm = /* @__PURE__ */ new Set();
|
|
3362
|
-
this.syncing = null;
|
|
3363
|
-
this.readonlyRecoveryAttempts = 0;
|
|
3364
|
-
this.readonlyRecoverySuccesses = 0;
|
|
3365
|
-
this.readonlyRecoveryFailures = 0;
|
|
3366
|
-
this.cacheKey = params.cacheKey;
|
|
3367
|
-
this.cfg = params.cfg;
|
|
3368
|
-
this.agentId = params.agentId;
|
|
3369
|
-
this.workspaceDir = params.workspaceDir;
|
|
3370
|
-
this.settings = params.settings;
|
|
3371
|
-
this.provider = params.providerResult.provider;
|
|
3372
|
-
this.requestedProvider = params.providerResult.requestedProvider;
|
|
3373
|
-
this.fallbackFrom = params.providerResult.fallbackFrom;
|
|
3374
|
-
this.fallbackReason = params.providerResult.fallbackReason;
|
|
3375
|
-
this.providerUnavailableReason = params.providerResult.providerUnavailableReason;
|
|
3376
|
-
this.openAi = params.providerResult.openAi;
|
|
3377
|
-
this.gemini = params.providerResult.gemini;
|
|
3378
|
-
this.voyage = params.providerResult.voyage;
|
|
3379
|
-
this.mistral = params.providerResult.mistral;
|
|
3380
|
-
this.sources = new Set(params.settings.sources);
|
|
3381
|
-
this.db = this.openDatabase();
|
|
3382
|
-
this.providerKey = this.computeProviderKey();
|
|
3383
|
-
this.cache = {
|
|
3384
|
-
enabled: params.settings.cache.enabled,
|
|
3385
|
-
maxEntries: params.settings.cache.maxEntries
|
|
3386
|
-
};
|
|
3387
|
-
this.fts = {
|
|
3388
|
-
enabled: params.settings.query.hybrid.enabled,
|
|
3389
|
-
available: false
|
|
3390
|
-
};
|
|
3391
|
-
this.ensureSchema();
|
|
3392
|
-
this.vector = {
|
|
3393
|
-
enabled: params.settings.store.vector.enabled,
|
|
3394
|
-
available: null,
|
|
3395
|
-
extensionPath: params.settings.store.vector.extensionPath
|
|
3396
|
-
};
|
|
3397
|
-
const meta = this.readMeta();
|
|
3398
|
-
if (meta?.vectorDims) this.vector.dims = meta.vectorDims;
|
|
3399
|
-
this.ensureWatcher();
|
|
3400
|
-
this.ensureSessionListener();
|
|
3401
|
-
this.ensureIntervalSync();
|
|
3402
|
-
const statusOnly = params.purpose === "status";
|
|
3403
|
-
this.dirty = this.sources.has("memory") && (statusOnly ? !meta : true);
|
|
3404
|
-
this.batch = this.resolveBatchConfig();
|
|
3405
|
-
}
|
|
3406
|
-
async warmSession(sessionKey) {
|
|
3407
|
-
if (!this.settings.sync.onSessionStart) return;
|
|
3408
|
-
const key = sessionKey?.trim() || "";
|
|
3409
|
-
if (key && this.sessionWarm.has(key)) return;
|
|
3410
|
-
this.sync({ reason: "session-start" }).catch((err) => {
|
|
3411
|
-
log.warn(`memory sync failed (session-start): ${String(err)}`);
|
|
3412
|
-
});
|
|
3413
|
-
if (key) this.sessionWarm.add(key);
|
|
3414
|
-
}
|
|
3415
|
-
async search(query, opts) {
|
|
3416
|
-
this.warmSession(opts?.sessionKey);
|
|
3417
|
-
if (this.settings.sync.onSearch && (this.dirty || this.sessionsDirty)) this.sync({ reason: "search" }).catch((err) => {
|
|
3418
|
-
log.warn(`memory sync failed (search): ${String(err)}`);
|
|
3419
|
-
});
|
|
3420
|
-
const cleaned = query.trim();
|
|
3421
|
-
if (!cleaned) return [];
|
|
3422
|
-
const minScore = opts?.minScore ?? this.settings.query.minScore;
|
|
3423
|
-
const maxResults = opts?.maxResults ?? this.settings.query.maxResults;
|
|
3424
|
-
const hybrid = this.settings.query.hybrid;
|
|
3425
|
-
const candidates = Math.min(200, Math.max(1, Math.floor(maxResults * hybrid.candidateMultiplier)));
|
|
3426
|
-
if (!this.provider) {
|
|
3427
|
-
if (!this.fts.enabled || !this.fts.available) {
|
|
3428
|
-
log.warn("memory search: no provider and FTS unavailable");
|
|
3429
|
-
return [];
|
|
3430
|
-
}
|
|
3431
|
-
const keywords = extractKeywords(cleaned);
|
|
3432
|
-
const searchTerms = keywords.length > 0 ? keywords : [cleaned];
|
|
3433
|
-
const resultSets = await Promise.all(searchTerms.map((term) => this.searchKeyword(term, candidates).catch(() => [])));
|
|
3434
|
-
const seenIds = /* @__PURE__ */ new Map();
|
|
3435
|
-
for (const results of resultSets) for (const result of results) {
|
|
3436
|
-
const existing = seenIds.get(result.id);
|
|
3437
|
-
if (!existing || result.score > existing.score) seenIds.set(result.id, result);
|
|
3438
|
-
}
|
|
3439
|
-
return [...seenIds.values()].toSorted((a, b) => b.score - a.score).filter((entry) => entry.score >= minScore).slice(0, maxResults);
|
|
3440
|
-
}
|
|
3441
|
-
const keywordResults = hybrid.enabled ? await this.searchKeyword(cleaned, candidates).catch(() => []) : [];
|
|
3442
|
-
const queryVec = await this.embedQueryWithTimeout(cleaned);
|
|
3443
|
-
const vectorResults = queryVec.some((v) => v !== 0) ? await this.searchVector(queryVec, candidates).catch(() => []) : [];
|
|
3444
|
-
if (!hybrid.enabled) return vectorResults.filter((entry) => entry.score >= minScore).slice(0, maxResults);
|
|
3445
|
-
return (await this.mergeHybridResults({
|
|
3446
|
-
vector: vectorResults,
|
|
3447
|
-
keyword: keywordResults,
|
|
3448
|
-
vectorWeight: hybrid.vectorWeight,
|
|
3449
|
-
textWeight: hybrid.textWeight,
|
|
3450
|
-
mmr: hybrid.mmr,
|
|
3451
|
-
temporalDecay: hybrid.temporalDecay
|
|
3452
|
-
})).filter((entry) => entry.score >= minScore).slice(0, maxResults);
|
|
3453
|
-
}
|
|
3454
|
-
async searchVector(queryVec, limit) {
|
|
3455
|
-
if (!this.provider) return [];
|
|
3456
|
-
return (await searchVector({
|
|
3457
|
-
db: this.db,
|
|
3458
|
-
vectorTable: VECTOR_TABLE,
|
|
3459
|
-
providerModel: this.provider.model,
|
|
3460
|
-
queryVec,
|
|
3461
|
-
limit,
|
|
3462
|
-
snippetMaxChars: SNIPPET_MAX_CHARS,
|
|
3463
|
-
ensureVectorReady: async (dimensions) => await this.ensureVectorReady(dimensions),
|
|
3464
|
-
sourceFilterVec: this.buildSourceFilter("c"),
|
|
3465
|
-
sourceFilterChunks: this.buildSourceFilter()
|
|
3466
|
-
})).map((entry) => entry);
|
|
3467
|
-
}
|
|
3468
|
-
buildFtsQuery(raw) {
|
|
3469
|
-
return buildFtsQuery(raw);
|
|
3470
|
-
}
|
|
3471
|
-
async searchKeyword(query, limit) {
|
|
3472
|
-
if (!this.fts.enabled || !this.fts.available) return [];
|
|
3473
|
-
const sourceFilter = this.buildSourceFilter();
|
|
3474
|
-
const providerModel = this.provider?.model;
|
|
3475
|
-
return (await searchKeyword({
|
|
3476
|
-
db: this.db,
|
|
3477
|
-
ftsTable: FTS_TABLE,
|
|
3478
|
-
providerModel,
|
|
3479
|
-
query,
|
|
3480
|
-
limit,
|
|
3481
|
-
snippetMaxChars: SNIPPET_MAX_CHARS,
|
|
3482
|
-
sourceFilter,
|
|
3483
|
-
buildFtsQuery: (raw) => this.buildFtsQuery(raw),
|
|
3484
|
-
bm25RankToScore
|
|
3485
|
-
})).map((entry) => entry);
|
|
3486
|
-
}
|
|
3487
|
-
mergeHybridResults(params) {
|
|
3488
|
-
return mergeHybridResults({
|
|
3489
|
-
vector: params.vector.map((r) => ({
|
|
3490
|
-
id: r.id,
|
|
3491
|
-
path: r.path,
|
|
3492
|
-
startLine: r.startLine,
|
|
3493
|
-
endLine: r.endLine,
|
|
3494
|
-
source: r.source,
|
|
3495
|
-
snippet: r.snippet,
|
|
3496
|
-
vectorScore: r.score
|
|
3497
|
-
})),
|
|
3498
|
-
keyword: params.keyword.map((r) => ({
|
|
3499
|
-
id: r.id,
|
|
3500
|
-
path: r.path,
|
|
3501
|
-
startLine: r.startLine,
|
|
3502
|
-
endLine: r.endLine,
|
|
3503
|
-
source: r.source,
|
|
3504
|
-
snippet: r.snippet,
|
|
3505
|
-
textScore: r.textScore
|
|
3506
|
-
})),
|
|
3507
|
-
vectorWeight: params.vectorWeight,
|
|
3508
|
-
textWeight: params.textWeight,
|
|
3509
|
-
mmr: params.mmr,
|
|
3510
|
-
temporalDecay: params.temporalDecay,
|
|
3511
|
-
workspaceDir: this.workspaceDir
|
|
3512
|
-
}).then((entries) => entries.map((entry) => entry));
|
|
3513
|
-
}
|
|
3514
|
-
async sync(params) {
|
|
3515
|
-
if (this.closed) return;
|
|
3516
|
-
if (this.syncing) return this.syncing;
|
|
3517
|
-
this.syncing = this.runSyncWithReadonlyRecovery(params).finally(() => {
|
|
3518
|
-
this.syncing = null;
|
|
3519
|
-
});
|
|
3520
|
-
return this.syncing ?? Promise.resolve();
|
|
3521
|
-
}
|
|
3522
|
-
isReadonlyDbError(err) {
|
|
3523
|
-
const readonlyPattern = /attempt to write a readonly database|database is read-only|SQLITE_READONLY/i;
|
|
3524
|
-
const messages = /* @__PURE__ */ new Set();
|
|
3525
|
-
const pushValue = (value) => {
|
|
3526
|
-
if (typeof value !== "string") return;
|
|
3527
|
-
const normalized = value.trim();
|
|
3528
|
-
if (!normalized) return;
|
|
3529
|
-
messages.add(normalized);
|
|
3530
|
-
};
|
|
3531
|
-
pushValue(err instanceof Error ? err.message : String(err));
|
|
3532
|
-
if (err && typeof err === "object") {
|
|
3533
|
-
const record = err;
|
|
3534
|
-
pushValue(record.message);
|
|
3535
|
-
pushValue(record.code);
|
|
3536
|
-
pushValue(record.name);
|
|
3537
|
-
if (record.cause && typeof record.cause === "object") {
|
|
3538
|
-
const cause = record.cause;
|
|
3539
|
-
pushValue(cause.message);
|
|
3540
|
-
pushValue(cause.code);
|
|
3541
|
-
pushValue(cause.name);
|
|
3542
|
-
}
|
|
3543
|
-
}
|
|
3544
|
-
return [...messages].some((value) => readonlyPattern.test(value));
|
|
3545
|
-
}
|
|
3546
|
-
extractErrorReason(err) {
|
|
3547
|
-
if (err instanceof Error && err.message.trim()) return err.message;
|
|
3548
|
-
if (err && typeof err === "object") {
|
|
3549
|
-
const record = err;
|
|
3550
|
-
if (typeof record.message === "string" && record.message.trim()) return record.message;
|
|
3551
|
-
if (typeof record.code === "string" && record.code.trim()) return record.code;
|
|
3552
|
-
}
|
|
3553
|
-
return String(err);
|
|
3554
|
-
}
|
|
3555
|
-
async runSyncWithReadonlyRecovery(params) {
|
|
3556
|
-
try {
|
|
3557
|
-
await this.runSync(params);
|
|
3558
|
-
return;
|
|
3559
|
-
} catch (err) {
|
|
3560
|
-
if (!this.isReadonlyDbError(err) || this.closed) throw err;
|
|
3561
|
-
const reason = this.extractErrorReason(err);
|
|
3562
|
-
this.readonlyRecoveryAttempts += 1;
|
|
3563
|
-
this.readonlyRecoveryLastError = reason;
|
|
3564
|
-
log.warn(`memory sync readonly handle detected; reopening sqlite connection`, { reason });
|
|
3565
|
-
try {
|
|
3566
|
-
this.db.close();
|
|
3567
|
-
} catch {}
|
|
3568
|
-
this.db = this.openDatabase();
|
|
3569
|
-
this.vectorReady = null;
|
|
3570
|
-
this.vector.available = null;
|
|
3571
|
-
this.vector.loadError = void 0;
|
|
3572
|
-
this.ensureSchema();
|
|
3573
|
-
const meta = this.readMeta();
|
|
3574
|
-
this.vector.dims = meta?.vectorDims;
|
|
3575
|
-
try {
|
|
3576
|
-
await this.runSync(params);
|
|
3577
|
-
this.readonlyRecoverySuccesses += 1;
|
|
3578
|
-
} catch (retryErr) {
|
|
3579
|
-
this.readonlyRecoveryFailures += 1;
|
|
3580
|
-
throw retryErr;
|
|
3581
|
-
}
|
|
3582
|
-
}
|
|
3583
|
-
}
|
|
3584
|
-
async readFile(params) {
|
|
3585
|
-
const rawPath = params.relPath.trim();
|
|
3586
|
-
if (!rawPath) throw new Error("path required");
|
|
3587
|
-
const absPath = path.isAbsolute(rawPath) ? path.resolve(rawPath) : path.resolve(this.workspaceDir, rawPath);
|
|
3588
|
-
const relPath = path.relative(this.workspaceDir, absPath).replace(/\\/g, "/");
|
|
3589
|
-
const allowedWorkspace = relPath.length > 0 && !relPath.startsWith("..") && !path.isAbsolute(relPath) && isMemoryPath(relPath);
|
|
3590
|
-
let allowedAdditional = false;
|
|
3591
|
-
if (!allowedWorkspace && this.settings.extraPaths.length > 0) {
|
|
3592
|
-
const additionalPaths = normalizeExtraMemoryPaths(this.workspaceDir, this.settings.extraPaths);
|
|
3593
|
-
for (const additionalPath of additionalPaths) try {
|
|
3594
|
-
const stat = await fs$1.lstat(additionalPath);
|
|
3595
|
-
if (stat.isSymbolicLink()) continue;
|
|
3596
|
-
if (stat.isDirectory()) {
|
|
3597
|
-
if (absPath === additionalPath || absPath.startsWith(`${additionalPath}${path.sep}`)) {
|
|
3598
|
-
allowedAdditional = true;
|
|
3599
|
-
break;
|
|
3600
|
-
}
|
|
3601
|
-
continue;
|
|
3602
|
-
}
|
|
3603
|
-
if (stat.isFile()) {
|
|
3604
|
-
if (absPath === additionalPath && absPath.endsWith(".md")) {
|
|
3605
|
-
allowedAdditional = true;
|
|
3606
|
-
break;
|
|
3607
|
-
}
|
|
3608
|
-
}
|
|
3609
|
-
} catch {}
|
|
3610
|
-
}
|
|
3611
|
-
if (!allowedWorkspace && !allowedAdditional) throw new Error("path required");
|
|
3612
|
-
if (!absPath.endsWith(".md")) throw new Error("path required");
|
|
3613
|
-
if ((await statRegularFile(absPath)).missing) return {
|
|
3614
|
-
text: "",
|
|
3615
|
-
path: relPath
|
|
3616
|
-
};
|
|
3617
|
-
let content;
|
|
3618
|
-
try {
|
|
3619
|
-
content = await fs$1.readFile(absPath, "utf-8");
|
|
3620
|
-
} catch (err) {
|
|
3621
|
-
if (isFileMissingError(err)) return {
|
|
3622
|
-
text: "",
|
|
3623
|
-
path: relPath
|
|
3624
|
-
};
|
|
3625
|
-
throw err;
|
|
3626
|
-
}
|
|
3627
|
-
if (!params.from && !params.lines) return {
|
|
3628
|
-
text: content,
|
|
3629
|
-
path: relPath
|
|
3630
|
-
};
|
|
3631
|
-
const lines = content.split("\n");
|
|
3632
|
-
const start = Math.max(1, params.from ?? 1);
|
|
3633
|
-
const count = Math.max(1, params.lines ?? lines.length);
|
|
3634
|
-
return {
|
|
3635
|
-
text: lines.slice(start - 1, start - 1 + count).join("\n"),
|
|
3636
|
-
path: relPath
|
|
3637
|
-
};
|
|
3638
|
-
}
|
|
3639
|
-
status() {
|
|
3640
|
-
const sourceFilter = this.buildSourceFilter();
|
|
3641
|
-
const files = this.db.prepare(`SELECT COUNT(*) as c FROM files WHERE 1=1${sourceFilter.sql}`).get(...sourceFilter.params);
|
|
3642
|
-
const chunks = this.db.prepare(`SELECT COUNT(*) as c FROM chunks WHERE 1=1${sourceFilter.sql}`).get(...sourceFilter.params);
|
|
3643
|
-
const sourceCounts = (() => {
|
|
3644
|
-
const sources = Array.from(this.sources);
|
|
3645
|
-
if (sources.length === 0) return [];
|
|
3646
|
-
const bySource = /* @__PURE__ */ new Map();
|
|
3647
|
-
for (const source of sources) bySource.set(source, {
|
|
3648
|
-
files: 0,
|
|
3649
|
-
chunks: 0
|
|
3650
|
-
});
|
|
3651
|
-
const fileRows = this.db.prepare(`SELECT source, COUNT(*) as c FROM files WHERE 1=1${sourceFilter.sql} GROUP BY source`).all(...sourceFilter.params);
|
|
3652
|
-
for (const row of fileRows) {
|
|
3653
|
-
const entry = bySource.get(row.source) ?? {
|
|
3654
|
-
files: 0,
|
|
3655
|
-
chunks: 0
|
|
3656
|
-
};
|
|
3657
|
-
entry.files = row.c ?? 0;
|
|
3658
|
-
bySource.set(row.source, entry);
|
|
3659
|
-
}
|
|
3660
|
-
const chunkRows = this.db.prepare(`SELECT source, COUNT(*) as c FROM chunks WHERE 1=1${sourceFilter.sql} GROUP BY source`).all(...sourceFilter.params);
|
|
3661
|
-
for (const row of chunkRows) {
|
|
3662
|
-
const entry = bySource.get(row.source) ?? {
|
|
3663
|
-
files: 0,
|
|
3664
|
-
chunks: 0
|
|
3665
|
-
};
|
|
3666
|
-
entry.chunks = row.c ?? 0;
|
|
3667
|
-
bySource.set(row.source, entry);
|
|
3668
|
-
}
|
|
3669
|
-
return sources.map((source) => Object.assign({ source }, bySource.get(source)));
|
|
3670
|
-
})();
|
|
3671
|
-
const searchMode = this.provider ? "hybrid" : "fts-only";
|
|
3672
|
-
const providerInfo = this.provider ? {
|
|
3673
|
-
provider: this.provider.id,
|
|
3674
|
-
model: this.provider.model
|
|
3675
|
-
} : {
|
|
3676
|
-
provider: "none",
|
|
3677
|
-
model: void 0
|
|
3678
|
-
};
|
|
3679
|
-
return {
|
|
3680
|
-
backend: "builtin",
|
|
3681
|
-
files: files?.c ?? 0,
|
|
3682
|
-
chunks: chunks?.c ?? 0,
|
|
3683
|
-
dirty: this.dirty || this.sessionsDirty,
|
|
3684
|
-
workspaceDir: this.workspaceDir,
|
|
3685
|
-
dbPath: this.settings.store.path,
|
|
3686
|
-
provider: providerInfo.provider,
|
|
3687
|
-
model: providerInfo.model,
|
|
3688
|
-
requestedProvider: this.requestedProvider,
|
|
3689
|
-
sources: Array.from(this.sources),
|
|
3690
|
-
extraPaths: this.settings.extraPaths,
|
|
3691
|
-
sourceCounts,
|
|
3692
|
-
cache: this.cache.enabled ? {
|
|
3693
|
-
enabled: true,
|
|
3694
|
-
entries: this.db.prepare(`SELECT COUNT(*) as c FROM ${EMBEDDING_CACHE_TABLE}`).get()?.c ?? 0,
|
|
3695
|
-
maxEntries: this.cache.maxEntries
|
|
3696
|
-
} : {
|
|
3697
|
-
enabled: false,
|
|
3698
|
-
maxEntries: this.cache.maxEntries
|
|
3699
|
-
},
|
|
3700
|
-
fts: {
|
|
3701
|
-
enabled: this.fts.enabled,
|
|
3702
|
-
available: this.fts.available,
|
|
3703
|
-
error: this.fts.loadError
|
|
3704
|
-
},
|
|
3705
|
-
fallback: this.fallbackReason ? {
|
|
3706
|
-
from: this.fallbackFrom ?? "local",
|
|
3707
|
-
reason: this.fallbackReason
|
|
3708
|
-
} : void 0,
|
|
3709
|
-
vector: {
|
|
3710
|
-
enabled: this.vector.enabled,
|
|
3711
|
-
available: this.vector.available ?? void 0,
|
|
3712
|
-
extensionPath: this.vector.extensionPath,
|
|
3713
|
-
loadError: this.vector.loadError,
|
|
3714
|
-
dims: this.vector.dims
|
|
3715
|
-
},
|
|
3716
|
-
batch: {
|
|
3717
|
-
enabled: this.batch.enabled,
|
|
3718
|
-
failures: this.batchFailureCount,
|
|
3719
|
-
limit: BATCH_FAILURE_LIMIT,
|
|
3720
|
-
wait: this.batch.wait,
|
|
3721
|
-
concurrency: this.batch.concurrency,
|
|
3722
|
-
pollIntervalMs: this.batch.pollIntervalMs,
|
|
3723
|
-
timeoutMs: this.batch.timeoutMs,
|
|
3724
|
-
lastError: this.batchFailureLastError,
|
|
3725
|
-
lastProvider: this.batchFailureLastProvider
|
|
3726
|
-
},
|
|
3727
|
-
custom: {
|
|
3728
|
-
searchMode,
|
|
3729
|
-
providerUnavailableReason: this.providerUnavailableReason,
|
|
3730
|
-
readonlyRecovery: {
|
|
3731
|
-
attempts: this.readonlyRecoveryAttempts,
|
|
3732
|
-
successes: this.readonlyRecoverySuccesses,
|
|
3733
|
-
failures: this.readonlyRecoveryFailures,
|
|
3734
|
-
lastError: this.readonlyRecoveryLastError
|
|
3735
|
-
}
|
|
3736
|
-
}
|
|
3737
|
-
};
|
|
3738
|
-
}
|
|
3739
|
-
async probeVectorAvailability() {
|
|
3740
|
-
if (!this.provider) return false;
|
|
3741
|
-
if (!this.vector.enabled) return false;
|
|
3742
|
-
return this.ensureVectorReady();
|
|
3743
|
-
}
|
|
3744
|
-
async probeEmbeddingAvailability() {
|
|
3745
|
-
if (!this.provider) return {
|
|
3746
|
-
ok: false,
|
|
3747
|
-
error: this.providerUnavailableReason ?? "No embedding provider available (FTS-only mode)"
|
|
3748
|
-
};
|
|
3749
|
-
try {
|
|
3750
|
-
await this.embedBatchWithRetry(["ping"]);
|
|
3751
|
-
return { ok: true };
|
|
3752
|
-
} catch (err) {
|
|
3753
|
-
return {
|
|
3754
|
-
ok: false,
|
|
3755
|
-
error: err instanceof Error ? err.message : String(err)
|
|
3756
|
-
};
|
|
3757
|
-
}
|
|
3758
|
-
}
|
|
3759
|
-
async close() {
|
|
3760
|
-
if (this.closed) return;
|
|
3761
|
-
this.closed = true;
|
|
3762
|
-
const pendingSync = this.syncing;
|
|
3763
|
-
if (this.watchTimer) {
|
|
3764
|
-
clearTimeout(this.watchTimer);
|
|
3765
|
-
this.watchTimer = null;
|
|
3766
|
-
}
|
|
3767
|
-
if (this.sessionWatchTimer) {
|
|
3768
|
-
clearTimeout(this.sessionWatchTimer);
|
|
3769
|
-
this.sessionWatchTimer = null;
|
|
3770
|
-
}
|
|
3771
|
-
if (this.intervalTimer) {
|
|
3772
|
-
clearInterval(this.intervalTimer);
|
|
3773
|
-
this.intervalTimer = null;
|
|
3774
|
-
}
|
|
3775
|
-
if (this.watcher) {
|
|
3776
|
-
await this.watcher.close();
|
|
3777
|
-
this.watcher = null;
|
|
3778
|
-
}
|
|
3779
|
-
if (this.sessionUnsubscribe) {
|
|
3780
|
-
this.sessionUnsubscribe();
|
|
3781
|
-
this.sessionUnsubscribe = null;
|
|
3782
|
-
}
|
|
3783
|
-
if (pendingSync) try {
|
|
3784
|
-
await pendingSync;
|
|
3785
|
-
} catch {}
|
|
3786
|
-
this.db.close();
|
|
3787
|
-
INDEX_CACHE.delete(this.cacheKey);
|
|
3788
|
-
}
|
|
3789
|
-
};
|
|
3790
|
-
|
|
3791
|
-
//#endregion
|
|
3792
|
-
export { executeWithApiKeyRotation as i, parseGeminiAuth as n, collectProviderApiKeysForExecution as r, manager_exports as t };
|