@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,250 @@
1
+ /**
2
+ * Plan builder — converts intent + flow + probes into an OrchestrationPlan.
3
+ */
4
+
5
+ import { randomUUID } from 'node:crypto';
6
+ import type { AgentRuntime } from '../runtime/types.js';
7
+ import type {
8
+ Flow,
9
+ PlanStep,
10
+ SkippedStep,
11
+ OrchestrationPlan,
12
+ ProbeResults,
13
+ ProbeName,
14
+ } from './types.js';
15
+ import { loadFlowById } from './loader.js';
16
+ import { runProbes } from './probes.js';
17
+ import { detectContext, applyContextOverrides } from './context-router.js';
18
+ import { chainToCapability } from '../capabilities/index.js';
19
+ import type { CapabilityRegistry } from '../capabilities/index.js';
20
+
21
+ // ---------------------------------------------------------------------------
22
+ // Intent → Flow mapping
23
+ // ---------------------------------------------------------------------------
24
+
25
+ export const INTENT_TO_FLOW: Record<string, string> = {
26
+ BUILD: 'BUILD-flow',
27
+ CREATE: 'BUILD-flow',
28
+ FIX: 'FIX-flow',
29
+ REVIEW: 'REVIEW-flow',
30
+ PLAN: 'PLAN-flow',
31
+ DESIGN: 'DESIGN-flow',
32
+ ENHANCE: 'ENHANCE-flow',
33
+ IMPROVE: 'ENHANCE-flow',
34
+ EXPLORE: 'EXPLORE-flow',
35
+ DELIVER: 'DELIVER-flow',
36
+ };
37
+
38
+ // ---------------------------------------------------------------------------
39
+ // Helpers
40
+ // ---------------------------------------------------------------------------
41
+
42
+ /**
43
+ * Convert a chain name (e.g. "vault-search") to a tool name (e.g. "myagent_vault_search").
44
+ */
45
+ export function chainToToolName(chain: string, agentId: string): string {
46
+ return `${agentId}_${chain.replace(/-/g, '_')}`;
47
+ }
48
+
49
+ /**
50
+ * Infer which probe capability a chain requires, or undefined if none.
51
+ */
52
+ export function chainToRequires(chain: string): ProbeName | undefined {
53
+ const lower = chain.toLowerCase();
54
+ if (lower.startsWith('vault') || lower.startsWith('memory')) return 'vault';
55
+ if (lower.startsWith('brain')) return 'brain';
56
+ if (lower.startsWith('component') || lower.startsWith('token') || lower.startsWith('design'))
57
+ return 'designSystem';
58
+ if (lower.startsWith('session')) return 'sessionStore';
59
+ // recommend-* and get-stack-* have no hard requirements
60
+ if (lower.startsWith('recommend') || lower.startsWith('get-stack')) return undefined;
61
+ return undefined;
62
+ }
63
+
64
+ /**
65
+ * Convert flow steps into plan steps.
66
+ *
67
+ * Resolution order for capability IDs:
68
+ * 1. If the step has `needs:` (v2), use those capability IDs directly
69
+ * 2. If the step only has `chains:` (v1), map via chainToCapability()
70
+ * 3. chainToToolName() is still used for tool dispatch (fallback path)
71
+ *
72
+ * When an optional `registry` is provided, each resolved capability is
73
+ * validated. Unavailable capabilities are recorded in the step's
74
+ * `unavailableCapabilities` list (informational — pruning is separate).
75
+ */
76
+ export function flowStepsToPlanSteps(
77
+ flow: Flow,
78
+ agentId: string,
79
+ registry?: CapabilityRegistry,
80
+ ): PlanStep[] {
81
+ return flow.steps.map((step) => {
82
+ // Tool names for dispatch fallback (always computed from chains)
83
+ const tools = (step.chains ?? []).map((c) => chainToToolName(c, agentId));
84
+
85
+ // Resolve capability IDs: prefer needs (v2), fall back to chains (v1)
86
+ const capabilityIds: string[] = [];
87
+ if (step.needs && step.needs.length > 0) {
88
+ capabilityIds.push(...step.needs);
89
+ } else if (step.chains) {
90
+ for (const chain of step.chains) {
91
+ const capId = chainToCapability(chain);
92
+ if (capId && !capabilityIds.includes(capId)) {
93
+ capabilityIds.push(capId);
94
+ }
95
+ }
96
+ }
97
+
98
+ // Probe-level requires (existing behavior, derived from chains)
99
+ const requires: ProbeName[] = [];
100
+ for (const chain of step.chains ?? []) {
101
+ const req = chainToRequires(chain);
102
+ if (req && !requires.includes(req)) requires.push(req);
103
+ }
104
+
105
+ // Validate capabilities against registry if provided
106
+ const unavailableCapabilities: string[] = [];
107
+ if (registry) {
108
+ for (const capId of capabilityIds) {
109
+ const resolved = registry.resolve(capId);
110
+ if (!resolved.available) {
111
+ unavailableCapabilities.push(capId);
112
+ }
113
+ }
114
+ }
115
+
116
+ const planStep: PlanStep = {
117
+ id: step.id,
118
+ name: step.name ?? step.id,
119
+ tools,
120
+ parallel: step.parallel ?? false,
121
+ requires,
122
+ status: 'pending',
123
+ };
124
+
125
+ // Attach capability metadata (non-breaking additions)
126
+ if (capabilityIds.length > 0) {
127
+ (planStep as PlanStep & { capabilities?: string[] }).capabilities = capabilityIds;
128
+ }
129
+ if (unavailableCapabilities.length > 0) {
130
+ (planStep as PlanStep & { unavailableCapabilities?: string[] }).unavailableCapabilities =
131
+ unavailableCapabilities;
132
+ }
133
+
134
+ if (step.gate) {
135
+ const gate = step.gate;
136
+ planStep.gate = {
137
+ type: gate.type,
138
+ };
139
+ if ('condition' in gate && gate.condition) {
140
+ planStep.gate.condition = gate.condition;
141
+ }
142
+ if ('min' in gate && gate.min !== undefined) {
143
+ planStep.gate.min = gate.min;
144
+ }
145
+ if (gate['on-false']) {
146
+ planStep.gate.onFail = {
147
+ action: gate['on-false'].action,
148
+ goto: gate['on-false'].goto,
149
+ message: gate['on-false'].message,
150
+ };
151
+ }
152
+ }
153
+
154
+ return planStep;
155
+ });
156
+ }
157
+
158
+ /**
159
+ * Remove steps whose required capabilities are not available.
160
+ */
161
+ export function pruneSteps(
162
+ steps: PlanStep[],
163
+ probes: ProbeResults,
164
+ ): { kept: PlanStep[]; skipped: SkippedStep[] } {
165
+ const kept: PlanStep[] = [];
166
+ const skipped: SkippedStep[] = [];
167
+
168
+ for (const step of steps) {
169
+ const missingProbes = step.requires.filter((r) => !probes[r]);
170
+ if (missingProbes.length > 0) {
171
+ skipped.push({
172
+ id: step.id,
173
+ name: step.name,
174
+ reason: `Missing capabilities: ${missingProbes.join(', ')}`,
175
+ });
176
+ } else {
177
+ kept.push(step);
178
+ }
179
+ }
180
+
181
+ return { kept, skipped };
182
+ }
183
+
184
+ /**
185
+ * Build a full orchestration plan from intent, agent config, and runtime.
186
+ */
187
+ export async function buildPlan(
188
+ intent: string,
189
+ agentId: string,
190
+ projectPath: string,
191
+ runtime: AgentRuntime,
192
+ prompt?: string,
193
+ ): Promise<OrchestrationPlan> {
194
+ const normalizedIntent = intent.toUpperCase();
195
+ const flowId = INTENT_TO_FLOW[normalizedIntent] ?? 'BUILD-flow';
196
+ const flow = loadFlowById(flowId);
197
+
198
+ const probes = await runProbes(runtime, projectPath);
199
+
200
+ let steps: PlanStep[] = [];
201
+ let skipped: SkippedStep[] = [];
202
+ const warnings: string[] = [];
203
+
204
+ if (flow) {
205
+ let allSteps = flowStepsToPlanSteps(flow, agentId);
206
+
207
+ // Context-sensitive chain routing: detect what's being built/fixed/reviewed
208
+ // and apply chain overrides (inject, skip, substitute) before pruning.
209
+ const entities = { components: [] as string[], actions: [] as string[] };
210
+ const contexts = prompt ? detectContext(prompt, entities) : [];
211
+ if (contexts.length > 0) {
212
+ allSteps = applyContextOverrides(allSteps, contexts, flowId, agentId);
213
+ }
214
+
215
+ const pruneResult = pruneSteps(allSteps, probes);
216
+ steps = pruneResult.kept;
217
+ skipped = pruneResult.skipped;
218
+
219
+ if (pruneResult.skipped.length > 0) {
220
+ warnings.push(`${pruneResult.skipped.length} step(s) skipped due to missing capabilities.`);
221
+ }
222
+ } else {
223
+ warnings.push(`Flow "${flowId}" not found — plan will have no steps.`);
224
+ }
225
+
226
+ if (!probes.vault) warnings.push('Vault unavailable — knowledge capture will be skipped.');
227
+ if (!probes.brain) warnings.push('Brain has no vocabulary — recommendations may be limited.');
228
+
229
+ const epilogue: string[] = [];
230
+ if (probes.vault) epilogue.push('capture_knowledge');
231
+ if (probes.sessionStore) epilogue.push('session_capture');
232
+
233
+ return {
234
+ planId: randomUUID(),
235
+ intent: normalizedIntent,
236
+ flowId,
237
+ steps,
238
+ skipped,
239
+ epilogue,
240
+ warnings,
241
+ summary: prompt ?? `${normalizedIntent} plan with ${steps.length} step(s)`,
242
+ estimatedTools: steps.reduce((acc, s) => acc + s.tools.length, 0),
243
+ context: {
244
+ intent: normalizedIntent,
245
+ probes,
246
+ entities: { components: [], actions: [] },
247
+ projectPath,
248
+ },
249
+ };
250
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Capability probes — detect what subsystems are available at runtime.
3
+ * All probes are resilient: they catch errors and return false on failure.
4
+ */
5
+
6
+ import { existsSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import type { AgentRuntime } from '../runtime/types.js';
9
+ import type { ProbeResults } from './types.js';
10
+
11
+ /**
12
+ * Run all 6 capability probes in parallel and return results.
13
+ */
14
+ export async function runProbes(runtime: AgentRuntime, projectPath: string): Promise<ProbeResults> {
15
+ const [vault, brain, designSystem, sessionStore, projectRules, active] = await Promise.all([
16
+ probeVault(runtime),
17
+ probeBrain(runtime),
18
+ probeDesignSystem(runtime),
19
+ probeSessionStore(),
20
+ probeProjectRules(projectPath),
21
+ probeActive(),
22
+ ]);
23
+
24
+ return { vault, brain, designSystem, sessionStore, projectRules, active };
25
+ }
26
+
27
+ async function probeVault(runtime: AgentRuntime): Promise<boolean> {
28
+ try {
29
+ const stats = runtime.vault.stats();
30
+ return stats.totalEntries >= 0;
31
+ } catch {
32
+ return false;
33
+ }
34
+ }
35
+
36
+ async function probeBrain(runtime: AgentRuntime): Promise<boolean> {
37
+ try {
38
+ return runtime.brain.getVocabularySize() > 0;
39
+ } catch {
40
+ return false;
41
+ }
42
+ }
43
+
44
+ async function probeDesignSystem(runtime: AgentRuntime): Promise<boolean> {
45
+ try {
46
+ return runtime.projectRegistry.list().length > 0;
47
+ } catch {
48
+ return false;
49
+ }
50
+ }
51
+
52
+ async function probeSessionStore(): Promise<boolean> {
53
+ // Session store is always available in Soleri runtime
54
+ return true;
55
+ }
56
+
57
+ async function probeProjectRules(projectPath: string): Promise<boolean> {
58
+ try {
59
+ return (
60
+ existsSync(join(projectPath, 'docs', 'vault')) || existsSync(join(projectPath, '.soleri'))
61
+ );
62
+ } catch {
63
+ return false;
64
+ }
65
+ }
66
+
67
+ async function probeActive(): Promise<boolean> {
68
+ // Always true when the engine is running
69
+ return true;
70
+ }
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Flow engine types — YAML-driven workflow orchestration.
3
+ *
4
+ * Flow → Steps → Chains (ops) → Gates → Execution
5
+ */
6
+
7
+ import { z } from 'zod';
8
+
9
+ // ---------------------------------------------------------------------------
10
+ // Gate types
11
+ // ---------------------------------------------------------------------------
12
+
13
+ export const gateActionSchema = z.object({
14
+ action: z.enum(['STOP', 'BRANCH', 'CONTINUE']),
15
+ goto: z.string().optional(),
16
+ message: z.string().optional(),
17
+ });
18
+
19
+ export const gateSchema = z.discriminatedUnion('type', [
20
+ z.object({
21
+ type: z.literal('GATE'),
22
+ condition: z.string(),
23
+ 'on-false': gateActionSchema,
24
+ }),
25
+ z.object({
26
+ type: z.literal('SCORE'),
27
+ min: z.number(),
28
+ 'grade-thresholds': z.record(z.number()).optional(),
29
+ 'on-false': gateActionSchema,
30
+ }),
31
+ z.object({
32
+ type: z.literal('CHECKPOINT'),
33
+ condition: z.string().optional(),
34
+ save: z.array(z.string()).optional(),
35
+ 'on-false': gateActionSchema,
36
+ }),
37
+ z.object({
38
+ type: z.literal('BRANCH'),
39
+ 'on-false': gateActionSchema.optional(),
40
+ }),
41
+ ]);
42
+
43
+ // ---------------------------------------------------------------------------
44
+ // Step
45
+ // ---------------------------------------------------------------------------
46
+
47
+ export const flowStepSchema = z.object({
48
+ id: z.string(),
49
+ name: z.string().optional(),
50
+ description: z.string().optional(),
51
+ chains: z.array(z.string()).optional(),
52
+ parallel: z.boolean().optional(),
53
+ output: z.array(z.string()).optional(),
54
+ gate: gateSchema.optional(),
55
+ /** Capability IDs required by this step (v2) */
56
+ needs: z.array(z.string()).optional(),
57
+ });
58
+
59
+ // ---------------------------------------------------------------------------
60
+ // Flow (root YAML structure)
61
+ // ---------------------------------------------------------------------------
62
+
63
+ export const flowSchema = z.object({
64
+ id: z.string(),
65
+ name: z.string().optional(),
66
+ description: z.string().optional(),
67
+ version: z.string().optional(),
68
+ triggers: z.object({
69
+ modes: z.array(z.string()),
70
+ contexts: z.array(z.string()).optional(),
71
+ 'min-confidence': z.enum(['HIGH', 'MEDIUM', 'LOW']).optional(),
72
+ }),
73
+ steps: z.array(flowStepSchema),
74
+ scoring: z
75
+ .object({
76
+ weights: z.record(z.number()),
77
+ formula: z.string().optional(),
78
+ })
79
+ .optional(),
80
+ 'on-error': z
81
+ .object({
82
+ default: z
83
+ .object({
84
+ action: z.string(),
85
+ message: z.string().optional(),
86
+ recovery: z.string().optional(),
87
+ })
88
+ .optional(),
89
+ 'max-retries': z.number().optional(),
90
+ escalation: z
91
+ .object({
92
+ action: z.string(),
93
+ message: z.string().optional(),
94
+ })
95
+ .optional(),
96
+ })
97
+ .optional(),
98
+ /** Strategy when a step's capability requirement is not satisfied */
99
+ onMissingCapability: z
100
+ .object({
101
+ default: z.enum(['skip-with-warning', 'fail', 'ask-user']).default('skip-with-warning'),
102
+ blocking: z.array(z.string()).optional().default([]),
103
+ })
104
+ .optional(),
105
+ metadata: z
106
+ .object({
107
+ author: z.string().optional(),
108
+ domain: z.string().optional(),
109
+ tags: z.array(z.string()).optional(),
110
+ })
111
+ .optional(),
112
+ });
113
+
114
+ export type Flow = z.infer<typeof flowSchema>;
115
+ export type FlowStep = z.infer<typeof flowStepSchema>;
116
+ export type Gate = z.infer<typeof gateSchema>;
117
+ export type GateAction = z.infer<typeof gateActionSchema>;
118
+
119
+ // ---------------------------------------------------------------------------
120
+ // Probes
121
+ // ---------------------------------------------------------------------------
122
+
123
+ export type ProbeName =
124
+ | 'vault'
125
+ | 'brain'
126
+ | 'designSystem'
127
+ | 'sessionStore'
128
+ | 'projectRules'
129
+ | 'active';
130
+
131
+ export interface ProbeResults {
132
+ vault: boolean;
133
+ brain: boolean;
134
+ designSystem: boolean;
135
+ sessionStore: boolean;
136
+ projectRules: boolean;
137
+ active: boolean;
138
+ }
139
+
140
+ // ---------------------------------------------------------------------------
141
+ // Plan (built from flow + probes)
142
+ // ---------------------------------------------------------------------------
143
+
144
+ export interface PlanStep {
145
+ id: string;
146
+ name: string;
147
+ tools: string[];
148
+ parallel: boolean;
149
+ requires: ProbeName[];
150
+ gate?: {
151
+ type: string;
152
+ condition?: string;
153
+ min?: number;
154
+ onFail?: { action: string; goto?: string; message?: string };
155
+ };
156
+ status: 'pending' | 'running' | 'passed' | 'failed' | 'skipped' | 'gate-paused';
157
+ }
158
+
159
+ export interface SkippedStep {
160
+ id: string;
161
+ name: string;
162
+ reason: string;
163
+ }
164
+
165
+ export interface OrchestrationPlan {
166
+ planId: string;
167
+ intent: string;
168
+ flowId: string;
169
+ steps: PlanStep[];
170
+ skipped: SkippedStep[];
171
+ epilogue: string[];
172
+ warnings: string[];
173
+ summary: string;
174
+ estimatedTools: number;
175
+ context: OrchestrationContext;
176
+ }
177
+
178
+ export interface OrchestrationContext {
179
+ intent: string;
180
+ probes: ProbeResults;
181
+ entities: { components: string[]; actions: string[]; technologies?: string[] };
182
+ projectPath: string;
183
+ }
184
+
185
+ // ---------------------------------------------------------------------------
186
+ // Execution
187
+ // ---------------------------------------------------------------------------
188
+
189
+ export interface StepResult {
190
+ stepId: string;
191
+ status: 'passed' | 'failed' | 'skipped' | 'gate-paused';
192
+ toolResults: Record<string, { tool: string; status: string; data?: unknown; error?: string }>;
193
+ durationMs: number;
194
+ gateResult?: { action: string; message?: string };
195
+ }
196
+
197
+ export interface ExecutionResult {
198
+ planId: string;
199
+ status: 'completed' | 'partial' | 'failed';
200
+ stepsCompleted: number;
201
+ totalSteps: number;
202
+ toolsCalled: string[];
203
+ durationMs: number;
204
+ stepResults: StepResult[];
205
+ }
206
+
207
+ // ---------------------------------------------------------------------------
208
+ // Gate verdict
209
+ // ---------------------------------------------------------------------------
210
+
211
+ export interface GateVerdict {
212
+ passed: boolean;
213
+ action: 'CONTINUE' | 'STOP' | 'BRANCH';
214
+ goto?: string;
215
+ message?: string;
216
+ score?: number;
217
+ }
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Doctor Checks — 8 specialized health checks for comprehensive diagnostics.
3
+ *
4
+ * Each check validates a subsystem and reports pass/warn/fail.
5
+ */
6
+
7
+ import type { HealthRegistry } from './health-registry.js';
8
+ import type { AgentRuntime } from '../runtime/types.js';
9
+
10
+ export interface DoctorCheckResult {
11
+ check: string;
12
+ status: 'pass' | 'warn' | 'fail';
13
+ message: string;
14
+ }
15
+
16
+ export function runDoctorChecks(runtime: AgentRuntime): DoctorCheckResult[] {
17
+ const results: DoctorCheckResult[] = [];
18
+
19
+ // 1. Config
20
+ try {
21
+ const id = runtime.config.agentId;
22
+ results.push({
23
+ check: 'config',
24
+ status: id ? 'pass' : 'fail',
25
+ message: id ? `Agent "${id}" configured` : 'No agent ID',
26
+ });
27
+ } catch (e) {
28
+ results.push({ check: 'config', status: 'fail', message: (e as Error).message });
29
+ }
30
+
31
+ // 2. Database
32
+ try {
33
+ runtime.vault.getProvider().get<{ v: number }>('PRAGMA user_version');
34
+ results.push({ check: 'database', status: 'pass', message: 'SQLite healthy' });
35
+ } catch (e) {
36
+ results.push({ check: 'database', status: 'fail', message: (e as Error).message });
37
+ }
38
+
39
+ // 3. Vault
40
+ try {
41
+ const stats = runtime.vault.stats();
42
+ results.push({
43
+ check: 'vault',
44
+ status: stats.totalEntries > 0 ? 'pass' : 'warn',
45
+ message: stats.totalEntries > 0 ? `${stats.totalEntries} entries` : 'Vault empty',
46
+ });
47
+ } catch (e) {
48
+ results.push({ check: 'vault', status: 'fail', message: (e as Error).message });
49
+ }
50
+
51
+ // 4. LLM
52
+ try {
53
+ const pool = runtime.keyPool;
54
+ const total = (pool.openai?.getActiveKey() ? 1 : 0) + (pool.anthropic?.getActiveKey() ? 1 : 0);
55
+ results.push({
56
+ check: 'llm',
57
+ status: total > 0 ? 'pass' : 'warn',
58
+ message: total > 0 ? `${total} provider(s) available` : 'No API keys — LLM features disabled',
59
+ });
60
+ } catch {
61
+ results.push({ check: 'llm', status: 'warn', message: 'LLM check failed' });
62
+ }
63
+
64
+ // 5. Auth
65
+ results.push({
66
+ check: 'auth',
67
+ status: 'pass',
68
+ message: `Mode: ${runtime.authPolicy.mode}`,
69
+ });
70
+
71
+ // 6. Plugins
72
+ try {
73
+ const count = runtime.pluginRegistry.list().length;
74
+ results.push({ check: 'plugins', status: 'pass', message: `${count} plugin(s)` });
75
+ } catch {
76
+ results.push({ check: 'plugins', status: 'warn', message: 'Plugin check failed' });
77
+ }
78
+
79
+ // 7. Embeddings (Cognee)
80
+ try {
81
+ const available = runtime.cognee?.isAvailable ?? false;
82
+ results.push({
83
+ check: 'embeddings',
84
+ status: available ? 'pass' : 'warn',
85
+ message: available ? 'Cognee available' : 'Cognee not available — vector search disabled',
86
+ });
87
+ } catch {
88
+ results.push({ check: 'embeddings', status: 'warn', message: 'Embedding check failed' });
89
+ }
90
+
91
+ // 8. Security
92
+ results.push({
93
+ check: 'security',
94
+ status: runtime.authPolicy.mode === 'permissive' ? 'warn' : 'pass',
95
+ message:
96
+ runtime.authPolicy.mode === 'permissive'
97
+ ? 'Permissive mode — all ops allowed'
98
+ : `Enforcement: ${runtime.authPolicy.mode}`,
99
+ });
100
+
101
+ return results;
102
+ }
103
+
104
+ export function registerDoctorChecks(health: HealthRegistry, runtime: AgentRuntime): void {
105
+ const results = runDoctorChecks(runtime);
106
+ for (const r of results) {
107
+ health.register(
108
+ r.check,
109
+ r.status === 'pass' ? 'healthy' : r.status === 'warn' ? 'degraded' : 'down',
110
+ );
111
+ if (r.status !== 'pass') {
112
+ health.update(r.check, r.status === 'warn' ? 'degraded' : 'down', r.message);
113
+ }
114
+ }
115
+ }