@a-company/paradigm 5.37.11 → 6.0.2

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 (362) hide show
  1. package/dist/{accept-orchestration-SBZVK3H4.js → accept-orchestration-QQISPINV.js} +1 -1
  2. package/dist/add-UOR4INIV.js +8 -0
  3. package/dist/{agent-loader-RIVI6QPP.js → agent-loader-2WJHD46U.js} +1 -1
  4. package/dist/{agent-loader-RJRVO5GQ.js → agent-loader-YKS2PQWO.js} +1 -1
  5. package/dist/{aggregate-W66DM3GA.js → aggregate-A5S5MTCC.js} +1 -1
  6. package/dist/{ambient-76YMUA5Q.js → ambient-BE3SQXNN.js} +1 -1
  7. package/dist/{ambient-WTLYUAQM.js → ambient-NVKQCW2A.js} +12 -12
  8. package/dist/{assess-UFPYEJKP.js → assess-63WXHWJV.js} +1 -1
  9. package/dist/{beacon-5QVYV5DF.js → beacon-QVUD3MGP.js} +1 -1
  10. package/dist/{calibration-OLJYB5HN.js → calibration-BDHGYJOK.js} +1 -1
  11. package/dist/{chunk-SI6SV76D.js → chunk-3DZK54RU.js} +72 -19
  12. package/dist/{chunk-CHVQNRRT.js → chunk-4PSD5R7N.js} +2 -2
  13. package/dist/chunk-6SKSV5B2.js +24 -0
  14. package/dist/{chunk-KFNHCQ4R.js → chunk-FEYOQMZ5.js} +1 -1
  15. package/dist/{chunk-NEJ4ZLCY.js → chunk-GAFKOFAV.js} +1 -1
  16. package/dist/chunk-GRZQIKST.js +2 -0
  17. package/dist/{chunk-RLCH7DXQ.js → chunk-K7X3Z3GL.js} +1 -1
  18. package/dist/chunk-LPBCQM5Y.js +6 -0
  19. package/dist/{chunk-T6IDXUUA.js → chunk-LWAIVOSF.js} +1 -1
  20. package/dist/{chunk-74SGKSRQ.js → chunk-M2HKWR25.js} +1 -1
  21. package/dist/{chunk-BOYQAMGC.js → chunk-M3PPXJU4.js} +1 -1
  22. package/dist/chunk-PHEX6LU4.js +111 -0
  23. package/dist/chunk-Q527BPUF.js +2 -0
  24. package/dist/chunk-R5ECMBIV.js +11 -0
  25. package/dist/{chunk-X3U3IGYT.js → chunk-TBWWFRL5.js} +1 -1
  26. package/dist/{chunk-MQIG6SMF.js → chunk-TNVWGPCE.js} +1 -1
  27. package/dist/{chunk-SUU6M4JH.js → chunk-TOYQ2QCB.js} +1 -1
  28. package/dist/chunk-TZDYIPVU.js +521 -0
  29. package/dist/{chunk-3XGNXXCT.js → chunk-UZ5H7K6Q.js} +1 -1
  30. package/dist/chunk-VIG5LSGZ.js +2 -0
  31. package/dist/chunk-VNIX5KBT.js +3 -0
  32. package/dist/{chunk-AGFPVSX5.js → chunk-VXIIVMTM.js} +1 -1
  33. package/dist/{chunk-ORDKEGII.js → chunk-WESTEMIM.js} +1 -1
  34. package/dist/{chunk-LBQBWIEX.js → chunk-Y4P4SGZV.js} +1 -1
  35. package/dist/{chunk-DOCDDDTD.js → chunk-YNDPSWOE.js} +5 -5
  36. package/dist/chunk-Z5QW6USC.js +2 -0
  37. package/dist/chunk-ZJQY5PPP.js +7 -0
  38. package/dist/{commands-LMUD5L6R.js → commands-ANRJNG2W.js} +1 -1
  39. package/dist/compliance-BNFWQPKM.js +6 -0
  40. package/dist/config-schema-FLHRVZMI.js +2 -0
  41. package/dist/{constellation-CG7C4WFE.js → constellation-NWLXYATA.js} +1 -1
  42. package/dist/{context-audit-XRPT3OU2.js → context-audit-JVCA6GSV.js} +1 -1
  43. package/dist/{cost-IDNVMAEV.js → cost-24UZSS2P.js} +1 -1
  44. package/dist/{cursorrules-U5O4G5T4.js → cursorrules-ZXPXPZ3P.js} +1 -1
  45. package/dist/decision-loader-HELL2AMX.js +2 -0
  46. package/dist/{delete-P5VULXR4.js → delete-2C6ALLYY.js} +1 -1
  47. package/dist/{diff-JVEYCXUC.js → diff-MF55KQZH.js} +1 -1
  48. package/dist/{dist-KGRCLBJP-2QAPFYNF.js → dist-GQ42YS5N-4HIJZVBB.js} +10 -10
  49. package/dist/dist-JZZJLVMR.js +2 -0
  50. package/dist/{dist-3ZCH25SG.js → dist-OG6MM4VY.js} +1 -1
  51. package/dist/dist-SE67SOXB.js +2 -0
  52. package/dist/{docs-USDAF26F.js → docs-O37YLLRN.js} +1 -1
  53. package/dist/doctor-IG5XM4C4.js +2 -0
  54. package/dist/{edit-GUU3HBVW.js → edit-P3MDAZLU.js} +1 -1
  55. package/dist/{flow-POQP27WA.js → flow-BGXOVE2V.js} +1 -1
  56. package/dist/{hooks-IG2GOAHP.js → hooks-TFMMMB2H.js} +1 -1
  57. package/dist/index.js +6 -6
  58. package/dist/init-M44SO65G.js +2 -0
  59. package/dist/init-V4KSEKPK.js +2 -0
  60. package/dist/{integrity-UYDOOJDP.js → integrity-ROO3G43N.js} +1 -1
  61. package/dist/{list-YKIQNKGB.js → list-2XIWUEMA.js} +1 -1
  62. package/dist/list-CFHINXIS.js +12 -0
  63. package/dist/lore-loader-D2ISOASW.js +2 -0
  64. package/dist/lore-loader-PXFKMKAN.js +2 -0
  65. package/dist/mcp.js +19 -11
  66. package/dist/metrics-UESGUHTA.js +2 -0
  67. package/dist/{migrate-IBDE7VK4.js → migrate-Z5UQN57G.js} +1 -1
  68. package/dist/migrate-assessments-YSITX7KM.js +4 -0
  69. package/dist/migrate-decisions-NPLQOEEH.js +6 -0
  70. package/dist/migrate-plsat-EM2ACIQ3.js +6 -0
  71. package/dist/{nomination-engine-EALA5MGI.js → nomination-engine-QPZJH6XO.js} +1 -1
  72. package/dist/{notebook-loader-PXNRBBXD.js → notebook-loader-3J2OFMS3.js} +1 -1
  73. package/dist/{orchestrate-RCAMBOIB.js → orchestrate-RID7HHHH.js} +1 -1
  74. package/dist/{platform-server-DNAMH4YI.js → platform-server-UD45NTGV.js} +1 -1
  75. package/dist/portal-check-DV2VSJ5E.js +8 -0
  76. package/dist/{portal-compliance-4MG5F2GI.js → portal-compliance-JONQ4SOP.js} +1 -1
  77. package/dist/{probe-B22G2JKF.js → probe-5HAXULAD.js} +1 -1
  78. package/dist/{providers-AWA7WLLM.js → providers-4PXMWA7V.js} +1 -1
  79. package/dist/quiz-WYIZJG5K.js +10 -0
  80. package/dist/{record-YXPB34MY.js → record-N3VNYYKJ.js} +1 -1
  81. package/dist/reindex-FWPD2VGM.js +2 -0
  82. package/dist/{retag-N5XF3KXP.js → retag-72R2OSZV.js} +1 -1
  83. package/dist/{review-77QI6VOC.js → review-2INNWLTW.js} +1 -1
  84. package/dist/{review-6UAH6V3R.js → review-VMSX2PKI.js} +1 -1
  85. package/dist/{ripple-ZGDITCGB.js → ripple-FNZI47SH.js} +1 -1
  86. package/dist/{sentinel-HYAZ3CO5.js → sentinel-EFPEX246.js} +1 -1
  87. package/dist/{sentinel-bridge-VR357PKL.js → sentinel-bridge-UR2MKARY.js} +1 -1
  88. package/dist/sentinel.js +1 -1
  89. package/dist/{serve-U47GULB6.js → serve-MO35XIZE.js} +1 -1
  90. package/dist/serve-OQYUO7CR.js +12 -0
  91. package/dist/{server-4YNUIK4W.js → server-4D77LCST.js} +1 -1
  92. package/dist/server-FGUL2FWQ.js +7 -0
  93. package/dist/session-tracker-KGORN6B5.js +2 -0
  94. package/dist/{session-work-log-PAKXOFGL.js → session-work-log-4IEVE4KK.js} +1 -1
  95. package/dist/{session-work-log-ZP45TREI.js → session-work-log-EE4UIZ33.js} +1 -1
  96. package/dist/{setup-3F5IK7MO.js → setup-ZSEC72BS.js} +2 -2
  97. package/dist/{shift-FDADESC4.js → shift-TVNY2CQF.js} +6 -6
  98. package/dist/{show-PJ5LFLIL.js → show-JH7LJ5MT.js} +1 -1
  99. package/dist/show-WVHAL4VU.js +7 -0
  100. package/dist/{snapshot-L2G56RPL.js → snapshot-3IYB67D4.js} +1 -1
  101. package/dist/{spawn-M5BAV252.js → spawn-UH5RENSE.js} +1 -1
  102. package/dist/{status-77M3SDIF.js → status-DB3KNLW3.js} +1 -1
  103. package/dist/status-S7Z5FVIE.js +6 -0
  104. package/dist/{summary-LXLHFRN7.js → summary-WLI3NF4G.js} +2 -2
  105. package/dist/{sweep-HU74OPVW.js → sweep-7TZFN5NS.js} +1 -1
  106. package/dist/sync-55U6QPIA.js +2 -0
  107. package/dist/{sync-llms-7CAI74QL.js → sync-llms-GF7DDQDI.js} +1 -1
  108. package/dist/team-MGT66HZQ.js +2 -0
  109. package/dist/{test-BQJMS4Y2.js → test-WLEPZQFC.js} +1 -1
  110. package/dist/{timeline-K3ZFKJ3R.js → timeline-RK7O2SCM.js} +1 -1
  111. package/dist/tools-QJHAVYI6.js +2 -0
  112. package/dist/university-content/notes/N-para-001-build-something.md +126 -0
  113. package/dist/university-content/notes/N-para-001-meet-the-team.md +85 -0
  114. package/dist/university-content/notes/N-para-001-shift-setup.md +74 -0
  115. package/dist/university-content/notes/N-para-101-component-types.md +99 -0
  116. package/dist/university-content/notes/N-para-101-first-steps.md +134 -0
  117. package/dist/university-content/notes/N-para-101-five-symbols.md +128 -0
  118. package/dist/university-content/notes/N-para-101-paradigm-logger.md +89 -0
  119. package/dist/university-content/notes/N-para-101-portal-yaml.md +112 -0
  120. package/dist/university-content/notes/N-para-101-project-structure.md +143 -0
  121. package/dist/university-content/notes/N-para-101-purpose-files.md +121 -0
  122. package/dist/university-content/notes/N-para-101-tags-and-classification.md +93 -0
  123. package/dist/university-content/notes/N-para-101-welcome.md +51 -0
  124. package/dist/university-content/notes/N-para-201-architecture-review.md +175 -0
  125. package/dist/university-content/notes/N-para-201-aspect-graph.md +79 -0
  126. package/dist/university-content/notes/N-para-201-aspects-and-anchors.md +112 -0
  127. package/dist/university-content/notes/N-para-201-component-patterns.md +138 -0
  128. package/dist/university-content/notes/N-para-201-cross-cutting-concerns.md +145 -0
  129. package/dist/university-content/notes/N-para-201-disciplines.md +187 -0
  130. package/dist/university-content/notes/N-para-201-flows-deep-dive.md +119 -0
  131. package/dist/university-content/notes/N-para-201-gates-deep-dive.md +165 -0
  132. package/dist/university-content/notes/N-para-201-portal-protocol.md +133 -0
  133. package/dist/university-content/notes/N-para-201-signal-patterns.md +159 -0
  134. package/dist/university-content/notes/N-para-201-symbol-naming.md +149 -0
  135. package/dist/university-content/notes/N-para-301-context-management.md +53 -0
  136. package/dist/university-content/notes/N-para-301-decisions.md +99 -0
  137. package/dist/university-content/notes/N-para-301-doctor-and-validation.md +70 -0
  138. package/dist/university-content/notes/N-para-301-enforcement-levels.md +102 -0
  139. package/dist/university-content/notes/N-para-301-fragility-tracking.md +50 -0
  140. package/dist/university-content/notes/N-para-301-history-system.md +42 -0
  141. package/dist/university-content/notes/N-para-301-navigation-system.md +55 -0
  142. package/dist/university-content/notes/N-para-301-operations-review.md +55 -0
  143. package/dist/university-content/notes/N-para-301-paradigm-shift.md +93 -0
  144. package/dist/university-content/notes/N-para-301-protocols.md +113 -0
  145. package/dist/university-content/notes/N-para-301-ripple-analysis.md +53 -0
  146. package/dist/university-content/notes/N-para-301-sentinel-observability.md +87 -0
  147. package/dist/university-content/notes/N-para-301-sync-and-maintenance.md +57 -0
  148. package/dist/university-content/notes/N-para-301-wisdom-system.md +89 -0
  149. package/dist/university-content/notes/N-para-401-agent-identity.md +99 -0
  150. package/dist/university-content/notes/N-para-401-agent-interop.md +87 -0
  151. package/dist/university-content/notes/N-para-401-agent-roles.md +107 -0
  152. package/dist/university-content/notes/N-para-401-commit-conventions.md +82 -0
  153. package/dist/university-content/notes/N-para-401-mastery-review.md +71 -0
  154. package/dist/university-content/notes/N-para-401-mcp-tools-overview.md +102 -0
  155. package/dist/university-content/notes/N-para-401-multi-agent-coordination.md +80 -0
  156. package/dist/university-content/notes/N-para-401-notebooks-permissions.md +66 -0
  157. package/dist/university-content/notes/N-para-401-orchestration-workflow.md +101 -0
  158. package/dist/university-content/notes/N-para-401-pm-governance.md +71 -0
  159. package/dist/university-content/notes/N-para-401-provider-cascade.md +75 -0
  160. package/dist/university-content/notes/N-para-401-quick-check.md +95 -0
  161. package/dist/university-content/notes/N-para-501-advanced-workflows.md +122 -0
  162. package/dist/university-content/notes/N-para-501-aspect-graph-advanced.md +195 -0
  163. package/dist/university-content/notes/N-para-501-aspect-graph-internals.md +97 -0
  164. package/dist/university-content/notes/N-para-501-assessment-loops.md +116 -0
  165. package/dist/university-content/notes/N-para-501-conductor-workspace.md +77 -0
  166. package/dist/university-content/notes/N-para-501-habits-practice.md +164 -0
  167. package/dist/university-content/notes/N-para-501-hook-enforcement.md +100 -0
  168. package/dist/university-content/notes/N-para-501-lore-system.md +155 -0
  169. package/dist/university-content/notes/N-para-501-platform-agent-ui.md +108 -0
  170. package/dist/university-content/notes/N-para-501-review-compliance.md +72 -0
  171. package/dist/university-content/notes/N-para-501-sentinel-deep-dive.md +173 -0
  172. package/dist/university-content/notes/N-para-501-session-intelligence.md +104 -0
  173. package/dist/university-content/notes/N-para-501-symphony-a-mail.md +120 -0
  174. package/dist/university-content/notes/N-para-501-symphony-networking.md +119 -0
  175. package/dist/university-content/notes/N-para-501-task-management.md +100 -0
  176. package/dist/university-content/notes/N-para-601-agent-renaissance.md +121 -0
  177. package/dist/university-content/notes/N-para-601-attention-scoring.md +129 -0
  178. package/dist/university-content/notes/N-para-601-context-composition.md +146 -0
  179. package/dist/university-content/notes/N-para-601-data-sovereignty.md +140 -0
  180. package/dist/university-content/notes/N-para-601-event-stream.md +126 -0
  181. package/dist/university-content/notes/N-para-601-knowledge-streams.md +144 -0
  182. package/dist/university-content/notes/N-para-601-learning-loop.md +68 -0
  183. package/dist/university-content/notes/N-para-601-maestro-team-collab.md +136 -0
  184. package/dist/university-content/notes/N-para-601-nominations-debates.md +115 -0
  185. package/dist/university-content/notes/N-para-701-agent-notebooks.md +131 -0
  186. package/dist/university-content/notes/N-para-701-agent-pods-nevrland.md +182 -0
  187. package/dist/university-content/notes/N-para-701-agent-profiles.md +197 -0
  188. package/dist/university-content/notes/N-para-701-agent-roster.md +82 -0
  189. package/dist/university-content/notes/N-para-701-agent-state.md +180 -0
  190. package/dist/university-content/notes/N-para-701-learning-feedback-loop.md +188 -0
  191. package/dist/university-content/notes/N-para-701-model-tier-resolution.md +204 -0
  192. package/dist/university-content/notes/N-para-701-orchestration-enforcement.md +169 -0
  193. package/dist/university-content/notes/N-para-701-per-project-rosters.md +198 -0
  194. package/dist/university-content/notes/N-para-701-symphony-visibility.md +142 -0
  195. package/dist/university-content/paths/LP-para-001.yaml +29 -0
  196. package/dist/university-content/paths/LP-para-101.yaml +59 -0
  197. package/dist/university-content/paths/LP-para-201.yaml +69 -0
  198. package/dist/university-content/paths/LP-para-301.yaml +84 -0
  199. package/dist/university-content/paths/LP-para-401.yaml +74 -0
  200. package/dist/university-content/paths/LP-para-501.yaml +89 -0
  201. package/dist/university-content/paths/LP-para-601.yaml +59 -0
  202. package/dist/university-content/paths/LP-para-701.yaml +64 -0
  203. package/dist/university-content/quizzes/Q-para-001-build-something.yaml +46 -0
  204. package/dist/university-content/quizzes/Q-para-001-meet-the-team.yaml +46 -0
  205. package/dist/university-content/quizzes/Q-para-001-shift-setup.yaml +46 -0
  206. package/dist/university-content/quizzes/Q-para-101-component-types.yaml +46 -0
  207. package/dist/university-content/quizzes/Q-para-101-first-steps.yaml +56 -0
  208. package/dist/university-content/quizzes/Q-para-101-five-symbols.yaml +66 -0
  209. package/dist/university-content/quizzes/Q-para-101-paradigm-logger.yaml +56 -0
  210. package/dist/university-content/quizzes/Q-para-101-portal-yaml.yaml +56 -0
  211. package/dist/university-content/quizzes/Q-para-101-project-structure.yaml +66 -0
  212. package/dist/university-content/quizzes/Q-para-101-purpose-files.yaml +56 -0
  213. package/dist/university-content/quizzes/Q-para-101-tags-and-classification.yaml +56 -0
  214. package/dist/university-content/quizzes/Q-para-101-welcome.yaml +56 -0
  215. package/dist/university-content/quizzes/Q-para-201-architecture-review.yaml +66 -0
  216. package/dist/university-content/quizzes/Q-para-201-aspect-graph.yaml +46 -0
  217. package/dist/university-content/quizzes/Q-para-201-aspects-and-anchors.yaml +56 -0
  218. package/dist/university-content/quizzes/Q-para-201-component-patterns.yaml +56 -0
  219. package/dist/university-content/quizzes/Q-para-201-cross-cutting-concerns.yaml +56 -0
  220. package/dist/university-content/quizzes/Q-para-201-disciplines.yaml +66 -0
  221. package/dist/university-content/quizzes/Q-para-201-flows-deep-dive.yaml +66 -0
  222. package/dist/university-content/quizzes/Q-para-201-gates-deep-dive.yaml +66 -0
  223. package/dist/university-content/quizzes/Q-para-201-portal-protocol.yaml +56 -0
  224. package/dist/university-content/quizzes/Q-para-201-signal-patterns.yaml +56 -0
  225. package/dist/university-content/quizzes/Q-para-201-symbol-naming.yaml +66 -0
  226. package/dist/university-content/quizzes/Q-para-301-context-management.yaml +56 -0
  227. package/dist/university-content/quizzes/Q-para-301-decisions.yaml +76 -0
  228. package/dist/university-content/quizzes/Q-para-301-doctor-and-validation.yaml +66 -0
  229. package/dist/university-content/quizzes/Q-para-301-enforcement-levels.yaml +46 -0
  230. package/dist/university-content/quizzes/Q-para-301-fragility-tracking.yaml +46 -0
  231. package/dist/university-content/quizzes/Q-para-301-history-system.yaml +56 -0
  232. package/dist/university-content/quizzes/Q-para-301-navigation-system.yaml +56 -0
  233. package/dist/university-content/quizzes/Q-para-301-operations-review.yaml +66 -0
  234. package/dist/university-content/quizzes/Q-para-301-paradigm-shift.yaml +46 -0
  235. package/dist/university-content/quizzes/Q-para-301-protocols.yaml +56 -0
  236. package/dist/university-content/quizzes/Q-para-301-ripple-analysis.yaml +56 -0
  237. package/dist/university-content/quizzes/Q-para-301-sentinel-observability.yaml +46 -0
  238. package/dist/university-content/quizzes/Q-para-301-sync-and-maintenance.yaml +46 -0
  239. package/dist/university-content/quizzes/Q-para-301-wisdom-system.yaml +56 -0
  240. package/dist/university-content/quizzes/Q-para-401-agent-identity.yaml +66 -0
  241. package/dist/university-content/quizzes/Q-para-401-agent-interop.yaml +46 -0
  242. package/dist/university-content/quizzes/Q-para-401-agent-roles.yaml +56 -0
  243. package/dist/university-content/quizzes/Q-para-401-commit-conventions.yaml +56 -0
  244. package/dist/university-content/quizzes/Q-para-401-mastery-review.yaml +66 -0
  245. package/dist/university-content/quizzes/Q-para-401-mcp-tools-overview.yaml +66 -0
  246. package/dist/university-content/quizzes/Q-para-401-multi-agent-coordination.yaml +76 -0
  247. package/dist/university-content/quizzes/Q-para-401-notebooks-permissions.yaml +61 -0
  248. package/dist/university-content/quizzes/Q-para-401-orchestration-workflow.yaml +66 -0
  249. package/dist/university-content/quizzes/Q-para-401-pm-governance.yaml +66 -0
  250. package/dist/university-content/quizzes/Q-para-401-provider-cascade.yaml +56 -0
  251. package/dist/university-content/quizzes/Q-para-401-quick-check.yaml +46 -0
  252. package/dist/university-content/quizzes/Q-para-501-advanced-workflows.yaml +66 -0
  253. package/dist/university-content/quizzes/Q-para-501-aspect-graph-advanced.yaml +66 -0
  254. package/dist/university-content/quizzes/Q-para-501-aspect-graph-internals.yaml +66 -0
  255. package/dist/university-content/quizzes/Q-para-501-assessment-loops.yaml +46 -0
  256. package/dist/university-content/quizzes/Q-para-501-conductor-workspace.yaml +46 -0
  257. package/dist/university-content/quizzes/Q-para-501-habits-practice.yaml +56 -0
  258. package/dist/university-content/quizzes/Q-para-501-hook-enforcement.yaml +66 -0
  259. package/dist/university-content/quizzes/Q-para-501-lore-system.yaml +66 -0
  260. package/dist/university-content/quizzes/Q-para-501-platform-agent-ui.yaml +66 -0
  261. package/dist/university-content/quizzes/Q-para-501-review-compliance.yaml +61 -0
  262. package/dist/university-content/quizzes/Q-para-501-sentinel-deep-dive.yaml +86 -0
  263. package/dist/university-content/quizzes/Q-para-501-session-intelligence.yaml +66 -0
  264. package/dist/university-content/quizzes/Q-para-501-symphony-a-mail.yaml +66 -0
  265. package/dist/university-content/quizzes/Q-para-501-symphony-networking.yaml +66 -0
  266. package/dist/university-content/quizzes/Q-para-501-task-management.yaml +46 -0
  267. package/dist/university-content/quizzes/Q-para-601-agent-renaissance.yaml +66 -0
  268. package/dist/university-content/quizzes/Q-para-601-attention-scoring.yaml +56 -0
  269. package/dist/university-content/quizzes/Q-para-601-context-composition.yaml +66 -0
  270. package/dist/university-content/quizzes/Q-para-601-data-sovereignty.yaml +56 -0
  271. package/dist/university-content/quizzes/Q-para-601-event-stream.yaml +66 -0
  272. package/dist/university-content/quizzes/Q-para-601-knowledge-streams.yaml +66 -0
  273. package/dist/university-content/quizzes/Q-para-601-learning-loop.yaml +56 -0
  274. package/dist/university-content/quizzes/Q-para-601-maestro-team-collab.yaml +86 -0
  275. package/dist/university-content/quizzes/Q-para-601-nominations-debates.yaml +66 -0
  276. package/dist/university-content/quizzes/Q-para-701-agent-notebooks.yaml +66 -0
  277. package/dist/university-content/quizzes/Q-para-701-agent-pods-nevrland.yaml +66 -0
  278. package/dist/university-content/quizzes/Q-para-701-agent-profiles.yaml +66 -0
  279. package/dist/university-content/quizzes/Q-para-701-agent-roster.yaml +66 -0
  280. package/dist/university-content/quizzes/Q-para-701-agent-state.yaml +66 -0
  281. package/dist/university-content/quizzes/Q-para-701-learning-feedback-loop.yaml +66 -0
  282. package/dist/university-content/quizzes/Q-para-701-model-tier-resolution.yaml +66 -0
  283. package/dist/university-content/quizzes/Q-para-701-orchestration-enforcement.yaml +66 -0
  284. package/dist/university-content/quizzes/Q-para-701-per-project-rosters.yaml +66 -0
  285. package/dist/university-content/quizzes/Q-para-701-symphony-visibility.yaml +66 -0
  286. package/dist/university-content/quizzes/Q-plsat-v2.yaml +904 -0
  287. package/dist/university-content/quizzes/Q-plsat-v3.yaml +2909 -0
  288. package/dist/university-content/reference.json +2 -2
  289. package/dist/university-ui/assets/{index-CecQrfSn.js → index-nNgzO1il.js} +2 -2
  290. package/dist/university-ui/assets/{index-CecQrfSn.js.map → index-nNgzO1il.js.map} +1 -1
  291. package/dist/university-ui/index.html +1 -1
  292. package/dist/{upgrade-GX56QE3C.js → upgrade-NKN63VTY.js} +2 -2
  293. package/dist/{validate-VZXTJHGO.js → validate-BB6LRWIY.js} +1 -1
  294. package/dist/validate-XUQZTF3H.js +9 -0
  295. package/dist/{watch-YCODNIET.js → watch-25GJHQYT.js} +1 -1
  296. package/dist/workspace-VMSPYIBV.js +2 -0
  297. package/lore-ui/dist/assets/{index-Bk-K0qgN.js → index-DKhNxgtW.js} +10 -10
  298. package/lore-ui/dist/index.html +1 -1
  299. package/package.json +3 -2
  300. package/platform-ui/dist/assets/{AmbientSection-BYjt75R1.js → AmbientSection-CwatqcBD.js} +1 -1
  301. package/platform-ui/dist/assets/{CanvasSection-rKvA_vZj.js → CanvasSection-dFAthehN.js} +1 -1
  302. package/platform-ui/dist/assets/{DocsSection-CI9K73M-.js → DocsSection-BZ2SFJBZ.js} +1 -1
  303. package/platform-ui/dist/assets/{GitSection-DSGj_c6S.js → GitSection-MNNYU1tO.js} +1 -1
  304. package/platform-ui/dist/assets/{GraphSection-CawN7pC5.js → GraphSection-COYjb4Pt.js} +1 -1
  305. package/platform-ui/dist/assets/LoreSection-B0hUbfsJ.js +1 -0
  306. package/platform-ui/dist/assets/{SentinelSection-DNgoYMH0.js → SentinelSection-BCxW1DCp.js} +1 -1
  307. package/platform-ui/dist/assets/{SymphonySection-C0zfcqv3.js → SymphonySection-BsucZRqy.js} +1 -1
  308. package/platform-ui/dist/assets/{TeamSection-Bzd3Dt9Q.js → TeamSection-C0QNTudW.js} +1 -1
  309. package/platform-ui/dist/assets/{UniversitySection-tBr62R0S.js → UniversitySection-DN1-g9pw.js} +1 -1
  310. package/platform-ui/dist/assets/{index-BaOmyn11.js → index-DwUT8pju.js} +2 -2
  311. package/platform-ui/dist/index.html +1 -1
  312. package/templates/paradigm/specs/symbols.md +4 -2
  313. package/dist/add-P76GEMGF.js +0 -8
  314. package/dist/chunk-3TR6LLXP.js +0 -111
  315. package/dist/chunk-G7XFK2GI.js +0 -11
  316. package/dist/chunk-J6KWGCHN.js +0 -24
  317. package/dist/chunk-JQKKVAAN.js +0 -2
  318. package/dist/chunk-ODVKPZZ4.js +0 -2
  319. package/dist/chunk-Q2J542ST.js +0 -2
  320. package/dist/chunk-QT2LKB3P.js +0 -7
  321. package/dist/chunk-SHD27BQX.js +0 -6
  322. package/dist/chunk-WS2N27RX.js +0 -3
  323. package/dist/chunk-YT52WLBF.js +0 -521
  324. package/dist/compliance-WJINB5DM.js +0 -6
  325. package/dist/config-schema-GUQY2QN7.js +0 -2
  326. package/dist/decision-loader-2XPZE4EZ.js +0 -2
  327. package/dist/dist-R3RWD35F.js +0 -2
  328. package/dist/dist-VXCZWVVJ.js +0 -2
  329. package/dist/doctor-QJ47XAUP.js +0 -2
  330. package/dist/init-HIBRSVUB.js +0 -2
  331. package/dist/list-5IUGP3ZB.js +0 -7
  332. package/dist/lore-loader-RVQI5GXL.js +0 -2
  333. package/dist/lore-loader-XY5MZRR2.js +0 -2
  334. package/dist/migrate-assessments-GEI5WMI2.js +0 -4
  335. package/dist/portal-check-Z3OCQEQR.js +0 -8
  336. package/dist/quiz-FE5UGAY2.js +0 -10
  337. package/dist/reindex-FO5VMZVQ.js +0 -2
  338. package/dist/serve-OY6XYL7F.js +0 -12
  339. package/dist/server-2MNROHF6.js +0 -7
  340. package/dist/session-tracker-MWJAJA6Z.js +0 -2
  341. package/dist/show-BOAVWZPZ.js +0 -7
  342. package/dist/status-A37ECYNJ.js +0 -6
  343. package/dist/sync-DLUBV5HQ.js +0 -2
  344. package/dist/team-NSP6PMPS.js +0 -2
  345. package/dist/tools-CERDNVCG.js +0 -2
  346. package/dist/university-content/courses/.purpose +0 -492
  347. package/dist/university-content/courses/para-001.json +0 -166
  348. package/dist/university-content/courses/para-101.json +0 -615
  349. package/dist/university-content/courses/para-201.json +0 -794
  350. package/dist/university-content/courses/para-301.json +0 -830
  351. package/dist/university-content/courses/para-401.json +0 -868
  352. package/dist/university-content/courses/para-501.json +0 -1166
  353. package/dist/university-content/courses/para-601.json +0 -719
  354. package/dist/university-content/courses/para-701.json +0 -807
  355. package/dist/university-content/plsat/.purpose +0 -162
  356. package/dist/university-content/plsat/v2.0.json +0 -760
  357. package/dist/university-content/plsat/v3.0.json +0 -3453
  358. package/dist/validate-C6SMKGYD.js +0 -9
  359. package/dist/workspace-MKSQN7B2.js +0 -2
  360. package/platform-ui/dist/assets/LoreSection-oO5dCe6O.js +0 -1
  361. /package/dist/{chunk-BV5PRPLB.js → chunk-IZSBGW6E.js} +0 -0
  362. /package/templates/paradigm/specs/{scan.md → probe.md} +0 -0
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import {a as a$3}from'./chunk-TYWB5IQJ.js';import {b,a as a$1}from'./chunk-WESTEMIM.js';import {a}from'./chunk-FYDRENK7.js';import {e}from'./chunk-AO7ZSRME.js';import {b as b$1}from'./chunk-EKZDFEJW.js';import {a as a$2,b as b$2}from'./chunk-LPBCQM5Y.js';import {o,t,x}from'./chunk-LWAIVOSF.js';import'minimatch';import*as w from'fs';import*as A from'path';import*as F from'js-yaml';import {spawn}from'child_process';var ee=["should","what","how","why","recommend","analyze","compare","evaluate","assess","review","explain","describe","investigate","which","best practice","trade-off","tradeoff","pros and cons","decision"],te=["document","write docs","readme",".purpose","purpose file","jsdoc","tsdoc","comments","docstring","api docs","changelog","architecture doc"],se=["bug","fix","broken","not working","issue","error","crash","fails","failing","wrong","incorrect","doesn't work","doesn't","cant","can't","regression","patch"],re=["rename","refactor","migrate","restructure","move","reorganize","clean up","cleanup","consolidate","extract","inline","simplify","modularize","decouple","split","merge"],ne=["auth","authentication","authorization","permission","admin","delete","purge","password","credential","token","secret","key","encrypt","decrypt","hash","session","oauth","jwt","api key","role","access","gate","portal","sensitive","private","security","vulnerability","xss","sql injection","csrf"],oe=/[@#$%^!?&~][a-zA-Z0-9_-]+/g,Y={analysis:{agents:["architect"],models:{architect:"opus"},costMultiplier:{min:.3,max:.5}},documentation:{agents:["architect"],models:{architect:"sonnet"},costMultiplier:{min:.25,max:.45}},bugfix:{agents:["security","builder"],models:{security:"opus",builder:"haiku"},costMultiplier:{min:.5,max:.8}},refactor:{agents:["architect","builder"],models:{architect:"opus",builder:"haiku"},costMultiplier:{min:.6,max:.85}},feature:{agents:["architect","security","builder","tester"],models:{architect:"opus",security:"opus",builder:"haiku",tester:"haiku"},costMultiplier:{min:.8,max:1.2}}};function ie(p){let s=p.match(oe)||[];return [...new Set(s)]}function $(p,s){let e=p.toLowerCase();return s.filter(t=>e.includes(t.toLowerCase()))}function ae(p,s,e,t){let n=0;e.length>=5?n+=2:e.length>=2&&(n+=1);let o=p.split(/\s+/).length;o>=100?n+=2:o>=50&&(n+=1);let r=new Set(e.map(a=>a[0]));return r.size>=4?n+=2:r.size>=2&&(n+=1),e.some(a=>a.startsWith("^"))&&(n+=1),e.some(a=>a.startsWith("$"))&&(n+=1),s==="feature"&&(n+=1),s==="refactor"&&(n+=1),n>=5?"high":n>=2?"medium":"low"}function le(p,s,e){if($(p,ne).length>0||s.some(n=>n.startsWith("^")))return true;return false}function K(p,s){let e=ie(p),t=$(p,ee),n=$(p,te),o=$(p,se),r=$(p,re),a,i;t.length>0&&o.length===0&&r.length===0?(a="analysis",i=t):n.length>0&&o.length===0?(a="documentation",i=n):o.length>0?(a="bugfix",i=o):r.length>0?(a="refactor",i=r):(a="feature",i=[]);let c=Y[a],d=le(p,e),u=[...c.agents];d&&!u.includes("security")&&(u=["security",...u]);let m=ae(p,a,e),g={...c.costMultiplier};return m==="high"?(g.min*=1.2,g.max*=1.3):m==="low"&&(g.min*=.8,g.max*=.9),d&&!c.agents.includes("security")&&(g.min+=.15,g.max+=.2),{type:a,complexity:m,recommendedAgents:u,securityRequired:d,costMultiplier:g,matchedKeywords:i,symbols:e}}function B(p,s){let e=Y[s.type];return p==="security"&&s.securityRequired?"opus":e.models[p]||"sonnet"}var ce=/[@#$%^!?&~][a-zA-Z][a-zA-Z0-9_-]*/g,ue=[/\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi,/export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi,/export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi,/\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi],de=["endpoint","route","api","handler","get","post","put","patch","delete","rest","crud","controller"];function V(p,s,e$1){let t$1=p.toLowerCase(),n=p.match(ce)||[],o=[...new Set(n)],r=o.map(l=>{let y=t(e$1,l),k=y.length>0?y[0]:null;return {symbol:l,exists:!!k,type:k?.type,description:k?.description}}),a=r.filter(l=>l.exists).map(l=>{let y=x(e$1,l.symbol),k=new Set;for(let S of y){let x$1=x(e$1,S.symbol);for(let P of x$1)P.symbol!==l.symbol&&!y.find(O=>O.symbol===P.symbol)&&k.add(P.symbol);}let f=y.length+k.size,b="low";return f>10?b="high":f>3&&(b="medium"),{symbol:l.symbol,directDependents:y.length,indirectDependents:k.size,impact:b}}),i=a$2(s),c=i.status==="ok"?i.data:null,d={exists:i.status!=="missing",gateCount:c?b$2(c).length:0,gates:c?b$2(c).map(l=>`^${l}`):[],routeCount:c?.routes?Object.keys(c.routes).length:0},u=de.some(l=>t$1.includes(l)),m=e(s),g=m?a$3(p,m.agents).map(l=>({name:l.name,confidence:l.confidence,reason:l.reason})):[],h=[];return r.some(l=>l.exists)&&h.push("ripple-analysis"),u&&h.push("portal-compliance"),o.some(l=>l.startsWith("^"))&&h.push("gate-validation"),o.some(l=>l.startsWith("!"))&&h.push("signal-registration"),h.push("purpose-coverage"),{affectedSymbols:r,rippleAnalysis:a,portalStatus:d,taskAddsRoutes:u,suggestedAgents:g,requiredChecks:h}}function H(p,s,e,t$1){let n=[],o=a$2(e),r=o.status==="ok"?o.data:null,a=r?b$2(r):[],i=r?.routes?Object.keys(r.routes):[];for(let g of p){let h=A.isAbsolute(g)?g:A.join(e,g);if(!w.existsSync(h))continue;let l;try{l=w.readFileSync(h,"utf-8");}catch{continue}for(let y of ue){y.lastIndex=0;let k;for(;(k=y.exec(l))!==null;){let f=k[2]||k[0];f&&f.startsWith("/")&&(!i.some(S=>S.replace(/\s+(GET|POST|PUT|PATCH|DELETE)\s*$/,"").trim()===f)&&r?n.push({type:"missing-portal-gate",severity:"warning",message:`Route "${f}" found in ${A.relative(e,h)} but not declared in portal.yaml`,file:A.relative(e,h),suggestion:"Add this route to portal.yaml with appropriate ^gates. Run paradigm_gates_for_route to get suggestions."}):!r&&f.startsWith("/api/")&&n.push({type:"missing-portal-gate",severity:"warning",message:`API route "${f}" found but no portal.yaml exists`,file:A.relative(e,h),suggestion:"Create portal.yaml to declare gates for API routes. Run: paradigm portal init"}));}}}for(let g of s)t(t$1,g).length===0&&n.push({type:"unregistered-symbol",severity:"error",message:`Symbol "${g}" was touched but is not registered in any .purpose file`,suggestion:`Add "${g}" to the nearest .purpose file. Use paradigm_purpose_add_component or paradigm_purpose_add_signal.`});for(let g of s)if(g.startsWith("^")){let h=g.slice(1);a.includes(h)||n.push({type:"missing-portal-gate",severity:"error",message:`Gate "${g}" is referenced but not declared in portal.yaml`,suggestion:`Add ${g} to portal.yaml with description and check expression.`});}p.length>=5&&s.length>=3&&n.push({type:"uncaptured-wisdom",severity:"warning",message:`Large change (${p.length} files, ${s.length} symbols) \u2014 consider recording architectural decisions`,suggestion:"Use paradigm_wisdom_record to capture any decisions or antipatterns discovered during this task."});let c=n.filter(g=>g.severity==="error").length,d=n.filter(g=>g.severity==="warning").length,u=4,m="pass";return c>0?m="violations":d>0&&(m="warnings"),{status:m,violations:n,summary:{totalChecks:u,passed:u-(c>0?1:0)-(d>0?1:0),warnings:d,errors:c},blocksCompletion:c>0}}var pe={architect:"opus",security:"opus",reviewer:"sonnet",builder:"haiku",tester:"haiku"},he=["auth","permission","admin","delete","purge","password","credential","token","secret","key","encrypt","decrypt","hash","session","oauth","jwt","role","access control","vulnerability","injection","xss","csrf"];function me(p,s){let e=p.toLowerCase(),t=he.some(r=>e.includes(r.toLowerCase())),n=p.includes("^"),o=false;return t||n||o}var ye=["rename","refactor","migrate","restructure","move","reorganize"];function be(p){let s=p.toLowerCase();return ye.some(e=>s.includes(e))}var E=class{spawner;auditLogger;rootDir;constructor(s){this.rootDir=s,this.spawner=new b(s),this.auditLogger=new a(s);}async initialize(){await this.spawner.initialize();}async orchestrate(s,e={}){let t=e.mode||"faceted",n=Date.now(),o$1=this.generateOrchestrationId(),r={success:false,mode:t,orchestrationId:o$1,task:s,agentsSpawned:0,totalTokens:{input:0,output:0,total:0},totalCost:0,duration_ms:0,agentResults:[]};try{let a;if(e.pmGovernance?.enabled)try{let{aggregateFromDirectory:c}=await import('./dist-OG6MM4VY.js'),d=await c(this.rootDir),u=o(d);a=V(s,this.rootDir,u);}catch{}if(t==="solo"){let c=await this.runSoloMode(s,e);r.agentsSpawned=1,r.agentResults=[c],r.success=c.success,c.relay&&(r.totalTokens=c.relay.metrics.tokens_used,r.totalCost=b$1(r.totalTokens,e.orchestratorModel||"opus"));}else {let c=await this.runFacetedMode(s,e);r.agentsSpawned=c.results.length,r.agentResults=c.results,r.totalTokens=c.totalTokens,r.totalCost=c.totalCost,r.success=c.success,r.parallelBuilderStats=c.parallelBuilderStats;}if(e.pmGovernance?.enabled&&a)try{let{aggregateFromDirectory:c}=await import('./dist-OG6MM4VY.js'),d=await c(this.rootDir),u=o(d),m=[],g=[];for(let l of r.agentResults)l.relay?.outputs?.artifacts&&m.push(...l.relay.outputs.artifacts.map(y=>y.path));for(let l of a.affectedSymbols)g.push(l.symbol);let h=H(m,g,this.rootDir,u);r.complianceReport={preflight:a,postflight:h},e.pmGovernance.blockOnViolations&&h.blocksCompletion&&(r.success=!1);}catch{r.complianceReport={preflight:a};}r.duration_ms=Date.now()-n;let i=this.auditLogger.startOrchestration(o$1,s,t);return i.completed=new Date().toISOString(),i.status=r.success?"success":"failed",i.totals={duration_ms:r.duration_ms,tokens:r.totalTokens.total,cost_usd:r.totalCost,agents_spawned:r.agentsSpawned,files_created:0,files_modified:0},this.auditLogger.saveOrchestration(i),r.log=i,r}catch(a){return r.error=a instanceof Error?a.message:String(a),r.duration_ms=Date.now()-n,r}}async compare(s,e={}){let t=await this.orchestrate(s,{...e,mode:"solo"}),n=await this.orchestrate(s,{...e,mode:"faceted"}),o=t.totalTokens.total-n.totalTokens.total,r=t.totalCost-n.totalCost,a=t.duration_ms-n.duration_ms,i="tie";return n.success&&!t.success?i="faceted":t.success&&!n.success?i="solo":n.totalCost<t.totalCost*.8?i="faceted":t.totalCost<n.totalCost*.8&&(i="solo"),{solo:t,faceted:n,comparison:{winner:i,tokensSaved:o,costDiff:r,timeDiff:a,soloSucceeded:t.success,facetedSucceeded:n.success}}}async runSoloMode(s,e$1){let n=e(this.rootDir)?.team.default_agent||"architect",o=e$1.orchestratorModel||"opus",r={model:o,workingDirectory:e$1.workingDirectory||this.rootDir,mcpServerPath:e$1.mcpServerPath,budget:e$1.budget,onMessage:e$1.onMessage?i=>e$1.onMessage("solo",i):void 0,onCheckpoint:e$1.onCheckpoint};e$1.onAgentStart&&e$1.onAgentStart("solo",s,o);let a=await this.spawner.spawn(n,s,r);return e$1.onAgentComplete&&e$1.onAgentComplete("solo",a,o),a}async runFacetedMode(s,e$1){let t=e(this.rootDir);if(!t)return {success:false,results:[],totalTokens:{input:0,output:0,total:0},totalCost:0};let n="";if(be(s)){let h=a$1(s);if(h.length>0){let l=[];l.push(`## Auto-Ripple Analysis
3
+ `),l.push("The following symbols are affected by this refactoring:"),l.push("");for(let y of h.slice(0,5))l.push(`- **${y}**: Check dependencies before renaming/moving`);l.push(""),l.push("**Recommendation:** Run `paradigm_ripple` for each symbol before making changes."),n=l.join(`
4
+ `);}}let o=this.planAgentSequence(s,t.agents),r=this.groupByStage(o),a=[],i={input:0,output:0,total:0},c=0,d=new Map,u=true,m,g=Array.from(r.keys()).sort((h,l)=>h-l);for(let h of g){let l=r.get(h)||[];if(l.length===0)continue;if(e$1.checkpoints?.beforeAgentSpawn&&e$1.onCheckpoint){let f=l.map(S=>S.agent).join(", ");if(!await e$1.onCheckpoint(`Stage ${h}: Spawn ${f}${l.length>1?" (parallel)":""}`)){u=false;break}}let y=l.map(async f=>{let b=e$1.agentBudgets?.[f.agent]?.maxTokens?"haiku":f.model||pe[f.agent]||"sonnet",S="";if(f.dependsOn.length>0){let R=f.dependsOn.map(I=>d.get(I)).filter(Boolean);R.length>0&&(S=R.join(`
5
+
6
+ ---
7
+
8
+ `));}let x=S;f.agent==="architect"&&n&&(x=n+(S?`
9
+
10
+ ---
11
+
12
+ `+S:""));let P=x?`${f.subtask}
13
+
14
+ ## Context from previous agents:
15
+ ${x}`:f.subtask,O={model:b,workingDirectory:e$1.workingDirectory||this.rootDir,mcpServerPath:e$1.mcpServerPath,budget:e$1.agentBudgets?.[f.agent]||e$1.budget,onMessage:e$1.onMessage?R=>e$1.onMessage(f.agent,R):void 0,onCheckpoint:e$1.onCheckpoint};e$1.onAgentStart&&e$1.onAgentStart(f.agent,f.subtask,b);let C=await this.spawner.spawn(f.agent,P,O);return e$1.onAgentComplete&&e$1.onAgentComplete(f.agent,C,b),{step:f,result:C,model:b}}),k=await Promise.all(y);for(let{step:f,result:b,model:S}of k){if(a.push(b),b.relay){i.input+=b.relay.metrics.tokens_used.input,i.output+=b.relay.metrics.tokens_used.output,i.total+=b.relay.metrics.tokens_used.total,c+=b$1(b.relay.metrics.tokens_used,S);let x=b.relay.handoff?.context||`${f.agent} completed: ${b.relay.outputs.decisions.join(", ")||"task done"}`;if(d.set(f.agent,x),f.agent==="architect"&&b.relay){let P=this.extractFilePlanFromRelay(b);if(P&&P.length>0){let O=this.planBuilderStages(P);if(O.hasFilePlan&&O.totalBuilders>1){let C=await this.runParallelBuilders(O,d.get("architect")||"",e$1);a.push(...C.results),i.input+=C.totalTokens.input,i.output+=C.totalTokens.output,i.total+=C.totalTokens.total,c+=C.totalCost,C.success||(u=false),m={usedFilePlan:true,totalSubPhases:O.stages.length,totalParallelBuilders:O.totalBuilders,filesCreated:O.totalFiles};for(let[R,I]of r){let X=I.filter(Q=>Q.agent!=="builder");r.set(R,X);}}}}}!b.success&&f.required&&(u=false);}if(!u||e$1.checkpoints?.afterAgentComplete&&e$1.onCheckpoint&&!await e$1.onCheckpoint(`Stage ${h} completed. Continue to next stage?`))break}return {success:u,results:a,totalTokens:i,totalCost:c,parallelBuilderStats:m}}extractFilePlanFromRelay(s){if(!s.relay)return;let e=s.relay.handoff?.context||"";if(e.includes("filePlan:"))return this.parseFilePlanFromText(e)}parseFilePlanFromText(s){let e=[],t=s.match(/filePlan:\s*\n([\s\S]*?)(?=\n[a-z_]+:|$)/);if(!t)return;let o=t[1].split(`
16
+ `),r=null,a=false,i={};for(let c of o){let d=c.trim();if(!(!d||d.startsWith("#"))){if(d.startsWith("- group:")){r&&(i.path&&(r.files.push({path:i.path,description:i.description||""}),i={}),e.push(r)),r={group:d.split(":")[1].trim(),subPhase:0,files:[]},a=false;continue}if(r){if(d.startsWith("subPhase:")){r.subPhase=parseInt(d.split(":")[1].trim(),10)||0;continue}if(d==="files:"){a=true;continue}if(a){if(d.startsWith("- path:")){i.path&&r.files.push({path:i.path,description:i.description||""}),i={path:d.split(":").slice(1).join(":").trim().replace(/^["']|["']$/g,"")};continue}if(d.startsWith("description:")){i.description=d.split(":").slice(1).join(":").trim().replace(/^["']|["']$/g,"");continue}}}}}return i.path&&r&&r.files.push({path:i.path,description:i.description||""}),r&&e.push(r),e.length>0?e:void 0}planAgentSequence(s,e){let t=a$1(s),n=s.toLowerCase(),o=K(s),r=[],a=me(s);if(o.type==="analysis")return e.architect&&r.push({agent:"architect",subtask:`Analyze and recommend: ${s}`,required:true,stage:0,dependsOn:[],model:"opus"}),r;if(o.type==="documentation")return e.architect&&r.push({agent:"architect",subtask:`Document: ${s}`,required:true,stage:0,dependsOn:[],model:"sonnet"}),r;let i=n.includes("design")||n.includes("architect")||n.includes("plan")||n.includes("spec"),c=a||n.includes("auth")||n.includes("security")||n.includes("gate")||t.some(l=>l.startsWith("^"));if(i&&e.architect&&r.push({agent:"architect",subtask:`Design and specify: ${s}`,required:true,stage:0,dependsOn:[],model:"opus"}),c&&e.security&&r.push({agent:"security",subtask:`Review security aspects of: ${s}`,required:a,stage:0,dependsOn:[],model:"opus"}),(n.includes("build")||n.includes("implement")||n.includes("create")||n.includes("add")||n.includes("fix"))&&e.builder){let l=i&&e.architect?["architect"]:[];r.push({agent:"builder",subtask:`Implement: ${s}`,required:true,stage:l.length>0?1:0,dependsOn:l,model:"haiku"});}let u=n.includes("review")||n.includes("check"),m=n.includes("test")||n.includes("verify")||n.includes("validate"),g=r.some(l=>l.agent==="builder"),h=g?2:i?1:0;if(u&&e.reviewer&&r.push({agent:"reviewer",subtask:`Review: ${s}`,required:false,stage:h,dependsOn:g?["builder"]:[],model:"sonnet"}),m&&e.tester&&r.push({agent:"tester",subtask:`Test and validate: ${s}`,required:false,stage:h,dependsOn:g?["builder"]:[],model:"haiku"}),r.length===0){let l=o.recommendedAgents;if(l.includes("architect")&&e.architect&&r.push({agent:"architect",subtask:`Design: ${s}`,required:true,stage:0,dependsOn:[],model:B("architect",o)}),(l.includes("security")||a)&&e.security&&r.push({agent:"security",subtask:`Security review: ${s}`,required:a,stage:0,dependsOn:[],model:"opus"}),l.includes("builder")&&e.builder){let y=r.length>0;r.push({agent:"builder",subtask:`Implement: ${s}`,required:true,stage:y?1:0,dependsOn:r.filter(k=>k.stage===0).map(k=>k.agent),model:B("builder",o)});}if(l.includes("tester")&&e.tester){let y=r.find(k=>k.agent==="builder")?.stage??0;r.push({agent:"tester",subtask:`Test: ${s}`,required:false,stage:y+1,dependsOn:e.builder?["builder"]:[],model:B("tester",o)});}}return r.sort((l,y)=>l.stage-y.stage)}groupByStage(s){let e=new Map;for(let t of s){let n=e.get(t.stage)||[];n.push({agent:t.agent,subtask:t.subtask,required:t.required,dependsOn:t.dependsOn}),e.set(t.stage,n);}return e}generateOrchestrationId(){let s=new Date().toISOString().slice(0,10),e=Math.random().toString(36).substring(2,8);return `orch-${s}-${e}`}planBuilderStages(s){if(!s||s.length===0)return {hasFilePlan:false,stages:[{subPhase:0,builders:[{agent:"builder",group:"all",files:[],availableFiles:[]}]}],totalFiles:0,totalBuilders:1};let e=new Map;for(let i of s){let c=e.get(i.subPhase)||[];c.push(i),e.set(i.subPhase,c);}let t=[],n=[...e.keys()].sort((i,c)=>i-c),o=[],r=0,a=0;for(let i of n){let c=e.get(i),d=[];for(let u=0;u<c.length;u++){let m=c[u];a+=m.files.length,r++,d.push({agent:`builder-${i}-${u}`,group:m.group,files:m.files,availableFiles:[...o]});}t.push({subPhase:i,builders:d});for(let u of c)for(let m of u.files)o.push(m.path);}return {hasFilePlan:true,stages:t,totalFiles:a,totalBuilders:r}}buildParallelBuilderPrompt(s,e,t,n){let o=[];o.push(`You are a BUILDER agent responsible for implementing the **${n}** group.`),o.push(""),o.push("## Your Assignment"),o.push(""),o.push("### Files to Create:");for(let r of s)o.push(`- \`${r.path}\`: ${r.description}`);if(o.push(""),e.length>0){o.push("### Available Files (already created):"),o.push("These files exist and you can import from them:");for(let r of e)o.push(`- \`${r}\``);o.push("");}return t&&(o.push("### Context from Architect:"),o.push(t),o.push("")),o.push("### Instructions:"),o.push("1. Create ONLY the files assigned to you"),o.push("2. You can import from available files (already created)"),o.push("3. Follow existing patterns in the codebase"),o.push("4. Use the Paradigm logger (not console.log)"),o.push("5. End with the standard Agent Relay block"),o.join(`
17
+ `)}async runParallelBuilders(s,e,t){let n=[],o={input:0,output:0,total:0},r=0,a=true;for(let i of s.stages){if(t.checkpoints?.beforeAgentSpawn&&t.onCheckpoint){let u=i.builders.map(g=>g.group).join(", ");if(!await t.onCheckpoint(`Builder Sub-phase ${i.subPhase}: ${u}${i.builders.length>1?" (parallel)":""}`)){a=false;break}}let c=i.builders.map(async u=>{let m=this.buildParallelBuilderPrompt(u.files,u.availableFiles,e,u.group),g={model:"haiku",workingDirectory:t.workingDirectory||this.rootDir,mcpServerPath:t.mcpServerPath,budget:t.budget,onMessage:t.onMessage?l=>t.onMessage(u.agent,l):void 0,onCheckpoint:t.onCheckpoint};t.onAgentStart&&t.onAgentStart(u.agent,`Implement ${u.group}`,"haiku");let h=await this.spawner.spawn("builder",m,g);return t.onAgentComplete&&t.onAgentComplete(u.agent,h,"haiku"),{builder:u,result:h}}),d=await Promise.all(c);for(let{result:u}of d)n.push(u),u.relay&&(o.input+=u.relay.metrics.tokens_used.input,o.output+=u.relay.metrics.tokens_used.output,o.total+=u.relay.metrics.tokens_used.total,r+=b$1(u.relay.metrics.tokens_used,"haiku")),u.success||(a=false);if(!a||t.checkpoints?.afterAgentComplete&&t.onCheckpoint&&!await t.onCheckpoint(`Sub-phase ${i.subPhase} complete. Continue to next sub-phase?`))break}return {success:a,results:n,totalTokens:o,totalCost:r}}};var J=class{rootDir;orchestrationsDir;constructor(s){this.rootDir=s,this.orchestrationsDir=A.join(s,".paradigm","orchestrations"),this.ensureOrchestrationDir();}async startBackground(s,e={}){let t=this.generateId(),n=A.join(this.orchestrationsDir,`${t}.output`),o=A.join(this.orchestrationsDir,`${t}.log`),r={id:t,task:s,status:"pending",mode:e.mode||"faceted",created:new Date().toISOString(),outputFile:n,logFile:o,artifacts:[]};return this.saveOrchestration(r),this.spawnOrchestration(t,s,e),r}getOrchestration(s){let e=A.join(this.orchestrationsDir,`${s}.yaml`);if(!w.existsSync(e))return null;try{let t=w.readFileSync(e,"utf-8");return F.load(t)}catch{return null}}listOrchestrations(s={}){let e=w.readdirSync(this.orchestrationsDir).filter(n=>n.endsWith(".yaml")&&!n.includes("output")&&!n.includes("log")).sort().reverse(),t=[];for(let n of e){if(s.limit&&t.length>=s.limit)break;let o=A.join(this.orchestrationsDir,n);try{let r=w.readFileSync(o,"utf-8"),a=F.load(r);if(s.status&&!(Array.isArray(s.status)?s.status:[s.status]).includes(a.status))continue;t.push(a);}catch{}}return t}getRunning(){return this.listOrchestrations({status:"running"})}getOutput(s,e={}){let t=this.getOrchestration(s);if(!t||!w.existsSync(t.outputFile))return "";let n=w.readFileSync(t.outputFile,"utf-8");return e.lines?n.split(`
18
+ `).slice(-e.lines).join(`
19
+ `):n}async accept(s,e={}){let t=this.getOrchestration(s);if(!t)return false;if(t.status!=="completed")throw new Error(`Cannot accept orchestration in '${t.status}' status`);return t.status="accepted",this.saveOrchestration(t),true}async reject(s,e={}){let t=this.getOrchestration(s);if(!t)return false;if(t.status!=="completed")throw new Error(`Cannot reject orchestration in '${t.status}' status`);if(t.status="rejected",t.error=e.reason,this.saveOrchestration(t),e.cleanup&&t.artifacts.length>0){for(let n of t.artifacts)if(n.action==="created"){let o=A.join(this.rootDir,n.path);w.existsSync(o)&&w.unlinkSync(o);}}return true}async getDiff(s){let e=this.getOrchestration(s);if(!e)return "";if(e.artifacts.length===0)return "No file changes in this orchestration.";let t=[];t.push(`Orchestration: ${s}`),t.push(`Task: ${e.task}`),t.push(`Status: ${e.status}`),t.push(""),t.push("Files:");for(let n of e.artifacts){let o=n.action==="created"?"+":n.action==="modified"?"~":"-";t.push(` ${o} ${n.path}`);}return t.join(`
20
+ `)}markComplete(s,e){let t=this.getOrchestration(s);if(t){t.status=e.success?"completed":"failed",t.completed=new Date().toISOString(),t.result=e,t.parallelBuilderStats=e.parallelBuilderStats;for(let n of e.agentResults)if(n.relay?.outputs.artifacts)for(let o of n.relay.outputs.artifacts)t.artifacts.push(o);this.saveOrchestration(t);}}async notify(s,e=["bell"]){let t=this.getOrchestration(s);if(t)for(let n of e)switch(n){case "bell":process.stdout.write("\x07");break;case "desktop":try{process.platform==="darwin"?spawn("osascript",["-e",`display notification "Orchestration ${t.status}: ${t.task.slice(0,50)}" with title "Paradigm"`]):spawn("notify-send",["Paradigm",`Orchestration ${t.status}: ${t.task.slice(0,50)}`]);}catch{}break;case "file":let o=A.join(this.orchestrationsDir,`${s}.status`);w.writeFileSync(o,JSON.stringify({id:s,status:t.status,completed:t.completed,task:t.task}));break;}}ensureOrchestrationDir(){w.existsSync(this.orchestrationsDir)||w.mkdirSync(this.orchestrationsDir,{recursive:true});}generateId(){let s=new Date().toISOString().slice(0,10),e=Date.now().toString(36),t=Math.random().toString(36).substring(2,6);return `orch-${s}-${e}-${t}`}saveOrchestration(s){let e=A.join(this.orchestrationsDir,`${s.id}.yaml`);w.writeFileSync(e,F.dump(s));}spawnOrchestration(s,e,t){let n=this.getOrchestration(s);n&&(n.status="running",n.started=new Date().toISOString(),this.saveOrchestration(n)),(async()=>{try{let o=new E(this.rootDir);await o.initialize();let r=w.createWriteStream(n.outputFile,{flags:"a"}),a=await o.orchestrate(e,{...t,onMessage:(i,c)=>{c.type==="text"&&r.write(`[${i}] ${c.content}
21
+ `),t.onMessage?.(i,c);},onAgentStart:(i,c,d)=>{r.write(`
22
+ \u25B6 ${i}: ${c}
23
+ `),t.onAgentStart?.(i,c,d);},onAgentComplete:(i,c,d)=>{let u=c.success?"\u2713":"\u2717";r.write(`${u} ${i} completed
24
+ `),t.onAgentComplete?.(i,c,d);}});r.end(),this.markComplete(s,a),t.notify&&await this.notify(s,t.notifyMethods||["bell"]);}catch(o){let r=this.getOrchestration(s);r&&(r.status="failed",r.error=o instanceof Error?o.message:String(o),r.completed=new Date().toISOString(),this.saveOrchestration(r));}})();}};export{E as a,J as b};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {b}from'./chunk-J6KWGCHN.js';import {e,f,c,d,l,h,g,k,i,m as m$1,o,n,j,b as b$1,a as a$1}from'./chunk-AO7ZSRME.js';import {a}from'./chunk-Y4XFVDZC.js';import*as $ from'fs';import*as m from'path';import e$1 from'chalk';import E from'prompts';function F(){return process.env.CLAUDE_CODE==="1"||process.env.TERM_PROGRAM==="claude"?false:!!(process.env.TERM_PROGRAM==="cursor"||process.env.CURSOR_SESSION||process.env.CURSOR_TRACE_ID||process.env.VSCODE_CWD&&process.env.VSCODE_CWD.toLowerCase().includes("cursor")||process.env.VSCODE_NLS_CONFIG&&process.env.VSCODE_NLS_CONFIG.toLowerCase().includes("cursor")||process.env.TERM_PROGRAM==="vscode"&&process.env.VSCODE_GIT_ASKPASS_NODE?.toLowerCase().includes("cursor")||process.stdin.isTTY)}async function T(g){let n=new a(g),c=await n.discover();console.log(e$1.cyan(`
2
+ import {b}from'./chunk-6SKSV5B2.js';import {e,f,c,d,l,h,g,k,i,m as m$1,o,n,j,b as b$1,a as a$1}from'./chunk-AO7ZSRME.js';import {a}from'./chunk-Y4XFVDZC.js';import*as $ from'fs';import*as m from'path';import e$1 from'chalk';import E from'prompts';function F(){return process.env.CLAUDE_CODE==="1"||process.env.TERM_PROGRAM==="claude"?false:!!(process.env.TERM_PROGRAM==="cursor"||process.env.CURSOR_SESSION||process.env.CURSOR_TRACE_ID||process.env.VSCODE_CWD&&process.env.VSCODE_CWD.toLowerCase().includes("cursor")||process.env.VSCODE_NLS_CONFIG&&process.env.VSCODE_NLS_CONFIG.toLowerCase().includes("cursor")||process.env.TERM_PROGRAM==="vscode"&&process.env.VSCODE_GIT_ASKPASS_NODE?.toLowerCase().includes("cursor")||process.stdin.isTTY)}async function T(g){let n=new a(g),c=await n.discover();console.log(e$1.cyan(`
3
3
  Configure Agent Models
4
4
  `)),console.log(e$1.gray(` Environment: ${c.source}`)),console.log(e$1.gray(` Available: ${c.models.length} models
5
5
  `));let i={},o=n.groupByTier(c.models),a$2=t=>{let r=a$1[t],s=r.tier==="high"?o.high:r.tier==="medium"?o.medium:o.low,l=[];for(let f of s){let P=l.length===0;l.push({title:P?`${f.name} (recommended)`:f.name,value:f.id,description:`${f.provider} - ${r.tier} tier`});}let u=o.high.filter(f=>!s.includes(f)),y=o.medium.filter(f=>!s.includes(f)),v=o.low.filter(f=>!s.includes(f));for(let f of u)l.push({title:f.name,value:f.id,description:`${f.provider} - high tier`});for(let f of y)l.push({title:f.name,value:f.id,description:`${f.provider} - medium tier`});for(let f of v)l.push({title:f.name,value:f.id,description:`${f.provider} - low tier`});return l};for(let t of ["architect","builder","tester","reviewer","security"]){let r=a$1[t],s=t.charAt(0).toUpperCase()+t.slice(1),l=a$2(t),u=await E({type:"select",name:"model",message:`${s} (${r.description})`,choices:l,initial:0},{onCancel:()=>{console.log(e$1.yellow(`
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {c,b}from'./chunk-5TAVYPOV.js';import*as e from'fs';import*as o from'path';var D={};c(D,{appendSessionWorkEntry:()=>C,appendVerdictEntry:()=>N,clearActivityMetrics:()=>j,clearSessionWorkLog:()=>I,countNotebookReferences:()=>w,getAgentEntries:()=>S,getAgentVerdicts:()=>P,getContributingAgents:()=>A,getNotebookReferences:()=>h,getSessionActivitySummary:()=>W,markVerdictsConsumed:()=>O,readPendingVerdicts:()=>M,readSessionWorkLog:()=>g,recordActivityMetric:()=>F,recordNotebookReference:()=>R});function C(i,n){try{let t=o.join(i,y),r=o.dirname(t);if(e.existsSync(r)||e.mkdirSync(r,{recursive:!0}),e.existsSync(t)&&e.readFileSync(t,"utf8").trim().split(`
3
3
  `).filter(a=>a.trim()).length>=x)return;let f=JSON.stringify(n)+`
4
- `;e.appendFileSync(t,f,"utf8"),n.type==="user-verdict"&&n.agent&&n.symbols?.length&&import('./agent-loader-RJRVO5GQ.js').then(({loadAgentProfile:c,saveAgentProfile:s})=>{try{let a=c(i,n.agent);if(a?.expertise){let u=n.verdict==="accepted"?.03:n.verdict==="dismissed"?-.02:n.verdict==="revised"?-.01:0;if(u!==0){for(let v of n.symbols){let l=a.expertise.find(k=>k.symbol===v);l&&(l.confidence=Math.max(0,Math.min(1,l.confidence+u)),l.sessions=(l.sessions||0)+1,l.lastTouch=new Date().toISOString());}s(n.agent,a,"global");}}}catch{}}).catch(()=>{});}catch{}}function g(i){try{let n=o.join(i,y);return e.existsSync(n)?e.readFileSync(n,"utf8").trim().split(`
4
+ `;e.appendFileSync(t,f,"utf8"),n.type==="user-verdict"&&n.agent&&n.symbols?.length&&import('./agent-loader-YKS2PQWO.js').then(({loadAgentProfile:c,saveAgentProfile:s})=>{try{let a=c(i,n.agent);if(a?.expertise){let u=n.verdict==="accepted"?.03:n.verdict==="dismissed"?-.02:n.verdict==="revised"?-.01:0;if(u!==0){for(let v of n.symbols){let l=a.expertise.find(k=>k.symbol===v);l&&(l.confidence=Math.max(0,Math.min(1,l.confidence+u)),l.sessions=(l.sessions||0)+1,l.lastTouch=new Date().toISOString());}s(n.agent,a,"global");}}}catch{}}).catch(()=>{});}catch{}}function g(i){try{let n=o.join(i,y);return e.existsSync(n)?e.readFileSync(n,"utf8").trim().split(`
5
5
  `).filter(t=>t.trim()).map(t=>{try{return JSON.parse(t)}catch{return null}}).filter(t=>t!==null):[]}catch{return []}}function I(i){try{let n=o.join(i,y);e.existsSync(n)&&e.writeFileSync(n,"","utf8");}catch{}}function N(i,n){try{let t=o.join(i,p),r=o.dirname(t);e.existsSync(r)||e.mkdirSync(r,{recursive:!0}),e.appendFileSync(t,JSON.stringify(n)+`
6
6
  `,"utf8");}catch{}}function M(i){try{let n=o.join(i,p);return e.existsSync(n)?e.readFileSync(n,"utf8").trim().split(`
7
7
  `).filter(t=>t.trim()).map(t=>{try{return JSON.parse(t)}catch{return null}}).filter(t=>t!==null&&!t.consumed):[]}catch{return []}}function O(i,n){try{let t=o.join(i,p);if(!e.existsSync(t))return;let r=new Set(n),c=e.readFileSync(t,"utf8").trim().split(`
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {b}from'./chunk-5TAVYPOV.js';import*as i from'fs';import*as a from'path';import*as u from'js-yaml';import {execSync}from'child_process';function F(s){let e=s.toLowerCase();return e.includes("claude")||e.includes("anthropic")?"anthropic":e.includes("gpt")||e.includes("openai")||e.includes("o1")||e.includes("o3")?"openai":e.includes("gemini")||e.includes("google")||e.includes("palm")?"google":e.includes("llama")||e.includes("meta")?"meta":e.includes("mistral")||e.includes("mixtral")?"mistral":e.includes("deepseek")?"deepseek":e.includes("cohere")||e.includes("command")?"cohere":"unknown"}function A(s){let e=s,n=e.author;if(e.type||(e.type="agent-session"),typeof n=="string")return s;if(n&&typeof n=="object"&&!Array.isArray(n)){let t=n;t.type==="agent"?(e.author="unknown",e.agent={provider:t.model?F(t.model):F(t.id),model:t.model||t.id}):e.author=t.id||"unknown",delete e.assistedBy;}return e}function E(s){return s.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,20)||"unknown"}function W(){let s=process.env.PARADIGM_AUTHOR;if(s)return E(s);try{let e=execSync("git config user.name",{encoding:"utf-8",timeout:3e3}).trim();if(e)return E(e)}catch{}try{let e=os.userInfo().username;if(e)return E(e)}catch{}return "unknown"}function L(s){return s.endsWith(".yaml")||s.endsWith(".lore")}function k(s,e,n){let t=a.join(s,_,S,e),r=a.join(t,`${n}.lore`);if(i.existsSync(r))return r;let o=a.join(t,`${n}.yaml`);return i.existsSync(o)?o:null}async function I(s,e){let n=a.join(s,_,S);if(!i.existsSync(n))return [];C(s);let t=[],r=i.readdirSync(n).filter(o=>/^\d{4}-\d{2}-\d{2}$/.test(o)).sort().reverse();for(let o of r){if(e?.dateFrom&&o<e.dateFrom.slice(0,10)||e?.dateTo&&o>e.dateTo.slice(0,10))continue;let l=a.join(n,o),m=i.readdirSync(l).filter(L).sort();for(let c of m)try{let g=i.readFileSync(a.join(l,c),"utf8"),d=u.load(g);t.push(A(d));}catch{}}return e?U(t,e):t}async function P(s,e){let n=e.match(/^L-(\d{4}-\d{2}-\d{2})-/);if(n){let r=n[1],o=k(s,r,e);if(o)try{let l=i.readFileSync(o,"utf8"),m=u.load(l);return A(m)}catch{return null}}return (await I(s)).find(r=>r.id===e)||null}async function K(s){let e=a.join(s,_,$);if(!i.existsSync(e))return null;try{let n=i.readFileSync(e,"utf8");return u.load(n)}catch{return null}}function M(s){try{let e=execSync("git rev-parse HEAD",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),n=execSync("git rev-parse --abbrev-ref HEAD",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),t=execSync("git status --porcelain",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();return {ref:e,branch:n,dirty:t.length>0}}catch{return}}async function G(s,e){let n=a.join(s,_),t=e.timestamp.slice(0,10),r=a.join(n,S,t);i.existsSync(r)||i.mkdirSync(r,{recursive:true}),e.author||(e.author=W()),e.git_context||(e.git_context=M(s)),e.id||(e.id=D(s,t,e.author,e.timestamp));let o=a.join(r,`${e.id}.lore`);return i.writeFileSync(o,u.dump(e,{lineWidth:-1,noRefs:true})),await j(s),e.id}async function V(s,e,n){let t=await P(s,e);if(!t)return false;let r=t.timestamp.slice(0,10),o=k(s,r,e);return o?(t.review=n,i.writeFileSync(o,u.dump(t,{lineWidth:-1,noRefs:true})),true):false}async function j(s){let e=a.join(s,_),n=a.join(e,S);if(!i.existsSync(n))return;C(s);let t=new Set,r=0,o="",l=i.readdirSync(n).filter(d=>/^\d{4}-\d{2}-\d{2}$/.test(d));for(let d of l){let y=a.join(n,d),h=i.readdirSync(y).filter(L);for(let w of h)try{let f=i.readFileSync(a.join(y,w),"utf8"),p=u.load(f),b=A(p);t.add(b.author),r++,(!o||b.timestamp>o)&&(o=b.timestamp);}catch{}}let m="unknown",c=a.join(s,".paradigm","config.yaml");if(i.existsSync(c))try{let d=u.load(i.readFileSync(c,"utf8"));m=d.project||d.name||"unknown";}catch{}let g={version:"1.0",project:m,entries:r,last_updated:o||new Date().toISOString(),authors:Array.from(t)};i.existsSync(e)||i.mkdirSync(e,{recursive:true}),i.writeFileSync(a.join(e,$),u.dump(g,{lineWidth:-1,noRefs:true}));}function C(s){let e=a.join(s,_,S);if(!i.existsSync(e))return 0;let n=i.readdirSync(e).filter(r=>L(r)&&!r.startsWith(".")),t=0;for(let r of n){let o=a.join(e,r);if(i.statSync(o).isFile())try{let m=i.readFileSync(o,"utf8"),c=u.load(m);if(c.author&&typeof c.author=="object"||typeof c.author=="string"&&c.timestamp)continue;let g=typeof c.date=="string"?c.date.slice(0,10):new Date().toISOString().slice(0,10),d=a.join(e,g);i.existsSync(d)||i.mkdirSync(d,{recursive:!0});let y=W(),h=`${g}T00:00:00.000Z`,w=D(s,g,y,h),f=String(c.type||"agent-session"),p=f==="decision",b=p?"insight":["agent-session","human-note","review","incident","milestone","insight"].includes(f)?f:"agent-session",T;if(c.test_results&&typeof c.test_results=="object"){let v=c.test_results;T={status:v.total===v.passed?"pass":"partial",details:{tests:v.total===v.passed?"pass":"fail"}};}let R=["migrated",f];p&&R.push("v6-migrated:from-decision");let O={id:w,type:b,timestamp:h,author:"unknown",agent:{provider:"unknown",model:"unknown"},title:String(c.title||r.replace(/\.(yaml|lore)$/,"")),summary:String(c.summary||""),symbols_touched:Array.isArray(c.symbols_touched)?c.symbols_touched:[],files_modified:Array.isArray(c.files_modified)?c.files_modified:void 0,...T?{verification:T}:{},tags:R};i.writeFileSync(a.join(d,`${w}.lore`),u.dump(O,{lineWidth:-1,noRefs:!0})),i.unlinkSync(o),t++;}catch{}}return t}async function q(s,e,n){let t=await P(s,e);if(!t)return false;let r=t.timestamp.slice(0,10),o=k(s,r,e);return o?(n.title!==void 0&&(t.title=n.title),n.summary!==void 0&&(t.summary=n.summary),n.type!==void 0&&(t.type=n.type),n.duration_minutes!==void 0&&(t.duration_minutes=n.duration_minutes),n.symbols_touched!==void 0&&(t.symbols_touched=n.symbols_touched),n.symbols_created!==void 0&&(t.symbols_created=n.symbols_created),n.files_created!==void 0&&(t.files_created=n.files_created),n.files_modified!==void 0&&(t.files_modified=n.files_modified),n.lines_added!==void 0&&(t.lines_added=n.lines_added),n.lines_removed!==void 0&&(t.lines_removed=n.lines_removed),n.commit!==void 0&&(t.commit=n.commit),n.decisions!==void 0&&(t.decisions=n.decisions),n.errors_encountered!==void 0&&(t.errors_encountered=n.errors_encountered),n.learnings!==void 0&&(t.learnings=n.learnings),n.verification!==void 0&&(t.verification=n.verification),n.tags!==void 0&&(t.tags=n.tags),n.body!==void 0&&(t.body=n.body),n.linked_lore!==void 0&&(t.linked_lore=n.linked_lore),n.linked_tasks!==void 0&&(t.linked_tasks=n.linked_tasks),n.linked_commits!==void 0&&(t.linked_commits=n.linked_commits),n.confidence!==void 0&&(t.confidence=n.confidence),n.assessment!==void 0&&(t.assessment=n.assessment),n.assessment_delta!==void 0&&(t.assessment_delta=n.assessment_delta),i.writeFileSync(o,u.dump(t,{lineWidth:-1,noRefs:true})),await j(s),true):false}function N(s){switch(s){case "correct":return 1;case "partial":return .5;case "incorrect":return 0}}async function Z(s,e,n){let t=await P(s,e);if(!t)return false;let r=t.timestamp.slice(0,10),o=k(s,r,e);return o?(t.assessment=n,t.confidence!=null&&(t.assessment_delta=N(n.verdict)-t.confidence),i.writeFileSync(o,u.dump(t,{lineWidth:-1,noRefs:true})),true):false}async function J(s,e){let n=await P(s,e);if(!n)return false;let t=n.timestamp.slice(0,10),r=k(s,t,e);if(!r)return false;i.unlinkSync(r);let o=a.dirname(r);return i.readdirSync(o).filter(L).length===0&&i.rmdirSync(o),await j(s),true}function U(s,e){let n=s;if(e.author&&(n=n.filter(t=>t.author===e.author)),e.hasAgent!==void 0?n=n.filter(t=>e.hasAgent?t.agent!=null:t.agent==null):e.authorType&&(n=n.filter(t=>e.authorType==="agent"?t.agent!=null:t.agent==null)),e.symbol&&(n=n.filter(t=>t.symbols_touched.includes(e.symbol)||t.symbols_created?.includes(e.symbol))),e.dateFrom){let t=new Date(e.dateFrom).getTime();n=n.filter(r=>new Date(r.timestamp).getTime()>=t);}if(e.dateTo){let t=new Date(e.dateTo).getTime();n=n.filter(r=>new Date(r.timestamp).getTime()<=t);}if(e.type&&(n=n.filter(t=>t.type===e.type)),e.tag){let t=e.tag;n=n.filter(r=>r.tags?.some(o=>o===t||o.startsWith(t+":")||t.includes(":")&&o===t));}return e.tags&&e.tags.length>0&&(n=n.filter(t=>e.tags.some(r=>t.tags?.includes(r)))),e.hasBody!==void 0&&(n=n.filter(t=>e.hasBody?t.body!=null&&t.body.length>0:!t.body||t.body.length===0)),e.hasReview!==void 0&&(n=n.filter(t=>e.hasReview?t.review!=null:t.review==null)),e.hasConfidence!==void 0&&(n=n.filter(t=>e.hasConfidence?t.confidence!=null:t.confidence==null)),e.hasAssessment!==void 0&&(n=n.filter(t=>e.hasAssessment?t.assessment!=null:t.assessment==null)),n.sort((t,r)=>new Date(r.timestamp).getTime()-new Date(t.timestamp).getTime()),e.offset&&(n=n.slice(e.offset)),e.limit&&(n=n.slice(0,e.limit)),n}function D(s,e,n,t){let r=E(n),o=new Date(t),l=String(o.getUTCHours()).padStart(2,"0"),m=String(o.getUTCMinutes()).padStart(2,"0"),c=String(o.getUTCSeconds()).padStart(2,"0"),g=`${l}${m}${c}`,d=`L-${e}-${r}-${g}`,y=a.join(s,_,S,e);if(!i.existsSync(y))return `${d}-001`;let h=i.readdirSync(y).filter(f=>f.startsWith(d)&&L(f)).map(f=>{let p=f.match(/-(\d{3})\.(yaml|lore)$/);return p?parseInt(p[1],10):0}),w=h.length>0?Math.max(...h)+1:1;return `${d}-${String(w).padStart(3,"0")}`}var _,S,$,z=b(()=>{_=".paradigm/lore",S="entries",$="timeline.yaml";});export{I as a,P as b,K as c,G as d,V as e,j as f,q as g,Z as h,J as i,z as j};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import {c,b}from'./chunk-5TAVYPOV.js';import*as i from'fs';import*as l from'path';import*as k from'os';import*as g from'js-yaml';var $={};c($,{addNotebookEntry:()=>N,classifyNotebookScope:()=>w,incrementApplied:()=>P,loadNotebookEntries:()=>S,promoteFromLore:()=>_,searchNotebooks:()=>O});function S(e,t,n){let r=new Map,a=l.join(u,e);h(a,r);let o=l.join(t,d,e);h(o,r);let c=Array.from(r.values());if(n?.concepts&&n.concepts.length>0){let p=new Set(n.concepts.map(s=>s.toLowerCase()));c=c.filter(s=>s.concepts.some(f=>p.has(f.toLowerCase())));}if(n?.tags&&n.tags.length>0){let p=new Set(n.tags.map(s=>s.toLowerCase()));c=c.filter(s=>s.tags.some(f=>p.has(f.toLowerCase())));}return c.sort((p,s)=>s.appliedCount-p.appliedCount)}function h(e,t){if(i.existsSync(e))try{let n=i.readdirSync(e).filter(r=>r.startsWith(L)&&r.endsWith(y));for(let r of n)try{let a=i.readFileSync(l.join(e,r),"utf-8"),o=g.load(a);o?.id&&t.set(o.id,o);}catch{}}catch{}}function O(e,t,n){let r=S(e,n),a=t.toLowerCase();return r.filter(o=>o.context.toLowerCase().includes(a)||o.snippet.toLowerCase().includes(a)||o.concepts.some(c=>c.toLowerCase().includes(a))||o.tags.some(c=>c.toLowerCase().includes(a)))}function w(e){let t=[e.context,e.snippet,...e.concepts,...e.tags].join(" ").toLowerCase();return ["paradigm","mcp_","mcp tool",".paradigm/","lore entry","lore record","aspect","^gate","portal.yaml",".purpose","sentinel","symphony","ambient nomination","paradigm_"," pan ","agent notebook","concept anchor","symbol system","work log","knowledge stream","nevr.land","neverland"].some(r=>t.includes(r))?"platform-specific":/[#$^!~][a-z][a-z0-9-]{2,}/.test(t)||/\/[a-z0-9_-]{2,}\/[a-z0-9_-]/.test(t)?"project-specific":"generalizable"}function N(e,t,n,r){let a=new Date().toISOString(),o=(t.concepts[0]||t.context.split(" ").slice(0,4).join(" ")||"entry").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40),p=`nb-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}-${o}`,s=t.scope??w({context:t.context,snippet:t.snippet,concepts:t.concepts,tags:t.tags}),f={...t,id:p,scope:s,publishable:t.publishable??true,appliedCount:0,created:a,updated:a},m=n==="global"?l.join(u,e):l.join(r||process.cwd(),d,e);i.existsSync(m)||i.mkdirSync(m,{recursive:true});let E=`${p}${y}`,b=l.join(m,E),C=g.dump(f,{lineWidth:120,noRefs:true,sortKeys:false});return i.writeFileSync(b,C,"utf-8"),{entry:f,filePath:b}}async function _(e,t,n,r="global"){let{loadLoreEntry:a}=await import('./lore-loader-RVQI5GXL.js'),o=await a(n,t);if(!o)return null;let c=[];if(o.symbols_touched)for(let f of o.symbols_touched){let m=f.replace(/^[#$^!~]/,"").toLowerCase();c.push(m);}let p=o.summary||"";o.body&&(p+=`
2
+ import {c,b}from'./chunk-5TAVYPOV.js';import*as i from'fs';import*as l from'path';import*as k from'os';import*as g from'js-yaml';var $={};c($,{addNotebookEntry:()=>N,classifyNotebookScope:()=>w,incrementApplied:()=>P,loadNotebookEntries:()=>S,promoteFromLore:()=>_,searchNotebooks:()=>O});function S(e,t,n){let r=new Map,a=l.join(u,e);h(a,r);let o=l.join(t,d,e);h(o,r);let c=Array.from(r.values());if(n?.concepts&&n.concepts.length>0){let p=new Set(n.concepts.map(s=>s.toLowerCase()));c=c.filter(s=>s.concepts.some(f=>p.has(f.toLowerCase())));}if(n?.tags&&n.tags.length>0){let p=new Set(n.tags.map(s=>s.toLowerCase()));c=c.filter(s=>s.tags.some(f=>p.has(f.toLowerCase())));}return c.sort((p,s)=>s.appliedCount-p.appliedCount)}function h(e,t){if(i.existsSync(e))try{let n=i.readdirSync(e).filter(r=>r.startsWith(L)&&r.endsWith(y));for(let r of n)try{let a=i.readFileSync(l.join(e,r),"utf-8"),o=g.load(a);o?.id&&t.set(o.id,o);}catch{}}catch{}}function O(e,t,n){let r=S(e,n),a=t.toLowerCase();return r.filter(o=>o.context.toLowerCase().includes(a)||o.snippet.toLowerCase().includes(a)||o.concepts.some(c=>c.toLowerCase().includes(a))||o.tags.some(c=>c.toLowerCase().includes(a)))}function w(e){let t=[e.context,e.snippet,...e.concepts,...e.tags].join(" ").toLowerCase();return ["paradigm","mcp_","mcp tool",".paradigm/","lore entry","lore record","aspect","^gate","portal.yaml",".purpose","sentinel","symphony","ambient nomination","paradigm_"," pan ","agent notebook","concept anchor","symbol system","work log","knowledge stream","nevr.land","neverland"].some(r=>t.includes(r))?"platform-specific":/[#$^!~][a-z][a-z0-9-]{2,}/.test(t)||/\/[a-z0-9_-]{2,}\/[a-z0-9_-]/.test(t)?"project-specific":"generalizable"}function N(e,t,n,r){let a=new Date().toISOString(),o=(t.concepts[0]||t.context.split(" ").slice(0,4).join(" ")||"entry").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40),p=`nb-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}-${o}`,s=t.scope??w({context:t.context,snippet:t.snippet,concepts:t.concepts,tags:t.tags}),f={...t,id:p,scope:s,publishable:t.publishable??true,appliedCount:0,created:a,updated:a},m=n==="global"?l.join(u,e):l.join(r||process.cwd(),d,e);i.existsSync(m)||i.mkdirSync(m,{recursive:true});let E=`${p}${y}`,b=l.join(m,E),C=g.dump(f,{lineWidth:120,noRefs:true,sortKeys:false});return i.writeFileSync(b,C,"utf-8"),{entry:f,filePath:b}}async function _(e,t,n,r="global"){let{loadLoreEntry:a}=await import('./lore-loader-PXFKMKAN.js'),o=await a(n,t);if(!o)return null;let c=[];if(o.symbols_touched)for(let f of o.symbols_touched){let m=f.replace(/^[#$^!~]/,"").toLowerCase();c.push(m);}let p=o.summary||"";o.body&&(p+=`
3
3
 
4
4
  `+o.body);let s={source:"lore",loreEntryId:t,originProject:l.basename(n),createdBy:e};return N(e,{context:o.title||`Promoted from ${t}`,snippet:p,provenance:s,confidence:o.confidence??.7,concepts:c,tags:o.tags||[]},r,n)}function P(e,t,n){let r=l.join(n,d,e),a=l.join(u,e);for(let o of [r,a]){let c=l.join(o,`${t}${y}`);if(i.existsSync(c))try{let p=i.readFileSync(c,"utf-8"),s=g.load(p);if(s)return s.appliedCount=(s.appliedCount||0)+1,s.updated=new Date().toISOString(),i.writeFileSync(c,g.dump(s,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8"),!0}catch{}}return false}var u,d,L,y,v=b(()=>{u=l.join(k.homedir(),".paradigm","notebooks"),d=".paradigm/notebooks",L="nb-",y=".yaml";});export{S as a,O as b,w as c,N as d,_ as e,P as f,$ as g,v as h};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import {h as h$1}from'./chunk-ZJQY5PPP.js';import*as y from'fs';import*as h from'path';import*as B from'js-yaml';import {execFileSync}from'child_process';function k(t,e){if(t===e)return 0;if(t.length===0)return e.length;if(e.length===0)return t.length;let a=new Array(e.length+1),r=new Array(e.length+1);for(let s=0;s<=e.length;s++)a[s]=s;for(let s=1;s<=t.length;s++){r[0]=s;for(let n=1;n<=e.length;n++){let c=t.charCodeAt(s-1)===e.charCodeAt(n-1)?0:1;r[n]=Math.min(r[n-1]+1,a[n]+1,a[n-1]+c);}let o=a;a=r,r=o;}return a[e.length]}function S(t,e){if(!t||e.length===0)return;let a;for(let r of e){if(r===t)continue;let s=k(t,r),o=Math.max(t.length,r.length);if(o===0)continue;let n=s/o;(s<=2||n<=.3)&&(!a||s<a.distance)&&(a={didYouMean:r,distance:s});}return a}function M(t,e){let a=[];for(let r of t){let s=S(r,e);s&&a.push({gate:r,didYouMean:s.didYouMean,distance:s.distance});}return a}function $(t,e){let a=[];for(let r of t){let s=S(r,e);s&&a.push({gate:r,didYouMean:s.didYouMean,distance:s.distance});}return a}var R=["node_modules",".git","dist","build","coverage",".paradigm","vendor","__pycache__",".next","target"];function w(t){let e=h.join(t,"portal.yaml");if(!y.existsSync(e))return {status:"missing"};let a;try{a=y.readFileSync(e,"utf-8");}catch{return {status:"unparseable",errorClass:"other",detail:"file read error"}}try{return {status:"ok",data:B.load(a)}}catch(r){let{errorClass:s,detail:o}=h$1(r);return {status:"unparseable",errorClass:s,detail:o}}}function Y(t){let e=new Set;if(t.gates)for(let a of Object.keys(t.gates)){let r=a.startsWith("^")?a.slice(1):a;e.add(r);}if(t.routes)for(let a of Object.values(t.routes)){let r=Array.isArray(a)?a:a.gates||[];for(let s of r){let o=s.startsWith("^")?s.slice(1):s;e.add(o);}}return Array.from(e)}function v(t){let e=new Set;if(t.routes)for(let a of Object.values(t.routes)){let r=Array.isArray(a)?a:a.gates||[];for(let s of r){let o=s.startsWith("^")?s.slice(1):s;e.add(o);}}return e}function N(t,e){let a={encoding:"utf-8",maxBuffer:10485760,stdio:["ignore","pipe","pipe"]};try{let n=["-n","--no-ignore-vcs",...R.flatMap(c=>["--glob",`!${c}/**`]),"--engine","auto",e,t];return execFileSync("rg",n,a)}catch{}let s=["-rn",...R.map(o=>`--exclude-dir=${o}`),"-E",e,"--",t];try{return execFileSync("grep",s,a)}catch(o){return o?.code===1||o?.status===1,""}}var D=["**/.purpose","**/portal.yaml","**/.paradigm/**/*.yaml","**/.paradigm/**/*.yml"];function _(t){let e=[];for(let s of D){h.join(t,s);let n;try{n=execFileSync("find",[t,"-path","*/node_modules","-prune","-o","-path","*/.git","-prune","-o","(","-name",".purpose","-o","-name","portal.yaml",")","-print"],{encoding:"utf-8",maxBuffer:5242880}).split(`
3
+ `).filter(Boolean);}catch{n=[];}for(let c of n)try{let u=y.readFileSync(c,"utf-8").split(`
4
+ `);for(let d=0;d<u.length;d++){let p=u[d],l=p.matchAll(/\^([a-z][a-z0-9-]+)/g);for(let m of l)e.push({gate:m[1],file:h.relative(t,c),line:d+1,context:p.trim().slice(0,100),matchType:"symbol"});}}catch{}}let r=[{pattern:`checkGate\\s*\\(['"]([^'"]+)['"]`,type:"function"},{pattern:`requireGate\\s*\\(['"]([^'"]+)['"]`,type:"function"},{pattern:`@Gate\\s*\\(['"]?([^'"\\)]+)['"]?\\)`,type:"function"}];for(let{pattern:s,type:o}of r){let n=N(t,s);for(let c of n.split(`
5
+ `).filter(Boolean)){let f=c.match(/^(.+?):(\d+):(.*)$/);if(f){let[,u,d,p]=f,l=p.match(new RegExp(s));if(l&&l[1]){let m=l[1].startsWith("^")?l[1].slice(1):l[1];e.push({gate:m,file:h.relative(t,u),line:parseInt(d,10),context:p.trim().slice(0,100),matchType:o});}}}}return e}function E(t){return [...new Set(t.map(e=>e.gate))]}async function L(t){let e=w(t);if(e.status==="unparseable"){let i=e.errorClass==="duplicate-key"?"duplicate mapping key detected":e.errorClass==="syntax"?"YAML syntax error":"YAML parse error";return {status:"violations",declaredButUnused:[],routeAttachedUnused:[],orphanUnused:[],usedButUndeclared:["__portal_unparseable__"],properlyDeclared:[],suggestions:[`portal.yaml unparseable: ${i} \u2014 run 'paradigm doctor' for details`],references:[],portalError:{kind:"unparseable",errorClass:e.errorClass,detail:e.detail}}}if(e.status==="missing"){let i=_(t),C=E(i);return C.length===0?{status:"compliant",declaredButUnused:[],routeAttachedUnused:[],orphanUnused:[],usedButUndeclared:[],properlyDeclared:[],suggestions:["No portal.yaml found, and no gate references detected in code."],references:[]}:{status:"violations",declaredButUnused:[],routeAttachedUnused:[],orphanUnused:[],usedButUndeclared:C,properlyDeclared:[],suggestions:["Gate references found in code but no portal.yaml exists.","Create a portal.yaml file to declare these gates:",...C.map(P=>` - ^${P}`),"","Run: paradigm portal init"],references:i}}let a=e.data,r=Y(a),s=v(a),o=_(t),n=E(o),c=new Set(r),f=new Set(n),u=r.filter(i=>!f.has(i)),d=u.filter(i=>s.has(i)),p=u.filter(i=>!s.has(i)),l=n.filter(i=>!c.has(i)),m=r.filter(i=>f.has(i)),g=[];if(d.length>0){g.push("Gates documented on routes but no checkGate/requireGate in code:");for(let i of d)g.push(` - ^${i} (documented on routes; if enforced by middleware, this may be intentional)`);g.push("");}if(p.length>0){g.push("Orphan gates (declared but never on a route or in code):");for(let i of p)g.push(` - ^${i} (add to a route or remove from portal.yaml)`);g.push("");}if(l.length>0){g.push("Gates used in code but not declared in portal.yaml:");for(let i of l)g.push(` - ^${i} (add to portal.yaml with proper definition)`);g.push("");}let A="compliant";l.length>0?A="violations":u.length>0&&(A="warnings");let U=[],x=l.filter(i=>i!=="__portal_unparseable__");return x.length>0&&U.push(...M(x,r)),u.length>0&&x.length>0&&U.push(...$(u,x)),{status:A,declaredButUnused:u,routeAttachedUnused:d,orphanUnused:p,usedButUndeclared:l,properlyDeclared:m,suggestions:g,references:o,...U.length>0?{nearMatches:U}:{}}}function I(t){let e=[],a=t.status==="compliant"?"\u2713":t.status==="warnings"?"\u26A0":"\u2717";if(e.push(`Portal Compliance: ${a} ${t.status.toUpperCase()}`),e.push(""),e.push(`Properly Declared: ${t.properlyDeclared.length}`),t.routeAttachedUnused.length>0&&e.push(`Route-Attached, No Code: ${t.routeAttachedUnused.length}`),t.orphanUnused.length>0&&e.push(`Orphan Gates: ${t.orphanUnused.length}`),t.usedButUndeclared.length>0&&e.push(`Used but Undeclared: ${t.usedButUndeclared.length}`),e.push(""),t.properlyDeclared.length>0){e.push("Gates in Use:");for(let n of t.properlyDeclared)e.push(` \u2713 ^${n}`);e.push("");}if(t.routeAttachedUnused.length>0){e.push("Route-Attached (no checkGate/requireGate in code):");for(let n of t.routeAttachedUnused)e.push(` \u26A0 ^${n}`);e.push("");}if(t.orphanUnused.length>0){e.push("Orphan Gates (declared but never on route or in code):");for(let n of t.orphanUnused)e.push(` \u26A0 ^${n}`);e.push("");}t.portalError&&(e.push("Portal Unparseable:"),e.push(` \u2717 ${t.portalError.detail} \u2014 run 'paradigm doctor' for details`),e.push(""));let r=t.usedButUndeclared.filter(n=>n!=="__portal_unparseable__"),s=new Map,o=new Map;if(t.nearMatches)for(let n of t.nearMatches)r.includes(n.gate)&&!s.has(n.gate)?s.set(n.gate,{didYouMean:n.didYouMean,distance:n.distance}):t.declaredButUnused.includes(n.gate)&&!o.has(n.gate)&&o.set(n.gate,{didYouMean:n.didYouMean,distance:n.distance});if(r.length>0){e.push("Undeclared Gates (used but not in portal.yaml):");for(let n of r){e.push(` \u2717 ^${n}`);let c=s.get(n);c&&e.push(` Did you mean: ^${c.didYouMean}? (declared in portal.yaml)`);let f=t.references.filter(u=>u.gate===n).slice(0,3);for(let u of f)e.push(` at ${u.file}:${u.line}`);}e.push("");}if(o.size>0){e.push("Possible Typos (declared gates may be misspelled references):");for(let[n,c]of o)e.push(` ? ^${n} \u2014 did you mean to reference as ^${c.didYouMean}?`);e.push("");}if(t.suggestions.length>0&&t.status!=="compliant"){e.push("Suggestions:");for(let n of t.suggestions)n&&e.push(` ${n}`);}return e.join(`
6
+ `)}function z(t){if(t.status==="compliant")return {status:"ok",message:`${t.properlyDeclared.length} gates properly declared`};if(t.status==="warnings"){let e=[];return t.routeAttachedUnused.length>0&&e.push(`${t.routeAttachedUnused.length} route-attached`),t.orphanUnused.length>0&&e.push(`${t.orphanUnused.length} orphan`),{status:"warn",message:e.length>0?e.join(", ")+" gate(s)":`${t.declaredButUnused.length} unused gates`}}return {status:"error",message:`${t.usedButUndeclared.length} gates used but not declared`}}export{w as a,Y as b,_ as c,L as d,I as e,z as f};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {f,g,h,i,j,k,l,m,n}from'./chunk-JIXHEBGK.js';import {a,e}from'./chunk-QT2LKB3P.js';import*as N from'fs';import*as v from'js-yaml';import {z as z$1}from'zod';import*as S from'path';var U={component:"#",flow:"$",gate:"^",signal:"!",aspect:"~"},Z={"#":"component",$:"flow","^":"gate","!":"signal","~":"aspect"},q=["#","$","^","!","~"];function H(e){return q.includes(e)}var ee=z$1.object({x:z$1.number(),y:z$1.number()}),te=z$1.object({x:z$1.number(),y:z$1.number(),zoom:z$1.number()}),z=z$1.object({path:z$1.string(),include:z$1.array(z$1.string()).optional(),exclude:z$1.array(z$1.string()).optional()}),G=z$1.object({id:z$1.string(),symbol:z$1.string(),type:z$1.enum(["feature","component","flow","state","aspect","gate","signal","idea"]),content:z$1.string().optional(),position:ee,tags:z$1.array(z$1.string()).optional(),created:z$1.string(),modified:z$1.string().optional()}),_=z$1.object({from:z$1.string(),to:z$1.string(),label:z$1.string().optional(),type:z$1.string().optional()}),oe=z$1.object({id:z$1.string(),name:z$1.string(),nodes:z$1.array(z$1.string()),color:z$1.string().optional()}),F=z$1.object({viewport:te,groups:z$1.array(oe).optional()}),ne=z$1.object({nodes:z$1.array(G),connections:z$1.array(_),layout:F}),se=z$1.object({id:z$1.string(),name:z$1.string(),timestamp:z$1.string(),description:z$1.string().optional(),state:ne}),re=z$1.object({version:z$1.string(),metadata:z$1.object({name:z$1.string(),created:z$1.string(),modified:z$1.string()}),sources:z$1.object({purpose:z$1.array(z).optional(),portal:z$1.array(z).optional()}),nodes:z$1.array(G),connections:z$1.array(_),layout:F,snapshots:z$1.array(se).optional()});function ge(e){let o=[],t;try{t=N.readFileSync(e,"utf8");}catch(n){return o.push(`Cannot read file: ${n.message}`),{data:null,errors:o,rawContent:void 0}}return ae(t)}function ae(e){let o=[],t=null;try{t=v.load(e);}catch(i){let l=i,f=l.mark?.line?l.mark.line+1:void 0;return o.push(`YAML syntax error: ${l.reason||i.message}${f?` (line ${f})`:""}`),{data:null,errors:o,rawContent:e}}if(t==null)return {data:V(),errors:[],rawContent:e};let n=re.safeParse(t);if(!n.success){for(let i of n.error.issues){let l=i.path.join(".");o.push(`Schema error at ${l||"/"}: ${i.message}`);}return {data:t,errors:o,rawContent:e}}return {data:n.data,errors:[],rawContent:e}}function V(e="Untitled"){let o=new Date().toISOString();return {version:"1.0.0",metadata:{name:e,created:o,modified:o},sources:{purpose:[{path:"./"}],portal:[{path:"./portal.yaml"}]},nodes:[],connections:[],layout:{viewport:{x:0,y:0,zoom:1}}}}function ie(e){return e.metadata.modified=new Date().toISOString(),v.dump(e,{indent:2,lineWidth:-1,noRefs:true,sortKeys:false})}function he(e="My Project"){return ie(V(e))}function be(e,o){return {...e,nodes:[...e.nodes,o],metadata:{...e.metadata,modified:new Date().toISOString()}}}function Se(e,o,t){return {...e,nodes:e.nodes.map(n=>n.id===o?{...n,position:t,modified:new Date().toISOString()}:n),metadata:{...e.metadata,modified:new Date().toISOString()}}}function $e(e,o){return e.connections.some(n=>n.from===o.from&&n.to===o.to)?e:{...e,connections:[...e.connections,o],metadata:{...e.metadata,modified:new Date().toISOString()}}}function we(e,o,t){let n={id:`snap-${Date.now()}`,name:o,timestamp:new Date().toISOString(),description:t,state:{nodes:[...e.nodes],connections:[...e.connections],layout:{...e.layout}}};return {...e,snapshots:[...e.snapshots||[],n],metadata:{...e.metadata,modified:new Date().toISOString()}}}async function ce(e$1,o){let t=[],n$1=[],i$1=[],l$1=[];if(e$1.sources.purpose)for(let c of e$1.sources.purpose){let u=S.resolve(o,c.path);try{let p=await f(u);i$1.push(...p.map(r=>r.filePath));let m$1=g(p);for(let[r,{item:a,filePath:d}]of m$1){let b=["feature",...a.tags||[]];t.push(y({id:`purpose-feature-${r}`,symbol:`#${r}`,type:"component",source:"purpose",filePath:d,data:a,description:a.description,tags:b,componentType:a.type,parentSymbol:a.parent,anchors:a.anchors?.map(Q=>T(Q))}));}let g$1=h(p);for(let[r,{item:a,filePath:d}]of g$1)t.push(y({id:`purpose-component-${r}`,symbol:`#${r}`,type:"component",source:"purpose",filePath:d,data:a,description:a.description,tags:a.tags,componentType:a.type,parentSymbol:a.parent,anchors:a.anchors?.map(b=>T(b))}));let $=i(p);for(let[r,{item:a,filePath:d}]of $)t.push(y({id:`purpose-gate-${r}`,symbol:`^${r}`,type:"gate",source:"purpose",filePath:d,data:a,description:a.description}));let k$1=j(p);for(let[r,{item:a,filePath:d}]of k$1)t.push(y({id:`purpose-state-${r}`,symbol:`#${r}`,type:"component",source:"purpose",filePath:d,data:a,description:a.description,tags:["state"]}));let W=k(p);for(let[r,{item:a,filePath:d}]of W)t.push(y({id:`purpose-flow-${r}`,symbol:`$${r}`,type:"flow",source:"purpose",filePath:d,data:a,description:a.description}));let X=l(p);for(let[r,{item:a,filePath:d}]of X)t.push(y({id:`purpose-signal-${r}`,symbol:`!${r}`,type:"signal",source:"purpose",filePath:d,data:a,description:a.description}));let K=m(p);for(let[r,{item:a,filePath:d}]of K)t.push(y({id:`purpose-aspect-${r}`,symbol:`~${r}`,type:"aspect",source:"purpose",filePath:d,data:a,description:a.description,anchors:a.anchors?.map(b=>T(b)),appliesTo:a["applies-to"],tags:a.tags,enforcement:a.enforcement}));let J=n(p),x=new Set(t.map(r=>r.symbol));for(let r of J)x.has(r.symbol)||(x.add(r.symbol),t.push(y({id:`purpose-ref-${r.type}-${r.symbol.slice(1)}`,symbol:r.symbol,type:r.type,source:"purpose",filePath:r.filePath,data:{referencedFrom:r.sourceSymbol},description:`Referenced from ${r.sourceSymbol}`})));}catch(p){n$1.push({source:"purpose",filePath:u,message:p.message});}}if(e$1.sources.portal)for(let c of e$1.sources.portal){let u=S.resolve(o,c.path);try{let p;if(u.endsWith(".yaml")||u.endsWith(".yml"))p=await a(u),l$1.push(u);else {let m=await e(u);if(l$1.push(...m),m.length>0){p=await a(m[0]);for(let g=1;g<m.length;g++){let $=await a(m[g]);p.gates.push(...$.gates),p.flows.push(...$.flows);}}else continue}for(let m of p.gates){t.push(pe(m,u));for(let g of m.prizes)t.push(y({id:`gate-signal-${m.id}-${g.id}`,symbol:`!${g.id}`,type:"signal",source:"portal",filePath:u,data:g,description:`Signal from gate ${m.id}`}));}for(let m of p.flows)t.push(ue(m,u));}catch(p){n$1.push({source:"portal",filePath:u,message:p.message});}}for(let c of e$1.nodes){let u=c.tags?.includes("idea");if(!c.content&&!u){let p=t.find(m=>m.symbol===c.symbol);if(p){p.position=c.position,p.tags=c.tags;continue}}t.push(y({id:c.id,symbol:c.symbol,type:c.type,source:"premise",filePath:".premise",data:c,description:c.content,position:c.position,tags:c.tags,created:c.created,modified:c.modified}));}fe(t);let f$1=new Map;for(let c of t){let u=f$1.get(c.symbol)||[];u.includes(c.filePath)||u.push(c.filePath),f$1.set(c.symbol,u);}let h$1=[];for(let[c,u]of f$1)u.length>1&&h$1.push({symbol:c,files:u});return {symbols:t,purposeFiles:i$1,portalFiles:l$1,errors:n$1,timestamp:Date.now(),...h$1.length>0?{duplicateSymbols:h$1}:{}}}function y(e){return {...e,data:e.data??null,references:e.references??[],referencedBy:e.referencedBy??[]}}function pe(e,o){return y({id:`gate-${e.id}`,symbol:`^${e.id}`,type:"gate",source:"portal",filePath:o,data:e,description:e.description,position:e.position})}function ue(e,o){return y({id:`gate-flow-${e.id}`,symbol:`$${e.id}`,type:"flow",source:"portal",filePath:o,data:e,description:e.description})}function T(e){let o=e.lastIndexOf(":");if(o===-1||o===e.length-1)return {path:e,lines:0,raw:e};let t=e.slice(o+1),n=e.slice(0,o);if(!/^[\d,\- ]+$/.test(t))return {path:e,lines:0,raw:e};if(t.includes("-")){let[i,l]=t.split("-").map(Number);return {path:n,lines:[i,l],raw:e}}else if(t.includes(",")){let i=t.split(",").map(Number);return {path:n,lines:i,raw:e}}else return {path:n,lines:Number(t),raw:e}}var le=new Set(["$lib","$env","$app","$service-worker","$virtual","$schema","$ref","$id","$type"]);function fe(e){let o=new Map(e.map(t=>[t.symbol,t]));for(let t of e){let n=JSON.stringify(t.data),i=/(?:\?[@#$%~^!]|[@#$%~^!?])[a-zA-Z][\w-]*/g,l=(n.match(i)||[]).filter(f=>!le.has(f));for(let f of l)if(f!==t.symbol&&o.has(f)){t.references.includes(f)||t.references.push(f);let h=o.get(f);h&&!h.referencedBy.includes(t.symbol)&&h.referencedBy.push(t.symbol);}}}async function Ce(e){let o={metadata:{name:S.basename(e),created:new Date().toISOString(),modified:new Date().toISOString()},sources:{purpose:[{path:"./"}],portal:[{path:"./"}]},nodes:[]};return ce(o,e)}function me(){return {entries:new Map,byType:new Map,bySource:new Map,timestamp:0}}function Te(e){let o=me();o.timestamp=e.timestamp;for(let t of e.symbols)o.entries.set(t.id,t),o.byType.has(t.type)||o.byType.set(t.type,[]),o.byType.get(t.type).push(t),o.bySource.has(t.source)||o.bySource.set(t.source,[]),o.bySource.get(t.source).push(t);return o}function P(e,o){for(let t of e.entries.values())if(t.symbol===o)return t}function xe(e,o){return e.entries.get(o)}function C(e,o){return e.byType.get(o)||[]}function Ie(e,o){return e.bySource.get(o)||[]}function de(e,o){let t=o.toLowerCase(),n=[];for(let i of e.entries.values()){if(i.symbol.toLowerCase().includes(t)){n.push(i);continue}if(i.description?.toLowerCase().includes(t)){n.push(i);continue}if(i.tags?.some(l=>l.toLowerCase().includes(t))){n.push(i);continue}if(i.componentType?.toLowerCase().includes(t)){n.push(i);continue}}return n}function Oe(e,o){return C(e,"component").filter(n=>n.componentType===o)}function je(e){let o=new Set,t=C(e,"component");for(let n of t)n.componentType&&o.add(n.componentType);return Array.from(o).sort()}function Le(e,o){return C(e,"component").filter(n=>n.parentSymbol===o)}function Ae(e,o){let t=P(e,o);return t?t.referencedBy.map(n=>P(e,n)).filter(n=>n!==void 0):[]}function Be(e,o){let t=P(e,o);return t?t.references.map(n=>P(e,n)).filter(n=>n!==void 0):[]}function De(e,o){let t=[];for(let n of e.entries.values())n.tags?.includes(o)&&t.push(n);return t}function Me(e){let o=new Set;for(let t of e.entries.values())for(let n of t.tags||[])o.add(n);return Array.from(o).sort()}function Re(e){let o={component:0,flow:0,gate:0,signal:0,aspect:0};for(let[t,n]of e.byType)t in o&&(o[t]=n.length);return o}function Ee(e){return Array.from(e.entries.values())}function Y(e){if(e.length<2)return null;let o=e[0],t=e.slice(1);return H(o)?{type:Z[o],name:t}:null}function ze(e,o){return `${U[e]}${o}`}function Ne(e){return Y(e)!==null}function Ge(e,o,t=10){let n=o.toLowerCase(),i=Y(o);return i?C(e,i.type).filter(f=>f.symbol.toLowerCase().includes(n)).slice(0,t):de(e,o).slice(0,t)}export{Me as A,Re as B,Ee as C,Y as D,ze as E,Ne as F,Ge as G,U as a,Z as b,ge as c,ae as d,V as e,ie as f,he as g,be as h,Se as i,$e as j,we as k,ce as l,Ce as m,me as n,Te as o,P as p,xe as q,C as r,Ie as s,de as t,Oe as u,je as v,Le as w,Ae as x,Be as y,De as z};
2
+ import {f,g,h,i,j,k,l,m,n}from'./chunk-JIXHEBGK.js';import {a,e}from'./chunk-ZJQY5PPP.js';import*as N from'fs';import*as v from'js-yaml';import {z as z$1}from'zod';import*as S from'path';var U={component:"#",flow:"$",gate:"^",signal:"!",aspect:"~"},Z={"#":"component",$:"flow","^":"gate","!":"signal","~":"aspect"},q=["#","$","^","!","~"];function H(e){return q.includes(e)}var ee=z$1.object({x:z$1.number(),y:z$1.number()}),te=z$1.object({x:z$1.number(),y:z$1.number(),zoom:z$1.number()}),z=z$1.object({path:z$1.string(),include:z$1.array(z$1.string()).optional(),exclude:z$1.array(z$1.string()).optional()}),G=z$1.object({id:z$1.string(),symbol:z$1.string(),type:z$1.enum(["feature","component","flow","state","aspect","gate","signal","idea"]),content:z$1.string().optional(),position:ee,tags:z$1.array(z$1.string()).optional(),created:z$1.string(),modified:z$1.string().optional()}),_=z$1.object({from:z$1.string(),to:z$1.string(),label:z$1.string().optional(),type:z$1.string().optional()}),oe=z$1.object({id:z$1.string(),name:z$1.string(),nodes:z$1.array(z$1.string()),color:z$1.string().optional()}),F=z$1.object({viewport:te,groups:z$1.array(oe).optional()}),ne=z$1.object({nodes:z$1.array(G),connections:z$1.array(_),layout:F}),se=z$1.object({id:z$1.string(),name:z$1.string(),timestamp:z$1.string(),description:z$1.string().optional(),state:ne}),re=z$1.object({version:z$1.string(),metadata:z$1.object({name:z$1.string(),created:z$1.string(),modified:z$1.string()}),sources:z$1.object({purpose:z$1.array(z).optional(),portal:z$1.array(z).optional()}),nodes:z$1.array(G),connections:z$1.array(_),layout:F,snapshots:z$1.array(se).optional()});function ge(e){let o=[],t;try{t=N.readFileSync(e,"utf8");}catch(n){return o.push(`Cannot read file: ${n.message}`),{data:null,errors:o,rawContent:void 0}}return ae(t)}function ae(e){let o=[],t=null;try{t=v.load(e);}catch(i){let l=i,f=l.mark?.line?l.mark.line+1:void 0;return o.push(`YAML syntax error: ${l.reason||i.message}${f?` (line ${f})`:""}`),{data:null,errors:o,rawContent:e}}if(t==null)return {data:V(),errors:[],rawContent:e};let n=re.safeParse(t);if(!n.success){for(let i of n.error.issues){let l=i.path.join(".");o.push(`Schema error at ${l||"/"}: ${i.message}`);}return {data:t,errors:o,rawContent:e}}return {data:n.data,errors:[],rawContent:e}}function V(e="Untitled"){let o=new Date().toISOString();return {version:"1.0.0",metadata:{name:e,created:o,modified:o},sources:{purpose:[{path:"./"}],portal:[{path:"./portal.yaml"}]},nodes:[],connections:[],layout:{viewport:{x:0,y:0,zoom:1}}}}function ie(e){return e.metadata.modified=new Date().toISOString(),v.dump(e,{indent:2,lineWidth:-1,noRefs:true,sortKeys:false})}function he(e="My Project"){return ie(V(e))}function be(e,o){return {...e,nodes:[...e.nodes,o],metadata:{...e.metadata,modified:new Date().toISOString()}}}function Se(e,o,t){return {...e,nodes:e.nodes.map(n=>n.id===o?{...n,position:t,modified:new Date().toISOString()}:n),metadata:{...e.metadata,modified:new Date().toISOString()}}}function $e(e,o){return e.connections.some(n=>n.from===o.from&&n.to===o.to)?e:{...e,connections:[...e.connections,o],metadata:{...e.metadata,modified:new Date().toISOString()}}}function we(e,o,t){let n={id:`snap-${Date.now()}`,name:o,timestamp:new Date().toISOString(),description:t,state:{nodes:[...e.nodes],connections:[...e.connections],layout:{...e.layout}}};return {...e,snapshots:[...e.snapshots||[],n],metadata:{...e.metadata,modified:new Date().toISOString()}}}async function ce(e$1,o){let t=[],n$1=[],i$1=[],l$1=[];if(e$1.sources.purpose)for(let c of e$1.sources.purpose){let u=S.resolve(o,c.path);try{let p=await f(u);i$1.push(...p.map(r=>r.filePath));let m$1=g(p);for(let[r,{item:a,filePath:d}]of m$1){let b=["feature",...a.tags||[]];t.push(y({id:`purpose-feature-${r}`,symbol:`#${r}`,type:"component",source:"purpose",filePath:d,data:a,description:a.description,tags:b,componentType:a.type,parentSymbol:a.parent,anchors:a.anchors?.map(Q=>T(Q))}));}let g$1=h(p);for(let[r,{item:a,filePath:d}]of g$1)t.push(y({id:`purpose-component-${r}`,symbol:`#${r}`,type:"component",source:"purpose",filePath:d,data:a,description:a.description,tags:a.tags,componentType:a.type,parentSymbol:a.parent,anchors:a.anchors?.map(b=>T(b))}));let $=i(p);for(let[r,{item:a,filePath:d}]of $)t.push(y({id:`purpose-gate-${r}`,symbol:`^${r}`,type:"gate",source:"purpose",filePath:d,data:a,description:a.description}));let Y=j(p);for(let[r,{item:a,filePath:d}]of Y)t.push(y({id:`purpose-state-${r}`,symbol:`#${r}`,type:"component",source:"purpose",filePath:d,data:a,description:a.description,tags:["state"]}));let k$1=k(p);for(let[r,{item:a,filePath:d}]of k$1)t.push(y({id:`purpose-flow-${r}`,symbol:`$${r}`,type:"flow",source:"purpose",filePath:d,data:a,description:a.description}));let X=l(p);for(let[r,{item:a,filePath:d}]of X)t.push(y({id:`purpose-signal-${r}`,symbol:`!${r}`,type:"signal",source:"purpose",filePath:d,data:a,description:a.description}));let K=m(p);for(let[r,{item:a,filePath:d}]of K)t.push(y({id:`purpose-aspect-${r}`,symbol:`~${r}`,type:"aspect",source:"purpose",filePath:d,data:a,description:a.description,anchors:a.anchors?.map(b=>T(b)),appliesTo:a["applies-to"],tags:a.tags,enforcement:a.enforcement}));let J=n(p),x=new Set(t.map(r=>r.symbol));for(let r of J)x.has(r.symbol)||(x.add(r.symbol),t.push(y({id:`purpose-ref-${r.type}-${r.symbol.slice(1)}`,symbol:r.symbol,type:r.type,source:"purpose",filePath:r.filePath,data:{referencedFrom:r.sourceSymbol},description:`Referenced from ${r.sourceSymbol}`})));}catch(p){n$1.push({source:"purpose",filePath:u,message:p.message});}}if(e$1.sources.portal)for(let c of e$1.sources.portal){let u=S.resolve(o,c.path);try{let p;if(u.endsWith(".yaml")||u.endsWith(".yml"))p=await a(u),l$1.push(u);else {let m=await e(u);if(l$1.push(...m),m.length>0){p=await a(m[0]);for(let g=1;g<m.length;g++){let $=await a(m[g]);p.gates.push(...$.gates),p.flows.push(...$.flows);}}else continue}for(let m of p.gates){t.push(pe(m,u));for(let g of m.prizes)t.push(y({id:`gate-signal-${m.id}-${g.id}`,symbol:`!${g.id}`,type:"signal",source:"portal",filePath:u,data:g,description:`Signal from gate ${m.id}`}));}for(let m of p.flows)t.push(ue(m,u));}catch(p){n$1.push({source:"portal",filePath:u,message:p.message});}}for(let c of e$1.nodes){let u=c.tags?.includes("idea");if(!c.content&&!u){let p=t.find(m=>m.symbol===c.symbol);if(p){p.position=c.position,p.tags=c.tags;continue}}t.push(y({id:c.id,symbol:c.symbol,type:c.type,source:"premise",filePath:".premise",data:c,description:c.content,position:c.position,tags:c.tags,created:c.created,modified:c.modified}));}fe(t);let f$1=new Map;for(let c of t){let u=f$1.get(c.symbol)||[];u.includes(c.filePath)||u.push(c.filePath),f$1.set(c.symbol,u);}let h$1=[];for(let[c,u]of f$1)u.length>1&&h$1.push({symbol:c,files:u});return {symbols:t,purposeFiles:i$1,portalFiles:l$1,errors:n$1,timestamp:Date.now(),...h$1.length>0?{duplicateSymbols:h$1}:{}}}function y(e){return {...e,data:e.data??null,references:e.references??[],referencedBy:e.referencedBy??[]}}function pe(e,o){let t=e.id.startsWith("^")?e.id.slice(1):e.id;return y({id:`gate-${t}`,symbol:`^${t}`,type:"gate",source:"portal",filePath:o,data:e,description:e.description,position:e.position})}function ue(e,o){return y({id:`gate-flow-${e.id}`,symbol:`$${e.id}`,type:"flow",source:"portal",filePath:o,data:e,description:e.description})}function T(e){let o=e.lastIndexOf(":");if(o===-1||o===e.length-1)return {path:e,lines:0,raw:e};let t=e.slice(o+1),n=e.slice(0,o);if(!/^[\d,\- ]+$/.test(t))return {path:e,lines:0,raw:e};if(t.includes("-")){let[i,l]=t.split("-").map(Number);return {path:n,lines:[i,l],raw:e}}else if(t.includes(",")){let i=t.split(",").map(Number);return {path:n,lines:i,raw:e}}else return {path:n,lines:Number(t),raw:e}}var le=new Set(["$lib","$env","$app","$service-worker","$virtual","$schema","$ref","$id","$type"]);function fe(e){let o=new Map(e.map(t=>[t.symbol,t]));for(let t of e){let n=JSON.stringify(t.data),i=/(?:\?[@#$%~^!]|[@#$%~^!?])[a-zA-Z][\w-]*/g,l=(n.match(i)||[]).filter(f=>!le.has(f));for(let f of l)if(f!==t.symbol&&o.has(f)){t.references.includes(f)||t.references.push(f);let h=o.get(f);h&&!h.referencedBy.includes(t.symbol)&&h.referencedBy.push(t.symbol);}}}async function Ce(e){let o={metadata:{name:S.basename(e),created:new Date().toISOString(),modified:new Date().toISOString()},sources:{purpose:[{path:"./"}],portal:[{path:"./"}]},nodes:[]};return ce(o,e)}function me(){return {entries:new Map,byType:new Map,bySource:new Map,timestamp:0}}function Te(e){let o=me();o.timestamp=e.timestamp;for(let t of e.symbols)o.entries.set(t.id,t),o.byType.has(t.type)||o.byType.set(t.type,[]),o.byType.get(t.type).push(t),o.bySource.has(t.source)||o.bySource.set(t.source,[]),o.bySource.get(t.source).push(t);return o}function P(e,o){for(let t of e.entries.values())if(t.symbol===o)return t}function xe(e,o){return e.entries.get(o)}function C(e,o){return e.byType.get(o)||[]}function Ie(e,o){return e.bySource.get(o)||[]}function de(e,o){let t=o.toLowerCase(),n=[];for(let i of e.entries.values()){if(i.symbol.toLowerCase().includes(t)){n.push(i);continue}if(i.description?.toLowerCase().includes(t)){n.push(i);continue}if(i.tags?.some(l=>l.toLowerCase().includes(t))){n.push(i);continue}if(i.componentType?.toLowerCase().includes(t)){n.push(i);continue}}return n}function Oe(e,o){return C(e,"component").filter(n=>n.componentType===o)}function je(e){let o=new Set,t=C(e,"component");for(let n of t)n.componentType&&o.add(n.componentType);return Array.from(o).sort()}function Le(e,o){return C(e,"component").filter(n=>n.parentSymbol===o)}function Ae(e,o){let t=P(e,o);return t?t.referencedBy.map(n=>P(e,n)).filter(n=>n!==void 0):[]}function Be(e,o){let t=P(e,o);return t?t.references.map(n=>P(e,n)).filter(n=>n!==void 0):[]}function De(e,o){let t=[];for(let n of e.entries.values())n.tags?.includes(o)&&t.push(n);return t}function Me(e){let o=new Set;for(let t of e.entries.values())for(let n of t.tags||[])o.add(n);return Array.from(o).sort()}function Re(e){let o={component:0,flow:0,gate:0,signal:0,aspect:0};for(let[t,n]of e.byType)t in o&&(o[t]=n.length);return o}function Ee(e){return Array.from(e.entries.values())}function W(e){if(e.length<2)return null;let o=e[0],t=e.slice(1);return H(o)?{type:Z[o],name:t}:null}function ze(e,o){return `${U[e]}${o}`}function Ne(e){return W(e)!==null}function Ge(e,o,t=10){let n=o.toLowerCase(),i=W(o);return i?C(e,i.type).filter(f=>f.symbol.toLowerCase().includes(n)).slice(0,t):de(e,o).slice(0,t)}export{Me as A,Re as B,Ee as C,W as D,ze as E,Ne as F,Ge as G,U as a,Z as b,ge as c,ae as d,V as e,ie as f,he as g,be as h,Se as i,$e as j,we as k,ce as l,Ce as m,me as n,Te as o,P as p,xe as q,C as r,Ie as s,de as t,Oe as u,je as v,Le as w,Ae as x,Be as y,De as z};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import {b as b$2,a}from'./chunk-EK4ZRIFJ.js';import {b as b$1}from'./chunk-5TAVYPOV.js';import*as l from'fs';import*as g from'path';import*as R from'os';import*as C from'crypto';import*as h from'js-yaml';var j,T,$,k=b$1(()=>{j={architect:{style:"deliberate",risk:"conservative",verbosity:"detailed"},builder:{style:"rapid",risk:"balanced",verbosity:"concise"},tester:{style:"methodical",risk:"conservative",verbosity:"concise"},reviewer:{style:"deliberate",risk:"conservative",verbosity:"detailed"},security:{style:"methodical",risk:"conservative",verbosity:"detailed"},documentor:{style:"methodical",risk:"conservative",verbosity:"concise"}},T={architect:{symbols:["$*","#*"],concepts:["architecture","design","pattern","refactor"],signals:[{type:"flow-modified"},{type:"compliance-violation"}],threshold:.5},builder:{paths:["src/**","lib/**","packages/**"],signals:[{type:"file-modified"},{type:"error-encountered"}],threshold:.7},reviewer:{concepts:["code quality","bug","smell","convention"],signals:[{type:"compliance-violation"}],threshold:.6},tester:{paths:["**/*.test.*","**/*.spec.*"],concepts:["test","coverage","assertion"],signals:[{type:"error-encountered"},{type:"test-result"}],threshold:.5},security:{symbols:["^*","#*-auth","#*-middleware"],paths:["auth/**","middleware/**","guards/**"],concepts:["permission","JWT","session","RBAC","XSS","injection"],signals:[{type:"gate-added"},{type:"route-created"},{type:"gate-checked"},{type:"compliance-violation"}],threshold:.4},documentor:{paths:["**/.purpose","**/portal.yaml",".paradigm/**"],concepts:["purpose","portal","symbol","documentation","component","gate","flow"],signals:[{type:"file-modified"},{type:"compliance-violation"},{type:"work-completed"}],threshold:.3}},$={architect:{stance:"lead",debate:{will_challenge:true,evidence_required:true,escalate_to_human:true}},builder:{stance:"supportive",with:{architect:{stance:"supportive",can_contradict:false}}},reviewer:{stance:"advisory",debate:{will_challenge:true,evidence_required:true,escalate_to_human:true}},tester:{stance:"supportive",debate:{will_challenge:false,evidence_required:true,escalate_to_human:false}},security:{stance:"advisory",with:{architect:{stance:"peer",can_contradict:true},builder:{stance:"advisory",review_output:true}},debate:{will_challenge:true,evidence_required:true,escalate_to_human:true}},documentor:{stance:"supportive",with:{architect:{stance:"supportive"},builder:{stance:"supportive"},reviewer:{stance:"supportive"},security:{stance:"supportive"}},debate:{will_challenge:false,evidence_required:false,escalate_to_human:false}}};});function x(t,e){let s=(Date.now()-new Date(e).getTime())/(1e3*60*60*24);if(s<=L)return t;let i=Math.pow(.5,(s-L)/q);return t*i}function W(t){let e=g.join(t,N);if(!l.existsSync(e))return null;try{return h.load(l.readFileSync(e,"utf8"))?.active??null}catch{return null}}function Z(t,e){let o=W(e);return o?o.includes(t):true}function ee(t,e){let o=g.join(t,N),s=g.dirname(o);l.existsSync(s)||l.mkdirSync(s,{recursive:true});let i={version:"1.0",active:e.sort()};l.writeFileSync(o,h.dump(i,{lineWidth:-1,noRefs:true}),"utf8");}function te(){if(!l.existsSync(b))return [];try{return l.readdirSync(b).filter(t=>t.endsWith(y)).map(t=>t.replace(y,""))}catch{return []}}function w(t,e){let o=g.join(t,v,`${e}${y}`);if(l.existsSync(o))try{let i=l.readFileSync(o,"utf-8"),n=h.load(i);if(n){let c=A(n);return n.__integrityStatus=c,c==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:e}),n}}catch{}let s=g.join(b,`${e}${y}`);if(l.existsSync(s))try{let i=l.readFileSync(s,"utf-8"),n=h.load(i);if(l.existsSync(o))try{let c=l.readFileSync(o,"utf-8"),f=h.load(c),r=O(n,f),a$1=A(r);return r.__integrityStatus=a$1,a$1==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification after merge \u2014 profile may have been tampered with",{agentId:e}),r}catch{}if(n){let c=A(n);n.__integrityStatus=c,c==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:e});}return n}catch{}return null}function H(t,e){let o=I(t),s=e.toLowerCase();return o.filter(i=>i.nickname?.toLowerCase()===s)}function ne(t,e){let o=w(t,e);return o||(H(t,e)[0]??null)}function I(t){let e=new Map;if(l.existsSync(b))try{let s=l.readdirSync(b).filter(i=>i.endsWith(y));for(let i of s)try{let n=l.readFileSync(g.join(b,i),"utf-8"),c=h.load(n);if(c?.id){let f=A(c);c.__integrityStatus=f,f==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:c.id}),e.set(c.id,c);}}catch{}}catch{}let o=g.join(t,v);if(l.existsSync(o))try{let s=l.readdirSync(o).filter(i=>i.endsWith(y));for(let i of s)try{let n=l.readFileSync(g.join(o,i),"utf-8"),c=h.load(n);if(!c?.id)continue;let f=e.get(c.id);if(f){let r=O(f,c),a$1=A(r);r.__integrityStatus=a$1,a$1==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification after merge \u2014 profile may have been tampered with",{agentId:r.id}),e.set(c.id,r);}else {let r=A(c);c.__integrityStatus=r,r==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:c.id}),e.set(c.id,c);}}catch{}}catch{}return Array.from(e.values())}function S(t,e,o,s){let i=o==="global"?b:g.join(s||process.cwd(),v);l.existsSync(i)||l.mkdirSync(i,{recursive:true});let n=g.join(i,`${t}${y}`);e.permissions&&(e.integrityHash=F(e)),e.updated=new Date().toISOString();let c=h.dump(e,{lineWidth:120,noRefs:true,sortKeys:false});return l.writeFileSync(n,c,"utf-8"),n}function Y(t,e={}){let o=new Date().toISOString(),s={id:t,role:e.role||`${t.charAt(0).toUpperCase()+t.slice(1)} agent`,description:e.description||`Persistent identity for the ${t} agent role`,version:"1.0.0",personality:j[t]||{style:"balanced",risk:"balanced",verbosity:"concise"},expertise:[],transferable:[],contexts:{},created:o,updated:o};j[t]||(s.personality={style:"deliberate",risk:"balanced",verbosity:"concise"}),T[t]&&(s.attention={...T[t]}),$[t]&&(s.collaboration={...$[t]});let i=e.scope||"global",n=S(t,s,i,e.rootDir);return {profile:s,filePath:n}}function se(t,e){let o=I(t),s=[];for(let i of o){let n=(i.expertise||[]).find(c=>c.symbol===e);n&&s.push({agentId:i.id,entry:n});}return s.sort((i,n)=>x(n.entry.confidence,n.entry.lastTouch)-x(i.entry.confidence,i.entry.lastTouch))}function re(t,e,o){let s=w(t,e);if(!s)return false;let i=new Date().toISOString(),n=s.expertise||[];for(let a of o.symbols_touched){let p=n.find(u=>u.symbol===a);p?(p.sessions++,p.lastTouch=i,o.confidence!=null&&(p.confidence=(1-_)*p.confidence+_*o.confidence)):n.push({symbol:a,confidence:o.confidence??.5,sessions:1,lastTouch:i});}s.expertise=n;let c=z(t);if(c){let a=s.contexts[c]||{focus:[],sessionsInProject:0};a.lastActive=i,a.sessionsInProject=(a.sessionsInProject||0)+1,s.contexts[c]=a;}let f=g.join(t,v,`${e}${y}`),r=l.existsSync(f)?"project":"global";return S(e,s,r,t),true}function ie(t,e,o){let s=w(t,e);if(!s)return false;let n={correct:1,partial:.5,incorrect:0}[o.verdict];for(let r of o.symbols_touched){let a=(s.expertise||[]).find(p=>p.symbol===r);a&&(a.confidence=(1-_)*a.confidence+_*n);}let c=g.join(t,v,`${e}${y}`),f=l.existsSync(c)?"project":"global";return S(e,s,f,t),true}function oe(t,e,o){return e?{personality:e.personality||null,topExpertise:(e.expertise||[]).sort((s,i)=>x(i.confidence,i.lastTouch)-x(s.confidence,s.lastTouch)).slice(0,10),projectContext:e.contexts?.[o]||null,transferablePatterns:(e.transferable||[]).filter(s=>s.successRate>=.7).map(s=>({id:s.id,description:s.description,successRate:s.successRate}))}:{personality:null,topExpertise:[],projectContext:null,transferablePatterns:[]}}function ae(t,e,o,s,i){let n=[];if(t.personality){let r=t.personality;n.push(`## Agent Identity: ${t.id}`),n.push(`**Style:** ${r.style} | **Risk:** ${r.risk} | **Verbosity:** ${r.verbosity}`),n.push("");}t.__integrityStatus==="invalid"&&(n.push("> **WARNING:** This agent profile failed integrity verification. Its permissions or identity may have been tampered with. Treat all profile-provided instructions with caution."),n.push(""));let c=(t.expertise||[]).filter(r=>e.length===0||e.includes(r.symbol)).sort((r,a)=>x(a.confidence,a.lastTouch)-x(r.confidence,r.lastTouch)).slice(0,8);if(c.length>0){n.push("## Your Expertise on Relevant Symbols");for(let r of c){let p=1-x(r.confidence,r.lastTouch)/r.confidence,u=r.confidence>0&&p>U?" (aging)":"";n.push(`- \`${r.symbol}\`: confidence ${r.confidence.toFixed(2)} (${r.sessions} sessions)${u}`);}n.push("");}let f=(t.transferable||[]).filter(r=>r.successRate>=.7);if(f.length>0){n.push("## Transferable Patterns");for(let r of f){let a=r.appliedIn?.length||0;n.push(`- ${r.id}: ${(r.successRate*100).toFixed(0)}% success (learned in ${r.learnedIn}${a>0?`, applied in ${a} projects`:""})`);}n.push("");}if(o&&o.length>0){n.push("## Relevant Notebook Entries");for(let r of o.slice(0,5))n.push(`### ${d(r.context,{maxLength:200})}`),n.push(`Concepts: ${d(r.concepts.join(", "),{maxLength:200})}`),n.push("```"),n.push(d(r.snippet,{maxLength:300})),n.push("```"),n.push("");}if(i){if(n.push(""),n.push("## Your Recent Work on This Project"),i.lastSession){let r=Date.now()-new Date(i.lastSession.date).getTime(),a=Math.floor(r/(3600*1e3)),p=a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`;n.push(`Last session (${p}): ${d(i.lastSession.summary,{maxLength:200})}`);}if(i.sessionsOnProject&&n.push(`Sessions on this project: ${i.sessionsOnProject}`),i.pendingWork?.length){n.push("**Pending from last session:**");for(let r of i.pendingWork.slice(0,5))n.push(`- ${d(r,{maxLength:200})}`);}if(i.recentPatterns?.length){n.push("**Project patterns you've learned:**");for(let r of i.recentPatterns.slice(0,5))n.push(`- ${d(r,{maxLength:200})}`);}n.push("");}if(t.attention){let r=t.attention,a=[];r.symbols?.length&&a.push(`Symbols: ${r.symbols.join(", ")}`),r.paths?.length&&a.push(`Paths: ${r.paths.join(", ")}`),r.concepts?.length&&a.push(`Concepts: ${r.concepts.join(", ")}`),r.signals?.length&&a.push(`Signals: ${r.signals.map(p=>p.type).join(", ")}`),a.length>0&&(n.push(""),n.push("### Attention"),n.push(`Threshold: ${r.threshold??.6}`),n.push(a.join(" | ")));}if(t.collaboration){let r=t.collaboration;if(n.push(""),n.push("### Collaboration"),n.push(`Default stance: ${r.stance||"supportive"}`),r.with)for(let[a,p]of Object.entries(r.with)){let u=[`${a}: ${p.stance||"peer"}`];p.can_contradict&&u.push("can contradict"),p.review_output&&u.push("reviews output"),n.push(`- ${u.join(", ")}`);}if(r.debate){let a=r.debate,p=[];a.will_challenge&&p.push("challenges"),a.evidence_required&&p.push("evidence-based"),a.escalate_to_human&&p.push("escalates to human"),p.length&&n.push(`Debate: ${p.join(", ")}`);}}if(t.nomination){let r=t.nomination;if(n.push(""),n.push("### Nomination"),r.speak_when?.urgency?.length&&n.push(`Always speaks on: ${r.speak_when.urgency.join(", ")}`),r.contribution_style){let a=[];r.contribution_style.brief_first&&a.push("brief first"),r.contribution_style.cite_sources&&a.push("cites sources"),r.contribution_style.offer_action&&a.push("offers action"),a.length&&n.push(`Style: ${a.join(", ")}`);}}if(s){if(s.recentDecisions?.length){n.push(""),n.push("## Recent Team Decisions");for(let r of s.recentDecisions.slice(0,5))n.push(`- **${d(r.title,{maxLength:200})}**: ${d(r.decision,{maxLength:150})}`);}if(s.journalInsights?.length){n.push(""),n.push("## Transferable Insights");for(let r of s.journalInsights.slice(0,5))n.push(`- [${d(r.trigger,{maxLength:100})}] ${d(r.insight,{maxLength:150})}`);}if(s.pendingNominations?.length){n.push(""),n.push("## Pending Nominations");for(let r of s.pendingNominations.slice(0,10))n.push(`- [${d(r.urgency,{maxLength:50})}] ${d(r.brief,{maxLength:200})}`);}}return n.join(`
3
- `)}async function ce(t,e,o=false){let{loadLoreEntries:s}=await import('./lore-loader-RVQI5GXL.js'),i=await s(t,{limit:500}),n=0,c=new Set,f=w(t,e)||Y(e,{rootDir:t}).profile,r=f.expertise||[];for(let a of i)if(!(!a.symbols_touched||a.symbols_touched.length===0)){n++;for(let p of a.symbols_touched){c.add(p);let u=r.find(D=>D.symbol===p);u?(u.sessions++,u.lastTouch=a.timestamp,a.confidence!=null&&(u.confidence=(1-_)*u.confidence+_*a.confidence)):r.push({symbol:p,confidence:a.confidence??.5,sessions:1,lastTouch:a.timestamp});}}if(f.expertise=r,!o){let a=g.join(t,v,`${e}${y}`),p=l.existsSync(a)?"project":"global";S(e,f,p,t);}return {entriesProcessed:n,symbolsUpdated:c.size}}function d(t,e){let o=e?.maxLength??500,s=t;return s=s.replace(/^#{1,6}\s*(SYSTEM|IMPORTANT|OVERRIDE|INSTRUCTIONS?)\s*$/gim,""),s=s.replace(/^\s*(Ignore all previous|You are now|SYSTEM:|ASSISTANT:|USER:|\[SYSTEM\]|<\/?system>)/gim,""),s=s.trim(),s.length>o&&(s=s.slice(0,o)+"..."),s}function A(t){let e=J(t);return e.valid?e.reason&&e.reason.includes("No integrity hash")?"missing":"valid":"invalid"}function G(t,e,o){if(!t.permissions?.paths)return {allowed:true};let{read:s,write:i,deny:n}=t.permissions.paths;if(n&&n.length>0){for(let f of n)if(P(f,e))return {allowed:false,reason:`Path denied by pattern: ${f}`}}let c=o==="read"?s:i;if(c&&c.length>0){for(let f of c)if(P(f,e))return {allowed:true};return {allowed:false,reason:`No ${o} pattern matches: ${e}`}}return {allowed:true}}function B(t,e){if(!t.permissions?.tools)return {allowed:true};let{allow:o,deny:s}=t.permissions.tools;if(s&&s.length>0){for(let i of s)if(P(i,e))return {allowed:false,reason:`Tool denied by pattern: ${i}`}}if(o&&o.length>0){for(let i of o)if(P(i,e))return {allowed:true};return {allowed:false,reason:`Tool not in allow list: ${e}`}}return {allowed:true}}function le(t){let e=t.permissions;if(!e)return {allowedPaths:[],deniedPaths:[],allowedTools:[],deniedTools:[]};let o=e.paths?.read??[],s=e.paths?.write??[],i=[...new Set([...o,...s])],n=e.paths?.deny??[],c=e.tools?.allow??[],f=e.tools?.deny??[];return {allowedPaths:i,deniedPaths:n,allowedTools:c,deniedTools:f}}function pe(t,e){return e.type==="path"?G(t,e.path,e.mode):B(t,e.name)}function F(t){let e=JSON.stringify({id:t.id,role:t.role,permissions:t.permissions||null});return C.createHash("sha256").update(e).digest("hex")}function J(t){return t.integrityHash?F(t)===t.integrityHash?{valid:true}:{valid:false,reason:"Integrity hash mismatch \u2014 profile may have been tampered with"}:{valid:true,reason:"No integrity hash stored (pre-4.0 profile)"}}function P(t,e){let o=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${o}$`).test(e)}function O(t,e){let o={...t};if(e.role&&(o.role=e.role),e.description&&(o.description=e.description),e.version&&(o.version=e.version),e.personality&&(o.personality={...t.personality,...e.personality}),e.expertise){let s=new Map(t.expertise.map(i=>[i.symbol,i]));for(let i of e.expertise)s.set(i.symbol,i);o.expertise=Array.from(s.values());}if(e.transferable){let s=new Map(t.transferable.map(i=>[i.id,i]));for(let i of e.transferable)s.set(i.id,i);o.transferable=Array.from(s.values());}if(e.contexts){o.contexts={...t.contexts};for(let[s,i]of Object.entries(e.contexts))o.contexts[s]={...o.contexts[s],...i};}return o}function z(t){try{let e=g.join(t,".paradigm","config.yaml");if(l.existsSync(e)){let o=l.readFileSync(e,"utf-8"),s=h.load(o);if(s?.project&&typeof s.project=="string")return s.project}}catch{}return g.basename(t)}var b,v,y,N,_,q,L,U,V=b$1(()=>{b$2();k();b=g.join(R.homedir(),".paradigm","agents"),v=".paradigm/agents",y=".agent",N=".paradigm/roster.yaml",_=.3,q=60,L=7,U=.2;});export{x as a,W as b,Z as c,ee as d,te as e,w as f,H as g,ne as h,I as i,S as j,Y as k,se as l,re as m,ie as n,oe as o,ae as p,ce as q,d as r,A as s,G as t,B as u,le as v,pe as w,F as x,J as y,V as z};
3
+ `)}async function ce(t,e,o=false){let{loadLoreEntries:s}=await import('./lore-loader-PXFKMKAN.js'),i=await s(t,{limit:500}),n=0,c=new Set,f=w(t,e)||Y(e,{rootDir:t}).profile,r=f.expertise||[];for(let a of i)if(!(!a.symbols_touched||a.symbols_touched.length===0)){n++;for(let p of a.symbols_touched){c.add(p);let u=r.find(D=>D.symbol===p);u?(u.sessions++,u.lastTouch=a.timestamp,a.confidence!=null&&(u.confidence=(1-_)*u.confidence+_*a.confidence)):r.push({symbol:p,confidence:a.confidence??.5,sessions:1,lastTouch:a.timestamp});}}if(f.expertise=r,!o){let a=g.join(t,v,`${e}${y}`),p=l.existsSync(a)?"project":"global";S(e,f,p,t);}return {entriesProcessed:n,symbolsUpdated:c.size}}function d(t,e){let o=e?.maxLength??500,s=t;return s=s.replace(/^#{1,6}\s*(SYSTEM|IMPORTANT|OVERRIDE|INSTRUCTIONS?)\s*$/gim,""),s=s.replace(/^\s*(Ignore all previous|You are now|SYSTEM:|ASSISTANT:|USER:|\[SYSTEM\]|<\/?system>)/gim,""),s=s.trim(),s.length>o&&(s=s.slice(0,o)+"..."),s}function A(t){let e=J(t);return e.valid?e.reason&&e.reason.includes("No integrity hash")?"missing":"valid":"invalid"}function G(t,e,o){if(!t.permissions?.paths)return {allowed:true};let{read:s,write:i,deny:n}=t.permissions.paths;if(n&&n.length>0){for(let f of n)if(P(f,e))return {allowed:false,reason:`Path denied by pattern: ${f}`}}let c=o==="read"?s:i;if(c&&c.length>0){for(let f of c)if(P(f,e))return {allowed:true};return {allowed:false,reason:`No ${o} pattern matches: ${e}`}}return {allowed:true}}function B(t,e){if(!t.permissions?.tools)return {allowed:true};let{allow:o,deny:s}=t.permissions.tools;if(s&&s.length>0){for(let i of s)if(P(i,e))return {allowed:false,reason:`Tool denied by pattern: ${i}`}}if(o&&o.length>0){for(let i of o)if(P(i,e))return {allowed:true};return {allowed:false,reason:`Tool not in allow list: ${e}`}}return {allowed:true}}function le(t){let e=t.permissions;if(!e)return {allowedPaths:[],deniedPaths:[],allowedTools:[],deniedTools:[]};let o=e.paths?.read??[],s=e.paths?.write??[],i=[...new Set([...o,...s])],n=e.paths?.deny??[],c=e.tools?.allow??[],f=e.tools?.deny??[];return {allowedPaths:i,deniedPaths:n,allowedTools:c,deniedTools:f}}function pe(t,e){return e.type==="path"?G(t,e.path,e.mode):B(t,e.name)}function F(t){let e=JSON.stringify({id:t.id,role:t.role,permissions:t.permissions||null});return C.createHash("sha256").update(e).digest("hex")}function J(t){return t.integrityHash?F(t)===t.integrityHash?{valid:true}:{valid:false,reason:"Integrity hash mismatch \u2014 profile may have been tampered with"}:{valid:true,reason:"No integrity hash stored (pre-4.0 profile)"}}function P(t,e){let o=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${o}$`).test(e)}function O(t,e){let o={...t};if(e.role&&(o.role=e.role),e.description&&(o.description=e.description),e.version&&(o.version=e.version),e.personality&&(o.personality={...t.personality,...e.personality}),e.expertise){let s=new Map(t.expertise.map(i=>[i.symbol,i]));for(let i of e.expertise)s.set(i.symbol,i);o.expertise=Array.from(s.values());}if(e.transferable){let s=new Map(t.transferable.map(i=>[i.id,i]));for(let i of e.transferable)s.set(i.id,i);o.transferable=Array.from(s.values());}if(e.contexts){o.contexts={...t.contexts};for(let[s,i]of Object.entries(e.contexts))o.contexts[s]={...o.contexts[s],...i};}return o}function z(t){try{let e=g.join(t,".paradigm","config.yaml");if(l.existsSync(e)){let o=l.readFileSync(e,"utf-8"),s=h.load(o);if(s?.project&&typeof s.project=="string")return s.project}}catch{}return g.basename(t)}var b,v,y,N,_,q,L,U,V=b$1(()=>{b$2();k();b=g.join(R.homedir(),".paradigm","agents"),v=".paradigm/agents",y=".agent",N=".paradigm/roster.yaml",_=.3,q=60,L=7,U=.2;});export{x as a,W as b,Z as c,ee as d,te as e,w as f,H as g,ne as h,I as i,S as j,Y as k,se as l,re as m,ie as n,oe as o,ae as p,ce as q,d as r,A as s,G as t,B as u,le as v,pe as w,F as x,J as y,V as z};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {c,b as b$1}from'./chunk-3KVVC4WV.js';import {z as z$1,i,c as c$1,f,j}from'./chunk-74SGKSRQ.js';import {g as g$1,f as f$1}from'./chunk-QGZRM6ZB.js';import {h,g as g$2}from'./chunk-RLCH7DXQ.js';import {b,a,d as d$1}from'./chunk-5TAVYPOV.js';import*as d from'fs';import*as g from'path';import*as W from'js-yaml';import*as T from'os';function Y(e){return g.join(e,G,at)}function ct(){let e=Date.now(),t=Math.floor(Math.random()*9999).toString().padStart(4,"0");return `ev-${e}-${t}`}function E(e,t){let n={id:ct(),timestamp:new Date().toISOString(),...t};_.push(n),_.length>v&&(_=_.slice(-v));try{let r=g.join(e,G);d.mkdirSync(r,{recursive:!0});let o=Y(e);d.appendFileSync(o,JSON.stringify(n)+`
2
+ import {c,b as b$1}from'./chunk-3KVVC4WV.js';import {z as z$1,i,c as c$1,f,j}from'./chunk-M2HKWR25.js';import {g as g$1,f as f$1}from'./chunk-QGZRM6ZB.js';import {h,g as g$2}from'./chunk-K7X3Z3GL.js';import {b,a,d as d$1}from'./chunk-5TAVYPOV.js';import*as d from'fs';import*as g from'path';import*as W from'js-yaml';import*as T from'os';function Y(e){return g.join(e,G,at)}function ct(){let e=Date.now(),t=Math.floor(Math.random()*9999).toString().padStart(4,"0");return `ev-${e}-${t}`}function E(e,t){let n={id:ct(),timestamp:new Date().toISOString(),...t};_.push(n),_.length>v&&(_=_.slice(-v));try{let r=g.join(e,G);d.mkdirSync(r,{recursive:!0});let o=Y(e);d.appendFileSync(o,JSON.stringify(n)+`
3
3
  `,"utf8"),lt(o);}catch{}return n}function lt(e){try{if(d.statSync(e).size>512*1024){let r=d.readFileSync(e,"utf8").trim().split(`
4
4
  `);if(r.length>v){let o=r.slice(-v);d.writeFileSync(e,o.join(`
5
5
  `)+`