@dexto/core 1.5.7 → 1.6.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 (697) hide show
  1. package/README.md +19 -8
  2. package/dist/agent/DextoAgent.cjs +383 -153
  3. package/dist/agent/DextoAgent.d.ts +112 -60
  4. package/dist/agent/DextoAgent.d.ts.map +1 -1
  5. package/dist/agent/DextoAgent.js +380 -150
  6. package/dist/{context/compaction/provider.cjs → agent/agent-options.cjs} +2 -2
  7. package/dist/agent/agent-options.d.ts +53 -0
  8. package/dist/agent/agent-options.d.ts.map +1 -0
  9. package/dist/agent/agentCard.cjs +1 -1
  10. package/dist/agent/errors.cjs +2 -2
  11. package/dist/agent/errors.d.ts.map +1 -1
  12. package/dist/agent/index.cjs +1 -6
  13. package/dist/agent/index.d.ts +3 -2
  14. package/dist/agent/index.d.ts.map +1 -1
  15. package/dist/agent/index.js +1 -7
  16. package/dist/{storage/blob/provider.cjs → agent/runtime-config.cjs} +2 -2
  17. package/dist/agent/runtime-config.d.ts +53 -0
  18. package/dist/agent/runtime-config.d.ts.map +1 -0
  19. package/dist/agent/schemas.cjs +2 -99
  20. package/dist/agent/schemas.d.ts +10 -9160
  21. package/dist/agent/schemas.d.ts.map +1 -1
  22. package/dist/agent/schemas.js +1 -104
  23. package/dist/agent/state-manager.d.ts +5 -5
  24. package/dist/agent/state-manager.d.ts.map +1 -1
  25. package/dist/approval/error-codes.cjs +1 -1
  26. package/dist/approval/error-codes.d.ts +1 -1
  27. package/dist/approval/error-codes.d.ts.map +1 -1
  28. package/dist/approval/error-codes.js +1 -1
  29. package/dist/approval/errors.cjs +5 -5
  30. package/dist/approval/errors.d.ts +2 -2
  31. package/dist/approval/errors.d.ts.map +1 -1
  32. package/dist/approval/errors.js +5 -5
  33. package/dist/approval/index.cjs +8 -8
  34. package/dist/approval/index.d.ts +2 -2
  35. package/dist/approval/index.d.ts.map +1 -1
  36. package/dist/approval/index.js +8 -8
  37. package/dist/approval/manager.cjs +77 -57
  38. package/dist/approval/manager.d.ts +41 -43
  39. package/dist/approval/manager.d.ts.map +1 -1
  40. package/dist/approval/manager.js +75 -55
  41. package/dist/approval/schemas.cjs +26 -25
  42. package/dist/approval/schemas.d.ts +35 -15
  43. package/dist/approval/schemas.d.ts.map +1 -1
  44. package/dist/approval/schemas.js +22 -21
  45. package/dist/approval/types.cjs +1 -1
  46. package/dist/approval/types.d.ts +14 -14
  47. package/dist/approval/types.d.ts.map +1 -1
  48. package/dist/approval/types.js +1 -1
  49. package/dist/context/compaction/index.cjs +2 -23
  50. package/dist/context/compaction/index.d.ts +1 -7
  51. package/dist/context/compaction/index.d.ts.map +1 -1
  52. package/dist/context/compaction/index.js +1 -16
  53. package/dist/context/compaction/strategies/noop.cjs +19 -1
  54. package/dist/context/compaction/strategies/noop.d.ts +13 -3
  55. package/dist/context/compaction/strategies/noop.d.ts.map +1 -1
  56. package/dist/context/compaction/strategies/noop.js +19 -1
  57. package/dist/context/compaction/strategies/{reactive-overflow.cjs → reactive-overflow-compaction.cjs} +67 -64
  58. package/dist/context/compaction/strategies/{reactive-overflow.d.ts → reactive-overflow-compaction.d.ts} +19 -36
  59. package/dist/context/compaction/strategies/reactive-overflow-compaction.d.ts.map +1 -0
  60. package/dist/context/compaction/strategies/{reactive-overflow.js → reactive-overflow-compaction.js} +63 -60
  61. package/dist/context/compaction/types.d.ts +40 -8
  62. package/dist/context/compaction/types.d.ts.map +1 -1
  63. package/dist/context/manager.cjs +5 -3
  64. package/dist/context/manager.d.ts +4 -3
  65. package/dist/context/manager.d.ts.map +1 -1
  66. package/dist/context/manager.js +5 -3
  67. package/dist/context/types.d.ts +2 -0
  68. package/dist/context/types.d.ts.map +1 -1
  69. package/dist/context/utils.cjs +70 -43
  70. package/dist/context/utils.d.ts +14 -14
  71. package/dist/context/utils.d.ts.map +1 -1
  72. package/dist/context/utils.js +69 -42
  73. package/dist/errors/result-bridge.d.ts +2 -2
  74. package/dist/errors/result-bridge.d.ts.map +1 -1
  75. package/dist/errors/types.cjs +1 -1
  76. package/dist/errors/types.d.ts +3 -3
  77. package/dist/errors/types.d.ts.map +1 -1
  78. package/dist/errors/types.js +1 -1
  79. package/dist/events/index.cjs +15 -2
  80. package/dist/events/index.d.ts +78 -7
  81. package/dist/events/index.d.ts.map +1 -1
  82. package/dist/events/index.js +15 -2
  83. package/dist/{plugins → hooks}/builtins/content-policy.cjs +7 -6
  84. package/dist/hooks/builtins/content-policy.d.ts +24 -0
  85. package/dist/hooks/builtins/content-policy.d.ts.map +1 -0
  86. package/dist/{plugins → hooks}/builtins/content-policy.js +6 -5
  87. package/dist/{plugins → hooks}/builtins/response-sanitizer.cjs +3 -3
  88. package/dist/hooks/builtins/response-sanitizer.d.ts +22 -0
  89. package/dist/hooks/builtins/response-sanitizer.d.ts.map +1 -0
  90. package/dist/{plugins → hooks}/builtins/response-sanitizer.js +2 -2
  91. package/dist/hooks/error-codes.cjs +43 -0
  92. package/dist/hooks/error-codes.d.ts +34 -0
  93. package/dist/hooks/error-codes.d.ts.map +1 -0
  94. package/dist/hooks/error-codes.js +20 -0
  95. package/dist/{storage/cache/providers/memory.cjs → hooks/index.cjs} +15 -18
  96. package/dist/hooks/index.d.ts +14 -0
  97. package/dist/hooks/index.d.ts.map +1 -0
  98. package/dist/hooks/index.js +11 -0
  99. package/dist/hooks/manager.cjs +354 -0
  100. package/dist/hooks/manager.d.ts +103 -0
  101. package/dist/hooks/manager.d.ts.map +1 -0
  102. package/dist/hooks/manager.js +331 -0
  103. package/dist/{plugins → hooks}/types.d.ts +36 -34
  104. package/dist/hooks/types.d.ts.map +1 -0
  105. package/dist/index.browser.cjs +13 -12
  106. package/dist/index.browser.d.ts +6 -6
  107. package/dist/index.browser.d.ts.map +1 -1
  108. package/dist/index.browser.js +8 -7
  109. package/dist/index.cjs +5 -7
  110. package/dist/index.d.ts +2 -3
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +2 -3
  113. package/dist/llm/curation-config.cjs +82 -0
  114. package/dist/llm/curation-config.d.ts +13 -0
  115. package/dist/llm/curation-config.d.ts.map +1 -0
  116. package/dist/llm/curation-config.js +59 -0
  117. package/dist/llm/curation.cjs +57 -0
  118. package/dist/llm/curation.d.ts +16 -0
  119. package/dist/llm/curation.d.ts.map +1 -0
  120. package/dist/llm/curation.js +34 -0
  121. package/dist/llm/errors.cjs +2 -2
  122. package/dist/llm/errors.d.ts +8 -8
  123. package/dist/llm/errors.js +1 -1
  124. package/dist/llm/executor/provider-options.cjs +1 -1
  125. package/dist/llm/executor/provider-options.js +1 -1
  126. package/dist/llm/executor/stream-processor.cjs +131 -11
  127. package/dist/llm/executor/stream-processor.d.ts +7 -5
  128. package/dist/llm/executor/stream-processor.d.ts.map +1 -1
  129. package/dist/llm/executor/stream-processor.js +131 -11
  130. package/dist/llm/executor/turn-executor.cjs +57 -56
  131. package/dist/llm/executor/turn-executor.d.ts +7 -8
  132. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  133. package/dist/llm/executor/turn-executor.js +57 -56
  134. package/dist/llm/formatters/vercel.cjs +2 -2
  135. package/dist/llm/formatters/vercel.d.ts +2 -2
  136. package/dist/llm/formatters/vercel.d.ts.map +1 -1
  137. package/dist/llm/index.cjs +14 -3
  138. package/dist/llm/index.d.ts +3 -1
  139. package/dist/llm/index.d.ts.map +1 -1
  140. package/dist/llm/index.js +13 -2
  141. package/dist/llm/providers/local/schemas.d.ts +10 -10
  142. package/dist/llm/registry/auto-update.cjs +263 -0
  143. package/dist/llm/registry/auto-update.d.ts +27 -0
  144. package/dist/llm/registry/auto-update.d.ts.map +1 -0
  145. package/dist/llm/registry/auto-update.js +227 -0
  146. package/dist/llm/registry/index.cjs +806 -0
  147. package/dist/llm/{registry.d.ts → registry/index.d.ts} +21 -43
  148. package/dist/llm/registry/index.d.ts.map +1 -0
  149. package/dist/llm/registry/index.js +756 -0
  150. package/dist/llm/registry/models.generated.cjs +4861 -0
  151. package/dist/llm/registry/models.generated.d.ts +431 -0
  152. package/dist/llm/registry/models.generated.d.ts.map +1 -0
  153. package/dist/llm/registry/models.generated.js +4838 -0
  154. package/dist/{storage/database/providers/index.cjs → llm/registry/models.manual.cjs} +22 -12
  155. package/dist/llm/registry/models.manual.d.ts +22 -0
  156. package/dist/llm/registry/models.manual.d.ts.map +1 -0
  157. package/dist/llm/registry/models.manual.js +21 -0
  158. package/dist/llm/registry/sync.cjs +354 -0
  159. package/dist/llm/registry/sync.d.ts +41 -0
  160. package/dist/llm/registry/sync.d.ts.map +1 -0
  161. package/dist/llm/registry/sync.js +328 -0
  162. package/dist/llm/resolver.cjs +29 -20
  163. package/dist/llm/resolver.d.ts +4 -4
  164. package/dist/llm/resolver.d.ts.map +1 -1
  165. package/dist/llm/resolver.js +28 -20
  166. package/dist/llm/schemas.cjs +69 -94
  167. package/dist/llm/schemas.d.ts +19 -158
  168. package/dist/llm/schemas.d.ts.map +1 -1
  169. package/dist/llm/schemas.js +67 -91
  170. package/dist/llm/services/factory.cjs +6 -7
  171. package/dist/llm/services/factory.d.ts +3 -4
  172. package/dist/llm/services/factory.d.ts.map +1 -1
  173. package/dist/llm/services/factory.js +6 -7
  174. package/dist/llm/services/vercel.cjs +11 -15
  175. package/dist/llm/services/vercel.d.ts +7 -7
  176. package/dist/llm/services/vercel.d.ts.map +1 -1
  177. package/dist/llm/services/vercel.js +11 -15
  178. package/dist/llm/types.cjs +1 -1
  179. package/dist/llm/types.d.ts +1 -1
  180. package/dist/llm/types.d.ts.map +1 -1
  181. package/dist/llm/types.js +1 -1
  182. package/dist/llm/validation.cjs +2 -2
  183. package/dist/llm/validation.d.ts +2 -2
  184. package/dist/llm/validation.d.ts.map +1 -1
  185. package/dist/llm/validation.js +1 -1
  186. package/dist/logger/browser.cjs +4 -4
  187. package/dist/logger/browser.d.ts +4 -4
  188. package/dist/logger/browser.d.ts.map +1 -1
  189. package/dist/logger/browser.js +3 -3
  190. package/dist/{context/compaction/providers/noop-provider.cjs → logger/default-logger-factory.cjs} +16 -22
  191. package/dist/logger/default-logger-factory.d.ts +301 -0
  192. package/dist/logger/default-logger-factory.d.ts.map +1 -0
  193. package/dist/logger/default-logger-factory.js +18 -0
  194. package/dist/logger/factory.d.ts +2 -2
  195. package/dist/logger/factory.d.ts.map +1 -1
  196. package/dist/logger/index.cjs +7 -2
  197. package/dist/logger/index.d.ts +5 -3
  198. package/dist/logger/index.d.ts.map +1 -1
  199. package/dist/logger/index.js +8 -2
  200. package/dist/logger/logger.cjs +4 -4
  201. package/dist/logger/logger.d.ts +4 -4
  202. package/dist/logger/logger.d.ts.map +1 -1
  203. package/dist/logger/logger.js +3 -3
  204. package/dist/logger/v2/dexto-logger.d.ts +3 -3
  205. package/dist/logger/v2/dexto-logger.d.ts.map +1 -1
  206. package/dist/logger/v2/schemas.d.ts +12 -12
  207. package/dist/logger/v2/test-utils.d.ts +5 -5
  208. package/dist/logger/v2/test-utils.d.ts.map +1 -1
  209. package/dist/logger/v2/transport-factory.d.ts +3 -3
  210. package/dist/logger/v2/transport-factory.d.ts.map +1 -1
  211. package/dist/logger/v2/transports/console-transport.d.ts +2 -2
  212. package/dist/logger/v2/transports/console-transport.d.ts.map +1 -1
  213. package/dist/logger/v2/transports/file-transport.d.ts +2 -2
  214. package/dist/logger/v2/transports/file-transport.d.ts.map +1 -1
  215. package/dist/logger/v2/transports/silent-transport.d.ts +2 -2
  216. package/dist/logger/v2/transports/silent-transport.d.ts.map +1 -1
  217. package/dist/logger/v2/types.cjs +1 -1
  218. package/dist/logger/v2/types.d.ts +8 -8
  219. package/dist/logger/v2/types.d.ts.map +1 -1
  220. package/dist/logger/v2/types.js +1 -1
  221. package/dist/mcp/errors.cjs +2 -2
  222. package/dist/mcp/errors.d.ts.map +1 -1
  223. package/dist/mcp/manager.cjs +16 -11
  224. package/dist/mcp/manager.d.ts +16 -13
  225. package/dist/mcp/manager.d.ts.map +1 -1
  226. package/dist/mcp/manager.js +17 -12
  227. package/dist/mcp/mcp-client.cjs +25 -20
  228. package/dist/mcp/mcp-client.d.ts +5 -5
  229. package/dist/mcp/mcp-client.d.ts.map +1 -1
  230. package/dist/mcp/mcp-client.js +20 -15
  231. package/dist/mcp/resolver.cjs +1 -1
  232. package/dist/mcp/schemas.cjs +5 -5
  233. package/dist/mcp/schemas.d.ts +4 -4
  234. package/dist/mcp/schemas.js +2 -2
  235. package/dist/mcp/types.d.ts +7 -7
  236. package/dist/mcp/types.d.ts.map +1 -1
  237. package/dist/memory/manager.d.ts +2 -2
  238. package/dist/memory/manager.d.ts.map +1 -1
  239. package/dist/memory/schemas.d.ts +2 -2
  240. package/dist/prompts/errors.cjs +3 -3
  241. package/dist/prompts/errors.d.ts.map +1 -1
  242. package/dist/prompts/prompt-manager.d.ts +3 -3
  243. package/dist/prompts/prompt-manager.d.ts.map +1 -1
  244. package/dist/prompts/providers/config-prompt-provider.cjs +15 -29
  245. package/dist/prompts/providers/config-prompt-provider.d.ts +3 -3
  246. package/dist/prompts/providers/config-prompt-provider.d.ts.map +1 -1
  247. package/dist/prompts/providers/config-prompt-provider.js +15 -29
  248. package/dist/prompts/providers/custom-prompt-provider.d.ts +2 -2
  249. package/dist/prompts/providers/custom-prompt-provider.d.ts.map +1 -1
  250. package/dist/prompts/providers/mcp-prompt-provider.d.ts +2 -2
  251. package/dist/prompts/providers/mcp-prompt-provider.d.ts.map +1 -1
  252. package/dist/prompts/schemas.d.ts +4 -4
  253. package/dist/resources/{internal-provider.cjs → agent-resources-provider.cjs} +16 -16
  254. package/dist/resources/{internal-provider.d.ts → agent-resources-provider.d.ts} +6 -6
  255. package/dist/resources/agent-resources-provider.d.ts.map +1 -0
  256. package/dist/resources/{internal-provider.js → agent-resources-provider.js} +13 -13
  257. package/dist/resources/errors.cjs +2 -2
  258. package/dist/resources/errors.d.ts.map +1 -1
  259. package/dist/resources/handlers/blob-handler.d.ts +2 -2
  260. package/dist/resources/handlers/blob-handler.d.ts.map +1 -1
  261. package/dist/resources/handlers/factory.d.ts +3 -3
  262. package/dist/resources/handlers/factory.d.ts.map +1 -1
  263. package/dist/resources/handlers/filesystem-handler.cjs +25 -0
  264. package/dist/resources/handlers/filesystem-handler.d.ts +3 -2
  265. package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
  266. package/dist/resources/handlers/filesystem-handler.js +25 -0
  267. package/dist/resources/index.cjs +7 -9
  268. package/dist/resources/index.d.ts +3 -3
  269. package/dist/resources/index.d.ts.map +1 -1
  270. package/dist/resources/index.js +5 -10
  271. package/dist/resources/manager.cjs +77 -74
  272. package/dist/resources/manager.d.ts +16 -7
  273. package/dist/resources/manager.d.ts.map +1 -1
  274. package/dist/resources/manager.js +77 -74
  275. package/dist/resources/schemas.cjs +6 -26
  276. package/dist/resources/schemas.d.ts +8 -100
  277. package/dist/resources/schemas.d.ts.map +1 -1
  278. package/dist/resources/schemas.js +4 -23
  279. package/dist/search/search-service.d.ts +2 -2
  280. package/dist/search/search-service.d.ts.map +1 -1
  281. package/dist/session/chat-session.cjs +16 -26
  282. package/dist/session/chat-session.d.ts +7 -5
  283. package/dist/session/chat-session.d.ts.map +1 -1
  284. package/dist/session/chat-session.js +17 -27
  285. package/dist/session/errors.cjs +2 -2
  286. package/dist/session/errors.d.ts.map +1 -1
  287. package/dist/session/history/database.cjs +1 -1
  288. package/dist/session/history/database.d.ts +4 -4
  289. package/dist/session/history/database.d.ts.map +1 -1
  290. package/dist/session/history/factory.d.ts +3 -3
  291. package/dist/session/history/factory.d.ts.map +1 -1
  292. package/dist/session/history/memory.d.ts +4 -4
  293. package/dist/session/history/memory.d.ts.map +1 -1
  294. package/dist/session/history/types.d.ts +2 -2
  295. package/dist/session/history/types.d.ts.map +1 -1
  296. package/dist/session/index.cjs +3 -0
  297. package/dist/session/index.d.ts +2 -0
  298. package/dist/session/index.d.ts.map +1 -1
  299. package/dist/session/index.js +2 -0
  300. package/dist/session/message-queue.cjs +29 -5
  301. package/dist/session/message-queue.d.ts +5 -3
  302. package/dist/session/message-queue.d.ts.map +1 -1
  303. package/dist/session/message-queue.js +29 -5
  304. package/dist/session/session-manager.cjs +107 -12
  305. package/dist/session/session-manager.d.ts +49 -8
  306. package/dist/session/session-manager.d.ts.map +1 -1
  307. package/dist/session/session-manager.js +97 -12
  308. package/dist/session/title-generator.cjs +2 -2
  309. package/dist/session/title-generator.d.ts +2 -2
  310. package/dist/session/title-generator.d.ts.map +1 -1
  311. package/dist/session/types.d.ts +1 -0
  312. package/dist/session/types.d.ts.map +1 -1
  313. package/dist/storage/blob/index.cjs +0 -40
  314. package/dist/storage/blob/index.d.ts +2 -44
  315. package/dist/storage/blob/index.d.ts.map +1 -1
  316. package/dist/storage/blob/index.js +0 -30
  317. package/dist/storage/cache/index.cjs +0 -37
  318. package/dist/storage/cache/index.d.ts +0 -42
  319. package/dist/storage/cache/index.d.ts.map +1 -1
  320. package/dist/storage/cache/index.js +0 -28
  321. package/dist/storage/database/index.cjs +0 -42
  322. package/dist/storage/database/index.d.ts +0 -43
  323. package/dist/storage/database/index.d.ts.map +1 -1
  324. package/dist/storage/database/index.js +0 -37
  325. package/dist/storage/error-codes.cjs +1 -6
  326. package/dist/storage/error-codes.d.ts +2 -7
  327. package/dist/storage/error-codes.d.ts.map +1 -1
  328. package/dist/storage/error-codes.js +1 -6
  329. package/dist/storage/errors.cjs +18 -82
  330. package/dist/storage/errors.d.ts +4 -24
  331. package/dist/storage/errors.d.ts.map +1 -1
  332. package/dist/storage/errors.js +16 -80
  333. package/dist/storage/index.cjs +8 -69
  334. package/dist/storage/index.d.ts +11 -66
  335. package/dist/storage/index.d.ts.map +1 -1
  336. package/dist/storage/index.js +6 -50
  337. package/dist/storage/storage-manager.cjs +9 -25
  338. package/dist/storage/storage-manager.d.ts +11 -15
  339. package/dist/storage/storage-manager.d.ts.map +1 -1
  340. package/dist/storage/storage-manager.js +8 -23
  341. package/dist/storage/types.d.ts +0 -1
  342. package/dist/storage/types.d.ts.map +1 -1
  343. package/dist/systemPrompt/contributors.d.ts +4 -4
  344. package/dist/systemPrompt/contributors.d.ts.map +1 -1
  345. package/dist/systemPrompt/errors.cjs +2 -2
  346. package/dist/systemPrompt/errors.d.ts.map +1 -1
  347. package/dist/systemPrompt/manager.cjs +1 -5
  348. package/dist/systemPrompt/manager.d.ts +2 -3
  349. package/dist/systemPrompt/manager.d.ts.map +1 -1
  350. package/dist/systemPrompt/manager.js +1 -5
  351. package/dist/telemetry/index.cjs +3 -0
  352. package/dist/telemetry/index.d.ts +2 -0
  353. package/dist/telemetry/index.d.ts.map +1 -1
  354. package/dist/telemetry/index.js +2 -0
  355. package/dist/telemetry/utils.d.ts +4 -4
  356. package/dist/telemetry/utils.d.ts.map +1 -1
  357. package/dist/test-utils/in-memory-storage.cjs +288 -0
  358. package/dist/test-utils/in-memory-storage.js +252 -0
  359. package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts +3 -3
  360. package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts.map +1 -1
  361. package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.ts +2 -2
  362. package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.ts.map +1 -1
  363. package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts +4 -4
  364. package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts.map +1 -1
  365. package/dist/tools/confirmation/allowed-tools-provider/types.d.ts +2 -2
  366. package/dist/tools/confirmation/allowed-tools-provider/types.d.ts.map +1 -1
  367. package/dist/tools/{internal-tools/constants.cjs → define-tool.cjs} +8 -13
  368. package/dist/tools/define-tool.d.ts +11 -0
  369. package/dist/tools/define-tool.d.ts.map +1 -0
  370. package/dist/tools/define-tool.js +7 -0
  371. package/dist/tools/error-codes.cjs +2 -2
  372. package/dist/tools/error-codes.d.ts +2 -2
  373. package/dist/tools/error-codes.d.ts.map +1 -1
  374. package/dist/tools/error-codes.js +2 -2
  375. package/dist/tools/errors.cjs +11 -23
  376. package/dist/tools/errors.d.ts +4 -10
  377. package/dist/tools/errors.d.ts.map +1 -1
  378. package/dist/tools/errors.js +9 -21
  379. package/dist/tools/index.cjs +3 -8
  380. package/dist/tools/index.d.ts +2 -4
  381. package/dist/tools/index.d.ts.map +1 -1
  382. package/dist/tools/index.js +2 -7
  383. package/dist/{storage/blob/providers/index.cjs → tools/pattern-utils.cjs} +11 -9
  384. package/dist/tools/pattern-utils.d.ts +20 -0
  385. package/dist/tools/pattern-utils.d.ts.map +1 -0
  386. package/dist/tools/pattern-utils.js +10 -0
  387. package/dist/tools/schemas.cjs +14 -40
  388. package/dist/tools/schemas.d.ts +6 -50
  389. package/dist/tools/schemas.d.ts.map +1 -1
  390. package/dist/tools/schemas.js +11 -32
  391. package/dist/tools/tool-call-metadata.cjs +75 -0
  392. package/dist/tools/tool-call-metadata.d.ts +16 -0
  393. package/dist/tools/tool-call-metadata.d.ts.map +1 -0
  394. package/dist/tools/tool-call-metadata.js +51 -0
  395. package/dist/tools/tool-manager.cjs +578 -302
  396. package/dist/tools/tool-manager.d.ts +105 -81
  397. package/dist/tools/tool-manager.d.ts.map +1 -1
  398. package/dist/tools/tool-manager.js +578 -306
  399. package/dist/tools/types.d.ts +112 -13
  400. package/dist/tools/types.d.ts.map +1 -1
  401. package/dist/utils/api-key-resolver.cjs +1 -1
  402. package/dist/utils/api-key-resolver.js +1 -1
  403. package/dist/utils/env.cjs +49 -0
  404. package/dist/utils/env.d.ts +4 -0
  405. package/dist/utils/env.d.ts.map +1 -0
  406. package/dist/utils/env.js +24 -0
  407. package/dist/utils/error-conversion.d.ts +2 -2
  408. package/dist/utils/error-conversion.d.ts.map +1 -1
  409. package/dist/utils/index.cjs +3 -1
  410. package/dist/utils/index.d.ts +1 -0
  411. package/dist/utils/index.d.ts.map +1 -1
  412. package/dist/utils/index.js +1 -0
  413. package/dist/utils/path.d.ts +2 -2
  414. package/dist/utils/path.d.ts.map +1 -1
  415. package/dist/utils/result.cjs +1 -1
  416. package/dist/utils/result.d.ts.map +1 -1
  417. package/dist/utils/schema.cjs +9 -5
  418. package/dist/utils/schema.d.ts +4 -2
  419. package/dist/utils/schema.d.ts.map +1 -1
  420. package/dist/utils/schema.js +9 -5
  421. package/dist/utils/service-initializer.cjs +58 -51
  422. package/dist/utils/service-initializer.d.ts +31 -9
  423. package/dist/utils/service-initializer.d.ts.map +1 -1
  424. package/dist/utils/service-initializer.js +58 -51
  425. package/dist/{storage/cache/providers/index.cjs → workspace/error-codes.cjs} +8 -9
  426. package/dist/workspace/error-codes.d.ts +5 -0
  427. package/dist/workspace/error-codes.d.ts.map +1 -0
  428. package/dist/workspace/error-codes.js +7 -0
  429. package/dist/{storage/blob/factory.cjs → workspace/errors.cjs} +20 -14
  430. package/dist/workspace/errors.d.ts +5 -0
  431. package/dist/workspace/errors.d.ts.map +1 -0
  432. package/dist/workspace/errors.js +21 -0
  433. package/dist/{image → workspace}/index.cjs +12 -10
  434. package/dist/workspace/index.d.ts +5 -0
  435. package/dist/workspace/index.d.ts.map +1 -0
  436. package/dist/workspace/index.js +9 -0
  437. package/dist/workspace/manager.cjs +113 -0
  438. package/dist/workspace/manager.d.ts +18 -0
  439. package/dist/workspace/manager.d.ts.map +1 -0
  440. package/dist/workspace/manager.js +90 -0
  441. package/dist/workspace/types.d.ts +14 -0
  442. package/dist/workspace/types.d.ts.map +1 -0
  443. package/package.json +7 -3
  444. package/dist/context/compaction/factory.cjs +0 -57
  445. package/dist/context/compaction/factory.d.ts +0 -17
  446. package/dist/context/compaction/factory.d.ts.map +0 -1
  447. package/dist/context/compaction/factory.js +0 -34
  448. package/dist/context/compaction/provider.d.ts +0 -48
  449. package/dist/context/compaction/provider.d.ts.map +0 -1
  450. package/dist/context/compaction/providers/noop-provider.d.ts +0 -24
  451. package/dist/context/compaction/providers/noop-provider.d.ts.map +0 -1
  452. package/dist/context/compaction/providers/noop-provider.js +0 -24
  453. package/dist/context/compaction/providers/reactive-overflow-provider.cjs +0 -76
  454. package/dist/context/compaction/providers/reactive-overflow-provider.d.ts +0 -51
  455. package/dist/context/compaction/providers/reactive-overflow-provider.d.ts.map +0 -1
  456. package/dist/context/compaction/providers/reactive-overflow-provider.js +0 -52
  457. package/dist/context/compaction/registry.cjs +0 -39
  458. package/dist/context/compaction/registry.d.ts +0 -19
  459. package/dist/context/compaction/registry.d.ts.map +0 -1
  460. package/dist/context/compaction/registry.js +0 -16
  461. package/dist/context/compaction/schemas.cjs +0 -58
  462. package/dist/context/compaction/schemas.d.ts +0 -69
  463. package/dist/context/compaction/schemas.d.ts.map +0 -1
  464. package/dist/context/compaction/schemas.js +0 -34
  465. package/dist/context/compaction/strategies/reactive-overflow.d.ts.map +0 -1
  466. package/dist/image/define-image.cjs +0 -146
  467. package/dist/image/define-image.d.ts +0 -71
  468. package/dist/image/define-image.d.ts.map +0 -1
  469. package/dist/image/define-image.js +0 -121
  470. package/dist/image/index.d.ts +0 -53
  471. package/dist/image/index.d.ts.map +0 -1
  472. package/dist/image/index.js +0 -7
  473. package/dist/image/types.d.ts +0 -246
  474. package/dist/image/types.d.ts.map +0 -1
  475. package/dist/llm/registry.cjs +0 -2075
  476. package/dist/llm/registry.d.ts.map +0 -1
  477. package/dist/llm/registry.js +0 -2025
  478. package/dist/llm/services/test-utils.integration.cjs +0 -237
  479. package/dist/llm/services/test-utils.integration.d.ts +0 -48
  480. package/dist/llm/services/test-utils.integration.d.ts.map +0 -1
  481. package/dist/llm/services/test-utils.integration.js +0 -214
  482. package/dist/plugins/builtins/content-policy.d.ts +0 -26
  483. package/dist/plugins/builtins/content-policy.d.ts.map +0 -1
  484. package/dist/plugins/builtins/response-sanitizer.d.ts +0 -25
  485. package/dist/plugins/builtins/response-sanitizer.d.ts.map +0 -1
  486. package/dist/plugins/error-codes.cjs +0 -43
  487. package/dist/plugins/error-codes.d.ts +0 -34
  488. package/dist/plugins/error-codes.d.ts.map +0 -1
  489. package/dist/plugins/error-codes.js +0 -20
  490. package/dist/plugins/index.cjs +0 -61
  491. package/dist/plugins/index.d.ts +0 -21
  492. package/dist/plugins/index.d.ts.map +0 -1
  493. package/dist/plugins/index.js +0 -30
  494. package/dist/plugins/loader.cjs +0 -171
  495. package/dist/plugins/loader.d.ts +0 -30
  496. package/dist/plugins/loader.d.ts.map +0 -1
  497. package/dist/plugins/loader.js +0 -145
  498. package/dist/plugins/manager.cjs +0 -473
  499. package/dist/plugins/manager.d.ts +0 -106
  500. package/dist/plugins/manager.d.ts.map +0 -1
  501. package/dist/plugins/manager.js +0 -450
  502. package/dist/plugins/registrations/builtins.cjs +0 -51
  503. package/dist/plugins/registrations/builtins.d.ts +0 -17
  504. package/dist/plugins/registrations/builtins.d.ts.map +0 -1
  505. package/dist/plugins/registrations/builtins.js +0 -28
  506. package/dist/plugins/registry.cjs +0 -63
  507. package/dist/plugins/registry.d.ts +0 -101
  508. package/dist/plugins/registry.d.ts.map +0 -1
  509. package/dist/plugins/registry.js +0 -39
  510. package/dist/plugins/schemas.cjs +0 -73
  511. package/dist/plugins/schemas.d.ts +0 -195
  512. package/dist/plugins/schemas.d.ts.map +0 -1
  513. package/dist/plugins/schemas.js +0 -47
  514. package/dist/plugins/types.d.ts.map +0 -1
  515. package/dist/providers/base-registry.cjs +0 -147
  516. package/dist/providers/base-registry.d.ts +0 -147
  517. package/dist/providers/base-registry.d.ts.map +0 -1
  518. package/dist/providers/base-registry.js +0 -123
  519. package/dist/providers/discovery.cjs +0 -109
  520. package/dist/providers/discovery.d.ts +0 -96
  521. package/dist/providers/discovery.d.ts.map +0 -1
  522. package/dist/providers/discovery.js +0 -84
  523. package/dist/providers/index.cjs +0 -24
  524. package/dist/providers/index.d.ts +0 -32
  525. package/dist/providers/index.d.ts.map +0 -1
  526. package/dist/providers/index.js +0 -2
  527. package/dist/resources/internal-provider.d.ts.map +0 -1
  528. package/dist/storage/blob/factory.d.ts +0 -37
  529. package/dist/storage/blob/factory.d.ts.map +0 -1
  530. package/dist/storage/blob/factory.js +0 -15
  531. package/dist/storage/blob/local-blob-store.cjs +0 -496
  532. package/dist/storage/blob/local-blob-store.d.ts +0 -58
  533. package/dist/storage/blob/local-blob-store.d.ts.map +0 -1
  534. package/dist/storage/blob/local-blob-store.js +0 -463
  535. package/dist/storage/blob/memory-blob-store.cjs +0 -326
  536. package/dist/storage/blob/memory-blob-store.d.ts +0 -66
  537. package/dist/storage/blob/memory-blob-store.d.ts.map +0 -1
  538. package/dist/storage/blob/memory-blob-store.js +0 -303
  539. package/dist/storage/blob/provider.d.ts +0 -50
  540. package/dist/storage/blob/provider.d.ts.map +0 -1
  541. package/dist/storage/blob/providers/index.d.ts +0 -8
  542. package/dist/storage/blob/providers/index.d.ts.map +0 -1
  543. package/dist/storage/blob/providers/index.js +0 -7
  544. package/dist/storage/blob/providers/local.cjs +0 -39
  545. package/dist/storage/blob/providers/local.d.ts +0 -17
  546. package/dist/storage/blob/providers/local.d.ts.map +0 -1
  547. package/dist/storage/blob/providers/local.js +0 -16
  548. package/dist/storage/blob/providers/memory.cjs +0 -39
  549. package/dist/storage/blob/providers/memory.d.ts +0 -17
  550. package/dist/storage/blob/providers/memory.d.ts.map +0 -1
  551. package/dist/storage/blob/providers/memory.js +0 -16
  552. package/dist/storage/blob/registry.cjs +0 -50
  553. package/dist/storage/blob/registry.d.ts +0 -42
  554. package/dist/storage/blob/registry.d.ts.map +0 -1
  555. package/dist/storage/blob/registry.js +0 -26
  556. package/dist/storage/blob/schemas.cjs +0 -52
  557. package/dist/storage/blob/schemas.d.ts +0 -85
  558. package/dist/storage/blob/schemas.d.ts.map +0 -1
  559. package/dist/storage/blob/schemas.js +0 -26
  560. package/dist/storage/cache/factory.cjs +0 -38
  561. package/dist/storage/cache/factory.d.ts +0 -37
  562. package/dist/storage/cache/factory.d.ts.map +0 -1
  563. package/dist/storage/cache/factory.js +0 -15
  564. package/dist/storage/cache/memory-cache-store.cjs +0 -107
  565. package/dist/storage/cache/memory-cache-store.d.ts +0 -26
  566. package/dist/storage/cache/memory-cache-store.d.ts.map +0 -1
  567. package/dist/storage/cache/memory-cache-store.js +0 -84
  568. package/dist/storage/cache/provider.cjs +0 -16
  569. package/dist/storage/cache/provider.d.ts +0 -56
  570. package/dist/storage/cache/provider.d.ts.map +0 -1
  571. package/dist/storage/cache/provider.js +0 -0
  572. package/dist/storage/cache/providers/index.d.ts +0 -8
  573. package/dist/storage/cache/providers/index.d.ts.map +0 -1
  574. package/dist/storage/cache/providers/index.js +0 -7
  575. package/dist/storage/cache/providers/memory.d.ts +0 -17
  576. package/dist/storage/cache/providers/memory.d.ts.map +0 -1
  577. package/dist/storage/cache/providers/memory.js +0 -17
  578. package/dist/storage/cache/providers/redis.cjs +0 -66
  579. package/dist/storage/cache/providers/redis.d.ts +0 -20
  580. package/dist/storage/cache/providers/redis.d.ts.map +0 -1
  581. package/dist/storage/cache/providers/redis.js +0 -33
  582. package/dist/storage/cache/redis-store.cjs +0 -173
  583. package/dist/storage/cache/redis-store.d.ts +0 -32
  584. package/dist/storage/cache/redis-store.d.ts.map +0 -1
  585. package/dist/storage/cache/redis-store.js +0 -150
  586. package/dist/storage/cache/registry.cjs +0 -50
  587. package/dist/storage/cache/registry.d.ts +0 -42
  588. package/dist/storage/cache/registry.d.ts.map +0 -1
  589. package/dist/storage/cache/registry.js +0 -26
  590. package/dist/storage/cache/schemas.cjs +0 -81
  591. package/dist/storage/cache/schemas.d.ts +0 -150
  592. package/dist/storage/cache/schemas.d.ts.map +0 -1
  593. package/dist/storage/cache/schemas.js +0 -55
  594. package/dist/storage/database/factory.cjs +0 -38
  595. package/dist/storage/database/factory.d.ts +0 -39
  596. package/dist/storage/database/factory.d.ts.map +0 -1
  597. package/dist/storage/database/factory.js +0 -15
  598. package/dist/storage/database/memory-database-store.cjs +0 -122
  599. package/dist/storage/database/memory-database-store.d.ts +0 -29
  600. package/dist/storage/database/memory-database-store.d.ts.map +0 -1
  601. package/dist/storage/database/memory-database-store.js +0 -99
  602. package/dist/storage/database/postgres-store.cjs +0 -342
  603. package/dist/storage/database/postgres-store.d.ts +0 -55
  604. package/dist/storage/database/postgres-store.d.ts.map +0 -1
  605. package/dist/storage/database/postgres-store.js +0 -319
  606. package/dist/storage/database/provider.cjs +0 -16
  607. package/dist/storage/database/provider.d.ts +0 -56
  608. package/dist/storage/database/provider.d.ts.map +0 -1
  609. package/dist/storage/database/provider.js +0 -0
  610. package/dist/storage/database/providers/index.d.ts +0 -9
  611. package/dist/storage/database/providers/index.d.ts.map +0 -1
  612. package/dist/storage/database/providers/index.js +0 -9
  613. package/dist/storage/database/providers/memory.cjs +0 -40
  614. package/dist/storage/database/providers/memory.d.ts +0 -16
  615. package/dist/storage/database/providers/memory.d.ts.map +0 -1
  616. package/dist/storage/database/providers/memory.js +0 -17
  617. package/dist/storage/database/providers/postgres.cjs +0 -62
  618. package/dist/storage/database/providers/postgres.d.ts +0 -19
  619. package/dist/storage/database/providers/postgres.d.ts.map +0 -1
  620. package/dist/storage/database/providers/postgres.js +0 -29
  621. package/dist/storage/database/providers/sqlite.cjs +0 -66
  622. package/dist/storage/database/providers/sqlite.d.ts +0 -20
  623. package/dist/storage/database/providers/sqlite.d.ts.map +0 -1
  624. package/dist/storage/database/providers/sqlite.js +0 -33
  625. package/dist/storage/database/registry.cjs +0 -50
  626. package/dist/storage/database/registry.d.ts +0 -42
  627. package/dist/storage/database/registry.d.ts.map +0 -1
  628. package/dist/storage/database/registry.js +0 -26
  629. package/dist/storage/database/schemas.cjs +0 -97
  630. package/dist/storage/database/schemas.d.ts +0 -226
  631. package/dist/storage/database/schemas.d.ts.map +0 -1
  632. package/dist/storage/database/schemas.js +0 -70
  633. package/dist/storage/database/sqlite-store.cjs +0 -270
  634. package/dist/storage/database/sqlite-store.d.ts +0 -33
  635. package/dist/storage/database/sqlite-store.d.ts.map +0 -1
  636. package/dist/storage/database/sqlite-store.js +0 -237
  637. package/dist/storage/schemas.cjs +0 -57
  638. package/dist/storage/schemas.d.ts +0 -347
  639. package/dist/storage/schemas.d.ts.map +0 -1
  640. package/dist/storage/schemas.js +0 -37
  641. package/dist/tools/bash-pattern-utils.cjs +0 -91
  642. package/dist/tools/bash-pattern-utils.d.ts +0 -58
  643. package/dist/tools/bash-pattern-utils.d.ts.map +0 -1
  644. package/dist/tools/bash-pattern-utils.js +0 -64
  645. package/dist/tools/custom-tool-registry.cjs +0 -64
  646. package/dist/tools/custom-tool-registry.d.ts +0 -126
  647. package/dist/tools/custom-tool-registry.d.ts.map +0 -1
  648. package/dist/tools/custom-tool-registry.js +0 -40
  649. package/dist/tools/custom-tool-schema-registry.cjs +0 -164
  650. package/dist/tools/custom-tool-schema-registry.d.ts +0 -86
  651. package/dist/tools/custom-tool-schema-registry.d.ts.map +0 -1
  652. package/dist/tools/custom-tool-schema-registry.js +0 -140
  653. package/dist/tools/internal-tools/constants.d.ts +0 -12
  654. package/dist/tools/internal-tools/constants.d.ts.map +0 -1
  655. package/dist/tools/internal-tools/constants.js +0 -12
  656. package/dist/tools/internal-tools/implementations/ask-user-tool.cjs +0 -57
  657. package/dist/tools/internal-tools/implementations/ask-user-tool.d.ts +0 -18
  658. package/dist/tools/internal-tools/implementations/ask-user-tool.d.ts.map +0 -1
  659. package/dist/tools/internal-tools/implementations/ask-user-tool.js +0 -34
  660. package/dist/tools/internal-tools/implementations/delegate-to-url-tool.cjs +0 -192
  661. package/dist/tools/internal-tools/implementations/delegate-to-url-tool.d.ts +0 -33
  662. package/dist/tools/internal-tools/implementations/delegate-to-url-tool.d.ts.map +0 -1
  663. package/dist/tools/internal-tools/implementations/delegate-to-url-tool.js +0 -169
  664. package/dist/tools/internal-tools/implementations/get-resource-tool.cjs +0 -113
  665. package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts +0 -30
  666. package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts.map +0 -1
  667. package/dist/tools/internal-tools/implementations/get-resource-tool.js +0 -90
  668. package/dist/tools/internal-tools/implementations/invoke-skill-tool.cjs +0 -140
  669. package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts +0 -24
  670. package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts.map +0 -1
  671. package/dist/tools/internal-tools/implementations/invoke-skill-tool.js +0 -117
  672. package/dist/tools/internal-tools/implementations/list-resources-tool.cjs +0 -91
  673. package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts +0 -24
  674. package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts.map +0 -1
  675. package/dist/tools/internal-tools/implementations/list-resources-tool.js +0 -68
  676. package/dist/tools/internal-tools/implementations/search-history-tool.cjs +0 -61
  677. package/dist/tools/internal-tools/implementations/search-history-tool.d.ts +0 -7
  678. package/dist/tools/internal-tools/implementations/search-history-tool.d.ts.map +0 -1
  679. package/dist/tools/internal-tools/implementations/search-history-tool.js +0 -38
  680. package/dist/tools/internal-tools/index.cjs +0 -26
  681. package/dist/tools/internal-tools/index.d.ts +0 -4
  682. package/dist/tools/internal-tools/index.d.ts.map +0 -1
  683. package/dist/tools/internal-tools/index.js +0 -3
  684. package/dist/tools/internal-tools/provider.cjs +0 -324
  685. package/dist/tools/internal-tools/provider.d.ts +0 -114
  686. package/dist/tools/internal-tools/provider.d.ts.map +0 -1
  687. package/dist/tools/internal-tools/provider.js +0 -301
  688. package/dist/tools/internal-tools/registry.cjs +0 -71
  689. package/dist/tools/internal-tools/registry.d.ts +0 -91
  690. package/dist/tools/internal-tools/registry.d.ts.map +0 -1
  691. package/dist/tools/internal-tools/registry.js +0 -47
  692. /package/dist/{context/compaction/provider.js → agent/agent-options.js} +0 -0
  693. /package/dist/{image/types.js → agent/runtime-config.js} +0 -0
  694. /package/dist/{image → hooks}/types.cjs +0 -0
  695. /package/dist/{plugins → hooks}/types.js +0 -0
  696. /package/dist/{plugins → workspace}/types.cjs +0 -0
  697. /package/dist/{storage/blob/provider.js → workspace/types.js} +0 -0
@@ -9,13 +9,11 @@ import { setMaxListeners } from "events";
9
9
  import { SkillsContributor } from "../systemPrompt/contributors.js";
10
10
  import { expandMessageReferences } from "../resources/index.js";
11
11
  import { expandBlobReferences } from "../context/utils.js";
12
+ import { StorageManager } from "../storage/index.js";
12
13
  import { PromptManager } from "../prompts/index.js";
13
14
  import { SessionError } from "../session/index.js";
14
- import { createLogger } from "../logger/factory.js";
15
- import { DextoLogComponent } from "../logger/v2/types.js";
16
15
  import { InstrumentClass } from "../telemetry/decorators.js";
17
16
  import { trace, context, propagation } from "@opentelemetry/api";
18
- import { LLMUpdatesSchema } from "../llm/schemas.js";
19
17
  import { resolveAndValidateLLMConfig } from "../llm/resolver.js";
20
18
  import { validateInputForLLM } from "../llm/validation.js";
21
19
  import { LLMError } from "../llm/errors.js";
@@ -32,9 +30,18 @@ import {
32
30
  getDefaultModelForProvider,
33
31
  getProviderFromModel,
34
32
  getAllModelsForProvider
35
- } from "../llm/registry.js";
33
+ } from "../llm/registry/index.js";
36
34
  import { createAgentServices } from "../utils/service-initializer.js";
37
- import { AgentConfigSchema, createAgentConfigSchema } from "./schemas.js";
35
+ import { LLMConfigSchema, LLMUpdatesSchema } from "../llm/schemas.js";
36
+ import { ServersConfigSchema } from "../mcp/schemas.js";
37
+ import { MemoriesConfigSchema } from "../memory/schemas.js";
38
+ import { PromptsSchema } from "../prompts/schemas.js";
39
+ import { ResourcesConfigSchema } from "../resources/schemas.js";
40
+ import { SessionConfigSchema } from "../session/schemas.js";
41
+ import { SystemPromptConfigSchema } from "../systemPrompt/schemas.js";
42
+ import { ElicitationConfigSchema, PermissionsConfigSchema } from "../tools/schemas.js";
43
+ import { OtelConfigurationSchema } from "../telemetry/schemas.js";
44
+ import { AgentCardSchema } from "./schemas.js";
38
45
  import {
39
46
  AgentEventBus
40
47
  } from "../events/index.js";
@@ -47,6 +54,7 @@ const requiredServices = [
47
54
  "agentEventBus",
48
55
  "stateManager",
49
56
  "sessionManager",
57
+ "workspaceManager",
50
58
  "searchService",
51
59
  "memoryManager"
52
60
  ];
@@ -58,44 +66,14 @@ _DextoAgent_decorators = [InstrumentClass({
58
66
  "getConfig",
59
67
  "getEffectiveConfig",
60
68
  "registerSubscriber",
69
+ "on",
70
+ "once",
71
+ "off",
72
+ "emit",
61
73
  "ensureStarted"
62
74
  ]
63
75
  })];
64
- class DextoAgent {
65
- /**
66
- * Creates a DextoAgent instance.
67
- *
68
- * @param config - Agent configuration (validated and enriched)
69
- * @param configPath - Optional path to config file (for relative path resolution)
70
- * @param options - Validation options
71
- * @param options.strict - When true (default), enforces API key and baseURL requirements.
72
- * When false, allows missing credentials for interactive configuration.
73
- */
74
- constructor(config, configPath, options) {
75
- this.configPath = configPath;
76
- const schema = options?.strict === false ? createAgentConfigSchema({ strict: false }) : AgentConfigSchema;
77
- this.config = schema.parse(config);
78
- this.logger = createLogger({
79
- config: this.config.logger,
80
- agentId: this.config.agentId,
81
- component: DextoLogComponent.AGENT
82
- });
83
- const serviceOverrides = {};
84
- if (options?.sessionLoggerFactory) {
85
- serviceOverrides.sessionLoggerFactory = options.sessionLoggerFactory;
86
- }
87
- if (options && "mcpAuthProviderFactory" in options) {
88
- serviceOverrides.mcpAuthProviderFactory = options.mcpAuthProviderFactory ?? null;
89
- }
90
- if (Object.keys(serviceOverrides).length > 0) {
91
- this.serviceOverrides = serviceOverrides;
92
- }
93
- if (options?.mcpAuthProviderFactory) {
94
- this.mcpAuthProviderFactory = options.mcpAuthProviderFactory;
95
- }
96
- this.agentEventBus = new AgentEventBus();
97
- this.logger.info("DextoAgent created.");
98
- }
76
+ let _DextoAgent = class _DextoAgent {
99
77
  /**
100
78
  * These services are public for use by the outside world
101
79
  * This gives users the option to use methods of the services directly if they know what they are doing
@@ -107,6 +85,7 @@ class DextoAgent {
107
85
  promptManager;
108
86
  stateManager;
109
87
  sessionManager;
88
+ workspaceManager;
110
89
  toolManager;
111
90
  resourceManager;
112
91
  memoryManager;
@@ -129,9 +108,87 @@ class DextoAgent {
129
108
  // Active stream controllers per session - allows cancel() to abort iterators
130
109
  activeStreamControllers = /* @__PURE__ */ new Map();
131
110
  // Host overrides for service initialization (e.g. session logger factory)
132
- serviceOverrides;
111
+ overrides;
112
+ // DI-provided local tools.
113
+ tools;
114
+ compactionStrategy;
133
115
  // Logger instance for this agent (dependency injection)
134
116
  logger;
117
+ /**
118
+ * Validate + normalize runtime settings.
119
+ *
120
+ * This is the single validation boundary for programmatic (code-first) construction.
121
+ * Host layers may validate earlier (e.g. YAML parsing), but core always normalizes
122
+ * runtime settings before use.
123
+ */
124
+ static validateConfig(options) {
125
+ return {
126
+ agentId: options.agentId,
127
+ llm: LLMConfigSchema.parse(options.llm),
128
+ systemPrompt: SystemPromptConfigSchema.parse(options.systemPrompt),
129
+ mcpServers: ServersConfigSchema.parse(options.mcpServers ?? {}),
130
+ sessions: SessionConfigSchema.parse(options.sessions ?? {}),
131
+ permissions: PermissionsConfigSchema.parse(options.permissions ?? {}),
132
+ elicitation: ElicitationConfigSchema.parse(options.elicitation ?? {}),
133
+ resources: ResourcesConfigSchema.parse(options.resources ?? []),
134
+ prompts: PromptsSchema.parse(options.prompts),
135
+ ...options.agentCard !== void 0 && {
136
+ agentCard: AgentCardSchema.parse(options.agentCard)
137
+ },
138
+ ...options.greeting !== void 0 && { greeting: options.greeting },
139
+ ...options.telemetry !== void 0 && {
140
+ telemetry: OtelConfigurationSchema.parse(options.telemetry)
141
+ },
142
+ ...options.memories !== void 0 && {
143
+ memories: MemoriesConfigSchema.parse(options.memories)
144
+ }
145
+ };
146
+ }
147
+ /**
148
+ * Creates a DextoAgent instance.
149
+ *
150
+ * Constructor options are DI-first:
151
+ * - runtime settings (validated + defaulted by core)
152
+ * - concrete services (logger/tools/hooks/storage backends)
153
+ * - optional internal service overrides (session logging, auth factories, etc.)
154
+ */
155
+ constructor(options) {
156
+ const {
157
+ logger,
158
+ storage,
159
+ tools: toolsInput,
160
+ hooks: hooksInput,
161
+ compaction,
162
+ overrides: overridesInput,
163
+ ...runtimeSettings
164
+ } = options;
165
+ const tools = toolsInput ?? [];
166
+ const hooks = hooksInput ?? [];
167
+ this.config = _DextoAgent.validateConfig(runtimeSettings);
168
+ this.logger = logger;
169
+ this.tools = tools;
170
+ this.compactionStrategy = compaction ?? null;
171
+ const overrides = { ...overridesInput ?? {} };
172
+ if (overrides.storageManager === void 0) {
173
+ overrides.storageManager = new StorageManager(
174
+ {
175
+ cache: storage.cache,
176
+ database: storage.database,
177
+ blobStore: storage.blob
178
+ },
179
+ this.logger
180
+ );
181
+ }
182
+ if (overrides.hooks === void 0) {
183
+ overrides.hooks = hooks;
184
+ }
185
+ this.overrides = overrides;
186
+ if (overrides.mcpAuthProviderFactory !== void 0) {
187
+ this.mcpAuthProviderFactory = overrides.mcpAuthProviderFactory;
188
+ }
189
+ this.agentEventBus = new AgentEventBus();
190
+ this.logger.info("DextoAgent created.");
191
+ }
135
192
  /**
136
193
  * Starts the agent by initializing all async services.
137
194
  * This method handles storage backends, MCP connections, session manager initialization, and other async operations.
@@ -147,10 +204,10 @@ class DextoAgent {
147
204
  this.logger.info("Starting DextoAgent...");
148
205
  const services = await createAgentServices(
149
206
  this.config,
150
- this.configPath,
151
207
  this.logger,
152
208
  this.agentEventBus,
153
- this.serviceOverrides
209
+ this.overrides,
210
+ this.compactionStrategy
154
211
  );
155
212
  if (this.mcpAuthProviderFactory) {
156
213
  services.mcpManager.setAuthProviderFactory(this.mcpAuthProviderFactory);
@@ -162,11 +219,11 @@ class DextoAgent {
162
219
  );
163
220
  }
164
221
  }
165
- const needsHandler = this.config.toolConfirmation.mode === "manual" || this.config.elicitation.enabled;
222
+ const needsHandler = this.config.permissions.mode === "manual" || this.config.elicitation.enabled;
166
223
  if (needsHandler && !this.approvalHandler) {
167
224
  const reasons = [];
168
- if (this.config.toolConfirmation.mode === "manual") {
169
- reasons.push('tool confirmation mode is "manual"');
225
+ if (this.config.permissions.mode === "manual") {
226
+ reasons.push('permissions mode is "manual"');
170
227
  }
171
228
  if (this.config.elicitation.enabled) {
172
229
  reasons.push("elicitation is enabled");
@@ -175,7 +232,7 @@ class DextoAgent {
175
232
  `An approval handler is required but not configured (${reasons.join(" and ")}).
176
233
  Either:
177
234
  \u2022 Call agent.setApprovalHandler() before starting
178
- \u2022 Set toolConfirmation: { mode: "auto-approve" } or { mode: "auto-deny" }
235
+ \u2022 Set permissions: { mode: "auto-approve" } or { mode: "auto-deny" }
179
236
  \u2022 Disable elicitation: { enabled: false }`
180
237
  );
181
238
  }
@@ -189,6 +246,7 @@ Either:
189
246
  systemPromptManager: services.systemPromptManager,
190
247
  stateManager: services.stateManager,
191
248
  sessionManager: services.sessionManager,
249
+ workspaceManager: services.workspaceManager,
192
250
  memoryManager: services.memoryManager,
193
251
  services
194
252
  });
@@ -202,9 +260,27 @@ Either:
202
260
  );
203
261
  await promptManager.initialize();
204
262
  Object.assign(this, { promptManager });
205
- services.toolManager.setAgent(this);
206
- services.toolManager.setPromptManager(promptManager);
207
- if (this.config.internalTools?.includes("invoke_skill")) {
263
+ const toolExecutionStorage = {
264
+ blob: services.storageManager.getBlobStore(),
265
+ database: services.storageManager.getDatabase(),
266
+ cache: services.storageManager.getCache()
267
+ };
268
+ const toolExecutionServices = {
269
+ approval: services.approvalManager,
270
+ search: services.searchService,
271
+ resources: services.resourceManager,
272
+ prompts: promptManager,
273
+ mcp: services.mcpManager,
274
+ taskForker: null
275
+ };
276
+ services.toolManager.setToolExecutionContextFactory((baseContext) => ({
277
+ ...baseContext,
278
+ agent: this,
279
+ storage: toolExecutionStorage,
280
+ services: toolExecutionServices
281
+ }));
282
+ const agentTools = this.tools;
283
+ if (agentTools.some((t) => t.id === "invoke_skill")) {
208
284
  const skillsContributor = new SkillsContributor(
209
285
  "skills",
210
286
  50,
@@ -215,6 +291,7 @@ Either:
215
291
  services.systemPromptManager.addContributor(skillsContributor);
216
292
  this.logger.debug("Added SkillsContributor to system prompt");
217
293
  }
294
+ services.toolManager.setTools(agentTools);
218
295
  await services.toolManager.initialize();
219
296
  this.searchService = services.searchService;
220
297
  this._isStarted = true;
@@ -258,13 +335,22 @@ Either:
258
335
  shutdownErrors.push(new Error(`SessionManager cleanup failed: ${err.message}`));
259
336
  }
260
337
  try {
261
- if (this.services?.pluginManager) {
262
- await this.services.pluginManager.cleanup();
263
- this.logger.debug("PluginManager cleaned up successfully");
338
+ if (this.toolManager) {
339
+ await this.toolManager.cleanup();
340
+ this.logger.debug("ToolManager cleaned up successfully");
341
+ }
342
+ } catch (error) {
343
+ const err = error instanceof Error ? error : new Error(String(error));
344
+ shutdownErrors.push(new Error(`ToolManager cleanup failed: ${err.message}`));
345
+ }
346
+ try {
347
+ if (this.services?.hookManager) {
348
+ await this.services.hookManager.cleanup();
349
+ this.logger.debug("HookManager cleaned up successfully");
264
350
  }
265
351
  } catch (error) {
266
352
  const err = error instanceof Error ? error : new Error(String(error));
267
- shutdownErrors.push(new Error(`PluginManager cleanup failed: ${err.message}`));
353
+ shutdownErrors.push(new Error(`HookManager cleanup failed: ${err.message}`));
268
354
  }
269
355
  try {
270
356
  if (this.mcpManager) {
@@ -275,6 +361,15 @@ Either:
275
361
  const err = error instanceof Error ? error : new Error(String(error));
276
362
  shutdownErrors.push(new Error(`MCPManager disconnect failed: ${err.message}`));
277
363
  }
364
+ try {
365
+ if (this.resourceManager) {
366
+ this.resourceManager.cleanup();
367
+ this.logger.debug("ResourceManager cleaned up successfully");
368
+ }
369
+ } catch (error) {
370
+ const err = error instanceof Error ? error : new Error(String(error));
371
+ shutdownErrors.push(new Error(`ResourceManager cleanup failed: ${err.message}`));
372
+ }
278
373
  try {
279
374
  if (this.services?.storageManager) {
280
375
  await this.services.storageManager.disconnect();
@@ -292,6 +387,7 @@ Either:
292
387
  } else {
293
388
  this.logger.info("DextoAgent stopped successfully.");
294
389
  }
390
+ this.agentEventBus.emit("agent:stopped");
295
391
  } catch (error) {
296
392
  this.logger.error("Failed to stop DextoAgent", {
297
393
  error: error instanceof Error ? error.message : String(error)
@@ -312,6 +408,26 @@ Either:
312
408
  subscriber.subscribe(this.agentEventBus);
313
409
  }
314
410
  }
411
+ /**
412
+ * Convenience event subscription APIs (typed delegates to {@link AgentEventBus}).
413
+ *
414
+ * Prefer these over reaching into the internal event bus directly.
415
+ */
416
+ on(event, listener, options) {
417
+ this.agentEventBus.on(event, listener, options);
418
+ return this;
419
+ }
420
+ once(event, listener, options) {
421
+ this.agentEventBus.once(event, listener, options);
422
+ return this;
423
+ }
424
+ off(event, listener) {
425
+ this.agentEventBus.off(event, listener);
426
+ return this;
427
+ }
428
+ emit(event, ...args) {
429
+ return this.agentEventBus.emit(event, ...args);
430
+ }
315
431
  /**
316
432
  * Restart the agent by stopping and starting it.
317
433
  * Automatically re-subscribes all registered event subscribers to the new event bus.
@@ -564,6 +680,14 @@ Either:
564
680
  };
565
681
  this.agentEventBus.on("llm:tool-call", toolCallListener, { signal: cleanupSignal });
566
682
  listeners.push({ event: "llm:tool-call", listener: toolCallListener });
683
+ const toolCallPartialListener = (data) => {
684
+ if (data.sessionId !== sessionId) return;
685
+ eventQueue.push({ name: "llm:tool-call-partial", ...data });
686
+ };
687
+ this.agentEventBus.on("llm:tool-call-partial", toolCallPartialListener, {
688
+ signal: cleanupSignal
689
+ });
690
+ listeners.push({ event: "llm:tool-call-partial", listener: toolCallPartialListener });
567
691
  const toolResultListener = (data) => {
568
692
  if (data.sessionId !== sessionId) return;
569
693
  eventQueue.push({ name: "llm:tool-result", ...data });
@@ -941,6 +1065,36 @@ Either:
941
1065
  }
942
1066
  return !!streamController;
943
1067
  }
1068
+ // ============= WORKSPACE MANAGEMENT =============
1069
+ /**
1070
+ * Sets the active workspace for this runtime.
1071
+ * The workspace context is persisted and emitted via the agent event bus.
1072
+ */
1073
+ async setWorkspace(input) {
1074
+ this.ensureStarted();
1075
+ return await this.workspaceManager.setWorkspace(input);
1076
+ }
1077
+ /**
1078
+ * Gets the currently active workspace, if any.
1079
+ */
1080
+ async getWorkspace() {
1081
+ this.ensureStarted();
1082
+ return await this.workspaceManager.getWorkspace();
1083
+ }
1084
+ /**
1085
+ * Clears the active workspace for this runtime.
1086
+ */
1087
+ async clearWorkspace() {
1088
+ this.ensureStarted();
1089
+ await this.workspaceManager.clearWorkspace();
1090
+ }
1091
+ /**
1092
+ * Lists all known workspaces in storage.
1093
+ */
1094
+ async listWorkspaces() {
1095
+ this.ensureStarted();
1096
+ return await this.workspaceManager.listWorkspaces();
1097
+ }
944
1098
  // ============= SESSION MANAGEMENT =============
945
1099
  /**
946
1100
  * Creates a new chat session or returns an existing one.
@@ -1214,7 +1368,7 @@ Either:
1214
1368
  return null;
1215
1369
  }
1216
1370
  const contributorContext = { mcpManager: this.mcpManager };
1217
- const tools = await llmService.getAllTools();
1371
+ const tools = await llmService.getEnabledTools();
1218
1372
  const beforeEstimate = await contextManager.getContextTokenEstimate(
1219
1373
  contributorContext,
1220
1374
  tools
@@ -1225,7 +1379,11 @@ Either:
1225
1379
  estimatedTokens: originalTokens,
1226
1380
  sessionId
1227
1381
  });
1228
- const summaryMessages = await compactionStrategy.compact(history);
1382
+ const summaryMessages = await compactionStrategy.compact(history, {
1383
+ sessionId,
1384
+ model: llmService.getLanguageModel(),
1385
+ logger: session.logger
1386
+ });
1229
1387
  if (summaryMessages.length === 0) {
1230
1388
  this.logger.debug(`Compaction skipped for session ${sessionId} - nothing to compact`);
1231
1389
  this.agentEventBus.emit("context:compacted", {
@@ -1289,28 +1447,24 @@ Either:
1289
1447
  const contextManager = session.getContextManager();
1290
1448
  const contributorContext = { mcpManager: this.mcpManager };
1291
1449
  const llmService = session.getLLMService();
1292
- const tools = await llmService.getAllTools();
1450
+ const tools = await llmService.getEnabledTools();
1293
1451
  const tokenEstimate = await contextManager.getContextTokenEstimate(
1294
1452
  contributorContext,
1295
1453
  tools
1296
1454
  );
1297
1455
  const history = await contextManager.getHistory();
1298
1456
  const runtimeConfig = this.stateManager.getRuntimeConfig(sessionId);
1299
- const compactionConfig = runtimeConfig.compaction;
1300
1457
  const modelContextWindow = contextManager.getMaxInputTokens();
1301
- let maxContextTokens = modelContextWindow;
1302
- if (compactionConfig?.maxContextTokens !== void 0) {
1303
- maxContextTokens = Math.min(maxContextTokens, compactionConfig.maxContextTokens);
1304
- }
1305
- const thresholdPercent = compactionConfig?.thresholdPercent ?? 0.9;
1306
- if (thresholdPercent < 1) {
1307
- maxContextTokens = Math.floor(maxContextTokens * thresholdPercent);
1308
- }
1458
+ const compactionStrategy = this.compactionStrategy;
1459
+ const compactionSettings = compactionStrategy?.getSettings();
1460
+ const thresholdPercent = compactionSettings && compactionSettings.enabled ? compactionSettings.thresholdPercent : 1;
1461
+ const modelLimits = compactionStrategy ? compactionStrategy.getModelLimits(modelContextWindow) : { contextWindow: modelContextWindow };
1462
+ const maxContextTokens = thresholdPercent < 1 ? Math.floor(modelLimits.contextWindow * thresholdPercent) : modelLimits.contextWindow;
1309
1463
  const hasSummary = history.some(
1310
1464
  (msg) => msg.metadata?.isSummary === true || msg.metadata?.isSessionSummary === true
1311
1465
  );
1312
1466
  const llmConfig = runtimeConfig.llm;
1313
- const { getModelDisplayName } = await import("../llm/registry.js");
1467
+ const { getModelDisplayName } = await import("../llm/registry/index.js");
1314
1468
  const modelDisplayName = getModelDisplayName(llmConfig.model, llmConfig.provider);
1315
1469
  const estimatedTokens = tokenEstimate.estimated;
1316
1470
  const autoCompactBuffer = thresholdPercent > 0 && thresholdPercent < 1 ? Math.floor(maxContextTokens * (1 - thresholdPercent) / thresholdPercent) : 0;
@@ -1483,7 +1637,7 @@ Either:
1483
1637
  /**
1484
1638
  * Gets supported models for a specific provider.
1485
1639
  * Returns model information including metadata for the specified provider only.
1486
- * For gateway providers like 'dexto' with supportsAllRegistryModels, returns
1640
+ * For gateway providers like 'dexto-nova' with supportsAllRegistryModels, returns
1487
1641
  * all models from all accessible providers with their original provider info.
1488
1642
  *
1489
1643
  * @param provider The provider to get models for
@@ -1587,6 +1741,70 @@ Either:
1587
1741
  throw MCPError.connectionFailed(name, errorMessage);
1588
1742
  }
1589
1743
  }
1744
+ /**
1745
+ * Updates an existing MCP server configuration and reconnects if needed.
1746
+ * This is used when editing server params (timeout, headers, env, etc.).
1747
+ *
1748
+ * @param name The name of the server to update.
1749
+ * @param config The updated configuration object.
1750
+ * @throws MCPError if validation fails or reconnect fails.
1751
+ */
1752
+ async updateMcpServer(name, config) {
1753
+ this.ensureStarted();
1754
+ const currentConfig = this.stateManager.getRuntimeConfig().mcpServers[name];
1755
+ if (!currentConfig) {
1756
+ throw MCPError.serverNotFound(name);
1757
+ }
1758
+ const existingServerNames = Object.keys(this.stateManager.getRuntimeConfig().mcpServers);
1759
+ const validation = resolveAndValidateMcpServerConfig(name, config, existingServerNames);
1760
+ const validatedConfig = ensureOk(validation, this.logger);
1761
+ this.stateManager.setMcpServer(name, validatedConfig);
1762
+ const shouldEnable = validatedConfig.enabled !== false;
1763
+ const hasClient = this.mcpManager.getClients().has(name);
1764
+ if (!shouldEnable) {
1765
+ if (hasClient) {
1766
+ await this.mcpManager.removeClient(name);
1767
+ await this.toolManager.refresh();
1768
+ }
1769
+ this.logger.info(`MCP server '${name}' updated (disabled)`);
1770
+ return;
1771
+ }
1772
+ try {
1773
+ if (hasClient) {
1774
+ await this.mcpManager.removeClient(name);
1775
+ }
1776
+ await this.mcpManager.connectServer(name, validatedConfig);
1777
+ await this.toolManager.refresh();
1778
+ this.agentEventBus.emit("mcp:server-connected", { name, success: true });
1779
+ this.agentEventBus.emit("tools:available-updated", {
1780
+ tools: Object.keys(await this.toolManager.getAllTools()),
1781
+ source: "mcp"
1782
+ });
1783
+ this.logger.info(`MCP server '${name}' updated and reconnected successfully`);
1784
+ const warnings = validation.issues.filter((i) => i.severity === "warning");
1785
+ if (warnings.length > 0) {
1786
+ this.logger.warn(
1787
+ `MCP server updated with warnings: ${warnings.map((w) => w.message).join(", ")}`
1788
+ );
1789
+ }
1790
+ } catch (error) {
1791
+ const errorMessage = error instanceof Error ? error.message : String(error);
1792
+ this.logger.error(`Failed to update MCP server '${name}': ${errorMessage}`);
1793
+ this.stateManager.setMcpServer(name, currentConfig);
1794
+ if (currentConfig.enabled !== false) {
1795
+ try {
1796
+ await this.mcpManager.connectServer(name, currentConfig);
1797
+ await this.toolManager.refresh();
1798
+ } catch (reconnectError) {
1799
+ const reconnectMsg = reconnectError instanceof Error ? reconnectError.message : String(reconnectError);
1800
+ this.logger.error(
1801
+ `Failed to restore MCP server '${name}' after update error: ${reconnectMsg}`
1802
+ );
1803
+ }
1804
+ }
1805
+ throw MCPError.connectionFailed(name, errorMessage);
1806
+ }
1807
+ }
1590
1808
  /**
1591
1809
  * @deprecated Use `addMcpServer` instead. This method will be removed in a future version.
1592
1810
  */
@@ -1742,6 +1960,90 @@ Either:
1742
1960
  this.ensureStarted();
1743
1961
  return await this.toolManager.getAllTools();
1744
1962
  }
1963
+ /**
1964
+ * Gets tools enabled for LLM context (applies session overrides + global preferences).
1965
+ */
1966
+ async getEnabledTools(sessionId) {
1967
+ this.ensureStarted();
1968
+ if (sessionId !== void 0 && (!sessionId || typeof sessionId !== "string")) {
1969
+ throw AgentError.apiValidationError("sessionId must be a non-empty string");
1970
+ }
1971
+ return this.toolManager.filterToolsForSession(
1972
+ await this.toolManager.getAllTools(),
1973
+ sessionId
1974
+ );
1975
+ }
1976
+ /**
1977
+ * Get global disabled tools (agent preferences).
1978
+ */
1979
+ getGlobalDisabledTools() {
1980
+ this.ensureStarted();
1981
+ return this.toolManager.getGlobalDisabledTools();
1982
+ }
1983
+ /**
1984
+ * Set global disabled tools (agent preferences).
1985
+ */
1986
+ setGlobalDisabledTools(toolNames) {
1987
+ this.ensureStarted();
1988
+ if (!Array.isArray(toolNames) || toolNames.some((name) => !name || typeof name !== "string")) {
1989
+ throw AgentError.apiValidationError("toolNames must be an array of non-empty strings");
1990
+ }
1991
+ this.toolManager.setGlobalDisabledTools(toolNames);
1992
+ }
1993
+ /**
1994
+ * Set session-level disabled tools (session override).
1995
+ */
1996
+ setSessionDisabledTools(sessionId, toolNames) {
1997
+ this.ensureStarted();
1998
+ if (!sessionId || typeof sessionId !== "string") {
1999
+ throw AgentError.apiValidationError(
2000
+ "sessionId is required and must be a non-empty string"
2001
+ );
2002
+ }
2003
+ if (!Array.isArray(toolNames) || toolNames.some((name) => !name || typeof name !== "string")) {
2004
+ throw AgentError.apiValidationError("toolNames must be an array of non-empty strings");
2005
+ }
2006
+ this.toolManager.setSessionDisabledTools(sessionId, toolNames);
2007
+ }
2008
+ /**
2009
+ * Clear session-level disabled tools (session override).
2010
+ */
2011
+ clearSessionDisabledTools(sessionId) {
2012
+ this.ensureStarted();
2013
+ if (!sessionId || typeof sessionId !== "string") {
2014
+ throw AgentError.apiValidationError(
2015
+ "sessionId is required and must be a non-empty string"
2016
+ );
2017
+ }
2018
+ this.toolManager.clearSessionDisabledTools(sessionId);
2019
+ }
2020
+ /**
2021
+ * Get session-level auto-approve tools.
2022
+ */
2023
+ getSessionAutoApproveTools(sessionId) {
2024
+ this.ensureStarted();
2025
+ if (!sessionId || typeof sessionId !== "string") {
2026
+ throw AgentError.apiValidationError(
2027
+ "sessionId is required and must be a non-empty string"
2028
+ );
2029
+ }
2030
+ return this.toolManager.getSessionUserAutoApproveTools(sessionId) ?? [];
2031
+ }
2032
+ /**
2033
+ * Set session-level auto-approve tools (user selection).
2034
+ */
2035
+ setSessionAutoApproveTools(sessionId, toolNames) {
2036
+ this.ensureStarted();
2037
+ if (!sessionId || typeof sessionId !== "string") {
2038
+ throw AgentError.apiValidationError(
2039
+ "sessionId is required and must be a non-empty string"
2040
+ );
2041
+ }
2042
+ if (!Array.isArray(toolNames) || toolNames.some((name) => !name || typeof name !== "string")) {
2043
+ throw AgentError.apiValidationError("toolNames must be an array of non-empty strings");
2044
+ }
2045
+ this.toolManager.setSessionUserAutoApproveTools(sessionId, toolNames);
2046
+ }
1745
2047
  /**
1746
2048
  * Gets all connected MCP clients.
1747
2049
  * Used by the API layer to inspect client status.
@@ -2010,90 +2312,17 @@ Either:
2010
2312
  this.ensureStarted();
2011
2313
  return sessionId ? this.stateManager.getRuntimeConfig(sessionId) : this.stateManager.getRuntimeConfig();
2012
2314
  }
2013
- /**
2014
- * Gets the file path of the agent configuration currently in use.
2015
- * This returns the source agent file path, not session-specific overrides.
2016
- * @returns The path to the agent configuration file
2017
- * @throws AgentError if no config path is available
2018
- */
2019
- getAgentFilePath() {
2020
- if (!this.configPath) {
2021
- throw AgentError.noConfigPath();
2022
- }
2023
- return this.configPath;
2024
- }
2025
- /**
2026
- * Reloads the agent configuration with a new config object.
2027
- * Validates the new config, detects what changed, and automatically
2028
- * restarts the agent if necessary to apply the changes.
2029
- *
2030
- * @param newConfig The new agent configuration to apply
2031
- * @returns Object containing whether agent was restarted and list of changes applied
2032
- * @throws Error if config is invalid or restart fails
2033
- *
2034
- * TODO: improve hot reload capabilites so that we don't always require a restart
2035
- */
2036
- async reload(newConfig) {
2037
- this.logger.info("Reloading agent configuration");
2038
- const oldConfig = this.config;
2039
- const validated = AgentConfigSchema.parse(newConfig);
2040
- const changesApplied = this.detectConfigChanges(oldConfig, validated);
2041
- this.config = validated;
2042
- let restarted = false;
2043
- if (changesApplied.length > 0) {
2044
- this.logger.info(
2045
- `Configuration changed. Restarting agent to apply: ${changesApplied.join(", ")}`
2046
- );
2047
- await this.restart();
2048
- restarted = true;
2049
- this.logger.info("Agent restarted successfully with new configuration");
2050
- } else {
2051
- this.logger.info("Agent configuration reloaded successfully (no changes detected)");
2052
- }
2053
- return {
2054
- restarted,
2055
- changesApplied
2056
- };
2057
- }
2058
- /**
2059
- * Detects configuration changes that require a full agent restart.
2060
- * Pure comparison logic - no file I/O.
2061
- * Returns an array of change descriptions.
2062
- *
2063
- * @param oldConfig Previous validated configuration
2064
- * @param newConfig New validated configuration
2065
- * @returns Array of restart-required change descriptions
2066
- */
2067
- detectConfigChanges(oldConfig, newConfig) {
2068
- const changes = [];
2069
- if (JSON.stringify(oldConfig.storage) !== JSON.stringify(newConfig.storage)) {
2070
- changes.push("Storage backend");
2071
- }
2072
- if (JSON.stringify(oldConfig.sessions) !== JSON.stringify(newConfig.sessions)) {
2073
- changes.push("Session configuration");
2074
- }
2075
- if (JSON.stringify(oldConfig.systemPrompt) !== JSON.stringify(newConfig.systemPrompt)) {
2076
- changes.push("System prompt");
2077
- }
2078
- if (JSON.stringify(oldConfig.toolConfirmation) !== JSON.stringify(newConfig.toolConfirmation)) {
2079
- changes.push("Tool confirmation");
2080
- }
2081
- if (JSON.stringify(oldConfig.internalTools) !== JSON.stringify(newConfig.internalTools)) {
2082
- changes.push("Internal tools");
2083
- }
2084
- if (JSON.stringify(oldConfig.mcpServers) !== JSON.stringify(newConfig.mcpServers)) {
2085
- changes.push("MCP servers");
2086
- }
2087
- if (oldConfig.llm.provider !== newConfig.llm.provider || oldConfig.llm.model !== newConfig.llm.model || oldConfig.llm.apiKey !== newConfig.llm.apiKey) {
2088
- changes.push("LLM configuration");
2089
- }
2090
- return changes;
2315
+ getMcpServerConfig(name) {
2316
+ this.ensureStarted();
2317
+ const config = this.stateManager.getRuntimeConfig().mcpServers[name];
2318
+ if (config) return config;
2319
+ return this.mcpManager.getServerConfig(name);
2091
2320
  }
2092
2321
  // ============= APPROVAL HANDLER API =============
2093
2322
  /**
2094
2323
  * Set a custom approval handler for manual approval mode.
2095
2324
  *
2096
- * When `toolConfirmation.mode` is set to 'manual', an approval handler must be
2325
+ * When `permissions.mode` is set to 'manual', an approval handler must be
2097
2326
  * provided to process tool confirmation requests. The handler will be called
2098
2327
  * whenever a tool execution requires user approval.
2099
2328
  *
@@ -2166,10 +2395,11 @@ Either:
2166
2395
  // - Memory and context management across sessions
2167
2396
  // - Tool chaining and workflow automation
2168
2397
  // - Agent collaboration and delegation
2169
- }
2398
+ };
2170
2399
  _init = __decoratorStart(null);
2171
- DextoAgent = __decorateElement(_init, 0, "DextoAgent", _DextoAgent_decorators, DextoAgent);
2172
- __runInitializers(_init, 1, DextoAgent);
2400
+ _DextoAgent = __decorateElement(_init, 0, "DextoAgent", _DextoAgent_decorators, _DextoAgent);
2401
+ __runInitializers(_init, 1, _DextoAgent);
2402
+ let DextoAgent = _DextoAgent;
2173
2403
  export {
2174
2404
  DextoAgent
2175
2405
  };