@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,710 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- addPeer,
4
- computeHmacProof,
5
- generatePairing,
6
- loadPeers,
7
- updatePeerAgents,
8
- updatePeerLastSeen,
9
- verifyHmacProof,
10
- verifyPairingCode
11
- } from "./chunk-KVDYJLTC.js";
12
- import {
13
- appendToInbox,
14
- isAgentAsleep,
15
- listAgents,
16
- readOutbox
17
- } from "./chunk-S2HO5MLR.js";
18
- import "./chunk-PDX44BCA.js";
19
-
20
- // ../paradigm-mcp/src/utils/symphony-relay.ts
21
- import * as fs from "fs";
22
- import * as path from "path";
23
- import * as os from "os";
24
- import * as crypto from "crypto";
25
- import { WebSocketServer, WebSocket } from "ws";
26
- var SCORE_DIR = path.join(os.homedir(), ".paradigm", "score");
27
- var OUTBOX_POLL_INTERVAL_MS = 2e3;
28
- var KEEPALIVE_INTERVAL_MS = 3e4;
29
- var PONG_TIMEOUT_MS = 1e4;
30
- var MAX_AUTH_ATTEMPTS = 3;
31
- var AUTH_COOLDOWN_MS = 6e4;
32
- var RECONNECT_MIN_MS = 1e3;
33
- var RECONNECT_MAX_MS = 3e4;
34
- function sendFrame(ws, frame) {
35
- if (ws.readyState === WebSocket.OPEN) {
36
- ws.send(JSON.stringify(frame));
37
- }
38
- }
39
- function parseFrame(data) {
40
- try {
41
- const text = typeof data === "string" ? data : String(data);
42
- return JSON.parse(text);
43
- } catch {
44
- return null;
45
- }
46
- }
47
- var SymphonyRelay = class _SymphonyRelay {
48
- wss = null;
49
- wsClient = null;
50
- mode;
51
- pairingState = null;
52
- /** peerId → WebSocket for authenticated connections. */
53
- connectedPeers = /* @__PURE__ */ new Map();
54
- /** Bounded dedup set of message IDs already processed. */
55
- seenMessageIds = /* @__PURE__ */ new Set();
56
- outboxWatchInterval = null;
57
- keepaliveInterval = null;
58
- reconnectTimer = null;
59
- reconnectDelay = RECONNECT_MIN_MS;
60
- /** agentId → count of outbox lines already forwarded. */
61
- outboxPositions = /* @__PURE__ */ new Map();
62
- events;
63
- myPeerId;
64
- port;
65
- stopped = false;
66
- /** IP/address → { count, cooldownUntil } for rate limiting. */
67
- failedAuthAttempts = /* @__PURE__ */ new Map();
68
- /** Per-connection pong tracking: peerId → pending timeout handle. */
69
- pongTimers = /* @__PURE__ */ new Map();
70
- /** Server-side address stored for client reconnect. */
71
- serverAddress = null;
72
- /** Pairing code stored for client reconnect. */
73
- serverCode = null;
74
- /** Maximum number of message IDs to keep for dedup. */
75
- static MAX_SEEN_IDS = 1e4;
76
- constructor(options) {
77
- this.mode = options.mode;
78
- this.myPeerId = options.peerId;
79
- this.port = options.port ?? 3939;
80
- this.events = options.events ?? {};
81
- }
82
- // ────────────────────────────────────────────────────────
83
- // Server Mode
84
- // ────────────────────────────────────────────────────────
85
- /**
86
- * Start a WebSocket relay server (hub mode).
87
- *
88
- * Generates a fresh pairing state, binds to `this.port`, and begins
89
- * accepting peer connections. Returns the pairing state so the caller
90
- * can display the code to the user.
91
- */
92
- async startServer() {
93
- if (this.mode !== "server") {
94
- throw new Error('startServer() requires mode "server"');
95
- }
96
- this.pairingState = generatePairing();
97
- this.wss = new WebSocketServer({ port: this.port });
98
- this.wss.on("connection", (ws, req) => {
99
- const remoteAddress = req.socket.remoteAddress ?? "unknown";
100
- if (this.isRateLimited(remoteAddress)) {
101
- sendFrame(ws, { type: "auth_fail", reason: "Too many failed attempts \u2014 try again later" });
102
- ws.close();
103
- return;
104
- }
105
- const challenge = crypto.randomBytes(32).toString("hex");
106
- sendFrame(ws, {
107
- type: "hello",
108
- version: "1.0",
109
- peerId: this.myPeerId,
110
- challenge
111
- });
112
- let authenticated = false;
113
- ws.on("message", (raw) => {
114
- const frame = parseFrame(raw);
115
- if (!frame) return;
116
- if (!authenticated) {
117
- this.handleServerAuth(ws, frame, challenge, remoteAddress).then((peerId) => {
118
- if (peerId) {
119
- authenticated = true;
120
- this.registerPeerConnection(peerId, ws);
121
- }
122
- }).catch((err) => {
123
- this.events.onError?.(err instanceof Error ? err : new Error(String(err)));
124
- });
125
- return;
126
- }
127
- this.handleAuthenticatedFrame(ws, frame);
128
- });
129
- ws.on("close", () => {
130
- if (authenticated) {
131
- this.handlePeerDisconnect(ws);
132
- }
133
- });
134
- ws.on("error", (err) => {
135
- this.events.onError?.(err);
136
- });
137
- });
138
- this.wss.on("error", (err) => {
139
- this.events.onError?.(err);
140
- });
141
- await new Promise((resolve, reject) => {
142
- this.wss.on("listening", resolve);
143
- this.wss.on("error", reject);
144
- });
145
- this.startOutboxWatcher();
146
- this.startKeepalive();
147
- return this.pairingState;
148
- }
149
- /**
150
- * Process an auth frame from an incoming client connection.
151
- * Returns the authenticated peerId on success, null on failure.
152
- */
153
- async handleServerAuth(ws, frame, challenge, remoteAddress) {
154
- if (frame.type !== "auth") {
155
- sendFrame(ws, { type: "auth_fail", reason: "Expected auth frame" });
156
- ws.close();
157
- return null;
158
- }
159
- if (!this.pairingState || !verifyPairingCode(this.pairingState, frame.code)) {
160
- this.recordFailedAuth(remoteAddress);
161
- const reason = "Invalid or expired pairing code";
162
- sendFrame(ws, { type: "auth_fail", reason });
163
- this.events.onPeerAuthFailed?.(remoteAddress, reason);
164
- ws.close();
165
- return null;
166
- }
167
- const codeHash = this.pairingState.codeHash;
168
- if (!verifyHmacProof(challenge, codeHash, frame.proof)) {
169
- this.recordFailedAuth(remoteAddress);
170
- const reason = "HMAC proof verification failed";
171
- sendFrame(ws, { type: "auth_fail", reason });
172
- this.events.onPeerAuthFailed?.(remoteAddress, reason);
173
- ws.close();
174
- return null;
175
- }
176
- const localAgents = this.getLocalAgentSummaries();
177
- const displayName = this.myPeerId;
178
- sendFrame(ws, {
179
- type: "auth_ok",
180
- peerId: this.myPeerId,
181
- displayName,
182
- agents: localAgents
183
- });
184
- addPeer({
185
- id: frame.peerId,
186
- displayName: frame.peerId,
187
- address: remoteAddress,
188
- sharedSecret: this.pairingState.sharedSecret,
189
- connectedAt: (/* @__PURE__ */ new Date()).toISOString(),
190
- lastSeen: (/* @__PURE__ */ new Date()).toISOString(),
191
- revoked: false,
192
- agents: []
193
- });
194
- return frame.peerId;
195
- }
196
- // ────────────────────────────────────────────────────────
197
- // Client Mode
198
- // ────────────────────────────────────────────────────────
199
- /**
200
- * Connect to a remote relay server as a spoke.
201
- *
202
- * Resolves once authentication completes successfully.
203
- * Rejects if the connection fails or auth is denied.
204
- */
205
- async connectToServer(address, code) {
206
- if (this.mode !== "client") {
207
- throw new Error('connectToServer() requires mode "client"');
208
- }
209
- this.serverAddress = address;
210
- this.serverCode = code;
211
- await this.attemptConnection(address, code);
212
- }
213
- /**
214
- * Inner connection attempt — used for both initial connect and reconnects.
215
- */
216
- attemptConnection(address, code) {
217
- return new Promise((resolve, reject) => {
218
- if (this.stopped) {
219
- reject(new Error("Relay has been stopped"));
220
- return;
221
- }
222
- const wsUrl = address.includes("://") ? address : `ws://${address}`;
223
- const ws = new WebSocket(wsUrl);
224
- let settled = false;
225
- ws.on("open", () => {
226
- this.wsClient = ws;
227
- });
228
- ws.on("message", (raw) => {
229
- const frame = parseFrame(raw);
230
- if (!frame) return;
231
- switch (frame.type) {
232
- case "hello": {
233
- const codeHash = crypto.createHash("sha256").update(code).digest("hex");
234
- const proof = computeHmacProof(frame.challenge, codeHash);
235
- sendFrame(ws, {
236
- type: "auth",
237
- peerId: this.myPeerId,
238
- code,
239
- proof
240
- });
241
- break;
242
- }
243
- case "auth_ok": {
244
- addPeer({
245
- id: frame.peerId,
246
- displayName: frame.displayName,
247
- address,
248
- sharedSecret: code,
249
- // Store code for reconnect
250
- connectedAt: (/* @__PURE__ */ new Date()).toISOString(),
251
- lastSeen: (/* @__PURE__ */ new Date()).toISOString(),
252
- revoked: false,
253
- agents: frame.agents
254
- });
255
- sendFrame(ws, {
256
- type: "agents_sync",
257
- agents: this.getLocalAgentSummaries()
258
- });
259
- this.registerPeerConnection(frame.peerId, ws);
260
- this.startOutboxWatcher();
261
- this.startKeepalive();
262
- this.reconnectDelay = RECONNECT_MIN_MS;
263
- if (!settled) {
264
- settled = true;
265
- resolve();
266
- }
267
- break;
268
- }
269
- case "auth_fail": {
270
- if (!settled) {
271
- settled = true;
272
- reject(new Error(`Auth failed: ${frame.reason}`));
273
- }
274
- ws.close();
275
- break;
276
- }
277
- default:
278
- this.handleAuthenticatedFrame(ws, frame);
279
- break;
280
- }
281
- });
282
- ws.on("close", () => {
283
- this.handlePeerDisconnect(ws);
284
- if (!settled) {
285
- settled = true;
286
- reject(new Error("Connection closed before auth completed"));
287
- } else if (!this.stopped) {
288
- this.scheduleReconnect();
289
- }
290
- });
291
- ws.on("error", (err) => {
292
- this.events.onError?.(err);
293
- if (!settled) {
294
- settled = true;
295
- reject(err);
296
- }
297
- });
298
- });
299
- }
300
- // ────────────────────────────────────────────────────────
301
- // Authenticated Frame Handler
302
- // ────────────────────────────────────────────────────────
303
- /**
304
- * Dispatch a frame received on an authenticated connection.
305
- */
306
- handleAuthenticatedFrame(ws, frame) {
307
- switch (frame.type) {
308
- case "message":
309
- this.handleIncomingMessage(ws, frame.message, frame.origin);
310
- break;
311
- case "message_ack":
312
- break;
313
- case "nomination_forward":
314
- this.handleNominationForward(ws, frame.nomination, frame.origin);
315
- break;
316
- case "agents_sync":
317
- this.handleAgentsSync(ws, frame.agents);
318
- break;
319
- case "agent_joined": {
320
- const peerId = this.peerIdForSocket(ws);
321
- if (peerId) {
322
- const peers = loadPeers();
323
- const peer = peers.find((p) => p.id === peerId);
324
- if (peer) {
325
- const agents = [...peer.agents || [], frame.agent];
326
- updatePeerAgents(peerId, agents);
327
- }
328
- }
329
- break;
330
- }
331
- case "agent_left": {
332
- const peerId = this.peerIdForSocket(ws);
333
- if (peerId) {
334
- const peers = loadPeers();
335
- const peer = peers.find((p) => p.id === peerId);
336
- if (peer) {
337
- const agents = (peer.agents || []).filter((a) => a.id !== frame.agentId);
338
- updatePeerAgents(peerId, agents);
339
- }
340
- }
341
- break;
342
- }
343
- case "peer_leaving":
344
- this.handlePeerDisconnect(ws);
345
- ws.close();
346
- break;
347
- case "ping":
348
- sendFrame(ws, { type: "pong" });
349
- break;
350
- case "pong":
351
- this.handlePong(ws);
352
- break;
353
- default:
354
- break;
355
- }
356
- }
357
- // ────────────────────────────────────────────────────────
358
- // Message Handling
359
- // ────────────────────────────────────────────────────────
360
- /**
361
- * Process an incoming relayed message.
362
- *
363
- * 1. Dedup check — skip if already seen
364
- * 2. Deliver to matching local agents
365
- * 3. In server mode, relay to other connected peers (not the sender)
366
- * 4. Send ack back to the sender
367
- */
368
- handleIncomingMessage(senderWs, message, origin) {
369
- if (this.seenMessageIds.has(message.id)) {
370
- sendFrame(senderWs, { type: "message_ack", messageId: message.id });
371
- return;
372
- }
373
- this.addToSeenIds(message.id);
374
- const localAgents = listAgents();
375
- if (message.recipients && message.recipients.length > 0) {
376
- for (const recipient of message.recipients) {
377
- const localMatch = localAgents.find((a) => a.id === recipient.id);
378
- if (localMatch) {
379
- appendToInbox(localMatch.id, message);
380
- this.events.onMessageRelayed?.(message.id, origin, localMatch.id);
381
- }
382
- }
383
- } else {
384
- for (const agent of localAgents) {
385
- appendToInbox(agent.id, message);
386
- this.events.onMessageRelayed?.(message.id, origin, agent.id);
387
- }
388
- }
389
- if (this.mode === "server") {
390
- const senderPeerId = this.peerIdForSocket(senderWs);
391
- for (const [peerId, peerWs] of this.connectedPeers) {
392
- if (peerId !== senderPeerId && peerId !== origin) {
393
- sendFrame(peerWs, { type: "message", message, origin });
394
- }
395
- }
396
- }
397
- sendFrame(senderWs, { type: "message_ack", messageId: message.id });
398
- }
399
- /**
400
- * Forward a nomination from a remote agent to local nomination storage.
401
- * Remote nominations are stored in the same nominations.jsonl but tagged with origin.
402
- */
403
- handleNominationForward(senderWs, nomination, origin) {
404
- if (!nomination?.id) return;
405
- const tagged = { ...nomination, remote_origin: origin, forwarded_at: (/* @__PURE__ */ new Date()).toISOString() };
406
- try {
407
- const eventsDir = path.join(os.homedir(), ".paradigm", "events");
408
- fs.mkdirSync(eventsDir, { recursive: true });
409
- const nomPath = path.join(eventsDir, "nominations.jsonl");
410
- fs.appendFileSync(nomPath, JSON.stringify(tagged) + "\n", "utf8");
411
- } catch {
412
- }
413
- if (this.mode === "server") {
414
- for (const [peerId, peerWs] of this.connectedPeers) {
415
- if (peerWs !== senderWs && peerWs.readyState === WebSocket.OPEN) {
416
- sendFrame(peerWs, { type: "nomination_forward", nomination: tagged, origin });
417
- }
418
- }
419
- }
420
- sendFrame(senderWs, { type: "nomination_ack", nominationId: nomination.id });
421
- }
422
- /**
423
- * Update stored agent list for a peer after receiving agents_sync.
424
- */
425
- handleAgentsSync(ws, agents) {
426
- const peerId = this.peerIdForSocket(ws);
427
- if (peerId) {
428
- updatePeerAgents(peerId, agents);
429
- updatePeerLastSeen(peerId);
430
- }
431
- }
432
- // ────────────────────────────────────────────────────────
433
- // Outbox Watcher
434
- // ────────────────────────────────────────────────────────
435
- /**
436
- * Start polling local agent outboxes for new messages to relay.
437
- *
438
- * Reads each outbox as an array, compares length against the stored
439
- * position, and forwards any new entries to all connected peers.
440
- */
441
- startOutboxWatcher() {
442
- if (this.outboxWatchInterval) return;
443
- this.outboxWatchInterval = setInterval(() => {
444
- if (this.connectedPeers.size === 0) return;
445
- try {
446
- const agents = listAgents();
447
- for (const agent of agents) {
448
- const messages = readOutbox(agent.id);
449
- const lastPosition = this.outboxPositions.get(agent.id) ?? 0;
450
- if (messages.length <= lastPosition) continue;
451
- const newMessages = messages.slice(lastPosition);
452
- for (const msg of newMessages) {
453
- if (this.seenMessageIds.has(msg.id)) continue;
454
- this.addToSeenIds(msg.id);
455
- const frame = {
456
- type: "message",
457
- message: msg,
458
- origin: this.myPeerId
459
- };
460
- for (const [_peerId, peerWs] of this.connectedPeers) {
461
- sendFrame(peerWs, frame);
462
- }
463
- }
464
- this.outboxPositions.set(agent.id, messages.length);
465
- }
466
- } catch (err) {
467
- this.events.onError?.(err instanceof Error ? err : new Error(String(err)));
468
- }
469
- }, OUTBOX_POLL_INTERVAL_MS);
470
- }
471
- /**
472
- * Stop the outbox watcher.
473
- */
474
- stopOutboxWatcher() {
475
- if (this.outboxWatchInterval) {
476
- clearInterval(this.outboxWatchInterval);
477
- this.outboxWatchInterval = null;
478
- }
479
- }
480
- // ────────────────────────────────────────────────────────
481
- // Keepalive
482
- // ────────────────────────────────────────────────────────
483
- /**
484
- * Start periodic ping/pong keepalive for all connected peers.
485
- */
486
- startKeepalive() {
487
- if (this.keepaliveInterval) return;
488
- this.keepaliveInterval = setInterval(() => {
489
- for (const [peerId, ws] of this.connectedPeers) {
490
- sendFrame(ws, { type: "ping" });
491
- const timer = setTimeout(() => {
492
- this.handlePeerDisconnect(ws);
493
- ws.terminate();
494
- }, PONG_TIMEOUT_MS);
495
- this.pongTimers.set(peerId, timer);
496
- }
497
- }, KEEPALIVE_INTERVAL_MS);
498
- }
499
- /**
500
- * Stop keepalive pings.
501
- */
502
- stopKeepalive() {
503
- if (this.keepaliveInterval) {
504
- clearInterval(this.keepaliveInterval);
505
- this.keepaliveInterval = null;
506
- }
507
- for (const timer of this.pongTimers.values()) {
508
- clearTimeout(timer);
509
- }
510
- this.pongTimers.clear();
511
- }
512
- /**
513
- * Handle a pong response — clear the dead-connection timer.
514
- */
515
- handlePong(ws) {
516
- const peerId = this.peerIdForSocket(ws);
517
- if (peerId) {
518
- const timer = this.pongTimers.get(peerId);
519
- if (timer) {
520
- clearTimeout(timer);
521
- this.pongTimers.delete(peerId);
522
- }
523
- updatePeerLastSeen(peerId);
524
- }
525
- }
526
- // ────────────────────────────────────────────────────────
527
- // Peer Lifecycle
528
- // ────────────────────────────────────────────────────────
529
- /**
530
- * Register an authenticated peer connection.
531
- */
532
- registerPeerConnection(peerId, ws) {
533
- const existing = this.connectedPeers.get(peerId);
534
- if (existing && existing !== ws) {
535
- existing.close();
536
- }
537
- this.connectedPeers.set(peerId, ws);
538
- updatePeerLastSeen(peerId);
539
- this.events.onPeerConnected?.(peerId, peerId);
540
- }
541
- /**
542
- * Clean up after a peer disconnects (or is terminated).
543
- */
544
- handlePeerDisconnect(ws) {
545
- const peerId = this.peerIdForSocket(ws);
546
- if (!peerId) return;
547
- this.connectedPeers.delete(peerId);
548
- const timer = this.pongTimers.get(peerId);
549
- if (timer) {
550
- clearTimeout(timer);
551
- this.pongTimers.delete(peerId);
552
- }
553
- this.events.onPeerDisconnected?.(peerId);
554
- }
555
- /**
556
- * Find the peerId associated with a WebSocket connection.
557
- */
558
- peerIdForSocket(ws) {
559
- for (const [peerId, peerWs] of this.connectedPeers) {
560
- if (peerWs === ws) return peerId;
561
- }
562
- return null;
563
- }
564
- // ────────────────────────────────────────────────────────
565
- // Reconnect (Client Mode)
566
- // ────────────────────────────────────────────────────────
567
- /**
568
- * Schedule an automatic reconnect with exponential backoff.
569
- */
570
- scheduleReconnect() {
571
- if (this.stopped || this.mode !== "client") return;
572
- if (!this.serverAddress || !this.serverCode) return;
573
- this.stopOutboxWatcher();
574
- this.stopKeepalive();
575
- this.wsClient = null;
576
- const delay = this.reconnectDelay;
577
- this.reconnectDelay = Math.min(this.reconnectDelay * 2, RECONNECT_MAX_MS);
578
- this.reconnectTimer = setTimeout(() => {
579
- if (this.stopped) return;
580
- this.attemptConnection(this.serverAddress, this.serverCode).catch((err) => {
581
- this.events.onError?.(err instanceof Error ? err : new Error(String(err)));
582
- });
583
- }, delay);
584
- }
585
- // ────────────────────────────────────────────────────────
586
- // Rate Limiting
587
- // ────────────────────────────────────────────────────────
588
- /**
589
- * Check whether an address is currently rate-limited.
590
- */
591
- isRateLimited(address) {
592
- const entry = this.failedAuthAttempts.get(address);
593
- if (!entry) return false;
594
- if (Date.now() < entry.cooldownUntil) return true;
595
- if (entry.count >= MAX_AUTH_ATTEMPTS) {
596
- entry.cooldownUntil = Date.now() + AUTH_COOLDOWN_MS;
597
- return true;
598
- }
599
- return false;
600
- }
601
- /**
602
- * Record a failed auth attempt from a given address.
603
- */
604
- recordFailedAuth(address) {
605
- const entry = this.failedAuthAttempts.get(address);
606
- if (entry) {
607
- entry.count++;
608
- } else {
609
- this.failedAuthAttempts.set(address, { count: 1, cooldownUntil: 0 });
610
- }
611
- }
612
- // ────────────────────────────────────────────────────────
613
- // Dedup
614
- // ────────────────────────────────────────────────────────
615
- /**
616
- * Add a message ID to the dedup set, evicting the oldest half when
617
- * the set exceeds {@link MAX_SEEN_IDS}.
618
- */
619
- addToSeenIds(messageId) {
620
- this.seenMessageIds.add(messageId);
621
- if (this.seenMessageIds.size > _SymphonyRelay.MAX_SEEN_IDS) {
622
- const entries = Array.from(this.seenMessageIds);
623
- const keepFrom = Math.floor(entries.length / 2);
624
- this.seenMessageIds = new Set(entries.slice(keepFrom));
625
- }
626
- }
627
- // ────────────────────────────────────────────────────────
628
- // Local Agent Helpers
629
- // ────────────────────────────────────────────────────────
630
- /**
631
- * Build a summary list of all locally registered agents.
632
- */
633
- getLocalAgentSummaries() {
634
- return listAgents().map((a) => ({
635
- id: a.id,
636
- project: a.project,
637
- role: a.role,
638
- status: isAgentAsleep(a) ? "asleep" : "awake"
639
- }));
640
- }
641
- // ────────────────────────────────────────────────────────
642
- // Public API
643
- // ────────────────────────────────────────────────────────
644
- /**
645
- * Gracefully shut down the relay.
646
- *
647
- * Sends `peer_leaving` to all connected peers, closes every WebSocket,
648
- * clears all timers, and shuts down the server (if running).
649
- */
650
- stop() {
651
- this.stopped = true;
652
- for (const [_peerId, ws] of this.connectedPeers) {
653
- sendFrame(ws, { type: "peer_leaving" });
654
- ws.close();
655
- }
656
- this.connectedPeers.clear();
657
- if (this.wsClient) {
658
- this.wsClient.close();
659
- this.wsClient = null;
660
- }
661
- this.stopOutboxWatcher();
662
- this.stopKeepalive();
663
- if (this.reconnectTimer) {
664
- clearTimeout(this.reconnectTimer);
665
- this.reconnectTimer = null;
666
- }
667
- if (this.wss) {
668
- this.wss.close();
669
- this.wss = null;
670
- }
671
- }
672
- /**
673
- * Return the list of currently connected peer IDs.
674
- */
675
- getConnectedPeers() {
676
- return Array.from(this.connectedPeers.keys());
677
- }
678
- /**
679
- * Return the aggregated agent summaries from all connected peers.
680
- */
681
- getRemoteAgents() {
682
- const result = [];
683
- const peers = loadPeers();
684
- for (const peerId of this.connectedPeers.keys()) {
685
- const peer = peers.find((p) => p.id === peerId);
686
- if (peer?.agents) {
687
- for (const agent of peer.agents) {
688
- result.push({ ...agent, peerId });
689
- }
690
- }
691
- }
692
- return result;
693
- }
694
- /**
695
- * Generate a new pairing code, invalidating the previous one.
696
- *
697
- * Only meaningful in server mode — clients don't generate pairing codes.
698
- */
699
- rotatePairingCode() {
700
- if (this.mode !== "server") {
701
- throw new Error('rotatePairingCode() requires mode "server"');
702
- }
703
- this.pairingState = generatePairing();
704
- return this.pairingState;
705
- }
706
- };
707
- export {
708
- SCORE_DIR,
709
- SymphonyRelay
710
- };