indusagi-coding-agent 0.1.41 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/command-line/args.d.ts +56 -0
- package/dist/command-line/args.d.ts.map +1 -0
- package/dist/command-line/args.js.map +1 -0
- package/dist/command-line/config-selector.d.ts +17 -0
- package/dist/command-line/config-selector.d.ts.map +1 -0
- package/dist/command-line/config-selector.js.map +1 -0
- package/dist/command-line/file-processor.d.ts.map +1 -0
- package/dist/command-line/file-processor.js.map +1 -0
- package/dist/command-line/list-models.d.ts +9 -0
- package/dist/command-line/list-models.d.ts.map +1 -0
- package/dist/command-line/list-models.js.map +1 -0
- package/dist/command-line/login-handler.d.ts.map +1 -0
- package/dist/command-line/login-handler.js +746 -0
- package/dist/command-line/login-handler.js.map +1 -0
- package/dist/command-line/session-picker.d.ts.map +1 -0
- package/dist/command-line/session-picker.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -5
- package/dist/config.js.map +1 -1
- package/dist/helpers/array.d.ts.map +1 -0
- package/dist/helpers/array.js.map +1 -0
- package/dist/helpers/changelog.d.ts.map +1 -0
- package/dist/helpers/changelog.js.map +1 -0
- package/dist/helpers/clipboard-image.d.ts.map +1 -0
- package/dist/helpers/clipboard-image.js.map +1 -0
- package/dist/helpers/clipboard.d.ts.map +1 -0
- package/dist/helpers/clipboard.js.map +1 -0
- package/dist/helpers/color-formatter.d.ts.map +1 -0
- package/dist/helpers/color-formatter.js.map +1 -0
- package/dist/helpers/data-transformer.d.ts.map +1 -0
- package/dist/helpers/data-transformer.js.map +1 -0
- package/dist/helpers/date-formatter.d.ts.map +1 -0
- package/dist/helpers/date-formatter.js.map +1 -0
- package/dist/helpers/error-handler.d.ts.map +1 -0
- package/dist/helpers/error-handler.js.map +1 -0
- package/dist/helpers/file-operations.d.ts.map +1 -0
- package/dist/helpers/file-operations.js.map +1 -0
- package/dist/helpers/frontmatter.d.ts.map +1 -0
- package/dist/helpers/frontmatter.js.map +1 -0
- package/dist/helpers/git.d.ts.map +1 -0
- package/dist/helpers/git.js.map +1 -0
- package/dist/helpers/image-convert.d.ts.map +1 -0
- package/dist/helpers/image-convert.js.map +1 -0
- package/dist/helpers/image-resize.d.ts.map +1 -0
- package/dist/helpers/image-resize.js.map +1 -0
- package/dist/helpers/json-formatter.d.ts.map +1 -0
- package/dist/helpers/json-formatter.js.map +1 -0
- package/dist/helpers/logger.d.ts.map +1 -0
- package/dist/helpers/logger.js.map +1 -0
- package/dist/helpers/markdown-formatter.d.ts.map +1 -0
- package/dist/helpers/markdown-formatter.js.map +1 -0
- package/dist/helpers/mime.d.ts.map +1 -0
- package/dist/helpers/mime.js.map +1 -0
- package/dist/helpers/path-validator.d.ts.map +1 -0
- package/dist/helpers/path-validator.js.map +1 -0
- package/dist/helpers/photon.d.ts.map +1 -0
- package/dist/helpers/photon.js.map +1 -0
- package/dist/helpers/shell.d.ts.map +1 -0
- package/dist/helpers/shell.js +142 -0
- package/dist/helpers/shell.js.map +1 -0
- package/dist/helpers/sleep.d.ts.map +1 -0
- package/dist/helpers/sleep.js.map +1 -0
- package/dist/helpers/string-formatter.d.ts.map +1 -0
- package/dist/helpers/string-formatter.js.map +1 -0
- package/dist/helpers/tools-manager.d.ts.map +1 -0
- package/dist/helpers/tools-manager.js.map +1 -0
- package/dist/helpers/type-guards.d.ts.map +1 -0
- package/dist/helpers/type-guards.js.map +1 -0
- package/dist/index.d.ts +34 -34
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -34
- package/dist/index.js.map +1 -1
- package/dist/interfaces/index.d.ts +16 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +14 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/print-mode.d.ts +561 -0
- package/dist/interfaces/print-mode.d.ts.map +1 -0
- package/dist/interfaces/print-mode.js.map +1 -0
- package/dist/interfaces/service-api/rpc-client.d.ts +1129 -0
- package/dist/interfaces/service-api/rpc-client.d.ts.map +1 -0
- package/dist/interfaces/service-api/rpc-client.js.map +1 -0
- package/dist/interfaces/service-api/rpc-mode.d.ts +813 -0
- package/dist/interfaces/service-api/rpc-mode.d.ts.map +1 -0
- package/dist/interfaces/service-api/rpc-mode.js +1229 -0
- package/dist/interfaces/service-api/rpc-mode.js.map +1 -0
- package/dist/interfaces/service-api/rpc-types.d.ts +392 -0
- package/dist/interfaces/service-api/rpc-types.d.ts.map +1 -0
- package/dist/interfaces/service-api/rpc-types.js.map +1 -0
- package/dist/interfaces/shared.d.ts.map +1 -0
- package/dist/interfaces/shared.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/armin.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/armin.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/assistant-message.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/assistant-message.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/bash-execution.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/bash-execution.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/bordered-loader.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/bordered-loader.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/branch-summary-message.d.ts +16 -0
- package/dist/interfaces/terminal-ui/components/branch-summary-message.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/branch-summary-message.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/compaction-summary-message.d.ts +16 -0
- package/dist/interfaces/terminal-ui/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/compaction-summary-message.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/config-selector.d.ts +71 -0
- package/dist/interfaces/terminal-ui/components/config-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/config-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/countdown-timer.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/countdown-timer.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/custom-editor.d.ts +17 -0
- package/dist/interfaces/terminal-ui/components/custom-editor.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/custom-editor.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/custom-message.d.ts +19 -0
- package/dist/interfaces/terminal-ui/components/custom-message.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/custom-message.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/diff.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/diff.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/dynamic-border.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/dynamic-border.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/extension-editor.d.ts +13 -0
- package/dist/interfaces/terminal-ui/components/extension-editor.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/extension-editor.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/extension-input.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/extension-input.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/extension-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/extension-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/footer.d.ts +17 -0
- package/dist/interfaces/terminal-ui/components/footer.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/footer.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/index.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/index.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/keybinding-hints.d.ts +23 -0
- package/dist/interfaces/terminal-ui/components/keybinding-hints.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/keybinding-hints.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/login-dialog.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/login-dialog.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/model-selector.d.ts +43 -0
- package/dist/interfaces/terminal-ui/components/model-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/model-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/oauth-selector.d.ts +75 -0
- package/dist/interfaces/terminal-ui/components/oauth-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/oauth-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/scoped-models-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/session-selector-search.d.ts +21 -0
- package/dist/interfaces/terminal-ui/components/session-selector-search.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/session-selector-search.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/session-selector.d.ts +85 -0
- package/dist/interfaces/terminal-ui/components/session-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/session-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/settings-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/settings-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/show-images-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/show-images-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/skill-invocation-message.d.ts +17 -0
- package/dist/interfaces/terminal-ui/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/skill-invocation-message.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/theme-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/theme-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/thinking-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/thinking-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/tool-execution.d.ts +72 -0
- package/dist/interfaces/terminal-ui/components/tool-execution.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/tool-execution.js +1001 -0
- package/dist/interfaces/terminal-ui/components/tool-execution.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/tree-selector.d.ts +62 -0
- package/dist/interfaces/terminal-ui/components/tree-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/tree-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/user-message-selector.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/user-message-selector.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/user-message.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/user-message.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/visual-truncate.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/components/visual-truncate.js.map +1 -0
- package/dist/interfaces/terminal-ui/interactive-mode.d.ts +1931 -0
- package/dist/interfaces/terminal-ui/interactive-mode.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/interactive-mode.js +5733 -0
- package/dist/interfaces/terminal-ui/interactive-mode.js.map +1 -0
- package/dist/interfaces/terminal-ui/theme/theme.d.ts.map +1 -0
- package/dist/interfaces/terminal-ui/theme/theme.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +21 -21
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/runtime/agent-session.d.ts +936 -0
- package/dist/runtime/agent-session.d.ts.map +1 -0
- package/dist/runtime/agent-session.js +2737 -0
- package/dist/runtime/agent-session.js.map +1 -0
- package/dist/runtime/auth-storage.d.ts.map +1 -0
- package/dist/runtime/auth-storage.js.map +1 -0
- package/dist/runtime/bash-executor.d.ts.map +1 -0
- package/dist/runtime/bash-executor.js.map +1 -0
- package/dist/runtime/context-compression/branch-summarization.d.ts.map +1 -0
- package/dist/runtime/context-compression/branch-summarization.js.map +1 -0
- package/dist/runtime/context-compression/compaction.d.ts.map +1 -0
- package/dist/runtime/context-compression/compaction.js.map +1 -0
- package/dist/runtime/context-compression/index.d.ts.map +1 -0
- package/dist/runtime/context-compression/index.js.map +1 -0
- package/dist/runtime/context-compression/utils.d.ts.map +1 -0
- package/dist/runtime/context-compression/utils.js.map +1 -0
- package/dist/runtime/diagnostics.d.ts.map +1 -0
- package/dist/runtime/diagnostics.js.map +1 -0
- package/dist/runtime/discover-packages.d.ts.map +1 -0
- package/dist/runtime/discover-packages.js.map +1 -0
- package/dist/runtime/event-bus.d.ts.map +1 -0
- package/dist/runtime/event-bus.js.map +1 -0
- package/dist/runtime/exec.d.ts.map +1 -0
- package/dist/runtime/exec.js.map +1 -0
- package/dist/runtime/footer-data-provider.d.ts.map +1 -0
- package/dist/runtime/footer-data-provider.js.map +1 -0
- package/dist/runtime/html-export/ansi-to-html.d.ts.map +1 -0
- package/dist/runtime/html-export/ansi-to-html.js.map +1 -0
- package/dist/runtime/html-export/index.d.ts.map +1 -0
- package/dist/runtime/html-export/index.js +350 -0
- package/dist/runtime/html-export/index.js.map +1 -0
- package/dist/runtime/html-export/index.ts +433 -0
- package/dist/runtime/html-export/tool-renderer.d.ts +18 -0
- package/dist/runtime/html-export/tool-renderer.d.ts.map +1 -0
- package/dist/runtime/html-export/tool-renderer.js.map +1 -0
- package/dist/runtime/html-export/tool-renderer.ts +80 -0
- package/dist/runtime/index.d.ts +30 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +30 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/keybindings.d.ts.map +1 -0
- package/dist/runtime/keybindings.js.map +1 -0
- package/dist/runtime/lifecycle/index.d.ts.map +1 -0
- package/dist/runtime/lifecycle/index.js.map +1 -0
- package/dist/runtime/lifecycle/loader.d.ts.map +1 -0
- package/dist/runtime/lifecycle/loader.js.map +1 -0
- package/dist/runtime/lifecycle/runner.d.ts.map +1 -0
- package/dist/runtime/lifecycle/runner.js.map +1 -0
- package/dist/runtime/lifecycle/types.d.ts.map +1 -0
- package/dist/runtime/lifecycle/types.js.map +1 -0
- package/dist/runtime/messages.d.ts.map +1 -0
- package/dist/runtime/messages.js.map +1 -0
- package/dist/runtime/model-registry.d.ts.map +1 -0
- package/dist/runtime/model-registry.js.map +1 -0
- package/dist/runtime/model-resolver.d.ts.map +1 -0
- package/dist/runtime/model-resolver.js +227 -0
- package/dist/runtime/model-resolver.js.map +1 -0
- package/dist/runtime/package-manager.d.ts.map +1 -0
- package/dist/runtime/package-manager.js.map +1 -0
- package/dist/runtime/plugins/index.d.ts.map +1 -0
- package/dist/runtime/plugins/index.js.map +1 -0
- package/dist/runtime/plugins/loader.d.ts.map +1 -0
- package/dist/runtime/plugins/loader.js.map +1 -0
- package/dist/runtime/plugins/runner.d.ts.map +1 -0
- package/dist/runtime/plugins/runner.js +468 -0
- package/dist/runtime/plugins/runner.js.map +1 -0
- package/dist/runtime/plugins/types.d.ts +859 -0
- package/dist/runtime/plugins/types.d.ts.map +1 -0
- package/dist/runtime/plugins/types.js.map +1 -0
- package/dist/runtime/plugins/wrapper.d.ts +29 -0
- package/dist/runtime/plugins/wrapper.d.ts.map +1 -0
- package/dist/runtime/plugins/wrapper.js.map +1 -0
- package/dist/runtime/prompt-templates.d.ts.map +1 -0
- package/dist/runtime/prompt-templates.js +203 -0
- package/dist/runtime/prompt-templates.js.map +1 -0
- package/dist/runtime/resource-loader.d.ts +180 -0
- package/dist/runtime/resource-loader.d.ts.map +1 -0
- package/dist/runtime/resource-loader.js +530 -0
- package/dist/runtime/resource-loader.js.map +1 -0
- package/dist/runtime/sdk.d.ts +49 -0
- package/dist/runtime/sdk.d.ts.map +1 -0
- package/dist/runtime/sdk.js +306 -0
- package/dist/runtime/sdk.js.map +1 -0
- package/dist/runtime/session-manager.d.ts.map +1 -0
- package/dist/runtime/session-manager.js.map +1 -0
- package/dist/runtime/settings-manager.d.ts.map +1 -0
- package/dist/runtime/settings-manager.js.map +1 -0
- package/dist/runtime/skills.d.ts.map +1 -0
- package/dist/runtime/skills.js +277 -0
- package/dist/runtime/skills.js.map +1 -0
- package/dist/runtime/subagents.d.ts.map +1 -0
- package/dist/runtime/subagents.js +163 -0
- package/dist/runtime/subagents.js.map +1 -0
- package/dist/runtime/system-prompt.d.ts.map +1 -0
- package/dist/runtime/system-prompt.js.map +1 -0
- package/dist/runtime/task-session-manager.d.ts.map +1 -0
- package/dist/runtime/task-session-manager.js.map +1 -0
- package/dist/runtime/timings.d.ts.map +1 -0
- package/dist/runtime/timings.js.map +1 -0
- package/dist/runtime/todo-store.d.ts.map +1 -0
- package/dist/runtime/todo-store.js.map +1 -0
- package/dist/runtime/tooling/bash.d.ts.map +1 -0
- package/dist/runtime/tooling/bash.js.map +1 -0
- package/dist/runtime/tooling/bg-process.d.ts.map +1 -0
- package/dist/runtime/tooling/bg-process.js.map +1 -0
- package/dist/runtime/tooling/edit-diff.d.ts.map +1 -0
- package/dist/runtime/tooling/edit-diff.js.map +1 -0
- package/dist/runtime/tooling/edit.d.ts.map +1 -0
- package/dist/runtime/tooling/edit.js.map +1 -0
- package/dist/runtime/tooling/find.d.ts.map +1 -0
- package/dist/runtime/tooling/find.js.map +1 -0
- package/dist/runtime/tooling/grep.d.ts.map +1 -0
- package/dist/runtime/tooling/grep.js.map +1 -0
- package/dist/runtime/tooling/index.d.ts +208 -0
- package/dist/runtime/tooling/index.d.ts.map +1 -0
- package/dist/runtime/tooling/index.js.map +1 -0
- package/dist/runtime/tooling/ls.d.ts.map +1 -0
- package/dist/runtime/tooling/ls.js.map +1 -0
- package/dist/runtime/tooling/memory.d.ts.map +1 -0
- package/dist/runtime/tooling/memory.js.map +1 -0
- package/dist/runtime/tooling/path-utils.d.ts.map +1 -0
- package/dist/runtime/tooling/path-utils.js.map +1 -0
- package/dist/runtime/tooling/read.d.ts.map +1 -0
- package/dist/runtime/tooling/read.js.map +1 -0
- package/dist/runtime/tooling/registry.d.ts.map +1 -0
- package/dist/runtime/tooling/registry.js.map +1 -0
- package/dist/runtime/tooling/task.d.ts.map +1 -0
- package/dist/runtime/tooling/task.js.map +1 -0
- package/dist/runtime/tooling/todo.d.ts.map +1 -0
- package/dist/runtime/tooling/todo.js.map +1 -0
- package/dist/runtime/tooling/truncate.d.ts.map +1 -0
- package/dist/runtime/tooling/truncate.js.map +1 -0
- package/dist/runtime/tooling/webfetch.d.ts.map +1 -0
- package/dist/runtime/tooling/webfetch.js.map +1 -0
- package/dist/runtime/tooling/websearch.d.ts.map +1 -0
- package/dist/runtime/tooling/websearch.js.map +1 -0
- package/dist/runtime/tooling/write.d.ts.map +1 -0
- package/dist/runtime/tooling/write.js.map +1 -0
- package/dist/telemetry/core/config.d.ts.map +1 -0
- package/dist/telemetry/core/config.js.map +1 -0
- package/dist/telemetry/core/event-bus.d.ts.map +1 -0
- package/dist/telemetry/core/event-bus.js.map +1 -0
- package/dist/telemetry/core/index.d.ts.map +1 -0
- package/dist/telemetry/core/index.js.map +1 -0
- package/dist/telemetry/core/observability.d.ts.map +1 -0
- package/dist/telemetry/core/observability.js.map +1 -0
- package/dist/telemetry/core/span.d.ts.map +1 -0
- package/dist/telemetry/core/span.js.map +1 -0
- package/dist/telemetry/core/tracer.d.ts.map +1 -0
- package/dist/telemetry/core/tracer.js.map +1 -0
- package/dist/telemetry/core/types.d.ts.map +1 -0
- package/dist/telemetry/core/types.js.map +1 -0
- package/dist/telemetry/exporters/base-exporter.d.ts.map +1 -0
- package/dist/telemetry/exporters/base-exporter.js.map +1 -0
- package/dist/telemetry/exporters/console-exporter.d.ts.map +1 -0
- package/dist/telemetry/exporters/console-exporter.js.map +1 -0
- package/dist/telemetry/exporters/file-exporter.d.ts.map +1 -0
- package/dist/telemetry/exporters/file-exporter.js.map +1 -0
- package/dist/telemetry/exporters/index.d.ts.map +1 -0
- package/dist/telemetry/exporters/index.js.map +1 -0
- package/dist/telemetry/exporters/langfuse-exporter.d.ts.map +1 -0
- package/dist/telemetry/exporters/langfuse-exporter.js.map +1 -0
- package/dist/telemetry/exporters/sentry-exporter.d.ts.map +1 -0
- package/dist/telemetry/exporters/sentry-exporter.js.map +1 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js.map +1 -0
- package/package.json +7 -7
- package/dist/cli/args.d.ts +0 -56
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/config-selector.d.ts +0 -17
- package/dist/cli/config-selector.d.ts.map +0 -1
- package/dist/cli/config-selector.js.map +0 -1
- package/dist/cli/file-processor.d.ts.map +0 -1
- package/dist/cli/file-processor.js.map +0 -1
- package/dist/cli/list-models.d.ts +0 -9
- package/dist/cli/list-models.d.ts.map +0 -1
- package/dist/cli/list-models.js.map +0 -1
- package/dist/cli/login-handler.d.ts.map +0 -1
- package/dist/cli/login-handler.js +0 -746
- package/dist/cli/login-handler.js.map +0 -1
- package/dist/cli/session-picker.d.ts.map +0 -1
- package/dist/cli/session-picker.js.map +0 -1
- package/dist/core/agent-session.d.ts +0 -936
- package/dist/core/agent-session.d.ts.map +0 -1
- package/dist/core/agent-session.js +0 -2737
- package/dist/core/agent-session.js.map +0 -1
- package/dist/core/auth-storage.d.ts.map +0 -1
- package/dist/core/auth-storage.js.map +0 -1
- package/dist/core/bash-executor.d.ts.map +0 -1
- package/dist/core/bash-executor.js.map +0 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
- package/dist/core/compaction/branch-summarization.js.map +0 -1
- package/dist/core/compaction/compaction.d.ts.map +0 -1
- package/dist/core/compaction/compaction.js.map +0 -1
- package/dist/core/compaction/index.d.ts.map +0 -1
- package/dist/core/compaction/index.js.map +0 -1
- package/dist/core/compaction/utils.d.ts.map +0 -1
- package/dist/core/compaction/utils.js.map +0 -1
- package/dist/core/diagnostics.d.ts.map +0 -1
- package/dist/core/diagnostics.js.map +0 -1
- package/dist/core/discover-packages.d.ts.map +0 -1
- package/dist/core/discover-packages.js.map +0 -1
- package/dist/core/event-bus.d.ts.map +0 -1
- package/dist/core/event-bus.js.map +0 -1
- package/dist/core/exec.d.ts.map +0 -1
- package/dist/core/exec.js.map +0 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
- package/dist/core/export-html/ansi-to-html.js.map +0 -1
- package/dist/core/export-html/index.d.ts.map +0 -1
- package/dist/core/export-html/index.js +0 -350
- package/dist/core/export-html/index.js.map +0 -1
- package/dist/core/export-html/index.ts +0 -433
- package/dist/core/export-html/tool-renderer.d.ts +0 -18
- package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
- package/dist/core/export-html/tool-renderer.js.map +0 -1
- package/dist/core/export-html/tool-renderer.ts +0 -80
- package/dist/core/extensions/index.d.ts.map +0 -1
- package/dist/core/extensions/index.js.map +0 -1
- package/dist/core/extensions/loader.d.ts.map +0 -1
- package/dist/core/extensions/loader.js.map +0 -1
- package/dist/core/extensions/runner.d.ts.map +0 -1
- package/dist/core/extensions/runner.js +0 -468
- package/dist/core/extensions/runner.js.map +0 -1
- package/dist/core/extensions/types.d.ts +0 -859
- package/dist/core/extensions/types.d.ts.map +0 -1
- package/dist/core/extensions/types.js.map +0 -1
- package/dist/core/extensions/wrapper.d.ts +0 -29
- package/dist/core/extensions/wrapper.d.ts.map +0 -1
- package/dist/core/extensions/wrapper.js.map +0 -1
- package/dist/core/footer-data-provider.d.ts.map +0 -1
- package/dist/core/footer-data-provider.js.map +0 -1
- package/dist/core/hooks/index.d.ts.map +0 -1
- package/dist/core/hooks/index.js.map +0 -1
- package/dist/core/hooks/loader.d.ts.map +0 -1
- package/dist/core/hooks/loader.js.map +0 -1
- package/dist/core/hooks/runner.d.ts.map +0 -1
- package/dist/core/hooks/runner.js.map +0 -1
- package/dist/core/hooks/types.d.ts.map +0 -1
- package/dist/core/hooks/types.js.map +0 -1
- package/dist/core/index.d.ts +0 -30
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -30
- package/dist/core/index.js.map +0 -1
- package/dist/core/keybindings.d.ts.map +0 -1
- package/dist/core/keybindings.js.map +0 -1
- package/dist/core/messages.d.ts.map +0 -1
- package/dist/core/messages.js.map +0 -1
- package/dist/core/model-registry.d.ts.map +0 -1
- package/dist/core/model-registry.js.map +0 -1
- package/dist/core/model-resolver.d.ts.map +0 -1
- package/dist/core/model-resolver.js +0 -227
- package/dist/core/model-resolver.js.map +0 -1
- package/dist/core/package-manager.d.ts.map +0 -1
- package/dist/core/package-manager.js.map +0 -1
- package/dist/core/prompt-templates.d.ts.map +0 -1
- package/dist/core/prompt-templates.js +0 -203
- package/dist/core/prompt-templates.js.map +0 -1
- package/dist/core/resource-loader.d.ts +0 -180
- package/dist/core/resource-loader.d.ts.map +0 -1
- package/dist/core/resource-loader.js +0 -530
- package/dist/core/resource-loader.js.map +0 -1
- package/dist/core/sdk.d.ts +0 -49
- package/dist/core/sdk.d.ts.map +0 -1
- package/dist/core/sdk.js +0 -306
- package/dist/core/sdk.js.map +0 -1
- package/dist/core/session-manager.d.ts.map +0 -1
- package/dist/core/session-manager.js.map +0 -1
- package/dist/core/settings-manager.d.ts.map +0 -1
- package/dist/core/settings-manager.js.map +0 -1
- package/dist/core/skills.d.ts.map +0 -1
- package/dist/core/skills.js +0 -277
- package/dist/core/skills.js.map +0 -1
- package/dist/core/subagents.d.ts.map +0 -1
- package/dist/core/subagents.js +0 -163
- package/dist/core/subagents.js.map +0 -1
- package/dist/core/system-prompt.d.ts.map +0 -1
- package/dist/core/system-prompt.js.map +0 -1
- package/dist/core/task-session-manager.d.ts.map +0 -1
- package/dist/core/task-session-manager.js.map +0 -1
- package/dist/core/timings.d.ts.map +0 -1
- package/dist/core/timings.js.map +0 -1
- package/dist/core/todo-store.d.ts.map +0 -1
- package/dist/core/todo-store.js.map +0 -1
- package/dist/core/tools/bash.d.ts.map +0 -1
- package/dist/core/tools/bash.js.map +0 -1
- package/dist/core/tools/bg-process.d.ts.map +0 -1
- package/dist/core/tools/bg-process.js.map +0 -1
- package/dist/core/tools/edit-diff.d.ts.map +0 -1
- package/dist/core/tools/edit-diff.js.map +0 -1
- package/dist/core/tools/edit.d.ts.map +0 -1
- package/dist/core/tools/edit.js.map +0 -1
- package/dist/core/tools/find.d.ts.map +0 -1
- package/dist/core/tools/find.js.map +0 -1
- package/dist/core/tools/grep.d.ts.map +0 -1
- package/dist/core/tools/grep.js.map +0 -1
- package/dist/core/tools/index.d.ts +0 -208
- package/dist/core/tools/index.d.ts.map +0 -1
- package/dist/core/tools/index.js.map +0 -1
- package/dist/core/tools/ls.d.ts.map +0 -1
- package/dist/core/tools/ls.js.map +0 -1
- package/dist/core/tools/memory.d.ts.map +0 -1
- package/dist/core/tools/memory.js.map +0 -1
- package/dist/core/tools/path-utils.d.ts.map +0 -1
- package/dist/core/tools/path-utils.js.map +0 -1
- package/dist/core/tools/read.d.ts.map +0 -1
- package/dist/core/tools/read.js.map +0 -1
- package/dist/core/tools/registry.d.ts.map +0 -1
- package/dist/core/tools/registry.js.map +0 -1
- package/dist/core/tools/task.d.ts.map +0 -1
- package/dist/core/tools/task.js.map +0 -1
- package/dist/core/tools/todo.d.ts.map +0 -1
- package/dist/core/tools/todo.js.map +0 -1
- package/dist/core/tools/truncate.d.ts.map +0 -1
- package/dist/core/tools/truncate.js.map +0 -1
- package/dist/core/tools/webfetch.d.ts.map +0 -1
- package/dist/core/tools/webfetch.js.map +0 -1
- package/dist/core/tools/websearch.d.ts.map +0 -1
- package/dist/core/tools/websearch.js.map +0 -1
- package/dist/core/tools/write.d.ts.map +0 -1
- package/dist/core/tools/write.js.map +0 -1
- package/dist/modes/index.d.ts +0 -16
- package/dist/modes/index.d.ts.map +0 -1
- package/dist/modes/index.js +0 -14
- package/dist/modes/index.js.map +0 -1
- package/dist/modes/interactive/components/armin.d.ts.map +0 -1
- package/dist/modes/interactive/components/armin.js.map +0 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/assistant-message.js.map +0 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
- package/dist/modes/interactive/components/bash-execution.js.map +0 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
- package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
- package/dist/modes/interactive/components/config-selector.d.ts +0 -71
- package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/config-selector.js.map +0 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
- package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +0 -17
- package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-editor.js.map +0 -1
- package/dist/modes/interactive/components/custom-message.d.ts +0 -19
- package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-message.js.map +0 -1
- package/dist/modes/interactive/components/diff.d.ts.map +0 -1
- package/dist/modes/interactive/components/diff.js.map +0 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +0 -13
- package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-editor.js.map +0 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-input.js.map +0 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-selector.js.map +0 -1
- package/dist/modes/interactive/components/footer.d.ts +0 -17
- package/dist/modes/interactive/components/footer.d.ts.map +0 -1
- package/dist/modes/interactive/components/footer.js.map +0 -1
- package/dist/modes/interactive/components/index.d.ts.map +0 -1
- package/dist/modes/interactive/components/index.js.map +0 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -23
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
- package/dist/modes/interactive/components/login-dialog.js.map +0 -1
- package/dist/modes/interactive/components/model-selector.d.ts +0 -43
- package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/model-selector.js.map +0 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +0 -75
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts +0 -21
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
- package/dist/modes/interactive/components/session-selector.d.ts +0 -85
- package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/session-selector.js.map +0 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/settings-selector.js.map +0 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/theme-selector.js.map +0 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -72
- package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
- package/dist/modes/interactive/components/tool-execution.js +0 -1001
- package/dist/modes/interactive/components/tool-execution.js.map +0 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +0 -62
- package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/tree-selector.js.map +0 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/user-message.js.map +0 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts +0 -1931
- package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
- package/dist/modes/interactive/interactive-mode.js +0 -5733
- package/dist/modes/interactive/interactive-mode.js.map +0 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme.js.map +0 -1
- package/dist/modes/print-mode.d.ts +0 -561
- package/dist/modes/print-mode.d.ts.map +0 -1
- package/dist/modes/print-mode.js.map +0 -1
- package/dist/modes/rpc/rpc-client.d.ts +0 -1129
- package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-client.js.map +0 -1
- package/dist/modes/rpc/rpc-mode.d.ts +0 -813
- package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-mode.js +0 -1229
- package/dist/modes/rpc/rpc-mode.js.map +0 -1
- package/dist/modes/rpc/rpc-types.d.ts +0 -392
- package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-types.js.map +0 -1
- package/dist/modes/shared.d.ts.map +0 -1
- package/dist/modes/shared.js.map +0 -1
- package/dist/observability/core/config.d.ts.map +0 -1
- package/dist/observability/core/config.js.map +0 -1
- package/dist/observability/core/event-bus.d.ts.map +0 -1
- package/dist/observability/core/event-bus.js.map +0 -1
- package/dist/observability/core/index.d.ts.map +0 -1
- package/dist/observability/core/index.js.map +0 -1
- package/dist/observability/core/observability.d.ts.map +0 -1
- package/dist/observability/core/observability.js.map +0 -1
- package/dist/observability/core/span.d.ts.map +0 -1
- package/dist/observability/core/span.js.map +0 -1
- package/dist/observability/core/tracer.d.ts.map +0 -1
- package/dist/observability/core/tracer.js.map +0 -1
- package/dist/observability/core/types.d.ts.map +0 -1
- package/dist/observability/core/types.js.map +0 -1
- package/dist/observability/exporters/base-exporter.d.ts.map +0 -1
- package/dist/observability/exporters/base-exporter.js.map +0 -1
- package/dist/observability/exporters/console-exporter.d.ts.map +0 -1
- package/dist/observability/exporters/console-exporter.js.map +0 -1
- package/dist/observability/exporters/file-exporter.d.ts.map +0 -1
- package/dist/observability/exporters/file-exporter.js.map +0 -1
- package/dist/observability/exporters/index.d.ts.map +0 -1
- package/dist/observability/exporters/index.js.map +0 -1
- package/dist/observability/exporters/langfuse-exporter.d.ts.map +0 -1
- package/dist/observability/exporters/langfuse-exporter.js.map +0 -1
- package/dist/observability/exporters/sentry-exporter.d.ts.map +0 -1
- package/dist/observability/exporters/sentry-exporter.js.map +0 -1
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/index.js.map +0 -1
- package/dist/utils/array.d.ts.map +0 -1
- package/dist/utils/array.js.map +0 -1
- package/dist/utils/changelog.d.ts.map +0 -1
- package/dist/utils/changelog.js.map +0 -1
- package/dist/utils/clipboard-image.d.ts.map +0 -1
- package/dist/utils/clipboard-image.js.map +0 -1
- package/dist/utils/clipboard.d.ts.map +0 -1
- package/dist/utils/clipboard.js.map +0 -1
- package/dist/utils/color-formatter.d.ts.map +0 -1
- package/dist/utils/color-formatter.js.map +0 -1
- package/dist/utils/data-transformer.d.ts.map +0 -1
- package/dist/utils/data-transformer.js.map +0 -1
- package/dist/utils/date-formatter.d.ts.map +0 -1
- package/dist/utils/date-formatter.js.map +0 -1
- package/dist/utils/error-handler.d.ts.map +0 -1
- package/dist/utils/error-handler.js.map +0 -1
- package/dist/utils/file-operations.d.ts.map +0 -1
- package/dist/utils/file-operations.js.map +0 -1
- package/dist/utils/frontmatter.d.ts.map +0 -1
- package/dist/utils/frontmatter.js.map +0 -1
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/image-convert.d.ts.map +0 -1
- package/dist/utils/image-convert.js.map +0 -1
- package/dist/utils/image-resize.d.ts.map +0 -1
- package/dist/utils/image-resize.js.map +0 -1
- package/dist/utils/json-formatter.d.ts.map +0 -1
- package/dist/utils/json-formatter.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/markdown-formatter.d.ts.map +0 -1
- package/dist/utils/markdown-formatter.js.map +0 -1
- package/dist/utils/mime.d.ts.map +0 -1
- package/dist/utils/mime.js.map +0 -1
- package/dist/utils/path-validator.d.ts.map +0 -1
- package/dist/utils/path-validator.js.map +0 -1
- package/dist/utils/photon.d.ts.map +0 -1
- package/dist/utils/photon.js.map +0 -1
- package/dist/utils/shell.d.ts.map +0 -1
- package/dist/utils/shell.js +0 -142
- package/dist/utils/shell.js.map +0 -1
- package/dist/utils/sleep.d.ts.map +0 -1
- package/dist/utils/sleep.js.map +0 -1
- package/dist/utils/string-formatter.d.ts.map +0 -1
- package/dist/utils/string-formatter.js.map +0 -1
- package/dist/utils/tools-manager.d.ts.map +0 -1
- package/dist/utils/tools-manager.js.map +0 -1
- package/dist/utils/type-guards.d.ts.map +0 -1
- package/dist/utils/type-guards.js.map +0 -1
- /package/{examples → demos}/README.md +0 -0
- /package/dist/{cli → command-line}/args.js +0 -0
- /package/dist/{cli → command-line}/config-selector.js +0 -0
- /package/dist/{cli → command-line}/file-processor.d.ts +0 -0
- /package/dist/{cli → command-line}/file-processor.js +0 -0
- /package/dist/{cli → command-line}/list-models.js +0 -0
- /package/dist/{cli → command-line}/login-handler.d.ts +0 -0
- /package/dist/{cli → command-line}/session-picker.d.ts +0 -0
- /package/dist/{cli → command-line}/session-picker.js +0 -0
- /package/dist/{utils → helpers}/array.d.ts +0 -0
- /package/dist/{utils → helpers}/array.js +0 -0
- /package/dist/{utils → helpers}/changelog.d.ts +0 -0
- /package/dist/{utils → helpers}/changelog.js +0 -0
- /package/dist/{utils → helpers}/clipboard-image.d.ts +0 -0
- /package/dist/{utils → helpers}/clipboard-image.js +0 -0
- /package/dist/{utils → helpers}/clipboard.d.ts +0 -0
- /package/dist/{utils → helpers}/clipboard.js +0 -0
- /package/dist/{utils → helpers}/color-formatter.d.ts +0 -0
- /package/dist/{utils → helpers}/color-formatter.js +0 -0
- /package/dist/{utils → helpers}/data-transformer.d.ts +0 -0
- /package/dist/{utils → helpers}/data-transformer.js +0 -0
- /package/dist/{utils → helpers}/date-formatter.d.ts +0 -0
- /package/dist/{utils → helpers}/date-formatter.js +0 -0
- /package/dist/{utils → helpers}/error-handler.d.ts +0 -0
- /package/dist/{utils → helpers}/error-handler.js +0 -0
- /package/dist/{utils → helpers}/file-operations.d.ts +0 -0
- /package/dist/{utils → helpers}/file-operations.js +0 -0
- /package/dist/{utils → helpers}/frontmatter.d.ts +0 -0
- /package/dist/{utils → helpers}/frontmatter.js +0 -0
- /package/dist/{utils → helpers}/git.d.ts +0 -0
- /package/dist/{utils → helpers}/git.js +0 -0
- /package/dist/{utils → helpers}/image-convert.d.ts +0 -0
- /package/dist/{utils → helpers}/image-convert.js +0 -0
- /package/dist/{utils → helpers}/image-resize.d.ts +0 -0
- /package/dist/{utils → helpers}/image-resize.js +0 -0
- /package/dist/{utils → helpers}/json-formatter.d.ts +0 -0
- /package/dist/{utils → helpers}/json-formatter.js +0 -0
- /package/dist/{utils → helpers}/logger.d.ts +0 -0
- /package/dist/{utils → helpers}/logger.js +0 -0
- /package/dist/{utils → helpers}/markdown-formatter.d.ts +0 -0
- /package/dist/{utils → helpers}/markdown-formatter.js +0 -0
- /package/dist/{utils → helpers}/mime.d.ts +0 -0
- /package/dist/{utils → helpers}/mime.js +0 -0
- /package/dist/{utils → helpers}/path-validator.d.ts +0 -0
- /package/dist/{utils → helpers}/path-validator.js +0 -0
- /package/dist/{utils → helpers}/photon.d.ts +0 -0
- /package/dist/{utils → helpers}/photon.js +0 -0
- /package/dist/{utils → helpers}/shell.d.ts +0 -0
- /package/dist/{utils → helpers}/sleep.d.ts +0 -0
- /package/dist/{utils → helpers}/sleep.js +0 -0
- /package/dist/{utils → helpers}/string-formatter.d.ts +0 -0
- /package/dist/{utils → helpers}/string-formatter.js +0 -0
- /package/dist/{utils → helpers}/tools-manager.d.ts +0 -0
- /package/dist/{utils → helpers}/tools-manager.js +0 -0
- /package/dist/{utils → helpers}/type-guards.d.ts +0 -0
- /package/dist/{utils → helpers}/type-guards.js +0 -0
- /package/dist/{modes → interfaces}/print-mode.js +0 -0
- /package/dist/{modes/rpc → interfaces/service-api}/rpc-client.js +0 -0
- /package/dist/{modes/rpc → interfaces/service-api}/rpc-types.js +0 -0
- /package/dist/{modes → interfaces}/shared.d.ts +0 -0
- /package/dist/{modes → interfaces}/shared.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/armin.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/armin.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/assistant-message.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/assistant-message.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/bash-execution.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/bash-execution.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/bordered-loader.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/bordered-loader.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/branch-summary-message.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/compaction-summary-message.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/config-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/countdown-timer.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/countdown-timer.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/custom-editor.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/custom-message.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/diff.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/diff.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/dynamic-border.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/dynamic-border.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/extension-editor.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/extension-input.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/extension-input.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/extension-selector.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/extension-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/footer.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/index.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/index.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/keybinding-hints.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/login-dialog.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/login-dialog.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/model-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/oauth-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/scoped-models-selector.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/scoped-models-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/session-selector-search.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/session-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/settings-selector.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/settings-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/show-images-selector.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/show-images-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/skill-invocation-message.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/theme-selector.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/theme-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/thinking-selector.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/thinking-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/tree-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/user-message-selector.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/user-message-selector.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/user-message.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/user-message.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/visual-truncate.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/components/visual-truncate.js +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/theme/dark.json +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/theme/light.json +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/theme/theme-schema.json +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/theme/theme.d.ts +0 -0
- /package/dist/{modes/interactive → interfaces/terminal-ui}/theme/theme.js +0 -0
- /package/dist/{core → runtime}/auth-storage.d.ts +0 -0
- /package/dist/{core → runtime}/auth-storage.js +0 -0
- /package/dist/{core → runtime}/bash-executor.d.ts +0 -0
- /package/dist/{core → runtime}/bash-executor.js +0 -0
- /package/dist/{core/compaction → runtime/context-compression}/branch-summarization.d.ts +0 -0
- /package/dist/{core/compaction → runtime/context-compression}/branch-summarization.js +0 -0
- /package/dist/{core/compaction → runtime/context-compression}/compaction.d.ts +0 -0
- /package/dist/{core/compaction → runtime/context-compression}/compaction.js +0 -0
- /package/dist/{core/compaction → runtime/context-compression}/index.d.ts +0 -0
- /package/dist/{core/compaction → runtime/context-compression}/index.js +0 -0
- /package/dist/{core/compaction → runtime/context-compression}/utils.d.ts +0 -0
- /package/dist/{core/compaction → runtime/context-compression}/utils.js +0 -0
- /package/dist/{core → runtime}/diagnostics.d.ts +0 -0
- /package/dist/{core → runtime}/diagnostics.js +0 -0
- /package/dist/{core → runtime}/discover-packages.d.ts +0 -0
- /package/dist/{core → runtime}/discover-packages.js +0 -0
- /package/dist/{core → runtime}/event-bus.d.ts +0 -0
- /package/dist/{core → runtime}/event-bus.js +0 -0
- /package/dist/{core → runtime}/exec.d.ts +0 -0
- /package/dist/{core → runtime}/exec.js +0 -0
- /package/dist/{core → runtime}/footer-data-provider.d.ts +0 -0
- /package/dist/{core → runtime}/footer-data-provider.js +0 -0
- /package/dist/{core/export-html → runtime/html-export}/ansi-to-html.d.ts +0 -0
- /package/dist/{core/export-html → runtime/html-export}/ansi-to-html.js +0 -0
- /package/dist/{core/export-html → runtime/html-export}/ansi-to-html.ts +0 -0
- /package/dist/{core/export-html → runtime/html-export}/index.d.ts +0 -0
- /package/dist/{core/export-html → runtime/html-export}/template.css +0 -0
- /package/dist/{core/export-html → runtime/html-export}/template.html +0 -0
- /package/dist/{core/export-html → runtime/html-export}/template.js +0 -0
- /package/dist/{core/export-html → runtime/html-export}/tool-renderer.js +0 -0
- /package/dist/{core/export-html → runtime/html-export}/vendor/highlight.min.js +0 -0
- /package/dist/{core/export-html → runtime/html-export}/vendor/marked.min.js +0 -0
- /package/dist/{core → runtime}/keybindings.d.ts +0 -0
- /package/dist/{core → runtime}/keybindings.js +0 -0
- /package/dist/{core/hooks → runtime/lifecycle}/index.d.ts +0 -0
- /package/dist/{core/hooks → runtime/lifecycle}/index.js +0 -0
- /package/dist/{core/hooks → runtime/lifecycle}/loader.d.ts +0 -0
- /package/dist/{core/hooks → runtime/lifecycle}/loader.js +0 -0
- /package/dist/{core/hooks → runtime/lifecycle}/runner.d.ts +0 -0
- /package/dist/{core/hooks → runtime/lifecycle}/runner.js +0 -0
- /package/dist/{core/hooks → runtime/lifecycle}/types.d.ts +0 -0
- /package/dist/{core/hooks → runtime/lifecycle}/types.js +0 -0
- /package/dist/{core → runtime}/messages.d.ts +0 -0
- /package/dist/{core → runtime}/messages.js +0 -0
- /package/dist/{core → runtime}/model-registry.d.ts +0 -0
- /package/dist/{core → runtime}/model-registry.js +0 -0
- /package/dist/{core → runtime}/model-resolver.d.ts +0 -0
- /package/dist/{core → runtime}/package-manager.d.ts +0 -0
- /package/dist/{core → runtime}/package-manager.js +0 -0
- /package/dist/{core/extensions → runtime/plugins}/index.d.ts +0 -0
- /package/dist/{core/extensions → runtime/plugins}/index.js +0 -0
- /package/dist/{core/extensions → runtime/plugins}/loader.d.ts +0 -0
- /package/dist/{core/extensions → runtime/plugins}/loader.js +0 -0
- /package/dist/{core/extensions → runtime/plugins}/runner.d.ts +0 -0
- /package/dist/{core/extensions → runtime/plugins}/types.js +0 -0
- /package/dist/{core/extensions → runtime/plugins}/wrapper.js +0 -0
- /package/dist/{core → runtime}/prompt-templates.d.ts +0 -0
- /package/dist/{core → runtime}/session-manager.d.ts +0 -0
- /package/dist/{core → runtime}/session-manager.js +0 -0
- /package/dist/{core → runtime}/settings-manager.d.ts +0 -0
- /package/dist/{core → runtime}/settings-manager.js +0 -0
- /package/dist/{core → runtime}/skills.d.ts +0 -0
- /package/dist/{core → runtime}/subagents.d.ts +0 -0
- /package/dist/{core → runtime}/system-prompt.d.ts +0 -0
- /package/dist/{core → runtime}/system-prompt.js +0 -0
- /package/dist/{core → runtime}/task-session-manager.d.ts +0 -0
- /package/dist/{core → runtime}/task-session-manager.js +0 -0
- /package/dist/{core → runtime}/timings.d.ts +0 -0
- /package/dist/{core → runtime}/timings.js +0 -0
- /package/dist/{core → runtime}/todo-store.d.ts +0 -0
- /package/dist/{core → runtime}/todo-store.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/bash.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/bash.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/bg-process.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/bg-process.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/edit-diff.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/edit-diff.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/edit.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/edit.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/find.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/find.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/grep.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/grep.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/index.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/ls.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/ls.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/memory.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/memory.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/path-utils.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/path-utils.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/read.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/read.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/registry.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/registry.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/task.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/task.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/todo.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/todo.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/truncate.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/truncate.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/webfetch.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/webfetch.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/websearch.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/websearch.js +0 -0
- /package/dist/{core/tools → runtime/tooling}/write.d.ts +0 -0
- /package/dist/{core/tools → runtime/tooling}/write.js +0 -0
- /package/dist/{observability → telemetry}/core/config.d.ts +0 -0
- /package/dist/{observability → telemetry}/core/config.js +0 -0
- /package/dist/{observability → telemetry}/core/event-bus.d.ts +0 -0
- /package/dist/{observability → telemetry}/core/event-bus.js +0 -0
- /package/dist/{observability → telemetry}/core/index.d.ts +0 -0
- /package/dist/{observability → telemetry}/core/index.js +0 -0
- /package/dist/{observability → telemetry}/core/observability.d.ts +0 -0
- /package/dist/{observability → telemetry}/core/observability.js +0 -0
- /package/dist/{observability → telemetry}/core/span.d.ts +0 -0
- /package/dist/{observability → telemetry}/core/span.js +0 -0
- /package/dist/{observability → telemetry}/core/tracer.d.ts +0 -0
- /package/dist/{observability → telemetry}/core/tracer.js +0 -0
- /package/dist/{observability → telemetry}/core/types.d.ts +0 -0
- /package/dist/{observability → telemetry}/core/types.js +0 -0
- /package/dist/{observability → telemetry}/exporters/base-exporter.d.ts +0 -0
- /package/dist/{observability → telemetry}/exporters/base-exporter.js +0 -0
- /package/dist/{observability → telemetry}/exporters/console-exporter.d.ts +0 -0
- /package/dist/{observability → telemetry}/exporters/console-exporter.js +0 -0
- /package/dist/{observability → telemetry}/exporters/file-exporter.d.ts +0 -0
- /package/dist/{observability → telemetry}/exporters/file-exporter.js +0 -0
- /package/dist/{observability → telemetry}/exporters/index.d.ts +0 -0
- /package/dist/{observability → telemetry}/exporters/index.js +0 -0
- /package/dist/{observability → telemetry}/exporters/langfuse-exporter.d.ts +0 -0
- /package/dist/{observability → telemetry}/exporters/langfuse-exporter.js +0 -0
- /package/dist/{observability → telemetry}/exporters/sentry-exporter.d.ts +0 -0
- /package/dist/{observability → telemetry}/exporters/sentry-exporter.js +0 -0
- /package/dist/{observability → telemetry}/index.d.ts +0 -0
- /package/dist/{observability → telemetry}/index.js +0 -0
- /package/{docs → guides}/PI_MONO_MIT_REMOVAL_GUIDE.md +0 -0
- /package/{docs → guides}/SAME_TO_SAME_PARITY_REPORT.md +0 -0
|
@@ -1,1931 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive Mode - Terminal-based UI for interactive agent use
|
|
3
|
-
*
|
|
4
|
-
* ============================================================================
|
|
5
|
-
* PURPOSE
|
|
6
|
-
* ============================================================================
|
|
7
|
-
*
|
|
8
|
-
* Provides a full-featured terminal UI for interactive use of the coding agent.
|
|
9
|
-
* Handles rendering, keyboard input, session management, and real-time updates.
|
|
10
|
-
* This is the primary mode for direct user interaction with the agent.
|
|
11
|
-
*
|
|
12
|
-
* ============================================================================
|
|
13
|
-
* ARCHITECTURE
|
|
14
|
-
* ============================================================================
|
|
15
|
-
*
|
|
16
|
-
* Initialization Phase:
|
|
17
|
-
* - Create AgentSession with language model and tools
|
|
18
|
-
* - Load theme system and keyboard bindings
|
|
19
|
-
* - Initialize TUI (terminal user interface) library
|
|
20
|
-
* - Set up extension system with UI context
|
|
21
|
-
* - Load autocomplete provider with fd tool for file paths
|
|
22
|
-
*
|
|
23
|
-
* Rendering Phase:
|
|
24
|
-
* - Terminal layout: Header (logo/changelog) → Chat → Pending → Status → Widgets → Editor → Footer
|
|
25
|
-
* - Live rendering of agent messages with syntax highlighting
|
|
26
|
-
* - Real-time tool execution display with collapsible output
|
|
27
|
-
* - Thinking block display (can be toggled via settings)
|
|
28
|
-
* - Auto-scrolling to latest message
|
|
29
|
-
*
|
|
30
|
-
* Input Phase:
|
|
31
|
-
* - Keyboard event handling via TUI key system
|
|
32
|
-
* - Command parsing (/command format)
|
|
33
|
-
* - Slash command autocomplete with fuzzy filtering
|
|
34
|
-
* - File path completion via fd tool
|
|
35
|
-
* - Multi-line editor support with Ctrl+J to continue
|
|
36
|
-
*
|
|
37
|
-
* State Management:
|
|
38
|
-
* - Subscribe to AgentSession events (messages, tools, compaction)
|
|
39
|
-
* - Update display on each event
|
|
40
|
-
* - Maintain streaming component state for incremental rendering
|
|
41
|
-
* - Track tool execution components for expansion control
|
|
42
|
-
*
|
|
43
|
-
* ============================================================================
|
|
44
|
-
* DATA FLOW
|
|
45
|
-
* ============================================================================
|
|
46
|
-
*
|
|
47
|
-
* User Input Flow:
|
|
48
|
-
* User Input (keyboard)
|
|
49
|
-
* ↓
|
|
50
|
-
* TUI Key Handler (in setupKeyHandlers)
|
|
51
|
-
* ↓
|
|
52
|
-
* Command Parser (parseSlashCommand or plain text)
|
|
53
|
-
* ↓
|
|
54
|
-
* Command Handler or session.prompt()
|
|
55
|
-
* ↓
|
|
56
|
-
* AgentSession.prompt() executes agent loop
|
|
57
|
-
* ↓
|
|
58
|
-
* Agent emits AgentSessionEvent (message, tool, etc.)
|
|
59
|
-
* ↓
|
|
60
|
-
* Event Subscriber in InteractiveMode (subscribeToAgent)
|
|
61
|
-
* ↓
|
|
62
|
-
* Display Update (render message, tool, status)
|
|
63
|
-
* ↓
|
|
64
|
-
* TUI Invalidate → requestRender()
|
|
65
|
-
* ↓
|
|
66
|
-
* Terminal Output Rendered
|
|
67
|
-
*
|
|
68
|
-
* Event Processing Flow:
|
|
69
|
-
* agent_start → Show loading animation
|
|
70
|
-
* message_streamed → Stream text to AssistantMessageComponent
|
|
71
|
-
* tool_call → Create ToolExecutionComponent, show in pending area
|
|
72
|
-
* tool_output → Update tool component with result
|
|
73
|
-
* message_complete → Move message to chat, hide loading
|
|
74
|
-
* compaction_start → Show compaction loader
|
|
75
|
-
* compaction_complete → Update with summary message
|
|
76
|
-
*
|
|
77
|
-
* ============================================================================
|
|
78
|
-
* KEY COMPONENTS
|
|
79
|
-
* ============================================================================
|
|
80
|
-
*
|
|
81
|
-
* Renderer:
|
|
82
|
-
* - TUI: Core terminal rendering library (from indusagi/tui)
|
|
83
|
-
* - Components: Markdown, Text, Container, ProcessTerminal, etc.
|
|
84
|
-
* - Handles ANSI codes for colors, styles, and terminal control
|
|
85
|
-
* - Manages viewport size and automatic text wrapping
|
|
86
|
-
*
|
|
87
|
-
* InputHandler:
|
|
88
|
-
* - CustomEditor: Multi-line editor with autocomplete
|
|
89
|
-
* - KeybindingsManager: Keyboard shortcut configuration
|
|
90
|
-
* - Autocomplete: Slash commands, file paths, templates
|
|
91
|
-
* - Command Parser: Processes /settings, /model, /fork, etc.
|
|
92
|
-
*
|
|
93
|
-
* DisplayManager:
|
|
94
|
-
* - InteractiveMode class: Orchestrates all display updates
|
|
95
|
-
* - Container hierarchy: ChatContainer, PendingMessagesContainer, StatusContainer
|
|
96
|
-
* - Session display: Shows messages, tools, thinking blocks
|
|
97
|
-
* - Component tracking: streamingComponent, pendingTools, etc.
|
|
98
|
-
*
|
|
99
|
-
* ThemeManager:
|
|
100
|
-
* - Theme system: Colors, styles, layout options
|
|
101
|
-
* - EditorTheme: Syntax highlighting for code
|
|
102
|
-
* - MarkdownTheme: Rendering options for markdown
|
|
103
|
-
* - Theme switching: Hot reload on theme file changes
|
|
104
|
-
* - Custom themes: Load from .indusagi/themes/*.json
|
|
105
|
-
*
|
|
106
|
-
* Extension System:
|
|
107
|
-
* - ExtensionRunner: Manages registered extensions
|
|
108
|
-
* - ExtensionUIContext: TUI-based UI for extensions
|
|
109
|
-
* - Extension shortcuts: Keyboard shortcuts from extensions
|
|
110
|
-
* - Extension widgets: Custom UI above/below editor
|
|
111
|
-
* - Extension commands: Custom slash commands
|
|
112
|
-
*
|
|
113
|
-
* SessionManager:
|
|
114
|
-
* - Session state tracking: Model, messages, tools
|
|
115
|
-
* - Session persistence: Save/load from disk
|
|
116
|
-
* - Branching: Create branches from previous messages
|
|
117
|
-
* - Tree navigation: Switch between branches
|
|
118
|
-
*
|
|
119
|
-
* ============================================================================
|
|
120
|
-
* KEY FEATURES
|
|
121
|
-
* ============================================================================
|
|
122
|
-
*
|
|
123
|
-
* Real-time Streaming:
|
|
124
|
-
* - Stream agent responses token-by-token
|
|
125
|
-
* - Show tool execution in real-time
|
|
126
|
-
* - Display thinking blocks (if enabled)
|
|
127
|
-
* - Syntax highlighting for code blocks
|
|
128
|
-
*
|
|
129
|
-
* Interactive Commands:
|
|
130
|
-
* - /settings: Open settings menu
|
|
131
|
-
* - /model: Select language model
|
|
132
|
-
* - /fork: Create branch from previous message
|
|
133
|
-
* - /tree: Navigate session tree
|
|
134
|
-
* - /export: Export to HTML
|
|
135
|
-
* - /compact: Manually compact session
|
|
136
|
-
* - /new: Start new session
|
|
137
|
-
*
|
|
138
|
-
* Session Management:
|
|
139
|
-
* - Save/load sessions from disk
|
|
140
|
-
* - Branch creation and navigation
|
|
141
|
-
* - Automatic context compaction
|
|
142
|
-
* - Session switching
|
|
143
|
-
*
|
|
144
|
-
* Customization:
|
|
145
|
-
* - Custom themes
|
|
146
|
-
* - Keyboard bindings
|
|
147
|
-
* - Settings (quiet startup, collapse changelog, etc.)
|
|
148
|
-
* - Editor options (padding, tab width, etc.)
|
|
149
|
-
*
|
|
150
|
-
* ============================================================================
|
|
151
|
-
* BASED ON INDUSAGI VENDOR
|
|
152
|
-
* ============================================================================
|
|
153
|
-
*
|
|
154
|
-
* This interactive mode implementation is based on indusagi, a terminal UI
|
|
155
|
-
* toolkit and agent framework maintained at:
|
|
156
|
-
* https://github.com/varunisrani/indusagi-ts
|
|
157
|
-
*
|
|
158
|
-
* Vendor packages used:
|
|
159
|
-
* - indusagi/tui: Terminal UI components and rendering
|
|
160
|
-
* - indusagi/ai: AI model interfaces and chat protocol
|
|
161
|
-
* - indusagi/agent: Core agent session and event system
|
|
162
|
-
*
|
|
163
|
-
* Attribution: Builds on proven TUI patterns and architectural decisions
|
|
164
|
-
* from the original indusagi implementation.
|
|
165
|
-
*/
|
|
166
|
-
import { type ImageContent } from "indusagi/ai";
|
|
167
|
-
import { type AgentSession } from "../../core/agent-session.js";
|
|
168
|
-
/**
|
|
169
|
-
* Options for InteractiveMode initialization.
|
|
170
|
-
*/
|
|
171
|
-
export interface InteractiveModeOptions {
|
|
172
|
-
/** Providers that were migrated to auth.json (shows warning) */
|
|
173
|
-
migratedProviders?: string[];
|
|
174
|
-
/** Warning message if session model couldn't be restored */
|
|
175
|
-
modelFallbackMessage?: string;
|
|
176
|
-
/** Initial message to send on startup (can include @file content) */
|
|
177
|
-
initialMessage?: string;
|
|
178
|
-
/** Images to attach to the initial message */
|
|
179
|
-
initialImages?: ImageContent[];
|
|
180
|
-
/** Additional messages to send after the initial message */
|
|
181
|
-
initialMessages?: string[];
|
|
182
|
-
/** Force verbose startup (overrides quietStartup setting) */
|
|
183
|
-
verbose?: boolean;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* ============================================================================
|
|
187
|
-
* INTERACTIVE MODE - RENDERING ORCHESTRATION & PIPELINE
|
|
188
|
-
* ============================================================================
|
|
189
|
-
*
|
|
190
|
-
* COMPREHENSIVE RENDERING DOCUMENTATION:
|
|
191
|
-
* ============================================================================
|
|
192
|
-
*
|
|
193
|
-
* This section documents the complete rendering pipeline from session state
|
|
194
|
-
* to terminal output. The InteractiveMode class manages the TUI layout,
|
|
195
|
-
* message rendering, and real-time updates for the interactive agent interface.
|
|
196
|
-
*
|
|
197
|
-
* RENDERING PIPELINE OVERVIEW:
|
|
198
|
-
* ============================================================================
|
|
199
|
-
* End-to-End Flow (from user input to terminal display):
|
|
200
|
-
*
|
|
201
|
-
* User Input (keyboard event)
|
|
202
|
-
* ↓
|
|
203
|
-
* TUI key handler → setupKeyHandlers()
|
|
204
|
-
* ↓
|
|
205
|
-
* Command parser (parseSlashCommand or plaintext)
|
|
206
|
-
* ↓
|
|
207
|
-
* Handler: session.prompt(text) or special command
|
|
208
|
-
* ↓
|
|
209
|
-
* AgentSession processes (calls LLM, tools, etc.)
|
|
210
|
-
* ↓
|
|
211
|
-
* Agent emits events: message_streamed, tool_output, etc.
|
|
212
|
-
* ↓
|
|
213
|
-
* Event handler: subscribeToAgent() listeners
|
|
214
|
-
* ↓
|
|
215
|
-
* Display update: addMessageToChat() or component.updateResult()
|
|
216
|
-
* ↓
|
|
217
|
-
* TUI invalidate() → ui.requestRender()
|
|
218
|
-
* ↓
|
|
219
|
-
* TUI render() → compute layout (width, height, wrapping)
|
|
220
|
-
* ↓
|
|
221
|
-
* Terminal output: ANSI codes to terminal device
|
|
222
|
-
* ↓
|
|
223
|
-
* User sees updated chat with new message
|
|
224
|
-
*
|
|
225
|
-
* LAYOUT STRUCTURE:
|
|
226
|
-
* ============================================================================
|
|
227
|
-
* Terminal Layout (top to bottom):
|
|
228
|
-
*
|
|
229
|
-
* ┌─────────────────────────────────────────────────────┐
|
|
230
|
-
* │ [Logo/Changelog] (conditionally shown at startup) │ 1-10 lines
|
|
231
|
-
* ├─────────────────────────────────────────────────────┤
|
|
232
|
-
* │ │
|
|
233
|
-
* │ Chat Messages (scrollable, grows downward) │ N lines
|
|
234
|
-
* │ ├─ User message (background colored) │
|
|
235
|
-
* │ ├─ Assistant message │
|
|
236
|
-
* │ ├─ Tool execution (pending or complete) │
|
|
237
|
-
* │ └─ ...more messages... │
|
|
238
|
-
* │ │
|
|
239
|
-
* ├─────────────────────────────────────────────────────┤
|
|
240
|
-
* │ Pending Messages (tools being executed) │ 1-20 lines
|
|
241
|
-
* │ ├─ Tool call (pending background) │
|
|
242
|
-
* │ └─ ...more pending tools... │
|
|
243
|
-
* ├─────────────────────────────────────────────────────┤
|
|
244
|
-
* │ Status Line (operation status) │ 1 line
|
|
245
|
-
* │ "Thinking..." or "Reading files..." or "Complete" │
|
|
246
|
-
* ├─────────────────────────────────────────────────────┤
|
|
247
|
-
* │ [Widgets] (optional, from extensions) │ 0-5 lines
|
|
248
|
-
* ├─────────────────────────────────────────────────────┤
|
|
249
|
-
* │ [Editor] (multi-line input) │ 3-10 lines
|
|
250
|
-
* │ > User typing here... │
|
|
251
|
-
* │ > Can span multiple lines │
|
|
252
|
-
* ├─────────────────────────────────────────────────────┤
|
|
253
|
-
* │ [Footer] (status, model, etc.) │ 1 line
|
|
254
|
-
* │ Model: GPT-4 | Tokens: 4,251 | Compaction: ... │
|
|
255
|
-
* └─────────────────────────────────────────────────────┘
|
|
256
|
-
*
|
|
257
|
-
* Container Hierarchy:
|
|
258
|
-
* - mainContainer: Root container for entire UI
|
|
259
|
-
* ├── logoContainer: Logo/changelog (conditional)
|
|
260
|
-
* ├── chatContainer: All completed messages
|
|
261
|
-
* ├── pendingMessagesContainer: Tools being executed
|
|
262
|
-
* ├── statusContainer: Status line
|
|
263
|
-
* ├── widgetsContainer: Extension widgets
|
|
264
|
-
* ├── editorContainer: Multi-line input
|
|
265
|
-
* └── footerComponent: Status bar at bottom
|
|
266
|
-
*
|
|
267
|
-
* RENDERING MODES:
|
|
268
|
-
* ============================================================================
|
|
269
|
-
*
|
|
270
|
-
* 1. INITIAL LOAD (renderInitialMessages):
|
|
271
|
-
* Purpose: Display all messages when session loads
|
|
272
|
-
* Process:
|
|
273
|
-
* a. Session manager builds aligned message context
|
|
274
|
-
* b. Iterate through all messages (oldest to newest)
|
|
275
|
-
* c. For each assistant message:
|
|
276
|
-
* - Create AssistantMessageComponent
|
|
277
|
-
* - For each tool call in message:
|
|
278
|
-
* - Create ToolExecutionComponent (no result yet)
|
|
279
|
-
* - Render to chatContainer
|
|
280
|
-
* d. For each tool result message:
|
|
281
|
-
* - Find matching pending tool
|
|
282
|
-
* - Call component.updateResult()
|
|
283
|
-
* - Remove from pending map
|
|
284
|
-
* e. Update footer (token count, context info)
|
|
285
|
-
* f. Add user messages to editor history (for Up arrow)
|
|
286
|
-
* g. Call ui.requestRender()
|
|
287
|
-
*
|
|
288
|
-
* 2. STREAMING UPDATES (handleEvent):
|
|
289
|
-
* Purpose: Update display as agent processes real-time
|
|
290
|
-
* Process:
|
|
291
|
-
* a. Agent emits message_streamed event
|
|
292
|
-
* b. Extract message from event.message
|
|
293
|
-
* c. Create/update component:
|
|
294
|
-
* - First event: Create AssistantMessageComponent
|
|
295
|
-
* - Subsequent events: Call component.updateContent()
|
|
296
|
-
* d. Add to chatContainer if first event
|
|
297
|
-
* e. Update footer status (show operation in progress)
|
|
298
|
-
* f. TUI invalidate() and requestRender()
|
|
299
|
-
* Optimization:
|
|
300
|
-
* - Streaming component cached (one per assistant message)
|
|
301
|
-
* - Only call updateContent() on new content (not full rebuild)
|
|
302
|
-
* - Markdown rendering is lazy-cached by TUI library
|
|
303
|
-
*
|
|
304
|
-
* 3. TOOL EXECUTION (handleEvent + renderSessionContext):
|
|
305
|
-
* Purpose: Show tool calls and their results
|
|
306
|
-
* Process:
|
|
307
|
-
* a. Agent emits message_update (tool call started)
|
|
308
|
-
* b. Render tool call with pending background
|
|
309
|
-
* c. Tool executes (could take seconds/minutes)
|
|
310
|
-
* d. Agent emits tool_output event
|
|
311
|
-
* e. Find tool component in pendingTools map
|
|
312
|
-
* f. Call component.updateResult()
|
|
313
|
-
* g. Pending background changes to success/error
|
|
314
|
-
* h. Remove from pendingTools (completed)
|
|
315
|
-
* i. User can expand/collapse output via toolOutputExpanded setting
|
|
316
|
-
*
|
|
317
|
-
* 4. REAL-TIME BASH (handleBashCommand):
|
|
318
|
-
* Purpose: Stream bash output line-by-line
|
|
319
|
-
* Process:
|
|
320
|
-
* a. User types !! command
|
|
321
|
-
* b. Create BashExecutionComponent
|
|
322
|
-
* c. Start bash execution (async)
|
|
323
|
-
* d. Agent streams stdout chunks
|
|
324
|
-
* e. For each chunk:
|
|
325
|
-
* - Call component.appendOutput()
|
|
326
|
-
* - Component appends to outputLines
|
|
327
|
-
* - Call updateDisplay() and requestRender()
|
|
328
|
-
* f. When done, call component.setComplete()
|
|
329
|
-
* g. Show exit code or cancellation message
|
|
330
|
-
*
|
|
331
|
-
* 5. REBUILD (rebuildChatFromMessages):
|
|
332
|
-
* Purpose: Clear and re-render after settings change or recovery
|
|
333
|
-
* Process:
|
|
334
|
-
* a. Clear chatContainer
|
|
335
|
-
* b. Call renderInitialMessages()
|
|
336
|
-
* c. All messages re-created with new settings
|
|
337
|
-
* d. Useful for: thinking block toggle, theme change, etc.
|
|
338
|
-
*
|
|
339
|
-
* STYLING & COLOR SCHEME:
|
|
340
|
-
* ============================================================================
|
|
341
|
-
* Message Type Colors:
|
|
342
|
-
* - User message: userMessageBg + userMessageText (background + text)
|
|
343
|
-
* - Assistant: Normal markdown colors (no background)
|
|
344
|
-
* - Tool pending: toolPendingBg (neutral during execution)
|
|
345
|
-
* - Tool success: toolSuccessBg (green tint after success)
|
|
346
|
-
* - Tool error: toolErrorBg (red tint after error)
|
|
347
|
-
* - Bash: bashMode color (border + command)
|
|
348
|
-
* - Error: theme.fg("error", text) (red)
|
|
349
|
-
* - Warning: theme.fg("warning", text) (yellow)
|
|
350
|
-
* - Muted: theme.fg("muted", text) (dim/gray)
|
|
351
|
-
*
|
|
352
|
-
* Code Highlighting:
|
|
353
|
-
* - Markdown: Full markdown with syntax-highlighted code blocks
|
|
354
|
-
* - Code inline: Monospace with color
|
|
355
|
-
* - Code block: Full syntax highlighting via highlight.js
|
|
356
|
-
* - Languages detected from file extensions
|
|
357
|
-
* - Theme provides editor theme for highlighting
|
|
358
|
-
*
|
|
359
|
-
* Spacing & Layout:
|
|
360
|
-
* - Line height: 1 logical line per message (no double spacing)
|
|
361
|
-
* - Margins: Spacer(1) before each message type
|
|
362
|
-
* - Padding: 1 char left/right within backgrounds
|
|
363
|
-
* - Terminal width: Auto-wrap text to terminal width
|
|
364
|
-
* - Viewport: Scrollable (auto-scroll to bottom on new message)
|
|
365
|
-
*
|
|
366
|
-
* PERFORMANCE CONSIDERATIONS:
|
|
367
|
-
* ============================================================================
|
|
368
|
-
*
|
|
369
|
-
* Streaming Performance:
|
|
370
|
-
* - Streaming component cached: Only one active at a time
|
|
371
|
-
* - Markdown incremental: TUI library caches rendering
|
|
372
|
-
* - Invalidate efficient: Only re-renders changed container
|
|
373
|
-
* - Suitable for: 100+ stream updates without lag
|
|
374
|
-
*
|
|
375
|
-
* Large Conversations:
|
|
376
|
-
* - Tool caching: pendingTools map (fast lookup by ID)
|
|
377
|
-
* - Lazy rendering: Messages only rendered when visible
|
|
378
|
-
* - No 1000+ message overhead with proper viewport management
|
|
379
|
-
* - Compaction system: Auto-summarizes old messages to save memory
|
|
380
|
-
*
|
|
381
|
-
* Image Handling:
|
|
382
|
-
* - Async conversion: Non-blocking PNG conversion for Kitty protocol
|
|
383
|
-
* - Lazy loading: Images loaded when result arrives
|
|
384
|
-
* - Format detection: MIME type checked, converted if needed
|
|
385
|
-
* - Display control: showImages setting filters images
|
|
386
|
-
*
|
|
387
|
-
* Diff Computation:
|
|
388
|
-
* - Async preview: Edit diff computed before tool runs
|
|
389
|
-
* - Result override: Post-execution diff takes priority
|
|
390
|
-
* - Caching: Results cached to avoid re-computation
|
|
391
|
-
* - Race handling: File modifications between preview/execution
|
|
392
|
-
*
|
|
393
|
-
* INTERACTIVE FEATURES:
|
|
394
|
-
* ============================================================================
|
|
395
|
-
*
|
|
396
|
-
* Keyboard Controls:
|
|
397
|
-
* - Enter: Send message
|
|
398
|
-
* - Ctrl-J: Continue multi-line message
|
|
399
|
-
* - Arrow Up: Recall previous message from history
|
|
400
|
-
* - /settings: Open settings dialog
|
|
401
|
-
* - /model: Select language model
|
|
402
|
-
* - Tab: Autocomplete
|
|
403
|
-
* - Ctrl-C: Cancel current operation or exit
|
|
404
|
-
*
|
|
405
|
-
* Expandable Elements:
|
|
406
|
-
* - Tool output: Expand to see full output (toolOutputExpanded setting)
|
|
407
|
-
* - Code blocks: Expand long code to show all lines
|
|
408
|
-
* - Tool list: Expand to show all matching tools
|
|
409
|
-
* - Bash output: Expand from preview (20 lines) to full
|
|
410
|
-
*
|
|
411
|
-
* Real-time Status:
|
|
412
|
-
* - Status line: Shows current operation (thinking, reading, writing)
|
|
413
|
-
* - Footer: Token count, model name, session info
|
|
414
|
-
* - Loader: Animated spinner for long operations
|
|
415
|
-
* - Progress: Some operations show progress indicator
|
|
416
|
-
*
|
|
417
|
-
* Session Management:
|
|
418
|
-
* - Fork: Create branch from previous message
|
|
419
|
-
* - Tree: Navigate between branches
|
|
420
|
-
* - Save: Auto-save to .indusagi/sessions/
|
|
421
|
-
* - Resume: Load previous session on startup
|
|
422
|
-
*
|
|
423
|
-
* EXAMPLE RENDERING SEQUENCES:
|
|
424
|
-
* ============================================================================
|
|
425
|
-
*
|
|
426
|
-
* Sequence 1: User Prompt → Assistant Response
|
|
427
|
-
* ─────────────────────────────────────────────
|
|
428
|
-
*
|
|
429
|
-
* 1. User types "read src/main.ts" and presses Enter
|
|
430
|
-
* 2. CustomEditor captures text and clears
|
|
431
|
-
* 3. session.prompt(text) called
|
|
432
|
-
* 4. Agent starts processing
|
|
433
|
-
* 5. Agent emits message_streamed with assistant message (empty)
|
|
434
|
-
* → CreateAssistantMessageComponent, add to chatContainer
|
|
435
|
-
* → Show status "Thinking..."
|
|
436
|
-
* 6. Agent streams text tokens "I'll read the file..."
|
|
437
|
-
* → component.updateContent(), add text to message
|
|
438
|
-
* → invalidate() and requestRender()
|
|
439
|
-
* 7. Agent detects tool call (read)
|
|
440
|
-
* → Emit message_update with tool call
|
|
441
|
-
* → CreateToolExecutionComponent, add to chatContainer
|
|
442
|
-
* → pendingTools["id"] = component
|
|
443
|
-
* 8. Tool executes on server
|
|
444
|
-
* 9. Agent emits tool_output with result
|
|
445
|
-
* → Find component in pendingTools["id"]
|
|
446
|
-
* → component.updateResult(result)
|
|
447
|
-
* → Remove from pendingTools
|
|
448
|
-
* → Background changes from pending to success
|
|
449
|
-
* 10. Agent completes
|
|
450
|
-
* → Hide status line
|
|
451
|
-
* → Show footer with token count
|
|
452
|
-
* 11. Entire sequence rendered to terminal
|
|
453
|
-
*
|
|
454
|
-
* Sequence 2: Real-time Bash Output
|
|
455
|
-
* ──────────────────────────────────
|
|
456
|
-
*
|
|
457
|
-
* 1. User types "!!ls -la /src" and presses Enter
|
|
458
|
-
* 2. handleBashCommand() parses and creates BashExecutionComponent
|
|
459
|
-
* 3. Component shows header and loader
|
|
460
|
-
* 4. Shell command starts (async)
|
|
461
|
-
* 5. Shell outputs "total 128\ndrwx..." chunk 1
|
|
462
|
-
* → component.appendOutput(chunk)
|
|
463
|
-
* → outputLines = ["total 128", "drwx..."]
|
|
464
|
-
* → updateDisplay() and requestRender()
|
|
465
|
-
* 6. Shell outputs "-rw-r--..." chunk 2
|
|
466
|
-
* → component.appendOutput(chunk)
|
|
467
|
-
* → outputLines += ["-rw-r--..."]
|
|
468
|
-
* → updateDisplay() and requestRender()
|
|
469
|
-
* 7. Shell outputs "(exit 0)" and completes
|
|
470
|
-
* → component.setComplete(0, false, ...)
|
|
471
|
-
* → Loader stops, exit code shown
|
|
472
|
-
* → updateDisplay() and requestRender()
|
|
473
|
-
* 8. Final output rendered to terminal
|
|
474
|
-
*
|
|
475
|
-
* TERMINAL DIMENSIONS & WRAPPING:
|
|
476
|
-
* ============================================================================
|
|
477
|
-
*
|
|
478
|
-
* Width Handling:
|
|
479
|
-
* - Terminal width from ui.terminal.columns
|
|
480
|
-
* - TUI library auto-wraps text at this width
|
|
481
|
-
* - Code blocks may overflow (user can scroll horizontally)
|
|
482
|
-
* - Table rendering respects width (may abbreviate cells)
|
|
483
|
-
*
|
|
484
|
-
* Height Handling:
|
|
485
|
-
* - Terminal height from ui.terminal.rows
|
|
486
|
-
* - mainContainer grows as needed (scrollable)
|
|
487
|
-
* - Chat area expands to fill available space
|
|
488
|
-
* - Footer always at bottom (fixed)
|
|
489
|
-
* - Editor always above footer (fixed)
|
|
490
|
-
*
|
|
491
|
-
* Dynamic Resizing:
|
|
492
|
-
* - TUI detects terminal resize (SIGWINCH)
|
|
493
|
-
* - All components re-render with new dimensions
|
|
494
|
-
* - invalidate() called on all containers
|
|
495
|
-
* - Visual line truncation recached (width-aware)
|
|
496
|
-
* - Auto-scroll adjusted to show latest message
|
|
497
|
-
*
|
|
498
|
-
* Text Truncation:
|
|
499
|
-
* - Long lines: Wrapped automatically by TUI
|
|
500
|
-
* - Visual truncation: truncateToVisualLines() respects width
|
|
501
|
-
* - Ellipsis: "..." used to indicate truncation
|
|
502
|
-
* - Hints: Show "(to expand)" for cut-off content
|
|
503
|
-
*
|
|
504
|
-
* INTEGRATION WITH EXTENSIONS:
|
|
505
|
-
* ============================================================================
|
|
506
|
-
*
|
|
507
|
-
* Custom Renderers:
|
|
508
|
-
* - Extension provides renderCall() and renderResult()
|
|
509
|
-
* - Called from ToolExecutionComponent.updateDisplay()
|
|
510
|
-
* - Custom components rendered within tool box
|
|
511
|
-
* - Falls back to built-in rendering if custom fails
|
|
512
|
-
*
|
|
513
|
-
* Custom Commands:
|
|
514
|
-
* - Extension registers slash command handler
|
|
515
|
-
* - Command handler called from InteractiveMode.handleCommand()
|
|
516
|
-
* - Can show dialogs, update display, etc.
|
|
517
|
-
* - Can access session and TUI for rendering
|
|
518
|
-
*
|
|
519
|
-
* Widgets:
|
|
520
|
-
* - Extension provides widget component
|
|
521
|
-
* - Rendered in widgetsContainer above editor
|
|
522
|
-
* - Can show status, buttons, controls, etc.
|
|
523
|
-
* - Multiple widgets stack vertically
|
|
524
|
-
*
|
|
525
|
-
* SEE ALSO:
|
|
526
|
-
* ============================================================================
|
|
527
|
-
* - AssistantMessageComponent: Text/thinking rendering
|
|
528
|
-
* - UserMessageComponent: User prompt rendering
|
|
529
|
-
* - ToolExecutionComponent: Tool call/result rendering
|
|
530
|
-
* - BashExecutionComponent: Real-time bash output
|
|
531
|
-
* - renderInitialMessages(): Full session rendering
|
|
532
|
-
* - renderSessionContext(): Message-by-message rendering
|
|
533
|
-
* - handleEvent(): Real-time event processing
|
|
534
|
-
* - subscribeToAgent(): Event subscription setup
|
|
535
|
-
*/
|
|
536
|
-
export declare class InteractiveMode {
|
|
537
|
-
private options;
|
|
538
|
-
private session;
|
|
539
|
-
private ui;
|
|
540
|
-
private chatContainer;
|
|
541
|
-
private pendingMessagesContainer;
|
|
542
|
-
private statusContainer;
|
|
543
|
-
private defaultEditor;
|
|
544
|
-
private editor;
|
|
545
|
-
private autocompleteProvider;
|
|
546
|
-
private fdPath;
|
|
547
|
-
private editorContainer;
|
|
548
|
-
private footer;
|
|
549
|
-
private footerDataProvider;
|
|
550
|
-
private keybindings;
|
|
551
|
-
private version;
|
|
552
|
-
private isInitialized;
|
|
553
|
-
private onInputCallback?;
|
|
554
|
-
private loadingAnimation;
|
|
555
|
-
private pendingWorkingMessage;
|
|
556
|
-
private readonly defaultWorkingMessage;
|
|
557
|
-
private lastSigintTime;
|
|
558
|
-
private lastEscapeTime;
|
|
559
|
-
private changelogMarkdown;
|
|
560
|
-
private lastStatusSpacer;
|
|
561
|
-
private lastStatusText;
|
|
562
|
-
private streamingComponent;
|
|
563
|
-
private streamingMessage;
|
|
564
|
-
private pendingTools;
|
|
565
|
-
private toolOutputExpanded;
|
|
566
|
-
private hideThinkingBlock;
|
|
567
|
-
private skillCommands;
|
|
568
|
-
private unsubscribe?;
|
|
569
|
-
private isBashMode;
|
|
570
|
-
private bashComponent;
|
|
571
|
-
private pendingBashComponents;
|
|
572
|
-
private autoCompactionLoader;
|
|
573
|
-
private autoCompactionEscapeHandler?;
|
|
574
|
-
private retryLoader;
|
|
575
|
-
private retryEscapeHandler?;
|
|
576
|
-
private compactionQueuedMessages;
|
|
577
|
-
private shutdownRequested;
|
|
578
|
-
private extensionSelector;
|
|
579
|
-
private extensionInput;
|
|
580
|
-
private extensionEditor;
|
|
581
|
-
private extensionWidgetsAbove;
|
|
582
|
-
private extensionWidgetsBelow;
|
|
583
|
-
private widgetContainerAbove;
|
|
584
|
-
private widgetContainerBelow;
|
|
585
|
-
private customFooter;
|
|
586
|
-
private builtInHeader;
|
|
587
|
-
private customHeader;
|
|
588
|
-
private get agent();
|
|
589
|
-
private get sessionManager();
|
|
590
|
-
private get settingsManager();
|
|
591
|
-
constructor(session: AgentSession, options?: InteractiveModeOptions);
|
|
592
|
-
private setupAutocomplete;
|
|
593
|
-
private rebuildAutocomplete;
|
|
594
|
-
private prepareStartupResources;
|
|
595
|
-
private buildStartupHeader;
|
|
596
|
-
private attachMainLayout;
|
|
597
|
-
private activateInteractiveRuntime;
|
|
598
|
-
private showStartupWarnings;
|
|
599
|
-
private processStartupMessages;
|
|
600
|
-
/**
|
|
601
|
-
* Initialize the interactive mode UI and extensions.
|
|
602
|
-
*
|
|
603
|
-
* PURPOSE:
|
|
604
|
-
* Sets up the terminal UI, keyboard handlers, event subscriptions, and extension system.
|
|
605
|
-
* This prepares the interactive mode for user interaction. Must be called before run().
|
|
606
|
-
*
|
|
607
|
-
* PROCESS:
|
|
608
|
-
* 1. Load changelog entries and check for initial messages
|
|
609
|
-
* 2. Ensure fd tool is available for file path autocomplete
|
|
610
|
-
* 3. Build autocomplete provider (slash commands, templates, extensions, skills)
|
|
611
|
-
* 4. Initialize TUI with header (logo, keybinding hints, changelog)
|
|
612
|
-
* 5. Add layout components (chat, pending, status, widgets, editor, footer)
|
|
613
|
-
* 6. Set up keyboard handlers (key bindings, editor events)
|
|
614
|
-
* 7. Start the TUI (terminal raw mode, enable mouse, etc.)
|
|
615
|
-
* 8. Initialize extension system with TUI-based UI context
|
|
616
|
-
* 9. Subscribe to agent events (messages, tools, compaction, retry)
|
|
617
|
-
* 10. Set up theme file watcher for hot reload
|
|
618
|
-
* 11. Set up git branch watcher for footer
|
|
619
|
-
* 12. Initialize available provider count for display
|
|
620
|
-
*
|
|
621
|
-
* PARAMETERS:
|
|
622
|
-
* None - uses constructor options for initial messages and warnings
|
|
623
|
-
*
|
|
624
|
-
* RETURNS:
|
|
625
|
-
* Promise<void> - resolves when initialization is complete
|
|
626
|
-
*
|
|
627
|
-
* STATE CHANGES:
|
|
628
|
-
* - Sets isInitialized flag to true
|
|
629
|
-
* - Starts TUI (terminal is in raw mode after this)
|
|
630
|
-
* - Sets terminal title with session name
|
|
631
|
-
* - Subscribes to agent events and theme changes
|
|
632
|
-
*
|
|
633
|
-
* NOTES:
|
|
634
|
-
* - Must be idempotent (calling twice does nothing on second call)
|
|
635
|
-
* - Extension system is fully initialized here
|
|
636
|
-
* - Changelog is only shown for new sessions, not resumed ones
|
|
637
|
-
*/
|
|
638
|
-
init(): Promise<void>;
|
|
639
|
-
/**
|
|
640
|
-
* Update terminal title with session name and cwd.
|
|
641
|
-
*/
|
|
642
|
-
private updateTerminalTitle;
|
|
643
|
-
/**
|
|
644
|
-
* Run the interactive mode main loop.
|
|
645
|
-
*
|
|
646
|
-
* PURPOSE:
|
|
647
|
-
* Main entry point for interactive mode. Initializes UI, displays startup info,
|
|
648
|
-
* processes initial messages, and enters the interactive user input loop.
|
|
649
|
-
* Never returns under normal operation (runs until user exits with /quit, Ctrl+D, etc.).
|
|
650
|
-
*
|
|
651
|
-
* PROCESS:
|
|
652
|
-
* 1. Call init() to set up UI, keyboard handlers, extensions
|
|
653
|
-
* 2. Start version check asynchronously (shows notification if newer version available)
|
|
654
|
-
* 3. Render initial session messages from previous session (if resumed)
|
|
655
|
-
* 4. Show startup warnings:
|
|
656
|
-
* - Migrated provider credentials
|
|
657
|
-
* - models.json parsing errors
|
|
658
|
-
* - Model fallback message (if model couldn't be restored)
|
|
659
|
-
* 5. Process initial messages from options (--message, --initial-message):
|
|
660
|
-
* - Send each via session.prompt()
|
|
661
|
-
* - Catch and display errors
|
|
662
|
-
* 6. Start interactive loop:
|
|
663
|
-
* a. Wait for user input (getUserInput waits for editor.onSubmit)
|
|
664
|
-
* b. Send input to session.prompt()
|
|
665
|
-
* c. Loop continues until shutdown (process.exit)
|
|
666
|
-
*
|
|
667
|
-
* PARAMETERS:
|
|
668
|
-
* None - uses constructor options for initial messages and warnings
|
|
669
|
-
*
|
|
670
|
-
* RETURNS:
|
|
671
|
-
* Promise<void> - never resolves (runs until process.exit is called)
|
|
672
|
-
*
|
|
673
|
-
* STATE CHANGES:
|
|
674
|
-
* - Initializes all UI components
|
|
675
|
-
* - Starts the interactive input loop
|
|
676
|
-
* - Updates footer/display as agent processes messages
|
|
677
|
-
* - May create new sessions, fork, navigate tree, etc. based on commands
|
|
678
|
-
*
|
|
679
|
-
* NOTES:
|
|
680
|
-
* - Must call init() first
|
|
681
|
-
* - Handles all errors from session.prompt() and displays them
|
|
682
|
-
* - Runs forever - shutdown happens via /quit, Ctrl+D, or extension shutdown signal
|
|
683
|
-
*/
|
|
684
|
-
run(): Promise<void>;
|
|
685
|
-
/**
|
|
686
|
-
* Check npm registry for a newer version.
|
|
687
|
-
*/
|
|
688
|
-
private checkForNewVersion;
|
|
689
|
-
/**
|
|
690
|
-
* Get changelog entries to display on startup.
|
|
691
|
-
* Only shows new entries since last seen version, skips for resumed sessions.
|
|
692
|
-
*/
|
|
693
|
-
private getChangelogForDisplay;
|
|
694
|
-
private getStartupImageComponent;
|
|
695
|
-
private getMarkdownThemeWithSettings;
|
|
696
|
-
private formatDisplayPath;
|
|
697
|
-
/**
|
|
698
|
-
* Get a short path relative to the package root for display.
|
|
699
|
-
*/
|
|
700
|
-
private getShortPath;
|
|
701
|
-
private getDisplaySourceInfo;
|
|
702
|
-
private getScopeGroup;
|
|
703
|
-
private isPackageSource;
|
|
704
|
-
private buildScopeGroups;
|
|
705
|
-
private formatScopeGroups;
|
|
706
|
-
/**
|
|
707
|
-
* Find metadata for a path, checking parent directories if exact match fails.
|
|
708
|
-
* Package manager stores metadata for directories, but we display file paths.
|
|
709
|
-
*/
|
|
710
|
-
private findMetadata;
|
|
711
|
-
/**
|
|
712
|
-
* Format a path with its source/scope info from metadata.
|
|
713
|
-
*/
|
|
714
|
-
private formatPathWithSource;
|
|
715
|
-
/**
|
|
716
|
-
* Format resource diagnostics with nice collision display using metadata.
|
|
717
|
-
*/
|
|
718
|
-
private formatDiagnostics;
|
|
719
|
-
private showLoadedResources;
|
|
720
|
-
/**
|
|
721
|
-
* Initialize the extension system with TUI-based UI context.
|
|
722
|
-
*
|
|
723
|
-
* PURPOSE:
|
|
724
|
-
* Set up extensions with UI capabilities. Creates ExtensionUIContext for
|
|
725
|
-
* extensions to use for dialogs, widgets, status messages, etc.
|
|
726
|
-
* Binds command context actions, error handlers, and shutdown handler.
|
|
727
|
-
*
|
|
728
|
-
* PROCESS:
|
|
729
|
-
* 1. If no extension runner: show loaded resources and return
|
|
730
|
-
* 2. Create ExtensionUIContext with:
|
|
731
|
-
* a. Dialog methods (select, confirm, input, notify)
|
|
732
|
-
* b. Status/title setters
|
|
733
|
-
* c. Widget and footer/header setters
|
|
734
|
-
* d. Editor interaction methods
|
|
735
|
-
* e. Theme access and switching
|
|
736
|
-
* 3. Call session.bindExtensions() with:
|
|
737
|
-
* a. uiContext - for TUI dialogs
|
|
738
|
-
* b. commandContextActions - for /fork, /tree, /new actions
|
|
739
|
-
* c. shutdownHandler - called when extension wants to exit
|
|
740
|
-
* d. Error handlers - for extension and hook errors
|
|
741
|
-
* 4. Set up extension shortcuts (keyboard bindings from extensions)
|
|
742
|
-
* 5. Show loaded resources (extensions, skills, prompts, themes)
|
|
743
|
-
*
|
|
744
|
-
* EXTENSION CAPABILITIES:
|
|
745
|
-
* - Show dialogs (selectors, confirmations, inputs)
|
|
746
|
-
* - Display persistent widgets above/below editor
|
|
747
|
-
* - Set custom footer and header
|
|
748
|
-
* - Customize editor component
|
|
749
|
-
* - Register keyboard shortcuts
|
|
750
|
-
* - Request shutdown
|
|
751
|
-
* - Access theme system
|
|
752
|
-
*
|
|
753
|
-
* COMMAND CONTEXT ACTIONS:
|
|
754
|
-
* - waitForIdle(): Wait until agent is idle
|
|
755
|
-
* - newSession(): Start a new session
|
|
756
|
-
* - fork(): Create branch from previous message
|
|
757
|
-
* - navigateTree(): Switch to different point in tree
|
|
758
|
-
*
|
|
759
|
-
* PARAMETERS:
|
|
760
|
-
* None
|
|
761
|
-
*
|
|
762
|
-
* RETURNS:
|
|
763
|
-
* Promise<void> - completes when extensions are initialized
|
|
764
|
-
*
|
|
765
|
-
* STATE CHANGES:
|
|
766
|
-
* - Binds extensions to session
|
|
767
|
-
* - Sets up shortcuts on defaultEditor
|
|
768
|
-
* - Displays loaded resources in chat
|
|
769
|
-
*
|
|
770
|
-
* NOTES:
|
|
771
|
-
* - Called from init() after TUI is started
|
|
772
|
-
* - Extensions can't affect UI until this completes
|
|
773
|
-
* - Error/hook errors displayed but don't stop initialization
|
|
774
|
-
* - Resources shown only if verbose or not quietStartup
|
|
775
|
-
*
|
|
776
|
-
* SEE ALSO:
|
|
777
|
-
* - createExtensionUIContext() for UI API details
|
|
778
|
-
* - setupExtensionShortcuts() for keyboard bindings
|
|
779
|
-
*/
|
|
780
|
-
private initExtensions;
|
|
781
|
-
/**
|
|
782
|
-
* Get a registered tool definition by name (for custom rendering).
|
|
783
|
-
*/
|
|
784
|
-
private getRegisteredToolDefinition;
|
|
785
|
-
/**
|
|
786
|
-
* Set up keyboard shortcuts registered by extensions.
|
|
787
|
-
*/
|
|
788
|
-
private setupExtensionShortcuts;
|
|
789
|
-
/**
|
|
790
|
-
* Set extension status text in the footer.
|
|
791
|
-
*/
|
|
792
|
-
private setExtensionStatus;
|
|
793
|
-
/**
|
|
794
|
-
* Set an extension widget (string array or custom component).
|
|
795
|
-
*/
|
|
796
|
-
private setExtensionWidget;
|
|
797
|
-
private clearExtensionWidgets;
|
|
798
|
-
private resetExtensionUI;
|
|
799
|
-
private static readonly MAX_WIDGET_LINES;
|
|
800
|
-
/**
|
|
801
|
-
* Render all extension widgets to the widget container.
|
|
802
|
-
*/
|
|
803
|
-
private renderWidgets;
|
|
804
|
-
private renderWidgetContainer;
|
|
805
|
-
/**
|
|
806
|
-
* Set a custom footer component, or restore the built-in footer.
|
|
807
|
-
*/
|
|
808
|
-
private setExtensionFooter;
|
|
809
|
-
/**
|
|
810
|
-
* Set a custom header component, or restore the built-in header.
|
|
811
|
-
*/
|
|
812
|
-
private setExtensionHeader;
|
|
813
|
-
/**
|
|
814
|
-
* Create the ExtensionUIContext for extensions.
|
|
815
|
-
*/
|
|
816
|
-
private createExtensionUIContext;
|
|
817
|
-
/**
|
|
818
|
-
* Show a selector for extensions.
|
|
819
|
-
*/
|
|
820
|
-
private showExtensionSelector;
|
|
821
|
-
/**
|
|
822
|
-
* Hide the extension selector.
|
|
823
|
-
*/
|
|
824
|
-
private hideExtensionSelector;
|
|
825
|
-
/**
|
|
826
|
-
* Show a confirmation dialog for extensions.
|
|
827
|
-
*/
|
|
828
|
-
private showExtensionConfirm;
|
|
829
|
-
/**
|
|
830
|
-
* Show a text input for extensions.
|
|
831
|
-
*/
|
|
832
|
-
private showExtensionInput;
|
|
833
|
-
/**
|
|
834
|
-
* Hide the extension input.
|
|
835
|
-
*/
|
|
836
|
-
private hideExtensionInput;
|
|
837
|
-
/**
|
|
838
|
-
* Show a multi-line editor for extensions (with Ctrl+G support).
|
|
839
|
-
*/
|
|
840
|
-
private showExtensionEditor;
|
|
841
|
-
/**
|
|
842
|
-
* Hide the extension editor.
|
|
843
|
-
*/
|
|
844
|
-
private hideExtensionEditor;
|
|
845
|
-
/**
|
|
846
|
-
* Set a custom editor component from an extension.
|
|
847
|
-
* Pass undefined to restore the default editor.
|
|
848
|
-
*/
|
|
849
|
-
private setCustomEditorComponent;
|
|
850
|
-
/**
|
|
851
|
-
* Show a notification for extensions.
|
|
852
|
-
*/
|
|
853
|
-
private showExtensionNotify;
|
|
854
|
-
/** Show a custom component with keyboard focus. Overlay mode renders on top of existing content. */
|
|
855
|
-
private showExtensionCustom;
|
|
856
|
-
/**
|
|
857
|
-
* Show an extension error in the UI.
|
|
858
|
-
*/
|
|
859
|
-
private showExtensionError;
|
|
860
|
-
/**
|
|
861
|
-
* Show a hook error in the UI.
|
|
862
|
-
*/
|
|
863
|
-
private showHookError;
|
|
864
|
-
/**
|
|
865
|
-
* Set up keyboard event handlers for all key bindings.
|
|
866
|
-
*
|
|
867
|
-
* PURPOSE:
|
|
868
|
-
* Registers all keyboard shortcuts and special key handlers on the editor.
|
|
869
|
-
* Handles direct key events (Escape, Ctrl+D, etc.) and action dispatching
|
|
870
|
-
* for keybinding-mapped actions (clear, suspend, cycle models, etc.).
|
|
871
|
-
*
|
|
872
|
-
* KEY BINDINGS CONFIGURED:
|
|
873
|
-
*
|
|
874
|
-
* **Escape**:
|
|
875
|
-
* - If loading: restore queued messages and abort agent
|
|
876
|
-
* - Else if bash running: abort bash
|
|
877
|
-
* - Else if bash mode (!): clear input and exit bash mode
|
|
878
|
-
* - Else if editor has text: clear editor
|
|
879
|
-
* - Else double-escape with empty: open tree selector or fork selector
|
|
880
|
-
* (based on settings.doubleEscapeAction)
|
|
881
|
-
*
|
|
882
|
-
* **Ctrl+C** (mapped to "clear" action):
|
|
883
|
-
* - First press: clear editor
|
|
884
|
-
* - Second press within 500ms: exit application
|
|
885
|
-
*
|
|
886
|
-
* **Ctrl+D** (mapped via onCtrlD):
|
|
887
|
-
* - Only when editor is empty
|
|
888
|
-
* - Exit application immediately
|
|
889
|
-
*
|
|
890
|
-
* **Ctrl+Z** (mapped to "suspend" action):
|
|
891
|
-
* - Suspend terminal to background
|
|
892
|
-
* - Set up SIGCONT handler to restore TUI on resume
|
|
893
|
-
*
|
|
894
|
-
* **Ctrl+M** (mapped to "cycleThinkingLevel" action):
|
|
895
|
-
* - Cycle thinking level: off → low → medium → high → off
|
|
896
|
-
* - Update border color and footer
|
|
897
|
-
* - Show status message
|
|
898
|
-
*
|
|
899
|
-
* **Ctrl+N** (mapped to "cycleModelForward" action):
|
|
900
|
-
* - Cycle to next model in scope or registry
|
|
901
|
-
* - Update footer and border color
|
|
902
|
-
* - Show status with new model name
|
|
903
|
-
*
|
|
904
|
-
* **Ctrl+P** (mapped to "cycleModelBackward" action):
|
|
905
|
-
* - Cycle to previous model
|
|
906
|
-
*
|
|
907
|
-
* **Ctrl+L** (mapped to "selectModel" action):
|
|
908
|
-
* - Open model selector dialog
|
|
909
|
-
*
|
|
910
|
-
* **Ctrl+E** (mapped to "expandTools" action):
|
|
911
|
-
* - Toggle expansion state of all tool output components
|
|
912
|
-
* - Affects current and future tool displays
|
|
913
|
-
*
|
|
914
|
-
* **Ctrl+K** (mapped to "toggleThinking" action):
|
|
915
|
-
* - Toggle visibility of thinking blocks in all messages
|
|
916
|
-
* - Rebuild chat with updated visibility
|
|
917
|
-
*
|
|
918
|
-
* **Ctrl+X** (mapped to "externalEditor" action):
|
|
919
|
-
* - Open current editor content in $VISUAL or $EDITOR
|
|
920
|
-
* - Replace content on save
|
|
921
|
-
*
|
|
922
|
-
* **Alt+Enter** (mapped to "followUp" action):
|
|
923
|
-
* - If streaming: queue message to send after agent finishes
|
|
924
|
-
* - If idle: acts like regular Enter (trigger onSubmit)
|
|
925
|
-
*
|
|
926
|
-
* **Ctrl+J** (mapped to "dequeue" action):
|
|
927
|
-
* - Restore all queued messages back to editor
|
|
928
|
-
* - Show count of restored messages
|
|
929
|
-
*
|
|
930
|
-
* **Alt+Debug** (global on TUI, not editor):
|
|
931
|
-
* - Write debug log with terminal render state and agent messages
|
|
932
|
-
*
|
|
933
|
-
* **onChange**:
|
|
934
|
-
* - Track if text starts with ! to enter bash mode
|
|
935
|
-
* - Update editor border color (blue for bash, accent for thinking)
|
|
936
|
-
*
|
|
937
|
-
* **onPasteImage**:
|
|
938
|
-
* - Handle Ctrl+V clipboard image paste
|
|
939
|
-
* - Write to temp file, insert path in editor
|
|
940
|
-
*
|
|
941
|
-
* PARAMETERS:
|
|
942
|
-
* None - configures this.defaultEditor handlers
|
|
943
|
-
*
|
|
944
|
-
* RETURNS:
|
|
945
|
-
* void - side effects only
|
|
946
|
-
*
|
|
947
|
-
* STATE CHANGES:
|
|
948
|
-
* - Sets this.defaultEditor.onEscape, onSubmit, onChange, onCtrlD, onPasteImage
|
|
949
|
-
* - Sets this.defaultEditor action handlers (clear, suspend, etc.)
|
|
950
|
-
* - Sets this.ui.onDebug for global debug shortcut
|
|
951
|
-
*
|
|
952
|
-
* NOTES:
|
|
953
|
-
* - Handlers use this.editor (which may be custom from extension)
|
|
954
|
-
* - All handlers use updateEditorBorderColor() to reflect state
|
|
955
|
-
* - Extension shortcuts can override action handlers via registerShortcut()
|
|
956
|
-
* - Most handlers call updatePendingMessagesDisplay() to sync UI
|
|
957
|
-
*/
|
|
958
|
-
private setupKeyHandlers;
|
|
959
|
-
private handleClipboardImagePaste;
|
|
960
|
-
/**
|
|
961
|
-
* Set up the editor submit handler for user input.
|
|
962
|
-
*
|
|
963
|
-
* PURPOSE:
|
|
964
|
-
* Configures the editor's onSubmit callback to process user input.
|
|
965
|
-
* This is called when the user presses Enter in the editor.
|
|
966
|
-
* Handles command parsing, slash commands, bash execution, and message queuing.
|
|
967
|
-
*
|
|
968
|
-
* INPUT TYPES PROCESSED:
|
|
969
|
-
*
|
|
970
|
-
* **Slash Commands** (commands starting with /):
|
|
971
|
-
* - /settings: Open settings selector menu
|
|
972
|
-
* - /scoped-models: Open model scoping selector
|
|
973
|
-
* - /model [search]: Open model selector or find exact match
|
|
974
|
-
* - /export [path]: Export session to HTML file
|
|
975
|
-
* - /share: Share session as secret GitHub gist
|
|
976
|
-
* - /copy: Copy last agent message to clipboard
|
|
977
|
-
* - /name [name]: Set or display session name
|
|
978
|
-
* - /session: Show session info and stats (messages, tokens, cost)
|
|
979
|
-
* - /changelog: Show full changelog entries
|
|
980
|
-
* - /hotkeys: Show all keyboard shortcuts
|
|
981
|
-
* - /fork: Show fork selector (pick message to branch from)
|
|
982
|
-
* - /tree: Show tree selector (navigate session DAG)
|
|
983
|
-
* - /login: Open OAuth or API key login selector
|
|
984
|
-
* - /logout: Open logout selector for saved credentials
|
|
985
|
-
* - /new, /clear: Start a new session
|
|
986
|
-
* - /compact [instructions]: Manually compact context
|
|
987
|
-
* - /reload: Reload extensions, skills, prompts, themes
|
|
988
|
-
* - /resume: Show session selector to switch sessions
|
|
989
|
-
* - /quit, /exit: Exit the application
|
|
990
|
-
*
|
|
991
|
-
* **Bash Commands** (text starting with ! or !!):
|
|
992
|
-
* - !command: Execute bash command, include output in context
|
|
993
|
-
* - !!command: Execute bash command, exclude from context (use !!)
|
|
994
|
-
* - Shows BashExecutionComponent with real-time output
|
|
995
|
-
* - Can be queued during streaming (moved to chat on next submit)
|
|
996
|
-
*
|
|
997
|
-
* **Prompt Templates** (custom /name commands):
|
|
998
|
-
* - Registered template names become slash commands
|
|
999
|
-
* - Can have placeholders and argument completion
|
|
1000
|
-
* - Expanded and sent as regular messages
|
|
1001
|
-
*
|
|
1002
|
-
* **Extension Commands**:
|
|
1003
|
-
* - Custom commands registered by extensions
|
|
1004
|
-
* - Execute immediately even during streaming
|
|
1005
|
-
* - Can provide argument completion
|
|
1006
|
-
*
|
|
1007
|
-
* **Regular Messages**:
|
|
1008
|
-
* - If streaming: queue with streaming behavior (steer/followUp)
|
|
1009
|
-
* - "steer": interrupt immediately
|
|
1010
|
-
* - "followUp": wait until response finishes
|
|
1011
|
-
* - If compacting: queue in compactionQueuedMessages
|
|
1012
|
-
* - If idle: send immediately
|
|
1013
|
-
* - Can include @file references for context injection
|
|
1014
|
-
*
|
|
1015
|
-
* COMMAND PARSING:
|
|
1016
|
-
* 1. Trim whitespace
|
|
1017
|
-
* 2. Check if it's a slash command (/command or /command arg)
|
|
1018
|
-
* 3. Check if it's a bash command (!cmd or !!cmd)
|
|
1019
|
-
* 4. Otherwise treat as regular message
|
|
1020
|
-
*
|
|
1021
|
-
* QUEUEING BEHAVIOR:
|
|
1022
|
-
* - During streaming: prompt() with streamingBehavior option
|
|
1023
|
-
* - During compaction: compactionQueuedMessages array
|
|
1024
|
-
* - Queued messages shown in pendingMessagesContainer
|
|
1025
|
-
* - Can be dequeued with Ctrl+J and edited
|
|
1026
|
-
*
|
|
1027
|
-
* PARAMETERS:
|
|
1028
|
-
* @param text - The submitted editor text (trimmed)
|
|
1029
|
-
*
|
|
1030
|
-
* RETURNS:
|
|
1031
|
-
* void - async, calls callbacks but doesn't return a value
|
|
1032
|
-
*
|
|
1033
|
-
* STATE CHANGES:
|
|
1034
|
-
* - Clears editor text on submit
|
|
1035
|
-
* - Adds to editor history (for Up arrow to recall)
|
|
1036
|
-
* - Updates pendingMessagesDisplay when queuing
|
|
1037
|
-
* - Moves pendingBashComponents to chat
|
|
1038
|
-
* - Calls session.prompt() or command handlers
|
|
1039
|
-
*
|
|
1040
|
-
* NOTES:
|
|
1041
|
-
* - Empty input is ignored
|
|
1042
|
-
* - All errors are caught and displayed via showError()
|
|
1043
|
-
* - Some commands suppress editor.addToHistory() (reload, etc.)
|
|
1044
|
-
* - Bash commands check if bash is already running and warn
|
|
1045
|
-
* - Must check isBashMode before allowing bash command execution
|
|
1046
|
-
*/
|
|
1047
|
-
private setupEditorSubmitHandler;
|
|
1048
|
-
/**
|
|
1049
|
-
* Subscribe to agent session events for UI updates.
|
|
1050
|
-
*
|
|
1051
|
-
* PURPOSE:
|
|
1052
|
-
* Sets up the event subscription to agent session. All agent activity (messages,
|
|
1053
|
-
* tool execution, compaction, retry, etc.) flows through here to update the display.
|
|
1054
|
-
* This is the bridge between the agent execution layer and the TUI rendering layer.
|
|
1055
|
-
*
|
|
1056
|
-
* PROCESS:
|
|
1057
|
-
* 1. Call session.subscribe() with an async event handler
|
|
1058
|
-
* 2. Save unsubscribe function for cleanup on shutdown
|
|
1059
|
-
* 3. Handler receives AgentSessionEvent objects and calls handleEvent()
|
|
1060
|
-
* 4. handleEvent() dispatches based on event type to update UI components
|
|
1061
|
-
*
|
|
1062
|
-
* EVENT TYPES HANDLED:
|
|
1063
|
-
* - `agent_start`: Show loading animation with working message
|
|
1064
|
-
* - `message_start`: Create new message component (user/assistant/custom)
|
|
1065
|
-
* - `message_update`: Stream content to message component, add tool calls
|
|
1066
|
-
* - `message_end`: Mark message complete, update tool results
|
|
1067
|
-
* - `tool_execution_start`: Create tool execution component in chat
|
|
1068
|
-
* - `tool_execution_update`: Stream partial tool results
|
|
1069
|
-
* - `tool_execution_end`: Mark tool complete with final result
|
|
1070
|
-
* - `agent_end`: Hide loading animation, check for shutdown request
|
|
1071
|
-
* - `auto_compaction_start`: Show compaction loader, allow escape to abort
|
|
1072
|
-
* - `auto_compaction_end`: Hide loader, rebuild chat, flush queued messages
|
|
1073
|
-
* - `auto_retry_start`: Show retry countdown loader
|
|
1074
|
-
* - `auto_retry_end`: Hide loader, show error only on failure
|
|
1075
|
-
*
|
|
1076
|
-
* PARAMETERS:
|
|
1077
|
-
* None - subscribes to this.session
|
|
1078
|
-
*
|
|
1079
|
-
* RETURNS:
|
|
1080
|
-
* void - side effects only (sets this.unsubscribe)
|
|
1081
|
-
*
|
|
1082
|
-
* NOTES:
|
|
1083
|
-
* - Called from init() after TUI is started
|
|
1084
|
-
* - Handles streaming content incrementally
|
|
1085
|
-
* - Must save unsubscribe function for cleanup in stop()
|
|
1086
|
-
* - Events are processed sequentially (not concurrent)
|
|
1087
|
-
*/
|
|
1088
|
-
private subscribeToAgent;
|
|
1089
|
-
/**
|
|
1090
|
-
* Handle a single agent session event and update the UI.
|
|
1091
|
-
*
|
|
1092
|
-
* PURPOSE:
|
|
1093
|
-
* Processes agent events and translates them into UI updates. This is the main
|
|
1094
|
-
* event dispatcher that receives all agent activity and renders it to the terminal.
|
|
1095
|
-
*
|
|
1096
|
-
* PROCESS FOR EACH EVENT TYPE:
|
|
1097
|
-
*
|
|
1098
|
-
* **agent_start**:
|
|
1099
|
-
* - Stop any existing loading animation
|
|
1100
|
-
* - Create new Loader component in statusContainer
|
|
1101
|
-
* - Apply pending working message if queued
|
|
1102
|
-
* - Request render
|
|
1103
|
-
*
|
|
1104
|
-
* **message_start**:
|
|
1105
|
-
* - User messages: render to chat immediately
|
|
1106
|
-
* - Assistant messages: create streaming component, add to chat
|
|
1107
|
-
* - Custom messages: render with extension renderer
|
|
1108
|
-
*
|
|
1109
|
-
* **message_update**:
|
|
1110
|
-
* - Stream new content to streamingComponent
|
|
1111
|
-
* - For each tool call: create or update ToolExecutionComponent
|
|
1112
|
-
* - Track tool components by ID for later result updates
|
|
1113
|
-
*
|
|
1114
|
-
* **message_end**:
|
|
1115
|
-
* - Mark streaming complete
|
|
1116
|
-
* - If aborted/error: set error message, mark all pending tools as error
|
|
1117
|
-
* - Otherwise: trigger diff computation for edit tools
|
|
1118
|
-
* - Clear streaming component reference
|
|
1119
|
-
*
|
|
1120
|
-
* **tool_execution_start/update/end**:
|
|
1121
|
-
* - Create or update ToolExecutionComponent in chat
|
|
1122
|
-
* - Stream partial results incrementally
|
|
1123
|
-
* - On completion: mark expanded state and remove from pending
|
|
1124
|
-
*
|
|
1125
|
-
* **agent_end**:
|
|
1126
|
-
* - Stop loading animation
|
|
1127
|
-
* - Clear streaming component from chat
|
|
1128
|
-
* - Clear pending tools
|
|
1129
|
-
* - Check for shutdown request (if extension called shutdown())
|
|
1130
|
-
*
|
|
1131
|
-
* **auto_compaction_start**:
|
|
1132
|
-
* - Show compaction loader with reason (overflow, etc.)
|
|
1133
|
-
* - Replace main escape handler to allow abort
|
|
1134
|
-
* - Editor stays active for queueing messages
|
|
1135
|
-
*
|
|
1136
|
-
* **auto_compaction_end**:
|
|
1137
|
-
* - Hide loader
|
|
1138
|
-
* - Rebuild chat to show compacted state
|
|
1139
|
-
* - Add compaction summary component
|
|
1140
|
-
* - Flush queued messages
|
|
1141
|
-
* - Handle completion, cancellation, or errors
|
|
1142
|
-
*
|
|
1143
|
-
* **auto_retry_start**:
|
|
1144
|
-
* - Show retry countdown (attempt N/M in delay seconds)
|
|
1145
|
-
* - Replace main escape handler to allow abort
|
|
1146
|
-
*
|
|
1147
|
-
* **auto_retry_end**:
|
|
1148
|
-
* - Hide loader
|
|
1149
|
-
* - Show error only on final failure (success shows normal response)
|
|
1150
|
-
*
|
|
1151
|
-
* PARAMETERS:
|
|
1152
|
-
* @param event - AgentSessionEvent (message, tool, compaction, retry, etc.)
|
|
1153
|
-
*
|
|
1154
|
-
* RETURNS:
|
|
1155
|
-
* Promise<void> - completes when UI update is done
|
|
1156
|
-
*
|
|
1157
|
-
* STATE CHANGES:
|
|
1158
|
-
* - Updates streamingComponent and streamingMessage
|
|
1159
|
-
* - Updates pendingTools map
|
|
1160
|
-
* - Updates loading animations (loadingAnimation, autoCompactionLoader, retryLoader)
|
|
1161
|
-
* - Updates UI via this.ui.requestRender()
|
|
1162
|
-
* - May call checkShutdownRequested() on agent_end
|
|
1163
|
-
*
|
|
1164
|
-
* NOTES:
|
|
1165
|
-
* - Initializes if not yet initialized (lazy init)
|
|
1166
|
-
* - Handles streaming content incremental rendering
|
|
1167
|
-
* - Events are sequential, not concurrent
|
|
1168
|
-
* - Tool components maintain expanded state across events
|
|
1169
|
-
*/
|
|
1170
|
-
private handleEvent;
|
|
1171
|
-
/** Extract text content from a user message */
|
|
1172
|
-
private getUserMessageText;
|
|
1173
|
-
/**
|
|
1174
|
-
* Show a status message in the chat.
|
|
1175
|
-
*
|
|
1176
|
-
* If multiple status messages are emitted back-to-back (without anything else being added to the chat),
|
|
1177
|
-
* we update the previous status line instead of appending new ones to avoid log spam.
|
|
1178
|
-
*/
|
|
1179
|
-
private showStatus;
|
|
1180
|
-
/**
|
|
1181
|
-
* Render a single message to the chat display.
|
|
1182
|
-
*
|
|
1183
|
-
* PURPOSE:
|
|
1184
|
-
* Converts an AgentMessage into one or more UI components and adds to chatContainer.
|
|
1185
|
-
* Handles all message types with appropriate rendering, tool display, and formatting.
|
|
1186
|
-
*
|
|
1187
|
-
* MESSAGE TYPES HANDLED:
|
|
1188
|
-
*
|
|
1189
|
-
* **user**:
|
|
1190
|
-
* - Extract text content (ignore images/other content)
|
|
1191
|
-
* - Check for skill blocks (```skill block with instructions)
|
|
1192
|
-
* - If skill block found:
|
|
1193
|
-
* a. Render SkillInvocationMessageComponent (collapsible)
|
|
1194
|
-
* b. Render user message separately if non-skill text exists
|
|
1195
|
-
* - Otherwise render UserMessageComponent with full text
|
|
1196
|
-
* - Optionally add to editor history for Up arrow recall
|
|
1197
|
-
*
|
|
1198
|
-
* **assistant**:
|
|
1199
|
-
* - Create AssistantMessageComponent with streaming content
|
|
1200
|
-
* - Respect hideThinkingBlock setting for visibility
|
|
1201
|
-
* - Tool calls are handled separately in message_update event
|
|
1202
|
-
*
|
|
1203
|
-
* **custom**:
|
|
1204
|
-
* - Check message.display flag (if false, skip rendering)
|
|
1205
|
-
* - Use extension message renderer if available
|
|
1206
|
-
* - Render as CustomMessageComponent with markdown theme
|
|
1207
|
-
*
|
|
1208
|
-
* **toolResult**:
|
|
1209
|
-
* - Rendered inline with tool calls (not standalone)
|
|
1210
|
-
* - Handled during renderSessionContext() matching with tool calls
|
|
1211
|
-
*
|
|
1212
|
-
* **bashExecution**:
|
|
1213
|
-
* - Create BashExecutionComponent
|
|
1214
|
-
* - Show command and real-time output
|
|
1215
|
-
* - Mark complete with exit code and optional truncation info
|
|
1216
|
-
*
|
|
1217
|
-
* **compactionSummary**:
|
|
1218
|
-
* - Show how many tokens were saved during compaction
|
|
1219
|
-
* - Display summary of what was compacted
|
|
1220
|
-
* - Component respects toolOutputExpanded setting
|
|
1221
|
-
*
|
|
1222
|
-
* **branchSummary**:
|
|
1223
|
-
* - Show branch point with label
|
|
1224
|
-
* - Display custom instructions for navigation
|
|
1225
|
-
* - Component respects toolOutputExpanded setting
|
|
1226
|
-
*
|
|
1227
|
-
* PARAMETERS:
|
|
1228
|
-
* @param message - AgentMessage to render (any role type)
|
|
1229
|
-
* @param options.populateHistory - Add user text to editor history (default: false)
|
|
1230
|
-
*
|
|
1231
|
-
* RETURNS:
|
|
1232
|
-
* void - side effects only (adds components to chatContainer)
|
|
1233
|
-
*
|
|
1234
|
-
* STATE CHANGES:
|
|
1235
|
-
* - Adds components to chatContainer
|
|
1236
|
-
* - May update editor history
|
|
1237
|
-
* - Updates pendingTools map (indirectly in renderSessionContext)
|
|
1238
|
-
*
|
|
1239
|
-
* NOTES:
|
|
1240
|
-
* - Uses getMarkdownThemeWithSettings() for consistent rendering
|
|
1241
|
-
* - Respects current display settings (hideThinkingBlock, showImages, etc.)
|
|
1242
|
-
* - Tool calls are created separately during message_update event
|
|
1243
|
-
* - Skill blocks use parseSkillBlock() to extract instructions
|
|
1244
|
-
* - Images in messages are handled by markdown renderer
|
|
1245
|
-
* - Does NOT call ui.requestRender() (caller does)
|
|
1246
|
-
*
|
|
1247
|
-
* SEE ALSO:
|
|
1248
|
-
* - renderSessionContext() which calls this for all messages
|
|
1249
|
-
* - handleEvent() which creates components during streaming
|
|
1250
|
-
*/
|
|
1251
|
-
private addMessageToChat;
|
|
1252
|
-
/**
|
|
1253
|
-
* Render a complete session context (all messages) to the chat display.
|
|
1254
|
-
*
|
|
1255
|
-
* PURPOSE:
|
|
1256
|
-
* Renders all aligned messages from a SessionContext to the chat display.
|
|
1257
|
-
* Handles message-to-tool-result matching and streaming state management.
|
|
1258
|
-
* Used during initial load, after compaction, and during rebuilds.
|
|
1259
|
-
*
|
|
1260
|
-
* PROCESS:
|
|
1261
|
-
* 1. Clear pendingTools map (reset tracking)
|
|
1262
|
-
* 2. Iterate through all messages in context:
|
|
1263
|
-
* - Assistant messages: render message + create tool components for each tool call
|
|
1264
|
-
* - Tool result messages: match to tool component, update result, remove from pending
|
|
1265
|
-
* - Other messages: render via addMessageToChat()
|
|
1266
|
-
* 3. Final clear of pendingTools (shouldn't have any left)
|
|
1267
|
-
* 4. Call ui.requestRender() to display changes
|
|
1268
|
-
*
|
|
1269
|
-
* TOOL CALL/RESULT MATCHING:
|
|
1270
|
-
* Tool calls and results are matched by ID:
|
|
1271
|
-
* 1. When rendering assistant message, create ToolExecutionComponent for each tool call
|
|
1272
|
-
* 2. Store component in pendingTools[toolCallId]
|
|
1273
|
-
* 3. When rendering tool result: look up component, update it, remove from pending
|
|
1274
|
-
* 4. If tool errored/aborted: mark component as error, don't add to pending
|
|
1275
|
-
*
|
|
1276
|
-
* PARAMETERS:
|
|
1277
|
-
* @param sessionContext - SessionContext from sessionManager.buildSessionContext()
|
|
1278
|
-
* @param options.updateFooter - Call footer.invalidate() and updateEditorBorderColor() (default: false)
|
|
1279
|
-
* @param options.populateHistory - Add user message text to editor history (default: false)
|
|
1280
|
-
*
|
|
1281
|
-
* RETURNS:
|
|
1282
|
-
* void - side effects only
|
|
1283
|
-
*
|
|
1284
|
-
* STATE CHANGES:
|
|
1285
|
-
* - Clears and repopulates chatContainer
|
|
1286
|
-
* - Updates pendingTools map (should be empty after completion)
|
|
1287
|
-
* - May call footer.invalidate() if updateFooter is true
|
|
1288
|
-
* - Calls ui.requestRender()
|
|
1289
|
-
*
|
|
1290
|
-
* NOTES:
|
|
1291
|
-
* - Used internally by renderInitialMessages() and rebuildChatFromMessages()
|
|
1292
|
-
* - All messages must be aligned (via sessionManager.buildSessionContext())
|
|
1293
|
-
* - Tool calls/results must already be matched and in correct order
|
|
1294
|
-
* - Error state is preserved from messages (stopReason, errorMessage)
|
|
1295
|
-
* - Tool components track expanded state (respects this.toolOutputExpanded)
|
|
1296
|
-
*
|
|
1297
|
-
* SEE ALSO:
|
|
1298
|
-
* - addMessageToChat() for individual message rendering
|
|
1299
|
-
* - handleEvent() for streaming message handling
|
|
1300
|
-
*/
|
|
1301
|
-
private renderSessionContext;
|
|
1302
|
-
/**
|
|
1303
|
-
* Render all session messages to the chat display.
|
|
1304
|
-
*
|
|
1305
|
-
* PURPOSE:
|
|
1306
|
-
* Displays all messages from the current session context in the chat area.
|
|
1307
|
-
* Used when initializing the UI, resuming a session, or after compaction.
|
|
1308
|
-
* Handles special message types: assistant, user, tool calls/results, compaction, branches.
|
|
1309
|
-
*
|
|
1310
|
-
* PROCESS:
|
|
1311
|
-
* 1. Get aligned session messages from sessionManager.buildSessionContext()
|
|
1312
|
-
* 2. Call renderSessionContext() to render all messages
|
|
1313
|
-
* 3. Show compaction count if session was compacted (0+ times)
|
|
1314
|
-
* 4. Update footer state (model, tokens, etc.)
|
|
1315
|
-
* 5. Populate editor history with user messages for Up arrow
|
|
1316
|
-
*
|
|
1317
|
-
* MESSAGE TYPES RENDERED:
|
|
1318
|
-
* - User messages: with text content and optional skill blocks
|
|
1319
|
-
* - Assistant messages: with streaming content, thinking blocks, tool calls
|
|
1320
|
-
* - Tool calls: inline with ToolExecutionComponent showing args and results
|
|
1321
|
-
* - Tool results: rendered within tool components (not standalone)
|
|
1322
|
-
* - Bash execution: with command and output
|
|
1323
|
-
* - Compaction summary: shows how many tokens were saved
|
|
1324
|
-
* - Branch summary: shows custom branch label/instructions
|
|
1325
|
-
* - Custom messages: rendered via extension message renderer
|
|
1326
|
-
*
|
|
1327
|
-
* PARAMETERS:
|
|
1328
|
-
* None - uses this.session and this.sessionManager
|
|
1329
|
-
*
|
|
1330
|
-
* RETURNS:
|
|
1331
|
-
* void - side effects only (adds components to chatContainer)
|
|
1332
|
-
*
|
|
1333
|
-
* STATE CHANGES:
|
|
1334
|
-
* - Populates chatContainer with all message components
|
|
1335
|
-
* - Populates editor history
|
|
1336
|
-
* - Updates footer.invalidate()
|
|
1337
|
-
* - Updates pendingTools map for tracking tool components
|
|
1338
|
-
* - Clears previous chat display
|
|
1339
|
-
*
|
|
1340
|
-
* NOTES:
|
|
1341
|
-
* - Called from init() after UI setup
|
|
1342
|
-
* - Called from run() before entering interactive loop
|
|
1343
|
-
* - Called from resume/fork/tree navigation
|
|
1344
|
-
* - Rebuilds entire chat, clearing previous messages
|
|
1345
|
-
* - Compaction entries show as status messages
|
|
1346
|
-
* - Only shows compaction info if compaction was performed
|
|
1347
|
-
*
|
|
1348
|
-
* SEE ALSO:
|
|
1349
|
-
* - renderSessionContext() for detailed rendering logic
|
|
1350
|
-
* - addMessageToChat() for rendering individual messages
|
|
1351
|
-
*/
|
|
1352
|
-
renderInitialMessages(): void;
|
|
1353
|
-
getUserInput(): Promise<string>;
|
|
1354
|
-
/**
|
|
1355
|
-
* Rebuild chat display from scratch, clearing and re-rendering all messages.
|
|
1356
|
-
*
|
|
1357
|
-
* PURPOSE:
|
|
1358
|
-
* Clears the entire chat display and re-renders all messages from session context.
|
|
1359
|
-
* Used after toggling thinking block visibility, compaction completion, or theme changes.
|
|
1360
|
-
* Ensures the display matches the current session state and settings.
|
|
1361
|
-
*
|
|
1362
|
-
* PROCESS:
|
|
1363
|
-
* 1. Clear chatContainer (remove all rendered components)
|
|
1364
|
-
* 2. Get fresh session context from sessionManager
|
|
1365
|
-
* 3. Call renderSessionContext() to re-render all messages
|
|
1366
|
-
* 4. All messages respect current settings (hideThinkingBlock, showImages, etc.)
|
|
1367
|
-
*
|
|
1368
|
-
* PARAMETERS:
|
|
1369
|
-
* None - uses this.session and this.settingsManager
|
|
1370
|
-
*
|
|
1371
|
-
* RETURNS:
|
|
1372
|
-
* void - side effects only
|
|
1373
|
-
*
|
|
1374
|
-
* STATE CHANGES:
|
|
1375
|
-
* - Clears and repopulates chatContainer
|
|
1376
|
-
* - Resets pendingTools map
|
|
1377
|
-
* - Updates streaming/non-streaming component visibility
|
|
1378
|
-
* - Respects current display settings
|
|
1379
|
-
*
|
|
1380
|
-
* NOTES:
|
|
1381
|
-
* - Much faster than renderInitialMessages() (no footer update or history)
|
|
1382
|
-
* - Used internally by toggleThinkingBlockVisibility()
|
|
1383
|
-
* - Used after compaction to show new state
|
|
1384
|
-
* - Does NOT scroll to top (chat scrolls naturally)
|
|
1385
|
-
* - Triggers UI render request in renderSessionContext()
|
|
1386
|
-
*
|
|
1387
|
-
* SEE ALSO:
|
|
1388
|
-
* - renderInitialMessages() for full initialization with footer/history
|
|
1389
|
-
* - toggleThinkingBlockVisibility() which calls this
|
|
1390
|
-
*/
|
|
1391
|
-
private rebuildChatFromMessages;
|
|
1392
|
-
private handleCtrlC;
|
|
1393
|
-
private handleCtrlD;
|
|
1394
|
-
/**
|
|
1395
|
-
* Gracefully shutdown the interactive mode and exit.
|
|
1396
|
-
*
|
|
1397
|
-
* PURPOSE:
|
|
1398
|
-
* Clean shutdown sequence. Gives extensions opportunity to clean up,
|
|
1399
|
-
* waits for pending renders, then exits the process.
|
|
1400
|
-
*
|
|
1401
|
-
* PROCESS:
|
|
1402
|
-
* 1. Check if already shutting down (prevent double shutdown)
|
|
1403
|
-
* 2. Emit session_shutdown event to extensions
|
|
1404
|
-
* - Extensions can clean up resources, save state, etc.
|
|
1405
|
-
* - Waits for handlers to complete
|
|
1406
|
-
* 3. Wait one tick for pending renders to complete
|
|
1407
|
-
* 4. Call stop() to clean up UI resources:
|
|
1408
|
-
* a. Stop loading animation
|
|
1409
|
-
* b. Dispose footer
|
|
1410
|
-
* c. Unsubscribe from agent events
|
|
1411
|
-
* d. Stop TUI (restore terminal)
|
|
1412
|
-
* 5. Exit process with code 0
|
|
1413
|
-
*
|
|
1414
|
-
* TRIGGERS:
|
|
1415
|
-
* - User presses Ctrl+D (when editor empty)
|
|
1416
|
-
* - User presses Ctrl+C twice within 500ms
|
|
1417
|
-
* - User enters /quit or /exit
|
|
1418
|
-
* - Extension calls shutdown() via context
|
|
1419
|
-
*
|
|
1420
|
-
* PARAMETERS:
|
|
1421
|
-
* None
|
|
1422
|
-
*
|
|
1423
|
-
* RETURNS:
|
|
1424
|
-
* Promise<void> - never resolves (process.exit is called)
|
|
1425
|
-
*
|
|
1426
|
-
* NOTES:
|
|
1427
|
-
* - Sets this.isShuttingDown flag to prevent double-shutdown
|
|
1428
|
-
* - Emits session_shutdown event (not awaited if no handlers)
|
|
1429
|
-
* - Extensions can catch this event with .on("session_shutdown")
|
|
1430
|
-
* - Clean exits prevent terminal corruption
|
|
1431
|
-
* - TUI stop() restores cursor and clear screen
|
|
1432
|
-
*
|
|
1433
|
-
* SEE ALSO:
|
|
1434
|
-
* - stop() which does actual cleanup
|
|
1435
|
-
* - checkShutdownRequested() which triggers shutdown on agent_end
|
|
1436
|
-
*/
|
|
1437
|
-
private isShuttingDown;
|
|
1438
|
-
private shutdown;
|
|
1439
|
-
/**
|
|
1440
|
-
* Check if shutdown was requested and perform it if so.
|
|
1441
|
-
*
|
|
1442
|
-
* PURPOSE:
|
|
1443
|
-
* Called after agent completes (agent_end event) to check if an extension
|
|
1444
|
-
* has requested shutdown. Allows shutdown to be queued and executed cleanly
|
|
1445
|
-
* after current operation completes.
|
|
1446
|
-
*
|
|
1447
|
-
* PROCESS:
|
|
1448
|
-
* 1. Check this.shutdownRequested flag
|
|
1449
|
-
* 2. If false: return (no shutdown requested)
|
|
1450
|
-
* 3. If true: call shutdown()
|
|
1451
|
-
*
|
|
1452
|
-
* USAGE:
|
|
1453
|
-
* - Extensions call context.shutdown() to request shutdown
|
|
1454
|
-
* - Set this.shutdownRequested = true
|
|
1455
|
-
* - After agent finishes, agent_end event triggers this check
|
|
1456
|
-
* - Shutdown happens cleanly after current message completes
|
|
1457
|
-
*
|
|
1458
|
-
* PARAMETERS:
|
|
1459
|
-
* None
|
|
1460
|
-
*
|
|
1461
|
-
* RETURNS:
|
|
1462
|
-
* Promise<void> - never resolves (process.exit is called)
|
|
1463
|
-
*
|
|
1464
|
-
* NOTES:
|
|
1465
|
-
* - Called from handleEvent() on agent_end
|
|
1466
|
-
* - Defers shutdown until agent is idle
|
|
1467
|
-
* - Allows current streaming/compaction to complete
|
|
1468
|
-
* - Much cleaner than immediate exit
|
|
1469
|
-
*
|
|
1470
|
-
* SEE ALSO:
|
|
1471
|
-
* - shutdown() which does the actual cleanup
|
|
1472
|
-
* - handleEvent() which calls this on agent_end
|
|
1473
|
-
*/
|
|
1474
|
-
private checkShutdownRequested;
|
|
1475
|
-
private handleCtrlZ;
|
|
1476
|
-
private handleFollowUp;
|
|
1477
|
-
private handleDequeue;
|
|
1478
|
-
private updateEditorBorderColor;
|
|
1479
|
-
private cycleThinkingLevel;
|
|
1480
|
-
private cycleModel;
|
|
1481
|
-
private toggleToolOutputExpansion;
|
|
1482
|
-
private toggleThinkingBlockVisibility;
|
|
1483
|
-
private openExternalEditor;
|
|
1484
|
-
/**
|
|
1485
|
-
* Clear the editor and request re-render.
|
|
1486
|
-
*
|
|
1487
|
-
* PURPOSE:
|
|
1488
|
-
* Empties the editor text area. Used when user presses Escape with text.
|
|
1489
|
-
*/
|
|
1490
|
-
clearEditor(): void;
|
|
1491
|
-
/**
|
|
1492
|
-
* Show an error message in the chat.
|
|
1493
|
-
*
|
|
1494
|
-
* PURPOSE:
|
|
1495
|
-
* Display an error message to the user. Used for command failures,
|
|
1496
|
-
* parsing errors, and unexpected exceptions.
|
|
1497
|
-
*
|
|
1498
|
-
* PARAMETERS:
|
|
1499
|
-
* @param errorMessage - The error message text (without "Error:" prefix)
|
|
1500
|
-
*
|
|
1501
|
-
* RETURNS:
|
|
1502
|
-
* void - side effects only
|
|
1503
|
-
*
|
|
1504
|
-
* FORMATTING:
|
|
1505
|
-
* - Adds 1-line spacer before message
|
|
1506
|
-
* - Prefixes with "Error: "
|
|
1507
|
-
* - Uses error color from theme
|
|
1508
|
-
* - Adds to bottom of chat
|
|
1509
|
-
*
|
|
1510
|
-
* NOTES:
|
|
1511
|
-
* - Auto-calls ui.requestRender()
|
|
1512
|
-
* - Should be used for all errors displayed to user
|
|
1513
|
-
* - Does not throw (safe to use in error handlers)
|
|
1514
|
-
*/
|
|
1515
|
-
showError(errorMessage: string): void;
|
|
1516
|
-
/**
|
|
1517
|
-
* Show a warning message in the chat.
|
|
1518
|
-
*
|
|
1519
|
-
* PURPOSE:
|
|
1520
|
-
* Display a warning message to the user. Used for non-fatal issues,
|
|
1521
|
-
* deprecated features, and important notifications.
|
|
1522
|
-
*
|
|
1523
|
-
* PARAMETERS:
|
|
1524
|
-
* @param warningMessage - The warning message text (without "Warning:" prefix)
|
|
1525
|
-
*
|
|
1526
|
-
* RETURNS:
|
|
1527
|
-
* void - side effects only
|
|
1528
|
-
*
|
|
1529
|
-
* FORMATTING:
|
|
1530
|
-
* - Adds 1-line spacer before message
|
|
1531
|
-
* - Prefixes with "Warning: "
|
|
1532
|
-
* - Uses warning color from theme
|
|
1533
|
-
* - Adds to bottom of chat
|
|
1534
|
-
*
|
|
1535
|
-
* NOTES:
|
|
1536
|
-
* - Auto-calls ui.requestRender()
|
|
1537
|
-
* - Similar to showError() but with different severity
|
|
1538
|
-
* - Used for resource loading issues, model fallbacks, etc.
|
|
1539
|
-
*
|
|
1540
|
-
* SEE ALSO:
|
|
1541
|
-
* - showError() for fatal errors
|
|
1542
|
-
* - showStatus() for informational messages
|
|
1543
|
-
*/
|
|
1544
|
-
showWarning(warningMessage: string): void;
|
|
1545
|
-
showNewVersionNotification(newVersion: string): void;
|
|
1546
|
-
/**
|
|
1547
|
-
* Get all queued messages (read-only).
|
|
1548
|
-
* Combines session queue and compaction queue.
|
|
1549
|
-
*/
|
|
1550
|
-
private getAllQueuedMessages;
|
|
1551
|
-
/**
|
|
1552
|
-
* Clear all queued messages and return their contents.
|
|
1553
|
-
* Clears both session queue and compaction queue.
|
|
1554
|
-
*/
|
|
1555
|
-
private clearAllQueues;
|
|
1556
|
-
private updatePendingMessagesDisplay;
|
|
1557
|
-
private restoreQueuedMessagesToEditor;
|
|
1558
|
-
private queueCompactionMessage;
|
|
1559
|
-
private isExtensionCommand;
|
|
1560
|
-
private flushCompactionQueue;
|
|
1561
|
-
/** Move pending bash components from pending area to chat */
|
|
1562
|
-
private flushPendingBashComponents;
|
|
1563
|
-
/**
|
|
1564
|
-
* Show a selector component, replacing the editor temporarily.
|
|
1565
|
-
*
|
|
1566
|
-
* PURPOSE:
|
|
1567
|
-
* Generic helper to display selector dialogs (/settings, /model, /tree, etc.).
|
|
1568
|
-
* Manages switching between the editor and selector, and restoring the editor.
|
|
1569
|
-
*
|
|
1570
|
-
* PROCESS:
|
|
1571
|
-
* 1. Create done callback that:
|
|
1572
|
-
* a. Clears editorContainer
|
|
1573
|
-
* b. Restores this.editor as the focused component
|
|
1574
|
-
* c. Requests UI render
|
|
1575
|
-
* 2. Call factory(done) to create the selector component
|
|
1576
|
-
* 3. Factory returns { component, focus } where focus is initial focus target
|
|
1577
|
-
* 4. Clear editorContainer and add selector component
|
|
1578
|
-
* 5. Set focus to the focus component (usually the selector itself)
|
|
1579
|
-
* 6. Request UI render
|
|
1580
|
-
* 7. Selector calls done() when user makes selection or presses escape
|
|
1581
|
-
*
|
|
1582
|
-
* SELECTOR TYPES:
|
|
1583
|
-
* - SettingsSelectorComponent: /settings - change settings
|
|
1584
|
-
* - ModelSelectorComponent: /model - select a model
|
|
1585
|
-
* - UserMessageSelectorComponent: /fork - pick message to branch from
|
|
1586
|
-
* - TreeSelectorComponent: /tree - navigate session DAG
|
|
1587
|
-
* - SessionSelectorComponent: /resume - switch to different session
|
|
1588
|
-
* - OAuthSelectorComponent: /login or /logout - manage credentials
|
|
1589
|
-
* - ExtensionSelectorComponent: custom dialogs from extensions
|
|
1590
|
-
*
|
|
1591
|
-
* PARAMETERS:
|
|
1592
|
-
* @param create - Factory function that:
|
|
1593
|
-
* - Receives done() callback (selector calls when finished)
|
|
1594
|
-
* - Returns { component, focus } where component is the selector UI
|
|
1595
|
-
* - focus is the component to set focus to (keyboard input target)
|
|
1596
|
-
*
|
|
1597
|
-
* RETURNS:
|
|
1598
|
-
* void - done callback handles restoration
|
|
1599
|
-
*
|
|
1600
|
-
* STATE CHANGES:
|
|
1601
|
-
* - Temporarily replaces editor with selector in editorContainer
|
|
1602
|
-
* - Sets keyboard focus to selector
|
|
1603
|
-
* - On done: restores editor and focus
|
|
1604
|
-
*
|
|
1605
|
-
* NOTES:
|
|
1606
|
-
* - Editor content is preserved (not cleared) during selector
|
|
1607
|
-
* - Selector can be closed by pressing Escape
|
|
1608
|
-
* - Factory receives done callback for flexible completion handling
|
|
1609
|
-
* - Used by all major selectors (model, settings, fork, tree, etc.)
|
|
1610
|
-
*
|
|
1611
|
-
* SEE ALSO:
|
|
1612
|
-
* - showModelSelector() for model selection
|
|
1613
|
-
* - showSettingsSelector() for settings
|
|
1614
|
-
* - showUserMessageSelector() for forking
|
|
1615
|
-
* - showTreeSelector() for tree navigation
|
|
1616
|
-
*/
|
|
1617
|
-
private showSelector;
|
|
1618
|
-
private showSettingsSelector;
|
|
1619
|
-
/**
|
|
1620
|
-
* Handle the /model command - select or switch models.
|
|
1621
|
-
*
|
|
1622
|
-
* PURPOSE:
|
|
1623
|
-
* Process /model commands. If search term provided, find exact match.
|
|
1624
|
-
* Otherwise show interactive selector. Supports both quick switch and browse.
|
|
1625
|
-
*
|
|
1626
|
-
* PROCESS:
|
|
1627
|
-
* If searchTerm provided:
|
|
1628
|
-
* 1. Call findExactModelMatch(searchTerm)
|
|
1629
|
-
* 2. If found: switch to model, update footer/border, show status
|
|
1630
|
-
* 3. If not found: show selector with search term as initial filter
|
|
1631
|
-
*
|
|
1632
|
-
* If no searchTerm:
|
|
1633
|
-
* 1. Show model selector dialog
|
|
1634
|
-
* 2. User picks a model
|
|
1635
|
-
* 3. Model is switched
|
|
1636
|
-
*
|
|
1637
|
-
* SEARCH FORMAT:
|
|
1638
|
-
* - "model-id": Match by model ID only
|
|
1639
|
-
* - "provider/model-id": Match provider and model ID
|
|
1640
|
-
* - Case-insensitive matching
|
|
1641
|
-
*
|
|
1642
|
-
* PARAMETERS:
|
|
1643
|
-
* @param searchTerm - Optional model ID or "provider/model-id" to search for
|
|
1644
|
-
*
|
|
1645
|
-
* RETURNS:
|
|
1646
|
-
* Promise<void> - completes when model is selected
|
|
1647
|
-
*
|
|
1648
|
-
* STATE CHANGES:
|
|
1649
|
-
* - May call session.setModel() to switch
|
|
1650
|
-
* - Updates footer.invalidate()
|
|
1651
|
-
* - Updates editor border color (thinking level)
|
|
1652
|
-
* - Shows status message
|
|
1653
|
-
*
|
|
1654
|
-
* SEE ALSO:
|
|
1655
|
-
* - findExactModelMatch() for model lookup
|
|
1656
|
-
* - showModelSelector() for interactive selection
|
|
1657
|
-
*/
|
|
1658
|
-
private handleModelCommand;
|
|
1659
|
-
private findExactModelMatch;
|
|
1660
|
-
private getModelCandidates;
|
|
1661
|
-
/** Update the footer's available provider count from current model candidates */
|
|
1662
|
-
private updateAvailableProviderCount;
|
|
1663
|
-
private showModelSelector;
|
|
1664
|
-
private showModelsSelector;
|
|
1665
|
-
private showUserMessageSelector;
|
|
1666
|
-
private showTreeSelector;
|
|
1667
|
-
private showSessionSelector;
|
|
1668
|
-
private handleResumeSession;
|
|
1669
|
-
private showOAuthSelector;
|
|
1670
|
-
/**
|
|
1671
|
-
* Show account selector for providers with multiple accounts
|
|
1672
|
-
*/
|
|
1673
|
-
private showAccountSelector;
|
|
1674
|
-
/**
|
|
1675
|
-
* Prompt for account name, then proceed with OAuth or API key login
|
|
1676
|
-
*/
|
|
1677
|
-
private showNewAccountNameDialog;
|
|
1678
|
-
/**
|
|
1679
|
-
* OAuth login with a specific account name
|
|
1680
|
-
*/
|
|
1681
|
-
private showLoginDialogWithAccountName;
|
|
1682
|
-
/**
|
|
1683
|
-
* API key input with a specific account name
|
|
1684
|
-
*/
|
|
1685
|
-
private showApiKeyInputDialogWithName;
|
|
1686
|
-
private showLoginDialog;
|
|
1687
|
-
private showApiKeyDialog;
|
|
1688
|
-
/**
|
|
1689
|
-
* Show API key input dialog for adding a new account
|
|
1690
|
-
*/
|
|
1691
|
-
private showApiKeyInputDialog;
|
|
1692
|
-
private handleReloadCommand;
|
|
1693
|
-
/**
|
|
1694
|
-
* Handle MCP (Model Context Protocol) commands.
|
|
1695
|
-
*
|
|
1696
|
-
* Subcommands:
|
|
1697
|
-
* - "" (empty): Show MCP status
|
|
1698
|
-
* - "connect": Connect to MCP servers
|
|
1699
|
-
* - "disconnect": Disconnect from MCP servers
|
|
1700
|
-
* - "tools": List available MCP tools
|
|
1701
|
-
*/
|
|
1702
|
-
private handleMCPCommand;
|
|
1703
|
-
/**
|
|
1704
|
-
* Handle /memory commands for memory system management.
|
|
1705
|
-
* Sub-commands:
|
|
1706
|
-
* - "" / "status": Show memory status
|
|
1707
|
-
* - "on": Enable memory for current and future sessions
|
|
1708
|
-
* - "off": Disable memory for current and future sessions
|
|
1709
|
-
* - "setup <api-key>": Save OpenAI API key and enable memory
|
|
1710
|
-
* - "clear": Clear memory for current thread
|
|
1711
|
-
* - "working": Show working memory for current thread
|
|
1712
|
-
* - "tools": List memory tools
|
|
1713
|
-
*/
|
|
1714
|
-
private handleMemoryCommand;
|
|
1715
|
-
private handleExportCommand;
|
|
1716
|
-
private handleShareCommand;
|
|
1717
|
-
private handleCopyCommand;
|
|
1718
|
-
private handleNameCommand;
|
|
1719
|
-
private handleSessionCommand;
|
|
1720
|
-
private handleChangelogCommand;
|
|
1721
|
-
/**
|
|
1722
|
-
* Capitalize keybinding for display (e.g., "ctrl+c" -> "Ctrl+C").
|
|
1723
|
-
*/
|
|
1724
|
-
private capitalizeKey;
|
|
1725
|
-
/**
|
|
1726
|
-
* Get capitalized display string for an app keybinding action.
|
|
1727
|
-
*/
|
|
1728
|
-
private getAppKeyDisplay;
|
|
1729
|
-
/**
|
|
1730
|
-
* Get capitalized display string for an editor keybinding action.
|
|
1731
|
-
*/
|
|
1732
|
-
private getEditorKeyDisplay;
|
|
1733
|
-
private handleHotkeysCommand;
|
|
1734
|
-
private handleClearCommand;
|
|
1735
|
-
/**
|
|
1736
|
-
* Handle the /debug command - write diagnostic information to file.
|
|
1737
|
-
*
|
|
1738
|
-
* PURPOSE:
|
|
1739
|
-
* Generates a comprehensive debug log of the current terminal rendering state
|
|
1740
|
-
* and agent message history. Used for troubleshooting rendering issues or
|
|
1741
|
-
* unusual terminal behavior.
|
|
1742
|
-
*
|
|
1743
|
-
* PROCESS:
|
|
1744
|
-
* 1. Get current terminal dimensions (columns x rows)
|
|
1745
|
-
* 2. Call ui.render() to get all rendered lines at that width
|
|
1746
|
-
* 3. Calculate visible width of each line (accounting for ANSI codes)
|
|
1747
|
-
* 4. Collect all agent messages in JSONL format (one per line)
|
|
1748
|
-
* 5. Write everything to debug log file (~/.indusagi/debug.log or similar)
|
|
1749
|
-
* 6. Display success message with file path
|
|
1750
|
-
*
|
|
1751
|
-
* DEBUG LOG CONTENTS:
|
|
1752
|
-
* - Timestamp of debug generation
|
|
1753
|
-
* - Terminal dimensions (WxH)
|
|
1754
|
-
* - Total rendered lines
|
|
1755
|
-
* - All rendered lines with visible widths and ANSI-escaped content
|
|
1756
|
-
* - All agent messages in JSONL format (one message object per line)
|
|
1757
|
-
*
|
|
1758
|
-
* PARAMETERS:
|
|
1759
|
-
* None
|
|
1760
|
-
*
|
|
1761
|
-
* RETURNS:
|
|
1762
|
-
* void - side effects only (writes file, shows status)
|
|
1763
|
-
*
|
|
1764
|
-
* STATE CHANGES:
|
|
1765
|
-
* - Writes to disk (debug log file)
|
|
1766
|
-
* - Adds status message to chat display
|
|
1767
|
-
*
|
|
1768
|
-
* NOTES:
|
|
1769
|
-
* - File path: getDebugLogPath()
|
|
1770
|
-
* - Creates parent directories if needed
|
|
1771
|
-
* - Useful for reporting rendering bugs
|
|
1772
|
-
* - Shows actual ANSI codes (escaped as JSON strings)
|
|
1773
|
-
* - One message per line in JSONL section for easy parsing
|
|
1774
|
-
*/
|
|
1775
|
-
private handleDebugCommand;
|
|
1776
|
-
private handleArminSaysHi;
|
|
1777
|
-
/**
|
|
1778
|
-
* Handle bash command execution (! or !! prefix).
|
|
1779
|
-
*
|
|
1780
|
-
* PURPOSE:
|
|
1781
|
-
* Executes a shell command and displays the output in a BashExecutionComponent.
|
|
1782
|
-
* Supports including/excluding from context. Can be intercepted by extensions.
|
|
1783
|
-
*
|
|
1784
|
-
* PROCESS:
|
|
1785
|
-
* 1. Emit user_bash event to extensions (if loaded)
|
|
1786
|
-
* 2. If extension returns a result, use it (extension may intercept)
|
|
1787
|
-
* - Extensions can run custom operations or modify commands
|
|
1788
|
-
* 3. Otherwise execute bash command normally:
|
|
1789
|
-
* a. Create BashExecutionComponent (shows command)
|
|
1790
|
-
* b. If streaming: add to pendingMessagesContainer, queue for chat
|
|
1791
|
-
* c. If idle: add directly to chatContainer
|
|
1792
|
-
* 4. Stream output chunks to component in real-time
|
|
1793
|
-
* 5. Mark complete with exit code and truncation status
|
|
1794
|
-
* 6. Record result in session context
|
|
1795
|
-
*
|
|
1796
|
-
* CONTEXT HANDLING:
|
|
1797
|
-
* - excludeFromContext=false (!): Output included in context for agent
|
|
1798
|
-
* - excludeFromContext=true (!!): Output excluded from context
|
|
1799
|
-
* - Extensions can define custom "operations" to transform output
|
|
1800
|
-
*
|
|
1801
|
-
* PARAMETERS:
|
|
1802
|
-
* @param command - The bash command string (without ! or !! prefix)
|
|
1803
|
-
* @param excludeFromContext - If true, mark output as excluded (!! prefix)
|
|
1804
|
-
*
|
|
1805
|
-
* RETURNS:
|
|
1806
|
-
* Promise<void> - completes when command finishes
|
|
1807
|
-
*
|
|
1808
|
-
* STATE CHANGES:
|
|
1809
|
-
* - Creates BashExecutionComponent
|
|
1810
|
-
* - Adds to chatContainer or pendingMessagesContainer
|
|
1811
|
-
* - Adds to pendingBashComponents if queued
|
|
1812
|
-
* - Records bash result in session
|
|
1813
|
-
* - Updates ui on each output chunk
|
|
1814
|
-
*
|
|
1815
|
-
* ERROR HANDLING:
|
|
1816
|
-
* - Command failures caught and displayed as error message
|
|
1817
|
-
* - Bash execution may be aborted by user (Esc)
|
|
1818
|
-
* - Output may be truncated if too large
|
|
1819
|
-
* - Truncation info shown with link to full output file
|
|
1820
|
-
*
|
|
1821
|
-
* NOTES:
|
|
1822
|
-
* - User can check if bash is already running before executing
|
|
1823
|
-
* - Extension can provide custom operations (e.g., parsing specific formats)
|
|
1824
|
-
* - Output is streamed, so large outputs appear incrementally
|
|
1825
|
-
* - Bash components moved from pending to chat on next regular message
|
|
1826
|
-
* - Session.executeBash() handles actual execution and truncation
|
|
1827
|
-
*
|
|
1828
|
-
* SEE ALSO:
|
|
1829
|
-
* - session.executeBash() for actual command execution
|
|
1830
|
-
* - BashExecutionComponent for rendering
|
|
1831
|
-
*/
|
|
1832
|
-
private handleBashCommand;
|
|
1833
|
-
/**
|
|
1834
|
-
* Handle the /compact command - manually trigger context compaction.
|
|
1835
|
-
*
|
|
1836
|
-
* PURPOSE:
|
|
1837
|
-
* Allows user to manually compact the session context to reduce token usage.
|
|
1838
|
-
* Can include custom instructions to guide the compaction process.
|
|
1839
|
-
*
|
|
1840
|
-
* PROCESS:
|
|
1841
|
-
* 1. Count messages in session
|
|
1842
|
-
* 2. If less than 2 messages: show warning and return (nothing to compact)
|
|
1843
|
-
* 3. Otherwise call executeCompaction() with custom instructions
|
|
1844
|
-
*
|
|
1845
|
-
* PARAMETERS:
|
|
1846
|
-
* @param customInstructions - Optional custom instructions for compaction process
|
|
1847
|
-
*
|
|
1848
|
-
* RETURNS:
|
|
1849
|
-
* Promise<void> - completes when compaction is done
|
|
1850
|
-
*
|
|
1851
|
-
* NOTES:
|
|
1852
|
-
* - User can press Esc during compaction to abort
|
|
1853
|
-
* - Compaction may queue incoming messages
|
|
1854
|
-
* - Custom instructions merged with default compaction prompt
|
|
1855
|
-
*
|
|
1856
|
-
* SEE ALSO:
|
|
1857
|
-
* - executeCompaction() which does the actual work
|
|
1858
|
-
* - auto-compaction (happens automatically based on context size)
|
|
1859
|
-
*/
|
|
1860
|
-
private handleCompactCommand;
|
|
1861
|
-
/**
|
|
1862
|
-
* Execute context compaction (manual or automatic).
|
|
1863
|
-
*
|
|
1864
|
-
* PURPOSE:
|
|
1865
|
-
* Compacts the session context to reduce token usage by summarizing old messages.
|
|
1866
|
-
* Used both for manual /compact commands and automatic overflow-triggered compaction.
|
|
1867
|
-
*
|
|
1868
|
-
* PROCESS:
|
|
1869
|
-
* 1. Stop and clear any existing loading animation
|
|
1870
|
-
* 2. Replace escape handler to allow abort (Esc cancels compaction)
|
|
1871
|
-
* 3. Show "Compacting context..." loader with estimated time
|
|
1872
|
-
* 4. Call session.compact() with optional custom instructions
|
|
1873
|
-
* 5. On success:
|
|
1874
|
-
* a. Rebuild chat to show compacted state
|
|
1875
|
-
* b. Add CompactionSummaryMessageComponent showing tokens saved
|
|
1876
|
-
* c. Invalidate footer (update token counts)
|
|
1877
|
-
* 6. On abort/error:
|
|
1878
|
-
* a. Show error message
|
|
1879
|
-
* b. Chat state unchanged (compaction failed)
|
|
1880
|
-
* 7. Flush queued messages that arrived during compaction
|
|
1881
|
-
* 8. Restore original escape handler
|
|
1882
|
-
* 9. Clear loader
|
|
1883
|
-
*
|
|
1884
|
-
* CUSTOM INSTRUCTIONS:
|
|
1885
|
-
* - Optional guidance for compaction algorithm
|
|
1886
|
-
* - Examples: "focus on recent messages", "preserve code context", etc.
|
|
1887
|
-
* - Merged with default compaction system prompt
|
|
1888
|
-
*
|
|
1889
|
-
* AUTO vs MANUAL:
|
|
1890
|
-
* - isAuto=false (/compact command): shows "Compacting context..." label
|
|
1891
|
-
* - isAuto=true (automatic): shows "Auto-compacting..." label
|
|
1892
|
-
* - auto-compaction triggered by context overflow (token limit)
|
|
1893
|
-
*
|
|
1894
|
-
* QUEUED MESSAGES:
|
|
1895
|
-
* - Messages sent during compaction are queued in compactionQueuedMessages
|
|
1896
|
-
* - After compaction completes, queued messages are flushed
|
|
1897
|
-
* - First message becomes next prompt, rest queued as steer/followUp
|
|
1898
|
-
*
|
|
1899
|
-
* PARAMETERS:
|
|
1900
|
-
* @param customInstructions - Optional custom instructions for compaction
|
|
1901
|
-
* @param isAuto - If true, shows "Auto-compacting..." (default: false)
|
|
1902
|
-
*
|
|
1903
|
-
* RETURNS:
|
|
1904
|
-
* Promise<CompactionResult | undefined> - returns result or undefined on error/abort
|
|
1905
|
-
*
|
|
1906
|
-
* STATE CHANGES:
|
|
1907
|
-
* - Rebuilds chatContainer
|
|
1908
|
-
* - Updates footer
|
|
1909
|
-
* - Clears status container
|
|
1910
|
-
* - Restores escape handler
|
|
1911
|
-
* - Flushes compaction queue
|
|
1912
|
-
*
|
|
1913
|
-
* ERROR HANDLING:
|
|
1914
|
-
* - Compaction cancelled: shows "Compaction cancelled" error
|
|
1915
|
-
* - Compaction failed: shows detailed error message
|
|
1916
|
-
* - Messages queued during compaction are preserved and flushed
|
|
1917
|
-
*
|
|
1918
|
-
* NOTES:
|
|
1919
|
-
* - User can press Esc to abort
|
|
1920
|
-
* - Loader shows "Ctrl+C to cancel" hint
|
|
1921
|
-
* - Compaction happens asynchronously, UI stays responsive
|
|
1922
|
-
* - Very large contexts may take several seconds
|
|
1923
|
-
*
|
|
1924
|
-
* SEE ALSO:
|
|
1925
|
-
* - handleCompactCommand() for /compact processing
|
|
1926
|
-
* - auto-compaction in handleEvent() for automatic triggering
|
|
1927
|
-
*/
|
|
1928
|
-
private executeCompaction;
|
|
1929
|
-
stop(): void;
|
|
1930
|
-
}
|
|
1931
|
-
//# sourceMappingURL=interactive-mode.d.ts.map
|