@pi-chamber/web 1.0.3 → 1.0.4-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/dist/assets/DiagramView-GKGxPczP.js +1 -0
  2. package/dist/assets/{DiffView-D19Jps0i.js → DiffView-Cay8VAqL.js} +6 -6
  3. package/dist/assets/FileSaveConflictDialog-BRM9TJo0.js +3 -0
  4. package/dist/assets/FilesView-CEeQzjc6.js +6 -0
  5. package/dist/assets/GitHubDetailScaffold-q4YP8iyJ.js +11 -0
  6. package/dist/assets/GitHubLinkPicker-B9xgIW8y.js +1 -0
  7. package/dist/assets/GitHubListPrimitives-XkALat1v.js +1 -0
  8. package/dist/assets/GitView-DV3d0oSJ.js +9 -0
  9. package/dist/assets/IssuesSurface-OTyt9f3A.js +7 -0
  10. package/dist/assets/JsonTreeView-X2Auiy_q.js +1 -0
  11. package/dist/assets/MarkdownRendererImpl-1HameF6j.js +12 -0
  12. package/dist/assets/PatchDiff-GMQAv4en.js +1 -0
  13. package/dist/assets/PierreDiffViewer-0X__nypk.js +134 -0
  14. package/dist/assets/PullRequestsSurface-Dec20SIg.js +2 -0
  15. package/dist/assets/SessionSwitcherContent-DEw4nz7K.js +1 -0
  16. package/dist/assets/SessionSwitcherDropdown-DmLhbRzE.js +2 -0
  17. package/dist/assets/SessionUnreadDot-CJFawQpo.js +1 -0
  18. package/dist/assets/SettingsView-CwSspvq-.js +6 -0
  19. package/dist/assets/SettingsWindow-DkPv9MaU.js +1 -0
  20. package/dist/assets/ToolOutputDialog-DDwbOpTO.js +8 -0
  21. package/dist/assets/ToolPartDiffPreview-DZRP7p-Q.js +1 -0
  22. package/dist/assets/{VirtualizedFileDiff-CJondRlh.js → VirtualizedFileDiff-CUWx7JVZ.js} +3 -3
  23. package/dist/assets/Virtualizer-wpC51ZBQ.js +1 -0
  24. package/dist/assets/collapsible-Ce85nuXX.js +1 -0
  25. package/dist/assets/computeVirtualFileMetrics-3PpRLd5B.js +3 -0
  26. package/dist/assets/{contextFileOpenGuard-CsZL8yie.js → contextFileOpenGuard-PoBklHMz.js} +1 -1
  27. package/dist/assets/gitStatusPredicates-BvzxqidP.js +1 -0
  28. package/dist/assets/githubLink-iQ51wqRa.js +10 -0
  29. package/dist/assets/index-CkMnC_GK.js +1 -0
  30. package/dist/assets/index-Dd2OcIUY.js +10 -0
  31. package/dist/assets/index-DvN8zlLT.css +1 -0
  32. package/dist/assets/main-FasHq7Ck.js +2 -0
  33. package/dist/assets/main-PSCt716b.js +136 -0
  34. package/dist/assets/markdownCore-BH56o6Wu.js +2 -0
  35. package/dist/assets/miniChat-BzfobBDq.js +2 -0
  36. package/dist/assets/mobile-DAzZE2EL.js +2 -0
  37. package/dist/assets/permissionStore-B9Hkrqny.js +1 -0
  38. package/dist/assets/pi-session-focus-preference-D2-1HWmY.js +10 -0
  39. package/dist/assets/renderDiffWithHighlighter-l8hZWWBO.js +1 -0
  40. package/dist/assets/renderElectronMiniChatApp-DGYSIihR.js +2 -0
  41. package/dist/assets/renderFileWithHighlighter-BvDoP7ob.js +1 -0
  42. package/dist/assets/renderMobileApp-CwgWG0lU.js +11 -0
  43. package/dist/assets/runtimeEndpointReset-CmI6dBKM.js +62 -0
  44. package/dist/assets/{runtimeSurface-BdndJV2m.js → runtimeSurface-B1GRkkKC.js} +1 -1
  45. package/dist/assets/shell-CjFT_Tl9.js +1 -0
  46. package/dist/assets/sprite-HGQGInUp.js +6510 -0
  47. package/dist/assets/useAppFontEffects--lKKtKVo.js +212 -0
  48. package/dist/assets/{useFilesViewSearch-DJ3psTKU.js → useFilesViewSearch-D1jsGQrN.js} +3 -3
  49. package/dist/assets/useGitHubRemoteSearch-zNgy2bSt.js +1 -0
  50. package/dist/assets/useSwitcherItems-OCRYcHeu.js +1 -0
  51. package/dist/assets/vendor-base-ui-DIkTOIJS.js +1 -0
  52. package/dist/assets/{vendor-beautiful-mermaid-D3YCkKz7.js → vendor-beautiful-mermaid-DApbjBp2.js} +1 -1
  53. package/dist/assets/vendor-boot-DyL2td56.js +69 -0
  54. package/dist/assets/vendor-codemirror-autocomplete-DsFn4GLp.js +1 -0
  55. package/dist/assets/vendor-codemirror-lang-angular-B_NMmBbS.js +1 -0
  56. package/dist/assets/vendor-codemirror-lang-cpp-GOE7Gjd0.js +1 -0
  57. package/dist/assets/vendor-codemirror-lang-css-Dwf2XpnZ.js +1 -0
  58. package/dist/assets/vendor-codemirror-lang-go-C2KHbcll.js +7 -0
  59. package/dist/assets/vendor-codemirror-lang-html-DcKqyeGk.js +1 -0
  60. package/dist/assets/vendor-codemirror-lang-java-6eGbyB2k.js +1 -0
  61. package/dist/assets/vendor-codemirror-lang-javascript-DpTUrvx8.js +13 -0
  62. package/dist/assets/vendor-codemirror-lang-jinja-xSUJjXhr.js +1 -0
  63. package/dist/assets/vendor-codemirror-lang-json-CLGxdOCz.js +1 -0
  64. package/dist/assets/vendor-codemirror-lang-less-6nXi1rS9.js +1 -0
  65. package/dist/assets/vendor-codemirror-lang-liquid-B9hmb9P8.js +1 -0
  66. package/dist/assets/vendor-codemirror-lang-markdown-DmFP9s6x.js +1 -0
  67. package/dist/assets/vendor-codemirror-lang-php-DC6To8iX.js +1 -0
  68. package/dist/assets/vendor-codemirror-lang-python-yuxIkjit.js +3 -0
  69. package/dist/assets/vendor-codemirror-lang-rust-di1Sjz-0.js +1 -0
  70. package/dist/assets/vendor-codemirror-lang-sass-BWpV9NPV.js +1 -0
  71. package/dist/assets/{vendor-codemirror-lang-sql-HpQWHJjv.js → vendor-codemirror-lang-sql-C_RazIaB.js} +2 -2
  72. package/dist/assets/vendor-codemirror-lang-vue-BYL0r7KR.js +1 -0
  73. package/dist/assets/vendor-codemirror-lang-wast-BiVarhcz.js +1 -0
  74. package/dist/assets/vendor-codemirror-lang-xml-Cn1lY1ts.js +1 -0
  75. package/dist/assets/vendor-codemirror-lang-yaml-BZ6mZw9L.js +1 -0
  76. package/dist/assets/vendor-codemirror-language-data-DglcKYWT.js +2 -0
  77. package/dist/assets/vendor-codemirror-search-DaE6R5gH.js +2 -0
  78. package/dist/assets/{vendor-elkjs-mzfkf0ML.js → vendor-elkjs-D27273Ms.js} +1 -1
  79. package/dist/assets/{vendor-heic2any-BHsbokcA.js → vendor-heic2any-pq-UTQQR.js} +1 -1
  80. package/dist/assets/vendor-lezer-cpp-Dt99h3WT.js +1 -0
  81. package/dist/assets/vendor-lezer-css-DNU_fzPI.js +1 -0
  82. package/dist/assets/vendor-lezer-go-BEFtcNyS.js +1 -0
  83. package/dist/assets/vendor-lezer-html-DDGRhRUz.js +1 -0
  84. package/dist/assets/vendor-lezer-java-DmfZtW09.js +1 -0
  85. package/dist/assets/vendor-lezer-javascript-oje4tdp_.js +1 -0
  86. package/dist/assets/vendor-lezer-json-BRXb_bDX.js +1 -0
  87. package/dist/assets/vendor-lezer-lr-BU2qmu_5.js +1 -0
  88. package/dist/assets/{vendor-lezer-markdown-C6g-d6P3.js → vendor-lezer-markdown-CicYv7V9.js} +4 -4
  89. package/dist/assets/vendor-lezer-php-COORrTpE.js +1 -0
  90. package/dist/assets/vendor-lezer-python-Cuvm9X9Y.js +1 -0
  91. package/dist/assets/vendor-lezer-rust-C_zOfHbX.js +1 -0
  92. package/dist/assets/vendor-lezer-sass-DWP4w7O1.js +1 -0
  93. package/dist/assets/vendor-lezer-xml-Br6nOYeG.js +1 -0
  94. package/dist/assets/vendor-lezer-yaml-CYQmm6Sb.js +1 -0
  95. package/dist/assets/{vendor-lru_map-Cy8fTs3_.js → vendor-lru_map-DOPmc7GU.js} +1 -1
  96. package/dist/assets/{vendor-qrcode-B0KNSajT.js → vendor-qrcode-Dv4uniC1.js} +1 -1
  97. package/dist/assets/vendor-react-DASdDPIk.js +1 -0
  98. package/dist/assets/{vendor-react-drawio-BYDptOsj.js → vendor-react-drawio-Duu5LgQA.js} +1 -1
  99. package/dist/assets/{vendor-replit-codemirror-vim-DaSwPsXt.js → vendor-replit-codemirror-vim-CZy3BUVv.js} +15 -15
  100. package/dist/assets/vendor-zustand-CUi8eEds.js +6 -0
  101. package/dist/assets/{web-components-CCKlju0Z.js → web-components-v9fuidaX.js} +4 -4
  102. package/dist/index.html +7 -9
  103. package/dist/mini-chat.html +6 -8
  104. package/dist/mobile.html +6 -8
  105. package/package.json +2 -2
  106. package/server/index.js +3 -1
  107. package/server/lib/fs/DOCUMENTATION.md +1 -1
  108. package/server/lib/fs/routes.js +1 -50
  109. package/server/lib/git/DOCUMENTATION.md +18 -11
  110. package/server/lib/git/index.js +8 -3
  111. package/server/lib/git/routes.js +0 -129
  112. package/server/lib/git/service.js +40 -152
  113. package/server/lib/git/service.test.js +42 -18
  114. package/server/lib/github/DOCUMENTATION.md +271 -0
  115. package/server/lib/github/cache.js +164 -0
  116. package/server/lib/github/checks.js +230 -0
  117. package/server/lib/github/client.js +305 -0
  118. package/server/lib/github/context.js +177 -0
  119. package/server/lib/github/contracts.test.js +235 -0
  120. package/server/lib/github/correctness.test.js +356 -0
  121. package/server/lib/github/credential.js +46 -0
  122. package/server/lib/github/errors.js +151 -0
  123. package/server/lib/github/gh-cli.js +336 -0
  124. package/server/lib/github/index.js +27 -0
  125. package/server/lib/github/issues.js +495 -0
  126. package/server/lib/github/pulls.js +699 -0
  127. package/server/lib/github/repo-scope.js +688 -0
  128. package/server/lib/github/routes.js +599 -0
  129. package/server/lib/github/security.test.js +275 -0
  130. package/server/lib/github/templates.js +153 -0
  131. package/server/lib/package-manager-detect-child.js +12 -0
  132. package/server/lib/package-manager.js +366 -92
  133. package/server/lib/package-manager.test.js +109 -0
  134. package/server/lib/pi/routes-extension-events.test.js +268 -4
  135. package/server/lib/pi/routes.js +109 -25
  136. package/server/lib/pi/routes.test.js +118 -0
  137. package/server/lib/pi/session-daemon/DOCUMENTATION.md +24 -9
  138. package/server/lib/pi/session-daemon/builtin-extensions.js +37 -0
  139. package/server/lib/pi/session-daemon/daemon-process.js +6 -0
  140. package/server/lib/pi/session-daemon/extension-bridge-draft.test.js +222 -0
  141. package/server/lib/pi/session-daemon/extension-bridge.js +415 -42
  142. package/server/lib/pi/session-daemon/extension-name.js +87 -0
  143. package/server/lib/pi/session-daemon/extension-name.test.js +143 -0
  144. package/server/lib/pi/session-daemon/extension-theme.js +217 -0
  145. package/server/lib/pi/session-daemon/extension-theme.test.js +164 -0
  146. package/server/lib/pi/session-daemon/extension-tool-render.js +365 -0
  147. package/server/lib/pi/session-daemon/extension-tool-render.test.js +607 -0
  148. package/server/lib/pi/session-daemon/prompt-operations.test.js +3 -3
  149. package/server/lib/pi/session-daemon/prompt-preflight.test.js +12 -14
  150. package/server/lib/pi/session-daemon/sdk-upgrade.test.js +118 -2
  151. package/server/lib/pi/session-daemon/send-operation-dedup.test.js +1 -1
  152. package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +323 -3
  153. package/server/lib/pi/session-daemon/session-daemon-list-live.test.js +244 -0
  154. package/server/lib/pi/session-daemon/session-daemon-mcp.e2e.test.js +638 -0
  155. package/server/lib/pi/session-daemon/session-daemon-turn.e2e.test.js +437 -0
  156. package/server/lib/pi/session-daemon/session-daemon.js +265 -75
  157. package/server/lib/pi/session-daemon/session-daemon.test.js +271 -5
  158. package/server/lib/pi/session-daemon/session-idle-residency.test.js +1 -1
  159. package/server/lib/pi/session-daemon/session-replay.test.js +1 -1
  160. package/server/lib/pi/session-persistence-gap.test.js +2 -3
  161. package/server/lib/pi/ui-settings-store.js +2 -1
  162. package/server/lib/pi/ui-settings-store.test.js +27 -0
  163. package/server/lib/static-cache-control.js +18 -0
  164. package/server/lib/static-cache-control.test.js +25 -0
  165. package/server/lib/workspace/host.js +2 -0
  166. package/dist/assets/DiagramView-Bj1ZrdhI.js +0 -1
  167. package/dist/assets/FileSaveConflictDialog-2Z4V_gZU.js +0 -3
  168. package/dist/assets/FilesView-K18gBSws.js +0 -6
  169. package/dist/assets/GitView-Hm1KBPaD.js +0 -8
  170. package/dist/assets/JsonTreeView-fNsiZEIo.js +0 -1
  171. package/dist/assets/MarkdownRendererImpl-DV5Xkj8N.js +0 -12
  172. package/dist/assets/PatchDiff-DZaJG6jj.js +0 -1
  173. package/dist/assets/SessionSwitcherContent-RAsmsuYk.js +0 -1
  174. package/dist/assets/SessionSwitcherDropdown-DuLPlIF_.js +0 -2
  175. package/dist/assets/SessionUnreadDot-Dm6k5OCd.js +0 -1
  176. package/dist/assets/SettingsView-Chu4zbWo.js +0 -6
  177. package/dist/assets/SettingsWindow-CJzFmmfu.js +0 -1
  178. package/dist/assets/ToolOutputDialog-uYeXsAGc.js +0 -8
  179. package/dist/assets/ToolPartDiffPreview-DnAHVRs-.js +0 -1
  180. package/dist/assets/Virtualizer-BSHVMKgK.js +0 -1
  181. package/dist/assets/collapsible-BH1vXEAI.js +0 -1
  182. package/dist/assets/computeVirtualFileMetrics-DXkR5jdw.js +0 -3
  183. package/dist/assets/gitStatusPredicates-BW8heN1a.js +0 -134
  184. package/dist/assets/index-5fyXnZFi.css +0 -1
  185. package/dist/assets/index-BrgKwTb0.js +0 -1
  186. package/dist/assets/index-C-sV_9sb.js +0 -8
  187. package/dist/assets/isDiffPlainText-DZFr1Tta.js +0 -1
  188. package/dist/assets/isFilePlainText-KNpEMvb-.js +0 -1
  189. package/dist/assets/main-BPY2ug1A.js +0 -135
  190. package/dist/assets/main-BRIjzIRl.js +0 -2
  191. package/dist/assets/markdownCore-DYizLr1N.js +0 -3
  192. package/dist/assets/miniChat-Dva4MINl.js +0 -2
  193. package/dist/assets/mobile-6jNUNv_x.js +0 -2
  194. package/dist/assets/permissionStore-iKN1K2_x.js +0 -1
  195. package/dist/assets/renderElectronMiniChatApp-BIeBrZmO.js +0 -2
  196. package/dist/assets/renderMobileApp-BDCtZpeS.js +0 -11
  197. package/dist/assets/runtimeEndpointReset-DqdGOWp8.js +0 -53
  198. package/dist/assets/useAppFontEffects-BABx-DxZ.js +0 -6722
  199. package/dist/assets/usePushVisibilityBeacon-BciEu3HS.js +0 -10
  200. package/dist/assets/useSwitcherItems-C7_5TB_n.js +0 -1
  201. package/dist/assets/vendor-aria-hidden-DvXkyWUv.js +0 -1
  202. package/dist/assets/vendor-base-ui-DXSHfszQ.js +0 -1
  203. package/dist/assets/vendor-class-variance-authority-5VPnzWs2.js +0 -1
  204. package/dist/assets/vendor-cmdk-zXx6sGnS.js +0 -1
  205. package/dist/assets/vendor-codemirror-autocomplete-wd6iRebq.js +0 -1
  206. package/dist/assets/vendor-codemirror-commands-CNlncqrr.js +0 -1
  207. package/dist/assets/vendor-codemirror-lang-angular-DU_4KiiW.js +0 -1
  208. package/dist/assets/vendor-codemirror-lang-cpp-CmIT9Z5_.js +0 -1
  209. package/dist/assets/vendor-codemirror-lang-css-djiuoTi8.js +0 -1
  210. package/dist/assets/vendor-codemirror-lang-go-COZSwZYW.js +0 -7
  211. package/dist/assets/vendor-codemirror-lang-html-CKHqhW5R.js +0 -1
  212. package/dist/assets/vendor-codemirror-lang-java-CNMP5hyC.js +0 -1
  213. package/dist/assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js +0 -13
  214. package/dist/assets/vendor-codemirror-lang-jinja-DaKn_b1k.js +0 -1
  215. package/dist/assets/vendor-codemirror-lang-json-CZ07HmNC.js +0 -1
  216. package/dist/assets/vendor-codemirror-lang-less-wJdQiDBf.js +0 -1
  217. package/dist/assets/vendor-codemirror-lang-liquid-0z48Roi8.js +0 -1
  218. package/dist/assets/vendor-codemirror-lang-markdown-DtcZDGqe.js +0 -1
  219. package/dist/assets/vendor-codemirror-lang-php-W8plS-JQ.js +0 -1
  220. package/dist/assets/vendor-codemirror-lang-python-DzzokVau.js +0 -3
  221. package/dist/assets/vendor-codemirror-lang-rust-C4ulBVpf.js +0 -1
  222. package/dist/assets/vendor-codemirror-lang-sass-BkZJYEwS.js +0 -1
  223. package/dist/assets/vendor-codemirror-lang-vue-DiBPljCc.js +0 -1
  224. package/dist/assets/vendor-codemirror-lang-wast-DoABsogh.js +0 -1
  225. package/dist/assets/vendor-codemirror-lang-xml-BhLJhOCH.js +0 -1
  226. package/dist/assets/vendor-codemirror-lang-yaml-D95i1Y5R.js +0 -1
  227. package/dist/assets/vendor-codemirror-language-BByA_dGF.js +0 -3
  228. package/dist/assets/vendor-codemirror-language-data-BB5mQv-R.js +0 -2
  229. package/dist/assets/vendor-codemirror-search-BV44140v.js +0 -2
  230. package/dist/assets/vendor-codemirror-state-CNWM3Q8V.js +0 -5
  231. package/dist/assets/vendor-codemirror-view-Ct4T37Ue.js +0 -4
  232. package/dist/assets/vendor-crelt-C8TCjufn.js +0 -1
  233. package/dist/assets/vendor-detect-node-es-l0sNRNKZ.js +0 -1
  234. package/dist/assets/vendor-dnd-kit-accessibility-DZKKhs9S.js +0 -1
  235. package/dist/assets/vendor-dnd-kit-core-C9qcAm_1.js +0 -5
  236. package/dist/assets/vendor-dnd-kit-sortable-D8ozj8M-.js +0 -1
  237. package/dist/assets/vendor-dnd-kit-utilities-DTY1C6ST.js +0 -1
  238. package/dist/assets/vendor-floating-ui-core-CXmKXOXc.js +0 -1
  239. package/dist/assets/vendor-floating-ui-dom-WyXykhNi.js +0 -1
  240. package/dist/assets/vendor-floating-ui-react-dom-BZOGXAGe.js +0 -1
  241. package/dist/assets/vendor-floating-ui-utils-BzXdqYpP.js +0 -1
  242. package/dist/assets/vendor-framer-motion-CfplGuM0.js +0 -1
  243. package/dist/assets/vendor-get-nonce-C-Z93AgS.js +0 -1
  244. package/dist/assets/vendor-lezer-common-B3-cUCR_.js +0 -1
  245. package/dist/assets/vendor-lezer-cpp-BleAU9o-.js +0 -1
  246. package/dist/assets/vendor-lezer-css-C5xB6jxd.js +0 -1
  247. package/dist/assets/vendor-lezer-go-CXK1UKk8.js +0 -1
  248. package/dist/assets/vendor-lezer-highlight-CDMHUZ74.js +0 -1
  249. package/dist/assets/vendor-lezer-html-C0I1p52t.js +0 -1
  250. package/dist/assets/vendor-lezer-java-D_zzj-NV.js +0 -1
  251. package/dist/assets/vendor-lezer-javascript-D7Tj24ot.js +0 -1
  252. package/dist/assets/vendor-lezer-json-Iaex0UN-.js +0 -1
  253. package/dist/assets/vendor-lezer-lr-bhwg1HMg.js +0 -1
  254. package/dist/assets/vendor-lezer-php-_DHrbsZG.js +0 -1
  255. package/dist/assets/vendor-lezer-python-CvuFxeZl.js +0 -1
  256. package/dist/assets/vendor-lezer-rust-Lqgd5SAo.js +0 -1
  257. package/dist/assets/vendor-lezer-sass-Dnm2lY4t.js +0 -1
  258. package/dist/assets/vendor-lezer-xml-hUDuAyS5.js +0 -1
  259. package/dist/assets/vendor-lezer-yaml-BNIl6S_O.js +0 -1
  260. package/dist/assets/vendor-marijn-find-cluster-break-DXwl3gUT.js +0 -1
  261. package/dist/assets/vendor-motion-dom-DhJ-sYS5.js +0 -1
  262. package/dist/assets/vendor-motion-l0sNRNKZ.js +0 -1
  263. package/dist/assets/vendor-motion-utils-CKEGc_YG.js +0 -1
  264. package/dist/assets/vendor-radix-ui-primitive-Dc_FVRD7.js +0 -1
  265. package/dist/assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js +0 -1
  266. package/dist/assets/vendor-radix-ui-react-context-CFsX-AUC.js +0 -1
  267. package/dist/assets/vendor-radix-ui-react-dialog-D2yhEu2p.js +0 -5
  268. package/dist/assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js +0 -1
  269. package/dist/assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js +0 -1
  270. package/dist/assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js +0 -1
  271. package/dist/assets/vendor-radix-ui-react-id-D2kS9K1j.js +0 -1
  272. package/dist/assets/vendor-radix-ui-react-portal-YgCRIyi7.js +0 -1
  273. package/dist/assets/vendor-radix-ui-react-presence-D432pCMB.js +0 -1
  274. package/dist/assets/vendor-radix-ui-react-primitive-DkH8dMOR.js +0 -1
  275. package/dist/assets/vendor-radix-ui-react-slot-BIDFZX0-.js +0 -1
  276. package/dist/assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js +0 -1
  277. package/dist/assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js +0 -1
  278. package/dist/assets/vendor-radix-ui-react-use-effect-event-D94va83M.js +0 -1
  279. package/dist/assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js +0 -1
  280. package/dist/assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js +0 -1
  281. package/dist/assets/vendor-react-B5Z1Mdn3.js +0 -9
  282. package/dist/assets/vendor-react-remove-scroll-bar-CSAHp1YF.js +0 -38
  283. package/dist/assets/vendor-react-remove-scroll-vR1dy1aP.js +0 -4
  284. package/dist/assets/vendor-react-style-singleton-Ctw6HnYx.js +0 -1
  285. package/dist/assets/vendor-reselect-l0sNRNKZ.js +0 -1
  286. package/dist/assets/vendor-scheduler-7OC5HNn7.js +0 -1
  287. package/dist/assets/vendor-simplewebauthn-browser-VDA66rT_.js +0 -2
  288. package/dist/assets/vendor-sonner-BDtm25td.js +0 -1
  289. package/dist/assets/vendor-style-mod-NZ5MEPvj.js +0 -3
  290. package/dist/assets/vendor-tanstack-react-virtual-2skouoFw.js +0 -1
  291. package/dist/assets/vendor-tanstack-virtual-core-Dubg10g5.js +0 -1
  292. package/dist/assets/vendor-tslib-De9GV7Vy.js +0 -1
  293. package/dist/assets/vendor-use-callback-ref-CVVuCyLj.js +0 -1
  294. package/dist/assets/vendor-use-sidecar-Vv4V8Nd1.js +0 -1
  295. package/dist/assets/vendor-use-sync-external-store-D0AXkdQC.js +0 -1
  296. package/dist/assets/vendor-w3c-keyname-Vcq4gwWv.js +0 -1
  297. package/dist/assets/vendor-zustand-GVb4H8HE.js +0 -6
  298. package/server/lib/git/credentials.js +0 -41
  299. package/server/lib/git/identity-storage.js +0 -122
  300. /package/dist/assets/{vendor-katex-CNckGUMB.js → vendor-katex-DZG0Ov6p.js} +0 -0
  301. /package/dist/assets/{vendor-katex-Cp579UoJ.css → vendor-katex-css-Cp579UoJ.css} +0 -0
  302. /package/dist/assets/{vendor-xterm-xterm-CrXqRur4.js → vendor-xterm-xterm-B-qIQCd3.js} +0 -0
  303. /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 getCommandOutput(command, args) {
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: 10000,
223
+ timeout,
224
224
  ...getSpawnSyncBaseOptions(),
225
225
  });
226
226
 
227
- if (result.status !== 0) {
228
- return null;
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
- const stdout = result.stdout.trim();
232
- return stdout || null;
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 getGlobalBinDirs(pm) {
239
- const pmCommand = resolvePackageManagerCommand(pm);
240
- if (!isCommandAvailable(pmCommand)) {
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 = getCommandOutput(pmCommand, ['bin', '-g']);
372
+ const pnpmBin = yield* getCommandOutputGen(pmCommand, ['bin', '-g']);
248
373
  if (pnpmBin) dirs.push(pnpmBin);
249
- const pnpmPrefix = getCommandOutput(pmCommand, ['prefix', '-g']);
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 = getCommandOutput(pmCommand, ['global', 'bin']);
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 = getCommandOutput(pmCommand, ['pm', 'bin', '-g']);
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 = getCommandOutput(pmCommand, ['prefix', '-g']);
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 getGlobalNodeModulesRoots(pm) {
398
+ function getGlobalBinDirs(pm) {
399
+ return runSpawnGeneratorSync(getGlobalBinDirsGen(pm));
400
+ }
401
+
402
+ function* getGlobalNodeModulesRootsGen(pm) {
274
403
  try {
275
- const pmCommand = resolvePackageManagerCommand(pm);
276
- if (!isCommandAvailable(pmCommand)) {
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 = getCommandOutput(pmCommand, ['root', '-g']);
413
+ const pnpmRoot = yield* getCommandOutputGen(pmCommand, ['root', '-g']);
285
414
  if (pnpmRoot) roots.push(pnpmRoot);
286
- const pnpmPrefix = getCommandOutput(pmCommand, ['prefix', '-g']);
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 = getCommandOutput(pmCommand, ['global', 'dir']);
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 = getCommandOutput(pmCommand, ['pm', 'bin', '-g']);
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 = getCommandOutput(pmCommand, ['root', '-g']);
434
+ const npmRoot = yield* getCommandOutputGen(pmCommand, ['root', '-g']);
306
435
  if (npmRoot) roots.push(npmRoot);
307
- const npmPrefix = getCommandOutput(pmCommand, ['prefix', '-g']);
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 getOwnedPackagePathsFromGlobalBins(pm) {
448
+ function getGlobalNodeModulesRoots(pm) {
449
+ return runSpawnGeneratorSync(getGlobalNodeModulesRootsGen(pm));
450
+ }
451
+
452
+ function* getOwnedPackagePathsFromGlobalBinsGen(pm) {
320
453
  const packagePaths = [];
321
- for (const binDir of getGlobalBinDirs(pm)) {
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 packageManagerOwnsCurrentInstall(pm) {
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
- ...getGlobalNodeModulesRoots(pm).map(getPackagePathForGlobalRoot),
344
- ...getOwnedPackagePathsFromGlobalBins(pm),
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 detectionResult(packageManager, reason) {
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: resolvePackageManagerCommand(packageManager),
363
- globalNodeModulesRoot: getGlobalNodeModulesRoots(packageManager)[0] || null,
506
+ packageManagerCommand: yield* resolvePackageManagerCommandGen(packageManager),
507
+ globalNodeModulesRoot: (yield* getGlobalNodeModulesRootsGen(packageManager))[0] || null,
364
508
  };
365
509
  }
366
510
 
367
- function cacheTrustedDetection(packageManager, reason) {
511
+ function detectionResult(packageManager, reason) {
512
+ return runSpawnGeneratorSync(detectionResultGen(packageManager, reason));
513
+ }
514
+
515
+ function* cacheTrustedDetectionGen(packageManager, reason) {
368
516
  cachedDetectedPm = packageManager;
369
- return detectionResult(packageManager, reason);
517
+ return yield* detectionResultGen(packageManager, reason);
370
518
  }
371
519
 
372
- export function detectPackageManagerDetails() {
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 spawnSync(pm, ['bin', '-g']) calls with 10s timeouts each; under
377
- // the in-process server every one blocks the Electron main event loop and
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: resolvePackageManagerCommand(cachedDetectedPm),
395
- globalNodeModulesRoot: getGlobalNodeModulesRoots(cachedDetectedPm)[0] || null,
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 = resolvePackageManagerCommand(forcedPm);
402
- if (isCommandAvailable(forcedPmCommand)) {
403
- return cacheTrustedDetection(forcedPm, 'forced-env');
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 && packageManagerOwnsCurrentInstall(installPathPm)) {
410
- return cacheTrustedDetection(installPathPm, 'install-path-owner');
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 (packageManagerOwnsCurrentInstall(candidate)) {
416
- return cacheTrustedDetection(candidate, 'global-root-owner');
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 && isCommandAvailable(resolvePackageManagerCommand(hintedPm)) && isPackageInstalledWith(hintedPm)) {
449
- return detectionResult(hintedPm, 'hinted-visible-install');
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 && isCommandAvailable(resolvePackageManagerCommand(runtimePm)) && isPackageInstalledWith(runtimePm)) {
454
- return detectionResult(runtimePm, 'runtime-visible-install');
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 pmChecks = [
458
- { name: 'pnpm', check: () => isCommandAvailable(resolvePackageManagerCommand('pnpm')) },
459
- { name: 'yarn', check: () => isCommandAvailable(resolvePackageManagerCommand('yarn')) },
460
- { name: 'bun', check: () => isCommandAvailable(resolvePackageManagerCommand('bun')) },
461
- { name: 'npm', check: () => isCommandAvailable(resolvePackageManagerCommand('npm')) },
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
- for (const { name, check } of pmChecks) {
465
- if (check() && isPackageInstalledWith(name)) {
466
- return detectionResult(name, 'last-resort-visible-install');
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
- return detectionResult('npm', 'default-fallback');
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
- const candidates = getPackageManagerCommandCandidates(pm);
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
- try {
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 isPackageInstalledWith(pm) {
961
+ function* isPackageInstalledWithGen(pm) {
697
962
  try {
698
- const pmCommand = resolvePackageManagerCommand(pm);
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
- const result = spawnSync(pmCommand, args, {
715
- encoding: 'utf8',
716
- stdio: ['ignore', 'pipe', 'pipe'],
717
- timeout: 10000,
718
- ...getSpawnSyncBaseOptions(),
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 pm = detectPackageManager();
1207
+ const channel = normalizeServerUpdateChannel(options.channel);
939
1208
  const appType = normalizeAppType(options.appType);
940
1209
  const platform = normalizePlatform(options.platform);
941
- const channel = normalizeServerUpdateChannel(options.channel);
942
- const target = currentVersion === 'unknown'
943
- ? null
944
- : await getRegistryUpdateTarget(currentVersion, channel);
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') {