@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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure display helpers for the plan pane + Ctrl+P pager body (PLAN-001, V2-070).
|
|
3
|
+
*/
|
|
4
|
+
import { planProgress } from "../../store/plan.js";
|
|
5
|
+
export const TASK_GLYPH = {
|
|
6
|
+
pending: "○",
|
|
7
|
+
in_progress: "◉",
|
|
8
|
+
done: "✓",
|
|
9
|
+
failed: "✗",
|
|
10
|
+
skipped: "–",
|
|
11
|
+
};
|
|
12
|
+
export const TASK_STATE_LABEL = {
|
|
13
|
+
pending: "pending",
|
|
14
|
+
in_progress: "active",
|
|
15
|
+
done: "done",
|
|
16
|
+
failed: "failed",
|
|
17
|
+
skipped: "skipped",
|
|
18
|
+
};
|
|
19
|
+
export const STATUS_LABEL = {
|
|
20
|
+
draft: "draft",
|
|
21
|
+
approved: "approved",
|
|
22
|
+
in_progress: "in progress",
|
|
23
|
+
completed: "completed",
|
|
24
|
+
abandoned: "abandoned",
|
|
25
|
+
};
|
|
26
|
+
export function planStatusColor(status) {
|
|
27
|
+
switch (status) {
|
|
28
|
+
case "completed":
|
|
29
|
+
return "success";
|
|
30
|
+
case "in_progress":
|
|
31
|
+
case "approved":
|
|
32
|
+
return "activity";
|
|
33
|
+
case "draft":
|
|
34
|
+
return "cyan";
|
|
35
|
+
case "abandoned":
|
|
36
|
+
return "muted";
|
|
37
|
+
default:
|
|
38
|
+
return "foreground";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function taskStateColor(state) {
|
|
42
|
+
switch (state) {
|
|
43
|
+
case "done":
|
|
44
|
+
return "success";
|
|
45
|
+
case "in_progress":
|
|
46
|
+
return "activity";
|
|
47
|
+
case "failed":
|
|
48
|
+
return "accent";
|
|
49
|
+
case "skipped":
|
|
50
|
+
return "muted";
|
|
51
|
+
case "pending":
|
|
52
|
+
default:
|
|
53
|
+
return "muted";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function progressView(plan) {
|
|
57
|
+
const { done, total } = planProgress(plan);
|
|
58
|
+
if (total === 0)
|
|
59
|
+
return { done: 0, total: 0, label: "no tasks" };
|
|
60
|
+
if (done === total)
|
|
61
|
+
return { done, total, label: `${done}/${total} complete` };
|
|
62
|
+
return { done, total, label: `${done}/${total} tasks` };
|
|
63
|
+
}
|
|
64
|
+
export function taskLabel(task) {
|
|
65
|
+
return `${TASK_GLYPH[task.state]} ${task.id} ${task.title}`;
|
|
66
|
+
}
|
|
67
|
+
export function activeTaskId(plan) {
|
|
68
|
+
return plan.tasks.find((t) => t.state === "pending" || t.state === "in_progress")?.id;
|
|
69
|
+
}
|
|
70
|
+
/** Soft-wrap without ellipsis — full text, never truncated. */
|
|
71
|
+
export function wrapPlanText(text, width) {
|
|
72
|
+
const clean = text.replace(/\s+/g, " ").trim();
|
|
73
|
+
if (!clean)
|
|
74
|
+
return [""];
|
|
75
|
+
const max = Math.max(8, width);
|
|
76
|
+
if (clean.length <= max)
|
|
77
|
+
return [clean];
|
|
78
|
+
const lines = [];
|
|
79
|
+
let rest = clean;
|
|
80
|
+
while (rest.length > max) {
|
|
81
|
+
let breakAt = rest.lastIndexOf(" ", max);
|
|
82
|
+
if (breakAt < Math.floor(max * 0.35))
|
|
83
|
+
breakAt = max;
|
|
84
|
+
lines.push(rest.slice(0, breakAt).trimEnd());
|
|
85
|
+
rest = rest.slice(breakAt).trimStart();
|
|
86
|
+
}
|
|
87
|
+
if (rest)
|
|
88
|
+
lines.push(rest);
|
|
89
|
+
return lines;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Strip redundant `t1:` / `t1 -` prefixes when the model baked the task id
|
|
93
|
+
* into the title (keeps the pager readable).
|
|
94
|
+
*/
|
|
95
|
+
export function cleanTaskTitle(task) {
|
|
96
|
+
let title = task.title.replace(/\s+/g, " ").trim();
|
|
97
|
+
const id = task.id.trim();
|
|
98
|
+
if (!id)
|
|
99
|
+
return title;
|
|
100
|
+
// t1: … | t1 - … | t1. … | [t1] …
|
|
101
|
+
const re = new RegExp(`^\\[?${id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\]?\\s*[:.\\-)–—]\\s*`, "i");
|
|
102
|
+
title = title.replace(re, "");
|
|
103
|
+
return title || task.title.trim();
|
|
104
|
+
}
|
|
105
|
+
const PAGER_WIDTH = 76;
|
|
106
|
+
const RULE = "─".repeat(PAGER_WIDTH);
|
|
107
|
+
function pushWrapped(lines, text, prefix, width) {
|
|
108
|
+
const bodyWidth = Math.max(12, width - prefix.length);
|
|
109
|
+
const wrapped = wrapPlanText(text, bodyWidth);
|
|
110
|
+
for (let i = 0; i < wrapped.length; i++) {
|
|
111
|
+
lines.push(i === 0 ? `${prefix}${wrapped[i]}` : `${" ".repeat(prefix.length)}${wrapped[i]}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Full plan body for the OpenTUI pager (Ctrl+P / /plan).
|
|
116
|
+
* Plain text only — no chalk/ANSI (those look messy in the pager).
|
|
117
|
+
* Tasks are card-like blocks with clear rules between them.
|
|
118
|
+
*/
|
|
119
|
+
export function formatPlanPagerDocument(plan) {
|
|
120
|
+
const { done, total } = planProgress(plan);
|
|
121
|
+
const lines = [];
|
|
122
|
+
lines.push(plan.goal.trim() || "Untitled plan");
|
|
123
|
+
lines.push("");
|
|
124
|
+
lines.push(`Status ${STATUS_LABEL[plan.status]} Progress ${done}/${total} Kind ${plan.kind || "general"}`);
|
|
125
|
+
lines.push(`Updated ${plan.updatedAt.replace("T", " ").slice(0, 19)}`);
|
|
126
|
+
lines.push("");
|
|
127
|
+
lines.push(RULE);
|
|
128
|
+
lines.push("");
|
|
129
|
+
const detail = plan.detail.trim();
|
|
130
|
+
if (detail) {
|
|
131
|
+
lines.push("Approach");
|
|
132
|
+
lines.push("");
|
|
133
|
+
for (const raw of detail.split(/\r?\n/)) {
|
|
134
|
+
const line = raw.replace(/\t/g, " ");
|
|
135
|
+
if (line.trim() === "") {
|
|
136
|
+
lines.push("");
|
|
137
|
+
}
|
|
138
|
+
else if (/^#{1,6}\s/.test(line.trim())) {
|
|
139
|
+
lines.push(line.trim().replace(/^#+\s*/, ""));
|
|
140
|
+
}
|
|
141
|
+
else if (/^[-*•]\s/.test(line.trim()) || /^\d+[.)]\s/.test(line.trim())) {
|
|
142
|
+
pushWrapped(lines, line.trim(), " ", PAGER_WIDTH);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
pushWrapped(lines, line.trim(), " ", PAGER_WIDTH);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
lines.push("");
|
|
149
|
+
lines.push(RULE);
|
|
150
|
+
lines.push("");
|
|
151
|
+
}
|
|
152
|
+
lines.push(`Tasks (${total})`);
|
|
153
|
+
lines.push("");
|
|
154
|
+
if (plan.tasks.length === 0) {
|
|
155
|
+
lines.push(" (no tasks)");
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
plan.tasks.forEach((task, i) => {
|
|
159
|
+
const glyph = TASK_GLYPH[task.state] ?? "○";
|
|
160
|
+
const state = TASK_STATE_LABEL[task.state] ?? task.state;
|
|
161
|
+
const num = String(i + 1).padStart(2, " ");
|
|
162
|
+
const title = cleanTaskTitle(task);
|
|
163
|
+
// Card header: glyph + index + title (wrapped)
|
|
164
|
+
pushWrapped(lines, title, `${glyph} ${num}. `, PAGER_WIDTH);
|
|
165
|
+
// State as a clean tag line (not free-floating "done")
|
|
166
|
+
lines.push(` [${state}] ${task.id}`);
|
|
167
|
+
if (task.note?.trim()) {
|
|
168
|
+
pushWrapped(lines, task.note.trim(), " note ", PAGER_WIDTH);
|
|
169
|
+
}
|
|
170
|
+
// Boundary between tasks
|
|
171
|
+
if (i < plan.tasks.length - 1) {
|
|
172
|
+
lines.push("");
|
|
173
|
+
lines.push(RULE);
|
|
174
|
+
lines.push("");
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
lines.push("");
|
|
179
|
+
lines.push(RULE);
|
|
180
|
+
lines.push("");
|
|
181
|
+
if (plan.status === "draft") {
|
|
182
|
+
lines.push("Next: /implement to approve and run, or refine the plan in chat.");
|
|
183
|
+
}
|
|
184
|
+
else if (plan.status === "approved" || plan.status === "in_progress") {
|
|
185
|
+
lines.push("Plan is approved — the agent marks tasks as they complete.");
|
|
186
|
+
}
|
|
187
|
+
else if (plan.status === "completed") {
|
|
188
|
+
lines.push("All tasks completed.");
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
lines.push(`Plan status: ${STATUS_LABEL[plan.status]}.`);
|
|
192
|
+
}
|
|
193
|
+
lines.push("q/esc:close · ↑↓:scroll · ^r:search");
|
|
194
|
+
return lines.join("\n");
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=plan-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-view.js","sourceRoot":"","sources":["../../../src/tui-v2/rendering/plan-view.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AASnD,MAAM,CAAC,MAAM,UAAU,GAA8B;IACnD,OAAO,EAAE,GAAG;IACZ,WAAW,EAAE,GAAG;IAChB,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,GAAG;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAA+B;IACtD,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;I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I,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;QACvE,KAAK,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;IAC3E,CAAC;SAAM,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;QACvC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACrC,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,gBAAgB,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;IAEtD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classic-parity markdown for OpenTUI transcript rows.
|
|
3
|
+
*
|
|
4
|
+
* OpenTUI's native `<markdown>` component does not expand `<br>`, and its
|
|
5
|
+
* table styling diverges from classic clai. We reuse `renderMarkdown` from
|
|
6
|
+
* `ui/markdown.ts` (tables, fences, lists, `<br>`, …) and convert the ANSI
|
|
7
|
+
* output into OpenTUI `StyledText` chunks.
|
|
8
|
+
*/
|
|
9
|
+
import { ansiToStyledText } from "./ansi-to-styled.js";
|
|
10
|
+
type StyledLine = ReturnType<typeof ansiToStyledText>;
|
|
11
|
+
export interface RenderMarkdownLinesOptions {
|
|
12
|
+
/** Wrap budget in columns (classic uses terminal width − chrome). */
|
|
13
|
+
readonly width: number;
|
|
14
|
+
/** Default body color (assistant replies use theme.response green). */
|
|
15
|
+
readonly defaultFg?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* `renderMarkdown` prefixes every line with two spaces; strip them when the
|
|
18
|
+
* caller already pads the container (assistant box uses paddingLeft: 2).
|
|
19
|
+
*/
|
|
20
|
+
readonly stripOuterIndent?: boolean | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Pre-normalize a few HTML-ish tokens models emit so classic markdown sees
|
|
24
|
+
* clean source (beyond the `<br>` expansion it already does).
|
|
25
|
+
*/
|
|
26
|
+
export declare function preprocessAssistantMarkdown(text: string): string;
|
|
27
|
+
/** Render markdown into one StyledText line per physical row. */
|
|
28
|
+
export declare function renderMarkdownLines(text: string, options: RenderMarkdownLinesOptions): StyledLine[];
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classic-parity markdown for OpenTUI transcript rows.
|
|
3
|
+
*
|
|
4
|
+
* OpenTUI's native `<markdown>` component does not expand `<br>`, and its
|
|
5
|
+
* table styling diverges from classic clai. We reuse `renderMarkdown` from
|
|
6
|
+
* `ui/markdown.ts` (tables, fences, lists, `<br>`, …) and convert the ANSI
|
|
7
|
+
* output into OpenTUI `StyledText` chunks.
|
|
8
|
+
*/
|
|
9
|
+
import { renderMarkdown } from "../../ui/markdown.js";
|
|
10
|
+
import { ansiToStyledText } from "./ansi-to-styled.js";
|
|
11
|
+
/**
|
|
12
|
+
* Pre-normalize a few HTML-ish tokens models emit so classic markdown sees
|
|
13
|
+
* clean source (beyond the `<br>` expansion it already does).
|
|
14
|
+
*/
|
|
15
|
+
export function preprocessAssistantMarkdown(text) {
|
|
16
|
+
return text
|
|
17
|
+
// Non-breaking spaces → regular space so wrap math stays sane.
|
|
18
|
+
.replace(/\u00a0/g, " ")
|
|
19
|
+
// Common self-closing / HTML line breaks that slip past some model paths.
|
|
20
|
+
.replace(/<\/?br\s*\/?>/gi, "<br>")
|
|
21
|
+
// Paragraph breaks occasionally emitted as HTML.
|
|
22
|
+
.replace(/<\/p>\s*<p[^>]*>/gi, "\n\n")
|
|
23
|
+
.replace(/<\/?p[^>]*>/gi, "\n")
|
|
24
|
+
// Horizontal rules as HTML.
|
|
25
|
+
.replace(/<hr\s*\/?>/gi, "\n---\n");
|
|
26
|
+
}
|
|
27
|
+
/** Render markdown into one StyledText line per physical row. */
|
|
28
|
+
export function renderMarkdownLines(text, options) {
|
|
29
|
+
if (!text)
|
|
30
|
+
return [];
|
|
31
|
+
const prepared = preprocessAssistantMarkdown(text);
|
|
32
|
+
const width = Math.max(20, options.width);
|
|
33
|
+
const rendered = renderMarkdown(prepared, width).replace(/\n+$/, "");
|
|
34
|
+
if (!rendered)
|
|
35
|
+
return [];
|
|
36
|
+
return rendered.split("\n").map((line) => {
|
|
37
|
+
let body = line;
|
|
38
|
+
if (options.stripOuterIndent && body.startsWith(" ")) {
|
|
39
|
+
body = body.slice(2);
|
|
40
|
+
}
|
|
41
|
+
return ansiToStyledText(body.length === 0 ? " " : body, {
|
|
42
|
+
defaultFg: options.defaultFg,
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=render-markdown-lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-markdown-lines.js","sourceRoot":"","sources":["../../../src/tui-v2/rendering/render-markdown-lines.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAgBvD;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAAY;IACtD,OAAO,IAAI;QACT,+DAA+D;SAC9D,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;QACxB,0EAA0E;SACzE,OAAO,CAAC,iBAAiB,EAAE,MAAM,CAAC;QACnC,iDAAiD;SAChD,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC;SACrC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC;QAC/B,4BAA4B;SAC3B,OAAO,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;AACxC,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,OAAmC;IAEnC,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,MAAM,QAAQ,GAAG,2BAA2B,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACrE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACvC,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,OAAO,CAAC,gBAAgB,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACtD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE;YACtD,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display-safe text sanitization (QUALITY visual correctness / V2-094).
|
|
3
|
+
*
|
|
4
|
+
* External content (tool output, model text, paste) can carry C0/C1 controls
|
|
5
|
+
* and OSC/CSI sequences that corrupt a terminal or inject misleading UI.
|
|
6
|
+
* This pure helper strips those bytes while preserving ordinary newlines,
|
|
7
|
+
* tabs, and Unicode. Clipboard/export paths should run content through here
|
|
8
|
+
* before writing terminal-facing strings.
|
|
9
|
+
*/
|
|
10
|
+
export declare function stripAnsiSequences(text: string): string;
|
|
11
|
+
export declare function stripControlChars(text: string): string;
|
|
12
|
+
/** Full display sanitize: ANSI first, then remaining control characters. */
|
|
13
|
+
export declare function sanitizeDisplayText(text: string): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display-safe text sanitization (QUALITY visual correctness / V2-094).
|
|
3
|
+
*
|
|
4
|
+
* External content (tool output, model text, paste) can carry C0/C1 controls
|
|
5
|
+
* and OSC/CSI sequences that corrupt a terminal or inject misleading UI.
|
|
6
|
+
* This pure helper strips those bytes while preserving ordinary newlines,
|
|
7
|
+
* tabs, and Unicode. Clipboard/export paths should run content through here
|
|
8
|
+
* before writing terminal-facing strings.
|
|
9
|
+
*/
|
|
10
|
+
// CSI / OSC / DCS first (order matters: bare ESC+letter must not swallow `]`).
|
|
11
|
+
const ANSI_ESCAPE_RE = /\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\)?|P[^\x1b]*(?:\x1b\\)?|[@-Z\\_])/g;
|
|
12
|
+
// C0 controls except TAB (0x09) and LF (0x0a); DEL; C1 0x80–0x9f.
|
|
13
|
+
const CONTROL_CHARS_RE = /[\x00-\x08\x0b-\x1a\x1c-\x1f\x7f\x80-\x9f]/g;
|
|
14
|
+
export function stripAnsiSequences(text) {
|
|
15
|
+
return text.replace(ANSI_ESCAPE_RE, "");
|
|
16
|
+
}
|
|
17
|
+
export function stripControlChars(text) {
|
|
18
|
+
return text.replace(CONTROL_CHARS_RE, "");
|
|
19
|
+
}
|
|
20
|
+
/** Full display sanitize: ANSI first, then remaining control characters. */
|
|
21
|
+
export function sanitizeDisplayText(text) {
|
|
22
|
+
return stripControlChars(stripAnsiSequences(text));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=sanitize-display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-display.js","sourceRoot":"","sources":["../../../src/tui-v2/rendering/sanitize-display.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAC/E,MAAM,cAAc,GAClB,2FAA2F,CAAC;AAC9F,kEAAkE;AAClE,MAAM,gBAAgB,GAAG,6CAA6C,CAAC;AAEvE,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remove tool-call surfaces from assistant display text so the TUI never
|
|
3
|
+
* flashes raw ```tool JSON (or XML tool_call blocks) before tool cards appear.
|
|
4
|
+
*
|
|
5
|
+
* Safe for streaming: incomplete trailing fences are stripped from the cursor
|
|
6
|
+
* to end-of-string so mid-fence tokens never paint.
|
|
7
|
+
*/
|
|
8
|
+
export declare function stripToolCallSurfaces(text: string): string;
|
|
9
|
+
/** True when stripping leaves nothing meaningful for a Response card. */
|
|
10
|
+
export declare function isToolFenceOnlyText(text: string): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remove tool-call surfaces from assistant display text so the TUI never
|
|
3
|
+
* flashes raw ```tool JSON (or XML tool_call blocks) before tool cards appear.
|
|
4
|
+
*
|
|
5
|
+
* Safe for streaming: incomplete trailing fences are stripped from the cursor
|
|
6
|
+
* to end-of-string so mid-fence tokens never paint.
|
|
7
|
+
*/
|
|
8
|
+
const COMPLETE_TOOL_FENCE = /```(?:tool|json\s*tool)\b[^\n]*\n[\s\S]*?```/gi;
|
|
9
|
+
const TRAILING_TOOL_FENCE = /```(?:tool|json\s*tool)\b[\s\S]*$/i;
|
|
10
|
+
const COMPLETE_TOOL_XML = /<tool_call\b[^>]*>[\s\S]*?<\/tool_call>/gi;
|
|
11
|
+
const TRAILING_TOOL_XML = /<tool_call\b[^>]*>[\s\S]*$/i;
|
|
12
|
+
/** Kimi / sentinel-style blocks sometimes leak as prose. */
|
|
13
|
+
const COMPLETE_TOOL_SENTINEL = /(?:^|\n)\s*(?:tool_call|invoke_tool)\s*\([\s\S]*?\)\s*(?=\n|$)/gi;
|
|
14
|
+
export function stripToolCallSurfaces(text) {
|
|
15
|
+
if (!text)
|
|
16
|
+
return text;
|
|
17
|
+
let s = text;
|
|
18
|
+
s = s.replace(COMPLETE_TOOL_FENCE, "");
|
|
19
|
+
s = s.replace(TRAILING_TOOL_FENCE, "");
|
|
20
|
+
s = s.replace(COMPLETE_TOOL_XML, "");
|
|
21
|
+
s = s.replace(TRAILING_TOOL_XML, "");
|
|
22
|
+
s = s.replace(COMPLETE_TOOL_SENTINEL, "\n");
|
|
23
|
+
// Collapse leftover blank runs from removed fences.
|
|
24
|
+
s = s.replace(/[ \t]+\n/g, "\n");
|
|
25
|
+
s = s.replace(/\n{3,}/g, "\n\n");
|
|
26
|
+
return s;
|
|
27
|
+
}
|
|
28
|
+
/** True when stripping leaves nothing meaningful for a Response card. */
|
|
29
|
+
export function isToolFenceOnlyText(text) {
|
|
30
|
+
return stripToolCallSurfaces(text).trim().length === 0;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=strip-tool-surfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip-tool-surfaces.js","sourceRoot":"","sources":["../../../src/tui-v2/rendering/strip-tool-surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,mBAAmB,GACvB,gDAAgD,CAAC;AACnD,MAAM,mBAAmB,GAAG,oCAAoC,CAAC;AACjE,MAAM,iBAAiB,GAAG,2CAA2C,CAAC;AACtE,MAAM,iBAAiB,GAAG,6BAA6B,CAAC;AACxD,4DAA4D;AAC5D,MAAM,sBAAsB,GAC1B,kEAAkE,CAAC;AAErE,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,IAAI,CAAC,GAAG,IAAI,CAAC;IACb,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;IACrC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;IACrC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;IAC5C,oDAAoD;IACpD,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLAI theme tokens (V2-030 / QUALITY "visual correctness").
|
|
3
|
+
*
|
|
4
|
+
* Palette is anchored to the CLAI wordmark gradient (magenta → blue → cyan)
|
|
5
|
+
* plus the legacy amber mode badge, green READY/success, and aqua chrome.
|
|
6
|
+
* Components should pull from these tokens — never scatter raw hex.
|
|
7
|
+
*/
|
|
8
|
+
import type { ThemeHint } from "../bootstrap/capabilities.js";
|
|
9
|
+
export interface Theme {
|
|
10
|
+
readonly background: string;
|
|
11
|
+
readonly foreground: string;
|
|
12
|
+
readonly muted: string;
|
|
13
|
+
readonly accent: string;
|
|
14
|
+
readonly border: string;
|
|
15
|
+
readonly statusBackground: string;
|
|
16
|
+
/** Selected row / focus highlight (legacy #2563EB). */
|
|
17
|
+
readonly selection: string;
|
|
18
|
+
/** Alternating list row A (legacy #1E293B). */
|
|
19
|
+
readonly rowA: string;
|
|
20
|
+
/** Alternating list row B (legacy #0F172A). */
|
|
21
|
+
readonly rowB: string;
|
|
22
|
+
/** Chip / badge slate (legacy #334155). */
|
|
23
|
+
readonly chip: string;
|
|
24
|
+
/** Mode badge amber / RUNNING (legacy #B45309). */
|
|
25
|
+
readonly mode: string;
|
|
26
|
+
/** Success / READY / allow-all green. */
|
|
27
|
+
readonly success: string;
|
|
28
|
+
/**
|
|
29
|
+
* Wordmark top-of-"I" magenta (`WORDMARK_TOP_HEX` / chalk.magentaBright).
|
|
30
|
+
* Used for plan/task pane border, agent-card frame, output accents.
|
|
31
|
+
*/
|
|
32
|
+
readonly magenta: string;
|
|
33
|
+
/** Soft cyan for command labels (legacy #67E8F9). */
|
|
34
|
+
readonly cyan: string;
|
|
35
|
+
readonly white: string;
|
|
36
|
+
/** Assistant / model reply body (user request: green chat text). */
|
|
37
|
+
readonly response: string;
|
|
38
|
+
/** Amber/yellow activity text while RUNNING (legacy yellow). */
|
|
39
|
+
readonly activity: string;
|
|
40
|
+
/** Spinner color while RUNNING (legacy magenta). */
|
|
41
|
+
readonly spinner: string;
|
|
42
|
+
/** Queued badge amber-dark (legacy #854D0E). */
|
|
43
|
+
readonly queued: string;
|
|
44
|
+
/** Teal chip for idle command shortcuts (richer than flat slate). */
|
|
45
|
+
readonly chipTeal: string;
|
|
46
|
+
/** Indigo chip alternate for idle shortcuts. */
|
|
47
|
+
readonly chipIndigo: string;
|
|
48
|
+
/**
|
|
49
|
+
* Prompt / YOU badge background — same as the CTRL+O OUTPUT chip so user
|
|
50
|
+
* chrome and output chrome share one brand accent.
|
|
51
|
+
*/
|
|
52
|
+
readonly prompt: string;
|
|
53
|
+
/** Thinking / reasoning text (violet). */
|
|
54
|
+
readonly thinking: string;
|
|
55
|
+
/**
|
|
56
|
+
* Input / composer border, ❯ mark, and cursor — electric aqua, a step
|
|
57
|
+
* stronger than the `/` command menu border (`theme.border` #22D3EE).
|
|
58
|
+
*/
|
|
59
|
+
readonly inputBorder: string;
|
|
60
|
+
/** User prompt bubble border — soft magenta. */
|
|
61
|
+
readonly userBorder: string;
|
|
62
|
+
/** Tool output card border — blue from wordmark mid gradient. */
|
|
63
|
+
readonly toolBorder: string;
|
|
64
|
+
/** Modal accent border. */
|
|
65
|
+
readonly modalBorder: string;
|
|
66
|
+
}
|
|
67
|
+
export declare function themeFor(hint: ThemeHint): Theme;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLAI theme tokens (V2-030 / QUALITY "visual correctness").
|
|
3
|
+
*
|
|
4
|
+
* Palette is anchored to the CLAI wordmark gradient (magenta → blue → cyan)
|
|
5
|
+
* plus the legacy amber mode badge, green READY/success, and aqua chrome.
|
|
6
|
+
* Components should pull from these tokens — never scatter raw hex.
|
|
7
|
+
*/
|
|
8
|
+
const DARK_THEME = {
|
|
9
|
+
background: "#0b0e14",
|
|
10
|
+
foreground: "#F8FAFC",
|
|
11
|
+
muted: "#94A3B8",
|
|
12
|
+
accent: "#5cc8ff",
|
|
13
|
+
border: "#22D3EE",
|
|
14
|
+
statusBackground: "#11151c",
|
|
15
|
+
selection: "#2563EB",
|
|
16
|
+
rowA: "#1E293B",
|
|
17
|
+
rowB: "#0F172A",
|
|
18
|
+
chip: "#334155",
|
|
19
|
+
mode: "#B45309",
|
|
20
|
+
success: "#166534",
|
|
21
|
+
// Top of CLAI wordmark "I" (magentaBright) — plan pane + agent card frame.
|
|
22
|
+
magenta: "#FF55FF",
|
|
23
|
+
cyan: "#67E8F9",
|
|
24
|
+
white: "#FFFFFF",
|
|
25
|
+
response: "#4ADE80",
|
|
26
|
+
activity: "#FACC15",
|
|
27
|
+
spinner: "#E879F9",
|
|
28
|
+
queued: "#854D0E",
|
|
29
|
+
chipTeal: "#0E7490",
|
|
30
|
+
chipIndigo: "#3730A3",
|
|
31
|
+
// Match CTRL+O OUTPUT chip bg for YOU / prompt chrome.
|
|
32
|
+
prompt: "#0E7490",
|
|
33
|
+
thinking: "#A78BFA",
|
|
34
|
+
// Stronger aqua than /command border (#22D3EE) — high-sat electric cyan.
|
|
35
|
+
inputBorder: "#2EEBFF",
|
|
36
|
+
userBorder: "#0E7490",
|
|
37
|
+
toolBorder: "#3B82F6",
|
|
38
|
+
modalBorder: "#22D3EE",
|
|
39
|
+
};
|
|
40
|
+
const LIGHT_THEME = {
|
|
41
|
+
background: "#fdfdfd",
|
|
42
|
+
foreground: "#1c1f24",
|
|
43
|
+
muted: "#6b7280",
|
|
44
|
+
accent: "#0969da",
|
|
45
|
+
border: "#0891B2",
|
|
46
|
+
statusBackground: "#f0f2f4",
|
|
47
|
+
selection: "#0969da",
|
|
48
|
+
rowA: "#eef2f7",
|
|
49
|
+
rowB: "#f8fafc",
|
|
50
|
+
chip: "#e2e8f0",
|
|
51
|
+
mode: "#B45309",
|
|
52
|
+
success: "#166534",
|
|
53
|
+
// Top of CLAI wordmark "I" (slightly deeper on light bg for contrast).
|
|
54
|
+
magenta: "#D946EF",
|
|
55
|
+
cyan: "#0891b2",
|
|
56
|
+
white: "#FFFFFF",
|
|
57
|
+
response: "#15803d",
|
|
58
|
+
activity: "#a16207",
|
|
59
|
+
spinner: "#a21caf",
|
|
60
|
+
queued: "#854D0E",
|
|
61
|
+
chipTeal: "#0e7490",
|
|
62
|
+
chipIndigo: "#4338ca",
|
|
63
|
+
prompt: "#0e7490",
|
|
64
|
+
thinking: "#7c3aed",
|
|
65
|
+
// Stronger aqua than /command border (#0891B2) for light terminals.
|
|
66
|
+
inputBorder: "#06B6D4",
|
|
67
|
+
userBorder: "#0e7490",
|
|
68
|
+
toolBorder: "#2563eb",
|
|
69
|
+
modalBorder: "#0891B2",
|
|
70
|
+
};
|
|
71
|
+
export function themeFor(hint) {
|
|
72
|
+
return hint === "light" ? LIGHT_THEME : DARK_THEME;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/tui-v2/rendering/theme.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+DH,MAAM,UAAU,GAAU;IACxB,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,gBAAgB,EAAE,SAAS;IAC3B,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS;IAClB,2EAA2E;IAC3E,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;IACrB,uDAAuD;IACvD,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,yEAAyE;IACzE,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,SAAS;CACvB,CAAC;AAEF,MAAM,WAAW,GAAU;IACzB,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,gBAAgB,EAAE,SAAS;IAC3B,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS;IAClB,uEAAuE;IACvE,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;IACrB,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,oEAAoE;IACpE,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,SAAS;CACvB,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,IAAe;IACtC,OAAO,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure presentation logic for tool cards (CHAT-004/005, V2-054/055).
|
|
3
|
+
*
|
|
4
|
+
* Collapsed cards must stay cheap even when the spool holds multi‑MB output
|
|
5
|
+
* (no full-string split on every render). Full bodies open in the pager.
|
|
6
|
+
*/
|
|
7
|
+
import type { BoundedTextState } from "../../app/events/event-buffer.js";
|
|
8
|
+
import type { ToolItem } from "../state/transcript-types.js";
|
|
9
|
+
export interface ToolPresentation {
|
|
10
|
+
readonly glyph: string;
|
|
11
|
+
readonly statusLabel: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly argsLabel: string | undefined;
|
|
14
|
+
readonly argsDisplay: string | undefined;
|
|
15
|
+
readonly detail: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare function presentTool(item: ToolItem): ToolPresentation;
|
|
18
|
+
export interface OutputPresentation {
|
|
19
|
+
readonly lines: readonly string[];
|
|
20
|
+
readonly hiddenAboveCount: number;
|
|
21
|
+
readonly truncatedNotice: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Sample start+end of a huge string so we never `.split("\n")` a multi‑MB body
|
|
25
|
+
* just to draw a collapsed card.
|
|
26
|
+
*/
|
|
27
|
+
export declare function sampleEnds(raw: string, eachEnd?: number): string;
|
|
28
|
+
export declare function cleanToolOutputLines(raw: string, options?: {
|
|
29
|
+
readonly maxLineChars?: number;
|
|
30
|
+
}): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Card body presentation.
|
|
33
|
+
*
|
|
34
|
+
* Collapsed: head + tail with a mid-body “··· N lines more ···” gap so the end
|
|
35
|
+
* of streaming output stays visible. Expanded (Ctrl+O): full cleaned body in
|
|
36
|
+
* place (classic parity). The unbounded raw body always lives in the spool /
|
|
37
|
+
* artifact and the click-to-open pager modal.
|
|
38
|
+
*/
|
|
39
|
+
export declare function presentOutput(tail: string, state: BoundedTextState | undefined, expanded: boolean): OutputPresentation;
|