@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,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Spawn an ACP-backed session and register it exactly like an omp one.
|
|
8
|
+
*
|
|
9
|
+
* The registration rules are omp's, reused rather than reimplemented: a session
|
|
10
|
+
* lands in the shared registry under BOTH the id the caller asked for and the id
|
|
11
|
+
* the agent reported, because the id can change (a load that forks) and the
|
|
12
|
+
* client keeps posting to the id it holds. `registerSpawnedSession` owns that
|
|
13
|
+
* rule; this module only supplies the driver.
|
|
14
|
+
*
|
|
15
|
+
* The model/thinking/mode picks ride the CONFIG WRITES after `session/new` — not
|
|
16
|
+
* an environment variable — because ACP publishes them as selectors and the
|
|
17
|
+
* agent applies them to the session it just created.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { AcpSession } from '@/server/lib/harness/acp/session';
|
|
21
|
+
import { loadHarnessConfig, resolveLaunch } from '@/server/lib/harness/config.server';
|
|
22
|
+
import { sessionLaunchCommand } from '@/server/lib/harness/launch';
|
|
23
|
+
import { resolveDefaultModel, modelProvider } from '@/shared/lib/harness/config';
|
|
24
|
+
import { harnessProbeModels } from '@/server/lib/harness/probe-cache.server';
|
|
25
|
+
import { claimHarness } from '@/server/lib/harness/registry';
|
|
26
|
+
import { registerAcpSession } from '@/server/lib/harness/register.server';
|
|
27
|
+
import { saveHarnessSession } from '@/server/lib/harness/session-store.server';
|
|
28
|
+
import { emitRealtimeSignal } from '@/server/lib/realtime/signals.server';
|
|
29
|
+
import { harnessDescriptor, type HarnessId } from '@/shared/lib/harness/catalog';
|
|
30
|
+
import type { HarnessSession } from '@/server/lib/harness/session';
|
|
31
|
+
import type { SelectedModel } from '@/shared/types/models';
|
|
32
|
+
import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
33
|
+
|
|
34
|
+
export interface AcpSpawnRequest {
|
|
35
|
+
harness: HarnessId;
|
|
36
|
+
sessionId: string;
|
|
37
|
+
/** On-disk transcript to resume; '' for a new chat. For ACP that is the
|
|
38
|
+
* agent's own session id, not a path — Kabmo stores it in `harness_sessions`. */
|
|
39
|
+
resumeAgentSessionId?: string;
|
|
40
|
+
cwd: string;
|
|
41
|
+
model?: SelectedModel | null;
|
|
42
|
+
thinkingLevel?: string | null;
|
|
43
|
+
mode?: string | null;
|
|
44
|
+
/** The composer's access pick, applied to the ACP session's own approval
|
|
45
|
+
* gate (this transport has no `--approval-mode` spawn flag). */
|
|
46
|
+
accessMode?: ApprovalMode | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export class HarnessNotLaunchableError extends Error {
|
|
50
|
+
constructor(harness: HarnessId, reason: string) {
|
|
51
|
+
super(`Cannot start ${harnessDescriptor(harness)?.label ?? harness}: ${reason}`);
|
|
52
|
+
this.name = 'HarnessNotLaunchableError';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export async function startAcpSession(
|
|
57
|
+
request: AcpSpawnRequest,
|
|
58
|
+
): Promise<{ session: HarnessSession; realSessionId: string }> {
|
|
59
|
+
// The USER's launch line, merged over the build's table. A command override is
|
|
60
|
+
// the only way to start an agent installed outside PATH, and an env override is
|
|
61
|
+
// the only provider switch an ACP agent actually honours — Kabmo routes nothing
|
|
62
|
+
// model-side for these agents, so pretending to would be a wrong setting.
|
|
63
|
+
const configured = await loadHarnessConfig(request.harness);
|
|
64
|
+
let launch;
|
|
65
|
+
try {
|
|
66
|
+
launch = resolveLaunch(request.harness, configured);
|
|
67
|
+
} catch (cause) {
|
|
68
|
+
throw new HarnessNotLaunchableError(
|
|
69
|
+
request.harness,
|
|
70
|
+
cause instanceof Error ? cause.message : 'no launch command is configured',
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// The model the chat starts on: the request's pick, else the harness's own
|
|
75
|
+
// configured default. Resolved against what the AGENT published, so a stale
|
|
76
|
+
// default falls through rather than failing the first prompt.
|
|
77
|
+
const probedModels = await harnessProbeModels(request.harness);
|
|
78
|
+
const configuredDefault = resolveDefaultModel(configured, probedModels);
|
|
79
|
+
const startingModel = request.model
|
|
80
|
+
?? (configuredDefault ? { provider: modelProvider(configuredDefault), modelId: configuredDefault } : null);
|
|
81
|
+
|
|
82
|
+
// Built here rather than behind a factory in the session module: this is the
|
|
83
|
+
// only place a session is constructed, and the handshake it runs (load vs
|
|
84
|
+
// new) is decided by the request this function already holds.
|
|
85
|
+
const session = new AcpSession(
|
|
86
|
+
{
|
|
87
|
+
harness: request.harness,
|
|
88
|
+
command: sessionLaunchCommand(request.harness, launch.command),
|
|
89
|
+
...(launch.env ? { env: launch.env } : {}),
|
|
90
|
+
model: startingModel,
|
|
91
|
+
thinkingLevel: request.thinkingLevel ?? configured.thinking ?? null,
|
|
92
|
+
mode: request.mode ?? configured.mode ?? null,
|
|
93
|
+
accessMode: request.accessMode ?? null,
|
|
94
|
+
},
|
|
95
|
+
request.cwd,
|
|
96
|
+
);
|
|
97
|
+
let realSessionId: string;
|
|
98
|
+
try {
|
|
99
|
+
({ sessionId: realSessionId } = await session.start(request.resumeAgentSessionId || undefined));
|
|
100
|
+
} catch (error) {
|
|
101
|
+
// A refused handshake (an agent that will not `session/load`, a launch line
|
|
102
|
+
// that cannot run) must not leave the child it just spawned running with
|
|
103
|
+
// nobody holding it: measured on a resume of a chat the agent no longer
|
|
104
|
+
// knew, the process stayed alive after the request answered an error.
|
|
105
|
+
await session.destroyAndWait().catch(() => {});
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
claimHarness(session, request.harness);
|
|
110
|
+
registerAcpSession(session, request.sessionId);
|
|
111
|
+
// Record the ownership BEFORE the first frame is forwarded: the sidebar reads
|
|
112
|
+
// this table, not the live registry, so a row written late would draw the row
|
|
113
|
+
// as `omp` until the next folder load. A failed write must not kill a live
|
|
114
|
+
// session, but it must be visible — silently losing it restores the bug this
|
|
115
|
+
// table exists to fix.
|
|
116
|
+
await saveHarnessSession({
|
|
117
|
+
sessionId: realSessionId,
|
|
118
|
+
harness: request.harness,
|
|
119
|
+
agentSessionId: realSessionId === request.sessionId ? '' : realSessionId,
|
|
120
|
+
cwd: request.cwd,
|
|
121
|
+
}).catch((cause: unknown) => {
|
|
122
|
+
console.error(`[harness] could not record ${request.harness} for session ${realSessionId}:`, cause);
|
|
123
|
+
});
|
|
124
|
+
// `request.sessionId` is the CLIENT's placeholder (`__new__<uuid>`) for a chat
|
|
125
|
+
// that had no id yet. It is an alias in the live registry, never a session:
|
|
126
|
+
// persisting it listed the same chat twice in the sidebar, once under an id
|
|
127
|
+
// that stops existing the moment the tab adopts the real one.
|
|
128
|
+
// A subscriber that attached before the spawn holds a `running:false`
|
|
129
|
+
// snapshot; the child exists now, so the topic must re-snapshot.
|
|
130
|
+
emitRealtimeSignal('session-attached', realSessionId);
|
|
131
|
+
if (request.sessionId !== realSessionId) emitRealtimeSignal('session-attached', request.sessionId);
|
|
132
|
+
return { session, realSessionId };
|
|
133
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The INSTALLED and LATEST version of each PART of a harness — the one read both
|
|
8
|
+
* "what am I running?" (the versions route) and "what would an update move?" (the
|
|
9
|
+
* update route) are built on.
|
|
10
|
+
*
|
|
11
|
+
* A harness is not always one package. `claude` is an ACP ADAPTER
|
|
12
|
+
* (`@agentclientprotocol/claude-agent-acp`, the number the probe reports) sitting
|
|
13
|
+
* on top of a CLI (`claude --version`, its own npm package, its own `claude
|
|
14
|
+
* update`). The two move independently — measured on this machine, the adapter was
|
|
15
|
+
* 0.100.0 while the CLI was 2.1.318 — so each part is read, compared and reported
|
|
16
|
+
* on its own line, and an update moves only the part that is behind.
|
|
17
|
+
*
|
|
18
|
+
* Both reads are cached process-wide because both are expensive and change
|
|
19
|
+
* slowly: `--version` spawns the binary, a registry read is a network request.
|
|
20
|
+
* `force` bypasses the REGISTRY cache only — that is the "Check again" path. A
|
|
21
|
+
* binary does not change under us, except through an update, which calls
|
|
22
|
+
* `forgetCliVersion` and `forgetProbe` so the next read states what is on disk.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { commandAvailable } from '@/server/lib/harness/auto-probe.server';
|
|
26
|
+
import { loadHarnessConfig } from '@/server/lib/harness/config.server';
|
|
27
|
+
import { fetchNpmLatest } from '@/server/lib/updates/npm';
|
|
28
|
+
import type { HarnessId } from '@/shared/lib/harness/catalog';
|
|
29
|
+
import { harnessUpdateFacts, latestSourceFor } from '@/shared/lib/harness/updates';
|
|
30
|
+
|
|
31
|
+
/** How long a registry answer is reused when the caller did not force a read. */
|
|
32
|
+
const LATEST_TTL_MS = 10 * 60_000;
|
|
33
|
+
|
|
34
|
+
declare global {
|
|
35
|
+
// eslint-disable-next-line no-var
|
|
36
|
+
var __kabmoHarnessLatest: Map<string, { version: string | null; at: number }> | undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function latestCache(): Map<string, { version: string | null; at: number }> {
|
|
40
|
+
globalThis.__kabmoHarnessLatest ??= new Map();
|
|
41
|
+
return globalThis.__kabmoHarnessLatest;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The newest version npm serves for `pkg`, cached for `LATEST_TTL_MS`.
|
|
46
|
+
*
|
|
47
|
+
* A null answer is cached too: a registry that could not be read must not be
|
|
48
|
+
* asked again on every row of the same dialog.
|
|
49
|
+
*/
|
|
50
|
+
export async function latestVersion(pkg: string, force = false): Promise<string | null> {
|
|
51
|
+
const cache = latestCache();
|
|
52
|
+
const cached = cache.get(pkg);
|
|
53
|
+
if (!force && cached && Date.now() - cached.at < LATEST_TTL_MS) return cached.version;
|
|
54
|
+
const version = await fetchNpmLatest(pkg);
|
|
55
|
+
cache.set(pkg, { version, at: Date.now() });
|
|
56
|
+
return version;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Is this harness's launch command resolvable?
|
|
61
|
+
*
|
|
62
|
+
* The same rule the catalog uses (`commandAvailable` in `auto-probe.server`), not
|
|
63
|
+
* a second copy of it: the USER's configured command and a bridge's required
|
|
64
|
+
* runtime both decide whether this harness can run. Reading the build's table
|
|
65
|
+
* directly said "installed" for a zcode with no runtime, and "not installed" for
|
|
66
|
+
* a harness whose binary is only reachable through its configured launch line —
|
|
67
|
+
* so the update route refused an install the spawn would have used.
|
|
68
|
+
*/
|
|
69
|
+
export async function harnessLaunchable(id: HarnessId): Promise<boolean> {
|
|
70
|
+
return commandAvailable(id, await loadHarnessConfig(id));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** How long a CLI version read is reused. A binary does not change under us. */
|
|
74
|
+
const CLI_VERSION_TTL_MS = 10 * 60_000;
|
|
75
|
+
|
|
76
|
+
declare global {
|
|
77
|
+
// eslint-disable-next-line no-var
|
|
78
|
+
var __kabmoHarnessCliVersions: Map<string, { version: string | null; at: number }> | undefined;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function cliVersions(): Map<string, { version: string | null; at: number }> {
|
|
82
|
+
globalThis.__kabmoHarnessCliVersions ??= new Map();
|
|
83
|
+
return globalThis.__kabmoHarnessCliVersions;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The installed CLI's own version, from `--version`.
|
|
88
|
+
*
|
|
89
|
+
* The number a user recognises. `claude --version` prints `2.1.318 (Claude Code)`
|
|
90
|
+
* while the ACP adapter reports `0.101.0` — two real numbers for two real things,
|
|
91
|
+
* and showing only the adapter read as "why is my 2.x showing 0.100?".
|
|
92
|
+
*
|
|
93
|
+
* Best-effort: a missing binary or a timeout is `null`, never an error, because
|
|
94
|
+
* the row still has the adapter's version to show.
|
|
95
|
+
*/
|
|
96
|
+
export async function cliVersion(bin: string): Promise<string | null> {
|
|
97
|
+
const cache = cliVersions();
|
|
98
|
+
const cached = cache.get(bin);
|
|
99
|
+
if (cached && Date.now() - cached.at < CLI_VERSION_TTL_MS) return cached.version;
|
|
100
|
+
let version: string | null = null;
|
|
101
|
+
try {
|
|
102
|
+
if (Bun.which(bin)) {
|
|
103
|
+
const proc = Bun.spawn({ cmd: [bin, '--version'], stdout: 'pipe', stderr: 'pipe', timeout: 5000 });
|
|
104
|
+
const text = (await new Response(proc.stdout).text()) + (await new Response(proc.stderr).text());
|
|
105
|
+
await proc.exited;
|
|
106
|
+
// The first version-shaped token: `2.1.318 (Claude Code)`, `codex-cli 0.166.0`.
|
|
107
|
+
version = text.match(/\b(\d+\.\d+\.\d+(?:[-+][\w.]+)?)\b/)?.[1] ?? null;
|
|
108
|
+
}
|
|
109
|
+
} catch {
|
|
110
|
+
version = null;
|
|
111
|
+
}
|
|
112
|
+
cache.set(bin, { version, at: Date.now() });
|
|
113
|
+
return version;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Forget a cached CLI read: the binary on disk just changed.
|
|
118
|
+
*
|
|
119
|
+
* Without it the row keeps reporting the version it read BEFORE an update for the
|
|
120
|
+
* rest of the TTL — the same defect `forgetProbe` fixes for the adapter.
|
|
121
|
+
*/
|
|
122
|
+
export function forgetCliVersion(bin: string): void {
|
|
123
|
+
cliVersions().delete(bin);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** One part's installed and registry version. */
|
|
127
|
+
export interface HarnessPartVersions {
|
|
128
|
+
/** What is on disk, or null when it has never answered. */
|
|
129
|
+
version: string | null;
|
|
130
|
+
/** What its install source offers, or null when it has no source Kabmo reads. */
|
|
131
|
+
latest: string | null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** The CLI underneath an adapter, with the name a reader recognises. */
|
|
135
|
+
export interface HarnessCliVersions extends HarnessPartVersions {
|
|
136
|
+
name: string;
|
|
137
|
+
bin: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface HarnessVersionState {
|
|
141
|
+
/** Is the launch command resolvable? An absent harness has nothing to move. */
|
|
142
|
+
installed: boolean;
|
|
143
|
+
/** The ADAPTER — the number the probe reported — and its own package. */
|
|
144
|
+
agent: HarnessPartVersions;
|
|
145
|
+
/** The CLI underneath, when this harness is an adapter for one. */
|
|
146
|
+
cli: HarnessCliVersions | null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Every part's installed and latest version, in one read.
|
|
151
|
+
*
|
|
152
|
+
* `agentVersion` is passed in rather than read here so a caller listing the whole
|
|
153
|
+
* catalog pays for ONE `loadProbes()`; this function is about versions, not about
|
|
154
|
+
* which probes exist.
|
|
155
|
+
*/
|
|
156
|
+
export async function harnessVersionState(
|
|
157
|
+
id: HarnessId,
|
|
158
|
+
agentVersion: string | null,
|
|
159
|
+
force = false,
|
|
160
|
+
): Promise<HarnessVersionState> {
|
|
161
|
+
const facts = harnessUpdateFacts(id);
|
|
162
|
+
const installed = id === 'omp-rpc' ? true : await harnessLaunchable(id);
|
|
163
|
+
|
|
164
|
+
// An ABSENT harness gets no registry read: there is no install to update, and
|
|
165
|
+
// the npm number would describe a package this machine does not have.
|
|
166
|
+
const agentPkg = installed ? latestSourceFor(id) : null;
|
|
167
|
+
const agentLatest = agentPkg ? await latestVersion(agentPkg, force) : null;
|
|
168
|
+
|
|
169
|
+
let cli: HarnessCliVersions | null = null;
|
|
170
|
+
if (facts?.cli) {
|
|
171
|
+
const version = installed ? await cliVersion(facts.cli.bin) : null;
|
|
172
|
+
// The CLI's own package is read whenever the facts name one: an npm CLI
|
|
173
|
+
// (dsh) moves through that package too, and reporting no latest for it would
|
|
174
|
+
// leave a stale CLI with no way to say so.
|
|
175
|
+
const movable = Boolean(facts.cli.pkg);
|
|
176
|
+
const cliLatest = version && movable ? await latestVersion(facts.cli.pkg as string, force) : null;
|
|
177
|
+
cli = { name: facts.cli.name, bin: facts.cli.bin, version, latest: cliLatest };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
installed,
|
|
182
|
+
agent: { version: agentVersion, latest: agentLatest },
|
|
183
|
+
cli,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import { getDb } from '@/server/db.server';
|
|
22
|
+
import { startHarnessAutoProbe } from '@/server/lib/harness/auto-probe.server';
|
|
22
23
|
import { compactChatOverlayRows } from '@/server/lib/db/compact-chat-overlay';
|
|
23
24
|
import { packageDir } from '@/server/lib/fs/package-root';
|
|
24
25
|
import { isTrayEnabledByArgv } from '@/server/lib/lifecycle/argv-flags';
|
|
@@ -65,6 +66,12 @@ export async function runAfterListenTasks(target: AfterListenTarget): Promise<vo
|
|
|
65
66
|
|
|
66
67
|
// A full collection past the ceiling, never a schedule (`lifecycle/memory.ts`).
|
|
67
68
|
installMemoryMaintenance();
|
|
69
|
+
|
|
70
|
+
// The harness probes for the agents this install keeps ON. Deliberately LAST
|
|
71
|
+
// and never awaited: a probe spawns an agent that may take a minute, and the
|
|
72
|
+
// listener is already serving tabs and chats. The pass is per PROCESS, so a
|
|
73
|
+
// `bun --hot` reload does not start every agent again — see the module header.
|
|
74
|
+
startHarnessAutoProbe();
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
/**
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A registry write is only visible to the readers that re-open the file, so the
|
|
8
|
+
* refresh has an ORDER: recycle the pooled omp children, forget the probes that
|
|
9
|
+
* measured the old file, re-probe when asked, and invalidate Kabmo's caches LAST
|
|
10
|
+
* — invalidating first would let the `models` topic resolve from the pre-write
|
|
11
|
+
* pool and cache that answer for another minute.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { describe, expect, test } from 'bun:test';
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
refreshModelRegistryAfterWrite,
|
|
18
|
+
type RegistryRefreshDeps,
|
|
19
|
+
} from '@/server/lib/models/registry-refresh.server';
|
|
20
|
+
|
|
21
|
+
/** Record every side effect in the order it happened. */
|
|
22
|
+
function recorder(sharing: string[] = ['omp-acp']) {
|
|
23
|
+
const steps: string[] = [];
|
|
24
|
+
const deps: RegistryRefreshDeps = {
|
|
25
|
+
restartUtilities: async () => { steps.push('restart'); },
|
|
26
|
+
registryPath: async () => '/home/me/.omp/models.yml',
|
|
27
|
+
sharing: (path) => {
|
|
28
|
+
steps.push(`sharing:${path}`);
|
|
29
|
+
return sharing as never;
|
|
30
|
+
},
|
|
31
|
+
forget: async (id) => { steps.push(`forget:${id}`); },
|
|
32
|
+
reprobe: async (ids, cwd) => { steps.push(`reprobe:${ids.join(',')}:${cwd}`); },
|
|
33
|
+
invalidate: () => { steps.push('invalidate'); },
|
|
34
|
+
};
|
|
35
|
+
return { steps, deps };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
describe('refreshModelRegistryAfterWrite', () => {
|
|
39
|
+
test('recycles the pool, forgets the probes, and invalidates LAST', async () => {
|
|
40
|
+
const { steps, deps } = recorder();
|
|
41
|
+
|
|
42
|
+
const sharing = await refreshModelRegistryAfterWrite({}, deps);
|
|
43
|
+
|
|
44
|
+
expect(sharing).toEqual(['omp-acp'] as never);
|
|
45
|
+
expect(steps).toEqual([
|
|
46
|
+
'restart',
|
|
47
|
+
'sharing:/home/me/.omp/models.yml',
|
|
48
|
+
'forget:omp-acp',
|
|
49
|
+
'invalidate',
|
|
50
|
+
]);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('a re-probe runs on the shared harnesses, with the caller scope, before the caches drop', async () => {
|
|
54
|
+
const { steps, deps } = recorder(['omp-rpc', 'omp-acp']);
|
|
55
|
+
|
|
56
|
+
await refreshModelRegistryAfterWrite({ path: '/w/models.yml', reprobe: true, cwd: '/w' }, deps);
|
|
57
|
+
|
|
58
|
+
expect(steps).toEqual([
|
|
59
|
+
'restart',
|
|
60
|
+
'sharing:/w/models.yml',
|
|
61
|
+
'forget:omp-rpc',
|
|
62
|
+
'forget:omp-acp',
|
|
63
|
+
'reprobe:omp-rpc,omp-acp:/w',
|
|
64
|
+
'invalidate',
|
|
65
|
+
]);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('a write that cannot change a probe still recycles and invalidates', async () => {
|
|
69
|
+
const { steps, deps } = recorder();
|
|
70
|
+
|
|
71
|
+
const sharing = await refreshModelRegistryAfterWrite({ probes: false }, deps);
|
|
72
|
+
|
|
73
|
+
expect(sharing).toEqual([]);
|
|
74
|
+
expect(steps).toEqual(['restart', 'invalidate']);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('the restart lands before any cache is dropped, even when it throws', async () => {
|
|
78
|
+
const { steps, deps } = recorder();
|
|
79
|
+
deps.restartUtilities = async () => {
|
|
80
|
+
steps.push('restart');
|
|
81
|
+
throw new Error('omp is missing');
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
await expect(refreshModelRegistryAfterWrite({}, deps)).rejects.toThrow('omp is missing');
|
|
85
|
+
expect(steps).toEqual(['restart']);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Refresh every reader of a registry file AFTER a write to it.
|
|
8
|
+
*
|
|
9
|
+
* A `models.yml` write is invisible to the pooled `omp` utility child: the child
|
|
10
|
+
* loads the file when it is SPAWNED, and `get_available_models` only awaits an
|
|
11
|
+
* in-flight background refresh — it does not compare the file's mtime. So
|
|
12
|
+
* dropping Kabmo's cache alone left `/api/models` re-reading the OLD registry
|
|
13
|
+
* from that child, which is why adding a provider only showed up after omp was
|
|
14
|
+
* restarted. Recycling the pool makes the next read start from the current file.
|
|
15
|
+
*
|
|
16
|
+
* The harness probes have the same problem from the other side: an ACP transport
|
|
17
|
+
* reads the same file at spawn, so a probe recorded before the write describes a
|
|
18
|
+
* registry that no longer exists. Those records are dropped, and the launchable
|
|
19
|
+
* transports are re-probed when `reprobe` is set, so a picker that reads the
|
|
20
|
+
* cache sees the new provider without an extra "check status" round.
|
|
21
|
+
*
|
|
22
|
+
* The caches are dropped LAST: the `models` topic resolver reads through
|
|
23
|
+
* `loadModelsWithCache`, and publishing before the pool was recycled would cache
|
|
24
|
+
* the pre-write answer for another 60s.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type { HarnessId } from '@/shared/lib/harness/catalog';
|
|
28
|
+
import { restartUtilityProcesses } from '@/server/lib/omp/rpc/utility';
|
|
29
|
+
import { getModelsConfigPath } from '@/server/lib/omp/config/models-config';
|
|
30
|
+
import { forgetProbe } from '@/server/lib/harness/probe-cache.server';
|
|
31
|
+
import { runAutoProbe } from '@/server/lib/harness/auto-probe.server';
|
|
32
|
+
import { harnessesSharingRegistry } from '@/server/lib/harness/provider-sources.server';
|
|
33
|
+
import { invalidateModelsCaches } from '@/shared/lib/models/server-cache';
|
|
34
|
+
|
|
35
|
+
export interface RegistryWriteRefreshOptions {
|
|
36
|
+
/**
|
|
37
|
+
* The registry file that was written. Defaults to the omp `models.yml` path,
|
|
38
|
+
* which is what every settings route writes.
|
|
39
|
+
*/
|
|
40
|
+
path?: string;
|
|
41
|
+
/** Workspace scope for a re-probe; defaults to the server's cwd. */
|
|
42
|
+
cwd?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Drop stored probes for the harnesses that read this file. Set false for a
|
|
45
|
+
* write that cannot change what an agent lists (a per-model override), where
|
|
46
|
+
* dropping the answer would only hide a still-valid model list.
|
|
47
|
+
*/
|
|
48
|
+
probes?: boolean;
|
|
49
|
+
/** Re-probe the launchable harnesses after dropping their records. */
|
|
50
|
+
reprobe?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The side effects the refresh drives, injected so a test can watch the ORDER. */
|
|
54
|
+
export interface RegistryRefreshDeps {
|
|
55
|
+
restartUtilities: () => Promise<unknown>;
|
|
56
|
+
registryPath: () => Promise<string>;
|
|
57
|
+
sharing: (path: string) => HarnessId[];
|
|
58
|
+
forget: (id: HarnessId) => Promise<void>;
|
|
59
|
+
reprobe: (ids: readonly HarnessId[], cwd: string) => Promise<unknown>;
|
|
60
|
+
invalidate: () => void;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const defaults: RegistryRefreshDeps = {
|
|
64
|
+
restartUtilities: restartUtilityProcesses,
|
|
65
|
+
registryPath: getModelsConfigPath,
|
|
66
|
+
sharing: harnessesSharingRegistry,
|
|
67
|
+
forget: forgetProbe,
|
|
68
|
+
reprobe: (ids, cwd) => runAutoProbe({ ids, cwd }),
|
|
69
|
+
invalidate: invalidateModelsCaches,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Recycle the pooled omp readers, forget the probes that measured the old file,
|
|
74
|
+
* and republish the model catalog once the fresh state is in place.
|
|
75
|
+
*
|
|
76
|
+
* Returns the harness ids that read the written file, so a caller can tell the
|
|
77
|
+
* browser which tabs need their own probe.
|
|
78
|
+
*/
|
|
79
|
+
export async function refreshModelRegistryAfterWrite(
|
|
80
|
+
options: RegistryWriteRefreshOptions = {},
|
|
81
|
+
deps: RegistryRefreshDeps = defaults,
|
|
82
|
+
): Promise<HarnessId[]> {
|
|
83
|
+
await deps.restartUtilities();
|
|
84
|
+
|
|
85
|
+
const sharing = options.probes === false
|
|
86
|
+
? []
|
|
87
|
+
: deps.sharing(options.path ?? (await deps.registryPath()));
|
|
88
|
+
|
|
89
|
+
if (options.probes !== false) {
|
|
90
|
+
for (const id of sharing) await deps.forget(id);
|
|
91
|
+
if (options.reprobe) {
|
|
92
|
+
await deps.reprobe(sharing, options.cwd ?? process.cwd());
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
deps.invalidate();
|
|
97
|
+
return sharing;
|
|
98
|
+
}
|
|
@@ -34,6 +34,9 @@ export async function getModelsConfigPath(): Promise<string> {
|
|
|
34
34
|
export interface NativeProviderInfo {
|
|
35
35
|
/** Provider slug, e.g. "deepseek" or "custom/my-gateway". */
|
|
36
36
|
slug: string;
|
|
37
|
+
/** The entry's own `name`, when the file declares one. Absent means the slug
|
|
38
|
+
* is the label, which is what omp itself prints. */
|
|
39
|
+
name?: string;
|
|
37
40
|
/** Base URL of the provider API, when configured. */
|
|
38
41
|
baseUrl?: string;
|
|
39
42
|
/** Wire dialect from the entry's `api`, when it declares one. */
|
|
@@ -90,6 +93,7 @@ export async function readNativeProviders(): Promise<NativeProviderInfo[]> {
|
|
|
90
93
|
return Object.entries(data.providers).map(([slug, value]) => {
|
|
91
94
|
const info: NativeProviderInfo = { slug, modelIds: [], models: [] };
|
|
92
95
|
if (isRecord(value)) {
|
|
96
|
+
if (typeof value.name === 'string' && value.name.trim()) info.name = value.name;
|
|
93
97
|
if (typeof value.baseUrl === 'string') info.baseUrl = value.baseUrl;
|
|
94
98
|
if (typeof value.api === 'string') info.api = value.api;
|
|
95
99
|
if (typeof value.auth === 'string') info.auth = value.auth;
|
|
@@ -18,6 +18,10 @@ import { delimiter, join } from 'path';
|
|
|
18
18
|
|
|
19
19
|
let cachedBin: string | null = null;
|
|
20
20
|
let binMissAt = 0;
|
|
21
|
+
/** The override the cache was resolved FOR. A changed override must re-probe:
|
|
22
|
+
* `KABMO_OMP_BIN` is a seam tests and packaged shells both move at runtime, and
|
|
23
|
+
* a hit cached under the previous value silently ignored the new one. */
|
|
24
|
+
let cachedOverride: string | null = null;
|
|
21
25
|
|
|
22
26
|
const BIN_NAME = process.platform === 'win32' ? 'omp.exe' : 'omp';
|
|
23
27
|
|
|
@@ -30,6 +34,7 @@ const MISS_TTL_MS = 30_000;
|
|
|
30
34
|
export function invalidateOmpCliCache(): void {
|
|
31
35
|
cachedBin = null;
|
|
32
36
|
binMissAt = 0;
|
|
37
|
+
cachedOverride = null;
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
function probeOmpBin(): string | null {
|
|
@@ -54,6 +59,14 @@ function probeOmpBin(): string | null {
|
|
|
54
59
|
* null when omp is not installed. A hit is cached for the process lifetime; a
|
|
55
60
|
* miss is re-probed after MISS_TTL_MS. */
|
|
56
61
|
export function resolveOmpBin(): string | null {
|
|
62
|
+
const override = Bun.env.KABMO_OMP_BIN ?? Bun.env.OMPCHAMBER_OMP_BIN ?? null;
|
|
63
|
+
if (override !== cachedOverride) {
|
|
64
|
+
// The override itself changed: the previous answer describes a different
|
|
65
|
+
// request, so it is not a cache hit.
|
|
66
|
+
cachedBin = null;
|
|
67
|
+
binMissAt = 0;
|
|
68
|
+
cachedOverride = override;
|
|
69
|
+
}
|
|
57
70
|
// A global Bun/npm update can replace or remove its launcher while this
|
|
58
71
|
// server process is still alive. Never keep returning a stale cache entry.
|
|
59
72
|
if (cachedBin && existsSync(cachedBin)) return cachedBin;
|
|
@@ -87,11 +87,14 @@ describe('resolveOmpBin', () => {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
test('a cached miss suppresses probing until the miss TTL elapses', () => {
|
|
90
|
-
|
|
90
|
+
// The SAME path all the way through: this is a miss cached, then the binary
|
|
91
|
+
// installed at it — not an override swap, which is a different request and
|
|
92
|
+
// therefore never a cache hit (a stale answer there ignored the new value).
|
|
93
|
+
const bin = join(tempDir('omp-miss'), 'omp');
|
|
94
|
+
Bun.env.KABMO_OMP_BIN = bin;
|
|
91
95
|
invalidateOmpCliCache();
|
|
92
96
|
expect(resolveOmpBin()).toBeNull();
|
|
93
|
-
|
|
94
|
-
Bun.env.KABMO_OMP_BIN = bin;
|
|
97
|
+
fs.writeFileSync(bin, '#!/bin/sh\nexit 0\n', { mode: 0o755 });
|
|
95
98
|
// Still inside MISS_TTL_MS: the install that just appeared is invisible.
|
|
96
99
|
expect(resolveOmpBin()).toBeNull();
|
|
97
100
|
// An explicit invalidation (after `omp update`) makes it visible at once.
|
|
@@ -39,10 +39,11 @@ export async function configureChild(proc: RpcProcess): Promise<void> {
|
|
|
39
39
|
// Full accumulated `message_update` frames (see the module doc): the streaming
|
|
40
40
|
// tool call's name/id live on the seed block, which delta mode drops.
|
|
41
41
|
await proc.sendCommand({ type: 'set_event_filter', events: null, messageUpdates: 'full' }).catch(() => {});
|
|
42
|
-
// Grouped `ask` dialogs: every question of one
|
|
42
|
+
// Grouped `ask` dialogs: every question of one ask in a SINGLE
|
|
43
43
|
// `extension_ui_request` (`method:"ask"`, with `multi`/`recommended`), answered
|
|
44
|
-
// by one `answers` response.
|
|
45
|
-
//
|
|
46
|
-
//
|
|
44
|
+
// by one `answers` response. omp 18.18.3 no longer routes its OWN `ask` tool
|
|
45
|
+
// through this (the tool takes an HTML form now and the RPC host walks its
|
|
46
|
+
// fields one dialog at a time), but extensions and the ratchet still use the
|
|
47
|
+
// grouped dialog, and an older child still takes this path for the tool.
|
|
47
48
|
await proc.sendCommand({ type: 'set_ask_dialog', enabled: true }).catch(() => {});
|
|
48
49
|
}
|
|
@@ -119,7 +119,8 @@ describe('command classification sets', () => {
|
|
|
119
119
|
test('image-bearing commands and answerable UI methods', () => {
|
|
120
120
|
expect([...IMAGE_BEARING_COMMANDS].sort()).toEqual(['abort_and_prompt', 'follow_up', 'prompt', 'steer']);
|
|
121
121
|
// `ask` is the grouped dialog `configureChild` opts into with
|
|
122
|
-
// `set_ask_dialog
|
|
122
|
+
// `set_ask_dialog` (extensions and the ratchet; omp's own tool moved to an
|
|
123
|
+
// HTML form in 18.18.3): the agent parks on it exactly as it does on a
|
|
123
124
|
// `select`, so a list without it leaves the frame unremembered and the
|
|
124
125
|
// question unanswerable after a reload.
|
|
125
126
|
expect(Object.keys(ANSWERABLE_UI_METHODS).sort()).toEqual(['ask', 'confirm', 'editor', 'input', 'select']);
|
|
@@ -15,14 +15,23 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Insertion order is preserved, and unsubscribing is by identity, so a listener
|
|
17
17
|
* added twice receives twice and each removal takes out one registration.
|
|
18
|
+
*
|
|
19
|
+
* It is also where omp's embedded-shell trace is dropped: 18.17.0 stamps every
|
|
20
|
+
* `bash` progress frame and result with `details.trace` (measured: 192 KB of
|
|
21
|
+
* frames for a 40-line command, against 19 KB on 18.16.0; ~300 KB for a large
|
|
22
|
+
* one), whose `history` repeats the output. No subscriber reads it, and this is
|
|
23
|
+
* the one place every subscriber is reached — the topic publishes straight to
|
|
24
|
+
* each open tab. See `shared/lib/omp/session/shell-trace.ts`.
|
|
18
25
|
*/
|
|
19
26
|
|
|
20
27
|
import type { AgentEvent, EventListener } from '@/server/lib/omp/rpc/constants';
|
|
28
|
+
import { stripShellTrace } from '@/shared/lib/omp/session/shell-trace';
|
|
21
29
|
|
|
22
30
|
export class EventFanout {
|
|
23
31
|
readonly #listeners: EventListener[] = [];
|
|
24
32
|
|
|
25
33
|
emit(event: AgentEvent): void {
|
|
34
|
+
stripShellTrace(event);
|
|
26
35
|
for (const listener of this.#listeners) {
|
|
27
36
|
try {
|
|
28
37
|
listener(event);
|