@a-company/paradigm 5.11.0 → 5.21.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 (408) hide show
  1. package/dist/accept-orchestration-IUAWQZUN.js +18 -0
  2. package/dist/add-P76GEMGF.js +8 -0
  3. package/dist/agent-UUTYOFTH.js +33 -0
  4. package/dist/agent-loader-EPXURMO7.js +2 -0
  5. package/dist/agent-loader-PYGPX6D2.js +2 -0
  6. package/dist/agent-state-KSQ3S7OB.js +2 -0
  7. package/dist/agents-suggest-HYTFMQD3.js +10 -0
  8. package/dist/aggregate-W66DM3GA.js +10 -0
  9. package/dist/ambient-HYZR42NX.js +35 -0
  10. package/dist/assess-UFPYEJKP.js +9 -0
  11. package/dist/auto-RHJXOZFL.js +14 -0
  12. package/dist/beacon-5QVYV5DF.js +13 -0
  13. package/dist/calibration-OLJYB5HN.js +7 -0
  14. package/dist/check-THVGY4R5.js +14 -0
  15. package/dist/chunk-22ISTMKI.js +31 -0
  16. package/dist/chunk-2QO33NYK.js +3 -0
  17. package/dist/chunk-33LKBMVK.js +134 -0
  18. package/dist/chunk-4QADCWPU.js +7 -0
  19. package/dist/chunk-4TXOVRWD.js +3 -0
  20. package/dist/chunk-4UJ4NIEQ.js +4 -0
  21. package/dist/chunk-4ZGGWZ32.js +3 -0
  22. package/dist/chunk-5TAVYPOV.js +2 -0
  23. package/dist/chunk-6EX37L4Q.js +8 -0
  24. package/dist/chunk-AD5TAD2A.js +5 -0
  25. package/dist/chunk-AGVAHVUA.js +2 -0
  26. package/dist/chunk-AO7ZSRME.js +13 -0
  27. package/dist/chunk-BFD3GFRK.js +2 -0
  28. package/dist/chunk-D34YFK4M.js +6 -0
  29. package/dist/chunk-DVZWCXB6.js +2 -0
  30. package/dist/chunk-EKZDFEJW.js +2 -0
  31. package/dist/chunk-ET5XJTSX.js +2 -0
  32. package/dist/chunk-FYDRENK7.js +3 -0
  33. package/dist/chunk-HMQ5BHP2.js +743 -0
  34. package/dist/chunk-HXKWL3VK.js +29 -0
  35. package/dist/chunk-IZSBGW6E.js +2 -0
  36. package/dist/chunk-J32OPJEX.js +2 -0
  37. package/dist/chunk-JBDMCRPP.js +7 -0
  38. package/dist/chunk-JIXHEBGK.js +7 -0
  39. package/dist/chunk-JNSJVCTU.js +2 -0
  40. package/dist/chunk-JQKKVAAN.js +2 -0
  41. package/dist/chunk-KLBH26PA.js +429 -0
  42. package/dist/chunk-L6K5HNDL.js +24 -0
  43. package/dist/chunk-LKAT7IAK.js +2 -0
  44. package/dist/chunk-M4UMM6DC.js +5 -0
  45. package/dist/chunk-NKYNHSA5.js +424 -0
  46. package/dist/chunk-NW6OKHE6.js +5 -0
  47. package/dist/chunk-NXRVR37G.js +60 -0
  48. package/dist/chunk-ODVKPZZ4.js +2 -0
  49. package/dist/chunk-PUBB7LIT.js +5 -0
  50. package/dist/chunk-Q2J542ST.js +2 -0
  51. package/dist/chunk-QGZRM6ZB.js +2 -0
  52. package/dist/chunk-QNZEG7IT.js +13 -0
  53. package/dist/chunk-QT2LKB3P.js +7 -0
  54. package/dist/chunk-RVRARWSY.js +9 -0
  55. package/dist/chunk-T6IDXUUA.js +2 -0
  56. package/dist/chunk-TYWB5IQJ.js +3 -0
  57. package/dist/chunk-UIKLE3WD.js +2 -0
  58. package/dist/chunk-V7K6CQVX.js +111 -0
  59. package/dist/chunk-VCKKJDLP.js +8 -0
  60. package/dist/chunk-VG7FN2TU.js +4 -0
  61. package/dist/chunk-W5IWDW4Y.js +16 -0
  62. package/dist/chunk-W7C6FFMO.js +8 -0
  63. package/dist/chunk-WESTEMIM.js +10 -0
  64. package/dist/chunk-WR6D3SC6.js +5 -0
  65. package/dist/chunk-WS2N27RX.js +3 -0
  66. package/dist/chunk-XMAV5AG6.js +2 -0
  67. package/dist/chunk-XROULIQN.js +2 -0
  68. package/dist/chunk-XUFYOXOU.js +3 -0
  69. package/dist/chunk-Y4XFVDZC.js +3 -0
  70. package/dist/chunk-Y6KXTQBG.js +2 -0
  71. package/dist/{chunk-GTR2TBIJ.js → chunk-Z2UZUCY6.js} +237 -1047
  72. package/dist/chunk-Z34K6GY2.js +8 -0
  73. package/dist/claude-4LR3LJQZ.js +13 -0
  74. package/dist/claude-cli-UP6HGH7C.js +6 -0
  75. package/dist/claude-code-RLJ4GX77.js +11 -0
  76. package/dist/claude-code-teams-R37HJY3Y.js +29 -0
  77. package/dist/commands-LMUD5L6R.js +455 -0
  78. package/dist/compliance-GZ7UAOG3.js +6 -0
  79. package/dist/conductor-Y5IXELTL.js +4 -0
  80. package/dist/config-schema-HR7LDEQ6.js +2 -0
  81. package/dist/constellation-CG7C4WFE.js +13 -0
  82. package/dist/context-audit-RSSRX6XC.js +6 -0
  83. package/dist/cost-IDNVMAEV.js +10 -0
  84. package/dist/cost-PK4KIF7R.js +2 -0
  85. package/dist/cursor-cli-QKF7Z6M2.js +4 -0
  86. package/dist/cursorrules-U5O4G5T4.js +14 -0
  87. package/dist/decision-loader-2XPZE4EZ.js +2 -0
  88. package/dist/delete-P5VULXR4.js +14 -0
  89. package/dist/diff-RTFUKJHF.js +9 -0
  90. package/dist/discipline-H7LDI6NT.js +2 -0
  91. package/dist/dist-3ZCH25SG.js +2 -0
  92. package/dist/dist-KGRCLBJP-2QAPFYNF.js +39 -0
  93. package/dist/dist-R3RWD35F.js +2 -0
  94. package/dist/dist-VGFSP3XM.js +2 -0
  95. package/dist/dist-VXCZWVVJ.js +2 -0
  96. package/dist/dist-W3XCATBJ.js +2 -0
  97. package/dist/docs-EDQ2STFK.js +2 -0
  98. package/dist/docs-RXPN6CK7.js +12 -0
  99. package/dist/doctor-2T2QL6VM.js +2 -0
  100. package/dist/drift-ILZE5BFJ.js +13 -0
  101. package/dist/echo-UPTQUEDU.js +46 -0
  102. package/dist/edit-GUU3HBVW.js +9 -0
  103. package/dist/event-Y3VXC2RV.js +3 -0
  104. package/dist/explain-files-3GPZUETV.js +4 -0
  105. package/dist/export-CV5KCTPS.js +2 -0
  106. package/dist/flow-S3RQ4YPY.js +11 -0
  107. package/dist/global-C44FW4G2.js +13 -0
  108. package/dist/graduate-3BBSC27A.js +5 -0
  109. package/dist/graph-CNDE5TAT.js +2 -0
  110. package/dist/graph-server-COZR5C3Z.js +14 -0
  111. package/dist/habits-4J2KRYUL.js +42 -0
  112. package/dist/history-UW454SDP.js +12 -0
  113. package/dist/hooks-XH52VGOU.js +2 -0
  114. package/dist/index.js +15 -1039
  115. package/dist/init-24MAQJFM.js +2 -0
  116. package/dist/integrity-UYDOOJDP.js +7 -0
  117. package/dist/integrity-checker-DHGMZQDG.js +2 -0
  118. package/dist/journal-loader-GLH7XFTK.js +2 -0
  119. package/dist/lint-IGKE6UPS.js +26 -0
  120. package/dist/list-5IUGP3ZB.js +7 -0
  121. package/dist/list-YKIQNKGB.js +6 -0
  122. package/dist/lore-loader-RVQI5GXL.js +2 -0
  123. package/dist/lore-loader-XY5MZRR2.js +2 -0
  124. package/dist/lore-server-FC2GMDLT.js +14 -0
  125. package/dist/manual-RXSPSFLL.js +20 -0
  126. package/dist/mcp.js +93 -20529
  127. package/dist/migrate-X5OMAFAQ.js +59 -0
  128. package/dist/migrate-assessments-GEI5WMI2.js +4 -0
  129. package/dist/model-discovery-HMB3YI4L.js +2 -0
  130. package/dist/nomination-engine-XF7TWPAP.js +2 -0
  131. package/dist/notebook-PE3JSYZI.js +11 -0
  132. package/dist/notebook-loader-CENTDDUJ.js +2 -0
  133. package/dist/orchestrate-35HBQ3O3.js +8 -0
  134. package/dist/peers-P2KXU7ZK.js +5 -0
  135. package/dist/persona-STQWZH5P.js +29 -0
  136. package/dist/pipeline-MZUITRVN.js +4 -0
  137. package/dist/platform-server-2KXHGHFV.js +25 -0
  138. package/dist/plugin-update-checker-M7PW434O.js +2 -0
  139. package/dist/portal-check-3JVNLOEP.js +8 -0
  140. package/dist/portal-compliance-2UG4VKWH.js +2 -0
  141. package/dist/probe-5L5BQDGE.js +6 -0
  142. package/dist/project-type-SURTOIG7.js +2 -0
  143. package/dist/promote-NJQDZBZA.js +8 -0
  144. package/dist/providers-4PXMWA7V.js +8 -0
  145. package/dist/quiz-FE5UGAY2.js +10 -0
  146. package/dist/record-YXPB34MY.js +6 -0
  147. package/dist/reindex-PGDQSM42.js +2 -0
  148. package/dist/remember-MJRNTXYS.js +14 -0
  149. package/dist/retag-N5XF3KXP.js +6 -0
  150. package/dist/review-6UAH6V3R.js +11 -0
  151. package/dist/review-77QI6VOC.js +6 -0
  152. package/dist/ripple-ZGDITCGB.js +10 -0
  153. package/dist/roster-FLRZ5J42.js +2 -0
  154. package/dist/sentinel-HYAZ3CO5.js +19 -0
  155. package/dist/sentinel-bridge-VR357PKL.js +2 -0
  156. package/dist/sentinel-mcp.js +38 -3808
  157. package/dist/sentinel.js +1 -34
  158. package/dist/serve-JE6UF5P2.js +8 -0
  159. package/dist/serve-L52ZUTU6.js +10 -0
  160. package/dist/serve-OY6XYL7F.js +12 -0
  161. package/dist/server-2MNROHF6.js +7 -0
  162. package/dist/server-4YNUIK4W.js +8 -0
  163. package/dist/session-tracker-SKOMBDOW.js +2 -0
  164. package/dist/session-work-log-3MNUDEZ6.js +2 -0
  165. package/dist/session-work-log-J2H5OZBR.js +2 -0
  166. package/dist/setup-3F5IK7MO.js +31 -0
  167. package/dist/setup-KPIMRZ4Q.js +2 -0
  168. package/dist/shift-6GCNH666.js +11 -0
  169. package/dist/show-BOAVWZPZ.js +7 -0
  170. package/dist/show-PJ5LFLIL.js +5 -0
  171. package/dist/snapshot-L2G56RPL.js +8 -0
  172. package/dist/spawn-UH5RENSE.js +12 -0
  173. package/dist/status-77M3SDIF.js +8 -0
  174. package/dist/status-A37ECYNJ.js +6 -0
  175. package/dist/summary-ZJLQ6KHB.js +7 -0
  176. package/dist/sweep-HU74OPVW.js +17 -0
  177. package/dist/switch-CTW4PDGI.js +17 -0
  178. package/dist/symphony-3QMBGCZY.js +2 -0
  179. package/dist/symphony-QI63XL62.js +53 -0
  180. package/dist/symphony-loader-XACVV2E3.js +2 -0
  181. package/dist/symphony-peers-U4KHMKGI.js +2 -0
  182. package/dist/symphony-peers-X5NGWXFP.js +2 -0
  183. package/dist/symphony-relay-5GY5JIPT.js +3 -0
  184. package/dist/sync-QRDSFETO.js +2 -0
  185. package/dist/sync-llms-HL5PPW3M.js +15 -0
  186. package/dist/task-loader-NZFDTUQ5.js +2 -0
  187. package/dist/team-WGERKGNP.js +2 -0
  188. package/dist/test-BQJMS4Y2.js +111 -0
  189. package/dist/thread-HFXK65D4.js +41 -0
  190. package/dist/timeline-K3ZFKJ3R.js +6 -0
  191. package/dist/triage-FCWOZASE.js +18 -0
  192. package/dist/tutorial-UC6YQMNN.js +305 -0
  193. package/dist/university-content/courses/.purpose +74 -5
  194. package/dist/university-content/plsat/.purpose +3 -2
  195. package/dist/university-ui/assets/{index-BjewBB6s.js → index-CGFJczb1.js} +2 -2
  196. package/dist/university-ui/assets/{index-BjewBB6s.js.map → index-CGFJczb1.js.map} +1 -1
  197. package/dist/university-ui/index.html +1 -1
  198. package/dist/upgrade-B4IOLZYK.js +53 -0
  199. package/dist/validate-C6SMKGYD.js +9 -0
  200. package/dist/validate-LSCDOLBO.js +13 -0
  201. package/dist/validate-VZXTJHGO.js +6 -0
  202. package/dist/watch-LRM5XD46.js +8 -0
  203. package/dist/watch-PZCCUP6K.js +9 -0
  204. package/dist/wisdom-XZ3QKPNP.js +7 -0
  205. package/dist/work-log-loader-DL5GZ2BQ.js +2 -0
  206. package/dist/workspace-2ODL5WLY.js +2 -0
  207. package/package.json +1 -1
  208. package/platform-ui/dist/assets/AmbientSection-DqQ2mfCO.js +1 -0
  209. package/platform-ui/dist/assets/{CanvasSection-DwPTRdIN.js → CanvasSection-DLW0s-Bu.js} +1 -1
  210. package/platform-ui/dist/assets/{DocsSection-BJc_ws4I.js → DocsSection-BQ9Hi51g.js} +1 -1
  211. package/platform-ui/dist/assets/{GitSection-DhqBo1xc.js → GitSection-QQeUX6o3.js} +1 -1
  212. package/platform-ui/dist/assets/{GraphSection-D9fhVnZ0.js → GraphSection-0c9C-w7K.js} +2 -2
  213. package/platform-ui/dist/assets/{GraphSection-BlgXTl53.css → GraphSection-Bbs2a8sC.css} +1 -1
  214. package/platform-ui/dist/assets/LoreSection--t56kCj2.js +1 -0
  215. package/platform-ui/dist/assets/LoreSection-qnmm3o4y.css +1 -0
  216. package/platform-ui/dist/assets/SentinelSection-C4OoME9U.js +1 -0
  217. package/platform-ui/dist/assets/{SymphonySection-BRoBaUSS.js → SymphonySection-B-rvsLxq.js} +1 -1
  218. package/platform-ui/dist/assets/TeamSection-CBFmNEEo.js +1 -0
  219. package/platform-ui/dist/assets/index-Bxp0TVaf.css +1 -0
  220. package/platform-ui/dist/assets/index-DPpOdAtC.js +57 -0
  221. package/platform-ui/dist/index.html +2 -2
  222. package/dist/accept-orchestration-UQLM7PTQ.js +0 -189
  223. package/dist/add-FZRKEGH4.js +0 -81
  224. package/dist/agent-WERIO2XV.js +0 -523
  225. package/dist/agent-loader-TFIANSF4.js +0 -44
  226. package/dist/agent-state-S5DAWPTF.js +0 -24
  227. package/dist/agents-suggest-DNSYJ6IA.js +0 -83
  228. package/dist/aggregate-H57K7PNV.js +0 -88
  229. package/dist/assess-4WVXZLZQ.js +0 -68
  230. package/dist/auto-QFS5NHQU.js +0 -504
  231. package/dist/beacon-KXZXYQHX.js +0 -251
  232. package/dist/calibration-V46G7JTY.js +0 -135
  233. package/dist/check-OWAIWV23.js +0 -175
  234. package/dist/chunk-2IO7JAG2.js +0 -148
  235. package/dist/chunk-2T6BTYBN.js +0 -712
  236. package/dist/chunk-36TKPM5Z.js +0 -400
  237. package/dist/chunk-45MUDW6E.js +0 -804
  238. package/dist/chunk-4BLYIB7J.js +0 -5701
  239. package/dist/chunk-4L3UTYQX.js +0 -677
  240. package/dist/chunk-4NCFWYGG.js +0 -110
  241. package/dist/chunk-54LTTQBH.js +0 -138
  242. package/dist/chunk-5EWAQHFY.js +0 -269
  243. package/dist/chunk-5JGJACDU.js +0 -37
  244. package/dist/chunk-5OUOLN6M.js +0 -659
  245. package/dist/chunk-5VKJBNJL.js +0 -444
  246. package/dist/chunk-6N3JTACN.js +0 -2260
  247. package/dist/chunk-6QC3YGB6.js +0 -114
  248. package/dist/chunk-7N7GSU6K.js +0 -34
  249. package/dist/chunk-ABVQGRF7.js +0 -268
  250. package/dist/chunk-CL7JSK52.js +0 -129
  251. package/dist/chunk-CSD7IHSN.js +0 -152
  252. package/dist/chunk-EDOAWN7J.js +0 -717
  253. package/dist/chunk-EKGMAM62.js +0 -525
  254. package/dist/chunk-EZ3GOCYC.js +0 -132
  255. package/dist/chunk-F3BCHPYT.js +0 -143
  256. package/dist/chunk-FKJUBQU3.js +0 -3081
  257. package/dist/chunk-GT5QGC2H.js +0 -253
  258. package/dist/chunk-GZDFVP2N.js +0 -540
  259. package/dist/chunk-IRKUEJVW.js +0 -405
  260. package/dist/chunk-J2JEQRT3.js +0 -164
  261. package/dist/chunk-JASGXLK3.js +0 -679
  262. package/dist/chunk-KVDYJLTC.js +0 -121
  263. package/dist/chunk-L27I3CPZ.js +0 -357
  264. package/dist/chunk-LHLIAYQ3.js +0 -185
  265. package/dist/chunk-MCMOGQMU.js +0 -145
  266. package/dist/chunk-NQKQG45G.js +0 -688
  267. package/dist/chunk-PBHIFAL4.js +0 -259
  268. package/dist/chunk-PDX44BCA.js +0 -11
  269. package/dist/chunk-PMXRGPRQ.js +0 -305
  270. package/dist/chunk-RAB5IKPR.js +0 -487
  271. package/dist/chunk-RJE5G7WO.js +0 -590
  272. package/dist/chunk-RTHA3XRE.js +0 -880
  273. package/dist/chunk-S2HO5MLR.js +0 -621
  274. package/dist/chunk-S3ORKP3V.js +0 -716
  275. package/dist/chunk-TAIJOFOE.js +0 -124
  276. package/dist/chunk-TXESEO7Y.js +0 -245
  277. package/dist/chunk-UPLDI7CN.js +0 -1334
  278. package/dist/chunk-VL67H5IC.js +0 -506
  279. package/dist/chunk-VPPK3SY4.js +0 -1136
  280. package/dist/chunk-YMDLDELF.js +0 -314
  281. package/dist/chunk-YO6DVTL7.js +0 -99
  282. package/dist/chunk-YRZ5RPEB.js +0 -1561
  283. package/dist/chunk-ZDHLG5VP.js +0 -5676
  284. package/dist/chunk-ZGUAAVMA.js +0 -756
  285. package/dist/chunk-ZSYVKSY6.js +0 -2602
  286. package/dist/claude-FRRWJSTJ.js +0 -362
  287. package/dist/claude-cli-XJLK2X4L.js +0 -276
  288. package/dist/claude-code-HTBA4XRB.js +0 -126
  289. package/dist/claude-code-teams-T4SP24MD.js +0 -199
  290. package/dist/commands-5N4ILTPH.js +0 -5859
  291. package/dist/conductor-CQVGTEQN.js +0 -161
  292. package/dist/config-schema-EA4XALGG.js +0 -154
  293. package/dist/constellation-A26CCGQS.js +0 -225
  294. package/dist/context-audit-RLO3ETRP.js +0 -682
  295. package/dist/cost-BGM32XJU.js +0 -93
  296. package/dist/cost-VI46A4XL.js +0 -174
  297. package/dist/cursor-cli-JVEZGHWQ.js +0 -269
  298. package/dist/cursorrules-HLIKJJZT.js +0 -84
  299. package/dist/decision-loader-WWCLIQPJ.js +0 -20
  300. package/dist/delete-KBRPQLPC.js +0 -56
  301. package/dist/diff-D4X53HAC.js +0 -126
  302. package/dist/discipline-FA4OZXIS.js +0 -24
  303. package/dist/dist-34NA5RS5.js +0 -74
  304. package/dist/dist-5QE2BB2B-5S3T6Y3T.js +0 -6919
  305. package/dist/dist-77JDTVAY.js +0 -62
  306. package/dist/dist-OGTSAZ55.js +0 -1358
  307. package/dist/dist-QK4SQAK7.js +0 -64
  308. package/dist/dist-TA6LSC2Q.js +0 -20
  309. package/dist/docs-PBZB7LYP.js +0 -89
  310. package/dist/docs-QIYKO3BR.js +0 -155
  311. package/dist/doctor-ULBOHEIC.js +0 -11
  312. package/dist/drift-R5NRKFHI.js +0 -251
  313. package/dist/echo-O2LY7CC2.js +0 -248
  314. package/dist/edit-R2HNLMOG.js +0 -63
  315. package/dist/event-25OJKDCE.js +0 -31
  316. package/dist/export-IWVL7XLF.js +0 -38
  317. package/dist/flow-CRRVV3O3.js +0 -185
  318. package/dist/global-3NG5JXUB.js +0 -136
  319. package/dist/graduate-USAWGBJM.js +0 -160
  320. package/dist/graph-VHUMAAS6.js +0 -12
  321. package/dist/graph-server-YL22VBBN.js +0 -116
  322. package/dist/habits-OL5NGPXO.js +0 -1405
  323. package/dist/history-WOWC573W.js +0 -277
  324. package/dist/hooks-HFWSCGPV.js +0 -12
  325. package/dist/integrity-IHO4FZTS.js +0 -194
  326. package/dist/integrity-checker-PSKJA5SB.js +0 -12
  327. package/dist/journal-loader-5EYSBFFY.js +0 -18
  328. package/dist/lint-K6CJGGPH.js +0 -456
  329. package/dist/list-4YK7QKFF.js +0 -57
  330. package/dist/list-ENR7Q4CR.js +0 -56
  331. package/dist/lore-loader-7NO6N6FT.js +0 -26
  332. package/dist/lore-server-UNJY5KC3.js +0 -118
  333. package/dist/manual-G6FISID5.js +0 -204
  334. package/dist/migrate-LS45DNEV.js +0 -889
  335. package/dist/migrate-assessments-RGH4O6IX.js +0 -97
  336. package/dist/model-discovery-D2H3VBGC.js +0 -8
  337. package/dist/nomination-engine-RV5CNO5B.js +0 -42
  338. package/dist/notebook-YWIYGEHV.js +0 -155
  339. package/dist/orchestrate-JLILBBJE.js +0 -324
  340. package/dist/peers-DEOUIZM6.js +0 -82
  341. package/dist/persona-UHAHIVST.js +0 -390
  342. package/dist/pipeline-L4HCSBGN.js +0 -263
  343. package/dist/platform-server-H5YO3DQD.js +0 -1475
  344. package/dist/plugin-update-checker-KRRSGXMV.js +0 -12
  345. package/dist/portal-check-NPYGII2D.js +0 -42
  346. package/dist/portal-compliance-J7DGAPFX.js +0 -18
  347. package/dist/probe-MHL5HQZ2.js +0 -167
  348. package/dist/promote-F6ZYZZAL.js +0 -182
  349. package/dist/providers-GK7PB2OL.js +0 -104
  350. package/dist/quiz-M66SC7F7.js +0 -99
  351. package/dist/record-RA4WR2BO.js +0 -49
  352. package/dist/reindex-5LTD53ZC.js +0 -16
  353. package/dist/remember-HBWJ655S.js +0 -77
  354. package/dist/retag-3OLCVDEQ.js +0 -62
  355. package/dist/review-27ATYTD2.js +0 -33
  356. package/dist/review-57QMURZV.js +0 -334
  357. package/dist/ripple-JPBXP5I3.js +0 -215
  358. package/dist/sentinel-4XIG4STA.js +0 -63
  359. package/dist/sentinel-bridge-MDUXTQRL.js +0 -109
  360. package/dist/serve-CAH3PHE7.js +0 -33
  361. package/dist/serve-INL7SNBK.js +0 -36
  362. package/dist/serve-KBSE36PL.js +0 -49
  363. package/dist/server-54SKYFFY.js +0 -1647
  364. package/dist/server-XUOIO7E6.js +0 -338
  365. package/dist/session-tracker-C4BMD5WG.js +0 -13
  366. package/dist/session-work-log-MZ47OAPB.js +0 -20
  367. package/dist/setup-EDS27WUR.js +0 -25
  368. package/dist/setup-KO5AFC4K.js +0 -296
  369. package/dist/shift-D2JOHHBF.js +0 -668
  370. package/dist/show-5PV5KFJE.js +0 -176
  371. package/dist/show-NQKYX6WQ.js +0 -82
  372. package/dist/snapshot-BK4RBPCG.js +0 -62
  373. package/dist/spawn-RCHNXDHE.js +0 -196
  374. package/dist/status-WGIAQODY.js +0 -71
  375. package/dist/summary-NIRABMF5.js +0 -140
  376. package/dist/sweep-QMHNSIY5.js +0 -934
  377. package/dist/switch-6EJPZDIA.js +0 -232
  378. package/dist/symphony-4OCY36AI.js +0 -791
  379. package/dist/symphony-B75X2MME.js +0 -326
  380. package/dist/symphony-loader-UZGON56V.js +0 -90
  381. package/dist/symphony-peers-2ZQYLRNI.js +0 -34
  382. package/dist/symphony-peers-OL7F6M5S.js +0 -121
  383. package/dist/symphony-relay-UJYUXN65.js +0 -710
  384. package/dist/sync-VEHUH4OA.js +0 -11
  385. package/dist/sync-llms-YHCFIE6X.js +0 -166
  386. package/dist/task-loader-LDYWQSLM.js +0 -20
  387. package/dist/team-O5MIIFMA.js +0 -34
  388. package/dist/test-566CP5KC.js +0 -1017
  389. package/dist/thread-N754I4D5.js +0 -274
  390. package/dist/timeline-M3CICQFE.js +0 -112
  391. package/dist/triage-HHYGT3HY.js +0 -671
  392. package/dist/tutorial-KD22SUNO.js +0 -666
  393. package/dist/upgrade-H5PF32BW.js +0 -551
  394. package/dist/validate-CNKEKO6A.js +0 -134
  395. package/dist/validate-MB5ULIHS.js +0 -39
  396. package/dist/validate-QH3LADM6.js +0 -64
  397. package/dist/watch-2TKP5PVL.js +0 -199
  398. package/dist/watch-ZF4ML6CD.js +0 -111
  399. package/dist/wisdom-AATMGNFA.js +0 -319
  400. package/dist/work-log-loader-5L45XNYZ.js +0 -14
  401. package/dist/workspace-6E6OSRNU.js +0 -21
  402. package/platform-ui/dist/assets/AmbientSection-WtHfNedO.js +0 -1
  403. package/platform-ui/dist/assets/LoreSection-C3EixkjW.css +0 -1
  404. package/platform-ui/dist/assets/LoreSection-CwDDHrz9.js +0 -1
  405. package/platform-ui/dist/assets/SentinelSection-Cl7e5oZ6.js +0 -1
  406. package/platform-ui/dist/assets/TeamSection-CqSIMrKz.js +0 -1
  407. package/platform-ui/dist/assets/index-CfpZFjea.css +0 -1
  408. package/platform-ui/dist/assets/index-F0KL9xrN.js +0 -57
@@ -1,1561 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- suggestAgentsForTask
4
- } from "./chunk-6QC3YGB6.js";
5
- import {
6
- AgentSpawner,
7
- extractSymbols
8
- } from "./chunk-45MUDW6E.js";
9
- import {
10
- loadAgentsManifest
11
- } from "./chunk-PMXRGPRQ.js";
12
- import {
13
- AuditLogger
14
- } from "./chunk-PBHIFAL4.js";
15
- import {
16
- calculateCost
17
- } from "./chunk-5JGJACDU.js";
18
- import {
19
- buildSymbolIndex,
20
- getReferencesTo,
21
- searchSymbols
22
- } from "./chunk-ZGUAAVMA.js";
23
- import {
24
- extractDeclaredGates,
25
- loadPortalConfig
26
- } from "./chunk-YMDLDELF.js";
27
-
28
- // src/core/orchestrator.ts
29
- import { minimatch } from "minimatch";
30
-
31
- // src/core/task-classifier.ts
32
- var ANALYSIS_KEYWORDS = [
33
- "should",
34
- "what",
35
- "how",
36
- "why",
37
- "recommend",
38
- "analyze",
39
- "compare",
40
- "evaluate",
41
- "assess",
42
- "review",
43
- "explain",
44
- "describe",
45
- "investigate",
46
- "which",
47
- "best practice",
48
- "trade-off",
49
- "tradeoff",
50
- "pros and cons",
51
- "decision"
52
- ];
53
- var DOCUMENTATION_KEYWORDS = [
54
- "document",
55
- "write docs",
56
- "readme",
57
- ".purpose",
58
- "purpose file",
59
- "jsdoc",
60
- "tsdoc",
61
- "comments",
62
- "docstring",
63
- "api docs",
64
- "changelog",
65
- "architecture doc"
66
- ];
67
- var BUGFIX_KEYWORDS = [
68
- "bug",
69
- "fix",
70
- "broken",
71
- "not working",
72
- "issue",
73
- "error",
74
- "crash",
75
- "fails",
76
- "failing",
77
- "wrong",
78
- "incorrect",
79
- "doesn't work",
80
- "doesn't",
81
- "cant",
82
- "can't",
83
- "regression",
84
- "patch"
85
- ];
86
- var REFACTOR_KEYWORDS = [
87
- "rename",
88
- "refactor",
89
- "migrate",
90
- "restructure",
91
- "move",
92
- "reorganize",
93
- "clean up",
94
- "cleanup",
95
- "consolidate",
96
- "extract",
97
- "inline",
98
- "simplify",
99
- "modularize",
100
- "decouple",
101
- "split",
102
- "merge"
103
- ];
104
- var SECURITY_KEYWORDS = [
105
- "auth",
106
- "authentication",
107
- "authorization",
108
- "permission",
109
- "admin",
110
- "delete",
111
- "purge",
112
- "password",
113
- "credential",
114
- "token",
115
- "secret",
116
- "key",
117
- "encrypt",
118
- "decrypt",
119
- "hash",
120
- "session",
121
- "oauth",
122
- "jwt",
123
- "api key",
124
- "role",
125
- "access",
126
- "gate",
127
- "portal",
128
- "sensitive",
129
- "private",
130
- "security",
131
- "vulnerability",
132
- "xss",
133
- "sql injection",
134
- "csrf"
135
- ];
136
- var SYMBOL_PATTERN = /[@#$%^!?&~][a-zA-Z0-9_-]+/g;
137
- var TASK_AGENT_MAPPING = {
138
- analysis: {
139
- agents: ["architect"],
140
- models: { architect: "opus" },
141
- costMultiplier: { min: 0.3, max: 0.5 }
142
- },
143
- documentation: {
144
- agents: ["architect"],
145
- models: { architect: "sonnet" },
146
- costMultiplier: { min: 0.25, max: 0.45 }
147
- },
148
- bugfix: {
149
- agents: ["security", "builder"],
150
- models: { security: "opus", builder: "haiku" },
151
- costMultiplier: { min: 0.5, max: 0.8 }
152
- },
153
- refactor: {
154
- agents: ["architect", "builder"],
155
- models: { architect: "opus", builder: "haiku" },
156
- costMultiplier: { min: 0.6, max: 0.85 }
157
- },
158
- feature: {
159
- agents: ["architect", "security", "builder", "tester"],
160
- models: { architect: "opus", security: "opus", builder: "haiku", tester: "haiku" },
161
- costMultiplier: { min: 0.8, max: 1.2 }
162
- }
163
- };
164
- function extractSymbols2(text) {
165
- const matches = text.match(SYMBOL_PATTERN) || [];
166
- return [...new Set(matches)];
167
- }
168
- function matchesKeywords(text, keywords) {
169
- const textLower = text.toLowerCase();
170
- return keywords.filter((keyword) => textLower.includes(keyword.toLowerCase()));
171
- }
172
- function determineComplexity(task, type, symbols, context) {
173
- let score = 0;
174
- if (symbols.length >= 5) score += 2;
175
- else if (symbols.length >= 2) score += 1;
176
- const wordCount = task.split(/\s+/).length;
177
- if (wordCount >= 100) score += 2;
178
- else if (wordCount >= 50) score += 1;
179
- const prefixes = new Set(symbols.map((s) => s[0]));
180
- if (prefixes.size >= 4) score += 2;
181
- else if (prefixes.size >= 2) score += 1;
182
- if (symbols.some((s) => s.startsWith("^"))) score += 1;
183
- if (symbols.some((s) => s.startsWith("$"))) score += 1;
184
- if (type === "feature") score += 1;
185
- if (type === "refactor") score += 1;
186
- if (context?.affectedFiles && context.affectedFiles.length > 10) score += 2;
187
- else if (context?.affectedFiles && context.affectedFiles.length > 5) score += 1;
188
- if (score >= 5) return "high";
189
- if (score >= 2) return "medium";
190
- return "low";
191
- }
192
- function shouldInvolveSecurity(task, symbols, context) {
193
- const securityMatches = matchesKeywords(task, SECURITY_KEYWORDS);
194
- if (securityMatches.length > 0) return true;
195
- if (symbols.some((s) => s.startsWith("^"))) return true;
196
- if (context?.affectedFiles) {
197
- const sensitivePathPatterns = [
198
- /auth/i,
199
- /middleware/i,
200
- /security/i,
201
- /gate/i,
202
- /permission/i,
203
- /admin/i
204
- ];
205
- for (const file of context.affectedFiles) {
206
- if (sensitivePathPatterns.some((pattern) => pattern.test(file))) {
207
- return true;
208
- }
209
- }
210
- }
211
- return false;
212
- }
213
- function classifyTask(task, context) {
214
- const symbols = extractSymbols2(task);
215
- const analysisMatches = matchesKeywords(task, ANALYSIS_KEYWORDS);
216
- const documentationMatches = matchesKeywords(task, DOCUMENTATION_KEYWORDS);
217
- const bugfixMatches = matchesKeywords(task, BUGFIX_KEYWORDS);
218
- const refactorMatches = matchesKeywords(task, REFACTOR_KEYWORDS);
219
- let type;
220
- let matchedKeywords;
221
- if (analysisMatches.length > 0 && bugfixMatches.length === 0 && refactorMatches.length === 0) {
222
- type = "analysis";
223
- matchedKeywords = analysisMatches;
224
- } else if (documentationMatches.length > 0 && bugfixMatches.length === 0) {
225
- type = "documentation";
226
- matchedKeywords = documentationMatches;
227
- } else if (bugfixMatches.length > 0) {
228
- type = "bugfix";
229
- matchedKeywords = bugfixMatches;
230
- } else if (refactorMatches.length > 0) {
231
- type = "refactor";
232
- matchedKeywords = refactorMatches;
233
- } else {
234
- type = "feature";
235
- matchedKeywords = [];
236
- }
237
- const mapping = TASK_AGENT_MAPPING[type];
238
- const securityRequired = shouldInvolveSecurity(task, symbols, context);
239
- let recommendedAgents = [...mapping.agents];
240
- if (securityRequired && !recommendedAgents.includes("security")) {
241
- recommendedAgents = ["security", ...recommendedAgents];
242
- }
243
- const complexity = determineComplexity(task, type, symbols, context);
244
- let costMultiplier = { ...mapping.costMultiplier };
245
- if (complexity === "high") {
246
- costMultiplier.min *= 1.2;
247
- costMultiplier.max *= 1.3;
248
- } else if (complexity === "low") {
249
- costMultiplier.min *= 0.8;
250
- costMultiplier.max *= 0.9;
251
- }
252
- if (securityRequired && !mapping.agents.includes("security")) {
253
- costMultiplier.min += 0.15;
254
- costMultiplier.max += 0.2;
255
- }
256
- return {
257
- type,
258
- complexity,
259
- recommendedAgents,
260
- securityRequired,
261
- costMultiplier,
262
- matchedKeywords,
263
- symbols
264
- };
265
- }
266
- function getRecommendedModel(agentName, classification) {
267
- const mapping = TASK_AGENT_MAPPING[classification.type];
268
- if (agentName === "security" && classification.securityRequired) {
269
- return "opus";
270
- }
271
- return mapping.models[agentName] || "sonnet";
272
- }
273
-
274
- // src/core/pm-compliance.ts
275
- import * as fs from "fs";
276
- import * as path from "path";
277
- var SYMBOL_PATTERN2 = /[@#$%^!?&~][a-zA-Z][a-zA-Z0-9_-]*/g;
278
- var ROUTE_PATTERNS = [
279
- // Express/Fastify
280
- /\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi,
281
- // SvelteKit
282
- /export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi,
283
- // Next.js
284
- /export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi,
285
- // Hono
286
- /\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi
287
- ];
288
- var ROUTE_KEYWORDS = [
289
- "endpoint",
290
- "route",
291
- "api",
292
- "handler",
293
- "get",
294
- "post",
295
- "put",
296
- "patch",
297
- "delete",
298
- "rest",
299
- "crud",
300
- "controller"
301
- ];
302
- function runPreflight(task, rootDir, index) {
303
- const taskLower = task.toLowerCase();
304
- const symbolMatches = task.match(SYMBOL_PATTERN2) || [];
305
- const uniqueSymbols = [...new Set(symbolMatches)];
306
- const affectedSymbols = uniqueSymbols.map((sym) => {
307
- const results = searchSymbols(index, sym);
308
- const found = results.length > 0 ? results[0] : null;
309
- return {
310
- symbol: sym,
311
- exists: !!found,
312
- type: found?.type,
313
- description: found?.description
314
- };
315
- });
316
- const rippleAnalysis = affectedSymbols.filter((s) => s.exists).map((s) => {
317
- const directDeps = getReferencesTo(index, s.symbol);
318
- const indirectSet = /* @__PURE__ */ new Set();
319
- for (const dep of directDeps) {
320
- const indirect = getReferencesTo(index, dep.symbol);
321
- for (const ind of indirect) {
322
- if (ind.symbol !== s.symbol && !directDeps.find((d) => d.symbol === ind.symbol)) {
323
- indirectSet.add(ind.symbol);
324
- }
325
- }
326
- }
327
- const total = directDeps.length + indirectSet.size;
328
- let impact = "low";
329
- if (total > 10) impact = "high";
330
- else if (total > 3) impact = "medium";
331
- return {
332
- symbol: s.symbol,
333
- directDependents: directDeps.length,
334
- indirectDependents: indirectSet.size,
335
- impact
336
- };
337
- });
338
- const portalConfig = loadPortalConfig(rootDir);
339
- const portalStatus = {
340
- exists: !!portalConfig,
341
- gateCount: portalConfig ? extractDeclaredGates(portalConfig).length : 0,
342
- gates: portalConfig ? extractDeclaredGates(portalConfig).map((g) => `^${g}`) : [],
343
- routeCount: portalConfig?.routes ? Object.keys(portalConfig.routes).length : 0
344
- };
345
- const taskAddsRoutes = ROUTE_KEYWORDS.some((k) => taskLower.includes(k));
346
- const manifest = loadAgentsManifest(rootDir);
347
- const suggestedAgents = manifest ? suggestAgentsForTask(task, manifest.agents).map((s) => ({
348
- name: s.name,
349
- confidence: s.confidence,
350
- reason: s.reason
351
- })) : [];
352
- const requiredChecks = [];
353
- if (affectedSymbols.some((s) => s.exists)) {
354
- requiredChecks.push("ripple-analysis");
355
- }
356
- if (taskAddsRoutes) {
357
- requiredChecks.push("portal-compliance");
358
- }
359
- if (uniqueSymbols.some((s) => s.startsWith("^"))) {
360
- requiredChecks.push("gate-validation");
361
- }
362
- if (uniqueSymbols.some((s) => s.startsWith("!"))) {
363
- requiredChecks.push("signal-registration");
364
- }
365
- requiredChecks.push("purpose-coverage");
366
- return {
367
- affectedSymbols,
368
- rippleAnalysis,
369
- portalStatus,
370
- taskAddsRoutes,
371
- suggestedAgents,
372
- requiredChecks
373
- };
374
- }
375
- function runPostflight(filesModified, symbolsTouched, rootDir, index) {
376
- const violations = [];
377
- const portalConfig = loadPortalConfig(rootDir);
378
- const declaredGates = portalConfig ? extractDeclaredGates(portalConfig) : [];
379
- const declaredRoutes = portalConfig?.routes ? Object.keys(portalConfig.routes) : [];
380
- for (const file of filesModified) {
381
- const absPath = path.isAbsolute(file) ? file : path.join(rootDir, file);
382
- if (!fs.existsSync(absPath)) continue;
383
- let content;
384
- try {
385
- content = fs.readFileSync(absPath, "utf-8");
386
- } catch {
387
- continue;
388
- }
389
- for (const pattern of ROUTE_PATTERNS) {
390
- pattern.lastIndex = 0;
391
- let match;
392
- while ((match = pattern.exec(content)) !== null) {
393
- const routePath = match[2] || match[0];
394
- if (routePath && routePath.startsWith("/")) {
395
- const isKnown = declaredRoutes.some((r) => {
396
- const normalizedDeclared = r.replace(/\s+(GET|POST|PUT|PATCH|DELETE)\s*$/, "").trim();
397
- return normalizedDeclared === routePath;
398
- });
399
- if (!isKnown && portalConfig) {
400
- violations.push({
401
- type: "missing-portal-gate",
402
- severity: "warning",
403
- message: `Route "${routePath}" found in ${path.relative(rootDir, absPath)} but not declared in portal.yaml`,
404
- file: path.relative(rootDir, absPath),
405
- suggestion: `Add this route to portal.yaml with appropriate ^gates. Run paradigm_gates_for_route to get suggestions.`
406
- });
407
- } else if (!portalConfig && routePath.startsWith("/api/")) {
408
- violations.push({
409
- type: "missing-portal-gate",
410
- severity: "warning",
411
- message: `API route "${routePath}" found but no portal.yaml exists`,
412
- file: path.relative(rootDir, absPath),
413
- suggestion: `Create portal.yaml to declare gates for API routes. Run: paradigm portal init`
414
- });
415
- }
416
- }
417
- }
418
- }
419
- }
420
- for (const symbol of symbolsTouched) {
421
- const results = searchSymbols(index, symbol);
422
- if (results.length === 0) {
423
- violations.push({
424
- type: "unregistered-symbol",
425
- severity: "error",
426
- message: `Symbol "${symbol}" was touched but is not registered in any .purpose file`,
427
- suggestion: `Add "${symbol}" to the nearest .purpose file. Use paradigm_purpose_add_component or paradigm_purpose_add_signal.`
428
- });
429
- }
430
- }
431
- for (const symbol of symbolsTouched) {
432
- if (symbol.startsWith("^")) {
433
- const gateName = symbol.slice(1);
434
- if (!declaredGates.includes(gateName)) {
435
- violations.push({
436
- type: "missing-portal-gate",
437
- severity: "error",
438
- message: `Gate "${symbol}" is referenced but not declared in portal.yaml`,
439
- suggestion: `Add ${symbol} to portal.yaml with description and check expression.`
440
- });
441
- }
442
- }
443
- }
444
- if (filesModified.length >= 5 && symbolsTouched.length >= 3) {
445
- violations.push({
446
- type: "uncaptured-wisdom",
447
- severity: "warning",
448
- message: `Large change (${filesModified.length} files, ${symbolsTouched.length} symbols) \u2014 consider recording architectural decisions`,
449
- suggestion: `Use paradigm_wisdom_record to capture any decisions or antipatterns discovered during this task.`
450
- });
451
- }
452
- const errors = violations.filter((v) => v.severity === "error").length;
453
- const warnings = violations.filter((v) => v.severity === "warning").length;
454
- const totalChecks = 4;
455
- let status = "pass";
456
- if (errors > 0) status = "violations";
457
- else if (warnings > 0) status = "warnings";
458
- return {
459
- status,
460
- violations,
461
- summary: {
462
- totalChecks,
463
- passed: totalChecks - (errors > 0 ? 1 : 0) - (warnings > 0 ? 1 : 0),
464
- warnings,
465
- errors
466
- },
467
- blocksCompletion: errors > 0
468
- };
469
- }
470
-
471
- // src/core/orchestrator.ts
472
- var DEFAULT_AGENT_MODELS = {
473
- architect: "opus",
474
- security: "opus",
475
- reviewer: "sonnet",
476
- builder: "haiku",
477
- tester: "haiku"
478
- };
479
- var SECURITY_ESCALATION_KEYWORDS = [
480
- "auth",
481
- "permission",
482
- "admin",
483
- "delete",
484
- "purge",
485
- "password",
486
- "credential",
487
- "token",
488
- "secret",
489
- "key",
490
- "encrypt",
491
- "decrypt",
492
- "hash",
493
- "session",
494
- "oauth",
495
- "jwt",
496
- "role",
497
- "access control",
498
- "vulnerability",
499
- "injection",
500
- "xss",
501
- "csrf"
502
- ];
503
- var SECURITY_ESCALATION_PATHS = [
504
- "**/auth/**",
505
- "**/middleware/**",
506
- "**/security/**",
507
- "**/gates/**",
508
- "**/guards/**",
509
- "**/policies/**",
510
- "**/permissions/**",
511
- "**/admin/**"
512
- ];
513
- function shouldEscalateSecurity(task, affectedFiles) {
514
- const taskLower = task.toLowerCase();
515
- const hasKeyword = SECURITY_ESCALATION_KEYWORDS.some(
516
- (k) => taskLower.includes(k.toLowerCase())
517
- );
518
- const hasGateSymbol = task.includes("^");
519
- let hasSensitivePath = false;
520
- if (affectedFiles) {
521
- hasSensitivePath = affectedFiles.some(
522
- (file) => SECURITY_ESCALATION_PATHS.some((pattern) => minimatch(file, pattern))
523
- );
524
- }
525
- return hasKeyword || hasGateSymbol || hasSensitivePath;
526
- }
527
- var REFACTOR_KEYWORDS2 = ["rename", "refactor", "migrate", "restructure", "move", "reorganize"];
528
- function isRefactoringTask(task) {
529
- const taskLower = task.toLowerCase();
530
- return REFACTOR_KEYWORDS2.some((k) => taskLower.includes(k));
531
- }
532
- var Orchestrator = class {
533
- spawner;
534
- auditLogger;
535
- rootDir;
536
- constructor(rootDir) {
537
- this.rootDir = rootDir;
538
- this.spawner = new AgentSpawner(rootDir);
539
- this.auditLogger = new AuditLogger(rootDir);
540
- }
541
- /**
542
- * Initialize the orchestrator
543
- */
544
- async initialize() {
545
- await this.spawner.initialize();
546
- }
547
- /**
548
- * Orchestrate a task
549
- */
550
- async orchestrate(task, options = {}) {
551
- const mode = options.mode || "faceted";
552
- const startTime = Date.now();
553
- const orchestrationId = this.generateOrchestrationId();
554
- const result = {
555
- success: false,
556
- mode,
557
- orchestrationId,
558
- task,
559
- agentsSpawned: 0,
560
- totalTokens: { input: 0, output: 0, total: 0 },
561
- totalCost: 0,
562
- duration_ms: 0,
563
- agentResults: []
564
- };
565
- try {
566
- let preflightResult;
567
- if (options.pmGovernance?.enabled) {
568
- try {
569
- const { aggregateFromDirectory } = await import("./dist-34NA5RS5.js");
570
- const aggregation = await aggregateFromDirectory(this.rootDir);
571
- const index = buildSymbolIndex(aggregation);
572
- preflightResult = runPreflight(task, this.rootDir, index);
573
- } catch {
574
- }
575
- }
576
- if (mode === "solo") {
577
- const soloResult = await this.runSoloMode(task, options);
578
- result.agentsSpawned = 1;
579
- result.agentResults = [soloResult];
580
- result.success = soloResult.success;
581
- if (soloResult.relay) {
582
- result.totalTokens = soloResult.relay.metrics.tokens_used;
583
- result.totalCost = calculateCost(result.totalTokens, options.orchestratorModel || "opus");
584
- }
585
- } else {
586
- const facetedResult = await this.runFacetedMode(task, options);
587
- result.agentsSpawned = facetedResult.results.length;
588
- result.agentResults = facetedResult.results;
589
- result.totalTokens = facetedResult.totalTokens;
590
- result.totalCost = facetedResult.totalCost;
591
- result.success = facetedResult.success;
592
- result.parallelBuilderStats = facetedResult.parallelBuilderStats;
593
- }
594
- if (options.pmGovernance?.enabled && preflightResult) {
595
- try {
596
- const { aggregateFromDirectory } = await import("./dist-34NA5RS5.js");
597
- const aggregation = await aggregateFromDirectory(this.rootDir);
598
- const index = buildSymbolIndex(aggregation);
599
- const filesModified = [];
600
- const symbolsTouched = [];
601
- for (const agentResult of result.agentResults) {
602
- if (agentResult.relay?.outputs?.artifacts) {
603
- filesModified.push(...agentResult.relay.outputs.artifacts.map((a) => a.path));
604
- }
605
- }
606
- for (const sym of preflightResult.affectedSymbols) {
607
- symbolsTouched.push(sym.symbol);
608
- }
609
- const postflightResult = runPostflight(filesModified, symbolsTouched, this.rootDir, index);
610
- result.complianceReport = {
611
- preflight: preflightResult,
612
- postflight: postflightResult
613
- };
614
- if (options.pmGovernance.blockOnViolations && postflightResult.blocksCompletion) {
615
- result.success = false;
616
- }
617
- } catch {
618
- result.complianceReport = { preflight: preflightResult };
619
- }
620
- }
621
- result.duration_ms = Date.now() - startTime;
622
- const log = this.auditLogger.startOrchestration(orchestrationId, task, mode);
623
- log.completed = (/* @__PURE__ */ new Date()).toISOString();
624
- log.status = result.success ? "success" : "failed";
625
- log.totals = {
626
- duration_ms: result.duration_ms,
627
- tokens: result.totalTokens.total,
628
- cost_usd: result.totalCost,
629
- agents_spawned: result.agentsSpawned,
630
- files_created: 0,
631
- files_modified: 0
632
- };
633
- this.auditLogger.saveOrchestration(log);
634
- result.log = log;
635
- return result;
636
- } catch (error) {
637
- result.error = error instanceof Error ? error.message : String(error);
638
- result.duration_ms = Date.now() - startTime;
639
- return result;
640
- }
641
- }
642
- /**
643
- * Compare solo vs faceted mode for A/B testing
644
- */
645
- async compare(task, options = {}) {
646
- const soloResult = await this.orchestrate(task, { ...options, mode: "solo" });
647
- const facetedResult = await this.orchestrate(task, { ...options, mode: "faceted" });
648
- const tokensSaved = soloResult.totalTokens.total - facetedResult.totalTokens.total;
649
- const costDiff = soloResult.totalCost - facetedResult.totalCost;
650
- const timeDiff = soloResult.duration_ms - facetedResult.duration_ms;
651
- let winner = "tie";
652
- if (facetedResult.success && !soloResult.success) {
653
- winner = "faceted";
654
- } else if (soloResult.success && !facetedResult.success) {
655
- winner = "solo";
656
- } else if (facetedResult.totalCost < soloResult.totalCost * 0.8) {
657
- winner = "faceted";
658
- } else if (soloResult.totalCost < facetedResult.totalCost * 0.8) {
659
- winner = "solo";
660
- }
661
- return {
662
- solo: soloResult,
663
- faceted: facetedResult,
664
- comparison: {
665
- winner,
666
- tokensSaved,
667
- costDiff,
668
- timeDiff,
669
- soloSucceeded: soloResult.success,
670
- facetedSucceeded: facetedResult.success
671
- }
672
- };
673
- }
674
- // ==========================================================================
675
- // Private: Solo Mode
676
- // ==========================================================================
677
- async runSoloMode(task, options) {
678
- const manifest = loadAgentsManifest(this.rootDir);
679
- const agentName = manifest?.team.default_agent || "architect";
680
- const model = options.orchestratorModel || "opus";
681
- const spawnerOptions = {
682
- model,
683
- workingDirectory: options.workingDirectory || this.rootDir,
684
- mcpServerPath: options.mcpServerPath,
685
- budget: options.budget,
686
- onMessage: options.onMessage ? (msg) => options.onMessage("solo", msg) : void 0,
687
- onCheckpoint: options.onCheckpoint
688
- };
689
- if (options.onAgentStart) {
690
- options.onAgentStart("solo", task, model);
691
- }
692
- const result = await this.spawner.spawn(agentName, task, spawnerOptions);
693
- if (options.onAgentComplete) {
694
- options.onAgentComplete("solo", result, model);
695
- }
696
- return result;
697
- }
698
- // ==========================================================================
699
- // Private: Faceted Mode
700
- // ==========================================================================
701
- async runFacetedMode(task, options) {
702
- const manifest = loadAgentsManifest(this.rootDir);
703
- if (!manifest) {
704
- return {
705
- success: false,
706
- results: [],
707
- totalTokens: { input: 0, output: 0, total: 0 },
708
- totalCost: 0
709
- };
710
- }
711
- let rippleContext = "";
712
- if (isRefactoringTask(task)) {
713
- const symbols = extractSymbols(task);
714
- if (symbols.length > 0) {
715
- const rippleResults = [];
716
- rippleResults.push("## Auto-Ripple Analysis\n");
717
- rippleResults.push("The following symbols are affected by this refactoring:");
718
- rippleResults.push("");
719
- for (const symbol of symbols.slice(0, 5)) {
720
- rippleResults.push(`- **${symbol}**: Check dependencies before renaming/moving`);
721
- }
722
- rippleResults.push("");
723
- rippleResults.push("**Recommendation:** Run `paradigm_ripple` for each symbol before making changes.");
724
- rippleContext = rippleResults.join("\n");
725
- }
726
- }
727
- const agentPlan = this.planAgentSequence(task, manifest.agents);
728
- const stages = this.groupByStage(agentPlan);
729
- const results = [];
730
- let totalTokens = { input: 0, output: 0, total: 0 };
731
- let totalCost = 0;
732
- let handoffContexts = /* @__PURE__ */ new Map();
733
- let success = true;
734
- let parallelBuilderStats;
735
- const sortedStages = Array.from(stages.keys()).sort((a, b) => a - b);
736
- for (const stageNum of sortedStages) {
737
- const stageAgents = stages.get(stageNum) || [];
738
- if (stageAgents.length === 0) continue;
739
- if (options.checkpoints?.beforeAgentSpawn && options.onCheckpoint) {
740
- const agentNames = stageAgents.map((s) => s.agent).join(", ");
741
- const approved = await options.onCheckpoint(
742
- `Stage ${stageNum}: Spawn ${agentNames}${stageAgents.length > 1 ? " (parallel)" : ""}`
743
- );
744
- if (!approved) {
745
- success = false;
746
- break;
747
- }
748
- }
749
- const spawnPromises = stageAgents.map(async (step) => {
750
- const model = options.agentBudgets?.[step.agent]?.maxTokens ? "haiku" : step.model || DEFAULT_AGENT_MODELS[step.agent] || "sonnet";
751
- let handoffContext = "";
752
- if (step.dependsOn.length > 0) {
753
- const contexts = step.dependsOn.map((dep) => handoffContexts.get(dep)).filter(Boolean);
754
- if (contexts.length > 0) {
755
- handoffContext = contexts.join("\n\n---\n\n");
756
- }
757
- }
758
- let additionalContext = handoffContext;
759
- if (step.agent === "architect" && rippleContext) {
760
- additionalContext = rippleContext + (handoffContext ? "\n\n---\n\n" + handoffContext : "");
761
- }
762
- const taskWithContext = additionalContext ? `${step.subtask}
763
-
764
- ## Context from previous agents:
765
- ${additionalContext}` : step.subtask;
766
- const spawnerOptions = {
767
- model,
768
- workingDirectory: options.workingDirectory || this.rootDir,
769
- mcpServerPath: options.mcpServerPath,
770
- budget: options.agentBudgets?.[step.agent] || options.budget,
771
- onMessage: options.onMessage ? (msg) => options.onMessage(step.agent, msg) : void 0,
772
- onCheckpoint: options.onCheckpoint
773
- };
774
- if (options.onAgentStart) {
775
- options.onAgentStart(step.agent, step.subtask, model);
776
- }
777
- const result = await this.spawner.spawn(step.agent, taskWithContext, spawnerOptions);
778
- if (options.onAgentComplete) {
779
- options.onAgentComplete(step.agent, result, model);
780
- }
781
- return { step, result, model };
782
- });
783
- const stageResults = await Promise.all(spawnPromises);
784
- for (const { step, result, model } of stageResults) {
785
- results.push(result);
786
- if (result.relay) {
787
- totalTokens.input += result.relay.metrics.tokens_used.input;
788
- totalTokens.output += result.relay.metrics.tokens_used.output;
789
- totalTokens.total += result.relay.metrics.tokens_used.total;
790
- totalCost += calculateCost(result.relay.metrics.tokens_used, model);
791
- const context = result.relay.handoff?.context || `${step.agent} completed: ${result.relay.outputs.decisions.join(", ") || "task done"}`;
792
- handoffContexts.set(step.agent, context);
793
- if (step.agent === "architect" && result.relay) {
794
- const filePlan = this.extractFilePlanFromRelay(result);
795
- if (filePlan && filePlan.length > 0) {
796
- const builderPlan = this.planBuilderStages(filePlan);
797
- if (builderPlan.hasFilePlan && builderPlan.totalBuilders > 1) {
798
- const parallelResult = await this.runParallelBuilders(
799
- builderPlan,
800
- handoffContexts.get("architect") || "",
801
- options
802
- );
803
- results.push(...parallelResult.results);
804
- totalTokens.input += parallelResult.totalTokens.input;
805
- totalTokens.output += parallelResult.totalTokens.output;
806
- totalTokens.total += parallelResult.totalTokens.total;
807
- totalCost += parallelResult.totalCost;
808
- if (!parallelResult.success) {
809
- success = false;
810
- }
811
- parallelBuilderStats = {
812
- usedFilePlan: true,
813
- totalSubPhases: builderPlan.stages.length,
814
- totalParallelBuilders: builderPlan.totalBuilders,
815
- filesCreated: builderPlan.totalFiles
816
- };
817
- for (const [stageKey, stageValue] of stages) {
818
- const filtered = stageValue.filter((s) => s.agent !== "builder");
819
- stages.set(stageKey, filtered);
820
- }
821
- }
822
- }
823
- }
824
- }
825
- if (!result.success && step.required) {
826
- success = false;
827
- }
828
- }
829
- if (!success) break;
830
- if (options.checkpoints?.afterAgentComplete && options.onCheckpoint) {
831
- const approved = await options.onCheckpoint(
832
- `Stage ${stageNum} completed. Continue to next stage?`
833
- );
834
- if (!approved) {
835
- break;
836
- }
837
- }
838
- }
839
- return { success, results, totalTokens, totalCost, parallelBuilderStats };
840
- }
841
- /**
842
- * Extract file plan from architect's relay result
843
- */
844
- extractFilePlanFromRelay(result) {
845
- if (!result.relay) return void 0;
846
- const handoffContext = result.relay.handoff?.context || "";
847
- if (handoffContext.includes("filePlan:")) {
848
- return this.parseFilePlanFromText(handoffContext);
849
- }
850
- return void 0;
851
- }
852
- /**
853
- * Parse file plan from text (simplified YAML parsing)
854
- */
855
- parseFilePlanFromText(text) {
856
- const filePlan = [];
857
- const filePlanMatch = text.match(/filePlan:\s*\n([\s\S]*?)(?=\n[a-z_]+:|$)/);
858
- if (!filePlanMatch) {
859
- return void 0;
860
- }
861
- const filePlanContent = filePlanMatch[1];
862
- const lines = filePlanContent.split("\n");
863
- let currentGroup = null;
864
- let inFiles = false;
865
- let currentFile = {};
866
- for (const line of lines) {
867
- const trimmed = line.trim();
868
- if (!trimmed || trimmed.startsWith("#")) continue;
869
- if (trimmed.startsWith("- group:")) {
870
- if (currentGroup) {
871
- if (currentFile.path) {
872
- currentGroup.files.push({
873
- path: currentFile.path,
874
- description: currentFile.description || ""
875
- });
876
- currentFile = {};
877
- }
878
- filePlan.push(currentGroup);
879
- }
880
- currentGroup = {
881
- group: trimmed.split(":")[1].trim(),
882
- subPhase: 0,
883
- files: []
884
- };
885
- inFiles = false;
886
- continue;
887
- }
888
- if (!currentGroup) continue;
889
- if (trimmed.startsWith("subPhase:")) {
890
- currentGroup.subPhase = parseInt(trimmed.split(":")[1].trim(), 10) || 0;
891
- continue;
892
- }
893
- if (trimmed === "files:") {
894
- inFiles = true;
895
- continue;
896
- }
897
- if (inFiles) {
898
- if (trimmed.startsWith("- path:")) {
899
- if (currentFile.path) {
900
- currentGroup.files.push({
901
- path: currentFile.path,
902
- description: currentFile.description || ""
903
- });
904
- }
905
- currentFile = {
906
- path: trimmed.split(":").slice(1).join(":").trim().replace(/^["']|["']$/g, "")
907
- };
908
- continue;
909
- }
910
- if (trimmed.startsWith("description:")) {
911
- currentFile.description = trimmed.split(":").slice(1).join(":").trim().replace(/^["']|["']$/g, "");
912
- continue;
913
- }
914
- }
915
- }
916
- if (currentFile.path && currentGroup) {
917
- currentGroup.files.push({
918
- path: currentFile.path,
919
- description: currentFile.description || ""
920
- });
921
- }
922
- if (currentGroup) {
923
- filePlan.push(currentGroup);
924
- }
925
- return filePlan.length > 0 ? filePlan : void 0;
926
- }
927
- // ==========================================================================
928
- // Private: Agent Planning
929
- // ==========================================================================
930
- /**
931
- * Plan agent sequence with parallel execution support
932
- *
933
- * Returns execution stages where agents within a stage can run in parallel,
934
- * but stages execute sequentially (stage N+1 waits for stage N to complete).
935
- *
936
- * Uses task classification for intelligent agent selection:
937
- * - Analysis tasks: Architect only
938
- * - Documentation tasks: Architect only
939
- * - Bug fixes: Security + Builder
940
- * - Refactoring: Architect + Builder (with auto-ripple)
941
- * - Features: Full team as needed
942
- */
943
- planAgentSequence(task, agents) {
944
- const symbols = extractSymbols(task);
945
- const taskLower = task.toLowerCase();
946
- const classification = classifyTask(task);
947
- const plan = [];
948
- const securityEscalated = shouldEscalateSecurity(task);
949
- if (classification.type === "analysis") {
950
- if (agents["architect"]) {
951
- plan.push({
952
- agent: "architect",
953
- subtask: `Analyze and recommend: ${task}`,
954
- required: true,
955
- stage: 0,
956
- dependsOn: [],
957
- model: "opus"
958
- });
959
- }
960
- return plan;
961
- }
962
- if (classification.type === "documentation") {
963
- if (agents["architect"]) {
964
- plan.push({
965
- agent: "architect",
966
- subtask: `Document: ${task}`,
967
- required: true,
968
- stage: 0,
969
- dependsOn: [],
970
- model: "sonnet"
971
- // Sonnet is sufficient for documentation
972
- });
973
- }
974
- return plan;
975
- }
976
- const hasDesign = taskLower.includes("design") || taskLower.includes("architect") || taskLower.includes("plan") || taskLower.includes("spec");
977
- const hasSecurity = securityEscalated || taskLower.includes("auth") || taskLower.includes("security") || taskLower.includes("gate") || symbols.some((s) => s.startsWith("^"));
978
- if (hasDesign && agents["architect"]) {
979
- plan.push({
980
- agent: "architect",
981
- subtask: `Design and specify: ${task}`,
982
- required: true,
983
- stage: 0,
984
- dependsOn: [],
985
- model: "opus"
986
- });
987
- }
988
- if (hasSecurity && agents["security"]) {
989
- plan.push({
990
- agent: "security",
991
- subtask: `Review security aspects of: ${task}`,
992
- // Security is REQUIRED when escalated, optional otherwise
993
- required: securityEscalated,
994
- stage: 0,
995
- // Can run parallel with architect
996
- dependsOn: [],
997
- // Use opus for escalated security reviews
998
- model: securityEscalated ? "opus" : "opus"
999
- });
1000
- }
1001
- const hasImplementation = taskLower.includes("build") || taskLower.includes("implement") || taskLower.includes("create") || taskLower.includes("add") || taskLower.includes("fix");
1002
- if (hasImplementation && agents["builder"]) {
1003
- const dependsOn = hasDesign && agents["architect"] ? ["architect"] : [];
1004
- plan.push({
1005
- agent: "builder",
1006
- subtask: `Implement: ${task}`,
1007
- required: true,
1008
- stage: dependsOn.length > 0 ? 1 : 0,
1009
- dependsOn,
1010
- model: "haiku"
1011
- });
1012
- }
1013
- const hasReview = taskLower.includes("review") || taskLower.includes("check");
1014
- const hasTest = taskLower.includes("test") || taskLower.includes("verify") || taskLower.includes("validate");
1015
- const builderInPlan = plan.some((p) => p.agent === "builder");
1016
- const reviewStage = builderInPlan ? 2 : hasDesign ? 1 : 0;
1017
- if (hasReview && agents["reviewer"]) {
1018
- plan.push({
1019
- agent: "reviewer",
1020
- subtask: `Review: ${task}`,
1021
- required: false,
1022
- stage: reviewStage,
1023
- dependsOn: builderInPlan ? ["builder"] : [],
1024
- model: "sonnet"
1025
- });
1026
- }
1027
- if (hasTest && agents["tester"]) {
1028
- plan.push({
1029
- agent: "tester",
1030
- subtask: `Test and validate: ${task}`,
1031
- required: false,
1032
- stage: reviewStage,
1033
- // Can run parallel with reviewer
1034
- dependsOn: builderInPlan ? ["builder"] : [],
1035
- model: "haiku"
1036
- });
1037
- }
1038
- if (plan.length === 0) {
1039
- const recommendedAgents = classification.recommendedAgents;
1040
- if (recommendedAgents.includes("architect") && agents["architect"]) {
1041
- plan.push({
1042
- agent: "architect",
1043
- subtask: `Design: ${task}`,
1044
- required: true,
1045
- stage: 0,
1046
- dependsOn: [],
1047
- model: getRecommendedModel("architect", classification)
1048
- });
1049
- }
1050
- if ((recommendedAgents.includes("security") || securityEscalated) && agents["security"]) {
1051
- plan.push({
1052
- agent: "security",
1053
- subtask: `Security review: ${task}`,
1054
- required: securityEscalated,
1055
- stage: 0,
1056
- dependsOn: [],
1057
- model: "opus"
1058
- });
1059
- }
1060
- if (recommendedAgents.includes("builder") && agents["builder"]) {
1061
- const hasPreviousStage = plan.length > 0;
1062
- plan.push({
1063
- agent: "builder",
1064
- subtask: `Implement: ${task}`,
1065
- required: true,
1066
- stage: hasPreviousStage ? 1 : 0,
1067
- dependsOn: plan.filter((p) => p.stage === 0).map((p) => p.agent),
1068
- model: getRecommendedModel("builder", classification)
1069
- });
1070
- }
1071
- if (recommendedAgents.includes("tester") && agents["tester"]) {
1072
- const builderStage = plan.find((p) => p.agent === "builder")?.stage ?? 0;
1073
- plan.push({
1074
- agent: "tester",
1075
- subtask: `Test: ${task}`,
1076
- required: false,
1077
- stage: builderStage + 1,
1078
- dependsOn: agents["builder"] ? ["builder"] : [],
1079
- model: getRecommendedModel("tester", classification)
1080
- });
1081
- }
1082
- }
1083
- return plan.sort((a, b) => a.stage - b.stage);
1084
- }
1085
- /**
1086
- * Group plan steps by stage for parallel execution
1087
- */
1088
- groupByStage(plan) {
1089
- const stages = /* @__PURE__ */ new Map();
1090
- for (const step of plan) {
1091
- const existing = stages.get(step.stage) || [];
1092
- existing.push({ agent: step.agent, subtask: step.subtask, required: step.required, dependsOn: step.dependsOn });
1093
- stages.set(step.stage, existing);
1094
- }
1095
- return stages;
1096
- }
1097
- // ==========================================================================
1098
- // Private: Utilities
1099
- // ==========================================================================
1100
- generateOrchestrationId() {
1101
- const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1102
- const random = Math.random().toString(36).substring(2, 8);
1103
- return `orch-${date}-${random}`;
1104
- }
1105
- // ==========================================================================
1106
- // Private: Parallel Builder Planning
1107
- // ==========================================================================
1108
- /**
1109
- * Plan parallel builder stages from architect's file plan
1110
- */
1111
- planBuilderStages(filePlan) {
1112
- if (!filePlan || filePlan.length === 0) {
1113
- return {
1114
- hasFilePlan: false,
1115
- stages: [{
1116
- subPhase: 0,
1117
- builders: [{
1118
- agent: "builder",
1119
- group: "all",
1120
- files: [],
1121
- availableFiles: []
1122
- }]
1123
- }],
1124
- totalFiles: 0,
1125
- totalBuilders: 1
1126
- };
1127
- }
1128
- const subPhases = /* @__PURE__ */ new Map();
1129
- for (const group of filePlan) {
1130
- const existing = subPhases.get(group.subPhase) || [];
1131
- existing.push(group);
1132
- subPhases.set(group.subPhase, existing);
1133
- }
1134
- const stages = [];
1135
- const sortedPhases = [...subPhases.keys()].sort((a, b) => a - b);
1136
- let availableFiles = [];
1137
- let totalBuilders = 0;
1138
- let totalFiles = 0;
1139
- for (const phase of sortedPhases) {
1140
- const groups = subPhases.get(phase);
1141
- const builders = [];
1142
- for (let i = 0; i < groups.length; i++) {
1143
- const group = groups[i];
1144
- totalFiles += group.files.length;
1145
- totalBuilders++;
1146
- builders.push({
1147
- agent: `builder-${phase}-${i}`,
1148
- group: group.group,
1149
- files: group.files,
1150
- availableFiles: [...availableFiles]
1151
- });
1152
- }
1153
- stages.push({
1154
- subPhase: phase,
1155
- builders
1156
- });
1157
- for (const group of groups) {
1158
- for (const file of group.files) {
1159
- availableFiles.push(file.path);
1160
- }
1161
- }
1162
- }
1163
- return {
1164
- hasFilePlan: true,
1165
- stages,
1166
- totalFiles,
1167
- totalBuilders
1168
- };
1169
- }
1170
- /**
1171
- * Build narrowed prompt for a parallel builder
1172
- */
1173
- buildParallelBuilderPrompt(assignedFiles, availableFiles, architectContext, groupName) {
1174
- const parts = [];
1175
- parts.push(`You are a BUILDER agent responsible for implementing the **${groupName}** group.`);
1176
- parts.push("");
1177
- parts.push("## Your Assignment");
1178
- parts.push("");
1179
- parts.push("### Files to Create:");
1180
- for (const file of assignedFiles) {
1181
- parts.push(`- \`${file.path}\`: ${file.description}`);
1182
- }
1183
- parts.push("");
1184
- if (availableFiles.length > 0) {
1185
- parts.push("### Available Files (already created):");
1186
- parts.push("These files exist and you can import from them:");
1187
- for (const file of availableFiles) {
1188
- parts.push(`- \`${file}\``);
1189
- }
1190
- parts.push("");
1191
- }
1192
- if (architectContext) {
1193
- parts.push("### Context from Architect:");
1194
- parts.push(architectContext);
1195
- parts.push("");
1196
- }
1197
- parts.push("### Instructions:");
1198
- parts.push("1. Create ONLY the files assigned to you");
1199
- parts.push("2. You can import from available files (already created)");
1200
- parts.push("3. Follow existing patterns in the codebase");
1201
- parts.push("4. Use the Paradigm logger (not console.log)");
1202
- parts.push("5. End with the standard Agent Relay block");
1203
- return parts.join("\n");
1204
- }
1205
- /**
1206
- * Execute parallel builder stages
1207
- * Sub-phases execute sequentially, builders within each sub-phase execute in parallel
1208
- */
1209
- async runParallelBuilders(builderPlan, architectContext, options) {
1210
- const results = [];
1211
- let totalTokens = { input: 0, output: 0, total: 0 };
1212
- let totalCost = 0;
1213
- let success = true;
1214
- for (const stage of builderPlan.stages) {
1215
- if (options.checkpoints?.beforeAgentSpawn && options.onCheckpoint) {
1216
- const builderNames = stage.builders.map((b) => b.group).join(", ");
1217
- const approved = await options.onCheckpoint(
1218
- `Builder Sub-phase ${stage.subPhase}: ${builderNames}${stage.builders.length > 1 ? " (parallel)" : ""}`
1219
- );
1220
- if (!approved) {
1221
- success = false;
1222
- break;
1223
- }
1224
- }
1225
- const spawnPromises = stage.builders.map(async (builder) => {
1226
- const taskPrompt = this.buildParallelBuilderPrompt(
1227
- builder.files,
1228
- builder.availableFiles,
1229
- architectContext,
1230
- builder.group
1231
- );
1232
- const spawnerOptions = {
1233
- model: "haiku",
1234
- // Builders always use haiku
1235
- workingDirectory: options.workingDirectory || this.rootDir,
1236
- mcpServerPath: options.mcpServerPath,
1237
- budget: options.budget,
1238
- onMessage: options.onMessage ? (msg) => options.onMessage(builder.agent, msg) : void 0,
1239
- onCheckpoint: options.onCheckpoint
1240
- };
1241
- if (options.onAgentStart) {
1242
- options.onAgentStart(builder.agent, `Implement ${builder.group}`, "haiku");
1243
- }
1244
- const result = await this.spawner.spawn("builder", taskPrompt, spawnerOptions);
1245
- if (options.onAgentComplete) {
1246
- options.onAgentComplete(builder.agent, result, "haiku");
1247
- }
1248
- return { builder, result };
1249
- });
1250
- const stageResults = await Promise.all(spawnPromises);
1251
- for (const { result } of stageResults) {
1252
- results.push(result);
1253
- if (result.relay) {
1254
- totalTokens.input += result.relay.metrics.tokens_used.input;
1255
- totalTokens.output += result.relay.metrics.tokens_used.output;
1256
- totalTokens.total += result.relay.metrics.tokens_used.total;
1257
- totalCost += calculateCost(result.relay.metrics.tokens_used, "haiku");
1258
- }
1259
- if (!result.success) {
1260
- success = false;
1261
- }
1262
- }
1263
- if (!success) break;
1264
- if (options.checkpoints?.afterAgentComplete && options.onCheckpoint) {
1265
- const approved = await options.onCheckpoint(
1266
- `Sub-phase ${stage.subPhase} complete. Continue to next sub-phase?`
1267
- );
1268
- if (!approved) {
1269
- break;
1270
- }
1271
- }
1272
- }
1273
- return { success, results, totalTokens, totalCost };
1274
- }
1275
- };
1276
-
1277
- // src/core/background-orchestrator.ts
1278
- import * as fs2 from "fs";
1279
- import * as path2 from "path";
1280
- import * as yaml from "js-yaml";
1281
- import { spawn } from "child_process";
1282
- var BackgroundOrchestrator = class {
1283
- rootDir;
1284
- orchestrationsDir;
1285
- constructor(rootDir) {
1286
- this.rootDir = rootDir;
1287
- this.orchestrationsDir = path2.join(rootDir, ".paradigm", "orchestrations");
1288
- this.ensureOrchestrationDir();
1289
- }
1290
- /**
1291
- * Start an orchestration in background mode
1292
- */
1293
- async startBackground(task, options = {}) {
1294
- const id = this.generateId();
1295
- const outputFile = path2.join(this.orchestrationsDir, `${id}.output`);
1296
- const logFile = path2.join(this.orchestrationsDir, `${id}.log`);
1297
- const orchestration = {
1298
- id,
1299
- task,
1300
- status: "pending",
1301
- mode: options.mode || "faceted",
1302
- created: (/* @__PURE__ */ new Date()).toISOString(),
1303
- outputFile,
1304
- logFile,
1305
- artifacts: []
1306
- };
1307
- this.saveOrchestration(orchestration);
1308
- this.spawnOrchestration(id, task, options);
1309
- return orchestration;
1310
- }
1311
- /**
1312
- * Get orchestration by ID
1313
- */
1314
- getOrchestration(id) {
1315
- const metaFile = path2.join(this.orchestrationsDir, `${id}.yaml`);
1316
- if (!fs2.existsSync(metaFile)) {
1317
- return null;
1318
- }
1319
- try {
1320
- const content = fs2.readFileSync(metaFile, "utf-8");
1321
- return yaml.load(content);
1322
- } catch {
1323
- return null;
1324
- }
1325
- }
1326
- /**
1327
- * List all orchestrations
1328
- */
1329
- listOrchestrations(options = {}) {
1330
- const files = fs2.readdirSync(this.orchestrationsDir).filter((f) => f.endsWith(".yaml") && !f.includes("output") && !f.includes("log")).sort().reverse();
1331
- const orchestrations = [];
1332
- for (const file of files) {
1333
- if (options.limit && orchestrations.length >= options.limit) break;
1334
- const metaFile = path2.join(this.orchestrationsDir, file);
1335
- try {
1336
- const content = fs2.readFileSync(metaFile, "utf-8");
1337
- const orch = yaml.load(content);
1338
- if (options.status) {
1339
- const statuses = Array.isArray(options.status) ? options.status : [options.status];
1340
- if (!statuses.includes(orch.status)) continue;
1341
- }
1342
- orchestrations.push(orch);
1343
- } catch {
1344
- }
1345
- }
1346
- return orchestrations;
1347
- }
1348
- /**
1349
- * Get running orchestrations
1350
- */
1351
- getRunning() {
1352
- return this.listOrchestrations({ status: "running" });
1353
- }
1354
- /**
1355
- * Get orchestration output (streaming)
1356
- */
1357
- getOutput(id, options = {}) {
1358
- const orch = this.getOrchestration(id);
1359
- if (!orch) return "";
1360
- if (!fs2.existsSync(orch.outputFile)) {
1361
- return "";
1362
- }
1363
- const content = fs2.readFileSync(orch.outputFile, "utf-8");
1364
- if (options.lines) {
1365
- const lines = content.split("\n");
1366
- return lines.slice(-options.lines).join("\n");
1367
- }
1368
- return content;
1369
- }
1370
- /**
1371
- * Accept orchestration changes
1372
- */
1373
- async accept(id, _options = {}) {
1374
- const orch = this.getOrchestration(id);
1375
- if (!orch) return false;
1376
- if (orch.status !== "completed") {
1377
- throw new Error(`Cannot accept orchestration in '${orch.status}' status`);
1378
- }
1379
- orch.status = "accepted";
1380
- this.saveOrchestration(orch);
1381
- return true;
1382
- }
1383
- /**
1384
- * Reject orchestration changes
1385
- */
1386
- async reject(id, options = {}) {
1387
- const orch = this.getOrchestration(id);
1388
- if (!orch) return false;
1389
- if (orch.status !== "completed") {
1390
- throw new Error(`Cannot reject orchestration in '${orch.status}' status`);
1391
- }
1392
- orch.status = "rejected";
1393
- orch.error = options.reason;
1394
- this.saveOrchestration(orch);
1395
- if (options.cleanup && orch.artifacts.length > 0) {
1396
- for (const artifact of orch.artifacts) {
1397
- if (artifact.action === "created") {
1398
- const filePath = path2.join(this.rootDir, artifact.path);
1399
- if (fs2.existsSync(filePath)) {
1400
- fs2.unlinkSync(filePath);
1401
- }
1402
- }
1403
- }
1404
- }
1405
- return true;
1406
- }
1407
- /**
1408
- * Get diff of orchestration changes
1409
- */
1410
- async getDiff(id) {
1411
- const orch = this.getOrchestration(id);
1412
- if (!orch) return "";
1413
- if (orch.artifacts.length === 0) {
1414
- return "No file changes in this orchestration.";
1415
- }
1416
- const diffParts = [];
1417
- diffParts.push(`Orchestration: ${id}`);
1418
- diffParts.push(`Task: ${orch.task}`);
1419
- diffParts.push(`Status: ${orch.status}`);
1420
- diffParts.push("");
1421
- diffParts.push("Files:");
1422
- for (const artifact of orch.artifacts) {
1423
- const icon = artifact.action === "created" ? "+" : artifact.action === "modified" ? "~" : "-";
1424
- diffParts.push(` ${icon} ${artifact.path}`);
1425
- }
1426
- return diffParts.join("\n");
1427
- }
1428
- /**
1429
- * Mark orchestration as complete
1430
- */
1431
- markComplete(id, result) {
1432
- const orch = this.getOrchestration(id);
1433
- if (!orch) return;
1434
- orch.status = result.success ? "completed" : "failed";
1435
- orch.completed = (/* @__PURE__ */ new Date()).toISOString();
1436
- orch.result = result;
1437
- orch.parallelBuilderStats = result.parallelBuilderStats;
1438
- for (const agentResult of result.agentResults) {
1439
- if (agentResult.relay?.outputs.artifacts) {
1440
- for (const artifact of agentResult.relay.outputs.artifacts) {
1441
- orch.artifacts.push(artifact);
1442
- }
1443
- }
1444
- }
1445
- this.saveOrchestration(orch);
1446
- }
1447
- /**
1448
- * Send completion notification
1449
- */
1450
- async notify(id, methods = ["bell"]) {
1451
- const orch = this.getOrchestration(id);
1452
- if (!orch) return;
1453
- for (const method of methods) {
1454
- switch (method) {
1455
- case "bell":
1456
- process.stdout.write("\x07");
1457
- break;
1458
- case "desktop":
1459
- try {
1460
- if (process.platform === "darwin") {
1461
- spawn("osascript", [
1462
- "-e",
1463
- `display notification "Orchestration ${orch.status}: ${orch.task.slice(0, 50)}" with title "Paradigm"`
1464
- ]);
1465
- } else {
1466
- spawn("notify-send", [
1467
- "Paradigm",
1468
- `Orchestration ${orch.status}: ${orch.task.slice(0, 50)}`
1469
- ]);
1470
- }
1471
- } catch {
1472
- }
1473
- break;
1474
- case "file":
1475
- const statusFile = path2.join(this.orchestrationsDir, `${id}.status`);
1476
- fs2.writeFileSync(statusFile, JSON.stringify({
1477
- id,
1478
- status: orch.status,
1479
- completed: orch.completed,
1480
- task: orch.task
1481
- }));
1482
- break;
1483
- case "webhook":
1484
- break;
1485
- }
1486
- }
1487
- }
1488
- // ==========================================================================
1489
- // Private Methods
1490
- // ==========================================================================
1491
- ensureOrchestrationDir() {
1492
- if (!fs2.existsSync(this.orchestrationsDir)) {
1493
- fs2.mkdirSync(this.orchestrationsDir, { recursive: true });
1494
- }
1495
- }
1496
- generateId() {
1497
- const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1498
- const time = Date.now().toString(36);
1499
- const random = Math.random().toString(36).substring(2, 6);
1500
- return `orch-${date}-${time}-${random}`;
1501
- }
1502
- saveOrchestration(orch) {
1503
- const metaFile = path2.join(this.orchestrationsDir, `${orch.id}.yaml`);
1504
- fs2.writeFileSync(metaFile, yaml.dump(orch));
1505
- }
1506
- spawnOrchestration(id, task, options) {
1507
- const orch = this.getOrchestration(id);
1508
- if (orch) {
1509
- orch.status = "running";
1510
- orch.started = (/* @__PURE__ */ new Date()).toISOString();
1511
- this.saveOrchestration(orch);
1512
- }
1513
- (async () => {
1514
- try {
1515
- const orchestrator = new Orchestrator(this.rootDir);
1516
- await orchestrator.initialize();
1517
- const outputStream = fs2.createWriteStream(orch.outputFile, { flags: "a" });
1518
- const result = await orchestrator.orchestrate(task, {
1519
- ...options,
1520
- onMessage: (source, message) => {
1521
- if (message.type === "text") {
1522
- outputStream.write(`[${source}] ${message.content}
1523
- `);
1524
- }
1525
- options.onMessage?.(source, message);
1526
- },
1527
- onAgentStart: (agent, agentTask, model) => {
1528
- outputStream.write(`
1529
- \u25B6 ${agent}: ${agentTask}
1530
- `);
1531
- options.onAgentStart?.(agent, agentTask, model);
1532
- },
1533
- onAgentComplete: (agent, agentResult, model) => {
1534
- const status = agentResult.success ? "\u2713" : "\u2717";
1535
- outputStream.write(`${status} ${agent} completed
1536
- `);
1537
- options.onAgentComplete?.(agent, agentResult, model);
1538
- }
1539
- });
1540
- outputStream.end();
1541
- this.markComplete(id, result);
1542
- if (options.notify) {
1543
- await this.notify(id, options.notifyMethods || ["bell"]);
1544
- }
1545
- } catch (error) {
1546
- const failedOrch = this.getOrchestration(id);
1547
- if (failedOrch) {
1548
- failedOrch.status = "failed";
1549
- failedOrch.error = error instanceof Error ? error.message : String(error);
1550
- failedOrch.completed = (/* @__PURE__ */ new Date()).toISOString();
1551
- this.saveOrchestration(failedOrch);
1552
- }
1553
- }
1554
- })();
1555
- }
1556
- };
1557
-
1558
- export {
1559
- Orchestrator,
1560
- BackgroundOrchestrator
1561
- };