@openchamber/web 2.0.0 → 2.0.2
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/assets/{CodeMirrorCommentWidgets-hJbl3JX4.js → CodeMirrorCommentWidgets-CmKmyb9T.js} +1 -1
- package/dist/assets/DiffView-8-PFpZ2p.js +4 -0
- package/dist/assets/FilesView-0Ie20mEk.js +17 -0
- package/dist/assets/{GitView-DY4pelsO.js → GitView-DNUSu00w.js} +4 -4
- package/dist/assets/{GuestAttachDialog-D6mHDTB2.js → GuestAttachDialog-Cv6QzjHC.js} +1 -1
- package/dist/assets/GuestSurfacePane-Bt3jB_Ye.js +1 -0
- package/dist/assets/{JsonTreeView-DEXI2NvJ.js → JsonTreeView-BlyHTRhM.js} +1 -1
- package/dist/assets/{LinearIssuesView-BTNc-4dN.js → LinearIssuesView-CSl2MUfA.js} +1 -1
- package/dist/assets/MarkdownImageGallery-2UXJF-5B.js +1 -0
- package/dist/assets/MarkdownRendererImpl-DVHqZoug.js +12 -0
- package/dist/assets/{OnboardingScreen-FJUreEgI.js → OnboardingScreen-CIdXJpfc.js} +1 -1
- package/dist/assets/{PatchDiff-C0oOkKnO.js → PatchDiff-ByvnbG5T.js} +1 -1
- package/dist/assets/{PierreDiffViewer-asuSQAsf.js → PierreDiffViewer-BXieg0mH.js} +3 -3
- package/dist/assets/{PlanView-DGbasNHP.js → PlanView-DEIi3Q7M.js} +4 -4
- package/dist/assets/PluginPane-BEPUWVho.js +3 -0
- package/dist/assets/SettingsView-CiNh-RbW.js +30 -0
- package/dist/assets/{SettingsWindow-By4cqnqy.js → SettingsWindow-BIz224xs.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-C0P2tXLU.js → SubmoduleDiffSummary-CXKmlps9.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Cayc-yIM.js → ToolOutputDialog-BsgAK8xu.js} +6 -6
- package/dist/assets/{ToolPartDiffPreview-B0jmpPQz.js → ToolPartDiffPreview-vdPObXOf.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-DsOpvWZD.js → VirtualizedFileDiff-BkFNKWS5.js} +1 -1
- package/dist/assets/{WalkthroughView-CCakjyn9.js → WalkthroughView-6oE-MuDL.js} +2 -2
- package/dist/assets/{appThemeRegistry-Bw5oTm41.js → appThemeRegistry-aHUNHoqP.js} +1 -1
- package/dist/assets/changesTree-CePHbFcj.js +1 -0
- package/dist/assets/commitAndPush-Bon9r94r.js +1 -0
- package/dist/assets/{computeVirtualFileMetrics-B-4aLf4A.js → computeVirtualFileMetrics-DKqr_1AQ.js} +2 -2
- package/dist/assets/de-CgAJ51z7.js +10 -0
- package/dist/assets/es-zGi_ravM.js +16 -0
- package/dist/assets/fr-CPfogrWx.js +14 -0
- package/dist/assets/index-CHfphYL3.js +41 -0
- package/dist/assets/{index-B6r0Kv-B.js → index-DpFttslC.js} +1 -1
- package/dist/assets/index-DvMJ3w6V.css +1 -0
- package/dist/assets/{isDiffPlainText-Ok-kgtJA.js → isDiffPlainText-kzAgpIgi.js} +1 -1
- package/dist/assets/{isFilePlainText-0dLnkYm8.js → isFilePlainText-Uj6y-jzz.js} +1 -1
- package/dist/assets/ja-DMk6wd-U.js +16 -0
- package/dist/assets/ko-BFpzJ8jc.js +16 -0
- package/dist/assets/{main-CjXBM_Xe.js → main-CbfMxn-I.js} +2 -2
- package/dist/assets/main-anyZFMIs.js +896 -0
- package/dist/assets/{markdown-shiki.worker-CahLvHIq.js → markdown-shiki.worker-Bg8SoAJJ.js} +8 -5
- package/dist/assets/markdownCore-CmM47cAE.js +7 -0
- package/dist/assets/{miniChat-DZ3OAeLN.js → miniChat-CiAKBC10.js} +2 -2
- package/dist/assets/{mobile-CH0LOIF-.js → mobile-CsT4sJwC.js} +2 -2
- package/dist/assets/patchFileDiff-DeaE08W0.js +13 -0
- package/dist/assets/pl-VdRPcZrB.js +16 -0
- package/dist/assets/pt-BR-BRys_lOW.js +16 -0
- package/dist/assets/{renderElectronMiniChatApp-CB1uLYvh.js → renderElectronMiniChatApp-C5677jy0.js} +2 -2
- package/dist/assets/renderMobileApp-D4dBBAqQ.js +25 -0
- package/dist/assets/runtimeEndpointReset-5r0hkd-2.js +27 -0
- package/dist/assets/scheduledTasksApi-BZCNJ588.js +1 -0
- package/dist/assets/{shikiHighlight-CocY80VR.js → shikiHighlight-BSUEa3yF.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-CF77r8FA.js → textMateThemeFromAppTheme-CsATFZIV.js} +1 -1
- package/dist/assets/tr-CA9ckNnm.js +7 -0
- package/dist/assets/uk-byjR-y8D.js +16 -0
- package/dist/assets/{useAppFontEffects-Dc5nTHi8.js → useAppFontEffects-BWQZ5DeI.js} +161 -157
- package/dist/assets/{useInlineCommentController-Dbza5c8l.js → useInlineCommentController-DlFyVfBu.js} +2 -2
- package/dist/assets/{useRootScrollLock-CSCLv396.js → useRootScrollLock-Cp1eFoM2.js} +2 -2
- package/dist/assets/{vendor-codemirror-language-data-CkmYWcRI.js → vendor-codemirror-language-data-BwwommM0.js} +2 -2
- package/dist/assets/{vendor-opencode-client-_BAHQo4R.js → vendor-opencode-client-DYdsLbCM.js} +2 -2
- package/dist/assets/vendor-zod-BSoePkpP.js +39 -0
- package/dist/assets/{web-components-nsStrYq9.js → web-components-D3Yjr4Zx.js} +1 -1
- package/dist/assets/zh-CN-DRabgxdG.js +16 -0
- package/dist/assets/zh-TW-rbY5c9UK.js +16 -0
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +5 -5
- package/package.json +4 -4
- package/server/index.js +82 -0
- package/server/lib/agent-tool/DOCUMENTATION.md +5 -0
- package/server/lib/agent-tool/runtime.js +34 -6
- package/server/lib/agent-tool/runtime.test.js +15 -0
- package/server/lib/browser-control/DOCUMENTATION.md +14 -2
- package/server/lib/event-stream/global-hub.js +23 -1
- package/server/lib/event-stream/global-hub.test.js +35 -0
- package/server/lib/event-stream/global-ws-bridge.js +3 -1
- package/server/lib/event-stream/upstream-reader.js +3 -2
- package/server/lib/git/DOCUMENTATION.md +1 -1
- package/server/lib/git/service.js +22 -0
- package/server/lib/git/service.test.js +8 -0
- package/server/lib/guests/DOCUMENTATION.md +4 -3
- package/server/lib/guests/catalog.js +19 -1
- package/server/lib/guests/catalog.test.js +22 -0
- package/server/lib/guests/html-styles.js +5 -3
- package/server/lib/guests/html-styles.test.js +3 -1
- package/server/lib/guests/routes.js +11 -3
- package/server/lib/guests/service.js +5 -0
- package/server/lib/guests/surface.js +55 -9
- package/server/lib/guests/surface.test.js +56 -6
- package/server/lib/notifications/DOCUMENTATION.md +10 -0
- package/server/lib/notifications/emit-route.js +118 -0
- package/server/lib/notifications/emit-route.test.js +112 -0
- package/server/lib/openchamber-control/actions.js +16 -2
- package/server/lib/openchamber-control/service.js +23 -0
- package/server/lib/openchamber-control/service.test.js +31 -0
- package/server/lib/openchamber-sessions/fork-inheritance.js +103 -0
- package/server/lib/openchamber-sessions/fork-inheritance.test.js +69 -0
- package/server/lib/openchamber-sessions/routes.js +11 -0
- package/server/lib/openchamber-sessions/routes.test.js +18 -0
- package/server/lib/opencode/DOCUMENTATION.md +37 -24
- package/server/lib/opencode/bootstrap-runtime.js +14 -1
- package/server/lib/opencode/compatibility.js +6 -3
- package/server/lib/opencode/compatibility.test.js +8 -0
- package/server/lib/opencode/config-entity-v2.test.js +27 -0
- package/server/lib/opencode/config-paths.test.js +12 -0
- package/server/lib/opencode/config-v2.d.ts +2 -0
- package/server/lib/opencode/config-v2.js +42 -0
- package/server/lib/opencode/config-v2.test.js +17 -0
- package/server/lib/opencode/core-routes.js +20 -4
- package/server/lib/opencode/core-routes.test.js +41 -0
- package/server/lib/opencode/env-runtime.js +1 -8
- package/server/lib/opencode/feature-routes-runtime.js +2 -1
- package/server/lib/opencode/lifecycle.js +30 -2
- package/server/lib/opencode/lifecycle.test.js +27 -0
- package/server/lib/opencode/managed-config-file.js +18 -6
- package/server/lib/opencode/managed-config-file.test.js +23 -7
- package/server/lib/opencode/mcp.js +7 -2
- package/server/lib/opencode/openchamber-routes.js +29 -11
- package/server/lib/opencode/openchamber-routes.test.js +18 -0
- package/server/lib/opencode/project-directory-runtime.js +8 -0
- package/server/lib/opencode/project-directory-runtime.test.js +13 -0
- package/server/lib/opencode/provider-source-route.test.js +59 -0
- package/server/lib/opencode/providers.js +3 -0
- package/server/lib/opencode/providers.test.js +62 -0
- package/server/lib/opencode/proxy.js +38 -2
- package/server/lib/opencode/routes-upgrade.test.js +1 -1
- package/server/lib/opencode/routes.js +36 -1
- package/server/lib/opencode/server-utils-runtime.js +5 -0
- package/server/lib/opencode/settings-helpers.js +10 -0
- package/server/lib/opencode/settings-helpers.test.js +2 -2
- package/server/lib/opencode/settings-registry.json +17 -0
- package/server/lib/opencode/settings-runtime.js +1 -0
- package/server/lib/opencode/shared.js +49 -4
- package/server/lib/opencode/shared.test.js +79 -1
- package/server/lib/opencode/shutdown-runtime.js +3 -0
- package/server/lib/opencode/skill-routes.js +28 -12
- package/server/lib/opencode/skill-routes.test.js +121 -1
- package/server/lib/opencode/upgrade-capability.js +0 -14
- package/server/lib/opencode/v1-migration-topup.js +21 -15
- package/server/lib/opencode/v1-migration-topup.test.js +14 -6
- package/server/lib/opencode/v2-install.d.ts +1 -0
- package/server/lib/opencode/v2-install.js +8 -7
- package/server/lib/opencode/v2-install.test.js +13 -4
- package/server/lib/opencode/watcher.js +3 -1
- package/server/lib/opencode/websearch-config.js +13 -1
- package/server/lib/quota/providers/kimi.js +1 -1
- package/server/lib/realtime-proxy.js +5 -1
- package/server/lib/realtime-proxy.test.js +29 -0
- package/server/lib/relay/tunnel-host.js +4 -1
- package/server/lib/relay/tunnel-host.test.js +11 -0
- package/server/lib/session-assist/DOCUMENTATION.md +17 -5
- package/server/lib/session-assist/runtime.js +19 -2
- package/server/lib/session-assist/runtime.test.js +8 -0
- package/server/lib/session-goal/DOCUMENTATION.md +11 -0
- package/server/lib/small-model/DOCUMENTATION.md +11 -10
- package/server/lib/small-model/index.js +27 -32
- package/server/lib/small-model/index.test.js +28 -16
- package/server/lib/spaces/DOCUMENTATION.md +381 -20
- package/server/lib/spaces/code-in-bait.js +145 -6
- package/server/lib/spaces/code-in.js +10 -150
- package/server/lib/spaces/code-in.test.js +7 -83
- package/server/lib/spaces/code-out.js +1819 -0
- package/server/lib/spaces/code-out.test.js +3945 -0
- package/server/lib/spaces/code-transfer.js +173 -0
- package/server/lib/spaces/command-stream.test.js +181 -0
- package/server/lib/spaces/dispatcher.js +670 -0
- package/server/lib/spaces/dispatcher.test.js +582 -0
- package/server/lib/spaces/gatekeeper-channel.js +2 -0
- package/server/lib/spaces/gatekeeper-channel.test.js +9 -3
- package/server/lib/spaces/gatekeeper-program.cjs +4 -1
- package/server/lib/spaces/gatekeeper-program.test.js +3 -0
- package/server/lib/spaces/hardening.js +20 -4
- package/server/lib/spaces/hardening.test.js +18 -3
- package/server/lib/spaces/host-git.js +7 -4
- package/server/lib/spaces/host-git.test.js +6 -2
- package/server/lib/spaces/host.js +304 -0
- package/server/lib/spaces/host.test.js +273 -0
- package/server/lib/spaces/journey.js +393 -0
- package/server/lib/spaces/journey.test.js +384 -0
- package/server/lib/spaces/layout.js +26 -2
- package/server/lib/spaces/manager.js +4 -3
- package/server/lib/spaces/manager.test.js +6 -0
- package/server/lib/spaces/places/code-out.docker.live.test.js +412 -0
- package/server/lib/spaces/places/contract-suite.js +36 -0
- package/server/lib/spaces/places/dispatcher.docker.live.test.js +296 -0
- package/server/lib/spaces/places/docker.js +15 -3
- package/server/lib/spaces/places/docker.test.js +33 -2
- package/server/lib/spaces/places/escape-suite.js +86 -14
- package/server/lib/spaces/places/memory-place.js +24 -1
- package/server/lib/spaces/places/registry.js +1 -1
- package/server/lib/spaces/places/server.docker.live.test.js +69 -33
- package/server/lib/spaces/places/sessions.docker.live.test.js +220 -0
- package/server/lib/spaces/routes.js +207 -0
- package/server/lib/spaces/routes.test.js +211 -0
- package/server/lib/spaces/run-command.js +261 -8
- package/server/lib/spaces/run-command.test.js +193 -3
- package/server/lib/spaces/space-events.js +153 -0
- package/server/lib/spaces/space-events.test.js +160 -0
- package/server/lib/spaces/space-records.js +98 -0
- package/server/lib/spaces/space-records.test.js +73 -0
- package/server/lib/spaces/space-sessions.js +210 -0
- package/server/lib/spaces/space-sessions.test.js +161 -0
- package/server/lib/spaces/websocket.js +329 -0
- package/server/lib/spaces/websocket.test.js +345 -0
- package/server/lib/ui-auth/ui-auth.js +8 -2
- package/server/lib/ui-auth/ui-auth.test.js +29 -0
- package/server/opencode-proxy.test.js +113 -0
- package/dist/assets/DiffView-BucGEJYa.js +0 -4
- package/dist/assets/FilesView-CQcaaAVP.js +0 -17
- package/dist/assets/GuestSurfacePane--DJ7rsmY.js +0 -1
- package/dist/assets/MarkdownImageGallery-wcUUcf8l.js +0 -1
- package/dist/assets/MarkdownRendererImpl-BPe2TVV2.js +0 -12
- package/dist/assets/PluginPane-DImv8hV2.js +0 -3
- package/dist/assets/SettingsView-DOjuOljf.js +0 -29
- package/dist/assets/commitAndPush-sGEelpjh.js +0 -1
- package/dist/assets/de-CD9utsNj.js +0 -10
- package/dist/assets/es-NNum2rX8.js +0 -16
- package/dist/assets/fr-CJLGmduQ.js +0 -14
- package/dist/assets/index-DjGPR5vW.js +0 -41
- package/dist/assets/index-fCXJ-8Qt.css +0 -1
- package/dist/assets/ja-BuddHNi6.js +0 -16
- package/dist/assets/ko-BrwMbHmf.js +0 -16
- package/dist/assets/main-CxVyUDU_.js +0 -896
- package/dist/assets/markdownCore-B6PpX409.js +0 -5
- package/dist/assets/patchFileDiff-BFRGKaGH.js +0 -13
- package/dist/assets/pl-BwN4TNlP.js +0 -16
- package/dist/assets/pt-BR-BhMtownO.js +0 -16
- package/dist/assets/renderMobileApp-nQ4sjQtb.js +0 -25
- package/dist/assets/runtimeEndpointReset-9ZGlXU4J.js +0 -27
- package/dist/assets/scheduledTasksApi-6DsL_SwM.js +0 -1
- package/dist/assets/tr-DRzvqMdi.js +0 -7
- package/dist/assets/uk-b2aYOSNh.js +0 -16
- package/dist/assets/vendor-zod-Gea9uBlY.js +0 -39
- package/dist/assets/zh-CN-DZeUThm_.js +0 -16
- package/dist/assets/zh-TW-2fRE7uc6.js +0 -16
package/dist/index.html
CHANGED
|
@@ -515,17 +515,17 @@
|
|
|
515
515
|
pointer-events: none;
|
|
516
516
|
}
|
|
517
517
|
</style>
|
|
518
|
-
<script type="module" crossorigin src="/assets/main-
|
|
518
|
+
<script type="module" crossorigin src="/assets/main-CbfMxn-I.js"></script>
|
|
519
519
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
520
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
520
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-BSoePkpP.js">
|
|
521
521
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
522
522
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
523
523
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
524
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
525
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
524
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-DYdsLbCM.js">
|
|
525
|
+
<link rel="modulepreload" crossorigin href="/assets/index-CHfphYL3.js">
|
|
526
526
|
<link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-CirXEPJq.js">
|
|
527
527
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
528
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
528
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DvMJ3w6V.css">
|
|
529
529
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
530
530
|
</head>
|
|
531
531
|
<body class="h-full bg-background text-foreground">
|
package/dist/mini-chat.html
CHANGED
|
@@ -74,16 +74,16 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
|
|
77
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
77
|
+
<script type="module" crossorigin src="/assets/miniChat-CiAKBC10.js"></script>
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
79
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
79
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-BSoePkpP.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
83
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
84
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
83
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-DYdsLbCM.js">
|
|
84
|
+
<link rel="modulepreload" crossorigin href="/assets/index-CHfphYL3.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
86
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
86
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DvMJ3w6V.css">
|
|
87
87
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
88
88
|
</head>
|
|
89
89
|
<body class="h-full bg-background text-foreground">
|
package/dist/mobile.html
CHANGED
|
@@ -63,16 +63,16 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-CsT4sJwC.js"></script>
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-BSoePkpP.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-DYdsLbCM.js">
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/index-CHfphYL3.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
75
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
75
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DvMJ3w6V.css">
|
|
76
76
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
77
77
|
</head>
|
|
78
78
|
<body class="h-full bg-background text-foreground">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openchamber/web",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server/index.js",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@clack/prompts": "^1.1.0",
|
|
28
28
|
"@octokit/rest": "^22.0.1",
|
|
29
|
-
"@openchamber/sdk": "2.0.
|
|
30
|
-
"@opencode/client": "2.0.
|
|
31
|
-
"@opencode/schema": "2.0.
|
|
29
|
+
"@openchamber/sdk": "2.0.2",
|
|
30
|
+
"@opencode/client": "2.0.16",
|
|
31
|
+
"@opencode/schema": "2.0.16",
|
|
32
32
|
"@simplewebauthn/server": "13.3.3",
|
|
33
33
|
"bun-pty": "^0.4.5",
|
|
34
34
|
"compression": "^1.8.1",
|
package/server/index.js
CHANGED
|
@@ -112,6 +112,8 @@ import { createAgentMemoryRuntime } from './lib/agent-memory/runtime.js';
|
|
|
112
112
|
import { createAgentMemoryActions } from './lib/agent-memory/actions.js';
|
|
113
113
|
import { createMemoryProjectResolver } from './lib/agent-memory/project-resolution.js';
|
|
114
114
|
import { isAgentMemoryFeatureAvailable } from './lib/agent-memory/feature-flag.js';
|
|
115
|
+
import { createSpacesHost } from './lib/spaces/host.js';
|
|
116
|
+
import { createSwitchController, registerSpaceRoutes } from './lib/spaces/routes.js';
|
|
115
117
|
import { resolvePrimaryWorktreeRoot } from './lib/git/service.js';
|
|
116
118
|
import { createRemoteClientAuthRuntime } from './lib/client-auth/remote-clients.js';
|
|
117
119
|
import { createClientPairingRuntime } from './lib/client-auth/pairing.js';
|
|
@@ -129,6 +131,7 @@ import { createOpenChamberSessionService } from './lib/openchamber-sessions/rout
|
|
|
129
131
|
import { createSessionMetadataStore, createOpenCodeSessionMetadata } from './lib/openchamber-sessions/session-metadata-store.js';
|
|
130
132
|
import { createScheduledTaskService } from './lib/scheduled-tasks/service.js';
|
|
131
133
|
import { createOpenChamberControlService } from './lib/openchamber-control/service.js';
|
|
134
|
+
import { createPluginNotificationEmitter } from './lib/notifications/emit-route.js';
|
|
132
135
|
import { OpenChamberControlError } from './lib/openchamber-control/error.js';
|
|
133
136
|
import { createFileOpenRequester } from './lib/openchamber-control/file-open.js';
|
|
134
137
|
import { applyConnectAttemptTimeout } from './lib/network-defaults.js';
|
|
@@ -386,6 +389,8 @@ const projectDirectoryRuntime = createProjectDirectoryRuntime({
|
|
|
386
389
|
normalizeDirectoryPath,
|
|
387
390
|
getReadSettingsFromDiskMigrated: () => readSettingsFromDiskMigrated,
|
|
388
391
|
sanitizeProjects,
|
|
392
|
+
// A space's directory never runs on the host, whatever route carries it.
|
|
393
|
+
refuseDirectory: (candidate) => spacesHost?.refuseDirectory(candidate) ?? null,
|
|
389
394
|
});
|
|
390
395
|
|
|
391
396
|
const resolveDirectoryCandidate = (...args) => projectDirectoryRuntime.resolveDirectoryCandidate(...args);
|
|
@@ -629,6 +634,9 @@ let openCodeNotReadySince = 0;
|
|
|
629
634
|
let isExternalOpenCode = false;
|
|
630
635
|
let exitOnShutdown = true;
|
|
631
636
|
let uiAuthController = null;
|
|
637
|
+
// The isolated-spaces host: the place, the manager and the dispatcher. Null while the feature's
|
|
638
|
+
// switch is off, and then nothing of the feature runs, see docs/isolated-spaces/DESIGN.md.
|
|
639
|
+
let spacesHost = null;
|
|
632
640
|
let activeTunnelController = null;
|
|
633
641
|
let globalWatcherStartPromise = null;
|
|
634
642
|
const tunnelProviderRegistry = createTunnelProviderRegistry([
|
|
@@ -1105,6 +1113,10 @@ const serverUtilsRuntime = createServerUtilsRuntime({
|
|
|
1105
1113
|
// down, while the proxy is registered later still.
|
|
1106
1114
|
getArchivedSessions: () => openChamberSessionService.archiveStore.getAll(),
|
|
1107
1115
|
getStoredSessionMetadata: () => sessionMetadataStore.listUnmigrated(),
|
|
1116
|
+
// Isolated spaces: with the switch on, the session list carries every space's sessions and
|
|
1117
|
+
// the global SSE stream their events. Called, not captured: the host is made in `main`.
|
|
1118
|
+
getMergeSpaceSessionList: () => (spacesHost ? (payload) => spacesHost.mergeSessionList(payload) : null),
|
|
1119
|
+
getSpaceEventHub: () => (spacesHost ? globalMessageStreamHub : null),
|
|
1108
1120
|
fs,
|
|
1109
1121
|
os,
|
|
1110
1122
|
path,
|
|
@@ -1563,6 +1575,12 @@ const fileOpenRequester = createFileOpenRequester({
|
|
|
1563
1575
|
},
|
|
1564
1576
|
});
|
|
1565
1577
|
|
|
1578
|
+
const pluginNotificationEmitter = createPluginNotificationEmitter({
|
|
1579
|
+
readSettingsFromDiskMigrated,
|
|
1580
|
+
emitDesktopNotification,
|
|
1581
|
+
broadcastUiNotification,
|
|
1582
|
+
});
|
|
1583
|
+
|
|
1566
1584
|
const openChamberControlService = createOpenChamberControlService({
|
|
1567
1585
|
readSettingsFromDiskMigrated,
|
|
1568
1586
|
sanitizeProjects,
|
|
@@ -1573,6 +1591,15 @@ const openChamberControlService = createOpenChamberControlService({
|
|
|
1573
1591
|
scheduledTaskService,
|
|
1574
1592
|
browserControl: browserControlRouter,
|
|
1575
1593
|
fileOpen: fileOpenRequester,
|
|
1594
|
+
// The tool is off by default; a plugin generated before it was switched off
|
|
1595
|
+
// must not keep paging the user.
|
|
1596
|
+
notifyUser: async (input) => {
|
|
1597
|
+
const settings = await readSettingsFromDiskMigrated().catch(() => null);
|
|
1598
|
+
if (settings?.agentNotifyToolEnabled !== true) {
|
|
1599
|
+
return { status: 403, body: { error: 'The notify tool is turned off in OpenChamber settings' } };
|
|
1600
|
+
}
|
|
1601
|
+
return pluginNotificationEmitter.emit(input);
|
|
1602
|
+
},
|
|
1576
1603
|
agentMemoryActions: createAgentMemoryActions({
|
|
1577
1604
|
agentMemoryRuntime,
|
|
1578
1605
|
createError: (message, status) => new OpenChamberControlError(message, status),
|
|
@@ -1670,6 +1697,7 @@ const gracefulShutdownRuntime = createGracefulShutdownRuntime({
|
|
|
1670
1697
|
getDictationRuntime: () => dictationRuntime,
|
|
1671
1698
|
getRelayService: () => relayServiceInstance,
|
|
1672
1699
|
getRelayReconcileTimer: () => relayReconcileTimer,
|
|
1700
|
+
getSpacesHost: () => spacesHost,
|
|
1673
1701
|
});
|
|
1674
1702
|
|
|
1675
1703
|
const gracefulShutdown = (...args) => gracefulShutdownRuntime.gracefulShutdown(...args);
|
|
@@ -1846,6 +1874,31 @@ async function main(options = {}) {
|
|
|
1846
1874
|
// but do not hold server listen or managed OpenCode startup on `say -v "?"`.
|
|
1847
1875
|
const sayTTSCapability = detectSayTtsCapability(process);
|
|
1848
1876
|
|
|
1877
|
+
// The isolated-spaces switch, read here at start and changed live through its route below.
|
|
1878
|
+
// While it is off the feature has no place, no manager, no route and runs no `docker`.
|
|
1879
|
+
const buildSpacesHost = () => createSpacesHost({
|
|
1880
|
+
dataDir: OPENCHAMBER_DATA_DIR,
|
|
1881
|
+
dockerPath: searchPathFor('docker', buildAugmentedPath()) ?? 'docker',
|
|
1882
|
+
gitPath: searchPathFor('git', buildAugmentedPath()) ?? 'git',
|
|
1883
|
+
// git starts `docker exec` itself when code moves in or out, so its PATH must find docker.
|
|
1884
|
+
hostEnvironment: { ...process.env, PATH: buildAugmentedPath() },
|
|
1885
|
+
// So the session list can say which registered project each space was made for.
|
|
1886
|
+
listProjectDirectories: async () => {
|
|
1887
|
+
const settings = await readSettingsFromDiskMigrated();
|
|
1888
|
+
return sanitizeProjects(settings?.projects || []).map((project) => project.path);
|
|
1889
|
+
},
|
|
1890
|
+
});
|
|
1891
|
+
const startupSettings = await readSettingsFromDiskMigrated().catch(() => null);
|
|
1892
|
+
if (startupSettings?.isolatedSpacesEnabled === true) {
|
|
1893
|
+
try {
|
|
1894
|
+
spacesHost = buildSpacesHost();
|
|
1895
|
+
} catch (error) {
|
|
1896
|
+
// The feature is absent then, and the rest of the server starts as with the switch off.
|
|
1897
|
+
console.error(`[spaces] isolated spaces are unavailable this start: ${error?.code ?? ''} ${error?.message ?? error}`.trim());
|
|
1898
|
+
spacesHost = null;
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1849
1902
|
const app = express();
|
|
1850
1903
|
const serverStartedAt = new Date().toISOString();
|
|
1851
1904
|
const packagedClientOrigins = new Set([
|
|
@@ -1997,6 +2050,7 @@ async function main(options = {}) {
|
|
|
1997
2050
|
isUiVisible,
|
|
1998
2051
|
getUiNotificationClients: () => uiNotificationClients,
|
|
1999
2052
|
writeSseEvent,
|
|
2053
|
+
pluginNotificationEmitter,
|
|
2000
2054
|
sessionRuntime,
|
|
2001
2055
|
setPushInitialized,
|
|
2002
2056
|
fs,
|
|
@@ -2012,8 +2066,35 @@ async function main(options = {}) {
|
|
|
2012
2066
|
setAutoAcceptSession,
|
|
2013
2067
|
agentToolRuntime,
|
|
2014
2068
|
desktopUpdater,
|
|
2069
|
+
skipBodyParsing: (req) => spacesHost?.skipsBodyParsing(req) === true,
|
|
2015
2070
|
});
|
|
2016
2071
|
uiAuthController = bootstrapResult.uiAuthController;
|
|
2072
|
+
// After the API auth gate, before every route that reads a directory, before the OpenCode proxy.
|
|
2073
|
+
// The slot is mounted once and reads the host at call time, so the switch can turn the feature
|
|
2074
|
+
// on and off live: with no host it passes every request on and no upgrade is taken.
|
|
2075
|
+
app.use((req, res, next) => (spacesHost ? spacesHost.middleware(req, res, next) : next()));
|
|
2076
|
+
server.on('upgrade', (...args) => { spacesHost?.upgradeHandler(...args); });
|
|
2077
|
+
const startSpacesHost = (host) => {
|
|
2078
|
+
host.prepareUpgrades({ uiAuthController, isRequestOriginAllowed });
|
|
2079
|
+
// Every space's events join the host's hub, and the host asks each space for its live status.
|
|
2080
|
+
void host.startEvents(globalMessageStreamHub).catch((error) => {
|
|
2081
|
+
console.warn(`[spaces] could not follow the spaces: ${error?.message ?? error}`);
|
|
2082
|
+
});
|
|
2083
|
+
};
|
|
2084
|
+
if (spacesHost) startSpacesHost(spacesHost);
|
|
2085
|
+
const spacesSwitch = createSwitchController({
|
|
2086
|
+
getHost: () => spacesHost,
|
|
2087
|
+
setHost: (host) => { spacesHost = host; },
|
|
2088
|
+
buildHost: buildSpacesHost,
|
|
2089
|
+
startHost: startSpacesHost,
|
|
2090
|
+
persist: (enabled) => persistSettings({ isolatedSpacesEnabled: enabled }),
|
|
2091
|
+
});
|
|
2092
|
+
registerSpaceRoutes(app, {
|
|
2093
|
+
getJourney: () => spacesHost?.journey ?? null,
|
|
2094
|
+
getPlaces: () => spacesHost?.places() ?? [],
|
|
2095
|
+
readSwitch: spacesSwitch.readSwitch,
|
|
2096
|
+
setSwitch: spacesSwitch.setSwitch,
|
|
2097
|
+
});
|
|
2017
2098
|
realtimeProxyRuntime = attachRealtimeProxy({
|
|
2018
2099
|
app,
|
|
2019
2100
|
server,
|
|
@@ -2107,6 +2188,7 @@ async function main(options = {}) {
|
|
|
2107
2188
|
guestSurfaceRuntime?.endForGuest(event.guestId);
|
|
2108
2189
|
return browserControlRouter.handleGuestDeactivated(event);
|
|
2109
2190
|
},
|
|
2191
|
+
surfaceViewerHeaders: (guestId, viewerId) => guestSurfaceRuntime?.viewerHeaders(guestId, viewerId) ?? null,
|
|
2110
2192
|
builtInExtensionsDir: options.builtInExtensionsDir,
|
|
2111
2193
|
openchamberUserConfigRoot: OPENCHAMBER_USER_CONFIG_ROOT,
|
|
2112
2194
|
managedChatsRoot: OPENCHAMBER_CHATS_DIR,
|
|
@@ -11,6 +11,11 @@ the user can want independently:
|
|
|
11
11
|
`agentControlToolEnabled` setting is not `false`.
|
|
12
12
|
- `openchamber_web` — looking at and interacting with the page in OpenChamber's
|
|
13
13
|
browser panel. Enabled while `agentWebToolEnabled` is not `false`.
|
|
14
|
+
- `openchamber_notify` — `notify.send`, a notification to the user through
|
|
15
|
+
`lib/notifications/emit-route.js` (same limits and rate window as
|
|
16
|
+
`POST /api/notifications/emit`). Off by default: enabled only while
|
|
17
|
+
`agentNotifyToolEnabled` is `true`, and the control service refuses the
|
|
18
|
+
action when the setting is off, so a stale plugin cannot keep paging.
|
|
14
19
|
|
|
15
20
|
Both default to on, are toggled in Settings → General → OpenCode CLI, and take
|
|
16
21
|
effect in the running OpenCode within a couple of seconds — OpenChamber rewrites
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
OPENCHAMBER_AGENT_TOOL_ACTIONS,
|
|
4
4
|
OPENCHAMBER_MEMORY_ACTION_DEFINITIONS,
|
|
5
5
|
OPENCHAMBER_MEMORY_ACTIONS,
|
|
6
|
+
OPENCHAMBER_NOTIFY_ACTION_DEFINITIONS,
|
|
7
|
+
OPENCHAMBER_NOTIFY_ACTIONS,
|
|
6
8
|
resolveAgentToolAction,
|
|
7
9
|
OPENCHAMBER_WEB_ACTION_DEFINITIONS,
|
|
8
10
|
OPENCHAMBER_WEB_ACTIONS,
|
|
@@ -12,12 +14,18 @@ const TOOL_SCHEMA_VERSION = 1;
|
|
|
12
14
|
const PLUGIN_ID = 'openchamber-agent-tool';
|
|
13
15
|
// Everything either managed tool may ask for; the agent allowlist stays
|
|
14
16
|
// narrower than the full control surface.
|
|
15
|
-
const ACTIONS = new Set([
|
|
17
|
+
const ACTIONS = new Set([
|
|
18
|
+
...OPENCHAMBER_AGENT_TOOL_ACTIONS,
|
|
19
|
+
...OPENCHAMBER_WEB_ACTIONS,
|
|
20
|
+
...OPENCHAMBER_MEMORY_ACTIONS,
|
|
21
|
+
...OPENCHAMBER_NOTIFY_ACTIONS,
|
|
22
|
+
]);
|
|
16
23
|
const AGENT_TOOL_ACTION_TITLES = Object.fromEntries(
|
|
17
24
|
[
|
|
18
25
|
...OPENCHAMBER_AGENT_TOOL_ACTION_DEFINITIONS,
|
|
19
26
|
...OPENCHAMBER_WEB_ACTION_DEFINITIONS,
|
|
20
27
|
...OPENCHAMBER_MEMORY_ACTION_DEFINITIONS,
|
|
28
|
+
...OPENCHAMBER_NOTIFY_ACTION_DEFINITIONS,
|
|
21
29
|
].map(({ action, title }) => [action, title]),
|
|
22
30
|
);
|
|
23
31
|
|
|
@@ -28,7 +36,7 @@ const AGENT_TOOL_ACTION_TITLES = Object.fromEntries(
|
|
|
28
36
|
* in the other tool's schema, which is both misleading and paid for in context
|
|
29
37
|
* on every call.
|
|
30
38
|
*/
|
|
31
|
-
const WEB_PARAMETER_NAMES = ['url', 'selector', 'text', 'value', 'submit', 'direction', 'viewport', 'label'];
|
|
39
|
+
const WEB_PARAMETER_NAMES = ['url', 'selector', 'text', 'value', 'submit', 'direction', 'viewport', 'label', 'tabId'];
|
|
32
40
|
// `title` is shared with the control tool, so it is not listed here — only the
|
|
33
41
|
// names memory alone introduces are kept out of the other schemas.
|
|
34
42
|
const MEMORY_ONLY_PARAMETER_NAMES = ['body', 'scope', 'memoryId', 'type'];
|
|
@@ -87,6 +95,7 @@ const ALL_PARAMETER_PROPERTIES = {
|
|
|
87
95
|
direction: { type: 'string', enum: ['up', 'down', 'top', 'bottom'], description: 'Scroll direction for browser.scroll' },
|
|
88
96
|
viewport: { type: 'string', enum: ['mobile', 'tablet', 'desktop', 'fill'], description: 'Page layout size; snapshots report which one is in effect' },
|
|
89
97
|
label: { type: 'string', description: 'Short name for a browser.capture image, such as before-fix' },
|
|
98
|
+
tabId: { type: 'string', description: 'Browser tab to act on, an id from the tabs a browser.snapshot lists. Omit to use the tab the user is looking at' },
|
|
90
99
|
body: { type: 'string', description: 'Full text of the memory; state it so it still makes sense in a session that has none of this conversation' },
|
|
91
100
|
scope: { type: 'string', enum: ['global', 'project', 'both'], description: 'global is about the user and applies everywhere; project is about this codebase. both is only valid for memory.list' },
|
|
92
101
|
memoryId: { type: 'string', description: 'Memory ID from a memory.list or memory.read result' },
|
|
@@ -108,12 +117,22 @@ const MEMORY_PARAMETER_PROPERTIES = {
|
|
|
108
117
|
...MEMORY_PARAMETER_OVERRIDES,
|
|
109
118
|
};
|
|
110
119
|
|
|
120
|
+
// Its own names, not the shared map: `title` and `body` mean something else in
|
|
121
|
+
// the control and memory tools.
|
|
122
|
+
const NOTIFY_PARAMETER_PROPERTIES = {
|
|
123
|
+
title: { type: 'string', description: 'Short headline the user reads first, up to 120 characters' },
|
|
124
|
+
body: { type: 'string', description: 'One or two sentences of detail, up to 500 characters' },
|
|
125
|
+
showWhenFocused: { type: 'boolean', description: 'Show it even while the user is looking at OpenChamber. Only for something that cannot wait' },
|
|
126
|
+
};
|
|
127
|
+
|
|
111
128
|
const CONTROL_TOOL_DESCRIPTION = "Control OpenChamber projects, sessions, and scheduled tasks on the user's behalf. Sessions and scheduled tasks you create are for the user to follow and interact with. Do not decide on your own to hand parts of your current task to another session; when the user asks you to create a session, send a prompt to one, or schedule a task, do it, including when the work relates to your current task. Use one action per call. Scope with projectId or directory; omit both to use the current session directory. Session dispatches return immediately by default and you receive no notification when a dispatched session finishes, so never promise to report back on it; the user follows it in OpenChamber; a dispatched session needs no follow-up from you. If the user later asks how it went, use session.messages (add wait to block until it is idle, lastAssistant for just the final answer) — session.send always sends a NEW prompt and never just waits. Set wait only when the user asks or the next step requires the completed result. Session and worktree deletion are unavailable.";
|
|
112
129
|
|
|
113
130
|
const WEB_TOOL_DESCRIPTION = "Look at and interact with a web page in OpenChamber's browser panel, so you can check your own work rather than describing what you expect. Use one action per call. Open a page, snapshot it to read its text and its interactive elements, then click, type or scroll using the selectors the snapshot returned; snapshots also report any errors the page logged. Pass a selector to browser.snapshot to read one part of a long page. browser.inspect returns computed styles when the question is how something renders. Set viewport to check a layout at mobile, tablet or desktop size. The page runs with the user's real logins, so treat what you see as their live session.";
|
|
114
131
|
|
|
115
132
|
const MEMORY_TOOL_DESCRIPTION = "Keep what you learn across sessions, so the user does not have to explain the same thing twice. Use one action per call. The session already lists the titles of what is stored. A title is an abbreviation, not the memory: read the entry with memory.read once before acting on it (it then stays in your context; do not re-read it on later turns), because titles leave out the conditions and exceptions that decide how the memory applies, and the ones that look self-explanatory hide them most often. Save something only when it will still be true in a later session — a stable preference, a project convention, a decision and its reason, or a hard-won pointer. Do not save one-off task state, anything you can read from the code, secrets or credentials, or anything the user asked you not to keep; when the user explicitly asks you to remember something, save it, unless it is a secret or credential. Choose the scope deliberately: global is about the user and reaches every project, so put a project's conventions in project scope. Save in the moment, without asking first, when the user corrects how you work or states a preference, confirms that a non-obvious approach worked, or when you learn a project fact that took real effort to find. One fact per entry. The user can review and remove what you save, so save when it fits and mention it briefly.";
|
|
116
133
|
|
|
134
|
+
const NOTIFY_TOOL_DESCRIPTION = "Send the user a notification through OpenChamber, so they learn about something without watching the session. Use it when you finish work that took long enough for the user to step away, when you are blocked on something only the user can resolve, or when the user asked to be told about something. Do not use it for routine progress, for every finished step, or to repeat what your reply already says to a user who is present. Keep the title short and put detail in the body.";
|
|
135
|
+
|
|
117
136
|
const asNonEmptyString = (value) => {
|
|
118
137
|
if (typeof value !== 'string') return null;
|
|
119
138
|
const trimmed = value.trim();
|
|
@@ -240,7 +259,7 @@ const createToolEntry = ({ name, description, definitions, parameters }) => Stri
|
|
|
240
259
|
})
|
|
241
260
|
`;
|
|
242
261
|
|
|
243
|
-
const createPluginSource = ({ includeControl, includeWeb, includeMemory }) => {
|
|
262
|
+
const createPluginSource = ({ includeControl, includeWeb, includeMemory, includeNotify }) => {
|
|
244
263
|
const entries = [];
|
|
245
264
|
if (includeControl) {
|
|
246
265
|
entries.push(createToolEntry({
|
|
@@ -266,6 +285,14 @@ const createPluginSource = ({ includeControl, includeWeb, includeMemory }) => {
|
|
|
266
285
|
parameters: MEMORY_PARAMETER_PROPERTIES,
|
|
267
286
|
}));
|
|
268
287
|
}
|
|
288
|
+
if (includeNotify) {
|
|
289
|
+
entries.push(createToolEntry({
|
|
290
|
+
name: 'openchamber_notify',
|
|
291
|
+
description: NOTIFY_TOOL_DESCRIPTION,
|
|
292
|
+
definitions: OPENCHAMBER_NOTIFY_ACTION_DEFINITIONS,
|
|
293
|
+
parameters: NOTIFY_PARAMETER_PROPERTIES,
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
269
296
|
|
|
270
297
|
// The callback carries the per-child token over plain HTTP. With a proxy in
|
|
271
298
|
// the child's environment, fetch would hand a non-loopback callback, token
|
|
@@ -329,13 +356,13 @@ export const createAgentToolRuntime = (dependencies) => {
|
|
|
329
356
|
* change while it runs, so the source on disk always matches the settings —
|
|
330
357
|
* the running OpenCode reloads the directory it already has configured.
|
|
331
358
|
*/
|
|
332
|
-
const materializePlugin = async ({ includeControl = true, includeWeb = true, includeMemory = true } = {}) => {
|
|
333
|
-
if (!includeControl && !includeWeb && !includeMemory) {
|
|
359
|
+
const materializePlugin = async ({ includeControl = true, includeWeb = true, includeMemory = true, includeNotify = false } = {}) => {
|
|
360
|
+
if (!includeControl && !includeWeb && !includeMemory && !includeNotify) {
|
|
334
361
|
throw new Error('At least one OpenChamber managed tool must be enabled to inject the plugin');
|
|
335
362
|
}
|
|
336
363
|
await fsPromises.mkdir(pluginDirectory, { recursive: true });
|
|
337
364
|
await fsPromises.writeFile(pluginManifestPath, PLUGIN_PACKAGE_JSON, { mode: 0o600 });
|
|
338
|
-
await fsPromises.writeFile(pluginPath, createPluginSource({ includeControl, includeWeb, includeMemory }), { mode: 0o600 });
|
|
365
|
+
await fsPromises.writeFile(pluginPath, createPluginSource({ includeControl, includeWeb, includeMemory, includeNotify }), { mode: 0o600 });
|
|
339
366
|
return pluginDirectory;
|
|
340
367
|
};
|
|
341
368
|
|
|
@@ -484,6 +511,7 @@ export const createAgentToolRuntime = (dependencies) => {
|
|
|
484
511
|
pluginDirectory,
|
|
485
512
|
materializePlugin,
|
|
486
513
|
createChildEnv,
|
|
514
|
+
authorizeRequest: authorize,
|
|
487
515
|
registerRoutes,
|
|
488
516
|
execute,
|
|
489
517
|
abortSession,
|
|
@@ -249,6 +249,21 @@ describe('managed agent tool runtime', () => {
|
|
|
249
249
|
expect(Object.keys(tool)).toEqual(['openchamber_memory']);
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
+
it('exposes notify as its own tool only when switched on', async () => {
|
|
253
|
+
const { runtime, dataDir } = await createRuntime();
|
|
254
|
+
await prepareManagedEnv(runtime, { includeControl: true, includeWeb: false, includeMemory: false, includeNotify: true });
|
|
255
|
+
const tool = await loadTools(dataDir, 'notify');
|
|
256
|
+
|
|
257
|
+
expect(Object.keys(tool)).toEqual(['openchamber', 'openchamber_notify']);
|
|
258
|
+
expect(Object.keys(tool.openchamber_notify.input.properties.parameters.properties).sort())
|
|
259
|
+
.toEqual(['body', 'showWhenFocused', 'title']);
|
|
260
|
+
expect(Object.keys(tool.openchamber.input.properties.parameters.properties)).not.toContain('showWhenFocused');
|
|
261
|
+
|
|
262
|
+
const { runtime: plain, dataDir: plainDir } = await createRuntime();
|
|
263
|
+
await prepareManagedEnv(plain, { includeControl: true, includeWeb: false, includeMemory: false });
|
|
264
|
+
expect(Object.keys(await loadTools(plainDir, 'nonotify'))).toEqual(['openchamber']);
|
|
265
|
+
});
|
|
266
|
+
|
|
252
267
|
it('refuses to inject a plugin with no tools in it', async () => {
|
|
253
268
|
const { runtime } = await createRuntime();
|
|
254
269
|
let failed = false;
|
|
@@ -46,8 +46,20 @@ itself; it can only ask and wait.
|
|
|
46
46
|
`browser.*` actions of the `openchamber_web` tool onto the router's
|
|
47
47
|
`request()` (same signature as the broker) and owns their parameter
|
|
48
48
|
validation.
|
|
49
|
-
- The client half is `packages/ui/src/lib/browser/controlClient.ts
|
|
50
|
-
|
|
49
|
+
- The client half is `packages/ui/src/lib/browser/controlClient.ts`. Every
|
|
50
|
+
mounted browser tab registers its pane under its context-panel tab id. An
|
|
51
|
+
action with `tabId` runs in that tab; without one it runs in the browser tab
|
|
52
|
+
the user last had in front of them (`setShownBrowserTab`, set by
|
|
53
|
+
`ContextPanel`), never in whichever pane registered last, and never switches
|
|
54
|
+
the user to the tab it acts in. `browser.open` without `tabId` never
|
|
55
|
+
navigates an existing tab: the registered opener (`ContextPanel`,
|
|
56
|
+
`useUIStore.openAgentBrowserTab`) makes a new background tab and the answer
|
|
57
|
+
carries its `tabId`. `browser.snapshot` answers carry `tabs`
|
|
58
|
+
(`id`, `title`, `url`, `active`). A client without the named tab waits
|
|
59
|
+
briefly, so the client that has it claims first, then claims and answers
|
|
60
|
+
"no such tab". `tabId` is validated and passed through by
|
|
61
|
+
`../openchamber-control/service.js` for every action, so an extension
|
|
62
|
+
provider receives it untouched (`BrowserTabTarget` in `@openchamber/sdk`).
|
|
51
63
|
|
|
52
64
|
## Invariants
|
|
53
65
|
|
|
@@ -24,6 +24,8 @@ export function createGlobalMessageStreamHub({
|
|
|
24
24
|
throw new RangeError('Replay limits must be nonnegative safe integers');
|
|
25
25
|
}
|
|
26
26
|
const eventSubscribers = new Set();
|
|
27
|
+
// The event subscribers that also take the events of isolated spaces.
|
|
28
|
+
const spaceSubscribers = new Set();
|
|
27
29
|
const statusSubscribers = new Set();
|
|
28
30
|
const replay = [];
|
|
29
31
|
let replayBytes = 0;
|
|
@@ -69,6 +71,10 @@ export function createGlobalMessageStreamHub({
|
|
|
69
71
|
const eventId = typeof envelope?.eventId === 'string' && envelope.eventId.length > 0
|
|
70
72
|
? envelope.eventId
|
|
71
73
|
: `${replayIdPrefix}${String(++replaySequence).padStart(12, '0')}`;
|
|
74
|
+
// An event of an isolated space carries the space's id; subscribers see it only when they
|
|
75
|
+
// asked for space events, because a consumer that acts on the host's OpenCode by
|
|
76
|
+
// directory must never act on a space's directory.
|
|
77
|
+
const spaceId = typeof envelope?.spaceId === 'string' && envelope.spaceId.length > 0 ? envelope.spaceId : null;
|
|
72
78
|
let serializedFrame;
|
|
73
79
|
let translated;
|
|
74
80
|
return {
|
|
@@ -76,6 +82,7 @@ export function createGlobalMessageStreamHub({
|
|
|
76
82
|
payload,
|
|
77
83
|
directory,
|
|
78
84
|
eventId,
|
|
85
|
+
spaceId,
|
|
79
86
|
serialize() {
|
|
80
87
|
serializedFrame ??= serializeMessageStreamWsEvent(payload, { directory, eventId });
|
|
81
88
|
return serializedFrame;
|
|
@@ -112,6 +119,7 @@ export function createGlobalMessageStreamHub({
|
|
|
112
119
|
}
|
|
113
120
|
|
|
114
121
|
for (const subscriber of Array.from(eventSubscribers)) {
|
|
122
|
+
if (normalized.spaceId !== null && !spaceSubscribers.has(subscriber)) continue;
|
|
115
123
|
notifySubscriber('event', subscriber, normalized);
|
|
116
124
|
}
|
|
117
125
|
};
|
|
@@ -191,12 +199,26 @@ export function createGlobalMessageStreamHub({
|
|
|
191
199
|
hasConnected() {
|
|
192
200
|
return everConnected;
|
|
193
201
|
},
|
|
194
|
-
|
|
202
|
+
/**
|
|
203
|
+
* `spaces: true` also delivers the events of isolated spaces, which carry `spaceId`.
|
|
204
|
+
* Without it a subscriber sees the host's events only, as every consumer did before spaces.
|
|
205
|
+
*/
|
|
206
|
+
subscribeEvent(subscriber, { spaces = false } = {}) {
|
|
195
207
|
eventSubscribers.add(subscriber);
|
|
208
|
+
if (spaces) spaceSubscribers.add(subscriber);
|
|
196
209
|
return () => {
|
|
197
210
|
eventSubscribers.delete(subscriber);
|
|
211
|
+
spaceSubscribers.delete(subscriber);
|
|
198
212
|
};
|
|
199
213
|
},
|
|
214
|
+
/**
|
|
215
|
+
* One event of an isolated space, from that space's own connection, entered here as if it
|
|
216
|
+
* had arrived upstream: numbered, coalesced, replayed and fanned out with the host's, so
|
|
217
|
+
* a client keeps one cursor for everything. `directory` is the space's, `spaceId` marks it.
|
|
218
|
+
*/
|
|
219
|
+
injectEvent({ payload, directory, spaceId }) {
|
|
220
|
+
coalescer.push({ envelope: { directory, spaceId }, payload });
|
|
221
|
+
},
|
|
200
222
|
subscribeStatus(subscriber) {
|
|
201
223
|
statusSubscribers.add(subscriber);
|
|
202
224
|
return () => {
|
|
@@ -321,3 +321,38 @@ describe('createGlobalMessageStreamHub', () => {
|
|
|
321
321
|
}
|
|
322
322
|
});
|
|
323
323
|
});
|
|
324
|
+
|
|
325
|
+
describe('events of isolated spaces in the global hub', () => {
|
|
326
|
+
const makeHub = () => createGlobalMessageStreamHub({
|
|
327
|
+
buildOpenCodeUrl: path => `http://127.0.0.1:4096${path}`,
|
|
328
|
+
getOpenCodeAuthHeaders: () => ({}),
|
|
329
|
+
deltaCoalesceWindowMs: 0,
|
|
330
|
+
fetchImpl: async () => createSseResponse({ blocks: [] }),
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
it('delivers an injected space event to subscribers that asked for spaces only, numbered and replayable like the host\'s', () => {
|
|
334
|
+
const hub = makeHub();
|
|
335
|
+
const plain = [];
|
|
336
|
+
const withSpaces = [];
|
|
337
|
+
hub.subscribeEvent(event => plain.push(event));
|
|
338
|
+
hub.subscribeEvent(event => withSpaces.push(event), { spaces: true });
|
|
339
|
+
hub.injectEvent({ payload: { type: 'session.execution.started', data: { sessionID: 's1' } }, directory: '/spaces/a1b2c3d4e5f6/repo', spaceId: 'a1b2c3d4e5f6' });
|
|
340
|
+
expect(plain).toHaveLength(0);
|
|
341
|
+
expect(withSpaces).toHaveLength(1);
|
|
342
|
+
expect(withSpaces[0]).toMatchObject({ spaceId: 'a1b2c3d4e5f6', directory: '/spaces/a1b2c3d4e5f6/repo' });
|
|
343
|
+
expect(withSpaces[0].eventId).toMatch(/^oc-/);
|
|
344
|
+
expect(withSpaces[0].translated()).toEqual([expect.objectContaining({ type: 'session.status' })]);
|
|
345
|
+
expect(JSON.parse(withSpaces[0].serialize())).toMatchObject({ type: 'event', directory: '/spaces/a1b2c3d4e5f6/repo', payload: { type: 'session.execution.started' } });
|
|
346
|
+
hub.injectEvent({ payload: { type: 'session.execution.succeeded', data: { sessionID: 's1' } }, directory: '/spaces/a1b2c3d4e5f6/repo', spaceId: 'a1b2c3d4e5f6' });
|
|
347
|
+
expect(hub.replayAfter(withSpaces[0].eventId).map(entry => entry.eventId)).toEqual([withSpaces[1].eventId]);
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
it('marks a host event with no space, so every subscriber sees it', () => {
|
|
351
|
+
const hub = makeHub();
|
|
352
|
+
const seen = [];
|
|
353
|
+
hub.subscribeEvent(event => seen.push(event.spaceId));
|
|
354
|
+
hub.subscribeEvent(event => seen.push(event.spaceId), { spaces: true });
|
|
355
|
+
hub.injectEvent({ payload: { type: 'session.execution.started', data: { sessionID: 's1' } }, directory: '/home/me', spaceId: null });
|
|
356
|
+
expect(seen).toEqual([null, null]);
|
|
357
|
+
});
|
|
358
|
+
});
|
|
@@ -86,6 +86,8 @@ export function createGlobalMessageStreamWsBridge({
|
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
// Browser clients take the events of isolated spaces too: each frame carries its directory,
|
|
90
|
+
// and a space's directory is one more project directory to the UI.
|
|
89
91
|
const unsubscribeEvent = globalHub.subscribeEvent((event) => {
|
|
90
92
|
const { payload } = event;
|
|
91
93
|
for (const socket of Array.from(clients)) {
|
|
@@ -111,7 +113,7 @@ export function createGlobalMessageStreamWsBridge({
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
});
|
|
114
|
-
});
|
|
116
|
+
}, { spaces: true });
|
|
115
117
|
|
|
116
118
|
const unsubscribeStatus = globalHub.subscribeStatus((status) => {
|
|
117
119
|
if (status.type === 'connect') {
|
|
@@ -144,7 +144,7 @@ export function createUpstreamSseReader({
|
|
|
144
144
|
response,
|
|
145
145
|
});
|
|
146
146
|
await cancelResponseBody(response);
|
|
147
|
-
await waitForReconnectDelay(reconnectDelayMs, signal);
|
|
147
|
+
await waitForReconnectDelay(resolveTimeoutMs(reconnectDelayMs, DEFAULT_UPSTREAM_RECONNECT_DELAY_MS), signal);
|
|
148
148
|
continue;
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -219,7 +219,8 @@ export function createUpstreamSseReader({
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
if (!stopped && !signal?.aborted) {
|
|
222
|
-
|
|
222
|
+
// A function is read before every wait, so a caller can back off between attempts.
|
|
223
|
+
await waitForReconnectDelay(resolveTimeoutMs(reconnectDelayMs, DEFAULT_UPSTREAM_RECONNECT_DELAY_MS), signal);
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
226
|
})().finally(() => {
|
|
@@ -43,7 +43,7 @@ The following functions are exported and used by the web server:
|
|
|
43
43
|
- `applyHunk(directory, filePath, options)`: Apply a single-hunk patch via `git apply`. `options.action` is `stage` (`git apply --cached`), `unstage` (`git apply --cached --reverse`), or `discard` (`git apply --reverse` in the working tree). Inside the index mutation queue, the server verifies that the complete patch exactly matches one current three-context-line hunk for that file and scope, then runs `--check` before applying. Applicability alone cannot prove an unstaged change: old staged or committed hunks can reverse cleanly too. Stale, historical and multi-file patches fail with a refresh error. Temporary patch files are removed on success and failure; hunk content retains CRLF bytes.
|
|
44
44
|
|
|
45
45
|
### Branch Operations
|
|
46
|
-
- `getBranchBase(directory, branch)`: Read a named creation source from reflog. After a rebase, the creation source is no longer a current parent record, so return `null` and let the user choose a base. Explicit per-runtime, directory, and branch choices in the shared UI outrank detection.
|
|
46
|
+
- `getBranchBase(directory, branch)`: Read a named creation source from reflog. After a rebase, the creation source is no longer a current parent record, so return `null` and let the user choose a base. A source that is the branch's own remote copy (`git switch feat` records `Created from refs/remotes/origin/feat`) is not a parent either and also returns `null`. Explicit per-runtime, directory, and branch choices in the shared UI outrank detection.
|
|
47
47
|
- `getBranches(directory)`: Get list of local and remote branches (filtered to active remote branches).
|
|
48
48
|
- `getUnpushedBranchCounts(directory, branchNames)`: Count commits ahead of each locally known upstream for up to five supplied local branches. This reads local refs only and omits branches without an upstream.
|
|
49
49
|
- `createBranch(directory, branchName, options)`: Create and checkout a new branch.
|
|
@@ -3097,6 +3097,21 @@ export function parseBranchCreationSource(reflogText) {
|
|
|
3097
3097
|
return null;
|
|
3098
3098
|
}
|
|
3099
3099
|
|
|
3100
|
+
async function isOwnRemoteCopy(git, source, branchName) {
|
|
3101
|
+
const fullName = await git
|
|
3102
|
+
.raw(['rev-parse', '--symbolic-full-name', source])
|
|
3103
|
+
.then((value) => String(value || '').trim())
|
|
3104
|
+
.catch(() => '');
|
|
3105
|
+
if (!fullName.startsWith('refs/remotes/')) return false;
|
|
3106
|
+
const upstream = await git
|
|
3107
|
+
.raw(['rev-parse', '--symbolic-full-name', `refs/heads/${branchName}@{upstream}`])
|
|
3108
|
+
.then((value) => String(value || '').trim())
|
|
3109
|
+
.catch(() => '');
|
|
3110
|
+
if (upstream && fullName === upstream) return true;
|
|
3111
|
+
// Upstream may be unset; a remote ref with the branch's own name is still its copy.
|
|
3112
|
+
return fullName.slice('refs/remotes/'.length).split('/').slice(1).join('/') === branchName;
|
|
3113
|
+
}
|
|
3114
|
+
|
|
3100
3115
|
/**
|
|
3101
3116
|
* Resolve the branch the given branch was created from, from its reflog.
|
|
3102
3117
|
* Returns { base: null } when git has no authoritative record (clone, detached
|
|
@@ -3130,6 +3145,13 @@ export async function getBranchBase(directory, branch) {
|
|
|
3130
3145
|
return { base: null };
|
|
3131
3146
|
}
|
|
3132
3147
|
|
|
3148
|
+
// `git switch feat` from a remote branch records "Created from
|
|
3149
|
+
// refs/remotes/origin/feat": the branch's own remote copy, not a parent.
|
|
3150
|
+
// Comparing against it hides every pushed commit.
|
|
3151
|
+
if (await isOwnRemoteCopy(git, source, branchName)) {
|
|
3152
|
+
return { base: null };
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3133
3155
|
return { base: source };
|
|
3134
3156
|
}
|
|
3135
3157
|
|
|
@@ -2316,6 +2316,14 @@ describe.runIf(canRunGit())('getRangeDiff', () => {
|
|
|
2316
2316
|
}
|
|
2317
2317
|
});
|
|
2318
2318
|
|
|
2319
|
+
it('does not treat a branch checked out from its own remote copy as its base', async () => {
|
|
2320
|
+
const { repository } = createRepositoryWithRemote();
|
|
2321
|
+
runGit(repository, ['checkout', '-b', 'react', '--track', 'origin/react']);
|
|
2322
|
+
expect(await getBranchBase(repository, 'react')).toEqual({ base: null });
|
|
2323
|
+
runGit(repository, ['checkout', '--no-track', '-b', 'loose', 'origin/react']);
|
|
2324
|
+
expect(await getBranchBase(repository, 'loose')).toEqual({ base: 'origin/react' });
|
|
2325
|
+
});
|
|
2326
|
+
|
|
2319
2327
|
it('asks for a new base after restacking and compares against the selected parent', async () => {
|
|
2320
2328
|
const { repository } = createRepositoryWithRemote();
|
|
2321
2329
|
runGit(repository, ['checkout', '-b', 'child', 'origin/react']);
|