@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
|
@@ -33,14 +33,20 @@ import {
|
|
|
33
33
|
import { BRAND_COLORS } from '@/shared/lib/models/provider/brand-color';
|
|
34
34
|
import { FILE_BRAND_COLORS } from '@/shared/lib/icons/file-brand-color';
|
|
35
35
|
import { ICON_TINT_TOKENS, iconHue, iconTintRole, iconTone } from '@/shared/lib/icons/tint';
|
|
36
|
+
import { resolveTheme } from '@/shared/lib/theme/catalog';
|
|
36
37
|
|
|
37
38
|
interface IconStyleSectionProps {
|
|
38
39
|
settings: SettingsState;
|
|
39
40
|
onUpdate: (updater: Partial<SettingsState> | ((previous: SettingsState) => SettingsState)) => void;
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
/** The paper of the palette being previewed, so the sample shows THAT palette's tone. */
|
|
44
|
+
function previewPaper(theme: string): string {
|
|
45
|
+
return resolveTheme(theme).paper;
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
/** One functional glyph, painted the way the chosen mode would paint it. */
|
|
43
|
-
function GlyphSample({ name, Icon, colored }: { name: string; Icon: typeof Check; colored: boolean }) {
|
|
49
|
+
function GlyphSample({ name, Icon, colored, paper }: { name: string; Icon: typeof Check; colored: boolean; paper: string }) {
|
|
44
50
|
const role = iconTintRole(name);
|
|
45
51
|
// The role wins over the hue, exactly as the stylesheet orders its rules.
|
|
46
52
|
// Same formula as the stylesheet's light paint, through the same helper: the
|
|
@@ -49,7 +55,7 @@ function GlyphSample({ name, Icon, colored }: { name: string; Icon: typeof Check
|
|
|
49
55
|
? undefined
|
|
50
56
|
: role
|
|
51
57
|
? ICON_TINT_TOKENS[role]
|
|
52
|
-
: iconTone(iconHue(name), 'light');
|
|
58
|
+
: iconTone(iconHue(name), 'light', paper);
|
|
53
59
|
return <Icon size={13} strokeWidth={2} style={color ? { color } : undefined} aria-hidden="true" />;
|
|
54
60
|
}
|
|
55
61
|
|
|
@@ -71,12 +77,12 @@ function BrandSample({ name, base, colored }: { name: string; base: string; colo
|
|
|
71
77
|
);
|
|
72
78
|
}
|
|
73
79
|
|
|
74
|
-
function Miniature({ colored }: { colored: boolean }) {
|
|
80
|
+
function Miniature({ colored, paper }: { colored: boolean; paper: string }) {
|
|
75
81
|
return (
|
|
76
82
|
<span className="flex h-full items-center gap-1.5 rounded-md border border-ink/10 bg-canvas/60 px-2">
|
|
77
|
-
<GlyphSample name="Trash2" Icon={Trash2} colored={colored} />
|
|
78
|
-
<GlyphSample name="Check" Icon={Check} colored={colored} />
|
|
79
|
-
<GlyphSample name="Sparkles" Icon={Sparkles} colored={colored} />
|
|
83
|
+
<GlyphSample name="Trash2" Icon={Trash2} colored={colored} paper={paper} />
|
|
84
|
+
<GlyphSample name="Check" Icon={Check} colored={colored} paper={paper} />
|
|
85
|
+
<GlyphSample name="Sparkles" Icon={Sparkles} colored={colored} paper={paper} />
|
|
80
86
|
<span className="mx-0.5 h-4 w-px bg-ink/10" />
|
|
81
87
|
<BrandSample name="claude" base={BRAND_COLORS.claude.light} colored={colored} />
|
|
82
88
|
<BrandSample name="Typescript" base={FILE_BRAND_COLORS.Typescript.light} colored={colored} />
|
|
@@ -84,13 +90,16 @@ function Miniature({ colored }: { colored: boolean }) {
|
|
|
84
90
|
);
|
|
85
91
|
}
|
|
86
92
|
|
|
87
|
-
const MINIATURES: Record<IconStyle, ComponentType> = {
|
|
88
|
-
monochrome: () => <Miniature colored={false} />,
|
|
89
|
-
color: () => <Miniature colored />,
|
|
90
|
-
};
|
|
91
|
-
|
|
92
93
|
export function IconStyleSection({ settings, onUpdate }: IconStyleSectionProps) {
|
|
93
94
|
const selected = resolveIconStyle(settings.iconStyle);
|
|
95
|
+
// The tone is solved per PAPER bucket, so the sample has to read the palette
|
|
96
|
+
// the user is actually on — otherwise the preview promises a colour the
|
|
97
|
+
// document will not paint.
|
|
98
|
+
const paper = previewPaper(settings.theme);
|
|
99
|
+
const MINIATURES: Record<IconStyle, ComponentType> = {
|
|
100
|
+
monochrome: () => <Miniature colored={false} paper={paper} />,
|
|
101
|
+
color: () => <Miniature colored paper={paper} />,
|
|
102
|
+
};
|
|
94
103
|
|
|
95
104
|
return (
|
|
96
105
|
<section className="space-y-3">
|
|
@@ -16,10 +16,10 @@ import { useEffect, useState } from 'preact/hooks';
|
|
|
16
16
|
import { Check, Coins, ShieldCheck, Target } from 'lucide-preact';
|
|
17
17
|
import type { AIModelOption, SettingsState } from '@/shared/types';
|
|
18
18
|
import { fetchModelsData } from '@/shared/lib/models/client';
|
|
19
|
-
import { modelKey } from '@/shared/lib/models/identity';
|
|
20
19
|
import { providerLabel } from '@/shared/lib/models/provider/label';
|
|
21
20
|
import { useProviderNames } from '@/client/hooks/models/use-provider-names';
|
|
22
21
|
import { normalizeGoalBudget } from '@/shared/lib/omp/mode/budget';
|
|
22
|
+
import { SearchSelect } from '@/client/components/common/search-select';
|
|
23
23
|
|
|
24
24
|
interface ChatGoalSectionProps {
|
|
25
25
|
settings: SettingsState;
|
|
@@ -135,23 +135,23 @@ export function ChatGoalSection({ settings, onUpdate }: ChatGoalSectionProps) {
|
|
|
135
135
|
<div className="rounded-lg border border-ink/15 bg-paper p-3.5 space-y-3">
|
|
136
136
|
<div>
|
|
137
137
|
<label className="mb-1 block text-[10px] font-semibold uppercase tracking-wider text-ink/45">Auditor model</label>
|
|
138
|
-
<
|
|
138
|
+
<SearchSelect
|
|
139
|
+
ariaLabel="Auditor model"
|
|
139
140
|
value={auditModel}
|
|
140
|
-
onChange={(
|
|
141
|
+
onChange={(next) => onUpdate({ goalAuditModel: next })}
|
|
141
142
|
disabled={loading}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</select>
|
|
143
|
+
// The session's own model is a real default, not a hidden fallback:
|
|
144
|
+
// a goal runs on the provider the chat runs on unless the operator
|
|
145
|
+
// says otherwise, so it is the placeholder row.
|
|
146
|
+
placeholder="Session model (default)"
|
|
147
|
+
className="w-full py-1.5 text-[11.5px]"
|
|
148
|
+
options={models.map((model) => ({
|
|
149
|
+
value: `${model.provider}/${model.id}`,
|
|
150
|
+
label: model.name,
|
|
151
|
+
hint: `${model.provider}/${model.id}`,
|
|
152
|
+
group: providerLabel(model.provider, providerNames),
|
|
153
|
+
}))}
|
|
154
|
+
/>
|
|
155
155
|
<p className="mt-1 text-[10.5px] text-ink/45">
|
|
156
156
|
The audit is a classification, not a task: it runs with thinking off, one small call per turn.
|
|
157
157
|
</p>
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* "Add provider" for ONE harness — the typed twin of an import.
|
|
8
|
+
*
|
|
9
|
+
* Everything the form decides is a fact the registry cannot discover by itself:
|
|
10
|
+
* the endpoint, the credential, and (for a registry that needs them) the model
|
|
11
|
+
* ids. Everything else is DERIVED, on purpose:
|
|
12
|
+
*
|
|
13
|
+
* - **the id** comes from `providerSlugFrom`, the same function the server
|
|
14
|
+
* validates with, so the key printed under the field is the key that lands —
|
|
15
|
+
* no "my gateway" saved as `provider-1712345`;
|
|
16
|
+
* - **the protocol** is left to the probe. A user knows their gateway, rarely
|
|
17
|
+
* which wire API it answers; the route asks the host and refuses by name when
|
|
18
|
+
* the target cannot speak the answer (`kenari` declares Chat and works in
|
|
19
|
+
* claude through Anthropic Messages — measured).
|
|
20
|
+
*
|
|
21
|
+
* There is no protocol picker because a wrong pick is indistinguishable from a
|
|
22
|
+
* working one until the first request; the probe has evidence, a dropdown has an
|
|
23
|
+
* opinion.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { useState } from 'preact/hooks';
|
|
27
|
+
import { Check, Loader2, Plus } from 'lucide-preact';
|
|
28
|
+
import type { HarnessImportOutcome, HarnessProviderSupport } from '@/shared/types/harness';
|
|
29
|
+
import { providerIdProblem, providerSlugFrom } from '@/shared/lib/harness/provider-slug';
|
|
30
|
+
|
|
31
|
+
const INPUT_CLASS =
|
|
32
|
+
'w-full rounded-md border border-ink/20 bg-paper px-2 py-1.5 font-mono text-[11px] text-ink outline-none transition-colors placeholder:text-ink/30 focus:border-ink/50';
|
|
33
|
+
|
|
34
|
+
export interface AddProviderInput {
|
|
35
|
+
name: string;
|
|
36
|
+
baseUrl: string;
|
|
37
|
+
apiKey: string;
|
|
38
|
+
models?: string[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Comma- or newline-separated model ids, trimmed and de-duplicated. */
|
|
42
|
+
function parseModelIds(text: string): string[] {
|
|
43
|
+
const seen = new Set<string>();
|
|
44
|
+
const out: string[] = [];
|
|
45
|
+
for (const entry of text.split(/[\n,]+/)) {
|
|
46
|
+
const id = entry.trim();
|
|
47
|
+
if (!id || seen.has(id)) continue;
|
|
48
|
+
seen.add(id);
|
|
49
|
+
out.push(id);
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function AddProviderForm({
|
|
55
|
+
support, onAdd,
|
|
56
|
+
}: {
|
|
57
|
+
support: HarnessProviderSupport;
|
|
58
|
+
onAdd: (input: AddProviderInput) => Promise<HarnessImportOutcome>;
|
|
59
|
+
}) {
|
|
60
|
+
const [open, setOpen] = useState(false);
|
|
61
|
+
const [name, setName] = useState('');
|
|
62
|
+
const [baseUrl, setBaseUrl] = useState('');
|
|
63
|
+
const [apiKey, setApiKey] = useState('');
|
|
64
|
+
const [models, setModels] = useState('');
|
|
65
|
+
const [saving, setSaving] = useState(false);
|
|
66
|
+
const [outcome, setOutcome] = useState<HarnessImportOutcome | null>(null);
|
|
67
|
+
|
|
68
|
+
const id = providerSlugFrom(name);
|
|
69
|
+
const idProblem = name.trim() ? providerIdProblem(id) : null;
|
|
70
|
+
// A registry entry IS its endpoint; an environment harness needs the URL or a
|
|
71
|
+
// key to have anything to write at all.
|
|
72
|
+
const needsUrl = support.level === 'full';
|
|
73
|
+
const canSubmit = Boolean(name.trim()) && !idProblem && !saving
|
|
74
|
+
&& (!needsUrl || Boolean(baseUrl.trim()));
|
|
75
|
+
|
|
76
|
+
const submit = async () => {
|
|
77
|
+
setSaving(true);
|
|
78
|
+
try {
|
|
79
|
+
const result = await onAdd({
|
|
80
|
+
name: name.trim(),
|
|
81
|
+
baseUrl: baseUrl.trim(),
|
|
82
|
+
apiKey: apiKey.trim(),
|
|
83
|
+
...(models.trim() ? { models: parseModelIds(models) } : {}),
|
|
84
|
+
});
|
|
85
|
+
setOutcome(result);
|
|
86
|
+
if (!result.problem) {
|
|
87
|
+
setName('');
|
|
88
|
+
setBaseUrl('');
|
|
89
|
+
setApiKey('');
|
|
90
|
+
setModels('');
|
|
91
|
+
}
|
|
92
|
+
} finally {
|
|
93
|
+
setSaving(false);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
if (!open) {
|
|
98
|
+
return (
|
|
99
|
+
<div className="mt-2">
|
|
100
|
+
<button
|
|
101
|
+
type="button"
|
|
102
|
+
onClick={() => setOpen(true)}
|
|
103
|
+
className="inline-flex cursor-pointer items-center gap-1 rounded-md border border-ink/20 px-2 py-1 text-[11px] text-ink/70 transition-colors hover:border-ink/40 hover:text-ink"
|
|
104
|
+
>
|
|
105
|
+
<Plus size={11} /> Add provider
|
|
106
|
+
</button>
|
|
107
|
+
{outcome?.problem && (
|
|
108
|
+
<p className="mt-1 text-[10px] text-ink/70">{outcome.problem}</p>
|
|
109
|
+
)}
|
|
110
|
+
{outcome && !outcome.problem && (
|
|
111
|
+
<p className="mt-1 text-[10px] text-ink/55">{outcome.detail ?? 'Added.'}</p>
|
|
112
|
+
)}
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div className="mt-2 space-y-2 rounded-md border border-ink/15 bg-ink/[0.02] p-2">
|
|
119
|
+
<div className="flex items-center justify-between">
|
|
120
|
+
<span className="text-[10px] font-semibold uppercase tracking-wider text-ink/45">Add provider</span>
|
|
121
|
+
<span className="font-mono text-[9px] text-ink/35">
|
|
122
|
+
{support.protocols.length > 0 ? 'protocol measured on save' : 'no provider slot here'}
|
|
123
|
+
</span>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<label className="flex flex-col gap-1">
|
|
127
|
+
<span className="text-[10px] text-ink/50">Name</span>
|
|
128
|
+
<input
|
|
129
|
+
type="text"
|
|
130
|
+
value={name}
|
|
131
|
+
placeholder="My Gateway"
|
|
132
|
+
onInput={(e) => setName(e.currentTarget.value)}
|
|
133
|
+
className={INPUT_CLASS}
|
|
134
|
+
/>
|
|
135
|
+
{id && (
|
|
136
|
+
<span className="font-mono text-[9px] text-ink/35">
|
|
137
|
+
id: {id}{idProblem ? '' : ` · ${support.pointer ?? 'registry'}`}
|
|
138
|
+
</span>
|
|
139
|
+
)}
|
|
140
|
+
{idProblem && <span className="text-[10px] text-ink/70">{idProblem}</span>}
|
|
141
|
+
</label>
|
|
142
|
+
|
|
143
|
+
<label className="flex flex-col gap-1">
|
|
144
|
+
<span className="text-[10px] text-ink/50">Base URL</span>
|
|
145
|
+
<input
|
|
146
|
+
type="text"
|
|
147
|
+
value={baseUrl}
|
|
148
|
+
placeholder="https://gateway.example/v1"
|
|
149
|
+
onInput={(e) => setBaseUrl(e.currentTarget.value)}
|
|
150
|
+
className={INPUT_CLASS}
|
|
151
|
+
/>
|
|
152
|
+
{support.level === 'environment' && support.env && (
|
|
153
|
+
<span className="font-mono text-[9px] text-ink/35">
|
|
154
|
+
becomes {support.env.baseUrl} — host root, the agent appends its own path
|
|
155
|
+
</span>
|
|
156
|
+
)}
|
|
157
|
+
</label>
|
|
158
|
+
|
|
159
|
+
<label className="flex flex-col gap-1">
|
|
160
|
+
<span className="text-[10px] text-ink/50">API key</span>
|
|
161
|
+
<input
|
|
162
|
+
type="password"
|
|
163
|
+
value={apiKey}
|
|
164
|
+
autoComplete="off"
|
|
165
|
+
placeholder="sk-…"
|
|
166
|
+
onInput={(e) => setApiKey(e.currentTarget.value)}
|
|
167
|
+
className={INPUT_CLASS}
|
|
168
|
+
/>
|
|
169
|
+
{support.credentialLabel && (
|
|
170
|
+
<span className="font-mono text-[9px] text-ink/35">stored as {support.credentialLabel}</span>
|
|
171
|
+
)}
|
|
172
|
+
</label>
|
|
173
|
+
|
|
174
|
+
{support.level === 'full' && (
|
|
175
|
+
<label className="flex flex-col gap-1">
|
|
176
|
+
<span className="text-[10px] text-ink/50">Models</span>
|
|
177
|
+
<input
|
|
178
|
+
type="text"
|
|
179
|
+
value={models}
|
|
180
|
+
placeholder="model-id, another-id"
|
|
181
|
+
onInput={(e) => setModels(e.currentTarget.value)}
|
|
182
|
+
className={INPUT_CLASS}
|
|
183
|
+
/>
|
|
184
|
+
<span className="text-[9px] text-ink/35">
|
|
185
|
+
Comma separated. Leave it empty only for an endpoint OVERRIDE of a provider the agent
|
|
186
|
+
already ships — measured: a provider with no models and no discovery serves nothing.
|
|
187
|
+
</span>
|
|
188
|
+
</label>
|
|
189
|
+
)}
|
|
190
|
+
|
|
191
|
+
<div className="flex items-center gap-2">
|
|
192
|
+
<button
|
|
193
|
+
type="button"
|
|
194
|
+
onClick={() => void submit()}
|
|
195
|
+
disabled={!canSubmit}
|
|
196
|
+
className="inline-flex cursor-pointer items-center gap-1 rounded-md border border-ink/20 px-2 py-1 text-[11px] text-ink/75 transition-colors hover:border-ink/40 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50"
|
|
197
|
+
>
|
|
198
|
+
{saving ? <Loader2 size={11} className="animate-spin" /> : <Check size={11} />} Add
|
|
199
|
+
</button>
|
|
200
|
+
<button
|
|
201
|
+
type="button"
|
|
202
|
+
onClick={() => { setOpen(false); setOutcome(null); }}
|
|
203
|
+
className="cursor-pointer text-[11px] text-ink/45 hover:text-ink"
|
|
204
|
+
>
|
|
205
|
+
Cancel
|
|
206
|
+
</button>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
{outcome && (
|
|
210
|
+
<div className="space-y-0.5">
|
|
211
|
+
<p className={`text-[10px] ${outcome.problem ? 'text-ink/70' : 'text-ink/55'}`}>
|
|
212
|
+
{outcome.problem ?? 'Added.'}
|
|
213
|
+
</p>
|
|
214
|
+
{outcome.detail && <p className="font-mono text-[9px] leading-relaxed text-ink/40">{outcome.detail}</p>}
|
|
215
|
+
</div>
|
|
216
|
+
)}
|
|
217
|
+
</div>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The per-harness config form: launch command, env, provider and the defaults a
|
|
8
|
+
* new chat starts on.
|
|
9
|
+
*
|
|
10
|
+
* Every field is OPTIONAL and empty means "the build's default" — stated, not
|
|
11
|
+
* implied, because an empty box that silently overrides something is the same
|
|
12
|
+
* class of bug as a value that silently does nothing. Saving writes the whole
|
|
13
|
+
* config in one request; the card re-renders from the server's answer, so what a
|
|
14
|
+
* user sees afterwards is what the spawn will read.
|
|
15
|
+
*
|
|
16
|
+
* WHICH fields appear is per harness, from `config-fields.ts`. The form used to
|
|
17
|
+
* draw the same six for all of them, and the differences are measured, not
|
|
18
|
+
* stylistic: `omp-acp` publishes `kenari/claude-sonnet-5` (a provider dimension),
|
|
19
|
+
* while `claude` publishes `default`, `opus`, `sonnet`, `haiku` — bare names with
|
|
20
|
+
* no provider at all, so its Provider field could never fill and its model list
|
|
21
|
+
* never narrowed. Claude Code's real provider switch is `ANTHROPIC_BASE_URL`, in
|
|
22
|
+
* the Environment box whose hint used to talk about `GEMINI_API_KEY`.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { ComponentChildren } from 'preact';
|
|
26
|
+
import { useState } from 'preact/hooks';
|
|
27
|
+
import { Loader2, RotateCcw, Save } from 'lucide-preact';
|
|
28
|
+
import {
|
|
29
|
+
EMPTY_HARNESS_CONFIG,
|
|
30
|
+
isHarnessConfigured,
|
|
31
|
+
providerChoices,
|
|
32
|
+
resolveDefaultModel,
|
|
33
|
+
type HarnessConfig,
|
|
34
|
+
} from '@/shared/lib/harness/config';
|
|
35
|
+
import type { HarnessSummary } from '@/shared/types/harness';
|
|
36
|
+
import { SearchSelect } from '@/client/components/common/search-select';
|
|
37
|
+
import { configFieldPlan } from '@/shared/lib/harness/config-fields';
|
|
38
|
+
|
|
39
|
+
interface HarnessConfigFormProps {
|
|
40
|
+
summary: HarnessSummary;
|
|
41
|
+
config: HarnessConfig;
|
|
42
|
+
onSave: (config: HarnessConfig) => Promise<string | null>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** One labelled field, with its own hint where the value needs explaining. */
|
|
46
|
+
function Field({
|
|
47
|
+
label, hint, children,
|
|
48
|
+
}: { label: string; hint: string; children: ComponentChildren }) {
|
|
49
|
+
return (
|
|
50
|
+
<label className="flex flex-col gap-1">
|
|
51
|
+
<span className="text-[10px] font-semibold uppercase tracking-wider text-ink/45">{label}</span>
|
|
52
|
+
{children}
|
|
53
|
+
<span className="text-[10px] leading-relaxed text-ink/40">{hint}</span>
|
|
54
|
+
</label>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const INPUT_CLASS =
|
|
59
|
+
'w-full rounded-md border border-ink/20 bg-paper px-2 py-1.5 font-mono text-[11px] text-ink outline-none transition-colors placeholder:text-ink/30 focus:border-ink/50';
|
|
60
|
+
|
|
61
|
+
export function HarnessConfigForm({ summary, config, onSave }: HarnessConfigFormProps) {
|
|
62
|
+
const [draft, setDraft] = useState<HarnessConfig>(config);
|
|
63
|
+
const [saving, setSaving] = useState(false);
|
|
64
|
+
const [problem, setProblem] = useState<string | null>(null);
|
|
65
|
+
|
|
66
|
+
const models = summary.probe?.models ?? [];
|
|
67
|
+
const plan = configFieldPlan(summary.id as never, summary.probe ?? undefined, {
|
|
68
|
+
...(draft.provider ? { provider: draft.provider } : {}),
|
|
69
|
+
...(summary.install ? { launchCommand: summary.install } : {}),
|
|
70
|
+
});
|
|
71
|
+
const providers = providerChoices(models);
|
|
72
|
+
// The model list narrows to the chosen provider, which is what makes the two
|
|
73
|
+
// fields read as one decision instead of two independent ones.
|
|
74
|
+
const modelChoices = draft.provider
|
|
75
|
+
? models.filter((option) => option.value.startsWith(`${draft.provider}/`))
|
|
76
|
+
: models;
|
|
77
|
+
const fallbackModel = resolveDefaultModel(draft, models);
|
|
78
|
+
|
|
79
|
+
const set = (patch: Partial<HarnessConfig>) => setDraft((prev) => ({ ...prev, ...patch }));
|
|
80
|
+
|
|
81
|
+
const save = async () => {
|
|
82
|
+
setSaving(true);
|
|
83
|
+
try {
|
|
84
|
+
setProblem(await onSave(draft));
|
|
85
|
+
} finally {
|
|
86
|
+
setSaving(false);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div className="mt-3 space-y-3 border-t border-ink/10 pt-3">
|
|
92
|
+
<div className="flex items-center justify-between gap-2">
|
|
93
|
+
<span className="text-[10px] font-semibold uppercase tracking-wider text-ink/45">Configuration</span>
|
|
94
|
+
<div className="flex items-center gap-1.5">
|
|
95
|
+
{isHarnessConfigured(draft) && (
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
onClick={() => setDraft({ ...EMPTY_HARNESS_CONFIG })}
|
|
99
|
+
className="inline-flex cursor-pointer items-center gap-1 rounded-md border border-ink/15 px-2 py-1 text-[11px] text-ink/60 transition-colors hover:border-ink/35 hover:text-ink"
|
|
100
|
+
>
|
|
101
|
+
<RotateCcw size={11} /> Reset
|
|
102
|
+
</button>
|
|
103
|
+
)}
|
|
104
|
+
<button
|
|
105
|
+
type="button"
|
|
106
|
+
onClick={() => void save()}
|
|
107
|
+
disabled={saving}
|
|
108
|
+
className="inline-flex cursor-pointer items-center gap-1 rounded-md border border-ink/20 px-2 py-1 text-[11px] text-ink/75 transition-colors hover:border-ink/40 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50"
|
|
109
|
+
>
|
|
110
|
+
{saving ? <Loader2 size={11} className="animate-spin" /> : <Save size={11} />} Save
|
|
111
|
+
</button>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
{plan.notes.length > 0 && (
|
|
116
|
+
<ul className="space-y-0.5">
|
|
117
|
+
{plan.notes.map((note) => (
|
|
118
|
+
<li key={note} className="text-[10px] leading-relaxed text-ink/45">{note}</li>
|
|
119
|
+
))}
|
|
120
|
+
</ul>
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
<div className="grid gap-3 sm:grid-cols-2">
|
|
124
|
+
<Field
|
|
125
|
+
label="Launch command"
|
|
126
|
+
hint={`Empty uses the built-in line (${summary.install ?? 'this build’s table'}). Quoted paths survive: /Users/me/bin/agy acp`}
|
|
127
|
+
>
|
|
128
|
+
<input
|
|
129
|
+
type="text"
|
|
130
|
+
value={draft.command}
|
|
131
|
+
placeholder="agy acp"
|
|
132
|
+
onInput={(event) => set({ command: event.currentTarget.value })}
|
|
133
|
+
className={INPUT_CLASS}
|
|
134
|
+
/>
|
|
135
|
+
</Field>
|
|
136
|
+
|
|
137
|
+
{plan.showProvider && (
|
|
138
|
+
<Field
|
|
139
|
+
label="Provider"
|
|
140
|
+
hint={
|
|
141
|
+
providers.length > 0
|
|
142
|
+
? `Published by this agent: ${providers.slice(0, 4).join(', ')}${providers.length > 4 ? '…' : ''}`
|
|
143
|
+
: 'Not known yet — probe the harness to list its providers'
|
|
144
|
+
}
|
|
145
|
+
>
|
|
146
|
+
{providers.length > 0 ? (
|
|
147
|
+
<SearchSelect
|
|
148
|
+
value={draft.provider}
|
|
149
|
+
// Changing the provider clears the model: a model from the previous
|
|
150
|
+
// provider would be written into a selector this agent cannot resolve.
|
|
151
|
+
onChange={(provider) => set({ provider, model: '' })}
|
|
152
|
+
placeholder="Agent default"
|
|
153
|
+
ariaLabel="Provider"
|
|
154
|
+
className={INPUT_CLASS}
|
|
155
|
+
options={providers.map((provider) => ({ value: provider, label: provider }))}
|
|
156
|
+
/>
|
|
157
|
+
) : (
|
|
158
|
+
<input
|
|
159
|
+
type="text"
|
|
160
|
+
value={draft.provider}
|
|
161
|
+
placeholder="command-code"
|
|
162
|
+
onInput={(event) => set({ provider: event.currentTarget.value })}
|
|
163
|
+
className={INPUT_CLASS}
|
|
164
|
+
/>
|
|
165
|
+
)}
|
|
166
|
+
</Field>
|
|
167
|
+
)}
|
|
168
|
+
|
|
169
|
+
<Field
|
|
170
|
+
label="Default model"
|
|
171
|
+
hint={
|
|
172
|
+
draft.model
|
|
173
|
+
? 'Applied after session/new'
|
|
174
|
+
: fallbackModel
|
|
175
|
+
? `Falls back to ${fallbackModel}`
|
|
176
|
+
: 'Empty leaves the agent on its own default'
|
|
177
|
+
}
|
|
178
|
+
>
|
|
179
|
+
{modelChoices.length > 0 ? (
|
|
180
|
+
<SearchSelect
|
|
181
|
+
value={draft.model}
|
|
182
|
+
onChange={(model) => set({ model })}
|
|
183
|
+
placeholder="Agent default"
|
|
184
|
+
ariaLabel="Default model"
|
|
185
|
+
className={INPUT_CLASS}
|
|
186
|
+
// An agent publishes up to 221 models (omp, measured), so this list
|
|
187
|
+
// is why the control is searchable at all. Rows are keyed by the
|
|
188
|
+
// stored value; the label is what the agent calls the model.
|
|
189
|
+
options={modelChoices.map((option) => ({
|
|
190
|
+
value: option.value,
|
|
191
|
+
label: option.name || option.value,
|
|
192
|
+
hint: option.value,
|
|
193
|
+
}))}
|
|
194
|
+
/>
|
|
195
|
+
) : (
|
|
196
|
+
<input
|
|
197
|
+
type="text"
|
|
198
|
+
value={draft.model}
|
|
199
|
+
// Not every agent speaks selectors: measured, `omp-acp` publishes
|
|
200
|
+
// `kenari/claude-sonnet-5` while `claude` publishes `opus`/`sonnet`.
|
|
201
|
+
// A `provider/model` placeholder there described a shape that agent
|
|
202
|
+
// never accepts.
|
|
203
|
+
placeholder={plan.modelsAreSelectors ? 'provider/model' : 'model name the agent accepts'}
|
|
204
|
+
onInput={(event) => set({ model: event.currentTarget.value })}
|
|
205
|
+
className={INPUT_CLASS}
|
|
206
|
+
/>
|
|
207
|
+
)}
|
|
208
|
+
</Field>
|
|
209
|
+
|
|
210
|
+
{plan.showThinking && (
|
|
211
|
+
<Field
|
|
212
|
+
label="Default thinking"
|
|
213
|
+
hint={`This agent publishes ${summary.probe?.thinking.length ?? 0} levels`}
|
|
214
|
+
>
|
|
215
|
+
<SearchSelect
|
|
216
|
+
value={draft.thinking}
|
|
217
|
+
onChange={(thinking) => set({ thinking })}
|
|
218
|
+
placeholder="Agent default"
|
|
219
|
+
ariaLabel="Default thinking"
|
|
220
|
+
className={INPUT_CLASS}
|
|
221
|
+
options={(summary.probe?.thinking ?? []).map((option) => ({
|
|
222
|
+
value: option.value,
|
|
223
|
+
label: option.name || option.value,
|
|
224
|
+
}))}
|
|
225
|
+
/>
|
|
226
|
+
</Field>
|
|
227
|
+
)}
|
|
228
|
+
</div>
|
|
229
|
+
|
|
230
|
+
<div className="grid gap-3 sm:grid-cols-2">
|
|
231
|
+
{plan.showMode && (
|
|
232
|
+
<Field
|
|
233
|
+
label="Default mode"
|
|
234
|
+
hint={`This agent publishes ${summary.probe?.modes.length ?? 0} modes`}
|
|
235
|
+
>
|
|
236
|
+
<SearchSelect
|
|
237
|
+
value={draft.mode}
|
|
238
|
+
onChange={(mode) => set({ mode })}
|
|
239
|
+
placeholder="Agent default"
|
|
240
|
+
ariaLabel="Default mode"
|
|
241
|
+
className={INPUT_CLASS}
|
|
242
|
+
options={(summary.probe?.modes ?? []).map((option) => ({
|
|
243
|
+
value: option.value,
|
|
244
|
+
label: option.name || option.value,
|
|
245
|
+
}))}
|
|
246
|
+
/>
|
|
247
|
+
</Field>
|
|
248
|
+
)}
|
|
249
|
+
|
|
250
|
+
<Field label="Environment" hint={plan.envHint}>
|
|
251
|
+
<textarea
|
|
252
|
+
value={draft.env}
|
|
253
|
+
rows={3}
|
|
254
|
+
// The example is the agent's OWN contract: `GEMINI_API_KEY` in a
|
|
255
|
+
// Claude Code card is an instruction that cannot work.
|
|
256
|
+
placeholder={plan.envPlaceholder}
|
|
257
|
+
onInput={(event) => set({ env: event.currentTarget.value })}
|
|
258
|
+
className={`${INPUT_CLASS} resize-y`}
|
|
259
|
+
/>
|
|
260
|
+
</Field>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
{problem && (
|
|
264
|
+
<div className="rounded-lg border border-ink/15 bg-ink/[0.04] p-2 text-[11px] text-ink/75">{problem}</div>
|
|
265
|
+
)}
|
|
266
|
+
</div>
|
|
267
|
+
);
|
|
268
|
+
}
|