@pentoshi/clai 2.0.62 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +262 -368
- package/dist/agent/classic-renderer.js +9 -1
- package/dist/agent/classic-renderer.js.map +1 -1
- package/dist/agent/context-manager.d.ts +5 -0
- package/dist/agent/context-manager.js +14 -2
- package/dist/agent/context-manager.js.map +1 -1
- package/dist/agent/events.d.ts +9 -1
- package/dist/agent/plan-tool.js +80 -8
- package/dist/agent/plan-tool.js.map +1 -1
- package/dist/agent/runner.js +261 -122
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/tool-call-parser.d.ts +20 -0
- package/dist/agent/tool-call-parser.js +186 -2
- package/dist/agent/tool-call-parser.js.map +1 -1
- package/dist/app/adapters/agent-event-adapter.d.ts +29 -0
- package/dist/app/adapters/agent-event-adapter.js +148 -0
- package/dist/app/adapters/agent-event-adapter.js.map +1 -0
- package/dist/app/adapters/current-agent-adapter.d.ts +7 -0
- package/dist/app/adapters/current-agent-adapter.js +27 -0
- package/dist/app/adapters/current-agent-adapter.js.map +1 -0
- package/dist/app/adapters/current-jobs-adapter.d.ts +4 -0
- package/dist/app/adapters/current-jobs-adapter.js +13 -0
- package/dist/app/adapters/current-jobs-adapter.js.map +1 -0
- package/dist/app/adapters/current-store-adapter.d.ts +3 -0
- package/dist/app/adapters/current-store-adapter.js +22 -0
- package/dist/app/adapters/current-store-adapter.js.map +1 -0
- package/dist/app/adapters/current-terminal-adapter.d.ts +9 -0
- package/dist/app/adapters/current-terminal-adapter.js +31 -0
- package/dist/app/adapters/current-terminal-adapter.js.map +1 -0
- package/dist/app/adapters/current-updates-adapter.d.ts +7 -0
- package/dist/app/adapters/current-updates-adapter.js +31 -0
- package/dist/app/adapters/current-updates-adapter.js.map +1 -0
- package/dist/app/adapters/in-memory-clipboard-adapter.d.ts +10 -0
- package/dist/app/adapters/in-memory-clipboard-adapter.js +20 -0
- package/dist/app/adapters/in-memory-clipboard-adapter.js.map +1 -0
- package/dist/app/commands/command.d.ts +24 -0
- package/dist/app/commands/command.js +4 -0
- package/dist/app/commands/command.js.map +1 -0
- package/dist/app/commands/registry.d.ts +45 -0
- package/dist/app/commands/registry.js +164 -0
- package/dist/app/commands/registry.js.map +1 -0
- package/dist/app/controllers/disposable.d.ts +15 -0
- package/dist/app/controllers/disposable.js +38 -0
- package/dist/app/controllers/disposable.js.map +1 -0
- package/dist/app/controllers/job-controller.d.ts +22 -0
- package/dist/app/controllers/job-controller.js +35 -0
- package/dist/app/controllers/job-controller.js.map +1 -0
- package/dist/app/controllers/plan-controller.d.ts +31 -0
- package/dist/app/controllers/plan-controller.js +69 -0
- package/dist/app/controllers/plan-controller.js.map +1 -0
- package/dist/app/controllers/session-controller.d.ts +167 -0
- package/dist/app/controllers/session-controller.js +467 -0
- package/dist/app/controllers/session-controller.js.map +1 -0
- package/dist/app/controllers/turn-controller.d.ts +52 -0
- package/dist/app/controllers/turn-controller.js +118 -0
- package/dist/app/controllers/turn-controller.js.map +1 -0
- package/dist/app/events/app-event.d.ts +122 -0
- package/dist/app/events/app-event.js +25 -0
- package/dist/app/events/app-event.js.map +1 -0
- package/dist/app/events/event-buffer.d.ts +51 -0
- package/dist/app/events/event-buffer.js +109 -0
- package/dist/app/events/event-buffer.js.map +1 -0
- package/dist/app/events/sequencer.d.ts +32 -0
- package/dist/app/events/sequencer.js +55 -0
- package/dist/app/events/sequencer.js.map +1 -0
- package/dist/app/ports/agent-port.d.ts +29 -0
- package/dist/app/ports/agent-port.js +2 -0
- package/dist/app/ports/agent-port.js.map +1 -0
- package/dist/app/ports/clipboard-port.d.ts +9 -0
- package/dist/app/ports/clipboard-port.js +2 -0
- package/dist/app/ports/clipboard-port.js.map +1 -0
- package/dist/app/ports/confirm-port.d.ts +17 -0
- package/dist/app/ports/confirm-port.js +2 -0
- package/dist/app/ports/confirm-port.js.map +1 -0
- package/dist/app/ports/jobs-port.d.ts +18 -0
- package/dist/app/ports/jobs-port.js +2 -0
- package/dist/app/ports/jobs-port.js.map +1 -0
- package/dist/app/ports/persistence-port.d.ts +21 -0
- package/dist/app/ports/persistence-port.js +2 -0
- package/dist/app/ports/persistence-port.js.map +1 -0
- package/dist/app/ports/secret-port.d.ts +12 -0
- package/dist/app/ports/secret-port.js +2 -0
- package/dist/app/ports/secret-port.js.map +1 -0
- package/dist/app/ports/terminal-port.d.ts +18 -0
- package/dist/app/ports/terminal-port.js +2 -0
- package/dist/app/ports/terminal-port.js.map +1 -0
- package/dist/app/ports/updates-port.d.ts +12 -0
- package/dist/app/ports/updates-port.js +2 -0
- package/dist/app/ports/updates-port.js.map +1 -0
- package/dist/commands/doctor.js +19 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/update.js +1 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/index.js +47 -12
- package/dist/index.js.map +1 -1
- package/dist/llm/router.js +4 -2
- package/dist/llm/router.js.map +1 -1
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.js +11 -8
- package/dist/prompts/index.js.map +1 -1
- package/dist/repl/slash-commands.js +1 -1
- package/dist/repl/slash-commands.js.map +1 -1
- package/dist/repl.js +35 -107
- package/dist/repl.js.map +1 -1
- package/dist/store/config.js +3 -1
- package/dist/store/config.js.map +1 -1
- package/dist/store/history.d.ts +26 -2
- package/dist/store/history.js +383 -72
- package/dist/store/history.js.map +1 -1
- package/dist/store/logs.js +3 -3
- package/dist/store/logs.js.map +1 -1
- package/dist/store/paths.d.ts +6 -0
- package/dist/store/paths.js +38 -0
- package/dist/store/paths.js.map +1 -0
- package/dist/store/plan.js +8 -5
- package/dist/store/plan.js.map +1 -1
- package/dist/tools/fs.d.ts +6 -0
- package/dist/tools/fs.js +56 -6
- package/dist/tools/fs.js.map +1 -1
- package/dist/tools/jobs.js +2 -2
- package/dist/tools/jobs.js.map +1 -1
- package/dist/tools/registry.js +189 -67
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/shell.js +2 -2
- package/dist/tools/shell.js.map +1 -1
- package/dist/tui/runtime.d.ts +19 -0
- package/dist/tui/runtime.js +92 -0
- package/dist/tui/runtime.js.map +1 -0
- package/dist/tui/state.js +22 -17
- package/dist/tui/state.js.map +1 -1
- package/dist/tui-v2/actions/action-id.d.ts +14 -0
- package/dist/tui-v2/actions/action-id.js +109 -0
- package/dist/tui-v2/actions/action-id.js.map +1 -0
- package/dist/tui-v2/actions/action-router.d.ts +18 -0
- package/dist/tui-v2/actions/action-router.js +62 -0
- package/dist/tui-v2/actions/action-router.js.map +1 -0
- package/dist/tui-v2/actions/chord-from-key.d.ts +26 -0
- package/dist/tui-v2/actions/chord-from-key.js +45 -0
- package/dist/tui-v2/actions/chord-from-key.js.map +1 -0
- package/dist/tui-v2/actions/keymap.d.ts +24 -0
- package/dist/tui-v2/actions/keymap.js +134 -0
- package/dist/tui-v2/actions/keymap.js.map +1 -0
- package/dist/tui-v2/app/App.d.ts +13 -0
- package/dist/tui-v2/app/App.js +332 -0
- package/dist/tui-v2/app/App.js.map +1 -0
- package/dist/tui-v2/app/command-handlers.d.ts +8 -0
- package/dist/tui-v2/app/command-handlers.js +66 -0
- package/dist/tui-v2/app/command-handlers.js.map +1 -0
- package/dist/tui-v2/app/commands/config-commands.d.ts +14 -0
- package/dist/tui-v2/app/commands/config-commands.js +161 -0
- package/dist/tui-v2/app/commands/config-commands.js.map +1 -0
- package/dist/tui-v2/app/commands/key-commands.d.ts +9 -0
- package/dist/tui-v2/app/commands/key-commands.js +263 -0
- package/dist/tui-v2/app/commands/key-commands.js.map +1 -0
- package/dist/tui-v2/app/commands/picker-commands.d.ts +24 -0
- package/dist/tui-v2/app/commands/picker-commands.js +423 -0
- package/dist/tui-v2/app/commands/picker-commands.js.map +1 -0
- package/dist/tui-v2/app/commands/session-commands.d.ts +19 -0
- package/dist/tui-v2/app/commands/session-commands.js +162 -0
- package/dist/tui-v2/app/commands/session-commands.js.map +1 -0
- package/dist/tui-v2/app/plan-lifecycle.d.ts +22 -0
- package/dist/tui-v2/app/plan-lifecycle.js +95 -0
- package/dist/tui-v2/app/plan-lifecycle.js.map +1 -0
- package/dist/tui-v2/app/providers.d.ts +17 -0
- package/dist/tui-v2/app/providers.js +32 -0
- package/dist/tui-v2/app/providers.js.map +1 -0
- package/dist/tui-v2/bootstrap/capabilities.d.ts +35 -0
- package/dist/tui-v2/bootstrap/capabilities.js +93 -0
- package/dist/tui-v2/bootstrap/capabilities.js.map +1 -0
- package/dist/tui-v2/bootstrap/composition-root.d.ts +85 -0
- package/dist/tui-v2/bootstrap/composition-root.js +131 -0
- package/dist/tui-v2/bootstrap/composition-root.js.map +1 -0
- package/dist/tui-v2/bootstrap/disable-native-selection.d.ts +11 -0
- package/dist/tui-v2/bootstrap/disable-native-selection.js +13 -0
- package/dist/tui-v2/bootstrap/disable-native-selection.js.map +1 -0
- package/dist/tui-v2/bootstrap/lifecycle.d.ts +62 -0
- package/dist/tui-v2/bootstrap/lifecycle.js +123 -0
- package/dist/tui-v2/bootstrap/lifecycle.js.map +1 -0
- package/dist/tui-v2/bootstrap/osc52-clipboard.d.ts +28 -0
- package/dist/tui-v2/bootstrap/osc52-clipboard.js +44 -0
- package/dist/tui-v2/bootstrap/osc52-clipboard.js.map +1 -0
- package/dist/tui-v2/bootstrap/overlay-ports.d.ts +12 -0
- package/dist/{tui/confirm.js → tui-v2/bootstrap/overlay-ports.js} +17 -25
- package/dist/tui-v2/bootstrap/overlay-ports.js.map +1 -0
- package/dist/tui-v2/bootstrap/pager-export.d.ts +24 -0
- package/dist/tui-v2/bootstrap/pager-export.js +87 -0
- package/dist/tui-v2/bootstrap/pager-export.js.map +1 -0
- package/dist/tui-v2/bootstrap/start-tui-v2.d.ts +15 -0
- package/dist/tui-v2/bootstrap/start-tui-v2.js +95 -0
- package/dist/tui-v2/bootstrap/start-tui-v2.js.map +1 -0
- package/dist/tui-v2/bootstrap/ui-selection.d.ts +30 -0
- package/dist/tui-v2/bootstrap/ui-selection.js +59 -0
- package/dist/tui-v2/bootstrap/ui-selection.js.map +1 -0
- package/dist/tui-v2/components/completion/completion-menu.d.ts +23 -0
- package/dist/tui-v2/components/completion/completion-menu.js +84 -0
- package/dist/tui-v2/components/completion/completion-menu.js.map +1 -0
- package/dist/tui-v2/components/jobs/jobs-panel.d.ts +16 -0
- package/dist/tui-v2/components/jobs/jobs-panel.js +92 -0
- package/dist/tui-v2/components/jobs/jobs-panel.js.map +1 -0
- package/dist/tui-v2/components/modal/confirm-modal.d.ts +20 -0
- package/dist/tui-v2/components/modal/confirm-modal.js +110 -0
- package/dist/tui-v2/components/modal/confirm-modal.js.map +1 -0
- package/dist/tui-v2/components/modal/prompt-actions-modal.d.ts +15 -0
- package/dist/tui-v2/components/modal/prompt-actions-modal.js +80 -0
- package/dist/tui-v2/components/modal/prompt-actions-modal.js.map +1 -0
- package/dist/tui-v2/components/modal/secret-modal.d.ts +18 -0
- package/dist/tui-v2/components/modal/secret-modal.js +50 -0
- package/dist/tui-v2/components/modal/secret-modal.js.map +1 -0
- package/dist/tui-v2/components/overlay/overlay-host.d.ts +26 -0
- package/dist/tui-v2/components/overlay/overlay-host.js +43 -0
- package/dist/tui-v2/components/overlay/overlay-host.js.map +1 -0
- package/dist/tui-v2/components/pager/pager.d.ts +20 -0
- package/dist/tui-v2/components/pager/pager.js +396 -0
- package/dist/tui-v2/components/pager/pager.js.map +1 -0
- package/dist/tui-v2/components/picker/picker.d.ts +17 -0
- package/dist/tui-v2/components/picker/picker.js +222 -0
- package/dist/tui-v2/components/picker/picker.js.map +1 -0
- package/dist/tui-v2/components/plan/plan-view.d.ts +20 -0
- package/dist/tui-v2/components/plan/plan-view.js +120 -0
- package/dist/tui-v2/components/plan/plan-view.js.map +1 -0
- package/dist/tui-v2/components/queue/queue-panel.d.ts +23 -0
- package/dist/tui-v2/components/queue/queue-panel.js +58 -0
- package/dist/tui-v2/components/queue/queue-panel.js.map +1 -0
- package/dist/tui-v2/components/status/status-line.d.ts +27 -0
- package/dist/tui-v2/components/status/status-line.js +167 -0
- package/dist/tui-v2/components/status/status-line.js.map +1 -0
- package/dist/tui-v2/components/toast/toast-host.d.ts +15 -0
- package/dist/tui-v2/components/toast/toast-host.js +48 -0
- package/dist/tui-v2/components/toast/toast-host.js.map +1 -0
- package/dist/tui-v2/components/transcript/assistant-message.d.ts +20 -0
- package/dist/tui-v2/components/transcript/assistant-message.js +41 -0
- package/dist/tui-v2/components/transcript/assistant-message.js.map +1 -0
- package/dist/tui-v2/components/transcript/compacted-row.d.ts +19 -0
- package/dist/tui-v2/components/transcript/compacted-row.js +69 -0
- package/dist/tui-v2/components/transcript/compacted-row.js.map +1 -0
- package/dist/tui-v2/components/transcript/intro-card.d.ts +19 -0
- package/dist/tui-v2/components/transcript/intro-card.js +50 -0
- package/dist/tui-v2/components/transcript/intro-card.js.map +1 -0
- package/dist/tui-v2/components/transcript/linkable-text.d.ts +21 -0
- package/dist/tui-v2/components/transcript/linkable-text.js +46 -0
- package/dist/tui-v2/components/transcript/linkable-text.js.map +1 -0
- package/dist/tui-v2/components/transcript/notice-row.d.ts +14 -0
- package/dist/tui-v2/components/transcript/notice-row.js +40 -0
- package/dist/tui-v2/components/transcript/notice-row.js.map +1 -0
- package/dist/tui-v2/components/transcript/search-bar.d.ts +19 -0
- package/dist/tui-v2/components/transcript/search-bar.js +7 -0
- package/dist/tui-v2/components/transcript/search-bar.js.map +1 -0
- package/dist/tui-v2/components/transcript/thinking-block.d.ts +22 -0
- package/dist/tui-v2/components/transcript/thinking-block.js +27 -0
- package/dist/tui-v2/components/transcript/thinking-block.js.map +1 -0
- package/dist/tui-v2/components/transcript/tool-card.d.ts +26 -0
- package/dist/tui-v2/components/transcript/tool-card.js +205 -0
- package/dist/tui-v2/components/transcript/tool-card.js.map +1 -0
- package/dist/tui-v2/components/transcript/transcript-row.d.ts +25 -0
- package/dist/tui-v2/components/transcript/transcript-row.js +37 -0
- package/dist/tui-v2/components/transcript/transcript-row.js.map +1 -0
- package/dist/tui-v2/components/transcript/transcript-scroll-port.d.ts +52 -0
- package/dist/tui-v2/components/transcript/transcript-scroll-port.js +86 -0
- package/dist/tui-v2/components/transcript/transcript-scroll-port.js.map +1 -0
- package/dist/tui-v2/components/transcript/transcript-view.d.ts +24 -0
- package/dist/tui-v2/components/transcript/transcript-view.js +403 -0
- package/dist/tui-v2/components/transcript/transcript-view.js.map +1 -0
- package/dist/tui-v2/components/transcript/use-click-without-drag.d.ts +13 -0
- package/dist/tui-v2/components/transcript/use-click-without-drag.js +35 -0
- package/dist/tui-v2/components/transcript/use-click-without-drag.js.map +1 -0
- package/dist/tui-v2/components/transcript/use-native-selection-copy.d.ts +10 -0
- package/dist/tui-v2/components/transcript/use-native-selection-copy.js +37 -0
- package/dist/tui-v2/components/transcript/use-native-selection-copy.js.map +1 -0
- package/dist/tui-v2/components/transcript/use-transcript-selection.d.ts +23 -0
- package/dist/tui-v2/components/transcript/use-transcript-selection.js +136 -0
- package/dist/tui-v2/components/transcript/use-transcript-selection.js.map +1 -0
- package/dist/tui-v2/components/transcript/user-message.d.ts +10 -0
- package/dist/tui-v2/components/transcript/user-message.js +23 -0
- package/dist/tui-v2/components/transcript/user-message.js.map +1 -0
- package/dist/tui-v2/composer/arrow-intent.d.ts +23 -0
- package/dist/tui-v2/composer/arrow-intent.js +35 -0
- package/dist/tui-v2/composer/arrow-intent.js.map +1 -0
- package/dist/tui-v2/composer/completion.d.ts +37 -0
- package/dist/tui-v2/composer/completion.js +67 -0
- package/dist/tui-v2/composer/completion.js.map +1 -0
- package/dist/tui-v2/composer/composer-editor.d.ts +33 -0
- package/dist/tui-v2/composer/composer-editor.js +620 -0
- package/dist/tui-v2/composer/composer-editor.js.map +1 -0
- package/dist/tui-v2/composer/composer-height.d.ts +21 -0
- package/dist/tui-v2/composer/composer-height.js +29 -0
- package/dist/tui-v2/composer/composer-height.js.map +1 -0
- package/dist/tui-v2/composer/composer-meta.d.ts +9 -0
- package/dist/tui-v2/composer/composer-meta.js +38 -0
- package/dist/tui-v2/composer/composer-meta.js.map +1 -0
- package/dist/tui-v2/composer/history-nav.d.ts +15 -0
- package/dist/tui-v2/composer/history-nav.js +16 -0
- package/dist/tui-v2/composer/history-nav.js.map +1 -0
- package/dist/tui-v2/composer/newline-hint.d.ts +13 -0
- package/dist/tui-v2/composer/newline-hint.js +13 -0
- package/dist/tui-v2/composer/newline-hint.js.map +1 -0
- package/dist/tui-v2/composer/paste-placeholder.d.ts +35 -0
- package/dist/tui-v2/composer/paste-placeholder.js +55 -0
- package/dist/tui-v2/composer/paste-placeholder.js.map +1 -0
- package/dist/tui-v2/composer/prompt-history.d.ts +22 -0
- package/dist/tui-v2/composer/prompt-history.js +51 -0
- package/dist/tui-v2/composer/prompt-history.js.map +1 -0
- package/dist/tui-v2/composer/secret-buffer.d.ts +20 -0
- package/dist/tui-v2/composer/secret-buffer.js +42 -0
- package/dist/tui-v2/composer/secret-buffer.js.map +1 -0
- package/dist/tui-v2/composer/textarea-keybindings.d.ts +22 -0
- package/dist/tui-v2/composer/textarea-keybindings.js +27 -0
- package/dist/tui-v2/composer/textarea-keybindings.js.map +1 -0
- package/dist/tui-v2/controllers/focus-controller.d.ts +30 -0
- package/dist/tui-v2/controllers/focus-controller.js +80 -0
- package/dist/tui-v2/controllers/focus-controller.js.map +1 -0
- package/dist/tui-v2/controllers/overlay-controller.d.ts +99 -0
- package/dist/tui-v2/controllers/overlay-controller.js +195 -0
- package/dist/tui-v2/controllers/overlay-controller.js.map +1 -0
- package/dist/tui-v2/controllers/selection-controller.d.ts +76 -0
- package/dist/tui-v2/controllers/selection-controller.js +238 -0
- package/dist/tui-v2/controllers/selection-controller.js.map +1 -0
- package/dist/tui-v2/controllers/toast-controller.d.ts +35 -0
- package/dist/tui-v2/controllers/toast-controller.js +88 -0
- package/dist/tui-v2/controllers/toast-controller.js.map +1 -0
- package/dist/tui-v2/layout/compute-layout.d.ts +59 -0
- package/dist/tui-v2/layout/compute-layout.js +170 -0
- package/dist/tui-v2/layout/compute-layout.js.map +1 -0
- package/dist/tui-v2/rendering/ansi-to-styled.d.ts +17 -0
- package/dist/tui-v2/rendering/ansi-to-styled.js +217 -0
- package/dist/tui-v2/rendering/ansi-to-styled.js.map +1 -0
- package/dist/tui-v2/rendering/batch-sections.d.ts +57 -0
- package/dist/tui-v2/rendering/batch-sections.js +177 -0
- package/dist/tui-v2/rendering/batch-sections.js.map +1 -0
- package/dist/tui-v2/rendering/link-detector.d.ts +16 -0
- package/dist/tui-v2/rendering/link-detector.js +43 -0
- package/dist/tui-v2/rendering/link-detector.js.map +1 -0
- package/dist/tui-v2/rendering/open-tool-output.d.ts +28 -0
- package/dist/tui-v2/rendering/open-tool-output.js +138 -0
- package/dist/tui-v2/rendering/open-tool-output.js.map +1 -0
- package/dist/tui-v2/rendering/picker-filter.d.ts +22 -0
- package/dist/tui-v2/rendering/picker-filter.js +68 -0
- package/dist/tui-v2/rendering/picker-filter.js.map +1 -0
- package/dist/tui-v2/rendering/plan-view.d.ts +32 -0
- package/dist/tui-v2/rendering/plan-view.js +196 -0
- package/dist/tui-v2/rendering/plan-view.js.map +1 -0
- package/dist/tui-v2/rendering/render-markdown-lines.d.ts +29 -0
- package/dist/tui-v2/rendering/render-markdown-lines.js +46 -0
- package/dist/tui-v2/rendering/render-markdown-lines.js.map +1 -0
- package/dist/tui-v2/rendering/sanitize-display.d.ts +13 -0
- package/dist/tui-v2/rendering/sanitize-display.js +24 -0
- package/dist/tui-v2/rendering/sanitize-display.js.map +1 -0
- package/dist/tui-v2/rendering/strip-tool-surfaces.d.ts +10 -0
- package/dist/tui-v2/rendering/strip-tool-surfaces.js +32 -0
- package/dist/tui-v2/rendering/strip-tool-surfaces.js.map +1 -0
- package/dist/tui-v2/rendering/theme.d.ts +67 -0
- package/dist/tui-v2/rendering/theme.js +74 -0
- package/dist/tui-v2/rendering/theme.js.map +1 -0
- package/dist/tui-v2/rendering/tool-presenter.d.ts +39 -0
- package/dist/tui-v2/rendering/tool-presenter.js +209 -0
- package/dist/tui-v2/rendering/tool-presenter.js.map +1 -0
- package/dist/tui-v2/rendering/transcript-export.d.ts +11 -0
- package/dist/tui-v2/rendering/transcript-export.js +18 -0
- package/dist/tui-v2/rendering/transcript-export.js.map +1 -0
- package/dist/tui-v2/rendering/transcript-semantic.d.ts +17 -0
- package/dist/tui-v2/rendering/transcript-semantic.js +67 -0
- package/dist/tui-v2/rendering/transcript-semantic.js.map +1 -0
- package/dist/tui-v2/state/pager-search.d.ts +22 -0
- package/dist/tui-v2/state/pager-search.js +78 -0
- package/dist/tui-v2/state/pager-search.js.map +1 -0
- package/dist/tui-v2/state/semantic-document.d.ts +34 -0
- package/dist/tui-v2/state/semantic-document.js +201 -0
- package/dist/tui-v2/state/semantic-document.js.map +1 -0
- package/dist/tui-v2/state/transcript-compaction.d.ts +24 -0
- package/dist/tui-v2/state/transcript-compaction.js +79 -0
- package/dist/tui-v2/state/transcript-compaction.js.map +1 -0
- package/dist/tui-v2/state/transcript-hydrate.d.ts +27 -0
- package/dist/tui-v2/state/transcript-hydrate.js +276 -0
- package/dist/tui-v2/state/transcript-hydrate.js.map +1 -0
- package/dist/tui-v2/state/transcript-reducer.d.ts +10 -0
- package/dist/tui-v2/state/transcript-reducer.js +339 -0
- package/dist/tui-v2/state/transcript-reducer.js.map +1 -0
- package/dist/tui-v2/state/transcript-search.d.ts +17 -0
- package/dist/tui-v2/state/transcript-search.js +38 -0
- package/dist/tui-v2/state/transcript-search.js.map +1 -0
- package/dist/tui-v2/state/transcript-store.d.ts +32 -0
- package/dist/tui-v2/state/transcript-store.js +66 -0
- package/dist/tui-v2/state/transcript-store.js.map +1 -0
- package/dist/tui-v2/state/transcript-struct.d.ts +15 -0
- package/dist/tui-v2/state/transcript-struct.js +133 -0
- package/dist/tui-v2/state/transcript-struct.js.map +1 -0
- package/dist/tui-v2/state/transcript-types.d.ts +76 -0
- package/dist/tui-v2/state/transcript-types.js +65 -0
- package/dist/tui-v2/state/transcript-types.js.map +1 -0
- package/dist/tui-v2/state/use-overlay.d.ts +3 -0
- package/dist/tui-v2/state/use-overlay.js +6 -0
- package/dist/tui-v2/state/use-overlay.js.map +1 -0
- package/dist/tui-v2/state/use-plan.d.ts +4 -0
- package/dist/tui-v2/state/use-plan.js +6 -0
- package/dist/tui-v2/state/use-plan.js.map +1 -0
- package/dist/tui-v2/state/use-session-state.d.ts +2 -0
- package/dist/tui-v2/state/use-session-state.js +7 -0
- package/dist/tui-v2/state/use-session-state.js.map +1 -0
- package/dist/tui-v2/state/use-toast.d.ts +3 -0
- package/dist/tui-v2/state/use-toast.js +15 -0
- package/dist/tui-v2/state/use-toast.js.map +1 -0
- package/dist/tui-v2/state/use-transcript-store.d.ts +10 -0
- package/dist/tui-v2/state/use-transcript-store.js +12 -0
- package/dist/tui-v2/state/use-transcript-store.js.map +1 -0
- package/dist/ui/intro-card.js +3 -3
- package/dist/ui/intro-card.js.map +1 -1
- package/dist/ui/intro-header.d.ts +23 -0
- package/dist/ui/intro-header.js +232 -0
- package/dist/ui/intro-header.js.map +1 -0
- package/dist/ui/markdown.js +0 -1
- package/dist/ui/markdown.js.map +1 -1
- package/dist/ui/mentions.d.ts +9 -2
- package/dist/ui/mentions.js +102 -4
- package/dist/ui/mentions.js.map +1 -1
- package/dist/ui/output-pane.js +1 -1
- package/dist/ui/output-pane.js.map +1 -1
- package/dist/ui/plan-pane.d.ts +8 -0
- package/dist/ui/plan-pane.js +38 -0
- package/dist/ui/plan-pane.js.map +1 -1
- package/dist/ui/wordmark.d.ts +5 -0
- package/dist/ui/wordmark.js +6 -1
- package/dist/ui/wordmark.js.map +1 -1
- package/package.json +25 -12
- package/dist/tui/App.d.ts +0 -12
- package/dist/tui/App.js +0 -2174
- package/dist/tui/App.js.map +0 -1
- package/dist/tui/components/ConfirmModal.d.ts +0 -9
- package/dist/tui/components/ConfirmModal.js +0 -55
- package/dist/tui/components/ConfirmModal.js.map +0 -1
- package/dist/tui/components/JobsPanel.d.ts +0 -11
- package/dist/tui/components/JobsPanel.js +0 -55
- package/dist/tui/components/JobsPanel.js.map +0 -1
- package/dist/tui/components/Pager.d.ts +0 -14
- package/dist/tui/components/Pager.js +0 -56
- package/dist/tui/components/Pager.js.map +0 -1
- package/dist/tui/components/PickerPanel.d.ts +0 -15
- package/dist/tui/components/PickerPanel.js +0 -126
- package/dist/tui/components/PickerPanel.js.map +0 -1
- package/dist/tui/components/PlanSidebar.d.ts +0 -6
- package/dist/tui/components/PlanSidebar.js +0 -99
- package/dist/tui/components/PlanSidebar.js.map +0 -1
- package/dist/tui/components/SecretInputPanel.d.ts +0 -7
- package/dist/tui/components/SecretInputPanel.js +0 -38
- package/dist/tui/components/SecretInputPanel.js.map +0 -1
- package/dist/tui/confirm.d.ts +0 -16
- package/dist/tui/confirm.js.map +0 -1
- package/dist/tui/default.d.ts +0 -6
- package/dist/tui/default.js +0 -11
- package/dist/tui/default.js.map +0 -1
- package/dist/tui/hooks/useAgentRunner.d.ts +0 -73
- package/dist/tui/hooks/useAgentRunner.js +0 -277
- package/dist/tui/hooks/useAgentRunner.js.map +0 -1
- package/dist/tui/hooks/useJobs.d.ts +0 -7
- package/dist/tui/hooks/useJobs.js +0 -39
- package/dist/tui/hooks/useJobs.js.map +0 -1
- package/dist/tui/hooks/useSpinner.d.ts +0 -5
- package/dist/tui/hooks/useSpinner.js +0 -21
- package/dist/tui/hooks/useSpinner.js.map +0 -1
- package/dist/tui/hooks/useTerminalSize.d.ts +0 -9
- package/dist/tui/hooks/useTerminalSize.js +0 -26
- package/dist/tui/hooks/useTerminalSize.js.map +0 -1
- package/dist/tui/index.d.ts +0 -10
- package/dist/tui/index.js +0 -37
- package/dist/tui/index.js.map +0 -1
- package/dist/tui/key-intent.d.ts +0 -36
- package/dist/tui/key-intent.js +0 -54
- package/dist/tui/key-intent.js.map +0 -1
- package/dist/tui/mouse.d.ts +0 -8
- package/dist/tui/mouse.js +0 -34
- package/dist/tui/mouse.js.map +0 -1
- package/dist/tui/plan-sidebar-lines.d.ts +0 -2
- package/dist/tui/plan-sidebar-lines.js +0 -140
- package/dist/tui/plan-sidebar-lines.js.map +0 -1
- package/dist/tui/render-lines.d.ts +0 -22
- package/dist/tui/render-lines.js +0 -611
- package/dist/tui/render-lines.js.map +0 -1
package/dist/prompts/index.js
CHANGED
|
@@ -108,11 +108,12 @@ Format rules:
|
|
|
108
108
|
- shell.tail: {"id":"<job-id>","bytes":<optional>} — read recent output of a background job.
|
|
109
109
|
- shell.stop: {"id":"<job-id>"} — stop a background job.
|
|
110
110
|
- fs.read: {"path":"<file>","offset":<optional 1-indexed line>,"limit":<optional max lines>,"maxBytes":<optional>} — read a file. You get the FULL content for normal files (it is NOT truncated unless it is very large). If a file IS truncated, page it with offset/limit (e.g. offset=1 limit=500, then offset=501) instead of re-reading the whole file.
|
|
111
|
-
- fs.write: {"path":"<file>","content":"<data>"} — create or overwrite a single file. Parent dirs are auto-created
|
|
112
|
-
- fs.writeMany: {"files":[{"path":"<file>","content":"<data>"}, ...]} — write up to 50 files in one call. Prefer this to scaffold
|
|
111
|
+
- fs.write: {"path":"<file>","content":"<data>"} — create or overwrite a single file (FULL content in ONE call). Parent dirs are auto-created. Prefer one complete fs.write for reports, scripts, and source files — same as Cursor/Claude Code. Returns a receipt (bytes, lines, sha256_12, ends_with); TRUST the receipt — do NOT re-read the whole file just to check the write.
|
|
112
|
+
- fs.writeMany: {"files":[{"path":"<file>","content":"<data>"}, ...]} — write up to 50 complete files in one call. Prefer this to scaffold a project; each file's content should still be complete. Split the *file list* across turns if needed, not mid-file contents.
|
|
113
113
|
- fs.edit: {"path":"<file>","oldText":"<exact text>","newText":"<replacement>","expectedReplacements":<optional int>} — atomic find-and-replace. Prefer this for precise changes to existing files; use fs.write for new files or intentional full rewrites.
|
|
114
|
-
- fs.replaceLines: {"path":"<file>","startLine":<1-indexed inclusive>,"endLine":<inclusive
|
|
115
|
-
- fs.append: {"path":"<file>","content":"<data>","position":"<optional start|end>"} — append
|
|
114
|
+
- fs.replaceLines: {"path":"<file>","startLine":<1-indexed inclusive>,"endLine":<inclusive>","content":"<replacement>"} — atomically replace a known line range. Read the relevant range immediately first; prefer fs.edit when exact text is a safer anchor.
|
|
115
|
+
- fs.append: {"path":"<file>","content":"<data>","position":"<optional start|end>","expectedPriorBytes":<optional int>} — append only when continuing a truncated write. Pass expectedPriorBytes from the previous write/append receipt to prevent double-append. Do NOT use append as the default way to write long files.
|
|
116
|
+
- FILE WRITE POLICY: Always try a single complete fs.write first. Keep reasoning SHORT so the tool JSON has room. Only if a write is truncated by the output limit (system will salvage and tell you), continue with large fs.append chunks (hundreds of lines, not ~100) using expectedPriorBytes. Never invent content you already wrote; never re-read full files after a successful receipt unless the next edit needs context.
|
|
116
117
|
- fs.delete: {"path":"<file>","recursive":<optional bool>} — delete a file/dir. Always confirmed manually. Use only when the user asks to delete; never use shell rm for deletion.
|
|
117
118
|
- fs.list: {"path":"<dir>"} — list a directory.
|
|
118
119
|
- fs.search: {"pattern":"<regex>","path":"<dir>"} — search file CONTENTS (not filenames).
|
|
@@ -132,7 +133,7 @@ Format rules:
|
|
|
132
133
|
- image.ocr: {"path":"<image>","lang":"<optional eng>","psm":<optional>} — OCR text from an image. Use when the model cannot view images or only text is needed.
|
|
133
134
|
- pdf.read: {"path":"<file.pdf>","lang":"<optional>","dpi":<optional>} — extract text from a PDF (digital or scanned). Prefer over raw pdftotext.
|
|
134
135
|
- sysinfo: {} — OS / system info.
|
|
135
|
-
- plan.create: {"goal":"<short goal>","detail":"<stack/approach chosen and why, architecture, how you'll verify>","tasks":["task 1","task 2", ...],"kind":"coding|pentest|general"} —
|
|
136
|
+
- plan.create: {"goal":"<short goal>","detail":"<stack/approach chosen and why, architecture, how you'll verify>","tasks":["task 1","task 2", ...] OR [{"title":"task 1"},...],"kind":"coding|pentest|general"} — **primary tool for multi-step work**. tasks MUST be a non-empty array (string titles or objects with title/name). Prefer 4–8 separate tasks. After creating it, STOP and wait for implement/discard.
|
|
136
137
|
- task.update: {"taskId":"<id like t1>","state":"pending|in_progress|done|failed|skipped","note":"<optional>"} — update one task while executing an approved plan. Mark in_progress before starting, done only after the work actually succeeded, failed if it errored.
|
|
137
138
|
|
|
138
139
|
# OPERATING RULES
|
|
@@ -142,7 +143,7 @@ Format rules:
|
|
|
142
143
|
- STAY ON TARGET. Do exactly what was asked. Use narrow tools for narrow questions (whois.lookup for ownership, dns.lookup for one record, net.scan with specific ports for one port). Use pentest.recon only when the user asks for full recon.
|
|
143
144
|
- HIGH-SIGNAL TOOL USE AND OUTPUT: Apply this to EVERY tool call and command. Scope each invocation to the exact evidence needed; use native filters, narrow paths/targets, quiet or structured output, and bounded limits so only relevant findings reach context. Never guess a large set of directories, endpoints, binaries, or wordlist paths and fire speculative requests. First use the available evidence (links, robots.txt, sitemap, application assets, service banners, project files) and the dedicated discovery tools. Before relying on a non-standard CLI, call tool.check; if it is missing and installation is appropriate, call pkg.install and then verify with tool.check. Before a wordlist-driven directory scan, call wordlist.find instead of guessing an OS-specific path. Configure discovery/scanner commands to emit structured or quiet output and include only candidate hits / relevant status codes; filter known negative or wildcard responses at the tool. Prefer one bounded, stack-targeted scan over many guessed http.fetch calls. Feed back a compact finding summary: successes, unusual responses, and one representative failure only when no useful result exists. Full raw output is retained as an artifact, so do not paste progress bars, repeated failures, or verbose banners into context.
|
|
144
145
|
- TOOL READINESS AND PROFESSIONAL DISCOVERY: Choose tools from the evidence and current phase, not from a fixed spray list. For an identified web application, directory/content discovery may use an appropriate installed fuzzer (for example ffuf, gobuster, feroxbuster, dirsearch, or dirb) ONLY after stack fingerprinting and only with a verified wordlist. Check the specific utility with tool.check; if it is absent, install only that required utility through pkg.install, then verify it. Use the tool's own match/filter, wildcard calibration, status-code, extension, rate, and output-format controls so it returns candidate findings rather than every miss. Apply the same evidence → check → install-if-needed → bounded-run → concise-findings sequence to service enumeration, subdomain discovery, template scanning, and every other specialized tool.
|
|
145
|
-
- VERIFY BEFORE CLAIMING. You MUST NOT mark a task 'done'
|
|
146
|
+
- VERIFY BEFORE CLAIMING. You MUST NOT mark a task 'done' without evidence. For coding builds: after writes, confirm files exist; after builds, exit 0; after starting a LOCAL app server (only when the task is a local app), shell.tail + a localhost probe. For REMOTE pentests: evidence is tool output from recon/exploits against the remote target — NEVER start a local dev server to "finish" a website assessment, and NEVER treat the clai workspace as the target.
|
|
146
147
|
- ONE GOOD TOOL PER JOB. Don't run two overlapping tools speculatively (e.g. subfinder AND amass). Use the best available one; escalate to another only if it fails or the user asks to be exhaustive.
|
|
147
148
|
- BE CONCISE. A line or two of reasoning before a tool call. After tool output, summarize the concrete findings in plain text — never just "see the output".
|
|
148
149
|
- USE HISTORY. "it", "that", "the target" refer to earlier context.
|
|
@@ -203,9 +204,11 @@ Format rules:
|
|
|
203
204
|
|
|
204
205
|
# PLANNING (plan.create + approval gate)
|
|
205
206
|
|
|
207
|
+
You have a first-class planning system. For multi-step project builds and multi-step pentests you are expected to use plan.create — do not improvise a long ad-hoc chain when a durable checklist would keep the work ordered. The plan is re-shown every turn and survives context compaction.
|
|
208
|
+
|
|
206
209
|
- Trivial work (one command, one quick lookup, one small edit) → just do it; no plan.
|
|
207
|
-
- Multi-step
|
|
208
|
-
- Pentest / security engagements follow a DIFFERENT shape: RECON / DISCOVERY FIRST (whois.lookup, dns.lookup, net.context, http.fetch GET, tool.batch of read-only lookups, net.scan, pentest.recon), THEN plan.create BUILT FROM the findings (open ports, services and versions, endpoints, technologies, weaknesses). Read-only recon is allowed BEFORE a plan exists — it is the data the plan is built on. As new attack surface is uncovered (new ports, endpoints, services, vulnerabilities, discovered subdomains), call plan.create again with a REVISED tasks array that preserves every previously completed task (same id and order) followed by the new tasks at the end; the system merges and preserves the completed state. Incremental task additions to an approved plan are allowed inside the engagement scope — they are how a pentest grows. Stay inside the engagement scope and FLAG out-of-scope hosts / ports / phases to the user instead of acting on them automatically.
|
|
210
|
+
- Multi-step PROJECT BUILD / coding (scaffold an app, multi-file feature, refactor across files, anything needing 3+ meaningful actions) → first EXPLORE (fs.list/fs.read) and UNDERSTAND the stack, then call plan.create with kind=coding, a thoughtful detail (stack + approach + how you'll verify), and 4-8 separate ordered verifiable tasks. Do not lump everything into one task. After plan.create, STOP and wait for approval.
|
|
211
|
+
- Pentest / security engagements follow a DIFFERENT shape: RECON / DISCOVERY FIRST (whois.lookup, dns.lookup, net.context, http.fetch GET, tool.batch of read-only lookups, net.scan, pentest.recon), THEN plan.create with kind=pentest BUILT FROM the findings (open ports, services and versions, endpoints, technologies, weaknesses). Read-only recon is allowed BEFORE a plan exists — it is the data the plan is built on. As new attack surface is uncovered (new ports, endpoints, services, vulnerabilities, discovered subdomains), call plan.create again with a REVISED tasks array that preserves every previously completed task (same id and order) followed by the new tasks at the end; the system merges and preserves the completed state. Incremental task additions to an approved plan are allowed inside the engagement scope — they are how a pentest grows. Stay inside the engagement scope and FLAG out-of-scope hosts / ports / phases to the user instead of acting on them automatically.
|
|
209
212
|
- PLAN ROUND BOUNDARY (MANDATORY RESPONSE SHAPES): (A) RECON RESPONSE = one or more gathering calls only; NEVER include plan.create. (B) ANALYSIS + PLAN RESPONSE = first reason from the returned tool outputs, then emit EXACTLY ONE standalone plan.create call; NEVER attach recon, exploitation, task.update, or any follow-on call. (C) AFTER PLAN RESPONSE = stop and wait for /implement approval. A plan based on proposed calls rather than returned evidence is invalid.
|
|
210
213
|
- PLAN PERSISTENCE — you never lose the plan. Your plan and its task checklist are SAVED to durable storage for the whole session and re-shown to you at the start of every turn as an "ACTIVE PLAN for this session" block (goal, detail, and each task's id + state). It SURVIVES context compaction. If a plan is already complete/done, and the user asks to add new features/tasks, do NOT discard the existing plan. Call plan.create with a revised tasks array that includes all the previously completed tasks (to preserve their done status) followed by the new tasks at the end. The system will automatically merge and preserve the completed state of the old tasks.
|
|
211
214
|
- APPROVAL: after plan.create the user is asked to approve (implement) or discard the plan. While a plan is awaiting approval, the only thing you may do is refine it (call plan.create again with revisions) or read-only exploration; do not execute. Treat new user messages as plan feedback until the plan is approved — even if they sound like an instruction. The user can cancel a plan at any time with /discard.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,IAAI,GACR,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QAC1E,SAAS,CAAC;IACZ,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kcAkDgb,CAAC;AAEnc,MAAM,WAAW,GAAG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,IAAI,GACR,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QAC1E,SAAS,CAAC;IACZ,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC;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AC,MAAM,CAAC,GAAG,CAAC;QAClC,QAAQ,EAAE,MAAM,EAAE;QAClB,SAAS,EAAE,QAAQ;KACpB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -6,7 +6,7 @@ export const slashCommands = [
|
|
|
6
6
|
{
|
|
7
7
|
command: "/model",
|
|
8
8
|
usage: "[name|#]",
|
|
9
|
-
description: "open searchable picker (type
|
|
9
|
+
description: "open searchable picker (type:filter · ↑↓:select · enter:confirm), or pass a name/number",
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
command: "/provider",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/repl/slash-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAQxD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC3C,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE;IACtD,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE;IAC1D;QACE,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,UAAU;QACjB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/repl/slash-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAQxD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC3C,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE;IACtD,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE;IAC1D;QACE,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,UAAU;QACjB,WAAW,EACT,yFAAyF;KAC5F;IACD;QACE,OAAO,EAAE,WAAW;QACpB,KAAK,EAAE,QAAQ;QACf,WAAW,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AAC,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;AACnE,CAAC"}
|
package/dist/repl.js
CHANGED
|
@@ -91,42 +91,12 @@ async function buildImageOcrGrounding(line, baseDir) {
|
|
|
91
91
|
}
|
|
92
92
|
// Abort controller for streaming cancellation
|
|
93
93
|
let currentAbortController = null;
|
|
94
|
-
let abortPressCount = 0;
|
|
95
|
-
let lastAbortPressAt = 0;
|
|
96
|
-
const ABORT_PRESS_DEDUP_MS = 40;
|
|
97
|
-
const FORCE_EXIT_AFTER_ABORT_PRESSES = 2;
|
|
98
94
|
class AbortRunError extends Error {
|
|
99
95
|
constructor() {
|
|
100
96
|
super("Aborted.");
|
|
101
97
|
this.name = "AbortRunError";
|
|
102
98
|
}
|
|
103
99
|
}
|
|
104
|
-
function resetAbortEscalation() {
|
|
105
|
-
abortPressCount = 0;
|
|
106
|
-
lastAbortPressAt = 0;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Shared by raw input, readline keypresses, and SIGINT. A single terminal
|
|
110
|
-
* Ctrl+C can produce both a raw `data` event and a `keypress` event, so dedupe
|
|
111
|
-
* those notifications before counting presses. The raw-data path is the only
|
|
112
|
-
* reliable fallback in some terminals and must retain the same force-exit
|
|
113
|
-
* behavior as the normalized keypress path.
|
|
114
|
-
*/
|
|
115
|
-
function abortCurrentRun() {
|
|
116
|
-
if (!currentAbortController)
|
|
117
|
-
return;
|
|
118
|
-
const now = Date.now();
|
|
119
|
-
if (now - lastAbortPressAt < ABORT_PRESS_DEDUP_MS)
|
|
120
|
-
return;
|
|
121
|
-
lastAbortPressAt = now;
|
|
122
|
-
abortPressCount += 1;
|
|
123
|
-
currentAbortController.abort();
|
|
124
|
-
if (abortPressCount >= FORCE_EXIT_AFTER_ABORT_PRESSES) {
|
|
125
|
-
process.stdout.write(chalk.yellow("\n ⏹ force-exiting…\n"));
|
|
126
|
-
process.exit(130);
|
|
127
|
-
}
|
|
128
|
-
process.stdout.write(chalk.yellow("\n ⏹ aborting…\n"));
|
|
129
|
-
}
|
|
130
100
|
// Build a concise, width-bounded spinner label for ask-mode research so the
|
|
131
101
|
// user sees what's being searched/fetched without the line overflowing.
|
|
132
102
|
function askResearchLabel(name, argsDisplay) {
|
|
@@ -224,11 +194,10 @@ async function streamWithAbort(run, signal) {
|
|
|
224
194
|
}
|
|
225
195
|
async function withAbortableInput(run) {
|
|
226
196
|
const ac = new AbortController();
|
|
227
|
-
resetAbortEscalation();
|
|
228
197
|
const abortFromRawData = (chunk) => {
|
|
229
198
|
const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
230
199
|
if (text.includes("\x03") || text === "\x1b") {
|
|
231
|
-
|
|
200
|
+
ac.abort();
|
|
232
201
|
}
|
|
233
202
|
};
|
|
234
203
|
currentAbortController = ac;
|
|
@@ -487,8 +456,8 @@ async function pickModelInteractively(provider, currentModel) {
|
|
|
487
456
|
return undefined;
|
|
488
457
|
}
|
|
489
458
|
const header = fetchedDynamically
|
|
490
|
-
? chalk.dim(`
|
|
491
|
-
: chalk.dim(`
|
|
459
|
+
? chalk.dim(` ↑↓:navigate · type:filter · tab:fill · enter:select · esc:cancel`)
|
|
460
|
+
: chalk.dim(` ↑↓:navigate · type:filter · tab:fill · enter:select · esc:cancel`);
|
|
492
461
|
const items = models.map((model, index) => {
|
|
493
462
|
const tags = [];
|
|
494
463
|
if (model === currentModel)
|
|
@@ -562,7 +531,7 @@ function maybePrintThinkingTip(provider, model) {
|
|
|
562
531
|
* (cleaned) explanation, then prompt the user to switch into agent mode and
|
|
563
532
|
* run the task there. Returns the text to record as the assistant turn.
|
|
564
533
|
*/
|
|
565
|
-
async function offerAgentSwitch(info, state, requestModel, images
|
|
534
|
+
async function offerAgentSwitch(info, state, requestModel, images) {
|
|
566
535
|
if (info.preamble) {
|
|
567
536
|
process.stdout.write(`${renderMarkdown(info.preamble)}\n`);
|
|
568
537
|
}
|
|
@@ -605,7 +574,6 @@ async function offerAgentSwitch(info, state, requestModel, images, onMessages) {
|
|
|
605
574
|
session: state.session,
|
|
606
575
|
images,
|
|
607
576
|
onEvent: classicRenderer.onEvent,
|
|
608
|
-
onMessages,
|
|
609
577
|
}));
|
|
610
578
|
}
|
|
611
579
|
/**
|
|
@@ -755,7 +723,7 @@ async function handleSlash(line, state) {
|
|
|
755
723
|
});
|
|
756
724
|
const picked = await pickInline({
|
|
757
725
|
items,
|
|
758
|
-
header: chalk.dim("
|
|
726
|
+
header: chalk.dim(" ↑↓:navigate · enter:select · esc:cancel"),
|
|
759
727
|
pageSize: allEfforts.length,
|
|
760
728
|
});
|
|
761
729
|
if (!picked) {
|
|
@@ -851,7 +819,7 @@ async function handleSlash(line, state) {
|
|
|
851
819
|
});
|
|
852
820
|
const selectedId = await pickInline({
|
|
853
821
|
items,
|
|
854
|
-
header: chalk.dim(`
|
|
822
|
+
header: chalk.dim(` ↑↓:navigate · type:filter · enter:resume · esc:cancel`),
|
|
855
823
|
pageSize: Math.min(15, items.length),
|
|
856
824
|
});
|
|
857
825
|
if (!selectedId) {
|
|
@@ -1265,47 +1233,6 @@ async function handleSlash(line, state) {
|
|
|
1265
1233
|
console.log();
|
|
1266
1234
|
return true;
|
|
1267
1235
|
}
|
|
1268
|
-
case "/permissions": {
|
|
1269
|
-
const arg = (args[0] ?? "").toLowerCase().trim();
|
|
1270
|
-
const current = getConfig().permissions ?? "default";
|
|
1271
|
-
const allPermissions = [
|
|
1272
|
-
{ value: "default", label: "default", desc: "normal behavior (prompts for confirmation on mutating actions)" },
|
|
1273
|
-
{ value: "allow-all", label: "allow-all", desc: "run everything without confirmation (except passwords)" }
|
|
1274
|
-
];
|
|
1275
|
-
if (!arg) {
|
|
1276
|
-
console.log(chalk.dim(" current permissions: ") + chalk.cyan(current));
|
|
1277
|
-
const items = allPermissions.map((p) => {
|
|
1278
|
-
const isActive = p.value === current;
|
|
1279
|
-
const activeTag = isActive ? chalk.green(" (active)") : "";
|
|
1280
|
-
const label = ` ${chalk.cyan(p.label.padEnd(12))} ${chalk.dim(p.desc)}${activeTag}`;
|
|
1281
|
-
return { label, value: p.value, filterText: p.label };
|
|
1282
|
-
});
|
|
1283
|
-
const picked = await pickInline({
|
|
1284
|
-
items,
|
|
1285
|
-
header: chalk.dim(" ↑/↓ navigate · Enter to select · ESC to cancel"),
|
|
1286
|
-
pageSize: allPermissions.length,
|
|
1287
|
-
});
|
|
1288
|
-
if (!picked) {
|
|
1289
|
-
console.log(chalk.dim(" permissions unchanged"));
|
|
1290
|
-
return true;
|
|
1291
|
-
}
|
|
1292
|
-
updateConfig({ permissions: picked });
|
|
1293
|
-
console.log(chalk.dim(` permissions → ${chalk.cyan(picked)}`));
|
|
1294
|
-
return true;
|
|
1295
|
-
}
|
|
1296
|
-
if (arg === "default" || arg === "normal") {
|
|
1297
|
-
updateConfig({ permissions: "default" });
|
|
1298
|
-
console.log(chalk.dim(` permissions → ${chalk.cyan("default")}`));
|
|
1299
|
-
return true;
|
|
1300
|
-
}
|
|
1301
|
-
if (arg === "allow-all" || arg === "allowall" || arg === "all") {
|
|
1302
|
-
updateConfig({ permissions: "allow-all" });
|
|
1303
|
-
console.log(chalk.dim(` permissions → ${chalk.cyan("allow-all")}`));
|
|
1304
|
-
return true;
|
|
1305
|
-
}
|
|
1306
|
-
console.log(chalk.dim(" usage: /permissions [default|allow-all]"));
|
|
1307
|
-
return true;
|
|
1308
|
-
}
|
|
1309
1236
|
case "/update":
|
|
1310
1237
|
await runUpdate();
|
|
1311
1238
|
return true;
|
|
@@ -1335,6 +1262,7 @@ export async function startRepl(options = {}) {
|
|
|
1335
1262
|
let isReadingPrompt = false;
|
|
1336
1263
|
let outputShortcutBusy = false;
|
|
1337
1264
|
let lastOutputShortcutAt = 0;
|
|
1265
|
+
let abortPressCount = 0;
|
|
1338
1266
|
emitKeypressEvents(input);
|
|
1339
1267
|
// Survive stray promise rejections (eg AbortError from a cancelled
|
|
1340
1268
|
// SSE reader) without killing the REPL. Anything that ends up here
|
|
@@ -1437,7 +1365,19 @@ export async function startRepl(options = {}) {
|
|
|
1437
1365
|
void handlePlanShortcut();
|
|
1438
1366
|
}
|
|
1439
1367
|
if ((isEscape(key) || isCtrlC(key)) && currentAbortController) {
|
|
1440
|
-
|
|
1368
|
+
abortPressCount += 1;
|
|
1369
|
+
currentAbortController.abort();
|
|
1370
|
+
// Escalate: after the first abort attempt the child process
|
|
1371
|
+
// receives SIGTERM, which tools like ffuf may catch and handle
|
|
1372
|
+
// gracefully (taking several seconds). Show feedback so the
|
|
1373
|
+
// user knows the abort registered, and on subsequent presses
|
|
1374
|
+
// hint that force-kill is in progress.
|
|
1375
|
+
if (abortPressCount === 1) {
|
|
1376
|
+
process.stdout.write(chalk.yellow("\n ⏹ aborting…\n"));
|
|
1377
|
+
}
|
|
1378
|
+
else if (abortPressCount >= 2) {
|
|
1379
|
+
process.stdout.write(chalk.yellow(" ⏹ force-killing…\n"));
|
|
1380
|
+
}
|
|
1441
1381
|
}
|
|
1442
1382
|
};
|
|
1443
1383
|
input.on("keypress", handleKeypress);
|
|
@@ -1456,9 +1396,8 @@ export async function startRepl(options = {}) {
|
|
|
1456
1396
|
// second press within 1s; so SIGINT here only acts as a fallback for
|
|
1457
1397
|
// the rare case where no prompt or stream is active.
|
|
1458
1398
|
const handleSigint = () => {
|
|
1459
|
-
const now = Date.now();
|
|
1460
1399
|
if (currentAbortController) {
|
|
1461
|
-
|
|
1400
|
+
currentAbortController.abort();
|
|
1462
1401
|
return;
|
|
1463
1402
|
}
|
|
1464
1403
|
if (isReadingPrompt) {
|
|
@@ -1466,6 +1405,7 @@ export async function startRepl(options = {}) {
|
|
|
1466
1405
|
// semantics; do nothing here so the two paths never fight.
|
|
1467
1406
|
return;
|
|
1468
1407
|
}
|
|
1408
|
+
const now = Date.now();
|
|
1469
1409
|
if (now - lastSigintAt < 1_000) {
|
|
1470
1410
|
console.log();
|
|
1471
1411
|
process.exit(0);
|
|
@@ -1577,14 +1517,9 @@ export async function startRepl(options = {}) {
|
|
|
1577
1517
|
break;
|
|
1578
1518
|
continue;
|
|
1579
1519
|
}
|
|
1580
|
-
let stateMessagesUpdated = false;
|
|
1581
|
-
const onMessages = (msgs) => {
|
|
1582
|
-
stateMessagesUpdated = true;
|
|
1583
|
-
state.messages = msgs;
|
|
1584
|
-
};
|
|
1585
1520
|
try {
|
|
1586
1521
|
clearThinking();
|
|
1587
|
-
|
|
1522
|
+
abortPressCount = 0;
|
|
1588
1523
|
let assistantContent = "";
|
|
1589
1524
|
// Expand @file mentions and drag-and-dropped paths into real context.
|
|
1590
1525
|
// The user-visible `line` stays readable in history; the model gets
|
|
@@ -1658,7 +1593,7 @@ export async function startRepl(options = {}) {
|
|
|
1658
1593
|
// The task needs actions ask mode can't perform. Offer to switch
|
|
1659
1594
|
// into agent mode and run it there. On confirm, state.mode flips
|
|
1660
1595
|
// so subsequent turns stay in agent mode too.
|
|
1661
|
-
assistantContent = await offerAgentSwitch(actionRequired, state, requestModel, images
|
|
1596
|
+
assistantContent = await offerAgentSwitch(actionRequired, state, requestModel, images);
|
|
1662
1597
|
}
|
|
1663
1598
|
}
|
|
1664
1599
|
else {
|
|
@@ -1671,37 +1606,30 @@ export async function startRepl(options = {}) {
|
|
|
1671
1606
|
session: state.session,
|
|
1672
1607
|
images,
|
|
1673
1608
|
onEvent: classicRenderer.onEvent,
|
|
1674
|
-
onMessages,
|
|
1675
1609
|
}));
|
|
1676
1610
|
}
|
|
1677
1611
|
console.log();
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
});
|
|
1689
|
-
}
|
|
1612
|
+
const userHistoryMessage = {
|
|
1613
|
+
role: "user",
|
|
1614
|
+
content: modelInput,
|
|
1615
|
+
};
|
|
1616
|
+
if (images.length > 0)
|
|
1617
|
+
userHistoryMessage.images = images;
|
|
1618
|
+
state.messages.push(userHistoryMessage, {
|
|
1619
|
+
role: "assistant",
|
|
1620
|
+
content: assistantContent,
|
|
1621
|
+
});
|
|
1690
1622
|
}
|
|
1691
1623
|
catch (error) {
|
|
1692
1624
|
if (error instanceof AbortRunError) {
|
|
1693
1625
|
process.stdout.write(chalk.yellow("\n ⏹ Aborted.\n"));
|
|
1694
|
-
await persistSession(state, line);
|
|
1695
1626
|
continue;
|
|
1696
1627
|
}
|
|
1697
1628
|
// Still save the exchange so /history doesn't lose conversations
|
|
1698
1629
|
// that hit transient errors (e.g. "requires root", network timeout).
|
|
1699
1630
|
const errMsg = error instanceof Error ? error.message : String(error);
|
|
1700
|
-
|
|
1701
|
-
state.messages.push({ role: "user", content: line }, { role: "assistant", content: `[error: ${errMsg}]` });
|
|
1702
|
-
}
|
|
1631
|
+
state.messages.push({ role: "user", content: line }, { role: "assistant", content: `[error: ${errMsg}]` });
|
|
1703
1632
|
console.error(chalk.red(errMsg));
|
|
1704
|
-
await persistSession(state, line);
|
|
1705
1633
|
}
|
|
1706
1634
|
}
|
|
1707
1635
|
}
|