@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
@@ -107,5 +107,73 @@ export function createAgencyFacadeOps(runtime: AgentRuntime): OpDefinition[] {
107
107
  return question ?? { clarificationNeeded: false };
108
108
  },
109
109
  },
110
+
111
+ // ─── Proactive Intelligence (#211) ─────────────────────────────
112
+ {
113
+ name: 'agency_suggestions',
114
+ description:
115
+ 'Evaluate suggestion rules and return triggered proactive suggestions, sorted by priority.',
116
+ auth: 'read',
117
+ handler: async () => agencyManager.generateSuggestions(),
118
+ },
119
+ {
120
+ name: 'agency_rich_clarify',
121
+ description:
122
+ 'Generate structured clarification questions with urgency, options, and implications.',
123
+ auth: 'read',
124
+ schema: z.object({
125
+ prompt: z.string().describe('The ambiguous prompt to clarify'),
126
+ }),
127
+ handler: async (params) => agencyManager.generateRichClarification(params.prompt as string),
128
+ },
129
+ {
130
+ name: 'agency_suppress_warning',
131
+ description: 'Suppress a warning by ID — prevents it from appearing in pending warnings.',
132
+ auth: 'write',
133
+ schema: z.object({
134
+ warningId: z.string(),
135
+ }),
136
+ handler: async (params) => {
137
+ agencyManager.suppressWarning(params.warningId as string);
138
+ return { suppressed: true, warningId: params.warningId };
139
+ },
140
+ },
141
+ {
142
+ name: 'agency_unsuppress_warning',
143
+ description: 'Remove suppression for a warning.',
144
+ auth: 'write',
145
+ schema: z.object({
146
+ warningId: z.string(),
147
+ }),
148
+ handler: async (params) => {
149
+ agencyManager.unsuppressWarning(params.warningId as string);
150
+ return { unsuppressed: true, warningId: params.warningId };
151
+ },
152
+ },
153
+ {
154
+ name: 'agency_dismiss_pattern',
155
+ description: 'Dismiss a surfaced pattern for 24h — prevents re-surfacing.',
156
+ auth: 'write',
157
+ schema: z.object({
158
+ entryId: z.string(),
159
+ }),
160
+ handler: async (params) => {
161
+ agencyManager.dismissPattern(params.entryId as string);
162
+ return { dismissed: true, entryId: params.entryId, ttlHours: 24 };
163
+ },
164
+ },
165
+ {
166
+ name: 'agency_notifications',
167
+ description: 'Drain pending notifications — returns and clears the notification queue.',
168
+ auth: 'read',
169
+ handler: async () => agencyManager.drainNotifications(),
170
+ },
171
+ {
172
+ name: 'agency_full_status',
173
+ description:
174
+ 'Full agency status including suggestions, suppressions, dismissals, and notifications.',
175
+ auth: 'read',
176
+ handler: async () => agencyManager.getFullStatus(),
177
+ },
110
178
  ];
111
179
  }
@@ -8,7 +8,15 @@ import type { OpDefinition } from '../../facades/types.js';
8
8
  import type { AgentRuntime } from '../types.js';
9
9
 
10
10
  export function createBrainFacadeOps(runtime: AgentRuntime): OpDefinition[] {
11
- const { brain, brainIntelligence, llmClient, keyPool, governance } = runtime;
11
+ const {
12
+ brain,
13
+ brainIntelligence,
14
+ llmClient,
15
+ keyPool,
16
+ governance,
17
+ learningRadar,
18
+ knowledgeSynthesizer,
19
+ } = runtime;
12
20
 
13
21
  return [
14
22
  // ─── Brain (inline from core-ops.ts) ────────────────────────
@@ -387,5 +395,138 @@ export function createBrainFacadeOps(runtime: AgentRuntime): OpDefinition[] {
387
395
  });
388
396
  },
389
397
  },
398
+
399
+ // ─── Learning Radar (#208) ────────────────────────────────────
400
+ {
401
+ name: 'radar_analyze',
402
+ description:
403
+ 'Analyze a learning signal (correction, search miss, workaround, etc.). ' +
404
+ 'High confidence auto-captures silently. Medium queues for review. Low logs only.',
405
+ auth: 'write',
406
+ schema: z.object({
407
+ type: z.enum([
408
+ 'correction',
409
+ 'search_miss',
410
+ 'explicit_capture',
411
+ 'pattern_success',
412
+ 'workaround',
413
+ 'repeated_question',
414
+ ]),
415
+ title: z.string().describe('Short title for the detected pattern'),
416
+ description: z.string().describe('What was learned and why it matters'),
417
+ suggestedType: z.enum(['pattern', 'anti-pattern']).optional(),
418
+ confidence: z
419
+ .number()
420
+ .optional()
421
+ .describe('Override confidence (0-1). Default inferred from signal type.'),
422
+ sourceQuery: z.string().optional().describe('Original query that triggered this signal'),
423
+ context: z.string().optional().describe('Additional context'),
424
+ }),
425
+ handler: async (params) => {
426
+ return learningRadar.analyze({
427
+ type: params.type as
428
+ | 'correction'
429
+ | 'search_miss'
430
+ | 'explicit_capture'
431
+ | 'pattern_success'
432
+ | 'workaround'
433
+ | 'repeated_question',
434
+ title: params.title as string,
435
+ description: params.description as string,
436
+ suggestedType: params.suggestedType as 'pattern' | 'anti-pattern' | undefined,
437
+ confidence: params.confidence as number | undefined,
438
+ sourceQuery: params.sourceQuery as string | undefined,
439
+ context: params.context as string | undefined,
440
+ });
441
+ },
442
+ },
443
+ {
444
+ name: 'radar_candidates',
445
+ description: 'Get pending radar candidates queued for end-of-session review.',
446
+ auth: 'read',
447
+ schema: z.object({
448
+ limit: z.number().optional().default(20),
449
+ }),
450
+ handler: async (params) => {
451
+ return learningRadar.getCandidates(params.limit as number);
452
+ },
453
+ },
454
+ {
455
+ name: 'radar_approve',
456
+ description: 'Approve a pending radar candidate — captures it to vault.',
457
+ auth: 'write',
458
+ schema: z.object({
459
+ candidateId: z.number().describe('Radar candidate ID to approve'),
460
+ }),
461
+ handler: async (params) => {
462
+ return learningRadar.approve(params.candidateId as number);
463
+ },
464
+ },
465
+ {
466
+ name: 'radar_dismiss',
467
+ description: 'Dismiss a pending radar candidate — marks it as not worth capturing.',
468
+ auth: 'write',
469
+ schema: z.object({
470
+ candidateId: z.number().describe('Radar candidate ID to dismiss'),
471
+ }),
472
+ handler: async (params) => {
473
+ return learningRadar.dismiss(params.candidateId as number);
474
+ },
475
+ },
476
+ {
477
+ name: 'radar_flush',
478
+ description:
479
+ 'Auto-capture all pending candidates above a confidence threshold. ' +
480
+ 'Use at end-of-session to batch-capture high-quality candidates.',
481
+ auth: 'write',
482
+ schema: z.object({
483
+ minConfidence: z
484
+ .number()
485
+ .optional()
486
+ .default(0.8)
487
+ .describe('Minimum confidence to auto-capture (default 0.8)'),
488
+ }),
489
+ handler: async (params) => {
490
+ return learningRadar.flush(params.minConfidence as number);
491
+ },
492
+ },
493
+ {
494
+ name: 'radar_stats',
495
+ description:
496
+ 'Get learning radar statistics — analyzed, captured, queued, dismissed, knowledge gaps.',
497
+ auth: 'read',
498
+ handler: async () => {
499
+ return learningRadar.getStats();
500
+ },
501
+ },
502
+
503
+ // ─── Knowledge Synthesis (#207) ───────────────────────────────
504
+ {
505
+ name: 'synthesize',
506
+ description:
507
+ 'Synthesize vault knowledge into structured content. Searches vault for relevant entries, ' +
508
+ 'then uses LLM to produce a brief, outline, talking points, or post draft. ' +
509
+ 'Includes source attribution, coverage score, and knowledge gap detection.',
510
+ auth: 'read',
511
+ schema: z.object({
512
+ query: z.string().describe('Topic to synthesize knowledge about'),
513
+ format: z
514
+ .enum(['brief', 'outline', 'talking-points', 'post-draft'])
515
+ .describe('Output format'),
516
+ maxEntries: z.number().optional().default(10).describe('Max vault entries to consult'),
517
+ audience: z
518
+ .enum(['technical', 'executive', 'general'])
519
+ .optional()
520
+ .default('general')
521
+ .describe('Target audience for tone and language'),
522
+ }),
523
+ handler: async (params) => {
524
+ return knowledgeSynthesizer.synthesize(params.query as string, {
525
+ format: params.format as 'brief' | 'outline' | 'talking-points' | 'post-draft',
526
+ maxEntries: params.maxEntries as number,
527
+ audience: params.audience as 'technical' | 'executive' | 'general',
528
+ });
529
+ },
530
+ },
390
531
  ];
391
532
  }
@@ -11,7 +11,9 @@ import type { CogneeSearchType } from '../../cognee/types.js';
11
11
  import { createCogneeSyncOps } from '../cognee-sync-ops.js';
12
12
 
13
13
  export function createCogneeFacadeOps(runtime: AgentRuntime): OpDefinition[] {
14
- const { cognee, vault, syncManager } = runtime;
14
+ // Only called when runtime.cognee is non-null (guarded in createSemanticFacades)
15
+ const cognee = runtime.cognee!;
16
+ const { vault, syncManager } = runtime;
15
17
 
16
18
  return [
17
19
  // ─── Cognee (inline from core-ops.ts) ───────────────────────
@@ -275,5 +275,50 @@ export function createControlFacadeOps(runtime: AgentRuntime): OpDefinition[] {
275
275
  return governance.getDashboard(params.projectPath as string);
276
276
  },
277
277
  },
278
+
279
+ // ─── Routing Feedback (#209) ──────────────────────────────────
280
+ {
281
+ name: 'routing_feedback',
282
+ description:
283
+ 'Record whether intent routing was correct. Call after a session to track accuracy. ' +
284
+ 'Set correction=true if the human had to override the detected intent.',
285
+ auth: 'write',
286
+ schema: z.object({
287
+ initialIntent: z.string().describe('The intent that was originally detected'),
288
+ actualIntent: z.string().describe('The intent that the session actually turned out to be'),
289
+ confidence: z.number().describe('Original confidence score from route_intent'),
290
+ correction: z
291
+ .boolean()
292
+ .optional()
293
+ .default(false)
294
+ .describe('True if human had to correct the routing'),
295
+ routingLogId: z.number().optional().describe('ID from agent_routing_log for linking'),
296
+ }),
297
+ handler: async (params) => {
298
+ return intentRouter.recordRoutingFeedback({
299
+ initialIntent: params.initialIntent as string,
300
+ actualIntent: params.actualIntent as string,
301
+ confidence: params.confidence as number,
302
+ correction: params.correction as boolean,
303
+ routingLogId: params.routingLogId as number | undefined,
304
+ });
305
+ },
306
+ },
307
+ {
308
+ name: 'routing_accuracy',
309
+ description:
310
+ 'Get routing accuracy report — overall accuracy, common misroutes, confidence calibration per bucket (high/medium/low).',
311
+ auth: 'read',
312
+ schema: z.object({
313
+ periodDays: z
314
+ .number()
315
+ .optional()
316
+ .default(30)
317
+ .describe('Look-back period in days (default: 30)'),
318
+ }),
319
+ handler: async (params) => {
320
+ return intentRouter.getRoutingAccuracy(params.periodDays as number);
321
+ },
322
+ },
278
323
  ];
279
324
  }
@@ -22,7 +22,7 @@ import { createAgencyFacadeOps } from './agency-facade.js';
22
22
  import { createChatFacadeOps } from './chat-facade.js';
23
23
 
24
24
  export function createSemanticFacades(runtime: AgentRuntime, agentId: string): FacadeConfig[] {
25
- return [
25
+ const facades: FacadeConfig[] = [
26
26
  {
27
27
  name: `${agentId}_vault`,
28
28
  description: 'Knowledge management — search, CRUD, import/export, intake, archival.',
@@ -69,11 +69,6 @@ export function createSemanticFacades(runtime: AgentRuntime, agentId: string): F
69
69
  description: 'Agent behavior — identity, intent routing, morphing, guidelines, governance.',
70
70
  ops: createControlFacadeOps(runtime),
71
71
  },
72
- {
73
- name: `${agentId}_cognee`,
74
- description: 'Knowledge graph — Cognee search, sync, export, graph stats.',
75
- ops: createCogneeFacadeOps(runtime),
76
- },
77
72
  {
78
73
  name: `${agentId}_context`,
79
74
  description: 'Context analysis — entity extraction, knowledge retrieval, confidence scoring.',
@@ -92,4 +87,15 @@ export function createSemanticFacades(runtime: AgentRuntime, agentId: string): F
92
87
  ops: createChatFacadeOps(runtime),
93
88
  },
94
89
  ];
90
+
91
+ // Cognee facade — only registered when Cognee integration is enabled
92
+ if (runtime.cognee) {
93
+ facades.push({
94
+ name: `${agentId}_cognee`,
95
+ description: 'Knowledge graph — Cognee search, sync, export, graph stats.',
96
+ ops: createCogneeFacadeOps(runtime),
97
+ });
98
+ }
99
+
100
+ return facades;
95
101
  }
@@ -54,6 +54,11 @@ export function createMemoryFacadeOps(runtime: AgentRuntime): OpDefinition[] {
54
54
  topics: (params.topics as string[]) ?? [],
55
55
  filesModified: (params.filesModified as string[]) ?? [],
56
56
  toolsUsed: (params.toolsUsed as string[]) ?? [],
57
+ intent: null,
58
+ decisions: [],
59
+ currentState: null,
60
+ nextSteps: [],
61
+ vaultEntriesReferenced: [],
57
62
  });
58
63
  return { captured: true, memory };
59
64
  },
@@ -82,14 +87,22 @@ export function createMemoryFacadeOps(runtime: AgentRuntime): OpDefinition[] {
82
87
  {
83
88
  name: 'session_capture',
84
89
  description:
85
- 'Capture a session summary before context compaction. Called automatically by PreCompact hook.',
90
+ 'Capture a session summary. Supports rich format: intent, decisions, currentState, nextSteps, vaultEntriesReferenced.',
86
91
  auth: 'write',
87
92
  schema: z.object({
88
93
  projectPath: z.string().optional().default('.'),
89
- summary: z.string().describe('Brief summary of what was accomplished in this session'),
94
+ summary: z.string().describe('Brief summary of what was accomplished'),
90
95
  topics: z.array(z.string()).optional().default([]),
91
96
  filesModified: z.array(z.string()).optional().default([]),
92
97
  toolsUsed: z.array(z.string()).optional().default([]),
98
+ intent: z.string().optional().describe('What the user was trying to accomplish'),
99
+ decisions: z.array(z.string()).optional().describe('Key decisions and rationale'),
100
+ currentState: z.string().optional().describe('Where things stand at capture time'),
101
+ nextSteps: z.array(z.string()).optional().describe('What should happen next session'),
102
+ vaultEntriesReferenced: z
103
+ .array(z.string())
104
+ .optional()
105
+ .describe('Vault entry IDs that informed this session'),
93
106
  }),
94
107
  handler: async (params) => {
95
108
  const { resolve } = await import('node:path');
@@ -102,6 +115,11 @@ export function createMemoryFacadeOps(runtime: AgentRuntime): OpDefinition[] {
102
115
  topics: (params.topics as string[]) ?? [],
103
116
  filesModified: (params.filesModified as string[]) ?? [],
104
117
  toolsUsed: (params.toolsUsed as string[]) ?? [],
118
+ intent: (params.intent as string) ?? null,
119
+ decisions: (params.decisions as string[]) ?? [],
120
+ currentState: (params.currentState as string) ?? null,
121
+ nextSteps: (params.nextSteps as string[]) ?? [],
122
+ vaultEntriesReferenced: (params.vaultEntriesReferenced as string[]) ?? [],
105
123
  });
106
124
  return { captured: true, memory, message: 'Session summary saved to memory.' };
107
125
  },
@@ -8,6 +8,7 @@ import type { OpDefinition } from '../../facades/types.js';
8
8
  import type { AgentRuntime } from '../types.js';
9
9
  import { createPlanningExtraOps } from '../planning-extra-ops.js';
10
10
  import { createGradingOps } from '../grading-ops.js';
11
+ import { createChainOps } from '../chain-ops.js';
11
12
 
12
13
  export function createPlanFacadeOps(runtime: AgentRuntime): OpDefinition[] {
13
14
  const { planner } = runtime;
@@ -115,5 +116,6 @@ export function createPlanFacadeOps(runtime: AgentRuntime): OpDefinition[] {
115
116
  // ─── Satellite ops ───────────────────────────────────────────
116
117
  ...createPlanningExtraOps(runtime),
117
118
  ...createGradingOps(runtime),
119
+ ...createChainOps(runtime),
118
120
  ];
119
121
  }
@@ -12,17 +12,18 @@ import { createVaultExtraOps } from '../vault-extra-ops.js';
12
12
  import { createCaptureOps } from '../capture-ops.js';
13
13
  import { createIntakeOps } from '../intake-ops.js';
14
14
  import { createVaultSharingOps } from '../vault-sharing-ops.js';
15
+ import { createVaultLinkingOps } from '../vault-linking-ops.js';
15
16
  import { ObsidianSync } from '../../vault/obsidian-sync.js';
16
17
 
17
18
  export function createVaultFacadeOps(runtime: AgentRuntime): OpDefinition[] {
18
- const { vault, brain, intakePipeline, vaultManager } = runtime;
19
+ const { vault, brain, intakePipeline, textIngester, vaultManager } = runtime;
19
20
 
20
21
  return [
21
22
  // ─── Search / Vault (inline from core-ops.ts) ───────────────
22
23
  {
23
24
  name: 'search',
24
25
  description:
25
- 'Search across all knowledge domains. Results ranked by TF-IDF + severity + recency + tag overlap + domain match.',
26
+ 'Search knowledge. mode:"scan" returns lightweight results (titles + scores + snippets) for two-pass retrieval. mode:"full" (default) returns complete entries.',
26
27
  auth: 'read',
27
28
  schema: z.object({
28
29
  query: z.string(),
@@ -31,15 +32,38 @@ export function createVaultFacadeOps(runtime: AgentRuntime): OpDefinition[] {
31
32
  severity: z.enum(['critical', 'warning', 'suggestion']).optional(),
32
33
  tags: z.array(z.string()).optional(),
33
34
  limit: z.number().optional(),
35
+ mode: z
36
+ .enum(['full', 'scan'])
37
+ .optional()
38
+ .default('full')
39
+ .describe(
40
+ 'full = complete entries, scan = lightweight titles + scores for two-pass retrieval',
41
+ ),
34
42
  }),
35
43
  handler: async (params) => {
36
- return brain.intelligentSearch(params.query as string, {
44
+ const opts = {
37
45
  domain: params.domain as string | undefined,
38
46
  type: params.type as string | undefined,
39
47
  severity: params.severity as string | undefined,
40
48
  tags: params.tags as string[] | undefined,
41
49
  limit: (params.limit as number) ?? 10,
42
- });
50
+ };
51
+ if (params.mode === 'scan') {
52
+ return brain.scanSearch(params.query as string, opts);
53
+ }
54
+ return brain.intelligentSearch(params.query as string, opts);
55
+ },
56
+ },
57
+ {
58
+ name: 'load_entries',
59
+ description:
60
+ 'Two-pass retrieval — Pass 2: Load full entries by IDs (from a previous scan search).',
61
+ auth: 'read',
62
+ schema: z.object({
63
+ ids: z.array(z.string()).min(1).describe('Entry IDs from a previous scan search'),
64
+ }),
65
+ handler: async (params) => {
66
+ return brain.loadEntries(params.ids as string[]);
43
67
  },
44
68
  },
45
69
  {
@@ -477,7 +501,8 @@ export function createVaultFacadeOps(runtime: AgentRuntime): OpDefinition[] {
477
501
  // ─── Satellite ops ───────────────────────────────────────────
478
502
  ...createVaultExtraOps(runtime),
479
503
  ...createCaptureOps(runtime),
480
- ...createIntakeOps(intakePipeline),
504
+ ...createIntakeOps(intakePipeline, textIngester),
481
505
  ...createVaultSharingOps(runtime),
506
+ ...createVaultLinkingOps(runtime),
482
507
  ];
483
508
  }
@@ -1,19 +1,24 @@
1
1
  /**
2
- * Intake operations — 4 ops for book/PDF ingestion.
2
+ * Intake operations — 7 ops for book/PDF and text/URL ingestion.
3
3
  *
4
- * Ops: intake_ingest_book, intake_process, intake_status, intake_preview.
4
+ * Ops: intake_ingest_book, intake_process, intake_status, intake_preview,
5
+ * ingest_url, ingest_text, ingest_batch.
5
6
  */
6
7
 
7
8
  import { z } from 'zod';
8
9
  import type { OpDefinition } from '../facades/types.js';
9
10
  import type { IntakePipeline } from '../intake/intake-pipeline.js';
11
+ import type { TextIngester, IngestSource } from '../intake/text-ingester.js';
10
12
 
11
13
  /**
12
- * Create the 4 intake operations.
14
+ * Create the 7 intake operations.
13
15
  *
14
- * The pipeline is optional — when null, all ops return a graceful error.
16
+ * The pipeline and textIngester are optional — when null, affected ops return a graceful error.
15
17
  */
16
- export function createIntakeOps(pipeline: IntakePipeline | null): OpDefinition[] {
18
+ export function createIntakeOps(
19
+ pipeline: IntakePipeline | null,
20
+ textIngester?: TextIngester | null,
21
+ ): OpDefinition[] {
17
22
  return [
18
23
  // ─── Ingest Book ──────────────────────────────────────────────
19
24
  {
@@ -122,5 +127,102 @@ export function createIntakeOps(pipeline: IntakePipeline | null): OpDefinition[]
122
127
  return pipeline.preview({ pdfPath, title, domain }, pageStart, pageEnd);
123
128
  },
124
129
  },
130
+
131
+ // ─── URL Ingestion (#203) ──────────────────────────────────────
132
+ {
133
+ name: 'ingest_url',
134
+ description:
135
+ 'Fetch a URL, extract text, classify into knowledge items via LLM, dedup against vault, and store. ' +
136
+ 'Returns count of ingested entries and duplicates skipped.',
137
+ auth: 'write',
138
+ schema: z.object({
139
+ url: z.string().describe('URL to fetch and ingest'),
140
+ domain: z.string().optional().describe('Knowledge domain (default: general)'),
141
+ tags: z.array(z.string()).optional().describe('Additional tags for all extracted entries'),
142
+ }),
143
+ handler: async (params) => {
144
+ if (!textIngester) return { error: 'Text ingester not configured (LLM client required)' };
145
+ return textIngester.ingestUrl(params.url as string, {
146
+ domain: params.domain as string | undefined,
147
+ tags: params.tags as string[] | undefined,
148
+ });
149
+ },
150
+ },
151
+
152
+ // ─── Text/Transcript Ingestion (#203) ──────────────────────────
153
+ {
154
+ name: 'ingest_text',
155
+ description:
156
+ 'Ingest raw text (article, transcript, notes) — classify via LLM, dedup, and store. ' +
157
+ 'Use for transcripts, copied articles, meeting notes, etc.',
158
+ auth: 'write',
159
+ schema: z.object({
160
+ text: z.string().describe('The text content to ingest'),
161
+ title: z.string().describe('Title for the source material'),
162
+ sourceType: z
163
+ .enum(['article', 'transcript', 'notes', 'documentation'])
164
+ .optional()
165
+ .default('notes')
166
+ .describe('Type of source material'),
167
+ url: z.string().optional().describe('Source URL if available'),
168
+ author: z.string().optional().describe('Author of the source material'),
169
+ domain: z.string().optional().describe('Knowledge domain (default: general)'),
170
+ tags: z.array(z.string()).optional().describe('Additional tags'),
171
+ }),
172
+ handler: async (params) => {
173
+ if (!textIngester) return { error: 'Text ingester not configured (LLM client required)' };
174
+ const source: IngestSource = {
175
+ type: params.sourceType as 'article' | 'transcript' | 'notes' | 'documentation',
176
+ title: params.title as string,
177
+ url: params.url as string | undefined,
178
+ author: params.author as string | undefined,
179
+ };
180
+ return textIngester.ingestText(params.text as string, source, {
181
+ domain: params.domain as string | undefined,
182
+ tags: params.tags as string[] | undefined,
183
+ });
184
+ },
185
+ },
186
+
187
+ // ─── Batch Ingestion (#203) ────────────────────────────────────
188
+ {
189
+ name: 'ingest_batch',
190
+ description:
191
+ 'Ingest multiple text items in one call. Each item has its own source metadata. Processed sequentially.',
192
+ auth: 'write',
193
+ schema: z.object({
194
+ items: z
195
+ .array(
196
+ z.object({
197
+ text: z.string(),
198
+ title: z.string(),
199
+ sourceType: z.enum(['article', 'transcript', 'notes', 'documentation']).optional(),
200
+ url: z.string().optional(),
201
+ author: z.string().optional(),
202
+ domain: z.string().optional(),
203
+ tags: z.array(z.string()).optional(),
204
+ }),
205
+ )
206
+ .min(1)
207
+ .describe('Array of items to ingest'),
208
+ }),
209
+ handler: async (params) => {
210
+ if (!textIngester) return { error: 'Text ingester not configured (LLM client required)' };
211
+ const items = (params.items as Array<Record<string, unknown>>).map((item) => ({
212
+ text: item.text as string,
213
+ source: {
214
+ type: (item.sourceType as string | undefined) ?? 'notes',
215
+ title: item.title as string,
216
+ url: item.url as string | undefined,
217
+ author: item.author as string | undefined,
218
+ } as IngestSource,
219
+ opts: {
220
+ domain: item.domain as string | undefined,
221
+ tags: item.tags as string[] | undefined,
222
+ },
223
+ }));
224
+ return textIngester.ingestBatch(items);
225
+ },
226
+ },
125
227
  ];
126
228
  }