@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,172 @@
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_core_runtimeJson = require("@agimon-ai/po-core/runtimeJson");
7
+ let node_child_process = require("node:child_process");
8
+ let node_os = require("node:os");
9
+ let node_timers_promises = require("node:timers/promises");
10
+ let cross_spawn = require("cross-spawn");
11
+ cross_spawn = require_runtime.__toESM(cross_spawn, 1);
12
+ //#region src/cli/commands/compat/providers/process.ts
13
+ /**
14
+ * Child process and cross-repository locking primitives.
15
+ *
16
+ * Shared by every compatibility provider and by the Pi launch command, so that
17
+ * signal forwarding behaves the same however the harness starts a child.
18
+ */
19
+ const FORWARDED_SIGNALS = [
20
+ "SIGINT",
21
+ "SIGTERM",
22
+ "SIGHUP",
23
+ "SIGQUIT"
24
+ ];
25
+ const SIGNAL_EXIT_CODE_OFFSET = 128;
26
+ const UNKNOWN_SIGNAL_EXIT_CODE = 1;
27
+ const LOCK_RETRY_MS = 25;
28
+ const LOCK_STALE_MS = 1e4;
29
+ const LOCK_TIMEOUT_MS = 3e4;
30
+ const FILE_EXISTS_ERROR = "EEXIST";
31
+ const FILE_NOT_FOUND_ERROR = "ENOENT";
32
+ const PROCESS_NOT_FOUND_ERROR = "ESRCH";
33
+ const LOCK_OWNER_FILENAME = "owner.json";
34
+ /** Runs a command and returns its trimmed stdout, throwing on a non-zero exit. */
35
+ function runCaptured(command, args, cwd, environment) {
36
+ const result = (0, node_child_process.spawnSync)(command, args, {
37
+ cwd,
38
+ encoding: "utf8",
39
+ env: environment
40
+ });
41
+ if (result.error) throw result.error;
42
+ if (result.stderr) process.stderr.write(result.stderr);
43
+ if (result.status !== 0) throw new Error(`${command} exited with status ${result.status ?? 1}`);
44
+ return result.stdout.trim();
45
+ }
46
+ /** Runs a command with inherited stdio, throwing on a non-zero exit. */
47
+ function runChecked(command, args, cwd, environment) {
48
+ const result = (0, node_child_process.spawnSync)(command, args, {
49
+ cwd,
50
+ env: environment,
51
+ stdio: "inherit"
52
+ });
53
+ if (result.error) throw result.error;
54
+ if (result.status !== 0) throw new Error(`${command} exited with status ${result.status ?? 1}`);
55
+ }
56
+ /** The conventional 128+n exit code for a child killed by a signal. */
57
+ function signalExitCode(signal) {
58
+ if (!signal) return UNKNOWN_SIGNAL_EXIT_CODE;
59
+ const signalNumber = node_os.constants.signals[signal];
60
+ return signalNumber ? SIGNAL_EXIT_CODE_OFFSET + signalNumber : UNKNOWN_SIGNAL_EXIT_CODE;
61
+ }
62
+ /**
63
+ * Runs an interactive child, forwarding terminal signals for its lifetime.
64
+ *
65
+ * Listeners are registered with `on` rather than `once` so a second Ctrl-C still
66
+ * reaches the child, and removed in a finally so repeated launches in one
67
+ * process do not accumulate handlers.
68
+ */
69
+ function forwardSignals(child) {
70
+ const forward = (signal) => {
71
+ if (child.exitCode === null && child.signalCode === null) child.kill(signal);
72
+ };
73
+ for (const signal of FORWARDED_SIGNALS) process.on(signal, forward);
74
+ return () => {
75
+ for (const signal of FORWARDED_SIGNALS) process.removeListener(signal, forward);
76
+ };
77
+ }
78
+ /** Resolves with the child's exit code, or the conventional code for its signal. */
79
+ function waitForExit(child) {
80
+ return new Promise((resolve, reject) => {
81
+ child.once("error", reject);
82
+ child.once("exit", (code, signal) => resolve(code ?? signalExitCode(signal)));
83
+ });
84
+ }
85
+ async function runInteractive(command, args, cwd, environment) {
86
+ const child = (0, cross_spawn.default)(command, args, {
87
+ cwd,
88
+ env: environment,
89
+ stdio: "inherit"
90
+ });
91
+ const stopForwarding = forwardSignals(child);
92
+ try {
93
+ return await waitForExit(child);
94
+ } finally {
95
+ stopForwarding();
96
+ }
97
+ }
98
+ function isFileSystemError(error) {
99
+ return error instanceof Error && typeof error.code === "string";
100
+ }
101
+ /** True when the recorded lock owner is still a live process. */
102
+ function lockOwnerIsRunning(lockPath) {
103
+ const owner = (0, _agimon_ai_po_core_runtimeJson.readJson)(node_path.default.join(lockPath, LOCK_OWNER_FILENAME));
104
+ if (typeof owner.pid !== "number" || !Number.isSafeInteger(owner.pid) || owner.pid <= 0) return false;
105
+ try {
106
+ process.kill(owner.pid, 0);
107
+ return true;
108
+ } catch (error) {
109
+ return !isFileSystemError(error) || error.code !== PROCESS_NOT_FOUND_ERROR;
110
+ }
111
+ }
112
+ /**
113
+ * Takes an exclusive lock by creating a directory, which is atomic everywhere.
114
+ *
115
+ * A lock older than the stale window whose owner is gone is reclaimed, so a
116
+ * harness killed mid-sync cannot block every other repository forever.
117
+ */
118
+ async function acquireDirectoryLock(lockPath) {
119
+ node_fs.default.mkdirSync(node_path.default.dirname(lockPath), { recursive: true });
120
+ const startedAt = Date.now();
121
+ while (true) try {
122
+ await node_fs.default.promises.mkdir(lockPath);
123
+ try {
124
+ (0, _agimon_ai_po_core_runtimeJson.writeJson)(node_path.default.join(lockPath, LOCK_OWNER_FILENAME), { pid: process.pid });
125
+ } catch (error) {
126
+ await node_fs.default.promises.rm(lockPath, {
127
+ recursive: true,
128
+ force: true
129
+ });
130
+ throw error;
131
+ }
132
+ return () => node_fs.default.promises.rm(lockPath, {
133
+ recursive: true,
134
+ force: true
135
+ });
136
+ } catch (error) {
137
+ if (!isFileSystemError(error) || error.code !== FILE_EXISTS_ERROR) throw error;
138
+ try {
139
+ const stat = await node_fs.default.promises.stat(lockPath);
140
+ if (Date.now() - stat.mtimeMs >= LOCK_STALE_MS && !lockOwnerIsRunning(lockPath)) {
141
+ await node_fs.default.promises.rm(lockPath, {
142
+ recursive: true,
143
+ force: true
144
+ });
145
+ continue;
146
+ }
147
+ } catch (statError) {
148
+ if (isFileSystemError(statError) && statError.code === FILE_NOT_FOUND_ERROR) continue;
149
+ throw statError;
150
+ }
151
+ if (Date.now() - startedAt >= LOCK_TIMEOUT_MS) throw new Error(`Timed out waiting for Antigravity state lock: ${lockPath}`);
152
+ await (0, node_timers_promises.setTimeout)(LOCK_RETRY_MS);
153
+ }
154
+ }
155
+ /** True when `candidate` is `root` itself or sits underneath it. */
156
+ function pathInside(root, candidate) {
157
+ const relative = node_path.default.relative(root, candidate);
158
+ return relative === "" || !relative.startsWith(`..${node_path.default.sep}`) && relative !== ".." && !node_path.default.isAbsolute(relative);
159
+ }
160
+ //#endregion
161
+ exports.acquireDirectoryLock = acquireDirectoryLock;
162
+ exports.forwardSignals = forwardSignals;
163
+ exports.isFileSystemError = isFileSystemError;
164
+ exports.lockOwnerIsRunning = lockOwnerIsRunning;
165
+ exports.pathInside = pathInside;
166
+ exports.runCaptured = runCaptured;
167
+ exports.runChecked = runChecked;
168
+ exports.runInteractive = runInteractive;
169
+ exports.signalExitCode = signalExitCode;
170
+ exports.waitForExit = waitForExit;
171
+
172
+ //# sourceMappingURL=process.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.cjs","names":["spawnSync","osConstants","spawn","readJson","path","fs","delay"],"sources":["../../../../../../src/cli/commands/compat/providers/process.ts"],"sourcesContent":["import { type ChildProcess, spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport { constants as osConstants } from 'node:os';\nimport path from 'node:path';\nimport { setTimeout as delay } from 'node:timers/promises';\n\nimport { readJson, writeJson } from '@agimon-ai/po-core/runtimeJson';\nimport spawn from 'cross-spawn';\n\n/**\n * Child process and cross-repository locking primitives.\n *\n * Shared by every compatibility provider and by the Pi launch command, so that\n * signal forwarding behaves the same however the harness starts a child.\n */\n\nconst FORWARDED_SIGNALS: NodeJS.Signals[] = ['SIGINT', 'SIGTERM', 'SIGHUP', 'SIGQUIT'];\nconst SIGNAL_EXIT_CODE_OFFSET = 128;\nconst UNKNOWN_SIGNAL_EXIT_CODE = 1;\nconst LOCK_RETRY_MS = 25;\nconst LOCK_STALE_MS = 10_000;\nconst LOCK_TIMEOUT_MS = 30_000;\nconst FILE_EXISTS_ERROR = 'EEXIST';\nconst FILE_NOT_FOUND_ERROR = 'ENOENT';\nconst PROCESS_NOT_FOUND_ERROR = 'ESRCH';\nconst LOCK_OWNER_FILENAME = 'owner.json';\n\n/** Runs a command and returns its trimmed stdout, throwing on a non-zero exit. */\nexport function runCaptured(command: string, args: string[], cwd: string, environment: NodeJS.ProcessEnv): string {\n const result = spawnSync(command, args, { cwd, encoding: 'utf8', env: environment });\n if (result.error) throw result.error;\n if (result.stderr) process.stderr.write(result.stderr);\n if (result.status !== 0) {\n throw new Error(`${command} exited with status ${result.status ?? 1}`);\n }\n return result.stdout.trim();\n}\n\n/** Runs a command with inherited stdio, throwing on a non-zero exit. */\nexport function runChecked(command: string, args: string[], cwd: string, environment: NodeJS.ProcessEnv): void {\n const result = spawnSync(command, args, { cwd, env: environment, stdio: 'inherit' });\n if (result.error) throw result.error;\n if (result.status !== 0) throw new Error(`${command} exited with status ${result.status ?? 1}`);\n}\n\n/** The conventional 128+n exit code for a child killed by a signal. */\nexport function signalExitCode(signal: NodeJS.Signals | null): number {\n if (!signal) return UNKNOWN_SIGNAL_EXIT_CODE;\n const signalNumber = osConstants.signals[signal];\n return signalNumber ? SIGNAL_EXIT_CODE_OFFSET + signalNumber : UNKNOWN_SIGNAL_EXIT_CODE;\n}\n\n/**\n * Runs an interactive child, forwarding terminal signals for its lifetime.\n *\n * Listeners are registered with `on` rather than `once` so a second Ctrl-C still\n * reaches the child, and removed in a finally so repeated launches in one\n * process do not accumulate handlers.\n */\nexport function forwardSignals(child: ChildProcess): () => void {\n const forward = (signal: NodeJS.Signals): void => {\n if (child.exitCode === null && child.signalCode === null) child.kill(signal);\n };\n for (const signal of FORWARDED_SIGNALS) process.on(signal, forward);\n return () => {\n for (const signal of FORWARDED_SIGNALS) process.removeListener(signal, forward);\n };\n}\n\n/** Resolves with the child's exit code, or the conventional code for its signal. */\nexport function waitForExit(child: ChildProcess): Promise<number> {\n return new Promise<number>((resolve, reject) => {\n child.once('error', reject);\n child.once('exit', (code, signal) => resolve(code ?? signalExitCode(signal)));\n });\n}\n\nexport async function runInteractive(\n command: string,\n args: string[],\n cwd: string,\n environment: NodeJS.ProcessEnv,\n): Promise<number> {\n const child = spawn(command, args, { cwd, env: environment, stdio: 'inherit' });\n const stopForwarding = forwardSignals(child);\n try {\n return await waitForExit(child);\n } finally {\n stopForwarding();\n }\n}\n\nexport function isFileSystemError(error: unknown): error is NodeJS.ErrnoException {\n return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string';\n}\n\n/** True when the recorded lock owner is still a live process. */\nexport function lockOwnerIsRunning(lockPath: string): boolean {\n const owner = readJson(path.join(lockPath, LOCK_OWNER_FILENAME));\n if (typeof owner.pid !== 'number' || !Number.isSafeInteger(owner.pid) || owner.pid <= 0) return false;\n try {\n process.kill(owner.pid, 0);\n return true;\n } catch (error) {\n // Anything other than \"no such process\" means the pid exists but is not\n // ours to signal, so the lock is still held.\n return !isFileSystemError(error) || error.code !== PROCESS_NOT_FOUND_ERROR;\n }\n}\n\n/**\n * Takes an exclusive lock by creating a directory, which is atomic everywhere.\n *\n * A lock older than the stale window whose owner is gone is reclaimed, so a\n * harness killed mid-sync cannot block every other repository forever.\n */\nexport async function acquireDirectoryLock(lockPath: string): Promise<() => Promise<void>> {\n fs.mkdirSync(path.dirname(lockPath), { recursive: true });\n const startedAt = Date.now();\n\n while (true) {\n try {\n await fs.promises.mkdir(lockPath);\n try {\n writeJson(path.join(lockPath, LOCK_OWNER_FILENAME), { pid: process.pid });\n } catch (error) {\n await fs.promises.rm(lockPath, { recursive: true, force: true });\n throw error;\n }\n return () => fs.promises.rm(lockPath, { recursive: true, force: true });\n } catch (error) {\n if (!isFileSystemError(error) || error.code !== FILE_EXISTS_ERROR) throw error;\n try {\n const stat = await fs.promises.stat(lockPath);\n if (Date.now() - stat.mtimeMs >= LOCK_STALE_MS && !lockOwnerIsRunning(lockPath)) {\n await fs.promises.rm(lockPath, { recursive: true, force: true });\n continue;\n }\n } catch (statError) {\n // The holder released between the failed mkdir and this stat, so retry\n // immediately rather than waiting out the retry delay.\n if (isFileSystemError(statError) && statError.code === FILE_NOT_FOUND_ERROR) continue;\n throw statError;\n }\n if (Date.now() - startedAt >= LOCK_TIMEOUT_MS) {\n throw new Error(`Timed out waiting for Antigravity state lock: ${lockPath}`);\n }\n await delay(LOCK_RETRY_MS);\n }\n }\n}\n\n/** True when `candidate` is `root` itself or sits underneath it. */\nexport function pathInside(root: string, candidate: string): boolean {\n const relative = path.relative(root, candidate);\n return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));\n}\n"],"mappings":"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"}
@@ -0,0 +1,33 @@
1
+ import { ChildProcess } from "node:child_process";
2
+ //#region src/cli/commands/compat/providers/process.d.ts
3
+ /** Runs a command and returns its trimmed stdout, throwing on a non-zero exit. */
4
+ export declare function runCaptured(command: string, args: string[], cwd: string, environment: NodeJS.ProcessEnv): string;
5
+ /** Runs a command with inherited stdio, throwing on a non-zero exit. */
6
+ export declare function runChecked(command: string, args: string[], cwd: string, environment: NodeJS.ProcessEnv): void;
7
+ /** The conventional 128+n exit code for a child killed by a signal. */
8
+ export declare function signalExitCode(signal: NodeJS.Signals | null): number;
9
+ /**
10
+ * Runs an interactive child, forwarding terminal signals for its lifetime.
11
+ *
12
+ * Listeners are registered with `on` rather than `once` so a second Ctrl-C still
13
+ * reaches the child, and removed in a finally so repeated launches in one
14
+ * process do not accumulate handlers.
15
+ */
16
+ export declare function forwardSignals(child: ChildProcess): () => void;
17
+ /** Resolves with the child's exit code, or the conventional code for its signal. */
18
+ export declare function waitForExit(child: ChildProcess): Promise<number>;
19
+ export declare function runInteractive(command: string, args: string[], cwd: string, environment: NodeJS.ProcessEnv): Promise<number>;
20
+ export declare function isFileSystemError(error: unknown): error is NodeJS.ErrnoException;
21
+ /** True when the recorded lock owner is still a live process. */
22
+ export declare function lockOwnerIsRunning(lockPath: string): boolean;
23
+ /**
24
+ * Takes an exclusive lock by creating a directory, which is atomic everywhere.
25
+ *
26
+ * A lock older than the stale window whose owner is gone is reclaimed, so a
27
+ * harness killed mid-sync cannot block every other repository forever.
28
+ */
29
+ export declare function acquireDirectoryLock(lockPath: string): Promise<() => Promise<void>>;
30
+ /** True when `candidate` is `root` itself or sits underneath it. */
31
+ export declare function pathInside(root: string, candidate: string): boolean;
32
+ //#endregion
33
+ //# sourceMappingURL=process.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.d.mts","names":[],"sources":["../../../../../../src/cli/commands/compat/providers/process.ts"],"mappings":";;;wBA4BgB,YAAY,iBAAiB,gBAAgB,aAAa,aAAa,OAAO;;wBAW9E,WAAW,iBAAiB,gBAAgB,aAAa,aAAa,OAAO;;wBAO7E,eAAe,QAAQ,OAAO;;;;;;;;wBAa9B,eAAe,OAAO;;wBAWtB,YAAY,OAAO,eAAe;wBAO5B,eACpB,iBACA,gBACA,aACA,aAAa,OAAO,aACnB;wBAUa,kBAAkB,iBAAiB,SAAS,OAAO;;wBAKnD,mBAAmB;;;;;;;wBAmBb,qBAAqB,mBAAmB,cAAc;;wBAqC5D,WAAW,cAAc"}
@@ -0,0 +1,159 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { readJson, writeJson } from "@agimon-ai/po-core/runtimeJson";
4
+ import { spawnSync } from "node:child_process";
5
+ import { constants as constants$1 } from "node:os";
6
+ import { setTimeout } from "node:timers/promises";
7
+ import spawn$1 from "cross-spawn";
8
+ //#region src/cli/commands/compat/providers/process.ts
9
+ /**
10
+ * Child process and cross-repository locking primitives.
11
+ *
12
+ * Shared by every compatibility provider and by the Pi launch command, so that
13
+ * signal forwarding behaves the same however the harness starts a child.
14
+ */
15
+ const FORWARDED_SIGNALS = [
16
+ "SIGINT",
17
+ "SIGTERM",
18
+ "SIGHUP",
19
+ "SIGQUIT"
20
+ ];
21
+ const SIGNAL_EXIT_CODE_OFFSET = 128;
22
+ const UNKNOWN_SIGNAL_EXIT_CODE = 1;
23
+ const LOCK_RETRY_MS = 25;
24
+ const LOCK_STALE_MS = 1e4;
25
+ const LOCK_TIMEOUT_MS = 3e4;
26
+ const FILE_EXISTS_ERROR = "EEXIST";
27
+ const FILE_NOT_FOUND_ERROR = "ENOENT";
28
+ const PROCESS_NOT_FOUND_ERROR = "ESRCH";
29
+ const LOCK_OWNER_FILENAME = "owner.json";
30
+ /** Runs a command and returns its trimmed stdout, throwing on a non-zero exit. */
31
+ function runCaptured(command, args, cwd, environment) {
32
+ const result = spawnSync(command, args, {
33
+ cwd,
34
+ encoding: "utf8",
35
+ env: environment
36
+ });
37
+ if (result.error) throw result.error;
38
+ if (result.stderr) process.stderr.write(result.stderr);
39
+ if (result.status !== 0) throw new Error(`${command} exited with status ${result.status ?? 1}`);
40
+ return result.stdout.trim();
41
+ }
42
+ /** Runs a command with inherited stdio, throwing on a non-zero exit. */
43
+ function runChecked(command, args, cwd, environment) {
44
+ const result = spawnSync(command, args, {
45
+ cwd,
46
+ env: environment,
47
+ stdio: "inherit"
48
+ });
49
+ if (result.error) throw result.error;
50
+ if (result.status !== 0) throw new Error(`${command} exited with status ${result.status ?? 1}`);
51
+ }
52
+ /** The conventional 128+n exit code for a child killed by a signal. */
53
+ function signalExitCode(signal) {
54
+ if (!signal) return UNKNOWN_SIGNAL_EXIT_CODE;
55
+ const signalNumber = constants$1.signals[signal];
56
+ return signalNumber ? SIGNAL_EXIT_CODE_OFFSET + signalNumber : UNKNOWN_SIGNAL_EXIT_CODE;
57
+ }
58
+ /**
59
+ * Runs an interactive child, forwarding terminal signals for its lifetime.
60
+ *
61
+ * Listeners are registered with `on` rather than `once` so a second Ctrl-C still
62
+ * reaches the child, and removed in a finally so repeated launches in one
63
+ * process do not accumulate handlers.
64
+ */
65
+ function forwardSignals(child) {
66
+ const forward = (signal) => {
67
+ if (child.exitCode === null && child.signalCode === null) child.kill(signal);
68
+ };
69
+ for (const signal of FORWARDED_SIGNALS) process.on(signal, forward);
70
+ return () => {
71
+ for (const signal of FORWARDED_SIGNALS) process.removeListener(signal, forward);
72
+ };
73
+ }
74
+ /** Resolves with the child's exit code, or the conventional code for its signal. */
75
+ function waitForExit(child) {
76
+ return new Promise((resolve, reject) => {
77
+ child.once("error", reject);
78
+ child.once("exit", (code, signal) => resolve(code ?? signalExitCode(signal)));
79
+ });
80
+ }
81
+ async function runInteractive(command, args, cwd, environment) {
82
+ const child = spawn$1(command, args, {
83
+ cwd,
84
+ env: environment,
85
+ stdio: "inherit"
86
+ });
87
+ const stopForwarding = forwardSignals(child);
88
+ try {
89
+ return await waitForExit(child);
90
+ } finally {
91
+ stopForwarding();
92
+ }
93
+ }
94
+ function isFileSystemError(error) {
95
+ return error instanceof Error && typeof error.code === "string";
96
+ }
97
+ /** True when the recorded lock owner is still a live process. */
98
+ function lockOwnerIsRunning(lockPath) {
99
+ const owner = readJson(path.join(lockPath, LOCK_OWNER_FILENAME));
100
+ if (typeof owner.pid !== "number" || !Number.isSafeInteger(owner.pid) || owner.pid <= 0) return false;
101
+ try {
102
+ process.kill(owner.pid, 0);
103
+ return true;
104
+ } catch (error) {
105
+ return !isFileSystemError(error) || error.code !== PROCESS_NOT_FOUND_ERROR;
106
+ }
107
+ }
108
+ /**
109
+ * Takes an exclusive lock by creating a directory, which is atomic everywhere.
110
+ *
111
+ * A lock older than the stale window whose owner is gone is reclaimed, so a
112
+ * harness killed mid-sync cannot block every other repository forever.
113
+ */
114
+ async function acquireDirectoryLock(lockPath) {
115
+ fs.mkdirSync(path.dirname(lockPath), { recursive: true });
116
+ const startedAt = Date.now();
117
+ while (true) try {
118
+ await fs.promises.mkdir(lockPath);
119
+ try {
120
+ writeJson(path.join(lockPath, LOCK_OWNER_FILENAME), { pid: process.pid });
121
+ } catch (error) {
122
+ await fs.promises.rm(lockPath, {
123
+ recursive: true,
124
+ force: true
125
+ });
126
+ throw error;
127
+ }
128
+ return () => fs.promises.rm(lockPath, {
129
+ recursive: true,
130
+ force: true
131
+ });
132
+ } catch (error) {
133
+ if (!isFileSystemError(error) || error.code !== FILE_EXISTS_ERROR) throw error;
134
+ try {
135
+ const stat = await fs.promises.stat(lockPath);
136
+ if (Date.now() - stat.mtimeMs >= LOCK_STALE_MS && !lockOwnerIsRunning(lockPath)) {
137
+ await fs.promises.rm(lockPath, {
138
+ recursive: true,
139
+ force: true
140
+ });
141
+ continue;
142
+ }
143
+ } catch (statError) {
144
+ if (isFileSystemError(statError) && statError.code === FILE_NOT_FOUND_ERROR) continue;
145
+ throw statError;
146
+ }
147
+ if (Date.now() - startedAt >= LOCK_TIMEOUT_MS) throw new Error(`Timed out waiting for Antigravity state lock: ${lockPath}`);
148
+ await setTimeout(LOCK_RETRY_MS);
149
+ }
150
+ }
151
+ /** True when `candidate` is `root` itself or sits underneath it. */
152
+ function pathInside(root, candidate) {
153
+ const relative = path.relative(root, candidate);
154
+ return relative === "" || !relative.startsWith(`..${path.sep}`) && relative !== ".." && !path.isAbsolute(relative);
155
+ }
156
+ //#endregion
157
+ export { acquireDirectoryLock, forwardSignals, isFileSystemError, lockOwnerIsRunning, pathInside, runCaptured, runChecked, runInteractive, signalExitCode, waitForExit };
158
+
159
+ //# sourceMappingURL=process.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.mjs","names":["osConstants","spawn","delay"],"sources":["../../../../../../src/cli/commands/compat/providers/process.ts"],"sourcesContent":["import { type ChildProcess, spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport { constants as osConstants } from 'node:os';\nimport path from 'node:path';\nimport { setTimeout as delay } from 'node:timers/promises';\n\nimport { readJson, writeJson } from '@agimon-ai/po-core/runtimeJson';\nimport spawn from 'cross-spawn';\n\n/**\n * Child process and cross-repository locking primitives.\n *\n * Shared by every compatibility provider and by the Pi launch command, so that\n * signal forwarding behaves the same however the harness starts a child.\n */\n\nconst FORWARDED_SIGNALS: NodeJS.Signals[] = ['SIGINT', 'SIGTERM', 'SIGHUP', 'SIGQUIT'];\nconst SIGNAL_EXIT_CODE_OFFSET = 128;\nconst UNKNOWN_SIGNAL_EXIT_CODE = 1;\nconst LOCK_RETRY_MS = 25;\nconst LOCK_STALE_MS = 10_000;\nconst LOCK_TIMEOUT_MS = 30_000;\nconst FILE_EXISTS_ERROR = 'EEXIST';\nconst FILE_NOT_FOUND_ERROR = 'ENOENT';\nconst PROCESS_NOT_FOUND_ERROR = 'ESRCH';\nconst LOCK_OWNER_FILENAME = 'owner.json';\n\n/** Runs a command and returns its trimmed stdout, throwing on a non-zero exit. */\nexport function runCaptured(command: string, args: string[], cwd: string, environment: NodeJS.ProcessEnv): string {\n const result = spawnSync(command, args, { cwd, encoding: 'utf8', env: environment });\n if (result.error) throw result.error;\n if (result.stderr) process.stderr.write(result.stderr);\n if (result.status !== 0) {\n throw new Error(`${command} exited with status ${result.status ?? 1}`);\n }\n return result.stdout.trim();\n}\n\n/** Runs a command with inherited stdio, throwing on a non-zero exit. */\nexport function runChecked(command: string, args: string[], cwd: string, environment: NodeJS.ProcessEnv): void {\n const result = spawnSync(command, args, { cwd, env: environment, stdio: 'inherit' });\n if (result.error) throw result.error;\n if (result.status !== 0) throw new Error(`${command} exited with status ${result.status ?? 1}`);\n}\n\n/** The conventional 128+n exit code for a child killed by a signal. */\nexport function signalExitCode(signal: NodeJS.Signals | null): number {\n if (!signal) return UNKNOWN_SIGNAL_EXIT_CODE;\n const signalNumber = osConstants.signals[signal];\n return signalNumber ? SIGNAL_EXIT_CODE_OFFSET + signalNumber : UNKNOWN_SIGNAL_EXIT_CODE;\n}\n\n/**\n * Runs an interactive child, forwarding terminal signals for its lifetime.\n *\n * Listeners are registered with `on` rather than `once` so a second Ctrl-C still\n * reaches the child, and removed in a finally so repeated launches in one\n * process do not accumulate handlers.\n */\nexport function forwardSignals(child: ChildProcess): () => void {\n const forward = (signal: NodeJS.Signals): void => {\n if (child.exitCode === null && child.signalCode === null) child.kill(signal);\n };\n for (const signal of FORWARDED_SIGNALS) process.on(signal, forward);\n return () => {\n for (const signal of FORWARDED_SIGNALS) process.removeListener(signal, forward);\n };\n}\n\n/** Resolves with the child's exit code, or the conventional code for its signal. */\nexport function waitForExit(child: ChildProcess): Promise<number> {\n return new Promise<number>((resolve, reject) => {\n child.once('error', reject);\n child.once('exit', (code, signal) => resolve(code ?? signalExitCode(signal)));\n });\n}\n\nexport async function runInteractive(\n command: string,\n args: string[],\n cwd: string,\n environment: NodeJS.ProcessEnv,\n): Promise<number> {\n const child = spawn(command, args, { cwd, env: environment, stdio: 'inherit' });\n const stopForwarding = forwardSignals(child);\n try {\n return await waitForExit(child);\n } finally {\n stopForwarding();\n }\n}\n\nexport function isFileSystemError(error: unknown): error is NodeJS.ErrnoException {\n return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string';\n}\n\n/** True when the recorded lock owner is still a live process. */\nexport function lockOwnerIsRunning(lockPath: string): boolean {\n const owner = readJson(path.join(lockPath, LOCK_OWNER_FILENAME));\n if (typeof owner.pid !== 'number' || !Number.isSafeInteger(owner.pid) || owner.pid <= 0) return false;\n try {\n process.kill(owner.pid, 0);\n return true;\n } catch (error) {\n // Anything other than \"no such process\" means the pid exists but is not\n // ours to signal, so the lock is still held.\n return !isFileSystemError(error) || error.code !== PROCESS_NOT_FOUND_ERROR;\n }\n}\n\n/**\n * Takes an exclusive lock by creating a directory, which is atomic everywhere.\n *\n * A lock older than the stale window whose owner is gone is reclaimed, so a\n * harness killed mid-sync cannot block every other repository forever.\n */\nexport async function acquireDirectoryLock(lockPath: string): Promise<() => Promise<void>> {\n fs.mkdirSync(path.dirname(lockPath), { recursive: true });\n const startedAt = Date.now();\n\n while (true) {\n try {\n await fs.promises.mkdir(lockPath);\n try {\n writeJson(path.join(lockPath, LOCK_OWNER_FILENAME), { pid: process.pid });\n } catch (error) {\n await fs.promises.rm(lockPath, { recursive: true, force: true });\n throw error;\n }\n return () => fs.promises.rm(lockPath, { recursive: true, force: true });\n } catch (error) {\n if (!isFileSystemError(error) || error.code !== FILE_EXISTS_ERROR) throw error;\n try {\n const stat = await fs.promises.stat(lockPath);\n if (Date.now() - stat.mtimeMs >= LOCK_STALE_MS && !lockOwnerIsRunning(lockPath)) {\n await fs.promises.rm(lockPath, { recursive: true, force: true });\n continue;\n }\n } catch (statError) {\n // The holder released between the failed mkdir and this stat, so retry\n // immediately rather than waiting out the retry delay.\n if (isFileSystemError(statError) && statError.code === FILE_NOT_FOUND_ERROR) continue;\n throw statError;\n }\n if (Date.now() - startedAt >= LOCK_TIMEOUT_MS) {\n throw new Error(`Timed out waiting for Antigravity state lock: ${lockPath}`);\n }\n await delay(LOCK_RETRY_MS);\n }\n }\n}\n\n/** True when `candidate` is `root` itself or sits underneath it. */\nexport function pathInside(root: string, candidate: string): boolean {\n const relative = path.relative(root, candidate);\n return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));\n}\n"],"mappings":"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"}
@@ -0,0 +1,76 @@
1
+ //#region src/cli/commands/compat/providers/shared.ts
2
+ /**
3
+ * Values and argument builders shared by more than one provider.
4
+ *
5
+ * Kept separate from index.ts so the provider modules can import them without
6
+ * depending on the dispatch that imports the provider modules.
7
+ */
8
+ /**
9
+ * Pinned, not `@latest`.
10
+ *
11
+ * These launches run `npx -y`, so a floating tag installs and executes whatever
12
+ * was published most recently on the user's machine, with no lockfile in the
13
+ * way. The version tracks the coordinated `@agimon-ai` release train recorded
14
+ * in pnpm-workspace.yaml's minimumReleaseAgeExclude list; bump both together.
15
+ */
16
+ const MCP_PROXY_VERSION = "0.31.16";
17
+ const MCP_PROXY_PACKAGE = `@agimon-ai/mcp-proxy@${MCP_PROXY_VERSION}`;
18
+ const ANTIGRAVITY_MCP_PROXY_PACKAGE = `@agimon-ai/mcp-proxy@${MCP_PROXY_VERSION}`;
19
+ const AGIFLOW_PROXY_SERVER_NAME = "agiflow-proxy";
20
+ const MCP_CONFIG_OPTION = "--config";
21
+ const MCP_PRESTART_OPTION = "--prestart-http";
22
+ const ADD_DIRECTORY_OPTION = "--add-dir";
23
+ const SKIP_PERMISSIONS_OPTION = "--dangerously-skip-permissions";
24
+ const NPX_COMMAND = "npx";
25
+ const PLUGINS_DIRECTORY = "plugins";
26
+ const SKILLS_DIRECTORY = "skills";
27
+ const MCP_SERVERS_KEY = "mcpServers";
28
+ const CORE_PLUGIN_NAME = "core";
29
+ const PLUGIN_MANIFEST_FILENAME = "plugin.json";
30
+ const MCP_SERVE_COMMAND = "mcp-serve";
31
+ const MCP_TYPE_OPTION = "--type";
32
+ const MCP_STDIO_HTTP_TYPE = "stdio-http";
33
+ const MCP_PROXY_MODE_OPTION = "--proxy-mode";
34
+ const MCP_PROXY_MODE = "flat";
35
+ const MCP_PROXY_MODE_ASSIGNMENT = `${MCP_PROXY_MODE_OPTION}=${MCP_PROXY_MODE}`;
36
+ const NPX_ASSUME_YES_OPTION = "-y";
37
+ /**
38
+ * Command line for the MCP proxy.
39
+ *
40
+ * `inlineProxyMode` picks `--proxy-mode=flat` over `--proxy-mode flat`, which
41
+ * Codex needs because it receives the whole argument vector as one `-c` value.
42
+ */
43
+ function mcpProxyArguments(packageName, configPath, assumeYes, inlineProxyMode = false) {
44
+ return [
45
+ ...assumeYes ? [NPX_ASSUME_YES_OPTION] : [],
46
+ packageName,
47
+ MCP_SERVE_COMMAND,
48
+ MCP_TYPE_OPTION,
49
+ MCP_STDIO_HTTP_TYPE,
50
+ ...inlineProxyMode ? [MCP_PROXY_MODE_ASSIGNMENT] : [MCP_PROXY_MODE_OPTION, MCP_PROXY_MODE],
51
+ MCP_CONFIG_OPTION,
52
+ configPath
53
+ ];
54
+ }
55
+ function additionalDirectoryArgs(context) {
56
+ return context.options.additionalDirectories.flatMap((directory) => [ADD_DIRECTORY_OPTION, directory]);
57
+ }
58
+ //#endregion
59
+ exports.ADD_DIRECTORY_OPTION = ADD_DIRECTORY_OPTION;
60
+ exports.AGIFLOW_PROXY_SERVER_NAME = AGIFLOW_PROXY_SERVER_NAME;
61
+ exports.ANTIGRAVITY_MCP_PROXY_PACKAGE = ANTIGRAVITY_MCP_PROXY_PACKAGE;
62
+ exports.CORE_PLUGIN_NAME = CORE_PLUGIN_NAME;
63
+ exports.MCP_CONFIG_OPTION = MCP_CONFIG_OPTION;
64
+ exports.MCP_PRESTART_OPTION = MCP_PRESTART_OPTION;
65
+ exports.MCP_PROXY_PACKAGE = MCP_PROXY_PACKAGE;
66
+ exports.MCP_PROXY_VERSION = MCP_PROXY_VERSION;
67
+ exports.MCP_SERVERS_KEY = MCP_SERVERS_KEY;
68
+ exports.NPX_COMMAND = NPX_COMMAND;
69
+ exports.PLUGINS_DIRECTORY = PLUGINS_DIRECTORY;
70
+ exports.PLUGIN_MANIFEST_FILENAME = PLUGIN_MANIFEST_FILENAME;
71
+ exports.SKILLS_DIRECTORY = SKILLS_DIRECTORY;
72
+ exports.SKIP_PERMISSIONS_OPTION = SKIP_PERMISSIONS_OPTION;
73
+ exports.additionalDirectoryArgs = additionalDirectoryArgs;
74
+ exports.mcpProxyArguments = mcpProxyArguments;
75
+
76
+ //# sourceMappingURL=shared.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.cjs","names":[],"sources":["../../../../../../src/cli/commands/compat/providers/shared.ts"],"sourcesContent":["import type { CompatibilityContext } from '../context';\n\n/**\n * Values and argument builders shared by more than one provider.\n *\n * Kept separate from index.ts so the provider modules can import them without\n * depending on the dispatch that imports the provider modules.\n */\n\n/**\n * Pinned, not `@latest`.\n *\n * These launches run `npx -y`, so a floating tag installs and executes whatever\n * was published most recently on the user's machine, with no lockfile in the\n * way. The version tracks the coordinated `@agimon-ai` release train recorded\n * in pnpm-workspace.yaml's minimumReleaseAgeExclude list; bump both together.\n */\nexport const MCP_PROXY_VERSION = '0.31.16';\nexport const MCP_PROXY_PACKAGE = `@agimon-ai/mcp-proxy@${MCP_PROXY_VERSION}`;\nexport const ANTIGRAVITY_MCP_PROXY_PACKAGE = `@agimon-ai/mcp-proxy@${MCP_PROXY_VERSION}`;\nexport const AGIFLOW_PROXY_SERVER_NAME = 'agiflow-proxy';\nexport const MCP_CONFIG_OPTION = '--config';\nexport const MCP_PRESTART_OPTION = '--prestart-http';\nexport const ADD_DIRECTORY_OPTION = '--add-dir';\nexport const SKIP_PERMISSIONS_OPTION = '--dangerously-skip-permissions';\nexport const NPX_COMMAND = 'npx';\nexport const PLUGINS_DIRECTORY = 'plugins';\nexport const SKILLS_DIRECTORY = 'skills';\nexport const MCP_SERVERS_KEY = 'mcpServers';\nexport const CORE_PLUGIN_NAME = 'core';\nexport const PLUGIN_MANIFEST_FILENAME = 'plugin.json';\n\nconst MCP_SERVE_COMMAND = 'mcp-serve';\nconst MCP_TYPE_OPTION = '--type';\nconst MCP_STDIO_HTTP_TYPE = 'stdio-http';\nconst MCP_PROXY_MODE_OPTION = '--proxy-mode';\nconst MCP_PROXY_MODE = 'flat';\nconst MCP_PROXY_MODE_ASSIGNMENT = `${MCP_PROXY_MODE_OPTION}=${MCP_PROXY_MODE}`;\nconst NPX_ASSUME_YES_OPTION = '-y';\n\n/**\n * Command line for the MCP proxy.\n *\n * `inlineProxyMode` picks `--proxy-mode=flat` over `--proxy-mode flat`, which\n * Codex needs because it receives the whole argument vector as one `-c` value.\n */\nexport function mcpProxyArguments(\n packageName: string,\n configPath: string,\n assumeYes: boolean,\n inlineProxyMode = false,\n): string[] {\n return [\n ...(assumeYes ? [NPX_ASSUME_YES_OPTION] : []),\n packageName,\n MCP_SERVE_COMMAND,\n MCP_TYPE_OPTION,\n MCP_STDIO_HTTP_TYPE,\n ...(inlineProxyMode ? [MCP_PROXY_MODE_ASSIGNMENT] : [MCP_PROXY_MODE_OPTION, MCP_PROXY_MODE]),\n MCP_CONFIG_OPTION,\n configPath,\n ];\n}\n\nexport function additionalDirectoryArgs(context: CompatibilityContext): string[] {\n return context.options.additionalDirectories.flatMap((directory) => [ADD_DIRECTORY_OPTION, directory]);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAa,oBAAoB;AACjC,MAAa,oBAAoB,wBAAwB;AACzD,MAAa,gCAAgC,wBAAwB;AACrE,MAAa,4BAA4B;AACzC,MAAa,oBAAoB;AACjC,MAAa,sBAAsB;AACnC,MAAa,uBAAuB;AACpC,MAAa,0BAA0B;AACvC,MAAa,cAAc;AAC3B,MAAa,oBAAoB;AACjC,MAAa,mBAAmB;AAChC,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;AAChC,MAAa,2BAA2B;AAExC,MAAM,oBAAoB;AAC1B,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAC9B,MAAM,iBAAiB;AACvB,MAAM,4BAA4B,GAAG,sBAAsB,GAAG;AAC9D,MAAM,wBAAwB;;;;;;;AAQ9B,SAAgB,kBACd,aACA,YACA,WACA,kBAAkB,OACR;CACV,OAAO;EACL,GAAI,YAAY,CAAC,qBAAqB,IAAI,CAAC;EAC3C;EACA;EACA;EACA;EACA,GAAI,kBAAkB,CAAC,yBAAyB,IAAI,CAAC,uBAAuB,cAAc;EAC1F;EACA;CACF;AACF;AAEA,SAAgB,wBAAwB,SAAyC;CAC/E,OAAO,QAAQ,QAAQ,sBAAsB,SAAS,cAAc,CAAC,sBAAsB,SAAS,CAAC;AACvG"}
@@ -0,0 +1,40 @@
1
+ import { CompatibilityContext } from "../context.mjs";
2
+ //#region src/cli/commands/compat/providers/shared.d.ts
3
+ /**
4
+ * Values and argument builders shared by more than one provider.
5
+ *
6
+ * Kept separate from index.ts so the provider modules can import them without
7
+ * depending on the dispatch that imports the provider modules.
8
+ */
9
+ /**
10
+ * Pinned, not `@latest`.
11
+ *
12
+ * These launches run `npx -y`, so a floating tag installs and executes whatever
13
+ * was published most recently on the user's machine, with no lockfile in the
14
+ * way. The version tracks the coordinated `@agimon-ai` release train recorded
15
+ * in pnpm-workspace.yaml's minimumReleaseAgeExclude list; bump both together.
16
+ */
17
+ export declare const MCP_PROXY_VERSION = "0.31.16";
18
+ export declare const MCP_PROXY_PACKAGE = "@agimon-ai/mcp-proxy@0.31.16";
19
+ export declare const ANTIGRAVITY_MCP_PROXY_PACKAGE = "@agimon-ai/mcp-proxy@0.31.16";
20
+ export declare const AGIFLOW_PROXY_SERVER_NAME = "agiflow-proxy";
21
+ export declare const MCP_CONFIG_OPTION = "--config";
22
+ export declare const MCP_PRESTART_OPTION = "--prestart-http";
23
+ export declare const ADD_DIRECTORY_OPTION = "--add-dir";
24
+ export declare const SKIP_PERMISSIONS_OPTION = "--dangerously-skip-permissions";
25
+ export declare const NPX_COMMAND = "npx";
26
+ export declare const PLUGINS_DIRECTORY = "plugins";
27
+ export declare const SKILLS_DIRECTORY = "skills";
28
+ export declare const MCP_SERVERS_KEY = "mcpServers";
29
+ export declare const CORE_PLUGIN_NAME = "core";
30
+ export declare const PLUGIN_MANIFEST_FILENAME = "plugin.json";
31
+ /**
32
+ * Command line for the MCP proxy.
33
+ *
34
+ * `inlineProxyMode` picks `--proxy-mode=flat` over `--proxy-mode flat`, which
35
+ * Codex needs because it receives the whole argument vector as one `-c` value.
36
+ */
37
+ export declare function mcpProxyArguments(packageName: string, configPath: string, assumeYes: boolean, inlineProxyMode?: boolean): string[];
38
+ export declare function additionalDirectoryArgs(context: CompatibilityContext): string[];
39
+ //#endregion
40
+ //# sourceMappingURL=shared.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.mts","names":[],"sources":["../../../../../../src/cli/commands/compat/providers/shared.ts"],"mappings":";;;;;;;;;;;;;;;;qBAiBa;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;;;;;;;wBAgBG,kBACd,qBACA,oBACA,oBACA;wBAcc,wBAAwB,SAAS"}
@@ -0,0 +1,61 @@
1
+ //#region src/cli/commands/compat/providers/shared.ts
2
+ /**
3
+ * Values and argument builders shared by more than one provider.
4
+ *
5
+ * Kept separate from index.ts so the provider modules can import them without
6
+ * depending on the dispatch that imports the provider modules.
7
+ */
8
+ /**
9
+ * Pinned, not `@latest`.
10
+ *
11
+ * These launches run `npx -y`, so a floating tag installs and executes whatever
12
+ * was published most recently on the user's machine, with no lockfile in the
13
+ * way. The version tracks the coordinated `@agimon-ai` release train recorded
14
+ * in pnpm-workspace.yaml's minimumReleaseAgeExclude list; bump both together.
15
+ */
16
+ const MCP_PROXY_VERSION = "0.31.16";
17
+ const MCP_PROXY_PACKAGE = `@agimon-ai/mcp-proxy@${MCP_PROXY_VERSION}`;
18
+ const ANTIGRAVITY_MCP_PROXY_PACKAGE = `@agimon-ai/mcp-proxy@${MCP_PROXY_VERSION}`;
19
+ const AGIFLOW_PROXY_SERVER_NAME = "agiflow-proxy";
20
+ const MCP_CONFIG_OPTION = "--config";
21
+ const MCP_PRESTART_OPTION = "--prestart-http";
22
+ const ADD_DIRECTORY_OPTION = "--add-dir";
23
+ const SKIP_PERMISSIONS_OPTION = "--dangerously-skip-permissions";
24
+ const NPX_COMMAND = "npx";
25
+ const PLUGINS_DIRECTORY = "plugins";
26
+ const SKILLS_DIRECTORY = "skills";
27
+ const MCP_SERVERS_KEY = "mcpServers";
28
+ const CORE_PLUGIN_NAME = "core";
29
+ const PLUGIN_MANIFEST_FILENAME = "plugin.json";
30
+ const MCP_SERVE_COMMAND = "mcp-serve";
31
+ const MCP_TYPE_OPTION = "--type";
32
+ const MCP_STDIO_HTTP_TYPE = "stdio-http";
33
+ const MCP_PROXY_MODE_OPTION = "--proxy-mode";
34
+ const MCP_PROXY_MODE = "flat";
35
+ const MCP_PROXY_MODE_ASSIGNMENT = `${MCP_PROXY_MODE_OPTION}=${MCP_PROXY_MODE}`;
36
+ const NPX_ASSUME_YES_OPTION = "-y";
37
+ /**
38
+ * Command line for the MCP proxy.
39
+ *
40
+ * `inlineProxyMode` picks `--proxy-mode=flat` over `--proxy-mode flat`, which
41
+ * Codex needs because it receives the whole argument vector as one `-c` value.
42
+ */
43
+ function mcpProxyArguments(packageName, configPath, assumeYes, inlineProxyMode = false) {
44
+ return [
45
+ ...assumeYes ? [NPX_ASSUME_YES_OPTION] : [],
46
+ packageName,
47
+ MCP_SERVE_COMMAND,
48
+ MCP_TYPE_OPTION,
49
+ MCP_STDIO_HTTP_TYPE,
50
+ ...inlineProxyMode ? [MCP_PROXY_MODE_ASSIGNMENT] : [MCP_PROXY_MODE_OPTION, MCP_PROXY_MODE],
51
+ MCP_CONFIG_OPTION,
52
+ configPath
53
+ ];
54
+ }
55
+ function additionalDirectoryArgs(context) {
56
+ return context.options.additionalDirectories.flatMap((directory) => [ADD_DIRECTORY_OPTION, directory]);
57
+ }
58
+ //#endregion
59
+ export { ADD_DIRECTORY_OPTION, AGIFLOW_PROXY_SERVER_NAME, ANTIGRAVITY_MCP_PROXY_PACKAGE, CORE_PLUGIN_NAME, MCP_CONFIG_OPTION, MCP_PRESTART_OPTION, MCP_PROXY_PACKAGE, MCP_PROXY_VERSION, MCP_SERVERS_KEY, NPX_COMMAND, PLUGINS_DIRECTORY, PLUGIN_MANIFEST_FILENAME, SKILLS_DIRECTORY, SKIP_PERMISSIONS_OPTION, additionalDirectoryArgs, mcpProxyArguments };
60
+
61
+ //# sourceMappingURL=shared.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.mjs","names":[],"sources":["../../../../../../src/cli/commands/compat/providers/shared.ts"],"sourcesContent":["import type { CompatibilityContext } from '../context';\n\n/**\n * Values and argument builders shared by more than one provider.\n *\n * Kept separate from index.ts so the provider modules can import them without\n * depending on the dispatch that imports the provider modules.\n */\n\n/**\n * Pinned, not `@latest`.\n *\n * These launches run `npx -y`, so a floating tag installs and executes whatever\n * was published most recently on the user's machine, with no lockfile in the\n * way. The version tracks the coordinated `@agimon-ai` release train recorded\n * in pnpm-workspace.yaml's minimumReleaseAgeExclude list; bump both together.\n */\nexport const MCP_PROXY_VERSION = '0.31.16';\nexport const MCP_PROXY_PACKAGE = `@agimon-ai/mcp-proxy@${MCP_PROXY_VERSION}`;\nexport const ANTIGRAVITY_MCP_PROXY_PACKAGE = `@agimon-ai/mcp-proxy@${MCP_PROXY_VERSION}`;\nexport const AGIFLOW_PROXY_SERVER_NAME = 'agiflow-proxy';\nexport const MCP_CONFIG_OPTION = '--config';\nexport const MCP_PRESTART_OPTION = '--prestart-http';\nexport const ADD_DIRECTORY_OPTION = '--add-dir';\nexport const SKIP_PERMISSIONS_OPTION = '--dangerously-skip-permissions';\nexport const NPX_COMMAND = 'npx';\nexport const PLUGINS_DIRECTORY = 'plugins';\nexport const SKILLS_DIRECTORY = 'skills';\nexport const MCP_SERVERS_KEY = 'mcpServers';\nexport const CORE_PLUGIN_NAME = 'core';\nexport const PLUGIN_MANIFEST_FILENAME = 'plugin.json';\n\nconst MCP_SERVE_COMMAND = 'mcp-serve';\nconst MCP_TYPE_OPTION = '--type';\nconst MCP_STDIO_HTTP_TYPE = 'stdio-http';\nconst MCP_PROXY_MODE_OPTION = '--proxy-mode';\nconst MCP_PROXY_MODE = 'flat';\nconst MCP_PROXY_MODE_ASSIGNMENT = `${MCP_PROXY_MODE_OPTION}=${MCP_PROXY_MODE}`;\nconst NPX_ASSUME_YES_OPTION = '-y';\n\n/**\n * Command line for the MCP proxy.\n *\n * `inlineProxyMode` picks `--proxy-mode=flat` over `--proxy-mode flat`, which\n * Codex needs because it receives the whole argument vector as one `-c` value.\n */\nexport function mcpProxyArguments(\n packageName: string,\n configPath: string,\n assumeYes: boolean,\n inlineProxyMode = false,\n): string[] {\n return [\n ...(assumeYes ? [NPX_ASSUME_YES_OPTION] : []),\n packageName,\n MCP_SERVE_COMMAND,\n MCP_TYPE_OPTION,\n MCP_STDIO_HTTP_TYPE,\n ...(inlineProxyMode ? [MCP_PROXY_MODE_ASSIGNMENT] : [MCP_PROXY_MODE_OPTION, MCP_PROXY_MODE]),\n MCP_CONFIG_OPTION,\n configPath,\n ];\n}\n\nexport function additionalDirectoryArgs(context: CompatibilityContext): string[] {\n return context.options.additionalDirectories.flatMap((directory) => [ADD_DIRECTORY_OPTION, directory]);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAa,oBAAoB;AACjC,MAAa,oBAAoB,wBAAwB;AACzD,MAAa,gCAAgC,wBAAwB;AACrE,MAAa,4BAA4B;AACzC,MAAa,oBAAoB;AACjC,MAAa,sBAAsB;AACnC,MAAa,uBAAuB;AACpC,MAAa,0BAA0B;AACvC,MAAa,cAAc;AAC3B,MAAa,oBAAoB;AACjC,MAAa,mBAAmB;AAChC,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;AAChC,MAAa,2BAA2B;AAExC,MAAM,oBAAoB;AAC1B,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAC9B,MAAM,iBAAiB;AACvB,MAAM,4BAA4B,GAAG,sBAAsB,GAAG;AAC9D,MAAM,wBAAwB;;;;;;;AAQ9B,SAAgB,kBACd,aACA,YACA,WACA,kBAAkB,OACR;CACV,OAAO;EACL,GAAI,YAAY,CAAC,qBAAqB,IAAI,CAAC;EAC3C;EACA;EACA;EACA;EACA,GAAI,kBAAkB,CAAC,yBAAyB,IAAI,CAAC,uBAAuB,cAAc;EAC1F;EACA;CACF;AACF;AAEA,SAAgB,wBAAwB,SAAyC;CAC/E,OAAO,QAAQ,QAAQ,sBAAsB,SAAS,cAAc,CAAC,sBAAsB,SAAS,CAAC;AACvG"}
@@ -0,0 +1,31 @@
1
+ //#region src/cli/commands/compat/types.d.ts
2
+ export type CompatibilityProvider = 'antigravity' | 'claude' | 'codex';
3
+ export interface CompatibilityOptions {
4
+ repoRoot: string;
5
+ currentDirectory: string;
6
+ provider: CompatibilityProvider;
7
+ /** One persona and its environment defaults from `.po/profiles.yaml`. */
8
+ profile?: string;
9
+ /** Domain names that select provider plugins and MCP scope. */
10
+ domains: string[];
11
+ /** One named major mode from `.po/modes.yaml`. */
12
+ majorMode: string;
13
+ /** Arguments passed to the provider without Pi-specific translation. */
14
+ providerArgs: string[];
15
+ /** Directories inherited from the launcher environment. */
16
+ additionalDirectories: string[];
17
+ /**
18
+ * Whether to disable the provider's own approval prompts for this run.
19
+ *
20
+ * Off unless the caller passes `--skip-permissions`. Po scopes which
21
+ * tools and servers load; it does not decide on the user's behalf that the
22
+ * frontend's confirmation gate is unnecessary, so the bypass stays an
23
+ * explicit per-run choice and announces itself on stderr.
24
+ */
25
+ skipPermissions: boolean;
26
+ }
27
+ export interface ParsedCompatibilityArgs {
28
+ options: Omit<CompatibilityOptions, 'repoRoot' | 'provider'>;
29
+ }
30
+ //#endregion
31
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../src/cli/commands/compat/types.ts"],"mappings":";YAAY;iBAEK;EACf;EACA;EACA,UAAU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;EASA;;iBAGe;EACf,SAAS,KAAK"}