@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
|
@@ -20,7 +20,6 @@ const createRuntime = async (overrides = {}) => {
|
|
|
20
20
|
const dataDir = await fs.mkdtemp(path.join(os.tmpdir(), 'openchamber-agent-tool-'));
|
|
21
21
|
temporaryDirectories.push(dataDir);
|
|
22
22
|
const executeAction = vi.fn(async () => ({ projects: [] }));
|
|
23
|
-
const env = {};
|
|
24
23
|
const runtime = createAgentToolRuntime({
|
|
25
24
|
crypto,
|
|
26
25
|
fsPromises: fs,
|
|
@@ -28,10 +27,32 @@ const createRuntime = async (overrides = {}) => {
|
|
|
28
27
|
dataDir,
|
|
29
28
|
getActivePort: () => 3901,
|
|
30
29
|
executeAction,
|
|
31
|
-
env,
|
|
32
30
|
...overrides,
|
|
33
31
|
});
|
|
34
|
-
return { runtime, dataDir, executeAction
|
|
32
|
+
return { runtime, dataDir, executeAction };
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const pluginDirectoryFor = (dataDir) => path.join(dataDir, 'agent-tool', 'openchamber-agent-tool');
|
|
36
|
+
|
|
37
|
+
/** What a managed OpenCode child start does: write the plugin, mint a token. */
|
|
38
|
+
const prepareManagedEnv = async (runtime, options) => {
|
|
39
|
+
const pluginDirectory = await runtime.materializePlugin(options);
|
|
40
|
+
return { pluginDirectory, ...runtime.createChildEnv() };
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** Loads the generated plugin and returns the tools it registers, by name. */
|
|
44
|
+
const loadTools = async (dataDir, tag) => {
|
|
45
|
+
const entrypoint = path.join(pluginDirectoryFor(dataDir), 'index.js');
|
|
46
|
+
const pluginModule = await import(`${pathToFileURL(entrypoint).href}?${tag}=${Date.now()}`);
|
|
47
|
+
const registered = {};
|
|
48
|
+
await pluginModule.default.setup({
|
|
49
|
+
tool: {
|
|
50
|
+
transform: (edit) => {
|
|
51
|
+
edit({ add: (tool) => { registered[tool.name] = tool; } });
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
return registered;
|
|
35
56
|
};
|
|
36
57
|
|
|
37
58
|
describe('agent tool action allowlist', () => {
|
|
@@ -53,6 +74,7 @@ describe('agent tool action allowlist', () => {
|
|
|
53
74
|
'schedule.run',
|
|
54
75
|
'schedule.delete',
|
|
55
76
|
'schedule.toggle',
|
|
77
|
+
'file.open',
|
|
56
78
|
])('delegates %s to the shared control service', async (action) => {
|
|
57
79
|
const { runtime, executeAction } = await createRuntime();
|
|
58
80
|
const input = { action, projectId: 'project-1' };
|
|
@@ -75,21 +97,16 @@ describe('agent tool action allowlist', () => {
|
|
|
75
97
|
});
|
|
76
98
|
|
|
77
99
|
describe('managed agent tool runtime', () => {
|
|
78
|
-
it('materializes the plugin and
|
|
79
|
-
const { runtime, dataDir
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
expect(
|
|
88
|
-
expect(config.plugin).toEqual([
|
|
89
|
-
'file:///existing.js',
|
|
90
|
-
['example-plugin', { flag: true }],
|
|
91
|
-
expect.stringContaining('/agent-tool/openchamber-plugin.js'),
|
|
92
|
-
]);
|
|
100
|
+
it('materializes the plugin and mints a per-child callback token', async () => {
|
|
101
|
+
const { runtime, dataDir } = await createRuntime();
|
|
102
|
+
|
|
103
|
+
const preparedEnv = await prepareManagedEnv(runtime);
|
|
104
|
+
const source = await fs.readFile(path.join(pluginDirectoryFor(dataDir), 'index.js'), 'utf8');
|
|
105
|
+
const manifest = JSON.parse(await fs.readFile(path.join(pluginDirectoryFor(dataDir), 'package.json'), 'utf8'));
|
|
106
|
+
|
|
107
|
+
// The managed config layer names this directory; the runtime only writes it.
|
|
108
|
+
expect(preparedEnv.pluginDirectory).toBe(pluginDirectoryFor(dataDir));
|
|
109
|
+
expect(manifest.exports).toEqual({ '.': './index.js' });
|
|
93
110
|
expect(preparedEnv.OPENCHAMBER_AGENT_TOOL_URL).toBe('http://127.0.0.1:3901/api/openchamber/agent-tool');
|
|
94
111
|
expect(preparedEnv.OPENCHAMBER_AGENT_TOOL_TOKEN).toMatch(/^[A-Za-z0-9_-]+$/);
|
|
95
112
|
expect(source).toContain('openchamber: {');
|
|
@@ -97,48 +114,61 @@ describe('managed agent tool runtime', () => {
|
|
|
97
114
|
expect(source).toContain(JSON.stringify({ const: action, description }));
|
|
98
115
|
}
|
|
99
116
|
expect(source).not.toContain('"schedule.status"');
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
expect(
|
|
103
|
-
expect(
|
|
104
|
-
expect(hooks.tool.openchamber.args.action.oneOf).toContainEqual({
|
|
117
|
+
const tool = await loadTools(dataDir, 'schema');
|
|
118
|
+
expect(tool.openchamber.description).toContain('Session dispatches return immediately by default');
|
|
119
|
+
expect(tool.openchamber.description).toContain('Set wait only when the user asks or the next step requires the completed result');
|
|
120
|
+
expect(tool.openchamber.input.properties.action.oneOf).toContainEqual({
|
|
105
121
|
const: 'session.messages',
|
|
106
122
|
description: 'Read text-only messages and current sessionStatus for sessionId; directory and limit 10 are defaults',
|
|
107
123
|
});
|
|
108
|
-
expect(
|
|
124
|
+
expect(tool.openchamber.input.properties.parameters.properties.wait.description).toBe(
|
|
109
125
|
'Wait for current session activity to become idle. Omit by default; use only when the user asks or the next step requires the completed result',
|
|
110
126
|
);
|
|
111
|
-
expect(
|
|
127
|
+
expect(tool.openchamber.input.properties.parameters.properties.sessionId).toEqual({ type: 'string' });
|
|
112
128
|
expect(source).not.toContain('title: "OpenChamber"');
|
|
113
|
-
|
|
129
|
+
// Nothing resolves from the generated directory, so the file must not import.
|
|
130
|
+
expect(source).not.toMatch(/\bimport\b/);
|
|
114
131
|
expect(source).not.toContain(preparedEnv.OPENCHAMBER_AGENT_TOOL_TOKEN);
|
|
115
132
|
});
|
|
116
133
|
|
|
117
134
|
it('emits both tools, each carrying only its own actions and inputs', async () => {
|
|
118
135
|
const { runtime, dataDir } = await createRuntime();
|
|
119
|
-
await runtime
|
|
120
|
-
const
|
|
121
|
-
const pluginModule = await import(`${pathToFileURL(pluginPath).href}?both=${Date.now()}`);
|
|
122
|
-
const { tool } = await pluginModule.OpenChamberPlugin();
|
|
136
|
+
await prepareManagedEnv(runtime);
|
|
137
|
+
const tool = await loadTools(dataDir, 'both');
|
|
123
138
|
|
|
124
|
-
const controlActions = tool.openchamber.
|
|
125
|
-
const webActions = tool.openchamber_web.
|
|
139
|
+
const controlActions = tool.openchamber.input.properties.action.oneOf.map((entry) => entry.const);
|
|
140
|
+
const webActions = tool.openchamber_web.input.properties.action.oneOf.map((entry) => entry.const);
|
|
126
141
|
expect(webActions).toContain('browser.open');
|
|
127
142
|
expect(controlActions).not.toContain('browser.open');
|
|
128
143
|
expect(webActions).not.toContain('session.create');
|
|
129
144
|
|
|
130
145
|
// Turning one tool off has to remove its inputs too, not just its actions.
|
|
131
|
-
expect(Object.keys(tool.openchamber_web.
|
|
132
|
-
expect(Object.keys(tool.openchamber.
|
|
133
|
-
expect(Object.keys(tool.openchamber.
|
|
146
|
+
expect(Object.keys(tool.openchamber_web.input.properties.parameters.properties)).toContain('url');
|
|
147
|
+
expect(Object.keys(tool.openchamber.input.properties.parameters.properties)).not.toContain('url');
|
|
148
|
+
expect(Object.keys(tool.openchamber.input.properties.parameters.properties)).toContain('sessionId');
|
|
149
|
+
expect(Object.keys(tool.openchamber.input.properties.parameters.properties)).toContain('path');
|
|
150
|
+
expect(Object.keys(tool.openchamber_web.input.properties.parameters.properties)).not.toContain('path');
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('keeps the action schema to one validator keyword', async () => {
|
|
154
|
+
// A node carrying both `enum` and `oneOf` is valid JSON Schema, but some
|
|
155
|
+
// OpenAI-compatible gateways reject it and answer with an empty completion
|
|
156
|
+
// instead of an error. `oneOf` is the keyword that stayed. Its branches
|
|
157
|
+
// carry the per-action descriptions the model reads.
|
|
158
|
+
const { runtime, dataDir } = await createRuntime();
|
|
159
|
+
await prepareManagedEnv(runtime);
|
|
160
|
+
const tool = await loadTools(dataDir, 'validator');
|
|
161
|
+
|
|
162
|
+
for (const entry of Object.values(tool)) {
|
|
163
|
+
expect(entry.input.properties.action.oneOf).toBeInstanceOf(Array);
|
|
164
|
+
expect(entry.input.properties.action).not.toHaveProperty('enum');
|
|
165
|
+
}
|
|
134
166
|
});
|
|
135
167
|
|
|
136
168
|
it('accepts inputs passed beside the action, not only inside parameters', async () => {
|
|
137
169
|
const { runtime, dataDir } = await createRuntime();
|
|
138
|
-
const prepared = await runtime
|
|
139
|
-
const
|
|
140
|
-
const pluginModule = await import(`${pathToFileURL(pluginPath).href}?flat=${Date.now()}`);
|
|
141
|
-
const { tool } = await pluginModule.OpenChamberPlugin();
|
|
170
|
+
const prepared = await prepareManagedEnv(runtime);
|
|
171
|
+
const tool = await loadTools(dataDir, 'flat');
|
|
142
172
|
|
|
143
173
|
const sent = [];
|
|
144
174
|
const originalFetch = globalThis.fetch;
|
|
@@ -150,7 +180,7 @@ describe('managed agent tool runtime', () => {
|
|
|
150
180
|
sent.push(JSON.parse(init.body));
|
|
151
181
|
return new Response(JSON.stringify({ schemaVersion: 1, ok: true, action: 'browser.open', data: {} }));
|
|
152
182
|
};
|
|
153
|
-
const context = {
|
|
183
|
+
const context = { sessionID: 'ses_1', agent: 'build', messageID: 'msg_1', id: 'call_1', progress: async () => {} };
|
|
154
184
|
|
|
155
185
|
try {
|
|
156
186
|
// The shape a model actually produced: url and viewport next to action.
|
|
@@ -177,49 +207,44 @@ describe('managed agent tool runtime', () => {
|
|
|
177
207
|
expect(sent[0].input).toEqual({ action: 'browser.open', url: 'https://example.test', viewport: 'mobile' });
|
|
178
208
|
expect(sent[1].input.url).toBe('https://example.test/nested');
|
|
179
209
|
expect(sent[2].input).toEqual({ action: 'session.messages', sessionId: 'ses_1', limit: 3 });
|
|
210
|
+
// v2 tools get no directory; the session id is what OpenChamber resolves from.
|
|
211
|
+
expect(sent[2].sessionID).toBe('ses_1');
|
|
212
|
+
expect(sent[2].contextDirectory).toBeUndefined();
|
|
180
213
|
});
|
|
181
214
|
|
|
182
215
|
it('omits a tool the user turned off', async () => {
|
|
183
216
|
const { runtime, dataDir } = await createRuntime();
|
|
184
|
-
await runtime
|
|
185
|
-
const
|
|
186
|
-
const pluginModule = await import(`${pathToFileURL(pluginPath).href}?web=${Date.now()}`);
|
|
187
|
-
const { tool } = await pluginModule.OpenChamberPlugin();
|
|
217
|
+
await prepareManagedEnv(runtime, { includeControl: false, includeWeb: true, includeMemory: false });
|
|
218
|
+
const tool = await loadTools(dataDir, 'web');
|
|
188
219
|
|
|
189
220
|
expect(Object.keys(tool)).toEqual(['openchamber_web']);
|
|
190
221
|
});
|
|
191
222
|
|
|
192
223
|
it('exposes memory as its own tool carrying only its own inputs', async () => {
|
|
193
224
|
const { runtime, dataDir } = await createRuntime();
|
|
194
|
-
await runtime
|
|
195
|
-
const
|
|
196
|
-
const pluginModule = await import(`${pathToFileURL(pluginPath).href}?memory=${Date.now()}`);
|
|
197
|
-
const { tool } = await pluginModule.OpenChamberPlugin();
|
|
225
|
+
await prepareManagedEnv(runtime, { includeControl: true, includeWeb: false, includeMemory: true });
|
|
226
|
+
const tool = await loadTools(dataDir, 'memory');
|
|
198
227
|
|
|
199
228
|
expect(Object.keys(tool)).toEqual(['openchamber', 'openchamber_memory']);
|
|
200
|
-
expect(Object.keys(tool.openchamber_memory.
|
|
229
|
+
expect(Object.keys(tool.openchamber_memory.input.properties.parameters.properties).sort())
|
|
201
230
|
.toEqual(['body', 'memoryId', 'scope', 'title', 'type']);
|
|
202
231
|
// Memory inputs must not leak into the control tool's schema, which the
|
|
203
232
|
// model pays for on every unrelated call.
|
|
204
|
-
expect(Object.keys(tool.openchamber.
|
|
233
|
+
expect(Object.keys(tool.openchamber.input.properties.parameters.properties)).not.toContain('memoryId');
|
|
205
234
|
});
|
|
206
235
|
|
|
207
236
|
it('omits memory entirely when the user turns it off', async () => {
|
|
208
237
|
const { runtime, dataDir } = await createRuntime();
|
|
209
|
-
await runtime
|
|
210
|
-
const
|
|
211
|
-
const pluginModule = await import(`${pathToFileURL(pluginPath).href}?nomemory=${Date.now()}`);
|
|
212
|
-
const { tool } = await pluginModule.OpenChamberPlugin();
|
|
238
|
+
await prepareManagedEnv(runtime, { includeControl: true, includeWeb: false, includeMemory: false });
|
|
239
|
+
const tool = await loadTools(dataDir, 'nomemory');
|
|
213
240
|
|
|
214
241
|
expect(Object.keys(tool)).toEqual(['openchamber']);
|
|
215
242
|
});
|
|
216
243
|
|
|
217
244
|
it('injects the plugin when memory is the only tool left on', async () => {
|
|
218
245
|
const { runtime, dataDir } = await createRuntime();
|
|
219
|
-
await runtime
|
|
220
|
-
const
|
|
221
|
-
const pluginModule = await import(`${pathToFileURL(pluginPath).href}?onlymemory=${Date.now()}`);
|
|
222
|
-
const { tool } = await pluginModule.OpenChamberPlugin();
|
|
246
|
+
await prepareManagedEnv(runtime, { includeControl: false, includeWeb: false, includeMemory: true });
|
|
247
|
+
const tool = await loadTools(dataDir, 'onlymemory');
|
|
223
248
|
|
|
224
249
|
expect(Object.keys(tool)).toEqual(['openchamber_memory']);
|
|
225
250
|
});
|
|
@@ -228,7 +253,7 @@ describe('managed agent tool runtime', () => {
|
|
|
228
253
|
const { runtime } = await createRuntime();
|
|
229
254
|
let failed = false;
|
|
230
255
|
try {
|
|
231
|
-
await runtime
|
|
256
|
+
await prepareManagedEnv(runtime, { includeControl: false, includeWeb: false, includeMemory: false });
|
|
232
257
|
} catch {
|
|
233
258
|
failed = true;
|
|
234
259
|
}
|
|
@@ -244,6 +269,7 @@ describe('managed agent tool runtime', () => {
|
|
|
244
269
|
const result = await runtime.execute({
|
|
245
270
|
input: { action: 'read', title: 'Uses bun' },
|
|
246
271
|
contextDirectory: '/work/project',
|
|
272
|
+
contextSessionId: 'ses_1',
|
|
247
273
|
tool: 'openchamber_memory',
|
|
248
274
|
});
|
|
249
275
|
|
|
@@ -253,7 +279,7 @@ describe('managed agent tool runtime', () => {
|
|
|
253
279
|
'memory.read',
|
|
254
280
|
{ action: 'memory.read', title: 'Uses bun' },
|
|
255
281
|
'/work/project',
|
|
256
|
-
{},
|
|
282
|
+
{ contextSessionId: 'ses_1' },
|
|
257
283
|
);
|
|
258
284
|
});
|
|
259
285
|
|
|
@@ -300,6 +326,35 @@ describe('managed agent tool runtime', () => {
|
|
|
300
326
|
expect(executeAction).toHaveBeenCalledWith('projects.list', { action: 'projects.list' }, '/work/project', {});
|
|
301
327
|
});
|
|
302
328
|
|
|
329
|
+
it('resolves the directory from the session id the plugin sends', async () => {
|
|
330
|
+
const executeAction = vi.fn(async () => ({}));
|
|
331
|
+
const resolveSessionDirectory = vi.fn(async () => '/work/other-worktree');
|
|
332
|
+
const { runtime } = await createRuntime({ executeAction, resolveSessionDirectory });
|
|
333
|
+
|
|
334
|
+
await runtime.execute({ input: { action: 'session.messages', sessionId: 'ses_1' }, sessionID: 'ses_1' });
|
|
335
|
+
|
|
336
|
+
expect(resolveSessionDirectory).toHaveBeenCalledWith('ses_1');
|
|
337
|
+
// The calling session also scopes the action (browser pages are per session).
|
|
338
|
+
expect(executeAction).toHaveBeenCalledWith(
|
|
339
|
+
'session.messages',
|
|
340
|
+
{ action: 'session.messages', sessionId: 'ses_1' },
|
|
341
|
+
'/work/other-worktree',
|
|
342
|
+
{ contextSessionId: 'ses_1' },
|
|
343
|
+
);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it('runs without a directory when the session cannot be resolved', async () => {
|
|
347
|
+
const executeAction = vi.fn(async () => ({}));
|
|
348
|
+
const { runtime } = await createRuntime({
|
|
349
|
+
executeAction,
|
|
350
|
+
resolveSessionDirectory: vi.fn(async () => { throw new Error('unavailable'); }),
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
await runtime.execute({ input: { action: 'projects.list' }, sessionID: 'ses_1' });
|
|
354
|
+
|
|
355
|
+
expect(executeAction).toHaveBeenCalledWith('projects.list', { action: 'projects.list' }, undefined, { contextSessionId: 'ses_1' });
|
|
356
|
+
});
|
|
357
|
+
|
|
303
358
|
it('keeps service failures as structured tool results', async () => {
|
|
304
359
|
const error = Object.assign(new Error('Task not found'), { statusCode: 404 });
|
|
305
360
|
const { runtime } = await createRuntime({ executeAction: vi.fn(async () => { throw error; }) });
|
|
@@ -335,9 +390,45 @@ describe('managed agent tool runtime', () => {
|
|
|
335
390
|
expect(executeAction).toHaveBeenCalledWith('projects.list', { action: 'projects.list' }, undefined, { signal: controller.signal });
|
|
336
391
|
});
|
|
337
392
|
|
|
393
|
+
it('aborts the actions a session still has running when its turn is cancelled', async () => {
|
|
394
|
+
// Safety net beside the plugin's forwarded abort signal: the server also
|
|
395
|
+
// ends the action itself when the event stream reports the cancel.
|
|
396
|
+
const executeAction = vi.fn(async (_action, _input, _directory, options) => {
|
|
397
|
+
await new Promise((resolve, reject) => {
|
|
398
|
+
options.signal.addEventListener('abort', () => reject(Object.assign(new Error('OpenChamber action was cancelled'), { statusCode: 499 })), { once: true });
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
const { runtime } = await createRuntime({ executeAction });
|
|
402
|
+
const env = await prepareManagedEnv(runtime);
|
|
403
|
+
const app = express();
|
|
404
|
+
runtime.registerRoutes(app, express);
|
|
405
|
+
|
|
406
|
+
// supertest only sends when awaited; `.then` starts both requests now.
|
|
407
|
+
const pending = request(app)
|
|
408
|
+
.post('/api/openchamber/agent-tool')
|
|
409
|
+
.set('authorization', `Bearer ${env.OPENCHAMBER_AGENT_TOOL_TOKEN}`)
|
|
410
|
+
.send({ input: { action: 'projects.list' }, sessionID: 'ses_cancel' })
|
|
411
|
+
.then((response) => response);
|
|
412
|
+
const other = request(app)
|
|
413
|
+
.post('/api/openchamber/agent-tool')
|
|
414
|
+
.set('authorization', `Bearer ${env.OPENCHAMBER_AGENT_TOOL_TOKEN}`)
|
|
415
|
+
.send({ input: { action: 'projects.list' }, sessionID: 'ses_other' })
|
|
416
|
+
.then((response) => response);
|
|
417
|
+
// Let both requests reach the service before cancelling one session.
|
|
418
|
+
await vi.waitFor(() => expect(executeAction).toHaveBeenCalledTimes(2));
|
|
419
|
+
|
|
420
|
+
expect(runtime.abortSession('ses_cancel')).toBe(1);
|
|
421
|
+
const response = await pending;
|
|
422
|
+
expect(response.body).toEqual(expect.objectContaining({ ok: false, error: expect.objectContaining({ message: 'OpenChamber action was cancelled' }) }));
|
|
423
|
+
|
|
424
|
+
// The other session's action is untouched until it is told otherwise.
|
|
425
|
+
expect(runtime.abortSession('ses_other')).toBe(1);
|
|
426
|
+
await other;
|
|
427
|
+
});
|
|
428
|
+
|
|
338
429
|
it('requires the per-child token on the loopback route', async () => {
|
|
339
430
|
const { runtime } = await createRuntime();
|
|
340
|
-
const env = await runtime
|
|
431
|
+
const env = await prepareManagedEnv(runtime);
|
|
341
432
|
const app = express();
|
|
342
433
|
runtime.registerRoutes(app, express);
|
|
343
434
|
|
|
@@ -354,6 +445,73 @@ describe('managed agent tool runtime', () => {
|
|
|
354
445
|
expect(response.body).toEqual(expect.objectContaining({ ok: true, action: 'projects.list' }));
|
|
355
446
|
});
|
|
356
447
|
|
|
448
|
+
it.each([
|
|
449
|
+
['0.0.0.0', 'http://127.0.0.1:3901/api/openchamber/agent-tool'],
|
|
450
|
+
['::', 'http://127.0.0.1:3901/api/openchamber/agent-tool'],
|
|
451
|
+
[null, 'http://127.0.0.1:3901/api/openchamber/agent-tool'],
|
|
452
|
+
['127.0.0.1', 'http://127.0.0.1:3901/api/openchamber/agent-tool'],
|
|
453
|
+
['100.100.0.3', 'http://100.100.0.3:3901/api/openchamber/agent-tool'],
|
|
454
|
+
['fd7a:115c::3', 'http://[fd7a:115c::3]:3901/api/openchamber/agent-tool'],
|
|
455
|
+
])('points the callback at where a listener bound to %s answers', async (boundAddress, expectedUrl) => {
|
|
456
|
+
const { runtime } = await createRuntime({ getActiveHost: () => boundAddress });
|
|
457
|
+
const env = await prepareManagedEnv(runtime);
|
|
458
|
+
expect(env.OPENCHAMBER_AGENT_TOOL_URL).toBe(expectedUrl);
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
it.each([
|
|
462
|
+
['100.100.0.3', '100.100.0.3', 200],
|
|
463
|
+
['100.100.0.3', '::ffff:100.100.0.3', 200],
|
|
464
|
+
['100.100.0.3', '100.100.0.7', 401],
|
|
465
|
+
['fd7a:115c::3', 'fd7a:115c::3', 200],
|
|
466
|
+
['fd7a:115c::3', 'fd7a:115c::7', 401],
|
|
467
|
+
['0.0.0.0', '192.168.1.20', 401],
|
|
468
|
+
['0.0.0.0', '0.0.0.0', 401],
|
|
469
|
+
[null, '192.168.1.20', 401],
|
|
470
|
+
])('bound to %s, answers a token-bearing caller from %s with %i', async (boundAddress, remoteAddress, status) => {
|
|
471
|
+
const { runtime } = await createRuntime({ getActiveHost: () => boundAddress });
|
|
472
|
+
const env = await prepareManagedEnv(runtime);
|
|
473
|
+
const app = express();
|
|
474
|
+
app.use((req, _res, next) => {
|
|
475
|
+
Object.defineProperty(req.socket, 'remoteAddress', { value: remoteAddress, configurable: true });
|
|
476
|
+
next();
|
|
477
|
+
});
|
|
478
|
+
runtime.registerRoutes(app, express);
|
|
479
|
+
|
|
480
|
+
await request(app)
|
|
481
|
+
.post('/api/openchamber/agent-tool')
|
|
482
|
+
.set('authorization', `Bearer ${env.OPENCHAMBER_AGENT_TOOL_TOKEN}`)
|
|
483
|
+
.send({ input: { action: 'projects.list' } })
|
|
484
|
+
.expect(status);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
it.each([
|
|
488
|
+
['http://100.100.0.3:3901/api/openchamber/agent-tool', 'localhost,127.0.0.1', 'localhost,127.0.0.1,100.100.0.3'],
|
|
489
|
+
['http://[fd7a:115c::3]:3901/api/openchamber/agent-tool', undefined, 'fd7a:115c::3'],
|
|
490
|
+
['http://100.100.0.3:3901/api/openchamber/agent-tool', '100.100.0.3', '100.100.0.3'],
|
|
491
|
+
['not a url', 'localhost', 'localhost'],
|
|
492
|
+
])('keeps the callback %s away from an environment proxy', async (callbackUrl, existing, expected) => {
|
|
493
|
+
const { runtime, dataDir } = await createRuntime();
|
|
494
|
+
await prepareManagedEnv(runtime);
|
|
495
|
+
const keys = ['OPENCHAMBER_AGENT_TOOL_URL', 'NO_PROXY', 'no_proxy'];
|
|
496
|
+
const previous = keys.map((key) => process.env[key]);
|
|
497
|
+
try {
|
|
498
|
+
process.env.OPENCHAMBER_AGENT_TOOL_URL = callbackUrl;
|
|
499
|
+
for (const key of ['NO_PROXY', 'no_proxy']) {
|
|
500
|
+
if (existing === undefined) delete process.env[key];
|
|
501
|
+
else process.env[key] = existing;
|
|
502
|
+
}
|
|
503
|
+
await loadTools(dataDir, 'proxy');
|
|
504
|
+
|
|
505
|
+
expect(process.env.NO_PROXY).toBe(expected);
|
|
506
|
+
expect(process.env.no_proxy).toBe(expected);
|
|
507
|
+
} finally {
|
|
508
|
+
keys.forEach((key, index) => {
|
|
509
|
+
if (previous[index] === undefined) delete process.env[key];
|
|
510
|
+
else process.env[key] = previous[index];
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
|
|
357
515
|
it('executes through the materialized plugin and authenticated callback', async () => {
|
|
358
516
|
let activePort = null;
|
|
359
517
|
const { runtime, dataDir } = await createRuntime({ getActivePort: () => activePort });
|
|
@@ -367,32 +525,28 @@ describe('managed agent tool runtime', () => {
|
|
|
367
525
|
const previousUrl = process.env.OPENCHAMBER_AGENT_TOOL_URL;
|
|
368
526
|
const previousToken = process.env.OPENCHAMBER_AGENT_TOOL_TOKEN;
|
|
369
527
|
try {
|
|
370
|
-
const env = await runtime
|
|
528
|
+
const env = await prepareManagedEnv(runtime);
|
|
371
529
|
process.env.OPENCHAMBER_AGENT_TOOL_URL = env.OPENCHAMBER_AGENT_TOOL_URL;
|
|
372
530
|
process.env.OPENCHAMBER_AGENT_TOOL_TOKEN = env.OPENCHAMBER_AGENT_TOOL_TOKEN;
|
|
373
|
-
const
|
|
374
|
-
const
|
|
375
|
-
const hooks = await pluginModule.OpenChamberPlugin();
|
|
376
|
-
const metadata = vi.fn();
|
|
531
|
+
const tool = await loadTools(dataDir, 'callback');
|
|
532
|
+
const progress = vi.fn(async () => {});
|
|
377
533
|
|
|
378
|
-
const result = await
|
|
534
|
+
const result = await tool.openchamber.execute(
|
|
379
535
|
{ action: 'projects.list', parameters: {} },
|
|
380
|
-
{
|
|
536
|
+
{ sessionID: 'ses_1', agent: 'build', messageID: 'msg_1', id: 'call_1', progress },
|
|
381
537
|
);
|
|
382
538
|
|
|
383
|
-
|
|
539
|
+
// No output schema is declared, so the envelope has to travel as content.
|
|
540
|
+
expect(result.output).toBeUndefined();
|
|
541
|
+
expect(JSON.parse(result.content)).toEqual({
|
|
384
542
|
schemaVersion: 1,
|
|
385
543
|
ok: true,
|
|
386
544
|
action: 'projects.list',
|
|
387
545
|
data: { projects: [] },
|
|
388
546
|
});
|
|
389
|
-
expect(result.title).toBe('List configured projects');
|
|
390
547
|
expect(result.metadata.openchamber.description).toBe('List configured projects');
|
|
391
|
-
expect(
|
|
392
|
-
|
|
393
|
-
metadata: expect.objectContaining({
|
|
394
|
-
openchamber: expect.objectContaining({ description: 'List configured projects' }),
|
|
395
|
-
}),
|
|
548
|
+
expect(progress).toHaveBeenCalledWith(expect.objectContaining({
|
|
549
|
+
openchamber: expect.objectContaining({ description: 'List configured projects' }),
|
|
396
550
|
}));
|
|
397
551
|
} finally {
|
|
398
552
|
if (previousUrl === undefined) delete process.env.OPENCHAMBER_AGENT_TOOL_URL;
|
|
@@ -16,9 +16,36 @@ itself; it can only ask and wait.
|
|
|
16
16
|
validates the envelope and hands the outcome to the broker.
|
|
17
17
|
- `../../index.js` supplies `emitRequest`, which writes the request to the
|
|
18
18
|
OpenChamber SSE clients and returns how many were reached.
|
|
19
|
+
- `provider.js` sits between the control service and the broker. It reads
|
|
20
|
+
the `browserProvider` setting on every action: `builtin` goes to the broker;
|
|
21
|
+
an extension id goes to that extension's service (`contributes.service.provides`
|
|
22
|
+
includes `browser`) as `POST /browser-control` on its loopback through
|
|
23
|
+
`../guests/service.js`, with the open/action timeouts, the response cap, and
|
|
24
|
+
the idle stop from `@openchamber/sdk`. The body also carries `context`
|
|
25
|
+
(`directory`, `sessionId`, each `null` when unknown): the project and chat the
|
|
26
|
+
tool call came from, threaded from the plugin (`contextDirectory`,
|
|
27
|
+
`contextSessionId`) through the control service; the model never types it.
|
|
28
|
+
The answer is parsed with
|
|
29
|
+
`browserProviderResultSchema`; `ok: false` becomes the agent's error, any
|
|
30
|
+
other status or shape is reported as unknown page state. A selected extension
|
|
31
|
+
that cannot serve (`isBrowserProviderGuest`: enabled, fully approved, has the
|
|
32
|
+
role) resets the setting to `builtin`, emits
|
|
33
|
+
`openchamber:browser-provider-reset`, and runs the action in-app. A settings
|
|
34
|
+
or catalog read that fails is not that: the action fails with 503, nothing
|
|
35
|
+
runs anywhere, and the choice stays, because a read error says nothing
|
|
36
|
+
about the extension and an action must never land in a browser the user
|
|
37
|
+
did not pick. `REQUEST_FAILED` (sent, no answer) is reported to the agent
|
|
38
|
+
as "may or may not have run, read the page first", never as unchanged.
|
|
39
|
+
`handleGuestDeactivated` does the same reset when the guest routes pause,
|
|
40
|
+
remove, or withdraw approval from the selected extension.
|
|
41
|
+
When the extension also shows a shared surface (`../guests/surface.js`),
|
|
42
|
+
an action is refused with 409 while the user holds the surface, and every
|
|
43
|
+
action that runs is reported as agent activity so the panel says "Agent is
|
|
44
|
+
working".
|
|
19
45
|
- `../openchamber-control/service.js` is the only caller. It maps the
|
|
20
|
-
`browser.*` actions of the `openchamber_web` tool onto
|
|
21
|
-
owns their parameter
|
|
46
|
+
`browser.*` actions of the `openchamber_web` tool onto the router's
|
|
47
|
+
`request()` (same signature as the broker) and owns their parameter
|
|
48
|
+
validation.
|
|
22
49
|
- The client half is `packages/ui/src/lib/browser/controlClient.ts`, which
|
|
23
50
|
registers the mounted browser pane as the one responder.
|
|
24
51
|
|
|
@@ -48,3 +75,11 @@ itself; it can only ask and wait.
|
|
|
48
75
|
and a missing one silently turns every answer into an agent-visible timeout.
|
|
49
76
|
- Request payload limits are sized for a page snapshot (visible text plus every
|
|
50
77
|
interactive element), not for a control message.
|
|
78
|
+
- The provider path never trusts the setting alone: the extension is
|
|
79
|
+
re-checked against the catalog on every action, and the grant list handed to
|
|
80
|
+
the service proxy is the catalog's effective list, so a version that widened
|
|
81
|
+
its permissions is refused until re-approved.
|
|
82
|
+
- The provider's answer shapes are the desktop panel's own
|
|
83
|
+
(`packages/sdk/src/service-providers.ts`); `browser.capture` still returns
|
|
84
|
+
`base64`/`mime` and the control service writes the file, so the agent sees
|
|
85
|
+
the same result whoever took the picture.
|