@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,263 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { decodeKittyPrintable, matchesKey, truncateToWidth, visibleWidth, } from "@bubblebrain-ai/pi-tui";
|
|
3
|
+
import { paintSheetLine, padSheetLine, safeSheetInlineText, safeSheetText } from "./bottom-sheet.js";
|
|
4
|
+
import { darkTheme } from "../model/theme.js";
|
|
5
|
+
import { themeDim, themeForeground } from "../model/theme-style.js";
|
|
6
|
+
const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
7
|
+
function printableInput(data) {
|
|
8
|
+
const decoded = decodeKittyPrintable(data);
|
|
9
|
+
if (decoded !== undefined)
|
|
10
|
+
return decoded;
|
|
11
|
+
// Bracketed paste is already normalized by ProcessTerminal. Keep printable
|
|
12
|
+
// text (including CJK and pasted line breaks) while excluding raw terminal
|
|
13
|
+
// control input. safeSheetText() normalizes the allowed whitespace below.
|
|
14
|
+
// eslint-disable-next-line no-control-regex
|
|
15
|
+
return data && !/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/.test(data) ? data : undefined;
|
|
16
|
+
}
|
|
17
|
+
function removeLastGrapheme(value) {
|
|
18
|
+
const segments = [...graphemeSegmenter.segment(value)];
|
|
19
|
+
const last = segments[segments.length - 1];
|
|
20
|
+
return last ? value.slice(0, last.index) : "";
|
|
21
|
+
}
|
|
22
|
+
function joinColumns(left, right, width, theme = darkTheme) {
|
|
23
|
+
if (!right || width < 56) {
|
|
24
|
+
const combined = right ? `${left} ${themeDim(theme.dim, right)}` : left;
|
|
25
|
+
return truncateToWidth(combined, width, "…");
|
|
26
|
+
}
|
|
27
|
+
// The reference keeps the answer label compact and gives the explanation
|
|
28
|
+
// most of the row. At a 100-column terminal the second column begins around
|
|
29
|
+
// column 33, rather than drifting toward the middle of the sheet.
|
|
30
|
+
const leftWidth = Math.max(20, Math.min(34, Math.floor(width * 0.33)));
|
|
31
|
+
const renderedLeft = truncateToWidth(left, leftWidth - 2, "…");
|
|
32
|
+
const gap = " ".repeat(Math.max(2, leftWidth - visibleWidth(renderedLeft)));
|
|
33
|
+
return `${renderedLeft}${gap}${themeDim(theme.dim, truncateToWidth(right, Math.max(1, width - leftWidth), "…"))}`;
|
|
34
|
+
}
|
|
35
|
+
/** Request-aware, bottom-docked replacement for the lost Ink QuestionDialog. */
|
|
36
|
+
export class QuestionDialogComponent {
|
|
37
|
+
request;
|
|
38
|
+
getTerminalRows;
|
|
39
|
+
getTheme;
|
|
40
|
+
focused = false;
|
|
41
|
+
questionIndex = 0;
|
|
42
|
+
selectedIndex = 0;
|
|
43
|
+
customInput = "";
|
|
44
|
+
answers;
|
|
45
|
+
onSubmit;
|
|
46
|
+
onCancel;
|
|
47
|
+
constructor(request, getTerminalRows, getTheme = () => darkTheme) {
|
|
48
|
+
this.request = request;
|
|
49
|
+
this.getTerminalRows = getTerminalRows;
|
|
50
|
+
this.getTheme = getTheme;
|
|
51
|
+
this.answers = request.questions.map(() => []);
|
|
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
|
+
// A bottom sheet must not become the entire screen after a resize. Keep
|
|
58
|
+
// one transcript row visible whenever the terminal has room for it.
|
|
59
|
+
const sheetRows = terminalRows > 1 ? terminalRows - 1 : 1;
|
|
60
|
+
const question = this.currentQuestion();
|
|
61
|
+
if (!question)
|
|
62
|
+
return [];
|
|
63
|
+
const canUseCustom = question.custom !== false;
|
|
64
|
+
const rows = [
|
|
65
|
+
...question.options.map((_, optionIndex) => ({ kind: "option", optionIndex })),
|
|
66
|
+
...(canUseCustom ? [{ kind: "custom" }] : []),
|
|
67
|
+
];
|
|
68
|
+
const showOuterHelp = sheetRows >= 5;
|
|
69
|
+
const available = Math.max(1, sheetRows - (showOuterHelp ? 1 : 0));
|
|
70
|
+
const roomy = available >= 8;
|
|
71
|
+
const showInnerHelp = available >= 5;
|
|
72
|
+
const fixedRows = 1 + (roomy ? 3 : 0) + (showInnerHelp ? 1 : 0);
|
|
73
|
+
const choiceBudget = Math.max(0, Math.min(rows.length, available - fixedRows));
|
|
74
|
+
const panelBudget = fixedRows + choiceBudget;
|
|
75
|
+
const indentWidth = safeWidth >= 12 ? 2 : safeWidth >= 3 ? 1 : 0;
|
|
76
|
+
const indent = " ".repeat(indentWidth);
|
|
77
|
+
const contentWidth = Math.max(1, safeWidth - indentWidth * 2);
|
|
78
|
+
const selectedStart = Math.max(0, Math.min(this.selectedIndex - choiceBudget + 1, Math.max(0, rows.length - choiceBudget)));
|
|
79
|
+
const visibleRows = rows.slice(selectedStart, selectedStart + choiceBudget);
|
|
80
|
+
const panel = [];
|
|
81
|
+
if (roomy)
|
|
82
|
+
panel.push({ line: "" });
|
|
83
|
+
const tab = this.request.questions.length > 1
|
|
84
|
+
? themeDim(theme.dim, ` ${safeSheetInlineText(question.header) || "Question"} ${this.questionIndex + 1}/${this.request.questions.length}`)
|
|
85
|
+
: "";
|
|
86
|
+
const titleWidth = Math.max(1, contentWidth - visibleWidth(tab));
|
|
87
|
+
panel.push({
|
|
88
|
+
line: `${indent}${chalk.bold(themeForeground(theme.inputText, truncateToWidth(safeSheetInlineText(question.question), titleWidth, "…")))}${tab}`,
|
|
89
|
+
});
|
|
90
|
+
if (roomy)
|
|
91
|
+
panel.push({ line: "" });
|
|
92
|
+
const currentAnswers = this.answers[this.questionIndex] ?? [];
|
|
93
|
+
for (const row of visibleRows) {
|
|
94
|
+
const absoluteIndex = rows.indexOf(row);
|
|
95
|
+
const selected = absoluteIndex === this.selectedIndex;
|
|
96
|
+
if (row.kind === "custom") {
|
|
97
|
+
const marker = this.customInput.trim() ? "●" : "○";
|
|
98
|
+
const custom = this.customInput || "Type your answer here";
|
|
99
|
+
panel.push({
|
|
100
|
+
line: `${indent}${selected
|
|
101
|
+
? chalk.bold(themeForeground(theme.inputText, `z (${marker}) ${custom}`))
|
|
102
|
+
: themeForeground(theme.muted, `z (${marker}) ${custom}`)}`,
|
|
103
|
+
selected,
|
|
104
|
+
});
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const optionIndex = row.optionIndex ?? 0;
|
|
108
|
+
const option = question.options[optionIndex];
|
|
109
|
+
const checked = currentAnswers.includes(option.label);
|
|
110
|
+
const marker = checked ? "●" : "○";
|
|
111
|
+
const left = `${optionIndex + 1} (${marker}) ${safeSheetInlineText(option.label)}`;
|
|
112
|
+
const line = joinColumns(left, safeSheetInlineText(option.description), contentWidth, theme);
|
|
113
|
+
panel.push({
|
|
114
|
+
line: `${indent}${selected
|
|
115
|
+
? chalk.bold(themeForeground(theme.inputText, line))
|
|
116
|
+
: themeForeground(theme.muted, line)}`,
|
|
117
|
+
selected,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (roomy)
|
|
121
|
+
panel.push({ line: "" });
|
|
122
|
+
if (showInnerHelp) {
|
|
123
|
+
const selectionHelp = question.multiple ? "↑/↓ navigate · Space toggle · type custom" : "↑/↓ navigate · type custom";
|
|
124
|
+
const submitHelp = this.questionIndex < this.request.questions.length - 1 ? "Enter:next" : "Enter:submit";
|
|
125
|
+
const rightGap = Math.max(1, contentWidth - visibleWidth(selectionHelp) - visibleWidth(submitHelp));
|
|
126
|
+
panel.push({
|
|
127
|
+
line: `${indent}${themeDim(theme.dim, truncateToWidth(`${selectionHelp}${" ".repeat(rightGap)}${submitHelp}`, contentWidth, ""))}`,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const painted = panel.slice(0, panelBudget).map(({ line, selected }) => paintSheetLine(line, safeWidth, selected, theme));
|
|
131
|
+
if (!showOuterHelp)
|
|
132
|
+
return painted;
|
|
133
|
+
const outerHelp = this.request.questions.length > 1
|
|
134
|
+
? "Tab next question │ ←/→ change question │ Esc dismiss"
|
|
135
|
+
: "Tab next answer │ Esc dismiss │ Shift+X dismiss";
|
|
136
|
+
return [...painted, themeDim(theme.dim, padSheetLine(outerHelp, safeWidth))];
|
|
137
|
+
}
|
|
138
|
+
handleInput(data) {
|
|
139
|
+
const question = this.currentQuestion();
|
|
140
|
+
if (!question)
|
|
141
|
+
return;
|
|
142
|
+
const rowCount = question.options.length + (question.custom === false ? 0 : 1);
|
|
143
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c") || matchesKey(data, "shift+x")) {
|
|
144
|
+
this.onCancel?.();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (matchesKey(data, "up")) {
|
|
148
|
+
this.selectedIndex = (this.selectedIndex + rowCount - 1) % Math.max(1, rowCount);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (matchesKey(data, "down")) {
|
|
152
|
+
this.selectedIndex = (this.selectedIndex + 1) % Math.max(1, rowCount);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (matchesKey(data, "left") && this.questionIndex > 0) {
|
|
156
|
+
this.saveCurrentAnswer();
|
|
157
|
+
this.moveToQuestion(this.questionIndex - 1);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (matchesKey(data, "right") && this.questionIndex < this.request.questions.length - 1) {
|
|
161
|
+
this.saveCurrentAnswer();
|
|
162
|
+
this.moveToQuestion(this.questionIndex + 1);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (matchesKey(data, "tab")) {
|
|
166
|
+
if (this.request.questions.length > 1) {
|
|
167
|
+
this.commitAndAdvance();
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
this.selectedIndex = (this.selectedIndex + 1) % Math.max(1, rowCount);
|
|
171
|
+
}
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (/^[1-9]$/.test(data) && Number(data) <= question.options.length) {
|
|
175
|
+
this.selectedIndex = Number(data) - 1;
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const customSelected = question.custom !== false && this.selectedIndex === question.options.length;
|
|
179
|
+
if (matchesKey(data, "backspace") || matchesKey(data, "delete")) {
|
|
180
|
+
if (customSelected)
|
|
181
|
+
this.customInput = removeLastGrapheme(this.customInput);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (data === " " && !customSelected) {
|
|
185
|
+
this.toggleSelectedOption();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (matchesKey(data, "enter")) {
|
|
189
|
+
this.commitAndAdvance();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const printable = printableInput(data);
|
|
193
|
+
if (printable !== undefined && question.custom !== false) {
|
|
194
|
+
this.selectedIndex = question.options.length;
|
|
195
|
+
this.customInput += safeSheetText(printable).replace(/\n/g, " ");
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
invalidate() {
|
|
199
|
+
// Width, height, selection, and answers are projected on every render.
|
|
200
|
+
}
|
|
201
|
+
currentQuestion() {
|
|
202
|
+
return this.request.questions[this.questionIndex];
|
|
203
|
+
}
|
|
204
|
+
saveCurrentAnswer() {
|
|
205
|
+
const question = this.currentQuestion();
|
|
206
|
+
if (!question)
|
|
207
|
+
return [];
|
|
208
|
+
const customSelected = question.custom !== false && this.selectedIndex === question.options.length;
|
|
209
|
+
let answer;
|
|
210
|
+
if (customSelected) {
|
|
211
|
+
answer = this.customInput.trim() ? [this.customInput.trim()] : [];
|
|
212
|
+
}
|
|
213
|
+
else if (question.multiple) {
|
|
214
|
+
answer = [...(this.answers[this.questionIndex] ?? [])];
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
const label = question.options[this.selectedIndex]?.label;
|
|
218
|
+
answer = label ? [label] : [];
|
|
219
|
+
}
|
|
220
|
+
this.answers[this.questionIndex] = answer;
|
|
221
|
+
return answer;
|
|
222
|
+
}
|
|
223
|
+
toggleSelectedOption() {
|
|
224
|
+
const question = this.currentQuestion();
|
|
225
|
+
const option = question?.options[this.selectedIndex]?.label;
|
|
226
|
+
if (!question || !option)
|
|
227
|
+
return;
|
|
228
|
+
if (!question.multiple) {
|
|
229
|
+
this.answers[this.questionIndex] = [option];
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const current = this.answers[this.questionIndex] ?? [];
|
|
233
|
+
this.answers[this.questionIndex] = current.includes(option)
|
|
234
|
+
? current.filter((item) => item !== option)
|
|
235
|
+
: [...current, option];
|
|
236
|
+
}
|
|
237
|
+
commitAndAdvance() {
|
|
238
|
+
this.saveCurrentAnswer();
|
|
239
|
+
if (this.questionIndex < this.request.questions.length - 1) {
|
|
240
|
+
this.moveToQuestion(this.questionIndex + 1);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
this.onSubmit?.(this.answers.map((answer) => [...answer]));
|
|
244
|
+
}
|
|
245
|
+
moveToQuestion(index) {
|
|
246
|
+
this.questionIndex = index;
|
|
247
|
+
const question = this.currentQuestion();
|
|
248
|
+
const prior = this.answers[index]?.[0];
|
|
249
|
+
const priorOption = question?.options.findIndex((option) => option.label === prior) ?? -1;
|
|
250
|
+
if (priorOption >= 0) {
|
|
251
|
+
this.selectedIndex = priorOption;
|
|
252
|
+
this.customInput = "";
|
|
253
|
+
}
|
|
254
|
+
else if (prior && question?.custom !== false) {
|
|
255
|
+
this.selectedIndex = question.options.length;
|
|
256
|
+
this.customInput = prior;
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
this.selectedIndex = 0;
|
|
260
|
+
this.customInput = "";
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable transcript component.
|
|
3
|
+
*
|
|
4
|
+
* The component tree keeps this object for the lifetime of the TUI. Its rows
|
|
5
|
+
* are projected from message state at render time, so a terminal resize uses
|
|
6
|
+
* the new width instead of mechanically wrapping ANSI strings produced for an
|
|
7
|
+
* old width. This also makes message identity independent from rendered row
|
|
8
|
+
* count (which changes with Markdown, CJK, and terminal width).
|
|
9
|
+
*/
|
|
10
|
+
import type { Component, TuiMouseEvent } from "@bubblebrain-ai/pi-tui";
|
|
11
|
+
import type { DisplayMessage } from "../model/display-history.js";
|
|
12
|
+
import type { TraceAction } from "../model/trace-interaction.js";
|
|
13
|
+
import { type TranscriptRenderOptions } from "./transcript.js";
|
|
14
|
+
export interface ResponsiveTranscriptSnapshot {
|
|
15
|
+
messages: readonly DisplayMessage[];
|
|
16
|
+
options?: Omit<TranscriptRenderOptions, "columns">;
|
|
17
|
+
}
|
|
18
|
+
export interface ResponsiveTranscriptCallbacks {
|
|
19
|
+
onTraceAction?(action: TraceAction): void;
|
|
20
|
+
}
|
|
21
|
+
export declare class ResponsiveTranscriptComponent implements Component {
|
|
22
|
+
private readonly getSnapshot;
|
|
23
|
+
private readonly callbacks;
|
|
24
|
+
private traceTargets;
|
|
25
|
+
private traceInteraction?;
|
|
26
|
+
private cache?;
|
|
27
|
+
constructor(getSnapshot: () => ResponsiveTranscriptSnapshot, callbacks?: ResponsiveTranscriptCallbacks);
|
|
28
|
+
render(width: number): string[];
|
|
29
|
+
handleMouse(event: TuiMouseEvent): boolean;
|
|
30
|
+
invalidate(): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { projectTranscript, } from "./transcript.js";
|
|
2
|
+
export class ResponsiveTranscriptComponent {
|
|
3
|
+
getSnapshot;
|
|
4
|
+
callbacks;
|
|
5
|
+
traceTargets = [];
|
|
6
|
+
traceInteraction;
|
|
7
|
+
cache;
|
|
8
|
+
constructor(getSnapshot, callbacks = {}) {
|
|
9
|
+
this.getSnapshot = getSnapshot;
|
|
10
|
+
this.callbacks = callbacks;
|
|
11
|
+
}
|
|
12
|
+
render(width) {
|
|
13
|
+
const snapshot = this.getSnapshot();
|
|
14
|
+
const options = snapshot.options ?? {};
|
|
15
|
+
const normalizedWidth = Math.max(1, width);
|
|
16
|
+
const showReasoning = options.showReasoning ?? false;
|
|
17
|
+
const verboseTrace = options.verboseTrace ?? false;
|
|
18
|
+
const trailingSpacer = options.trailingSpacer !== false;
|
|
19
|
+
const dimFromMessageIndex = options.dimFromMessageIndex;
|
|
20
|
+
const traceRevision = options.traceInteraction?.getRevision() ?? 0;
|
|
21
|
+
const cached = this.cache;
|
|
22
|
+
const projection = cached
|
|
23
|
+
&& cached.messages === snapshot.messages
|
|
24
|
+
&& cached.width === normalizedWidth
|
|
25
|
+
&& cached.showReasoning === showReasoning
|
|
26
|
+
&& cached.verboseTrace === verboseTrace
|
|
27
|
+
&& cached.trailingSpacer === trailingSpacer
|
|
28
|
+
&& cached.dimFromMessageIndex === dimFromMessageIndex
|
|
29
|
+
&& cached.theme === options.theme
|
|
30
|
+
&& cached.markdownRenderer === options.markdownRenderer
|
|
31
|
+
&& cached.traceInteraction === options.traceInteraction
|
|
32
|
+
&& cached.traceRevision === traceRevision
|
|
33
|
+
? cached.projection
|
|
34
|
+
: projectTranscript(snapshot.messages, {
|
|
35
|
+
...options,
|
|
36
|
+
columns: normalizedWidth,
|
|
37
|
+
});
|
|
38
|
+
if (projection !== cached?.projection) {
|
|
39
|
+
this.cache = {
|
|
40
|
+
messages: snapshot.messages,
|
|
41
|
+
width: normalizedWidth,
|
|
42
|
+
showReasoning,
|
|
43
|
+
verboseTrace,
|
|
44
|
+
trailingSpacer,
|
|
45
|
+
dimFromMessageIndex,
|
|
46
|
+
theme: options.theme,
|
|
47
|
+
markdownRenderer: options.markdownRenderer,
|
|
48
|
+
traceInteraction: options.traceInteraction,
|
|
49
|
+
traceRevision,
|
|
50
|
+
projection,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
this.traceTargets = projection.traceTargets;
|
|
54
|
+
this.traceInteraction = options.traceInteraction;
|
|
55
|
+
return projection.rows;
|
|
56
|
+
}
|
|
57
|
+
handleMouse(event) {
|
|
58
|
+
if (!this.traceInteraction)
|
|
59
|
+
return false;
|
|
60
|
+
if (event.kind === "leave")
|
|
61
|
+
return this.traceInteraction.clearHover();
|
|
62
|
+
const target = this.traceTargets[event.y];
|
|
63
|
+
if (event.kind === "move")
|
|
64
|
+
return this.traceInteraction.hover(target);
|
|
65
|
+
if (event.release || (event.button & 3) !== 0 || !target)
|
|
66
|
+
return false;
|
|
67
|
+
const action = this.traceInteraction.activate(target, event.clickCount);
|
|
68
|
+
if (action)
|
|
69
|
+
this.callbacks.onTraceAction?.(action);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
invalidate() {
|
|
73
|
+
// Theme/capability changes can alter ANSI output without changing the
|
|
74
|
+
// immutable transcript reference. Width changes already miss naturally.
|
|
75
|
+
this.cache = undefined;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type Component, type Focusable, type TuiMouseEvent } from "@bubblebrain-ai/pi-tui";
|
|
2
|
+
import type { UserTurn } from "../../session.js";
|
|
3
|
+
import type { RewindScope } from "../../rewind.js";
|
|
4
|
+
import { type Theme } from "../model/theme.js";
|
|
5
|
+
export declare const REWIND_SCOPE_LABEL: Record<RewindScope, string>;
|
|
6
|
+
export interface RewindPickerPoint {
|
|
7
|
+
turn: UserTurn;
|
|
8
|
+
/** Oldest-first ordinal in SessionManager.listUserTurns(). */
|
|
9
|
+
turnIndex: number;
|
|
10
|
+
fileCount: number;
|
|
11
|
+
}
|
|
12
|
+
export type RewindPickerPhase = "loading" | "picker" | "cancel-offer" | "confirm" | "executing" | "error";
|
|
13
|
+
export interface RewindPickerCallbacks {
|
|
14
|
+
getTerminalRows(): number;
|
|
15
|
+
onPreview(point: RewindPickerPoint, scope: RewindScope): void;
|
|
16
|
+
onScopeChange(point: RewindPickerPoint | undefined, scope: RewindScope): void;
|
|
17
|
+
onCancel(): void;
|
|
18
|
+
onCancelRun(): void;
|
|
19
|
+
onConfirm(point: RewindPickerPoint, scope: RewindScope): void;
|
|
20
|
+
onRender(): void;
|
|
21
|
+
theme?: Theme;
|
|
22
|
+
}
|
|
23
|
+
/** Grok-style prompt-area rewind sheet: filled surface, accent rail, and full-row selection. */
|
|
24
|
+
export declare class RewindPickerComponent implements Component, Focusable {
|
|
25
|
+
private readonly callbacks;
|
|
26
|
+
focused: boolean;
|
|
27
|
+
private phase;
|
|
28
|
+
private points;
|
|
29
|
+
private selected;
|
|
30
|
+
private choice;
|
|
31
|
+
private scope;
|
|
32
|
+
private error;
|
|
33
|
+
private hitRows;
|
|
34
|
+
constructor(initialPhase: "picker" | "cancel-offer", points: RewindPickerPoint[], callbacks: RewindPickerCallbacks);
|
|
35
|
+
getPhase(): RewindPickerPhase;
|
|
36
|
+
getSelectedPoint(): RewindPickerPoint | undefined;
|
|
37
|
+
showLoading(): void;
|
|
38
|
+
showPicker(points: RewindPickerPoint[]): void;
|
|
39
|
+
showExecuting(): void;
|
|
40
|
+
showError(message: string): void;
|
|
41
|
+
render(width: number): string[];
|
|
42
|
+
handleInput(data: string): void;
|
|
43
|
+
handleMouse(event: TuiMouseEvent): boolean;
|
|
44
|
+
invalidate(): void;
|
|
45
|
+
private renderPicker;
|
|
46
|
+
private renderCancelOffer;
|
|
47
|
+
private renderConfirm;
|
|
48
|
+
private renderError;
|
|
49
|
+
private line;
|
|
50
|
+
private choiceLine;
|
|
51
|
+
private finish;
|
|
52
|
+
private setPoints;
|
|
53
|
+
private visiblePointBudget;
|
|
54
|
+
private movePoint;
|
|
55
|
+
private moveChoice;
|
|
56
|
+
private stepScope;
|
|
57
|
+
private emitPreview;
|
|
58
|
+
private confirm;
|
|
59
|
+
private activateCancelChoice;
|
|
60
|
+
private hover;
|
|
61
|
+
private activate;
|
|
62
|
+
}
|