@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
|
@@ -4,52 +4,29 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Pure helpers for omp's `ask` tool: read
|
|
8
|
-
* per-question dialogs omp raises for them back to the question they belong to
|
|
9
|
-
*
|
|
7
|
+
* Pure helpers for omp's `ask` tool: read the questions it asked and pair the
|
|
8
|
+
* per-question dialogs omp raises for them back to the question they belong to.
|
|
9
|
+
* The answers live in `ask-results.ts`.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* TWO payload shapes reach this file. Since 18.18.3 the tool takes ONE
|
|
12
|
+
* `{ html }` form (`ask-form/` parses it into questions) and the RPC host
|
|
13
|
+
* walks its named fields one dialog at a time — a `select`/`input`/`editor`
|
|
14
|
+
* per field, with the question as its title. Before that, the tool took
|
|
15
|
+
* `questions[]`, and a host that opted in with `set_ask_dialog` got every
|
|
16
|
+
* question in ONE `method:"ask"` frame matched by question ids. Persisted
|
|
17
|
+
* sessions keep the old shape, so both are still read; `set_ask_dialog` now
|
|
18
|
+
* only reaches extensions and omp's ratchet, not this tool.
|
|
17
19
|
*
|
|
18
|
-
* The
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* `(2 selected) ` prefix for multi-select questions), which is what lets the
|
|
23
|
-
* inline card put each frame back on the question it asked. Both shapes must
|
|
24
|
-
* keep working: the frame-ownership split knows each one.
|
|
20
|
+
* The title pairing is load-bearing: omp decorates a select's title with a
|
|
21
|
+
* `(2 selected) ` prefix and a ` (2/3)` progress suffix, and a rejected text
|
|
22
|
+
* answer re-asks as `question (Enter a number)`. What is left is what lets the
|
|
23
|
+
* inline card put each frame back on the question it asked.
|
|
25
24
|
*/
|
|
26
25
|
|
|
27
26
|
import type { ToolCallData } from '@/shared/types';
|
|
28
27
|
import type { ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
label: string;
|
|
32
|
-
description?: string;
|
|
33
|
-
preview?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface AskQuestion {
|
|
37
|
-
id?: string;
|
|
38
|
-
/** Short chip omp shows above the question ("Authentication"). */
|
|
39
|
-
header?: string;
|
|
40
|
-
question: string;
|
|
41
|
-
options: AskOption[];
|
|
42
|
-
multi: boolean;
|
|
43
|
-
/** Index of the option omp marks ` (Recommended)`. */
|
|
44
|
-
recommended?: number;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface AskAnswer {
|
|
48
|
-
selectedOptions: string[];
|
|
49
|
-
customInput?: string;
|
|
50
|
-
/** omp auto-selected the answer after `ask.timeout` elapsed. */
|
|
51
|
-
timedOut?: boolean;
|
|
52
|
-
}
|
|
28
|
+
import { parseAskForm } from '@/shared/lib/chat/ask-form';
|
|
29
|
+
import type { AskOption, AskQuestion } from '@/shared/lib/chat/ask-form/types';
|
|
53
30
|
|
|
54
31
|
/** The free-text escape hatch omp appends to every question's option list. */
|
|
55
32
|
const OTHER_OPTION = /^other\b/i;
|
|
@@ -75,6 +52,31 @@ export function normalizeAskText(value: string): string {
|
|
|
75
52
|
.toLowerCase();
|
|
76
53
|
}
|
|
77
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Index of the question a dialog title names.
|
|
57
|
+
*
|
|
58
|
+
* Exact after the decorations are stripped, else the longest question the
|
|
59
|
+
* title starts with followed by ` (` — the shape omp's field-by-field walk
|
|
60
|
+
* uses for a rejected text answer (`question (Enter a number)`). Longest wins
|
|
61
|
+
* so `Pick a colour (light)` is not captured by an `Pick a colour` beside it.
|
|
62
|
+
*/
|
|
63
|
+
export function askQuestionForTitle(questions: AskQuestion[], title: unknown): number {
|
|
64
|
+
if (typeof title !== 'string') return -1;
|
|
65
|
+
const needle = normalizeAskText(title);
|
|
66
|
+
if (!needle) return -1;
|
|
67
|
+
let best = -1;
|
|
68
|
+
let longest = 0;
|
|
69
|
+
for (let index = 0; index < questions.length; index += 1) {
|
|
70
|
+
const candidate = normalizeAskText(questions[index].question);
|
|
71
|
+
if (!candidate || candidate.length <= longest) continue;
|
|
72
|
+
if (needle === candidate || needle.startsWith(`${candidate} (`)) {
|
|
73
|
+
best = index;
|
|
74
|
+
longest = candidate.length;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return best;
|
|
78
|
+
}
|
|
79
|
+
|
|
78
80
|
function readOption(raw: unknown): AskOption | null {
|
|
79
81
|
if (typeof raw === 'string') {
|
|
80
82
|
const label = raw.trim();
|
|
@@ -112,13 +114,18 @@ export function isAskSettled(tool: ToolCallData): boolean {
|
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
/**
|
|
115
|
-
* The
|
|
116
|
-
*
|
|
117
|
+
* The questions of an `ask` tool call: parsed from its `html` form (18.18.3+),
|
|
118
|
+
* else from the `questions` array an older call carried. Empty when the tool is
|
|
119
|
+
* not an ask call or its arguments were truncated — callers fall back to the
|
|
117
120
|
* raw arguments/output rendering in that case.
|
|
118
121
|
*/
|
|
119
122
|
export function parseAskQuestions(tool: ToolCallData): AskQuestion[] {
|
|
120
123
|
const input = tool.input;
|
|
121
124
|
const record = typeof input === 'object' && input !== null ? (input as Record<string, unknown>) : null;
|
|
125
|
+
if (record && typeof record.html === 'string') {
|
|
126
|
+
const fromForm = parseAskForm(record.html);
|
|
127
|
+
if (fromForm.length > 0) return fromForm;
|
|
128
|
+
}
|
|
122
129
|
const raw = record && Array.isArray(record.questions) ? record.questions : [];
|
|
123
130
|
const questions: AskQuestion[] = [];
|
|
124
131
|
|
|
@@ -136,112 +143,13 @@ export function parseAskQuestions(tool: ToolCallData): AskQuestion[] {
|
|
|
136
143
|
: [],
|
|
137
144
|
multi: question.multi === true,
|
|
138
145
|
recommended: typeof question.recommended === 'number' ? question.recommended : undefined,
|
|
146
|
+
kind: 'choice',
|
|
139
147
|
});
|
|
140
148
|
}
|
|
141
149
|
|
|
142
150
|
return questions;
|
|
143
151
|
}
|
|
144
152
|
|
|
145
|
-
function readAnswer(row: Record<string, unknown>): AskAnswer {
|
|
146
|
-
return {
|
|
147
|
-
selectedOptions: Array.isArray(row.selectedOptions)
|
|
148
|
-
? row.selectedOptions.filter((value): value is string => typeof value === 'string')
|
|
149
|
-
: [],
|
|
150
|
-
customInput: typeof row.customInput === 'string' && row.customInput ? row.customInput : undefined,
|
|
151
|
-
timedOut: row.timedOut === true,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/** One `<id>: <answer>` line of a multi-question result. */
|
|
156
|
-
const ANSWER_LINE = /^([\w.-]+):\s*(.+)$/;
|
|
157
|
-
/** The single-question result's two prose shapes. */
|
|
158
|
-
const SELECTED_LINE = /^User selected:\s*(.+)$/m;
|
|
159
|
-
const CUSTOM_LINE = /^User provided custom input:\s*([\s\S]+)$/m;
|
|
160
|
-
|
|
161
|
-
/** `value` as omp renders it: a quoted string is typed input, a bare one is a
|
|
162
|
-
* picked label (comma-joined when the question allows several). */
|
|
163
|
-
function toAnswer(value: string, multi: boolean): AskAnswer {
|
|
164
|
-
const text = value.trim();
|
|
165
|
-
if (/^"[\s\S]*"$/.test(text)) return { selectedOptions: [], customInput: text.slice(1, -1) };
|
|
166
|
-
const labels = multi && text.includes(', ') ? text.split(', ') : [text];
|
|
167
|
-
return { selectedOptions: labels.map((label) => label.trim()).filter(Boolean) };
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Answers recovered from the tool's rendered text, used when `details` never
|
|
172
|
-
* reached this client. `details` is the richer source, but it is dropped by the
|
|
173
|
-
* live `tool_execution_end` frame on some omp builds; the text is the one part
|
|
174
|
-
* of a settled result every path carries, and it names each answer by question
|
|
175
|
-
* id (`language: Python`) or as a single sentence for a one-question ask.
|
|
176
|
-
*/
|
|
177
|
-
function parseAskOutputAnswers(output: string, questions: AskQuestion[]): (AskAnswer | null)[] {
|
|
178
|
-
const answers = questions.map((): AskAnswer | null => null);
|
|
179
|
-
const text = output.trim();
|
|
180
|
-
if (!text) return answers;
|
|
181
|
-
|
|
182
|
-
const byId = new Map<string, AskAnswer>();
|
|
183
|
-
for (const line of text.split('\n')) {
|
|
184
|
-
const match = ANSWER_LINE.exec(line.trim());
|
|
185
|
-
if (match) byId.set(match[1], toAnswer(match[2], questions.some((question) => question.multi)));
|
|
186
|
-
}
|
|
187
|
-
if (byId.size > 0) {
|
|
188
|
-
const ordered = [...byId.values()];
|
|
189
|
-
for (let index = 0; index < questions.length; index += 1) {
|
|
190
|
-
// The question id is the key omp prints; position is what is left when a
|
|
191
|
-
// payload carries no ids at all (omp requires them, so this is defensive).
|
|
192
|
-
const id = questions[index].id;
|
|
193
|
-
answers[index] = (id ? byId.get(id) : undefined) ?? ordered[index] ?? null;
|
|
194
|
-
}
|
|
195
|
-
return answers;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const selected = SELECTED_LINE.exec(text);
|
|
199
|
-
if (selected) {
|
|
200
|
-
answers[0] = toAnswer(selected[1], questions[0].multi);
|
|
201
|
-
return answers;
|
|
202
|
-
}
|
|
203
|
-
const custom = CUSTOM_LINE.exec(text);
|
|
204
|
-
if (custom) {
|
|
205
|
-
answers[0] = { selectedOptions: [], customInput: custom[1].trim() };
|
|
206
|
-
return answers;
|
|
207
|
-
}
|
|
208
|
-
if (questions.length === 1 && !text.includes('\n')) {
|
|
209
|
-
answers[0] = { selectedOptions: [text] };
|
|
210
|
-
}
|
|
211
|
-
return answers;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Answers recorded in an `ask` tool result, positionally aligned with
|
|
216
|
-
* `questions`. omp returns `details.results[]` for a multi-question ask and the
|
|
217
|
-
* bare answer fields for a single-question one; the rendered text backs both up.
|
|
218
|
-
*/
|
|
219
|
-
export function parseAskResult(tool: ToolCallData, questions: AskQuestion[]): (AskAnswer | null)[] {
|
|
220
|
-
const answers = questions.map((): AskAnswer | null => null);
|
|
221
|
-
if (questions.length === 0) return answers;
|
|
222
|
-
|
|
223
|
-
const details = tool.details ?? {};
|
|
224
|
-
const results = Array.isArray(details.results) ? (details.results as Record<string, unknown>[]) : null;
|
|
225
|
-
if (results) {
|
|
226
|
-
for (let index = 0; index < answers.length; index += 1) {
|
|
227
|
-
const row = results[index];
|
|
228
|
-
if (row && typeof row === 'object') answers[index] = readAnswer(row);
|
|
229
|
-
}
|
|
230
|
-
return answers;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
if (typeof details.selectedOptions !== 'undefined' || typeof details.customInput === 'string') {
|
|
234
|
-
answers[0] = readAnswer(details);
|
|
235
|
-
return answers;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// A failed/cancelled ask answers nothing; its text is the reason, which would
|
|
239
|
-
// otherwise read as an answer for whichever id its first sentence names.
|
|
240
|
-
if (isAskSettled(tool) || tool.isError) return answers;
|
|
241
|
-
|
|
242
|
-
return parseAskOutputAnswers(typeof tool.output === 'string' ? tool.output : '', questions);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
153
|
/**
|
|
246
154
|
* Bucket the ask's dialogs by question index.
|
|
247
155
|
*
|
|
@@ -258,12 +166,10 @@ export function groupAskFrames(
|
|
|
258
166
|
): ExtensionUiDialogRequest[][] {
|
|
259
167
|
const groups = questions.map((): ExtensionUiDialogRequest[] => []);
|
|
260
168
|
if (questions.length === 0) return groups;
|
|
261
|
-
const titles = questions.map((question) => normalizeAskText(question.question));
|
|
262
169
|
|
|
263
170
|
let cursor = 0;
|
|
264
171
|
for (const frame of frames) {
|
|
265
|
-
const
|
|
266
|
-
const index = titles.indexOf(title);
|
|
172
|
+
const index = askQuestionForTitle(questions, frame.title);
|
|
267
173
|
if (index > cursor) {
|
|
268
174
|
cursor = index;
|
|
269
175
|
} else if (
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reads the answers out of an `ask` tool result.
|
|
8
|
+
*
|
|
9
|
+
* The 18.18.3 form shape records them in `details.answers[]` — `{ name,
|
|
10
|
+
* question, answer }` — and prints the submitted data as JSON in the result
|
|
11
|
+
* text; the older tool returned `details.results[]` for a multi-question ask
|
|
12
|
+
* and bare answer fields for a single-question one, with `id: answer` prose as
|
|
13
|
+
* the fallback. All three are read because persisted sessions keep the old
|
|
14
|
+
* shapes, and `details` is dropped by the live `tool_execution_end` frame on
|
|
15
|
+
* some builds, which is what the text fallback exists for.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { ToolCallData } from '@/shared/types';
|
|
19
|
+
import type { AskAnswer, AskQuestion } from '@/shared/lib/chat/ask-form/types';
|
|
20
|
+
import { isAskSettled, normalizeAskText } from '@/shared/lib/chat/ask-questions';
|
|
21
|
+
|
|
22
|
+
function readAnswer(row: Record<string, unknown>): AskAnswer {
|
|
23
|
+
return {
|
|
24
|
+
selectedOptions: Array.isArray(row.selectedOptions)
|
|
25
|
+
? row.selectedOptions.filter((value): value is string => typeof value === 'string')
|
|
26
|
+
: [],
|
|
27
|
+
customInput: typeof row.customInput === 'string' && row.customInput ? row.customInput : undefined,
|
|
28
|
+
timedOut: row.timedOut === true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** One `<id>: <answer>` line of a multi-question result. */
|
|
33
|
+
const ANSWER_LINE = /^([\w.-]+):\s*(.+)$/;
|
|
34
|
+
/** The single-question result's two prose shapes. */
|
|
35
|
+
const SELECTED_LINE = /^User selected:\s*(.+)$/m;
|
|
36
|
+
const CUSTOM_LINE = /^User provided custom input:\s*([\s\S]+)$/m;
|
|
37
|
+
|
|
38
|
+
/** `value` as omp renders it: a quoted string is typed input, a bare one is a
|
|
39
|
+
* picked label (comma-joined when the question allows several). */
|
|
40
|
+
function toAnswer(value: string, multi: boolean): AskAnswer {
|
|
41
|
+
const text = value.trim();
|
|
42
|
+
if (/^"[\s\S]*"$/.test(text)) return { selectedOptions: [], customInput: text.slice(1, -1) };
|
|
43
|
+
const labels = multi && text.includes(', ') ? text.split(', ') : [text];
|
|
44
|
+
return { selectedOptions: labels.map((label) => label.trim()).filter(Boolean) };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Answers recovered from the tool's rendered text, used when `details` never
|
|
49
|
+
* reached this client. `details` is the richer source, but it is dropped by the
|
|
50
|
+
* live `tool_execution_end` frame on some omp builds; the text is the one part
|
|
51
|
+
* of a settled result every path carries. The form shape prints the submitted
|
|
52
|
+
* data as JSON after a marker line; the older tool named each answer by
|
|
53
|
+
* question id (`language: Python`) or drew a single sentence for a one-question
|
|
54
|
+
* ask.
|
|
55
|
+
*/
|
|
56
|
+
/** The form result's prose: the submitted JSON is the last `{…}` in the text. */
|
|
57
|
+
const FORM_RESULT = /(?:User answers:|submitted the form's current values:)[\s\S]*?(\{[\s\S]*\})\s*$/;
|
|
58
|
+
|
|
59
|
+
function parseAskOutputAnswers(output: string, questions: AskQuestion[]): (AskAnswer | null)[] {
|
|
60
|
+
const answers = questions.map((): AskAnswer | null => null);
|
|
61
|
+
const text = output.trim();
|
|
62
|
+
if (!text) return answers;
|
|
63
|
+
|
|
64
|
+
const form = FORM_RESULT.exec(text);
|
|
65
|
+
if (form) {
|
|
66
|
+
try {
|
|
67
|
+
const data = JSON.parse(form[1]) as Record<string, unknown>;
|
|
68
|
+
const timedOut = text.startsWith('No answer before the timeout');
|
|
69
|
+
for (const [name, value] of Object.entries(data)) {
|
|
70
|
+
const index = questions.findIndex((question) => question.id === name);
|
|
71
|
+
if (index >= 0) answers[index] = { ...fromFormData(questions[index], value), timedOut };
|
|
72
|
+
}
|
|
73
|
+
return answers;
|
|
74
|
+
} catch {
|
|
75
|
+
// Not the form's JSON; the prose shapes below still get a chance.
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const byId = new Map<string, AskAnswer>();
|
|
80
|
+
for (const line of text.split('\n')) {
|
|
81
|
+
const match = ANSWER_LINE.exec(line.trim());
|
|
82
|
+
if (match) byId.set(match[1], toAnswer(match[2], questions.some((question) => question.multi)));
|
|
83
|
+
}
|
|
84
|
+
if (byId.size > 0) {
|
|
85
|
+
const ordered = [...byId.values()];
|
|
86
|
+
for (let index = 0; index < questions.length; index += 1) {
|
|
87
|
+
// The question id is the key omp prints; position is what is left when a
|
|
88
|
+
// payload carries no ids at all (omp requires them, so this is defensive).
|
|
89
|
+
const id = questions[index].id;
|
|
90
|
+
answers[index] = (id ? byId.get(id) : undefined) ?? ordered[index] ?? null;
|
|
91
|
+
}
|
|
92
|
+
return answers;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const selected = SELECTED_LINE.exec(text);
|
|
96
|
+
if (selected) {
|
|
97
|
+
answers[0] = toAnswer(selected[1], questions[0].multi);
|
|
98
|
+
return answers;
|
|
99
|
+
}
|
|
100
|
+
const custom = CUSTOM_LINE.exec(text);
|
|
101
|
+
if (custom) {
|
|
102
|
+
answers[0] = { selectedOptions: [], customInput: custom[1].trim() };
|
|
103
|
+
return answers;
|
|
104
|
+
}
|
|
105
|
+
if (questions.length === 1 && !text.includes('\n')) {
|
|
106
|
+
answers[0] = { selectedOptions: [text] };
|
|
107
|
+
}
|
|
108
|
+
return answers;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The 18.18.3 result carries `details.answers[]` — one row per named control,
|
|
113
|
+
* `{ name, question, answer }` — with `answer` rendered the way omp's own
|
|
114
|
+
* `formAnswers` does: a picked option by its LABEL, `Other: <typed>` for free
|
|
115
|
+
* text, and ", "-joined labels for a checkbox group. Alignment is by control
|
|
116
|
+
* name, falling back to the question text.
|
|
117
|
+
*/
|
|
118
|
+
const OTHER_ANSWER = /^Other:\s*([\s\S]*)$/i;
|
|
119
|
+
|
|
120
|
+
function fromFormAnswer(question: AskQuestion, answer: string): AskAnswer {
|
|
121
|
+
if (question.kind === 'text') return { selectedOptions: [], customInput: answer.trim() || undefined };
|
|
122
|
+
const parts = question.multi ? answer.split(', ') : [answer];
|
|
123
|
+
const selectedOptions: string[] = [];
|
|
124
|
+
let customInput: string | undefined;
|
|
125
|
+
for (const part of parts) {
|
|
126
|
+
const other = OTHER_ANSWER.exec(part.trim());
|
|
127
|
+
if (other) customInput = other[1].trim() || undefined;
|
|
128
|
+
else if (part.trim()) selectedOptions.push(part.trim());
|
|
129
|
+
}
|
|
130
|
+
return { selectedOptions, customInput };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Answers recovered from the raw form data in the tool's text, `{ name: value }`. */
|
|
134
|
+
function fromFormData(question: AskQuestion, value: unknown): AskAnswer {
|
|
135
|
+
if (question.kind === 'text') {
|
|
136
|
+
const text = typeof value === 'number' ? String(value) : typeof value === 'string' ? value.trim() : '';
|
|
137
|
+
return { selectedOptions: [], customInput: text || undefined };
|
|
138
|
+
}
|
|
139
|
+
const raw = Array.isArray(value) ? value.map((entry) => String(entry)) : value === undefined ? [] : [String(value)];
|
|
140
|
+
const selectedOptions: string[] = [];
|
|
141
|
+
const typed: string[] = [];
|
|
142
|
+
for (const entry of raw) {
|
|
143
|
+
const label = question.options.find((option) => option.value === entry)?.label;
|
|
144
|
+
if (label) selectedOptions.push(label);
|
|
145
|
+
else if (entry) typed.push(entry);
|
|
146
|
+
}
|
|
147
|
+
return { selectedOptions, customInput: typed.length > 0 ? typed.join(', ') : undefined };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Answers recorded in an `ask` tool result, positionally aligned with
|
|
152
|
+
* `questions`. The form shape records them in `details.answers[]`; the older
|
|
153
|
+
* tool returned `details.results[]` for a multi-question ask and the bare
|
|
154
|
+
* answer fields for a single-question one. The rendered text backs both up.
|
|
155
|
+
*/
|
|
156
|
+
export function parseAskResult(tool: ToolCallData, questions: AskQuestion[]): (AskAnswer | null)[] {
|
|
157
|
+
const answers = questions.map((): AskAnswer | null => null);
|
|
158
|
+
if (questions.length === 0) return answers;
|
|
159
|
+
|
|
160
|
+
const details = tool.details ?? {};
|
|
161
|
+
const formAnswers = Array.isArray(details.answers) ? (details.answers as Record<string, unknown>[]) : null;
|
|
162
|
+
if (formAnswers && formAnswers.length > 0) {
|
|
163
|
+
const timedOut = details.timedOut === true;
|
|
164
|
+
for (const row of formAnswers) {
|
|
165
|
+
if (!row || typeof row !== 'object') continue;
|
|
166
|
+
const name = typeof row.name === 'string' ? row.name : '';
|
|
167
|
+
let index = name ? questions.findIndex((question) => question.id === name) : -1;
|
|
168
|
+
if (index === -1 && typeof row.question === 'string') {
|
|
169
|
+
const title = normalizeAskText(row.question);
|
|
170
|
+
index = questions.findIndex((question) => normalizeAskText(question.question) === title);
|
|
171
|
+
}
|
|
172
|
+
if (index === -1) continue;
|
|
173
|
+
const answer = typeof row.answer === 'string' ? row.answer : '';
|
|
174
|
+
answers[index] = { ...fromFormAnswer(questions[index], answer), timedOut };
|
|
175
|
+
}
|
|
176
|
+
return answers;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const results = Array.isArray(details.results) ? (details.results as Record<string, unknown>[]) : null;
|
|
180
|
+
if (results) {
|
|
181
|
+
for (let index = 0; index < answers.length; index += 1) {
|
|
182
|
+
const row = results[index];
|
|
183
|
+
if (row && typeof row === 'object') answers[index] = readAnswer(row);
|
|
184
|
+
}
|
|
185
|
+
return answers;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (typeof details.selectedOptions !== 'undefined' || typeof details.customInput === 'string') {
|
|
189
|
+
answers[0] = readAnswer(details);
|
|
190
|
+
return answers;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// A failed/cancelled ask answers nothing; its text is the reason, which would
|
|
194
|
+
// otherwise read as an answer for whichever id its first sentence names.
|
|
195
|
+
if (isAskSettled(tool) || tool.isError) return answers;
|
|
196
|
+
|
|
197
|
+
return parseAskOutputAnswers(typeof tool.output === 'string' ? tool.output : '', questions);
|
|
198
|
+
}
|
|
@@ -5,7 +5,7 @@ const CACHE_TTL_MS = 300_000;
|
|
|
5
5
|
|
|
6
6
|
/** Cache keys: `'agent'`, `'command::<root>'`, and `'file::<root>'` per workspace root. */
|
|
7
7
|
const AGENTS_KEY = 'agent';
|
|
8
|
-
const commandKey = (root: string): string => `command::${root}`;
|
|
8
|
+
const commandKey = (root: string, sessionId?: string | null): string => `command::${root}::${sessionId ?? ''}`;
|
|
9
9
|
const fileKey = (root: string): string => `file::${root}`;
|
|
10
10
|
|
|
11
11
|
interface CacheEntry {
|
|
@@ -161,8 +161,8 @@ async function loadFileItems(root: string | null): Promise<ComposerPickItem[]> {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/** Load command + skill items, deduping concurrent callers and caching 5 minutes. */
|
|
164
|
-
async function loadCommandItems(root: string | null): Promise<ComposerPickItem[]> {
|
|
165
|
-
const key = commandKey(root ?? '');
|
|
164
|
+
async function loadCommandItems(root: string | null, sessionId?: string | null): Promise<ComposerPickItem[]> {
|
|
165
|
+
const key = commandKey(root ?? '', sessionId);
|
|
166
166
|
const cached = cache.get(key);
|
|
167
167
|
if (cached && cached.expiresAt > Date.now()) return cached.data;
|
|
168
168
|
|
|
@@ -171,7 +171,13 @@ async function loadCommandItems(root: string | null): Promise<ComposerPickItem[]
|
|
|
171
171
|
|
|
172
172
|
const pending = (async () => {
|
|
173
173
|
try {
|
|
174
|
-
const
|
|
174
|
+
const params = new URLSearchParams();
|
|
175
|
+
if (root) params.set('root', root);
|
|
176
|
+
// The live chat's OWN command list (ACP agents publish one); without the
|
|
177
|
+
// id the route falls back to omp's utility catalog, which is a different
|
|
178
|
+
// agent's vocabulary.
|
|
179
|
+
if (sessionId) params.set('sessionId', sessionId);
|
|
180
|
+
const query = params.size > 0 ? `?${params.toString()}` : '';
|
|
175
181
|
const [commands, skills] = await Promise.all([
|
|
176
182
|
fetchJson<{ commands: CommandItem[] }>(`/api/settings/commands${query}`),
|
|
177
183
|
fetchJson<{ skills: SkillItem[] }>(`/api/settings/skills${query}`),
|
|
@@ -192,17 +198,23 @@ async function loadCommandItems(root: string | null): Promise<ComposerPickItem[]
|
|
|
192
198
|
* Load pick items for a trigger kind. `mention` merges agents (first) and
|
|
193
199
|
* workspace files; `command` merges commands and skills, both scoped to `root`
|
|
194
200
|
* so a workspace's own `.omp/commands` and `.omp/skills` are offered.
|
|
201
|
+
*
|
|
202
|
+
* `includeAgents: false` drops the omp subagent rows: they describe agents only
|
|
203
|
+
* omp has, and translating a pick into "use the task tool" is meaningless on an
|
|
204
|
+
* ACP harness. Files stay — every agent can read a path.
|
|
195
205
|
*/
|
|
196
206
|
export function loadComposerItems(
|
|
197
207
|
kind: ComposerPickKind,
|
|
198
208
|
root?: string | null,
|
|
209
|
+
sessionId?: string | null,
|
|
210
|
+
options: { includeAgents?: boolean } = {},
|
|
199
211
|
): Promise<ComposerPickItem[]> {
|
|
200
212
|
if (kind === 'mention') {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
);
|
|
213
|
+
const files = loadFileItems(root ?? null);
|
|
214
|
+
if (options.includeAgents === false) return files;
|
|
215
|
+
return Promise.all([loadAgentItems(), files]).then(([agents, fileItems]) => [...agents, ...fileItems]);
|
|
204
216
|
}
|
|
205
|
-
return loadCommandItems(root ?? null);
|
|
217
|
+
return loadCommandItems(root ?? null, sessionId);
|
|
206
218
|
}
|
|
207
219
|
|
|
208
220
|
/** Load agent names via the shared agent cache. Never throws. */
|
|
@@ -43,10 +43,14 @@ describe('contextUsageBand', () => {
|
|
|
43
43
|
expect(clampContextPercent(63.4)).toBe(63.4);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
test('every band has its own tone', () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
test('every band has its own tone, and the tone is the SOLVED signal level', () => {
|
|
47
|
+
// `-text`, not the palette hex: the arc is a 2px graphic and the raw signal
|
|
48
|
+
// hex fails the 3:1 non-text floor on most palettes (`usage.ts`). Pinning
|
|
49
|
+
// the exact token is what keeps a later "simplification" from putting the
|
|
50
|
+
// fill colour back on a stroke.
|
|
51
|
+
expect(CONTEXT_BAND_TONES.healthy.text).toBe('text-success-text');
|
|
52
|
+
expect(CONTEXT_BAND_TONES.warning.text).toBe('text-warning-text');
|
|
53
|
+
expect(CONTEXT_BAND_TONES.critical.text).toBe('text-error-text');
|
|
50
54
|
expect(CONTEXT_BAND_TONES.healthy.fill).toBe('bg-success');
|
|
51
55
|
expect(CONTEXT_BAND_TONES.critical.fill).toBe('bg-error');
|
|
52
56
|
expect(new Set(Object.values(CONTEXT_BAND_TONES).map((tone) => tone.text)).size).toBe(3);
|
|
@@ -49,11 +49,25 @@ export function contextUsageBand(percent: number): ContextUsageBand {
|
|
|
49
49
|
* `currentColor`, so the tone is a text class; the popover's status dot needs
|
|
50
50
|
* the same colour as a background, and deriving one from the other with a
|
|
51
51
|
* string replace is how the two drift apart.
|
|
52
|
+
*
|
|
53
|
+
* `text` is the SOLVED token (`--theme-<slot>-text`), not the palette hex, and
|
|
54
|
+
* that is a contrast budget rather than a preference: the arc is a 2px stroke —
|
|
55
|
+
* a graphic, under WCAG's 3:1 non-text floor. The raw signal hex is chosen for
|
|
56
|
+
* a FILL and measures 1.53:1 (`warning` on `carbonfox-light`), 1.75:1
|
|
57
|
+
* (`success` on `nord-light`) and 2.88:1 (`error` on `fields-of-the-shire-dark`)
|
|
58
|
+
* against paper, so a critical ring on that dark palette was a dim smear. The
|
|
59
|
+
* `-text` level is solved to 4.50:1 on every one of the 63 palettes
|
|
60
|
+
* (`signalTextColor`), for both light and dark.
|
|
61
|
+
*
|
|
62
|
+
* The same class on a `<span>` resolves to the identical value through the
|
|
63
|
+
* generated `text-<slot>` rule in `tailwind.css`, so a status WORD keeps the
|
|
64
|
+
* colour it always had. `fill` stays the palette hex: it is a solid ground, the
|
|
65
|
+
* one thing those hexes were chosen for.
|
|
52
66
|
*/
|
|
53
67
|
export const CONTEXT_BAND_TONES: Record<ContextUsageBand, { text: string; fill: string }> = {
|
|
54
|
-
healthy: { text: 'text-success', fill: 'bg-success' },
|
|
55
|
-
warning: { text: 'text-warning', fill: 'bg-warning' },
|
|
56
|
-
critical: { text: 'text-error', fill: 'bg-error' },
|
|
68
|
+
healthy: { text: 'text-success-text', fill: 'bg-success' },
|
|
69
|
+
warning: { text: 'text-warning-text', fill: 'bg-warning' },
|
|
70
|
+
critical: { text: 'text-error-text', fill: 'bg-error' },
|
|
57
71
|
};
|
|
58
72
|
|
|
59
73
|
export interface ContextRingGeometry {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* When the Stop button escalates.
|
|
8
|
+
*
|
|
9
|
+
* The escalation exists because `abort` is awaited server-side until the turn
|
|
10
|
+
* really stops, so a wedged session never answers and the button would hang with
|
|
11
|
+
* it. Its first line of defence is the reply itself: a 500 means the server
|
|
12
|
+
* FAILED to stop anything, and treating any HTTP status as a clean stop left the
|
|
13
|
+
* button doing nothing at all — measured on `omp-acp`, where `abort` answered
|
|
14
|
+
* `{"error":"undefined is not an object (evaluating 'this.write')"}` and the
|
|
15
|
+
* turn kept running.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
19
|
+
import { stopAgentSession } from '@/shared/lib/chat/omp/abort';
|
|
20
|
+
|
|
21
|
+
const realFetch = globalThis.fetch;
|
|
22
|
+
const posted: Array<{ type: string }> = [];
|
|
23
|
+
|
|
24
|
+
function stubFetch(answer: (body: { type: string }) => Response): void {
|
|
25
|
+
globalThis.fetch = (async (_input: RequestInfo | URL, init?: RequestInit) => {
|
|
26
|
+
const body = JSON.parse(String(init?.body ?? '{}')) as { type: string };
|
|
27
|
+
posted.push(body);
|
|
28
|
+
return answer(body);
|
|
29
|
+
}) as unknown as typeof fetch;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
globalThis.fetch = realFetch;
|
|
34
|
+
posted.length = 0;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('stopAgentSession', () => {
|
|
38
|
+
test('a successful abort is enough, and nothing is reset', async () => {
|
|
39
|
+
stubFetch(() => Response.json({ success: true, data: null }));
|
|
40
|
+
await stopAgentSession('session-1');
|
|
41
|
+
expect(posted.map((body) => body.type)).toEqual(['abort']);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('a failed abort escalates to force_reset', async () => {
|
|
45
|
+
stubFetch((body) =>
|
|
46
|
+
body.type === 'abort'
|
|
47
|
+
? Response.json({ error: 'undefined is not an object' }, { status: 500 })
|
|
48
|
+
: Response.json({ success: true, data: null }),
|
|
49
|
+
);
|
|
50
|
+
await stopAgentSession('session-1');
|
|
51
|
+
expect(posted.map((body) => body.type)).toEqual(['abort', 'force_reset']);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('an abort the server never answered escalates too', async () => {
|
|
55
|
+
stubFetch(() => {
|
|
56
|
+
throw new TypeError('connection dropped');
|
|
57
|
+
});
|
|
58
|
+
await stopAgentSession('session-1');
|
|
59
|
+
expect(posted.map((body) => body.type)).toEqual(['abort', 'force_reset']);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -27,12 +27,18 @@ function postCommand(sessionId: string, body: Record<string, unknown>, signal?:
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/** Ask the session to stop, then reset its process if it does not stop in time.
|
|
30
|
-
* Failures are swallowed: the event stream is the source of truth for state.
|
|
30
|
+
* Failures are swallowed: the event stream is the source of truth for state.
|
|
31
|
+
* A reply that did not succeed counts as a failure, not as a stop: the server
|
|
32
|
+
* answers a broken `abort` with 500 and the turn keeps running, so treating
|
|
33
|
+
* any HTTP status as success left the Stop button doing nothing at all
|
|
34
|
+
* (measured on `omp-acp`: `{"error":"undefined is not an object
|
|
35
|
+
* (evaluating 'this.write')"}` and no `session/cancel` on the wire). */
|
|
31
36
|
export async function stopAgentSession(sessionId: string): Promise<void> {
|
|
32
37
|
const grace = new AbortController();
|
|
33
38
|
const timer = setTimeout(() => grace.abort(), ABORT_GRACE_MS);
|
|
34
39
|
try {
|
|
35
|
-
const stopped = await postCommand(sessionId, { type: 'abort' }, grace.signal)
|
|
40
|
+
const stopped = await postCommand(sessionId, { type: 'abort' }, grace.signal)
|
|
41
|
+
.then((res) => res.ok, () => false);
|
|
36
42
|
if (stopped) return;
|
|
37
43
|
await postCommand(sessionId, { type: 'force_reset' }).catch(() => null);
|
|
38
44
|
} finally {
|