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,72 @@
1
+ /**
2
+ * EventTreeHandle - Queryable interface for the workflow event tree
3
+ *
4
+ * Provides methods for traversing and querying the event tree
5
+ * that mirrors workflow execution.
6
+ */
7
+ import type { EventTreeHandle, EventNode } from '../types/workflow-context.js';
8
+ import type { WorkflowNode } from '../types/index.js';
9
+ /**
10
+ * Implementation of EventTreeHandle
11
+ */
12
+ export declare class EventTreeHandleImpl implements EventTreeHandle {
13
+ /** Root node of the tree */
14
+ readonly root: EventNode;
15
+ /** Index of nodes by ID for fast lookup */
16
+ private nodeIndex;
17
+ /**
18
+ * Create a new EventTreeHandle from a workflow node
19
+ * @param workflowNode Root workflow node
20
+ */
21
+ constructor(workflowNode: WorkflowNode);
22
+ /**
23
+ * Get a node by ID
24
+ * @param id Node ID to find
25
+ */
26
+ getNode(id: string): EventNode | undefined;
27
+ /**
28
+ * Get all children of a node
29
+ * @param id Parent node ID
30
+ */
31
+ getChildren(id: string): EventNode[];
32
+ /**
33
+ * Get all ancestors of a node (from node up to root, excluding the node itself)
34
+ * @param id Node ID
35
+ */
36
+ getAncestors(id: string): EventNode[];
37
+ /**
38
+ * Export tree as JSON
39
+ */
40
+ toJSON(): EventNode;
41
+ /**
42
+ * Rebuild the tree from an updated workflow node
43
+ * @param workflowNode Updated workflow node
44
+ */
45
+ rebuild(workflowNode: WorkflowNode): void;
46
+ /**
47
+ * Build an EventNode from a WorkflowNode
48
+ */
49
+ private buildEventNode;
50
+ /**
51
+ * Convert a WorkflowEvent to an EventNode
52
+ */
53
+ private eventToNode;
54
+ /**
55
+ * Extract metrics from a workflow node
56
+ */
57
+ private extractMetrics;
58
+ /**
59
+ * Build index of all nodes
60
+ */
61
+ private buildIndex;
62
+ /**
63
+ * Deep clone a node for JSON export
64
+ */
65
+ private cloneNode;
66
+ }
67
+ /**
68
+ * Create an EventTreeHandle from a workflow node
69
+ * @param workflowNode Root workflow node
70
+ */
71
+ export declare function createEventTreeHandle(workflowNode: WorkflowNode): EventTreeHandle;
72
+ //# sourceMappingURL=event-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-tree.d.ts","sourceRoot":"","sources":["../../src/core/event-tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,SAAS,EAEV,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,mBAAmB,CAAC;AAErE;;GAEG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD,4BAA4B;IAC5B,SAAgB,IAAI,EAAE,SAAS,CAAC;IAEhC,2CAA2C;IAC3C,OAAO,CAAC,SAAS,CAAqC;IAEtD;;;OAGG;gBACS,YAAY,EAAE,YAAY;IAKtC;;;OAGG;IACI,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIjD;;;OAGG;IACI,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE;IAK3C;;;OAGG;IACI,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE;IAmB5C;;OAEG;IACI,MAAM,IAAI,SAAS;IAI1B;;;OAGG;IACI,OAAO,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAchD;;OAEG;IACH,OAAO,CAAC,cAAc;IA8BtB;;OAEG;IACH,OAAO,CAAC,WAAW;IA2EnB;;OAEG;IACH,OAAO,CAAC,cAAc;IAkBtB;;OAEG;IACH,OAAO,CAAC,UAAU;IAOlB;;OAEG;IACH,OAAO,CAAC,SAAS;CAMlB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,YAAY,GACzB,eAAe,CAEjB"}
@@ -0,0 +1,211 @@
1
+ /**
2
+ * EventTreeHandle - Queryable interface for the workflow event tree
3
+ *
4
+ * Provides methods for traversing and querying the event tree
5
+ * that mirrors workflow execution.
6
+ */
7
+ /**
8
+ * Implementation of EventTreeHandle
9
+ */
10
+ export class EventTreeHandleImpl {
11
+ /** Root node of the tree */
12
+ root;
13
+ /** Index of nodes by ID for fast lookup */
14
+ nodeIndex = new Map();
15
+ /**
16
+ * Create a new EventTreeHandle from a workflow node
17
+ * @param workflowNode Root workflow node
18
+ */
19
+ constructor(workflowNode) {
20
+ this.root = this.buildEventNode(workflowNode);
21
+ this.buildIndex(this.root);
22
+ }
23
+ /**
24
+ * Get a node by ID
25
+ * @param id Node ID to find
26
+ */
27
+ getNode(id) {
28
+ return this.nodeIndex.get(id);
29
+ }
30
+ /**
31
+ * Get all children of a node
32
+ * @param id Parent node ID
33
+ */
34
+ getChildren(id) {
35
+ const node = this.nodeIndex.get(id);
36
+ return node?.children ?? [];
37
+ }
38
+ /**
39
+ * Get all ancestors of a node (from node up to root, excluding the node itself)
40
+ * @param id Node ID
41
+ */
42
+ getAncestors(id) {
43
+ const ancestors = [];
44
+ const node = this.nodeIndex.get(id);
45
+ if (!node || !node.parentId) {
46
+ return ancestors;
47
+ }
48
+ let currentId = node.parentId;
49
+ while (currentId) {
50
+ const parent = this.nodeIndex.get(currentId);
51
+ if (!parent)
52
+ break;
53
+ ancestors.push(parent);
54
+ currentId = parent.parentId ?? '';
55
+ }
56
+ return ancestors;
57
+ }
58
+ /**
59
+ * Export tree as JSON
60
+ */
61
+ toJSON() {
62
+ return this.cloneNode(this.root);
63
+ }
64
+ /**
65
+ * Rebuild the tree from an updated workflow node
66
+ * @param workflowNode Updated workflow node
67
+ */
68
+ rebuild(workflowNode) {
69
+ const newRoot = this.buildEventNode(workflowNode);
70
+ this.root.children = newRoot.children;
71
+ Object.assign(this.root, {
72
+ type: newRoot.type,
73
+ name: newRoot.name,
74
+ timestamp: newRoot.timestamp,
75
+ metrics: newRoot.metrics,
76
+ });
77
+ this.nodeIndex.clear();
78
+ this.buildIndex(this.root);
79
+ }
80
+ /**
81
+ * Build an EventNode from a WorkflowNode
82
+ */
83
+ buildEventNode(wfNode, parentId) {
84
+ const eventNode = {
85
+ id: wfNode.id,
86
+ type: 'workflow',
87
+ timestamp: Date.now(),
88
+ name: wfNode.name,
89
+ parentId,
90
+ children: [],
91
+ metrics: this.extractMetrics(wfNode),
92
+ };
93
+ // Add event nodes from workflow events
94
+ for (const event of wfNode.events) {
95
+ const childNode = this.eventToNode(event, wfNode.id);
96
+ if (childNode) {
97
+ eventNode.children.push(childNode);
98
+ }
99
+ }
100
+ // Add child workflow nodes
101
+ for (const child of wfNode.children) {
102
+ eventNode.children.push(this.buildEventNode(child, wfNode.id));
103
+ }
104
+ return eventNode;
105
+ }
106
+ /**
107
+ * Convert a WorkflowEvent to an EventNode
108
+ */
109
+ eventToNode(event, parentId) {
110
+ const baseNode = {
111
+ id: `${parentId}-${event.type}-${Date.now()}`,
112
+ timestamp: Date.now(),
113
+ parentId,
114
+ children: [],
115
+ };
116
+ switch (event.type) {
117
+ case 'stepStart':
118
+ return {
119
+ ...baseNode,
120
+ type: 'step',
121
+ name: event.step,
122
+ };
123
+ case 'stepEnd':
124
+ return {
125
+ ...baseNode,
126
+ type: 'stepComplete',
127
+ name: event.step,
128
+ metrics: { duration: event.duration },
129
+ };
130
+ case 'agentPromptStart':
131
+ return {
132
+ ...baseNode,
133
+ id: `${event.agentId}-prompt-${event.promptId}`,
134
+ type: 'agentPrompt',
135
+ name: event.agentName,
136
+ payload: { promptId: event.promptId },
137
+ };
138
+ case 'agentPromptEnd':
139
+ return {
140
+ ...baseNode,
141
+ id: `${event.agentId}-promptEnd-${event.promptId}`,
142
+ type: 'agentPromptComplete',
143
+ name: event.agentName,
144
+ metrics: {
145
+ duration: event.duration,
146
+ tokenUsage: event.tokenUsage
147
+ ? {
148
+ input: event.tokenUsage.input_tokens,
149
+ output: event.tokenUsage.output_tokens,
150
+ }
151
+ : undefined,
152
+ },
153
+ };
154
+ case 'toolInvocation':
155
+ return {
156
+ ...baseNode,
157
+ type: 'tool',
158
+ name: event.toolName,
159
+ payload: { input: event.input, output: event.output },
160
+ metrics: { duration: event.duration },
161
+ };
162
+ case 'error':
163
+ return {
164
+ ...baseNode,
165
+ type: 'error',
166
+ name: event.error.message,
167
+ payload: event.error,
168
+ };
169
+ default:
170
+ return null;
171
+ }
172
+ }
173
+ /**
174
+ * Extract metrics from a workflow node
175
+ */
176
+ extractMetrics(wfNode) {
177
+ // Calculate total duration from step events
178
+ const stepEndEvents = wfNode.events.filter((e) => e.type === 'stepEnd');
179
+ if (stepEndEvents.length === 0) {
180
+ return undefined;
181
+ }
182
+ const totalDuration = stepEndEvents.reduce((sum, e) => sum + e.duration, 0);
183
+ return { duration: totalDuration };
184
+ }
185
+ /**
186
+ * Build index of all nodes
187
+ */
188
+ buildIndex(node) {
189
+ this.nodeIndex.set(node.id, node);
190
+ for (const child of node.children) {
191
+ this.buildIndex(child);
192
+ }
193
+ }
194
+ /**
195
+ * Deep clone a node for JSON export
196
+ */
197
+ cloneNode(node) {
198
+ return {
199
+ ...node,
200
+ children: node.children.map((c) => this.cloneNode(c)),
201
+ };
202
+ }
203
+ }
204
+ /**
205
+ * Create an EventTreeHandle from a workflow node
206
+ * @param workflowNode Root workflow node
207
+ */
208
+ export function createEventTreeHandle(workflowNode) {
209
+ return new EventTreeHandleImpl(workflowNode);
210
+ }
211
+ //# sourceMappingURL=event-tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-tree.js","sourceRoot":"","sources":["../../src/core/event-tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC9B,4BAA4B;IACZ,IAAI,CAAY;IAEhC,2CAA2C;IACnC,SAAS,GAA2B,IAAI,GAAG,EAAE,CAAC;IAEtD;;;OAGG;IACH,YAAY,YAA0B;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,EAAU;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,EAAU;QAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpC,OAAO,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED;;;OAG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AAmB,CAAC,YAAY,CAAC,CAAC;AAC/C,CAAC"}
@@ -4,13 +4,11 @@
4
4
  * These functions provide a simple API for creating workflow components dynamically
5
5
  * at runtime, useful for metaprogramming and agent-driven workflow construction.
6
6
  */
7
-
8
7
  import { Workflow, type WorkflowExecutor } from './workflow.js';
9
8
  import { Agent } from './agent.js';
10
9
  import { Prompt } from './prompt.js';
11
10
  import type { WorkflowConfig } from '../types/workflow-context.js';
12
11
  import type { AgentConfig, PromptConfig } from '../types/index.js';
13
-
14
12
  /**
15
13
  * Create a new Workflow instance
16
14
  *
@@ -32,13 +30,7 @@ import type { AgentConfig, PromptConfig } from '../types/index.js';
32
30
  * const result = await workflow.run();
33
31
  * ```
34
32
  */
35
- export function createWorkflow<T>(
36
- config: WorkflowConfig,
37
- executor: WorkflowExecutor<T>
38
- ): Workflow<T> {
39
- return new Workflow(config, executor);
40
- }
41
-
33
+ export declare function createWorkflow<T>(config: WorkflowConfig, executor: WorkflowExecutor<T>): Workflow<T>;
42
34
  /**
43
35
  * Create a new Agent instance
44
36
  *
@@ -57,10 +49,7 @@ export function createWorkflow<T>(
57
49
  * const result = await agent.prompt(analysisPrompt);
58
50
  * ```
59
51
  */
60
- export function createAgent(config: AgentConfig): Agent {
61
- return new Agent(config);
62
- }
63
-
52
+ export declare function createAgent(config: AgentConfig): Agent;
64
53
  /**
65
54
  * Create a new Prompt instance
66
55
  *
@@ -81,10 +70,7 @@ export function createAgent(config: AgentConfig): Agent {
81
70
  * const result = await agent.prompt(prompt);
82
71
  * ```
83
72
  */
84
- export function createPrompt<T>(config: PromptConfig<T>): Prompt<T> {
85
- return new Prompt(config);
86
- }
87
-
73
+ export declare function createPrompt<T>(config: PromptConfig<T>): Prompt<T>;
88
74
  /**
89
75
  * Create a workflow with an inline executor (shorthand)
90
76
  *
@@ -99,13 +85,7 @@ export function createPrompt<T>(config: PromptConfig<T>): Prompt<T> {
99
85
  * });
100
86
  * ```
101
87
  */
102
- export function quickWorkflow<T>(
103
- name: string,
104
- executor: WorkflowExecutor<T>
105
- ): Workflow<T> {
106
- return new Workflow({ name }, executor);
107
- }
108
-
88
+ export declare function quickWorkflow<T>(name: string, executor: WorkflowExecutor<T>): Workflow<T>;
109
89
  /**
110
90
  * Create a simple agent with minimal configuration (shorthand)
111
91
  *
@@ -118,6 +98,5 @@ export function quickWorkflow<T>(
118
98
  * const agent = quickAgent('Helper', 'You are a helpful assistant.');
119
99
  * ```
120
100
  */
121
- export function quickAgent(name: string, system?: string): Agent {
122
- return new Agent({ name, system });
123
- }
101
+ export declare function quickAgent(name: string, system?: string): Agent;
102
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/core/factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAC5B,QAAQ,CAAC,CAAC,CAAC,CAEb;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,CAEtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAElE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAC5B,QAAQ,CAAC,CAAC,CAAC,CAEb;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAE/D"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Factory Functions - Convenience functions for dynamic workflow, agent, and prompt creation
3
+ *
4
+ * These functions provide a simple API for creating workflow components dynamically
5
+ * at runtime, useful for metaprogramming and agent-driven workflow construction.
6
+ */
7
+ import { Workflow } from './workflow.js';
8
+ import { Agent } from './agent.js';
9
+ import { Prompt } from './prompt.js';
10
+ /**
11
+ * Create a new Workflow instance
12
+ *
13
+ * @param config Workflow configuration
14
+ * @param executor Executor function that receives WorkflowContext
15
+ * @returns Configured Workflow instance
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const workflow = createWorkflow(
20
+ * { name: 'DataPipeline', enableReflection: true },
21
+ * async (ctx) => {
22
+ * const data = await ctx.step('fetch', () => fetchData());
23
+ * const processed = await ctx.step('process', () => processData(data));
24
+ * return processed;
25
+ * }
26
+ * );
27
+ *
28
+ * const result = await workflow.run();
29
+ * ```
30
+ */
31
+ export function createWorkflow(config, executor) {
32
+ return new Workflow(config, executor);
33
+ }
34
+ /**
35
+ * Create a new Agent instance
36
+ *
37
+ * @param config Agent configuration
38
+ * @returns Configured Agent instance
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const agent = createAgent({
43
+ * name: 'DataAnalyst',
44
+ * system: 'You analyze data and provide insights.',
45
+ * enableCache: true,
46
+ * enableReflection: true,
47
+ * });
48
+ *
49
+ * const result = await agent.prompt(analysisPrompt);
50
+ * ```
51
+ */
52
+ export function createAgent(config) {
53
+ return new Agent(config);
54
+ }
55
+ /**
56
+ * Create a new Prompt instance
57
+ *
58
+ * @param config Prompt configuration
59
+ * @returns Configured Prompt instance
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const prompt = createPrompt({
64
+ * user: 'Analyze this data',
65
+ * data: { values: [1, 2, 3, 4, 5] },
66
+ * responseFormat: z.object({
67
+ * summary: z.string(),
68
+ * insights: z.array(z.string()),
69
+ * }),
70
+ * });
71
+ *
72
+ * const result = await agent.prompt(prompt);
73
+ * ```
74
+ */
75
+ export function createPrompt(config) {
76
+ return new Prompt(config);
77
+ }
78
+ /**
79
+ * Create a workflow with an inline executor (shorthand)
80
+ *
81
+ * @param name Workflow name
82
+ * @param executor Executor function
83
+ * @returns Configured Workflow instance
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const workflow = quickWorkflow('ProcessData', async (ctx) => {
88
+ * return await ctx.step('process', () => processData());
89
+ * });
90
+ * ```
91
+ */
92
+ export function quickWorkflow(name, executor) {
93
+ return new Workflow({ name }, executor);
94
+ }
95
+ /**
96
+ * Create a simple agent with minimal configuration (shorthand)
97
+ *
98
+ * @param name Agent name
99
+ * @param system System prompt
100
+ * @returns Configured Agent instance
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const agent = quickAgent('Helper', 'You are a helpful assistant.');
105
+ * ```
106
+ */
107
+ export function quickAgent(name, system) {
108
+ return new Agent({ name, system });
109
+ }
110
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/core/factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAyB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAsB,EACtB,QAA6B;IAE7B,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,WAAW,CAAC,MAAmB;IAC7C,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY,CAAI,MAAuB;IACrD,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,QAA6B;IAE7B,OAAO,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,MAAe;IACtD,OAAO,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACrC,CAAC"}
@@ -5,13 +5,5 @@ export { Prompt } from './prompt.js';
5
5
  export { MCPHandler, type ToolExecutor } from './mcp-handler.js';
6
6
  export { EventTreeHandleImpl, createEventTreeHandle } from './event-tree.js';
7
7
  export { WorkflowContextImpl, createWorkflowContext } from './workflow-context.js';
8
- export {
9
- getExecutionContext,
10
- requireExecutionContext,
11
- runInContext,
12
- runInContextSync,
13
- hasExecutionContext,
14
- createChildContext,
15
- agentExecutionStorage,
16
- type AgentExecutionContext,
17
- } from './context.js';
8
+ export { getExecutionContext, requireExecutionContext, runInContext, runInContextSync, hasExecutionContext, createChildContext, agentExecutionStorage, type AgentExecutionContext, } from './context.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,cAAc,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { WorkflowLogger } from './logger.js';
2
+ export { Workflow } from './workflow.js';
3
+ export { Agent } from './agent.js';
4
+ export { Prompt } from './prompt.js';
5
+ export { MCPHandler } from './mcp-handler.js';
6
+ export { EventTreeHandleImpl, createEventTreeHandle } from './event-tree.js';
7
+ export { WorkflowContextImpl, createWorkflowContext } from './workflow-context.js';
8
+ export { getExecutionContext, requireExecutionContext, runInContext, runInContextSync, hasExecutionContext, createChildContext, agentExecutionStorage, } from './context.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAyB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAqB,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,GAEtB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,50 @@
1
+ import type { WorkflowNode, LogEntry, WorkflowObserver } from '../types/index.js';
2
+ /**
3
+ * Logger that emits log entries to workflow node and observers
4
+ */
5
+ export declare class WorkflowLogger {
6
+ private readonly node;
7
+ private readonly observers;
8
+ private readonly parentLogId?;
9
+ constructor(node: WorkflowNode, observers: WorkflowObserver[], parentLogId?: string);
10
+ /**
11
+ * Emit a log entry directly to the node without notifying observers
12
+ * Used to avoid infinite recursion when observer.onLog() throws
13
+ */
14
+ private emitWithoutObserverNotification;
15
+ /**
16
+ * Emit a log entry to the node and all observers
17
+ */
18
+ private emit;
19
+ /**
20
+ * Create a log entry with the given level
21
+ */
22
+ private log;
23
+ /**
24
+ * Log a debug message
25
+ */
26
+ debug(message: string, data?: unknown): void;
27
+ /**
28
+ * Log an info message
29
+ */
30
+ info(message: string, data?: unknown): void;
31
+ /**
32
+ * Log a warning message
33
+ */
34
+ warn(message: string, data?: unknown): void;
35
+ /**
36
+ * Log an error message
37
+ */
38
+ error(message: string, data?: unknown): void;
39
+ /**
40
+ * Create a child logger that includes parentLogId
41
+ * @param parentLogId - ID of the parent log entry (legacy API)
42
+ */
43
+ child(parentLogId: string): WorkflowLogger;
44
+ /**
45
+ * Create a child logger with metadata
46
+ * @param meta - Partial log entry metadata (typically { parentLogId: string })
47
+ */
48
+ child(meta: Partial<LogEntry>): WorkflowLogger;
49
+ }
50
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAY,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG5F;;GAEG;AACH,qBAAa,cAAc;IAIvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAJ5B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAS;gBAGnB,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,gBAAgB,EAAE,EAC9C,WAAW,CAAC,EAAE,MAAM;IAKtB;;;OAGG;IACH,OAAO,CAAC,+BAA+B;IAIvC;;OAEG;IACH,OAAO,CAAC,IAAI;IAoBZ;;OAEG;IACH,OAAO,CAAC,GAAG;IAkBX;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAI5C;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAI3C;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAI3C;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAI5C;;;OAGG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc;IAC1C;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,cAAc;CAK/C"}
@@ -0,0 +1,91 @@
1
+ import { generateId } from '../utils/id.js';
2
+ /**
3
+ * Logger that emits log entries to workflow node and observers
4
+ */
5
+ export class WorkflowLogger {
6
+ node;
7
+ observers;
8
+ parentLogId;
9
+ constructor(node, observers, parentLogId) {
10
+ this.node = node;
11
+ this.observers = observers;
12
+ this.parentLogId = parentLogId;
13
+ }
14
+ /**
15
+ * Emit a log entry directly to the node without notifying observers
16
+ * Used to avoid infinite recursion when observer.onLog() throws
17
+ */
18
+ emitWithoutObserverNotification(entry) {
19
+ this.node.logs.push(entry);
20
+ }
21
+ /**
22
+ * Emit a log entry to the node and all observers
23
+ */
24
+ emit(entry) {
25
+ this.node.logs.push(entry);
26
+ for (const obs of this.observers) {
27
+ try {
28
+ obs.onLog(entry);
29
+ }
30
+ catch (err) {
31
+ // Create error entry and emit without observer notification to avoid infinite recursion
32
+ const errorEntry = {
33
+ id: generateId(),
34
+ workflowId: this.node.id,
35
+ timestamp: Date.now(),
36
+ level: 'error',
37
+ message: 'Observer onLog error',
38
+ data: { error: err },
39
+ };
40
+ this.emitWithoutObserverNotification(errorEntry);
41
+ }
42
+ }
43
+ }
44
+ /**
45
+ * Create a log entry with the given level
46
+ */
47
+ log(level, message, data) {
48
+ const entry = {
49
+ id: generateId(),
50
+ workflowId: this.node.id,
51
+ timestamp: Date.now(),
52
+ level,
53
+ message,
54
+ data,
55
+ };
56
+ // Add parent log ID if this is a child logger
57
+ if (this.parentLogId) {
58
+ entry.parentLogId = this.parentLogId;
59
+ }
60
+ this.emit(entry);
61
+ }
62
+ /**
63
+ * Log a debug message
64
+ */
65
+ debug(message, data) {
66
+ this.log('debug', message, data);
67
+ }
68
+ /**
69
+ * Log an info message
70
+ */
71
+ info(message, data) {
72
+ this.log('info', message, data);
73
+ }
74
+ /**
75
+ * Log a warning message
76
+ */
77
+ warn(message, data) {
78
+ this.log('warn', message, data);
79
+ }
80
+ /**
81
+ * Log an error message
82
+ */
83
+ error(message, data) {
84
+ this.log('error', message, data);
85
+ }
86
+ child(input) {
87
+ const parentLogId = typeof input === 'string' ? input : input.parentLogId;
88
+ return new WorkflowLogger(this.node, this.observers, parentLogId);
89
+ }
90
+ }
91
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,cAAc;IAIN;IACA;IAJF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