@kabmo-labs/kabmo 0.22.0 → 0.24.0
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 +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +873 -524
- package/dist/client/static/js/{index-297dck9a.js → index-jcr5twtp.js} +799 -795
- package/dist/client/static/js/index-z3w7n85q.css +1 -0
- package/marketplace/plugins/stats/package.json +2 -2
- package/marketplace/plugins/stats/src/groups.test.ts +14 -0
- package/marketplace/plugins/stats/src/groups.ts +20 -0
- package/marketplace/plugins/stats/src/labels.test.ts +9 -0
- package/marketplace/plugins/stats/src/labels.ts +7 -0
- package/marketplace/plugins/stats/src/server.ts +1 -1
- package/package.json +1 -1
- package/src/client/App.tsx +20 -19
- package/src/client/components/common/ComposerTextarea.tsx +10 -1
- package/src/client/components/common/Modal.tsx +2 -6
- package/src/client/components/common/PWAInstallButton.tsx +3 -2
- package/src/client/components/common/Toast.test.tsx +298 -0
- package/src/client/components/common/Toast.tsx +103 -37
- package/src/client/components/common/ToastStack.tsx +33 -12
- package/src/client/components/common/ViewportSelector.tsx +122 -114
- package/src/client/components/common/context-usage-button/Ring.tsx +38 -1
- package/src/client/components/common/context-usage-button/index.test.tsx +19 -3
- package/src/client/components/common/context-usage-button/index.tsx +5 -2
- package/src/client/components/common/harness-glyph/brands.ts +65 -0
- package/src/client/components/common/harness-glyph/harness-glyph.test.ts +185 -0
- package/src/client/components/common/harness-glyph/index.tsx +131 -0
- package/src/client/components/common/header-controls/MoreMenu.tsx +2 -1
- package/src/client/components/common/header-controls/index.tsx +16 -8
- package/src/client/components/common/header-panel-buttons/index.tsx +4 -3
- package/src/client/components/common/panel-mark/index.test.tsx +2 -2
- package/src/client/components/common/panel-mark/index.tsx +11 -2
- package/src/client/components/common/search-select/index.tsx +305 -0
- package/src/client/components/common/search-select/search-select.test.tsx +217 -0
- package/src/client/components/common/server-control/index.tsx +3 -2
- package/src/client/components/common/session-row/index.tsx +18 -1
- package/src/client/components/common/toolbar-row/index.tsx +57 -20
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -3
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +3 -2
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +7 -1
- package/src/client/components/layout/desktop-layout/index.tsx +1 -3
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +1 -0
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +18 -1
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +1 -3
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.test.tsx +332 -0
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +310 -0
- package/src/client/components/layout/session-sidebar/about-modal/SocialLinks.tsx +63 -51
- package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +4 -2
- package/src/client/components/layout/session-sidebar/about-modal/index.test.tsx +122 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +136 -35
- package/src/client/components/layout/session-sidebar/harness-mark.test.tsx +126 -0
- package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +4 -3
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +1 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +1 -7
- package/src/client/components/mobile/SessionSidebar.tsx +1 -3
- package/src/client/components/mobile/mobile-main-view/Header.tsx +3 -2
- package/src/client/components/mobile/mobile-session-sidebar/Dialogs.tsx +0 -8
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +1 -0
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +17 -1
- package/src/client/components/settings/Modal.tsx +26 -22
- package/src/client/components/settings/Sidebar.tsx +45 -5
- package/src/client/components/settings/categories/HarnessSettings.tsx +207 -0
- package/src/client/components/settings/categories/ProjectSettings.tsx +1 -3
- package/src/client/components/settings/categories/ProviderSettings.tsx +0 -4
- package/src/client/components/settings/categories/SkillCatalogSettings.tsx +13 -23
- package/src/client/components/settings/categories/agent-settings/ModelPicker.tsx +23 -30
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +20 -11
- package/src/client/components/settings/categories/chat-settings/GoalSection.tsx +16 -16
- package/src/client/components/settings/categories/harness-settings/AddProviderForm.tsx +219 -0
- package/src/client/components/settings/categories/harness-settings/ConfigForm.tsx +268 -0
- package/src/client/components/settings/categories/harness-settings/EnvProviderForm.tsx +146 -0
- package/src/client/components/settings/categories/harness-settings/HarnessCard.tsx +278 -0
- package/src/client/components/settings/categories/harness-settings/ImportSection.tsx +195 -0
- package/src/client/components/settings/categories/harness-settings/ProviderPanel.tsx +152 -0
- package/src/client/components/settings/categories/harness-settings/ToggleList.tsx +147 -0
- package/src/client/components/settings/categories/harness-settings/parts.test.tsx +97 -0
- package/src/client/components/settings/categories/harness-settings/parts.tsx +84 -0
- package/src/client/components/settings/categories/harness-settings/provider-panel.test.tsx +313 -0
- package/src/client/components/settings/categories/omp-settings/RoleEditor.test.ts +60 -39
- package/src/client/components/settings/categories/omp-settings/RoleRow.tsx +32 -41
- package/src/client/components/settings/categories/omp-settings/role-picker.test-util.ts +45 -0
- package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +11 -4
- package/src/client/components/settings/groups.test.tsx +160 -0
- package/src/client/components/settings/harness-icons.test.tsx +134 -0
- package/src/client/components/workspace/browser-panel/AddressBar.tsx +3 -13
- package/src/client/components/workspace/browser-toolbar/clusters.tsx +237 -0
- package/src/client/components/workspace/browser-toolbar/index.test.tsx +167 -0
- package/src/client/components/workspace/browser-toolbar/index.tsx +99 -100
- package/src/client/components/workspace/btw-panel/Messages.tsx +4 -1
- package/src/client/components/workspace/btw-panel/index.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +11 -7
- package/src/client/components/workspace/chat-timeline/ChatOverlays.tsx +5 -2
- package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +13 -0
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +13 -0
- package/src/client/components/workspace/chat-timeline/GeneratingIndicator.test.ts +41 -0
- package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +19 -14
- package/src/client/components/workspace/chat-timeline/MessageList.test.ts +14 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +6 -0
- package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +14 -0
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +4 -0
- package/src/client/components/workspace/chat-timeline/RunMark.tsx +58 -0
- package/src/client/components/workspace/chat-timeline/SubagentView.tsx +4 -1
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +4 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +11 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +13 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +8 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +27 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +48 -23
- package/src/client/components/workspace/chat-timeline/chat-input/composer-portal.test.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +21 -1
- package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +7 -0
- package/src/client/components/workspace/chat-timeline/chat-input/props.ts +13 -0
- package/src/client/components/workspace/chat-timeline/chat-input/selection.ts +11 -2
- package/src/client/components/workspace/chat-timeline/chat-input/styles.test.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +17 -15
- package/src/client/components/workspace/chat-timeline/pending-harness.test.tsx +157 -0
- package/src/client/components/workspace/chat-timeline/run-mark.test.ts +104 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FrameControl.tsx +11 -20
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/GroupedAsk.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/drafts.ts +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +31 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.test.ts +56 -45
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +38 -94
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/wait-parts.tsx +76 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +2 -1
- package/src/client/components/workspace/file-explorer/index.test.ts +25 -0
- package/src/client/components/workspace/file-explorer/index.tsx +10 -6
- package/src/client/components/workspace/git-panel/index.test.ts +13 -3
- package/src/client/components/workspace/git-panel/index.tsx +1 -3
- package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +92 -0
- package/src/client/components/workspace/model-dropdown/HarnessTabs.tsx +290 -0
- package/src/client/components/workspace/model-dropdown/Item.tsx +11 -0
- package/src/client/components/workspace/model-dropdown/Panel.tsx +119 -8
- package/src/client/components/workspace/model-dropdown/Section.tsx +4 -0
- package/src/client/components/workspace/model-dropdown/fullscreen-picker.ts +51 -0
- package/src/client/components/workspace/model-dropdown/harness-models.test.ts +177 -0
- package/src/client/components/workspace/model-dropdown/harness-models.ts +148 -0
- package/src/client/components/workspace/model-dropdown/harness-tabs.test.tsx +336 -0
- package/src/client/components/workspace/model-dropdown/index.tsx +114 -85
- package/src/client/components/workspace/model-dropdown/placement.test.tsx +127 -0
- package/src/client/components/workspace/model-dropdown/popover-metrics.test.ts +107 -0
- package/src/client/components/workspace/model-dropdown/popover-metrics.ts +118 -0
- package/src/client/components/workspace/model-dropdown/row-mutations.ts +106 -0
- package/src/client/components/workspace/model-dropdown/trigger.test.ts +22 -2
- package/src/client/components/workspace/model-dropdown/use-popover-size.ts +89 -0
- package/src/client/data/settings/omp-schema.json +224 -17
- package/src/client/hooks/chat/composer/index.ts +11 -2
- package/src/client/hooks/chat/composer/items.test.ts +11 -0
- package/src/client/hooks/chat/composer/items.ts +4 -2
- package/src/client/hooks/chat/composer/model-selection.test.ts +110 -0
- package/src/client/hooks/chat/composer/model-selection.ts +45 -4
- package/src/client/hooks/chat/omp/prompt-send.ts +4 -2
- package/src/client/hooks/chat/timeline/actions.ts +10 -5
- package/src/client/hooks/chat/timeline/ask-frames.ts +5 -4
- package/src/client/hooks/chat/timeline/composer-local-actions.test.ts +19 -81
- package/src/client/hooks/chat/timeline/composer-modes.ts +11 -2
- package/src/client/hooks/chat/timeline/composer-refs.ts +16 -1
- package/src/client/hooks/chat/timeline/index.ts +27 -35
- package/src/client/hooks/chat/timeline/mode-availability.test.ts +51 -0
- package/src/client/hooks/chat/timeline/modes-contract.ts +6 -0
- package/src/client/hooks/chat/timeline/modes.ts +41 -2
- package/src/client/hooks/chat/timeline/new-chat-open.test.ts +86 -0
- package/src/client/hooks/chat/timeline/new-chat-open.ts +23 -5
- package/src/client/hooks/chat/timeline/new-chat.test.ts +32 -4
- package/src/client/hooks/chat/timeline/new-chat.ts +18 -6
- package/src/client/hooks/chat/timeline/prompt-text.test.ts +7 -0
- package/src/client/hooks/chat/timeline/prompt-text.ts +15 -6
- package/src/client/hooks/chat/timeline/rewind-actions.test.ts +51 -1
- package/src/client/hooks/chat/timeline/rewind-actions.ts +23 -1
- package/src/client/hooks/chat/timeline/run-identity.test.ts +52 -0
- package/src/client/hooks/chat/timeline/run-identity.ts +23 -11
- package/src/client/hooks/chat/timeline/send-execute.test.ts +55 -0
- package/src/client/hooks/chat/timeline/send-props.ts +11 -3
- package/src/client/hooks/chat/timeline/send-steer.test.ts +2 -3
- package/src/client/hooks/chat/timeline/send.test-util.ts +3 -2
- package/src/client/hooks/chat/timeline/send.test.ts +2 -3
- package/src/client/hooks/chat/timeline/send.ts +34 -8
- package/src/client/hooks/chat/timeline/session-harness.test.ts +163 -0
- package/src/client/hooks/chat/timeline/session-harness.ts +164 -0
- package/src/client/hooks/chat/timeline/session-load.test-util.ts +6 -2
- package/src/client/hooks/chat/timeline/session-load.test.ts +31 -0
- package/src/client/hooks/chat/timeline/session-load.ts +6 -14
- package/src/client/hooks/chat/timeline/session-shapes.ts +32 -0
- package/src/client/hooks/chat/timeline/spawn-harness.ts +41 -0
- package/src/client/hooks/chat/timeline/timeline-running.ts +55 -0
- package/src/client/hooks/chat/timeline/tui-only-guard.ts +9 -0
- package/src/client/hooks/chat/timeline/undo-confirmation.test.ts +131 -0
- package/src/client/hooks/models/harness-catalog.ts +114 -0
- package/src/client/hooks/models/provider-writes.test.ts +81 -0
- package/src/client/hooks/models/provider-writes.ts +144 -0
- package/src/client/hooks/models/use-harness-versions.test.ts +152 -0
- package/src/client/hooks/models/use-harness-versions.ts +136 -0
- package/src/client/hooks/models/use-harnesses-controller.ts +57 -0
- package/src/client/hooks/models/use-harnesses-signal.test.ts +128 -0
- package/src/client/hooks/models/use-harnesses.test.ts +187 -0
- package/src/client/hooks/models/use-harnesses.ts +215 -0
- package/src/client/hooks/settings/providers/index.ts +1 -3
- package/src/client/hooks/ui/editor-error-toast.ts +10 -3
- package/src/client/hooks/ui/icon-style.ts +28 -0
- package/src/client/hooks/ui/on-click-outside.test.ts +104 -0
- package/src/client/hooks/ui/on-click-outside.ts +14 -2
- package/src/client/hooks/ui/theme.ts +6 -0
- package/src/client/hooks/ui/toast-queue.test.ts +126 -0
- package/src/client/hooks/ui/toasts.ts +132 -27
- package/src/client/hooks/ui/ui-feedback.test.ts +4 -91
- package/src/client/lib/ui/control-plate.test.ts +76 -0
- package/src/client/lib/ui/control-plate.ts +65 -0
- package/src/client/tailwind.css +47 -1
- package/src/server/lib/assets/shell-attributes.server.ts +9 -2
- package/src/server/lib/assets/shell-attributes.test.ts +22 -6
- package/src/server/lib/db/schema.ts +4 -0
- package/src/server/lib/harness/acp/acp-audit.server.ts +107 -0
- package/src/server/lib/harness/acp/acp-goal-driver.server.ts +153 -0
- package/src/server/lib/harness/acp/acp-goal-state.server.ts +136 -0
- package/src/server/lib/harness/acp/acp-goal.server.ts +273 -0
- package/src/server/lib/harness/acp/acp-goal.test.ts +229 -0
- package/src/server/lib/harness/acp/acp-telemetry.server.ts +133 -0
- package/src/server/lib/harness/acp/acp-telemetry.test.ts +85 -0
- package/src/server/lib/harness/acp/acp-todos.server.ts +45 -0
- package/src/server/lib/harness/acp/acp-todos.test.ts +43 -0
- package/src/server/lib/harness/acp/activation.test.ts +81 -0
- package/src/server/lib/harness/acp/activation.ts +72 -0
- package/src/server/lib/harness/acp/calls.ts +97 -0
- package/src/server/lib/harness/acp/client.test.ts +73 -0
- package/src/server/lib/harness/acp/client.ts +339 -0
- package/src/server/lib/harness/acp/commands.test.ts +92 -0
- package/src/server/lib/harness/acp/commands.ts +165 -0
- package/src/server/lib/harness/acp/frames.test.ts +315 -0
- package/src/server/lib/harness/acp/frames.ts +349 -0
- package/src/server/lib/harness/acp/mapper.ts +204 -0
- package/src/server/lib/harness/acp/permissions.test.ts +66 -0
- package/src/server/lib/harness/acp/permissions.ts +155 -0
- package/src/server/lib/harness/acp/prompt.test.ts +130 -0
- package/src/server/lib/harness/acp/prompt.ts +134 -0
- package/src/server/lib/harness/acp/protocol.ts +162 -0
- package/src/server/lib/harness/acp/session-config.test.ts +73 -0
- package/src/server/lib/harness/acp/session-config.ts +148 -0
- package/src/server/lib/harness/acp/session-facts.ts +71 -0
- package/src/server/lib/harness/acp/session-handshake.ts +89 -0
- package/src/server/lib/harness/acp/session-idle.ts +51 -0
- package/src/server/lib/harness/acp/session-notifications.ts +95 -0
- package/src/server/lib/harness/acp/session-observers.test.ts +193 -0
- package/src/server/lib/harness/acp/session-options.ts +33 -0
- package/src/server/lib/harness/acp/session-permissions.test.ts +105 -0
- package/src/server/lib/harness/acp/session-permissions.ts +74 -0
- package/src/server/lib/harness/acp/session-reaper.test.ts +96 -0
- package/src/server/lib/harness/acp/session-turns.ts +95 -0
- package/src/server/lib/harness/acp/session-usage.ts +60 -0
- package/src/server/lib/harness/acp/session-web-state.ts +61 -0
- package/src/server/lib/harness/acp/session.test-util.ts +160 -0
- package/src/server/lib/harness/acp/session.test.ts +233 -0
- package/src/server/lib/harness/acp/session.ts +350 -0
- package/src/server/lib/harness/acp/turn.ts +199 -0
- package/src/server/lib/harness/acp/verbs.ts +87 -0
- package/src/server/lib/harness/auto-probe.server.test.ts +121 -0
- package/src/server/lib/harness/auto-probe.server.ts +178 -0
- package/src/server/lib/harness/capabilities.ts +67 -0
- package/src/server/lib/harness/config-invalidation.test.ts +91 -0
- package/src/server/lib/harness/config.server.test.ts +105 -0
- package/src/server/lib/harness/config.server.ts +98 -0
- package/src/server/lib/harness/enabled.server.test.ts +87 -0
- package/src/server/lib/harness/enabled.server.ts +61 -0
- package/src/server/lib/harness/launch-table.ts +195 -0
- package/src/server/lib/harness/launch.test.ts +220 -0
- package/src/server/lib/harness/launch.ts +216 -0
- package/src/server/lib/harness/probe-cache.server.test.ts +154 -0
- package/src/server/lib/harness/probe-cache.server.ts +177 -0
- package/src/server/lib/harness/provider-entry.ts +212 -0
- package/src/server/lib/harness/provider-file.server.ts +67 -0
- package/src/server/lib/harness/provider-import.test.ts +191 -0
- package/src/server/lib/harness/provider-probe.server.ts +123 -0
- package/src/server/lib/harness/provider-sources.server.test.ts +45 -0
- package/src/server/lib/harness/provider-sources.server.ts +308 -0
- package/src/server/lib/harness/provider-write-error.ts +19 -0
- package/src/server/lib/harness/provider-write.server.test.ts +308 -0
- package/src/server/lib/harness/provider-write.server.ts +339 -0
- package/src/server/lib/harness/provider-zcode.server.test.ts +270 -0
- package/src/server/lib/harness/provider-zcode.server.ts +324 -0
- package/src/server/lib/harness/register.server.ts +36 -0
- package/src/server/lib/harness/registry.ts +58 -0
- package/src/server/lib/harness/schema.server.ts +129 -0
- package/src/server/lib/harness/session-store.server.test.ts +175 -0
- package/src/server/lib/harness/session-store.server.ts +206 -0
- package/src/server/lib/harness/session-title.server.test.ts +109 -0
- package/src/server/lib/harness/session-title.server.ts +70 -0
- package/src/server/lib/harness/session.ts +74 -0
- package/src/server/lib/harness/spawn.server.ts +133 -0
- package/src/server/lib/harness/update-state.server.ts +185 -0
- package/src/server/lib/lifecycle/after-listen.ts +7 -0
- package/src/server/lib/models/provider-items.server.ts +1 -1
- package/src/server/lib/models/registry-refresh.server.test.ts +87 -0
- package/src/server/lib/models/registry-refresh.server.ts +98 -0
- package/src/server/lib/omp/config/models-config.ts +4 -0
- package/src/server/lib/omp/core/cli.ts +13 -0
- package/src/server/lib/omp/core/host-resolution.test.ts +6 -3
- package/src/server/lib/omp/rpc/child-config.ts +5 -4
- package/src/server/lib/omp/rpc/constants.test.ts +2 -1
- package/src/server/lib/omp/rpc/event-fanout.ts +9 -0
- package/src/server/lib/omp/rpc/forked-resume.test.ts +14 -3
- package/src/server/lib/omp/rpc/rpc-primitives.test.ts +11 -0
- package/src/server/lib/omp/rpc/session-registration.ts +7 -2
- package/src/server/lib/omp/rpc/session-registry.test.ts +2 -1
- package/src/server/lib/omp/rpc/session-registry.ts +74 -5
- package/src/server/lib/omp/session/acp-rows.server.ts +79 -0
- package/src/server/lib/omp/session/delete-flow.server.ts +15 -8
- package/src/server/lib/omp/session/delete.server.ts +12 -0
- package/src/server/lib/omp/session/sidebar-data.harness.test.ts +247 -0
- package/src/server/lib/omp/session/sidebar-data.server.ts +56 -3
- package/src/server/lib/queue/delivery.server.test.ts +4 -2
- package/src/server/lib/queue/payload.test.ts +67 -0
- package/src/server/lib/queue/payload.ts +9 -3
- package/src/server/lib/realtime/signals.server.test.ts +99 -0
- package/src/server/lib/realtime/signals.server.ts +25 -5
- package/src/server/lib/realtime/topics/session-data.server.ts +29 -0
- package/src/server/lib/realtime/topics/session.server.ts +3 -3
- package/src/server/routes/agent/command-resume.test.ts +77 -0
- package/src/server/routes/agent/command.test.ts +243 -2
- package/src/server/routes/agent/command.ts +78 -15
- package/src/server/routes/agent/harness-command.ts +133 -0
- package/src/server/routes/agent/new.ts +63 -1
- package/src/server/routes/chat/rewind.test.ts +147 -0
- package/src/server/routes/chat/rewind.ts +29 -7
- package/src/server/routes/chat/session.test.ts +240 -0
- package/src/server/routes/chat/session.ts +96 -4
- package/src/server/routes/harness/add-provider.test.ts +233 -0
- package/src/server/routes/harness/import-action.ts +272 -0
- package/src/server/routes/harness/import.test.ts +196 -0
- package/src/server/routes/harness/index.ts +13 -0
- package/src/server/routes/harness/root.ts +280 -0
- package/src/server/routes/harness/toggle.test.ts +127 -0
- package/src/server/routes/harness/update.ts +259 -0
- package/src/server/routes/harness/versions.test.ts +148 -0
- package/src/server/routes/harness/versions.ts +105 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/sessions/delete-acp.test.ts +227 -0
- package/src/server/routes/sessions/queue.ts +7 -2
- package/src/server/routes/sessions/routes-queue.test.ts +52 -0
- package/src/server/routes/sessions/routes.test.ts +47 -13
- package/src/server/routes/sessions/session.ts +35 -0
- package/src/server/routes/settings/commands-harness.test.ts +92 -0
- package/src/server/routes/settings/commands.ts +26 -0
- package/src/server/routes/settings/model-override.ts +5 -2
- package/src/server/routes/settings/provider-entry.ts +2 -2
- package/src/server/routes/settings/provider-model.ts +2 -2
- package/src/server/routes/settings/provider-models.ts +2 -2
- package/src/server/routes/settings/provider-refresh.ts +6 -4
- package/src/server/routes/settings/providers.ts +3 -1
- package/src/server/routes/settings/settings-config-routes.test.ts +10 -2
- package/src/server/routes/settings/skills.ts +12 -0
- package/src/shared/lib/chat/ask-form/fields.ts +76 -0
- package/src/shared/lib/chat/ask-form/index.ts +323 -0
- package/src/shared/lib/chat/ask-form/tokens.ts +199 -0
- package/src/shared/lib/chat/ask-form/types.ts +43 -0
- package/src/shared/lib/chat/ask-form.test.ts +137 -0
- package/src/shared/lib/chat/ask-questions.test.ts +65 -1
- package/src/shared/lib/chat/ask-questions.ts +51 -145
- package/src/shared/lib/chat/ask-results.ts +198 -0
- package/src/shared/lib/chat/composer/client.ts +20 -8
- package/src/shared/lib/chat/context/usage.test.ts +8 -4
- package/src/shared/lib/chat/context/usage.ts +17 -3
- package/src/shared/lib/chat/omp/abort.test.ts +61 -0
- package/src/shared/lib/chat/omp/abort.ts +8 -2
- package/src/shared/lib/chat/omp/tool-frames.test.ts +23 -0
- package/src/shared/lib/chat/omp/tool-frames.ts +12 -2
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +13 -1
- package/src/shared/lib/chat/timeline/prompt-error.test.ts +146 -0
- package/src/shared/lib/chat/timeline/prompt-error.ts +88 -0
- package/src/shared/lib/chat/tool/summary-wait.test.ts +18 -8
- package/src/shared/lib/chat/tool/wait-facts.ts +14 -8
- package/src/shared/lib/harness/brand-color.test.ts +66 -0
- package/src/shared/lib/harness/brand-color.ts +96 -0
- package/src/shared/lib/harness/catalog.test.ts +88 -0
- package/src/shared/lib/harness/catalog.ts +169 -0
- package/src/shared/lib/harness/config-fields.test.ts +139 -0
- package/src/shared/lib/harness/config-fields.ts +168 -0
- package/src/shared/lib/harness/config.test.ts +153 -0
- package/src/shared/lib/harness/config.ts +206 -0
- package/src/shared/lib/harness/dialects.test.ts +140 -0
- package/src/shared/lib/harness/dialects.ts +249 -0
- package/src/shared/lib/harness/enabled.test.ts +79 -0
- package/src/shared/lib/harness/enabled.ts +72 -0
- package/src/shared/lib/harness/menu.test.ts +94 -0
- package/src/shared/lib/harness/menu.ts +88 -0
- package/src/shared/lib/harness/provider-facts.test.ts +199 -0
- package/src/shared/lib/harness/provider-facts.ts +349 -0
- package/src/shared/lib/harness/provider-slug.ts +46 -0
- package/src/shared/lib/harness/providers.ts +175 -0
- package/src/shared/lib/harness/rewind.ts +24 -0
- package/src/shared/lib/harness/status.test.ts +158 -0
- package/src/shared/lib/harness/status.ts +112 -0
- package/src/shared/lib/harness/update-plan.test.ts +163 -0
- package/src/shared/lib/harness/update-plan.ts +140 -0
- package/src/shared/lib/harness/updates.test.ts +106 -0
- package/src/shared/lib/harness/updates.ts +177 -0
- package/src/shared/lib/icons/icon-paint-authority.test.ts +16 -4
- package/src/shared/lib/icons/icon-paint-authority.ts +57 -12
- package/src/shared/lib/icons/icon-paint-bucket.test.ts +84 -0
- package/src/shared/lib/icons/icon-paint-css.test.ts +23 -25
- package/src/shared/lib/icons/icon-paint-css.ts +69 -55
- package/src/shared/lib/icons/icon-paint-harness.test.ts +73 -0
- package/src/shared/lib/icons/icon-paint-harness.ts +75 -0
- package/src/shared/lib/icons/icon-paint-ink.ts +108 -0
- package/src/shared/lib/icons/icon-paint-panel.ts +19 -4
- package/src/shared/lib/icons/icon-paint-weight.ts +21 -2
- package/src/shared/lib/icons/icon-tone.ts +118 -21
- package/src/shared/lib/icons/tint-hues.generated.ts +100 -284
- package/src/shared/lib/icons/tint-tones.test.ts +79 -25
- package/src/shared/lib/icons/tint.ts +66 -6
- package/src/shared/lib/models/client.ts +10 -1
- package/src/shared/lib/models/provider/vendors.ts +72 -0
- package/src/shared/lib/omp/config/schema.test.ts +36 -0
- package/src/shared/lib/omp/dialog-methods.ts +4 -3
- package/src/shared/lib/omp/session/messages-map-trace.test.ts +42 -0
- package/src/shared/lib/omp/session/messages-map.ts +6 -1
- package/src/shared/lib/omp/session/parse-message-blocks-toolcall.test.ts +8 -0
- package/src/shared/lib/omp/session/parse-message-blocks.ts +6 -1
- package/src/shared/lib/omp/session/shell-trace.test.ts +69 -0
- package/src/shared/lib/omp/session/shell-trace.ts +63 -0
- package/src/shared/lib/omp/session/sidebar.ts +37 -10
- package/src/shared/lib/omp/session/wait-idle.test.ts +47 -0
- package/src/shared/lib/omp/session/wait-idle.ts +93 -0
- package/src/shared/lib/omp/session/wait.test.ts +34 -33
- package/src/shared/lib/omp/session/wait.ts +25 -39
- package/src/shared/lib/settings/sections.ts +24 -0
- package/src/shared/lib/theme/css.ts +2 -0
- package/src/shared/lib/theme/ink-scale.ts +21 -1
- package/src/shared/lib/theme/theme.test.ts +25 -9
- package/src/shared/lib/ui/safe-area.test.ts +28 -0
- package/src/shared/lib/ui/safe-area.ts +42 -0
- package/src/shared/lib/ui/toast-duration.test.ts +74 -0
- package/src/shared/lib/ui/toast-duration.ts +70 -0
- package/src/shared/types/harness-version.ts +59 -0
- package/src/shared/types/harness.ts +201 -0
- package/src/shared/types/index.ts +2 -0
- package/src/shared/types/omp/agent.ts +13 -0
- package/src/shared/types/settings/state.ts +10 -1
- package/src/shared/types/workspace.ts +10 -0
- package/src/test-support/env.ts +38 -0
- package/src/test-support/file-explorer-render.test-util.ts +37 -0
- package/src/test-support/file-explorer.test-util.ts +20 -18
- package/src/test-support/harness-table.test-util.ts +108 -0
- package/dist/client/static/js/index-7ppta1pb.css +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The toast queue: one page-level list, deduplicated, bounded, and with a delay
|
|
8
|
+
* resolved once at push time.
|
|
9
|
+
*
|
|
10
|
+
* The bugs these cases pin:
|
|
11
|
+
*
|
|
12
|
+
* - Every host used to own a private array, so two surfaces raising a toast at
|
|
13
|
+
* the same moment printed two cards in the same corner. The queue is module
|
|
14
|
+
* state now, and `getToastsSnapshot` is the single source.
|
|
15
|
+
* - The same sentence pushed twice stacked two identical cards. It replaces.
|
|
16
|
+
* - The list grew without limit; a loop of failures became a wall. Three.
|
|
17
|
+
* - A duration the caller never asked for was a flat 4000; the policy decides
|
|
18
|
+
* and the resolved number rides on the entry, so every renderer agrees.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
22
|
+
import {
|
|
23
|
+
dismissToast,
|
|
24
|
+
getToastsSnapshot,
|
|
25
|
+
pushToast,
|
|
26
|
+
resetToasts,
|
|
27
|
+
subscribeToasts,
|
|
28
|
+
} from '@/client/hooks/ui/toasts';
|
|
29
|
+
import { toastDurationMs } from '@/shared/lib/ui/toast-duration';
|
|
30
|
+
|
|
31
|
+
afterEach(() => resetToasts());
|
|
32
|
+
|
|
33
|
+
describe('toast queue', () => {
|
|
34
|
+
test('pushes in order with monotonically increasing ids', () => {
|
|
35
|
+
pushToast('first', 'success');
|
|
36
|
+
pushToast('second', 'error');
|
|
37
|
+
const queue = getToastsSnapshot();
|
|
38
|
+
expect(queue.map((toast) => [toast.message, toast.type])).toEqual([
|
|
39
|
+
['first', 'success'],
|
|
40
|
+
['second', 'error'],
|
|
41
|
+
]);
|
|
42
|
+
expect(queue[1]!.id).toBeGreaterThan(queue[0]!.id);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('defaults to an error tone', () => {
|
|
46
|
+
pushToast('something broke');
|
|
47
|
+
expect(getToastsSnapshot()[0]!.type).toBe('error');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('the delay is resolved at push and matches the policy', () => {
|
|
51
|
+
pushToast('Saved', 'success');
|
|
52
|
+
expect(getToastsSnapshot()[0]!.duration).toBe(toastDurationMs({ tone: 'success', message: 'Saved' }));
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('an empty message is refused rather than drawn as a blank card', () => {
|
|
56
|
+
pushToast(' ');
|
|
57
|
+
expect(getToastsSnapshot()).toHaveLength(0);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('a repeated sentence replaces its own card instead of stacking a copy', () => {
|
|
61
|
+
pushToast('Provider list refreshed', 'success');
|
|
62
|
+
const [first] = getToastsSnapshot();
|
|
63
|
+
pushToast('Provider list refreshed', 'success');
|
|
64
|
+
const queue = getToastsSnapshot();
|
|
65
|
+
expect(queue).toHaveLength(1);
|
|
66
|
+
expect(queue[0]!.id).toBeGreaterThan(first!.id);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('the same words in a different tone are two different messages', () => {
|
|
70
|
+
pushToast('Check the log', 'success');
|
|
71
|
+
pushToast('Check the log', 'error');
|
|
72
|
+
expect(getToastsSnapshot()).toHaveLength(2);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('a toast carrying an action is never replaced by a plain repeat', () => {
|
|
76
|
+
const action = { label: 'Send now', onClick: () => {} };
|
|
77
|
+
pushToast('Stopped.', 'success', { action });
|
|
78
|
+
pushToast('Stopped.', 'success');
|
|
79
|
+
expect(getToastsSnapshot()).toHaveLength(2);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('an action toast waits for the decision', () => {
|
|
83
|
+
pushToast('Stopped.', 'success', { action: { label: 'Send now', onClick: () => {} } });
|
|
84
|
+
expect(getToastsSnapshot()[0]!.duration).toBeNull();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('the list is bounded: the oldest card falls off', () => {
|
|
88
|
+
for (let i = 0; i < 6; i += 1) pushToast(`message ${i}`, 'success');
|
|
89
|
+
expect(getToastsSnapshot().map((toast) => toast.message)).toEqual([
|
|
90
|
+
'message 3',
|
|
91
|
+
'message 4',
|
|
92
|
+
'message 5',
|
|
93
|
+
]);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('dismiss removes only the matching id and keeps the rest in order', () => {
|
|
97
|
+
pushToast('a', 'success');
|
|
98
|
+
pushToast('b', 'success');
|
|
99
|
+
pushToast('c', 'success');
|
|
100
|
+
const middle = getToastsSnapshot()[1]!.id;
|
|
101
|
+
dismissToast(middle);
|
|
102
|
+
expect(getToastsSnapshot().map((toast) => toast.message)).toEqual(['a', 'c']);
|
|
103
|
+
|
|
104
|
+
// An id that is not present is a no-op, not a wipe.
|
|
105
|
+
dismissToast(9_999_999);
|
|
106
|
+
expect(getToastsSnapshot().map((toast) => toast.message)).toEqual(['a', 'c']);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test('a subscriber hears every real change and nothing else', () => {
|
|
110
|
+
let changes = 0;
|
|
111
|
+
const unsubscribe = subscribeToasts(() => { changes += 1; });
|
|
112
|
+
|
|
113
|
+
pushToast('a', 'success');
|
|
114
|
+
expect(changes).toBe(1);
|
|
115
|
+
|
|
116
|
+
pushToast('a', 'success'); // replace is still a change
|
|
117
|
+
expect(changes).toBe(2);
|
|
118
|
+
|
|
119
|
+
dismissToast(9_999_999); // absent id: no change
|
|
120
|
+
expect(changes).toBe(2);
|
|
121
|
+
|
|
122
|
+
unsubscribe();
|
|
123
|
+
pushToast('b', 'success');
|
|
124
|
+
expect(changes).toBe(2);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
@@ -1,40 +1,145 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The toast queue.
|
|
8
|
+
*
|
|
9
|
+
* ## One queue for the page, not one per host
|
|
10
|
+
*
|
|
11
|
+
* Every surface that could raise a toast used to own a private array and render
|
|
12
|
+
* its own `ToastStack`: the desktop layout, its left column, the chat timeline,
|
|
13
|
+
* the sources panel, the file explorer, four settings panes and both phone
|
|
14
|
+
* shells. Each stack is `fixed bottom-4 right-4`, so two hosts raising a toast at
|
|
15
|
+
* the same time printed two cards in exactly the same place — on the desktop the
|
|
16
|
+
* chat timeline, the left column and the layout are all mounted at once.
|
|
17
|
+
*
|
|
18
|
+
* The queue is therefore module state and there is exactly ONE host
|
|
19
|
+
* (`ToastStack`, mounted by `App`). A host pushes; the single host renders.
|
|
20
|
+
*
|
|
21
|
+
* ## The delay is resolved once, at push
|
|
22
|
+
*
|
|
23
|
+
* `toastDurationMs` decides how long a card lives from its tone and its message
|
|
24
|
+
* length — see `shared/lib/ui/toast-duration.ts` for the measured reason. Keeping
|
|
25
|
+
* the resolution here means every renderer of the same toast draws the same
|
|
26
|
+
* number, and there is one place a caller can override it.
|
|
27
|
+
*
|
|
28
|
+
* ## A repeated sentence is not a second card
|
|
29
|
+
*
|
|
30
|
+
* "Provider list refreshed" on two clicks within a second, or an editor error
|
|
31
|
+
* reported by two plugins, would otherwise stack identical cards. A push whose
|
|
32
|
+
* message and tone already sit in the queue replaces that entry (new id, so its
|
|
33
|
+
* timer starts again) rather than adding a copy beside it.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
import { useEffect, useState } from 'preact/hooks';
|
|
2
37
|
import type { ToastData } from '@/client/components/common/Toast';
|
|
38
|
+
import { toastDurationMs, type ToastTone } from '@/shared/lib/ui/toast-duration';
|
|
3
39
|
import { useEditorErrorToast } from '@/client/hooks/ui/editor-error-toast';
|
|
4
40
|
|
|
5
|
-
/**
|
|
41
|
+
/** How many cards may share the corner. Older ones fall off the top. */
|
|
42
|
+
const MAX_VISIBLE_TOASTS = 3;
|
|
43
|
+
|
|
44
|
+
export interface PushToastOptions {
|
|
45
|
+
action?: ToastData['action'];
|
|
46
|
+
/** Auto-dismiss delay in ms; `null` waits for the user. Absent = the policy decides. */
|
|
47
|
+
duration?: number | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
6
50
|
export interface ToastsHandle {
|
|
7
|
-
|
|
8
|
-
pushToast: (
|
|
9
|
-
|
|
10
|
-
type?: 'success' | 'error',
|
|
11
|
-
options?: { action?: ToastData['action']; duration?: number },
|
|
12
|
-
) => void;
|
|
51
|
+
/** Raise a toast. Stable across renders, so it is safe in an effect's deps. */
|
|
52
|
+
pushToast: (message: string, type?: ToastTone, options?: PushToastOptions) => void;
|
|
53
|
+
/** Drop one toast now, without waiting for its timer. */
|
|
13
54
|
dismissToast: (id: number) => void;
|
|
14
55
|
}
|
|
15
56
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const pushToast = (
|
|
21
|
-
message: string,
|
|
22
|
-
type: 'success' | 'error' = 'error',
|
|
23
|
-
options?: { action?: ToastData['action']; duration?: number },
|
|
24
|
-
) => {
|
|
25
|
-
toastIdRef.current += 1;
|
|
26
|
-
setToasts(prev => [...prev, { id: toastIdRef.current, message, type, ...options }]);
|
|
27
|
-
};
|
|
57
|
+
let nextId = 1;
|
|
58
|
+
let queue: ToastData[] = [];
|
|
59
|
+
const listeners = new Set<() => void>();
|
|
28
60
|
|
|
29
|
-
|
|
30
|
-
|
|
61
|
+
function emit(): void {
|
|
62
|
+
for (const listener of [...listeners]) listener();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function pushToast(
|
|
66
|
+
message: string,
|
|
67
|
+
type: ToastTone = 'error',
|
|
68
|
+
options: PushToastOptions = {},
|
|
69
|
+
): void {
|
|
70
|
+
const text = message.trim();
|
|
71
|
+
// An empty card is noise with no content; a call site that computed an empty
|
|
72
|
+
// sentence is already a bug and should not be given a blank rectangle.
|
|
73
|
+
if (!text) return;
|
|
74
|
+
const duration = toastDurationMs({
|
|
75
|
+
tone: type,
|
|
76
|
+
message: text,
|
|
77
|
+
explicit: options.duration,
|
|
78
|
+
sticky: Boolean(options.action),
|
|
79
|
+
});
|
|
80
|
+
const entry: ToastData = {
|
|
81
|
+
id: nextId,
|
|
82
|
+
message: text,
|
|
83
|
+
type,
|
|
84
|
+
duration,
|
|
85
|
+
...(options.action ? { action: options.action } : {}),
|
|
31
86
|
};
|
|
87
|
+
nextId += 1;
|
|
88
|
+
const rest = queue.filter(
|
|
89
|
+
(toast) => !(toast.message === text && toast.type === type && !toast.action && !entry.action),
|
|
90
|
+
);
|
|
91
|
+
queue = [...rest, entry].slice(-MAX_VISIBLE_TOASTS);
|
|
92
|
+
emit();
|
|
93
|
+
}
|
|
32
94
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
95
|
+
export function dismissToast(id: number): void {
|
|
96
|
+
const next = queue.filter((toast) => toast.id !== id);
|
|
97
|
+
if (next.length === queue.length) return;
|
|
98
|
+
queue = next;
|
|
99
|
+
emit();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function subscribeToasts(listener: () => void): () => void {
|
|
103
|
+
listeners.add(listener);
|
|
104
|
+
return () => listeners.delete(listener);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** The current queue. A new array on every change, so identity means "changed". */
|
|
108
|
+
export function getToastsSnapshot(): ToastData[] {
|
|
109
|
+
return queue;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Drop every toast. Test seam; nothing in the app calls it. */
|
|
113
|
+
export function resetToasts(): void {
|
|
114
|
+
if (queue.length === 0) return;
|
|
115
|
+
queue = [];
|
|
116
|
+
emit();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The push half, and the editor-error listener every host already relied on.
|
|
121
|
+
*
|
|
122
|
+
* Deliberately does NOT subscribe to the queue: this is called from big trees
|
|
123
|
+
* (the chat timeline renders on every streamed frame) and re-rendering one of
|
|
124
|
+
* them because a toast appeared is a cost with no output. The single host reads
|
|
125
|
+
* the queue through `useToastQueue`.
|
|
126
|
+
*/
|
|
127
|
+
export function useToasts(): ToastsHandle {
|
|
128
|
+
// Every surface that can raise a toast calls this hook — both shells, the
|
|
129
|
+
// sidebar, the settings panes — so subscribing here is what makes an editor
|
|
130
|
+
// exception impossible to miss by forgetting one call site. A CodeMirror
|
|
131
|
+
// plugin that throws is caught by the library and would otherwise reach only
|
|
132
|
+
// the console.
|
|
37
133
|
useEditorErrorToast(pushToast);
|
|
134
|
+
return { pushToast, dismissToast };
|
|
135
|
+
}
|
|
38
136
|
|
|
39
|
-
|
|
137
|
+
/** The render half: the queue, re-read on every change. Used by `ToastStack` only. */
|
|
138
|
+
export function useToastQueue(): ToastData[] {
|
|
139
|
+
const [toasts, setToasts] = useState<ToastData[]>(getToastsSnapshot);
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
setToasts(getToastsSnapshot());
|
|
142
|
+
return subscribeToasts(() => setToasts(getToastsSnapshot()));
|
|
143
|
+
}, []);
|
|
144
|
+
return toasts;
|
|
40
145
|
}
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The short-lived feedback flags: the copy confirmation
|
|
8
|
-
* size
|
|
7
|
+
* The short-lived feedback flags: the copy confirmation and the "show more" page
|
|
8
|
+
* size. The toast queue has its own suite (`toast-queue.test.ts`).
|
|
9
9
|
*
|
|
10
10
|
* Each case pins a stale flag. The copy confirmation restarts a timer on a
|
|
11
11
|
* repeat trigger — without the clearTimeout the first timer still fires and the
|
|
12
12
|
* check mark disappears while the user is copying the next item. "Show more"
|
|
13
13
|
* must keep counting past the list length (the hook has no total to clamp
|
|
14
|
-
* against; callers slice)
|
|
15
|
-
* again or the renderer reuses the key of the row it just removed.
|
|
14
|
+
* against; callers slice).
|
|
16
15
|
*
|
|
17
16
|
* Mounted with `h()` against happy-dom, the same way the other hook tests do.
|
|
18
17
|
* The overlay-scrollbar fade lives in `lib/scrollbar-activity.test.ts`.
|
|
@@ -23,11 +22,9 @@ import { Window } from 'happy-dom';
|
|
|
23
22
|
import { h, render } from 'preact';
|
|
24
23
|
import { act } from 'preact/test-utils';
|
|
25
24
|
|
|
26
|
-
import type { ToastData } from '@/client/components/common/Toast';
|
|
27
25
|
import { useCopyFlag } from '@/client/hooks/ui/copy-flag';
|
|
28
26
|
import { useShowMore } from '@/client/hooks/ui/show-more';
|
|
29
27
|
import type { ShowMore } from '@/client/hooks/ui/show-more';
|
|
30
|
-
import { useToasts } from '@/client/hooks/ui/toasts';
|
|
31
28
|
|
|
32
29
|
const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'Event', 'CustomEvent'] as const;
|
|
33
30
|
/** The runner's own globals, restored on teardown (see the matching afterAll at the end of this file) so later files still see native Event/CustomEvent/window. */
|
|
@@ -57,22 +54,12 @@ function mount(vnode: Parameters<typeof render>[0]) {
|
|
|
57
54
|
});
|
|
58
55
|
}
|
|
59
56
|
|
|
60
|
-
/** The return
|
|
57
|
+
/** The return contract of the hook here that exports no named type. */
|
|
61
58
|
interface CopyFlagApi {
|
|
62
59
|
copied: boolean;
|
|
63
60
|
flagCopied: () => void;
|
|
64
61
|
}
|
|
65
62
|
|
|
66
|
-
interface ToastsApi {
|
|
67
|
-
toasts: ToastData[];
|
|
68
|
-
pushToast: (
|
|
69
|
-
message: string,
|
|
70
|
-
type?: 'success' | 'error',
|
|
71
|
-
options?: { action?: ToastData['action']; duration?: number },
|
|
72
|
-
) => void;
|
|
73
|
-
dismissToast: (id: number) => void;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
63
|
function CopyProbe({ resetMs, seen }: { resetMs: number; seen: { current: CopyFlagApi | null } }) {
|
|
77
64
|
seen.current = useCopyFlag(resetMs);
|
|
78
65
|
return h('span', null, seen.current.copied ? 'copied' : 'idle');
|
|
@@ -220,80 +207,6 @@ describe('useShowMore', () => {
|
|
|
220
207
|
});
|
|
221
208
|
});
|
|
222
209
|
|
|
223
|
-
function ToastProbe({ seen }: { seen: { current: ToastsApi | null } }) {
|
|
224
|
-
seen.current = useToasts();
|
|
225
|
-
return h('span', null, String(seen.current.toasts.length));
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
describe('useToasts', () => {
|
|
229
|
-
test('pushes in order with monotonically increasing ids', () => {
|
|
230
|
-
const seen: { current: ToastsApi | null } = { current: null };
|
|
231
|
-
mount(h(ToastProbe, { seen }));
|
|
232
|
-
|
|
233
|
-
act(() => {
|
|
234
|
-
seen.current!.pushToast('first');
|
|
235
|
-
seen.current!.pushToast('second');
|
|
236
|
-
});
|
|
237
|
-
expect(seen.current!.toasts.map((t) => [t.id, t.message, t.type])).toEqual([
|
|
238
|
-
[1, 'first', 'error'],
|
|
239
|
-
[2, 'second', 'error'],
|
|
240
|
-
]);
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
test('defaults to an error toast and carries the options through', () => {
|
|
244
|
-
const seen: { current: ToastsApi | null } = { current: null };
|
|
245
|
-
mount(h(ToastProbe, { seen }));
|
|
246
|
-
const action = { label: 'Send now', onClick: () => {} };
|
|
247
|
-
|
|
248
|
-
act(() => {
|
|
249
|
-
seen.current!.pushToast('failed', 'error', { action, duration: 250 });
|
|
250
|
-
seen.current!.pushToast('done', 'success');
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
const [failed, done] = seen.current!.toasts;
|
|
254
|
-
expect(failed.action).toBe(action);
|
|
255
|
-
expect(failed.duration).toBe(250);
|
|
256
|
-
expect(done.type).toBe('success');
|
|
257
|
-
expect(done.action).toBeUndefined();
|
|
258
|
-
expect(done.duration).toBeUndefined();
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
test('dismiss removes only the matching id and keeps the rest in order', () => {
|
|
262
|
-
const seen: { current: ToastsApi | null } = { current: null };
|
|
263
|
-
mount(h(ToastProbe, { seen }));
|
|
264
|
-
|
|
265
|
-
act(() => {
|
|
266
|
-
seen.current!.pushToast('a');
|
|
267
|
-
seen.current!.pushToast('b');
|
|
268
|
-
seen.current!.pushToast('c');
|
|
269
|
-
});
|
|
270
|
-
act(() => seen.current!.dismissToast(2));
|
|
271
|
-
expect(seen.current!.toasts.map((t) => t.message)).toEqual(['a', 'c']);
|
|
272
|
-
|
|
273
|
-
// An id that is not present is a no-op, not a wipe.
|
|
274
|
-
act(() => seen.current!.dismissToast(99));
|
|
275
|
-
expect(seen.current!.toasts.map((t) => t.message)).toEqual(['a', 'c']);
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
test('never reuses a dismissed id', () => {
|
|
279
|
-
const seen: { current: ToastsApi | null } = { current: null };
|
|
280
|
-
mount(h(ToastProbe, { seen }));
|
|
281
|
-
|
|
282
|
-
act(() => {
|
|
283
|
-
seen.current!.pushToast('a');
|
|
284
|
-
seen.current!.pushToast('b');
|
|
285
|
-
});
|
|
286
|
-
act(() => {
|
|
287
|
-
seen.current!.dismissToast(2);
|
|
288
|
-
seen.current!.pushToast('c');
|
|
289
|
-
});
|
|
290
|
-
expect(seen.current!.toasts.map((t) => [t.id, t.message])).toEqual([
|
|
291
|
-
[1, 'a'],
|
|
292
|
-
[3, 'c'],
|
|
293
|
-
]);
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
|
|
297
210
|
afterAll(() => {
|
|
298
211
|
const target = globalThis as unknown as Record<string, unknown>;
|
|
299
212
|
for (const key of DOM_GLOBALS) {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The chrome-row density: one box, one gap, every row.
|
|
8
|
+
*
|
|
9
|
+
* This module exists because the navbar stated its own numbers and drifted from
|
|
10
|
+
* the sidebar's action row — measured, the phone header's glyphs sat 48px apart
|
|
11
|
+
* against the drawer's 38px, and the header read as controls floating apart.
|
|
12
|
+
* The assertions below are the contract that drift has to break to come back:
|
|
13
|
+
* the box is a fixed square (not padding, which makes the pitch depend on the
|
|
14
|
+
* glyph's own width), the mobile box is the drawer's 36px rather than the
|
|
15
|
+
* standalone 44px touch floor, and both rows take the same gap.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { describe, expect, test } from 'bun:test';
|
|
19
|
+
import {
|
|
20
|
+
CONTROL_BOX,
|
|
21
|
+
CONTROL_CLUSTER_GAP,
|
|
22
|
+
CONTROL_GLYPH_PX,
|
|
23
|
+
CONTROL_ROW_GAP,
|
|
24
|
+
type ControlLayout,
|
|
25
|
+
} from '@/client/lib/ui/control-plate';
|
|
26
|
+
|
|
27
|
+
/** The px a Tailwind `w-7`-style class resolves to: the scale step is 4px. */
|
|
28
|
+
const px = (token: string, axis: 'w' | 'h'): number => {
|
|
29
|
+
const match = new RegExp(`\\b${axis}-(\\d+(?:\\.\\d+)?)\\b`).exec(token);
|
|
30
|
+
if (!match) throw new Error(`no ${axis} in "${token}"`);
|
|
31
|
+
return Number(match[1]) * 4;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const GAPS = { 'gap-0.5': 2, 'gap-1': 4 } as const;
|
|
35
|
+
|
|
36
|
+
describe('control plate', () => {
|
|
37
|
+
test('the box is a fixed square on both layouts', () => {
|
|
38
|
+
// Padding would make the pitch depend on the glyph: a 16px icon in a 36px
|
|
39
|
+
// box is the same box a 18px icon gets, which is what lets the two rows
|
|
40
|
+
// share one density.
|
|
41
|
+
for (const layout of ['desktop', 'mobile'] as ControlLayout[]) {
|
|
42
|
+
const box = CONTROL_BOX[layout];
|
|
43
|
+
expect(box).not.toContain('p-1.5');
|
|
44
|
+
expect(px(box, 'w')).toBe(px(box, 'h'));
|
|
45
|
+
}
|
|
46
|
+
expect(px(CONTROL_BOX.desktop, 'w')).toBe(28);
|
|
47
|
+
expect(px(CONTROL_BOX.mobile, 'w')).toBe(36);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('a phone box is the drawer row, not the standalone 44px floor', () => {
|
|
51
|
+
// `.tap-target` is the floor for a control that stands ALONE. A dense row
|
|
52
|
+
// takes the row density instead — and a 44px box here is the airiness this
|
|
53
|
+
// module was written to remove.
|
|
54
|
+
expect(CONTROL_BOX.mobile).not.toContain('tap-target');
|
|
55
|
+
expect(px(CONTROL_BOX.mobile, 'w')).toBeLessThan(44);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('the glyph fits inside the box with room to breathe', () => {
|
|
59
|
+
for (const layout of ['desktop', 'mobile'] as ControlLayout[]) {
|
|
60
|
+
const inset = (px(CONTROL_BOX[layout], 'w') - CONTROL_GLYPH_PX[layout]) / 2;
|
|
61
|
+
expect(inset).toBeGreaterThanOrEqual(5);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('one gap between controls, one between clusters', () => {
|
|
66
|
+
expect(GAPS[CONTROL_ROW_GAP as keyof typeof GAPS]).toBe(2);
|
|
67
|
+
expect(GAPS[CONTROL_CLUSTER_GAP as keyof typeof GAPS]).toBe(4);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('the pitch the rows now share', () => {
|
|
71
|
+
// glyph centre to glyph centre — the number a reader perceives as spacing.
|
|
72
|
+
const gap = GAPS[CONTROL_ROW_GAP as keyof typeof GAPS];
|
|
73
|
+
expect(px(CONTROL_BOX.desktop, 'w') + gap).toBe(30);
|
|
74
|
+
expect(px(CONTROL_BOX.mobile, 'w') + gap).toBe(38);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The box around an icon-only control, and the space between controls in one
|
|
8
|
+
* chrome row.
|
|
9
|
+
*
|
|
10
|
+
* These numbers are a DENSITY fact, and the row they have to agree with is the
|
|
11
|
+
* session sidebar's action row (`layout/session-sidebar/modern/ActionRow.tsx`):
|
|
12
|
+
* a 28px box at `gap-0.5` on the desktop, a 36px box at `gap-0.5` on a phone.
|
|
13
|
+
* The navbar used to state its own — `p-1.5` with `space-x-1` (4px) on the
|
|
14
|
+
* desktop, and a `.tap-target` 44px plate with 4px on the phone. Measured on
|
|
15
|
+
* the running app, the phone row's glyph pitch was 48px against the drawer
|
|
16
|
+
* row's 38px, which is the "controls floating apart" the header read as. The
|
|
17
|
+
* box is the bigger half of that: 44px around an 18px glyph is 13px of empty on
|
|
18
|
+
* each side before the gap is counted at all.
|
|
19
|
+
*
|
|
20
|
+
* Two things this module does NOT own:
|
|
21
|
+
*
|
|
22
|
+
* - **Colour, radius and hover state.** Each control states its own, because a
|
|
23
|
+
* plugin-backed readout, a toggle and a destructive control do not share one.
|
|
24
|
+
* - **The 44px touch floor** (`.tap-target` in `tailwind.css`). It still applies
|
|
25
|
+
* to controls that stand ALONE — the composer's attach/maximise, the session
|
|
26
|
+
* picker chip. It does not apply inside a dense chrome row: a 44px box in a
|
|
27
|
+
* 36px-density row IS the airiness being fixed, and overlapping hit areas to
|
|
28
|
+
* buy the floor back steal a neighbour's click (the measured reason the floor
|
|
29
|
+
* is real geometry rather than a pseudo-element).
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export type ControlLayout = 'desktop' | 'mobile';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The box the hover tint paints and the glyph is centred in. The glyph is
|
|
36
|
+
* `CONTROL_GLYPH_PX[layout]`, so the two together are what make the pitch:
|
|
37
|
+
* 28 + 2 = 30px on a desktop, 36 + 2 = 38px on a phone.
|
|
38
|
+
*/
|
|
39
|
+
export const CONTROL_BOX: Record<ControlLayout, string> = {
|
|
40
|
+
desktop: 'w-7 h-7 inline-flex items-center justify-center',
|
|
41
|
+
mobile: 'w-9 h-9 inline-flex items-center justify-center',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Between two controls in one row — 2px, the sidebar action row's `gap-0.5`.
|
|
46
|
+
* Written as a `gap-*` because `space-x-*` puts the same margin on both sides
|
|
47
|
+
* of every child and doubles itself against a neighbouring cluster.
|
|
48
|
+
*/
|
|
49
|
+
export const CONTROL_ROW_GAP = 'gap-0.5';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Between two CLUSTERS of controls in one row — 4px, the sidebar action row's
|
|
53
|
+
* own outer `gap-1`. A row holds clusters, not only controls: a labelled chip
|
|
54
|
+
* beside a group of icon buttons is two things, and 2px would read as though it
|
|
55
|
+
* belonged to the group.
|
|
56
|
+
*/
|
|
57
|
+
export const CONTROL_CLUSTER_GAP = 'gap-1';
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The glyph the navbar centres in that box: 16px in the 28px box, 18px in the
|
|
61
|
+
* 36px one. The sidebar's action row centres a 14px glyph in the same boxes —
|
|
62
|
+
* a list row's icons read at list density — so the BOX and the gap are what the
|
|
63
|
+
* two surfaces share, not the glyph.
|
|
64
|
+
*/
|
|
65
|
+
export const CONTROL_GLYPH_PX: Record<ControlLayout, number> = { desktop: 16, mobile: 18 };
|
package/src/client/tailwind.css
CHANGED
|
@@ -66,6 +66,15 @@
|
|
|
66
66
|
--color-warning: var(--theme-warning);
|
|
67
67
|
--color-warning-text: var(--theme-warning-text);
|
|
68
68
|
--color-warning-hover: var(--theme-warning-hover);
|
|
69
|
+
/* A filled control's hover, for the two slots the composer's action pair
|
|
70
|
+
uses. Mixing toward the theme's INK follows the palette (darker on a light
|
|
71
|
+
theme, lighter on a dark one) and keeps the `text-canvas` glyph legal:
|
|
72
|
+
measured over the 63 palettes, `hover:opacity-90` blended the fill into the
|
|
73
|
+
paper and dropped the glyph to **3.77:1** on `nightowl-light`, while this
|
|
74
|
+
mix holds 4.71:1 minimum. The `-text` fill is what the control rests on —
|
|
75
|
+
the raw palette hex measures 1.94:1 against `aura-light`'s canvas. */
|
|
76
|
+
--color-error-text-hover: color-mix(in srgb, var(--theme-error-text) 88%, var(--theme-ink));
|
|
77
|
+
--color-info-text-hover: color-mix(in srgb, var(--theme-info-text) 88%, var(--theme-ink));
|
|
69
78
|
/* The brand mark's own colour, and deliberately NOT a theme token: the logo
|
|
70
79
|
is the same mark in every palette, so a theme flip must not repaint the
|
|
71
80
|
letter that carries it. This is the app icon's accent stroke — the orange
|
|
@@ -800,10 +809,18 @@
|
|
|
800
809
|
.prose-content td, .prose-content th { line-height: inherit; overflow-wrap: break-word; }
|
|
801
810
|
.prose-content th { background: color-mix(in srgb, var(--theme-ink) 5%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--theme-ink) 15%, transparent); padding: 0.375rem 0.75rem; font-weight: 600; }
|
|
802
811
|
.prose-content td { border-bottom: 1px solid color-mix(in srgb, var(--theme-ink) 10%, transparent); padding: 0.375rem 0.75rem; }
|
|
812
|
+
/* The chip's fill is its OWN, opaque colour (`--theme-code-fill`, ink at 8% over
|
|
813
|
+
* the palette's paper). It used to be `color-mix(… 8%, transparent)`, an ALPHA:
|
|
814
|
+
* whatever was painted behind the chip showed through, so a hovered block's tint
|
|
815
|
+
* changed the code's colour mid-hover and with it the code/chip contrast —
|
|
816
|
+
* measured on a real session in the browser: `#e4e9ed` at rest against
|
|
817
|
+
* `#dce2e5` with the hover tint behind it. One solved colour per palette also
|
|
818
|
+
* removes lightningcss's `color-mix` fallback, which was
|
|
819
|
+
* `background: var(--theme-ink)` — a solid ink slab with ink text on it. */
|
|
803
820
|
.prose-content code.inline-code {
|
|
804
821
|
font-family: 'Fira Code', monospace; font-size: 0.75rem;
|
|
805
822
|
padding: 0.0125rem 0.275rem; border-radius: 0.375rem;
|
|
806
|
-
background:
|
|
823
|
+
background: var(--theme-code-fill);
|
|
807
824
|
color: var(--theme-ink);
|
|
808
825
|
overflow-wrap: break-word;
|
|
809
826
|
}
|
|
@@ -1391,6 +1408,35 @@ html[data-theme-variant='dark'] .brand-wordmark-glow {
|
|
|
1391
1408
|
}
|
|
1392
1409
|
}
|
|
1393
1410
|
|
|
1411
|
+
/* The generating indicator's mark: a nine-hue ring spun behind the ink badge.
|
|
1412
|
+
*
|
|
1413
|
+
* This is the ONE deliberate exception to "chroma is state" (DESIGN.md §3), and
|
|
1414
|
+
* it is stated here rather than inline for the same reason the dots are: a
|
|
1415
|
+
* component-level `<style>` block re-declared these keyframes on every render of
|
|
1416
|
+
* every indicator a transcript holds, and a hex in a component is a hex nobody
|
|
1417
|
+
* can find. The hues are the nine the original inline gradient used, so the mark
|
|
1418
|
+
* reads identically to the one it replaces.
|
|
1419
|
+
*
|
|
1420
|
+
* `animation-duration` is 1.2s here and the reduce-motion block below slows
|
|
1421
|
+
* `.animate-spin` to 3s — that block is later in the file, so it wins at equal
|
|
1422
|
+
* specificity. A ring that stops dead would look like a frozen indicator. */
|
|
1423
|
+
.generating-mark-ring {
|
|
1424
|
+
--generating-ring: conic-gradient(
|
|
1425
|
+
from 0deg,
|
|
1426
|
+
#ff453a,
|
|
1427
|
+
#ff9f0a,
|
|
1428
|
+
#ffd60a,
|
|
1429
|
+
#30d158,
|
|
1430
|
+
#64d2ff,
|
|
1431
|
+
#0a84ff,
|
|
1432
|
+
#bf5af2,
|
|
1433
|
+
#ff375f,
|
|
1434
|
+
#ff453a
|
|
1435
|
+
);
|
|
1436
|
+
background: var(--generating-ring);
|
|
1437
|
+
animation-duration: 1.2s;
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1394
1440
|
/* ============================================================================
|
|
1395
1441
|
* Motion, under the user's own switch.
|
|
1396
1442
|
*
|