kagent-ts 0.1.3 → 0.1.5

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 (349) hide show
  1. package/LICENSE +68 -21
  2. package/README.md +27 -371
  3. package/dist/compression/progressive-compressor.d.ts +66 -0
  4. package/dist/compression/progressive-compressor.d.ts.map +1 -0
  5. package/dist/compression/progressive-compressor.js +367 -0
  6. package/dist/compression/progressive-compressor.js.map +1 -0
  7. package/dist/compression/types.d.ts +1 -5
  8. package/dist/compression/types.d.ts.map +1 -1
  9. package/dist/context/context-manager.d.ts +34 -15
  10. package/dist/context/context-manager.d.ts.map +1 -1
  11. package/dist/context/context-manager.js +78 -28
  12. package/dist/context/context-manager.js.map +1 -1
  13. package/dist/context/types.d.ts +20 -4
  14. package/dist/context/types.d.ts.map +1 -1
  15. package/dist/core/agent.d.ts +407 -35
  16. package/dist/core/agent.d.ts.map +1 -1
  17. package/dist/core/agent.js +685 -70
  18. package/dist/core/agent.js.map +1 -1
  19. package/dist/core/fusion-agent.d.ts +207 -0
  20. package/dist/core/fusion-agent.d.ts.map +1 -0
  21. package/dist/core/fusion-agent.js +769 -0
  22. package/dist/core/fusion-agent.js.map +1 -0
  23. package/dist/core/hooks.d.ts +19 -7
  24. package/dist/core/hooks.d.ts.map +1 -1
  25. package/dist/core/plan-solve-agent.d.ts +1 -15
  26. package/dist/core/plan-solve-agent.d.ts.map +1 -1
  27. package/dist/core/plan-solve-agent.js +144 -117
  28. package/dist/core/plan-solve-agent.js.map +1 -1
  29. package/dist/core/react-agent.d.ts +0 -13
  30. package/dist/core/react-agent.d.ts.map +1 -1
  31. package/dist/core/react-agent.js +128 -101
  32. package/dist/core/react-agent.js.map +1 -1
  33. package/dist/core/response-schema.d.ts +65 -0
  34. package/dist/core/response-schema.d.ts.map +1 -1
  35. package/dist/core/response-schema.js +174 -1
  36. package/dist/core/response-schema.js.map +1 -1
  37. package/dist/core/system-prompts.d.ts +27 -0
  38. package/dist/core/system-prompts.d.ts.map +1 -0
  39. package/dist/core/system-prompts.js +112 -0
  40. package/dist/core/system-prompts.js.map +1 -0
  41. package/dist/eval/benchmark.d.ts +81 -0
  42. package/dist/eval/benchmark.d.ts.map +1 -0
  43. package/dist/eval/benchmark.js +292 -0
  44. package/dist/eval/benchmark.js.map +1 -0
  45. package/dist/eval/eval-runner.d.ts +79 -0
  46. package/dist/eval/eval-runner.d.ts.map +1 -0
  47. package/dist/eval/eval-runner.js +252 -0
  48. package/dist/eval/eval-runner.js.map +1 -0
  49. package/dist/eval/index.d.ts +7 -0
  50. package/dist/eval/index.d.ts.map +1 -0
  51. package/dist/eval/index.js +13 -0
  52. package/dist/eval/index.js.map +1 -0
  53. package/dist/eval/tool-call-evaluator.d.ts +72 -0
  54. package/dist/eval/tool-call-evaluator.d.ts.map +1 -0
  55. package/dist/eval/tool-call-evaluator.js +265 -0
  56. package/dist/eval/tool-call-evaluator.js.map +1 -0
  57. package/dist/eval/types.d.ts +219 -0
  58. package/dist/eval/types.d.ts.map +1 -0
  59. package/dist/eval/types.js +3 -0
  60. package/dist/eval/types.js.map +1 -0
  61. package/dist/index.d.ts +61 -14
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +121 -8
  64. package/dist/index.js.map +1 -1
  65. package/dist/llm/anthropic-provider.d.ts +141 -0
  66. package/dist/llm/anthropic-provider.d.ts.map +1 -0
  67. package/dist/llm/anthropic-provider.js +486 -0
  68. package/dist/llm/anthropic-provider.js.map +1 -0
  69. package/dist/llm/errors.d.ts +26 -0
  70. package/dist/llm/errors.d.ts.map +1 -0
  71. package/dist/llm/errors.js +19 -0
  72. package/dist/llm/errors.js.map +1 -0
  73. package/dist/llm/factory.d.ts +73 -0
  74. package/dist/llm/factory.d.ts.map +1 -0
  75. package/dist/llm/factory.js +77 -0
  76. package/dist/llm/factory.js.map +1 -0
  77. package/dist/llm/fallback-provider.d.ts +47 -0
  78. package/dist/llm/fallback-provider.d.ts.map +1 -0
  79. package/dist/llm/fallback-provider.js +91 -0
  80. package/dist/llm/fallback-provider.js.map +1 -0
  81. package/dist/llm/interface.d.ts +54 -11
  82. package/dist/llm/interface.d.ts.map +1 -1
  83. package/dist/llm/interface.js +34 -0
  84. package/dist/llm/interface.js.map +1 -1
  85. package/dist/llm/model-router.d.ts +126 -0
  86. package/dist/llm/model-router.d.ts.map +1 -0
  87. package/dist/llm/model-router.js +178 -0
  88. package/dist/llm/model-router.js.map +1 -0
  89. package/dist/llm/openai-provider.d.ts +8 -32
  90. package/dist/llm/openai-provider.d.ts.map +1 -1
  91. package/dist/llm/openai-provider.js +27 -60
  92. package/dist/llm/openai-provider.js.map +1 -1
  93. package/dist/llm/rate-limiter.d.ts +41 -0
  94. package/dist/llm/rate-limiter.d.ts.map +1 -0
  95. package/dist/llm/rate-limiter.js +93 -0
  96. package/dist/llm/rate-limiter.js.map +1 -0
  97. package/dist/llm/retry.d.ts +26 -0
  98. package/dist/llm/retry.d.ts.map +1 -0
  99. package/dist/llm/retry.js +44 -0
  100. package/dist/llm/retry.js.map +1 -0
  101. package/dist/llm/token-budget.d.ts +97 -0
  102. package/dist/llm/token-budget.d.ts.map +1 -0
  103. package/dist/llm/token-budget.js +115 -0
  104. package/dist/llm/token-budget.js.map +1 -0
  105. package/dist/logging/index.d.ts +2 -0
  106. package/dist/logging/index.d.ts.map +1 -0
  107. package/dist/logging/index.js +7 -0
  108. package/dist/logging/index.js.map +1 -0
  109. package/dist/logging/logger.d.ts +38 -0
  110. package/dist/logging/logger.d.ts.map +1 -0
  111. package/dist/logging/logger.js +34 -0
  112. package/dist/logging/logger.js.map +1 -0
  113. package/dist/mcp/index.d.ts +4 -0
  114. package/dist/mcp/index.d.ts.map +1 -0
  115. package/dist/mcp/index.js +8 -0
  116. package/dist/mcp/index.js.map +1 -0
  117. package/dist/mcp/mcp-client-manager.d.ts +72 -0
  118. package/dist/mcp/mcp-client-manager.d.ts.map +1 -0
  119. package/dist/mcp/mcp-client-manager.js +235 -0
  120. package/dist/mcp/mcp-client-manager.js.map +1 -0
  121. package/dist/mcp/mcp-types.d.ts +58 -0
  122. package/dist/mcp/mcp-types.d.ts.map +1 -0
  123. package/dist/mcp/mcp-types.js +20 -0
  124. package/dist/mcp/mcp-types.js.map +1 -0
  125. package/dist/memory/index.d.ts +3 -0
  126. package/dist/memory/index.d.ts.map +1 -0
  127. package/dist/memory/index.js +6 -0
  128. package/dist/memory/index.js.map +1 -0
  129. package/dist/memory/memory-manager.d.ts +119 -0
  130. package/dist/memory/memory-manager.d.ts.map +1 -0
  131. package/dist/memory/memory-manager.js +334 -0
  132. package/dist/memory/memory-manager.js.map +1 -0
  133. package/dist/messages/types.d.ts +2 -0
  134. package/dist/messages/types.d.ts.map +1 -1
  135. package/dist/orchestrator/index.d.ts +5 -0
  136. package/dist/orchestrator/index.d.ts.map +1 -0
  137. package/dist/orchestrator/index.js +13 -0
  138. package/dist/orchestrator/index.js.map +1 -0
  139. package/dist/orchestrator/json-extractor.d.ts +18 -0
  140. package/dist/orchestrator/json-extractor.d.ts.map +1 -0
  141. package/dist/orchestrator/json-extractor.js +111 -0
  142. package/dist/orchestrator/json-extractor.js.map +1 -0
  143. package/dist/orchestrator/orchestrator-agent.d.ts +152 -0
  144. package/dist/orchestrator/orchestrator-agent.d.ts.map +1 -0
  145. package/dist/orchestrator/orchestrator-agent.js +675 -0
  146. package/dist/orchestrator/orchestrator-agent.js.map +1 -0
  147. package/dist/orchestrator/orchestrator-response.d.ts +40 -0
  148. package/dist/orchestrator/orchestrator-response.d.ts.map +1 -0
  149. package/dist/orchestrator/orchestrator-response.js +275 -0
  150. package/dist/orchestrator/orchestrator-response.js.map +1 -0
  151. package/dist/orchestrator/orchestrator-types.d.ts +116 -0
  152. package/dist/orchestrator/orchestrator-types.d.ts.map +1 -0
  153. package/dist/orchestrator/orchestrator-types.js +3 -0
  154. package/dist/orchestrator/orchestrator-types.js.map +1 -0
  155. package/dist/preferences/preference-manager.d.ts +8 -3
  156. package/dist/preferences/preference-manager.d.ts.map +1 -1
  157. package/dist/preferences/preference-manager.js +17 -4
  158. package/dist/preferences/preference-manager.js.map +1 -1
  159. package/dist/rag/chroma-store.d.ts +52 -0
  160. package/dist/rag/chroma-store.d.ts.map +1 -0
  161. package/dist/rag/chroma-store.js +110 -0
  162. package/dist/rag/chroma-store.js.map +1 -0
  163. package/dist/rag/document-loader.d.ts +21 -0
  164. package/dist/rag/document-loader.d.ts.map +1 -0
  165. package/dist/rag/document-loader.js +129 -0
  166. package/dist/rag/document-loader.js.map +1 -0
  167. package/dist/rag/embedding-provider.d.ts +36 -0
  168. package/dist/rag/embedding-provider.d.ts.map +1 -0
  169. package/dist/rag/embedding-provider.js +74 -0
  170. package/dist/rag/embedding-provider.js.map +1 -0
  171. package/dist/rag/index.d.ts +17 -0
  172. package/dist/rag/index.d.ts.map +1 -0
  173. package/dist/rag/index.js +27 -0
  174. package/dist/rag/index.js.map +1 -0
  175. package/dist/rag/keyword-index.d.ts +53 -0
  176. package/dist/rag/keyword-index.d.ts.map +1 -0
  177. package/dist/rag/keyword-index.js +161 -0
  178. package/dist/rag/keyword-index.js.map +1 -0
  179. package/dist/rag/llm-reranker.d.ts +36 -0
  180. package/dist/rag/llm-reranker.d.ts.map +1 -0
  181. package/dist/rag/llm-reranker.js +95 -0
  182. package/dist/rag/llm-reranker.js.map +1 -0
  183. package/dist/rag/rag-manager.d.ts +54 -0
  184. package/dist/rag/rag-manager.d.ts.map +1 -0
  185. package/dist/rag/rag-manager.js +179 -0
  186. package/dist/rag/rag-manager.js.map +1 -0
  187. package/dist/rag/rag-types.d.ts +143 -0
  188. package/dist/rag/rag-types.d.ts.map +1 -0
  189. package/dist/rag/rag-types.js +9 -0
  190. package/dist/rag/rag-types.js.map +1 -0
  191. package/dist/rag/rrf.d.ts +47 -0
  192. package/dist/rag/rrf.d.ts.map +1 -0
  193. package/dist/rag/rrf.js +70 -0
  194. package/dist/rag/rrf.js.map +1 -0
  195. package/dist/rag/search-knowledge.d.ts +24 -0
  196. package/dist/rag/search-knowledge.d.ts.map +1 -0
  197. package/dist/rag/search-knowledge.js +86 -0
  198. package/dist/rag/search-knowledge.js.map +1 -0
  199. package/dist/rag/text-splitter.d.ts +25 -0
  200. package/dist/rag/text-splitter.d.ts.map +1 -0
  201. package/dist/rag/text-splitter.js +136 -0
  202. package/dist/rag/text-splitter.js.map +1 -0
  203. package/dist/rag/vector-store.d.ts +34 -0
  204. package/dist/rag/vector-store.d.ts.map +1 -0
  205. package/dist/rag/vector-store.js +73 -0
  206. package/dist/rag/vector-store.js.map +1 -0
  207. package/dist/reflection/error-notebook.d.ts +125 -0
  208. package/dist/reflection/error-notebook.d.ts.map +1 -0
  209. package/dist/reflection/error-notebook.js +368 -0
  210. package/dist/reflection/error-notebook.js.map +1 -0
  211. package/dist/reflection/index.d.ts +8 -0
  212. package/dist/reflection/index.d.ts.map +1 -0
  213. package/dist/reflection/index.js +12 -0
  214. package/dist/reflection/index.js.map +1 -0
  215. package/dist/reflection/memory-reflector.d.ts +97 -0
  216. package/dist/reflection/memory-reflector.d.ts.map +1 -0
  217. package/dist/reflection/memory-reflector.js +215 -0
  218. package/dist/reflection/memory-reflector.js.map +1 -0
  219. package/dist/reflection/reflection-agent.d.ts +105 -0
  220. package/dist/reflection/reflection-agent.d.ts.map +1 -0
  221. package/dist/reflection/reflection-agent.js +234 -0
  222. package/dist/reflection/reflection-agent.js.map +1 -0
  223. package/dist/reflection/reflection-hook.d.ts +50 -0
  224. package/dist/reflection/reflection-hook.d.ts.map +1 -0
  225. package/dist/reflection/reflection-hook.js +108 -0
  226. package/dist/reflection/reflection-hook.js.map +1 -0
  227. package/dist/rules/project-rules.d.ts +47 -0
  228. package/dist/rules/project-rules.d.ts.map +1 -0
  229. package/dist/rules/project-rules.js +166 -0
  230. package/dist/rules/project-rules.js.map +1 -0
  231. package/dist/security/boundaries.d.ts +81 -0
  232. package/dist/security/boundaries.d.ts.map +1 -0
  233. package/dist/security/boundaries.js +158 -0
  234. package/dist/security/boundaries.js.map +1 -0
  235. package/dist/security/index.d.ts +2 -0
  236. package/dist/security/index.d.ts.map +1 -0
  237. package/dist/security/index.js +11 -0
  238. package/dist/security/index.js.map +1 -0
  239. package/dist/session/session-types.d.ts +25 -4
  240. package/dist/session/session-types.d.ts.map +1 -1
  241. package/dist/skills/file-skill-loader.d.ts +9 -20
  242. package/dist/skills/file-skill-loader.d.ts.map +1 -1
  243. package/dist/skills/file-skill-loader.js +35 -164
  244. package/dist/skills/file-skill-loader.js.map +1 -1
  245. package/dist/skills/index.d.ts +1 -1
  246. package/dist/skills/index.d.ts.map +1 -1
  247. package/dist/skills/index.js +1 -2
  248. package/dist/skills/index.js.map +1 -1
  249. package/dist/skills/skill-manager.d.ts +22 -29
  250. package/dist/skills/skill-manager.d.ts.map +1 -1
  251. package/dist/skills/skill-manager.js +63 -85
  252. package/dist/skills/skill-manager.js.map +1 -1
  253. package/dist/skills/types.d.ts +4 -16
  254. package/dist/skills/types.d.ts.map +1 -1
  255. package/dist/subagent/index.d.ts +4 -0
  256. package/dist/subagent/index.d.ts.map +1 -0
  257. package/dist/subagent/index.js +8 -0
  258. package/dist/subagent/index.js.map +1 -0
  259. package/dist/subagent/subagent-loader.d.ts +53 -0
  260. package/dist/subagent/subagent-loader.d.ts.map +1 -0
  261. package/dist/subagent/subagent-loader.js +155 -0
  262. package/dist/subagent/subagent-loader.js.map +1 -0
  263. package/dist/subagent/subagent-manager.d.ts +161 -0
  264. package/dist/subagent/subagent-manager.d.ts.map +1 -0
  265. package/dist/subagent/subagent-manager.js +468 -0
  266. package/dist/subagent/subagent-manager.js.map +1 -0
  267. package/dist/subagent/subagent-types.d.ts +77 -0
  268. package/dist/subagent/subagent-types.d.ts.map +1 -0
  269. package/dist/subagent/subagent-types.js +3 -0
  270. package/dist/subagent/subagent-types.js.map +1 -0
  271. package/dist/tools/builtin/bash.d.ts +3 -0
  272. package/dist/tools/builtin/bash.d.ts.map +1 -0
  273. package/dist/tools/builtin/bash.js +87 -0
  274. package/dist/tools/builtin/bash.js.map +1 -0
  275. package/dist/tools/builtin/edit-file.d.ts.map +1 -1
  276. package/dist/tools/builtin/edit-file.js +1 -0
  277. package/dist/tools/builtin/edit-file.js.map +1 -1
  278. package/dist/tools/builtin/index.d.ts +14 -0
  279. package/dist/tools/builtin/index.d.ts.map +1 -1
  280. package/dist/tools/builtin/index.js +45 -1
  281. package/dist/tools/builtin/index.js.map +1 -1
  282. package/dist/tools/builtin/list-errors.d.ts +7 -0
  283. package/dist/tools/builtin/list-errors.d.ts.map +1 -0
  284. package/dist/tools/builtin/list-errors.js +64 -0
  285. package/dist/tools/builtin/list-errors.js.map +1 -0
  286. package/dist/tools/builtin/list-subagents.d.ts +7 -0
  287. package/dist/tools/builtin/list-subagents.d.ts.map +1 -0
  288. package/dist/tools/builtin/list-subagents.js +21 -0
  289. package/dist/tools/builtin/list-subagents.js.map +1 -0
  290. package/dist/tools/builtin/recall.d.ts +11 -0
  291. package/dist/tools/builtin/recall.d.ts.map +1 -0
  292. package/dist/tools/builtin/recall.js +60 -0
  293. package/dist/tools/builtin/recall.js.map +1 -0
  294. package/dist/tools/builtin/remember.d.ts +12 -0
  295. package/dist/tools/builtin/remember.d.ts.map +1 -0
  296. package/dist/tools/builtin/remember.js +72 -0
  297. package/dist/tools/builtin/remember.js.map +1 -0
  298. package/dist/tools/builtin/skill.d.ts +14 -0
  299. package/dist/tools/builtin/skill.d.ts.map +1 -0
  300. package/dist/tools/builtin/skill.js +71 -0
  301. package/dist/tools/builtin/skill.js.map +1 -0
  302. package/dist/tools/builtin/spawn-subagent.d.ts +7 -0
  303. package/dist/tools/builtin/spawn-subagent.d.ts.map +1 -0
  304. package/dist/tools/builtin/spawn-subagent.js +43 -0
  305. package/dist/tools/builtin/spawn-subagent.js.map +1 -0
  306. package/dist/tools/builtin/web-fetch.d.ts +3 -0
  307. package/dist/tools/builtin/web-fetch.d.ts.map +1 -0
  308. package/dist/tools/builtin/web-fetch.js +101 -0
  309. package/dist/tools/builtin/web-fetch.js.map +1 -0
  310. package/dist/tools/builtin/write-file.d.ts.map +1 -1
  311. package/dist/tools/builtin/write-file.js +1 -0
  312. package/dist/tools/builtin/write-file.js.map +1 -1
  313. package/dist/tools/circuit-breaker.d.ts +19 -10
  314. package/dist/tools/circuit-breaker.d.ts.map +1 -1
  315. package/dist/tools/circuit-breaker.js +22 -11
  316. package/dist/tools/circuit-breaker.js.map +1 -1
  317. package/dist/tools/error-tracker.d.ts +28 -44
  318. package/dist/tools/error-tracker.d.ts.map +1 -1
  319. package/dist/tools/error-tracker.js +39 -156
  320. package/dist/tools/error-tracker.js.map +1 -1
  321. package/dist/tools/tool-filter.d.ts +70 -0
  322. package/dist/tools/tool-filter.d.ts.map +1 -0
  323. package/dist/tools/tool-filter.js +92 -0
  324. package/dist/tools/tool-filter.js.map +1 -0
  325. package/dist/tools/tool-output-truncator.d.ts +36 -0
  326. package/dist/tools/tool-output-truncator.d.ts.map +1 -0
  327. package/dist/tools/tool-output-truncator.js +117 -0
  328. package/dist/tools/tool-output-truncator.js.map +1 -0
  329. package/dist/tools/tool-registry.d.ts +25 -9
  330. package/dist/tools/tool-registry.d.ts.map +1 -1
  331. package/dist/tools/tool-registry.js +77 -28
  332. package/dist/tools/tool-registry.js.map +1 -1
  333. package/dist/tools/tool-validator.d.ts +13 -0
  334. package/dist/tools/tool-validator.d.ts.map +1 -0
  335. package/dist/tools/tool-validator.js +116 -0
  336. package/dist/tools/tool-validator.js.map +1 -0
  337. package/dist/tools/types.d.ts +86 -3
  338. package/dist/tools/types.d.ts.map +1 -1
  339. package/dist/tools/types.js +51 -2
  340. package/dist/tools/types.js.map +1 -1
  341. package/dist/trace/trace-logger.d.ts +30 -4
  342. package/dist/trace/trace-logger.d.ts.map +1 -1
  343. package/dist/trace/trace-logger.js +83 -7
  344. package/dist/trace/trace-logger.js.map +1 -1
  345. package/package.json +14 -4
  346. package/dist/compression/sliding-window.d.ts +0 -21
  347. package/dist/compression/sliding-window.d.ts.map +0 -1
  348. package/dist/compression/sliding-window.js +0 -44
  349. package/dist/compression/sliding-window.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"context-manager.js","sourceRoot":"","sources":["../../src/context/context-manager.ts"],"names":[],"mappings":";;;AAAA,6CAAsD;AAGtD,kEAAyE;AACzE,0DAAqD;AAErD;;;;;;;GAOG;AACH,MAAa,cAAc;IACjB,MAAM,CAAgB;IACtB,QAAQ,GAAkB,EAAE,CAAC;IAC7B,aAAa,GAAuB,IAAI,CAAC;IACzC,mBAAmB,CAAsB;IACzC,aAAa,GAAG,KAAK,CAAC;IAE9B,YAAY,MAA+B;QACzC,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,MAAM;YACtC,yBAAyB,EAAE,MAAM,EAAE,yBAAyB,IAAI,IAAI;YACpE,WAAW,EAAE,MAAM,EAAE,WAAW;SACjC,CAAC;QACF,IAAI,CAAC,mBAAmB,GAAG,IAAI,yCAAwB,CACrD,IAAI,CAAC,MAAM,CAAC,WAAW,CACxB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,gBAAgB,CAAC,OAAe;QAC9B,IAAI,CAAC,aAAa,GAAG,EAAE,IAAI,EAAE,YAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,OAAoB;QAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,gBAAgB,EAAE,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACnE,CAAC;IAED;;OAEG;IACK,uBAAuB;QAC7B,OAAO,IAAI,CAAC,KAAK,CACf,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAC9D,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,IAAI,KAA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EAAE,CAAC;QACnB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC7B,CAAC;CACF;AAtLD,wCAsLC"}
@@ -9,11 +9,27 @@ export interface ContextConfig {
9
9
  */
10
10
  maxTokens: number;
11
11
  /**
12
- * Token count threshold at which compression triggers (as a fraction of maxTokens).
13
- * When `currentTokens >= maxTokens * compressionThresholdRatio`, compression fires.
14
- * Default: 0.75 (compression fires at ~75% of context).
12
+ * Free tokens to reserve when compression fires.
13
+ *
14
+ * Two modes (auto-detected by value):
15
+ * - **Absolute** (`>= 1`): reserve this many tokens. Default 20000.
16
+ * - **Ratio** (`< 1`): reserve this fraction of maxTokens.
17
+ * Must be ≤ 0.25 so the trigger point is ≥ 75 % of the window.
18
+ *
19
+ * Trigger condition: `currentTokens >= maxTokens - reserve` where
20
+ * `reserve = threshold (< 1 ? maxTokens * threshold : threshold)`.
15
21
  */
16
- compressionThresholdRatio: number;
22
+ compressionThreshold: number;
23
+ /**
24
+ * Number of conversation turns to preserve in Step 2 of compression.
25
+ * Default: 40.
26
+ */
27
+ keepTurns: number;
28
+ /**
29
+ * Tool results older than this (ms) are candidates for removal in Step 3.
30
+ * Default: 3600000 (60 minutes).
31
+ */
32
+ toolResultMaxAgeMs: number;
17
33
  /**
18
34
  * Compression strategy configuration.
19
35
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,yBAAyB,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,YAAY,EAAE,OAAO,CAAC;IACtB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;OAUG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,YAAY,EAAE,OAAO,CAAC;IACtB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -1,15 +1,32 @@
1
- import { LLMProvider } from "../llm/interface";
1
+ import { LLMProvider, ToolCall } from "../llm/interface";
2
+ import { LLMNetworkError } from "../llm/errors";
2
3
  import { ContextManager } from "../context/context-manager";
3
4
  import { Tool } from "./types";
4
5
  import { ToolRegistry } from "../tools/tool-registry";
5
6
  import { ToolErrorTracker } from "../tools/error-tracker";
6
7
  import { SkillManager } from "../skills/skill-manager";
7
- import { Skill } from "../skills/types";
8
+ import { MemoryManager } from "../memory/memory-manager";
9
+ import { ProjectRules } from "../rules/project-rules";
8
10
  import { SessionManager } from "../session/session-manager";
9
11
  import { SessionState, SessionStatus, AgentType } from "../session/session-types";
10
12
  import { PreferenceManager } from "../preferences/preference-manager";
11
13
  import { Preferences } from "../preferences/types";
12
14
  import { AgentHooks } from "./hooks";
15
+ import { McpClientManager } from "../mcp/mcp-client-manager";
16
+ import type { McpServerConfig } from "../mcp/mcp-types";
17
+ import { SubAgentManager } from "../subagent/subagent-manager";
18
+ import type { SubAgentResult } from "../subagent/subagent-types";
19
+ import { RAGManager } from "../rag/rag-manager";
20
+ import type { RAGConfig } from "../rag/rag-types";
21
+ import { Logger } from "../logging/logger";
22
+ import { TokenBudget, TokenBudgetConfig } from "../llm/token-budget";
23
+ /**
24
+ * Callback for human-in-the-loop tool approval.
25
+ *
26
+ * Called before executing a tool marked `requireApproval: true`.
27
+ * Return `true` to approve execution, `false` to deny it.
28
+ */
29
+ export type ApprovalCallback = (toolName: string, args: Record<string, unknown>) => Promise<boolean>;
13
30
  /**
14
31
  * Base configuration for any Agent.
15
32
  */
@@ -26,6 +43,17 @@ export interface AgentConfig {
26
43
  * Takes precedence over the plain `tools` array.
27
44
  */
28
45
  toolRegistry?: ToolRegistry;
46
+ /**
47
+ * Max bytes a tool output can be before it is automatically truncated.
48
+ * When a tool returns a result larger than this, the first 2 KB are kept
49
+ * in context and the full output is saved to disk for on-demand reading.
50
+ *
51
+ * Set to 0 (default) to disable truncation.
52
+ *
53
+ * Only used when `toolRegistry` is NOT provided (the framework creates
54
+ * its own registry).
55
+ */
56
+ toolOutputMaxBytes?: number;
29
57
  /**
30
58
  * Number of retry attempts allowed per tool before its circuit
31
59
  * breaker opens. Only used with the plain `tools` array path
@@ -40,11 +68,7 @@ export interface AgentConfig {
40
68
  */
41
69
  toolErrorTracker?: ToolErrorTracker;
42
70
  /**
43
- * Skills for progressive-disclosure capabilities.
44
- */
45
- skills?: Skill[];
46
- /**
47
- * A pre-configured SkillManager. If provided, `skills` is ignored.
71
+ * A pre-configured SkillManager. If provided, `skillsDir` is ignored.
48
72
  */
49
73
  skillManager?: SkillManager;
50
74
  /**
@@ -59,12 +83,42 @@ export interface AgentConfig {
59
83
  * full content loads on activation.
60
84
  */
61
85
  skillsDir?: string;
86
+ /**
87
+ * Path to the long-term memory storage directory.
88
+ * Default: ".memory". The MemoryManager persists facts, rules, and
89
+ * decisions across sessions using an index (MEMORY.md) + individual
90
+ * markdown files.
91
+ */
92
+ memoryDir?: string;
93
+ /**
94
+ * Path to a project rules file (e.g. "RULES.md") or directory (e.g.
95
+ * ".rules/"). Rules are user-authored, always injected into the system
96
+ * prompt, and reloaded at the start of each run.
97
+ */
98
+ rulesPath?: string;
62
99
  systemPrompt?: string;
63
100
  /**
64
101
  * Lifecycle hooks for observing agent execution.
65
102
  * Accepts a single AgentHooks or an array of them.
66
103
  */
67
104
  hooks?: AgentHooks | AgentHooks[];
105
+ /**
106
+ * Human-in-the-loop approval callback.
107
+ *
108
+ * Called before executing tools marked `requireApproval: true`.
109
+ * Return `true` to approve, `false` to deny (the tool is skipped and
110
+ * an APPROVAL_DENIED result is injected into context).
111
+ *
112
+ * If not provided, tools with `requireApproval: true` are ALWAYS DENIED
113
+ * (safe default — no silent execution of dangerous tools).
114
+ */
115
+ onToolApproval?: ApprovalCallback;
116
+ /**
117
+ * Logger instance for framework-internal messages.
118
+ * Defaults to {@link ConsoleLogger} (writes to `console` with `[Tag]` prefix).
119
+ * Pass a {@link SilentLogger} to suppress all framework output.
120
+ */
121
+ logger?: Logger;
68
122
  /**
69
123
  * Explicit user preferences: key-value pairs of plain-text directives
70
124
  * injected into the system prompt so the LLM always honors them.
@@ -101,6 +155,105 @@ export interface AgentConfig {
101
155
  * Default: false (existing consumers see no behavior change).
102
156
  */
103
157
  enableCheckpointing?: boolean;
158
+ /**
159
+ * MCP (Model Context Protocol) server configurations for dynamic tool
160
+ * discovery. Each key is the server name used as a prefix for discovered
161
+ * tools (e.g., a server named "filesystem" exposing tool "read" becomes
162
+ * available as "filesystem_read").
163
+ *
164
+ * Servers are connected asynchronously when `run()` is called (the
165
+ * constructor is synchronous). If a connection fails, a warning is
166
+ * logged and the other servers still connect.
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * mcpServers: {
171
+ * filesystem: {
172
+ * command: "npx",
173
+ * args: ["-y", "@modelcontextprotocol/server-filesystem", "."],
174
+ * },
175
+ * weather: {
176
+ * url: "http://localhost:3001/sse",
177
+ * },
178
+ * }
179
+ * ```
180
+ */
181
+ mcpServers?: Record<string, McpServerConfig>;
182
+ /**
183
+ * Path to a directory of sub-agent definitions (AGENT.md files).
184
+ *
185
+ * Each subdirectory should contain an `AGENT.md` file with YAML-like
186
+ * frontmatter (name, description, tools, skills) and a body that serves
187
+ * as the system prompt.
188
+ *
189
+ * Sub-agents can be spawned by the main agent via the `spawn_subagent`
190
+ * tool. They run asynchronously; results are injected back as user
191
+ * messages.
192
+ *
193
+ * @example
194
+ * ```
195
+ * subagents/
196
+ * ├── code-reviewer/
197
+ * │ └── AGENT.md
198
+ * └── researcher/
199
+ * └── AGENT.md
200
+ * ```
201
+ */
202
+ subAgentsDir?: string;
203
+ /**
204
+ * LLM provider for sub-agents spawned by the main agent.
205
+ *
206
+ * When set, sub-agents use this provider instead of the main agent's LLM.
207
+ * This enables model routing — use a cheaper/faster model for simple
208
+ * sub-agent tasks while keeping the main model for complex reasoning.
209
+ *
210
+ * When omitted, sub-agents inherit the main agent's `llm` provider.
211
+ *
212
+ * @example
213
+ * ```ts
214
+ * const agent = new ReActAgent({
215
+ * llm: new OpenAIProvider({ model: "gpt-4o" }),
216
+ * subAgentLLM: new OpenAIProvider({ model: "gpt-4o-mini" }),
217
+ * subAgentsDir: "./subagents",
218
+ * });
219
+ * ```
220
+ */
221
+ subAgentLLM?: LLMProvider;
222
+ /**
223
+ * RAG (Retrieval-Augmented Generation) configuration.
224
+ *
225
+ * When set, documents from `documentsDir` are indexed at startup and the
226
+ * `search_knowledge` tool is registered so the LLM can retrieve relevant
227
+ * context before answering.
228
+ *
229
+ * @example
230
+ * ```ts
231
+ * rag: {
232
+ * documentsDir: "./docs",
233
+ * embeddingProvider: new OpenAIEmbeddingProvider({ apiKey: "..." }),
234
+ * topK: 5,
235
+ * }
236
+ * ```
237
+ */
238
+ rag?: RAGConfig;
239
+ /**
240
+ * Token budget configuration for session-level cost control.
241
+ * When set, the agent stops making LLM calls when cumulative token
242
+ * consumption exceeds `maxTotalTokens`. The budget resets on
243
+ * `clearConversation()` and `reset()`.
244
+ */
245
+ tokenBudgetConfig?: TokenBudgetConfig;
246
+ /**
247
+ * Enable parallel execution of tool calls within a single LLM response.
248
+ *
249
+ * When `true` (default), tool calls from the same LLM response that are
250
+ * all parallel-safe (no `sequential: true` marks) execute concurrently
251
+ * via `Promise.allSettled`. This reduces per-turn latency from
252
+ * `sum(latency)` to `max(latency)`.
253
+ *
254
+ * Set to `false` to always execute tools one at a time (legacy behaviour).
255
+ */
256
+ enableParallelToolExecution?: boolean;
104
257
  }
105
258
  /**
106
259
  * Abstract base Agent class.
@@ -121,6 +274,10 @@ export declare abstract class Agent {
121
274
  protected contextManager: ContextManager;
122
275
  protected toolRegistry: ToolRegistry;
123
276
  protected skillManager: SkillManager;
277
+ /** Long-term memory (rules + project facts) persisted across sessions. */
278
+ protected memoryManager: MemoryManager;
279
+ /** User-defined project rules loaded from disk. */
280
+ protected projectRules: ProjectRules;
124
281
  /** The original core system prompt (before skill sections are appended). */
125
282
  protected coreSystemPrompt: string;
126
283
  /** User preferences — plain-text directives injected into the system prompt. */
@@ -129,16 +286,40 @@ export declare abstract class Agent {
129
286
  protected preferenceManager?: PreferenceManager;
130
287
  /** Lifecycle hooks for observing agent execution. */
131
288
  protected hooks: AgentHooks[];
132
- /**
133
- * Trace ID of the most recent tool error waiting for LLM analysis.
134
- * Set after a tool fails, cleared when the LLM's analysis is recorded. */
135
- protected pendingErrorTraceId: string | null;
289
+ /** Logger for framework-internal messages. */
290
+ protected logger: Logger;
291
+ /** Token budget for session-level cost control (optional). */
292
+ protected tokenBudget?: TokenBudget;
293
+ /** Human-in-the-loop approval callback (from AgentConfig). */
294
+ protected onToolApproval?: ApprovalCallback;
295
+ /** Whether to execute independent tool calls in parallel (default: true). */
296
+ protected enableParallelToolExecution: boolean;
136
297
  /** Session manager for checkpoint persistence (optional). */
137
298
  protected sessionManager?: SessionManager;
138
299
  /** Whether auto-checkpointing is enabled. */
139
300
  protected checkpointingEnabled: boolean;
140
301
  /** Whether the current run has been cancelled by the user. */
141
302
  protected _cancelled: boolean;
303
+ /** Controller for aborting in-flight LLM requests on cancellation. */
304
+ protected _abortController?: AbortController;
305
+ /** MCP server configurations (from AgentConfig). */
306
+ protected mcpServerConfigs?: Record<string, McpServerConfig>;
307
+ /** MCP client manager for dynamic tool discovery (lazily initialized). */
308
+ protected mcpClientManager?: McpClientManager;
309
+ /** Guards async init() from running more than once per instance. */
310
+ private _mcpInitialized;
311
+ /** RAG manager (lazily initialized in init()). */
312
+ protected ragManager?: RAGManager;
313
+ /** RAG configuration (from AgentConfig). */
314
+ protected ragConfig?: RAGConfig;
315
+ /** Sub-agent manager (lazily initialized in init()). */
316
+ protected subAgentManager?: SubAgentManager;
317
+ /** Sub-agent definitions directory (from AgentConfig). */
318
+ protected subAgentsDir?: string;
319
+ /** LLM provider for sub-agents (defaults to main llm if not set). */
320
+ protected subAgentLLM?: LLMProvider;
321
+ /** Skills directory path (from AgentConfig). */
322
+ protected skillsDir?: string;
142
323
  constructor(config: AgentConfig);
143
324
  /**
144
325
  * Run the agent with the given user input and return the final response.
@@ -152,10 +333,6 @@ export declare abstract class Agent {
152
333
  * Get the tool registry (for advanced management).
153
334
  */
154
335
  getToolRegistry(): ToolRegistry;
155
- /**
156
- * Add skills to the agent's SkillManager.
157
- */
158
- addSkill(...skills: Skill[]): void;
159
336
  /**
160
337
  * Get the SkillManager (for advanced management).
161
338
  */
@@ -176,21 +353,117 @@ export declare abstract class Agent {
176
353
  */
177
354
  addHook(hook: AgentHooks): void;
178
355
  /**
179
- * Rebuild the system message from the core prompt + user preferences + active skills.
180
- * Called automatically when skills are activated/deactivated or preferences change.
356
+ * Rebuild the system message.
357
+ *
358
+ * Sections are assembled in priority order:
359
+ * 1. Core prompt (agent identity + instructions)
360
+ * 2. Project rules (user-authored, always injected)
361
+ * 3. Preferences (user-set language / verbosity / style)
362
+ * 4. Error recovery rules (tool failure recovery guidance)
363
+ * 5. Long-term memories (index of persisted facts + rules)
364
+ * 6. Available skills (inactive skills the LLM can activate)
365
+ * 7. Active skill content (full instructions for activated skills)
366
+ *
367
+ * Empty sections are silently skipped.
368
+ */
369
+ /**
370
+ * Build the full system prompt from all sections.
371
+ *
372
+ * Subclasses that need to append extra content (e.g. plan progress)
373
+ * should call this and concatenate, instead of duplicating the assembly.
181
374
  */
375
+ protected buildSystemPrompt(): string;
182
376
  protected rebuildSystemPrompt(): void;
183
377
  /**
184
- * Pre-iteration maintenance:
185
- * 1. Compress context window if needed.
186
- * 2. Auto-reload preferences from disk if the file was manually edited.
378
+ * Pre-iteration maintenance: compress context window if needed.
187
379
  */
188
- protected checkAndCompress(): void;
380
+ protected checkAndCompress(): Promise<void>;
381
+ /**
382
+ * Reload preferences from disk if the file was manually edited.
383
+ * Called once at the start of each run so edits between runs take
384
+ * effect without restarting the agent process — but they won't
385
+ * change mid-run behavior.
386
+ */
387
+ protected reloadPreferencesIfChanged(): boolean;
388
+ /**
389
+ * Re-scan the skills directory for new SKILL.md files added between runs.
390
+ * New skills are registered and become available to the LLM immediately.
391
+ */
392
+ protected reloadSkillsFromDirectory(): boolean;
393
+ /**
394
+ * Re-read the MEMORY.md index from disk if it was manually edited
395
+ * between runs. The index is a lightweight list of memory names +
396
+ * descriptions — full content is loaded on demand via the recall tool.
397
+ */
398
+ protected reloadMemoryIfChanged(): boolean;
399
+ /**
400
+ * Incrementally connect to MCP servers that were added to the config
401
+ * since the last run. Already-connected servers are left untouched.
402
+ */
403
+ protected reconnectMCPIfNeeded(): Promise<void>;
404
+ /**
405
+ * Reload all dynamic resources at the start of a run.
406
+ * Picks up changes made between conversation turns.
407
+ */
408
+ protected reloadDynamicResources(): Promise<void>;
409
+ /**
410
+ * After a resume, recover results from sub-agents that were cancelled
411
+ * mid-run. Completed results are injected into context so the LLM can
412
+ * see them; still-running sub-agents get a notice.
413
+ */
414
+ protected recoverOrphanedSubAgentResults(): void;
415
+ /**
416
+ * Validate that user input won't overwhelm the context window.
417
+ *
418
+ * Returns a user-facing error string if the input is too large,
419
+ * or `null` if it passes the check.
420
+ */
421
+ protected validateInputSize(input: string): string | null;
422
+ /**
423
+ * Check whether a tool that requires approval should be executed.
424
+ *
425
+ * @returns `true` if approved, `false` if denied (or no callback configured).
426
+ */
427
+ protected checkToolApproval(toolName: string, args: Record<string, unknown>): Promise<boolean>;
428
+ /**
429
+ * Execute a batch of tool calls from a single LLM response.
430
+ *
431
+ * When `enableParallelToolExecution` is true and all tools in the batch are
432
+ * parallel-safe (`sequential` is not set), tools execute concurrently via
433
+ * `Promise.allSettled`. Otherwise, they execute one at a time (serial).
434
+ *
435
+ * Handles the full lifecycle for each tool call:
436
+ * 1. Parse JSON arguments (malformed args → error result, no execution)
437
+ * 2. HITL approval check for tools marked `requireApproval`
438
+ * 3. Hook notifications (`onToolStart`, `onToolEnd`, `onToolError`)
439
+ * 4. Execution via `ToolRegistry.execute()`
440
+ * 5. Context injection (all results added after execution completes)
441
+ * 6. Post-execution: sub-agent spawn tracking, MCP failure warnings
442
+ *
443
+ * @param toolCalls The tool calls from the LLM response.
444
+ * @param mcpWarnedServers Set tracking which MCP servers have already
445
+ * been warned about in this batch.
446
+ * @returns Whether any tool in the batch failed.
447
+ */
448
+ protected executeToolCallsBatch(toolCalls: ToolCall[], mcpWarnedServers: Set<string>): Promise<{
449
+ hadFailure: boolean;
450
+ }>;
451
+ /**
452
+ * Check whether the token budget allows another LLM call.
453
+ *
454
+ * @param estimatedInputTokens Approximate tokens in the upcoming request
455
+ * (system prompt + context messages).
456
+ * @returns A user-facing error string if the budget is exhausted,
457
+ * or `null` if the call can proceed.
458
+ */
459
+ protected checkTokenBudget(estimatedInputTokens: number): string | null;
189
460
  /**
190
461
  * Cancel the current run.
191
462
  *
192
- * Prevents any further checkpoint saves. Call this when the user presses
193
- * SIGINT to discard the session rather than persisting it.
463
+ * Aborts any in-flight LLM request via the AbortController, sets the
464
+ * cancellation flag, and cancels all running sub-agents. The agent loop
465
+ * will save a "cancelled" checkpoint and exit at its next iteration.
466
+ * The session is preserved on disk and can be resumed later.
194
467
  */
195
468
  cancel(): void;
196
469
  /**
@@ -231,10 +504,20 @@ export declare abstract class Agent {
231
504
  */
232
505
  protected buildBaseSessionState(status: SessionStatus): SessionState;
233
506
  /**
234
- * Save a session checkpoint to disk (if session manager is configured
235
- * and the run has NOT been cancelled).
507
+ * Save a session checkpoint to disk (if session manager is configured).
236
508
  */
237
509
  protected saveCheckpoint(status?: SessionStatus): void;
510
+ /**
511
+ * Handle an LLMNetworkError: save an interrupted checkpoint if
512
+ * checkpointing is enabled, and return a user-facing message with
513
+ * resume instructions.
514
+ *
515
+ * @param err The network error that occurred.
516
+ * @param iteration The current iteration number (for the log).
517
+ * @param resumeInstruction What the user should type to resume
518
+ * (e.g. "continue with my previous request").
519
+ */
520
+ protected handleNetworkError(err: LLMNetworkError, iteration: number, resumeInstruction?: string): string;
238
521
  /**
239
522
  * Restore agent state from a previously saved session.
240
523
  *
@@ -252,6 +535,39 @@ export declare abstract class Agent {
252
535
  * Use this to begin a new topic without creating a new agent instance.
253
536
  */
254
537
  clearConversation(): void;
538
+ /**
539
+ * Continue the current conversation with a follow-up input.
540
+ *
541
+ * Equivalent to `run()` but conveys the semantics of a multi-turn
542
+ * conversation continuation. Messages from previous calls are preserved
543
+ * in context, so the LLM sees the full conversation history.
544
+ *
545
+ * @param input The follow-up message from the user.
546
+ * @returns The agent's response.
547
+ */
548
+ chat(input: string): Promise<string>;
549
+ /**
550
+ * Start a new topic with a fresh conversation.
551
+ *
552
+ * Clears the message history (preserving the system prompt and
553
+ * configuration) and runs the input as the first message of a
554
+ * new conversation. The token budget is also reset.
555
+ *
556
+ * @param input The first message of the new topic.
557
+ * @returns The agent's response.
558
+ */
559
+ newTopic(input: string): Promise<string>;
560
+ /**
561
+ * The number of messages in the current conversation (excluding the
562
+ * system message). Use this to check whether there is an active
563
+ * conversation or to monitor context growth.
564
+ */
565
+ get conversationLength(): number;
566
+ /**
567
+ * Get the cumulative token consumption and cost for the current session.
568
+ * Returns null if no `tokenBudgetConfig` was configured.
569
+ */
570
+ getSessionCost(): import("../llm/token-budget").TokenBudgetCost | null;
255
571
  /**
256
572
  * Reset the agent to its initial state.
257
573
  *
@@ -264,26 +580,82 @@ export declare abstract class Agent {
264
580
  * Subclasses override this ("react" or "plan-solve").
265
581
  */
266
582
  protected getAgentType(): AgentType;
583
+ /**
584
+ * Initialize async resources (MCP connections, tool discovery).
585
+ *
586
+ * Idempotent — safe to call multiple times; the actual work happens
587
+ * only on the first invocation. Subclasses SHOULD call `await this.init()`
588
+ * at the start of `run()`.
589
+ *
590
+ * If MCP servers are configured:
591
+ * 1. Creates an McpClientManager bound to the tool registry.
592
+ * 2. Connects to each server and registers discovered tools.
593
+ * 3. Logs warnings for any servers that fail to connect.
594
+ */
595
+ protected init(): Promise<void>;
596
+ /**
597
+ * Gracefully shut down MCP connections.
598
+ *
599
+ * Disconnects all servers and unregisters their tools. Safe to call
600
+ * even if init() was never called or no servers were configured.
601
+ */
602
+ shutdown(): Promise<void>;
603
+ /**
604
+ * Check whether sub-agents are available.
605
+ *
606
+ * Used by `buildSystemPrompt()` to decide whether to include sub-agent
607
+ * delegation instructions. Returns true only when a SubAgentManager is
608
+ * configured AND has at least one registered definition.
609
+ */
610
+ protected hasSubAgents(): boolean;
611
+ /**
612
+ * Spawn a sub-agent by definition name.
613
+ *
614
+ * The sub-agent runs asynchronously — this method returns immediately.
615
+ * Call `pollSubAgentResults()` at the start of each iteration to
616
+ * collect completed results.
617
+ *
618
+ * @param name The registered sub-agent definition name.
619
+ * @param input The task description for the sub-agent.
620
+ * @returns The unique run ID.
621
+ */
622
+ protected spawnSubAgent(name: string, input: string): string;
623
+ /**
624
+ * Poll for completed sub-agent results.
625
+ *
626
+ * Should be called at the start of each ReAct iteration to inject
627
+ * sub-agent outputs into the main agent's context.
628
+ */
629
+ protected pollSubAgentResults(): Promise<SubAgentResult[]>;
267
630
  /**
268
631
  * Get the error tracker (if configured via the ToolRegistry).
269
632
  */
270
633
  get errorTracker(): ToolErrorTracker | undefined;
271
634
  /**
272
- * Call after a tool returns an error string — checks if the error
273
- * indicates a tool failure (with retry guidance) and saves the trace ID
274
- * so the next LLM analysis thought can be captured.
635
+ * Call after a tool returns a result — checks if the result indicates
636
+ * a tool failure (retryable or fatal) and saves the trace ID so the
637
+ * next LLM analysis thought can be captured.
275
638
  *
276
- * @param toolName The name of the tool that failed.
277
- * @param result The string returned by ToolRegistry.execute().
639
+ * @param toolName The name of the tool that was executed.
640
+ * @param result The structured ToolResult returned by ToolRegistry.execute().
278
641
  */
279
- protected trackToolErrorForAnalysis(toolName: string, result: string): void;
280
642
  /**
281
- * Records the LLM's analysis thought against the pending tool error trace.
282
- * Should be called each iteration after parsing the LLM's response.
643
+ * Capture the LLM's reasoning as error analysis for any active tool error traces.
644
+ *
645
+ * Call this after parsing the LLM's `thought` from each response. If any tools
646
+ * have an open failure chain (active trace), the thought is recorded as the
647
+ * LLM's analysis of what went wrong and how to proceed.
648
+ *
649
+ * This feeds the error→analysis pipeline:
650
+ * 1. Tool fails → recordFailure() creates an active trace
651
+ * 2. LLM sees error → its next thought IS the analysis
652
+ * 3. Analysis → recordAnalysis() attaches the LLM's reasoning to the trace
653
+ *
654
+ * For cross-session learning, use ErrorNotebook (错题本) via ReflectionHook.
283
655
  *
284
- * @param thought The LLM's thought/analysis content.
656
+ * @param thought The LLM's reasoning (from parsed.thought).
285
657
  */
286
- protected captureAnalysisFromThought(thought: string): void;
658
+ protected captureErrorAnalysis(thought: string): void;
287
659
  /**
288
660
  * Generate a markdown report of all recorded tool error traces.
289
661
  */
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/core/agent.ts"],"names":[],"mappings":"AAAA,O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