@kabmo-labs/kabmo 0.27.0 → 0.29.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/bunfig.toml +6 -0
- package/dist/client/index.html +2 -2
- package/dist/client/index.js +530 -493
- package/dist/client/static/js/{index-e3qh2yps.js → index-43z47ngg.js} +1178 -1034
- package/dist/client/static/js/index-naa91727.css +1 -0
- package/dist/client/static/{manifest-q6h8k9e0.webmanifest → manifest-vdvdqpre.webmanifest} +1 -0
- package/marketplace/plugins/command-runner/package.json +3 -17
- package/marketplace/plugins/command-runner/settings-schema.json +14 -0
- package/marketplace/plugins/git-forge/README.md +17 -7
- package/marketplace/plugins/git-forge/package.json +4 -30
- package/marketplace/plugins/git-forge/panel.css +16 -0
- package/marketplace/plugins/git-forge/settings-schema.json +27 -0
- package/marketplace/plugins/git-forge/src/panel/Badge.tsx +35 -22
- package/marketplace/plugins/git-forge/src/panel/Change.tsx +20 -24
- package/marketplace/plugins/git-forge/src/panel/CiBadge.tsx +16 -7
- package/marketplace/plugins/git-forge/src/panel/Credential.tsx +31 -26
- package/marketplace/plugins/git-forge/src/panel/Glyph.tsx +18 -2
- package/marketplace/plugins/git-forge/src/panel/Header.tsx +160 -96
- package/marketplace/plugins/git-forge/src/panel/ItemView.tsx +60 -44
- package/marketplace/plugins/git-forge/src/panel/List.tsx +150 -22
- package/marketplace/plugins/git-forge/src/panel/Row.tsx +11 -5
- package/marketplace/plugins/git-forge/src/panel/Sidebar.tsx +17 -15
- package/marketplace/plugins/git-forge/src/panel/Write.tsx +84 -61
- package/marketplace/plugins/git-forge/src/panel/format.test.ts +99 -0
- package/marketplace/plugins/git-forge/src/panel/format.ts +59 -16
- package/marketplace/plugins/git-forge/src/panel/index.test.tsx +109 -5
- package/marketplace/plugins/git-forge/src/panel/index.tsx +37 -4
- package/marketplace/plugins/git-forge/src/panel/use-forge.ts +17 -0
- package/marketplace/plugins/git-forge/src/panel/write.test.tsx +31 -0
- package/marketplace/plugins/session-info/package.json +2 -10
- package/marketplace/plugins/session-info/settings-schema.json +8 -0
- package/marketplace/plugins/stats/README.md +17 -5
- package/marketplace/plugins/stats/package.json +3 -23
- package/marketplace/plugins/stats/settings-schema.json +20 -0
- package/marketplace/plugins/stats/src/app.tsx +1 -1
- package/marketplace/plugins/stats/src/groups.test.ts +46 -1
- package/marketplace/plugins/stats/src/groups.ts +22 -11
- package/marketplace/plugins/stats/src/harness-leases.test.ts +84 -0
- package/marketplace/plugins/stats/src/harness-leases.ts +132 -0
- package/marketplace/plugins/stats/src/labels.test.ts +54 -1
- package/marketplace/plugins/stats/src/labels.ts +33 -7
- package/marketplace/plugins/stats/src/sampler.test.ts +61 -0
- package/marketplace/plugins/stats/src/sampler.ts +39 -5
- package/marketplace/plugins/stats/src/snapshot.ts +6 -0
- package/package.json +4 -3
- package/public/manifest.webmanifest +1 -0
- package/src/client/components/common/ComposerTextarea.test.tsx +109 -0
- package/src/client/components/common/ComposerTextarea.tsx +6 -0
- package/src/client/components/common/ReloadPageButton.test.tsx +14 -0
- package/src/client/components/common/ReloadPageButton.tsx +11 -2
- package/src/client/components/common/diagram-viewer/read-block.test.ts +71 -0
- package/src/client/components/common/diagram-viewer/read-block.ts +40 -16
- package/src/client/components/common/file-icon/index.tsx +7 -1
- package/src/client/components/common/harness-glyph/brands.ts +7 -1
- package/src/client/components/common/harness-glyph/index.tsx +18 -1
- package/src/client/components/common/image-viewer/index.tsx +37 -165
- package/src/client/components/common/picker-search/index.tsx +70 -0
- package/src/client/components/common/search-select/index.tsx +2 -7
- package/src/client/components/common/session-actions-menu/index.test.tsx +106 -0
- package/src/client/components/common/session-actions-menu/index.tsx +43 -1
- package/src/client/components/common/session-row/TrailingSlot.tsx +9 -4
- package/src/client/components/common/session-row/index.tsx +4 -0
- package/src/client/components/common/session-row/session-row.test.tsx +6 -0
- package/src/client/components/common/zoom-pan-stage/index.tsx +258 -0
- package/src/client/components/common/zoom-pan-stage/zoom-pan-stage.test.tsx +87 -0
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +2 -1
- package/src/client/components/layout/session-sidebar/ClassicView.tsx +1 -1
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +9 -1
- package/src/client/components/layout/session-sidebar/SessionListNotice.tsx +7 -3
- package/src/client/components/layout/session-sidebar/about-modal/HarnessRow.tsx +4 -1
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +12 -1
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.test.tsx +82 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.tsx +23 -3
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +1 -0
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +2 -1
- package/src/client/components/layout/session-sidebar/modern/index.tsx +1 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/ModelFields.tsx +202 -0
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +80 -19
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +29 -7
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +3 -0
- package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +8 -0
- package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +181 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +41 -86
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +2 -1
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.test.ts +6 -0
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +9 -1
- package/src/client/components/settings/Modal.tsx +6 -2
- package/src/client/components/settings/Sidebar.tsx +32 -7
- package/src/client/components/settings/categories/HarnessSettings.tsx +15 -9
- package/src/client/components/settings/categories/NotificationSettings.test.tsx +40 -15
- package/src/client/components/settings/categories/NotificationSettings.tsx +142 -64
- package/src/client/components/settings/categories/PanelPluginSettings.tsx +3 -3
- package/src/client/components/settings/categories/PluginSettings.tsx +1 -1
- package/src/client/components/settings/categories/harness-settings/ConfigForm.tsx +3 -6
- package/src/client/components/settings/categories/harness-settings/CustomHarnessForm.tsx +186 -0
- package/src/client/components/settings/categories/panel-plugins/GitFreshness.test.tsx +36 -0
- package/src/client/components/settings/categories/panel-plugins/InstalledList.tsx +11 -0
- package/src/client/components/settings/categories/panel-plugins/PluginCard.test.tsx +1 -0
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +15 -1
- package/src/client/components/settings/categories/panel-plugins/Section.tsx +1 -3
- package/src/client/components/settings/categories/panel-plugins/SettingsModal.test.tsx +165 -0
- package/src/client/components/settings/categories/panel-plugins/SettingsModal.tsx +260 -0
- package/src/client/components/settings/categories/panel-plugins/Toolbar.tsx +18 -4
- package/src/client/components/settings/categories/plugin-settings/MarketplacePane.tsx +64 -61
- package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +15 -4
- package/src/client/components/settings/groups.test.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.fork.test.ts +24 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +8 -4
- package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +34 -0
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +3 -2
- package/src/client/components/workspace/chat-timeline/IrcNotice.test.tsx +55 -0
- package/src/client/components/workspace/chat-timeline/IrcNotice.tsx +71 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.fork.test.ts +80 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +13 -4
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +8 -0
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx +9 -0
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +4 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +19 -0
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +32 -3
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.search.test.tsx +72 -0
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +53 -33
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/chat-input/props.ts +5 -5
- package/src/client/components/workspace/chat-timeline/index.tsx +11 -5
- package/src/client/components/workspace/chat-timeline/target-picker/DraftTargetRow.tsx +1 -9
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.test.tsx +129 -0
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +30 -12
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +47 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +55 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +3 -2
- package/src/client/components/workspace/editor/FilePane.tsx +41 -4
- package/src/client/components/workspace/editor/Notices.tsx +2 -2
- package/src/client/components/workspace/editor/Pane.tsx +2 -2
- package/src/client/components/workspace/editor/Toolbar.tsx +20 -10
- package/src/client/components/workspace/editor/index.tsx +6 -10
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +5 -3
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +26 -14
- package/src/client/components/workspace/editor/viewers/CsvGrid.tsx +52 -5
- package/src/client/components/workspace/editor/viewers/DataGrid.tsx +227 -41
- package/src/client/components/workspace/editor/viewers/DrawioView.tsx +93 -0
- package/src/client/components/workspace/editor/viewers/GridRow.tsx +91 -0
- package/src/client/components/workspace/editor/viewers/GridToolbar.tsx +53 -0
- package/src/client/components/workspace/editor/viewers/SheetView.tsx +152 -57
- package/src/client/components/workspace/editor/viewers/dispatch.tsx +42 -9
- package/src/client/components/workspace/editor/viewers/drawio-pages.test.ts +80 -0
- package/src/client/components/workspace/editor/viewers/drawio-pages.ts +63 -0
- package/src/client/components/workspace/editor/viewers/grid.test.ts +296 -0
- package/src/client/components/workspace/editor/viewers/use-cell-edit.ts +64 -0
- package/src/client/components/workspace/editor/viewers/use-grid-interaction.ts +216 -0
- package/src/client/components/workspace/editor/viewers/viewers.test.ts +47 -2
- package/src/client/components/workspace/editor/viewers/workbook.ts +149 -0
- package/src/client/components/workspace/file-explorer/ArchiveModals.tsx +262 -0
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +30 -6
- package/src/client/components/workspace/file-explorer/Modals.tsx +8 -3
- package/src/client/components/workspace/file-explorer/RootOverlays.tsx +60 -0
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +6 -2
- package/src/client/components/workspace/file-explorer/TreeItem.tsx +39 -49
- package/src/client/components/workspace/file-explorer/TreeItemModals.tsx +80 -0
- package/src/client/components/workspace/file-explorer/index.tsx +53 -29
- package/src/client/components/workspace/file-explorer/selection.test.tsx +109 -0
- package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +9 -1
- package/src/client/components/workspace/terminal-panel/focus.test.ts +70 -0
- package/src/client/components/workspace/terminal-panel/focus.ts +46 -0
- package/src/client/components/workspace/terminal-panel/index.tsx +14 -1
- package/src/client/components/workspace/terminal-panel/mount.ts +17 -9
- package/src/client/components/workspace/terminal-panel/scroll-hold.test.ts +158 -0
- package/src/client/components/workspace/terminal-panel/scroll-hold.ts +136 -0
- package/src/client/data/settings/omp-schema.json +169 -22
- package/src/client/glass.css +39 -14
- package/src/client/glass.test.ts +37 -0
- package/src/client/hooks/chat/composer/history.test.ts +267 -0
- package/src/client/hooks/chat/composer/history.ts +146 -0
- package/src/client/hooks/chat/composer/use-draft.ts +45 -1
- package/src/client/hooks/chat/omp/pending-sessions.waiting.test.ts +11 -10
- package/src/client/hooks/chat/omp/pending-waiting.ts +15 -7
- package/src/client/hooks/chat/omp/prompt-send.test.ts +11 -0
- package/src/client/hooks/chat/omp/prompt-send.ts +3 -0
- package/src/client/hooks/chat/timeline/actions.ts +4 -4
- package/src/client/hooks/chat/timeline/ask-frames.test.ts +54 -0
- package/src/client/hooks/chat/timeline/ask-frames.ts +29 -1
- package/src/client/hooks/chat/timeline/composer-modes.ts +13 -2
- package/src/client/hooks/chat/timeline/fork-open.ts +52 -0
- package/src/client/hooks/chat/timeline/index.ts +5 -2
- package/src/client/hooks/chat/timeline/mode-availability.ts +7 -0
- package/src/client/hooks/chat/timeline/modes-contract.ts +6 -0
- package/src/client/hooks/chat/timeline/modes-hydrate.ts +93 -0
- package/src/client/hooks/chat/timeline/modes.ts +32 -52
- package/src/client/hooks/chat/timeline/new-chat-open.ts +7 -6
- package/src/client/hooks/chat/timeline/new-chat.ts +10 -1
- package/src/client/hooks/chat/timeline/pending-dispatch.ts +4 -0
- package/src/client/hooks/chat/timeline/pending-session-mode.test.ts +136 -0
- package/src/client/hooks/chat/timeline/pending-session-mode.ts +69 -0
- package/src/client/hooks/chat/timeline/pending-warmup.test.ts +147 -0
- package/src/client/hooks/chat/timeline/pending-warmup.ts +62 -0
- package/src/client/hooks/chat/timeline/run-identity.test.ts +12 -0
- package/src/client/hooks/chat/timeline/run-identity.ts +4 -1
- package/src/client/hooks/chat/timeline/send-props.ts +2 -0
- package/src/client/hooks/chat/timeline/send-steer.test.ts +1 -0
- package/src/client/hooks/chat/timeline/send.test-util.ts +1 -0
- package/src/client/hooks/chat/timeline/send.test.ts +1 -0
- package/src/client/hooks/chat/timeline/session-harness.ts +4 -0
- package/src/client/hooks/chat/timeline/timeline-rail.test.ts +34 -2
- package/src/client/hooks/chat/timeline/use-fork-session.ts +9 -22
- package/src/client/hooks/chat/timeline/user-turns.ts +31 -2
- package/src/client/hooks/chat/waiting/cancel.ts +13 -6
- package/src/client/hooks/chat/waiting/choice.ts +13 -16
- package/src/client/hooks/chat/waiting/composer-wait.ts +70 -0
- package/src/client/hooks/chat/waiting/dispatch.ts +48 -28
- package/src/client/hooks/chat/waiting/held.ts +37 -13
- package/src/client/hooks/chat/waiting/hold.test.ts +22 -0
- package/src/client/hooks/chat/waiting/hold.ts +20 -11
- package/src/client/hooks/chat/waiting/restore.test.ts +69 -0
- package/src/client/hooks/chat/waiting/restore.ts +34 -0
- package/src/client/hooks/chat/waiting/store.ts +9 -3
- package/src/client/hooks/editor/file-editor-types.ts +36 -12
- package/src/client/hooks/editor/save-bytes.ts +79 -0
- package/src/client/hooks/editor/save-file.test.ts +1 -1
- package/src/client/hooks/editor/save-file.ts +35 -8
- package/src/client/hooks/editor/target-key.ts +17 -0
- package/src/client/hooks/editor/use-disk-digest.test.ts +82 -0
- package/src/client/hooks/editor/use-disk-digest.ts +164 -0
- package/src/client/hooks/editor/use-disk-sync.ts +212 -0
- package/src/client/hooks/editor/use-file-cache.ts +113 -0
- package/src/client/hooks/editor/use-file-editor.test.ts +120 -0
- package/src/client/hooks/editor/use-file-editor.ts +143 -57
- package/src/client/hooks/editor/use-file-read.ts +45 -12
- package/src/client/hooks/editor/use-file-writes.ts +4 -4
- package/src/client/hooks/editor/use-grid-selection.ts +160 -0
- package/src/client/hooks/models/harness-catalog.ts +15 -0
- package/src/client/hooks/models/use-harness-update.test.ts +35 -2
- package/src/client/hooks/models/use-harness-update.ts +49 -10
- package/src/client/hooks/ui/notifications.ts +17 -8
- package/src/client/hooks/workspace/diff-file.test.ts +72 -0
- package/src/client/hooks/workspace/diff-file.ts +12 -6
- package/src/client/hooks/workspace/file-archive.ts +220 -0
- package/src/client/hooks/workspace/file-clipboard.test.ts +4 -4
- package/src/client/hooks/workspace/file-clipboard.ts +37 -26
- package/src/client/hooks/workspace/file-selection.test.ts +67 -0
- package/src/client/hooks/workspace/file-selection.ts +156 -0
- package/src/client/hooks/workspace/file-tree-actions-clipboard.test.ts +5 -5
- package/src/client/hooks/workspace/file-tree-actions.ts +36 -8
- package/src/client/hooks/workspace/panel-registry.ts +1 -1
- package/src/client/hooks/workspace/scheduled-tasks.ts +26 -11
- package/src/client/lib/editor/workbook-drafts.ts +42 -0
- package/src/client/lib/launch/file-handlers.ts +2 -2
- package/src/client/lib/notifications/os.test.ts +1 -30
- package/src/client/lib/notifications/os.ts +0 -15
- package/src/client/lib/notifications/platform.test.ts +68 -0
- package/src/client/lib/notifications/platform.ts +36 -0
- package/src/client/lib/scrollbar-activity.test.ts +21 -88
- package/src/client/lib/scrollbar-activity.ts +71 -73
- package/src/client/lib/scrollbar-events.ts +143 -0
- package/src/client/lib/scrollbar-input.test.ts +126 -0
- package/src/client/lib/scrollbar-probe.test-util.ts +107 -0
- package/src/client/tailwind.css +32 -1
- package/src/server/db.server.test.ts +50 -1
- package/src/server/db.server.ts +36 -3
- package/src/server/index.ts +7 -0
- package/src/server/lib/chat/prompt-history.server.test.ts +92 -0
- package/src/server/lib/chat/prompt-history.server.ts +65 -0
- package/src/server/lib/chat/schema.server.ts +35 -0
- package/src/server/lib/db/schema.ts +3 -0
- package/src/server/lib/fs/archive.test.ts +139 -0
- package/src/server/lib/fs/archive.ts +259 -0
- package/src/server/lib/fs/git-diff.test.ts +26 -1
- package/src/server/lib/fs/git-diff.ts +43 -15
- package/src/server/lib/harness/acp/client.ts +81 -87
- package/src/server/lib/harness/acp/prewarm.server.ts +237 -0
- package/src/server/lib/harness/acp/prewarm.test.ts +171 -0
- package/src/server/lib/harness/acp/prompt.test.ts +70 -1
- package/src/server/lib/harness/acp/prompt.ts +32 -1
- package/src/server/lib/harness/acp/protocol.ts +23 -0
- package/src/server/lib/harness/acp/session-handshake.test.ts +26 -0
- package/src/server/lib/harness/acp/session-handshake.ts +22 -20
- package/src/server/lib/harness/acp/session-options.ts +16 -0
- package/src/server/lib/harness/acp/session-process.ts +43 -0
- package/src/server/lib/harness/acp/session.ts +11 -12
- package/src/server/lib/harness/acp/stdio.ts +129 -0
- package/src/server/lib/harness/acp/verbs.test.ts +97 -0
- package/src/server/lib/harness/acp/verbs.ts +16 -6
- package/src/server/lib/harness/auto-probe.server.ts +4 -3
- package/src/server/lib/harness/capabilities.ts +8 -0
- package/src/server/lib/harness/config.server.ts +3 -2
- package/src/server/lib/harness/custom.server.ts +209 -0
- package/src/server/lib/harness/launch-table.ts +19 -0
- package/src/server/lib/harness/launch.ts +6 -1
- package/src/server/lib/harness/provider-entry.ts +1 -1
- package/src/server/lib/harness/provider-file.server.ts +1 -1
- package/src/server/lib/harness/provider-sources.server.ts +2 -1
- package/src/server/lib/harness/provider-write.server.ts +2 -1
- package/src/server/lib/harness/register.server.ts +8 -1
- package/src/server/lib/harness/schema.server.ts +21 -0
- package/src/server/lib/harness/session-lease.server.test.ts +99 -0
- package/src/server/lib/harness/session-lease.server.ts +193 -0
- package/src/server/lib/harness/session-store.server.test.ts +8 -8
- package/src/server/lib/harness/session-store.server.ts +25 -4
- package/src/server/lib/harness/session-title.server.ts +12 -2
- package/src/server/lib/harness/spawn.server.ts +123 -20
- package/src/server/lib/harness/update-job-store.ts +12 -0
- package/src/server/lib/harness/update-queue.server.ts +18 -13
- package/src/server/lib/lifecycle/after-listen.ts +12 -1
- package/src/server/lib/lifecycle/paths.ts +19 -1
- package/src/server/lib/mcp/registry.server.ts +155 -0
- package/src/server/lib/mcp/registry.test.ts +169 -0
- package/src/server/lib/mcp/store.server.ts +38 -0
- package/src/server/lib/omp/rpc/frame-fold-contract.ts +59 -0
- package/src/server/lib/omp/rpc/frame-fold-frames.test.ts +64 -1
- package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +2 -1
- package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +5 -1
- package/src/server/lib/omp/rpc/frame-fold.test.ts +7 -2
- package/src/server/lib/omp/rpc/frame-fold.ts +6 -45
- package/src/server/lib/omp/rpc/lifecycle.test.ts +4 -0
- package/src/server/lib/omp/rpc/prewarm-pool.ts +19 -5
- package/src/server/lib/omp/rpc/run-model.test.ts +116 -0
- package/src/server/lib/omp/rpc/run-model.ts +4 -2
- package/src/server/lib/omp/session/auto-title.server.test.ts +4 -0
- package/src/server/lib/omp/session/delete.server.ts +1 -0
- package/src/server/lib/omp/session/goal-driver.test.ts +5 -1
- package/src/server/lib/omp/session/goal-settings.test.ts +5 -1
- package/src/server/lib/omp/session/sidebar-data.harness.test.ts +6 -3
- package/src/server/lib/omp/session/standby.server.ts +13 -2
- package/src/server/lib/panels/auto-update.server.test.ts +5 -2
- package/src/server/lib/panels/git-update.server.test.ts +5 -2
- package/src/server/lib/panels/install.server.test.ts +5 -2
- package/src/server/lib/panels/manifest.test.ts +47 -1
- package/src/server/lib/panels/manifest.ts +19 -0
- package/src/server/lib/panels/registry.server.ts +19 -2
- package/src/server/lib/panels/remove.server.test.ts +5 -2
- package/src/server/lib/panels/scan.server.ts +26 -2
- package/src/server/lib/panels/settings-schema.server.ts +72 -0
- package/src/server/lib/plugins/background.server.ts +21 -3
- package/src/server/lib/plugins/background.test.ts +13 -0
- package/src/server/lib/plugins/loader.server.ts +35 -51
- package/src/server/lib/plugins/mcp.server.ts +100 -0
- package/src/server/lib/plugins/mcp.test.ts +75 -0
- package/src/server/lib/plugins/schedule-runner.server.ts +153 -0
- package/src/server/lib/plugins/schedule-runner.test.ts +186 -0
- package/src/server/lib/plugins/schedule-store.server.ts +107 -0
- package/src/server/lib/plugins/schema.server.ts +8 -0
- package/src/server/lib/plugins/settings.server.ts +56 -19
- package/src/server/lib/plugins/shutdown.server.ts +58 -0
- package/src/server/lib/plugins/shutdown.test.ts +28 -3
- package/src/server/lib/realtime/topics/global.server.ts +5 -1
- package/src/server/lib/schedule/rows.server.ts +9 -0
- package/src/server/lib/schedule/runtime.server.test.ts +91 -0
- package/src/server/lib/schedule/runtime.server.ts +101 -23
- package/src/server/lib/schedule/schema.server.ts +15 -0
- package/src/server/lib/schedule/store.server.test.ts +34 -0
- package/src/server/lib/schedule/store.server.ts +33 -9
- package/src/server/lib/sessions/fork.server.test.ts +47 -0
- package/src/server/lib/sessions/fork.server.ts +17 -1
- package/src/server/lib/sessions/spawn.server.ts +2 -2
- package/src/server/lib/waiting/runtime.server.test.ts +48 -0
- package/src/server/lib/waiting/runtime.server.ts +22 -0
- package/src/server/lib/waiting/schema.server.ts +8 -0
- package/src/server/lib/waiting/store.server.test.ts +14 -0
- package/src/server/lib/waiting/store.server.ts +6 -2
- package/src/server/routes/agent/command-resume.test.ts +9 -4
- package/src/server/routes/agent/command.ts +11 -0
- package/src/server/routes/agent/new-mode.test.ts +40 -0
- package/src/server/routes/agent/new.ts +36 -10
- package/src/server/routes/agent/prewarm.ts +48 -7
- package/src/server/routes/chat/index.ts +5 -0
- package/src/server/routes/chat/prompt-history.test.ts +67 -0
- package/src/server/routes/chat/prompt-history.ts +31 -0
- package/src/server/routes/chat/stream.test.ts +21 -0
- package/src/server/routes/chat/stream.ts +5 -0
- package/src/server/routes/fs/action-archive.test.ts +128 -0
- package/src/server/routes/fs/action-bulk.ts +106 -0
- package/src/server/routes/fs/action-save-bytes.test.ts +59 -0
- package/src/server/routes/fs/action-transfer.test.ts +26 -0
- package/src/server/routes/fs/action.ts +100 -12
- package/src/server/routes/fs/archive.ts +20 -0
- package/src/server/routes/fs/digest.test.ts +100 -0
- package/src/server/routes/fs/digest.ts +106 -0
- package/src/server/routes/fs/grant.test.ts +5 -2
- package/src/server/routes/fs/index.ts +4 -0
- package/src/server/routes/fs/read.ts +6 -1
- package/src/server/routes/fs/scope.test.ts +6 -2
- package/src/server/routes/harness/custom.test.ts +131 -0
- package/src/server/routes/harness/import-action.ts +3 -3
- package/src/server/routes/harness/root.ts +47 -9
- package/src/server/routes/harness/summary.test.ts +50 -0
- package/src/server/routes/harness/update-status.ts +41 -2
- package/src/server/routes/harness/update.test.ts +56 -2
- package/src/server/routes/harness/update.ts +2 -2
- package/src/server/routes/panels/bindings.ts +2 -0
- package/src/server/routes/panels/settings.test.ts +165 -0
- package/src/server/routes/panels/settings.ts +106 -0
- package/src/server/routes/schedule/body.ts +14 -0
- package/src/server/routes/schedule/index.ts +28 -4
- package/src/server/routes/sessions/delete.test.ts +4 -0
- package/src/server/routes/settings/mcp.ts +9 -26
- package/src/server/routes/waiting/index.ts +21 -2
- package/src/server/routes/waiting/routes.test.ts +21 -0
- package/src/shared/lib/chat/ask-form/index.ts +39 -31
- package/src/shared/lib/chat/ask-form/labels.ts +46 -0
- package/src/shared/lib/chat/ask-form/tokens.ts +11 -2
- package/src/shared/lib/chat/ask-form.test.ts +57 -0
- package/src/shared/lib/chat/ask-questions.ts +31 -0
- package/src/shared/lib/chat/composer/delegation.ts +3 -3
- package/src/shared/lib/chat/composer/history.test.ts +67 -0
- package/src/shared/lib/chat/composer/history.ts +61 -0
- package/src/shared/lib/chat/irc-notice.ts +42 -0
- package/src/shared/lib/chat/timeline/fork-anchor.test.ts +99 -0
- package/src/shared/lib/chat/timeline/fork-anchor.ts +47 -0
- package/src/shared/lib/chat/todo/parser.ts +6 -4
- package/src/shared/lib/fs/archive.test.ts +101 -0
- package/src/shared/lib/fs/archive.ts +191 -0
- package/src/shared/lib/fs/clipboard.test.ts +32 -7
- package/src/shared/lib/fs/clipboard.ts +59 -14
- package/src/shared/lib/fs/content-hash.ts +29 -0
- package/src/shared/lib/fs/csv.test.ts +50 -0
- package/src/shared/lib/fs/csv.ts +40 -0
- package/src/shared/lib/fs/document-kind.test.ts +13 -6
- package/src/shared/lib/fs/document-kind.ts +18 -6
- package/src/shared/lib/fs/file-kind-classify.test.ts +4 -0
- package/src/shared/lib/fs/file-kind.test.ts +2 -7
- package/src/shared/lib/fs/file-kind.ts +4 -2
- package/src/shared/lib/fs/grid-edit.test.ts +24 -0
- package/src/shared/lib/fs/grid-edit.ts +29 -0
- package/src/shared/lib/fs/grid-selection.test.ts +137 -0
- package/src/shared/lib/fs/grid-selection.ts +138 -0
- package/src/shared/lib/harness/brand-color.ts +5 -0
- package/src/shared/lib/harness/catalog.test.ts +22 -0
- package/src/shared/lib/harness/catalog.ts +60 -7
- package/src/shared/lib/harness/config-fields.test.ts +25 -0
- package/src/shared/lib/harness/config-fields.ts +33 -3
- package/src/shared/lib/harness/dialects.ts +1 -1
- package/src/shared/lib/harness/fork.ts +60 -0
- package/src/shared/lib/harness/mcp-facts.test.ts +30 -0
- package/src/shared/lib/harness/mcp-facts.ts +69 -0
- package/src/shared/lib/harness/menu.test.ts +16 -1
- package/src/shared/lib/harness/menu.ts +2 -2
- package/src/shared/lib/harness/provider-contracts.ts +109 -0
- package/src/shared/lib/harness/provider-facts.test.ts +2 -1
- package/src/shared/lib/harness/provider-facts.ts +24 -115
- package/src/shared/lib/harness/provider-lookup.ts +37 -0
- package/src/shared/lib/harness/providers.ts +2 -1
- package/src/shared/lib/harness/rewind.ts +6 -6
- package/src/shared/lib/harness/session-modes.ts +31 -0
- package/src/shared/lib/harness/transcript.test.ts +29 -0
- package/src/shared/lib/harness/transcript.ts +19 -0
- package/src/shared/lib/harness/updates.ts +10 -0
- package/src/shared/lib/notifications/settings.test.ts +21 -0
- package/src/shared/lib/notifications/settings.ts +24 -0
- package/src/shared/lib/omp/session/mapper.test.ts +31 -0
- package/src/shared/lib/omp/session/mapper.ts +17 -0
- package/src/shared/lib/omp/session/messages-map-notice.test.ts +68 -0
- package/src/shared/lib/omp/session/messages-map.test.ts +1 -35
- package/src/shared/lib/omp/session/messages-map.ts +17 -0
- package/src/shared/lib/omp/session/prewarm.test.ts +28 -4
- package/src/shared/lib/omp/session/prewarm.ts +25 -6
- package/src/shared/lib/omp/session/stream-state.server.test.ts +25 -0
- package/src/shared/lib/omp/session/stream-state.server.ts +8 -4
- package/src/shared/lib/omp/session/wait.ts +10 -1
- package/src/shared/lib/panels/capabilities.test.ts +1 -1
- package/src/shared/lib/panels/capabilities.ts +3 -0
- package/src/shared/lib/plugins/settings.ts +22 -0
- package/src/shared/lib/schedule/parse.test.ts +48 -0
- package/src/shared/lib/schedule/parse.ts +69 -45
- package/src/shared/lib/schedule/timezone.ts +128 -0
- package/src/shared/lib/settings/defaults.ts +2 -0
- package/src/shared/lib/settings/sections.ts +8 -4
- package/src/shared/lib/ui/picker-filter.test.ts +23 -0
- package/src/shared/lib/ui/picker-filter.ts +20 -0
- package/src/shared/lib/workspace/refresh-cadence.test.ts +25 -1
- package/src/shared/lib/workspace/relative-time.ts +16 -0
- package/src/shared/types/chat.ts +4 -0
- package/src/shared/types/harness.ts +12 -1
- package/src/shared/types/omp/agent.ts +6 -0
- package/src/shared/types/omp/session.ts +18 -0
- package/src/shared/types/panels-registry.ts +3 -3
- package/src/shared/types/panels.ts +4 -2
- package/src/shared/types/schedule.ts +13 -0
- package/src/shared/types/settings/state.ts +18 -7
- package/src/shared/types/todo.ts +3 -1
- package/src/shared/types/waiting.ts +9 -0
- package/src/test-support/file-actions.test-util.ts +4 -0
- package/src/test-support/file-archive.test-util.ts +41 -0
- package/src/test-support/file-clipboard.test-util.ts +9 -6
- package/src/test-support/file-editor.test-util.ts +70 -5
- package/src/test-support/harness-table.test-util.ts +2 -0
- package/src/test-support/preload.ts +46 -0
- package/dist/client/static/js/index-32rpkj6b.css +0 -1
- package/src/client/hooks/editor/use-external-change-notice.ts +0 -71
- package/src/client/hooks/editor/use-external-change.test.ts +0 -88
- package/src/client/hooks/editor/use-external-change.ts +0 -146
|
@@ -25,12 +25,13 @@
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
import { newSessionAfterActivation } from '@/server/lib/harness/acp/activation';
|
|
28
|
-
import {
|
|
28
|
+
import { applyLaunchSelections, configOption, modelFromOption } from '@/server/lib/harness/acp/prompt';
|
|
29
29
|
import { capabilitiesFrom } from '@/server/lib/harness/launch';
|
|
30
30
|
import type {
|
|
31
31
|
AcpAgentCommand,
|
|
32
32
|
AcpConfigOption,
|
|
33
33
|
AcpInitializeResult,
|
|
34
|
+
AcpMcpServer,
|
|
34
35
|
AcpProtocolVersion,
|
|
35
36
|
AcpSessionModeState,
|
|
36
37
|
AcpSessionNewResult,
|
|
@@ -41,18 +42,20 @@ import type { HarnessId } from '@/shared/lib/harness/catalog';
|
|
|
41
42
|
/** The process slice a handshake drives; `AcpProcess` satisfies it as-is. */
|
|
42
43
|
export interface AcpHandshakeProcess {
|
|
43
44
|
initialize(params?: Record<string, unknown>, timeoutMs?: number): Promise<AcpInitializeResult>;
|
|
44
|
-
loadSession(sessionId: string, cwd: string, timeoutMs?: number): Promise<unknown>;
|
|
45
|
-
newSession(cwd: string, timeoutMs?: number): Promise<AcpSessionNewResult>;
|
|
45
|
+
loadSession(sessionId: string, cwd: string, timeoutMs?: number, mcpServers?: AcpMcpServer[]): Promise<unknown>;
|
|
46
|
+
newSession(cwd: string, timeoutMs?: number, mcpServers?: AcpMcpServer[]): Promise<AcpSessionNewResult>;
|
|
46
47
|
/** The negotiated major; absent on a test double, which is a v1 double. */
|
|
47
48
|
readonly protocolVersion?: AcpProtocolVersion;
|
|
48
49
|
/** `session/resume`; absent on a process double used by older tests. */
|
|
49
|
-
resumeSession?(sessionId: string, cwd: string, timeoutMs?: number): Promise<unknown>;
|
|
50
|
+
resumeSession?(sessionId: string, cwd: string, timeoutMs?: number, mcpServers?: AcpMcpServer[]): Promise<unknown>;
|
|
50
51
|
/** `session/fork`; absent on a process double used by older tests. */
|
|
51
52
|
forkSession?(
|
|
52
53
|
sessionId: string,
|
|
53
54
|
cwd: string,
|
|
54
55
|
timeoutMs?: number,
|
|
55
56
|
target?: Record<string, unknown>,
|
|
57
|
+
meta?: Record<string, unknown>,
|
|
58
|
+
mcpServers?: AcpMcpServer[],
|
|
56
59
|
): Promise<AcpSessionNewResult>;
|
|
57
60
|
}
|
|
58
61
|
|
|
@@ -73,6 +76,8 @@ export interface AcpHandshakeTarget {
|
|
|
73
76
|
acceptsImages?: boolean;
|
|
74
77
|
/** Initial slash commands from a v2 setup response. */
|
|
75
78
|
agentCommands?: AcpAgentCommand[];
|
|
79
|
+
/** MCP servers every session request carries; empty when none are configured. */
|
|
80
|
+
mcpServers?: AcpMcpServer[];
|
|
76
81
|
/** Called as soon as `initialize` answers, before any session request, so a
|
|
77
82
|
* v2 resume snapshot can open a turn. */
|
|
78
83
|
onProtocol?(version: AcpProtocolVersion): void;
|
|
@@ -91,13 +96,15 @@ export async function handshakeAcpSession(
|
|
|
91
96
|
wanted: AcpHandshakeSelections,
|
|
92
97
|
sessionIdToLoad?: string,
|
|
93
98
|
forkFromSessionId?: string,
|
|
99
|
+
forkMeta?: Record<string, unknown>,
|
|
94
100
|
): Promise<void> {
|
|
95
101
|
const init = await proc.initialize(undefined, 60_000);
|
|
96
102
|
target.onProtocol?.(init.protocolVersion === 2 ? 2 : 1);
|
|
97
103
|
/** opencode's plugin activation gate: the first `session/new`s refuse with
|
|
98
104
|
* `ServiceUnavailableError` until the agent's plugins finish booting. */
|
|
105
|
+
const mcpServers = target.mcpServers ?? [];
|
|
99
106
|
const newSession = (cwd: string, timeoutMs?: number) =>
|
|
100
|
-
newSessionAfterActivation(target.harness, cwd, (dir, ms) => proc.newSession(dir, ms), {
|
|
107
|
+
newSessionAfterActivation(target.harness, cwd, (dir, ms) => proc.newSession(dir, ms, mcpServers), {
|
|
101
108
|
...(timeoutMs !== undefined ? { perAttemptMs: timeoutMs } : {}),
|
|
102
109
|
});
|
|
103
110
|
let session: AcpSessionNewResult;
|
|
@@ -118,6 +125,10 @@ export async function handshakeAcpSession(
|
|
|
118
125
|
// required" for a request it cannot place. Other harnesses reject an
|
|
119
126
|
// unknown `target`, so it is sent only where it is understood.
|
|
120
127
|
target.harness === 'zcode' ? { kind: 'latestCheckpoint' } : undefined,
|
|
128
|
+
// claude-agent-acp's AIR extension: the fork point, when the caller has
|
|
129
|
+
// one. An agent that does not read it ignores the key and forks whole.
|
|
130
|
+
forkMeta,
|
|
131
|
+
mcpServers,
|
|
121
132
|
);
|
|
122
133
|
} else if (sessionIdToLoad) {
|
|
123
134
|
// ACP gates restoration on the AGENT's advertised capability: `loadSession`
|
|
@@ -131,13 +142,13 @@ export async function handshakeAcpSession(
|
|
|
131
142
|
// nothing unless `replayFrom` asks, which is exactly what Kabmo wants —
|
|
132
143
|
// its own transcript is already on screen.
|
|
133
144
|
? await (proc.resumeSession
|
|
134
|
-
? proc.resumeSession(sessionIdToLoad, target.cwd, 120_000)
|
|
145
|
+
? proc.resumeSession(sessionIdToLoad, target.cwd, 120_000, mcpServers)
|
|
135
146
|
: Promise.reject(new Error(`${target.harness} cannot resume a session`)))
|
|
136
147
|
: caps.loadSession === true
|
|
137
|
-
? await loadReplacement(proc, newSession, sessionIdToLoad, target.cwd)
|
|
148
|
+
? await loadReplacement(proc, newSession, sessionIdToLoad, target.cwd, mcpServers)
|
|
138
149
|
: caps.sessionCapabilities?.resume != null
|
|
139
150
|
? await (proc.resumeSession
|
|
140
|
-
? proc.resumeSession(sessionIdToLoad, target.cwd, 120_000)
|
|
151
|
+
? proc.resumeSession(sessionIdToLoad, target.cwd, 120_000, mcpServers)
|
|
141
152
|
: Promise.reject(new Error(`${target.harness} cannot resume a session`)))
|
|
142
153
|
: null;
|
|
143
154
|
if (restored === null) {
|
|
@@ -161,17 +172,7 @@ export async function handshakeAcpSession(
|
|
|
161
172
|
if (session.availableCommands) target.agentCommands = session.availableCommands;
|
|
162
173
|
target.runModel = modelFromOption(configOption(target.configOptions, 'model'), target.harness);
|
|
163
174
|
target.capabilities = capabilitiesFrom(init, target.configOptions, { usage: false, plan: false }, target.modes);
|
|
164
|
-
await
|
|
165
|
-
// A mode the composer asked for, on an agent that publishes only the older
|
|
166
|
-
// `modes` list: `session/set_mode` is the only way to apply it.
|
|
167
|
-
if (
|
|
168
|
-
wanted.mode
|
|
169
|
-
&& !configOption(target.configOptions, 'mode')
|
|
170
|
-
&& target.modes?.availableModes.some((entry) => entry.id === wanted.mode)
|
|
171
|
-
&& target.setMode
|
|
172
|
-
) {
|
|
173
|
-
await target.setMode(wanted.mode).catch(() => {});
|
|
174
|
-
}
|
|
175
|
+
await applyLaunchSelections(target, wanted);
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
/**
|
|
@@ -186,7 +187,8 @@ async function loadReplacement(
|
|
|
186
187
|
create: (cwd: string, timeoutMs?: number) => Promise<AcpSessionNewResult>,
|
|
187
188
|
sessionId: string,
|
|
188
189
|
cwd: string,
|
|
190
|
+
mcpServers: AcpMcpServer[],
|
|
189
191
|
): Promise<unknown> {
|
|
190
|
-
await proc.loadSession(sessionId, cwd, 120_000);
|
|
192
|
+
await proc.loadSession(sessionId, cwd, 120_000, mcpServers);
|
|
191
193
|
return (await create(cwd).catch(() => null)) ?? { sessionId };
|
|
192
194
|
}
|
|
@@ -14,11 +14,19 @@
|
|
|
14
14
|
|
|
15
15
|
import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
16
16
|
import type { HarnessId } from '@/shared/lib/harness/catalog';
|
|
17
|
+
import type { AcpProcess } from '@/server/lib/harness/acp/client';
|
|
18
|
+
import type { AcpMcpServer } from '@/server/lib/harness/acp/protocol';
|
|
17
19
|
|
|
18
20
|
export interface AcpSessionOptions {
|
|
19
21
|
harness: HarnessId;
|
|
20
22
|
command: string[];
|
|
21
23
|
env?: Record<string, string>;
|
|
24
|
+
/**
|
|
25
|
+
* A process that has already been spawned and `initialize`d — a prewarmed
|
|
26
|
+
* agent. The session adopts it, so the handshake it runs costs only
|
|
27
|
+
* `session/new` and the config writes; the frame sinks are re-bound here.
|
|
28
|
+
*/
|
|
29
|
+
process?: AcpProcess;
|
|
22
30
|
/** Provider/model this session starts on, applied with
|
|
23
31
|
* `session/set_config_option` right after `session/new`. */
|
|
24
32
|
model?: { provider: string; modelId: string } | null;
|
|
@@ -30,4 +38,12 @@ export interface AcpSessionOptions {
|
|
|
30
38
|
/** Quiet window before the child is reclaimed; defaults to the omp window so
|
|
31
39
|
* both transports release an idle agent after the same time. */
|
|
32
40
|
idleDestroyMs?: number;
|
|
41
|
+
/**
|
|
42
|
+
* MCP servers every `session/new|load|resume|fork` carries.
|
|
43
|
+
*
|
|
44
|
+
* ACP is the delivery for every harness but omp's RPC mode, so this is where
|
|
45
|
+
* the settings list reaches an agent. Empty means "none configured", which is
|
|
46
|
+
* also what an audit reader passes.
|
|
47
|
+
*/
|
|
48
|
+
mcpServers?: AcpMcpServer[];
|
|
33
49
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Which agent process a session drives: the one it spawns, or a prewarmed one
|
|
8
|
+
* it adopts.
|
|
9
|
+
*
|
|
10
|
+
* Split from `session.ts` for the per-file ceiling, and the decision is worth
|
|
11
|
+
* naming: a prewarmed child was spawned before this session existed, so its
|
|
12
|
+
* notifications, agent→client requests and exit notice are pointing at nobody.
|
|
13
|
+
* Adopting means re-binding those sinks — after that the process is
|
|
14
|
+
* indistinguishable from a cold spawn, and its cached `initialize` is reused.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { AcpProcess, type AcpClientOptions } from '@/server/lib/harness/acp/client';
|
|
18
|
+
import { withGatewayCompatibility } from '@/server/lib/harness/acp/gateway-env';
|
|
19
|
+
import type { AcpSessionOptions } from '@/server/lib/harness/acp/session-options';
|
|
20
|
+
|
|
21
|
+
/** The frame sinks a session supplies; `AcpProcess` re-binds them on adoption. */
|
|
22
|
+
export type SessionFrameSinks = Pick<
|
|
23
|
+
AcpClientOptions,
|
|
24
|
+
'onNotification' | 'onClientRequest' | 'onExit' | 'onStderr'
|
|
25
|
+
>;
|
|
26
|
+
|
|
27
|
+
export function openSessionProcess(
|
|
28
|
+
options: AcpSessionOptions,
|
|
29
|
+
cwd: string,
|
|
30
|
+
sinks: SessionFrameSinks,
|
|
31
|
+
): AcpProcess {
|
|
32
|
+
if (options.process) {
|
|
33
|
+
options.process.attachSinks(sinks);
|
|
34
|
+
return options.process;
|
|
35
|
+
}
|
|
36
|
+
const env = withGatewayCompatibility(options.harness, options.env);
|
|
37
|
+
return new AcpProcess({
|
|
38
|
+
command: options.command,
|
|
39
|
+
cwd,
|
|
40
|
+
...(env ? { env } : {}),
|
|
41
|
+
...sinks,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { AcpProcess } from '@/server/lib/harness/acp/client';
|
|
24
|
+
import { openSessionProcess } from '@/server/lib/harness/acp/session-process';
|
|
24
25
|
import { AcpTurns, type AcpTurnEndInfo } from '@/server/lib/harness/acp/turn';
|
|
25
26
|
import { AcpFrameMapper } from '@/server/lib/harness/acp/frames';
|
|
26
27
|
import type { AcpConfigOption, AcpId, AcpProtocolVersion, AcpSessionModeState } from '@/server/lib/harness/acp/protocol';
|
|
27
28
|
import { promptBlocks } from '@/server/lib/harness/acp/prompt';
|
|
28
|
-
import { withGatewayCompatibility } from '@/server/lib/harness/acp/gateway-env';
|
|
29
29
|
import { adoptConfigAnswer, publishConfigChange, settlePermissionDialog, stampMessageModel } from '@/server/lib/harness/acp/session-config';
|
|
30
30
|
import { beginAcpTurn, settleAcpTurn } from '@/server/lib/harness/acp/session-turns';
|
|
31
31
|
import { driveAcpGoalAfterTurn } from '@/server/lib/harness/acp/acp-goal-driver.server';
|
|
@@ -51,6 +51,7 @@ import { DEFAULT_APPROVAL_MODE, isApprovalMode, type ApprovalMode } from '@/shar
|
|
|
51
51
|
import { dispatchCommand, type AcpCommandHost } from '@/server/lib/harness/acp/commands';
|
|
52
52
|
import { markStreamStatus } from '@/shared/lib/omp/session/stream-state.server';
|
|
53
53
|
import type { AcpSessionOptions } from '@/server/lib/harness/acp/session-options';
|
|
54
|
+
import type { AcpMcpServer } from '@/server/lib/harness/acp/protocol';
|
|
54
55
|
import type { HarnessCapabilities } from '@/server/lib/harness/capabilities';
|
|
55
56
|
import type { HarnessSession } from '@/server/lib/harness/session';
|
|
56
57
|
import type { HarnessId } from '@/shared/lib/harness/catalog';
|
|
@@ -89,6 +90,8 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
89
90
|
modes: AcpSessionModeState | null = null;
|
|
90
91
|
/** Whether the agent advertised `promptCapabilities.image`. */
|
|
91
92
|
acceptsImages = false;
|
|
93
|
+
/** MCP servers every session request carries; empty when none are configured. */
|
|
94
|
+
readonly mcpServers: AcpMcpServer[];
|
|
92
95
|
private readonly proc: AcpProcess;
|
|
93
96
|
/** The quiet-window reclaim; the rules live in `session-idle.ts`. */
|
|
94
97
|
readonly idle: IdleReaper;
|
|
@@ -105,11 +108,7 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
105
108
|
constructor(options: AcpSessionOptions, cwd: string) {
|
|
106
109
|
this.harness = options.harness;
|
|
107
110
|
this.cwd = cwd;
|
|
108
|
-
|
|
109
|
-
this.proc = new AcpProcess({
|
|
110
|
-
command: options.command,
|
|
111
|
-
cwd,
|
|
112
|
-
...(env ? { env } : {}),
|
|
111
|
+
this.proc = openSessionProcess(options, cwd, {
|
|
113
112
|
onNotification: (method, params) => this.onNotification(method, params),
|
|
114
113
|
onClientRequest: (id, method, params) => this.onClientRequest(id, method, params),
|
|
115
114
|
onExit: (info) => this.onExit(info),
|
|
@@ -140,6 +139,7 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
140
139
|
// omp's wrapper.
|
|
141
140
|
onTurnEnd: (info) => this.onTurnEnded(info),
|
|
142
141
|
});
|
|
142
|
+
this.mcpServers = options.mcpServers ?? [];
|
|
143
143
|
this.requestedModel = options.model ?? null;
|
|
144
144
|
this.requestedThinking = options.thinkingLevel ?? null;
|
|
145
145
|
this.requestedMode = options.mode ?? null;
|
|
@@ -150,13 +150,14 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
150
150
|
private readonly requestedThinking: string | null;
|
|
151
151
|
private readonly requestedMode: string | null;
|
|
152
152
|
/** `initialize` + `session/new|load|resume`, then the requested selections. */
|
|
153
|
-
async start(sessionIdToLoad?: string, forkFromSessionId?: string): Promise<{ sessionId: string }> {
|
|
153
|
+
async start(sessionIdToLoad?: string, forkFromSessionId?: string, forkMeta?: Record<string, unknown>): Promise<{ sessionId: string }> {
|
|
154
154
|
await handshakeAcpSession(
|
|
155
155
|
this,
|
|
156
156
|
this.proc,
|
|
157
157
|
{ model: this.requestedModel, thinking: this.requestedThinking, mode: this.requestedMode },
|
|
158
158
|
sessionIdToLoad,
|
|
159
159
|
forkFromSessionId,
|
|
160
|
+
forkMeta,
|
|
160
161
|
);
|
|
161
162
|
// A slow handshake is not idleness: the window starts once it is usable.
|
|
162
163
|
this.idle.reset(true);
|
|
@@ -164,6 +165,8 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
get protocol(): AcpProtocolVersion { return this.proc.protocolVersion === 2 ? 2 : 1; }
|
|
168
|
+
/** The OS pid of the agent child, for the Stats panel's lease. */
|
|
169
|
+
get pid(): number | undefined { return this.proc.pid; }
|
|
167
170
|
/** Set by the handshake as soon as `initialize` answers. */
|
|
168
171
|
onProtocol(version: AcpProtocolVersion): void { this.turns.completion = version === 2 ? 'state' : 'response'; }
|
|
169
172
|
isAlive(): boolean { return !this.destroyed && this.proc.isAlive; }
|
|
@@ -308,11 +311,7 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
308
311
|
/** Answer an agent→client request with a result (cancellation uses it). */
|
|
309
312
|
respond(id: AcpId, result: unknown): void { this.proc.respond(id, result); }
|
|
310
313
|
/** Agent→client requests: every branch answers or refuses — an unanswered call parks the turn. */
|
|
311
|
-
private onClientRequest(
|
|
312
|
-
id: AcpId,
|
|
313
|
-
method: string,
|
|
314
|
-
params: Record<string, unknown>,
|
|
315
|
-
): Promise<AcpClientRequestAnswer> {
|
|
314
|
+
private onClientRequest(id: AcpId, method: string, params: Record<string, unknown>): Promise<AcpClientRequestAnswer> {
|
|
316
315
|
this.idle.reset();
|
|
317
316
|
return handleAcpClientRequest(this, id, method, params);
|
|
318
317
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The agent child and its pipes: spawn, read lines, keep the stderr tail, and
|
|
8
|
+
* dispose the process group.
|
|
9
|
+
*
|
|
10
|
+
* Split from `client.ts` for the repo's per-file ceiling, and the seam is real:
|
|
11
|
+
* the transport OWNS a process, and this module owns what the OS sees — the
|
|
12
|
+
* spawn, the two readers, the exit notice and the kill escalation. `client.ts`
|
|
13
|
+
* keeps framing, the pending-call table and the verbs.
|
|
14
|
+
*
|
|
15
|
+
* The stderr tail exists because `exited (code 1)` tells a reader nothing: a
|
|
16
|
+
* shadowed or corrupt binary usually explains itself on stderr, and that text is
|
|
17
|
+
* the only actionable part of a failed spawn.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { Subprocess } from 'bun';
|
|
21
|
+
import { readLines } from '@/server/lib/omp/rpc/lines';
|
|
22
|
+
import { killProcessTree } from '@/server/lib/lifecycle/kill-tree';
|
|
23
|
+
import { stripKabmoHostEnv, withToolchainPath } from '@kabmo-labs/kabmo-sdk';
|
|
24
|
+
|
|
25
|
+
const STDERR_TAIL_LIMIT = 8_000;
|
|
26
|
+
|
|
27
|
+
export interface AgentStdioOptions {
|
|
28
|
+
command: string[];
|
|
29
|
+
cwd: string;
|
|
30
|
+
env?: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface AgentStdioHandlers {
|
|
34
|
+
/** One stdout line, already trimmed of its newline — JSON or a log line. */
|
|
35
|
+
onLine: (line: string) => void;
|
|
36
|
+
onStderr?: (line: string) => void;
|
|
37
|
+
/** The child is gone. Fires once, after `exited`. */
|
|
38
|
+
onExit: (info: { code: number | null; stderrTail: string }) => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class AgentStdio {
|
|
42
|
+
readonly child: Subprocess<'pipe', 'pipe', 'pipe'>;
|
|
43
|
+
#tail = '';
|
|
44
|
+
|
|
45
|
+
constructor(options: AgentStdioOptions, handlers: AgentStdioHandlers) {
|
|
46
|
+
const [command, ...args] = options.command;
|
|
47
|
+
if (!command) throw new Error('ACP launch command is empty');
|
|
48
|
+
const childEnv = withToolchainPath(
|
|
49
|
+
stripKabmoHostEnv({ ...Bun.env, ...options.env }, process.platform),
|
|
50
|
+
process.platform,
|
|
51
|
+
);
|
|
52
|
+
try {
|
|
53
|
+
this.child = Bun.spawn({
|
|
54
|
+
cmd: [command, ...args],
|
|
55
|
+
cwd: options.cwd,
|
|
56
|
+
env: childEnv,
|
|
57
|
+
stdin: 'pipe',
|
|
58
|
+
stdout: 'pipe',
|
|
59
|
+
stderr: 'pipe',
|
|
60
|
+
windowsHide: true,
|
|
61
|
+
// Its own process group, exactly like the omp child: an ACP adapter
|
|
62
|
+
// spawns ITS own agent binary (codex-acp runs codex, pi-acp runs pi),
|
|
63
|
+
// so killing only the adapter leaves the real agent running.
|
|
64
|
+
detached: process.platform !== 'win32',
|
|
65
|
+
});
|
|
66
|
+
} catch (error) {
|
|
67
|
+
throw new Error(
|
|
68
|
+
`Could not start ${command}: ${error instanceof Error ? error.message : String(error)}`,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
void readLines(this.child.stdout, (line) => handlers.onLine(line));
|
|
73
|
+
void readLines(this.child.stderr, (line) => {
|
|
74
|
+
this.#tail = `${this.#tail}${line}\n`.slice(-STDERR_TAIL_LIMIT);
|
|
75
|
+
handlers.onStderr?.(line);
|
|
76
|
+
});
|
|
77
|
+
void this.child.exited.then((code) => {
|
|
78
|
+
handlers.onExit({ code, stderrTail: this.#tail });
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
get stderrTail(): string {
|
|
83
|
+
return this.#tail;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get pid(): number | undefined {
|
|
87
|
+
return this.child.pid ?? undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Write one already-serialized frame. A closed pipe is not an error here:
|
|
91
|
+
* the `exited` notice is what reports it, and throwing would wedge the
|
|
92
|
+
* caller's queue. */
|
|
93
|
+
write(line: string): void {
|
|
94
|
+
try {
|
|
95
|
+
this.child.stdin.write(line);
|
|
96
|
+
} catch {
|
|
97
|
+
// Closed pipe: reported by `exited`.
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async flush(): Promise<void> {
|
|
102
|
+
try {
|
|
103
|
+
await this.child.stdin.flush();
|
|
104
|
+
} catch {
|
|
105
|
+
// Closed pipe: reported by `exited`.
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Graceful then forceful shutdown of the whole process group. */
|
|
110
|
+
async dispose(gracePeriodMs = 5_000): Promise<void> {
|
|
111
|
+
const exited = this.child.exited.then(() => undefined);
|
|
112
|
+
try {
|
|
113
|
+
this.child.stdin.end();
|
|
114
|
+
} catch {
|
|
115
|
+
// Already closed.
|
|
116
|
+
}
|
|
117
|
+
const term = setTimeout(() => {
|
|
118
|
+
killProcessTree(this.child.pid, false, 'SIGTERM');
|
|
119
|
+
}, gracePeriodMs);
|
|
120
|
+
const kill = setTimeout(() => {
|
|
121
|
+
killProcessTree(this.child.pid, true, 'SIGKILL');
|
|
122
|
+
}, gracePeriodMs * 2);
|
|
123
|
+
term.unref?.();
|
|
124
|
+
kill.unref?.();
|
|
125
|
+
await exited;
|
|
126
|
+
clearTimeout(term);
|
|
127
|
+
clearTimeout(kill);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The wire shape of the ACP verbs Kabmo sends. `session/fork` is the one with
|
|
8
|
+
* two optional payloads: zcode's checkpoint `target` and the AIR fork point in
|
|
9
|
+
* `_meta` — an agent that does not read a key ignores it, so the shape is the
|
|
10
|
+
* only thing that can be wrong here.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { describe, expect, test } from 'bun:test';
|
|
14
|
+
import { forkSession, loadSession, newSession, resumeSession } from '@/server/lib/harness/acp/verbs';
|
|
15
|
+
|
|
16
|
+
function recorder() {
|
|
17
|
+
const calls: Array<{ method: string; params: unknown }> = [];
|
|
18
|
+
const invoke = async <T>(method: string, params: unknown): Promise<T> => {
|
|
19
|
+
calls.push({ method, params });
|
|
20
|
+
return { sessionId: 'forked' } as T;
|
|
21
|
+
};
|
|
22
|
+
return { calls, invoke };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe('forkSession verb', () => {
|
|
26
|
+
test('a plain fork sends only the session, cwd and servers', async () => {
|
|
27
|
+
const { calls, invoke } = recorder();
|
|
28
|
+
await forkSession(invoke, 'src', '/tmp/project', 1000);
|
|
29
|
+
expect(calls).toEqual([
|
|
30
|
+
{ method: 'session/fork', params: { sessionId: 'src', cwd: '/tmp/project', mcpServers: [] } },
|
|
31
|
+
]);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('a fork point rides as the request _meta', async () => {
|
|
35
|
+
const { calls, invoke } = recorder();
|
|
36
|
+
const meta = { jetbrains: { air: { fork: { version: 1, messageId: 'a2' } } } };
|
|
37
|
+
await forkSession(invoke, 'src', '/tmp/project', 1000, undefined, meta);
|
|
38
|
+
expect(calls).toEqual([
|
|
39
|
+
{
|
|
40
|
+
method: 'session/fork',
|
|
41
|
+
params: { sessionId: 'src', cwd: '/tmp/project', mcpServers: [], _meta: meta },
|
|
42
|
+
},
|
|
43
|
+
]);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('a checkpoint target and a fork point travel together', async () => {
|
|
47
|
+
const { calls, invoke } = recorder();
|
|
48
|
+
const meta = { jetbrains: { air: { fork: { version: 1, messageId: 'a2' } } } };
|
|
49
|
+
await forkSession(invoke, 'src', '/tmp/project', 1000, { kind: 'latestCheckpoint' }, meta);
|
|
50
|
+
expect(calls).toEqual([
|
|
51
|
+
{
|
|
52
|
+
method: 'session/fork',
|
|
53
|
+
params: {
|
|
54
|
+
sessionId: 'src',
|
|
55
|
+
cwd: '/tmp/project',
|
|
56
|
+
mcpServers: [],
|
|
57
|
+
target: { kind: 'latestCheckpoint' },
|
|
58
|
+
_meta: meta,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
]);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('MCP servers on the session verbs', () => {
|
|
66
|
+
const servers = [{ name: 'notes', command: 'npx', args: ['-y', 'notes'], env: [] }];
|
|
67
|
+
|
|
68
|
+
test('session/new carries the list', async () => {
|
|
69
|
+
const { calls, invoke } = recorder();
|
|
70
|
+
await newSession(invoke, '/tmp/project', 1000, 1, servers);
|
|
71
|
+
expect(calls).toEqual([{ method: 'session/new', params: { cwd: '/tmp/project', mcpServers: servers } }]);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('session/load carries the list', async () => {
|
|
75
|
+
const { calls, invoke } = recorder();
|
|
76
|
+
await loadSession(invoke, 'agent-1', '/tmp/project', 1000, servers);
|
|
77
|
+
expect(calls).toEqual([
|
|
78
|
+
{ method: 'session/load', params: { sessionId: 'agent-1', cwd: '/tmp/project', mcpServers: servers } },
|
|
79
|
+
]);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('session/resume carries the list', async () => {
|
|
83
|
+
const { calls, invoke } = recorder();
|
|
84
|
+
await resumeSession(invoke, 'agent-1', '/tmp/project', 1000, 1, servers);
|
|
85
|
+
expect(calls).toEqual([
|
|
86
|
+
{ method: 'session/resume', params: { sessionId: 'agent-1', cwd: '/tmp/project', mcpServers: servers } },
|
|
87
|
+
]);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('session/fork carries the list', async () => {
|
|
91
|
+
const { calls, invoke } = recorder();
|
|
92
|
+
await forkSession(invoke, 'src', '/tmp/project', 1000, undefined, undefined, servers);
|
|
93
|
+
expect(calls).toEqual([
|
|
94
|
+
{ method: 'session/fork', params: { sessionId: 'src', cwd: '/tmp/project', mcpServers: servers } },
|
|
95
|
+
]);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* `session/prompt` answer (`stopReason: "cancelled"`).
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import type { AcpSessionInfo, AcpSessionNewResult } from '@/server/lib/harness/acp/protocol';
|
|
19
|
+
import type { AcpMcpServer, AcpSessionInfo, AcpSessionNewResult } from '@/server/lib/harness/acp/protocol';
|
|
20
20
|
import { normalizeConfigOptions, normalizeSessionResult } from '@/server/lib/harness/acp/v2';
|
|
21
21
|
|
|
22
22
|
/** One request/response round trip against an ACP agent. Implemented by
|
|
@@ -33,13 +33,20 @@ export async function newSession(
|
|
|
33
33
|
cwd: string,
|
|
34
34
|
timeoutMs = 120_000,
|
|
35
35
|
dialect: AcpDialect = 1,
|
|
36
|
+
mcpServers: AcpMcpServer[] = [],
|
|
36
37
|
): Promise<AcpSessionNewResult> {
|
|
37
|
-
const result = await invoke<Record<string, unknown>>('session/new', { cwd, mcpServers
|
|
38
|
+
const result = await invoke<Record<string, unknown>>('session/new', { cwd, mcpServers }, timeoutMs);
|
|
38
39
|
return dialect === 2 ? normalizeSessionResult(result) : (result as unknown as AcpSessionNewResult);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
export async function loadSession(
|
|
42
|
-
|
|
42
|
+
export async function loadSession(
|
|
43
|
+
invoke: AcpInvoke,
|
|
44
|
+
sessionId: string,
|
|
45
|
+
cwd: string,
|
|
46
|
+
timeoutMs = 120_000,
|
|
47
|
+
mcpServers: AcpMcpServer[] = [],
|
|
48
|
+
): Promise<unknown> {
|
|
49
|
+
return invoke('session/load', { sessionId, cwd, mcpServers }, timeoutMs);
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
export async function resumeSession(
|
|
@@ -48,8 +55,9 @@ export async function resumeSession(
|
|
|
48
55
|
cwd: string,
|
|
49
56
|
timeoutMs = 120_000,
|
|
50
57
|
dialect: AcpDialect = 1,
|
|
58
|
+
mcpServers: AcpMcpServer[] = [],
|
|
51
59
|
): Promise<unknown> {
|
|
52
|
-
const result = await invoke<Record<string, unknown>>('session/resume', { sessionId, cwd, mcpServers
|
|
60
|
+
const result = await invoke<Record<string, unknown>>('session/resume', { sessionId, cwd, mcpServers }, timeoutMs);
|
|
53
61
|
return dialect === 2 ? normalizeSessionResult(result) : result;
|
|
54
62
|
}
|
|
55
63
|
|
|
@@ -59,10 +67,12 @@ export async function forkSession(
|
|
|
59
67
|
cwd: string,
|
|
60
68
|
timeoutMs = 120_000,
|
|
61
69
|
target?: Record<string, unknown>,
|
|
70
|
+
meta?: Record<string, unknown>,
|
|
71
|
+
mcpServers: AcpMcpServer[] = [],
|
|
62
72
|
): Promise<AcpSessionNewResult> {
|
|
63
73
|
return invoke<AcpSessionNewResult>(
|
|
64
74
|
'session/fork',
|
|
65
|
-
{ sessionId, cwd, mcpServers
|
|
75
|
+
{ sessionId, cwd, mcpServers, ...(target ? { target } : {}), ...(meta ? { _meta: meta } : {}) },
|
|
66
76
|
timeoutMs,
|
|
67
77
|
);
|
|
68
78
|
}
|
|
@@ -43,9 +43,10 @@ import type { HarnessConfig } from '@/shared/lib/harness/config';
|
|
|
43
43
|
import { loadDisabledHarnesses } from '@/server/lib/harness/enabled.server';
|
|
44
44
|
import { blockedProbe, probeHarness } from '@/server/lib/harness/launch';
|
|
45
45
|
import { HARNESS_LAUNCH, harnessRequirementMet, type HarnessLaunch } from '@/server/lib/harness/launch-table';
|
|
46
|
+
import { customLaunch } from '@/server/lib/harness/custom.server';
|
|
46
47
|
import { resolveOmpBin } from '@/server/lib/omp/core/cli';
|
|
47
48
|
import { rememberProbe } from '@/server/lib/harness/probe-cache.server';
|
|
48
|
-
import {
|
|
49
|
+
import { harnessDescriptor, harnessIds, type HarnessId } from '@/shared/lib/harness/catalog';
|
|
49
50
|
import { harnessEnabled } from '@/shared/lib/harness/enabled';
|
|
50
51
|
|
|
51
52
|
declare global {
|
|
@@ -64,7 +65,7 @@ declare global {
|
|
|
64
65
|
*/
|
|
65
66
|
export function commandAvailable(id: HarnessId, config?: HarnessConfig): boolean {
|
|
66
67
|
if (id === 'omp-acp') return Boolean(resolveOmpBin());
|
|
67
|
-
let launch: HarnessLaunch | undefined = HARNESS_LAUNCH[id];
|
|
68
|
+
let launch: HarnessLaunch | undefined = HARNESS_LAUNCH[id] ?? customLaunch(id);
|
|
68
69
|
if (config) {
|
|
69
70
|
try {
|
|
70
71
|
const configured = launchFromConfig(id, config);
|
|
@@ -113,7 +114,7 @@ export interface AutoProbeOptions {
|
|
|
113
114
|
export async function autoProbeTargets(
|
|
114
115
|
options: Pick<AutoProbeOptions, 'ids' | 'available'> = {},
|
|
115
116
|
): Promise<HarnessId[]> {
|
|
116
|
-
const ids = options.ids ??
|
|
117
|
+
const ids = options.ids ?? harnessIds();
|
|
117
118
|
const available = options.available ?? commandAvailable;
|
|
118
119
|
const disabled = await loadDisabledHarnesses();
|
|
119
120
|
const targets: HarnessId[] = [];
|
|
@@ -63,5 +63,13 @@ export interface HarnessProbe {
|
|
|
63
63
|
models: { value: string; name: string }[];
|
|
64
64
|
thinking: { value: string; name: string }[];
|
|
65
65
|
modes: { value: string; name: string }[];
|
|
66
|
+
/**
|
|
67
|
+
* The mode the agent was in when it answered `session/new`, when it said.
|
|
68
|
+
*
|
|
69
|
+
* The composer's mode control on a chat that has not spawned yet has no live
|
|
70
|
+
* session to ask, and `modes` alone says nothing about which one is current —
|
|
71
|
+
* showing the first as current would be a guess the agent never made.
|
|
72
|
+
*/
|
|
73
|
+
currentMode?: string;
|
|
66
74
|
probedAt: number;
|
|
67
75
|
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import { getDb } from '@/server/db.server';
|
|
18
18
|
import { readSettingsJson, writeSettingsJson } from '@/server/lib/db/settings-store';
|
|
19
19
|
import { HARNESS_LAUNCH, type HarnessLaunch } from '@/server/lib/harness/launch-table';
|
|
20
|
+
import { customLaunch } from '@/server/lib/harness/custom.server';
|
|
20
21
|
import {
|
|
21
22
|
harnessConfigKey,
|
|
22
23
|
isHarnessConfigured,
|
|
@@ -60,7 +61,7 @@ export function probeInvalidatedBy(previous: HarnessConfig, next: HarnessConfig)
|
|
|
60
61
|
/** The launch shape an override produces from the table entry, or null when the
|
|
61
62
|
* config says nothing about launching. Pure, so the merge is testable. */
|
|
62
63
|
export function launchFromConfig(id: HarnessId, config: HarnessConfig): HarnessLaunch | null {
|
|
63
|
-
const base = HARNESS_LAUNCH[id];
|
|
64
|
+
const base = HARNESS_LAUNCH[id] ?? customLaunch(id);
|
|
64
65
|
if (!base) return null;
|
|
65
66
|
const command = splitCommand(config.command);
|
|
66
67
|
const { env: parsedEnv, invalid } = parseEnvLines(config.env);
|
|
@@ -89,7 +90,7 @@ export function resolveLaunch(id: HarnessId, config: HarnessConfig): HarnessLaun
|
|
|
89
90
|
if (harnessDescriptor(id)?.builtIn) {
|
|
90
91
|
throw new Error(`${id} is built in and is not launched`);
|
|
91
92
|
}
|
|
92
|
-
if (!HARNESS_LAUNCH[id]) {
|
|
93
|
+
if (!HARNESS_LAUNCH[id] && !customLaunch(id)) {
|
|
93
94
|
throw new Error(`No launch command is configured for ${id}`);
|
|
94
95
|
}
|
|
95
96
|
const launch = launchFromConfig(id, config);
|