@kabmo-labs/kabmo 0.27.0 → 0.28.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/dist/client/index.html +1 -1
- package/dist/client/index.js +495 -467
- package/dist/client/static/js/index-81f7berm.css +1 -0
- package/dist/client/static/js/{index-e3qh2yps.js → index-xzvyrxya.js} +795 -795
- 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 +2 -2
- package/src/client/components/common/harness-glyph/index.tsx +18 -1
- 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/layout/session-sidebar/CategoryItem.tsx +2 -1
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +9 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +2 -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 +23 -3
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +3 -0
- package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +156 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +41 -86
- 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 +30 -3
- package/src/client/components/settings/categories/HarnessSettings.tsx +11 -7
- 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 +1 -1
- package/src/client/components/settings/categories/harness-settings/CustomHarnessForm.tsx +186 -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/SettingsModal.test.tsx +165 -0
- package/src/client/components/settings/categories/panel-plugins/SettingsModal.tsx +260 -0
- 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/MessageItem.fork.test.ts +80 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +9 -3
- 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.tsx +24 -0
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +13 -20
- 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 +101 -0
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +2 -2
- package/src/client/components/workspace/editor/FilePane.tsx +9 -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 +16 -10
- package/src/client/components/workspace/editor/index.tsx +6 -10
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +4 -3
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +23 -14
- 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/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/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/use-fork-session.ts +9 -22
- 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 +21 -12
- 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 +90 -0
- package/src/client/hooks/editor/use-file-editor.ts +90 -52
- package/src/client/hooks/editor/use-file-read.ts +24 -10
- package/src/client/hooks/editor/use-file-writes.ts +4 -4
- package/src/client/hooks/models/harness-catalog.ts +15 -0
- package/src/client/hooks/ui/notifications.ts +17 -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/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/server/index.ts +7 -0
- 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.ts +6 -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-queue.server.ts +3 -3
- 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.test.ts +2 -1
- package/src/server/lib/omp/rpc/frame-fold.ts +6 -45
- 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/sidebar-data.harness.test.ts +6 -3
- package/src/server/lib/omp/session/standby.server.ts +13 -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/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/new-mode.test.ts +40 -0
- package/src/server/routes/agent/new.ts +31 -10
- package/src/server/routes/agent/prewarm.ts +48 -7
- package/src/server/routes/fs/action.ts +9 -1
- package/src/server/routes/fs/digest.test.ts +100 -0
- package/src/server/routes/fs/digest.ts +106 -0
- package/src/server/routes/fs/index.ts +2 -0
- package/src/server/routes/fs/read.ts +6 -1
- package/src/server/routes/harness/custom.test.ts +131 -0
- package/src/server/routes/harness/import-action.ts +2 -2
- package/src/server/routes/harness/root.ts +41 -8
- 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/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/composer/delegation.ts +3 -3
- package/src/shared/lib/chat/timeline/fork-anchor.test.ts +97 -0
- package/src/shared/lib/chat/timeline/fork-anchor.ts +47 -0
- package/src/shared/lib/fs/content-hash.ts +29 -0
- package/src/shared/lib/harness/catalog.ts +48 -6
- 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 +65 -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/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/notifications/settings.test.ts +21 -0
- package/src/shared/lib/notifications/settings.ts +24 -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/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/workspace/refresh-cadence.test.ts +25 -1
- package/src/shared/lib/workspace/relative-time.ts +16 -0
- package/src/shared/types/harness.ts +7 -0
- package/src/shared/types/omp/agent.ts +6 -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 +12 -1
- package/src/shared/types/waiting.ts +9 -0
- package/src/test-support/file-editor.test-util.ts +70 -5
- 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
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* How each harness receives MCP servers, MEASURED — not assumed.
|
|
8
|
+
*
|
|
9
|
+
* Two deliveries exist, and the difference is a property of the transport, not
|
|
10
|
+
* a preference:
|
|
11
|
+
*
|
|
12
|
+
* - `acp` — the agent accepts `mcpServers` on `session/new|load|resume|fork`.
|
|
13
|
+
* This is the ACP baseline (stdio) plus the agent's advertised
|
|
14
|
+
* `mcpCapabilities` for `http`/`sse`, so one injection covers every ACP
|
|
15
|
+
* harness without writing a file in the agent's own format.
|
|
16
|
+
* - `omp-config` — omp's RPC mode reads `~/.omp/agent/mcp.json` (and the
|
|
17
|
+
* project's `.omp/mcp.json`) at SPAWN. Kabmo writes that file through the MCP
|
|
18
|
+
* settings page; a change therefore needs a respawn, which is why the
|
|
19
|
+
* delivery is a file rather than a per-session argument.
|
|
20
|
+
*
|
|
21
|
+
* A harness added later is a row here, not a new branch in the spawn path. The
|
|
22
|
+
* table is deliberately exhaustive over `HarnessId`: a missing row is a compile
|
|
23
|
+
* error, so a new agent cannot silently receive no MCP servers.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import type { BuiltinHarnessId, HarnessId } from '@/shared/lib/harness/catalog';
|
|
27
|
+
|
|
28
|
+
export type McpDelivery = 'acp' | 'omp-config';
|
|
29
|
+
|
|
30
|
+
export interface HarnessMcpFacts {
|
|
31
|
+
delivery: McpDelivery;
|
|
32
|
+
/** Why this delivery, in one line a settings card can show. */
|
|
33
|
+
note: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const HARNESS_MCP_FACTS: Record<BuiltinHarnessId, HarnessMcpFacts> = {
|
|
37
|
+
'omp-rpc': {
|
|
38
|
+
delivery: 'omp-config',
|
|
39
|
+
note: 'omp reads ~/.omp/agent/mcp.json at spawn; a change applies to the next session.',
|
|
40
|
+
},
|
|
41
|
+
'omp-acp': { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
42
|
+
claude: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
43
|
+
codex: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
44
|
+
opencode: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
45
|
+
'command-code': { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
46
|
+
dsh: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
47
|
+
antigravity: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
48
|
+
minimax: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
49
|
+
pi: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
50
|
+
qwen: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
51
|
+
kimi: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
52
|
+
cursor: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
53
|
+
zcode: { delivery: 'acp', note: 'Injected on session/new, so every new chat sees the current list.' },
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The delivery for one harness.
|
|
58
|
+
*
|
|
59
|
+
* A user-added harness is ACP by definition — that is the only transport the
|
|
60
|
+
* add form offers — so an id with no row takes the ACP path rather than
|
|
61
|
+
* crashing the spawn on an undefined table entry.
|
|
62
|
+
*/
|
|
63
|
+
export function mcpDelivery(harness: HarnessId): McpDelivery {
|
|
64
|
+
return (HARNESS_MCP_FACTS as Record<string, HarnessMcpFacts | undefined>)[harness]?.delivery ?? 'acp';
|
|
65
|
+
}
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
harnessMenuEntries,
|
|
28
28
|
isHarnessCategory,
|
|
29
29
|
} from '@/shared/lib/harness/menu';
|
|
30
|
-
import { HARNESS_IDS, harnessDescriptor } from '@/shared/lib/harness/catalog';
|
|
30
|
+
import { HARNESS_IDS, harnessDescriptor, registerHarnessDescriptors } from '@/shared/lib/harness/catalog';
|
|
31
31
|
import { SETTINGS_CATEGORIES } from '@/client/components/settings/Sidebar';
|
|
32
32
|
|
|
33
33
|
describe('harness menu ids', () => {
|
|
@@ -92,3 +92,18 @@ describe('harnessMenuEntries', () => {
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
|
+
|
|
96
|
+
describe('a user-added harness', () => {
|
|
97
|
+
test('gets a menu entry from the roster it is given', () => {
|
|
98
|
+
registerHarnessDescriptors([
|
|
99
|
+
{ id: 'my-agent', label: 'My Agent', initial: 'M', transport: 'acp', glyph: 'custom' },
|
|
100
|
+
]);
|
|
101
|
+
try {
|
|
102
|
+
const entries = harnessMenuEntries(['claude', 'my-agent']);
|
|
103
|
+
expect(entries.map((entry) => entry.harness)).toEqual([null, 'claude', 'my-agent']);
|
|
104
|
+
expect(entries.find((entry) => entry.harness === 'my-agent')?.label).toBe('My Agent');
|
|
105
|
+
} finally {
|
|
106
|
+
registerHarnessDescriptors([]);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -65,7 +65,7 @@ export interface HarnessMenuEntry {
|
|
|
65
65
|
* filters with it, and the All Harnesses overview — which always lists every
|
|
66
66
|
* agent — is where a switched-off one is switched back on.
|
|
67
67
|
*/
|
|
68
|
-
export function harnessMenuEntries(): HarnessMenuEntry[] {
|
|
68
|
+
export function harnessMenuEntries(ids: readonly string[] = HARNESS_IDS): HarnessMenuEntry[] {
|
|
69
69
|
const entries: HarnessMenuEntry[] = [
|
|
70
70
|
{
|
|
71
71
|
id: HARNESS_INDEX_CATEGORY as SettingsCategoryId,
|
|
@@ -74,7 +74,7 @@ export function harnessMenuEntries(): HarnessMenuEntry[] {
|
|
|
74
74
|
harness: null,
|
|
75
75
|
},
|
|
76
76
|
];
|
|
77
|
-
for (const id of
|
|
77
|
+
for (const id of ids) {
|
|
78
78
|
const descriptor = harnessDescriptor(id);
|
|
79
79
|
if (!descriptor || descriptor.builtIn) continue;
|
|
80
80
|
entries.push({
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { harnessHasLocalTranscript } from '@/shared/lib/harness/transcript';
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* Which harnesses Kabmo can rewind IN PLACE.
|
|
8
10
|
*
|
|
9
11
|
* Undo and Retry truncate the conversation and then re-run a turn, so the
|
|
10
12
|
* agent's own context must be truncatable with it. That is only true where the
|
|
11
|
-
* transcript is the JSONL omp writes
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* transcript is the JSONL omp writes (`harnessHasLocalTranscript`); the ACP
|
|
14
|
+
* child is torn down before the file is rewritten, and the next prompt resumes
|
|
15
|
+
* it over RPC.
|
|
14
16
|
*
|
|
15
17
|
* Every other ACP agent keeps the conversation in its own store, and ACP
|
|
16
18
|
* defines no truncation verb (`session/load` replays the whole history, a fork
|
|
17
19
|
* copies it). Truncating Kabmo's copy there would leave the agent answering
|
|
18
20
|
* from turns the timeline no longer shows — a silent divergence, not a rewind.
|
|
19
|
-
* An UNKNOWN harness keeps the historical allow: the caller has not resolved it
|
|
20
|
-
* yet, and the endpoint answers the real refusal.
|
|
21
21
|
*/
|
|
22
22
|
export function harnessSupportsRewind(harness: string | null | undefined): boolean {
|
|
23
|
-
return
|
|
23
|
+
return harnessHasLocalTranscript(harness);
|
|
24
24
|
}
|
|
@@ -22,3 +22,34 @@ export interface SessionModeState {
|
|
|
22
22
|
/** Every advertised value, in the agent's order. */
|
|
23
23
|
values: SessionModeChoice[];
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
/** What a harness probe knows about an agent's own mode ladder. */
|
|
27
|
+
export interface ProbedSessionModes {
|
|
28
|
+
choices: readonly SessionModeChoice[];
|
|
29
|
+
/** The value the agent was in when it answered `session/new`, when it said. */
|
|
30
|
+
current?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The selector a chat with NO live session can offer, built from its harness's
|
|
35
|
+
* probe — so the composer switches to the picked agent's own modes the moment
|
|
36
|
+
* the harness is chosen, instead of only after the first prompt spawned.
|
|
37
|
+
*
|
|
38
|
+
* `picked` is the operator's own choice and wins over the probe's. When neither
|
|
39
|
+
* is known `currentValue` is empty: the agent starts on its own default, and
|
|
40
|
+
* drawing the first advertised value as "current" would claim a selection the
|
|
41
|
+
* agent never made.
|
|
42
|
+
*/
|
|
43
|
+
export function pendingSessionMode(
|
|
44
|
+
probe: ProbedSessionModes | undefined,
|
|
45
|
+
picked: string | null,
|
|
46
|
+
): SessionModeState | null {
|
|
47
|
+
const choices = probe?.choices ?? [];
|
|
48
|
+
if (choices.length === 0) return null;
|
|
49
|
+
const offered = (value: string | null | undefined): string =>
|
|
50
|
+
value && choices.some((choice) => choice.value === value) ? value : '';
|
|
51
|
+
return {
|
|
52
|
+
currentValue: offered(picked) || offered(probe?.current),
|
|
53
|
+
values: choices.map((choice) => ({ ...choice })),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The fact two features share: which harness's conversation Kabmo can read off
|
|
8
|
+
* disk (rewind truncates it, a fork cuts it at a message).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { describe, expect, test } from 'bun:test';
|
|
12
|
+
import { harnessHasLocalTranscript } from '@/shared/lib/harness/transcript';
|
|
13
|
+
|
|
14
|
+
describe('harnessHasLocalTranscript', () => {
|
|
15
|
+
test('omp over either transport writes the JSONL Kabmo reads', () => {
|
|
16
|
+
expect(harnessHasLocalTranscript('omp-rpc')).toBe(true);
|
|
17
|
+
expect(harnessHasLocalTranscript('omp-acp')).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('an ACP agent with its own store has no local transcript', () => {
|
|
21
|
+
expect(harnessHasLocalTranscript('claude')).toBe(false);
|
|
22
|
+
expect(harnessHasLocalTranscript('zcode')).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('an unresolved harness keeps the historical allow', () => {
|
|
26
|
+
expect(harnessHasLocalTranscript(null)).toBe(true);
|
|
27
|
+
expect(harnessHasLocalTranscript(undefined)).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Which harnesses keep the conversation in the JSONL omp writes on disk.
|
|
8
|
+
*
|
|
9
|
+
* `omp-rpc` and `omp-acp` are the same product over two transports and both
|
|
10
|
+
* write that file. Every other ACP agent keeps its history in its own store:
|
|
11
|
+
* `session/load` replays the whole history and `session/fork` copies it whole,
|
|
12
|
+
* so Kabmo can neither truncate it (rewind) nor cut it at a message (fork).
|
|
13
|
+
*
|
|
14
|
+
* An UNKNOWN harness keeps the historical allow: the caller has not resolved it
|
|
15
|
+
* yet, and the endpoint answers the real refusal.
|
|
16
|
+
*/
|
|
17
|
+
export function harnessHasLocalTranscript(harness: string | null | undefined): boolean {
|
|
18
|
+
return !harness || harness === 'omp-rpc' || harness === 'omp-acp';
|
|
19
|
+
}
|
|
@@ -11,11 +11,15 @@ import { primeKabmoSettings } from '@/shared/lib/settings/client';
|
|
|
11
11
|
import { DEFAULT_SETTINGS } from '@/shared/lib/settings/defaults';
|
|
12
12
|
import {
|
|
13
13
|
isNotificationEnabled,
|
|
14
|
+
isNotificationPlatformEnabled,
|
|
15
|
+
NOTIFICATION_PLATFORM_KEYS,
|
|
14
16
|
NOTIFICATION_SETTING_KEYS,
|
|
15
17
|
type NotificationEvent,
|
|
18
|
+
type NotificationPlatform,
|
|
16
19
|
} from '@/shared/lib/notifications/settings';
|
|
17
20
|
|
|
18
21
|
const EVENTS: NotificationEvent[] = ['finish', 'ask', 'error'];
|
|
22
|
+
const PLATFORMS: NotificationPlatform[] = ['desktop', 'mobile'];
|
|
19
23
|
|
|
20
24
|
afterEach(() => {
|
|
21
25
|
primeKabmoSettings({});
|
|
@@ -46,4 +50,21 @@ describe('notification settings', () => {
|
|
|
46
50
|
primeKabmoSettings({ notifyOnFinish: 'yes' });
|
|
47
51
|
expect(isNotificationEnabled('finish')).toBe(false);
|
|
48
52
|
});
|
|
53
|
+
|
|
54
|
+
test('both platform switches ship ON, so the event opt-ins keep working', () => {
|
|
55
|
+
for (const platform of PLATFORMS) {
|
|
56
|
+
expect(DEFAULT_SETTINGS[NOTIFICATION_PLATFORM_KEYS[platform] as keyof typeof DEFAULT_SETTINGS]).toBe(true);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('an install that predates the master keys still delivers', () => {
|
|
61
|
+
primeKabmoSettings({});
|
|
62
|
+
for (const platform of PLATFORMS) expect(isNotificationPlatformEnabled(platform)).toBe(true);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('only the literal false silences a platform', () => {
|
|
66
|
+
primeKabmoSettings({ notifyDesktopEnabled: false, notifyMobileEnabled: true });
|
|
67
|
+
expect(isNotificationPlatformEnabled('desktop')).toBe(false);
|
|
68
|
+
expect(isNotificationPlatformEnabled('mobile')).toBe(true);
|
|
69
|
+
});
|
|
49
70
|
});
|
|
@@ -32,3 +32,27 @@ export function isNotificationEnabled(
|
|
|
32
32
|
): boolean {
|
|
33
33
|
return readKabmoSetting<boolean>(NOTIFICATION_SETTING_KEYS[event], appSettings) === true;
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
/** The two device classes the Notifications page switches delivery for. */
|
|
37
|
+
export type NotificationPlatform = 'desktop' | 'mobile';
|
|
38
|
+
|
|
39
|
+
/** The stored master switch for each platform. */
|
|
40
|
+
export const NOTIFICATION_PLATFORM_KEYS: Readonly<Record<NotificationPlatform, string>> = {
|
|
41
|
+
desktop: 'notifyDesktopEnabled',
|
|
42
|
+
mobile: 'notifyMobileEnabled',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Whether delivery is switched on for `platform`.
|
|
47
|
+
*
|
|
48
|
+
* The masters postdate the event switches, so an install that predates them has
|
|
49
|
+
* no value and must keep sending — an absent key means ON, and only the literal
|
|
50
|
+
* `false` turns a platform off. The event switches remain the opt-in: they ship
|
|
51
|
+
* false and still decide whether a given event is worth a banner.
|
|
52
|
+
*/
|
|
53
|
+
export function isNotificationPlatformEnabled(
|
|
54
|
+
platform: NotificationPlatform,
|
|
55
|
+
appSettings?: Record<string, any>,
|
|
56
|
+
): boolean {
|
|
57
|
+
return readKabmoSetting<boolean>(NOTIFICATION_PLATFORM_KEYS[platform], appSettings) !== false;
|
|
58
|
+
}
|
|
@@ -41,7 +41,7 @@ describe('triggerSessionPrewarm', () => {
|
|
|
41
41
|
prime('yolo');
|
|
42
42
|
triggerSessionPrewarm('/tmp/project');
|
|
43
43
|
expect(calls).toEqual([
|
|
44
|
-
{ url: '/api/agent/prewarm', method: 'POST', body: { cwd: '/tmp/project', accessMode: 'yolo' } },
|
|
44
|
+
{ url: '/api/agent/prewarm', method: 'POST', body: { cwd: '/tmp/project', harness: 'omp-rpc', accessMode: 'yolo' } },
|
|
45
45
|
]);
|
|
46
46
|
});
|
|
47
47
|
|
|
@@ -55,7 +55,7 @@ describe('triggerSessionPrewarm', () => {
|
|
|
55
55
|
calls.length = 0;
|
|
56
56
|
triggerSessionPrewarm('/tmp/project');
|
|
57
57
|
expect(calls).toEqual([
|
|
58
|
-
{ url: '/api/agent/prewarm', method: 'POST', body: { cwd: '/tmp/project', accessMode: 'yolo' } },
|
|
58
|
+
{ url: '/api/agent/prewarm', method: 'POST', body: { cwd: '/tmp/project', harness: 'omp-rpc', accessMode: 'yolo' } },
|
|
59
59
|
]);
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -67,8 +67,8 @@ describe('triggerSessionPrewarm', () => {
|
|
|
67
67
|
primeKabmoSettings({ [ACCESS_MODE_SETTING_KEY]: 'turbo' });
|
|
68
68
|
triggerSessionPrewarm('/tmp/project');
|
|
69
69
|
expect(calls).toEqual([
|
|
70
|
-
{ url: '/api/agent/prewarm', method: 'POST', body: { cwd: '/tmp/project' } },
|
|
71
|
-
{ url: '/api/agent/prewarm', method: 'POST', body: { cwd: '/tmp/project' } },
|
|
70
|
+
{ url: '/api/agent/prewarm', method: 'POST', body: { cwd: '/tmp/project', harness: 'omp-rpc' } },
|
|
71
|
+
{ url: '/api/agent/prewarm', method: 'POST', body: { cwd: '/tmp/project', harness: 'omp-rpc' } },
|
|
72
72
|
]);
|
|
73
73
|
});
|
|
74
74
|
|
|
@@ -78,6 +78,30 @@ describe('triggerSessionPrewarm', () => {
|
|
|
78
78
|
expect(calls).toEqual([]);
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
+
test('an ACP pick names its harness, which selects the pool', () => {
|
|
82
|
+
// The pool is chosen by the harness: warming omp's RPC child for a chat that
|
|
83
|
+
// will spawn `claude` is a process the send never claims.
|
|
84
|
+
prime('yolo');
|
|
85
|
+
triggerSessionPrewarm('/tmp/project', { harness: 'claude' });
|
|
86
|
+
expect(calls).toEqual([
|
|
87
|
+
{ url: '/api/agent/prewarm', method: 'POST', body: { cwd: '/tmp/project', harness: 'claude', accessMode: 'yolo' } },
|
|
88
|
+
]);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('a Plan pick rides the omp prewarm, so the warm child can serve the send', () => {
|
|
92
|
+
// omp's child reads the selection from its start-time environment; a child
|
|
93
|
+
// warmed without it is killed by the claim and the boot is paid twice.
|
|
94
|
+
prime('yolo');
|
|
95
|
+
triggerSessionPrewarm('/tmp/project', { modes: { plan: true, goal: false } });
|
|
96
|
+
expect(calls).toEqual([
|
|
97
|
+
{
|
|
98
|
+
url: '/api/agent/prewarm',
|
|
99
|
+
method: 'POST',
|
|
100
|
+
body: { cwd: '/tmp/project', harness: 'omp-rpc', accessMode: 'yolo', modes: { plan: true, goal: false } },
|
|
101
|
+
},
|
|
102
|
+
]);
|
|
103
|
+
});
|
|
104
|
+
|
|
81
105
|
test('a rejected request is swallowed — prewarm must never reach the UI', () => {
|
|
82
106
|
// Fire-and-forget: the function returns undefined synchronously and the
|
|
83
107
|
// module attaches its own catch, so the rejection never becomes an
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Client-side trigger for the server's prewarm
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* the seconds between the click and the
|
|
7
|
+
* Client-side trigger for the server's prewarm pools: asking Kabmo server to
|
|
8
|
+
* start an idle agent for a project cwd before the first prompt is sent.
|
|
9
|
+
* Fired when the user opens a new (pending) session and whenever a pending
|
|
10
|
+
* chat's harness or mode pick moves — the seconds between the click and the
|
|
11
|
+
* first send then hide the boot.
|
|
11
12
|
*
|
|
12
13
|
* Fire-and-forget by contract: a failed or slow prewarm must never block or
|
|
13
14
|
* error the UI. The next send spawns cold in that case, exactly as before.
|
|
@@ -23,19 +24,37 @@
|
|
|
23
24
|
* the phone passed nothing at all, so every prewarm there was always-ask
|
|
24
25
|
* against a yolo install. `writeSetting` updates the snapshot synchronously,
|
|
25
26
|
* so this reads exactly what the composer last chose.
|
|
27
|
+
*
|
|
28
|
+
* **`harness` picks the POOL.** Only omp's RPC pool existed at first, so every
|
|
29
|
+
* pending chat on an ACP agent paid that agent's full boot on its first prompt.
|
|
30
|
+
* `modes` is the pending chat's Plan pick: omp's child reads it from its
|
|
31
|
+
* start-time environment, so a warm child without it can never serve the chat.
|
|
26
32
|
*/
|
|
27
33
|
|
|
28
34
|
import { ACCESS_MODE_SETTING_KEY, isApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
29
35
|
import { readKabmoSetting } from '@/shared/lib/settings/client';
|
|
30
36
|
|
|
31
|
-
export
|
|
37
|
+
export interface PrewarmOptions {
|
|
38
|
+
/** The harness the pending chat will spawn on. Absent means omp's RPC pool. */
|
|
39
|
+
harness?: string | null;
|
|
40
|
+
/** The pending chat's mode selection (omp only; ACP applies modes at spawn). */
|
|
41
|
+
modes?: { plan: boolean; goal: boolean } | null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function triggerSessionPrewarm(cwd: string, options: PrewarmOptions = {}): void {
|
|
32
45
|
if (!cwd) return;
|
|
33
46
|
const stored = readKabmoSetting<unknown>(ACCESS_MODE_SETTING_KEY);
|
|
34
47
|
const accessMode = isApprovalMode(stored) ? stored : undefined;
|
|
48
|
+
const harness = options.harness || 'omp-rpc';
|
|
35
49
|
fetch('/api/agent/prewarm', {
|
|
36
50
|
method: 'POST',
|
|
37
51
|
headers: { 'Content-Type': 'application/json' },
|
|
38
|
-
body: JSON.stringify({
|
|
52
|
+
body: JSON.stringify({
|
|
53
|
+
cwd,
|
|
54
|
+
harness,
|
|
55
|
+
...(accessMode ? { accessMode } : {}),
|
|
56
|
+
...(options.modes ? { modes: options.modes } : {}),
|
|
57
|
+
}),
|
|
39
58
|
}).catch(() => {});
|
|
40
59
|
}
|
|
41
60
|
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import { afterEach, beforeEach, describe, expect, setDefaultTimeout, test } from 'bun:test';
|
|
13
13
|
|
|
14
14
|
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
15
|
+
import { onRealtimeSignal } from '@/server/lib/realtime/signals.server';
|
|
15
16
|
import {
|
|
16
17
|
loadStreamStates,
|
|
17
18
|
loadStreamStatuses,
|
|
@@ -113,6 +114,30 @@ describe('run model on the stream row', () => {
|
|
|
113
114
|
});
|
|
114
115
|
});
|
|
115
116
|
|
|
117
|
+
test('fills in a LIVE row that carries no model, and stays quiet when it already matches', async () => {
|
|
118
|
+
// A `stream` row written by `agent_start` alone named no model; the probe
|
|
119
|
+
// must repair it, and must not republish an unchanged row.
|
|
120
|
+
await markStreamStatus('s1', 'stream');
|
|
121
|
+
const signals: string[] = [];
|
|
122
|
+
const off = onRealtimeSignal((event) => signals.push(event.signal));
|
|
123
|
+
try {
|
|
124
|
+
await markStreamModel('s1', { provider: 'openai', modelId: 'gpt-5' });
|
|
125
|
+
expect((await loadStreamStates()).s1).toEqual({
|
|
126
|
+
status: 'stream',
|
|
127
|
+
model: { provider: 'openai', modelId: 'gpt-5' },
|
|
128
|
+
});
|
|
129
|
+
// A repair is a change: subscribers must see the pair.
|
|
130
|
+
expect(signals).toContain('stream-status');
|
|
131
|
+
|
|
132
|
+
signals.length = 0;
|
|
133
|
+
await markStreamModel('s1', { provider: 'openai', modelId: 'gpt-5' });
|
|
134
|
+
// Already naming this model: no write, no republish for every probe.
|
|
135
|
+
expect(signals).toEqual([]);
|
|
136
|
+
} finally {
|
|
137
|
+
off();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
116
141
|
test('never resurrects a row for a run that already ended', async () => {
|
|
117
142
|
// A fallback landing on the run's LAST frame must not put the spinner back:
|
|
118
143
|
// `markStreamStatus(..., 'stream', model)` would upsert one, which is why
|
|
@@ -121,18 +121,22 @@ export async function markStreamStatus(
|
|
|
121
121
|
* `stream` row, which would RESURRECT a spinner for a run that already ended
|
|
122
122
|
* (a fallback landing on the run's last frame). This can only ever rename a row
|
|
123
123
|
* that still means "a run is in flight".
|
|
124
|
+
*
|
|
125
|
+
* The `IS NOT` pair makes the write a repair as well as a rename: a live row
|
|
126
|
+
* with no pair is filled in, and an unchanged row raises no signal.
|
|
124
127
|
*/
|
|
125
128
|
export async function markStreamModel(sessionId: string, model: SessionRunModel): Promise<void> {
|
|
126
129
|
try {
|
|
127
130
|
const db = await getDb();
|
|
128
|
-
await db.run(
|
|
131
|
+
const result = await db.run(
|
|
129
132
|
`UPDATE session_stream_state
|
|
130
133
|
SET model_provider = ?, model_id = ?, updated_at = CURRENT_TIMESTAMP
|
|
131
|
-
WHERE session_id = ? AND status = 'stream'
|
|
132
|
-
|
|
134
|
+
WHERE session_id = ? AND status = 'stream'
|
|
135
|
+
AND (model_provider IS NOT ? OR model_id IS NOT ?)`,
|
|
136
|
+
[model.provider, model.modelId, sessionId, model.provider, model.modelId],
|
|
133
137
|
);
|
|
134
138
|
// The row the sidebar names a run by just changed, so subscribers must see it.
|
|
135
|
-
emitRealtimeSignal('stream-status');
|
|
139
|
+
if ((result.changes ?? 0) > 0) emitRealtimeSignal('stream-status');
|
|
136
140
|
} catch {
|
|
137
141
|
// Status tracking is best-effort by design.
|
|
138
142
|
}
|
|
@@ -38,7 +38,7 @@ function manifest(overrides: Partial<PanelPluginManifest> = {}): PanelPluginMani
|
|
|
38
38
|
describe('HOST_CAPABILITIES', () => {
|
|
39
39
|
test('names the shipped capabilities, each individually', () => {
|
|
40
40
|
// One assertion per row: a missing row is the bug, not a changed length.
|
|
41
|
-
for (const capability of ['panel', 'server', 'storage', 'rpc', 'realtime', 'settings', 'repo-scope']) {
|
|
41
|
+
for (const capability of ['panel', 'server', 'storage', 'rpc', 'realtime', 'settings', 'repo-scope', 'mcp']) {
|
|
42
42
|
expect(HOST_CAPABILITIES).toContain(capability);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
@@ -32,6 +32,9 @@ export const HOST_CAPABILITIES: readonly string[] = [
|
|
|
32
32
|
// on the UI kit's services. A plugin that renders a repo picker requires this
|
|
33
33
|
// rather than drawing one that cannot reach the shared slot.
|
|
34
34
|
'repo-scope',
|
|
35
|
+
// A plugin may contribute MCP servers, which the host registers with every
|
|
36
|
+
// harness that can take one (`api.mcp.register`).
|
|
37
|
+
'mcp',
|
|
35
38
|
];
|
|
36
39
|
|
|
37
40
|
/** The required capabilities this host does not provide, in declared order. */
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The wire contract for a plugin's declared settings.
|
|
8
|
+
*
|
|
9
|
+
* Shared by the server that masks a stored secret and the browser that renders
|
|
10
|
+
* the form, so the marker cannot drift between the two: a client that compared
|
|
11
|
+
* against a different string would send the mask back as the new value and
|
|
12
|
+
* overwrite the credential it was trying to preserve.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* What the server substitutes for a stored secret.
|
|
17
|
+
*
|
|
18
|
+
* A secret's value never leaves the server, so the settings form is told only
|
|
19
|
+
* that one exists. The marker is what the form recognises as "unchanged" — it
|
|
20
|
+
* is never written back.
|
|
21
|
+
*/
|
|
22
|
+
export const PLUGIN_SECRET_MASK = '••••••••';
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
parseOnce,
|
|
31
31
|
validateSchedule,
|
|
32
32
|
} from '@/shared/lib/schedule/parse';
|
|
33
|
+
import { isValidTimeZone } from '@/shared/lib/schedule/timezone';
|
|
33
34
|
|
|
34
35
|
describe('parseInterval', () => {
|
|
35
36
|
test('accepts compact and spaced spellings', () => {
|
|
@@ -185,3 +186,50 @@ describe('parseOnce', () => {
|
|
|
185
186
|
expect(parseOnce('tomorrow')).toBeNull();
|
|
186
187
|
});
|
|
187
188
|
});
|
|
189
|
+
|
|
190
|
+
describe('timezone-aware schedules', () => {
|
|
191
|
+
test('a cron fires at the wall time of the task zone, not the server zone', () => {
|
|
192
|
+
const fields = parseCron('0 9 * * *')!;
|
|
193
|
+
// 2026-03-02T00:00Z is exactly 09:00 in Asia/Tokyo, so the next fire is
|
|
194
|
+
// the following day — not the same instant.
|
|
195
|
+
const from = Date.UTC(2026, 2, 2, 0, 0);
|
|
196
|
+
expect(nextCronOccurrence(fields, new Date(from), 'Asia/Tokyo')).toBe(Date.UTC(2026, 2, 3, 0, 0));
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test('a spring-forward gap is skipped, not shifted', () => {
|
|
200
|
+
const fields = parseCron('0 2 * * *')!;
|
|
201
|
+
// 2026-03-08 02:00 does not exist in New York; the next fire is the 9th.
|
|
202
|
+
const from = Date.UTC(2026, 2, 8, 0, 0);
|
|
203
|
+
expect(nextCronOccurrence(fields, new Date(from), 'America/New_York')).toBe(Date.UTC(2026, 2, 9, 6, 0));
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
test('a fall-back overlap resolves to its first occurrence', () => {
|
|
207
|
+
const fields = parseCron('0 1 * * *')!;
|
|
208
|
+
// 2026-11-01 01:00 occurs twice in New York; the first is 05:00Z (EDT).
|
|
209
|
+
const from = Date.UTC(2026, 10, 1, 0, 0);
|
|
210
|
+
expect(nextCronOccurrence(fields, new Date(from), 'America/New_York')).toBe(Date.UTC(2026, 10, 1, 5, 0));
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('a naive once spec is read in the task zone', () => {
|
|
214
|
+
expect(parseOnce('2026-10-01T09:00', 'Europe/Kyiv')).toBe(Date.UTC(2026, 9, 1, 6, 0));
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
test('an offset-bearing once spec stays absolute', () => {
|
|
218
|
+
expect(parseOnce('2026-10-01T09:00:00Z', 'Europe/Kyiv')).toBe(Date.UTC(2026, 9, 1, 9, 0));
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test('validateSchedule previews in the task zone', () => {
|
|
222
|
+
const now = Date.UTC(2026, 2, 2, 0, 0);
|
|
223
|
+
expect(validateSchedule('cron', '0 9 * * *', now, 'Asia/Tokyo')).toEqual({
|
|
224
|
+
ok: true,
|
|
225
|
+
nextRunAt: Date.UTC(2026, 2, 3, 0, 0),
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test('isValidTimeZone accepts IANA names and rejects junk', () => {
|
|
230
|
+
expect(isValidTimeZone('Europe/Kyiv')).toBe(true);
|
|
231
|
+
expect(isValidTimeZone('UTC')).toBe(true);
|
|
232
|
+
expect(isValidTimeZone('Mars/Olympus')).toBe(false);
|
|
233
|
+
expect(isValidTimeZone('')).toBe(false);
|
|
234
|
+
});
|
|
235
|
+
});
|