@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,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Providers for one harness, drawn at the level the harness actually supports.
|
|
8
|
+
*
|
|
9
|
+
* The three shapes are not styling: each answers a different question, and
|
|
10
|
+
* presenting one as another is how a settings page starts lying.
|
|
11
|
+
*
|
|
12
|
+
* - **`full`** — the agent keeps a provider registry. The panel lists what is
|
|
13
|
+
* importable from elsewhere (`omp models.yml`, another agent's registry) and
|
|
14
|
+
* what is already configured, and a copy writes a real registry entry.
|
|
15
|
+
* - **`environment`** — the agent is pointed at ONE endpoint. The fields are
|
|
16
|
+
* labelled with the environment variable each becomes, and the panel says
|
|
17
|
+
* plainly that this REPLACES the vendor instead of adding beside it. Adding a
|
|
18
|
+
* "provider" here would be the page's lie, not the agent's limitation.
|
|
19
|
+
* - **`configurable`** — no registry Kabmo can write. The panel names the whole
|
|
20
|
+
* surface (the launch command and its env) and offers nothing, because
|
|
21
|
+
* offering an editor that writes a file the agent never reads is worse than
|
|
22
|
+
* saying so.
|
|
23
|
+
*
|
|
24
|
+
* Imports are CUSTOM providers only. A registry ships its own providers, and one
|
|
25
|
+
* of those copied across writes an override of the TARGET's vendor entry instead
|
|
26
|
+
* of adding a gateway — the server filters and refuses them, and the rows here
|
|
27
|
+
* say so rather than hiding the fact. Each row also names the protocol it speaks
|
|
28
|
+
* and whether THIS harness can take it, so a refusal is visible before a click.
|
|
29
|
+
*
|
|
30
|
+
* The import rows carry no credentials. Picking one and confirming is what reads
|
|
31
|
+
* the key, from the source file, in the request that writes the target.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import type { HarnessImportOutcome, HarnessProviderSupport } from '@/shared/types/harness';
|
|
35
|
+
import { PROTOCOL_LABELS } from '@/shared/lib/harness/dialects';
|
|
36
|
+
import { EnvProviderForm } from '@/client/components/settings/categories/harness-settings/EnvProviderForm';
|
|
37
|
+
import {
|
|
38
|
+
ConfiguredList, ImportSection, ReadOnlyRows,
|
|
39
|
+
} from '@/client/components/settings/categories/harness-settings/ImportSection';
|
|
40
|
+
import {
|
|
41
|
+
AddProviderForm, type AddProviderInput,
|
|
42
|
+
} from '@/client/components/settings/categories/harness-settings/AddProviderForm';
|
|
43
|
+
|
|
44
|
+
type ImportRow = HarnessProviderSupport['importable'][number];
|
|
45
|
+
|
|
46
|
+
interface ProviderPanelProps {
|
|
47
|
+
support: HarnessProviderSupport;
|
|
48
|
+
/** Save env-style providers into this harness's config. */
|
|
49
|
+
onSaveEnv?: (env: string) => Promise<string | null>;
|
|
50
|
+
/** Copy one provider out of a source registry into this harness.
|
|
51
|
+
*
|
|
52
|
+
* The whole ROW travels, not just its id: the writer needs the endpoint, the
|
|
53
|
+
* protocol and the model list, and re-reading them server-side would be a
|
|
54
|
+
* second lookup of something the list already answered. The credential is
|
|
55
|
+
* still not in the row — the server reads that from the source file. */
|
|
56
|
+
onImport?: (sourceId: string, entry: ImportRow) => Promise<HarnessImportOutcome>;
|
|
57
|
+
/** Type one in: the endpoint and key a user already has. The route probes the
|
|
58
|
+
* host and picks a protocol, so this is the typed twin of `onImport`. */
|
|
59
|
+
onAddProvider?: (input: AddProviderInput) => Promise<HarnessImportOutcome>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function HarnessProviderPanel({ support, onSaveEnv, onImport, onAddProvider }: ProviderPanelProps) {
|
|
63
|
+
if (support.level === 'configurable') {
|
|
64
|
+
return (
|
|
65
|
+
<div className="mt-3 space-y-2 border-t border-ink/10 pt-3">
|
|
66
|
+
<span className="text-[10px] font-semibold uppercase tracking-wider text-ink/45">Providers</span>
|
|
67
|
+
<p className="text-[11px] leading-relaxed text-ink/55">{support.summary}</p>
|
|
68
|
+
<p className="text-[10px] text-ink/40">
|
|
69
|
+
Use the launch command and environment fields above — that is this agent's whole surface.
|
|
70
|
+
</p>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (support.level === 'environment') {
|
|
76
|
+
return (
|
|
77
|
+
<div className="mt-3 space-y-2 border-t border-ink/10 pt-3">
|
|
78
|
+
<div className="flex items-center justify-between">
|
|
79
|
+
<span className="text-[10px] font-semibold uppercase tracking-wider text-ink/45">Provider</span>
|
|
80
|
+
<span className="font-mono text-[10px] text-ink/40">{support.fileLabel}</span>
|
|
81
|
+
</div>
|
|
82
|
+
<p className="text-[11px] leading-relaxed text-ink/55">{support.summary}</p>
|
|
83
|
+
{onSaveEnv && <EnvProviderForm support={support} onSave={onSaveEnv} />}
|
|
84
|
+
{onAddProvider && <AddProviderForm support={support} onAdd={onAddProvider} />}
|
|
85
|
+
{onImport && <ImportSection support={support} onImport={onImport} />}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// `full`: a real registry, with imports from the sources this harness allows.
|
|
91
|
+
return <FullProviderPanel support={support} onImport={onImport} onAddProvider={onAddProvider} />;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The registry-backed panel.
|
|
96
|
+
*
|
|
97
|
+
* A `full` harness whose file Kabmo cannot write yet (`command-code` keeps an
|
|
98
|
+
* undocumented `providers.json` its own `/connect` writes) says exactly that
|
|
99
|
+
* instead of pretending the import list is an editor: the rows are shown as
|
|
100
|
+
* what the source holds, with the action that actually adds one — the agent's
|
|
101
|
+
* own command.
|
|
102
|
+
*/
|
|
103
|
+
function FullProviderPanel({
|
|
104
|
+
support, onImport, onAddProvider,
|
|
105
|
+
}: {
|
|
106
|
+
support: HarnessProviderSupport;
|
|
107
|
+
onImport?: (sourceId: string, entry: ImportRow) => Promise<HarnessImportOutcome>;
|
|
108
|
+
onAddProvider?: (input: AddProviderInput) => Promise<HarnessImportOutcome>;
|
|
109
|
+
}) {
|
|
110
|
+
return (
|
|
111
|
+
<div className="mt-3 space-y-2 border-t border-ink/10 pt-3">
|
|
112
|
+
<div className="flex flex-wrap items-center justify-between gap-2">
|
|
113
|
+
<span className="text-[10px] font-semibold uppercase tracking-wider text-ink/45">Providers</span>
|
|
114
|
+
<span className="font-mono text-[10px] text-ink/40" title={support.file || undefined}>
|
|
115
|
+
{support.fileLabel}{support.pointer ? ` · ${support.pointer}` : ''}
|
|
116
|
+
</span>
|
|
117
|
+
</div>
|
|
118
|
+
<p className="text-[11px] leading-relaxed text-ink/55">{support.summary}</p>
|
|
119
|
+
<div className="flex flex-wrap gap-1">
|
|
120
|
+
{support.protocols.map((protocol) => (
|
|
121
|
+
<span
|
|
122
|
+
key={protocol}
|
|
123
|
+
className="rounded border border-ink/15 px-1.5 py-0.5 font-mono text-[9px] text-ink/50"
|
|
124
|
+
>
|
|
125
|
+
{PROTOCOL_LABELS[protocol]}
|
|
126
|
+
</span>
|
|
127
|
+
))}
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
{support.configured.length > 0 && <ConfiguredList support={support} />}
|
|
131
|
+
{onAddProvider && <AddProviderForm support={support} onAdd={onAddProvider} />}
|
|
132
|
+
|
|
133
|
+
{support.importable.length === 0 ? (
|
|
134
|
+
<p className="text-[10px] text-ink/40">
|
|
135
|
+
Nothing to import yet — the other agents' registries hold no provider you registered yourself.
|
|
136
|
+
</p>
|
|
137
|
+
) : (
|
|
138
|
+
// The rows are still SHOWN when this build has no writer: they are what
|
|
139
|
+
// the sources hold, and hiding them made a working reader look like an
|
|
140
|
+
// empty registry. The action is what is missing, so the button is
|
|
141
|
+
// disabled and the sentence below says why.
|
|
142
|
+
<div>
|
|
143
|
+
{onImport ? (
|
|
144
|
+
<ImportSection support={support} onImport={onImport} />
|
|
145
|
+
) : (
|
|
146
|
+
<ReadOnlyRows support={support} />
|
|
147
|
+
)}
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* All Harnesses: one ROW per agent, with the switch that decides whether it
|
|
8
|
+
* exists anywhere else in the app.
|
|
9
|
+
*
|
|
10
|
+
* This page used to be twelve full cards — capabilities, config form, provider
|
|
11
|
+
* panel — which made a roster question ("which agents do I run?") into a page
|
|
12
|
+
* you scroll through. The switch is the only control that belongs here: turning
|
|
13
|
+
* one on probes it once and its page appears in the menu, turning one off
|
|
14
|
+
* removes it from the menu and from the composer's picker. What the agent can DO
|
|
15
|
+
* is that agent's own page, reached from the row.
|
|
16
|
+
*
|
|
17
|
+
* A switched-off harness STAYS in this list, because it is the only place it can
|
|
18
|
+
* be switched back on.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { AlertCircle, ArrowUpRight, Check, CircleDashed, Loader2, PackageX } from 'lucide-preact';
|
|
22
|
+
import { HarnessGlyph, HARNESS_GLYPH_SIZE } from '@/client/components/common/harness-glyph';
|
|
23
|
+
import { harnessStatus, type HarnessState } from '@/shared/lib/harness/status';
|
|
24
|
+
import type { HarnessSummary } from '@/shared/types/harness';
|
|
25
|
+
|
|
26
|
+
interface HarnessToggleListProps {
|
|
27
|
+
/** Every non-built-in harness, switched on or off. */
|
|
28
|
+
harnesses: HarnessSummary[];
|
|
29
|
+
/** The harness a switch is in flight for, or null. */
|
|
30
|
+
busy: string | null;
|
|
31
|
+
onSetEnabled: (id: string, enabled: boolean) => void;
|
|
32
|
+
/** Opens that harness's own settings page. */
|
|
33
|
+
onOpen: (id: string) => void;
|
|
34
|
+
onProbe: (id: string) => void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The state's mark: shape carries the state, so tone is reinforcement only. */
|
|
38
|
+
function StatusMark({ state }: { state: HarnessState }) {
|
|
39
|
+
if (state === 'ready') return <Check size={11} className="text-ink/70" />;
|
|
40
|
+
if (state === 'not-installed') return <PackageX size={11} className="text-ink/50" />;
|
|
41
|
+
if (state === 'needs-setup') return <AlertCircle size={11} className="text-ink/55" />;
|
|
42
|
+
return <CircleDashed size={11} className="text-ink/35" />;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** How a row says when it was last checked, or that it never was. */
|
|
46
|
+
function probedLabel(summary: HarnessSummary): string {
|
|
47
|
+
const probe = summary.probe;
|
|
48
|
+
if (!probe) return 'not probed';
|
|
49
|
+
const minutes = Math.max(0, Math.round((Date.now() - probe.probedAt) / 60_000));
|
|
50
|
+
const ago = minutes < 1 ? 'just now' : minutes < 60 ? `${minutes}m ago` : `${Math.round(minutes / 60)}h ago`;
|
|
51
|
+
// An aged record keeps its answer and gains its age — never "not probed", which
|
|
52
|
+
// is what this page said before the record survived a restart.
|
|
53
|
+
return probe.stale ? `checked ${ago} · re-check for a current version` : `checked ${ago}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function HarnessToggleList({
|
|
57
|
+
harnesses, busy, onSetEnabled, onOpen, onProbe,
|
|
58
|
+
}: HarnessToggleListProps) {
|
|
59
|
+
return (
|
|
60
|
+
<ul className="divide-y divide-ink/10 rounded-xl border border-ink/10 bg-paper">
|
|
61
|
+
{harnesses.map((summary) => {
|
|
62
|
+
const status = harnessStatus(summary);
|
|
63
|
+
const checking = busy === summary.id;
|
|
64
|
+
return (
|
|
65
|
+
<li key={summary.id} className="flex items-center gap-3 px-3 py-2.5">
|
|
66
|
+
<span className={summary.enabled ? '' : 'opacity-40'}>
|
|
67
|
+
<HarnessGlyph harness={summary.id} size={HARNESS_GLYPH_SIZE.compact} />
|
|
68
|
+
</span>
|
|
69
|
+
|
|
70
|
+
<div className="min-w-0 flex-1">
|
|
71
|
+
<div className={`truncate text-xs font-medium ${summary.enabled ? 'text-ink' : 'text-ink/45'}`}>
|
|
72
|
+
{summary.label}
|
|
73
|
+
</div>
|
|
74
|
+
<div className="mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] text-ink/45">
|
|
75
|
+
{/* The chip names WHICH state: a missing binary, an agent that
|
|
76
|
+
wants a login, an answer, or an absence of information. */}
|
|
77
|
+
<span className="inline-flex items-center gap-1" title={status.detail ?? undefined}>
|
|
78
|
+
<StatusMark state={status.state} />
|
|
79
|
+
{status.label}
|
|
80
|
+
</span>
|
|
81
|
+
{summary.enabled && (
|
|
82
|
+
<span className="text-ink/35">
|
|
83
|
+
{summary.canLaunch ? probedLabel(summary) : status.detail}
|
|
84
|
+
</span>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
{/* Checking status is meaningless for a harness that is switched
|
|
90
|
+
off, and for one whose binary is missing: both are disabled with
|
|
91
|
+
the reason in the title. */}
|
|
92
|
+
{summary.enabled && (
|
|
93
|
+
<button
|
|
94
|
+
type="button"
|
|
95
|
+
disabled={checking || !summary.canLaunch}
|
|
96
|
+
onClick={() => onProbe(summary.id)}
|
|
97
|
+
title={summary.canLaunch ? 'Spawn this agent once and read what it reports' : status.detail ?? 'Not installed'}
|
|
98
|
+
className="shrink-0 cursor-pointer rounded-md border border-ink/15 px-2 py-1 text-[10px] text-ink/60 transition-colors hover:border-ink/35 hover:text-ink disabled:cursor-not-allowed disabled:opacity-40"
|
|
99
|
+
>
|
|
100
|
+
{checking ? <Loader2 size={10} className="animate-spin" /> : 'Check'}
|
|
101
|
+
</button>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
{summary.enabled && (
|
|
105
|
+
<button
|
|
106
|
+
type="button"
|
|
107
|
+
onClick={() => onOpen(summary.id)}
|
|
108
|
+
title={`Open ${summary.label} settings`}
|
|
109
|
+
aria-label={`Open ${summary.label} settings`}
|
|
110
|
+
className="shrink-0 cursor-pointer rounded p-1 text-ink/40 transition-colors hover:text-ink"
|
|
111
|
+
>
|
|
112
|
+
<ArrowUpRight size={12} />
|
|
113
|
+
</button>
|
|
114
|
+
)}
|
|
115
|
+
|
|
116
|
+
<button
|
|
117
|
+
type="button"
|
|
118
|
+
role="switch"
|
|
119
|
+
aria-checked={summary.enabled}
|
|
120
|
+
aria-label={`${summary.enabled ? 'Disable' : 'Enable'} ${summary.label}`}
|
|
121
|
+
disabled={checking}
|
|
122
|
+
onClick={() => onSetEnabled(summary.id, !summary.enabled)}
|
|
123
|
+
title={
|
|
124
|
+
summary.enabled
|
|
125
|
+
? 'Turn off — hides its settings page and removes it from the model picker'
|
|
126
|
+
: 'Turn on — probes it once and adds its settings page'
|
|
127
|
+
}
|
|
128
|
+
className={`relative h-4 w-8 shrink-0 rounded-full transition-colors disabled:opacity-40 ${
|
|
129
|
+
summary.enabled ? 'bg-ink/70' : 'bg-ink/20'
|
|
130
|
+
}`}
|
|
131
|
+
>
|
|
132
|
+
{checking ? (
|
|
133
|
+
<Loader2 size={9} className="absolute inset-0 m-auto animate-spin text-canvas" />
|
|
134
|
+
) : (
|
|
135
|
+
<span
|
|
136
|
+
className={`absolute top-0.5 h-3 w-3 rounded-full bg-canvas transition-all ${
|
|
137
|
+
summary.enabled ? 'left-[18px]' : 'left-0.5'
|
|
138
|
+
}`}
|
|
139
|
+
/>
|
|
140
|
+
)}
|
|
141
|
+
</button>
|
|
142
|
+
</li>
|
|
143
|
+
);
|
|
144
|
+
})}
|
|
145
|
+
</ul>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The dismissal control on an in-place refusal.
|
|
8
|
+
*
|
|
9
|
+
* A switch or probe refusal is the agent's own words, so it is stated in the
|
|
10
|
+
* page rather than in a toast that closes before it can be read — which means it
|
|
11
|
+
* has to be closable. Before this, the only way an error left the page was the
|
|
12
|
+
* next action succeeding, so a persistently failing harness kept a banner that
|
|
13
|
+
* became part of the furniture.
|
|
14
|
+
*
|
|
15
|
+
* The two facts pinned here:
|
|
16
|
+
*
|
|
17
|
+
* - the dismiss control is a real named button (not a bare `×`), so assistive
|
|
18
|
+
* tech can say WHICH notice it closes;
|
|
19
|
+
* - dismissing removes the MESSAGE only — the caller decides that, and the row
|
|
20
|
+
* beside it still states `not installed` and still disables `Check`.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
24
|
+
import { Window } from 'happy-dom';
|
|
25
|
+
import { h, render } from 'preact';
|
|
26
|
+
import { act } from 'preact/test-utils';
|
|
27
|
+
|
|
28
|
+
import { SettingsNotice } from '@/client/components/settings/categories/harness-settings/parts';
|
|
29
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
30
|
+
|
|
31
|
+
let container: HTMLElement;
|
|
32
|
+
|
|
33
|
+
beforeAll(() => {
|
|
34
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
container = document.createElement('div');
|
|
39
|
+
document.body.appendChild(container);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
render(null, container);
|
|
44
|
+
container.remove();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
afterAll(() => {
|
|
48
|
+
restoreDomGlobals();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('SettingsNotice', () => {
|
|
52
|
+
test('states the message and offers a NAMED dismiss button', () => {
|
|
53
|
+
let dismissed = 0;
|
|
54
|
+
act(() =>
|
|
55
|
+
render(
|
|
56
|
+
h(SettingsNotice, {
|
|
57
|
+
message: 'executable not found (command: pi)',
|
|
58
|
+
onDismiss: () => { dismissed += 1; },
|
|
59
|
+
dismissLabel: 'Dismiss this message',
|
|
60
|
+
}),
|
|
61
|
+
container,
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
expect(container.textContent).toContain('executable not found (command: pi)');
|
|
66
|
+
const button = container.querySelector('button');
|
|
67
|
+
expect(button).not.toBeNull();
|
|
68
|
+
// A bare `×` reads as "times" to a screen reader, which says nothing about
|
|
69
|
+
// what it closes.
|
|
70
|
+
expect(button?.getAttribute('aria-label')).toBe('Dismiss this message');
|
|
71
|
+
expect(button?.getAttribute('title')).toBe('Dismiss this message');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('clicking it calls the handler exactly once', () => {
|
|
75
|
+
let dismissed = 0;
|
|
76
|
+
act(() =>
|
|
77
|
+
render(
|
|
78
|
+
h(SettingsNotice, { message: 'boom', onDismiss: () => { dismissed += 1; } }),
|
|
79
|
+
container,
|
|
80
|
+
),
|
|
81
|
+
);
|
|
82
|
+
act(() => {
|
|
83
|
+
container.querySelector('button')?.dispatchEvent(
|
|
84
|
+
new window.MouseEvent('click', { bubbles: true }),
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
expect(dismissed).toBe(1);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('a notice with nothing to dismiss draws no button', () => {
|
|
91
|
+
// The same banner is used for a message the page must keep — an absent
|
|
92
|
+
// `onDismiss` is the honest way to say "this one stays".
|
|
93
|
+
act(() => render(h(SettingsNotice, { message: 'still true' }), container));
|
|
94
|
+
expect(container.querySelector('button')).toBeNull();
|
|
95
|
+
expect(container.textContent).toContain('still true');
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The two small controls this page needs, in their own file so the page itself
|
|
8
|
+
* reads as sections rather than as markup.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { AlertCircle, Search, X } from 'lucide-preact';
|
|
12
|
+
|
|
13
|
+
interface SettingsSearchFieldProps {
|
|
14
|
+
value: string;
|
|
15
|
+
onChange: (value: string) => void;
|
|
16
|
+
placeholder: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A search field with a clear button, matching the settings sidebar's one. */
|
|
20
|
+
export function SettingsSearchField({ value, onChange, placeholder }: SettingsSearchFieldProps) {
|
|
21
|
+
return (
|
|
22
|
+
<div className="relative flex min-w-[14rem] flex-1 items-center">
|
|
23
|
+
<Search size={13} className="pointer-events-none absolute left-2.5 text-ink/40" />
|
|
24
|
+
<input
|
|
25
|
+
type="text"
|
|
26
|
+
value={value}
|
|
27
|
+
onChange={(event) => onChange(event.currentTarget.value)}
|
|
28
|
+
placeholder={placeholder}
|
|
29
|
+
className="w-full rounded-md border border-ink/20 bg-paper py-1.5 pl-7 pr-7 text-xs text-ink outline-none transition-colors placeholder:text-ink/35 focus:border-ink/50"
|
|
30
|
+
/>
|
|
31
|
+
{value && (
|
|
32
|
+
<button
|
|
33
|
+
type="button"
|
|
34
|
+
onClick={() => onChange('')}
|
|
35
|
+
title="Clear search"
|
|
36
|
+
aria-label="Clear search"
|
|
37
|
+
className="absolute right-1.5 cursor-pointer rounded p-0.5 text-ink/40 transition-colors hover:text-ink"
|
|
38
|
+
>
|
|
39
|
+
<X size={12} />
|
|
40
|
+
</button>
|
|
41
|
+
)}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface SettingsNoticeProps {
|
|
47
|
+
message: string;
|
|
48
|
+
/** Dismiss this notice. Omitted by a notice that has nothing to dismiss. */
|
|
49
|
+
onDismiss?: () => void;
|
|
50
|
+
/** The dismiss control's accessible name, so it says WHICH notice closes. */
|
|
51
|
+
dismissLabel?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A refusal stated in place, with a way out of it.
|
|
56
|
+
*
|
|
57
|
+
* The banner is not a toast: a switch or probe refusal is the agent's own words
|
|
58
|
+
* (`Run mcode login`, `executable not found (command: pi)`), and a toast would
|
|
59
|
+
* close before they could be read. That also means it must be dismissible —
|
|
60
|
+
* an error that only leaves when the next action succeeds sits on the page
|
|
61
|
+
* forever, and on a switch that keeps failing it becomes part of the furniture.
|
|
62
|
+
*
|
|
63
|
+
* Dismissing hides the MESSAGE, never the state: the row's `not installed`
|
|
64
|
+
* chip and its disabled `Check` still say what is true.
|
|
65
|
+
*/
|
|
66
|
+
export function SettingsNotice({ message, onDismiss, dismissLabel = 'Dismiss message' }: SettingsNoticeProps) {
|
|
67
|
+
return (
|
|
68
|
+
<div className="flex items-start gap-2 rounded-lg border border-ink/15 bg-ink/[0.03] p-3 text-[11px] text-ink/70">
|
|
69
|
+
<AlertCircle size={13} className="mt-0.5 shrink-0" />
|
|
70
|
+
<span className="min-w-0 flex-1">{message}</span>
|
|
71
|
+
{onDismiss && (
|
|
72
|
+
<button
|
|
73
|
+
type="button"
|
|
74
|
+
onClick={onDismiss}
|
|
75
|
+
title={dismissLabel}
|
|
76
|
+
aria-label={dismissLabel}
|
|
77
|
+
className="-m-0.5 shrink-0 cursor-pointer rounded p-0.5 text-ink/40 transition-colors hover:text-ink"
|
|
78
|
+
>
|
|
79
|
+
<X size={12} />
|
|
80
|
+
</button>
|
|
81
|
+
)}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|