@sayknow-cli/coding-agent 0.3.11 → 0.3.13
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/CHANGELOG.md +0 -21
- package/package.json +116 -117
- package/scripts/build-binary.ts +2 -43
- package/scripts/compile-args.ts +106 -0
- package/scripts/g004-tmux-smoke.ts +196 -36
- package/scripts/generate-docs-index.ts +3 -0
- package/src/build-metadata.ts +104 -0
- package/src/capability/mcp.ts +3 -1
- package/src/cli/daemon-cli.ts +19 -29
- package/src/cli/malloc-env-guard.test.ts +104 -0
- package/src/cli/malloc-env-guard.ts +149 -0
- package/src/cli/mcp-cli.ts +108 -26
- package/src/cli/notify-cli.ts +78 -14
- package/src/cli/session-picker.ts +23 -40
- package/src/cli/update-cli.ts +56 -37
- package/src/cli.ts +71 -10
- package/src/commands/daemon.ts +19 -5
- package/src/commands/harness.ts +515 -47
- package/src/commands/launch.ts +11 -3
- package/src/commands/mcp.ts +8 -8
- package/src/commands/notify.ts +5 -1
- package/src/commands/session.ts +6 -1
- package/src/commands/stats.ts +6 -2
- package/src/config/keybindings.ts +7 -2
- package/src/config/mcp-schema.json +21 -17
- package/src/config/model-profile-activation.ts +1 -1
- package/src/config/model-profiles.ts +23 -23
- package/src/config/settings-schema.ts +41 -1
- package/src/coordinator-mcp/model-preset.ts +100 -0
- package/src/coordinator-mcp/server.ts +2735 -435
- package/src/daemon/control-types.ts +11 -0
- package/src/daemon/operator-contract.ts +121 -0
- package/src/defaults/skc/extensions/grok-cli-vendor/src/models/catalog.ts +57 -17
- package/src/defaults/skc/extensions/grok-cli-vendor/src/payload/sanitize.ts +15 -2
- package/src/defaults/skc/extensions/grok-cli-vendor/src/provider/register.ts +5 -1
- package/src/discovery/builtin.ts +14 -0
- package/src/discovery/mcp-json.ts +14 -0
- package/src/eval/js/executor.ts +7 -1
- package/src/internal-urls/docs-index.generated.ts +10 -9
- package/src/internal-urls/local-protocol.ts +29 -10
- package/src/internal-urls/skc-protocol.ts +14 -1
- package/src/main.ts +298 -75
- package/src/modes/acp/acp-agent.ts +800 -114
- package/src/modes/acp/acp-client-bridge.ts +27 -5
- package/src/modes/acp/acp-event-mapper.ts +39 -1
- package/src/modes/acp/acp-mode.ts +29 -2
- package/src/modes/components/assistant-message.ts +33 -4
- package/src/modes/components/bash-execution.ts +43 -13
- package/src/modes/components/custom-editor.ts +5 -0
- package/src/modes/components/hook-selector.ts +16 -0
- package/src/modes/components/irc-sidebar.ts +206 -0
- package/src/modes/components/model-selector.ts +17 -6
- package/src/modes/components/pet-selector.ts +55 -0
- package/src/modes/components/sayknow-pet-widget.ts +360 -0
- package/src/modes/components/session-selector.ts +223 -222
- package/src/modes/components/settings-selector.ts +10 -0
- package/src/modes/components/status-line/presets.ts +5 -19
- package/src/modes/components/status-line/segments.ts +14 -0
- package/src/modes/components/status-line/types.ts +6 -0
- package/src/modes/components/status-line.ts +13 -6
- package/src/modes/components/tool-execution.ts +48 -7
- package/src/modes/components/user-message.ts +26 -9
- package/src/modes/components/welcome.ts +4 -1
- package/src/modes/controllers/command-controller.ts +29 -3
- package/src/modes/controllers/event-controller.ts +168 -45
- package/src/modes/controllers/extension-ui-controller.ts +36 -17
- package/src/modes/controllers/input-controller.ts +16 -4
- package/src/modes/controllers/selector-controller.ts +69 -18
- package/src/modes/interactive-mode.ts +194 -10
- package/src/modes/irc-observation-ledger.ts +127 -0
- package/src/modes/rpc/rpc-client.ts +30 -6
- package/src/modes/shared/agent-wire/deep-interview-gate.ts +45 -2
- package/src/modes/shared/agent-wire/unattended-session.ts +288 -1
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +130 -20
- package/src/modes/types.ts +34 -2
- package/src/modes/utils/hotkeys-markdown.ts +1 -0
- package/src/modes/utils/irc-message.ts +138 -0
- package/src/modes/utils/ui-helpers.ts +368 -80
- package/src/notifications/config.ts +44 -0
- package/src/notifications/daemon-paths.ts +8 -0
- package/src/notifications/index.ts +535 -75
- package/src/notifications/lifecycle-control-runtime.ts +930 -77
- package/src/notifications/notification-service.ts +710 -0
- package/src/notifications/rate-limit-pool.ts +46 -12
- package/src/notifications/telegram-daemon-control.ts +27 -2
- package/src/notifications/telegram-daemon.ts +663 -96
- package/src/notifications/telegram-reference.ts +73 -13
- package/src/notifications/topic-registry.ts +86 -9
- package/src/prompts/system/irc-peer-roster.md +1 -0
- package/src/prompts/system/subagent-system-prompt.md +1 -0
- package/src/prompts/system/system-prompt.md +1 -0
- package/src/prompts/tools/irc.md +1 -1
- package/src/prompts/tools/skill.md +2 -2
- package/src/registry/agent-registry.ts +3 -0
- package/src/runtime-mcp/config-writer.ts +4 -3
- package/src/runtime-mcp/config.ts +1 -0
- package/src/runtime-mcp/types.ts +4 -3
- package/src/sdk.ts +52 -1
- package/src/secrets/obfuscator.ts +4 -2
- package/src/session/agent-session.ts +513 -148
- package/src/session/cache-economics.ts +275 -0
- package/src/session/provider-safety-stop.ts +9 -0
- package/src/session/session-dump-format.ts +6 -0
- package/src/session/session-manager.ts +877 -79
- package/src/session/session-storage.ts +582 -38
- package/src/skc-runtime/session-state-sidecar.ts +756 -135
- package/src/skc-runtime/state-runtime.ts +105 -12
- package/src/skc-runtime/tmux-common.ts +26 -7
- package/src/skc-runtime/tmux-gc.ts +52 -9
- package/src/skc-runtime/tmux-owner-isolation-cli.ts +185 -0
- package/src/skc-runtime/tmux-owner-isolation.ts +2060 -0
- package/src/skc-runtime/tmux-sessions.ts +871 -68
- package/src/skc-runtime/workflow-manifest.generated.json +4 -28
- package/src/skc-runtime/workflow-manifest.ts +1 -7
- package/src/slash-commands/builtin-registry.ts +152 -13
- package/src/task/executor.ts +12 -3
- package/src/task/index.ts +8 -0
- package/src/task/receipt.ts +7 -2
- package/src/task/types.ts +26 -0
- package/src/tools/ask-answer-registry.ts +25 -0
- package/src/tools/bash-interactive.ts +9 -4
- package/src/tools/browser/readable.ts +2 -2
- package/src/tools/browser/tab-supervisor.ts +63 -6
- package/src/tools/browser.ts +8 -3
- package/src/tools/fetch.ts +5 -5
- package/src/tools/index.ts +81 -6
- package/src/tools/skill.ts +14 -11
- package/src/tools/sqlite-reader.ts +8 -4
- package/src/tui/output-block.ts +18 -6
- package/src/utils/external-editor.ts +6 -1
- package/src/utils/linkedom.ts +14 -0
- package/src/utils/pasted-image-path.ts +23 -9
- package/src/web/scrapers/arxiv.ts +2 -2
- package/src/web/scrapers/go-pkg.ts +2 -2
- package/src/web/scrapers/iacr.ts +2 -2
- package/src/web/scrapers/readthedocs.ts +2 -2
- package/src/web/scrapers/twitter.ts +3 -2
- package/src/web/scrapers/wikipedia.ts +2 -2
- package/dist/types/append-only-mode.d.ts +0 -31
- package/dist/types/async/index.d.ts +0 -2
- package/dist/types/async/job-manager.d.ts +0 -328
- package/dist/types/async/support.d.ts +0 -2
- package/dist/types/autoresearch/dashboard.d.ts +0 -4
- package/dist/types/autoresearch/git.d.ts +0 -36
- package/dist/types/autoresearch/helpers.d.ts +0 -24
- package/dist/types/autoresearch/index.d.ts +0 -2
- package/dist/types/autoresearch/state.d.ts +0 -17
- package/dist/types/autoresearch/storage.d.ts +0 -142
- package/dist/types/autoresearch/tools/init-experiment.d.ts +0 -31
- package/dist/types/autoresearch/tools/log-experiment.d.ts +0 -23
- package/dist/types/autoresearch/tools/run-experiment.d.ts +0 -8
- package/dist/types/autoresearch/tools/update-notes.d.ts +0 -12
- package/dist/types/autoresearch/types.d.ts +0 -154
- package/dist/types/capability/context-file.d.ts +0 -17
- package/dist/types/capability/extension-module.d.ts +0 -15
- package/dist/types/capability/extension.d.ts +0 -28
- package/dist/types/capability/fs.d.ts +0 -20
- package/dist/types/capability/hook.d.ts +0 -19
- package/dist/types/capability/index.d.ts +0 -80
- package/dist/types/capability/instruction.d.ts +0 -17
- package/dist/types/capability/mcp.d.ts +0 -47
- package/dist/types/capability/prompt.d.ts +0 -15
- package/dist/types/capability/rule.d.ts +0 -69
- package/dist/types/capability/settings.d.ts +0 -15
- package/dist/types/capability/skill.d.ts +0 -36
- package/dist/types/capability/slash-command.d.ts +0 -17
- package/dist/types/capability/ssh.d.ts +0 -23
- package/dist/types/capability/system-prompt.d.ts +0 -15
- package/dist/types/capability/tool.d.ts +0 -19
- package/dist/types/capability/types.d.ts +0 -154
- package/dist/types/cli/agents-cli.d.ts +0 -12
- package/dist/types/cli/args.d.ts +0 -57
- package/dist/types/cli/auth-broker-cli.d.ts +0 -25
- package/dist/types/cli/auth-gateway-cli.d.ts +0 -18
- package/dist/types/cli/classify-install-target.d.ts +0 -18
- package/dist/types/cli/commands/init-xdg.d.ts +0 -1
- package/dist/types/cli/completion-cli.d.ts +0 -41
- package/dist/types/cli/config-cli.d.ts +0 -23
- package/dist/types/cli/daemon-cli.d.ts +0 -25
- package/dist/types/cli/fast-help.d.ts +0 -1
- package/dist/types/cli/file-processor.d.ts +0 -11
- package/dist/types/cli/fixture-report.d.ts +0 -20
- package/dist/types/cli/fixture-report.test.d.ts +0 -1
- package/dist/types/cli/grep-cli.d.ts +0 -17
- package/dist/types/cli/initial-message.d.ts +0 -17
- package/dist/types/cli/list-models.d.ts +0 -36
- package/dist/types/cli/local-provider-smoke.d.ts +0 -59
- package/dist/types/cli/mcp-cli.d.ts +0 -25
- package/dist/types/cli/migrate-cli.d.ts +0 -20
- package/dist/types/cli/nofile-limit.d.ts +0 -11
- package/dist/types/cli/notify-cli.d.ts +0 -37
- package/dist/types/cli/plugin-cli.d.ts +0 -34
- package/dist/types/cli/read-cli.d.ts +0 -4
- package/dist/types/cli/session-picker.d.ts +0 -3
- package/dist/types/cli/setup-cli.d.ts +0 -73
- package/dist/types/cli/shell-cli.d.ts +0 -8
- package/dist/types/cli/skills-cli.d.ts +0 -9
- package/dist/types/cli/ssh-cli.d.ts +0 -21
- package/dist/types/cli/stats-cli.d.ts +0 -17
- package/dist/types/cli/telegram-cli.d.ts +0 -13
- package/dist/types/cli/update-cli.d.ts +0 -89
- package/dist/types/cli/web-search-cli.d.ts +0 -32
- package/dist/types/cli/worktree-cli.d.ts +0 -26
- package/dist/types/cli.d.ts +0 -135
- package/dist/types/commands/acp.d.ts +0 -12
- package/dist/types/commands/agents.d.ts +0 -34
- package/dist/types/commands/auth-broker.d.ts +0 -54
- package/dist/types/commands/auth-gateway.d.ts +0 -32
- package/dist/types/commands/codex-native-hook.d.ts +0 -6
- package/dist/types/commands/commit.d.ts +0 -27
- package/dist/types/commands/completion.d.ts +0 -29
- package/dist/types/commands/config.d.ts +0 -33
- package/dist/types/commands/contribution-prep.d.ts +0 -18
- package/dist/types/commands/coordinator.d.ts +0 -19
- package/dist/types/commands/daemon.d.ts +0 -41
- package/dist/types/commands/deep-interview.d.ts +0 -54
- package/dist/types/commands/gc.d.ts +0 -26
- package/dist/types/commands/grep.d.ts +0 -42
- package/dist/types/commands/harness.d.ts +0 -43
- package/dist/types/commands/launch.d.ts +0 -130
- package/dist/types/commands/local-provider.d.ts +0 -34
- package/dist/types/commands/mcp-serve.d.ts +0 -24
- package/dist/types/commands/mcp.d.ts +0 -70
- package/dist/types/commands/migrate.d.ts +0 -33
- package/dist/types/commands/notify.d.ts +0 -41
- package/dist/types/commands/plugin.d.ts +0 -58
- package/dist/types/commands/ralplan.d.ts +0 -7
- package/dist/types/commands/read.d.ts +0 -15
- package/dist/types/commands/rlm.d.ts +0 -10
- package/dist/types/commands/session.d.ts +0 -30
- package/dist/types/commands/setup.d.ts +0 -105
- package/dist/types/commands/shell.d.ts +0 -21
- package/dist/types/commands/skills.d.ts +0 -26
- package/dist/types/commands/ssh.d.ts +0 -48
- package/dist/types/commands/state.d.ts +0 -7
- package/dist/types/commands/stats.d.ts +0 -25
- package/dist/types/commands/team.d.ts +0 -24
- package/dist/types/commands/telegram.d.ts +0 -22
- package/dist/types/commands/ultragoal.d.ts +0 -8
- package/dist/types/commands/update.d.ts +0 -20
- package/dist/types/commands/web-search.d.ts +0 -87
- package/dist/types/commands/worktree.d.ts +0 -34
- package/dist/types/commit/agentic/agent.d.ts +0 -31
- package/dist/types/commit/agentic/fallback.d.ts +0 -5
- package/dist/types/commit/agentic/index.d.ts +0 -2
- package/dist/types/commit/agentic/state.d.ts +0 -58
- package/dist/types/commit/agentic/tools/analyze-file.d.ts +0 -19
- package/dist/types/commit/agentic/tools/git-file-diff.d.ts +0 -10
- package/dist/types/commit/agentic/tools/git-hunk.d.ts +0 -9
- package/dist/types/commit/agentic/tools/git-overview.d.ts +0 -9
- package/dist/types/commit/agentic/tools/index.d.ts +0 -16
- package/dist/types/commit/agentic/tools/propose-changelog.d.ts +0 -28
- package/dist/types/commit/agentic/tools/propose-commit.d.ts +0 -36
- package/dist/types/commit/agentic/tools/recent-commits.d.ts +0 -7
- package/dist/types/commit/agentic/tools/schemas.d.ts +0 -27
- package/dist/types/commit/agentic/tools/split-commit.d.ts +0 -53
- package/dist/types/commit/agentic/topo-sort.d.ts +0 -4
- package/dist/types/commit/agentic/trivial.d.ts +0 -7
- package/dist/types/commit/agentic/validation.d.ts +0 -20
- package/dist/types/commit/analysis/conventional.d.ts +0 -22
- package/dist/types/commit/analysis/index.d.ts +0 -4
- package/dist/types/commit/analysis/scope.d.ts +0 -6
- package/dist/types/commit/analysis/summary.d.ts +0 -19
- package/dist/types/commit/analysis/validation.d.ts +0 -8
- package/dist/types/commit/changelog/detect.d.ts +0 -2
- package/dist/types/commit/changelog/generate.d.ts +0 -30
- package/dist/types/commit/changelog/index.d.ts +0 -30
- package/dist/types/commit/changelog/parse.d.ts +0 -2
- package/dist/types/commit/cli.d.ts +0 -3
- package/dist/types/commit/git/diff.d.ts +0 -5
- package/dist/types/commit/index.d.ts +0 -4
- package/dist/types/commit/map-reduce/index.d.ts +0 -28
- package/dist/types/commit/map-reduce/map-phase.d.ts +0 -17
- package/dist/types/commit/map-reduce/reduce-phase.d.ts +0 -13
- package/dist/types/commit/map-reduce/utils.d.ts +0 -2
- package/dist/types/commit/message.d.ts +0 -2
- package/dist/types/commit/model-selection.d.ts +0 -15
- package/dist/types/commit/pipeline.d.ts +0 -5
- package/dist/types/commit/shared-llm.d.ts +0 -54
- package/dist/types/commit/types.d.ts +0 -78
- package/dist/types/commit/utils/exclusions.d.ts +0 -4
- package/dist/types/commit/utils.d.ts +0 -20
- package/dist/types/config/config-file.d.ts +0 -58
- package/dist/types/config/file-lock-gc.d.ts +0 -5
- package/dist/types/config/file-lock.d.ts +0 -36
- package/dist/types/config/keybindings.d.ts +0 -359
- package/dist/types/config/model-equivalence.d.ts +0 -24
- package/dist/types/config/model-profile-activation.d.ts +0 -64
- package/dist/types/config/model-profiles.d.ts +0 -39
- package/dist/types/config/model-registry.d.ts +0 -473
- package/dist/types/config/model-resolver.d.ts +0 -217
- package/dist/types/config/models-config-schema.d.ts +0 -700
- package/dist/types/config/prompt-templates.d.ts +0 -32
- package/dist/types/config/resolve-config-value.d.ts +0 -17
- package/dist/types/config/settings-schema.d.ts +0 -4183
- package/dist/types/config/settings.d.ts +0 -156
- package/dist/types/config/skill-settings-defaults.d.ts +0 -14
- package/dist/types/config/telegram-autostart.d.ts +0 -14
- package/dist/types/config/telegram-env-bridge.d.ts +0 -18
- package/dist/types/config.d.ts +0 -66
- package/dist/types/coordinator/contract.d.ts +0 -4
- package/dist/types/coordinator-mcp/policy.d.ts +0 -24
- package/dist/types/coordinator-mcp/safety.d.ts +0 -26
- package/dist/types/coordinator-mcp/server.d.ts +0 -66
- package/dist/types/cursor.d.ts +0 -24
- package/dist/types/daemon/builtin.d.ts +0 -20
- package/dist/types/daemon/control-types.d.ts +0 -57
- package/dist/types/daemon/runtime.d.ts +0 -25
- package/dist/types/dap/client.d.ts +0 -39
- package/dist/types/dap/config.d.ts +0 -6
- package/dist/types/dap/index.d.ts +0 -4
- package/dist/types/dap/session.d.ts +0 -108
- package/dist/types/dap/types.d.ts +0 -524
- package/dist/types/debug/crash-diagnostics.d.ts +0 -45
- package/dist/types/debug/index.d.ts +0 -15
- package/dist/types/debug/log-formatting.d.ts +0 -4
- package/dist/types/debug/log-viewer.d.ts +0 -68
- package/dist/types/debug/profiler.d.ts +0 -24
- package/dist/types/debug/raw-sse-buffer.d.ts +0 -44
- package/dist/types/debug/raw-sse.d.ts +0 -16
- package/dist/types/debug/report-bundle.d.ts +0 -55
- package/dist/types/debug/runtime-gauges.d.ts +0 -6
- package/dist/types/debug/system-info.d.ts +0 -26
- package/dist/types/deep-interview/plaintext-gate-guard.d.ts +0 -11
- package/dist/types/deep-interview/render-middleware.d.ts +0 -6
- package/dist/types/defaults/skc/extensions/grok-build/index.d.ts +0 -1
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/index.d.ts +0 -1
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/models/catalog.d.ts +0 -25
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/payload/sanitize.d.ts +0 -27
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/provider/billing.d.ts +0 -8
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/provider/register.d.ts +0 -5
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/provider/stream.d.ts +0 -10
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/provider/usage.d.ts +0 -2
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/shared/base-url.d.ts +0 -2
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/shared/errors.d.ts +0 -38
- package/dist/types/defaults/skc-defaults.d.ts +0 -64
- package/dist/types/defaults/skc-grok-cli.d.ts +0 -5
- package/dist/types/discovery/agents-md.d.ts +0 -1
- package/dist/types/discovery/agents.d.ts +0 -12
- package/dist/types/discovery/builtin.d.ts +0 -1
- package/dist/types/discovery/claude-plugins.d.ts +0 -1
- package/dist/types/discovery/claude.d.ts +0 -1
- package/dist/types/discovery/cline.d.ts +0 -1
- package/dist/types/discovery/codex.d.ts +0 -1
- package/dist/types/discovery/cursor.d.ts +0 -19
- package/dist/types/discovery/gemini.d.ts +0 -1
- package/dist/types/discovery/github.d.ts +0 -1
- package/dist/types/discovery/helpers.d.ts +0 -271
- package/dist/types/discovery/index.d.ts +0 -48
- package/dist/types/discovery/mcp-json.d.ts +0 -1
- package/dist/types/discovery/opencode.d.ts +0 -1
- package/dist/types/discovery/plugin-dir-roots.d.ts +0 -15
- package/dist/types/discovery/ssh.d.ts +0 -1
- package/dist/types/discovery/substitute-plugin-root.d.ts +0 -5
- package/dist/types/discovery/vscode.d.ts +0 -1
- package/dist/types/discovery/windsurf.d.ts +0 -15
- package/dist/types/edit/apply-patch/index.d.ts +0 -35
- package/dist/types/edit/apply-patch/parser.d.ts +0 -34
- package/dist/types/edit/diff.d.ts +0 -75
- package/dist/types/edit/file-read-cache.d.ts +0 -25
- package/dist/types/edit/index.d.ts +0 -58
- package/dist/types/edit/modes/apply-patch.d.ts +0 -24
- package/dist/types/edit/modes/patch.d.ts +0 -99
- package/dist/types/edit/modes/replace.d.ts +0 -149
- package/dist/types/edit/normalize.d.ts +0 -43
- package/dist/types/edit/notebook.d.ts +0 -26
- package/dist/types/edit/read-file.d.ts +0 -8
- package/dist/types/edit/renderer.d.ts +0 -110
- package/dist/types/edit/streaming.d.ts +0 -66
- package/dist/types/eval/backend.d.ts +0 -40
- package/dist/types/eval/index.d.ts +0 -4
- package/dist/types/eval/js/context-manager.d.ts +0 -27
- package/dist/types/eval/js/executor.d.ts +0 -29
- package/dist/types/eval/js/index.d.ts +0 -10
- package/dist/types/eval/js/shared/helpers.d.ts +0 -38
- package/dist/types/eval/js/shared/indirect-eval.d.ts +0 -14
- package/dist/types/eval/js/shared/prelude.d.ts +0 -1
- package/dist/types/eval/js/shared/rewrite-imports.d.ts +0 -6
- package/dist/types/eval/js/shared/runtime.d.ts +0 -47
- package/dist/types/eval/js/shared/types.d.ts +0 -24
- package/dist/types/eval/js/tool-bridge.d.ts +0 -18
- package/dist/types/eval/js/worker-core.d.ts +0 -5
- package/dist/types/eval/js/worker-entry.d.ts +0 -1
- package/dist/types/eval/js/worker-protocol.d.ts +0 -77
- package/dist/types/eval/py/display.d.ts +0 -25
- package/dist/types/eval/py/executor.d.ts +0 -88
- package/dist/types/eval/py/index.d.ts +0 -10
- package/dist/types/eval/py/kernel.d.ts +0 -65
- package/dist/types/eval/py/prelude.d.ts +0 -1
- package/dist/types/eval/py/runtime.d.ts +0 -29
- package/dist/types/eval/py/tool-bridge.d.ts +0 -20
- package/dist/types/eval/types.d.ts +0 -52
- package/dist/types/exa/factory.d.ts +0 -13
- package/dist/types/exa/index.d.ts +0 -20
- package/dist/types/exa/mcp-client.d.ts +0 -45
- package/dist/types/exa/render.d.ts +0 -19
- package/dist/types/exa/researcher.d.ts +0 -9
- package/dist/types/exa/search.d.ts +0 -9
- package/dist/types/exa/types.d.ts +0 -155
- package/dist/types/exa/websets.d.ts +0 -9
- package/dist/types/exec/bash-executor.d.ts +0 -64
- package/dist/types/exec/exec.d.ts +0 -25
- package/dist/types/exec/idle-timeout-watchdog.d.ts +0 -18
- package/dist/types/exec/non-interactive-env.d.ts +0 -1
- package/dist/types/export/custom-share.d.ts +0 -20
- package/dist/types/export/html/index.d.ts +0 -10
- package/dist/types/export/html/template.generated.d.ts +0 -1
- package/dist/types/export/html/template.macro.d.ts +0 -5
- package/dist/types/export/ttsr.d.ts +0 -55
- package/dist/types/extensibility/custom-commands/bundled/ci-green/index.d.ts +0 -9
- package/dist/types/extensibility/custom-commands/index.d.ts +0 -2
- package/dist/types/extensibility/custom-commands/loader.d.ts +0 -29
- package/dist/types/extensibility/custom-commands/types.d.ts +0 -106
- package/dist/types/extensibility/custom-tools/index.d.ts +0 -6
- package/dist/types/extensibility/custom-tools/loader.d.ts +0 -69
- package/dist/types/extensibility/custom-tools/types.d.ts +0 -229
- package/dist/types/extensibility/custom-tools/wrapper.d.ts +0 -24
- package/dist/types/extensibility/extensions/compact-handler.d.ts +0 -26
- package/dist/types/extensibility/extensions/get-commands-handler.d.ts +0 -29
- package/dist/types/extensibility/extensions/index.d.ts +0 -9
- package/dist/types/extensibility/extensions/loader.d.ts +0 -43
- package/dist/types/extensibility/extensions/prefix-command-bridge.d.ts +0 -35
- package/dist/types/extensibility/extensions/runner.d.ts +0 -135
- package/dist/types/extensibility/extensions/types.d.ts +0 -918
- package/dist/types/extensibility/extensions/wrapper.d.ts +0 -55
- package/dist/types/extensibility/hooks/index.d.ts +0 -5
- package/dist/types/extensibility/hooks/loader.d.ts +0 -89
- package/dist/types/extensibility/hooks/runner.d.ts +0 -126
- package/dist/types/extensibility/hooks/tool-wrapper.d.ts +0 -25
- package/dist/types/extensibility/hooks/types.d.ts +0 -431
- package/dist/types/extensibility/plugins/doctor.d.ts +0 -3
- package/dist/types/extensibility/plugins/git-url.d.ts +0 -34
- package/dist/types/extensibility/plugins/index.d.ts +0 -8
- package/dist/types/extensibility/plugins/installer.d.ts +0 -5
- package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +0 -2
- package/dist/types/extensibility/plugins/loader.d.ts +0 -31
- package/dist/types/extensibility/plugins/manager.d.ts +0 -65
- package/dist/types/extensibility/plugins/marketplace/cache.d.ts +0 -41
- package/dist/types/extensibility/plugins/marketplace/fetcher.d.ts +0 -48
- package/dist/types/extensibility/plugins/marketplace/index.d.ts +0 -6
- package/dist/types/extensibility/plugins/marketplace/manager.d.ts +0 -57
- package/dist/types/extensibility/plugins/marketplace/registry.d.ts +0 -34
- package/dist/types/extensibility/plugins/marketplace/source-resolver.d.ts +0 -28
- package/dist/types/extensibility/plugins/marketplace/types.d.ts +0 -130
- package/dist/types/extensibility/plugins/parser.d.ts +0 -52
- package/dist/types/extensibility/plugins/security-scanner.d.ts +0 -31
- package/dist/types/extensibility/plugins/types.d.ts +0 -149
- package/dist/types/extensibility/runtime-skill-discovery.d.ts +0 -20
- package/dist/types/extensibility/shared-events.d.ts +0 -281
- package/dist/types/extensibility/skc-plugins/activation.d.ts +0 -14
- package/dist/types/extensibility/skc-plugins/compiler.d.ts +0 -19
- package/dist/types/extensibility/skc-plugins/constrained-hooks.d.ts +0 -29
- package/dist/types/extensibility/skc-plugins/index.d.ts +0 -18
- package/dist/types/extensibility/skc-plugins/injection.d.ts +0 -40
- package/dist/types/extensibility/skc-plugins/installer.d.ts +0 -13
- package/dist/types/extensibility/skc-plugins/loader.d.ts +0 -3
- package/dist/types/extensibility/skc-plugins/mcp-policy.d.ts +0 -26
- package/dist/types/extensibility/skc-plugins/observability.d.ts +0 -27
- package/dist/types/extensibility/skc-plugins/paths.d.ts +0 -8
- package/dist/types/extensibility/skc-plugins/prompt-appendix.d.ts +0 -16
- package/dist/types/extensibility/skc-plugins/registry.d.ts +0 -32
- package/dist/types/extensibility/skc-plugins/runtime-adapters.d.ts +0 -64
- package/dist/types/extensibility/skc-plugins/schema.d.ts +0 -3
- package/dist/types/extensibility/skc-plugins/session-validation.d.ts +0 -42
- package/dist/types/extensibility/skc-plugins/state.d.ts +0 -9
- package/dist/types/extensibility/skc-plugins/tools.d.ts +0 -8
- package/dist/types/extensibility/skc-plugins/types.d.ts +0 -220
- package/dist/types/extensibility/skc-plugins/validation.d.ts +0 -11
- package/dist/types/extensibility/skills.d.ts +0 -82
- package/dist/types/extensibility/slash-commands.d.ts +0 -48
- package/dist/types/extensibility/tool-proxy.d.ts +0 -4
- package/dist/types/extensibility/typebox.d.ts +0 -155
- package/dist/types/extensibility/utils.d.ts +0 -12
- package/dist/types/goals/index.d.ts +0 -3
- package/dist/types/goals/runtime.d.ts +0 -63
- package/dist/types/goals/state.d.ts +0 -32
- package/dist/types/goals/tools/goal-tool.d.ts +0 -62
- package/dist/types/harness-control-plane/classifier.d.ts +0 -13
- package/dist/types/harness-control-plane/control-endpoint.d.ts +0 -31
- package/dist/types/harness-control-plane/finalize.d.ts +0 -60
- package/dist/types/harness-control-plane/gc-adapter.d.ts +0 -3
- package/dist/types/harness-control-plane/operate.d.ts +0 -35
- package/dist/types/harness-control-plane/owner.d.ts +0 -53
- package/dist/types/harness-control-plane/phase-rollup.d.ts +0 -23
- package/dist/types/harness-control-plane/preserve.d.ts +0 -19
- package/dist/types/harness-control-plane/receipt-ingest.d.ts +0 -19
- package/dist/types/harness-control-plane/receipt-spool.d.ts +0 -19
- package/dist/types/harness-control-plane/receipts.d.ts +0 -149
- package/dist/types/harness-control-plane/rpc-adapter.d.ts +0 -69
- package/dist/types/harness-control-plane/seams.d.ts +0 -21
- package/dist/types/harness-control-plane/session-lease.d.ts +0 -65
- package/dist/types/harness-control-plane/state-machine.d.ts +0 -24
- package/dist/types/harness-control-plane/storage.d.ts +0 -81
- package/dist/types/harness-control-plane/types.d.ts +0 -187
- package/dist/types/hashline/anchors.d.ts +0 -20
- package/dist/types/hashline/apply.d.ts +0 -14
- package/dist/types/hashline/constants.d.ts +0 -19
- package/dist/types/hashline/diff-preview.d.ts +0 -2
- package/dist/types/hashline/diff.d.ts +0 -17
- package/dist/types/hashline/execute.d.ts +0 -4
- package/dist/types/hashline/hash.d.ts +0 -123
- package/dist/types/hashline/index.d.ts +0 -13
- package/dist/types/hashline/input.d.ts +0 -11
- package/dist/types/hashline/parser.d.ts +0 -7
- package/dist/types/hashline/prefixes.d.ts +0 -7
- package/dist/types/hashline/recovery.d.ts +0 -27
- package/dist/types/hashline/stream.d.ts +0 -2
- package/dist/types/hashline/types.d.ts +0 -77
- package/dist/types/hindsight/backend.d.ts +0 -13
- package/dist/types/hindsight/bank.d.ts +0 -54
- package/dist/types/hindsight/client.d.ts +0 -224
- package/dist/types/hindsight/config.d.ts +0 -51
- package/dist/types/hindsight/content.d.ts +0 -70
- package/dist/types/hindsight/index.d.ts +0 -8
- package/dist/types/hindsight/mental-models.d.ts +0 -125
- package/dist/types/hindsight/state.d.ts +0 -99
- package/dist/types/hindsight/transcript.d.ts +0 -28
- package/dist/types/hooks/codex-native-hooks-config.d.ts +0 -29
- package/dist/types/hooks/native-skill-hook.d.ts +0 -28
- package/dist/types/hooks/skill-keywords.d.ts +0 -18
- package/dist/types/hooks/skill-state.d.ts +0 -93
- package/dist/types/i18n/index.d.ts +0 -38
- package/dist/types/i18n/messages/de.d.ts +0 -2
- package/dist/types/i18n/messages/de.messages.d.ts +0 -1
- package/dist/types/i18n/messages/de.settings.d.ts +0 -1
- package/dist/types/i18n/messages/en.d.ts +0 -81
- package/dist/types/i18n/messages/es.d.ts +0 -2
- package/dist/types/i18n/messages/es.messages.d.ts +0 -1
- package/dist/types/i18n/messages/es.settings.d.ts +0 -1
- package/dist/types/i18n/messages/fr.d.ts +0 -2
- package/dist/types/i18n/messages/fr.messages.d.ts +0 -1
- package/dist/types/i18n/messages/fr.settings.d.ts +0 -1
- package/dist/types/i18n/messages/ja.d.ts +0 -2
- package/dist/types/i18n/messages/ja.messages.d.ts +0 -1
- package/dist/types/i18n/messages/ja.settings.d.ts +0 -1
- package/dist/types/i18n/messages/ko.d.ts +0 -2
- package/dist/types/i18n/messages/ko.messages.d.ts +0 -1
- package/dist/types/i18n/messages/ko.settings.d.ts +0 -1
- package/dist/types/i18n/messages/zh.d.ts +0 -2
- package/dist/types/i18n/messages/zh.messages.d.ts +0 -1
- package/dist/types/i18n/messages/zh.settings.d.ts +0 -1
- package/dist/types/index.d.ts +0 -33
- package/dist/types/internal-urls/agent-protocol.d.ts +0 -12
- package/dist/types/internal-urls/artifact-protocol.d.ts +0 -6
- package/dist/types/internal-urls/docs-index.generated.d.ts +0 -2
- package/dist/types/internal-urls/index.d.ts +0 -20
- package/dist/types/internal-urls/issue-pr-protocol.d.ts +0 -17
- package/dist/types/internal-urls/json-query.d.ts +0 -30
- package/dist/types/internal-urls/local-protocol.d.ts +0 -39
- package/dist/types/internal-urls/mcp-protocol.d.ts +0 -12
- package/dist/types/internal-urls/memory-protocol.d.ts +0 -23
- package/dist/types/internal-urls/parse.d.ts +0 -19
- package/dist/types/internal-urls/registry-helpers.d.ts +0 -11
- package/dist/types/internal-urls/router.d.ts +0 -14
- package/dist/types/internal-urls/rule-protocol.d.ts +0 -6
- package/dist/types/internal-urls/skc-protocol.d.ts +0 -12
- package/dist/types/internal-urls/skill-protocol.d.ts +0 -13
- package/dist/types/internal-urls/types.d.ts +0 -109
- package/dist/types/lsp/client.d.ts +0 -66
- package/dist/types/lsp/clients/biome-client.d.ts +0 -16
- package/dist/types/lsp/clients/index.d.ts +0 -19
- package/dist/types/lsp/clients/lsp-linter-client.d.ts +0 -16
- package/dist/types/lsp/clients/swiftlint-client.d.ts +0 -20
- package/dist/types/lsp/config.d.ts +0 -65
- package/dist/types/lsp/edits.d.ts +0 -23
- package/dist/types/lsp/index.d.ts +0 -130
- package/dist/types/lsp/lspmux.d.ts +0 -58
- package/dist/types/lsp/render.d.ts +0 -32
- package/dist/types/lsp/startup-events.d.ts +0 -12
- package/dist/types/lsp/types.d.ts +0 -306
- package/dist/types/lsp/utils.d.ts +0 -108
- package/dist/types/main.d.ts +0 -75
- package/dist/types/memories/index.d.ts +0 -28
- package/dist/types/memories/storage.d.ts +0 -110
- package/dist/types/memory-backend/index.d.ts +0 -4
- package/dist/types/memory-backend/local-backend.d.ts +0 -9
- package/dist/types/memory-backend/off-backend.d.ts +0 -7
- package/dist/types/memory-backend/resolve.d.ts +0 -15
- package/dist/types/memory-backend/types.d.ts +0 -61
- package/dist/types/migrate/action-planner.d.ts +0 -11
- package/dist/types/migrate/adapters/claude-code.d.ts +0 -2
- package/dist/types/migrate/adapters/codex.d.ts +0 -5
- package/dist/types/migrate/adapters/index.d.ts +0 -45
- package/dist/types/migrate/adapters/opencode.d.ts +0 -2
- package/dist/types/migrate/executor.d.ts +0 -2
- package/dist/types/migrate/mcp-mapper.d.ts +0 -20
- package/dist/types/migrate/report.d.ts +0 -18
- package/dist/types/migrate/skill-normalizer.d.ts +0 -27
- package/dist/types/migrate/types.d.ts +0 -126
- package/dist/types/modes/acp/acp-agent.d.ts +0 -61
- package/dist/types/modes/acp/acp-client-bridge.d.ts +0 -9
- package/dist/types/modes/acp/acp-event-mapper.d.ts +0 -34
- package/dist/types/modes/acp/acp-mode.d.ts +0 -5
- package/dist/types/modes/acp/index.d.ts +0 -2
- package/dist/types/modes/acp/terminal-auth.d.ts +0 -6
- package/dist/types/modes/bridge/auth.d.ts +0 -12
- package/dist/types/modes/bridge/bridge-client-bridge.d.ts +0 -9
- package/dist/types/modes/bridge/bridge-mode.d.ts +0 -47
- package/dist/types/modes/bridge/bridge-ui-context.d.ts +0 -88
- package/dist/types/modes/bridge/event-stream.d.ts +0 -8
- package/dist/types/modes/components/agent-dashboard.d.ts +0 -21
- package/dist/types/modes/components/assistant-message.d.ts +0 -20
- package/dist/types/modes/components/bash-execution.d.ts +0 -29
- package/dist/types/modes/components/bordered-loader.d.ts +0 -11
- package/dist/types/modes/components/branch-summary-message.d.ts +0 -13
- package/dist/types/modes/components/btw-panel.d.ts +0 -16
- package/dist/types/modes/components/compaction-summary-message.d.ts +0 -13
- package/dist/types/modes/components/countdown-timer.d.ts +0 -14
- package/dist/types/modes/components/custom-editor.d.ts +0 -67
- package/dist/types/modes/components/custom-message.d.ts +0 -15
- package/dist/types/modes/components/custom-model-preset-wizard.d.ts +0 -12
- package/dist/types/modes/components/custom-provider-wizard.d.ts +0 -10
- package/dist/types/modes/components/diff.d.ts +0 -11
- package/dist/types/modes/components/dynamic-border.d.ts +0 -14
- package/dist/types/modes/components/eval-execution.d.ts +0 -23
- package/dist/types/modes/components/execution-shared.d.ts +0 -46
- package/dist/types/modes/components/extensions/extension-dashboard.d.ts +0 -26
- package/dist/types/modes/components/extensions/extension-list.d.ts +0 -39
- package/dist/types/modes/components/extensions/index.d.ts +0 -8
- package/dist/types/modes/components/extensions/inspector-panel.d.ts +0 -8
- package/dist/types/modes/components/extensions/state-manager.d.ts +0 -50
- package/dist/types/modes/components/extensions/types.d.ts +0 -151
- package/dist/types/modes/components/footer.d.ts +0 -30
- package/dist/types/modes/components/history-search.d.ts +0 -7
- package/dist/types/modes/components/hook-editor.d.ts +0 -18
- package/dist/types/modes/components/hook-input.d.ts +0 -15
- package/dist/types/modes/components/hook-message.d.ts +0 -15
- package/dist/types/modes/components/hook-selector.d.ts +0 -53
- package/dist/types/modes/components/index.d.ts +0 -35
- package/dist/types/modes/components/jobs-overlay-model.d.ts +0 -31
- package/dist/types/modes/components/jobs-overlay.d.ts +0 -30
- package/dist/types/modes/components/keybinding-hints.d.ts +0 -40
- package/dist/types/modes/components/login-dialog.d.ts +0 -32
- package/dist/types/modes/components/message-frame.d.ts +0 -42
- package/dist/types/modes/components/model-selector.d.ts +0 -60
- package/dist/types/modes/components/oauth-selector.d.ts +0 -17
- package/dist/types/modes/components/plugin-selector.d.ts +0 -26
- package/dist/types/modes/components/plugin-settings.d.ts +0 -66
- package/dist/types/modes/components/provider-onboarding-selector.d.ts +0 -7
- package/dist/types/modes/components/queue-mode-selector.d.ts +0 -9
- package/dist/types/modes/components/queued-message-selector.d.ts +0 -12
- package/dist/types/modes/components/read-tool-group.d.ts +0 -30
- package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +0 -26
- package/dist/types/modes/components/session-observer-overlay.d.ts +0 -11
- package/dist/types/modes/components/session-selector.d.ts +0 -30
- package/dist/types/modes/components/settings-defs.d.ts +0 -50
- package/dist/types/modes/components/settings-selector.d.ts +0 -62
- package/dist/types/modes/components/show-images-selector.d.ts +0 -9
- package/dist/types/modes/components/skill-hud/render.d.ts +0 -2
- package/dist/types/modes/components/skill-message.d.ts +0 -10
- package/dist/types/modes/components/status-line/context-thresholds.d.ts +0 -4
- package/dist/types/modes/components/status-line/git-utils.d.ts +0 -28
- package/dist/types/modes/components/status-line/index.d.ts +0 -4
- package/dist/types/modes/components/status-line/presets.d.ts +0 -3
- package/dist/types/modes/components/status-line/segments.d.ts +0 -5
- package/dist/types/modes/components/status-line/separators.d.ts +0 -3
- package/dist/types/modes/components/status-line/token-rate.d.ts +0 -10
- package/dist/types/modes/components/status-line/types.d.ts +0 -77
- package/dist/types/modes/components/status-line.d.ts +0 -103
- package/dist/types/modes/components/theme-selector.d.ts +0 -10
- package/dist/types/modes/components/thinking-selector.d.ts +0 -15
- package/dist/types/modes/components/todo-reminder.d.ts +0 -13
- package/dist/types/modes/components/tool-execution.d.ts +0 -54
- package/dist/types/modes/components/tree-selector.d.ts +0 -31
- package/dist/types/modes/components/ttsr-notification.d.ts +0 -13
- package/dist/types/modes/components/two-column-body.d.ts +0 -9
- package/dist/types/modes/components/user-message-selector.d.ts +0 -28
- package/dist/types/modes/components/user-message.d.ts +0 -7
- package/dist/types/modes/components/visual-truncate.d.ts +0 -19
- package/dist/types/modes/components/welcome.d.ts +0 -45
- package/dist/types/modes/controllers/btw-controller.d.ts +0 -10
- package/dist/types/modes/controllers/command-controller-shared.d.ts +0 -47
- package/dist/types/modes/controllers/command-controller.d.ts +0 -40
- package/dist/types/modes/controllers/event-controller.d.ts +0 -17
- package/dist/types/modes/controllers/extension-ui-controller.d.ts +0 -80
- package/dist/types/modes/controllers/input-controller.d.ts +0 -42
- package/dist/types/modes/controllers/runtime-mcp-command-controller.d.ts +0 -10
- package/dist/types/modes/controllers/selector-controller.d.ts +0 -67
- package/dist/types/modes/controllers/ssh-command-controller.d.ts +0 -10
- package/dist/types/modes/controllers/todo-command-controller.d.ts +0 -7
- package/dist/types/modes/emoji-autocomplete.d.ts +0 -16
- package/dist/types/modes/index.d.ts +0 -10
- package/dist/types/modes/interactive-mode.d.ts +0 -275
- package/dist/types/modes/jobs-observer.d.ts +0 -57
- package/dist/types/modes/oauth-manual-input.d.ts +0 -8
- package/dist/types/modes/print-mode.d.ts +0 -45
- package/dist/types/modes/prompt-action-autocomplete.d.ts +0 -50
- package/dist/types/modes/rpc/host-tools.d.ts +0 -1
- package/dist/types/modes/rpc/host-uris.d.ts +0 -1
- package/dist/types/modes/rpc/rpc-client.d.ts +0 -288
- package/dist/types/modes/rpc/rpc-mode.d.ts +0 -85
- package/dist/types/modes/rpc/rpc-socket-security.d.ts +0 -10
- package/dist/types/modes/rpc/rpc-types.d.ts +0 -794
- package/dist/types/modes/runtime-init.d.ts +0 -21
- package/dist/types/modes/session-observer-registry.d.ts +0 -26
- package/dist/types/modes/shared/agent-wire/approval-gate.d.ts +0 -57
- package/dist/types/modes/shared/agent-wire/command-contract.d.ts +0 -18
- package/dist/types/modes/shared/agent-wire/command-dispatch.d.ts +0 -37
- package/dist/types/modes/shared/agent-wire/command-validation.d.ts +0 -2
- package/dist/types/modes/shared/agent-wire/deep-interview-gate.d.ts +0 -94
- package/dist/types/modes/shared/agent-wire/event-contract.d.ts +0 -103
- package/dist/types/modes/shared/agent-wire/event-envelope.d.ts +0 -60
- package/dist/types/modes/shared/agent-wire/event-observation.d.ts +0 -37
- package/dist/types/modes/shared/agent-wire/handshake.d.ts +0 -56
- package/dist/types/modes/shared/agent-wire/host-tool-bridge.d.ts +0 -16
- package/dist/types/modes/shared/agent-wire/host-uri-bridge.d.ts +0 -17
- package/dist/types/modes/shared/agent-wire/protocol.d.ts +0 -25
- package/dist/types/modes/shared/agent-wire/responses.d.ts +0 -4
- package/dist/types/modes/shared/agent-wire/scopes.d.ts +0 -18
- package/dist/types/modes/shared/agent-wire/session-registry.d.ts +0 -25
- package/dist/types/modes/shared/agent-wire/ui-request-broker.d.ts +0 -42
- package/dist/types/modes/shared/agent-wire/ui-result.d.ts +0 -27
- package/dist/types/modes/shared/agent-wire/unattended-action-policy.d.ts +0 -29
- package/dist/types/modes/shared/agent-wire/unattended-audit.d.ts +0 -68
- package/dist/types/modes/shared/agent-wire/unattended-run-controller.d.ts +0 -161
- package/dist/types/modes/shared/agent-wire/unattended-session.d.ts +0 -82
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +0 -114
- package/dist/types/modes/shared/agent-wire/workflow-gate-schema.d.ts +0 -39
- package/dist/types/modes/shared.d.ts +0 -15
- package/dist/types/modes/slash-command-visibility.d.ts +0 -1
- package/dist/types/modes/theme/defaults/index.d.ts +0 -652
- package/dist/types/modes/theme/mermaid-cache.d.ts +0 -9
- package/dist/types/modes/theme/shimmer.d.ts +0 -38
- package/dist/types/modes/theme/theme.d.ts +0 -275
- package/dist/types/modes/tmux-scroll.d.ts +0 -18
- package/dist/types/modes/types.d.ts +0 -292
- package/dist/types/modes/utils/abort-message.d.ts +0 -4
- package/dist/types/modes/utils/context-usage.d.ts +0 -51
- package/dist/types/modes/utils/hotkeys-markdown.d.ts +0 -5
- package/dist/types/modes/utils/injected-user-submission.d.ts +0 -52
- package/dist/types/modes/utils/keybinding-matchers.d.ts +0 -10
- package/dist/types/modes/utils/terminal-bell.d.ts +0 -3
- package/dist/types/modes/utils/tools-markdown.d.ts +0 -5
- package/dist/types/modes/utils/ui-helpers.d.ts +0 -54
- package/dist/types/notifications/attachment-registry.d.ts +0 -17
- package/dist/types/notifications/chat-adapters.d.ts +0 -9
- package/dist/types/notifications/config-commands.d.ts +0 -64
- package/dist/types/notifications/config.d.ts +0 -98
- package/dist/types/notifications/daemon-paths.d.ts +0 -10
- package/dist/types/notifications/engine.d.ts +0 -59
- package/dist/types/notifications/helpers.d.ts +0 -55
- package/dist/types/notifications/html-format.d.ts +0 -75
- package/dist/types/notifications/index.d.ts +0 -192
- package/dist/types/notifications/lifecycle-commands.d.ts +0 -69
- package/dist/types/notifications/lifecycle-control-runtime.d.ts +0 -99
- package/dist/types/notifications/lifecycle-orchestrator.d.ts +0 -144
- package/dist/types/notifications/managed-daemon.d.ts +0 -48
- package/dist/types/notifications/operator-runtime.d.ts +0 -52
- package/dist/types/notifications/rate-limit-pool.d.ts +0 -95
- package/dist/types/notifications/recent-activity.d.ts +0 -39
- package/dist/types/notifications/reply-sent-store.d.ts +0 -53
- package/dist/types/notifications/rich-draft.d.ts +0 -68
- package/dist/types/notifications/rich-render.d.ts +0 -90
- package/dist/types/notifications/telegram-cli.d.ts +0 -19
- package/dist/types/notifications/telegram-daemon-cli.d.ts +0 -28
- package/dist/types/notifications/telegram-daemon-control.d.ts +0 -64
- package/dist/types/notifications/telegram-daemon.d.ts +0 -429
- package/dist/types/notifications/telegram-reference.d.ts +0 -119
- package/dist/types/notifications/threaded-inbound.d.ts +0 -77
- package/dist/types/notifications/threaded-render.d.ts +0 -88
- package/dist/types/notifications/topic-registry.d.ts +0 -69
- package/dist/types/plan-mode/approved-plan.d.ts +0 -49
- package/dist/types/plan-mode/state.d.ts +0 -6
- package/dist/types/registry/agent-registry.d.ts +0 -62
- package/dist/types/reminders/star-reminder.d.ts +0 -115
- package/dist/types/research-plan/index.d.ts +0 -1
- package/dist/types/research-plan/ledger.d.ts +0 -33
- package/dist/types/rlm/artifacts.d.ts +0 -9
- package/dist/types/rlm/complete-research-tool.d.ts +0 -35
- package/dist/types/rlm/data-context.d.ts +0 -6
- package/dist/types/rlm/index.d.ts +0 -47
- package/dist/types/rlm/notebook.d.ts +0 -12
- package/dist/types/rlm/preset.d.ts +0 -23
- package/dist/types/rlm/python-tool.d.ts +0 -16
- package/dist/types/rlm/report.d.ts +0 -14
- package/dist/types/rlm/types.d.ts +0 -37
- package/dist/types/runtime/process-lifecycle.d.ts +0 -108
- package/dist/types/runtime-api-key.d.ts +0 -7
- package/dist/types/runtime-credential-selector.d.ts +0 -7
- package/dist/types/runtime-mcp/client.d.ts +0 -74
- package/dist/types/runtime-mcp/config-writer.d.ts +0 -88
- package/dist/types/runtime-mcp/config.d.ts +0 -77
- package/dist/types/runtime-mcp/discoverable-tool-metadata.d.ts +0 -7
- package/dist/types/runtime-mcp/index.d.ts +0 -18
- package/dist/types/runtime-mcp/json-rpc.d.ts +0 -22
- package/dist/types/runtime-mcp/loader.d.ts +0 -45
- package/dist/types/runtime-mcp/manager.d.ts +0 -195
- package/dist/types/runtime-mcp/oauth-discovery.d.ts +0 -40
- package/dist/types/runtime-mcp/oauth-flow.d.ts +0 -59
- package/dist/types/runtime-mcp/render.d.ts +0 -25
- package/dist/types/runtime-mcp/smithery-auth.d.ts +0 -16
- package/dist/types/runtime-mcp/smithery-connect.d.ts +0 -38
- package/dist/types/runtime-mcp/smithery-registry.d.ts +0 -51
- package/dist/types/runtime-mcp/tool-bridge.d.ts +0 -86
- package/dist/types/runtime-mcp/tool-cache.d.ts +0 -8
- package/dist/types/runtime-mcp/transports/http.d.ts +0 -36
- package/dist/types/runtime-mcp/transports/index.d.ts +0 -5
- package/dist/types/runtime-mcp/transports/stdio.d.ts +0 -29
- package/dist/types/runtime-mcp/types.d.ts +0 -348
- package/dist/types/sdk.d.ts +0 -254
- package/dist/types/secrets/index.d.ts +0 -9
- package/dist/types/secrets/obfuscator.d.ts +0 -23
- package/dist/types/secrets/regex.d.ts +0 -2
- package/dist/types/session/agent-session.d.ts +0 -1185
- package/dist/types/session/agent-storage.d.ts +0 -101
- package/dist/types/session/artifacts.d.ts +0 -64
- package/dist/types/session/auth-broker-config.d.ts +0 -13
- package/dist/types/session/auth-storage.d.ts +0 -6
- package/dist/types/session/blob-store.d.ts +0 -160
- package/dist/types/session/client-bridge.d.ts +0 -88
- package/dist/types/session/contribution-prep.d.ts +0 -47
- package/dist/types/session/file-mention-pruning.d.ts +0 -8
- package/dist/types/session/history-storage.d.ts +0 -16
- package/dist/types/session/messages.d.ts +0 -169
- package/dist/types/session/session-dump-format.d.ts +0 -22
- package/dist/types/session/session-manager.d.ts +0 -660
- package/dist/types/session/session-storage.d.ts +0 -88
- package/dist/types/session/streaming-output.d.ts +0 -209
- package/dist/types/session/tool-choice-queue.d.ts +0 -84
- package/dist/types/session/yield-queue.d.ts +0 -24
- package/dist/types/setup/credential-auto-import.d.ts +0 -63
- package/dist/types/setup/credential-import.d.ts +0 -82
- package/dist/types/setup/hermes-setup.d.ts +0 -78
- package/dist/types/setup/host-plugin-setup.d.ts +0 -39
- package/dist/types/setup/model-onboarding-guidance.d.ts +0 -9
- package/dist/types/setup/provider-onboarding.d.ts +0 -52
- package/dist/types/skc-runtime/cli-write-receipt.d.ts +0 -24
- package/dist/types/skc-runtime/deep-interview-ambiguity.d.ts +0 -39
- package/dist/types/skc-runtime/deep-interview-recorder.d.ts +0 -114
- package/dist/types/skc-runtime/deep-interview-runtime.d.ts +0 -36
- package/dist/types/skc-runtime/deep-interview-state.d.ts +0 -127
- package/dist/types/skc-runtime/gc-render.d.ts +0 -6
- package/dist/types/skc-runtime/gc-runtime.d.ts +0 -134
- package/dist/types/skc-runtime/goal-mode-request.d.ts +0 -53
- package/dist/types/skc-runtime/launch-tmux.d.ts +0 -78
- package/dist/types/skc-runtime/launch-worktree.d.ts +0 -46
- package/dist/types/skc-runtime/ledger-event-renderer.d.ts +0 -68
- package/dist/types/skc-runtime/psmux-detect.d.ts +0 -78
- package/dist/types/skc-runtime/ralplan-runtime.d.ts +0 -26
- package/dist/types/skc-runtime/restricted-role-agent-bash.d.ts +0 -3
- package/dist/types/skc-runtime/session-layout.d.ts +0 -59
- package/dist/types/skc-runtime/session-resolution.d.ts +0 -47
- package/dist/types/skc-runtime/session-state-sidecar.d.ts +0 -39
- package/dist/types/skc-runtime/state-graph.d.ts +0 -4
- package/dist/types/skc-runtime/state-migrations.d.ts +0 -33
- package/dist/types/skc-runtime/state-renderer.d.ts +0 -70
- package/dist/types/skc-runtime/state-runtime.d.ts +0 -38
- package/dist/types/skc-runtime/state-schema.d.ts +0 -319
- package/dist/types/skc-runtime/state-validation.d.ts +0 -6
- package/dist/types/skc-runtime/state-writer.d.ts +0 -244
- package/dist/types/skc-runtime/team-gc.d.ts +0 -7
- package/dist/types/skc-runtime/team-runtime.d.ts +0 -355
- package/dist/types/skc-runtime/tmux-common.d.ts +0 -105
- package/dist/types/skc-runtime/tmux-gc.d.ts +0 -7
- package/dist/types/skc-runtime/tmux-sessions.d.ts +0 -62
- package/dist/types/skc-runtime/ultragoal-guard.d.ts +0 -93
- package/dist/types/skc-runtime/ultragoal-receipt-freshness.d.ts +0 -42
- package/dist/types/skc-runtime/ultragoal-runtime.d.ts +0 -410
- package/dist/types/skc-runtime/workflow-command-ref.d.ts +0 -43
- package/dist/types/skc-runtime/workflow-manifest.d.ts +0 -54
- package/dist/types/skill-state/active-state.d.ts +0 -126
- package/dist/types/skill-state/canonical-skills.d.ts +0 -3
- package/dist/types/skill-state/deep-interview-mutation-guard.d.ts +0 -38
- package/dist/types/skill-state/initial-phase.d.ts +0 -12
- package/dist/types/skill-state/workflow-hud.d.ts +0 -83
- package/dist/types/skill-state/workflow-state-contract.d.ts +0 -57
- package/dist/types/skill-state/workflow-state-version.d.ts +0 -3
- package/dist/types/slash-commands/acp-builtins.d.ts +0 -18
- package/dist/types/slash-commands/builtin-registry.d.ts +0 -24
- package/dist/types/slash-commands/helpers/context-report.d.ts +0 -7
- package/dist/types/slash-commands/helpers/fast-status-report.d.ts +0 -82
- package/dist/types/slash-commands/helpers/format.d.ts +0 -10
- package/dist/types/slash-commands/helpers/mcp.d.ts +0 -3
- package/dist/types/slash-commands/helpers/parse.d.ts +0 -33
- package/dist/types/slash-commands/helpers/ssh.d.ts +0 -3
- package/dist/types/slash-commands/helpers/todo.d.ts +0 -3
- package/dist/types/slash-commands/helpers/usage-report.d.ts +0 -7
- package/dist/types/slash-commands/types.d.ts +0 -120
- package/dist/types/ssh/config-writer.d.ts +0 -49
- package/dist/types/ssh/connection-manager.d.ts +0 -33
- package/dist/types/ssh/ssh-executor.d.ts +0 -37
- package/dist/types/ssh/sshfs-mount.d.ts +0 -6
- package/dist/types/ssh/utils.d.ts +0 -2
- package/dist/types/stt/downloader.d.ts +0 -9
- package/dist/types/stt/index.d.ts +0 -3
- package/dist/types/stt/recorder.d.ts +0 -13
- package/dist/types/stt/setup.d.ts +0 -18
- package/dist/types/stt/stt-controller.d.ts +0 -16
- package/dist/types/stt/transcriber.d.ts +0 -16
- package/dist/types/system-prompt.d.ts +0 -118
- package/dist/types/task/agents.d.ts +0 -28
- package/dist/types/task/commands.d.ts +0 -35
- package/dist/types/task/discovery.d.ts +0 -19
- package/dist/types/task/executor.d.ts +0 -124
- package/dist/types/task/fork-context-advisory.d.ts +0 -13
- package/dist/types/task/fork-context-budget.d.ts +0 -7
- package/dist/types/task/id.d.ts +0 -7
- package/dist/types/task/index.d.ts +0 -43
- package/dist/types/task/name-generator.d.ts +0 -16
- package/dist/types/task/output-manager.d.ts +0 -36
- package/dist/types/task/parallel.d.ts +0 -34
- package/dist/types/task/receipt.d.ts +0 -87
- package/dist/types/task/render.d.ts +0 -28
- package/dist/types/task/roi-reconciliation.d.ts +0 -27
- package/dist/types/task/simple-mode.d.ts +0 -8
- package/dist/types/task/skc-command.d.ts +0 -7
- package/dist/types/task/spawn-gate.d.ts +0 -29
- package/dist/types/task/subprocess-tool-registry.d.ts +0 -72
- package/dist/types/task/token-log.d.ts +0 -30
- package/dist/types/task/token-log.test.d.ts +0 -1
- package/dist/types/task/types.d.ts +0 -508
- package/dist/types/task/worktree.d.ts +0 -94
- package/dist/types/thinking-metadata.d.ts +0 -16
- package/dist/types/thinking.d.ts +0 -22
- package/dist/types/tool-discovery/tool-index.d.ts +0 -112
- package/dist/types/tools/archive-reader.d.ts +0 -40
- package/dist/types/tools/ask-answer-registry.d.ts +0 -13
- package/dist/types/tools/ask.d.ts +0 -123
- package/dist/types/tools/ast-edit.d.ts +0 -77
- package/dist/types/tools/ast-grep.d.ts +0 -69
- package/dist/types/tools/auto-generated-guard.d.ts +0 -17
- package/dist/types/tools/bash-allowed-prefixes.d.ts +0 -10
- package/dist/types/tools/bash-command-fixup.d.ts +0 -11
- package/dist/types/tools/bash-interactive.d.ts +0 -16
- package/dist/types/tools/bash-interceptor.d.ts +0 -24
- package/dist/types/tools/bash-pty-selection.d.ts +0 -7
- package/dist/types/tools/bash-skill-urls.d.ts +0 -31
- package/dist/types/tools/bash.d.ts +0 -157
- package/dist/types/tools/bisect.d.ts +0 -81
- package/dist/types/tools/browser/actions.d.ts +0 -54
- package/dist/types/tools/browser/attach.d.ts +0 -50
- package/dist/types/tools/browser/launch.d.ts +0 -62
- package/dist/types/tools/browser/readable.d.ts +0 -17
- package/dist/types/tools/browser/registry.d.ts +0 -57
- package/dist/types/tools/browser/render.d.ts +0 -53
- package/dist/types/tools/browser/tab-protocol.d.ts +0 -144
- package/dist/types/tools/browser/tab-supervisor.d.ts +0 -103
- package/dist/types/tools/browser/tab-worker-entry.d.ts +0 -1
- package/dist/types/tools/browser/tab-worker.d.ts +0 -19
- package/dist/types/tools/browser.d.ts +0 -211
- package/dist/types/tools/calculator.d.ts +0 -76
- package/dist/types/tools/checkpoint.d.ts +0 -63
- package/dist/types/tools/composer-bash-policy.d.ts +0 -14
- package/dist/types/tools/computer/render.d.ts +0 -17
- package/dist/types/tools/computer-gc.d.ts +0 -23
- package/dist/types/tools/computer.d.ts +0 -465
- package/dist/types/tools/conflict-detect.d.ts +0 -205
- package/dist/types/tools/context.d.ts +0 -19
- package/dist/types/tools/cron.d.ts +0 -91
- package/dist/types/tools/debug.d.ts +0 -209
- package/dist/types/tools/eval.d.ts +0 -108
- package/dist/types/tools/fetch.d.ts +0 -84
- package/dist/types/tools/file-recorder.d.ts +0 -13
- package/dist/types/tools/find.d.ts +0 -95
- package/dist/types/tools/fs-cache-invalidation.d.ts +0 -15
- package/dist/types/tools/gh-format.d.ts +0 -6
- package/dist/types/tools/gh-renderer.d.ts +0 -25
- package/dist/types/tools/gh.d.ts +0 -356
- package/dist/types/tools/github-cache.d.ts +0 -103
- package/dist/types/tools/grouped-file-output.d.ts +0 -36
- package/dist/types/tools/hindsight-recall.d.ts +0 -21
- package/dist/types/tools/hindsight-reflect.d.ts +0 -23
- package/dist/types/tools/hindsight-retain.d.ts +0 -27
- package/dist/types/tools/image-gen.d.ts +0 -79
- package/dist/types/tools/index.d.ts +0 -319
- package/dist/types/tools/irc.d.ts +0 -79
- package/dist/types/tools/job.d.ts +0 -78
- package/dist/types/tools/json-tree.d.ts +0 -23
- package/dist/types/tools/jtd-to-json-schema.d.ts +0 -29
- package/dist/types/tools/jtd-to-typescript.d.ts +0 -26
- package/dist/types/tools/jtd-utils.d.ts +0 -42
- package/dist/types/tools/list-limit.d.ts +0 -12
- package/dist/types/tools/match-line-format.d.ts +0 -11
- package/dist/types/tools/monitor.d.ts +0 -54
- package/dist/types/tools/output-meta.d.ts +0 -204
- package/dist/types/tools/path-utils.d.ts +0 -147
- package/dist/types/tools/plan-mode-guard.d.ts +0 -18
- package/dist/types/tools/read.d.ts +0 -85
- package/dist/types/tools/recipe/index.d.ts +0 -45
- package/dist/types/tools/recipe/render.d.ts +0 -36
- package/dist/types/tools/recipe/runner.d.ts +0 -60
- package/dist/types/tools/recipe/runners/cargo.d.ts +0 -16
- package/dist/types/tools/recipe/runners/index.d.ts +0 -2
- package/dist/types/tools/recipe/runners/just.d.ts +0 -2
- package/dist/types/tools/recipe/runners/make.d.ts +0 -2
- package/dist/types/tools/recipe/runners/pkg.d.ts +0 -2
- package/dist/types/tools/recipe/runners/task.d.ts +0 -2
- package/dist/types/tools/render-mermaid.d.ts +0 -37
- package/dist/types/tools/render-utils.d.ts +0 -158
- package/dist/types/tools/renderers.d.ts +0 -26
- package/dist/types/tools/resolve.d.ts +0 -80
- package/dist/types/tools/resource-gc.d.ts +0 -54
- package/dist/types/tools/review.d.ts +0 -63
- package/dist/types/tools/search-tool-bm25.d.ts +0 -65
- package/dist/types/tools/search.d.ts +0 -93
- package/dist/types/tools/skill-discovery.d.ts +0 -40
- package/dist/types/tools/skill.d.ts +0 -47
- package/dist/types/tools/sqlite-reader.d.ts +0 -94
- package/dist/types/tools/ssh.d.ts +0 -67
- package/dist/types/tools/subagent-render.d.ts +0 -31
- package/dist/types/tools/subagent.d.ts +0 -117
- package/dist/types/tools/telegram-send.d.ts +0 -32
- package/dist/types/tools/todo-write.d.ts +0 -120
- package/dist/types/tools/tool-errors.d.ts +0 -33
- package/dist/types/tools/tool-result.d.ts +0 -30
- package/dist/types/tools/tool-timeouts.d.ts +0 -56
- package/dist/types/tools/ultragoal-ask-guard.d.ts +0 -12
- package/dist/types/tools/vim.d.ts +0 -58
- package/dist/types/tools/write.d.ts +0 -59
- package/dist/types/tools/yield.d.ts +0 -25
- package/dist/types/tui/code-cell.d.ts +0 -32
- package/dist/types/tui/file-list.d.ts +0 -22
- package/dist/types/tui/hyperlink.d.ts +0 -42
- package/dist/types/tui/index.d.ts +0 -11
- package/dist/types/tui/output-block.d.ts +0 -28
- package/dist/types/tui/status-line.d.ts +0 -18
- package/dist/types/tui/tree-list.d.ts +0 -19
- package/dist/types/tui/types.d.ts +0 -13
- package/dist/types/tui/utils.d.ts +0 -36
- package/dist/types/utils/changelog.d.ts +0 -37
- package/dist/types/utils/clipboard.d.ts +0 -22
- package/dist/types/utils/cmux-workspace.d.ts +0 -52
- package/dist/types/utils/command-args.d.ts +0 -9
- package/dist/types/utils/commit-message-generator.d.ts +0 -7
- package/dist/types/utils/edit-mode.d.ts +0 -13
- package/dist/types/utils/event-bus.d.ts +0 -6
- package/dist/types/utils/external-editor.d.ts +0 -17
- package/dist/types/utils/file-display-mode.d.ts +0 -27
- package/dist/types/utils/file-mentions.d.ts +0 -25
- package/dist/types/utils/git.d.ts +0 -393
- package/dist/types/utils/image-loading.d.ts +0 -26
- package/dist/types/utils/image-resize.d.ts +0 -39
- package/dist/types/utils/lang-from-path.d.ts +0 -8
- package/dist/types/utils/markit.d.ts +0 -7
- package/dist/types/utils/open.d.ts +0 -2
- package/dist/types/utils/pasted-image-path.d.ts +0 -30
- package/dist/types/utils/session-color.d.ts +0 -10
- package/dist/types/utils/shell-snapshot.d.ts +0 -5
- package/dist/types/utils/sixel.d.ts +0 -21
- package/dist/types/utils/title-generator.d.ts +0 -31
- package/dist/types/utils/tool-choice.d.ts +0 -20
- package/dist/types/utils/tools-manager.d.ts +0 -9
- package/dist/types/vim/buffer.d.ts +0 -41
- package/dist/types/vim/commands.d.ts +0 -6
- package/dist/types/vim/engine.d.ts +0 -47
- package/dist/types/vim/parser.d.ts +0 -3
- package/dist/types/vim/render.d.ts +0 -25
- package/dist/types/vim/types.d.ts +0 -182
- package/dist/types/web/insane/bridge.d.ts +0 -103
- package/dist/types/web/insane/url-guard.d.ts +0 -25
- package/dist/types/web/kagi.d.ts +0 -23
- package/dist/types/web/parallel.d.ts +0 -58
- package/dist/types/web/scrapers/artifacthub.d.ts +0 -6
- package/dist/types/web/scrapers/arxiv.d.ts +0 -5
- package/dist/types/web/scrapers/aur.d.ts +0 -5
- package/dist/types/web/scrapers/biorxiv.d.ts +0 -5
- package/dist/types/web/scrapers/bluesky.d.ts +0 -5
- package/dist/types/web/scrapers/brew.d.ts +0 -5
- package/dist/types/web/scrapers/cheatsh.d.ts +0 -8
- package/dist/types/web/scrapers/chocolatey.d.ts +0 -5
- package/dist/types/web/scrapers/choosealicense.d.ts +0 -2
- package/dist/types/web/scrapers/cisa-kev.d.ts +0 -5
- package/dist/types/web/scrapers/clojars.d.ts +0 -5
- package/dist/types/web/scrapers/coingecko.d.ts +0 -5
- package/dist/types/web/scrapers/crates-io.d.ts +0 -5
- package/dist/types/web/scrapers/crossref.d.ts +0 -2
- package/dist/types/web/scrapers/devto.d.ts +0 -5
- package/dist/types/web/scrapers/discogs.d.ts +0 -8
- package/dist/types/web/scrapers/discourse.d.ts +0 -5
- package/dist/types/web/scrapers/dockerhub.d.ts +0 -5
- package/dist/types/web/scrapers/docs-rs.d.ts +0 -2
- package/dist/types/web/scrapers/fdroid.d.ts +0 -5
- package/dist/types/web/scrapers/firefox-addons.d.ts +0 -2
- package/dist/types/web/scrapers/flathub.d.ts +0 -2
- package/dist/types/web/scrapers/github-gist.d.ts +0 -5
- package/dist/types/web/scrapers/github.d.ts +0 -12
- package/dist/types/web/scrapers/gitlab.d.ts +0 -5
- package/dist/types/web/scrapers/go-pkg.d.ts +0 -5
- package/dist/types/web/scrapers/hackage.d.ts +0 -5
- package/dist/types/web/scrapers/hackernews.d.ts +0 -2
- package/dist/types/web/scrapers/hex.d.ts +0 -5
- package/dist/types/web/scrapers/huggingface.d.ts +0 -2
- package/dist/types/web/scrapers/iacr.d.ts +0 -5
- package/dist/types/web/scrapers/index.d.ts +0 -84
- package/dist/types/web/scrapers/jetbrains-marketplace.d.ts +0 -2
- package/dist/types/web/scrapers/lemmy.d.ts +0 -2
- package/dist/types/web/scrapers/lobsters.d.ts +0 -5
- package/dist/types/web/scrapers/mastodon.d.ts +0 -5
- package/dist/types/web/scrapers/maven.d.ts +0 -6
- package/dist/types/web/scrapers/mdn.d.ts +0 -2
- package/dist/types/web/scrapers/metacpan.d.ts +0 -5
- package/dist/types/web/scrapers/musicbrainz.d.ts +0 -5
- package/dist/types/web/scrapers/npm.d.ts +0 -5
- package/dist/types/web/scrapers/nuget.d.ts +0 -5
- package/dist/types/web/scrapers/nvd.d.ts +0 -5
- package/dist/types/web/scrapers/ollama.d.ts +0 -2
- package/dist/types/web/scrapers/open-vsx.d.ts +0 -5
- package/dist/types/web/scrapers/opencorporates.d.ts +0 -5
- package/dist/types/web/scrapers/openlibrary.d.ts +0 -5
- package/dist/types/web/scrapers/orcid.d.ts +0 -5
- package/dist/types/web/scrapers/osv.d.ts +0 -5
- package/dist/types/web/scrapers/packagist.d.ts +0 -5
- package/dist/types/web/scrapers/pub-dev.d.ts +0 -5
- package/dist/types/web/scrapers/pubmed.d.ts +0 -5
- package/dist/types/web/scrapers/pypi.d.ts +0 -5
- package/dist/types/web/scrapers/rawg.d.ts +0 -2
- package/dist/types/web/scrapers/readthedocs.d.ts +0 -2
- package/dist/types/web/scrapers/reddit.d.ts +0 -5
- package/dist/types/web/scrapers/repology.d.ts +0 -5
- package/dist/types/web/scrapers/rfc.d.ts +0 -5
- package/dist/types/web/scrapers/rubygems.d.ts +0 -5
- package/dist/types/web/scrapers/searchcode.d.ts +0 -2
- package/dist/types/web/scrapers/sec-edgar.d.ts +0 -5
- package/dist/types/web/scrapers/semantic-scholar.d.ts +0 -2
- package/dist/types/web/scrapers/snapcraft.d.ts +0 -2
- package/dist/types/web/scrapers/sourcegraph.d.ts +0 -2
- package/dist/types/web/scrapers/spdx.d.ts +0 -5
- package/dist/types/web/scrapers/spotify.d.ts +0 -8
- package/dist/types/web/scrapers/stackoverflow.d.ts +0 -6
- package/dist/types/web/scrapers/terraform.d.ts +0 -5
- package/dist/types/web/scrapers/tldr.d.ts +0 -7
- package/dist/types/web/scrapers/twitter.d.ts +0 -5
- package/dist/types/web/scrapers/types.d.ts +0 -83
- package/dist/types/web/scrapers/utils.d.ts +0 -32
- package/dist/types/web/scrapers/vimeo.d.ts +0 -5
- package/dist/types/web/scrapers/vscode-marketplace.d.ts +0 -5
- package/dist/types/web/scrapers/w3c.d.ts +0 -2
- package/dist/types/web/scrapers/wikidata.d.ts +0 -5
- package/dist/types/web/scrapers/wikipedia.d.ts +0 -5
- package/dist/types/web/scrapers/youtube.d.ts +0 -13
- package/dist/types/web/search/index.d.ts +0 -118
- package/dist/types/web/search/provider.d.ts +0 -55
- package/dist/types/web/search/providers/anthropic.d.ts +0 -32
- package/dist/types/web/search/providers/base.d.ts +0 -90
- package/dist/types/web/search/providers/brave.d.ts +0 -27
- package/dist/types/web/search/providers/codex.d.ts +0 -35
- package/dist/types/web/search/providers/duckduckgo.d.ts +0 -57
- package/dist/types/web/search/providers/exa.d.ts +0 -52
- package/dist/types/web/search/providers/gemini.d.ts +0 -57
- package/dist/types/web/search/providers/insane.d.ts +0 -53
- package/dist/types/web/search/providers/jina.d.ts +0 -26
- package/dist/types/web/search/providers/kagi.d.ts +0 -24
- package/dist/types/web/search/providers/kimi.d.ts +0 -27
- package/dist/types/web/search/providers/openai-compatible.d.ts +0 -9
- package/dist/types/web/search/providers/parallel.d.ts +0 -15
- package/dist/types/web/search/providers/perplexity.d.ts +0 -38
- package/dist/types/web/search/providers/searxng.d.ts +0 -44
- package/dist/types/web/search/providers/synthetic.d.ts +0 -21
- package/dist/types/web/search/providers/tavily.d.ts +0 -29
- package/dist/types/web/search/providers/text-citations.d.ts +0 -23
- package/dist/types/web/search/providers/utils.d.ts +0 -88
- package/dist/types/web/search/providers/xai.d.ts +0 -64
- package/dist/types/web/search/providers/zai.d.ts +0 -28
- package/dist/types/web/search/render.d.ts +0 -36
- package/dist/types/web/search/types.d.ts +0 -372
- package/dist/types/web/search/utils.d.ts +0 -4
- package/dist/types/workflow/workflow-intent-diff.d.ts +0 -25
- package/dist/types/workflow/workflow-intent-report-consumer.d.ts +0 -50
- package/dist/types/workflow/workflow-intent-report-schema.d.ts +0 -2
- package/dist/types/workflow/workflow-intent-report.d.ts +0 -48
- package/dist/types/workspace-tree.d.ts +0 -42
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
type AgentMessage,
|
|
27
27
|
type AgentState,
|
|
28
28
|
type AgentTool,
|
|
29
|
+
assertImagePlaceholdersHavePayload,
|
|
30
|
+
canContinuePersistedHistory,
|
|
29
31
|
resolveTelemetry,
|
|
30
32
|
type StablePrefixSnapshot,
|
|
31
33
|
ThinkingLevel,
|
|
@@ -151,6 +153,7 @@ import { onAppendOnlyModeChanged } from "../config/settings";
|
|
|
151
153
|
import { RawSseDebugBuffer } from "../debug/raw-sse-buffer";
|
|
152
154
|
import { loadCapability } from "../discovery";
|
|
153
155
|
import { expandApplyPatchToEntries, normalizeDiff, normalizeToLF, ParseError, previewPatch, stripBom } from "../edit";
|
|
156
|
+
import { MAX_EDIT_FILE_BYTES } from "../edit/read-file";
|
|
154
157
|
import { disposeVmContextsByOwner } from "../eval/js/context-manager";
|
|
155
158
|
import {
|
|
156
159
|
disposeKernelSessionsByOwner,
|
|
@@ -203,6 +206,7 @@ import type { PlanModeState } from "../plan-mode/state";
|
|
|
203
206
|
import autoContinuePrompt from "../prompts/system/auto-continue.md" with { type: "text" };
|
|
204
207
|
import eagerTodoPrompt from "../prompts/system/eager-todo.md" with { type: "text" };
|
|
205
208
|
import ircIncomingTemplate from "../prompts/system/irc-incoming.md" with { type: "text" };
|
|
209
|
+
import ircPeerRosterTemplate from "../prompts/system/irc-peer-roster.md" with { type: "text" };
|
|
206
210
|
import planModeActivePrompt from "../prompts/system/plan-mode-active.md" with { type: "text" };
|
|
207
211
|
import planModeReferencePrompt from "../prompts/system/plan-mode-reference.md" with { type: "text" };
|
|
208
212
|
import planModeToolDecisionReminderPrompt from "../prompts/system/plan-mode-tool-decision-reminder.md" with {
|
|
@@ -252,7 +256,10 @@ import {
|
|
|
252
256
|
} from "../tool-discovery/tool-index";
|
|
253
257
|
import type { AskAnswerSource, ToolSession } from "../tools";
|
|
254
258
|
import { AskTool } from "../tools/ask";
|
|
255
|
-
import {
|
|
259
|
+
import {
|
|
260
|
+
getAskAnswerSource as getAskAnswerSourceFromRegistry,
|
|
261
|
+
notifyWorkflowGateEmitterChanged,
|
|
262
|
+
} from "../tools/ask-answer-registry";
|
|
256
263
|
import { assertEditableFile } from "../tools/auto-generated-guard";
|
|
257
264
|
import { releaseTabsForOwner } from "../tools/browser/tab-supervisor";
|
|
258
265
|
import type { CheckpointState } from "../tools/checkpoint";
|
|
@@ -289,6 +296,7 @@ import {
|
|
|
289
296
|
SILENT_ABORT_MARKER,
|
|
290
297
|
SKILL_PROMPT_MESSAGE_TYPE,
|
|
291
298
|
} from "./messages";
|
|
299
|
+
import { isLegacyProviderSafetyStopMessage } from "./provider-safety-stop";
|
|
292
300
|
import { formatSessionDumpText } from "./session-dump-format";
|
|
293
301
|
import type {
|
|
294
302
|
BranchSummaryEntry,
|
|
@@ -296,8 +304,13 @@ import type {
|
|
|
296
304
|
NewSessionOptions,
|
|
297
305
|
SessionContext,
|
|
298
306
|
SessionManager,
|
|
307
|
+
SessionManagerCloseOutcome,
|
|
308
|
+
} from "./session-manager";
|
|
309
|
+
import {
|
|
310
|
+
getLatestCompactionEntry,
|
|
311
|
+
getSessionMessageObservationId,
|
|
312
|
+
transferSessionMessageIdentity,
|
|
299
313
|
} from "./session-manager";
|
|
300
|
-
import { getLatestCompactionEntry } from "./session-manager";
|
|
301
314
|
import { ToolChoiceQueue } from "./tool-choice-queue";
|
|
302
315
|
import { YieldQueue } from "./yield-queue";
|
|
303
316
|
|
|
@@ -360,6 +373,11 @@ export interface AsyncJobSnapshot {
|
|
|
360
373
|
// Types
|
|
361
374
|
// ============================================================================
|
|
362
375
|
|
|
376
|
+
export interface RetainedMemorySample {
|
|
377
|
+
tuiChatChildren?: number;
|
|
378
|
+
tuiCachedRenderBytes?: number;
|
|
379
|
+
}
|
|
380
|
+
|
|
363
381
|
export interface AgentSessionConfig {
|
|
364
382
|
agent: Agent;
|
|
365
383
|
sessionManager: SessionManager;
|
|
@@ -439,6 +457,8 @@ export interface AgentSessionConfig {
|
|
|
439
457
|
* **MUST NOT** dispose it on their own teardown.
|
|
440
458
|
*/
|
|
441
459
|
ownedAsyncJobManager?: AsyncJobManager;
|
|
460
|
+
/** Cheap TUI retained-memory counters; absent for headless sessions. */
|
|
461
|
+
retainedMemorySampler?: () => RetainedMemorySample;
|
|
442
462
|
/**
|
|
443
463
|
* MCPManager whose lifecycle this session owns (top-level sessions that
|
|
444
464
|
* connected plugin-bundle MCP servers). Only the owned manager is
|
|
@@ -529,6 +549,7 @@ export interface SessionStats {
|
|
|
529
549
|
};
|
|
530
550
|
premiumRequests: number;
|
|
531
551
|
cost: number;
|
|
552
|
+
costBreakdown?: Usage["cost"];
|
|
532
553
|
}
|
|
533
554
|
|
|
534
555
|
/** Internal marker for hook messages queued through the agent loop */
|
|
@@ -1084,6 +1105,68 @@ export function buildContextInjectionSignature(kind: string, parts: readonly str
|
|
|
1084
1105
|
}
|
|
1085
1106
|
return hash.digest("base64url");
|
|
1086
1107
|
}
|
|
1108
|
+
|
|
1109
|
+
const STREAMING_EDIT_FILE_CACHE_MAX_ENTRIES = 16;
|
|
1110
|
+
const STREAMING_EDIT_FILE_CACHE_MAX_TOTAL_BYTES = 32 * 1024 * 1024;
|
|
1111
|
+
|
|
1112
|
+
type StreamingEditFileCacheEntry = {
|
|
1113
|
+
content: string;
|
|
1114
|
+
bytes: number;
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
export class StreamingEditFileCache {
|
|
1118
|
+
#entries = new Map<string, StreamingEditFileCacheEntry>();
|
|
1119
|
+
#totalBytes = 0;
|
|
1120
|
+
|
|
1121
|
+
get(path: string): string | undefined {
|
|
1122
|
+
const entry = this.#entries.get(path);
|
|
1123
|
+
if (entry === undefined) return undefined;
|
|
1124
|
+
this.#entries.delete(path);
|
|
1125
|
+
this.#entries.set(path, entry);
|
|
1126
|
+
return entry.content;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
set(path: string, content: string): void {
|
|
1130
|
+
const bytes = Buffer.byteLength(content, "utf8");
|
|
1131
|
+
if (bytes > MAX_EDIT_FILE_BYTES || bytes > STREAMING_EDIT_FILE_CACHE_MAX_TOTAL_BYTES) {
|
|
1132
|
+
this.delete(path);
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
this.delete(path);
|
|
1137
|
+
while (
|
|
1138
|
+
this.#entries.size >= STREAMING_EDIT_FILE_CACHE_MAX_ENTRIES ||
|
|
1139
|
+
this.#totalBytes + bytes > STREAMING_EDIT_FILE_CACHE_MAX_TOTAL_BYTES
|
|
1140
|
+
) {
|
|
1141
|
+
const oldestPath = this.#entries.keys().next().value;
|
|
1142
|
+
if (oldestPath === undefined) break;
|
|
1143
|
+
this.delete(oldestPath);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
this.#entries.set(path, { content, bytes });
|
|
1147
|
+
this.#totalBytes += bytes;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
delete(path: string): void {
|
|
1151
|
+
const entry = this.#entries.get(path);
|
|
1152
|
+
if (entry === undefined) return;
|
|
1153
|
+
this.#entries.delete(path);
|
|
1154
|
+
this.#totalBytes -= entry.bytes;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
clear(): void {
|
|
1158
|
+
this.#entries.clear();
|
|
1159
|
+
this.#totalBytes = 0;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
has(path: string): boolean {
|
|
1163
|
+
return this.#entries.has(path);
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
get totalBytes(): number {
|
|
1167
|
+
return this.#totalBytes;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1087
1170
|
export class AgentSession {
|
|
1088
1171
|
readonly agent: Agent;
|
|
1089
1172
|
readonly sessionManager: SessionManager;
|
|
@@ -1148,6 +1231,7 @@ export class AgentSession {
|
|
|
1148
1231
|
#compactionAbortController: AbortController | undefined = undefined;
|
|
1149
1232
|
#autoCompactionAbortController: AbortController | undefined = undefined;
|
|
1150
1233
|
#resourceSampler: () => EmergencyCompactionSample = () => this.#defaultResourceSample();
|
|
1234
|
+
#retainedMemorySampler: (() => RetainedMemorySample) | undefined;
|
|
1151
1235
|
#prePromptContextCheckPromise: Promise<void> | undefined = undefined;
|
|
1152
1236
|
|
|
1153
1237
|
// Branch summarization state
|
|
@@ -1198,6 +1282,9 @@ export class AgentSession {
|
|
|
1198
1282
|
// Agent identity + registry for IRC relay forwarding to the main session UI.
|
|
1199
1283
|
#agentId: string | undefined;
|
|
1200
1284
|
#agentRegistry: AgentRegistry | undefined;
|
|
1285
|
+
#lastDeliveredIrcRosterSignature: string | null = null;
|
|
1286
|
+
#ircRosterEpoch = 0;
|
|
1287
|
+
#ircRosterClaim: { token: symbol; signature: string; epoch: number } | null = null;
|
|
1201
1288
|
#providerSessionId: string | undefined;
|
|
1202
1289
|
#providerCacheSessionId: string | undefined;
|
|
1203
1290
|
#isDisposed = false;
|
|
@@ -1321,7 +1408,7 @@ export class AgentSession {
|
|
|
1321
1408
|
|
|
1322
1409
|
#streamingEditPrecheckedToolCallIds = new Set<string>();
|
|
1323
1410
|
|
|
1324
|
-
#streamingEditFileCache = new
|
|
1411
|
+
#streamingEditFileCache = new StreamingEditFileCache();
|
|
1325
1412
|
readonly streamingEditDebugCounters = {
|
|
1326
1413
|
guardRuns: 0,
|
|
1327
1414
|
processedChars: 0,
|
|
@@ -1447,6 +1534,7 @@ export class AgentSession {
|
|
|
1447
1534
|
// Power assertions are taken per turn (see #beginInFlight); nothing acquired here.
|
|
1448
1535
|
this.#evalKernelOwnerId = config.evalKernelOwnerId ?? `agent-session:${Snowflake.next()}`;
|
|
1449
1536
|
this.#ownedAsyncJobManager = config.ownedAsyncJobManager;
|
|
1537
|
+
this.#retainedMemorySampler = config.retainedMemorySampler;
|
|
1450
1538
|
this.#ownedMcpManager = config.ownedMcpManager;
|
|
1451
1539
|
this.#scopedModels = config.scopedModels ?? [];
|
|
1452
1540
|
this.#thinkingLevel = config.thinkingLevel;
|
|
@@ -2013,6 +2101,16 @@ export class AgentSession {
|
|
|
2013
2101
|
return queued;
|
|
2014
2102
|
}
|
|
2015
2103
|
|
|
2104
|
+
#persistRuntimeStateInBackground(event: AgentSessionEvent): void {
|
|
2105
|
+
void persistCoordinatorRuntimeStateFromEvent(event, {
|
|
2106
|
+
sessionId: this.sessionId,
|
|
2107
|
+
cwd: this.sessionManager.getCwd(),
|
|
2108
|
+
sessionFile: this.sessionManager.getSessionFile(),
|
|
2109
|
+
}).catch(() => {
|
|
2110
|
+
logger.warn("Failed to persist coordinator runtime state", { event: event.type });
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2016
2114
|
async #emitSessionEvent(event: AgentSessionEvent): Promise<void> {
|
|
2017
2115
|
if (event.type === "message_update") {
|
|
2018
2116
|
// Fast path: message_update maps to no sidecar state, so we must not
|
|
@@ -2024,12 +2122,7 @@ export class AgentSession {
|
|
|
2024
2122
|
}
|
|
2025
2123
|
return;
|
|
2026
2124
|
}
|
|
2027
|
-
const persistRuntimeState = () =>
|
|
2028
|
-
persistCoordinatorRuntimeStateFromEvent(event, {
|
|
2029
|
-
sessionId: this.sessionId,
|
|
2030
|
-
cwd: this.sessionManager.getCwd(),
|
|
2031
|
-
sessionFile: this.sessionManager.getSessionFile(),
|
|
2032
|
-
});
|
|
2125
|
+
const persistRuntimeState = () => this.#persistRuntimeStateInBackground(event);
|
|
2033
2126
|
// Hold the wire-level agent_end until in-flight prompts unwind. Subscribers
|
|
2034
2127
|
// (rpc-mode, ACP, Cursor) treat agent_end as the "session is idle" signal;
|
|
2035
2128
|
// emitting while #promptInFlightCount > 0 lets a client fire its next
|
|
@@ -2132,7 +2225,9 @@ export class AgentSession {
|
|
|
2132
2225
|
const message = event.message;
|
|
2133
2226
|
const deobfuscatedContent = obfuscator.deobfuscateObject(message.content);
|
|
2134
2227
|
if (deobfuscatedContent !== message.content) {
|
|
2135
|
-
|
|
2228
|
+
const displayMessage = { ...message, content: deobfuscatedContent };
|
|
2229
|
+
transferSessionMessageIdentity([message], [displayMessage]);
|
|
2230
|
+
displayEvent = { ...event, message: displayMessage };
|
|
2136
2231
|
}
|
|
2137
2232
|
}
|
|
2138
2233
|
|
|
@@ -2147,6 +2242,15 @@ export class AgentSession {
|
|
|
2147
2242
|
}
|
|
2148
2243
|
|
|
2149
2244
|
await this.#emitSessionEvent(displayEvent);
|
|
2245
|
+
if (
|
|
2246
|
+
displayEvent !== event &&
|
|
2247
|
+
displayEvent.type === "message_end" &&
|
|
2248
|
+
displayEvent.message.role === "assistant" &&
|
|
2249
|
+
event.type === "message_end" &&
|
|
2250
|
+
event.message.role === "assistant"
|
|
2251
|
+
) {
|
|
2252
|
+
transferSessionMessageIdentity([displayEvent.message], [event.message]);
|
|
2253
|
+
}
|
|
2150
2254
|
|
|
2151
2255
|
if (event.type === "turn_start") {
|
|
2152
2256
|
this.#resetStreamingEditState();
|
|
@@ -2316,14 +2420,20 @@ export class AgentSession {
|
|
|
2316
2420
|
if (event.type === "message_end") {
|
|
2317
2421
|
// Check if this is a hook/custom message
|
|
2318
2422
|
if (event.message.role === "hookMessage" || event.message.role === "custom") {
|
|
2319
|
-
//
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2423
|
+
// Roster reminders are request-context-only: never persist them, or a
|
|
2424
|
+
// reload would resurrect stale rosters into agent history.
|
|
2425
|
+
const isRosterReminder = event.message.role === "custom" && event.message.customType === "irc-peer-roster";
|
|
2426
|
+
if (!isRosterReminder) {
|
|
2427
|
+
// Persist as CustomMessageEntry
|
|
2428
|
+
this.sessionManager.appendCustomMessageEntry(
|
|
2429
|
+
event.message.customType,
|
|
2430
|
+
event.message.content,
|
|
2431
|
+
event.message.display,
|
|
2432
|
+
event.message.details,
|
|
2433
|
+
event.message.attribution ?? "agent",
|
|
2434
|
+
getSessionMessageObservationId(event.message),
|
|
2435
|
+
);
|
|
2436
|
+
}
|
|
2327
2437
|
if (event.message.role === "custom" && event.message.customType === "ttsr-injection") {
|
|
2328
2438
|
this.#markTtsrInjected(this.#extractTtsrRuleNames(event.message.details));
|
|
2329
2439
|
}
|
|
@@ -2688,8 +2798,7 @@ export class AgentSession {
|
|
|
2688
2798
|
}
|
|
2689
2799
|
|
|
2690
2800
|
#isResumableAgentTail(): boolean {
|
|
2691
|
-
|
|
2692
|
-
return lastMsg !== undefined && lastMsg.role !== "assistant";
|
|
2801
|
+
return canContinuePersistedHistory(this.agent.state.messages);
|
|
2693
2802
|
}
|
|
2694
2803
|
|
|
2695
2804
|
#stripOverflowFailedTurnForRetry(): void {
|
|
@@ -3170,7 +3279,31 @@ export class AgentSession {
|
|
|
3170
3279
|
// which is the optional patch-preview verification gated by
|
|
3171
3280
|
// edit.streamingAbort. Skip the read when the setting is off.
|
|
3172
3281
|
if (this.settings.get("edit.streamingAbort")) {
|
|
3173
|
-
|
|
3282
|
+
// Fire-and-forget async priming: toolcall deltas arrive on the hot
|
|
3283
|
+
// stream path, so never block it on filesystem I/O. The abort-check
|
|
3284
|
+
// path (#maybeAbortStreamingEdit) still falls back to the sync read
|
|
3285
|
+
// if priming hasn't completed by the time removed lines appear.
|
|
3286
|
+
void this.#preCacheFileAsync(streamingEdit.resolvedPath);
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
|
|
3290
|
+
#streamingEditPrecachePending = new Set<string>();
|
|
3291
|
+
async #preCacheFileAsync(resolvedPath: string): Promise<void> {
|
|
3292
|
+
if (this.#streamingEditFileCache.has(resolvedPath)) return;
|
|
3293
|
+
if (this.#streamingEditPrecachePending.has(resolvedPath)) return;
|
|
3294
|
+
this.#streamingEditPrecachePending.add(resolvedPath);
|
|
3295
|
+
try {
|
|
3296
|
+
const stat = await fs.promises.stat(resolvedPath);
|
|
3297
|
+
if (stat.size > MAX_EDIT_FILE_BYTES) return;
|
|
3298
|
+
|
|
3299
|
+
const rawText = await fs.promises.readFile(resolvedPath, "utf-8");
|
|
3300
|
+
if (this.#streamingEditFileCache.has(resolvedPath)) return;
|
|
3301
|
+
const { text } = stripBom(rawText);
|
|
3302
|
+
this.#streamingEditFileCache.set(resolvedPath, normalizeToLF(text));
|
|
3303
|
+
} catch {
|
|
3304
|
+
// Don't cache on read errors (including ENOENT) - let the edit tool handle them
|
|
3305
|
+
} finally {
|
|
3306
|
+
this.#streamingEditPrecachePending.delete(resolvedPath);
|
|
3174
3307
|
}
|
|
3175
3308
|
}
|
|
3176
3309
|
|
|
@@ -3178,6 +3311,9 @@ export class AgentSession {
|
|
|
3178
3311
|
if (this.#streamingEditFileCache.has(resolvedPath)) return;
|
|
3179
3312
|
|
|
3180
3313
|
try {
|
|
3314
|
+
const stat = fs.statSync(resolvedPath);
|
|
3315
|
+
if (stat.size > MAX_EDIT_FILE_BYTES) return;
|
|
3316
|
+
|
|
3181
3317
|
const rawText = fs.readFileSync(resolvedPath, "utf-8");
|
|
3182
3318
|
const { text } = stripBom(rawText);
|
|
3183
3319
|
this.#streamingEditFileCache.set(resolvedPath, normalizeToLF(text));
|
|
@@ -3665,6 +3801,8 @@ export class AgentSession {
|
|
|
3665
3801
|
} catch (error) {
|
|
3666
3802
|
logger.warn("Failed to emit session_shutdown event", { error: String(error) });
|
|
3667
3803
|
}
|
|
3804
|
+
this.#workflowGateEmitter = undefined;
|
|
3805
|
+
notifyWorkflowGateEmitterChanged(this.sessionId, undefined);
|
|
3668
3806
|
await this.#flushWorkerIntegrationAttempt();
|
|
3669
3807
|
await this.#cancelPostPromptTasks();
|
|
3670
3808
|
// Cancel jobs this agent registered so a subagent's teardown doesn't
|
|
@@ -3728,6 +3866,18 @@ export class AgentSession {
|
|
|
3728
3866
|
this.#eventListeners = [];
|
|
3729
3867
|
this.#rebuildEventListenerSnapshot();
|
|
3730
3868
|
}
|
|
3869
|
+
/**
|
|
3870
|
+
* Strict writer close for ACP session delete. On the first attempt it flushes
|
|
3871
|
+
* pending writes, then returns the certainty-aware close outcome so the caller
|
|
3872
|
+
* can block destructive mutation on a non-`closed` result. When the manager
|
|
3873
|
+
* retains a retryable writer (a prior `close_failed_retryable`), the flush is
|
|
3874
|
+
* NOT repeated: the underlying writer rejects flushes while in the retryable
|
|
3875
|
+
* state, and `SessionManager.closeStrict()` owns the flush/close sequencing so
|
|
3876
|
+
* a second call can return `closed` once the OS close lands.
|
|
3877
|
+
*/
|
|
3878
|
+
async closeWriterStrict(): Promise<SessionManagerCloseOutcome> {
|
|
3879
|
+
return this.sessionManager.flushAndCloseStrict();
|
|
3880
|
+
}
|
|
3731
3881
|
|
|
3732
3882
|
/**
|
|
3733
3883
|
* Bounded, best-effort teardown of the subprocess-spawning resources this session
|
|
@@ -3828,6 +3978,20 @@ export class AgentSession {
|
|
|
3828
3978
|
}
|
|
3829
3979
|
}
|
|
3830
3980
|
|
|
3981
|
+
/**
|
|
3982
|
+
* Owner-scoped async-delivery snapshot used by the strict ACP delete
|
|
3983
|
+
* quiescence barrier to PROVE quiescence after a best-effort drain. Unlike
|
|
3984
|
+
* {@link drainAsyncJobDeliveriesForAcp}'s boolean return (which conflates
|
|
3985
|
+
* "nothing to drain" with "timed out"), this reads the live state directly so
|
|
3986
|
+
* any remaining queued/delivering work is observable and can block mutation.
|
|
3987
|
+
*/
|
|
3988
|
+
getAsyncDeliveryStateForAcp(): { queued: number; delivering: boolean } {
|
|
3989
|
+
const manager = AsyncJobManager.instance();
|
|
3990
|
+
if (!manager) return { queued: 0, delivering: false };
|
|
3991
|
+
const ownerFilter = this.#agentId ? { ownerId: this.#agentId } : undefined;
|
|
3992
|
+
return manager.getDeliveryState(ownerFilter);
|
|
3993
|
+
}
|
|
3994
|
+
|
|
3831
3995
|
/** Most recent assistant message in agent state. */
|
|
3832
3996
|
getLastAssistantMessage(): AssistantMessage | undefined {
|
|
3833
3997
|
return this.#findLastAssistantMessage();
|
|
@@ -4795,6 +4959,14 @@ export class AgentSession {
|
|
|
4795
4959
|
return this.agent.state.messages;
|
|
4796
4960
|
}
|
|
4797
4961
|
|
|
4962
|
+
/** Main startup calls this exactly once, after a strict open returned `kind: "opened"`. */
|
|
4963
|
+
async continuePersistedHistory(): Promise<void> {
|
|
4964
|
+
if (!canContinuePersistedHistory(this.agent.state.messages)) {
|
|
4965
|
+
throw new Error("Cannot continue from persisted message history");
|
|
4966
|
+
}
|
|
4967
|
+
await this.agent.continue();
|
|
4968
|
+
}
|
|
4969
|
+
|
|
4798
4970
|
buildDisplaySessionContext(): SessionContext {
|
|
4799
4971
|
return deobfuscateSessionContext(this.sessionManager.buildSessionContext(), this.#obfuscator);
|
|
4800
4972
|
}
|
|
@@ -4929,6 +5101,7 @@ export class AgentSession {
|
|
|
4929
5101
|
|
|
4930
5102
|
setWorkflowGateEmitter(emitter: WorkflowGateEmitter | undefined): void {
|
|
4931
5103
|
this.#workflowGateEmitter = emitter;
|
|
5104
|
+
notifyWorkflowGateEmitterChanged(this.sessionId, emitter);
|
|
4932
5105
|
if (emitter) {
|
|
4933
5106
|
this.#ensureWorkflowGateAskTool();
|
|
4934
5107
|
}
|
|
@@ -5298,6 +5471,7 @@ export class AgentSession {
|
|
|
5298
5471
|
|
|
5299
5472
|
// Expand file-based prompt templates if requested
|
|
5300
5473
|
const expandedText = expandPromptTemplates ? expandPromptTemplate(text, [...this.#promptTemplates]) : text;
|
|
5474
|
+
assertImagePlaceholdersHavePayload(expandedText, options?.images);
|
|
5301
5475
|
const workflowIntentDiff = options?.synthetic ? null : buildWorkflowIntentDiff(expandedText);
|
|
5302
5476
|
|
|
5303
5477
|
// If streaming, queue via steer() or followUp() based on option
|
|
@@ -5475,6 +5649,7 @@ export class AgentSession {
|
|
|
5475
5649
|
): Promise<void> {
|
|
5476
5650
|
this.#beginInFlight();
|
|
5477
5651
|
const generation = this.#promptGeneration;
|
|
5652
|
+
const rosterClaim = this.#claimIrcRosterCandidate();
|
|
5478
5653
|
try {
|
|
5479
5654
|
// Flush any pending bash messages before the new prompt
|
|
5480
5655
|
this.#flushPendingBashMessages();
|
|
@@ -5526,6 +5701,11 @@ export class AgentSession {
|
|
|
5526
5701
|
}
|
|
5527
5702
|
const volatileProjectContextMessage = await this.#buildVolatileProjectContextMessage();
|
|
5528
5703
|
messages.push(volatileProjectContextMessage);
|
|
5704
|
+
if (rosterClaim && this.#isCurrentIrcRosterClaim(rosterClaim.token, rosterClaim.epoch)) {
|
|
5705
|
+
messages.push(rosterClaim.message);
|
|
5706
|
+
} else if (rosterClaim) {
|
|
5707
|
+
this.#releaseIrcRosterClaim(rosterClaim.token, rosterClaim.epoch);
|
|
5708
|
+
}
|
|
5529
5709
|
if (options?.prependMessages) {
|
|
5530
5710
|
messages.push(...options.prependMessages);
|
|
5531
5711
|
}
|
|
@@ -5630,10 +5810,27 @@ export class AgentSession {
|
|
|
5630
5810
|
|
|
5631
5811
|
const agentPromptOptions = options?.toolChoice ? { toolChoice: options.toolChoice } : undefined;
|
|
5632
5812
|
await this.#promptAgentWithIdleRetry(messages, agentPromptOptions);
|
|
5813
|
+
const terminalAssistant = this.#findLastAssistantMessage();
|
|
5814
|
+
if (
|
|
5815
|
+
rosterClaim &&
|
|
5816
|
+
terminalAssistant &&
|
|
5817
|
+
terminalAssistant.stopReason !== "error" &&
|
|
5818
|
+
terminalAssistant.stopReason !== "aborted"
|
|
5819
|
+
) {
|
|
5820
|
+
this.#commitIrcRosterClaim(rosterClaim.token, rosterClaim.epoch);
|
|
5821
|
+
}
|
|
5633
5822
|
if (!options?.skipPostPromptRecoveryWait) {
|
|
5634
5823
|
await this.#waitForPostPromptRecovery();
|
|
5635
5824
|
}
|
|
5636
5825
|
} finally {
|
|
5826
|
+
if (rosterClaim) {
|
|
5827
|
+
this.agent.replaceMessages(
|
|
5828
|
+
this.agent.state.messages.filter(
|
|
5829
|
+
candidate => !(candidate.role === "custom" && candidate.customType === "irc-peer-roster"),
|
|
5830
|
+
),
|
|
5831
|
+
);
|
|
5832
|
+
this.#releaseIrcRosterClaim(rosterClaim.token, rosterClaim.epoch);
|
|
5833
|
+
}
|
|
5637
5834
|
this.#endInFlight();
|
|
5638
5835
|
}
|
|
5639
5836
|
}
|
|
@@ -5784,6 +5981,7 @@ export class AgentSession {
|
|
|
5784
5981
|
}
|
|
5785
5982
|
|
|
5786
5983
|
const expandedText = expandPromptTemplate(text, [...this.#promptTemplates]);
|
|
5984
|
+
assertImagePlaceholdersHavePayload(expandedText, images);
|
|
5787
5985
|
await this.#queueSteer(expandedText, images);
|
|
5788
5986
|
}
|
|
5789
5987
|
|
|
@@ -5800,6 +5998,7 @@ export class AgentSession {
|
|
|
5800
5998
|
}
|
|
5801
5999
|
|
|
5802
6000
|
const expandedText = expandPromptTemplate(text, [...this.#promptTemplates]);
|
|
6001
|
+
assertImagePlaceholdersHavePayload(expandedText, images);
|
|
5803
6002
|
await this.#queueFollowUp(expandedText, images, {
|
|
5804
6003
|
forceOneAtATime: options?.followUpQueuePolicy === "sequential",
|
|
5805
6004
|
});
|
|
@@ -5809,6 +6008,7 @@ export class AgentSession {
|
|
|
5809
6008
|
* Internal: Queue a steering message (already expanded, no extension command check).
|
|
5810
6009
|
*/
|
|
5811
6010
|
async #queueSteer(text: string, images?: ImageContent[]): Promise<void> {
|
|
6011
|
+
assertImagePlaceholdersHavePayload(text, images);
|
|
5812
6012
|
const displayText = text || (images && images.length > 0 ? "[Image]" : "");
|
|
5813
6013
|
this.#steeringMessages.push(this.#createQueuedDisplayEntry(displayText));
|
|
5814
6014
|
const content: (TextContent | ImageContent)[] = [{ type: "text", text }];
|
|
@@ -5840,6 +6040,7 @@ export class AgentSession {
|
|
|
5840
6040
|
* Internal: Queue a follow-up message (already expanded, no extension command check).
|
|
5841
6041
|
*/
|
|
5842
6042
|
async #queueFollowUp(text: string, images?: ImageContent[], options?: { forceOneAtATime?: boolean }): Promise<void> {
|
|
6043
|
+
assertImagePlaceholdersHavePayload(text, images);
|
|
5843
6044
|
const displayText = text || (images && images.length > 0 ? "[Image]" : "");
|
|
5844
6045
|
this.#followUpMessages.push(this.#createQueuedDisplayEntry(displayText));
|
|
5845
6046
|
const content: (TextContent | ImageContent)[] = [{ type: "text", text }];
|
|
@@ -6057,6 +6258,7 @@ export class AgentSession {
|
|
|
6057
6258
|
message.display,
|
|
6058
6259
|
message.details,
|
|
6059
6260
|
message.attribution ?? "agent",
|
|
6261
|
+
getSessionMessageObservationId(appMessage),
|
|
6060
6262
|
);
|
|
6061
6263
|
return;
|
|
6062
6264
|
}
|
|
@@ -6084,6 +6286,7 @@ export class AgentSession {
|
|
|
6084
6286
|
message.display,
|
|
6085
6287
|
message.details,
|
|
6086
6288
|
message.attribution ?? "agent",
|
|
6289
|
+
getSessionMessageObservationId(appMessage),
|
|
6087
6290
|
);
|
|
6088
6291
|
}
|
|
6089
6292
|
|
|
@@ -6557,6 +6760,8 @@ export class AgentSession {
|
|
|
6557
6760
|
this.#planReferencePath = "local://PLAN.md";
|
|
6558
6761
|
this.#reconnectToAgent();
|
|
6559
6762
|
|
|
6763
|
+
this.#resetIrcRosterDeliveryState();
|
|
6764
|
+
|
|
6560
6765
|
// Emit session_switch event with reason "new" to hooks
|
|
6561
6766
|
if (this.#extensionRunner) {
|
|
6562
6767
|
await this.#extensionRunner.emit({
|
|
@@ -6664,6 +6869,8 @@ export class AgentSession {
|
|
|
6664
6869
|
this.#syncAgentSessionId();
|
|
6665
6870
|
this.#rekeyHindsightMemoryForCurrentSessionId();
|
|
6666
6871
|
|
|
6872
|
+
this.#resetIrcRosterDeliveryState();
|
|
6873
|
+
|
|
6667
6874
|
// Emit session_switch event with reason "fork" to hooks
|
|
6668
6875
|
if (this.#extensionRunner) {
|
|
6669
6876
|
await this.#extensionRunner.emit({
|
|
@@ -7603,6 +7810,8 @@ export class AgentSession {
|
|
|
7603
7810
|
this.#resetInjectedContextSignatures();
|
|
7604
7811
|
this.#syncTodoPhasesFromBranch();
|
|
7605
7812
|
|
|
7813
|
+
this.#resetIrcRosterDeliveryState();
|
|
7814
|
+
|
|
7606
7815
|
return { document: handoffText, savedPath };
|
|
7607
7816
|
} catch (error) {
|
|
7608
7817
|
if (handoffSignal.aborted || (error instanceof Error && error.name === "AbortError")) {
|
|
@@ -7641,6 +7850,14 @@ export class AgentSession {
|
|
|
7641
7850
|
* @param skipAbortedCheck If false, include aborted messages (for pre-prompt check). Default: true
|
|
7642
7851
|
*/
|
|
7643
7852
|
async #checkCompaction(assistantMessage: AssistantMessage, skipAbortedCheck = true): Promise<void> {
|
|
7853
|
+
// Safety stops are terminal and must not trigger context maintenance.
|
|
7854
|
+
if (
|
|
7855
|
+
assistantMessage.errorKind === "provider_safety_stop" ||
|
|
7856
|
+
(assistantMessage.errorMessage !== undefined &&
|
|
7857
|
+
isLegacyProviderSafetyStopMessage(assistantMessage.errorMessage))
|
|
7858
|
+
) {
|
|
7859
|
+
return;
|
|
7860
|
+
}
|
|
7644
7861
|
// Skip if message was aborted (user cancelled) - unless skipAbortedCheck is false
|
|
7645
7862
|
if (skipAbortedCheck && assistantMessage.stopReason === "aborted") return;
|
|
7646
7863
|
const contextWindow = this.model?.contextWindow ?? 0;
|
|
@@ -7732,9 +7949,14 @@ export class AgentSession {
|
|
|
7732
7949
|
this.#resourceSampler = sampler;
|
|
7733
7950
|
}
|
|
7734
7951
|
|
|
7952
|
+
setRetainedMemorySampler(sampler: (() => RetainedMemorySample) | undefined): void {
|
|
7953
|
+
this.#retainedMemorySampler = sampler;
|
|
7954
|
+
}
|
|
7955
|
+
|
|
7735
7956
|
#defaultResourceSample(): EmergencyCompactionSample {
|
|
7736
7957
|
let providerBytes = 0;
|
|
7737
7958
|
let imageBytes = 0;
|
|
7959
|
+
const retainedMemory = this.#retainedMemorySampler?.() ?? {};
|
|
7738
7960
|
for (const message of this.state.messages) {
|
|
7739
7961
|
const content = (message as { content?: unknown }).content;
|
|
7740
7962
|
if (typeof content === "string") {
|
|
@@ -7756,6 +7978,10 @@ export class AgentSession {
|
|
|
7756
7978
|
providerBytes,
|
|
7757
7979
|
messageCount: this.state.messages.length,
|
|
7758
7980
|
imageBytes,
|
|
7981
|
+
sessionResidentImageBytes: this.sessionManager.getResidentImageBytes(),
|
|
7982
|
+
materializedResidentBytes: this.#streamingEditFileCache.totalBytes,
|
|
7983
|
+
tuiChatChildren: retainedMemory.tuiChatChildren ?? 0,
|
|
7984
|
+
tuiCachedRenderBytes: retainedMemory.tuiCachedRenderBytes ?? 0,
|
|
7759
7985
|
};
|
|
7760
7986
|
}
|
|
7761
7987
|
|
|
@@ -8071,7 +8297,7 @@ export class AgentSession {
|
|
|
8071
8297
|
attribution: "agent",
|
|
8072
8298
|
timestamp: Date.now(),
|
|
8073
8299
|
});
|
|
8074
|
-
this.#scheduleAgentContinue({
|
|
8300
|
+
this.#scheduleAgentContinue({ skipCompactionCheck: true });
|
|
8075
8301
|
}
|
|
8076
8302
|
|
|
8077
8303
|
/**
|
|
@@ -9152,16 +9378,6 @@ export class AgentSession {
|
|
|
9152
9378
|
);
|
|
9153
9379
|
}
|
|
9154
9380
|
|
|
9155
|
-
#isRefusalErrorMessage(errorMessage: string): boolean {
|
|
9156
|
-
// Provider safety-refusal stops. Matches the engine-generated Anthropic
|
|
9157
|
-
// labels from packages/ai ("Refusal (<category>): …", "Refusal (no
|
|
9158
|
-
// details provided)", "Content flagged by safety filters") plus generic
|
|
9159
|
-
// usage-policy refusal copy.
|
|
9160
|
-
return /^refusal(\s*\(|:|$)|content flagged by safety filters|blocked under .{0,40}usage policy/i.test(
|
|
9161
|
-
errorMessage,
|
|
9162
|
-
);
|
|
9163
|
-
}
|
|
9164
|
-
|
|
9165
9381
|
#extractExplicitHttpStatusFromErrorMessage(errorMessage: string): number | undefined {
|
|
9166
9382
|
// Parse only explicit HTTP/status wording. Do not treat generic
|
|
9167
9383
|
// `error: 400` as an HTTP status because rate-limit copy can say
|
|
@@ -9173,14 +9389,15 @@ export class AgentSession {
|
|
|
9173
9389
|
}
|
|
9174
9390
|
|
|
9175
9391
|
/**
|
|
9176
|
-
* Ordered retry classification:
|
|
9177
|
-
* ->
|
|
9178
|
-
*
|
|
9392
|
+
* Ordered retry classification: typed safety stop (surface) -> legacy safety stop
|
|
9393
|
+
* (surface) -> overflow (compaction) -> terminal (surface) -> usage_limit
|
|
9394
|
+
* (rotation) -> first_event_timeout (bounded retry) -> transient (retry) ->
|
|
9395
|
+
* unknown (retry).
|
|
9179
9396
|
*/
|
|
9180
9397
|
#classifyErrorForRetry(message: AssistantMessage): RetryErrorClassification {
|
|
9181
|
-
if (message.stopReason !== "error"
|
|
9182
|
-
|
|
9183
|
-
if (
|
|
9398
|
+
if (message.stopReason !== "error") return "none";
|
|
9399
|
+
if (message.errorKind === "provider_safety_stop") return "terminal";
|
|
9400
|
+
if (!message.errorMessage) return "none";
|
|
9184
9401
|
const err = message.errorMessage;
|
|
9185
9402
|
// Provider safety refusals (e.g. Anthropic stop_reason "refusal" /
|
|
9186
9403
|
// "sensitive") are deterministic for the submitted context: replaying
|
|
@@ -9188,7 +9405,9 @@ export class AgentSession {
|
|
|
9188
9405
|
// auto-retry loop can never succeed and only re-bills the full context
|
|
9189
9406
|
// on every attempt (#1655). Surface immediately instead of joining the
|
|
9190
9407
|
// unbounded "unknown" retry class.
|
|
9191
|
-
if (
|
|
9408
|
+
if (isLegacyProviderSafetyStopMessage(err)) return "terminal";
|
|
9409
|
+
const contextWindow = this.model?.contextWindow ?? 0;
|
|
9410
|
+
if (isContextOverflow(message, contextWindow)) return "overflow";
|
|
9192
9411
|
if (isLocalModelEndpoint(this.model) && this.#isLocalProviderAvailabilityErrorMessage(err)) {
|
|
9193
9412
|
return "local_unavailable";
|
|
9194
9413
|
}
|
|
@@ -10140,17 +10359,19 @@ export class AgentSession {
|
|
|
10140
10359
|
}): Promise<{ replyText: string | null }> {
|
|
10141
10360
|
const awaitReply = args.awaitReply !== false;
|
|
10142
10361
|
const incomingTimestamp = Date.now();
|
|
10362
|
+
const incomingObservationId = crypto.randomUUID();
|
|
10143
10363
|
const incomingRecord: CustomMessage = {
|
|
10144
10364
|
role: "custom",
|
|
10145
10365
|
customType: "irc:incoming",
|
|
10146
10366
|
content: `[IRC \`${args.from}\` → you]\n\n${args.message}`,
|
|
10147
10367
|
display: true,
|
|
10148
|
-
details: { from: args.from, message: args.message },
|
|
10368
|
+
details: { observationId: incomingObservationId, from: args.from, message: args.message },
|
|
10149
10369
|
attribution: "agent",
|
|
10150
10370
|
timestamp: incomingTimestamp,
|
|
10151
10371
|
};
|
|
10152
10372
|
void this.#emitSessionEvent({ type: "irc_message", message: incomingRecord });
|
|
10153
10373
|
this.#forwardIrcRelayToMain({
|
|
10374
|
+
observationId: incomingObservationId,
|
|
10154
10375
|
from: args.from,
|
|
10155
10376
|
to: this.#agentId ?? "?",
|
|
10156
10377
|
body: args.message,
|
|
@@ -10172,17 +10393,19 @@ export class AgentSession {
|
|
|
10172
10393
|
signal: args.signal,
|
|
10173
10394
|
});
|
|
10174
10395
|
|
|
10396
|
+
const replyObservationId = crypto.randomUUID();
|
|
10175
10397
|
const replyRecord: CustomMessage = {
|
|
10176
10398
|
role: "custom",
|
|
10177
10399
|
customType: "irc:autoreply",
|
|
10178
10400
|
content: `[IRC you → \`${args.from}\` (auto)]\n\n${replyText}`,
|
|
10179
10401
|
display: true,
|
|
10180
|
-
details: { to: args.from, reply: replyText },
|
|
10402
|
+
details: { observationId: replyObservationId, to: args.from, reply: replyText },
|
|
10181
10403
|
attribution: "agent",
|
|
10182
10404
|
timestamp: Date.now(),
|
|
10183
10405
|
};
|
|
10184
10406
|
void this.#emitSessionEvent({ type: "irc_message", message: replyRecord });
|
|
10185
10407
|
this.#forwardIrcRelayToMain({
|
|
10408
|
+
observationId: replyObservationId,
|
|
10186
10409
|
from: this.#agentId ?? "?",
|
|
10187
10410
|
to: args.from,
|
|
10188
10411
|
body: replyText,
|
|
@@ -10201,6 +10424,7 @@ export class AgentSession {
|
|
|
10201
10424
|
* it is NOT injected into the main agent's persisted history.
|
|
10202
10425
|
*/
|
|
10203
10426
|
#forwardIrcRelayToMain(args: {
|
|
10427
|
+
observationId: string;
|
|
10204
10428
|
from: string;
|
|
10205
10429
|
to: string;
|
|
10206
10430
|
body: string;
|
|
@@ -10220,7 +10444,13 @@ export class AgentSession {
|
|
|
10220
10444
|
customType: "irc:relay",
|
|
10221
10445
|
content: `[IRC \`${args.from}\` ${arrow} \`${args.to}\`]\n\n${args.body}`,
|
|
10222
10446
|
display: true,
|
|
10223
|
-
details: {
|
|
10447
|
+
details: {
|
|
10448
|
+
observationId: args.observationId,
|
|
10449
|
+
from: args.from,
|
|
10450
|
+
to: args.to,
|
|
10451
|
+
body: args.body,
|
|
10452
|
+
kind: args.kind,
|
|
10453
|
+
},
|
|
10224
10454
|
attribution: "agent",
|
|
10225
10455
|
timestamp: args.timestamp,
|
|
10226
10456
|
};
|
|
@@ -10292,6 +10522,61 @@ export class AgentSession {
|
|
|
10292
10522
|
void this.#emitSessionEvent({ type: "subagent_steer_message", message: record });
|
|
10293
10523
|
}
|
|
10294
10524
|
|
|
10525
|
+
#buildIrcRosterCandidate(): { signature: string; message: CustomMessage } | null {
|
|
10526
|
+
const peers = (this.#agentRegistry?.listVisibleTo(this.#agentId ?? "") ?? [])
|
|
10527
|
+
.map(peer => ({ id: peer.id, label: peer.rosterLabel || peer.displayName }))
|
|
10528
|
+
.sort((left, right) => left.id.localeCompare(right.id));
|
|
10529
|
+
const signature = JSON.stringify(peers);
|
|
10530
|
+
if (peers.length === 0 && this.#lastDeliveredIrcRosterSignature === null) return null;
|
|
10531
|
+
return {
|
|
10532
|
+
signature,
|
|
10533
|
+
message: {
|
|
10534
|
+
role: "custom",
|
|
10535
|
+
customType: "irc-peer-roster",
|
|
10536
|
+
content: prompt.render(ircPeerRosterTemplate, {
|
|
10537
|
+
roster: peers.map(peer => `${peer.id} (${peer.label})`).join(", "),
|
|
10538
|
+
}),
|
|
10539
|
+
display: false,
|
|
10540
|
+
attribution: "agent",
|
|
10541
|
+
timestamp: Date.now(),
|
|
10542
|
+
},
|
|
10543
|
+
};
|
|
10544
|
+
}
|
|
10545
|
+
|
|
10546
|
+
#claimIrcRosterCandidate(): { token: symbol; epoch: number; message: CustomMessage } | null {
|
|
10547
|
+
if (this.#ircRosterClaim) return null;
|
|
10548
|
+
const candidate = this.#buildIrcRosterCandidate();
|
|
10549
|
+
if (!candidate || candidate.signature === this.#lastDeliveredIrcRosterSignature) return null;
|
|
10550
|
+
const token = Symbol("irc-roster");
|
|
10551
|
+
const epoch = this.#ircRosterEpoch;
|
|
10552
|
+
this.#ircRosterClaim = { token, signature: candidate.signature, epoch };
|
|
10553
|
+
return { token, epoch, message: candidate.message };
|
|
10554
|
+
}
|
|
10555
|
+
|
|
10556
|
+
#isCurrentIrcRosterClaim(token: symbol, epoch: number): boolean {
|
|
10557
|
+
return this.#ircRosterEpoch === epoch && this.#ircRosterClaim?.token === token;
|
|
10558
|
+
}
|
|
10559
|
+
|
|
10560
|
+
#commitIrcRosterClaim(token: symbol, epoch: number): void {
|
|
10561
|
+
const claim = this.#ircRosterClaim;
|
|
10562
|
+
if (this.#ircRosterEpoch !== epoch || claim?.token !== token) {
|
|
10563
|
+
this.#releaseIrcRosterClaim(token, epoch);
|
|
10564
|
+
return;
|
|
10565
|
+
}
|
|
10566
|
+
this.#lastDeliveredIrcRosterSignature = claim.signature;
|
|
10567
|
+
this.#ircRosterClaim = null;
|
|
10568
|
+
}
|
|
10569
|
+
|
|
10570
|
+
#releaseIrcRosterClaim(token: symbol, epoch: number): void {
|
|
10571
|
+
if (this.#isCurrentIrcRosterClaim(token, epoch)) this.#ircRosterClaim = null;
|
|
10572
|
+
}
|
|
10573
|
+
|
|
10574
|
+
#resetIrcRosterDeliveryState(): void {
|
|
10575
|
+
this.#ircRosterEpoch += 1;
|
|
10576
|
+
this.#lastDeliveredIrcRosterSignature = null;
|
|
10577
|
+
this.#ircRosterClaim = null;
|
|
10578
|
+
}
|
|
10579
|
+
|
|
10295
10580
|
/**
|
|
10296
10581
|
* Run a single ephemeral side-channel turn against this session's current
|
|
10297
10582
|
* model + system prompt + history. No tools are used; the side request
|
|
@@ -10308,61 +10593,84 @@ export class AgentSession {
|
|
|
10308
10593
|
onTextDelta?: (delta: string) => void;
|
|
10309
10594
|
signal?: AbortSignal;
|
|
10310
10595
|
}): Promise<{ replyText: string; assistantMessage: AssistantMessage }> {
|
|
10311
|
-
const
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10596
|
+
const rosterClaim = this.#claimIrcRosterCandidate();
|
|
10597
|
+
try {
|
|
10598
|
+
const model = this.model;
|
|
10599
|
+
if (!model) {
|
|
10600
|
+
throw new Error("No active model on session");
|
|
10601
|
+
}
|
|
10602
|
+
const apiKey = await this.#modelRegistry.getApiKey(model, this.sessionId);
|
|
10603
|
+
if (!apiKey) {
|
|
10604
|
+
throw new Error(`No API key for ${model.provider}/${model.id}`);
|
|
10605
|
+
}
|
|
10606
|
+
|
|
10607
|
+
const rosterMessage =
|
|
10608
|
+
rosterClaim && this.#isCurrentIrcRosterClaim(rosterClaim.token, rosterClaim.epoch)
|
|
10609
|
+
? rosterClaim.message
|
|
10610
|
+
: undefined;
|
|
10611
|
+
if (rosterClaim && !rosterMessage) {
|
|
10612
|
+
this.#releaseIrcRosterClaim(rosterClaim.token, rosterClaim.epoch);
|
|
10613
|
+
}
|
|
10614
|
+
let snapshot = this.#buildEphemeralSnapshot(args.promptText, rosterMessage ? [rosterMessage] : undefined);
|
|
10615
|
+
let llmMessages = await this.convertMessagesToLlm(snapshot, args.signal);
|
|
10616
|
+
if (rosterMessage && !this.#isCurrentIrcRosterClaim(rosterClaim!.token, rosterClaim!.epoch)) {
|
|
10617
|
+
this.#releaseIrcRosterClaim(rosterClaim!.token, rosterClaim!.epoch);
|
|
10618
|
+
// Conversion is asynchronous, so rebuild without a claim invalidated while it awaited.
|
|
10619
|
+
snapshot = this.#buildEphemeralSnapshot(args.promptText);
|
|
10620
|
+
llmMessages = await this.convertMessagesToLlm(snapshot, args.signal);
|
|
10621
|
+
}
|
|
10622
|
+
const context: Context = {
|
|
10623
|
+
systemPrompt: this.systemPrompt,
|
|
10624
|
+
messages: llmMessages,
|
|
10625
|
+
// Empty tools array: with toolChoice="none" some encoders still serialize the
|
|
10626
|
+
// recipient's tool catalog and the model leaks raw call markup
|
|
10627
|
+
// (<function_calls>, DSML envelopes) into IRC replies. Stripping tools here
|
|
10628
|
+
// removes the surface entirely.
|
|
10629
|
+
tools: [],
|
|
10630
|
+
};
|
|
10631
|
+
const options = this.prepareSimpleStreamOptions(
|
|
10632
|
+
{
|
|
10633
|
+
apiKey,
|
|
10634
|
+
sessionId: this.sessionId,
|
|
10635
|
+
reasoning: toReasoningEffort(this.thinkingLevel),
|
|
10636
|
+
hideThinkingSummary: this.agent.hideThinkingSummary,
|
|
10637
|
+
serviceTier: this.serviceTier,
|
|
10638
|
+
signal: args.signal,
|
|
10639
|
+
toolChoice: "none",
|
|
10640
|
+
},
|
|
10641
|
+
model.provider,
|
|
10642
|
+
);
|
|
10319
10643
|
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
serviceTier: this.serviceTier,
|
|
10338
|
-
signal: args.signal,
|
|
10339
|
-
toolChoice: "none",
|
|
10340
|
-
},
|
|
10341
|
-
model.provider,
|
|
10342
|
-
);
|
|
10644
|
+
let replyText = "";
|
|
10645
|
+
let assistantMessage: AssistantMessage | undefined;
|
|
10646
|
+
const stream = streamSimple(model, context, options);
|
|
10647
|
+
for await (const event of stream) {
|
|
10648
|
+
if (event.type === "text_delta") {
|
|
10649
|
+
replyText += event.delta;
|
|
10650
|
+
if (args.onTextDelta) args.onTextDelta(event.delta);
|
|
10651
|
+
continue;
|
|
10652
|
+
}
|
|
10653
|
+
if (event.type === "done") {
|
|
10654
|
+
assistantMessage = event.message;
|
|
10655
|
+
break;
|
|
10656
|
+
}
|
|
10657
|
+
if (event.type === "error") {
|
|
10658
|
+
throw new Error(event.error.errorMessage || "Ephemeral turn failed");
|
|
10659
|
+
}
|
|
10660
|
+
}
|
|
10343
10661
|
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
const stream = streamSimple(model, context, options);
|
|
10347
|
-
for await (const event of stream) {
|
|
10348
|
-
if (event.type === "text_delta") {
|
|
10349
|
-
replyText += event.delta;
|
|
10350
|
-
if (args.onTextDelta) args.onTextDelta(event.delta);
|
|
10351
|
-
continue;
|
|
10662
|
+
if (!assistantMessage) {
|
|
10663
|
+
throw new Error("Ephemeral turn ended without a final message");
|
|
10352
10664
|
}
|
|
10353
|
-
if (
|
|
10354
|
-
|
|
10355
|
-
break;
|
|
10665
|
+
if (rosterClaim) {
|
|
10666
|
+
this.#commitIrcRosterClaim(rosterClaim.token, rosterClaim.epoch);
|
|
10356
10667
|
}
|
|
10357
|
-
|
|
10358
|
-
|
|
10668
|
+
return { replyText: dedupeIrcReply(replyText.trim()), assistantMessage };
|
|
10669
|
+
} finally {
|
|
10670
|
+
if (rosterClaim) {
|
|
10671
|
+
this.#releaseIrcRosterClaim(rosterClaim.token, rosterClaim.epoch);
|
|
10359
10672
|
}
|
|
10360
10673
|
}
|
|
10361
|
-
|
|
10362
|
-
if (!assistantMessage) {
|
|
10363
|
-
throw new Error("Ephemeral turn ended without a final message");
|
|
10364
|
-
}
|
|
10365
|
-
return { replyText: dedupeIrcReply(replyText.trim()), assistantMessage };
|
|
10366
10674
|
}
|
|
10367
10675
|
|
|
10368
10676
|
/**
|
|
@@ -10371,7 +10679,7 @@ export class AgentSession {
|
|
|
10371
10679
|
* the partial response in context, then appends the prompt as a virtual
|
|
10372
10680
|
* user message.
|
|
10373
10681
|
*/
|
|
10374
|
-
#buildEphemeralSnapshot(promptText: string): AgentMessage[] {
|
|
10682
|
+
#buildEphemeralSnapshot(promptText: string, prependMessages?: AgentMessage[]): AgentMessage[] {
|
|
10375
10683
|
const messages = [...this.messages];
|
|
10376
10684
|
const streaming = this.agent.state.streamMessage;
|
|
10377
10685
|
if (streaming && streaming.role === "assistant") {
|
|
@@ -10402,6 +10710,7 @@ export class AgentSession {
|
|
|
10402
10710
|
}
|
|
10403
10711
|
}
|
|
10404
10712
|
}
|
|
10713
|
+
if (prependMessages) messages.push(...prependMessages);
|
|
10405
10714
|
messages.push({
|
|
10406
10715
|
role: "user",
|
|
10407
10716
|
content: [{ type: "text", text: promptText }],
|
|
@@ -10613,7 +10922,9 @@ export class AgentSession {
|
|
|
10613
10922
|
|
|
10614
10923
|
if (switchingToDifferentSession) {
|
|
10615
10924
|
this.#resetHindsightConversationTrackingIfHindsight();
|
|
10925
|
+
this.#resetIrcRosterDeliveryState();
|
|
10616
10926
|
}
|
|
10927
|
+
|
|
10617
10928
|
this.#reconnectToAgent();
|
|
10618
10929
|
return true;
|
|
10619
10930
|
} catch (error) {
|
|
@@ -10736,6 +11047,8 @@ export class AgentSession {
|
|
|
10736
11047
|
this.#closeCodexProviderSessionsForHistoryRewrite();
|
|
10737
11048
|
}
|
|
10738
11049
|
|
|
11050
|
+
this.#resetIrcRosterDeliveryState();
|
|
11051
|
+
|
|
10739
11052
|
return { selectedText, cancelled: false };
|
|
10740
11053
|
}
|
|
10741
11054
|
|
|
@@ -10971,6 +11284,52 @@ export class AgentSession {
|
|
|
10971
11284
|
let totalCacheWrite = 0;
|
|
10972
11285
|
let totalCost = 0;
|
|
10973
11286
|
let totalPremiumRequests = 0;
|
|
11287
|
+
const totalCostBreakdown: Usage["cost"] = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 };
|
|
11288
|
+
let hasCompleteCostBreakdown = true;
|
|
11289
|
+
const addCostBreakdown = (cost: unknown): void => {
|
|
11290
|
+
if (!cost || typeof cost !== "object") {
|
|
11291
|
+
hasCompleteCostBreakdown = false;
|
|
11292
|
+
return;
|
|
11293
|
+
}
|
|
11294
|
+
const completeCost = cost as Usage["cost"];
|
|
11295
|
+
if (
|
|
11296
|
+
!Number.isFinite(completeCost.input) ||
|
|
11297
|
+
completeCost.input < 0 ||
|
|
11298
|
+
!Number.isFinite(completeCost.output) ||
|
|
11299
|
+
completeCost.output < 0 ||
|
|
11300
|
+
!Number.isFinite(completeCost.cacheRead) ||
|
|
11301
|
+
completeCost.cacheRead < 0 ||
|
|
11302
|
+
!Number.isFinite(completeCost.cacheWrite) ||
|
|
11303
|
+
completeCost.cacheWrite < 0 ||
|
|
11304
|
+
!Number.isFinite(completeCost.total) ||
|
|
11305
|
+
completeCost.total < 0
|
|
11306
|
+
) {
|
|
11307
|
+
hasCompleteCostBreakdown = false;
|
|
11308
|
+
return;
|
|
11309
|
+
}
|
|
11310
|
+
if (!hasCompleteCostBreakdown) return;
|
|
11311
|
+
totalCostBreakdown.input += completeCost.input;
|
|
11312
|
+
totalCostBreakdown.output += completeCost.output;
|
|
11313
|
+
totalCostBreakdown.cacheRead += completeCost.cacheRead;
|
|
11314
|
+
totalCostBreakdown.cacheWrite += completeCost.cacheWrite;
|
|
11315
|
+
totalCostBreakdown.total += completeCost.total;
|
|
11316
|
+
if (
|
|
11317
|
+
!Number.isFinite(totalCostBreakdown.input) ||
|
|
11318
|
+
!Number.isFinite(totalCostBreakdown.output) ||
|
|
11319
|
+
!Number.isFinite(totalCostBreakdown.cacheRead) ||
|
|
11320
|
+
!Number.isFinite(totalCostBreakdown.cacheWrite) ||
|
|
11321
|
+
!Number.isFinite(totalCostBreakdown.total)
|
|
11322
|
+
) {
|
|
11323
|
+
hasCompleteCostBreakdown = false;
|
|
11324
|
+
}
|
|
11325
|
+
};
|
|
11326
|
+
const hasCompleteTaskToolUsage = (details: unknown): boolean =>
|
|
11327
|
+
Boolean(
|
|
11328
|
+
details &&
|
|
11329
|
+
typeof details === "object" &&
|
|
11330
|
+
(details as Record<string, unknown>).usageCostBreakdownComplete === true,
|
|
11331
|
+
);
|
|
11332
|
+
|
|
10974
11333
|
const getTaskToolUsage = (details: unknown): Usage | undefined => {
|
|
10975
11334
|
if (!details || typeof details !== "object") return undefined;
|
|
10976
11335
|
const record = details as Record<string, unknown>;
|
|
@@ -10994,6 +11353,7 @@ export class AgentSession {
|
|
|
10994
11353
|
totalCacheWrite += assistantMsg.usage.cacheWrite;
|
|
10995
11354
|
totalPremiumRequests += assistantMsg.usage.premiumRequests ?? 0;
|
|
10996
11355
|
totalCost += assistantMsg.usage.cost.total;
|
|
11356
|
+
addCostBreakdown(assistantMsg.usage.cost);
|
|
10997
11357
|
} else if (message.role === "toolResult") {
|
|
10998
11358
|
toolResults += 1;
|
|
10999
11359
|
if (message.toolName === "task") {
|
|
@@ -11005,6 +11365,11 @@ export class AgentSession {
|
|
|
11005
11365
|
totalCacheWrite += usage.cacheWrite;
|
|
11006
11366
|
totalPremiumRequests += usage.premiumRequests ?? 0;
|
|
11007
11367
|
totalCost += usage.cost.total;
|
|
11368
|
+
if (hasCompleteTaskToolUsage(message.details)) {
|
|
11369
|
+
addCostBreakdown(usage.cost);
|
|
11370
|
+
} else {
|
|
11371
|
+
hasCompleteCostBreakdown = false;
|
|
11372
|
+
}
|
|
11008
11373
|
}
|
|
11009
11374
|
}
|
|
11010
11375
|
}
|
|
@@ -11026,6 +11391,7 @@ export class AgentSession {
|
|
|
11026
11391
|
total: totalInput + totalOutput + totalCacheRead + totalCacheWrite,
|
|
11027
11392
|
},
|
|
11028
11393
|
cost: totalCost,
|
|
11394
|
+
...(hasCompleteCostBreakdown ? { costBreakdown: totalCostBreakdown } : {}),
|
|
11029
11395
|
premiumRequests: totalPremiumRequests,
|
|
11030
11396
|
};
|
|
11031
11397
|
}
|
|
@@ -11110,11 +11476,30 @@ export class AgentSession {
|
|
|
11110
11476
|
return count;
|
|
11111
11477
|
}
|
|
11112
11478
|
|
|
11479
|
+
/**
|
|
11480
|
+
* Usage-anchor eligibility for context estimation. Mirrors the compaction
|
|
11481
|
+
* rule (see getAssistantUsage in compaction.ts): error/aborted turns carry
|
|
11482
|
+
* absent or partial usage, so they must not anchor an estimate. Anchor on
|
|
11483
|
+
* the last successful positive-usage assistant instead and let callers
|
|
11484
|
+
* estimate every later message (including error/aborted ones) as trailing
|
|
11485
|
+
* context.
|
|
11486
|
+
*/
|
|
11487
|
+
#anchorableAssistantUsage(message: AgentMessage): Usage | undefined {
|
|
11488
|
+
if (message.role !== "assistant") return undefined;
|
|
11489
|
+
const assistant = message as AssistantMessage;
|
|
11490
|
+
if (assistant.stopReason === "aborted" || assistant.stopReason === "error") return undefined;
|
|
11491
|
+
const usage = assistant.usage;
|
|
11492
|
+
if (!usage || calculateContextTokens(usage) <= 0) return undefined;
|
|
11493
|
+
return usage;
|
|
11494
|
+
}
|
|
11495
|
+
|
|
11113
11496
|
/**
|
|
11114
11497
|
* Observed heuristic→actual token correction for the compaction keep window
|
|
11115
11498
|
* (Finding 7). Compares the provider's real prompt tokens against the chars/4
|
|
11116
|
-
* heuristic estimate of the same content (stable system prefix + history
|
|
11117
|
-
* the last usage-bearing assistant turn
|
|
11499
|
+
* heuristic estimate of the same content (stable system prefix + history
|
|
11500
|
+
* before the last usage-bearing assistant turn — that turn's own output is
|
|
11501
|
+
* the response, not part of the request's prompt, so it belongs on neither
|
|
11502
|
+
* side of the ratio). Image-bearing content is bucketed out
|
|
11118
11503
|
* of BOTH sides using the identical fixed IMAGE_TOKEN_ESTIMATE so the 1200-token
|
|
11119
11504
|
* image charge cannot skew the text ratio. Returns undefined when data is
|
|
11120
11505
|
* insufficient, so prepareCompaction applies no correction (never the confounded
|
|
@@ -11125,9 +11510,9 @@ export class AgentSession {
|
|
|
11125
11510
|
let lastUsageIndex = -1;
|
|
11126
11511
|
let lastUsage: Usage | undefined;
|
|
11127
11512
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
11128
|
-
const
|
|
11129
|
-
if (
|
|
11130
|
-
lastUsage =
|
|
11513
|
+
const usage = this.#anchorableAssistantUsage(messages[i]);
|
|
11514
|
+
if (usage) {
|
|
11515
|
+
lastUsage = usage;
|
|
11131
11516
|
lastUsageIndex = i;
|
|
11132
11517
|
break;
|
|
11133
11518
|
}
|
|
@@ -11139,7 +11524,7 @@ export class AgentSession {
|
|
|
11139
11524
|
let heuristic = 0;
|
|
11140
11525
|
for (const block of this.agent.state.systemPrompt) heuristic += estimateTextTokensHeuristic(block);
|
|
11141
11526
|
let imageBlocks = 0;
|
|
11142
|
-
for (let i = 0; i
|
|
11527
|
+
for (let i = 0; i < lastUsageIndex; i++) {
|
|
11143
11528
|
heuristic += this.#estimateMessageDisplayTokens(messages[i]);
|
|
11144
11529
|
imageBlocks += this.#countImageBlocks(messages[i]);
|
|
11145
11530
|
}
|
|
@@ -11164,18 +11549,16 @@ export class AgentSession {
|
|
|
11164
11549
|
} {
|
|
11165
11550
|
const messages = this.messages;
|
|
11166
11551
|
|
|
11167
|
-
// Find last assistant message with usage
|
|
11552
|
+
// Find the last successful assistant message with positive usage.
|
|
11553
|
+
// Error/aborted turns are estimated as trailing context instead.
|
|
11168
11554
|
let lastUsageIndex: number | null = null;
|
|
11169
11555
|
let lastUsage: Usage | undefined;
|
|
11170
11556
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
11171
|
-
const
|
|
11172
|
-
if (
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
lastUsageIndex = i;
|
|
11177
|
-
break;
|
|
11178
|
-
}
|
|
11557
|
+
const usage = this.#anchorableAssistantUsage(messages[i]);
|
|
11558
|
+
if (usage) {
|
|
11559
|
+
lastUsage = usage;
|
|
11560
|
+
lastUsageIndex = i;
|
|
11561
|
+
break;
|
|
11179
11562
|
}
|
|
11180
11563
|
}
|
|
11181
11564
|
|
|
@@ -11190,7 +11573,11 @@ export class AgentSession {
|
|
|
11190
11573
|
};
|
|
11191
11574
|
}
|
|
11192
11575
|
|
|
11193
|
-
|
|
11576
|
+
// Anchor on total context tokens (input + cache + output), not prompt-only
|
|
11577
|
+
// tokens: the next request replays the anchor assistant's own output
|
|
11578
|
+
// (text/reasoning/tool calls), so dropping it undercounts the very tokens
|
|
11579
|
+
// a large-reasoning turn just added (Sol xhigh emits tens of thousands).
|
|
11580
|
+
const usageTokens = calculateContextTokens(lastUsage);
|
|
11194
11581
|
let trailingTokens = 0;
|
|
11195
11582
|
for (let i = lastUsageIndex + 1; i < messages.length; i++) {
|
|
11196
11583
|
trailingTokens += estimateMessage(messages[i]);
|
|
@@ -11218,55 +11605,33 @@ export class AgentSession {
|
|
|
11218
11605
|
}
|
|
11219
11606
|
|
|
11220
11607
|
/**
|
|
11221
|
-
* Conservative inflation applied to the native-free
|
|
11222
|
-
*
|
|
11223
|
-
*
|
|
11224
|
-
*
|
|
11608
|
+
* Conservative inflation applied to the native-free estimate of the UNSENT
|
|
11609
|
+
* context delta. The heuristic is script-aware (CJK counted ~1 token/char),
|
|
11610
|
+
* but dense non-CJK content (compact JSON, diffs, hashes) can still exceed
|
|
11611
|
+
* chars/4, so we bias high to compact slightly early rather than overflow
|
|
11612
|
+
* the model window before the next provider response re-anchors the count.
|
|
11225
11613
|
*/
|
|
11226
11614
|
#compactionDeltaInflation = 1.2;
|
|
11227
|
-
#compactionDeltaTokenCache = new WeakMap<AgentMessage, { len: number; tokens: number }>();
|
|
11228
|
-
|
|
11229
|
-
/**
|
|
11230
|
-
* Cheap content-size signal to invalidate the compaction-delta token cache on mutation. Recursively
|
|
11231
|
-
* sums string lengths across the whole message (depth-bounded), so it covers every
|
|
11232
|
-
* provider-visible shape (text/thinking/tool args, toolResult output, tool names, etc.)
|
|
11233
|
-
* without allocating a serialized copy. A size-preserving in-place edit yields only a
|
|
11234
|
-
* benign estimate drift.
|
|
11235
|
-
*/
|
|
11236
|
-
#messageTokenSize(value: unknown, depth = 0): number {
|
|
11237
|
-
if (depth > 6) return 0;
|
|
11238
|
-
if (typeof value === "string") return value.length;
|
|
11239
|
-
if (typeof value === "number" || typeof value === "boolean") return 8;
|
|
11240
|
-
if (Array.isArray(value)) {
|
|
11241
|
-
let size = 0;
|
|
11242
|
-
for (const item of value) size += this.#messageTokenSize(item, depth + 1);
|
|
11243
|
-
return size;
|
|
11244
|
-
}
|
|
11245
|
-
if (value && typeof value === "object") {
|
|
11246
|
-
let size = 0;
|
|
11247
|
-
for (const item of Object.values(value)) size += this.#messageTokenSize(item, depth + 1);
|
|
11248
|
-
return size;
|
|
11249
|
-
}
|
|
11250
|
-
return 0;
|
|
11251
|
-
}
|
|
11252
11615
|
|
|
11253
11616
|
#estimateMessageCompactionDeltaTokens(message: AgentMessage): number {
|
|
11254
|
-
// Provider usage anchors the already-sent context (see
|
|
11255
|
-
// estimates only the UNSENT delta with the
|
|
11617
|
+
// Provider usage anchors the already-sent context (see calculateContextTokens); this
|
|
11618
|
+
// estimates only the UNSENT delta with the script-aware heuristic, inflated by
|
|
11256
11619
|
// #compactionDeltaInflation so dense input cannot undercount us past the compaction
|
|
11257
|
-
// threshold before the next provider response re-anchors the exact count.
|
|
11258
|
-
//
|
|
11259
|
-
//
|
|
11260
|
-
|
|
11261
|
-
|
|
11262
|
-
|
|
11620
|
+
// threshold before the next provider response re-anchors the exact count.
|
|
11621
|
+
//
|
|
11622
|
+
// Deliberately uncached: this feeds the compaction-threshold decision, and a
|
|
11623
|
+
// stale estimate after an in-place mutation (e.g. a same-length ASCII→CJK
|
|
11624
|
+
// edit, which changes the script-aware estimate up to 4x) could hold the
|
|
11625
|
+
// session under the threshold while the real prompt overflows. Any cheap
|
|
11626
|
+
// invalidation signal short of recomputing the estimator's own converted
|
|
11627
|
+
// fragments provably admits stale reuse, and the call sites run once per
|
|
11628
|
+
// prompt over the few messages trailing the usage anchor, so correctness
|
|
11629
|
+
// wins over a microcache here.
|
|
11263
11630
|
let heuristic = 0;
|
|
11264
11631
|
for (const llmMessage of convertToLlm([message])) {
|
|
11265
11632
|
heuristic += estimateMessageTokensHeuristic(llmMessage);
|
|
11266
11633
|
}
|
|
11267
|
-
|
|
11268
|
-
this.#compactionDeltaTokenCache.set(message, { len, tokens });
|
|
11269
|
-
return tokens;
|
|
11634
|
+
return Math.ceil(heuristic * this.#compactionDeltaInflation);
|
|
11270
11635
|
}
|
|
11271
11636
|
|
|
11272
11637
|
/**
|