@a-company/paradigm 5.10.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 (409) 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 -20484
  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/courses/para-701.json +807 -0
  195. package/dist/university-content/plsat/.purpose +3 -2
  196. package/dist/university-ui/assets/{index-BjewBB6s.js → index-CGFJczb1.js} +2 -2
  197. package/dist/university-ui/assets/{index-BjewBB6s.js.map → index-CGFJczb1.js.map} +1 -1
  198. package/dist/university-ui/index.html +1 -1
  199. package/dist/upgrade-B4IOLZYK.js +53 -0
  200. package/dist/validate-C6SMKGYD.js +9 -0
  201. package/dist/validate-LSCDOLBO.js +13 -0
  202. package/dist/validate-VZXTJHGO.js +6 -0
  203. package/dist/watch-LRM5XD46.js +8 -0
  204. package/dist/watch-PZCCUP6K.js +9 -0
  205. package/dist/wisdom-XZ3QKPNP.js +7 -0
  206. package/dist/work-log-loader-DL5GZ2BQ.js +2 -0
  207. package/dist/workspace-2ODL5WLY.js +2 -0
  208. package/package.json +1 -1
  209. package/platform-ui/dist/assets/AmbientSection-DqQ2mfCO.js +1 -0
  210. package/platform-ui/dist/assets/{CanvasSection-DwPTRdIN.js → CanvasSection-DLW0s-Bu.js} +1 -1
  211. package/platform-ui/dist/assets/{DocsSection-BJc_ws4I.js → DocsSection-BQ9Hi51g.js} +1 -1
  212. package/platform-ui/dist/assets/{GitSection-DhqBo1xc.js → GitSection-QQeUX6o3.js} +1 -1
  213. package/platform-ui/dist/assets/{GraphSection-D9fhVnZ0.js → GraphSection-0c9C-w7K.js} +2 -2
  214. package/platform-ui/dist/assets/{GraphSection-BlgXTl53.css → GraphSection-Bbs2a8sC.css} +1 -1
  215. package/platform-ui/dist/assets/LoreSection--t56kCj2.js +1 -0
  216. package/platform-ui/dist/assets/LoreSection-qnmm3o4y.css +1 -0
  217. package/platform-ui/dist/assets/SentinelSection-C4OoME9U.js +1 -0
  218. package/platform-ui/dist/assets/{SymphonySection-BRoBaUSS.js → SymphonySection-B-rvsLxq.js} +1 -1
  219. package/platform-ui/dist/assets/TeamSection-CBFmNEEo.js +1 -0
  220. package/platform-ui/dist/assets/index-Bxp0TVaf.css +1 -0
  221. package/platform-ui/dist/assets/index-DPpOdAtC.js +57 -0
  222. package/platform-ui/dist/index.html +2 -2
  223. package/dist/accept-orchestration-UQLM7PTQ.js +0 -189
  224. package/dist/add-FZRKEGH4.js +0 -81
  225. package/dist/agent-WERIO2XV.js +0 -523
  226. package/dist/agent-loader-TFIANSF4.js +0 -44
  227. package/dist/agent-state-S5DAWPTF.js +0 -24
  228. package/dist/agents-suggest-DNSYJ6IA.js +0 -83
  229. package/dist/aggregate-H57K7PNV.js +0 -88
  230. package/dist/assess-4WVXZLZQ.js +0 -68
  231. package/dist/auto-QFS5NHQU.js +0 -504
  232. package/dist/beacon-KXZXYQHX.js +0 -251
  233. package/dist/calibration-V46G7JTY.js +0 -135
  234. package/dist/check-OWAIWV23.js +0 -175
  235. package/dist/chunk-2IO7JAG2.js +0 -148
  236. package/dist/chunk-2T6BTYBN.js +0 -712
  237. package/dist/chunk-36TKPM5Z.js +0 -400
  238. package/dist/chunk-45MUDW6E.js +0 -804
  239. package/dist/chunk-4BLYIB7J.js +0 -5701
  240. package/dist/chunk-4L3UTYQX.js +0 -677
  241. package/dist/chunk-4NCFWYGG.js +0 -110
  242. package/dist/chunk-54LTTQBH.js +0 -138
  243. package/dist/chunk-5EWAQHFY.js +0 -269
  244. package/dist/chunk-5JGJACDU.js +0 -37
  245. package/dist/chunk-5OUOLN6M.js +0 -659
  246. package/dist/chunk-5VKJBNJL.js +0 -444
  247. package/dist/chunk-6N3JTACN.js +0 -2260
  248. package/dist/chunk-6QC3YGB6.js +0 -114
  249. package/dist/chunk-7N7GSU6K.js +0 -34
  250. package/dist/chunk-ABVQGRF7.js +0 -268
  251. package/dist/chunk-CL7JSK52.js +0 -129
  252. package/dist/chunk-CSD7IHSN.js +0 -152
  253. package/dist/chunk-EDOAWN7J.js +0 -717
  254. package/dist/chunk-EKGMAM62.js +0 -525
  255. package/dist/chunk-EZ3GOCYC.js +0 -132
  256. package/dist/chunk-F3BCHPYT.js +0 -143
  257. package/dist/chunk-FKJUBQU3.js +0 -3081
  258. package/dist/chunk-GT5QGC2H.js +0 -253
  259. package/dist/chunk-GZDFVP2N.js +0 -540
  260. package/dist/chunk-IRKUEJVW.js +0 -405
  261. package/dist/chunk-J2JEQRT3.js +0 -164
  262. package/dist/chunk-JASGXLK3.js +0 -679
  263. package/dist/chunk-KVDYJLTC.js +0 -121
  264. package/dist/chunk-L27I3CPZ.js +0 -357
  265. package/dist/chunk-LHLIAYQ3.js +0 -185
  266. package/dist/chunk-MCMOGQMU.js +0 -145
  267. package/dist/chunk-NQKQG45G.js +0 -688
  268. package/dist/chunk-PBHIFAL4.js +0 -259
  269. package/dist/chunk-PDX44BCA.js +0 -11
  270. package/dist/chunk-PMXRGPRQ.js +0 -305
  271. package/dist/chunk-RAB5IKPR.js +0 -487
  272. package/dist/chunk-RJE5G7WO.js +0 -590
  273. package/dist/chunk-RTHA3XRE.js +0 -880
  274. package/dist/chunk-S2HO5MLR.js +0 -621
  275. package/dist/chunk-S3ORKP3V.js +0 -716
  276. package/dist/chunk-TAIJOFOE.js +0 -124
  277. package/dist/chunk-TXESEO7Y.js +0 -245
  278. package/dist/chunk-UPLDI7CN.js +0 -1334
  279. package/dist/chunk-VL67H5IC.js +0 -506
  280. package/dist/chunk-VPPK3SY4.js +0 -1136
  281. package/dist/chunk-YMDLDELF.js +0 -314
  282. package/dist/chunk-YO6DVTL7.js +0 -99
  283. package/dist/chunk-YRZ5RPEB.js +0 -1561
  284. package/dist/chunk-ZDHLG5VP.js +0 -5676
  285. package/dist/chunk-ZGUAAVMA.js +0 -756
  286. package/dist/chunk-ZSYVKSY6.js +0 -2602
  287. package/dist/claude-FRRWJSTJ.js +0 -362
  288. package/dist/claude-cli-XJLK2X4L.js +0 -276
  289. package/dist/claude-code-HTBA4XRB.js +0 -126
  290. package/dist/claude-code-teams-T4SP24MD.js +0 -199
  291. package/dist/commands-5N4ILTPH.js +0 -5859
  292. package/dist/conductor-CQVGTEQN.js +0 -161
  293. package/dist/config-schema-EA4XALGG.js +0 -154
  294. package/dist/constellation-A26CCGQS.js +0 -225
  295. package/dist/context-audit-RLO3ETRP.js +0 -682
  296. package/dist/cost-BGM32XJU.js +0 -93
  297. package/dist/cost-VI46A4XL.js +0 -174
  298. package/dist/cursor-cli-JVEZGHWQ.js +0 -269
  299. package/dist/cursorrules-HLIKJJZT.js +0 -84
  300. package/dist/decision-loader-WWCLIQPJ.js +0 -20
  301. package/dist/delete-KBRPQLPC.js +0 -56
  302. package/dist/diff-D4X53HAC.js +0 -126
  303. package/dist/discipline-FA4OZXIS.js +0 -24
  304. package/dist/dist-34NA5RS5.js +0 -74
  305. package/dist/dist-5QE2BB2B-5S3T6Y3T.js +0 -6919
  306. package/dist/dist-77JDTVAY.js +0 -62
  307. package/dist/dist-OGTSAZ55.js +0 -1358
  308. package/dist/dist-QK4SQAK7.js +0 -64
  309. package/dist/dist-TA6LSC2Q.js +0 -20
  310. package/dist/docs-PBZB7LYP.js +0 -89
  311. package/dist/docs-QIYKO3BR.js +0 -155
  312. package/dist/doctor-ULBOHEIC.js +0 -11
  313. package/dist/drift-R5NRKFHI.js +0 -251
  314. package/dist/echo-O2LY7CC2.js +0 -248
  315. package/dist/edit-R2HNLMOG.js +0 -63
  316. package/dist/event-25OJKDCE.js +0 -31
  317. package/dist/export-IWVL7XLF.js +0 -38
  318. package/dist/flow-CRRVV3O3.js +0 -185
  319. package/dist/global-3NG5JXUB.js +0 -136
  320. package/dist/graduate-USAWGBJM.js +0 -160
  321. package/dist/graph-VHUMAAS6.js +0 -12
  322. package/dist/graph-server-YL22VBBN.js +0 -116
  323. package/dist/habits-OL5NGPXO.js +0 -1405
  324. package/dist/history-WOWC573W.js +0 -277
  325. package/dist/hooks-HFWSCGPV.js +0 -12
  326. package/dist/integrity-IHO4FZTS.js +0 -194
  327. package/dist/integrity-checker-PSKJA5SB.js +0 -12
  328. package/dist/journal-loader-5EYSBFFY.js +0 -18
  329. package/dist/lint-K6CJGGPH.js +0 -456
  330. package/dist/list-4YK7QKFF.js +0 -57
  331. package/dist/list-ENR7Q4CR.js +0 -56
  332. package/dist/lore-loader-7NO6N6FT.js +0 -26
  333. package/dist/lore-server-UNJY5KC3.js +0 -118
  334. package/dist/manual-G6FISID5.js +0 -204
  335. package/dist/migrate-LS45DNEV.js +0 -889
  336. package/dist/migrate-assessments-RGH4O6IX.js +0 -97
  337. package/dist/model-discovery-D2H3VBGC.js +0 -8
  338. package/dist/nomination-engine-RV5CNO5B.js +0 -42
  339. package/dist/notebook-YWIYGEHV.js +0 -155
  340. package/dist/orchestrate-JLILBBJE.js +0 -324
  341. package/dist/peers-DEOUIZM6.js +0 -82
  342. package/dist/persona-UHAHIVST.js +0 -390
  343. package/dist/pipeline-L4HCSBGN.js +0 -263
  344. package/dist/platform-server-H5YO3DQD.js +0 -1475
  345. package/dist/plugin-update-checker-KRRSGXMV.js +0 -12
  346. package/dist/portal-check-NPYGII2D.js +0 -42
  347. package/dist/portal-compliance-J7DGAPFX.js +0 -18
  348. package/dist/probe-MHL5HQZ2.js +0 -167
  349. package/dist/promote-F6ZYZZAL.js +0 -182
  350. package/dist/providers-GK7PB2OL.js +0 -104
  351. package/dist/quiz-M66SC7F7.js +0 -99
  352. package/dist/record-RA4WR2BO.js +0 -49
  353. package/dist/reindex-5LTD53ZC.js +0 -16
  354. package/dist/remember-HBWJ655S.js +0 -77
  355. package/dist/retag-3OLCVDEQ.js +0 -62
  356. package/dist/review-27ATYTD2.js +0 -33
  357. package/dist/review-57QMURZV.js +0 -334
  358. package/dist/ripple-JPBXP5I3.js +0 -215
  359. package/dist/sentinel-4XIG4STA.js +0 -63
  360. package/dist/sentinel-bridge-MDUXTQRL.js +0 -109
  361. package/dist/serve-CAH3PHE7.js +0 -33
  362. package/dist/serve-INL7SNBK.js +0 -36
  363. package/dist/serve-KBSE36PL.js +0 -49
  364. package/dist/server-54SKYFFY.js +0 -1647
  365. package/dist/server-XUOIO7E6.js +0 -338
  366. package/dist/session-tracker-C4BMD5WG.js +0 -13
  367. package/dist/session-work-log-MZ47OAPB.js +0 -20
  368. package/dist/setup-EDS27WUR.js +0 -25
  369. package/dist/setup-KO5AFC4K.js +0 -296
  370. package/dist/shift-D2JOHHBF.js +0 -668
  371. package/dist/show-5PV5KFJE.js +0 -176
  372. package/dist/show-NQKYX6WQ.js +0 -82
  373. package/dist/snapshot-BK4RBPCG.js +0 -62
  374. package/dist/spawn-RCHNXDHE.js +0 -196
  375. package/dist/status-WGIAQODY.js +0 -71
  376. package/dist/summary-NIRABMF5.js +0 -140
  377. package/dist/sweep-QMHNSIY5.js +0 -934
  378. package/dist/switch-6EJPZDIA.js +0 -232
  379. package/dist/symphony-4OCY36AI.js +0 -791
  380. package/dist/symphony-B75X2MME.js +0 -326
  381. package/dist/symphony-loader-UZGON56V.js +0 -90
  382. package/dist/symphony-peers-2ZQYLRNI.js +0 -34
  383. package/dist/symphony-peers-OL7F6M5S.js +0 -121
  384. package/dist/symphony-relay-UJYUXN65.js +0 -710
  385. package/dist/sync-VEHUH4OA.js +0 -11
  386. package/dist/sync-llms-YHCFIE6X.js +0 -166
  387. package/dist/task-loader-LDYWQSLM.js +0 -20
  388. package/dist/team-O5MIIFMA.js +0 -34
  389. package/dist/test-566CP5KC.js +0 -1017
  390. package/dist/thread-N754I4D5.js +0 -274
  391. package/dist/timeline-M3CICQFE.js +0 -112
  392. package/dist/triage-HHYGT3HY.js +0 -671
  393. package/dist/tutorial-KD22SUNO.js +0 -666
  394. package/dist/upgrade-H5PF32BW.js +0 -551
  395. package/dist/validate-CNKEKO6A.js +0 -134
  396. package/dist/validate-MB5ULIHS.js +0 -39
  397. package/dist/validate-QH3LADM6.js +0 -64
  398. package/dist/watch-2TKP5PVL.js +0 -199
  399. package/dist/watch-ZF4ML6CD.js +0 -111
  400. package/dist/wisdom-AATMGNFA.js +0 -319
  401. package/dist/work-log-loader-5L45XNYZ.js +0 -14
  402. package/dist/workspace-6E6OSRNU.js +0 -21
  403. package/platform-ui/dist/assets/AmbientSection-WtHfNedO.js +0 -1
  404. package/platform-ui/dist/assets/LoreSection-C3EixkjW.css +0 -1
  405. package/platform-ui/dist/assets/LoreSection-CwDDHrz9.js +0 -1
  406. package/platform-ui/dist/assets/SentinelSection-Cl7e5oZ6.js +0 -1
  407. package/platform-ui/dist/assets/TeamSection-CqSIMrKz.js +0 -1
  408. package/platform-ui/dist/assets/index-CfpZFjea.css +0 -1
  409. package/platform-ui/dist/assets/index-F0KL9xrN.js +0 -57
@@ -1,1475 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- createInfoRouter,
4
- createLoreRouter,
5
- createSessionsRouter
6
- } from "./chunk-RAB5IKPR.js";
7
- import {
8
- createGraphsRouter,
9
- createSymbolsRouter
10
- } from "./chunk-F3BCHPYT.js";
11
- import "./chunk-PDX44BCA.js";
12
-
13
- // src/platform-server/index.ts
14
- import express from "express";
15
- import * as http from "http";
16
- import * as path5 from "path";
17
- import * as fs5 from "fs";
18
- import { fileURLToPath } from "url";
19
- import chalk from "chalk";
20
-
21
- // src/platform-server/ws/index.ts
22
- import { WebSocketServer, WebSocket } from "ws";
23
-
24
- // src/platform-server/ws/agent.ts
25
- function agentColor(agentId) {
26
- const colors = [
27
- "#58a6ff",
28
- "#3fb950",
29
- "#f85149",
30
- "#d29922",
31
- "#bc8cff",
32
- "#f778ba",
33
- "#79c0ff",
34
- "#56d364"
35
- ];
36
- let hash = 0;
37
- for (let i = 0; i < agentId.length; i++) {
38
- hash = (hash << 5) - hash + agentId.charCodeAt(i) | 0;
39
- }
40
- return colors[Math.abs(hash) % colors.length];
41
- }
42
- var annotationCounter = 0;
43
- var AgentPresenceManager = class {
44
- agents = /* @__PURE__ */ new Map();
45
- staleTimeout = 2 * 60 * 1e3;
46
- // 2 minutes
47
- join(agentId) {
48
- const now = (/* @__PURE__ */ new Date()).toISOString();
49
- const presence = {
50
- agentId,
51
- color: agentColor(agentId),
52
- connectedAt: now,
53
- lastActivity: now
54
- };
55
- this.agents.set(agentId, presence);
56
- return presence;
57
- }
58
- touch(agentId) {
59
- const agent = this.agents.get(agentId);
60
- if (agent) {
61
- agent.lastActivity = (/* @__PURE__ */ new Date()).toISOString();
62
- }
63
- }
64
- leave(agentId) {
65
- this.agents.delete(agentId);
66
- }
67
- getAll() {
68
- return Array.from(this.agents.values());
69
- }
70
- pruneStale() {
71
- const now = Date.now();
72
- const pruned = [];
73
- for (const [id, agent] of this.agents) {
74
- if (now - new Date(agent.lastActivity).getTime() > this.staleTimeout) {
75
- this.agents.delete(id);
76
- pruned.push(id);
77
- }
78
- }
79
- return pruned;
80
- }
81
- };
82
- var UserStateTracker = class {
83
- state = {
84
- section: "overview",
85
- selectedSymbol: null,
86
- theme: "dark",
87
- lastInteraction: Date.now()
88
- };
89
- highlights = [];
90
- annotations = [];
91
- muted = false;
92
- updateSection(section) {
93
- this.state.section = section;
94
- this.state.lastInteraction = Date.now();
95
- }
96
- updateSelectedSymbol(symbol) {
97
- this.state.selectedSymbol = symbol;
98
- this.state.lastInteraction = Date.now();
99
- }
100
- updateTheme(theme) {
101
- this.state.theme = theme;
102
- }
103
- setMuted(muted) {
104
- this.muted = muted;
105
- }
106
- isMuted() {
107
- return this.muted;
108
- }
109
- isUserActive(thresholdMs = 5e3) {
110
- return Date.now() - this.state.lastInteraction < thresholdMs;
111
- }
112
- getState() {
113
- return { ...this.state, muted: this.muted };
114
- }
115
- addHighlight(h) {
116
- this.highlights.push(h);
117
- if (h.duration > 0) {
118
- setTimeout(() => {
119
- this.highlights = this.highlights.filter((x) => x !== h);
120
- }, h.duration);
121
- }
122
- }
123
- addAnnotation(a) {
124
- const annotation = {
125
- ...a,
126
- id: `ann-${++annotationCounter}`,
127
- createdAt: Date.now()
128
- };
129
- this.annotations.push(annotation);
130
- if (annotation.duration > 0) {
131
- setTimeout(() => {
132
- this.annotations = this.annotations.filter((x) => x !== annotation);
133
- }, annotation.duration);
134
- }
135
- return annotation;
136
- }
137
- clearHighlights() {
138
- this.highlights = [];
139
- }
140
- clearAnnotations() {
141
- this.annotations = [];
142
- }
143
- clearAll() {
144
- this.highlights = [];
145
- this.annotations = [];
146
- }
147
- getHighlights() {
148
- return [...this.highlights];
149
- }
150
- getAnnotations() {
151
- return [...this.annotations];
152
- }
153
- };
154
-
155
- // src/platform-server/ws/index.ts
156
- function attachWebSocket(httpServer) {
157
- const wsClients = /* @__PURE__ */ new Set();
158
- const agentPresence = new AgentPresenceManager();
159
- const userState = new UserStateTracker();
160
- function broadcast(message) {
161
- const data = JSON.stringify(message);
162
- for (const client of wsClients) {
163
- if (client.readyState === WebSocket.OPEN) {
164
- client.send(data);
165
- }
166
- }
167
- }
168
- const wss = new WebSocketServer({ server: httpServer, path: "/ws" });
169
- wss.on("connection", (ws) => {
170
- wsClients.add(ws);
171
- ws.on("message", (raw) => {
172
- try {
173
- const msg = JSON.parse(raw.toString());
174
- if (msg.type === "user:navigate") {
175
- userState.updateSection(msg.section);
176
- } else if (msg.type === "user:select") {
177
- userState.updateSelectedSymbol(msg.symbol ?? null);
178
- } else if (msg.type === "user:theme") {
179
- userState.updateTheme(msg.theme);
180
- } else if (msg.type === "user:mute") {
181
- userState.setMuted(msg.muted);
182
- broadcast({ type: "agent:mute_changed", muted: msg.muted });
183
- } else if (msg.type === "ping") {
184
- ws.send(JSON.stringify({ type: "pong", timestamp: (/* @__PURE__ */ new Date()).toISOString() }));
185
- }
186
- } catch {
187
- }
188
- });
189
- ws.on("close", () => {
190
- wsClients.delete(ws);
191
- });
192
- ws.on("error", () => {
193
- wsClients.delete(ws);
194
- });
195
- });
196
- setInterval(() => {
197
- const pruned = agentPresence.pruneStale();
198
- for (const agentId of pruned) {
199
- broadcast({ type: "agent:leave", agentId });
200
- }
201
- }, 3e4);
202
- return {
203
- broadcast,
204
- agentPresence,
205
- userState,
206
- clientCount: () => wsClients.size
207
- };
208
- }
209
-
210
- // src/platform-server/routes/agent.ts
211
- import { Router } from "express";
212
- function createAgentRouter(wsContext) {
213
- const router = Router();
214
- router.post("/", (req, res) => {
215
- const { command, agentId, payload } = req.body;
216
- if (!command || !agentId) {
217
- res.status(400).json({ error: "Missing command or agentId" });
218
- return;
219
- }
220
- const agents = wsContext.agentPresence.getAll();
221
- if (!agents.find((a) => a.agentId === agentId)) {
222
- wsContext.agentPresence.join(agentId);
223
- wsContext.broadcast({ type: "agent:join", agent: wsContext.agentPresence.getAll().find((a) => a.agentId === agentId) });
224
- }
225
- wsContext.agentPresence.touch(agentId);
226
- switch (command) {
227
- case "navigate": {
228
- const { section, symbol, loreId } = payload;
229
- const userActive = wsContext.userState.isUserActive();
230
- const muted = wsContext.userState.isMuted();
231
- if (muted) {
232
- res.json({ navigated: false, reason: "Agent actions are muted by user" });
233
- return;
234
- }
235
- wsContext.broadcast({
236
- type: "agent:navigate",
237
- agentId,
238
- section,
239
- symbol,
240
- loreId,
241
- userActive
242
- });
243
- if (section) wsContext.userState.updateSection(section);
244
- if (symbol) wsContext.userState.updateSelectedSymbol(symbol);
245
- res.json({ navigated: true, section, symbol, userActive });
246
- return;
247
- }
248
- case "highlight": {
249
- const { symbols, color, duration, pulse, label } = payload;
250
- const muted = wsContext.userState.isMuted();
251
- if (muted) {
252
- res.json({ highlighted: false, reason: "Agent actions are muted by user" });
253
- return;
254
- }
255
- const symbolList = symbols || [];
256
- wsContext.userState.addHighlight({
257
- symbols: symbolList,
258
- color: color || wsContext.agentPresence.getAll().find((a) => a.agentId === agentId)?.color || "#58a6ff",
259
- duration: duration || 5e3,
260
- pulse: pulse ?? true,
261
- label,
262
- createdAt: Date.now()
263
- });
264
- wsContext.broadcast({
265
- type: "agent:highlight",
266
- agentId,
267
- symbols: symbolList,
268
- color: color || "#58a6ff",
269
- duration: duration || 5e3,
270
- pulse: pulse ?? true,
271
- label
272
- });
273
- res.json({ highlighted: true, count: symbolList.length });
274
- return;
275
- }
276
- case "annotate": {
277
- const { type, message, symbol, severity, duration } = payload;
278
- const muted = wsContext.userState.isMuted();
279
- if (muted) {
280
- res.json({ annotated: false, reason: "Agent actions are muted by user" });
281
- return;
282
- }
283
- const annotation = wsContext.userState.addAnnotation({
284
- type: type || "toast",
285
- message: message || "",
286
- symbol,
287
- severity: severity || "info",
288
- duration: duration || 6e3
289
- });
290
- wsContext.broadcast({
291
- type: "agent:annotate",
292
- agentId,
293
- annotation
294
- });
295
- res.json({ annotated: true, id: annotation.id });
296
- return;
297
- }
298
- case "observe": {
299
- const state = wsContext.userState.getState();
300
- const agentsList = wsContext.agentPresence.getAll();
301
- const connected = wsContext.clientCount() > 0;
302
- res.json({
303
- connected,
304
- users: wsContext.clientCount(),
305
- agents: agentsList,
306
- state: {
307
- section: state.section,
308
- selectedSymbol: state.selectedSymbol,
309
- theme: state.theme,
310
- muted: state.muted
311
- },
312
- highlights: wsContext.userState.getHighlights(),
313
- annotations: wsContext.userState.getAnnotations()
314
- });
315
- return;
316
- }
317
- case "clear": {
318
- const { target } = payload;
319
- const clearTarget = target || "all";
320
- if (clearTarget === "highlights" || clearTarget === "all") {
321
- wsContext.userState.clearHighlights();
322
- }
323
- if (clearTarget === "annotations" || clearTarget === "all") {
324
- wsContext.userState.clearAnnotations();
325
- }
326
- wsContext.broadcast({
327
- type: "agent:clear",
328
- agentId,
329
- target: clearTarget
330
- });
331
- res.json({ cleared: true, target: clearTarget });
332
- return;
333
- }
334
- default:
335
- res.status(400).json({ error: `Unknown command: ${command}` });
336
- return;
337
- }
338
- });
339
- return router;
340
- }
341
-
342
- // src/platform-server/routes/overview.ts
343
- import * as fs from "fs";
344
- import * as path from "path";
345
- import simpleGit from "simple-git";
346
- import * as yaml from "js-yaml";
347
- function readJsonSafe(filePath) {
348
- try {
349
- return JSON.parse(fs.readFileSync(filePath, "utf-8"));
350
- } catch {
351
- return null;
352
- }
353
- }
354
- function readYamlSafe(filePath) {
355
- try {
356
- return yaml.load(fs.readFileSync(filePath, "utf-8"));
357
- } catch {
358
- return null;
359
- }
360
- }
361
- function getSymbolCounts(projectDir) {
362
- const indexPath = path.join(projectDir, ".paradigm", "scan-index.json");
363
- const data = readJsonSafe(indexPath);
364
- if (!data?.symbols) return { total: 0, byType: {} };
365
- const byType = {};
366
- for (const sym of data.symbols) {
367
- const cat = sym.category || "unknown";
368
- byType[cat] = (byType[cat] || 0) + 1;
369
- }
370
- return { total: data.symbols.length, byType };
371
- }
372
- function getLoreStats(projectDir) {
373
- const entriesDir = path.join(projectDir, ".paradigm", "lore", "entries");
374
- if (!fs.existsSync(entriesDir)) {
375
- return { total: 0, thisWeek: 0, lastEntry: null, calibrationScore: null, assessed: 0 };
376
- }
377
- const files = fs.readdirSync(entriesDir).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml"));
378
- const now = Date.now();
379
- const weekAgo = now - 7 * 24 * 60 * 60 * 1e3;
380
- let lastTimestamp = null;
381
- let thisWeek = 0;
382
- let assessedCount = 0;
383
- let confidenceSum = 0;
384
- let deltaSum = 0;
385
- let deltaCount = 0;
386
- for (const file of files) {
387
- try {
388
- const entry = readYamlSafe(path.join(entriesDir, file));
389
- if (!entry) continue;
390
- const ts = entry.timestamp;
391
- if (ts) {
392
- const entryTime = new Date(ts).getTime();
393
- if (!lastTimestamp || entryTime > new Date(lastTimestamp).getTime()) {
394
- lastTimestamp = ts;
395
- }
396
- if (entryTime >= weekAgo) thisWeek++;
397
- }
398
- if (entry.assessment) {
399
- assessedCount++;
400
- if (typeof entry.confidence === "number" && typeof entry.assessment_delta === "number") {
401
- confidenceSum += entry.confidence;
402
- deltaSum += Math.abs(entry.assessment_delta);
403
- deltaCount++;
404
- }
405
- }
406
- } catch {
407
- }
408
- }
409
- const calibrationScore = deltaCount > 0 ? Math.max(0, 1 - deltaSum / deltaCount) : null;
410
- return {
411
- total: files.length,
412
- thisWeek,
413
- lastEntry: lastTimestamp,
414
- calibrationScore,
415
- assessed: assessedCount
416
- };
417
- }
418
- function getTaskCounts(projectDir) {
419
- const tasksDir = path.join(projectDir, ".paradigm", "tasks");
420
- if (!fs.existsSync(tasksDir)) return { total: 0, inProgress: 0, completed: 0 };
421
- const files = fs.readdirSync(tasksDir).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml"));
422
- let inProgress = 0;
423
- let completed = 0;
424
- for (const file of files) {
425
- try {
426
- const task = readYamlSafe(path.join(tasksDir, file));
427
- if (!task) continue;
428
- const status = task.status;
429
- if (status === "in-progress" || status === "in_progress") inProgress++;
430
- else if (status === "completed" || status === "done") completed++;
431
- } catch {
432
- }
433
- }
434
- return { total: files.length, inProgress, completed };
435
- }
436
- function getPurposeCoverage(projectDir) {
437
- const srcDirs = ["src", "lib", "packages"];
438
- let withPurpose = 0;
439
- let total = 0;
440
- for (const dir of srcDirs) {
441
- const fullPath = path.join(projectDir, dir);
442
- if (!fs.existsSync(fullPath)) continue;
443
- countPurposeCoverage(fullPath, { withPurpose: 0, total: 0 }, (stats) => {
444
- withPurpose += stats.withPurpose;
445
- total += stats.total;
446
- });
447
- }
448
- if (fs.existsSync(path.join(projectDir, ".purpose"))) {
449
- withPurpose++;
450
- total++;
451
- }
452
- return total === 0 ? 1 : withPurpose / total;
453
- }
454
- function countPurposeCoverage(dir, _stats, callback) {
455
- const stats = { withPurpose: 0, total: 0 };
456
- try {
457
- const entries = fs.readdirSync(dir, { withFileTypes: true });
458
- const hasSourceFiles = entries.some(
459
- (e) => e.isFile() && /\.(ts|tsx|js|jsx|rs|py|go|swift)$/.test(e.name)
460
- );
461
- if (hasSourceFiles) {
462
- stats.total++;
463
- if (entries.some((e) => e.isFile() && e.name === ".purpose")) {
464
- stats.withPurpose++;
465
- }
466
- }
467
- for (const entry of entries) {
468
- if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules" && entry.name !== "dist") {
469
- countPurposeCoverage(path.join(dir, entry.name), stats, (sub) => {
470
- stats.withPurpose += sub.withPurpose;
471
- stats.total += sub.total;
472
- });
473
- }
474
- }
475
- } catch {
476
- }
477
- callback(stats);
478
- }
479
- function getGateCompliance(projectDir) {
480
- const portalPath = path.join(projectDir, "portal.yaml");
481
- if (!fs.existsSync(portalPath)) return 1;
482
- const portal = readYamlSafe(portalPath);
483
- if (!portal?.routes) return 1;
484
- const routeCount = Object.keys(portal.routes).length;
485
- return routeCount > 0 ? 1 : 0.5;
486
- }
487
- function getAspectAnchors(projectDir) {
488
- const dbPath = path.join(projectDir, ".paradigm", "aspect-graph.db");
489
- if (!fs.existsSync(dbPath)) return 1;
490
- return 1;
491
- }
492
- function getConfigInfo(projectDir) {
493
- const configPath = path.join(projectDir, ".paradigm", "config.yaml");
494
- const config = readYamlSafe(configPath);
495
- return {
496
- name: config?.project || path.basename(projectDir),
497
- discipline: config?.discipline || "general"
498
- };
499
- }
500
- async function getRecentCommits(projectDir, limit) {
501
- try {
502
- const git = simpleGit(projectDir);
503
- const log2 = await git.log({ maxCount: limit });
504
- return log2.all.map((c) => ({
505
- timestamp: c.date,
506
- type: "commit",
507
- summary: c.message.split("\n")[0],
508
- symbol: extractFirstSymbol(c.message),
509
- link: c.hash.substring(0, 7)
510
- }));
511
- } catch {
512
- return [];
513
- }
514
- }
515
- function extractFirstSymbol(text) {
516
- const match = text.match(/[#$^!~][\w-]+/);
517
- return match ? match[0] : void 0;
518
- }
519
- function getLoreActivity(projectDir, limit) {
520
- const entriesDir = path.join(projectDir, ".paradigm", "lore", "entries");
521
- if (!fs.existsSync(entriesDir)) return [];
522
- const files = fs.readdirSync(entriesDir).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml"));
523
- const items = [];
524
- for (const file of files) {
525
- try {
526
- const entry = readYamlSafe(path.join(entriesDir, file));
527
- if (!entry) continue;
528
- items.push({
529
- timestamp: entry.timestamp || "",
530
- type: "lore",
531
- summary: entry.title || file,
532
- symbol: Array.isArray(entry.symbols_touched) ? entry.symbols_touched[0] : void 0,
533
- link: entry.id
534
- });
535
- } catch {
536
- }
537
- }
538
- return items.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()).slice(0, limit);
539
- }
540
- function createOverviewHandler(projectDir) {
541
- return async (_req, res) => {
542
- try {
543
- const configInfo = getConfigInfo(projectDir);
544
- const symbolCounts = getSymbolCounts(projectDir);
545
- const loreStats = getLoreStats(projectDir);
546
- const taskCounts = getTaskCounts(projectDir);
547
- const purposeCoverage = getPurposeCoverage(projectDir);
548
- const gateCompliance = getGateCompliance(projectDir);
549
- const aspectAnchors = getAspectAnchors(projectDir);
550
- let branch = "unknown";
551
- try {
552
- const git = simpleGit(projectDir);
553
- const branchInfo = await git.branch();
554
- branch = branchInfo.current;
555
- } catch {
556
- }
557
- const [commits, loreActivity] = await Promise.all([
558
- getRecentCommits(projectDir, 20),
559
- Promise.resolve(getLoreActivity(projectDir, 20))
560
- ]);
561
- const recentActivity = [...commits, ...loreActivity].sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()).slice(0, 20);
562
- const loreFreshnessDays = loreStats.lastEntry ? Math.floor((Date.now() - new Date(loreStats.lastEntry).getTime()) / (1e3 * 60 * 60 * 24)) : 0;
563
- const overview = {
564
- project: { name: configInfo.name, branch, discipline: configInfo.discipline },
565
- symbols: symbolCounts,
566
- lore: { total: loreStats.total, thisWeek: loreStats.thisWeek, lastEntry: loreStats.lastEntry },
567
- calibration: { score: loreStats.calibrationScore, assessed: loreStats.assessed },
568
- tasks: taskCounts,
569
- health: {
570
- purposeCoverage,
571
- aspectAnchors,
572
- gateCompliance,
573
- calibration: loreStats.calibrationScore ?? 1,
574
- loreFreshnessDays
575
- },
576
- recentActivity
577
- };
578
- res.json(overview);
579
- } catch (err) {
580
- res.status(500).json({ error: "Failed to aggregate overview", detail: String(err) });
581
- }
582
- };
583
- }
584
-
585
- // src/platform-server/routes/git.ts
586
- import { Router as Router2 } from "express";
587
- import simpleGit2 from "simple-git";
588
- var SYMBOL_RE = /[#$^!~][\w-]+/g;
589
- function extractSymbols(text) {
590
- const matches = text.match(SYMBOL_RE);
591
- return matches ? [...new Set(matches)] : [];
592
- }
593
- function createGitRouter(projectDir) {
594
- const router = Router2();
595
- const git = simpleGit2(projectDir);
596
- router.get("/status", async (_req, res) => {
597
- try {
598
- const [status, branchInfo] = await Promise.all([
599
- git.status(),
600
- git.branch()
601
- ]);
602
- res.json({
603
- branch: branchInfo.current,
604
- ahead: status.ahead,
605
- behind: status.behind,
606
- staged: status.staged,
607
- unstaged: status.modified.filter((f) => !status.staged.includes(f)),
608
- untracked: status.not_added
609
- });
610
- } catch (err) {
611
- res.status(500).json({ error: "Failed to get git status", detail: String(err) });
612
- }
613
- });
614
- router.get("/branches", async (_req, res) => {
615
- try {
616
- const branchInfo = await git.branch();
617
- const branches = Object.values(branchInfo.branches).map((b) => ({
618
- name: b.name,
619
- current: b.current,
620
- commit: b.commit,
621
- label: b.label
622
- }));
623
- res.json({ current: branchInfo.current, branches });
624
- } catch (err) {
625
- res.status(500).json({ error: "Failed to get branches", detail: String(err) });
626
- }
627
- });
628
- router.get("/log", async (req, res) => {
629
- try {
630
- const limit = Math.min(parseInt(req.query.limit) || 20, 100);
631
- const offset = parseInt(req.query.offset) || 0;
632
- const log2 = await git.log({
633
- maxCount: limit,
634
- "--skip": offset
635
- });
636
- const commits = log2.all.map((c) => ({
637
- hash: c.hash,
638
- shortHash: c.hash.substring(0, 7),
639
- message: c.message,
640
- author: c.author_name,
641
- date: c.date,
642
- symbols: extractSymbols(c.message)
643
- }));
644
- res.json({ commits, total: log2.total });
645
- } catch (err) {
646
- res.status(500).json({ error: "Failed to get git log", detail: String(err) });
647
- }
648
- });
649
- router.get("/diff", async (req, res) => {
650
- try {
651
- const filePath = req.query.path;
652
- const staged = req.query.staged === "true";
653
- const args = [];
654
- if (staged) args.push("--cached");
655
- if (filePath) args.push("--", filePath);
656
- const diffText = await git.diff(args);
657
- res.json({ diff: diffText });
658
- } catch (err) {
659
- res.status(500).json({ error: "Failed to get diff", detail: String(err) });
660
- }
661
- });
662
- router.post("/stage", async (req, res) => {
663
- try {
664
- const { paths } = req.body;
665
- if (!paths?.length) {
666
- res.status(400).json({ error: "paths is required" });
667
- return;
668
- }
669
- await git.add(paths);
670
- res.json({ staged: paths });
671
- } catch (err) {
672
- res.status(500).json({ error: "Failed to stage files", detail: String(err) });
673
- }
674
- });
675
- router.post("/unstage", async (req, res) => {
676
- try {
677
- const { paths } = req.body;
678
- if (!paths?.length) {
679
- res.status(400).json({ error: "paths is required" });
680
- return;
681
- }
682
- await git.reset(["HEAD", "--", ...paths]);
683
- res.json({ unstaged: paths });
684
- } catch (err) {
685
- res.status(500).json({ error: "Failed to unstage files", detail: String(err) });
686
- }
687
- });
688
- router.post("/commit", async (req, res) => {
689
- try {
690
- const { message } = req.body;
691
- if (!message?.trim()) {
692
- res.status(400).json({ error: "message is required" });
693
- return;
694
- }
695
- const result = await git.commit(message);
696
- res.json({
697
- hash: result.commit,
698
- summary: result.summary
699
- });
700
- } catch (err) {
701
- res.status(500).json({ error: "Failed to commit", detail: String(err) });
702
- }
703
- });
704
- router.post("/push", async (_req, res) => {
705
- try {
706
- const result = await git.push();
707
- res.json({
708
- pushed: true,
709
- branch: result.branch,
710
- remoteMessages: result.remoteMessages
711
- });
712
- } catch (err) {
713
- res.status(500).json({ error: "Failed to push", detail: String(err) });
714
- }
715
- });
716
- return router;
717
- }
718
-
719
- // src/platform-server/routes/ambient.ts
720
- import { Router as Router3 } from "express";
721
- import * as fs2 from "fs";
722
- import * as path2 from "path";
723
- import * as yaml2 from "js-yaml";
724
- function readJsonlSafe(filePath) {
725
- if (!fs2.existsSync(filePath)) return [];
726
- try {
727
- const content = fs2.readFileSync(filePath, "utf-8");
728
- const lines = content.split("\n").filter((l) => l.trim());
729
- const results = [];
730
- for (const line of lines) {
731
- try {
732
- results.push(JSON.parse(line));
733
- } catch {
734
- }
735
- }
736
- return results;
737
- } catch {
738
- return [];
739
- }
740
- }
741
- function writeJsonl(filePath, items) {
742
- const dir = path2.dirname(filePath);
743
- if (!fs2.existsSync(dir)) {
744
- fs2.mkdirSync(dir, { recursive: true });
745
- }
746
- const content = items.map((item) => JSON.stringify(item)).join("\n") + "\n";
747
- fs2.writeFileSync(filePath, content, "utf-8");
748
- }
749
- function parseSince(since) {
750
- const match = since.match(/^(\d+)(m|h|d)$/);
751
- if (!match) return null;
752
- const value = parseInt(match[1], 10);
753
- const unit = match[2];
754
- const now = Date.now();
755
- switch (unit) {
756
- case "m":
757
- return new Date(now - value * 60 * 1e3);
758
- case "h":
759
- return new Date(now - value * 60 * 60 * 1e3);
760
- case "d":
761
- return new Date(now - value * 24 * 60 * 60 * 1e3);
762
- default:
763
- return null;
764
- }
765
- }
766
- function createAmbientRouter(projectDir, wsContext) {
767
- const router = Router3();
768
- const eventsPath = path2.join(projectDir, ".paradigm", "events", "stream.jsonl");
769
- const nominationsPath = path2.join(projectDir, ".paradigm", "events", "nominations.jsonl");
770
- const debatesPath = path2.join(projectDir, ".paradigm", "events", "debates.jsonl");
771
- const policyPath = path2.join(projectDir, ".paradigm", "data-policy.yaml");
772
- router.get("/events", (req, res) => {
773
- try {
774
- const {
775
- type: typeFilter,
776
- source: sourceFilter,
777
- symbol: symbolFilter,
778
- agent: agentFilter,
779
- since: sinceParam,
780
- limit: limitParam
781
- } = req.query;
782
- const limit = limitParam ? parseInt(limitParam, 10) : 50;
783
- const sinceDate = sinceParam ? parseSince(sinceParam) : null;
784
- let events = readJsonlSafe(eventsPath);
785
- if (typeFilter) {
786
- events = events.filter((e) => e.type === typeFilter);
787
- }
788
- if (sourceFilter) {
789
- events = events.filter((e) => e.source === sourceFilter);
790
- }
791
- if (symbolFilter) {
792
- events = events.filter((e) => e.symbol === symbolFilter);
793
- }
794
- if (agentFilter) {
795
- events = events.filter((e) => e.agent === agentFilter);
796
- }
797
- if (sinceDate) {
798
- events = events.filter((e) => {
799
- if (!e.timestamp) return false;
800
- return new Date(e.timestamp).getTime() >= sinceDate.getTime();
801
- });
802
- }
803
- const result = events.slice(-limit);
804
- wsContext.broadcast({ type: "ambient:event", action: "query", count: result.length });
805
- res.json(result);
806
- } catch (err) {
807
- res.status(500).json({ error: "Failed to query events", detail: String(err) });
808
- }
809
- });
810
- router.get("/nominations", (req, res) => {
811
- try {
812
- const {
813
- agent: agentFilter,
814
- urgency: urgencyFilter,
815
- pending_only: pendingOnlyParam,
816
- include_debates: includeDebatesParam,
817
- limit: limitParam
818
- } = req.query;
819
- const limit = limitParam ? parseInt(limitParam, 10) : 20;
820
- const pendingOnly = pendingOnlyParam !== "false";
821
- const includeDebates = includeDebatesParam === "true";
822
- let nominations = readJsonlSafe(nominationsPath);
823
- if (agentFilter) {
824
- nominations = nominations.filter((n) => n.agent === agentFilter);
825
- }
826
- if (urgencyFilter) {
827
- nominations = nominations.filter((n) => n.urgency === urgencyFilter);
828
- }
829
- if (pendingOnly) {
830
- nominations = nominations.filter((n) => !n.engaged);
831
- }
832
- nominations = nominations.slice(-limit);
833
- let debateMap;
834
- if (includeDebates) {
835
- const debates = readJsonlSafe(debatesPath);
836
- debateMap = /* @__PURE__ */ new Map();
837
- for (const debate of debates) {
838
- if (debate.nominationId) {
839
- const existing = debateMap.get(debate.nominationId) || [];
840
- existing.push(debate);
841
- debateMap.set(debate.nominationId, existing);
842
- }
843
- }
844
- }
845
- const result = nominations.map((n) => {
846
- const entry = { ...n };
847
- if (includeDebates && debateMap && n.id) {
848
- entry.debates = debateMap.get(n.id) || [];
849
- }
850
- return entry;
851
- });
852
- res.json(result);
853
- } catch (err) {
854
- res.status(500).json({ error: "Failed to query nominations", detail: String(err) });
855
- }
856
- });
857
- router.post("/nominations/:id/engage", (req, res) => {
858
- try {
859
- const { id } = req.params;
860
- const { response } = req.body;
861
- if (!response || !["accepted", "dismissed", "deferred"].includes(response)) {
862
- res.status(400).json({ error: "response must be one of: accepted, dismissed, deferred" });
863
- return;
864
- }
865
- const nominations = readJsonlSafe(nominationsPath);
866
- const index = nominations.findIndex((n) => n.id === id);
867
- if (index === -1) {
868
- res.status(404).json({ error: `Nomination not found: ${id}` });
869
- return;
870
- }
871
- nominations[index] = {
872
- ...nominations[index],
873
- engaged: true,
874
- response
875
- };
876
- writeJsonl(nominationsPath, nominations);
877
- wsContext.broadcast({
878
- type: "ambient:nomination",
879
- action: "engaged",
880
- nominationId: id,
881
- response
882
- });
883
- res.json(nominations[index]);
884
- } catch (err) {
885
- res.status(500).json({ error: "Failed to engage nomination", detail: String(err) });
886
- }
887
- });
888
- router.get("/stream", (req, res) => {
889
- res.setHeader("Content-Type", "text/event-stream");
890
- res.setHeader("Cache-Control", "no-cache");
891
- res.setHeader("Connection", "keep-alive");
892
- res.flushHeaders();
893
- let lastSize = 0;
894
- try {
895
- const stat = fs2.statSync(eventsPath);
896
- lastSize = stat.size;
897
- } catch {
898
- }
899
- const pollInterval = 1e3;
900
- const watcher = setInterval(() => {
901
- try {
902
- if (!fs2.existsSync(eventsPath)) return;
903
- const stat = fs2.statSync(eventsPath);
904
- if (stat.size <= lastSize) {
905
- if (stat.size < lastSize) lastSize = 0;
906
- else return;
907
- }
908
- const fd = fs2.openSync(eventsPath, "r");
909
- const buffer = Buffer.alloc(stat.size - lastSize);
910
- fs2.readSync(fd, buffer, 0, buffer.length, lastSize);
911
- fs2.closeSync(fd);
912
- lastSize = stat.size;
913
- const newContent = buffer.toString("utf-8");
914
- const lines = newContent.split("\n").filter((l) => l.trim());
915
- for (const line of lines) {
916
- try {
917
- const event = JSON.parse(line);
918
- res.write(`data: ${JSON.stringify(event)}
919
-
920
- `);
921
- } catch {
922
- }
923
- }
924
- } catch {
925
- }
926
- }, pollInterval);
927
- res.write(": connected\n\n");
928
- req.on("close", () => {
929
- clearInterval(watcher);
930
- });
931
- });
932
- router.get("/policy", (_req, res) => {
933
- try {
934
- if (fs2.existsSync(policyPath)) {
935
- const content = fs2.readFileSync(policyPath, "utf-8");
936
- const policy = yaml2.load(content);
937
- res.json(policy);
938
- } else {
939
- res.json({
940
- version: "1.0",
941
- retention: { events: "30d", nominations: "90d", debates: "90d" },
942
- collection: { telemetry: false, usage: false },
943
- sharing: { external: false }
944
- });
945
- }
946
- } catch (err) {
947
- res.status(500).json({ error: "Failed to read data policy", detail: String(err) });
948
- }
949
- });
950
- return router;
951
- }
952
-
953
- // src/platform-server/routes/team.ts
954
- import { Router as Router4 } from "express";
955
- import * as fs3 from "fs";
956
- import * as path3 from "path";
957
- import * as os from "os";
958
- import * as yaml3 from "js-yaml";
959
- function readJsonl(filePath) {
960
- if (!fs3.existsSync(filePath)) return [];
961
- try {
962
- return fs3.readFileSync(filePath, "utf-8").trim().split("\n").filter((line) => line.trim()).map((line) => {
963
- try {
964
- return JSON.parse(line);
965
- } catch {
966
- return null;
967
- }
968
- }).filter((v) => v !== null);
969
- } catch {
970
- return [];
971
- }
972
- }
973
- function loadAgentProfiles() {
974
- const globalDir = path3.join(os.homedir(), ".paradigm", "agents");
975
- const profiles = [];
976
- if (!fs3.existsSync(globalDir)) return profiles;
977
- for (const file of fs3.readdirSync(globalDir).filter((f) => f.endsWith(".agent"))) {
978
- try {
979
- const content = fs3.readFileSync(path3.join(globalDir, file), "utf-8");
980
- const p = yaml3.load(content);
981
- if (!p?.id) continue;
982
- const expertise = p.expertise || [];
983
- expertise.sort((a, b) => b.confidence - a.confidence);
984
- profiles.push({
985
- id: p.id,
986
- role: p.role || p.id,
987
- nickname: p.nickname,
988
- benched: p.benched || false,
989
- expertiseCount: expertise.length,
990
- topExpertise: expertise.slice(0, 3).map((e) => ({
991
- symbol: e.symbol,
992
- confidence: parseFloat(e.confidence.toFixed(2))
993
- })),
994
- threshold: p.attention?.threshold
995
- });
996
- } catch {
997
- }
998
- }
999
- return profiles;
1000
- }
1001
- function loadTeamThreads() {
1002
- const mailDir = path3.join(os.homedir(), ".paradigm", "mail", "agents");
1003
- if (!fs3.existsSync(mailDir)) return [];
1004
- const allMessages = [];
1005
- try {
1006
- for (const agentDir of fs3.readdirSync(mailDir, { withFileTypes: true })) {
1007
- if (!agentDir.isDirectory()) continue;
1008
- const agentPath = path3.join(mailDir, agentDir.name);
1009
- for (const file of ["inbox.jsonl", "outbox.jsonl"]) {
1010
- const filePath = path3.join(agentPath, file);
1011
- const notes = readJsonl(filePath);
1012
- for (const note of notes) {
1013
- if (!note.threadRoot?.startsWith("thr-orch-")) continue;
1014
- if (allMessages.some((m) => m.id === note.id)) continue;
1015
- allMessages.push({
1016
- id: note.id,
1017
- threadRoot: note.threadRoot,
1018
- timestamp: note.timestamp,
1019
- sender: {
1020
- name: note.sender?.name || "unknown",
1021
- role: note.sender?.role,
1022
- project: note.sender?.project
1023
- },
1024
- intent: note.intent || "context",
1025
- text: note.content?.text || "",
1026
- symbols: note.symbols || [],
1027
- diff: note.content?.diff,
1028
- decision: note.content?.decision
1029
- });
1030
- }
1031
- }
1032
- }
1033
- } catch {
1034
- }
1035
- const threadMap = /* @__PURE__ */ new Map();
1036
- for (const msg of allMessages) {
1037
- const threadId = msg.threadRoot;
1038
- if (!threadMap.has(threadId)) threadMap.set(threadId, []);
1039
- threadMap.get(threadId).push(msg);
1040
- }
1041
- const threads = [];
1042
- for (const [threadId, messages] of threadMap) {
1043
- messages.sort((a, b) => a.timestamp.localeCompare(b.timestamp));
1044
- const stripped = threadId.replace("thr-orch-", "");
1045
- const parts = stripped.split("-");
1046
- const displayName = parts[0] ? `Team ${parts[0]}` : threadId;
1047
- threads.push({
1048
- id: threadId,
1049
- displayName,
1050
- messages,
1051
- lastActivity: messages[messages.length - 1]?.timestamp || ""
1052
- });
1053
- }
1054
- threads.sort((a, b) => b.lastActivity.localeCompare(a.lastActivity));
1055
- return threads;
1056
- }
1057
- function createTeamRouter(projectDir) {
1058
- const router = Router4();
1059
- router.get("/roster", (_req, res) => {
1060
- try {
1061
- const agents = loadAgentProfiles();
1062
- const active = agents.filter((a) => !a.benched);
1063
- const benched = agents.filter((a) => a.benched);
1064
- res.json({ active, benched, total: agents.length });
1065
- } catch (err) {
1066
- res.status(500).json({ error: "Failed to load roster", detail: String(err) });
1067
- }
1068
- });
1069
- router.get("/threads", (_req, res) => {
1070
- try {
1071
- const threads = loadTeamThreads();
1072
- res.json({ threads, count: threads.length });
1073
- } catch (err) {
1074
- res.status(500).json({ error: "Failed to load threads", detail: String(err) });
1075
- }
1076
- });
1077
- router.patch("/agents/:id/bench", (req, res) => {
1078
- try {
1079
- const { id } = req.params;
1080
- const { benched } = req.body;
1081
- const globalDir = path3.join(os.homedir(), ".paradigm", "agents");
1082
- const filePath = path3.join(globalDir, `${id}.agent`);
1083
- if (!fs3.existsSync(filePath)) {
1084
- res.status(404).json({ error: `Agent "${id}" not found` });
1085
- return;
1086
- }
1087
- const content = fs3.readFileSync(filePath, "utf-8");
1088
- const profile = yaml3.load(content);
1089
- profile.benched = benched;
1090
- profile.updated = (/* @__PURE__ */ new Date()).toISOString();
1091
- fs3.writeFileSync(filePath, yaml3.dump(profile, { lineWidth: 120, noRefs: true, sortKeys: false }), "utf-8");
1092
- res.json({ id, benched, updated: profile.updated });
1093
- } catch (err) {
1094
- res.status(500).json({ error: "Failed to update agent", detail: String(err) });
1095
- }
1096
- });
1097
- return router;
1098
- }
1099
-
1100
- // src/platform-server/routes/canvas.ts
1101
- import { Router as Router5 } from "express";
1102
- import * as fs4 from "fs";
1103
- import * as path4 from "path";
1104
- import * as yaml4 from "js-yaml";
1105
- var IGNORE_DIRS = /* @__PURE__ */ new Set([
1106
- "node_modules",
1107
- ".git",
1108
- "dist",
1109
- ".next",
1110
- "build",
1111
- ".paradigm",
1112
- ".turbo",
1113
- ".cache",
1114
- "coverage",
1115
- ".output"
1116
- ]);
1117
- function findCanvasFiles(dir, rootDir) {
1118
- const results = [];
1119
- let entries;
1120
- try {
1121
- entries = fs4.readdirSync(dir, { withFileTypes: true });
1122
- } catch {
1123
- return results;
1124
- }
1125
- for (const entry of entries) {
1126
- if (entry.isDirectory()) {
1127
- if (!IGNORE_DIRS.has(entry.name) && !entry.name.startsWith(".")) {
1128
- results.push(...findCanvasFiles(path4.join(dir, entry.name), rootDir));
1129
- }
1130
- } else if (entry.isFile() && entry.name.endsWith(".canvas")) {
1131
- results.push(path4.relative(rootDir, path4.join(dir, entry.name)));
1132
- }
1133
- }
1134
- return results;
1135
- }
1136
- var cachedFiles = null;
1137
- var cacheTimestamp = 0;
1138
- var CACHE_TTL = 5e3;
1139
- function getCanvasFiles(projectDir) {
1140
- const now = Date.now();
1141
- if (cachedFiles && now - cacheTimestamp < CACHE_TTL) {
1142
- return cachedFiles;
1143
- }
1144
- const rootFiles = fs4.readdirSync(projectDir).filter((f) => f.endsWith(".canvas")).map((f) => f);
1145
- const nestedFiles = findCanvasFiles(projectDir, projectDir).filter((f) => !rootFiles.includes(f));
1146
- cachedFiles = [...rootFiles, ...nestedFiles];
1147
- cacheTimestamp = now;
1148
- return cachedFiles;
1149
- }
1150
- function safePath(projectDir, requestedPath) {
1151
- const resolved = path4.resolve(projectDir, requestedPath);
1152
- if (!resolved.startsWith(projectDir + path4.sep) && resolved !== projectDir) {
1153
- return null;
1154
- }
1155
- if (!resolved.endsWith(".canvas")) {
1156
- return null;
1157
- }
1158
- return resolved;
1159
- }
1160
- function createCanvasRouter(projectDir) {
1161
- const router = Router5();
1162
- router.get("/files", (_req, res) => {
1163
- try {
1164
- const relativePaths = getCanvasFiles(projectDir);
1165
- const files = relativePaths.map((relPath) => {
1166
- const absPath = path4.join(projectDir, relPath);
1167
- try {
1168
- const stat = fs4.statSync(absPath);
1169
- let name = path4.basename(relPath, ".canvas");
1170
- let description = "";
1171
- try {
1172
- const raw = yaml4.load(fs4.readFileSync(absPath, "utf8"));
1173
- if (raw && typeof raw.name === "string") name = raw.name;
1174
- if (raw && typeof raw.description === "string") description = raw.description;
1175
- } catch {
1176
- }
1177
- return {
1178
- path: relPath,
1179
- name,
1180
- description,
1181
- modified: stat.mtime.toISOString(),
1182
- size: stat.size
1183
- };
1184
- } catch {
1185
- return null;
1186
- }
1187
- }).filter(Boolean);
1188
- files.sort((a, b) => b.modified.localeCompare(a.modified));
1189
- res.json({ files });
1190
- } catch (err) {
1191
- res.status(500).json({ error: "Failed to list canvas files", details: err.message });
1192
- }
1193
- });
1194
- router.get("/files/*", (req, res) => {
1195
- const requestedPath = req.params[0] || req.params["path"] || "";
1196
- if (!requestedPath) {
1197
- res.status(400).json({ error: "File path required" });
1198
- return;
1199
- }
1200
- const absPath = safePath(projectDir, requestedPath);
1201
- if (!absPath) {
1202
- res.status(400).json({ error: "Invalid path" });
1203
- return;
1204
- }
1205
- if (!fs4.existsSync(absPath)) {
1206
- res.status(404).json({ error: `Canvas file not found: ${requestedPath}` });
1207
- return;
1208
- }
1209
- try {
1210
- const raw = fs4.readFileSync(absPath, "utf8");
1211
- const parsed = yaml4.load(raw);
1212
- res.json(parsed);
1213
- } catch (err) {
1214
- res.status(500).json({ error: "Failed to read canvas file", details: err.message });
1215
- }
1216
- });
1217
- router.put("/files/*", (req, res) => {
1218
- const requestedPath = req.params[0] || req.params["path"] || "";
1219
- if (!requestedPath) {
1220
- res.status(400).json({ error: "File path required" });
1221
- return;
1222
- }
1223
- const absPath = safePath(projectDir, requestedPath);
1224
- if (!absPath) {
1225
- res.status(400).json({ error: "Invalid path" });
1226
- return;
1227
- }
1228
- try {
1229
- const data = req.body;
1230
- if (!data || typeof data !== "object") {
1231
- res.status(400).json({ error: "Request body must be a JSON object" });
1232
- return;
1233
- }
1234
- const now = (/* @__PURE__ */ new Date()).toISOString();
1235
- if (!data.created) data.created = now;
1236
- data.updated = now;
1237
- const dir = path4.dirname(absPath);
1238
- if (!fs4.existsSync(dir)) {
1239
- fs4.mkdirSync(dir, { recursive: true });
1240
- }
1241
- const yamlStr = yaml4.dump(data, {
1242
- lineWidth: -1,
1243
- noRefs: true,
1244
- quotingType: '"',
1245
- forceQuotes: false
1246
- });
1247
- fs4.writeFileSync(absPath, yamlStr, "utf8");
1248
- cachedFiles = null;
1249
- res.json({ saved: true, path: requestedPath });
1250
- } catch (err) {
1251
- res.status(500).json({ error: "Failed to save canvas file", details: err.message });
1252
- }
1253
- });
1254
- router.delete("/files/*", (req, res) => {
1255
- const requestedPath = req.params[0] || req.params["path"] || "";
1256
- if (!requestedPath) {
1257
- res.status(400).json({ error: "File path required" });
1258
- return;
1259
- }
1260
- const absPath = safePath(projectDir, requestedPath);
1261
- if (!absPath) {
1262
- res.status(400).json({ error: "Invalid path" });
1263
- return;
1264
- }
1265
- if (!fs4.existsSync(absPath)) {
1266
- res.status(404).json({ error: `Canvas file not found: ${requestedPath}` });
1267
- return;
1268
- }
1269
- try {
1270
- fs4.unlinkSync(absPath);
1271
- cachedFiles = null;
1272
- res.json({ deleted: true, path: requestedPath });
1273
- } catch (err) {
1274
- res.status(500).json({ error: "Failed to delete canvas file", details: err.message });
1275
- }
1276
- });
1277
- return router;
1278
- }
1279
-
1280
- // src/platform-server/index.ts
1281
- var __filename = fileURLToPath(import.meta.url);
1282
- var __dirname = path5.dirname(__filename);
1283
- var log = {
1284
- component(name) {
1285
- const symbol = chalk.magenta(`#${name}`);
1286
- return {
1287
- info: (msg, data) => {
1288
- const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
1289
- console.log(`${chalk.blue("i")} ${symbol} ${msg}${dataStr}`);
1290
- },
1291
- success: (msg, data) => {
1292
- const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
1293
- console.log(`${chalk.green("+")} ${symbol} ${msg}${dataStr}`);
1294
- },
1295
- warn: (msg, data) => {
1296
- const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
1297
- console.log(`${chalk.yellow("!")} ${symbol} ${msg}${dataStr}`);
1298
- },
1299
- error: (msg, data) => {
1300
- const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
1301
- console.error(`${chalk.red("x")} ${symbol} ${msg}${dataStr}`);
1302
- }
1303
- };
1304
- }
1305
- };
1306
- function resolveSections(options) {
1307
- const always = ["overview", "lore", "graph", "canvas", "git", "ambient", "team"];
1308
- const requested = options.sections ?? [...always, "sentinel", "university", "symphony", "docs"];
1309
- const enabled = /* @__PURE__ */ new Set();
1310
- for (const section of requested) {
1311
- if (always.includes(section)) {
1312
- enabled.add(section);
1313
- continue;
1314
- }
1315
- if (section === "sentinel") {
1316
- const sentinelRoutesPath = path5.join(options.projectDir, ".paradigm");
1317
- if (fs5.existsSync(sentinelRoutesPath)) {
1318
- enabled.add(section);
1319
- }
1320
- } else if (section === "university") {
1321
- enabled.add(section);
1322
- } else if (section === "symphony") {
1323
- const mailDir = path5.join(process.env.HOME || "~", ".paradigm", "score");
1324
- if (fs5.existsSync(mailDir)) {
1325
- enabled.add(section);
1326
- }
1327
- } else {
1328
- enabled.add(section);
1329
- }
1330
- }
1331
- return enabled;
1332
- }
1333
- function createPlatformApp(options) {
1334
- const app = express();
1335
- const sections = resolveSections(options);
1336
- app.use(express.json());
1337
- app.use((_req, res, next) => {
1338
- res.header("Access-Control-Allow-Origin", "*");
1339
- res.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
1340
- res.header("Access-Control-Allow-Headers", "Content-Type");
1341
- if (_req.method === "OPTIONS") {
1342
- res.sendStatus(204);
1343
- return;
1344
- }
1345
- next();
1346
- });
1347
- app.use("/api/lore", createLoreRouter(options.projectDir));
1348
- app.use("/api/info", createInfoRouter(options.projectDir));
1349
- app.use("/api/sessions", createSessionsRouter(options.projectDir));
1350
- app.use("/api/symbols", createSymbolsRouter(options.projectDir));
1351
- app.use("/api/graphs", createGraphsRouter(options.projectDir));
1352
- app.get("/api/platform/overview", createOverviewHandler(options.projectDir));
1353
- app.use("/api/canvas", createCanvasRouter(options.projectDir));
1354
- app.use("/api/git", createGitRouter(options.projectDir));
1355
- app.get("/api/platform/health", (_req, res) => {
1356
- res.json({
1357
- status: "ok",
1358
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1359
- sections: Array.from(sections)
1360
- });
1361
- });
1362
- app.get("/api/platform/sections", (_req, res) => {
1363
- res.json({ sections: Array.from(sections) });
1364
- });
1365
- app.get("/api/health", (_req, res) => {
1366
- res.json({ status: "ok", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
1367
- });
1368
- app.set("agentRouterSlot", true);
1369
- let uiDistPath = path5.join(__dirname, "..", "platform-ui", "dist");
1370
- if (!fs5.existsSync(uiDistPath)) {
1371
- uiDistPath = path5.join(__dirname, "..", "..", "platform-ui", "dist");
1372
- }
1373
- if (fs5.existsSync(uiDistPath)) {
1374
- app.use(express.static(uiDistPath));
1375
- app.get("{*path}", (req, res, next) => {
1376
- if (!req.path.startsWith("/api")) {
1377
- res.sendFile(path5.join(uiDistPath, "index.html"));
1378
- } else {
1379
- next();
1380
- }
1381
- });
1382
- } else {
1383
- app.get("/", (_req, res) => {
1384
- res.send(`
1385
- <html>
1386
- <head><title>Paradigm Platform</title></head>
1387
- <body style="background:#0d1117;color:#e6edf3;font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0">
1388
- <div style="text-align:center">
1389
- <h1 style="font-size:2rem;margin-bottom:8px">Paradigm Platform</h1>
1390
- <p style="color:#8b949e">UI not built yet. Run <code style="background:#21262d;padding:4px 8px;border-radius:4px">cd platform-ui && npx vite build</code></p>
1391
- <p style="color:#8b949e;margin-top:16px">APIs available:</p>
1392
- <p><a href="/api/lore" style="color:#58a6ff">/api/lore</a> &middot; <a href="/api/symbols" style="color:#58a6ff">/api/symbols</a> &middot; <a href="/api/platform/health" style="color:#58a6ff">/api/platform/health</a></p>
1393
- </div>
1394
- </body>
1395
- </html>
1396
- `);
1397
- });
1398
- }
1399
- return app;
1400
- }
1401
- async function startPlatformServer(options) {
1402
- const app = createPlatformApp(options);
1403
- const sections = resolveSections(options);
1404
- log.component("platform-server").info("Starting Paradigm Platform", { port: options.port });
1405
- log.component("platform-server").info("Project directory", { path: options.projectDir });
1406
- log.component("platform-server").info("Sections", { enabled: Array.from(sections).join(", ") });
1407
- const httpServer = http.createServer(app);
1408
- const wsContext = attachWebSocket(httpServer);
1409
- app.use("/api/platform/agent-command", createAgentRouter(wsContext));
1410
- app.use("/api/ambient", createAmbientRouter(options.projectDir, wsContext));
1411
- app.use("/api/team", createTeamRouter(options.projectDir));
1412
- if (sections.has("sentinel")) {
1413
- try {
1414
- const { createSentinelBridge } = await import("./sentinel-bridge-MDUXTQRL.js");
1415
- const sentinelRouter = await createSentinelBridge(options.projectDir, wsContext.broadcast);
1416
- if (sentinelRouter) {
1417
- app.use("/api/sentinel", sentinelRouter);
1418
- log.component("platform-server").success("Sentinel routes mounted");
1419
- }
1420
- } catch {
1421
- log.component("platform-server").warn("Sentinel not available");
1422
- }
1423
- }
1424
- if (sections.has("symphony")) {
1425
- try {
1426
- const { createSymphonyRouter } = await import("./symphony-B75X2MME.js");
1427
- app.use("/api/symphony", createSymphonyRouter(options.projectDir, wsContext.broadcast));
1428
- log.component("platform-server").success("Symphony routes mounted");
1429
- } catch (err) {
1430
- log.component("platform-server").warn("Symphony routes failed to mount");
1431
- }
1432
- }
1433
- if (sections.has("docs")) {
1434
- try {
1435
- const { createDocsRouter } = await import("./docs-PBZB7LYP.js");
1436
- app.use("/api/docs", createDocsRouter(options.projectDir));
1437
- log.component("platform-server").success("Docs routes mounted");
1438
- } catch (err) {
1439
- log.component("platform-server").warn("Docs routes failed to mount");
1440
- }
1441
- }
1442
- return new Promise((resolve2, reject) => {
1443
- httpServer.listen(options.port, () => {
1444
- log.component("platform-server").success("Platform running", { url: `http://localhost:${options.port}` });
1445
- log.component("platform-ws").success("WebSocket ready", { url: `ws://localhost:${options.port}/ws` });
1446
- console.log("");
1447
- console.log(chalk.gray(" Sections:"));
1448
- for (const section of sections) {
1449
- console.log(chalk.gray(` ${chalk.cyan("\u25CF")} ${section}`));
1450
- }
1451
- console.log("");
1452
- if (options.open) {
1453
- import("open").then((openModule) => {
1454
- openModule.default(`http://localhost:${options.port}`);
1455
- log.component("platform-server").info("Opened browser");
1456
- }).catch(() => {
1457
- log.component("platform-server").warn("Could not open browser automatically");
1458
- });
1459
- }
1460
- resolve2();
1461
- });
1462
- httpServer.on("error", (err) => {
1463
- if (err.code === "EADDRINUSE") {
1464
- log.component("platform-server").error("Port already in use", { port: options.port });
1465
- } else {
1466
- log.component("platform-server").error("Server error", { error: err.message });
1467
- }
1468
- reject(err);
1469
- });
1470
- });
1471
- }
1472
- export {
1473
- createPlatformApp,
1474
- startPlatformServer
1475
- };