@pi-chamber/web 1.0.3-rc.1 → 1.0.4-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/DiagramView-DfZMQkXY.js +1 -0
- package/dist/assets/{DiffView-CXg8TAtI.js → DiffView-BjWUdbL5.js} +6 -6
- package/dist/assets/FileSaveConflictDialog-u5L4k_5k.js +3 -0
- package/dist/assets/FilesView-qP1ypN9J.js +6 -0
- package/dist/assets/GitHubDetailScaffold-zCKCy5OJ.js +11 -0
- package/dist/assets/GitHubLinkPicker-CwxKY3lN.js +1 -0
- package/dist/assets/GitHubListPrimitives-Ck3zllel.js +1 -0
- package/dist/assets/GitView-y2k2i4gR.js +9 -0
- package/dist/assets/IssuesSurface-HWgR87N3.js +7 -0
- package/dist/assets/JsonTreeView-DSuC4naV.js +1 -0
- package/dist/assets/{MarkdownRendererImpl-CeYMkg1A.js → MarkdownRendererImpl-CT5ln9em.js} +5 -5
- package/dist/assets/PatchDiff-DArTeWeK.js +1 -0
- package/dist/assets/PierreDiffViewer-DQKujzLb.js +134 -0
- package/dist/assets/PullRequestsSurface-Cfb1wSvC.js +2 -0
- package/dist/assets/SessionSwitcherContent-DEGJyZBl.js +1 -0
- package/dist/assets/SessionSwitcherDropdown-cC9wVBH7.js +2 -0
- package/dist/assets/SessionUnreadDot-CELKNVIM.js +1 -0
- package/dist/assets/SettingsView-CZvRRgJe.js +6 -0
- package/dist/assets/SettingsWindow-CZM1dmVb.js +1 -0
- package/dist/assets/ToolOutputDialog-DClOSbJc.js +8 -0
- package/dist/assets/ToolPartDiffPreview-BaFiGUDE.js +1 -0
- package/dist/assets/{VirtualizedFileDiff-CV_Cpmqu.js → VirtualizedFileDiff-D6KbvKc6.js} +3 -3
- package/dist/assets/Virtualizer-wpC51ZBQ.js +1 -0
- package/dist/assets/collapsible-DhV9d4dT.js +1 -0
- package/dist/assets/computeVirtualFileMetrics-CeMpF2xC.js +3 -0
- package/dist/assets/{contextFileOpenGuard-BA2pkQY_.js → contextFileOpenGuard-Ck5u_kAP.js} +1 -1
- package/dist/assets/gitStatusPredicates-DEBSqUNE.js +1 -0
- package/dist/assets/githubLink-DT7i2NlH.js +10 -0
- package/dist/assets/index-6IO1AcJI.js +10 -0
- package/dist/assets/index-BAmzAlNx.css +1 -0
- package/dist/assets/index-eDf4LKLY.js +1 -0
- package/dist/assets/main-BczEScAA.js +2 -0
- package/dist/assets/main-CHLNMYeJ.js +136 -0
- package/dist/assets/markdownCore-C4Gk5Zht.js +2 -0
- package/dist/assets/miniChat-Do3hE87Z.js +2 -0
- package/dist/assets/mobile-CTnihwfa.js +2 -0
- package/dist/assets/permissionStore-B9Hkrqny.js +1 -0
- package/dist/assets/pi-session-focus-preference-LDVCJ_YR.js +10 -0
- package/dist/assets/renderDiffWithHighlighter-CDsgOnkH.js +1 -0
- package/dist/assets/renderElectronMiniChatApp-DSa3gYqR.js +2 -0
- package/dist/assets/renderFileWithHighlighter-TpKRyfCY.js +1 -0
- package/dist/assets/renderMobileApp-CPE-3uMl.js +11 -0
- package/dist/assets/runtimeEndpointReset-CzJfovWI.js +62 -0
- package/dist/assets/{runtimeSurface-BdndJV2m.js → runtimeSurface-DW_Ia4q3.js} +1 -1
- package/dist/assets/shell-CjFT_Tl9.js +1 -0
- package/dist/assets/sprite-HGQGInUp.js +6510 -0
- package/dist/assets/useAppFontEffects-CG3_yteE.js +212 -0
- package/dist/assets/{useFilesViewSearch-CI5Gy1cp.js → useFilesViewSearch-C_LzYIgD.js} +1 -1
- package/dist/assets/useGitHubRemoteSearch-DsxWOzKZ.js +1 -0
- package/dist/assets/useSwitcherItems-BmoCnS9W.js +1 -0
- package/dist/assets/vendor-base-ui-DIkTOIJS.js +1 -0
- package/dist/assets/{vendor-beautiful-mermaid-D3YCkKz7.js → vendor-beautiful-mermaid-DApbjBp2.js} +1 -1
- package/dist/assets/vendor-boot-DyL2td56.js +69 -0
- package/dist/assets/vendor-codemirror-autocomplete-DsFn4GLp.js +1 -0
- package/dist/assets/vendor-codemirror-lang-angular-B_NMmBbS.js +1 -0
- package/dist/assets/vendor-codemirror-lang-cpp-GOE7Gjd0.js +1 -0
- package/dist/assets/vendor-codemirror-lang-css-Dwf2XpnZ.js +1 -0
- package/dist/assets/vendor-codemirror-lang-go-C2KHbcll.js +7 -0
- package/dist/assets/vendor-codemirror-lang-html-DcKqyeGk.js +1 -0
- package/dist/assets/vendor-codemirror-lang-java-6eGbyB2k.js +1 -0
- package/dist/assets/vendor-codemirror-lang-javascript-DpTUrvx8.js +13 -0
- package/dist/assets/vendor-codemirror-lang-jinja-xSUJjXhr.js +1 -0
- package/dist/assets/vendor-codemirror-lang-json-CLGxdOCz.js +1 -0
- package/dist/assets/vendor-codemirror-lang-less-6nXi1rS9.js +1 -0
- package/dist/assets/vendor-codemirror-lang-liquid-B9hmb9P8.js +1 -0
- package/dist/assets/vendor-codemirror-lang-markdown-DmFP9s6x.js +1 -0
- package/dist/assets/vendor-codemirror-lang-php-DC6To8iX.js +1 -0
- package/dist/assets/vendor-codemirror-lang-python-yuxIkjit.js +3 -0
- package/dist/assets/vendor-codemirror-lang-rust-di1Sjz-0.js +1 -0
- package/dist/assets/vendor-codemirror-lang-sass-BWpV9NPV.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-sql-HpQWHJjv.js → vendor-codemirror-lang-sql-C_RazIaB.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-vue-BYL0r7KR.js +1 -0
- package/dist/assets/vendor-codemirror-lang-wast-BiVarhcz.js +1 -0
- package/dist/assets/vendor-codemirror-lang-xml-Cn1lY1ts.js +1 -0
- package/dist/assets/vendor-codemirror-lang-yaml-BZ6mZw9L.js +1 -0
- package/dist/assets/vendor-codemirror-language-data-DglcKYWT.js +2 -0
- package/dist/assets/vendor-codemirror-search-DaE6R5gH.js +2 -0
- package/dist/assets/{vendor-elkjs-mzfkf0ML.js → vendor-elkjs-D27273Ms.js} +1 -1
- package/dist/assets/{vendor-heic2any-BHsbokcA.js → vendor-heic2any-pq-UTQQR.js} +1 -1
- package/dist/assets/vendor-lezer-cpp-Dt99h3WT.js +1 -0
- package/dist/assets/vendor-lezer-css-DNU_fzPI.js +1 -0
- package/dist/assets/vendor-lezer-go-BEFtcNyS.js +1 -0
- package/dist/assets/vendor-lezer-html-DDGRhRUz.js +1 -0
- package/dist/assets/vendor-lezer-java-DmfZtW09.js +1 -0
- package/dist/assets/vendor-lezer-javascript-oje4tdp_.js +1 -0
- package/dist/assets/vendor-lezer-json-BRXb_bDX.js +1 -0
- package/dist/assets/vendor-lezer-lr-BU2qmu_5.js +1 -0
- package/dist/assets/{vendor-lezer-markdown-C6g-d6P3.js → vendor-lezer-markdown-CicYv7V9.js} +4 -4
- package/dist/assets/vendor-lezer-php-COORrTpE.js +1 -0
- package/dist/assets/vendor-lezer-python-Cuvm9X9Y.js +1 -0
- package/dist/assets/vendor-lezer-rust-C_zOfHbX.js +1 -0
- package/dist/assets/vendor-lezer-sass-DWP4w7O1.js +1 -0
- package/dist/assets/vendor-lezer-xml-Br6nOYeG.js +1 -0
- package/dist/assets/vendor-lezer-yaml-CYQmm6Sb.js +1 -0
- package/dist/assets/{vendor-lru_map-Cy8fTs3_.js → vendor-lru_map-DOPmc7GU.js} +1 -1
- package/dist/assets/{vendor-qrcode-B0KNSajT.js → vendor-qrcode-Dv4uniC1.js} +1 -1
- package/dist/assets/vendor-react-DASdDPIk.js +1 -0
- package/dist/assets/{vendor-react-drawio-BYDptOsj.js → vendor-react-drawio-Duu5LgQA.js} +1 -1
- package/dist/assets/{vendor-replit-codemirror-vim-DaSwPsXt.js → vendor-replit-codemirror-vim-CZy3BUVv.js} +15 -15
- package/dist/assets/vendor-zustand-CUi8eEds.js +6 -0
- package/dist/assets/{web-components-Cdnmh4Xb.js → web-components-CH3-XV-n.js} +4 -4
- package/dist/index.html +7 -9
- package/dist/mini-chat.html +6 -8
- package/dist/mobile.html +6 -8
- package/package.json +1 -1
- package/server/index.js +3 -1
- package/server/lib/fs/DOCUMENTATION.md +1 -1
- package/server/lib/fs/routes.js +1 -50
- package/server/lib/git/DOCUMENTATION.md +18 -11
- package/server/lib/git/index.js +8 -3
- package/server/lib/git/routes.js +0 -129
- package/server/lib/git/service.js +40 -152
- package/server/lib/git/service.test.js +42 -18
- package/server/lib/github/DOCUMENTATION.md +271 -0
- package/server/lib/github/cache.js +164 -0
- package/server/lib/github/checks.js +230 -0
- package/server/lib/github/client.js +305 -0
- package/server/lib/github/context.js +177 -0
- package/server/lib/github/contracts.test.js +235 -0
- package/server/lib/github/correctness.test.js +356 -0
- package/server/lib/github/credential.js +46 -0
- package/server/lib/github/errors.js +151 -0
- package/server/lib/github/gh-cli.js +336 -0
- package/server/lib/github/index.js +27 -0
- package/server/lib/github/issues.js +495 -0
- package/server/lib/github/pulls.js +699 -0
- package/server/lib/github/repo-scope.js +688 -0
- package/server/lib/github/routes.js +599 -0
- package/server/lib/github/security.test.js +275 -0
- package/server/lib/github/templates.js +153 -0
- package/server/lib/package-manager-detect-child.js +12 -0
- package/server/lib/package-manager.js +366 -92
- package/server/lib/package-manager.test.js +109 -0
- package/server/lib/pi/routes-extension-events.test.js +268 -4
- package/server/lib/pi/routes.js +109 -25
- package/server/lib/pi/routes.test.js +118 -0
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +5 -3
- package/server/lib/pi/session-daemon/extension-bridge-draft.test.js +222 -0
- package/server/lib/pi/session-daemon/extension-bridge.js +415 -42
- package/server/lib/pi/session-daemon/extension-name.js +87 -0
- package/server/lib/pi/session-daemon/extension-name.test.js +143 -0
- package/server/lib/pi/session-daemon/extension-theme.js +142 -0
- package/server/lib/pi/session-daemon/extension-theme.test.js +117 -0
- package/server/lib/pi/session-daemon/extension-tool-render.js +365 -0
- package/server/lib/pi/session-daemon/extension-tool-render.test.js +607 -0
- package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +322 -2
- package/server/lib/pi/session-daemon/session-daemon-list-live.test.js +244 -0
- package/server/lib/pi/session-daemon/session-daemon.js +204 -33
- package/server/lib/pi/session-daemon/session-daemon.test.js +218 -0
- package/server/lib/pi/ui-settings-store.js +1 -1
- package/server/lib/static-cache-control.js +18 -0
- package/server/lib/static-cache-control.test.js +25 -0
- package/server/lib/workspace/host.js +2 -0
- package/dist/assets/DiagramView-CXjieF51.js +0 -1
- package/dist/assets/FileSaveConflictDialog-a-HOCgyP.js +0 -3
- package/dist/assets/FilesView-Dcd9ltOX.js +0 -6
- package/dist/assets/GitView-DF2nsuSA.js +0 -8
- package/dist/assets/JsonTreeView-BRU2mRTd.js +0 -1
- package/dist/assets/PatchDiff-kSTpjhu6.js +0 -1
- package/dist/assets/SessionSwitcherContent-BsXDFt24.js +0 -1
- package/dist/assets/SessionSwitcherDropdown-D8fSObHr.js +0 -2
- package/dist/assets/SessionUnreadDot-BpsHyrri.js +0 -1
- package/dist/assets/SettingsView-OEl7QmXC.js +0 -6
- package/dist/assets/SettingsWindow-BMBCj_L_.js +0 -1
- package/dist/assets/ToolOutputDialog-KOVdmTqm.js +0 -8
- package/dist/assets/ToolPartDiffPreview-B9xuVvkm.js +0 -1
- package/dist/assets/Virtualizer-BSHVMKgK.js +0 -1
- package/dist/assets/collapsible-BH1vXEAI.js +0 -1
- package/dist/assets/computeVirtualFileMetrics-yHZbtf5H.js +0 -3
- package/dist/assets/gitStatusPredicates-CpGQLvMK.js +0 -134
- package/dist/assets/index-5fyXnZFi.css +0 -1
- package/dist/assets/index-C-sV_9sb.js +0 -8
- package/dist/assets/index-D_FGGnQQ.js +0 -1
- package/dist/assets/isDiffPlainText-BNyusJZz.js +0 -1
- package/dist/assets/isFilePlainText-CMAUe7qD.js +0 -1
- package/dist/assets/main-BMLgZ5yn.js +0 -2
- package/dist/assets/main-DNq1n9F_.js +0 -135
- package/dist/assets/markdownCore-CZWcaNr2.js +0 -3
- package/dist/assets/miniChat-B2AgUZqL.js +0 -2
- package/dist/assets/mobile-BsGiRUUg.js +0 -2
- package/dist/assets/permissionStore-iKN1K2_x.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-UV9dnnbf.js +0 -2
- package/dist/assets/renderMobileApp-BMifduGA.js +0 -11
- package/dist/assets/runtimeEndpointReset-CkvC02dQ.js +0 -53
- package/dist/assets/useAppFontEffects-CclUs9KY.js +0 -6722
- package/dist/assets/usePushVisibilityBeacon-aDmGZrTW.js +0 -10
- package/dist/assets/useSwitcherItems-BZKyNjhp.js +0 -1
- package/dist/assets/vendor-aria-hidden-DvXkyWUv.js +0 -1
- package/dist/assets/vendor-base-ui-DXSHfszQ.js +0 -1
- package/dist/assets/vendor-class-variance-authority-5VPnzWs2.js +0 -1
- package/dist/assets/vendor-cmdk-zXx6sGnS.js +0 -1
- package/dist/assets/vendor-codemirror-autocomplete-wd6iRebq.js +0 -1
- package/dist/assets/vendor-codemirror-commands-CNlncqrr.js +0 -1
- package/dist/assets/vendor-codemirror-lang-angular-DU_4KiiW.js +0 -1
- package/dist/assets/vendor-codemirror-lang-cpp-CmIT9Z5_.js +0 -1
- package/dist/assets/vendor-codemirror-lang-css-djiuoTi8.js +0 -1
- package/dist/assets/vendor-codemirror-lang-go-COZSwZYW.js +0 -7
- package/dist/assets/vendor-codemirror-lang-html-CKHqhW5R.js +0 -1
- package/dist/assets/vendor-codemirror-lang-java-CNMP5hyC.js +0 -1
- package/dist/assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js +0 -13
- package/dist/assets/vendor-codemirror-lang-jinja-DaKn_b1k.js +0 -1
- package/dist/assets/vendor-codemirror-lang-json-CZ07HmNC.js +0 -1
- package/dist/assets/vendor-codemirror-lang-less-wJdQiDBf.js +0 -1
- package/dist/assets/vendor-codemirror-lang-liquid-0z48Roi8.js +0 -1
- package/dist/assets/vendor-codemirror-lang-markdown-DtcZDGqe.js +0 -1
- package/dist/assets/vendor-codemirror-lang-php-W8plS-JQ.js +0 -1
- package/dist/assets/vendor-codemirror-lang-python-DzzokVau.js +0 -3
- package/dist/assets/vendor-codemirror-lang-rust-C4ulBVpf.js +0 -1
- package/dist/assets/vendor-codemirror-lang-sass-BkZJYEwS.js +0 -1
- package/dist/assets/vendor-codemirror-lang-vue-DiBPljCc.js +0 -1
- package/dist/assets/vendor-codemirror-lang-wast-DoABsogh.js +0 -1
- package/dist/assets/vendor-codemirror-lang-xml-BhLJhOCH.js +0 -1
- package/dist/assets/vendor-codemirror-lang-yaml-D95i1Y5R.js +0 -1
- package/dist/assets/vendor-codemirror-language-BByA_dGF.js +0 -3
- package/dist/assets/vendor-codemirror-language-data-C6LBD7qA.js +0 -2
- package/dist/assets/vendor-codemirror-search-BV44140v.js +0 -2
- package/dist/assets/vendor-codemirror-state-CNWM3Q8V.js +0 -5
- package/dist/assets/vendor-codemirror-view-Ct4T37Ue.js +0 -4
- package/dist/assets/vendor-crelt-C8TCjufn.js +0 -1
- package/dist/assets/vendor-detect-node-es-l0sNRNKZ.js +0 -1
- package/dist/assets/vendor-dnd-kit-accessibility-DZKKhs9S.js +0 -1
- package/dist/assets/vendor-dnd-kit-core-C9qcAm_1.js +0 -5
- package/dist/assets/vendor-dnd-kit-sortable-D8ozj8M-.js +0 -1
- package/dist/assets/vendor-dnd-kit-utilities-DTY1C6ST.js +0 -1
- package/dist/assets/vendor-floating-ui-core-CXmKXOXc.js +0 -1
- package/dist/assets/vendor-floating-ui-dom-WyXykhNi.js +0 -1
- package/dist/assets/vendor-floating-ui-react-dom-BZOGXAGe.js +0 -1
- package/dist/assets/vendor-floating-ui-utils-BzXdqYpP.js +0 -1
- package/dist/assets/vendor-framer-motion-CfplGuM0.js +0 -1
- package/dist/assets/vendor-get-nonce-C-Z93AgS.js +0 -1
- package/dist/assets/vendor-lezer-common-B3-cUCR_.js +0 -1
- package/dist/assets/vendor-lezer-cpp-BleAU9o-.js +0 -1
- package/dist/assets/vendor-lezer-css-C5xB6jxd.js +0 -1
- package/dist/assets/vendor-lezer-go-CXK1UKk8.js +0 -1
- package/dist/assets/vendor-lezer-highlight-CDMHUZ74.js +0 -1
- package/dist/assets/vendor-lezer-html-C0I1p52t.js +0 -1
- package/dist/assets/vendor-lezer-java-D_zzj-NV.js +0 -1
- package/dist/assets/vendor-lezer-javascript-D7Tj24ot.js +0 -1
- package/dist/assets/vendor-lezer-json-Iaex0UN-.js +0 -1
- package/dist/assets/vendor-lezer-lr-bhwg1HMg.js +0 -1
- package/dist/assets/vendor-lezer-php-_DHrbsZG.js +0 -1
- package/dist/assets/vendor-lezer-python-CvuFxeZl.js +0 -1
- package/dist/assets/vendor-lezer-rust-Lqgd5SAo.js +0 -1
- package/dist/assets/vendor-lezer-sass-Dnm2lY4t.js +0 -1
- package/dist/assets/vendor-lezer-xml-hUDuAyS5.js +0 -1
- package/dist/assets/vendor-lezer-yaml-BNIl6S_O.js +0 -1
- package/dist/assets/vendor-marijn-find-cluster-break-DXwl3gUT.js +0 -1
- package/dist/assets/vendor-motion-dom-DhJ-sYS5.js +0 -1
- package/dist/assets/vendor-motion-l0sNRNKZ.js +0 -1
- package/dist/assets/vendor-motion-utils-CKEGc_YG.js +0 -1
- package/dist/assets/vendor-radix-ui-primitive-Dc_FVRD7.js +0 -1
- package/dist/assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js +0 -1
- package/dist/assets/vendor-radix-ui-react-context-CFsX-AUC.js +0 -1
- package/dist/assets/vendor-radix-ui-react-dialog-D2yhEu2p.js +0 -5
- package/dist/assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js +0 -1
- package/dist/assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js +0 -1
- package/dist/assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js +0 -1
- package/dist/assets/vendor-radix-ui-react-id-D2kS9K1j.js +0 -1
- package/dist/assets/vendor-radix-ui-react-portal-YgCRIyi7.js +0 -1
- package/dist/assets/vendor-radix-ui-react-presence-D432pCMB.js +0 -1
- package/dist/assets/vendor-radix-ui-react-primitive-DkH8dMOR.js +0 -1
- package/dist/assets/vendor-radix-ui-react-slot-BIDFZX0-.js +0 -1
- package/dist/assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js +0 -1
- package/dist/assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js +0 -1
- package/dist/assets/vendor-radix-ui-react-use-effect-event-D94va83M.js +0 -1
- package/dist/assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js +0 -1
- package/dist/assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js +0 -1
- package/dist/assets/vendor-react-B5Z1Mdn3.js +0 -9
- package/dist/assets/vendor-react-remove-scroll-bar-CSAHp1YF.js +0 -38
- package/dist/assets/vendor-react-remove-scroll-vR1dy1aP.js +0 -4
- package/dist/assets/vendor-react-style-singleton-Ctw6HnYx.js +0 -1
- package/dist/assets/vendor-reselect-l0sNRNKZ.js +0 -1
- package/dist/assets/vendor-scheduler-7OC5HNn7.js +0 -1
- package/dist/assets/vendor-simplewebauthn-browser-VDA66rT_.js +0 -2
- package/dist/assets/vendor-sonner-BDtm25td.js +0 -1
- package/dist/assets/vendor-style-mod-NZ5MEPvj.js +0 -3
- package/dist/assets/vendor-tanstack-react-virtual-2skouoFw.js +0 -1
- package/dist/assets/vendor-tanstack-virtual-core-Dubg10g5.js +0 -1
- package/dist/assets/vendor-tslib-De9GV7Vy.js +0 -1
- package/dist/assets/vendor-use-callback-ref-CVVuCyLj.js +0 -1
- package/dist/assets/vendor-use-sidecar-Vv4V8Nd1.js +0 -1
- package/dist/assets/vendor-use-sync-external-store-D0AXkdQC.js +0 -1
- package/dist/assets/vendor-w3c-keyname-Vcq4gwWv.js +0 -1
- package/dist/assets/vendor-zustand-GVb4H8HE.js +0 -6
- package/server/lib/git/credentials.js +0 -41
- package/server/lib/git/identity-storage.js +0 -122
- /package/dist/assets/{vendor-katex-CNckGUMB.js → vendor-katex-DZG0Ov6p.js} +0 -0
- /package/dist/assets/{vendor-katex-Cp579UoJ.css → vendor-katex-css-Cp579UoJ.css} +0 -0
- /package/dist/assets/{vendor-xterm-xterm-CrXqRur4.js → vendor-xterm-xterm-B-qIQCd3.js} +0 -0
- /package/dist/assets/{vendor-xterm-xterm-DDGTF8rc.css → vendor-xterm-xterm-css-DDGTF8rc.css} +0 -0
|
@@ -215,53 +215,178 @@ function getUniquePaths(paths) {
|
|
|
215
215
|
return result;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
function
|
|
218
|
+
function runSpawnSyncRequest({ command, args, timeout }) {
|
|
219
219
|
try {
|
|
220
220
|
const result = spawnSync(command, args, {
|
|
221
221
|
encoding: 'utf8',
|
|
222
222
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
223
|
-
timeout
|
|
223
|
+
timeout,
|
|
224
224
|
...getSpawnSyncBaseOptions(),
|
|
225
225
|
});
|
|
226
226
|
|
|
227
|
-
if (result.status !== 0) {
|
|
228
|
-
return
|
|
227
|
+
if (!result || result.status !== 0) {
|
|
228
|
+
return { status: result?.status ?? 1, stdout: '' };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const stdout = typeof result.stdout === 'string' ? result.stdout : '';
|
|
232
|
+
return { status: result.status, stdout };
|
|
233
|
+
} catch {
|
|
234
|
+
return { status: 1, stdout: '' };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function runSpawnGeneratorSync(generator) {
|
|
239
|
+
let step = generator.next();
|
|
240
|
+
while (!step.done) {
|
|
241
|
+
step = generator.next(runSpawnSyncRequest(step.value));
|
|
242
|
+
}
|
|
243
|
+
return step.value;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function spawnAsyncRequest({ command, args, timeout }) {
|
|
247
|
+
return new Promise((resolve) => {
|
|
248
|
+
let child;
|
|
249
|
+
try {
|
|
250
|
+
// stderr is ignored so a chatty package manager cannot fill an unread pipe.
|
|
251
|
+
child = spawn(command, args, {
|
|
252
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
253
|
+
...getSpawnSyncBaseOptions(),
|
|
254
|
+
});
|
|
255
|
+
} catch {
|
|
256
|
+
resolve({ status: 1, stdout: '' });
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (!child || typeof child.on !== 'function') {
|
|
261
|
+
resolve({ status: 1, stdout: '' });
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
let stdout = '';
|
|
266
|
+
let settled = false;
|
|
267
|
+
let timer = null;
|
|
268
|
+
const finish = (status) => {
|
|
269
|
+
if (settled) return;
|
|
270
|
+
settled = true;
|
|
271
|
+
if (timer) {
|
|
272
|
+
clearTimeout(timer);
|
|
273
|
+
timer = null;
|
|
274
|
+
}
|
|
275
|
+
resolve({ status: typeof status === 'number' ? status : 1, stdout });
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
try {
|
|
279
|
+
if (timeout && timeout > 0) {
|
|
280
|
+
timer = setTimeout(() => {
|
|
281
|
+
try {
|
|
282
|
+
child.kill?.('SIGKILL');
|
|
283
|
+
} catch {
|
|
284
|
+
}
|
|
285
|
+
finish(1);
|
|
286
|
+
}, timeout);
|
|
287
|
+
try {
|
|
288
|
+
timer.unref?.();
|
|
289
|
+
} catch {
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const stdoutStream = child.stdout;
|
|
294
|
+
if (stdoutStream && typeof stdoutStream.on === 'function') {
|
|
295
|
+
stdoutStream.setEncoding?.('utf8');
|
|
296
|
+
stdoutStream.on('data', (chunk) => {
|
|
297
|
+
try {
|
|
298
|
+
stdout += String(chunk);
|
|
299
|
+
} catch {
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
child.on('error', () => finish(1));
|
|
304
|
+
child.on('close', (code) => finish(typeof code === 'number' ? code : 1));
|
|
305
|
+
} catch {
|
|
306
|
+
finish(1);
|
|
229
307
|
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
230
310
|
|
|
231
|
-
|
|
232
|
-
|
|
311
|
+
async function runSpawnGeneratorAsync(generator) {
|
|
312
|
+
let step = generator.next();
|
|
313
|
+
while (!step.done) {
|
|
314
|
+
let result;
|
|
315
|
+
try {
|
|
316
|
+
result = await spawnAsyncRequest(step.value);
|
|
317
|
+
} catch {
|
|
318
|
+
result = { status: 1, stdout: '' };
|
|
319
|
+
}
|
|
320
|
+
step = generator.next(result);
|
|
321
|
+
}
|
|
322
|
+
return step.value;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function* getCommandOutputGen(command, args) {
|
|
326
|
+
let result;
|
|
327
|
+
try {
|
|
328
|
+
result = yield { command, args, timeout: 10000 };
|
|
233
329
|
} catch {
|
|
234
330
|
return null;
|
|
235
331
|
}
|
|
332
|
+
if (!result || result.status !== 0) {
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
const stdout = typeof result.stdout === 'string' ? result.stdout.trim() : '';
|
|
336
|
+
return stdout || null;
|
|
236
337
|
}
|
|
237
338
|
|
|
238
|
-
function
|
|
239
|
-
|
|
240
|
-
|
|
339
|
+
function getCommandOutput(command, args) {
|
|
340
|
+
return runSpawnGeneratorSync(getCommandOutputGen(command, args));
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function* isCommandAvailableGen(command) {
|
|
344
|
+
let result;
|
|
345
|
+
try {
|
|
346
|
+
result = yield { command, args: ['--version'], timeout: 5000 };
|
|
347
|
+
} catch {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
return !!result && result.status === 0;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function* resolvePackageManagerCommandGen(pm) {
|
|
354
|
+
const candidates = getPackageManagerCommandCandidates(pm);
|
|
355
|
+
for (const candidate of candidates) {
|
|
356
|
+
if (yield* isCommandAvailableGen(candidate)) {
|
|
357
|
+
return candidate;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return pm;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function* getGlobalBinDirsGen(pm) {
|
|
364
|
+
const pmCommand = yield* resolvePackageManagerCommandGen(pm);
|
|
365
|
+
if (!(yield* isCommandAvailableGen(pmCommand))) {
|
|
241
366
|
return [];
|
|
242
367
|
}
|
|
243
368
|
|
|
244
369
|
const dirs = [];
|
|
245
370
|
switch (pm) {
|
|
246
371
|
case 'pnpm': {
|
|
247
|
-
const pnpmBin =
|
|
372
|
+
const pnpmBin = yield* getCommandOutputGen(pmCommand, ['bin', '-g']);
|
|
248
373
|
if (pnpmBin) dirs.push(pnpmBin);
|
|
249
|
-
const pnpmPrefix =
|
|
374
|
+
const pnpmPrefix = yield* getCommandOutputGen(pmCommand, ['prefix', '-g']);
|
|
250
375
|
if (pnpmPrefix) dirs.push(process.platform === 'win32' ? pnpmPrefix : path.join(pnpmPrefix, 'bin'));
|
|
251
376
|
break;
|
|
252
377
|
}
|
|
253
378
|
case 'yarn': {
|
|
254
|
-
const yarnBin =
|
|
379
|
+
const yarnBin = yield* getCommandOutputGen(pmCommand, ['global', 'bin']);
|
|
255
380
|
if (yarnBin) dirs.push(yarnBin);
|
|
256
381
|
break;
|
|
257
382
|
}
|
|
258
383
|
case 'bun': {
|
|
259
|
-
const bunBin =
|
|
384
|
+
const bunBin = yield* getCommandOutputGen(pmCommand, ['pm', 'bin', '-g']);
|
|
260
385
|
if (bunBin) dirs.push(bunBin);
|
|
261
386
|
break;
|
|
262
387
|
}
|
|
263
388
|
default: {
|
|
264
|
-
const npmPrefix =
|
|
389
|
+
const npmPrefix = yield* getCommandOutputGen(pmCommand, ['prefix', '-g']);
|
|
265
390
|
if (npmPrefix) dirs.push(process.platform === 'win32' ? npmPrefix : path.join(npmPrefix, 'bin'));
|
|
266
391
|
break;
|
|
267
392
|
}
|
|
@@ -270,10 +395,14 @@ function getGlobalBinDirs(pm) {
|
|
|
270
395
|
return getUniquePaths(dirs);
|
|
271
396
|
}
|
|
272
397
|
|
|
273
|
-
function
|
|
398
|
+
function getGlobalBinDirs(pm) {
|
|
399
|
+
return runSpawnGeneratorSync(getGlobalBinDirsGen(pm));
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function* getGlobalNodeModulesRootsGen(pm) {
|
|
274
403
|
try {
|
|
275
|
-
const pmCommand =
|
|
276
|
-
if (!
|
|
404
|
+
const pmCommand = yield* resolvePackageManagerCommandGen(pm);
|
|
405
|
+
if (!(yield* isCommandAvailableGen(pmCommand))) {
|
|
277
406
|
return [];
|
|
278
407
|
}
|
|
279
408
|
|
|
@@ -281,19 +410,19 @@ function getGlobalNodeModulesRoots(pm) {
|
|
|
281
410
|
|
|
282
411
|
switch (pm) {
|
|
283
412
|
case 'pnpm': {
|
|
284
|
-
const pnpmRoot =
|
|
413
|
+
const pnpmRoot = yield* getCommandOutputGen(pmCommand, ['root', '-g']);
|
|
285
414
|
if (pnpmRoot) roots.push(pnpmRoot);
|
|
286
|
-
const pnpmPrefix =
|
|
415
|
+
const pnpmPrefix = yield* getCommandOutputGen(pmCommand, ['prefix', '-g']);
|
|
287
416
|
if (pnpmPrefix) roots.push(process.platform === 'win32' ? path.join(pnpmPrefix, 'node_modules') : path.join(pnpmPrefix, 'lib', 'node_modules'));
|
|
288
417
|
break;
|
|
289
418
|
}
|
|
290
419
|
case 'yarn': {
|
|
291
|
-
const yarnDir =
|
|
420
|
+
const yarnDir = yield* getCommandOutputGen(pmCommand, ['global', 'dir']);
|
|
292
421
|
if (yarnDir) roots.push(path.join(yarnDir, 'node_modules'));
|
|
293
422
|
break;
|
|
294
423
|
}
|
|
295
424
|
case 'bun': {
|
|
296
|
-
const bunBinDir =
|
|
425
|
+
const bunBinDir = yield* getCommandOutputGen(pmCommand, ['pm', 'bin', '-g']);
|
|
297
426
|
if (bunBinDir) {
|
|
298
427
|
roots.push(path.resolve(bunBinDir, '..', 'install', 'global', 'node_modules'));
|
|
299
428
|
roots.push(path.resolve(bunBinDir, '..', '..', 'node_modules'));
|
|
@@ -302,9 +431,9 @@ function getGlobalNodeModulesRoots(pm) {
|
|
|
302
431
|
}
|
|
303
432
|
default:
|
|
304
433
|
{
|
|
305
|
-
const npmRoot =
|
|
434
|
+
const npmRoot = yield* getCommandOutputGen(pmCommand, ['root', '-g']);
|
|
306
435
|
if (npmRoot) roots.push(npmRoot);
|
|
307
|
-
const npmPrefix =
|
|
436
|
+
const npmPrefix = yield* getCommandOutputGen(pmCommand, ['prefix', '-g']);
|
|
308
437
|
if (npmPrefix) roots.push(process.platform === 'win32' ? path.join(npmPrefix, 'node_modules') : path.join(npmPrefix, 'lib', 'node_modules'));
|
|
309
438
|
break;
|
|
310
439
|
}
|
|
@@ -316,9 +445,14 @@ function getGlobalNodeModulesRoots(pm) {
|
|
|
316
445
|
}
|
|
317
446
|
}
|
|
318
447
|
|
|
319
|
-
function
|
|
448
|
+
function getGlobalNodeModulesRoots(pm) {
|
|
449
|
+
return runSpawnGeneratorSync(getGlobalNodeModulesRootsGen(pm));
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
function* getOwnedPackagePathsFromGlobalBinsGen(pm) {
|
|
320
453
|
const packagePaths = [];
|
|
321
|
-
|
|
454
|
+
const binDirs = yield* getGlobalBinDirsGen(pm);
|
|
455
|
+
for (const binDir of binDirs) {
|
|
322
456
|
const binaryName = process.platform === 'win32' ? 'pichamber.cmd' : 'pichamber';
|
|
323
457
|
const binaryPath = path.join(binDir, binaryName);
|
|
324
458
|
if (!fs.existsSync(binaryPath)) continue;
|
|
@@ -333,15 +467,21 @@ function getOwnedPackagePathsFromGlobalBins(pm) {
|
|
|
333
467
|
return getUniquePaths(packagePaths);
|
|
334
468
|
}
|
|
335
469
|
|
|
470
|
+
function getOwnedPackagePathsFromGlobalBins(pm) {
|
|
471
|
+
return runSpawnGeneratorSync(getOwnedPackagePathsFromGlobalBinsGen(pm));
|
|
472
|
+
}
|
|
473
|
+
|
|
336
474
|
function detectPackageManagerFromCurrentInstallPath() {
|
|
337
475
|
return detectPackageManagerFromInstallPath(getCurrentPackagePath());
|
|
338
476
|
}
|
|
339
477
|
|
|
340
|
-
function
|
|
478
|
+
function* packageManagerOwnsCurrentInstallGen(pm) {
|
|
341
479
|
const currentPackagePaths = getComparablePaths(getCurrentPackagePath());
|
|
480
|
+
const roots = yield* getGlobalNodeModulesRootsGen(pm);
|
|
481
|
+
const owned = yield* getOwnedPackagePathsFromGlobalBinsGen(pm);
|
|
342
482
|
const candidatePackagePaths = [
|
|
343
|
-
...
|
|
344
|
-
...
|
|
483
|
+
...roots.map(getPackagePathForGlobalRoot),
|
|
484
|
+
...owned,
|
|
345
485
|
];
|
|
346
486
|
|
|
347
487
|
for (const candidatePath of candidatePackagePaths) {
|
|
@@ -354,27 +494,39 @@ function packageManagerOwnsCurrentInstall(pm) {
|
|
|
354
494
|
return false;
|
|
355
495
|
}
|
|
356
496
|
|
|
357
|
-
function
|
|
497
|
+
function packageManagerOwnsCurrentInstall(pm) {
|
|
498
|
+
return runSpawnGeneratorSync(packageManagerOwnsCurrentInstallGen(pm));
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
function* detectionResultGen(packageManager, reason) {
|
|
358
502
|
return {
|
|
359
503
|
packageManager,
|
|
360
504
|
reason,
|
|
361
505
|
packagePath: getCurrentPackagePath(),
|
|
362
|
-
packageManagerCommand:
|
|
363
|
-
globalNodeModulesRoot:
|
|
506
|
+
packageManagerCommand: yield* resolvePackageManagerCommandGen(packageManager),
|
|
507
|
+
globalNodeModulesRoot: (yield* getGlobalNodeModulesRootsGen(packageManager))[0] || null,
|
|
364
508
|
};
|
|
365
509
|
}
|
|
366
510
|
|
|
367
|
-
function
|
|
511
|
+
function detectionResult(packageManager, reason) {
|
|
512
|
+
return runSpawnGeneratorSync(detectionResultGen(packageManager, reason));
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
function* cacheTrustedDetectionGen(packageManager, reason) {
|
|
368
516
|
cachedDetectedPm = packageManager;
|
|
369
|
-
return
|
|
517
|
+
return yield* detectionResultGen(packageManager, reason);
|
|
370
518
|
}
|
|
371
519
|
|
|
372
|
-
|
|
520
|
+
function cacheTrustedDetection(packageManager, reason) {
|
|
521
|
+
return runSpawnGeneratorSync(cacheTrustedDetectionGen(packageManager, reason));
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
function* detectPackageManagerDetailsGen() {
|
|
373
525
|
// In desktop (Electron) runtime, package-manager detection is worthless —
|
|
374
526
|
// the app ships as a .app bundle, not installed via npm/pnpm/yarn/bun, and
|
|
375
527
|
// updates are handled by electron-updater. The detection path does up to a
|
|
376
|
-
// dozen
|
|
377
|
-
// the in-process server every one blocks the
|
|
528
|
+
// dozen spawn(pm, ['bin', '-g']) calls with 10s timeouts each; under
|
|
529
|
+
// the in-process server every sync one blocks the event loop and
|
|
378
530
|
// manifests as a multi-second UI freeze. Short-circuit here.
|
|
379
531
|
if (process.env.PICHAMBER_RUNTIME === 'desktop') {
|
|
380
532
|
return {
|
|
@@ -391,29 +543,29 @@ export function detectPackageManagerDetails() {
|
|
|
391
543
|
packageManager: cachedDetectedPm,
|
|
392
544
|
reason: 'cached',
|
|
393
545
|
packagePath: getCurrentPackagePath(),
|
|
394
|
-
packageManagerCommand:
|
|
395
|
-
globalNodeModulesRoot:
|
|
546
|
+
packageManagerCommand: yield* resolvePackageManagerCommandGen(cachedDetectedPm),
|
|
547
|
+
globalNodeModulesRoot: (yield* getGlobalNodeModulesRootsGen(cachedDetectedPm))[0] || null,
|
|
396
548
|
};
|
|
397
549
|
}
|
|
398
550
|
|
|
399
551
|
const forcedPm = process.env.PICHAMBER_PACKAGE_MANAGER?.trim();
|
|
400
552
|
if (forcedPm && UPDATE_PACKAGE_MANAGERS.has(forcedPm)) {
|
|
401
|
-
const forcedPmCommand =
|
|
402
|
-
if (
|
|
403
|
-
return
|
|
553
|
+
const forcedPmCommand = yield* resolvePackageManagerCommandGen(forcedPm);
|
|
554
|
+
if (yield* isCommandAvailableGen(forcedPmCommand)) {
|
|
555
|
+
return yield* cacheTrustedDetectionGen(forcedPm, 'forced-env');
|
|
404
556
|
}
|
|
405
557
|
}
|
|
406
558
|
|
|
407
559
|
// First prefer the package manager that demonstrably owns the current install.
|
|
408
560
|
const installPathPm = detectPackageManagerFromCurrentInstallPath();
|
|
409
|
-
if (installPathPm &&
|
|
410
|
-
return
|
|
561
|
+
if (installPathPm && (yield* packageManagerOwnsCurrentInstallGen(installPathPm))) {
|
|
562
|
+
return yield* cacheTrustedDetectionGen(installPathPm, 'install-path-owner');
|
|
411
563
|
}
|
|
412
564
|
|
|
413
565
|
const ownershipCandidates = ['pnpm', 'yarn', 'bun', 'npm'];
|
|
414
566
|
for (const candidate of ownershipCandidates) {
|
|
415
|
-
if (
|
|
416
|
-
return
|
|
567
|
+
if (yield* packageManagerOwnsCurrentInstallGen(candidate)) {
|
|
568
|
+
return yield* cacheTrustedDetectionGen(candidate, 'global-root-owner');
|
|
417
569
|
}
|
|
418
570
|
}
|
|
419
571
|
|
|
@@ -445,29 +597,158 @@ export function detectPackageManagerDetails() {
|
|
|
445
597
|
}
|
|
446
598
|
|
|
447
599
|
// Validate the hint against package visibility, but only after ownership checks failed.
|
|
448
|
-
if (hintedPm
|
|
449
|
-
|
|
600
|
+
if (hintedPm) {
|
|
601
|
+
const hintedCommand = yield* resolvePackageManagerCommandGen(hintedPm);
|
|
602
|
+
if ((yield* isCommandAvailableGen(hintedCommand)) && (yield* isPackageInstalledWithGen(hintedPm))) {
|
|
603
|
+
return yield* detectionResultGen(hintedPm, 'hinted-visible-install');
|
|
604
|
+
}
|
|
450
605
|
}
|
|
451
606
|
|
|
452
607
|
const runtimePm = detectPackageManagerFromRuntimePath(process.execPath);
|
|
453
|
-
if (runtimePm
|
|
454
|
-
|
|
608
|
+
if (runtimePm) {
|
|
609
|
+
const runtimeCommand = yield* resolvePackageManagerCommandGen(runtimePm);
|
|
610
|
+
if ((yield* isCommandAvailableGen(runtimeCommand)) && (yield* isPackageInstalledWithGen(runtimePm))) {
|
|
611
|
+
return yield* detectionResultGen(runtimePm, 'runtime-visible-install');
|
|
612
|
+
}
|
|
455
613
|
}
|
|
456
614
|
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
615
|
+
const pmNames = ['pnpm', 'yarn', 'bun', 'npm'];
|
|
616
|
+
for (const name of pmNames) {
|
|
617
|
+
const candidateCommand = yield* resolvePackageManagerCommandGen(name);
|
|
618
|
+
if (!(yield* isCommandAvailableGen(candidateCommand))) continue;
|
|
619
|
+
if (yield* isPackageInstalledWithGen(name)) {
|
|
620
|
+
return yield* detectionResultGen(name, 'last-resort-visible-install');
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
return yield* detectionResultGen('npm', 'default-fallback');
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
let cachedAsyncDetectionDetails = null;
|
|
628
|
+
let inFlightAsyncDetection = null;
|
|
629
|
+
|
|
630
|
+
// The in-process PiChamber server must never block its event loop on
|
|
631
|
+
// package-manager probing: the sync detection above fans out to dozens of
|
|
632
|
+
// `spawnSync` calls (each with multi-second timeouts), which once stalled
|
|
633
|
+
// every HTTP request for ~36s after UI boot. The async variant below reuses
|
|
634
|
+
// the exact same generator decision logic with a non-blocking `spawn` driver,
|
|
635
|
+
// memoizes the final details for the process lifetime (install ownership
|
|
636
|
+
// cannot change while the server runs), and shares one in-flight detection
|
|
637
|
+
// across concurrent update-checks.
|
|
638
|
+
//
|
|
639
|
+
// Detection normally runs as one child process (`package-manager-detect-child.js`)
|
|
640
|
+
// so the server forks once; its sync probes then fork from that small child.
|
|
641
|
+
// If the child cannot run or returns malformed output, the in-process async
|
|
642
|
+
// generator driver is the fallback, so a detection failure never degrades to a
|
|
643
|
+
// blocking path.
|
|
644
|
+
const DETECTION_CHILD_PATH = path.join(__dirname, 'package-manager-detect-child.js');
|
|
645
|
+
const DETECTION_CHILD_TIMEOUT_MS = 180000;
|
|
646
|
+
|
|
647
|
+
function isDetectionDetails(value) {
|
|
648
|
+
return Boolean(value)
|
|
649
|
+
&& typeof value === 'object'
|
|
650
|
+
&& typeof value.packageManager === 'string'
|
|
651
|
+
&& typeof value.reason === 'string';
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
function runDetectionChild() {
|
|
655
|
+
return new Promise((resolve) => {
|
|
656
|
+
if (!fs.existsSync(DETECTION_CHILD_PATH)) {
|
|
657
|
+
resolve(null);
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
let child;
|
|
661
|
+
try {
|
|
662
|
+
child = spawn(process.execPath, [DETECTION_CHILD_PATH], {
|
|
663
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
664
|
+
env: { ...process.env, PICHAMBER_DETECT_INVOKED_PATH: process.argv?.[1] || '' },
|
|
665
|
+
...getSpawnSyncBaseOptions(),
|
|
666
|
+
});
|
|
667
|
+
} catch {
|
|
668
|
+
resolve(null);
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
if (!child || typeof child.on !== 'function') {
|
|
672
|
+
resolve(null);
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
let stdout = '';
|
|
677
|
+
let settled = false;
|
|
678
|
+
const finish = (value) => {
|
|
679
|
+
if (settled) return;
|
|
680
|
+
settled = true;
|
|
681
|
+
clearTimeout(timer);
|
|
682
|
+
resolve(value);
|
|
683
|
+
};
|
|
684
|
+
const timer = setTimeout(() => {
|
|
685
|
+
try {
|
|
686
|
+
child.kill?.('SIGKILL');
|
|
687
|
+
} catch {
|
|
688
|
+
}
|
|
689
|
+
finish(null);
|
|
690
|
+
}, DETECTION_CHILD_TIMEOUT_MS);
|
|
691
|
+
timer.unref?.();
|
|
692
|
+
|
|
693
|
+
child.stdout?.setEncoding?.('utf8');
|
|
694
|
+
child.stdout?.on?.('data', (chunk) => {
|
|
695
|
+
stdout += String(chunk);
|
|
696
|
+
});
|
|
697
|
+
child.on('error', () => finish(null));
|
|
698
|
+
child.on('close', (code) => {
|
|
699
|
+
if (code !== 0) {
|
|
700
|
+
finish(null);
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
try {
|
|
704
|
+
const parsed = JSON.parse(stdout);
|
|
705
|
+
finish(isDetectionDetails(parsed) ? parsed : null);
|
|
706
|
+
} catch {
|
|
707
|
+
finish(null);
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
});
|
|
711
|
+
}
|
|
463
712
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
713
|
+
async function detectPackageManagerDetailsOffThread() {
|
|
714
|
+
if (process.env.PICHAMBER_RUNTIME === 'desktop') {
|
|
715
|
+
return runSpawnGeneratorAsync(detectPackageManagerDetailsGen());
|
|
716
|
+
}
|
|
717
|
+
const fromChild = await runDetectionChild();
|
|
718
|
+
if (fromChild) {
|
|
719
|
+
if (TRUSTED_UPDATE_REASONS.has(fromChild.reason) && fromChild.reason !== 'cached') {
|
|
720
|
+
cachedDetectedPm = fromChild.packageManager;
|
|
467
721
|
}
|
|
722
|
+
return fromChild;
|
|
468
723
|
}
|
|
724
|
+
return runSpawnGeneratorAsync(detectPackageManagerDetailsGen());
|
|
725
|
+
}
|
|
469
726
|
|
|
470
|
-
|
|
727
|
+
export async function detectPackageManagerDetailsAsync() {
|
|
728
|
+
if (cachedAsyncDetectionDetails) return cachedAsyncDetectionDetails;
|
|
729
|
+
if (inFlightAsyncDetection) return inFlightAsyncDetection;
|
|
730
|
+
inFlightAsyncDetection = detectPackageManagerDetailsOffThread().then(
|
|
731
|
+
(details) => {
|
|
732
|
+
cachedAsyncDetectionDetails = details;
|
|
733
|
+
inFlightAsyncDetection = null;
|
|
734
|
+
return details;
|
|
735
|
+
},
|
|
736
|
+
(error) => {
|
|
737
|
+
inFlightAsyncDetection = null;
|
|
738
|
+
throw error;
|
|
739
|
+
},
|
|
740
|
+
);
|
|
741
|
+
return inFlightAsyncDetection;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
export function resetPackageManagerDetectionCacheForTests() {
|
|
745
|
+
cachedDetectedPm = null;
|
|
746
|
+
cachedAsyncDetectionDetails = null;
|
|
747
|
+
inFlightAsyncDetection = null;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export function detectPackageManagerDetails() {
|
|
751
|
+
return runSpawnGeneratorSync(detectPackageManagerDetailsGen());
|
|
471
752
|
}
|
|
472
753
|
|
|
473
754
|
export function detectPackageManager() {
|
|
@@ -661,13 +942,7 @@ function getPackageManagerCommandCandidates(pm) {
|
|
|
661
942
|
}
|
|
662
943
|
|
|
663
944
|
function resolvePackageManagerCommand(pm) {
|
|
664
|
-
|
|
665
|
-
for (const candidate of candidates) {
|
|
666
|
-
if (isCommandAvailable(candidate)) {
|
|
667
|
-
return candidate;
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
return pm;
|
|
945
|
+
return runSpawnGeneratorSync(resolvePackageManagerCommandGen(pm));
|
|
671
946
|
}
|
|
672
947
|
|
|
673
948
|
function quoteCommand(command) {
|
|
@@ -680,22 +955,12 @@ function quoteCommand(command) {
|
|
|
680
955
|
}
|
|
681
956
|
|
|
682
957
|
function isCommandAvailable(command) {
|
|
683
|
-
|
|
684
|
-
const result = spawnSync(command, ['--version'], {
|
|
685
|
-
encoding: 'utf8',
|
|
686
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
687
|
-
timeout: 5000,
|
|
688
|
-
...getSpawnSyncBaseOptions(),
|
|
689
|
-
});
|
|
690
|
-
return result.status === 0;
|
|
691
|
-
} catch {
|
|
692
|
-
return false;
|
|
693
|
-
}
|
|
958
|
+
return runSpawnGeneratorSync(isCommandAvailableGen(command));
|
|
694
959
|
}
|
|
695
960
|
|
|
696
|
-
function
|
|
961
|
+
function* isPackageInstalledWithGen(pm) {
|
|
697
962
|
try {
|
|
698
|
-
const pmCommand =
|
|
963
|
+
const pmCommand = yield* resolvePackageManagerCommandGen(pm);
|
|
699
964
|
let args;
|
|
700
965
|
switch (pm) {
|
|
701
966
|
case 'pnpm':
|
|
@@ -711,20 +976,24 @@ function isPackageInstalledWith(pm) {
|
|
|
711
976
|
args = ['list', '-g', '--depth=0', PACKAGE_NAME];
|
|
712
977
|
}
|
|
713
978
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
}
|
|
979
|
+
let result;
|
|
980
|
+
try {
|
|
981
|
+
result = yield { command: pmCommand, args, timeout: 10000 };
|
|
982
|
+
} catch {
|
|
983
|
+
return false;
|
|
984
|
+
}
|
|
720
985
|
|
|
721
|
-
if (result.status !== 0) return false;
|
|
722
|
-
return result.stdout.includes(PACKAGE_NAME);
|
|
986
|
+
if (!result || result.status !== 0) return false;
|
|
987
|
+
return typeof result.stdout === 'string' && result.stdout.includes(PACKAGE_NAME);
|
|
723
988
|
} catch {
|
|
724
989
|
return false;
|
|
725
990
|
}
|
|
726
991
|
}
|
|
727
992
|
|
|
993
|
+
function isPackageInstalledWith(pm) {
|
|
994
|
+
return runSpawnGeneratorSync(isPackageInstalledWithGen(pm));
|
|
995
|
+
}
|
|
996
|
+
|
|
728
997
|
/**
|
|
729
998
|
* Get the update command for the detected package manager
|
|
730
999
|
*/
|
|
@@ -935,13 +1204,18 @@ async function fetchChangelogNotes(fromVersion, toVersion) {
|
|
|
935
1204
|
|
|
936
1205
|
export async function checkForUpdates(options = {}) {
|
|
937
1206
|
const currentVersion = options.currentVersion || getCurrentVersion();
|
|
938
|
-
const
|
|
1207
|
+
const channel = normalizeServerUpdateChannel(options.channel);
|
|
939
1208
|
const appType = normalizeAppType(options.appType);
|
|
940
1209
|
const platform = normalizePlatform(options.platform);
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1210
|
+
// Run package-manager detection concurrently with the registry lookup.
|
|
1211
|
+
// Detection is non-blocking (memoized async spawn) so the in-process
|
|
1212
|
+
// server event loop stays responsive to other requests while both settle.
|
|
1213
|
+
const detectionPromise = detectPackageManagerDetailsAsync().catch(() => null);
|
|
1214
|
+
const targetPromise = currentVersion === 'unknown'
|
|
1215
|
+
? Promise.resolve(null)
|
|
1216
|
+
: getRegistryUpdateTarget(currentVersion, channel);
|
|
1217
|
+
const [details, target] = await Promise.all([detectionPromise, targetPromise]);
|
|
1218
|
+
const pm = details?.packageManager || 'npm';
|
|
945
1219
|
const latestVersion = target?.version;
|
|
946
1220
|
|
|
947
1221
|
if (!latestVersion || currentVersion === 'unknown') {
|