@agimon-ai/po 0.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (560) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +755 -0
  3. package/assets/banner.png +0 -0
  4. package/assets/banner.svg +25 -0
  5. package/assets/favicon.svg +15 -0
  6. package/assets/logo-light.png +0 -0
  7. package/assets/logo-light.svg +25 -0
  8. package/assets/logo.png +0 -0
  9. package/assets/logo.svg +25 -0
  10. package/assets/mascot.png +0 -0
  11. package/assets/mascot.svg +25 -0
  12. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  13. package/dist/antigravity.cjs +5 -0
  14. package/dist/antigravity.d.mts +2 -0
  15. package/dist/antigravity.mjs +2 -0
  16. package/dist/apiContracts.cjs +11 -0
  17. package/dist/apiContracts.cjs.map +1 -0
  18. package/dist/apiContracts.d.mts +52 -0
  19. package/dist/apiContracts.d.mts.map +1 -0
  20. package/dist/apiContracts.mjs +7 -0
  21. package/dist/apiContracts.mjs.map +1 -0
  22. package/dist/baseCommand.cjs +3 -0
  23. package/dist/baseCommand.d.mts +2 -0
  24. package/dist/baseCommand.mjs +2 -0
  25. package/dist/bin/cli.cjs +24 -0
  26. package/dist/bin/cli.cjs.map +1 -0
  27. package/dist/bin/cli.d.mts +1 -0
  28. package/dist/bin/cli.mjs +25 -0
  29. package/dist/bin/cli.mjs.map +1 -0
  30. package/dist/bin/doomRunner.cjs +33 -0
  31. package/dist/bin/doomRunner.cjs.map +1 -0
  32. package/dist/bin/doomRunner.d.mts +4 -0
  33. package/dist/bin/doomRunner.d.mts.map +1 -0
  34. package/dist/bin/doomRunner.mjs +32 -0
  35. package/dist/bin/doomRunner.mjs.map +1 -0
  36. package/dist/bin/serve.cjs +30 -0
  37. package/dist/bin/serve.cjs.map +1 -0
  38. package/dist/bin/serve.d.mts +1 -0
  39. package/dist/bin/serve.mjs +31 -0
  40. package/dist/bin/serve.mjs.map +1 -0
  41. package/dist/builders/cli/extensionAssembler/index.cjs +342 -0
  42. package/dist/builders/cli/extensionAssembler/index.cjs.map +1 -0
  43. package/dist/builders/cli/extensionAssembler/index.d.mts +85 -0
  44. package/dist/builders/cli/extensionAssembler/index.d.mts.map +1 -0
  45. package/dist/builders/cli/extensionAssembler/index.mjs +335 -0
  46. package/dist/builders/cli/extensionAssembler/index.mjs.map +1 -0
  47. package/dist/catalog/index.json +430 -0
  48. package/dist/cli.cjs +28 -0
  49. package/dist/cli.d.mts +11 -0
  50. package/dist/cli.mjs +11 -0
  51. package/dist/cliApp.cjs +6 -0
  52. package/dist/cliApp.d.mts +2 -0
  53. package/dist/cliApp.mjs +2 -0
  54. package/dist/codex.cjs +8 -0
  55. package/dist/codex.d.mts +2 -0
  56. package/dist/codex.mjs +2 -0
  57. package/dist/commands.cjs +18 -0
  58. package/dist/commands.d.mts +9 -0
  59. package/dist/commands.mjs +9 -0
  60. package/dist/compatibility.cjs +27 -0
  61. package/dist/compatibility.d.mts +6 -0
  62. package/dist/compatibility.mjs +6 -0
  63. package/dist/compatibilityCommand.cjs +4 -0
  64. package/dist/compatibilityCommand.d.mts +2 -0
  65. package/dist/compatibilityCommand.mjs +2 -0
  66. package/dist/compatibilityContext.cjs +3 -0
  67. package/dist/compatibilityContext.d.mts +2 -0
  68. package/dist/compatibilityContext.mjs +2 -0
  69. package/dist/compatibilityOptions.cjs +5 -0
  70. package/dist/compatibilityOptions.d.mts +2 -0
  71. package/dist/compatibilityOptions.mjs +2 -0
  72. package/dist/config.cjs +163 -0
  73. package/dist/config.d.mts +7 -0
  74. package/dist/config.mjs +7 -0
  75. package/dist/doctorCommand.cjs +5 -0
  76. package/dist/doctorCommand.d.mts +2 -0
  77. package/dist/doctorCommand.mjs +2 -0
  78. package/dist/emitMcpCommand.cjs +4 -0
  79. package/dist/emitMcpCommand.d.mts +2 -0
  80. package/dist/emitMcpCommand.mjs +2 -0
  81. package/dist/explainCommand.cjs +5 -0
  82. package/dist/explainCommand.d.mts +2 -0
  83. package/dist/explainCommand.mjs +2 -0
  84. package/dist/extensions/server.cjs +39 -0
  85. package/dist/extensions/server.cjs.map +1 -0
  86. package/dist/extensions/server.d.mts +5 -0
  87. package/dist/extensions/server.d.mts.map +1 -0
  88. package/dist/extensions/server.mjs +34 -0
  89. package/dist/extensions/server.mjs.map +1 -0
  90. package/dist/harnessContext.cjs +5 -0
  91. package/dist/harnessContext.d.mts +2 -0
  92. package/dist/harnessContext.mjs +2 -0
  93. package/dist/harnessState.cjs +19 -0
  94. package/dist/harnessState.d.mts +2 -0
  95. package/dist/harnessState.mjs +2 -0
  96. package/dist/help.cjs +12 -0
  97. package/dist/help.d.mts +6 -0
  98. package/dist/help.mjs +6 -0
  99. package/dist/index.cjs +306 -0
  100. package/dist/index.d.mts +40 -0
  101. package/dist/index.mjs +37 -0
  102. package/dist/initCommand.cjs +4 -0
  103. package/dist/initCommand.d.mts +2 -0
  104. package/dist/initCommand.mjs +2 -0
  105. package/dist/matrixOptions.cjs +28 -0
  106. package/dist/matrixOptions.d.mts +2 -0
  107. package/dist/matrixOptions.mjs +2 -0
  108. package/dist/matrixSwitcher.cjs +11 -0
  109. package/dist/matrixSwitcher.d.mts +3 -0
  110. package/dist/matrixSwitcher.mjs +3 -0
  111. package/dist/mcpFilter.cjs +9 -0
  112. package/dist/mcpFilter.d.mts +1 -0
  113. package/dist/mcpFilter.mjs +2 -0
  114. package/dist/options.cjs +3 -0
  115. package/dist/options.d.mts +2 -0
  116. package/dist/options.mjs +2 -0
  117. package/dist/process.cjs +12 -0
  118. package/dist/process.d.mts +2 -0
  119. package/dist/process.mjs +2 -0
  120. package/dist/projectTrust.cjs +6 -0
  121. package/dist/projectTrust.d.mts +2 -0
  122. package/dist/projectTrust.mjs +2 -0
  123. package/dist/repository.cjs +5 -0
  124. package/dist/repository.d.mts +2 -0
  125. package/dist/repository.mjs +2 -0
  126. package/dist/resourceCollector.cjs +9 -0
  127. package/dist/resourceCollector.d.mts +1 -0
  128. package/dist/resourceCollector.mjs +2 -0
  129. package/dist/router.cjs +6 -0
  130. package/dist/router.d.mts +2 -0
  131. package/dist/router.mjs +2 -0
  132. package/dist/services.cjs +97 -0
  133. package/dist/services.d.mts +12 -0
  134. package/dist/services.mjs +12 -0
  135. package/dist/shared.cjs +18 -0
  136. package/dist/shared.d.mts +2 -0
  137. package/dist/shared.mjs +2 -0
  138. package/dist/src/bin/agentDirectory.cjs +27 -0
  139. package/dist/src/bin/agentDirectory.cjs.map +1 -0
  140. package/dist/src/bin/agentDirectory.mjs +26 -0
  141. package/dist/src/bin/agentDirectory.mjs.map +1 -0
  142. package/dist/src/builders/apiContractExport/index.cjs +126 -0
  143. package/dist/src/builders/apiContractExport/index.cjs.map +1 -0
  144. package/dist/src/builders/apiContractExport/index.mjs +123 -0
  145. package/dist/src/builders/apiContractExport/index.mjs.map +1 -0
  146. package/dist/src/builders/cli/entryResolution.cjs +39 -0
  147. package/dist/src/builders/cli/entryResolution.cjs.map +1 -0
  148. package/dist/src/builders/cli/entryResolution.mjs +35 -0
  149. package/dist/src/builders/cli/entryResolution.mjs.map +1 -0
  150. package/dist/src/builders/cli/harnessContext.cjs +175 -0
  151. package/dist/src/builders/cli/harnessContext.cjs.map +1 -0
  152. package/dist/src/builders/cli/harnessContext.d.mts +48 -0
  153. package/dist/src/builders/cli/harnessContext.d.mts.map +1 -0
  154. package/dist/src/builders/cli/harnessContext.mjs +167 -0
  155. package/dist/src/builders/cli/harnessContext.mjs.map +1 -0
  156. package/dist/src/builders/cli/sessionComposition.cjs +27 -0
  157. package/dist/src/builders/cli/sessionComposition.cjs.map +1 -0
  158. package/dist/src/builders/cli/sessionComposition.mjs +26 -0
  159. package/dist/src/builders/cli/sessionComposition.mjs.map +1 -0
  160. package/dist/src/builders/hooks/index.cjs +238 -0
  161. package/dist/src/builders/hooks/index.cjs.map +1 -0
  162. package/dist/src/builders/hooks/index.mjs +231 -0
  163. package/dist/src/builders/hooks/index.mjs.map +1 -0
  164. package/dist/src/builders/native/index.cjs +176 -0
  165. package/dist/src/builders/native/index.cjs.map +1 -0
  166. package/dist/src/builders/native/index.d.mts +36 -0
  167. package/dist/src/builders/native/index.d.mts.map +1 -0
  168. package/dist/src/builders/native/index.mjs +170 -0
  169. package/dist/src/builders/native/index.mjs.map +1 -0
  170. package/dist/src/builders/server/backgroundSync.cjs +333 -0
  171. package/dist/src/builders/server/backgroundSync.cjs.map +1 -0
  172. package/dist/src/builders/server/backgroundSync.mjs +320 -0
  173. package/dist/src/builders/server/backgroundSync.mjs.map +1 -0
  174. package/dist/src/builders/server/computerUseBinding.cjs +273 -0
  175. package/dist/src/builders/server/computerUseBinding.cjs.map +1 -0
  176. package/dist/src/builders/server/computerUseBinding.mjs +269 -0
  177. package/dist/src/builders/server/computerUseBinding.mjs.map +1 -0
  178. package/dist/src/builders/server/computerUseRecordings.cjs +188 -0
  179. package/dist/src/builders/server/computerUseRecordings.cjs.map +1 -0
  180. package/dist/src/builders/server/computerUseRecordings.mjs +184 -0
  181. package/dist/src/builders/server/computerUseRecordings.mjs.map +1 -0
  182. package/dist/src/builders/server/defaultWorkspace.cjs +38 -0
  183. package/dist/src/builders/server/defaultWorkspace.cjs.map +1 -0
  184. package/dist/src/builders/server/defaultWorkspace.mjs +35 -0
  185. package/dist/src/builders/server/defaultWorkspace.mjs.map +1 -0
  186. package/dist/src/builders/server/idleRestart.cjs +149 -0
  187. package/dist/src/builders/server/idleRestart.cjs.map +1 -0
  188. package/dist/src/builders/server/idleRestart.mjs +136 -0
  189. package/dist/src/builders/server/idleRestart.mjs.map +1 -0
  190. package/dist/src/builders/server/index.cjs +63 -0
  191. package/dist/src/builders/server/index.cjs.map +1 -0
  192. package/dist/src/builders/server/index.mjs +60 -0
  193. package/dist/src/builders/server/index.mjs.map +1 -0
  194. package/dist/src/builders/server/logSink.cjs +57 -0
  195. package/dist/src/builders/server/logSink.cjs.map +1 -0
  196. package/dist/src/builders/server/logSink.mjs +57 -0
  197. package/dist/src/builders/server/logSink.mjs.map +1 -0
  198. package/dist/src/builders/server/mcpApp.cjs +152 -0
  199. package/dist/src/builders/server/mcpApp.cjs.map +1 -0
  200. package/dist/src/builders/server/mcpApp.d.mts +18 -0
  201. package/dist/src/builders/server/mcpApp.d.mts.map +1 -0
  202. package/dist/src/builders/server/mcpApp.mjs +147 -0
  203. package/dist/src/builders/server/mcpApp.mjs.map +1 -0
  204. package/dist/src/builders/server/mcpAppBuild.cjs +111 -0
  205. package/dist/src/builders/server/mcpAppBuild.cjs.map +1 -0
  206. package/dist/src/builders/server/mcpAppBuild.d.mts +24 -0
  207. package/dist/src/builders/server/mcpAppBuild.d.mts.map +1 -0
  208. package/dist/src/builders/server/mcpAppBuild.mjs +105 -0
  209. package/dist/src/builders/server/mcpAppBuild.mjs.map +1 -0
  210. package/dist/src/builders/server/mcpBundle.cjs +87 -0
  211. package/dist/src/builders/server/mcpBundle.cjs.map +1 -0
  212. package/dist/src/builders/server/mcpBundle.d.mts +23 -0
  213. package/dist/src/builders/server/mcpBundle.d.mts.map +1 -0
  214. package/dist/src/builders/server/mcpBundle.mjs +84 -0
  215. package/dist/src/builders/server/mcpBundle.mjs.map +1 -0
  216. package/dist/src/builders/server/packageReloadCheck.cjs +62 -0
  217. package/dist/src/builders/server/packageReloadCheck.cjs.map +1 -0
  218. package/dist/src/builders/server/packageReloadCheck.mjs +61 -0
  219. package/dist/src/builders/server/packageReloadCheck.mjs.map +1 -0
  220. package/dist/src/builders/server/packageUrl.cjs +210 -0
  221. package/dist/src/builders/server/packageUrl.cjs.map +1 -0
  222. package/dist/src/builders/server/packageUrl.mjs +203 -0
  223. package/dist/src/builders/server/packageUrl.mjs.map +1 -0
  224. package/dist/src/builders/server/runtime.cjs +1428 -0
  225. package/dist/src/builders/server/runtime.cjs.map +1 -0
  226. package/dist/src/builders/server/runtime.mjs +1420 -0
  227. package/dist/src/builders/server/runtime.mjs.map +1 -0
  228. package/dist/src/builders/server/runtimeResources.cjs +72 -0
  229. package/dist/src/builders/server/runtimeResources.cjs.map +1 -0
  230. package/dist/src/builders/server/runtimeResources.mjs +71 -0
  231. package/dist/src/builders/server/runtimeResources.mjs.map +1 -0
  232. package/dist/src/builders/server/selectionStatus.cjs +12 -0
  233. package/dist/src/builders/server/selectionStatus.cjs.map +1 -0
  234. package/dist/src/builders/server/selectionStatus.mjs +12 -0
  235. package/dist/src/builders/server/selectionStatus.mjs.map +1 -0
  236. package/dist/src/builders/server/sessionArguments.cjs +63 -0
  237. package/dist/src/builders/server/sessionArguments.cjs.map +1 -0
  238. package/dist/src/builders/server/sessionArguments.mjs +62 -0
  239. package/dist/src/builders/server/sessionArguments.mjs.map +1 -0
  240. package/dist/src/builders/server/shutdown.cjs +16 -0
  241. package/dist/src/builders/server/shutdown.cjs.map +1 -0
  242. package/dist/src/builders/server/shutdown.mjs +16 -0
  243. package/dist/src/builders/server/shutdown.mjs.map +1 -0
  244. package/dist/src/builders/server/webTemplateDecision.cjs +34 -0
  245. package/dist/src/builders/server/webTemplateDecision.cjs.map +1 -0
  246. package/dist/src/builders/server/webTemplateDecision.mjs +32 -0
  247. package/dist/src/builders/server/webTemplateDecision.mjs.map +1 -0
  248. package/dist/src/builders/server/workspaceCheckout.cjs +31 -0
  249. package/dist/src/builders/server/workspaceCheckout.cjs.map +1 -0
  250. package/dist/src/builders/server/workspaceCheckout.mjs +29 -0
  251. package/dist/src/builders/server/workspaceCheckout.mjs.map +1 -0
  252. package/dist/src/builders/web/bundle.cjs +225 -0
  253. package/dist/src/builders/web/bundle.cjs.map +1 -0
  254. package/dist/src/builders/web/bundle.d.mts +65 -0
  255. package/dist/src/builders/web/bundle.d.mts.map +1 -0
  256. package/dist/src/builders/web/bundle.mjs +221 -0
  257. package/dist/src/builders/web/bundle.mjs.map +1 -0
  258. package/dist/src/builders/web/bundleAssetPolicy.cjs +96 -0
  259. package/dist/src/builders/web/bundleAssetPolicy.cjs.map +1 -0
  260. package/dist/src/builders/web/bundleAssetPolicy.d.mts +22 -0
  261. package/dist/src/builders/web/bundleAssetPolicy.d.mts.map +1 -0
  262. package/dist/src/builders/web/bundleAssetPolicy.mjs +95 -0
  263. package/dist/src/builders/web/bundleAssetPolicy.mjs.map +1 -0
  264. package/dist/src/builders/web/index.cjs +361 -0
  265. package/dist/src/builders/web/index.cjs.map +1 -0
  266. package/dist/src/builders/web/index.d.mts +109 -0
  267. package/dist/src/builders/web/index.d.mts.map +1 -0
  268. package/dist/src/builders/web/index.mjs +342 -0
  269. package/dist/src/builders/web/index.mjs.map +1 -0
  270. package/dist/src/builders/web/webDevRoots.cjs +27 -0
  271. package/dist/src/builders/web/webDevRoots.cjs.map +1 -0
  272. package/dist/src/builders/web/webDevRoots.d.mts +22 -0
  273. package/dist/src/builders/web/webDevRoots.d.mts.map +1 -0
  274. package/dist/src/builders/web/webDevRoots.mjs +25 -0
  275. package/dist/src/builders/web/webDevRoots.mjs.map +1 -0
  276. package/dist/src/builders/web/webPluginGenerate.cjs +188 -0
  277. package/dist/src/builders/web/webPluginGenerate.cjs.map +1 -0
  278. package/dist/src/builders/web/webPluginGenerate.d.mts +56 -0
  279. package/dist/src/builders/web/webPluginGenerate.d.mts.map +1 -0
  280. package/dist/src/builders/web/webPluginGenerate.mjs +178 -0
  281. package/dist/src/builders/web/webPluginGenerate.mjs.map +1 -0
  282. package/dist/src/builders/web/webPluginManifest.cjs +128 -0
  283. package/dist/src/builders/web/webPluginManifest.cjs.map +1 -0
  284. package/dist/src/builders/web/webPluginManifest.d.mts +64 -0
  285. package/dist/src/builders/web/webPluginManifest.d.mts.map +1 -0
  286. package/dist/src/builders/web/webPluginManifest.mjs +118 -0
  287. package/dist/src/builders/web/webPluginManifest.mjs.map +1 -0
  288. package/dist/src/builders/web/webPluginScan.cjs +57 -0
  289. package/dist/src/builders/web/webPluginScan.cjs.map +1 -0
  290. package/dist/src/builders/web/webPluginScan.d.mts +19 -0
  291. package/dist/src/builders/web/webPluginScan.d.mts.map +1 -0
  292. package/dist/src/builders/web/webPluginScan.mjs +54 -0
  293. package/dist/src/builders/web/webPluginScan.mjs.map +1 -0
  294. package/dist/src/builders/web/webPluginVite.cjs +255 -0
  295. package/dist/src/builders/web/webPluginVite.cjs.map +1 -0
  296. package/dist/src/builders/web/webPluginVite.d.mts +64 -0
  297. package/dist/src/builders/web/webPluginVite.d.mts.map +1 -0
  298. package/dist/src/builders/web/webPluginVite.mjs +242 -0
  299. package/dist/src/builders/web/webPluginVite.mjs.map +1 -0
  300. package/dist/src/cli/cliApp.cjs +187 -0
  301. package/dist/src/cli/cliApp.cjs.map +1 -0
  302. package/dist/src/cli/cliApp.d.mts +32 -0
  303. package/dist/src/cli/cliApp.d.mts.map +1 -0
  304. package/dist/src/cli/cliApp.mjs +184 -0
  305. package/dist/src/cli/cliApp.mjs.map +1 -0
  306. package/dist/src/cli/commands/api-export/index.cjs +66 -0
  307. package/dist/src/cli/commands/api-export/index.cjs.map +1 -0
  308. package/dist/src/cli/commands/api-export/index.mjs +62 -0
  309. package/dist/src/cli/commands/api-export/index.mjs.map +1 -0
  310. package/dist/src/cli/commands/baseCommand.cjs +16 -0
  311. package/dist/src/cli/commands/baseCommand.cjs.map +1 -0
  312. package/dist/src/cli/commands/baseCommand.d.mts +24 -0
  313. package/dist/src/cli/commands/baseCommand.d.mts.map +1 -0
  314. package/dist/src/cli/commands/baseCommand.mjs +16 -0
  315. package/dist/src/cli/commands/baseCommand.mjs.map +1 -0
  316. package/dist/src/cli/commands/compat/context.cjs +115 -0
  317. package/dist/src/cli/commands/compat/context.cjs.map +1 -0
  318. package/dist/src/cli/commands/compat/context.d.mts +22 -0
  319. package/dist/src/cli/commands/compat/context.d.mts.map +1 -0
  320. package/dist/src/cli/commands/compat/context.mjs +110 -0
  321. package/dist/src/cli/commands/compat/context.mjs.map +1 -0
  322. package/dist/src/cli/commands/compat/help.cjs +26 -0
  323. package/dist/src/cli/commands/compat/help.cjs.map +1 -0
  324. package/dist/src/cli/commands/compat/help.d.mts +4 -0
  325. package/dist/src/cli/commands/compat/help.d.mts.map +1 -0
  326. package/dist/src/cli/commands/compat/help.mjs +25 -0
  327. package/dist/src/cli/commands/compat/help.mjs.map +1 -0
  328. package/dist/src/cli/commands/compat/index.cjs +73 -0
  329. package/dist/src/cli/commands/compat/index.cjs.map +1 -0
  330. package/dist/src/cli/commands/compat/index.d.mts +14 -0
  331. package/dist/src/cli/commands/compat/index.d.mts.map +1 -0
  332. package/dist/src/cli/commands/compat/index.mjs +70 -0
  333. package/dist/src/cli/commands/compat/index.mjs.map +1 -0
  334. package/dist/src/cli/commands/compat/options.cjs +88 -0
  335. package/dist/src/cli/commands/compat/options.cjs.map +1 -0
  336. package/dist/src/cli/commands/compat/options.d.mts +15 -0
  337. package/dist/src/cli/commands/compat/options.d.mts.map +1 -0
  338. package/dist/src/cli/commands/compat/options.mjs +86 -0
  339. package/dist/src/cli/commands/compat/options.mjs.map +1 -0
  340. package/dist/src/cli/commands/compat/providers/antigravity.cjs +294 -0
  341. package/dist/src/cli/commands/compat/providers/antigravity.cjs.map +1 -0
  342. package/dist/src/cli/commands/compat/providers/antigravity.d.mts +9 -0
  343. package/dist/src/cli/commands/compat/providers/antigravity.d.mts.map +1 -0
  344. package/dist/src/cli/commands/compat/providers/antigravity.mjs +289 -0
  345. package/dist/src/cli/commands/compat/providers/antigravity.mjs.map +1 -0
  346. package/dist/src/cli/commands/compat/providers/codex.cjs +178 -0
  347. package/dist/src/cli/commands/compat/providers/codex.cjs.map +1 -0
  348. package/dist/src/cli/commands/compat/providers/codex.d.mts +17 -0
  349. package/dist/src/cli/commands/compat/providers/codex.d.mts.map +1 -0
  350. package/dist/src/cli/commands/compat/providers/codex.mjs +170 -0
  351. package/dist/src/cli/commands/compat/providers/codex.mjs.map +1 -0
  352. package/dist/src/cli/commands/compat/providers/index.cjs +65 -0
  353. package/dist/src/cli/commands/compat/providers/index.cjs.map +1 -0
  354. package/dist/src/cli/commands/compat/providers/index.d.mts +15 -0
  355. package/dist/src/cli/commands/compat/providers/index.d.mts.map +1 -0
  356. package/dist/src/cli/commands/compat/providers/index.mjs +45 -0
  357. package/dist/src/cli/commands/compat/providers/index.mjs.map +1 -0
  358. package/dist/src/cli/commands/compat/providers/process.cjs +172 -0
  359. package/dist/src/cli/commands/compat/providers/process.cjs.map +1 -0
  360. package/dist/src/cli/commands/compat/providers/process.d.mts +33 -0
  361. package/dist/src/cli/commands/compat/providers/process.d.mts.map +1 -0
  362. package/dist/src/cli/commands/compat/providers/process.mjs +159 -0
  363. package/dist/src/cli/commands/compat/providers/process.mjs.map +1 -0
  364. package/dist/src/cli/commands/compat/providers/shared.cjs +76 -0
  365. package/dist/src/cli/commands/compat/providers/shared.cjs.map +1 -0
  366. package/dist/src/cli/commands/compat/providers/shared.d.mts +40 -0
  367. package/dist/src/cli/commands/compat/providers/shared.d.mts.map +1 -0
  368. package/dist/src/cli/commands/compat/providers/shared.mjs +61 -0
  369. package/dist/src/cli/commands/compat/providers/shared.mjs.map +1 -0
  370. package/dist/src/cli/commands/compat/types.d.mts +31 -0
  371. package/dist/src/cli/commands/compat/types.d.mts.map +1 -0
  372. package/dist/src/cli/commands/doctor/help.cjs +19 -0
  373. package/dist/src/cli/commands/doctor/help.cjs.map +1 -0
  374. package/dist/src/cli/commands/doctor/help.d.mts +4 -0
  375. package/dist/src/cli/commands/doctor/help.d.mts.map +1 -0
  376. package/dist/src/cli/commands/doctor/help.mjs +19 -0
  377. package/dist/src/cli/commands/doctor/help.mjs.map +1 -0
  378. package/dist/src/cli/commands/doctor/index.cjs +118 -0
  379. package/dist/src/cli/commands/doctor/index.cjs.map +1 -0
  380. package/dist/src/cli/commands/doctor/index.d.mts +33 -0
  381. package/dist/src/cli/commands/doctor/index.d.mts.map +1 -0
  382. package/dist/src/cli/commands/doctor/index.mjs +113 -0
  383. package/dist/src/cli/commands/doctor/index.mjs.map +1 -0
  384. package/dist/src/cli/commands/emit-mcp/index.cjs +32 -0
  385. package/dist/src/cli/commands/emit-mcp/index.cjs.map +1 -0
  386. package/dist/src/cli/commands/emit-mcp/index.d.mts +19 -0
  387. package/dist/src/cli/commands/emit-mcp/index.d.mts.map +1 -0
  388. package/dist/src/cli/commands/emit-mcp/index.mjs +31 -0
  389. package/dist/src/cli/commands/emit-mcp/index.mjs.map +1 -0
  390. package/dist/src/cli/commands/explain/index.cjs +155 -0
  391. package/dist/src/cli/commands/explain/index.cjs.map +1 -0
  392. package/dist/src/cli/commands/explain/index.d.mts +57 -0
  393. package/dist/src/cli/commands/explain/index.d.mts.map +1 -0
  394. package/dist/src/cli/commands/explain/index.mjs +150 -0
  395. package/dist/src/cli/commands/explain/index.mjs.map +1 -0
  396. package/dist/src/cli/commands/init/constants.cjs +11 -0
  397. package/dist/src/cli/commands/init/constants.cjs.map +1 -0
  398. package/dist/src/cli/commands/init/constants.mjs +11 -0
  399. package/dist/src/cli/commands/init/constants.mjs.map +1 -0
  400. package/dist/src/cli/commands/init/help.cjs +17 -0
  401. package/dist/src/cli/commands/init/help.cjs.map +1 -0
  402. package/dist/src/cli/commands/init/help.d.mts +4 -0
  403. package/dist/src/cli/commands/init/help.d.mts.map +1 -0
  404. package/dist/src/cli/commands/init/help.mjs +17 -0
  405. package/dist/src/cli/commands/init/help.mjs.map +1 -0
  406. package/dist/src/cli/commands/init/index.cjs +67 -0
  407. package/dist/src/cli/commands/init/index.cjs.map +1 -0
  408. package/dist/src/cli/commands/init/index.d.mts +12 -0
  409. package/dist/src/cli/commands/init/index.d.mts.map +1 -0
  410. package/dist/src/cli/commands/init/index.mjs +63 -0
  411. package/dist/src/cli/commands/init/index.mjs.map +1 -0
  412. package/dist/src/cli/commands/init/presenter.cjs +140 -0
  413. package/dist/src/cli/commands/init/presenter.cjs.map +1 -0
  414. package/dist/src/cli/commands/init/presenter.d.mts +8 -0
  415. package/dist/src/cli/commands/init/presenter.d.mts.map +1 -0
  416. package/dist/src/cli/commands/init/presenter.mjs +140 -0
  417. package/dist/src/cli/commands/init/presenter.mjs.map +1 -0
  418. package/dist/src/cli/commands/sync/help.cjs +34 -0
  419. package/dist/src/cli/commands/sync/help.cjs.map +1 -0
  420. package/dist/src/cli/commands/sync/help.d.mts +4 -0
  421. package/dist/src/cli/commands/sync/help.d.mts.map +1 -0
  422. package/dist/src/cli/commands/sync/help.mjs +34 -0
  423. package/dist/src/cli/commands/sync/help.mjs.map +1 -0
  424. package/dist/src/cli/commands/sync/index.cjs +215 -0
  425. package/dist/src/cli/commands/sync/index.cjs.map +1 -0
  426. package/dist/src/cli/commands/sync/index.d.mts +20 -0
  427. package/dist/src/cli/commands/sync/index.d.mts.map +1 -0
  428. package/dist/src/cli/commands/sync/index.mjs +206 -0
  429. package/dist/src/cli/commands/sync/index.mjs.map +1 -0
  430. package/dist/src/cli/commands/sync/presenter.cjs +58 -0
  431. package/dist/src/cli/commands/sync/presenter.cjs.map +1 -0
  432. package/dist/src/cli/commands/sync/presenter.d.mts +16 -0
  433. package/dist/src/cli/commands/sync/presenter.d.mts.map +1 -0
  434. package/dist/src/cli/commands/sync/presenter.mjs +57 -0
  435. package/dist/src/cli/commands/sync/presenter.mjs.map +1 -0
  436. package/dist/src/cli/commands/sync/workflow.cjs +16 -0
  437. package/dist/src/cli/commands/sync/workflow.cjs.map +1 -0
  438. package/dist/src/cli/commands/sync/workflow.mjs +16 -0
  439. package/dist/src/cli/commands/sync/workflow.mjs.map +1 -0
  440. package/dist/src/cli/commands/web/index.cjs +88 -0
  441. package/dist/src/cli/commands/web/index.cjs.map +1 -0
  442. package/dist/src/cli/commands/web/index.mjs +85 -0
  443. package/dist/src/cli/commands/web/index.mjs.map +1 -0
  444. package/dist/src/cli/harnessOptions.cjs +70 -0
  445. package/dist/src/cli/harnessOptions.cjs.map +1 -0
  446. package/dist/src/cli/harnessOptions.d.mts +26 -0
  447. package/dist/src/cli/harnessOptions.d.mts.map +1 -0
  448. package/dist/src/cli/harnessOptions.mjs +66 -0
  449. package/dist/src/cli/harnessOptions.mjs.map +1 -0
  450. package/dist/src/cli/help.cjs +82 -0
  451. package/dist/src/cli/help.cjs.map +1 -0
  452. package/dist/src/cli/help.d.mts +10 -0
  453. package/dist/src/cli/help.d.mts.map +1 -0
  454. package/dist/src/cli/help.mjs +78 -0
  455. package/dist/src/cli/help.mjs.map +1 -0
  456. package/dist/src/cli/matrixOptions.cjs +178 -0
  457. package/dist/src/cli/matrixOptions.cjs.map +1 -0
  458. package/dist/src/cli/matrixOptions.d.mts +90 -0
  459. package/dist/src/cli/matrixOptions.d.mts.map +1 -0
  460. package/dist/src/cli/matrixOptions.mjs +151 -0
  461. package/dist/src/cli/matrixOptions.mjs.map +1 -0
  462. package/dist/src/cli/options.cjs +281 -0
  463. package/dist/src/cli/options.cjs.map +1 -0
  464. package/dist/src/cli/options.d.mts +5 -0
  465. package/dist/src/cli/options.d.mts.map +1 -0
  466. package/dist/src/cli/options.mjs +279 -0
  467. package/dist/src/cli/options.mjs.map +1 -0
  468. package/dist/src/cli/router.cjs +57 -0
  469. package/dist/src/cli/router.cjs.map +1 -0
  470. package/dist/src/cli/router.d.mts +32 -0
  471. package/dist/src/cli/router.d.mts.map +1 -0
  472. package/dist/src/cli/router.mjs +54 -0
  473. package/dist/src/cli/router.mjs.map +1 -0
  474. package/dist/src/cli/server/options.cjs +71 -0
  475. package/dist/src/cli/server/options.cjs.map +1 -0
  476. package/dist/src/cli/server/options.mjs +70 -0
  477. package/dist/src/cli/server/options.mjs.map +1 -0
  478. package/dist/src/cli/server/processGuards.cjs +83 -0
  479. package/dist/src/cli/server/processGuards.cjs.map +1 -0
  480. package/dist/src/cli/server/processGuards.mjs +79 -0
  481. package/dist/src/cli/server/processGuards.mjs.map +1 -0
  482. package/dist/src/cli/server/run.cjs +69 -0
  483. package/dist/src/cli/server/run.cjs.map +1 -0
  484. package/dist/src/cli/server/run.mjs +66 -0
  485. package/dist/src/cli/server/run.mjs.map +1 -0
  486. package/dist/src/composition/harnessState/index.cjs +48 -0
  487. package/dist/src/composition/harnessState/index.cjs.map +1 -0
  488. package/dist/src/composition/harnessState/index.d.mts +19 -0
  489. package/dist/src/composition/harnessState/index.d.mts.map +1 -0
  490. package/dist/src/composition/harnessState/index.mjs +34 -0
  491. package/dist/src/composition/harnessState/index.mjs.map +1 -0
  492. package/dist/src/composition/layerPackageInstaller/index.cjs +651 -0
  493. package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -0
  494. package/dist/src/composition/layerPackageInstaller/index.d.mts +74 -0
  495. package/dist/src/composition/layerPackageInstaller/index.d.mts.map +1 -0
  496. package/dist/src/composition/layerPackageInstaller/index.mjs +637 -0
  497. package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -0
  498. package/dist/src/composition/poHomeMigration/index.cjs +234 -0
  499. package/dist/src/composition/poHomeMigration/index.cjs.map +1 -0
  500. package/dist/src/composition/poHomeMigration/index.d.mts +12 -0
  501. package/dist/src/composition/poHomeMigration/index.d.mts.map +1 -0
  502. package/dist/src/composition/poHomeMigration/index.mjs +226 -0
  503. package/dist/src/composition/poHomeMigration/index.mjs.map +1 -0
  504. package/dist/src/composition/projectTrust/index.cjs +51 -0
  505. package/dist/src/composition/projectTrust/index.cjs.map +1 -0
  506. package/dist/src/composition/projectTrust/index.d.mts +22 -0
  507. package/dist/src/composition/projectTrust/index.d.mts.map +1 -0
  508. package/dist/src/composition/projectTrust/index.mjs +48 -0
  509. package/dist/src/composition/projectTrust/index.mjs.map +1 -0
  510. package/dist/src/composition/repository/index.cjs +68 -0
  511. package/dist/src/composition/repository/index.cjs.map +1 -0
  512. package/dist/src/composition/repository/index.d.mts +22 -0
  513. package/dist/src/composition/repository/index.d.mts.map +1 -0
  514. package/dist/src/composition/repository/index.mjs +63 -0
  515. package/dist/src/composition/repository/index.mjs.map +1 -0
  516. package/dist/src/composition/syncPrune/index.cjs +85 -0
  517. package/dist/src/composition/syncPrune/index.cjs.map +1 -0
  518. package/dist/src/composition/syncPrune/index.d.mts +33 -0
  519. package/dist/src/composition/syncPrune/index.d.mts.map +1 -0
  520. package/dist/src/composition/syncPrune/index.mjs +82 -0
  521. package/dist/src/composition/syncPrune/index.mjs.map +1 -0
  522. package/dist/src/composition/syncService/index.cjs +808 -0
  523. package/dist/src/composition/syncService/index.cjs.map +1 -0
  524. package/dist/src/composition/syncService/index.d.mts +65 -0
  525. package/dist/src/composition/syncService/index.d.mts.map +1 -0
  526. package/dist/src/composition/syncService/index.mjs +792 -0
  527. package/dist/src/composition/syncService/index.mjs.map +1 -0
  528. package/dist/src/composition/syncService/localBuilds.cjs +367 -0
  529. package/dist/src/composition/syncService/localBuilds.cjs.map +1 -0
  530. package/dist/src/composition/syncService/localBuilds.mjs +358 -0
  531. package/dist/src/composition/syncService/localBuilds.mjs.map +1 -0
  532. package/dist/src/composition/transitionLayers.cjs +17 -0
  533. package/dist/src/composition/transitionLayers.cjs.map +1 -0
  534. package/dist/src/composition/transitionLayers.d.mts +6 -0
  535. package/dist/src/composition/transitionLayers.d.mts.map +1 -0
  536. package/dist/src/composition/transitionLayers.mjs +16 -0
  537. package/dist/src/composition/transitionLayers.mjs.map +1 -0
  538. package/dist/src/composition/types/harness.d.mts +52 -0
  539. package/dist/src/composition/types/harness.d.mts.map +1 -0
  540. package/dist/src/extensions/setupDiagnostics.cjs +65 -0
  541. package/dist/src/extensions/setupDiagnostics.cjs.map +1 -0
  542. package/dist/src/extensions/setupDiagnostics.mjs +64 -0
  543. package/dist/src/extensions/setupDiagnostics.mjs.map +1 -0
  544. package/dist/utils.cjs +4 -0
  545. package/dist/utils.d.mts +2 -0
  546. package/dist/utils.mjs +2 -0
  547. package/dist/webBuilder.cjs +59 -0
  548. package/dist/webBuilder.d.mts +9 -0
  549. package/dist/webBuilder.mjs +9 -0
  550. package/docs/server/api-export.md +86 -0
  551. package/docs/server/api.md +144 -0
  552. package/docs/server/getting-started.md +114 -0
  553. package/docs/server/index.md +67 -0
  554. package/docs/server/ipc.md +97 -0
  555. package/docs/server/lifecycle.md +108 -0
  556. package/docs/server/security.md +101 -0
  557. package/llms.txt +12 -0
  558. package/package.json +295 -0
  559. package/src/prompts/po-author-extension/SKILL.md +35 -0
  560. package/src/prompts/po-author-extension/references/extension-contract.md +134 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/composition/poHomeMigration/index.ts"],"sourcesContent":["import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\n/**\n * Moving Po's home from `~/.pi/.po` to `~/.po`.\n *\n * The user's data is copied, never renamed: an older Po still running reads the old\n * directory, so it must stay whole until no older host is left. The old directory is\n * deleted only when both the host registry and a process scan find no older host.\n */\n\nconst LEGACY_SEGMENTS = ['.pi', '.po'] as const;\nconst MARKER_FILE = 'migration.json';\nconst MARKER_VERSION = 1;\n/** What moves: configuration, user workspaces, git and session state, and the signer. */\nconst COPIED_ENTRIES = [\n 'config.yaml',\n 'modes.yaml',\n 'domains.yaml',\n 'profiles.yaml',\n 'hooks.yaml',\n 'workspace',\n 'git',\n 'session',\n path.join('server', 'signing.json'),\n] as const;\nconst LEGACY_PLANS_DIRECTORY = 'plans';\nconst HOSTS_DIRECTORY = path.join('run', 'hosts');\nconst HOST_RECORD_PREFIX = 'po-server-';\n/** Command lines of an older Po host, which reads the legacy directory. */\nconst PO_HOST_COMMAND = /po\\/dist\\/bin\\/(serve|dpi|cli)\\.mjs/u;\n/** The web and server ports older Po hosts listen on. */\nconst LEGACY_HOST_PORTS = [7433, 7434, 7533, 7534] as const;\nconst PRIVATE_DIRECTORY_MODE = 0o700;\n\nexport function legacyPoHomeDirectory(homeDirectory: string): string {\n return path.join(homeDirectory, ...LEGACY_SEGMENTS);\n}\n\nexport interface PoHomeMigrationResult {\n readonly status: 'migrated' | 'already-migrated' | 'nothing-to-migrate';\n readonly copied: readonly string[];\n /** Entries left alone because `~/.po` already had them. */\n readonly skipped: readonly string[];\n}\n\n/**\n * Copies the user's data from `~/.pi/.po`, and plans from `~/.pi/plans`, into the Po home, once.\n *\n * An entry the Po home already has is skipped, never merged or overwritten. The marker\n * records that this ran; the Po home existing does not, because `run` lives there too.\n */\nexport function migratePoHome(homeDirectory: string, poHome: string): PoHomeMigrationResult {\n const marker = path.join(poHome, MARKER_FILE);\n if (fs.existsSync(marker)) return { status: 'already-migrated', copied: [], skipped: [] };\n const legacy = legacyPoHomeDirectory(homeDirectory);\n if (path.resolve(legacy) === path.resolve(poHome) || !fs.existsSync(legacy)) {\n return { status: 'nothing-to-migrate', copied: [], skipped: [] };\n }\n fs.mkdirSync(poHome, { recursive: true, mode: PRIVATE_DIRECTORY_MODE });\n const copied: string[] = [];\n const skipped: string[] = [];\n // Plans lived beside ~/.pi/.po, at ~/.pi/plans, and now default to <po home>/plans.\n const sources = [\n ...COPIED_ENTRIES.map((entry) => ({ entry, source: path.join(legacy, entry) })),\n { entry: LEGACY_PLANS_DIRECTORY, source: path.join(homeDirectory, '.pi', LEGACY_PLANS_DIRECTORY) },\n ];\n for (const { entry, source } of sources) {\n if (!fs.existsSync(source)) continue;\n const target = path.join(poHome, entry);\n if (fs.existsSync(target)) {\n skipped.push(entry);\n continue;\n }\n fs.mkdirSync(path.dirname(target), { recursive: true, mode: PRIVATE_DIRECTORY_MODE });\n fs.cpSync(source, target, { recursive: true, errorOnExist: true, force: false, preserveTimestamps: true });\n copied.push(entry);\n }\n fs.writeFileSync(\n marker,\n `${JSON.stringify({ version: MARKER_VERSION, from: legacy, migratedAt: new Date().toISOString(), copied, skipped }, null, 2)}\\n`,\n { mode: 0o600 },\n );\n return { status: 'migrated', copied, skipped };\n}\n\n/** Records this host in the Po home's registry until the returned release runs. */\nexport function registerPoHost(poHome: string, pid: number = process.pid): () => void {\n const directory = path.join(poHome, HOSTS_DIRECTORY);\n fs.mkdirSync(directory, { recursive: true, mode: PRIVATE_DIRECTORY_MODE });\n const file = path.join(directory, `${HOST_RECORD_PREFIX}${String(pid)}.json`);\n fs.writeFileSync(file, `${JSON.stringify({ pid, startedAt: new Date().toISOString() })}\\n`, { mode: 0o600 });\n return () => fs.rmSync(file, { force: true });\n}\n\n/** Pids of registered hosts; records of processes that are gone are ignored. */\nfunction registeredHostPids(poHome: string): Set<number> {\n const directory = path.join(poHome, HOSTS_DIRECTORY);\n const pids = new Set<number>();\n if (!fs.existsSync(directory)) return pids;\n for (const name of fs.readdirSync(directory)) {\n const match = new RegExp(`^${HOST_RECORD_PREFIX}(\\\\d+)\\\\.json$`, 'u').exec(name);\n if (match?.[1]) pids.add(Number(match[1]));\n }\n return pids;\n}\n\nexport interface HostScan {\n /** Every process's pid and command line. */\n processes(): readonly { pid: number; command: string }[];\n /** Pids listening on any of the ports. */\n listeners(ports: readonly number[]): readonly number[];\n}\n\n/** `ps` and `lsof`, as macOS and Linux provide them. A missing tool throws, which defers deletion. */\nexport const systemHostScan: HostScan = {\n processes() {\n return execFileSync('ps', ['-axo', 'pid=,command='], { encoding: 'utf8' })\n .split('\\n')\n .map((line) => /^\\s*(\\d+)\\s+(.*)$/u.exec(line))\n .filter((match): match is RegExpExecArray => match !== null)\n .map((match) => ({ pid: Number(match[1]), command: match[2]! }));\n },\n listeners(ports) {\n const args = ['-nP', '-sTCP:LISTEN', '-t', ...ports.map((port) => `-iTCP:${String(port)}`)];\n let output: string;\n try {\n output = execFileSync('lsof', args, { encoding: 'utf8' });\n } catch (error) {\n // lsof exits 1 when any one port has no listener, even when another port has one;\n // its output still lists the pids it found. Any other status is a real failure.\n const status = (error as { status?: number }).status;\n if (status !== 1) throw error;\n output = (error as { stdout?: string }).stdout ?? '';\n }\n return output\n .split('\\n')\n .map((line) => Number(line.trim()))\n .filter((pid) => Number.isInteger(pid) && pid > 0);\n },\n};\n\n/**\n * One scan for Po hosts: `hosts` holds every process running a Po host entry and every\n * listener on a Po host port, registered or not; `live` holds every pid that exists.\n * A scan that cannot run throws.\n */\nfunction scanPoHosts(scan: HostScan): { hosts: number[]; live: Set<number> } {\n const processes = scan.processes();\n return {\n hosts: [\n ...processes.filter((entry) => PO_HOST_COMMAND.test(entry.command)).map((entry) => entry.pid),\n ...scan.listeners(LEGACY_HOST_PORTS),\n ],\n live: new Set(processes.map((entry) => entry.pid)),\n };\n}\n\nexport type OtherPoHosts = { status: 'none' } | { status: 'running'; reason: string };\n\n/**\n * Whether any Po host other than this process runs: the scan of 4c's retirement, plus\n * registered hosts whose process still exists (a host run from source has no `dist` entry\n * to match). A scan that fails counts as running, so a caller acting on \"none\" never\n * acts on a guess.\n */\nexport function otherPoHosts(\n poHome: string,\n scan: HostScan = systemHostScan,\n selfPid: number = process.pid,\n): OtherPoHosts {\n let others: number[];\n try {\n const { hosts, live } = scanPoHosts(scan);\n others = [...hosts, ...[...registeredHostPids(poHome)].filter((pid) => live.has(pid))].filter(\n (pid) => pid !== selfPid,\n );\n } catch (error) {\n return { status: 'running', reason: `host scan failed: ${error instanceof Error ? error.message : String(error)}` };\n }\n return others.length === 0\n ? { status: 'none' }\n : { status: 'running', reason: `other Po processes run: ${[...new Set(others)].join(', ')}` };\n}\n\nexport type LegacyRetirement =\n | { status: 'removed' | 'absent' | 'not-migrated' }\n | { status: 'deferred'; reason: string };\n\n/**\n * Deletes `~/.pi/.po` once nothing can still be using it.\n *\n * An older host is any Po process, or any listener on the old ports, that is not in the\n * registry: registered hosts are new and use the Po home. Only after the migration ran,\n * and only when the scan itself succeeded and found no older host; otherwise the next\n * start tries again. The directory is never renamed.\n */\nexport function retireLegacyPoHome(\n homeDirectory: string,\n poHome: string,\n scan: HostScan = systemHostScan,\n): LegacyRetirement {\n const legacy = legacyPoHomeDirectory(homeDirectory);\n if (path.resolve(legacy) === path.resolve(poHome) || !fs.existsSync(legacy)) return { status: 'absent' };\n if (!fs.existsSync(path.join(poHome, MARKER_FILE))) return { status: 'not-migrated' };\n const registered = registeredHostPids(poHome);\n let older: number[];\n try {\n older = scanPoHosts(scan).hosts.filter((pid) => !registered.has(pid));\n } catch (error) {\n return {\n status: 'deferred',\n reason: `host scan failed: ${error instanceof Error ? error.message : String(error)}`,\n };\n }\n if (older.length > 0) {\n return { status: 'deferred', reason: `unregistered Po processes still run: ${[...new Set(older)].join(', ')}` };\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AAG,OAAO,QAAQ;EAAE,WAAW;EAAM,OAAO;CAAK,CAAC;CAClD,OAAO,EAAE,QAAQ,UAAU;AAC7B"}
@@ -0,0 +1,51 @@
1
+ let _agimon_ai_po_config_config = require("@agimon-ai/po-config/config");
2
+ //#region src/composition/projectTrust/index.ts
3
+ const APPROVE_OPTION = "--approve";
4
+ const APPROVE_SHORT_OPTION = "-a";
5
+ const NO_APPROVE_OPTION = "--no-approve";
6
+ const NO_APPROVE_SHORT_OPTION = "-na";
7
+ const PROJECT_TRUST_ALWAYS = "always";
8
+ const PROJECT_TRUST_NEVER = "never";
9
+ function loadDoomConfig(repoRoot) {
10
+ const config = (0, _agimon_ai_po_config_config.loadDoomConfig)(repoRoot);
11
+ return {
12
+ projectTrust: config.projectTrust,
13
+ selection: config.selection
14
+ };
15
+ }
16
+ /**
17
+ * Reads the config the way `po sync` needs it: an unknown key is reported
18
+ * rather than fatal, so a config written for a different version cannot break
19
+ * a build. `po doctor` runs the strict read above.
20
+ */
21
+ function loadDoomConfigLenient(repoRoot, homeDirectory) {
22
+ const { config, diagnostics } = (0, _agimon_ai_po_config_config.loadDoomConfigLenient)(repoRoot, homeDirectory);
23
+ return {
24
+ config: {
25
+ projectTrust: config.projectTrust,
26
+ selection: config.selection
27
+ },
28
+ diagnostics
29
+ };
30
+ }
31
+ function hasProjectTrustOption(piArgs) {
32
+ return piArgs.some((argument) => [
33
+ APPROVE_OPTION,
34
+ APPROVE_SHORT_OPTION,
35
+ NO_APPROVE_OPTION,
36
+ NO_APPROVE_SHORT_OPTION
37
+ ].includes(argument));
38
+ }
39
+ function applyProjectTrust(piArgs, config) {
40
+ if (hasProjectTrustOption(piArgs)) return [...piArgs];
41
+ if (config.projectTrust === PROJECT_TRUST_ALWAYS) return [APPROVE_OPTION, ...piArgs];
42
+ if (config.projectTrust === PROJECT_TRUST_NEVER) return [NO_APPROVE_OPTION, ...piArgs];
43
+ return [...piArgs];
44
+ }
45
+ //#endregion
46
+ exports.applyProjectTrust = applyProjectTrust;
47
+ exports.hasProjectTrustOption = hasProjectTrustOption;
48
+ exports.loadDoomConfig = loadDoomConfig;
49
+ exports.loadDoomConfigLenient = loadDoomConfigLenient;
50
+
51
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["loadSharedDoomConfig","loadSharedDoomConfigLenient"],"sources":["../../../../src/composition/projectTrust/index.ts"],"sourcesContent":["import {\n loadDoomConfig as loadSharedDoomConfig,\n loadDoomConfigLenient as loadSharedDoomConfigLenient,\n} from '@agimon-ai/po-config/config';\nimport type { ConfigDiagnostic, DoomSelectionConfig, ProjectTrust } from '@agimon-ai/po-config/types';\n\nconst APPROVE_OPTION = '--approve';\nconst APPROVE_SHORT_OPTION = '-a';\nconst NO_APPROVE_OPTION = '--no-approve';\nconst NO_APPROVE_SHORT_OPTION = '-na';\nconst PROJECT_TRUST_ALWAYS: ProjectTrust = 'always';\nconst PROJECT_TRUST_NEVER: ProjectTrust = 'never';\n\nexport type { ProjectTrust };\n\nexport interface DoomConfig {\n projectTrust: ProjectTrust;\n /** The matrix the repository declares by default, read by `po sync`. */\n selection?: DoomSelectionConfig;\n}\n\nexport function loadDoomConfig(repoRoot: string): DoomConfig {\n const config = loadSharedDoomConfig(repoRoot);\n return { projectTrust: config.projectTrust, selection: config.selection };\n}\n\n/**\n * Reads the config the way `po sync` needs it: an unknown key is reported\n * rather than fatal, so a config written for a different version cannot break\n * a build. `po doctor` runs the strict read above.\n */\nexport function loadDoomConfigLenient(\n repoRoot: string,\n homeDirectory?: string,\n): { config: DoomConfig; diagnostics: ConfigDiagnostic[] } {\n const { config, diagnostics } = loadSharedDoomConfigLenient(repoRoot, homeDirectory);\n return { config: { projectTrust: config.projectTrust, selection: config.selection }, diagnostics };\n}\n\nexport function hasProjectTrustOption(piArgs: string[]): boolean {\n return piArgs.some((argument) =>\n [APPROVE_OPTION, APPROVE_SHORT_OPTION, NO_APPROVE_OPTION, NO_APPROVE_SHORT_OPTION].includes(argument),\n );\n}\n\nexport function applyProjectTrust(piArgs: string[], config: DoomConfig): string[] {\n if (hasProjectTrustOption(piArgs)) {\n return [...piArgs];\n }\n if (config.projectTrust === PROJECT_TRUST_ALWAYS) return [APPROVE_OPTION, ...piArgs];\n if (config.projectTrust === PROJECT_TRUST_NEVER) return [NO_APPROVE_OPTION, ...piArgs];\n return [...piArgs];\n}\n"],"mappings":";;AAMA,MAAM,iBAAiB;AACvB,MAAM,uBAAuB;AAC7B,MAAM,oBAAoB;AAC1B,MAAM,0BAA0B;AAChC,MAAM,uBAAqC;AAC3C,MAAM,sBAAoC;AAU1C,SAAgB,eAAe,UAA8B;CAC3D,MAAM,UAAA,GAASA,4BAAAA,eAAAA,CAAqB,QAAQ;CAC5C,OAAO;EAAE,cAAc,OAAO;EAAc,WAAW,OAAO;CAAU;AAC1E;;;;;;AAOA,SAAgB,sBACd,UACA,eACyD;CACzD,MAAM,EAAE,QAAQ,iBAAA,GAAgBC,4BAAAA,sBAAAA,CAA4B,UAAU,aAAa;CACnF,OAAO;EAAE,QAAQ;GAAE,cAAc,OAAO;GAAc,WAAW,OAAO;EAAU;EAAG;CAAY;AACnG;AAEA,SAAgB,sBAAsB,QAA2B;CAC/D,OAAO,OAAO,MAAM,aAClB;EAAC;EAAgB;EAAsB;EAAmB;CAAuB,CAAC,CAAC,SAAS,QAAQ,CACtG;AACF;AAEA,SAAgB,kBAAkB,QAAkB,QAA8B;CAChF,IAAI,sBAAsB,MAAM,GAC9B,OAAO,CAAC,GAAG,MAAM;CAEnB,IAAI,OAAO,iBAAiB,sBAAsB,OAAO,CAAC,gBAAgB,GAAG,MAAM;CACnF,IAAI,OAAO,iBAAiB,qBAAqB,OAAO,CAAC,mBAAmB,GAAG,MAAM;CACrF,OAAO,CAAC,GAAG,MAAM;AACnB"}
@@ -0,0 +1,22 @@
1
+ import { ConfigDiagnostic, DoomSelectionConfig, ProjectTrust } from "@agimon-ai/po-config/types";
2
+ //#region src/composition/projectTrust/index.d.ts
3
+ export interface DoomConfig {
4
+ projectTrust: ProjectTrust;
5
+ /** The matrix the repository declares by default, read by `po sync`. */
6
+ selection?: DoomSelectionConfig;
7
+ }
8
+ export declare function loadDoomConfig(repoRoot: string): DoomConfig;
9
+ /**
10
+ * Reads the config the way `po sync` needs it: an unknown key is reported
11
+ * rather than fatal, so a config written for a different version cannot break
12
+ * a build. `po doctor` runs the strict read above.
13
+ */
14
+ export declare function loadDoomConfigLenient(repoRoot: string, homeDirectory?: string): {
15
+ config: DoomConfig;
16
+ diagnostics: ConfigDiagnostic[];
17
+ };
18
+ export declare function hasProjectTrustOption(piArgs: string[]): boolean;
19
+ export declare function applyProjectTrust(piArgs: string[], config: DoomConfig): string[];
20
+ //#endregion
21
+ export type { ProjectTrust };
22
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/composition/projectTrust/index.ts"],"mappings":";;iBAeiB;EACf,cAAc;;EAEd,YAAY;;wBAGE,eAAe,mBAAmB;;;;;;wBAUlC,sBACd,kBACA;EACG,QAAQ;EAAY,aAAa;;wBAKtB,sBAAsB;wBAMtB,kBAAkB,kBAAkB,QAAQ"}
@@ -0,0 +1,48 @@
1
+ import { loadDoomConfig, loadDoomConfigLenient } from "@agimon-ai/po-config/config";
2
+ //#region src/composition/projectTrust/index.ts
3
+ const APPROVE_OPTION = "--approve";
4
+ const APPROVE_SHORT_OPTION = "-a";
5
+ const NO_APPROVE_OPTION = "--no-approve";
6
+ const NO_APPROVE_SHORT_OPTION = "-na";
7
+ const PROJECT_TRUST_ALWAYS = "always";
8
+ const PROJECT_TRUST_NEVER = "never";
9
+ function loadDoomConfig$1(repoRoot) {
10
+ const config = loadDoomConfig(repoRoot);
11
+ return {
12
+ projectTrust: config.projectTrust,
13
+ selection: config.selection
14
+ };
15
+ }
16
+ /**
17
+ * Reads the config the way `po sync` needs it: an unknown key is reported
18
+ * rather than fatal, so a config written for a different version cannot break
19
+ * a build. `po doctor` runs the strict read above.
20
+ */
21
+ function loadDoomConfigLenient$1(repoRoot, homeDirectory) {
22
+ const { config, diagnostics } = loadDoomConfigLenient(repoRoot, homeDirectory);
23
+ return {
24
+ config: {
25
+ projectTrust: config.projectTrust,
26
+ selection: config.selection
27
+ },
28
+ diagnostics
29
+ };
30
+ }
31
+ function hasProjectTrustOption(piArgs) {
32
+ return piArgs.some((argument) => [
33
+ APPROVE_OPTION,
34
+ APPROVE_SHORT_OPTION,
35
+ NO_APPROVE_OPTION,
36
+ NO_APPROVE_SHORT_OPTION
37
+ ].includes(argument));
38
+ }
39
+ function applyProjectTrust(piArgs, config) {
40
+ if (hasProjectTrustOption(piArgs)) return [...piArgs];
41
+ if (config.projectTrust === PROJECT_TRUST_ALWAYS) return [APPROVE_OPTION, ...piArgs];
42
+ if (config.projectTrust === PROJECT_TRUST_NEVER) return [NO_APPROVE_OPTION, ...piArgs];
43
+ return [...piArgs];
44
+ }
45
+ //#endregion
46
+ export { applyProjectTrust, hasProjectTrustOption, loadDoomConfig$1 as loadDoomConfig, loadDoomConfigLenient$1 as loadDoomConfigLenient };
47
+
48
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["loadDoomConfig","loadSharedDoomConfig","loadDoomConfigLenient","loadSharedDoomConfigLenient"],"sources":["../../../../src/composition/projectTrust/index.ts"],"sourcesContent":["import {\n loadDoomConfig as loadSharedDoomConfig,\n loadDoomConfigLenient as loadSharedDoomConfigLenient,\n} from '@agimon-ai/po-config/config';\nimport type { ConfigDiagnostic, DoomSelectionConfig, ProjectTrust } from '@agimon-ai/po-config/types';\n\nconst APPROVE_OPTION = '--approve';\nconst APPROVE_SHORT_OPTION = '-a';\nconst NO_APPROVE_OPTION = '--no-approve';\nconst NO_APPROVE_SHORT_OPTION = '-na';\nconst PROJECT_TRUST_ALWAYS: ProjectTrust = 'always';\nconst PROJECT_TRUST_NEVER: ProjectTrust = 'never';\n\nexport type { ProjectTrust };\n\nexport interface DoomConfig {\n projectTrust: ProjectTrust;\n /** The matrix the repository declares by default, read by `po sync`. */\n selection?: DoomSelectionConfig;\n}\n\nexport function loadDoomConfig(repoRoot: string): DoomConfig {\n const config = loadSharedDoomConfig(repoRoot);\n return { projectTrust: config.projectTrust, selection: config.selection };\n}\n\n/**\n * Reads the config the way `po sync` needs it: an unknown key is reported\n * rather than fatal, so a config written for a different version cannot break\n * a build. `po doctor` runs the strict read above.\n */\nexport function loadDoomConfigLenient(\n repoRoot: string,\n homeDirectory?: string,\n): { config: DoomConfig; diagnostics: ConfigDiagnostic[] } {\n const { config, diagnostics } = loadSharedDoomConfigLenient(repoRoot, homeDirectory);\n return { config: { projectTrust: config.projectTrust, selection: config.selection }, diagnostics };\n}\n\nexport function hasProjectTrustOption(piArgs: string[]): boolean {\n return piArgs.some((argument) =>\n [APPROVE_OPTION, APPROVE_SHORT_OPTION, NO_APPROVE_OPTION, NO_APPROVE_SHORT_OPTION].includes(argument),\n );\n}\n\nexport function applyProjectTrust(piArgs: string[], config: DoomConfig): string[] {\n if (hasProjectTrustOption(piArgs)) {\n return [...piArgs];\n }\n if (config.projectTrust === PROJECT_TRUST_ALWAYS) return [APPROVE_OPTION, ...piArgs];\n if (config.projectTrust === PROJECT_TRUST_NEVER) return [NO_APPROVE_OPTION, ...piArgs];\n return [...piArgs];\n}\n"],"mappings":";;AAMA,MAAM,iBAAiB;AACvB,MAAM,uBAAuB;AAC7B,MAAM,oBAAoB;AAC1B,MAAM,0BAA0B;AAChC,MAAM,uBAAqC;AAC3C,MAAM,sBAAoC;AAU1C,SAAgBA,iBAAe,UAA8B;CAC3D,MAAM,SAASC,eAAqB,QAAQ;CAC5C,OAAO;EAAE,cAAc,OAAO;EAAc,WAAW,OAAO;CAAU;AAC1E;;;;;;AAOA,SAAgBC,wBACd,UACA,eACyD;CACzD,MAAM,EAAE,QAAQ,gBAAgBC,sBAA4B,UAAU,aAAa;CACnF,OAAO;EAAE,QAAQ;GAAE,cAAc,OAAO;GAAc,WAAW,OAAO;EAAU;EAAG;CAAY;AACnG;AAEA,SAAgB,sBAAsB,QAA2B;CAC/D,OAAO,OAAO,MAAM,aAClB;EAAC;EAAgB;EAAsB;EAAmB;CAAuB,CAAC,CAAC,SAAS,QAAQ,CACtG;AACF;AAEA,SAAgB,kBAAkB,QAAkB,QAA8B;CAChF,IAAI,sBAAsB,MAAM,GAC9B,OAAO,CAAC,GAAG,MAAM;CAEnB,IAAI,OAAO,iBAAiB,sBAAsB,OAAO,CAAC,gBAAgB,GAAG,MAAM;CACnF,IAAI,OAAO,iBAAiB,qBAAqB,OAAO,CAAC,mBAAmB,GAAG,MAAM;CACrF,OAAO,CAAC,GAAG,MAAM;AACnB"}
@@ -0,0 +1,68 @@
1
+ const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
2
+ let node_fs = require("node:fs");
3
+ node_fs = require_runtime.__toESM(node_fs, 1);
4
+ let node_path = require("node:path");
5
+ node_path = require_runtime.__toESM(node_path, 1);
6
+ let _agimon_ai_po_config_config = require("@agimon-ai/po-config/config");
7
+ let _agimon_ai_po_core_piSettings = require("@agimon-ai/po-core/piSettings");
8
+ //#region src/composition/repository/index.ts
9
+ /** Git's root marker, which may be a directory or a worktree pointer file. */
10
+ const GIT_DIRECTORY = ".git";
11
+ /** A Pi project that has been configured, rather than any stray `.pi` folder. */
12
+ const PI_SETTINGS = node_path.default.join(".pi", "settings.json");
13
+ function isDirectory(target) {
14
+ try {
15
+ return node_fs.default.statSync(target).isDirectory();
16
+ } catch {
17
+ return false;
18
+ }
19
+ }
20
+ function isFile(target) {
21
+ try {
22
+ return node_fs.default.statSync(target).isFile();
23
+ } catch {
24
+ return false;
25
+ }
26
+ }
27
+ /**
28
+ * True when a directory carries a marker Doom Pi is willing to treat as a root.
29
+ *
30
+ * Doom and Pi markers identify configured projects. A Git marker also counts so
31
+ * personal configuration can be synchronized into a new checkout before it has
32
+ * repository-local configuration. Build-tooling markers remain deliberately
33
+ * excluded because they do not establish a repository boundary.
34
+ */
35
+ function isRepositoryRoot(directory) {
36
+ const gitMarker = node_path.default.join(directory, GIT_DIRECTORY);
37
+ return (0, _agimon_ai_po_core_piSettings.hasRepositoryDoomDirectory)(directory) || isFile(node_path.default.join(directory, PI_SETTINGS)) || isDirectory(gitMarker) || isFile(gitMarker);
38
+ }
39
+ /**
40
+ * Walks up from `start` looking for the repository root.
41
+ *
42
+ * The nearest marked ancestor wins, so a session started in a subdirectory
43
+ * resolves to the repository that configured Doom rather than to a parent
44
+ * checkout that happens to sit above it.
45
+ */
46
+ function findRepositoryRoot(start) {
47
+ let directory = node_path.default.resolve(start);
48
+ while (true) {
49
+ if (isRepositoryRoot(directory)) return directory;
50
+ const parent = node_path.default.dirname(directory);
51
+ if (parent === directory) throw new Error(`Could not find repository root from ${start}`);
52
+ directory = parent;
53
+ }
54
+ }
55
+ /** Uses the nearest repository when one exists, otherwise the user's global Doom composition. */
56
+ function resolveDoomConfigurationRoot(start, homeDirectory) {
57
+ try {
58
+ return findRepositoryRoot(start);
59
+ } catch {
60
+ return (0, _agimon_ai_po_config_config.globalDoomConfigDirectory)(homeDirectory);
61
+ }
62
+ }
63
+ //#endregion
64
+ exports.findRepositoryRoot = findRepositoryRoot;
65
+ exports.isRepositoryRoot = isRepositoryRoot;
66
+ exports.resolveDoomConfigurationRoot = resolveDoomConfigurationRoot;
67
+
68
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["path","fs","hasRepositoryDoomDirectory","globalDoomConfigDirectory"],"sources":["../../../../src/composition/repository/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { globalDoomConfigDirectory } from '@agimon-ai/po-config/config';\nimport { hasRepositoryDoomDirectory } from '@agimon-ai/po-core/piSettings';\n\n/** Git's root marker, which may be a directory or a worktree pointer file. */\nconst GIT_DIRECTORY = '.git';\n/** A Pi project that has been configured, rather than any stray `.pi` folder. */\nconst PI_SETTINGS = path.join('.pi', 'settings.json');\n\nfunction isDirectory(target: string): boolean {\n try {\n return fs.statSync(target).isDirectory();\n } catch {\n return false;\n }\n}\n\nfunction isFile(target: string): boolean {\n try {\n return fs.statSync(target).isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * True when a directory carries a marker Doom Pi is willing to treat as a root.\n *\n * Doom and Pi markers identify configured projects. A Git marker also counts so\n * personal configuration can be synchronized into a new checkout before it has\n * repository-local configuration. Build-tooling markers remain deliberately\n * excluded because they do not establish a repository boundary.\n */\nexport function isRepositoryRoot(directory: string): boolean {\n const gitMarker = path.join(directory, GIT_DIRECTORY);\n return (\n hasRepositoryDoomDirectory(directory) ||\n isFile(path.join(directory, PI_SETTINGS)) ||\n isDirectory(gitMarker) ||\n isFile(gitMarker)\n );\n}\n\n/**\n * Walks up from `start` looking for the repository root.\n *\n * The nearest marked ancestor wins, so a session started in a subdirectory\n * resolves to the repository that configured Doom rather than to a parent\n * checkout that happens to sit above it.\n */\nexport function findRepositoryRoot(start: string): string {\n let directory = path.resolve(start);\n while (true) {\n if (isRepositoryRoot(directory)) return directory;\n const parent = path.dirname(directory);\n if (parent === directory) throw new Error(`Could not find repository root from ${start}`);\n directory = parent;\n }\n}\n\n/** Uses the nearest repository when one exists, otherwise the user's global Doom composition. */\nexport function resolveDoomConfigurationRoot(start: string, homeDirectory: string): string {\n try {\n return findRepositoryRoot(start);\n } catch {\n return globalDoomConfigDirectory(homeDirectory);\n }\n}\n"],"mappings":";;;;;;;;;AAOA,MAAM,gBAAgB;;AAEtB,MAAM,cAAcA,UAAAA,QAAK,KAAK,OAAO,eAAe;AAEpD,SAAS,YAAY,QAAyB;CAC5C,IAAI;EACF,OAAOC,QAAAA,QAAG,SAAS,MAAM,CAAC,CAAC,YAAY;CACzC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,OAAO,QAAyB;CACvC,IAAI;EACF,OAAOA,QAAAA,QAAG,SAAS,MAAM,CAAC,CAAC,OAAO;CACpC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;AAUA,SAAgB,iBAAiB,WAA4B;CAC3D,MAAM,YAAYD,UAAAA,QAAK,KAAK,WAAW,aAAa;CACpD,QAAA,GACEE,8BAAAA,2BAAAA,CAA2B,SAAS,KACpC,OAAOF,UAAAA,QAAK,KAAK,WAAW,WAAW,CAAC,KACxC,YAAY,SAAS,KACrB,OAAO,SAAS;AAEpB;;;;;;;;AASA,SAAgB,mBAAmB,OAAuB;CACxD,IAAI,YAAYA,UAAAA,QAAK,QAAQ,KAAK;CAClC,OAAO,MAAM;EACX,IAAI,iBAAiB,SAAS,GAAG,OAAO;EACxC,MAAM,SAASA,UAAAA,QAAK,QAAQ,SAAS;EACrC,IAAI,WAAW,WAAW,MAAM,IAAI,MAAM,uCAAuC,OAAO;EACxF,YAAY;CACd;AACF;;AAGA,SAAgB,6BAA6B,OAAe,eAA+B;CACzF,IAAI;EACF,OAAO,mBAAmB,KAAK;CACjC,QAAQ;EACN,QAAA,GAAOG,4BAAAA,0BAAAA,CAA0B,aAAa;CAChD;AACF"}
@@ -0,0 +1,22 @@
1
+ //#region src/composition/repository/index.d.ts
2
+ /**
3
+ * True when a directory carries a marker Doom Pi is willing to treat as a root.
4
+ *
5
+ * Doom and Pi markers identify configured projects. A Git marker also counts so
6
+ * personal configuration can be synchronized into a new checkout before it has
7
+ * repository-local configuration. Build-tooling markers remain deliberately
8
+ * excluded because they do not establish a repository boundary.
9
+ */
10
+ export declare function isRepositoryRoot(directory: string): boolean;
11
+ /**
12
+ * Walks up from `start` looking for the repository root.
13
+ *
14
+ * The nearest marked ancestor wins, so a session started in a subdirectory
15
+ * resolves to the repository that configured Doom rather than to a parent
16
+ * checkout that happens to sit above it.
17
+ */
18
+ export declare function findRepositoryRoot(start: string): string;
19
+ /** Uses the nearest repository when one exists, otherwise the user's global Doom composition. */
20
+ export declare function resolveDoomConfigurationRoot(start: string, homeDirectory: string): string;
21
+ //#endregion
22
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/composition/repository/index.ts"],"mappings":";;;;;;;;;wBAmCgB,iBAAiB;;;;;;;;wBAiBjB,mBAAmB;;wBAWnB,6BAA6B,eAAe"}
@@ -0,0 +1,63 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { globalDoomConfigDirectory } from "@agimon-ai/po-config/config";
4
+ import { hasRepositoryDoomDirectory } from "@agimon-ai/po-core/piSettings";
5
+ //#region src/composition/repository/index.ts
6
+ /** Git's root marker, which may be a directory or a worktree pointer file. */
7
+ const GIT_DIRECTORY = ".git";
8
+ /** A Pi project that has been configured, rather than any stray `.pi` folder. */
9
+ const PI_SETTINGS = path.join(".pi", "settings.json");
10
+ function isDirectory(target) {
11
+ try {
12
+ return fs.statSync(target).isDirectory();
13
+ } catch {
14
+ return false;
15
+ }
16
+ }
17
+ function isFile(target) {
18
+ try {
19
+ return fs.statSync(target).isFile();
20
+ } catch {
21
+ return false;
22
+ }
23
+ }
24
+ /**
25
+ * True when a directory carries a marker Doom Pi is willing to treat as a root.
26
+ *
27
+ * Doom and Pi markers identify configured projects. A Git marker also counts so
28
+ * personal configuration can be synchronized into a new checkout before it has
29
+ * repository-local configuration. Build-tooling markers remain deliberately
30
+ * excluded because they do not establish a repository boundary.
31
+ */
32
+ function isRepositoryRoot(directory) {
33
+ const gitMarker = path.join(directory, GIT_DIRECTORY);
34
+ return hasRepositoryDoomDirectory(directory) || isFile(path.join(directory, PI_SETTINGS)) || isDirectory(gitMarker) || isFile(gitMarker);
35
+ }
36
+ /**
37
+ * Walks up from `start` looking for the repository root.
38
+ *
39
+ * The nearest marked ancestor wins, so a session started in a subdirectory
40
+ * resolves to the repository that configured Doom rather than to a parent
41
+ * checkout that happens to sit above it.
42
+ */
43
+ function findRepositoryRoot(start) {
44
+ let directory = path.resolve(start);
45
+ while (true) {
46
+ if (isRepositoryRoot(directory)) return directory;
47
+ const parent = path.dirname(directory);
48
+ if (parent === directory) throw new Error(`Could not find repository root from ${start}`);
49
+ directory = parent;
50
+ }
51
+ }
52
+ /** Uses the nearest repository when one exists, otherwise the user's global Doom composition. */
53
+ function resolveDoomConfigurationRoot(start, homeDirectory) {
54
+ try {
55
+ return findRepositoryRoot(start);
56
+ } catch {
57
+ return globalDoomConfigDirectory(homeDirectory);
58
+ }
59
+ }
60
+ //#endregion
61
+ export { findRepositoryRoot, isRepositoryRoot, resolveDoomConfigurationRoot };
62
+
63
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/composition/repository/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { globalDoomConfigDirectory } from '@agimon-ai/po-config/config';\nimport { hasRepositoryDoomDirectory } from '@agimon-ai/po-core/piSettings';\n\n/** Git's root marker, which may be a directory or a worktree pointer file. */\nconst GIT_DIRECTORY = '.git';\n/** A Pi project that has been configured, rather than any stray `.pi` folder. */\nconst PI_SETTINGS = path.join('.pi', 'settings.json');\n\nfunction isDirectory(target: string): boolean {\n try {\n return fs.statSync(target).isDirectory();\n } catch {\n return false;\n }\n}\n\nfunction isFile(target: string): boolean {\n try {\n return fs.statSync(target).isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * True when a directory carries a marker Doom Pi is willing to treat as a root.\n *\n * Doom and Pi markers identify configured projects. A Git marker also counts so\n * personal configuration can be synchronized into a new checkout before it has\n * repository-local configuration. Build-tooling markers remain deliberately\n * excluded because they do not establish a repository boundary.\n */\nexport function isRepositoryRoot(directory: string): boolean {\n const gitMarker = path.join(directory, GIT_DIRECTORY);\n return (\n hasRepositoryDoomDirectory(directory) ||\n isFile(path.join(directory, PI_SETTINGS)) ||\n isDirectory(gitMarker) ||\n isFile(gitMarker)\n );\n}\n\n/**\n * Walks up from `start` looking for the repository root.\n *\n * The nearest marked ancestor wins, so a session started in a subdirectory\n * resolves to the repository that configured Doom rather than to a parent\n * checkout that happens to sit above it.\n */\nexport function findRepositoryRoot(start: string): string {\n let directory = path.resolve(start);\n while (true) {\n if (isRepositoryRoot(directory)) return directory;\n const parent = path.dirname(directory);\n if (parent === directory) throw new Error(`Could not find repository root from ${start}`);\n directory = parent;\n }\n}\n\n/** Uses the nearest repository when one exists, otherwise the user's global Doom composition. */\nexport function resolveDoomConfigurationRoot(start: string, homeDirectory: string): string {\n try {\n return findRepositoryRoot(start);\n } catch {\n return globalDoomConfigDirectory(homeDirectory);\n }\n}\n"],"mappings":";;;;;;AAOA,MAAM,gBAAgB;;AAEtB,MAAM,cAAc,KAAK,KAAK,OAAO,eAAe;AAEpD,SAAS,YAAY,QAAyB;CAC5C,IAAI;EACF,OAAO,GAAG,SAAS,MAAM,CAAC,CAAC,YAAY;CACzC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,OAAO,QAAyB;CACvC,IAAI;EACF,OAAO,GAAG,SAAS,MAAM,CAAC,CAAC,OAAO;CACpC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;AAUA,SAAgB,iBAAiB,WAA4B;CAC3D,MAAM,YAAY,KAAK,KAAK,WAAW,aAAa;CACpD,OACE,2BAA2B,SAAS,KACpC,OAAO,KAAK,KAAK,WAAW,WAAW,CAAC,KACxC,YAAY,SAAS,KACrB,OAAO,SAAS;AAEpB;;;;;;;;AASA,SAAgB,mBAAmB,OAAuB;CACxD,IAAI,YAAY,KAAK,QAAQ,KAAK;CAClC,OAAO,MAAM;EACX,IAAI,iBAAiB,SAAS,GAAG,OAAO;EACxC,MAAM,SAAS,KAAK,QAAQ,SAAS;EACrC,IAAI,WAAW,WAAW,MAAM,IAAI,MAAM,uCAAuC,OAAO;EACxF,YAAY;CACd;AACF;;AAGA,SAAgB,6BAA6B,OAAe,eAA+B;CACzF,IAAI;EACF,OAAO,mBAAmB,KAAK;CACjC,QAAQ;EACN,OAAO,0BAA0B,aAAa;CAChD;AACF"}
@@ -0,0 +1,85 @@
1
+ const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_index = require("../layerPackageInstaller/index.cjs");
3
+ const require_index$1 = require("../poHomeMigration/index.cjs");
4
+ let node_fs = require("node:fs");
5
+ node_fs = require_runtime.__toESM(node_fs, 1);
6
+ let node_path = require("node:path");
7
+ node_path = require_runtime.__toESM(node_path, 1);
8
+ let _agimon_ai_po_core_runtimePackages = require("@agimon-ai/po-core/runtimePackages");
9
+ let _agimon_ai_po_core_runtimePiSettings = require("@agimon-ai/po-core/runtimePiSettings");
10
+ //#region src/composition/syncPrune/index.ts
11
+ /**
12
+ * What an explicit `po sync` drops once its installs and builds are done:
13
+ * - the runtime project's stale entries and store content nothing references (upm's prune,
14
+ * which keeps anything written in the last hour);
15
+ * - global web, native and MCP app builds other than the current key and the one before it.
16
+ *
17
+ * Sync calls this under its lock. Builds are pruned even while a Po server runs: the server
18
+ * serves copies it publishes into `~/.po/server`, not these folders. The runtime is pruned only
19
+ * when no other Po host runs, judged by the same scan that retires `~/.pi/.po`: a running server
20
+ * may be installing into it, and upm's prune cannot be told to keep the previous manifest's
21
+ * packages, so the runtime store grows while a server stays up. The staged catalogue archives
22
+ * under `runtime/catalog` share that gate: a running server imports from them.
23
+ */
24
+ const BUILD_DIRECTORY = "build";
25
+ const BUILD_KINDS = {
26
+ web: "web",
27
+ native: "native",
28
+ mcpApp: "mcp-app"
29
+ };
30
+ const RUNTIME_MANIFEST = "package.json";
31
+ /** Builds an in-flight build writes start with a dot; they are never touched. */
32
+ const TEMPORARY_PREFIX = ".";
33
+ /**
34
+ * Removes every build of one kind except the current keys and the most recently written
35
+ * other key, the one a client that has not refreshed yet may still load.
36
+ */
37
+ function pruneBuilds(buildsRoot, kind, currentKeys) {
38
+ if (currentKeys.length === 0) return [];
39
+ const directory = node_path.default.join(buildsRoot, BUILD_DIRECTORY, kind);
40
+ if (!node_fs.default.existsSync(directory)) return [];
41
+ return node_fs.default.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(TEMPORARY_PREFIX) && !currentKeys.includes(entry.name)).map((entry) => ({
42
+ name: entry.name,
43
+ modified: node_fs.default.statSync(node_path.default.join(directory, entry.name)).mtimeMs
44
+ })).sort((left, right) => right.modified - left.modified).slice(1).map((entry) => {
45
+ node_fs.default.rmSync(node_path.default.join(directory, entry.name), {
46
+ recursive: true,
47
+ force: true
48
+ });
49
+ return `${kind}/${entry.name}`;
50
+ });
51
+ }
52
+ async function pruneAfterSync(input) {
53
+ const poHome = (0, _agimon_ai_po_core_runtimePiSettings.poHomeDirectory)(input.homeDirectory, input.environment);
54
+ const builds = [
55
+ ...pruneBuilds(input.buildsRoot, BUILD_KINDS.web, input.webKey === void 0 ? [] : [input.webKey]),
56
+ ...pruneBuilds(input.buildsRoot, BUILD_KINDS.native, input.nativeKey === void 0 ? [] : [input.nativeKey]),
57
+ ...pruneBuilds(input.buildsRoot, BUILD_KINDS.mcpApp, input.mcpAppKeys ?? [])
58
+ ];
59
+ const hosts = require_index$1.otherPoHosts(poHome, input.scan ?? require_index$1.systemHostScan, input.selfPid ?? process.pid);
60
+ if (hosts.status === "running") return {
61
+ status: "pruned",
62
+ builds,
63
+ runtime: { skipped: hosts.reason }
64
+ };
65
+ const runtimeDirectory = (0, _agimon_ai_po_core_runtimePiSettings.poRuntimeDirectory)(input.homeDirectory, input.environment);
66
+ if (!node_fs.default.existsSync(node_path.default.join(runtimeDirectory, RUNTIME_MANIFEST))) return {
67
+ status: "pruned",
68
+ builds,
69
+ runtime: { skipped: "no runtime packages are installed" }
70
+ };
71
+ require_index.pruneStagedCatalogArchives(runtimeDirectory);
72
+ const result = await (input.pruneRuntime ?? _agimon_ai_po_core_runtimePackages.pruneRuntimePackages)({
73
+ dir: runtimeDirectory,
74
+ poHome
75
+ });
76
+ return {
77
+ status: "pruned",
78
+ builds,
79
+ runtime: { bytes: result.content.bytes + (result.entries?.bytes ?? 0) }
80
+ };
81
+ }
82
+ //#endregion
83
+ exports.pruneAfterSync = pruneAfterSync;
84
+
85
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["path","fs","poHomeDirectory","otherPoHosts","systemHostScan","poRuntimeDirectory","pruneRuntimePackages"],"sources":["../../../../src/composition/syncPrune/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { pruneRuntimePackages } from '@agimon-ai/po-core/runtimePackages';\nimport { poHomeDirectory, poRuntimeDirectory } from '@agimon-ai/po-core/runtimePiSettings';\n\nimport { pruneStagedCatalogArchives } from '../layerPackageInstaller';\nimport { type HostScan, otherPoHosts, systemHostScan } from '../poHomeMigration';\n\n/**\n * What an explicit `po sync` drops once its installs and builds are done:\n * - the runtime project's stale entries and store content nothing references (upm's prune,\n * which keeps anything written in the last hour);\n * - global web, native and MCP app builds other than the current key and the one before it.\n *\n * Sync calls this under its lock. Builds are pruned even while a Po server runs: the server\n * serves copies it publishes into `~/.po/server`, not these folders. The runtime is pruned only\n * when no other Po host runs, judged by the same scan that retires `~/.pi/.po`: a running server\n * may be installing into it, and upm's prune cannot be told to keep the previous manifest's\n * packages, so the runtime store grows while a server stays up. The staged catalogue archives\n * under `runtime/catalog` share that gate: a running server imports from them.\n */\n\nconst BUILD_DIRECTORY = 'build';\nconst BUILD_KINDS = { web: 'web', native: 'native', mcpApp: 'mcp-app' } as const;\nconst RUNTIME_MANIFEST = 'package.json';\n/** Builds an in-flight build writes start with a dot; they are never touched. */\nconst TEMPORARY_PREFIX = '.';\n\nexport interface SyncPruneInput {\n homeDirectory: string;\n environment: NodeJS.ProcessEnv;\n /** The root the global builds live under: `<root>/build/web/<key>`, `<root>/build/mcp-app/<key>`. */\n buildsRoot: string;\n /** The current global web build key; without one the web builds are left alone. */\n webKey?: string;\n /** The current global native build key; without one the native builds are left alone. */\n nativeKey?: string;\n /** The current MCP app build keys, one per distinct widget set; without any the MCP app builds are left alone. */\n mcpAppKeys?: readonly string[];\n /** Test seams. */\n scan?: HostScan;\n selfPid?: number;\n pruneRuntime?: typeof pruneRuntimePackages;\n}\n\nexport interface SyncPruneResult {\n status: 'pruned';\n /** Build directories removed, as `<kind>/<key>`. */\n builds: string[];\n /** Store bytes upm released, or why the runtime was not pruned. */\n runtime: { bytes: number } | { skipped: string };\n}\n\n/**\n * Removes every build of one kind except the current keys and the most recently written\n * other key, the one a client that has not refreshed yet may still load.\n */\nfunction pruneBuilds(buildsRoot: string, kind: string, currentKeys: readonly string[]): string[] {\n if (currentKeys.length === 0) return [];\n const directory = path.join(buildsRoot, BUILD_DIRECTORY, kind);\n if (!fs.existsSync(directory)) return [];\n const others = fs\n .readdirSync(directory, { withFileTypes: true })\n .filter(\n (entry) => entry.isDirectory() && !entry.name.startsWith(TEMPORARY_PREFIX) && !currentKeys.includes(entry.name),\n )\n .map((entry) => ({ name: entry.name, modified: fs.statSync(path.join(directory, entry.name)).mtimeMs }))\n .sort((left, right) => right.modified - left.modified);\n return others.slice(1).map((entry) => {\n fs.rmSync(path.join(directory, entry.name), { recursive: true, force: true });\n return `${kind}/${entry.name}`;\n });\n}\n\nexport async function pruneAfterSync(input: SyncPruneInput): Promise<SyncPruneResult> {\n const poHome = poHomeDirectory(input.homeDirectory, input.environment);\n const builds = [\n ...pruneBuilds(input.buildsRoot, BUILD_KINDS.web, input.webKey === undefined ? [] : [input.webKey]),\n ...pruneBuilds(input.buildsRoot, BUILD_KINDS.native, input.nativeKey === undefined ? [] : [input.nativeKey]),\n ...pruneBuilds(input.buildsRoot, BUILD_KINDS.mcpApp, input.mcpAppKeys ?? []),\n ];\n // ponytail: upm's prune has no keep-list, so the previous manifest cannot be protected while a\n // server runs; the runtime and its staged catalogue folders stay gated on no other host. A keep\n // option in upm is the upgrade.\n const hosts = otherPoHosts(poHome, input.scan ?? systemHostScan, input.selfPid ?? process.pid);\n if (hosts.status === 'running') return { status: 'pruned', builds, runtime: { skipped: hosts.reason } };\n const runtimeDirectory = poRuntimeDirectory(input.homeDirectory, input.environment);\n if (!fs.existsSync(path.join(runtimeDirectory, RUNTIME_MANIFEST))) {\n return { status: 'pruned', builds, runtime: { skipped: 'no runtime packages are installed' } };\n }\n pruneStagedCatalogArchives(runtimeDirectory);\n const result = await (input.pruneRuntime ?? pruneRuntimePackages)({ dir: runtimeDirectory, poHome });\n return {\n status: 'pruned',\n builds,\n runtime: { bytes: result.content.bytes + (result.entries?.bytes ?? 0) },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,kBAAkB;AACxB,MAAM,cAAc;CAAE,KAAK;CAAO,QAAQ;CAAU,QAAQ;AAAU;AACtE,MAAM,mBAAmB;;AAEzB,MAAM,mBAAmB;;;;;AA+BzB,SAAS,YAAY,YAAoB,MAAc,aAA0C;CAC/F,IAAI,YAAY,WAAW,GAAG,OAAO,CAAC;CACtC,MAAM,YAAYA,UAAAA,QAAK,KAAK,YAAY,iBAAiB,IAAI;CAC7D,IAAI,CAACC,QAAAA,QAAG,WAAW,SAAS,GAAG,OAAO,CAAC;CAQvC,OAPeA,QAAAA,QACZ,YAAY,WAAW,EAAE,eAAe,KAAK,CAAC,CAAC,CAC/C,QACE,UAAU,MAAM,YAAY,KAAK,CAAC,MAAM,KAAK,WAAW,gBAAgB,KAAK,CAAC,YAAY,SAAS,MAAM,IAAI,CAChH,CAAC,CACA,KAAK,WAAW;EAAE,MAAM,MAAM;EAAM,UAAUA,QAAAA,QAAG,SAASD,UAAAA,QAAK,KAAK,WAAW,MAAM,IAAI,CAAC,CAAC,CAAC;CAAQ,EAAE,CAAC,CACvG,MAAM,MAAM,UAAU,MAAM,WAAW,KAAK,QACnC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU;EACpC,QAAA,QAAG,OAAOA,UAAAA,QAAK,KAAK,WAAW,MAAM,IAAI,GAAG;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EAC5E,OAAO,GAAG,KAAK,GAAG,MAAM;CAC1B,CAAC;AACH;AAEA,eAAsB,eAAe,OAAiD;CACpF,MAAM,UAAA,GAASE,qCAAAA,gBAAAA,CAAgB,MAAM,eAAe,MAAM,WAAW;CACrE,MAAM,SAAS;EACb,GAAG,YAAY,MAAM,YAAY,YAAY,KAAK,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC;EAClG,GAAG,YAAY,MAAM,YAAY,YAAY,QAAQ,MAAM,cAAc,KAAA,IAAY,CAAC,IAAI,CAAC,MAAM,SAAS,CAAC;EAC3G,GAAG,YAAY,MAAM,YAAY,YAAY,QAAQ,MAAM,cAAc,CAAC,CAAC;CAC7E;CAIA,MAAM,QAAQC,gBAAAA,aAAa,QAAQ,MAAM,QAAQC,gBAAAA,gBAAgB,MAAM,WAAW,QAAQ,GAAG;CAC7F,IAAI,MAAM,WAAW,WAAW,OAAO;EAAE,QAAQ;EAAU;EAAQ,SAAS,EAAE,SAAS,MAAM,OAAO;CAAE;CACtG,MAAM,oBAAA,GAAmBC,qCAAAA,mBAAAA,CAAmB,MAAM,eAAe,MAAM,WAAW;CAClF,IAAI,CAACJ,QAAAA,QAAG,WAAWD,UAAAA,QAAK,KAAK,kBAAkB,gBAAgB,CAAC,GAC9D,OAAO;EAAE,QAAQ;EAAU;EAAQ,SAAS,EAAE,SAAS,oCAAoC;CAAE;CAE/F,cAAA,2BAA2B,gBAAgB;CAC3C,MAAM,SAAS,OAAO,MAAM,gBAAgBM,mCAAAA,qBAAAA,CAAsB;EAAE,KAAK;EAAkB;CAAO,CAAC;CACnG,OAAO;EACL,QAAQ;EACR;EACA,SAAS,EAAE,OAAO,OAAO,QAAQ,SAAS,OAAO,SAAS,SAAS,GAAG;CACxE;AACF"}
@@ -0,0 +1,33 @@
1
+ import { HostScan } from "../poHomeMigration/index.mjs";
2
+ import { pruneRuntimePackages } from "@agimon-ai/po-core/runtimePackages";
3
+ //#region src/composition/syncPrune/index.d.ts
4
+ export interface SyncPruneInput {
5
+ homeDirectory: string;
6
+ environment: NodeJS.ProcessEnv;
7
+ /** The root the global builds live under: `<root>/build/web/<key>`, `<root>/build/mcp-app/<key>`. */
8
+ buildsRoot: string;
9
+ /** The current global web build key; without one the web builds are left alone. */
10
+ webKey?: string;
11
+ /** The current global native build key; without one the native builds are left alone. */
12
+ nativeKey?: string;
13
+ /** The current MCP app build keys, one per distinct widget set; without any the MCP app builds are left alone. */
14
+ mcpAppKeys?: readonly string[];
15
+ /** Test seams. */
16
+ scan?: HostScan;
17
+ selfPid?: number;
18
+ pruneRuntime?: typeof pruneRuntimePackages;
19
+ }
20
+ export interface SyncPruneResult {
21
+ status: 'pruned';
22
+ /** Build directories removed, as `<kind>/<key>`. */
23
+ builds: string[];
24
+ /** Store bytes upm released, or why the runtime was not pruned. */
25
+ runtime: {
26
+ bytes: number;
27
+ } | {
28
+ skipped: string;
29
+ };
30
+ }
31
+ export declare function pruneAfterSync(input: SyncPruneInput): Promise<SyncPruneResult>;
32
+ //#endregion
33
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/composition/syncPrune/index.ts"],"mappings":";;;iBA6BiB;EACf;EACA,aAAa,OAAO;;EAEpB;;EAEA;;EAEA;;EAEA;;EAEA,OAAO;EACP;EACA,sBAAsB;;iBAGP;EACf;;EAEA;;EAEA;IAAW;;IAAoB;;;wBAwBX,eAAe,OAAO,iBAAiB,QAAQ"}
@@ -0,0 +1,82 @@
1
+ import { pruneStagedCatalogArchives } from "../layerPackageInstaller/index.mjs";
2
+ import { otherPoHosts, systemHostScan } from "../poHomeMigration/index.mjs";
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { pruneRuntimePackages } from "@agimon-ai/po-core/runtimePackages";
6
+ import { poHomeDirectory, poRuntimeDirectory } from "@agimon-ai/po-core/runtimePiSettings";
7
+ //#region src/composition/syncPrune/index.ts
8
+ /**
9
+ * What an explicit `po sync` drops once its installs and builds are done:
10
+ * - the runtime project's stale entries and store content nothing references (upm's prune,
11
+ * which keeps anything written in the last hour);
12
+ * - global web, native and MCP app builds other than the current key and the one before it.
13
+ *
14
+ * Sync calls this under its lock. Builds are pruned even while a Po server runs: the server
15
+ * serves copies it publishes into `~/.po/server`, not these folders. The runtime is pruned only
16
+ * when no other Po host runs, judged by the same scan that retires `~/.pi/.po`: a running server
17
+ * may be installing into it, and upm's prune cannot be told to keep the previous manifest's
18
+ * packages, so the runtime store grows while a server stays up. The staged catalogue archives
19
+ * under `runtime/catalog` share that gate: a running server imports from them.
20
+ */
21
+ const BUILD_DIRECTORY = "build";
22
+ const BUILD_KINDS = {
23
+ web: "web",
24
+ native: "native",
25
+ mcpApp: "mcp-app"
26
+ };
27
+ const RUNTIME_MANIFEST = "package.json";
28
+ /** Builds an in-flight build writes start with a dot; they are never touched. */
29
+ const TEMPORARY_PREFIX = ".";
30
+ /**
31
+ * Removes every build of one kind except the current keys and the most recently written
32
+ * other key, the one a client that has not refreshed yet may still load.
33
+ */
34
+ function pruneBuilds(buildsRoot, kind, currentKeys) {
35
+ if (currentKeys.length === 0) return [];
36
+ const directory = path.join(buildsRoot, BUILD_DIRECTORY, kind);
37
+ if (!fs.existsSync(directory)) return [];
38
+ return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(TEMPORARY_PREFIX) && !currentKeys.includes(entry.name)).map((entry) => ({
39
+ name: entry.name,
40
+ modified: fs.statSync(path.join(directory, entry.name)).mtimeMs
41
+ })).sort((left, right) => right.modified - left.modified).slice(1).map((entry) => {
42
+ fs.rmSync(path.join(directory, entry.name), {
43
+ recursive: true,
44
+ force: true
45
+ });
46
+ return `${kind}/${entry.name}`;
47
+ });
48
+ }
49
+ async function pruneAfterSync(input) {
50
+ const poHome = poHomeDirectory(input.homeDirectory, input.environment);
51
+ const builds = [
52
+ ...pruneBuilds(input.buildsRoot, BUILD_KINDS.web, input.webKey === void 0 ? [] : [input.webKey]),
53
+ ...pruneBuilds(input.buildsRoot, BUILD_KINDS.native, input.nativeKey === void 0 ? [] : [input.nativeKey]),
54
+ ...pruneBuilds(input.buildsRoot, BUILD_KINDS.mcpApp, input.mcpAppKeys ?? [])
55
+ ];
56
+ const hosts = otherPoHosts(poHome, input.scan ?? systemHostScan, input.selfPid ?? process.pid);
57
+ if (hosts.status === "running") return {
58
+ status: "pruned",
59
+ builds,
60
+ runtime: { skipped: hosts.reason }
61
+ };
62
+ const runtimeDirectory = poRuntimeDirectory(input.homeDirectory, input.environment);
63
+ if (!fs.existsSync(path.join(runtimeDirectory, RUNTIME_MANIFEST))) return {
64
+ status: "pruned",
65
+ builds,
66
+ runtime: { skipped: "no runtime packages are installed" }
67
+ };
68
+ pruneStagedCatalogArchives(runtimeDirectory);
69
+ const result = await (input.pruneRuntime ?? pruneRuntimePackages)({
70
+ dir: runtimeDirectory,
71
+ poHome
72
+ });
73
+ return {
74
+ status: "pruned",
75
+ builds,
76
+ runtime: { bytes: result.content.bytes + (result.entries?.bytes ?? 0) }
77
+ };
78
+ }
79
+ //#endregion
80
+ export { pruneAfterSync };
81
+
82
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/composition/syncPrune/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { pruneRuntimePackages } from '@agimon-ai/po-core/runtimePackages';\nimport { poHomeDirectory, poRuntimeDirectory } from '@agimon-ai/po-core/runtimePiSettings';\n\nimport { pruneStagedCatalogArchives } from '../layerPackageInstaller';\nimport { type HostScan, otherPoHosts, systemHostScan } from '../poHomeMigration';\n\n/**\n * What an explicit `po sync` drops once its installs and builds are done:\n * - the runtime project's stale entries and store content nothing references (upm's prune,\n * which keeps anything written in the last hour);\n * - global web, native and MCP app builds other than the current key and the one before it.\n *\n * Sync calls this under its lock. Builds are pruned even while a Po server runs: the server\n * serves copies it publishes into `~/.po/server`, not these folders. The runtime is pruned only\n * when no other Po host runs, judged by the same scan that retires `~/.pi/.po`: a running server\n * may be installing into it, and upm's prune cannot be told to keep the previous manifest's\n * packages, so the runtime store grows while a server stays up. The staged catalogue archives\n * under `runtime/catalog` share that gate: a running server imports from them.\n */\n\nconst BUILD_DIRECTORY = 'build';\nconst BUILD_KINDS = { web: 'web', native: 'native', mcpApp: 'mcp-app' } as const;\nconst RUNTIME_MANIFEST = 'package.json';\n/** Builds an in-flight build writes start with a dot; they are never touched. */\nconst TEMPORARY_PREFIX = '.';\n\nexport interface SyncPruneInput {\n homeDirectory: string;\n environment: NodeJS.ProcessEnv;\n /** The root the global builds live under: `<root>/build/web/<key>`, `<root>/build/mcp-app/<key>`. */\n buildsRoot: string;\n /** The current global web build key; without one the web builds are left alone. */\n webKey?: string;\n /** The current global native build key; without one the native builds are left alone. */\n nativeKey?: string;\n /** The current MCP app build keys, one per distinct widget set; without any the MCP app builds are left alone. */\n mcpAppKeys?: readonly string[];\n /** Test seams. */\n scan?: HostScan;\n selfPid?: number;\n pruneRuntime?: typeof pruneRuntimePackages;\n}\n\nexport interface SyncPruneResult {\n status: 'pruned';\n /** Build directories removed, as `<kind>/<key>`. */\n builds: string[];\n /** Store bytes upm released, or why the runtime was not pruned. */\n runtime: { bytes: number } | { skipped: string };\n}\n\n/**\n * Removes every build of one kind except the current keys and the most recently written\n * other key, the one a client that has not refreshed yet may still load.\n */\nfunction pruneBuilds(buildsRoot: string, kind: string, currentKeys: readonly string[]): string[] {\n if (currentKeys.length === 0) return [];\n const directory = path.join(buildsRoot, BUILD_DIRECTORY, kind);\n if (!fs.existsSync(directory)) return [];\n const others = fs\n .readdirSync(directory, { withFileTypes: true })\n .filter(\n (entry) => entry.isDirectory() && !entry.name.startsWith(TEMPORARY_PREFIX) && !currentKeys.includes(entry.name),\n )\n .map((entry) => ({ name: entry.name, modified: fs.statSync(path.join(directory, entry.name)).mtimeMs }))\n .sort((left, right) => right.modified - left.modified);\n return others.slice(1).map((entry) => {\n fs.rmSync(path.join(directory, entry.name), { recursive: true, force: true });\n return `${kind}/${entry.name}`;\n });\n}\n\nexport async function pruneAfterSync(input: SyncPruneInput): Promise<SyncPruneResult> {\n const poHome = poHomeDirectory(input.homeDirectory, input.environment);\n const builds = [\n ...pruneBuilds(input.buildsRoot, BUILD_KINDS.web, input.webKey === undefined ? [] : [input.webKey]),\n ...pruneBuilds(input.buildsRoot, BUILD_KINDS.native, input.nativeKey === undefined ? [] : [input.nativeKey]),\n ...pruneBuilds(input.buildsRoot, BUILD_KINDS.mcpApp, input.mcpAppKeys ?? []),\n ];\n // ponytail: upm's prune has no keep-list, so the previous manifest cannot be protected while a\n // server runs; the runtime and its staged catalogue folders stay gated on no other host. A keep\n // option in upm is the upgrade.\n const hosts = otherPoHosts(poHome, input.scan ?? systemHostScan, input.selfPid ?? process.pid);\n if (hosts.status === 'running') return { status: 'pruned', builds, runtime: { skipped: hosts.reason } };\n const runtimeDirectory = poRuntimeDirectory(input.homeDirectory, input.environment);\n if (!fs.existsSync(path.join(runtimeDirectory, RUNTIME_MANIFEST))) {\n return { status: 'pruned', builds, runtime: { skipped: 'no runtime packages are installed' } };\n }\n pruneStagedCatalogArchives(runtimeDirectory);\n const result = await (input.pruneRuntime ?? pruneRuntimePackages)({ dir: runtimeDirectory, poHome });\n return {\n status: 'pruned',\n builds,\n runtime: { bytes: result.content.bytes + (result.entries?.bytes ?? 0) },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,kBAAkB;AACxB,MAAM,cAAc;CAAE,KAAK;CAAO,QAAQ;CAAU,QAAQ;AAAU;AACtE,MAAM,mBAAmB;;AAEzB,MAAM,mBAAmB;;;;;AA+BzB,SAAS,YAAY,YAAoB,MAAc,aAA0C;CAC/F,IAAI,YAAY,WAAW,GAAG,OAAO,CAAC;CACtC,MAAM,YAAY,KAAK,KAAK,YAAY,iBAAiB,IAAI;CAC7D,IAAI,CAAC,GAAG,WAAW,SAAS,GAAG,OAAO,CAAC;CAQvC,OAPe,GACZ,YAAY,WAAW,EAAE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