@poolzin/pool-bot 2026.3.27 → 2026.3.28
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/build-info.json +3 -3
- package/package.json +1 -1
- package/dist/acp/client.js +0 -333
- package/dist/acp/commands.js +0 -38
- package/dist/acp/event-mapper.js +0 -135
- package/dist/acp/meta.js +0 -36
- package/dist/acp/server.js +0 -133
- package/dist/acp/session-mapper.js +0 -65
- package/dist/acp/session.js +0 -68
- package/dist/acp/translator.js +0 -441
- package/dist/acp/types.js +0 -6
- package/dist/agents/agent-paths.js +0 -22
- package/dist/agents/agent-scope.js +0 -134
- package/dist/agents/announce-idempotency.js +0 -14
- package/dist/agents/anthropic-payload-log.js +0 -161
- package/dist/agents/api-key-rotation.js +0 -47
- package/dist/agents/apply-patch-update.js +0 -155
- package/dist/agents/apply-patch.js +0 -380
- package/dist/agents/auth-health.js +0 -165
- package/dist/agents/auth-profiles/constants.js +0 -20
- package/dist/agents/auth-profiles/display.js +0 -10
- package/dist/agents/auth-profiles/doctor.js +0 -31
- package/dist/agents/auth-profiles/external-cli-sync.js +0 -62
- package/dist/agents/auth-profiles/oauth.js +0 -302
- package/dist/agents/auth-profiles/order.js +0 -166
- package/dist/agents/auth-profiles/paths.js +0 -27
- package/dist/agents/auth-profiles/profiles.js +0 -72
- package/dist/agents/auth-profiles/repair.js +0 -120
- package/dist/agents/auth-profiles/session-override.js +0 -103
- package/dist/agents/auth-profiles/store.js +0 -323
- package/dist/agents/auth-profiles/usage.js +0 -260
- package/dist/agents/auth-profiles.js +0 -10
- package/dist/agents/bash-process-registry.js +0 -177
- package/dist/agents/bash-tools.exec-runtime.js +0 -415
- package/dist/agents/bash-tools.exec-types.js +0 -1
- package/dist/agents/bash-tools.exec.js +0 -813
- package/dist/agents/bash-tools.js +0 -2
- package/dist/agents/bash-tools.process.js +0 -575
- package/dist/agents/bash-tools.shared.js +0 -205
- package/dist/agents/bedrock-discovery.js +0 -159
- package/dist/agents/bootstrap-files.js +0 -28
- package/dist/agents/bootstrap-hooks.js +0 -19
- package/dist/agents/byteplus-models.js +0 -97
- package/dist/agents/cache-trace.js +0 -189
- package/dist/agents/channel-tools.js +0 -58
- package/dist/agents/chutes-oauth.js +0 -134
- package/dist/agents/cli-backends.js +0 -169
- package/dist/agents/cli-credentials.js +0 -360
- package/dist/agents/cli-runner/helpers.js +0 -328
- package/dist/agents/cli-runner/reliability.js +0 -61
- package/dist/agents/cli-runner.js +0 -316
- package/dist/agents/cli-session.js +0 -27
- package/dist/agents/cli-watchdog-defaults.js +0 -11
- package/dist/agents/cloudflare-ai-gateway.js +0 -31
- package/dist/agents/command-poll-backoff.js +0 -63
- package/dist/agents/compaction.js +0 -270
- package/dist/agents/content-blocks.js +0 -16
- package/dist/agents/context-window-guard.js +0 -40
- package/dist/agents/context.js +0 -34
- package/dist/agents/current-time.js +0 -16
- package/dist/agents/date-time.js +0 -158
- package/dist/agents/defaults.js +0 -6
- package/dist/agents/docs-path.js +0 -20
- package/dist/agents/doubao-models.js +0 -121
- package/dist/agents/failover-error.js +0 -264
- package/dist/agents/glob-pattern.js +0 -42
- package/dist/agents/huggingface-models.js +0 -168
- package/dist/agents/identity-avatar.js +0 -82
- package/dist/agents/identity-file.js +0 -80
- package/dist/agents/identity.js +0 -120
- package/dist/agents/image-sanitization.js +0 -9
- package/dist/agents/lanes.js +0 -2
- package/dist/agents/live-auth-keys.js +0 -168
- package/dist/agents/memory-search.js +0 -242
- package/dist/agents/minimax-vlm.js +0 -83
- package/dist/agents/model-alias-lines.js +0 -18
- package/dist/agents/model-auth-label.js +0 -61
- package/dist/agents/model-auth.js +0 -318
- package/dist/agents/model-catalog.js +0 -128
- package/dist/agents/model-compat.js +0 -17
- package/dist/agents/model-fallback.js +0 -339
- package/dist/agents/model-forward-compat.js +0 -224
- package/dist/agents/model-scan.js +0 -350
- package/dist/agents/model-selection.js +0 -410
- package/dist/agents/models-config.js +0 -111
- package/dist/agents/models-config.providers.js +0 -837
- package/dist/agents/ollama-stream.js +0 -415
- package/dist/agents/opencode-zen-models.js +0 -265
- package/dist/agents/pi-auth-json.js +0 -118
- package/dist/agents/pi-embedded-block-chunker.js +0 -284
- package/dist/agents/pi-embedded-helpers/bootstrap.js +0 -209
- package/dist/agents/pi-embedded-helpers/errors.js +0 -688
- package/dist/agents/pi-embedded-helpers/google.js +0 -12
- package/dist/agents/pi-embedded-helpers/images.js +0 -102
- package/dist/agents/pi-embedded-helpers/messaging-dedupe.js +0 -40
- package/dist/agents/pi-embedded-helpers/openai.js +0 -98
- package/dist/agents/pi-embedded-helpers/thinking.js +0 -37
- package/dist/agents/pi-embedded-helpers/turns.js +0 -95
- package/dist/agents/pi-embedded-helpers/types.js +0 -1
- package/dist/agents/pi-embedded-helpers.js +0 -9
- package/dist/agents/pi-embedded-messaging.js +0 -24
- package/dist/agents/pi-embedded-runner/abort.js +0 -16
- package/dist/agents/pi-embedded-runner/cache-ttl.js +0 -45
- package/dist/agents/pi-embedded-runner/compact.js +0 -623
- package/dist/agents/pi-embedded-runner/compaction-safety-timeout.js +0 -5
- package/dist/agents/pi-embedded-runner/extensions.js +0 -66
- package/dist/agents/pi-embedded-runner/extra-params.js +0 -261
- package/dist/agents/pi-embedded-runner/google.js +0 -404
- package/dist/agents/pi-embedded-runner/history.js +0 -79
- package/dist/agents/pi-embedded-runner/lanes.js +0 -11
- package/dist/agents/pi-embedded-runner/logger.js +0 -2
- package/dist/agents/pi-embedded-runner/model.js +0 -83
- package/dist/agents/pi-embedded-runner/run/attempt.js +0 -1127
- package/dist/agents/pi-embedded-runner/run/compaction-timeout.js +0 -27
- package/dist/agents/pi-embedded-runner/run/images.js +0 -370
- package/dist/agents/pi-embedded-runner/run/params.js +0 -1
- package/dist/agents/pi-embedded-runner/run/payloads.js +0 -212
- package/dist/agents/pi-embedded-runner/run/types.js +0 -1
- package/dist/agents/pi-embedded-runner/run.js +0 -915
- package/dist/agents/pi-embedded-runner/runs.js +0 -116
- package/dist/agents/pi-embedded-runner/sandbox-info.js +0 -22
- package/dist/agents/pi-embedded-runner/session-manager-cache.js +0 -59
- package/dist/agents/pi-embedded-runner/session-manager-init.js +0 -31
- package/dist/agents/pi-embedded-runner/system-prompt.js +0 -43
- package/dist/agents/pi-embedded-runner/thinking.js +0 -42
- package/dist/agents/pi-embedded-runner/tool-name-allowlist.js +0 -19
- package/dist/agents/pi-embedded-runner/tool-result-context-guard.js +0 -262
- package/dist/agents/pi-embedded-runner/tool-result-truncation.js +0 -330
- package/dist/agents/pi-embedded-runner/tool-split.js +0 -8
- package/dist/agents/pi-embedded-runner/types.js +0 -1
- package/dist/agents/pi-embedded-runner/utils.js +0 -22
- package/dist/agents/pi-embedded-runner/wait-for-idle-before-flush.js +0 -29
- package/dist/agents/pi-embedded-runner.js +0 -10
- package/dist/agents/pi-embedded-subscribe.handlers.compaction.js +0 -63
- package/dist/agents/pi-embedded-subscribe.handlers.js +0 -45
- package/dist/agents/pi-embedded-subscribe.handlers.lifecycle.js +0 -75
- package/dist/agents/pi-embedded-subscribe.handlers.messages.js +0 -230
- package/dist/agents/pi-embedded-subscribe.handlers.tools.js +0 -346
- package/dist/agents/pi-embedded-subscribe.handlers.types.js +0 -1
- package/dist/agents/pi-embedded-subscribe.js +0 -640
- package/dist/agents/pi-embedded-subscribe.raw-stream.js +0 -28
- package/dist/agents/pi-embedded-subscribe.tools.js +0 -317
- package/dist/agents/pi-embedded-subscribe.types.js +0 -1
- package/dist/agents/pi-embedded-utils.js +0 -344
- package/dist/agents/pi-embedded.js +0 -1
- package/dist/agents/pi-extensions/compaction-safeguard-runtime.js +0 -4
- package/dist/agents/pi-extensions/compaction-safeguard.js +0 -294
- package/dist/agents/pi-extensions/context-pruning/extension.js +0 -32
- package/dist/agents/pi-extensions/context-pruning/pruner.js +0 -263
- package/dist/agents/pi-extensions/context-pruning/runtime.js +0 -21
- package/dist/agents/pi-extensions/context-pruning/settings.js +0 -71
- package/dist/agents/pi-extensions/context-pruning/tools.js +0 -44
- package/dist/agents/pi-extensions/context-pruning.js +0 -9
- package/dist/agents/pi-extensions/session-manager-runtime-registry.js +0 -23
- package/dist/agents/pi-model-discovery.js +0 -17
- package/dist/agents/pi-settings.js +0 -59
- package/dist/agents/pi-tool-definition-adapter.js +0 -167
- package/dist/agents/pi-tools.abort.js +0 -41
- package/dist/agents/pi-tools.before-tool-call.js +0 -208
- package/dist/agents/pi-tools.js +0 -376
- package/dist/agents/pi-tools.policy.js +0 -239
- package/dist/agents/pi-tools.read.js +0 -526
- package/dist/agents/pi-tools.schema.js +0 -174
- package/dist/agents/pi-tools.types.js +0 -1
- package/dist/agents/poolbot-tools.js +0 -168
- package/dist/agents/provider/integration.js +0 -136
- package/dist/agents/provider/rate-limits.js +0 -458
- package/dist/agents/provider/request-monitor.js +0 -449
- package/dist/agents/provider/token-pool.js +0 -541
- package/dist/agents/pty-dsr.js +0 -13
- package/dist/agents/pty-keys.js +0 -235
- package/dist/agents/sandbox/browser-bridges.js +0 -1
- package/dist/agents/sandbox/browser.js +0 -318
- package/dist/agents/sandbox/config-hash.js +0 -32
- package/dist/agents/sandbox/config.js +0 -133
- package/dist/agents/sandbox/constants.js +0 -47
- package/dist/agents/sandbox/context.js +0 -117
- package/dist/agents/sandbox/docker.js +0 -384
- package/dist/agents/sandbox/fs-bridge.js +0 -146
- package/dist/agents/sandbox/fs-paths.js +0 -205
- package/dist/agents/sandbox/hash.js +0 -4
- package/dist/agents/sandbox/manage.js +0 -91
- package/dist/agents/sandbox/novnc-auth.js +0 -62
- package/dist/agents/sandbox/prune.js +0 -87
- package/dist/agents/sandbox/registry.js +0 -121
- package/dist/agents/sandbox/runtime-status.js +0 -90
- package/dist/agents/sandbox/sanitize-env-vars.js +0 -82
- package/dist/agents/sandbox/shared.js +0 -42
- package/dist/agents/sandbox/tool-policy.js +0 -106
- package/dist/agents/sandbox/types.docker.js +0 -1
- package/dist/agents/sandbox/types.js +0 -1
- package/dist/agents/sandbox/validate-sandbox-security.js +0 -157
- package/dist/agents/sandbox/workspace.js +0 -39
- package/dist/agents/sandbox-paths.js +0 -148
- package/dist/agents/sandbox-tool-policy.js +0 -26
- package/dist/agents/sandbox.js +0 -7
- package/dist/agents/sanitize-for-prompt.js +0 -18
- package/dist/agents/schema/clean-for-gemini.js +0 -342
- package/dist/agents/schema/typebox.js +0 -22
- package/dist/agents/session-dirs.js +0 -20
- package/dist/agents/session-file-repair.js +0 -83
- package/dist/agents/session-slug.js +0 -139
- package/dist/agents/session-tool-result-guard-wrapper.js +0 -47
- package/dist/agents/session-tool-result-guard.js +0 -180
- package/dist/agents/session-transcript-repair.js +0 -279
- package/dist/agents/session-write-lock.js +0 -437
- package/dist/agents/shell-utils.js +0 -150
- package/dist/agents/skills/bundled-dir.js +0 -79
- package/dist/agents/skills/config.js +0 -142
- package/dist/agents/skills/env-overrides.js +0 -148
- package/dist/agents/skills/filter.js +0 -24
- package/dist/agents/skills/frontmatter.js +0 -81
- package/dist/agents/skills/plugin-skills.js +0 -62
- package/dist/agents/skills/refresh.js +0 -135
- package/dist/agents/skills/serialize.js +0 -13
- package/dist/agents/skills/types.js +0 -1
- package/dist/agents/skills/workspace.js +0 -580
- package/dist/agents/skills-install.js +0 -427
- package/dist/agents/skills-status.js +0 -183
- package/dist/agents/skills.js +0 -13
- package/dist/agents/stable-stringify.js +0 -12
- package/dist/agents/subagent-announce-queue.js +0 -173
- package/dist/agents/subagent-announce.js +0 -972
- package/dist/agents/subagent-depth.js +0 -137
- package/dist/agents/subagent-lifecycle-events.js +0 -19
- package/dist/agents/subagent-registry-cleanup.js +0 -31
- package/dist/agents/subagent-registry-completion.js +0 -68
- package/dist/agents/subagent-registry-queries.js +0 -117
- package/dist/agents/subagent-registry-state.js +0 -46
- package/dist/agents/subagent-registry.js +0 -767
- package/dist/agents/subagent-registry.store.js +0 -74
- package/dist/agents/subagent-registry.types.js +0 -1
- package/dist/agents/subagent-spawn.js +0 -433
- package/dist/agents/synthetic-models.js +0 -182
- package/dist/agents/system-prompt-params.js +0 -70
- package/dist/agents/system-prompt-report.js +0 -130
- package/dist/agents/system-prompt.js +0 -532
- package/dist/agents/timeout.js +0 -36
- package/dist/agents/together-models.js +0 -127
- package/dist/agents/tool-call-id.js +0 -216
- package/dist/agents/tool-display.js +0 -209
- package/dist/agents/tool-display.json +0 -308
- package/dist/agents/tool-images.js +0 -272
- package/dist/agents/tool-loop-detection.js +0 -466
- package/dist/agents/tool-mutation.js +0 -164
- package/dist/agents/tool-policy-pipeline.js +0 -69
- package/dist/agents/tool-policy.js +0 -254
- package/dist/agents/tool-summaries.js +0 -10
- package/dist/agents/tools/agent-step.js +0 -44
- package/dist/agents/tools/agents-list-tool.js +0 -66
- package/dist/agents/tools/browser-tool.js +0 -702
- package/dist/agents/tools/browser-tool.schema.js +0 -105
- package/dist/agents/tools/canvas-tool.js +0 -190
- package/dist/agents/tools/cron-tool.js +0 -410
- package/dist/agents/tools/deep-research-tool.js +0 -225
- package/dist/agents/tools/discord-actions-guild.js +0 -456
- package/dist/agents/tools/discord-actions-messaging.js +0 -383
- package/dist/agents/tools/discord-actions-moderation.js +0 -92
- package/dist/agents/tools/discord-actions.js +0 -61
- package/dist/agents/tools/gateway-tool.js +0 -216
- package/dist/agents/tools/gateway.js +0 -98
- package/dist/agents/tools/image-generate-tool.js +0 -235
- package/dist/agents/tools/image-tool.helpers.js +0 -55
- package/dist/agents/tools/image-tool.js +0 -485
- package/dist/agents/tools/memory-tool.js +0 -191
- package/dist/agents/tools/message-tool.js +0 -515
- package/dist/agents/tools/nodes-file-tool.js +0 -197
- package/dist/agents/tools/nodes-tool.js +0 -491
- package/dist/agents/tools/nodes-utils.js +0 -57
- package/dist/agents/tools/pdf-native-providers.js +0 -102
- package/dist/agents/tools/pdf-tool.helpers.js +0 -86
- package/dist/agents/tools/pdf-tool.js +0 -508
- package/dist/agents/tools/session-status-tool.js +0 -310
- package/dist/agents/tools/sessions-access.js +0 -178
- package/dist/agents/tools/sessions-announce-target.js +0 -43
- package/dist/agents/tools/sessions-helpers.js +0 -89
- package/dist/agents/tools/sessions-history-tool.js +0 -218
- package/dist/agents/tools/sessions-list-tool.js +0 -161
- package/dist/agents/tools/sessions-resolution.js +0 -206
- package/dist/agents/tools/sessions-send-helpers.js +0 -122
- package/dist/agents/tools/sessions-send-tool.a2a.js +0 -119
- package/dist/agents/tools/sessions-send-tool.js +0 -345
- package/dist/agents/tools/sessions-spawn-tool.js +0 -68
- package/dist/agents/tools/slack-actions.js +0 -243
- package/dist/agents/tools/subagents-tool.js +0 -617
- package/dist/agents/tools/telegram-actions.js +0 -305
- package/dist/agents/tools/tts-tool.js +0 -47
- package/dist/agents/tools/web-fetch-utils.js +0 -209
- package/dist/agents/tools/web-fetch.js +0 -581
- package/dist/agents/tools/web-search.js +0 -524
- package/dist/agents/tools/web-shared.js +0 -125
- package/dist/agents/tools/web-tools.js +0 -2
- package/dist/agents/tools/whatsapp-actions.js +0 -40
- package/dist/agents/tools/whatsapp-target-auth.js +0 -18
- package/dist/agents/transcript-policy.js +0 -97
- package/dist/agents/usage.js +0 -79
- package/dist/agents/venice-models.js +0 -350
- package/dist/agents/workspace-dir.js +0 -18
- package/dist/agents/workspace-dirs.js +0 -14
- package/dist/agents/workspace-run.js +0 -67
- package/dist/agents/workspace-templates.js +0 -44
- package/dist/agents/workspace.js +0 -480
- package/dist/auto-reply/auto-reply/reply/agent-runner-execution.js +0 -502
- package/dist/auto-reply/auto-reply/reply/agent-runner-helpers.js +0 -65
- package/dist/auto-reply/auto-reply/reply/agent-runner-memory.js +0 -160
- package/dist/auto-reply/auto-reply/reply/agent-runner-payloads.js +0 -85
- package/dist/auto-reply/auto-reply/reply/agent-runner-utils.js +0 -101
- package/dist/auto-reply/auto-reply/reply/bash-command.js +0 -338
- package/dist/auto-reply/auto-reply/reply/block-streaming.js +0 -91
- package/dist/auto-reply/auto-reply/reply/commands-approve.js +0 -88
- package/dist/auto-reply/auto-reply/reply/commands-bash.js +0 -26
- package/dist/auto-reply/auto-reply/reply/commands-compact.js +0 -107
- package/dist/auto-reply/auto-reply/reply/commands-config.js +0 -241
- package/dist/auto-reply/auto-reply/reply/commands-context-report.js +0 -295
- package/dist/auto-reply/auto-reply/reply/commands-context.js +0 -30
- package/dist/auto-reply/auto-reply/reply/commands-core.js +0 -151
- package/dist/auto-reply/auto-reply/reply/commands-export-session.js +0 -163
- package/dist/auto-reply/auto-reply/reply/commands-info.js +0 -184
- package/dist/auto-reply/auto-reply/reply/commands-models.js +0 -299
- package/dist/auto-reply/auto-reply/reply/commands-plugin.js +0 -35
- package/dist/auto-reply/auto-reply/reply/commands-ptt.js +0 -171
- package/dist/auto-reply/auto-reply/reply/commands-setunset-standard.js +0 -13
- package/dist/auto-reply/auto-reply/reply/commands-setunset.js +0 -73
- package/dist/auto-reply/auto-reply/reply/commands-slash-parse.js +0 -31
- package/dist/auto-reply/auto-reply/reply/commands-status.js +0 -178
- package/dist/auto-reply/auto-reply/reply/commands-subagents.js +0 -73
- package/dist/auto-reply/auto-reply/reply/commands-system-prompt.js +0 -117
- package/dist/auto-reply/auto-reply/reply/commands-tts.js +0 -231
- package/dist/auto-reply/auto-reply/reply/commands-types.js +0 -1
- package/dist/auto-reply/auto-reply/reply/directive-handling.impl.js +0 -380
- package/dist/auto-reply/auto-reply/reply/followup-runner.js +0 -227
- package/dist/auto-reply/auto-reply/reply/get-reply-directives-apply.js +0 -201
- package/dist/auto-reply/auto-reply/reply/get-reply-directives-utils.js +0 -54
- package/dist/auto-reply/auto-reply/reply/get-reply-directives.js +0 -332
- package/dist/auto-reply/auto-reply/reply/get-reply-inline-actions.js +0 -258
- package/dist/auto-reply/auto-reply/reply/get-reply-run.js +0 -297
- package/dist/auto-reply/auto-reply/reply/groups.js +0 -102
- package/dist/auto-reply/auto-reply/reply/mentions.js +0 -129
- package/dist/auto-reply/auto-reply/reply/reply-delivery.js +0 -92
- package/dist/auto-reply/auto-reply/reply/reply-directives.js +0 -30
- package/dist/auto-reply/auto-reply/reply/reply-dispatcher.js +0 -152
- package/dist/auto-reply/auto-reply/reply/reply-elevated.js +0 -166
- package/dist/auto-reply/auto-reply/reply/reply-inline.js +0 -28
- package/dist/auto-reply/auto-reply/reply/reply-payloads.js +0 -114
- package/dist/auto-reply/auto-reply/reply/reply-reference.js +0 -36
- package/dist/auto-reply/auto-reply/reply/reply-tags.js +0 -13
- package/dist/auto-reply/auto-reply/reply/reply-threading.js +0 -41
- package/dist/auto-reply/auto-reply/reply/session-updates.js +0 -233
- package/dist/auto-reply/auto-reply/reply/stage-sandbox-media.js +0 -146
- package/dist/auto-reply/chunk.js +0 -358
- package/dist/auto-reply/command-auth.js +0 -247
- package/dist/auto-reply/command-detection.js +0 -56
- package/dist/auto-reply/commands-args.js +0 -85
- package/dist/auto-reply/commands-registry.data.js +0 -699
- package/dist/auto-reply/commands-registry.js +0 -352
- package/dist/auto-reply/commands-registry.types.js +0 -1
- package/dist/auto-reply/dispatch.js +0 -59
- package/dist/auto-reply/envelope.js +0 -165
- package/dist/auto-reply/fallback-state.js +0 -114
- package/dist/auto-reply/group-activation.js +0 -27
- package/dist/auto-reply/heartbeat-reply-payload.js +0 -18
- package/dist/auto-reply/heartbeat.js +0 -120
- package/dist/auto-reply/inbound-debounce.js +0 -79
- package/dist/auto-reply/media-note.js +0 -72
- package/dist/auto-reply/model-runtime.js +0 -68
- package/dist/auto-reply/model.js +0 -28
- package/dist/auto-reply/reply/abort.js +0 -220
- package/dist/auto-reply/reply/agent-runner-execution.js +0 -502
- package/dist/auto-reply/reply/agent-runner-helpers.js +0 -65
- package/dist/auto-reply/reply/agent-runner-memory.js +0 -160
- package/dist/auto-reply/reply/agent-runner-payloads.js +0 -85
- package/dist/auto-reply/reply/agent-runner-utils.js +0 -101
- package/dist/auto-reply/reply/agent-runner.js +0 -505
- package/dist/auto-reply/reply/audio-tags.js +0 -1
- package/dist/auto-reply/reply/bash-command.js +0 -338
- package/dist/auto-reply/reply/block-reply-coalescer.js +0 -101
- package/dist/auto-reply/reply/block-reply-pipeline.js +0 -179
- package/dist/auto-reply/reply/block-streaming.js +0 -91
- package/dist/auto-reply/reply/body.js +0 -37
- package/dist/auto-reply/reply/command-gates.js +0 -25
- package/dist/auto-reply/reply/commands-allowlist.js +0 -609
- package/dist/auto-reply/reply/commands-approve.js +0 -88
- package/dist/auto-reply/reply/commands-bash.js +0 -26
- package/dist/auto-reply/reply/commands-compact.js +0 -107
- package/dist/auto-reply/reply/commands-config.js +0 -241
- package/dist/auto-reply/reply/commands-context-report.js +0 -295
- package/dist/auto-reply/reply/commands-context.js +0 -30
- package/dist/auto-reply/reply/commands-core.js +0 -151
- package/dist/auto-reply/reply/commands-export-session.js +0 -163
- package/dist/auto-reply/reply/commands-info.js +0 -184
- package/dist/auto-reply/reply/commands-models.js +0 -299
- package/dist/auto-reply/reply/commands-plugin.js +0 -35
- package/dist/auto-reply/reply/commands-ptt.js +0 -171
- package/dist/auto-reply/reply/commands-session.js +0 -466
- package/dist/auto-reply/reply/commands-setunset-standard.js +0 -13
- package/dist/auto-reply/reply/commands-setunset.js +0 -73
- package/dist/auto-reply/reply/commands-slash-parse.js +0 -31
- package/dist/auto-reply/reply/commands-status.js +0 -178
- package/dist/auto-reply/reply/commands-subagents/action-agents.js +0 -44
- package/dist/auto-reply/reply/commands-subagents/action-focus.js +0 -64
- package/dist/auto-reply/reply/commands-subagents/action-help.js +0 -4
- package/dist/auto-reply/reply/commands-subagents/action-info.js +0 -45
- package/dist/auto-reply/reply/commands-subagents/action-kill.js +0 -60
- package/dist/auto-reply/reply/commands-subagents/action-list.js +0 -44
- package/dist/auto-reply/reply/commands-subagents/action-log.js +0 -29
- package/dist/auto-reply/reply/commands-subagents/action-send.js +0 -119
- package/dist/auto-reply/reply/commands-subagents/action-spawn.js +0 -52
- package/dist/auto-reply/reply/commands-subagents/action-unfocus.js +0 -30
- package/dist/auto-reply/reply/commands-subagents/shared.js +0 -303
- package/dist/auto-reply/reply/commands-subagents.js +0 -73
- package/dist/auto-reply/reply/commands-system-prompt.js +0 -117
- package/dist/auto-reply/reply/commands-tts.js +0 -231
- package/dist/auto-reply/reply/commands-types.js +0 -1
- package/dist/auto-reply/reply/commands.js +0 -3
- package/dist/auto-reply/reply/config-commands.js +0 -58
- package/dist/auto-reply/reply/config-value.js +0 -40
- package/dist/auto-reply/reply/debug-commands.js +0 -58
- package/dist/auto-reply/reply/directive-handling.auth.js +0 -191
- package/dist/auto-reply/reply/directive-handling.fast-lane.js +0 -60
- package/dist/auto-reply/reply/directive-handling.impl.js +0 -380
- package/dist/auto-reply/reply/directive-handling.js +0 -5
- package/dist/auto-reply/reply/directive-handling.levels.js +0 -17
- package/dist/auto-reply/reply/directive-handling.model-picker.js +0 -70
- package/dist/auto-reply/reply/directive-handling.model.js +0 -279
- package/dist/auto-reply/reply/directive-handling.params.js +0 -1
- package/dist/auto-reply/reply/directive-handling.parse.js +0 -84
- package/dist/auto-reply/reply/directive-handling.persist.js +0 -169
- package/dist/auto-reply/reply/directive-handling.queue-validation.js +0 -48
- package/dist/auto-reply/reply/directive-handling.shared.js +0 -63
- package/dist/auto-reply/reply/directive-parsing.js +0 -36
- package/dist/auto-reply/reply/directives.js +0 -114
- package/dist/auto-reply/reply/dispatch-from-config.js +0 -424
- package/dist/auto-reply/reply/dispatcher-registry.js +0 -43
- package/dist/auto-reply/reply/elevated-unavailable.js +0 -20
- package/dist/auto-reply/reply/exec/directive.js +0 -183
- package/dist/auto-reply/reply/exec.js +0 -1
- package/dist/auto-reply/reply/followup-runner.js +0 -227
- package/dist/auto-reply/reply/get-reply-directives-apply.js +0 -201
- package/dist/auto-reply/reply/get-reply-directives-utils.js +0 -54
- package/dist/auto-reply/reply/get-reply-directives.js +0 -332
- package/dist/auto-reply/reply/get-reply-inline-actions.js +0 -258
- package/dist/auto-reply/reply/get-reply-run.js +0 -297
- package/dist/auto-reply/reply/get-reply.js +0 -299
- package/dist/auto-reply/reply/groups.js +0 -102
- package/dist/auto-reply/reply/history.js +0 -110
- package/dist/auto-reply/reply/inbound-context.js +0 -59
- package/dist/auto-reply/reply/inbound-dedupe.js +0 -39
- package/dist/auto-reply/reply/inbound-meta.js +0 -141
- package/dist/auto-reply/reply/inbound-sender-meta.js +0 -45
- package/dist/auto-reply/reply/inbound-text.js +0 -3
- package/dist/auto-reply/reply/line-directives.js +0 -294
- package/dist/auto-reply/reply/memory-flush.js +0 -66
- package/dist/auto-reply/reply/mentions.js +0 -129
- package/dist/auto-reply/reply/message-preprocess-hooks.js +0 -17
- package/dist/auto-reply/reply/model-selection.js +0 -439
- package/dist/auto-reply/reply/normalize-reply.js +0 -63
- package/dist/auto-reply/reply/post-compaction-audit.js +0 -96
- package/dist/auto-reply/reply/post-compaction-context.js +0 -98
- package/dist/auto-reply/reply/provider-dispatcher.js +0 -19
- package/dist/auto-reply/reply/queue/cleanup.js +0 -19
- package/dist/auto-reply/reply/queue/directive.js +0 -155
- package/dist/auto-reply/reply/queue/drain.js +0 -111
- package/dist/auto-reply/reply/queue/enqueue.js +0 -48
- package/dist/auto-reply/reply/queue/normalize.js +0 -30
- package/dist/auto-reply/reply/queue/settings.js +0 -52
- package/dist/auto-reply/reply/queue/state.js +0 -54
- package/dist/auto-reply/reply/queue/types.js +0 -1
- package/dist/auto-reply/reply/queue.js +0 -6
- package/dist/auto-reply/reply/reply-delivery.js +0 -92
- package/dist/auto-reply/reply/reply-directives.js +0 -30
- package/dist/auto-reply/reply/reply-dispatcher.js +0 -152
- package/dist/auto-reply/reply/reply-elevated.js +0 -166
- package/dist/auto-reply/reply/reply-inline.js +0 -28
- package/dist/auto-reply/reply/reply-payloads.js +0 -114
- package/dist/auto-reply/reply/reply-reference.js +0 -36
- package/dist/auto-reply/reply/reply-tags.js +0 -13
- package/dist/auto-reply/reply/reply-threading.js +0 -41
- package/dist/auto-reply/reply/response-prefix-template.js +0 -76
- package/dist/auto-reply/reply/route-reply.js +0 -115
- package/dist/auto-reply/reply/session-reset-model.js +0 -133
- package/dist/auto-reply/reply/session-reset-prompt.js +0 -1
- package/dist/auto-reply/reply/session-run-accounting.js +0 -33
- package/dist/auto-reply/reply/session-updates.js +0 -233
- package/dist/auto-reply/reply/session-usage.js +0 -79
- package/dist/auto-reply/reply/session.js +0 -400
- package/dist/auto-reply/reply/stage-sandbox-media.js +0 -146
- package/dist/auto-reply/reply/streaming-directives.js +0 -103
- package/dist/auto-reply/reply/strip-inbound-meta.js +0 -147
- package/dist/auto-reply/reply/subagents-utils.js +0 -78
- package/dist/auto-reply/reply/test-ctx.js +0 -15
- package/dist/auto-reply/reply/typing-mode.js +0 -91
- package/dist/auto-reply/reply/typing.js +0 -157
- package/dist/auto-reply/reply/untrusted-context.js +0 -15
- package/dist/auto-reply/reply.directive.directive-behavior.e2e-mocks.js +0 -12
- package/dist/auto-reply/reply.js +0 -5
- package/dist/auto-reply/send-policy.js +0 -37
- package/dist/auto-reply/skill-commands.js +0 -97
- package/dist/auto-reply/status.js +0 -638
- package/dist/auto-reply/templating.js +0 -44
- package/dist/auto-reply/thinking.js +0 -190
- package/dist/auto-reply/tokens.js +0 -31
- package/dist/auto-reply/tool-meta.js +0 -112
- package/dist/auto-reply/types.js +0 -1
- package/dist/browser/bridge-auth-registry.js +0 -26
- package/dist/browser/bridge-server.js +0 -74
- package/dist/browser/browser-profile-manager.js +0 -319
- package/dist/browser/cdp-proxy-bypass.js +0 -129
- package/dist/browser/cdp-timeouts.js +0 -41
- package/dist/browser/cdp.helpers.js +0 -143
- package/dist/browser/cdp.js +0 -313
- package/dist/browser/chrome-extension-validator.js +0 -406
- package/dist/browser/chrome-mcp-snapshot.js +0 -222
- package/dist/browser/chrome-mcp.js +0 -421
- package/dist/browser/chrome-mcp.snapshot.js +0 -133
- package/dist/browser/chrome.executables.js +0 -509
- package/dist/browser/chrome.js +0 -253
- package/dist/browser/chrome.profile-decoration.js +0 -147
- package/dist/browser/client-actions-core.js +0 -100
- package/dist/browser/client-actions-observe.js +0 -100
- package/dist/browser/client-actions-state.js +0 -169
- package/dist/browser/client-actions-types.js +0 -1
- package/dist/browser/client-actions-url.js +0 -10
- package/dist/browser/client-actions.js +0 -4
- package/dist/browser/client-fetch.js +0 -134
- package/dist/browser/client.js +0 -137
- package/dist/browser/config.js +0 -201
- package/dist/browser/constants.js +0 -8
- package/dist/browser/control-auth.js +0 -73
- package/dist/browser/control-service.js +0 -72
- package/dist/browser/csrf.js +0 -64
- package/dist/browser/errors.js +0 -67
- package/dist/browser/extension-relay-auth.js +0 -55
- package/dist/browser/extension-relay.js +0 -647
- package/dist/browser/form-fields.js +0 -22
- package/dist/browser/http-auth.js +0 -52
- package/dist/browser/navigation-guard.js +0 -39
- package/dist/browser/output-atomic.js +0 -44
- package/dist/browser/paths.js +0 -114
- package/dist/browser/profile-capabilities.js +0 -47
- package/dist/browser/profiles-service.js +0 -132
- package/dist/browser/profiles.js +0 -98
- package/dist/browser/proxy-files.js +0 -32
- package/dist/browser/pw-ai-module.js +0 -42
- package/dist/browser/pw-ai-state.js +0 -7
- package/dist/browser/pw-ai.js +0 -2
- package/dist/browser/pw-role-snapshot.js +0 -310
- package/dist/browser/pw-session.js +0 -603
- package/dist/browser/pw-tools-core.activity.js +0 -44
- package/dist/browser/pw-tools-core.downloads.js +0 -176
- package/dist/browser/pw-tools-core.interactions.js +0 -525
- package/dist/browser/pw-tools-core.js +0 -8
- package/dist/browser/pw-tools-core.responses.js +0 -83
- package/dist/browser/pw-tools-core.shared.js +0 -48
- package/dist/browser/pw-tools-core.snapshot.js +0 -142
- package/dist/browser/pw-tools-core.state.js +0 -153
- package/dist/browser/pw-tools-core.storage.js +0 -72
- package/dist/browser/pw-tools-core.trace.js +0 -25
- package/dist/browser/resolved-config-refresh.js +0 -42
- package/dist/browser/routes/agent.act.js +0 -518
- package/dist/browser/routes/agent.act.shared.js +0 -38
- package/dist/browser/routes/agent.debug.js +0 -133
- package/dist/browser/routes/agent.js +0 -10
- package/dist/browser/routes/agent.shared.js +0 -89
- package/dist/browser/routes/agent.snapshot.js +0 -275
- package/dist/browser/routes/agent.storage.js +0 -392
- package/dist/browser/routes/basic.js +0 -173
- package/dist/browser/routes/dispatcher.js +0 -86
- package/dist/browser/routes/index.js +0 -8
- package/dist/browser/routes/path-output.js +0 -1
- package/dist/browser/routes/tabs.js +0 -174
- package/dist/browser/routes/types.js +0 -1
- package/dist/browser/routes/utils.js +0 -57
- package/dist/browser/safe-filename.js +0 -25
- package/dist/browser/screenshot.js +0 -39
- package/dist/browser/server-context.chrome-test-harness.js +0 -20
- package/dist/browser/server-context.js +0 -540
- package/dist/browser/server-context.types.js +0 -1
- package/dist/browser/server-lifecycle.js +0 -37
- package/dist/browser/server-middleware.js +0 -31
- package/dist/browser/server.js +0 -103
- package/dist/browser/snapshot-roles.js +0 -60
- package/dist/browser/target-id.js +0 -16
- package/dist/browser/test-port.js +0 -16
- package/dist/browser/trash.js +0 -21
- package/dist/canvas-host/a2ui.js +0 -191
- package/dist/canvas-host/file-resolver.js +0 -43
- package/dist/canvas-host/server.js +0 -414
- package/dist/channel-web.js +0 -8
- package/dist/channels/account-summary.js +0 -19
- package/dist/channels/ack-reactions.js +0 -56
- package/dist/channels/allow-from.js +0 -26
- package/dist/channels/allowlist-match.js +0 -23
- package/dist/channels/allowlists/resolve-utils.js +0 -124
- package/dist/channels/channel-config.js +0 -138
- package/dist/channels/channels/directory-config.js +0 -185
- package/dist/channels/channels/discord/handle-action.guild-admin.js +0 -332
- package/dist/channels/channels/discord/handle-action.js +0 -165
- package/dist/channels/channels/discord.js +0 -413
- package/dist/channels/channels/dock.js +0 -436
- package/dist/channels/channels/index.js +0 -51
- package/dist/channels/channels/plugins/outbound/discord.js +0 -101
- package/dist/channels/channels/whatsapp.js +0 -17
- package/dist/channels/chat-type.js +0 -16
- package/dist/channels/command-gating.js +0 -24
- package/dist/channels/conversation-label.js +0 -48
- package/dist/channels/dock.js +0 -436
- package/dist/channels/draft-stream-controls.js +0 -89
- package/dist/channels/draft-stream-loop.js +0 -88
- package/dist/channels/location.js +0 -44
- package/dist/channels/logging.js +0 -13
- package/dist/channels/mention-gating.js +0 -26
- package/dist/channels/model-overrides.js +0 -82
- package/dist/channels/plugins/account-action-gate.js +0 -13
- package/dist/channels/plugins/account-helpers.js +0 -26
- package/dist/channels/plugins/actions/discord/handle-action.guild-admin.js +0 -332
- package/dist/channels/plugins/actions/discord/handle-action.js +0 -165
- package/dist/channels/plugins/actions/discord.js +0 -93
- package/dist/channels/plugins/actions/signal.js +0 -115
- package/dist/channels/plugins/actions/telegram.js +0 -173
- package/dist/channels/plugins/agent-tools/whatsapp-login.js +0 -63
- package/dist/channels/plugins/allowlist-match.js +0 -1
- package/dist/channels/plugins/bluebubbles-actions.js +0 -16
- package/dist/channels/plugins/catalog.js +0 -223
- package/dist/channels/plugins/channel-config.js +0 -1
- package/dist/channels/plugins/config-helpers.js +0 -87
- package/dist/channels/plugins/config-schema.js +0 -8
- package/dist/channels/plugins/config-writes.js +0 -21
- package/dist/channels/plugins/directory-config.js +0 -185
- package/dist/channels/plugins/group-mentions.js +0 -324
- package/dist/channels/plugins/helpers.js +0 -12
- package/dist/channels/plugins/index.js +0 -51
- package/dist/channels/plugins/load.js +0 -22
- package/dist/channels/plugins/media-limits.js +0 -15
- package/dist/channels/plugins/message-action-names.js +0 -53
- package/dist/channels/plugins/message-actions.js +0 -64
- package/dist/channels/plugins/normalize/discord.js +0 -40
- package/dist/channels/plugins/normalize/imessage.js +0 -43
- package/dist/channels/plugins/normalize/signal.js +0 -65
- package/dist/channels/plugins/normalize/slack.js +0 -24
- package/dist/channels/plugins/normalize/telegram.js +0 -38
- package/dist/channels/plugins/normalize/whatsapp.js +0 -17
- package/dist/channels/plugins/onboarding/channel-access.js +0 -68
- package/dist/channels/plugins/onboarding/discord.js +0 -413
- package/dist/channels/plugins/onboarding/helpers.js +0 -15
- package/dist/channels/plugins/onboarding/imessage.js +0 -231
- package/dist/channels/plugins/onboarding/signal.js +0 -262
- package/dist/channels/plugins/onboarding/slack.js +0 -470
- package/dist/channels/plugins/onboarding/telegram.js +0 -289
- package/dist/channels/plugins/onboarding/whatsapp.js +0 -286
- package/dist/channels/plugins/onboarding-types.js +0 -1
- package/dist/channels/plugins/outbound/discord.js +0 -101
- package/dist/channels/plugins/outbound/imessage.js +0 -39
- package/dist/channels/plugins/outbound/load.js +0 -28
- package/dist/channels/plugins/outbound/signal.js +0 -36
- package/dist/channels/plugins/outbound/slack.js +0 -27
- package/dist/channels/plugins/outbound/telegram.js +0 -91
- package/dist/channels/plugins/outbound/whatsapp.js +0 -76
- package/dist/channels/plugins/pairing-message.js +0 -1
- package/dist/channels/plugins/pairing.js +0 -44
- package/dist/channels/plugins/setup-helpers.js +0 -94
- package/dist/channels/plugins/slack.actions.js +0 -158
- package/dist/channels/plugins/status-issues/bluebubbles.js +0 -76
- package/dist/channels/plugins/status-issues/discord.js +0 -115
- package/dist/channels/plugins/status-issues/shared.js +0 -23
- package/dist/channels/plugins/status-issues/telegram.js +0 -100
- package/dist/channels/plugins/status-issues/whatsapp.js +0 -52
- package/dist/channels/plugins/status.js +0 -26
- package/dist/channels/plugins/types.adapters.js +0 -1
- package/dist/channels/plugins/types.core.js +0 -1
- package/dist/channels/plugins/types.plugin.js +0 -1
- package/dist/channels/plugins/whatsapp-heartbeat.js +0 -56
- package/dist/channels/registry.js +0 -166
- package/dist/channels/reply-prefix.js +0 -28
- package/dist/channels/run-state-machine.js +0 -7
- package/dist/channels/sender-identity.js +0 -30
- package/dist/channels/sender-label.js +0 -45
- package/dist/channels/session.js +0 -28
- package/dist/channels/status-reactions.js +0 -297
- package/dist/channels/targets.js +0 -27
- package/dist/channels/telegram/allow-from.js +0 -10
- package/dist/channels/telegram/api.js +0 -18
- package/dist/channels/typing-lifecycle.js +0 -39
- package/dist/channels/typing.js +0 -17
- package/dist/channels/web/index.js +0 -2
- package/dist/cli/acp-cli.js +0 -63
- package/dist/cli/argv.js +0 -189
- package/dist/cli/banner.js +0 -116
- package/dist/cli/browser-cli-actions-input/register.element.js +0 -228
- package/dist/cli/browser-cli-actions-input/register.files-downloads.js +0 -157
- package/dist/cli/browser-cli-actions-input/register.form-wait-eval.js +0 -121
- package/dist/cli/browser-cli-actions-input/register.js +0 -10
- package/dist/cli/browser-cli-actions-input/register.navigation.js +0 -72
- package/dist/cli/browser-cli-actions-input/shared.js +0 -57
- package/dist/cli/browser-cli-actions-input.js +0 -1
- package/dist/cli/browser-cli-actions-observe.js +0 -90
- package/dist/cli/browser-cli-debug.js +0 -162
- package/dist/cli/browser-cli-examples.js +0 -33
- package/dist/cli/browser-cli-extension.js +0 -111
- package/dist/cli/browser-cli-inspect.js +0 -136
- package/dist/cli/browser-cli-manage.js +0 -401
- package/dist/cli/browser-cli-resize.js +0 -22
- package/dist/cli/browser-cli-shared.js +0 -42
- package/dist/cli/browser-cli-state.cookies-storage.js +0 -201
- package/dist/cli/browser-cli-state.js +0 -243
- package/dist/cli/browser-cli.js +0 -37
- package/dist/cli/channel-auth.js +0 -49
- package/dist/cli/channel-options.js +0 -29
- package/dist/cli/channels-cli.js +0 -208
- package/dist/cli/clawbot-cli.js +0 -5
- package/dist/cli/cli-name.js +0 -26
- package/dist/cli/cli-utils.js +0 -44
- package/dist/cli/command-format.js +0 -18
- package/dist/cli/command-options.js +0 -34
- package/dist/cli/completion-cli.js +0 -566
- package/dist/cli/config-cli.js +0 -427
- package/dist/cli/cron-cli/register.cron-add.js +0 -233
- package/dist/cli/cron-cli/register.cron-dashboard.js +0 -339
- package/dist/cli/cron-cli/register.cron-edit.js +0 -230
- package/dist/cli/cron-cli/register.cron-simple.js +0 -98
- package/dist/cli/cron-cli/register.js +0 -18
- package/dist/cli/cron-cli/shared.js +0 -199
- package/dist/cli/cron-cli.js +0 -1
- package/dist/cli/daemon-cli/install.js +0 -115
- package/dist/cli/daemon-cli/lifecycle-core.js +0 -270
- package/dist/cli/daemon-cli/lifecycle.js +0 -103
- package/dist/cli/daemon-cli/probe.js +0 -28
- package/dist/cli/daemon-cli/register-service-commands.js +0 -81
- package/dist/cli/daemon-cli/register.js +0 -69
- package/dist/cli/daemon-cli/response.js +0 -20
- package/dist/cli/daemon-cli/restart-health.js +0 -126
- package/dist/cli/daemon-cli/runners.js +0 -3
- package/dist/cli/daemon-cli/shared.js +0 -169
- package/dist/cli/daemon-cli/status.gather.js +0 -168
- package/dist/cli/daemon-cli/status.js +0 -19
- package/dist/cli/daemon-cli/status.print.js +0 -233
- package/dist/cli/daemon-cli/types.js +0 -1
- package/dist/cli/daemon-cli-compat.js +0 -80
- package/dist/cli/daemon-cli.js +0 -3
- package/dist/cli/deps.js +0 -33
- package/dist/cli/devices-cli.js +0 -194
- package/dist/cli/directory-cli.js +0 -227
- package/dist/cli/dns-cli.js +0 -211
- package/dist/cli/docs-cli.js +0 -17
- package/dist/cli/errors.js +0 -187
- package/dist/cli/exec-approvals-cli.js +0 -346
- package/dist/cli/gateway-cli/call.js +0 -25
- package/dist/cli/gateway-cli/dev.js +0 -99
- package/dist/cli/gateway-cli/discover.js +0 -88
- package/dist/cli/gateway-cli/register.js +0 -205
- package/dist/cli/gateway-cli/run-loop.js +0 -137
- package/dist/cli/gateway-cli/run.js +0 -308
- package/dist/cli/gateway-cli/shared.js +0 -101
- package/dist/cli/gateway-cli.js +0 -1
- package/dist/cli/gateway-rpc.js +0 -27
- package/dist/cli/help-format.js +0 -16
- package/dist/cli/hooks-cli.js +0 -709
- package/dist/cli/logs-cli.js +0 -222
- package/dist/cli/memory-cli.js +0 -640
- package/dist/cli/models-cli.js +0 -321
- package/dist/cli/node-cli/daemon.js +0 -482
- package/dist/cli/node-cli/register.js +0 -90
- package/dist/cli/node-cli.js +0 -1
- package/dist/cli/nodes-camera.js +0 -107
- package/dist/cli/nodes-canvas.js +0 -26
- package/dist/cli/nodes-cli/a2ui-jsonl.js +0 -81
- package/dist/cli/nodes-cli/cli-utils.js +0 -27
- package/dist/cli/nodes-cli/format.js +0 -35
- package/dist/cli/nodes-cli/pairing-render.js +0 -26
- package/dist/cli/nodes-cli/register.camera.js +0 -196
- package/dist/cli/nodes-cli/register.canvas.js +0 -215
- package/dist/cli/nodes-cli/register.invoke.js +0 -303
- package/dist/cli/nodes-cli/register.js +0 -24
- package/dist/cli/nodes-cli/register.location.js +0 -64
- package/dist/cli/nodes-cli/register.notify.js +0 -51
- package/dist/cli/nodes-cli/register.pairing.js +0 -99
- package/dist/cli/nodes-cli/register.push.js +0 -63
- package/dist/cli/nodes-cli/register.screen.js +0 -66
- package/dist/cli/nodes-cli/register.status.js +0 -328
- package/dist/cli/nodes-cli/rpc.js +0 -71
- package/dist/cli/nodes-cli/types.js +0 -1
- package/dist/cli/nodes-cli.js +0 -1
- package/dist/cli/nodes-media-utils.js +0 -26
- package/dist/cli/nodes-run.js +0 -19
- package/dist/cli/nodes-screen.js +0 -35
- package/dist/cli/outbound-send-deps.js +0 -4
- package/dist/cli/outbound-send-mapping.js +0 -11
- package/dist/cli/pairing-cli.js +0 -141
- package/dist/cli/parse-bytes.js +0 -37
- package/dist/cli/parse-duration.js +0 -28
- package/dist/cli/parse-timeout.js +0 -18
- package/dist/cli/plugin-registry.js +0 -24
- package/dist/cli/plugins-cli.js +0 -646
- package/dist/cli/ports.js +0 -102
- package/dist/cli/profile-utils.js +0 -17
- package/dist/cli/profile.js +0 -96
- package/dist/cli/program/action-reparse.js +0 -17
- package/dist/cli/program/build-program.js +0 -16
- package/dist/cli/program/command-registry.js +0 -326
- package/dist/cli/program/command-tree.js +0 -16
- package/dist/cli/program/config-guard.js +0 -67
- package/dist/cli/program/context.js +0 -11
- package/dist/cli/program/help.js +0 -99
- package/dist/cli/program/helpers.js +0 -26
- package/dist/cli/program/message/helpers.js +0 -46
- package/dist/cli/program/message/register.broadcast.js +0 -11
- package/dist/cli/program/message/register.discord-admin.js +0 -119
- package/dist/cli/program/message/register.emoji-sticker.js +0 -43
- package/dist/cli/program/message/register.permissions-search.js +0 -22
- package/dist/cli/program/message/register.pins.js +0 -23
- package/dist/cli/program/message/register.poll.js +0 -13
- package/dist/cli/program/message/register.reactions.js +0 -21
- package/dist/cli/program/message/register.read-edit-delete.js +0 -30
- package/dist/cli/program/message/register.send.js +0 -18
- package/dist/cli/program/message/register.thread.js +0 -35
- package/dist/cli/program/preaction.js +0 -52
- package/dist/cli/program/program-context.js +0 -8
- package/dist/cli/program/register.agent.js +0 -162
- package/dist/cli/program/register.configure.js +0 -17
- package/dist/cli/program/register.maintenance.js +0 -112
- package/dist/cli/program/register.message.js +0 -54
- package/dist/cli/program/register.onboard.js +0 -155
- package/dist/cli/program/register.setup.js +0 -41
- package/dist/cli/program/register.skills.js +0 -4
- package/dist/cli/program/register.status-health-sessions.js +0 -108
- package/dist/cli/program/register.subclis.js +0 -328
- package/dist/cli/program/routes.js +0 -233
- package/dist/cli/program.js +0 -2
- package/dist/cli/progress.js +0 -165
- package/dist/cli/prompt.js +0 -17
- package/dist/cli/qr-cli.js +0 -132
- package/dist/cli/requirements-test-fixtures.js +0 -17
- package/dist/cli/respawn-policy.js +0 -4
- package/dist/cli/route.js +0 -33
- package/dist/cli/run-main.js +0 -107
- package/dist/cli/sandbox-cli.js +0 -98
- package/dist/cli/security-cli.js +0 -332
- package/dist/cli/shared/parse-port.js +0 -18
- package/dist/cli/skills-cli.format.js +0 -241
- package/dist/cli/skills-cli.js +0 -341
- package/dist/cli/swarm-cli/register.js +0 -8
- package/dist/cli/swarm-cli/register.swarm-status.js +0 -488
- package/dist/cli/system-cli.js +0 -88
- package/dist/cli/tagline.js +0 -215
- package/dist/cli/telemetry-cli/register.js +0 -10
- package/dist/cli/telemetry-cli/register.telemetry-alerts.js +0 -176
- package/dist/cli/telemetry-cli/register.telemetry-metrics.js +0 -323
- package/dist/cli/telemetry-cli/register.telemetry-status.js +0 -179
- package/dist/cli/test-runtime-capture.js +0 -24
- package/dist/cli/tui-cli.js +0 -44
- package/dist/cli/update-cli/progress.js +0 -121
- package/dist/cli/update-cli/restart-helper.js +0 -129
- package/dist/cli/update-cli/shared.js +0 -209
- package/dist/cli/update-cli/status.js +0 -97
- package/dist/cli/update-cli/suppress-deprecations.js +0 -17
- package/dist/cli/update-cli/update-command.js +0 -587
- package/dist/cli/update-cli/wizard.js +0 -124
- package/dist/cli/update-cli.js +0 -124
- package/dist/cli/wait.js +0 -8
- package/dist/cli/webhooks-cli.js +0 -140
- package/dist/cli/windows-argv.js +0 -69
- package/dist/commands/agent/delivery.js +0 -140
- package/dist/commands/agent/run-context.js +0 -40
- package/dist/commands/agent/session-store.js +0 -56
- package/dist/commands/agent/session.js +0 -74
- package/dist/commands/agent/types.js +0 -1
- package/dist/commands/agent-binding.js +0 -123
- package/dist/commands/agent-via-gateway.js +0 -119
- package/dist/commands/agent.js +0 -536
- package/dist/commands/agents.bindings.js +0 -133
- package/dist/commands/agents.command-shared.js +0 -18
- package/dist/commands/agents.commands.add.js +0 -297
- package/dist/commands/agents.commands.delete.js +0 -75
- package/dist/commands/agents.commands.identity.js +0 -174
- package/dist/commands/agents.commands.list.js +0 -103
- package/dist/commands/agents.config.js +0 -143
- package/dist/commands/agents.js +0 -6
- package/dist/commands/agents.providers.js +0 -146
- package/dist/commands/auth-choice-legacy.js +0 -20
- package/dist/commands/auth-choice-options.js +0 -328
- package/dist/commands/auth-choice-prompt.js +0 -36
- package/dist/commands/auth-choice.api-key.js +0 -34
- package/dist/commands/auth-choice.apply-helpers.js +0 -8
- package/dist/commands/auth-choice.apply.anthropic.js +0 -85
- package/dist/commands/auth-choice.apply.api-providers.js +0 -895
- package/dist/commands/auth-choice.apply.byteplus.js +0 -55
- package/dist/commands/auth-choice.apply.copilot-proxy.js +0 -10
- package/dist/commands/auth-choice.apply.github-copilot.js +0 -47
- package/dist/commands/auth-choice.apply.google-antigravity.js +0 -10
- package/dist/commands/auth-choice.apply.google-gemini-cli.js +0 -10
- package/dist/commands/auth-choice.apply.huggingface.js +0 -130
- package/dist/commands/auth-choice.apply.js +0 -37
- package/dist/commands/auth-choice.apply.minimax.js +0 -120
- package/dist/commands/auth-choice.apply.oauth.js +0 -78
- package/dist/commands/auth-choice.apply.openai.js +0 -119
- package/dist/commands/auth-choice.apply.openrouter.js +0 -77
- package/dist/commands/auth-choice.apply.plugin-provider.js +0 -85
- package/dist/commands/auth-choice.apply.qwen-portal.js +0 -10
- package/dist/commands/auth-choice.apply.vllm.js +0 -92
- package/dist/commands/auth-choice.apply.volcengine.js +0 -55
- package/dist/commands/auth-choice.apply.xai.js +0 -63
- package/dist/commands/auth-choice.default-model.js +0 -12
- package/dist/commands/auth-choice.js +0 -3
- package/dist/commands/auth-choice.model-check.js +0 -61
- package/dist/commands/auth-choice.preferred-provider.js +0 -50
- package/dist/commands/auth-token.js +0 -32
- package/dist/commands/backup.js +0 -166
- package/dist/commands/channel-account.js +0 -190
- package/dist/commands/channels/add-mutators.js +0 -17
- package/dist/commands/channels/add.js +0 -198
- package/dist/commands/channels/capabilities.js +0 -439
- package/dist/commands/channels/list.js +0 -145
- package/dist/commands/channels/logs.js +0 -85
- package/dist/commands/channels/remove.js +0 -121
- package/dist/commands/channels/resolve.js +0 -107
- package/dist/commands/channels/shared.js +0 -31
- package/dist/commands/channels/status.js +0 -238
- package/dist/commands/channels.js +0 -7
- package/dist/commands/channels.mock-harness.js +0 -23
- package/dist/commands/chutes-oauth.js +0 -144
- package/dist/commands/cleanup-plan.js +0 -10
- package/dist/commands/cleanup-utils.js +0 -81
- package/dist/commands/config-validation.js +0 -15
- package/dist/commands/configure.channels.js +0 -52
- package/dist/commands/configure.commands.js +0 -22
- package/dist/commands/configure.daemon.js +0 -101
- package/dist/commands/configure.gateway-auth.js +0 -101
- package/dist/commands/configure.gateway.js +0 -201
- package/dist/commands/configure.js +0 -4
- package/dist/commands/configure.shared.js +0 -60
- package/dist/commands/configure.wizard.js +0 -485
- package/dist/commands/daemon-install-helpers.js +0 -51
- package/dist/commands/daemon-install-runtime-warning.js +0 -11
- package/dist/commands/daemon-runtime.js +0 -11
- package/dist/commands/dashboard.js +0 -52
- package/dist/commands/docs.js +0 -154
- package/dist/commands/doctor-auth.js +0 -236
- package/dist/commands/doctor-checks.js +0 -498
- package/dist/commands/doctor-completion.js +0 -112
- package/dist/commands/doctor-config-flow.js +0 -766
- package/dist/commands/doctor-format.js +0 -85
- package/dist/commands/doctor-gateway-daemon-flow.js +0 -207
- package/dist/commands/doctor-gateway-health.js +0 -43
- package/dist/commands/doctor-gateway-services.js +0 -237
- package/dist/commands/doctor-install.js +0 -27
- package/dist/commands/doctor-legacy-config.js +0 -323
- package/dist/commands/doctor-memory-search.js +0 -126
- package/dist/commands/doctor-platform-notes.js +0 -110
- package/dist/commands/doctor-prompter.js +0 -75
- package/dist/commands/doctor-sandbox.js +0 -207
- package/dist/commands/doctor-security.js +0 -141
- package/dist/commands/doctor-session-locks.js +0 -73
- package/dist/commands/doctor-state-integrity.js +0 -408
- package/dist/commands/doctor-state-migrations.js +0 -1
- package/dist/commands/doctor-ui.js +0 -119
- package/dist/commands/doctor-update.js +0 -68
- package/dist/commands/doctor-workspace-status.js +0 -56
- package/dist/commands/doctor-workspace.js +0 -69
- package/dist/commands/doctor.js +0 -264
- package/dist/commands/gateway-presence.js +0 -19
- package/dist/commands/gateway-status/helpers.js +0 -202
- package/dist/commands/gateway-status.js +0 -300
- package/dist/commands/google-gemini-model-default.js +0 -33
- package/dist/commands/health-format.js +0 -37
- package/dist/commands/health.js +0 -595
- package/dist/commands/message-format.js +0 -345
- package/dist/commands/message.js +0 -45
- package/dist/commands/model-allowlist.js +0 -29
- package/dist/commands/model-default.js +0 -35
- package/dist/commands/model-picker.js +0 -446
- package/dist/commands/models/aliases.js +0 -92
- package/dist/commands/models/auth-order.js +0 -95
- package/dist/commands/models/auth.js +0 -323
- package/dist/commands/models/fallbacks-shared.js +0 -102
- package/dist/commands/models/fallbacks.js +0 -126
- package/dist/commands/models/image-fallbacks.js +0 -126
- package/dist/commands/models/list.auth-overview.js +0 -93
- package/dist/commands/models/list.configured.js +0 -80
- package/dist/commands/models/list.errors.js +0 -14
- package/dist/commands/models/list.format.js +0 -41
- package/dist/commands/models/list.js +0 -2
- package/dist/commands/models/list.list-command.js +0 -112
- package/dist/commands/models/list.probe.js +0 -348
- package/dist/commands/models/list.registry.js +0 -173
- package/dist/commands/models/list.status-command.js +0 -441
- package/dist/commands/models/list.table.js +0 -58
- package/dist/commands/models/list.types.js +0 -1
- package/dist/commands/models/scan.js +0 -293
- package/dist/commands/models/set-image.js +0 -9
- package/dist/commands/models/set.js +0 -9
- package/dist/commands/models/shared.js +0 -161
- package/dist/commands/models.js +0 -10
- package/dist/commands/node-daemon-install-helpers.js +0 -37
- package/dist/commands/node-daemon-runtime.js +0 -6
- package/dist/commands/oauth-env.js +0 -16
- package/dist/commands/oauth-flow.js +0 -33
- package/dist/commands/onboard-auth.config-core.js +0 -981
- package/dist/commands/onboard-auth.config-gateways.js +0 -64
- package/dist/commands/onboard-auth.config-litellm.js +0 -45
- package/dist/commands/onboard-auth.config-minimax.js +0 -150
- package/dist/commands/onboard-auth.config-opencode.js +0 -24
- package/dist/commands/onboard-auth.config-shared.js +0 -116
- package/dist/commands/onboard-auth.credentials.js +0 -327
- package/dist/commands/onboard-auth.js +0 -7
- package/dist/commands/onboard-auth.models.js +0 -170
- package/dist/commands/onboard-channels.js +0 -527
- package/dist/commands/onboard-config.js +0 -16
- package/dist/commands/onboard-custom.js +0 -495
- package/dist/commands/onboard-helpers.js +0 -401
- package/dist/commands/onboard-hooks.js +0 -59
- package/dist/commands/onboard-interactive.js +0 -17
- package/dist/commands/onboard-non-interactive/api-keys.js +0 -61
- package/dist/commands/onboard-non-interactive/local/auth-choice-inference.js +0 -43
- package/dist/commands/onboard-non-interactive/local/auth-choice.js +0 -683
- package/dist/commands/onboard-non-interactive/local/daemon-install.js +0 -45
- package/dist/commands/onboard-non-interactive/local/gateway-config.js +0 -86
- package/dist/commands/onboard-non-interactive/local/output.js +0 -14
- package/dist/commands/onboard-non-interactive/local/skills-config.js +0 -21
- package/dist/commands/onboard-non-interactive/local/workspace.js +0 -7
- package/dist/commands/onboard-non-interactive/local.js +0 -105
- package/dist/commands/onboard-non-interactive/remote.js +0 -41
- package/dist/commands/onboard-non-interactive.js +0 -25
- package/dist/commands/onboard-non-interactive.test-helpers.js +0 -31
- package/dist/commands/onboard-provider-auth-flags.js +0 -150
- package/dist/commands/onboard-remote.js +0 -128
- package/dist/commands/onboard-skills.js +0 -171
- package/dist/commands/onboard-types.js +0 -1
- package/dist/commands/onboard.js +0 -60
- package/dist/commands/onboarding/__tests__/test-utils.js +0 -20
- package/dist/commands/onboarding/plugin-install.js +0 -162
- package/dist/commands/onboarding/registry.js +0 -13
- package/dist/commands/onboarding/types.js +0 -1
- package/dist/commands/openai-codex-model-default.js +0 -44
- package/dist/commands/openai-codex-oauth.js +0 -40
- package/dist/commands/openai-model-default.js +0 -41
- package/dist/commands/opencode-zen-model-default.js +0 -35
- package/dist/commands/provider-auth-helpers.js +0 -61
- package/dist/commands/reset.js +0 -134
- package/dist/commands/sandbox-display.js +0 -83
- package/dist/commands/sandbox-explain.js +0 -226
- package/dist/commands/sandbox-formatters.js +0 -31
- package/dist/commands/sandbox.js +0 -119
- package/dist/commands/security-owner-only.js +0 -86
- package/dist/commands/sessions-cleanup.js +0 -97
- package/dist/commands/sessions.js +0 -210
- package/dist/commands/sessions.test-helpers.js +0 -61
- package/dist/commands/setup.js +0 -60
- package/dist/commands/signal-install.js +0 -132
- package/dist/commands/skills-openclaw.command.js +0 -123
- package/dist/commands/status-all/agents.js +0 -62
- package/dist/commands/status-all/channels.js +0 -354
- package/dist/commands/status-all/diagnosis.js +0 -160
- package/dist/commands/status-all/format.js +0 -42
- package/dist/commands/status-all/gateway.js +0 -158
- package/dist/commands/status-all/report-lines.js +0 -135
- package/dist/commands/status-all.js +0 -411
- package/dist/commands/status.agent-local.js +0 -68
- package/dist/commands/status.command.js +0 -476
- package/dist/commands/status.daemon.js +0 -30
- package/dist/commands/status.format.js +0 -52
- package/dist/commands/status.gateway-probe.js +0 -22
- package/dist/commands/status.js +0 -2
- package/dist/commands/status.link-channel.js +0 -39
- package/dist/commands/status.scan.js +0 -141
- package/dist/commands/status.summary.js +0 -190
- package/dist/commands/status.types.js +0 -1
- package/dist/commands/status.update.js +0 -112
- package/dist/commands/systemd-linger.js +0 -83
- package/dist/commands/test-runtime-config-helpers.js +0 -21
- package/dist/commands/test-wizard-helpers.js +0 -68
- package/dist/commands/uninstall.js +0 -161
- package/dist/commands/vllm-setup.js +0 -66
- package/dist/commands/zai-endpoint-detect.js +0 -97
- package/dist/commands-subagents/action-agents.js +0 -44
- package/dist/commands-subagents/action-focus.js +0 -64
- package/dist/commands-subagents/action-help.js +0 -4
- package/dist/commands-subagents/action-info.js +0 -45
- package/dist/commands-subagents/action-kill.js +0 -60
- package/dist/commands-subagents/action-list.js +0 -44
- package/dist/commands-subagents/action-log.js +0 -29
- package/dist/commands-subagents/action-send.js +0 -119
- package/dist/commands-subagents/action-spawn.js +0 -52
- package/dist/commands-subagents/action-unfocus.js +0 -30
- package/dist/commands-subagents/shared.js +0 -303
- package/dist/compat/legacy-names.js +0 -9
- package/dist/config/agent-dirs.js +0 -79
- package/dist/config/agent-limits.js +0 -18
- package/dist/config/backup-rotation.js +0 -19
- package/dist/config/cache-utils.js +0 -22
- package/dist/config/channel-capabilities.js +0 -42
- package/dist/config/commands.js +0 -55
- package/dist/config/config-paths.js +0 -73
- package/dist/config/defaults.js +0 -408
- package/dist/config/discord-preview-streaming.js +0 -104
- package/dist/config/env-preserve.js +0 -122
- package/dist/config/env-substitution.js +0 -145
- package/dist/config/env-vars.js +0 -59
- package/dist/config/group-policy.js +0 -155
- package/dist/config/includes-scan.js +0 -78
- package/dist/config/includes.js +0 -214
- package/dist/config/io.js +0 -979
- package/dist/config/legacy-migrate.js +0 -13
- package/dist/config/legacy.js +0 -34
- package/dist/config/legacy.migrations.js +0 -8
- package/dist/config/legacy.migrations.part-1.js +0 -419
- package/dist/config/legacy.migrations.part-2.js +0 -343
- package/dist/config/legacy.migrations.part-3.js +0 -221
- package/dist/config/legacy.rules.js +0 -116
- package/dist/config/legacy.shared.js +0 -78
- package/dist/config/logging.js +0 -10
- package/dist/config/markdown-tables.js +0 -36
- package/dist/config/merge-config.js +0 -22
- package/dist/config/merge-patch.js +0 -72
- package/dist/config/normalize-paths.js +0 -54
- package/dist/config/paths.js +0 -241
- package/dist/config/plugin-auto-enable.js +0 -354
- package/dist/config/plugins-allowlist.js +0 -13
- package/dist/config/port-defaults.js +0 -30
- package/dist/config/prototype-keys.js +0 -4
- package/dist/config/redact-snapshot.js +0 -481
- package/dist/config/runtime-overrides.js +0 -50
- package/dist/config/schema.field-metadata.js +0 -590
- package/dist/config/schema.help.js +0 -294
- package/dist/config/schema.hints.js +0 -189
- package/dist/config/schema.irc.js +0 -20
- package/dist/config/schema.js +0 -281
- package/dist/config/schema.labels.js +0 -350
- package/dist/config/secrets-integration.js +0 -88
- package/dist/config/sessions/delivery-info.js +0 -47
- package/dist/config/sessions/group.js +0 -84
- package/dist/config/sessions/main-session.js +0 -48
- package/dist/config/sessions/metadata.js +0 -114
- package/dist/config/sessions/paths.js +0 -172
- package/dist/config/sessions/reset.js +0 -103
- package/dist/config/sessions/session-file.js +0 -33
- package/dist/config/sessions/session-key.js +0 -39
- package/dist/config/sessions/store.js +0 -734
- package/dist/config/sessions/transcript.js +0 -113
- package/dist/config/sessions/types.js +0 -25
- package/dist/config/sessions.js +0 -11
- package/dist/config/talk.js +0 -31
- package/dist/config/telegram-custom-commands.js +0 -71
- package/dist/config/types.agent-defaults.js +0 -1
- package/dist/config/types.agents.js +0 -1
- package/dist/config/types.approvals.js +0 -1
- package/dist/config/types.auth.js +0 -1
- package/dist/config/types.base.js +0 -1
- package/dist/config/types.browser.js +0 -1
- package/dist/config/types.channels.js +0 -1
- package/dist/config/types.cli.js +0 -1
- package/dist/config/types.cron.js +0 -1
- package/dist/config/types.discord.js +0 -1
- package/dist/config/types.gateway.js +0 -1
- package/dist/config/types.googlechat.js +0 -1
- package/dist/config/types.hooks.js +0 -1
- package/dist/config/types.imessage.js +0 -1
- package/dist/config/types.irc.js +0 -1
- package/dist/config/types.js +0 -31
- package/dist/config/types.memory.js +0 -1
- package/dist/config/types.messages.js +0 -1
- package/dist/config/types.models.js +0 -1
- package/dist/config/types.msteams.js +0 -1
- package/dist/config/types.node-host.js +0 -1
- package/dist/config/types.plugins.js +0 -1
- package/dist/config/types.poolbot.js +0 -1
- package/dist/config/types.queue.js +0 -1
- package/dist/config/types.sandbox.js +0 -1
- package/dist/config/types.secrets.js +0 -61
- package/dist/config/types.security.js +0 -33
- package/dist/config/types.signal.js +0 -1
- package/dist/config/types.skills.js +0 -1
- package/dist/config/types.slack.js +0 -1
- package/dist/config/types.telegram.js +0 -1
- package/dist/config/types.tools.js +0 -1
- package/dist/config/types.tts.js +0 -1
- package/dist/config/types.whatsapp.js +0 -1
- package/dist/config/validation.js +0 -352
- package/dist/config/version.js +0 -30
- package/dist/config/zod-schema.agent-defaults.js +0 -153
- package/dist/config/zod-schema.agent-model.js +0 -10
- package/dist/config/zod-schema.agent-runtime.js +0 -654
- package/dist/config/zod-schema.agents.js +0 -46
- package/dist/config/zod-schema.allowdeny.js +0 -35
- package/dist/config/zod-schema.approvals.js +0 -25
- package/dist/config/zod-schema.channels.js +0 -9
- package/dist/config/zod-schema.core.js +0 -453
- package/dist/config/zod-schema.hooks.js +0 -153
- package/dist/config/zod-schema.installs.js +0 -20
- package/dist/config/zod-schema.js +0 -689
- package/dist/config/zod-schema.providers-core.js +0 -993
- package/dist/config/zod-schema.providers-whatsapp.js +0 -126
- package/dist/config/zod-schema.providers.js +0 -34
- package/dist/config/zod-schema.security.js +0 -113
- package/dist/config/zod-schema.sensitive.js +0 -4
- package/dist/config/zod-schema.session.js +0 -169
- package/dist/context-engine/index.js +0 -33
- package/dist/context-engine/legacy.js +0 -179
- package/dist/context-engine/registry.js +0 -86
- package/dist/context-engine/summarizing.js +0 -290
- package/dist/context-engine/types.js +0 -7
- package/dist/cron/cron-filters.js +0 -150
- package/dist/cron/cron-improvements.js +0 -195
- package/dist/cron/delivery.js +0 -57
- package/dist/cron/heartbeat-policy.js +0 -26
- package/dist/cron/isolated-agent/delivery-target.js +0 -74
- package/dist/cron/isolated-agent/helpers.js +0 -66
- package/dist/cron/isolated-agent/run.js +0 -652
- package/dist/cron/isolated-agent/session.js +0 -29
- package/dist/cron/isolated-agent/skills-snapshot.js +0 -26
- package/dist/cron/isolated-agent/subagent-followup.js +0 -127
- package/dist/cron/isolated-agent.js +0 -1
- package/dist/cron/isolated-agent.mocks.js +0 -12
- package/dist/cron/isolated-agent.test-setup.js +0 -22
- package/dist/cron/legacy-delivery.js +0 -43
- package/dist/cron/normalize.js +0 -445
- package/dist/cron/parse.js +0 -29
- package/dist/cron/payload-migration.js +0 -29
- package/dist/cron/run-log.js +0 -112
- package/dist/cron/schedule.js +0 -70
- package/dist/cron/service/jobs.js +0 -557
- package/dist/cron/service/locked.js +0 -12
- package/dist/cron/service/normalize.js +0 -73
- package/dist/cron/service/ops.js +0 -188
- package/dist/cron/service/state.js +0 -12
- package/dist/cron/service/store.js +0 -415
- package/dist/cron/service/timer.js +0 -664
- package/dist/cron/service.js +0 -38
- package/dist/cron/session-reaper.js +0 -86
- package/dist/cron/stagger.js +0 -39
- package/dist/cron/store.js +0 -58
- package/dist/cron/types.js +0 -1
- package/dist/cron/validate-timestamp.js +0 -43
- package/dist/cron/webhook-url.js +0 -22
- package/dist/daemon/arg-split.js +0 -40
- package/dist/daemon/cmd-argv.js +0 -21
- package/dist/daemon/cmd-set.js +0 -58
- package/dist/daemon/constants.js +0 -75
- package/dist/daemon/diagnostics.js +0 -38
- package/dist/daemon/exec-file.js +0 -23
- package/dist/daemon/inspect.js +0 -353
- package/dist/daemon/launchd-plist.js +0 -68
- package/dist/daemon/launchd.js +0 -319
- package/dist/daemon/legacy.js +0 -44
- package/dist/daemon/node-service.js +0 -67
- package/dist/daemon/output.js +0 -6
- package/dist/daemon/paths.js +0 -35
- package/dist/daemon/program-args.js +0 -220
- package/dist/daemon/runtime-format.js +0 -31
- package/dist/daemon/runtime-parse.js +0 -17
- package/dist/daemon/runtime-paths.js +0 -130
- package/dist/daemon/schtasks-exec.js +0 -4
- package/dist/daemon/schtasks.js +0 -306
- package/dist/daemon/service-audit.js +0 -323
- package/dist/daemon/service-env.js +0 -148
- package/dist/daemon/service-runtime.js +0 -1
- package/dist/daemon/service-types.js +0 -1
- package/dist/daemon/service.js +0 -90
- package/dist/daemon/systemd-hints.js +0 -24
- package/dist/daemon/systemd-linger.js +0 -59
- package/dist/daemon/systemd-unit.js +0 -108
- package/dist/daemon/systemd.js +0 -321
- package/dist/discord/accounts.js +0 -55
- package/dist/discord/api.js +0 -99
- package/dist/discord/audit.js +0 -94
- package/dist/discord/chunk.js +0 -200
- package/dist/discord/client.js +0 -41
- package/dist/discord/components-registry.js +0 -57
- package/dist/discord/components.js +0 -816
- package/dist/discord/directory-live.js +0 -76
- package/dist/discord/draft-chunking.js +0 -22
- package/dist/discord/draft-stream.js +0 -124
- package/dist/discord/gateway-logging.js +0 -48
- package/dist/discord/guilds.js +0 -12
- package/dist/discord/monitor/agent-components.js +0 -1334
- package/dist/discord/monitor/allow-list.js +0 -333
- package/dist/discord/monitor/commands.js +0 -5
- package/dist/discord/monitor/exec-approvals.js +0 -601
- package/dist/discord/monitor/format.js +0 -27
- package/dist/discord/monitor/gateway-plugin.js +0 -49
- package/dist/discord/monitor/gateway-registry.js +0 -29
- package/dist/discord/monitor/listeners.js +0 -357
- package/dist/discord/monitor/message-handler.js +0 -115
- package/dist/discord/monitor/message-handler.preflight.js +0 -598
- package/dist/discord/monitor/message-handler.preflight.types.js +0 -1
- package/dist/discord/monitor/message-handler.process.js +0 -634
- package/dist/discord/monitor/message-utils.js +0 -389
- package/dist/discord/monitor/model-picker-preferences.js +0 -143
- package/dist/discord/monitor/model-picker.js +0 -651
- package/dist/discord/monitor/native-command.js +0 -1305
- package/dist/discord/monitor/presence-cache.js +0 -38
- package/dist/discord/monitor/presence.js +0 -30
- package/dist/discord/monitor/provider.allowlist.js +0 -223
- package/dist/discord/monitor/provider.js +0 -484
- package/dist/discord/monitor/provider.lifecycle.js +0 -100
- package/dist/discord/monitor/reply-context.js +0 -33
- package/dist/discord/monitor/reply-delivery.js +0 -196
- package/dist/discord/monitor/rest-fetch.js +0 -22
- package/dist/discord/monitor/sender-identity.js +0 -45
- package/dist/discord/monitor/system-events.js +0 -53
- package/dist/discord/monitor/thread-bindings.discord-api.js +0 -215
- package/dist/discord/monitor/thread-bindings.js +0 -4
- package/dist/discord/monitor/thread-bindings.lifecycle.js +0 -177
- package/dist/discord/monitor/thread-bindings.manager.js +0 -423
- package/dist/discord/monitor/thread-bindings.messages.js +0 -55
- package/dist/discord/monitor/thread-bindings.state.js +0 -358
- package/dist/discord/monitor/thread-bindings.types.js +0 -6
- package/dist/discord/monitor/threading.js +0 -294
- package/dist/discord/monitor/typing.js +0 -8
- package/dist/discord/monitor.gateway.js +0 -54
- package/dist/discord/monitor.js +0 -7
- package/dist/discord/pluralkit.js +0 -27
- package/dist/discord/probe.js +0 -124
- package/dist/discord/resolve-channels.js +0 -239
- package/dist/discord/resolve-users.js +0 -126
- package/dist/discord/send.channels.js +0 -89
- package/dist/discord/send.components.js +0 -115
- package/dist/discord/send.emojis-stickers.js +0 -48
- package/dist/discord/send.guild.js +0 -79
- package/dist/discord/send.js +0 -9
- package/dist/discord/send.messages.js +0 -91
- package/dist/discord/send.outbound.js +0 -343
- package/dist/discord/send.permissions.js +0 -169
- package/dist/discord/send.reactions.js +0 -75
- package/dist/discord/send.shared.js +0 -330
- package/dist/discord/send.types.js +0 -16
- package/dist/discord/targets.js +0 -126
- package/dist/discord/token.js +0 -34
- package/dist/discord/ui.js +0 -26
- package/dist/discord/voice/command.js +0 -263
- package/dist/discord/voice/manager.js +0 -531
- package/dist/discord/voice-message.js +0 -254
- package/dist/entry.js +0 -136
- package/dist/extensionAPI.js +0 -8
- package/dist/gateway/agent-event-assistant-text.js +0 -5
- package/dist/gateway/agent-prompt.js +0 -33
- package/dist/gateway/assistant-identity.js +0 -64
- package/dist/gateway/auth-rate-limit.js +0 -155
- package/dist/gateway/auth.js +0 -367
- package/dist/gateway/boot.js +0 -72
- package/dist/gateway/call.js +0 -295
- package/dist/gateway/canvas-capability.js +0 -75
- package/dist/gateway/channel-health-monitor.js +0 -121
- package/dist/gateway/chat-abort.js +0 -55
- package/dist/gateway/chat-attachments.js +0 -133
- package/dist/gateway/chat-sanitize.js +0 -103
- package/dist/gateway/client.js +0 -397
- package/dist/gateway/config-reload.js +0 -294
- package/dist/gateway/control-plane-audit.js +0 -28
- package/dist/gateway/control-plane-rate-limit.js +0 -53
- package/dist/gateway/control-ui-contract.js +0 -1
- package/dist/gateway/control-ui-csp.js +0 -15
- package/dist/gateway/control-ui-shared.js +0 -48
- package/dist/gateway/control-ui.js +0 -388
- package/dist/gateway/device-auth.js +0 -19
- package/dist/gateway/device-pairing-security.js +0 -197
- package/dist/gateway/event-deduplication.js +0 -167
- package/dist/gateway/events.js +0 -1
- package/dist/gateway/exec-approval-manager.js +0 -40
- package/dist/gateway/gateway-config-prompts.shared.js +0 -25
- package/dist/gateway/gateway-improvements.js +0 -294
- package/dist/gateway/hooks-mapping.js +0 -379
- package/dist/gateway/hooks.js +0 -287
- package/dist/gateway/http-auth-helpers.js +0 -19
- package/dist/gateway/http-common.js +0 -88
- package/dist/gateway/http-endpoint-helpers.js +0 -28
- package/dist/gateway/http-utils.js +0 -49
- package/dist/gateway/live-image-probe.js +0 -91
- package/dist/gateway/method-scopes.js +0 -177
- package/dist/gateway/net.js +0 -414
- package/dist/gateway/node-command-policy.js +0 -146
- package/dist/gateway/node-invoke-sanitize.js +0 -11
- package/dist/gateway/node-invoke-system-run-approval.js +0 -184
- package/dist/gateway/node-pending-work.js +0 -142
- package/dist/gateway/node-registry.js +0 -147
- package/dist/gateway/open-responses.schema.js +0 -285
- package/dist/gateway/openai-http.js +0 -328
- package/dist/gateway/openresponses-http.js +0 -704
- package/dist/gateway/origin-check.js +0 -39
- package/dist/gateway/probe-auth.js +0 -23
- package/dist/gateway/probe.js +0 -87
- package/dist/gateway/protocol/client-info.js +0 -55
- package/dist/gateway/protocol/index.js +0 -127
- package/dist/gateway/protocol/schema/agent.js +0 -91
- package/dist/gateway/protocol/schema/agents-models-skills.js +0 -117
- package/dist/gateway/protocol/schema/channels.js +0 -95
- package/dist/gateway/protocol/schema/config.js +0 -44
- package/dist/gateway/protocol/schema/cron.js +0 -188
- package/dist/gateway/protocol/schema/devices.js +0 -37
- package/dist/gateway/protocol/schema/error-codes.js +0 -15
- package/dist/gateway/protocol/schema/exec-approvals.js +0 -66
- package/dist/gateway/protocol/schema/frames.js +0 -101
- package/dist/gateway/protocol/schema/logs-chat.js +0 -53
- package/dist/gateway/protocol/schema/nodes.js +0 -72
- package/dist/gateway/protocol/schema/primitives.js +0 -10
- package/dist/gateway/protocol/schema/protocol-schemas.js +0 -136
- package/dist/gateway/protocol/schema/push.js +0 -18
- package/dist/gateway/protocol/schema/sessions.js +0 -91
- package/dist/gateway/protocol/schema/snapshot.js +0 -40
- package/dist/gateway/protocol/schema/swarm.js +0 -80
- package/dist/gateway/protocol/schema/types.js +0 -1
- package/dist/gateway/protocol/schema/wizard.js +0 -76
- package/dist/gateway/protocol/schema.js +0 -18
- package/dist/gateway/role-policy.js +0 -17
- package/dist/gateway/run-tracker.js +0 -253
- package/dist/gateway/server/__tests__/test-utils.js +0 -24
- package/dist/gateway/server/close-reason.js +0 -10
- package/dist/gateway/server/health-state.js +0 -69
- package/dist/gateway/server/hooks.js +0 -85
- package/dist/gateway/server/http-listen.js +0 -26
- package/dist/gateway/server/plugins-http.js +0 -45
- package/dist/gateway/server/presence-events.js +0 -12
- package/dist/gateway/server/tls.js +0 -4
- package/dist/gateway/server/ws-connection/auth-messages.js +0 -54
- package/dist/gateway/server/ws-connection/connect-policy.js +0 -37
- package/dist/gateway/server/ws-connection/message-handler.js +0 -792
- package/dist/gateway/server/ws-connection.js +0 -228
- package/dist/gateway/server/ws-types.js +0 -1
- package/dist/gateway/server-broadcast.js +0 -95
- package/dist/gateway/server-browser.js +0 -24
- package/dist/gateway/server-channels.js +0 -338
- package/dist/gateway/server-chat.js +0 -368
- package/dist/gateway/server-close.js +0 -103
- package/dist/gateway/server-constants.js +0 -34
- package/dist/gateway/server-cron.js +0 -372
- package/dist/gateway/server-discovery-runtime.js +0 -80
- package/dist/gateway/server-discovery.js +0 -62
- package/dist/gateway/server-health-probes.js +0 -55
- package/dist/gateway/server-http-health.js +0 -215
- package/dist/gateway/server-http.js +0 -526
- package/dist/gateway/server-lanes.js +0 -7
- package/dist/gateway/server-maintenance.js +0 -116
- package/dist/gateway/server-methods/agent-job.js +0 -197
- package/dist/gateway/server-methods/agent-timestamp.js +0 -60
- package/dist/gateway/server-methods/agent.js +0 -498
- package/dist/gateway/server-methods/agents.js +0 -333
- package/dist/gateway/server-methods/attachment-normalize.js +0 -16
- package/dist/gateway/server-methods/base-hash.js +0 -8
- package/dist/gateway/server-methods/browser.js +0 -204
- package/dist/gateway/server-methods/channels.js +0 -218
- package/dist/gateway/server-methods/chat.js +0 -855
- package/dist/gateway/server-methods/config.js +0 -310
- package/dist/gateway/server-methods/connect.js +0 -6
- package/dist/gateway/server-methods/cron.js +0 -109
- package/dist/gateway/server-methods/devices.js +0 -109
- package/dist/gateway/server-methods/exec-approval.js +0 -78
- package/dist/gateway/server-methods/exec-approvals.js +0 -141
- package/dist/gateway/server-methods/health.js +0 -29
- package/dist/gateway/server-methods/logs.js +0 -143
- package/dist/gateway/server-methods/models.js +0 -26
- package/dist/gateway/server-methods/nodes-pending.js +0 -96
- package/dist/gateway/server-methods/nodes.handlers.invoke-result.js +0 -55
- package/dist/gateway/server-methods/nodes.helpers.js +0 -44
- package/dist/gateway/server-methods/nodes.js +0 -624
- package/dist/gateway/server-methods/push.js +0 -53
- package/dist/gateway/server-methods/restart-request.js +0 -13
- package/dist/gateway/server-methods/send.js +0 -326
- package/dist/gateway/server-methods/sessions.js +0 -442
- package/dist/gateway/server-methods/skills.js +0 -137
- package/dist/gateway/server-methods/swarm.js +0 -58
- package/dist/gateway/server-methods/system.js +0 -120
- package/dist/gateway/server-methods/talk.js +0 -20
- package/dist/gateway/server-methods/telemetry.js +0 -71
- package/dist/gateway/server-methods/tts.js +0 -132
- package/dist/gateway/server-methods/types.js +0 -1
- package/dist/gateway/server-methods/update.js +0 -96
- package/dist/gateway/server-methods/usage.js +0 -693
- package/dist/gateway/server-methods/validation.js +0 -8
- package/dist/gateway/server-methods/voicewake.js +0 -30
- package/dist/gateway/server-methods/web.js +0 -73
- package/dist/gateway/server-methods/wizard.js +0 -100
- package/dist/gateway/server-methods-list.js +0 -128
- package/dist/gateway/server-methods.js +0 -220
- package/dist/gateway/server-mobile-nodes.js +0 -10
- package/dist/gateway/server-model-catalog.js +0 -11
- package/dist/gateway/server-node-events-types.js +0 -1
- package/dist/gateway/server-node-events.js +0 -445
- package/dist/gateway/server-node-subscriptions.js +0 -93
- package/dist/gateway/server-plugins.js +0 -36
- package/dist/gateway/server-reload-handlers.js +0 -111
- package/dist/gateway/server-restart-sentinel.js +0 -84
- package/dist/gateway/server-runtime-config.js +0 -92
- package/dist/gateway/server-runtime-state.js +0 -129
- package/dist/gateway/server-session-key.js +0 -20
- package/dist/gateway/server-shared.js +0 -1
- package/dist/gateway/server-startup-log.js +0 -27
- package/dist/gateway/server-startup-memory.js +0 -22
- package/dist/gateway/server-startup.js +0 -119
- package/dist/gateway/server-tailscale.js +0 -41
- package/dist/gateway/server-utils.js +0 -35
- package/dist/gateway/server-wizard-sessions.js +0 -19
- package/dist/gateway/server-ws-runtime.js +0 -21
- package/dist/gateway/server.agent.gateway-server-agent.mocks.js +0 -35
- package/dist/gateway/server.e2e-registry-helpers.js +0 -1
- package/dist/gateway/server.e2e-ws-harness.js +0 -20
- package/dist/gateway/server.impl.js +0 -615
- package/dist/gateway/server.js +0 -2
- package/dist/gateway/session-preview.test-helpers.js +0 -11
- package/dist/gateway/session-utils.fs.js +0 -580
- package/dist/gateway/session-utils.js +0 -698
- package/dist/gateway/session-utils.types.js +0 -1
- package/dist/gateway/sessions-patch.js +0 -326
- package/dist/gateway/sessions-resolve.js +0 -115
- package/dist/gateway/startup-auth.js +0 -126
- package/dist/gateway/test-helpers.agent-results.js +0 -15
- package/dist/gateway/test-helpers.e2e.js +0 -101
- package/dist/gateway/test-helpers.js +0 -2
- package/dist/gateway/test-helpers.mocks.js +0 -532
- package/dist/gateway/test-helpers.openai-mock.js +0 -170
- package/dist/gateway/test-helpers.server.js +0 -526
- package/dist/gateway/test-http-response.js +0 -12
- package/dist/gateway/test-openai-responses-model.js +0 -20
- package/dist/gateway/test-temp-config.js +0 -30
- package/dist/gateway/test-with-server.js +0 -32
- package/dist/gateway/tools-invoke-http.js +0 -244
- package/dist/gateway/websocket-preauth-security.js +0 -188
- package/dist/gateway/ws-log.js +0 -364
- package/dist/gateway/ws-logging.js +0 -8
- package/dist/globals.js +0 -41
- package/dist/hooks/bundled/boot-md/handler.js +0 -14
- package/dist/hooks/bundled/bootstrap-extra-files/handler.js +0 -48
- package/dist/hooks/bundled/command-logger/handler.js +0 -60
- package/dist/hooks/bundled/session-memory/handler.js +0 -278
- package/dist/hooks/bundled/soul-evil/handler.js +0 -36
- package/dist/hooks/bundled-dir.js +0 -42
- package/dist/hooks/config.js +0 -123
- package/dist/hooks/fire-and-forget.js +0 -6
- package/dist/hooks/frontmatter.js +0 -60
- package/dist/hooks/gmail-ops.js +0 -243
- package/dist/hooks/gmail-setup-utils.js +0 -310
- package/dist/hooks/gmail-watcher-lifecycle.js +0 -23
- package/dist/hooks/gmail-watcher.js +0 -196
- package/dist/hooks/gmail.js +0 -179
- package/dist/hooks/hooks-status.js +0 -135
- package/dist/hooks/hooks.js +0 -2
- package/dist/hooks/install.js +0 -338
- package/dist/hooks/installs.js +0 -24
- package/dist/hooks/internal-hooks.js +0 -201
- package/dist/hooks/llm-slug-generator.js +0 -73
- package/dist/hooks/loader.js +0 -110
- package/dist/hooks/message-hook-mappers.js +0 -179
- package/dist/hooks/module-loader.js +0 -28
- package/dist/hooks/plugin-hooks.js +0 -92
- package/dist/hooks/soul-evil.js +0 -186
- package/dist/hooks/types.js +0 -1
- package/dist/hooks/workspace.js +0 -237
- package/dist/imessage/accounts.js +0 -50
- package/dist/imessage/channel.js +0 -253
- package/dist/imessage/client.js +0 -174
- package/dist/imessage/constants.js +0 -2
- package/dist/imessage/index.js +0 -3
- package/dist/imessage/monitor/abort-handler.js +0 -23
- package/dist/imessage/monitor/deliver.js +0 -54
- package/dist/imessage/monitor/echo-cache.js +0 -70
- package/dist/imessage/monitor/inbound-processing.js +0 -347
- package/dist/imessage/monitor/loop-rate-limiter.js +0 -51
- package/dist/imessage/monitor/monitor-provider.js +0 -418
- package/dist/imessage/monitor/parse-notification.js +0 -64
- package/dist/imessage/monitor/reflection-guard.js +0 -50
- package/dist/imessage/monitor/runtime.js +0 -8
- package/dist/imessage/monitor/sanitize-outbound.js +0 -25
- package/dist/imessage/monitor/self-chat-cache.js +0 -75
- package/dist/imessage/monitor/types.js +0 -1
- package/dist/imessage/monitor.js +0 -1
- package/dist/imessage/probe.js +0 -68
- package/dist/imessage/runtime.js +0 -3
- package/dist/imessage/send.js +0 -147
- package/dist/imessage/target-parsing-helpers.js +0 -92
- package/dist/imessage/targets.js +0 -172
- package/dist/index.js +0 -49
- package/dist/infra/abort-pattern.js +0 -106
- package/dist/infra/abort-signal.js +0 -12
- package/dist/infra/agent-command-binding.js +0 -144
- package/dist/infra/agent-events.js +0 -57
- package/dist/infra/archive-path.js +0 -49
- package/dist/infra/archive.js +0 -422
- package/dist/infra/backoff.js +0 -19
- package/dist/infra/backup.js +0 -328
- package/dist/infra/binaries.js +0 -9
- package/dist/infra/bonjour-ciao.js +0 -10
- package/dist/infra/bonjour-discovery.js +0 -506
- package/dist/infra/bonjour-errors.js +0 -7
- package/dist/infra/bonjour.js +0 -209
- package/dist/infra/boundary-file-read.js +0 -118
- package/dist/infra/boundary-path.js +0 -594
- package/dist/infra/brew.js +0 -55
- package/dist/infra/canvas-host-url.js +0 -52
- package/dist/infra/channel-account-context.js +0 -173
- package/dist/infra/channel-activity.js +0 -32
- package/dist/infra/channel-summary.js +0 -183
- package/dist/infra/channels-status-issues.js +0 -15
- package/dist/infra/clipboard.js +0 -24
- package/dist/infra/control-ui-assets.js +0 -228
- package/dist/infra/dedupe.js +0 -47
- package/dist/infra/detect-package-manager.js +0 -26
- package/dist/infra/device-auth-store.js +0 -97
- package/dist/infra/device-identity.js +0 -149
- package/dist/infra/device-pairing.js +0 -461
- package/dist/infra/diagnostic-events.js +0 -28
- package/dist/infra/diagnostic-flags.js +0 -67
- package/dist/infra/dotenv.js +0 -15
- package/dist/infra/env-file.js +0 -43
- package/dist/infra/env.js +0 -39
- package/dist/infra/errors.js +0 -87
- package/dist/infra/exec-approval-forwarder.js +0 -212
- package/dist/infra/exec-approval-reply.js +0 -7
- package/dist/infra/exec-approvals-allowlist.js +0 -335
- package/dist/infra/exec-approvals-analysis.js +0 -828
- package/dist/infra/exec-approvals-security.js +0 -217
- package/dist/infra/exec-approvals.js +0 -365
- package/dist/infra/exec-host.js +0 -75
- package/dist/infra/exec-safe-bin-policy.js +0 -277
- package/dist/infra/exec-safe-bin-trust.js +0 -64
- package/dist/infra/exec-safety.js +0 -31
- package/dist/infra/fetch.js +0 -58
- package/dist/infra/file-identity.js +0 -12
- package/dist/infra/file-lock.js +0 -1
- package/dist/infra/fixed-window-rate-limit.js +0 -33
- package/dist/infra/format-duration.js +0 -20
- package/dist/infra/format-time/format-datetime.js +0 -79
- package/dist/infra/format-time/format-duration.js +0 -81
- package/dist/infra/format-time/format-relative.js +0 -80
- package/dist/infra/fs-safe.js +0 -473
- package/dist/infra/gateway-lock.js +0 -206
- package/dist/infra/gemini-auth.js +0 -39
- package/dist/infra/git-commit.js +0 -106
- package/dist/infra/git-root.js +0 -61
- package/dist/infra/hardlink-guards.js +0 -30
- package/dist/infra/heartbeat-active-hours.js +0 -85
- package/dist/infra/heartbeat-events-filter.js +0 -50
- package/dist/infra/heartbeat-events.js +0 -34
- package/dist/infra/heartbeat-reason.js +0 -40
- package/dist/infra/heartbeat-runner.js +0 -947
- package/dist/infra/heartbeat-runner.test-utils.js +0 -39
- package/dist/infra/heartbeat-visibility.js +0 -45
- package/dist/infra/heartbeat-wake.js +0 -216
- package/dist/infra/home-dir.js +0 -54
- package/dist/infra/host-env-security-policy.json +0 -19
- package/dist/infra/host-env-security.js +0 -66
- package/dist/infra/http-body.js +0 -265
- package/dist/infra/install-package-dir.js +0 -50
- package/dist/infra/install-safe-path.js +0 -49
- package/dist/infra/install-source-utils.js +0 -131
- package/dist/infra/is-main.js +0 -33
- package/dist/infra/json-file.js +0 -21
- package/dist/infra/json-files.js +0 -49
- package/dist/infra/json-utf8-bytes.js +0 -8
- package/dist/infra/jsonl-socket.js +0 -52
- package/dist/infra/machine-name.js +0 -43
- package/dist/infra/map-size.js +0 -14
- package/dist/infra/net/fetch-guard.js +0 -217
- package/dist/infra/net/hostname.js +0 -7
- package/dist/infra/net/proxy-env.js +0 -17
- package/dist/infra/net/ssrf.js +0 -277
- package/dist/infra/node-pairing.js +0 -173
- package/dist/infra/node-shell.js +0 -9
- package/dist/infra/npm-integrity.js +0 -45
- package/dist/infra/npm-pack-install.js +0 -40
- package/dist/infra/npm-registry-spec.js +0 -39
- package/dist/infra/os-summary.js +0 -23
- package/dist/infra/outbound/abort.js +0 -14
- package/dist/infra/outbound/agent-delivery.js +0 -86
- package/dist/infra/outbound/bound-delivery-router.js +0 -88
- package/dist/infra/outbound/channel-adapters.js +0 -29
- package/dist/infra/outbound/channel-selection.js +0 -68
- package/dist/infra/outbound/channel-target.js +0 -28
- package/dist/infra/outbound/deliver.js +0 -419
- package/dist/infra/outbound/delivery-queue.js +0 -214
- package/dist/infra/outbound/directory-cache.js +0 -44
- package/dist/infra/outbound/envelope.js +0 -20
- package/dist/infra/outbound/format.js +0 -72
- package/dist/infra/outbound/identity.js +0 -23
- package/dist/infra/outbound/message-action-params.js +0 -307
- package/dist/infra/outbound/message-action-runner.js +0 -610
- package/dist/infra/outbound/message-action-spec.js +0 -90
- package/dist/infra/outbound/message.js +0 -212
- package/dist/infra/outbound/outbound-policy.js +0 -149
- package/dist/infra/outbound/outbound-send-service.js +0 -110
- package/dist/infra/outbound/outbound-session.js +0 -852
- package/dist/infra/outbound/payloads.js +0 -85
- package/dist/infra/outbound/session-binding-service.js +0 -123
- package/dist/infra/outbound/target-errors.js +0 -23
- package/dist/infra/outbound/target-normalization.js +0 -27
- package/dist/infra/outbound/target-resolver.js +0 -348
- package/dist/infra/outbound/targets.js +0 -213
- package/dist/infra/outbound/tool-payload.js +0 -21
- package/dist/infra/package-json.js +0 -23
- package/dist/infra/pairing-files.js +0 -29
- package/dist/infra/pairing-token.js +0 -9
- package/dist/infra/path-alias-guards.js +0 -21
- package/dist/infra/path-env.js +0 -94
- package/dist/infra/path-guards.js +0 -37
- package/dist/infra/path-prepend.js +0 -51
- package/dist/infra/path-safety.js +0 -16
- package/dist/infra/plain-object.js +0 -9
- package/dist/infra/poolbot-root.js +0 -109
- package/dist/infra/ports-format.js +0 -53
- package/dist/infra/ports-inspect.js +0 -240
- package/dist/infra/ports-lsof.js +0 -33
- package/dist/infra/ports-probe.js +0 -19
- package/dist/infra/ports-types.js +0 -1
- package/dist/infra/ports.js +0 -78
- package/dist/infra/process-respawn.js +0 -49
- package/dist/infra/prototype-keys.js +0 -4
- package/dist/infra/provider-usage.auth.js +0 -188
- package/dist/infra/provider-usage.fetch.antigravity.js +0 -212
- package/dist/infra/provider-usage.fetch.claude.js +0 -129
- package/dist/infra/provider-usage.fetch.codex.js +0 -54
- package/dist/infra/provider-usage.fetch.copilot.js +0 -42
- package/dist/infra/provider-usage.fetch.gemini.js +0 -60
- package/dist/infra/provider-usage.fetch.js +0 -7
- package/dist/infra/provider-usage.fetch.minimax.js +0 -332
- package/dist/infra/provider-usage.fetch.shared.js +0 -39
- package/dist/infra/provider-usage.fetch.zai.js +0 -63
- package/dist/infra/provider-usage.format.js +0 -96
- package/dist/infra/provider-usage.js +0 -3
- package/dist/infra/provider-usage.load.js +0 -59
- package/dist/infra/provider-usage.shared.js +0 -51
- package/dist/infra/provider-usage.types.js +0 -1
- package/dist/infra/push-apns.js +0 -365
- package/dist/infra/restart-sentinel.js +0 -80
- package/dist/infra/restart-stale-pids.js +0 -254
- package/dist/infra/restart.js +0 -375
- package/dist/infra/retry-policy.js +0 -73
- package/dist/infra/retry.js +0 -185
- package/dist/infra/runtime-guard.js +0 -60
- package/dist/infra/runtime-status.js +0 -16
- package/dist/infra/safe-open-sync.js +0 -71
- package/dist/infra/scp-host.js +0 -54
- package/dist/infra/secure-random.js +0 -7
- package/dist/infra/security/command-analyzer.js +0 -257
- package/dist/infra/session-cleanup.js +0 -143
- package/dist/infra/session-cost-usage.js +0 -828
- package/dist/infra/session-cost-usage.types.js +0 -1
- package/dist/infra/session-maintenance-warning.js +0 -91
- package/dist/infra/shell-env.js +0 -190
- package/dist/infra/shell-security.js +0 -201
- package/dist/infra/skills-remote.js +0 -293
- package/dist/infra/ssh-config.js +0 -89
- package/dist/infra/ssh-tunnel.js +0 -166
- package/dist/infra/state-migrations.fs.js +0 -49
- package/dist/infra/state-migrations.js +0 -770
- package/dist/infra/system-events.js +0 -89
- package/dist/infra/system-presence.js +0 -227
- package/dist/infra/system-run-command.js +0 -123
- package/dist/infra/tailnet.js +0 -46
- package/dist/infra/tailscale.js +0 -368
- package/dist/infra/tls/fingerprint.js +0 -5
- package/dist/infra/tls/gateway.js +0 -119
- package/dist/infra/tmp-openclaw-dir.js +0 -84
- package/dist/infra/tmp-poolbot-dir.js +0 -81
- package/dist/infra/transport-ready.js +0 -38
- package/dist/infra/unhandled-rejections.js +0 -116
- package/dist/infra/update-channels.js +0 -81
- package/dist/infra/update-check.js +0 -293
- package/dist/infra/update-global.js +0 -120
- package/dist/infra/update-runner.js +0 -686
- package/dist/infra/update-startup.js +0 -163
- package/dist/infra/voicewake.js +0 -74
- package/dist/infra/warning-filter.js +0 -65
- package/dist/infra/warnings.js +0 -25
- package/dist/infra/widearea-dns.js +0 -152
- package/dist/infra/ws.js +0 -13
- package/dist/infra/wsl.js +0 -61
- package/dist/line/accounts.js +0 -128
- package/dist/line/actions.js +0 -45
- package/dist/line/auto-reply-delivery.js +0 -102
- package/dist/line/bot-access.js +0 -26
- package/dist/line/bot-handlers.js +0 -260
- package/dist/line/bot-message-context.js +0 -346
- package/dist/line/bot.js +0 -48
- package/dist/line/channel-access-token.js +0 -9
- package/dist/line/config-schema.js +0 -47
- package/dist/line/download.js +0 -95
- package/dist/line/flex-templates/basic-cards.js +0 -332
- package/dist/line/flex-templates/common.js +0 -18
- package/dist/line/flex-templates/media-control-cards.js +0 -453
- package/dist/line/flex-templates/message.js +0 -10
- package/dist/line/flex-templates/schedule-cards.js +0 -399
- package/dist/line/flex-templates/types.js +0 -1
- package/dist/line/flex-templates.js +0 -1264
- package/dist/line/http-registry.js +0 -27
- package/dist/line/index.js +0 -19
- package/dist/line/markdown-to-line.js +0 -346
- package/dist/line/monitor.js +0 -266
- package/dist/line/probe.js +0 -37
- package/dist/line/reply-chunks.js +0 -53
- package/dist/line/rich-menu.js +0 -320
- package/dist/line/send.js +0 -451
- package/dist/line/signature.js +0 -11
- package/dist/line/template-messages.js +0 -258
- package/dist/line/types.js +0 -1
- package/dist/line/webhook-node.js +0 -100
- package/dist/line/webhook-utils.js +0 -11
- package/dist/line/webhook.js +0 -71
- package/dist/link-understanding/apply.js +0 -22
- package/dist/link-understanding/defaults.js +0 -2
- package/dist/link-understanding/detect.js +0 -57
- package/dist/link-understanding/format.js +0 -10
- package/dist/link-understanding/index.js +0 -4
- package/dist/link-understanding/runner.js +0 -99
- package/dist/logger.js +0 -53
- package/dist/logging/config.js +0 -19
- package/dist/logging/console.js +0 -237
- package/dist/logging/diagnostic-session-state.js +0 -73
- package/dist/logging/diagnostic.js +0 -258
- package/dist/logging/levels.js +0 -26
- package/dist/logging/logger.js +0 -185
- package/dist/logging/parse-log-line.js +0 -52
- package/dist/logging/redact-identifier.js +0 -12
- package/dist/logging/redact.js +0 -115
- package/dist/logging/state.js +0 -12
- package/dist/logging/subsystem.js +0 -271
- package/dist/logging/timestamps.js +0 -14
- package/dist/logging.js +0 -5
- package/dist/macos/gateway-daemon.js +0 -183
- package/dist/macos/relay-smoke.js +0 -33
- package/dist/macos/relay.js +0 -61
- package/dist/markdown/code-spans.js +0 -67
- package/dist/markdown/fences.js +0 -57
- package/dist/markdown/frontmatter.js +0 -124
- package/dist/markdown/ir.js +0 -761
- package/dist/markdown/render.js +0 -113
- package/dist/markdown/tables.js +0 -35
- package/dist/markdown/whatsapp.js +0 -62
- package/dist/media/audio-tags.js +0 -14
- package/dist/media/audio.js +0 -15
- package/dist/media/base64.js +0 -34
- package/dist/media/constants.js +0 -42
- package/dist/media/fetch.js +0 -145
- package/dist/media/ffmpeg-limits.js +0 -4
- package/dist/media/host.js +0 -43
- package/dist/media/image-ops.js +0 -394
- package/dist/media/inbound-path-policy.js +0 -107
- package/dist/media/input-files.js +0 -296
- package/dist/media/local-roots.js +0 -33
- package/dist/media/mime.js +0 -151
- package/dist/media/outbound-attachment.js +0 -10
- package/dist/media/parse.js +0 -175
- package/dist/media/png-encode.js +0 -74
- package/dist/media/read-response-with-limit.js +0 -64
- package/dist/media/server.js +0 -88
- package/dist/media/sniff-mime-from-base64.js +0 -19
- package/dist/media/store.js +0 -238
- package/dist/media/temp-files.js +0 -12
- package/dist/media-understanding/apply.js +0 -481
- package/dist/media-understanding/attachments.js +0 -331
- package/dist/media-understanding/audio-preflight.js +0 -67
- package/dist/media-understanding/concurrency.js +0 -14
- package/dist/media-understanding/defaults.js +0 -46
- package/dist/media-understanding/errors.js +0 -11
- package/dist/media-understanding/format.js +0 -56
- package/dist/media-understanding/fs.js +0 -13
- package/dist/media-understanding/index.js +0 -3
- package/dist/media-understanding/output-extract.js +0 -26
- package/dist/media-understanding/providers/anthropic/index.js +0 -6
- package/dist/media-understanding/providers/audio.test-helpers.js +0 -34
- package/dist/media-understanding/providers/deepgram/audio.js +0 -55
- package/dist/media-understanding/providers/deepgram/index.js +0 -6
- package/dist/media-understanding/providers/google/audio.js +0 -71
- package/dist/media-understanding/providers/google/index.js +0 -10
- package/dist/media-understanding/providers/google/inline-data.js +0 -64
- package/dist/media-understanding/providers/google/video.js +0 -71
- package/dist/media-understanding/providers/groq/index.js +0 -10
- package/dist/media-understanding/providers/image.js +0 -59
- package/dist/media-understanding/providers/index.js +0 -48
- package/dist/media-understanding/providers/minimax/index.js +0 -6
- package/dist/media-understanding/providers/openai/audio.js +0 -54
- package/dist/media-understanding/providers/openai/index.js +0 -8
- package/dist/media-understanding/providers/shared.js +0 -41
- package/dist/media-understanding/providers/zai/index.js +0 -6
- package/dist/media-understanding/resolve.js +0 -113
- package/dist/media-understanding/runner.entries.js +0 -476
- package/dist/media-understanding/runner.js +0 -649
- package/dist/media-understanding/scope.js +0 -41
- package/dist/media-understanding/types.js +0 -1
- package/dist/media-understanding/video.js +0 -8
- package/dist/memory/backend-config.js +0 -246
- package/dist/memory/batch-error-utils.js +0 -11
- package/dist/memory/batch-gemini.js +0 -320
- package/dist/memory/batch-http.js +0 -27
- package/dist/memory/batch-openai.js +0 -290
- package/dist/memory/batch-output.js +0 -29
- package/dist/memory/batch-runner.js +0 -22
- package/dist/memory/batch-upload.js +0 -23
- package/dist/memory/batch-utils.js +0 -26
- package/dist/memory/batch-voyage.js +0 -277
- package/dist/memory/embedding-chunk-limits.js +0 -25
- package/dist/memory/embedding-input-limits.js +0 -56
- package/dist/memory/embedding-model-limits.js +0 -24
- package/dist/memory/embeddings-debug.js +0 -11
- package/dist/memory/embeddings-gemini.js +0 -144
- package/dist/memory/embeddings-ollama.js +0 -111
- package/dist/memory/embeddings-openai.js +0 -65
- package/dist/memory/embeddings-remote-client.js +0 -22
- package/dist/memory/embeddings-remote-fetch.js +0 -15
- package/dist/memory/embeddings-voyage.js +0 -75
- package/dist/memory/embeddings.js +0 -251
- package/dist/memory/fs-utils.js +0 -23
- package/dist/memory/headers-fingerprint.js +0 -16
- package/dist/memory/hybrid.js +0 -80
- package/dist/memory/index.js +0 -1
- package/dist/memory/internal.js +0 -272
- package/dist/memory/manager-cache-key.js +0 -45
- package/dist/memory/manager-embedding-ops.js +0 -595
- package/dist/memory/manager-search.js +0 -101
- package/dist/memory/manager-sync-ops.js +0 -963
- package/dist/memory/manager.js +0 -1975
- package/dist/memory/memory-improvements.js +0 -239
- package/dist/memory/memory-schema.js +0 -76
- package/dist/memory/mmr.js +0 -164
- package/dist/memory/node-llama.js +0 -3
- package/dist/memory/openai-batch.js +0 -2
- package/dist/memory/post-json.js +0 -23
- package/dist/memory/provider-key.js +0 -23
- package/dist/memory/qmd-manager.js +0 -1669
- package/dist/memory/qmd-query-parser.js +0 -107
- package/dist/memory/qmd-scope.js +0 -93
- package/dist/memory/query-expansion.js +0 -495
- package/dist/memory/remote-http.js +0 -33
- package/dist/memory/search-manager.js +0 -183
- package/dist/memory/session-files.js +0 -104
- package/dist/memory/sqlite-vec.js +0 -19
- package/dist/memory/sqlite.js +0 -7
- package/dist/memory/status-format.js +0 -28
- package/dist/memory/sync-index.js +0 -21
- package/dist/memory/sync-memory-files.js +0 -69
- package/dist/memory/sync-progress.js +0 -22
- package/dist/memory/sync-session-files.js +0 -95
- package/dist/memory/sync-stale.js +0 -30
- package/dist/memory/temporal-decay.js +0 -119
- package/dist/memory/test-embeddings-mock.js +0 -16
- package/dist/memory/test-manager-helpers.js +0 -14
- package/dist/memory/test-manager.js +0 -8
- package/dist/memory/test-runtime-mocks.js +0 -11
- package/dist/memory/types.js +0 -1
- package/dist/node-host/config.js +0 -53
- package/dist/node-host/invoke-browser.js +0 -177
- package/dist/node-host/invoke-system-run.js +0 -281
- package/dist/node-host/invoke.js +0 -403
- package/dist/node-host/runner.js +0 -1034
- package/dist/node-host/with-timeout.js +0 -27
- package/dist/pairing/pairing-challenge.js +0 -15
- package/dist/pairing/pairing-labels.js +0 -4
- package/dist/pairing/pairing-messages.js +0 -14
- package/dist/pairing/pairing-store.js +0 -438
- package/dist/pairing/setup-code.js +0 -285
- package/dist/plugin-sdk/account-id.d.ts +0 -1
- package/dist/plugin-sdk/agent-media-payload.d.ts +0 -12
- package/dist/plugin-sdk/allow-from.d.ts +0 -27
- package/dist/plugin-sdk/command-auth.d.ts +0 -25
- package/dist/plugin-sdk/config-paths.d.ts +0 -6
- package/dist/plugin-sdk/file-lock.d.ts +0 -16
- package/dist/plugin-sdk/index.d.ts +0 -428
- package/dist/plugin-sdk/json-store.d.ts +0 -5
- package/dist/plugin-sdk/keyed-async-queue.d.ts +0 -12
- package/dist/plugin-sdk/onboarding.d.ts +0 -11
- package/dist/plugin-sdk/provider-auth-result.d.ts +0 -14
- package/dist/plugin-sdk/slack-message-actions.d.ts +0 -11
- package/dist/plugin-sdk/status-helpers.d.ts +0 -25
- package/dist/plugin-sdk/temp-path.d.ts +0 -12
- package/dist/plugin-sdk/text-chunking.d.ts +0 -1
- package/dist/plugin-sdk/tool-send.d.ts +0 -4
- package/dist/plugin-sdk/webhook-path.d.ts +0 -6
- package/dist/plugin-sdk/webhook-targets.d.ts +0 -23
- package/dist/plugin-sdk/windows-spawn.d.ts +0 -39
- package/dist/plugin-sdk-internal/accounts.js +0 -6
- package/dist/plugin-sdk-internal/discord.js +0 -23
- package/dist/plugin-sdk-internal/imessage.js +0 -13
- package/dist/plugin-sdk-internal/setup.js +0 -9
- package/dist/plugin-sdk-internal/signal.js +0 -13
- package/dist/plugin-sdk-internal/slack.js +0 -22
- package/dist/plugin-sdk-internal/telegram.js +0 -32
- package/dist/plugin-sdk-internal/whatsapp.js +0 -29
- package/dist/plugins/bundled-dir.js +0 -39
- package/dist/plugins/cli.js +0 -49
- package/dist/plugins/commands.js +0 -232
- package/dist/plugins/config-schema.js +0 -23
- package/dist/plugins/config-state.js +0 -180
- package/dist/plugins/discovery.js +0 -468
- package/dist/plugins/enable.js +0 -36
- package/dist/plugins/hook-runner-global.js +0 -73
- package/dist/plugins/hooks.js +0 -454
- package/dist/plugins/hooks.test-helpers.js +0 -21
- package/dist/plugins/http-path.js +0 -10
- package/dist/plugins/http-registry.js +0 -31
- package/dist/plugins/install.js +0 -374
- package/dist/plugins/installs.js +0 -21
- package/dist/plugins/loader.js +0 -548
- package/dist/plugins/logger.js +0 -8
- package/dist/plugins/manifest-registry.js +0 -140
- package/dist/plugins/manifest.js +0 -84
- package/dist/plugins/path-safety.js +0 -34
- package/dist/plugins/providers.js +0 -16
- package/dist/plugins/registry.js +0 -315
- package/dist/plugins/runtime/index.js +0 -355
- package/dist/plugins/runtime/native-deps.js +0 -16
- package/dist/plugins/runtime/types.js +0 -1
- package/dist/plugins/runtime.js +0 -28
- package/dist/plugins/schema-validator.js +0 -28
- package/dist/plugins/services.js +0 -55
- package/dist/plugins/slots.js +0 -68
- package/dist/plugins/source-display.js +0 -51
- package/dist/plugins/status.js +0 -27
- package/dist/plugins/tools.js +0 -98
- package/dist/plugins/uninstall.js +0 -171
- package/dist/plugins/update.js +0 -390
- package/dist/polls.js +0 -52
- package/dist/process/child-process-bridge.js +0 -34
- package/dist/process/command-queue.js +0 -226
- package/dist/process/exec.js +0 -116
- package/dist/process/kill-tree.js +0 -98
- package/dist/process/lanes.js +0 -1
- package/dist/process/restart-recovery.js +0 -16
- package/dist/process/spawn-utils.js +0 -102
- package/dist/process/supervisor/adapters/child.js +0 -143
- package/dist/process/supervisor/adapters/env.js +0 -13
- package/dist/process/supervisor/adapters/pty.js +0 -148
- package/dist/process/supervisor/index.js +0 -10
- package/dist/process/supervisor/registry.js +0 -117
- package/dist/process/supervisor/supervisor.js +0 -244
- package/dist/process/supervisor/types.js +0 -1
- package/dist/providers/github-copilot-auth.js +0 -101
- package/dist/providers/github-copilot-models.js +0 -66
- package/dist/providers/github-copilot-token.js +0 -57
- package/dist/providers/google-shared.test-helpers.js +0 -75
- package/dist/providers/qwen-portal-oauth.js +0 -46
- package/dist/routing/account-id.js +0 -30
- package/dist/routing/bindings.js +0 -87
- package/dist/routing/resolve-route.js +0 -282
- package/dist/runtime.js +0 -43
- package/dist/secrets/index.js +0 -28
- package/dist/secrets/resolver.js +0 -185
- package/dist/secrets/runtime.js +0 -142
- package/dist/secrets/types.js +0 -11
- package/dist/security/audit-channel.js +0 -499
- package/dist/security/audit-extra.async.js +0 -927
- package/dist/security/audit-extra.js +0 -12
- package/dist/security/audit-extra.sync.js +0 -891
- package/dist/security/audit-findings.js +0 -165
- package/dist/security/audit-fs.js +0 -151
- package/dist/security/audit-tool-policy.js +0 -1
- package/dist/security/audit.js +0 -172
- package/dist/security/capability-guards.js +0 -89
- package/dist/security/capability-manager.js +0 -76
- package/dist/security/capability.js +0 -147
- package/dist/security/channel-metadata.js +0 -34
- package/dist/security/dangerous-tools.js +0 -114
- package/dist/security/dm-policy-shared.js +0 -68
- package/dist/security/external-content.js +0 -307
- package/dist/security/fix.js +0 -366
- package/dist/security/index.js +0 -7
- package/dist/security/middleware.js +0 -105
- package/dist/security/prototype-pollution.js +0 -141
- package/dist/security/scan-paths.js +0 -32
- package/dist/security/secret-equal.js +0 -8
- package/dist/security/skill-scanner.js +0 -330
- package/dist/security/types.js +0 -12
- package/dist/security/webhook-security.js +0 -253
- package/dist/security/windows-acl.js +0 -177
- package/dist/sessions/input-provenance.js +0 -55
- package/dist/sessions/level-overrides.js +0 -24
- package/dist/sessions/model-overrides.js +0 -57
- package/dist/sessions/send-policy.js +0 -69
- package/dist/sessions/session-costs.js +0 -228
- package/dist/sessions/session-key-utils.js +0 -83
- package/dist/sessions/session-label.js +0 -16
- package/dist/sessions/transcript-events.js +0 -16
- package/dist/shared/chat-content.js +0 -31
- package/dist/shared/chat-envelope.js +0 -45
- package/dist/shared/config-eval.js +0 -117
- package/dist/shared/device-auth.js +0 -16
- package/dist/shared/entry-metadata.js +0 -9
- package/dist/shared/entry-status.js +0 -31
- package/dist/shared/frontmatter.js +0 -98
- package/dist/shared/model-param-b.js +0 -19
- package/dist/shared/net/ip-test-fixtures.js +0 -1
- package/dist/shared/net/ip.js +0 -354
- package/dist/shared/net/ipv4.js +0 -14
- package/dist/shared/node-list-parse.js +0 -13
- package/dist/shared/node-list-types.js +0 -1
- package/dist/shared/node-match.js +0 -60
- package/dist/shared/operator-scope-compat.js +0 -42
- package/dist/shared/param-key.js +0 -16
- package/dist/shared/poll-params.js +0 -58
- package/dist/shared/polls.js +0 -55
- package/dist/shared/requirements.js +0 -128
- package/dist/shared/string-normalization.js +0 -15
- package/dist/shared/subagents-format.js +0 -84
- package/dist/shared/text/reasoning-tags.js +0 -93
- package/dist/shared/text-chunking.js +0 -29
- package/dist/shared/usage-aggregates.js +0 -28
- package/dist/signal/accounts.js +0 -46
- package/dist/signal/channel.js +0 -264
- package/dist/signal/client.js +0 -141
- package/dist/signal/daemon.js +0 -69
- package/dist/signal/format.js +0 -165
- package/dist/signal/identity.js +0 -95
- package/dist/signal/index.js +0 -5
- package/dist/signal/monitor/access-policy.js +0 -60
- package/dist/signal/monitor/event-handler.js +0 -605
- package/dist/signal/monitor/event-handler.types.js +0 -1
- package/dist/signal/monitor/mentions.js +0 -45
- package/dist/signal/monitor.js +0 -269
- package/dist/signal/probe.js +0 -46
- package/dist/signal/reaction-level.js +0 -53
- package/dist/signal/rpc-context.js +0 -19
- package/dist/signal/runtime.js +0 -3
- package/dist/signal/send-reactions.js +0 -155
- package/dist/signal/send.js +0 -184
- package/dist/signal/sse-reconnect.js +0 -56
- package/dist/skills/commands.js +0 -333
- package/dist/skills/index.js +0 -164
- package/dist/skills/loader.js +0 -282
- package/dist/skills/openclaw-skill-loader.js +0 -191
- package/dist/skills/parser.js +0 -446
- package/dist/skills/registry.js +0 -394
- package/dist/skills/security.js +0 -312
- package/dist/skills/types.js +0 -21
- package/dist/slack/account-inspect.js +0 -135
- package/dist/slack/account-surface-fields.js +0 -1
- package/dist/slack/accounts.js +0 -71
- package/dist/slack/actions.js +0 -164
- package/dist/slack/blocks-fallback.js +0 -76
- package/dist/slack/blocks.test-helpers.js +0 -31
- package/dist/slack/channel-migration.js +0 -53
- package/dist/slack/channel.js +0 -394
- package/dist/slack/client.js +0 -17
- package/dist/slack/directory-live.js +0 -122
- package/dist/slack/draft-stream.js +0 -106
- package/dist/slack/format.js +0 -111
- package/dist/slack/http/index.js +0 -1
- package/dist/slack/http/registry.js +0 -27
- package/dist/slack/index.js +0 -6
- package/dist/slack/interactive-replies.js +0 -28
- package/dist/slack/message-actions.js +0 -51
- package/dist/slack/modal-metadata.js +0 -32
- package/dist/slack/monitor/allow-list.js +0 -57
- package/dist/slack/monitor/auth.js +0 -17
- package/dist/slack/monitor/channel-config.js +0 -79
- package/dist/slack/monitor/channel-type.js +0 -31
- package/dist/slack/monitor/commands.js +0 -28
- package/dist/slack/monitor/context.js +0 -243
- package/dist/slack/monitor/dm-auth.js +0 -49
- package/dist/slack/monitor/events/channels.js +0 -116
- package/dist/slack/monitor/events/interactions.js +0 -462
- package/dist/slack/monitor/events/interactions.modal.js +0 -137
- package/dist/slack/monitor/events/members.js +0 -74
- package/dist/slack/monitor/events/message-subtype-handlers.js +0 -68
- package/dist/slack/monitor/events/messages.js +0 -111
- package/dist/slack/monitor/events/pins.js +0 -76
- package/dist/slack/monitor/events/reactions.js +0 -54
- package/dist/slack/monitor/events/system-event-context.js +0 -29
- package/dist/slack/monitor/events/system-event-test-harness.js +0 -41
- package/dist/slack/monitor/events.js +0 -15
- package/dist/slack/monitor/external-arg-menu-store.js +0 -46
- package/dist/slack/monitor/media.js +0 -372
- package/dist/slack/monitor/message-handler/dispatch.js +0 -438
- package/dist/slack/monitor/message-handler/prepare-content.js +0 -69
- package/dist/slack/monitor/message-handler/prepare-thread-context.js +0 -91
- package/dist/slack/monitor/message-handler/prepare.js +0 -560
- package/dist/slack/monitor/message-handler/prepare.test-helpers.js +0 -55
- package/dist/slack/monitor/message-handler/types.js +0 -1
- package/dist/slack/monitor/message-handler.js +0 -87
- package/dist/slack/monitor/mrkdwn.js +0 -8
- package/dist/slack/monitor/policy.js +0 -10
- package/dist/slack/monitor/provider.js +0 -326
- package/dist/slack/monitor/reconnect-policy.js +0 -78
- package/dist/slack/monitor/replies.js +0 -115
- package/dist/slack/monitor/room-context.js +0 -17
- package/dist/slack/monitor/slash-commands.runtime.js +0 -1
- package/dist/slack/monitor/slash-dispatch.runtime.js +0 -9
- package/dist/slack/monitor/slash-skill-commands.runtime.js +0 -1
- package/dist/slack/monitor/slash.js +0 -726
- package/dist/slack/monitor/thread-resolution.js +0 -102
- package/dist/slack/monitor/types.js +0 -1
- package/dist/slack/monitor.js +0 -4
- package/dist/slack/monitor.test-helpers.js +0 -119
- package/dist/slack/probe.js +0 -47
- package/dist/slack/resolve-allowlist-common.js +0 -36
- package/dist/slack/resolve-channels.js +0 -93
- package/dist/slack/resolve-users.js +0 -133
- package/dist/slack/runtime.js +0 -3
- package/dist/slack/scopes.js +0 -87
- package/dist/slack/send.js +0 -222
- package/dist/slack/sent-thread-cache.js +0 -61
- package/dist/slack/slack-improvements.js +0 -225
- package/dist/slack/stream-mode.js +0 -51
- package/dist/slack/streaming.js +0 -79
- package/dist/slack/targets.js +0 -48
- package/dist/slack/threading-tool-context.js +0 -18
- package/dist/slack/threading.js +0 -26
- package/dist/slack/token.js +0 -10
- package/dist/slack/truncate.js +0 -10
- package/dist/slack/types.js +0 -1
- package/dist/swarm/service.js +0 -247
- package/dist/tailscale/detect.js +0 -145
- package/dist/telegram/account-inspect.js +0 -175
- package/dist/telegram/accounts.js +0 -130
- package/dist/telegram/allow-from.js +0 -10
- package/dist/telegram/allowed-updates.js +0 -11
- package/dist/telegram/api-fetch.js +0 -18
- package/dist/telegram/api-logging.js +0 -24
- package/dist/telegram/approval-buttons.js +0 -30
- package/dist/telegram/audit-membership-runtime.js +0 -61
- package/dist/telegram/audit.js +0 -116
- package/dist/telegram/bot/delivery.js +0 -474
- package/dist/telegram/bot/delivery.replies.js +0 -508
- package/dist/telegram/bot/delivery.resolve-media.js +0 -227
- package/dist/telegram/bot/delivery.send.js +0 -132
- package/dist/telegram/bot/helpers.js +0 -396
- package/dist/telegram/bot/reply-threading.js +0 -46
- package/dist/telegram/bot/types.js +0 -1
- package/dist/telegram/bot-access.js +0 -58
- package/dist/telegram/bot-handlers.js +0 -952
- package/dist/telegram/bot-message-context.body.js +0 -186
- package/dist/telegram/bot-message-context.js +0 -621
- package/dist/telegram/bot-message-context.session.js +0 -207
- package/dist/telegram/bot-message-context.types.js +0 -1
- package/dist/telegram/bot-message-dispatch.js +0 -682
- package/dist/telegram/bot-message.js +0 -41
- package/dist/telegram/bot-native-command-menu.js +0 -66
- package/dist/telegram/bot-native-commands.js +0 -529
- package/dist/telegram/bot-native-commands.test-helpers.js +0 -117
- package/dist/telegram/bot-updates.js +0 -25
- package/dist/telegram/bot.js +0 -292
- package/dist/telegram/bot.media.e2e-harness.js +0 -81
- package/dist/telegram/bot.media.test-utils.js +0 -81
- package/dist/telegram/button-types.js +0 -1
- package/dist/telegram/caption.js +0 -11
- package/dist/telegram/channel-actions.js +0 -225
- package/dist/telegram/channel.js +0 -515
- package/dist/telegram/conversation-route.js +0 -107
- package/dist/telegram/delivery.js +0 -2
- package/dist/telegram/delivery.replies.js +0 -508
- package/dist/telegram/dm-access.js +0 -86
- package/dist/telegram/download.js +0 -34
- package/dist/telegram/draft-chunking.js +0 -22
- package/dist/telegram/draft-stream.js +0 -146
- package/dist/telegram/draft-stream.test-helpers.js +0 -62
- package/dist/telegram/exec-approvals-handler.js +0 -281
- package/dist/telegram/exec-approvals.js +0 -62
- package/dist/telegram/fetch.js +0 -35
- package/dist/telegram/format.js +0 -210
- package/dist/telegram/forum-service-message.js +0 -22
- package/dist/telegram/group-access.js +0 -65
- package/dist/telegram/group-config-helpers.js +0 -10
- package/dist/telegram/group-migration.js +0 -53
- package/dist/telegram/index.js +0 -4
- package/dist/telegram/inline-buttons.js +0 -45
- package/dist/telegram/lane-delivery-state.js +0 -19
- package/dist/telegram/lane-delivery-text-deliverer.js +0 -357
- package/dist/telegram/lane-delivery.js +0 -2
- package/dist/telegram/model-buttons.js +0 -163
- package/dist/telegram/monitor.js +0 -179
- package/dist/telegram/network-config.js +0 -39
- package/dist/telegram/network-errors.js +0 -103
- package/dist/telegram/normalize.js +0 -37
- package/dist/telegram/onboarding.js +0 -192
- package/dist/telegram/outbound-adapter.js +0 -100
- package/dist/telegram/outbound-params.js +0 -21
- package/dist/telegram/pairing-store.js +0 -77
- package/dist/telegram/polling-session.js +0 -275
- package/dist/telegram/probe.js +0 -70
- package/dist/telegram/proxy.js +0 -10
- package/dist/telegram/reaction-level.js +0 -46
- package/dist/telegram/reasoning-lane-coordinator.js +0 -128
- package/dist/telegram/runtime.js +0 -3
- package/dist/telegram/send.js +0 -769
- package/dist/telegram/sendchataction-401-backoff.js +0 -71
- package/dist/telegram/sent-message-cache.js +0 -52
- package/dist/telegram/sequential-key.js +0 -46
- package/dist/telegram/status-issues.js +0 -105
- package/dist/telegram/status-reaction-variants.js +0 -208
- package/dist/telegram/sticker-cache.js +0 -204
- package/dist/telegram/target-writeback.js +0 -165
- package/dist/telegram/targets.js +0 -65
- package/dist/telegram/telegram-improvements.js +0 -220
- package/dist/telegram/thread-bindings.js +0 -560
- package/dist/telegram/token.js +0 -58
- package/dist/telegram/update-offset-store.js +0 -76
- package/dist/telegram/voice.js +0 -23
- package/dist/telegram/webhook-set.js +0 -28
- package/dist/telegram/webhook.js +0 -95
- package/dist/telemetry/alert-engine.js +0 -258
- package/dist/telemetry/cron-instrumentation.js +0 -49
- package/dist/telemetry/gateway-instrumentation.js +0 -80
- package/dist/telemetry/instrumentation.js +0 -66
- package/dist/telemetry/service.js +0 -345
- package/dist/terminal/ansi.js +0 -11
- package/dist/terminal/health-style.js +0 -36
- package/dist/terminal/links.js +0 -17
- package/dist/terminal/note.js +0 -79
- package/dist/terminal/palette.js +0 -14
- package/dist/terminal/progress-line.js +0 -18
- package/dist/terminal/prompt-select-styled.js +0 -9
- package/dist/terminal/prompt-style.js +0 -4
- package/dist/terminal/restore.js +0 -48
- package/dist/terminal/stream-writer.js +0 -49
- package/dist/terminal/table.js +0 -327
- package/dist/terminal/theme.js +0 -22
- package/dist/test-helpers/ssrf.js +0 -13
- package/dist/test-helpers/state-dir-env.js +0 -24
- package/dist/test-helpers/workspace.js +0 -11
- package/dist/test-utils/channel-plugins.js +0 -82
- package/dist/test-utils/command-runner.js +0 -6
- package/dist/test-utils/env.js +0 -72
- package/dist/test-utils/exec-assertions.js +0 -12
- package/dist/test-utils/fetch-mock.js +0 -5
- package/dist/test-utils/imessage-test-plugin.js +0 -54
- package/dist/test-utils/index.js +0 -219
- package/dist/test-utils/internal-hook-event-payload.js +0 -10
- package/dist/test-utils/mock-http-response.js +0 -17
- package/dist/test-utils/model-auth-mock.js +0 -12
- package/dist/test-utils/ports.js +0 -73
- package/dist/test-utils/provider-usage-fetch.js +0 -14
- package/dist/test-utils/temp-home.js +0 -33
- package/dist/test-utils/vitest-mock-fn.js +0 -1
- package/dist/tts/tts-core.js +0 -550
- package/dist/tts/tts.js +0 -683
- package/dist/tui/commands.js +0 -134
- package/dist/tui/components/assistant-message.js +0 -20
- package/dist/tui/components/chat-log.js +0 -128
- package/dist/tui/components/custom-editor.js +0 -61
- package/dist/tui/components/filterable-select-list.js +0 -105
- package/dist/tui/components/fuzzy-filter.js +0 -113
- package/dist/tui/components/hyperlink-markdown.js +0 -32
- package/dist/tui/components/searchable-select-list.js +0 -247
- package/dist/tui/components/selectors.js +0 -16
- package/dist/tui/components/tool-execution.js +0 -109
- package/dist/tui/components/user-message.js +0 -21
- package/dist/tui/gateway-chat.js +0 -148
- package/dist/tui/index.js +0 -611
- package/dist/tui/theme/syntax-theme.js +0 -49
- package/dist/tui/theme/theme-detection.js +0 -226
- package/dist/tui/theme/theme.js +0 -117
- package/dist/tui/tui-command-handlers.js +0 -455
- package/dist/tui/tui-event-handlers.js +0 -250
- package/dist/tui/tui-formatters.js +0 -159
- package/dist/tui/tui-local-shell.js +0 -109
- package/dist/tui/tui-overlays.js +0 -13
- package/dist/tui/tui-session-actions.js +0 -317
- package/dist/tui/tui-status-summary.js +0 -74
- package/dist/tui/tui-stream-assembler.js +0 -54
- package/dist/tui/tui-types.js +0 -1
- package/dist/tui/tui-waiting.js +0 -34
- package/dist/tui/tui.js +0 -750
- package/dist/tui/utils/ctrl-c-handler.js +0 -67
- package/dist/tui/utils/osc8-hyperlinks.js +0 -208
- package/dist/tui/utils/safe-stop.js +0 -180
- package/dist/tui/utils/session-key-utils.js +0 -81
- package/dist/tui/utils/text-sanitization.js +0 -284
- package/dist/ui-plugins/ui-plugins-improvements.js +0 -191
- package/dist/utils/account-id.js +0 -4
- package/dist/utils/boolean.js +0 -27
- package/dist/utils/chunk-items.js +0 -10
- package/dist/utils/delivery-context.js +0 -84
- package/dist/utils/directive-tags.js +0 -65
- package/dist/utils/fetch-timeout.js +0 -31
- package/dist/utils/lru-cache.js +0 -116
- package/dist/utils/mask-api-key.js +0 -10
- package/dist/utils/message-channel.js +0 -84
- package/dist/utils/normalize-secret-input.js +0 -19
- package/dist/utils/performance.js +0 -199
- package/dist/utils/provider-utils.js +0 -28
- package/dist/utils/queue-helpers.js +0 -150
- package/dist/utils/reaction-level.js +0 -52
- package/dist/utils/retry.js +0 -240
- package/dist/utils/run-with-concurrency.js +0 -39
- package/dist/utils/safe-json.js +0 -22
- package/dist/utils/shell-argv.js +0 -61
- package/dist/utils/time-format.js +0 -19
- package/dist/utils/transcript-tools.js +0 -58
- package/dist/utils/usage-format.js +0 -46
- package/dist/utils/with-timeout.js +0 -14
- package/dist/version.js +0 -69
- package/dist/web/accounts.js +0 -122
- package/dist/web/active-listener.js +0 -37
- package/dist/web/auth-store.js +0 -168
- package/dist/web/auto-reply/constants.js +0 -1
- package/dist/web/auto-reply/deliver-reply.js +0 -144
- package/dist/web/auto-reply/heartbeat-runner.js +0 -264
- package/dist/web/auto-reply/loggers.js +0 -5
- package/dist/web/auto-reply/mentions.js +0 -84
- package/dist/web/auto-reply/monitor/ack-reaction.js +0 -47
- package/dist/web/auto-reply/monitor/broadcast.js +0 -68
- package/dist/web/auto-reply/monitor/commands.js +0 -21
- package/dist/web/auto-reply/monitor/echo.js +0 -36
- package/dist/web/auto-reply/monitor/group-activation.js +0 -37
- package/dist/web/auto-reply/monitor/group-gating.js +0 -98
- package/dist/web/auto-reply/monitor/group-members.js +0 -60
- package/dist/web/auto-reply/monitor/last-route.js +0 -38
- package/dist/web/auto-reply/monitor/message-line.js +0 -35
- package/dist/web/auto-reply/monitor/on-message.js +0 -131
- package/dist/web/auto-reply/monitor/peer.js +0 -10
- package/dist/web/auto-reply/monitor/process-message.js +0 -337
- package/dist/web/auto-reply/monitor.js +0 -355
- package/dist/web/auto-reply/session-snapshot.js +0 -40
- package/dist/web/auto-reply/types.js +0 -1
- package/dist/web/auto-reply/util.js +0 -47
- package/dist/web/auto-reply.impl.js +0 -5
- package/dist/web/auto-reply.js +0 -1
- package/dist/web/inbound/access-control.js +0 -150
- package/dist/web/inbound/dedupe.js +0 -13
- package/dist/web/inbound/extract.js +0 -254
- package/dist/web/inbound/media.js +0 -61
- package/dist/web/inbound/monitor.js +0 -349
- package/dist/web/inbound/send-api.js +0 -91
- package/dist/web/inbound/types.js +0 -1
- package/dist/web/inbound.js +0 -3
- package/dist/web/login-qr.js +0 -233
- package/dist/web/login.js +0 -68
- package/dist/web/media.js +0 -344
- package/dist/web/outbound.js +0 -139
- package/dist/web/qr-image.js +0 -35
- package/dist/web/reconnect.js +0 -36
- package/dist/web/session.js +0 -224
- package/dist/web/vcard.js +0 -63
- package/dist/wizard/clack-prompter.js +0 -108
- package/dist/wizard/onboarding.completion.js +0 -74
- package/dist/wizard/onboarding.finalize.js +0 -354
- package/dist/wizard/onboarding.gateway-config.js +0 -188
- package/dist/wizard/onboarding.js +0 -376
- package/dist/wizard/onboarding.types.js +0 -1
- package/dist/wizard/session.js +0 -201
|
@@ -1,1669 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
import fs from "node:fs/promises";
|
|
3
|
-
import os from "node:os";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import readline from "node:readline";
|
|
6
|
-
import { resolveAgentWorkspaceDir } from "../agents/agent-scope.js";
|
|
7
|
-
import { resolveStateDir } from "../config/paths.js";
|
|
8
|
-
import { writeFileWithinRoot } from "../infra/fs-safe.js";
|
|
9
|
-
import { createSubsystemLogger } from "../logging/subsystem.js";
|
|
10
|
-
import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram, } from "../plugin-sdk/windows-spawn.js";
|
|
11
|
-
import { isFileMissingError, statRegularFile } from "./fs-utils.js";
|
|
12
|
-
import { deriveQmdScopeChannel, deriveQmdScopeChatType, isQmdScopeAllowed } from "./qmd-scope.js";
|
|
13
|
-
import { listSessionFilesForAgent, buildSessionEntry, } from "./session-files.js";
|
|
14
|
-
import { requireNodeSqlite } from "./sqlite.js";
|
|
15
|
-
import { parseQmdQueryJson } from "./qmd-query-parser.js";
|
|
16
|
-
import { extractKeywords } from "./query-expansion.js";
|
|
17
|
-
const log = createSubsystemLogger("memory");
|
|
18
|
-
const SNIPPET_HEADER_RE = /@@\s*-([0-9]+),([0-9]+)/;
|
|
19
|
-
const SEARCH_PENDING_UPDATE_WAIT_MS = 500;
|
|
20
|
-
const MAX_QMD_OUTPUT_CHARS = 200_000;
|
|
21
|
-
const NUL_MARKER_RE = /(?:\^@|\\0|\\x00|\\u0000|null\s*byte|nul\s*byte)/i;
|
|
22
|
-
const QMD_EMBED_BACKOFF_BASE_MS = 60_000;
|
|
23
|
-
const QMD_EMBED_BACKOFF_MAX_MS = 60 * 60 * 1000;
|
|
24
|
-
const HAN_SCRIPT_RE = /[\u3400-\u9fff]/u;
|
|
25
|
-
const QMD_BM25_HAN_KEYWORD_LIMIT = 12;
|
|
26
|
-
let qmdEmbedQueueTail = Promise.resolve();
|
|
27
|
-
function resolveWindowsCommandShim(command) {
|
|
28
|
-
if (process.platform !== "win32") {
|
|
29
|
-
return command;
|
|
30
|
-
}
|
|
31
|
-
const trimmed = command.trim();
|
|
32
|
-
if (!trimmed) {
|
|
33
|
-
return command;
|
|
34
|
-
}
|
|
35
|
-
const ext = path.extname(trimmed).toLowerCase();
|
|
36
|
-
if (ext === ".cmd" || ext === ".exe" || ext === ".bat") {
|
|
37
|
-
return command;
|
|
38
|
-
}
|
|
39
|
-
const base = path.basename(trimmed).toLowerCase();
|
|
40
|
-
if (base === "qmd" || base === "mcporter") {
|
|
41
|
-
return `${trimmed}.cmd`;
|
|
42
|
-
}
|
|
43
|
-
return command;
|
|
44
|
-
}
|
|
45
|
-
function resolveSpawnInvocation(params) {
|
|
46
|
-
const program = resolveWindowsSpawnProgram({
|
|
47
|
-
command: resolveWindowsCommandShim(params.command),
|
|
48
|
-
platform: process.platform,
|
|
49
|
-
env: params.env,
|
|
50
|
-
execPath: process.execPath,
|
|
51
|
-
packageName: params.packageName,
|
|
52
|
-
allowShellFallback: true,
|
|
53
|
-
});
|
|
54
|
-
return materializeWindowsSpawnProgram(program, params.args);
|
|
55
|
-
}
|
|
56
|
-
function hasHanScript(value) {
|
|
57
|
-
return HAN_SCRIPT_RE.test(value);
|
|
58
|
-
}
|
|
59
|
-
function normalizeHanBm25Query(query) {
|
|
60
|
-
const trimmed = query.trim();
|
|
61
|
-
if (!trimmed || !hasHanScript(trimmed)) {
|
|
62
|
-
return trimmed;
|
|
63
|
-
}
|
|
64
|
-
const keywords = extractKeywords(trimmed);
|
|
65
|
-
const normalizedKeywords = [];
|
|
66
|
-
const seen = new Set();
|
|
67
|
-
for (const keyword of keywords) {
|
|
68
|
-
const token = keyword.trim();
|
|
69
|
-
if (!token || seen.has(token)) {
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
const includesHan = hasHanScript(token);
|
|
73
|
-
// Han unigrams are usually too broad for BM25 and can drown signal.
|
|
74
|
-
if (includesHan && Array.from(token).length < 2) {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
if (!includesHan && token.length < 2) {
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
seen.add(token);
|
|
81
|
-
normalizedKeywords.push(token);
|
|
82
|
-
if (normalizedKeywords.length >= QMD_BM25_HAN_KEYWORD_LIMIT) {
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return normalizedKeywords.length > 0 ? normalizedKeywords.join(" ") : trimmed;
|
|
87
|
-
}
|
|
88
|
-
async function runWithQmdEmbedLock(task) {
|
|
89
|
-
const previous = qmdEmbedQueueTail;
|
|
90
|
-
let release;
|
|
91
|
-
qmdEmbedQueueTail = new Promise((resolve) => {
|
|
92
|
-
release = resolve;
|
|
93
|
-
});
|
|
94
|
-
await previous.catch(() => undefined);
|
|
95
|
-
try {
|
|
96
|
-
return await task();
|
|
97
|
-
}
|
|
98
|
-
finally {
|
|
99
|
-
release?.();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
export class QmdMemoryManager {
|
|
103
|
-
static async create(params) {
|
|
104
|
-
const resolved = params.resolved.qmd;
|
|
105
|
-
if (!resolved) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
const manager = new QmdMemoryManager({ cfg: params.cfg, agentId: params.agentId, resolved });
|
|
109
|
-
await manager.initialize(params.mode ?? "full");
|
|
110
|
-
return manager;
|
|
111
|
-
}
|
|
112
|
-
cfg;
|
|
113
|
-
agentId;
|
|
114
|
-
qmd;
|
|
115
|
-
workspaceDir;
|
|
116
|
-
stateDir;
|
|
117
|
-
agentStateDir;
|
|
118
|
-
qmdDir;
|
|
119
|
-
xdgConfigHome;
|
|
120
|
-
xdgCacheHome;
|
|
121
|
-
indexPath;
|
|
122
|
-
env;
|
|
123
|
-
managedCollectionNames;
|
|
124
|
-
collectionRoots = new Map();
|
|
125
|
-
sources = new Set();
|
|
126
|
-
docPathCache = new Map();
|
|
127
|
-
exportedSessionState = new Map();
|
|
128
|
-
maxQmdOutputChars = MAX_QMD_OUTPUT_CHARS;
|
|
129
|
-
sessionExporter;
|
|
130
|
-
updateTimer = null;
|
|
131
|
-
pendingUpdate = null;
|
|
132
|
-
queuedForcedUpdate = null;
|
|
133
|
-
queuedForcedRuns = 0;
|
|
134
|
-
closed = false;
|
|
135
|
-
db = null;
|
|
136
|
-
lastUpdateAt = null;
|
|
137
|
-
lastEmbedAt = null;
|
|
138
|
-
embedBackoffUntil = null;
|
|
139
|
-
embedFailureCount = 0;
|
|
140
|
-
attemptedNullByteCollectionRepair = false;
|
|
141
|
-
constructor(params) {
|
|
142
|
-
this.cfg = params.cfg;
|
|
143
|
-
this.agentId = params.agentId;
|
|
144
|
-
this.qmd = params.resolved;
|
|
145
|
-
this.workspaceDir = resolveAgentWorkspaceDir(params.cfg, params.agentId);
|
|
146
|
-
this.stateDir = resolveStateDir(process.env, os.homedir);
|
|
147
|
-
this.agentStateDir = path.join(this.stateDir, "agents", this.agentId);
|
|
148
|
-
this.qmdDir = path.join(this.agentStateDir, "qmd");
|
|
149
|
-
// QMD uses XDG base dirs for its internal state.
|
|
150
|
-
// Collections are managed via `qmd collection add` and stored inside the index DB.
|
|
151
|
-
// - config: $XDG_CONFIG_HOME (contexts, etc.)
|
|
152
|
-
// - cache: $XDG_CACHE_HOME/qmd/index.sqlite
|
|
153
|
-
this.xdgConfigHome = path.join(this.qmdDir, "xdg-config");
|
|
154
|
-
this.xdgCacheHome = path.join(this.qmdDir, "xdg-cache");
|
|
155
|
-
this.indexPath = path.join(this.xdgCacheHome, "qmd", "index.sqlite");
|
|
156
|
-
this.env = {
|
|
157
|
-
...process.env,
|
|
158
|
-
XDG_CONFIG_HOME: this.xdgConfigHome,
|
|
159
|
-
// workaround for upstream bug https://github.com/tobi/qmd/issues/132
|
|
160
|
-
// QMD doesn't respect XDG_CONFIG_HOME:
|
|
161
|
-
QMD_CONFIG_DIR: this.xdgConfigHome,
|
|
162
|
-
XDG_CACHE_HOME: this.xdgCacheHome,
|
|
163
|
-
NO_COLOR: "1",
|
|
164
|
-
};
|
|
165
|
-
this.sessionExporter = this.qmd.sessions.enabled
|
|
166
|
-
? {
|
|
167
|
-
dir: this.qmd.sessions.exportDir ?? path.join(this.qmdDir, "sessions"),
|
|
168
|
-
retentionMs: this.qmd.sessions.retentionDays
|
|
169
|
-
? this.qmd.sessions.retentionDays * 24 * 60 * 60 * 1000
|
|
170
|
-
: undefined,
|
|
171
|
-
collectionName: this.pickSessionCollectionName(),
|
|
172
|
-
}
|
|
173
|
-
: null;
|
|
174
|
-
if (this.sessionExporter) {
|
|
175
|
-
this.qmd.collections = [
|
|
176
|
-
...this.qmd.collections,
|
|
177
|
-
{
|
|
178
|
-
name: this.sessionExporter.collectionName,
|
|
179
|
-
path: this.sessionExporter.dir,
|
|
180
|
-
pattern: "**/*.md",
|
|
181
|
-
kind: "sessions",
|
|
182
|
-
},
|
|
183
|
-
];
|
|
184
|
-
}
|
|
185
|
-
this.managedCollectionNames = this.computeManagedCollectionNames();
|
|
186
|
-
}
|
|
187
|
-
async initialize(mode) {
|
|
188
|
-
this.bootstrapCollections();
|
|
189
|
-
if (mode === "status") {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
await fs.mkdir(this.xdgConfigHome, { recursive: true });
|
|
193
|
-
await fs.mkdir(this.xdgCacheHome, { recursive: true });
|
|
194
|
-
await fs.mkdir(path.dirname(this.indexPath), { recursive: true });
|
|
195
|
-
if (this.sessionExporter) {
|
|
196
|
-
await fs.mkdir(this.sessionExporter.dir, { recursive: true });
|
|
197
|
-
}
|
|
198
|
-
// QMD stores its ML models under $XDG_CACHE_HOME/qmd/models/. Because we
|
|
199
|
-
// override XDG_CACHE_HOME to isolate the index per-agent, qmd would not
|
|
200
|
-
// find models installed at the default location (~/.cache/qmd/models/) and
|
|
201
|
-
// would attempt to re-download them on every invocation. Symlink the
|
|
202
|
-
// default models directory into our custom cache so the index stays
|
|
203
|
-
// isolated while models are shared.
|
|
204
|
-
await this.symlinkSharedModels();
|
|
205
|
-
await this.ensureCollections();
|
|
206
|
-
if (this.qmd.update.onBoot) {
|
|
207
|
-
const bootRun = this.runUpdate("boot", true);
|
|
208
|
-
if (this.qmd.update.waitForBootSync) {
|
|
209
|
-
await bootRun.catch((err) => {
|
|
210
|
-
log.warn(`qmd boot update failed: ${String(err)}`);
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
void bootRun.catch((err) => {
|
|
215
|
-
log.warn(`qmd boot update failed: ${String(err)}`);
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
if (this.qmd.update.intervalMs > 0) {
|
|
220
|
-
this.updateTimer = setInterval(() => {
|
|
221
|
-
void this.runUpdate("interval").catch((err) => {
|
|
222
|
-
log.warn(`qmd update failed (${String(err)})`);
|
|
223
|
-
});
|
|
224
|
-
}, this.qmd.update.intervalMs);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
bootstrapCollections() {
|
|
228
|
-
this.collectionRoots.clear();
|
|
229
|
-
this.sources.clear();
|
|
230
|
-
for (const collection of this.qmd.collections) {
|
|
231
|
-
const kind = collection.kind === "sessions" ? "sessions" : "memory";
|
|
232
|
-
this.collectionRoots.set(collection.name, { path: collection.path, kind });
|
|
233
|
-
this.sources.add(kind);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
async ensureCollections() {
|
|
237
|
-
// QMD collections are persisted inside the index database and must be created
|
|
238
|
-
// via the CLI. Prefer listing existing collections when supported, otherwise
|
|
239
|
-
// fall back to best-effort idempotent `qmd collection add`.
|
|
240
|
-
const existing = new Map();
|
|
241
|
-
try {
|
|
242
|
-
const result = await this.runQmd(["collection", "list", "--json"], {
|
|
243
|
-
timeoutMs: this.qmd.update.commandTimeoutMs,
|
|
244
|
-
});
|
|
245
|
-
const parsed = this.parseListedCollections(result.stdout);
|
|
246
|
-
for (const [name, details] of parsed) {
|
|
247
|
-
existing.set(name, details);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
catch {
|
|
251
|
-
// ignore; older qmd versions might not support list --json.
|
|
252
|
-
}
|
|
253
|
-
await this.migrateLegacyUnscopedCollections(existing);
|
|
254
|
-
for (const collection of this.qmd.collections) {
|
|
255
|
-
const listed = existing.get(collection.name);
|
|
256
|
-
if (listed && !this.shouldRebindCollection(collection, listed)) {
|
|
257
|
-
continue;
|
|
258
|
-
}
|
|
259
|
-
if (listed) {
|
|
260
|
-
try {
|
|
261
|
-
await this.removeCollection(collection.name);
|
|
262
|
-
}
|
|
263
|
-
catch (err) {
|
|
264
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
265
|
-
if (!this.isCollectionMissingError(message)) {
|
|
266
|
-
log.warn(`qmd collection remove failed for ${collection.name}: ${message}`);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
try {
|
|
271
|
-
await this.ensureCollectionPath(collection);
|
|
272
|
-
await this.addCollection(collection.path, collection.name, collection.pattern);
|
|
273
|
-
}
|
|
274
|
-
catch (err) {
|
|
275
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
276
|
-
if (this.isCollectionAlreadyExistsError(message)) {
|
|
277
|
-
continue;
|
|
278
|
-
}
|
|
279
|
-
log.warn(`qmd collection add failed for ${collection.name}: ${message}`);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
async migrateLegacyUnscopedCollections(existing) {
|
|
284
|
-
for (const collection of this.qmd.collections) {
|
|
285
|
-
if (existing.has(collection.name)) {
|
|
286
|
-
continue;
|
|
287
|
-
}
|
|
288
|
-
const legacyName = this.deriveLegacyCollectionName(collection.name);
|
|
289
|
-
if (!legacyName) {
|
|
290
|
-
continue;
|
|
291
|
-
}
|
|
292
|
-
const listedLegacy = existing.get(legacyName);
|
|
293
|
-
if (!listedLegacy) {
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
296
|
-
if (!this.canMigrateLegacyCollection(collection, listedLegacy)) {
|
|
297
|
-
log.debug(`qmd legacy collection migration skipped for ${legacyName} (path/pattern mismatch)`);
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
try {
|
|
301
|
-
await this.removeCollection(legacyName);
|
|
302
|
-
existing.delete(legacyName);
|
|
303
|
-
}
|
|
304
|
-
catch (err) {
|
|
305
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
306
|
-
if (!this.isCollectionMissingError(message)) {
|
|
307
|
-
log.warn(`qmd collection remove failed for ${legacyName}: ${message}`);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
deriveLegacyCollectionName(scopedName) {
|
|
313
|
-
const agentSuffix = `-${this.sanitizeCollectionNameSegment(this.agentId)}`;
|
|
314
|
-
if (!scopedName.endsWith(agentSuffix)) {
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
317
|
-
const legacyName = scopedName.slice(0, -agentSuffix.length).trim();
|
|
318
|
-
return legacyName || null;
|
|
319
|
-
}
|
|
320
|
-
canMigrateLegacyCollection(collection, listedLegacy) {
|
|
321
|
-
if (listedLegacy.path && !this.pathsMatch(listedLegacy.path, collection.path)) {
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
if (typeof listedLegacy.pattern === "string" && listedLegacy.pattern !== collection.pattern) {
|
|
325
|
-
return false;
|
|
326
|
-
}
|
|
327
|
-
return true;
|
|
328
|
-
}
|
|
329
|
-
async ensureCollectionPath(collection) {
|
|
330
|
-
if (!this.isDirectoryGlobPattern(collection.pattern)) {
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
await fs.mkdir(collection.path, { recursive: true });
|
|
334
|
-
}
|
|
335
|
-
isDirectoryGlobPattern(pattern) {
|
|
336
|
-
return pattern.includes("*") || pattern.includes("?") || pattern.includes("[");
|
|
337
|
-
}
|
|
338
|
-
isCollectionAlreadyExistsError(message) {
|
|
339
|
-
const lower = message.toLowerCase();
|
|
340
|
-
return lower.includes("already exists") || lower.includes("exists");
|
|
341
|
-
}
|
|
342
|
-
isCollectionMissingError(message) {
|
|
343
|
-
const lower = message.toLowerCase();
|
|
344
|
-
return (lower.includes("not found") || lower.includes("does not exist") || lower.includes("missing"));
|
|
345
|
-
}
|
|
346
|
-
isMissingCollectionSearchError(err) {
|
|
347
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
348
|
-
return this.isCollectionMissingError(message) && message.toLowerCase().includes("collection");
|
|
349
|
-
}
|
|
350
|
-
async tryRepairMissingCollectionSearch(err) {
|
|
351
|
-
if (!this.isMissingCollectionSearchError(err)) {
|
|
352
|
-
return false;
|
|
353
|
-
}
|
|
354
|
-
log.warn("qmd search failed because a managed collection is missing; repairing collections and retrying once");
|
|
355
|
-
await this.ensureCollections();
|
|
356
|
-
return true;
|
|
357
|
-
}
|
|
358
|
-
async addCollection(pathArg, name, pattern) {
|
|
359
|
-
await this.runQmd(["collection", "add", pathArg, "--name", name, "--mask", pattern], {
|
|
360
|
-
timeoutMs: this.qmd.update.commandTimeoutMs,
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
async removeCollection(name) {
|
|
364
|
-
await this.runQmd(["collection", "remove", name], {
|
|
365
|
-
timeoutMs: this.qmd.update.commandTimeoutMs,
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
parseListedCollections(output) {
|
|
369
|
-
const listed = new Map();
|
|
370
|
-
const trimmed = output.trim();
|
|
371
|
-
if (!trimmed) {
|
|
372
|
-
return listed;
|
|
373
|
-
}
|
|
374
|
-
try {
|
|
375
|
-
const parsed = JSON.parse(trimmed);
|
|
376
|
-
if (Array.isArray(parsed)) {
|
|
377
|
-
for (const entry of parsed) {
|
|
378
|
-
if (typeof entry === "string") {
|
|
379
|
-
listed.set(entry, {});
|
|
380
|
-
continue;
|
|
381
|
-
}
|
|
382
|
-
if (!entry || typeof entry !== "object") {
|
|
383
|
-
continue;
|
|
384
|
-
}
|
|
385
|
-
const name = entry.name;
|
|
386
|
-
if (typeof name !== "string") {
|
|
387
|
-
continue;
|
|
388
|
-
}
|
|
389
|
-
const listedPath = entry.path;
|
|
390
|
-
const listedPattern = entry.pattern;
|
|
391
|
-
const listedMask = entry.mask;
|
|
392
|
-
listed.set(name, {
|
|
393
|
-
path: typeof listedPath === "string" ? listedPath : undefined,
|
|
394
|
-
pattern: typeof listedPattern === "string"
|
|
395
|
-
? listedPattern
|
|
396
|
-
: typeof listedMask === "string"
|
|
397
|
-
? listedMask
|
|
398
|
-
: undefined,
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
return listed;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
catch {
|
|
405
|
-
// Some qmd builds ignore `--json` and still print table output.
|
|
406
|
-
}
|
|
407
|
-
let currentName = null;
|
|
408
|
-
for (const rawLine of output.split(/\r?\n/)) {
|
|
409
|
-
const line = rawLine.trimEnd();
|
|
410
|
-
if (!line.trim()) {
|
|
411
|
-
currentName = null;
|
|
412
|
-
continue;
|
|
413
|
-
}
|
|
414
|
-
const collectionLine = /^\s*([a-z0-9._-]+)\s+\(qmd:\/\/[^)]+\)\s*$/i.exec(line);
|
|
415
|
-
if (collectionLine) {
|
|
416
|
-
currentName = collectionLine[1];
|
|
417
|
-
if (!listed.has(currentName)) {
|
|
418
|
-
listed.set(currentName, {});
|
|
419
|
-
}
|
|
420
|
-
continue;
|
|
421
|
-
}
|
|
422
|
-
if (/^\s*collections\b/i.test(line)) {
|
|
423
|
-
continue;
|
|
424
|
-
}
|
|
425
|
-
const bareNameLine = /^\s*([a-z0-9._-]+)\s*$/i.exec(line);
|
|
426
|
-
if (bareNameLine && !line.includes(":")) {
|
|
427
|
-
currentName = bareNameLine[1];
|
|
428
|
-
if (!listed.has(currentName)) {
|
|
429
|
-
listed.set(currentName, {});
|
|
430
|
-
}
|
|
431
|
-
continue;
|
|
432
|
-
}
|
|
433
|
-
if (!currentName) {
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
const patternLine = /^\s*(?:pattern|mask)\s*:\s*(.+?)\s*$/i.exec(line);
|
|
437
|
-
if (patternLine) {
|
|
438
|
-
const existing = listed.get(currentName) ?? {};
|
|
439
|
-
existing.pattern = patternLine[1].trim();
|
|
440
|
-
listed.set(currentName, existing);
|
|
441
|
-
continue;
|
|
442
|
-
}
|
|
443
|
-
const pathLine = /^\s*path\s*:\s*(.+?)\s*$/i.exec(line);
|
|
444
|
-
if (pathLine) {
|
|
445
|
-
const existing = listed.get(currentName) ?? {};
|
|
446
|
-
existing.path = pathLine[1].trim();
|
|
447
|
-
listed.set(currentName, existing);
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
return listed;
|
|
451
|
-
}
|
|
452
|
-
shouldRebindCollection(collection, listed) {
|
|
453
|
-
if (!listed.path) {
|
|
454
|
-
// Older qmd versions may only return names from `collection list --json`.
|
|
455
|
-
// Rebind managed collections so stale path bindings cannot survive upgrades.
|
|
456
|
-
return true;
|
|
457
|
-
}
|
|
458
|
-
if (!this.pathsMatch(listed.path, collection.path)) {
|
|
459
|
-
return true;
|
|
460
|
-
}
|
|
461
|
-
if (typeof listed.pattern === "string" && listed.pattern !== collection.pattern) {
|
|
462
|
-
return true;
|
|
463
|
-
}
|
|
464
|
-
return false;
|
|
465
|
-
}
|
|
466
|
-
pathsMatch(left, right) {
|
|
467
|
-
const normalize = (value) => {
|
|
468
|
-
const resolved = path.isAbsolute(value)
|
|
469
|
-
? path.resolve(value)
|
|
470
|
-
: path.resolve(this.workspaceDir, value);
|
|
471
|
-
const normalized = path.normalize(resolved);
|
|
472
|
-
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
473
|
-
};
|
|
474
|
-
return normalize(left) === normalize(right);
|
|
475
|
-
}
|
|
476
|
-
shouldRepairNullByteCollectionError(err) {
|
|
477
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
478
|
-
const lower = message.toLowerCase();
|
|
479
|
-
return ((lower.includes("enotdir") || lower.includes("not a directory")) &&
|
|
480
|
-
NUL_MARKER_RE.test(message));
|
|
481
|
-
}
|
|
482
|
-
async tryRepairNullByteCollections(err, reason) {
|
|
483
|
-
if (this.attemptedNullByteCollectionRepair) {
|
|
484
|
-
return false;
|
|
485
|
-
}
|
|
486
|
-
if (!this.shouldRepairNullByteCollectionError(err)) {
|
|
487
|
-
return false;
|
|
488
|
-
}
|
|
489
|
-
this.attemptedNullByteCollectionRepair = true;
|
|
490
|
-
log.warn(`qmd update failed with suspected null-byte collection metadata (${reason}); rebuilding managed collections and retrying once`);
|
|
491
|
-
for (const collection of this.qmd.collections) {
|
|
492
|
-
try {
|
|
493
|
-
await this.removeCollection(collection.name);
|
|
494
|
-
}
|
|
495
|
-
catch (removeErr) {
|
|
496
|
-
const removeMessage = removeErr instanceof Error ? removeErr.message : String(removeErr);
|
|
497
|
-
if (!this.isCollectionMissingError(removeMessage)) {
|
|
498
|
-
log.warn(`qmd collection remove failed for ${collection.name}: ${removeMessage}`);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
try {
|
|
502
|
-
await this.addCollection(collection.path, collection.name, collection.pattern);
|
|
503
|
-
}
|
|
504
|
-
catch (addErr) {
|
|
505
|
-
const addMessage = addErr instanceof Error ? addErr.message : String(addErr);
|
|
506
|
-
if (!this.isCollectionAlreadyExistsError(addMessage)) {
|
|
507
|
-
log.warn(`qmd collection add failed for ${collection.name}: ${addMessage}`);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
return true;
|
|
512
|
-
}
|
|
513
|
-
async search(query, opts) {
|
|
514
|
-
if (!this.isScopeAllowed(opts?.sessionKey)) {
|
|
515
|
-
this.logScopeDenied(opts?.sessionKey);
|
|
516
|
-
return [];
|
|
517
|
-
}
|
|
518
|
-
const trimmed = query.trim();
|
|
519
|
-
if (!trimmed) {
|
|
520
|
-
return [];
|
|
521
|
-
}
|
|
522
|
-
await this.waitForPendingUpdateBeforeSearch();
|
|
523
|
-
const limit = Math.min(this.qmd.limits.maxResults, opts?.maxResults ?? this.qmd.limits.maxResults);
|
|
524
|
-
const collectionNames = this.listManagedCollectionNames();
|
|
525
|
-
if (collectionNames.length === 0) {
|
|
526
|
-
log.warn("qmd query skipped: no managed collections configured");
|
|
527
|
-
return [];
|
|
528
|
-
}
|
|
529
|
-
const qmdSearchCommand = this.qmd.searchMode;
|
|
530
|
-
const mcporterEnabled = this.qmd.mcporter.enabled;
|
|
531
|
-
const runSearchAttempt = async (allowMissingCollectionRepair) => {
|
|
532
|
-
try {
|
|
533
|
-
if (mcporterEnabled) {
|
|
534
|
-
const tool = qmdSearchCommand === "search"
|
|
535
|
-
? "search"
|
|
536
|
-
: qmdSearchCommand === "vsearch"
|
|
537
|
-
? "vector_search"
|
|
538
|
-
: "deep_search";
|
|
539
|
-
const minScore = opts?.minScore ?? 0;
|
|
540
|
-
if (collectionNames.length > 1) {
|
|
541
|
-
return await this.runMcporterAcrossCollections({
|
|
542
|
-
tool,
|
|
543
|
-
query: trimmed,
|
|
544
|
-
limit,
|
|
545
|
-
minScore,
|
|
546
|
-
collectionNames,
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
return await this.runQmdSearchViaMcporter({
|
|
550
|
-
mcporter: this.qmd.mcporter,
|
|
551
|
-
tool,
|
|
552
|
-
query: trimmed,
|
|
553
|
-
limit,
|
|
554
|
-
minScore,
|
|
555
|
-
collection: collectionNames[0],
|
|
556
|
-
timeoutMs: this.qmd.limits.timeoutMs,
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
if (collectionNames.length > 1) {
|
|
560
|
-
return await this.runQueryAcrossCollections(trimmed, limit, collectionNames, qmdSearchCommand);
|
|
561
|
-
}
|
|
562
|
-
const args = this.buildSearchArgs(qmdSearchCommand, trimmed, limit);
|
|
563
|
-
args.push(...this.buildCollectionFilterArgs(collectionNames));
|
|
564
|
-
// Always scope to managed collections (default + custom). Even for `search`/`vsearch`,
|
|
565
|
-
// pass collection filters; if a given QMD build rejects these flags, we fall back to `query`.
|
|
566
|
-
const result = await this.runQmd(args, { timeoutMs: this.qmd.limits.timeoutMs });
|
|
567
|
-
return parseQmdQueryJson(result.stdout, result.stderr);
|
|
568
|
-
}
|
|
569
|
-
catch (err) {
|
|
570
|
-
if (allowMissingCollectionRepair && this.isMissingCollectionSearchError(err)) {
|
|
571
|
-
throw err;
|
|
572
|
-
}
|
|
573
|
-
if (!mcporterEnabled &&
|
|
574
|
-
qmdSearchCommand !== "query" &&
|
|
575
|
-
this.isUnsupportedQmdOptionError(err)) {
|
|
576
|
-
log.warn(`qmd ${qmdSearchCommand} does not support configured flags; retrying search with qmd query`);
|
|
577
|
-
try {
|
|
578
|
-
if (collectionNames.length > 1) {
|
|
579
|
-
return await this.runQueryAcrossCollections(trimmed, limit, collectionNames, "query");
|
|
580
|
-
}
|
|
581
|
-
const fallbackArgs = this.buildSearchArgs("query", trimmed, limit);
|
|
582
|
-
fallbackArgs.push(...this.buildCollectionFilterArgs(collectionNames));
|
|
583
|
-
const fallback = await this.runQmd(fallbackArgs, {
|
|
584
|
-
timeoutMs: this.qmd.limits.timeoutMs,
|
|
585
|
-
});
|
|
586
|
-
return parseQmdQueryJson(fallback.stdout, fallback.stderr);
|
|
587
|
-
}
|
|
588
|
-
catch (fallbackErr) {
|
|
589
|
-
log.warn(`qmd query fallback failed: ${String(fallbackErr)}`);
|
|
590
|
-
throw fallbackErr instanceof Error ? fallbackErr : new Error(String(fallbackErr));
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
const label = mcporterEnabled ? "mcporter/qmd" : `qmd ${qmdSearchCommand}`;
|
|
594
|
-
log.warn(`${label} failed: ${String(err)}`);
|
|
595
|
-
throw err instanceof Error ? err : new Error(String(err));
|
|
596
|
-
}
|
|
597
|
-
};
|
|
598
|
-
let parsed;
|
|
599
|
-
try {
|
|
600
|
-
parsed = await runSearchAttempt(true);
|
|
601
|
-
}
|
|
602
|
-
catch (err) {
|
|
603
|
-
if (!(await this.tryRepairMissingCollectionSearch(err))) {
|
|
604
|
-
throw err instanceof Error ? err : new Error(String(err));
|
|
605
|
-
}
|
|
606
|
-
parsed = await runSearchAttempt(false);
|
|
607
|
-
}
|
|
608
|
-
const results = [];
|
|
609
|
-
for (const entry of parsed) {
|
|
610
|
-
const doc = await this.resolveDocLocation(entry.docid, {
|
|
611
|
-
preferredCollection: entry.collection,
|
|
612
|
-
preferredFile: entry.file,
|
|
613
|
-
});
|
|
614
|
-
if (!doc) {
|
|
615
|
-
continue;
|
|
616
|
-
}
|
|
617
|
-
const snippet = entry.snippet?.slice(0, this.qmd.limits.maxSnippetChars) ?? "";
|
|
618
|
-
const lines = this.extractSnippetLines(snippet);
|
|
619
|
-
const score = typeof entry.score === "number" ? entry.score : 0;
|
|
620
|
-
const minScore = opts?.minScore ?? 0;
|
|
621
|
-
if (score < minScore) {
|
|
622
|
-
continue;
|
|
623
|
-
}
|
|
624
|
-
results.push({
|
|
625
|
-
path: doc.rel,
|
|
626
|
-
startLine: lines.startLine,
|
|
627
|
-
endLine: lines.endLine,
|
|
628
|
-
score,
|
|
629
|
-
snippet,
|
|
630
|
-
source: doc.source,
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
return this.clampResultsByInjectedChars(this.diversifyResultsBySource(results, limit));
|
|
634
|
-
}
|
|
635
|
-
async sync(params) {
|
|
636
|
-
if (params?.progress) {
|
|
637
|
-
params.progress({ completed: 0, total: 1, label: "Updating QMD index…" });
|
|
638
|
-
}
|
|
639
|
-
await this.runUpdate(params?.reason ?? "manual", params?.force);
|
|
640
|
-
if (params?.progress) {
|
|
641
|
-
params.progress({ completed: 1, total: 1, label: "QMD index updated" });
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
async readFile(params) {
|
|
645
|
-
const relPath = params.relPath?.trim();
|
|
646
|
-
if (!relPath) {
|
|
647
|
-
throw new Error("path required");
|
|
648
|
-
}
|
|
649
|
-
const absPath = this.resolveReadPath(relPath);
|
|
650
|
-
if (!absPath.endsWith(".md")) {
|
|
651
|
-
throw new Error("path required");
|
|
652
|
-
}
|
|
653
|
-
const statResult = await statRegularFile(absPath);
|
|
654
|
-
if (statResult.missing) {
|
|
655
|
-
return { text: "", path: relPath };
|
|
656
|
-
}
|
|
657
|
-
if (params.from !== undefined || params.lines !== undefined) {
|
|
658
|
-
const partial = await this.readPartialText(absPath, params.from, params.lines);
|
|
659
|
-
if (partial.missing) {
|
|
660
|
-
return { text: "", path: relPath };
|
|
661
|
-
}
|
|
662
|
-
return { text: partial.text, path: relPath };
|
|
663
|
-
}
|
|
664
|
-
const full = await this.readFullText(absPath);
|
|
665
|
-
if (full.missing) {
|
|
666
|
-
return { text: "", path: relPath };
|
|
667
|
-
}
|
|
668
|
-
if (!params.from && !params.lines) {
|
|
669
|
-
return { text: full.text, path: relPath };
|
|
670
|
-
}
|
|
671
|
-
const lines = full.text.split("\n");
|
|
672
|
-
const start = Math.max(1, params.from ?? 1);
|
|
673
|
-
const count = Math.max(1, params.lines ?? lines.length);
|
|
674
|
-
const slice = lines.slice(start - 1, start - 1 + count);
|
|
675
|
-
return { text: slice.join("\n"), path: relPath };
|
|
676
|
-
}
|
|
677
|
-
status() {
|
|
678
|
-
const counts = this.readCounts();
|
|
679
|
-
return {
|
|
680
|
-
backend: "qmd",
|
|
681
|
-
provider: "qmd",
|
|
682
|
-
model: "qmd",
|
|
683
|
-
requestedProvider: "qmd",
|
|
684
|
-
files: counts.totalDocuments,
|
|
685
|
-
chunks: counts.totalDocuments,
|
|
686
|
-
dirty: false,
|
|
687
|
-
workspaceDir: this.workspaceDir,
|
|
688
|
-
dbPath: this.indexPath,
|
|
689
|
-
sources: Array.from(this.sources),
|
|
690
|
-
sourceCounts: counts.sourceCounts,
|
|
691
|
-
vector: { enabled: true, available: true },
|
|
692
|
-
batch: {
|
|
693
|
-
enabled: false,
|
|
694
|
-
failures: 0,
|
|
695
|
-
limit: 0,
|
|
696
|
-
wait: false,
|
|
697
|
-
concurrency: 0,
|
|
698
|
-
pollIntervalMs: 0,
|
|
699
|
-
timeoutMs: 0,
|
|
700
|
-
},
|
|
701
|
-
custom: {
|
|
702
|
-
qmd: {
|
|
703
|
-
collections: this.qmd.collections.length,
|
|
704
|
-
lastUpdateAt: this.lastUpdateAt,
|
|
705
|
-
},
|
|
706
|
-
},
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
async probeEmbeddingAvailability() {
|
|
710
|
-
return { ok: true };
|
|
711
|
-
}
|
|
712
|
-
async probeVectorAvailability() {
|
|
713
|
-
return true;
|
|
714
|
-
}
|
|
715
|
-
async close() {
|
|
716
|
-
if (this.closed) {
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
this.closed = true;
|
|
720
|
-
if (this.updateTimer) {
|
|
721
|
-
clearInterval(this.updateTimer);
|
|
722
|
-
this.updateTimer = null;
|
|
723
|
-
}
|
|
724
|
-
this.queuedForcedRuns = 0;
|
|
725
|
-
await this.pendingUpdate?.catch(() => undefined);
|
|
726
|
-
await this.queuedForcedUpdate?.catch(() => undefined);
|
|
727
|
-
if (this.db) {
|
|
728
|
-
this.db.close();
|
|
729
|
-
this.db = null;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
async runUpdate(reason, force, opts) {
|
|
733
|
-
if (this.closed) {
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
if (this.pendingUpdate) {
|
|
737
|
-
if (force) {
|
|
738
|
-
return this.enqueueForcedUpdate(reason);
|
|
739
|
-
}
|
|
740
|
-
return this.pendingUpdate;
|
|
741
|
-
}
|
|
742
|
-
if (this.queuedForcedUpdate && !opts?.fromForcedQueue) {
|
|
743
|
-
if (force) {
|
|
744
|
-
return this.enqueueForcedUpdate(reason);
|
|
745
|
-
}
|
|
746
|
-
return this.queuedForcedUpdate;
|
|
747
|
-
}
|
|
748
|
-
if (this.shouldSkipUpdate(force)) {
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
const run = async () => {
|
|
752
|
-
if (this.sessionExporter) {
|
|
753
|
-
await this.exportSessions();
|
|
754
|
-
}
|
|
755
|
-
await this.runQmdUpdateWithRetry(reason);
|
|
756
|
-
if (this.shouldRunEmbed(force)) {
|
|
757
|
-
try {
|
|
758
|
-
await runWithQmdEmbedLock(async () => {
|
|
759
|
-
await this.runQmd(["embed"], {
|
|
760
|
-
timeoutMs: this.qmd.update.embedTimeoutMs,
|
|
761
|
-
discardOutput: true,
|
|
762
|
-
});
|
|
763
|
-
});
|
|
764
|
-
this.lastEmbedAt = Date.now();
|
|
765
|
-
this.embedBackoffUntil = null;
|
|
766
|
-
this.embedFailureCount = 0;
|
|
767
|
-
}
|
|
768
|
-
catch (err) {
|
|
769
|
-
this.noteEmbedFailure(reason, err);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
this.lastUpdateAt = Date.now();
|
|
773
|
-
this.docPathCache.clear();
|
|
774
|
-
};
|
|
775
|
-
this.pendingUpdate = run().finally(() => {
|
|
776
|
-
this.pendingUpdate = null;
|
|
777
|
-
});
|
|
778
|
-
await this.pendingUpdate;
|
|
779
|
-
}
|
|
780
|
-
async runQmdUpdateWithRetry(reason) {
|
|
781
|
-
const isBootRun = reason === "boot" || reason.startsWith("boot:");
|
|
782
|
-
const maxAttempts = isBootRun ? 3 : 1;
|
|
783
|
-
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
784
|
-
try {
|
|
785
|
-
await this.runQmdUpdateOnce(reason);
|
|
786
|
-
return;
|
|
787
|
-
}
|
|
788
|
-
catch (err) {
|
|
789
|
-
if (attempt >= maxAttempts || !this.isRetryableUpdateError(err)) {
|
|
790
|
-
throw err;
|
|
791
|
-
}
|
|
792
|
-
const delayMs = 500 * 2 ** (attempt - 1);
|
|
793
|
-
log.warn(`qmd update retry ${attempt}/${maxAttempts - 1} after failure (${reason}): ${String(err)}`);
|
|
794
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
async runQmdUpdateOnce(reason) {
|
|
799
|
-
try {
|
|
800
|
-
await this.runQmd(["update"], {
|
|
801
|
-
timeoutMs: this.qmd.update.updateTimeoutMs,
|
|
802
|
-
discardOutput: true,
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
catch (err) {
|
|
806
|
-
if (!(await this.tryRepairNullByteCollections(err, reason))) {
|
|
807
|
-
throw err;
|
|
808
|
-
}
|
|
809
|
-
await this.runQmd(["update"], {
|
|
810
|
-
timeoutMs: this.qmd.update.updateTimeoutMs,
|
|
811
|
-
discardOutput: true,
|
|
812
|
-
});
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
isRetryableUpdateError(err) {
|
|
816
|
-
if (this.isSqliteBusyError(err)) {
|
|
817
|
-
return true;
|
|
818
|
-
}
|
|
819
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
820
|
-
const normalized = message.toLowerCase();
|
|
821
|
-
return normalized.includes("timed out");
|
|
822
|
-
}
|
|
823
|
-
shouldRunEmbed(force) {
|
|
824
|
-
if (this.qmd.searchMode === "search") {
|
|
825
|
-
return false;
|
|
826
|
-
}
|
|
827
|
-
const now = Date.now();
|
|
828
|
-
if (this.embedBackoffUntil !== null && now < this.embedBackoffUntil) {
|
|
829
|
-
return false;
|
|
830
|
-
}
|
|
831
|
-
const embedIntervalMs = this.qmd.update.embedIntervalMs;
|
|
832
|
-
return (Boolean(force) ||
|
|
833
|
-
this.lastEmbedAt === null ||
|
|
834
|
-
(embedIntervalMs > 0 && now - this.lastEmbedAt > embedIntervalMs));
|
|
835
|
-
}
|
|
836
|
-
noteEmbedFailure(reason, err) {
|
|
837
|
-
this.embedFailureCount += 1;
|
|
838
|
-
const delayMs = Math.min(QMD_EMBED_BACKOFF_MAX_MS, QMD_EMBED_BACKOFF_BASE_MS * 2 ** Math.max(0, this.embedFailureCount - 1));
|
|
839
|
-
this.embedBackoffUntil = Date.now() + delayMs;
|
|
840
|
-
log.warn(`qmd embed failed (${reason}): ${String(err)}; backing off for ${Math.ceil(delayMs / 1000)}s`);
|
|
841
|
-
}
|
|
842
|
-
enqueueForcedUpdate(reason) {
|
|
843
|
-
this.queuedForcedRuns += 1;
|
|
844
|
-
if (!this.queuedForcedUpdate) {
|
|
845
|
-
this.queuedForcedUpdate = this.drainForcedUpdates(reason).finally(() => {
|
|
846
|
-
this.queuedForcedUpdate = null;
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
return this.queuedForcedUpdate;
|
|
850
|
-
}
|
|
851
|
-
async drainForcedUpdates(reason) {
|
|
852
|
-
await this.pendingUpdate?.catch(() => undefined);
|
|
853
|
-
while (!this.closed && this.queuedForcedRuns > 0) {
|
|
854
|
-
this.queuedForcedRuns -= 1;
|
|
855
|
-
await this.runUpdate(`${reason}:queued`, true, { fromForcedQueue: true });
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
/**
|
|
859
|
-
* Symlink the default QMD models directory into our custom XDG_CACHE_HOME so
|
|
860
|
-
* that the pre-installed ML models (~/.cache/qmd/models/) are reused rather
|
|
861
|
-
* than re-downloaded for every agent. If the default models directory does
|
|
862
|
-
* not exist, or a models directory/symlink already exists in the target, this
|
|
863
|
-
* is a no-op.
|
|
864
|
-
*/
|
|
865
|
-
async symlinkSharedModels() {
|
|
866
|
-
// process.env is never modified — only this.env (passed to child_process
|
|
867
|
-
// spawn) overrides XDG_CACHE_HOME. So reading it here gives us the
|
|
868
|
-
// user's original value, which is where `qmd` downloaded its models.
|
|
869
|
-
//
|
|
870
|
-
// On Windows, well-behaved apps (including Rust `dirs` / Go os.UserCacheDir)
|
|
871
|
-
// store caches under %LOCALAPPDATA% rather than ~/.cache. Fall back to
|
|
872
|
-
// LOCALAPPDATA when XDG_CACHE_HOME is not set on Windows.
|
|
873
|
-
const defaultCacheHome = process.env.XDG_CACHE_HOME ||
|
|
874
|
-
(process.platform === "win32" ? process.env.LOCALAPPDATA : undefined) ||
|
|
875
|
-
path.join(os.homedir(), ".cache");
|
|
876
|
-
const defaultModelsDir = path.join(defaultCacheHome, "qmd", "models");
|
|
877
|
-
const targetModelsDir = path.join(this.xdgCacheHome, "qmd", "models");
|
|
878
|
-
try {
|
|
879
|
-
// Check if the default models directory exists.
|
|
880
|
-
// Missing path is normal on first run and should be silent.
|
|
881
|
-
const stat = await fs.stat(defaultModelsDir).catch((err) => {
|
|
882
|
-
if (err.code === "ENOENT") {
|
|
883
|
-
return null;
|
|
884
|
-
}
|
|
885
|
-
throw err;
|
|
886
|
-
});
|
|
887
|
-
if (!stat?.isDirectory()) {
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
// Check if something already exists at the target path
|
|
891
|
-
try {
|
|
892
|
-
await fs.lstat(targetModelsDir);
|
|
893
|
-
// Already exists (directory, symlink, or file) – leave it alone
|
|
894
|
-
return;
|
|
895
|
-
}
|
|
896
|
-
catch {
|
|
897
|
-
// Does not exist – proceed to create symlink
|
|
898
|
-
}
|
|
899
|
-
// On Windows, creating directory symlinks requires either Administrator
|
|
900
|
-
// privileges or Developer Mode. Fall back to a directory junction which
|
|
901
|
-
// works without elevated privileges (junctions are always absolute-path,
|
|
902
|
-
// which is fine here since both paths are already absolute).
|
|
903
|
-
try {
|
|
904
|
-
await fs.symlink(defaultModelsDir, targetModelsDir, "dir");
|
|
905
|
-
}
|
|
906
|
-
catch (symlinkErr) {
|
|
907
|
-
const code = symlinkErr.code;
|
|
908
|
-
if (process.platform === "win32" && (code === "EPERM" || code === "ENOTSUP")) {
|
|
909
|
-
await fs.symlink(defaultModelsDir, targetModelsDir, "junction");
|
|
910
|
-
}
|
|
911
|
-
else {
|
|
912
|
-
throw symlinkErr;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
log.debug(`symlinked qmd models: ${defaultModelsDir} → ${targetModelsDir}`);
|
|
916
|
-
}
|
|
917
|
-
catch (err) {
|
|
918
|
-
// Non-fatal: if we can't symlink, qmd will fall back to downloading
|
|
919
|
-
log.warn(`failed to symlink qmd models directory: ${String(err)}`);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
async runQmd(args, opts) {
|
|
923
|
-
return await new Promise((resolve, reject) => {
|
|
924
|
-
const spawnInvocation = resolveSpawnInvocation({
|
|
925
|
-
command: this.qmd.command,
|
|
926
|
-
args,
|
|
927
|
-
env: this.env,
|
|
928
|
-
packageName: "qmd",
|
|
929
|
-
});
|
|
930
|
-
const child = spawn(spawnInvocation.command, spawnInvocation.argv, {
|
|
931
|
-
env: this.env,
|
|
932
|
-
cwd: this.workspaceDir,
|
|
933
|
-
shell: spawnInvocation.shell,
|
|
934
|
-
windowsHide: spawnInvocation.windowsHide,
|
|
935
|
-
});
|
|
936
|
-
let stdout = "";
|
|
937
|
-
let stderr = "";
|
|
938
|
-
let stdoutTruncated = false;
|
|
939
|
-
let stderrTruncated = false;
|
|
940
|
-
// When discardOutput is set, skip stdout accumulation entirely and keep
|
|
941
|
-
// only a small stderr tail for diagnostics -- never fail on truncation.
|
|
942
|
-
// This prevents large `qmd update` runs from hitting the output cap.
|
|
943
|
-
const discard = opts?.discardOutput === true;
|
|
944
|
-
const timer = opts?.timeoutMs
|
|
945
|
-
? setTimeout(() => {
|
|
946
|
-
child.kill("SIGKILL");
|
|
947
|
-
reject(new Error(`qmd ${args.join(" ")} timed out after ${opts.timeoutMs}ms`));
|
|
948
|
-
}, opts.timeoutMs)
|
|
949
|
-
: null;
|
|
950
|
-
child.stdout.on("data", (data) => {
|
|
951
|
-
if (discard) {
|
|
952
|
-
return; // drain without accumulating
|
|
953
|
-
}
|
|
954
|
-
const next = appendOutputWithCap(stdout, data.toString("utf8"), this.maxQmdOutputChars);
|
|
955
|
-
stdout = next.text;
|
|
956
|
-
stdoutTruncated = stdoutTruncated || next.truncated;
|
|
957
|
-
});
|
|
958
|
-
child.stderr.on("data", (data) => {
|
|
959
|
-
const next = appendOutputWithCap(stderr, data.toString("utf8"), this.maxQmdOutputChars);
|
|
960
|
-
stderr = next.text;
|
|
961
|
-
stderrTruncated = stderrTruncated || next.truncated;
|
|
962
|
-
});
|
|
963
|
-
child.on("error", (err) => {
|
|
964
|
-
if (timer) {
|
|
965
|
-
clearTimeout(timer);
|
|
966
|
-
}
|
|
967
|
-
reject(err);
|
|
968
|
-
});
|
|
969
|
-
child.on("close", (code) => {
|
|
970
|
-
if (timer) {
|
|
971
|
-
clearTimeout(timer);
|
|
972
|
-
}
|
|
973
|
-
if (!discard && (stdoutTruncated || stderrTruncated)) {
|
|
974
|
-
reject(new Error(`qmd ${args.join(" ")} produced too much output (limit ${this.maxQmdOutputChars} chars)`));
|
|
975
|
-
return;
|
|
976
|
-
}
|
|
977
|
-
if (code === 0) {
|
|
978
|
-
resolve({ stdout, stderr });
|
|
979
|
-
}
|
|
980
|
-
else {
|
|
981
|
-
reject(new Error(`qmd ${args.join(" ")} failed (code ${code}): ${stderr || stdout}`));
|
|
982
|
-
}
|
|
983
|
-
});
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
async ensureMcporterDaemonStarted(mcporter) {
|
|
987
|
-
if (!mcporter.enabled) {
|
|
988
|
-
return;
|
|
989
|
-
}
|
|
990
|
-
if (!mcporter.startDaemon) {
|
|
991
|
-
const g = globalThis;
|
|
992
|
-
if (!g.__poolbotMcporterColdStartWarned) {
|
|
993
|
-
g.__poolbotMcporterColdStartWarned = true;
|
|
994
|
-
log.warn("mcporter qmd bridge enabled but startDaemon=false; each query may cold-start QMD MCP. Consider setting memory.qmd.mcporter.startDaemon=true to keep it warm.");
|
|
995
|
-
}
|
|
996
|
-
return;
|
|
997
|
-
}
|
|
998
|
-
const g = globalThis;
|
|
999
|
-
if (!g.__poolbotMcporterDaemonStart) {
|
|
1000
|
-
g.__poolbotMcporterDaemonStart = (async () => {
|
|
1001
|
-
try {
|
|
1002
|
-
await this.runMcporter(["daemon", "start"], { timeoutMs: 10_000 });
|
|
1003
|
-
}
|
|
1004
|
-
catch (err) {
|
|
1005
|
-
log.warn(`mcporter daemon start failed: ${String(err)}`);
|
|
1006
|
-
// Allow future searches to retry daemon start on transient failures.
|
|
1007
|
-
delete g.__poolbotMcporterDaemonStart;
|
|
1008
|
-
}
|
|
1009
|
-
})();
|
|
1010
|
-
}
|
|
1011
|
-
await g.__poolbotMcporterDaemonStart;
|
|
1012
|
-
}
|
|
1013
|
-
async runMcporter(args, opts) {
|
|
1014
|
-
return await new Promise((resolve, reject) => {
|
|
1015
|
-
const spawnInvocation = resolveSpawnInvocation({
|
|
1016
|
-
command: "mcporter",
|
|
1017
|
-
args,
|
|
1018
|
-
env: this.env,
|
|
1019
|
-
packageName: "mcporter",
|
|
1020
|
-
});
|
|
1021
|
-
const child = spawn(spawnInvocation.command, spawnInvocation.argv, {
|
|
1022
|
-
// Keep mcporter and direct qmd commands on the same agent-scoped XDG state.
|
|
1023
|
-
env: this.env,
|
|
1024
|
-
cwd: this.workspaceDir,
|
|
1025
|
-
shell: spawnInvocation.shell,
|
|
1026
|
-
windowsHide: spawnInvocation.windowsHide,
|
|
1027
|
-
});
|
|
1028
|
-
let stdout = "";
|
|
1029
|
-
let stderr = "";
|
|
1030
|
-
let stdoutTruncated = false;
|
|
1031
|
-
let stderrTruncated = false;
|
|
1032
|
-
const timer = opts?.timeoutMs
|
|
1033
|
-
? setTimeout(() => {
|
|
1034
|
-
child.kill("SIGKILL");
|
|
1035
|
-
reject(new Error(`mcporter ${args.join(" ")} timed out after ${opts.timeoutMs}ms`));
|
|
1036
|
-
}, opts.timeoutMs)
|
|
1037
|
-
: null;
|
|
1038
|
-
child.stdout.on("data", (data) => {
|
|
1039
|
-
const next = appendOutputWithCap(stdout, data.toString("utf8"), this.maxQmdOutputChars);
|
|
1040
|
-
stdout = next.text;
|
|
1041
|
-
stdoutTruncated = stdoutTruncated || next.truncated;
|
|
1042
|
-
});
|
|
1043
|
-
child.stderr.on("data", (data) => {
|
|
1044
|
-
const next = appendOutputWithCap(stderr, data.toString("utf8"), this.maxQmdOutputChars);
|
|
1045
|
-
stderr = next.text;
|
|
1046
|
-
stderrTruncated = stderrTruncated || next.truncated;
|
|
1047
|
-
});
|
|
1048
|
-
child.on("error", (err) => {
|
|
1049
|
-
if (timer) {
|
|
1050
|
-
clearTimeout(timer);
|
|
1051
|
-
}
|
|
1052
|
-
reject(err);
|
|
1053
|
-
});
|
|
1054
|
-
child.on("close", (code) => {
|
|
1055
|
-
if (timer) {
|
|
1056
|
-
clearTimeout(timer);
|
|
1057
|
-
}
|
|
1058
|
-
if (stdoutTruncated || stderrTruncated) {
|
|
1059
|
-
reject(new Error(`mcporter ${args.join(" ")} produced too much output (limit ${this.maxQmdOutputChars} chars)`));
|
|
1060
|
-
return;
|
|
1061
|
-
}
|
|
1062
|
-
if (code === 0) {
|
|
1063
|
-
resolve({ stdout, stderr });
|
|
1064
|
-
}
|
|
1065
|
-
else {
|
|
1066
|
-
reject(new Error(`mcporter ${args.join(" ")} failed (code ${code}): ${stderr || stdout}`));
|
|
1067
|
-
}
|
|
1068
|
-
});
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
async runQmdSearchViaMcporter(params) {
|
|
1072
|
-
await this.ensureMcporterDaemonStarted(params.mcporter);
|
|
1073
|
-
const selector = `${params.mcporter.serverName}.${params.tool}`;
|
|
1074
|
-
const callArgs = {
|
|
1075
|
-
query: params.query,
|
|
1076
|
-
limit: params.limit,
|
|
1077
|
-
minScore: params.minScore,
|
|
1078
|
-
};
|
|
1079
|
-
if (params.collection) {
|
|
1080
|
-
callArgs.collection = params.collection;
|
|
1081
|
-
}
|
|
1082
|
-
const result = await this.runMcporter([
|
|
1083
|
-
"call",
|
|
1084
|
-
selector,
|
|
1085
|
-
"--args",
|
|
1086
|
-
JSON.stringify(callArgs),
|
|
1087
|
-
"--output",
|
|
1088
|
-
"json",
|
|
1089
|
-
"--timeout",
|
|
1090
|
-
String(Math.max(0, params.timeoutMs)),
|
|
1091
|
-
], { timeoutMs: Math.max(params.timeoutMs + 2_000, 5_000) });
|
|
1092
|
-
const parsedUnknown = JSON.parse(result.stdout);
|
|
1093
|
-
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1094
|
-
const structured = isRecord(parsedUnknown) && isRecord(parsedUnknown.structuredContent)
|
|
1095
|
-
? parsedUnknown.structuredContent
|
|
1096
|
-
: parsedUnknown;
|
|
1097
|
-
const results = isRecord(structured) && Array.isArray(structured.results)
|
|
1098
|
-
? structured.results
|
|
1099
|
-
: Array.isArray(structured)
|
|
1100
|
-
? structured
|
|
1101
|
-
: [];
|
|
1102
|
-
const out = [];
|
|
1103
|
-
for (const item of results) {
|
|
1104
|
-
if (!isRecord(item)) {
|
|
1105
|
-
continue;
|
|
1106
|
-
}
|
|
1107
|
-
const docidRaw = item.docid;
|
|
1108
|
-
const docid = typeof docidRaw === "string" ? docidRaw.replace(/^#/, "").trim() : "";
|
|
1109
|
-
if (!docid) {
|
|
1110
|
-
continue;
|
|
1111
|
-
}
|
|
1112
|
-
const scoreRaw = item.score;
|
|
1113
|
-
const score = typeof scoreRaw === "number" ? scoreRaw : Number(scoreRaw);
|
|
1114
|
-
const snippet = typeof item.snippet === "string" ? item.snippet : "";
|
|
1115
|
-
out.push({ docid, score: Number.isFinite(score) ? score : 0, snippet });
|
|
1116
|
-
}
|
|
1117
|
-
return out;
|
|
1118
|
-
}
|
|
1119
|
-
async readPartialText(absPath, from, lines) {
|
|
1120
|
-
const start = Math.max(1, from ?? 1);
|
|
1121
|
-
const count = Math.max(1, lines ?? Number.POSITIVE_INFINITY);
|
|
1122
|
-
let handle;
|
|
1123
|
-
try {
|
|
1124
|
-
handle = await fs.open(absPath);
|
|
1125
|
-
}
|
|
1126
|
-
catch (err) {
|
|
1127
|
-
if (isFileMissingError(err)) {
|
|
1128
|
-
return { missing: true };
|
|
1129
|
-
}
|
|
1130
|
-
throw err;
|
|
1131
|
-
}
|
|
1132
|
-
const stream = handle.createReadStream({ encoding: "utf-8" });
|
|
1133
|
-
const rl = readline.createInterface({
|
|
1134
|
-
input: stream,
|
|
1135
|
-
crlfDelay: Infinity,
|
|
1136
|
-
});
|
|
1137
|
-
const selected = [];
|
|
1138
|
-
let index = 0;
|
|
1139
|
-
try {
|
|
1140
|
-
for await (const line of rl) {
|
|
1141
|
-
index += 1;
|
|
1142
|
-
if (index < start) {
|
|
1143
|
-
continue;
|
|
1144
|
-
}
|
|
1145
|
-
if (selected.length >= count) {
|
|
1146
|
-
break;
|
|
1147
|
-
}
|
|
1148
|
-
selected.push(line);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
finally {
|
|
1152
|
-
rl.close();
|
|
1153
|
-
await handle.close();
|
|
1154
|
-
}
|
|
1155
|
-
return { missing: false, text: selected.slice(0, count).join("\n") };
|
|
1156
|
-
}
|
|
1157
|
-
async readFullText(absPath) {
|
|
1158
|
-
try {
|
|
1159
|
-
const text = await fs.readFile(absPath, "utf-8");
|
|
1160
|
-
return { missing: false, text };
|
|
1161
|
-
}
|
|
1162
|
-
catch (err) {
|
|
1163
|
-
if (isFileMissingError(err)) {
|
|
1164
|
-
return { missing: true };
|
|
1165
|
-
}
|
|
1166
|
-
throw err;
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
ensureDb() {
|
|
1170
|
-
if (this.db) {
|
|
1171
|
-
return this.db;
|
|
1172
|
-
}
|
|
1173
|
-
const { DatabaseSync } = requireNodeSqlite();
|
|
1174
|
-
this.db = new DatabaseSync(this.indexPath, { readOnly: true });
|
|
1175
|
-
// Keep QMD recall responsive when the updater holds a write lock.
|
|
1176
|
-
this.db.exec("PRAGMA busy_timeout = 1");
|
|
1177
|
-
return this.db;
|
|
1178
|
-
}
|
|
1179
|
-
async exportSessions() {
|
|
1180
|
-
if (!this.sessionExporter) {
|
|
1181
|
-
return;
|
|
1182
|
-
}
|
|
1183
|
-
const exportDir = this.sessionExporter.dir;
|
|
1184
|
-
await fs.mkdir(exportDir, { recursive: true });
|
|
1185
|
-
const files = await listSessionFilesForAgent(this.agentId);
|
|
1186
|
-
const keep = new Set();
|
|
1187
|
-
const tracked = new Set();
|
|
1188
|
-
const cutoff = this.sessionExporter.retentionMs
|
|
1189
|
-
? Date.now() - this.sessionExporter.retentionMs
|
|
1190
|
-
: null;
|
|
1191
|
-
for (const sessionFile of files) {
|
|
1192
|
-
const entry = await buildSessionEntry(sessionFile);
|
|
1193
|
-
if (!entry) {
|
|
1194
|
-
continue;
|
|
1195
|
-
}
|
|
1196
|
-
if (cutoff && entry.mtimeMs < cutoff) {
|
|
1197
|
-
continue;
|
|
1198
|
-
}
|
|
1199
|
-
const targetName = `${path.basename(sessionFile, ".jsonl")}.md`;
|
|
1200
|
-
const target = path.join(exportDir, targetName);
|
|
1201
|
-
tracked.add(sessionFile);
|
|
1202
|
-
const state = this.exportedSessionState.get(sessionFile);
|
|
1203
|
-
if (!state || state.hash !== entry.hash || state.mtimeMs !== entry.mtimeMs) {
|
|
1204
|
-
await writeFileWithinRoot({
|
|
1205
|
-
rootDir: exportDir,
|
|
1206
|
-
relativePath: targetName,
|
|
1207
|
-
data: this.renderSessionMarkdown(entry),
|
|
1208
|
-
encoding: "utf-8",
|
|
1209
|
-
});
|
|
1210
|
-
}
|
|
1211
|
-
this.exportedSessionState.set(sessionFile, {
|
|
1212
|
-
hash: entry.hash,
|
|
1213
|
-
mtimeMs: entry.mtimeMs,
|
|
1214
|
-
target,
|
|
1215
|
-
});
|
|
1216
|
-
keep.add(target);
|
|
1217
|
-
}
|
|
1218
|
-
const exported = await fs.readdir(exportDir).catch(() => []);
|
|
1219
|
-
for (const name of exported) {
|
|
1220
|
-
if (!name.endsWith(".md")) {
|
|
1221
|
-
continue;
|
|
1222
|
-
}
|
|
1223
|
-
const full = path.join(exportDir, name);
|
|
1224
|
-
if (!keep.has(full)) {
|
|
1225
|
-
await fs.rm(full, { force: true });
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
for (const [sessionFile, state] of this.exportedSessionState) {
|
|
1229
|
-
if (!tracked.has(sessionFile) || !state.target.startsWith(exportDir + path.sep)) {
|
|
1230
|
-
this.exportedSessionState.delete(sessionFile);
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
renderSessionMarkdown(entry) {
|
|
1235
|
-
const header = `# Session ${path.basename(entry.absPath, path.extname(entry.absPath))}`;
|
|
1236
|
-
const body = entry.content?.trim().length ? entry.content.trim() : "(empty)";
|
|
1237
|
-
return `${header}\n\n${body}\n`;
|
|
1238
|
-
}
|
|
1239
|
-
pickSessionCollectionName() {
|
|
1240
|
-
const existing = new Set(this.qmd.collections.map((collection) => collection.name));
|
|
1241
|
-
const base = `sessions-${this.sanitizeCollectionNameSegment(this.agentId)}`;
|
|
1242
|
-
if (!existing.has(base)) {
|
|
1243
|
-
return base;
|
|
1244
|
-
}
|
|
1245
|
-
let counter = 2;
|
|
1246
|
-
let candidate = `${base}-${counter}`;
|
|
1247
|
-
while (existing.has(candidate)) {
|
|
1248
|
-
counter += 1;
|
|
1249
|
-
candidate = `${base}-${counter}`;
|
|
1250
|
-
}
|
|
1251
|
-
return candidate;
|
|
1252
|
-
}
|
|
1253
|
-
sanitizeCollectionNameSegment(input) {
|
|
1254
|
-
const lower = input.toLowerCase().replace(/[^a-z0-9-]+/g, "-");
|
|
1255
|
-
const trimmed = lower.replace(/^-+|-+$/g, "");
|
|
1256
|
-
return trimmed || "agent";
|
|
1257
|
-
}
|
|
1258
|
-
async resolveDocLocation(docid, hints) {
|
|
1259
|
-
if (!docid) {
|
|
1260
|
-
return null;
|
|
1261
|
-
}
|
|
1262
|
-
const normalized = docid.startsWith("#") ? docid.slice(1) : docid;
|
|
1263
|
-
if (!normalized) {
|
|
1264
|
-
return null;
|
|
1265
|
-
}
|
|
1266
|
-
const cacheKey = `${hints?.preferredCollection ?? "*"}:${normalized}`;
|
|
1267
|
-
const cached = this.docPathCache.get(cacheKey);
|
|
1268
|
-
if (cached) {
|
|
1269
|
-
return cached;
|
|
1270
|
-
}
|
|
1271
|
-
const db = this.ensureDb();
|
|
1272
|
-
let rows = [];
|
|
1273
|
-
try {
|
|
1274
|
-
rows = db
|
|
1275
|
-
.prepare("SELECT collection, path FROM documents WHERE hash = ? AND active = 1")
|
|
1276
|
-
.all(normalized);
|
|
1277
|
-
if (rows.length === 0) {
|
|
1278
|
-
rows = db
|
|
1279
|
-
.prepare("SELECT collection, path FROM documents WHERE hash LIKE ? AND active = 1")
|
|
1280
|
-
.all(`${normalized}%`);
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
catch (err) {
|
|
1284
|
-
if (this.isSqliteBusyError(err)) {
|
|
1285
|
-
log.debug(`qmd index is busy while resolving doc path: ${String(err)}`);
|
|
1286
|
-
throw this.createQmdBusyError(err);
|
|
1287
|
-
}
|
|
1288
|
-
throw err;
|
|
1289
|
-
}
|
|
1290
|
-
if (rows.length === 0) {
|
|
1291
|
-
return null;
|
|
1292
|
-
}
|
|
1293
|
-
const location = this.pickDocLocation(rows, hints);
|
|
1294
|
-
if (!location) {
|
|
1295
|
-
return null;
|
|
1296
|
-
}
|
|
1297
|
-
this.docPathCache.set(cacheKey, location);
|
|
1298
|
-
return location;
|
|
1299
|
-
}
|
|
1300
|
-
pickDocLocation(rows, hints) {
|
|
1301
|
-
if (hints?.preferredCollection) {
|
|
1302
|
-
for (const row of rows) {
|
|
1303
|
-
if (row.collection !== hints.preferredCollection) {
|
|
1304
|
-
continue;
|
|
1305
|
-
}
|
|
1306
|
-
const location = this.toDocLocation(row.collection, row.path);
|
|
1307
|
-
if (location) {
|
|
1308
|
-
return location;
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
if (hints?.preferredFile) {
|
|
1313
|
-
const preferred = path.normalize(hints.preferredFile);
|
|
1314
|
-
for (const row of rows) {
|
|
1315
|
-
const rowPath = path.normalize(row.path);
|
|
1316
|
-
if (rowPath !== preferred && !rowPath.endsWith(path.sep + preferred)) {
|
|
1317
|
-
continue;
|
|
1318
|
-
}
|
|
1319
|
-
const location = this.toDocLocation(row.collection, row.path);
|
|
1320
|
-
if (location) {
|
|
1321
|
-
return location;
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
for (const row of rows) {
|
|
1326
|
-
const location = this.toDocLocation(row.collection, row.path);
|
|
1327
|
-
if (location) {
|
|
1328
|
-
return location;
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
return null;
|
|
1332
|
-
}
|
|
1333
|
-
extractSnippetLines(snippet) {
|
|
1334
|
-
const match = SNIPPET_HEADER_RE.exec(snippet);
|
|
1335
|
-
if (match) {
|
|
1336
|
-
const start = Number(match[1]);
|
|
1337
|
-
const count = Number(match[2]);
|
|
1338
|
-
if (Number.isFinite(start) && Number.isFinite(count)) {
|
|
1339
|
-
return { startLine: start, endLine: start + count - 1 };
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
const lines = snippet.split("\n").length;
|
|
1343
|
-
return { startLine: 1, endLine: lines };
|
|
1344
|
-
}
|
|
1345
|
-
readCounts() {
|
|
1346
|
-
try {
|
|
1347
|
-
const db = this.ensureDb();
|
|
1348
|
-
const rows = db
|
|
1349
|
-
.prepare("SELECT collection, COUNT(*) as c FROM documents WHERE active = 1 GROUP BY collection")
|
|
1350
|
-
.all();
|
|
1351
|
-
const bySource = new Map();
|
|
1352
|
-
for (const source of this.sources) {
|
|
1353
|
-
bySource.set(source, { files: 0, chunks: 0 });
|
|
1354
|
-
}
|
|
1355
|
-
let total = 0;
|
|
1356
|
-
for (const row of rows) {
|
|
1357
|
-
const root = this.collectionRoots.get(row.collection);
|
|
1358
|
-
const source = root?.kind ?? "memory";
|
|
1359
|
-
const entry = bySource.get(source) ?? { files: 0, chunks: 0 };
|
|
1360
|
-
entry.files += row.c ?? 0;
|
|
1361
|
-
entry.chunks += row.c ?? 0;
|
|
1362
|
-
bySource.set(source, entry);
|
|
1363
|
-
total += row.c ?? 0;
|
|
1364
|
-
}
|
|
1365
|
-
return {
|
|
1366
|
-
totalDocuments: total,
|
|
1367
|
-
sourceCounts: Array.from(bySource.entries()).map(([source, value]) => ({
|
|
1368
|
-
source,
|
|
1369
|
-
files: value.files,
|
|
1370
|
-
chunks: value.chunks,
|
|
1371
|
-
})),
|
|
1372
|
-
};
|
|
1373
|
-
}
|
|
1374
|
-
catch (err) {
|
|
1375
|
-
log.warn(`failed to read qmd index stats: ${String(err)}`);
|
|
1376
|
-
return {
|
|
1377
|
-
totalDocuments: 0,
|
|
1378
|
-
sourceCounts: Array.from(this.sources).map((source) => ({ source, files: 0, chunks: 0 })),
|
|
1379
|
-
};
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
logScopeDenied(sessionKey) {
|
|
1383
|
-
const channel = deriveQmdScopeChannel(sessionKey) ?? "unknown";
|
|
1384
|
-
const chatType = deriveQmdScopeChatType(sessionKey) ?? "unknown";
|
|
1385
|
-
const key = sessionKey?.trim() || "<none>";
|
|
1386
|
-
log.warn(`qmd search denied by scope (channel=${channel}, chatType=${chatType}, session=${key})`);
|
|
1387
|
-
}
|
|
1388
|
-
isScopeAllowed(sessionKey) {
|
|
1389
|
-
return isQmdScopeAllowed(this.qmd.scope, sessionKey);
|
|
1390
|
-
}
|
|
1391
|
-
toDocLocation(collection, collectionRelativePath) {
|
|
1392
|
-
const root = this.collectionRoots.get(collection);
|
|
1393
|
-
if (!root) {
|
|
1394
|
-
return null;
|
|
1395
|
-
}
|
|
1396
|
-
const normalizedRelative = collectionRelativePath.replace(/\\/g, "/");
|
|
1397
|
-
const absPath = path.normalize(path.resolve(root.path, collectionRelativePath));
|
|
1398
|
-
const relativeToWorkspace = path.relative(this.workspaceDir, absPath);
|
|
1399
|
-
const relPath = this.buildSearchPath(collection, normalizedRelative, relativeToWorkspace, absPath);
|
|
1400
|
-
return { rel: relPath, abs: absPath, source: root.kind };
|
|
1401
|
-
}
|
|
1402
|
-
buildSearchPath(collection, collectionRelativePath, relativeToWorkspace, absPath) {
|
|
1403
|
-
const insideWorkspace = this.isInsideWorkspace(relativeToWorkspace);
|
|
1404
|
-
if (insideWorkspace) {
|
|
1405
|
-
const normalized = relativeToWorkspace.replace(/\\/g, "/");
|
|
1406
|
-
if (!normalized) {
|
|
1407
|
-
return path.basename(absPath);
|
|
1408
|
-
}
|
|
1409
|
-
return normalized;
|
|
1410
|
-
}
|
|
1411
|
-
const sanitized = collectionRelativePath.replace(/^\/+/, "");
|
|
1412
|
-
return `qmd/${collection}/${sanitized}`;
|
|
1413
|
-
}
|
|
1414
|
-
isInsideWorkspace(relativePath) {
|
|
1415
|
-
if (!relativePath) {
|
|
1416
|
-
return true;
|
|
1417
|
-
}
|
|
1418
|
-
if (relativePath.startsWith("..")) {
|
|
1419
|
-
return false;
|
|
1420
|
-
}
|
|
1421
|
-
if (relativePath.startsWith(`..${path.sep}`)) {
|
|
1422
|
-
return false;
|
|
1423
|
-
}
|
|
1424
|
-
return !path.isAbsolute(relativePath);
|
|
1425
|
-
}
|
|
1426
|
-
resolveReadPath(relPath) {
|
|
1427
|
-
if (relPath.startsWith("qmd/")) {
|
|
1428
|
-
const [, collection, ...rest] = relPath.split("/");
|
|
1429
|
-
if (!collection || rest.length === 0) {
|
|
1430
|
-
throw new Error("invalid qmd path");
|
|
1431
|
-
}
|
|
1432
|
-
const root = this.collectionRoots.get(collection);
|
|
1433
|
-
if (!root) {
|
|
1434
|
-
throw new Error(`unknown qmd collection: ${collection}`);
|
|
1435
|
-
}
|
|
1436
|
-
const joined = rest.join("/");
|
|
1437
|
-
const resolved = path.resolve(root.path, joined);
|
|
1438
|
-
if (!this.isWithinRoot(root.path, resolved)) {
|
|
1439
|
-
throw new Error("qmd path escapes collection");
|
|
1440
|
-
}
|
|
1441
|
-
return resolved;
|
|
1442
|
-
}
|
|
1443
|
-
const absPath = path.resolve(this.workspaceDir, relPath);
|
|
1444
|
-
if (!this.isWithinWorkspace(absPath)) {
|
|
1445
|
-
throw new Error("path escapes workspace");
|
|
1446
|
-
}
|
|
1447
|
-
return absPath;
|
|
1448
|
-
}
|
|
1449
|
-
isWithinWorkspace(absPath) {
|
|
1450
|
-
const normalizedWorkspace = this.workspaceDir.endsWith(path.sep)
|
|
1451
|
-
? this.workspaceDir
|
|
1452
|
-
: `${this.workspaceDir}${path.sep}`;
|
|
1453
|
-
if (absPath === this.workspaceDir) {
|
|
1454
|
-
return true;
|
|
1455
|
-
}
|
|
1456
|
-
const candidate = absPath.endsWith(path.sep) ? absPath : `${absPath}${path.sep}`;
|
|
1457
|
-
return candidate.startsWith(normalizedWorkspace);
|
|
1458
|
-
}
|
|
1459
|
-
isWithinRoot(root, candidate) {
|
|
1460
|
-
const normalizedRoot = root.endsWith(path.sep) ? root : `${root}${path.sep}`;
|
|
1461
|
-
if (candidate === root) {
|
|
1462
|
-
return true;
|
|
1463
|
-
}
|
|
1464
|
-
const next = candidate.endsWith(path.sep) ? candidate : `${candidate}${path.sep}`;
|
|
1465
|
-
return next.startsWith(normalizedRoot);
|
|
1466
|
-
}
|
|
1467
|
-
clampResultsByInjectedChars(results) {
|
|
1468
|
-
const budget = this.qmd.limits.maxInjectedChars;
|
|
1469
|
-
if (!budget || budget <= 0) {
|
|
1470
|
-
return results;
|
|
1471
|
-
}
|
|
1472
|
-
let remaining = budget;
|
|
1473
|
-
const clamped = [];
|
|
1474
|
-
for (const entry of results) {
|
|
1475
|
-
if (remaining <= 0) {
|
|
1476
|
-
break;
|
|
1477
|
-
}
|
|
1478
|
-
const snippet = entry.snippet ?? "";
|
|
1479
|
-
if (snippet.length <= remaining) {
|
|
1480
|
-
clamped.push(entry);
|
|
1481
|
-
remaining -= snippet.length;
|
|
1482
|
-
}
|
|
1483
|
-
else {
|
|
1484
|
-
const trimmed = snippet.slice(0, Math.max(0, remaining));
|
|
1485
|
-
clamped.push({ ...entry, snippet: trimmed });
|
|
1486
|
-
break;
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
return clamped;
|
|
1490
|
-
}
|
|
1491
|
-
diversifyResultsBySource(results, limit) {
|
|
1492
|
-
const target = Math.max(0, limit);
|
|
1493
|
-
if (target <= 0) {
|
|
1494
|
-
return [];
|
|
1495
|
-
}
|
|
1496
|
-
if (results.length <= 1) {
|
|
1497
|
-
return results.slice(0, target);
|
|
1498
|
-
}
|
|
1499
|
-
const bySource = new Map();
|
|
1500
|
-
for (const entry of results) {
|
|
1501
|
-
const list = bySource.get(entry.source) ?? [];
|
|
1502
|
-
list.push(entry);
|
|
1503
|
-
bySource.set(entry.source, list);
|
|
1504
|
-
}
|
|
1505
|
-
const hasSessions = bySource.has("sessions");
|
|
1506
|
-
const hasMemory = bySource.has("memory");
|
|
1507
|
-
if (!hasSessions || !hasMemory) {
|
|
1508
|
-
return results.slice(0, target);
|
|
1509
|
-
}
|
|
1510
|
-
const sourceOrder = Array.from(bySource.entries())
|
|
1511
|
-
.toSorted((a, b) => (b[1][0]?.score ?? 0) - (a[1][0]?.score ?? 0))
|
|
1512
|
-
.map(([source]) => source);
|
|
1513
|
-
const diversified = [];
|
|
1514
|
-
while (diversified.length < target) {
|
|
1515
|
-
let emitted = false;
|
|
1516
|
-
for (const source of sourceOrder) {
|
|
1517
|
-
const next = bySource.get(source)?.shift();
|
|
1518
|
-
if (!next) {
|
|
1519
|
-
continue;
|
|
1520
|
-
}
|
|
1521
|
-
diversified.push(next);
|
|
1522
|
-
emitted = true;
|
|
1523
|
-
if (diversified.length >= target) {
|
|
1524
|
-
break;
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
if (!emitted) {
|
|
1528
|
-
break;
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
return diversified;
|
|
1532
|
-
}
|
|
1533
|
-
shouldSkipUpdate(force) {
|
|
1534
|
-
if (force) {
|
|
1535
|
-
return false;
|
|
1536
|
-
}
|
|
1537
|
-
const debounceMs = this.qmd.update.debounceMs;
|
|
1538
|
-
if (debounceMs <= 0) {
|
|
1539
|
-
return false;
|
|
1540
|
-
}
|
|
1541
|
-
if (!this.lastUpdateAt) {
|
|
1542
|
-
return false;
|
|
1543
|
-
}
|
|
1544
|
-
return Date.now() - this.lastUpdateAt < debounceMs;
|
|
1545
|
-
}
|
|
1546
|
-
isSqliteBusyError(err) {
|
|
1547
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1548
|
-
const normalized = message.toLowerCase();
|
|
1549
|
-
return normalized.includes("sqlite_busy") || normalized.includes("database is locked");
|
|
1550
|
-
}
|
|
1551
|
-
isUnsupportedQmdOptionError(err) {
|
|
1552
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1553
|
-
const normalized = message.toLowerCase();
|
|
1554
|
-
return (normalized.includes("unknown flag") ||
|
|
1555
|
-
normalized.includes("unknown option") ||
|
|
1556
|
-
normalized.includes("unrecognized option") ||
|
|
1557
|
-
normalized.includes("flag provided but not defined") ||
|
|
1558
|
-
normalized.includes("unexpected argument"));
|
|
1559
|
-
}
|
|
1560
|
-
createQmdBusyError(err) {
|
|
1561
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1562
|
-
return new Error(`qmd index busy while reading results: ${message}`);
|
|
1563
|
-
}
|
|
1564
|
-
async waitForPendingUpdateBeforeSearch() {
|
|
1565
|
-
const pending = this.pendingUpdate;
|
|
1566
|
-
if (!pending) {
|
|
1567
|
-
return;
|
|
1568
|
-
}
|
|
1569
|
-
await Promise.race([
|
|
1570
|
-
pending.catch(() => undefined),
|
|
1571
|
-
new Promise((resolve) => setTimeout(resolve, SEARCH_PENDING_UPDATE_WAIT_MS)),
|
|
1572
|
-
]);
|
|
1573
|
-
}
|
|
1574
|
-
async runQueryAcrossCollections(query, limit, collectionNames, command) {
|
|
1575
|
-
log.debug(`qmd ${command} multi-collection workaround active (${collectionNames.length} collections)`);
|
|
1576
|
-
const bestByDocId = new Map();
|
|
1577
|
-
for (const collectionName of collectionNames) {
|
|
1578
|
-
const args = this.buildSearchArgs(command, query, limit);
|
|
1579
|
-
args.push("-c", collectionName);
|
|
1580
|
-
const result = await this.runQmd(args, { timeoutMs: this.qmd.limits.timeoutMs });
|
|
1581
|
-
const parsed = parseQmdQueryJson(result.stdout, result.stderr);
|
|
1582
|
-
for (const entry of parsed) {
|
|
1583
|
-
const normalizedDocId = typeof entry.docid === "string" && entry.docid.trim().length > 0
|
|
1584
|
-
? entry.docid
|
|
1585
|
-
: undefined;
|
|
1586
|
-
if (!normalizedDocId) {
|
|
1587
|
-
continue;
|
|
1588
|
-
}
|
|
1589
|
-
const withCollection = {
|
|
1590
|
-
...entry,
|
|
1591
|
-
docid: normalizedDocId,
|
|
1592
|
-
collection: entry.collection ?? collectionName,
|
|
1593
|
-
};
|
|
1594
|
-
const prev = bestByDocId.get(normalizedDocId);
|
|
1595
|
-
const prevScore = typeof prev?.score === "number" ? prev.score : Number.NEGATIVE_INFINITY;
|
|
1596
|
-
const nextScore = typeof withCollection.score === "number"
|
|
1597
|
-
? withCollection.score
|
|
1598
|
-
: Number.NEGATIVE_INFINITY;
|
|
1599
|
-
if (!prev || nextScore > prevScore) {
|
|
1600
|
-
bestByDocId.set(normalizedDocId, withCollection);
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
return [...bestByDocId.values()].toSorted((a, b) => (b.score ?? 0) - (a.score ?? 0));
|
|
1605
|
-
}
|
|
1606
|
-
async runMcporterAcrossCollections(params) {
|
|
1607
|
-
const bestByDocId = new Map();
|
|
1608
|
-
for (const collectionName of params.collectionNames) {
|
|
1609
|
-
const parsed = await this.runQmdSearchViaMcporter({
|
|
1610
|
-
mcporter: this.qmd.mcporter,
|
|
1611
|
-
tool: params.tool,
|
|
1612
|
-
query: params.query,
|
|
1613
|
-
limit: params.limit,
|
|
1614
|
-
minScore: params.minScore,
|
|
1615
|
-
collection: collectionName,
|
|
1616
|
-
timeoutMs: this.qmd.limits.timeoutMs,
|
|
1617
|
-
});
|
|
1618
|
-
for (const entry of parsed) {
|
|
1619
|
-
if (typeof entry.docid !== "string" || !entry.docid.trim()) {
|
|
1620
|
-
continue;
|
|
1621
|
-
}
|
|
1622
|
-
const prev = bestByDocId.get(entry.docid);
|
|
1623
|
-
const prevScore = typeof prev?.score === "number" ? prev.score : Number.NEGATIVE_INFINITY;
|
|
1624
|
-
const nextScore = typeof entry.score === "number" ? entry.score : Number.NEGATIVE_INFINITY;
|
|
1625
|
-
if (!prev || nextScore > prevScore) {
|
|
1626
|
-
bestByDocId.set(entry.docid, entry);
|
|
1627
|
-
}
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
return [...bestByDocId.values()].toSorted((a, b) => (b.score ?? 0) - (a.score ?? 0));
|
|
1631
|
-
}
|
|
1632
|
-
listManagedCollectionNames() {
|
|
1633
|
-
return this.managedCollectionNames;
|
|
1634
|
-
}
|
|
1635
|
-
computeManagedCollectionNames() {
|
|
1636
|
-
const seen = new Set();
|
|
1637
|
-
const names = [];
|
|
1638
|
-
for (const collection of this.qmd.collections) {
|
|
1639
|
-
const name = collection.name?.trim();
|
|
1640
|
-
if (!name || seen.has(name)) {
|
|
1641
|
-
continue;
|
|
1642
|
-
}
|
|
1643
|
-
seen.add(name);
|
|
1644
|
-
names.push(name);
|
|
1645
|
-
}
|
|
1646
|
-
return names;
|
|
1647
|
-
}
|
|
1648
|
-
buildCollectionFilterArgs(collectionNames) {
|
|
1649
|
-
if (collectionNames.length === 0) {
|
|
1650
|
-
return [];
|
|
1651
|
-
}
|
|
1652
|
-
const names = collectionNames.filter(Boolean);
|
|
1653
|
-
return names.flatMap((name) => ["-c", name]);
|
|
1654
|
-
}
|
|
1655
|
-
buildSearchArgs(command, query, limit) {
|
|
1656
|
-
const normalizedQuery = command === "search" ? normalizeHanBm25Query(query) : query;
|
|
1657
|
-
if (command === "query") {
|
|
1658
|
-
return ["query", normalizedQuery, "--json", "-n", String(limit)];
|
|
1659
|
-
}
|
|
1660
|
-
return [command, normalizedQuery, "--json", "-n", String(limit)];
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
function appendOutputWithCap(current, chunk, maxChars) {
|
|
1664
|
-
const appended = current + chunk;
|
|
1665
|
-
if (appended.length <= maxChars) {
|
|
1666
|
-
return { text: appended, truncated: false };
|
|
1667
|
-
}
|
|
1668
|
-
return { text: appended.slice(-maxChars), truncated: true };
|
|
1669
|
-
}
|