@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
|
@@ -25,8 +25,20 @@
|
|
|
25
25
|
* resolver and 404s for an id with no session file — a spawn was attempted.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
import { describe, expect, test } from 'bun:test';
|
|
29
|
-
import { sendCommand } from '@/server/routes/agent/command';
|
|
28
|
+
import { describe, expect, test, beforeEach, afterEach } from 'bun:test';
|
|
29
|
+
import { buildAgentSnapshot, sendCommand } from '@/server/routes/agent/command';
|
|
30
|
+
import { registerAcpSession } from '@/server/lib/harness/register.server';
|
|
31
|
+
import { claimHarness } from '@/server/lib/harness/registry';
|
|
32
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
33
|
+
import type { HarnessSession } from '@/server/lib/harness/session';
|
|
34
|
+
|
|
35
|
+
beforeEach(async () => {
|
|
36
|
+
await isolateDb();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
afterEach(async () => {
|
|
40
|
+
await releaseDb();
|
|
41
|
+
});
|
|
30
42
|
|
|
31
43
|
/** Ids that no Kabmo instance manages and no session file backs. */
|
|
32
44
|
const DEAD = 'spawn-guard-dead-session';
|
|
@@ -85,3 +97,232 @@ describe('agent command spawn guard', () => {
|
|
|
85
97
|
expect(response.status).not.toBe(409);
|
|
86
98
|
});
|
|
87
99
|
});
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The reattach snapshot for a NON-omp harness.
|
|
103
|
+
*
|
|
104
|
+
* The ACP driver reports its own run flags, and "the child is alive" is not
|
|
105
|
+
* "a turn is in flight". Reporting `running: true` for an idle ACP chat re-armed
|
|
106
|
+
* the generating indicator — and a reattaching tab's sidebar spinner — for a
|
|
107
|
+
* turn that had already finished (measured: `isStreaming` and `isPromptRunning`
|
|
108
|
+
* both false while the snapshot read `running: true`).
|
|
109
|
+
*/
|
|
110
|
+
describe('agent snapshot for a non-omp harness', () => {
|
|
111
|
+
interface FakeAcp {
|
|
112
|
+
running: boolean;
|
|
113
|
+
dialogs: unknown[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function registerAcp(id: string, fake: FakeAcp): () => void {
|
|
117
|
+
let release: (() => void) | null = null;
|
|
118
|
+
const session = {
|
|
119
|
+
sessionId: id,
|
|
120
|
+
harness: 'omp-acp',
|
|
121
|
+
sessionFile: '',
|
|
122
|
+
cwd: '/tmp',
|
|
123
|
+
isStreaming: fake.running,
|
|
124
|
+
isPromptRunning: fake.running,
|
|
125
|
+
runModel: null,
|
|
126
|
+
capabilities: {},
|
|
127
|
+
configOptions: [],
|
|
128
|
+
isAlive: () => true,
|
|
129
|
+
isRunning: () => fake.running,
|
|
130
|
+
isBusy: () => fake.running || fake.dialogs.length > 0,
|
|
131
|
+
send: async () => ({
|
|
132
|
+
sessionId: id,
|
|
133
|
+
isStreaming: fake.running,
|
|
134
|
+
isPromptRunning: fake.running,
|
|
135
|
+
messageCount: 0,
|
|
136
|
+
}),
|
|
137
|
+
getPendingUiDialogs: () => fake.dialogs,
|
|
138
|
+
resolvePendingUiDialog: () => {},
|
|
139
|
+
onEvent: () => () => {},
|
|
140
|
+
emit: () => {},
|
|
141
|
+
destroy: () => {},
|
|
142
|
+
destroyAndWait: async () => {},
|
|
143
|
+
onDestroy: (callback: () => void) => {
|
|
144
|
+
release = callback;
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
registerAcpSession(session as unknown as HarnessSession, id);
|
|
148
|
+
claimHarness(session as unknown as HarnessSession, 'omp-acp');
|
|
149
|
+
return () => release?.();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
test('an idle ACP chat is not reported as running', async () => {
|
|
153
|
+
const id = 'acp-snapshot-idle';
|
|
154
|
+
const release = registerAcp(id, { running: false, dialogs: [] });
|
|
155
|
+
try {
|
|
156
|
+
expect((await buildAgentSnapshot(id)).running).toBe(false);
|
|
157
|
+
} finally {
|
|
158
|
+
release();
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test('a streaming ACP chat is running', async () => {
|
|
163
|
+
const id = 'acp-snapshot-streaming';
|
|
164
|
+
const release = registerAcp(id, { running: true, dialogs: [] });
|
|
165
|
+
try {
|
|
166
|
+
expect((await buildAgentSnapshot(id)).running).toBe(true);
|
|
167
|
+
} finally {
|
|
168
|
+
release();
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test('a parked approval keeps an idle chat running and busy', async () => {
|
|
173
|
+
const id = 'acp-snapshot-dialog';
|
|
174
|
+
const dialog = { type: 'extension_ui_request', id: '7', method: 'confirm', title: 't', message: 'm', options: [] };
|
|
175
|
+
const release = registerAcp(id, { running: false, dialogs: [dialog] });
|
|
176
|
+
try {
|
|
177
|
+
const snapshot = await buildAgentSnapshot(id);
|
|
178
|
+
expect(snapshot.running).toBe(true);
|
|
179
|
+
expect(snapshot.busy).toBe(true);
|
|
180
|
+
expect(snapshot.pendingUiRequests).toHaveLength(1);
|
|
181
|
+
} finally {
|
|
182
|
+
release();
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Mode commands on a harness that has no `/kabmo-mode` extension.
|
|
189
|
+
*
|
|
190
|
+
* The Plan/Goal toggles send an extension command that only omp carries.
|
|
191
|
+
* Forwarding it to another agent handed the MODEL the literal text — measured
|
|
192
|
+
* on claude, which opened a turn with `/kabmo-mode plan on` and then refused the
|
|
193
|
+
* next mode command as "already processing". The harness's own ACP `mode`
|
|
194
|
+
* selector is the honest equivalent, and a scope it cannot express is refused
|
|
195
|
+
* in words instead of being sent as prose.
|
|
196
|
+
*/
|
|
197
|
+
describe('mode commands on a non-omp harness', () => {
|
|
198
|
+
interface Recorder {
|
|
199
|
+
commands: Record<string, unknown>[];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function registerModeHarness(id: string, modes: string[], current: string): { recorder: Recorder; release: () => void } {
|
|
203
|
+
const commands: Record<string, unknown>[] = [];
|
|
204
|
+
let release: (() => void) | null = null;
|
|
205
|
+
const session = {
|
|
206
|
+
sessionId: id,
|
|
207
|
+
harness: 'claude',
|
|
208
|
+
sessionFile: '',
|
|
209
|
+
cwd: '/tmp',
|
|
210
|
+
isStreaming: false,
|
|
211
|
+
isPromptRunning: false,
|
|
212
|
+
runModel: null,
|
|
213
|
+
capabilities: {},
|
|
214
|
+
configOptions: [],
|
|
215
|
+
isAlive: () => true,
|
|
216
|
+
isRunning: () => false,
|
|
217
|
+
isBusy: () => false,
|
|
218
|
+
send: async (command: Record<string, unknown>) => {
|
|
219
|
+
commands.push(command);
|
|
220
|
+
if (command.type === 'get_state') {
|
|
221
|
+
return {
|
|
222
|
+
configOptions: [
|
|
223
|
+
{
|
|
224
|
+
id: 'mode',
|
|
225
|
+
name: 'Mode',
|
|
226
|
+
category: 'mode',
|
|
227
|
+
type: 'select',
|
|
228
|
+
currentValue: current,
|
|
229
|
+
options: modes.map((value) => ({ value, name: value })),
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
return { ok: true };
|
|
235
|
+
},
|
|
236
|
+
getPendingUiDialogs: () => [],
|
|
237
|
+
resolvePendingUiDialog: () => {},
|
|
238
|
+
onEvent: () => () => {},
|
|
239
|
+
emit: () => {},
|
|
240
|
+
destroy: () => {},
|
|
241
|
+
destroyAndWait: async () => {},
|
|
242
|
+
onDestroy: (callback: () => void) => {
|
|
243
|
+
release = callback;
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
registerAcpSession(session as unknown as HarnessSession, id);
|
|
247
|
+
claimHarness(session as unknown as HarnessSession, 'claude');
|
|
248
|
+
return { recorder: { commands }, release: () => release?.() };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function postMode(id: string, body: Record<string, unknown>): Promise<Response> {
|
|
252
|
+
return sendCommand({
|
|
253
|
+
params: { sessionId: id },
|
|
254
|
+
request: new Request(`http://localhost/api/agent/${id}`, {
|
|
255
|
+
method: 'POST',
|
|
256
|
+
headers: { 'Content-Type': 'application/json', 'x-kabmo-peer-hop': '1' },
|
|
257
|
+
body: JSON.stringify(body),
|
|
258
|
+
}),
|
|
259
|
+
} as never) as Promise<Response>;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
test('plan on drives the harness mode selector, never a prompt', async () => {
|
|
263
|
+
const { recorder, release } = registerModeHarness('mode-plan-on', ['default', 'plan', 'acceptEdits'], 'default');
|
|
264
|
+
try {
|
|
265
|
+
const response = await postMode('mode-plan-on', { type: 'kabmo_mode', scope: 'plan', action: 'on' });
|
|
266
|
+
expect(response.status).toBe(200);
|
|
267
|
+
expect(recorder.commands.some((command) => command.type === 'prompt')).toBe(false);
|
|
268
|
+
expect(recorder.commands.some((command) => command.type === 'set_mode' && command.mode === 'plan')).toBe(true);
|
|
269
|
+
} finally {
|
|
270
|
+
release();
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
test('plan off returns to `default`', async () => {
|
|
275
|
+
const { recorder, release } = registerModeHarness('mode-plan-off', ['default', 'plan'], 'plan');
|
|
276
|
+
try {
|
|
277
|
+
expect((await postMode('mode-plan-off', { type: 'kabmo_mode', scope: 'plan', action: 'off' })).status).toBe(200);
|
|
278
|
+
expect(recorder.commands.some((command) => command.type === 'set_mode' && command.mode === 'default')).toBe(true);
|
|
279
|
+
} finally {
|
|
280
|
+
release();
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
test('plan state answers from the selector without touching it', async () => {
|
|
285
|
+
const { recorder, release } = registerModeHarness('mode-plan-state', ['default', 'plan'], 'plan');
|
|
286
|
+
try {
|
|
287
|
+
const response = await postMode('mode-plan-state', { type: 'kabmo_mode', scope: 'plan', action: 'state' });
|
|
288
|
+
expect(await response.json()).toMatchObject({ success: true, data: { enabled: true } });
|
|
289
|
+
expect(recorder.commands.some((command) => command.type === 'set_mode')).toBe(false);
|
|
290
|
+
} finally {
|
|
291
|
+
release();
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
test('a harness with no plan value refuses in words, and sends no prompt', async () => {
|
|
296
|
+
const { recorder, release } = registerModeHarness('mode-no-plan', ['worker', 'plan-builder'], 'worker');
|
|
297
|
+
try {
|
|
298
|
+
const response = await postMode('mode-no-plan', { type: 'kabmo_mode', scope: 'plan', action: 'on' });
|
|
299
|
+
expect(response.status).toBe(400);
|
|
300
|
+
const body = (await response.json()) as { error: string; code: string };
|
|
301
|
+
expect(body.error).toContain('has no plan mode');
|
|
302
|
+
expect(body.code).toBe('mode_not_supported');
|
|
303
|
+
expect(recorder.commands.some((command) => command.type === 'prompt')).toBe(false);
|
|
304
|
+
} finally {
|
|
305
|
+
release();
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
test('goal create is owned by Kabmo and sends no prompt when armed', async () => {
|
|
310
|
+
const { recorder, release } = registerModeHarness('mode-goal', ['default', 'plan'], 'default');
|
|
311
|
+
try {
|
|
312
|
+
const response = await postMode('mode-goal', {
|
|
313
|
+
type: 'kabmo_mode',
|
|
314
|
+
scope: 'goal',
|
|
315
|
+
action: 'create',
|
|
316
|
+
payload: { objective: 'ship it', startTurn: false },
|
|
317
|
+
});
|
|
318
|
+
expect(response.status).toBe(200);
|
|
319
|
+
// The record is Kabmo's; the operator's own prompt is the first turn.
|
|
320
|
+
expect(recorder.commands.some((command) => command.type === 'prompt')).toBe(false);
|
|
321
|
+
const state = (await response.json()) as { success: boolean; data: { goal?: { status?: string } } };
|
|
322
|
+
expect(state.success).toBe(true);
|
|
323
|
+
expect(state.data.goal?.status).toBe('active');
|
|
324
|
+
} finally {
|
|
325
|
+
release();
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { json } from '@/server/lib/remix-compat';
|
|
2
2
|
import type { ActionFunctionArgs, LoaderFunctionArgs } from '@/server/lib/remix-compat';
|
|
3
3
|
import { resolveSessionPathOr404 } from '@/server/lib/omp/session/locator';
|
|
4
|
-
import { WebRpcError,
|
|
4
|
+
import { WebRpcError, resolveSpawnCwd, startRpcSession, type AgentSessionWrapper } from '@/server/lib/omp/rpc/manager';
|
|
5
5
|
import { getSpawnApprovalMode, reconcileSpawnApprovalMode } from '@/server/lib/omp/rpc/session-registry';
|
|
6
6
|
import { isApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
7
7
|
import { loadPersistedAccessMode } from '@/shared/lib/omp/config/access-mode.server';
|
|
@@ -13,6 +13,9 @@ import { isModeCommandType, modeCommandPrompt, parseModeRequest, parseModeSelect
|
|
|
13
13
|
import { kabmoModeEnv } from '@/server/lib/omp/extensions/locator';
|
|
14
14
|
import { resetGoalDriverState } from '@/server/lib/omp/session/goal-driver.server';
|
|
15
15
|
import { forwardToPeer, isPeerRelayed, peerOriginForSession } from '@/server/lib/omp/rpc/peer-proxy.server';
|
|
16
|
+
import { applyHarnessMode, resumeRecordedHarnessSession } from '@/server/routes/agent/harness-command';
|
|
17
|
+
import { asHarnessSession } from '@/server/lib/harness/registry';
|
|
18
|
+
import { asOmpSession, getLiveSession } from '@/server/lib/omp/rpc/session-registry';
|
|
16
19
|
|
|
17
20
|
/** How long after an accepted Resume Kabmo nudges the loop. The
|
|
18
21
|
* extension answers the mode command first; this only coalesces the nudge
|
|
@@ -74,13 +77,32 @@ export async function sendCommand({ params, request }: ActionFunctionArgs) {
|
|
|
74
77
|
// local extension command inside the child, never an RPC verb.
|
|
75
78
|
const forwarded = modeRequest ? { type: 'prompt', message: modeCommandPrompt(modeRequest) } : body;
|
|
76
79
|
|
|
77
|
-
// Fast path: already-running session.
|
|
78
|
-
|
|
80
|
+
// Fast path: already-running session — whichever harness runs it. An ACP
|
|
81
|
+
// session answers the same command vocabulary, so the transport is invisible
|
|
82
|
+
// to the client.
|
|
83
|
+
const existing = getLiveSession(sessionId);
|
|
79
84
|
if (existing?.isAlive()) {
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
// The approval mode is a SPAWN flag (`--approval-mode`), so reconciling it
|
|
86
|
+
// means destroying an idle omp child and respawning. An ACP agent has no
|
|
87
|
+
// such flag — it gates through `session/request_permission` — so there is
|
|
88
|
+
// nothing to reconcile and the command goes straight through.
|
|
89
|
+
const ompSession = asOmpSession(existing);
|
|
90
|
+
// A mode command is an omp EXTENSION command (`/kabmo-mode …`), and only
|
|
91
|
+
// omp carries that extension. Forwarding it to another harness made the
|
|
92
|
+
// MODEL read `/kabmo-mode plan on` as prose and opened a turn with it
|
|
93
|
+
// (measured on claude) — the exact failure the extension argument exists
|
|
94
|
+
// to prevent for omp. Another harness gets its own mode selector, or a
|
|
95
|
+
// refusal in words.
|
|
96
|
+
if (modeRequest && !ompSession) {
|
|
97
|
+
const applied = await applyHarnessMode(asHarnessSession(existing), modeRequest);
|
|
98
|
+
if (!applied.ok) return json({ error: applied.error, code: 'mode_not_supported' }, { status: 400 });
|
|
99
|
+
return json({ success: true, data: applied.data });
|
|
100
|
+
}
|
|
101
|
+
const liveMode = explicitMode ?? (ompSession ? getSpawnApprovalMode(ompSession) : null);
|
|
102
|
+
const needsRespawn = Boolean(
|
|
103
|
+
ompSession && liveMode && (await reconcileSpawnApprovalMode(ompSession, liveMode)),
|
|
104
|
+
);
|
|
105
|
+
if (!needsRespawn) {
|
|
84
106
|
const result = await existing.send(forwarded);
|
|
85
107
|
// A Resume is the operator re-arming the loop: strike history from the
|
|
86
108
|
// previous stop is not evidence about this run, and an idle session
|
|
@@ -115,6 +137,27 @@ export async function sendCommand({ params, request }: ActionFunctionArgs) {
|
|
|
115
137
|
return json({ error: 'Session is not running', code: 'session_not_running' }, { status: 409 });
|
|
116
138
|
}
|
|
117
139
|
|
|
140
|
+
// A recorded chat that runs on ANOTHER harness has no JSONL for the locator
|
|
141
|
+
// below to resolve, so "Session not found" was the only answer Kabmo could
|
|
142
|
+
// give it — measured on a `claude` chat after a restart: its row was in the
|
|
143
|
+
// sidebar, and both a prompt and `get_state` answered 404. Its own agent can
|
|
144
|
+
// restore the conversation (`session/load`), so the chat is respawned on its
|
|
145
|
+
// OWN harness with the id the agent reported and the command dispatched
|
|
146
|
+
// there — the same lazy-spawn contract this route already has for omp.
|
|
147
|
+
const restored = await resumeRecordedHarnessSession(sessionId, explicitMode);
|
|
148
|
+
if (restored) {
|
|
149
|
+
// A mode command is the harness's own selector here, never the
|
|
150
|
+
// `/kabmo-mode` extension prompt: the live path above applies the same
|
|
151
|
+
// rule, and a restored chat must not answer differently from one that
|
|
152
|
+
// never stopped.
|
|
153
|
+
if (modeRequest) {
|
|
154
|
+
const applied = await applyHarnessMode(restored, modeRequest);
|
|
155
|
+
if (!applied.ok) return json({ error: applied.error, code: 'mode_not_supported' }, { status: 400 });
|
|
156
|
+
return json({ success: true, data: applied.data });
|
|
157
|
+
}
|
|
158
|
+
return json({ success: true, data: await restored.send(forwarded) });
|
|
159
|
+
}
|
|
160
|
+
|
|
118
161
|
const resolved = await resolveSessionPathOr404(sessionId);
|
|
119
162
|
if ('response' in resolved) return resolved.response;
|
|
120
163
|
const { filePath, recordedCwd } = resolved;
|
|
@@ -184,8 +227,25 @@ export interface AgentSnapshot {
|
|
|
184
227
|
* decides whether another instance owns it.
|
|
185
228
|
*/
|
|
186
229
|
export async function buildAgentSnapshot(sessionId: string): Promise<AgentSnapshot> {
|
|
187
|
-
|
|
230
|
+
// Any harness: an ACP session answers `get_state` from its own config
|
|
231
|
+
// selectors (there is no RPC probe), so a reattaching tab sees one payload
|
|
232
|
+
// shape either way.
|
|
233
|
+
const session = getLiveSession(sessionId);
|
|
188
234
|
if (!session || !session.isAlive()) return { running: false };
|
|
235
|
+
const omp = asOmpSession(session);
|
|
236
|
+
if (!omp) {
|
|
237
|
+
// "Alive" is not "a turn is in flight": the driver's own flags answer that.
|
|
238
|
+
// Reporting `running: true` for an idle ACP chat re-armed the generating
|
|
239
|
+
// indicator and a reattaching tab's spinner for a turn that had already
|
|
240
|
+
// finished (measured: both turn flags false while `running` read true).
|
|
241
|
+
const dialogs = session.getPendingUiDialogs();
|
|
242
|
+
return {
|
|
243
|
+
running: session.isRunning() || dialogs.length > 0,
|
|
244
|
+
...(dialogs.length > 0 ? { busy: true } : {}),
|
|
245
|
+
state: await session.send({ type: 'get_state' }),
|
|
246
|
+
pendingUiRequests: dialogs,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
189
249
|
|
|
190
250
|
// A busy session answers from local flags: its `get_state` would queue behind
|
|
191
251
|
// the running turn (omp runs RPC handlers one at a time), and a timeout there
|
|
@@ -197,9 +257,9 @@ export async function buildAgentSnapshot(sessionId: string): Promise<AgentSnapsh
|
|
|
197
257
|
// chance to settle before they are trusted. A live run pays nothing —
|
|
198
258
|
// `RunSettle` probes only after 30s of quiet and settles only on omp's own
|
|
199
259
|
// `isSettled`.
|
|
200
|
-
if (
|
|
201
|
-
await
|
|
202
|
-
if (
|
|
260
|
+
if (omp.isBusy()) {
|
|
261
|
+
await omp.runSettle.reconcile('request');
|
|
262
|
+
if (omp.isBusy()) return busySessionPayload(omp) as AgentSnapshot;
|
|
203
263
|
}
|
|
204
264
|
|
|
205
265
|
try {
|
|
@@ -212,8 +272,9 @@ export async function buildAgentSnapshot(sessionId: string): Promise<AgentSnapsh
|
|
|
212
272
|
state,
|
|
213
273
|
pendingUiRequests: session.getPendingUiDialogs(),
|
|
214
274
|
// The child's own goal state, read from the mirror so the composer's Goal
|
|
215
|
-
// toggle reflects the CHILD rather than the client's last request.
|
|
216
|
-
|
|
275
|
+
// toggle reflects the CHILD rather than the client's last request. Goal is
|
|
276
|
+
// a Kabmo extension inside the omp child, so another harness reports off.
|
|
277
|
+
goal: { enabled: omp.modeMirror.goalEnabled, status: omp.modeMirror.goalStatus },
|
|
217
278
|
};
|
|
218
279
|
} catch (error) {
|
|
219
280
|
if (error instanceof WebRpcError && error.code === 'session_unresponsive') {
|
|
@@ -221,7 +282,7 @@ export async function buildAgentSnapshot(sessionId: string): Promise<AgentSnapsh
|
|
|
221
282
|
}
|
|
222
283
|
// A turn started between the check above and the RPC: report busy, not dead.
|
|
223
284
|
if (error instanceof WebRpcError && error.code === 'session_busy') {
|
|
224
|
-
return busySessionPayload(
|
|
285
|
+
return busySessionPayload(omp) as AgentSnapshot;
|
|
225
286
|
}
|
|
226
287
|
throw error;
|
|
227
288
|
}
|
|
@@ -232,7 +293,9 @@ export async function getAgentState({ params, request }: LoaderFunctionArgs) {
|
|
|
232
293
|
const { sessionId } = params;
|
|
233
294
|
if (!sessionId) return json({ error: 'session id is required' }, { status: 400 });
|
|
234
295
|
|
|
235
|
-
|
|
296
|
+
// Any harness: an ACP session has no `get_state` RPC, so its snapshot comes
|
|
297
|
+
// from the driver's own flags and config selectors.
|
|
298
|
+
const session = getLiveSession(sessionId);
|
|
236
299
|
if (!session || !session.isAlive()) {
|
|
237
300
|
// Another instance may be running it. Without this the client reads
|
|
238
301
|
// `running: false`, never reattaches its stream, and shows a timeline that
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The two command paths that only exist because a chat can run on a harness
|
|
8
|
+
* that is NOT omp: restoring one that has no session file, and answering a mode
|
|
9
|
+
* command where the `/kabmo-mode` extension does not exist.
|
|
10
|
+
*
|
|
11
|
+
* Both are dispatched from `routes/agent/command.ts` and both answer the same
|
|
12
|
+
* shapes a live omp session does, so the client cannot tell which transport
|
|
13
|
+
* served a command.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { freshProbe } from '@/server/lib/harness/probe-cache.server';
|
|
17
|
+
import { startAcpSession } from '@/server/lib/harness/spawn.server';
|
|
18
|
+
import { knownHarness, loadHarnessSession, repointHarnessSession } from '@/server/lib/harness/session-store.server';
|
|
19
|
+
import { selectValues } from '@/server/lib/harness/launch';
|
|
20
|
+
import { harnessOfSession } from '@/server/lib/omp/rpc/session-registry';
|
|
21
|
+
import { emitRealtimeSignal } from '@/server/lib/realtime/signals.server';
|
|
22
|
+
import { HARNESS_IDS, harnessDescriptor } from '@/shared/lib/harness/catalog';
|
|
23
|
+
import type { AcpConfigOption } from '@/server/lib/harness/acp/protocol';
|
|
24
|
+
import { applyAcpGoalAction, type AcpGoalHost } from '@/server/lib/harness/acp/acp-goal.server';
|
|
25
|
+
import { saveAcpPlanState } from '@/server/lib/harness/acp/acp-goal-state.server';
|
|
26
|
+
import type { HarnessSession } from '@/server/lib/harness/session';
|
|
27
|
+
import type { ModeRequest } from '@/server/lib/omp/mode/request';
|
|
28
|
+
import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Respawn the ACP session a recorded non-omp chat belongs to, or null when this
|
|
32
|
+
* is not one.
|
|
33
|
+
*
|
|
34
|
+
* The caller dispatches to the returned session exactly as it does to one that
|
|
35
|
+
* never stopped, which is what makes "open an old chat and keep talking" work
|
|
36
|
+
* for a harness whose agent writes no session file.
|
|
37
|
+
*
|
|
38
|
+
* Two refusals are deliberate:
|
|
39
|
+
*
|
|
40
|
+
* - an id this build's catalog no longer lists spawns NOTHING (a retired
|
|
41
|
+
* adapter must not be guessed at from a stale row);
|
|
42
|
+
* - a harness whose probe says it cannot `session/load` is refused in words,
|
|
43
|
+
* because the only alternative is starting a FRESH agent session under this
|
|
44
|
+
* chat's id — which would silently throw the conversation away.
|
|
45
|
+
*
|
|
46
|
+
* `omp-acp` is excluded even though ACP is what it speaks. It WRITES a session
|
|
47
|
+
* file, so the locator resumes it in place over RPC — the same chat, the same
|
|
48
|
+
* id, one row. `session/load` on omp FORKS (measured: a load for `01a1b49f-…`
|
|
49
|
+
* answered id `01a1b4cc-…`), and a forked id is a second record — a second
|
|
50
|
+
* sidebar row for one conversation, which is the defect the merge rule in
|
|
51
|
+
* `sidebar-data.server.ts` exists to prevent. The recorded mark is rewritten to
|
|
52
|
+
* `omp-rpc` on that path, which is truthful: RPC is then the transport that ran
|
|
53
|
+
* it.
|
|
54
|
+
*/
|
|
55
|
+
export async function resumeRecordedHarnessSession(
|
|
56
|
+
sessionId: string,
|
|
57
|
+
accessMode: ApprovalMode | null,
|
|
58
|
+
): Promise<HarnessSession | null> {
|
|
59
|
+
const record = await loadHarnessSession(sessionId);
|
|
60
|
+
const harness = knownHarness(record?.harness, HARNESS_IDS);
|
|
61
|
+
if (!record || !harness || harness === 'omp-rpc' || harness === 'omp-acp' || !record.cwd) return null;
|
|
62
|
+
|
|
63
|
+
const label = harnessDescriptor(harness)?.label ?? harness;
|
|
64
|
+
const probe = await freshProbe(harness);
|
|
65
|
+
if (probe?.capabilities.loadSession === false) {
|
|
66
|
+
throw new Error(`${label} cannot restore this chat: it does not support session/load.`);
|
|
67
|
+
}
|
|
68
|
+
const { session, realSessionId } = await startAcpSession({
|
|
69
|
+
harness,
|
|
70
|
+
sessionId,
|
|
71
|
+
// The AGENT's own id, stored because ACP may answer a different one than
|
|
72
|
+
// the caller asked for. `session/load` needs the agent's, never Kabmo's —
|
|
73
|
+
// and an EMPTY stored id means "the same as ours" (`saveHarnessSession`
|
|
74
|
+
// writes it blank in exactly that case), so the row's own id is the value to
|
|
75
|
+
// send. Passing '' here would silently start a FRESH agent session under
|
|
76
|
+
// this chat's id and throw the conversation away.
|
|
77
|
+
resumeAgentSessionId: record.agentSessionId || sessionId,
|
|
78
|
+
cwd: record.cwd,
|
|
79
|
+
accessMode,
|
|
80
|
+
});
|
|
81
|
+
// A forking load answers a NEW agent id, and the spawn recorded that id as its
|
|
82
|
+
// own row — a second sidebar row for one conversation. The chat keeps ITS id
|
|
83
|
+
// (the tab, the transcript and the layout all name it) and adopts the agent's.
|
|
84
|
+
await repointHarnessSession(sessionId, realSessionId).catch(() => {});
|
|
85
|
+
if (realSessionId !== sessionId) emitRealtimeSignal('sidebar-structure');
|
|
86
|
+
return session;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Answer a mode command on a harness that has no `/kabmo-mode` extension.
|
|
91
|
+
*
|
|
92
|
+
* Forwarding the extension prompt to any other agent made the MODEL read
|
|
93
|
+
* `/kabmo-mode plan on` as prose and opened a turn with it (measured on claude,
|
|
94
|
+
* whose next mode command was then refused as "already processing"). Its own
|
|
95
|
+
* ACP `mode` selector is the honest equivalent: `plan` is a value where the
|
|
96
|
+
* agent implements one, and a scope it cannot express is refused in words.
|
|
97
|
+
*/
|
|
98
|
+
export async function applyHarnessMode(
|
|
99
|
+
session: HarnessSession,
|
|
100
|
+
request: ModeRequest,
|
|
101
|
+
): Promise<{ ok: true; data: unknown } | { ok: false; error: string }> {
|
|
102
|
+
const harness = harnessOfSession(session);
|
|
103
|
+
const label = harnessDescriptor(harness)?.label ?? harness;
|
|
104
|
+
if (request.scope === 'goal') {
|
|
105
|
+
// Kabmo owns the record and the loop for every ACP transport (see
|
|
106
|
+
// `acp-goal.server.ts`); the agent needs no extension for it.
|
|
107
|
+
return applyAcpGoalAction(session as unknown as AcpGoalHost, request);
|
|
108
|
+
}
|
|
109
|
+
const state = (await session.send({ type: 'get_state' })) as { configOptions?: unknown } | undefined;
|
|
110
|
+
const options = Array.isArray(state?.configOptions) ? state.configOptions : [];
|
|
111
|
+
const selector = options.find(
|
|
112
|
+
(option): option is AcpConfigOption =>
|
|
113
|
+
typeof option === 'object' && option !== null && 'category' in option && option.category === 'mode',
|
|
114
|
+
);
|
|
115
|
+
const values = selectValues(selector).map((entry) => entry.value);
|
|
116
|
+
if (request.action !== 'on' && request.action !== 'off') {
|
|
117
|
+
const enabled = selector?.currentValue === 'plan';
|
|
118
|
+
// Mirror it: a dead ACP session has no selector left to ask, and the
|
|
119
|
+
// composer must still show the mode it was in.
|
|
120
|
+
void saveAcpPlanState(session.sessionId, enabled);
|
|
121
|
+
return { ok: true, data: { enabled } };
|
|
122
|
+
}
|
|
123
|
+
if (!values.includes('plan')) return { ok: false, error: `${label} has no plan mode` };
|
|
124
|
+
// `default` is the value every measured agent uses for "no special mode"; the
|
|
125
|
+
// first non-plan value is the fallback for an agent that names it differently.
|
|
126
|
+
const target = request.action === 'on'
|
|
127
|
+
? 'plan'
|
|
128
|
+
: values.find((value) => value === 'default') ?? values.find((value) => value !== 'plan');
|
|
129
|
+
if (!target) return { ok: false, error: `${label} has no plan mode` };
|
|
130
|
+
const data = await session.send({ type: 'set_mode', mode: target });
|
|
131
|
+
void saveAcpPlanState(session.sessionId, target === 'plan');
|
|
132
|
+
return { ok: true, data };
|
|
133
|
+
}
|
|
@@ -2,12 +2,14 @@ import { json } from '@/server/lib/remix-compat';
|
|
|
2
2
|
import type { ActionFunctionArgs } from '@/server/lib/remix-compat';
|
|
3
3
|
import { getDb } from '@/server/db.server';
|
|
4
4
|
import { startNewRpcSession } from '@/server/lib/omp/rpc/manager';
|
|
5
|
-
import { isApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
5
|
+
import { isApprovalMode, type ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
6
6
|
import { loadPersistedAccessMode } from '@/shared/lib/omp/config/access-mode.server';
|
|
7
7
|
import { rpcErrorResponse } from '@/server/lib/omp/rpc/errors';
|
|
8
8
|
import { kabmoModeEnv } from '@/server/lib/omp/extensions/locator';
|
|
9
9
|
import { parseModeSelection } from '@/server/lib/omp/mode/request';
|
|
10
10
|
import { projectModelForCwd } from '@/server/lib/workspace/project-model.server';
|
|
11
|
+
import { HARNESS_IDS, type HarnessId } from '@/shared/lib/harness/catalog';
|
|
12
|
+
import { startAcpSession } from '@/server/lib/harness/spawn.server';
|
|
11
13
|
|
|
12
14
|
/** The model-dropdown persists its selection here (actionType 'selectModel');
|
|
13
15
|
* a spawn that arrives without an explicit provider/modelId falls back to it. */
|
|
@@ -66,9 +68,21 @@ export async function action({ request }: ActionFunctionArgs) {
|
|
|
66
68
|
// (measured: `modes:{plan:true}` produced a child reporting `plan: null`).
|
|
67
69
|
const modes = body.modes !== undefined ? parseModeSelection(asRecord(body.modes)) : null;
|
|
68
70
|
const modeEnv = modes ? kabmoModeEnv(modes) : undefined;
|
|
71
|
+
// A harness other than omp's RPC runs over ACP. The pick is validated
|
|
72
|
+
// against the catalog, so a typo cannot spawn an arbitrary binary.
|
|
73
|
+
const harness = HARNESS_IDS.includes(body.harness as HarnessId) ? body.harness as HarnessId : 'omp-rpc';
|
|
69
74
|
// startNewRpcSession adopts the prewarmed idle process for this cwd when
|
|
70
75
|
// one exists (fired by the sidebar's New Session click) and otherwise
|
|
71
76
|
// cold-spawns — same contract, minus the boot wait when prewarmed.
|
|
77
|
+
if (harness !== 'omp-rpc') {
|
|
78
|
+
return await startAcpChat({
|
|
79
|
+
harness,
|
|
80
|
+
cwd,
|
|
81
|
+
body: body as Record<string, unknown>,
|
|
82
|
+
model: body.provider && body.modelId ? { provider: String(body.provider), modelId: String(body.modelId) } : null,
|
|
83
|
+
accessMode,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
72
86
|
const { session, realSessionId } = await startNewRpcSession(cwd, accessMode, modeEnv);
|
|
73
87
|
|
|
74
88
|
const { type, message, images, provider, modelId, thinkingLevel } = body as {
|
|
@@ -119,3 +133,51 @@ export async function action({ request }: ActionFunctionArgs) {
|
|
|
119
133
|
return rpcErrorResponse(error);
|
|
120
134
|
}
|
|
121
135
|
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The ACP half of this route: spawn the agent, apply the picks, run the first
|
|
139
|
+
* prompt. Kept in the same file because both branches answer the SAME shapes
|
|
140
|
+
* (`{sessionId, model}` / `{sessionId, data}`), and a client must not be able to
|
|
141
|
+
* tell which transport served a new chat.
|
|
142
|
+
*/
|
|
143
|
+
async function startAcpChat({ harness, cwd, body, model, accessMode }: {
|
|
144
|
+
harness: HarnessId;
|
|
145
|
+
cwd: string;
|
|
146
|
+
body: Record<string, unknown>;
|
|
147
|
+
model: { provider: string; modelId: string } | null;
|
|
148
|
+
accessMode: ApprovalMode;
|
|
149
|
+
}): Promise<Response> {
|
|
150
|
+
const type = String(body.type ?? '');
|
|
151
|
+
const projectModel = await projectModelForCwd(await getDb(), cwd);
|
|
152
|
+
const thinkingLevel = typeof body.thinkingLevel === 'string' ? body.thinkingLevel : null;
|
|
153
|
+
const mode = harnessModeSelection(body);
|
|
154
|
+
const { session, realSessionId } = await startAcpSession({
|
|
155
|
+
harness,
|
|
156
|
+
sessionId: `__new__${Bun.randomUUIDv7()}`,
|
|
157
|
+
cwd,
|
|
158
|
+
model: model ?? projectModel ?? await loadPersistedModel(),
|
|
159
|
+
thinkingLevel,
|
|
160
|
+
mode,
|
|
161
|
+
accessMode,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (type === 'ensure_session') {
|
|
165
|
+
return json({ success: true, sessionId: realSessionId, model: session.runModel, data: null, harness });
|
|
166
|
+
}
|
|
167
|
+
if (type === 'prompt') {
|
|
168
|
+
const ack = await session.send({
|
|
169
|
+
type: 'prompt',
|
|
170
|
+
message: typeof body.message === 'string' ? body.message : '',
|
|
171
|
+
...(Array.isArray(body.images) && body.images.length > 0 ? { images: body.images } : {}),
|
|
172
|
+
});
|
|
173
|
+
return json({ success: true, sessionId: realSessionId, data: ack, harness });
|
|
174
|
+
}
|
|
175
|
+
return json({ error: `Unsupported command: ${type}` }, { status: 400 });
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** The ACP mode id a new chat asked for, when the composer sent one. */
|
|
179
|
+
function harnessModeSelection(body: Record<string, unknown>): string | null {
|
|
180
|
+
const modes = asRecord(body.modes);
|
|
181
|
+
if (modes.plan === true) return 'plan';
|
|
182
|
+
return null;
|
|
183
|
+
}
|