@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,178 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ let node_path = require("node:path");
3
+ node_path = require_runtime.__toESM(node_path, 1);
4
+ //#region src/cli/matrixOptions.ts
5
+ /**
6
+ * Matrix selection shared by the Pi and compatibility parsers.
7
+ *
8
+ * Both frontends pick the same three axes (profile, domains, major mode) out of
9
+ * the same environment variables with the same defaults. They used to hold two
10
+ * copies of that logic, and the copies drifted: the inline `--name=value` forms
11
+ * and the strict value reader existed in the compatibility parser only, so
12
+ * `./pi.sh --profile=x` silently forwarded an unknown flag to Pi. One copy here
13
+ * is what keeps them honest.
14
+ */
15
+ /**
16
+ * One variable per axis.
17
+ *
18
+ * These used to come in pairs, `DOOM_PI_*` for what the caller selected and
19
+ * `PO_*` for what the harness resolved and published, with the second
20
+ * outranking the first. A nested run still inherits its launcher's choice under
21
+ * one name, because the launcher projects into the child environment and
22
+ * overwrites the same key. Two names for one value only ever meant two ways to
23
+ * disagree.
24
+ */
25
+ const PO_PROFILE_ENV = "PO_PROFILE";
26
+ const PO_DOMAINS_ENV = "PO_DOMAINS";
27
+ const PO_MAJOR_MODE_ENV = "PO_MAJOR_MODE";
28
+ const PO_ADDITIONAL_DIRECTORIES_ENV = "PO_ADDITIONAL_DIRS";
29
+ const PO_PRESET_ENV = "PO_PRESET";
30
+ /** Removed spelling of the major mode axis, reported rather than honored. */
31
+ const REMOVED_PO_LAYER_ENV = "PO_LAYER";
32
+ /**
33
+ * The whole retired namespace, reported rather than ignored.
34
+ *
35
+ * A prefix scan rather than a constant per variable: there were 28 of them, and
36
+ * a list maintained by hand is a list that misses one. A stale
37
+ * `export AGENT_HARNESS_MAJOR_MODE=dev` in a shell profile would otherwise
38
+ * silently start the session on `copilot`.
39
+ */
40
+ const RETIRED_ENV_PREFIX = "AGENT_HARNESS_";
41
+ const CURRENT_ENV_PREFIX = "PO_";
42
+ const PROFILE_OPTION = "--profile";
43
+ const DOMAIN_OPTION = "--domain";
44
+ const DOMAINS_OPTION = "--domains";
45
+ /**
46
+ * The major mode flag.
47
+ *
48
+ * Not `--mode`: Pi owns that one for its output mode, and for a value outside
49
+ * `text|json|rpc` it consumes both tokens and ignores them without a
50
+ * diagnostic. A synced `pi --mode dev` would have failed silently.
51
+ */
52
+ const MAJOR_MODE_OPTION = "--major-mode";
53
+ const ADD_DIRECTORY_OPTION = "--add-dir";
54
+ const REMOVED_LAYER_OPTION = "--layer";
55
+ const REMOVED_LAYERS_OPTION = "--layers";
56
+ const REMOVED_TARGET_OPTION = "--target";
57
+ const DEFAULT_MAJOR_MODE = "copilot";
58
+ const DEFAULT_DOMAIN = "default";
59
+ const CSV_DELIMITER = ",";
60
+ const OPTION_PREFIX = "--";
61
+ /**
62
+ * Reads `--name value` or `--name=value`, returning undefined for anything else.
63
+ *
64
+ * A value starting with `--` is rejected rather than consumed, so
65
+ * `--profile --explain` reports a missing value instead of swallowing the next
66
+ * flag. In compatibility mode this is also what stops the `--` provider
67
+ * delimiter being taken as a matrix value.
68
+ */
69
+ function readOption(args, index, name) {
70
+ const arg = args[index];
71
+ if (arg === name) {
72
+ const value = args[index + 1];
73
+ if (!value || value.startsWith(OPTION_PREFIX)) throw new Error(`${name} requires a value`);
74
+ return {
75
+ value,
76
+ nextIndex: index + 1,
77
+ inline: false
78
+ };
79
+ }
80
+ const inlinePrefix = `${name}=`;
81
+ if (!arg.startsWith(inlinePrefix)) return void 0;
82
+ const value = arg.slice(inlinePrefix.length);
83
+ if (!value) throw new Error(`${name} requires a value`);
84
+ return {
85
+ value,
86
+ nextIndex: index,
87
+ inline: true
88
+ };
89
+ }
90
+ /** Matches `--name` or `--name=value`, for reporting options that were removed. */
91
+ function matchesOption(arg, name) {
92
+ return arg === name || arg.startsWith(`${name}=`);
93
+ }
94
+ function parseCsv(value) {
95
+ return value.split(CSV_DELIMITER).map((item) => item.trim()).filter(Boolean);
96
+ }
97
+ function parseRequiredCsv(value, option) {
98
+ const values = parseCsv(value);
99
+ if (values.length === 0) throw new Error(`${option} requires a value`);
100
+ return values;
101
+ }
102
+ function parseMajorMode(value, source) {
103
+ const majorMode = value.trim();
104
+ if (!majorMode) throw new Error(`${source} requires a value`);
105
+ if (majorMode.includes(CSV_DELIMITER)) throw new Error(`${source} accepts one major mode name`);
106
+ return majorMode;
107
+ }
108
+ function parseProfileValue(value, source) {
109
+ if (value.includes(CSV_DELIMITER)) throw new Error(`${source} accepts one profile name`);
110
+ if (!value.trim()) throw new Error(`${source} requires a value`);
111
+ return value;
112
+ }
113
+ /**
114
+ * Reports any variable left over from the retired `AGENT_HARNESS_*` namespace.
115
+ *
116
+ * Called before anything reads the environment, so a stale export fails the
117
+ * session instead of being quietly outvoted by a default. Both prefixes are
118
+ * built from the constants above rather than written inline, because a
119
+ * search-and-replace over this repository is exactly what retired the old one.
120
+ */
121
+ function assertNoRetiredEnvironment(environment) {
122
+ const stale = Object.keys(environment).filter((key) => key.startsWith(RETIRED_ENV_PREFIX)).sort();
123
+ if (stale.length === 0) return;
124
+ const replacements = stale.map((key) => `${key} -> ${CURRENT_ENV_PREFIX}${key.slice(14)}`);
125
+ throw new Error(`The ${RETIRED_ENV_PREFIX}* environment was replaced by ${CURRENT_ENV_PREFIX}*. Unset or rename: ${replacements.join(", ")}`);
126
+ }
127
+ /**
128
+ * The major mode a nested run inherits from its launcher, or the default.
129
+ *
130
+ * The removed spelling throws rather than being ignored. A stale
131
+ * `export PO_LAYER=dev` left in a shell profile would otherwise silently
132
+ * select `copilot`, which is the exact confusion the rename removed.
133
+ */
134
+ function resolveInheritedMajorMode(environment, defaultMajorMode = DEFAULT_MAJOR_MODE) {
135
+ assertNoRetiredEnvironment(environment);
136
+ if (environment["PO_LAYER"]) throw new Error(`${REMOVED_PO_LAYER_ENV} was replaced by ${PO_MAJOR_MODE_ENV}`);
137
+ const inherited = environment[PO_MAJOR_MODE_ENV];
138
+ return parseMajorMode(inherited || defaultMajorMode, inherited ? PO_MAJOR_MODE_ENV : "defaultMajorMode");
139
+ }
140
+ /** The profile a run inherits from its environment, validated once up front. */
141
+ function resolveInheritedProfile(environment) {
142
+ const inherited = environment["PO_PROFILE"] || void 0;
143
+ if (inherited?.includes(CSV_DELIMITER)) throw new Error(`${PO_PROFILE_ENV} accepts one profile name`);
144
+ return inherited;
145
+ }
146
+ /** Directories inherited from the launcher environment. */
147
+ function resolveAdditionalDirectories(environment, baseDirectory) {
148
+ return (environment["PO_ADDITIONAL_DIRS"] ?? "").split(node_path.default.delimiter).filter(Boolean).map((directory) => node_path.default.resolve(baseDirectory, directory));
149
+ }
150
+ //#endregion
151
+ exports.ADD_DIRECTORY_OPTION = ADD_DIRECTORY_OPTION;
152
+ exports.DEFAULT_DOMAIN = DEFAULT_DOMAIN;
153
+ exports.DEFAULT_MAJOR_MODE = DEFAULT_MAJOR_MODE;
154
+ exports.DOMAINS_OPTION = DOMAINS_OPTION;
155
+ exports.DOMAIN_OPTION = DOMAIN_OPTION;
156
+ exports.MAJOR_MODE_OPTION = MAJOR_MODE_OPTION;
157
+ exports.PO_ADDITIONAL_DIRECTORIES_ENV = PO_ADDITIONAL_DIRECTORIES_ENV;
158
+ exports.PO_DOMAINS_ENV = PO_DOMAINS_ENV;
159
+ exports.PO_MAJOR_MODE_ENV = PO_MAJOR_MODE_ENV;
160
+ exports.PO_PRESET_ENV = PO_PRESET_ENV;
161
+ exports.PO_PROFILE_ENV = PO_PROFILE_ENV;
162
+ exports.PROFILE_OPTION = PROFILE_OPTION;
163
+ exports.REMOVED_LAYERS_OPTION = REMOVED_LAYERS_OPTION;
164
+ exports.REMOVED_LAYER_OPTION = REMOVED_LAYER_OPTION;
165
+ exports.REMOVED_PO_LAYER_ENV = REMOVED_PO_LAYER_ENV;
166
+ exports.REMOVED_TARGET_OPTION = REMOVED_TARGET_OPTION;
167
+ exports.assertNoRetiredEnvironment = assertNoRetiredEnvironment;
168
+ exports.matchesOption = matchesOption;
169
+ exports.parseCsv = parseCsv;
170
+ exports.parseMajorMode = parseMajorMode;
171
+ exports.parseProfileValue = parseProfileValue;
172
+ exports.parseRequiredCsv = parseRequiredCsv;
173
+ exports.readOption = readOption;
174
+ exports.resolveAdditionalDirectories = resolveAdditionalDirectories;
175
+ exports.resolveInheritedMajorMode = resolveInheritedMajorMode;
176
+ exports.resolveInheritedProfile = resolveInheritedProfile;
177
+
178
+ //# sourceMappingURL=matrixOptions.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrixOptions.cjs","names":["path"],"sources":["../../../src/cli/matrixOptions.ts"],"sourcesContent":["import path from 'node:path';\n\n/**\n * Matrix selection shared by the Pi and compatibility parsers.\n *\n * Both frontends pick the same three axes (profile, domains, major mode) out of\n * the same environment variables with the same defaults. They used to hold two\n * copies of that logic, and the copies drifted: the inline `--name=value` forms\n * and the strict value reader existed in the compatibility parser only, so\n * `./pi.sh --profile=x` silently forwarded an unknown flag to Pi. One copy here\n * is what keeps them honest.\n */\n\n/**\n * One variable per axis.\n *\n * These used to come in pairs, `DOOM_PI_*` for what the caller selected and\n * `PO_*` for what the harness resolved and published, with the second\n * outranking the first. A nested run still inherits its launcher's choice under\n * one name, because the launcher projects into the child environment and\n * overwrites the same key. Two names for one value only ever meant two ways to\n * disagree.\n */\nexport const PO_PROFILE_ENV = 'PO_PROFILE';\nexport const PO_DOMAINS_ENV = 'PO_DOMAINS';\nexport const PO_MAJOR_MODE_ENV = 'PO_MAJOR_MODE';\nexport const PO_ADDITIONAL_DIRECTORIES_ENV = 'PO_ADDITIONAL_DIRS';\nexport const PO_PRESET_ENV = 'PO_PRESET';\n\n/** Removed spelling of the major mode axis, reported rather than honored. */\nexport const REMOVED_PO_LAYER_ENV = 'PO_LAYER';\n\n/**\n * The whole retired namespace, reported rather than ignored.\n *\n * A prefix scan rather than a constant per variable: there were 28 of them, and\n * a list maintained by hand is a list that misses one. A stale\n * `export AGENT_HARNESS_MAJOR_MODE=dev` in a shell profile would otherwise\n * silently start the session on `copilot`.\n */\nconst RETIRED_ENV_PREFIX = 'AGENT_HARNESS_';\nconst CURRENT_ENV_PREFIX = 'PO_';\n\nexport const PROFILE_OPTION = '--profile';\nexport const DOMAIN_OPTION = '--domain';\nexport const DOMAINS_OPTION = '--domains';\n/**\n * The major mode flag.\n *\n * Not `--mode`: Pi owns that one for its output mode, and for a value outside\n * `text|json|rpc` it consumes both tokens and ignores them without a\n * diagnostic. A synced `pi --mode dev` would have failed silently.\n */\nexport const MAJOR_MODE_OPTION = '--major-mode';\nexport const ADD_DIRECTORY_OPTION = '--add-dir';\nexport const REMOVED_LAYER_OPTION = '--layer';\nexport const REMOVED_LAYERS_OPTION = '--layers';\nexport const REMOVED_TARGET_OPTION = '--target';\n\nexport const DEFAULT_MAJOR_MODE = 'copilot';\nexport const DEFAULT_DOMAIN = 'default';\n\nconst CSV_DELIMITER = ',';\nconst OPTION_PREFIX = '--';\n\nexport interface OptionMatch {\n value: string;\n /** Index of the last argument consumed, for the caller's loop cursor. */\n nextIndex: number;\n /** True for `--name=value`. Callers that re-emit an option preserve the form. */\n inline: boolean;\n}\n\n/**\n * Reads `--name value` or `--name=value`, returning undefined for anything else.\n *\n * A value starting with `--` is rejected rather than consumed, so\n * `--profile --explain` reports a missing value instead of swallowing the next\n * flag. In compatibility mode this is also what stops the `--` provider\n * delimiter being taken as a matrix value.\n */\nexport function readOption(args: string[], index: number, name: string): OptionMatch | undefined {\n // Callers walk `args` by index, so this is always in range.\n const arg = args[index]!;\n if (arg === name) {\n const value = args[index + 1];\n if (!value || value.startsWith(OPTION_PREFIX)) throw new Error(`${name} requires a value`);\n return { value, nextIndex: index + 1, inline: false };\n }\n const inlinePrefix = `${name}=`;\n if (!arg.startsWith(inlinePrefix)) return undefined;\n const value = arg.slice(inlinePrefix.length);\n if (!value) throw new Error(`${name} requires a value`);\n return { value, nextIndex: index, inline: true };\n}\n\n/** Matches `--name` or `--name=value`, for reporting options that were removed. */\nexport function matchesOption(arg: string, name: string): boolean {\n return arg === name || arg.startsWith(`${name}=`);\n}\n\nexport function parseCsv(value: string): string[] {\n return value\n .split(CSV_DELIMITER)\n .map((item) => item.trim())\n .filter(Boolean);\n}\n\nexport function parseRequiredCsv(value: string, option: string): string[] {\n const values = parseCsv(value);\n if (values.length === 0) throw new Error(`${option} requires a value`);\n return values;\n}\n\nexport function parseMajorMode(value: string, source: string): string {\n const majorMode = value.trim();\n if (!majorMode) throw new Error(`${source} requires a value`);\n if (majorMode.includes(CSV_DELIMITER)) throw new Error(`${source} accepts one major mode name`);\n return majorMode;\n}\n\nexport function parseProfileValue(value: string, source: string): string {\n if (value.includes(CSV_DELIMITER)) throw new Error(`${source} accepts one profile name`);\n if (!value.trim()) throw new Error(`${source} requires a value`);\n return value;\n}\n\n/**\n * Reports any variable left over from the retired `AGENT_HARNESS_*` namespace.\n *\n * Called before anything reads the environment, so a stale export fails the\n * session instead of being quietly outvoted by a default. Both prefixes are\n * built from the constants above rather than written inline, because a\n * search-and-replace over this repository is exactly what retired the old one.\n */\nexport function assertNoRetiredEnvironment(environment: NodeJS.ProcessEnv): void {\n const stale = Object.keys(environment)\n .filter((key) => key.startsWith(RETIRED_ENV_PREFIX))\n .sort();\n if (stale.length === 0) return;\n const replacements = stale.map((key) => `${key} -> ${CURRENT_ENV_PREFIX}${key.slice(RETIRED_ENV_PREFIX.length)}`);\n throw new Error(\n `The ${RETIRED_ENV_PREFIX}* environment was replaced by ${CURRENT_ENV_PREFIX}*. Unset or rename: ${replacements.join(', ')}`,\n );\n}\n\n/**\n * The major mode a nested run inherits from its launcher, or the default.\n *\n * The removed spelling throws rather than being ignored. A stale\n * `export PO_LAYER=dev` left in a shell profile would otherwise silently\n * select `copilot`, which is the exact confusion the rename removed.\n */\nexport function resolveInheritedMajorMode(\n environment: NodeJS.ProcessEnv,\n defaultMajorMode: string = DEFAULT_MAJOR_MODE,\n): string {\n assertNoRetiredEnvironment(environment);\n if (environment[REMOVED_PO_LAYER_ENV]) {\n throw new Error(`${REMOVED_PO_LAYER_ENV} was replaced by ${PO_MAJOR_MODE_ENV}`);\n }\n const inherited = environment[PO_MAJOR_MODE_ENV];\n return parseMajorMode(inherited || defaultMajorMode, inherited ? PO_MAJOR_MODE_ENV : 'defaultMajorMode');\n}\n\n/** The profile a run inherits from its environment, validated once up front. */\nexport function resolveInheritedProfile(environment: NodeJS.ProcessEnv): string | undefined {\n const inherited = environment[PO_PROFILE_ENV] || undefined;\n if (inherited?.includes(CSV_DELIMITER)) throw new Error(`${PO_PROFILE_ENV} accepts one profile name`);\n return inherited;\n}\n\n/** Directories inherited from the launcher environment. */\nexport function resolveAdditionalDirectories(environment: NodeJS.ProcessEnv, baseDirectory: string): string[] {\n return (environment[PO_ADDITIONAL_DIRECTORIES_ENV] ?? '')\n .split(path.delimiter)\n .filter(Boolean)\n .map((directory) => path.resolve(baseDirectory, directory));\n}\n"],"mappings":"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"}
@@ -0,0 +1,90 @@
1
+ //#region src/cli/matrixOptions.d.ts
2
+ /**
3
+ * Matrix selection shared by the Pi and compatibility parsers.
4
+ *
5
+ * Both frontends pick the same three axes (profile, domains, major mode) out of
6
+ * the same environment variables with the same defaults. They used to hold two
7
+ * copies of that logic, and the copies drifted: the inline `--name=value` forms
8
+ * and the strict value reader existed in the compatibility parser only, so
9
+ * `./pi.sh --profile=x` silently forwarded an unknown flag to Pi. One copy here
10
+ * is what keeps them honest.
11
+ */
12
+ /**
13
+ * One variable per axis.
14
+ *
15
+ * These used to come in pairs, `DOOM_PI_*` for what the caller selected and
16
+ * `PO_*` for what the harness resolved and published, with the second
17
+ * outranking the first. A nested run still inherits its launcher's choice under
18
+ * one name, because the launcher projects into the child environment and
19
+ * overwrites the same key. Two names for one value only ever meant two ways to
20
+ * disagree.
21
+ */
22
+ export declare const PO_PROFILE_ENV = "PO_PROFILE";
23
+ export declare const PO_DOMAINS_ENV = "PO_DOMAINS";
24
+ export declare const PO_MAJOR_MODE_ENV = "PO_MAJOR_MODE";
25
+ export declare const PO_ADDITIONAL_DIRECTORIES_ENV = "PO_ADDITIONAL_DIRS";
26
+ export declare const PO_PRESET_ENV = "PO_PRESET";
27
+ /** Removed spelling of the major mode axis, reported rather than honored. */
28
+ export declare const REMOVED_PO_LAYER_ENV = "PO_LAYER";
29
+ export declare const PROFILE_OPTION = "--profile";
30
+ export declare const DOMAIN_OPTION = "--domain";
31
+ export declare const DOMAINS_OPTION = "--domains";
32
+ /**
33
+ * The major mode flag.
34
+ *
35
+ * Not `--mode`: Pi owns that one for its output mode, and for a value outside
36
+ * `text|json|rpc` it consumes both tokens and ignores them without a
37
+ * diagnostic. A synced `pi --mode dev` would have failed silently.
38
+ */
39
+ export declare const MAJOR_MODE_OPTION = "--major-mode";
40
+ export declare const ADD_DIRECTORY_OPTION = "--add-dir";
41
+ export declare const REMOVED_LAYER_OPTION = "--layer";
42
+ export declare const REMOVED_LAYERS_OPTION = "--layers";
43
+ export declare const REMOVED_TARGET_OPTION = "--target";
44
+ export declare const DEFAULT_MAJOR_MODE = "copilot";
45
+ export declare const DEFAULT_DOMAIN = "default";
46
+ export interface OptionMatch {
47
+ value: string;
48
+ /** Index of the last argument consumed, for the caller's loop cursor. */
49
+ nextIndex: number;
50
+ /** True for `--name=value`. Callers that re-emit an option preserve the form. */
51
+ inline: boolean;
52
+ }
53
+ /**
54
+ * Reads `--name value` or `--name=value`, returning undefined for anything else.
55
+ *
56
+ * A value starting with `--` is rejected rather than consumed, so
57
+ * `--profile --explain` reports a missing value instead of swallowing the next
58
+ * flag. In compatibility mode this is also what stops the `--` provider
59
+ * delimiter being taken as a matrix value.
60
+ */
61
+ export declare function readOption(args: string[], index: number, name: string): OptionMatch | undefined;
62
+ /** Matches `--name` or `--name=value`, for reporting options that were removed. */
63
+ export declare function matchesOption(arg: string, name: string): boolean;
64
+ export declare function parseCsv(value: string): string[];
65
+ export declare function parseRequiredCsv(value: string, option: string): string[];
66
+ export declare function parseMajorMode(value: string, source: string): string;
67
+ export declare function parseProfileValue(value: string, source: string): string;
68
+ /**
69
+ * Reports any variable left over from the retired `AGENT_HARNESS_*` namespace.
70
+ *
71
+ * Called before anything reads the environment, so a stale export fails the
72
+ * session instead of being quietly outvoted by a default. Both prefixes are
73
+ * built from the constants above rather than written inline, because a
74
+ * search-and-replace over this repository is exactly what retired the old one.
75
+ */
76
+ export declare function assertNoRetiredEnvironment(environment: NodeJS.ProcessEnv): void;
77
+ /**
78
+ * The major mode a nested run inherits from its launcher, or the default.
79
+ *
80
+ * The removed spelling throws rather than being ignored. A stale
81
+ * `export PO_LAYER=dev` left in a shell profile would otherwise silently
82
+ * select `copilot`, which is the exact confusion the rename removed.
83
+ */
84
+ export declare function resolveInheritedMajorMode(environment: NodeJS.ProcessEnv, defaultMajorMode?: string): string;
85
+ /** The profile a run inherits from its environment, validated once up front. */
86
+ export declare function resolveInheritedProfile(environment: NodeJS.ProcessEnv): string | undefined;
87
+ /** Directories inherited from the launcher environment. */
88
+ export declare function resolveAdditionalDirectories(environment: NodeJS.ProcessEnv, baseDirectory: string): string[];
89
+ //#endregion
90
+ //# sourceMappingURL=matrixOptions.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrixOptions.d.mts","names":[],"sources":["../../../src/cli/matrixOptions.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;qBAuBa;qBACA;qBACA;qBACA;qBACA;;qBAGA;qBAaA;qBACA;qBACA;;;;;;;;qBAQA;qBACA;qBACA;qBACA;qBACA;qBAEA;qBACA;iBAKI;EACf;;EAEA;;EAEA;;;;;;;;;;wBAWc,WAAW,gBAAgB,eAAe,eAAe;;wBAgBzD,cAAc,aAAa;wBAI3B,SAAS;wBAOT,iBAAiB,eAAe;wBAMhC,eAAe,eAAe;wBAO9B,kBAAkB,eAAe;;;;;;;;;wBAcjC,2BAA2B,aAAa,OAAO;;;;;;;;wBAkB/C,0BACd,aAAa,OAAO,YACpB;;wBAWc,wBAAwB,aAAa,OAAO;;wBAO5C,6BAA6B,aAAa,OAAO,YAAY"}
@@ -0,0 +1,151 @@
1
+ import path from "node:path";
2
+ //#region src/cli/matrixOptions.ts
3
+ /**
4
+ * Matrix selection shared by the Pi and compatibility parsers.
5
+ *
6
+ * Both frontends pick the same three axes (profile, domains, major mode) out of
7
+ * the same environment variables with the same defaults. They used to hold two
8
+ * copies of that logic, and the copies drifted: the inline `--name=value` forms
9
+ * and the strict value reader existed in the compatibility parser only, so
10
+ * `./pi.sh --profile=x` silently forwarded an unknown flag to Pi. One copy here
11
+ * is what keeps them honest.
12
+ */
13
+ /**
14
+ * One variable per axis.
15
+ *
16
+ * These used to come in pairs, `DOOM_PI_*` for what the caller selected and
17
+ * `PO_*` for what the harness resolved and published, with the second
18
+ * outranking the first. A nested run still inherits its launcher's choice under
19
+ * one name, because the launcher projects into the child environment and
20
+ * overwrites the same key. Two names for one value only ever meant two ways to
21
+ * disagree.
22
+ */
23
+ const PO_PROFILE_ENV = "PO_PROFILE";
24
+ const PO_DOMAINS_ENV = "PO_DOMAINS";
25
+ const PO_MAJOR_MODE_ENV = "PO_MAJOR_MODE";
26
+ const PO_ADDITIONAL_DIRECTORIES_ENV = "PO_ADDITIONAL_DIRS";
27
+ const PO_PRESET_ENV = "PO_PRESET";
28
+ /** Removed spelling of the major mode axis, reported rather than honored. */
29
+ const REMOVED_PO_LAYER_ENV = "PO_LAYER";
30
+ /**
31
+ * The whole retired namespace, reported rather than ignored.
32
+ *
33
+ * A prefix scan rather than a constant per variable: there were 28 of them, and
34
+ * a list maintained by hand is a list that misses one. A stale
35
+ * `export AGENT_HARNESS_MAJOR_MODE=dev` in a shell profile would otherwise
36
+ * silently start the session on `copilot`.
37
+ */
38
+ const RETIRED_ENV_PREFIX = "AGENT_HARNESS_";
39
+ const CURRENT_ENV_PREFIX = "PO_";
40
+ const PROFILE_OPTION = "--profile";
41
+ const DOMAIN_OPTION = "--domain";
42
+ const DOMAINS_OPTION = "--domains";
43
+ /**
44
+ * The major mode flag.
45
+ *
46
+ * Not `--mode`: Pi owns that one for its output mode, and for a value outside
47
+ * `text|json|rpc` it consumes both tokens and ignores them without a
48
+ * diagnostic. A synced `pi --mode dev` would have failed silently.
49
+ */
50
+ const MAJOR_MODE_OPTION = "--major-mode";
51
+ const ADD_DIRECTORY_OPTION = "--add-dir";
52
+ const REMOVED_LAYER_OPTION = "--layer";
53
+ const REMOVED_LAYERS_OPTION = "--layers";
54
+ const REMOVED_TARGET_OPTION = "--target";
55
+ const DEFAULT_MAJOR_MODE = "copilot";
56
+ const DEFAULT_DOMAIN = "default";
57
+ const CSV_DELIMITER = ",";
58
+ const OPTION_PREFIX = "--";
59
+ /**
60
+ * Reads `--name value` or `--name=value`, returning undefined for anything else.
61
+ *
62
+ * A value starting with `--` is rejected rather than consumed, so
63
+ * `--profile --explain` reports a missing value instead of swallowing the next
64
+ * flag. In compatibility mode this is also what stops the `--` provider
65
+ * delimiter being taken as a matrix value.
66
+ */
67
+ function readOption(args, index, name) {
68
+ const arg = args[index];
69
+ if (arg === name) {
70
+ const value = args[index + 1];
71
+ if (!value || value.startsWith(OPTION_PREFIX)) throw new Error(`${name} requires a value`);
72
+ return {
73
+ value,
74
+ nextIndex: index + 1,
75
+ inline: false
76
+ };
77
+ }
78
+ const inlinePrefix = `${name}=`;
79
+ if (!arg.startsWith(inlinePrefix)) return void 0;
80
+ const value = arg.slice(inlinePrefix.length);
81
+ if (!value) throw new Error(`${name} requires a value`);
82
+ return {
83
+ value,
84
+ nextIndex: index,
85
+ inline: true
86
+ };
87
+ }
88
+ /** Matches `--name` or `--name=value`, for reporting options that were removed. */
89
+ function matchesOption(arg, name) {
90
+ return arg === name || arg.startsWith(`${name}=`);
91
+ }
92
+ function parseCsv(value) {
93
+ return value.split(CSV_DELIMITER).map((item) => item.trim()).filter(Boolean);
94
+ }
95
+ function parseRequiredCsv(value, option) {
96
+ const values = parseCsv(value);
97
+ if (values.length === 0) throw new Error(`${option} requires a value`);
98
+ return values;
99
+ }
100
+ function parseMajorMode(value, source) {
101
+ const majorMode = value.trim();
102
+ if (!majorMode) throw new Error(`${source} requires a value`);
103
+ if (majorMode.includes(CSV_DELIMITER)) throw new Error(`${source} accepts one major mode name`);
104
+ return majorMode;
105
+ }
106
+ function parseProfileValue(value, source) {
107
+ if (value.includes(CSV_DELIMITER)) throw new Error(`${source} accepts one profile name`);
108
+ if (!value.trim()) throw new Error(`${source} requires a value`);
109
+ return value;
110
+ }
111
+ /**
112
+ * Reports any variable left over from the retired `AGENT_HARNESS_*` namespace.
113
+ *
114
+ * Called before anything reads the environment, so a stale export fails the
115
+ * session instead of being quietly outvoted by a default. Both prefixes are
116
+ * built from the constants above rather than written inline, because a
117
+ * search-and-replace over this repository is exactly what retired the old one.
118
+ */
119
+ function assertNoRetiredEnvironment(environment) {
120
+ const stale = Object.keys(environment).filter((key) => key.startsWith(RETIRED_ENV_PREFIX)).sort();
121
+ if (stale.length === 0) return;
122
+ const replacements = stale.map((key) => `${key} -> ${CURRENT_ENV_PREFIX}${key.slice(14)}`);
123
+ throw new Error(`The ${RETIRED_ENV_PREFIX}* environment was replaced by ${CURRENT_ENV_PREFIX}*. Unset or rename: ${replacements.join(", ")}`);
124
+ }
125
+ /**
126
+ * The major mode a nested run inherits from its launcher, or the default.
127
+ *
128
+ * The removed spelling throws rather than being ignored. A stale
129
+ * `export PO_LAYER=dev` left in a shell profile would otherwise silently
130
+ * select `copilot`, which is the exact confusion the rename removed.
131
+ */
132
+ function resolveInheritedMajorMode(environment, defaultMajorMode = DEFAULT_MAJOR_MODE) {
133
+ assertNoRetiredEnvironment(environment);
134
+ if (environment["PO_LAYER"]) throw new Error(`${REMOVED_PO_LAYER_ENV} was replaced by ${PO_MAJOR_MODE_ENV}`);
135
+ const inherited = environment[PO_MAJOR_MODE_ENV];
136
+ return parseMajorMode(inherited || defaultMajorMode, inherited ? PO_MAJOR_MODE_ENV : "defaultMajorMode");
137
+ }
138
+ /** The profile a run inherits from its environment, validated once up front. */
139
+ function resolveInheritedProfile(environment) {
140
+ const inherited = environment["PO_PROFILE"] || void 0;
141
+ if (inherited?.includes(CSV_DELIMITER)) throw new Error(`${PO_PROFILE_ENV} accepts one profile name`);
142
+ return inherited;
143
+ }
144
+ /** Directories inherited from the launcher environment. */
145
+ function resolveAdditionalDirectories(environment, baseDirectory) {
146
+ return (environment["PO_ADDITIONAL_DIRS"] ?? "").split(path.delimiter).filter(Boolean).map((directory) => path.resolve(baseDirectory, directory));
147
+ }
148
+ //#endregion
149
+ export { ADD_DIRECTORY_OPTION, DEFAULT_DOMAIN, DEFAULT_MAJOR_MODE, DOMAINS_OPTION, DOMAIN_OPTION, MAJOR_MODE_OPTION, PO_ADDITIONAL_DIRECTORIES_ENV, PO_DOMAINS_ENV, PO_MAJOR_MODE_ENV, PO_PRESET_ENV, PO_PROFILE_ENV, PROFILE_OPTION, REMOVED_LAYERS_OPTION, REMOVED_LAYER_OPTION, REMOVED_PO_LAYER_ENV, REMOVED_TARGET_OPTION, assertNoRetiredEnvironment, matchesOption, parseCsv, parseMajorMode, parseProfileValue, parseRequiredCsv, readOption, resolveAdditionalDirectories, resolveInheritedMajorMode, resolveInheritedProfile };
150
+
151
+ //# sourceMappingURL=matrixOptions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrixOptions.mjs","names":[],"sources":["../../../src/cli/matrixOptions.ts"],"sourcesContent":["import path from 'node:path';\n\n/**\n * Matrix selection shared by the Pi and compatibility parsers.\n *\n * Both frontends pick the same three axes (profile, domains, major mode) out of\n * the same environment variables with the same defaults. They used to hold two\n * copies of that logic, and the copies drifted: the inline `--name=value` forms\n * and the strict value reader existed in the compatibility parser only, so\n * `./pi.sh --profile=x` silently forwarded an unknown flag to Pi. One copy here\n * is what keeps them honest.\n */\n\n/**\n * One variable per axis.\n *\n * These used to come in pairs, `DOOM_PI_*` for what the caller selected and\n * `PO_*` for what the harness resolved and published, with the second\n * outranking the first. A nested run still inherits its launcher's choice under\n * one name, because the launcher projects into the child environment and\n * overwrites the same key. Two names for one value only ever meant two ways to\n * disagree.\n */\nexport const PO_PROFILE_ENV = 'PO_PROFILE';\nexport const PO_DOMAINS_ENV = 'PO_DOMAINS';\nexport const PO_MAJOR_MODE_ENV = 'PO_MAJOR_MODE';\nexport const PO_ADDITIONAL_DIRECTORIES_ENV = 'PO_ADDITIONAL_DIRS';\nexport const PO_PRESET_ENV = 'PO_PRESET';\n\n/** Removed spelling of the major mode axis, reported rather than honored. */\nexport const REMOVED_PO_LAYER_ENV = 'PO_LAYER';\n\n/**\n * The whole retired namespace, reported rather than ignored.\n *\n * A prefix scan rather than a constant per variable: there were 28 of them, and\n * a list maintained by hand is a list that misses one. A stale\n * `export AGENT_HARNESS_MAJOR_MODE=dev` in a shell profile would otherwise\n * silently start the session on `copilot`.\n */\nconst RETIRED_ENV_PREFIX = 'AGENT_HARNESS_';\nconst CURRENT_ENV_PREFIX = 'PO_';\n\nexport const PROFILE_OPTION = '--profile';\nexport const DOMAIN_OPTION = '--domain';\nexport const DOMAINS_OPTION = '--domains';\n/**\n * The major mode flag.\n *\n * Not `--mode`: Pi owns that one for its output mode, and for a value outside\n * `text|json|rpc` it consumes both tokens and ignores them without a\n * diagnostic. A synced `pi --mode dev` would have failed silently.\n */\nexport const MAJOR_MODE_OPTION = '--major-mode';\nexport const ADD_DIRECTORY_OPTION = '--add-dir';\nexport const REMOVED_LAYER_OPTION = '--layer';\nexport const REMOVED_LAYERS_OPTION = '--layers';\nexport const REMOVED_TARGET_OPTION = '--target';\n\nexport const DEFAULT_MAJOR_MODE = 'copilot';\nexport const DEFAULT_DOMAIN = 'default';\n\nconst CSV_DELIMITER = ',';\nconst OPTION_PREFIX = '--';\n\nexport interface OptionMatch {\n value: string;\n /** Index of the last argument consumed, for the caller's loop cursor. */\n nextIndex: number;\n /** True for `--name=value`. Callers that re-emit an option preserve the form. */\n inline: boolean;\n}\n\n/**\n * Reads `--name value` or `--name=value`, returning undefined for anything else.\n *\n * A value starting with `--` is rejected rather than consumed, so\n * `--profile --explain` reports a missing value instead of swallowing the next\n * flag. In compatibility mode this is also what stops the `--` provider\n * delimiter being taken as a matrix value.\n */\nexport function readOption(args: string[], index: number, name: string): OptionMatch | undefined {\n // Callers walk `args` by index, so this is always in range.\n const arg = args[index]!;\n if (arg === name) {\n const value = args[index + 1];\n if (!value || value.startsWith(OPTION_PREFIX)) throw new Error(`${name} requires a value`);\n return { value, nextIndex: index + 1, inline: false };\n }\n const inlinePrefix = `${name}=`;\n if (!arg.startsWith(inlinePrefix)) return undefined;\n const value = arg.slice(inlinePrefix.length);\n if (!value) throw new Error(`${name} requires a value`);\n return { value, nextIndex: index, inline: true };\n}\n\n/** Matches `--name` or `--name=value`, for reporting options that were removed. */\nexport function matchesOption(arg: string, name: string): boolean {\n return arg === name || arg.startsWith(`${name}=`);\n}\n\nexport function parseCsv(value: string): string[] {\n return value\n .split(CSV_DELIMITER)\n .map((item) => item.trim())\n .filter(Boolean);\n}\n\nexport function parseRequiredCsv(value: string, option: string): string[] {\n const values = parseCsv(value);\n if (values.length === 0) throw new Error(`${option} requires a value`);\n return values;\n}\n\nexport function parseMajorMode(value: string, source: string): string {\n const majorMode = value.trim();\n if (!majorMode) throw new Error(`${source} requires a value`);\n if (majorMode.includes(CSV_DELIMITER)) throw new Error(`${source} accepts one major mode name`);\n return majorMode;\n}\n\nexport function parseProfileValue(value: string, source: string): string {\n if (value.includes(CSV_DELIMITER)) throw new Error(`${source} accepts one profile name`);\n if (!value.trim()) throw new Error(`${source} requires a value`);\n return value;\n}\n\n/**\n * Reports any variable left over from the retired `AGENT_HARNESS_*` namespace.\n *\n * Called before anything reads the environment, so a stale export fails the\n * session instead of being quietly outvoted by a default. Both prefixes are\n * built from the constants above rather than written inline, because a\n * search-and-replace over this repository is exactly what retired the old one.\n */\nexport function assertNoRetiredEnvironment(environment: NodeJS.ProcessEnv): void {\n const stale = Object.keys(environment)\n .filter((key) => key.startsWith(RETIRED_ENV_PREFIX))\n .sort();\n if (stale.length === 0) return;\n const replacements = stale.map((key) => `${key} -> ${CURRENT_ENV_PREFIX}${key.slice(RETIRED_ENV_PREFIX.length)}`);\n throw new Error(\n `The ${RETIRED_ENV_PREFIX}* environment was replaced by ${CURRENT_ENV_PREFIX}*. Unset or rename: ${replacements.join(', ')}`,\n );\n}\n\n/**\n * The major mode a nested run inherits from its launcher, or the default.\n *\n * The removed spelling throws rather than being ignored. A stale\n * `export PO_LAYER=dev` left in a shell profile would otherwise silently\n * select `copilot`, which is the exact confusion the rename removed.\n */\nexport function resolveInheritedMajorMode(\n environment: NodeJS.ProcessEnv,\n defaultMajorMode: string = DEFAULT_MAJOR_MODE,\n): string {\n assertNoRetiredEnvironment(environment);\n if (environment[REMOVED_PO_LAYER_ENV]) {\n throw new Error(`${REMOVED_PO_LAYER_ENV} was replaced by ${PO_MAJOR_MODE_ENV}`);\n }\n const inherited = environment[PO_MAJOR_MODE_ENV];\n return parseMajorMode(inherited || defaultMajorMode, inherited ? PO_MAJOR_MODE_ENV : 'defaultMajorMode');\n}\n\n/** The profile a run inherits from its environment, validated once up front. */\nexport function resolveInheritedProfile(environment: NodeJS.ProcessEnv): string | undefined {\n const inherited = environment[PO_PROFILE_ENV] || undefined;\n if (inherited?.includes(CSV_DELIMITER)) throw new Error(`${PO_PROFILE_ENV} accepts one profile name`);\n return inherited;\n}\n\n/** Directories inherited from the launcher environment. */\nexport function resolveAdditionalDirectories(environment: NodeJS.ProcessEnv, baseDirectory: string): string[] {\n return (environment[PO_ADDITIONAL_DIRECTORIES_ENV] ?? '')\n .split(path.delimiter)\n .filter(Boolean)\n .map((directory) => path.resolve(baseDirectory, directory));\n}\n"],"mappings":"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"}