@agimon-ai/po 0.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (560) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +755 -0
  3. package/assets/banner.png +0 -0
  4. package/assets/banner.svg +25 -0
  5. package/assets/favicon.svg +15 -0
  6. package/assets/logo-light.png +0 -0
  7. package/assets/logo-light.svg +25 -0
  8. package/assets/logo.png +0 -0
  9. package/assets/logo.svg +25 -0
  10. package/assets/mascot.png +0 -0
  11. package/assets/mascot.svg +25 -0
  12. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  13. package/dist/antigravity.cjs +5 -0
  14. package/dist/antigravity.d.mts +2 -0
  15. package/dist/antigravity.mjs +2 -0
  16. package/dist/apiContracts.cjs +11 -0
  17. package/dist/apiContracts.cjs.map +1 -0
  18. package/dist/apiContracts.d.mts +52 -0
  19. package/dist/apiContracts.d.mts.map +1 -0
  20. package/dist/apiContracts.mjs +7 -0
  21. package/dist/apiContracts.mjs.map +1 -0
  22. package/dist/baseCommand.cjs +3 -0
  23. package/dist/baseCommand.d.mts +2 -0
  24. package/dist/baseCommand.mjs +2 -0
  25. package/dist/bin/cli.cjs +24 -0
  26. package/dist/bin/cli.cjs.map +1 -0
  27. package/dist/bin/cli.d.mts +1 -0
  28. package/dist/bin/cli.mjs +25 -0
  29. package/dist/bin/cli.mjs.map +1 -0
  30. package/dist/bin/doomRunner.cjs +33 -0
  31. package/dist/bin/doomRunner.cjs.map +1 -0
  32. package/dist/bin/doomRunner.d.mts +4 -0
  33. package/dist/bin/doomRunner.d.mts.map +1 -0
  34. package/dist/bin/doomRunner.mjs +32 -0
  35. package/dist/bin/doomRunner.mjs.map +1 -0
  36. package/dist/bin/serve.cjs +30 -0
  37. package/dist/bin/serve.cjs.map +1 -0
  38. package/dist/bin/serve.d.mts +1 -0
  39. package/dist/bin/serve.mjs +31 -0
  40. package/dist/bin/serve.mjs.map +1 -0
  41. package/dist/builders/cli/extensionAssembler/index.cjs +342 -0
  42. package/dist/builders/cli/extensionAssembler/index.cjs.map +1 -0
  43. package/dist/builders/cli/extensionAssembler/index.d.mts +85 -0
  44. package/dist/builders/cli/extensionAssembler/index.d.mts.map +1 -0
  45. package/dist/builders/cli/extensionAssembler/index.mjs +335 -0
  46. package/dist/builders/cli/extensionAssembler/index.mjs.map +1 -0
  47. package/dist/catalog/index.json +430 -0
  48. package/dist/cli.cjs +28 -0
  49. package/dist/cli.d.mts +11 -0
  50. package/dist/cli.mjs +11 -0
  51. package/dist/cliApp.cjs +6 -0
  52. package/dist/cliApp.d.mts +2 -0
  53. package/dist/cliApp.mjs +2 -0
  54. package/dist/codex.cjs +8 -0
  55. package/dist/codex.d.mts +2 -0
  56. package/dist/codex.mjs +2 -0
  57. package/dist/commands.cjs +18 -0
  58. package/dist/commands.d.mts +9 -0
  59. package/dist/commands.mjs +9 -0
  60. package/dist/compatibility.cjs +27 -0
  61. package/dist/compatibility.d.mts +6 -0
  62. package/dist/compatibility.mjs +6 -0
  63. package/dist/compatibilityCommand.cjs +4 -0
  64. package/dist/compatibilityCommand.d.mts +2 -0
  65. package/dist/compatibilityCommand.mjs +2 -0
  66. package/dist/compatibilityContext.cjs +3 -0
  67. package/dist/compatibilityContext.d.mts +2 -0
  68. package/dist/compatibilityContext.mjs +2 -0
  69. package/dist/compatibilityOptions.cjs +5 -0
  70. package/dist/compatibilityOptions.d.mts +2 -0
  71. package/dist/compatibilityOptions.mjs +2 -0
  72. package/dist/config.cjs +163 -0
  73. package/dist/config.d.mts +7 -0
  74. package/dist/config.mjs +7 -0
  75. package/dist/doctorCommand.cjs +5 -0
  76. package/dist/doctorCommand.d.mts +2 -0
  77. package/dist/doctorCommand.mjs +2 -0
  78. package/dist/emitMcpCommand.cjs +4 -0
  79. package/dist/emitMcpCommand.d.mts +2 -0
  80. package/dist/emitMcpCommand.mjs +2 -0
  81. package/dist/explainCommand.cjs +5 -0
  82. package/dist/explainCommand.d.mts +2 -0
  83. package/dist/explainCommand.mjs +2 -0
  84. package/dist/extensions/server.cjs +39 -0
  85. package/dist/extensions/server.cjs.map +1 -0
  86. package/dist/extensions/server.d.mts +5 -0
  87. package/dist/extensions/server.d.mts.map +1 -0
  88. package/dist/extensions/server.mjs +34 -0
  89. package/dist/extensions/server.mjs.map +1 -0
  90. package/dist/harnessContext.cjs +5 -0
  91. package/dist/harnessContext.d.mts +2 -0
  92. package/dist/harnessContext.mjs +2 -0
  93. package/dist/harnessState.cjs +19 -0
  94. package/dist/harnessState.d.mts +2 -0
  95. package/dist/harnessState.mjs +2 -0
  96. package/dist/help.cjs +12 -0
  97. package/dist/help.d.mts +6 -0
  98. package/dist/help.mjs +6 -0
  99. package/dist/index.cjs +306 -0
  100. package/dist/index.d.mts +40 -0
  101. package/dist/index.mjs +37 -0
  102. package/dist/initCommand.cjs +4 -0
  103. package/dist/initCommand.d.mts +2 -0
  104. package/dist/initCommand.mjs +2 -0
  105. package/dist/matrixOptions.cjs +28 -0
  106. package/dist/matrixOptions.d.mts +2 -0
  107. package/dist/matrixOptions.mjs +2 -0
  108. package/dist/matrixSwitcher.cjs +11 -0
  109. package/dist/matrixSwitcher.d.mts +3 -0
  110. package/dist/matrixSwitcher.mjs +3 -0
  111. package/dist/mcpFilter.cjs +9 -0
  112. package/dist/mcpFilter.d.mts +1 -0
  113. package/dist/mcpFilter.mjs +2 -0
  114. package/dist/options.cjs +3 -0
  115. package/dist/options.d.mts +2 -0
  116. package/dist/options.mjs +2 -0
  117. package/dist/process.cjs +12 -0
  118. package/dist/process.d.mts +2 -0
  119. package/dist/process.mjs +2 -0
  120. package/dist/projectTrust.cjs +6 -0
  121. package/dist/projectTrust.d.mts +2 -0
  122. package/dist/projectTrust.mjs +2 -0
  123. package/dist/repository.cjs +5 -0
  124. package/dist/repository.d.mts +2 -0
  125. package/dist/repository.mjs +2 -0
  126. package/dist/resourceCollector.cjs +9 -0
  127. package/dist/resourceCollector.d.mts +1 -0
  128. package/dist/resourceCollector.mjs +2 -0
  129. package/dist/router.cjs +6 -0
  130. package/dist/router.d.mts +2 -0
  131. package/dist/router.mjs +2 -0
  132. package/dist/services.cjs +97 -0
  133. package/dist/services.d.mts +12 -0
  134. package/dist/services.mjs +12 -0
  135. package/dist/shared.cjs +18 -0
  136. package/dist/shared.d.mts +2 -0
  137. package/dist/shared.mjs +2 -0
  138. package/dist/src/bin/agentDirectory.cjs +27 -0
  139. package/dist/src/bin/agentDirectory.cjs.map +1 -0
  140. package/dist/src/bin/agentDirectory.mjs +26 -0
  141. package/dist/src/bin/agentDirectory.mjs.map +1 -0
  142. package/dist/src/builders/apiContractExport/index.cjs +126 -0
  143. package/dist/src/builders/apiContractExport/index.cjs.map +1 -0
  144. package/dist/src/builders/apiContractExport/index.mjs +123 -0
  145. package/dist/src/builders/apiContractExport/index.mjs.map +1 -0
  146. package/dist/src/builders/cli/entryResolution.cjs +39 -0
  147. package/dist/src/builders/cli/entryResolution.cjs.map +1 -0
  148. package/dist/src/builders/cli/entryResolution.mjs +35 -0
  149. package/dist/src/builders/cli/entryResolution.mjs.map +1 -0
  150. package/dist/src/builders/cli/harnessContext.cjs +175 -0
  151. package/dist/src/builders/cli/harnessContext.cjs.map +1 -0
  152. package/dist/src/builders/cli/harnessContext.d.mts +48 -0
  153. package/dist/src/builders/cli/harnessContext.d.mts.map +1 -0
  154. package/dist/src/builders/cli/harnessContext.mjs +167 -0
  155. package/dist/src/builders/cli/harnessContext.mjs.map +1 -0
  156. package/dist/src/builders/cli/sessionComposition.cjs +27 -0
  157. package/dist/src/builders/cli/sessionComposition.cjs.map +1 -0
  158. package/dist/src/builders/cli/sessionComposition.mjs +26 -0
  159. package/dist/src/builders/cli/sessionComposition.mjs.map +1 -0
  160. package/dist/src/builders/hooks/index.cjs +238 -0
  161. package/dist/src/builders/hooks/index.cjs.map +1 -0
  162. package/dist/src/builders/hooks/index.mjs +231 -0
  163. package/dist/src/builders/hooks/index.mjs.map +1 -0
  164. package/dist/src/builders/native/index.cjs +176 -0
  165. package/dist/src/builders/native/index.cjs.map +1 -0
  166. package/dist/src/builders/native/index.d.mts +36 -0
  167. package/dist/src/builders/native/index.d.mts.map +1 -0
  168. package/dist/src/builders/native/index.mjs +170 -0
  169. package/dist/src/builders/native/index.mjs.map +1 -0
  170. package/dist/src/builders/server/backgroundSync.cjs +333 -0
  171. package/dist/src/builders/server/backgroundSync.cjs.map +1 -0
  172. package/dist/src/builders/server/backgroundSync.mjs +320 -0
  173. package/dist/src/builders/server/backgroundSync.mjs.map +1 -0
  174. package/dist/src/builders/server/computerUseBinding.cjs +273 -0
  175. package/dist/src/builders/server/computerUseBinding.cjs.map +1 -0
  176. package/dist/src/builders/server/computerUseBinding.mjs +269 -0
  177. package/dist/src/builders/server/computerUseBinding.mjs.map +1 -0
  178. package/dist/src/builders/server/computerUseRecordings.cjs +188 -0
  179. package/dist/src/builders/server/computerUseRecordings.cjs.map +1 -0
  180. package/dist/src/builders/server/computerUseRecordings.mjs +184 -0
  181. package/dist/src/builders/server/computerUseRecordings.mjs.map +1 -0
  182. package/dist/src/builders/server/defaultWorkspace.cjs +38 -0
  183. package/dist/src/builders/server/defaultWorkspace.cjs.map +1 -0
  184. package/dist/src/builders/server/defaultWorkspace.mjs +35 -0
  185. package/dist/src/builders/server/defaultWorkspace.mjs.map +1 -0
  186. package/dist/src/builders/server/idleRestart.cjs +149 -0
  187. package/dist/src/builders/server/idleRestart.cjs.map +1 -0
  188. package/dist/src/builders/server/idleRestart.mjs +136 -0
  189. package/dist/src/builders/server/idleRestart.mjs.map +1 -0
  190. package/dist/src/builders/server/index.cjs +63 -0
  191. package/dist/src/builders/server/index.cjs.map +1 -0
  192. package/dist/src/builders/server/index.mjs +60 -0
  193. package/dist/src/builders/server/index.mjs.map +1 -0
  194. package/dist/src/builders/server/logSink.cjs +57 -0
  195. package/dist/src/builders/server/logSink.cjs.map +1 -0
  196. package/dist/src/builders/server/logSink.mjs +57 -0
  197. package/dist/src/builders/server/logSink.mjs.map +1 -0
  198. package/dist/src/builders/server/mcpApp.cjs +152 -0
  199. package/dist/src/builders/server/mcpApp.cjs.map +1 -0
  200. package/dist/src/builders/server/mcpApp.d.mts +18 -0
  201. package/dist/src/builders/server/mcpApp.d.mts.map +1 -0
  202. package/dist/src/builders/server/mcpApp.mjs +147 -0
  203. package/dist/src/builders/server/mcpApp.mjs.map +1 -0
  204. package/dist/src/builders/server/mcpAppBuild.cjs +111 -0
  205. package/dist/src/builders/server/mcpAppBuild.cjs.map +1 -0
  206. package/dist/src/builders/server/mcpAppBuild.d.mts +24 -0
  207. package/dist/src/builders/server/mcpAppBuild.d.mts.map +1 -0
  208. package/dist/src/builders/server/mcpAppBuild.mjs +105 -0
  209. package/dist/src/builders/server/mcpAppBuild.mjs.map +1 -0
  210. package/dist/src/builders/server/mcpBundle.cjs +87 -0
  211. package/dist/src/builders/server/mcpBundle.cjs.map +1 -0
  212. package/dist/src/builders/server/mcpBundle.d.mts +23 -0
  213. package/dist/src/builders/server/mcpBundle.d.mts.map +1 -0
  214. package/dist/src/builders/server/mcpBundle.mjs +84 -0
  215. package/dist/src/builders/server/mcpBundle.mjs.map +1 -0
  216. package/dist/src/builders/server/packageReloadCheck.cjs +62 -0
  217. package/dist/src/builders/server/packageReloadCheck.cjs.map +1 -0
  218. package/dist/src/builders/server/packageReloadCheck.mjs +61 -0
  219. package/dist/src/builders/server/packageReloadCheck.mjs.map +1 -0
  220. package/dist/src/builders/server/packageUrl.cjs +210 -0
  221. package/dist/src/builders/server/packageUrl.cjs.map +1 -0
  222. package/dist/src/builders/server/packageUrl.mjs +203 -0
  223. package/dist/src/builders/server/packageUrl.mjs.map +1 -0
  224. package/dist/src/builders/server/runtime.cjs +1428 -0
  225. package/dist/src/builders/server/runtime.cjs.map +1 -0
  226. package/dist/src/builders/server/runtime.mjs +1420 -0
  227. package/dist/src/builders/server/runtime.mjs.map +1 -0
  228. package/dist/src/builders/server/runtimeResources.cjs +72 -0
  229. package/dist/src/builders/server/runtimeResources.cjs.map +1 -0
  230. package/dist/src/builders/server/runtimeResources.mjs +71 -0
  231. package/dist/src/builders/server/runtimeResources.mjs.map +1 -0
  232. package/dist/src/builders/server/selectionStatus.cjs +12 -0
  233. package/dist/src/builders/server/selectionStatus.cjs.map +1 -0
  234. package/dist/src/builders/server/selectionStatus.mjs +12 -0
  235. package/dist/src/builders/server/selectionStatus.mjs.map +1 -0
  236. package/dist/src/builders/server/sessionArguments.cjs +63 -0
  237. package/dist/src/builders/server/sessionArguments.cjs.map +1 -0
  238. package/dist/src/builders/server/sessionArguments.mjs +62 -0
  239. package/dist/src/builders/server/sessionArguments.mjs.map +1 -0
  240. package/dist/src/builders/server/shutdown.cjs +16 -0
  241. package/dist/src/builders/server/shutdown.cjs.map +1 -0
  242. package/dist/src/builders/server/shutdown.mjs +16 -0
  243. package/dist/src/builders/server/shutdown.mjs.map +1 -0
  244. package/dist/src/builders/server/webTemplateDecision.cjs +34 -0
  245. package/dist/src/builders/server/webTemplateDecision.cjs.map +1 -0
  246. package/dist/src/builders/server/webTemplateDecision.mjs +32 -0
  247. package/dist/src/builders/server/webTemplateDecision.mjs.map +1 -0
  248. package/dist/src/builders/server/workspaceCheckout.cjs +31 -0
  249. package/dist/src/builders/server/workspaceCheckout.cjs.map +1 -0
  250. package/dist/src/builders/server/workspaceCheckout.mjs +29 -0
  251. package/dist/src/builders/server/workspaceCheckout.mjs.map +1 -0
  252. package/dist/src/builders/web/bundle.cjs +225 -0
  253. package/dist/src/builders/web/bundle.cjs.map +1 -0
  254. package/dist/src/builders/web/bundle.d.mts +65 -0
  255. package/dist/src/builders/web/bundle.d.mts.map +1 -0
  256. package/dist/src/builders/web/bundle.mjs +221 -0
  257. package/dist/src/builders/web/bundle.mjs.map +1 -0
  258. package/dist/src/builders/web/bundleAssetPolicy.cjs +96 -0
  259. package/dist/src/builders/web/bundleAssetPolicy.cjs.map +1 -0
  260. package/dist/src/builders/web/bundleAssetPolicy.d.mts +22 -0
  261. package/dist/src/builders/web/bundleAssetPolicy.d.mts.map +1 -0
  262. package/dist/src/builders/web/bundleAssetPolicy.mjs +95 -0
  263. package/dist/src/builders/web/bundleAssetPolicy.mjs.map +1 -0
  264. package/dist/src/builders/web/index.cjs +361 -0
  265. package/dist/src/builders/web/index.cjs.map +1 -0
  266. package/dist/src/builders/web/index.d.mts +109 -0
  267. package/dist/src/builders/web/index.d.mts.map +1 -0
  268. package/dist/src/builders/web/index.mjs +342 -0
  269. package/dist/src/builders/web/index.mjs.map +1 -0
  270. package/dist/src/builders/web/webDevRoots.cjs +27 -0
  271. package/dist/src/builders/web/webDevRoots.cjs.map +1 -0
  272. package/dist/src/builders/web/webDevRoots.d.mts +22 -0
  273. package/dist/src/builders/web/webDevRoots.d.mts.map +1 -0
  274. package/dist/src/builders/web/webDevRoots.mjs +25 -0
  275. package/dist/src/builders/web/webDevRoots.mjs.map +1 -0
  276. package/dist/src/builders/web/webPluginGenerate.cjs +188 -0
  277. package/dist/src/builders/web/webPluginGenerate.cjs.map +1 -0
  278. package/dist/src/builders/web/webPluginGenerate.d.mts +56 -0
  279. package/dist/src/builders/web/webPluginGenerate.d.mts.map +1 -0
  280. package/dist/src/builders/web/webPluginGenerate.mjs +178 -0
  281. package/dist/src/builders/web/webPluginGenerate.mjs.map +1 -0
  282. package/dist/src/builders/web/webPluginManifest.cjs +128 -0
  283. package/dist/src/builders/web/webPluginManifest.cjs.map +1 -0
  284. package/dist/src/builders/web/webPluginManifest.d.mts +64 -0
  285. package/dist/src/builders/web/webPluginManifest.d.mts.map +1 -0
  286. package/dist/src/builders/web/webPluginManifest.mjs +118 -0
  287. package/dist/src/builders/web/webPluginManifest.mjs.map +1 -0
  288. package/dist/src/builders/web/webPluginScan.cjs +57 -0
  289. package/dist/src/builders/web/webPluginScan.cjs.map +1 -0
  290. package/dist/src/builders/web/webPluginScan.d.mts +19 -0
  291. package/dist/src/builders/web/webPluginScan.d.mts.map +1 -0
  292. package/dist/src/builders/web/webPluginScan.mjs +54 -0
  293. package/dist/src/builders/web/webPluginScan.mjs.map +1 -0
  294. package/dist/src/builders/web/webPluginVite.cjs +255 -0
  295. package/dist/src/builders/web/webPluginVite.cjs.map +1 -0
  296. package/dist/src/builders/web/webPluginVite.d.mts +64 -0
  297. package/dist/src/builders/web/webPluginVite.d.mts.map +1 -0
  298. package/dist/src/builders/web/webPluginVite.mjs +242 -0
  299. package/dist/src/builders/web/webPluginVite.mjs.map +1 -0
  300. package/dist/src/cli/cliApp.cjs +187 -0
  301. package/dist/src/cli/cliApp.cjs.map +1 -0
  302. package/dist/src/cli/cliApp.d.mts +32 -0
  303. package/dist/src/cli/cliApp.d.mts.map +1 -0
  304. package/dist/src/cli/cliApp.mjs +184 -0
  305. package/dist/src/cli/cliApp.mjs.map +1 -0
  306. package/dist/src/cli/commands/api-export/index.cjs +66 -0
  307. package/dist/src/cli/commands/api-export/index.cjs.map +1 -0
  308. package/dist/src/cli/commands/api-export/index.mjs +62 -0
  309. package/dist/src/cli/commands/api-export/index.mjs.map +1 -0
  310. package/dist/src/cli/commands/baseCommand.cjs +16 -0
  311. package/dist/src/cli/commands/baseCommand.cjs.map +1 -0
  312. package/dist/src/cli/commands/baseCommand.d.mts +24 -0
  313. package/dist/src/cli/commands/baseCommand.d.mts.map +1 -0
  314. package/dist/src/cli/commands/baseCommand.mjs +16 -0
  315. package/dist/src/cli/commands/baseCommand.mjs.map +1 -0
  316. package/dist/src/cli/commands/compat/context.cjs +115 -0
  317. package/dist/src/cli/commands/compat/context.cjs.map +1 -0
  318. package/dist/src/cli/commands/compat/context.d.mts +22 -0
  319. package/dist/src/cli/commands/compat/context.d.mts.map +1 -0
  320. package/dist/src/cli/commands/compat/context.mjs +110 -0
  321. package/dist/src/cli/commands/compat/context.mjs.map +1 -0
  322. package/dist/src/cli/commands/compat/help.cjs +26 -0
  323. package/dist/src/cli/commands/compat/help.cjs.map +1 -0
  324. package/dist/src/cli/commands/compat/help.d.mts +4 -0
  325. package/dist/src/cli/commands/compat/help.d.mts.map +1 -0
  326. package/dist/src/cli/commands/compat/help.mjs +25 -0
  327. package/dist/src/cli/commands/compat/help.mjs.map +1 -0
  328. package/dist/src/cli/commands/compat/index.cjs +73 -0
  329. package/dist/src/cli/commands/compat/index.cjs.map +1 -0
  330. package/dist/src/cli/commands/compat/index.d.mts +14 -0
  331. package/dist/src/cli/commands/compat/index.d.mts.map +1 -0
  332. package/dist/src/cli/commands/compat/index.mjs +70 -0
  333. package/dist/src/cli/commands/compat/index.mjs.map +1 -0
  334. package/dist/src/cli/commands/compat/options.cjs +88 -0
  335. package/dist/src/cli/commands/compat/options.cjs.map +1 -0
  336. package/dist/src/cli/commands/compat/options.d.mts +15 -0
  337. package/dist/src/cli/commands/compat/options.d.mts.map +1 -0
  338. package/dist/src/cli/commands/compat/options.mjs +86 -0
  339. package/dist/src/cli/commands/compat/options.mjs.map +1 -0
  340. package/dist/src/cli/commands/compat/providers/antigravity.cjs +294 -0
  341. package/dist/src/cli/commands/compat/providers/antigravity.cjs.map +1 -0
  342. package/dist/src/cli/commands/compat/providers/antigravity.d.mts +9 -0
  343. package/dist/src/cli/commands/compat/providers/antigravity.d.mts.map +1 -0
  344. package/dist/src/cli/commands/compat/providers/antigravity.mjs +289 -0
  345. package/dist/src/cli/commands/compat/providers/antigravity.mjs.map +1 -0
  346. package/dist/src/cli/commands/compat/providers/codex.cjs +178 -0
  347. package/dist/src/cli/commands/compat/providers/codex.cjs.map +1 -0
  348. package/dist/src/cli/commands/compat/providers/codex.d.mts +17 -0
  349. package/dist/src/cli/commands/compat/providers/codex.d.mts.map +1 -0
  350. package/dist/src/cli/commands/compat/providers/codex.mjs +170 -0
  351. package/dist/src/cli/commands/compat/providers/codex.mjs.map +1 -0
  352. package/dist/src/cli/commands/compat/providers/index.cjs +65 -0
  353. package/dist/src/cli/commands/compat/providers/index.cjs.map +1 -0
  354. package/dist/src/cli/commands/compat/providers/index.d.mts +15 -0
  355. package/dist/src/cli/commands/compat/providers/index.d.mts.map +1 -0
  356. package/dist/src/cli/commands/compat/providers/index.mjs +45 -0
  357. package/dist/src/cli/commands/compat/providers/index.mjs.map +1 -0
  358. package/dist/src/cli/commands/compat/providers/process.cjs +172 -0
  359. package/dist/src/cli/commands/compat/providers/process.cjs.map +1 -0
  360. package/dist/src/cli/commands/compat/providers/process.d.mts +33 -0
  361. package/dist/src/cli/commands/compat/providers/process.d.mts.map +1 -0
  362. package/dist/src/cli/commands/compat/providers/process.mjs +159 -0
  363. package/dist/src/cli/commands/compat/providers/process.mjs.map +1 -0
  364. package/dist/src/cli/commands/compat/providers/shared.cjs +76 -0
  365. package/dist/src/cli/commands/compat/providers/shared.cjs.map +1 -0
  366. package/dist/src/cli/commands/compat/providers/shared.d.mts +40 -0
  367. package/dist/src/cli/commands/compat/providers/shared.d.mts.map +1 -0
  368. package/dist/src/cli/commands/compat/providers/shared.mjs +61 -0
  369. package/dist/src/cli/commands/compat/providers/shared.mjs.map +1 -0
  370. package/dist/src/cli/commands/compat/types.d.mts +31 -0
  371. package/dist/src/cli/commands/compat/types.d.mts.map +1 -0
  372. package/dist/src/cli/commands/doctor/help.cjs +19 -0
  373. package/dist/src/cli/commands/doctor/help.cjs.map +1 -0
  374. package/dist/src/cli/commands/doctor/help.d.mts +4 -0
  375. package/dist/src/cli/commands/doctor/help.d.mts.map +1 -0
  376. package/dist/src/cli/commands/doctor/help.mjs +19 -0
  377. package/dist/src/cli/commands/doctor/help.mjs.map +1 -0
  378. package/dist/src/cli/commands/doctor/index.cjs +118 -0
  379. package/dist/src/cli/commands/doctor/index.cjs.map +1 -0
  380. package/dist/src/cli/commands/doctor/index.d.mts +33 -0
  381. package/dist/src/cli/commands/doctor/index.d.mts.map +1 -0
  382. package/dist/src/cli/commands/doctor/index.mjs +113 -0
  383. package/dist/src/cli/commands/doctor/index.mjs.map +1 -0
  384. package/dist/src/cli/commands/emit-mcp/index.cjs +32 -0
  385. package/dist/src/cli/commands/emit-mcp/index.cjs.map +1 -0
  386. package/dist/src/cli/commands/emit-mcp/index.d.mts +19 -0
  387. package/dist/src/cli/commands/emit-mcp/index.d.mts.map +1 -0
  388. package/dist/src/cli/commands/emit-mcp/index.mjs +31 -0
  389. package/dist/src/cli/commands/emit-mcp/index.mjs.map +1 -0
  390. package/dist/src/cli/commands/explain/index.cjs +155 -0
  391. package/dist/src/cli/commands/explain/index.cjs.map +1 -0
  392. package/dist/src/cli/commands/explain/index.d.mts +57 -0
  393. package/dist/src/cli/commands/explain/index.d.mts.map +1 -0
  394. package/dist/src/cli/commands/explain/index.mjs +150 -0
  395. package/dist/src/cli/commands/explain/index.mjs.map +1 -0
  396. package/dist/src/cli/commands/init/constants.cjs +11 -0
  397. package/dist/src/cli/commands/init/constants.cjs.map +1 -0
  398. package/dist/src/cli/commands/init/constants.mjs +11 -0
  399. package/dist/src/cli/commands/init/constants.mjs.map +1 -0
  400. package/dist/src/cli/commands/init/help.cjs +17 -0
  401. package/dist/src/cli/commands/init/help.cjs.map +1 -0
  402. package/dist/src/cli/commands/init/help.d.mts +4 -0
  403. package/dist/src/cli/commands/init/help.d.mts.map +1 -0
  404. package/dist/src/cli/commands/init/help.mjs +17 -0
  405. package/dist/src/cli/commands/init/help.mjs.map +1 -0
  406. package/dist/src/cli/commands/init/index.cjs +67 -0
  407. package/dist/src/cli/commands/init/index.cjs.map +1 -0
  408. package/dist/src/cli/commands/init/index.d.mts +12 -0
  409. package/dist/src/cli/commands/init/index.d.mts.map +1 -0
  410. package/dist/src/cli/commands/init/index.mjs +63 -0
  411. package/dist/src/cli/commands/init/index.mjs.map +1 -0
  412. package/dist/src/cli/commands/init/presenter.cjs +140 -0
  413. package/dist/src/cli/commands/init/presenter.cjs.map +1 -0
  414. package/dist/src/cli/commands/init/presenter.d.mts +8 -0
  415. package/dist/src/cli/commands/init/presenter.d.mts.map +1 -0
  416. package/dist/src/cli/commands/init/presenter.mjs +140 -0
  417. package/dist/src/cli/commands/init/presenter.mjs.map +1 -0
  418. package/dist/src/cli/commands/sync/help.cjs +34 -0
  419. package/dist/src/cli/commands/sync/help.cjs.map +1 -0
  420. package/dist/src/cli/commands/sync/help.d.mts +4 -0
  421. package/dist/src/cli/commands/sync/help.d.mts.map +1 -0
  422. package/dist/src/cli/commands/sync/help.mjs +34 -0
  423. package/dist/src/cli/commands/sync/help.mjs.map +1 -0
  424. package/dist/src/cli/commands/sync/index.cjs +215 -0
  425. package/dist/src/cli/commands/sync/index.cjs.map +1 -0
  426. package/dist/src/cli/commands/sync/index.d.mts +20 -0
  427. package/dist/src/cli/commands/sync/index.d.mts.map +1 -0
  428. package/dist/src/cli/commands/sync/index.mjs +206 -0
  429. package/dist/src/cli/commands/sync/index.mjs.map +1 -0
  430. package/dist/src/cli/commands/sync/presenter.cjs +58 -0
  431. package/dist/src/cli/commands/sync/presenter.cjs.map +1 -0
  432. package/dist/src/cli/commands/sync/presenter.d.mts +16 -0
  433. package/dist/src/cli/commands/sync/presenter.d.mts.map +1 -0
  434. package/dist/src/cli/commands/sync/presenter.mjs +57 -0
  435. package/dist/src/cli/commands/sync/presenter.mjs.map +1 -0
  436. package/dist/src/cli/commands/sync/workflow.cjs +16 -0
  437. package/dist/src/cli/commands/sync/workflow.cjs.map +1 -0
  438. package/dist/src/cli/commands/sync/workflow.mjs +16 -0
  439. package/dist/src/cli/commands/sync/workflow.mjs.map +1 -0
  440. package/dist/src/cli/commands/web/index.cjs +88 -0
  441. package/dist/src/cli/commands/web/index.cjs.map +1 -0
  442. package/dist/src/cli/commands/web/index.mjs +85 -0
  443. package/dist/src/cli/commands/web/index.mjs.map +1 -0
  444. package/dist/src/cli/harnessOptions.cjs +70 -0
  445. package/dist/src/cli/harnessOptions.cjs.map +1 -0
  446. package/dist/src/cli/harnessOptions.d.mts +26 -0
  447. package/dist/src/cli/harnessOptions.d.mts.map +1 -0
  448. package/dist/src/cli/harnessOptions.mjs +66 -0
  449. package/dist/src/cli/harnessOptions.mjs.map +1 -0
  450. package/dist/src/cli/help.cjs +82 -0
  451. package/dist/src/cli/help.cjs.map +1 -0
  452. package/dist/src/cli/help.d.mts +10 -0
  453. package/dist/src/cli/help.d.mts.map +1 -0
  454. package/dist/src/cli/help.mjs +78 -0
  455. package/dist/src/cli/help.mjs.map +1 -0
  456. package/dist/src/cli/matrixOptions.cjs +178 -0
  457. package/dist/src/cli/matrixOptions.cjs.map +1 -0
  458. package/dist/src/cli/matrixOptions.d.mts +90 -0
  459. package/dist/src/cli/matrixOptions.d.mts.map +1 -0
  460. package/dist/src/cli/matrixOptions.mjs +151 -0
  461. package/dist/src/cli/matrixOptions.mjs.map +1 -0
  462. package/dist/src/cli/options.cjs +281 -0
  463. package/dist/src/cli/options.cjs.map +1 -0
  464. package/dist/src/cli/options.d.mts +5 -0
  465. package/dist/src/cli/options.d.mts.map +1 -0
  466. package/dist/src/cli/options.mjs +279 -0
  467. package/dist/src/cli/options.mjs.map +1 -0
  468. package/dist/src/cli/router.cjs +57 -0
  469. package/dist/src/cli/router.cjs.map +1 -0
  470. package/dist/src/cli/router.d.mts +32 -0
  471. package/dist/src/cli/router.d.mts.map +1 -0
  472. package/dist/src/cli/router.mjs +54 -0
  473. package/dist/src/cli/router.mjs.map +1 -0
  474. package/dist/src/cli/server/options.cjs +71 -0
  475. package/dist/src/cli/server/options.cjs.map +1 -0
  476. package/dist/src/cli/server/options.mjs +70 -0
  477. package/dist/src/cli/server/options.mjs.map +1 -0
  478. package/dist/src/cli/server/processGuards.cjs +83 -0
  479. package/dist/src/cli/server/processGuards.cjs.map +1 -0
  480. package/dist/src/cli/server/processGuards.mjs +79 -0
  481. package/dist/src/cli/server/processGuards.mjs.map +1 -0
  482. package/dist/src/cli/server/run.cjs +69 -0
  483. package/dist/src/cli/server/run.cjs.map +1 -0
  484. package/dist/src/cli/server/run.mjs +66 -0
  485. package/dist/src/cli/server/run.mjs.map +1 -0
  486. package/dist/src/composition/harnessState/index.cjs +48 -0
  487. package/dist/src/composition/harnessState/index.cjs.map +1 -0
  488. package/dist/src/composition/harnessState/index.d.mts +19 -0
  489. package/dist/src/composition/harnessState/index.d.mts.map +1 -0
  490. package/dist/src/composition/harnessState/index.mjs +34 -0
  491. package/dist/src/composition/harnessState/index.mjs.map +1 -0
  492. package/dist/src/composition/layerPackageInstaller/index.cjs +651 -0
  493. package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -0
  494. package/dist/src/composition/layerPackageInstaller/index.d.mts +74 -0
  495. package/dist/src/composition/layerPackageInstaller/index.d.mts.map +1 -0
  496. package/dist/src/composition/layerPackageInstaller/index.mjs +637 -0
  497. package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -0
  498. package/dist/src/composition/poHomeMigration/index.cjs +234 -0
  499. package/dist/src/composition/poHomeMigration/index.cjs.map +1 -0
  500. package/dist/src/composition/poHomeMigration/index.d.mts +12 -0
  501. package/dist/src/composition/poHomeMigration/index.d.mts.map +1 -0
  502. package/dist/src/composition/poHomeMigration/index.mjs +226 -0
  503. package/dist/src/composition/poHomeMigration/index.mjs.map +1 -0
  504. package/dist/src/composition/projectTrust/index.cjs +51 -0
  505. package/dist/src/composition/projectTrust/index.cjs.map +1 -0
  506. package/dist/src/composition/projectTrust/index.d.mts +22 -0
  507. package/dist/src/composition/projectTrust/index.d.mts.map +1 -0
  508. package/dist/src/composition/projectTrust/index.mjs +48 -0
  509. package/dist/src/composition/projectTrust/index.mjs.map +1 -0
  510. package/dist/src/composition/repository/index.cjs +68 -0
  511. package/dist/src/composition/repository/index.cjs.map +1 -0
  512. package/dist/src/composition/repository/index.d.mts +22 -0
  513. package/dist/src/composition/repository/index.d.mts.map +1 -0
  514. package/dist/src/composition/repository/index.mjs +63 -0
  515. package/dist/src/composition/repository/index.mjs.map +1 -0
  516. package/dist/src/composition/syncPrune/index.cjs +85 -0
  517. package/dist/src/composition/syncPrune/index.cjs.map +1 -0
  518. package/dist/src/composition/syncPrune/index.d.mts +33 -0
  519. package/dist/src/composition/syncPrune/index.d.mts.map +1 -0
  520. package/dist/src/composition/syncPrune/index.mjs +82 -0
  521. package/dist/src/composition/syncPrune/index.mjs.map +1 -0
  522. package/dist/src/composition/syncService/index.cjs +808 -0
  523. package/dist/src/composition/syncService/index.cjs.map +1 -0
  524. package/dist/src/composition/syncService/index.d.mts +65 -0
  525. package/dist/src/composition/syncService/index.d.mts.map +1 -0
  526. package/dist/src/composition/syncService/index.mjs +792 -0
  527. package/dist/src/composition/syncService/index.mjs.map +1 -0
  528. package/dist/src/composition/syncService/localBuilds.cjs +367 -0
  529. package/dist/src/composition/syncService/localBuilds.cjs.map +1 -0
  530. package/dist/src/composition/syncService/localBuilds.mjs +358 -0
  531. package/dist/src/composition/syncService/localBuilds.mjs.map +1 -0
  532. package/dist/src/composition/transitionLayers.cjs +17 -0
  533. package/dist/src/composition/transitionLayers.cjs.map +1 -0
  534. package/dist/src/composition/transitionLayers.d.mts +6 -0
  535. package/dist/src/composition/transitionLayers.d.mts.map +1 -0
  536. package/dist/src/composition/transitionLayers.mjs +16 -0
  537. package/dist/src/composition/transitionLayers.mjs.map +1 -0
  538. package/dist/src/composition/types/harness.d.mts +52 -0
  539. package/dist/src/composition/types/harness.d.mts.map +1 -0
  540. package/dist/src/extensions/setupDiagnostics.cjs +65 -0
  541. package/dist/src/extensions/setupDiagnostics.cjs.map +1 -0
  542. package/dist/src/extensions/setupDiagnostics.mjs +64 -0
  543. package/dist/src/extensions/setupDiagnostics.mjs.map +1 -0
  544. package/dist/utils.cjs +4 -0
  545. package/dist/utils.d.mts +2 -0
  546. package/dist/utils.mjs +2 -0
  547. package/dist/webBuilder.cjs +59 -0
  548. package/dist/webBuilder.d.mts +9 -0
  549. package/dist/webBuilder.mjs +9 -0
  550. package/docs/server/api-export.md +86 -0
  551. package/docs/server/api.md +144 -0
  552. package/docs/server/getting-started.md +114 -0
  553. package/docs/server/index.md +67 -0
  554. package/docs/server/ipc.md +97 -0
  555. package/docs/server/lifecycle.md +108 -0
  556. package/docs/server/security.md +101 -0
  557. package/llms.txt +12 -0
  558. package/package.json +295 -0
  559. package/src/prompts/po-author-extension/SKILL.md +35 -0
  560. package/src/prompts/po-author-extension/references/extension-contract.md +134 -0
@@ -0,0 +1,637 @@
1
+ import { poPackageRoot } from "../../builders/cli/entryResolution.mjs";
2
+ import { createLayerResolvers } from "../../../builders/cli/extensionAssembler/index.mjs";
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { writeFileAtomic } from "@agimon-ai/po-core/runtimeJson";
6
+ import os from "node:os";
7
+ import { isLocalPackageSpecifier } from "@agimon-ai/po-config/majorModes";
8
+ import { consumerPackageEntry, splitPackageSpecifier } from "@agimon-ai/po-core/moduleResolution";
9
+ import crypto from "node:crypto";
10
+ import zlib from "node:zlib";
11
+ import { installRuntimePackages, resolveNewest } from "@agimon-ai/po-core/runtimePackages";
12
+ import { poHomeDirectory, poRuntimeDirectory } from "@agimon-ai/po-core/runtimePiSettings";
13
+ //#region src/composition/layerPackageInstaller/index.ts
14
+ const NPM_SOURCE_PREFIX = "npm:";
15
+ const FILE_SPECIFIER_PREFIX = "file:";
16
+ const WORKSPACE_SPECIFIER_PREFIX = "workspace:";
17
+ /** Root target of a staged catalogue archive: always the staged workspace, never the registry. */
18
+ const CATALOG_WORKSPACE_TARGET = "workspace:*";
19
+ /** Where catalogue archives are unpacked inside the runtime, one directory per archive hash. */
20
+ const CATALOG_STAGING_DIRECTORY = "catalog";
21
+ const RUNTIME_PACKAGE_NAME = "po-runtime";
22
+ const UNPINNED_PACKAGE_RANGE = "*";
23
+ const PACKAGE_MANIFEST = "package.json";
24
+ const NODE_MODULES = "node_modules";
25
+ const PACKAGE_CATALOG_ENV = "PO_PACKAGE_CATALOG";
26
+ /** The registry catalogue a release writes into the CLI package: `<package root>/dist/catalog/index.json`. */
27
+ const BUNDLED_CATALOG_SEGMENTS = [
28
+ "dist",
29
+ "catalog",
30
+ "index.json"
31
+ ];
32
+ /** upm error codes that mean the registry could not be reached, so the store may still answer. */
33
+ const NETWORK_FAILURE_CODES = /* @__PURE__ */ new Set([
34
+ "ENETWORK",
35
+ "ETIMEDOUT",
36
+ "EREGISTRY"
37
+ ]);
38
+ function overridePackageName(selector) {
39
+ const separatorIndex = selector.indexOf("@", selector.startsWith("@") ? 1 : 0);
40
+ return separatorIndex === -1 ? selector : selector.slice(0, separatorIndex);
41
+ }
42
+ /**
43
+ * Same-major patches for transitive versions pinned by the current foundation packages.
44
+ * Package managers only honor overrides from the install root, so published extensions
45
+ * cannot carry these fixes in their own manifests.
46
+ */
47
+ const SAFE_TRANSITIVE_OVERRIDES = {
48
+ "@hono/node-server@2.0.0 - 2.0.9": "^2.0.10",
49
+ "@opentelemetry/core@2.0.0 - 2.7.999": "2.8.0",
50
+ "brace-expansion@1.0.0 - 1.1.20": "^1.1.21",
51
+ "brace-expansion@5.0.0 - 5.0.11": "^5.0.12",
52
+ "hono@4.0.0 - 4.13.7": "4.13.8",
53
+ "js-yaml@4.0.0 - 4.3.1": "^4.3.2",
54
+ "js-yaml@5.0.0 - 5.2.1": "^5.2.2",
55
+ "liquidjs@10.0.0 - 10.27.1": "^10.27.2",
56
+ "protobufjs@8.0.0 - 8.7.1": "^8.7.2",
57
+ "undici@7.0.0 - 7.29.0": "^7.29.1"
58
+ };
59
+ const SAFE_TRANSITIVE_PACKAGE_NAMES = new Set(Object.keys(SAFE_TRANSITIVE_OVERRIDES).map(overridePackageName));
60
+ function isRecord$1(value) {
61
+ return typeof value === "object" && value !== null && !Array.isArray(value);
62
+ }
63
+ function recordValue(value) {
64
+ return isRecord$1(value) ? { ...value } : {};
65
+ }
66
+ function withoutConflictingTransitiveOverrides(value) {
67
+ const overrides = recordValue(value);
68
+ for (const [selector, replacement] of Object.entries(overrides)) if (SAFE_TRANSITIVE_PACKAGE_NAMES.has(overridePackageName(selector))) delete overrides[selector];
69
+ else if (isRecord$1(replacement)) overrides[selector] = withoutConflictingTransitiveOverrides(replacement);
70
+ return overrides;
71
+ }
72
+ /** Earlier versions overrode catalog packages with relative `file:` targets; any other override is not Po's. */
73
+ function withoutCatalogOverrides(overrides) {
74
+ return Object.fromEntries(Object.entries(overrides).filter(([, replacement]) => !(typeof replacement === "string" && replacement.startsWith(FILE_SPECIFIER_PREFIX))));
75
+ }
76
+ /** The published (non-local, required) package specifiers the default and the given layers name. */
77
+ function configuredPackageSpecifiers(config, layers) {
78
+ const specifiers = /* @__PURE__ */ new Set();
79
+ const selectedDefinitions = [...config.default ? [config.default] : [], ...layers.map((layerName) => {
80
+ const layer = config.layers[layerName];
81
+ if (!layer) throw new Error(`Unknown layer: ${layerName}`);
82
+ return layer;
83
+ })];
84
+ for (const layer of selectedDefinitions) for (const configured of layer.packages ?? []) {
85
+ const specifier = typeof configured === "string" ? configured : configured.name;
86
+ if (!(typeof configured !== "string" && configured.optional === true) && !isLocalPackageSpecifier(specifier)) specifiers.add(specifier);
87
+ }
88
+ return [...specifiers];
89
+ }
90
+ function resolvePackageEntries(resolvers, specifier) {
91
+ const entries = resolvers.optionalPackageEntries?.(specifier);
92
+ if (entries !== void 0) return entries;
93
+ const entry = resolvers.optionalPackageEntry(specifier);
94
+ return entry ? [entry] : void 0;
95
+ }
96
+ function readRuntimeManifest(manifestPath) {
97
+ const current = fs.existsSync(manifestPath) ? fs.readFileSync(manifestPath, "utf8") : void 0;
98
+ if (current === void 0) return {
99
+ current,
100
+ manifest: {
101
+ name: RUNTIME_PACKAGE_NAME,
102
+ private: true
103
+ }
104
+ };
105
+ const parsed = JSON.parse(current);
106
+ if (!isRecord$1(parsed)) throw new Error(`Po runtime package manifest at ${manifestPath} must be a JSON object.`);
107
+ return {
108
+ current,
109
+ manifest: parsed
110
+ };
111
+ }
112
+ /** Names the runtime manifest already declares: what earlier runs, from any root, installed there. */
113
+ function declaredRuntimePackages(runtimeDirectory) {
114
+ const manifestPath = path.join(runtimeDirectory, PACKAGE_MANIFEST);
115
+ if (!fs.existsSync(manifestPath)) return /* @__PURE__ */ new Set();
116
+ return new Set(Object.keys(recordValue(readRuntimeManifest(manifestPath).manifest.dependencies)));
117
+ }
118
+ /**
119
+ * Adds a package set and the patched transitive policy to the shared runtime manifest.
120
+ *
121
+ * `targets` pins names to exact versions or `workspace:*`. `catalogWorkspaces` maps each
122
+ * staged catalogue archive's name to its directory relative to the runtime; the manifest
123
+ * lists exactly those directories as its `workspaces`, so a catalogue package's dependency
124
+ * on another one links the staged copy instead of reaching the registry. Both `overrides` and
125
+ * `pnpm.overrides` are written; upm reads both.
126
+ * With `exact`, declared names outside `sources` are dropped instead of kept.
127
+ */
128
+ function ensureManagedPackageManifest(runtimeDirectory, sources, targets = /* @__PURE__ */ new Map(), catalogWorkspaces = {}, exact = false) {
129
+ const manifestPath = path.join(runtimeDirectory, PACKAGE_MANIFEST);
130
+ const { current, manifest } = readRuntimeManifest(manifestPath);
131
+ const declared = recordValue(manifest.dependencies);
132
+ const sourceNames = new Set(sources.map(packageName));
133
+ const dependencies = exact ? Object.fromEntries(Object.entries(declared).filter(([name]) => sourceNames.has(name))) : declared;
134
+ for (const [name, declared] of Object.entries(dependencies)) if (Object.hasOwn(catalogWorkspaces, name)) dependencies[name] = CATALOG_WORKSPACE_TARGET;
135
+ else if (typeof declared === "string" && (declared.startsWith(FILE_SPECIFIER_PREFIX) || declared.startsWith(WORKSPACE_SPECIFIER_PREFIX))) dependencies[name] = UNPINNED_PACKAGE_RANGE;
136
+ for (const source of sources) {
137
+ const name = packageName(source);
138
+ const target = targets.get(name);
139
+ if (target !== void 0) dependencies[name] = target;
140
+ else if (!Object.hasOwn(dependencies, name)) dependencies[name] = UNPINNED_PACKAGE_RANGE;
141
+ }
142
+ manifest.dependencies = dependencies;
143
+ const workspaces = Object.values(catalogWorkspaces).sort();
144
+ if (workspaces.length > 0) manifest.workspaces = workspaces;
145
+ else delete manifest.workspaces;
146
+ manifest.overrides = {
147
+ ...withoutCatalogOverrides(withoutConflictingTransitiveOverrides(manifest.overrides)),
148
+ ...SAFE_TRANSITIVE_OVERRIDES
149
+ };
150
+ const pnpm = recordValue(manifest.pnpm);
151
+ pnpm.overrides = {
152
+ ...withoutCatalogOverrides(withoutConflictingTransitiveOverrides(pnpm.overrides)),
153
+ ...SAFE_TRANSITIVE_OVERRIDES
154
+ };
155
+ manifest.pnpm = pnpm;
156
+ const serialized = `${JSON.stringify(manifest, null, 2)}\n`;
157
+ if (serialized === current) return false;
158
+ fs.mkdirSync(runtimeDirectory, { recursive: true });
159
+ writeFileAtomic(manifestPath, serialized);
160
+ return true;
161
+ }
162
+ /** Finds required npm packages selected by defaults and active layers that Po cannot resolve. */
163
+ function missingLayerPackageSpecifiers(config, layers, resolvers) {
164
+ return configuredPackageSpecifiers(config, layers).filter((specifier) => resolvePackageEntries(resolvers, specifier) === void 0);
165
+ }
166
+ /** Whether `root`'s own node_modules chain holds the package, walked the way Node looks it up from `root`. */
167
+ function ownsPackage(name, root) {
168
+ for (let directory = path.resolve(root);; directory = path.dirname(directory)) {
169
+ if (fs.existsSync(path.join(directory, NODE_MODULES, name, PACKAGE_MANIFEST))) return true;
170
+ if (path.dirname(directory) === directory) return false;
171
+ }
172
+ }
173
+ /**
174
+ * The required npm packages the default and the given layers name that `root` does not get
175
+ * from its own node_modules chain: what the shared runtime provides for it, whether it does so
176
+ * already or not yet. Sync declares exactly these, over every root, in the runtime manifest; a
177
+ * name the runtime already provides still counts, or the next exact manifest would drop it.
178
+ */
179
+ function runtimeLayerPackageSpecifiers(config, layers, root) {
180
+ return configuredPackageSpecifiers(config, layers).filter((specifier) => !ownsPackage(splitPackageSpecifier(specifier).name, root));
181
+ }
182
+ function packageName(source) {
183
+ const specifier = source.startsWith(NPM_SOURCE_PREFIX) ? source.slice(4) : source;
184
+ if (specifier.startsWith("@")) {
185
+ const slash = specifier.indexOf("/");
186
+ const version = slash === -1 ? -1 : specifier.indexOf("@", slash);
187
+ return version === -1 ? specifier : specifier.slice(0, version);
188
+ }
189
+ const version = specifier.indexOf("@");
190
+ return version === -1 ? specifier : specifier.slice(0, version);
191
+ }
192
+ const EMPTY_CATALOG = {
193
+ packages: /* @__PURE__ */ new Map(),
194
+ install: []
195
+ };
196
+ function stringList(value) {
197
+ if (!Array.isArray(value)) return void 0;
198
+ const strings = value.filter((item) => typeof item === "string");
199
+ return strings.length === value.length ? strings : void 0;
200
+ }
201
+ function defaultBundledCatalogPath() {
202
+ try {
203
+ return path.join(poPackageRoot(), ...BUNDLED_CATALOG_SEGMENTS);
204
+ } catch {
205
+ return;
206
+ }
207
+ }
208
+ /**
209
+ * The first catalogue present: `PO_PACKAGE_CATALOG` (desktop's archives), then the one
210
+ * a release bundles into the CLI. With neither, the runtime installs only what roots name.
211
+ */
212
+ function packageCatalogPath(environment) {
213
+ const configured = environment[PACKAGE_CATALOG_ENV]?.trim();
214
+ if (configured) return configured;
215
+ const bundledCatalogPath = defaultBundledCatalogPath();
216
+ return bundledCatalogPath !== void 0 && fs.existsSync(bundledCatalogPath) ? bundledCatalogPath : void 0;
217
+ }
218
+ function readPackageCatalog(manifestPath) {
219
+ if (!manifestPath) return EMPTY_CATALOG;
220
+ const parsed = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
221
+ if (!isRecord$1(parsed) || parsed.version !== 1 || !isRecord$1(parsed.packages)) throw new Error(`Unsupported Po package catalog: ${manifestPath}`);
222
+ const packages = /* @__PURE__ */ new Map();
223
+ for (const [name, value] of Object.entries(parsed.packages)) {
224
+ if (!isRecord$1(value) || !Array.isArray(value.dependencies) || value.archive !== void 0 && typeof value.archive !== "string" || value.version !== void 0 && typeof value.version !== "string" || value.archive === void 0 && value.version === void 0) throw new Error(`Invalid package entry for ${name} in ${manifestPath}`);
225
+ const dependencies = stringList(value.dependencies);
226
+ if (!dependencies) throw new Error(`Invalid dependencies for ${name} in ${manifestPath}`);
227
+ const version = typeof value.version === "string" ? value.version : void 0;
228
+ if (typeof value.archive !== "string") {
229
+ packages.set(name, {
230
+ version,
231
+ dependencies
232
+ });
233
+ continue;
234
+ }
235
+ const archive = path.resolve(path.dirname(manifestPath), value.archive);
236
+ if (!fs.existsSync(archive)) throw new Error(`Po package catalog archive is missing: ${archive}`);
237
+ packages.set(name, {
238
+ archive,
239
+ version,
240
+ dependencies
241
+ });
242
+ }
243
+ const install = parsed.install === void 0 ? [] : stringList(parsed.install);
244
+ if (!install) throw new Error(`Invalid install list in ${manifestPath}`);
245
+ const unknown = install.filter((name) => !packages.has(name));
246
+ if (unknown.length > 0) throw new Error(`Po package catalog installs unlisted package(s): ${unknown.join(", ")}`);
247
+ return {
248
+ packages,
249
+ install
250
+ };
251
+ }
252
+ /**
253
+ * The catalogue's `install` list as exact `name@version` specifiers for
254
+ * `EnsureLayerPackagesOptions.specifiers`; empty when no catalogue is present.
255
+ */
256
+ function catalogInstallSpecifiers(environment = process.env) {
257
+ const catalog = readPackageCatalog(packageCatalogPath(environment));
258
+ return catalog.install.map((name) => {
259
+ const version = catalog.packages.get(name)?.version;
260
+ return version ? `${name}@${version}` : name;
261
+ });
262
+ }
263
+ /**
264
+ * The installed package roots of the catalogue's `install` list, resolved the way a root
265
+ * resolves a bare name (its own node_modules, then the shared runtime). The global web build
266
+ * covers them, so every first-party plugin has a slot; a name not installed yet is left out.
267
+ */
268
+ function catalogPackageRoots(globalRoot, environment = process.env) {
269
+ const roots = [];
270
+ for (const name of readPackageCatalog(packageCatalogPath(environment)).install) {
271
+ const manifest = consumerPackageEntry(`${name}/${PACKAGE_MANIFEST}`, globalRoot, environment);
272
+ if (manifest !== void 0) roots.push(path.dirname(fs.realpathSync(manifest)));
273
+ }
274
+ return roots;
275
+ }
276
+ /** SHA-256 of the catalogue file in use, or `none` when no catalogue is present. */
277
+ function packageCatalogHash(environment = process.env) {
278
+ const catalogPath = packageCatalogPath(environment);
279
+ if (!catalogPath) return "none";
280
+ return crypto.createHash("sha256").update(fs.readFileSync(catalogPath)).digest("hex");
281
+ }
282
+ /** Exact target per catalogue name: its staged workspace for an archive, else its registry version. */
283
+ function catalogTargets(catalog) {
284
+ return new Map([...catalog.packages].flatMap(([name, entry]) => {
285
+ if (entry.archive !== void 0) return [[name, CATALOG_WORKSPACE_TARGET]];
286
+ return entry.version !== void 0 ? [[name, entry.version]] : [];
287
+ }));
288
+ }
289
+ const TAR_BLOCK_SIZE = 512;
290
+ const TAR_EXECUTABLE_BITS = 73;
291
+ function tarString(block, start, length) {
292
+ const field = block.subarray(start, start + length);
293
+ const end = field.indexOf(0);
294
+ return field.subarray(0, end === -1 ? field.length : end).toString("utf8");
295
+ }
296
+ function tarNumber(block, start, length) {
297
+ const field = block.subarray(start, start + length);
298
+ if ((field[0] & 128) !== 0) return field.subarray(1).reduce((value, byte) => value * 256 + byte, field[0] & 127);
299
+ const text = tarString(block, start, length).trim();
300
+ return text === "" ? 0 : Number.parseInt(text, 8);
301
+ }
302
+ /** The `path` record of a pax extended header, if it has one. */
303
+ function paxPath(data) {
304
+ let found;
305
+ let offset = 0;
306
+ while (offset < data.length) {
307
+ const space = data.indexOf(32, offset);
308
+ if (space === -1) break;
309
+ const length = Number.parseInt(data.subarray(offset, space).toString("utf8"), 10);
310
+ if (!Number.isFinite(length) || length <= 0) break;
311
+ const record = data.subarray(space + 1, offset + length - 1).toString("utf8");
312
+ const separator = record.indexOf("=");
313
+ if (record.slice(0, separator) === "path") found = record.slice(separator + 1);
314
+ offset += length;
315
+ }
316
+ return found;
317
+ }
318
+ /**
319
+ * Unpacks a gzipped npm package archive into `destination`, dropping the archive's top
320
+ * directory (`package/`) as npm does. Only files and directories are written: npm package
321
+ * archives carry no links, and an entry that would land outside `destination` is refused.
322
+ */
323
+ function extractPackageArchive(archive, destination) {
324
+ const data = zlib.gunzipSync(fs.readFileSync(archive));
325
+ let offset = 0;
326
+ let nextPath;
327
+ while (offset + TAR_BLOCK_SIZE <= data.length) {
328
+ const header = data.subarray(offset, offset + TAR_BLOCK_SIZE);
329
+ if (header.every((byte) => byte === 0)) break;
330
+ const size = tarNumber(header, 124, 12);
331
+ const type = String.fromCharCode(header[156]);
332
+ const body = data.subarray(offset + TAR_BLOCK_SIZE, offset + TAR_BLOCK_SIZE + size);
333
+ offset += TAR_BLOCK_SIZE + Math.ceil(size / TAR_BLOCK_SIZE) * TAR_BLOCK_SIZE;
334
+ if (type === "x" || type === "L") {
335
+ nextPath = type === "x" ? paxPath(body) ?? nextPath : tarString(body, 0, body.length);
336
+ continue;
337
+ }
338
+ if (type === "g") continue;
339
+ const prefix = tarString(header, 345, 155);
340
+ const name = nextPath ?? (prefix ? `${prefix}/${tarString(header, 0, 100)}` : tarString(header, 0, 100));
341
+ nextPath = void 0;
342
+ if (type !== "0" && type !== "\0" && type !== "5") continue;
343
+ const relative = name.split("/").slice(1).join("/");
344
+ if (relative === "") continue;
345
+ const target = path.resolve(destination, relative);
346
+ if (!target.startsWith(`${destination}${path.sep}`)) throw new Error(`Po package catalog archive ${archive} has an entry outside the package: ${name}`);
347
+ if (type === "5") {
348
+ fs.mkdirSync(target, { recursive: true });
349
+ continue;
350
+ }
351
+ fs.mkdirSync(path.dirname(target), { recursive: true });
352
+ const executable = (tarNumber(header, 100, 8) & TAR_EXECUTABLE_BITS) !== 0;
353
+ fs.writeFileSync(target, body, { mode: executable ? 493 : 420 });
354
+ }
355
+ }
356
+ /** Dependency fields of a staged manifest that may name another catalogue package. */
357
+ const STAGED_DEPENDENCY_FIELDS = [
358
+ "dependencies",
359
+ "optionalDependencies",
360
+ "peerDependencies"
361
+ ];
362
+ /**
363
+ * Unpacks one catalogue archive into `<runtime>/catalog/<hash>` and returns that directory
364
+ * relative to the runtime, with the catalogue names its manifest depends on.
365
+ *
366
+ * upm only installs a package from a directory as a workspace: a `file:` archive takes its own
367
+ * dependencies from the registry, so one catalogue archive could not depend on another. In the
368
+ * staged manifest every dependency on another catalogue archive becomes `workspace:*`, so the
369
+ * catalogue's copy wins whatever range the package declared, and `devDependencies`, which a
370
+ * workspace would otherwise install, are dropped. The hash covers the archive bytes and the
371
+ * catalogue's archive names, everything that rewrite reads, so a staged directory is reused.
372
+ */
373
+ function stageCatalogArchive(runtimeDirectory, archive, archiveNames) {
374
+ const hash = crypto.createHash("sha256").update(fs.readFileSync(archive)).update(`\0${[...archiveNames].sort().join("\n")}`).digest("hex");
375
+ const relative = `${CATALOG_STAGING_DIRECTORY}/${hash}`;
376
+ const directory = path.join(runtimeDirectory, CATALOG_STAGING_DIRECTORY, hash);
377
+ const stagedManifest = path.join(directory, PACKAGE_MANIFEST);
378
+ if (!fs.existsSync(stagedManifest)) {
379
+ const temporary = `${directory}.${String(process.pid)}.${crypto.randomUUID()}.tmp`;
380
+ try {
381
+ extractPackageArchive(archive, temporary);
382
+ const manifestPath = path.join(temporary, PACKAGE_MANIFEST);
383
+ if (!fs.existsSync(manifestPath)) throw new Error(`Po package catalog archive has no package.json: ${archive}`);
384
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
385
+ if (!isRecord$1(manifest)) throw new Error(`Po package catalog archive has an invalid package.json: ${archive}`);
386
+ delete manifest.devDependencies;
387
+ for (const field of STAGED_DEPENDENCY_FIELDS) {
388
+ if (!isRecord$1(manifest[field])) continue;
389
+ const declared = { ...manifest[field] };
390
+ for (const name of Object.keys(declared)) if (archiveNames.has(name)) declared[name] = CATALOG_WORKSPACE_TARGET;
391
+ manifest[field] = declared;
392
+ }
393
+ fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
394
+ try {
395
+ fs.renameSync(temporary, directory);
396
+ } catch (error) {
397
+ if (!fs.existsSync(stagedManifest)) throw error;
398
+ }
399
+ } finally {
400
+ fs.rmSync(temporary, {
401
+ recursive: true,
402
+ force: true
403
+ });
404
+ }
405
+ }
406
+ const staged = recordValue(JSON.parse(fs.readFileSync(stagedManifest, "utf8")));
407
+ return {
408
+ relative,
409
+ dependencies: STAGED_DEPENDENCY_FIELDS.flatMap((field) => Object.keys(recordValue(staged[field]))).filter((name) => archiveNames.has(name))
410
+ };
411
+ }
412
+ /**
413
+ * Stages the archive of every named catalogue package and of every catalogue package those
414
+ * name in turn, since a staged manifest's `workspace:*` needs that workspace present. The
415
+ * result, name to staged directory, feeds `ensureManagedPackageManifest`.
416
+ */
417
+ function stageCatalogArchives(runtimeDirectory, catalog, names) {
418
+ const archiveNames = new Set([...catalog.packages].flatMap(([name, entry]) => entry.archive === void 0 ? [] : [name]));
419
+ const staged = {};
420
+ const pending = [...names].filter((name) => archiveNames.has(name));
421
+ while (pending.length > 0) {
422
+ const name = pending.shift();
423
+ if (Object.hasOwn(staged, name)) continue;
424
+ const { relative, dependencies } = stageCatalogArchive(runtimeDirectory, catalog.packages.get(name).archive, archiveNames);
425
+ staged[name] = relative;
426
+ pending.push(...dependencies);
427
+ }
428
+ return staged;
429
+ }
430
+ /**
431
+ * Removes staged archives the runtime manifest no longer lists as workspaces, and returns their
432
+ * folder names. An install never calls this: a running server imports from these folders (its
433
+ * `.po-snapshots` live there), so sync prunes them under the same gate as the runtime store.
434
+ */
435
+ function pruneStagedCatalogArchives(runtimeDirectory) {
436
+ const stagingDirectory = path.join(runtimeDirectory, CATALOG_STAGING_DIRECTORY);
437
+ if (!fs.existsSync(stagingDirectory)) return [];
438
+ const { manifest } = readRuntimeManifest(path.join(runtimeDirectory, PACKAGE_MANIFEST));
439
+ const kept = new Set((stringList(manifest.workspaces) ?? []).map((relative) => path.basename(relative)));
440
+ return fs.readdirSync(stagingDirectory).filter((entry) => !kept.has(entry)).map((entry) => {
441
+ fs.rmSync(path.join(stagingDirectory, entry), {
442
+ recursive: true,
443
+ force: true
444
+ });
445
+ return entry;
446
+ });
447
+ }
448
+ /** Splits `name@version` (scoped or not); the version is absent for a bare name or subpath. */
449
+ function splitVersionedSpecifier(specifier) {
450
+ const separator = specifier.indexOf("@", specifier.startsWith("@") ? 1 : 0);
451
+ if (separator === -1) return { name: splitPackageSpecifier(specifier).name };
452
+ return {
453
+ name: specifier.slice(0, separator),
454
+ version: specifier.slice(separator + 1)
455
+ };
456
+ }
457
+ function npmSources(specifiers, catalog, targets, includeCatalogDependencies = false) {
458
+ const names = [...new Set(specifiers.map((specifier) => splitPackageSpecifier(specifier).name))];
459
+ if (includeCatalogDependencies) {
460
+ for (let index = 0; index < names.length; index += 1) for (const dependency of catalog.packages.get(names[index])?.dependencies ?? []) if (!names.includes(dependency)) names.push(dependency);
461
+ }
462
+ return names.map((name) => {
463
+ const target = targets.get(name);
464
+ return `${NPM_SOURCE_PREFIX}${name}${target ? `@${target}` : ""}`;
465
+ });
466
+ }
467
+ function pluralize(count, noun) {
468
+ return `${count} ${noun}${count === 1 ? "" : "s"}`;
469
+ }
470
+ /** Version of a package inside the shared runtime, absent when Po did not install it there. */
471
+ function managedPackageVersion(runtimeDirectory, name) {
472
+ const manifestPath = path.join(runtimeDirectory, NODE_MODULES, name, PACKAGE_MANIFEST);
473
+ if (!fs.existsSync(manifestPath)) return void 0;
474
+ try {
475
+ const parsed = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
476
+ return isRecord$1(parsed) && typeof parsed.version === "string" ? parsed.version : void 0;
477
+ } catch {
478
+ return;
479
+ }
480
+ }
481
+ function errorCode(error) {
482
+ return typeof error === "object" && error !== null ? error.code : void 0;
483
+ }
484
+ /**
485
+ * Installs the runtime, and when the registry cannot be reached installs it again offline:
486
+ * an unchanged lockfile whose packages the store already holds needs no network.
487
+ */
488
+ async function installWithOfflineRetry(install, options, onProgress) {
489
+ try {
490
+ await install(options);
491
+ } catch (error) {
492
+ const code = errorCode(error);
493
+ if (typeof code !== "string" || !NETWORK_FAILURE_CODES.has(code)) throw error;
494
+ onProgress?.(`the registry is unreachable (${code}); installing offline from the store`);
495
+ try {
496
+ await install({
497
+ ...options,
498
+ preferOffline: false,
499
+ offline: true
500
+ });
501
+ } catch {
502
+ throw error;
503
+ }
504
+ }
505
+ }
506
+ /**
507
+ * Compares every package sync installed against the registry.
508
+ *
509
+ * Only the shared runtime is consulted: a package that resolves from the
510
+ * repository's own modules is not sync's to move, and a package that is not
511
+ * installed yet is already covered by the missing-package path.
512
+ */
513
+ async function resolveUpdates(runtimeDirectory, sources, publishedVersion, onProgress) {
514
+ const managed = sources.map((source) => ({
515
+ name: packageName(source),
516
+ from: managedPackageVersion(runtimeDirectory, packageName(source))
517
+ })).filter((entry) => entry.from !== void 0);
518
+ const checked = await Promise.all(managed.map(async (entry) => {
519
+ try {
520
+ return {
521
+ ...entry,
522
+ to: await publishedVersion(entry.name)
523
+ };
524
+ } catch (error) {
525
+ return {
526
+ ...entry,
527
+ failure: (error instanceof Error ? error.message : String(error)).split("\n")[0]
528
+ };
529
+ }
530
+ }));
531
+ const updated = [];
532
+ const unchecked = [];
533
+ for (const entry of checked) {
534
+ if (entry.to === void 0) {
535
+ unchecked.push(entry.name);
536
+ onProgress?.(`kept ${entry.name} ${entry.from}: ${entry.failure ?? "no published version"}`);
537
+ continue;
538
+ }
539
+ if (entry.to === entry.from) continue;
540
+ updated.push({
541
+ name: entry.name,
542
+ from: entry.from,
543
+ to: entry.to
544
+ });
545
+ onProgress?.(`${entry.name} ${entry.from} -> ${entry.to}`);
546
+ }
547
+ return {
548
+ updated,
549
+ unchecked
550
+ };
551
+ }
552
+ /**
553
+ * Installs the selected layer packages a root cannot resolve into the shared runtime,
554
+ * `<po home>/runtime`, and verifies they now resolve.
555
+ *
556
+ * The runtime manifest is the union of what every root asked for. A root adds the
557
+ * packages it is missing; a package it already resolves from its own node_modules stays
558
+ * out unless an earlier run put it there. One name has one version: an exact target
559
+ * (a sync update, a catalog archive or registry pin) replaces the declared range, last
560
+ * writer wins, and a plain `*` never replaces a range already declared.
561
+ *
562
+ * `specifiers` and `exactManifest` only add behaviour: without them, and without a
563
+ * catalogue, a run behaves as it always has.
564
+ */
565
+ async function ensureLayerPackages(options, dependencies = {}) {
566
+ const environment = options.environment ?? process.env;
567
+ const homeDirectory = environment.HOME ?? os.homedir();
568
+ const poHome = poHomeDirectory(homeDirectory, environment);
569
+ const runtimeDirectory = poRuntimeDirectory(homeDirectory, environment);
570
+ const resolvers = dependencies.resolvers ?? createLayerResolvers(options.repoRoot, environment);
571
+ const configured = configuredPackageSpecifiers(options.config, options.layers);
572
+ const missing = configured.filter((specifier) => resolvePackageEntries(resolvers, specifier) === void 0);
573
+ const declared = declaredRuntimePackages(runtimeDirectory);
574
+ const managed = configured.filter((specifier) => missing.includes(specifier) || declared.has(splitPackageSpecifier(specifier).name));
575
+ const requested = (options.specifiers ?? []).map(splitVersionedSpecifier);
576
+ if (managed.length === 0 && requested.length === 0 && options.exactManifest !== true) return {
577
+ installed: [],
578
+ updated: [],
579
+ unchecked: []
580
+ };
581
+ const catalog = readPackageCatalog(packageCatalogPath(environment));
582
+ const pins = catalogTargets(catalog);
583
+ for (const { name, version } of requested) if (version !== void 0 && catalog.packages.get(name)?.archive === void 0) pins.set(name, version);
584
+ const requestedMissing = requested.filter(({ name, version }) => {
585
+ const installed = managedPackageVersion(runtimeDirectory, name);
586
+ const entry = catalog.packages.get(name);
587
+ const expected = entry?.archive === void 0 ? version : entry.version;
588
+ return installed === void 0 || expected !== void 0 && installed !== expected;
589
+ }).map(({ name }) => name);
590
+ const missingSources = npmSources([...missing, ...requestedMissing], catalog, pins);
591
+ const sources = npmSources([...managed, ...requested.map(({ name }) => name)], catalog, pins, true);
592
+ const missingCount = missing.length + requestedMissing.length;
593
+ const fixedNames = /* @__PURE__ */ new Set([...catalog.packages.keys(), ...requested.filter(({ version }) => version !== void 0).map(({ name }) => name)]);
594
+ const registrySources = sources.filter((source) => !fixedNames.has(packageName(source)));
595
+ const { updated, unchecked } = options.refresh ? await resolveUpdates(runtimeDirectory, registrySources, dependencies.publishedVersion ?? ((name) => resolveNewest(name, {
596
+ dir: runtimeDirectory,
597
+ poHome
598
+ })), options.onProgress) : {
599
+ updated: [],
600
+ unchecked: []
601
+ };
602
+ const targets = new Map(sources.flatMap((source) => {
603
+ const target = pins.get(packageName(source));
604
+ return target ? [[packageName(source), target]] : [];
605
+ }));
606
+ for (const update of updated) targets.set(update.name, update.to);
607
+ const manifestChanged = ensureManagedPackageManifest(runtimeDirectory, sources, targets, stageCatalogArchives(runtimeDirectory, catalog, /* @__PURE__ */ new Set([...sources.map(packageName), ...options.exactManifest === true ? [] : declared])), options.exactManifest === true);
608
+ if (missingCount === 0 && !manifestChanged) return {
609
+ installed: [],
610
+ updated: [],
611
+ unchecked
612
+ };
613
+ options.onProgress?.(`installing ${updated.length > 0 ? pluralize(updated.length, "update") : missingCount > 0 ? pluralize(missingCount, "missing package") : "the package manifest"}`);
614
+ try {
615
+ await installWithOfflineRetry(dependencies.install ?? installRuntimePackages, {
616
+ dir: runtimeDirectory,
617
+ poHome,
618
+ preferOffline: options.refresh !== true,
619
+ log: (message, level) => {
620
+ if (level === "warn") options.onProgress?.(message);
621
+ }
622
+ }, options.onProgress);
623
+ } catch (error) {
624
+ throw new Error(`Failed to reconcile Po layer package(s): ${(manifestChanged ? sources : missingSources).join(", ")}`, { cause: error });
625
+ }
626
+ const unresolved = missing.filter((specifier) => !resolvePackageEntries(resolvers, specifier)?.length);
627
+ if (unresolved.length > 0) throw new Error(`Installed Po layer package(s) did not expose the configured Pi extension: ${unresolved.join(", ")}`);
628
+ return {
629
+ installed: missingSources,
630
+ updated,
631
+ unchecked
632
+ };
633
+ }
634
+ //#endregion
635
+ export { SAFE_TRANSITIVE_OVERRIDES, catalogInstallSpecifiers, catalogPackageRoots, ensureLayerPackages, ensureManagedPackageManifest, missingLayerPackageSpecifiers, packageCatalogHash, pruneStagedCatalogArchives, runtimeLayerPackageSpecifiers };
636
+
637
+ //# sourceMappingURL=index.mjs.map