@agimon-ai/po 0.0.0-alpha.4 → 0.0.0-alpha.41

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 (389) hide show
  1. package/LICENSE +149 -21
  2. package/README.md +19 -24
  3. package/dist/bin/cli.cjs +37 -14
  4. package/dist/bin/cli.cjs.map +1 -1
  5. package/dist/bin/cli.mjs +34 -14
  6. package/dist/bin/cli.mjs.map +1 -1
  7. package/dist/bin/serve.cjs +25 -17
  8. package/dist/bin/serve.cjs.map +1 -1
  9. package/dist/bin/serve.mjs +25 -17
  10. package/dist/bin/serve.mjs.map +1 -1
  11. package/dist/builders/cli/extensionAssembler/index.cjs +16 -15
  12. package/dist/builders/cli/extensionAssembler/index.cjs.map +1 -1
  13. package/dist/builders/cli/extensionAssembler/index.d.mts +1 -1
  14. package/dist/builders/cli/extensionAssembler/index.d.mts.map +1 -1
  15. package/dist/builders/cli/extensionAssembler/index.mjs +16 -15
  16. package/dist/builders/cli/extensionAssembler/index.mjs.map +1 -1
  17. package/dist/catalog/index.json +100 -89
  18. package/dist/cli.cjs +9 -14
  19. package/dist/cli.d.mts +1 -3
  20. package/dist/cli.mjs +1 -3
  21. package/dist/commands.cjs +13 -15
  22. package/dist/commands.d.mts +1 -2
  23. package/dist/commands.mjs +1 -2
  24. package/dist/config.cjs +0 -6
  25. package/dist/config.d.mts +2 -2
  26. package/dist/config.mjs +2 -2
  27. package/dist/extensions/server.cjs +11 -7
  28. package/dist/extensions/server.cjs.map +1 -1
  29. package/dist/extensions/server.d.mts +2 -2
  30. package/dist/extensions/server.d.mts.map +1 -1
  31. package/dist/extensions/server.mjs +12 -8
  32. package/dist/extensions/server.mjs.map +1 -1
  33. package/dist/help.cjs +9 -11
  34. package/dist/help.d.mts +1 -2
  35. package/dist/help.mjs +1 -2
  36. package/dist/index.cjs +29 -56
  37. package/dist/index.d.mts +3 -13
  38. package/dist/index.mjs +3 -11
  39. package/dist/repository.cjs +1 -0
  40. package/dist/repository.d.mts +2 -2
  41. package/dist/repository.mjs +1 -1
  42. package/dist/services.cjs +2 -16
  43. package/dist/services.d.mts +1 -6
  44. package/dist/services.mjs +1 -6
  45. package/dist/shared.cjs +4 -17
  46. package/dist/shared.d.mts +2 -2
  47. package/dist/shared.mjs +1 -1
  48. package/dist/src/bin/agentDirectory.cjs +16 -50
  49. package/dist/src/bin/agentDirectory.cjs.map +1 -1
  50. package/dist/src/bin/agentDirectory.mjs +15 -50
  51. package/dist/src/bin/agentDirectory.mjs.map +1 -1
  52. package/dist/src/builders/apiContractExport/index.cjs +8 -8
  53. package/dist/src/builders/apiContractExport/index.cjs.map +1 -1
  54. package/dist/src/builders/apiContractExport/index.mjs +8 -8
  55. package/dist/src/builders/apiContractExport/index.mjs.map +1 -1
  56. package/dist/src/builders/cli/entryResolution.cjs +2 -2
  57. package/dist/src/builders/cli/entryResolution.mjs +1 -1
  58. package/dist/src/builders/cli/harnessContext.cjs +16 -16
  59. package/dist/src/builders/cli/harnessContext.cjs.map +1 -1
  60. package/dist/src/builders/cli/harnessContext.d.mts +0 -1
  61. package/dist/src/builders/cli/harnessContext.d.mts.map +1 -1
  62. package/dist/src/builders/cli/harnessContext.mjs +16 -16
  63. package/dist/src/builders/cli/harnessContext.mjs.map +1 -1
  64. package/dist/src/builders/cli/sessionComposition.cjs +2 -6
  65. package/dist/src/builders/cli/sessionComposition.cjs.map +1 -1
  66. package/dist/src/builders/cli/sessionComposition.mjs +3 -6
  67. package/dist/src/builders/cli/sessionComposition.mjs.map +1 -1
  68. package/dist/src/builders/isolate/compile.cjs +134 -0
  69. package/dist/src/builders/isolate/compile.cjs.map +1 -0
  70. package/dist/src/builders/isolate/compile.mjs +129 -0
  71. package/dist/src/builders/isolate/compile.mjs.map +1 -0
  72. package/dist/src/builders/isolate/index.cjs +191 -0
  73. package/dist/src/builders/isolate/index.cjs.map +1 -0
  74. package/dist/src/builders/isolate/index.mjs +188 -0
  75. package/dist/src/builders/isolate/index.mjs.map +1 -0
  76. package/dist/src/builders/isolate/membrane.cjs +187 -0
  77. package/dist/src/builders/isolate/membrane.cjs.map +1 -0
  78. package/dist/src/builders/isolate/membrane.mjs +187 -0
  79. package/dist/src/builders/isolate/membrane.mjs.map +1 -0
  80. package/dist/src/builders/native/index.cjs +27 -2
  81. package/dist/src/builders/native/index.cjs.map +1 -1
  82. package/dist/src/builders/native/index.d.mts.map +1 -1
  83. package/dist/src/builders/native/index.mjs +26 -3
  84. package/dist/src/builders/native/index.mjs.map +1 -1
  85. package/dist/src/builders/npm/index.cjs +70 -0
  86. package/dist/src/builders/npm/index.cjs.map +1 -0
  87. package/dist/src/builders/npm/index.mjs +67 -0
  88. package/dist/src/builders/npm/index.mjs.map +1 -0
  89. package/dist/src/builders/server/backgroundSync.cjs +19 -4
  90. package/dist/src/builders/server/backgroundSync.cjs.map +1 -1
  91. package/dist/src/builders/server/backgroundSync.mjs +18 -3
  92. package/dist/src/builders/server/backgroundSync.mjs.map +1 -1
  93. package/dist/src/builders/server/bundlerService.cjs +151 -0
  94. package/dist/src/builders/server/bundlerService.cjs.map +1 -0
  95. package/dist/src/builders/server/bundlerService.mjs +151 -0
  96. package/dist/src/builders/server/bundlerService.mjs.map +1 -0
  97. package/dist/src/builders/server/computerUseBinding.cjs +18 -1
  98. package/dist/src/builders/server/computerUseBinding.cjs.map +1 -1
  99. package/dist/src/builders/server/computerUseBinding.mjs +18 -1
  100. package/dist/src/builders/server/computerUseBinding.mjs.map +1 -1
  101. package/dist/src/builders/server/computerUseRecordings.cjs +2 -2
  102. package/dist/src/builders/server/computerUseRecordings.cjs.map +1 -1
  103. package/dist/src/builders/server/computerUseRecordings.mjs +4 -4
  104. package/dist/src/builders/server/computerUseRecordings.mjs.map +1 -1
  105. package/dist/src/builders/server/containedSessions.cjs +138 -0
  106. package/dist/src/builders/server/containedSessions.cjs.map +1 -0
  107. package/dist/src/builders/server/containedSessions.mjs +132 -0
  108. package/dist/src/builders/server/containedSessions.mjs.map +1 -0
  109. package/dist/src/builders/server/defaultWorkspace.cjs +3 -3
  110. package/dist/src/builders/server/defaultWorkspace.mjs +2 -2
  111. package/dist/src/builders/server/hostModelGateway.cjs +41 -0
  112. package/dist/src/builders/server/hostModelGateway.cjs.map +1 -0
  113. package/dist/src/builders/server/hostModelGateway.mjs +39 -0
  114. package/dist/src/builders/server/hostModelGateway.mjs.map +1 -0
  115. package/dist/src/builders/server/idleRestart.cjs +49 -13
  116. package/dist/src/builders/server/idleRestart.cjs.map +1 -1
  117. package/dist/src/builders/server/idleRestart.mjs +47 -13
  118. package/dist/src/builders/server/idleRestart.mjs.map +1 -1
  119. package/dist/src/builders/server/index.cjs +8 -8
  120. package/dist/src/builders/server/index.cjs.map +1 -1
  121. package/dist/src/builders/server/index.mjs +7 -7
  122. package/dist/src/builders/server/index.mjs.map +1 -1
  123. package/dist/src/builders/server/logSink.cjs +15 -13
  124. package/dist/src/builders/server/logSink.cjs.map +1 -1
  125. package/dist/src/builders/server/logSink.mjs +14 -12
  126. package/dist/src/builders/server/logSink.mjs.map +1 -1
  127. package/dist/src/builders/server/mcpApp.cjs +3 -3
  128. package/dist/src/builders/server/mcpApp.mjs +1 -1
  129. package/dist/src/builders/server/mcpAppBuild.cjs +2 -2
  130. package/dist/src/builders/server/mcpAppBuild.mjs +1 -1
  131. package/dist/src/builders/server/mcpBundle.cjs +2 -2
  132. package/dist/src/builders/server/mcpBundle.cjs.map +1 -1
  133. package/dist/src/builders/server/mcpBundle.d.mts +1 -1
  134. package/dist/src/builders/server/mcpBundle.mjs +1 -1
  135. package/dist/src/builders/server/mcpBundle.mjs.map +1 -1
  136. package/dist/src/builders/server/nativePush.cjs +182 -0
  137. package/dist/src/builders/server/nativePush.cjs.map +1 -0
  138. package/dist/src/builders/server/nativePush.mjs +181 -0
  139. package/dist/src/builders/server/nativePush.mjs.map +1 -0
  140. package/dist/src/builders/server/packageUrl.cjs +9 -10
  141. package/dist/src/builders/server/packageUrl.cjs.map +1 -1
  142. package/dist/src/builders/server/packageUrl.mjs +8 -9
  143. package/dist/src/builders/server/packageUrl.mjs.map +1 -1
  144. package/dist/src/builders/server/runtime.cjs +859 -343
  145. package/dist/src/builders/server/runtime.cjs.map +1 -1
  146. package/dist/src/builders/server/runtime.mjs +868 -352
  147. package/dist/src/builders/server/runtime.mjs.map +1 -1
  148. package/dist/src/builders/server/runtimeResources.cjs +2 -0
  149. package/dist/src/builders/server/runtimeResources.cjs.map +1 -1
  150. package/dist/src/builders/server/runtimeResources.mjs +2 -0
  151. package/dist/src/builders/server/runtimeResources.mjs.map +1 -1
  152. package/dist/src/builders/server/sandboxRouter.cjs +733 -0
  153. package/dist/src/builders/server/sandboxRouter.cjs.map +1 -0
  154. package/dist/src/builders/server/sandboxRouter.mjs +729 -0
  155. package/dist/src/builders/server/sandboxRouter.mjs.map +1 -0
  156. package/dist/src/builders/server/sandboxSessionHandoff.cjs +289 -0
  157. package/dist/src/builders/server/sandboxSessionHandoff.cjs.map +1 -0
  158. package/dist/src/builders/server/sandboxSessionHandoff.mjs +278 -0
  159. package/dist/src/builders/server/sandboxSessionHandoff.mjs.map +1 -0
  160. package/dist/src/builders/server/sessionArguments.cjs +26 -0
  161. package/dist/src/builders/server/sessionArguments.cjs.map +1 -1
  162. package/dist/src/builders/server/sessionArguments.mjs +26 -1
  163. package/dist/src/builders/server/sessionArguments.mjs.map +1 -1
  164. package/dist/src/builders/server/shutdown.cjs +23 -0
  165. package/dist/src/builders/server/shutdown.cjs.map +1 -1
  166. package/dist/src/builders/server/shutdown.mjs +21 -1
  167. package/dist/src/builders/server/shutdown.mjs.map +1 -1
  168. package/dist/src/builders/server/watcherService.cjs +65 -0
  169. package/dist/src/builders/server/watcherService.cjs.map +1 -0
  170. package/dist/src/builders/server/watcherService.mjs +61 -0
  171. package/dist/src/builders/server/watcherService.mjs.map +1 -0
  172. package/dist/src/builders/server/workspaceCheckout.cjs +5 -10
  173. package/dist/src/builders/server/workspaceCheckout.cjs.map +1 -1
  174. package/dist/src/builders/server/workspaceCheckout.mjs +6 -9
  175. package/dist/src/builders/server/workspaceCheckout.mjs.map +1 -1
  176. package/dist/src/builders/web/bundle.cjs +2 -2
  177. package/dist/src/builders/web/bundle.cjs.map +1 -1
  178. package/dist/src/builders/web/bundle.d.mts +3 -3
  179. package/dist/src/builders/web/bundle.mjs +1 -1
  180. package/dist/src/builders/web/bundle.mjs.map +1 -1
  181. package/dist/src/builders/web/index.cjs +4 -4
  182. package/dist/src/builders/web/index.cjs.map +1 -1
  183. package/dist/src/builders/web/index.mjs +2 -2
  184. package/dist/src/builders/web/index.mjs.map +1 -1
  185. package/dist/src/builders/web/webPluginGenerate.cjs +7 -18
  186. package/dist/src/builders/web/webPluginGenerate.cjs.map +1 -1
  187. package/dist/src/builders/web/webPluginGenerate.d.mts +5 -9
  188. package/dist/src/builders/web/webPluginGenerate.d.mts.map +1 -1
  189. package/dist/src/builders/web/webPluginGenerate.mjs +5 -16
  190. package/dist/src/builders/web/webPluginGenerate.mjs.map +1 -1
  191. package/dist/src/builders/web/webPluginManifest.cjs +2 -2
  192. package/dist/src/builders/web/webPluginManifest.mjs +1 -1
  193. package/dist/src/builders/web/webPluginScan.cjs +2 -2
  194. package/dist/src/builders/web/webPluginScan.mjs +1 -1
  195. package/dist/src/builders/web/webPluginVite.cjs +3 -3
  196. package/dist/src/builders/web/webPluginVite.mjs +1 -1
  197. package/dist/src/cli/cliApp.cjs +9 -9
  198. package/dist/src/cli/cliApp.cjs.map +1 -1
  199. package/dist/src/cli/cliApp.d.mts.map +1 -1
  200. package/dist/src/cli/cliApp.mjs +9 -9
  201. package/dist/src/cli/cliApp.mjs.map +1 -1
  202. package/dist/src/cli/commands/doctor/index.cjs +1 -1
  203. package/dist/src/cli/commands/doctor/index.mjs +1 -1
  204. package/dist/src/cli/commands/explain/index.cjs +4 -6
  205. package/dist/src/cli/commands/explain/index.cjs.map +1 -1
  206. package/dist/src/cli/commands/explain/index.d.mts +0 -2
  207. package/dist/src/cli/commands/explain/index.d.mts.map +1 -1
  208. package/dist/src/cli/commands/explain/index.mjs +3 -5
  209. package/dist/src/cli/commands/explain/index.mjs.map +1 -1
  210. package/dist/src/cli/commands/sync/help.cjs +2 -1
  211. package/dist/src/cli/commands/sync/help.cjs.map +1 -1
  212. package/dist/src/cli/commands/sync/help.mjs +2 -1
  213. package/dist/src/cli/commands/sync/help.mjs.map +1 -1
  214. package/dist/src/cli/commands/sync/index.cjs +45 -5
  215. package/dist/src/cli/commands/sync/index.cjs.map +1 -1
  216. package/dist/src/cli/commands/sync/index.d.mts.map +1 -1
  217. package/dist/src/cli/commands/sync/index.mjs +44 -4
  218. package/dist/src/cli/commands/sync/index.mjs.map +1 -1
  219. package/dist/src/cli/commands/web/index.cjs +4 -21
  220. package/dist/src/cli/commands/web/index.cjs.map +1 -1
  221. package/dist/src/cli/commands/web/index.mjs +3 -20
  222. package/dist/src/cli/commands/web/index.mjs.map +1 -1
  223. package/dist/src/cli/harnessOptions.cjs +2 -16
  224. package/dist/src/cli/harnessOptions.cjs.map +1 -1
  225. package/dist/src/cli/harnessOptions.d.mts.map +1 -1
  226. package/dist/src/cli/harnessOptions.mjs +3 -16
  227. package/dist/src/cli/harnessOptions.mjs.map +1 -1
  228. package/dist/src/cli/help.cjs +8 -13
  229. package/dist/src/cli/help.cjs.map +1 -1
  230. package/dist/src/cli/help.d.mts +1 -2
  231. package/dist/src/cli/help.d.mts.map +1 -1
  232. package/dist/src/cli/help.mjs +3 -7
  233. package/dist/src/cli/help.mjs.map +1 -1
  234. package/dist/src/cli/options.cjs +0 -24
  235. package/dist/src/cli/options.cjs.map +1 -1
  236. package/dist/src/cli/options.d.mts.map +1 -1
  237. package/dist/src/cli/options.mjs +0 -24
  238. package/dist/src/cli/options.mjs.map +1 -1
  239. package/dist/src/cli/router.cjs +0 -1
  240. package/dist/src/cli/router.cjs.map +1 -1
  241. package/dist/src/cli/router.d.mts +1 -1
  242. package/dist/src/cli/router.mjs +0 -1
  243. package/dist/src/cli/router.mjs.map +1 -1
  244. package/dist/src/cli/server/options.cjs +18 -2
  245. package/dist/src/cli/server/options.cjs.map +1 -1
  246. package/dist/src/cli/server/options.mjs +18 -2
  247. package/dist/src/cli/server/options.mjs.map +1 -1
  248. package/dist/src/cli/server/processGuards.cjs +5 -5
  249. package/dist/src/cli/server/processGuards.cjs.map +1 -1
  250. package/dist/src/cli/server/processGuards.mjs +4 -4
  251. package/dist/src/cli/server/processGuards.mjs.map +1 -1
  252. package/dist/src/cli/server/restartPolicy.cjs +38 -0
  253. package/dist/src/cli/server/restartPolicy.cjs.map +1 -0
  254. package/dist/src/cli/server/restartPolicy.d.mts +21 -0
  255. package/dist/src/cli/server/restartPolicy.d.mts.map +1 -0
  256. package/dist/src/cli/server/restartPolicy.mjs +36 -0
  257. package/dist/src/cli/server/restartPolicy.mjs.map +1 -0
  258. package/dist/src/cli/server/run.cjs +4 -3
  259. package/dist/src/cli/server/run.cjs.map +1 -1
  260. package/dist/src/cli/server/run.mjs +4 -3
  261. package/dist/src/cli/server/run.mjs.map +1 -1
  262. package/dist/src/cli/server/supervise.cjs +86 -0
  263. package/dist/src/cli/server/supervise.cjs.map +1 -0
  264. package/dist/src/cli/server/supervise.mjs +86 -0
  265. package/dist/src/cli/server/supervise.mjs.map +1 -0
  266. package/dist/src/composition/harnessState/index.d.mts +2 -2
  267. package/dist/src/composition/harnessState/index.mjs +2 -2
  268. package/dist/src/composition/layerPackageInstaller/index.cjs +53 -7
  269. package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -1
  270. package/dist/src/composition/layerPackageInstaller/index.mjs +62 -17
  271. package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -1
  272. package/dist/src/composition/poHomeMigration/index.cjs +2 -3
  273. package/dist/src/composition/poHomeMigration/index.cjs.map +1 -1
  274. package/dist/src/composition/poHomeMigration/index.d.mts.map +1 -1
  275. package/dist/src/composition/poHomeMigration/index.mjs +1 -2
  276. package/dist/src/composition/poHomeMigration/index.mjs.map +1 -1
  277. package/dist/src/composition/repository/index.cjs +17 -2
  278. package/dist/src/composition/repository/index.cjs.map +1 -1
  279. package/dist/src/composition/repository/index.d.mts +7 -0
  280. package/dist/src/composition/repository/index.d.mts.map +1 -1
  281. package/dist/src/composition/repository/index.mjs +16 -2
  282. package/dist/src/composition/repository/index.mjs.map +1 -1
  283. package/dist/src/composition/syncPrune/index.cjs +2 -2
  284. package/dist/src/composition/syncPrune/index.mjs +1 -1
  285. package/dist/src/composition/syncService/index.cjs +60 -39
  286. package/dist/src/composition/syncService/index.cjs.map +1 -1
  287. package/dist/src/composition/syncService/index.d.mts.map +1 -1
  288. package/dist/src/composition/syncService/index.mjs +60 -40
  289. package/dist/src/composition/syncService/index.mjs.map +1 -1
  290. package/dist/src/composition/syncService/localBuilds.cjs +10 -5
  291. package/dist/src/composition/syncService/localBuilds.cjs.map +1 -1
  292. package/dist/src/composition/syncService/localBuilds.mjs +9 -4
  293. package/dist/src/composition/syncService/localBuilds.mjs.map +1 -1
  294. package/dist/src/composition/types/harness.d.mts +0 -2
  295. package/dist/src/composition/types/harness.d.mts.map +1 -1
  296. package/dist/src/extensions/setupDiagnostics.cjs +7 -7
  297. package/dist/src/extensions/setupDiagnostics.cjs.map +1 -1
  298. package/dist/src/extensions/setupDiagnostics.mjs +6 -6
  299. package/dist/src/extensions/setupDiagnostics.mjs.map +1 -1
  300. package/docs/server/api-export.md +2 -2
  301. package/docs/server/api.md +13 -12
  302. package/docs/server/getting-started.md +6 -6
  303. package/docs/server/index.md +4 -4
  304. package/docs/server/ipc.md +4 -7
  305. package/docs/server/lifecycle.md +17 -17
  306. package/docs/server/security.md +8 -8
  307. package/package.json +31 -65
  308. package/src/prompts/po-author-extension/references/extension-contract.md +2 -2
  309. package/dist/antigravity.cjs +0 -5
  310. package/dist/antigravity.d.mts +0 -2
  311. package/dist/antigravity.mjs +0 -1
  312. package/dist/codex.cjs +0 -8
  313. package/dist/codex.d.mts +0 -2
  314. package/dist/codex.mjs +0 -1
  315. package/dist/compatibility.cjs +0 -27
  316. package/dist/compatibility.d.mts +0 -6
  317. package/dist/compatibility.mjs +0 -6
  318. package/dist/compatibilityCommand.cjs +0 -4
  319. package/dist/compatibilityCommand.d.mts +0 -2
  320. package/dist/compatibilityCommand.mjs +0 -1
  321. package/dist/compatibilityContext.cjs +0 -3
  322. package/dist/compatibilityContext.d.mts +0 -2
  323. package/dist/compatibilityContext.mjs +0 -1
  324. package/dist/compatibilityOptions.cjs +0 -5
  325. package/dist/compatibilityOptions.d.mts +0 -2
  326. package/dist/compatibilityOptions.mjs +0 -1
  327. package/dist/process.cjs +0 -12
  328. package/dist/process.d.mts +0 -2
  329. package/dist/process.mjs +0 -1
  330. package/dist/src/builders/hooks/index.cjs +0 -238
  331. package/dist/src/builders/hooks/index.cjs.map +0 -1
  332. package/dist/src/builders/hooks/index.mjs +0 -231
  333. package/dist/src/builders/hooks/index.mjs.map +0 -1
  334. package/dist/src/cli/commands/compat/context.cjs +0 -115
  335. package/dist/src/cli/commands/compat/context.cjs.map +0 -1
  336. package/dist/src/cli/commands/compat/context.d.mts +0 -22
  337. package/dist/src/cli/commands/compat/context.d.mts.map +0 -1
  338. package/dist/src/cli/commands/compat/context.mjs +0 -110
  339. package/dist/src/cli/commands/compat/context.mjs.map +0 -1
  340. package/dist/src/cli/commands/compat/help.cjs +0 -26
  341. package/dist/src/cli/commands/compat/help.cjs.map +0 -1
  342. package/dist/src/cli/commands/compat/help.d.mts +0 -4
  343. package/dist/src/cli/commands/compat/help.d.mts.map +0 -1
  344. package/dist/src/cli/commands/compat/help.mjs +0 -25
  345. package/dist/src/cli/commands/compat/help.mjs.map +0 -1
  346. package/dist/src/cli/commands/compat/index.cjs +0 -73
  347. package/dist/src/cli/commands/compat/index.cjs.map +0 -1
  348. package/dist/src/cli/commands/compat/index.d.mts +0 -14
  349. package/dist/src/cli/commands/compat/index.d.mts.map +0 -1
  350. package/dist/src/cli/commands/compat/index.mjs +0 -70
  351. package/dist/src/cli/commands/compat/index.mjs.map +0 -1
  352. package/dist/src/cli/commands/compat/options.cjs +0 -88
  353. package/dist/src/cli/commands/compat/options.cjs.map +0 -1
  354. package/dist/src/cli/commands/compat/options.d.mts +0 -15
  355. package/dist/src/cli/commands/compat/options.d.mts.map +0 -1
  356. package/dist/src/cli/commands/compat/options.mjs +0 -86
  357. package/dist/src/cli/commands/compat/options.mjs.map +0 -1
  358. package/dist/src/cli/commands/compat/providers/antigravity.cjs +0 -294
  359. package/dist/src/cli/commands/compat/providers/antigravity.cjs.map +0 -1
  360. package/dist/src/cli/commands/compat/providers/antigravity.d.mts +0 -9
  361. package/dist/src/cli/commands/compat/providers/antigravity.d.mts.map +0 -1
  362. package/dist/src/cli/commands/compat/providers/antigravity.mjs +0 -289
  363. package/dist/src/cli/commands/compat/providers/antigravity.mjs.map +0 -1
  364. package/dist/src/cli/commands/compat/providers/codex.cjs +0 -178
  365. package/dist/src/cli/commands/compat/providers/codex.cjs.map +0 -1
  366. package/dist/src/cli/commands/compat/providers/codex.d.mts +0 -17
  367. package/dist/src/cli/commands/compat/providers/codex.d.mts.map +0 -1
  368. package/dist/src/cli/commands/compat/providers/codex.mjs +0 -170
  369. package/dist/src/cli/commands/compat/providers/codex.mjs.map +0 -1
  370. package/dist/src/cli/commands/compat/providers/index.cjs +0 -65
  371. package/dist/src/cli/commands/compat/providers/index.cjs.map +0 -1
  372. package/dist/src/cli/commands/compat/providers/index.d.mts +0 -15
  373. package/dist/src/cli/commands/compat/providers/index.d.mts.map +0 -1
  374. package/dist/src/cli/commands/compat/providers/index.mjs +0 -45
  375. package/dist/src/cli/commands/compat/providers/index.mjs.map +0 -1
  376. package/dist/src/cli/commands/compat/providers/process.cjs +0 -172
  377. package/dist/src/cli/commands/compat/providers/process.cjs.map +0 -1
  378. package/dist/src/cli/commands/compat/providers/process.d.mts +0 -33
  379. package/dist/src/cli/commands/compat/providers/process.d.mts.map +0 -1
  380. package/dist/src/cli/commands/compat/providers/process.mjs +0 -159
  381. package/dist/src/cli/commands/compat/providers/process.mjs.map +0 -1
  382. package/dist/src/cli/commands/compat/providers/shared.cjs +0 -76
  383. package/dist/src/cli/commands/compat/providers/shared.cjs.map +0 -1
  384. package/dist/src/cli/commands/compat/providers/shared.d.mts +0 -40
  385. package/dist/src/cli/commands/compat/providers/shared.d.mts.map +0 -1
  386. package/dist/src/cli/commands/compat/providers/shared.mjs +0 -61
  387. package/dist/src/cli/commands/compat/providers/shared.mjs.map +0 -1
  388. package/dist/src/cli/commands/compat/types.d.mts +0 -31
  389. package/dist/src/cli/commands/compat/types.d.mts.map +0 -1
package/LICENSE CHANGED
@@ -1,21 +1,149 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Vuong Ngo
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
2
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
3
+
4
+ Parameters
5
+
6
+ Licensor: Agimon Pty Ltd
7
+ Licensed Work: Po, the software in the Po source repository and the
8
+ packages released from it, in each version released by
9
+ the Licensor.
10
+ The Licensed Work is (c) 2026 Agimon Pty Ltd.
11
+ Material identified as third-party in the "Third-party
12
+ components" section at the end of this file or in a
13
+ NOTICE file, and any package or directory whose own
14
+ license file grants a different license, is not part of
15
+ the Licensed Work and remains under its own license.
16
+ Additional Use Grant: You may make production use of the Licensed Work if
17
+ your use is Eligible Use. "Eligible Use" is production use that falls
18
+ within at least one of the following:
19
+
20
+ (a) Personal Use. Use by an individual for their own personal purposes,
21
+ and not on behalf of, or for the benefit of, an employer, client, or
22
+ other Organization. Use by an individual in the course of employment
23
+ or engagement by an Organization is use by that Organization.
24
+
25
+ (b) Small Organization Use. Use by or on behalf of an Organization whose
26
+ Annual Revenue is less than USD 1,000,000.
27
+
28
+ (c) Non-profit, Education and Research Use. Use, regardless of Annual
29
+ Revenue, by (i) an Organization registered or recognized as a
30
+ non-profit or charitable organization under the laws of its
31
+ jurisdiction, for its non-profit purposes; (ii) an accredited school,
32
+ college, or university, for teaching, learning, or academic research;
33
+ or (iii) a publicly funded research institution, for its research.
34
+
35
+ (d) Service Provider Use. Use by a consultant, contractor, agency, or other
36
+ service provider, regardless of its own Annual Revenue, solely to
37
+ build, deploy, host, operate, or support the Licensed Work for a client
38
+ whose own use would be Eligible Use under (a), (b), or (c). A service
39
+ provider's use for its own purposes is Eligible Use only if the service
40
+ provider itself qualifies under (b) or (c).
41
+
42
+
43
+ Hosted services. Offering the Licensed Work to third parties as a hosted
44
+ or managed service whose primary value is the Licensed Work is Eligible
45
+ Use only if each such third party's own use would be Eligible Use.
46
+
47
+ Definitions. "Organization" means any company, partnership, sole
48
+ proprietorship, trust, association, government body, or other entity, and
49
+ includes an individual acting in a business or professional capacity.
50
+ "Affiliate" means any entity that directly or indirectly controls, is
51
+ controlled by, or is under common control with an Organization, where
52
+ "control" means ownership of more than 50% of the voting interests of an
53
+ entity or the power to direct its management and policies by contract or
54
+ otherwise. "Annual Revenue" means the total gross revenue of an
55
+ Organization and all of its Affiliates combined, from all sources and
56
+ whether or not related to the Licensed Work, for its most recently
57
+ completed fiscal year, or, if it has not completed a fiscal year, for the
58
+ twelve months before the use (or since its formation, if shorter),
59
+ converted into US dollars at the average exchange rate for that period.
60
+ Proceeds of equity or debt financing are not revenue.
61
+
62
+ Threshold. If an Organization stops qualifying under (b), its existing
63
+ production use remains Eligible Use for 90 days after it stops
64
+ qualifying, after which it must obtain a commercial license or stop
65
+ production use. Use that was Eligible Use when it occurred never requires
66
+ a commercial license after the fact.
67
+ Change Date: Four years from the date a version of the Licensed Work
68
+ is first publicly released by the Licensor.
69
+ Change License: Apache License, Version 2.0
70
+
71
+ For information about alternative licensing arrangements for the Licensed
72
+ Work, please visit: https://agimon.ai/licensing
73
+
74
+ Notice
75
+
76
+ The Business Source License (this document, or the "License") is not an Open
77
+ Source license. However, the Licensed Work will eventually be made available
78
+ under an Open Source License, as stated in this License.
79
+
80
+ -----------------------------------------------------------------------------
81
+
82
+ Business Source License 1.1
83
+
84
+ Terms
85
+
86
+ The Licensor hereby grants you the right to copy, modify, create derivative
87
+ works, redistribute, and make non-production use of the Licensed Work. The
88
+ Licensor may make an Additional Use Grant, above, permitting limited
89
+ production use.
90
+
91
+ Effective on the Change Date, or the fourth anniversary of the first publicly
92
+ available distribution of a specific version of the Licensed Work under this
93
+ License, whichever comes first, the Licensor hereby grants you rights under
94
+ the terms of the Change License, and the rights granted in the paragraph
95
+ above terminate.
96
+
97
+ If your use of the Licensed Work does not comply with the requirements
98
+ currently in effect as described in this License, you must purchase a
99
+ commercial license from the Licensor, its affiliated entities, or authorized
100
+ resellers, or you must refrain from using the Licensed Work.
101
+
102
+ All copies of the original and modified Licensed Work, and derivative works
103
+ of the Licensed Work, are subject to this License. This License applies
104
+ separately for each version of the Licensed Work and the Change Date may vary
105
+ for each version of the Licensed Work released by Licensor.
106
+
107
+ You must conspicuously display this License on each original or modified copy
108
+ of the Licensed Work. If you receive the Licensed Work in original or
109
+ modified form from a third party, the terms and conditions set forth in this
110
+ License apply to your use of that work.
111
+
112
+ Any use of the Licensed Work in violation of this License will automatically
113
+ terminate your rights under this License for the current and all other
114
+ versions of the Licensed Work.
115
+
116
+ This License does not grant you any right in any trademark or logo of
117
+ Licensor or its affiliates (provided that you may use a trademark or logo of
118
+ Licensor as expressly required by this License).
119
+
120
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
121
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
122
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
123
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
124
+ TITLE.
125
+
126
+ MariaDB hereby grants you permission to use this License’s text to license
127
+ your works, and to refer to it using the trademark “Business Source License”,
128
+ as long as you comply with the Covenants of Licensor below.
129
+
130
+ Covenants of Licensor
131
+
132
+ In consideration of the right to use this License’s text and the “Business
133
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
134
+ other recipients of the licensed work to be provided by Licensor:
135
+
136
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
137
+ or a license that is compatible with GPL Version 2.0 or a later version,
138
+ where “compatible” means that software provided under the Change License can
139
+ be included in a program with software provided under GPL Version 2.0 or a
140
+ later version. Licensor may specify additional Change Licenses without
141
+ limitation.
142
+
143
+ 2. To either: (a) specify an additional grant of rights to use that does not
144
+ impose any additional restriction on the right granted in this License, as
145
+ the Additional Use Grant; or (b) insert the text “None”.
146
+
147
+ 3. To specify a Change Date.
148
+
149
+ 4. Not to modify this License in any other way.
package/README.md CHANGED
@@ -308,7 +308,7 @@ The fixed `@agimon-ai/po-artifact` package gives each session a durable artifact
308
308
  names it in the system prompt, and shows recent artifacts in web and native Activity.
309
309
  The Artifacts heading opens all files in that session's folder as a grid.
310
310
  [`@agimon-ai/po-log`][pkg-po-log] collects session events, while
311
- [`@agimon-ai/po-telemetry`][pkg-po-telemetry] is the library-level telemetry adapter.
311
+ `@agimon-ai/po-core/telemetry` is the library-level telemetry adapter. Po Log's `logsink` code-mode namespace reads session evidence and explicitly selected cross-session history.
312
312
 
313
313
  Runner selects matching RMUX and RTK native artifacts automatically. Do not install them directly.
314
314
  The packages cover macOS and Linux on arm64 and x64 for both [RMUX][pkg-rmux-darwin-arm64] and
@@ -395,11 +395,9 @@ choices, and accepts the next spoken response as an ordinary user message.
395
395
 
396
396
  Po logging records operational metadata such as counters, spans, session IDs, tool names, and
397
397
  errors. Callers remain responsible for values they attach to telemetry. Native diagnostics expose
398
- current-session metrics, and [`@agimon-ai/log-sink-mcp`][pkg-log-sink-mcp] provides historical lookup
398
+ current-session metrics, and [`@agimon-ai/po-logsink`][pkg-po-logsink] provides historical lookup
399
399
  when a sink is configured.
400
400
 
401
- ### Modes and automation
402
-
403
401
  #### Plan mode
404
402
 
405
403
  A promise to "only plan" is not a permission boundary. [`@agimon-ai/po-plan`][pkg-po-plan]
@@ -492,7 +490,6 @@ configuration:
492
490
  default:
493
491
  packages:
494
492
  - '@agimon-ai/po-help'
495
- - '@agimon-ai/po-hook'
496
493
  - '@agimon-ai/po-goal'
497
494
  - '@agimon-ai/po-voice'
498
495
  - '@agimon-ai/po-runner'
@@ -656,17 +653,16 @@ its owning package's controls; values supplied by callers are not automatically
656
653
 
657
654
  ## CLI reference
658
655
 
659
- | Command or option | What it does |
660
- | ---------------------------------------- | ---------------------------------------------------------------------------------- |
661
- | `po` | Starts the `po-web` console and its headless `po-server`; arguments go to po-web |
662
- | `po init` | Seeds personal config and removes Po entries earlier versions wrote to Pi settings |
663
- | `po sync` | Publishes the current repository, or the global composition outside repositories |
664
- | `po sync --check` | Exits non-zero when the applicable registered generation is missing or stale |
665
- | `po compat <codex\|claude\|antigravity>` | Resolves the selected matrix and launches the compatibility adapter |
666
- | `po-runner` | Inspects and controls supervised Runner processes and logs |
667
- | `--explain` | Prints the resolved matrix and estimated prompt cost without launching Pi |
668
- | `--emit-mcp <dir>`, `--no-mcp` | Writes the resolved MCP config or disables MCP for one run |
669
- | `--` and remaining arguments | Forwards provider or Pi arguments unchanged where the selected command allows it |
656
+ | Command or option | What it does |
657
+ | ------------------------------ | ---------------------------------------------------------------------------------- |
658
+ | `po` | Starts the `po-web` console and its headless `po-server`; arguments go to po-web |
659
+ | `po init` | Seeds personal config and removes Po entries earlier versions wrote to Pi settings |
660
+ | `po sync` | Publishes the current repository, or the global composition outside repositories |
661
+ | `po sync --check` | Exits non-zero when the applicable registered generation is missing or stale |
662
+ | `po-runner` | Inspects and controls supervised Runner processes and logs |
663
+ | `--explain` | Prints the resolved matrix and estimated prompt cost without launching Pi |
664
+ | `--emit-mcp <dir>`, `--no-mcp` | Writes the resolved MCP config or disables MCP for one run |
665
+ | `--` and remaining arguments | Forwards provider or Pi arguments unchanged where the selected command allows it |
670
666
 
671
667
  ## Troubleshooting and direct use
672
668
 
@@ -674,9 +670,9 @@ its owning package's controls; values supplied by callers are not automatically
674
670
  to install them and rebuild synchronized state.
675
671
  - If neither RMUX nor tmux is available, non-interactive Runner calls report the supervised subprocess
676
672
  fallback. Interactive calls require RMUX or tmux. Linux native artifacts require a compatible loader and libc.
677
- - Po-owned packages expose native server, web, and MCP facets, not Pi entry points. Install them with
678
- `npm install` or select them in `modes.yaml`. Third-party Pi settings packages still load through
679
- the upstream SDK extension host, including provider registration before model selection.
673
+ - Po-owned packages expose native server, web, and MCP contributions, not Pi entry points. Install
674
+ them with `npm install` or select them in `modes.yaml`. Third-party Pi settings packages still load
675
+ through the upstream SDK extension host, including provider registration before model selection.
680
676
  - Terminal leader menus, shortcuts, overlays, and widgets are no longer shipped. Native commands,
681
677
  tools, and web panels remain where the owning package provides them. RMUX and RTK artifacts are
682
678
  selected by Runner and should not be installed directly.
@@ -689,8 +685,8 @@ its owning package's controls; values supplied by callers are not automatically
689
685
  ## Architecture
690
686
 
691
687
  See [Architecture](https://github.com/AgiFlow/po/blob/main/docs/architecture.md) for native
692
- server/web/MCP facets, canonical fingerprints, transition classification, shared-host Cordis
693
- lifecycle ownership, and parent/child isolation. Po no longer composes its own Pi factories;
688
+ server/web/MCP contributions, canonical fingerprints, transition classification, shared-host
689
+ Cordis lifecycle ownership, and parent/child isolation. Po no longer composes its own Pi factories;
694
690
  third-party Pi packages remain supported through the SDK host.
695
691
 
696
692
  ## Development
@@ -709,7 +705,7 @@ Po is maintained by [Agimon](https://agimon.ai/about).
709
705
 
710
706
  ## License
711
707
 
712
- MIT
708
+ Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
713
709
 
714
710
  ## Maintainer release order
715
711
 
@@ -733,7 +729,6 @@ loaded extension graph inside the same release boundary as the packages that con
733
729
  [pkg-po-edit]: https://www.npmjs.com/package/@agimon-ai/po-edit
734
730
  [pkg-po-file-edit]: https://www.npmjs.com/package/@agimon-ai/po-file-edit
735
731
  [pkg-po-log]: https://www.npmjs.com/package/@agimon-ai/po-log
736
- [pkg-po-telemetry]: https://www.npmjs.com/package/@agimon-ai/po-telemetry
737
732
  [pkg-rmux-darwin-arm64]: https://www.npmjs.com/package/@agimon-ai/po-runner-rmux-darwin-arm64
738
733
  [pkg-rmux-darwin-x64]: https://www.npmjs.com/package/@agimon-ai/po-runner-rmux-darwin-x64
739
734
  [pkg-rmux-linux-arm64]: https://www.npmjs.com/package/@agimon-ai/po-runner-rmux-linux-arm64
@@ -749,7 +744,7 @@ loaded extension graph inside the same release boundary as the packages that con
749
744
  [pkg-po-help]: https://www.npmjs.com/package/@agimon-ai/po-help
750
745
  [pkg-po-mcp]: https://www.npmjs.com/package/@agimon-ai/po-mcp
751
746
  [pkg-po-user-feedback]: https://www.npmjs.com/package/@agimon-ai/po-user-feedback
752
- [pkg-log-sink-mcp]: https://www.npmjs.com/package/@agimon-ai/log-sink-mcp
747
+ [pkg-po-logsink]: ../../tooling/po-logsink/README.md
753
748
  [pkg-po-plan]: https://www.npmjs.com/package/@agimon-ai/po-plan
754
749
  [pkg-po-loop]: https://www.npmjs.com/package/@agimon-ai/po-loop
755
750
  [pkg-po-goal]: https://www.npmjs.com/package/@agimon-ai/po-goal
package/dist/bin/cli.cjs CHANGED
@@ -1,19 +1,42 @@
1
1
  #!/usr/bin/env node
2
- const require_help = require("../src/cli/help.cjs");
3
- const require_router = require("../src/cli/router.cjs");
4
- require("../src/bin/agentDirectory.cjs");
2
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_agentDirectory = require("../src/bin/agentDirectory.cjs");
4
+ let node_path = require("node:path");
5
+ node_path = require_runtime.__toESM(node_path, 1);
6
+ let node_fs = require("node:fs");
7
+ node_fs = require_runtime.__toESM(node_fs, 1);
8
+ let node_url = require("node:url");
5
9
  //#region src/bin/cli.ts
6
- const args = process.argv.slice(2);
7
- const informational = require_router.routeCommand(args) !== void 0 ? void 0 : require_router.informationalRequest(args);
8
- const informationalExit = informational === "help" ? (() => {
9
- require_help.printHelp();
10
- return 0;
11
- })() : informational === "version" ? (() => {
12
- process.stdout.write(`${require_help.HARNESS_VERSION}\n`);
13
- return 0;
14
- })() : void 0;
15
- (informationalExit === void 0 ? Promise.resolve().then(() => require("../src/cli/cliApp.cjs")).then(({ runCli }) => runCli(args)) : Promise.resolve(informationalExit)).then((exitCode) => {
16
- process.exitCode = exitCode;
10
+ /**
11
+ * CLI Entry Point for po
12
+ *
13
+ * The executable installed as the `po` binary, and the file the repository
14
+ * launcher (pi.sh) invoke directly from source.
15
+ */
16
+ async function main() {
17
+ if (require_agentDirectory.testRoot) {
18
+ const target = node_path.default.join(require_agentDirectory.testRoot, "packages/cli/po/dist/bin/cli.mjs");
19
+ if (!node_fs.default.existsSync(target)) throw new Error(`Local test CLI build is missing: ${target}. Build @agimon-ai/po first.`);
20
+ if (node_fs.default.realpathSync(target) !== node_fs.default.realpathSync((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href))) {
21
+ await import((0, node_url.pathToFileURL)(target).href);
22
+ return;
23
+ }
24
+ }
25
+ const { HARNESS_VERSION, printHelp } = await Promise.resolve().then(() => require("../src/cli/help.cjs"));
26
+ const { informationalRequest, routeCommand } = await Promise.resolve().then(() => require("../src/cli/router.cjs"));
27
+ const args = process.argv.slice(2);
28
+ const informational = routeCommand(args) !== void 0 ? void 0 : informationalRequest(args);
29
+ const informationalExit = informational === "help" ? (() => {
30
+ printHelp();
31
+ return 0;
32
+ })() : informational === "version" ? (() => {
33
+ process.stdout.write(`${HARNESS_VERSION}\n`);
34
+ return 0;
35
+ })() : void 0;
36
+ return informationalExit === void 0 ? Promise.resolve().then(() => require("../src/cli/cliApp.cjs")).then(({ runCli }) => runCli(args)) : Promise.resolve(informationalExit);
37
+ }
38
+ main().then((exitCode) => {
39
+ if (exitCode !== void 0) process.exitCode = exitCode;
17
40
  }, (error) => {
18
41
  const message = error instanceof Error ? error.message : String(error);
19
42
  process.stderr.write(`[po] ${message}\n`);
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","names":["routeCommand","informationalRequest","HARNESS_VERSION"],"sources":["../../src/bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for po\n *\n * The executable installed as the `po` binary, and the file the repository\n * launchers (pi.sh, claude.sh, codex.sh) invoke directly from source.\n */\n\nimport './agentDirectory';\nimport { HARNESS_VERSION, printHelp } from '../cli/help';\nimport { informationalRequest, routeCommand } from '../cli/router';\n\nconst args = process.argv.slice(2);\n// A named subcommand parses its own arguments, including its own --help, so the\n// fast path below must not answer for it.\nconst ownsArguments = routeCommand(args) !== undefined;\n\n// Keep informational startup independent from telemetry, configuration, Pi,\n// and the extension compiler. Those graphs are useful for a real command but\n// used to account for almost all of `po --help` and `po --version`.\nconst informational = ownsArguments ? undefined : informationalRequest(args);\nconst informationalExit =\n informational === 'help'\n ? (() => {\n printHelp();\n return 0;\n })()\n : informational === 'version'\n ? (() => {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n })()\n : undefined;\n\nconst run =\n informationalExit === undefined\n ? import('../cli/cliApp').then(({ runCli }) => runCli(args))\n : Promise.resolve(informationalExit);\n\nrun.then(\n (exitCode) => {\n process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[po] ${message}\\n`);\n process.exitCode = 1;\n },\n);\n"],"mappings":";;;;;AAaA,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAQjC,MAAM,gBALgBA,eAAAA,aAAa,IAAI,MAAM,KAAA,IAKP,KAAA,IAAYC,eAAAA,qBAAqB,IAAI;AAC3E,MAAM,oBACJ,kBAAkB,gBACP;CACL,aAAA,UAAU;CACV,OAAO;AACT,EAAA,CAAG,IACH,kBAAkB,mBACT;CACL,QAAQ,OAAO,MAAM,GAAGC,aAAAA,gBAAgB,GAAG;CAC3C,OAAO;AACT,EAAA,CAAG,IACH,KAAA;CAGN,sBAAsB,KAAA,IAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAClB,uBAAA,CAAA,CAAA,CAAwB,MAAM,EAAE,aAAa,OAAO,IAAI,CAAC,IACzD,QAAQ,QAAQ,iBAAiB,EAAA,CAEnC,MACD,aAAa;CACZ,QAAQ,WAAW;AACrB,IACC,UAAmB;CAClB,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,QAAQ,OAAO,MAAM,QAAQ,QAAQ,GAAG;CACxC,QAAQ,WAAW;AACrB,CACF"}
1
+ {"version":3,"file":"cli.cjs","names":["testRoot","path","fs","fileURLToPath","pathToFileURL"],"sources":["../../src/bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for po\n *\n * The executable installed as the `po` binary, and the file the repository\n * launcher (pi.sh) invoke directly from source.\n */\n\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\n\nimport { testRoot } from './agentDirectory';\n\nasync function main(): Promise<number | undefined> {\n if (testRoot) {\n const target = path.join(testRoot, 'packages/cli/po/dist/bin/cli.mjs');\n if (!fs.existsSync(target))\n throw new Error(`Local test CLI build is missing: ${target}. Build @agimon-ai/po first.`);\n if (fs.realpathSync(target) !== fs.realpathSync(fileURLToPath(import.meta.url))) {\n await import(pathToFileURL(target).href);\n return;\n }\n }\n const { HARNESS_VERSION, printHelp } = await import('../cli/help');\n const { informationalRequest, routeCommand } = await import('../cli/router');\n\n const args = process.argv.slice(2);\n // A named subcommand parses its own arguments, including its own --help, so the\n // fast path below must not answer for it.\n const ownsArguments = routeCommand(args) !== undefined;\n\n // Keep informational startup independent from telemetry, configuration, Pi,\n // and the extension compiler. Those graphs are useful for a real command but\n // used to account for almost all of `po --help` and `po --version`.\n const informational = ownsArguments ? undefined : informationalRequest(args);\n const informationalExit =\n informational === 'help'\n ? (() => {\n printHelp();\n return 0;\n })()\n : informational === 'version'\n ? (() => {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n })()\n : undefined;\n\n const run =\n informationalExit === undefined\n ? import('../cli/cliApp').then(({ runCli }) => runCli(args))\n : Promise.resolve(informationalExit);\n\n return run;\n}\n\nmain().then(\n (exitCode) => {\n if (exitCode !== undefined) process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[po] ${message}\\n`);\n process.exitCode = 1;\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;AAeA,eAAe,OAAoC;CACjD,IAAIA,uBAAAA,UAAU;EACZ,MAAM,SAASC,UAAAA,QAAK,KAAKD,uBAAAA,UAAU,kCAAkC;EACrE,IAAI,CAACE,QAAAA,QAAG,WAAW,MAAM,GACvB,MAAM,IAAI,MAAM,oCAAoC,OAAO,6BAA6B;EAC1F,IAAIA,QAAAA,QAAG,aAAa,MAAM,MAAMA,QAAAA,QAAG,cAAA,GAAaC,SAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,IAA6B,CAAC,GAAG;GAC/E,MAAM,QAAA,GAAOC,SAAAA,cAAAA,CAAc,MAAM,CAAC,CAAC;GACnC;EACF;CACF;CACA,MAAM,EAAE,iBAAiB,cAAc,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;CAC7C,MAAM,EAAE,sBAAsB,iBAAiB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,uBAAA,CAAA;CAErD,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CAQjC,MAAM,gBALgB,aAAa,IAAI,MAAM,KAAA,IAKP,KAAA,IAAY,qBAAqB,IAAI;CAC3E,MAAM,oBACJ,kBAAkB,gBACP;EACL,UAAU;EACV,OAAO;CACT,EAAA,CAAG,IACH,kBAAkB,mBACT;EACL,QAAQ,OAAO,MAAM,GAAG,gBAAgB,GAAG;EAC3C,OAAO;CACT,EAAA,CAAG,IACH,KAAA;CAOR,OAJE,sBAAsB,KAAA,IAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAClB,uBAAA,CAAA,CAAA,CAAwB,MAAM,EAAE,aAAa,OAAO,IAAI,CAAC,IACzD,QAAQ,QAAQ,iBAAiB;AAGzC;AAEA,KAAK,CAAC,CAAC,MACJ,aAAa;CACZ,IAAI,aAAa,KAAA,GAAW,QAAQ,WAAW;AACjD,IACC,UAAmB;CAClB,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,QAAQ,OAAO,MAAM,QAAQ,QAAQ,GAAG;CACxC,QAAQ,WAAW;AACrB,CACF"}
package/dist/bin/cli.mjs CHANGED
@@ -1,19 +1,39 @@
1
1
  #!/usr/bin/env node
2
- import { HARNESS_VERSION, printHelp } from "../src/cli/help.mjs";
3
- import { informationalRequest, routeCommand } from "../src/cli/router.mjs";
4
- import "../src/bin/agentDirectory.mjs";
2
+ import { testRoot } from "../src/bin/agentDirectory.mjs";
3
+ import path from "node:path";
4
+ import fs from "node:fs";
5
+ import { fileURLToPath, pathToFileURL } from "node:url";
5
6
  //#region src/bin/cli.ts
6
- const args = process.argv.slice(2);
7
- const informational = routeCommand(args) !== void 0 ? void 0 : informationalRequest(args);
8
- const informationalExit = informational === "help" ? (() => {
9
- printHelp();
10
- return 0;
11
- })() : informational === "version" ? (() => {
12
- process.stdout.write(`${HARNESS_VERSION}\n`);
13
- return 0;
14
- })() : void 0;
15
- (informationalExit === void 0 ? import("../src/cli/cliApp.mjs").then(({ runCli }) => runCli(args)) : Promise.resolve(informationalExit)).then((exitCode) => {
16
- process.exitCode = exitCode;
7
+ /**
8
+ * CLI Entry Point for po
9
+ *
10
+ * The executable installed as the `po` binary, and the file the repository
11
+ * launcher (pi.sh) invoke directly from source.
12
+ */
13
+ async function main() {
14
+ if (testRoot) {
15
+ const target = path.join(testRoot, "packages/cli/po/dist/bin/cli.mjs");
16
+ if (!fs.existsSync(target)) throw new Error(`Local test CLI build is missing: ${target}. Build @agimon-ai/po first.`);
17
+ if (fs.realpathSync(target) !== fs.realpathSync(fileURLToPath(import.meta.url))) {
18
+ await import(pathToFileURL(target).href);
19
+ return;
20
+ }
21
+ }
22
+ const { HARNESS_VERSION, printHelp } = await import("../src/cli/help.mjs");
23
+ const { informationalRequest, routeCommand } = await import("../src/cli/router.mjs");
24
+ const args = process.argv.slice(2);
25
+ const informational = routeCommand(args) !== void 0 ? void 0 : informationalRequest(args);
26
+ const informationalExit = informational === "help" ? (() => {
27
+ printHelp();
28
+ return 0;
29
+ })() : informational === "version" ? (() => {
30
+ process.stdout.write(`${HARNESS_VERSION}\n`);
31
+ return 0;
32
+ })() : void 0;
33
+ return informationalExit === void 0 ? import("../src/cli/cliApp.mjs").then(({ runCli }) => runCli(args)) : Promise.resolve(informationalExit);
34
+ }
35
+ main().then((exitCode) => {
36
+ if (exitCode !== void 0) process.exitCode = exitCode;
17
37
  }, (error) => {
18
38
  const message = error instanceof Error ? error.message : String(error);
19
39
  process.stderr.write(`[po] ${message}\n`);
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../../src/bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for po\n *\n * The executable installed as the `po` binary, and the file the repository\n * launchers (pi.sh, claude.sh, codex.sh) invoke directly from source.\n */\n\nimport './agentDirectory';\nimport { HARNESS_VERSION, printHelp } from '../cli/help';\nimport { informationalRequest, routeCommand } from '../cli/router';\n\nconst args = process.argv.slice(2);\n// A named subcommand parses its own arguments, including its own --help, so the\n// fast path below must not answer for it.\nconst ownsArguments = routeCommand(args) !== undefined;\n\n// Keep informational startup independent from telemetry, configuration, Pi,\n// and the extension compiler. Those graphs are useful for a real command but\n// used to account for almost all of `po --help` and `po --version`.\nconst informational = ownsArguments ? undefined : informationalRequest(args);\nconst informationalExit =\n informational === 'help'\n ? (() => {\n printHelp();\n return 0;\n })()\n : informational === 'version'\n ? (() => {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n })()\n : undefined;\n\nconst run =\n informationalExit === undefined\n ? import('../cli/cliApp').then(({ runCli }) => runCli(args))\n : Promise.resolve(informationalExit);\n\nrun.then(\n (exitCode) => {\n process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[po] ${message}\\n`);\n process.exitCode = 1;\n },\n);\n"],"mappings":";;;;;AAaA,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAQjC,MAAM,gBALgB,aAAa,IAAI,MAAM,KAAA,IAKP,KAAA,IAAY,qBAAqB,IAAI;AAC3E,MAAM,oBACJ,kBAAkB,gBACP;CACL,UAAU;CACV,OAAO;AACT,EAAA,CAAG,IACH,kBAAkB,mBACT;CACL,QAAQ,OAAO,MAAM,GAAG,gBAAgB,GAAG;CAC3C,OAAO;AACT,EAAA,CAAG,IACH,KAAA;CAGN,sBAAsB,KAAA,IAClB,OAAO,wBAAgB,CAAC,MAAM,EAAE,aAAa,OAAO,IAAI,CAAC,IACzD,QAAQ,QAAQ,iBAAiB,EAAA,CAEnC,MACD,aAAa;CACZ,QAAQ,WAAW;AACrB,IACC,UAAmB;CAClB,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,QAAQ,OAAO,MAAM,QAAQ,QAAQ,GAAG;CACxC,QAAQ,WAAW;AACrB,CACF"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../../src/bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for po\n *\n * The executable installed as the `po` binary, and the file the repository\n * launcher (pi.sh) invoke directly from source.\n */\n\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\n\nimport { testRoot } from './agentDirectory';\n\nasync function main(): Promise<number | undefined> {\n if (testRoot) {\n const target = path.join(testRoot, 'packages/cli/po/dist/bin/cli.mjs');\n if (!fs.existsSync(target))\n throw new Error(`Local test CLI build is missing: ${target}. Build @agimon-ai/po first.`);\n if (fs.realpathSync(target) !== fs.realpathSync(fileURLToPath(import.meta.url))) {\n await import(pathToFileURL(target).href);\n return;\n }\n }\n const { HARNESS_VERSION, printHelp } = await import('../cli/help');\n const { informationalRequest, routeCommand } = await import('../cli/router');\n\n const args = process.argv.slice(2);\n // A named subcommand parses its own arguments, including its own --help, so the\n // fast path below must not answer for it.\n const ownsArguments = routeCommand(args) !== undefined;\n\n // Keep informational startup independent from telemetry, configuration, Pi,\n // and the extension compiler. Those graphs are useful for a real command but\n // used to account for almost all of `po --help` and `po --version`.\n const informational = ownsArguments ? undefined : informationalRequest(args);\n const informationalExit =\n informational === 'help'\n ? (() => {\n printHelp();\n return 0;\n })()\n : informational === 'version'\n ? (() => {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n })()\n : undefined;\n\n const run =\n informationalExit === undefined\n ? import('../cli/cliApp').then(({ runCli }) => runCli(args))\n : Promise.resolve(informationalExit);\n\n return run;\n}\n\nmain().then(\n (exitCode) => {\n if (exitCode !== undefined) process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[po] ${message}\\n`);\n process.exitCode = 1;\n },\n);\n"],"mappings":";;;;;;;;;;;;AAeA,eAAe,OAAoC;CACjD,IAAI,UAAU;EACZ,MAAM,SAAS,KAAK,KAAK,UAAU,kCAAkC;EACrE,IAAI,CAAC,GAAG,WAAW,MAAM,GACvB,MAAM,IAAI,MAAM,oCAAoC,OAAO,6BAA6B;EAC1F,IAAI,GAAG,aAAa,MAAM,MAAM,GAAG,aAAa,cAAc,YAAY,GAAG,CAAC,GAAG;GAC/E,MAAM,OAAO,cAAc,MAAM,CAAC,CAAC;GACnC;EACF;CACF;CACA,MAAM,EAAE,iBAAiB,cAAc,MAAM,OAAO;CACpD,MAAM,EAAE,sBAAsB,iBAAiB,MAAM,OAAO;CAE5D,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CAQjC,MAAM,gBALgB,aAAa,IAAI,MAAM,KAAA,IAKP,KAAA,IAAY,qBAAqB,IAAI;CAC3E,MAAM,oBACJ,kBAAkB,gBACP;EACL,UAAU;EACV,OAAO;CACT,EAAA,CAAG,IACH,kBAAkB,mBACT;EACL,QAAQ,OAAO,MAAM,GAAG,gBAAgB,GAAG;EAC3C,OAAO;CACT,EAAA,CAAG,IACH,KAAA;CAOR,OAJE,sBAAsB,KAAA,IAClB,OAAO,wBAAgB,CAAC,MAAM,EAAE,aAAa,OAAO,IAAI,CAAC,IACzD,QAAQ,QAAQ,iBAAiB;AAGzC;AAEA,KAAK,CAAC,CAAC,MACJ,aAAa;CACZ,IAAI,aAAa,KAAA,GAAW,QAAQ,WAAW;AACjD,IACC,UAAmB;CAClB,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,QAAQ,OAAO,MAAM,QAAQ,QAAQ,GAAG;CACxC,QAAQ,WAAW;AACrB,CACF"}
@@ -1,27 +1,35 @@
1
1
  #!/usr/bin/env node
2
- require("../src/bin/agentDirectory.cjs");
3
2
  const require_processGuards = require("../src/cli/server/processGuards.cjs");
4
- const require_run = require("../src/cli/server/run.cjs");
3
+ const require_supervise = require("../src/cli/server/supervise.cjs");
5
4
  //#region src/bin/serve.ts
6
5
  function finish(code) {
7
6
  process.exitCode = code;
8
7
  setTimeout(() => process.exit(code), 2e3).unref();
9
8
  }
10
- const stopController = new AbortController();
11
- let stopped;
12
- const server = require_run.runServer(process.argv.slice(2), stopController.signal);
13
- require_processGuards.installProcessGuards({
14
- write: (message) => void process.stderr.write(message),
15
- stop: () => {
16
- stopController.abort();
17
- stopped ??= server.catch(() => void 0);
18
- return stopped;
19
- },
20
- exit: (code) => process.exit(code)
21
- });
22
- server.then((code) => {
23
- finish(code);
24
- }, (error) => {
9
+ async function main() {
10
+ if (process.env.PO_SERVER_SUPERVISED !== "1") return require_supervise.superviseServer({
11
+ entry: process.argv[1],
12
+ args: process.argv.slice(2),
13
+ environment: process.env,
14
+ notice: (message) => void process.stderr.write(`[po-server] ${message}\n`)
15
+ });
16
+ await Promise.resolve().then(() => require("../src/bin/agentDirectory.cjs"));
17
+ const { runServer } = await Promise.resolve().then(() => require("../src/cli/server/run.cjs"));
18
+ const stopController = new AbortController();
19
+ let stopped;
20
+ const server = runServer(process.argv.slice(2), stopController.signal);
21
+ require_processGuards.installProcessGuards({
22
+ write: (message) => void process.stderr.write(message),
23
+ stop: (reason) => {
24
+ stopController.abort(reason);
25
+ stopped ??= server.catch(() => void 0);
26
+ return stopped;
27
+ },
28
+ exit: (code) => process.exit(code)
29
+ });
30
+ return server;
31
+ }
32
+ main().then(finish, (error) => {
25
33
  process.stderr.write(`[po-server] ${error instanceof Error ? error.message : String(error)}\n`);
26
34
  finish(1);
27
35
  });
@@ -1 +1 @@
1
- {"version":3,"file":"serve.cjs","names":["runServer","installProcessGuards"],"sources":["../../src/bin/serve.ts"],"sourcesContent":["#!/usr/bin/env node\nimport './agentDirectory';\nimport { installProcessGuards } from '../cli/server/processGuards';\nimport { runServer } from '../cli/server/run';\n\n// The library finishes bounded cleanup first. A stale handle must not keep this\n// standalone CLI alive forever; an unreferenced deadline still lets output drain.\nfunction finish(code: number): void {\n process.exitCode = code;\n setTimeout(() => process.exit(code), 2_000).unref();\n}\n\nconst stopController = new AbortController();\nlet stopped: Promise<unknown> | undefined;\nconst server = runServer(process.argv.slice(2), stopController.signal);\ninstallProcessGuards({\n write: (message) => void process.stderr.write(message),\n stop: () => {\n stopController.abort();\n // The failure itself is reported by the handler below; here it only ends the stop.\n stopped ??= server.catch(() => undefined);\n return stopped;\n },\n exit: (code) => process.exit(code),\n});\n\nserver.then(\n (code) => {\n finish(code);\n },\n (error: unknown) => {\n process.stderr.write(`[po-server] ${error instanceof Error ? error.message : String(error)}\\n`);\n finish(1);\n },\n);\n"],"mappings":";;;;;AAOA,SAAS,OAAO,MAAoB;CAClC,QAAQ,WAAW;CACnB,iBAAiB,QAAQ,KAAK,IAAI,GAAG,GAAK,CAAC,CAAC,MAAM;AACpD;AAEA,MAAM,iBAAiB,IAAI,gBAAgB;AAC3C,IAAI;AACJ,MAAM,SAASA,YAAAA,UAAU,QAAQ,KAAK,MAAM,CAAC,GAAG,eAAe,MAAM;AACrEC,sBAAAA,qBAAqB;CACnB,QAAQ,YAAY,KAAK,QAAQ,OAAO,MAAM,OAAO;CACrD,YAAY;EACV,eAAe,MAAM;EAErB,YAAY,OAAO,YAAY,KAAA,CAAS;EACxC,OAAO;CACT;CACA,OAAO,SAAS,QAAQ,KAAK,IAAI;AACnC,CAAC;AAED,OAAO,MACJ,SAAS;CACR,OAAO,IAAI;AACb,IACC,UAAmB;CAClB,QAAQ,OAAO,MAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GAAG;CAC9F,OAAO,CAAC;AACV,CACF"}
1
+ {"version":3,"file":"serve.cjs","names":["superviseServer"],"sources":["../../src/bin/serve.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { installProcessGuards } from '../cli/server/processGuards';\nimport { superviseServer } from '../cli/server/supervise';\n\n// The library finishes bounded cleanup first. A stale handle must not keep this\n// standalone CLI alive forever; an unreferenced deadline still lets output drain.\nfunction finish(code: number): void {\n process.exitCode = code;\n setTimeout(() => process.exit(code), 2_000).unref();\n}\n\nasync function main(): Promise<number> {\n if (process.env.PO_SERVER_SUPERVISED !== '1') {\n return superviseServer({\n entry: process.argv[1]!,\n args: process.argv.slice(2),\n environment: process.env,\n notice: (message) => void process.stderr.write(`[po-server] ${message}\\n`),\n });\n }\n\n // Only the worker initializes configuration and imports the runtime.\n await import('./agentDirectory');\n const { runServer } = await import('../cli/server/run');\n const stopController = new AbortController();\n let stopped: Promise<unknown> | undefined;\n const server = runServer(process.argv.slice(2), stopController.signal);\n installProcessGuards({\n write: (message) => void process.stderr.write(message),\n stop: (reason) => {\n stopController.abort(reason);\n // The failure itself is reported by the handler below; here it only ends the stop.\n stopped ??= server.catch(() => undefined);\n return stopped;\n },\n exit: (code) => process.exit(code),\n });\n return server;\n}\n\nmain().then(finish, (error: unknown) => {\n process.stderr.write(`[po-server] ${error instanceof Error ? error.message : String(error)}\\n`);\n finish(1);\n});\n"],"mappings":";;;;AAMA,SAAS,OAAO,MAAoB;CAClC,QAAQ,WAAW;CACnB,iBAAiB,QAAQ,KAAK,IAAI,GAAG,GAAK,CAAC,CAAC,MAAM;AACpD;AAEA,eAAe,OAAwB;CACrC,IAAI,QAAQ,IAAI,yBAAyB,KACvC,OAAOA,kBAAAA,gBAAgB;EACrB,OAAO,QAAQ,KAAK;EACpB,MAAM,QAAQ,KAAK,MAAM,CAAC;EAC1B,aAAa,QAAQ;EACrB,SAAS,YAAY,KAAK,QAAQ,OAAO,MAAM,eAAe,QAAQ,GAAG;CAC3E,CAAC;CAIH,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,+BAAA,CAAA;CACN,MAAM,EAAE,cAAc,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,2BAAA,CAAA;CAC5B,MAAM,iBAAiB,IAAI,gBAAgB;CAC3C,IAAI;CACJ,MAAM,SAAS,UAAU,QAAQ,KAAK,MAAM,CAAC,GAAG,eAAe,MAAM;CACrE,sBAAA,qBAAqB;EACnB,QAAQ,YAAY,KAAK,QAAQ,OAAO,MAAM,OAAO;EACrD,OAAO,WAAW;GAChB,eAAe,MAAM,MAAM;GAE3B,YAAY,OAAO,YAAY,KAAA,CAAS;GACxC,OAAO;EACT;EACA,OAAO,SAAS,QAAQ,KAAK,IAAI;CACnC,CAAC;CACD,OAAO;AACT;AAEA,KAAK,CAAC,CAAC,KAAK,SAAS,UAAmB;CACtC,QAAQ,OAAO,MAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GAAG;CAC9F,OAAO,CAAC;AACV,CAAC"}
@@ -1,27 +1,35 @@
1
1
  #!/usr/bin/env node
2
- import "../src/bin/agentDirectory.mjs";
3
2
  import { installProcessGuards } from "../src/cli/server/processGuards.mjs";
4
- import { runServer } from "../src/cli/server/run.mjs";
3
+ import { superviseServer } from "../src/cli/server/supervise.mjs";
5
4
  //#region src/bin/serve.ts
6
5
  function finish(code) {
7
6
  process.exitCode = code;
8
7
  setTimeout(() => process.exit(code), 2e3).unref();
9
8
  }
10
- const stopController = new AbortController();
11
- let stopped;
12
- const server = runServer(process.argv.slice(2), stopController.signal);
13
- installProcessGuards({
14
- write: (message) => void process.stderr.write(message),
15
- stop: () => {
16
- stopController.abort();
17
- stopped ??= server.catch(() => void 0);
18
- return stopped;
19
- },
20
- exit: (code) => process.exit(code)
21
- });
22
- server.then((code) => {
23
- finish(code);
24
- }, (error) => {
9
+ async function main() {
10
+ if (process.env.PO_SERVER_SUPERVISED !== "1") return superviseServer({
11
+ entry: process.argv[1],
12
+ args: process.argv.slice(2),
13
+ environment: process.env,
14
+ notice: (message) => void process.stderr.write(`[po-server] ${message}\n`)
15
+ });
16
+ await import("../src/bin/agentDirectory.mjs");
17
+ const { runServer } = await import("../src/cli/server/run.mjs");
18
+ const stopController = new AbortController();
19
+ let stopped;
20
+ const server = runServer(process.argv.slice(2), stopController.signal);
21
+ installProcessGuards({
22
+ write: (message) => void process.stderr.write(message),
23
+ stop: (reason) => {
24
+ stopController.abort(reason);
25
+ stopped ??= server.catch(() => void 0);
26
+ return stopped;
27
+ },
28
+ exit: (code) => process.exit(code)
29
+ });
30
+ return server;
31
+ }
32
+ main().then(finish, (error) => {
25
33
  process.stderr.write(`[po-server] ${error instanceof Error ? error.message : String(error)}\n`);
26
34
  finish(1);
27
35
  });
@@ -1 +1 @@
1
- {"version":3,"file":"serve.mjs","names":[],"sources":["../../src/bin/serve.ts"],"sourcesContent":["#!/usr/bin/env node\nimport './agentDirectory';\nimport { installProcessGuards } from '../cli/server/processGuards';\nimport { runServer } from '../cli/server/run';\n\n// The library finishes bounded cleanup first. A stale handle must not keep this\n// standalone CLI alive forever; an unreferenced deadline still lets output drain.\nfunction finish(code: number): void {\n process.exitCode = code;\n setTimeout(() => process.exit(code), 2_000).unref();\n}\n\nconst stopController = new AbortController();\nlet stopped: Promise<unknown> | undefined;\nconst server = runServer(process.argv.slice(2), stopController.signal);\ninstallProcessGuards({\n write: (message) => void process.stderr.write(message),\n stop: () => {\n stopController.abort();\n // The failure itself is reported by the handler below; here it only ends the stop.\n stopped ??= server.catch(() => undefined);\n return stopped;\n },\n exit: (code) => process.exit(code),\n});\n\nserver.then(\n (code) => {\n finish(code);\n },\n (error: unknown) => {\n process.stderr.write(`[po-server] ${error instanceof Error ? error.message : String(error)}\\n`);\n finish(1);\n },\n);\n"],"mappings":";;;;;AAOA,SAAS,OAAO,MAAoB;CAClC,QAAQ,WAAW;CACnB,iBAAiB,QAAQ,KAAK,IAAI,GAAG,GAAK,CAAC,CAAC,MAAM;AACpD;AAEA,MAAM,iBAAiB,IAAI,gBAAgB;AAC3C,IAAI;AACJ,MAAM,SAAS,UAAU,QAAQ,KAAK,MAAM,CAAC,GAAG,eAAe,MAAM;AACrE,qBAAqB;CACnB,QAAQ,YAAY,KAAK,QAAQ,OAAO,MAAM,OAAO;CACrD,YAAY;EACV,eAAe,MAAM;EAErB,YAAY,OAAO,YAAY,KAAA,CAAS;EACxC,OAAO;CACT;CACA,OAAO,SAAS,QAAQ,KAAK,IAAI;AACnC,CAAC;AAED,OAAO,MACJ,SAAS;CACR,OAAO,IAAI;AACb,IACC,UAAmB;CAClB,QAAQ,OAAO,MAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GAAG;CAC9F,OAAO,CAAC;AACV,CACF"}
1
+ {"version":3,"file":"serve.mjs","names":[],"sources":["../../src/bin/serve.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { installProcessGuards } from '../cli/server/processGuards';\nimport { superviseServer } from '../cli/server/supervise';\n\n// The library finishes bounded cleanup first. A stale handle must not keep this\n// standalone CLI alive forever; an unreferenced deadline still lets output drain.\nfunction finish(code: number): void {\n process.exitCode = code;\n setTimeout(() => process.exit(code), 2_000).unref();\n}\n\nasync function main(): Promise<number> {\n if (process.env.PO_SERVER_SUPERVISED !== '1') {\n return superviseServer({\n entry: process.argv[1]!,\n args: process.argv.slice(2),\n environment: process.env,\n notice: (message) => void process.stderr.write(`[po-server] ${message}\\n`),\n });\n }\n\n // Only the worker initializes configuration and imports the runtime.\n await import('./agentDirectory');\n const { runServer } = await import('../cli/server/run');\n const stopController = new AbortController();\n let stopped: Promise<unknown> | undefined;\n const server = runServer(process.argv.slice(2), stopController.signal);\n installProcessGuards({\n write: (message) => void process.stderr.write(message),\n stop: (reason) => {\n stopController.abort(reason);\n // The failure itself is reported by the handler below; here it only ends the stop.\n stopped ??= server.catch(() => undefined);\n return stopped;\n },\n exit: (code) => process.exit(code),\n });\n return server;\n}\n\nmain().then(finish, (error: unknown) => {\n process.stderr.write(`[po-server] ${error instanceof Error ? error.message : String(error)}\\n`);\n finish(1);\n});\n"],"mappings":";;;;AAMA,SAAS,OAAO,MAAoB;CAClC,QAAQ,WAAW;CACnB,iBAAiB,QAAQ,KAAK,IAAI,GAAG,GAAK,CAAC,CAAC,MAAM;AACpD;AAEA,eAAe,OAAwB;CACrC,IAAI,QAAQ,IAAI,yBAAyB,KACvC,OAAO,gBAAgB;EACrB,OAAO,QAAQ,KAAK;EACpB,MAAM,QAAQ,KAAK,MAAM,CAAC;EAC1B,aAAa,QAAQ;EACrB,SAAS,YAAY,KAAK,QAAQ,OAAO,MAAM,eAAe,QAAQ,GAAG;CAC3E,CAAC;CAIH,MAAM,OAAO;CACb,MAAM,EAAE,cAAc,MAAM,OAAO;CACnC,MAAM,iBAAiB,IAAI,gBAAgB;CAC3C,IAAI;CACJ,MAAM,SAAS,UAAU,QAAQ,KAAK,MAAM,CAAC,GAAG,eAAe,MAAM;CACrE,qBAAqB;EACnB,QAAQ,YAAY,KAAK,QAAQ,OAAO,MAAM,OAAO;EACrD,OAAO,WAAW;GAChB,eAAe,MAAM,MAAM;GAE3B,YAAY,OAAO,YAAY,KAAA,CAAS;GACxC,OAAO;EACT;EACA,OAAO,SAAS,QAAQ,KAAK,IAAI;CACnC,CAAC;CACD,OAAO;AACT;AAEA,KAAK,CAAC,CAAC,KAAK,SAAS,UAAmB;CACtC,QAAQ,OAAO,MAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GAAG;CAC9F,OAAO,CAAC;AACV,CAAC"}