@soleri/core 2.12.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (430) hide show
  1. package/data/flows/build.flow.yaml +128 -0
  2. package/data/flows/deliver.flow.yaml +110 -0
  3. package/data/flows/design.flow.yaml +108 -0
  4. package/data/flows/enhance.flow.yaml +90 -0
  5. package/data/flows/explore.flow.yaml +84 -0
  6. package/data/flows/fix.flow.yaml +90 -0
  7. package/data/flows/plan.flow.yaml +87 -0
  8. package/data/flows/review.flow.yaml +90 -0
  9. package/dist/agency/agency-manager.d.ts +27 -1
  10. package/dist/agency/agency-manager.d.ts.map +1 -1
  11. package/dist/agency/agency-manager.js +180 -9
  12. package/dist/agency/agency-manager.js.map +1 -1
  13. package/dist/agency/default-rules.d.ts +7 -0
  14. package/dist/agency/default-rules.d.ts.map +1 -0
  15. package/dist/agency/default-rules.js +79 -0
  16. package/dist/agency/default-rules.js.map +1 -0
  17. package/dist/agency/types.d.ts +48 -0
  18. package/dist/agency/types.d.ts.map +1 -1
  19. package/dist/brain/brain.d.ts +17 -2
  20. package/dist/brain/brain.d.ts.map +1 -1
  21. package/dist/brain/brain.js +118 -8
  22. package/dist/brain/brain.js.map +1 -1
  23. package/dist/brain/intelligence.d.ts.map +1 -1
  24. package/dist/brain/intelligence.js +16 -2
  25. package/dist/brain/intelligence.js.map +1 -1
  26. package/dist/brain/knowledge-synthesizer.d.ts +37 -0
  27. package/dist/brain/knowledge-synthesizer.d.ts.map +1 -0
  28. package/dist/brain/knowledge-synthesizer.js +161 -0
  29. package/dist/brain/knowledge-synthesizer.js.map +1 -0
  30. package/dist/brain/learning-radar.d.ts +96 -0
  31. package/dist/brain/learning-radar.d.ts.map +1 -0
  32. package/dist/brain/learning-radar.js +202 -0
  33. package/dist/brain/learning-radar.js.map +1 -0
  34. package/dist/brain/types.d.ts +15 -0
  35. package/dist/brain/types.d.ts.map +1 -1
  36. package/dist/capabilities/chain-mapping.d.ts +21 -0
  37. package/dist/capabilities/chain-mapping.d.ts.map +1 -0
  38. package/dist/capabilities/chain-mapping.js +86 -0
  39. package/dist/capabilities/chain-mapping.js.map +1 -0
  40. package/dist/capabilities/index.d.ts +10 -0
  41. package/dist/capabilities/index.d.ts.map +1 -0
  42. package/dist/capabilities/index.js +8 -0
  43. package/dist/capabilities/index.js.map +1 -0
  44. package/dist/capabilities/registry.d.ts +95 -0
  45. package/dist/capabilities/registry.d.ts.map +1 -0
  46. package/dist/capabilities/registry.js +227 -0
  47. package/dist/capabilities/registry.js.map +1 -0
  48. package/dist/capabilities/types.d.ts +106 -0
  49. package/dist/capabilities/types.d.ts.map +1 -0
  50. package/dist/capabilities/types.js +12 -0
  51. package/dist/capabilities/types.js.map +1 -0
  52. package/dist/context/context-engine.d.ts.map +1 -1
  53. package/dist/context/context-engine.js +82 -17
  54. package/dist/context/context-engine.js.map +1 -1
  55. package/dist/context/types.d.ts +5 -0
  56. package/dist/context/types.d.ts.map +1 -1
  57. package/dist/control/intent-router.d.ts +12 -1
  58. package/dist/control/intent-router.d.ts.map +1 -1
  59. package/dist/control/intent-router.js +126 -2
  60. package/dist/control/intent-router.js.map +1 -1
  61. package/dist/control/types.d.ts +17 -0
  62. package/dist/control/types.d.ts.map +1 -1
  63. package/dist/curator/classifier.d.ts +18 -0
  64. package/dist/curator/classifier.d.ts.map +1 -0
  65. package/dist/curator/classifier.js +61 -0
  66. package/dist/curator/classifier.js.map +1 -0
  67. package/dist/curator/quality-gate.d.ts +29 -0
  68. package/dist/curator/quality-gate.d.ts.map +1 -0
  69. package/dist/curator/quality-gate.js +88 -0
  70. package/dist/curator/quality-gate.js.map +1 -0
  71. package/dist/domain-packs/index.d.ts +8 -0
  72. package/dist/domain-packs/index.d.ts.map +1 -0
  73. package/dist/domain-packs/index.js +8 -0
  74. package/dist/domain-packs/index.js.map +1 -0
  75. package/dist/domain-packs/inject-rules.d.ts +24 -0
  76. package/dist/domain-packs/inject-rules.d.ts.map +1 -0
  77. package/dist/domain-packs/inject-rules.js +65 -0
  78. package/dist/domain-packs/inject-rules.js.map +1 -0
  79. package/dist/domain-packs/knowledge-installer.d.ts +27 -0
  80. package/dist/domain-packs/knowledge-installer.d.ts.map +1 -0
  81. package/dist/domain-packs/knowledge-installer.js +89 -0
  82. package/dist/domain-packs/knowledge-installer.js.map +1 -0
  83. package/dist/domain-packs/loader.d.ts +28 -0
  84. package/dist/domain-packs/loader.d.ts.map +1 -0
  85. package/dist/domain-packs/loader.js +105 -0
  86. package/dist/domain-packs/loader.js.map +1 -0
  87. package/dist/domain-packs/pack-runtime.d.ts +80 -0
  88. package/dist/domain-packs/pack-runtime.d.ts.map +1 -0
  89. package/dist/domain-packs/pack-runtime.js +36 -0
  90. package/dist/domain-packs/pack-runtime.js.map +1 -0
  91. package/dist/domain-packs/skills-installer.d.ts +21 -0
  92. package/dist/domain-packs/skills-installer.d.ts.map +1 -0
  93. package/dist/domain-packs/skills-installer.js +38 -0
  94. package/dist/domain-packs/skills-installer.js.map +1 -0
  95. package/dist/domain-packs/token-resolver.d.ts +37 -0
  96. package/dist/domain-packs/token-resolver.d.ts.map +1 -0
  97. package/dist/domain-packs/token-resolver.js +109 -0
  98. package/dist/domain-packs/token-resolver.js.map +1 -0
  99. package/dist/domain-packs/types.d.ts +91 -0
  100. package/dist/domain-packs/types.d.ts.map +1 -0
  101. package/dist/domain-packs/types.js +122 -0
  102. package/dist/domain-packs/types.js.map +1 -0
  103. package/dist/engine/bin/soleri-engine.d.ts +12 -0
  104. package/dist/engine/bin/soleri-engine.d.ts.map +1 -0
  105. package/dist/engine/bin/soleri-engine.js +184 -0
  106. package/dist/engine/bin/soleri-engine.js.map +1 -0
  107. package/dist/engine/core-ops.d.ts +27 -0
  108. package/dist/engine/core-ops.d.ts.map +1 -0
  109. package/dist/engine/core-ops.js +159 -0
  110. package/dist/engine/core-ops.js.map +1 -0
  111. package/dist/engine/index.d.ts +19 -0
  112. package/dist/engine/index.d.ts.map +1 -0
  113. package/dist/engine/index.js +17 -0
  114. package/dist/engine/index.js.map +1 -0
  115. package/dist/engine/register-engine.d.ts +54 -0
  116. package/dist/engine/register-engine.d.ts.map +1 -0
  117. package/dist/engine/register-engine.js +270 -0
  118. package/dist/engine/register-engine.js.map +1 -0
  119. package/dist/engine/test-helpers.d.ts +30 -0
  120. package/dist/engine/test-helpers.d.ts.map +1 -0
  121. package/dist/engine/test-helpers.js +59 -0
  122. package/dist/engine/test-helpers.js.map +1 -0
  123. package/dist/events/event-bus.d.ts +30 -0
  124. package/dist/events/event-bus.d.ts.map +1 -0
  125. package/dist/events/event-bus.js +51 -0
  126. package/dist/events/event-bus.js.map +1 -0
  127. package/dist/flows/chain-runner.d.ts +46 -0
  128. package/dist/flows/chain-runner.d.ts.map +1 -0
  129. package/dist/flows/chain-runner.js +271 -0
  130. package/dist/flows/chain-runner.js.map +1 -0
  131. package/dist/flows/chain-types.d.ts +103 -0
  132. package/dist/flows/chain-types.d.ts.map +1 -0
  133. package/dist/flows/chain-types.js +23 -0
  134. package/dist/flows/chain-types.js.map +1 -0
  135. package/dist/flows/context-router.d.ts +39 -0
  136. package/dist/flows/context-router.d.ts.map +1 -0
  137. package/dist/flows/context-router.js +206 -0
  138. package/dist/flows/context-router.js.map +1 -0
  139. package/dist/flows/dispatch-registry.d.ts +24 -0
  140. package/dist/flows/dispatch-registry.d.ts.map +1 -0
  141. package/dist/flows/dispatch-registry.js +70 -0
  142. package/dist/flows/dispatch-registry.js.map +1 -0
  143. package/dist/flows/epilogue.d.ts +24 -0
  144. package/dist/flows/epilogue.d.ts.map +1 -0
  145. package/dist/flows/epilogue.js +52 -0
  146. package/dist/flows/epilogue.js.map +1 -0
  147. package/dist/flows/executor.d.ts +25 -0
  148. package/dist/flows/executor.d.ts.map +1 -0
  149. package/dist/flows/executor.js +153 -0
  150. package/dist/flows/executor.js.map +1 -0
  151. package/dist/flows/gate-evaluator.d.ts +26 -0
  152. package/dist/flows/gate-evaluator.d.ts.map +1 -0
  153. package/dist/flows/gate-evaluator.js +162 -0
  154. package/dist/flows/gate-evaluator.js.map +1 -0
  155. package/dist/flows/index.d.ts +14 -0
  156. package/dist/flows/index.d.ts.map +1 -0
  157. package/dist/flows/index.js +20 -0
  158. package/dist/flows/index.js.map +1 -0
  159. package/dist/flows/loader.d.ts +17 -0
  160. package/dist/flows/loader.d.ts.map +1 -0
  161. package/dist/flows/loader.js +61 -0
  162. package/dist/flows/loader.js.map +1 -0
  163. package/dist/flows/plan-builder.d.ts +40 -0
  164. package/dist/flows/plan-builder.d.ts.map +1 -0
  165. package/dist/flows/plan-builder.js +213 -0
  166. package/dist/flows/plan-builder.js.map +1 -0
  167. package/dist/flows/probes.d.ts +11 -0
  168. package/dist/flows/probes.d.ts.map +1 -0
  169. package/dist/flows/probes.js +62 -0
  170. package/dist/flows/probes.js.map +1 -0
  171. package/dist/flows/types.d.ts +950 -0
  172. package/dist/flows/types.d.ts.map +1 -0
  173. package/dist/flows/types.js +105 -0
  174. package/dist/flows/types.js.map +1 -0
  175. package/dist/health/doctor-checks.d.ts +15 -0
  176. package/dist/health/doctor-checks.d.ts.map +1 -0
  177. package/dist/health/doctor-checks.js +98 -0
  178. package/dist/health/doctor-checks.js.map +1 -0
  179. package/dist/index.d.ts +11 -1
  180. package/dist/index.d.ts.map +1 -1
  181. package/dist/index.js +10 -1
  182. package/dist/index.js.map +1 -1
  183. package/dist/intake/text-ingester.d.ts +52 -0
  184. package/dist/intake/text-ingester.d.ts.map +1 -0
  185. package/dist/intake/text-ingester.js +181 -0
  186. package/dist/intake/text-ingester.js.map +1 -0
  187. package/dist/intelligence/loader.d.ts +19 -0
  188. package/dist/intelligence/loader.d.ts.map +1 -1
  189. package/dist/intelligence/loader.js +35 -0
  190. package/dist/intelligence/loader.js.map +1 -1
  191. package/dist/intelligence/types.d.ts +1 -0
  192. package/dist/intelligence/types.d.ts.map +1 -1
  193. package/dist/llm/llm-client.d.ts.map +1 -1
  194. package/dist/llm/llm-client.js +37 -1
  195. package/dist/llm/llm-client.js.map +1 -1
  196. package/dist/llm/oauth-discovery.d.ts +26 -0
  197. package/dist/llm/oauth-discovery.d.ts.map +1 -0
  198. package/dist/llm/oauth-discovery.js +149 -0
  199. package/dist/llm/oauth-discovery.js.map +1 -0
  200. package/dist/packs/types.d.ts +58 -19
  201. package/dist/packs/types.d.ts.map +1 -1
  202. package/dist/packs/types.js +14 -0
  203. package/dist/packs/types.js.map +1 -1
  204. package/dist/planning/evidence-collector.d.ts +41 -0
  205. package/dist/planning/evidence-collector.d.ts.map +1 -0
  206. package/dist/planning/evidence-collector.js +194 -0
  207. package/dist/planning/evidence-collector.js.map +1 -0
  208. package/dist/planning/planner.d.ts +4 -0
  209. package/dist/planning/planner.d.ts.map +1 -1
  210. package/dist/planning/planner.js +11 -0
  211. package/dist/planning/planner.js.map +1 -1
  212. package/dist/playbooks/generic/onboarding.d.ts +9 -0
  213. package/dist/playbooks/generic/onboarding.d.ts.map +1 -0
  214. package/dist/playbooks/generic/onboarding.js +74 -0
  215. package/dist/playbooks/generic/onboarding.js.map +1 -0
  216. package/dist/playbooks/playbook-registry.d.ts.map +1 -1
  217. package/dist/playbooks/playbook-registry.js +2 -0
  218. package/dist/playbooks/playbook-registry.js.map +1 -1
  219. package/dist/queue/job-queue.d.ts +92 -0
  220. package/dist/queue/job-queue.d.ts.map +1 -0
  221. package/dist/queue/job-queue.js +180 -0
  222. package/dist/queue/job-queue.js.map +1 -0
  223. package/dist/queue/pipeline-runner.d.ts +62 -0
  224. package/dist/queue/pipeline-runner.d.ts.map +1 -0
  225. package/dist/queue/pipeline-runner.js +126 -0
  226. package/dist/queue/pipeline-runner.js.map +1 -0
  227. package/dist/runtime/admin-extra-ops.d.ts.map +1 -1
  228. package/dist/runtime/admin-extra-ops.js +15 -9
  229. package/dist/runtime/admin-extra-ops.js.map +1 -1
  230. package/dist/runtime/admin-ops.js +4 -4
  231. package/dist/runtime/admin-ops.js.map +1 -1
  232. package/dist/runtime/admin-setup-ops.d.ts +20 -0
  233. package/dist/runtime/admin-setup-ops.d.ts.map +1 -0
  234. package/dist/runtime/admin-setup-ops.js +583 -0
  235. package/dist/runtime/admin-setup-ops.js.map +1 -0
  236. package/dist/runtime/capture-ops.d.ts.map +1 -1
  237. package/dist/runtime/capture-ops.js +33 -1
  238. package/dist/runtime/capture-ops.js.map +1 -1
  239. package/dist/runtime/chain-ops.d.ts +9 -0
  240. package/dist/runtime/chain-ops.d.ts.map +1 -0
  241. package/dist/runtime/chain-ops.js +107 -0
  242. package/dist/runtime/chain-ops.js.map +1 -0
  243. package/dist/runtime/claude-md-helpers.d.ts +65 -0
  244. package/dist/runtime/claude-md-helpers.d.ts.map +1 -0
  245. package/dist/runtime/claude-md-helpers.js +173 -0
  246. package/dist/runtime/claude-md-helpers.js.map +1 -0
  247. package/dist/runtime/curator-extra-ops.d.ts +3 -2
  248. package/dist/runtime/curator-extra-ops.d.ts.map +1 -1
  249. package/dist/runtime/curator-extra-ops.js +81 -3
  250. package/dist/runtime/curator-extra-ops.js.map +1 -1
  251. package/dist/runtime/domain-ops.d.ts +21 -5
  252. package/dist/runtime/domain-ops.d.ts.map +1 -1
  253. package/dist/runtime/domain-ops.js +64 -6
  254. package/dist/runtime/domain-ops.js.map +1 -1
  255. package/dist/runtime/facades/admin-facade.d.ts.map +1 -1
  256. package/dist/runtime/facades/admin-facade.js +4 -0
  257. package/dist/runtime/facades/admin-facade.js.map +1 -1
  258. package/dist/runtime/facades/agency-facade.d.ts.map +1 -1
  259. package/dist/runtime/facades/agency-facade.js +64 -0
  260. package/dist/runtime/facades/agency-facade.js.map +1 -1
  261. package/dist/runtime/facades/brain-facade.d.ts.map +1 -1
  262. package/dist/runtime/facades/brain-facade.js +122 -1
  263. package/dist/runtime/facades/brain-facade.js.map +1 -1
  264. package/dist/runtime/facades/cognee-facade.d.ts.map +1 -1
  265. package/dist/runtime/facades/cognee-facade.js +3 -1
  266. package/dist/runtime/facades/cognee-facade.js.map +1 -1
  267. package/dist/runtime/facades/control-facade.d.ts.map +1 -1
  268. package/dist/runtime/facades/control-facade.js +42 -0
  269. package/dist/runtime/facades/control-facade.js.map +1 -1
  270. package/dist/runtime/facades/index.d.ts.map +1 -1
  271. package/dist/runtime/facades/index.js +10 -6
  272. package/dist/runtime/facades/index.js.map +1 -1
  273. package/dist/runtime/facades/memory-facade.d.ts.map +1 -1
  274. package/dist/runtime/facades/memory-facade.js +20 -2
  275. package/dist/runtime/facades/memory-facade.js.map +1 -1
  276. package/dist/runtime/facades/plan-facade.d.ts.map +1 -1
  277. package/dist/runtime/facades/plan-facade.js +2 -0
  278. package/dist/runtime/facades/plan-facade.js.map +1 -1
  279. package/dist/runtime/facades/vault-facade.d.ts.map +1 -1
  280. package/dist/runtime/facades/vault-facade.js +27 -5
  281. package/dist/runtime/facades/vault-facade.js.map +1 -1
  282. package/dist/runtime/intake-ops.d.ts +7 -5
  283. package/dist/runtime/intake-ops.d.ts.map +1 -1
  284. package/dist/runtime/intake-ops.js +98 -5
  285. package/dist/runtime/intake-ops.js.map +1 -1
  286. package/dist/runtime/memory-extra-ops.d.ts +6 -3
  287. package/dist/runtime/memory-extra-ops.d.ts.map +1 -1
  288. package/dist/runtime/memory-extra-ops.js +292 -4
  289. package/dist/runtime/memory-extra-ops.js.map +1 -1
  290. package/dist/runtime/orchestrate-ops.d.ts +8 -7
  291. package/dist/runtime/orchestrate-ops.d.ts.map +1 -1
  292. package/dist/runtime/orchestrate-ops.js +217 -61
  293. package/dist/runtime/orchestrate-ops.js.map +1 -1
  294. package/dist/runtime/planning-extra-ops.d.ts.map +1 -1
  295. package/dist/runtime/planning-extra-ops.js +85 -0
  296. package/dist/runtime/planning-extra-ops.js.map +1 -1
  297. package/dist/runtime/playbook-ops.js +1 -1
  298. package/dist/runtime/playbook-ops.js.map +1 -1
  299. package/dist/runtime/runtime.d.ts.map +1 -1
  300. package/dist/runtime/runtime.js +165 -18
  301. package/dist/runtime/runtime.js.map +1 -1
  302. package/dist/runtime/session-briefing.d.ts +23 -0
  303. package/dist/runtime/session-briefing.d.ts.map +1 -0
  304. package/dist/runtime/session-briefing.js +140 -0
  305. package/dist/runtime/session-briefing.js.map +1 -0
  306. package/dist/runtime/types.d.ts +29 -2
  307. package/dist/runtime/types.d.ts.map +1 -1
  308. package/dist/runtime/vault-linking-ops.d.ts +13 -0
  309. package/dist/runtime/vault-linking-ops.d.ts.map +1 -0
  310. package/dist/runtime/vault-linking-ops.js +365 -0
  311. package/dist/runtime/vault-linking-ops.js.map +1 -0
  312. package/dist/vault/linking.d.ts +46 -0
  313. package/dist/vault/linking.d.ts.map +1 -0
  314. package/dist/vault/linking.js +275 -0
  315. package/dist/vault/linking.js.map +1 -0
  316. package/dist/vault/vault-types.d.ts +37 -0
  317. package/dist/vault/vault-types.d.ts.map +1 -1
  318. package/dist/vault/vault.d.ts +37 -0
  319. package/dist/vault/vault.d.ts.map +1 -1
  320. package/dist/vault/vault.js +152 -9
  321. package/dist/vault/vault.js.map +1 -1
  322. package/package.json +4 -1
  323. package/src/__tests__/admin-extra-ops.test.ts +1 -1
  324. package/src/__tests__/admin-ops.test.ts +2 -1
  325. package/src/__tests__/admin-setup-ops.test.ts +355 -0
  326. package/src/__tests__/async-infrastructure.test.ts +307 -0
  327. package/src/__tests__/cognee-client-gaps.test.ts +474 -0
  328. package/src/__tests__/cognee-hybrid-search.test.ts +492 -0
  329. package/src/__tests__/cognee-sync-manager-deep.test.ts +654 -0
  330. package/src/__tests__/cognee-sync-manager.test.ts +1 -0
  331. package/src/__tests__/core-ops.test.ts +9 -61
  332. package/src/__tests__/curator-extra-ops.test.ts +6 -2
  333. package/src/__tests__/curator-pipeline-e2e.test.ts +358 -0
  334. package/src/__tests__/domain-packs.test.ts +421 -0
  335. package/src/__tests__/flows.test.ts +604 -0
  336. package/src/__tests__/memory-extra-ops.test.ts +2 -2
  337. package/src/__tests__/planning-extra-ops.test.ts +2 -2
  338. package/src/__tests__/playbook-registry.test.ts +2 -2
  339. package/src/__tests__/playbook-seeder.test.ts +8 -8
  340. package/src/__tests__/playbook.test.ts +5 -5
  341. package/src/__tests__/second-brain-features.test.ts +583 -0
  342. package/src/__tests__/token-resolver.test.ts +79 -0
  343. package/src/agency/agency-manager.ts +217 -9
  344. package/src/agency/default-rules.ts +83 -0
  345. package/src/agency/types.ts +61 -0
  346. package/src/brain/brain.ts +110 -8
  347. package/src/brain/intelligence.ts +21 -2
  348. package/src/brain/knowledge-synthesizer.ts +218 -0
  349. package/src/brain/learning-radar.ts +340 -0
  350. package/src/brain/types.ts +16 -0
  351. package/src/capabilities/chain-mapping.ts +93 -0
  352. package/src/capabilities/index.ts +21 -0
  353. package/src/capabilities/registry.ts +290 -0
  354. package/src/capabilities/types.ts +143 -0
  355. package/src/context/context-engine.ts +114 -15
  356. package/src/context/types.ts +5 -0
  357. package/src/control/intent-router.ts +153 -2
  358. package/src/control/types.ts +10 -0
  359. package/src/curator/classifier.ts +88 -0
  360. package/src/curator/quality-gate.ts +129 -0
  361. package/src/domain-packs/index.ts +27 -0
  362. package/src/domain-packs/inject-rules.ts +74 -0
  363. package/src/domain-packs/knowledge-installer.ts +116 -0
  364. package/src/domain-packs/loader.ts +124 -0
  365. package/src/domain-packs/pack-runtime.ts +99 -0
  366. package/src/domain-packs/skills-installer.ts +56 -0
  367. package/src/domain-packs/token-resolver.ts +126 -0
  368. package/src/domain-packs/types.ts +229 -0
  369. package/src/engine/__tests__/register-engine.test.ts +104 -0
  370. package/src/engine/bin/soleri-engine.ts +218 -0
  371. package/src/engine/core-ops.ts +178 -0
  372. package/src/engine/index.ts +19 -0
  373. package/src/engine/register-engine.ts +385 -0
  374. package/src/engine/test-helpers.ts +83 -0
  375. package/src/events/event-bus.ts +58 -0
  376. package/src/flows/chain-runner.ts +369 -0
  377. package/src/flows/chain-types.ts +57 -0
  378. package/src/flows/context-router.ts +257 -0
  379. package/src/flows/dispatch-registry.ts +80 -0
  380. package/src/flows/epilogue.ts +65 -0
  381. package/src/flows/executor.ts +182 -0
  382. package/src/flows/gate-evaluator.ts +171 -0
  383. package/src/flows/index.ts +52 -0
  384. package/src/flows/loader.ts +63 -0
  385. package/src/flows/plan-builder.ts +250 -0
  386. package/src/flows/probes.ts +70 -0
  387. package/src/flows/types.ts +217 -0
  388. package/src/health/doctor-checks.ts +115 -0
  389. package/src/index.ts +68 -1
  390. package/src/intake/text-ingester.ts +234 -0
  391. package/src/intelligence/loader.ts +38 -0
  392. package/src/intelligence/types.ts +1 -0
  393. package/src/llm/llm-client.ts +38 -1
  394. package/src/llm/oauth-discovery.ts +169 -0
  395. package/src/packs/types.ts +19 -0
  396. package/src/planning/evidence-collector.ts +247 -0
  397. package/src/planning/planner.ts +11 -0
  398. package/src/playbooks/generic/onboarding.ts +79 -0
  399. package/src/playbooks/playbook-registry.ts +2 -0
  400. package/src/queue/job-queue.ts +281 -0
  401. package/src/queue/pipeline-runner.ts +149 -0
  402. package/src/runtime/admin-extra-ops.ts +14 -8
  403. package/src/runtime/admin-ops.ts +4 -4
  404. package/src/runtime/admin-setup-ops.ts +664 -0
  405. package/src/runtime/capture-ops.ts +40 -1
  406. package/src/runtime/chain-ops.ts +121 -0
  407. package/src/runtime/claude-md-helpers.ts +236 -0
  408. package/src/runtime/curator-extra-ops.ts +86 -3
  409. package/src/runtime/domain-ops.ts +71 -5
  410. package/src/runtime/facades/admin-facade.ts +4 -0
  411. package/src/runtime/facades/agency-facade.ts +68 -0
  412. package/src/runtime/facades/brain-facade.ts +142 -1
  413. package/src/runtime/facades/cognee-facade.ts +3 -1
  414. package/src/runtime/facades/control-facade.ts +45 -0
  415. package/src/runtime/facades/index.ts +12 -6
  416. package/src/runtime/facades/memory-facade.ts +20 -2
  417. package/src/runtime/facades/plan-facade.ts +2 -0
  418. package/src/runtime/facades/vault-facade.ts +30 -5
  419. package/src/runtime/intake-ops.ts +107 -5
  420. package/src/runtime/memory-extra-ops.ts +312 -4
  421. package/src/runtime/orchestrate-ops.ts +261 -65
  422. package/src/runtime/planning-extra-ops.ts +94 -0
  423. package/src/runtime/playbook-ops.ts +1 -1
  424. package/src/runtime/runtime.ts +164 -19
  425. package/src/runtime/session-briefing.ts +161 -0
  426. package/src/runtime/types.ts +29 -2
  427. package/src/runtime/vault-linking-ops.ts +452 -0
  428. package/src/vault/linking.ts +333 -0
  429. package/src/vault/vault-types.ts +46 -0
  430. package/src/vault/vault.ts +173 -11
@@ -0,0 +1,218 @@
1
+ /**
2
+ * Knowledge Synthesizer — turn vault knowledge into structured content.
3
+ *
4
+ * Searches vault for relevant entries, builds context, calls LLM to synthesize
5
+ * into one of 4 formats: brief, outline, talking-points, post-draft.
6
+ *
7
+ * Graceful degradation: if no LLM, returns raw entries without synthesis.
8
+ */
9
+
10
+ import type { Brain } from './brain.js';
11
+ import type { LLMClient } from '../llm/llm-client.js';
12
+ import type { RankedResult } from './types.js';
13
+
14
+ // ─── Types ───────────────────────────────────────────────────────────
15
+
16
+ export type SynthesisFormat = 'brief' | 'outline' | 'talking-points' | 'post-draft';
17
+ export type Audience = 'technical' | 'executive' | 'general';
18
+
19
+ export interface SynthesisOptions {
20
+ format: SynthesisFormat;
21
+ maxEntries?: number;
22
+ audience?: Audience;
23
+ }
24
+
25
+ export interface SynthesisResult {
26
+ query: string;
27
+ format: SynthesisFormat;
28
+ content: string;
29
+ sources: Array<{ id: string; title: string; score: number }>;
30
+ coverage: number;
31
+ gaps: string[];
32
+ entriesConsulted: number;
33
+ }
34
+
35
+ // ─── Prompts ─────────────────────────────────────────────────────────
36
+
37
+ const FORMAT_PROMPTS: Record<SynthesisFormat, string> = {
38
+ brief:
39
+ 'Produce a concise executive brief (5-10 bullet points). Start with a one-line summary. ' +
40
+ 'Group findings by theme. End with open questions or knowledge gaps.',
41
+ outline:
42
+ 'Produce a structured article/document outline with numbered sections. ' +
43
+ 'Each section should reference which vault entries support it. ' +
44
+ 'Mark sections where knowledge is thin as [GAP].',
45
+ 'talking-points':
46
+ 'Produce bullet-point talking points for a presentation or discussion. ' +
47
+ 'Each point should be self-contained and quotable. ' +
48
+ 'Include a "Questions to anticipate" section at the end.',
49
+ 'post-draft':
50
+ 'Draft a short-form post (200-300 words) suitable for LinkedIn or a blog. ' +
51
+ 'Conversational tone, one key insight, actionable takeaway. ' +
52
+ 'End with a question to prompt engagement.',
53
+ };
54
+
55
+ const AUDIENCE_CONTEXT: Record<Audience, string> = {
56
+ technical: 'The audience is software engineers and architects. Use precise technical language.',
57
+ executive:
58
+ 'The audience is non-technical leadership. Focus on impact, decisions, and outcomes. Avoid jargon.',
59
+ general: 'The audience is mixed. Be clear and accessible while maintaining accuracy.',
60
+ };
61
+
62
+ // ─── Class ───────────────────────────────────────────────────────────
63
+
64
+ export class KnowledgeSynthesizer {
65
+ private brain: Brain;
66
+ private llm: LLMClient | null;
67
+
68
+ constructor(brain: Brain, llm: LLMClient | null) {
69
+ this.brain = brain;
70
+ this.llm = llm;
71
+ }
72
+
73
+ async synthesize(query: string, opts: SynthesisOptions): Promise<SynthesisResult> {
74
+ const maxEntries = opts.maxEntries ?? 10;
75
+ const audience = opts.audience ?? 'general';
76
+
77
+ // 1. Search vault for relevant entries
78
+ const results = await this.brain.intelligentSearch(query, { limit: maxEntries });
79
+
80
+ const sources = results.map((r) => ({
81
+ id: r.entry.id,
82
+ title: r.entry.title,
83
+ score: r.score,
84
+ }));
85
+
86
+ // Coverage: how many entries scored above 0.3 vs how many we asked for
87
+ const strongMatches = results.filter((r) => r.score > 0.3).length;
88
+ const coverage =
89
+ maxEntries > 0 ? Math.min(Math.round((strongMatches / maxEntries) * 100), 100) : 0;
90
+
91
+ // 2. If no LLM, return raw entries without synthesis
92
+ if (!this.llm || results.length === 0) {
93
+ return {
94
+ query,
95
+ format: opts.format,
96
+ content:
97
+ results.length === 0
98
+ ? `No vault entries found for "${query}".`
99
+ : formatRawEntries(results),
100
+ sources,
101
+ coverage,
102
+ gaps: results.length === 0 ? [`No knowledge found for: ${query}`] : [],
103
+ entriesConsulted: results.length,
104
+ };
105
+ }
106
+
107
+ // 3. Build context from entries
108
+ const context = buildContext(results);
109
+
110
+ // 4. LLM synthesis call
111
+ const systemPrompt = buildSystemPrompt(opts.format, audience);
112
+ const userPrompt = buildUserPrompt(query, context, opts.format);
113
+
114
+ let llmOutput: string;
115
+ try {
116
+ const result = await this.llm.complete({
117
+ provider: 'openai',
118
+ model: 'gpt-4o-mini',
119
+ systemPrompt,
120
+ userPrompt,
121
+ temperature: 0.3,
122
+ maxTokens: 1500,
123
+ caller: 'knowledge-synthesizer',
124
+ task: 'synthesize',
125
+ });
126
+ llmOutput = result.text;
127
+ } catch {
128
+ // LLM failed — return raw entries
129
+ return {
130
+ query,
131
+ format: opts.format,
132
+ content: formatRawEntries(results),
133
+ sources,
134
+ coverage,
135
+ gaps: [],
136
+ entriesConsulted: results.length,
137
+ };
138
+ }
139
+
140
+ // 5. Extract gaps from LLM output
141
+ const gaps = extractGaps(llmOutput);
142
+
143
+ return {
144
+ query,
145
+ format: opts.format,
146
+ content: llmOutput,
147
+ sources,
148
+ coverage,
149
+ gaps,
150
+ entriesConsulted: results.length,
151
+ };
152
+ }
153
+ }
154
+
155
+ // ─── Helpers ─────────────────────────────────────────────────────────
156
+
157
+ function buildContext(results: RankedResult[]): string {
158
+ return results
159
+ .map((r, i) => {
160
+ const entry = r.entry;
161
+ let text = `[${i + 1}] ${entry.title} (${entry.type}, ${entry.severity})\n`;
162
+ text += ` ${entry.description}`;
163
+ if (entry.why) text += `\n Why: ${entry.why}`;
164
+ if (entry.context) text += `\n Context: ${entry.context}`;
165
+ if (entry.tags.length > 0) text += `\n Tags: ${entry.tags.join(', ')}`;
166
+ return text;
167
+ })
168
+ .join('\n\n');
169
+ }
170
+
171
+ function buildSystemPrompt(format: SynthesisFormat, audience: Audience): string {
172
+ return (
173
+ 'You are a knowledge synthesizer. You take structured vault entries (patterns, anti-patterns, rules) ' +
174
+ 'and produce clear, actionable content.\n\n' +
175
+ FORMAT_PROMPTS[format] +
176
+ '\n\n' +
177
+ AUDIENCE_CONTEXT[audience] +
178
+ '\n\n' +
179
+ 'Rules:\n' +
180
+ '- Only use information from the provided vault entries. Do not invent facts.\n' +
181
+ '- Reference entries by their [number] when making claims.\n' +
182
+ "- If the entries don't cover an important subtopic, note it as a GAP.\n" +
183
+ '- Be concise. Every sentence should earn its place.'
184
+ );
185
+ }
186
+
187
+ function buildUserPrompt(query: string, context: string, format: SynthesisFormat): string {
188
+ return (
189
+ `Topic: ${query}\n\n` +
190
+ `Format: ${format}\n\n` +
191
+ `Vault entries:\n${context}\n\n` +
192
+ 'Synthesize the above entries into the requested format. ' +
193
+ 'Include a "Knowledge Gaps" section at the end listing topics not covered by the entries.'
194
+ );
195
+ }
196
+
197
+ function formatRawEntries(results: RankedResult[]): string {
198
+ if (results.length === 0) return 'No entries found.';
199
+ return results
200
+ .map(
201
+ (r) =>
202
+ `- **${r.entry.title}** (${r.entry.type}, score: ${r.score.toFixed(2)}): ${r.entry.description}`,
203
+ )
204
+ .join('\n');
205
+ }
206
+
207
+ function extractGaps(llmOutput: string): string[] {
208
+ // Look for a "Knowledge Gaps" or "Gaps" or "[GAP]" section
209
+ const gapSection = llmOutput.match(
210
+ /(?:knowledge\s+gaps?|gaps?|open\s+questions?)[\s:]*\n([\s\S]*?)(?:\n##|\n\*\*|$)/i,
211
+ );
212
+ if (!gapSection) return [];
213
+
214
+ return gapSection[1]
215
+ .split('\n')
216
+ .map((line) => line.replace(/^[-*•\d.)\s]+/, '').trim())
217
+ .filter((line) => line.length > 5);
218
+ }
@@ -0,0 +1,340 @@
1
+ /**
2
+ * Learning Radar — automatic pattern detection from agent sessions.
3
+ *
4
+ * Analyzes signals (corrections, search misses, explicit captures, workarounds)
5
+ * and queues knowledge candidates by confidence level:
6
+ * >= 0.8 → auto-capture silently
7
+ * 0.4-0.8 → queue for end-of-session review
8
+ * < 0.4 → log to metrics only
9
+ *
10
+ * Zero-friction: never interrupts the user. All analysis is pull-based.
11
+ */
12
+
13
+ import type { Vault } from '../vault/vault.js';
14
+ import type { PersistenceProvider } from '../persistence/types.js';
15
+ import type { Brain } from './brain.js';
16
+
17
+ // ─── Types ───────────────────────────────────────────────────────────
18
+
19
+ export type SignalType =
20
+ | 'correction'
21
+ | 'search_miss'
22
+ | 'explicit_capture'
23
+ | 'pattern_success'
24
+ | 'workaround'
25
+ | 'repeated_question';
26
+
27
+ export type CandidateStatus = 'pending' | 'captured' | 'dismissed' | 'logged';
28
+
29
+ export interface RadarSignal {
30
+ type: SignalType;
31
+ title: string;
32
+ description: string;
33
+ /** Override suggested entry type. Default inferred from signal type. */
34
+ suggestedType?: 'pattern' | 'anti-pattern';
35
+ /** Override confidence. Default computed from signal type. */
36
+ confidence?: number;
37
+ /** Original query that triggered this signal (for search_miss, repeated_question). */
38
+ sourceQuery?: string;
39
+ /** Additional context (e.g., what the user said, what was corrected). */
40
+ context?: string;
41
+ }
42
+
43
+ export interface RadarCandidate {
44
+ id: number;
45
+ signalType: SignalType;
46
+ title: string;
47
+ description: string;
48
+ suggestedType: string;
49
+ confidence: number;
50
+ status: CandidateStatus;
51
+ sourceQuery: string | null;
52
+ context: string | null;
53
+ createdAt: string;
54
+ }
55
+
56
+ export interface RadarStats {
57
+ totalAnalyzed: number;
58
+ autoCaptured: number;
59
+ queued: number;
60
+ dismissed: number;
61
+ logged: number;
62
+ knowledgeGaps: number;
63
+ }
64
+
65
+ export interface FlushResult {
66
+ captured: number;
67
+ capturedIds: number[];
68
+ failed: number;
69
+ }
70
+
71
+ // ─── Constants ───────────────────────────────────────────────────────
72
+
73
+ const HIGH_CONFIDENCE = 0.8;
74
+ const MEDIUM_CONFIDENCE = 0.4;
75
+
76
+ const DEFAULT_CONFIDENCE: Record<SignalType, number> = {
77
+ explicit_capture: 0.95,
78
+ correction: 0.75,
79
+ workaround: 0.65,
80
+ search_miss: 0.5,
81
+ pattern_success: 0.4,
82
+ repeated_question: 0.6,
83
+ };
84
+
85
+ const DEFAULT_TYPE: Record<SignalType, 'pattern' | 'anti-pattern'> = {
86
+ explicit_capture: 'pattern',
87
+ correction: 'anti-pattern',
88
+ workaround: 'pattern',
89
+ search_miss: 'pattern',
90
+ pattern_success: 'pattern',
91
+ repeated_question: 'pattern',
92
+ };
93
+
94
+ // ─── Class ───────────────────────────────────────────────────────────
95
+
96
+ export class LearningRadar {
97
+ private provider: PersistenceProvider;
98
+ private vault: Vault;
99
+ private brain: Brain;
100
+
101
+ constructor(vault: Vault, brain: Brain) {
102
+ this.vault = vault;
103
+ this.brain = brain;
104
+ this.provider = vault.getProvider();
105
+ this.initializeTable();
106
+ }
107
+
108
+ private initializeTable(): void {
109
+ this.provider.execSql(`
110
+ CREATE TABLE IF NOT EXISTS radar_candidates (
111
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
112
+ signal_type TEXT NOT NULL,
113
+ title TEXT NOT NULL,
114
+ description TEXT NOT NULL,
115
+ suggested_type TEXT NOT NULL DEFAULT 'pattern',
116
+ confidence REAL NOT NULL,
117
+ status TEXT NOT NULL DEFAULT 'pending',
118
+ source_query TEXT,
119
+ context TEXT,
120
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
121
+ );
122
+
123
+ CREATE INDEX IF NOT EXISTS idx_radar_status ON radar_candidates(status);
124
+ `);
125
+ }
126
+
127
+ /**
128
+ * Analyze a signal and classify it by confidence.
129
+ * High confidence → auto-capture. Medium → queue. Low → log only.
130
+ */
131
+ analyze(signal: RadarSignal): RadarCandidate | null {
132
+ const confidence = signal.confidence ?? DEFAULT_CONFIDENCE[signal.type] ?? 0.5;
133
+ const suggestedType = signal.suggestedType ?? DEFAULT_TYPE[signal.type] ?? 'pattern';
134
+
135
+ let status: CandidateStatus;
136
+ if (confidence >= HIGH_CONFIDENCE) {
137
+ status = 'captured';
138
+ } else if (confidence >= MEDIUM_CONFIDENCE) {
139
+ status = 'pending';
140
+ } else {
141
+ status = 'logged';
142
+ }
143
+
144
+ const result = this.provider.run(
145
+ `INSERT INTO radar_candidates (signal_type, title, description, suggested_type, confidence, status, source_query, context)
146
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
147
+ [
148
+ signal.type,
149
+ signal.title,
150
+ signal.description,
151
+ suggestedType,
152
+ confidence,
153
+ status,
154
+ signal.sourceQuery ?? null,
155
+ signal.context ?? null,
156
+ ],
157
+ );
158
+
159
+ const id = Number(result.lastInsertRowid);
160
+
161
+ // Auto-capture high confidence signals immediately
162
+ if (status === 'captured') {
163
+ this.captureCandidate(id, signal.title, signal.description, suggestedType, signal.type);
164
+ }
165
+
166
+ return this.getCandidate(id);
167
+ }
168
+
169
+ /**
170
+ * Get all pending candidates (medium confidence, queued for review).
171
+ */
172
+ getCandidates(limit: number = 20): RadarCandidate[] {
173
+ const rows = this.provider.all<CandidateRow>(
174
+ 'SELECT * FROM radar_candidates WHERE status = ? ORDER BY confidence DESC LIMIT ?',
175
+ ['pending', limit],
176
+ );
177
+ return rows.map(rowToCandidate);
178
+ }
179
+
180
+ /**
181
+ * Get a single candidate by ID.
182
+ */
183
+ getCandidate(id: number): RadarCandidate | null {
184
+ const row = this.provider.get<CandidateRow>('SELECT * FROM radar_candidates WHERE id = ?', [
185
+ id,
186
+ ]);
187
+ return row ? rowToCandidate(row) : null;
188
+ }
189
+
190
+ /**
191
+ * Approve a pending candidate — capture it to vault.
192
+ */
193
+ approve(candidateId: number): { captured: boolean; entryId?: string } {
194
+ const candidate = this.getCandidate(candidateId);
195
+ if (!candidate || candidate.status !== 'pending') {
196
+ return { captured: false };
197
+ }
198
+
199
+ const entryId = this.captureCandidate(
200
+ candidateId,
201
+ candidate.title,
202
+ candidate.description,
203
+ candidate.suggestedType,
204
+ candidate.signalType,
205
+ );
206
+
207
+ return { captured: true, entryId };
208
+ }
209
+
210
+ /**
211
+ * Dismiss a pending candidate — mark it as not worth capturing.
212
+ */
213
+ dismiss(candidateId: number): { dismissed: boolean } {
214
+ const result = this.provider.run(
215
+ "UPDATE radar_candidates SET status = 'dismissed' WHERE id = ? AND status = 'pending'",
216
+ [candidateId],
217
+ );
218
+ return { dismissed: result.changes > 0 };
219
+ }
220
+
221
+ /**
222
+ * Flush: auto-capture all pending candidates above a confidence threshold.
223
+ */
224
+ flush(minConfidence: number = HIGH_CONFIDENCE): FlushResult {
225
+ const rows = this.provider.all<CandidateRow>(
226
+ 'SELECT * FROM radar_candidates WHERE status = ? AND confidence >= ? ORDER BY confidence DESC',
227
+ ['pending', minConfidence],
228
+ );
229
+
230
+ let captured = 0;
231
+ let failed = 0;
232
+ const capturedIds: number[] = [];
233
+
234
+ for (const row of rows) {
235
+ try {
236
+ this.captureCandidate(
237
+ row.id,
238
+ row.title,
239
+ row.description,
240
+ row.suggested_type,
241
+ row.signal_type,
242
+ );
243
+ captured++;
244
+ capturedIds.push(row.id);
245
+ } catch {
246
+ failed++;
247
+ }
248
+ }
249
+
250
+ return { captured, capturedIds, failed };
251
+ }
252
+
253
+ /**
254
+ * Get radar statistics.
255
+ */
256
+ getStats(): RadarStats {
257
+ const total = this.provider.get<{ count: number }>(
258
+ 'SELECT COUNT(*) as count FROM radar_candidates',
259
+ )!.count;
260
+
261
+ const statusRows = this.provider.all<{ status: string; count: number }>(
262
+ 'SELECT status, COUNT(*) as count FROM radar_candidates GROUP BY status',
263
+ );
264
+ const byStatus: Record<string, number> = {};
265
+ for (const row of statusRows) byStatus[row.status] = row.count;
266
+
267
+ const gaps = this.provider.get<{ count: number }>(
268
+ "SELECT COUNT(*) as count FROM radar_candidates WHERE signal_type = 'search_miss' OR signal_type = 'repeated_question'",
269
+ )!.count;
270
+
271
+ return {
272
+ totalAnalyzed: total,
273
+ autoCaptured: byStatus['captured'] ?? 0,
274
+ queued: byStatus['pending'] ?? 0,
275
+ dismissed: byStatus['dismissed'] ?? 0,
276
+ logged: byStatus['logged'] ?? 0,
277
+ knowledgeGaps: gaps,
278
+ };
279
+ }
280
+
281
+ // ─── Internal ──────────────────────────────────────────────────────
282
+
283
+ private captureCandidate(
284
+ candidateId: number,
285
+ title: string,
286
+ description: string,
287
+ suggestedType: string,
288
+ signalType: string,
289
+ ): string {
290
+ const id = `radar-${signalType}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
291
+ const entryType = suggestedType === 'anti-pattern' ? 'anti-pattern' : 'pattern';
292
+
293
+ this.brain.enrichAndCapture({
294
+ id,
295
+ type: entryType,
296
+ domain: 'general',
297
+ title,
298
+ description,
299
+ severity: 'suggestion' as const,
300
+ tags: ['radar-detected', signalType],
301
+ origin: 'agent' as const,
302
+ });
303
+
304
+ this.provider.run("UPDATE radar_candidates SET status = 'captured' WHERE id = ?", [
305
+ candidateId,
306
+ ]);
307
+
308
+ return id;
309
+ }
310
+ }
311
+
312
+ // ─── Row Types ───────────────────────────────────────────────────────
313
+
314
+ interface CandidateRow {
315
+ id: number;
316
+ signal_type: string;
317
+ title: string;
318
+ description: string;
319
+ suggested_type: string;
320
+ confidence: number;
321
+ status: string;
322
+ source_query: string | null;
323
+ context: string | null;
324
+ created_at: string;
325
+ }
326
+
327
+ function rowToCandidate(row: CandidateRow): RadarCandidate {
328
+ return {
329
+ id: row.id,
330
+ signalType: row.signal_type as SignalType,
331
+ title: row.title,
332
+ description: row.description,
333
+ suggestedType: row.suggested_type,
334
+ confidence: row.confidence,
335
+ status: row.status as CandidateStatus,
336
+ sourceQuery: row.source_query,
337
+ context: row.context,
338
+ createdAt: row.created_at,
339
+ };
340
+ }
@@ -33,6 +33,22 @@ export interface SearchOptions {
33
33
  severity?: string;
34
34
  limit?: number;
35
35
  tags?: string[];
36
+ /** 'full' returns RankedResult[] with complete entries (default). 'scan' returns ScanResult[] — lightweight titles + scores for two-pass retrieval. */
37
+ mode?: 'full' | 'scan';
38
+ }
39
+
40
+ /** Lightweight search result for scan mode — titles + scores without full entry body. */
41
+ export interface ScanResult {
42
+ id: string;
43
+ title: string;
44
+ score: number;
45
+ type: string;
46
+ domain: string;
47
+ severity: string;
48
+ tags: string[];
49
+ snippet: string;
50
+ /** Estimated tokens if this entry were loaded in full. */
51
+ tokenEstimate: number;
36
52
  }
37
53
 
38
54
  export interface CaptureResult {
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Chain-to-capability mapping — v1 to v2 bridge.
3
+ *
4
+ * Maps Soleri's existing 26 v1 chain names (from data/flows/*.flow.yaml)
5
+ * to capability IDs in domain.action format.
6
+ *
7
+ * Used during migration: flows with chains: [] are auto-translated to
8
+ * capability references. Remove this file when all flows use needs: []
9
+ * exclusively.
10
+ *
11
+ * @see docs/architecture/capability-packs.md — "Chain-to-capability mapping"
12
+ */
13
+
14
+ /**
15
+ * Exhaustive map of every chain name used across Soleri's 8 flow YAML files.
16
+ *
17
+ * Sources:
18
+ * build.flow.yaml — vault-search, memory-search, component-search,
19
+ * recommend-design-system, architecture-search,
20
+ * brain-recommend, component-workflow,
21
+ * validate-component, validate-tokens
22
+ * deliver.flow.yaml — validate-component, validate-tokens,
23
+ * design-rules-check, test-coverage-check,
24
+ * performance-audit, delivery-checklist
25
+ * design.flow.yaml — vault-search, memory-search, cognee-design-search,
26
+ * recommend-design-system, recommend-style,
27
+ * recommend-palette, recommend-typography,
28
+ * get-stack-guidelines, brain-recommend
29
+ * enhance.flow.yaml — vault-search, memory-search, architecture-search,
30
+ * brain-recommend, validate-component, validate-tokens
31
+ * explore.flow.yaml — vault-search, memory-search, brain-strengths,
32
+ * brain-recommend, playbook-search
33
+ * fix.flow.yaml — vault-search-antipatterns, memory-search,
34
+ * error-pattern-search, brain-recommend,
35
+ * validate-component, validate-tokens
36
+ * plan.flow.yaml — vault-search, memory-search, brain-recommend,
37
+ * architecture-search, plan-create
38
+ * review.flow.yaml — validate-component, validate-tokens,
39
+ * design-rules-check, vault-search, contrast-check,
40
+ * accessibility-audit, review-report
41
+ */
42
+ const CHAIN_TO_CAPABILITY: Record<string, string> = {
43
+ // Vault & Knowledge
44
+ 'vault-search': 'vault.search',
45
+ 'vault-search-antipatterns': 'vault.search',
46
+ 'memory-search': 'memory.search',
47
+ 'playbook-search': 'vault.playbook',
48
+
49
+ // Brain
50
+ 'brain-recommend': 'brain.recommend',
51
+ 'brain-strengths': 'brain.strengths',
52
+
53
+ // Components
54
+ 'component-search': 'component.search',
55
+ 'component-workflow': 'component.workflow',
56
+ 'validate-component': 'component.validate',
57
+
58
+ // Design
59
+ 'contrast-check': 'color.validate',
60
+ 'validate-tokens': 'token.check',
61
+ 'design-rules-check': 'design.rules',
62
+ 'recommend-design-system': 'design.recommend',
63
+ 'recommend-palette': 'design.palette',
64
+ 'recommend-style': 'design.style',
65
+ 'recommend-typography': 'design.typography',
66
+ 'get-stack-guidelines': 'stack.guidelines',
67
+
68
+ // Architecture
69
+ 'architecture-search': 'architecture.search',
70
+ 'cognee-design-search': 'cognee.search',
71
+
72
+ // Planning
73
+ 'plan-create': 'plan.create',
74
+
75
+ // Review & Quality
76
+ 'review-report': 'review.report',
77
+ 'accessibility-audit': 'a11y.audit',
78
+ 'performance-audit': 'perf.audit',
79
+ 'test-coverage-check': 'test.coverage',
80
+ 'error-pattern-search': 'debug.patterns',
81
+ 'delivery-checklist': 'deliver.checklist',
82
+ };
83
+
84
+ /**
85
+ * Translate a v1 chain name to a v2 capability ID.
86
+ *
87
+ * @param chain - The chain name from a flow YAML `chains:` field
88
+ * @returns The corresponding capability ID in domain.action format, or
89
+ * undefined if no mapping exists
90
+ */
91
+ export function chainToCapability(chain: string): string | undefined {
92
+ return CHAIN_TO_CAPABILITY[chain];
93
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Capability system — barrel export.
3
+ *
4
+ * @see docs/architecture/capability-packs.md
5
+ */
6
+
7
+ export { CapabilityRegistry } from './registry.js';
8
+ export type { FlowForValidation } from './registry.js';
9
+ export { chainToCapability } from './chain-mapping.js';
10
+ export type {
11
+ CapabilityDefinition,
12
+ CapabilityHandler,
13
+ CapabilityContext,
14
+ CapabilityResult,
15
+ KnowledgeContext,
16
+ BrainRecommendation,
17
+ RegisteredCapability,
18
+ ResolvedCapability,
19
+ PackSuggestion,
20
+ FlowValidation,
21
+ } from './types.js';