@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
package/dist/tui/run.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pi TUI production entry. Keeps the RunTuiOptions surface main.ts builds so
|
|
3
|
+
* renderer startup and shutdown remain isolated from application wiring.
|
|
4
|
+
*/
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
import { execFile } from "node:child_process";
|
|
7
|
+
import { BubbleTuiController } from "./controller/controller.js";
|
|
8
|
+
import { PiTuiApp } from "./app.js";
|
|
9
|
+
export async function runTui(agent, _args, options) {
|
|
10
|
+
const controller = new BubbleTuiController({
|
|
11
|
+
agent,
|
|
12
|
+
sessionManager: options.sessionManager,
|
|
13
|
+
goalStore: options.goalStore,
|
|
14
|
+
processManager: options.processManager,
|
|
15
|
+
tasksAutoResume: options.tasksAutoResume,
|
|
16
|
+
promotionChannel: options.promotionChannel,
|
|
17
|
+
workspaceCwd: process.cwd(),
|
|
18
|
+
ports: buildPorts(options),
|
|
19
|
+
});
|
|
20
|
+
const app = new PiTuiApp({
|
|
21
|
+
agent,
|
|
22
|
+
sessionManager: options.sessionManager,
|
|
23
|
+
registry: options.registry,
|
|
24
|
+
createProvider: options.createProvider,
|
|
25
|
+
skillRegistry: options.skillRegistry,
|
|
26
|
+
bashAllowlist: options.bashAllowlist,
|
|
27
|
+
settingsManager: options.settingsManager,
|
|
28
|
+
hookController: options.hookController,
|
|
29
|
+
mcpManager: options.mcpManager,
|
|
30
|
+
lspService: options.lspService,
|
|
31
|
+
questionController: options.questionController,
|
|
32
|
+
planHandlerRef: options.planHandlerRef,
|
|
33
|
+
approvalHandlerRef: options.approvalHandlerRef,
|
|
34
|
+
controller,
|
|
35
|
+
updateNotice: options.updateNotice,
|
|
36
|
+
updateNoticeRefresh: options.updateNoticeRefresh,
|
|
37
|
+
flushMemory: options.flushMemory,
|
|
38
|
+
runMemoryCompaction: options.runMemoryCompaction,
|
|
39
|
+
runMemorySummary: options.runMemorySummary,
|
|
40
|
+
runMemoryRefresh: options.runMemoryRefresh,
|
|
41
|
+
themeMode: options.themeMode,
|
|
42
|
+
detectedTheme: options.detectedTheme,
|
|
43
|
+
themeOverrides: options.themeOverrides,
|
|
44
|
+
resolveGitBranch: currentGitBranch,
|
|
45
|
+
// Fullscreen is the production root renderer. Selecting it before start()
|
|
46
|
+
// prevents a regular-screen frame from ever being painted at startup.
|
|
47
|
+
uiMode: "fullscreen",
|
|
48
|
+
callbacks: {
|
|
49
|
+
onExitRequest: () => { },
|
|
50
|
+
onClearTranscript: () => controller.clearTranscript(),
|
|
51
|
+
onThemeToggle: () => {
|
|
52
|
+
// Kept for embedded hosts compiled against the pre-runtime-theme
|
|
53
|
+
// callback shape. /theme now uses onThemeModeChange directly.
|
|
54
|
+
},
|
|
55
|
+
onThemeModeChange: (mode) => {
|
|
56
|
+
options.onThemeModeChange?.(mode);
|
|
57
|
+
},
|
|
58
|
+
onCompact: () => {
|
|
59
|
+
void options.runMemoryCompaction?.();
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const startedAt = Date.now();
|
|
64
|
+
app.start();
|
|
65
|
+
const sigterm = () => app.dispose();
|
|
66
|
+
process.once("SIGTERM", sigterm);
|
|
67
|
+
try {
|
|
68
|
+
await app.waitUntilExit();
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
process.removeListener("SIGTERM", sigterm);
|
|
72
|
+
// The app has stopped painting, but the runtime still retains owner-session
|
|
73
|
+
// bindings. Reap first, then persist killed terminal markers so a resumed
|
|
74
|
+
// session never contains a dangling `task_started` lifecycle.
|
|
75
|
+
await options.processManager?.shutdownTasks();
|
|
76
|
+
controller.persistFinalTaskMarkers();
|
|
77
|
+
}
|
|
78
|
+
return { exitCode: 0, reason: "user-quit", wallMs: Date.now() - startedAt };
|
|
79
|
+
}
|
|
80
|
+
/** Resolve after first paint so git discovery never delays TUI startup. */
|
|
81
|
+
export function currentGitBranch(cwd) {
|
|
82
|
+
return new Promise((resolve) => {
|
|
83
|
+
execFile("git", ["-C", cwd, "branch", "--show-current"], { timeout: 3_000 }, (error, stdout) => {
|
|
84
|
+
if (error) {
|
|
85
|
+
resolve(undefined);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
resolve(stdout.trim() || undefined);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** Production streaming repaint scheduler: one cancellable timer per burst. */
|
|
93
|
+
export function createFlushScheduler() {
|
|
94
|
+
let pending = null;
|
|
95
|
+
return {
|
|
96
|
+
scheduleFlush: (intervalMs, flush) => {
|
|
97
|
+
if (pending !== null)
|
|
98
|
+
return;
|
|
99
|
+
pending = setTimeout(() => {
|
|
100
|
+
pending = null;
|
|
101
|
+
flush();
|
|
102
|
+
}, intervalMs);
|
|
103
|
+
},
|
|
104
|
+
cancelFlush: () => {
|
|
105
|
+
if (pending !== null)
|
|
106
|
+
clearTimeout(pending);
|
|
107
|
+
pending = null;
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function buildPorts(options) {
|
|
112
|
+
return {
|
|
113
|
+
clock: { now: () => Date.now() },
|
|
114
|
+
scheduler: {
|
|
115
|
+
setTimeout: (callback, ms) => {
|
|
116
|
+
const timer = setTimeout(callback, ms);
|
|
117
|
+
return { [Symbol.dispose]: () => clearTimeout(timer) };
|
|
118
|
+
},
|
|
119
|
+
setInterval: (callback, ms) => {
|
|
120
|
+
const timer = setInterval(callback, ms);
|
|
121
|
+
return { [Symbol.dispose]: () => clearInterval(timer) };
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
flush: createFlushScheduler(),
|
|
125
|
+
terminal: {
|
|
126
|
+
isMultiplexed: () => !!process.env.TMUX || (process.env.TERM ?? "").startsWith("screen"),
|
|
127
|
+
},
|
|
128
|
+
sessionHost: {
|
|
129
|
+
switchSession: (file) => options.switchSession
|
|
130
|
+
? options.switchSession(file)
|
|
131
|
+
: { error: "session switching not configured" },
|
|
132
|
+
createFresh: (cwd) => options.createFreshSession
|
|
133
|
+
? options.createFreshSession(cwd)
|
|
134
|
+
: { error: "fresh session creation not configured" },
|
|
135
|
+
},
|
|
136
|
+
git: { currentBranch: () => undefined },
|
|
137
|
+
exitProcess: (code) => process.exit(code),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal multiplexer detection for the controller's terminal probe.
|
|
3
|
+
* Reuses the legacy detection semantics (tmux/screen force full reprints).
|
|
4
|
+
*/
|
|
5
|
+
export function isMultiplexedTerminalLike(env = process.env) {
|
|
6
|
+
if (env.TMUX)
|
|
7
|
+
return true;
|
|
8
|
+
const term = env.TERM ?? "";
|
|
9
|
+
if (term.startsWith("screen") || term.startsWith("tmux"))
|
|
10
|
+
return true;
|
|
11
|
+
if (env.STY)
|
|
12
|
+
return true;
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scripted fake agent: replays a fixed AgentEvent[] per run so controller
|
|
3
|
+
* tests drive full sessions deterministically (no provider, no network).
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentRunOptions } from "../../agent.js";
|
|
6
|
+
import type { Message } from "../../types.js";
|
|
7
|
+
import type { AgentEvent } from "../../types.js";
|
|
8
|
+
export interface FakeAgentRunScript {
|
|
9
|
+
events: AgentEvent[];
|
|
10
|
+
/** Throw this error at the end of the script instead of completing. */
|
|
11
|
+
failWith?: Error;
|
|
12
|
+
}
|
|
13
|
+
export declare class FakeAgent {
|
|
14
|
+
messages: Message[];
|
|
15
|
+
scripts: FakeAgentRunScript[];
|
|
16
|
+
runCalls: Array<{
|
|
17
|
+
input: unknown;
|
|
18
|
+
options?: AgentRunOptions;
|
|
19
|
+
}>;
|
|
20
|
+
sessionIds: string[];
|
|
21
|
+
setSessionID(file: string): void;
|
|
22
|
+
enqueueScript(script: FakeAgentRunScript): void;
|
|
23
|
+
run(userInput: unknown, _cwd: string, options?: AgentRunOptions): AsyncIterable<AgentEvent>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class FakeAgent {
|
|
2
|
+
messages = [];
|
|
3
|
+
scripts = [];
|
|
4
|
+
runCalls = [];
|
|
5
|
+
sessionIds = [];
|
|
6
|
+
setSessionID(file) {
|
|
7
|
+
this.sessionIds.push(file);
|
|
8
|
+
}
|
|
9
|
+
enqueueScript(script) {
|
|
10
|
+
this.scripts.push(script);
|
|
11
|
+
}
|
|
12
|
+
async *run(userInput, _cwd, options) {
|
|
13
|
+
this.runCalls.push({ input: userInput, options });
|
|
14
|
+
const script = this.scripts.shift() ?? { events: [{ type: "turn_end" }] };
|
|
15
|
+
for (const event of script.events) {
|
|
16
|
+
yield event;
|
|
17
|
+
}
|
|
18
|
+
if (script.failWith) {
|
|
19
|
+
throw script.failWith;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless spy host: deterministic ports for controller tests.
|
|
3
|
+
* Records every effect and snapshot version so integration tests can assert
|
|
4
|
+
* exact sequences without a terminal.
|
|
5
|
+
*/
|
|
6
|
+
import type { BubbleTuiPorts } from "../controller/ports.js";
|
|
7
|
+
import type { ControllerEffect } from "../controller/effects.js";
|
|
8
|
+
export declare class SpyHost {
|
|
9
|
+
readonly effects: ControllerEffect[];
|
|
10
|
+
readonly snapshotVersions: number[];
|
|
11
|
+
private flushPending;
|
|
12
|
+
private nowMs;
|
|
13
|
+
readonly ports: BubbleTuiPorts;
|
|
14
|
+
readonly exitCodes: number[];
|
|
15
|
+
/** Fire any pending debounced flush (simulates the 40ms timer). */
|
|
16
|
+
fireFlush(): void;
|
|
17
|
+
advanceNow(deltaMs: number): void;
|
|
18
|
+
recordEffect(effect: ControllerEffect): void;
|
|
19
|
+
recordSnapshot(version: number): void;
|
|
20
|
+
effectsOf(kind: ControllerEffect["kind"]): ControllerEffect[];
|
|
21
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export class SpyHost {
|
|
2
|
+
effects = [];
|
|
3
|
+
snapshotVersions = [];
|
|
4
|
+
flushPending = null;
|
|
5
|
+
nowMs = 10_000;
|
|
6
|
+
ports = {
|
|
7
|
+
clock: { now: () => this.nowMs },
|
|
8
|
+
scheduler: {
|
|
9
|
+
setTimeout: (callback, ms) => {
|
|
10
|
+
const timer = setTimeout(callback, ms);
|
|
11
|
+
return { [Symbol.dispose ?? Symbol.for("nodejs.dispose")]: () => clearTimeout(timer) };
|
|
12
|
+
},
|
|
13
|
+
setInterval: (callback, ms) => {
|
|
14
|
+
const timer = setInterval(callback, ms);
|
|
15
|
+
return { [Symbol.dispose ?? Symbol.for("nodejs.dispose")]: () => clearInterval(timer) };
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
flush: {
|
|
19
|
+
scheduleFlush: (_intervalMs, flush) => {
|
|
20
|
+
this.flushPending ??= { flush };
|
|
21
|
+
},
|
|
22
|
+
cancelFlush: () => {
|
|
23
|
+
this.flushPending = null;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
terminal: { isMultiplexed: () => false },
|
|
27
|
+
sessionHost: {
|
|
28
|
+
switchSession: () => ({ error: "spy host: switchSession not configured" }),
|
|
29
|
+
createFresh: () => ({ error: "spy host: createFresh not configured" }),
|
|
30
|
+
},
|
|
31
|
+
git: { currentBranch: () => undefined },
|
|
32
|
+
exitProcess: (code) => {
|
|
33
|
+
this.exitCodes.push(code);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
exitCodes = [];
|
|
37
|
+
/** Fire any pending debounced flush (simulates the 40ms timer). */
|
|
38
|
+
fireFlush() {
|
|
39
|
+
const pending = this.flushPending;
|
|
40
|
+
this.flushPending = null;
|
|
41
|
+
pending?.flush();
|
|
42
|
+
}
|
|
43
|
+
advanceNow(deltaMs) {
|
|
44
|
+
this.nowMs += deltaMs;
|
|
45
|
+
}
|
|
46
|
+
recordEffect(effect) {
|
|
47
|
+
this.effects.push(effect);
|
|
48
|
+
}
|
|
49
|
+
recordSnapshot(version) {
|
|
50
|
+
this.snapshotVersions.push(version);
|
|
51
|
+
}
|
|
52
|
+
effectsOf(kind) {
|
|
53
|
+
return this.effects.filter((effect) => effect.kind === kind);
|
|
54
|
+
}
|
|
55
|
+
}
|
package/dist/tui/trace-groups.js
CHANGED
|
@@ -2,6 +2,7 @@ import os from "node:os";
|
|
|
2
2
|
import { getEditDiffDetails } from "./edit-diff.js";
|
|
3
3
|
import { formatSubagentRoute } from "../agent/subagent-route-format.js";
|
|
4
4
|
import { mcpInfoFromString } from "../mcp/name.js";
|
|
5
|
+
import { analyzeToolIntent } from "../agent/tool-intent.js";
|
|
5
6
|
const DEFAULT_MAX_ITEMS = 6;
|
|
6
7
|
const DEFAULT_MAX_PREVIEW_LINES = 8;
|
|
7
8
|
export function buildTraceGroups(toolCalls, options = {}) {
|
|
@@ -100,6 +101,18 @@ function classifyTool(toolCall) {
|
|
|
100
101
|
if (toolCall.metadata?.kind === "subagent") {
|
|
101
102
|
return { kind: "subagent", title: "Subagents", bucketKey: `subagent:${toolCall.id}`, groupable: false };
|
|
102
103
|
}
|
|
104
|
+
if (toolCall.name === "bash") {
|
|
105
|
+
const semanticKind = toolCall.metadata?.kind;
|
|
106
|
+
const family = semanticKind === "read" || semanticKind === "search"
|
|
107
|
+
? semanticKind
|
|
108
|
+
: analyzeToolIntent({ name: toolCall.name, parsedArgs: toolCall.args }).family;
|
|
109
|
+
if (family === "read") {
|
|
110
|
+
return { kind: "read", title: "Read", bucketKey: "read", groupable: true };
|
|
111
|
+
}
|
|
112
|
+
if (family === "search") {
|
|
113
|
+
return { kind: "search", title: "Search", bucketKey: "search", groupable: true };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
103
116
|
switch (toolCall.name) {
|
|
104
117
|
case "glob": {
|
|
105
118
|
const pattern = String(toolCall.args.pattern ?? "");
|
|
@@ -194,7 +207,7 @@ function listResultItems(tool, homeDir) {
|
|
|
194
207
|
const metadataPaths = Array.isArray(tool.metadata?.paths)
|
|
195
208
|
? tool.metadata.paths.filter((item) => typeof item === "string" && item.trim().length > 0)
|
|
196
209
|
: [];
|
|
197
|
-
if (metadataPaths.length > 0
|
|
210
|
+
if (metadataPaths.length > 0) {
|
|
198
211
|
return metadataPaths.map((line) => formatTracePath(line, homeDir));
|
|
199
212
|
}
|
|
200
213
|
return resultLines(tool.result)
|
|
@@ -226,7 +239,11 @@ function isListResultLine(line) {
|
|
|
226
239
|
}
|
|
227
240
|
function buildPathGroup(classifier, raw, options, pending, startedAt, hasError, errorCount, nounBase) {
|
|
228
241
|
const items = unique(raw
|
|
229
|
-
.map((tool) => formatTracePath(tool.args.path
|
|
242
|
+
.map((tool) => formatTracePath(tool.args.path
|
|
243
|
+
?? tool.args.file
|
|
244
|
+
?? tool.metadata?.path
|
|
245
|
+
?? analyzeToolIntent({ name: tool.name, parsedArgs: tool.args }).read?.path
|
|
246
|
+
?? "", options.homeDir))
|
|
230
247
|
.filter(Boolean));
|
|
231
248
|
const { shown, omitted } = take(items, options.maxItems);
|
|
232
249
|
const count = items.length || raw.length;
|
|
@@ -248,12 +265,16 @@ function buildPathGroup(classifier, raw, options, pending, startedAt, hasError,
|
|
|
248
265
|
}
|
|
249
266
|
function buildSearchGroup(classifier, raw, options, pending, startedAt, hasError, errorCount) {
|
|
250
267
|
const items = raw.map((tool) => {
|
|
251
|
-
const
|
|
252
|
-
const
|
|
268
|
+
const intent = analyzeToolIntent({ name: tool.name, parsedArgs: tool.args }).search;
|
|
269
|
+
const pattern = String(tool.args.pattern ?? tool.args.query ?? tool.metadata?.pattern ?? intent?.pattern ?? "").trim();
|
|
270
|
+
const scope = String(tool.args.path ?? tool.args.glob ?? tool.args.include ?? tool.metadata?.path ?? intent?.path ?? "").trim();
|
|
253
271
|
const patternText = pattern ? `"${pattern}"` : "(pattern)";
|
|
254
272
|
return scope ? `${patternText} in ${formatTracePath(scope, options.homeDir)}` : patternText;
|
|
255
273
|
});
|
|
274
|
+
const resultPreview = raw.flatMap((tool) => resultLines(tool.result))
|
|
275
|
+
.map((line) => formatTracePath(line, options.homeDir));
|
|
256
276
|
const { shown, omitted } = take(items, options.maxItems);
|
|
277
|
+
const preview = take(resultPreview, options.maxPreviewLines);
|
|
257
278
|
const count = raw.length;
|
|
258
279
|
return {
|
|
259
280
|
kind: "search",
|
|
@@ -262,9 +283,9 @@ function buildSearchGroup(classifier, raw, options, pending, startedAt, hasError
|
|
|
262
283
|
count,
|
|
263
284
|
noun: plural(count, "search", "searches"),
|
|
264
285
|
items: shown,
|
|
265
|
-
previewLines:
|
|
286
|
+
previewLines: preview.shown,
|
|
266
287
|
errorLines: collectErrorLines(raw, options),
|
|
267
|
-
omitted,
|
|
288
|
+
omitted: omitted + preview.omitted,
|
|
268
289
|
pending,
|
|
269
290
|
hasError,
|
|
270
291
|
errorCount,
|
package/dist/types.d.ts
CHANGED
|
@@ -35,6 +35,13 @@ export interface AssistantProviderMetadata {
|
|
|
35
35
|
export interface UserMessage {
|
|
36
36
|
role: "user";
|
|
37
37
|
content: string | ContentPart[];
|
|
38
|
+
/** Local presentation metadata; provider adapters intentionally ignore it. */
|
|
39
|
+
ui?: {
|
|
40
|
+
/** Exact composer layout, including inline image chips. */
|
|
41
|
+
displayText: string;
|
|
42
|
+
/** First [Image #N] label used by this message. */
|
|
43
|
+
imageDisplayStart?: number;
|
|
44
|
+
};
|
|
38
45
|
}
|
|
39
46
|
export interface AssistantMessage {
|
|
40
47
|
role: "assistant";
|
package/dist/update/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface InstallInfo {
|
|
|
22
22
|
isLocalCheckout: boolean;
|
|
23
23
|
installPath: string;
|
|
24
24
|
}
|
|
25
|
+
export declare function detectInstallFromPath(installPath: string): InstallInfo;
|
|
25
26
|
/**
|
|
26
27
|
* Figure out how this copy of Bubble was installed by inspecting the real path
|
|
27
28
|
* of the package directory (two levels up from this module: dist/update -> pkg).
|
package/dist/update/index.js
CHANGED
|
@@ -81,28 +81,15 @@ export function compareVersions(a, b) {
|
|
|
81
81
|
return -1;
|
|
82
82
|
return pa.pre > pb.pre ? 1 : -1;
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
* Figure out how this copy of Bubble was installed by inspecting the real path
|
|
86
|
-
* of the package directory (two levels up from this module: dist/update -> pkg).
|
|
87
|
-
*/
|
|
88
|
-
export function detectInstall() {
|
|
89
|
-
const rawRoot = fileURLToPath(new URL("../../", import.meta.url));
|
|
90
|
-
let installPath = rawRoot;
|
|
91
|
-
try {
|
|
92
|
-
installPath = realpathSync(rawRoot);
|
|
93
|
-
}
|
|
94
|
-
catch {
|
|
95
|
-
// keep rawRoot
|
|
96
|
-
}
|
|
84
|
+
export function detectInstallFromPath(installPath) {
|
|
97
85
|
const lower = installPath.replace(/\\/g, "/").toLowerCase();
|
|
98
86
|
const isUnderNodeModules = lower.includes("/node_modules/");
|
|
99
87
|
// A dev/source checkout has src/ alongside dist/ and isn't under node_modules.
|
|
100
88
|
const isLocalCheckout = !isUnderNodeModules;
|
|
101
89
|
let manager = "unknown";
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
else if (lower.includes("/.bun/") || lower.includes("/bun/install/")) {
|
|
90
|
+
// Package-manager-specific node_modules layouts take precedence over a
|
|
91
|
+
// parent directory name (for example /opt/homebrew/lib/node_modules is npm).
|
|
92
|
+
if (lower.includes("/.bun/") || lower.includes("/bun/install/")) {
|
|
106
93
|
manager = "bun";
|
|
107
94
|
}
|
|
108
95
|
else if (lower.includes("/pnpm/") || lower.includes("/.pnpm/")) {
|
|
@@ -114,8 +101,26 @@ export function detectInstall() {
|
|
|
114
101
|
else if (isUnderNodeModules) {
|
|
115
102
|
manager = "npm";
|
|
116
103
|
}
|
|
104
|
+
else if (lower.includes("/cellar/") || lower.includes("/homebrew/")) {
|
|
105
|
+
manager = "homebrew";
|
|
106
|
+
}
|
|
117
107
|
return { manager, isGlobal: isUnderNodeModules, isLocalCheckout, installPath };
|
|
118
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Figure out how this copy of Bubble was installed by inspecting the real path
|
|
111
|
+
* of the package directory (two levels up from this module: dist/update -> pkg).
|
|
112
|
+
*/
|
|
113
|
+
export function detectInstall() {
|
|
114
|
+
const rawRoot = fileURLToPath(new URL("../../", import.meta.url));
|
|
115
|
+
let installPath = rawRoot;
|
|
116
|
+
try {
|
|
117
|
+
installPath = realpathSync(rawRoot);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// keep rawRoot
|
|
121
|
+
}
|
|
122
|
+
return detectInstallFromPath(installPath);
|
|
123
|
+
}
|
|
119
124
|
export function upgradeCommandFor(manager) {
|
|
120
125
|
const spec = `${PACKAGE_NAME}@latest`;
|
|
121
126
|
switch (manager) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mario Zechner
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|