@vantran-se/openchamber-web 1.23.1 → 1.24.4
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 +29 -6
- package/bin/lib/cli-http.js +5 -1
- package/bin/lib/commands-status.js +5 -0
- package/dist/assets/{CodeMirrorCommentWidgets-BOpqXpFU.js → CodeMirrorCommentWidgets-B4a0JkUz.js} +1 -1
- package/dist/assets/DiffView-B2CD9wC8.js +4 -0
- package/dist/assets/FilesView-C4vMFclc.js +13 -0
- package/dist/assets/GitView-Byu2DY7s.js +6 -0
- package/dist/assets/GuestAttachDialog-B808E0-d.js +1 -0
- package/dist/assets/{JsonTreeView-nd_E8eVM.js → JsonTreeView-VW_7czo3.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-EzGNCGrd.js +1 -0
- package/dist/assets/{MarkdownImageGallery-CVYds3sQ.js → MarkdownImageGallery-B2YUDFaB.js} +1 -1
- package/dist/assets/MarkdownRendererImpl-B4ikIzR3.js +12 -0
- package/dist/assets/{OnboardingScreen-Dd2IbPTn.js → OnboardingScreen-CQHBSTEi.js} +1 -1
- package/dist/assets/{PatchDiff-nUu5i4bG.js → PatchDiff-DCjGhlYV.js} +1 -1
- package/dist/assets/PierreDiffViewer-CEDZNkU2.js +210 -0
- package/dist/assets/PlanView-D3x-pTkZ.js +5 -0
- package/dist/assets/PluginPane-DEcgDQ9h.js +3 -0
- package/dist/assets/SettingsView-CSinuH-1.js +29 -0
- package/dist/assets/{SettingsWindow-BccxY81J.js → SettingsWindow-B5CHoJFZ.js} +1 -1
- package/dist/assets/SubmoduleDiffSummary-oxeACCWs.js +1 -0
- package/dist/assets/ToolOutputDialog-tLNWmfcW.js +15 -0
- package/dist/assets/{ToolPartDiffPreview-BFVgk0UK.js → ToolPartDiffPreview-CflzmK-x.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-z3_H74UR.js → VirtualizedFileDiff-NU0FHFhT.js} +3 -3
- package/dist/assets/{WalkthroughView-BqM9GFbJ.js → WalkthroughView-BZyjhqHv.js} +2 -2
- package/dist/assets/appThemeRegistry-DLicw4dH.js +1 -0
- package/dist/assets/commitAndPush-BDftrjr6.js +1 -0
- package/dist/assets/{computeVirtualFileMetrics-Bdazp9Qo.js → computeVirtualFileMetrics-DlWlEM3x.js} +1 -1
- package/dist/assets/de-Bro6_zyl.js +10 -0
- package/dist/assets/es-Bb9XQZvd.js +16 -0
- package/dist/assets/fr-Dgfzn-IL.js +14 -0
- package/dist/assets/{index-eo1-D_7z.js → index-CtQNmqUL.js} +1 -1
- package/dist/assets/index-DqaMWNrC.css +1 -0
- package/dist/assets/index-Dqc6USl3.js +40 -0
- package/dist/assets/{isDiffPlainText-BvKH712-.js → isDiffPlainText-CO4e5J_S.js} +1 -1
- package/dist/assets/{isFilePlainText-BdVVPukf.js → isFilePlainText-ue6kCou7.js} +1 -1
- package/dist/assets/ja-BYsakGFh.js +16 -0
- package/dist/assets/ko-BSaQz9aN.js +16 -0
- package/dist/assets/main-B62_pjL5.js +2 -0
- package/dist/assets/main-BEdcOI2P.js +896 -0
- package/dist/assets/{markdown-shiki.worker-D5fBU-lw.js → markdown-shiki.worker-CahLvHIq.js} +5 -5
- package/dist/assets/markdownCore-CK48LG0z.js +5 -0
- package/dist/assets/miniChat-LT8Rqofr.js +2 -0
- package/dist/assets/mobile-CqarEynh.js +2 -0
- package/dist/assets/{patchFileDiff-B7LjppSS.js → patchFileDiff-D7QVlovD.js} +3 -3
- package/dist/assets/pl-OIviPdoj.js +16 -0
- package/dist/assets/pt-BR-Cltg-E6s.js +16 -0
- package/dist/assets/renderElectronMiniChatApp-COyLTtZx.js +2 -0
- package/dist/assets/renderMobileApp-BC1MHg6g.js +25 -0
- package/dist/assets/runtimeEndpointReset-DdrazOVH.js +25 -0
- package/dist/assets/{scheduledTasksApi-hceovDei.js → scheduledTasksApi-B2SWMGEU.js} +1 -1
- package/dist/assets/shikiHighlight-BPu3JiQs.js +1 -0
- package/dist/assets/textMateThemeFromAppTheme-DWqRPo9A.js +1 -0
- package/dist/assets/tr-CQI-KPre.js +7 -0
- package/dist/assets/uk-CqW7R4DA.js +16 -0
- package/dist/assets/useAppFontEffects-ne84JBVL.js +7333 -0
- package/dist/assets/useInlineCommentController-CgS0fnw_.js +2 -0
- package/dist/assets/useRootScrollLock-Cpf1qoGp.js +2 -0
- package/dist/assets/{vendor-base-ui-BY_5qla_.js → vendor-base-ui-CsXYnR5c.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-DWA1bm1F.js → vendor-codemirror-language-data-Bx2EHc1O.js} +2 -2
- package/dist/assets/vendor-framer-motion-Bq3iTZ6r.js +1 -0
- package/dist/assets/vendor-katex-Cp579UoJ.css +1 -0
- package/dist/assets/{vendor-motion-dom-D_o3BTI3.js → vendor-motion-dom-DcCgeG69.js} +1 -1
- package/dist/assets/{vendor-remixicon-react-Dil0zKKT.js → vendor-remixicon-react-BDmGmFCA.js} +1 -1
- package/dist/assets/vendor-strip-json-comments-5dJlOkP1.js +4 -0
- package/dist/assets/{vendor-tanstack-react-virtual-g05Cx3z9.js → vendor-tanstack-react-virtual-ClYN8CzB.js} +1 -1
- package/dist/assets/{vendor-tanstack-virtual-core-Dubg10g5.js → vendor-tanstack-virtual-core-BewVQryB.js} +1 -1
- package/dist/assets/{vendor-zod-B6551dwG.js → vendor-zod-CgAdXWZO.js} +4 -4
- package/dist/assets/{web-components-B_Z64So5.js → web-components-DxX8bZ1o.js} +2 -2
- package/dist/assets/zh-CN-CVZG_o_J.js +16 -0
- package/dist/assets/zh-TW-D5ZxzCZp.js +16 -0
- package/dist/index.html +6 -4
- package/dist/mini-chat.html +6 -4
- package/dist/mobile.html +6 -4
- package/package.json +12 -9
- package/server/built-in-extensions/registry.json +4 -0
- package/server/index.d.ts +2 -0
- package/server/index.js +44 -10
- package/server/lib/agent-tool/DOCUMENTATION.md +17 -4
- package/server/lib/agent-tool/runtime.js +62 -15
- package/server/lib/agent-tool/runtime.test.js +88 -2
- package/server/lib/changelog/update-notes.js +2 -1
- package/server/lib/changelog/update-notes.test.js +19 -0
- package/server/lib/event-stream/DOCUMENTATION.md +23 -0
- package/server/lib/event-stream/delta-coalescer.js +0 -0
- package/server/lib/event-stream/delta-coalescer.test.js +292 -0
- package/server/lib/event-stream/global-hub.js +53 -23
- package/server/lib/event-stream/global-hub.test.js +160 -0
- package/server/lib/event-stream/global-ws-bridge.js +1 -0
- package/server/lib/event-stream/index.js +4 -0
- package/server/lib/fs/DOCUMENTATION.md +10 -1
- package/server/lib/fs/git-process.test.js +77 -0
- package/server/lib/fs/routes.js +58 -5
- package/server/lib/fs/routes.test.js +116 -0
- package/server/lib/fs/search.js +2 -1
- package/server/lib/git/DOCUMENTATION.md +20 -5
- package/server/lib/git/routes.js +16 -3
- package/server/lib/git/serial-refresh.js +93 -0
- package/server/lib/git/serial-refresh.test.js +112 -0
- package/server/lib/git/service.js +429 -70
- package/server/lib/git/service.test.js +418 -0
- package/server/lib/github/pr-status.js +5 -5
- package/server/lib/github/pr-status.test.js +1 -1
- package/server/lib/github/routes.js +4 -4
- package/server/lib/guests/DOCUMENTATION.md +68 -0
- package/server/lib/guests/auth-store.js +184 -0
- package/server/lib/guests/auth-store.test.js +112 -0
- package/server/lib/guests/background.test.js +83 -0
- package/server/lib/guests/builtins.js +34 -0
- package/server/lib/guests/builtins.test.js +174 -0
- package/server/lib/guests/catalog.js +477 -0
- package/server/lib/guests/catalog.test.js +390 -0
- package/server/lib/guests/clone.js +297 -0
- package/server/lib/guests/extract-zip.js +136 -0
- package/server/lib/guests/extract-zip.test.js +109 -0
- package/server/lib/guests/files.js +308 -0
- package/server/lib/guests/files.test.js +262 -0
- package/server/lib/guests/grant-scope.js +81 -0
- package/server/lib/guests/grant-scope.test.js +75 -0
- package/server/lib/guests/host-session.js +73 -0
- package/server/lib/guests/host-session.test.js +30 -0
- package/server/lib/guests/html-styles.js +6 -0
- package/server/lib/guests/html-styles.test.js +45 -0
- package/server/lib/guests/html-tokens.js +73 -0
- package/server/lib/guests/html-tokens.test.js +53 -0
- package/server/lib/guests/install.js +406 -0
- package/server/lib/guests/install.test.js +338 -0
- package/server/lib/guests/oauth.js +501 -0
- package/server/lib/guests/oauth.test.js +481 -0
- package/server/lib/guests/persist.js +336 -0
- package/server/lib/guests/persist.test.js +288 -0
- package/server/lib/guests/request.js +112 -0
- package/server/lib/guests/request.test.js +206 -0
- package/server/lib/guests/routes.js +838 -0
- package/server/lib/guests/service.js +538 -0
- package/server/lib/guests/service.test.js +277 -0
- package/server/lib/guests/sockets.js +129 -0
- package/server/lib/guests/sockets.test.js +110 -0
- package/server/lib/guests/ssh-install.test.js +188 -0
- package/server/lib/guests/storage.js +68 -0
- package/server/lib/guests/storage.test.js +59 -0
- package/server/lib/guests/updates.js +294 -0
- package/server/lib/guests/updates.test.js +334 -0
- package/server/lib/guests/upload.js +50 -0
- package/server/lib/guests/upload.test.js +131 -0
- package/server/lib/linear/DOCUMENTATION.md +1 -1
- package/server/lib/message-queue/DOCUMENTATION.md +10 -1
- package/server/lib/message-queue/runtime.js +21 -1
- package/server/lib/message-queue/runtime.test.js +52 -5
- package/server/lib/notifications/routes.js +5 -0
- package/server/lib/openchamber-control/DOCUMENTATION.md +6 -0
- package/server/lib/openchamber-sessions/routes.js +62 -29
- package/server/lib/openchamber-sessions/routes.test.js +96 -0
- package/server/lib/opencode/DOCUMENTATION.md +55 -1
- package/server/lib/opencode/bootstrap-runtime.js +1 -0
- package/server/lib/opencode/core-routes.js +39 -1
- package/server/lib/opencode/feature-routes-runtime.js +15 -0
- package/server/lib/opencode/lifecycle-process.test.js +84 -0
- package/server/lib/opencode/lifecycle.js +54 -67
- package/server/lib/opencode/openchamber-routes.js +72 -14
- package/server/lib/opencode/openchamber-routes.test.js +71 -3
- package/server/lib/opencode/session-runtime.js +68 -0
- package/server/lib/opencode/session-runtime.test.js +43 -0
- package/server/lib/opencode/settings-helpers.js +8 -0
- package/server/lib/opencode/settings-helpers.test.js +13 -1
- package/server/lib/opencode/settings-normalization-runtime.js +2 -0
- package/server/lib/opencode/settings-normalization-runtime.test.js +13 -0
- package/server/lib/opencode/settings-registry.json +15 -0
- package/server/lib/opencode/shutdown-runtime.js +3 -0
- package/server/lib/opencode/shutdown-runtime.test.js +24 -0
- package/server/lib/opencode/theme-archive.js +53 -0
- package/server/lib/opencode/theme-catalog.js +171 -0
- package/server/lib/opencode/theme-catalog.test.js +125 -0
- package/server/lib/opencode/theme-import.test.js +144 -0
- package/server/lib/opencode/theme-runtime.js +100 -28
- package/server/lib/opencode/theme-runtime.test.js +15 -0
- package/server/lib/permission-auto-accept/DOCUMENTATION.md +8 -0
- package/server/lib/permission-auto-accept/runtime.js +13 -0
- package/server/lib/permission-auto-accept/runtime.test.js +37 -1
- package/server/lib/projects/project-config.js +2 -2
- package/server/lib/quota/DOCUMENTATION.md +0 -1
- package/server/lib/quota/providers/index.js +0 -7
- package/server/lib/realtime-proxy-terminal.test.js +150 -0
- package/server/lib/realtime-proxy.js +2 -0
- package/server/lib/routing/DOCUMENTATION.md +83 -0
- package/server/lib/routing/defaults.js +98 -0
- package/server/lib/routing/feature-flag.js +11 -0
- package/server/lib/routing/history.js +34 -0
- package/server/lib/routing/jev.js +98 -0
- package/server/lib/routing/routes.http.test.js +100 -0
- package/server/lib/routing/routes.js +81 -0
- package/server/lib/routing/runtime.js +217 -0
- package/server/lib/routing/runtime.test.js +188 -0
- package/server/lib/routing/store.js +249 -0
- package/server/lib/routing/store.test.js +96 -0
- package/server/lib/scheduled-tasks/runtime.js +2 -2
- package/server/lib/scheduled-tasks/runtime.test.js +14 -0
- package/server/lib/security/request-security.js +9 -5
- package/server/lib/security/request-security.test.js +37 -0
- package/server/lib/small-model/DOCUMENTATION.md +14 -2
- package/server/lib/small-model/call.js +37 -6
- package/server/lib/small-model/call.test.js +182 -0
- package/server/lib/terminal/DOCUMENTATION.md +23 -2
- package/server/lib/terminal/runtime.js +27 -5
- package/server/lib/terminal/runtime.test.js +67 -0
- package/server/lib/terminal/shutdown.js +106 -0
- package/server/lib/terminal/shutdown.test.js +84 -0
- package/server/lib/tts/service.test.js +78 -0
- package/server/lib/ui-auth/DOCUMENTATION.md +8 -0
- package/server/lib/ui-auth/session-cookie.js +51 -0
- package/server/lib/ui-auth/session-cookie.test.js +46 -0
- package/server/lib/ui-auth/ui-auth.js +56 -17
- package/server/lib/ui-auth/ui-auth.test.js +96 -0
- package/dist/assets/DiffView-CyLmb-wF.js +0 -4
- package/dist/assets/DirtyBranchSwitchDialog-pu5kcoir.js +0 -1
- package/dist/assets/FilesView-WtJB0y_l.js +0 -13
- package/dist/assets/GitView-DkNrV0BK.js +0 -6
- package/dist/assets/LinearIssuesView-B0H0Otii.js +0 -1
- package/dist/assets/MarkdownRendererImpl-DSqVN2d8.js +0 -12
- package/dist/assets/PierreDiffViewer-Bsq9z-sw.js +0 -161
- package/dist/assets/PlanView-CAFziKH5.js +0 -5
- package/dist/assets/SettingsView-BRittavZ.js +0 -28
- package/dist/assets/ToolOutputDialog-B0uYaJio.js +0 -15
- package/dist/assets/appThemeRegistry-BK0dHKa6.js +0 -1
- package/dist/assets/de-c7CYLCAW.js +0 -10
- package/dist/assets/es-BKAVPQmQ.js +0 -16
- package/dist/assets/fr-Bj1glqfV.js +0 -14
- package/dist/assets/index-BYFyOu_D.css +0 -1
- package/dist/assets/index-BfwRClDe.js +0 -40
- package/dist/assets/ja-5jwSIbK0.js +0 -16
- package/dist/assets/ko-BaDbg-Eb.js +0 -16
- package/dist/assets/main-CGG2_uHq.js +0 -2
- package/dist/assets/main-CcrSaL4J.js +0 -930
- package/dist/assets/markdownCore-DsmQr3bt.js +0 -5
- package/dist/assets/miniChat-DEaAhP4b.js +0 -2
- package/dist/assets/mobile-BC3rsvv0.js +0 -2
- package/dist/assets/pl-BFKVBDFu.js +0 -16
- package/dist/assets/pt-BR-qKfHvkDL.js +0 -16
- package/dist/assets/registerCustomTheme-BBXUCRnG.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-CR9d1Mr0.js +0 -2
- package/dist/assets/renderMobileApp-Da5dwobZ.js +0 -25
- package/dist/assets/runtimeEndpointReset-CLYVRw2H.js +0 -41
- package/dist/assets/shikiHighlight-D1Z9G58W.js +0 -1
- package/dist/assets/tr-DYXPoEDG.js +0 -7
- package/dist/assets/uk-CwAoloR8.js +0 -16
- package/dist/assets/useAppFontEffects-DeStGcUT.js +0 -7282
- package/dist/assets/useGitComparison-CpxioduU.js +0 -1
- package/dist/assets/useInlineCommentController-gmUnJtrb.js +0 -2
- package/dist/assets/useRootScrollLock--a3cPz8s.js +0 -1
- package/dist/assets/vendor-framer-motion-livSKyyV.js +0 -1
- package/dist/assets/zh-CN-D9MG0lqF.js +0 -16
- package/dist/assets/zh-TW-1HNK7shh.js +0 -16
- package/server/lib/quota/providers/crof.js +0 -96
- package/server/lib/quota/providers/crof.test.js +0 -98
- /package/dist/assets/{vendor-katex-k3Ppq1Ha.js → vendor-katex-CHD9BdDO.js} +0 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
import { spawnSync } from 'node:child_process';
|
|
7
|
+
|
|
8
|
+
import { listInstalledGuests } from './catalog.js';
|
|
9
|
+
import { buildStoreZip } from './extract-zip.test.js';
|
|
10
|
+
import { gitNetworkArgs } from './clone.js';
|
|
11
|
+
import {
|
|
12
|
+
downloadZip,
|
|
13
|
+
installGuestFromGitSource,
|
|
14
|
+
installGuestFromPath,
|
|
15
|
+
installGuestFromUrl,
|
|
16
|
+
parseInstallRequest,
|
|
17
|
+
uninstallGuest,
|
|
18
|
+
} from './install.js';
|
|
19
|
+
import { guestCopiesDir } from './persist.js';
|
|
20
|
+
|
|
21
|
+
const writeGuest = async (root, id) => {
|
|
22
|
+
await fs.mkdir(path.join(root, 'panel'), { recursive: true });
|
|
23
|
+
await fs.writeFile(path.join(root, 'panel', 'index.html'), '<html></html>');
|
|
24
|
+
await fs.writeFile(path.join(root, 'package.json'), JSON.stringify({
|
|
25
|
+
name: `@openchamber/${id}`,
|
|
26
|
+
version: '1.0.0',
|
|
27
|
+
openchamber: {
|
|
28
|
+
apiVersion: 1,
|
|
29
|
+
contributes: {
|
|
30
|
+
panel: { id, name: id, icon: 'window', entry: 'panel/index.html' },
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
describe('installGuestFromPath', () => {
|
|
37
|
+
test('installs a folder extension and refuses a second copy', async () => {
|
|
38
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'oc-ext-'));
|
|
39
|
+
const persistPath = path.join(dir, 'extensions.json');
|
|
40
|
+
const guestRoot = path.join(dir, 'clone');
|
|
41
|
+
await writeGuest(guestRoot, 'clone-hello');
|
|
42
|
+
|
|
43
|
+
expect(parseInstallRequest({ path: guestRoot })).toEqual({ path: guestRoot });
|
|
44
|
+
expect(parseInstallRequest({ url: 'https://github.com/acme/panel.git' })).toEqual({
|
|
45
|
+
url: 'https://github.com/acme/panel.git',
|
|
46
|
+
});
|
|
47
|
+
expect(parseInstallRequest({ path: guestRoot, replace: true })).toEqual({
|
|
48
|
+
path: guestRoot,
|
|
49
|
+
replace: true,
|
|
50
|
+
});
|
|
51
|
+
expect(parseInstallRequest({})).toBeNull();
|
|
52
|
+
expect(parseInstallRequest({ path: guestRoot, url: 'https://github.com/acme/panel.git' })).toBeNull();
|
|
53
|
+
|
|
54
|
+
const installed = await installGuestFromPath(guestRoot, persistPath);
|
|
55
|
+
expect(installed.ok).toBe(true);
|
|
56
|
+
if (!installed.ok) {
|
|
57
|
+
throw new Error('expected install');
|
|
58
|
+
}
|
|
59
|
+
expect(installed.guest.id).toBe('clone-hello');
|
|
60
|
+
expect(installed.guest.source).toBe('path');
|
|
61
|
+
|
|
62
|
+
const listed = await listInstalledGuests({ persistPath });
|
|
63
|
+
expect(listed.some((guest) => guest.id === 'clone-hello')).toBe(true);
|
|
64
|
+
|
|
65
|
+
const again = await installGuestFromPath(guestRoot, persistPath);
|
|
66
|
+
expect(again).toEqual({ ok: false, code: 'already-installed', id: 'clone-hello' });
|
|
67
|
+
|
|
68
|
+
const replacedSame = await installGuestFromPath(guestRoot, persistPath, { replace: true });
|
|
69
|
+
expect(replacedSame.ok).toBe(true);
|
|
70
|
+
if (!replacedSame.ok) {
|
|
71
|
+
throw new Error('expected replace');
|
|
72
|
+
}
|
|
73
|
+
expect(replacedSame.replaced).toBe(true);
|
|
74
|
+
|
|
75
|
+
const otherRoot = path.join(dir, 'other');
|
|
76
|
+
await writeGuest(otherRoot, 'clone-hello');
|
|
77
|
+
const taken = await installGuestFromPath(otherRoot, persistPath);
|
|
78
|
+
expect(taken).toEqual({ ok: false, code: 'id-taken', id: 'clone-hello' });
|
|
79
|
+
|
|
80
|
+
const replacedOther = await installGuestFromPath(otherRoot, persistPath, { replace: true });
|
|
81
|
+
expect(replacedOther.ok).toBe(true);
|
|
82
|
+
if (!replacedOther.ok) {
|
|
83
|
+
throw new Error('expected replace other');
|
|
84
|
+
}
|
|
85
|
+
expect(replacedOther.replaced).toBe(true);
|
|
86
|
+
expect(replacedOther.guest.path).toBe(await fs.realpath(otherRoot));
|
|
87
|
+
|
|
88
|
+
const relative = await installGuestFromPath('clone', persistPath);
|
|
89
|
+
expect(relative).toEqual({ ok: false, code: 'invalid-path' });
|
|
90
|
+
|
|
91
|
+
const badIdRoot = path.join(dir, 'bad-id');
|
|
92
|
+
await writeGuest(badIdRoot, 'Not Kebab');
|
|
93
|
+
const badId = await installGuestFromPath(badIdRoot, persistPath);
|
|
94
|
+
expect(badId).toEqual({ ok: false, code: 'invalid-manifest' });
|
|
95
|
+
|
|
96
|
+
const removed = await uninstallGuest('clone-hello', persistPath);
|
|
97
|
+
expect(removed).toEqual({ ok: true });
|
|
98
|
+
const after = await listInstalledGuests({ persistPath });
|
|
99
|
+
expect(after.some((guest) => guest.id === 'clone-hello')).toBe(false);
|
|
100
|
+
|
|
101
|
+
const missing = await uninstallGuest('hello', persistPath);
|
|
102
|
+
expect(missing).toEqual({ ok: false, code: 'not-found' });
|
|
103
|
+
|
|
104
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('refuses a panel that has TypeScript but no built script', async () => {
|
|
108
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'oc-ext-'));
|
|
109
|
+
const persistPath = path.join(dir, 'extensions.json');
|
|
110
|
+
const guestRoot = path.join(dir, 'source-only');
|
|
111
|
+
await fs.mkdir(path.join(guestRoot, 'panel'), { recursive: true });
|
|
112
|
+
await fs.writeFile(path.join(guestRoot, 'panel', 'index.html'), '<script src="./main.js"></script>');
|
|
113
|
+
await fs.writeFile(path.join(guestRoot, 'panel', 'main.ts'), 'console.log(1)');
|
|
114
|
+
await fs.writeFile(path.join(guestRoot, 'package.json'), JSON.stringify({
|
|
115
|
+
name: '@openchamber/source-only',
|
|
116
|
+
version: '1.0.0',
|
|
117
|
+
openchamber: {
|
|
118
|
+
apiVersion: 1,
|
|
119
|
+
contributes: {
|
|
120
|
+
panel: { id: 'source-only', name: 'Source', icon: 'window', entry: 'panel/index.html' },
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
}));
|
|
124
|
+
const missing = await installGuestFromPath(guestRoot, persistPath);
|
|
125
|
+
expect(missing).toEqual({ ok: false, code: 'missing-build' });
|
|
126
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('refuses engines.openchamber newer than the host', async () => {
|
|
130
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'oc-ext-'));
|
|
131
|
+
const persistPath = path.join(dir, 'extensions.json');
|
|
132
|
+
const guestRoot = path.join(dir, 'future');
|
|
133
|
+
await fs.mkdir(path.join(guestRoot, 'panel'), { recursive: true });
|
|
134
|
+
await fs.writeFile(path.join(guestRoot, 'panel', 'index.html'), '<html></html>');
|
|
135
|
+
await fs.writeFile(path.join(guestRoot, 'package.json'), JSON.stringify({
|
|
136
|
+
name: '@openchamber/future',
|
|
137
|
+
version: '1.0.0',
|
|
138
|
+
openchamber: {
|
|
139
|
+
apiVersion: 1,
|
|
140
|
+
engines: { openchamber: '>=9.9.9' },
|
|
141
|
+
contributes: {
|
|
142
|
+
panel: { id: 'future', name: 'Future', icon: 'window', entry: 'panel/index.html' },
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
}));
|
|
146
|
+
|
|
147
|
+
const refused = await installGuestFromPath(guestRoot, persistPath, { openchamberVersion: '1.22.0' });
|
|
148
|
+
expect(refused).toEqual({ ok: false, code: 'host-too-old', required: '9.9.9' });
|
|
149
|
+
|
|
150
|
+
const allowed = await installGuestFromPath(guestRoot, persistPath, { openchamberVersion: '9.9.9' });
|
|
151
|
+
expect(allowed.ok).toBe(true);
|
|
152
|
+
|
|
153
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test('keeps two instance catalogs apart', async () => {
|
|
157
|
+
const parent = await fs.mkdtemp(path.join(os.tmpdir(), 'oc-ext-'));
|
|
158
|
+
const persistA = path.join(parent, 'a', 'extensions.json');
|
|
159
|
+
const persistB = path.join(parent, 'b', 'extensions.json');
|
|
160
|
+
const guestRoot = path.join(parent, 'clone');
|
|
161
|
+
await writeGuest(guestRoot, 'clone-hello');
|
|
162
|
+
|
|
163
|
+
const installed = await installGuestFromPath(guestRoot, persistA);
|
|
164
|
+
expect(installed.ok).toBe(true);
|
|
165
|
+
expect(await listInstalledGuests({ persistPath: persistB })).toEqual([]);
|
|
166
|
+
expect((await listInstalledGuests({ persistPath: persistA })).some((guest) => guest.id === 'clone-hello')).toBe(true);
|
|
167
|
+
|
|
168
|
+
await fs.rm(parent, { recursive: true, force: true });
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test('installs a zip and deletes the copy on uninstall', async () => {
|
|
172
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'oc-ext-'));
|
|
173
|
+
const persistPath = path.join(dir, 'extensions.json');
|
|
174
|
+
const zipPath = path.join(dir, 'panel.zip');
|
|
175
|
+
await fs.writeFile(zipPath, buildStoreZip([
|
|
176
|
+
{ name: 'package.json', data: JSON.stringify({
|
|
177
|
+
name: '@openchamber/zip-hello',
|
|
178
|
+
version: '1.0.0',
|
|
179
|
+
openchamber: {
|
|
180
|
+
apiVersion: 1,
|
|
181
|
+
contributes: {
|
|
182
|
+
panel: { id: 'zip-hello', name: 'Zip', icon: 'window', entry: 'panel/index.html' },
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
}) },
|
|
186
|
+
{ name: 'panel/index.html', data: '<html></html>' },
|
|
187
|
+
]));
|
|
188
|
+
|
|
189
|
+
const installed = await installGuestFromPath(zipPath, persistPath);
|
|
190
|
+
expect(installed.ok).toBe(true);
|
|
191
|
+
if (!installed.ok) {
|
|
192
|
+
throw new Error('expected zip install');
|
|
193
|
+
}
|
|
194
|
+
expect(installed.guest.id).toBe('zip-hello');
|
|
195
|
+
expect(installed.guest.source).toBe('zip');
|
|
196
|
+
const copy = path.join(guestCopiesDir(persistPath), 'zip-hello');
|
|
197
|
+
expect(await fs.stat(copy).then((stat) => stat.isDirectory())).toBe(true);
|
|
198
|
+
|
|
199
|
+
const removed = await uninstallGuest('zip-hello', persistPath);
|
|
200
|
+
expect(removed).toEqual({ ok: true });
|
|
201
|
+
expect(await fs.stat(copy).then(() => true).catch(() => false)).toBe(false);
|
|
202
|
+
expect(await fs.stat(zipPath).then((stat) => stat.isFile())).toBe(true);
|
|
203
|
+
|
|
204
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
describe('installGuestFromUrl', () => {
|
|
209
|
+
test('refuses a non-https url', async () => {
|
|
210
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'oc-ext-'));
|
|
211
|
+
const persistPath = path.join(dir, 'extensions.json');
|
|
212
|
+
expect(await installGuestFromUrl('http://example.com/panel.git', persistPath)).toEqual({
|
|
213
|
+
ok: false,
|
|
214
|
+
code: 'invalid-url',
|
|
215
|
+
});
|
|
216
|
+
for (const privateUrl of [
|
|
217
|
+
'https://127.0.0.1/panel.git',
|
|
218
|
+
'https://localhost/panel.zip',
|
|
219
|
+
'https://10.0.0.5/panel.git',
|
|
220
|
+
'https://192.168.1.2/panel.zip',
|
|
221
|
+
'https://[::1]/panel.git',
|
|
222
|
+
'https://user:pass@example.com/panel.git',
|
|
223
|
+
]) {
|
|
224
|
+
expect(await installGuestFromUrl(privateUrl, persistPath)).toEqual({ ok: false, code: 'invalid-url' });
|
|
225
|
+
}
|
|
226
|
+
expect(await installGuestFromUrl('ftp://example.com/panel.git', persistPath)).toEqual({
|
|
227
|
+
ok: false,
|
|
228
|
+
code: 'invalid-url',
|
|
229
|
+
});
|
|
230
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
describe('installGuestFromGitSource', () => {
|
|
235
|
+
test('clones a local repo and deletes the copy on uninstall', async () => {
|
|
236
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'oc-ext-'));
|
|
237
|
+
const persistPath = path.join(dir, 'extensions.json');
|
|
238
|
+
const repo = path.join(dir, 'repo');
|
|
239
|
+
await writeGuest(repo, 'git-hello');
|
|
240
|
+
const git = (args) => {
|
|
241
|
+
const result = spawnSync('git', args, {
|
|
242
|
+
cwd: repo,
|
|
243
|
+
encoding: 'utf8',
|
|
244
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
|
|
245
|
+
});
|
|
246
|
+
if (result.status !== 0) {
|
|
247
|
+
throw new Error(result.stderr || 'git failed');
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
git(['init', '--template=']);
|
|
251
|
+
git(['add', '.']);
|
|
252
|
+
git(['-c', 'user.name=test', '-c', 'user.email=test@example.com', 'commit', '-m', 'init']);
|
|
253
|
+
|
|
254
|
+
const installed = await installGuestFromGitSource(repo, persistPath);
|
|
255
|
+
expect(installed.ok).toBe(true);
|
|
256
|
+
if (!installed.ok) {
|
|
257
|
+
throw new Error('expected git install');
|
|
258
|
+
}
|
|
259
|
+
expect(installed.guest.id).toBe('git-hello');
|
|
260
|
+
expect(installed.guest.source).toBe('git');
|
|
261
|
+
const copy = path.join(guestCopiesDir(persistPath), 'git-hello');
|
|
262
|
+
expect(await fs.stat(copy).then((stat) => stat.isDirectory())).toBe(true);
|
|
263
|
+
expect(await fs.stat(path.join(repo, 'package.json')).then((stat) => stat.isFile())).toBe(true);
|
|
264
|
+
|
|
265
|
+
const removed = await uninstallGuest('git-hello', persistPath);
|
|
266
|
+
expect(removed).toEqual({ ok: true });
|
|
267
|
+
expect(await fs.stat(copy).then(() => true).catch(() => false)).toBe(false);
|
|
268
|
+
expect(await fs.stat(path.join(repo, 'package.json')).then((stat) => stat.isFile())).toBe(true);
|
|
269
|
+
|
|
270
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
describe('downloadZip', () => {
|
|
275
|
+
const publicLookup = async () => [{ address: '93.184.216.34' }];
|
|
276
|
+
|
|
277
|
+
test('follows a public redirect by hand, pinned to the checked address, and returns the bytes', async () => {
|
|
278
|
+
const seen = [];
|
|
279
|
+
const request = async (url, target) => {
|
|
280
|
+
seen.push({ url, address: target.address });
|
|
281
|
+
if (url === 'https://example.com/panel.zip') {
|
|
282
|
+
return { status: 302, location: 'https://cdn.example.com/signed/abc', body: null };
|
|
283
|
+
}
|
|
284
|
+
return { status: 200, location: null, body: Buffer.from([1, 2, 3]) };
|
|
285
|
+
};
|
|
286
|
+
const bytes = await downloadZip('https://example.com/panel.zip', { request, lookup: publicLookup });
|
|
287
|
+
expect(bytes && [...bytes]).toEqual([1, 2, 3]);
|
|
288
|
+
expect(seen).toEqual([
|
|
289
|
+
{ url: 'https://example.com/panel.zip', address: '93.184.216.34' },
|
|
290
|
+
{ url: 'https://cdn.example.com/signed/abc', address: '93.184.216.34' },
|
|
291
|
+
]);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
test('refuses a redirect to a private or non-https address before requesting it', async () => {
|
|
295
|
+
for (const location of ['http://127.0.0.1:8080/panel.zip', 'https://localhost/panel.zip', 'https://10.0.0.5/x.zip', 'http://example.com/panel.zip']) {
|
|
296
|
+
const requested = [];
|
|
297
|
+
const request = async (url) => {
|
|
298
|
+
requested.push(url);
|
|
299
|
+
return { status: 302, location, body: null };
|
|
300
|
+
};
|
|
301
|
+
expect(await downloadZip('https://example.com/panel.zip', { request, lookup: publicLookup })).toBeNull();
|
|
302
|
+
expect(requested).toEqual(['https://example.com/panel.zip']);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
test('refuses a public name that resolves to a private address', async () => {
|
|
307
|
+
let requested = 0;
|
|
308
|
+
const request = async () => {
|
|
309
|
+
requested += 1;
|
|
310
|
+
return { status: 200, location: null, body: Buffer.from([1]) };
|
|
311
|
+
};
|
|
312
|
+
const lookup = async () => [{ address: '93.184.216.34' }, { address: '10.1.1.1' }];
|
|
313
|
+
expect(await downloadZip('https://example.com/panel.zip', { request, lookup })).toBeNull();
|
|
314
|
+
expect(requested).toBe(0);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
test('gives up after too many redirects', async () => {
|
|
318
|
+
let hops = 0;
|
|
319
|
+
const request = async (url) => {
|
|
320
|
+
hops += 1;
|
|
321
|
+
return { status: 302, location: `${url}0`, body: null };
|
|
322
|
+
};
|
|
323
|
+
expect(await downloadZip('https://example.com/panel.zip', { request, lookup: publicLookup })).toBeNull();
|
|
324
|
+
expect(hops).toBeLessThanOrEqual(6);
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
describe('gitNetworkArgs', () => {
|
|
329
|
+
test('pins a public https host to its resolved addresses and forbids redirects', async () => {
|
|
330
|
+
const lookup = async () => [{ address: '93.184.216.34' }, { address: '2606:2800:220:1:248:1893:25c8:1946' }];
|
|
331
|
+
expect(await gitNetworkArgs('https://example.com/org/panel.git', lookup)).toEqual([
|
|
332
|
+
'-c', 'http.followRedirects=false',
|
|
333
|
+
'-c', 'http.curloptResolve=example.com:443:93.184.216.34,2606:2800:220:1:248:1893:25c8:1946',
|
|
334
|
+
]);
|
|
335
|
+
expect(await gitNetworkArgs('https://example.com/org/panel.git', async () => [{ address: '127.0.0.1' }])).toBeNull();
|
|
336
|
+
expect(await gitNetworkArgs('/tmp/local/repo')).toEqual([]);
|
|
337
|
+
});
|
|
338
|
+
});
|