@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
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useState } from "react";
|
|
3
|
-
import { Box, Text, useInput, useStdout } from "ink";
|
|
4
|
-
import { isKeyReleaseEvent } from "./key-events.js";
|
|
5
|
-
import { useTheme } from "./theme.js";
|
|
6
|
-
import { formatRelativeTime } from "./recent-activity.js";
|
|
7
|
-
import { padVisual, truncateVisual } from "../text-display.js";
|
|
8
|
-
export function SessionPicker({ currentCwd, currentSessions, allSessions, onSelect, onCancel }) {
|
|
9
|
-
const theme = useTheme();
|
|
10
|
-
const { stdout } = useStdout();
|
|
11
|
-
const termHeight = stdout?.rows || 24;
|
|
12
|
-
const termWidth = stdout?.columns || 80;
|
|
13
|
-
const maxVisible = Math.max(6, termHeight - 10);
|
|
14
|
-
const [mode, setMode] = useState("current");
|
|
15
|
-
const [selectedSessionIdx, setSelectedSessionIdx] = useState(0);
|
|
16
|
-
const rows = useMemo(() => buildRows(mode, currentCwd, currentSessions, allSessions), [mode, currentCwd, currentSessions, allSessions]);
|
|
17
|
-
const sessionRowIndices = useMemo(() => rows.map((row, i) => (row.type === "session" ? i : -1)).filter((i) => i >= 0), [rows]);
|
|
18
|
-
const clampedIdx = sessionRowIndices.length === 0
|
|
19
|
-
? 0
|
|
20
|
-
: Math.min(selectedSessionIdx, sessionRowIndices.length - 1);
|
|
21
|
-
const selectedRowIndex = sessionRowIndices[clampedIdx] ?? -1;
|
|
22
|
-
useInput((_input, key) => {
|
|
23
|
-
if (isKeyReleaseEvent(key))
|
|
24
|
-
return;
|
|
25
|
-
if (key.escape) {
|
|
26
|
-
onCancel();
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (key.tab) {
|
|
30
|
-
setMode((m) => (m === "current" ? "all" : "current"));
|
|
31
|
-
setSelectedSessionIdx(0);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (key.return) {
|
|
35
|
-
const row = rows[selectedRowIndex];
|
|
36
|
-
if (row?.type === "session" && row.session)
|
|
37
|
-
onSelect(row.session.file);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (key.upArrow) {
|
|
41
|
-
setSelectedSessionIdx((i) => Math.max(0, i - 1));
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (key.downArrow) {
|
|
45
|
-
setSelectedSessionIdx((i) => Math.min(Math.max(0, sessionRowIndices.length - 1), i + 1));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
// Window the visible rows around the selected session.
|
|
50
|
-
const start = clampWindowStart(rows, selectedRowIndex, maxVisible);
|
|
51
|
-
const visible = rows.slice(start, start + maxVisible);
|
|
52
|
-
const modeLabel = mode === "current" ? "Current dir" : "All directories";
|
|
53
|
-
const totalSessions = sessionRowIndices.length;
|
|
54
|
-
return (_jsxs(Box, { flexDirection: "column", marginY: 1, paddingX: 1, borderStyle: "round", borderColor: theme.borderActive, children: [_jsx(Text, { bold: true, color: theme.accent, children: "Resume session" }), _jsxs(Text, { color: theme.muted, children: ["View: ", _jsx(Text, { color: theme.accent, children: modeLabel }), " · ", totalSessions, " session", totalSessions === 1 ? "" : "s"] }), _jsx(Text, { color: theme.muted, children: "\u2191/\u2193 navigate \u00B7 Enter resume \u00B7 Tab toggle scope \u00B7 Esc start fresh" }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [totalSessions === 0 && (_jsx(Text, { color: theme.muted, children: mode === "current"
|
|
55
|
-
? "No previous sessions in this directory."
|
|
56
|
-
: "No previous sessions found." })), visible.map((row, i) => {
|
|
57
|
-
const actualIndex = start + i;
|
|
58
|
-
if (row.type === "header") {
|
|
59
|
-
return (_jsx(Box, { marginTop: i === 0 ? 0 : 1, children: _jsx(Text, { color: theme.muted, bold: true, children: row.label }) }, `h-${actualIndex}`));
|
|
60
|
-
}
|
|
61
|
-
const session = row.session;
|
|
62
|
-
const isSelected = actualIndex === selectedRowIndex;
|
|
63
|
-
const time = padVisual(formatRelativeTime(session.mtime), 9);
|
|
64
|
-
const titleWidth = Math.max(20, Math.min(80, termWidth - 30));
|
|
65
|
-
return (_jsxs(Box, { children: [_jsxs(Text, { color: isSelected ? theme.accent : undefined, children: [isSelected ? "> " : " ", time, " ", padVisual(truncateVisual(session.title, titleWidth), titleWidth)] }), _jsx(Box, { marginLeft: 1, children: _jsxs(Text, { color: theme.muted, dimColor: true, children: ["\u00B7 ", session.messageCount, " msg", session.messageCount === 1 ? "" : "s"] }) })] }, session.file));
|
|
66
|
-
})] })] }));
|
|
67
|
-
}
|
|
68
|
-
function buildRows(mode, currentCwd, currentSessions, allSessions) {
|
|
69
|
-
if (mode === "current") {
|
|
70
|
-
if (currentSessions.length === 0)
|
|
71
|
-
return [];
|
|
72
|
-
return [
|
|
73
|
-
{ type: "header", label: currentCwd },
|
|
74
|
-
...currentSessions.map((session) => ({ type: "session", session })),
|
|
75
|
-
];
|
|
76
|
-
}
|
|
77
|
-
const grouped = new Map();
|
|
78
|
-
for (const session of allSessions) {
|
|
79
|
-
const key = session.cwdLabel;
|
|
80
|
-
const list = grouped.get(key);
|
|
81
|
-
if (list)
|
|
82
|
-
list.push(session);
|
|
83
|
-
else
|
|
84
|
-
grouped.set(key, [session]);
|
|
85
|
-
}
|
|
86
|
-
const sortedGroups = Array.from(grouped.entries()).sort((a, b) => {
|
|
87
|
-
if (a[0] === currentCwd)
|
|
88
|
-
return -1;
|
|
89
|
-
if (b[0] === currentCwd)
|
|
90
|
-
return 1;
|
|
91
|
-
const aLatest = a[1][0]?.mtime ?? 0;
|
|
92
|
-
const bLatest = b[1][0]?.mtime ?? 0;
|
|
93
|
-
return bLatest - aLatest;
|
|
94
|
-
});
|
|
95
|
-
const rows = [];
|
|
96
|
-
for (const [label, sessions] of sortedGroups) {
|
|
97
|
-
rows.push({ type: "header", label });
|
|
98
|
-
for (const session of sessions)
|
|
99
|
-
rows.push({ type: "session", session });
|
|
100
|
-
}
|
|
101
|
-
return rows;
|
|
102
|
-
}
|
|
103
|
-
function clampWindowStart(rows, selectedRowIndex, maxVisible) {
|
|
104
|
-
if (rows.length <= maxVisible)
|
|
105
|
-
return 0;
|
|
106
|
-
if (selectedRowIndex < 0)
|
|
107
|
-
return 0;
|
|
108
|
-
const half = Math.floor(maxVisible / 2);
|
|
109
|
-
let start = Math.max(0, selectedRowIndex - half);
|
|
110
|
-
if (start + maxVisible > rows.length)
|
|
111
|
-
start = rows.length - maxVisible;
|
|
112
|
-
return Math.max(0, start);
|
|
113
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type StatsRange, type UsageStatsBundle } from "../stats/usage.js";
|
|
2
|
-
export declare function StatsPanel({ panel, terminalColumns, terminalRows, onRangeChange, onCancel, }: {
|
|
3
|
-
panel: {
|
|
4
|
-
range: StatsRange;
|
|
5
|
-
bundle: UsageStatsBundle;
|
|
6
|
-
};
|
|
7
|
-
terminalColumns: number;
|
|
8
|
-
terminalRows: number;
|
|
9
|
-
onRangeChange: (range: StatsRange) => void;
|
|
10
|
-
onCancel: () => void;
|
|
11
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* /stats overlay: range-switching, scrollable usage panel.
|
|
4
|
-
*/
|
|
5
|
-
import { useEffect, useMemo, useState } from "react";
|
|
6
|
-
import { Box, Text, useInput } from "ink";
|
|
7
|
-
import { formatStatsPanelBody, rangeLabel } from "../stats/usage.js";
|
|
8
|
-
import { useTheme } from "./theme.js";
|
|
9
|
-
import { isKeyReleaseEvent } from "./key-events.js";
|
|
10
|
-
export function StatsPanel({ panel, terminalColumns, terminalRows, onRangeChange, onCancel, }) {
|
|
11
|
-
const theme = useTheme();
|
|
12
|
-
const [scroll, setScroll] = useState(0);
|
|
13
|
-
const bodyWidth = Math.max(48, Math.min(92, terminalColumns - 6));
|
|
14
|
-
const lines = useMemo(() => formatStatsPanelBody(panel.bundle.ranges[panel.range], bodyWidth).split("\n"), [bodyWidth, panel.bundle, panel.range]);
|
|
15
|
-
const maxVisible = Math.max(5, Math.min(16, terminalRows - 10));
|
|
16
|
-
const maxScroll = Math.max(0, lines.length - maxVisible);
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
setScroll(0);
|
|
19
|
-
}, [panel.range]);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
setScroll((current) => Math.min(current, maxScroll));
|
|
22
|
-
}, [maxScroll]);
|
|
23
|
-
useInput((input, key) => {
|
|
24
|
-
if (isKeyReleaseEvent(key))
|
|
25
|
-
return;
|
|
26
|
-
if (key.escape) {
|
|
27
|
-
onCancel();
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (key.tab) {
|
|
31
|
-
onRangeChange(panel.range === "30d" ? "7d" : "30d");
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (key.leftArrow || input === "h") {
|
|
35
|
-
onRangeChange("7d");
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (key.rightArrow || input === "l") {
|
|
39
|
-
onRangeChange("30d");
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (key.upArrow) {
|
|
43
|
-
setScroll((current) => Math.max(0, current - 1));
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (key.downArrow) {
|
|
47
|
-
setScroll((current) => Math.min(maxScroll, current + 1));
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (key.pageUp) {
|
|
51
|
-
setScroll((current) => Math.max(0, current - maxVisible));
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (key.pageDown) {
|
|
55
|
-
setScroll((current) => Math.min(maxScroll, current + maxVisible));
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
const visible = lines.slice(scroll, scroll + maxVisible);
|
|
59
|
-
const generatedAt = panel.bundle.generatedAt.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
60
|
-
return (_jsxs(Box, { flexDirection: "column", marginY: 1, paddingX: 1, borderStyle: "round", borderColor: theme.borderActive, children: [_jsx(Text, { bold: true, color: theme.accent, children: "Stats" }), _jsxs(Text, { color: theme.muted, children: [rangeLabel(panel.range), " \u00B7 generated ", generatedAt] }), _jsx(Text, { color: theme.muted, children: "Left/Right range \u00B7 Up/Down scroll \u00B7 Tab toggle \u00B7 Esc close" }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: visible.map((line, index) => {
|
|
61
|
-
const key = `${scroll + index}-${line}`;
|
|
62
|
-
const heading = line === "Activity" || line === "Model usage" || line === "Summary";
|
|
63
|
-
return (_jsx(Text, { color: heading ? theme.accent : undefined, bold: heading, children: line || " " }, key));
|
|
64
|
-
}) }), maxScroll > 0 && (_jsxs(Text, { color: theme.muted, children: [scroll + 1, "-", Math.min(lines.length, scroll + maxVisible), " of ", lines.length] }))] }));
|
|
65
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Full-screen subagent inspector opened from the subagent entry line.
|
|
3
|
-
*
|
|
4
|
-
* Two-level drill-in modeled on Claude Code's workflow view: a grouped list of
|
|
5
|
-
* subagents (each spawn_agent is one member; each agent_team/agent_batch is a
|
|
6
|
-
* group of members) → a per-member working-trace detail (its task, every tool
|
|
7
|
-
* step it ran, and its final summary/error). Data is live: app.tsx derives the
|
|
8
|
-
* groups from the message state each render, so the inspector reflects running
|
|
9
|
-
* members as their events stream in.
|
|
10
|
-
*/
|
|
11
|
-
import { type SubagentGroup } from "./subagent-view.js";
|
|
12
|
-
import type { BackgroundTaskInfo } from "../tasks/manager.js";
|
|
13
|
-
export type { SubagentGroup };
|
|
14
|
-
export interface SubagentInspectorProps {
|
|
15
|
-
groups: SubagentGroup[];
|
|
16
|
-
onCancel: () => void;
|
|
17
|
-
/** Background tasks of the bound session (design §2.5). */
|
|
18
|
-
tasks?: BackgroundTaskInfo[];
|
|
19
|
-
onKillTask?: (taskId: string) => void;
|
|
20
|
-
}
|
|
21
|
-
export declare function SubagentInspector({ groups, onCancel, tasks, onKillTask }: SubagentInspectorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Full-screen subagent inspector opened from the subagent entry line.
|
|
4
|
-
*
|
|
5
|
-
* Two-level drill-in modeled on Claude Code's workflow view: a grouped list of
|
|
6
|
-
* subagents (each spawn_agent is one member; each agent_team/agent_batch is a
|
|
7
|
-
* group of members) → a per-member working-trace detail (its task, every tool
|
|
8
|
-
* step it ran, and its final summary/error). Data is live: app.tsx derives the
|
|
9
|
-
* groups from the message state each render, so the inspector reflects running
|
|
10
|
-
* members as their events stream in.
|
|
11
|
-
*/
|
|
12
|
-
import { useMemo, useState } from "react";
|
|
13
|
-
import { Box, Text, useInput, useStdout } from "ink";
|
|
14
|
-
import { isKeyReleaseEvent } from "./key-events.js";
|
|
15
|
-
import { useTheme } from "./theme.js";
|
|
16
|
-
import { padVisual, truncateVisual } from "../text-display.js";
|
|
17
|
-
import { latestSubagentNote, subagentDescriptor, subagentLabel, subagentStatusColor, subagentSummary, } from "./subagent-view.js";
|
|
18
|
-
const STATUS_FILTERS = [null, "running", "queued", "completed", "failed"];
|
|
19
|
-
export function SubagentInspector({ groups, onCancel, tasks = [], onKillTask }) {
|
|
20
|
-
const theme = useTheme();
|
|
21
|
-
const { stdout } = useStdout();
|
|
22
|
-
const termHeight = stdout?.rows || 24;
|
|
23
|
-
const termWidth = stdout?.columns || 80;
|
|
24
|
-
const maxVisible = Math.max(6, termHeight - 12);
|
|
25
|
-
const [view, setView] = useState("list");
|
|
26
|
-
const [selectedIdx, setSelectedIdx] = useState(0);
|
|
27
|
-
const [detailScroll, setDetailScroll] = useState(0);
|
|
28
|
-
const [filterIdx, setFilterIdx] = useState(0);
|
|
29
|
-
const statusFilter = STATUS_FILTERS[filterIdx];
|
|
30
|
-
const allMembers = useMemo(() => groups.flatMap((g) => g.members), [groups]);
|
|
31
|
-
// Flat row list: background tasks first (design §2.5), then a header per
|
|
32
|
-
// multi-member group and its (filtered) members.
|
|
33
|
-
const rows = useMemo(() => {
|
|
34
|
-
const out = [];
|
|
35
|
-
for (const task of tasks) {
|
|
36
|
-
out.push({ type: "task", task, key: task.id });
|
|
37
|
-
}
|
|
38
|
-
for (const group of groups) {
|
|
39
|
-
const members = statusFilter
|
|
40
|
-
? group.members.filter((m) => (m.status ?? "running") === statusFilter)
|
|
41
|
-
: group.members;
|
|
42
|
-
if (members.length === 0)
|
|
43
|
-
continue;
|
|
44
|
-
if (group.kind !== "single")
|
|
45
|
-
out.push({ type: "header", group });
|
|
46
|
-
members.forEach((member, i) => {
|
|
47
|
-
out.push({ type: "member", group, member, key: member.subAgentId ?? `${group.id}:${i}` });
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return out;
|
|
51
|
-
}, [groups, statusFilter, tasks]);
|
|
52
|
-
const memberRowIndices = useMemo(() => rows.map((row, i) => (row.type === "member" || row.type === "task" ? i : -1)).filter((i) => i >= 0), [rows]);
|
|
53
|
-
const clampedIdx = memberRowIndices.length === 0 ? 0 : Math.min(selectedIdx, memberRowIndices.length - 1);
|
|
54
|
-
const selectedRowIndex = memberRowIndices[clampedIdx] ?? -1;
|
|
55
|
-
const selectedRow = rows[selectedRowIndex];
|
|
56
|
-
const selectedMember = selectedRow?.type === "member" ? selectedRow.member : undefined;
|
|
57
|
-
const selectedTask = selectedRow?.type === "task" ? selectedRow.task : undefined;
|
|
58
|
-
useInput((input, key) => {
|
|
59
|
-
if (isKeyReleaseEvent(key))
|
|
60
|
-
return;
|
|
61
|
-
if (view === "detail") {
|
|
62
|
-
if (key.escape || key.leftArrow) {
|
|
63
|
-
setView("list");
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (key.upArrow || input === "k") {
|
|
67
|
-
setDetailScroll((s) => Math.max(0, s - 1));
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (key.downArrow || input === "j") {
|
|
71
|
-
setDetailScroll((s) => s + 1);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
// list view
|
|
77
|
-
if (key.escape) {
|
|
78
|
-
onCancel();
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (input === "f") {
|
|
82
|
-
setFilterIdx((i) => (i + 1) % STATUS_FILTERS.length);
|
|
83
|
-
setSelectedIdx(0);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (key.upArrow) {
|
|
87
|
-
setSelectedIdx((i) => Math.max(0, i - 1));
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (key.downArrow) {
|
|
91
|
-
setSelectedIdx((i) => Math.min(Math.max(0, memberRowIndices.length - 1), i + 1));
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if ((key.return || key.rightArrow) && selectedMember) {
|
|
95
|
-
setDetailScroll(0);
|
|
96
|
-
setView("detail");
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (input === "x" && selectedTask && selectedTask.status === "running") {
|
|
100
|
-
onKillTask?.(selectedTask.id);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
if (groups.length === 0 && tasks.length === 0) {
|
|
105
|
-
return (_jsxs(Box, { flexDirection: "column", marginY: 1, paddingX: 1, borderStyle: "round", borderColor: theme.borderActive, children: [_jsx(Text, { bold: true, color: theme.accent, children: "Subagents & tasks" }), _jsx(Text, { color: theme.muted, children: "No subagents or background tasks yet. Esc to close." })] }));
|
|
106
|
-
}
|
|
107
|
-
if (view === "detail" && selectedMember) {
|
|
108
|
-
return (_jsx(SubagentDetail, { member: selectedMember, group: selectedRow?.type === "member" ? selectedRow.group : undefined, scroll: detailScroll, maxVisible: maxVisible, termWidth: termWidth }));
|
|
109
|
-
}
|
|
110
|
-
// ---- list view ----
|
|
111
|
-
const start = clampWindowStart(rows, selectedRowIndex, maxVisible);
|
|
112
|
-
const visible = rows.slice(start, start + maxVisible);
|
|
113
|
-
const labelWidth = 12;
|
|
114
|
-
const descriptorWidth = Math.max(20, Math.min(46, termWidth - 48));
|
|
115
|
-
return (_jsxs(Box, { flexDirection: "column", marginY: 1, paddingX: 1, borderStyle: "round", borderColor: theme.borderActive, children: [_jsx(Text, { bold: true, color: theme.accent, children: tasks.length > 0 ? "Subagents & tasks · working traces" : "Subagents · working traces" }), _jsxs(Text, { color: theme.muted, children: [allMembers.length, " member", allMembers.length === 1 ? "" : "s", " \u00B7 ", subagentSummary(allMembers), tasks.length > 0 ? ` · ${tasks.length} task${tasks.length === 1 ? "" : "s"}` : "", statusFilter ? ` · filter: ${statusFilter}` : ""] }), _jsxs(Text, { color: theme.muted, children: ["\u2191/\u2193 select \u00B7 Enter/\u2192 open trace", tasks.length > 0 ? " · x kill task" : "", " \u00B7 f filter status \u00B7 Esc close"] }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [rows.length === 0 && (_jsx(Text, { color: theme.muted, children: "No members match the current filter." })), visible.map((row, i) => {
|
|
116
|
-
const actualIndex = start + i;
|
|
117
|
-
if (row.type === "task") {
|
|
118
|
-
const task = row.task;
|
|
119
|
-
const isSelected = actualIndex === selectedRowIndex;
|
|
120
|
-
const elapsed = Math.max(0, Math.round(((task.endedAt ?? Date.now()) - task.startedAt) / 1000));
|
|
121
|
-
const statusColor = task.status === "running" ? theme.warning : task.status === "completed" ? theme.success : theme.error;
|
|
122
|
-
return (_jsxs(Box, { children: [_jsx(Text, { color: isSelected ? theme.accent : undefined, children: isSelected ? "> " : " " }), _jsx(Text, { color: statusColor, children: padVisual(task.id, labelWidth) }), _jsxs(Text, { color: theme.traceAction, children: [" ", padVisual(truncateVisual(task.description || task.command, descriptorWidth), descriptorWidth)] }), _jsxs(Text, { color: statusColor, children: [" ", padVisual(task.status, 9)] }), _jsxs(Text, { color: theme.traceDetail, children: [" ", elapsed, "s", task.exitCode != null ? ` · exit ${task.exitCode}` : ""] })] }, row.key));
|
|
123
|
-
}
|
|
124
|
-
if (row.type === "header") {
|
|
125
|
-
return (_jsx(Box, { marginTop: i === 0 ? 0 : 1, children: _jsxs(Text, { bold: true, color: theme.muted, children: ["\u25A6 ", row.group.kind, " \u00B7 ", truncateVisual(row.group.label, termWidth - 18), " (", row.group.members.length, ")"] }) }, `h-${actualIndex}`));
|
|
126
|
-
}
|
|
127
|
-
const member = row.member;
|
|
128
|
-
const status = member.status ?? "running";
|
|
129
|
-
const isSelected = actualIndex === selectedRowIndex;
|
|
130
|
-
const note = truncateVisual(latestSubagentNote(member), Math.max(12, termWidth - labelWidth - descriptorWidth - 18));
|
|
131
|
-
return (_jsxs(Box, { children: [_jsx(Text, { color: isSelected ? theme.accent : undefined, children: isSelected ? "> " : " " }), _jsx(Text, { color: subagentStatusColor(status, theme), children: padVisual(truncateVisual(subagentLabel(member), labelWidth), labelWidth) }), _jsxs(Text, { color: theme.traceAction, children: [" ", padVisual(truncateVisual(subagentDescriptor(member), descriptorWidth), descriptorWidth)] }), _jsxs(Text, { color: subagentStatusColor(status, theme), children: [" ", padVisual(status, 9)] }), note && _jsxs(Text, { color: member.error ? theme.error : theme.traceDetail, children: [" ", note] })] }, row.key));
|
|
132
|
-
})] })] }));
|
|
133
|
-
}
|
|
134
|
-
function SubagentDetail({ member, group, scroll, maxVisible, termWidth, }) {
|
|
135
|
-
const theme = useTheme();
|
|
136
|
-
const status = member.status ?? "running";
|
|
137
|
-
const wrapWidth = Math.max(20, termWidth - 6);
|
|
138
|
-
// Build the scrollable body: task → working trace (every tool step) → summary/error.
|
|
139
|
-
const body = [];
|
|
140
|
-
if (member.task) {
|
|
141
|
-
body.push({ text: "Task", color: theme.muted });
|
|
142
|
-
for (const line of wrapText(member.task, wrapWidth))
|
|
143
|
-
body.push({ text: ` ${line}` });
|
|
144
|
-
body.push({ text: "" });
|
|
145
|
-
}
|
|
146
|
-
body.push({ text: `Working trace (${member.toolNotes?.length ?? 0} steps)`, color: theme.muted });
|
|
147
|
-
const notes = member.toolNotes?.filter(Boolean) ?? [];
|
|
148
|
-
if (notes.length === 0) {
|
|
149
|
-
body.push({ text: " (no tool steps recorded yet)", dim: true });
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
notes.forEach((noteRaw, i) => {
|
|
153
|
-
const note = noteRaw.replace(/\r\n/g, "\n").split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
154
|
-
const wrapped = wrapText(`${String(i + 1).padStart(2, " ")}. ${note}`, wrapWidth);
|
|
155
|
-
wrapped.forEach((line, j) => body.push({ text: ` ${j === 0 ? line : ` ${line}`}`, color: theme.traceDetail }));
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
if (member.error) {
|
|
159
|
-
body.push({ text: "" });
|
|
160
|
-
body.push({ text: "Error", color: theme.error });
|
|
161
|
-
for (const line of wrapText(member.error, wrapWidth))
|
|
162
|
-
body.push({ text: ` ${line}`, color: theme.error });
|
|
163
|
-
}
|
|
164
|
-
else if (member.summary) {
|
|
165
|
-
body.push({ text: "" });
|
|
166
|
-
body.push({ text: "Summary", color: theme.muted });
|
|
167
|
-
for (const line of wrapText(member.summary, wrapWidth))
|
|
168
|
-
body.push({ text: ` ${line}` });
|
|
169
|
-
}
|
|
170
|
-
const maxScroll = Math.max(0, body.length - maxVisible);
|
|
171
|
-
const clampedScroll = Math.min(scroll, maxScroll);
|
|
172
|
-
const visible = body.slice(clampedScroll, clampedScroll + maxVisible);
|
|
173
|
-
return (_jsxs(Box, { flexDirection: "column", marginY: 1, paddingX: 1, borderStyle: "round", borderColor: theme.borderActive, children: [_jsxs(Box, { children: [_jsx(Text, { bold: true, color: theme.accent, children: subagentLabel(member) }), _jsxs(Text, { color: theme.traceAction, children: [" ", subagentDescriptor(member, true)] }), _jsxs(Text, { color: subagentStatusColor(status, theme), children: [" ", status] }), group && group.kind !== "single" && _jsxs(Text, { color: theme.muted, children: [" \u00B7 ", group.kind, " \u201C", truncateVisual(group.label, 28), "\u201D"] })] }), _jsxs(Text, { color: theme.muted, children: ["\u2191/\u2193 or j/k scroll \u00B7 \u2190/Esc back", maxScroll > 0 ? ` · ${clampedScroll + 1}-${Math.min(clampedScroll + maxVisible, body.length)}/${body.length}` : ""] }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: visible.map((line, i) => (_jsx(Text, { color: line.color, dimColor: line.dim, children: line.text || " " }, i))) })] }));
|
|
174
|
-
}
|
|
175
|
-
function wrapText(text, width) {
|
|
176
|
-
const out = [];
|
|
177
|
-
for (const rawLine of text.replace(/\r\n/g, "\n").split("\n")) {
|
|
178
|
-
let line = rawLine;
|
|
179
|
-
if (line.length === 0) {
|
|
180
|
-
out.push("");
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
while (line.length > width) {
|
|
184
|
-
// Prefer breaking at the last space within the width window.
|
|
185
|
-
let cut = line.lastIndexOf(" ", width);
|
|
186
|
-
if (cut <= 0)
|
|
187
|
-
cut = width;
|
|
188
|
-
out.push(line.slice(0, cut).trimEnd());
|
|
189
|
-
line = line.slice(cut).trimStart();
|
|
190
|
-
}
|
|
191
|
-
out.push(line);
|
|
192
|
-
}
|
|
193
|
-
return out;
|
|
194
|
-
}
|
|
195
|
-
function clampWindowStart(rows, selectedRowIndex, maxVisible) {
|
|
196
|
-
if (rows.length <= maxVisible)
|
|
197
|
-
return 0;
|
|
198
|
-
if (selectedRowIndex < 0)
|
|
199
|
-
return 0;
|
|
200
|
-
const half = Math.floor(maxVisible / 2);
|
|
201
|
-
let start = Math.max(0, selectedRowIndex - half);
|
|
202
|
-
if (start + maxVisible > rows.length)
|
|
203
|
-
start = rows.length - maxVisible;
|
|
204
|
-
return Math.max(0, start);
|
|
205
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { useStdout } from "ink";
|
|
3
|
-
const subscribers = new Set();
|
|
4
|
-
let attachedStream = null;
|
|
5
|
-
function notifyAll() {
|
|
6
|
-
for (const cb of subscribers)
|
|
7
|
-
cb();
|
|
8
|
-
}
|
|
9
|
-
function detach() {
|
|
10
|
-
if (!attachedStream)
|
|
11
|
-
return;
|
|
12
|
-
const off = attachedStream.off ?? attachedStream.removeListener;
|
|
13
|
-
off?.call(attachedStream, "resize", notifyAll);
|
|
14
|
-
attachedStream = null;
|
|
15
|
-
}
|
|
16
|
-
function subscribe(stream, cb) {
|
|
17
|
-
subscribers.add(cb);
|
|
18
|
-
if (attachedStream !== stream) {
|
|
19
|
-
detach();
|
|
20
|
-
stream.on("resize", notifyAll);
|
|
21
|
-
attachedStream = stream;
|
|
22
|
-
}
|
|
23
|
-
return () => {
|
|
24
|
-
subscribers.delete(cb);
|
|
25
|
-
if (subscribers.size === 0)
|
|
26
|
-
detach();
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export function useTerminalSize() {
|
|
30
|
-
const { stdout } = useStdout();
|
|
31
|
-
const [size, setSize] = useState(() => ({
|
|
32
|
-
columns: stdout?.columns || 80,
|
|
33
|
-
rows: stdout?.rows || 24,
|
|
34
|
-
}));
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (!stdout)
|
|
37
|
-
return;
|
|
38
|
-
const update = () => {
|
|
39
|
-
setSize((prev) => {
|
|
40
|
-
const next = { columns: stdout.columns || 80, rows: stdout.rows || 24 };
|
|
41
|
-
return prev.columns === next.columns && prev.rows === next.rows ? prev : next;
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
update(); // sync in case the size changed between initial state and mount
|
|
45
|
-
return subscribe(stdout, update);
|
|
46
|
-
}, [stdout]);
|
|
47
|
-
return size;
|
|
48
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { DisplayToolCall } from "./display-history.js";
|
|
2
|
-
interface WaitingIndicatorProps {
|
|
3
|
-
tools: DisplayToolCall[];
|
|
4
|
-
hasStreamingText: boolean;
|
|
5
|
-
hasStreamingReasoning: boolean;
|
|
6
|
-
streamedChars: number;
|
|
7
|
-
nowTick: number;
|
|
8
|
-
pendingSteerCount?: number;
|
|
9
|
-
queuedCount?: number;
|
|
10
|
-
}
|
|
11
|
-
export declare function WaitingIndicator({ tools, hasStreamingText, hasStreamingReasoning, streamedChars, nowTick, pendingSteerCount, queuedCount, }: WaitingIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* The animated spinner row shown while a run is in flight: tool-targeted or
|
|
4
|
-
* generic phrases, streaming token counter, and steer/queue hints.
|
|
5
|
-
*/
|
|
6
|
-
import { useEffect, useState } from "react";
|
|
7
|
-
import { Box, Text } from "ink";
|
|
8
|
-
import { useTheme } from "./theme.js";
|
|
9
|
-
const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
10
|
-
const GENERIC_PHRASES = [
|
|
11
|
-
"mapping the workspace",
|
|
12
|
-
"reading the room",
|
|
13
|
-
"following the threads",
|
|
14
|
-
"connecting the pieces",
|
|
15
|
-
"sorting the context",
|
|
16
|
-
"scanning the structure",
|
|
17
|
-
"shaping the next step",
|
|
18
|
-
"gathering signal",
|
|
19
|
-
"checking the edges",
|
|
20
|
-
"lining up the answer",
|
|
21
|
-
"tracing the flow",
|
|
22
|
-
"building the picture",
|
|
23
|
-
"walking the graph",
|
|
24
|
-
"collecting the clues",
|
|
25
|
-
"framing the problem",
|
|
26
|
-
"locating the source",
|
|
27
|
-
"resolving the shape",
|
|
28
|
-
"untangling the state",
|
|
29
|
-
"comparing the paths",
|
|
30
|
-
"narrowing the target",
|
|
31
|
-
"tracking the changes",
|
|
32
|
-
"reading the patterns",
|
|
33
|
-
"weighing the options",
|
|
34
|
-
"assembling the context",
|
|
35
|
-
"following the signal",
|
|
36
|
-
"checking the assumptions",
|
|
37
|
-
"aligning the details",
|
|
38
|
-
"testing the shape",
|
|
39
|
-
"pulling the thread",
|
|
40
|
-
"cleaning the edges",
|
|
41
|
-
"refining the draft",
|
|
42
|
-
"verifying the route",
|
|
43
|
-
"making sense of it",
|
|
44
|
-
"looking for leverage",
|
|
45
|
-
"stitching the answer",
|
|
46
|
-
"holding the thread",
|
|
47
|
-
"distilling the noise",
|
|
48
|
-
"finding the seam",
|
|
49
|
-
"reading between the lines",
|
|
50
|
-
"preparing the response",
|
|
51
|
-
];
|
|
52
|
-
const TOOL_TARGET_PHRASES = {
|
|
53
|
-
read: "reading files",
|
|
54
|
-
write: "writing changes",
|
|
55
|
-
edit: "patching files",
|
|
56
|
-
grep: "searching the codebase",
|
|
57
|
-
glob: "scanning paths",
|
|
58
|
-
ls: "listing directories",
|
|
59
|
-
bash: "running command",
|
|
60
|
-
web_search: "searching the web",
|
|
61
|
-
web_fetch: "fetching a page",
|
|
62
|
-
task: "spawning subagent",
|
|
63
|
-
};
|
|
64
|
-
function formatTokensApprox(chars) {
|
|
65
|
-
const tokens = Math.max(0, Math.round(chars / 4));
|
|
66
|
-
if (tokens < 1000)
|
|
67
|
-
return `${tokens}`;
|
|
68
|
-
if (tokens < 10000)
|
|
69
|
-
return `${(tokens / 1000).toFixed(1)}k`;
|
|
70
|
-
return `${Math.round(tokens / 1000)}k`;
|
|
71
|
-
}
|
|
72
|
-
export function WaitingIndicator({ tools, hasStreamingText, hasStreamingReasoning, streamedChars, nowTick, pendingSteerCount = 0, queuedCount = 0, }) {
|
|
73
|
-
void nowTick;
|
|
74
|
-
const theme = useTheme();
|
|
75
|
-
const [frameIndex, setFrameIndex] = useState(0);
|
|
76
|
-
const [idlePhrase, setIdlePhrase] = useState(() => GENERIC_PHRASES[0]);
|
|
77
|
-
// Frame timer is independent of the agent state — keeps animation smooth.
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
const t = setInterval(() => {
|
|
80
|
-
setFrameIndex((i) => (i + 1) % SPINNER_FRAMES.length);
|
|
81
|
-
}, 100);
|
|
82
|
-
return () => clearInterval(t);
|
|
83
|
-
}, []);
|
|
84
|
-
// Determine state: active tool > streaming text > streaming reasoning > idle
|
|
85
|
-
const activeTool = [...tools].reverse().find((t) => !t.result);
|
|
86
|
-
const state = activeTool
|
|
87
|
-
? "tool"
|
|
88
|
-
: hasStreamingText
|
|
89
|
-
? "text"
|
|
90
|
-
: hasStreamingReasoning
|
|
91
|
-
? "reasoning"
|
|
92
|
-
: "idle";
|
|
93
|
-
// Rotate idle phrases on a slower cadence; only matters in the idle state.
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
if (state !== "idle")
|
|
96
|
-
return;
|
|
97
|
-
const t = setInterval(() => {
|
|
98
|
-
setIdlePhrase((current) => {
|
|
99
|
-
const candidates = GENERIC_PHRASES.filter((item) => item !== current);
|
|
100
|
-
return candidates[Math.floor(Math.random() * candidates.length)] || current;
|
|
101
|
-
});
|
|
102
|
-
}, 1500);
|
|
103
|
-
return () => clearInterval(t);
|
|
104
|
-
}, [state]);
|
|
105
|
-
let phrase;
|
|
106
|
-
if (state === "tool" && activeTool) {
|
|
107
|
-
phrase =
|
|
108
|
-
TOOL_TARGET_PHRASES[activeTool.name] || `running ${activeTool.name}`;
|
|
109
|
-
}
|
|
110
|
-
else if (state === "text") {
|
|
111
|
-
phrase = "writing the response";
|
|
112
|
-
}
|
|
113
|
-
else if (state === "reasoning") {
|
|
114
|
-
phrase = "working through the request";
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
phrase = idlePhrase;
|
|
118
|
-
}
|
|
119
|
-
const tokenText = streamedChars > 0 ? `↓${formatTokensApprox(streamedChars)} tok` : "";
|
|
120
|
-
const hintParts = [];
|
|
121
|
-
if (tokenText)
|
|
122
|
-
hintParts.push(tokenText);
|
|
123
|
-
if (pendingSteerCount > 0)
|
|
124
|
-
hintParts.push(`${pendingSteerCount} pending steer${pendingSteerCount === 1 ? "" : "s"}`);
|
|
125
|
-
if (queuedCount > 0)
|
|
126
|
-
hintParts.push(`${queuedCount} queued`);
|
|
127
|
-
hintParts.push("enter steer", "tab queue", "esc stop");
|
|
128
|
-
return (_jsxs(Box, { children: [_jsx(Text, { color: theme.accent, children: SPINNER_FRAMES[frameIndex] }), _jsxs(Text, { color: theme.muted, children: [" ", phrase, " "] }), _jsxs(Text, { color: theme.muted, dimColor: true, children: ["(", hintParts.join(" · "), ")"] })] }));
|
|
129
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { DisplayMessage } from "./display-history.js";
|
|
2
|
-
interface WelcomeBannerProps {
|
|
3
|
-
terminalColumns: number;
|
|
4
|
-
tips: string[];
|
|
5
|
-
/** One-line "update available" notice shown under the version. */
|
|
6
|
-
updateNotice?: string;
|
|
7
|
-
/** Friendly working directory (~ collapsed). */
|
|
8
|
-
cwd?: string;
|
|
9
|
-
/** Session identifier (session file basename). */
|
|
10
|
-
sessionLabel?: string;
|
|
11
|
-
providerId?: string;
|
|
12
|
-
modelId?: string;
|
|
13
|
-
modelLabel?: string;
|
|
14
|
-
/** Active thinking level, rendered as part of the model unit (e.g. "xhigh"). */
|
|
15
|
-
thinkingLabel?: string;
|
|
16
|
-
}
|
|
17
|
-
interface WelcomeVisibilityInput {
|
|
18
|
-
messages: Pick<DisplayMessage, "role" | "syntheticKind">[];
|
|
19
|
-
startedWithVisibleHistory: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare function shouldShowWelcomeBanner({ startedWithVisibleHistory, }: WelcomeVisibilityInput): boolean;
|
|
22
|
-
export declare function lerpColor(from: string, to: string, t: number): string;
|
|
23
|
-
export declare function WelcomeBanner({ terminalColumns, tips, updateNotice, cwd, sessionLabel, providerId, modelId, modelLabel, thinkingLabel, }: WelcomeBannerProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export declare function formatModelLine({ providerId, modelId, modelLabel, thinkingLabel, tips, }: Pick<WelcomeBannerProps, "providerId" | "modelId" | "modelLabel" | "thinkingLabel" | "tips">): string;
|
|
25
|
-
export {};
|