@bubblebrain-ai/bubble 0.0.51 → 0.0.53
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 +80 -11
- package/dist/provider-transform.js +32 -4
- package/dist/provider.d.ts +6 -2
- package/dist/provider.js +100 -11
- 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/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/package.json +23 -10
- package/packages/pi-tui/node_modules/marked/LICENSE +44 -0
- package/packages/pi-tui/node_modules/marked/README.md +115 -0
- package/packages/pi-tui/node_modules/marked/bin/main.js +284 -0
- package/packages/pi-tui/node_modules/marked/bin/marked.js +16 -0
- package/packages/pi-tui/node_modules/marked/lib/marked.d.ts +760 -0
- package/packages/pi-tui/node_modules/marked/lib/marked.esm.js +77 -0
- package/packages/pi-tui/node_modules/marked/lib/marked.esm.js.map +7 -0
- package/packages/pi-tui/node_modules/marked/lib/marked.umd.js +79 -0
- package/packages/pi-tui/node_modules/marked/lib/marked.umd.js.map +7 -0
- package/packages/pi-tui/node_modules/marked/man/marked.1 +113 -0
- package/packages/pi-tui/node_modules/marked/man/marked.1.md +93 -0
- package/packages/pi-tui/node_modules/marked/package.json +103 -0
- 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,59 @@
|
|
|
1
|
+
import { type Component, type Focusable, type TuiMouseEvent } from "@bubblebrain-ai/pi-tui";
|
|
2
|
+
import type { SkillRegistry } from "../../skills/registry.js";
|
|
3
|
+
import { type Theme } from "../model/theme.js";
|
|
4
|
+
export interface SkillsPanelComponentOptions {
|
|
5
|
+
getTerminalRows(): number;
|
|
6
|
+
onClose(): void;
|
|
7
|
+
onRender(): void;
|
|
8
|
+
onSkillsChanged(): void;
|
|
9
|
+
theme?: Theme;
|
|
10
|
+
}
|
|
11
|
+
/** Grok-style centered Skill browser/manager opened by /skills. */
|
|
12
|
+
export declare class SkillsPanelComponent implements Component, Focusable {
|
|
13
|
+
private readonly registry;
|
|
14
|
+
private readonly options;
|
|
15
|
+
focused: boolean;
|
|
16
|
+
private readonly search;
|
|
17
|
+
private searchActive;
|
|
18
|
+
private filter;
|
|
19
|
+
private selectedKey;
|
|
20
|
+
private hoveredKey;
|
|
21
|
+
private collapsedGroups;
|
|
22
|
+
private expandedSkills;
|
|
23
|
+
private actionBadges;
|
|
24
|
+
private offset;
|
|
25
|
+
private manuallyScrolled;
|
|
26
|
+
private bodyRows;
|
|
27
|
+
private frameWidth;
|
|
28
|
+
private closeHovered;
|
|
29
|
+
private filterHovered;
|
|
30
|
+
private searchHovered;
|
|
31
|
+
private hitRows;
|
|
32
|
+
private footerHits;
|
|
33
|
+
private selectableEntries;
|
|
34
|
+
constructor(registry: SkillRegistry, options: SkillsPanelComponentOptions);
|
|
35
|
+
render(width: number): string[];
|
|
36
|
+
handleInput(data: string): void;
|
|
37
|
+
handleMouse(event: TuiMouseEvent): boolean;
|
|
38
|
+
invalidate(): void;
|
|
39
|
+
private frameLine;
|
|
40
|
+
private renderSearch;
|
|
41
|
+
private renderFooter;
|
|
42
|
+
private buildRows;
|
|
43
|
+
private skillDetailRows;
|
|
44
|
+
private resourceSummary;
|
|
45
|
+
private seedCollapsedGroups;
|
|
46
|
+
private ensureSelection;
|
|
47
|
+
private moveSelection;
|
|
48
|
+
private selectBoundary;
|
|
49
|
+
private selectedEntry;
|
|
50
|
+
private toggleExpanded;
|
|
51
|
+
private collapseSelected;
|
|
52
|
+
private toggleEnabled;
|
|
53
|
+
private cycleFilter;
|
|
54
|
+
private reload;
|
|
55
|
+
private startSearch;
|
|
56
|
+
private stopSearch;
|
|
57
|
+
private scroll;
|
|
58
|
+
private pruneBadges;
|
|
59
|
+
}
|
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { Input, decodeKittyPrintable, matchesKey, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "@bubblebrain-ai/pi-tui";
|
|
5
|
+
import { parseTerminalMouseWheel } from "../model/terminal-mouse.js";
|
|
6
|
+
import { darkTheme } from "../model/theme.js";
|
|
7
|
+
import { themeBackground, themeDim, themeForeground } from "../model/theme-style.js";
|
|
8
|
+
const GROUP_ORDER = ["project", "user", "configured"];
|
|
9
|
+
const GROUP_LABEL = {
|
|
10
|
+
project: "Project",
|
|
11
|
+
user: "User",
|
|
12
|
+
configured: "Config",
|
|
13
|
+
};
|
|
14
|
+
const MAX_PANEL_HEIGHT = 34;
|
|
15
|
+
function fit(value, width, ellipsis = "") {
|
|
16
|
+
if (width <= 0)
|
|
17
|
+
return "";
|
|
18
|
+
const clipped = truncateToWidth(value, width, ellipsis);
|
|
19
|
+
return clipped + " ".repeat(Math.max(0, width - visibleWidth(clipped)));
|
|
20
|
+
}
|
|
21
|
+
function alignSides(left, right, width) {
|
|
22
|
+
if (width <= 0)
|
|
23
|
+
return "";
|
|
24
|
+
if (!right)
|
|
25
|
+
return fit(left, width, "…");
|
|
26
|
+
const rightWidth = Math.min(visibleWidth(right), Math.max(0, Math.floor(width * 0.48)));
|
|
27
|
+
const clippedRight = truncateToWidth(right, rightWidth, "…");
|
|
28
|
+
const gap = 2;
|
|
29
|
+
const leftWidth = Math.max(0, width - visibleWidth(clippedRight) - gap);
|
|
30
|
+
return `${fit(left, leftWidth, "…")}${" ".repeat(gap)}${clippedRight}`;
|
|
31
|
+
}
|
|
32
|
+
function friendlyPath(path) {
|
|
33
|
+
const home = homedir();
|
|
34
|
+
if (path === home)
|
|
35
|
+
return "~";
|
|
36
|
+
if (path.startsWith(`${home}/`))
|
|
37
|
+
return `~/${path.slice(home.length + 1)}`;
|
|
38
|
+
return path;
|
|
39
|
+
}
|
|
40
|
+
function skillSourceLabel(skill) {
|
|
41
|
+
return friendlyPath(dirname(skill.rootDir));
|
|
42
|
+
}
|
|
43
|
+
function sourceKey(source) {
|
|
44
|
+
return `group:${source}`;
|
|
45
|
+
}
|
|
46
|
+
function skillKey(name) {
|
|
47
|
+
return `skill:${name}`;
|
|
48
|
+
}
|
|
49
|
+
function filterLabel(filter) {
|
|
50
|
+
if (filter === "enabled")
|
|
51
|
+
return "Enabled";
|
|
52
|
+
if (filter === "disabled")
|
|
53
|
+
return "Disabled";
|
|
54
|
+
return "All";
|
|
55
|
+
}
|
|
56
|
+
function nextFilter(filter) {
|
|
57
|
+
if (filter === "all")
|
|
58
|
+
return "enabled";
|
|
59
|
+
if (filter === "enabled")
|
|
60
|
+
return "disabled";
|
|
61
|
+
return "all";
|
|
62
|
+
}
|
|
63
|
+
function matchesSkill(skill, query) {
|
|
64
|
+
if (!query)
|
|
65
|
+
return { matches: true, nameHit: true };
|
|
66
|
+
const needle = query.toLocaleLowerCase();
|
|
67
|
+
const nameHit = skill.meta.name.toLocaleLowerCase().includes(needle)
|
|
68
|
+
|| (skill.meta.author ?? "").toLocaleLowerCase().includes(needle);
|
|
69
|
+
const descriptionHit = skill.meta.description.toLocaleLowerCase().includes(needle);
|
|
70
|
+
const tagsHit = (skill.meta.tags ?? []).some((tag) => tag.toLocaleLowerCase().includes(needle));
|
|
71
|
+
return { matches: nameHit || descriptionHit || tagsHit, nameHit };
|
|
72
|
+
}
|
|
73
|
+
/** Grok-style centered Skill browser/manager opened by /skills. */
|
|
74
|
+
export class SkillsPanelComponent {
|
|
75
|
+
registry;
|
|
76
|
+
options;
|
|
77
|
+
focused = false;
|
|
78
|
+
search = new Input({ prompt: "" });
|
|
79
|
+
searchActive = false;
|
|
80
|
+
filter = "all";
|
|
81
|
+
selectedKey;
|
|
82
|
+
hoveredKey;
|
|
83
|
+
collapsedGroups = new Set();
|
|
84
|
+
expandedSkills = new Set();
|
|
85
|
+
actionBadges = new Map();
|
|
86
|
+
offset = 0;
|
|
87
|
+
manuallyScrolled = false;
|
|
88
|
+
bodyRows = 0;
|
|
89
|
+
frameWidth = 0;
|
|
90
|
+
closeHovered = false;
|
|
91
|
+
filterHovered = false;
|
|
92
|
+
searchHovered = false;
|
|
93
|
+
hitRows = [];
|
|
94
|
+
footerHits = [];
|
|
95
|
+
selectableEntries = [];
|
|
96
|
+
constructor(registry, options) {
|
|
97
|
+
this.registry = registry;
|
|
98
|
+
this.options = options;
|
|
99
|
+
this.seedCollapsedGroups();
|
|
100
|
+
this.search.onBackspaceAtStart = () => this.stopSearch();
|
|
101
|
+
}
|
|
102
|
+
render(width) {
|
|
103
|
+
const theme = this.options.theme ?? darkTheme;
|
|
104
|
+
const frameWidth = Math.max(1, Math.floor(width));
|
|
105
|
+
const frameHeight = Math.max(1, Math.min(MAX_PANEL_HEIGHT, this.options.getTerminalRows() - 6));
|
|
106
|
+
this.frameWidth = frameWidth;
|
|
107
|
+
if (frameWidth < 40 || frameHeight < 12) {
|
|
108
|
+
return [truncateToWidth("Skills requires a 40 × 12 terminal · Esc close", frameWidth, "")]
|
|
109
|
+
.slice(0, frameHeight);
|
|
110
|
+
}
|
|
111
|
+
this.pruneBadges();
|
|
112
|
+
const innerWidth = frameWidth - 2;
|
|
113
|
+
const horizontal = "─".repeat(innerWidth);
|
|
114
|
+
const close = this.closeHovered ? chalk.bold(themeForeground(theme.inputText, "[✗]")) : themeForeground(theme.muted, "[✗]");
|
|
115
|
+
const topDashCount = Math.max(0, frameWidth - 7);
|
|
116
|
+
const top = themeForeground(theme.border, `┌${"─".repeat(topDashCount)}`) + ` ${close} ` + themeForeground(theme.border, "┐");
|
|
117
|
+
const bottom = themeForeground(theme.border, `└${horizontal}┘`);
|
|
118
|
+
const separator = themeForeground(theme.border, `├${horizontal}┤`);
|
|
119
|
+
const tab = this.frameLine(` ${chalk.bold(themeForeground(theme.inputText, themeBackground(theme.traceHoverBg, " Skills ")))}`, innerWidth);
|
|
120
|
+
const search = this.frameLine(this.renderSearch(innerWidth), innerWidth);
|
|
121
|
+
const footerRows = this.searchActive ? 0 : 2;
|
|
122
|
+
this.bodyRows = Math.max(1, frameHeight - 5 - footerRows);
|
|
123
|
+
const contentWidth = Math.max(1, innerWidth - 4);
|
|
124
|
+
const rows = this.buildRows(contentWidth);
|
|
125
|
+
this.selectableEntries = rows
|
|
126
|
+
.map((row) => row.selectable)
|
|
127
|
+
.filter((entry) => !!entry);
|
|
128
|
+
this.ensureSelection();
|
|
129
|
+
const selectedLine = rows.findIndex((row) => row.key === this.selectedKey);
|
|
130
|
+
if (selectedLine >= 0 && !this.manuallyScrolled) {
|
|
131
|
+
if (selectedLine < this.offset)
|
|
132
|
+
this.offset = selectedLine;
|
|
133
|
+
if (selectedLine >= this.offset + this.bodyRows)
|
|
134
|
+
this.offset = selectedLine - this.bodyRows + 1;
|
|
135
|
+
}
|
|
136
|
+
this.offset = Math.max(0, Math.min(this.offset, Math.max(0, rows.length - this.bodyRows)));
|
|
137
|
+
this.hitRows = [];
|
|
138
|
+
this.footerHits = [];
|
|
139
|
+
const visible = rows.slice(this.offset, this.offset + this.bodyRows);
|
|
140
|
+
while (visible.length < this.bodyRows)
|
|
141
|
+
visible.push({ text: "" });
|
|
142
|
+
const bodyStart = 4;
|
|
143
|
+
const body = visible.map((row, index) => {
|
|
144
|
+
const localY = bodyStart + index;
|
|
145
|
+
if (row.selectable && row.key)
|
|
146
|
+
this.hitRows[localY] = { kind: "entry", key: row.key };
|
|
147
|
+
const selected = !!row.key && row.key === this.selectedKey && !this.searchActive;
|
|
148
|
+
const hovered = !!row.key && row.key === this.hoveredKey;
|
|
149
|
+
const content = ` ${fit(row.text, contentWidth, "…")} `;
|
|
150
|
+
const styled = selected
|
|
151
|
+
? chalk.bold(themeForeground(theme.inputText, themeBackground(theme.traceSelectedBg, fit(content, innerWidth))))
|
|
152
|
+
: hovered
|
|
153
|
+
? themeForeground(theme.inputText, themeBackground(theme.traceHoverBg, fit(content, innerWidth)))
|
|
154
|
+
: themeBackground(theme.backgroundPanel, fit(content, innerWidth));
|
|
155
|
+
return `${themeForeground(theme.border, "│")}${styled}${themeForeground(theme.border, "│")}`;
|
|
156
|
+
});
|
|
157
|
+
const footer = this.searchActive ? [] : this.renderFooter(innerWidth, bodyStart + this.bodyRows);
|
|
158
|
+
return [top, tab, search, separator, ...body, ...footer, bottom]
|
|
159
|
+
.slice(0, frameHeight)
|
|
160
|
+
.map((line) => truncateToWidth(line, frameWidth, ""));
|
|
161
|
+
}
|
|
162
|
+
handleInput(data) {
|
|
163
|
+
const wheel = parseTerminalMouseWheel(data);
|
|
164
|
+
if (wheel.length > 0) {
|
|
165
|
+
for (const direction of wheel)
|
|
166
|
+
this.scroll(direction === "up" ? -3 : 3);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (this.searchActive) {
|
|
170
|
+
if (matchesKey(data, "escape"))
|
|
171
|
+
return this.stopSearch();
|
|
172
|
+
if (matchesKey(data, "up"))
|
|
173
|
+
return this.moveSelection(-1);
|
|
174
|
+
if (matchesKey(data, "down"))
|
|
175
|
+
return this.moveSelection(1);
|
|
176
|
+
if (matchesKey(data, "pageUp"))
|
|
177
|
+
return this.moveSelection(-Math.max(1, this.bodyRows - 1));
|
|
178
|
+
if (matchesKey(data, "pageDown"))
|
|
179
|
+
return this.moveSelection(Math.max(1, this.bodyRows - 1));
|
|
180
|
+
if (matchesKey(data, "enter"))
|
|
181
|
+
return this.toggleExpanded();
|
|
182
|
+
const before = this.search.getValue();
|
|
183
|
+
this.search.focused = this.focused;
|
|
184
|
+
this.search.handleInput(data);
|
|
185
|
+
if (this.search.getValue() !== before) {
|
|
186
|
+
this.selectedKey = undefined;
|
|
187
|
+
this.offset = 0;
|
|
188
|
+
this.manuallyScrolled = false;
|
|
189
|
+
}
|
|
190
|
+
this.options.onRender();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (matchesKey(data, "escape"))
|
|
194
|
+
return this.options.onClose();
|
|
195
|
+
const printable = decodeKittyPrintable(data) ?? data;
|
|
196
|
+
if (printable === "/")
|
|
197
|
+
return this.startSearch();
|
|
198
|
+
if (printable === "f")
|
|
199
|
+
return this.cycleFilter();
|
|
200
|
+
if (printable === "r")
|
|
201
|
+
return this.reload();
|
|
202
|
+
if (matchesKey(data, "space"))
|
|
203
|
+
return this.toggleEnabled();
|
|
204
|
+
if (matchesKey(data, "up") || printable === "k")
|
|
205
|
+
return this.moveSelection(-1);
|
|
206
|
+
if (matchesKey(data, "down") || printable === "j")
|
|
207
|
+
return this.moveSelection(1);
|
|
208
|
+
if (matchesKey(data, "pageUp"))
|
|
209
|
+
return this.moveSelection(-Math.max(1, this.bodyRows - 1));
|
|
210
|
+
if (matchesKey(data, "pageDown"))
|
|
211
|
+
return this.moveSelection(Math.max(1, this.bodyRows - 1));
|
|
212
|
+
if (matchesKey(data, "home"))
|
|
213
|
+
return this.selectBoundary("first");
|
|
214
|
+
if (matchesKey(data, "end") || printable === "G")
|
|
215
|
+
return this.selectBoundary("last");
|
|
216
|
+
if (matchesKey(data, "enter") || matchesKey(data, "right") || printable === "l")
|
|
217
|
+
return this.toggleExpanded(false);
|
|
218
|
+
if (matchesKey(data, "left") || printable === "h")
|
|
219
|
+
return this.collapseSelected();
|
|
220
|
+
}
|
|
221
|
+
handleMouse(event) {
|
|
222
|
+
if (event.kind === "leave") {
|
|
223
|
+
const changed = this.closeHovered || this.filterHovered || this.searchHovered || this.hoveredKey !== undefined;
|
|
224
|
+
this.closeHovered = false;
|
|
225
|
+
this.filterHovered = false;
|
|
226
|
+
this.searchHovered = false;
|
|
227
|
+
this.hoveredKey = undefined;
|
|
228
|
+
return changed;
|
|
229
|
+
}
|
|
230
|
+
const overClose = event.y === 0
|
|
231
|
+
&& event.x >= Math.max(0, this.frameWidth - 6)
|
|
232
|
+
&& event.x < this.frameWidth - 1;
|
|
233
|
+
const hit = this.hitRows[event.y] ?? this.footerHits.find((candidate) => (event.y === candidate.row
|
|
234
|
+
&& event.x >= (candidate.start ?? 0)
|
|
235
|
+
&& event.x < (candidate.end ?? 0)));
|
|
236
|
+
const overSearch = event.y === 2 && event.x > 1 && event.x < this.frameWidth - 14;
|
|
237
|
+
const overFilter = event.y === 2 && event.x >= Math.max(1, this.frameWidth - 14) && event.x < this.frameWidth - 1;
|
|
238
|
+
const overEntryKey = hit?.kind === "entry" ? hit.key : undefined;
|
|
239
|
+
if (event.kind === "move") {
|
|
240
|
+
const changed = this.closeHovered !== overClose
|
|
241
|
+
|| this.searchHovered !== overSearch
|
|
242
|
+
|| this.filterHovered !== overFilter
|
|
243
|
+
|| this.hoveredKey !== overEntryKey;
|
|
244
|
+
this.closeHovered = overClose;
|
|
245
|
+
this.searchHovered = overSearch;
|
|
246
|
+
this.filterHovered = overFilter;
|
|
247
|
+
this.hoveredKey = overEntryKey;
|
|
248
|
+
return changed;
|
|
249
|
+
}
|
|
250
|
+
if (event.release || (event.button & 3) !== 0)
|
|
251
|
+
return false;
|
|
252
|
+
if (overClose) {
|
|
253
|
+
this.options.onClose();
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
if (overSearch) {
|
|
257
|
+
this.startSearch();
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
if (overFilter || hit?.kind === "filter") {
|
|
261
|
+
this.cycleFilter();
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
if (hit?.kind === "footer-reload") {
|
|
265
|
+
this.reload();
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
if (hit?.kind === "footer-toggle") {
|
|
269
|
+
this.toggleEnabled();
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
if (hit?.kind === "entry" && hit.key) {
|
|
273
|
+
this.selectedKey = hit.key;
|
|
274
|
+
this.manuallyScrolled = false;
|
|
275
|
+
this.toggleExpanded();
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
invalidate() {
|
|
281
|
+
this.search.invalidate?.();
|
|
282
|
+
}
|
|
283
|
+
frameLine(content, width) {
|
|
284
|
+
const theme = this.options.theme ?? darkTheme;
|
|
285
|
+
return `${themeForeground(theme.border, "│")}${themeBackground(theme.backgroundPanel, fit(content, width))}${themeForeground(theme.border, "│")}`;
|
|
286
|
+
}
|
|
287
|
+
renderSearch(innerWidth) {
|
|
288
|
+
const theme = this.options.theme ?? darkTheme;
|
|
289
|
+
const filter = filterLabel(this.filter);
|
|
290
|
+
const filterText = this.filterHovered || this.filter !== "all"
|
|
291
|
+
? themeForeground(theme.inputText, themeBackground(theme.traceHoverBg, ` f ${filter} `))
|
|
292
|
+
: themeForeground(theme.muted, ` f ${filter} `);
|
|
293
|
+
const filterWidth = visibleWidth(` f ${filter} `);
|
|
294
|
+
const leftWidth = Math.max(1, innerWidth - filterWidth - 3);
|
|
295
|
+
let left;
|
|
296
|
+
if (this.searchActive) {
|
|
297
|
+
this.search.focused = this.focused;
|
|
298
|
+
left = this.search.render(leftWidth)[0] ?? "";
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
this.search.focused = false;
|
|
302
|
+
left = this.searchHovered
|
|
303
|
+
? themeForeground(theme.inputText, "/ to search")
|
|
304
|
+
: themeDim(theme.dim, "/ to search");
|
|
305
|
+
}
|
|
306
|
+
return fit(` ${fit(left, leftWidth)} ${filterText}`, innerWidth);
|
|
307
|
+
}
|
|
308
|
+
renderFooter(innerWidth, firstRow) {
|
|
309
|
+
const theme = this.options.theme ?? darkTheme;
|
|
310
|
+
const actionPlain = "space toggle · f filter · r reload · / search";
|
|
311
|
+
const navPlain = "↑/↓ navigate · Enter expand · Esc close";
|
|
312
|
+
const actionLeft = Math.max(0, Math.floor((innerWidth - visibleWidth(actionPlain)) / 2));
|
|
313
|
+
const navLeft = Math.max(0, Math.floor((innerWidth - visibleWidth(navPlain)) / 2));
|
|
314
|
+
const action = fit(`${" ".repeat(actionLeft)}${themeDim(theme.dim, actionPlain)}`, innerWidth);
|
|
315
|
+
const nav = fit(`${" ".repeat(navLeft)}${themeDim(theme.dim, navPlain)}`, innerWidth);
|
|
316
|
+
const toggleAt = actionPlain.indexOf("space toggle");
|
|
317
|
+
const filterAt = actionPlain.indexOf("f filter");
|
|
318
|
+
const reloadAt = actionPlain.indexOf("r reload");
|
|
319
|
+
this.footerHits = [
|
|
320
|
+
{ kind: "footer-toggle", start: 1 + actionLeft + toggleAt, end: 1 + actionLeft + toggleAt + "space toggle".length, row: firstRow },
|
|
321
|
+
{ kind: "filter", start: 1 + actionLeft + filterAt, end: 1 + actionLeft + filterAt + "f filter".length, row: firstRow },
|
|
322
|
+
{ kind: "footer-reload", start: 1 + actionLeft + reloadAt, end: 1 + actionLeft + reloadAt + "r reload".length, row: firstRow },
|
|
323
|
+
];
|
|
324
|
+
return [this.frameLine(action, innerWidth), this.frameLine(nav, innerWidth)];
|
|
325
|
+
}
|
|
326
|
+
buildRows(contentWidth) {
|
|
327
|
+
const theme = this.options.theme ?? darkTheme;
|
|
328
|
+
const query = this.search.getValue().trim().toLocaleLowerCase();
|
|
329
|
+
const rows = [];
|
|
330
|
+
const records = this.registry.all();
|
|
331
|
+
for (const source of GROUP_ORDER) {
|
|
332
|
+
const members = records
|
|
333
|
+
.filter((skill) => skill.source === source)
|
|
334
|
+
.filter((skill) => {
|
|
335
|
+
const enabled = this.registry.isEnabled(skill.meta.name);
|
|
336
|
+
if (this.filter === "enabled" && !enabled)
|
|
337
|
+
return false;
|
|
338
|
+
if (this.filter === "disabled" && enabled)
|
|
339
|
+
return false;
|
|
340
|
+
return matchesSkill(skill, query).matches;
|
|
341
|
+
})
|
|
342
|
+
.sort((a, b) => {
|
|
343
|
+
const aMatch = matchesSkill(a, query);
|
|
344
|
+
const bMatch = matchesSkill(b, query);
|
|
345
|
+
if (aMatch.nameHit !== bMatch.nameHit)
|
|
346
|
+
return aMatch.nameHit ? -1 : 1;
|
|
347
|
+
return a.meta.name.localeCompare(b.meta.name);
|
|
348
|
+
});
|
|
349
|
+
if (members.length === 0)
|
|
350
|
+
continue;
|
|
351
|
+
const forcedOpen = query.length > 0;
|
|
352
|
+
const collapsed = !forcedOpen && this.collapsedGroups.has(source);
|
|
353
|
+
const groupEntry = { key: sourceKey(source), kind: "group", group: source };
|
|
354
|
+
rows.push({
|
|
355
|
+
key: groupEntry.key,
|
|
356
|
+
selectable: groupEntry,
|
|
357
|
+
text: `${collapsed ? "›" : "⌄"} ${GROUP_LABEL[source]} (${members.length} skill${members.length === 1 ? "" : "s"})`,
|
|
358
|
+
});
|
|
359
|
+
if (collapsed)
|
|
360
|
+
continue;
|
|
361
|
+
for (const skill of members) {
|
|
362
|
+
const enabled = this.registry.isEnabled(skill.meta.name);
|
|
363
|
+
const badge = this.actionBadges.get(skill.meta.name)?.text;
|
|
364
|
+
const status = badge
|
|
365
|
+
? themeForeground(theme.accent, `[${badge}]`)
|
|
366
|
+
: enabled
|
|
367
|
+
? ""
|
|
368
|
+
: themeForeground(theme.error, "[disabled]");
|
|
369
|
+
const author = skill.meta.author ? ` · ${skill.meta.author}` : "";
|
|
370
|
+
const right = `${status}${status && (author || skillSourceLabel(skill)) ? " " : ""}(${skillSourceLabel(skill)}${author})`;
|
|
371
|
+
const key = skillKey(skill.meta.name);
|
|
372
|
+
const entry = { key, kind: "skill", group: source, skill };
|
|
373
|
+
const left = ` ${this.selectedKey === key && !this.searchActive ? "›" : " "} ${skill.meta.name}`;
|
|
374
|
+
rows.push({
|
|
375
|
+
key,
|
|
376
|
+
selectable: entry,
|
|
377
|
+
text: enabled
|
|
378
|
+
? alignSides(left, right, contentWidth)
|
|
379
|
+
: themeDim(theme.dim, alignSides(left, right, contentWidth)),
|
|
380
|
+
});
|
|
381
|
+
if (this.expandedSkills.has(skill.meta.name)) {
|
|
382
|
+
rows.push(...this.skillDetailRows(skill, contentWidth));
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
if (rows.length === 0) {
|
|
387
|
+
const message = records.length === 0
|
|
388
|
+
? "No skills discovered. Add SKILL.md under ~/.bubble/skills or .bubble/skills."
|
|
389
|
+
: query
|
|
390
|
+
? `No skills matched “${this.search.getValue().trim()}”.`
|
|
391
|
+
: `No ${filterLabel(this.filter).toLocaleLowerCase()} skills.`;
|
|
392
|
+
rows.push({ text: themeForeground(theme.muted, message) });
|
|
393
|
+
}
|
|
394
|
+
return rows;
|
|
395
|
+
}
|
|
396
|
+
skillDetailRows(skill, width) {
|
|
397
|
+
const theme = this.options.theme ?? darkTheme;
|
|
398
|
+
const indent = " ";
|
|
399
|
+
const detailWidth = Math.max(1, width - visibleWidth(indent));
|
|
400
|
+
const rows = wrapTextWithAnsi(themeForeground(theme.muted, skill.meta.description), detailWidth)
|
|
401
|
+
.map((line) => ({ text: `${indent}${line}` }));
|
|
402
|
+
const fields = [
|
|
403
|
+
["path", friendlyPath(skill.skillFile)],
|
|
404
|
+
["author", skill.meta.author],
|
|
405
|
+
["tools", skill.meta.allowedTools?.join(", ")],
|
|
406
|
+
["tags", skill.meta.tags?.join(", ")],
|
|
407
|
+
["resources", this.resourceSummary(skill)],
|
|
408
|
+
["model invocation", skill.meta.disableModelInvocation ? "manual only" : undefined],
|
|
409
|
+
];
|
|
410
|
+
for (const [label, value] of fields) {
|
|
411
|
+
if (!value)
|
|
412
|
+
continue;
|
|
413
|
+
const prefix = `${indent}${themeDim(theme.dim, `${label}:`)} `;
|
|
414
|
+
const prefixWidth = visibleWidth(`${indent}${label}: `);
|
|
415
|
+
const wrapped = wrapTextWithAnsi(themeForeground(theme.muted, value), Math.max(1, width - prefixWidth));
|
|
416
|
+
rows.push({ text: `${prefix}${wrapped[0] ?? ""}` });
|
|
417
|
+
for (const continuation of wrapped.slice(1)) {
|
|
418
|
+
rows.push({ text: `${" ".repeat(prefixWidth)}${continuation}` });
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return rows;
|
|
422
|
+
}
|
|
423
|
+
resourceSummary(skill) {
|
|
424
|
+
const parts = [
|
|
425
|
+
skill.resources.references.length > 0 ? `${skill.resources.references.length} references` : "",
|
|
426
|
+
skill.resources.scripts.length > 0 ? `${skill.resources.scripts.length} scripts` : "",
|
|
427
|
+
skill.resources.assets.length > 0 ? `${skill.resources.assets.length} assets` : "",
|
|
428
|
+
].filter(Boolean);
|
|
429
|
+
return parts.length > 0 ? parts.join(" · ") : undefined;
|
|
430
|
+
}
|
|
431
|
+
seedCollapsedGroups() {
|
|
432
|
+
for (const skill of this.registry.all())
|
|
433
|
+
this.collapsedGroups.add(skill.source);
|
|
434
|
+
}
|
|
435
|
+
ensureSelection() {
|
|
436
|
+
if (this.selectableEntries.length === 0) {
|
|
437
|
+
this.selectedKey = undefined;
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
if (!this.selectedKey || !this.selectableEntries.some((entry) => entry.key === this.selectedKey)) {
|
|
441
|
+
this.selectedKey = this.selectableEntries[0].key;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
moveSelection(delta) {
|
|
445
|
+
if (this.selectableEntries.length === 0)
|
|
446
|
+
return;
|
|
447
|
+
const current = Math.max(0, this.selectableEntries.findIndex((entry) => entry.key === this.selectedKey));
|
|
448
|
+
const next = Math.max(0, Math.min(this.selectableEntries.length - 1, current + delta));
|
|
449
|
+
this.selectedKey = this.selectableEntries[next].key;
|
|
450
|
+
this.manuallyScrolled = false;
|
|
451
|
+
this.options.onRender();
|
|
452
|
+
}
|
|
453
|
+
selectBoundary(boundary) {
|
|
454
|
+
if (this.selectableEntries.length === 0)
|
|
455
|
+
return;
|
|
456
|
+
this.selectedKey = boundary === "first"
|
|
457
|
+
? this.selectableEntries[0].key
|
|
458
|
+
: this.selectableEntries[this.selectableEntries.length - 1].key;
|
|
459
|
+
this.manuallyScrolled = false;
|
|
460
|
+
this.options.onRender();
|
|
461
|
+
}
|
|
462
|
+
selectedEntry() {
|
|
463
|
+
return this.selectableEntries.find((entry) => entry.key === this.selectedKey);
|
|
464
|
+
}
|
|
465
|
+
toggleExpanded(collapseOnly = false) {
|
|
466
|
+
const entry = this.selectedEntry();
|
|
467
|
+
if (!entry)
|
|
468
|
+
return;
|
|
469
|
+
this.manuallyScrolled = false;
|
|
470
|
+
if (entry.kind === "group") {
|
|
471
|
+
const collapsed = this.collapsedGroups.has(entry.group);
|
|
472
|
+
if (collapseOnly && !collapsed)
|
|
473
|
+
this.collapsedGroups.add(entry.group);
|
|
474
|
+
else if (!collapseOnly) {
|
|
475
|
+
if (collapsed)
|
|
476
|
+
this.collapsedGroups.delete(entry.group);
|
|
477
|
+
else
|
|
478
|
+
this.collapsedGroups.add(entry.group);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
else if (entry.skill) {
|
|
482
|
+
const name = entry.skill.meta.name;
|
|
483
|
+
const expanded = this.expandedSkills.has(name);
|
|
484
|
+
if (collapseOnly && expanded)
|
|
485
|
+
this.expandedSkills.delete(name);
|
|
486
|
+
else if (!collapseOnly) {
|
|
487
|
+
if (expanded)
|
|
488
|
+
this.expandedSkills.delete(name);
|
|
489
|
+
else
|
|
490
|
+
this.expandedSkills.add(name);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
this.options.onRender();
|
|
494
|
+
}
|
|
495
|
+
collapseSelected() {
|
|
496
|
+
this.toggleExpanded(true);
|
|
497
|
+
}
|
|
498
|
+
toggleEnabled() {
|
|
499
|
+
const entry = this.selectedEntry();
|
|
500
|
+
if (entry?.kind !== "skill" || !entry.skill)
|
|
501
|
+
return;
|
|
502
|
+
const name = entry.skill.meta.name;
|
|
503
|
+
const enabled = !this.registry.isEnabled(name);
|
|
504
|
+
if (!this.registry.setEnabled(name, enabled))
|
|
505
|
+
return;
|
|
506
|
+
this.actionBadges.set(name, { text: enabled ? "enabled" : "disabled", expiresAt: Date.now() + 1_500 });
|
|
507
|
+
this.options.onSkillsChanged();
|
|
508
|
+
setTimeout(() => {
|
|
509
|
+
const badge = this.actionBadges.get(name);
|
|
510
|
+
if (badge && badge.expiresAt <= Date.now()) {
|
|
511
|
+
this.actionBadges.delete(name);
|
|
512
|
+
this.options.onRender();
|
|
513
|
+
}
|
|
514
|
+
}, 1_550);
|
|
515
|
+
this.options.onRender();
|
|
516
|
+
}
|
|
517
|
+
cycleFilter() {
|
|
518
|
+
this.filter = nextFilter(this.filter);
|
|
519
|
+
this.selectedKey = undefined;
|
|
520
|
+
this.offset = 0;
|
|
521
|
+
this.manuallyScrolled = false;
|
|
522
|
+
this.options.onRender();
|
|
523
|
+
}
|
|
524
|
+
reload() {
|
|
525
|
+
this.registry.reload();
|
|
526
|
+
this.seedCollapsedGroups();
|
|
527
|
+
this.selectedKey = undefined;
|
|
528
|
+
this.offset = 0;
|
|
529
|
+
this.manuallyScrolled = false;
|
|
530
|
+
this.options.onSkillsChanged();
|
|
531
|
+
this.options.onRender();
|
|
532
|
+
}
|
|
533
|
+
startSearch() {
|
|
534
|
+
if (this.searchActive)
|
|
535
|
+
return;
|
|
536
|
+
this.searchActive = true;
|
|
537
|
+
this.hoveredKey = undefined;
|
|
538
|
+
this.manuallyScrolled = false;
|
|
539
|
+
this.search.focused = this.focused;
|
|
540
|
+
this.options.onRender();
|
|
541
|
+
}
|
|
542
|
+
stopSearch() {
|
|
543
|
+
if (!this.searchActive && !this.search.getValue())
|
|
544
|
+
return;
|
|
545
|
+
this.searchActive = false;
|
|
546
|
+
this.search.setValue("");
|
|
547
|
+
this.search.focused = false;
|
|
548
|
+
this.selectedKey = undefined;
|
|
549
|
+
this.offset = 0;
|
|
550
|
+
this.manuallyScrolled = false;
|
|
551
|
+
this.options.onRender();
|
|
552
|
+
}
|
|
553
|
+
scroll(delta) {
|
|
554
|
+
const next = Math.max(0, this.offset + delta);
|
|
555
|
+
if (next === this.offset)
|
|
556
|
+
return;
|
|
557
|
+
this.offset = next;
|
|
558
|
+
this.manuallyScrolled = true;
|
|
559
|
+
this.options.onRender();
|
|
560
|
+
}
|
|
561
|
+
pruneBadges() {
|
|
562
|
+
const now = Date.now();
|
|
563
|
+
for (const [name, badge] of this.actionBadges) {
|
|
564
|
+
if (badge.expiresAt <= now)
|
|
565
|
+
this.actionBadges.delete(name);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Component, type Focusable, type TuiMouseEvent } from "@bubblebrain-ai/pi-tui";
|
|
2
|
+
import { type StatsRange, type UsageStatsBundle } from "../../stats/usage.js";
|
|
3
|
+
import { type Theme } from "../model/theme.js";
|
|
4
|
+
export interface StatsPanelComponentOptions {
|
|
5
|
+
getTerminalRows(): number;
|
|
6
|
+
onClose(): void;
|
|
7
|
+
onRender(): void;
|
|
8
|
+
theme?: Theme;
|
|
9
|
+
}
|
|
10
|
+
export declare function buildStatsPanelLines(bundle: UsageStatsBundle, range: StatsRange, contentWidth: number, expandedModels?: boolean, theme?: Theme): string[];
|
|
11
|
+
/** A /context-style usage overlay with range switching and scrolling. */
|
|
12
|
+
export declare class StatsPanelComponent implements Component, Focusable {
|
|
13
|
+
private readonly bundle;
|
|
14
|
+
private readonly options;
|
|
15
|
+
focused: boolean;
|
|
16
|
+
private range;
|
|
17
|
+
private offset;
|
|
18
|
+
private bodyRows;
|
|
19
|
+
private contentRows;
|
|
20
|
+
private frameWidth;
|
|
21
|
+
private tabHits;
|
|
22
|
+
private modelToggleHit;
|
|
23
|
+
private hoveredTab;
|
|
24
|
+
private modelToggleHovered;
|
|
25
|
+
private closeHovered;
|
|
26
|
+
private modelsExpanded;
|
|
27
|
+
constructor(bundle: UsageStatsBundle, options: StatsPanelComponentOptions);
|
|
28
|
+
render(width: number): string[];
|
|
29
|
+
handleInput(data: string): void;
|
|
30
|
+
handleMouse(event: TuiMouseEvent): boolean;
|
|
31
|
+
invalidate(): void;
|
|
32
|
+
private frameLine;
|
|
33
|
+
private renderTabs;
|
|
34
|
+
private renderFooter;
|
|
35
|
+
private stepRange;
|
|
36
|
+
private selectRange;
|
|
37
|
+
private toggleModels;
|
|
38
|
+
private scroll;
|
|
39
|
+
private setOffset;
|
|
40
|
+
}
|