@dexto/core 1.5.8 → 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 (640) hide show
  1. package/README.md +19 -8
  2. package/dist/agent/DextoAgent.cjs +293 -154
  3. package/dist/agent/DextoAgent.d.ts +83 -56
  4. package/dist/agent/DextoAgent.d.ts.map +1 -1
  5. package/dist/agent/DextoAgent.js +290 -151
  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 -104
  20. package/dist/agent/schemas.d.ts +10 -9199
  21. package/dist/agent/schemas.d.ts.map +1 -1
  22. package/dist/agent/schemas.js +1 -109
  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 +4 -2
  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 +4 -2
  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 +2 -2
  70. package/dist/context/utils.d.ts +14 -14
  71. package/dist/context/utils.d.ts.map +1 -1
  72. package/dist/errors/result-bridge.d.ts +2 -2
  73. package/dist/errors/result-bridge.d.ts.map +1 -1
  74. package/dist/errors/types.cjs +1 -1
  75. package/dist/errors/types.d.ts +3 -3
  76. package/dist/errors/types.d.ts.map +1 -1
  77. package/dist/errors/types.js +1 -1
  78. package/dist/events/index.cjs +11 -1
  79. package/dist/events/index.d.ts +43 -7
  80. package/dist/events/index.d.ts.map +1 -1
  81. package/dist/events/index.js +11 -1
  82. package/dist/{plugins → hooks}/builtins/content-policy.cjs +7 -6
  83. package/dist/hooks/builtins/content-policy.d.ts +24 -0
  84. package/dist/hooks/builtins/content-policy.d.ts.map +1 -0
  85. package/dist/{plugins → hooks}/builtins/content-policy.js +6 -5
  86. package/dist/{plugins → hooks}/builtins/response-sanitizer.cjs +3 -3
  87. package/dist/hooks/builtins/response-sanitizer.d.ts +22 -0
  88. package/dist/hooks/builtins/response-sanitizer.d.ts.map +1 -0
  89. package/dist/{plugins → hooks}/builtins/response-sanitizer.js +2 -2
  90. package/dist/hooks/error-codes.cjs +43 -0
  91. package/dist/hooks/error-codes.d.ts +34 -0
  92. package/dist/hooks/error-codes.d.ts.map +1 -0
  93. package/dist/hooks/error-codes.js +20 -0
  94. package/dist/{storage/cache/providers/memory.cjs → hooks/index.cjs} +15 -18
  95. package/dist/hooks/index.d.ts +14 -0
  96. package/dist/hooks/index.d.ts.map +1 -0
  97. package/dist/hooks/index.js +11 -0
  98. package/dist/hooks/manager.cjs +354 -0
  99. package/dist/hooks/manager.d.ts +103 -0
  100. package/dist/hooks/manager.d.ts.map +1 -0
  101. package/dist/hooks/manager.js +331 -0
  102. package/dist/{plugins → hooks}/types.d.ts +36 -34
  103. package/dist/hooks/types.d.ts.map +1 -0
  104. package/dist/index.browser.cjs +13 -12
  105. package/dist/index.browser.d.ts +5 -5
  106. package/dist/index.browser.d.ts.map +1 -1
  107. package/dist/index.browser.js +8 -7
  108. package/dist/index.cjs +5 -7
  109. package/dist/index.d.ts +2 -3
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +2 -3
  112. package/dist/llm/errors.cjs +1 -1
  113. package/dist/llm/executor/stream-processor.cjs +131 -11
  114. package/dist/llm/executor/stream-processor.d.ts +7 -5
  115. package/dist/llm/executor/stream-processor.d.ts.map +1 -1
  116. package/dist/llm/executor/stream-processor.js +131 -11
  117. package/dist/llm/executor/turn-executor.cjs +49 -54
  118. package/dist/llm/executor/turn-executor.d.ts +7 -8
  119. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  120. package/dist/llm/executor/turn-executor.js +49 -54
  121. package/dist/llm/formatters/vercel.cjs +2 -2
  122. package/dist/llm/formatters/vercel.d.ts +2 -2
  123. package/dist/llm/formatters/vercel.d.ts.map +1 -1
  124. package/dist/llm/providers/local/schemas.d.ts +10 -10
  125. package/dist/llm/registry/auto-update.d.ts +2 -2
  126. package/dist/llm/registry/auto-update.d.ts.map +1 -1
  127. package/dist/llm/registry/index.d.ts +3 -3
  128. package/dist/llm/registry/index.d.ts.map +1 -1
  129. package/dist/llm/resolver.cjs +2 -2
  130. package/dist/llm/resolver.d.ts +4 -4
  131. package/dist/llm/resolver.d.ts.map +1 -1
  132. package/dist/llm/schemas.cjs +67 -104
  133. package/dist/llm/schemas.d.ts +6 -145
  134. package/dist/llm/schemas.d.ts.map +1 -1
  135. package/dist/llm/schemas.js +64 -101
  136. package/dist/llm/services/factory.cjs +2 -3
  137. package/dist/llm/services/factory.d.ts +3 -4
  138. package/dist/llm/services/factory.d.ts.map +1 -1
  139. package/dist/llm/services/factory.js +2 -3
  140. package/dist/llm/services/vercel.cjs +7 -14
  141. package/dist/llm/services/vercel.d.ts +6 -7
  142. package/dist/llm/services/vercel.d.ts.map +1 -1
  143. package/dist/llm/services/vercel.js +7 -14
  144. package/dist/llm/validation.cjs +1 -1
  145. package/dist/llm/validation.d.ts +2 -2
  146. package/dist/llm/validation.d.ts.map +1 -1
  147. package/dist/logger/browser.cjs +4 -4
  148. package/dist/logger/browser.d.ts +4 -4
  149. package/dist/logger/browser.d.ts.map +1 -1
  150. package/dist/logger/browser.js +3 -3
  151. package/dist/{context/compaction/providers/noop-provider.cjs → logger/default-logger-factory.cjs} +16 -22
  152. package/dist/logger/default-logger-factory.d.ts +301 -0
  153. package/dist/logger/default-logger-factory.d.ts.map +1 -0
  154. package/dist/logger/default-logger-factory.js +18 -0
  155. package/dist/logger/factory.d.ts +2 -2
  156. package/dist/logger/factory.d.ts.map +1 -1
  157. package/dist/logger/index.cjs +7 -2
  158. package/dist/logger/index.d.ts +5 -3
  159. package/dist/logger/index.d.ts.map +1 -1
  160. package/dist/logger/index.js +8 -2
  161. package/dist/logger/logger.cjs +4 -4
  162. package/dist/logger/logger.d.ts +4 -4
  163. package/dist/logger/logger.d.ts.map +1 -1
  164. package/dist/logger/logger.js +3 -3
  165. package/dist/logger/v2/dexto-logger.d.ts +3 -3
  166. package/dist/logger/v2/dexto-logger.d.ts.map +1 -1
  167. package/dist/logger/v2/schemas.d.ts +12 -12
  168. package/dist/logger/v2/test-utils.d.ts +5 -5
  169. package/dist/logger/v2/test-utils.d.ts.map +1 -1
  170. package/dist/logger/v2/transport-factory.d.ts +3 -3
  171. package/dist/logger/v2/transport-factory.d.ts.map +1 -1
  172. package/dist/logger/v2/transports/console-transport.d.ts +2 -2
  173. package/dist/logger/v2/transports/console-transport.d.ts.map +1 -1
  174. package/dist/logger/v2/transports/file-transport.d.ts +2 -2
  175. package/dist/logger/v2/transports/file-transport.d.ts.map +1 -1
  176. package/dist/logger/v2/transports/silent-transport.d.ts +2 -2
  177. package/dist/logger/v2/transports/silent-transport.d.ts.map +1 -1
  178. package/dist/logger/v2/types.cjs +1 -1
  179. package/dist/logger/v2/types.d.ts +8 -8
  180. package/dist/logger/v2/types.d.ts.map +1 -1
  181. package/dist/logger/v2/types.js +1 -1
  182. package/dist/mcp/errors.cjs +2 -2
  183. package/dist/mcp/errors.d.ts.map +1 -1
  184. package/dist/mcp/manager.cjs +16 -11
  185. package/dist/mcp/manager.d.ts +16 -13
  186. package/dist/mcp/manager.d.ts.map +1 -1
  187. package/dist/mcp/manager.js +17 -12
  188. package/dist/mcp/mcp-client.cjs +25 -20
  189. package/dist/mcp/mcp-client.d.ts +5 -5
  190. package/dist/mcp/mcp-client.d.ts.map +1 -1
  191. package/dist/mcp/mcp-client.js +20 -15
  192. package/dist/mcp/resolver.cjs +1 -1
  193. package/dist/mcp/schemas.cjs +5 -5
  194. package/dist/mcp/schemas.d.ts +4 -4
  195. package/dist/mcp/schemas.js +2 -2
  196. package/dist/mcp/types.d.ts +7 -7
  197. package/dist/mcp/types.d.ts.map +1 -1
  198. package/dist/memory/manager.d.ts +2 -2
  199. package/dist/memory/manager.d.ts.map +1 -1
  200. package/dist/memory/schemas.d.ts +2 -2
  201. package/dist/prompts/errors.cjs +3 -3
  202. package/dist/prompts/errors.d.ts.map +1 -1
  203. package/dist/prompts/prompt-manager.d.ts +3 -3
  204. package/dist/prompts/prompt-manager.d.ts.map +1 -1
  205. package/dist/prompts/providers/config-prompt-provider.cjs +15 -29
  206. package/dist/prompts/providers/config-prompt-provider.d.ts +3 -3
  207. package/dist/prompts/providers/config-prompt-provider.d.ts.map +1 -1
  208. package/dist/prompts/providers/config-prompt-provider.js +15 -29
  209. package/dist/prompts/providers/custom-prompt-provider.d.ts +2 -2
  210. package/dist/prompts/providers/custom-prompt-provider.d.ts.map +1 -1
  211. package/dist/prompts/providers/mcp-prompt-provider.d.ts +2 -2
  212. package/dist/prompts/providers/mcp-prompt-provider.d.ts.map +1 -1
  213. package/dist/prompts/schemas.d.ts +4 -4
  214. package/dist/resources/{internal-provider.cjs → agent-resources-provider.cjs} +16 -16
  215. package/dist/resources/{internal-provider.d.ts → agent-resources-provider.d.ts} +6 -6
  216. package/dist/resources/agent-resources-provider.d.ts.map +1 -0
  217. package/dist/resources/{internal-provider.js → agent-resources-provider.js} +13 -13
  218. package/dist/resources/errors.cjs +2 -2
  219. package/dist/resources/errors.d.ts.map +1 -1
  220. package/dist/resources/handlers/blob-handler.d.ts +2 -2
  221. package/dist/resources/handlers/blob-handler.d.ts.map +1 -1
  222. package/dist/resources/handlers/factory.d.ts +3 -3
  223. package/dist/resources/handlers/factory.d.ts.map +1 -1
  224. package/dist/resources/handlers/filesystem-handler.d.ts +2 -2
  225. package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
  226. package/dist/resources/index.cjs +7 -9
  227. package/dist/resources/index.d.ts +3 -3
  228. package/dist/resources/index.d.ts.map +1 -1
  229. package/dist/resources/index.js +5 -10
  230. package/dist/resources/manager.cjs +77 -74
  231. package/dist/resources/manager.d.ts +16 -7
  232. package/dist/resources/manager.d.ts.map +1 -1
  233. package/dist/resources/manager.js +77 -74
  234. package/dist/resources/schemas.cjs +6 -26
  235. package/dist/resources/schemas.d.ts +8 -100
  236. package/dist/resources/schemas.d.ts.map +1 -1
  237. package/dist/resources/schemas.js +4 -23
  238. package/dist/search/search-service.d.ts +2 -2
  239. package/dist/search/search-service.d.ts.map +1 -1
  240. package/dist/session/chat-session.cjs +15 -25
  241. package/dist/session/chat-session.d.ts +7 -5
  242. package/dist/session/chat-session.d.ts.map +1 -1
  243. package/dist/session/chat-session.js +16 -26
  244. package/dist/session/errors.cjs +2 -2
  245. package/dist/session/errors.d.ts.map +1 -1
  246. package/dist/session/history/database.cjs +1 -1
  247. package/dist/session/history/database.d.ts +4 -4
  248. package/dist/session/history/database.d.ts.map +1 -1
  249. package/dist/session/history/factory.d.ts +3 -3
  250. package/dist/session/history/factory.d.ts.map +1 -1
  251. package/dist/session/history/memory.d.ts +4 -4
  252. package/dist/session/history/memory.d.ts.map +1 -1
  253. package/dist/session/history/types.d.ts +2 -2
  254. package/dist/session/history/types.d.ts.map +1 -1
  255. package/dist/session/index.cjs +3 -0
  256. package/dist/session/index.d.ts +2 -0
  257. package/dist/session/index.d.ts.map +1 -1
  258. package/dist/session/index.js +2 -0
  259. package/dist/session/message-queue.d.ts +2 -2
  260. package/dist/session/message-queue.d.ts.map +1 -1
  261. package/dist/session/session-manager.cjs +67 -9
  262. package/dist/session/session-manager.d.ts +46 -7
  263. package/dist/session/session-manager.d.ts.map +1 -1
  264. package/dist/session/session-manager.js +67 -9
  265. package/dist/session/title-generator.cjs +2 -2
  266. package/dist/session/title-generator.d.ts +2 -2
  267. package/dist/session/title-generator.d.ts.map +1 -1
  268. package/dist/storage/blob/index.cjs +0 -40
  269. package/dist/storage/blob/index.d.ts +2 -44
  270. package/dist/storage/blob/index.d.ts.map +1 -1
  271. package/dist/storage/blob/index.js +0 -30
  272. package/dist/storage/cache/index.cjs +0 -37
  273. package/dist/storage/cache/index.d.ts +0 -42
  274. package/dist/storage/cache/index.d.ts.map +1 -1
  275. package/dist/storage/cache/index.js +0 -28
  276. package/dist/storage/database/index.cjs +0 -42
  277. package/dist/storage/database/index.d.ts +0 -43
  278. package/dist/storage/database/index.d.ts.map +1 -1
  279. package/dist/storage/database/index.js +0 -37
  280. package/dist/storage/error-codes.cjs +1 -6
  281. package/dist/storage/error-codes.d.ts +2 -7
  282. package/dist/storage/error-codes.d.ts.map +1 -1
  283. package/dist/storage/error-codes.js +1 -6
  284. package/dist/storage/errors.cjs +18 -82
  285. package/dist/storage/errors.d.ts +4 -24
  286. package/dist/storage/errors.d.ts.map +1 -1
  287. package/dist/storage/errors.js +16 -80
  288. package/dist/storage/index.cjs +8 -69
  289. package/dist/storage/index.d.ts +11 -66
  290. package/dist/storage/index.d.ts.map +1 -1
  291. package/dist/storage/index.js +6 -50
  292. package/dist/storage/storage-manager.cjs +9 -25
  293. package/dist/storage/storage-manager.d.ts +11 -15
  294. package/dist/storage/storage-manager.d.ts.map +1 -1
  295. package/dist/storage/storage-manager.js +8 -23
  296. package/dist/storage/types.d.ts +0 -1
  297. package/dist/storage/types.d.ts.map +1 -1
  298. package/dist/systemPrompt/contributors.d.ts +4 -4
  299. package/dist/systemPrompt/contributors.d.ts.map +1 -1
  300. package/dist/systemPrompt/errors.cjs +2 -2
  301. package/dist/systemPrompt/errors.d.ts.map +1 -1
  302. package/dist/systemPrompt/manager.cjs +1 -5
  303. package/dist/systemPrompt/manager.d.ts +2 -3
  304. package/dist/systemPrompt/manager.d.ts.map +1 -1
  305. package/dist/systemPrompt/manager.js +1 -5
  306. package/dist/telemetry/index.cjs +3 -0
  307. package/dist/telemetry/index.d.ts +2 -0
  308. package/dist/telemetry/index.d.ts.map +1 -1
  309. package/dist/telemetry/index.js +2 -0
  310. package/dist/telemetry/utils.d.ts +4 -4
  311. package/dist/telemetry/utils.d.ts.map +1 -1
  312. package/dist/test-utils/in-memory-storage.cjs +288 -0
  313. package/dist/test-utils/in-memory-storage.js +252 -0
  314. package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts +3 -3
  315. package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts.map +1 -1
  316. package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.ts +2 -2
  317. package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.ts.map +1 -1
  318. package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts +4 -4
  319. package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts.map +1 -1
  320. package/dist/tools/confirmation/allowed-tools-provider/types.d.ts +2 -2
  321. package/dist/tools/confirmation/allowed-tools-provider/types.d.ts.map +1 -1
  322. package/dist/tools/{internal-tools/constants.cjs → define-tool.cjs} +8 -13
  323. package/dist/tools/define-tool.d.ts +11 -0
  324. package/dist/tools/define-tool.d.ts.map +1 -0
  325. package/dist/tools/define-tool.js +7 -0
  326. package/dist/tools/error-codes.cjs +2 -2
  327. package/dist/tools/error-codes.d.ts +2 -2
  328. package/dist/tools/error-codes.d.ts.map +1 -1
  329. package/dist/tools/error-codes.js +2 -2
  330. package/dist/tools/errors.cjs +11 -23
  331. package/dist/tools/errors.d.ts +4 -10
  332. package/dist/tools/errors.d.ts.map +1 -1
  333. package/dist/tools/errors.js +9 -21
  334. package/dist/tools/index.cjs +3 -8
  335. package/dist/tools/index.d.ts +2 -4
  336. package/dist/tools/index.d.ts.map +1 -1
  337. package/dist/tools/index.js +2 -7
  338. package/dist/{storage/blob/providers/index.cjs → tools/pattern-utils.cjs} +11 -9
  339. package/dist/tools/pattern-utils.d.ts +20 -0
  340. package/dist/tools/pattern-utils.d.ts.map +1 -0
  341. package/dist/tools/pattern-utils.js +10 -0
  342. package/dist/tools/schemas.cjs +14 -40
  343. package/dist/tools/schemas.d.ts +6 -50
  344. package/dist/tools/schemas.d.ts.map +1 -1
  345. package/dist/tools/schemas.js +11 -32
  346. package/dist/tools/tool-call-metadata.cjs +3 -3
  347. package/dist/tools/tool-call-metadata.d.ts +1 -1
  348. package/dist/tools/tool-call-metadata.d.ts.map +1 -1
  349. package/dist/tools/tool-call-metadata.js +3 -3
  350. package/dist/tools/tool-manager.cjs +376 -327
  351. package/dist/tools/tool-manager.d.ts +63 -80
  352. package/dist/tools/tool-manager.d.ts.map +1 -1
  353. package/dist/tools/tool-manager.js +376 -331
  354. package/dist/tools/types.d.ts +112 -13
  355. package/dist/tools/types.d.ts.map +1 -1
  356. package/dist/utils/error-conversion.d.ts +2 -2
  357. package/dist/utils/error-conversion.d.ts.map +1 -1
  358. package/dist/utils/path.d.ts +2 -2
  359. package/dist/utils/path.d.ts.map +1 -1
  360. package/dist/utils/result.cjs +1 -1
  361. package/dist/utils/result.d.ts.map +1 -1
  362. package/dist/utils/schema.cjs +9 -5
  363. package/dist/utils/schema.d.ts +4 -2
  364. package/dist/utils/schema.d.ts.map +1 -1
  365. package/dist/utils/schema.js +9 -5
  366. package/dist/utils/service-initializer.cjs +51 -56
  367. package/dist/utils/service-initializer.d.ts +17 -14
  368. package/dist/utils/service-initializer.d.ts.map +1 -1
  369. package/dist/utils/service-initializer.js +51 -56
  370. package/dist/{storage/cache/providers/index.cjs → workspace/error-codes.cjs} +8 -9
  371. package/dist/workspace/error-codes.d.ts +5 -0
  372. package/dist/workspace/error-codes.d.ts.map +1 -0
  373. package/dist/workspace/error-codes.js +7 -0
  374. package/dist/{storage/blob/factory.cjs → workspace/errors.cjs} +20 -14
  375. package/dist/workspace/errors.d.ts +5 -0
  376. package/dist/workspace/errors.d.ts.map +1 -0
  377. package/dist/workspace/errors.js +21 -0
  378. package/dist/{image → workspace}/index.cjs +12 -10
  379. package/dist/workspace/index.d.ts +5 -0
  380. package/dist/workspace/index.d.ts.map +1 -0
  381. package/dist/workspace/index.js +9 -0
  382. package/dist/workspace/manager.cjs +113 -0
  383. package/dist/workspace/manager.d.ts +18 -0
  384. package/dist/workspace/manager.d.ts.map +1 -0
  385. package/dist/workspace/manager.js +90 -0
  386. package/dist/workspace/types.d.ts +14 -0
  387. package/dist/workspace/types.d.ts.map +1 -0
  388. package/package.json +2 -2
  389. package/dist/context/compaction/factory.cjs +0 -57
  390. package/dist/context/compaction/factory.d.ts +0 -17
  391. package/dist/context/compaction/factory.d.ts.map +0 -1
  392. package/dist/context/compaction/factory.js +0 -34
  393. package/dist/context/compaction/provider.d.ts +0 -48
  394. package/dist/context/compaction/provider.d.ts.map +0 -1
  395. package/dist/context/compaction/providers/noop-provider.d.ts +0 -24
  396. package/dist/context/compaction/providers/noop-provider.d.ts.map +0 -1
  397. package/dist/context/compaction/providers/noop-provider.js +0 -24
  398. package/dist/context/compaction/providers/reactive-overflow-provider.cjs +0 -76
  399. package/dist/context/compaction/providers/reactive-overflow-provider.d.ts +0 -51
  400. package/dist/context/compaction/providers/reactive-overflow-provider.d.ts.map +0 -1
  401. package/dist/context/compaction/providers/reactive-overflow-provider.js +0 -52
  402. package/dist/context/compaction/registry.cjs +0 -39
  403. package/dist/context/compaction/registry.d.ts +0 -19
  404. package/dist/context/compaction/registry.d.ts.map +0 -1
  405. package/dist/context/compaction/registry.js +0 -16
  406. package/dist/context/compaction/schemas.cjs +0 -58
  407. package/dist/context/compaction/schemas.d.ts +0 -69
  408. package/dist/context/compaction/schemas.d.ts.map +0 -1
  409. package/dist/context/compaction/schemas.js +0 -34
  410. package/dist/context/compaction/strategies/reactive-overflow.d.ts.map +0 -1
  411. package/dist/image/define-image.cjs +0 -146
  412. package/dist/image/define-image.d.ts +0 -71
  413. package/dist/image/define-image.d.ts.map +0 -1
  414. package/dist/image/define-image.js +0 -121
  415. package/dist/image/index.d.ts +0 -53
  416. package/dist/image/index.d.ts.map +0 -1
  417. package/dist/image/index.js +0 -7
  418. package/dist/image/types.d.ts +0 -246
  419. package/dist/image/types.d.ts.map +0 -1
  420. package/dist/llm/services/test-utils.integration.cjs +0 -237
  421. package/dist/llm/services/test-utils.integration.d.ts +0 -48
  422. package/dist/llm/services/test-utils.integration.d.ts.map +0 -1
  423. package/dist/llm/services/test-utils.integration.js +0 -214
  424. package/dist/plugins/builtins/content-policy.d.ts +0 -26
  425. package/dist/plugins/builtins/content-policy.d.ts.map +0 -1
  426. package/dist/plugins/builtins/response-sanitizer.d.ts +0 -25
  427. package/dist/plugins/builtins/response-sanitizer.d.ts.map +0 -1
  428. package/dist/plugins/error-codes.cjs +0 -43
  429. package/dist/plugins/error-codes.d.ts +0 -34
  430. package/dist/plugins/error-codes.d.ts.map +0 -1
  431. package/dist/plugins/error-codes.js +0 -20
  432. package/dist/plugins/index.cjs +0 -61
  433. package/dist/plugins/index.d.ts +0 -21
  434. package/dist/plugins/index.d.ts.map +0 -1
  435. package/dist/plugins/index.js +0 -30
  436. package/dist/plugins/loader.cjs +0 -171
  437. package/dist/plugins/loader.d.ts +0 -30
  438. package/dist/plugins/loader.d.ts.map +0 -1
  439. package/dist/plugins/loader.js +0 -145
  440. package/dist/plugins/manager.cjs +0 -473
  441. package/dist/plugins/manager.d.ts +0 -106
  442. package/dist/plugins/manager.d.ts.map +0 -1
  443. package/dist/plugins/manager.js +0 -450
  444. package/dist/plugins/registrations/builtins.cjs +0 -51
  445. package/dist/plugins/registrations/builtins.d.ts +0 -17
  446. package/dist/plugins/registrations/builtins.d.ts.map +0 -1
  447. package/dist/plugins/registrations/builtins.js +0 -28
  448. package/dist/plugins/registry.cjs +0 -63
  449. package/dist/plugins/registry.d.ts +0 -101
  450. package/dist/plugins/registry.d.ts.map +0 -1
  451. package/dist/plugins/registry.js +0 -39
  452. package/dist/plugins/schemas.cjs +0 -73
  453. package/dist/plugins/schemas.d.ts +0 -195
  454. package/dist/plugins/schemas.d.ts.map +0 -1
  455. package/dist/plugins/schemas.js +0 -47
  456. package/dist/plugins/types.d.ts.map +0 -1
  457. package/dist/providers/base-registry.cjs +0 -147
  458. package/dist/providers/base-registry.d.ts +0 -147
  459. package/dist/providers/base-registry.d.ts.map +0 -1
  460. package/dist/providers/base-registry.js +0 -123
  461. package/dist/providers/discovery.cjs +0 -109
  462. package/dist/providers/discovery.d.ts +0 -96
  463. package/dist/providers/discovery.d.ts.map +0 -1
  464. package/dist/providers/discovery.js +0 -84
  465. package/dist/providers/index.cjs +0 -24
  466. package/dist/providers/index.d.ts +0 -32
  467. package/dist/providers/index.d.ts.map +0 -1
  468. package/dist/providers/index.js +0 -2
  469. package/dist/resources/internal-provider.d.ts.map +0 -1
  470. package/dist/storage/blob/factory.d.ts +0 -37
  471. package/dist/storage/blob/factory.d.ts.map +0 -1
  472. package/dist/storage/blob/factory.js +0 -15
  473. package/dist/storage/blob/local-blob-store.cjs +0 -496
  474. package/dist/storage/blob/local-blob-store.d.ts +0 -58
  475. package/dist/storage/blob/local-blob-store.d.ts.map +0 -1
  476. package/dist/storage/blob/local-blob-store.js +0 -463
  477. package/dist/storage/blob/memory-blob-store.cjs +0 -326
  478. package/dist/storage/blob/memory-blob-store.d.ts +0 -66
  479. package/dist/storage/blob/memory-blob-store.d.ts.map +0 -1
  480. package/dist/storage/blob/memory-blob-store.js +0 -303
  481. package/dist/storage/blob/provider.d.ts +0 -50
  482. package/dist/storage/blob/provider.d.ts.map +0 -1
  483. package/dist/storage/blob/providers/index.d.ts +0 -8
  484. package/dist/storage/blob/providers/index.d.ts.map +0 -1
  485. package/dist/storage/blob/providers/index.js +0 -7
  486. package/dist/storage/blob/providers/local.cjs +0 -39
  487. package/dist/storage/blob/providers/local.d.ts +0 -17
  488. package/dist/storage/blob/providers/local.d.ts.map +0 -1
  489. package/dist/storage/blob/providers/local.js +0 -16
  490. package/dist/storage/blob/providers/memory.cjs +0 -39
  491. package/dist/storage/blob/providers/memory.d.ts +0 -17
  492. package/dist/storage/blob/providers/memory.d.ts.map +0 -1
  493. package/dist/storage/blob/providers/memory.js +0 -16
  494. package/dist/storage/blob/registry.cjs +0 -50
  495. package/dist/storage/blob/registry.d.ts +0 -42
  496. package/dist/storage/blob/registry.d.ts.map +0 -1
  497. package/dist/storage/blob/registry.js +0 -26
  498. package/dist/storage/blob/schemas.cjs +0 -52
  499. package/dist/storage/blob/schemas.d.ts +0 -85
  500. package/dist/storage/blob/schemas.d.ts.map +0 -1
  501. package/dist/storage/blob/schemas.js +0 -26
  502. package/dist/storage/cache/factory.cjs +0 -38
  503. package/dist/storage/cache/factory.d.ts +0 -37
  504. package/dist/storage/cache/factory.d.ts.map +0 -1
  505. package/dist/storage/cache/factory.js +0 -15
  506. package/dist/storage/cache/memory-cache-store.cjs +0 -107
  507. package/dist/storage/cache/memory-cache-store.d.ts +0 -26
  508. package/dist/storage/cache/memory-cache-store.d.ts.map +0 -1
  509. package/dist/storage/cache/memory-cache-store.js +0 -84
  510. package/dist/storage/cache/provider.cjs +0 -16
  511. package/dist/storage/cache/provider.d.ts +0 -56
  512. package/dist/storage/cache/provider.d.ts.map +0 -1
  513. package/dist/storage/cache/provider.js +0 -0
  514. package/dist/storage/cache/providers/index.d.ts +0 -8
  515. package/dist/storage/cache/providers/index.d.ts.map +0 -1
  516. package/dist/storage/cache/providers/index.js +0 -7
  517. package/dist/storage/cache/providers/memory.d.ts +0 -17
  518. package/dist/storage/cache/providers/memory.d.ts.map +0 -1
  519. package/dist/storage/cache/providers/memory.js +0 -17
  520. package/dist/storage/cache/providers/redis.cjs +0 -66
  521. package/dist/storage/cache/providers/redis.d.ts +0 -20
  522. package/dist/storage/cache/providers/redis.d.ts.map +0 -1
  523. package/dist/storage/cache/providers/redis.js +0 -33
  524. package/dist/storage/cache/redis-store.cjs +0 -173
  525. package/dist/storage/cache/redis-store.d.ts +0 -32
  526. package/dist/storage/cache/redis-store.d.ts.map +0 -1
  527. package/dist/storage/cache/redis-store.js +0 -150
  528. package/dist/storage/cache/registry.cjs +0 -50
  529. package/dist/storage/cache/registry.d.ts +0 -42
  530. package/dist/storage/cache/registry.d.ts.map +0 -1
  531. package/dist/storage/cache/registry.js +0 -26
  532. package/dist/storage/cache/schemas.cjs +0 -81
  533. package/dist/storage/cache/schemas.d.ts +0 -150
  534. package/dist/storage/cache/schemas.d.ts.map +0 -1
  535. package/dist/storage/cache/schemas.js +0 -55
  536. package/dist/storage/database/factory.cjs +0 -38
  537. package/dist/storage/database/factory.d.ts +0 -39
  538. package/dist/storage/database/factory.d.ts.map +0 -1
  539. package/dist/storage/database/factory.js +0 -15
  540. package/dist/storage/database/memory-database-store.cjs +0 -122
  541. package/dist/storage/database/memory-database-store.d.ts +0 -29
  542. package/dist/storage/database/memory-database-store.d.ts.map +0 -1
  543. package/dist/storage/database/memory-database-store.js +0 -99
  544. package/dist/storage/database/postgres-store.cjs +0 -342
  545. package/dist/storage/database/postgres-store.d.ts +0 -55
  546. package/dist/storage/database/postgres-store.d.ts.map +0 -1
  547. package/dist/storage/database/postgres-store.js +0 -319
  548. package/dist/storage/database/provider.cjs +0 -16
  549. package/dist/storage/database/provider.d.ts +0 -56
  550. package/dist/storage/database/provider.d.ts.map +0 -1
  551. package/dist/storage/database/provider.js +0 -0
  552. package/dist/storage/database/providers/index.cjs +0 -34
  553. package/dist/storage/database/providers/index.d.ts +0 -9
  554. package/dist/storage/database/providers/index.d.ts.map +0 -1
  555. package/dist/storage/database/providers/index.js +0 -9
  556. package/dist/storage/database/providers/memory.cjs +0 -40
  557. package/dist/storage/database/providers/memory.d.ts +0 -16
  558. package/dist/storage/database/providers/memory.d.ts.map +0 -1
  559. package/dist/storage/database/providers/memory.js +0 -17
  560. package/dist/storage/database/providers/postgres.cjs +0 -62
  561. package/dist/storage/database/providers/postgres.d.ts +0 -19
  562. package/dist/storage/database/providers/postgres.d.ts.map +0 -1
  563. package/dist/storage/database/providers/postgres.js +0 -29
  564. package/dist/storage/database/providers/sqlite.cjs +0 -66
  565. package/dist/storage/database/providers/sqlite.d.ts +0 -20
  566. package/dist/storage/database/providers/sqlite.d.ts.map +0 -1
  567. package/dist/storage/database/providers/sqlite.js +0 -33
  568. package/dist/storage/database/registry.cjs +0 -50
  569. package/dist/storage/database/registry.d.ts +0 -42
  570. package/dist/storage/database/registry.d.ts.map +0 -1
  571. package/dist/storage/database/registry.js +0 -26
  572. package/dist/storage/database/schemas.cjs +0 -97
  573. package/dist/storage/database/schemas.d.ts +0 -226
  574. package/dist/storage/database/schemas.d.ts.map +0 -1
  575. package/dist/storage/database/schemas.js +0 -70
  576. package/dist/storage/database/sqlite-store.cjs +0 -270
  577. package/dist/storage/database/sqlite-store.d.ts +0 -33
  578. package/dist/storage/database/sqlite-store.d.ts.map +0 -1
  579. package/dist/storage/database/sqlite-store.js +0 -237
  580. package/dist/storage/schemas.cjs +0 -57
  581. package/dist/storage/schemas.d.ts +0 -347
  582. package/dist/storage/schemas.d.ts.map +0 -1
  583. package/dist/storage/schemas.js +0 -37
  584. package/dist/tools/bash-pattern-utils.cjs +0 -91
  585. package/dist/tools/bash-pattern-utils.d.ts +0 -58
  586. package/dist/tools/bash-pattern-utils.d.ts.map +0 -1
  587. package/dist/tools/bash-pattern-utils.js +0 -64
  588. package/dist/tools/custom-tool-registry.cjs +0 -64
  589. package/dist/tools/custom-tool-registry.d.ts +0 -126
  590. package/dist/tools/custom-tool-registry.d.ts.map +0 -1
  591. package/dist/tools/custom-tool-registry.js +0 -40
  592. package/dist/tools/custom-tool-schema-registry.cjs +0 -164
  593. package/dist/tools/custom-tool-schema-registry.d.ts +0 -86
  594. package/dist/tools/custom-tool-schema-registry.d.ts.map +0 -1
  595. package/dist/tools/custom-tool-schema-registry.js +0 -140
  596. package/dist/tools/internal-tools/constants.d.ts +0 -12
  597. package/dist/tools/internal-tools/constants.d.ts.map +0 -1
  598. package/dist/tools/internal-tools/constants.js +0 -12
  599. package/dist/tools/internal-tools/implementations/ask-user-tool.cjs +0 -57
  600. package/dist/tools/internal-tools/implementations/ask-user-tool.d.ts +0 -18
  601. package/dist/tools/internal-tools/implementations/ask-user-tool.d.ts.map +0 -1
  602. package/dist/tools/internal-tools/implementations/ask-user-tool.js +0 -34
  603. package/dist/tools/internal-tools/implementations/delegate-to-url-tool.cjs +0 -192
  604. package/dist/tools/internal-tools/implementations/delegate-to-url-tool.d.ts +0 -33
  605. package/dist/tools/internal-tools/implementations/delegate-to-url-tool.d.ts.map +0 -1
  606. package/dist/tools/internal-tools/implementations/delegate-to-url-tool.js +0 -169
  607. package/dist/tools/internal-tools/implementations/get-resource-tool.cjs +0 -113
  608. package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts +0 -30
  609. package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts.map +0 -1
  610. package/dist/tools/internal-tools/implementations/get-resource-tool.js +0 -90
  611. package/dist/tools/internal-tools/implementations/invoke-skill-tool.cjs +0 -140
  612. package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts +0 -24
  613. package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts.map +0 -1
  614. package/dist/tools/internal-tools/implementations/invoke-skill-tool.js +0 -117
  615. package/dist/tools/internal-tools/implementations/list-resources-tool.cjs +0 -91
  616. package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts +0 -24
  617. package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts.map +0 -1
  618. package/dist/tools/internal-tools/implementations/list-resources-tool.js +0 -68
  619. package/dist/tools/internal-tools/implementations/search-history-tool.cjs +0 -61
  620. package/dist/tools/internal-tools/implementations/search-history-tool.d.ts +0 -7
  621. package/dist/tools/internal-tools/implementations/search-history-tool.d.ts.map +0 -1
  622. package/dist/tools/internal-tools/implementations/search-history-tool.js +0 -38
  623. package/dist/tools/internal-tools/index.cjs +0 -26
  624. package/dist/tools/internal-tools/index.d.ts +0 -4
  625. package/dist/tools/internal-tools/index.d.ts.map +0 -1
  626. package/dist/tools/internal-tools/index.js +0 -3
  627. package/dist/tools/internal-tools/provider.cjs +0 -324
  628. package/dist/tools/internal-tools/provider.d.ts +0 -116
  629. package/dist/tools/internal-tools/provider.d.ts.map +0 -1
  630. package/dist/tools/internal-tools/provider.js +0 -301
  631. package/dist/tools/internal-tools/registry.cjs +0 -71
  632. package/dist/tools/internal-tools/registry.d.ts +0 -91
  633. package/dist/tools/internal-tools/registry.d.ts.map +0 -1
  634. package/dist/tools/internal-tools/registry.js +0 -47
  635. /package/dist/{context/compaction/provider.js → agent/agent-options.js} +0 -0
  636. /package/dist/{image/types.js → agent/runtime-config.js} +0 -0
  637. /package/dist/{image → hooks}/types.cjs +0 -0
  638. /package/dist/{plugins → hooks}/types.js +0 -0
  639. /package/dist/{plugins → workspace}/types.cjs +0 -0
  640. /package/dist/{storage/blob/provider.js → workspace/types.js} +0 -0
@@ -1,450 +0,0 @@
1
- import "../chunk-PTJYTZNU.js";
2
- import { DextoRuntimeError, ErrorScope, ErrorType } from "../errors/index.js";
3
- import { PluginErrorCode } from "./error-codes.js";
4
- import { loadPluginModule, resolvePluginPath } from "./loader.js";
5
- import { getContext } from "../utils/async-context.js";
6
- import { pluginRegistry } from "./registry.js";
7
- import { DextoLogComponent } from "../logger/v2/types.js";
8
- class PluginManager {
9
- plugins = /* @__PURE__ */ new Map();
10
- pluginsByExtensionPoint = /* @__PURE__ */ new Map();
11
- options;
12
- initialized = false;
13
- logger;
14
- /** Default timeout for plugin execution (milliseconds) */
15
- static DEFAULT_TIMEOUT = 5e3;
16
- constructor(options, logger) {
17
- this.options = options;
18
- this.logger = logger.createChild(DextoLogComponent.PLUGIN);
19
- this.logger.debug("PluginManager created");
20
- }
21
- /**
22
- * Register a built-in plugin
23
- * Called by the built-in plugin registry before initialize()
24
- *
25
- * @param name - Plugin name
26
- * @param PluginClass - Plugin class constructor
27
- * @param config - Plugin configuration
28
- */
29
- registerBuiltin(name, PluginClass, config) {
30
- if (this.initialized) {
31
- throw new DextoRuntimeError(
32
- PluginErrorCode.PLUGIN_CONFIGURATION_INVALID,
33
- ErrorScope.PLUGIN,
34
- ErrorType.SYSTEM,
35
- "Cannot register built-in plugins after initialization"
36
- );
37
- }
38
- const plugin = new PluginClass();
39
- const loadedPlugin = {
40
- plugin,
41
- config: {
42
- name,
43
- module: `<builtin:${name}>`,
44
- enabled: config.enabled ?? true,
45
- blocking: config.blocking,
46
- priority: config.priority,
47
- config: config.config ?? void 0
48
- }
49
- };
50
- this.plugins.set(name, loadedPlugin);
51
- this.logger.debug(`Built-in plugin registered: ${name}`);
52
- }
53
- /**
54
- * Initialize all plugins from configuration
55
- * Loads custom plugins (file-based), registry plugins (programmatic), validates priorities,
56
- * sorts by priority, and calls initialize()
57
- *
58
- * TODO: Consider adding an MCP server-like convention for plugin discovery.
59
- * Instead of requiring explicit file paths, plugins could be connected as
60
- * plugin servers to the PluginManager.
61
- *
62
- * @param customPlugins - Array of custom plugin configurations from YAML (file-based)
63
- * @param registryPlugins - Array of registry plugin configurations from YAML (programmatic)
64
- * @throws {DextoRuntimeError} If any plugin fails to load or initialize (fail-fast)
65
- */
66
- async initialize(customPlugins = [], registryPlugins = []) {
67
- if (this.initialized) {
68
- throw new DextoRuntimeError(
69
- PluginErrorCode.PLUGIN_CONFIGURATION_INVALID,
70
- ErrorScope.PLUGIN,
71
- ErrorType.SYSTEM,
72
- "PluginManager already initialized"
73
- );
74
- }
75
- const priorities = /* @__PURE__ */ new Set();
76
- const allPluginConfigs = [
77
- ...Array.from(this.plugins.values()).map((p) => p.config),
78
- ...customPlugins,
79
- ...registryPlugins.map((r) => ({
80
- name: r.type,
81
- module: `<registry:${r.type}>`,
82
- enabled: r.enabled,
83
- blocking: r.blocking,
84
- priority: r.priority,
85
- config: r.config
86
- }))
87
- ];
88
- for (const config of allPluginConfigs) {
89
- if (!config.enabled) continue;
90
- if (priorities.has(config.priority)) {
91
- throw new DextoRuntimeError(
92
- PluginErrorCode.PLUGIN_DUPLICATE_PRIORITY,
93
- ErrorScope.PLUGIN,
94
- ErrorType.USER,
95
- `Duplicate plugin priority: ${config.priority}. Each plugin must have a unique priority.`,
96
- {
97
- priority: config.priority,
98
- hint: "Ensure all enabled plugins (built-in, custom, and registry) have unique priority values."
99
- }
100
- );
101
- }
102
- priorities.add(config.priority);
103
- }
104
- for (const registryConfig of registryPlugins) {
105
- if (!registryConfig.enabled) {
106
- this.logger.debug(`Skipping disabled registry plugin: ${registryConfig.type}`);
107
- continue;
108
- }
109
- try {
110
- const provider = pluginRegistry.get(registryConfig.type);
111
- if (!provider) {
112
- throw new DextoRuntimeError(
113
- PluginErrorCode.PLUGIN_PROVIDER_NOT_FOUND,
114
- ErrorScope.PLUGIN,
115
- ErrorType.USER,
116
- `Plugin provider '${registryConfig.type}' not found in registry`,
117
- {
118
- type: registryConfig.type,
119
- available: pluginRegistry.getTypes()
120
- },
121
- `Available plugin providers: ${pluginRegistry.getTypes().join(", ") || "none"}. Register the provider using pluginRegistry.register() before agent initialization.`
122
- );
123
- }
124
- const validatedConfig = provider.configSchema.safeParse({
125
- type: registryConfig.type,
126
- ...registryConfig.config
127
- });
128
- if (!validatedConfig.success) {
129
- throw new DextoRuntimeError(
130
- PluginErrorCode.PLUGIN_PROVIDER_VALIDATION_FAILED,
131
- ErrorScope.PLUGIN,
132
- ErrorType.USER,
133
- `Invalid configuration for plugin provider '${registryConfig.type}'`,
134
- {
135
- type: registryConfig.type,
136
- errors: validatedConfig.error.errors
137
- },
138
- "Check the configuration schema for this plugin provider"
139
- );
140
- }
141
- const creationContext = {
142
- config: registryConfig.config || {},
143
- blocking: registryConfig.blocking,
144
- priority: registryConfig.priority
145
- };
146
- const plugin = provider.create(validatedConfig.data, creationContext);
147
- const loadedPlugin = {
148
- plugin,
149
- config: {
150
- name: registryConfig.type,
151
- module: `<registry:${registryConfig.type}>`,
152
- enabled: registryConfig.enabled,
153
- blocking: registryConfig.blocking,
154
- priority: registryConfig.priority,
155
- config: registryConfig.config
156
- }
157
- };
158
- this.plugins.set(registryConfig.type, loadedPlugin);
159
- this.logger.info(`Registry plugin loaded: ${registryConfig.type}`);
160
- } catch (error) {
161
- if (error instanceof DextoRuntimeError) {
162
- throw error;
163
- }
164
- throw new DextoRuntimeError(
165
- PluginErrorCode.PLUGIN_INITIALIZATION_FAILED,
166
- ErrorScope.PLUGIN,
167
- ErrorType.SYSTEM,
168
- `Failed to load registry plugin '${registryConfig.type}': ${error instanceof Error ? error.message : String(error)}`
169
- );
170
- }
171
- }
172
- for (const pluginConfig of customPlugins) {
173
- if (!pluginConfig.enabled) {
174
- this.logger.debug(`Skipping disabled plugin: ${pluginConfig.name}`);
175
- continue;
176
- }
177
- try {
178
- const modulePath = resolvePluginPath(pluginConfig.module, this.options.configDir);
179
- const PluginClass = await loadPluginModule(modulePath, pluginConfig.name);
180
- const plugin = new PluginClass();
181
- const loadedPlugin = {
182
- plugin,
183
- config: pluginConfig
184
- };
185
- this.plugins.set(pluginConfig.name, loadedPlugin);
186
- this.logger.info(`Custom plugin loaded: ${pluginConfig.name}`);
187
- } catch (error) {
188
- throw new DextoRuntimeError(
189
- PluginErrorCode.PLUGIN_INITIALIZATION_FAILED,
190
- ErrorScope.PLUGIN,
191
- ErrorType.SYSTEM,
192
- `Failed to load plugin '${pluginConfig.name}': ${error instanceof Error ? error.message : String(error)}`
193
- );
194
- }
195
- }
196
- for (const [name, loadedPlugin] of this.plugins.entries()) {
197
- if (!loadedPlugin.config.enabled) continue;
198
- try {
199
- if (loadedPlugin.plugin.initialize) {
200
- await loadedPlugin.plugin.initialize(loadedPlugin.config.config || {});
201
- this.logger.debug(`Plugin initialized: ${name}`);
202
- }
203
- } catch (error) {
204
- throw new DextoRuntimeError(
205
- PluginErrorCode.PLUGIN_INITIALIZATION_FAILED,
206
- ErrorScope.PLUGIN,
207
- ErrorType.SYSTEM,
208
- `Plugin '${name}' initialization failed: ${error instanceof Error ? error.message : String(error)}`
209
- );
210
- }
211
- }
212
- for (const loadedPlugin of this.plugins.values()) {
213
- if (!loadedPlugin.config.enabled) continue;
214
- this.registerToExtensionPoints(loadedPlugin);
215
- }
216
- for (const [extensionPoint, plugins] of this.pluginsByExtensionPoint.entries()) {
217
- plugins.sort((a, b) => a.config.priority - b.config.priority);
218
- this.logger.debug(
219
- `Extension point '${extensionPoint}': ${plugins.length} plugin(s) registered`,
220
- {
221
- plugins: plugins.map((p) => ({
222
- name: p.config.name,
223
- priority: p.config.priority
224
- }))
225
- }
226
- );
227
- }
228
- this.initialized = true;
229
- this.logger.info(`PluginManager initialized with ${this.plugins.size} plugin(s)`);
230
- }
231
- /**
232
- * Register a plugin to the extension points it implements
233
- */
234
- registerToExtensionPoints(loadedPlugin) {
235
- const extensionPoints = [
236
- "beforeLLMRequest",
237
- "beforeToolCall",
238
- "afterToolResult",
239
- "beforeResponse"
240
- ];
241
- for (const point of extensionPoints) {
242
- if (typeof loadedPlugin.plugin[point] === "function") {
243
- if (!this.pluginsByExtensionPoint.has(point)) {
244
- this.pluginsByExtensionPoint.set(point, []);
245
- }
246
- this.pluginsByExtensionPoint.get(point).push(loadedPlugin);
247
- }
248
- }
249
- }
250
- /**
251
- * Execute all plugins at a specific extension point
252
- * Plugins execute sequentially in priority order
253
- *
254
- * @param extensionPoint - Which extension point to execute
255
- * @param payload - Payload for this extension point (must be an object)
256
- * @param options - Options for building execution context
257
- * @returns Modified payload after all plugins execute
258
- * @throws {DextoRuntimeError} If a blocking plugin cancels execution or payload is not an object
259
- */
260
- async executePlugins(extensionPoint, payload, options) {
261
- const plugins = this.pluginsByExtensionPoint.get(extensionPoint) || [];
262
- if (plugins.length === 0) {
263
- return payload;
264
- }
265
- if (payload === null || typeof payload !== "object") {
266
- throw new DextoRuntimeError(
267
- PluginErrorCode.PLUGIN_INVALID_SHAPE,
268
- ErrorScope.PLUGIN,
269
- ErrorType.USER,
270
- `Payload for ${extensionPoint} must be an object (got ${payload === null ? "null" : typeof payload})`,
271
- { extensionPoint, payloadType: typeof payload }
272
- );
273
- }
274
- let currentPayload = { ...payload };
275
- const asyncCtx = getContext();
276
- const llmConfig = options.stateManager.getLLMConfig(options.sessionId);
277
- const context = {
278
- sessionId: options.sessionId ?? void 0,
279
- userId: asyncCtx?.userId ?? void 0,
280
- tenantId: asyncCtx?.tenantId ?? void 0,
281
- llmConfig,
282
- logger: this.logger,
283
- abortSignal: options.abortSignal ?? void 0,
284
- agent: {
285
- sessionManager: options.sessionManager,
286
- mcpManager: options.mcpManager,
287
- toolManager: options.toolManager,
288
- stateManager: options.stateManager,
289
- agentEventBus: this.options.agentEventBus,
290
- storageManager: this.options.storageManager
291
- }
292
- };
293
- for (const { plugin, config } of plugins) {
294
- const method = plugin[extensionPoint];
295
- if (!method) continue;
296
- const startTime = Date.now();
297
- try {
298
- const result = await this.executeWithTimeout(
299
- method.call(plugin, currentPayload, context),
300
- config.name,
301
- PluginManager.DEFAULT_TIMEOUT
302
- );
303
- const duration = Date.now() - startTime;
304
- this.logger.debug(`Plugin '${config.name}' executed at ${extensionPoint}`, {
305
- ok: result.ok,
306
- cancelled: result.cancel,
307
- duration,
308
- hasModifications: !!result.modify
309
- });
310
- if (result.notices && result.notices.length > 0) {
311
- for (const notice of result.notices) {
312
- const level = notice.kind === "block" || notice.kind === "warn" ? "warn" : "info";
313
- this.logger[level](`Plugin notice (${notice.kind}): ${notice.message}`, {
314
- plugin: config.name,
315
- code: notice.code,
316
- details: notice.details
317
- });
318
- }
319
- }
320
- if (!result.ok) {
321
- this.logger.warn(`Plugin '${config.name}' returned error`, {
322
- message: result.message
323
- });
324
- if (config.blocking && result.cancel) {
325
- throw new DextoRuntimeError(
326
- PluginErrorCode.PLUGIN_BLOCKED_EXECUTION,
327
- ErrorScope.PLUGIN,
328
- ErrorType.FORBIDDEN,
329
- result.message || `Operation blocked by plugin '${config.name}'`,
330
- {
331
- plugin: config.name,
332
- extensionPoint,
333
- notices: result.notices
334
- }
335
- );
336
- }
337
- continue;
338
- }
339
- if (result.modify) {
340
- currentPayload = { ...currentPayload, ...result.modify };
341
- this.logger.debug(`Plugin '${config.name}' modified payload`, {
342
- keys: Object.keys(result.modify)
343
- });
344
- }
345
- if (result.cancel && config.blocking) {
346
- throw new DextoRuntimeError(
347
- PluginErrorCode.PLUGIN_BLOCKED_EXECUTION,
348
- ErrorScope.PLUGIN,
349
- ErrorType.FORBIDDEN,
350
- result.message || `Operation cancelled by plugin '${config.name}'`,
351
- {
352
- plugin: config.name,
353
- extensionPoint,
354
- notices: result.notices
355
- }
356
- );
357
- }
358
- } catch (error) {
359
- const duration = Date.now() - startTime;
360
- if (error instanceof DextoRuntimeError) {
361
- throw error;
362
- }
363
- this.logger.error(`Plugin '${config.name}' threw error`, {
364
- error: error instanceof Error ? error.message : String(error),
365
- duration
366
- });
367
- if (config.blocking) {
368
- throw new DextoRuntimeError(
369
- PluginErrorCode.PLUGIN_EXECUTION_FAILED,
370
- ErrorScope.PLUGIN,
371
- ErrorType.SYSTEM,
372
- `Plugin '${config.name}' failed: ${error instanceof Error ? error.message : String(error)}`,
373
- {
374
- plugin: config.name,
375
- extensionPoint
376
- }
377
- );
378
- }
379
- this.logger.debug(`Non-blocking plugin error, continuing execution`);
380
- }
381
- }
382
- return currentPayload;
383
- }
384
- /**
385
- * Execute a promise with timeout, properly clearing timer on completion
386
- * Prevents timer leaks and unhandled rejections from Promise.race
387
- */
388
- async executeWithTimeout(promise, pluginName, ms) {
389
- let timer;
390
- return await new Promise((resolve, reject) => {
391
- timer = setTimeout(() => {
392
- reject(
393
- new DextoRuntimeError(
394
- PluginErrorCode.PLUGIN_EXECUTION_TIMEOUT,
395
- ErrorScope.PLUGIN,
396
- ErrorType.TIMEOUT,
397
- `Plugin '${pluginName}' execution timed out after ${ms}ms`
398
- )
399
- );
400
- }, ms);
401
- promise.then(
402
- (val) => {
403
- if (timer) clearTimeout(timer);
404
- resolve(val);
405
- },
406
- (err) => {
407
- if (timer) clearTimeout(timer);
408
- reject(err);
409
- }
410
- );
411
- });
412
- }
413
- /**
414
- * Cleanup all plugins
415
- * Called when agent shuts down
416
- */
417
- async cleanup() {
418
- for (const [name, loadedPlugin] of this.plugins.entries()) {
419
- if (loadedPlugin.plugin.cleanup) {
420
- try {
421
- await loadedPlugin.plugin.cleanup();
422
- this.logger.debug(`Plugin cleaned up: ${name}`);
423
- } catch (error) {
424
- this.logger.error(`Plugin cleanup failed: ${name}`, {
425
- error: error instanceof Error ? error.message : String(error)
426
- });
427
- }
428
- }
429
- }
430
- this.logger.info("PluginManager cleanup complete");
431
- }
432
- /**
433
- * Get plugin statistics
434
- */
435
- getStats() {
436
- const enabled = Array.from(this.plugins.values()).filter((p) => p.config.enabled).length;
437
- const byExtensionPoint = {};
438
- for (const [point, plugins] of this.pluginsByExtensionPoint.entries()) {
439
- byExtensionPoint[point] = plugins.length;
440
- }
441
- return {
442
- total: this.plugins.size,
443
- enabled,
444
- byExtensionPoint
445
- };
446
- }
447
- }
448
- export {
449
- PluginManager
450
- };
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var builtins_exports = {};
20
- __export(builtins_exports, {
21
- registerBuiltInPlugins: () => registerBuiltInPlugins
22
- });
23
- module.exports = __toCommonJS(builtins_exports);
24
- var import_content_policy = require("../builtins/content-policy.js");
25
- var import_response_sanitizer = require("../builtins/response-sanitizer.js");
26
- function registerBuiltInPlugins(args) {
27
- const cp = args.config.plugins?.contentPolicy;
28
- if (cp && typeof cp === "object" && cp.enabled !== false) {
29
- args.pluginManager.registerBuiltin("content-policy", import_content_policy.ContentPolicyPlugin, {
30
- name: "content-policy",
31
- enabled: cp.enabled ?? true,
32
- priority: cp.priority,
33
- blocking: cp.blocking ?? true,
34
- config: cp
35
- });
36
- }
37
- const rs = args.config.plugins?.responseSanitizer;
38
- if (rs && typeof rs === "object" && rs.enabled !== false) {
39
- args.pluginManager.registerBuiltin("response-sanitizer", import_response_sanitizer.ResponseSanitizerPlugin, {
40
- name: "response-sanitizer",
41
- enabled: rs.enabled ?? true,
42
- priority: rs.priority,
43
- blocking: rs.blocking ?? false,
44
- config: rs
45
- });
46
- }
47
- }
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- registerBuiltInPlugins
51
- });
@@ -1,17 +0,0 @@
1
- import type { PluginManager } from '../manager.js';
2
- import type { ValidatedAgentConfig } from '../../agent/schemas.js';
3
- /**
4
- * Register all built-in plugins with the PluginManager
5
- * Called during agent initialization before custom plugins are loaded
6
- *
7
- * Built-in plugins are referenced by name in the config (e.g., contentPolicy, responseSanitizer)
8
- * and activated based on presence of their configuration object.
9
- *
10
- * @param pluginManager - The PluginManager instance
11
- * @param config - Validated agent configuration
12
- */
13
- export declare function registerBuiltInPlugins(args: {
14
- pluginManager: PluginManager;
15
- config: ValidatedAgentConfig;
16
- }): void;
17
- //# sourceMappingURL=builtins.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../../src/plugins/registrations/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAInE;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IACzC,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,oBAAoB,CAAC;CAChC,GAAG,IAAI,CAwBP"}
@@ -1,28 +0,0 @@
1
- import "../../chunk-PTJYTZNU.js";
2
- import { ContentPolicyPlugin } from "../builtins/content-policy.js";
3
- import { ResponseSanitizerPlugin } from "../builtins/response-sanitizer.js";
4
- function registerBuiltInPlugins(args) {
5
- const cp = args.config.plugins?.contentPolicy;
6
- if (cp && typeof cp === "object" && cp.enabled !== false) {
7
- args.pluginManager.registerBuiltin("content-policy", ContentPolicyPlugin, {
8
- name: "content-policy",
9
- enabled: cp.enabled ?? true,
10
- priority: cp.priority,
11
- blocking: cp.blocking ?? true,
12
- config: cp
13
- });
14
- }
15
- const rs = args.config.plugins?.responseSanitizer;
16
- if (rs && typeof rs === "object" && rs.enabled !== false) {
17
- args.pluginManager.registerBuiltin("response-sanitizer", ResponseSanitizerPlugin, {
18
- name: "response-sanitizer",
19
- enabled: rs.enabled ?? true,
20
- priority: rs.priority,
21
- blocking: rs.blocking ?? false,
22
- config: rs
23
- });
24
- }
25
- }
26
- export {
27
- registerBuiltInPlugins
28
- };
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var registry_exports = {};
20
- __export(registry_exports, {
21
- PluginRegistry: () => PluginRegistry,
22
- pluginRegistry: () => pluginRegistry
23
- });
24
- module.exports = __toCommonJS(registry_exports);
25
- var import_errors = require("../errors/index.js");
26
- var import_error_codes = require("./error-codes.js");
27
- var import_base_registry = require("../providers/base-registry.js");
28
- const pluginRegistryErrorFactory = {
29
- alreadyRegistered: (type) => new import_errors.DextoRuntimeError(
30
- import_error_codes.PluginErrorCode.PLUGIN_PROVIDER_ALREADY_REGISTERED,
31
- import_errors.ErrorScope.PLUGIN,
32
- import_errors.ErrorType.USER,
33
- `Plugin provider '${type}' is already registered`,
34
- { type },
35
- "Each plugin provider type can only be registered once"
36
- ),
37
- notFound: (type, availableTypes) => new import_errors.DextoRuntimeError(
38
- import_error_codes.PluginErrorCode.PLUGIN_PROVIDER_NOT_FOUND,
39
- import_errors.ErrorScope.PLUGIN,
40
- import_errors.ErrorType.USER,
41
- `Plugin provider '${type}' not found`,
42
- { type, available: availableTypes },
43
- `Available plugin providers: ${availableTypes.join(", ") || "none"}`
44
- )
45
- };
46
- class PluginRegistry extends import_base_registry.BaseRegistry {
47
- constructor() {
48
- super(pluginRegistryErrorFactory);
49
- }
50
- /**
51
- * Get all registered plugin providers.
52
- * Alias for getAll() to match other registry patterns.
53
- */
54
- getProviders() {
55
- return this.getAll();
56
- }
57
- }
58
- const pluginRegistry = new PluginRegistry();
59
- // Annotate the CommonJS export names for ESM import in node:
60
- 0 && (module.exports = {
61
- PluginRegistry,
62
- pluginRegistry
63
- });