@agimon-ai/po 0.0.0-alpha.21 → 0.0.0-alpha.210

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 (621) hide show
  1. package/LICENSE +97 -8
  2. package/README.md +37 -722
  3. package/dist/apiContracts.cjs.map +1 -1
  4. package/dist/apiContracts.d.mts +2 -2
  5. package/dist/bin/cli.cjs +12 -7
  6. package/dist/bin/cli.cjs.map +1 -1
  7. package/dist/bin/cli.mjs +12 -7
  8. package/dist/bin/cli.mjs.map +1 -1
  9. package/dist/bin/poRunner.cjs +24 -7
  10. package/dist/bin/poRunner.cjs.map +1 -1
  11. package/dist/bin/poRunner.d.mts +8 -0
  12. package/dist/bin/poRunner.d.mts.map +1 -1
  13. package/dist/bin/poRunner.mjs +24 -7
  14. package/dist/bin/poRunner.mjs.map +1 -1
  15. package/dist/bin/serve.cjs +28 -17
  16. package/dist/bin/serve.cjs.map +1 -1
  17. package/dist/bin/serve.mjs +28 -17
  18. package/dist/bin/serve.mjs.map +1 -1
  19. package/dist/builders/cli/extensionAssembler/index.cjs +53 -40
  20. package/dist/builders/cli/extensionAssembler/index.cjs.map +1 -1
  21. package/dist/builders/cli/extensionAssembler/index.d.mts +11 -6
  22. package/dist/builders/cli/extensionAssembler/index.d.mts.map +1 -1
  23. package/dist/builders/cli/extensionAssembler/index.mjs +53 -41
  24. package/dist/builders/cli/extensionAssembler/index.mjs.map +1 -1
  25. package/dist/catalog/index.json +662 -105
  26. package/dist/cli.cjs +9 -14
  27. package/dist/cli.d.mts +1 -3
  28. package/dist/cli.mjs +1 -3
  29. package/dist/commands.cjs +13 -15
  30. package/dist/commands.d.mts +1 -2
  31. package/dist/commands.mjs +1 -2
  32. package/dist/config.cjs +9 -14
  33. package/dist/config.d.mts +3 -2
  34. package/dist/config.mjs +3 -2
  35. package/dist/extensions/server.cjs +30 -23
  36. package/dist/extensions/server.cjs.map +1 -1
  37. package/dist/extensions/server.d.mts.map +1 -1
  38. package/dist/extensions/server.mjs +31 -24
  39. package/dist/extensions/server.mjs.map +1 -1
  40. package/dist/harnessContext.cjs +0 -1
  41. package/dist/harnessContext.d.mts +2 -2
  42. package/dist/harnessContext.mjs +1 -1
  43. package/dist/harnessState.cjs +2 -1
  44. package/dist/help.cjs +9 -11
  45. package/dist/help.d.mts +1 -2
  46. package/dist/help.mjs +1 -2
  47. package/dist/index.cjs +40 -67
  48. package/dist/index.d.mts +7 -16
  49. package/dist/index.mjs +7 -14
  50. package/dist/matrixOptions.cjs +10 -5
  51. package/dist/matrixOptions.d.mts +2 -2
  52. package/dist/matrixOptions.mjs +1 -1
  53. package/dist/package.cjs +11 -0
  54. package/dist/package.cjs.map +1 -0
  55. package/dist/package.mjs +6 -0
  56. package/dist/package.mjs.map +1 -0
  57. package/dist/projectTrust.cjs +3 -0
  58. package/dist/projectTrust.d.mts +2 -2
  59. package/dist/projectTrust.mjs +1 -1
  60. package/dist/repository.cjs +1 -0
  61. package/dist/repository.d.mts +2 -2
  62. package/dist/repository.mjs +1 -1
  63. package/dist/services.cjs +5 -20
  64. package/dist/services.d.mts +3 -8
  65. package/dist/services.mjs +3 -8
  66. package/dist/shared.cjs +4 -17
  67. package/dist/shared.d.mts +2 -2
  68. package/dist/shared.mjs +1 -1
  69. package/dist/src/bin/agentDirectory.cjs +19 -15
  70. package/dist/src/bin/agentDirectory.cjs.map +1 -1
  71. package/dist/src/bin/agentDirectory.mjs +16 -13
  72. package/dist/src/bin/agentDirectory.mjs.map +1 -1
  73. package/dist/src/builders/apiContractExport/index.cjs +23 -22
  74. package/dist/src/builders/apiContractExport/index.cjs.map +1 -1
  75. package/dist/src/builders/apiContractExport/index.mjs +22 -21
  76. package/dist/src/builders/apiContractExport/index.mjs.map +1 -1
  77. package/dist/src/builders/cli/entryResolution.cjs +2 -2
  78. package/dist/src/builders/cli/entryResolution.cjs.map +1 -1
  79. package/dist/src/builders/cli/entryResolution.mjs +1 -1
  80. package/dist/src/builders/cli/entryResolution.mjs.map +1 -1
  81. package/dist/src/builders/cli/harnessContext.cjs +38 -43
  82. package/dist/src/builders/cli/harnessContext.cjs.map +1 -1
  83. package/dist/src/builders/cli/harnessContext.d.mts +11 -10
  84. package/dist/src/builders/cli/harnessContext.d.mts.map +1 -1
  85. package/dist/src/builders/cli/harnessContext.mjs +37 -41
  86. package/dist/src/builders/cli/harnessContext.mjs.map +1 -1
  87. package/dist/src/builders/cli/sessionComposition.cjs +23 -12
  88. package/dist/src/builders/cli/sessionComposition.cjs.map +1 -1
  89. package/dist/src/builders/cli/sessionComposition.mjs +23 -12
  90. package/dist/src/builders/cli/sessionComposition.mjs.map +1 -1
  91. package/dist/src/builders/isolate/compile.cjs +226 -0
  92. package/dist/src/builders/isolate/compile.cjs.map +1 -0
  93. package/dist/src/builders/isolate/compile.mjs +222 -0
  94. package/dist/src/builders/isolate/compile.mjs.map +1 -0
  95. package/dist/src/builders/isolate/index.cjs +195 -0
  96. package/dist/src/builders/isolate/index.cjs.map +1 -0
  97. package/dist/src/builders/isolate/index.mjs +192 -0
  98. package/dist/src/builders/isolate/index.mjs.map +1 -0
  99. package/dist/src/builders/isolate/membrane.cjs +198 -0
  100. package/dist/src/builders/isolate/membrane.cjs.map +1 -0
  101. package/dist/src/builders/isolate/membrane.mjs +198 -0
  102. package/dist/src/builders/isolate/membrane.mjs.map +1 -0
  103. package/dist/src/builders/isolate/names.cjs +10 -0
  104. package/dist/src/builders/isolate/names.cjs.map +1 -0
  105. package/dist/src/builders/isolate/names.mjs +9 -0
  106. package/dist/src/builders/isolate/names.mjs.map +1 -0
  107. package/dist/src/builders/native/index.cjs +229 -67
  108. package/dist/src/builders/native/index.cjs.map +1 -1
  109. package/dist/src/builders/native/index.d.mts +4 -2
  110. package/dist/src/builders/native/index.d.mts.map +1 -1
  111. package/dist/src/builders/native/index.mjs +229 -68
  112. package/dist/src/builders/native/index.mjs.map +1 -1
  113. package/dist/src/builders/npm/index.cjs +76 -0
  114. package/dist/src/builders/npm/index.cjs.map +1 -0
  115. package/dist/src/builders/npm/index.mjs +73 -0
  116. package/dist/src/builders/npm/index.mjs.map +1 -0
  117. package/dist/src/builders/server/backgroundSync.cjs +62 -39
  118. package/dist/src/builders/server/backgroundSync.cjs.map +1 -1
  119. package/dist/src/builders/server/backgroundSync.mjs +62 -38
  120. package/dist/src/builders/server/backgroundSync.mjs.map +1 -1
  121. package/dist/src/builders/server/bundlerService.cjs +165 -35
  122. package/dist/src/builders/server/bundlerService.cjs.map +1 -1
  123. package/dist/src/builders/server/bundlerService.mjs +164 -36
  124. package/dist/src/builders/server/bundlerService.mjs.map +1 -1
  125. package/dist/src/builders/server/capabilities.cjs +103 -0
  126. package/dist/src/builders/server/capabilities.cjs.map +1 -0
  127. package/dist/src/builders/server/capabilities.mjs +101 -0
  128. package/dist/src/builders/server/capabilities.mjs.map +1 -0
  129. package/dist/src/builders/server/computerUseBinding.cjs +62 -10
  130. package/dist/src/builders/server/computerUseBinding.cjs.map +1 -1
  131. package/dist/src/builders/server/computerUseBinding.mjs +60 -8
  132. package/dist/src/builders/server/computerUseBinding.mjs.map +1 -1
  133. package/dist/src/builders/server/computerUseRecordings.cjs +152 -51
  134. package/dist/src/builders/server/computerUseRecordings.cjs.map +1 -1
  135. package/dist/src/builders/server/computerUseRecordings.mjs +158 -59
  136. package/dist/src/builders/server/computerUseRecordings.mjs.map +1 -1
  137. package/dist/src/builders/server/containedSessions.cjs +152 -0
  138. package/dist/src/builders/server/containedSessions.cjs.map +1 -0
  139. package/dist/src/builders/server/containedSessions.mjs +146 -0
  140. package/dist/src/builders/server/containedSessions.mjs.map +1 -0
  141. package/dist/src/builders/server/defaultWorkspace.cjs +46 -11
  142. package/dist/src/builders/server/defaultWorkspace.cjs.map +1 -1
  143. package/dist/src/builders/server/defaultWorkspace.mjs +42 -10
  144. package/dist/src/builders/server/defaultWorkspace.mjs.map +1 -1
  145. package/dist/src/builders/server/electronBinding.cjs +82 -0
  146. package/dist/src/builders/server/electronBinding.cjs.map +1 -0
  147. package/dist/src/builders/server/electronBinding.mjs +82 -0
  148. package/dist/src/builders/server/electronBinding.mjs.map +1 -0
  149. package/dist/src/builders/server/federation.cjs +364 -0
  150. package/dist/src/builders/server/federation.cjs.map +1 -0
  151. package/dist/src/builders/server/federation.mjs +363 -0
  152. package/dist/src/builders/server/federation.mjs.map +1 -0
  153. package/dist/src/builders/server/hostDisplayName.cjs +14 -0
  154. package/dist/src/builders/server/hostDisplayName.cjs.map +1 -0
  155. package/dist/src/builders/server/hostDisplayName.mjs +14 -0
  156. package/dist/src/builders/server/hostDisplayName.mjs.map +1 -0
  157. package/dist/src/builders/server/hostModelGateway.cjs +41 -0
  158. package/dist/src/builders/server/hostModelGateway.cjs.map +1 -0
  159. package/dist/src/builders/server/hostModelGateway.mjs +39 -0
  160. package/dist/src/builders/server/hostModelGateway.mjs.map +1 -0
  161. package/dist/src/builders/server/hostTeam.cjs +188 -0
  162. package/dist/src/builders/server/hostTeam.cjs.map +1 -0
  163. package/dist/src/builders/server/hostTeam.mjs +180 -0
  164. package/dist/src/builders/server/hostTeam.mjs.map +1 -0
  165. package/dist/src/builders/server/idleRestart.cjs +185 -40
  166. package/dist/src/builders/server/idleRestart.cjs.map +1 -1
  167. package/dist/src/builders/server/idleRestart.mjs +176 -39
  168. package/dist/src/builders/server/idleRestart.mjs.map +1 -1
  169. package/dist/src/builders/server/index.cjs +33 -19
  170. package/dist/src/builders/server/index.cjs.map +1 -1
  171. package/dist/src/builders/server/index.mjs +33 -18
  172. package/dist/src/builders/server/index.mjs.map +1 -1
  173. package/dist/src/builders/server/liveActivityPush.cjs +202 -0
  174. package/dist/src/builders/server/liveActivityPush.cjs.map +1 -0
  175. package/dist/src/builders/server/liveActivityPush.mjs +202 -0
  176. package/dist/src/builders/server/liveActivityPush.mjs.map +1 -0
  177. package/dist/src/builders/server/logSink.cjs +12 -10
  178. package/dist/src/builders/server/logSink.cjs.map +1 -1
  179. package/dist/src/builders/server/logSink.mjs +12 -10
  180. package/dist/src/builders/server/logSink.mjs.map +1 -1
  181. package/dist/src/builders/server/mcpApp.cjs +27 -20
  182. package/dist/src/builders/server/mcpApp.cjs.map +1 -1
  183. package/dist/src/builders/server/mcpApp.mjs +25 -18
  184. package/dist/src/builders/server/mcpApp.mjs.map +1 -1
  185. package/dist/src/builders/server/mcpAppBuild.cjs +61 -41
  186. package/dist/src/builders/server/mcpAppBuild.cjs.map +1 -1
  187. package/dist/src/builders/server/mcpAppBuild.d.mts +3 -6
  188. package/dist/src/builders/server/mcpAppBuild.d.mts.map +1 -1
  189. package/dist/src/builders/server/mcpAppBuild.mjs +61 -40
  190. package/dist/src/builders/server/mcpAppBuild.mjs.map +1 -1
  191. package/dist/src/builders/server/mcpBundle.cjs +20 -16
  192. package/dist/src/builders/server/mcpBundle.cjs.map +1 -1
  193. package/dist/src/builders/server/mcpBundle.d.mts +2 -1
  194. package/dist/src/builders/server/mcpBundle.d.mts.map +1 -1
  195. package/dist/src/builders/server/mcpBundle.mjs +20 -15
  196. package/dist/src/builders/server/mcpBundle.mjs.map +1 -1
  197. package/dist/src/builders/server/nativePush.cjs +229 -0
  198. package/dist/src/builders/server/nativePush.cjs.map +1 -0
  199. package/dist/src/builders/server/nativePush.mjs +228 -0
  200. package/dist/src/builders/server/nativePush.mjs.map +1 -0
  201. package/dist/src/builders/server/network.cjs +887 -0
  202. package/dist/src/builders/server/network.cjs.map +1 -0
  203. package/dist/src/builders/server/network.mjs +886 -0
  204. package/dist/src/builders/server/network.mjs.map +1 -0
  205. package/dist/src/builders/server/networkGateway.cjs +123 -0
  206. package/dist/src/builders/server/networkGateway.cjs.map +1 -0
  207. package/dist/src/builders/server/networkGateway.mjs +123 -0
  208. package/dist/src/builders/server/networkGateway.mjs.map +1 -0
  209. package/dist/src/builders/server/networkRelay.cjs +83 -0
  210. package/dist/src/builders/server/networkRelay.cjs.map +1 -0
  211. package/dist/src/builders/server/networkRelay.mjs +81 -0
  212. package/dist/src/builders/server/networkRelay.mjs.map +1 -0
  213. package/dist/src/builders/server/orgPluginLibraryBinding.cjs +72 -0
  214. package/dist/src/builders/server/orgPluginLibraryBinding.cjs.map +1 -0
  215. package/dist/src/builders/server/orgPluginLibraryBinding.mjs +72 -0
  216. package/dist/src/builders/server/orgPluginLibraryBinding.mjs.map +1 -0
  217. package/dist/src/builders/server/packageReloadCheck.cjs +46 -2
  218. package/dist/src/builders/server/packageReloadCheck.cjs.map +1 -1
  219. package/dist/src/builders/server/packageReloadCheck.mjs +46 -3
  220. package/dist/src/builders/server/packageReloadCheck.mjs.map +1 -1
  221. package/dist/src/builders/server/packageUrl.cjs +161 -58
  222. package/dist/src/builders/server/packageUrl.cjs.map +1 -1
  223. package/dist/src/builders/server/packageUrl.mjs +162 -58
  224. package/dist/src/builders/server/packageUrl.mjs.map +1 -1
  225. package/dist/src/builders/server/privateRelay.cjs +309 -0
  226. package/dist/src/builders/server/privateRelay.cjs.map +1 -0
  227. package/dist/src/builders/server/privateRelay.mjs +305 -0
  228. package/dist/src/builders/server/privateRelay.mjs.map +1 -0
  229. package/dist/src/builders/server/privateRelayCarrier.cjs +316 -0
  230. package/dist/src/builders/server/privateRelayCarrier.cjs.map +1 -0
  231. package/dist/src/builders/server/privateRelayCarrier.mjs +309 -0
  232. package/dist/src/builders/server/privateRelayCarrier.mjs.map +1 -0
  233. package/dist/src/builders/server/runtime.cjs +2731 -485
  234. package/dist/src/builders/server/runtime.cjs.map +1 -1
  235. package/dist/src/builders/server/runtime.mjs +2741 -499
  236. package/dist/src/builders/server/runtime.mjs.map +1 -1
  237. package/dist/src/builders/server/runtimeResources.cjs +37 -0
  238. package/dist/src/builders/server/runtimeResources.cjs.map +1 -1
  239. package/dist/src/builders/server/runtimeResources.mjs +38 -2
  240. package/dist/src/builders/server/runtimeResources.mjs.map +1 -1
  241. package/dist/src/builders/server/sandboxRouter.cjs +815 -0
  242. package/dist/src/builders/server/sandboxRouter.cjs.map +1 -0
  243. package/dist/src/builders/server/sandboxRouter.mjs +811 -0
  244. package/dist/src/builders/server/sandboxRouter.mjs.map +1 -0
  245. package/dist/src/builders/server/sandboxSessionHandoff.cjs +298 -0
  246. package/dist/src/builders/server/sandboxSessionHandoff.cjs.map +1 -0
  247. package/dist/src/builders/server/sandboxSessionHandoff.mjs +287 -0
  248. package/dist/src/builders/server/sandboxSessionHandoff.mjs.map +1 -0
  249. package/dist/src/builders/server/scopeReloadController.cjs +80 -0
  250. package/dist/src/builders/server/scopeReloadController.cjs.map +1 -0
  251. package/dist/src/builders/server/scopeReloadController.mjs +80 -0
  252. package/dist/src/builders/server/scopeReloadController.mjs.map +1 -0
  253. package/dist/src/builders/server/selectionStatus.cjs +2 -2
  254. package/dist/src/builders/server/selectionStatus.cjs.map +1 -1
  255. package/dist/src/builders/server/selectionStatus.mjs +2 -2
  256. package/dist/src/builders/server/selectionStatus.mjs.map +1 -1
  257. package/dist/src/builders/server/sessionArguments.cjs +65 -7
  258. package/dist/src/builders/server/sessionArguments.cjs.map +1 -1
  259. package/dist/src/builders/server/sessionArguments.mjs +64 -8
  260. package/dist/src/builders/server/sessionArguments.mjs.map +1 -1
  261. package/dist/src/builders/server/sessionRemoval.cjs +233 -0
  262. package/dist/src/builders/server/sessionRemoval.cjs.map +1 -0
  263. package/dist/src/builders/server/sessionRemoval.mjs +224 -0
  264. package/dist/src/builders/server/sessionRemoval.mjs.map +1 -0
  265. package/dist/src/builders/server/sessionSummaries.cjs +32 -0
  266. package/dist/src/builders/server/sessionSummaries.cjs.map +1 -0
  267. package/dist/src/builders/server/sessionSummaries.mjs +31 -0
  268. package/dist/src/builders/server/sessionSummaries.mjs.map +1 -0
  269. package/dist/src/builders/server/shutdown.cjs +23 -0
  270. package/dist/src/builders/server/shutdown.cjs.map +1 -1
  271. package/dist/src/builders/server/shutdown.mjs +21 -1
  272. package/dist/src/builders/server/shutdown.mjs.map +1 -1
  273. package/dist/src/builders/server/shutdownStack.cjs +44 -0
  274. package/dist/src/builders/server/shutdownStack.cjs.map +1 -0
  275. package/dist/src/builders/server/shutdownStack.mjs +43 -0
  276. package/dist/src/builders/server/shutdownStack.mjs.map +1 -0
  277. package/dist/src/builders/server/toolBoundaryHold.cjs +55 -0
  278. package/dist/src/builders/server/toolBoundaryHold.cjs.map +1 -0
  279. package/dist/src/builders/server/toolBoundaryHold.mjs +55 -0
  280. package/dist/src/builders/server/toolBoundaryHold.mjs.map +1 -0
  281. package/dist/src/builders/server/watcherService.cjs +55 -28
  282. package/dist/src/builders/server/watcherService.cjs.map +1 -1
  283. package/dist/src/builders/server/watcherService.mjs +55 -27
  284. package/dist/src/builders/server/watcherService.mjs.map +1 -1
  285. package/dist/src/builders/server/webTemplateDecision.cjs +7 -3
  286. package/dist/src/builders/server/webTemplateDecision.cjs.map +1 -1
  287. package/dist/src/builders/server/webTemplateDecision.mjs +7 -3
  288. package/dist/src/builders/server/webTemplateDecision.mjs.map +1 -1
  289. package/dist/src/builders/server/workspaceAdmission.cjs +96 -0
  290. package/dist/src/builders/server/workspaceAdmission.cjs.map +1 -0
  291. package/dist/src/builders/server/workspaceAdmission.mjs +90 -0
  292. package/dist/src/builders/server/workspaceAdmission.mjs.map +1 -0
  293. package/dist/src/builders/server/workspaceCheckout.cjs +16 -7
  294. package/dist/src/builders/server/workspaceCheckout.cjs.map +1 -1
  295. package/dist/src/builders/server/workspaceCheckout.mjs +16 -7
  296. package/dist/src/builders/server/workspaceCheckout.mjs.map +1 -1
  297. package/dist/src/builders/web/bundle.cjs +16 -14
  298. package/dist/src/builders/web/bundle.cjs.map +1 -1
  299. package/dist/src/builders/web/bundle.d.mts +3 -0
  300. package/dist/src/builders/web/bundle.d.mts.map +1 -1
  301. package/dist/src/builders/web/bundle.mjs +15 -13
  302. package/dist/src/builders/web/bundle.mjs.map +1 -1
  303. package/dist/src/builders/web/index.cjs +77 -59
  304. package/dist/src/builders/web/index.cjs.map +1 -1
  305. package/dist/src/builders/web/index.d.mts +19 -14
  306. package/dist/src/builders/web/index.d.mts.map +1 -1
  307. package/dist/src/builders/web/index.mjs +76 -58
  308. package/dist/src/builders/web/index.mjs.map +1 -1
  309. package/dist/src/builders/web/webPluginGenerate.cjs +84 -45
  310. package/dist/src/builders/web/webPluginGenerate.cjs.map +1 -1
  311. package/dist/src/builders/web/webPluginGenerate.d.mts +13 -4
  312. package/dist/src/builders/web/webPluginGenerate.d.mts.map +1 -1
  313. package/dist/src/builders/web/webPluginGenerate.mjs +82 -44
  314. package/dist/src/builders/web/webPluginGenerate.mjs.map +1 -1
  315. package/dist/src/builders/web/webPluginManifest.cjs +24 -17
  316. package/dist/src/builders/web/webPluginManifest.cjs.map +1 -1
  317. package/dist/src/builders/web/webPluginManifest.d.mts +11 -23
  318. package/dist/src/builders/web/webPluginManifest.d.mts.map +1 -1
  319. package/dist/src/builders/web/webPluginManifest.mjs +23 -16
  320. package/dist/src/builders/web/webPluginManifest.mjs.map +1 -1
  321. package/dist/src/builders/web/webPluginScan.cjs +11 -8
  322. package/dist/src/builders/web/webPluginScan.cjs.map +1 -1
  323. package/dist/src/builders/web/webPluginScan.d.mts +1 -1
  324. package/dist/src/builders/web/webPluginScan.d.mts.map +1 -1
  325. package/dist/src/builders/web/webPluginScan.mjs +10 -7
  326. package/dist/src/builders/web/webPluginScan.mjs.map +1 -1
  327. package/dist/src/builders/web/webPluginVite.cjs +5 -5
  328. package/dist/src/builders/web/webPluginVite.cjs.map +1 -1
  329. package/dist/src/builders/web/webPluginVite.d.mts +1 -1
  330. package/dist/src/builders/web/webPluginVite.d.mts.map +1 -1
  331. package/dist/src/builders/web/webPluginVite.mjs +3 -3
  332. package/dist/src/builders/web/webPluginVite.mjs.map +1 -1
  333. package/dist/src/cli/cliApp.cjs +18 -19
  334. package/dist/src/cli/cliApp.cjs.map +1 -1
  335. package/dist/src/cli/cliApp.d.mts +1 -1
  336. package/dist/src/cli/cliApp.d.mts.map +1 -1
  337. package/dist/src/cli/cliApp.mjs +18 -19
  338. package/dist/src/cli/cliApp.mjs.map +1 -1
  339. package/dist/src/cli/commands/api-export/index.cjs +14 -13
  340. package/dist/src/cli/commands/api-export/index.cjs.map +1 -1
  341. package/dist/src/cli/commands/api-export/index.mjs +13 -12
  342. package/dist/src/cli/commands/api-export/index.mjs.map +1 -1
  343. package/dist/src/cli/commands/doctor/help.cjs +4 -3
  344. package/dist/src/cli/commands/doctor/help.cjs.map +1 -1
  345. package/dist/src/cli/commands/doctor/help.d.mts.map +1 -1
  346. package/dist/src/cli/commands/doctor/help.mjs +4 -3
  347. package/dist/src/cli/commands/doctor/help.mjs.map +1 -1
  348. package/dist/src/cli/commands/doctor/index.cjs +30 -17
  349. package/dist/src/cli/commands/doctor/index.cjs.map +1 -1
  350. package/dist/src/cli/commands/doctor/index.d.mts +4 -4
  351. package/dist/src/cli/commands/doctor/index.d.mts.map +1 -1
  352. package/dist/src/cli/commands/doctor/index.mjs +28 -15
  353. package/dist/src/cli/commands/doctor/index.mjs.map +1 -1
  354. package/dist/src/cli/commands/emit-mcp/index.cjs +3 -2
  355. package/dist/src/cli/commands/emit-mcp/index.cjs.map +1 -1
  356. package/dist/src/cli/commands/emit-mcp/index.d.mts.map +1 -1
  357. package/dist/src/cli/commands/emit-mcp/index.mjs +3 -2
  358. package/dist/src/cli/commands/emit-mcp/index.mjs.map +1 -1
  359. package/dist/src/cli/commands/explain/index.cjs +53 -38
  360. package/dist/src/cli/commands/explain/index.cjs.map +1 -1
  361. package/dist/src/cli/commands/explain/index.d.mts +3 -4
  362. package/dist/src/cli/commands/explain/index.d.mts.map +1 -1
  363. package/dist/src/cli/commands/explain/index.mjs +52 -37
  364. package/dist/src/cli/commands/explain/index.mjs.map +1 -1
  365. package/dist/src/cli/commands/init/help.cjs +3 -2
  366. package/dist/src/cli/commands/init/help.cjs.map +1 -1
  367. package/dist/src/cli/commands/init/help.d.mts.map +1 -1
  368. package/dist/src/cli/commands/init/help.mjs +3 -2
  369. package/dist/src/cli/commands/init/help.mjs.map +1 -1
  370. package/dist/src/cli/commands/init/index.cjs +17 -12
  371. package/dist/src/cli/commands/init/index.cjs.map +1 -1
  372. package/dist/src/cli/commands/init/index.d.mts.map +1 -1
  373. package/dist/src/cli/commands/init/index.mjs +16 -11
  374. package/dist/src/cli/commands/init/index.mjs.map +1 -1
  375. package/dist/src/cli/commands/init/presenter.cjs +29 -21
  376. package/dist/src/cli/commands/init/presenter.cjs.map +1 -1
  377. package/dist/src/cli/commands/init/presenter.mjs +29 -21
  378. package/dist/src/cli/commands/init/presenter.mjs.map +1 -1
  379. package/dist/src/cli/commands/sync/help.cjs +7 -3
  380. package/dist/src/cli/commands/sync/help.cjs.map +1 -1
  381. package/dist/src/cli/commands/sync/help.d.mts.map +1 -1
  382. package/dist/src/cli/commands/sync/help.mjs +7 -3
  383. package/dist/src/cli/commands/sync/help.mjs.map +1 -1
  384. package/dist/src/cli/commands/sync/index.cjs +72 -40
  385. package/dist/src/cli/commands/sync/index.cjs.map +1 -1
  386. package/dist/src/cli/commands/sync/index.d.mts.map +1 -1
  387. package/dist/src/cli/commands/sync/index.mjs +69 -37
  388. package/dist/src/cli/commands/sync/index.mjs.map +1 -1
  389. package/dist/src/cli/commands/sync/presenter.cjs +10 -1
  390. package/dist/src/cli/commands/sync/presenter.cjs.map +1 -1
  391. package/dist/src/cli/commands/sync/presenter.d.mts +0 -9
  392. package/dist/src/cli/commands/sync/presenter.d.mts.map +1 -1
  393. package/dist/src/cli/commands/sync/presenter.mjs +10 -1
  394. package/dist/src/cli/commands/sync/presenter.mjs.map +1 -1
  395. package/dist/src/cli/commands/web/index.cjs +7 -6
  396. package/dist/src/cli/commands/web/index.cjs.map +1 -1
  397. package/dist/src/cli/commands/web/index.mjs +6 -5
  398. package/dist/src/cli/commands/web/index.mjs.map +1 -1
  399. package/dist/src/cli/harnessOptions.cjs +15 -24
  400. package/dist/src/cli/harnessOptions.cjs.map +1 -1
  401. package/dist/src/cli/harnessOptions.d.mts +2 -2
  402. package/dist/src/cli/harnessOptions.d.mts.map +1 -1
  403. package/dist/src/cli/harnessOptions.mjs +14 -22
  404. package/dist/src/cli/harnessOptions.mjs.map +1 -1
  405. package/dist/src/cli/help.cjs +20 -26
  406. package/dist/src/cli/help.cjs.map +1 -1
  407. package/dist/src/cli/help.d.mts +1 -2
  408. package/dist/src/cli/help.d.mts.map +1 -1
  409. package/dist/src/cli/help.mjs +15 -20
  410. package/dist/src/cli/help.mjs.map +1 -1
  411. package/dist/src/cli/locale.cjs +25 -0
  412. package/dist/src/cli/locale.cjs.map +1 -0
  413. package/dist/src/cli/locale.mjs +22 -0
  414. package/dist/src/cli/locale.mjs.map +1 -0
  415. package/dist/src/cli/matrixOptions.cjs +85 -37
  416. package/dist/src/cli/matrixOptions.cjs.map +1 -1
  417. package/dist/src/cli/matrixOptions.d.mts +22 -16
  418. package/dist/src/cli/matrixOptions.d.mts.map +1 -1
  419. package/dist/src/cli/matrixOptions.mjs +76 -33
  420. package/dist/src/cli/matrixOptions.mjs.map +1 -1
  421. package/dist/src/cli/options.cjs +51 -128
  422. package/dist/src/cli/options.cjs.map +1 -1
  423. package/dist/src/cli/options.d.mts +1 -1
  424. package/dist/src/cli/options.d.mts.map +1 -1
  425. package/dist/src/cli/options.mjs +53 -130
  426. package/dist/src/cli/options.mjs.map +1 -1
  427. package/dist/src/cli/router.cjs +0 -1
  428. package/dist/src/cli/router.cjs.map +1 -1
  429. package/dist/src/cli/router.d.mts +1 -1
  430. package/dist/src/cli/router.mjs +0 -1
  431. package/dist/src/cli/router.mjs.map +1 -1
  432. package/dist/src/cli/server/options.cjs +37 -7
  433. package/dist/src/cli/server/options.cjs.map +1 -1
  434. package/dist/src/cli/server/options.mjs +37 -7
  435. package/dist/src/cli/server/options.mjs.map +1 -1
  436. package/dist/src/cli/server/processGuards.cjs +22 -15
  437. package/dist/src/cli/server/processGuards.cjs.map +1 -1
  438. package/dist/src/cli/server/processGuards.mjs +21 -14
  439. package/dist/src/cli/server/processGuards.mjs.map +1 -1
  440. package/dist/src/cli/server/restartPolicy.cjs +38 -0
  441. package/dist/src/cli/server/restartPolicy.cjs.map +1 -0
  442. package/dist/src/cli/server/restartPolicy.d.mts +21 -0
  443. package/dist/src/cli/server/restartPolicy.d.mts.map +1 -0
  444. package/dist/src/cli/server/restartPolicy.mjs +36 -0
  445. package/dist/src/cli/server/restartPolicy.mjs.map +1 -0
  446. package/dist/src/cli/server/run.cjs +12 -11
  447. package/dist/src/cli/server/run.cjs.map +1 -1
  448. package/dist/src/cli/server/run.mjs +11 -10
  449. package/dist/src/cli/server/run.mjs.map +1 -1
  450. package/dist/src/cli/server/supervise.cjs +89 -0
  451. package/dist/src/cli/server/supervise.cjs.map +1 -0
  452. package/dist/src/cli/server/supervise.mjs +89 -0
  453. package/dist/src/cli/server/supervise.mjs.map +1 -0
  454. package/dist/src/composition/harnessState/index.cjs +2 -1
  455. package/dist/src/composition/harnessState/index.cjs.map +1 -1
  456. package/dist/src/composition/harnessState/index.d.mts +2 -1
  457. package/dist/src/composition/harnessState/index.d.mts.map +1 -1
  458. package/dist/src/composition/harnessState/index.mjs +2 -1
  459. package/dist/src/composition/harnessState/index.mjs.map +1 -1
  460. package/dist/src/composition/layerPackageInstaller/index.cjs +293 -86
  461. package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -1
  462. package/dist/src/composition/layerPackageInstaller/index.d.mts +25 -2
  463. package/dist/src/composition/layerPackageInstaller/index.d.mts.map +1 -1
  464. package/dist/src/composition/layerPackageInstaller/index.mjs +295 -94
  465. package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -1
  466. package/dist/src/composition/marketplaceCatalog/index.cjs +136 -0
  467. package/dist/src/composition/marketplaceCatalog/index.cjs.map +1 -0
  468. package/dist/src/composition/marketplaceCatalog/index.mjs +132 -0
  469. package/dist/src/composition/marketplaceCatalog/index.mjs.map +1 -0
  470. package/dist/src/composition/orgPluginActivation/index.cjs +179 -0
  471. package/dist/src/composition/orgPluginActivation/index.cjs.map +1 -0
  472. package/dist/src/composition/orgPluginActivation/index.mjs +177 -0
  473. package/dist/src/composition/orgPluginActivation/index.mjs.map +1 -0
  474. package/dist/src/composition/orgPluginLibrary/index.cjs +205 -0
  475. package/dist/src/composition/orgPluginLibrary/index.cjs.map +1 -0
  476. package/dist/src/composition/orgPluginLibrary/index.mjs +200 -0
  477. package/dist/src/composition/orgPluginLibrary/index.mjs.map +1 -0
  478. package/dist/src/composition/pluginMarketplace/index.cjs +304 -0
  479. package/dist/src/composition/pluginMarketplace/index.cjs.map +1 -0
  480. package/dist/src/composition/pluginMarketplace/index.mjs +302 -0
  481. package/dist/src/composition/pluginMarketplace/index.mjs.map +1 -0
  482. package/dist/src/composition/poHomeMigration/index.cjs +46 -26
  483. package/dist/src/composition/poHomeMigration/index.cjs.map +1 -1
  484. package/dist/src/composition/poHomeMigration/index.d.mts.map +1 -1
  485. package/dist/src/composition/poHomeMigration/index.mjs +45 -25
  486. package/dist/src/composition/poHomeMigration/index.mjs.map +1 -1
  487. package/dist/src/composition/projectTrust/index.cjs +40 -3
  488. package/dist/src/composition/projectTrust/index.cjs.map +1 -1
  489. package/dist/src/composition/projectTrust/index.d.mts +8 -0
  490. package/dist/src/composition/projectTrust/index.d.mts.map +1 -1
  491. package/dist/src/composition/projectTrust/index.mjs +33 -2
  492. package/dist/src/composition/projectTrust/index.mjs.map +1 -1
  493. package/dist/src/composition/repository/index.cjs +29 -12
  494. package/dist/src/composition/repository/index.cjs.map +1 -1
  495. package/dist/src/composition/repository/index.d.mts +10 -3
  496. package/dist/src/composition/repository/index.d.mts.map +1 -1
  497. package/dist/src/composition/repository/index.mjs +29 -13
  498. package/dist/src/composition/repository/index.mjs.map +1 -1
  499. package/dist/src/composition/syncPrune/index.cjs +23 -16
  500. package/dist/src/composition/syncPrune/index.cjs.map +1 -1
  501. package/dist/src/composition/syncPrune/index.d.mts.map +1 -1
  502. package/dist/src/composition/syncPrune/index.mjs +22 -15
  503. package/dist/src/composition/syncPrune/index.mjs.map +1 -1
  504. package/dist/src/composition/syncService/index.cjs +441 -194
  505. package/dist/src/composition/syncService/index.cjs.map +1 -1
  506. package/dist/src/composition/syncService/index.d.mts +4 -1
  507. package/dist/src/composition/syncService/index.d.mts.map +1 -1
  508. package/dist/src/composition/syncService/index.mjs +440 -196
  509. package/dist/src/composition/syncService/index.mjs.map +1 -1
  510. package/dist/src/composition/syncService/localBuilds.cjs +41 -37
  511. package/dist/src/composition/syncService/localBuilds.cjs.map +1 -1
  512. package/dist/src/composition/syncService/localBuilds.mjs +40 -37
  513. package/dist/src/composition/syncService/localBuilds.mjs.map +1 -1
  514. package/dist/src/composition/transitionLayers.cjs.map +1 -1
  515. package/dist/src/composition/transitionLayers.d.mts +3 -3
  516. package/dist/src/composition/transitionLayers.d.mts.map +1 -1
  517. package/dist/src/composition/transitionLayers.mjs.map +1 -1
  518. package/dist/src/composition/types/harness.d.mts +4 -9
  519. package/dist/src/composition/types/harness.d.mts.map +1 -1
  520. package/dist/src/extensions/setupDiagnostics.cjs +8 -8
  521. package/dist/src/extensions/setupDiagnostics.cjs.map +1 -1
  522. package/dist/src/extensions/setupDiagnostics.mjs +8 -8
  523. package/dist/src/extensions/setupDiagnostics.mjs.map +1 -1
  524. package/dist/webBuilder.cjs +1 -0
  525. package/dist/webBuilder.d.mts +2 -2
  526. package/dist/webBuilder.mjs +2 -2
  527. package/docs/server/api-export.md +9 -9
  528. package/docs/server/api.md +22 -125
  529. package/docs/server/getting-started.md +21 -85
  530. package/docs/server/index.md +13 -58
  531. package/docs/server/ipc.md +26 -72
  532. package/docs/server/lifecycle.md +18 -91
  533. package/docs/server/security.md +20 -80
  534. package/package.json +47 -67
  535. package/src/prompts/po-author-extension/SKILL.md +2 -2
  536. package/src/prompts/po-author-extension/references/extension-contract.md +4 -6
  537. package/dist/antigravity.cjs +0 -5
  538. package/dist/antigravity.d.mts +0 -2
  539. package/dist/antigravity.mjs +0 -1
  540. package/dist/codex.cjs +0 -8
  541. package/dist/codex.d.mts +0 -2
  542. package/dist/codex.mjs +0 -1
  543. package/dist/compatibility.cjs +0 -27
  544. package/dist/compatibility.d.mts +0 -6
  545. package/dist/compatibility.mjs +0 -6
  546. package/dist/compatibilityCommand.cjs +0 -4
  547. package/dist/compatibilityCommand.d.mts +0 -2
  548. package/dist/compatibilityCommand.mjs +0 -1
  549. package/dist/compatibilityContext.cjs +0 -3
  550. package/dist/compatibilityContext.d.mts +0 -2
  551. package/dist/compatibilityContext.mjs +0 -1
  552. package/dist/compatibilityOptions.cjs +0 -5
  553. package/dist/compatibilityOptions.d.mts +0 -2
  554. package/dist/compatibilityOptions.mjs +0 -1
  555. package/dist/process.cjs +0 -12
  556. package/dist/process.d.mts +0 -2
  557. package/dist/process.mjs +0 -1
  558. package/dist/src/builders/hooks/index.cjs +0 -238
  559. package/dist/src/builders/hooks/index.cjs.map +0 -1
  560. package/dist/src/builders/hooks/index.mjs +0 -231
  561. package/dist/src/builders/hooks/index.mjs.map +0 -1
  562. package/dist/src/cli/commands/compat/context.cjs +0 -115
  563. package/dist/src/cli/commands/compat/context.cjs.map +0 -1
  564. package/dist/src/cli/commands/compat/context.d.mts +0 -22
  565. package/dist/src/cli/commands/compat/context.d.mts.map +0 -1
  566. package/dist/src/cli/commands/compat/context.mjs +0 -110
  567. package/dist/src/cli/commands/compat/context.mjs.map +0 -1
  568. package/dist/src/cli/commands/compat/help.cjs +0 -26
  569. package/dist/src/cli/commands/compat/help.cjs.map +0 -1
  570. package/dist/src/cli/commands/compat/help.d.mts +0 -4
  571. package/dist/src/cli/commands/compat/help.d.mts.map +0 -1
  572. package/dist/src/cli/commands/compat/help.mjs +0 -25
  573. package/dist/src/cli/commands/compat/help.mjs.map +0 -1
  574. package/dist/src/cli/commands/compat/index.cjs +0 -73
  575. package/dist/src/cli/commands/compat/index.cjs.map +0 -1
  576. package/dist/src/cli/commands/compat/index.d.mts +0 -14
  577. package/dist/src/cli/commands/compat/index.d.mts.map +0 -1
  578. package/dist/src/cli/commands/compat/index.mjs +0 -70
  579. package/dist/src/cli/commands/compat/index.mjs.map +0 -1
  580. package/dist/src/cli/commands/compat/options.cjs +0 -88
  581. package/dist/src/cli/commands/compat/options.cjs.map +0 -1
  582. package/dist/src/cli/commands/compat/options.d.mts +0 -15
  583. package/dist/src/cli/commands/compat/options.d.mts.map +0 -1
  584. package/dist/src/cli/commands/compat/options.mjs +0 -86
  585. package/dist/src/cli/commands/compat/options.mjs.map +0 -1
  586. package/dist/src/cli/commands/compat/providers/antigravity.cjs +0 -294
  587. package/dist/src/cli/commands/compat/providers/antigravity.cjs.map +0 -1
  588. package/dist/src/cli/commands/compat/providers/antigravity.d.mts +0 -9
  589. package/dist/src/cli/commands/compat/providers/antigravity.d.mts.map +0 -1
  590. package/dist/src/cli/commands/compat/providers/antigravity.mjs +0 -289
  591. package/dist/src/cli/commands/compat/providers/antigravity.mjs.map +0 -1
  592. package/dist/src/cli/commands/compat/providers/codex.cjs +0 -178
  593. package/dist/src/cli/commands/compat/providers/codex.cjs.map +0 -1
  594. package/dist/src/cli/commands/compat/providers/codex.d.mts +0 -17
  595. package/dist/src/cli/commands/compat/providers/codex.d.mts.map +0 -1
  596. package/dist/src/cli/commands/compat/providers/codex.mjs +0 -170
  597. package/dist/src/cli/commands/compat/providers/codex.mjs.map +0 -1
  598. package/dist/src/cli/commands/compat/providers/index.cjs +0 -65
  599. package/dist/src/cli/commands/compat/providers/index.cjs.map +0 -1
  600. package/dist/src/cli/commands/compat/providers/index.d.mts +0 -15
  601. package/dist/src/cli/commands/compat/providers/index.d.mts.map +0 -1
  602. package/dist/src/cli/commands/compat/providers/index.mjs +0 -45
  603. package/dist/src/cli/commands/compat/providers/index.mjs.map +0 -1
  604. package/dist/src/cli/commands/compat/providers/process.cjs +0 -172
  605. package/dist/src/cli/commands/compat/providers/process.cjs.map +0 -1
  606. package/dist/src/cli/commands/compat/providers/process.d.mts +0 -33
  607. package/dist/src/cli/commands/compat/providers/process.d.mts.map +0 -1
  608. package/dist/src/cli/commands/compat/providers/process.mjs +0 -159
  609. package/dist/src/cli/commands/compat/providers/process.mjs.map +0 -1
  610. package/dist/src/cli/commands/compat/providers/shared.cjs +0 -76
  611. package/dist/src/cli/commands/compat/providers/shared.cjs.map +0 -1
  612. package/dist/src/cli/commands/compat/providers/shared.d.mts +0 -40
  613. package/dist/src/cli/commands/compat/providers/shared.d.mts.map +0 -1
  614. package/dist/src/cli/commands/compat/providers/shared.mjs +0 -61
  615. package/dist/src/cli/commands/compat/providers/shared.mjs.map +0 -1
  616. package/dist/src/cli/commands/compat/types.d.mts +0 -31
  617. package/dist/src/cli/commands/compat/types.d.mts.map +0 -1
  618. package/dist/src/cli/commands/init/constants.cjs +0 -11
  619. package/dist/src/cli/commands/init/constants.cjs.map +0 -1
  620. package/dist/src/cli/commands/init/constants.mjs +0 -11
  621. package/dist/src/cli/commands/init/constants.mjs.map +0 -1
@@ -2,29 +2,31 @@ const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_packageUrl = require("../server/packageUrl.cjs");
3
3
  const require_webPluginManifest = require("./webPluginManifest.cjs");
4
4
  const require_webPluginScan = require("./webPluginScan.cjs");
5
- let node_fs = require("node:fs");
6
- node_fs = require_runtime.__toESM(node_fs, 1);
5
+ let node_module = require("node:module");
7
6
  let node_path = require("node:path");
8
7
  node_path = require_runtime.__toESM(node_path, 1);
9
- let node_child_process = require("node:child_process");
10
- let node_module = require("node:module");
8
+ let node_fs_promises = require("node:fs/promises");
9
+ node_fs_promises = require_runtime.__toESM(node_fs_promises, 1);
10
+ let _agimon_ai_po_core_nodePlatform = require("@agimon-ai/po-core/nodePlatform");
11
+ let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
11
12
  let node_crypto = require("node:crypto");
12
13
  node_crypto = require_runtime.__toESM(node_crypto, 1);
14
+ let node_child_process = require("node:child_process");
13
15
  //#region src/builders/web/index.ts
14
16
  const WEB_PACKAGE = "@agimon-ai/po-web";
15
17
  const WEB_PACKAGE_ROOT_ENV = "PO_WEB_PACKAGE_ROOT";
16
- /** The package roots a set of compositions activates, each once. */
17
- function compositionPackageRoots(compositions) {
18
- return [...new Set(compositions.flatMap((composition) => composition.packageEntries).map(packageRootOf).filter((root) => root !== void 0))];
18
+ /** The package roots a set of compositions activates, without blocking a live host. */
19
+ async function compositionPackageRoots(compositions, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(process.cwd())) {
20
+ const roots = await Promise.all(compositions.flatMap((composition) => composition.packageEntries).map((entry) => packageRootOf(entry, files)));
21
+ return [...new Set(roots.filter((root) => root !== void 0))];
19
22
  }
20
- /** Walks from a resolved module path up to the directory owning its package.json. */
21
- function packageRootOf(entryPath) {
22
- let dir = node_path.default.dirname(entryPath);
23
+ async function packageRootOf(entryPath, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(process.cwd())) {
24
+ let directory = node_path.default.dirname(entryPath);
23
25
  for (;;) {
24
- if (node_fs.default.existsSync(node_path.default.join(dir, "package.json"))) return dir;
25
- const parent = node_path.default.dirname(dir);
26
- if (parent === dir) return void 0;
27
- dir = parent;
26
+ if (await (0, _agimon_ai_po_core_platform.pathExists)(files, node_path.default.join(directory, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)) return directory;
27
+ const parent = node_path.default.dirname(directory);
28
+ if (parent === directory) return void 0;
29
+ directory = parent;
28
30
  }
29
31
  }
30
32
  function resolveWebPackageRoot(repoRoot, environment) {
@@ -41,11 +43,11 @@ function resolveWebPackageRoot(repoRoot, environment) {
41
43
  }
42
44
  }
43
45
  /** The installed po-web host version the global web build would use, or `none` when it is not installed. */
44
- function webHostVersion(poHome, environment = process.env) {
46
+ async function webHostVersion(poHome, environment = process.env, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(poHome)) {
45
47
  const webRoot = resolveWebPackageRoot(poHome, environment);
46
48
  if (webRoot === void 0) return "none";
47
49
  try {
48
- const manifest = JSON.parse(node_fs.default.readFileSync(node_path.default.join(webRoot, "package.json"), "utf8"));
50
+ const manifest = JSON.parse((0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(node_path.default.join(webRoot, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)));
49
51
  return typeof manifest.version === "string" ? manifest.version : "unversioned";
50
52
  } catch (error) {
51
53
  return `unreadable:${error instanceof Error ? error.message : String(error)}`;
@@ -55,6 +57,13 @@ function webHostVersion(poHome, environment = process.env) {
55
57
  const GLOBAL_BUILD_FORMAT = "global-web-5";
56
58
  /** The record every keyed global build writes last, so a key directory holding it is complete. */
57
59
  const BUILD_RECORD = "build.json";
60
+ /** Po packages the host shell bundles, the Po members of the bundle's shared runtimes. */
61
+ const HOST_SHELL_PACKAGES = [
62
+ "@agimon-ai/po-core",
63
+ "@agimon-ai/po-web-dashboard",
64
+ "@agimon-ai/po-web-components",
65
+ "@agimon-ai/po-web-security"
66
+ ];
58
67
  const BUILD_CHILD_SCRIPT = `
59
68
  const [bundleUrl, request] = process.argv.slice(1);
60
69
  try {
@@ -77,11 +86,11 @@ try {
77
86
  * plus the whole top-level folder of the client entry and of each declared export, so an
78
87
  * edited import or a rebuilt dist chunk changes the key, not only the entry file.
79
88
  */
80
- function packageSignature(packageDir, entries) {
89
+ async function packageSignature(packageDir, entries, files) {
81
90
  try {
82
- const files = /* @__PURE__ */ new Set();
83
- for (const entry of entries) for (const file of require_packageUrl.snapshotFiles(packageDir, entry)) files.add(file);
84
- return require_packageUrl.statSignature(packageDir, [...files].sort());
91
+ const selected = /* @__PURE__ */ new Set();
92
+ for (const entry of entries) for (const file of await require_packageUrl.snapshotFiles(packageDir, entry, files)) selected.add(file);
93
+ return await require_packageUrl.statSignature(packageDir, [...selected].sort(), files);
85
94
  } catch (error) {
86
95
  return `unreadable:${error instanceof Error ? error.message : String(error)}`;
87
96
  }
@@ -91,9 +100,16 @@ function packageSignature(packageDir, entries) {
91
100
  * plugin package's file signature. A changed source or dist file or a changed plugin set
92
101
  * yields a new key; roots that declare no plugin do not take part.
93
102
  */
94
- function globalBuildKey(format, hostRoot, plugins) {
103
+ async function globalBuildKey(format, hostRoot, plugins, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(process.cwd())) {
95
104
  const hash = node_crypto.default.createHash("sha256").update(format);
96
- if (hostRoot !== void 0) hash.update(`host:${hostRoot}:${node_fs.default.readFileSync(node_path.default.join(hostRoot, "package.json"), "utf8")}`);
105
+ if (hostRoot !== void 0) {
106
+ hash.update(`host:${hostRoot}:${(0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(node_path.default.join(hostRoot, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT))}`);
107
+ hash.update(`\0host-files:${await packageSignature(hostRoot, [node_path.default.join(hostRoot, "src", "web", "index.html")], files)}`);
108
+ for (const name of HOST_SHELL_PACKAGES) {
109
+ const packageDir = node_path.default.join(hostRoot, "node_modules", ...name.split("/"));
110
+ hash.update(`\0shell:${name}\0${await packageSignature(packageDir, [node_path.default.join(packageDir, "dist")], files)}`);
111
+ }
112
+ }
97
113
  const entries = /* @__PURE__ */ new Map();
98
114
  for (const plugin of [...plugins].sort((a, b) => require_webPluginManifest.compareCodeUnits(a.pluginId, b.pluginId))) {
99
115
  hash.update(`\0${plugin.pluginId}:${plugin.packageDir}:${plugin.client.entry}`);
@@ -101,7 +117,7 @@ function globalBuildKey(format, hostRoot, plugins) {
101
117
  list.push(node_path.default.join(plugin.packageDir, plugin.client.entry));
102
118
  entries.set(plugin.packageDir, list);
103
119
  }
104
- for (const packageDir of [...entries.keys()].sort()) hash.update(`\0${packageDir}\0${packageSignature(packageDir, entries.get(packageDir) ?? [])}`);
120
+ for (const packageDir of [...entries.keys()].sort()) hash.update(`\0${packageDir}\0${await packageSignature(packageDir, entries.get(packageDir) ?? [], files)}`);
105
121
  return hash.digest("hex").slice(0, 32);
106
122
  }
107
123
  function bundleModuleUrl() {
@@ -135,17 +151,17 @@ function runBuildProcess(request, environment, onNotice) {
135
151
  });
136
152
  }
137
153
  /** A key directory's parsed build record, or undefined when the build is not there (yet). */
138
- function readBuildJson(directory) {
154
+ async function readBuildJson(directory, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(directory)) {
139
155
  try {
140
- return JSON.parse(node_fs.default.readFileSync(node_path.default.join(directory, BUILD_RECORD), "utf8"));
156
+ return JSON.parse((0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(node_path.default.join(directory, BUILD_RECORD), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)));
141
157
  } catch (error) {
142
- if (error.code === "ENOENT") return void 0;
158
+ if (error.code === "not_found") return void 0;
143
159
  throw error;
144
160
  }
145
161
  }
146
- function readBuildRecord(directory) {
147
- const record = readBuildJson(directory);
148
- if (record === void 0) return void 0;
162
+ async function readBuildRecord(directory, files) {
163
+ const record = await readBuildJson(directory, files);
164
+ if (record === void 0 || !Array.isArray(record.plugins) || record.plugins.some((plugin) => typeof plugin.slot !== "string")) return void 0;
149
165
  return {
150
166
  ...record,
151
167
  webDirectory: node_path.default.join(directory, "web"),
@@ -156,23 +172,25 @@ function webBuildsRoot(poHome) {
156
172
  return node_path.default.join(poHome, "build", "web");
157
173
  }
158
174
  /** The complete global web build of one key, or undefined when it is not there. Never builds. */
159
- function readGlobalWebBuildRecord(poHome, key) {
160
- return readBuildRecord(node_path.default.join(webBuildsRoot(poHome), key));
175
+ async function readGlobalWebBuildRecord(poHome, key, files) {
176
+ return readBuildRecord(node_path.default.join(webBuildsRoot(poHome), key), files);
161
177
  }
162
178
  /**
163
179
  * The key of the most recently written complete global web build, for a server that starts
164
180
  * before sync ever wrote a pointer. Temporary build folders start with a dot and are skipped.
165
181
  */
166
- function newestGlobalWebBuildKey(poHome) {
182
+ async function newestGlobalWebBuildKey(poHome, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(poHome)) {
167
183
  const root = webBuildsRoot(poHome);
168
- if (!node_fs.default.existsSync(root)) return void 0;
169
- return node_fs.default.readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => ({
170
- name: entry.name,
171
- file: node_path.default.join(root, entry.name, BUILD_RECORD)
172
- })).filter((entry) => node_fs.default.existsSync(entry.file)).map((entry) => ({
173
- name: entry.name,
174
- modified: node_fs.default.statSync(entry.file).mtimeMs
175
- })).sort((left, right) => right.modified - left.modified)[0]?.name;
184
+ const listed = await files.listDir(root, _agimon_ai_po_core_platform.BACKGROUND_CONTEXT);
185
+ if (!listed.ok && listed.error.code === "not_found") return void 0;
186
+ return (await Promise.all((0, _agimon_ai_po_core_platform.getOrThrow)(listed).filter((entry) => entry.kind === "directory" && !entry.name.startsWith(".")).map(async (entry) => {
187
+ const info = await files.fileInfo(node_path.default.join(root, entry.name, BUILD_RECORD), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT);
188
+ if (!info.ok && info.error.code === "not_found") return void 0;
189
+ return {
190
+ name: entry.name,
191
+ modified: (0, _agimon_ai_po_core_platform.getOrThrow)(info).mtimeMs
192
+ };
193
+ }))).filter((entry) => entry !== void 0).sort((left, right) => right.modified - left.modified)[0]?.name;
176
194
  }
177
195
  /**
178
196
  * Builds into a temporary sibling of `directory`, writes the build record last, and renames
@@ -180,18 +198,18 @@ function newestGlobalWebBuildKey(poHome) {
180
198
  * process that finished the same key is fine: its bytes are identical.
181
199
  */
182
200
  async function buildKeyDirectory(buildsRoot, key, directory, build) {
183
- node_fs.default.mkdirSync(buildsRoot, { recursive: true });
184
- const temporary = node_fs.default.mkdtempSync(node_path.default.join(buildsRoot, `.${key}-`));
201
+ await node_fs_promises.default.mkdir(buildsRoot, { recursive: true });
202
+ const temporary = await node_fs_promises.default.mkdtemp(node_path.default.join(buildsRoot, `.${key}-`));
185
203
  try {
186
204
  const record = await build(temporary);
187
- node_fs.default.writeFileSync(node_path.default.join(temporary, BUILD_RECORD), `${JSON.stringify(record, null, 2)}\n`);
205
+ await node_fs_promises.default.writeFile(node_path.default.join(temporary, BUILD_RECORD), `${JSON.stringify(record, null, 2)}\n`);
188
206
  try {
189
- node_fs.default.renameSync(temporary, directory);
207
+ await node_fs_promises.default.rename(temporary, directory);
190
208
  } catch (error) {
191
- if (readBuildJson(directory) === void 0) throw error;
209
+ if (await readBuildJson(directory) === void 0) throw error;
192
210
  }
193
211
  } finally {
194
- node_fs.default.rmSync(temporary, {
212
+ await node_fs_promises.default.rm(temporary, {
195
213
  recursive: true,
196
214
  force: true
197
215
  });
@@ -211,17 +229,17 @@ async function singleFlightBuild(key, run) {
211
229
  }
212
230
  }
213
231
  /** The build key for these plugin roots and where its build lives, without building anything. */
214
- function resolveGlobalWebBuild(input) {
232
+ async function resolveGlobalWebBuild(input) {
215
233
  const environment = input.environment ?? process.env;
216
234
  const webRoot = (input.resolveWebRoot ?? resolveWebPackageRoot)(input.poHome, environment);
217
- if (webRoot === void 0 || !node_fs.default.existsSync(node_path.default.join(webRoot, "package.json"))) return {
235
+ if (webRoot === void 0 || !await (0, _agimon_ai_po_core_platform.pathExists)(input.files ?? (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(input.poHome), node_path.default.join(webRoot, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)) return {
218
236
  status: "skipped",
219
237
  reason: `${WEB_PACKAGE} is not installed; no web composition is published`
220
238
  };
221
239
  const pluginRoots = [...new Set(input.pluginRoots.map((root) => node_path.default.resolve(root)))].sort();
222
240
  let key;
223
241
  try {
224
- key = globalBuildKey(GLOBAL_BUILD_FORMAT, webRoot, require_webPluginScan.scanWebPlugins(webRoot, pluginRoots, input.onNotice ?? (() => {})));
242
+ key = await globalBuildKey(GLOBAL_BUILD_FORMAT, webRoot, await require_webPluginScan.scanWebPlugins(webRoot, pluginRoots, input.onNotice ?? (() => {})), input.files);
225
243
  } catch (error) {
226
244
  return {
227
245
  status: "failed",
@@ -239,21 +257,21 @@ function resolveGlobalWebBuild(input) {
239
257
  };
240
258
  }
241
259
  /** Whether the global build for these plugin roots exists, for a check that must not build. */
242
- function readGlobalWebBuildStatus(input) {
243
- const resolved = resolveGlobalWebBuild(input);
260
+ async function readGlobalWebBuildStatus(input) {
261
+ const resolved = await resolveGlobalWebBuild(input);
244
262
  if (resolved.status !== "resolved") return resolved;
245
263
  return {
246
- status: readBuildRecord(resolved.directory) === void 0 ? "missing" : "current",
264
+ status: await readBuildRecord(resolved.directory, input.files) === void 0 ? "missing" : "current",
247
265
  key: resolved.key
248
266
  };
249
267
  }
250
268
  async function ensureGlobalWebBuild(input) {
251
269
  const environment = input.environment ?? process.env;
252
270
  const notice = input.onNotice ?? (() => {});
253
- const resolved = resolveGlobalWebBuild(input);
271
+ const resolved = await resolveGlobalWebBuild(input);
254
272
  if (resolved.status !== "resolved") return resolved;
255
273
  const { webRoot, pluginRoots, key, buildsRoot, directory } = resolved;
256
- const existing = readBuildRecord(directory);
274
+ const existing = await readBuildRecord(directory, input.files);
257
275
  if (existing !== void 0) return {
258
276
  status: "cached",
259
277
  build: existing
@@ -274,7 +292,7 @@ async function ensureGlobalWebBuild(input) {
274
292
  baseStyle: output.baseStyle
275
293
  };
276
294
  });
277
- const build = readBuildRecord(directory);
295
+ const build = await readBuildRecord(directory, input.files);
278
296
  if (build === void 0) throw new Error(`The web build '${key}' was not recorded.`);
279
297
  return {
280
298
  status: "built",
@@ -305,20 +323,20 @@ function mountWebPluginIds(build, packageRoots) {
305
323
  }
306
324
  /** The slots a mount runs: one copy per pluginId, the first in build order. */
307
325
  function mountWebPluginSlots(build, packageRoots) {
308
- return mountPluginCopies(build, packageRoots).map(require_webPluginManifest.pluginSlot);
326
+ return mountPluginCopies(build, packageRoots).map((plugin) => plugin.slot);
309
327
  }
310
328
  /**
311
329
  * The package roots among `packageRoots` that declare a web plugin the build has no slot for:
312
330
  * a package that was not synced yet, or was left out of the build. Their names, else their roots.
313
331
  */
314
- function unslottedWebPackages(build, packageRoots) {
332
+ async function unslottedWebPackages(build, packageRoots, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(process.cwd())) {
315
333
  const slotted = new Set(build.plugins.map((plugin) => node_path.default.resolve(plugin.packageDir)));
316
334
  const missing = [];
317
335
  for (const root of new Set(packageRoots.map((entry) => node_path.default.resolve(entry)))) {
318
336
  if (slotted.has(root)) continue;
319
337
  let manifest;
320
338
  try {
321
- manifest = JSON.parse(node_fs.default.readFileSync(node_path.default.join(root, "package.json"), "utf8"));
339
+ manifest = JSON.parse((0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(node_path.default.join(root, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)));
322
340
  } catch {
323
341
  continue;
324
342
  }
@@ -333,7 +351,7 @@ function duplicatePluginCopies(build, packageRoots) {
333
351
  const slotsById = /* @__PURE__ */ new Map();
334
352
  for (const plugin of build.plugins) {
335
353
  if (!plugin.isHost && !roots.has(node_path.default.resolve(plugin.packageDir))) continue;
336
- const slot = require_webPluginManifest.pluginSlot(plugin);
354
+ const slot = plugin.slot;
337
355
  const slots = slotsById.get(plugin.pluginId) ?? [];
338
356
  if (!slots.includes(slot)) slots.push(slot);
339
357
  slotsById.set(plugin.pluginId, slots);
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["path","fs","createRequire","snapshotFiles","statSignature","crypto","compareCodeUnits","scanWebPlugins","pluginSlot"],"sources":["../../../../src/builders/web/index.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport type { GlobalWebBuild, GlobalWebBuildPlugin } from '@agimon-ai/po-core/webCompositions';\n\nimport { snapshotFiles, statSignature } from '../server/packageUrl';\nimport { compareCodeUnits, type DeclaredWebPlugin, pluginSlot } from './webPluginManifest';\nimport { scanWebPlugins } from './webPluginScan';\n\nconst WEB_PACKAGE = '@agimon-ai/po-web';\nconst WEB_PACKAGE_ROOT_ENV = 'PO_WEB_PACKAGE_ROOT';\n\n/** The package roots a set of compositions activates, each once. */\nexport function compositionPackageRoots(compositions: readonly { packageEntries: readonly string[] }[]): string[] {\n return [\n ...new Set(\n compositions\n .flatMap((composition) => composition.packageEntries)\n .map(packageRootOf)\n .filter((root): root is string => root !== undefined),\n ),\n ];\n}\n\n/** Walks from a resolved module path up to the directory owning its package.json. */\nexport function packageRootOf(entryPath: string): string | undefined {\n let dir = path.dirname(entryPath);\n for (;;) {\n if (fs.existsSync(path.join(dir, 'package.json'))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n}\n\nfunction resolveWebPackageRoot(repoRoot: string, environment: NodeJS.ProcessEnv): string | undefined {\n const override = environment[WEB_PACKAGE_ROOT_ENV];\n if (override !== undefined && override !== '') return path.resolve(override);\n try {\n return path.dirname(createRequire(path.join(repoRoot, 'package.json')).resolve(`${WEB_PACKAGE}/package.json`));\n } catch {\n try {\n return path.dirname(createRequire(import.meta.url).resolve(`${WEB_PACKAGE}/package.json`));\n } catch {\n return undefined;\n }\n }\n}\n\n/** The installed po-web host version the global web build would use, or `none` when it is not installed. */\nexport function webHostVersion(poHome: string, environment: NodeJS.ProcessEnv = process.env): string {\n const webRoot = resolveWebPackageRoot(poHome, environment);\n if (webRoot === undefined) return 'none';\n try {\n const manifest = JSON.parse(fs.readFileSync(path.join(webRoot, 'package.json'), 'utf8')) as { version?: unknown };\n return typeof manifest.version === 'string' ? manifest.version : 'unversioned';\n } catch (error) {\n return `unreadable:${error instanceof Error ? error.message : String(error)}`;\n }\n}\n\n/** Bumped whenever the build's output layout changes, so an old layout is never reused. */\nconst GLOBAL_BUILD_FORMAT = 'global-web-5';\n/** The record every keyed global build writes last, so a key directory holding it is complete. */\nexport const BUILD_RECORD = 'build.json';\nconst BUILD_CHILD_SCRIPT = `\nconst [bundleUrl, request] = process.argv.slice(1);\ntry {\n const { bundleCockpitWeb } = await import(bundleUrl);\n const { hostRoot, pluginRoots, outDir } = JSON.parse(request);\n const result = await bundleCockpitWeb({\n hostRoot,\n pluginRoots,\n outDir,\n onNotice: (message) => process.stderr.write(message + '\\\\n'),\n });\n process.stdout.write(JSON.stringify(result));\n} catch (error) {\n process.stderr.write(error instanceof Error ? (error.stack ?? error.message) : String(error));\n process.exitCode = 1;\n}\n`;\n\n/** One build's record: the publishable build, whose plugins carry each copy's package and slot closure. */\nexport type GlobalWebBuildRecord = GlobalWebBuild;\n\nexport interface GlobalWebBuildInput {\n /** Po's global home; builds land in `<home>/build/web/<key>/`. */\n poHome: string;\n /** The union of every scope's package roots; roots without a poWeb block are ignored. */\n pluginRoots: readonly string[];\n environment?: NodeJS.ProcessEnv;\n onNotice?: (message: string) => void;\n /** Test seam over the child-process build. */\n runBuild?: (request: { hostRoot: string; pluginRoots: string[]; outDir: string }) => Promise<BuildOutput>;\n /** Test seam over package resolution. */\n resolveWebRoot?: (repoRoot: string, environment: NodeJS.ProcessEnv) => string | undefined;\n}\n\ninterface BuildOutput {\n assetsDir: string;\n pluginsDir: string;\n plugins: GlobalWebBuildPlugin[];\n pluginStyles: Record<string, string>;\n baseStyle: string;\n}\n\nexport type GlobalWebBuildResult =\n | { status: 'built' | 'cached'; build: GlobalWebBuildRecord }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/**\n * The size+mtime signature of every file a plugin package hands the build: its manifest\n * plus the whole top-level folder of the client entry and of each declared export, so an\n * edited import or a rebuilt dist chunk changes the key, not only the entry file.\n */\nfunction packageSignature(packageDir: string, entries: readonly string[]): string {\n try {\n const files = new Set<string>();\n for (const entry of entries) for (const file of snapshotFiles(packageDir, entry)) files.add(file);\n return statSignature(packageDir, [...files].sort());\n } catch (error) {\n // A declared export that is not built yet must not block the build; it only weakens the key.\n return `unreadable:${error instanceof Error ? error.message : String(error)}`;\n }\n}\n\n/**\n * The content key of a build: the format, the host package when there is one, then every\n * plugin package's file signature. A changed source or dist file or a changed plugin set\n * yields a new key; roots that declare no plugin do not take part.\n */\nexport function globalBuildKey(\n format: string,\n hostRoot: string | undefined,\n plugins: readonly DeclaredWebPlugin[],\n): string {\n const hash = crypto.createHash('sha256').update(format);\n if (hostRoot !== undefined)\n hash.update(`host:${hostRoot}:${fs.readFileSync(path.join(hostRoot, 'package.json'), 'utf8')}`);\n const entries = new Map<string, string[]>();\n for (const plugin of [...plugins].sort((a, b) => compareCodeUnits(a.pluginId, b.pluginId))) {\n hash.update(`\\0${plugin.pluginId}:${plugin.packageDir}:${plugin.client.entry}`);\n const list = entries.get(plugin.packageDir) ?? [];\n list.push(path.join(plugin.packageDir, plugin.client.entry));\n entries.set(plugin.packageDir, list);\n }\n for (const packageDir of [...entries.keys()].sort())\n hash.update(`\\0${packageDir}\\0${packageSignature(packageDir, entries.get(packageDir) ?? [])}`);\n return hash.digest('hex').slice(0, 32);\n}\n\nfunction bundleModuleUrl(): string {\n const extension = import.meta.url.endsWith('.ts') ? 'ts' : 'mjs';\n return new URL(`./bundle.${extension}`, import.meta.url).href;\n}\n\n/** Runs Vite in a child process so its module graph and caches never stay in the server heap. */\nfunction runBuildProcess(\n request: { hostRoot: string; pluginRoots: string[]; outDir: string },\n environment: NodeJS.ProcessEnv,\n onNotice: (message: string) => void,\n): Promise<BuildOutput> {\n const args = [\n ...process.execArgv,\n '--input-type=module',\n '--eval',\n BUILD_CHILD_SCRIPT,\n bundleModuleUrl(),\n JSON.stringify(request),\n ];\n return new Promise((resolve, reject) => {\n execFile(\n process.execPath,\n args,\n { cwd: request.hostRoot, env: environment, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 },\n (error, stdout, stderr) => {\n if (error) {\n reject(new Error(`${stderr || stdout}`.trim() || `Web build exited with code ${String(error.code ?? 1)}`));\n return;\n }\n for (const line of stderr.split('\\n')) if (line.trim()) onNotice(line.trim());\n resolve(JSON.parse(stdout) as BuildOutput);\n },\n );\n });\n}\n\n/** A key directory's parsed build record, or undefined when the build is not there (yet). */\nexport function readBuildJson<T>(directory: string): T | undefined {\n try {\n return JSON.parse(fs.readFileSync(path.join(directory, BUILD_RECORD), 'utf8')) as T;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nfunction readBuildRecord(directory: string): GlobalWebBuildRecord | undefined {\n const record = readBuildJson<Omit<GlobalWebBuildRecord, 'webDirectory' | 'pluginsDirectory'>>(directory);\n if (record === undefined) return undefined;\n return { ...record, webDirectory: path.join(directory, 'web'), pluginsDirectory: path.join(directory, 'plugins') };\n}\n\nfunction webBuildsRoot(poHome: string): string {\n return path.join(poHome, 'build', 'web');\n}\n\n/** The complete global web build of one key, or undefined when it is not there. Never builds. */\nexport function readGlobalWebBuildRecord(poHome: string, key: string): GlobalWebBuildRecord | undefined {\n return readBuildRecord(path.join(webBuildsRoot(poHome), key));\n}\n\n/**\n * The key of the most recently written complete global web build, for a server that starts\n * before sync ever wrote a pointer. Temporary build folders start with a dot and are skipped.\n */\nexport function newestGlobalWebBuildKey(poHome: string): string | undefined {\n const root = webBuildsRoot(poHome);\n if (!fs.existsSync(root)) return undefined;\n return fs\n .readdirSync(root, { withFileTypes: true })\n .filter((entry) => entry.isDirectory() && !entry.name.startsWith('.'))\n .map((entry) => ({ name: entry.name, file: path.join(root, entry.name, BUILD_RECORD) }))\n .filter((entry) => fs.existsSync(entry.file))\n .map((entry) => ({ name: entry.name, modified: fs.statSync(entry.file).mtimeMs }))\n .sort((left, right) => right.modified - left.modified)[0]?.name;\n}\n\n/**\n * Builds into a temporary sibling of `directory`, writes the build record last, and renames\n * the result into place, so a key directory is always complete. Losing the rename to another\n * process that finished the same key is fine: its bytes are identical.\n */\nexport async function buildKeyDirectory(\n buildsRoot: string,\n key: string,\n directory: string,\n build: (temporary: string) => Promise<object>,\n): Promise<void> {\n fs.mkdirSync(buildsRoot, { recursive: true });\n const temporary = fs.mkdtempSync(path.join(buildsRoot, `.${key}-`));\n try {\n const record = await build(temporary);\n fs.writeFileSync(path.join(temporary, BUILD_RECORD), `${JSON.stringify(record, null, 2)}\\n`);\n try {\n fs.renameSync(temporary, directory);\n } catch (error) {\n if (readBuildJson(directory) === undefined) throw error;\n }\n } finally {\n fs.rmSync(temporary, { recursive: true, force: true });\n }\n}\n\nconst pendingBuilds = new Map<string, Promise<unknown>>();\n\n/** Joins a build of the same key that is already running in this process instead of starting another. */\nexport async function singleFlightBuild<T>(key: string, run: () => Promise<T>): Promise<T> {\n const pending = pendingBuilds.get(key);\n if (pending !== undefined) return pending as Promise<T>;\n const started = run();\n pendingBuilds.set(key, started);\n try {\n return await started;\n } finally {\n pendingBuilds.delete(key);\n }\n}\n\n/**\n * Ensures the one global web build for the given plugin roots exists and returns it.\n *\n * The output is `<home>/build/web/<key>/`, built in a temporary directory and renamed into\n * place, so a key directory is always complete; an existing key builds nothing. Each\n * plugin shares one content-hashed Tailwind stylesheet with the shell and fallback template.\n */\ntype ResolvedGlobalWebBuild =\n | { status: 'resolved'; webRoot: string; pluginRoots: string[]; key: string; buildsRoot: string; directory: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/** The build key for these plugin roots and where its build lives, without building anything. */\nfunction resolveGlobalWebBuild(input: GlobalWebBuildInput): ResolvedGlobalWebBuild {\n const environment = input.environment ?? process.env;\n const webRoot = (input.resolveWebRoot ?? resolveWebPackageRoot)(input.poHome, environment);\n if (webRoot === undefined || !fs.existsSync(path.join(webRoot, 'package.json')))\n return { status: 'skipped', reason: `${WEB_PACKAGE} is not installed; no web composition is published` };\n const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();\n let key: string;\n try {\n key = globalBuildKey(\n GLOBAL_BUILD_FORMAT,\n webRoot,\n scanWebPlugins(webRoot, pluginRoots, input.onNotice ?? ((): void => {})),\n );\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n const buildsRoot = path.join(input.poHome, 'build', 'web');\n return { status: 'resolved', webRoot, pluginRoots, key, buildsRoot, directory: path.join(buildsRoot, key) };\n}\n\n/** Whether the global build for these plugin roots exists, for a check that must not build. */\nexport function readGlobalWebBuildStatus(\n input: GlobalWebBuildInput,\n):\n | { status: 'current' | 'missing'; key: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string } {\n const resolved = resolveGlobalWebBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n return { status: readBuildRecord(resolved.directory) === undefined ? 'missing' : 'current', key: resolved.key };\n}\n\nexport async function ensureGlobalWebBuild(input: GlobalWebBuildInput): Promise<GlobalWebBuildResult> {\n const environment = input.environment ?? process.env;\n const notice = input.onNotice ?? ((): void => {});\n const resolved = resolveGlobalWebBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n const { webRoot, pluginRoots, key, buildsRoot, directory } = resolved;\n const existing = readBuildRecord(directory);\n if (existing !== undefined) return { status: 'cached', build: existing };\n return singleFlightBuild(key, async (): Promise<GlobalWebBuildResult> => {\n try {\n await buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {\n const request = { hostRoot: webRoot, pluginRoots, outDir: temporary };\n const output = await (input.runBuild ?? ((value) => runBuildProcess(value, environment, notice)))(request);\n return {\n key,\n plugins: output.plugins,\n pluginStyles: output.pluginStyles,\n baseStyle: output.baseStyle,\n };\n });\n const build = readBuildRecord(directory);\n if (build === undefined) throw new Error(`The web build '${key}' was not recorded.`);\n return { status: 'built', build };\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n });\n}\n\ntype MountPluginRecord = { pluginId: string; packageDir: string; isHost: boolean };\n\n/** The plugin copies a mount runs, host plugins plus its own roots', at most one per pluginId (first wins). */\nfunction mountPluginCopies(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): MountPluginRecord[] {\n const roots = new Set(packageRoots.map((root) => path.resolve(root)));\n const seen = new Set<string>();\n return build.plugins.filter((plugin) => {\n if (!plugin.isHost && !roots.has(path.resolve(plugin.packageDir))) return false;\n if (seen.has(plugin.pluginId)) return false;\n seen.add(plugin.pluginId);\n return true;\n });\n}\n\n/** The `pluginId` values a mount runs: the host's plugins plus those of its own package roots, deduplicated. */\nexport function mountWebPluginIds(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): string[] {\n return mountPluginCopies(build, packageRoots).map((plugin) => plugin.pluginId);\n}\n\n/** The slots a mount runs: one copy per pluginId, the first in build order. */\nexport function mountWebPluginSlots(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): string[] {\n return mountPluginCopies(build, packageRoots).map(pluginSlot);\n}\n\n/**\n * The package roots among `packageRoots` that declare a web plugin the build has no slot for:\n * a package that was not synced yet, or was left out of the build. Their names, else their roots.\n */\nexport function unslottedWebPackages(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): string[] {\n const slotted = new Set(build.plugins.map((plugin) => path.resolve(plugin.packageDir)));\n const missing: string[] = [];\n for (const root of new Set(packageRoots.map((entry) => path.resolve(entry)))) {\n if (slotted.has(root)) continue;\n let manifest: { name?: unknown; poWeb?: unknown };\n try {\n manifest = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')) as typeof manifest;\n } catch {\n // Unreadable manifests are reported by the build's own scan, not as a missing slot.\n continue;\n }\n if (manifest.poWeb === undefined) continue;\n missing.push(typeof manifest.name === 'string' ? manifest.name : root);\n }\n return missing;\n}\n\n/** The pluginIds with more than one installed copy among the host and these roots, each with its slots in build order. */\nexport function duplicatePluginCopies(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): Map<string, string[]> {\n const roots = new Set(packageRoots.map((root) => path.resolve(root)));\n const slotsById = new Map<string, string[]>();\n for (const plugin of build.plugins) {\n if (!plugin.isHost && !roots.has(path.resolve(plugin.packageDir))) continue;\n const slot = pluginSlot(plugin);\n const slots = slotsById.get(plugin.pluginId) ?? [];\n if (!slots.includes(slot)) slots.push(slot);\n slotsById.set(plugin.pluginId, slots);\n }\n return new Map([...slotsById].filter(([, slots]) => slots.length > 1));\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,cAAc;AACpB,MAAM,uBAAuB;;AAG7B,SAAgB,wBAAwB,cAA0E;CAChH,OAAO,CACL,GAAG,IAAI,I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A,OAAO;AACT;;AAGA,SAAgB,sBACd,OACA,cACuB;CACvB,MAAM,QAAQ,IAAI,IAAI,aAAa,KAAK,SAASA,UAAAA,QAAK,QAAQ,IAAI,CAAC,CAAC;CACpE,MAAM,4BAAY,IAAI,IAAsB;CAC5C,KAAK,MAAM,UAAU,MAAM,SAAS;EAClC,IAAI,CAAC,OAAO,UAAU,CAAC,MAAM,IAAIA,UAAAA,QAAK,QAAQ,OAAO,UAAU,CAAC,GAAG;EACnE,MAAM,OAAOQ,0BAAAA,WAAW,MAAM;EAC9B,MAAM,QAAQ,UAAU,IAAI,OAAO,QAAQ,KAAK,CAAC;EACjD,IAAI,CAAC,MAAM,SAAS,IAAI,GAAG,MAAM,KAAK,IAAI;EAC1C,UAAU,IAAI,OAAO,UAAU,KAAK;CACtC;CACA,OAAO,IAAI,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,QAAQ,GAAG,WAAW,MAAM,SAAS,CAAC,CAAC;AACvE"}
1
+ {"version":3,"file":"index.cjs","names":["createNodePlatform","path","pathExists","BACKGROUND_CONTEXT","createRequire","getOrThrow","snapshotFiles","statSignature","crypto","compareCodeUnits","fsp","scanWebPlugins"],"sources":["../../../../src/builders/web/index.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport crypto from 'node:crypto';\nimport fsp from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport { createNodePlatform } from '@agimon-ai/po-core/nodePlatform';\nimport { BACKGROUND_CONTEXT, type FileSystem, getOrThrow, pathExists } from '@agimon-ai/po-core/platform';\nimport type { GlobalWebBuild, GlobalWebBuildPlugin } from '@agimon-ai/po-core/webCompositions';\n\nimport { snapshotFiles, statSignature } from '../server/packageUrl';\nimport { compareCodeUnits, type DeclaredWebPlugin } from './webPluginManifest';\nimport { scanWebPlugins } from './webPluginScan';\n\nconst WEB_PACKAGE = '@agimon-ai/po-web';\nconst WEB_PACKAGE_ROOT_ENV = 'PO_WEB_PACKAGE_ROOT';\n\n/** The package roots a set of compositions activates, without blocking a live host. */\nexport async function compositionPackageRoots(\n compositions: readonly { packageEntries: readonly string[] }[],\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string[]> {\n const roots = await Promise.all(\n compositions.flatMap((composition) => composition.packageEntries).map((entry) => packageRootOf(entry, files)),\n );\n return [...new Set(roots.filter((root) => root !== undefined))];\n}\n\nexport async function packageRootOf(\n entryPath: string,\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string | undefined> {\n let directory = path.dirname(entryPath);\n for (;;) {\n if (await pathExists(files, path.join(directory, 'package.json'), BACKGROUND_CONTEXT)) return directory;\n const parent = path.dirname(directory);\n if (parent === directory) return undefined;\n directory = parent;\n }\n}\n\nfunction resolveWebPackageRoot(repoRoot: string, environment: NodeJS.ProcessEnv): string | undefined {\n const override = environment[WEB_PACKAGE_ROOT_ENV];\n if (override !== undefined && override !== '') return path.resolve(override);\n try {\n return path.dirname(createRequire(path.join(repoRoot, 'package.json')).resolve(`${WEB_PACKAGE}/package.json`));\n } catch {\n try {\n return path.dirname(createRequire(import.meta.url).resolve(`${WEB_PACKAGE}/package.json`));\n } catch {\n return undefined;\n }\n }\n}\n\n/** The installed po-web host version the global web build would use, or `none` when it is not installed. */\nexport async function webHostVersion(\n poHome: string,\n environment: NodeJS.ProcessEnv = process.env,\n files: FileSystem = createNodePlatform().env(poHome),\n): Promise<string> {\n const webRoot = resolveWebPackageRoot(poHome, environment);\n if (webRoot === undefined) return 'none';\n try {\n const manifest = JSON.parse(\n getOrThrow(await files.readTextFile(path.join(webRoot, 'package.json'), BACKGROUND_CONTEXT)),\n ) as { version?: unknown };\n return typeof manifest.version === 'string' ? manifest.version : 'unversioned';\n } catch (error) {\n return `unreadable:${error instanceof Error ? error.message : String(error)}`;\n }\n}\n\n/** Bumped whenever the build's output layout changes, so an old layout is never reused. */\nconst GLOBAL_BUILD_FORMAT = 'global-web-5';\n/** The record every keyed global build writes last, so a key directory holding it is complete. */\nexport const BUILD_RECORD = 'build.json';\n/** Po packages the host shell bundles, the Po members of the bundle's shared runtimes. */\nconst HOST_SHELL_PACKAGES = [\n '@agimon-ai/po-core',\n '@agimon-ai/po-web-dashboard',\n '@agimon-ai/po-web-components',\n '@agimon-ai/po-web-security',\n];\nconst BUILD_CHILD_SCRIPT = `\nconst [bundleUrl, request] = process.argv.slice(1);\ntry {\n const { bundleCockpitWeb } = await import(bundleUrl);\n const { hostRoot, pluginRoots, outDir } = JSON.parse(request);\n const result = await bundleCockpitWeb({\n hostRoot,\n pluginRoots,\n outDir,\n onNotice: (message) => process.stderr.write(message + '\\\\n'),\n });\n process.stdout.write(JSON.stringify(result));\n} catch (error) {\n process.stderr.write(error instanceof Error ? (error.stack ?? error.message) : String(error));\n process.exitCode = 1;\n}\n`;\n\n/** One build's record: the publishable build, whose plugins carry each copy's package and slot closure. */\nexport type GlobalWebBuildRecord = GlobalWebBuild;\n\nexport interface GlobalWebBuildInput {\n /** Po's global home; builds land in `<home>/build/web/<key>/`. */\n poHome: string;\n files?: FileSystem;\n /** The union of every scope's package roots; roots without a poWeb block are ignored. */\n pluginRoots: readonly string[];\n environment?: NodeJS.ProcessEnv;\n onNotice?: (message: string) => void;\n /** Test seam over the child-process build. */\n runBuild?: (request: { hostRoot: string; pluginRoots: string[]; outDir: string }) => Promise<BuildOutput>;\n /** Test seam over package resolution. */\n resolveWebRoot?: (repoRoot: string, environment: NodeJS.ProcessEnv) => string | undefined;\n}\n\ninterface BuildOutput {\n assetsDir: string;\n pluginsDir: string;\n plugins: GlobalWebBuildPlugin[];\n pluginStyles: Record<string, string>;\n baseStyle: string;\n}\n\nexport type GlobalWebBuildResult =\n | { status: 'built' | 'cached'; build: GlobalWebBuildRecord }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/**\n * The size+mtime signature of every file a plugin package hands the build: its manifest\n * plus the whole top-level folder of the client entry and of each declared export, so an\n * edited import or a rebuilt dist chunk changes the key, not only the entry file.\n */\nasync function packageSignature(packageDir: string, entries: readonly string[], files: FileSystem): Promise<string> {\n try {\n const selected = new Set<string>();\n for (const entry of entries) for (const file of await snapshotFiles(packageDir, entry, files)) selected.add(file);\n return await statSignature(packageDir, [...selected].sort(), files);\n } catch (error) {\n // A declared export that is not built yet must not block the build; it only weakens the key.\n return `unreadable:${error instanceof Error ? error.message : String(error)}`;\n }\n}\n\n/**\n * The content key of a build: the format, the host package when there is one, then every\n * plugin package's file signature. A changed source or dist file or a changed plugin set\n * yields a new key; roots that declare no plugin do not take part.\n */\nexport async function globalBuildKey(\n format: string,\n hostRoot: string | undefined,\n plugins: readonly DeclaredWebPlugin[],\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string> {\n const hash = crypto.createHash('sha256').update(format);\n if (hostRoot !== undefined) {\n hash.update(\n `host:${hostRoot}:${getOrThrow(await files.readTextFile(path.join(hostRoot, 'package.json'), BACKGROUND_CONTEXT))}`,\n );\n hash.update(\n `\\0host-files:${await packageSignature(hostRoot, [path.join(hostRoot, 'src', 'web', 'index.html')], files)}`,\n );\n // The shell bundles these from the host's own node_modules. A checkout rebuilds them in place without touching\n // the host manifest, so their built files key the build too; a missing one only weakens the key.\n for (const name of HOST_SHELL_PACKAGES) {\n const packageDir = path.join(hostRoot, 'node_modules', ...name.split('/'));\n hash.update(`\\0shell:${name}\\0${await packageSignature(packageDir, [path.join(packageDir, 'dist')], files)}`);\n }\n }\n const entries = new Map<string, string[]>();\n for (const plugin of [...plugins].sort((a, b) => compareCodeUnits(a.pluginId, b.pluginId))) {\n hash.update(`\\0${plugin.pluginId}:${plugin.packageDir}:${plugin.client.entry}`);\n const list = entries.get(plugin.packageDir) ?? [];\n list.push(path.join(plugin.packageDir, plugin.client.entry));\n entries.set(plugin.packageDir, list);\n }\n for (const packageDir of [...entries.keys()].sort())\n hash.update(`\\0${packageDir}\\0${await packageSignature(packageDir, entries.get(packageDir) ?? [], files)}`);\n return hash.digest('hex').slice(0, 32);\n}\n\nfunction bundleModuleUrl(): string {\n const extension = import.meta.url.endsWith('.ts') ? 'ts' : 'mjs';\n return new URL(`./bundle.${extension}`, import.meta.url).href;\n}\n\n/** Runs Vite in a child process so its module graph and caches never stay in the server heap. */\nfunction runBuildProcess(\n request: { hostRoot: string; pluginRoots: string[]; outDir: string },\n environment: NodeJS.ProcessEnv,\n onNotice: (message: string) => void,\n): Promise<BuildOutput> {\n const args = [\n ...process.execArgv,\n '--input-type=module',\n '--eval',\n BUILD_CHILD_SCRIPT,\n bundleModuleUrl(),\n JSON.stringify(request),\n ];\n return new Promise((resolve, reject) => {\n execFile(\n process.execPath,\n args,\n { cwd: request.hostRoot, env: environment, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 },\n (error, stdout, stderr) => {\n if (error) {\n reject(new Error(`${stderr || stdout}`.trim() || `Web build exited with code ${String(error.code ?? 1)}`));\n return;\n }\n for (const line of stderr.split('\\n')) if (line.trim()) onNotice(line.trim());\n resolve(JSON.parse(stdout) as BuildOutput);\n },\n );\n });\n}\n\n/** A key directory's parsed build record, or undefined when the build is not there (yet). */\nexport async function readBuildJson<T>(\n directory: string,\n files: FileSystem = createNodePlatform().env(directory),\n): Promise<T | undefined> {\n try {\n return JSON.parse(\n getOrThrow(await files.readTextFile(path.join(directory, BUILD_RECORD), BACKGROUND_CONTEXT)),\n ) as T;\n } catch (error) {\n if ((error as { code?: string }).code === 'not_found') return undefined;\n throw error;\n }\n}\n\nasync function readBuildRecord(directory: string, files?: FileSystem): Promise<GlobalWebBuildRecord | undefined> {\n const record = await readBuildJson<Omit<GlobalWebBuildRecord, 'webDirectory' | 'pluginsDirectory'>>(directory, files);\n if (\n record === undefined ||\n !Array.isArray(record.plugins) ||\n record.plugins.some((plugin) => typeof plugin.slot !== 'string')\n )\n return undefined;\n return { ...record, webDirectory: path.join(directory, 'web'), pluginsDirectory: path.join(directory, 'plugins') };\n}\n\nfunction webBuildsRoot(poHome: string): string {\n return path.join(poHome, 'build', 'web');\n}\n\n/** The complete global web build of one key, or undefined when it is not there. Never builds. */\nexport async function readGlobalWebBuildRecord(\n poHome: string,\n key: string,\n files?: FileSystem,\n): Promise<GlobalWebBuildRecord | undefined> {\n return readBuildRecord(path.join(webBuildsRoot(poHome), key), files);\n}\n\n/**\n * The key of the most recently written complete global web build, for a server that starts\n * before sync ever wrote a pointer. Temporary build folders start with a dot and are skipped.\n */\nexport async function newestGlobalWebBuildKey(\n poHome: string,\n files: FileSystem = createNodePlatform().env(poHome),\n): Promise<string | undefined> {\n const root = webBuildsRoot(poHome);\n const listed = await files.listDir(root, BACKGROUND_CONTEXT);\n if (!listed.ok && listed.error.code === 'not_found') return undefined;\n const records = await Promise.all(\n getOrThrow(listed)\n .filter((entry) => entry.kind === 'directory' && !entry.name.startsWith('.'))\n .map(async (entry) => {\n const info = await files.fileInfo(path.join(root, entry.name, BUILD_RECORD), BACKGROUND_CONTEXT);\n if (!info.ok && info.error.code === 'not_found') return undefined;\n return { name: entry.name, modified: getOrThrow(info).mtimeMs };\n }),\n );\n return records.filter((entry) => entry !== undefined).sort((left, right) => right.modified - left.modified)[0]?.name;\n}\n\n/**\n * Builds into a temporary sibling of `directory`, writes the build record last, and renames\n * the result into place, so a key directory is always complete. Losing the rename to another\n * process that finished the same key is fine: its bytes are identical.\n */\nexport async function buildKeyDirectory(\n buildsRoot: string,\n key: string,\n directory: string,\n build: (temporary: string) => Promise<object>,\n): Promise<void> {\n await fsp.mkdir(buildsRoot, { recursive: true });\n const temporary = await fsp.mkdtemp(path.join(buildsRoot, `.${key}-`));\n try {\n const record = await build(temporary);\n await fsp.writeFile(path.join(temporary, BUILD_RECORD), `${JSON.stringify(record, null, 2)}\\n`);\n try {\n await fsp.rename(temporary, directory);\n } catch (error) {\n if ((await readBuildJson(directory)) === undefined) throw error;\n }\n } finally {\n await fsp.rm(temporary, { recursive: true, force: true });\n }\n}\n\nconst pendingBuilds = new Map<string, Promise<unknown>>();\n\n/** Joins a build of the same key that is already running in this process instead of starting another. */\nexport async function singleFlightBuild<T>(key: string, run: () => Promise<T>): Promise<T> {\n const pending = pendingBuilds.get(key);\n if (pending !== undefined) return pending as Promise<T>;\n const started = run();\n pendingBuilds.set(key, started);\n try {\n return await started;\n } finally {\n pendingBuilds.delete(key);\n }\n}\n\n/**\n * Ensures the one global web build for the given plugin roots exists and returns it.\n *\n * The output is `<home>/build/web/<key>/`, built in a temporary directory and renamed into\n * place, so a key directory is always complete; an existing key builds nothing. Each\n * plugin shares one content-hashed Tailwind stylesheet with the shell and fallback template.\n */\ntype ResolvedGlobalWebBuild =\n | { status: 'resolved'; webRoot: string; pluginRoots: string[]; key: string; buildsRoot: string; directory: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/** The build key for these plugin roots and where its build lives, without building anything. */\nasync function resolveGlobalWebBuild(input: GlobalWebBuildInput): Promise<ResolvedGlobalWebBuild> {\n const environment = input.environment ?? process.env;\n const webRoot = (input.resolveWebRoot ?? resolveWebPackageRoot)(input.poHome, environment);\n if (\n webRoot === undefined ||\n !(await pathExists(\n input.files ?? createNodePlatform().env(input.poHome),\n path.join(webRoot, 'package.json'),\n BACKGROUND_CONTEXT,\n ))\n )\n return { status: 'skipped', reason: `${WEB_PACKAGE} is not installed; no web composition is published` };\n const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();\n let key: string;\n try {\n key = await globalBuildKey(\n GLOBAL_BUILD_FORMAT,\n webRoot,\n await scanWebPlugins(webRoot, pluginRoots, input.onNotice ?? ((): void => {})),\n input.files,\n );\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n const buildsRoot = path.join(input.poHome, 'build', 'web');\n return { status: 'resolved', webRoot, pluginRoots, key, buildsRoot, directory: path.join(buildsRoot, key) };\n}\n\n/** Whether the global build for these plugin roots exists, for a check that must not build. */\nexport async function readGlobalWebBuildStatus(\n input: GlobalWebBuildInput,\n): Promise<\n | { status: 'current' | 'missing'; key: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string }\n> {\n const resolved = await resolveGlobalWebBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n return {\n status: (await readBuildRecord(resolved.directory, input.files)) === undefined ? 'missing' : 'current',\n key: resolved.key,\n };\n}\n\nexport async function ensureGlobalWebBuild(input: GlobalWebBuildInput): Promise<GlobalWebBuildResult> {\n const environment = input.environment ?? process.env;\n const notice = input.onNotice ?? ((): void => {});\n const resolved = await resolveGlobalWebBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n const { webRoot, pluginRoots, key, buildsRoot, directory } = resolved;\n const existing = await readBuildRecord(directory, input.files);\n if (existing !== undefined) return { status: 'cached', build: existing };\n return singleFlightBuild(key, async (): Promise<GlobalWebBuildResult> => {\n try {\n await buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {\n const request = { hostRoot: webRoot, pluginRoots, outDir: temporary };\n const output = await (input.runBuild ?? ((value) => runBuildProcess(value, environment, notice)))(request);\n return {\n key,\n plugins: output.plugins,\n pluginStyles: output.pluginStyles,\n baseStyle: output.baseStyle,\n };\n });\n const build = await readBuildRecord(directory, input.files);\n if (build === undefined) throw new Error(`The web build '${key}' was not recorded.`);\n return { status: 'built', build };\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n });\n}\n\ntype MountPluginRecord = { pluginId: string; packageDir: string; isHost: boolean };\n\n/** The plugin copies a mount runs, host plugins plus its own roots', at most one per pluginId (first wins). */\nfunction mountPluginCopies<T extends MountPluginRecord>(\n build: { plugins: readonly T[] },\n packageRoots: readonly string[],\n): T[] {\n const roots = new Set(packageRoots.map((root) => path.resolve(root)));\n const seen = new Set<string>();\n return build.plugins.filter((plugin) => {\n if (!plugin.isHost && !roots.has(path.resolve(plugin.packageDir))) return false;\n if (seen.has(plugin.pluginId)) return false;\n seen.add(plugin.pluginId);\n return true;\n });\n}\n\n/** The `pluginId` values a mount runs: the host's plugins plus those of its own package roots, deduplicated. */\nexport function mountWebPluginIds(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): string[] {\n return mountPluginCopies(build, packageRoots).map((plugin) => plugin.pluginId);\n}\n\n/** The slots a mount runs: one copy per pluginId, the first in build order. */\nexport function mountWebPluginSlots(\n build: { plugins: readonly (MountPluginRecord & { slot: string })[] },\n packageRoots: readonly string[],\n): string[] {\n return mountPluginCopies(build, packageRoots).map((plugin) => plugin.slot);\n}\n\n/**\n * The package roots among `packageRoots` that declare a web plugin the build has no slot for:\n * a package that was not synced yet, or was left out of the build. Their names, else their roots.\n */\nexport async function unslottedWebPackages(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string[]> {\n const slotted = new Set(build.plugins.map((plugin) => path.resolve(plugin.packageDir)));\n const missing: string[] = [];\n for (const root of new Set(packageRoots.map((entry) => path.resolve(entry)))) {\n if (slotted.has(root)) continue;\n let manifest: { name?: unknown; poWeb?: unknown };\n try {\n manifest = JSON.parse(\n getOrThrow(await files.readTextFile(path.join(root, 'package.json'), BACKGROUND_CONTEXT)),\n ) as typeof manifest;\n } catch {\n // Unreadable manifests are reported by the build's own scan, not as a missing slot.\n continue;\n }\n if (manifest.poWeb === undefined) continue;\n missing.push(typeof manifest.name === 'string' ? manifest.name : root);\n }\n return missing;\n}\n\n/** The pluginIds with more than one installed copy among the host and these roots, each with its slots in build order. */\nexport function duplicatePluginCopies(\n build: { plugins: readonly (MountPluginRecord & { slot: string })[] },\n packageRoots: readonly string[],\n): Map<string, string[]> {\n const roots = new Set(packageRoots.map((root) => path.resolve(root)));\n const slotsById = new Map<string, string[]>();\n for (const plugin of build.plugins) {\n if (!plugin.isHost && !roots.has(path.resolve(plugin.packageDir))) continue;\n const slot = plugin.slot;\n const slots = slotsById.get(plugin.pluginId) ?? [];\n if (!slots.includes(slot)) slots.push(slot);\n slotsById.set(plugin.pluginId, slots);\n }\n return new Map([...slotsById].filter(([, slots]) => slots.length > 1));\n}\n"],"mappings":";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C;AACvE"}
@@ -1,14 +1,14 @@
1
1
  import { DeclaredWebPlugin } from "./webPluginManifest.mjs";
2
+ import { FileSystem } from "@agimon-ai/po-core/platform";
2
3
  import { GlobalWebBuild, GlobalWebBuildPlugin } from "@agimon-ai/po-core/webCompositions";
3
4
  //#region src/builders/web/index.d.ts
4
- /** The package roots a set of compositions activates, each once. */
5
+ /** The package roots a set of compositions activates, without blocking a live host. */
5
6
  export declare function compositionPackageRoots(compositions: readonly {
6
7
  packageEntries: readonly string[];
7
- }[]): string[];
8
- /** Walks from a resolved module path up to the directory owning its package.json. */
9
- export declare function packageRootOf(entryPath: string): string | undefined;
8
+ }[], files?: FileSystem): Promise<string[]>;
9
+ export declare function packageRootOf(entryPath: string, files?: FileSystem): Promise<string | undefined>;
10
10
  /** The installed po-web host version the global web build would use, or `none` when it is not installed. */
11
- export declare function webHostVersion(poHome: string, environment?: NodeJS.ProcessEnv): string;
11
+ export declare function webHostVersion(poHome: string, environment?: NodeJS.ProcessEnv, files?: FileSystem): Promise<string>;
12
12
  /** The record every keyed global build writes last, so a key directory holding it is complete. */
13
13
  export declare const BUILD_RECORD = "build.json";
14
14
  /** One build's record: the publishable build, whose plugins carry each copy's package and slot closure. */
@@ -16,6 +16,7 @@ export type GlobalWebBuildRecord = GlobalWebBuild;
16
16
  export interface GlobalWebBuildInput {
17
17
  /** Po's global home; builds land in `<home>/build/web/<key>/`. */
18
18
  poHome: string;
19
+ files?: FileSystem;
19
20
  /** The union of every scope's package roots; roots without a poWeb block are ignored. */
20
21
  pluginRoots: readonly string[];
21
22
  environment?: NodeJS.ProcessEnv;
@@ -51,16 +52,16 @@ export type GlobalWebBuildResult = {
51
52
  * plugin package's file signature. A changed source or dist file or a changed plugin set
52
53
  * yields a new key; roots that declare no plugin do not take part.
53
54
  */
54
- export declare function globalBuildKey(format: string, hostRoot: string | undefined, plugins: readonly DeclaredWebPlugin[]): string;
55
+ export declare function globalBuildKey(format: string, hostRoot: string | undefined, plugins: readonly DeclaredWebPlugin[], files?: FileSystem): Promise<string>;
55
56
  /** A key directory's parsed build record, or undefined when the build is not there (yet). */
56
- export declare function readBuildJson<T>(directory: string): T | undefined;
57
+ export declare function readBuildJson<T>(directory: string, files?: FileSystem): Promise<T | undefined>;
57
58
  /** The complete global web build of one key, or undefined when it is not there. Never builds. */
58
- export declare function readGlobalWebBuildRecord(poHome: string, key: string): GlobalWebBuildRecord | undefined;
59
+ export declare function readGlobalWebBuildRecord(poHome: string, key: string, files?: FileSystem): Promise<GlobalWebBuildRecord | undefined>;
59
60
  /**
60
61
  * The key of the most recently written complete global web build, for a server that starts
61
62
  * before sync ever wrote a pointer. Temporary build folders start with a dot and are skipped.
62
63
  */
63
- export declare function newestGlobalWebBuildKey(poHome: string): string | undefined;
64
+ export declare function newestGlobalWebBuildKey(poHome: string, files?: FileSystem): Promise<string | undefined>;
64
65
  /**
65
66
  * Builds into a temporary sibling of `directory`, writes the build record last, and renames
66
67
  * the result into place, so a key directory is always complete. Losing the rename to another
@@ -70,7 +71,7 @@ export declare function buildKeyDirectory(buildsRoot: string, key: string, direc
70
71
  /** Joins a build of the same key that is already running in this process instead of starting another. */
71
72
  export declare function singleFlightBuild<T>(key: string, run: () => Promise<T>): Promise<T>;
72
73
  /** Whether the global build for these plugin roots exists, for a check that must not build. */
73
- export declare function readGlobalWebBuildStatus(input: GlobalWebBuildInput): {
74
+ export declare function readGlobalWebBuildStatus(input: GlobalWebBuildInput): Promise<{
74
75
  status: 'current' | 'missing';
75
76
  key: string;
76
77
  } | {
@@ -79,7 +80,7 @@ export declare function readGlobalWebBuildStatus(input: GlobalWebBuildInput): {
79
80
  } | {
80
81
  status: 'failed';
81
82
  reason: string;
82
- };
83
+ }>;
83
84
  export declare function ensureGlobalWebBuild(input: GlobalWebBuildInput): Promise<GlobalWebBuildResult>;
84
85
  type MountPluginRecord = {
85
86
  pluginId: string;
@@ -92,7 +93,9 @@ export declare function mountWebPluginIds(build: {
92
93
  }, packageRoots: readonly string[]): string[];
93
94
  /** The slots a mount runs: one copy per pluginId, the first in build order. */
94
95
  export declare function mountWebPluginSlots(build: {
95
- plugins: readonly MountPluginRecord[];
96
+ plugins: readonly (MountPluginRecord & {
97
+ slot: string;
98
+ })[];
96
99
  }, packageRoots: readonly string[]): string[];
97
100
  /**
98
101
  * The package roots among `packageRoots` that declare a web plugin the build has no slot for:
@@ -100,10 +103,12 @@ export declare function mountWebPluginSlots(build: {
100
103
  */
101
104
  export declare function unslottedWebPackages(build: {
102
105
  plugins: readonly MountPluginRecord[];
103
- }, packageRoots: readonly string[]): string[];
106
+ }, packageRoots: readonly string[], files?: FileSystem): Promise<string[]>;
104
107
  /** The pluginIds with more than one installed copy among the host and these roots, each with its slots in build order. */
105
108
  export declare function duplicatePluginCopies(build: {
106
- plugins: readonly MountPluginRecord[];
109
+ plugins: readonly (MountPluginRecord & {
110
+ slot: string;
111
+ })[];
107
112
  }, packageRoots: readonly string[]): Map<string, string[]>;
108
113
  //#endregion
109
114
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/builders/web/index.ts"],"mappings":";;;;wBAgBgB,wBAAwB;EAAyB;;;wBAYjD,cAAc;;wBAyBd,eAAe,gBAAgB,cAAa,OAAO;;qBActD;;YAoBD,uBAAuB;iBAElB;;EAEf;;EAEA;EACA,cAAc,OAAO;EACrB,YAAY;;EAEZ,YAAY;IAAW;IAAkB;IAAuB;QAAqB,QAAQ;;EAE7F,kBAAkB,kBAAkB,aAAa,OAAO;;UAGhD;EACR;EACA;EACA,SAAS;EACT,cAAc;EACd;;YAGU;EACN;EAA4B,OAAO;;EACnC;EAAmB;;EACnB;EAAkB;;;;;;;wBAuBR,eACd,gBACA,8BACA,kBAAkB;;wBAsDJ,cAAc,GAAG,oBAAoB;;wBAoBrC,yBAAyB,gBAAgB,cAAc;;;;;wBAQvD,wBAAwB;;;;;;wBAiBlB,kBACpB,oBACA,aACA,mBACA,QAAQ,sBAAsB,kBAC7B;;wBAmBmB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A6B3E;EAAsB;EAAkB;EAAoB;;;wBAkBjD,kBACd;EAAS,kBAAkB;GAC3B;;wBAMc,oBACd;EAAS,mBAAmB;IAAsB;;GAClD;;;;;wBASoB,qBACpB;EAAS,kBAAkB;GAC3B,iCACA,QAAO,aACN;;wBAqBa,sBACd;EAAS,mBAAmB;IAAsB;;GAClD,kCACC"}