@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,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The provider panel, as the two measured bugs and the user's rule define it.
|
|
8
|
+
*
|
|
9
|
+
* - **Custom only.** `anthropic` lives in the same models.yml as `kenari` and
|
|
10
|
+
* must never be offered: copying it into another agent writes an override of
|
|
11
|
+
* that agent's OWN built-in provider. The server filters it (`vendors.ts`);
|
|
12
|
+
* this pins what the card RENDERS.
|
|
13
|
+
* - **A row states the source's protocol and the target's list, not a verdict.**
|
|
14
|
+
* The import is what decides, by probing the endpoint — `kenari` declares Chat
|
|
15
|
+
* Completions and lands in Claude Code through Anthropic Messages. A row that
|
|
16
|
+
* said "won't work" here would have hidden the one import that works.
|
|
17
|
+
* - **The env form clears itself on a successful save.** Reading the `problem`
|
|
18
|
+
* state right after `setProblem(...)` held the PREVIOUS save's value, so a
|
|
19
|
+
* successful write reported failure and kept its fields filled.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
23
|
+
import { Window } from 'happy-dom';
|
|
24
|
+
import { h, render } from 'preact';
|
|
25
|
+
import { act } from 'preact/test-utils';
|
|
26
|
+
|
|
27
|
+
import { HarnessProviderPanel } from '@/client/components/settings/categories/harness-settings/ProviderPanel';
|
|
28
|
+
import type { HarnessProviderSupport } from '@/shared/types/harness';
|
|
29
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
30
|
+
|
|
31
|
+
let container: HTMLElement;
|
|
32
|
+
|
|
33
|
+
function support(overrides: Partial<HarnessProviderSupport> = {}): HarnessProviderSupport {
|
|
34
|
+
return {
|
|
35
|
+
level: 'full',
|
|
36
|
+
file: '.omp/agent/models.yml',
|
|
37
|
+
fileLabel: 'models.yml (omp)',
|
|
38
|
+
summary: 'omp keeps providers in models.yml.',
|
|
39
|
+
createsChoice: true,
|
|
40
|
+
pointer: 'providers',
|
|
41
|
+
credentialLabel: 'apiKey',
|
|
42
|
+
protocols: ['openai-chat', 'anthropic-messages'],
|
|
43
|
+
configured: [],
|
|
44
|
+
importable: [],
|
|
45
|
+
...overrides,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const KENARI = {
|
|
50
|
+
id: 'kenari',
|
|
51
|
+
name: 'Kenari',
|
|
52
|
+
baseUrl: 'https://kenari.id/v1',
|
|
53
|
+
dialect: 'openai-completions',
|
|
54
|
+
protocol: 'openai-chat' as const,
|
|
55
|
+
models: ['claude-sonnet-5'],
|
|
56
|
+
source: 'omp-rpc',
|
|
57
|
+
hasKey: true,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
installDomGlobals(new Window());
|
|
62
|
+
container = document.createElement('div');
|
|
63
|
+
document.body.appendChild(container);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
afterEach(() => {
|
|
67
|
+
render(null, container);
|
|
68
|
+
container.remove();
|
|
69
|
+
restoreDomGlobals();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
function buttons(): HTMLButtonElement[] {
|
|
73
|
+
return [...container.querySelectorAll('button')];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
describe('the import list', () => {
|
|
77
|
+
test('a custom provider is offered with its SOURCE and its declared protocol', () => {
|
|
78
|
+
render(h(HarnessProviderPanel, { support: support({ importable: [KENARI] }) }), container);
|
|
79
|
+
const text = container.textContent ?? '';
|
|
80
|
+
expect(text).toContain('Kenari');
|
|
81
|
+
expect(text).toContain('omp-rpc');
|
|
82
|
+
expect(text).toContain('https://kenari.id/v1');
|
|
83
|
+
// The source's own protocol, named on the shared vocabulary.
|
|
84
|
+
expect(text).toContain('OpenAI Chat Completions');
|
|
85
|
+
// And what THIS agent can take, so the refusal is visible early.
|
|
86
|
+
expect(text).toContain('Anthropic Messages');
|
|
87
|
+
expect(text).toContain('key stored');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('an IMPORT button is present and never disabled by the declaration alone', () => {
|
|
91
|
+
// `kenari` declares a protocol `claude` does not store; the probe decides, so
|
|
92
|
+
// the button stays live.
|
|
93
|
+
render(
|
|
94
|
+
h(HarnessProviderPanel, {
|
|
95
|
+
support: support({
|
|
96
|
+
level: 'environment',
|
|
97
|
+
env: { baseUrl: 'ANTHROPIC_BASE_URL', apiKey: 'ANTHROPIC_AUTH_TOKEN', model: 'ANTHROPIC_MODEL' },
|
|
98
|
+
protocols: ['anthropic-messages'],
|
|
99
|
+
importable: [KENARI],
|
|
100
|
+
}),
|
|
101
|
+
onImport: async () => ({ problem: null, detail: null }),
|
|
102
|
+
}),
|
|
103
|
+
container,
|
|
104
|
+
);
|
|
105
|
+
const importButton = buttons().find((button) => button.textContent?.includes('Import'));
|
|
106
|
+
expect(importButton).toBeDefined();
|
|
107
|
+
expect(importButton?.disabled).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('an empty list says so instead of drawing a dead section', () => {
|
|
111
|
+
render(h(HarnessProviderPanel, { support: support({ importable: [] }) }), container);
|
|
112
|
+
expect(container.textContent).toContain('Nothing to import yet');
|
|
113
|
+
expect(buttons().some((button) => button.textContent?.includes('Import'))).toBe(false);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('a successful import shows the EVIDENCE, not just "copied"', async () => {
|
|
117
|
+
render(
|
|
118
|
+
h(HarnessProviderPanel, {
|
|
119
|
+
support: support({ importable: [KENARI] }),
|
|
120
|
+
onImport: async () => ({
|
|
121
|
+
problem: null,
|
|
122
|
+
detail: 'anthropic-messages → models.yml (omp) · set ANTHROPIC_AUTH_TOKEN',
|
|
123
|
+
}),
|
|
124
|
+
}),
|
|
125
|
+
container,
|
|
126
|
+
);
|
|
127
|
+
const importButton = buttons().find((button) => button.textContent?.includes('Import'))!;
|
|
128
|
+
await act(async () => {
|
|
129
|
+
importButton.click();
|
|
130
|
+
await Promise.resolve();
|
|
131
|
+
await Promise.resolve();
|
|
132
|
+
});
|
|
133
|
+
const text = container.textContent ?? '';
|
|
134
|
+
expect(text).toContain('Copied kenari into models.yml (omp)');
|
|
135
|
+
expect(text).toContain('anthropic-messages');
|
|
136
|
+
expect(text).toContain('ANTHROPIC_AUTH_TOKEN');
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test('a refusal is printed verbatim, with the reason the route gave', async () => {
|
|
140
|
+
render(
|
|
141
|
+
h(HarnessProviderPanel, {
|
|
142
|
+
support: support({ importable: [KENARI] }),
|
|
143
|
+
onImport: async () => ({ problem: 'antigravity has no protocol that matches kenari', detail: null }),
|
|
144
|
+
}),
|
|
145
|
+
container,
|
|
146
|
+
);
|
|
147
|
+
const importButton = buttons().find((button) => button.textContent?.includes('Import'))!;
|
|
148
|
+
await act(async () => {
|
|
149
|
+
importButton.click();
|
|
150
|
+
await Promise.resolve();
|
|
151
|
+
await Promise.resolve();
|
|
152
|
+
});
|
|
153
|
+
expect(container.textContent).toContain('antigravity has no protocol that matches kenari');
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
describe('the env form', () => {
|
|
158
|
+
test('a successful save CLEARS its fields — the second save is not blocked by a stale problem', async () => {
|
|
159
|
+
let calls = 0;
|
|
160
|
+
render(
|
|
161
|
+
h(HarnessProviderPanel, {
|
|
162
|
+
support: support({
|
|
163
|
+
level: 'environment',
|
|
164
|
+
env: { baseUrl: 'ANTHROPIC_BASE_URL', apiKey: 'ANTHROPIC_AUTH_TOKEN' },
|
|
165
|
+
protocols: ['anthropic-messages'],
|
|
166
|
+
importable: [],
|
|
167
|
+
}),
|
|
168
|
+
onSaveEnv: async () => {
|
|
169
|
+
calls += 1;
|
|
170
|
+
return null;
|
|
171
|
+
},
|
|
172
|
+
}),
|
|
173
|
+
container,
|
|
174
|
+
);
|
|
175
|
+
const inputs = [...container.querySelectorAll('input')] as HTMLInputElement[];
|
|
176
|
+
expect(inputs).toHaveLength(2);
|
|
177
|
+
await act(async () => {
|
|
178
|
+
inputs[0]!.value = 'https://kenari.id';
|
|
179
|
+
inputs[0]!.dispatchEvent(new Event('input', { bubbles: true }));
|
|
180
|
+
inputs[1]!.value = 'kn-key';
|
|
181
|
+
inputs[1]!.dispatchEvent(new Event('input', { bubbles: true }));
|
|
182
|
+
});
|
|
183
|
+
const save = buttons().find((button) => button.textContent?.includes('Save to environment'))!;
|
|
184
|
+
expect(save.disabled).toBe(false);
|
|
185
|
+
await act(async () => {
|
|
186
|
+
save.click();
|
|
187
|
+
await Promise.resolve();
|
|
188
|
+
await Promise.resolve();
|
|
189
|
+
});
|
|
190
|
+
expect(calls).toBe(1);
|
|
191
|
+
// Cleared, and no error text left behind.
|
|
192
|
+
const after = [...container.querySelectorAll('input')] as HTMLInputElement[];
|
|
193
|
+
expect(after[0]!.value).toBe('');
|
|
194
|
+
expect(after[1]!.value).toBe('');
|
|
195
|
+
expect(container.textContent).not.toContain('Save to environment failed');
|
|
196
|
+
// One input carrying the class ONCE — the duplicate `class`/`className` pair
|
|
197
|
+
// was a JSX-precompile hazard, not a style choice.
|
|
198
|
+
expect(container.querySelector('input')?.getAttribute('class')).toContain('font-mono');
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
test('each alias field writes its own variable; a blank one writes nothing', async () => {
|
|
202
|
+
let saved = '';
|
|
203
|
+
render(
|
|
204
|
+
h(HarnessProviderPanel, {
|
|
205
|
+
support: support({
|
|
206
|
+
level: 'environment',
|
|
207
|
+
env: {
|
|
208
|
+
baseUrl: 'ANTHROPIC_BASE_URL',
|
|
209
|
+
apiKey: 'ANTHROPIC_AUTH_TOKEN',
|
|
210
|
+
model: 'ANTHROPIC_MODEL',
|
|
211
|
+
modelAliases: [
|
|
212
|
+
{ family: 'sonnet', env: 'ANTHROPIC_DEFAULT_SONNET_MODEL' },
|
|
213
|
+
{ family: 'haiku', env: 'ANTHROPIC_DEFAULT_HAIKU_MODEL' },
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
protocols: ['anthropic-messages'],
|
|
217
|
+
importable: [],
|
|
218
|
+
}),
|
|
219
|
+
onSaveEnv: async (env) => {
|
|
220
|
+
saved = env;
|
|
221
|
+
return null;
|
|
222
|
+
},
|
|
223
|
+
}),
|
|
224
|
+
container,
|
|
225
|
+
);
|
|
226
|
+
const inputs = [...container.querySelectorAll('input')] as HTMLInputElement[];
|
|
227
|
+
expect(inputs).toHaveLength(5);
|
|
228
|
+
await act(async () => {
|
|
229
|
+
const values = ['https://kenari.id', 'kn-key', 'qwen3-8-27b:free', 'claude-sonnet-5-5', ''];
|
|
230
|
+
inputs.forEach((input, index) => {
|
|
231
|
+
input.value = values[index]!;
|
|
232
|
+
input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
const save = buttons().find((button) => button.textContent?.includes('Save to environment'))!;
|
|
236
|
+
await act(async () => {
|
|
237
|
+
save.click();
|
|
238
|
+
await Promise.resolve();
|
|
239
|
+
await Promise.resolve();
|
|
240
|
+
});
|
|
241
|
+
expect(saved).toBe([
|
|
242
|
+
'ANTHROPIC_BASE_URL=https://kenari.id',
|
|
243
|
+
'ANTHROPIC_AUTH_TOKEN=kn-key',
|
|
244
|
+
'ANTHROPIC_MODEL=qwen3-8-27b:free',
|
|
245
|
+
'ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5-5',
|
|
246
|
+
].join('\n'));
|
|
247
|
+
expect([...container.querySelectorAll('input')].every((input) => input.value === '')).toBe(true);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
describe('the add-provider form', () => {
|
|
252
|
+
test('the id under the field is the key that will land', async () => {
|
|
253
|
+
render(
|
|
254
|
+
h(HarnessProviderPanel, {
|
|
255
|
+
support: support({ importable: [] }),
|
|
256
|
+
onAddProvider: async () => ({ problem: null, detail: null }),
|
|
257
|
+
}),
|
|
258
|
+
container,
|
|
259
|
+
);
|
|
260
|
+
const open = buttons().find((button) => button.textContent?.includes('Add provider'))!;
|
|
261
|
+
expect(open).toBeDefined();
|
|
262
|
+
await act(async () => {
|
|
263
|
+
open.click();
|
|
264
|
+
await Promise.resolve();
|
|
265
|
+
});
|
|
266
|
+
// Typing a name previews the derived id, so "My Gateway (EU)" is never saved
|
|
267
|
+
// under a name the reader did not see.
|
|
268
|
+
const field = container.querySelector('input') as HTMLInputElement;
|
|
269
|
+
await act(async () => {
|
|
270
|
+
field.value = 'My Gateway (EU)';
|
|
271
|
+
field.dispatchEvent(new Event('input', { bubbles: true }));
|
|
272
|
+
});
|
|
273
|
+
expect(container.textContent).toContain('my-gateway-eu');
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
test('Add is blocked until a name exists, and a failure keeps the values', async () => {
|
|
277
|
+
let calls = 0;
|
|
278
|
+
render(
|
|
279
|
+
h(HarnessProviderPanel, {
|
|
280
|
+
support: support({ importable: [] }),
|
|
281
|
+
onAddProvider: async () => {
|
|
282
|
+
calls += 1;
|
|
283
|
+
return { problem: 'omp-acp cannot speak anthropic-messages', detail: null };
|
|
284
|
+
},
|
|
285
|
+
}),
|
|
286
|
+
container,
|
|
287
|
+
);
|
|
288
|
+
await act(async () => {
|
|
289
|
+
(buttons().find((b) => b.textContent?.includes('Add provider')) as HTMLButtonElement).click();
|
|
290
|
+
await Promise.resolve();
|
|
291
|
+
});
|
|
292
|
+
const add = () => buttons().find((b) => b.textContent?.trim() === 'Add') as HTMLButtonElement;
|
|
293
|
+
expect(add().disabled).toBe(true);
|
|
294
|
+
|
|
295
|
+
const [nameField, urlField] = [...container.querySelectorAll('input')] as HTMLInputElement[];
|
|
296
|
+
await act(async () => {
|
|
297
|
+
nameField!.value = 'Gateway';
|
|
298
|
+
nameField!.dispatchEvent(new Event('input', { bubbles: true }));
|
|
299
|
+
urlField!.value = 'https://gw.example/v1';
|
|
300
|
+
urlField!.dispatchEvent(new Event('input', { bubbles: true }));
|
|
301
|
+
});
|
|
302
|
+
expect(add().disabled).toBe(false);
|
|
303
|
+
await act(async () => {
|
|
304
|
+
add().click();
|
|
305
|
+
await Promise.resolve();
|
|
306
|
+
await Promise.resolve();
|
|
307
|
+
});
|
|
308
|
+
expect(calls).toBe(1);
|
|
309
|
+
expect(container.textContent).toContain('omp-acp cannot speak anthropic-messages');
|
|
310
|
+
// A refusal must NOT clear the form — the reader fixes it and retries.
|
|
311
|
+
expect((container.querySelector('input') as HTMLInputElement).value).toBe('Gateway');
|
|
312
|
+
});
|
|
313
|
+
});
|
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
* `MODEL_ROLE_IDS` at 18.12.6 (read from the installed package,
|
|
15
15
|
* `pi-tui/src/overlays/model-browser.ts`), so an upstream addition surfaces
|
|
16
16
|
* as a failure here rather than as a silently missing row.
|
|
17
|
-
* - **A role row is a
|
|
18
|
-
* box cannot be typed reliably and a typo silently falls
|
|
19
|
-
* resolution.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* - **A role row is a SEARCHABLE picker, not a text field.** A free-text
|
|
18
|
+
* `provider/model` box cannot be typed reliably and a typo silently falls
|
|
19
|
+
* back to omp's own resolution. It is not a native `<select>` either: omp
|
|
20
|
+
* serves 221 models, which the OS popup shows as one scroll box with no
|
|
21
|
+
* filter. The candidates are grouped per provider, only the role's own kinds
|
|
22
|
+
* are offered, and the stored value stays selectable when the catalog no
|
|
23
|
+
* longer lists it.
|
|
22
24
|
* - **The selection and "in use" are two facts.** `in use` is derived by
|
|
23
25
|
* comparing the live map with the preset, so there is no stored "last
|
|
24
26
|
* applied" flag to go stale. The SELECTION survives a hand edit, because it
|
|
@@ -31,6 +33,7 @@ import { Window } from 'happy-dom';
|
|
|
31
33
|
import { h, render } from 'preact';
|
|
32
34
|
import { act } from 'preact/test-utils';
|
|
33
35
|
import { RoleEditor } from '@/client/components/settings/categories/omp-settings/RoleEditor';
|
|
36
|
+
import { openPicker, openRows, pickRole, rolePicker } from '@/client/components/settings/categories/omp-settings/role-picker.test-util';
|
|
34
37
|
import {
|
|
35
38
|
MODEL_ROLES,
|
|
36
39
|
ROLE_IDS,
|
|
@@ -98,7 +101,25 @@ afterAll(() => {
|
|
|
98
101
|
}
|
|
99
102
|
});
|
|
100
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Tear down the previous mount AND its portals.
|
|
106
|
+
*
|
|
107
|
+
* The picker's listbox is portalled to `document.body`, so a test that opens one
|
|
108
|
+
* and moves on leaves it in the DOM — and the next test's `[role="option"]` query
|
|
109
|
+
* then reads rows from a picker nobody is looking at.
|
|
110
|
+
*/
|
|
111
|
+
function cleanup(): void {
|
|
112
|
+
if (container) {
|
|
113
|
+
render(null, container);
|
|
114
|
+
container.remove();
|
|
115
|
+
}
|
|
116
|
+
for (const node of document.querySelectorAll('[role="listbox"]')) {
|
|
117
|
+
node.closest('.fixed')?.remove();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
101
121
|
async function mount(roles: Record<string, string>, overrides: Partial<Parameters<typeof RoleEditor>[0]> = {}): Promise<HTMLElement> {
|
|
122
|
+
cleanup();
|
|
102
123
|
container = document.createElement('div');
|
|
103
124
|
document.body.appendChild(container);
|
|
104
125
|
const props = {
|
|
@@ -127,8 +148,8 @@ describe('role table', () => {
|
|
|
127
148
|
test('the roles the editor used to omit are each offered as a picker', async () => {
|
|
128
149
|
const el = await mount({});
|
|
129
150
|
for (const role of PREVIOUSLY_MISSING) {
|
|
130
|
-
const
|
|
131
|
-
expect(
|
|
151
|
+
const picker = el.querySelector(`button[role="combobox"][aria-label*="(${role})"]`);
|
|
152
|
+
expect(picker, `${role} must be editable`).not.toBeNull();
|
|
132
153
|
}
|
|
133
154
|
});
|
|
134
155
|
|
|
@@ -176,20 +197,36 @@ describe('role candidate rules', () => {
|
|
|
176
197
|
describe('role rows', () => {
|
|
177
198
|
test('the picker groups candidates by provider and carries the stored value', async () => {
|
|
178
199
|
const el = await mount({ default: 'kenari/glm-5' });
|
|
179
|
-
|
|
180
|
-
expect(
|
|
181
|
-
|
|
200
|
+
// The trigger reads the model's NAME, not the stored selector.
|
|
201
|
+
expect(rolePicker(el, 'default').textContent).toContain('GLM-5');
|
|
202
|
+
await openPicker(el, 'default');
|
|
203
|
+
const groups = [...document.querySelectorAll('[role="listbox"] .uppercase')]
|
|
204
|
+
.map((node) => node.textContent?.trim());
|
|
182
205
|
expect(groups).toEqual(['kenari']);
|
|
183
|
-
// "omp default" is always the first
|
|
184
|
-
expect(
|
|
206
|
+
// "omp default" is always the first row — it is how an override is removed.
|
|
207
|
+
expect(openRows()[0]?.textContent).toContain('omp default');
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
test('typing in the picker narrows across providers', async () => {
|
|
211
|
+
const el = await mount({ default: 'kenari/glm-5' });
|
|
212
|
+
await openPicker(el, 'default');
|
|
213
|
+
const search = document.querySelector('input[aria-label^="Search"]') as HTMLInputElement;
|
|
214
|
+
await act(async () => {
|
|
215
|
+
search.value = 'deepseek';
|
|
216
|
+
search.dispatchEvent(new window.Event('input', { bubbles: true }));
|
|
217
|
+
await Promise.resolve();
|
|
218
|
+
});
|
|
219
|
+
const labels = openRows().map((node) => node.textContent);
|
|
220
|
+
expect(labels).toHaveLength(2); // "omp default" + the one match
|
|
221
|
+
expect(labels[1]).toContain('DeepSeek V4 Flash');
|
|
185
222
|
});
|
|
186
223
|
|
|
187
224
|
test('a stored selector the catalog no longer lists stays selectable', async () => {
|
|
188
225
|
const el = await mount({ default: 'gone/model-x' });
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
expect(
|
|
226
|
+
expect(rolePicker(el, 'default').textContent).toContain('gone/model-x (not in catalog)');
|
|
227
|
+
await openPicker(el, 'default');
|
|
228
|
+
// Offered as a row of its own, directly under the empty one.
|
|
229
|
+
expect(openRows()[1]?.textContent).toContain('gone/model-x');
|
|
193
230
|
});
|
|
194
231
|
|
|
195
232
|
test('choosing a model writes the whole map with that role set', async () => {
|
|
@@ -197,11 +234,7 @@ describe('role rows', () => {
|
|
|
197
234
|
const el = await mount({ tiny: 'local/gemma-3-1b' }, {
|
|
198
235
|
onSaveRoles: async (roles) => { writes.push(roles); return true; },
|
|
199
236
|
});
|
|
200
|
-
|
|
201
|
-
await act(async () => {
|
|
202
|
-
select.value = 'kenari/glm-5';
|
|
203
|
-
select.dispatchEvent(new window.Event('change'));
|
|
204
|
-
});
|
|
237
|
+
await pickRole(el, 'default', 'GLM-5');
|
|
205
238
|
expect(writes).toEqual([{ tiny: 'local/gemma-3-1b', default: 'kenari/glm-5' }]);
|
|
206
239
|
});
|
|
207
240
|
|
|
@@ -210,11 +243,7 @@ describe('role rows', () => {
|
|
|
210
243
|
const el = await mount({ default: 'kenari/glm-5', tiny: 'local/gemma-3-1b' }, {
|
|
211
244
|
onSaveRoles: async (roles) => { writes.push(roles); return true; },
|
|
212
245
|
});
|
|
213
|
-
|
|
214
|
-
await act(async () => {
|
|
215
|
-
select.value = '';
|
|
216
|
-
select.dispatchEvent(new window.Event('change'));
|
|
217
|
-
});
|
|
246
|
+
await pickRole(el, 'default', 'omp default');
|
|
218
247
|
expect(writes).toEqual([{ tiny: 'local/gemma-3-1b' }]);
|
|
219
248
|
});
|
|
220
249
|
});
|
|
@@ -244,11 +273,7 @@ describe('presets', () => {
|
|
|
244
273
|
|
|
245
274
|
test('a hand edit keeps the selection and reads modified, so Update stays reachable', async () => {
|
|
246
275
|
const el = await mount({ ...PRESETS[0].roles });
|
|
247
|
-
|
|
248
|
-
await act(async () => {
|
|
249
|
-
select.value = 'kenari/glm-5';
|
|
250
|
-
select.dispatchEvent(new window.Event('change'));
|
|
251
|
-
});
|
|
276
|
+
await pickRole(el, 'default', 'GLM-5');
|
|
252
277
|
const picker = el.querySelector('select[aria-label="Model role preset"]') as HTMLSelectElement;
|
|
253
278
|
expect(picker.value).toBe('p-cheap');
|
|
254
279
|
expect(el.textContent).toContain('modified');
|
|
@@ -262,11 +287,7 @@ describe('presets', () => {
|
|
|
262
287
|
const el = await mount({ ...PRESETS[0].roles }, {
|
|
263
288
|
onUpdatePreset: async (preset) => { updates.push(preset); return true; },
|
|
264
289
|
});
|
|
265
|
-
|
|
266
|
-
await act(async () => {
|
|
267
|
-
select.value = 'kenari/glm-5';
|
|
268
|
-
select.dispatchEvent(new window.Event('change'));
|
|
269
|
-
});
|
|
290
|
+
await pickRole(el, 'default', 'GLM-5');
|
|
270
291
|
const update = [...el.querySelectorAll('button')].find((button) => button.textContent?.includes('Update'))!;
|
|
271
292
|
await act(async () => { update.click(); });
|
|
272
293
|
expect(updates.length).toBe(1);
|
|
@@ -295,10 +316,10 @@ describe('presets', () => {
|
|
|
295
316
|
const el = await mount({ default: 'kenari/glm-5' }, { candidates: [], candidatesError: 'omp binary not found' });
|
|
296
317
|
expect(el.textContent).toContain('Model catalog unavailable');
|
|
297
318
|
expect(el.textContent).toContain('omp binary not found');
|
|
298
|
-
const
|
|
299
|
-
expect(
|
|
319
|
+
const picker = rolePicker(el, 'default');
|
|
320
|
+
expect(picker.disabled).toBe(false);
|
|
300
321
|
// The stored selector survives even with no catalog to draw options from.
|
|
301
|
-
expect(
|
|
322
|
+
expect(picker.textContent).toContain('kenari/glm-5 (not in catalog)');
|
|
302
323
|
});
|
|
303
324
|
|
|
304
325
|
test('a refused write is shown in place', async () => {
|
|
@@ -6,20 +6,22 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* One role row: the role's name, its id, and a MODEL PICKER.
|
|
8
8
|
*
|
|
9
|
-
* A
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* navigation and screen-reader semantics for free. The candidates come from
|
|
14
|
-
* omp's own catalog, so a row can only name a model omp can resolve.
|
|
9
|
+
* A provider-GROUPED picker rather than a text field: the value is a
|
|
10
|
+
* `provider/model` selector, which a user cannot be expected to type correctly
|
|
11
|
+
* (and a typo in `modelRoles` is a role that silently falls back), while the
|
|
12
|
+
* picker offers only models omp's own catalog can resolve.
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
14
|
+
* It is a SEARCHABLE list, not a native `<select>`: omp serves 221 models on this
|
|
15
|
+
* machine, and the OS popup shows them as one scroll box with no filter. The
|
|
16
|
+
* grouping survives as headings, and typing "sonnet" narrows across providers.
|
|
17
|
+
*
|
|
18
|
+
* The current value is always present as a row, even when the catalog no longer
|
|
19
|
+
* lists it (a model removed from models.yml, a provider whose credential was
|
|
20
|
+
* removed, a catalog read that failed): dropping it would show a different model
|
|
21
|
+
* than the config holds, and the next edit would write that one over it.
|
|
21
22
|
*/
|
|
22
23
|
|
|
24
|
+
import { SearchSelect } from '@/client/components/common/search-select';
|
|
23
25
|
import type { ModelRoleCandidate } from '@/shared/types/model-roles';
|
|
24
26
|
import type { ModelRoleInfo } from '@/shared/lib/omp/config/model-roles';
|
|
25
27
|
|
|
@@ -32,20 +34,8 @@ interface RoleRowProps {
|
|
|
32
34
|
onChange: (role: string, value: string) => void;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
/** Candidates grouped by provider, in the order they arrive (already sorted). */
|
|
36
|
-
function groupByProvider(candidates: ModelRoleCandidate[]): Array<{ provider: string; rows: ModelRoleCandidate[] }> {
|
|
37
|
-
const groups: Array<{ provider: string; rows: ModelRoleCandidate[] }> = [];
|
|
38
|
-
for (const candidate of candidates) {
|
|
39
|
-
const last = groups[groups.length - 1];
|
|
40
|
-
if (last && last.provider === candidate.provider) last.rows.push(candidate);
|
|
41
|
-
else groups.push({ provider: candidate.provider, rows: [candidate] });
|
|
42
|
-
}
|
|
43
|
-
return groups;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
37
|
export function RoleRow({ role, info, value, candidates, disabled, onChange }: RoleRowProps) {
|
|
47
38
|
const known = candidates.some((candidate) => candidate.selector === value);
|
|
48
|
-
const groups = groupByProvider(candidates);
|
|
49
39
|
const label = `${info.label} (${role}) model`;
|
|
50
40
|
|
|
51
41
|
return (
|
|
@@ -54,26 +44,27 @@ export function RoleRow({ role, info, value, candidates, disabled, onChange }: R
|
|
|
54
44
|
<div className="font-medium text-ink">{info.label}</div>
|
|
55
45
|
<div className="font-mono text-[10px] text-ink/35">{role}</div>
|
|
56
46
|
</div>
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
title={value || 'omp decides this role'}
|
|
47
|
+
<SearchSelect
|
|
48
|
+
ariaLabel={label}
|
|
60
49
|
value={value}
|
|
50
|
+
// omp decides a role it has no opinion about; that is a real choice, so
|
|
51
|
+
// it is the placeholder row and not an absent value.
|
|
52
|
+
placeholder="omp default"
|
|
53
|
+
onChange={(next) => onChange(role, next)}
|
|
61
54
|
disabled={disabled}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
))}
|
|
76
|
-
</select>
|
|
55
|
+
className="w-60 max-w-[60%]"
|
|
56
|
+
options={[
|
|
57
|
+
// A saved selector the catalog has dropped stays offered: omp still
|
|
58
|
+
// resolves it, and silently swapping it would rewrite the user's role.
|
|
59
|
+
...(value && !known ? [{ value, label: `${value} (not in catalog)` }] : []),
|
|
60
|
+
...candidates.map((candidate) => ({
|
|
61
|
+
value: candidate.selector,
|
|
62
|
+
label: candidate.name,
|
|
63
|
+
hint: candidate.selector,
|
|
64
|
+
group: candidate.provider,
|
|
65
|
+
})),
|
|
66
|
+
]}
|
|
67
|
+
/>
|
|
77
68
|
</div>
|
|
78
69
|
);
|
|
79
70
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Driving a role row's SEARCHABLE picker from a test.
|
|
8
|
+
*
|
|
9
|
+
* The picker's listbox is portalled to `document.body` (`AnchoredMenu`), so it is
|
|
10
|
+
* not a descendant of the mounted container and `container.querySelector` cannot
|
|
11
|
+
* see it. These helpers keep that fact in ONE place: every test that exercises a
|
|
12
|
+
* role picker goes through them, and the day the portal changes, one file moves.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { act } from 'preact/test-utils';
|
|
16
|
+
|
|
17
|
+
/** One role's picker trigger. */
|
|
18
|
+
export function rolePicker(el: HTMLElement, role: string): HTMLButtonElement {
|
|
19
|
+
const node = el.querySelector(`button[role="combobox"][aria-label*="(${role})"]`);
|
|
20
|
+
if (!node) throw new Error(`no picker for role ${role}`);
|
|
21
|
+
return node as HTMLButtonElement;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The rows the OPEN picker is showing, from the portal in `document.body`. */
|
|
25
|
+
export function openRows(): HTMLButtonElement[] {
|
|
26
|
+
return [...document.querySelectorAll('[role="option"]')] as HTMLButtonElement[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function openPicker(el: HTMLElement, role: string): Promise<void> {
|
|
30
|
+
await act(async () => {
|
|
31
|
+
rolePicker(el, role).dispatchEvent(new window.MouseEvent('click', { bubbles: true }));
|
|
32
|
+
await Promise.resolve();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Open a role's picker and commit the row whose label it is. */
|
|
37
|
+
export async function pickRole(el: HTMLElement, role: string, label: string): Promise<void> {
|
|
38
|
+
await openPicker(el, role);
|
|
39
|
+
const row = openRows().find((node) => node.textContent?.includes(label));
|
|
40
|
+
if (!row) throw new Error(`no option "${label}" for role ${role}`);
|
|
41
|
+
await act(async () => {
|
|
42
|
+
row.dispatchEvent(new window.MouseEvent('click', { bubbles: true }));
|
|
43
|
+
await Promise.resolve();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -137,7 +137,7 @@ describe('PluginMark', () => {
|
|
|
137
137
|
const tone = badge?.style.getPropertyValue('--icon-tone') ?? '';
|
|
138
138
|
|
|
139
139
|
expect(tone).toMatch(/^#[0-9a-f]{6}$/);
|
|
140
|
-
expect(tone).toBe(ICON_TONES[hue]);
|
|
140
|
+
expect(tone).toBe(ICON_TONES.deepest[hue]);
|
|
141
141
|
});
|
|
142
142
|
|
|
143
143
|
test('the initials fallback takes the same colour hook as a vector mark', () => {
|