@bubblebrain-ai/bubble 0.0.52 → 0.0.54
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 +4 -12
- package/dist/agent/routing-catalog.js +3 -2
- package/dist/agent/subagent/router.js +5 -0
- package/dist/agent/subagent/runtime.d.ts +1 -0
- package/dist/agent/subagent/runtime.js +13 -1
- package/dist/agent/subagent-control.d.ts +4 -0
- package/dist/agent/subagent-control.js +1 -0
- package/dist/agent/subagent-store.js +2 -0
- package/dist/agent/workflow/control.d.ts +2 -0
- package/dist/agent/workflow/runs.d.ts +1 -0
- package/dist/agent/workflow/runs.js +3 -0
- package/dist/agent.d.ts +11 -1
- package/dist/agent.js +158 -57
- package/dist/bin.js +2 -44
- package/dist/config.d.ts +14 -1
- package/dist/config.js +45 -4
- package/dist/context/budget.d.ts +7 -1
- package/dist/context/budget.js +25 -2
- package/dist/context/compact-llm.d.ts +1 -1
- package/dist/context/compact-llm.js +5 -2
- package/dist/context/overflow.js +2 -0
- package/dist/context/projector.d.ts +8 -0
- package/dist/context/projector.js +55 -6
- package/dist/context/tool-output-truncate.d.ts +17 -1
- package/dist/context/tool-output-truncate.js +171 -49
- package/dist/feishu/agent-host/run-driver.js +3 -0
- package/dist/feishu/serve.js +2 -0
- package/dist/goal/command.d.ts +1 -1
- package/dist/goal/command.js +7 -2
- package/dist/main.d.ts +1 -1
- package/dist/main.js +38 -8
- package/dist/memory/db.js +0 -7
- package/dist/model-catalog.js +25 -6
- package/dist/model-config.js +3 -2
- package/dist/model-pricing.d.ts +24 -5
- package/dist/model-pricing.js +0 -0
- package/dist/model-selection.js +13 -4
- package/dist/network/chatgpt-transport.js +0 -34
- package/dist/network/errors.d.ts +19 -0
- package/dist/network/errors.js +24 -0
- package/dist/network/provider-transport.d.ts +0 -4
- package/dist/network/provider-transport.js +3 -35
- package/dist/network/retry.d.ts +6 -1
- package/dist/network/retry.js +9 -0
- package/dist/provider-model-policy.d.ts +16 -0
- package/dist/provider-model-policy.js +33 -0
- package/dist/provider-registry.d.ts +1 -1
- package/dist/provider-registry.js +73 -10
- package/dist/provider-transform.js +32 -4
- package/dist/provider.d.ts +6 -2
- package/dist/provider.js +95 -6
- package/dist/question/controller.js +5 -4
- package/dist/question/normalize.d.ts +6 -0
- package/dist/question/normalize.js +11 -0
- package/dist/rewind.d.ts +20 -0
- package/dist/rewind.js +29 -0
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +11 -3
- package/dist/session.d.ts +7 -0
- package/dist/session.js +20 -0
- package/dist/skills/discovery.js +18 -0
- package/dist/skills/registry.d.ts +12 -2
- package/dist/skills/registry.js +40 -5
- package/dist/skills/types.d.ts +2 -0
- package/dist/slash-commands/commands.js +120 -81
- package/dist/slash-commands/registry.d.ts +2 -1
- package/dist/slash-commands/registry.js +3 -0
- package/dist/slash-commands/types.d.ts +22 -4
- package/dist/stats/usage.d.ts +3 -1
- package/dist/stats/usage.js +22 -13
- package/dist/tasks/manager.d.ts +4 -2
- package/dist/tasks/manager.js +34 -9
- package/dist/tasks/promotion.d.ts +2 -2
- package/dist/tasks/promotion.js +2 -2
- package/dist/tools/agent-lifecycle.js +4 -0
- package/dist/tools/bash.d.ts +3 -1
- package/dist/tools/bash.js +13 -2
- package/dist/tools/grep.d.ts +5 -1
- package/dist/tools/grep.js +318 -69
- package/dist/tools/index.d.ts +3 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/question.js +5 -4
- package/dist/tools/read.js +40 -21
- package/dist/tui/animation-clock.d.ts +14 -0
- package/dist/tui/animation-clock.js +34 -0
- package/dist/tui/app.d.ts +176 -0
- package/dist/tui/app.js +1647 -0
- package/dist/tui/components/approval-dialog.d.ts +43 -0
- package/dist/tui/components/approval-dialog.js +247 -0
- package/dist/tui/components/bottom-sheet.d.ts +9 -0
- package/dist/tui/components/bottom-sheet.js +32 -0
- package/dist/tui/components/context-info.d.ts +54 -0
- package/dist/tui/components/context-info.js +388 -0
- package/dist/tui/components/feedback-dialog.d.ts +56 -0
- package/dist/tui/components/feedback-dialog.js +262 -0
- package/dist/tui/components/feishu-setup-dialog.d.ts +65 -0
- package/dist/tui/components/feishu-setup-dialog.js +332 -0
- package/dist/tui/components/image-preview.d.ts +32 -0
- package/dist/tui/components/image-preview.js +130 -0
- package/dist/tui/components/plan-dialog.d.ts +34 -0
- package/dist/tui/components/plan-dialog.js +196 -0
- package/dist/tui/components/provider-key-input.d.ts +18 -0
- package/dist/tui/components/provider-key-input.js +49 -0
- package/dist/tui/components/question-dialog.d.ts +25 -0
- package/dist/tui/components/question-dialog.js +263 -0
- package/dist/tui/components/responsive-transcript.d.ts +31 -0
- package/dist/tui/components/responsive-transcript.js +77 -0
- package/dist/tui/components/rewind-picker.d.ts +62 -0
- package/dist/tui/components/rewind-picker.js +317 -0
- package/dist/tui/components/session-picker.d.ts +49 -0
- package/dist/tui/components/session-picker.js +303 -0
- package/dist/tui/components/skills-panel.d.ts +59 -0
- package/dist/tui/components/skills-panel.js +568 -0
- package/dist/tui/components/stats-panel.d.ts +40 -0
- package/dist/tui/components/stats-panel.js +301 -0
- package/dist/tui/components/streaming-message.d.ts +69 -0
- package/dist/tui/components/streaming-message.js +393 -0
- package/dist/tui/components/subagent-inspector.d.ts +28 -0
- package/dist/tui/components/subagent-inspector.js +127 -0
- package/dist/tui/components/task-inspector.d.ts +26 -0
- package/dist/tui/components/task-inspector.js +70 -0
- package/dist/tui/components/tasks-pane.d.ts +88 -0
- package/dist/tui/components/tasks-pane.js +416 -0
- package/dist/tui/components/transcript.d.ts +96 -0
- package/dist/tui/components/transcript.js +771 -0
- package/dist/tui/components/welcome.d.ts +20 -0
- package/dist/tui/components/welcome.js +133 -0
- package/dist/tui/components/workflow-inspector.d.ts +30 -0
- package/dist/tui/components/workflow-inspector.js +136 -0
- package/dist/tui/composer-autocomplete.d.ts +61 -0
- package/dist/tui/composer-autocomplete.js +383 -0
- package/dist/tui/composer-style.d.ts +7 -0
- package/dist/tui/composer-style.js +29 -0
- package/dist/tui/controller/agent-event-reducer.d.ts +75 -0
- package/dist/tui/controller/agent-event-reducer.js +238 -0
- package/dist/tui/controller/composer-controller.d.ts +95 -0
- package/dist/tui/controller/composer-controller.js +502 -0
- package/dist/tui/controller/controller.d.ts +194 -0
- package/dist/tui/controller/controller.js +1035 -0
- package/dist/tui/controller/effects.d.ts +71 -0
- package/dist/tui/controller/effects.js +1 -0
- package/dist/tui/controller/goal-runtime-controller.d.ts +47 -0
- package/dist/tui/controller/goal-runtime-controller.js +202 -0
- package/dist/tui/controller/input-queue-machine.d.ts +71 -0
- package/dist/tui/controller/input-queue-machine.js +121 -0
- package/dist/tui/controller/intents.d.ts +56 -0
- package/dist/tui/controller/intents.js +6 -0
- package/dist/tui/controller/overlay-controller.d.ts +64 -0
- package/dist/tui/controller/overlay-controller.js +129 -0
- package/dist/tui/controller/ports.d.ts +57 -0
- package/dist/tui/controller/ports.js +9 -0
- package/dist/tui/controller/session-transition.d.ts +54 -0
- package/dist/tui/controller/session-transition.js +68 -0
- package/dist/tui/controller/state.d.ts +14 -0
- package/dist/tui/controller/state.js +36 -0
- package/dist/tui/controller/task-runtime-controller.d.ts +66 -0
- package/dist/tui/controller/task-runtime-controller.js +158 -0
- package/dist/tui/footer.d.ts +37 -0
- package/dist/tui/footer.js +80 -0
- package/dist/{tui-ink → tui/formatting}/edit-diff.d.ts +1 -1
- package/dist/{tui-ink → tui/formatting}/edit-diff.js +1 -1
- package/dist/{tui-ink/app-helpers.d.ts → tui/formatting/summary.d.ts} +4 -4
- package/dist/{tui-ink/app-helpers.js → tui/formatting/summary.js} +2 -2
- package/dist/tui/fullscreen.d.ts +48 -0
- package/dist/tui/fullscreen.js +255 -0
- package/dist/tui/image-display.d.ts +4 -0
- package/dist/tui/image-display.js +30 -12
- package/dist/tui/markdown-style.d.ts +5 -0
- package/dist/tui/markdown-style.js +23 -0
- package/dist/{tui-ink → tui/model}/composer-buffer.js +1 -1
- package/dist/tui/model/composer-types.d.ts +17 -0
- package/dist/tui/model/composer-types.js +1 -0
- package/dist/{tui-ink → tui/model}/display-history.d.ts +7 -1
- package/dist/{tui-ink → tui/model}/display-reconstruct.d.ts +1 -1
- package/dist/{tui-ink → tui/model}/display-reconstruct.js +54 -6
- package/dist/{tui-ink → tui/model}/file-mentions.d.ts +2 -0
- package/dist/{tui-ink → tui/model}/file-mentions.js +4 -0
- package/dist/tui/model/image-attachment.d.ts +15 -0
- package/dist/tui/model/image-attachment.js +1 -0
- package/dist/{tui-ink → tui/model}/image-paste.d.ts +7 -1
- package/dist/{tui-ink → tui/model}/image-paste.js +46 -0
- package/dist/tui/model/input-history.d.ts +1 -0
- package/dist/tui/model/input-history.js +1 -0
- package/dist/{tui-ink → tui/model}/input-queue.d.ts +1 -1
- package/dist/{tui-ink → tui/model}/recent-activity.js +1 -1
- package/dist/{tui-ink → tui/model}/subagent-view.d.ts +17 -2
- package/dist/{tui-ink → tui/model}/subagent-view.js +125 -4
- package/dist/{tui-ink → tui/model}/submit-dedupe.d.ts +1 -1
- package/dist/tui/model/theme-style.d.ts +10 -0
- package/dist/tui/model/theme-style.js +79 -0
- package/dist/{tui-ink → tui/model}/theme.d.ts +11 -23
- package/dist/{tui-ink → tui/model}/theme.js +23 -38
- package/dist/{tui-ink → tui/model}/trace-groups.d.ts +2 -0
- package/dist/{tui-ink → tui/model}/trace-groups.js +91 -30
- package/dist/tui/model/trace-interaction.d.ts +63 -0
- package/dist/tui/model/trace-interaction.js +87 -0
- package/dist/tui/model-picker-data.d.ts +1 -2
- package/dist/tui/model-picker-data.js +8 -1
- package/dist/tui/model-switch.js +2 -0
- package/dist/{tui-ink → tui}/run-session-picker.d.ts +2 -3
- package/dist/tui/run-session-picker.js +64 -0
- package/dist/tui/run.d.ts +72 -0
- package/dist/tui/run.js +139 -0
- package/dist/tui/terminal/multiplexer.d.ts +5 -0
- package/dist/tui/terminal/multiplexer.js +14 -0
- package/dist/tui/testing/fake-agent.d.ts +24 -0
- package/dist/tui/testing/fake-agent.js +22 -0
- package/dist/tui/testing/spy-host.d.ts +21 -0
- package/dist/tui/testing/spy-host.js +55 -0
- package/dist/tui/trace-groups.js +27 -6
- package/dist/types.d.ts +7 -0
- package/dist/update/index.d.ts +1 -0
- package/dist/update/index.js +22 -17
- package/node_modules/@bubblebrain-ai/pi-tui/LICENSE +21 -0
- package/node_modules/@bubblebrain-ai/pi-tui/README.md +854 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.d.ts +26 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.js +121 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.d.ts +86 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.js +649 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.d.ts +13 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.js +36 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.d.ts +22 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.js +99 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.d.ts +22 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.js +36 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.d.ts +330 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.js +2344 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.d.ts +7 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.js +43 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.d.ts +28 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.js +82 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.d.ts +48 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.js +390 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.d.ts +31 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.js +67 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.d.ts +103 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.js +797 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.d.ts +56 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.js +179 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.d.ts +53 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.js +175 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.d.ts +50 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.js +174 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.d.ts +12 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.js +22 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.d.ts +32 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.js +109 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.d.ts +19 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.js +81 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.d.ts +13 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.js +48 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.d.ts +8 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.js +26 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.d.ts +39 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.js +2 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.d.ts +16 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.js +110 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.d.ts +31 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.js +42 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.d.ts +273 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.js +231 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.d.ts +184 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.js +1174 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.d.ts +28 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.js +46 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.d.ts +10 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.js +1268 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.d.ts +40 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.js +6 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.d.ts +42 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.js +335 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.d.ts +3 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.js +60 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.d.ts +56 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.js +363 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.d.ts +10 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.js +59 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.d.ts +116 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.js +518 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.d.ts +142 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.js +544 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.d.ts +11 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.js +11 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.d.ts +140 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.js +1334 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.d.ts +39 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.js +536 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.d.ts +338 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.js +1016 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.d.ts +17 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.js +27 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.d.ts +96 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.js +1193 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.d.ts +25 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.js +96 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.d.ts +73 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.d.ts.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.js +188 -0
- package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.js.map +1 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/README.md +20 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/build.sh +62 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/src/darwin-modifiers.c +70 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/win32/README.md +22 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/win32/build.mjs +229 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@bubblebrain-ai/pi-tui/native/win32/src/win32-console-mode.c +119 -0
- package/node_modules/@bubblebrain-ai/pi-tui/package.json +66 -0
- package/node_modules/get-east-asian-width/index.d.ts +60 -0
- package/node_modules/get-east-asian-width/index.js +30 -0
- package/node_modules/get-east-asian-width/license +9 -0
- package/node_modules/get-east-asian-width/lookup-data.js +21 -0
- package/node_modules/get-east-asian-width/lookup.js +138 -0
- package/node_modules/get-east-asian-width/package.json +71 -0
- package/node_modules/get-east-asian-width/readme.md +65 -0
- package/node_modules/get-east-asian-width/utilities.js +24 -0
- package/node_modules/marked/LICENSE +44 -0
- package/node_modules/marked/README.md +115 -0
- package/node_modules/marked/bin/main.js +284 -0
- package/node_modules/marked/bin/marked.js +16 -0
- package/node_modules/marked/lib/marked.d.ts +760 -0
- package/node_modules/marked/lib/marked.esm.js +77 -0
- package/node_modules/marked/lib/marked.esm.js.map +7 -0
- package/node_modules/marked/lib/marked.umd.js +79 -0
- package/node_modules/marked/lib/marked.umd.js.map +7 -0
- package/node_modules/marked/man/marked.1 +113 -0
- package/node_modules/marked/man/marked.1.md +93 -0
- package/node_modules/marked/package.json +103 -0
- package/package.json +25 -10
- package/dist/tui-ink/app.d.ts +0 -76
- package/dist/tui-ink/app.js +0 -2377
- package/dist/tui-ink/approval/approval-dialog.d.ts +0 -13
- package/dist/tui-ink/approval/approval-dialog.js +0 -184
- package/dist/tui-ink/approval/diff-view.d.ts +0 -7
- package/dist/tui-ink/approval/diff-view.js +0 -44
- package/dist/tui-ink/approval/select.d.ts +0 -35
- package/dist/tui-ink/approval/select.js +0 -98
- package/dist/tui-ink/code-highlight.d.ts +0 -8
- package/dist/tui-ink/code-highlight.js +0 -121
- package/dist/tui-ink/command-palette.d.ts +0 -32
- package/dist/tui-ink/command-palette.js +0 -158
- package/dist/tui-ink/compaction-progress.d.ts +0 -19
- package/dist/tui-ink/compaction-progress.js +0 -74
- package/dist/tui-ink/detect-theme.d.ts +0 -1
- package/dist/tui-ink/detect-theme.js +0 -1
- package/dist/tui-ink/feedback-dialog.d.ts +0 -19
- package/dist/tui-ink/feedback-dialog.js +0 -133
- package/dist/tui-ink/feishu-setup-picker.d.ts +0 -5
- package/dist/tui-ink/feishu-setup-picker.js +0 -271
- package/dist/tui-ink/footer.d.ts +0 -26
- package/dist/tui-ink/footer.js +0 -51
- package/dist/tui-ink/input-box.d.ts +0 -189
- package/dist/tui-ink/input-box.js +0 -1279
- package/dist/tui-ink/input-history.d.ts +0 -1
- package/dist/tui-ink/input-history.js +0 -1
- package/dist/tui-ink/markdown.d.ts +0 -103
- package/dist/tui-ink/markdown.js +0 -747
- package/dist/tui-ink/message-list.d.ts +0 -49
- package/dist/tui-ink/message-list.js +0 -841
- package/dist/tui-ink/model-picker.d.ts +0 -143
- package/dist/tui-ink/model-picker.js +0 -966
- package/dist/tui-ink/plan-confirm.d.ts +0 -7
- package/dist/tui-ink/plan-confirm.js +0 -115
- package/dist/tui-ink/question-dialog.d.ts +0 -8
- package/dist/tui-ink/question-dialog.js +0 -135
- package/dist/tui-ink/rewind-picker.d.ts +0 -8
- package/dist/tui-ink/rewind-picker.js +0 -102
- package/dist/tui-ink/run-session-picker.js +0 -22
- package/dist/tui-ink/run.d.ts +0 -62
- package/dist/tui-ink/run.js +0 -103
- package/dist/tui-ink/session-picker.d.ts +0 -10
- package/dist/tui-ink/session-picker.js +0 -113
- package/dist/tui-ink/stats-panel.d.ts +0 -11
- package/dist/tui-ink/stats-panel.js +0 -65
- package/dist/tui-ink/subagent-inspector.d.ts +0 -21
- package/dist/tui-ink/subagent-inspector.js +0 -205
- package/dist/tui-ink/use-terminal-size.d.ts +0 -4
- package/dist/tui-ink/use-terminal-size.js +0 -48
- package/dist/tui-ink/waiting-indicator.d.ts +0 -12
- package/dist/tui-ink/waiting-indicator.js +0 -129
- package/dist/tui-ink/welcome.d.ts +0 -25
- package/dist/tui-ink/welcome.js +0 -88
- package/dist/tui-ink/wordmark.d.ts +0 -8
- package/dist/tui-ink/wordmark.js +0 -103
- /package/dist/{tui-ink → tui/model}/composer-buffer.d.ts +0 -0
- /package/dist/{tui-ink → tui/model}/display-history.js +0 -0
- /package/dist/{tui-ink → tui/model}/input-queue.js +0 -0
- /package/dist/{tui-ink → tui/model}/key-events.d.ts +0 -0
- /package/dist/{tui-ink → tui/model}/key-events.js +0 -0
- /package/dist/{tui-ink → tui/model}/paste-operation-tracker.d.ts +0 -0
- /package/dist/{tui-ink → tui/model}/paste-operation-tracker.js +0 -0
- /package/dist/{tui-ink → tui/model}/recent-activity.d.ts +0 -0
- /package/dist/{tui-ink → tui/model}/submit-dedupe.js +0 -0
- /package/dist/{tui-ink → tui/model}/sync-output.d.ts +0 -0
- /package/dist/{tui-ink → tui/model}/sync-output.js +0 -0
- /package/dist/{tui-ink → tui/model}/terminal-env.d.ts +0 -0
- /package/dist/{tui-ink → tui/model}/terminal-env.js +0 -0
- /package/dist/{tui-ink → tui/model}/terminal-mouse.d.ts +0 -0
- /package/dist/{tui-ink → tui/model}/terminal-mouse.js +0 -0
- /package/dist/{tui-ink → tui/model}/width.d.ts +0 -0
- /package/dist/{tui-ink → tui/model}/width.js +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { Image, getCapabilities, getImageDimensions, truncateToWidth, visibleWidth, } from "@bubblebrain-ai/pi-tui";
|
|
3
|
+
import { darkTheme } from "../model/theme.js";
|
|
4
|
+
import { themeBackground, themeDim, themeForeground } from "../model/theme-style.js";
|
|
5
|
+
function normalizedImage(input) {
|
|
6
|
+
if ("attachment" in input)
|
|
7
|
+
return { ...input.attachment, label: input.label };
|
|
8
|
+
return input;
|
|
9
|
+
}
|
|
10
|
+
export function formatImageBytes(bytes) {
|
|
11
|
+
if (bytes < 1024)
|
|
12
|
+
return `${bytes} B`;
|
|
13
|
+
if (bytes < 1024 * 1024)
|
|
14
|
+
return `${(bytes / 1024).toFixed(bytes < 10 * 1024 ? 1 : 0)} KB`;
|
|
15
|
+
return `${(bytes / (1024 * 1024)).toFixed(bytes < 10 * 1024 * 1024 ? 1 : 0)} MB`;
|
|
16
|
+
}
|
|
17
|
+
function formatName(mediaType) {
|
|
18
|
+
return mediaType.slice("image/".length).replace("jpeg", "JPEG").toUpperCase();
|
|
19
|
+
}
|
|
20
|
+
export function imageDetailLine(input) {
|
|
21
|
+
const image = normalizedImage(input);
|
|
22
|
+
const dimensions = getImageDimensions(image.base64, image.mediaType);
|
|
23
|
+
return [
|
|
24
|
+
formatName(image.mediaType),
|
|
25
|
+
dimensions ? `${dimensions.widthPx}×${dimensions.heightPx}` : undefined,
|
|
26
|
+
formatImageBytes(image.bytes),
|
|
27
|
+
].filter(Boolean).join(" · ");
|
|
28
|
+
}
|
|
29
|
+
/** Grok-style transient preview rendered directly above the composer. */
|
|
30
|
+
export class ComposerImagePreviewComponent {
|
|
31
|
+
getImage;
|
|
32
|
+
getTheme;
|
|
33
|
+
cachedKey;
|
|
34
|
+
cachedImage;
|
|
35
|
+
constructor(getImage, getTheme = () => darkTheme) {
|
|
36
|
+
this.getImage = getImage;
|
|
37
|
+
this.getTheme = getTheme;
|
|
38
|
+
}
|
|
39
|
+
render(width) {
|
|
40
|
+
const input = this.getImage();
|
|
41
|
+
if (!input || width < 8)
|
|
42
|
+
return [];
|
|
43
|
+
const theme = this.getTheme();
|
|
44
|
+
const image = normalizedImage(input);
|
|
45
|
+
const innerWidth = Math.max(1, width - 4);
|
|
46
|
+
const key = `${image.label}:${image.dataUrl.length}:${image.sourcePath ?? image.filename ?? ""}`;
|
|
47
|
+
if (key !== this.cachedKey) {
|
|
48
|
+
this.cachedKey = key;
|
|
49
|
+
this.cachedImage = new Image(image.base64, image.mediaType, { fallbackColor: (text) => themeDim(theme.dim, text) }, {
|
|
50
|
+
maxWidthCells: Math.min(42, innerWidth),
|
|
51
|
+
maxHeightCells: 6,
|
|
52
|
+
filename: image.sourcePath ?? image.filename,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const header = truncateToWidth(` ${chalk.bold(themeForeground(theme.inputText, image.label))} ${themeDim(theme.dim, imageDetailLine(image))}`, width, "");
|
|
56
|
+
const rows = [themeBackground(theme.backgroundPanel, `${header}${" ".repeat(Math.max(0, width - visibleWidth(header)))}`)];
|
|
57
|
+
if (getCapabilities().images)
|
|
58
|
+
rows.push(...(this.cachedImage?.render(innerWidth) ?? []));
|
|
59
|
+
const path = image.sourcePath ?? image.filename;
|
|
60
|
+
if (path)
|
|
61
|
+
rows.push(truncateToWidth(themeDim(theme.dim, ` ${path}`), width));
|
|
62
|
+
rows.push(truncateToWidth(themeDim(theme.dim, " Enter to view · Backspace/Delete to remove"), width));
|
|
63
|
+
return rows;
|
|
64
|
+
}
|
|
65
|
+
invalidate() {
|
|
66
|
+
this.cachedKey = undefined;
|
|
67
|
+
this.cachedImage?.invalidate();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Full image inspector used by composer activation and sent-message clicks. */
|
|
71
|
+
export class ImageViewerComponent {
|
|
72
|
+
onClose;
|
|
73
|
+
getTheme;
|
|
74
|
+
focused = false;
|
|
75
|
+
image;
|
|
76
|
+
renderer;
|
|
77
|
+
hovered = false;
|
|
78
|
+
constructor(input, onClose, getTerminalRows = () => 30, getTheme = () => darkTheme) {
|
|
79
|
+
this.onClose = onClose;
|
|
80
|
+
this.getTheme = getTheme;
|
|
81
|
+
this.image = normalizedImage(input);
|
|
82
|
+
this.renderer = new Image(this.image.base64, this.image.mediaType, { fallbackColor: (text) => themeDim(this.getTheme().dim, text) }, {
|
|
83
|
+
maxWidthCells: 100,
|
|
84
|
+
maxHeightCells: Math.max(1, Math.min(18, getTerminalRows() - 12)),
|
|
85
|
+
filename: this.image.sourcePath ?? this.image.filename,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
render(width) {
|
|
89
|
+
const theme = this.getTheme();
|
|
90
|
+
const safeWidth = Math.max(1, width);
|
|
91
|
+
if (safeWidth < 4)
|
|
92
|
+
return [truncateToWidth(this.image.label, safeWidth, "")];
|
|
93
|
+
const title = `${this.image.label} ${imageDetailLine(this.image)}`;
|
|
94
|
+
const titleRow = truncateToWidth(chalk.bold(themeForeground(theme.inputText, title)), Math.max(1, safeWidth - 4), "");
|
|
95
|
+
const body = this.renderer.render(Math.max(1, safeWidth - 4));
|
|
96
|
+
const path = this.image.sourcePath ?? this.image.filename;
|
|
97
|
+
return [
|
|
98
|
+
themeForeground(theme.border, `┌${"─".repeat(Math.max(0, safeWidth - 2))}┐`),
|
|
99
|
+
`${themeForeground(theme.border, "│")} ${titleRow}${" ".repeat(Math.max(0, safeWidth - 4 - visibleWidth(titleRow)))} ${themeForeground(theme.border, "│")}`,
|
|
100
|
+
...body,
|
|
101
|
+
...(path ? [truncateToWidth(themeDim(theme.dim, ` ${path}`), safeWidth)] : []),
|
|
102
|
+
truncateToWidth(themeDim(theme.dim, ` Esc close${this.hovered ? " · click to close" : ""}`), safeWidth),
|
|
103
|
+
themeForeground(theme.border, `└${"─".repeat(Math.max(0, safeWidth - 2))}┘`),
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
handleInput(data) {
|
|
107
|
+
if (data === "\x1b" || data === "q" || data === "Q" || data === "\r")
|
|
108
|
+
this.onClose();
|
|
109
|
+
}
|
|
110
|
+
handleMouse(event) {
|
|
111
|
+
if (event.kind === "leave") {
|
|
112
|
+
const changed = this.hovered;
|
|
113
|
+
this.hovered = false;
|
|
114
|
+
return changed;
|
|
115
|
+
}
|
|
116
|
+
if (event.kind === "move") {
|
|
117
|
+
const changed = !this.hovered;
|
|
118
|
+
this.hovered = true;
|
|
119
|
+
return changed;
|
|
120
|
+
}
|
|
121
|
+
if (!event.release && (event.button & 3) === 0) {
|
|
122
|
+
this.onClose();
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
invalidate() {
|
|
128
|
+
this.renderer.invalidate();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Component, type Focusable, type TUI } from "@bubblebrain-ai/pi-tui";
|
|
2
|
+
import { type Theme } from "../model/theme.js";
|
|
3
|
+
/**
|
|
4
|
+
* Full-width plan approval sheet with an embedded multiline editor.
|
|
5
|
+
*
|
|
6
|
+
* Enter approves the proposed plan while viewing it. Editing deliberately
|
|
7
|
+
* changes Enter to a newline; Ctrl+S/Ctrl+D is the explicit save-and-approve
|
|
8
|
+
* action, matching the pre-migration Ink interaction.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PlanDialogComponent implements Component, Focusable {
|
|
11
|
+
private readonly getTerminalRows;
|
|
12
|
+
private readonly getTheme;
|
|
13
|
+
private stage;
|
|
14
|
+
private readonly editor;
|
|
15
|
+
private viewOffset;
|
|
16
|
+
private viewRows;
|
|
17
|
+
private viewContentRows;
|
|
18
|
+
private validationMessage;
|
|
19
|
+
private hasFocus;
|
|
20
|
+
private readonly initialPlan;
|
|
21
|
+
onApprove?: (plan: string) => void;
|
|
22
|
+
onReject?: () => void;
|
|
23
|
+
constructor(tui: TUI, initialPlan: string, getTerminalRows: () => number, getTheme?: () => Theme);
|
|
24
|
+
get focused(): boolean;
|
|
25
|
+
set focused(value: boolean);
|
|
26
|
+
render(width: number): string[];
|
|
27
|
+
handleInput(data: string): void;
|
|
28
|
+
invalidate(): void;
|
|
29
|
+
private enterEditStage;
|
|
30
|
+
private renderPlan;
|
|
31
|
+
private renderEditor;
|
|
32
|
+
private maxViewOffset;
|
|
33
|
+
private fitEditorWindow;
|
|
34
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { Editor, matchesKey, wrapTextWithAnsi, } from "@bubblebrain-ai/pi-tui";
|
|
3
|
+
import { createComposerEditorTheme } from "../composer-style.js";
|
|
4
|
+
import { darkTheme } from "../model/theme.js";
|
|
5
|
+
import { themeDim, themeForeground } from "../model/theme-style.js";
|
|
6
|
+
import { paintSheetLine, padSheetLine, safeSheetText } from "./bottom-sheet.js";
|
|
7
|
+
/**
|
|
8
|
+
* Full-width plan approval sheet with an embedded multiline editor.
|
|
9
|
+
*
|
|
10
|
+
* Enter approves the proposed plan while viewing it. Editing deliberately
|
|
11
|
+
* changes Enter to a newline; Ctrl+S/Ctrl+D is the explicit save-and-approve
|
|
12
|
+
* action, matching the pre-migration Ink interaction.
|
|
13
|
+
*/
|
|
14
|
+
export class PlanDialogComponent {
|
|
15
|
+
getTerminalRows;
|
|
16
|
+
getTheme;
|
|
17
|
+
stage = "view";
|
|
18
|
+
editor;
|
|
19
|
+
viewOffset = 0;
|
|
20
|
+
viewRows = 0;
|
|
21
|
+
viewContentRows = 0;
|
|
22
|
+
validationMessage;
|
|
23
|
+
hasFocus = false;
|
|
24
|
+
initialPlan;
|
|
25
|
+
onApprove;
|
|
26
|
+
onReject;
|
|
27
|
+
constructor(tui, initialPlan, getTerminalRows, getTheme = () => darkTheme) {
|
|
28
|
+
this.getTerminalRows = getTerminalRows;
|
|
29
|
+
this.getTheme = getTheme;
|
|
30
|
+
// Plans originate in model output. Keep terminal control sequences out of
|
|
31
|
+
// both the preview and the editable buffer.
|
|
32
|
+
this.initialPlan = safeSheetText(initialPlan);
|
|
33
|
+
this.editor = new Editor(tui, createComposerEditorTheme(getTheme), {
|
|
34
|
+
borderStyle: "box",
|
|
35
|
+
paddingX: 1,
|
|
36
|
+
prompt: "",
|
|
37
|
+
autocompletePlacement: "below",
|
|
38
|
+
autocompleteBorderStyle: "none",
|
|
39
|
+
});
|
|
40
|
+
this.editor.setText(this.initialPlan);
|
|
41
|
+
this.editor.onChange = (value) => {
|
|
42
|
+
if (value.trim())
|
|
43
|
+
this.validationMessage = undefined;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
get focused() {
|
|
47
|
+
return this.hasFocus;
|
|
48
|
+
}
|
|
49
|
+
set focused(value) {
|
|
50
|
+
this.hasFocus = value;
|
|
51
|
+
this.editor.focused = value && this.stage === "edit";
|
|
52
|
+
}
|
|
53
|
+
render(width) {
|
|
54
|
+
const theme = this.getTheme();
|
|
55
|
+
const safeWidth = Math.max(1, width);
|
|
56
|
+
const terminalRows = Math.max(1, this.getTerminalRows());
|
|
57
|
+
// Long plans scroll inside a bounded sheet instead of covering the entire
|
|
58
|
+
// transcript. On short terminals, keep one row of conversation visible.
|
|
59
|
+
const sheetRows = terminalRows > 1
|
|
60
|
+
? Math.min(18, terminalRows - 1)
|
|
61
|
+
: 1;
|
|
62
|
+
const showHelp = sheetRows >= 4;
|
|
63
|
+
const panelBudget = Math.max(1, sheetRows - (showHelp ? 1 : 0));
|
|
64
|
+
const panel = this.stage === "edit"
|
|
65
|
+
? this.renderEditor(safeWidth, panelBudget, theme)
|
|
66
|
+
: this.renderPlan(safeWidth, panelBudget, theme);
|
|
67
|
+
const painted = panel.map((line) => paintSheetLine(line, safeWidth, false, theme));
|
|
68
|
+
if (!showHelp)
|
|
69
|
+
return painted;
|
|
70
|
+
const help = this.stage === "edit"
|
|
71
|
+
? "Enter newline │ Ctrl+S/Ctrl+D save & approve │ Esc cancel edit"
|
|
72
|
+
: "↑/↓ scroll │ Enter/y approve │ e edit │ Esc/n reject";
|
|
73
|
+
return [...painted, themeDim(theme.dim, padSheetLine(help, safeWidth))];
|
|
74
|
+
}
|
|
75
|
+
handleInput(data) {
|
|
76
|
+
if (this.stage === "view") {
|
|
77
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c") || data === "n" || data === "N") {
|
|
78
|
+
this.onReject?.();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (matchesKey(data, "enter") || data === "y" || data === "Y") {
|
|
82
|
+
this.onApprove?.(this.initialPlan.trim());
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (data === "e" || data === "E") {
|
|
86
|
+
this.enterEditStage();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (matchesKey(data, "up") || data === "k") {
|
|
90
|
+
this.viewOffset = Math.max(0, this.viewOffset - 1);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (matchesKey(data, "down") || data === "j") {
|
|
94
|
+
this.viewOffset = Math.min(this.maxViewOffset(), this.viewOffset + 1);
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (matchesKey(data, "escape")) {
|
|
99
|
+
this.editor.setText(this.initialPlan);
|
|
100
|
+
this.validationMessage = undefined;
|
|
101
|
+
this.stage = "view";
|
|
102
|
+
this.editor.focused = false;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (matchesKey(data, "ctrl+s") || matchesKey(data, "ctrl+d")) {
|
|
106
|
+
const finalPlan = this.editor.getExpandedText().trim();
|
|
107
|
+
if (!finalPlan) {
|
|
108
|
+
this.validationMessage = "Plan cannot be empty.";
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.onApprove?.(finalPlan);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (matchesKey(data, "enter")) {
|
|
115
|
+
this.editor.insertTextAtCursor("\n");
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.editor.handleInput(data);
|
|
119
|
+
}
|
|
120
|
+
invalidate() {
|
|
121
|
+
this.editor.invalidate();
|
|
122
|
+
}
|
|
123
|
+
enterEditStage() {
|
|
124
|
+
this.stage = "edit";
|
|
125
|
+
this.validationMessage = undefined;
|
|
126
|
+
this.editor.setText(this.initialPlan);
|
|
127
|
+
this.editor.focused = this.hasFocus;
|
|
128
|
+
}
|
|
129
|
+
renderPlan(width, budget, theme) {
|
|
130
|
+
const indentWidth = width >= 12 ? 2 : width >= 3 ? 1 : 0;
|
|
131
|
+
const indent = " ".repeat(indentWidth);
|
|
132
|
+
const contentWidth = Math.max(1, width - indentWidth * 2);
|
|
133
|
+
const title = `${indent}${chalk.bold(themeForeground(theme.inputText, "Proposed plan"))}`;
|
|
134
|
+
const action = (key, label) => `${indent}${themeForeground(theme.accent, key)} ${label}`;
|
|
135
|
+
if (width < 24 && budget <= 3) {
|
|
136
|
+
return [action("y", "approve"), action("e", "edit"), action("n", "reject")].slice(0, budget);
|
|
137
|
+
}
|
|
138
|
+
const actions = width < 40
|
|
139
|
+
? `${indent}${themeForeground(theme.accent, "y")} approve ${themeForeground(theme.accent, "e")} edit ${themeForeground(theme.accent, "n")} reject`
|
|
140
|
+
: `${indent}${themeForeground(theme.accent, "y")} approve ${themeForeground(theme.accent, "e")} edit ${themeForeground(theme.accent, "n")} reject`;
|
|
141
|
+
if (budget === 1)
|
|
142
|
+
return [actions];
|
|
143
|
+
const roomy = budget >= 6;
|
|
144
|
+
const fixedRows = 2 + (roomy ? 2 : 0);
|
|
145
|
+
const bodyBudget = Math.max(0, budget - fixedRows);
|
|
146
|
+
const wrapped = safeSheetText(this.initialPlan)
|
|
147
|
+
.split("\n")
|
|
148
|
+
.flatMap((line) => line ? wrapTextWithAnsi(line, contentWidth) : [""]);
|
|
149
|
+
this.viewRows = bodyBudget;
|
|
150
|
+
this.viewContentRows = wrapped.length;
|
|
151
|
+
this.viewOffset = Math.min(this.viewOffset, this.maxViewOffset());
|
|
152
|
+
const visible = wrapped.slice(this.viewOffset, this.viewOffset + bodyBudget);
|
|
153
|
+
while (visible.length < bodyBudget)
|
|
154
|
+
visible.push("");
|
|
155
|
+
return [
|
|
156
|
+
title,
|
|
157
|
+
...(roomy ? [""] : []),
|
|
158
|
+
...visible.map((line) => `${indent}${themeForeground(theme.inputText, line)}`),
|
|
159
|
+
...(roomy ? [""] : []),
|
|
160
|
+
actions,
|
|
161
|
+
].slice(0, budget);
|
|
162
|
+
}
|
|
163
|
+
renderEditor(width, budget, theme) {
|
|
164
|
+
const indentWidth = width >= 12 ? 2 : width >= 3 ? 1 : 0;
|
|
165
|
+
const indent = " ".repeat(indentWidth);
|
|
166
|
+
const contentWidth = Math.max(1, width - indentWidth * 2);
|
|
167
|
+
const title = `${indent}${chalk.bold(themeForeground(theme.inputText, "Edit plan"))}`;
|
|
168
|
+
if (budget === 1)
|
|
169
|
+
return [title];
|
|
170
|
+
const errorRows = this.validationMessage ? 1 : 0;
|
|
171
|
+
const editorBudget = Math.max(1, budget - 1 - errorRows);
|
|
172
|
+
const renderedEditor = this.editor.render(contentWidth);
|
|
173
|
+
const visibleEditor = this.fitEditorWindow(renderedEditor, editorBudget);
|
|
174
|
+
const lines = [title, ...visibleEditor.map((line) => `${indent}${line}`)];
|
|
175
|
+
if (this.validationMessage) {
|
|
176
|
+
lines.push(`${indent}${themeForeground(theme.error, this.validationMessage)}`);
|
|
177
|
+
}
|
|
178
|
+
return lines.slice(0, budget);
|
|
179
|
+
}
|
|
180
|
+
maxViewOffset() {
|
|
181
|
+
return Math.max(0, this.viewContentRows - this.viewRows);
|
|
182
|
+
}
|
|
183
|
+
fitEditorWindow(lines, budget) {
|
|
184
|
+
if (lines.length <= budget)
|
|
185
|
+
return lines;
|
|
186
|
+
if (budget <= 2)
|
|
187
|
+
return lines.slice(-budget);
|
|
188
|
+
const top = lines[0];
|
|
189
|
+
const bottom = lines[lines.length - 1];
|
|
190
|
+
const body = lines.slice(1, -1);
|
|
191
|
+
const bodyBudget = budget - 2;
|
|
192
|
+
const cursorIndex = Math.max(0, body.findIndex((line) => line.includes("\x1b[7m")));
|
|
193
|
+
const start = Math.max(0, Math.min(cursorIndex - Math.floor(bodyBudget / 2), Math.max(0, body.length - bodyBudget)));
|
|
194
|
+
return [top, ...body.slice(start, start + bodyBudget), bottom];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Input, type Component } from "@bubblebrain-ai/pi-tui";
|
|
2
|
+
import { type Theme } from "../model/theme.js";
|
|
3
|
+
/**
|
|
4
|
+
* Inline credential phase used by /provider.
|
|
5
|
+
*
|
|
6
|
+
* It deliberately owns a plain masked Input instead of the main Editor so a
|
|
7
|
+
* credential can never enter composer history, autocomplete, or transcript
|
|
8
|
+
* state. Its geometry mirrors the model/reasoning command surface: a filled
|
|
9
|
+
* context row immediately above the normal square composer frame.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ProviderKeyInputComponent implements Component {
|
|
12
|
+
readonly input: Input;
|
|
13
|
+
private readonly providerName;
|
|
14
|
+
private readonly getTheme;
|
|
15
|
+
constructor(input: Input, providerName: string, getTheme?: () => Theme);
|
|
16
|
+
render(width: number): string[];
|
|
17
|
+
invalidate(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { truncateToWidth, visibleWidth, } from "@bubblebrain-ai/pi-tui";
|
|
2
|
+
import { darkTheme } from "../model/theme.js";
|
|
3
|
+
import { themeBackground, themeDim, themeForeground } from "../model/theme-style.js";
|
|
4
|
+
function fillLine(text, width) {
|
|
5
|
+
const clipped = truncateToWidth(text, width);
|
|
6
|
+
return clipped + " ".repeat(Math.max(0, width - visibleWidth(clipped)));
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Inline credential phase used by /provider.
|
|
10
|
+
*
|
|
11
|
+
* It deliberately owns a plain masked Input instead of the main Editor so a
|
|
12
|
+
* credential can never enter composer history, autocomplete, or transcript
|
|
13
|
+
* state. Its geometry mirrors the model/reasoning command surface: a filled
|
|
14
|
+
* context row immediately above the normal square composer frame.
|
|
15
|
+
*/
|
|
16
|
+
export class ProviderKeyInputComponent {
|
|
17
|
+
input;
|
|
18
|
+
providerName;
|
|
19
|
+
getTheme;
|
|
20
|
+
constructor(input, providerName, getTheme = () => darkTheme) {
|
|
21
|
+
this.input = input;
|
|
22
|
+
this.providerName = providerName;
|
|
23
|
+
this.getTheme = getTheme;
|
|
24
|
+
}
|
|
25
|
+
render(width) {
|
|
26
|
+
const theme = this.getTheme();
|
|
27
|
+
const borderColor = (text) => themeDim(theme.border, text);
|
|
28
|
+
const surfaceBackground = (text) => themeBackground(theme.backgroundPanel, text);
|
|
29
|
+
const safeWidth = Math.max(1, Math.floor(width));
|
|
30
|
+
const title = ` Enter API Key for ${this.providerName}`;
|
|
31
|
+
const hint = " · Enter to save · Esc or empty Backspace to return";
|
|
32
|
+
const surface = surfaceBackground(fillLine(`${themeForeground(theme.accent, "◆")}${title}${themeDim(theme.dim, hint)}`, safeWidth));
|
|
33
|
+
if (safeWidth < 3) {
|
|
34
|
+
return [surface, ...this.input.render(safeWidth)];
|
|
35
|
+
}
|
|
36
|
+
const innerWidth = safeWidth - 2;
|
|
37
|
+
const inputLine = this.input.render(innerWidth)[0] ?? " ".repeat(innerWidth);
|
|
38
|
+
const horizontal = "─".repeat(innerWidth);
|
|
39
|
+
return [
|
|
40
|
+
surface,
|
|
41
|
+
borderColor(`┌${horizontal}┐`),
|
|
42
|
+
`${borderColor("│")}${fillLine(inputLine, innerWidth)}${borderColor("│")}`,
|
|
43
|
+
borderColor(`└${horizontal}┘`),
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
invalidate() {
|
|
47
|
+
this.input.invalidate?.();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Component, type Focusable } from "@bubblebrain-ai/pi-tui";
|
|
2
|
+
import type { QuestionAnswer, QuestionRequest } from "../../question/types.js";
|
|
3
|
+
import { type Theme } from "../model/theme.js";
|
|
4
|
+
/** Request-aware, bottom-docked replacement for the lost Ink QuestionDialog. */
|
|
5
|
+
export declare class QuestionDialogComponent implements Component, Focusable {
|
|
6
|
+
private readonly request;
|
|
7
|
+
private readonly getTerminalRows;
|
|
8
|
+
private readonly getTheme;
|
|
9
|
+
focused: boolean;
|
|
10
|
+
private questionIndex;
|
|
11
|
+
private selectedIndex;
|
|
12
|
+
private customInput;
|
|
13
|
+
private answers;
|
|
14
|
+
onSubmit?: (answers: QuestionAnswer[]) => void;
|
|
15
|
+
onCancel?: () => void;
|
|
16
|
+
constructor(request: QuestionRequest, getTerminalRows: () => number, getTheme?: () => Theme);
|
|
17
|
+
render(width: number): string[];
|
|
18
|
+
handleInput(data: string): void;
|
|
19
|
+
invalidate(): void;
|
|
20
|
+
private currentQuestion;
|
|
21
|
+
private saveCurrentAnswer;
|
|
22
|
+
private toggleSelectedOption;
|
|
23
|
+
private commitAndAdvance;
|
|
24
|
+
private moveToQuestion;
|
|
25
|
+
}
|