@openchamber/web 1.24.1 → 2.0.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/bin/cli.test.js +22 -0
- package/bin/lib/commands-connect-url.js +3 -8
- package/bin/lib/commands-status.js +5 -0
- package/bin/lib/commands-tunnel.js +3 -0
- package/dist/assets/{CodeMirrorCommentWidgets-DvUH815P.js → CodeMirrorCommentWidgets-hJbl3JX4.js} +1 -1
- package/dist/assets/DiffView-BucGEJYa.js +4 -0
- package/dist/assets/FilesView-CQcaaAVP.js +17 -0
- package/dist/assets/{GitView-Bxuv3dfP.js → GitView-DY4pelsO.js} +4 -4
- package/dist/assets/{GuestAttachDialog-B0u3Q5uO.js → GuestAttachDialog-D6mHDTB2.js} +1 -1
- package/dist/assets/GuestSurfacePane--DJ7rsmY.js +1 -0
- package/dist/assets/{JsonTreeView-BBVPFM5K.js → JsonTreeView-DEXI2NvJ.js} +1 -1
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/LinearIssuesView-BTNc-4dN.js +1 -0
- package/dist/assets/MarkdownImageGallery-wcUUcf8l.js +1 -0
- package/dist/assets/MarkdownRendererImpl-BPe2TVV2.js +12 -0
- package/dist/assets/OnboardingScreen-FJUreEgI.js +1 -0
- package/dist/assets/{PatchDiff-C4rE5k6z.js → PatchDiff-C0oOkKnO.js} +1 -1
- package/dist/assets/PierreDiffViewer-asuSQAsf.js +210 -0
- package/dist/assets/PlanView-DGbasNHP.js +5 -0
- package/dist/assets/PluginPane-DImv8hV2.js +3 -0
- package/dist/assets/SettingsView-DOjuOljf.js +29 -0
- package/dist/assets/SettingsWindow-By4cqnqy.js +1 -0
- package/dist/assets/SubmoduleDiffSummary-C0P2tXLU.js +1 -0
- package/dist/assets/ToolOutputDialog-Cayc-yIM.js +15 -0
- package/dist/assets/ToolPartDiffPreview-B0jmpPQz.js +8 -0
- package/dist/assets/{VirtualizedFileDiff-CZgXWHjU.js → VirtualizedFileDiff-DsOpvWZD.js} +4 -4
- package/dist/assets/{WalkthroughView-wSpED5L4.js → WalkthroughView-CCakjyn9.js} +2 -2
- package/dist/assets/appThemeRegistry-Bw5oTm41.js +1 -0
- package/dist/assets/{commitAndPush-DZnzlhvc.js → commitAndPush-sGEelpjh.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-VYnT_A2h.js → computeVirtualFileMetrics-B-4aLf4A.js} +1 -1
- package/dist/assets/de-CD9utsNj.js +10 -0
- package/dist/assets/es-NNum2rX8.js +16 -0
- package/dist/assets/fr-CJLGmduQ.js +14 -0
- package/dist/assets/index-B6r0Kv-B.js +1 -0
- package/dist/assets/index-DjGPR5vW.js +41 -0
- package/dist/assets/index-fCXJ-8Qt.css +1 -0
- package/dist/assets/{isDiffPlainText-ImDG3Uhg.js → isDiffPlainText-Ok-kgtJA.js} +1 -1
- package/dist/assets/{isFilePlainText-D_YDVYDb.js → isFilePlainText-0dLnkYm8.js} +1 -1
- package/dist/assets/ja-BuddHNi6.js +16 -0
- package/dist/assets/ko-BrwMbHmf.js +16 -0
- package/dist/assets/main-CjXBM_Xe.js +2 -0
- package/dist/assets/main-CxVyUDU_.js +896 -0
- package/dist/assets/markdownCore-B6PpX409.js +5 -0
- package/dist/assets/miniChat-DZ3OAeLN.js +2 -0
- package/dist/assets/mobile-CH0LOIF-.js +2 -0
- package/dist/assets/{patchFileDiff-DDQ6Rq5e.js → patchFileDiff-BFRGKaGH.js} +3 -3
- package/dist/assets/pl-BwN4TNlP.js +16 -0
- package/dist/assets/pt-BR-BhMtownO.js +16 -0
- package/dist/assets/renderElectronMiniChatApp-CB1uLYvh.js +2 -0
- package/dist/assets/renderMobileApp-nQ4sjQtb.js +25 -0
- package/dist/assets/runtimeEndpointReset-9ZGlXU4J.js +27 -0
- package/dist/assets/scheduledTasksApi-6DsL_SwM.js +1 -0
- package/dist/assets/{shikiHighlight-1imXsir9.js → shikiHighlight-CocY80VR.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-Dgqc63LZ.js → textMateThemeFromAppTheme-CF77r8FA.js} +1 -1
- package/dist/assets/tr-DRzvqMdi.js +7 -0
- package/dist/assets/uk-b2aYOSNh.js +16 -0
- package/dist/assets/useAppFontEffects-Dc5nTHi8.js +7337 -0
- package/dist/assets/useInlineCommentController-Dbza5c8l.js +2 -0
- package/dist/assets/useRootScrollLock-CSCLv396.js +2 -0
- package/dist/assets/{vendor-codemirror-language-data-BDyxuqK4.js → vendor-codemirror-language-data-CkmYWcRI.js} +2 -2
- package/dist/assets/vendor-cron-parser-CjvYVigk.js +2 -0
- package/dist/assets/vendor-katex-Cp579UoJ.css +1 -0
- package/dist/assets/vendor-opencode-client-_BAHQo4R.js +12 -0
- package/dist/assets/{vendor-remixicon-react-BDmGmFCA.js → vendor-remixicon-react-D6dZ0UwF.js} +1 -1
- package/dist/assets/{vendor-zod-fZppILAM.js → vendor-zod-Gea9uBlY.js} +4 -4
- package/dist/assets/{web-components-D7FinaeH.js → web-components-nsStrYq9.js} +2 -2
- package/dist/assets/zh-CN-DZeUThm_.js +16 -0
- package/dist/assets/zh-TW-2fRE7uc6.js +16 -0
- package/dist/index.html +15 -7
- package/dist/mini-chat.html +7 -5
- package/dist/mobile.html +7 -5
- package/package.json +8 -7
- package/server/index.d.ts +1 -0
- package/server/index.js +248 -90
- package/server/lib/agent-tool/DOCUMENTATION.md +45 -15
- package/server/lib/agent-tool/runtime.js +189 -61
- package/server/lib/agent-tool/runtime.test.js +229 -75
- package/server/lib/browser-control/DOCUMENTATION.md +37 -2
- package/server/lib/browser-control/provider.js +217 -0
- package/server/lib/browser-control/provider.test.js +251 -0
- package/server/lib/context-obligatory/runtime.js +61 -50
- package/server/lib/context-obligatory/runtime.test.js +62 -162
- package/server/lib/event-stream/DOCUMENTATION.md +12 -1
- package/server/lib/event-stream/delta-coalescer.js +0 -0
- package/server/lib/event-stream/delta-coalescer.test.js +68 -57
- package/server/lib/event-stream/directory-ws-bridge.js +1 -1
- package/server/lib/event-stream/global-hub.js +10 -1
- package/server/lib/event-stream/global-hub.test.js +27 -26
- package/server/lib/event-stream/index.js +6 -0
- package/server/lib/event-stream/protocol.js +26 -19
- package/server/lib/event-stream/protocol.test.js +18 -7
- package/server/lib/event-stream/rebind.test.js +5 -5
- package/server/lib/event-stream/runtime.test.js +17 -15
- package/server/lib/event-stream/translate-v2.js +313 -0
- package/server/lib/event-stream/translate-v2.test.js +209 -0
- package/server/lib/event-stream/upstream-reader.test.js +16 -16
- package/server/lib/fs/DOCUMENTATION.md +6 -3
- package/server/lib/fs/byte-range.js +35 -0
- package/server/lib/fs/byte-range.test.js +31 -0
- package/server/lib/fs/routes.js +103 -46
- package/server/lib/fs/routes.test.js +239 -18
- package/server/lib/git/DOCUMENTATION.md +2 -2
- package/server/lib/git/service.js +106 -9
- package/server/lib/git/service.test.js +18 -0
- package/server/lib/github/DOCUMENTATION.md +1 -1
- package/server/lib/github/pr-status.js +22 -2
- package/server/lib/github/pr-status.test.js +27 -14
- package/server/lib/guests/DOCUMENTATION.md +13 -0
- package/server/lib/guests/catalog.js +12 -0
- package/server/lib/guests/catalog.test.js +33 -0
- package/server/lib/guests/routes.js +10 -1
- package/server/lib/guests/service.js +192 -14
- package/server/lib/guests/service.test.js +201 -1
- package/server/lib/guests/surface.js +630 -0
- package/server/lib/guests/surface.test.js +486 -0
- package/server/lib/markdown-image-grants/routes.js +18 -5
- package/server/lib/markdown-image-grants/routes.test.js +9 -6
- package/server/lib/message-queue/DOCUMENTATION.md +36 -22
- package/server/lib/message-queue/runtime.js +170 -100
- package/server/lib/message-queue/runtime.test.js +184 -82
- package/server/lib/notifications/DOCUMENTATION.md +28 -0
- package/server/lib/notifications/control-stream.http.test.js +68 -0
- package/server/lib/notifications/emitter-runtime.js +15 -0
- package/server/lib/notifications/emitter-runtime.test.js +32 -0
- package/server/lib/notifications/push-runtime.js +5 -1
- package/server/lib/notifications/push-runtime.test.js +2 -2
- package/server/lib/notifications/routes.js +5 -0
- package/server/lib/notifications/runtime.js +115 -26
- package/server/lib/notifications/template-runtime.js +13 -15
- package/server/lib/notifications/template-runtime.test.js +16 -9
- package/server/lib/notifications/trigger-runtime.test.js +187 -0
- package/server/lib/openchamber-control/DOCUMENTATION.md +10 -0
- package/server/lib/openchamber-control/actions.js +3 -2
- package/server/lib/openchamber-control/error.js +1 -1
- package/server/lib/openchamber-control/file-open.js +59 -0
- package/server/lib/openchamber-control/file-open.test.js +57 -0
- package/server/lib/openchamber-control/routes.test.js +12 -0
- package/server/lib/openchamber-control/service.js +102 -49
- package/server/lib/openchamber-control/service.test.js +84 -44
- package/server/lib/openchamber-sessions/archive-store.js +224 -0
- package/server/lib/openchamber-sessions/archive-store.test.js +187 -0
- package/server/lib/openchamber-sessions/opencode-client.js +22 -0
- package/server/lib/openchamber-sessions/routes.js +398 -328
- package/server/lib/openchamber-sessions/routes.test.js +786 -700
- package/server/lib/openchamber-sessions/session-metadata-store.js +285 -0
- package/server/lib/openchamber-sessions/session-metadata-store.test.js +259 -0
- package/server/lib/opencode/DOCUMENTATION.md +450 -30
- package/server/lib/opencode/agents.js +233 -327
- package/server/lib/opencode/auth.js +41 -44
- package/server/lib/opencode/auth.test.js +92 -0
- package/server/lib/opencode/bootstrap-runtime.js +1 -0
- package/server/lib/opencode/cli-upgrade.d.ts +4 -0
- package/server/lib/opencode/cli-upgrade.js +18 -0
- package/server/lib/opencode/cli-upgrade.test.js +36 -0
- package/server/lib/opencode/commands.js +164 -145
- package/server/lib/opencode/compatibility.d.ts +16 -0
- package/server/lib/opencode/compatibility.js +88 -0
- package/server/lib/opencode/compatibility.test.js +62 -0
- package/server/lib/opencode/config-entity-routes.js +58 -29
- package/server/lib/opencode/config-entity-v2.test.js +290 -0
- package/server/lib/opencode/config-mutation-response.js +17 -7
- package/server/lib/opencode/config-mutation-response.test.js +4 -7
- package/server/lib/opencode/config-paths.test.js +2 -2
- package/server/lib/opencode/config-v2.d.ts +183 -0
- package/server/lib/opencode/config-v2.js +801 -0
- package/server/lib/opencode/config-v2.test.js +466 -0
- package/server/lib/opencode/credential-db.js +144 -0
- package/server/lib/opencode/credential-db.test.js +104 -0
- package/server/lib/opencode/env-runtime.js +48 -9
- package/server/lib/opencode/env-runtime.test.js +45 -0
- package/server/lib/opencode/feature-routes-runtime.js +15 -5
- package/server/lib/opencode/lifecycle-process.test.js +7 -4
- package/server/lib/opencode/lifecycle.js +85 -30
- package/server/lib/opencode/lifecycle.test.js +80 -8
- package/server/lib/opencode/login-shell-env.js +27 -0
- package/server/lib/opencode/managed-config-file.js +119 -0
- package/server/lib/opencode/managed-config-file.test.js +152 -0
- package/server/lib/opencode/managed-plugin-config.js +33 -13
- package/server/lib/opencode/mcp.js +43 -149
- package/server/lib/opencode/network-runtime.js +6 -7
- package/server/lib/opencode/openchamber-routes.test.js +0 -1
- package/server/lib/opencode/plugin-routes.js +3 -3
- package/server/lib/opencode/plugin-routes.test.js +6 -24
- package/server/lib/opencode/plugins.js +91 -40
- package/server/lib/opencode/plugins.test.js +28 -15
- package/server/lib/opencode/providers.js +63 -83
- package/server/lib/opencode/providers.test.js +128 -59
- package/server/lib/opencode/proxy-agent-wiring.test.js +4 -2
- package/server/lib/opencode/proxy.js +179 -129
- package/server/lib/opencode/pwa-manifest-routes.js +4 -2
- package/server/lib/opencode/pwa-manifest-routes.test.js +3 -2
- package/server/lib/opencode/response-envelope.js +14 -0
- package/server/lib/opencode/response-envelope.test.js +23 -0
- package/server/lib/opencode/routes-upgrade.test.js +73 -116
- package/server/lib/opencode/routes.js +121 -428
- package/server/lib/opencode/server-utils-runtime.js +10 -4
- package/server/lib/opencode/session-activity.js +78 -0
- package/server/lib/opencode/session-runtime.js +79 -0
- package/server/lib/opencode/session-runtime.test.js +43 -0
- package/server/lib/opencode/settings-helpers.js +9 -9
- package/server/lib/opencode/settings-helpers.test.js +7 -12
- package/server/lib/opencode/settings-registry.json +6 -8
- package/server/lib/opencode/settings-runtime.js +18 -1
- package/server/lib/opencode/settings-runtime.test.js +31 -2
- package/server/lib/opencode/shared.js +54 -22
- package/server/lib/opencode/shared.test.js +8 -4
- package/server/lib/opencode/shutdown-runtime.js +54 -7
- package/server/lib/opencode/shutdown-runtime.test.js +224 -30
- package/server/lib/opencode/skill-routes.js +23 -24
- package/server/lib/opencode/skills.js +7 -5
- package/server/lib/opencode/tunnel-wiring-runtime.js +2 -1
- package/server/lib/opencode/upgrade-capability.test.js +1 -1
- package/server/lib/opencode/v1-migration-topup.js +288 -0
- package/server/lib/opencode/v1-migration-topup.test.js +266 -0
- package/server/lib/opencode/v2-install.d.ts +8 -0
- package/server/lib/opencode/v2-install.js +158 -0
- package/server/lib/opencode/v2-install.test.js +124 -0
- package/server/lib/opencode/watcher.js +10 -3
- package/server/lib/opencode/watcher.test.js +17 -21
- package/server/lib/opencode/websearch-config.js +66 -0
- package/server/lib/permission-auto-accept/runtime.js +38 -22
- package/server/lib/permission-auto-accept/runtime.test.js +39 -17
- package/server/lib/projects/project-config.js +2 -2
- package/server/lib/quota/DOCUMENTATION.md +4 -0
- package/server/lib/quota/providers/xai.js +4 -4
- package/server/lib/realtime-proxy-terminal.test.js +150 -0
- package/server/lib/realtime-proxy.js +2 -0
- package/server/lib/relay/tunnel-host.js +4 -1
- package/server/lib/relay/tunnel-host.test.js +7 -0
- package/server/lib/routing/DOCUMENTATION.md +52 -19
- package/server/lib/routing/defaults.js +23 -6
- package/server/lib/routing/jev.js +17 -7
- package/server/lib/routing/routes.http.test.js +68 -33
- package/server/lib/routing/routes.js +65 -22
- package/server/lib/routing/runtime.js +145 -48
- package/server/lib/routing/runtime.test.js +79 -55
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +4 -0
- package/server/lib/scheduled-tasks/issue-2710-double-execution.test.js +51 -46
- package/server/lib/scheduled-tasks/runtime.js +83 -76
- package/server/lib/scheduled-tasks/runtime.test.js +67 -1
- package/server/lib/session-assist/DOCUMENTATION.md +8 -3
- package/server/lib/session-assist/context.js +122 -46
- package/server/lib/session-assist/context.test.js +117 -49
- package/server/lib/session-assist/runtime.js +52 -22
- package/server/lib/session-assist/runtime.test.js +145 -173
- package/server/lib/session-goal/DOCUMENTATION.md +23 -15
- package/server/lib/session-goal/create.js +9 -12
- package/server/lib/session-goal/create.test.js +27 -28
- package/server/lib/session-goal/runtime.js +164 -77
- package/server/lib/session-goal/runtime.test.js +271 -519
- package/server/lib/session-knowledge/DOCUMENTATION.md +5 -0
- package/server/lib/session-knowledge/runtime.js +59 -41
- package/server/lib/session-knowledge/runtime.test.js +90 -20
- package/server/lib/small-model/DOCUMENTATION.md +154 -196
- package/server/lib/small-model/client.js +113 -0
- package/server/lib/small-model/index.js +296 -158
- package/server/lib/small-model/index.test.js +423 -256
- package/server/lib/small-model/routes.js +1 -1
- package/server/lib/spaces/DOCUMENTATION.md +807 -0
- package/server/lib/spaces/code-in-bait.js +185 -0
- package/server/lib/spaces/code-in.js +641 -0
- package/server/lib/spaces/code-in.test.js +1048 -0
- package/server/lib/spaces/errors.js +8 -0
- package/server/lib/spaces/exec-http.js +94 -0
- package/server/lib/spaces/gatekeeper-channel.js +202 -0
- package/server/lib/spaces/gatekeeper-channel.test.js +215 -0
- package/server/lib/spaces/gatekeeper-program.cjs +914 -0
- package/server/lib/spaces/gatekeeper-program.test.js +1391 -0
- package/server/lib/spaces/hardening.js +457 -0
- package/server/lib/spaces/hardening.test.js +368 -0
- package/server/lib/spaces/host-git.js +127 -0
- package/server/lib/spaces/host-git.test.js +137 -0
- package/server/lib/spaces/labels.js +234 -0
- package/server/lib/spaces/labels.test.js +219 -0
- package/server/lib/spaces/layout.js +184 -0
- package/server/lib/spaces/layout.test.js +30 -0
- package/server/lib/spaces/manager.js +82 -0
- package/server/lib/spaces/manager.test.js +114 -0
- package/server/lib/spaces/places/code-in.docker.live.test.js +216 -0
- package/server/lib/spaces/places/contract-suite.js +156 -0
- package/server/lib/spaces/places/contract.docker.live.test.js +7 -0
- package/server/lib/spaces/places/contract.test.js +6 -0
- package/server/lib/spaces/places/docker-engine.js +126 -0
- package/server/lib/spaces/places/docker-live-support.js +202 -0
- package/server/lib/spaces/places/docker-tools.js +186 -0
- package/server/lib/spaces/places/docker.js +587 -0
- package/server/lib/spaces/places/docker.test.js +1610 -0
- package/server/lib/spaces/places/escape-suite.js +1018 -0
- package/server/lib/spaces/places/escape.docker.live.test.js +7 -0
- package/server/lib/spaces/places/fake-docker.js +375 -0
- package/server/lib/spaces/places/memory-place.js +103 -0
- package/server/lib/spaces/places/packed.docker.live.test.js +77 -0
- package/server/lib/spaces/places/registry.js +43 -0
- package/server/lib/spaces/places/registry.test.js +50 -0
- package/server/lib/spaces/places/server.docker.live.test.js +225 -0
- package/server/lib/spaces/run-command.js +261 -0
- package/server/lib/spaces/run-command.test.js +396 -0
- package/server/lib/spaces/space-server.js +190 -0
- package/server/lib/spaces/space-server.test.js +335 -0
- package/server/lib/spaces/tools-filler.js +82 -0
- package/server/lib/spaces/tools-filler.test.js +148 -0
- package/server/lib/spaces/tools-pack.js +49 -0
- package/server/lib/spaces/tools-pack.test.js +57 -0
- package/server/lib/spaces/tools.js +137 -0
- package/server/lib/spaces/tools.test.js +153 -0
- package/server/lib/terminal/DOCUMENTATION.md +21 -2
- package/server/lib/terminal/runtime.js +10 -3
- package/server/lib/terminal/runtime.test.js +22 -0
- package/server/lib/terminal/shutdown.js +106 -0
- package/server/lib/terminal/shutdown.test.js +84 -0
- package/server/lib/tts/openai-sdk.js +11 -0
- package/server/lib/tts/service.js +7 -5
- package/server/lib/tts/service.test.js +78 -0
- package/server/lib/tts/stt.js +3 -2
- package/server/lib/tunnels/DOCUMENTATION.md +2 -0
- package/server/lib/tunnels/routes.js +7 -0
- package/server/lib/tunnels/routes.test.js +55 -0
- package/server/lib/ui-auth/ui-auth.js +38 -2
- package/server/lib/ui-auth/ui-auth.test.js +42 -0
- package/server/lib/ui-auth/ui-passkeys.js +12 -10
- package/server/lib/walkthrough/DOCUMENTATION.md +10 -1
- package/server/lib/walkthrough/pull-request.js +61 -8
- package/server/lib/walkthrough/pull-request.test.js +54 -1
- package/server/lib/walkthrough/routes.js +20 -0
- package/server/lib/walkthrough/routes.test.js +19 -0
- package/server/opencode-proxy.test.js +190 -166
- package/server/opencode-worktree-readiness.test.js +5 -4
- package/dist/assets/DiffView-DkC3xlRJ.js +0 -4
- package/dist/assets/FilesView-D0bM9FVB.js +0 -13
- package/dist/assets/LinearIssuesView-UI1FcSC8.js +0 -1
- package/dist/assets/MarkdownImageGallery-CUJxH8Le.js +0 -1
- package/dist/assets/MarkdownRendererImpl-D5BZOg8X.js +0 -12
- package/dist/assets/OnboardingScreen-5Gou9cGD.js +0 -1
- package/dist/assets/PierreDiffViewer-ByRVu6ss.js +0 -161
- package/dist/assets/PlanView-u2yi5XGJ.js +0 -5
- package/dist/assets/PluginPane-QxjsKYeO.js +0 -3
- package/dist/assets/SettingsView-Fo5ZqMaT.js +0 -29
- package/dist/assets/SettingsWindow-HVDVANjJ.js +0 -1
- package/dist/assets/SubmoduleDiffSummary-D3hzkybB.js +0 -1
- package/dist/assets/ToolOutputDialog-3J6IRayW.js +0 -15
- package/dist/assets/ToolPartDiffPreview-DarxPjSd.js +0 -8
- package/dist/assets/appThemeRegistry-Cf8KitzT.js +0 -1
- package/dist/assets/de-BM_8EDD3.js +0 -10
- package/dist/assets/es-CxZjlqpo.js +0 -16
- package/dist/assets/fr-VCixCnMW.js +0 -14
- package/dist/assets/index-3U4CtS9b.js +0 -1
- package/dist/assets/index-B9Hvzjwl.css +0 -1
- package/dist/assets/index-DLHQogv8.js +0 -40
- package/dist/assets/ja-CZ5k_GyD.js +0 -16
- package/dist/assets/ko-7YM3A1Xh.js +0 -16
- package/dist/assets/main-CycplCph.js +0 -2
- package/dist/assets/main-DFYTCx5o.js +0 -896
- package/dist/assets/markdownCore-DHvqMxPn.js +0 -5
- package/dist/assets/miniChat-DIQKfY2V.js +0 -2
- package/dist/assets/mobile-BMwz5q-m.js +0 -2
- package/dist/assets/pl-BcgDO_w5.js +0 -16
- package/dist/assets/pt-BR-CU2u_1q5.js +0 -16
- package/dist/assets/renderElectronMiniChatApp-3_d6g6CU.js +0 -2
- package/dist/assets/renderMobileApp-D0Y8DtkA.js +0 -25
- package/dist/assets/runtimeEndpointReset-DhC3REb2.js +0 -25
- package/dist/assets/scheduledTasksApi-D8pq6gQz.js +0 -1
- package/dist/assets/tr-DuYhOzNe.js +0 -7
- package/dist/assets/uk-Cuk7-uvq.js +0 -16
- package/dist/assets/useAppFontEffects-BItUWdo4.js +0 -7333
- package/dist/assets/useInlineCommentController-CkbKsm7m.js +0 -2
- package/dist/assets/useRootScrollLock-vmzxZjWA.js +0 -2
- package/dist/assets/vendor-cron-parser-CUcP7OfX.js +0 -2
- package/dist/assets/vendor-opencode-sdk-BJ73u-bH.js +0 -7
- package/dist/assets/zh-CN-CUWoiRHd.js +0 -16
- package/dist/assets/zh-TW-CQ8EBSBN.js +0 -16
- package/server/lib/opencode/mcp-oauth-callback.test.js +0 -111
- package/server/lib/routing/feature-flag.js +0 -11
- package/server/lib/small-model/call.js +0 -820
- package/server/lib/small-model/call.test.js +0 -1110
- package/server/lib/small-model/catalog.js +0 -13
- package/server/lib/small-model/resolve.js +0 -131
- package/server/lib/small-model/resolve.test.js +0 -197
- package/server/lib/small-model/runtime-providers.js +0 -164
- package/server/lib/small-model/runtime-providers.test.js +0 -118
- package/server/lib/system-prompt/DOCUMENTATION.md +0 -36
- package/server/lib/system-prompt/runtime.js +0 -49
- package/server/lib/system-prompt/runtime.test.js +0 -76
- package/server/lib/walkthrough/reproduce-2607.test.js +0 -148
- /package/dist/assets/{vendor-katex-k3Ppq1Ha.js → vendor-katex-CHD9BdDO.js} +0 -0
|
@@ -33,12 +33,19 @@ afterEach(() => {
|
|
|
33
33
|
*/
|
|
34
34
|
const createOpenCode = () => {
|
|
35
35
|
const state = {
|
|
36
|
-
|
|
36
|
+
// `/api/session/active` lists only running sessions; an absent id is idle.
|
|
37
|
+
active: {},
|
|
38
|
+
// Subagent sessions per parent, as `GET /api/session?parentID=` lists them.
|
|
39
|
+
children: {},
|
|
37
40
|
tail: [],
|
|
38
41
|
commands: [],
|
|
39
42
|
sent: [],
|
|
43
|
+
switched: [],
|
|
40
44
|
failNext: null,
|
|
41
45
|
};
|
|
46
|
+
// v2 wraps `/api/*` payloads in `{ location, data }`; a message page is
|
|
47
|
+
// `{ data, cursor }` and lists newest first.
|
|
48
|
+
const wrapped = (data) => Response.json({ location: { directory: DIRECTORY }, data });
|
|
42
49
|
const fetchImpl = vi.fn(async (url, init = {}) => {
|
|
43
50
|
const { pathname } = new URL(url);
|
|
44
51
|
const method = init.method ?? 'GET';
|
|
@@ -46,19 +53,29 @@ const createOpenCode = () => {
|
|
|
46
53
|
state.failNext = null;
|
|
47
54
|
return new Response('boom', { status: 500 });
|
|
48
55
|
}
|
|
49
|
-
|
|
50
|
-
if (pathname
|
|
51
|
-
if (pathname === '/
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
// Real shape: `{ data }` without a `location`, unlike directory-scoped routes.
|
|
57
|
+
if (pathname === '/api/session/active') return Response.json({ data: state.active });
|
|
58
|
+
if (pathname === '/api/session' && method === 'GET') {
|
|
59
|
+
const parentID = new URL(url).searchParams.get('parentID');
|
|
60
|
+
return Response.json({ data: (state.children[parentID] ?? []).map((id) => ({ id, parentID })), cursor: {} });
|
|
61
|
+
}
|
|
62
|
+
if (pathname.endsWith('/message')) return Response.json({ data: state.tail, cursor: {} });
|
|
63
|
+
if (pathname === '/api/command') return wrapped(state.commands);
|
|
64
|
+
if (method === 'POST' && (pathname.endsWith('/model') || pathname.endsWith('/agent'))) {
|
|
65
|
+
// Kept apart from `sent`: switching the session is not a message.
|
|
66
|
+
state.switched.push({ path: pathname, body: JSON.parse(init.body) });
|
|
54
67
|
return new Response(null, { status: 204 });
|
|
55
68
|
}
|
|
69
|
+
if (method === 'POST' && (pathname.endsWith('/prompt') || pathname.endsWith('/command') || pathname.endsWith('/synthetic'))) {
|
|
70
|
+
state.sent.push({ path: pathname, body: JSON.parse(init.body) });
|
|
71
|
+
return wrapped({ id: `msg_${state.sent.length}` });
|
|
72
|
+
}
|
|
56
73
|
return new Response('not found', { status: 404 });
|
|
57
74
|
});
|
|
58
75
|
return { state, fetchImpl };
|
|
59
76
|
};
|
|
60
77
|
|
|
61
|
-
const createRuntime = ({ dataDir = makeDataDir(), openCode = createOpenCode(), knowledge = null, retryDelayMs,
|
|
78
|
+
const createRuntime = ({ dataDir = makeDataDir(), openCode = createOpenCode(), knowledge = null, retryDelayMs, resolveAutoSelection, now } = {}) => {
|
|
62
79
|
let eventHandler = () => {};
|
|
63
80
|
let statusHandler = () => {};
|
|
64
81
|
const broadcasts = [];
|
|
@@ -79,7 +96,8 @@ const createRuntime = ({ dataDir = makeDataDir(), openCode = createOpenCode(), k
|
|
|
79
96
|
abortHoldMs: 50,
|
|
80
97
|
};
|
|
81
98
|
if (retryDelayMs) options.retryDelayMs = retryDelayMs;
|
|
82
|
-
if (
|
|
99
|
+
if (resolveAutoSelection) options.resolveAutoSelection = resolveAutoSelection;
|
|
100
|
+
if (now) options.now = now;
|
|
83
101
|
const runtime = createMessageQueueRuntime(options);
|
|
84
102
|
return {
|
|
85
103
|
runtime,
|
|
@@ -87,7 +105,8 @@ const createRuntime = ({ dataDir = makeDataDir(), openCode = createOpenCode(), k
|
|
|
87
105
|
dataDir,
|
|
88
106
|
broadcasts,
|
|
89
107
|
promptSent,
|
|
90
|
-
|
|
108
|
+
// The hub hands server-side subscribers already-translated events.
|
|
109
|
+
emit: (payload, directory = DIRECTORY) => eventHandler({ payload, directory, translated: () => [payload] }),
|
|
91
110
|
connect: () => statusHandler({ type: 'connect' }),
|
|
92
111
|
};
|
|
93
112
|
};
|
|
@@ -97,13 +116,11 @@ const settle = async (ms = 30) => {
|
|
|
97
116
|
};
|
|
98
117
|
|
|
99
118
|
describe('auto routing', () => {
|
|
100
|
-
it('
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
106
|
-
const { runtime, openCode, emit } = createRuntime({ resolvePromptBody });
|
|
119
|
+
it('switches a queued prompt and a queued command onto the routed model and agent', async () => {
|
|
120
|
+
const resolveAutoSelection = vi.fn(async ({ model }) => (model?.id === 'auto'
|
|
121
|
+
? { model: { providerID: 'openai', id: 'gpt-6-astra' }, agent: 'plan', decision: {} }
|
|
122
|
+
: null));
|
|
123
|
+
const { runtime, openCode, emit } = createRuntime({ resolveAutoSelection });
|
|
107
124
|
runtime.start();
|
|
108
125
|
openCode.state.statuses = { [SESSION]: { type: 'busy' } };
|
|
109
126
|
openCode.state.commands = [{ name: 'review', template: 'Review $ARGUMENTS' }];
|
|
@@ -117,12 +134,16 @@ describe('auto routing', () => {
|
|
|
117
134
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
118
135
|
await settle();
|
|
119
136
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
137
|
+
// v2 carries no model in a prompt body: the session is switched first.
|
|
138
|
+
const switched = openCode.state.switched.filter((entry) => entry.path.endsWith('/model'));
|
|
139
|
+
expect(switched.map((entry) => entry.body.model)).toEqual([
|
|
140
|
+
{ providerID: 'openai', id: 'gpt-6-astra' },
|
|
141
|
+
{ providerID: 'openai', id: 'gpt-6-astra' },
|
|
123
142
|
]);
|
|
124
|
-
expect(
|
|
125
|
-
|
|
143
|
+
expect(openCode.state.switched.filter((entry) => entry.path.endsWith('/agent')).map((entry) => entry.body.agent))
|
|
144
|
+
.toEqual(['plan', 'plan']);
|
|
145
|
+
expect(resolveAutoSelection).toHaveBeenCalledTimes(2);
|
|
146
|
+
expect(resolveAutoSelection.mock.calls[0][0]).toMatchObject({ sessionId: SESSION, directory: DIRECTORY, requestText: 'plain' });
|
|
126
147
|
});
|
|
127
148
|
});
|
|
128
149
|
|
|
@@ -171,24 +192,22 @@ describe('message queue runtime', () => {
|
|
|
171
192
|
it('delivers the head of the queue when the session goes idle, in order', async () => {
|
|
172
193
|
const { runtime, openCode, emit, promptSent, broadcasts } = createRuntime();
|
|
173
194
|
runtime.start();
|
|
174
|
-
openCode.state.
|
|
195
|
+
openCode.state.active = { [SESSION]: { type: 'running' } };
|
|
175
196
|
|
|
176
197
|
await runtime.enqueue(SESSION, DIRECTORY, item({ content: 'first', text: 'first' }));
|
|
177
198
|
await runtime.enqueue(SESSION, DIRECTORY, item({ content: 'second', text: 'second' }));
|
|
178
199
|
await settle();
|
|
179
200
|
expect(openCode.state.sent).toHaveLength(0);
|
|
180
201
|
|
|
181
|
-
openCode.state.
|
|
202
|
+
openCode.state.active = {};
|
|
182
203
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
183
204
|
await settle();
|
|
184
205
|
|
|
185
206
|
expect(openCode.state.sent).toHaveLength(1);
|
|
186
|
-
expect(openCode.state.sent[0].path).toBe(`/session/${SESSION}/
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
parts: [{ type: 'text', text: 'first' }],
|
|
191
|
-
});
|
|
207
|
+
expect(openCode.state.sent[0].path).toBe(`/api/session/${SESSION}/prompt`);
|
|
208
|
+
// v2 selects model and agent on the session, so the prompt carries text
|
|
209
|
+
// and attachments only.
|
|
210
|
+
expect(openCode.state.sent[0].body).toEqual({ text: 'first' });
|
|
192
211
|
expect(promptSent).toEqual([SESSION]);
|
|
193
212
|
expect(runtime.sessionSnapshot(SESSION).items.map((entry) => entry.content)).toEqual(['second']);
|
|
194
213
|
// Clients learned about the in-flight item and then the removal.
|
|
@@ -205,10 +224,32 @@ describe('message queue runtime', () => {
|
|
|
205
224
|
expect(runtime.sessionSnapshot(SESSION).items).toEqual([]);
|
|
206
225
|
});
|
|
207
226
|
|
|
208
|
-
it('
|
|
227
|
+
it('waits for a background subagent before sending the queued message', async () => {
|
|
209
228
|
const { runtime, openCode, emit } = createRuntime();
|
|
210
229
|
runtime.start();
|
|
211
|
-
|
|
230
|
+
// The parent paused: it is idle while its background subagent works.
|
|
231
|
+
openCode.state.children = { [SESSION]: ['ses_child'] };
|
|
232
|
+
openCode.state.active = { ses_child: { type: 'running' } };
|
|
233
|
+
|
|
234
|
+
await runtime.enqueue(SESSION, DIRECTORY, item({ content: 'next', text: 'next' }));
|
|
235
|
+
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
236
|
+
await settle();
|
|
237
|
+
expect(openCode.state.sent).toHaveLength(0);
|
|
238
|
+
|
|
239
|
+
// The subagent finished and OpenCode ran the parent again with its result.
|
|
240
|
+
openCode.state.active = {};
|
|
241
|
+
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'busy' } } });
|
|
242
|
+
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
243
|
+
await settle();
|
|
244
|
+
expect(openCode.state.sent).toHaveLength(1);
|
|
245
|
+
expect(openCode.state.sent[0].body).toEqual({ text: 'next' });
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it('does not send into a running turn even when the status event says idle', async () => {
|
|
249
|
+
const { runtime, openCode, emit } = createRuntime({ now: () => 10_000 });
|
|
250
|
+
runtime.start();
|
|
251
|
+
// Live unfinished turn: created after this runtime started.
|
|
252
|
+
openCode.state.tail = [{ type: 'assistant', time: { created: 10_001 } }];
|
|
212
253
|
await runtime.enqueue(SESSION, DIRECTORY, item());
|
|
213
254
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
214
255
|
await settle();
|
|
@@ -216,17 +257,31 @@ describe('message queue runtime', () => {
|
|
|
216
257
|
|
|
217
258
|
// The reply completes: that alone drains the queue (a missed idle event
|
|
218
259
|
// must not strand it).
|
|
219
|
-
openCode.state.tail = [{
|
|
220
|
-
emit({ type: 'message.updated', properties: { info: { role: 'assistant', sessionID: SESSION, time: { created:
|
|
260
|
+
openCode.state.tail = [{ type: 'assistant', time: { created: 10_001, completed: 10_002 } }];
|
|
261
|
+
emit({ type: 'message.updated', properties: { info: { role: 'assistant', sessionID: SESSION, time: { created: 10_001, completed: 10_002 } } } });
|
|
262
|
+
await settle();
|
|
263
|
+
expect(openCode.state.sent).toHaveLength(1);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
it('delivers past an unfinished tail that predates this runtime (dead pre-restart run)', async () => {
|
|
267
|
+
const { runtime, openCode, emit } = createRuntime({ now: () => 10_000 });
|
|
268
|
+
runtime.start();
|
|
269
|
+
// Assistant reply interrupted by a server restart: unfinished, but older
|
|
270
|
+
// than this runtime — no completion event will ever arrive for it, so it
|
|
271
|
+
// must not block a restored queue forever.
|
|
272
|
+
openCode.state.tail = [{ type: 'assistant', time: { created: 1 } }];
|
|
273
|
+
await runtime.enqueue(SESSION, DIRECTORY, item());
|
|
274
|
+
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
221
275
|
await settle();
|
|
222
276
|
expect(openCode.state.sent).toHaveLength(1);
|
|
277
|
+
expect(openCode.state.sent[0].path).toBe(`/api/session/${SESSION}/prompt`);
|
|
223
278
|
});
|
|
224
279
|
|
|
225
280
|
it('treats an unreachable OpenCode as unknown, not idle', async () => {
|
|
226
281
|
const { runtime, openCode, emit } = createRuntime({ retryDelayMs: () => 10 });
|
|
227
282
|
runtime.start();
|
|
228
283
|
await runtime.enqueue(SESSION, DIRECTORY, item());
|
|
229
|
-
openCode.state.failNext = /\/session\/
|
|
284
|
+
openCode.state.failNext = /\/api\/session\/active$/;
|
|
230
285
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
231
286
|
await settle(5);
|
|
232
287
|
expect(openCode.state.sent).toHaveLength(0);
|
|
@@ -239,7 +294,7 @@ describe('message queue runtime', () => {
|
|
|
239
294
|
const { runtime, openCode, emit, broadcasts } = createRuntime({ retryDelayMs: () => 20 });
|
|
240
295
|
runtime.start();
|
|
241
296
|
await runtime.enqueue(SESSION, DIRECTORY, item());
|
|
242
|
-
openCode.state.failNext =
|
|
297
|
+
openCode.state.failNext = /\/prompt$/;
|
|
243
298
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
244
299
|
await settle(10);
|
|
245
300
|
expect(openCode.state.sent).toHaveLength(0);
|
|
@@ -255,8 +310,10 @@ describe('message queue runtime', () => {
|
|
|
255
310
|
const { runtime, openCode, emit } = createRuntime();
|
|
256
311
|
runtime.start();
|
|
257
312
|
await runtime.enqueue(SESSION, DIRECTORY, item());
|
|
258
|
-
|
|
313
|
+
// v2 reports a user abort as `session.execution.interrupted`, which the
|
|
314
|
+
// translator turns into an aborted `session.idle`.
|
|
259
315
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
316
|
+
emit({ type: 'session.idle', properties: { sessionID: SESSION, aborted: true, reason: 'user' } });
|
|
260
317
|
await settle(10);
|
|
261
318
|
expect(openCode.state.sent).toHaveLength(0);
|
|
262
319
|
await settle(80);
|
|
@@ -281,7 +338,7 @@ describe('message queue runtime', () => {
|
|
|
281
338
|
const dataDir = makeDataDir();
|
|
282
339
|
const first = createRuntime({ dataDir });
|
|
283
340
|
first.runtime.start();
|
|
284
|
-
first.openCode.state.
|
|
341
|
+
first.openCode.state.active = { [SESSION]: { type: 'running' } };
|
|
285
342
|
await first.runtime.enqueue(SESSION, DIRECTORY, item({ content: 'persisted', text: 'persisted', contextPreview: 'Saved context preview' }));
|
|
286
343
|
await first.runtime.flush();
|
|
287
344
|
first.runtime.stop();
|
|
@@ -294,7 +351,7 @@ describe('message queue runtime', () => {
|
|
|
294
351
|
second.connect();
|
|
295
352
|
await settle();
|
|
296
353
|
expect(second.openCode.state.sent).toHaveLength(1);
|
|
297
|
-
expect(second.openCode.state.sent[0].body
|
|
354
|
+
expect(second.openCode.state.sent[0].body).toEqual({ text: 'persisted' });
|
|
298
355
|
});
|
|
299
356
|
|
|
300
357
|
it('moves an unreadable queue file aside instead of treating it as empty', async () => {
|
|
@@ -310,9 +367,13 @@ describe('message queue runtime', () => {
|
|
|
310
367
|
const { runtime, openCode, emit } = createRuntime();
|
|
311
368
|
runtime.start();
|
|
312
369
|
let release;
|
|
313
|
-
//
|
|
314
|
-
|
|
315
|
-
|
|
370
|
+
// active map, message tail, the subagent check (active map, children),
|
|
371
|
+
// model switch, then the prompt itself (held open until released)
|
|
372
|
+
openCode.fetchImpl.mockImplementationOnce(async () => Response.json({ location: {}, data: {} }))
|
|
373
|
+
.mockImplementationOnce(async () => Response.json({ data: [], cursor: {} }))
|
|
374
|
+
.mockImplementationOnce(async () => Response.json({ data: {} }))
|
|
375
|
+
.mockImplementationOnce(async () => Response.json({ data: [], cursor: {} }))
|
|
376
|
+
.mockImplementationOnce(async () => new Response(null, { status: 204 }))
|
|
316
377
|
.mockImplementationOnce(() => new Promise((resolve) => { release = () => resolve(new Response(null, { status: 204 })); }));
|
|
317
378
|
const { itemId } = await runtime.enqueue(SESSION, DIRECTORY, item());
|
|
318
379
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
@@ -382,7 +443,7 @@ describe('message queue runtime', () => {
|
|
|
382
443
|
const { runtime, emit, broadcasts, openCode } = createRuntime();
|
|
383
444
|
runtime.start();
|
|
384
445
|
await runtime.enqueue(SESSION, DIRECTORY, item());
|
|
385
|
-
openCode.state.
|
|
446
|
+
openCode.state.active = {};
|
|
386
447
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
387
448
|
await settle();
|
|
388
449
|
|
|
@@ -418,11 +479,12 @@ describe('message queue runtime', () => {
|
|
|
418
479
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
419
480
|
await settle();
|
|
420
481
|
expect(openCode.state.sent).toHaveLength(1);
|
|
421
|
-
expect(openCode.state.sent[0].path).toBe(`/session/${SESSION}/command`);
|
|
422
|
-
|
|
482
|
+
expect(openCode.state.sent[0].path).toBe(`/api/session/${SESSION}/command`);
|
|
483
|
+
// v2's command route takes `text`, and the selection lives on the session.
|
|
484
|
+
expect(openCode.state.sent[0].body).toEqual({ name: 'review', text: 'src' });
|
|
423
485
|
});
|
|
424
486
|
|
|
425
|
-
it('delivers captured context as synthetic
|
|
487
|
+
it('delivers captured context as synthetic messages, instructions first, before project knowledge', async () => {
|
|
426
488
|
const knowledge = {
|
|
427
489
|
resolvePendingForSession: async () => ({ text: 'pinned notes', signature: 'sig-1' }),
|
|
428
490
|
recordDelivered: async () => {},
|
|
@@ -441,16 +503,29 @@ describe('message queue runtime', () => {
|
|
|
441
503
|
}));
|
|
442
504
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
443
505
|
await settle();
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
{
|
|
449
|
-
{
|
|
450
|
-
{
|
|
451
|
-
{
|
|
452
|
-
{
|
|
506
|
+
|
|
507
|
+
// v2 has no inline synthetic parts: everything attached to the message is
|
|
508
|
+
// admitted as its own synthetic message, before the prompt.
|
|
509
|
+
expect(openCode.state.sent.map((entry) => entry.path)).toEqual([
|
|
510
|
+
`/api/session/${SESSION}/synthetic`,
|
|
511
|
+
`/api/session/${SESSION}/synthetic`,
|
|
512
|
+
`/api/session/${SESSION}/synthetic`,
|
|
513
|
+
`/api/session/${SESSION}/synthetic`,
|
|
514
|
+
`/api/session/${SESSION}/synthetic`,
|
|
515
|
+
`/api/session/${SESSION}/prompt`,
|
|
453
516
|
]);
|
|
517
|
+
expect(openCode.state.sent.slice(0, 5).map((entry) => entry.body)).toEqual([
|
|
518
|
+
{ text: 'how to read it', resume: false },
|
|
519
|
+
{ text: 'the diff', resume: false, metadata },
|
|
520
|
+
{ text: 'conflict payload', resume: false },
|
|
521
|
+
{ text: 'use the skill', resume: false },
|
|
522
|
+
{ text: 'pinned notes', resume: false },
|
|
523
|
+
]);
|
|
524
|
+
expect(openCode.state.sent.at(-1).body).toEqual({
|
|
525
|
+
text: 'follow up',
|
|
526
|
+
files: [{ uri: 'data:text/plain,hi', name: 'f.txt' }],
|
|
527
|
+
agents: [{ name: 'reviewer' }],
|
|
528
|
+
});
|
|
454
529
|
});
|
|
455
530
|
|
|
456
531
|
it('keeps files on the command route, which is all that route accepts', async () => {
|
|
@@ -464,17 +539,21 @@ describe('message queue runtime', () => {
|
|
|
464
539
|
}));
|
|
465
540
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
466
541
|
await settle();
|
|
467
|
-
expect(openCode.state.sent[0].path).toBe(`/session/${SESSION}/command`);
|
|
468
|
-
expect(openCode.state.sent[0].body
|
|
542
|
+
expect(openCode.state.sent[0].path).toBe(`/api/session/${SESSION}/command`);
|
|
543
|
+
expect(openCode.state.sent[0].body).toEqual({
|
|
544
|
+
name: 'review',
|
|
545
|
+
text: '',
|
|
546
|
+
files: [{ uri: 'data:text/plain,hi', name: 'f.txt' }],
|
|
547
|
+
});
|
|
469
548
|
});
|
|
470
549
|
|
|
471
|
-
it('
|
|
472
|
-
// The command route
|
|
473
|
-
//
|
|
474
|
-
// the
|
|
550
|
+
it('admits captured context as synthetic messages and still runs a queued command through the command route', async () => {
|
|
551
|
+
// The command route takes attachments only, so the context goes ahead as
|
|
552
|
+
// synthetic messages; the command itself keeps its route, because sending
|
|
553
|
+
// "/review ..." as a prompt would skip the template OpenCode expands there.
|
|
475
554
|
const { runtime, openCode, emit } = createRuntime();
|
|
476
555
|
runtime.start();
|
|
477
|
-
openCode.state.commands = [{ name: 'review',
|
|
556
|
+
openCode.state.commands = [{ name: 'review', description: 'Review' }];
|
|
478
557
|
const metadata = { openchamberContext: { kind: 'chat-quote', quote: 'q', text: 'why?' } };
|
|
479
558
|
await runtime.enqueue(SESSION, DIRECTORY, item({
|
|
480
559
|
content: '/review src "error handling"',
|
|
@@ -483,30 +562,50 @@ describe('message queue runtime', () => {
|
|
|
483
562
|
}));
|
|
484
563
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
485
564
|
await settle();
|
|
486
|
-
|
|
487
|
-
expect(openCode.state.sent
|
|
488
|
-
{
|
|
489
|
-
{
|
|
565
|
+
|
|
566
|
+
expect(openCode.state.sent.map((entry) => entry.path)).toEqual([
|
|
567
|
+
`/api/session/${SESSION}/synthetic`,
|
|
568
|
+
`/api/session/${SESSION}/command`,
|
|
490
569
|
]);
|
|
570
|
+
expect(openCode.state.sent[0].body).toEqual({ text: 'quoted', resume: false, metadata });
|
|
571
|
+
expect(openCode.state.sent[1].body).toEqual({ name: 'review', text: 'src "error handling"' });
|
|
491
572
|
});
|
|
492
573
|
|
|
493
|
-
it('
|
|
574
|
+
it('delivers pending project knowledge ahead of a queued command and records it', async () => {
|
|
575
|
+
const recorded = [];
|
|
576
|
+
const knowledge = {
|
|
577
|
+
resolvePendingForSession: async () => ({ text: 'pinned notes', signature: 'sig-1' }),
|
|
578
|
+
recordDelivered: async (sessionId, directory, signature) => { recorded.push({ sessionId, directory, signature }); },
|
|
579
|
+
};
|
|
580
|
+
const { runtime, openCode, emit } = createRuntime({ knowledge });
|
|
581
|
+
runtime.start();
|
|
582
|
+
openCode.state.commands = [{ name: 'review' }];
|
|
583
|
+
await runtime.enqueue(SESSION, DIRECTORY, item({ content: '/review', text: '/review' }));
|
|
584
|
+
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
585
|
+
await settle();
|
|
586
|
+
|
|
587
|
+
expect(openCode.state.sent.map((entry) => entry.path)).toEqual([
|
|
588
|
+
`/api/session/${SESSION}/synthetic`,
|
|
589
|
+
`/api/session/${SESSION}/command`,
|
|
590
|
+
]);
|
|
591
|
+
expect(openCode.state.sent[0].body).toEqual({ text: 'pinned notes', resume: false });
|
|
592
|
+
expect(recorded).toEqual([{ sessionId: SESSION, directory: DIRECTORY, signature: 'sig-1' }]);
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
it('admits nothing when the command lookup fails, so a retry cannot duplicate the context', async () => {
|
|
494
596
|
const { runtime, openCode, emit } = createRuntime();
|
|
495
597
|
runtime.start();
|
|
496
|
-
openCode.state.
|
|
598
|
+
openCode.state.failNext = /^\/api\/command$/;
|
|
497
599
|
await runtime.enqueue(SESSION, DIRECTORY, item({
|
|
498
|
-
content: '/
|
|
499
|
-
text: '/
|
|
500
|
-
context: [{ kind: '
|
|
600
|
+
content: '/review',
|
|
601
|
+
text: '/review',
|
|
602
|
+
context: [{ kind: 'context', text: 'quoted', metadata: {} }],
|
|
501
603
|
}));
|
|
502
604
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
503
605
|
await settle();
|
|
504
|
-
|
|
505
|
-
expect(openCode.state.sent
|
|
506
|
-
|
|
507
|
-
{ type: 'text', text: 'focus on tests', synthetic: true },
|
|
508
|
-
{ type: 'text', text: 'The user explicitly invoked the grill skill. Use the corresponding skill tool to handle this request.', synthetic: true },
|
|
509
|
-
]);
|
|
606
|
+
|
|
607
|
+
expect(openCode.state.sent).toEqual([]);
|
|
608
|
+
expect(runtime.sessionSnapshot(SESSION).items).toHaveLength(1);
|
|
510
609
|
});
|
|
511
610
|
|
|
512
611
|
it('keeps captured context out of snapshots and broadcasts, and hands it back on take', async () => {
|
|
@@ -532,12 +631,15 @@ describe('message queue runtime', () => {
|
|
|
532
631
|
await runtime.enqueue(SESSION, DIRECTORY, item({ agentMention: 'reviewer', attachments: [{ id: 'a', filename: 'f.txt', mimeType: 'text/plain', size: 1, source: 'local', dataUrl: 'data:text/plain,hi' }] }));
|
|
533
632
|
emit({ type: 'session.status', properties: { sessionID: SESSION, status: { type: 'idle' } } });
|
|
534
633
|
await settle();
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
634
|
+
// Knowledge is admitted as a synthetic message ahead of the prompt.
|
|
635
|
+
expect(openCode.state.sent[0].path).toBe(`/api/session/${SESSION}/synthetic`);
|
|
636
|
+
expect(openCode.state.sent[0].body).toEqual({ text: 'pinned notes', resume: false });
|
|
637
|
+
expect(openCode.state.sent[1].path).toBe(`/api/session/${SESSION}/prompt`);
|
|
638
|
+
expect(openCode.state.sent[1].body).toEqual({
|
|
639
|
+
text: 'follow up',
|
|
640
|
+
files: [{ uri: 'data:text/plain,hi', name: 'f.txt' }],
|
|
641
|
+
agents: [{ name: 'reviewer' }],
|
|
642
|
+
});
|
|
541
643
|
expect(recorded).toEqual([{ sessionId: SESSION, directory: DIRECTORY, signature: 'sig-1' }]);
|
|
542
644
|
});
|
|
543
645
|
});
|
|
@@ -47,6 +47,7 @@ This module provides notification message preparation utilities for the web serv
|
|
|
47
47
|
- Owns:
|
|
48
48
|
- completion/error/question/permission trigger routing; permission suppression consults the authoritative permission-auto-accept runtime
|
|
49
49
|
- session parent cache for subtask suppression
|
|
50
|
+
- no ready notification on a `session.idle` while a subagent of that session is still running (a background-subagent pause; OpenCode runs the parent again with the result and its next idle announces). The check comes from `../opencode/session-activity.js`; when it cannot be made, the idle announces as before
|
|
50
51
|
- template resolution and fallback behavior
|
|
51
52
|
- native notification fanout and web push payload fanout
|
|
52
53
|
- push suppression while any fresh UI visibility heartbeat reports a focused client
|
|
@@ -136,3 +137,30 @@ The `settings` parameter for `prepareNotificationLastMessage` supports `maxLastM
|
|
|
136
137
|
### Testing
|
|
137
138
|
- Run `bun run type-check`, `bun run lint`, and `bun run build` before finalizing changes.
|
|
138
139
|
- Unit tests should cover truncation behavior and edge cases (empty strings, invalid inputs).
|
|
140
|
+
|
|
141
|
+
## Browser event delivery
|
|
142
|
+
|
|
143
|
+
Web notifications subscribe to the shared `/api/openchamber/events` control
|
|
144
|
+
stream. The emitter sends each notification there and through the existing
|
|
145
|
+
global broadcaster. The broadcaster owns the main WebSocket and the legacy
|
|
146
|
+
`/api/notifications/stream` endpoint, which remains available to older clients.
|
|
147
|
+
Do not call both global and control broadcasters for one notification: they
|
|
148
|
+
share the WebSocket client set and would send each frame twice.
|
|
149
|
+
|
|
150
|
+
The web hook preserves `tag`, `sessionId`, `kind`, and the remaining notification
|
|
151
|
+
fields so the web notification API recognizes duplicate control-SSE and main-WS
|
|
152
|
+
delivery. Its existing five-second claim suppresses duplicate native alerts.
|
|
153
|
+
Native alerts remain best-effort live events, with no historical replay or
|
|
154
|
+
synthetic catch-up alerts. Authoritative session attention is owned by sync.
|
|
155
|
+
|
|
156
|
+
This removes one persistent HTTP connection per browser tab in both main-WS and
|
|
157
|
+
main-SSE modes. Two tabs use two control SSE connections, or four connections
|
|
158
|
+
when their main event pipelines also use SSE. It does not make HTTP/1.1 support
|
|
159
|
+
an unlimited number of tabs. The notification hook retains the app's background
|
|
160
|
+
work enablement, settings, focus, and runtime gates; it no longer opens a second
|
|
161
|
+
connection or switches sources when the main pipeline changes transport.
|
|
162
|
+
|
|
163
|
+
The control stream retains its browser-control capability declaration, runtime
|
|
164
|
+
switch cleanup, stale-source rejection, heartbeat, and reconnect-ready events.
|
|
165
|
+
Electron uses its native notification path; VS Code does not subscribe to this
|
|
166
|
+
server-only stream. Mobile shells retain their existing push behavior.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { createServer } from 'node:http';
|
|
3
|
+
import express from 'express';
|
|
4
|
+
import { createUiAuth } from '../ui-auth/ui-auth.js';
|
|
5
|
+
import { registerScheduledTaskRoutes } from '../scheduled-tasks/routes.js';
|
|
6
|
+
import { createNotificationEmitterRuntime } from './emitter-runtime.js';
|
|
7
|
+
|
|
8
|
+
// Exercise the existing browser URL-token gate and the real SSE route, not an
|
|
9
|
+
// unauthenticated mock endpoint. Notification consolidation adds no auth bypass.
|
|
10
|
+
describe('notifications over the authenticated control stream', () => {
|
|
11
|
+
it('rejects anonymous readers and delivers to a scoped authenticated stream', async () => {
|
|
12
|
+
const auth = createUiAuth({
|
|
13
|
+
requireClientAuth: true,
|
|
14
|
+
clientAuthController: {
|
|
15
|
+
authenticateBearerToken: async (token) => token === 'test-client' ? { ok: true, clientId: 'fixture' } : null,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const clients = new Set();
|
|
19
|
+
const emitter = createNotificationEmitterRuntime({
|
|
20
|
+
process,
|
|
21
|
+
getDesktopNotifyEnabled: () => false,
|
|
22
|
+
desktopNotifyPrefix: '',
|
|
23
|
+
getUiNotificationClients: () => new Set(),
|
|
24
|
+
getOpenChamberEventClients: () => clients,
|
|
25
|
+
});
|
|
26
|
+
const app = express();
|
|
27
|
+
app.use(express.json());
|
|
28
|
+
app.post('/auth/url-token', auth.handleUrlAuthToken);
|
|
29
|
+
app.use('/api', auth.requireAuth);
|
|
30
|
+
registerScheduledTaskRoutes(app, {
|
|
31
|
+
getOpenChamberEventClients: () => clients,
|
|
32
|
+
writeSseEvent: emitter.writeSseEvent,
|
|
33
|
+
});
|
|
34
|
+
const server = createServer(app);
|
|
35
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
36
|
+
const base = `http://127.0.0.1:${server.address().port}`;
|
|
37
|
+
const abort = new AbortController();
|
|
38
|
+
try {
|
|
39
|
+
const denied = await fetch(`${base}/api/openchamber/events`);
|
|
40
|
+
expect(denied.status).toBe(401);
|
|
41
|
+
expect(clients.size).toBe(0);
|
|
42
|
+
const tokenResponse = await fetch(`${base}/auth/url-token`, {
|
|
43
|
+
method: 'POST', headers: { Authorization: 'Bearer test-client' },
|
|
44
|
+
});
|
|
45
|
+
expect(tokenResponse.status).toBe(200);
|
|
46
|
+
const { token } = await tokenResponse.json();
|
|
47
|
+
expect(token).toBeTruthy();
|
|
48
|
+
const response = await fetch(`${base}/api/openchamber/events?browser=1&oc_url_token=${encodeURIComponent(token)}`, { signal: abort.signal });
|
|
49
|
+
expect(response.status).toBe(200);
|
|
50
|
+
expect(response.headers.get('content-type')).toContain('text/event-stream');
|
|
51
|
+
const reader = response.body.getReader();
|
|
52
|
+
const ready = new TextDecoder().decode((await reader.read()).value);
|
|
53
|
+
expect(ready).toContain('openchamber:event-stream-ready');
|
|
54
|
+
expect(clients.size).toBe(1);
|
|
55
|
+
expect([...clients][0].openchamberBrowserCapable).toBe(true);
|
|
56
|
+
emitter.broadcastUiNotification({ title: 'Done', sessionId: 's1', kind: 'complete' });
|
|
57
|
+
const notification = new TextDecoder().decode((await reader.read()).value);
|
|
58
|
+
expect(notification).toContain('"type":"openchamber:notification"');
|
|
59
|
+
expect(notification).toContain('"sessionId":"s1"');
|
|
60
|
+
await reader.cancel();
|
|
61
|
+
} finally {
|
|
62
|
+
abort.abort();
|
|
63
|
+
server.closeAllConnections();
|
|
64
|
+
await new Promise((resolve) => server.close(resolve));
|
|
65
|
+
auth.dispose();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -4,6 +4,7 @@ export const createNotificationEmitterRuntime = (dependencies) => {
|
|
|
4
4
|
getDesktopNotifyEnabled,
|
|
5
5
|
desktopNotifyPrefix,
|
|
6
6
|
getUiNotificationClients,
|
|
7
|
+
getOpenChamberEventClients = () => new Set(),
|
|
7
8
|
getBroadcastGlobalUiEvent,
|
|
8
9
|
// Optional: in-process desktop shells (Electron main) inject a callback so
|
|
9
10
|
// notifications are delivered as a direct function call instead of a stdout
|
|
@@ -78,6 +79,20 @@ export const createNotificationEmitterRuntime = (dependencies) => {
|
|
|
78
79
|
},
|
|
79
80
|
};
|
|
80
81
|
|
|
82
|
+
// New clients share the control SSE; older clients retain their dedicated
|
|
83
|
+
// notification SSE. The global broadcaster still owns WebSocket delivery.
|
|
84
|
+
const controlClients = getOpenChamberEventClients();
|
|
85
|
+
if (controlClients.size > 0) {
|
|
86
|
+
const serializedPayload = JSON.stringify(syntheticPayload);
|
|
87
|
+
for (const client of controlClients) {
|
|
88
|
+
try {
|
|
89
|
+
writeSseEvent(client, syntheticPayload, serializedPayload);
|
|
90
|
+
} catch {
|
|
91
|
+
// One disconnected control client must not block other transports.
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
81
96
|
const broadcastGlobalUiEvent = typeof getBroadcastGlobalUiEvent === 'function'
|
|
82
97
|
? getBroadcastGlobalUiEvent()
|
|
83
98
|
: null;
|
|
@@ -45,3 +45,35 @@ describe('notification emitter runtime', () => {
|
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
describe('shared control notification delivery', () => {
|
|
51
|
+
it('writes once to control SSE and once to the legacy/global broadcaster', () => {
|
|
52
|
+
const control = { write: vi.fn() };
|
|
53
|
+
const failed = { write: () => { throw new Error('closed'); } };
|
|
54
|
+
const broadcastGlobalUiEvent = vi.fn();
|
|
55
|
+
const runtime = createRuntime({
|
|
56
|
+
getOpenChamberEventClients: () => new Set([failed, control]),
|
|
57
|
+
getBroadcastGlobalUiEvent: () => broadcastGlobalUiEvent,
|
|
58
|
+
});
|
|
59
|
+
runtime.broadcastUiNotification({ title: 'Done', sessionId: 's1', kind: 'complete' });
|
|
60
|
+
expect(control.write).toHaveBeenCalledTimes(1);
|
|
61
|
+
expect(broadcastGlobalUiEvent).toHaveBeenCalledTimes(1);
|
|
62
|
+
const envelope = broadcastGlobalUiEvent.mock.calls[0][0];
|
|
63
|
+
expect(control.write).toHaveBeenCalledWith(`data: ${JSON.stringify(envelope)}\n\n`);
|
|
64
|
+
expect(envelope.properties.sessionId).toBe('s1');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('preserves legacy notification SSE without a global broadcaster', () => {
|
|
68
|
+
const control = { write: vi.fn() };
|
|
69
|
+
const legacy = { write: vi.fn() };
|
|
70
|
+
const runtime = createRuntime({
|
|
71
|
+
getOpenChamberEventClients: () => new Set([control]),
|
|
72
|
+
getUiNotificationClients: () => new Set([legacy]),
|
|
73
|
+
});
|
|
74
|
+
runtime.broadcastUiNotification({ title: 'Done' });
|
|
75
|
+
expect(control.write).toHaveBeenCalledTimes(1);
|
|
76
|
+
expect(legacy.write).toHaveBeenCalledTimes(1);
|
|
77
|
+
expect(control.write.mock.calls).toEqual(legacy.write.mock.calls);
|
|
78
|
+
});
|
|
79
|
+
});
|