groundswell 0.0.1 → 0.0.3

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 (451) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/README.md +99 -5
  3. package/dist/__tests__/adversarial/attachChild-performance.test.d.ts +16 -0
  4. package/dist/__tests__/adversarial/attachChild-performance.test.d.ts.map +1 -0
  5. package/dist/__tests__/adversarial/attachChild-performance.test.js +187 -0
  6. package/dist/__tests__/adversarial/attachChild-performance.test.js.map +1 -0
  7. package/dist/__tests__/adversarial/circular-reference.test.d.ts +13 -0
  8. package/dist/__tests__/adversarial/circular-reference.test.d.ts.map +1 -0
  9. package/dist/__tests__/adversarial/circular-reference.test.js +92 -0
  10. package/dist/__tests__/adversarial/circular-reference.test.js.map +1 -0
  11. package/dist/__tests__/adversarial/complex-circular-reference.test.d.ts +16 -0
  12. package/dist/__tests__/adversarial/complex-circular-reference.test.d.ts.map +1 -0
  13. package/dist/__tests__/adversarial/complex-circular-reference.test.js +127 -0
  14. package/dist/__tests__/adversarial/complex-circular-reference.test.js.map +1 -0
  15. package/dist/__tests__/adversarial/concurrent-task-failures.test.d.ts +21 -0
  16. package/dist/__tests__/adversarial/concurrent-task-failures.test.d.ts.map +1 -0
  17. package/dist/__tests__/adversarial/concurrent-task-failures.test.js +667 -0
  18. package/dist/__tests__/adversarial/concurrent-task-failures.test.js.map +1 -0
  19. package/dist/__tests__/adversarial/deep-analysis.test.d.ts +6 -0
  20. package/dist/__tests__/adversarial/deep-analysis.test.d.ts.map +1 -0
  21. package/dist/__tests__/adversarial/deep-analysis.test.js +877 -0
  22. package/dist/__tests__/adversarial/deep-analysis.test.js.map +1 -0
  23. package/dist/__tests__/adversarial/deep-hierarchy-stress.test.d.ts +13 -0
  24. package/dist/__tests__/adversarial/deep-hierarchy-stress.test.d.ts.map +1 -0
  25. package/dist/__tests__/adversarial/deep-hierarchy-stress.test.js +186 -0
  26. package/dist/__tests__/adversarial/deep-hierarchy-stress.test.js.map +1 -0
  27. package/dist/__tests__/adversarial/e2e-prd-validation.test.d.ts +6 -0
  28. package/dist/__tests__/adversarial/e2e-prd-validation.test.d.ts.map +1 -0
  29. package/dist/__tests__/adversarial/e2e-prd-validation.test.js +626 -0
  30. package/dist/__tests__/adversarial/e2e-prd-validation.test.js.map +1 -0
  31. package/dist/__tests__/adversarial/edge-case.test.d.ts +6 -0
  32. package/dist/__tests__/adversarial/edge-case.test.d.ts.map +1 -0
  33. package/dist/__tests__/adversarial/edge-case.test.js +857 -0
  34. package/dist/__tests__/adversarial/edge-case.test.js.map +1 -0
  35. package/dist/__tests__/adversarial/error-merge-strategy.test.d.ts +20 -0
  36. package/dist/__tests__/adversarial/error-merge-strategy.test.d.ts.map +1 -0
  37. package/dist/__tests__/adversarial/error-merge-strategy.test.js +907 -0
  38. package/dist/__tests__/adversarial/error-merge-strategy.test.js.map +1 -0
  39. package/dist/__tests__/adversarial/incremental-performance.test.d.ts +2 -0
  40. package/dist/__tests__/adversarial/incremental-performance.test.d.ts.map +1 -0
  41. package/dist/__tests__/adversarial/incremental-performance.test.js +113 -0
  42. package/dist/__tests__/adversarial/incremental-performance.test.js.map +1 -0
  43. package/dist/__tests__/adversarial/node-map-update-benchmarks.test.d.ts +22 -0
  44. package/dist/__tests__/adversarial/node-map-update-benchmarks.test.d.ts.map +1 -0
  45. package/dist/__tests__/adversarial/node-map-update-benchmarks.test.js +383 -0
  46. package/dist/__tests__/adversarial/node-map-update-benchmarks.test.js.map +1 -0
  47. package/dist/__tests__/adversarial/observer-propagation.test.d.ts +21 -0
  48. package/dist/__tests__/adversarial/observer-propagation.test.d.ts.map +1 -0
  49. package/dist/__tests__/adversarial/observer-propagation.test.js +404 -0
  50. package/dist/__tests__/adversarial/observer-propagation.test.js.map +1 -0
  51. package/dist/__tests__/adversarial/parent-validation.test.d.ts +13 -0
  52. package/dist/__tests__/adversarial/parent-validation.test.d.ts.map +1 -0
  53. package/dist/__tests__/adversarial/parent-validation.test.js +128 -0
  54. package/dist/__tests__/adversarial/parent-validation.test.js.map +1 -0
  55. package/dist/__tests__/adversarial/prd-12-2-compliance.test.d.ts +20 -0
  56. package/dist/__tests__/adversarial/prd-12-2-compliance.test.d.ts.map +1 -0
  57. package/dist/__tests__/adversarial/prd-12-2-compliance.test.js +482 -0
  58. package/dist/__tests__/adversarial/prd-12-2-compliance.test.js.map +1 -0
  59. package/dist/__tests__/adversarial/prd-compliance.test.d.ts +6 -0
  60. package/dist/__tests__/adversarial/prd-compliance.test.d.ts.map +1 -0
  61. package/dist/__tests__/adversarial/prd-compliance.test.js +886 -0
  62. package/dist/__tests__/adversarial/prd-compliance.test.js.map +1 -0
  63. package/dist/__tests__/compatibility/backward-compatibility.test.d.ts +22 -0
  64. package/dist/__tests__/compatibility/backward-compatibility.test.d.ts.map +1 -0
  65. package/dist/__tests__/compatibility/backward-compatibility.test.js +1843 -0
  66. package/dist/__tests__/compatibility/backward-compatibility.test.js.map +1 -0
  67. package/dist/__tests__/helpers/index.d.ts +10 -0
  68. package/dist/__tests__/helpers/index.d.ts.map +1 -0
  69. package/dist/__tests__/helpers/index.js +10 -0
  70. package/dist/__tests__/helpers/index.js.map +1 -0
  71. package/dist/__tests__/helpers/tree-verification.d.ts +90 -0
  72. package/dist/__tests__/helpers/tree-verification.d.ts.map +1 -0
  73. package/dist/__tests__/helpers/tree-verification.js +202 -0
  74. package/dist/__tests__/helpers/tree-verification.js.map +1 -0
  75. package/dist/__tests__/integration/agent-workflow.test.d.ts +2 -0
  76. package/dist/__tests__/integration/agent-workflow.test.d.ts.map +1 -0
  77. package/dist/__tests__/integration/agent-workflow.test.js +256 -0
  78. package/dist/__tests__/integration/agent-workflow.test.js.map +1 -0
  79. package/dist/__tests__/integration/bidirectional-consistency.test.d.ts +14 -0
  80. package/dist/__tests__/integration/bidirectional-consistency.test.d.ts.map +1 -0
  81. package/dist/__tests__/integration/bidirectional-consistency.test.js +668 -0
  82. package/dist/__tests__/integration/bidirectional-consistency.test.js.map +1 -0
  83. package/dist/__tests__/integration/observer-logging.test.d.ts +2 -0
  84. package/dist/__tests__/integration/observer-logging.test.d.ts.map +1 -0
  85. package/dist/__tests__/integration/observer-logging.test.js +517 -0
  86. package/dist/__tests__/integration/observer-logging.test.js.map +1 -0
  87. package/dist/__tests__/integration/tree-mirroring.test.d.ts +2 -0
  88. package/dist/__tests__/integration/tree-mirroring.test.d.ts.map +1 -0
  89. package/dist/__tests__/integration/tree-mirroring.test.js +117 -0
  90. package/dist/__tests__/integration/tree-mirroring.test.js.map +1 -0
  91. package/dist/__tests__/integration/workflow-reparenting.test.d.ts +12 -0
  92. package/dist/__tests__/integration/workflow-reparenting.test.d.ts.map +1 -0
  93. package/dist/__tests__/integration/workflow-reparenting.test.js +239 -0
  94. package/dist/__tests__/integration/workflow-reparenting.test.js.map +1 -0
  95. package/dist/__tests__/unit/agent.test.d.ts +2 -0
  96. package/dist/__tests__/unit/agent.test.d.ts.map +1 -0
  97. package/dist/__tests__/unit/agent.test.js +143 -0
  98. package/dist/__tests__/unit/agent.test.js.map +1 -0
  99. package/dist/__tests__/unit/cache-key.test.d.ts +5 -0
  100. package/dist/__tests__/unit/cache-key.test.d.ts.map +1 -0
  101. package/dist/__tests__/unit/cache-key.test.js +145 -0
  102. package/dist/__tests__/unit/cache-key.test.js.map +1 -0
  103. package/dist/__tests__/unit/cache.test.d.ts +5 -0
  104. package/dist/__tests__/unit/cache.test.d.ts.map +1 -0
  105. package/dist/__tests__/unit/cache.test.js +132 -0
  106. package/dist/__tests__/unit/cache.test.js.map +1 -0
  107. package/dist/__tests__/unit/context.test.d.ts +2 -0
  108. package/dist/__tests__/unit/context.test.d.ts.map +1 -0
  109. package/dist/__tests__/unit/context.test.js +220 -0
  110. package/dist/__tests__/unit/context.test.js.map +1 -0
  111. package/dist/__tests__/unit/decorators.test.d.ts +2 -0
  112. package/dist/__tests__/unit/decorators.test.d.ts.map +1 -0
  113. package/dist/__tests__/unit/decorators.test.js +162 -0
  114. package/dist/__tests__/unit/decorators.test.js.map +1 -0
  115. package/dist/__tests__/unit/introspection-tools.test.d.ts +5 -0
  116. package/dist/__tests__/unit/introspection-tools.test.d.ts.map +1 -0
  117. package/dist/__tests__/unit/introspection-tools.test.js +191 -0
  118. package/dist/__tests__/unit/introspection-tools.test.js.map +1 -0
  119. package/dist/__tests__/unit/logger.test.d.ts +2 -0
  120. package/dist/__tests__/unit/logger.test.d.ts.map +1 -0
  121. package/dist/__tests__/unit/logger.test.js +241 -0
  122. package/dist/__tests__/unit/logger.test.js.map +1 -0
  123. package/dist/__tests__/unit/observable.test.d.ts +2 -0
  124. package/dist/__tests__/unit/observable.test.d.ts.map +1 -0
  125. package/dist/__tests__/unit/observable.test.js +251 -0
  126. package/dist/__tests__/unit/observable.test.js.map +1 -0
  127. package/dist/__tests__/unit/prompt.test.d.ts +2 -0
  128. package/dist/__tests__/unit/prompt.test.d.ts.map +1 -0
  129. package/dist/__tests__/unit/prompt.test.js +113 -0
  130. package/dist/__tests__/unit/prompt.test.js.map +1 -0
  131. package/dist/__tests__/unit/reflection.test.d.ts +5 -0
  132. package/dist/__tests__/unit/reflection.test.d.ts.map +1 -0
  133. package/dist/__tests__/unit/reflection.test.js +160 -0
  134. package/dist/__tests__/unit/reflection.test.js.map +1 -0
  135. package/dist/__tests__/unit/tree-debugger-incremental.test.d.ts +2 -0
  136. package/dist/__tests__/unit/tree-debugger-incremental.test.d.ts.map +1 -0
  137. package/dist/__tests__/unit/tree-debugger-incremental.test.js +136 -0
  138. package/dist/__tests__/unit/tree-debugger-incremental.test.js.map +1 -0
  139. package/dist/__tests__/unit/tree-debugger.test.d.ts +2 -0
  140. package/dist/__tests__/unit/tree-debugger.test.d.ts.map +1 -0
  141. package/dist/__tests__/unit/tree-debugger.test.js +69 -0
  142. package/dist/__tests__/unit/tree-debugger.test.js.map +1 -0
  143. package/dist/__tests__/unit/utils/workflow-error-utils.test.d.ts +2 -0
  144. package/dist/__tests__/unit/utils/workflow-error-utils.test.d.ts.map +1 -0
  145. package/dist/__tests__/unit/utils/workflow-error-utils.test.js +154 -0
  146. package/dist/__tests__/unit/utils/workflow-error-utils.test.js.map +1 -0
  147. package/dist/__tests__/unit/workflow-detachChild.test.d.ts +2 -0
  148. package/dist/__tests__/unit/workflow-detachChild.test.d.ts.map +1 -0
  149. package/dist/__tests__/unit/workflow-detachChild.test.js +76 -0
  150. package/dist/__tests__/unit/workflow-detachChild.test.js.map +1 -0
  151. package/dist/__tests__/unit/workflow-emitEvent-childDetached.test.d.ts +2 -0
  152. package/dist/__tests__/unit/workflow-emitEvent-childDetached.test.d.ts.map +1 -0
  153. package/dist/__tests__/unit/workflow-emitEvent-childDetached.test.js +122 -0
  154. package/dist/__tests__/unit/workflow-emitEvent-childDetached.test.js.map +1 -0
  155. package/dist/__tests__/unit/workflow-isDescendantOf.test.d.ts +2 -0
  156. package/dist/__tests__/unit/workflow-isDescendantOf.test.d.ts.map +1 -0
  157. package/dist/__tests__/unit/workflow-isDescendantOf.test.js +140 -0
  158. package/dist/__tests__/unit/workflow-isDescendantOf.test.js.map +1 -0
  159. package/dist/__tests__/unit/workflow.test.d.ts +2 -0
  160. package/dist/__tests__/unit/workflow.test.d.ts.map +1 -0
  161. package/dist/__tests__/unit/workflow.test.js +330 -0
  162. package/dist/__tests__/unit/workflow.test.js.map +1 -0
  163. package/dist/cache/cache-key.d.ts +66 -0
  164. package/dist/cache/cache-key.d.ts.map +1 -0
  165. package/dist/cache/cache-key.js +195 -0
  166. package/dist/cache/cache-key.js.map +1 -0
  167. package/dist/cache/cache.d.ts +104 -0
  168. package/dist/cache/cache.d.ts.map +1 -0
  169. package/dist/cache/cache.js +179 -0
  170. package/dist/cache/cache.js.map +1 -0
  171. package/{src/cache/index.ts → dist/cache/index.d.ts} +1 -1
  172. package/dist/cache/index.d.ts.map +1 -0
  173. package/dist/cache/index.js +6 -0
  174. package/dist/cache/index.js.map +1 -0
  175. package/dist/core/agent.d.ts +112 -0
  176. package/dist/core/agent.d.ts.map +1 -0
  177. package/dist/core/agent.js +426 -0
  178. package/dist/core/agent.js.map +1 -0
  179. package/{src/core/context.ts → dist/core/context.d.ts} +16 -67
  180. package/dist/core/context.d.ts.map +1 -0
  181. package/dist/core/context.js +80 -0
  182. package/dist/core/context.js.map +1 -0
  183. package/dist/core/event-tree.d.ts +72 -0
  184. package/dist/core/event-tree.d.ts.map +1 -0
  185. package/dist/core/event-tree.js +211 -0
  186. package/dist/core/event-tree.js.map +1 -0
  187. package/{src/core/factory.ts → dist/core/factory.d.ts} +6 -27
  188. package/dist/core/factory.d.ts.map +1 -0
  189. package/dist/core/factory.js +110 -0
  190. package/dist/core/factory.js.map +1 -0
  191. package/{src/core/index.ts → dist/core/index.d.ts} +2 -10
  192. package/dist/core/index.d.ts.map +1 -0
  193. package/dist/core/index.js +9 -0
  194. package/dist/core/index.js.map +1 -0
  195. package/dist/core/logger.d.ts +50 -0
  196. package/dist/core/logger.d.ts.map +1 -0
  197. package/dist/core/logger.js +91 -0
  198. package/dist/core/logger.js.map +1 -0
  199. package/dist/core/mcp-handler.d.ts +69 -0
  200. package/dist/core/mcp-handler.d.ts.map +1 -0
  201. package/dist/core/mcp-handler.js +143 -0
  202. package/dist/core/mcp-handler.js.map +1 -0
  203. package/dist/core/prompt.d.ts +80 -0
  204. package/dist/core/prompt.d.ts.map +1 -0
  205. package/dist/core/prompt.js +120 -0
  206. package/dist/core/prompt.js.map +1 -0
  207. package/dist/core/workflow-context.d.ts +57 -0
  208. package/dist/core/workflow-context.d.ts.map +1 -0
  209. package/dist/core/workflow-context.js +263 -0
  210. package/dist/core/workflow-context.js.map +1 -0
  211. package/dist/core/workflow.d.ts +241 -0
  212. package/dist/core/workflow.d.ts.map +1 -0
  213. package/dist/core/workflow.js +464 -0
  214. package/dist/core/workflow.js.map +1 -0
  215. package/dist/debugger/index.d.ts +2 -0
  216. package/dist/debugger/index.d.ts.map +1 -0
  217. package/{src/debugger/index.ts → dist/debugger/index.js} +1 -0
  218. package/dist/debugger/index.js.map +1 -0
  219. package/dist/debugger/tree-debugger.d.ts +71 -0
  220. package/dist/debugger/tree-debugger.d.ts.map +1 -0
  221. package/dist/debugger/tree-debugger.js +198 -0
  222. package/dist/debugger/tree-debugger.js.map +1 -0
  223. package/dist/decorators/index.d.ts +4 -0
  224. package/dist/decorators/index.d.ts.map +1 -0
  225. package/{src/decorators/index.ts → dist/decorators/index.js} +1 -0
  226. package/dist/decorators/index.js.map +1 -0
  227. package/dist/decorators/observed-state.d.ts +32 -0
  228. package/dist/decorators/observed-state.d.ts.map +1 -0
  229. package/dist/decorators/observed-state.js +79 -0
  230. package/dist/decorators/observed-state.js.map +1 -0
  231. package/dist/decorators/step.d.ts +15 -0
  232. package/dist/decorators/step.d.ts.map +1 -0
  233. package/dist/decorators/step.js +110 -0
  234. package/dist/decorators/step.js.map +1 -0
  235. package/dist/decorators/task.d.ts +50 -0
  236. package/dist/decorators/task.d.ts.map +1 -0
  237. package/dist/decorators/task.js +118 -0
  238. package/dist/decorators/task.js.map +1 -0
  239. package/dist/examples/index.d.ts +3 -0
  240. package/dist/examples/index.d.ts.map +1 -0
  241. package/{src/examples/index.ts → dist/examples/index.js} +1 -0
  242. package/dist/examples/index.js.map +1 -0
  243. package/dist/examples/tdd-orchestrator.d.ts +15 -0
  244. package/dist/examples/tdd-orchestrator.d.ts.map +1 -0
  245. package/dist/examples/tdd-orchestrator.js +121 -0
  246. package/dist/examples/tdd-orchestrator.js.map +1 -0
  247. package/dist/examples/test-cycle-workflow.d.ts +14 -0
  248. package/dist/examples/test-cycle-workflow.d.ts.map +1 -0
  249. package/dist/examples/test-cycle-workflow.js +116 -0
  250. package/dist/examples/test-cycle-workflow.js.map +1 -0
  251. package/dist/index.d.ts +27 -0
  252. package/dist/index.d.ts.map +1 -0
  253. package/dist/index.js +40 -0
  254. package/dist/index.js.map +1 -0
  255. package/dist/reflection/index.d.ts +5 -0
  256. package/dist/reflection/index.d.ts.map +1 -0
  257. package/{src/reflection/index.ts → dist/reflection/index.js} +1 -1
  258. package/dist/reflection/index.js.map +1 -0
  259. package/dist/reflection/reflection.d.ts +84 -0
  260. package/dist/reflection/reflection.d.ts.map +1 -0
  261. package/dist/reflection/reflection.js +329 -0
  262. package/dist/reflection/reflection.js.map +1 -0
  263. package/dist/tools/index.d.ts +6 -0
  264. package/dist/tools/index.d.ts.map +1 -0
  265. package/dist/tools/index.js +11 -0
  266. package/dist/tools/index.js.map +1 -0
  267. package/dist/tools/introspection.d.ts +165 -0
  268. package/dist/tools/introspection.d.ts.map +1 -0
  269. package/dist/tools/introspection.js +324 -0
  270. package/dist/tools/introspection.js.map +1 -0
  271. package/dist/types/agent.d.ts +66 -0
  272. package/dist/types/agent.d.ts.map +1 -0
  273. package/dist/types/agent.js +6 -0
  274. package/dist/types/agent.js.map +1 -0
  275. package/dist/types/decorators.d.ts +31 -0
  276. package/dist/types/decorators.d.ts.map +1 -0
  277. package/dist/types/decorators.js +2 -0
  278. package/dist/types/decorators.js.map +1 -0
  279. package/dist/types/error-strategy.d.ts +13 -0
  280. package/dist/types/error-strategy.d.ts.map +1 -0
  281. package/dist/types/error-strategy.js +2 -0
  282. package/dist/types/error-strategy.js.map +1 -0
  283. package/dist/types/error.d.ts +20 -0
  284. package/dist/types/error.d.ts.map +1 -0
  285. package/dist/types/error.js +2 -0
  286. package/dist/types/error.js.map +1 -0
  287. package/dist/types/events.d.ts +87 -0
  288. package/dist/types/events.d.ts.map +1 -0
  289. package/dist/types/events.js +2 -0
  290. package/dist/types/events.js.map +1 -0
  291. package/dist/types/index.d.ts +15 -0
  292. package/dist/types/index.d.ts.map +1 -0
  293. package/dist/types/index.js +2 -0
  294. package/dist/types/index.js.map +1 -0
  295. package/dist/types/logging.d.ts +24 -0
  296. package/dist/types/logging.d.ts.map +1 -0
  297. package/dist/types/logging.js +2 -0
  298. package/dist/types/logging.js.map +1 -0
  299. package/dist/types/observer.d.ts +18 -0
  300. package/dist/types/observer.d.ts.map +1 -0
  301. package/dist/types/observer.js +2 -0
  302. package/dist/types/observer.js.map +1 -0
  303. package/dist/types/prompt.d.ts +31 -0
  304. package/dist/types/prompt.d.ts.map +1 -0
  305. package/dist/types/prompt.js +6 -0
  306. package/dist/types/prompt.js.map +1 -0
  307. package/dist/types/reflection.d.ts +96 -0
  308. package/dist/types/reflection.d.ts.map +1 -0
  309. package/dist/types/reflection.js +24 -0
  310. package/dist/types/reflection.js.map +1 -0
  311. package/dist/types/sdk-primitives.d.ts +118 -0
  312. package/dist/types/sdk-primitives.d.ts.map +1 -0
  313. package/dist/types/sdk-primitives.js +6 -0
  314. package/dist/types/sdk-primitives.js.map +1 -0
  315. package/{src/types/snapshot.ts → dist/types/snapshot.d.ts} +5 -5
  316. package/dist/types/snapshot.d.ts.map +1 -0
  317. package/dist/types/snapshot.js +2 -0
  318. package/dist/types/snapshot.js.map +1 -0
  319. package/dist/types/workflow-context.d.ts +139 -0
  320. package/dist/types/workflow-context.d.ts.map +1 -0
  321. package/dist/types/workflow-context.js +8 -0
  322. package/dist/types/workflow-context.js.map +1 -0
  323. package/dist/types/workflow.d.ts +30 -0
  324. package/dist/types/workflow.d.ts.map +1 -0
  325. package/dist/types/workflow.js +2 -0
  326. package/dist/types/workflow.js.map +1 -0
  327. package/dist/utils/id.d.ts +6 -0
  328. package/dist/utils/id.d.ts.map +1 -0
  329. package/dist/utils/id.js +12 -0
  330. package/dist/utils/id.js.map +1 -0
  331. package/{src/utils/index.ts → dist/utils/index.d.ts} +2 -0
  332. package/dist/utils/index.d.ts.map +1 -0
  333. package/dist/utils/index.js +4 -0
  334. package/dist/utils/index.js.map +1 -0
  335. package/dist/utils/observable.d.ts +54 -0
  336. package/dist/utils/observable.d.ts.map +1 -0
  337. package/dist/utils/observable.js +82 -0
  338. package/dist/utils/observable.js.map +1 -0
  339. package/dist/utils/workflow-error-utils.d.ts +22 -0
  340. package/dist/utils/workflow-error-utils.d.ts.map +1 -0
  341. package/dist/utils/workflow-error-utils.js +45 -0
  342. package/dist/utils/workflow-error-utils.js.map +1 -0
  343. package/package.json +7 -2
  344. package/.claude/settings.local.json +0 -9
  345. package/.claude/system_prompts/task-breakdown.md +0 -100
  346. package/PRPs/001-hierarchical-workflow-engine.md +0 -2438
  347. package/PRPs/PRDs/001-hierarchical-workflow-engine.md +0 -543
  348. package/PRPs/PRDs/002-agent-prompt.md +0 -390
  349. package/PRPs/PRDs/003-agent-prompt.md +0 -943
  350. package/PRPs/PRDs/004-agent-prompt.md +0 -1136
  351. package/PRPs/PRDs/tasks-001.json +0 -492
  352. package/PRPs/README.md +0 -83
  353. package/PRPs/templates/prp_base.md +0 -222
  354. package/docs/agent.md +0 -422
  355. package/docs/prompt.md +0 -419
  356. package/docs/workflow.md +0 -600
  357. package/examples/README.md +0 -244
  358. package/examples/examples/01-basic-workflow.ts +0 -100
  359. package/examples/examples/02-decorator-options.ts +0 -217
  360. package/examples/examples/03-parent-child.ts +0 -241
  361. package/examples/examples/04-observers-debugger.ts +0 -340
  362. package/examples/examples/05-error-handling.ts +0 -387
  363. package/examples/examples/06-concurrent-tasks.ts +0 -352
  364. package/examples/examples/07-agent-loops.ts +0 -432
  365. package/examples/examples/08-sdk-features.ts +0 -667
  366. package/examples/examples/09-reflection.ts +0 -573
  367. package/examples/examples/10-introspection.ts +0 -550
  368. package/examples/index.ts +0 -143
  369. package/examples/utils/helpers.ts +0 -57
  370. package/llms_full.txt +0 -5890
  371. package/plan/P1P2/PRP.md +0 -527
  372. package/plan/P1P2/research/LRU_CACHE_BEST_PRACTICES.md +0 -1929
  373. package/plan/P1P2/research/LRU_CACHE_CODE_PATTERNS.md +0 -857
  374. package/plan/P1P2/research/LRU_CACHE_INTEGRATION_GUIDE.md +0 -738
  375. package/plan/P1P2/research/LRU_CACHE_RESEARCH_INDEX.md +0 -424
  376. package/plan/P1P2/research/REFLECTION_INDEX.md +0 -291
  377. package/plan/P1P2/research/REFLECTION_RESEARCH_REPORT.md +0 -1342
  378. package/plan/P1P2/research/RESEARCH_SUMMARY.md +0 -342
  379. package/plan/P1P2/research/anthropic-sdk.md +0 -174
  380. package/plan/P1P2/research/async-local-storage.md +0 -200
  381. package/plan/P1P2/research/reflection-code-patterns.md +0 -1205
  382. package/plan/P1P2/research/reflection-decision-matrix.md +0 -421
  383. package/plan/P1P2/research/reflection-implementation-guide.md +0 -1341
  384. package/plan/P1P2/research/reflection-integration-guide.md +0 -834
  385. package/plan/P1P2/research/reflection-patterns.md +0 -1468
  386. package/plan/P1P2/research/reflection-quick-reference.md +0 -558
  387. package/plan/P1P2/research/zod-schema.md +0 -152
  388. package/plan/P3P4/PRP.md +0 -1388
  389. package/plan/P3P4/research/caching-lru.md +0 -116
  390. package/plan/P3P4/research/introspection-tools.md +0 -177
  391. package/plan/P3P4/research/reflection-patterns.md +0 -117
  392. package/plan/P4P5/PRP.md +0 -1136
  393. package/plan/P4P5/research/RESEARCH_SUMMARY.md +0 -151
  394. package/plan/architecture/external_deps.md +0 -358
  395. package/plan/architecture/system_context.md +0 -242
  396. package/plan/backlog.json +0 -867
  397. package/plan/research/INTROSPECTION_RESEARCH_SUMMARY.md +0 -378
  398. package/plan/research/README-INTROSPECTION.md +0 -352
  399. package/plan/research/agent-introspection-patterns.md +0 -1085
  400. package/plan/research/introspection-security-guide.md +0 -928
  401. package/plan/research/introspection-tool-examples.md +0 -875
  402. package/scripts/generate-llms-full.ts +0 -206
  403. package/src/__tests__/integration/agent-workflow.test.ts +0 -256
  404. package/src/__tests__/integration/tree-mirroring.test.ts +0 -114
  405. package/src/__tests__/unit/agent.test.ts +0 -169
  406. package/src/__tests__/unit/cache-key.test.ts +0 -182
  407. package/src/__tests__/unit/cache.test.ts +0 -172
  408. package/src/__tests__/unit/context.test.ts +0 -138
  409. package/src/__tests__/unit/decorators.test.ts +0 -100
  410. package/src/__tests__/unit/introspection-tools.test.ts +0 -277
  411. package/src/__tests__/unit/prompt.test.ts +0 -135
  412. package/src/__tests__/unit/reflection.test.ts +0 -210
  413. package/src/__tests__/unit/tree-debugger.test.ts +0 -85
  414. package/src/__tests__/unit/workflow.test.ts +0 -81
  415. package/src/cache/cache-key.ts +0 -244
  416. package/src/cache/cache.ts +0 -236
  417. package/src/core/agent.ts +0 -573
  418. package/src/core/event-tree.ts +0 -260
  419. package/src/core/logger.ts +0 -87
  420. package/src/core/mcp-handler.ts +0 -184
  421. package/src/core/prompt.ts +0 -150
  422. package/src/core/workflow-context.ts +0 -349
  423. package/src/core/workflow.ts +0 -302
  424. package/src/debugger/tree-debugger.ts +0 -210
  425. package/src/decorators/observed-state.ts +0 -95
  426. package/src/decorators/step.ts +0 -139
  427. package/src/decorators/task.ts +0 -96
  428. package/src/examples/tdd-orchestrator.ts +0 -65
  429. package/src/examples/test-cycle-workflow.ts +0 -64
  430. package/src/index.ts +0 -140
  431. package/src/reflection/reflection.ts +0 -407
  432. package/src/tools/index.ts +0 -36
  433. package/src/tools/introspection.ts +0 -464
  434. package/src/types/agent.ts +0 -90
  435. package/src/types/decorators.ts +0 -25
  436. package/src/types/error-strategy.ts +0 -13
  437. package/src/types/error.ts +0 -20
  438. package/src/types/events.ts +0 -74
  439. package/src/types/index.ts +0 -55
  440. package/src/types/logging.ts +0 -24
  441. package/src/types/observer.ts +0 -18
  442. package/src/types/prompt.ts +0 -40
  443. package/src/types/reflection.ts +0 -117
  444. package/src/types/sdk-primitives.ts +0 -128
  445. package/src/types/workflow-context.ts +0 -163
  446. package/src/types/workflow.ts +0 -37
  447. package/src/utils/id.ts +0 -11
  448. package/src/utils/observable.ts +0 -77
  449. package/tasks.json +0 -0
  450. package/tsconfig.json +0 -22
  451. package/vitest.config.ts +0 -16
@@ -0,0 +1,426 @@
1
+ /**
2
+ * Agent - Lightweight wrapper around Anthropic's Agent SDK
3
+ *
4
+ * Agents execute prompts and manage tool invocation cycles.
5
+ * All configuration properties map 1:1 to Anthropic SDK.
6
+ */
7
+ import Anthropic from '@anthropic-ai/sdk';
8
+ import { MCPHandler } from './mcp-handler.js';
9
+ import { generateId } from '../utils/id.js';
10
+ import { getExecutionContext } from './context.js';
11
+ import { generateCacheKey, defaultCache } from '../cache/index.js';
12
+ /**
13
+ * Agent class - executes prompts via Anthropic SDK
14
+ */
15
+ export class Agent {
16
+ /** Unique identifier for this agent instance */
17
+ id;
18
+ /** Agent name */
19
+ name;
20
+ /** Stored configuration */
21
+ config;
22
+ /** Anthropic client instance */
23
+ client;
24
+ /** MCP handler for tool management */
25
+ mcpHandler;
26
+ /** Direct MCPHandler instances for delegated execution */
27
+ mcpHandlers = [];
28
+ /** Default model to use */
29
+ model;
30
+ /**
31
+ * Create a new Agent instance
32
+ * @param config Agent configuration
33
+ */
34
+ constructor(config = {}) {
35
+ this.id = generateId();
36
+ this.name = config.name ?? 'Agent';
37
+ this.config = config;
38
+ this.model = config.model ?? 'claude-sonnet-4-20250514';
39
+ // Create Anthropic client
40
+ this.client = new Anthropic({
41
+ apiKey: process.env.ANTHROPIC_API_KEY,
42
+ });
43
+ // Initialize MCP handler
44
+ this.mcpHandler = new MCPHandler();
45
+ // Register MCP servers
46
+ if (config.mcps) {
47
+ for (const mcp of config.mcps) {
48
+ // If the MCP is already an MCPHandler instance, store it directly
49
+ // for delegated tool execution (preserves registered executors)
50
+ if (mcp instanceof MCPHandler) {
51
+ this.mcpHandlers.push(mcp);
52
+ }
53
+ // Always register with main handler for tool discovery
54
+ this.mcpHandler.registerServer(mcp);
55
+ }
56
+ }
57
+ }
58
+ /**
59
+ * Execute a prompt and return validated response
60
+ * @param prompt Prompt to execute
61
+ * @param overrides Optional overrides for this execution
62
+ * @returns Validated response of type T
63
+ */
64
+ async prompt(prompt, overrides) {
65
+ const result = await this.executePrompt(prompt, overrides);
66
+ return result.data;
67
+ }
68
+ /**
69
+ * Execute a prompt with full result metadata
70
+ * @param prompt Prompt to execute
71
+ * @param overrides Optional overrides for this execution
72
+ * @returns Full result including metadata
73
+ */
74
+ async promptWithMetadata(prompt, overrides) {
75
+ return this.executePrompt(prompt, overrides);
76
+ }
77
+ /**
78
+ * Execute a prompt with reflection capabilities
79
+ * @param prompt Prompt to execute
80
+ * @param overrides Optional overrides for this execution
81
+ * @returns Validated response of type T
82
+ */
83
+ async reflect(prompt, overrides) {
84
+ // Add reflection system prefix if reflection is enabled
85
+ const reflectionEnabled = prompt.enableReflection ??
86
+ overrides?.enableReflection ??
87
+ this.config.enableReflection;
88
+ const systemPrefix = reflectionEnabled
89
+ ? 'Before answering, reflect on your reasoning step by step. Consider alternative approaches and potential errors. Then provide your final answer.\n\n'
90
+ : '';
91
+ const effectiveOverrides = {
92
+ ...overrides,
93
+ system: systemPrefix +
94
+ (prompt.systemOverride ?? overrides?.system ?? this.config.system ?? ''),
95
+ };
96
+ const result = await this.executePrompt(prompt, effectiveOverrides);
97
+ return result.data;
98
+ }
99
+ /**
100
+ * Get the MCP handler for custom tool registration
101
+ */
102
+ getMcpHandler() {
103
+ return this.mcpHandler;
104
+ }
105
+ /**
106
+ * Emit an event if within workflow context
107
+ */
108
+ emitWorkflowEvent(event) {
109
+ const ctx = getExecutionContext();
110
+ if (ctx) {
111
+ ctx.emitEvent(event);
112
+ }
113
+ }
114
+ /**
115
+ * Internal prompt execution with full flow
116
+ */
117
+ async executePrompt(prompt, overrides) {
118
+ const startTime = Date.now();
119
+ let toolCallCount = 0;
120
+ let totalUsage = { input_tokens: 0, output_tokens: 0 };
121
+ // Get execution context for event emission
122
+ const ctx = getExecutionContext();
123
+ // Merge configuration: Prompt > Overrides > Config
124
+ const effectiveSystem = prompt.systemOverride ?? overrides?.system ?? this.config.system;
125
+ const effectiveModel = overrides?.model ?? this.model;
126
+ const effectiveMaxTokens = overrides?.maxTokens ?? this.config.maxTokens ?? 4096;
127
+ const effectiveTemperature = overrides?.temperature ?? this.config.temperature;
128
+ // Check cache if enabled
129
+ const cacheEnabled = this.config.enableCache && !overrides?.disableCache;
130
+ let cacheKey;
131
+ if (cacheEnabled) {
132
+ const cacheInputs = {
133
+ user: prompt.buildUserMessage(),
134
+ data: prompt.getData(),
135
+ system: effectiveSystem,
136
+ model: effectiveModel,
137
+ temperature: effectiveTemperature,
138
+ maxTokens: effectiveMaxTokens,
139
+ tools: this.config.tools,
140
+ mcps: this.config.mcps,
141
+ skills: this.config.skills,
142
+ responseFormat: prompt.getResponseFormat(),
143
+ };
144
+ cacheKey = generateCacheKey(cacheInputs);
145
+ const cached = await defaultCache.get(cacheKey);
146
+ if (cached) {
147
+ // Emit cache hit event
148
+ if (ctx) {
149
+ this.emitWorkflowEvent({
150
+ type: 'cacheHit',
151
+ key: cacheKey,
152
+ node: ctx.workflowNode,
153
+ });
154
+ }
155
+ return cached;
156
+ }
157
+ // Emit cache miss event
158
+ if (ctx) {
159
+ this.emitWorkflowEvent({
160
+ type: 'cacheMiss',
161
+ key: cacheKey,
162
+ node: ctx.workflowNode,
163
+ });
164
+ }
165
+ }
166
+ // Emit prompt start event if in workflow context
167
+ if (ctx) {
168
+ this.emitWorkflowEvent({
169
+ type: 'agentPromptStart',
170
+ agentId: this.id,
171
+ agentName: this.name,
172
+ promptId: prompt.id,
173
+ node: ctx.workflowNode,
174
+ });
175
+ }
176
+ const effectiveTools = this.mergeTools(prompt.toolsOverride ?? overrides?.tools ?? this.config.tools);
177
+ const effectiveHooks = this.mergeHooks(prompt.hooksOverride, overrides?.hooks, this.config.hooks);
178
+ const effectiveStop = overrides?.stop;
179
+ // Set up environment variables
180
+ const originalEnv = this.setupEnvironment(overrides?.env ?? this.config.env);
181
+ try {
182
+ // Call session start hooks
183
+ await this.callHooks(effectiveHooks?.sessionStart, {
184
+ agentId: this.id,
185
+ agentName: this.name,
186
+ });
187
+ // Build initial messages
188
+ const messages = [
189
+ { role: 'user', content: prompt.buildUserMessage() },
190
+ ];
191
+ // Execute conversation loop
192
+ let response = await this.callApi(messages, effectiveSystem, effectiveTools, effectiveModel, effectiveMaxTokens, effectiveTemperature, effectiveStop);
193
+ totalUsage = this.addUsage(totalUsage, response.usage);
194
+ // Handle tool use loop
195
+ while (response.stop_reason === 'tool_use') {
196
+ const toolUseBlocks = response.content.filter((block) => block.type === 'tool_use');
197
+ const toolResults = [];
198
+ for (const toolUse of toolUseBlocks) {
199
+ toolCallCount++;
200
+ // Call pre-tool hooks
201
+ await this.callHooks(effectiveHooks?.preToolUse, {
202
+ toolName: toolUse.name,
203
+ toolInput: toolUse.input,
204
+ agentId: this.id,
205
+ });
206
+ const toolStartTime = Date.now();
207
+ // Execute tool
208
+ const result = await this.executeTool(toolUse.name, toolUse.input);
209
+ const toolDuration = Date.now() - toolStartTime;
210
+ // Emit tool invocation event if in workflow context
211
+ if (ctx) {
212
+ this.emitWorkflowEvent({
213
+ type: 'toolInvocation',
214
+ toolName: toolUse.name,
215
+ input: toolUse.input,
216
+ output: result,
217
+ duration: toolDuration,
218
+ node: ctx.workflowNode,
219
+ });
220
+ }
221
+ // Call post-tool hooks
222
+ await this.callHooks(effectiveHooks?.postToolUse, {
223
+ toolName: toolUse.name,
224
+ toolInput: toolUse.input,
225
+ toolOutput: result,
226
+ agentId: this.id,
227
+ duration: toolDuration,
228
+ });
229
+ toolResults.push({
230
+ type: 'tool_result',
231
+ tool_use_id: toolUse.id,
232
+ content: typeof result === 'string' ? result : JSON.stringify(result),
233
+ });
234
+ }
235
+ // Add assistant message with tool uses
236
+ messages.push({ role: 'assistant', content: response.content });
237
+ // Add tool results
238
+ messages.push({ role: 'user', content: toolResults });
239
+ // Continue conversation
240
+ response = await this.callApi(messages, effectiveSystem, effectiveTools, effectiveModel, effectiveMaxTokens, effectiveTemperature, effectiveStop);
241
+ totalUsage = this.addUsage(totalUsage, response.usage);
242
+ }
243
+ // Extract text response
244
+ const textContent = response.content.find((block) => block.type === 'text');
245
+ if (!textContent) {
246
+ throw new Error('No text response received from API');
247
+ }
248
+ // Parse JSON from response
249
+ const jsonMatch = textContent.text.match(/\{[\s\S]*\}/);
250
+ if (!jsonMatch) {
251
+ throw new Error('No JSON object found in response');
252
+ }
253
+ const parsed = JSON.parse(jsonMatch[0]);
254
+ // Validate with schema
255
+ const validated = prompt.validateResponse(parsed);
256
+ // Call session end hooks
257
+ await this.callHooks(effectiveHooks?.sessionEnd, {
258
+ agentId: this.id,
259
+ agentName: this.name,
260
+ totalDuration: Date.now() - startTime,
261
+ });
262
+ const duration = Date.now() - startTime;
263
+ // Emit prompt end event if in workflow context
264
+ if (ctx) {
265
+ this.emitWorkflowEvent({
266
+ type: 'agentPromptEnd',
267
+ agentId: this.id,
268
+ agentName: this.name,
269
+ promptId: prompt.id,
270
+ node: ctx.workflowNode,
271
+ duration,
272
+ tokenUsage: totalUsage,
273
+ });
274
+ }
275
+ const result = {
276
+ data: validated,
277
+ usage: totalUsage,
278
+ duration,
279
+ toolCalls: toolCallCount,
280
+ };
281
+ // Store in cache if enabled
282
+ if (cacheEnabled && cacheKey) {
283
+ await defaultCache.set(cacheKey, result, { prefix: this.id });
284
+ }
285
+ return result;
286
+ }
287
+ finally {
288
+ // Restore environment
289
+ this.restoreEnvironment(originalEnv);
290
+ }
291
+ }
292
+ /**
293
+ * Call the Anthropic API
294
+ */
295
+ async callApi(messages, system, tools, model, maxTokens, temperature, stop) {
296
+ const params = {
297
+ model,
298
+ max_tokens: maxTokens,
299
+ messages,
300
+ };
301
+ if (system) {
302
+ params.system = system;
303
+ }
304
+ if (tools && tools.length > 0) {
305
+ params.tools = tools.map((tool) => ({
306
+ name: tool.name,
307
+ description: tool.description,
308
+ input_schema: tool.input_schema,
309
+ }));
310
+ }
311
+ if (temperature !== undefined) {
312
+ params.temperature = temperature;
313
+ }
314
+ if (stop && stop.length > 0) {
315
+ params.stop_sequences = stop;
316
+ }
317
+ return this.client.messages.create(params);
318
+ }
319
+ /**
320
+ * Execute a tool (either direct or via MCP)
321
+ */
322
+ async executeTool(name, input) {
323
+ // First, check stored MCPHandler instances (they have registered executors)
324
+ for (const handler of this.mcpHandlers) {
325
+ if (handler.hasTool(name)) {
326
+ const result = await handler.executeTool(name, input);
327
+ if (result.is_error) {
328
+ throw new Error(result.content);
329
+ }
330
+ return result.content;
331
+ }
332
+ }
333
+ // Fall back to main mcpHandler (for non-MCPHandler MCPServers)
334
+ if (this.mcpHandler.hasTool(name)) {
335
+ const result = await this.mcpHandler.executeTool(name, input);
336
+ if (result.is_error) {
337
+ throw new Error(result.content);
338
+ }
339
+ return result.content;
340
+ }
341
+ // Look for direct tool handler - this would be set by subclasses
342
+ throw new Error(`No handler found for tool '${name}'`);
343
+ }
344
+ /**
345
+ * Merge tools from config and MCP servers
346
+ */
347
+ mergeTools(configTools) {
348
+ const mcpTools = this.mcpHandler.getTools();
349
+ const directTools = configTools ?? [];
350
+ const allTools = [...directTools, ...mcpTools];
351
+ return allTools.length > 0 ? allTools : undefined;
352
+ }
353
+ /**
354
+ * Merge hooks from multiple sources
355
+ */
356
+ mergeHooks(promptHooks, overrideHooks, configHooks) {
357
+ return {
358
+ preToolUse: [
359
+ ...(configHooks?.preToolUse ?? []),
360
+ ...(overrideHooks?.preToolUse ?? []),
361
+ ...(promptHooks?.preToolUse ?? []),
362
+ ],
363
+ postToolUse: [
364
+ ...(configHooks?.postToolUse ?? []),
365
+ ...(overrideHooks?.postToolUse ?? []),
366
+ ...(promptHooks?.postToolUse ?? []),
367
+ ],
368
+ sessionStart: [
369
+ ...(configHooks?.sessionStart ?? []),
370
+ ...(overrideHooks?.sessionStart ?? []),
371
+ ...(promptHooks?.sessionStart ?? []),
372
+ ],
373
+ sessionEnd: [
374
+ ...(configHooks?.sessionEnd ?? []),
375
+ ...(overrideHooks?.sessionEnd ?? []),
376
+ ...(promptHooks?.sessionEnd ?? []),
377
+ ],
378
+ };
379
+ }
380
+ /**
381
+ * Call hooks of a specific type
382
+ */
383
+ async callHooks(hooks, context) {
384
+ if (!hooks)
385
+ return;
386
+ for (const hook of hooks) {
387
+ await hook(context);
388
+ }
389
+ }
390
+ /**
391
+ * Set up environment variables
392
+ */
393
+ setupEnvironment(env) {
394
+ if (!env)
395
+ return {};
396
+ const original = {};
397
+ for (const [key, value] of Object.entries(env)) {
398
+ original[key] = process.env[key];
399
+ process.env[key] = value;
400
+ }
401
+ return original;
402
+ }
403
+ /**
404
+ * Restore environment variables
405
+ */
406
+ restoreEnvironment(original) {
407
+ for (const [key, value] of Object.entries(original)) {
408
+ if (value === undefined) {
409
+ delete process.env[key];
410
+ }
411
+ else {
412
+ process.env[key] = value;
413
+ }
414
+ }
415
+ }
416
+ /**
417
+ * Add token usage from response
418
+ */
419
+ addUsage(total, usage) {
420
+ return {
421
+ input_tokens: total.input_tokens + usage.input_tokens,
422
+ output_tokens: total.output_tokens + usage.output_tokens,
423
+ };
424
+ }
425
+ }
426
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/core/agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAc1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAsBnE;;GAEG;AACH,MAAM,OAAO,KAAK;IAChB,gDAAgD;IAChC,EAAE,CAAS;IAE3B,iBAAiB;IACD,IAAI,CAAS;IAE7B,2BAA2B;IACV,MAAM,CAAc;IAErC,gCAAgC;IACf,MAAM,CAAY;IAEnC,sCAAsC;IACrB,UAAU,CAAa;IAExC,0DAA0D;IACzC,WAAW,GAAiB,EAAE,CAAC;IAEhD,2BAA2B;IACV,KAAK,CAAS;IAE/B;;;OAGG;IACH,YAAY,SAAsB,EAAE;QAClC,IAAI,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,M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O,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC3B,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACK,kBAAkB,CAAC,QAA4C;QACrE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACK,QAAQ,CAAC,KAAiB,EAAE,KAAsB;QACxD,OAAO;YACL,YAAY,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY;YACrD,aAAa,EAAE,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa;SACzD,CAAC;IACJ,CAAC;CACF"}
@@ -4,116 +4,65 @@
4
4
  * Uses Node.js AsyncLocalStorage to automatically propagate context
5
5
  * through async call chains without manual passing.
6
6
  */
7
-
8
7
  import { AsyncLocalStorage } from 'node:async_hooks';
9
8
  import type { WorkflowNode, WorkflowEvent } from '../types/index.js';
10
-
11
9
  /**
12
10
  * Context available during agent/prompt execution
13
11
  */
14
12
  export interface AgentExecutionContext {
15
- /** Current workflow node in the hierarchy */
16
- workflowNode: WorkflowNode;
17
-
18
- /** Function to emit events to the workflow tree */
19
- emitEvent: (event: WorkflowEvent) => void;
20
-
21
- /** Workflow ID for tracking */
22
- workflowId: string;
23
-
24
- /** Parent workflow ID if nested */
25
- parentWorkflowId?: string;
13
+ /** Current workflow node in the hierarchy */
14
+ workflowNode: WorkflowNode;
15
+ /** Function to emit events to the workflow tree */
16
+ emitEvent: (event: WorkflowEvent) => void;
17
+ /** Workflow ID for tracking */
18
+ workflowId: string;
19
+ /** Parent workflow ID if nested */
20
+ parentWorkflowId?: string;
26
21
  }
27
-
28
22
  /**
29
23
  * Global AsyncLocalStorage instance for execution context
30
24
  * Single shared instance per application (recommended pattern)
31
25
  */
32
- const executionContext = new AsyncLocalStorage<AgentExecutionContext>();
33
-
26
+ declare const executionContext: AsyncLocalStorage<AgentExecutionContext>;
34
27
  /**
35
28
  * Get the current execution context
36
29
  * @returns Current context or undefined if not in a workflow
37
30
  */
38
- export function getExecutionContext(): AgentExecutionContext | undefined {
39
- return executionContext.getStore();
40
- }
41
-
31
+ export declare function getExecutionContext(): AgentExecutionContext | undefined;
42
32
  /**
43
33
  * Get the current execution context, throwing if not available
44
34
  * @param operation Name of the operation requiring context
45
35
  * @returns Current context
46
36
  * @throws Error if not within a workflow context
47
37
  */
48
- export function requireExecutionContext(
49
- operation: string
50
- ): AgentExecutionContext {
51
- const context = executionContext.getStore();
52
- if (!context) {
53
- throw new Error(
54
- `${operation} called outside of workflow context. ` +
55
- `Agent/Prompt operations must be executed within a workflow step.`
56
- );
57
- }
58
- return context;
59
- }
60
-
38
+ export declare function requireExecutionContext(operation: string): AgentExecutionContext;
61
39
  /**
62
40
  * Run a function within an execution context
63
41
  * @param context Context to establish
64
42
  * @param fn Function to execute
65
43
  * @returns Result of the function
66
44
  */
67
- export async function runInContext<T>(
68
- context: AgentExecutionContext,
69
- fn: () => Promise<T>
70
- ): Promise<T> {
71
- return executionContext.run(context, fn);
72
- }
73
-
45
+ export declare function runInContext<T>(context: AgentExecutionContext, fn: () => Promise<T>): Promise<T>;
74
46
  /**
75
47
  * Run a synchronous function within an execution context
76
48
  * @param context Context to establish
77
49
  * @param fn Function to execute
78
50
  * @returns Result of the function
79
51
  */
80
- export function runInContextSync<T>(
81
- context: AgentExecutionContext,
82
- fn: () => T
83
- ): T {
84
- return executionContext.run(context, fn);
85
- }
86
-
52
+ export declare function runInContextSync<T>(context: AgentExecutionContext, fn: () => T): T;
87
53
  /**
88
54
  * Check if currently within an execution context
89
55
  * @returns true if context is available
90
56
  */
91
- export function hasExecutionContext(): boolean {
92
- return executionContext.getStore() !== undefined;
93
- }
94
-
57
+ export declare function hasExecutionContext(): boolean;
95
58
  /**
96
59
  * Create a child context with updated node
97
60
  * @param childNode The new workflow node for the child context
98
61
  * @returns New context with child node
99
62
  */
100
- export function createChildContext(
101
- childNode: WorkflowNode
102
- ): AgentExecutionContext | undefined {
103
- const parent = getExecutionContext();
104
- if (!parent) {
105
- return undefined;
106
- }
107
-
108
- return {
109
- workflowNode: childNode,
110
- emitEvent: parent.emitEvent,
111
- workflowId: parent.workflowId,
112
- parentWorkflowId: parent.parentWorkflowId,
113
- };
114
- }
115
-
63
+ export declare function createChildContext(childNode: WorkflowNode): AgentExecutionContext | undefined;
116
64
  /**
117
65
  * Export the raw AsyncLocalStorage for advanced use cases
118
66
  */
119
67
  export { executionContext as agentExecutionStorage };
68
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,YAAY,EAAE,YAAY,CAAC;IAE3B,mDAAmD;IACnD,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAE1C,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IAEnB,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,QAAA,MAAM,gBAAgB,0CAAiD,CAAC;AAExE;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,qBAAqB,GAAG,SAAS,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,GAChB,qBAAqB,CASvB;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,OAAO,EAAE,qBAAqB,EAC9B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,OAAO,EAAE,qBAAqB,EAC9B,EAAE,EAAE,MAAM,CAAC,GACV,CAAC,CAEH;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,YAAY,GACtB,qBAAqB,GAAG,SAAS,CAYnC;AAED;;GAEG;AACH,OAAO,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * AgentExecutionContext - Provides zero-plumbing context propagation
3
+ *
4
+ * Uses Node.js AsyncLocalStorage to automatically propagate context
5
+ * through async call chains without manual passing.
6
+ */
7
+ import { AsyncLocalStorage } from 'node:async_hooks';
8
+ /**
9
+ * Global AsyncLocalStorage instance for execution context
10
+ * Single shared instance per application (recommended pattern)
11
+ */
12
+ const executionContext = new AsyncLocalStorage();
13
+ /**
14
+ * Get the current execution context
15
+ * @returns Current context or undefined if not in a workflow
16
+ */
17
+ export function getExecutionContext() {
18
+ return executionContext.getStore();
19
+ }
20
+ /**
21
+ * Get the current execution context, throwing if not available
22
+ * @param operation Name of the operation requiring context
23
+ * @returns Current context
24
+ * @throws Error if not within a workflow context
25
+ */
26
+ export function requireExecutionContext(operation) {
27
+ const context = executionContext.getStore();
28
+ if (!context) {
29
+ throw new Error(`${operation} called outside of workflow context. ` +
30
+ `Agent/Prompt operations must be executed within a workflow step.`);
31
+ }
32
+ return context;
33
+ }
34
+ /**
35
+ * Run a function within an execution context
36
+ * @param context Context to establish
37
+ * @param fn Function to execute
38
+ * @returns Result of the function
39
+ */
40
+ export async function runInContext(context, fn) {
41
+ return executionContext.run(context, fn);
42
+ }
43
+ /**
44
+ * Run a synchronous function within an execution context
45
+ * @param context Context to establish
46
+ * @param fn Function to execute
47
+ * @returns Result of the function
48
+ */
49
+ export function runInContextSync(context, fn) {
50
+ return executionContext.run(context, fn);
51
+ }
52
+ /**
53
+ * Check if currently within an execution context
54
+ * @returns true if context is available
55
+ */
56
+ export function hasExecutionContext() {
57
+ return executionContext.getStore() !== undefined;
58
+ }
59
+ /**
60
+ * Create a child context with updated node
61
+ * @param childNode The new workflow node for the child context
62
+ * @returns New context with child node
63
+ */
64
+ export function createChildContext(childNode) {
65
+ const parent = getExecutionContext();
66
+ if (!parent) {
67
+ return undefined;
68
+ }
69
+ return {
70
+ workflowNode: childNode,
71
+ emitEvent: parent.emitEvent,
72
+ workflowId: parent.workflowId,
73
+ parentWorkflowId: parent.parentWorkflowId,
74
+ };
75
+ }
76
+ /**
77
+ * Export the raw AsyncLocalStorage for advanced use cases
78
+ */
79
+ export { executionContext as agentExecutionStorage };
80
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAoBrD;;;GAGG;AACH,MAAM,gBAAgB,GAAG,IAAI,iBAAiB,EAAyB,CAAC;AAExE;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,gBAAgB,CAAC,QAAQ,EAAE,CAAC;AACrC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,SAAiB;IAEjB,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,GAAG,SAAS,uCAAuC;YACjD,kEAAkE,C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