@draht/coding-agent 2026.7.7 → 2026.7.12-1
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 +55 -0
- package/README.md +2 -2
- package/agents/advisor.md +44 -0
- package/bin/draht-tools.cjs +1808 -988
- package/dist/agents/advisor.md +44 -0
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/register-bedrock.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.js.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/attach-mode.d.ts.map +1 -1
- package/dist/cli/attach-mode.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/initial-message.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/list-sessions.d.ts.map +1 -1
- package/dist/cli/list-sessions.js.map +1 -1
- package/dist/cli/project-trust.d.ts.map +1 -1
- package/dist/cli/project-trust.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +0 -8
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +44 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +165 -136
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +4 -7
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/builtins/index.d.ts +11 -0
- package/dist/core/builtins/index.d.ts.map +1 -0
- package/dist/core/builtins/index.js +11 -0
- package/dist/core/builtins/index.js.map +1 -0
- package/dist/core/builtins/subagent.d.ts +88 -1
- package/dist/core/builtins/subagent.d.ts.map +1 -1
- package/dist/core/builtins/subagent.js +263 -27
- package/dist/core/builtins/subagent.js.map +1 -1
- package/dist/core/cache-stats.d.ts +49 -0
- package/dist/core/cache-stats.d.ts.map +1 -0
- package/dist/core/cache-stats.js +101 -0
- package/dist/core/cache-stats.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +1 -2
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +51 -73
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +23 -4
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +22 -52
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +9 -9
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +17 -18
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +0 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry.d.ts +4 -6
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +39 -15
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/multi-agent/fsm.d.ts +60 -0
- package/dist/core/multi-agent/fsm.d.ts.map +1 -0
- package/dist/core/multi-agent/fsm.js +90 -0
- package/dist/core/multi-agent/fsm.js.map +1 -0
- package/dist/core/multi-agent/index.d.ts +21 -0
- package/dist/core/multi-agent/index.d.ts.map +1 -0
- package/dist/core/multi-agent/index.js +21 -0
- package/dist/core/multi-agent/index.js.map +1 -0
- package/dist/core/multi-agent/mailbox.d.ts +56 -0
- package/dist/core/multi-agent/mailbox.d.ts.map +1 -0
- package/dist/core/multi-agent/mailbox.js +112 -0
- package/dist/core/multi-agent/mailbox.js.map +1 -0
- package/dist/core/multi-agent/permission-gate.d.ts +140 -0
- package/dist/core/multi-agent/permission-gate.d.ts.map +1 -0
- package/dist/core/multi-agent/permission-gate.js +669 -0
- package/dist/core/multi-agent/permission-gate.js.map +1 -0
- package/dist/core/multi-agent/task-board.d.ts +100 -0
- package/dist/core/multi-agent/task-board.d.ts.map +1 -0
- package/dist/core/multi-agent/task-board.js +141 -0
- package/dist/core/multi-agent/task-board.js.map +1 -0
- package/dist/core/multi-agent/worktree.d.ts +50 -0
- package/dist/core/multi-agent/worktree.d.ts.map +1 -0
- package/dist/core/multi-agent/worktree.js +148 -0
- package/dist/core/multi-agent/worktree.js.map +1 -0
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +0 -6
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-attribution.d.ts.map +1 -1
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +2 -46
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +7 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +0 -1
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +7 -11
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +7 -3
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +17 -18
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts +1 -0
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +3 -3
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/socket-server/discovery.d.ts.map +1 -1
- package/dist/core/socket-server/discovery.js.map +1 -1
- package/dist/core/socket-server/index.d.ts.map +1 -1
- package/dist/core/socket-server/session-integration.d.ts.map +1 -1
- package/dist/core/socket-server/session-integration.js.map +1 -1
- package/dist/core/socket-server/socket-client.d.ts.map +1 -1
- package/dist/core/socket-server/socket-client.js.map +1 -1
- package/dist/core/socket-server/socket-server.d.ts.map +1 -1
- package/dist/core/socket-server/socket-server.js.map +1 -1
- package/dist/core/socket-server/types.d.ts.map +1 -1
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/telemetry.d.ts.map +1 -1
- package/dist/core/telemetry.js.map +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +8 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +12 -18
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +0 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +0 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/gsd/domain-validator.d.ts.map +1 -1
- package/dist/gsd/domain-validator.js.map +1 -1
- package/dist/gsd/domain.d.ts.map +1 -1
- package/dist/gsd/domain.js.map +1 -1
- package/dist/gsd/git.d.ts.map +1 -1
- package/dist/gsd/git.js.map +1 -1
- package/dist/gsd/hook-utils.d.ts.map +1 -1
- package/dist/gsd/hook-utils.js +3 -1
- package/dist/gsd/hook-utils.js.map +1 -1
- package/dist/gsd/index.d.ts.map +1 -1
- package/dist/gsd/index.js.map +1 -1
- package/dist/gsd/planning.d.ts.map +1 -1
- package/dist/gsd/planning.js.map +1 -1
- package/dist/hooks/gsd/draht-post-task.js +1 -1
- package/dist/hooks/gsd/draht-quality-gate.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js +6 -10
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +1 -7
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +4 -9
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +0 -3
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +1 -3
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -3
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +5 -22
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +0 -5
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +1 -8
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +1 -4
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -6
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js +6 -8
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +0 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +1 -7
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +2 -8
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +1 -9
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +2 -4
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +4 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +2 -4
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +3 -9
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +8 -20
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +3 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +19 -18
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +9 -13
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +33 -57
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +10 -14
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +0 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +1 -3
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +0 -2
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +0 -2
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +0 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -24
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +18 -32
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +0 -6
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +3 -6
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +0 -3
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +21 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +312 -143
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-search.d.ts.map +1 -1
- package/dist/modes/interactive/model-search.js.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +2 -7
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +3 -4
- package/dist/modes/interactive/theme/theme.d.ts +4 -3
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +8 -10
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +1 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +6 -6
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +10 -11
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/prompts/agents/build.md +38 -0
- package/dist/prompts/agents/plan.md +36 -0
- package/dist/prompts/agents/verify.md +36 -4
- package/dist/prompts/commands/brainstorm.md +16 -2
- package/dist/prompts/commands/discuss-phase.md +1 -1
- package/dist/prompts/commands/execute-phase.md +16 -3
- package/dist/prompts/commands/fix.md +13 -1
- package/dist/prompts/commands/init-project.md +1 -0
- package/dist/prompts/commands/map-codebase.md +9 -9
- package/dist/prompts/commands/new-project.md +1 -0
- package/dist/prompts/commands/next-milestone.md +3 -0
- package/dist/prompts/commands/orchestrate-loop.md +99 -0
- package/dist/prompts/commands/orchestrate.md +29 -6
- package/dist/prompts/commands/pause-work.md +2 -1
- package/dist/prompts/commands/plan-phase.md +6 -0
- package/dist/prompts/commands/quick.md +6 -2
- package/dist/prompts/commands/review.md +4 -1
- package/dist/prompts/commands/verify-work.md +10 -8
- package/dist/rlm-cli.d.ts +92 -0
- package/dist/rlm-cli.d.ts.map +1 -0
- package/dist/rlm-cli.js +379 -0
- package/dist/rlm-cli.js.map +1 -0
- package/dist/rpc-entry.d.ts.map +1 -1
- package/dist/rpc-entry.js.map +1 -1
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/deprecation.d.ts.map +1 -1
- package/dist/utils/deprecation.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js.map +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/html.d.ts.map +1 -1
- package/dist/utils/html.js.map +1 -1
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-process.d.ts.map +1 -1
- package/dist/utils/image-process.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/image-resize-worker.d.ts.map +1 -1
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/notify.d.ts +3 -1
- package/dist/utils/notify.d.ts.map +1 -1
- package/dist/utils/notify.js +11 -4
- package/dist/utils/notify.js.map +1 -1
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts.map +1 -1
- package/dist/utils/pi-user-agent.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/sleep.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/docs/custom-provider.md +4 -3
- package/docs/extensions.md +15 -10
- package/docs/models.md +49 -8
- package/docs/rpc.md +15 -5
- package/docs/sdk.md +1 -1
- package/docs/settings.md +3 -2
- package/docs/themes.md +5 -3
- package/docs/tui.md +1 -1
- package/docs/usage.md +2 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/preset.ts +2 -2
- package/examples/extensions/reload-runtime.ts +2 -2
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/README.md +1 -1
- package/hooks/gsd/draht-post-task.js +1 -1
- package/hooks/gsd/draht-quality-gate.js +1 -1
- package/package.json +10 -8
- package/prompts/agents/build.md +38 -0
- package/prompts/agents/plan.md +36 -0
- package/prompts/agents/verify.md +36 -4
- package/prompts/commands/brainstorm.md +16 -2
- package/prompts/commands/discuss-phase.md +1 -1
- package/prompts/commands/execute-phase.md +16 -3
- package/prompts/commands/fix.md +13 -1
- package/prompts/commands/init-project.md +1 -0
- package/prompts/commands/map-codebase.md +9 -9
- package/prompts/commands/new-project.md +1 -0
- package/prompts/commands/next-milestone.md +3 -0
- package/prompts/commands/orchestrate-loop.md +99 -0
- package/prompts/commands/orchestrate.md +29 -6
- package/prompts/commands/pause-work.md +2 -1
- package/prompts/commands/plan-phase.md +6 -0
- package/prompts/commands/quick.md +6 -2
- package/prompts/commands/review.md +4 -1
- package/prompts/commands/verify-work.md +10 -8
|
@@ -13,6 +13,7 @@ import { spawn, spawnSync } from "child_process";
|
|
|
13
13
|
import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, DISPLAY_VERSION, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.js";
|
|
14
14
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
15
15
|
import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
|
|
16
|
+
import { CACHE_TTL_MS, collectCacheMisses, computeCacheWaste, detectCacheMiss, } from "../../core/cache-stats.js";
|
|
16
17
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
17
18
|
import { configureHttpDispatcher, formatHttpIdleTimeoutMs } from "../../core/http-dispatcher.js";
|
|
18
19
|
import { KeybindingsManager } from "../../core/keybindings.js";
|
|
@@ -29,6 +30,7 @@ import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelo
|
|
|
29
30
|
import { copyToClipboard } from "../../utils/clipboard.js";
|
|
30
31
|
import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
|
|
31
32
|
import { parseGitUrl } from "../../utils/git.js";
|
|
33
|
+
import { sendTerminalNotification } from "../../utils/notify.js";
|
|
32
34
|
import { getCwdRelativePath } from "../../utils/paths.js";
|
|
33
35
|
import { getPiUserAgent } from "../../utils/pi-user-agent.js";
|
|
34
36
|
import { killTrackedDetachedChildren } from "../../utils/shell.js";
|
|
@@ -49,11 +51,11 @@ import { EarendilAnnouncementComponent } from "./components/earendil-announcemen
|
|
|
49
51
|
import { ExtensionEditorComponent } from "./components/extension-editor.js";
|
|
50
52
|
import { ExtensionInputComponent } from "./components/extension-input.js";
|
|
51
53
|
import { ExtensionSelectorComponent } from "./components/extension-selector.js";
|
|
52
|
-
import { FooterComponent } from "./components/footer.js";
|
|
54
|
+
import { FooterComponent, formatTokens } from "./components/footer.js";
|
|
53
55
|
import { formatKeyText, keyDisplayText, keyHint, keyText, rawKeyHint } from "./components/keybinding-hints.js";
|
|
54
56
|
import { LoginDialogComponent } from "./components/login-dialog.js";
|
|
55
57
|
import { ModelSelectorComponent } from "./components/model-selector.js";
|
|
56
|
-
import { OAuthSelectorComponent } from "./components/oauth-selector.js";
|
|
58
|
+
import { formatAuthSelectorProviderType, OAuthSelectorComponent, } from "./components/oauth-selector.js";
|
|
57
59
|
import { ScopedModelsSelectorComponent } from "./components/scoped-models-selector.js";
|
|
58
60
|
import { SessionSelectorComponent } from "./components/session-selector.js";
|
|
59
61
|
import { SettingsSelectorComponent } from "./components/settings-selector.js";
|
|
@@ -71,8 +73,6 @@ function isExpandable(obj) {
|
|
|
71
73
|
return typeof obj === "object" && obj !== null && "setExpanded" in obj && typeof obj.setExpanded === "function";
|
|
72
74
|
}
|
|
73
75
|
class ExpandableText extends Text {
|
|
74
|
-
getCollapsedText;
|
|
75
|
-
getExpandedText;
|
|
76
76
|
constructor(getCollapsedText, getExpandedText, expanded = false, paddingX = 0, paddingY = 0) {
|
|
77
77
|
super(expanded ? getExpandedText() : getCollapsedText(), paddingX, paddingY);
|
|
78
78
|
this.getCollapsedText = getCollapsedText;
|
|
@@ -135,94 +135,43 @@ export function isApiKeyLoginProvider(providerId, oauthProviderIds, builtInProvi
|
|
|
135
135
|
}
|
|
136
136
|
return !oauthProviderIds.has(providerId);
|
|
137
137
|
}
|
|
138
|
+
const AUTH_TYPE_ORDER = { oauth: 0, api_key: 1 };
|
|
139
|
+
function createFuzzyAutocompleteItems(items, prefix, getSearchText, toAutocompleteItem) {
|
|
140
|
+
const filtered = fuzzyFilter(items, prefix, getSearchText);
|
|
141
|
+
if (filtered.length === 0)
|
|
142
|
+
return null;
|
|
143
|
+
return filtered.map(toAutocompleteItem);
|
|
144
|
+
}
|
|
145
|
+
function getLoginProviderCompletionOptions(providerOptions) {
|
|
146
|
+
const byId = new Map();
|
|
147
|
+
for (const provider of providerOptions) {
|
|
148
|
+
const existing = byId.get(provider.id);
|
|
149
|
+
if (existing) {
|
|
150
|
+
if (!existing.authTypes.includes(provider.authType)) {
|
|
151
|
+
existing.authTypes.push(provider.authType);
|
|
152
|
+
existing.authTypes.sort((a, b) => AUTH_TYPE_ORDER[a] - AUTH_TYPE_ORDER[b]);
|
|
153
|
+
}
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
byId.set(provider.id, {
|
|
157
|
+
id: provider.id,
|
|
158
|
+
name: provider.name,
|
|
159
|
+
authTypes: [provider.authType],
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return Array.from(byId.values()).sort((a, b) => a.name.localeCompare(b.name));
|
|
163
|
+
}
|
|
164
|
+
function getLoginProviderSearchText(provider) {
|
|
165
|
+
const authTypes = provider.authTypes
|
|
166
|
+
.map((authType) => `${authType} ${formatAuthSelectorProviderType(authType)}`)
|
|
167
|
+
.join(" ");
|
|
168
|
+
return `${provider.id} ${provider.name} ${authTypes}`;
|
|
169
|
+
}
|
|
170
|
+
function formatLoginProviderCompletionDescription(provider) {
|
|
171
|
+
const authTypes = provider.authTypes.map(formatAuthSelectorProviderType).join("/");
|
|
172
|
+
return provider.name === provider.id ? authTypes : `${provider.name} · ${authTypes}`;
|
|
173
|
+
}
|
|
138
174
|
export class InteractiveMode {
|
|
139
|
-
runtimeHost;
|
|
140
|
-
ui;
|
|
141
|
-
loadedResourcesContainer;
|
|
142
|
-
chatContainer;
|
|
143
|
-
pendingMessagesContainer;
|
|
144
|
-
statusContainer;
|
|
145
|
-
defaultEditor;
|
|
146
|
-
editor;
|
|
147
|
-
editorComponentFactory;
|
|
148
|
-
autocompleteProvider;
|
|
149
|
-
autocompleteProviderWrappers = [];
|
|
150
|
-
fdPath;
|
|
151
|
-
editorContainer;
|
|
152
|
-
footer;
|
|
153
|
-
footerDataProvider;
|
|
154
|
-
// Stored so the same manager can be injected into custom editors, selectors, and extension UI.
|
|
155
|
-
keybindings;
|
|
156
|
-
version;
|
|
157
|
-
isInitialized = false;
|
|
158
|
-
onInputCallback;
|
|
159
|
-
pendingUserInputs = [];
|
|
160
|
-
activeStatusIndicator = undefined;
|
|
161
|
-
idleStatus = new IdleStatus();
|
|
162
|
-
workingMessage = undefined;
|
|
163
|
-
workingVisible = true;
|
|
164
|
-
workingIndicatorOptions = undefined;
|
|
165
|
-
defaultWorkingMessage = "Working...";
|
|
166
|
-
defaultHiddenThinkingLabel = "Thinking...";
|
|
167
|
-
hiddenThinkingLabel = this.defaultHiddenThinkingLabel;
|
|
168
|
-
lastSigintTime = 0;
|
|
169
|
-
lastEscapeTime = 0;
|
|
170
|
-
changelogMarkdown = undefined;
|
|
171
|
-
startupNoticesShown = false;
|
|
172
|
-
anthropicSubscriptionWarningShown = false;
|
|
173
|
-
// Status line tracking (for mutating immediately-sequential status updates)
|
|
174
|
-
lastStatusSpacer = undefined;
|
|
175
|
-
lastStatusText = undefined;
|
|
176
|
-
// Streaming message tracking
|
|
177
|
-
streamingComponent = undefined;
|
|
178
|
-
streamingMessage = undefined;
|
|
179
|
-
// Tool execution tracking: toolCallId -> component
|
|
180
|
-
pendingTools = new Map();
|
|
181
|
-
// Tool output expansion state
|
|
182
|
-
toolOutputExpanded = false;
|
|
183
|
-
// Thinking block visibility state
|
|
184
|
-
hideThinkingBlock = false;
|
|
185
|
-
outputPad = 1;
|
|
186
|
-
// Skill commands: command name -> skill file path
|
|
187
|
-
skillCommands = new Map();
|
|
188
|
-
// Agent subscription unsubscribe function
|
|
189
|
-
unsubscribe;
|
|
190
|
-
signalCleanupHandlers = [];
|
|
191
|
-
// Track if editor is in bash mode (text starts with !)
|
|
192
|
-
isBashMode = false;
|
|
193
|
-
// Track current bash execution component
|
|
194
|
-
bashComponent = undefined;
|
|
195
|
-
// Track pending bash components (shown in pending area, moved to chat on submit)
|
|
196
|
-
pendingBashComponents = [];
|
|
197
|
-
// Auto-compaction state
|
|
198
|
-
autoCompactionEscapeHandler;
|
|
199
|
-
// Auto-retry state
|
|
200
|
-
retryEscapeHandler;
|
|
201
|
-
// Messages queued while compaction is running
|
|
202
|
-
compactionQueuedMessages = [];
|
|
203
|
-
// Shutdown state
|
|
204
|
-
shutdownRequested = false;
|
|
205
|
-
// Extension UI state
|
|
206
|
-
extensionSelector = undefined;
|
|
207
|
-
extensionInput = undefined;
|
|
208
|
-
extensionEditor = undefined;
|
|
209
|
-
extensionTerminalInputUnsubscribers = new Set();
|
|
210
|
-
// Extension widgets (components rendered above/below the editor)
|
|
211
|
-
extensionWidgetsAbove = new Map();
|
|
212
|
-
extensionWidgetsBelow = new Map();
|
|
213
|
-
widgetContainerAbove;
|
|
214
|
-
widgetContainerBelow;
|
|
215
|
-
// Custom footer from extension (undefined = use built-in footer)
|
|
216
|
-
customFooter = undefined;
|
|
217
|
-
// Header container that holds the built-in or custom header
|
|
218
|
-
headerContainer;
|
|
219
|
-
// Built-in header (logo + keybinding hints + changelog)
|
|
220
|
-
builtInHeader = undefined;
|
|
221
|
-
// Custom header from extension (undefined = use built-in header)
|
|
222
|
-
customHeader = undefined;
|
|
223
|
-
options;
|
|
224
|
-
autoTrustOnReloadCwd;
|
|
225
|
-
themeController;
|
|
226
175
|
// Convenience accessors
|
|
227
176
|
get session() {
|
|
228
177
|
return this.runtimeHost.session;
|
|
@@ -237,6 +186,68 @@ export class InteractiveMode {
|
|
|
237
186
|
return this.session.settingsManager;
|
|
238
187
|
}
|
|
239
188
|
constructor(runtimeHost, options = {}) {
|
|
189
|
+
this.autocompleteProviderWrappers = [];
|
|
190
|
+
this.isInitialized = false;
|
|
191
|
+
this.pendingUserInputs = [];
|
|
192
|
+
this.activeStatusIndicator = undefined;
|
|
193
|
+
this.idleStatus = new IdleStatus();
|
|
194
|
+
this.workingMessage = undefined;
|
|
195
|
+
this.workingVisible = true;
|
|
196
|
+
this.workingIndicatorOptions = undefined;
|
|
197
|
+
this.defaultWorkingMessage = "Working...";
|
|
198
|
+
this.defaultHiddenThinkingLabel = "Thinking...";
|
|
199
|
+
this.hiddenThinkingLabel = this.defaultHiddenThinkingLabel;
|
|
200
|
+
this.lastSigintTime = 0;
|
|
201
|
+
this.lastEscapeTime = 0;
|
|
202
|
+
this.changelogMarkdown = undefined;
|
|
203
|
+
this.startupNoticesShown = false;
|
|
204
|
+
this.anthropicSubscriptionWarningShown = false;
|
|
205
|
+
// Status line tracking (for mutating immediately-sequential status updates)
|
|
206
|
+
this.lastStatusSpacer = undefined;
|
|
207
|
+
this.lastStatusText = undefined;
|
|
208
|
+
// Streaming message tracking
|
|
209
|
+
this.streamingComponent = undefined;
|
|
210
|
+
this.streamingMessage = undefined;
|
|
211
|
+
// Tool execution tracking: toolCallId -> component
|
|
212
|
+
this.pendingTools = new Map();
|
|
213
|
+
// Tool output expansion state
|
|
214
|
+
this.toolOutputExpanded = false;
|
|
215
|
+
// Thinking block visibility state
|
|
216
|
+
this.hideThinkingBlock = false;
|
|
217
|
+
this.outputPad = 1;
|
|
218
|
+
// Skill commands: command name -> skill file path
|
|
219
|
+
this.skillCommands = new Map();
|
|
220
|
+
this.signalCleanupHandlers = [];
|
|
221
|
+
// Track if editor is in bash mode (text starts with !)
|
|
222
|
+
this.isBashMode = false;
|
|
223
|
+
// Track current bash execution component
|
|
224
|
+
this.bashComponent = undefined;
|
|
225
|
+
// Track pending bash components (shown in pending area, moved to chat on submit)
|
|
226
|
+
this.pendingBashComponents = [];
|
|
227
|
+
// Messages queued while compaction is running
|
|
228
|
+
this.compactionQueuedMessages = [];
|
|
229
|
+
// Shutdown state
|
|
230
|
+
this.shutdownRequested = false;
|
|
231
|
+
// Extension UI state
|
|
232
|
+
this.extensionSelector = undefined;
|
|
233
|
+
this.extensionInput = undefined;
|
|
234
|
+
this.extensionEditor = undefined;
|
|
235
|
+
this.extensionTerminalInputUnsubscribers = new Set();
|
|
236
|
+
// Extension widgets (components rendered above/below the editor)
|
|
237
|
+
this.extensionWidgetsAbove = new Map();
|
|
238
|
+
this.extensionWidgetsBelow = new Map();
|
|
239
|
+
// Custom footer from extension (undefined = use built-in footer)
|
|
240
|
+
this.customFooter = undefined;
|
|
241
|
+
// Built-in header (logo + keybinding hints + changelog)
|
|
242
|
+
this.builtInHeader = undefined;
|
|
243
|
+
// Custom header from extension (undefined = use built-in header)
|
|
244
|
+
this.customHeader = undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Gracefully shutdown the agent.
|
|
247
|
+
* Stops the TUI before emitting shutdown events so extension UI cleanup cannot
|
|
248
|
+
* repaint the final frame while the process is exiting.
|
|
249
|
+
*/
|
|
250
|
+
this.isShuttingDown = false;
|
|
240
251
|
this.runtimeHost = runtimeHost;
|
|
241
252
|
this.options = options;
|
|
242
253
|
this.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd;
|
|
@@ -321,6 +332,7 @@ export class InteractiveMode {
|
|
|
321
332
|
const slashCommands = BUILTIN_SLASH_COMMANDS.map((command) => ({
|
|
322
333
|
name: command.name,
|
|
323
334
|
description: command.description,
|
|
335
|
+
...(command.argumentHint && { argumentHint: command.argumentHint }),
|
|
324
336
|
}));
|
|
325
337
|
const modelCommand = slashCommands.find((command) => command.name === "model");
|
|
326
338
|
if (modelCommand) {
|
|
@@ -338,17 +350,24 @@ export class InteractiveMode {
|
|
|
338
350
|
name: m.name,
|
|
339
351
|
label: `${m.provider}/${m.id}`,
|
|
340
352
|
}));
|
|
341
|
-
|
|
342
|
-
const filtered = fuzzyFilter(items, prefix, getModelSearchText);
|
|
343
|
-
if (filtered.length === 0)
|
|
344
|
-
return null;
|
|
345
|
-
return filtered.map((item) => ({
|
|
353
|
+
return createFuzzyAutocompleteItems(items, prefix, getModelSearchText, (item) => ({
|
|
346
354
|
value: item.label,
|
|
347
355
|
label: item.id,
|
|
348
356
|
description: item.provider,
|
|
349
357
|
}));
|
|
350
358
|
};
|
|
351
359
|
}
|
|
360
|
+
const loginCommand = slashCommands.find((command) => command.name === "login");
|
|
361
|
+
if (loginCommand) {
|
|
362
|
+
loginCommand.getArgumentCompletions = (prefix) => {
|
|
363
|
+
const providers = getLoginProviderCompletionOptions(this.getLoginProviderOptions());
|
|
364
|
+
return createFuzzyAutocompleteItems(providers, prefix, getLoginProviderSearchText, (provider) => ({
|
|
365
|
+
value: provider.id,
|
|
366
|
+
label: provider.id,
|
|
367
|
+
description: formatLoginProviderCompletionDescription(provider),
|
|
368
|
+
}));
|
|
369
|
+
};
|
|
370
|
+
}
|
|
352
371
|
// Convert prompt templates to SlashCommand format for autocomplete
|
|
353
372
|
const templateCommands = this.session.promptTemplates.map((cmd) => ({
|
|
354
373
|
name: cmd.name,
|
|
@@ -1171,7 +1190,7 @@ export class InteractiveMode {
|
|
|
1171
1190
|
this.restoreQueuedMessagesToEditor({ abort: true });
|
|
1172
1191
|
},
|
|
1173
1192
|
commandContextActions: {
|
|
1174
|
-
waitForIdle: () => this.session.
|
|
1193
|
+
waitForIdle: () => this.session.waitForIdle(),
|
|
1175
1194
|
newSession: async (options) => {
|
|
1176
1195
|
this.clearStatusIndicator();
|
|
1177
1196
|
try {
|
|
@@ -1222,7 +1241,7 @@ export class InteractiveMode {
|
|
|
1222
1241
|
},
|
|
1223
1242
|
shutdownHandler: () => {
|
|
1224
1243
|
this.shutdownRequested = true;
|
|
1225
|
-
if (
|
|
1244
|
+
if (this.session.isIdle) {
|
|
1226
1245
|
void this.shutdown();
|
|
1227
1246
|
}
|
|
1228
1247
|
},
|
|
@@ -1315,7 +1334,7 @@ export class InteractiveMode {
|
|
|
1315
1334
|
sessionManager: this.sessionManager,
|
|
1316
1335
|
modelRegistry: this.session.modelRegistry,
|
|
1317
1336
|
model: this.session.model,
|
|
1318
|
-
isIdle: () =>
|
|
1337
|
+
isIdle: () => this.session.isIdle,
|
|
1319
1338
|
isProjectTrusted: () => this.settingsManager.isProjectTrusted(),
|
|
1320
1339
|
signal: this.session.agent.signal,
|
|
1321
1340
|
abort: () => {
|
|
@@ -1490,7 +1509,7 @@ export class InteractiveMode {
|
|
|
1490
1509
|
this.setHiddenThinkingLabel();
|
|
1491
1510
|
}
|
|
1492
1511
|
// Maximum total widget lines to prevent viewport overflow
|
|
1493
|
-
static MAX_WIDGET_LINES = 10;
|
|
1512
|
+
static { this.MAX_WIDGET_LINES = 10; }
|
|
1494
1513
|
/**
|
|
1495
1514
|
* Render all extension widgets to the widget container.
|
|
1496
1515
|
*/
|
|
@@ -2121,9 +2140,10 @@ export class InteractiveMode {
|
|
|
2121
2140
|
this.editor.setText("");
|
|
2122
2141
|
return;
|
|
2123
2142
|
}
|
|
2124
|
-
if (text === "/login") {
|
|
2125
|
-
|
|
2143
|
+
if (text === "/login" || text.startsWith("/login ")) {
|
|
2144
|
+
const providerRef = text.startsWith("/login ") ? text.slice(7).trim() : undefined;
|
|
2126
2145
|
this.editor.setText("");
|
|
2146
|
+
await this.handleLoginCommand(providerRef);
|
|
2127
2147
|
return;
|
|
2128
2148
|
}
|
|
2129
2149
|
if (text === "/logout") {
|
|
@@ -2348,6 +2368,7 @@ export class InteractiveMode {
|
|
|
2348
2368
|
for (const [, component] of this.pendingTools.entries()) {
|
|
2349
2369
|
component.setArgsComplete();
|
|
2350
2370
|
}
|
|
2371
|
+
this.maybeShowCacheMissNotice(this.streamingMessage);
|
|
2351
2372
|
}
|
|
2352
2373
|
this.streamingComponent = undefined;
|
|
2353
2374
|
this.streamingMessage = undefined;
|
|
@@ -2398,9 +2419,12 @@ export class InteractiveMode {
|
|
|
2398
2419
|
this.streamingMessage = undefined;
|
|
2399
2420
|
}
|
|
2400
2421
|
this.pendingTools.clear();
|
|
2401
|
-
|
|
2422
|
+
sendTerminalNotification(APP_NAME, "Ready for input");
|
|
2402
2423
|
this.ui.requestRender();
|
|
2403
2424
|
break;
|
|
2425
|
+
case "agent_settled":
|
|
2426
|
+
await this.checkShutdownRequested();
|
|
2427
|
+
break;
|
|
2404
2428
|
case "compaction_start": {
|
|
2405
2429
|
if (this.settingsManager.getShowTerminalProgress()) {
|
|
2406
2430
|
this.ui.terminal.setProgress(true);
|
|
@@ -2607,6 +2631,11 @@ export class InteractiveMode {
|
|
|
2607
2631
|
renderSessionItems(items, options = {}) {
|
|
2608
2632
|
this.pendingTools.clear();
|
|
2609
2633
|
const renderedPendingTools = new Map();
|
|
2634
|
+
// Cache-miss notices are not persisted; re-derive them from the full entry
|
|
2635
|
+
// list and re-inject them after the assistant messages that paid for them.
|
|
2636
|
+
const cacheMisses = this.settingsManager.getShowCacheMissNotices()
|
|
2637
|
+
? collectCacheMisses(this.sessionManager.getEntries(), this.session.modelRegistry)
|
|
2638
|
+
: new Map();
|
|
2610
2639
|
if (options.updateFooter) {
|
|
2611
2640
|
this.footer.invalidate();
|
|
2612
2641
|
this.updateEditorBorderColor();
|
|
@@ -2648,6 +2677,11 @@ export class InteractiveMode {
|
|
|
2648
2677
|
}
|
|
2649
2678
|
}
|
|
2650
2679
|
}
|
|
2680
|
+
if (message.stopReason !== "aborted" && message.stopReason !== "error") {
|
|
2681
|
+
const miss = cacheMisses.get(message);
|
|
2682
|
+
if (miss)
|
|
2683
|
+
this.addCacheMissNotice(miss);
|
|
2684
|
+
}
|
|
2651
2685
|
}
|
|
2652
2686
|
else if (message.role === "toolResult") {
|
|
2653
2687
|
// Match tool results to pending tool components
|
|
@@ -2682,6 +2716,35 @@ export class InteractiveMode {
|
|
|
2682
2716
|
});
|
|
2683
2717
|
this.renderSessionItems(items, options);
|
|
2684
2718
|
}
|
|
2719
|
+
/**
|
|
2720
|
+
* Show a transcript notice when a completed assistant message paid for a
|
|
2721
|
+
* significant cache miss. Only states observable facts: the miss itself,
|
|
2722
|
+
* a model switch, or an idle gap past the cache TTL.
|
|
2723
|
+
*/
|
|
2724
|
+
maybeShowCacheMissNotice(message) {
|
|
2725
|
+
if (!this.settingsManager.getShowCacheMissNotices())
|
|
2726
|
+
return;
|
|
2727
|
+
// Entries don't contain `message` yet: message_end fires before persistence.
|
|
2728
|
+
const miss = detectCacheMiss(this.sessionManager.getEntries(), message, this.session.modelRegistry);
|
|
2729
|
+
if (miss)
|
|
2730
|
+
this.addCacheMissNotice(miss);
|
|
2731
|
+
}
|
|
2732
|
+
addCacheMissNotice(miss) {
|
|
2733
|
+
if (miss.missedTokens < 20_000 && miss.missedCost < 0.1)
|
|
2734
|
+
return;
|
|
2735
|
+
const cost = miss.missedCost >= 0.01 ? ` (~$${miss.missedCost.toFixed(2)})` : "";
|
|
2736
|
+
const reBilled = `${formatTokens(miss.missedTokens)} tokens re-billed${cost}`;
|
|
2737
|
+
let label = "Cache miss";
|
|
2738
|
+
if (miss.modelChanged) {
|
|
2739
|
+
label = "Cache miss after model switch";
|
|
2740
|
+
}
|
|
2741
|
+
else if (miss.idleMs >= CACHE_TTL_MS) {
|
|
2742
|
+
label = `Cache miss after ${Math.round(miss.idleMs / 60_000)}m idle`;
|
|
2743
|
+
}
|
|
2744
|
+
const text = theme.fg("warning", `${label}: ${reBilled}`);
|
|
2745
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
2746
|
+
this.chatContainer.addChild(new Text(text, 1, 0));
|
|
2747
|
+
}
|
|
2685
2748
|
renderInitialMessages() {
|
|
2686
2749
|
const entries = this.sessionManager.buildContextEntries();
|
|
2687
2750
|
this.renderSessionEntries(entries, {
|
|
@@ -2739,12 +2802,6 @@ export class InteractiveMode {
|
|
|
2739
2802
|
// Only called when editor is empty (enforced by CustomEditor)
|
|
2740
2803
|
void this.shutdown();
|
|
2741
2804
|
}
|
|
2742
|
-
/**
|
|
2743
|
-
* Gracefully shutdown the agent.
|
|
2744
|
-
* Stops the TUI before emitting shutdown events so extension UI cleanup cannot
|
|
2745
|
-
* repaint the final frame while the process is exiting.
|
|
2746
|
-
*/
|
|
2747
|
-
isShuttingDown = false;
|
|
2748
2805
|
async shutdown(options) {
|
|
2749
2806
|
if (this.isShuttingDown)
|
|
2750
2807
|
return;
|
|
@@ -3319,6 +3376,7 @@ export class InteractiveMode {
|
|
|
3319
3376
|
doubleEscapeAction: this.settingsManager.getDoubleEscapeAction(),
|
|
3320
3377
|
treeFilterMode: this.settingsManager.getTreeFilterMode(),
|
|
3321
3378
|
showHardwareCursor: this.settingsManager.getShowHardwareCursor(),
|
|
3379
|
+
showCacheMissNotices: this.settingsManager.getShowCacheMissNotices(),
|
|
3322
3380
|
defaultProjectTrust: this.settingsManager.getDefaultProjectTrust(),
|
|
3323
3381
|
editorPaddingX: this.settingsManager.getEditorPaddingX(),
|
|
3324
3382
|
outputPad: this.settingsManager.getOutputPad(),
|
|
@@ -3394,6 +3452,10 @@ export class InteractiveMode {
|
|
|
3394
3452
|
this.chatContainer.clear();
|
|
3395
3453
|
this.rebuildChatFromMessages();
|
|
3396
3454
|
},
|
|
3455
|
+
onShowCacheMissNoticesChange: (shown) => {
|
|
3456
|
+
this.settingsManager.setShowCacheMissNotices(shown);
|
|
3457
|
+
this.rebuildChatFromMessages();
|
|
3458
|
+
},
|
|
3397
3459
|
onCollapseChangelogChange: (collapsed) => {
|
|
3398
3460
|
this.settingsManager.setCollapseChangelog(collapsed);
|
|
3399
3461
|
},
|
|
@@ -3683,19 +3745,17 @@ export class InteractiveMode {
|
|
|
3683
3745
|
const initialSelectedId = userMessages[userMessages.length - 1]?.entryId;
|
|
3684
3746
|
this.showSelector((done) => {
|
|
3685
3747
|
const selector = new UserMessageSelectorComponent(userMessages.map((m) => ({ id: m.entryId, text: m.text })), async (entryId) => {
|
|
3748
|
+
done();
|
|
3686
3749
|
try {
|
|
3687
3750
|
const result = await this.runtimeHost.fork(entryId);
|
|
3688
3751
|
if (result.cancelled) {
|
|
3689
|
-
done();
|
|
3690
3752
|
this.ui.requestRender();
|
|
3691
3753
|
return;
|
|
3692
3754
|
}
|
|
3693
3755
|
this.editor.setText(result.selectedText ?? "");
|
|
3694
|
-
done();
|
|
3695
3756
|
this.showStatus("Forked to new session");
|
|
3696
3757
|
}
|
|
3697
3758
|
catch (error) {
|
|
3698
|
-
done();
|
|
3699
3759
|
this.showError(error instanceof Error ? error.message : String(error));
|
|
3700
3760
|
}
|
|
3701
3761
|
}, () => {
|
|
@@ -3924,13 +3984,82 @@ export class InteractiveMode {
|
|
|
3924
3984
|
}
|
|
3925
3985
|
return options.sort((a, b) => a.name.localeCompare(b.name));
|
|
3926
3986
|
}
|
|
3927
|
-
|
|
3987
|
+
findLoginProviderOptions(providerRef) {
|
|
3988
|
+
const normalizedProviderRef = providerRef.trim().toLowerCase();
|
|
3989
|
+
if (!normalizedProviderRef) {
|
|
3990
|
+
return [];
|
|
3991
|
+
}
|
|
3992
|
+
return this.getLoginProviderOptions().filter((provider) => provider.id.toLowerCase() === normalizedProviderRef ||
|
|
3993
|
+
provider.name.toLowerCase() === normalizedProviderRef);
|
|
3994
|
+
}
|
|
3995
|
+
async handleLoginCommand(providerRef) {
|
|
3996
|
+
if (!providerRef) {
|
|
3997
|
+
this.showLoginAuthTypeSelector();
|
|
3998
|
+
return;
|
|
3999
|
+
}
|
|
4000
|
+
const providerOptions = this.findLoginProviderOptions(providerRef);
|
|
4001
|
+
if (providerOptions.length === 1) {
|
|
4002
|
+
await this.startProviderLogin(providerOptions[0]);
|
|
4003
|
+
return;
|
|
4004
|
+
}
|
|
4005
|
+
if (providerOptions.length > 1) {
|
|
4006
|
+
const providerIds = new Set(providerOptions.map((provider) => provider.id));
|
|
4007
|
+
if (providerIds.size === 1) {
|
|
4008
|
+
this.showLoginAuthTypeSelector(providerOptions);
|
|
4009
|
+
return;
|
|
4010
|
+
}
|
|
4011
|
+
}
|
|
4012
|
+
this.showLoginProviderSelector(undefined, providerRef);
|
|
4013
|
+
}
|
|
4014
|
+
async startProviderLogin(providerOption) {
|
|
4015
|
+
if (providerOption.authType === "oauth") {
|
|
4016
|
+
await this.showLoginDialog(providerOption.id, providerOption.name);
|
|
4017
|
+
}
|
|
4018
|
+
else if (providerOption.id === BEDROCK_PROVIDER_ID) {
|
|
4019
|
+
this.showBedrockSetupDialog(providerOption.id, providerOption.name);
|
|
4020
|
+
}
|
|
4021
|
+
else {
|
|
4022
|
+
await this.showApiKeyLoginDialog(providerOption.id, providerOption.name);
|
|
4023
|
+
}
|
|
4024
|
+
}
|
|
4025
|
+
showLoginAuthTypeSelector(providerOptions) {
|
|
3928
4026
|
const subscriptionLabel = "Use a subscription";
|
|
3929
4027
|
const apiKeyLabel = "Use an API key";
|
|
4028
|
+
const availableAuthTypes = providerOptions
|
|
4029
|
+
? new Set(providerOptions.map((provider) => provider.authType))
|
|
4030
|
+
: new Set(["oauth", "api_key"]);
|
|
4031
|
+
const options = [];
|
|
4032
|
+
if (availableAuthTypes.has("oauth")) {
|
|
4033
|
+
options.push(subscriptionLabel);
|
|
4034
|
+
}
|
|
4035
|
+
if (availableAuthTypes.has("api_key")) {
|
|
4036
|
+
options.push(apiKeyLabel);
|
|
4037
|
+
}
|
|
4038
|
+
if (options.length === 0) {
|
|
4039
|
+
this.showStatus("No login methods available.");
|
|
4040
|
+
return;
|
|
4041
|
+
}
|
|
4042
|
+
if (providerOptions && options.length === 1) {
|
|
4043
|
+
const providerOption = providerOptions[0];
|
|
4044
|
+
if (providerOption) {
|
|
4045
|
+
void this.startProviderLogin(providerOption);
|
|
4046
|
+
}
|
|
4047
|
+
return;
|
|
4048
|
+
}
|
|
4049
|
+
const title = providerOptions?.[0]
|
|
4050
|
+
? `Select authentication method for ${providerOptions[0].name}:`
|
|
4051
|
+
: "Select authentication method:";
|
|
3930
4052
|
this.showSelector((done) => {
|
|
3931
|
-
const selector = new ExtensionSelectorComponent(
|
|
4053
|
+
const selector = new ExtensionSelectorComponent(title, options, (option) => {
|
|
3932
4054
|
done();
|
|
3933
4055
|
const authType = option === subscriptionLabel ? "oauth" : "api_key";
|
|
4056
|
+
if (providerOptions) {
|
|
4057
|
+
const providerOption = providerOptions.find((provider) => provider.authType === authType);
|
|
4058
|
+
if (providerOption) {
|
|
4059
|
+
void this.startProviderLogin(providerOption);
|
|
4060
|
+
}
|
|
4061
|
+
return;
|
|
4062
|
+
}
|
|
3934
4063
|
this.showLoginProviderSelector(authType);
|
|
3935
4064
|
}, () => {
|
|
3936
4065
|
done();
|
|
@@ -3939,32 +4068,34 @@ export class InteractiveMode {
|
|
|
3939
4068
|
return { component: selector, focus: selector };
|
|
3940
4069
|
});
|
|
3941
4070
|
}
|
|
3942
|
-
showLoginProviderSelector(authType) {
|
|
4071
|
+
showLoginProviderSelector(authType, initialSearchInput) {
|
|
3943
4072
|
const providerOptions = this.getLoginProviderOptions(authType);
|
|
3944
4073
|
if (providerOptions.length === 0) {
|
|
3945
|
-
|
|
4074
|
+
const message = authType === "oauth"
|
|
4075
|
+
? "No subscription providers available."
|
|
4076
|
+
: authType === "api_key"
|
|
4077
|
+
? "No API key providers available."
|
|
4078
|
+
: "No login providers available.";
|
|
4079
|
+
this.showStatus(message);
|
|
3946
4080
|
return;
|
|
3947
4081
|
}
|
|
3948
4082
|
this.showSelector((done) => {
|
|
3949
|
-
const selector = new OAuthSelectorComponent("login", this.session.modelRegistry.authStorage, providerOptions, async (providerId) => {
|
|
4083
|
+
const selector = new OAuthSelectorComponent("login", this.session.modelRegistry.authStorage, providerOptions, async (providerId, selectedAuthType) => {
|
|
3950
4084
|
done();
|
|
3951
|
-
const providerOption = providerOptions.find((provider) => provider.id === providerId);
|
|
4085
|
+
const providerOption = providerOptions.find((provider) => provider.id === providerId && provider.authType === selectedAuthType);
|
|
3952
4086
|
if (!providerOption) {
|
|
3953
4087
|
return;
|
|
3954
4088
|
}
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
this.
|
|
4089
|
+
await this.startProviderLogin(providerOption);
|
|
4090
|
+
}, () => {
|
|
4091
|
+
done();
|
|
4092
|
+
if (authType) {
|
|
4093
|
+
this.showLoginAuthTypeSelector();
|
|
3960
4094
|
}
|
|
3961
4095
|
else {
|
|
3962
|
-
|
|
4096
|
+
this.ui.requestRender();
|
|
3963
4097
|
}
|
|
3964
|
-
}, () =>
|
|
3965
|
-
done();
|
|
3966
|
-
this.showLoginAuthTypeSelector();
|
|
3967
|
-
}, (providerId) => this.session.modelRegistry.getProviderAuthStatus(providerId));
|
|
4098
|
+
}, (providerId) => this.session.modelRegistry.getProviderAuthStatus(providerId), initialSearchInput);
|
|
3968
4099
|
return { component: selector, focus: selector };
|
|
3969
4100
|
});
|
|
3970
4101
|
}
|
|
@@ -4223,7 +4354,7 @@ export class InteractiveMode {
|
|
|
4223
4354
|
const borderColor = (s) => theme.fg("border", s);
|
|
4224
4355
|
reloadBox.addChild(new DynamicBorder(borderColor));
|
|
4225
4356
|
reloadBox.addChild(new Spacer(1));
|
|
4226
|
-
reloadBox.addChild(new Text(theme.fg("muted", "Reloading keybindings, extensions, skills, prompts, themes..."), 1, 0));
|
|
4357
|
+
reloadBox.addChild(new Text(theme.fg("muted", "Reloading keybindings, extensions, skills, prompts, themes, and context files..."), 1, 0));
|
|
4227
4358
|
reloadBox.addChild(new Spacer(1));
|
|
4228
4359
|
reloadBox.addChild(new DynamicBorder(borderColor));
|
|
4229
4360
|
const previousEditor = this.editor;
|
|
@@ -4287,8 +4418,8 @@ export class InteractiveMode {
|
|
|
4287
4418
|
this.showError(`models.json error: ${modelsJsonError}`);
|
|
4288
4419
|
}
|
|
4289
4420
|
this.showStatus(savedImplicitProjectTrust
|
|
4290
|
-
? "Reloaded keybindings, extensions, skills, prompts, themes; saved project trust"
|
|
4291
|
-
: "Reloaded keybindings, extensions, skills, prompts, themes");
|
|
4421
|
+
? "Reloaded keybindings, extensions, skills, prompts, themes, and context files; saved project trust"
|
|
4422
|
+
: "Reloaded keybindings, extensions, skills, prompts, themes, and context files");
|
|
4292
4423
|
dismissReloadBox(this.editor);
|
|
4293
4424
|
reloadBoxDismissed = true;
|
|
4294
4425
|
}
|
|
@@ -4509,6 +4640,26 @@ export class InteractiveMode {
|
|
|
4509
4640
|
handleSessionCommand() {
|
|
4510
4641
|
const stats = this.session.getSessionStats();
|
|
4511
4642
|
const sessionName = this.sessionManager.getSessionName();
|
|
4643
|
+
const entries = this.sessionManager.getEntries();
|
|
4644
|
+
const cacheWaste = computeCacheWaste(entries, this.session.modelRegistry);
|
|
4645
|
+
// Cost/token totals per provider/model actually used (e.g. OpenRouter `auto`
|
|
4646
|
+
// resolves to a concrete responseModel), sorted by cost descending.
|
|
4647
|
+
const perModelMap = new Map();
|
|
4648
|
+
for (const entry of entries) {
|
|
4649
|
+
if (entry.type !== "message" || entry.message.role !== "assistant")
|
|
4650
|
+
continue;
|
|
4651
|
+
const message = entry.message;
|
|
4652
|
+
const usage = message.usage;
|
|
4653
|
+
const key = `${message.provider}/${message.responseModel ?? message.model}`;
|
|
4654
|
+
let bucket = perModelMap.get(key);
|
|
4655
|
+
if (!bucket) {
|
|
4656
|
+
bucket = { key, cost: 0, tokens: 0 };
|
|
4657
|
+
perModelMap.set(key, bucket);
|
|
4658
|
+
}
|
|
4659
|
+
bucket.cost += usage.cost.total;
|
|
4660
|
+
bucket.tokens += usage.input + usage.output + usage.cacheRead + usage.cacheWrite;
|
|
4661
|
+
}
|
|
4662
|
+
const perModel = Array.from(perModelMap.values()).sort((a, b) => b.cost - a.cost);
|
|
4512
4663
|
let info = `${theme.bold("Session Info")}\n\n`;
|
|
4513
4664
|
if (sessionName) {
|
|
4514
4665
|
info += `${theme.fg("dim", "Name:")} ${sessionName}\n`;
|
|
@@ -4516,24 +4667,42 @@ export class InteractiveMode {
|
|
|
4516
4667
|
info += `${theme.fg("dim", "File:")} ${stats.sessionFile ?? "In-memory"}\n`;
|
|
4517
4668
|
info += `${theme.fg("dim", "ID:")} ${stats.sessionId}\n\n`;
|
|
4518
4669
|
info += `${theme.bold("Messages")}\n`;
|
|
4670
|
+
info += `${theme.fg("dim", "Total:")} ${stats.totalMessages}\n`;
|
|
4519
4671
|
info += `${theme.fg("dim", "User:")} ${stats.userMessages}\n`;
|
|
4520
4672
|
info += `${theme.fg("dim", "Assistant:")} ${stats.assistantMessages}\n`;
|
|
4521
|
-
info += `${theme.fg("dim", "
|
|
4522
|
-
info += `${theme.fg("dim", "Tool Results:")} ${stats.toolResults}\n`;
|
|
4523
|
-
info += `${theme.fg("dim", "Total:")} ${stats.totalMessages}\n\n`;
|
|
4673
|
+
info += `${theme.fg("dim", "Tools:")} ${stats.toolCalls} calls, ${stats.toolResults} results\n\n`;
|
|
4524
4674
|
info += `${theme.bold("Tokens")}\n`;
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
}
|
|
4530
|
-
|
|
4531
|
-
|
|
4675
|
+
// "Input" is the full prompt volume. With cache activity, split it into
|
|
4676
|
+
// cached (served from cache) vs uncached (everything else) - the only
|
|
4677
|
+
// provider-independent split. Cache writes, where reported, are a detail
|
|
4678
|
+
// of the uncached portion.
|
|
4679
|
+
const { input, cacheRead, cacheWrite } = stats.tokens;
|
|
4680
|
+
const promptTokens = input + cacheRead + cacheWrite;
|
|
4681
|
+
info += `${theme.fg("dim", "Input:")} ${promptTokens.toLocaleString()}\n`;
|
|
4682
|
+
if (promptTokens > 0 && (cacheRead > 0 || cacheWrite > 0)) {
|
|
4683
|
+
const hitRate = theme.fg("dim", `(${((cacheRead / promptTokens) * 100).toFixed(1)}%)`);
|
|
4684
|
+
info += ` ${theme.fg("dim", "Cached:")} ${cacheRead.toLocaleString()} ${hitRate}\n`;
|
|
4685
|
+
const written = cacheWrite > 0 ? ` ${theme.fg("dim", `(${cacheWrite.toLocaleString()} written to cache)`)}` : "";
|
|
4686
|
+
info += ` ${theme.fg("dim", "Uncached:")} ${(input + cacheWrite).toLocaleString()}${written}\n`;
|
|
4532
4687
|
}
|
|
4688
|
+
info += `${theme.fg("dim", "Output:")} ${stats.tokens.output.toLocaleString()}\n`;
|
|
4533
4689
|
info += `${theme.fg("dim", "Total:")} ${stats.tokens.total.toLocaleString()}\n`;
|
|
4534
|
-
if (stats.cost > 0) {
|
|
4690
|
+
if (stats.cost > 0 || cacheWaste.missedTokens > 0) {
|
|
4535
4691
|
info += `\n${theme.bold("Cost")}\n`;
|
|
4536
|
-
info += `${theme.fg("dim", "Total:")}
|
|
4692
|
+
info += `${theme.fg("dim", "Total:")} $${stats.cost.toFixed(3)}`;
|
|
4693
|
+
if (perModel.length > 1) {
|
|
4694
|
+
for (const entry of perModel) {
|
|
4695
|
+
info += `\n ${theme.fg("dim", `${entry.key}:`)} $${entry.cost.toFixed(3)} ${theme.fg("dim", `(${formatTokens(entry.tokens)} tokens)`)}`;
|
|
4696
|
+
}
|
|
4697
|
+
}
|
|
4698
|
+
if (cacheWaste.missedTokens > 0) {
|
|
4699
|
+
const missLabel = cacheWaste.missCount === 1 ? "1 miss" : `${cacheWaste.missCount} misses`;
|
|
4700
|
+
const detail = `${cacheWaste.missedTokens.toLocaleString()} tokens, ${missLabel}`;
|
|
4701
|
+
info +=
|
|
4702
|
+
cacheWaste.missedCost >= 0.0001
|
|
4703
|
+
? `\n${theme.fg("dim", "Cache Re-billed:")} $${cacheWaste.missedCost.toFixed(3)} ${theme.fg("dim", `(${detail})`)}`
|
|
4704
|
+
: `\n${theme.fg("dim", "Cache Re-billed:")} ${detail}`;
|
|
4705
|
+
}
|
|
4537
4706
|
}
|
|
4538
4707
|
this.chatContainer.addChild(new Spacer(1));
|
|
4539
4708
|
this.chatContainer.addChild(new Text(info, 1, 0));
|