@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,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Providers, as a SURFACE: what each harness can do, what to call it, and how a
|
|
8
|
+
* provider becomes one.
|
|
9
|
+
*
|
|
10
|
+
* The facts (which file, which field, writable or not) live in
|
|
11
|
+
* `provider-facts.ts`, measured against each vendor's own reference. This module
|
|
12
|
+
* turns them into what a card and a form need, and holds the one pure rule that
|
|
13
|
+
* has to agree with the server: how a provider becomes env vars for an
|
|
14
|
+
* `environment` harness.
|
|
15
|
+
*
|
|
16
|
+
* The old `PROVIDER_SUPPORT` table lived here and was WRONG in three places
|
|
17
|
+
* (see `provider-facts.ts`): it invented an `opencode2.json` that does not
|
|
18
|
+
* exist, called codex "no registry" when its own reference documents one, and
|
|
19
|
+
* lumped pi/kimi/qwen/minimax in with it. It is gone rather than patched —
|
|
20
|
+
* two tables would keep disagreeing about the same file.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import type { HarnessId } from '@/shared/lib/harness/catalog';
|
|
24
|
+
import { providerFacts, type ProviderRegistryKind } from '@/shared/lib/harness/provider-facts';
|
|
25
|
+
|
|
26
|
+
/** The level a settings panel is drawn at. */
|
|
27
|
+
export type ProviderSupportLevel = 'full' | 'environment' | 'configurable' | 'none';
|
|
28
|
+
|
|
29
|
+
/** What the user is editing, named the way the agent names it. */
|
|
30
|
+
export function registryLabel(id: string | null | undefined): string {
|
|
31
|
+
const { registry } = providerFacts(id);
|
|
32
|
+
switch (registry.kind) {
|
|
33
|
+
case 'yaml-providers': return 'models.yml (omp)';
|
|
34
|
+
case 'json-provider': return 'opencode.json';
|
|
35
|
+
case 'toml-model-providers': return 'config.toml (codex)';
|
|
36
|
+
case 'json-providers': return 'models.json (pi)';
|
|
37
|
+
case 'toml-providers': return 'config.toml (kimi)';
|
|
38
|
+
case 'json-model-providers': return 'settings.json (qwen)';
|
|
39
|
+
case 'zcode-provider-rules': return 'provider_config.json (zcode)';
|
|
40
|
+
case 'agent-managed': return "the agent's own provider command";
|
|
41
|
+
case 'env': return 'environment variables';
|
|
42
|
+
default: return 'launch command and env';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Which shape the card draws. */
|
|
47
|
+
export function providerLevel(id: string | null | undefined): ProviderSupportLevel {
|
|
48
|
+
const facts = providerFacts(id);
|
|
49
|
+
if (facts.registry.kind === 'env') return 'environment';
|
|
50
|
+
if (facts.registry.kind === 'agent-managed') return 'configurable';
|
|
51
|
+
if (!facts.registry.writable) return facts.registry.kind === 'none' ? 'none' : 'configurable';
|
|
52
|
+
return 'full';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** True when the settings page should draw a registry editor. */
|
|
56
|
+
export function supportsProviderEditor(id: string | null | undefined): boolean {
|
|
57
|
+
return providerLevel(id) === 'full';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The env a provider becomes for an `environment` harness.
|
|
62
|
+
*
|
|
63
|
+
* This is the entire "add a provider" action for Claude Code and Antigravity: a
|
|
64
|
+
* base URL plus a key, under the vendor's own variable names, which is why the
|
|
65
|
+
* form labels each field with the variable it becomes. A blank field writes NO
|
|
66
|
+
* variable — an empty env var is a real thing to set, so the form must not do it
|
|
67
|
+
* by accident.
|
|
68
|
+
*/
|
|
69
|
+
export function providerEnv(
|
|
70
|
+
id: string | null | undefined,
|
|
71
|
+
provider: { baseUrl: string; apiKey: string; model?: string },
|
|
72
|
+
): Record<string, string> {
|
|
73
|
+
const contract = providerFacts(id).env;
|
|
74
|
+
if (!contract) return {};
|
|
75
|
+
const env: Record<string, string> = {};
|
|
76
|
+
if (provider.baseUrl.trim()) env[contract.baseUrl] = provider.baseUrl.trim();
|
|
77
|
+
if (provider.apiKey.trim()) env[contract.apiKey] = provider.apiKey.trim();
|
|
78
|
+
if (contract.model && provider.model?.trim()) env[contract.model] = provider.model.trim();
|
|
79
|
+
return env;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Why a harness's editor is absent, when it is — the sentence the card shows
|
|
84
|
+
* instead of a form.
|
|
85
|
+
*
|
|
86
|
+
* `agent-managed` gets its own wording: a registry EXISTS, Kabmo just must not
|
|
87
|
+
* write it, and telling the reader "nothing to edit" would be false.
|
|
88
|
+
*/
|
|
89
|
+
export function providerAbsenceReason(id: string | null | undefined): string | null {
|
|
90
|
+
const level = providerLevel(id);
|
|
91
|
+
if (level === 'full') return null;
|
|
92
|
+
if (level === 'environment') return null;
|
|
93
|
+
if (level === 'none') return providerFacts(id).summary;
|
|
94
|
+
return providerFacts(id).summary;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The dialect field's VALUE vocabulary, per format.
|
|
99
|
+
*
|
|
100
|
+
* A writer must not invent a value the agent rejects. Each list is the one that
|
|
101
|
+
* format's own reference documents; an empty list means the format has no such
|
|
102
|
+
* field (qwen routes by protocol id, minimax by its own preset).
|
|
103
|
+
*/
|
|
104
|
+
export function dialectChoices(kind: ProviderRegistryKind): readonly { value: string; label: string }[] {
|
|
105
|
+
switch (kind) {
|
|
106
|
+
case 'yaml-providers':
|
|
107
|
+
case 'json-providers':
|
|
108
|
+
// omp's `api` and pi's `api` share the same vocabulary: both are the
|
|
109
|
+
// vendor's own wire-format names.
|
|
110
|
+
return [
|
|
111
|
+
{ value: 'openai-completions', label: 'OpenAI Chat Completions' },
|
|
112
|
+
{ value: 'openai-responses', label: 'OpenAI Responses' },
|
|
113
|
+
{ value: 'anthropic-messages', label: 'Anthropic Messages' },
|
|
114
|
+
{ value: 'google-generative-ai', label: 'Google Generative AI' },
|
|
115
|
+
];
|
|
116
|
+
case 'json-provider':
|
|
117
|
+
// opencode's `npm` IS the dialect: an SDK package name.
|
|
118
|
+
return [
|
|
119
|
+
{ value: '@ai-sdk/openai-compatible', label: 'OpenAI-compatible SDK' },
|
|
120
|
+
{ value: '@ai-sdk/openai', label: 'OpenAI SDK' },
|
|
121
|
+
{ value: '@ai-sdk/anthropic', label: 'Anthropic SDK' },
|
|
122
|
+
{ value: '@ai-sdk/google', label: 'Google SDK' },
|
|
123
|
+
];
|
|
124
|
+
case 'toml-model-providers':
|
|
125
|
+
return [
|
|
126
|
+
{ value: 'chat', label: 'Chat Completions' },
|
|
127
|
+
{ value: 'responses', label: 'Responses' },
|
|
128
|
+
];
|
|
129
|
+
case 'toml-providers':
|
|
130
|
+
return [
|
|
131
|
+
{ value: 'openai_legacy', label: 'OpenAI Chat Completions' },
|
|
132
|
+
{ value: 'openai_responses', label: 'OpenAI Responses' },
|
|
133
|
+
{ value: 'anthropic', label: 'Anthropic' },
|
|
134
|
+
{ value: 'gemini', label: 'Google Gemini' },
|
|
135
|
+
{ value: 'kimi', label: 'Kimi' },
|
|
136
|
+
{ value: 'vertexai', label: 'Google Vertex AI' },
|
|
137
|
+
];
|
|
138
|
+
case 'zcode-provider-rules':
|
|
139
|
+
// The three wire types ZCode's provider reference documents. Google is
|
|
140
|
+
// absent from its own enum, so it is not offered as a choice here.
|
|
141
|
+
return [
|
|
142
|
+
{ value: 'anthropic-messages', label: 'Anthropic Messages' },
|
|
143
|
+
{ value: 'openai-chat-completions', label: 'OpenAI Chat Completions' },
|
|
144
|
+
{ value: 'openai-responses', label: 'OpenAI Responses' },
|
|
145
|
+
];
|
|
146
|
+
default:
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** The label a format gives its own base-URL field, for the form's hint. */
|
|
152
|
+
export function baseUrlFieldLabel(id: string | null | undefined): string {
|
|
153
|
+
const field = providerFacts(id).registry.baseUrlField;
|
|
154
|
+
return field ?? 'base URL';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The label a format gives its own credential field. `env_key` in codex and
|
|
158
|
+
* qwen means the field holds a VARIABLE NAME, not the key itself — which a form
|
|
159
|
+
* has to say out loud or it will store a secret where a name belongs. */
|
|
160
|
+
export function credentialFieldLabel(id: string | null | undefined): string {
|
|
161
|
+
const field = providerFacts(id).registry.apiKeyField;
|
|
162
|
+
if (field === 'env_key' || field === 'envKey') return `${field} (a variable NAME)`;
|
|
163
|
+
return field ?? 'api key';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** True when the credential field holds the name of an environment variable. */
|
|
167
|
+
export function credentialIsEnvName(id: string | null | undefined): boolean {
|
|
168
|
+
const field = providerFacts(id).registry.apiKeyField;
|
|
169
|
+
return field === 'env_key' || field === 'envKey';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** The harnesses whose registries this one can read entries from. */
|
|
173
|
+
export function importSourcesFor(id: string | null | undefined): readonly HarnessId[] {
|
|
174
|
+
return providerFacts(id).importFrom;
|
|
175
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Which harnesses Kabmo can rewind IN PLACE.
|
|
8
|
+
*
|
|
9
|
+
* Undo and Retry truncate the conversation and then re-run a turn, so the
|
|
10
|
+
* agent's own context must be truncatable with it. That is only true where the
|
|
11
|
+
* transcript is the JSONL omp writes — `omp-rpc` and `omp-acp` are the same
|
|
12
|
+
* product over two transports, and the ACP child is torn down before the file
|
|
13
|
+
* is rewritten (the next prompt resumes it over RPC).
|
|
14
|
+
*
|
|
15
|
+
* Every other ACP agent keeps the conversation in its own store, and ACP
|
|
16
|
+
* defines no truncation verb (`session/load` replays the whole history, a fork
|
|
17
|
+
* copies it). Truncating Kabmo's copy there would leave the agent answering
|
|
18
|
+
* from turns the timeline no longer shows — a silent divergence, not a rewind.
|
|
19
|
+
* An UNKNOWN harness keeps the historical allow: the caller has not resolved it
|
|
20
|
+
* yet, and the endpoint answers the real refusal.
|
|
21
|
+
*/
|
|
22
|
+
export function harnessSupportsRewind(harness: string | null | undefined): boolean {
|
|
23
|
+
return !harness || harness === 'omp-rpc' || harness === 'omp-acp';
|
|
24
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What a harness card SAYS about a harness.
|
|
8
|
+
*
|
|
9
|
+
* The card used to print one word — `blocked` — for four unrelated conditions.
|
|
10
|
+
* The fix differs in every one of them (install a package, run a login, press a
|
|
11
|
+
* button, do nothing), so a bare state word told the reader nothing they could
|
|
12
|
+
* act on. These cases pin each state's words, and the precedence between them:
|
|
13
|
+
*
|
|
14
|
+
* - a binary that is not on PATH outranks everything, because there is nothing
|
|
15
|
+
* to authenticate or probe without it;
|
|
16
|
+
* - the sentence names the BINARY, not the harness id — `minimax` is launched by
|
|
17
|
+
* `mcode` and `cursor` by `cursor-agent`, so "minimax is not installed" sends
|
|
18
|
+
* the reader looking for a package that does not exist;
|
|
19
|
+
* - "never probed" is an absence of information, never reported as a problem;
|
|
20
|
+
* - a built-in transport is ready by definition, with no button to press.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { describe, expect, test } from 'bun:test';
|
|
24
|
+
import { harnessStatus } from '@/shared/lib/harness/status';
|
|
25
|
+
import type { HarnessSummary } from '@/shared/types/harness';
|
|
26
|
+
|
|
27
|
+
function summary(overrides: Partial<HarnessSummary> = {}): HarnessSummary {
|
|
28
|
+
return {
|
|
29
|
+
id: 'cursor',
|
|
30
|
+
label: 'cursor',
|
|
31
|
+
transport: 'acp',
|
|
32
|
+
canLaunch: true,
|
|
33
|
+
enabled: true,
|
|
34
|
+
probe: null,
|
|
35
|
+
...overrides,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A probe whose capabilities say exactly what a case needs. */
|
|
40
|
+
function probe(blocked: string | null, agentVersion?: string): HarnessSummary['probe'] {
|
|
41
|
+
return {
|
|
42
|
+
harness: 'cursor',
|
|
43
|
+
capabilities: {
|
|
44
|
+
configModel: 0, configThinking: 0, configMode: 0, modeValues: [],
|
|
45
|
+
loadSession: false, listSessions: false, forkSession: false, deleteSession: false,
|
|
46
|
+
resumeSession: false, closeSession: false, hasUsage: false, hasPlan: false, steerMode: null,
|
|
47
|
+
...(agentVersion ? { agentVersion } : {}),
|
|
48
|
+
...(blocked ? { blocked } : {}),
|
|
49
|
+
},
|
|
50
|
+
models: [],
|
|
51
|
+
thinking: [],
|
|
52
|
+
modes: [],
|
|
53
|
+
probedAt: Date.now(),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
describe('harness status', () => {
|
|
58
|
+
test('a missing binary says WHICH binary, and that it is missing', () => {
|
|
59
|
+
const status = harnessStatus(summary({
|
|
60
|
+
id: 'cursor',
|
|
61
|
+
label: 'cursor',
|
|
62
|
+
canLaunch: false,
|
|
63
|
+
unavailable: '`cursor-agent` is not installed',
|
|
64
|
+
}));
|
|
65
|
+
expect(status.state).toBe('not-installed');
|
|
66
|
+
expect(status.label).toBe('not installed');
|
|
67
|
+
expect(status.detail).toContain('cursor-agent');
|
|
68
|
+
expect(status.detail).toContain('PATH');
|
|
69
|
+
// The binary's own name — the words a user would search a package index for.
|
|
70
|
+
expect(status.detail).not.toBe('blocked');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('the sentence names the launched binary, not the harness id', () => {
|
|
74
|
+
// `minimax` is launched by `mcode`; saying "minimax is not installed" would
|
|
75
|
+
// send the reader looking for a package that does not exist.
|
|
76
|
+
const status = harnessStatus(summary({
|
|
77
|
+
id: 'minimax', label: 'minimax', canLaunch: false, unavailable: '`mcode` is not installed',
|
|
78
|
+
}));
|
|
79
|
+
expect(status.detail).toContain('mcode');
|
|
80
|
+
expect(status.detail).not.toContain('minimax is not installed');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("an agent's own refusal is quoted, not summarised away", () => {
|
|
84
|
+
const status = harnessStatus(summary({
|
|
85
|
+
id: 'claude', label: 'claude',
|
|
86
|
+
probe: probe('Authentication required: run `claude` in a terminal to sign in'),
|
|
87
|
+
}));
|
|
88
|
+
expect(status.state).toBe('needs-setup');
|
|
89
|
+
expect(status.label).toBe('needs setup');
|
|
90
|
+
expect(status.detail).toContain('run `claude` in a terminal to sign in');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('a probed harness is ready, and says the version it answered as', () => {
|
|
94
|
+
const status = harnessStatus(summary({ probe: probe(null, '18.14.0') }));
|
|
95
|
+
expect(status.state).toBe('ready');
|
|
96
|
+
expect(status.label).toBe('ready');
|
|
97
|
+
expect(status.detail).toContain('18.14.0');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('an AGED probe is still ready, and says how old it is', () => {
|
|
101
|
+
// The reported bug: a stored record past the TTL used to be reported as
|
|
102
|
+
// `not probed`, so a harness the user had checked an hour earlier looked
|
|
103
|
+
// like one that had never answered. It keeps its state and gains its age.
|
|
104
|
+
const aged = probe(null, '18.14.0');
|
|
105
|
+
const status = harnessStatus(summary({
|
|
106
|
+
probe: { ...(aged as NonNullable<HarnessSummary['probe']>), probedAt: Date.now() - 61 * 60_000, stale: true },
|
|
107
|
+
}));
|
|
108
|
+
expect(status.state).toBe('ready');
|
|
109
|
+
expect(status.label).toBe('ready (aged)');
|
|
110
|
+
expect(status.detail).toContain('18.14.0');
|
|
111
|
+
expect(status.detail).toContain('Check status');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('never probed is unknown, NOT a problem', () => {
|
|
115
|
+
const status = harnessStatus(summary());
|
|
116
|
+
expect(status.state).toBe('unprobed');
|
|
117
|
+
expect(status.label).toBe('not probed');
|
|
118
|
+
// It names the action that resolves it rather than implying a failure.
|
|
119
|
+
expect(status.detail).toContain('Check status');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('the built-in transport is ready by definition', () => {
|
|
123
|
+
const status = harnessStatus(summary({ id: 'omp-rpc', label: 'omp', transport: 'rpc', builtIn: true }));
|
|
124
|
+
expect(status.state).toBe('ready');
|
|
125
|
+
expect(status.label).toBe('built in');
|
|
126
|
+
expect(status.detail).toContain('nothing to install');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('a missing binary outranks a stale refusal in the same record', () => {
|
|
130
|
+
// A probe cached before the binary was removed, or one that reports an auth
|
|
131
|
+
// error that no longer matters: with no binary on disk, "install it" is the
|
|
132
|
+
// only true instruction.
|
|
133
|
+
const status = harnessStatus(summary({
|
|
134
|
+
canLaunch: false,
|
|
135
|
+
unavailable: '`cursor-agent` is not installed',
|
|
136
|
+
probe: probe('Authentication required'),
|
|
137
|
+
}));
|
|
138
|
+
expect(status.state).toBe('not-installed');
|
|
139
|
+
expect(status.detail).toContain('cursor-agent');
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test('no state ever renders the bare word "blocked"', () => {
|
|
143
|
+
// The shipped defect, as an assertion: the word appeared alone for four
|
|
144
|
+
// different conditions.
|
|
145
|
+
const cases: HarnessSummary[] = [
|
|
146
|
+
summary(),
|
|
147
|
+
summary({ canLaunch: false, unavailable: '`cursor-agent` is not installed' }),
|
|
148
|
+
summary({ probe: probe('Authentication required') }),
|
|
149
|
+
summary({ probe: probe(null, '1.0.0') }),
|
|
150
|
+
summary({ builtIn: true }),
|
|
151
|
+
];
|
|
152
|
+
for (const entry of cases) {
|
|
153
|
+
const status = harnessStatus(entry);
|
|
154
|
+
expect(status.label).not.toBe('blocked');
|
|
155
|
+
expect(status.detail ?? '').not.toBe('blocked');
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What a harness's status actually IS, as data.
|
|
8
|
+
*
|
|
9
|
+
* The settings card used to render one word — `blocked` — for four unrelated
|
|
10
|
+
* conditions: a binary that is not on PATH, an agent that is installed but
|
|
11
|
+
* refuses to start until you log in, a probe that has never run, and a transport
|
|
12
|
+
* Kabmo ships itself. The reader learned nothing and the fix differed in every
|
|
13
|
+
* case: install a package, run a login command, press a button, or do nothing.
|
|
14
|
+
*
|
|
15
|
+
* So the state is derived once, here, from facts the card already has:
|
|
16
|
+
*
|
|
17
|
+
* - `builtIn` — no agent to install or probe (omp over RPC);
|
|
18
|
+
* - `canLaunch` false — the launch command's binary is not resolvable;
|
|
19
|
+
* - a probe the AGENT refused (`capabilities.blocked`) — auth, licence, a
|
|
20
|
+
* broken plugin;
|
|
21
|
+
* - a probe that answered — ready, with the version it reported;
|
|
22
|
+
* - nothing — never probed, which is an absence of information, not a problem.
|
|
23
|
+
*
|
|
24
|
+
* The order is the precedence: a missing binary outranks a stale refusal (there
|
|
25
|
+
* is nothing to authenticate against with no binary on disk), and a refusal
|
|
26
|
+
* outranks "not probed" (something did answer).
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import type { HarnessSummary } from '@/shared/types/harness';
|
|
30
|
+
|
|
31
|
+
export type HarnessState =
|
|
32
|
+
/** Installed and answering. */
|
|
33
|
+
| 'ready'
|
|
34
|
+
/** The launch command's first token is not on PATH. */
|
|
35
|
+
| 'not-installed'
|
|
36
|
+
/** Installed, but the agent refuses until the user does something (auth, …). */
|
|
37
|
+
| 'needs-setup'
|
|
38
|
+
/** Never probed: unknown, not wrong. */
|
|
39
|
+
| 'unprobed';
|
|
40
|
+
|
|
41
|
+
export interface HarnessStatus {
|
|
42
|
+
state: HarnessState;
|
|
43
|
+
/** The chip's words — short enough for a header row. */
|
|
44
|
+
label: string;
|
|
45
|
+
/** The concrete sentence: what is missing, stated with the binary's own name.
|
|
46
|
+
* Null only for `ready`, where the version (or nothing) is the whole story. */
|
|
47
|
+
detail: string | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The first token of a launch command, for naming what is missing. */
|
|
51
|
+
function missingBinary(unavailable: string | undefined, id: string): string {
|
|
52
|
+
if (!unavailable) return id;
|
|
53
|
+
const match = /`([^`]+)`/.exec(unavailable);
|
|
54
|
+
return match?.[1] ?? id;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Derive the status a card should show. */
|
|
58
|
+
export function harnessStatus(summary: HarnessSummary): HarnessStatus {
|
|
59
|
+
if (summary.builtIn) {
|
|
60
|
+
return {
|
|
61
|
+
state: 'ready',
|
|
62
|
+
label: 'built in',
|
|
63
|
+
detail: 'Kabmo runs this transport itself — nothing to install or probe.',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!summary.canLaunch) {
|
|
68
|
+
const binary = missingBinary(summary.unavailable, summary.id);
|
|
69
|
+
return {
|
|
70
|
+
state: 'not-installed',
|
|
71
|
+
label: 'not installed',
|
|
72
|
+
// The binary's OWN name, not the harness id: `minimax` is launched by
|
|
73
|
+
// `mcode` and `cursor` by `cursor-agent`, so "minimax is not installed"
|
|
74
|
+
// would send the reader looking for a package that does not exist.
|
|
75
|
+
detail: `${summary.label}: \`${binary}\` was not found on PATH, so it cannot be launched.`,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const blocked = summary.probe?.capabilities.blocked;
|
|
80
|
+
if (blocked) {
|
|
81
|
+
return { state: 'needs-setup', label: 'needs setup', detail: `${summary.label}: ${blocked}` };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (summary.probe) {
|
|
85
|
+
const agentVersion = summary.probe.capabilities.agentVersion;
|
|
86
|
+
const version = agentVersion ? `answered as version ${agentVersion}` : 'answered';
|
|
87
|
+
// An AGED record is still the last real answer, so the state stays `ready`
|
|
88
|
+
// (or `needs setup`, above) — but the sentence says WHEN, because a version
|
|
89
|
+
// reported an hour ago describes the binary as it was an hour ago and the
|
|
90
|
+
// user needs to know that before trusting an update decision.
|
|
91
|
+
if (summary.probe.stale) {
|
|
92
|
+
const minutes = Math.max(1, Math.round((Date.now() - summary.probe.probedAt) / 60_000));
|
|
93
|
+
const age = minutes < 60 ? `${minutes} min` : `${Math.round(minutes / 60)} h`;
|
|
94
|
+
return {
|
|
95
|
+
state: 'ready',
|
|
96
|
+
label: 'ready (aged)',
|
|
97
|
+
detail: `${summary.label} ${version} ${age} ago. Press Check status to read the version on disk now.`,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
state: 'ready',
|
|
102
|
+
label: 'ready',
|
|
103
|
+
detail: version ? `${summary.label} answered as version ${agentVersion}.` : null,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
state: 'unprobed',
|
|
109
|
+
label: 'not probed',
|
|
110
|
+
detail: `${summary.label} has not answered yet — press Check status to ask it for its models and session features.`,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Which parts of a harness an update moves.
|
|
8
|
+
*
|
|
9
|
+
* The reported defect: pressing Update on `claude` ran an npm install AND
|
|
10
|
+
* `claude update` every time, so an adapter that was already current was
|
|
11
|
+
* reinstalled and the success message named a version that never moved. The rule
|
|
12
|
+
* is per PART — an adapter and the CLI under it move independently — so these
|
|
13
|
+
* cases pin exactly which argv come back for each combination:
|
|
14
|
+
*
|
|
15
|
+
* - both behind → the adapter install, then the CLI's own updater;
|
|
16
|
+
* - only the CLI behind → the CLI's updater alone;
|
|
17
|
+
* - only the adapter behind → the npm install alone;
|
|
18
|
+
* - neither → nothing at all.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { describe, expect, test } from 'bun:test';
|
|
22
|
+
import {
|
|
23
|
+
planHarnessUpdate,
|
|
24
|
+
repointAdapterLaunch,
|
|
25
|
+
type HarnessUpdateStep,
|
|
26
|
+
type UpdatePlanState,
|
|
27
|
+
} from '@/shared/lib/harness/update-plan';
|
|
28
|
+
import { harnessUpdateFacts } from '@/shared/lib/harness/updates';
|
|
29
|
+
|
|
30
|
+
const CLAUDE = harnessUpdateFacts('claude');
|
|
31
|
+
|
|
32
|
+
function state(overrides: Partial<UpdatePlanState> = {}): UpdatePlanState {
|
|
33
|
+
return {
|
|
34
|
+
installed: true,
|
|
35
|
+
agent: { version: '0.100.0', latest: '0.101.0' },
|
|
36
|
+
cli: { name: 'Claude Code', version: '2.1.318', latest: '2.1.400' },
|
|
37
|
+
...overrides,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
describe('repointing a launch line after an adapter install', () => {
|
|
42
|
+
const install: HarnessUpdateStep = {
|
|
43
|
+
part: 'adapter',
|
|
44
|
+
command: 'npm install -g @agentclientprotocol/claude-agent-acp@0.101.0',
|
|
45
|
+
argv: ['npm', 'install', '-g', '@agentclientprotocol/claude-agent-acp@0.101.0'],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
test('a pinned npx adapter is pointed at the binary the install wrote', () => {
|
|
49
|
+
// The launch requests 0.100.0; the install wrote 0.101.0. Without this, the
|
|
50
|
+
// press reports success and every new session still starts the pinned build.
|
|
51
|
+
expect(repointAdapterLaunch(CLAUDE, [install], '', true)).toBe('claude-agent-acp');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('a user command is never replaced', () => {
|
|
55
|
+
expect(repointAdapterLaunch(CLAUDE, [install], '/opt/bin/my-claude-wrapper', true)).toBeNull();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('no install step, no repoint', () => {
|
|
59
|
+
expect(repointAdapterLaunch(CLAUDE, [], '', true)).toBeNull();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('a binary that did not land on PATH is not claimed', () => {
|
|
63
|
+
expect(repointAdapterLaunch(CLAUDE, [install], '', false)).toBeNull();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('planning a harness update', () => {
|
|
68
|
+
test('both parts behind runs the install AND the CLI updater, in that order', () => {
|
|
69
|
+
const steps = planHarnessUpdate('claude', CLAUDE, state(), '0.100.0');
|
|
70
|
+
expect(steps.map((step) => step.argv[0])).toEqual(['npm', 'claude']);
|
|
71
|
+
expect(steps[0].argv).toEqual(['npm', 'install', '-g', '@agentclientprotocol/claude-agent-acp@0.101.0']);
|
|
72
|
+
expect(steps[0].part).toBe('adapter');
|
|
73
|
+
expect(steps[1].argv).toEqual(['claude', 'update']);
|
|
74
|
+
expect(steps[1].part).toBe('Claude Code');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('ONLY the CLI behind installs no adapter at all', () => {
|
|
78
|
+
// The half that was missing: the adapter is current, so nothing on npm runs —
|
|
79
|
+
// but the CLI underneath is still stale and must move.
|
|
80
|
+
const steps = planHarnessUpdate(
|
|
81
|
+
'claude',
|
|
82
|
+
CLAUDE,
|
|
83
|
+
state({ agent: { version: '0.101.0', latest: '0.101.0' } }),
|
|
84
|
+
'0.101.0',
|
|
85
|
+
);
|
|
86
|
+
expect(steps).toHaveLength(1);
|
|
87
|
+
expect(steps[0].argv).toEqual(['claude', 'update']);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('ONLY the adapter behind does not run the CLI updater', () => {
|
|
91
|
+
const steps = planHarnessUpdate(
|
|
92
|
+
'claude',
|
|
93
|
+
CLAUDE,
|
|
94
|
+
state({ cli: { name: 'Claude Code', version: '2.1.400', latest: '2.1.400' } }),
|
|
95
|
+
'0.100.0',
|
|
96
|
+
);
|
|
97
|
+
expect(steps).toHaveLength(1);
|
|
98
|
+
expect(steps[0].argv).toEqual(['npm', 'install', '-g', '@agentclientprotocol/claude-agent-acp@0.101.0']);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('nothing behind plans nothing, so the route can say "already up to date"', () => {
|
|
102
|
+
const steps = planHarnessUpdate(
|
|
103
|
+
'claude',
|
|
104
|
+
CLAUDE,
|
|
105
|
+
state({ agent: { version: '0.101.0', latest: '0.101.0' }, cli: { name: 'Claude Code', version: '2.1.400', latest: '2.1.400' } }),
|
|
106
|
+
'0.101.0',
|
|
107
|
+
);
|
|
108
|
+
expect(steps).toEqual([]);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test('a part whose latest version is UNKNOWN is never planned', () => {
|
|
112
|
+
// Kabmo cannot read a registry number for it, so it cannot claim it is behind.
|
|
113
|
+
const steps = planHarnessUpdate(
|
|
114
|
+
'claude',
|
|
115
|
+
CLAUDE,
|
|
116
|
+
state({ cli: { name: 'Claude Code', version: '2.1.318', latest: null } }),
|
|
117
|
+
'0.101.0',
|
|
118
|
+
);
|
|
119
|
+
expect(steps).toEqual([]);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('a harness that is not installed plans nothing', () => {
|
|
123
|
+
expect(planHarnessUpdate('claude', CLAUDE, state({ installed: false }), '0.100.0')).toEqual([]);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test('an unprobed adapter is planned, because a press means "make it current"', () => {
|
|
127
|
+
// With no probe there is no number to compare; answering "already up to date"
|
|
128
|
+
// would be a fabricated fact, so the install runs and the route says so.
|
|
129
|
+
const steps = planHarnessUpdate('claude', CLAUDE, state(), null);
|
|
130
|
+
expect(steps[0].argv[0]).toBe('npm');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('an npm CLI with no vendor updater moves through its own package', () => {
|
|
134
|
+
// `dsh` reports the ACP surface (0.0.1) while `dsh --version` is 0.2.2-rc.1;
|
|
135
|
+
// the CLI carries the package and has no `dsh update`. Leaving this half out
|
|
136
|
+
// made every press compare the adapter's version to the CLI's package.
|
|
137
|
+
const steps = planHarnessUpdate(
|
|
138
|
+
'deepseek-harness',
|
|
139
|
+
harnessUpdateFacts('dsh'),
|
|
140
|
+
{
|
|
141
|
+
installed: true,
|
|
142
|
+
agent: { version: '0.0.1', latest: null },
|
|
143
|
+
cli: { name: 'deepseek-harness', version: '0.2.2-rc.1', latest: '0.3.0' },
|
|
144
|
+
},
|
|
145
|
+
'0.0.1',
|
|
146
|
+
);
|
|
147
|
+
expect(steps).toHaveLength(1);
|
|
148
|
+
expect(steps[0].part).toBe('deepseek-harness');
|
|
149
|
+
expect(steps[0].argv).toEqual(['npm', 'install', '-g', '@deepseek-ai/dsh@0.3.0']);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test('a plain npm harness names itself, not "adapter"', () => {
|
|
153
|
+
const steps = planHarnessUpdate(
|
|
154
|
+
'qwen',
|
|
155
|
+
harnessUpdateFacts('qwen'),
|
|
156
|
+
{ installed: true, agent: { version: '0.9.0', latest: '0.10.0' }, cli: null },
|
|
157
|
+
'0.9.0',
|
|
158
|
+
);
|
|
159
|
+
expect(steps).toHaveLength(1);
|
|
160
|
+
expect(steps[0].part).toBe('qwen');
|
|
161
|
+
expect(steps[0].argv).toEqual(['npm', 'install', '-g', '@qwen-code/qwen-code@0.10.0']);
|
|
162
|
+
});
|
|
163
|
+
});
|