@zyro-sec/tui 0.0.0-stage → 1.0.2
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/AGENTS.md +6 -0
- package/bunfig.toml +4 -0
- package/package.json +79 -4
- package/src/app.tsx +1632 -0
- package/src/assets/backgrounds/anime.png +0 -0
- package/src/assets/backgrounds/circuit.jpg +0 -0
- package/src/assets/backgrounds/cyber-grid.jpg +0 -0
- package/src/assets/backgrounds/datacenter.jpg +0 -0
- package/src/assets/backgrounds/hacker-desk.jpg +0 -0
- package/src/assets/backgrounds/matrix-code.jpg +0 -0
- package/src/attention-sounds.bun.ts +8 -0
- package/src/attention-sounds.node.ts +16 -0
- package/src/attention.ts +189 -0
- package/src/audio.d.ts +9 -0
- package/src/audio.ts +49 -0
- package/src/clipboard.ts +68 -0
- package/src/component/background-image.tsx +26 -0
- package/src/component/command-palette.tsx +74 -0
- package/src/component/devtools-bar.tsx +611 -0
- package/src/component/dialog-agent.tsx +33 -0
- package/src/component/dialog-background.tsx +102 -0
- package/src/component/dialog-config.tsx +494 -0
- package/src/component/dialog-debug.tsx +90 -0
- package/src/component/dialog-error-details.tsx +130 -0
- package/src/component/dialog-experiments.tsx +101 -0
- package/src/component/dialog-go-upsell.tsx +448 -0
- package/src/component/dialog-highlights.tsx +88 -0
- package/src/component/dialog-image-preview.tsx +85 -0
- package/src/component/dialog-install-mcp.tsx +67 -0
- package/src/component/dialog-integration.tsx +1332 -0
- package/src/component/dialog-mcp.tsx +184 -0
- package/src/component/dialog-model-free.tsx +79 -0
- package/src/component/dialog-model.tsx +238 -0
- package/src/component/dialog-open.tsx +509 -0
- package/src/component/dialog-pair.tsx +123 -0
- package/src/component/dialog-session-list.tsx +328 -0
- package/src/component/dialog-session-rename.tsx +37 -0
- package/src/component/dialog-shell-output.tsx +194 -0
- package/src/component/dialog-skill.tsx +93 -0
- package/src/component/dialog-speed.tsx +48 -0
- package/src/component/dialog-stash.tsx +90 -0
- package/src/component/dialog-status.tsx +50 -0
- package/src/component/dialog-theme-list.tsx +56 -0
- package/src/component/dialog-update.tsx +144 -0
- package/src/component/dialog-variant.tsx +43 -0
- package/src/component/dialog-workspace-file-changes.tsx +187 -0
- package/src/component/dialog-workspaces.tsx +413 -0
- package/src/component/dialog-worktree-name.tsx +40 -0
- package/src/component/error-component.tsx +258 -0
- package/src/component/fade-in-text.tsx +113 -0
- package/src/component/go-upsell-art.ts +338 -0
- package/src/component/logo.tsx +79 -0
- package/src/component/masked-text.ts +59 -0
- package/src/component/media-source.ts +43 -0
- package/src/component/migration-overlay.tsx +73 -0
- package/src/component/model-options.tsx +121 -0
- package/src/component/one-cell-spinner.tsx +75 -0
- package/src/component/panel-host.tsx +64 -0
- package/src/component/patch-diff.tsx +211 -0
- package/src/component/plugin-route-missing.tsx +21 -0
- package/src/component/prompt/autocomplete.tsx +1005 -0
- package/src/component/prompt/draft-stash.ts +47 -0
- package/src/component/prompt/index.tsx +2080 -0
- package/src/component/prompt/local-attachment.ts +188 -0
- package/src/component/prompt/metadata.tsx +193 -0
- package/src/component/prompt/move.tsx +181 -0
- package/src/component/reconnecting.tsx +40 -0
- package/src/component/retry-provider.tsx +202 -0
- package/src/component/session-frame.tsx +408 -0
- package/src/component/session-tabs-rail.tsx +94 -0
- package/src/component/session-tabs.tsx +1789 -0
- package/src/component/shimmer-text.tsx +64 -0
- package/src/component/spinner-frames.ts +1 -0
- package/src/component/spinner-renderable.ts +126 -0
- package/src/component/spinner.tsx +50 -0
- package/src/component/startup-loading.tsx +63 -0
- package/src/component/tab-pulse.tsx +819 -0
- package/src/component/terminal-pane.tsx +377 -0
- package/src/component/theme-error-toast.tsx +20 -0
- package/src/component/title-shimmer.tsx +272 -0
- package/src/component/todo-item.tsx +27 -0
- package/src/component/usage.tsx +329 -0
- package/src/component/use-connected.tsx +14 -0
- package/src/config/index.tsx +438 -0
- package/src/config/keybind.ts +367 -0
- package/src/config/new-session-location.ts +16 -0
- package/src/config/v1/index.tsx +149 -0
- package/src/config/v1/keybind.ts +463 -0
- package/src/context/args.tsx +31 -0
- package/src/context/attention.tsx +23 -0
- package/src/context/client-mcp.tsx +119 -0
- package/src/context/client.tsx +76 -0
- package/src/context/clipboard.tsx +19 -0
- package/src/context/data.tsx +69 -0
- package/src/context/editor.ts +408 -0
- package/src/context/epilogue.tsx +14 -0
- package/src/context/event.ts +32 -0
- package/src/context/exit.tsx +8 -0
- package/src/context/helper.tsx +26 -0
- package/src/context/interactivity.tsx +20 -0
- package/src/context/keymap.tsx +515 -0
- package/src/context/local.tsx +723 -0
- package/src/context/location.tsx +80 -0
- package/src/context/log.tsx +24 -0
- package/src/context/panel.tsx +59 -0
- package/src/context/path-format.tsx +12 -0
- package/src/context/permission.tsx +18 -0
- package/src/context/program-status.ts +94 -0
- package/src/context/prompt.tsx +18 -0
- package/src/context/route.tsx +73 -0
- package/src/context/runtime.tsx +98 -0
- package/src/context/session-tabs-model.ts +263 -0
- package/src/context/session-tabs.tsx +508 -0
- package/src/context/session-terminals.tsx +136 -0
- package/src/context/storage.tsx +150 -0
- package/src/context/theme.tsx +447 -0
- package/src/context/thinking.ts +20 -0
- package/src/context/update-notification.tsx +158 -0
- package/src/devtools/index.ts +41 -0
- package/src/editor-zed-sqlite.bun.ts +1 -0
- package/src/editor-zed-sqlite.node.ts +21 -0
- package/src/editor-zed.ts +277 -0
- package/src/editor.ts +86 -0
- package/src/feature-plugins/home/footer.tsx +116 -0
- package/src/feature-plugins/prompt/btw.tsx +190 -0
- package/src/feature-plugins/prompt/footer.tsx +163 -0
- package/src/feature-plugins/prompt/goal.tsx +211 -0
- package/src/feature-plugins/sidebar/context.tsx +52 -0
- package/src/feature-plugins/sidebar/footer.tsx +126 -0
- package/src/feature-plugins/sidebar/limit.tsx +47 -0
- package/src/feature-plugins/sidebar/mcp.tsx +103 -0
- package/src/feature-plugins/sidebar/todo.tsx +58 -0
- package/src/feature-plugins/system/diff-viewer-file-menu.tsx +87 -0
- package/src/feature-plugins/system/diff-viewer-file-tree-utils.ts +174 -0
- package/src/feature-plugins/system/diff-viewer-file-tree.tsx +274 -0
- package/src/feature-plugins/system/diff-viewer-image.tsx +96 -0
- package/src/feature-plugins/system/diff-viewer.tsx +1380 -0
- package/src/feature-plugins/system/notifications.ts +102 -0
- package/src/feature-plugins/system/plugins.tsx +356 -0
- package/src/feature-plugins/system/stats-data.ts +18 -0
- package/src/feature-plugins/system/stats.tsx +217 -0
- package/src/feature-plugins/system/storybook/footer.tsx +51 -0
- package/src/feature-plugins/system/storybook/highlights.tsx +71 -0
- package/src/feature-plugins/system/storybook/index.tsx +153 -0
- package/src/feature-plugins/system/storybook/link-clicks.tsx +125 -0
- package/src/feature-plugins/system/storybook/merman-layouts.tsx +200 -0
- package/src/feature-plugins/system/storybook/one-cell-spinner.fixtures.ts +144 -0
- package/src/feature-plugins/system/storybook/one-cell-spinner.tsx +293 -0
- package/src/feature-plugins/system/storybook/session-location-missing.tsx +80 -0
- package/src/feature-plugins/system/storybook/session-tabs.tsx +571 -0
- package/src/feature-plugins/system/storybook/subcell-spinner.fixtures.ts +115 -0
- package/src/feature-plugins/system/storybook/todo.tsx +166 -0
- package/src/index.tsx +2 -0
- package/src/logo.ts +21 -0
- package/src/mini/catalog.shared.ts +116 -0
- package/src/mini/demo.ts +1086 -0
- package/src/mini/entry.body.ts +244 -0
- package/src/mini/footer.command.tsx +1205 -0
- package/src/mini/footer.form.tsx +647 -0
- package/src/mini/footer.menu.tsx +313 -0
- package/src/mini/footer.permission.tsx +562 -0
- package/src/mini/footer.prompt.tsx +1533 -0
- package/src/mini/footer.subagent.tsx +268 -0
- package/src/mini/footer.ts +1193 -0
- package/src/mini/footer.view.tsx +1022 -0
- package/src/mini/footer.width.ts +118 -0
- package/src/mini/form.shared.ts +241 -0
- package/src/mini/index.ts +7 -0
- package/src/mini/mono.ts +277 -0
- package/src/mini/permission.shared.ts +199 -0
- package/src/mini/prompt.editor.ts +74 -0
- package/src/mini/prompt.shared.ts +192 -0
- package/src/mini/runtime.boot.ts +98 -0
- package/src/mini/runtime.lifecycle.ts +393 -0
- package/src/mini/runtime.queue.ts +320 -0
- package/src/mini/runtime.ts +1117 -0
- package/src/mini/scrollback.shared.ts +82 -0
- package/src/mini/scrollback.surface.ts +548 -0
- package/src/mini/scrollback.writer.tsx +380 -0
- package/src/mini/session-data.ts +13 -0
- package/src/mini/session.shared.ts +113 -0
- package/src/mini/splash.ts +307 -0
- package/src/mini/stream-v2.fragment.ts +83 -0
- package/src/mini/stream-v2.image.ts +38 -0
- package/src/mini/stream-v2.subagent.ts +1130 -0
- package/src/mini/stream-v2.transport.ts +1916 -0
- package/src/mini/stream.ts +152 -0
- package/src/mini/theme.ts +328 -0
- package/src/mini/tool.public.ts +3 -0
- package/src/mini/tool.ts +1394 -0
- package/src/mini/turn-summary.ts +21 -0
- package/src/mini/types.ts +482 -0
- package/src/mini/variant.shared.ts +58 -0
- package/src/mini/verbosity.ts +84 -0
- package/src/model-preference.ts +206 -0
- package/src/parsers-config.ts +386 -0
- package/src/plugin/api.tsx +486 -0
- package/src/plugin/builtins.ts +35 -0
- package/src/plugin/context.tsx +757 -0
- package/src/plugin/discovery.ts +67 -0
- package/src/plugin/markdown.ts +18 -0
- package/src/plugin/render.tsx +116 -0
- package/src/plugin/runtime-plugin-support.bun.ts +11 -0
- package/src/plugin/runtime-plugin-support.node.ts +1 -0
- package/src/plugin/source.ts +1 -0
- package/src/plugin/structure.ts +159 -0
- package/src/plugin/watch.ts +113 -0
- package/src/prompt/attachment.ts +97 -0
- package/src/prompt/codec.ts +61 -0
- package/src/prompt/content.ts +22 -0
- package/src/prompt/directory-completion.ts +97 -0
- package/src/prompt/directory-recents.ts +36 -0
- package/src/prompt/display.ts +41 -0
- package/src/prompt/frecency.tsx +80 -0
- package/src/prompt/history.tsx +175 -0
- package/src/prompt/mention.ts +173 -0
- package/src/prompt/parse.ts +25 -0
- package/src/prompt/part.ts +35 -0
- package/src/prompt/restore.ts +39 -0
- package/src/prompt/stash.tsx +93 -0
- package/src/prompt/traits.ts +29 -0
- package/src/routes/home.tsx +180 -0
- package/src/routes/session/activity-summary.ts +101 -0
- package/src/routes/session/anchor-view.tsx +53 -0
- package/src/routes/session/anchors.ts +85 -0
- package/src/routes/session/composer/context.ts +24 -0
- package/src/routes/session/composer/index.tsx +143 -0
- package/src/routes/session/composer/scripts-tab.tsx +166 -0
- package/src/routes/session/composer/shell-tab.tsx +149 -0
- package/src/routes/session/composer/subagents-tab.tsx +264 -0
- package/src/routes/session/composer/tabs.ts +91 -0
- package/src/routes/session/composer/terminals-tab.tsx +114 -0
- package/src/routes/session/dialog-execute.tsx +276 -0
- package/src/routes/session/dialog-fork.tsx +87 -0
- package/src/routes/session/dialog-message.tsx +89 -0
- package/src/routes/session/dialog-timeline.tsx +43 -0
- package/src/routes/session/form.tsx +1177 -0
- package/src/routes/session/group-view.tsx +407 -0
- package/src/routes/session/grouping/session.ts +184 -0
- package/src/routes/session/grouping/tree.ts +111 -0
- package/src/routes/session/history.ts +59 -0
- package/src/routes/session/index.tsx +3922 -0
- package/src/routes/session/location-missing.tsx +81 -0
- package/src/routes/session/message-navigation.ts +48 -0
- package/src/routes/session/message-parts.tsx +322 -0
- package/src/routes/session/mount-budget.ts +38 -0
- package/src/routes/session/permission.tsx +622 -0
- package/src/routes/session/render-context.tsx +44 -0
- package/src/routes/session/rows.ts +493 -0
- package/src/routes/session/sidebar.tsx +80 -0
- package/src/routes/session/thinking-syntax.ts +8 -0
- package/src/runtime.tsx +1 -0
- package/src/simulation/semantics.ts +12 -0
- package/src/theme/assets/aura.json +69 -0
- package/src/theme/assets/ayu.json +80 -0
- package/src/theme/assets/carbonfox.json +248 -0
- package/src/theme/assets/catppuccin-frappe.json +230 -0
- package/src/theme/assets/catppuccin-macchiato.json +230 -0
- package/src/theme/assets/catppuccin.json +112 -0
- package/src/theme/assets/cobalt2.json +225 -0
- package/src/theme/assets/cursor.json +249 -0
- package/src/theme/assets/dracula.json +219 -0
- package/src/theme/assets/everforest.json +241 -0
- package/src/theme/assets/flexoki.json +237 -0
- package/src/theme/assets/github.json +233 -0
- package/src/theme/assets/gruvbox.json +242 -0
- package/src/theme/assets/kanagawa.json +77 -0
- package/src/theme/assets/lucent-orng.json +234 -0
- package/src/theme/assets/material.json +235 -0
- package/src/theme/assets/matrix.json +77 -0
- package/src/theme/assets/mercury.json +252 -0
- package/src/theme/assets/monokai.json +221 -0
- package/src/theme/assets/nightowl.json +221 -0
- package/src/theme/assets/nord.json +223 -0
- package/src/theme/assets/one-dark.json +84 -0
- package/src/theme/assets/opencode.json +245 -0
- package/src/theme/assets/orng.json +249 -0
- package/src/theme/assets/osaka-jade.json +93 -0
- package/src/theme/assets/palenight.json +222 -0
- package/src/theme/assets/rosepine.json +234 -0
- package/src/theme/assets/solarized.json +223 -0
- package/src/theme/assets/synthwave84.json +226 -0
- package/src/theme/assets/tokyonight.json +243 -0
- package/src/theme/assets/v2/opencode-classic.json +387 -0
- package/src/theme/assets/v2/opencode.json +395 -0
- package/src/theme/assets/vercel.json +245 -0
- package/src/theme/assets/vesper.json +218 -0
- package/src/theme/assets/zenburn.json +223 -0
- package/src/theme/color.ts +48 -0
- package/src/theme/component.ts +51 -0
- package/src/theme/discovery.ts +21 -0
- package/src/theme/index.ts +109 -0
- package/src/theme/resolve.ts +53 -0
- package/src/theme/system.ts +144 -0
- package/src/theme/v1.ts +70 -0
- package/src/ui/animation.ts +235 -0
- package/src/ui/border.ts +21 -0
- package/src/ui/dialog-alert.tsx +51 -0
- package/src/ui/dialog-confirm.tsx +62 -0
- package/src/ui/dialog-export-options.tsx +316 -0
- package/src/ui/dialog-export-result.tsx +84 -0
- package/src/ui/dialog-help.tsx +40 -0
- package/src/ui/dialog-prompt.tsx +180 -0
- package/src/ui/dialog-select.tsx +1006 -0
- package/src/ui/dialog.tsx +560 -0
- package/src/ui/file-path.tsx +112 -0
- package/src/ui/layout.ts +26 -0
- package/src/ui/link.tsx +51 -0
- package/src/ui/one-cell-motion.ts +111 -0
- package/src/ui/pane-resize-handle.tsx +33 -0
- package/src/ui/pane-resize.ts +76 -0
- package/src/ui/select-controller.ts +45 -0
- package/src/ui/session-link.ts +92 -0
- package/src/ui/spinner.ts +368 -0
- package/src/ui/subcell.ts +37 -0
- package/src/ui/toast.tsx +222 -0
- package/src/ui/working-directory-actions.tsx +66 -0
- package/src/util/collapse-tool-output.ts +95 -0
- package/src/util/config-directories.ts +53 -0
- package/src/util/connected-provider.ts +15 -0
- package/src/util/delayed-presence.ts +34 -0
- package/src/util/diff.ts +84 -0
- package/src/util/error-details.ts +21 -0
- package/src/util/error.ts +141 -0
- package/src/util/filetype.ts +135 -0
- package/src/util/form.ts +146 -0
- package/src/util/highlights.ts +51 -0
- package/src/util/locale.ts +81 -0
- package/src/util/marquee.ts +51 -0
- package/src/util/media.ts +43 -0
- package/src/util/model.ts +33 -0
- package/src/util/path-format.ts +37 -0
- package/src/util/path.ts +12 -0
- package/src/util/permission.ts +188 -0
- package/src/util/persistence.ts +42 -0
- package/src/util/presentation.ts +42 -0
- package/src/util/project.ts +7 -0
- package/src/util/record.ts +3 -0
- package/src/util/renderer.ts +15 -0
- package/src/util/scroll.ts +29 -0
- package/src/util/selection.ts +103 -0
- package/src/util/session.ts +103 -0
- package/src/util/signal.ts +49 -0
- package/src/util/single-flight.ts +12 -0
- package/src/util/string-width.bun.ts +1 -0
- package/src/util/string-width.node.ts +26 -0
- package/src/util/string-width.ts +1 -0
- package/src/util/system.ts +23 -0
- package/src/util/todo.ts +43 -0
- package/src/util/tool-display.ts +70 -0
- package/src/util/usage-limits.ts +152 -0
- package/src/util/watch.ts +24 -0
- package/test/app-lifecycle.test.tsx +2962 -0
- package/test/clear-session.test.tsx +67 -0
- package/test/cli/cmd/tui/integration-options.test.ts +98 -0
- package/test/cli/cmd/tui/model-options.test.ts +105 -0
- package/test/cli/cmd/tui/notifications.test.ts +356 -0
- package/test/cli/tui/__snapshots__/inline-tool-wrap-snapshot.test.tsx.snap +22 -0
- package/test/cli/tui/anchors.test.ts +77 -0
- package/test/cli/tui/collapse-tool-output.test.ts +14 -0
- package/test/cli/tui/command-palette.test.tsx +86 -0
- package/test/cli/tui/composer-keymap.test.tsx +346 -0
- package/test/cli/tui/data.test.tsx +3669 -0
- package/test/cli/tui/dialog-integration.test.tsx +588 -0
- package/test/cli/tui/dialog-mcp.test.tsx +197 -0
- package/test/cli/tui/dialog-open.test.tsx +1037 -0
- package/test/cli/tui/dialog-prompt.test.tsx +253 -0
- package/test/cli/tui/dialog-select.test.tsx +740 -0
- package/test/cli/tui/dialog-session-list.test.tsx +130 -0
- package/test/cli/tui/diff-viewer-file-tree.test.tsx +256 -0
- package/test/cli/tui/diff-viewer-image.test.tsx +172 -0
- package/test/cli/tui/diff-viewer.test.tsx +2510 -0
- package/test/cli/tui/form.test.tsx +950 -0
- package/test/cli/tui/group-boundary.test.ts +63 -0
- package/test/cli/tui/group-view.test.tsx +352 -0
- package/test/cli/tui/grouping-tree.test.ts +82 -0
- package/test/cli/tui/inline-tool-wrap-snapshot.test.tsx +248 -0
- package/test/cli/tui/input-scope.test.tsx +282 -0
- package/test/cli/tui/keymap-arguments.test.tsx +45 -0
- package/test/cli/tui/message-navigation.test.ts +164 -0
- package/test/cli/tui/mount-budget.test.ts +74 -0
- package/test/cli/tui/permission.test.ts +7 -0
- package/test/cli/tui/plugins-dialog.test.tsx +217 -0
- package/test/cli/tui/prompt-interrupt-status.test.tsx +25 -0
- package/test/cli/tui/prompt-move.test.tsx +446 -0
- package/test/cli/tui/reasoning-body.test.tsx +80 -0
- package/test/cli/tui/script-changes.test.ts +41 -0
- package/test/cli/tui/session-grouping.test.ts +21 -0
- package/test/cli/tui/session-history.test.ts +124 -0
- package/test/cli/tui/session-rows.test.ts +616 -0
- package/test/cli/tui/session-verbosity.test.ts +307 -0
- package/test/cli/tui/theme-mode.test.tsx +179 -0
- package/test/cli/tui/thinking.test.ts +36 -0
- package/test/cli/tui/toast.test.tsx +117 -0
- package/test/cli/tui/use-event.test.tsx +295 -0
- package/test/client-mcp.test.tsx +226 -0
- package/test/clipboard.test.ts +148 -0
- package/test/command-selection.test.tsx +123 -0
- package/test/compact-admission.test.tsx +251 -0
- package/test/completion-notices.test.tsx +197 -0
- package/test/component/animation-ticks.test.tsx +212 -0
- package/test/component/dialog-error-details.test.tsx +110 -0
- package/test/component/dialog-export-options.test.tsx +68 -0
- package/test/component/dialog-highlights.test.tsx +73 -0
- package/test/component/dialog-model.test.tsx +145 -0
- package/test/component/dialog-shell-output.test.tsx +255 -0
- package/test/component/dialog-speed.test.tsx +114 -0
- package/test/component/dialog-update.test.tsx +111 -0
- package/test/component/dialog-variant.test.tsx +24 -0
- package/test/component/go-upsell-art.test.tsx +110 -0
- package/test/component/retry-provider.test.tsx +288 -0
- package/test/component/session-tabs-marquee.test.tsx +100 -0
- package/test/component/session-tabs-mouse.test.tsx +216 -0
- package/test/component/session-tabs-rail.test.tsx +120 -0
- package/test/component/session-tabs-status.test.tsx +345 -0
- package/test/component/shimmer-text.test.tsx +37 -0
- package/test/component/spinner-renderable.test.tsx +133 -0
- package/test/component/tab-pulse.test.tsx +196 -0
- package/test/component/terminal-pane-theme.test.ts +68 -0
- package/test/config-v2.test.tsx +335 -0
- package/test/config.test.tsx +184 -0
- package/test/context/local-selection.test.tsx +204 -0
- package/test/context/local.test.ts +15 -0
- package/test/context/program-status.test.ts +73 -0
- package/test/context/session-retention.test.ts +234 -0
- package/test/context/session-tabs-model.test.ts +341 -0
- package/test/context/session-tabs.test.tsx +864 -0
- package/test/context/storage.test.ts +37 -0
- package/test/context/theme.test.tsx +183 -0
- package/test/copy-session-id.test.tsx +79 -0
- package/test/editor.test.ts +69 -0
- package/test/feature-plugins/diff-viewer-file-tree-utils.test.ts +234 -0
- package/test/feature-plugins/goal.test.tsx +126 -0
- package/test/feature-plugins/home-footer.test.ts +13 -0
- package/test/feature-plugins/prompt-footer.test.tsx +303 -0
- package/test/feature-plugins/sidebar-context.test.tsx +70 -0
- package/test/feature-plugins/sidebar-footer.test.tsx +139 -0
- package/test/fixture/animation-ticks.ts +19 -0
- package/test/fixture/app.ts +95 -0
- package/test/fixture/diff-image.ts +7 -0
- package/test/fixture/fixture.ts +27 -0
- package/test/fixture/frame.ts +25 -0
- package/test/fixture/local.tsx +158 -0
- package/test/fixture/plugin/client-reads/tui.tsx +9 -0
- package/test/fixture/plugin/dialog-throw/tui.tsx +11 -0
- package/test/fixture/plugin/native-resources/tui.tsx +26 -0
- package/test/fixture/plugin/setup-keymap/tui.tsx +72 -0
- package/test/fixture/plugin/slot-string/tui.tsx +10 -0
- package/test/fixture/tui-client.ts +186 -0
- package/test/fixture/tui-environment.tsx +47 -0
- package/test/fixture/tui-runtime.ts +21 -0
- package/test/highlights.test.ts +43 -0
- package/test/interactivity.test.tsx +46 -0
- package/test/keybind.test.ts +7 -0
- package/test/keymap-scope.test.tsx +271 -0
- package/test/keymap.test.tsx +244 -0
- package/test/markdown-streaming.test.tsx +49 -0
- package/test/mini/blocker.responsive.test.tsx +732 -0
- package/test/mini/catalog.shared.test.ts +76 -0
- package/test/mini/entry.body.test.ts +622 -0
- package/test/mini/fixture/catalog.ts +63 -0
- package/test/mini/fixture/footer-api.ts +69 -0
- package/test/mini/fixture/tool-part.ts +20 -0
- package/test/mini/footer-keymap.test.tsx +141 -0
- package/test/mini/footer.menu.test.ts +43 -0
- package/test/mini/footer.responsive.test.tsx +438 -0
- package/test/mini/footer.test.ts +446 -0
- package/test/mini/footer.view.test.tsx +2627 -0
- package/test/mini/footer.width.test.ts +120 -0
- package/test/mini/form.shared.test.ts +66 -0
- package/test/mini/permission.shared.test.ts +195 -0
- package/test/mini/prompt.editor.test.ts +118 -0
- package/test/mini/prompt.shared.test.ts +104 -0
- package/test/mini/runtime.boot.test.ts +118 -0
- package/test/mini/runtime.queue.test.ts +443 -0
- package/test/mini/runtime.test.ts +591 -0
- package/test/mini/scrollback.image.test.ts +213 -0
- package/test/mini/scrollback.surface.test.ts +1078 -0
- package/test/mini/session.shared.test.ts +267 -0
- package/test/mini/splash.test.ts +196 -0
- package/test/mini/stream-v2.transport.test.ts +4705 -0
- package/test/mini/stream.test.ts +52 -0
- package/test/mini/theme.test.ts +438 -0
- package/test/mini/tool.test.ts +134 -0
- package/test/mini/variant.shared.test.ts +58 -0
- package/test/mini/verbosity.test.ts +53 -0
- package/test/model-preference.test.ts +70 -0
- package/test/new-session-id.test.tsx +102 -0
- package/test/new-session-location.test.ts +30 -0
- package/test/panel.test.ts +71 -0
- package/test/plugin-discovery.test.ts +18 -0
- package/test/plugin-keymap.test.tsx +143 -0
- package/test/plugin-markdown.test.tsx +120 -0
- package/test/plugin-model.test.tsx +46 -0
- package/test/plugin-native-resources.test.tsx +11 -0
- package/test/plugin-select.test.tsx +391 -0
- package/test/plugin-slot-output.test.tsx +23 -0
- package/test/plugin-source.test.ts +871 -0
- package/test/plugin-toast.test.tsx +62 -0
- package/test/preload.ts +17 -0
- package/test/prompt/attachment.test.ts +138 -0
- package/test/prompt/autocomplete.test.ts +218 -0
- package/test/prompt/codec.test.ts +136 -0
- package/test/prompt/display.test.ts +72 -0
- package/test/prompt/draft-stash.test.ts +42 -0
- package/test/prompt/history-composer.test.tsx +52 -0
- package/test/prompt/history-provider.test.tsx +108 -0
- package/test/prompt/history.test.ts +94 -0
- package/test/prompt/jsonl.test.ts +24 -0
- package/test/prompt/local-attachment.test.ts +244 -0
- package/test/prompt/mention.test.ts +119 -0
- package/test/prompt/parse.test.ts +46 -0
- package/test/prompt/part.test.ts +40 -0
- package/test/prompt/persistence.test.ts +23 -0
- package/test/prompt/traits.test.ts +25 -0
- package/test/prompt-cursor.test.tsx +27 -0
- package/test/prompt-offset.test.tsx +58 -0
- package/test/prompt-paste.test.tsx +127 -0
- package/test/prompt-shell-failure.test.tsx +76 -0
- package/test/routes/composer-tabs.test.tsx +97 -0
- package/test/runtime.test.tsx +37 -0
- package/test/session-activity-anchor.test.tsx +180 -0
- package/test/session-backfill-disclosure.test.tsx +89 -0
- package/test/session-dialog-resync.test.tsx +122 -0
- package/test/session-fork-pending.test.tsx +60 -0
- package/test/session-group-navigation.test.tsx +252 -0
- package/test/session-history-interactions.test.tsx +305 -0
- package/test/session-history-reveal.test.tsx +108 -0
- package/test/session-home.test.tsx +401 -0
- package/test/session-interrupt-undo.test.tsx +98 -0
- package/test/session-media-refs.test.tsx +360 -0
- package/test/session-mount-budget.test.tsx +137 -0
- package/test/session-panel.test.tsx +721 -0
- package/test/session-shell-output.test.tsx +114 -0
- package/test/session-shell-stopped.test.tsx +107 -0
- package/test/session-subagent-navigation.test.tsx +44 -0
- package/test/session-submit-scroll.test.tsx +85 -0
- package/test/session-terminal-availability.test.tsx +80 -0
- package/test/session-wheel-focus.test.tsx +176 -0
- package/test/simulation/semantics.test.ts +23 -0
- package/test/stats.test.ts +33 -0
- package/test/stats.view.test.tsx +94 -0
- package/test/theme/v2/component.test.ts +87 -0
- package/test/theme/v2/resolve.test.ts +424 -0
- package/test/theme/v2/select.test.ts +25 -0
- package/test/theme/v2/types.typecheck.ts +57 -0
- package/test/theme/v2/v1-migrate.test.ts +397 -0
- package/test/theme.test.ts +150 -0
- package/test/ui/dialog-layout.test.tsx +56 -0
- package/test/ui/file-path.test.ts +61 -0
- package/test/ui/layout.test.ts +31 -0
- package/test/ui/link.test.tsx +60 -0
- package/test/ui/pane-resize-handle.test.tsx +134 -0
- package/test/ui/pane-resize.test.ts +258 -0
- package/test/ui/select-controller.test.ts +44 -0
- package/test/ui/session-link.test.tsx +325 -0
- package/test/usage-limits.test.tsx +162 -0
- package/test/util/added-patch.test.ts +44 -0
- package/test/util/connected-provider.test.ts +59 -0
- package/test/util/delayed-presence.test.ts +114 -0
- package/test/util/error-details.test.ts +26 -0
- package/test/util/error.test.ts +36 -0
- package/test/util/filetype.test.ts +23 -0
- package/test/util/form.test.ts +110 -0
- package/test/util/locale.test.ts +32 -0
- package/test/util/marquee.test.ts +45 -0
- package/test/util/media.test.ts +54 -0
- package/test/util/model.test.ts +70 -0
- package/test/util/path-format.test.ts +15 -0
- package/test/util/permission.test.ts +23 -0
- package/test/util/presentation.test.ts +30 -0
- package/test/util/renderer.test.ts +42 -0
- package/test/util/selection-copy-on-select.test.tsx +64 -0
- package/test/util/selection-keys.test.ts +172 -0
- package/test/util/selection.test.ts +115 -0
- package/test/util/session.test.ts +70 -0
- package/test/util/tool-display.test.ts +65 -0
- package/test/util/usage-limits.test.ts +154 -0
- package/tsconfig.json +13 -0
- package/README.md +0 -3
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import { Plugin } from "@zyro-sec/plugin/tui"
|
|
2
|
+
import { useTerminalDimensions } from "@opentui/solid"
|
|
3
|
+
import { batch, createSignal, For, Show } from "solid-js"
|
|
4
|
+
import { createStore, reconcile } from "solid-js/store"
|
|
5
|
+
import {
|
|
6
|
+
EMPTY_SESSION_TAB_STATUS,
|
|
7
|
+
SessionTabs,
|
|
8
|
+
TAB_SPINNERS,
|
|
9
|
+
TAB_UNREAD_MARKERS,
|
|
10
|
+
type SessionTabsController,
|
|
11
|
+
type TabSpinner,
|
|
12
|
+
type TabUnreadMarker,
|
|
13
|
+
} from "../../../component/session-tabs"
|
|
14
|
+
import { closeSessionTab, cycleSessionTab, moveSessionTab } from "../../../context/session-tabs-model"
|
|
15
|
+
import { StoryFooter } from "./footer"
|
|
16
|
+
import { DialogPrompt } from "../../../ui/dialog-prompt"
|
|
17
|
+
import { useDialog } from "../../../ui/dialog"
|
|
18
|
+
import { DialogSelect } from "../../../ui/dialog-select"
|
|
19
|
+
import {
|
|
20
|
+
clampSessionTabsWidth,
|
|
21
|
+
sessionTabsFitVertically,
|
|
22
|
+
SESSION_SIDEBAR_WIDTH,
|
|
23
|
+
SESSION_TABS_COMPACT_BREAKPOINT,
|
|
24
|
+
SESSION_TABS_COMPACT_WIDTH,
|
|
25
|
+
} from "../../../ui/layout"
|
|
26
|
+
import { createPaneResize } from "../../../ui/pane-resize"
|
|
27
|
+
import { PaneResizeHandle } from "../../../ui/pane-resize-handle"
|
|
28
|
+
import type { Story } from "./index"
|
|
29
|
+
|
|
30
|
+
type FixtureStatus = ReturnType<SessionTabsController["status"]>
|
|
31
|
+
|
|
32
|
+
const FIXTURE_TABS = [
|
|
33
|
+
{ sessionID: "fixture-1", title: "Implement session tabs", project: "opencode" },
|
|
34
|
+
{ sessionID: "fixture-2", title: "Investigate rendering", project: "opencode" },
|
|
35
|
+
{ sessionID: "fixture-3", title: "A deliberately long session title for truncation", project: "opencode-slack" },
|
|
36
|
+
{ sessionID: "fixture-4", title: "Fix provider state", project: "opencode" },
|
|
37
|
+
{ sessionID: "fixture-5", title: "Review animation", project: "opencode-slack" },
|
|
38
|
+
{ sessionID: "fixture-6", title: "Untitled behavior", project: "opencode-drive" },
|
|
39
|
+
{ sessionID: "fixture-7", title: "Queue follow-up work", project: "opencode" },
|
|
40
|
+
{ sessionID: "fixture-8", title: "Check narrow layout", project: "opencode-drive" },
|
|
41
|
+
{ sessionID: "fixture-9", title: "Profile terminal output", project: "opencode" },
|
|
42
|
+
{ sessionID: "fixture-10", title: "Handle permission", project: "opencode-slack" },
|
|
43
|
+
{ sessionID: "fixture-11", title: "Run focused tests", project: "opencode" },
|
|
44
|
+
{ sessionID: "fixture-12", title: "Prepare review", project: "opencode-drive" },
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
const FIXTURE_STATUSES: Record<string, FixtureStatus> = {
|
|
48
|
+
"fixture-2": { ...EMPTY_SESSION_TAB_STATUS, busy: true },
|
|
49
|
+
"fixture-3": { ...EMPTY_SESSION_TAB_STATUS, busy: true, attention: "question" },
|
|
50
|
+
"fixture-4": { ...EMPTY_SESSION_TAB_STATUS, busy: true, attention: "permission" },
|
|
51
|
+
"fixture-5": { ...EMPTY_SESSION_TAB_STATUS, unread: "activity" },
|
|
52
|
+
"fixture-6": { ...EMPTY_SESSION_TAB_STATUS, unread: "error" },
|
|
53
|
+
}
|
|
54
|
+
const FIXTURE_OUTCOMES = { "fixture-5": "completed", "fixture-6": "failed" } as const
|
|
55
|
+
|
|
56
|
+
// Plausible targets for the fake transcript's tool calls, picked per fixture index.
|
|
57
|
+
const TRANSCRIPT_FILES = [
|
|
58
|
+
"packages/tui/src/component/session-tabs.tsx",
|
|
59
|
+
"packages/tui/src/component/tab-pulse.tsx",
|
|
60
|
+
"packages/tui/src/context/session-tabs-model.ts",
|
|
61
|
+
"packages/core/src/session/runner.ts",
|
|
62
|
+
"packages/server/src/routes/session.ts",
|
|
63
|
+
"packages/tui/src/ui/animation.ts",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
function SessionTabsStory(props: { context: Plugin.Context }) {
|
|
67
|
+
const dimensions = useTerminalDimensions()
|
|
68
|
+
const theme = props.context.theme
|
|
69
|
+
const dialog = useDialog()
|
|
70
|
+
// A keyed store mirrors production: retitles mutate rows in place instead of remounting them.
|
|
71
|
+
const [tabStore, setTabStore] = createStore<{ items: { sessionID: string; title?: string }[] }>({
|
|
72
|
+
items: FIXTURE_TABS.slice(0, 6).map((tab) => ({ ...tab })),
|
|
73
|
+
})
|
|
74
|
+
const tabs = () => tabStore.items
|
|
75
|
+
const setItems = (next: { sessionID: string; title?: string }[]) =>
|
|
76
|
+
setTabStore("items", reconcile(next, { key: "sessionID" }))
|
|
77
|
+
const [active, setActive] = createSignal<string | undefined>("fixture-1")
|
|
78
|
+
const [lastEvent, setLastEvent] = createSignal("idle / working / question / permission / complete / error")
|
|
79
|
+
const [statuses, setStatuses] = createSignal<Record<string, FixtureStatus>>(FIXTURE_STATUSES)
|
|
80
|
+
const [orientation, setOrientation] = createSignal<"horizontal" | "vertical">("vertical")
|
|
81
|
+
const [width, setWidth] = createSignal(SESSION_SIDEBAR_WIDTH)
|
|
82
|
+
const resize = createPaneResize({
|
|
83
|
+
value: width,
|
|
84
|
+
defaultValue: () => SESSION_SIDEBAR_WIDTH,
|
|
85
|
+
clamp: (width) => clampSessionTabsWidth(width, dimensions().width),
|
|
86
|
+
fromMouse: (event) => event.x + 1,
|
|
87
|
+
contains: (event, width) => event.x >= width - 1 && event.x <= width,
|
|
88
|
+
onCommit: setWidth,
|
|
89
|
+
})
|
|
90
|
+
const vertical = () => orientation() === "vertical" && sessionTabsFitVertically(dimensions().width, resize.size())
|
|
91
|
+
const [indicators, setIndicators] = createSignal<"status" | "numbers">("status")
|
|
92
|
+
const railCompact = () => resize.size() < SESSION_TABS_COMPACT_BREAKPOINT
|
|
93
|
+
const spinners = Object.keys(TAB_SPINNERS) as TabSpinner[]
|
|
94
|
+
const [spinner, setSpinner] = createSignal<TabSpinner>("dots")
|
|
95
|
+
const markers = Object.keys(TAB_UNREAD_MARKERS) as TabUnreadMarker[]
|
|
96
|
+
const [marker, setMarker] = createSignal<TabUnreadMarker>("small-dot")
|
|
97
|
+
const [animations, setAnimations] = createSignal(true)
|
|
98
|
+
// Unread clears on select, so the transcript remembers how each session's last run ended.
|
|
99
|
+
const [outcomes, setOutcomes] = createSignal<Record<string, "completed" | "failed">>(FIXTURE_OUTCOMES)
|
|
100
|
+
const number = (sessionID: string) => tabs().findIndex((tab) => tab.sessionID === sessionID) + 1
|
|
101
|
+
|
|
102
|
+
function finishRun(sessionID: string, failed = Math.random() >= 0.75) {
|
|
103
|
+
if (!tabs().some((item) => item.sessionID === sessionID)) return
|
|
104
|
+
const unread = active() === sessionID ? undefined : failed ? ("error" as const) : ("activity" as const)
|
|
105
|
+
batch(() => {
|
|
106
|
+
setOutcomes((current) => ({ ...current, [sessionID]: failed ? "failed" : "completed" }))
|
|
107
|
+
setStatuses((current) => ({
|
|
108
|
+
...current,
|
|
109
|
+
[sessionID]: { ...(current[sessionID] ?? EMPTY_SESSION_TAB_STATUS), busy: false, attention: false, unread },
|
|
110
|
+
}))
|
|
111
|
+
// An untitled session earns its title after its first completed run, like a real summarization.
|
|
112
|
+
const index = number(sessionID) - 1
|
|
113
|
+
const fixture = FIXTURE_TABS.find((tab) => tab.sessionID === sessionID)
|
|
114
|
+
if (!failed && fixture && tabs()[index]?.title === undefined) setTabStore("items", index, "title", fixture.title)
|
|
115
|
+
})
|
|
116
|
+
setLastEvent(
|
|
117
|
+
`tab ${number(sessionID)} ${failed ? "failed" : "completed"}${unread ? " (unread)" : " while selected"}`,
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const select = (sessionID: string) => {
|
|
122
|
+
const status = statuses()[sessionID]
|
|
123
|
+
batch(() => {
|
|
124
|
+
setActive(sessionID)
|
|
125
|
+
if (status?.unread) setStatuses((current) => ({ ...current, [sessionID]: { ...status, unread: undefined } }))
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const addTab = () => {
|
|
130
|
+
const next = FIXTURE_TABS.find((fixture) => !tabs().some((tab) => tab.sessionID === fixture.sessionID))
|
|
131
|
+
if (!next) {
|
|
132
|
+
setLastEvent("all fixture tabs are open")
|
|
133
|
+
return
|
|
134
|
+
}
|
|
135
|
+
setItems([...tabs().map((tab) => ({ ...tab })), { sessionID: next.sessionID }])
|
|
136
|
+
select(next.sessionID)
|
|
137
|
+
setLastEvent(`tab ${number(next.sessionID)} opened untitled; run it to earn its title`)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const controller = {
|
|
141
|
+
tabs,
|
|
142
|
+
current: active,
|
|
143
|
+
add: addTab,
|
|
144
|
+
search() {
|
|
145
|
+
dialog.replace(() => (
|
|
146
|
+
<DialogSelect
|
|
147
|
+
title="Sessions (fixture)"
|
|
148
|
+
current={active()}
|
|
149
|
+
options={FIXTURE_TABS.map((tab) => ({ title: tab.title, value: tab.sessionID, description: tab.project }))}
|
|
150
|
+
onSelect={(option) => {
|
|
151
|
+
if (!tabs().some((tab) => tab.sessionID === option.value)) {
|
|
152
|
+
setItems([...tabs(), { ...FIXTURE_TABS.find((tab) => tab.sessionID === option.value)! }])
|
|
153
|
+
}
|
|
154
|
+
select(option.value)
|
|
155
|
+
dialog.clear()
|
|
156
|
+
}}
|
|
157
|
+
/>
|
|
158
|
+
))
|
|
159
|
+
},
|
|
160
|
+
detail(sessionID) {
|
|
161
|
+
return FIXTURE_TABS.find((tab) => tab.sessionID === sessionID)?.project
|
|
162
|
+
},
|
|
163
|
+
status(sessionID) {
|
|
164
|
+
return statuses()[sessionID] ?? EMPTY_SESSION_TAB_STATUS
|
|
165
|
+
},
|
|
166
|
+
select,
|
|
167
|
+
rename(sessionID: string) {
|
|
168
|
+
dialog.replace(() => (
|
|
169
|
+
<DialogPrompt
|
|
170
|
+
title="Rename fixture tab"
|
|
171
|
+
value={tabs().find((tab) => tab.sessionID === sessionID)?.title}
|
|
172
|
+
onConfirm={(title) => {
|
|
173
|
+
if (!title.trim()) return
|
|
174
|
+
setTabStore("items", (tab) => tab.sessionID === sessionID, "title", title.trim())
|
|
175
|
+
dialog.clear()
|
|
176
|
+
}}
|
|
177
|
+
/>
|
|
178
|
+
))
|
|
179
|
+
},
|
|
180
|
+
move(sessionID: string, index: number) {
|
|
181
|
+
const next = moveSessionTab(tabs(), sessionID, index)
|
|
182
|
+
if (next === tabs()) return
|
|
183
|
+
setItems(next.map((tab) => ({ ...tab })))
|
|
184
|
+
},
|
|
185
|
+
close(sessionID?: string) {
|
|
186
|
+
const target = sessionID ?? active()
|
|
187
|
+
if (!target) return
|
|
188
|
+
const result = closeSessionTab(tabs(), target)
|
|
189
|
+
if (result.tabs === tabs()) return
|
|
190
|
+
batch(() => {
|
|
191
|
+
setItems(result.tabs.map((tab) => ({ ...tab })))
|
|
192
|
+
setStatuses((current) => {
|
|
193
|
+
const updated = { ...current }
|
|
194
|
+
delete updated[target]
|
|
195
|
+
return updated
|
|
196
|
+
})
|
|
197
|
+
if (active() === target && result.next) select(result.next)
|
|
198
|
+
if (active() === target && !result.next) setActive(undefined)
|
|
199
|
+
})
|
|
200
|
+
},
|
|
201
|
+
} satisfies SessionTabsController
|
|
202
|
+
|
|
203
|
+
const cycle = (direction: 1 | -1) => {
|
|
204
|
+
const tab = cycleSessionTab(tabs(), active(), direction)
|
|
205
|
+
if (tab) select(tab.sessionID)
|
|
206
|
+
}
|
|
207
|
+
const startRun = (sessionID: string) => {
|
|
208
|
+
setStatuses((current) => ({
|
|
209
|
+
...current,
|
|
210
|
+
[sessionID]: {
|
|
211
|
+
...(current[sessionID] ?? EMPTY_SESSION_TAB_STATUS),
|
|
212
|
+
busy: true,
|
|
213
|
+
attention: false,
|
|
214
|
+
unread: undefined,
|
|
215
|
+
},
|
|
216
|
+
}))
|
|
217
|
+
setOutcomes((current) => {
|
|
218
|
+
const next = { ...current }
|
|
219
|
+
delete next[sessionID]
|
|
220
|
+
return next
|
|
221
|
+
})
|
|
222
|
+
setLastEvent(`tab ${number(sessionID)} running`)
|
|
223
|
+
}
|
|
224
|
+
const prompt = (sessionID: string) => {
|
|
225
|
+
const wasBusy = controller.status(sessionID).busy
|
|
226
|
+
setStatuses((current) => {
|
|
227
|
+
const status = current[sessionID] ?? EMPTY_SESSION_TAB_STATUS
|
|
228
|
+
return {
|
|
229
|
+
...current,
|
|
230
|
+
[sessionID]: {
|
|
231
|
+
...status,
|
|
232
|
+
busy: true,
|
|
233
|
+
unread: undefined,
|
|
234
|
+
promptPulse: status.promptPulse + 1,
|
|
235
|
+
},
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
setLastEvent(`prompt sent to tab ${number(sessionID)}${wasBusy ? " while running" : ""}`)
|
|
239
|
+
}
|
|
240
|
+
const randomInactiveTab = () => {
|
|
241
|
+
const candidates = tabs().filter((tab) => {
|
|
242
|
+
const status = controller.status(tab.sessionID)
|
|
243
|
+
return !status.busy && !status.unread && !status.attention
|
|
244
|
+
})
|
|
245
|
+
// Untitled sessions run first so their title arrival is easy to trigger.
|
|
246
|
+
const untitled = candidates.filter((tab) => tab.title === undefined)
|
|
247
|
+
const pool = untitled.length > 0 ? untitled : candidates
|
|
248
|
+
return pool[Math.floor(Math.random() * pool.length)]
|
|
249
|
+
}
|
|
250
|
+
const randomRunningTab = () => {
|
|
251
|
+
const candidates = tabs().filter((tab) => {
|
|
252
|
+
const status = controller.status(tab.sessionID)
|
|
253
|
+
return status.busy && !status.attention
|
|
254
|
+
})
|
|
255
|
+
return candidates[Math.floor(Math.random() * candidates.length)]
|
|
256
|
+
}
|
|
257
|
+
// A fake transcript for the selected session so tab switches feel like moving between real
|
|
258
|
+
// sessions; the tail line tracks the live status of the current run.
|
|
259
|
+
const transcript = () => {
|
|
260
|
+
const current = active()
|
|
261
|
+
if (!current) return [{ text: "no session selected", color: theme.text.muted }]
|
|
262
|
+
const index = Math.max(
|
|
263
|
+
0,
|
|
264
|
+
FIXTURE_TABS.findIndex((fixture) => fixture.sessionID === current),
|
|
265
|
+
)
|
|
266
|
+
const fixture = FIXTURE_TABS[index]
|
|
267
|
+
const status = controller.status(current)
|
|
268
|
+
const outcome = outcomes()[current]
|
|
269
|
+
const file = TRANSCRIPT_FILES[index % TRANSCRIPT_FILES.length]
|
|
270
|
+
const lines = [
|
|
271
|
+
{ text: `> ${fixture.title}`, color: theme.text.base },
|
|
272
|
+
{ text: "", color: theme.text.base },
|
|
273
|
+
]
|
|
274
|
+
if (!status.busy && !status.attention && outcome === undefined) {
|
|
275
|
+
lines.push({ text: "no activity yet — press s to run this session", color: theme.text.muted })
|
|
276
|
+
return lines
|
|
277
|
+
}
|
|
278
|
+
lines.push(
|
|
279
|
+
{ text: "● Taking a look — reading the relevant code first.", color: theme.text.base },
|
|
280
|
+
{ text: "", color: theme.text.base },
|
|
281
|
+
{ text: ` ✱ Read ${file}`, color: theme.text.muted },
|
|
282
|
+
{ text: ` ✱ Edit ${file}`, color: theme.text.muted },
|
|
283
|
+
{ text: ` ✱ Bash bun run test`, color: theme.text.muted },
|
|
284
|
+
{ text: "", color: theme.text.base },
|
|
285
|
+
)
|
|
286
|
+
if (status.attention === "question")
|
|
287
|
+
lines.push({ text: "? Which approach should I take?", color: theme.hue.accent[200] })
|
|
288
|
+
else if (status.attention === "permission")
|
|
289
|
+
lines.push({ text: "! Waiting for permission to run the command", color: theme.hue.accent[200] })
|
|
290
|
+
else if (status.busy) lines.push({ text: "● Working…", color: theme.hue.interactive[200] })
|
|
291
|
+
else if (outcome === "failed")
|
|
292
|
+
lines.push({
|
|
293
|
+
text: `✗ bun run test failed — 3 tests failing in ${file}`,
|
|
294
|
+
color: theme.text.feedback.error.base,
|
|
295
|
+
})
|
|
296
|
+
else
|
|
297
|
+
lines.push({
|
|
298
|
+
text: `✓ Done — updated ${file} and the tests pass.`,
|
|
299
|
+
color: theme.text.feedback.success.base,
|
|
300
|
+
})
|
|
301
|
+
return lines
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const stateSummary = () => {
|
|
305
|
+
const values = tabs().map((tab) => controller.status(tab.sessionID))
|
|
306
|
+
const running = values.filter((status) => status.busy && !status.attention).length
|
|
307
|
+
const waiting = values.filter((status) => status.attention).length
|
|
308
|
+
const unread = values.filter((status) => status.unread !== undefined).length
|
|
309
|
+
return [`selected ${number(active() ?? "")}`, `${running} running`, `${waiting} waiting`, `${unread} unread`].join(
|
|
310
|
+
" · ",
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const reset = (showcase = false) => {
|
|
315
|
+
batch(() => {
|
|
316
|
+
setItems(FIXTURE_TABS.slice(0, 6).map((tab) => ({ ...tab })))
|
|
317
|
+
setStatuses(showcase ? FIXTURE_STATUSES : {})
|
|
318
|
+
setOutcomes(showcase ? FIXTURE_OUTCOMES : {})
|
|
319
|
+
setActive("fixture-1")
|
|
320
|
+
setSpinner("dots")
|
|
321
|
+
setMarker("small-dot")
|
|
322
|
+
setAnimations(true)
|
|
323
|
+
setOrientation("vertical")
|
|
324
|
+
setWidth(SESSION_SIDEBAR_WIDTH)
|
|
325
|
+
setIndicators("status")
|
|
326
|
+
})
|
|
327
|
+
setLastEvent(showcase ? "all six states are visible" : "reset; all tabs idle")
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
props.context.keymap.layer(() => ({
|
|
331
|
+
commands: [
|
|
332
|
+
{
|
|
333
|
+
bind: "escape",
|
|
334
|
+
title: "Back to storybook",
|
|
335
|
+
group: "Storybook",
|
|
336
|
+
run() {
|
|
337
|
+
props.context.ui.router.navigate({ type: "plugin", name: "storybook" })
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
{ bind: "up,k,left,h", title: "Previous tab", group: "Storybook", run: () => cycle(-1) },
|
|
341
|
+
{ bind: "down,j,right,l", title: "Next tab", group: "Storybook", run: () => cycle(1) },
|
|
342
|
+
...Array.from({ length: 10 }, (_, index) => ({
|
|
343
|
+
bind: `${(index + 1) % 10},ctrl+${(index + 1) % 10}`,
|
|
344
|
+
title: `Select tab ${index + 1}`,
|
|
345
|
+
group: "Storybook",
|
|
346
|
+
run() {
|
|
347
|
+
const tab = tabs()[index]
|
|
348
|
+
if (tab) select(tab.sessionID)
|
|
349
|
+
},
|
|
350
|
+
})),
|
|
351
|
+
{
|
|
352
|
+
bind: "space",
|
|
353
|
+
title: "Start a random tab",
|
|
354
|
+
group: "Storybook",
|
|
355
|
+
run() {
|
|
356
|
+
const tab = randomInactiveTab()
|
|
357
|
+
if (!tab) {
|
|
358
|
+
setLastEvent("every tab is busy or unread; select tabs to read them, or press r")
|
|
359
|
+
return
|
|
360
|
+
}
|
|
361
|
+
startRun(tab.sessionID)
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
bind: "e",
|
|
366
|
+
title: "End a random running tab",
|
|
367
|
+
group: "Storybook",
|
|
368
|
+
run() {
|
|
369
|
+
const tab = randomRunningTab()
|
|
370
|
+
if (!tab) {
|
|
371
|
+
setLastEvent("no tabs are running; press space to start one")
|
|
372
|
+
return
|
|
373
|
+
}
|
|
374
|
+
finishRun(tab.sessionID)
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
bind: "p",
|
|
379
|
+
title: "Prompt selected tab",
|
|
380
|
+
group: "Storybook",
|
|
381
|
+
run() {
|
|
382
|
+
const current = active()
|
|
383
|
+
if (!current) return
|
|
384
|
+
prompt(current)
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
// Random runs may select any eligible tab; this command guarantees the edge flash
|
|
389
|
+
// and running sweep can be watched under the cursor.
|
|
390
|
+
bind: "s",
|
|
391
|
+
title: "Run selected tab",
|
|
392
|
+
group: "Storybook",
|
|
393
|
+
run() {
|
|
394
|
+
const current = active()
|
|
395
|
+
if (!current) return
|
|
396
|
+
if (controller.status(current).busy && !controller.status(current).attention) {
|
|
397
|
+
setLastEvent(`tab ${number(current)} is already running`)
|
|
398
|
+
return
|
|
399
|
+
}
|
|
400
|
+
startRun(current)
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
...(
|
|
404
|
+
[
|
|
405
|
+
{ bind: "q", title: "Ask a question", attention: "question" },
|
|
406
|
+
{ bind: "a", title: "Request permission", attention: "permission" },
|
|
407
|
+
{ bind: "i", title: "Set idle", attention: false },
|
|
408
|
+
] as const
|
|
409
|
+
).map((state) => ({
|
|
410
|
+
bind: state.bind,
|
|
411
|
+
title: state.title,
|
|
412
|
+
group: "Storybook",
|
|
413
|
+
run() {
|
|
414
|
+
const current = active()
|
|
415
|
+
if (!current) return
|
|
416
|
+
startRun(current)
|
|
417
|
+
setStatuses((statuses) => ({
|
|
418
|
+
...statuses,
|
|
419
|
+
[current]: { ...EMPTY_SESSION_TAB_STATUS, busy: Boolean(state.attention), attention: state.attention },
|
|
420
|
+
}))
|
|
421
|
+
setLastEvent(`tab ${number(current)} ${state.attention || "idle"}`)
|
|
422
|
+
},
|
|
423
|
+
})),
|
|
424
|
+
...(
|
|
425
|
+
[
|
|
426
|
+
{ bind: "f", title: "Complete selected tab", failed: false },
|
|
427
|
+
{ bind: "x", title: "Fail selected tab", failed: true },
|
|
428
|
+
] as const
|
|
429
|
+
).map((state) => ({
|
|
430
|
+
bind: state.bind,
|
|
431
|
+
title: state.title,
|
|
432
|
+
group: "Storybook",
|
|
433
|
+
run() {
|
|
434
|
+
const current = active()
|
|
435
|
+
if (!current) return
|
|
436
|
+
// Leave the result unread so its indicator can be inspected before selecting it again.
|
|
437
|
+
cycle(1)
|
|
438
|
+
finishRun(current, state.failed)
|
|
439
|
+
},
|
|
440
|
+
})),
|
|
441
|
+
{
|
|
442
|
+
bind: "c",
|
|
443
|
+
title: "Cycle spinner shape",
|
|
444
|
+
group: "Storybook",
|
|
445
|
+
run: () => setSpinner((value) => spinners[(spinners.indexOf(value) + 1) % spinners.length]),
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
bind: "u",
|
|
449
|
+
title: "Cycle unread marker",
|
|
450
|
+
group: "Storybook",
|
|
451
|
+
run: () => setMarker((value) => markers[(markers.indexOf(value) + 1) % markers.length]),
|
|
452
|
+
},
|
|
453
|
+
{ bind: "m", title: "Toggle animations", group: "Storybook", run: () => setAnimations((value) => !value) },
|
|
454
|
+
{
|
|
455
|
+
bind: "g",
|
|
456
|
+
title: "Toggle status icons or numbers",
|
|
457
|
+
group: "Storybook",
|
|
458
|
+
run: () => setIndicators((value) => (value === "status" ? "numbers" : "status")),
|
|
459
|
+
},
|
|
460
|
+
{ bind: "t", title: "Add tab", group: "Storybook", run: addTab },
|
|
461
|
+
{ bind: "d", title: "Close tab", group: "Storybook", run: () => controller.close() },
|
|
462
|
+
{
|
|
463
|
+
bind: "b",
|
|
464
|
+
title: "Switch minimum or default width",
|
|
465
|
+
group: "Storybook",
|
|
466
|
+
run: () => setWidth(railCompact() ? SESSION_SIDEBAR_WIDTH : SESSION_TABS_COMPACT_WIDTH),
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
bind: "n",
|
|
470
|
+
title: "Cycle tab count",
|
|
471
|
+
group: "Storybook",
|
|
472
|
+
run() {
|
|
473
|
+
const count = tabs().length < 6 ? 6 : tabs().length < 12 ? 12 : 3
|
|
474
|
+
setItems(FIXTURE_TABS.slice(0, count).map((tab) => ({ ...tab })))
|
|
475
|
+
if (!tabs().some((tab) => tab.sessionID === active())) setActive("fixture-1")
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
bind: "o",
|
|
480
|
+
title: "Toggle tab orientation",
|
|
481
|
+
group: "Storybook",
|
|
482
|
+
run() {
|
|
483
|
+
setOrientation((value) => (value === "vertical" ? "horizontal" : "vertical"))
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
{ bind: "r,shift+r", title: "Reset to idle", group: "Storybook", run: () => reset() },
|
|
487
|
+
{ bind: "v", title: "Show all states", group: "Storybook", run: () => reset(true) },
|
|
488
|
+
],
|
|
489
|
+
}))
|
|
490
|
+
|
|
491
|
+
return (
|
|
492
|
+
<box
|
|
493
|
+
width={dimensions().width}
|
|
494
|
+
height={dimensions().height}
|
|
495
|
+
flexDirection="column"
|
|
496
|
+
backgroundColor={theme.background.base}
|
|
497
|
+
>
|
|
498
|
+
<box
|
|
499
|
+
flexGrow={1}
|
|
500
|
+
minHeight={0}
|
|
501
|
+
flexDirection={vertical() ? "row" : "column"}
|
|
502
|
+
onMouseDrag={resize.onMouseDrag}
|
|
503
|
+
onMouseDragEnd={resize.onMouseDragEnd}
|
|
504
|
+
onMouseUp={resize.onMouseUp}
|
|
505
|
+
>
|
|
506
|
+
<SessionTabs
|
|
507
|
+
controller={controller}
|
|
508
|
+
orientation={vertical() ? "vertical" : "horizontal"}
|
|
509
|
+
width={resize.size()}
|
|
510
|
+
spinner={spinner()}
|
|
511
|
+
unreadMarker={marker()}
|
|
512
|
+
animations={animations()}
|
|
513
|
+
indicators={indicators()}
|
|
514
|
+
/>
|
|
515
|
+
<box flexGrow={1} minWidth={0} paddingLeft={2} paddingRight={2} paddingTop={1} flexDirection="column">
|
|
516
|
+
<For each={transcript()}>
|
|
517
|
+
{(line) => (
|
|
518
|
+
<text fg={line.color} wrapMode="none" selectable={false}>
|
|
519
|
+
{line.text || " "}
|
|
520
|
+
</text>
|
|
521
|
+
)}
|
|
522
|
+
</For>
|
|
523
|
+
</box>
|
|
524
|
+
<Show when={vertical()}>
|
|
525
|
+
<PaneResizeHandle resize={resize} left={resize.size() - 1} />
|
|
526
|
+
</Show>
|
|
527
|
+
</box>
|
|
528
|
+
<StoryFooter
|
|
529
|
+
context={props.context}
|
|
530
|
+
title="storybook / tabs"
|
|
531
|
+
details={[
|
|
532
|
+
vertical() ? `${railCompact() ? "compact rail" : "expanded rail"} · ${resize.size()} cols` : "top strip",
|
|
533
|
+
spinner(),
|
|
534
|
+
indicators(),
|
|
535
|
+
`${TAB_UNREAD_MARKERS[marker()]} ${marker()}`,
|
|
536
|
+
animations() ? "animated" : "still",
|
|
537
|
+
]}
|
|
538
|
+
status={stateSummary()}
|
|
539
|
+
message={lastEvent()}
|
|
540
|
+
controls={[
|
|
541
|
+
{ shortcut: "b", label: "min/default width" },
|
|
542
|
+
{ shortcut: "n", label: "3/6/12 tabs" },
|
|
543
|
+
{ shortcut: "s", label: "work" },
|
|
544
|
+
{ shortcut: "space/e", label: "random work" },
|
|
545
|
+
{ shortcut: "p", label: "prompt" },
|
|
546
|
+
{ shortcut: "q", label: "question" },
|
|
547
|
+
{ shortcut: "a", label: "permission" },
|
|
548
|
+
{ shortcut: "i", label: "idle" },
|
|
549
|
+
{ shortcut: "f/x", label: "complete/fail" },
|
|
550
|
+
{ shortcut: "t/d", label: "add/close" },
|
|
551
|
+
{ shortcut: "c", label: "spinner" },
|
|
552
|
+
{ shortcut: "g", label: "status/numbers" },
|
|
553
|
+
{ shortcut: "u", label: "unread marker" },
|
|
554
|
+
{ shortcut: "m", label: "motion" },
|
|
555
|
+
{ shortcut: "↑/↓", label: "select" },
|
|
556
|
+
{ shortcut: "o", label: "layout" },
|
|
557
|
+
{ shortcut: "drag edge", label: "resize / double-click reset" },
|
|
558
|
+
{ shortcut: "r", label: "reset idle" },
|
|
559
|
+
{ shortcut: "v", label: "all states" },
|
|
560
|
+
{ shortcut: "esc", label: "back" },
|
|
561
|
+
]}
|
|
562
|
+
/>
|
|
563
|
+
</box>
|
|
564
|
+
)
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export const sessionTabsStory: Story = {
|
|
568
|
+
id: "session-tabs",
|
|
569
|
+
title: "Tabs",
|
|
570
|
+
render: (context) => <SessionTabsStory context={context} />,
|
|
571
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BLOCK_LOW_COMET,
|
|
3
|
+
BLOCK_SOFT_SLIDE,
|
|
4
|
+
BLOCK_SOFT_SWEEP,
|
|
5
|
+
SEED_LAUNCH,
|
|
6
|
+
WORK_SPINNERS,
|
|
7
|
+
} from "../../../ui/one-cell-motion"
|
|
8
|
+
import { octantGlyph } from "../../../ui/subcell"
|
|
9
|
+
import type { SpinnerFixture } from "./one-cell-spinner.fixtures"
|
|
10
|
+
|
|
11
|
+
const perimeter = [0, 1, 3, 5, 7, 6, 4, 2]
|
|
12
|
+
const patterns = [
|
|
13
|
+
{
|
|
14
|
+
name: "comet",
|
|
15
|
+
description: "Three pixels chase the edge.",
|
|
16
|
+
interval: 100,
|
|
17
|
+
masks: perimeter.map(
|
|
18
|
+
(point, index) => (1 << point) | (1 << perimeter[(index + 7) % 8]!) | (1 << perimeter[(index + 6) % 8]!),
|
|
19
|
+
),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "orbit",
|
|
23
|
+
description: "Two pixels keep a steady orbit.",
|
|
24
|
+
interval: 140,
|
|
25
|
+
masks: perimeter.map((point, index) => (1 << point) | (1 << perimeter[(index + 7) % 8]!)),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "duet",
|
|
29
|
+
description: "Two pairs circle opposite edges.",
|
|
30
|
+
interval: 180,
|
|
31
|
+
masks: perimeter
|
|
32
|
+
.slice(0, 4)
|
|
33
|
+
.map((_, index) => [0, 3, 4, 7].reduce((mask, offset) => mask | (1 << perimeter[(index + offset) % 8]!), 0)),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "scan",
|
|
37
|
+
description: "A row sweeps down, pauses, and returns.",
|
|
38
|
+
interval: 130,
|
|
39
|
+
masks: [0, 0, 1, 2, 3, 3, 2, 1].map((row) => 3 << (row * 2)),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "weave",
|
|
43
|
+
description: "Four pixels pass from side to side.",
|
|
44
|
+
interval: 200,
|
|
45
|
+
masks: [0x55, 0x69, 0xaa, 0x96],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "tide",
|
|
49
|
+
description: "Rows rise from the floor, then recede.",
|
|
50
|
+
interval: 160,
|
|
51
|
+
masks: [0xc0, 0xc0, 0xf0, 0xfc, 0xff, 0xfc, 0xf0],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "low comet",
|
|
55
|
+
description: "The tail recedes before the head moves. The top row stays empty.",
|
|
56
|
+
motion: BLOCK_LOW_COMET,
|
|
57
|
+
blockOnly: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "low duet",
|
|
61
|
+
description: "Two tails recede, then the heads move. The top row stays empty.",
|
|
62
|
+
motion: WORK_SPINNERS["block-low-duet"],
|
|
63
|
+
blockOnly: true,
|
|
64
|
+
},
|
|
65
|
+
// The middle four octants are bits 2-5: left column 0x14, right column 0x28.
|
|
66
|
+
{
|
|
67
|
+
name: "shuttle",
|
|
68
|
+
description: "A narrow bar moves left and right through the middle four.",
|
|
69
|
+
motion: WORK_SPINNERS["block-shuttle"],
|
|
70
|
+
blockOnly: true,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "bridge",
|
|
74
|
+
description: "The bar stretches across the middle four, then settles opposite.",
|
|
75
|
+
motion: WORK_SPINNERS["block-bridge"],
|
|
76
|
+
blockOnly: true,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "soft sweep",
|
|
80
|
+
description: "A staggered wipe crosses the middle four and retraces its path.",
|
|
81
|
+
motion: BLOCK_SOFT_SWEEP,
|
|
82
|
+
blockOnly: true,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "squeeze",
|
|
86
|
+
description: "The middle bar folds, hops sideways, and opens.",
|
|
87
|
+
motion: WORK_SPINNERS["block-squeeze"],
|
|
88
|
+
blockOnly: true,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "soft slide",
|
|
92
|
+
description: "The middle bar softens before each sideways step.",
|
|
93
|
+
blockOnly: true,
|
|
94
|
+
motion: BLOCK_SOFT_SLIDE,
|
|
95
|
+
},
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
export const SUBCELL_SPINNERS: SpinnerFixture[] = patterns.flatMap((pattern) =>
|
|
99
|
+
(pattern.blockOnly ? ["block"] : ["block", "dot"]).map((style) => ({
|
|
100
|
+
name: `${style} ${pattern.name}`,
|
|
101
|
+
description: `${pattern.description} ${style === "block" ? "2x4 octants need a recent font." : "2x4 braille dots."}`,
|
|
102
|
+
...(pattern.motion ?? {
|
|
103
|
+
interval: pattern.interval!,
|
|
104
|
+
frames: pattern.masks!.map((mask) => {
|
|
105
|
+
if (style === "dot") {
|
|
106
|
+
// Braille numbers its dots by column rather than by raster row.
|
|
107
|
+
const dots = [0, 3, 1, 4, 2, 5, 6, 7].reduce((value, bit, index) => value | (((mask >> index) & 1) << bit), 0)
|
|
108
|
+
return String.fromCodePoint(0x2800 + dots)
|
|
109
|
+
}
|
|
110
|
+
return octantGlyph(mask)
|
|
111
|
+
}),
|
|
112
|
+
}),
|
|
113
|
+
launch: SEED_LAUNCH,
|
|
114
|
+
})),
|
|
115
|
+
)
|