@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,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The boot pass: every restart re-checks the harnesses the user keeps ON.
|
|
8
|
+
*
|
|
9
|
+
* The requirement is a ROSTER question before it is a probe question, so the
|
|
10
|
+
* cases here hold the selection: off means not spawned, built-in means not
|
|
11
|
+
* spawned, a missing launch command means not spawned. Only then "and the answer
|
|
12
|
+
* is stored" — the settings card reads the cache, not this pass.
|
|
13
|
+
*
|
|
14
|
+
* The seams (`ids`, `available`, `probe`) exist for these tests: a real probe
|
|
15
|
+
* spawns an agent, and a suite that depends on which binaries a runner happens to
|
|
16
|
+
* have is a suite that fails only on CI. The production defaults are the real
|
|
17
|
+
* catalog, `commandAvailable` and `probeWithConfig`.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { afterAll, afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
21
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
22
|
+
import {
|
|
23
|
+
autoProbeTargets,
|
|
24
|
+
runAutoProbe,
|
|
25
|
+
type AutoProbeOptions,
|
|
26
|
+
} from '@/server/lib/harness/auto-probe.server';
|
|
27
|
+
import type { HarnessProbe } from '@/server/lib/harness/capabilities';
|
|
28
|
+
import { loadProbes, probes } from '@/server/lib/harness/probe-cache.server';
|
|
29
|
+
import { saveHarnessEnabled } from '@/server/lib/harness/enabled.server';
|
|
30
|
+
import type { HarnessId } from '@/shared/lib/harness/catalog';
|
|
31
|
+
|
|
32
|
+
function probe(id: HarnessId): HarnessProbe {
|
|
33
|
+
return {
|
|
34
|
+
harness: id,
|
|
35
|
+
capabilities: {
|
|
36
|
+
configModel: 5, configThinking: 6, configMode: 5, modeValues: ['plan'],
|
|
37
|
+
loadSession: true, listSessions: true, forkSession: true, deleteSession: false,
|
|
38
|
+
resumeSession: true, closeSession: true, hasUsage: false, hasPlan: false, steerMode: null,
|
|
39
|
+
agentVersion: '1.0.0',
|
|
40
|
+
},
|
|
41
|
+
models: [], thinking: [], modes: [], probedAt: Date.now(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const allAvailable = (): boolean => true;
|
|
46
|
+
|
|
47
|
+
beforeEach(async () => {
|
|
48
|
+
await isolateDb();
|
|
49
|
+
probes().clear();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
afterEach(async () => {
|
|
53
|
+
await releaseDb();
|
|
54
|
+
probes().clear();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
afterAll(async () => {
|
|
58
|
+
await releaseDb();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe('autoProbeTargets', () => {
|
|
62
|
+
test('skips a switched-off harness and the built-in transport', async () => {
|
|
63
|
+
await saveHarnessEnabled('claude', false);
|
|
64
|
+
const checked: string[] = [];
|
|
65
|
+
const targets = await autoProbeTargets({
|
|
66
|
+
ids: ['omp-rpc', 'omp-acp', 'claude'],
|
|
67
|
+
available: (id) => {
|
|
68
|
+
checked.push(id);
|
|
69
|
+
return true;
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
expect(targets).toEqual(['omp-acp']);
|
|
73
|
+
// The built-in transport never reaches the availability check: there is no
|
|
74
|
+
// agent behind it to ask about.
|
|
75
|
+
expect(checked).toEqual(['omp-acp']);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('skips a harness whose launch command is not resolvable', async () => {
|
|
79
|
+
const targets = await autoProbeTargets({
|
|
80
|
+
ids: ['omp-acp', 'claude', 'cursor'],
|
|
81
|
+
available: (id) => id === 'omp-acp',
|
|
82
|
+
});
|
|
83
|
+
expect(targets).toEqual(['omp-acp']);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('runAutoProbe', () => {
|
|
88
|
+
test('probes every target and stores each answer', async () => {
|
|
89
|
+
const seen: HarnessId[] = [];
|
|
90
|
+
const options: AutoProbeOptions = {
|
|
91
|
+
ids: ['omp-acp', 'claude'],
|
|
92
|
+
cwd: '/tmp',
|
|
93
|
+
available: allAvailable,
|
|
94
|
+
probe: async (id, cwd) => {
|
|
95
|
+
expect(cwd).toBe('/tmp');
|
|
96
|
+
seen.push(id);
|
|
97
|
+
return probe(id);
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
const outcome = await runAutoProbe(options);
|
|
101
|
+
expect(outcome.failed).toEqual([]);
|
|
102
|
+
expect(outcome.probed).toEqual(['omp-acp', 'claude']);
|
|
103
|
+
expect(seen).toEqual(['omp-acp', 'claude']);
|
|
104
|
+
expect((await loadProbes()).get('claude')?.capabilities.agentVersion).toBe('1.0.0');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('a probe that throws is reported and does not stop the pass', async () => {
|
|
108
|
+
const outcome = await runAutoProbe({
|
|
109
|
+
ids: ['omp-acp', 'claude'],
|
|
110
|
+
available: allAvailable,
|
|
111
|
+
probe: async (id) => {
|
|
112
|
+
if (id === 'omp-acp') throw new Error('boom');
|
|
113
|
+
return probe(id);
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
expect(outcome.failed).toEqual([{ id: 'omp-acp', error: 'boom' }]);
|
|
117
|
+
expect(outcome.probed).toEqual(['claude']);
|
|
118
|
+
expect(probes().has('omp-acp')).toBe(false);
|
|
119
|
+
expect(probes().has('claude')).toBe(true);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Running a harness probe, and the boot pass that refreshes every ON harness.
|
|
8
|
+
*
|
|
9
|
+
* Three callers need the config-aware probe: the settings route's Check status,
|
|
10
|
+
* switching a harness on, and this module's startup pass. It cannot live in a
|
|
11
|
+
* route (`routes/harness/root.ts` used to own it) because the boot clock is not
|
|
12
|
+
* a request and a route must not be the import of the startup path.
|
|
13
|
+
*
|
|
14
|
+
* **The startup pass is per PROCESS, not per module evaluation.** A `bun --hot`
|
|
15
|
+
* reload re-runs the server entry, and a probe spawns an agent process; without
|
|
16
|
+
* the `globalThis` pid guard every edit during development would start one agent
|
|
17
|
+
* per enabled harness. A real restart is a new pid and therefore a fresh pass,
|
|
18
|
+
* which is the moment the requirement names: every Kabmo restart re-checks the
|
|
19
|
+
* harnesses the user keeps ON.
|
|
20
|
+
*
|
|
21
|
+
* It runs in the BACKGROUND. A probe can take a minute (an agent that has to
|
|
22
|
+
* authenticate, a wrapper that resolves a container), and the listener is
|
|
23
|
+
* already accepting requests — boot must not wait for twelve agents to answer.
|
|
24
|
+
*
|
|
25
|
+
* Which harnesses are checked:
|
|
26
|
+
*
|
|
27
|
+
* - switched OFF (`omp_harness_disabled`) is skipped — the roster is the user's
|
|
28
|
+
* answer, and probing an agent they hid would start a process for a tab they
|
|
29
|
+
* never see;
|
|
30
|
+
* - the built-in `omp-rpc` transport is skipped: there is no agent to spawn;
|
|
31
|
+
* - a harness whose launch command is not resolvable is skipped for the same
|
|
32
|
+
* measured reason as the toggle route: the card already says "not installed",
|
|
33
|
+
* and spawning a missing binary only reports that fact again.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
import type { HarnessProbe } from '@/server/lib/harness/capabilities';
|
|
37
|
+
import {
|
|
38
|
+
launchFromConfig,
|
|
39
|
+
loadHarnessConfig,
|
|
40
|
+
resolveLaunch,
|
|
41
|
+
} from '@/server/lib/harness/config.server';
|
|
42
|
+
import type { HarnessConfig } from '@/shared/lib/harness/config';
|
|
43
|
+
import { loadDisabledHarnesses } from '@/server/lib/harness/enabled.server';
|
|
44
|
+
import { blockedProbe, probeHarness } from '@/server/lib/harness/launch';
|
|
45
|
+
import { HARNESS_LAUNCH, harnessRequirementMet, type HarnessLaunch } from '@/server/lib/harness/launch-table';
|
|
46
|
+
import { resolveOmpBin } from '@/server/lib/omp/core/cli';
|
|
47
|
+
import { rememberProbe } from '@/server/lib/harness/probe-cache.server';
|
|
48
|
+
import { HARNESS_IDS, harnessDescriptor, type HarnessId } from '@/shared/lib/harness/catalog';
|
|
49
|
+
import { harnessEnabled } from '@/shared/lib/harness/enabled';
|
|
50
|
+
|
|
51
|
+
declare global {
|
|
52
|
+
// eslint-disable-next-line no-var
|
|
53
|
+
var __kabmoHarnessAutoProbePid: number | undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Is a launch command first-token resolvable? The omp binary has its own
|
|
58
|
+
* resolver (KABMO_OMP_BIN, then PATH) and is never "missing" through PATH alone.
|
|
59
|
+
*
|
|
60
|
+
* The USER's command override decides this, not the build's table: a harness
|
|
61
|
+
* whose binary lives behind a wrapper, a container (`docker run … agy acp`) or an
|
|
62
|
+
* absolute path read as "not installed" and could not even be switched on, while
|
|
63
|
+
* a spawn of that same configured command worked.
|
|
64
|
+
*/
|
|
65
|
+
export function commandAvailable(id: HarnessId, config?: HarnessConfig): boolean {
|
|
66
|
+
if (id === 'omp-acp') return Boolean(resolveOmpBin());
|
|
67
|
+
let launch: HarnessLaunch | undefined = HARNESS_LAUNCH[id];
|
|
68
|
+
if (config) {
|
|
69
|
+
try {
|
|
70
|
+
const configured = launchFromConfig(id, config);
|
|
71
|
+
if (configured) launch = configured;
|
|
72
|
+
} catch {
|
|
73
|
+
// An unusable env line is reported by the probe; availability falls back
|
|
74
|
+
// to the build's table rather than claiming "not installed".
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const [binary] = launch?.command ?? [];
|
|
78
|
+
if (!binary) return false;
|
|
79
|
+
// An adapter can need a binary it SPAWNS rather than execs: the zcode bridge
|
|
80
|
+
// starts `zcode app-server --stdio`, so `npx` being present says nothing.
|
|
81
|
+
if (!harnessRequirementMet(launch?.requires, launch?.env)) return false;
|
|
82
|
+
if (binary === 'npx') return Boolean(Bun.which('npx') ?? Bun.which('node'));
|
|
83
|
+
return Boolean(Bun.which(binary));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Probe a harness the way a SPAWN would launch it: the user's command and env
|
|
88
|
+
* override are part of what is being measured.
|
|
89
|
+
*
|
|
90
|
+
* Without this, a harness that only works with its configured env — `CODEX_HOME`,
|
|
91
|
+
* a provider base URL, a wrapper that logs in — probed as "Authentication
|
|
92
|
+
* required" in Settings while its chats ran fine. A launch line that cannot even
|
|
93
|
+
* be resolved (an invalid env line) answers a `blocked` record instead of a 500.
|
|
94
|
+
*/
|
|
95
|
+
export async function probeWithConfig(id: HarnessId, cwd: string): Promise<HarnessProbe> {
|
|
96
|
+
try {
|
|
97
|
+
const configured = await loadHarnessConfig(id);
|
|
98
|
+
return await probeHarness(id, cwd, resolveLaunch(id, configured));
|
|
99
|
+
} catch (cause) {
|
|
100
|
+
return blockedProbe(id, cause instanceof Error ? cause.message : String(cause));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Seams for the tests: the real catalog, availability and probe by default. */
|
|
105
|
+
export interface AutoProbeOptions {
|
|
106
|
+
cwd?: string;
|
|
107
|
+
ids?: readonly HarnessId[];
|
|
108
|
+
available?: (id: HarnessId, config: HarnessConfig) => boolean;
|
|
109
|
+
probe?: (id: HarnessId, cwd: string) => Promise<HarnessProbe>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** The harnesses the user keeps ON that this machine can actually launch. */
|
|
113
|
+
export async function autoProbeTargets(
|
|
114
|
+
options: Pick<AutoProbeOptions, 'ids' | 'available'> = {},
|
|
115
|
+
): Promise<HarnessId[]> {
|
|
116
|
+
const ids = options.ids ?? HARNESS_IDS;
|
|
117
|
+
const available = options.available ?? commandAvailable;
|
|
118
|
+
const disabled = await loadDisabledHarnesses();
|
|
119
|
+
const targets: HarnessId[] = [];
|
|
120
|
+
for (const id of ids) {
|
|
121
|
+
if (harnessDescriptor(id)?.builtIn) continue;
|
|
122
|
+
if (!harnessEnabled(id, disabled)) continue;
|
|
123
|
+
const config = await loadHarnessConfig(id);
|
|
124
|
+
if (!available(id, config)) continue;
|
|
125
|
+
targets.push(id);
|
|
126
|
+
}
|
|
127
|
+
return targets;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** What one boot pass did, for the log line and for the tests. */
|
|
131
|
+
export interface AutoProbeOutcome {
|
|
132
|
+
probed: HarnessId[];
|
|
133
|
+
failed: Array<{ id: HarnessId; error: string }>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Probe every target, one at a time, and write each answer to the cache.
|
|
138
|
+
*
|
|
139
|
+
* Sequential on purpose: these are agent processes, and a boot that starts one
|
|
140
|
+
* per installed harness at once competes with the chat the user just opened. A
|
|
141
|
+
* failure on one harness is recorded and the pass continues — the others still
|
|
142
|
+
* deserve their answer.
|
|
143
|
+
*/
|
|
144
|
+
export async function runAutoProbe(options: AutoProbeOptions = {}): Promise<AutoProbeOutcome> {
|
|
145
|
+
const cwd = options.cwd ?? process.cwd();
|
|
146
|
+
const probe = options.probe ?? probeWithConfig;
|
|
147
|
+
const targets = await autoProbeTargets(options);
|
|
148
|
+
const outcome: AutoProbeOutcome = { probed: [], failed: [] };
|
|
149
|
+
for (const id of targets) {
|
|
150
|
+
try {
|
|
151
|
+
await rememberProbe(id, await probe(id, cwd));
|
|
152
|
+
outcome.probed.push(id);
|
|
153
|
+
} catch (error) {
|
|
154
|
+
outcome.failed.push({ id, error: error instanceof Error ? error.message : String(error) });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return outcome;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Start the boot pass. Idempotent within one process — a `bun --hot` reload must
|
|
162
|
+
* not spawn the agents again — and never awaited, because boot does not wait for
|
|
163
|
+
* an agent to answer.
|
|
164
|
+
*/
|
|
165
|
+
export function startHarnessAutoProbe(): void {
|
|
166
|
+
if (globalThis.__kabmoHarnessAutoProbePid === process.pid) return;
|
|
167
|
+
globalThis.__kabmoHarnessAutoProbePid = process.pid;
|
|
168
|
+
void runAutoProbe()
|
|
169
|
+
.then(({ probed, failed }) => {
|
|
170
|
+
if (probed.length > 0) console.log(`[harness] probed on boot: ${probed.join(', ')}`);
|
|
171
|
+
for (const failure of failed) {
|
|
172
|
+
console.error(`[harness] ${failure.id}: boot probe failed — ${failure.error}`);
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
.catch((error) => {
|
|
176
|
+
console.error('[harness] boot probe skipped:', error);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The capability set an agent advertised at `initialize`, plus the two facts
|
|
8
|
+
* Kabmo derives from it.
|
|
9
|
+
*
|
|
10
|
+
* Rendered by the settings page, read by every panel's show/hide decision, and
|
|
11
|
+
* cached per harness for the process lifetime — spawning seven agents on every
|
|
12
|
+
* settings paint is the cost this exists to avoid.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export interface HarnessCapabilities {
|
|
16
|
+
/** Which config selectors the agent published, and how many values each has. */
|
|
17
|
+
configModel: number;
|
|
18
|
+
configThinking: number;
|
|
19
|
+
configMode: number;
|
|
20
|
+
/** Mode ids, so the composer knows whether `plan` is a real option. */
|
|
21
|
+
modeValues: string[];
|
|
22
|
+
loadSession: boolean;
|
|
23
|
+
listSessions: boolean;
|
|
24
|
+
forkSession: boolean;
|
|
25
|
+
deleteSession: boolean;
|
|
26
|
+
resumeSession: boolean;
|
|
27
|
+
closeSession: boolean;
|
|
28
|
+
/** `usage_update` was observed on this harness. Absent agents show
|
|
29
|
+
* "not reported" in the context and usage panels. */
|
|
30
|
+
hasUsage: boolean;
|
|
31
|
+
/** A `plan` update was observed. No measured agent sends one. */
|
|
32
|
+
hasPlan: boolean;
|
|
33
|
+
/** How mid-turn input works, or null when the agent has no way to take it. */
|
|
34
|
+
steerMode: 'steer' | 'follow-up' | null;
|
|
35
|
+
agentName?: string;
|
|
36
|
+
agentVersion?: string;
|
|
37
|
+
/** Why the harness is unusable, when it is: an auth method id, a missing
|
|
38
|
+
* binary, or the agent's own error text. */
|
|
39
|
+
blocked?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const UNPROBED_CAPABILITIES: HarnessCapabilities = {
|
|
43
|
+
configModel: 0,
|
|
44
|
+
configThinking: 0,
|
|
45
|
+
configMode: 0,
|
|
46
|
+
modeValues: [],
|
|
47
|
+
loadSession: false,
|
|
48
|
+
listSessions: false,
|
|
49
|
+
forkSession: false,
|
|
50
|
+
deleteSession: false,
|
|
51
|
+
resumeSession: false,
|
|
52
|
+
closeSession: false,
|
|
53
|
+
hasUsage: false,
|
|
54
|
+
hasPlan: false,
|
|
55
|
+
steerMode: null,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Spawn-time capability read: one ACP session, then dispose. */
|
|
59
|
+
export interface HarnessProbe {
|
|
60
|
+
harness: string;
|
|
61
|
+
capabilities: HarnessCapabilities;
|
|
62
|
+
/** Model ids the agent would offer, in its own order. */
|
|
63
|
+
models: { value: string; name: string }[];
|
|
64
|
+
thinking: { value: string; name: string }[];
|
|
65
|
+
modes: { value: string; name: string }[];
|
|
66
|
+
probedAt: number;
|
|
67
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Saving a harness's config must not throw away what the last probe measured —
|
|
8
|
+
* except when it must.
|
|
9
|
+
*
|
|
10
|
+
* The distinction is the whole rule, and it was wrong in the first version:
|
|
11
|
+
* every save dropped the cached probe, so storing a default model collapsed the
|
|
12
|
+
* provider/model PICKERS back into free-text fields. Measured in a browser:
|
|
13
|
+
* probe `command-code` (96 models, provider dropdown populated), press Save with
|
|
14
|
+
* an unchanged command, and the dropdowns were gone — the form the user had just
|
|
15
|
+
* improved was replaced by one where every value must be typed from memory.
|
|
16
|
+
*
|
|
17
|
+
* Only `command` and `env` are what a probe measured. A default model, provider,
|
|
18
|
+
* thinking level or mode does not change what the agent OFFERS.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { afterAll, afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
22
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
23
|
+
import { EMPTY_HARNESS_CONFIG, parseHarnessConfig } from '@/shared/lib/harness/config';
|
|
24
|
+
import {
|
|
25
|
+
loadHarnessConfig,
|
|
26
|
+
probeInvalidatedBy,
|
|
27
|
+
saveHarnessConfig,
|
|
28
|
+
} from '@/server/lib/harness/config.server';
|
|
29
|
+
|
|
30
|
+
beforeEach(async () => {
|
|
31
|
+
await isolateDb();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterEach(async () => {
|
|
35
|
+
await releaseDb();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
afterAll(async () => {
|
|
39
|
+
await releaseDb();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/** The rule is the ROUTE's own function, imported above — a copy here would let
|
|
43
|
+
* the test and the product disagree about which fields count. */
|
|
44
|
+
|
|
45
|
+
describe('which config writes invalidate a probe', () => {
|
|
46
|
+
test('a defaults-only save leaves the command and env untouched', async () => {
|
|
47
|
+
await saveHarnessConfig('command-code', { ...EMPTY_HARNESS_CONFIG, command: 'cmd acp', env: 'A=1' });
|
|
48
|
+
const before = await loadHarnessConfig('command-code');
|
|
49
|
+
|
|
50
|
+
await saveHarnessConfig('command-code', {
|
|
51
|
+
...before, provider: 'claude-sonnet-5', thinking: 'high',
|
|
52
|
+
});
|
|
53
|
+
const after = await loadHarnessConfig('command-code');
|
|
54
|
+
|
|
55
|
+
expect(probeInvalidatedBy(before, after)).toBe(false);
|
|
56
|
+
// The defaults really did land, so the case is not passing by doing nothing.
|
|
57
|
+
expect(after.provider).toBe('claude-sonnet-5');
|
|
58
|
+
expect(after.thinking).toBe('high');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('changing the launch command DOES invalidate it', async () => {
|
|
62
|
+
await saveHarnessConfig('claude', { ...EMPTY_HARNESS_CONFIG, command: 'cmd acp' });
|
|
63
|
+
const before = await loadHarnessConfig('claude');
|
|
64
|
+
await saveHarnessConfig('claude', { ...before, command: 'other acp' });
|
|
65
|
+
const after = await loadHarnessConfig('claude');
|
|
66
|
+
|
|
67
|
+
expect(probeInvalidatedBy(before, after)).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('changing the env DOES invalidate it', async () => {
|
|
71
|
+
// Env is the provider/credential switch an ACP agent honours, so it can
|
|
72
|
+
// point the same binary at a different catalog entirely.
|
|
73
|
+
await saveHarnessConfig('claude', { ...EMPTY_HARNESS_CONFIG, env: 'A=1' });
|
|
74
|
+
const before = await loadHarnessConfig('claude');
|
|
75
|
+
await saveHarnessConfig('claude', { ...before, env: 'A=2' });
|
|
76
|
+
const after = await loadHarnessConfig('claude');
|
|
77
|
+
|
|
78
|
+
expect(probeInvalidatedBy(before, after)).toBe(true);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('the stored config survives the round trip the route compares', async () => {
|
|
82
|
+
// The route compares what it READ against what it parsed from the body; a
|
|
83
|
+
// normalisation that changed whitespace would invalidate a probe on every
|
|
84
|
+
// save. `parseHarnessConfig` is identity over its own output.
|
|
85
|
+
const saved = parseHarnessConfig({ command: 'cmd acp', env: 'A=1' });
|
|
86
|
+
await saveHarnessConfig('antigravity', saved);
|
|
87
|
+
const read = await loadHarnessConfig('antigravity');
|
|
88
|
+
expect(read.command).toBe(saved.command);
|
|
89
|
+
expect(read.env).toBe(saved.env);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The per-harness config as the SPAWN sees it: the user's override merged over
|
|
8
|
+
* the build's launch table.
|
|
9
|
+
*
|
|
10
|
+
* The merge is the whole point, and both halves of it matter:
|
|
11
|
+
*
|
|
12
|
+
* - an empty command means the TABLE's line, so an install that never opened
|
|
13
|
+
* the form spawns exactly what it always did;
|
|
14
|
+
* - an env override is UNIONED with the table's, not substituted — the table's
|
|
15
|
+
* env carries what the adapter needs to run at all (`CODEX_PATH`), and
|
|
16
|
+
* replacing it would break a working harness by setting one unrelated
|
|
17
|
+
* variable.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { afterAll, afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
21
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
22
|
+
import { EMPTY_HARNESS_CONFIG, parseHarnessConfig } from '@/shared/lib/harness/config';
|
|
23
|
+
import { loadHarnessConfig, resolveLaunch, saveHarnessConfig } from '@/server/lib/harness/config.server';
|
|
24
|
+
import { HARNESS_LAUNCH } from '@/server/lib/harness/launch-table';
|
|
25
|
+
|
|
26
|
+
beforeEach(async () => {
|
|
27
|
+
await isolateDb();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
await releaseDb();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterAll(async () => {
|
|
35
|
+
await releaseDb();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe('harness config storage', () => {
|
|
39
|
+
test('an untouched harness reads as empty, and the table line is used', async () => {
|
|
40
|
+
const config = await loadHarnessConfig('antigravity');
|
|
41
|
+
expect(config).toEqual(EMPTY_HARNESS_CONFIG);
|
|
42
|
+
expect(resolveLaunch('antigravity', config).command).toEqual(HARNESS_LAUNCH.antigravity!.command);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('a saved config is what the next read returns', async () => {
|
|
46
|
+
await saveHarnessConfig('antigravity', {
|
|
47
|
+
...EMPTY_HARNESS_CONFIG,
|
|
48
|
+
command: '"/opt/my tools/agy" acp',
|
|
49
|
+
provider: 'google',
|
|
50
|
+
thinking: 'high',
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const config = await loadHarnessConfig('antigravity');
|
|
54
|
+
expect(config.command).toBe('"/opt/my tools/agy" acp');
|
|
55
|
+
expect(config.provider).toBe('google');
|
|
56
|
+
|
|
57
|
+
// The override reaches the spawn shape, quoted path intact.
|
|
58
|
+
expect(resolveLaunch('antigravity', config).command).toEqual(['/opt/my tools/agy', 'acp']);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('saving an empty config DELETES the row rather than storing blanks', async () => {
|
|
62
|
+
await saveHarnessConfig('claude', { ...EMPTY_HARNESS_CONFIG, mode: 'plan' });
|
|
63
|
+
await saveHarnessConfig('claude', { ...EMPTY_HARNESS_CONFIG });
|
|
64
|
+
|
|
65
|
+
const config = await loadHarnessConfig('claude');
|
|
66
|
+
expect(parseHarnessConfig(config)).toEqual(EMPTY_HARNESS_CONFIG);
|
|
67
|
+
expect(config.mode).toBe('');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('configs are per harness, so saving one leaves another alone', async () => {
|
|
71
|
+
await saveHarnessConfig('claude', { ...EMPTY_HARNESS_CONFIG, thinking: 'low' });
|
|
72
|
+
await saveHarnessConfig('codex', { ...EMPTY_HARNESS_CONFIG, thinking: 'high' });
|
|
73
|
+
|
|
74
|
+
expect((await loadHarnessConfig('claude')).thinking).toBe('low');
|
|
75
|
+
expect((await loadHarnessConfig('codex')).thinking).toBe('high');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('resolveLaunch', () => {
|
|
80
|
+
test('an env override is UNIONED with the table, never substituted', () => {
|
|
81
|
+
// `codex` ships `CODEX_PATH` in its table env; dropping it would break a
|
|
82
|
+
// harness that worked before the user set one unrelated variable.
|
|
83
|
+
const tableEnv = HARNESS_LAUNCH.codex?.env;
|
|
84
|
+
const launch = resolveLaunch('codex', { ...EMPTY_HARNESS_CONFIG, env: 'MY_VAR=1' });
|
|
85
|
+
expect(launch.env?.MY_VAR).toBe('1');
|
|
86
|
+
for (const key of Object.keys(tableEnv ?? {})) {
|
|
87
|
+
expect(launch.env?.[key]).toBe(tableEnv?.[key]);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('a malformed env line throws with the line named, not silently skipped', () => {
|
|
92
|
+
expect(() => resolveLaunch('claude', { ...EMPTY_HARNESS_CONFIG, env: 'NOT_AN_ASSIGNMENT' }))
|
|
93
|
+
.toThrow(/NOT_AN_ASSIGNMENT/);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('the built-in transport cannot be launched, and says so', () => {
|
|
97
|
+
expect(() => resolveLaunch('omp-rpc', EMPTY_HARNESS_CONFIG)).toThrow(/built in/);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('a harness the table does not know is an error, not an empty session', () => {
|
|
101
|
+
// `dsh` has a line; the check is the SHAPE of the failure, which must throw
|
|
102
|
+
// rather than spawn nothing.
|
|
103
|
+
expect(() => resolveLaunch('dsh', EMPTY_HARNESS_CONFIG)).not.toThrow();
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Per-harness config on the server: read it, write it, and turn it into the
|
|
8
|
+
* launch shape a spawn needs.
|
|
9
|
+
*
|
|
10
|
+
* Stored one key per harness in `app_settings` (`omp_harness_config:<id>`), not
|
|
11
|
+
* one blob for every harness. A blob would make two Kabmo instances writing
|
|
12
|
+
* different harnesses clobber each other, which is the same defect
|
|
13
|
+
* `session_ui_state` avoids by keying on the session; a key per harness makes
|
|
14
|
+
* each write touch only its own row.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { getDb } from '@/server/db.server';
|
|
18
|
+
import { readSettingsJson, writeSettingsJson } from '@/server/lib/db/settings-store';
|
|
19
|
+
import { HARNESS_LAUNCH, type HarnessLaunch } from '@/server/lib/harness/launch-table';
|
|
20
|
+
import {
|
|
21
|
+
harnessConfigKey,
|
|
22
|
+
isHarnessConfigured,
|
|
23
|
+
parseEnvLines,
|
|
24
|
+
parseHarnessConfig,
|
|
25
|
+
splitCommand,
|
|
26
|
+
type HarnessConfig,
|
|
27
|
+
} from '@/shared/lib/harness/config';
|
|
28
|
+
import { harnessDescriptor, type HarnessId } from '@/shared/lib/harness/catalog';
|
|
29
|
+
|
|
30
|
+
/** Read one harness's config, always fully populated. */
|
|
31
|
+
export async function loadHarnessConfig(id: HarnessId): Promise<HarnessConfig> {
|
|
32
|
+
const db = await getDb();
|
|
33
|
+
return parseHarnessConfig(await readSettingsJson<unknown>(db, harnessConfigKey(id), null));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Persist one harness's config. An all-empty config DELETES the row so an
|
|
37
|
+
* install that resets a harness leaves no stale key behind. */
|
|
38
|
+
export async function saveHarnessConfig(id: HarnessId, config: HarnessConfig): Promise<void> {
|
|
39
|
+
const db = await getDb();
|
|
40
|
+
if (!isHarnessConfigured(config)) {
|
|
41
|
+
await db.run('DELETE FROM app_settings WHERE key = ?', [harnessConfigKey(id)]);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
await writeSettingsJson(db, harnessConfigKey(id), config);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Does saving `next` over `previous` make the last probe stale?
|
|
49
|
+
*
|
|
50
|
+
* ONLY the launch line and the env: those are what a probe measured. A default
|
|
51
|
+
* model, provider, thinking level or mode does not change what the agent
|
|
52
|
+
* OFFERS — and treating every save as invalidating collapsed the provider/model
|
|
53
|
+
* pickers back into free-text fields the moment a user stored a default
|
|
54
|
+
* (measured).
|
|
55
|
+
*/
|
|
56
|
+
export function probeInvalidatedBy(previous: HarnessConfig, next: HarnessConfig): boolean {
|
|
57
|
+
return previous.command !== next.command || previous.env !== next.env;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The launch shape an override produces from the table entry, or null when the
|
|
61
|
+
* config says nothing about launching. Pure, so the merge is testable. */
|
|
62
|
+
export function launchFromConfig(id: HarnessId, config: HarnessConfig): HarnessLaunch | null {
|
|
63
|
+
const base = HARNESS_LAUNCH[id];
|
|
64
|
+
if (!base) return null;
|
|
65
|
+
const command = splitCommand(config.command);
|
|
66
|
+
const { env: parsedEnv, invalid } = parseEnvLines(config.env);
|
|
67
|
+
if (invalid.length > 0) {
|
|
68
|
+
// Surfaced as a spawn failure, not swallowed: a skipped line is an env var
|
|
69
|
+
// the user believes is set.
|
|
70
|
+
throw new Error(`Invalid env line${invalid.length === 1 ? '' : 's'}: ${invalid.join(', ')}`);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
...base,
|
|
74
|
+
...(command.length > 0 ? { command } : {}),
|
|
75
|
+
...(Object.keys(parsedEnv).length > 0
|
|
76
|
+
? { env: { ...(base.env ?? {}), ...parsedEnv } }
|
|
77
|
+
: {}),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The launch line a spawn uses: the user's override merged over the table.
|
|
83
|
+
*
|
|
84
|
+
* Throws for a harness that cannot be launched at all (built-in, or absent from
|
|
85
|
+
* the table): the spawn must fail loudly, because a harness with no line and no
|
|
86
|
+
* override is a configuration error, not a session with no defaults.
|
|
87
|
+
*/
|
|
88
|
+
export function resolveLaunch(id: HarnessId, config: HarnessConfig): HarnessLaunch {
|
|
89
|
+
if (harnessDescriptor(id)?.builtIn) {
|
|
90
|
+
throw new Error(`${id} is built in and is not launched`);
|
|
91
|
+
}
|
|
92
|
+
if (!HARNESS_LAUNCH[id]) {
|
|
93
|
+
throw new Error(`No launch command is configured for ${id}`);
|
|
94
|
+
}
|
|
95
|
+
const launch = launchFromConfig(id, config);
|
|
96
|
+
if (!launch) throw new Error(`No launch command is configured for ${id}`);
|
|
97
|
+
return launch;
|
|
98
|
+
}
|