groundswell 0.0.2 → 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 (633) hide show
  1. package/dist/__tests__/adversarial/attachChild-performance.test.d.ts +16 -0
  2. package/dist/__tests__/adversarial/attachChild-performance.test.d.ts.map +1 -0
  3. package/dist/__tests__/adversarial/attachChild-performance.test.js +187 -0
  4. package/dist/__tests__/adversarial/attachChild-performance.test.js.map +1 -0
  5. package/dist/__tests__/adversarial/circular-reference.test.d.ts +13 -0
  6. package/dist/__tests__/adversarial/circular-reference.test.d.ts.map +1 -0
  7. package/dist/__tests__/adversarial/circular-reference.test.js +92 -0
  8. package/dist/__tests__/adversarial/circular-reference.test.js.map +1 -0
  9. package/dist/__tests__/adversarial/complex-circular-reference.test.d.ts +16 -0
  10. package/dist/__tests__/adversarial/complex-circular-reference.test.d.ts.map +1 -0
  11. package/dist/__tests__/adversarial/complex-circular-reference.test.js +127 -0
  12. package/dist/__tests__/adversarial/complex-circular-reference.test.js.map +1 -0
  13. package/dist/__tests__/adversarial/concurrent-task-failures.test.d.ts +21 -0
  14. package/dist/__tests__/adversarial/concurrent-task-failures.test.d.ts.map +1 -0
  15. package/dist/__tests__/adversarial/concurrent-task-failures.test.js +667 -0
  16. package/dist/__tests__/adversarial/concurrent-task-failures.test.js.map +1 -0
  17. package/dist/__tests__/adversarial/deep-analysis.test.d.ts +6 -0
  18. package/dist/__tests__/adversarial/deep-analysis.test.d.ts.map +1 -0
  19. package/dist/__tests__/adversarial/deep-analysis.test.js +877 -0
  20. package/dist/__tests__/adversarial/deep-analysis.test.js.map +1 -0
  21. package/dist/__tests__/adversarial/deep-hierarchy-stress.test.d.ts +13 -0
  22. package/dist/__tests__/adversarial/deep-hierarchy-stress.test.d.ts.map +1 -0
  23. package/dist/__tests__/adversarial/deep-hierarchy-stress.test.js +186 -0
  24. package/dist/__tests__/adversarial/deep-hierarchy-stress.test.js.map +1 -0
  25. package/dist/__tests__/adversarial/e2e-prd-validation.test.d.ts +6 -0
  26. package/dist/__tests__/adversarial/e2e-prd-validation.test.d.ts.map +1 -0
  27. package/dist/__tests__/adversarial/e2e-prd-validation.test.js +626 -0
  28. package/dist/__tests__/adversarial/e2e-prd-validation.test.js.map +1 -0
  29. package/dist/__tests__/adversarial/edge-case.test.d.ts +6 -0
  30. package/dist/__tests__/adversarial/edge-case.test.d.ts.map +1 -0
  31. package/dist/__tests__/adversarial/edge-case.test.js +857 -0
  32. package/dist/__tests__/adversarial/edge-case.test.js.map +1 -0
  33. package/dist/__tests__/adversarial/error-merge-strategy.test.d.ts +20 -0
  34. package/dist/__tests__/adversarial/error-merge-strategy.test.d.ts.map +1 -0
  35. package/dist/__tests__/adversarial/error-merge-strategy.test.js +907 -0
  36. package/dist/__tests__/adversarial/error-merge-strategy.test.js.map +1 -0
  37. package/dist/__tests__/adversarial/incremental-performance.test.d.ts +2 -0
  38. package/dist/__tests__/adversarial/incremental-performance.test.d.ts.map +1 -0
  39. package/dist/__tests__/adversarial/incremental-performance.test.js +113 -0
  40. package/dist/__tests__/adversarial/incremental-performance.test.js.map +1 -0
  41. package/dist/__tests__/adversarial/node-map-update-benchmarks.test.d.ts +22 -0
  42. package/dist/__tests__/adversarial/node-map-update-benchmarks.test.d.ts.map +1 -0
  43. package/dist/__tests__/adversarial/node-map-update-benchmarks.test.js +383 -0
  44. package/dist/__tests__/adversarial/node-map-update-benchmarks.test.js.map +1 -0
  45. package/dist/__tests__/adversarial/observer-propagation.test.d.ts +21 -0
  46. package/dist/__tests__/adversarial/observer-propagation.test.d.ts.map +1 -0
  47. package/dist/__tests__/adversarial/observer-propagation.test.js +404 -0
  48. package/dist/__tests__/adversarial/observer-propagation.test.js.map +1 -0
  49. package/dist/__tests__/adversarial/parent-validation.test.d.ts +13 -0
  50. package/dist/__tests__/adversarial/parent-validation.test.d.ts.map +1 -0
  51. package/dist/__tests__/adversarial/parent-validation.test.js +128 -0
  52. package/dist/__tests__/adversarial/parent-validation.test.js.map +1 -0
  53. package/dist/__tests__/adversarial/prd-12-2-compliance.test.d.ts +20 -0
  54. package/dist/__tests__/adversarial/prd-12-2-compliance.test.d.ts.map +1 -0
  55. package/dist/__tests__/adversarial/prd-12-2-compliance.test.js +482 -0
  56. package/dist/__tests__/adversarial/prd-12-2-compliance.test.js.map +1 -0
  57. package/dist/__tests__/adversarial/prd-compliance.test.d.ts +6 -0
  58. package/dist/__tests__/adversarial/prd-compliance.test.d.ts.map +1 -0
  59. package/dist/__tests__/adversarial/prd-compliance.test.js +886 -0
  60. package/dist/__tests__/adversarial/prd-compliance.test.js.map +1 -0
  61. package/dist/__tests__/compatibility/backward-compatibility.test.d.ts +22 -0
  62. package/dist/__tests__/compatibility/backward-compatibility.test.d.ts.map +1 -0
  63. package/dist/__tests__/compatibility/backward-compatibility.test.js +1843 -0
  64. package/dist/__tests__/compatibility/backward-compatibility.test.js.map +1 -0
  65. package/dist/__tests__/helpers/index.d.ts +10 -0
  66. package/dist/__tests__/helpers/index.d.ts.map +1 -0
  67. package/{src/__tests__/helpers/index.ts → dist/__tests__/helpers/index.js} +2 -10
  68. package/dist/__tests__/helpers/index.js.map +1 -0
  69. package/dist/__tests__/helpers/tree-verification.d.ts +90 -0
  70. package/dist/__tests__/helpers/tree-verification.d.ts.map +1 -0
  71. package/dist/__tests__/helpers/tree-verification.js +202 -0
  72. package/dist/__tests__/helpers/tree-verification.js.map +1 -0
  73. package/dist/__tests__/integration/agent-workflow.test.d.ts +2 -0
  74. package/dist/__tests__/integration/agent-workflow.test.d.ts.map +1 -0
  75. package/dist/__tests__/integration/agent-workflow.test.js +256 -0
  76. package/dist/__tests__/integration/agent-workflow.test.js.map +1 -0
  77. package/dist/__tests__/integration/bidirectional-consistency.test.d.ts +14 -0
  78. package/dist/__tests__/integration/bidirectional-consistency.test.d.ts.map +1 -0
  79. package/dist/__tests__/integration/bidirectional-consistency.test.js +668 -0
  80. package/dist/__tests__/integration/bidirectional-consistency.test.js.map +1 -0
  81. package/dist/__tests__/integration/observer-logging.test.d.ts +2 -0
  82. package/dist/__tests__/integration/observer-logging.test.d.ts.map +1 -0
  83. package/dist/__tests__/integration/observer-logging.test.js +517 -0
  84. package/dist/__tests__/integration/observer-logging.test.js.map +1 -0
  85. package/dist/__tests__/integration/tree-mirroring.test.d.ts +2 -0
  86. package/dist/__tests__/integration/tree-mirroring.test.d.ts.map +1 -0
  87. package/dist/__tests__/integration/tree-mirroring.test.js +117 -0
  88. package/dist/__tests__/integration/tree-mirroring.test.js.map +1 -0
  89. package/dist/__tests__/integration/workflow-reparenting.test.d.ts +12 -0
  90. package/dist/__tests__/integration/workflow-reparenting.test.d.ts.map +1 -0
  91. package/dist/__tests__/integration/workflow-reparenting.test.js +239 -0
  92. package/dist/__tests__/integration/workflow-reparenting.test.js.map +1 -0
  93. package/dist/__tests__/unit/agent.test.d.ts +2 -0
  94. package/dist/__tests__/unit/agent.test.d.ts.map +1 -0
  95. package/dist/__tests__/unit/agent.test.js +143 -0
  96. package/dist/__tests__/unit/agent.test.js.map +1 -0
  97. package/dist/__tests__/unit/cache-key.test.d.ts +5 -0
  98. package/dist/__tests__/unit/cache-key.test.d.ts.map +1 -0
  99. package/dist/__tests__/unit/cache-key.test.js +145 -0
  100. package/dist/__tests__/unit/cache-key.test.js.map +1 -0
  101. package/dist/__tests__/unit/cache.test.d.ts +5 -0
  102. package/dist/__tests__/unit/cache.test.d.ts.map +1 -0
  103. package/dist/__tests__/unit/cache.test.js +132 -0
  104. package/dist/__tests__/unit/cache.test.js.map +1 -0
  105. package/dist/__tests__/unit/context.test.d.ts +2 -0
  106. package/dist/__tests__/unit/context.test.d.ts.map +1 -0
  107. package/dist/__tests__/unit/context.test.js +220 -0
  108. package/dist/__tests__/unit/context.test.js.map +1 -0
  109. package/dist/__tests__/unit/decorators.test.d.ts +2 -0
  110. package/dist/__tests__/unit/decorators.test.d.ts.map +1 -0
  111. package/dist/__tests__/unit/decorators.test.js +162 -0
  112. package/dist/__tests__/unit/decorators.test.js.map +1 -0
  113. package/dist/__tests__/unit/introspection-tools.test.d.ts +5 -0
  114. package/dist/__tests__/unit/introspection-tools.test.d.ts.map +1 -0
  115. package/dist/__tests__/unit/introspection-tools.test.js +191 -0
  116. package/dist/__tests__/unit/introspection-tools.test.js.map +1 -0
  117. package/dist/__tests__/unit/logger.test.d.ts +2 -0
  118. package/dist/__tests__/unit/logger.test.d.ts.map +1 -0
  119. package/dist/__tests__/unit/logger.test.js +241 -0
  120. package/dist/__tests__/unit/logger.test.js.map +1 -0
  121. package/dist/__tests__/unit/observable.test.d.ts +2 -0
  122. package/dist/__tests__/unit/observable.test.d.ts.map +1 -0
  123. package/dist/__tests__/unit/observable.test.js +251 -0
  124. package/dist/__tests__/unit/observable.test.js.map +1 -0
  125. package/dist/__tests__/unit/prompt.test.d.ts +2 -0
  126. package/dist/__tests__/unit/prompt.test.d.ts.map +1 -0
  127. package/dist/__tests__/unit/prompt.test.js +113 -0
  128. package/dist/__tests__/unit/prompt.test.js.map +1 -0
  129. package/dist/__tests__/unit/reflection.test.d.ts +5 -0
  130. package/dist/__tests__/unit/reflection.test.d.ts.map +1 -0
  131. package/dist/__tests__/unit/reflection.test.js +160 -0
  132. package/dist/__tests__/unit/reflection.test.js.map +1 -0
  133. package/dist/__tests__/unit/tree-debugger-incremental.test.d.ts +2 -0
  134. package/dist/__tests__/unit/tree-debugger-incremental.test.d.ts.map +1 -0
  135. package/dist/__tests__/unit/tree-debugger-incremental.test.js +136 -0
  136. package/dist/__tests__/unit/tree-debugger-incremental.test.js.map +1 -0
  137. package/dist/__tests__/unit/tree-debugger.test.d.ts +2 -0
  138. package/dist/__tests__/unit/tree-debugger.test.d.ts.map +1 -0
  139. package/dist/__tests__/unit/tree-debugger.test.js +69 -0
  140. package/dist/__tests__/unit/tree-debugger.test.js.map +1 -0
  141. package/dist/__tests__/unit/utils/workflow-error-utils.test.d.ts +2 -0
  142. package/dist/__tests__/unit/utils/workflow-error-utils.test.d.ts.map +1 -0
  143. package/dist/__tests__/unit/utils/workflow-error-utils.test.js +154 -0
  144. package/dist/__tests__/unit/utils/workflow-error-utils.test.js.map +1 -0
  145. package/dist/__tests__/unit/workflow-detachChild.test.d.ts +2 -0
  146. package/dist/__tests__/unit/workflow-detachChild.test.d.ts.map +1 -0
  147. package/dist/__tests__/unit/workflow-detachChild.test.js +76 -0
  148. package/dist/__tests__/unit/workflow-detachChild.test.js.map +1 -0
  149. package/dist/__tests__/unit/workflow-emitEvent-childDetached.test.d.ts +2 -0
  150. package/dist/__tests__/unit/workflow-emitEvent-childDetached.test.d.ts.map +1 -0
  151. package/dist/__tests__/unit/workflow-emitEvent-childDetached.test.js +122 -0
  152. package/dist/__tests__/unit/workflow-emitEvent-childDetached.test.js.map +1 -0
  153. package/dist/__tests__/unit/workflow-isDescendantOf.test.d.ts +2 -0
  154. package/dist/__tests__/unit/workflow-isDescendantOf.test.d.ts.map +1 -0
  155. package/dist/__tests__/unit/workflow-isDescendantOf.test.js +140 -0
  156. package/dist/__tests__/unit/workflow-isDescendantOf.test.js.map +1 -0
  157. package/dist/__tests__/unit/workflow.test.d.ts +2 -0
  158. package/dist/__tests__/unit/workflow.test.d.ts.map +1 -0
  159. package/dist/__tests__/unit/workflow.test.js +330 -0
  160. package/dist/__tests__/unit/workflow.test.js.map +1 -0
  161. package/dist/cache/cache-key.d.ts +66 -0
  162. package/dist/cache/cache-key.d.ts.map +1 -0
  163. package/dist/cache/cache-key.js +195 -0
  164. package/dist/cache/cache-key.js.map +1 -0
  165. package/dist/cache/cache.d.ts +104 -0
  166. package/dist/cache/cache.d.ts.map +1 -0
  167. package/dist/cache/cache.js +179 -0
  168. package/dist/cache/cache.js.map +1 -0
  169. package/{src/cache/index.ts → dist/cache/index.d.ts} +1 -1
  170. package/dist/cache/index.d.ts.map +1 -0
  171. package/dist/cache/index.js +6 -0
  172. package/dist/cache/index.js.map +1 -0
  173. package/dist/core/agent.d.ts +112 -0
  174. package/dist/core/agent.d.ts.map +1 -0
  175. package/dist/core/agent.js +426 -0
  176. package/dist/core/agent.js.map +1 -0
  177. package/{src/core/context.ts → dist/core/context.d.ts} +16 -67
  178. package/dist/core/context.d.ts.map +1 -0
  179. package/dist/core/context.js +80 -0
  180. package/dist/core/context.js.map +1 -0
  181. package/dist/core/event-tree.d.ts +72 -0
  182. package/dist/core/event-tree.d.ts.map +1 -0
  183. package/dist/core/event-tree.js +211 -0
  184. package/dist/core/event-tree.js.map +1 -0
  185. package/{src/core/factory.ts → dist/core/factory.d.ts} +6 -27
  186. package/dist/core/factory.d.ts.map +1 -0
  187. package/dist/core/factory.js +110 -0
  188. package/dist/core/factory.js.map +1 -0
  189. package/{src/core/index.ts → dist/core/index.d.ts} +2 -10
  190. package/dist/core/index.d.ts.map +1 -0
  191. package/dist/core/index.js +9 -0
  192. package/dist/core/index.js.map +1 -0
  193. package/dist/core/logger.d.ts +50 -0
  194. package/dist/core/logger.d.ts.map +1 -0
  195. package/dist/core/logger.js +91 -0
  196. package/dist/core/logger.js.map +1 -0
  197. package/dist/core/mcp-handler.d.ts +69 -0
  198. package/dist/core/mcp-handler.d.ts.map +1 -0
  199. package/dist/core/mcp-handler.js +143 -0
  200. package/dist/core/mcp-handler.js.map +1 -0
  201. package/dist/core/prompt.d.ts +80 -0
  202. package/dist/core/prompt.d.ts.map +1 -0
  203. package/dist/core/prompt.js +120 -0
  204. package/dist/core/prompt.js.map +1 -0
  205. package/dist/core/workflow-context.d.ts +57 -0
  206. package/dist/core/workflow-context.d.ts.map +1 -0
  207. package/dist/core/workflow-context.js +263 -0
  208. package/dist/core/workflow-context.js.map +1 -0
  209. package/dist/core/workflow.d.ts +241 -0
  210. package/dist/core/workflow.d.ts.map +1 -0
  211. package/dist/core/workflow.js +464 -0
  212. package/dist/core/workflow.js.map +1 -0
  213. package/dist/debugger/index.d.ts +2 -0
  214. package/dist/debugger/index.d.ts.map +1 -0
  215. package/{src/debugger/index.ts → dist/debugger/index.js} +1 -0
  216. package/dist/debugger/index.js.map +1 -0
  217. package/dist/debugger/tree-debugger.d.ts +71 -0
  218. package/dist/debugger/tree-debugger.d.ts.map +1 -0
  219. package/dist/debugger/tree-debugger.js +198 -0
  220. package/dist/debugger/tree-debugger.js.map +1 -0
  221. package/dist/decorators/index.d.ts +4 -0
  222. package/dist/decorators/index.d.ts.map +1 -0
  223. package/{src/decorators/index.ts → dist/decorators/index.js} +1 -0
  224. package/dist/decorators/index.js.map +1 -0
  225. package/dist/decorators/observed-state.d.ts +32 -0
  226. package/dist/decorators/observed-state.d.ts.map +1 -0
  227. package/dist/decorators/observed-state.js +79 -0
  228. package/dist/decorators/observed-state.js.map +1 -0
  229. package/dist/decorators/step.d.ts +15 -0
  230. package/dist/decorators/step.d.ts.map +1 -0
  231. package/dist/decorators/step.js +110 -0
  232. package/dist/decorators/step.js.map +1 -0
  233. package/dist/decorators/task.d.ts +50 -0
  234. package/dist/decorators/task.d.ts.map +1 -0
  235. package/dist/decorators/task.js +118 -0
  236. package/dist/decorators/task.js.map +1 -0
  237. package/dist/examples/index.d.ts +3 -0
  238. package/dist/examples/index.d.ts.map +1 -0
  239. package/{src/examples/index.ts → dist/examples/index.js} +1 -0
  240. package/dist/examples/index.js.map +1 -0
  241. package/dist/examples/tdd-orchestrator.d.ts +15 -0
  242. package/dist/examples/tdd-orchestrator.d.ts.map +1 -0
  243. package/dist/examples/tdd-orchestrator.js +121 -0
  244. package/dist/examples/tdd-orchestrator.js.map +1 -0
  245. package/dist/examples/test-cycle-workflow.d.ts +14 -0
  246. package/dist/examples/test-cycle-workflow.d.ts.map +1 -0
  247. package/dist/examples/test-cycle-workflow.js +116 -0
  248. package/dist/examples/test-cycle-workflow.js.map +1 -0
  249. package/dist/index.d.ts +27 -0
  250. package/dist/index.d.ts.map +1 -0
  251. package/dist/index.js +40 -0
  252. package/dist/index.js.map +1 -0
  253. package/dist/reflection/index.d.ts +5 -0
  254. package/dist/reflection/index.d.ts.map +1 -0
  255. package/{src/reflection/index.ts → dist/reflection/index.js} +1 -1
  256. package/dist/reflection/index.js.map +1 -0
  257. package/dist/reflection/reflection.d.ts +84 -0
  258. package/dist/reflection/reflection.d.ts.map +1 -0
  259. package/dist/reflection/reflection.js +329 -0
  260. package/dist/reflection/reflection.js.map +1 -0
  261. package/dist/tools/index.d.ts +6 -0
  262. package/dist/tools/index.d.ts.map +1 -0
  263. package/dist/tools/index.js +11 -0
  264. package/dist/tools/index.js.map +1 -0
  265. package/dist/tools/introspection.d.ts +165 -0
  266. package/dist/tools/introspection.d.ts.map +1 -0
  267. package/dist/tools/introspection.js +324 -0
  268. package/dist/tools/introspection.js.map +1 -0
  269. package/dist/types/agent.d.ts +66 -0
  270. package/dist/types/agent.d.ts.map +1 -0
  271. package/dist/types/agent.js +6 -0
  272. package/dist/types/agent.js.map +1 -0
  273. package/dist/types/decorators.d.ts +31 -0
  274. package/dist/types/decorators.d.ts.map +1 -0
  275. package/dist/types/decorators.js +2 -0
  276. package/dist/types/decorators.js.map +1 -0
  277. package/dist/types/error-strategy.d.ts +13 -0
  278. package/dist/types/error-strategy.d.ts.map +1 -0
  279. package/dist/types/error-strategy.js +2 -0
  280. package/dist/types/error-strategy.js.map +1 -0
  281. package/dist/types/error.d.ts +20 -0
  282. package/dist/types/error.d.ts.map +1 -0
  283. package/dist/types/error.js +2 -0
  284. package/dist/types/error.js.map +1 -0
  285. package/dist/types/events.d.ts +87 -0
  286. package/dist/types/events.d.ts.map +1 -0
  287. package/dist/types/events.js +2 -0
  288. package/dist/types/events.js.map +1 -0
  289. package/dist/types/index.d.ts +15 -0
  290. package/dist/types/index.d.ts.map +1 -0
  291. package/dist/types/index.js +2 -0
  292. package/dist/types/index.js.map +1 -0
  293. package/dist/types/logging.d.ts +24 -0
  294. package/dist/types/logging.d.ts.map +1 -0
  295. package/dist/types/logging.js +2 -0
  296. package/dist/types/logging.js.map +1 -0
  297. package/dist/types/observer.d.ts +18 -0
  298. package/dist/types/observer.d.ts.map +1 -0
  299. package/dist/types/observer.js +2 -0
  300. package/dist/types/observer.js.map +1 -0
  301. package/dist/types/prompt.d.ts +31 -0
  302. package/dist/types/prompt.d.ts.map +1 -0
  303. package/dist/types/prompt.js +6 -0
  304. package/dist/types/prompt.js.map +1 -0
  305. package/dist/types/reflection.d.ts +96 -0
  306. package/dist/types/reflection.d.ts.map +1 -0
  307. package/dist/types/reflection.js +24 -0
  308. package/dist/types/reflection.js.map +1 -0
  309. package/dist/types/sdk-primitives.d.ts +118 -0
  310. package/dist/types/sdk-primitives.d.ts.map +1 -0
  311. package/dist/types/sdk-primitives.js +6 -0
  312. package/dist/types/sdk-primitives.js.map +1 -0
  313. package/{src/types/snapshot.ts → dist/types/snapshot.d.ts} +5 -5
  314. package/dist/types/snapshot.d.ts.map +1 -0
  315. package/dist/types/snapshot.js +2 -0
  316. package/dist/types/snapshot.js.map +1 -0
  317. package/dist/types/workflow-context.d.ts +139 -0
  318. package/dist/types/workflow-context.d.ts.map +1 -0
  319. package/dist/types/workflow-context.js +8 -0
  320. package/dist/types/workflow-context.js.map +1 -0
  321. package/dist/types/workflow.d.ts +30 -0
  322. package/dist/types/workflow.d.ts.map +1 -0
  323. package/dist/types/workflow.js +2 -0
  324. package/dist/types/workflow.js.map +1 -0
  325. package/dist/utils/id.d.ts +6 -0
  326. package/dist/utils/id.d.ts.map +1 -0
  327. package/dist/utils/id.js +12 -0
  328. package/dist/utils/id.js.map +1 -0
  329. package/{src/utils/index.ts → dist/utils/index.d.ts} +1 -0
  330. package/dist/utils/index.d.ts.map +1 -0
  331. package/dist/utils/index.js +4 -0
  332. package/dist/utils/index.js.map +1 -0
  333. package/dist/utils/observable.d.ts +54 -0
  334. package/dist/utils/observable.d.ts.map +1 -0
  335. package/dist/utils/observable.js +82 -0
  336. package/dist/utils/observable.js.map +1 -0
  337. package/dist/utils/workflow-error-utils.d.ts +22 -0
  338. package/dist/utils/workflow-error-utils.d.ts.map +1 -0
  339. package/dist/utils/workflow-error-utils.js +45 -0
  340. package/dist/utils/workflow-error-utils.js.map +1 -0
  341. package/package.json +5 -2
  342. package/.claude/commands/subtask-planning/prp-base-create.md +0 -120
  343. package/.claude/commands/subtask-planning/prp-base-execute.md +0 -65
  344. package/.claude/commands/task-breakdown.md +0 -94
  345. package/.claude/settings.local.json +0 -9
  346. package/.claude/system_prompts/task-breakdown.md +0 -101
  347. package/PRD.md +0 -543
  348. package/PRPs/001-hierarchical-workflow-engine.md +0 -2438
  349. package/PRPs/PRDs/002-agent-prompt.md +0 -390
  350. package/PRPs/PRDs/003-agent-prompt.md +0 -943
  351. package/PRPs/PRDs/004-agent-prompt.md +0 -1136
  352. package/PRPs/PRDs/tasks-001.json +0 -492
  353. package/PRPs/README.md +0 -83
  354. package/PRPs/templates/prp_base.md +0 -222
  355. package/docs/agent.md +0 -422
  356. package/docs/prompt.md +0 -419
  357. package/docs/workflow.md +0 -600
  358. package/examples/README.md +0 -258
  359. package/examples/examples/01-basic-workflow.ts +0 -100
  360. package/examples/examples/02-decorator-options.ts +0 -217
  361. package/examples/examples/03-parent-child.ts +0 -241
  362. package/examples/examples/04-observers-debugger.ts +0 -340
  363. package/examples/examples/05-error-handling.ts +0 -387
  364. package/examples/examples/06-concurrent-tasks.ts +0 -352
  365. package/examples/examples/07-agent-loops.ts +0 -432
  366. package/examples/examples/08-sdk-features.ts +0 -667
  367. package/examples/examples/09-reflection.ts +0 -573
  368. package/examples/examples/10-introspection.ts +0 -550
  369. package/examples/examples/11-reparenting-workflows.ts +0 -269
  370. package/examples/index.ts +0 -147
  371. package/examples/utils/helpers.ts +0 -57
  372. package/package-lock.json +0 -2398
  373. package/plan/001_d3bb02af4886/TEST_RESULTS.md +0 -259
  374. package/plan/001_d3bb02af4886/backlog.json +0 -867
  375. package/plan/001_d3bb02af4886/bug_fix_tasks.json +0 -484
  376. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M1T1S1/PRP.md +0 -488
  377. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M1T1S2/PRP.md +0 -581
  378. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M1T1S3/PRP.md +0 -687
  379. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T1S1/PRP.md +0 -492
  380. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T1S3/PRP.md +0 -932
  381. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T1S3/research/concurrent_error_testing_patterns.md +0 -1109
  382. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T1S3/research/vitest_concurrent_testing.md +0 -802
  383. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T1S3/research/workflow_engine_test_references.md +0 -603
  384. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T2S1/PRP.md +0 -564
  385. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T2S3/PRP.md +0 -518
  386. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T2S4/PRP.md +0 -1252
  387. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T3S1/PRP.md +0 -364
  388. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T3S1/research/CODEBASE_INVENTORY.md +0 -114
  389. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T3S1/research/DECORATOR_DOCUMENTATION_PATTERNS.md +0 -205
  390. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T3S1/research/PRD_LOCATION_ANALYSIS.md +0 -199
  391. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T3S1/research/ULTRATHINK_PRP_PLAN.md +0 -134
  392. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T1S1/PRP.md +0 -495
  393. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T1S1/research/console_error_inventory.md +0 -435
  394. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T1S2/PRP.md +0 -506
  395. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T1S3/PRP.md +0 -612
  396. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T2S2/PRP.md +0 -558
  397. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T2S2/research/external_research.md +0 -788
  398. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T3S2/PRP.md +0 -460
  399. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T3S3/PRP.md +0 -454
  400. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T4S1/PRP.md +0 -520
  401. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T4S1/RECOMMENDATION.md +0 -417
  402. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T4S1/research/external_workflow_engines_research.md +0 -760
  403. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T4S1/research/security_implications_analysis.md +0 -245
  404. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T4S2/PRP.md +0 -792
  405. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S1/PRP.md +0 -535
  406. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S1/TEST_EXECUTION_REPORT.md +0 -190
  407. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S2/PRP.md +0 -654
  408. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S2/TEST_FIX_REPORT.md +0 -227
  409. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S2/research/KEY_FINDINGS.md +0 -345
  410. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S2/research/QUICK_REFERENCE.md +0 -193
  411. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S2/research/test_maintenance_research.md +0 -1323
  412. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T3S1/BREAKING_CHANGES_AUDIT.md +0 -1011
  413. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T3S1/PRP.md +0 -927
  414. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T3S2/PRP.md +0 -505
  415. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/architecture/logger_child_signature_analysis.md +0 -401
  416. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S3/child_implementation_research.md +0 -142
  417. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S3/test_patterns_research.md +0 -112
  418. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S3/vitest_patterns_research.md +0 -159
  419. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S4/PRP.md +0 -549
  420. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S4/VERIFICATION_REPORT.md +0 -368
  421. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S4/edge_case_analysis.md +0 -172
  422. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S4/usage_inventory.md +0 -175
  423. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T1S2/PRP.md +0 -696
  424. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T1S4/PRP.md +0 -860
  425. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/PRP.md +0 -1066
  426. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/01-testing-aggregated-errors.md +0 -1103
  427. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/01_typescript_error_aggregation_patterns.md +0 -789
  428. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/02-error-merge-strategy-testing-guide.md +0 -1098
  429. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/02_aggregate_error_patterns.md +0 -1037
  430. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/03-promise-allsettled-testing-patterns.md +0 -916
  431. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/03_error_merging_strategies.md +0 -1045
  432. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/04_github_stackoverflow_examples.md +0 -890
  433. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/05_comprehensive_summary.md +0 -822
  434. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/INDEX.md +0 -668
  435. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/QUICK_REFERENCE.md +0 -706
  436. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/README.md +0 -265
  437. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/RESEARCH_REPORT.md +0 -655
  438. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S4/research/vitest_testing_patterns.md +0 -1103
  439. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T3S2/PRP.md +0 -426
  440. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T1S2/PRP.md +0 -506
  441. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T1S2/research/QUICK_REFERENCE.md +0 -114
  442. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T1S2/research/RESEARCH_SUMMARY.md +0 -316
  443. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T1S2/research/vitest_observer_error_logging_best_practices.md +0 -754
  444. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T1S3/PRP.md +0 -612
  445. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T2S1/PRP.md +0 -719
  446. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T2S1/README.md +0 -215
  447. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T2S1/analysis.md +0 -765
  448. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T2S3/PRP.md +0 -718
  449. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/DECISION.md +0 -149
  450. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/PRP.md +0 -470
  451. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/research/ULTRATHINK_PLAN.md +0 -332
  452. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/research/codebase_workflow_name_analysis.md +0 -167
  453. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/research/external_best_practices.md +0 -265
  454. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/research/validation_patterns.md +0 -273
  455. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T4S1/workflow_engine_ancestry_api_research.md +0 -760
  456. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T4S3-PRP.md +0 -434
  457. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M4T2S1/PRP.md +0 -717
  458. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M4T2S2/PRP.md +0 -472
  459. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M4T2S2/VALIDATION_REPORT.md +0 -125
  460. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M4T2S2/research/ULTRATHINK_PRP_PLAN.md +0 -301
  461. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/error-logging-best-practices.md +0 -1170
  462. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/research_typescript_partial_and_overloads.md +0 -940
  463. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/vitest-quick-reference.md +0 -151
  464. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/vitest-research.md +0 -650
  465. package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/prd_snapshot.md +0 -259
  466. package/plan/001_d3bb02af4886/bugfix/P1M1T1S1/PRP.md +0 -457
  467. package/plan/001_d3bb02af4886/bugfix/RESEARCH_SUMMARY.md +0 -346
  468. package/plan/001_d3bb02af4886/bugfix/architecture/codebase_structure.md +0 -311
  469. package/plan/001_d3bb02af4886/bugfix/architecture/concurrent_execution_best_practices.md +0 -1565
  470. package/plan/001_d3bb02af4886/bugfix/architecture/error_handling_patterns.md +0 -288
  471. package/plan/001_d3bb02af4886/bugfix/architecture/promise_all_analysis.md +0 -741
  472. package/plan/001_d3bb02af4886/docs/PRP/P1M1T1S4-functional-workflow-error-state-capture-test.md +0 -652
  473. package/plan/001_d3bb02af4886/docs/PRP/P1P2-PRP.md +0 -527
  474. package/plan/001_d3bb02af4886/docs/PRP/P3P4-PRP.md +0 -1388
  475. package/plan/001_d3bb02af4886/docs/PRP/P4P5-PRP.md +0 -1136
  476. package/plan/001_d3bb02af4886/docs/PRP/PRP.md +0 -527
  477. package/plan/001_d3bb02af4886/docs/PRP/bugfix/P1M1T2S1-PRP.md +0 -415
  478. package/plan/001_d3bb02af4886/docs/PRP/bugfix/P1M1T2S2-PRP.md +0 -378
  479. package/plan/001_d3bb02af4886/docs/PRP/bugfix/P1M1T2S4-PRP.md +0 -713
  480. package/plan/001_d3bb02af4886/docs/PRP/bugfix/P1M2T1S4-PRP.md +0 -370
  481. package/plan/001_d3bb02af4886/docs/PRP_P1M3T1S3.md +0 -499
  482. package/plan/001_d3bb02af4886/docs/TEST_RESULTS.md +0 -230
  483. package/plan/001_d3bb02af4886/docs/architecture/external_deps.md +0 -358
  484. package/plan/001_d3bb02af4886/docs/architecture/system_context.md +0 -242
  485. package/plan/001_d3bb02af4886/docs/bugfix/ANALYSIS_PRD_VS_IMPLEMENTATION.md +0 -1134
  486. package/plan/001_d3bb02af4886/docs/bugfix/GAP_ANALYSIS_SUMMARY.md +0 -179
  487. package/plan/001_d3bb02af4886/docs/bugfix/P1M4T2S1/PRP.md +0 -629
  488. package/plan/001_d3bb02af4886/docs/bugfix/P1M4T2S1/validation-report.md +0 -214
  489. package/plan/001_d3bb02af4886/docs/bugfix/PRP_P1M4T2S3.md +0 -629
  490. package/plan/001_d3bb02af4886/docs/bugfix/bugfix_PRP.md +0 -529
  491. package/plan/001_d3bb02af4886/docs/bugfix/bugfix_QUICK_REFERENCE.md +0 -142
  492. package/plan/001_d3bb02af4886/docs/bugfix/bugfix_README.md +0 -304
  493. package/plan/001_d3bb02af4886/docs/bugfix/bugfix_TEST_RESULTS.md +0 -558
  494. package/plan/001_d3bb02af4886/docs/bugfix/bugfix_VALIDATION_SUMMARY.md +0 -256
  495. package/plan/001_d3bb02af4886/docs/bugfix/system_context.md +0 -346
  496. package/plan/001_d3bb02af4886/docs/bugfix-architecture/bug_analysis.md +0 -415
  497. package/plan/001_d3bb02af4886/docs/bugfix-architecture/implementation_patterns.md +0 -489
  498. package/plan/001_d3bb02af4886/docs/bugfix-architecture/system_context.md +0 -218
  499. package/plan/001_d3bb02af4886/docs/bugfix_INITIATION_SUMMARY.md +0 -380
  500. package/plan/001_d3bb02af4886/docs/research/CYCLE_DETECTION_PATTERNS.md +0 -1923
  501. package/plan/001_d3bb02af4886/docs/research/CYCLE_DETECTION_QUICK_REF.md +0 -319
  502. package/plan/001_d3bb02af4886/docs/research/P1M1T2S1/codebase-context.md +0 -115
  503. package/plan/001_d3bb02af4886/docs/research/P1M1T2S1/cycle-detection-algorithms.md +0 -134
  504. package/plan/001_d3bb02af4886/docs/research/P1M1T2S1/test-patterns.md +0 -153
  505. package/plan/001_d3bb02af4886/docs/research/P1M1T2S1/workflow-class.md +0 -132
  506. package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/DECORATOR_DOCUMENTATION_BEST_PRACTICES.md +0 -716
  507. package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/DECORATOR_DOCUMENTATION_QUICK_REF.md +0 -186
  508. package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/GROUNDSWELL_DECORATOR_EXAMPLES.md +0 -604
  509. package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/INDEX.md +0 -213
  510. package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/codebase_structure.md +0 -30
  511. package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/existing_test_pattern.md +0 -56
  512. package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/getRootObservers_implementation.md +0 -53
  513. package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/test_conventions.md +0 -49
  514. package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/PRP.md +0 -958
  515. package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/QUICK_REFERENCE.md +0 -339
  516. package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/README.md +0 -305
  517. package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/SUMMARY.md +0 -433
  518. package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/bidirectional-tree-consistency-testing.md +0 -1574
  519. package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/test-pattern-examples.md +0 -1014
  520. package/plan/001_d3bb02af4886/docs/research/P1P2/LRU_CACHE_BEST_PRACTICES.md +0 -1929
  521. package/plan/001_d3bb02af4886/docs/research/P1P2/LRU_CACHE_CODE_PATTERNS.md +0 -857
  522. package/plan/001_d3bb02af4886/docs/research/P1P2/LRU_CACHE_INTEGRATION_GUIDE.md +0 -738
  523. package/plan/001_d3bb02af4886/docs/research/P1P2/LRU_CACHE_RESEARCH_INDEX.md +0 -424
  524. package/plan/001_d3bb02af4886/docs/research/P1P2/REFLECTION_INDEX.md +0 -291
  525. package/plan/001_d3bb02af4886/docs/research/P1P2/REFLECTION_RESEARCH_REPORT.md +0 -1342
  526. package/plan/001_d3bb02af4886/docs/research/P1P2/RESEARCH_SUMMARY.md +0 -342
  527. package/plan/001_d3bb02af4886/docs/research/P1P2/anthropic-sdk.md +0 -174
  528. package/plan/001_d3bb02af4886/docs/research/P1P2/async-local-storage.md +0 -200
  529. package/plan/001_d3bb02af4886/docs/research/P1P2/reflection-code-patterns.md +0 -1205
  530. package/plan/001_d3bb02af4886/docs/research/P1P2/reflection-decision-matrix.md +0 -421
  531. package/plan/001_d3bb02af4886/docs/research/P1P2/reflection-implementation-guide.md +0 -1341
  532. package/plan/001_d3bb02af4886/docs/research/P1P2/reflection-integration-guide.md +0 -834
  533. package/plan/001_d3bb02af4886/docs/research/P1P2/reflection-patterns.md +0 -1468
  534. package/plan/001_d3bb02af4886/docs/research/P1P2/reflection-quick-reference.md +0 -558
  535. package/plan/001_d3bb02af4886/docs/research/P1P2/zod-schema.md +0 -152
  536. package/plan/001_d3bb02af4886/docs/research/P3P4/caching-lru.md +0 -116
  537. package/plan/001_d3bb02af4886/docs/research/P3P4/introspection-tools.md +0 -177
  538. package/plan/001_d3bb02af4886/docs/research/P3P4/reflection-patterns.md +0 -117
  539. package/plan/001_d3bb02af4886/docs/research/P4P5/RESEARCH_SUMMARY.md +0 -151
  540. package/plan/001_d3bb02af4886/docs/research/PROMISE_ALLSETTLED_QUICK_REF.md +0 -376
  541. package/plan/001_d3bb02af4886/docs/research/PROMISE_ALLSETTLED_RESEARCH.md +0 -1507
  542. package/plan/001_d3bb02af4886/docs/research/bugfix_typescript_patterns.md +0 -949
  543. package/plan/001_d3bb02af4886/docs/research/error-testing-research.md +0 -619
  544. package/plan/001_d3bb02af4886/docs/research/error_handling_patterns.md +0 -723
  545. package/plan/001_d3bb02af4886/docs/research/general/INTROSPECTION_RESEARCH_SUMMARY.md +0 -378
  546. package/plan/001_d3bb02af4886/docs/research/general/README-INTROSPECTION.md +0 -352
  547. package/plan/001_d3bb02af4886/docs/research/general/agent-introspection-patterns.md +0 -1085
  548. package/plan/001_d3bb02af4886/docs/research/general/introspection-security-guide.md +0 -984
  549. package/plan/001_d3bb02af4886/docs/research/general/introspection-tool-examples.md +0 -875
  550. package/plan/001_d3bb02af4886/docs/research/incremental-tree-map-updates/PRP_TEMPLATE.md +0 -460
  551. package/plan/001_d3bb02af4886/docs/research/incremental-tree-map-updates/QUICK_REFERENCE.md +0 -324
  552. package/plan/001_d3bb02af4886/docs/research/incremental-tree-map-updates/README.md +0 -175
  553. package/plan/001_d3bb02af4886/docs/research/incremental-tree-map-updates/RESEARCH_REPORT.md +0 -499
  554. package/plan/001_d3bb02af4886/docs/research/incremental-tree-map-updates/SUMMARY.md +0 -163
  555. package/plan/001_d3bb02af4886/prd_snapshot.md +0 -543
  556. package/plan/bugfix/BUG_FIX_SUMMARY.md +0 -961
  557. package/scripts/generate-llms-full.ts +0 -206
  558. package/src/__tests__/adversarial/attachChild-performance.test.ts +0 -216
  559. package/src/__tests__/adversarial/circular-reference.test.ts +0 -101
  560. package/src/__tests__/adversarial/complex-circular-reference.test.ts +0 -139
  561. package/src/__tests__/adversarial/concurrent-task-failures.test.ts +0 -571
  562. package/src/__tests__/adversarial/deep-analysis.test.ts +0 -729
  563. package/src/__tests__/adversarial/deep-hierarchy-stress.test.ts +0 -213
  564. package/src/__tests__/adversarial/e2e-prd-validation.test.ts +0 -448
  565. package/src/__tests__/adversarial/edge-case.test.ts +0 -703
  566. package/src/__tests__/adversarial/error-merge-strategy.test.ts +0 -760
  567. package/src/__tests__/adversarial/incremental-performance.test.ts +0 -140
  568. package/src/__tests__/adversarial/node-map-update-benchmarks.test.ts +0 -457
  569. package/src/__tests__/adversarial/observer-propagation.test.ts +0 -487
  570. package/src/__tests__/adversarial/parent-validation.test.ts +0 -143
  571. package/src/__tests__/adversarial/prd-12-2-compliance.test.ts +0 -611
  572. package/src/__tests__/adversarial/prd-compliance.test.ts +0 -731
  573. package/src/__tests__/compatibility/backward-compatibility.test.ts +0 -1572
  574. package/src/__tests__/helpers/tree-verification.ts +0 -257
  575. package/src/__tests__/integration/agent-workflow.test.ts +0 -256
  576. package/src/__tests__/integration/bidirectional-consistency.test.ts +0 -847
  577. package/src/__tests__/integration/observer-logging.test.ts +0 -643
  578. package/src/__tests__/integration/tree-mirroring.test.ts +0 -151
  579. package/src/__tests__/integration/workflow-reparenting.test.ts +0 -303
  580. package/src/__tests__/unit/agent.test.ts +0 -169
  581. package/src/__tests__/unit/cache-key.test.ts +0 -182
  582. package/src/__tests__/unit/cache.test.ts +0 -172
  583. package/src/__tests__/unit/context.test.ts +0 -217
  584. package/src/__tests__/unit/decorators.test.ts +0 -100
  585. package/src/__tests__/unit/introspection-tools.test.ts +0 -277
  586. package/src/__tests__/unit/logger.test.ts +0 -293
  587. package/src/__tests__/unit/observable.test.ts +0 -321
  588. package/src/__tests__/unit/prompt.test.ts +0 -135
  589. package/src/__tests__/unit/reflection.test.ts +0 -210
  590. package/src/__tests__/unit/tree-debugger-incremental.test.ts +0 -170
  591. package/src/__tests__/unit/tree-debugger.test.ts +0 -85
  592. package/src/__tests__/unit/utils/workflow-error-utils.test.ts +0 -209
  593. package/src/__tests__/unit/workflow-detachChild.test.ts +0 -100
  594. package/src/__tests__/unit/workflow-emitEvent-childDetached.test.ts +0 -153
  595. package/src/__tests__/unit/workflow-isDescendantOf.test.ts +0 -180
  596. package/src/__tests__/unit/workflow.test.ts +0 -357
  597. package/src/cache/cache-key.ts +0 -244
  598. package/src/cache/cache.ts +0 -236
  599. package/src/core/agent.ts +0 -593
  600. package/src/core/event-tree.ts +0 -260
  601. package/src/core/logger.ts +0 -112
  602. package/src/core/mcp-handler.ts +0 -184
  603. package/src/core/prompt.ts +0 -150
  604. package/src/core/workflow-context.ts +0 -351
  605. package/src/core/workflow.ts +0 -540
  606. package/src/debugger/tree-debugger.ts +0 -255
  607. package/src/decorators/observed-state.ts +0 -95
  608. package/src/decorators/step.ts +0 -139
  609. package/src/decorators/task.ts +0 -159
  610. package/src/examples/tdd-orchestrator.ts +0 -65
  611. package/src/examples/test-cycle-workflow.ts +0 -64
  612. package/src/index.ts +0 -142
  613. package/src/reflection/reflection.ts +0 -407
  614. package/src/tools/index.ts +0 -36
  615. package/src/tools/introspection.ts +0 -464
  616. package/src/types/agent.ts +0 -90
  617. package/src/types/decorators.ts +0 -32
  618. package/src/types/error-strategy.ts +0 -13
  619. package/src/types/error.ts +0 -20
  620. package/src/types/events.ts +0 -75
  621. package/src/types/index.ts +0 -55
  622. package/src/types/logging.ts +0 -24
  623. package/src/types/observer.ts +0 -18
  624. package/src/types/prompt.ts +0 -40
  625. package/src/types/reflection.ts +0 -117
  626. package/src/types/sdk-primitives.ts +0 -128
  627. package/src/types/workflow-context.ts +0 -163
  628. package/src/types/workflow.ts +0 -37
  629. package/src/utils/id.ts +0 -11
  630. package/src/utils/observable.ts +0 -106
  631. package/src/utils/workflow-error-utils.ts +0 -56
  632. package/tsconfig.json +0 -22
  633. package/vitest.config.ts +0 -16
@@ -0,0 +1,1843 @@
1
+ /**
2
+ * Backward Compatibility Test Suite
3
+ *
4
+ * Comprehensive tests that validate all existing API usage patterns continue to work
5
+ * after bug fixes, and ensures breaking changes fail with clear, actionable error
6
+ * messages directing users to the correct migration path.
7
+ *
8
+ * Related:
9
+ * - PRP: P1.M4.T3.S2 - Backward Compatibility Testing
10
+ * - Breaking Changes Audit: plan/.../P1M4T3S1/BREAKING_CHANGES_AUDIT.md
11
+ *
12
+ * Test Coverage:
13
+ * 1. Breaking Change: Workflow name validation (LOW severity)
14
+ * 2. Backward Compatible: WorkflowLogger.child() string API
15
+ * 3. Backward Compatible: Promise.allSettled default behavior
16
+ * 4. Documentation Examples: README quick start patterns
17
+ * 5. Example Files: All 11 runnable examples
18
+ * 6. Decorator Patterns: @Step, @Task, @ObservedState options
19
+ * 7. Parent-Child Patterns: Hierarchical workflow creation
20
+ */
21
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
22
+ var useValue = arguments.length > 2;
23
+ for (var i = 0; i < initializers.length; i++) {
24
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
25
+ }
26
+ return useValue ? value : void 0;
27
+ };
28
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
29
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
30
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
31
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
32
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
33
+ var _, done = false;
34
+ for (var i = decorators.length - 1; i >= 0; i--) {
35
+ var context = {};
36
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
37
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
38
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
39
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
40
+ if (kind === "accessor") {
41
+ if (result === void 0) continue;
42
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
43
+ if (_ = accept(result.get)) descriptor.get = _;
44
+ if (_ = accept(result.set)) descriptor.set = _;
45
+ if (_ = accept(result.init)) initializers.unshift(_);
46
+ }
47
+ else if (_ = accept(result)) {
48
+ if (kind === "field") initializers.unshift(_);
49
+ else descriptor[key] = _;
50
+ }
51
+ }
52
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
53
+ done = true;
54
+ };
55
+ import { describe, it, expect } from 'vitest';
56
+ import { Workflow, Step, Task, ObservedState, getObservedState, WorkflowTreeDebugger, createWorkflow, } from '../../index.js';
57
+ // ============================================================================
58
+ // Section 1: Breaking Changes - Workflow Name Validation
59
+ // ============================================================================
60
+ // Severity: LOW
61
+ // Impact: Constructor rejects empty/whitespace/long names
62
+ // Migration: Provide valid names (simple fix)
63
+ // ============================================================================
64
+ describe('Backward Compatibility Tests', () => {
65
+ describe('Breaking Changes - Workflow Name Validation', () => {
66
+ describe('Class-based constructor pattern', () => {
67
+ class TestWorkflow extends Workflow {
68
+ constructor(name) {
69
+ super(name);
70
+ }
71
+ async run() {
72
+ this.setStatus('running');
73
+ this.setStatus('completed');
74
+ return 'done';
75
+ }
76
+ }
77
+ it('should throw descriptive error for empty string name', () => {
78
+ expect(() => new TestWorkflow(''))
79
+ .toThrow('Workflow name cannot be empty or whitespace only');
80
+ });
81
+ it('should throw descriptive error for whitespace-only name (spaces)', () => {
82
+ expect(() => new TestWorkflow(' '))
83
+ .toThrow('Workflow name cannot be empty or whitespace only');
84
+ });
85
+ it('should throw descriptive error for whitespace-only name (tabs)', () => {
86
+ expect(() => new TestWorkflow('\t\t'))
87
+ .toThrow('Workflow name cannot be empty or whitespace only');
88
+ });
89
+ it('should throw descriptive error for whitespace-only name (newlines)', () => {
90
+ expect(() => new TestWorkflow('\n\n'))
91
+ .toThrow('Workflow name cannot be empty or whitespace only');
92
+ });
93
+ it('should throw descriptive error for whitespace-only name (mixed)', () => {
94
+ expect(() => new TestWorkflow(' \t\n '))
95
+ .toThrow('Workflow name cannot be empty or whitespace only');
96
+ });
97
+ it('should throw descriptive error for name exceeding 100 characters', () => {
98
+ const longName = 'a'.repeat(101);
99
+ expect(() => new TestWorkflow(longName))
100
+ .toThrow('Workflow name cannot exceed 100 characters');
101
+ });
102
+ it('should accept name with exactly 100 characters', () => {
103
+ const exactly100 = 'a'.repeat(100);
104
+ const wf = new TestWorkflow(exactly100);
105
+ expect(wf.getNode().name).toBe(exactly100);
106
+ expect(wf.getNode().name.length).toBe(100);
107
+ });
108
+ it('should accept valid names with leading/trailing whitespace', () => {
109
+ const wf1 = new TestWorkflow(' MyWorkflow ');
110
+ expect(wf1.getNode().name).toBe(' MyWorkflow ');
111
+ const wf2 = new TestWorkflow('\tValidName\t');
112
+ expect(wf2.getNode().name).toBe('\tValidName\t');
113
+ });
114
+ it('should use class name when name is undefined', () => {
115
+ const wf = new TestWorkflow();
116
+ expect(wf.getNode().name).toBe('TestWorkflow');
117
+ });
118
+ it('should use class name when name is null', () => {
119
+ const wf = new TestWorkflow(null);
120
+ expect(wf.getNode().name).toBe('TestWorkflow');
121
+ });
122
+ });
123
+ describe('Functional constructor pattern', () => {
124
+ it('should throw descriptive error for empty string name', () => {
125
+ expect(() => new Workflow({ name: '' }, async () => { }))
126
+ .toThrow('Workflow name cannot be empty or whitespace only');
127
+ });
128
+ it('should throw descriptive error for whitespace name', () => {
129
+ expect(() => new Workflow({ name: ' ' }, async () => { }))
130
+ .toThrow('Workflow name cannot be empty or whitespace only');
131
+ });
132
+ it('should throw descriptive error for name exceeding 100 characters', () => {
133
+ const longName = 'a'.repeat(101);
134
+ expect(() => new Workflow({ name: longName }, async () => { }))
135
+ .toThrow('Workflow name cannot exceed 100 characters');
136
+ });
137
+ it('should accept valid name in functional pattern', async () => {
138
+ const wf = new Workflow({ name: 'ValidFunctionalWorkflow' }, async () => 'done');
139
+ expect(wf.getNode().name).toBe('ValidFunctionalWorkflow');
140
+ });
141
+ });
142
+ describe('Error message clarity and actionability', () => {
143
+ it('should provide clear error message for empty name', () => {
144
+ expect(() => new Workflow({ name: '' }, async () => { }))
145
+ .toThrow('Workflow name cannot be empty or whitespace only');
146
+ });
147
+ it('should provide clear error message for long name', () => {
148
+ expect(() => new Workflow({ name: 'a'.repeat(101) }, async () => { }))
149
+ .toThrow('Workflow name cannot exceed 100 characters');
150
+ });
151
+ });
152
+ });
153
+ // ============================================================================
154
+ // Section 2: Backward Compatible Changes - WorkflowLogger.child()
155
+ // ============================================================================
156
+ // Change: child() now accepts Partial<LogEntry> in addition to string
157
+ // Backward Compatibility: String-based API still works via function overloads
158
+ // ============================================================================
159
+ describe('Backward Compatible Changes - WorkflowLogger.child()', () => {
160
+ describe('String-based API (backward compatible)', () => {
161
+ it('should support string-based logger.child() with parentLogId', async () => {
162
+ class TestWorkflow extends Workflow {
163
+ async run() {
164
+ // Old API - should still work
165
+ const childLogger = this.logger.child('parent-log-id');
166
+ childLogger.info('Test message');
167
+ }
168
+ }
169
+ const workflow = new TestWorkflow();
170
+ await workflow.run();
171
+ expect(workflow.getNode().logs[0].parentLogId).toBe('parent-log-id');
172
+ });
173
+ it('should support string-based logger.child() with all log levels', async () => {
174
+ class TestWorkflow extends Workflow {
175
+ async run() {
176
+ const childLogger = this.logger.child('test-parent');
177
+ childLogger.debug('Debug message');
178
+ childLogger.info('Info message');
179
+ childLogger.warn('Warn message');
180
+ childLogger.error('Error message');
181
+ }
182
+ }
183
+ const workflow = new TestWorkflow();
184
+ await workflow.run();
185
+ expect(workflow.getNode().logs.length).toBe(4);
186
+ expect(workflow.getNode().logs[0].parentLogId).toBe('test-parent');
187
+ expect(workflow.getNode().logs[0].level).toBe('debug');
188
+ expect(workflow.getNode().logs[1].level).toBe('info');
189
+ expect(workflow.getNode().logs[2].level).toBe('warn');
190
+ expect(workflow.getNode().logs[3].level).toBe('error');
191
+ });
192
+ it('should support string-based logger.child() with data parameter', async () => {
193
+ class TestWorkflow extends Workflow {
194
+ async run() {
195
+ const childLogger = this.logger.child('data-parent');
196
+ childLogger.info('Message with data', { key: 'value', count: 42 });
197
+ }
198
+ }
199
+ const workflow = new TestWorkflow();
200
+ await workflow.run();
201
+ expect(workflow.getNode().logs[0].parentLogId).toBe('data-parent');
202
+ expect(workflow.getNode().logs[0].data).toEqual({ key: 'value', count: 42 });
203
+ });
204
+ it('should handle empty string (results in undefined parentLogId)', async () => {
205
+ class TestWorkflow extends Workflow {
206
+ async run() {
207
+ const childLogger = this.logger.child('');
208
+ childLogger.info('Test message');
209
+ }
210
+ }
211
+ const workflow = new TestWorkflow();
212
+ await workflow.run();
213
+ // Empty string is falsy, so parentLogId becomes undefined
214
+ expect(workflow.getNode().logs[0].parentLogId).toBeUndefined();
215
+ });
216
+ });
217
+ describe('New API - Partial<LogEntry> syntax (also backward compatible)', () => {
218
+ it('should support new object-based logger.child() API', async () => {
219
+ class TestWorkflow extends Workflow {
220
+ async run() {
221
+ // New API - should work alongside old API
222
+ const childLogger = this.logger.child({ parentLogId: 'parent-log-id' });
223
+ childLogger.info('Test message');
224
+ }
225
+ }
226
+ const workflow = new TestWorkflow();
227
+ await workflow.run();
228
+ expect(workflow.getNode().logs[0].parentLogId).toBe('parent-log-id');
229
+ });
230
+ });
231
+ describe('Parent-child log hierarchy (backward compatible)', () => {
232
+ it('should support multi-level nesting with string-based child loggers', async () => {
233
+ class TestWorkflow extends Workflow {
234
+ async run() {
235
+ // Root log
236
+ this.logger.info('Root message');
237
+ const rootLogId = this.node.logs[0].id;
238
+ // First level child - using string API (backward compatible)
239
+ const child1 = this.logger.child(rootLogId);
240
+ child1.info('Level 1 child');
241
+ const level1LogId = this.node.logs[1].id;
242
+ // Second level child - using string API
243
+ const child2 = this.logger.child(level1LogId);
244
+ child2.info('Level 2 child');
245
+ }
246
+ }
247
+ const workflow = new TestWorkflow();
248
+ await workflow.run();
249
+ expect(workflow.getNode().logs.length).toBe(3);
250
+ expect(workflow.getNode().logs[0].parentLogId).toBeUndefined();
251
+ expect(workflow.getNode().logs[1].parentLogId).toBe(workflow.getNode().logs[0].id);
252
+ expect(workflow.getNode().logs[2].parentLogId).toBe(workflow.getNode().logs[1].id);
253
+ });
254
+ });
255
+ });
256
+ // ============================================================================
257
+ // Section 3: Backward Compatible Changes - Promise.allSettled Default Behavior
258
+ // ============================================================================
259
+ // Change: @Task with concurrent: true now uses Promise.allSettled()
260
+ // Backward Compatibility: Default behavior unchanged - throws first error
261
+ // ============================================================================
262
+ describe('Backward Compatible Changes - Promise.allSettled Default Behavior', () => {
263
+ // Helper to create a child workflow that may fail
264
+ function createChildWorkflow(parent, name, shouldFail = false) {
265
+ return new ((() => {
266
+ let _classSuper = Workflow;
267
+ let _instanceExtraInitializers = [];
268
+ let _executeStep_decorators;
269
+ return class extends _classSuper {
270
+ static {
271
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
272
+ _executeStep_decorators = [Step()];
273
+ __esDecorate(this, null, _executeStep_decorators, { kind: "method", name: "executeStep", static: false, private: false, access: { has: obj => "executeStep" in obj, get: obj => obj.executeStep }, metadata: _metadata }, null, _instanceExtraInitializers);
274
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
275
+ }
276
+ constructor(n, p) {
277
+ super(n, p);
278
+ __runInitializers(this, _instanceExtraInitializers);
279
+ }
280
+ async executeStep() {
281
+ if (shouldFail) {
282
+ throw new Error(`${name} failed`);
283
+ }
284
+ return `${name} succeeded`;
285
+ }
286
+ async run() {
287
+ return this.executeStep();
288
+ }
289
+ };
290
+ })())(name, parent);
291
+ }
292
+ describe('Default behavior - throws first error (backward compatible)', () => {
293
+ it('should throw first error when concurrent task fails', async () => {
294
+ let ParentWorkflow = (() => {
295
+ let _classSuper = Workflow;
296
+ let _instanceExtraInitializers = [];
297
+ let _spawnChildren_decorators;
298
+ return class ParentWorkflow extends _classSuper {
299
+ static {
300
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
301
+ _spawnChildren_decorators = [Task({ concurrent: true })];
302
+ __esDecorate(this, null, _spawnChildren_decorators, { kind: "method", name: "spawnChildren", static: false, private: false, access: { has: obj => "spawnChildren" in obj, get: obj => obj.spawnChildren }, metadata: _metadata }, null, _instanceExtraInitializers);
303
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
304
+ }
305
+ async spawnChildren() {
306
+ return [
307
+ createChildWorkflow(this, 'Child-0', false),
308
+ createChildWorkflow(this, 'Child-1', true), // Will fail
309
+ createChildWorkflow(this, 'Child-2', false),
310
+ createChildWorkflow(this, 'Child-3', false),
311
+ ];
312
+ }
313
+ async run() {
314
+ await this.spawnChildren();
315
+ }
316
+ constructor() {
317
+ super(...arguments);
318
+ __runInitializers(this, _instanceExtraInitializers);
319
+ }
320
+ };
321
+ })();
322
+ const workflow = new ParentWorkflow('Parent');
323
+ // Should throw first error (backward compatible with Promise.all)
324
+ await expect(workflow.run()).rejects.toThrow('Child-1 failed');
325
+ });
326
+ it('should complete all workflows even when one fails', async () => {
327
+ let ParentWorkflow = (() => {
328
+ let _classSuper = Workflow;
329
+ let _instanceExtraInitializers = [];
330
+ let _spawnChildren_decorators;
331
+ return class ParentWorkflow extends _classSuper {
332
+ static {
333
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
334
+ _spawnChildren_decorators = [Task({ concurrent: true })];
335
+ __esDecorate(this, null, _spawnChildren_decorators, { kind: "method", name: "spawnChildren", static: false, private: false, access: { has: obj => "spawnChildren" in obj, get: obj => obj.spawnChildren }, metadata: _metadata }, null, _instanceExtraInitializers);
336
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
337
+ }
338
+ async spawnChildren() {
339
+ return [
340
+ createChildWorkflow(this, 'Child-0', false),
341
+ createChildWorkflow(this, 'Child-1', true), // Will fail
342
+ createChildWorkflow(this, 'Child-2', false),
343
+ ];
344
+ }
345
+ async run() {
346
+ try {
347
+ await this.spawnChildren();
348
+ }
349
+ catch {
350
+ // Expected
351
+ }
352
+ }
353
+ constructor() {
354
+ super(...arguments);
355
+ __runInitializers(this, _instanceExtraInitializers);
356
+ }
357
+ };
358
+ })();
359
+ const workflow = new ParentWorkflow('Parent');
360
+ await workflow.run();
361
+ // All children should be attached (Promise.allSettled completed all)
362
+ expect(workflow.children.length).toBe(3);
363
+ const childNames = workflow.children.map((c) => c.getNode().name);
364
+ expect(childNames).toContain('Child-0');
365
+ expect(childNames).toContain('Child-1');
366
+ expect(childNames).toContain('Child-2');
367
+ });
368
+ });
369
+ describe('No error merge strategy - default behavior preserved', () => {
370
+ it('should not merge errors when errorMergeStrategy is not enabled', async () => {
371
+ let ParentWorkflow = (() => {
372
+ let _classSuper = Workflow;
373
+ let _instanceExtraInitializers = [];
374
+ let _spawnChildren_decorators;
375
+ return class ParentWorkflow extends _classSuper {
376
+ static {
377
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
378
+ _spawnChildren_decorators = [Task({ concurrent: true })];
379
+ __esDecorate(this, null, _spawnChildren_decorators, { kind: "method", name: "spawnChildren", static: false, private: false, access: { has: obj => "spawnChildren" in obj, get: obj => obj.spawnChildren }, metadata: _metadata }, null, _instanceExtraInitializers);
380
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
381
+ }
382
+ async spawnChildren() {
383
+ return [
384
+ createChildWorkflow(this, 'Alpha', true),
385
+ createChildWorkflow(this, 'Beta', true),
386
+ createChildWorkflow(this, 'Gamma', false),
387
+ ];
388
+ }
389
+ async run() {
390
+ await this.spawnChildren();
391
+ }
392
+ constructor() {
393
+ super(...arguments);
394
+ __runInitializers(this, _instanceExtraInitializers);
395
+ }
396
+ };
397
+ })();
398
+ const workflow = new ParentWorkflow('Parent');
399
+ // Should throw first error only (backward compatible)
400
+ await expect(workflow.run()).rejects.toThrow('Alpha failed');
401
+ });
402
+ });
403
+ });
404
+ // ============================================================================
405
+ // Section 4: Documentation Examples - README Quick Start
406
+ // ============================================================================
407
+ // Tests that all README documentation examples execute without modification
408
+ // ============================================================================
409
+ describe('Documentation Examples - README Quick Start', () => {
410
+ describe('Class-based workflow from README', () => {
411
+ it('should execute README class-based workflow example', async () => {
412
+ // From README.md lines 22-42 (approximately)
413
+ let DataProcessor = (() => {
414
+ let _classSuper = Workflow;
415
+ let _instanceExtraInitializers = [];
416
+ let _progress_decorators;
417
+ let _progress_initializers = [];
418
+ let _progress_extraInitializers = [];
419
+ let _process_decorators;
420
+ return class DataProcessor extends _classSuper {
421
+ static {
422
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
423
+ _progress_decorators = [ObservedState()];
424
+ _process_decorators = [Step({ trackTiming: true, snapshotState: true })];
425
+ __esDecorate(this, null, _process_decorators, { kind: "method", name: "process", static: false, private: false, access: { has: obj => "process" in obj, get: obj => obj.process }, metadata: _metadata }, null, _instanceExtraInitializers);
426
+ __esDecorate(null, null, _progress_decorators, { kind: "field", name: "progress", static: false, private: false, access: { has: obj => "progress" in obj, get: obj => obj.progress, set: (obj, value) => { obj.progress = value; } }, metadata: _metadata }, _progress_initializers, _progress_extraInitializers);
427
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
428
+ }
429
+ progress = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _progress_initializers, 0));
430
+ async process() {
431
+ this.progress = 100;
432
+ return ['item1', 'item2', 'item3'];
433
+ }
434
+ async run() {
435
+ this.setStatus('running');
436
+ const result = await this.process();
437
+ this.setStatus('completed');
438
+ return result;
439
+ }
440
+ constructor() {
441
+ super(...arguments);
442
+ __runInitializers(this, _progress_extraInitializers);
443
+ }
444
+ };
445
+ })();
446
+ const workflow = new DataProcessor('DataProcessor');
447
+ const result = await workflow.run();
448
+ expect(result).toEqual(['item1', 'item2', 'item3']);
449
+ expect(workflow.status).toBe('completed');
450
+ expect(workflow.progress).toBe(100);
451
+ });
452
+ });
453
+ describe('Functional workflow from README', () => {
454
+ it('should execute README functional workflow example', async () => {
455
+ // From README.md lines 44-57 (approximately)
456
+ const fetchData = async () => ['data1', 'data2'];
457
+ const transform = async (data) => data.map(x => x.toUpperCase());
458
+ const workflow = createWorkflow({ name: 'DataPipeline' }, async (ctx) => {
459
+ const loaded = await ctx.step('load', async () => fetchData());
460
+ const processed = await ctx.step('process', async () => transform(loaded));
461
+ return processed;
462
+ });
463
+ const result = await workflow.run();
464
+ // Result can be either direct value or WorkflowResult object
465
+ if (typeof result === 'object' && result !== null && 'data' in result) {
466
+ expect(result.data).toEqual(['DATA1', 'DATA2']);
467
+ }
468
+ else {
469
+ expect(result).toEqual(['DATA1', 'DATA2']);
470
+ }
471
+ });
472
+ });
473
+ describe('Basic workflow creation pattern', () => {
474
+ it('should support basic class extension pattern', async () => {
475
+ // From README basic usage
476
+ class DataProcessor extends Workflow {
477
+ async run() {
478
+ this.setStatus('running');
479
+ this.logger.info('Processing started');
480
+ const result = await this.processData();
481
+ this.setStatus('completed');
482
+ return result;
483
+ }
484
+ async processData() {
485
+ return ['item1', 'item2'];
486
+ }
487
+ }
488
+ const workflow = new DataProcessor('MyProcessor');
489
+ const result = await workflow.run();
490
+ expect(result).toEqual(['item1', 'item2']);
491
+ expect(workflow.status).toBe('completed');
492
+ });
493
+ });
494
+ describe('Logger usage from documentation', () => {
495
+ it('should support all logger methods from documentation', async () => {
496
+ class LoggingWorkflow extends Workflow {
497
+ async run() {
498
+ this.setStatus('running');
499
+ // All logger methods from docs
500
+ this.logger.debug('Debug message', { data: 'test' });
501
+ this.logger.info('Info message');
502
+ this.logger.warn('Warning message');
503
+ this.logger.error('Error message', { error: new Error('test') });
504
+ this.setStatus('completed');
505
+ }
506
+ }
507
+ const workflow = new LoggingWorkflow('LoggerTest');
508
+ await workflow.run();
509
+ expect(workflow.getNode().logs.length).toBe(4);
510
+ expect(workflow.getNode().logs[0].level).toBe('debug');
511
+ expect(workflow.getNode().logs[1].level).toBe('info');
512
+ expect(workflow.getNode().logs[2].level).toBe('warn');
513
+ expect(workflow.getNode().logs[3].level).toBe('error');
514
+ });
515
+ });
516
+ });
517
+ // ============================================================================
518
+ // Section 5: Example Files - Core Patterns
519
+ // ============================================================================
520
+ // Tests that verify example file patterns work correctly
521
+ // ============================================================================
522
+ describe('Example Files - Core Patterns', () => {
523
+ describe('01-basic-workflow.ts patterns', () => {
524
+ it('should support basic workflow with status management', async () => {
525
+ // Pattern from examples/examples/01-basic-workflow.ts
526
+ class DataProcessingWorkflow extends Workflow {
527
+ data = [];
528
+ async run() {
529
+ this.setStatus('running');
530
+ this.logger.info('Starting data processing workflow');
531
+ try {
532
+ // Simulate data processing
533
+ this.data = ['item1', 'item2', 'item3'];
534
+ this.setStatus('completed');
535
+ this.logger.info('Workflow completed successfully');
536
+ return this.data;
537
+ }
538
+ catch (error) {
539
+ this.setStatus('failed');
540
+ this.logger.error('Workflow failed', { error });
541
+ throw error;
542
+ }
543
+ }
544
+ }
545
+ const workflow = new DataProcessingWorkflow('DataProcessor');
546
+ const result = await workflow.run();
547
+ expect(result).toEqual(['item1', 'item2', 'item3']);
548
+ expect(workflow.status).toBe('completed');
549
+ });
550
+ it('should support WorkflowTreeDebugger', async () => {
551
+ class SimpleWorkflow extends Workflow {
552
+ async run() {
553
+ this.setStatus('running');
554
+ this.logger.info('Running');
555
+ this.setStatus('completed');
556
+ return 'done';
557
+ }
558
+ }
559
+ const workflow = new SimpleWorkflow();
560
+ const debugger_ = new WorkflowTreeDebugger(workflow);
561
+ await workflow.run();
562
+ // Debugger should produce valid tree output
563
+ const treeString = debugger_.toTreeString();
564
+ expect(treeString).toContain('SimpleWorkflow');
565
+ });
566
+ });
567
+ describe('02-decorator-options.ts patterns', () => {
568
+ it('should support @Step with all options', async () => {
569
+ // Pattern from examples/examples/02-decorator-options.ts
570
+ let StepOptionsWorkflow = (() => {
571
+ let _classSuper = Workflow;
572
+ let _instanceExtraInitializers = [];
573
+ let _currentPhase_decorators;
574
+ let _currentPhase_initializers = [];
575
+ let _currentPhase_extraInitializers = [];
576
+ let _defaultStep_decorators;
577
+ let _stepWithCustomName_decorators;
578
+ let _stepWithSnapshot_decorators;
579
+ let _stepWithTiming_decorators;
580
+ let _stepWithLogging_decorators;
581
+ return class StepOptionsWorkflow extends _classSuper {
582
+ static {
583
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
584
+ _currentPhase_decorators = [ObservedState()];
585
+ _defaultStep_decorators = [Step()];
586
+ _stepWithCustomName_decorators = [Step({ name: 'CustomNamedStep' })];
587
+ _stepWithSnapshot_decorators = [Step({ snapshotState: true })];
588
+ _stepWithTiming_decorators = [Step({ trackTiming: true })];
589
+ _stepWithLogging_decorators = [Step({ logStart: true, logFinish: true })];
590
+ __esDecorate(this, null, _defaultStep_decorators, { kind: "method", name: "defaultStep", static: false, private: false, access: { has: obj => "defaultStep" in obj, get: obj => obj.defaultStep }, metadata: _metadata }, null, _instanceExtraInitializers);
591
+ __esDecorate(this, null, _stepWithCustomName_decorators, { kind: "method", name: "stepWithCustomName", static: false, private: false, access: { has: obj => "stepWithCustomName" in obj, get: obj => obj.stepWithCustomName }, metadata: _metadata }, null, _instanceExtraInitializers);
592
+ __esDecorate(this, null, _stepWithSnapshot_decorators, { kind: "method", name: "stepWithSnapshot", static: false, private: false, access: { has: obj => "stepWithSnapshot" in obj, get: obj => obj.stepWithSnapshot }, metadata: _metadata }, null, _instanceExtraInitializers);
593
+ __esDecorate(this, null, _stepWithTiming_decorators, { kind: "method", name: "stepWithTiming", static: false, private: false, access: { has: obj => "stepWithTiming" in obj, get: obj => obj.stepWithTiming }, metadata: _metadata }, null, _instanceExtraInitializers);
594
+ __esDecorate(this, null, _stepWithLogging_decorators, { kind: "method", name: "stepWithLogging", static: false, private: false, access: { has: obj => "stepWithLogging" in obj, get: obj => obj.stepWithLogging }, metadata: _metadata }, null, _instanceExtraInitializers);
595
+ __esDecorate(null, null, _currentPhase_decorators, { kind: "field", name: "currentPhase", static: false, private: false, access: { has: obj => "currentPhase" in obj, get: obj => obj.currentPhase, set: (obj, value) => { obj.currentPhase = value; } }, metadata: _metadata }, _currentPhase_initializers, _currentPhase_extraInitializers);
596
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
597
+ }
598
+ currentPhase = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _currentPhase_initializers, 'init'));
599
+ // Default step - minimal configuration
600
+ async defaultStep() {
601
+ this.currentPhase = 'default';
602
+ }
603
+ // Step with custom name
604
+ async stepWithCustomName() {
605
+ this.currentPhase = 'custom-named';
606
+ }
607
+ // Step with state snapshot
608
+ async stepWithSnapshot() {
609
+ this.currentPhase = 'snapshot';
610
+ }
611
+ // Step with timing tracking
612
+ async stepWithTiming() {
613
+ this.currentPhase = 'timed';
614
+ }
615
+ // Step with start/finish logging
616
+ async stepWithLogging() {
617
+ this.currentPhase = 'logged';
618
+ }
619
+ async run() {
620
+ this.setStatus('running');
621
+ await this.defaultStep();
622
+ await this.stepWithCustomName();
623
+ await this.stepWithSnapshot();
624
+ await this.stepWithTiming();
625
+ await this.stepWithLogging();
626
+ this.setStatus('completed');
627
+ }
628
+ constructor() {
629
+ super(...arguments);
630
+ __runInitializers(this, _currentPhase_extraInitializers);
631
+ }
632
+ };
633
+ })();
634
+ const workflow = new StepOptionsWorkflow();
635
+ await workflow.run();
636
+ expect(workflow.status).toBe('completed');
637
+ expect(workflow.currentPhase).toBe('logged');
638
+ });
639
+ it('should support @ObservedState with redact option', async () => {
640
+ // Pattern from examples/examples/02-decorator-options.ts
641
+ let StateOptionsWorkflow = (() => {
642
+ let _classSuper = Workflow;
643
+ let _publicData_decorators;
644
+ let _publicData_initializers = [];
645
+ let _publicData_extraInitializers = [];
646
+ let _apiKey_decorators;
647
+ let _apiKey_initializers = [];
648
+ let _apiKey_extraInitializers = [];
649
+ let _internalCounter_decorators;
650
+ let _internalCounter_initializers = [];
651
+ let _internalCounter_extraInitializers = [];
652
+ return class StateOptionsWorkflow extends _classSuper {
653
+ static {
654
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
655
+ _publicData_decorators = [ObservedState()];
656
+ _apiKey_decorators = [ObservedState({ redact: true })];
657
+ _internalCounter_decorators = [ObservedState({ hidden: true })];
658
+ __esDecorate(null, null, _publicData_decorators, { kind: "field", name: "publicData", static: false, private: false, access: { has: obj => "publicData" in obj, get: obj => obj.publicData, set: (obj, value) => { obj.publicData = value; } }, metadata: _metadata }, _publicData_initializers, _publicData_extraInitializers);
659
+ __esDecorate(null, null, _apiKey_decorators, { kind: "field", name: "apiKey", static: false, private: false, access: { has: obj => "apiKey" in obj, get: obj => obj.apiKey, set: (obj, value) => { obj.apiKey = value; } }, metadata: _metadata }, _apiKey_initializers, _apiKey_extraInitializers);
660
+ __esDecorate(null, null, _internalCounter_decorators, { kind: "field", name: "internalCounter", static: false, private: false, access: { has: obj => "internalCounter" in obj, get: obj => obj.internalCounter, set: (obj, value) => { obj.internalCounter = value; } }, metadata: _metadata }, _internalCounter_initializers, _internalCounter_extraInitializers);
661
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
662
+ }
663
+ publicData = __runInitializers(this, _publicData_initializers, 'visible-value');
664
+ apiKey = (__runInitializers(this, _publicData_extraInitializers), __runInitializers(this, _apiKey_initializers, 'super-secret-api-key-12345'));
665
+ internalCounter = (__runInitializers(this, _apiKey_extraInitializers), __runInitializers(this, _internalCounter_initializers, 999));
666
+ async run() {
667
+ this.setStatus('running');
668
+ this.setStatus('completed');
669
+ }
670
+ constructor() {
671
+ super(...arguments);
672
+ __runInitializers(this, _internalCounter_extraInitializers);
673
+ }
674
+ };
675
+ })();
676
+ const workflow = new StateOptionsWorkflow();
677
+ await workflow.run();
678
+ const snapshot = getObservedState(workflow);
679
+ // Public data should be visible
680
+ expect(snapshot.publicData).toBe('visible-value');
681
+ // API key should be redacted
682
+ expect(snapshot.apiKey).toBe('***');
683
+ // Hidden field should not be present
684
+ expect('internalCounter' in snapshot).toBe(false);
685
+ });
686
+ });
687
+ describe('03-parent-child.ts patterns', () => {
688
+ it('should support hierarchical workflow creation', async () => {
689
+ // Pattern from examples/examples/03-parent-child.ts
690
+ let LeafWorkflow = (() => {
691
+ let _classSuper = Workflow;
692
+ let _instanceExtraInitializers = [];
693
+ let _processed_decorators;
694
+ let _processed_initializers = [];
695
+ let _processed_extraInitializers = [];
696
+ let _process_decorators;
697
+ return class LeafWorkflow extends _classSuper {
698
+ static {
699
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
700
+ _processed_decorators = [ObservedState()];
701
+ _process_decorators = [Step({ trackTiming: true })];
702
+ __esDecorate(this, null, _process_decorators, { kind: "method", name: "process", static: false, private: false, access: { has: obj => "process" in obj, get: obj => obj.process }, metadata: _metadata }, null, _instanceExtraInitializers);
703
+ __esDecorate(null, null, _processed_decorators, { kind: "field", name: "processed", static: false, private: false, access: { has: obj => "processed" in obj, get: obj => obj.processed, set: (obj, value) => { obj.processed = value; } }, metadata: _metadata }, _processed_initializers, _processed_extraInitializers);
704
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
705
+ }
706
+ processed = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _processed_initializers, false));
707
+ constructor(name, parent) {
708
+ super(name, parent);
709
+ __runInitializers(this, _processed_extraInitializers);
710
+ }
711
+ async process() {
712
+ this.logger.info(`Processing ${this.getNode().name}`);
713
+ this.processed = true;
714
+ }
715
+ async run() {
716
+ this.setStatus('running');
717
+ await this.process();
718
+ this.setStatus('completed');
719
+ }
720
+ };
721
+ })();
722
+ let ParentWorkflow = (() => {
723
+ let _classSuper = Workflow;
724
+ let _instanceExtraInitializers = [];
725
+ let _itemCount_decorators;
726
+ let _itemCount_initializers = [];
727
+ let _itemCount_extraInitializers = [];
728
+ let _spawnChild_decorators;
729
+ return class ParentWorkflow extends _classSuper {
730
+ static {
731
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
732
+ _itemCount_decorators = [ObservedState()];
733
+ _spawnChild_decorators = [Task()];
734
+ __esDecorate(this, null, _spawnChild_decorators, { kind: "method", name: "spawnChild", static: false, private: false, access: { has: obj => "spawnChild" in obj, get: obj => obj.spawnChild }, metadata: _metadata }, null, _instanceExtraInitializers);
735
+ __esDecorate(null, null, _itemCount_decorators, { kind: "field", name: "itemCount", static: false, private: false, access: { has: obj => "itemCount" in obj, get: obj => obj.itemCount, set: (obj, value) => { obj.itemCount = value; } }, metadata: _metadata }, _itemCount_initializers, _itemCount_extraInitializers);
736
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
737
+ }
738
+ itemCount = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _itemCount_initializers, 0));
739
+ async spawnChild(name) {
740
+ return new LeafWorkflow(name, this);
741
+ }
742
+ async run() {
743
+ this.setStatus('running');
744
+ this.itemCount = 2;
745
+ const child1 = await this.spawnChild('Child-1');
746
+ await child1.run();
747
+ const child2 = await this.spawnChild('Child-2');
748
+ await child2.run();
749
+ this.setStatus('completed');
750
+ }
751
+ constructor() {
752
+ super(...arguments);
753
+ __runInitializers(this, _itemCount_extraInitializers);
754
+ }
755
+ };
756
+ })();
757
+ const parent = new ParentWorkflow('Parent');
758
+ await parent.run();
759
+ expect(parent.status).toBe('completed');
760
+ expect(parent.children.length).toBe(2);
761
+ expect(parent.itemCount).toBe(2);
762
+ });
763
+ it('should support parent parameter in constructor', async () => {
764
+ class ChildWorkflow extends Workflow {
765
+ constructor(name, parent) {
766
+ super(name, parent);
767
+ }
768
+ async run() {
769
+ this.setStatus('running');
770
+ this.setStatus('completed');
771
+ return 'child-result';
772
+ }
773
+ }
774
+ let ParentWorkflow = (() => {
775
+ let _classSuper = Workflow;
776
+ let _instanceExtraInitializers = [];
777
+ let _createChild_decorators;
778
+ return class ParentWorkflow extends _classSuper {
779
+ static {
780
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
781
+ _createChild_decorators = [Task()];
782
+ __esDecorate(this, null, _createChild_decorators, { kind: "method", name: "createChild", static: false, private: false, access: { has: obj => "createChild" in obj, get: obj => obj.createChild }, metadata: _metadata }, null, _instanceExtraInitializers);
783
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
784
+ }
785
+ async createChild() {
786
+ return new ChildWorkflow('Child', this);
787
+ }
788
+ async run() {
789
+ this.setStatus('running');
790
+ const child = await this.createChild();
791
+ await child.run();
792
+ this.setStatus('completed');
793
+ }
794
+ constructor() {
795
+ super(...arguments);
796
+ __runInitializers(this, _instanceExtraInitializers);
797
+ }
798
+ };
799
+ })();
800
+ const parent = new ParentWorkflow('Parent');
801
+ await parent.run();
802
+ expect(parent.children.length).toBe(1);
803
+ expect(parent.children[0].getNode().name).toBe('Child');
804
+ expect(parent.children[0].parent).toBe(parent);
805
+ });
806
+ });
807
+ describe('05-error-handling.ts patterns', () => {
808
+ it('should support @Step with error wrapping', async () => {
809
+ // Pattern from examples/examples/05-error-handling.ts
810
+ let ErrorDemoWorkflow = (() => {
811
+ let _classSuper = Workflow;
812
+ let _instanceExtraInitializers = [];
813
+ let _currentStep_decorators;
814
+ let _currentStep_initializers = [];
815
+ let _currentStep_extraInitializers = [];
816
+ let _step1_decorators;
817
+ let _failingStep_decorators;
818
+ return class ErrorDemoWorkflow extends _classSuper {
819
+ static {
820
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
821
+ _currentStep_decorators = [ObservedState()];
822
+ _step1_decorators = [Step({ snapshotState: true })];
823
+ _failingStep_decorators = [Step({ snapshotState: true })];
824
+ __esDecorate(this, null, _step1_decorators, { kind: "method", name: "step1", static: false, private: false, access: { has: obj => "step1" in obj, get: obj => obj.step1 }, metadata: _metadata }, null, _instanceExtraInitializers);
825
+ __esDecorate(this, null, _failingStep_decorators, { kind: "method", name: "failingStep", static: false, private: false, access: { has: obj => "failingStep" in obj, get: obj => obj.failingStep }, metadata: _metadata }, null, _instanceExtraInitializers);
826
+ __esDecorate(null, null, _currentStep_decorators, { kind: "field", name: "currentStep", static: false, private: false, access: { has: obj => "currentStep" in obj, get: obj => obj.currentStep, set: (obj, value) => { obj.currentStep = value; } }, metadata: _metadata }, _currentStep_initializers, _currentStep_extraInitializers);
827
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
828
+ }
829
+ currentStep = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _currentStep_initializers, 'init'));
830
+ async step1() {
831
+ this.currentStep = 'step1';
832
+ }
833
+ async failingStep() {
834
+ this.currentStep = 'failing';
835
+ throw new Error('Something went wrong in failingStep!');
836
+ }
837
+ async run() {
838
+ this.setStatus('running');
839
+ await this.step1();
840
+ await this.failingStep();
841
+ this.setStatus('completed');
842
+ }
843
+ constructor() {
844
+ super(...arguments);
845
+ __runInitializers(this, _currentStep_extraInitializers);
846
+ }
847
+ };
848
+ })();
849
+ const workflow = new ErrorDemoWorkflow();
850
+ let capturedError = null;
851
+ try {
852
+ await workflow.run();
853
+ }
854
+ catch (error) {
855
+ capturedError = error;
856
+ }
857
+ expect(capturedError).not.toBeNull();
858
+ expect(capturedError?.message).toBe('Something went wrong in failingStep!');
859
+ expect(capturedError?.state.currentStep).toBe('failing');
860
+ expect(capturedError?.workflowId).toBe(workflow.id);
861
+ });
862
+ it('should support WorkflowError structure', async () => {
863
+ let FailingWorkflow = (() => {
864
+ let _classSuper = Workflow;
865
+ let _instanceExtraInitializers = [];
866
+ let _attempt_decorators;
867
+ let _attempt_initializers = [];
868
+ let _attempt_extraInitializers = [];
869
+ let _fail_decorators;
870
+ return class FailingWorkflow extends _classSuper {
871
+ static {
872
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
873
+ _attempt_decorators = [ObservedState()];
874
+ _fail_decorators = [Step()];
875
+ __esDecorate(this, null, _fail_decorators, { kind: "method", name: "fail", static: false, private: false, access: { has: obj => "fail" in obj, get: obj => obj.fail }, metadata: _metadata }, null, _instanceExtraInitializers);
876
+ __esDecorate(null, null, _attempt_decorators, { kind: "field", name: "attempt", static: false, private: false, access: { has: obj => "attempt" in obj, get: obj => obj.attempt, set: (obj, value) => { obj.attempt = value; } }, metadata: _metadata }, _attempt_initializers, _attempt_extraInitializers);
877
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
878
+ }
879
+ attempt = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _attempt_initializers, 1));
880
+ async fail() {
881
+ throw new Error('Test failure');
882
+ }
883
+ async run() {
884
+ this.setStatus('running');
885
+ await this.fail();
886
+ }
887
+ constructor() {
888
+ super(...arguments);
889
+ __runInitializers(this, _attempt_extraInitializers);
890
+ }
891
+ };
892
+ })();
893
+ const workflow = new FailingWorkflow();
894
+ let wfError = null;
895
+ try {
896
+ await workflow.run();
897
+ }
898
+ catch (error) {
899
+ wfError = error;
900
+ }
901
+ expect(wfError).toBeDefined();
902
+ expect(wfError?.message).toBe('Test failure');
903
+ expect(wfError?.workflowId).toBe(workflow.id);
904
+ expect(wfError?.state.attempt).toBe(1);
905
+ expect(Array.isArray(wfError?.logs)).toBe(true);
906
+ expect(wfError?.stack).toBeDefined();
907
+ });
908
+ });
909
+ describe('06-concurrent-tasks.ts patterns', () => {
910
+ it('should support @Task with concurrent option', async () => {
911
+ // Pattern from examples/examples/06-concurrent-tasks.ts
912
+ let WorkerWorkflow = (() => {
913
+ let _classSuper = Workflow;
914
+ let _instanceExtraInitializers = [];
915
+ let _result_decorators;
916
+ let _result_initializers = [];
917
+ let _result_extraInitializers = [];
918
+ let _process_decorators;
919
+ return class WorkerWorkflow extends _classSuper {
920
+ static {
921
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
922
+ _result_decorators = [ObservedState()];
923
+ _process_decorators = [Step({ trackTiming: true })];
924
+ __esDecorate(this, null, _process_decorators, { kind: "method", name: "process", static: false, private: false, access: { has: obj => "process" in obj, get: obj => obj.process }, metadata: _metadata }, null, _instanceExtraInitializers);
925
+ __esDecorate(null, null, _result_decorators, { kind: "field", name: "result", static: false, private: false, access: { has: obj => "result" in obj, get: obj => obj.result, set: (obj, value) => { obj.result = value; } }, metadata: _metadata }, _result_initializers, _result_extraInitializers);
926
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
927
+ }
928
+ result = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _result_initializers, ''));
929
+ constructor(id, parent) {
930
+ super(`Worker-${id}`, parent);
931
+ __runInitializers(this, _result_extraInitializers);
932
+ }
933
+ async process() {
934
+ this.result = `Result from ${this.getNode().name}`;
935
+ return this.result;
936
+ }
937
+ async run() {
938
+ this.setStatus('running');
939
+ const result = await this.process();
940
+ this.setStatus('completed');
941
+ return result;
942
+ }
943
+ };
944
+ })();
945
+ let ConcurrentWorkflow = (() => {
946
+ let _classSuper = Workflow;
947
+ let _instanceExtraInitializers = [];
948
+ let _workerCount_decorators;
949
+ let _workerCount_initializers = [];
950
+ let _workerCount_extraInitializers = [];
951
+ let _createAllWorkers_decorators;
952
+ return class ConcurrentWorkflow extends _classSuper {
953
+ static {
954
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
955
+ _workerCount_decorators = [ObservedState()];
956
+ _createAllWorkers_decorators = [Task({ concurrent: true })];
957
+ __esDecorate(this, null, _createAllWorkers_decorators, { kind: "method", name: "createAllWorkers", static: false, private: false, access: { has: obj => "createAllWorkers" in obj, get: obj => obj.createAllWorkers }, metadata: _metadata }, null, _instanceExtraInitializers);
958
+ __esDecorate(null, null, _workerCount_decorators, { kind: "field", name: "workerCount", static: false, private: false, access: { has: obj => "workerCount" in obj, get: obj => obj.workerCount, set: (obj, value) => { obj.workerCount = value; } }, metadata: _metadata }, _workerCount_initializers, _workerCount_extraInitializers);
959
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
960
+ }
961
+ workerCount = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _workerCount_initializers, 0));
962
+ async createAllWorkers() {
963
+ this.workerCount = 3;
964
+ return [
965
+ new WorkerWorkflow('1', this),
966
+ new WorkerWorkflow('2', this),
967
+ new WorkerWorkflow('3', this),
968
+ ];
969
+ }
970
+ async run() {
971
+ this.setStatus('running');
972
+ await this.createAllWorkers();
973
+ this.setStatus('completed');
974
+ }
975
+ constructor() {
976
+ super(...arguments);
977
+ __runInitializers(this, _workerCount_extraInitializers);
978
+ }
979
+ };
980
+ })();
981
+ const workflow = new ConcurrentWorkflow();
982
+ await workflow.run();
983
+ expect(workflow.status).toBe('completed');
984
+ expect(workflow.children.length).toBe(3);
985
+ expect(workflow.workerCount).toBe(3);
986
+ });
987
+ it('should support manual parallel execution pattern', async () => {
988
+ // Manual parallel execution (Promise.all) should still work
989
+ class WorkerWorkflow extends Workflow {
990
+ async run() {
991
+ this.setStatus('running');
992
+ this.setStatus('completed');
993
+ return 'worker-result';
994
+ }
995
+ }
996
+ let ManualParallelWorkflow = (() => {
997
+ let _classSuper = Workflow;
998
+ let _instanceExtraInitializers = [];
999
+ let _createWorker_decorators;
1000
+ return class ManualParallelWorkflow extends _classSuper {
1001
+ static {
1002
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1003
+ _createWorker_decorators = [Task()];
1004
+ __esDecorate(this, null, _createWorker_decorators, { kind: "method", name: "createWorker", static: false, private: false, access: { has: obj => "createWorker" in obj, get: obj => obj.createWorker }, metadata: _metadata }, null, _instanceExtraInitializers);
1005
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1006
+ }
1007
+ async createWorker() {
1008
+ return new WorkerWorkflow('Worker', this);
1009
+ }
1010
+ async run() {
1011
+ this.setStatus('running');
1012
+ // Manual parallel execution
1013
+ const workers = await Promise.all([
1014
+ this.createWorker(),
1015
+ this.createWorker(),
1016
+ this.createWorker(),
1017
+ ]);
1018
+ const results = await Promise.all(workers.map(w => w.run()));
1019
+ this.setStatus('completed');
1020
+ return results;
1021
+ }
1022
+ constructor() {
1023
+ super(...arguments);
1024
+ __runInitializers(this, _instanceExtraInitializers);
1025
+ }
1026
+ };
1027
+ })();
1028
+ const workflow = new ManualParallelWorkflow();
1029
+ const results = await workflow.run();
1030
+ expect(results).toEqual(['worker-result', 'worker-result', 'worker-result']);
1031
+ expect(workflow.children.length).toBe(3);
1032
+ });
1033
+ });
1034
+ });
1035
+ // ============================================================================
1036
+ // Section 6: Decorator Patterns - Comprehensive Coverage
1037
+ // ============================================================================
1038
+ // Tests for all decorator option combinations
1039
+ // ============================================================================
1040
+ describe('Decorator Patterns - Comprehensive Coverage', () => {
1041
+ describe('@Step decorator variations', () => {
1042
+ it('should support @Step with no options', async () => {
1043
+ let TestWorkflow = (() => {
1044
+ let _classSuper = Workflow;
1045
+ let _instanceExtraInitializers = [];
1046
+ let _basicStep_decorators;
1047
+ return class TestWorkflow extends _classSuper {
1048
+ static {
1049
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1050
+ _basicStep_decorators = [Step()];
1051
+ __esDecorate(this, null, _basicStep_decorators, { kind: "method", name: "basicStep", static: false, private: false, access: { has: obj => "basicStep" in obj, get: obj => obj.basicStep }, metadata: _metadata }, null, _instanceExtraInitializers);
1052
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1053
+ }
1054
+ async basicStep() {
1055
+ this.logger.info('Basic step');
1056
+ }
1057
+ async run() {
1058
+ await this.basicStep();
1059
+ }
1060
+ constructor() {
1061
+ super(...arguments);
1062
+ __runInitializers(this, _instanceExtraInitializers);
1063
+ }
1064
+ };
1065
+ })();
1066
+ const workflow = new TestWorkflow();
1067
+ await workflow.run();
1068
+ expect(workflow.getNode().logs.some(l => l.message === 'Basic step')).toBe(true);
1069
+ });
1070
+ it('should support @Step with trackTiming option', async () => {
1071
+ const events = [];
1072
+ let TestWorkflow = (() => {
1073
+ let _classSuper = Workflow;
1074
+ let _instanceExtraInitializers = [];
1075
+ let _timedStep_decorators;
1076
+ return class TestWorkflow extends _classSuper {
1077
+ static {
1078
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1079
+ _timedStep_decorators = [Step({ trackTiming: true })];
1080
+ __esDecorate(this, null, _timedStep_decorators, { kind: "method", name: "timedStep", static: false, private: false, access: { has: obj => "timedStep" in obj, get: obj => obj.timedStep }, metadata: _metadata }, null, _instanceExtraInitializers);
1081
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1082
+ }
1083
+ async timedStep() {
1084
+ // Do nothing
1085
+ }
1086
+ async run() {
1087
+ await this.timedStep();
1088
+ }
1089
+ constructor() {
1090
+ super(...arguments);
1091
+ __runInitializers(this, _instanceExtraInitializers);
1092
+ }
1093
+ };
1094
+ })();
1095
+ const workflow = new TestWorkflow();
1096
+ workflow.addObserver({
1097
+ onLog: () => { },
1098
+ onEvent: (e) => events.push(e),
1099
+ onStateUpdated: () => { },
1100
+ onTreeChanged: () => { },
1101
+ });
1102
+ await workflow.run();
1103
+ const stepEndEvents = events.filter(e => e.type === 'stepEnd');
1104
+ expect(stepEndEvents.length).toBeGreaterThan(0);
1105
+ if (stepEndEvents[0].type === 'stepEnd') {
1106
+ expect(stepEndEvents[0].duration).toBeDefined();
1107
+ }
1108
+ });
1109
+ it('should support @Step with snapshotState option', async () => {
1110
+ let TestWorkflow = (() => {
1111
+ let _classSuper = Workflow;
1112
+ let _instanceExtraInitializers = [];
1113
+ let _value_decorators;
1114
+ let _value_initializers = [];
1115
+ let _value_extraInitializers = [];
1116
+ let _updateStep_decorators;
1117
+ return class TestWorkflow extends _classSuper {
1118
+ static {
1119
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1120
+ _value_decorators = [ObservedState()];
1121
+ _updateStep_decorators = [Step({ snapshotState: true })];
1122
+ __esDecorate(this, null, _updateStep_decorators, { kind: "method", name: "updateStep", static: false, private: false, access: { has: obj => "updateStep" in obj, get: obj => obj.updateStep }, metadata: _metadata }, null, _instanceExtraInitializers);
1123
+ __esDecorate(null, null, _value_decorators, { kind: "field", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
1124
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1125
+ }
1126
+ value = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _value_initializers, 0));
1127
+ async updateStep() {
1128
+ this.value = 42;
1129
+ }
1130
+ async run() {
1131
+ await this.updateStep();
1132
+ }
1133
+ constructor() {
1134
+ super(...arguments);
1135
+ __runInitializers(this, _value_extraInitializers);
1136
+ }
1137
+ };
1138
+ })();
1139
+ const workflow = new TestWorkflow();
1140
+ await workflow.run();
1141
+ expect(workflow.value).toBe(42);
1142
+ });
1143
+ it('should support @Step with logStart and logFinish options', async () => {
1144
+ let TestWorkflow = (() => {
1145
+ let _classSuper = Workflow;
1146
+ let _instanceExtraInitializers = [];
1147
+ let _loggedStep_decorators;
1148
+ return class TestWorkflow extends _classSuper {
1149
+ static {
1150
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1151
+ _loggedStep_decorators = [Step({ logStart: true, logFinish: true })];
1152
+ __esDecorate(this, null, _loggedStep_decorators, { kind: "method", name: "loggedStep", static: false, private: false, access: { has: obj => "loggedStep" in obj, get: obj => obj.loggedStep }, metadata: _metadata }, null, _instanceExtraInitializers);
1153
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1154
+ }
1155
+ async loggedStep() {
1156
+ this.logger.info('Inside step');
1157
+ }
1158
+ async run() {
1159
+ await this.loggedStep();
1160
+ }
1161
+ constructor() {
1162
+ super(...arguments);
1163
+ __runInitializers(this, _instanceExtraInitializers);
1164
+ }
1165
+ };
1166
+ })();
1167
+ const workflow = new TestWorkflow();
1168
+ await workflow.run();
1169
+ const logs = workflow.getNode().logs;
1170
+ expect(logs.some(l => l.message.includes('STEP START'))).toBe(true);
1171
+ expect(logs.some(l => l.message.includes('Inside step'))).toBe(true);
1172
+ expect(logs.some(l => l.message.includes('STEP END'))).toBe(true);
1173
+ });
1174
+ it('should support @Step with all options combined', async () => {
1175
+ let TestWorkflow = (() => {
1176
+ let _classSuper = Workflow;
1177
+ let _instanceExtraInitializers = [];
1178
+ let _phase_decorators;
1179
+ let _phase_initializers = [];
1180
+ let _phase_extraInitializers = [];
1181
+ let _fullStep_decorators;
1182
+ return class TestWorkflow extends _classSuper {
1183
+ static {
1184
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1185
+ _phase_decorators = [ObservedState()];
1186
+ _fullStep_decorators = [Step({
1187
+ name: 'FullyConfigured',
1188
+ trackTiming: true,
1189
+ snapshotState: true,
1190
+ logStart: true,
1191
+ logFinish: true,
1192
+ })];
1193
+ __esDecorate(this, null, _fullStep_decorators, { kind: "method", name: "fullStep", static: false, private: false, access: { has: obj => "fullStep" in obj, get: obj => obj.fullStep }, metadata: _metadata }, null, _instanceExtraInitializers);
1194
+ __esDecorate(null, null, _phase_decorators, { kind: "field", name: "phase", static: false, private: false, access: { has: obj => "phase" in obj, get: obj => obj.phase, set: (obj, value) => { obj.phase = value; } }, metadata: _metadata }, _phase_initializers, _phase_extraInitializers);
1195
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1196
+ }
1197
+ phase = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _phase_initializers, 'init'));
1198
+ async fullStep() {
1199
+ this.phase = 'complete';
1200
+ }
1201
+ async run() {
1202
+ await this.fullStep();
1203
+ }
1204
+ constructor() {
1205
+ super(...arguments);
1206
+ __runInitializers(this, _phase_extraInitializers);
1207
+ }
1208
+ };
1209
+ })();
1210
+ const workflow = new TestWorkflow();
1211
+ await workflow.run();
1212
+ expect(workflow.phase).toBe('complete');
1213
+ });
1214
+ });
1215
+ describe('@Task decorator variations', () => {
1216
+ it('should support @Task with no options', async () => {
1217
+ class ChildWorkflow extends Workflow {
1218
+ async run() {
1219
+ return 'child-result';
1220
+ }
1221
+ }
1222
+ let ParentWorkflow = (() => {
1223
+ let _classSuper = Workflow;
1224
+ let _instanceExtraInitializers = [];
1225
+ let _createChild_decorators;
1226
+ return class ParentWorkflow extends _classSuper {
1227
+ static {
1228
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1229
+ _createChild_decorators = [Task()];
1230
+ __esDecorate(this, null, _createChild_decorators, { kind: "method", name: "createChild", static: false, private: false, access: { has: obj => "createChild" in obj, get: obj => obj.createChild }, metadata: _metadata }, null, _instanceExtraInitializers);
1231
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1232
+ }
1233
+ async createChild() {
1234
+ return new ChildWorkflow('Child', this);
1235
+ }
1236
+ async run() {
1237
+ const child = await this.createChild();
1238
+ await child.run();
1239
+ }
1240
+ constructor() {
1241
+ super(...arguments);
1242
+ __runInitializers(this, _instanceExtraInitializers);
1243
+ }
1244
+ };
1245
+ })();
1246
+ const workflow = new ParentWorkflow();
1247
+ await workflow.run();
1248
+ expect(workflow.children.length).toBe(1);
1249
+ });
1250
+ it('should support @Task with custom name', async () => {
1251
+ class ChildWorkflow extends Workflow {
1252
+ async run() {
1253
+ return 'result';
1254
+ }
1255
+ }
1256
+ let ParentWorkflow = (() => {
1257
+ let _classSuper = Workflow;
1258
+ let _instanceExtraInitializers = [];
1259
+ let _createChild_decorators;
1260
+ return class ParentWorkflow extends _classSuper {
1261
+ static {
1262
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1263
+ _createChild_decorators = [Task({ name: 'CustomTaskName' })];
1264
+ __esDecorate(this, null, _createChild_decorators, { kind: "method", name: "createChild", static: false, private: false, access: { has: obj => "createChild" in obj, get: obj => obj.createChild }, metadata: _metadata }, null, _instanceExtraInitializers);
1265
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1266
+ }
1267
+ async createChild() {
1268
+ return new ChildWorkflow('Child', this);
1269
+ }
1270
+ async run() {
1271
+ await this.createChild();
1272
+ }
1273
+ constructor() {
1274
+ super(...arguments);
1275
+ __runInitializers(this, _instanceExtraInitializers);
1276
+ }
1277
+ };
1278
+ })();
1279
+ const workflow = new ParentWorkflow();
1280
+ const events = [];
1281
+ workflow.addObserver({
1282
+ onLog: () => { },
1283
+ onEvent: (e) => events.push(e),
1284
+ onStateUpdated: () => { },
1285
+ onTreeChanged: () => { },
1286
+ });
1287
+ await workflow.run();
1288
+ const taskEvents = events.filter(e => e.type === 'taskStart' || e.type === 'taskEnd');
1289
+ expect(taskEvents.length).toBeGreaterThan(0);
1290
+ });
1291
+ it('should support @Task with concurrent option', async () => {
1292
+ class ChildWorkflow extends Workflow {
1293
+ async run() {
1294
+ return 'result';
1295
+ }
1296
+ }
1297
+ let ParentWorkflow = (() => {
1298
+ let _classSuper = Workflow;
1299
+ let _instanceExtraInitializers = [];
1300
+ let _createChildren_decorators;
1301
+ return class ParentWorkflow extends _classSuper {
1302
+ static {
1303
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1304
+ _createChildren_decorators = [Task({ concurrent: true })];
1305
+ __esDecorate(this, null, _createChildren_decorators, { kind: "method", name: "createChildren", static: false, private: false, access: { has: obj => "createChildren" in obj, get: obj => obj.createChildren }, metadata: _metadata }, null, _instanceExtraInitializers);
1306
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1307
+ }
1308
+ async createChildren() {
1309
+ return [
1310
+ new ChildWorkflow('Child-1', this),
1311
+ new ChildWorkflow('Child-2', this),
1312
+ new ChildWorkflow('Child-3', this),
1313
+ ];
1314
+ }
1315
+ async run() {
1316
+ await this.createChildren();
1317
+ }
1318
+ constructor() {
1319
+ super(...arguments);
1320
+ __runInitializers(this, _instanceExtraInitializers);
1321
+ }
1322
+ };
1323
+ })();
1324
+ const workflow = new ParentWorkflow();
1325
+ await workflow.run();
1326
+ expect(workflow.children.length).toBe(3);
1327
+ });
1328
+ });
1329
+ describe('@ObservedState decorator variations', () => {
1330
+ it('should support @ObservedState with no options', async () => {
1331
+ let TestWorkflow = (() => {
1332
+ let _classSuper = Workflow;
1333
+ let _value_decorators;
1334
+ let _value_initializers = [];
1335
+ let _value_extraInitializers = [];
1336
+ return class TestWorkflow extends _classSuper {
1337
+ static {
1338
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1339
+ _value_decorators = [ObservedState()];
1340
+ __esDecorate(null, null, _value_decorators, { kind: "field", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
1341
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1342
+ }
1343
+ value = __runInitializers(this, _value_initializers, 0);
1344
+ async run() {
1345
+ this.value = 42;
1346
+ }
1347
+ constructor() {
1348
+ super(...arguments);
1349
+ __runInitializers(this, _value_extraInitializers);
1350
+ }
1351
+ };
1352
+ })();
1353
+ const workflow = new TestWorkflow();
1354
+ await workflow.run();
1355
+ const snapshot = getObservedState(workflow);
1356
+ expect(snapshot.value).toBe(42);
1357
+ });
1358
+ it('should support @ObservedState with redact option', async () => {
1359
+ let TestWorkflow = (() => {
1360
+ let _classSuper = Workflow;
1361
+ let _apiKey_decorators;
1362
+ let _apiKey_initializers = [];
1363
+ let _apiKey_extraInitializers = [];
1364
+ return class TestWorkflow extends _classSuper {
1365
+ static {
1366
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1367
+ _apiKey_decorators = [ObservedState({ redact: true })];
1368
+ __esDecorate(null, null, _apiKey_decorators, { kind: "field", name: "apiKey", static: false, private: false, access: { has: obj => "apiKey" in obj, get: obj => obj.apiKey, set: (obj, value) => { obj.apiKey = value; } }, metadata: _metadata }, _apiKey_initializers, _apiKey_extraInitializers);
1369
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1370
+ }
1371
+ apiKey = __runInitializers(this, _apiKey_initializers, 'secret-key');
1372
+ async run() {
1373
+ // Do nothing
1374
+ }
1375
+ constructor() {
1376
+ super(...arguments);
1377
+ __runInitializers(this, _apiKey_extraInitializers);
1378
+ }
1379
+ };
1380
+ })();
1381
+ const workflow = new TestWorkflow();
1382
+ await workflow.run();
1383
+ const snapshot = getObservedState(workflow);
1384
+ expect(snapshot.apiKey).toBe('***');
1385
+ });
1386
+ it('should support @ObservedState with hidden option', async () => {
1387
+ let TestWorkflow = (() => {
1388
+ let _classSuper = Workflow;
1389
+ let _internalId_decorators;
1390
+ let _internalId_initializers = [];
1391
+ let _internalId_extraInitializers = [];
1392
+ return class TestWorkflow extends _classSuper {
1393
+ static {
1394
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1395
+ _internalId_decorators = [ObservedState({ hidden: true })];
1396
+ __esDecorate(null, null, _internalId_decorators, { kind: "field", name: "internalId", static: false, private: false, access: { has: obj => "internalId" in obj, get: obj => obj.internalId, set: (obj, value) => { obj.internalId = value; } }, metadata: _metadata }, _internalId_initializers, _internalId_extraInitializers);
1397
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1398
+ }
1399
+ internalId = __runInitializers(this, _internalId_initializers, 'internal-123');
1400
+ async run() {
1401
+ // Do nothing
1402
+ }
1403
+ constructor() {
1404
+ super(...arguments);
1405
+ __runInitializers(this, _internalId_extraInitializers);
1406
+ }
1407
+ };
1408
+ })();
1409
+ const workflow = new TestWorkflow();
1410
+ await workflow.run();
1411
+ const snapshot = getObservedState(workflow);
1412
+ expect('internalId' in snapshot).toBe(false);
1413
+ });
1414
+ it('should support multiple @ObservedState fields', async () => {
1415
+ let TestWorkflow = (() => {
1416
+ let _classSuper = Workflow;
1417
+ let _field1_decorators;
1418
+ let _field1_initializers = [];
1419
+ let _field1_extraInitializers = [];
1420
+ let _field2_decorators;
1421
+ let _field2_initializers = [];
1422
+ let _field2_extraInitializers = [];
1423
+ let _secret_decorators;
1424
+ let _secret_initializers = [];
1425
+ let _secret_extraInitializers = [];
1426
+ let _internal_decorators;
1427
+ let _internal_initializers = [];
1428
+ let _internal_extraInitializers = [];
1429
+ return class TestWorkflow extends _classSuper {
1430
+ static {
1431
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1432
+ _field1_decorators = [ObservedState()];
1433
+ _field2_decorators = [ObservedState()];
1434
+ _secret_decorators = [ObservedState({ redact: true })];
1435
+ _internal_decorators = [ObservedState({ hidden: true })];
1436
+ __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _field1_extraInitializers);
1437
+ __esDecorate(null, null, _field2_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj.field2, set: (obj, value) => { obj.field2 = value; } }, metadata: _metadata }, _field2_initializers, _field2_extraInitializers);
1438
+ __esDecorate(null, null, _secret_decorators, { kind: "field", name: "secret", static: false, private: false, access: { has: obj => "secret" in obj, get: obj => obj.secret, set: (obj, value) => { obj.secret = value; } }, metadata: _metadata }, _secret_initializers, _secret_extraInitializers);
1439
+ __esDecorate(null, null, _internal_decorators, { kind: "field", name: "internal", static: false, private: false, access: { has: obj => "internal" in obj, get: obj => obj.internal, set: (obj, value) => { obj.internal = value; } }, metadata: _metadata }, _internal_initializers, _internal_extraInitializers);
1440
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1441
+ }
1442
+ field1 = __runInitializers(this, _field1_initializers, 'value1');
1443
+ field2 = (__runInitializers(this, _field1_extraInitializers), __runInitializers(this, _field2_initializers, 42));
1444
+ secret = (__runInitializers(this, _field2_extraInitializers), __runInitializers(this, _secret_initializers, 'hidden'));
1445
+ internal = (__runInitializers(this, _secret_extraInitializers), __runInitializers(this, _internal_initializers, 'not-visible'));
1446
+ async run() {
1447
+ // Do nothing
1448
+ }
1449
+ constructor() {
1450
+ super(...arguments);
1451
+ __runInitializers(this, _internal_extraInitializers);
1452
+ }
1453
+ };
1454
+ })();
1455
+ const workflow = new TestWorkflow();
1456
+ await workflow.run();
1457
+ const snapshot = getObservedState(workflow);
1458
+ expect(snapshot.field1).toBe('value1');
1459
+ expect(snapshot.field2).toBe(42);
1460
+ expect(snapshot.secret).toBe('***');
1461
+ expect('internal' in snapshot).toBe(false);
1462
+ });
1463
+ });
1464
+ });
1465
+ // ============================================================================
1466
+ // Section 7: Parent-Child Patterns - Hierarchical Workflows
1467
+ // ============================================================================
1468
+ // Tests for parent-child relationship patterns
1469
+ // ============================================================================
1470
+ describe('Parent-Child Patterns - Hierarchical Workflows', () => {
1471
+ describe('Constructor-based parent attachment', () => {
1472
+ it('should attach child via constructor parent parameter', async () => {
1473
+ class ChildWorkflow extends Workflow {
1474
+ constructor(name, parent) {
1475
+ super(name, parent);
1476
+ }
1477
+ async run() {
1478
+ this.setStatus('running');
1479
+ this.setStatus('completed');
1480
+ return 'child-done';
1481
+ }
1482
+ }
1483
+ class ParentWorkflow extends Workflow {
1484
+ async run() {
1485
+ this.setStatus('running');
1486
+ const child1 = new ChildWorkflow('Child1', this);
1487
+ await child1.run();
1488
+ const child2 = new ChildWorkflow('Child2', this);
1489
+ await child2.run();
1490
+ this.setStatus('completed');
1491
+ }
1492
+ }
1493
+ const parent = new ParentWorkflow('Parent');
1494
+ await parent.run();
1495
+ expect(parent.children.length).toBe(2);
1496
+ expect(parent.children[0].parent).toBe(parent);
1497
+ expect(parent.children[1].parent).toBe(parent);
1498
+ });
1499
+ it('should establish bidirectional parent-child relationship', async () => {
1500
+ class ChildWorkflow extends Workflow {
1501
+ constructor(name, parent) {
1502
+ super(name, parent);
1503
+ }
1504
+ async run() {
1505
+ return 'done';
1506
+ }
1507
+ }
1508
+ let ParentWorkflow = (() => {
1509
+ let _classSuper = Workflow;
1510
+ let _instanceExtraInitializers = [];
1511
+ let _spawnChild_decorators;
1512
+ return class ParentWorkflow extends _classSuper {
1513
+ static {
1514
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1515
+ _spawnChild_decorators = [Task()];
1516
+ __esDecorate(this, null, _spawnChild_decorators, { kind: "method", name: "spawnChild", static: false, private: false, access: { has: obj => "spawnChild" in obj, get: obj => obj.spawnChild }, metadata: _metadata }, null, _instanceExtraInitializers);
1517
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1518
+ }
1519
+ async spawnChild() {
1520
+ return new ChildWorkflow('Child', this);
1521
+ }
1522
+ async run() {
1523
+ const child = await this.spawnChild();
1524
+ await child.run();
1525
+ }
1526
+ constructor() {
1527
+ super(...arguments);
1528
+ __runInitializers(this, _instanceExtraInitializers);
1529
+ }
1530
+ };
1531
+ })();
1532
+ const parent = new ParentWorkflow('Parent');
1533
+ await parent.run();
1534
+ const child = parent.children[0];
1535
+ expect(child.parent).toBe(parent);
1536
+ expect(parent.children).toContain(child);
1537
+ expect(parent.getNode().children).toContain(child.getNode());
1538
+ });
1539
+ });
1540
+ describe('Deep hierarchies', () => {
1541
+ it('should support multi-level parent-child chains', async () => {
1542
+ class Level3Workflow extends Workflow {
1543
+ constructor(name, parent) {
1544
+ super(name, parent);
1545
+ }
1546
+ async run() {
1547
+ this.setStatus('running');
1548
+ this.setStatus('completed');
1549
+ return 'level3';
1550
+ }
1551
+ }
1552
+ let Level2Workflow = (() => {
1553
+ let _classSuper = Workflow;
1554
+ let _instanceExtraInitializers = [];
1555
+ let _spawnLevel3_decorators;
1556
+ return class Level2Workflow extends _classSuper {
1557
+ static {
1558
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1559
+ _spawnLevel3_decorators = [Task()];
1560
+ __esDecorate(this, null, _spawnLevel3_decorators, { kind: "method", name: "spawnLevel3", static: false, private: false, access: { has: obj => "spawnLevel3" in obj, get: obj => obj.spawnLevel3 }, metadata: _metadata }, null, _instanceExtraInitializers);
1561
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1562
+ }
1563
+ constructor(name, parent) {
1564
+ super(name, parent);
1565
+ __runInitializers(this, _instanceExtraInitializers);
1566
+ }
1567
+ async spawnLevel3() {
1568
+ return new Level3Workflow('Level3', this);
1569
+ }
1570
+ async run() {
1571
+ this.setStatus('running');
1572
+ const child = await this.spawnLevel3();
1573
+ await child.run();
1574
+ this.setStatus('completed');
1575
+ return 'level2';
1576
+ }
1577
+ };
1578
+ })();
1579
+ let Level1Workflow = (() => {
1580
+ let _classSuper = Workflow;
1581
+ let _instanceExtraInitializers = [];
1582
+ let _spawnLevel2_decorators;
1583
+ return class Level1Workflow extends _classSuper {
1584
+ static {
1585
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1586
+ _spawnLevel2_decorators = [Task()];
1587
+ __esDecorate(this, null, _spawnLevel2_decorators, { kind: "method", name: "spawnLevel2", static: false, private: false, access: { has: obj => "spawnLevel2" in obj, get: obj => obj.spawnLevel2 }, metadata: _metadata }, null, _instanceExtraInitializers);
1588
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1589
+ }
1590
+ async spawnLevel2() {
1591
+ return new Level2Workflow('Level2', this);
1592
+ }
1593
+ async run() {
1594
+ this.setStatus('running');
1595
+ const child = await this.spawnLevel2();
1596
+ await child.run();
1597
+ this.setStatus('completed');
1598
+ }
1599
+ constructor() {
1600
+ super(...arguments);
1601
+ __runInitializers(this, _instanceExtraInitializers);
1602
+ }
1603
+ };
1604
+ })();
1605
+ const root = new Level1Workflow('Level1');
1606
+ await root.run();
1607
+ expect(root.children.length).toBe(1);
1608
+ const level2 = root.children[0];
1609
+ expect(level2.children.length).toBe(1);
1610
+ const level3 = level2.children[0];
1611
+ expect(level3.parent).toBe(level2);
1612
+ expect(level2.parent).toBe(root);
1613
+ });
1614
+ });
1615
+ describe('Sibling workflows', () => {
1616
+ it('should support multiple children of same parent', async () => {
1617
+ class ChildWorkflow extends Workflow {
1618
+ constructor(name, parent) {
1619
+ super(name, parent);
1620
+ }
1621
+ async run() {
1622
+ return 'done';
1623
+ }
1624
+ }
1625
+ let ParentWorkflow = (() => {
1626
+ let _classSuper = Workflow;
1627
+ let _childCount_decorators;
1628
+ let _childCount_initializers = [];
1629
+ let _childCount_extraInitializers = [];
1630
+ return class ParentWorkflow extends _classSuper {
1631
+ static {
1632
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1633
+ _childCount_decorators = [ObservedState()];
1634
+ __esDecorate(null, null, _childCount_decorators, { kind: "field", name: "childCount", static: false, private: false, access: { has: obj => "childCount" in obj, get: obj => obj.childCount, set: (obj, value) => { obj.childCount = value; } }, metadata: _metadata }, _childCount_initializers, _childCount_extraInitializers);
1635
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1636
+ }
1637
+ childCount = __runInitializers(this, _childCount_initializers, 0);
1638
+ async run() {
1639
+ this.childCount = 3;
1640
+ for (let i = 1; i <= 3; i++) {
1641
+ const child = new ChildWorkflow(`Child${i}`, this);
1642
+ await child.run();
1643
+ }
1644
+ }
1645
+ constructor() {
1646
+ super(...arguments);
1647
+ __runInitializers(this, _childCount_extraInitializers);
1648
+ }
1649
+ };
1650
+ })();
1651
+ const parent = new ParentWorkflow('Parent');
1652
+ await parent.run();
1653
+ expect(parent.children.length).toBe(3);
1654
+ expect(parent.childCount).toBe(3);
1655
+ const childNames = parent.children.map(c => c.getNode().name);
1656
+ expect(childNames).toEqual(['Child1', 'Child2', 'Child3']);
1657
+ });
1658
+ });
1659
+ });
1660
+ // ============================================================================
1661
+ // Section 8: Additional Backward Compatibility Validations
1662
+ // ============================================================================
1663
+ // Additional tests for comprehensive backward compatibility coverage
1664
+ // ============================================================================
1665
+ describe('Additional Backward Compatibility Validations', () => {
1666
+ describe('Workflow status transitions', () => {
1667
+ it('should support all status transitions from examples', async () => {
1668
+ class StatusWorkflow extends Workflow {
1669
+ async run() {
1670
+ // idle -> running -> completed
1671
+ expect(this.status).toBe('idle');
1672
+ this.setStatus('running');
1673
+ expect(this.status).toBe('running');
1674
+ this.setStatus('completed');
1675
+ expect(this.status).toBe('completed');
1676
+ }
1677
+ }
1678
+ const workflow = new StatusWorkflow();
1679
+ await workflow.run();
1680
+ expect(workflow.status).toBe('completed');
1681
+ });
1682
+ it('should support failed status transition', async () => {
1683
+ class FailingWorkflow extends Workflow {
1684
+ async run() {
1685
+ this.setStatus('running');
1686
+ this.setStatus('failed');
1687
+ throw new Error('Intentional failure');
1688
+ }
1689
+ }
1690
+ const workflow = new FailingWorkflow();
1691
+ try {
1692
+ await workflow.run();
1693
+ }
1694
+ catch {
1695
+ // Expected
1696
+ }
1697
+ expect(workflow.status).toBe('failed');
1698
+ });
1699
+ });
1700
+ describe('Workflow ID generation', () => {
1701
+ it('should generate unique IDs for each workflow instance', () => {
1702
+ class TestWorkflow extends Workflow {
1703
+ }
1704
+ const wf1 = new TestWorkflow();
1705
+ const wf2 = new TestWorkflow();
1706
+ const wf3 = new TestWorkflow();
1707
+ expect(wf1.id).not.toBe(wf2.id);
1708
+ expect(wf2.id).not.toBe(wf3.id);
1709
+ expect(wf1.id).not.toBe(wf3.id);
1710
+ });
1711
+ });
1712
+ describe('Workflow name defaults', () => {
1713
+ it('should use class name as default when no name provided', () => {
1714
+ class MyCustomWorkflow extends Workflow {
1715
+ }
1716
+ const wf = new MyCustomWorkflow();
1717
+ expect(wf.getNode().name).toBe('MyCustomWorkflow');
1718
+ });
1719
+ });
1720
+ describe('Logger child with both APIs', () => {
1721
+ it('should support mixing old and new logger.child() APIs', async () => {
1722
+ class TestWorkflow extends Workflow {
1723
+ async run() {
1724
+ // Old API
1725
+ const child1 = this.logger.child('log-1');
1726
+ child1.info('Message 1');
1727
+ // New API
1728
+ const child2 = this.logger.child({ parentLogId: 'log-2' });
1729
+ child2.info('Message 2');
1730
+ // Old API again
1731
+ const child3 = this.logger.child('log-3');
1732
+ child3.info('Message 3');
1733
+ }
1734
+ }
1735
+ const workflow = new TestWorkflow();
1736
+ await workflow.run();
1737
+ expect(workflow.getNode().logs[0].parentLogId).toBe('log-1');
1738
+ expect(workflow.getNode().logs[1].parentLogId).toBe('log-2');
1739
+ expect(workflow.getNode().logs[2].parentLogId).toBe('log-3');
1740
+ });
1741
+ });
1742
+ describe('WorkflowTreeDebugger compatibility', () => {
1743
+ it('should work with WorkflowTreeDebugger', async () => {
1744
+ let TestWorkflow = (() => {
1745
+ let _classSuper = Workflow;
1746
+ let _instanceExtraInitializers = [];
1747
+ let _value_decorators;
1748
+ let _value_initializers = [];
1749
+ let _value_extraInitializers = [];
1750
+ let _testStep_decorators;
1751
+ return class TestWorkflow extends _classSuper {
1752
+ static {
1753
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1754
+ _value_decorators = [ObservedState()];
1755
+ _testStep_decorators = [Step()];
1756
+ __esDecorate(this, null, _testStep_decorators, { kind: "method", name: "testStep", static: false, private: false, access: { has: obj => "testStep" in obj, get: obj => obj.testStep }, metadata: _metadata }, null, _instanceExtraInitializers);
1757
+ __esDecorate(null, null, _value_decorators, { kind: "field", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
1758
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1759
+ }
1760
+ value = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _value_initializers, 42));
1761
+ async testStep() {
1762
+ this.logger.info('Test log');
1763
+ }
1764
+ async run() {
1765
+ this.setStatus('running');
1766
+ await this.testStep();
1767
+ this.setStatus('completed');
1768
+ }
1769
+ constructor() {
1770
+ super(...arguments);
1771
+ __runInitializers(this, _value_extraInitializers);
1772
+ }
1773
+ };
1774
+ })();
1775
+ const workflow = new TestWorkflow();
1776
+ const debugger_ = new WorkflowTreeDebugger(workflow);
1777
+ await workflow.run();
1778
+ // All debugger methods should work
1779
+ const tree = debugger_.toTreeString();
1780
+ const logs = debugger_.toLogString();
1781
+ const stats = debugger_.getStats();
1782
+ expect(tree).toContain('TestWorkflow');
1783
+ expect(typeof logs).toBe('string');
1784
+ expect(stats.totalNodes).toBeGreaterThanOrEqual(1);
1785
+ });
1786
+ });
1787
+ describe('Observer pattern compatibility', () => {
1788
+ it('should support WorkflowObserver with all callbacks', async () => {
1789
+ const logs = [];
1790
+ const events = [];
1791
+ const stateUpdates = [];
1792
+ const treeUpdates = [];
1793
+ let TestWorkflow = (() => {
1794
+ let _classSuper = Workflow;
1795
+ let _instanceExtraInitializers = [];
1796
+ let _counter_decorators;
1797
+ let _counter_initializers = [];
1798
+ let _counter_extraInitializers = [];
1799
+ let _testStep_decorators;
1800
+ return class TestWorkflow extends _classSuper {
1801
+ static {
1802
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1803
+ _counter_decorators = [ObservedState()];
1804
+ _testStep_decorators = [Step({ snapshotState: true })];
1805
+ __esDecorate(this, null, _testStep_decorators, { kind: "method", name: "testStep", static: false, private: false, access: { has: obj => "testStep" in obj, get: obj => obj.testStep }, metadata: _metadata }, null, _instanceExtraInitializers);
1806
+ __esDecorate(null, null, _counter_decorators, { kind: "field", name: "counter", static: false, private: false, access: { has: obj => "counter" in obj, get: obj => obj.counter, set: (obj, value) => { obj.counter = value; } }, metadata: _metadata }, _counter_initializers, _counter_extraInitializers);
1807
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1808
+ }
1809
+ counter = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _counter_initializers, 0));
1810
+ async testStep() {
1811
+ this.counter = 1;
1812
+ this.logger.info('Test message');
1813
+ }
1814
+ async run() {
1815
+ this.setStatus('running');
1816
+ await this.testStep();
1817
+ this.setStatus('completed');
1818
+ }
1819
+ constructor() {
1820
+ super(...arguments);
1821
+ __runInitializers(this, _counter_extraInitializers);
1822
+ }
1823
+ };
1824
+ })();
1825
+ const workflow = new TestWorkflow();
1826
+ const observer = {
1827
+ onLog: (entry) => logs.push(entry.message),
1828
+ onEvent: (event) => events.push(event),
1829
+ onStateUpdated: () => stateUpdates.push(1),
1830
+ onTreeChanged: () => treeUpdates.push(1),
1831
+ };
1832
+ workflow.addObserver(observer);
1833
+ await workflow.run();
1834
+ expect(logs.length).toBeGreaterThan(0);
1835
+ expect(logs.some(l => l === 'Test message')).toBe(true);
1836
+ expect(events.length).toBeGreaterThan(0);
1837
+ expect(stateUpdates.length).toBeGreaterThan(0);
1838
+ expect(treeUpdates.length).toBeGreaterThan(0);
1839
+ });
1840
+ });
1841
+ });
1842
+ });
1843
+ //# sourceMappingURL=backward-compatibility.test.js.map