yaml-flow 7.1.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/browser/asset-integrity.json +8 -4
  2. package/browser/board-livecards-client.js +1 -1
  3. package/browser/board-livecards-localstorage.js +5 -5
  4. package/browser/live-cards.js +19 -3309
  5. package/cli/board-live-cards-lib-tjYsPt5U.d.ts +321 -0
  6. package/{dist/cli → cli}/browser-api/board-live-cards-browser-adapter.d.ts +3 -5
  7. package/{dist/cli → cli}/browser-api/card-store-browser-api.d.ts +1 -2
  8. package/{dist/cli → cli}/browser-api/card-store-browser-api.js +1 -1
  9. package/cli/execution-interface-C_A6WCiK.d.ts +284 -0
  10. package/{dist/cli → cli}/node/artifacts-store-cli.js +2 -2
  11. package/cli/node/batch-runner-cli.js +3 -0
  12. package/cli/node/board-live-cards-cli.js +15 -0
  13. package/{dist/cli → cli}/node/execution-adapter.d.ts +3 -3
  14. package/cli/node/execution-adapter.js +3 -0
  15. package/{dist/cli → cli}/node/fs-board-adapter.d.ts +24 -11
  16. package/cli/node/fs-board-adapter.js +14 -0
  17. package/cli/node/step-machine-cli.d.ts +7 -0
  18. package/cli/node/step-machine-cli.js +5 -0
  19. package/{dist/board-live-cards-public-5n1-syA3.d.cts → cli/types-CziUxkiv.d.ts} +68 -5
  20. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.config/card-store-ref.json +1 -0
  21. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.config/chat-handler.json +1 -0
  22. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.config/outputs-store-ref.json +1 -0
  23. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.config/task-executor.json +1 -0
  24. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.state-snapshot/board/graph.json +29 -0
  25. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.state-snapshot/board/lastJournalProcessedId.json +1 -0
  26. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime-out/.outputs/status.json +25 -0
  27. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/cards/card-market-prices/computed_values.json +67 -0
  28. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/cards/card-portfolio/computed_values.json +1 -0
  29. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/cards/card-portfolio-value/computed_values.json +52 -0
  30. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/data-objects/holdings.json +22 -0
  31. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/data-objects/positions.json +46 -0
  32. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/data-objects/quotes.json +35 -0
  33. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/status.json +113 -0
  34. package/examples/{example-board → board}/demo-server-config.json +0 -1
  35. package/examples/{example-board → board}/demo-server.js +23 -48
  36. package/examples/{example-board → board}/demo-shell-with-server.html +3 -3
  37. package/examples/{example-board → board}/demo-task-executor.js +71 -24
  38. package/examples/board/gandalf-cards/card-source-kinds.json +36 -0
  39. package/examples/board/gandalf-cards/cards/_index.json +7 -0
  40. package/examples/board/gandalf-cards/cards/card-source-kinds.json +64 -0
  41. package/examples/board/source-def-flows/copilot.flow.json +33 -0
  42. package/examples/board/source-def-flows/mock.flow.json +35 -0
  43. package/examples/board/source-def-flows/url-list.flow.json +33 -0
  44. package/examples/board/source-def-flows/url.flow.json +33 -0
  45. package/examples/board/source-def-flows/workiq.flow.json +34 -0
  46. package/examples/board/source-def-handlers/copilot-source-handler.js +141 -0
  47. package/examples/board/source-def-handlers/http-source-handler.js +145 -0
  48. package/examples/board/source_def_flows.json +249 -0
  49. package/examples/board/test/demo-http-test.js +317 -0
  50. package/examples/{example-board → board-local}/demo-shell-localstorage.html +4 -4
  51. package/examples/{browser/boards/portfolio-tracker → portfolio-tracker/handlers}/portfolio-tracker-fetch-prices.js +1 -1
  52. package/examples/{browser/boards/portfolio-tracker/portfolio-tracker-public.js → portfolio-tracker/portfolio-tracker.js} +11 -14
  53. package/examples/{browser/boards/portfolio-tracker → portfolio-tracker/test}/portfolio-t4.js +32 -50
  54. package/lib/artifacts-store-lib-public-BABrgFkV.d.ts +119 -0
  55. package/lib/artifacts-store-lib-public-DGa8BpJT.d.cts +119 -0
  56. package/lib/artifacts-store-public.cjs +2 -0
  57. package/lib/artifacts-store-public.d.cts +5 -0
  58. package/lib/artifacts-store-public.d.ts +5 -0
  59. package/lib/artifacts-store-public.js +2 -0
  60. package/lib/board-live-cards-node.cjs +14 -0
  61. package/{dist/cli/node/execution-adapter.d.cts → lib/board-live-cards-node.d.cts} +45 -85
  62. package/lib/board-live-cards-node.d.ts +134 -0
  63. package/lib/board-live-cards-node.js +14 -0
  64. package/lib/board-live-cards-public-BnmRAbQV.d.cts +383 -0
  65. package/{dist/board-live-cards-public-CK_J8uv0.d.ts → lib/board-live-cards-public-CsmYrvpd.d.ts} +142 -76
  66. package/lib/board-live-cards-public.cjs +3 -0
  67. package/lib/board-live-cards-public.d.cts +4 -0
  68. package/lib/board-live-cards-public.d.ts +4 -0
  69. package/lib/board-live-cards-public.js +3 -0
  70. package/lib/board-live-cards-server-runtime.cjs +9 -0
  71. package/lib/board-live-cards-server-runtime.d.cts +6 -0
  72. package/lib/board-live-cards-server-runtime.d.ts +6 -0
  73. package/lib/board-live-cards-server-runtime.js +9 -0
  74. package/lib/board-livegraph-runtime/index.cjs +3 -0
  75. package/{dist → lib}/board-livegraph-runtime/index.d.cts +1 -2
  76. package/{dist → lib}/board-livegraph-runtime/index.d.ts +1 -2
  77. package/lib/board-livegraph-runtime/index.js +3 -0
  78. package/{dist/storage-refs.cjs → lib/board-worker-adapter.cjs} +2 -2
  79. package/{dist/storage-refs.d.cts → lib/board-worker-adapter.d.cts} +4 -3
  80. package/{dist/storage-refs.d.ts → lib/board-worker-adapter.d.ts} +4 -3
  81. package/{dist/storage-refs.js → lib/board-worker-adapter.js} +2 -2
  82. package/{dist → lib}/card-compute/index.cjs +1 -1
  83. package/{dist → lib}/card-compute/index.js +1 -1
  84. package/lib/card-store-public.cjs +2 -0
  85. package/lib/card-store-public.d.cts +61 -0
  86. package/lib/card-store-public.d.ts +61 -0
  87. package/lib/card-store-public.js +2 -0
  88. package/lib/card-validation.cjs +10 -0
  89. package/lib/card-validation.d.cts +35 -0
  90. package/lib/card-validation.d.ts +35 -0
  91. package/lib/card-validation.js +10 -0
  92. package/{dist/constants-oCEbNpul.d.ts → lib/constants-BPVLb3Es.d.ts} +1 -1
  93. package/{dist/constants-BzZUyYlp.d.cts → lib/constants-DXxsRN9y.d.cts} +1 -1
  94. package/{dist → lib}/continuous-event-graph/index.cjs +2 -2
  95. package/{dist → lib}/continuous-event-graph/index.d.cts +3 -5
  96. package/{dist → lib}/continuous-event-graph/index.d.ts +3 -5
  97. package/{dist → lib}/continuous-event-graph/index.js +2 -2
  98. package/{dist → lib}/event-graph/index.d.cts +2 -2
  99. package/{dist → lib}/event-graph/index.d.ts +2 -2
  100. package/{dist → lib}/execution-refs.d.cts +29 -10
  101. package/{dist → lib}/execution-refs.d.ts +29 -10
  102. package/lib/index.cjs +25 -0
  103. package/{dist → lib}/index.d.cts +7 -8
  104. package/{dist → lib}/index.d.ts +7 -8
  105. package/lib/index.js +25 -0
  106. package/{dist/live-cards-bridge-BXbVTsna.d.cts → lib/live-cards-bridge-DC_ZU0eS.d.ts} +134 -3
  107. package/{dist/live-cards-bridge-Ds28XR15.d.ts → lib/live-cards-bridge-b25aAVvE.d.cts} +134 -3
  108. package/lib/loader-CuuLjxVA.d.cts +42 -0
  109. package/lib/loader-Zborm2pq.d.ts +42 -0
  110. package/lib/server-runtime/index.cjs +9 -0
  111. package/{dist → lib}/server-runtime/index.d.cts +4 -4
  112. package/{dist → lib}/server-runtime/index.d.ts +4 -4
  113. package/lib/server-runtime/index.js +9 -0
  114. package/lib/step-machine/index.d.cts +64 -0
  115. package/lib/step-machine/index.d.ts +64 -0
  116. package/lib/step-machine-public/index.cjs +5 -0
  117. package/{dist → lib}/step-machine-public/index.d.cts +14 -1
  118. package/{dist → lib}/step-machine-public/index.d.ts +14 -1
  119. package/lib/step-machine-public/index.js +5 -0
  120. package/lib/storage-interface-BhAON-gW.d.cts +84 -0
  121. package/lib/storage-interface-BhAON-gW.d.ts +84 -0
  122. package/lib/stores/index.cjs +3 -0
  123. package/lib/stores/index.d.cts +4 -0
  124. package/lib/stores/index.d.ts +4 -0
  125. package/lib/stores/index.js +3 -0
  126. package/lib/stores/kv.cjs +3 -0
  127. package/lib/stores/kv.d.cts +32 -0
  128. package/lib/stores/kv.d.ts +32 -0
  129. package/lib/stores/kv.js +3 -0
  130. package/{dist → lib}/stores/memory.d.cts +1 -1
  131. package/{dist → lib}/stores/memory.d.ts +1 -1
  132. package/{dist/types-HGDTWIun.d.ts → lib/types-CBxkYuLY.d.ts} +2 -1
  133. package/{dist/types-ycun84cq.d.cts → lib/types-DQ1bKuB1.d.cts} +11 -0
  134. package/{dist/types-ycun84cq.d.ts → lib/types-DQ1bKuB1.d.ts} +11 -0
  135. package/{dist/types-CU3DjTKL.d.cts → lib/types-DkFvgxwq.d.cts} +2 -1
  136. package/package.json +79 -119
  137. package/board-live-cards-cli.js +0 -37
  138. package/browser/board-livecards-client.js.map +0 -1
  139. package/browser/board-livecards-localstorage.js.map +0 -1
  140. package/browser/board-livegraph-engine.js +0 -3
  141. package/browser/board-livegraph-engine.js.map +0 -1
  142. package/browser/card-compute.js +0 -266
  143. package/browser/compute-jsonata.js.map +0 -1
  144. package/card-store.js +0 -37
  145. package/dist/batch/index.cjs.map +0 -1
  146. package/dist/batch/index.js.map +0 -1
  147. package/dist/board-live-cards-lib-Bg6EvCo5.d.cts +0 -136
  148. package/dist/board-live-cards-lib-jM2uYG1v.d.ts +0 -136
  149. package/dist/board-livegraph-runtime/index.cjs +0 -3
  150. package/dist/board-livegraph-runtime/index.cjs.map +0 -1
  151. package/dist/board-livegraph-runtime/index.js +0 -3
  152. package/dist/board-livegraph-runtime/index.js.map +0 -1
  153. package/dist/card-compute/index.cjs.map +0 -1
  154. package/dist/card-compute/index.js.map +0 -1
  155. package/dist/cli/browser-api/board-live-cards-browser-adapter.cjs +0 -3
  156. package/dist/cli/browser-api/board-live-cards-browser-adapter.cjs.map +0 -1
  157. package/dist/cli/browser-api/board-live-cards-browser-adapter.d.cts +0 -37
  158. package/dist/cli/browser-api/board-live-cards-browser-adapter.js.map +0 -1
  159. package/dist/cli/browser-api/card-store-browser-api.cjs +0 -2
  160. package/dist/cli/browser-api/card-store-browser-api.cjs.map +0 -1
  161. package/dist/cli/browser-api/card-store-browser-api.d.cts +0 -26
  162. package/dist/cli/browser-api/card-store-browser-api.js.map +0 -1
  163. package/dist/cli/node/artifacts-store-cli.cjs +0 -11
  164. package/dist/cli/node/artifacts-store-cli.cjs.map +0 -1
  165. package/dist/cli/node/artifacts-store-cli.d.cts +0 -8
  166. package/dist/cli/node/artifacts-store-cli.js.map +0 -1
  167. package/dist/cli/node/board-live-cards-cli.cjs +0 -15
  168. package/dist/cli/node/board-live-cards-cli.cjs.map +0 -1
  169. package/dist/cli/node/board-live-cards-cli.d.cts +0 -20
  170. package/dist/cli/node/board-live-cards-cli.js +0 -15
  171. package/dist/cli/node/board-live-cards-cli.js.map +0 -1
  172. package/dist/cli/node/card-store-cli.cjs +0 -8
  173. package/dist/cli/node/card-store-cli.cjs.map +0 -1
  174. package/dist/cli/node/card-store-cli.d.cts +0 -15
  175. package/dist/cli/node/card-store-cli.js.map +0 -1
  176. package/dist/cli/node/execution-adapter.cjs +0 -3
  177. package/dist/cli/node/execution-adapter.cjs.map +0 -1
  178. package/dist/cli/node/execution-adapter.js +0 -3
  179. package/dist/cli/node/execution-adapter.js.map +0 -1
  180. package/dist/cli/node/fs-board-adapter.cjs +0 -14
  181. package/dist/cli/node/fs-board-adapter.cjs.map +0 -1
  182. package/dist/cli/node/fs-board-adapter.d.cts +0 -204
  183. package/dist/cli/node/fs-board-adapter.js +0 -14
  184. package/dist/cli/node/fs-board-adapter.js.map +0 -1
  185. package/dist/cli/node/source-cli-task-executor.cjs +0 -11
  186. package/dist/cli/node/source-cli-task-executor.cjs.map +0 -1
  187. package/dist/cli/node/source-cli-task-executor.js.map +0 -1
  188. package/dist/config/index.cjs.map +0 -1
  189. package/dist/config/index.js.map +0 -1
  190. package/dist/continuous-event-graph/index.cjs.map +0 -1
  191. package/dist/continuous-event-graph/index.js.map +0 -1
  192. package/dist/event-graph/index.cjs.map +0 -1
  193. package/dist/event-graph/index.js.map +0 -1
  194. package/dist/execution-refs.cjs.map +0 -1
  195. package/dist/execution-refs.js.map +0 -1
  196. package/dist/index.cjs +0 -30
  197. package/dist/index.cjs.map +0 -1
  198. package/dist/index.js +0 -30
  199. package/dist/index.js.map +0 -1
  200. package/dist/inference/index.cjs +0 -7
  201. package/dist/inference/index.cjs.map +0 -1
  202. package/dist/inference/index.d.cts +0 -229
  203. package/dist/inference/index.d.ts +0 -229
  204. package/dist/inference/index.js +0 -7
  205. package/dist/inference/index.js.map +0 -1
  206. package/dist/server-runtime/index.cjs +0 -9
  207. package/dist/server-runtime/index.cjs.map +0 -1
  208. package/dist/server-runtime/index.js +0 -9
  209. package/dist/server-runtime/index.js.map +0 -1
  210. package/dist/step-machine/index.cjs.map +0 -1
  211. package/dist/step-machine/index.d.cts +0 -102
  212. package/dist/step-machine/index.d.ts +0 -102
  213. package/dist/step-machine/index.js.map +0 -1
  214. package/dist/step-machine-public/index.cjs +0 -3
  215. package/dist/step-machine-public/index.cjs.map +0 -1
  216. package/dist/step-machine-public/index.js +0 -3
  217. package/dist/step-machine-public/index.js.map +0 -1
  218. package/dist/storage-refs.cjs.map +0 -1
  219. package/dist/storage-refs.js.map +0 -1
  220. package/dist/stores/file.cjs +0 -2
  221. package/dist/stores/file.cjs.map +0 -1
  222. package/dist/stores/file.d.cts +0 -36
  223. package/dist/stores/file.d.ts +0 -36
  224. package/dist/stores/file.js +0 -2
  225. package/dist/stores/file.js.map +0 -1
  226. package/dist/stores/index.cjs +0 -2
  227. package/dist/stores/index.cjs.map +0 -1
  228. package/dist/stores/index.d.cts +0 -4
  229. package/dist/stores/index.d.ts +0 -4
  230. package/dist/stores/index.js +0 -2
  231. package/dist/stores/index.js.map +0 -1
  232. package/dist/stores/localStorage.cjs +0 -2
  233. package/dist/stores/localStorage.cjs.map +0 -1
  234. package/dist/stores/localStorage.d.cts +0 -34
  235. package/dist/stores/localStorage.d.ts +0 -34
  236. package/dist/stores/localStorage.js +0 -2
  237. package/dist/stores/localStorage.js.map +0 -1
  238. package/dist/stores/memory.cjs.map +0 -1
  239. package/dist/stores/memory.js.map +0 -1
  240. package/dist/types-CHSdoAAA.d.cts +0 -135
  241. package/dist/types-CoW0gQl3.d.ts +0 -135
  242. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-fetch-prices.py +0 -201
  243. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-http-test.js +0 -370
  244. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-http-test.py +0 -398
  245. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-inference-adapter.js +0 -196
  246. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-server.js +0 -300
  247. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-server.py +0 -617
  248. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.py +0 -366
  249. package/examples/browser/livecards-browser/index.html +0 -41
  250. package/examples/browser/step-machine-browser/index.html +0 -367
  251. package/examples/cli/step-machine-cli/portfolio-tracker/--base-ref/.runtime-out +0 -1
  252. package/examples/cli/step-machine-cli/portfolio-tracker/--base-ref/board-graph.json +0 -32
  253. package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +0 -22
  254. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +0 -43
  255. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +0 -15
  256. package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +0 -15
  257. package/examples/cli/step-machine-cli/portfolio-tracker/fetch-prices.js +0 -48
  258. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +0 -125
  259. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +0 -32
  260. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +0 -26
  261. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/poll-status-cli.js +0 -49
  262. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +0 -25
  263. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +0 -23
  264. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/status-cli.js +0 -21
  265. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +0 -38
  266. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +0 -48
  267. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +0 -31
  268. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/_board_pycli.py +0 -107
  269. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/add-cards.py +0 -51
  270. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/init-board.py +0 -45
  271. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/poll-status.py +0 -71
  272. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/reset-board-dir.py +0 -36
  273. package/examples/cli/step-machine-cli/portfolio-tracker/inline-python-demo.flow.yaml +0 -26
  274. package/examples/cli/step-machine-cli/portfolio-tracker/inline-python-handlers.py +0 -39
  275. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker-pycli.flow.yaml +0 -80
  276. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +0 -76
  277. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +0 -44
  278. package/examples/cli/step-machine-cli/portfolio-tracker/run-inline-python-demo-pycli.py +0 -43
  279. package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker-pycli.py +0 -77
  280. package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +0 -28
  281. package/examples/cli/step-machine-demo/jsonata-init-board-cli.js +0 -31
  282. package/examples/cli/step-machine-demo/jsonata-init-board.flow.yaml +0 -54
  283. package/examples/cli/step-machine-demo/one-step-cli-only.flow.yaml +0 -21
  284. package/examples/cli/step-machine-demo/step-cli-echo-y.js +0 -15
  285. package/examples/cli/step-machine-demo/step2-double-cli.js +0 -33
  286. package/examples/cli/step-machine-demo/two-step-math.flow.yaml +0 -93
  287. package/examples/cli/step-machine-demo/two-step-mixed.flow.yaml +0 -43
  288. package/examples/example-board/agent-instructions-cardlayout.md +0 -56
  289. package/examples/example-board/agent-instructions.md +0 -834
  290. package/examples/example-board/demo-shell.html +0 -63
  291. package/examples/index.html +0 -785
  292. package/examples/npm-libs/batch/batch-step-machine.ts +0 -121
  293. package/examples/npm-libs/continuous-event-graph/live-cards-board.ts +0 -215
  294. package/examples/npm-libs/continuous-event-graph/live-portfolio-dashboard.ts +0 -555
  295. package/examples/npm-libs/continuous-event-graph/portfolio-tracker.ts +0 -287
  296. package/examples/npm-libs/continuous-event-graph/reactive-monitoring.ts +0 -265
  297. package/examples/npm-libs/continuous-event-graph/reactive-pipeline.ts +0 -168
  298. package/examples/npm-libs/continuous-event-graph/soc-incident-board.ts +0 -287
  299. package/examples/npm-libs/continuous-event-graph/stock-dashboard.ts +0 -229
  300. package/examples/npm-libs/event-graph/ci-cd-pipeline.ts +0 -243
  301. package/examples/npm-libs/event-graph/executor-diamond.ts +0 -165
  302. package/examples/npm-libs/event-graph/executor-pipeline.ts +0 -161
  303. package/examples/npm-libs/event-graph/research-pipeline.ts +0 -137
  304. package/examples/npm-libs/flows/ai-conversation.yaml +0 -116
  305. package/examples/npm-libs/flows/order-processing.yaml +0 -143
  306. package/examples/npm-libs/flows/simple-greeting.yaml +0 -54
  307. package/examples/npm-libs/graph-of-graphs/multi-stage-etl.ts +0 -307
  308. package/examples/npm-libs/graph-of-graphs/url-processing-pipeline.ts +0 -254
  309. package/examples/npm-libs/inference/azure-deployment.ts +0 -149
  310. package/examples/npm-libs/inference/copilot-cli.ts +0 -138
  311. package/examples/npm-libs/inference/data-pipeline.ts +0 -145
  312. package/examples/npm-libs/inference/pluggable-adapters.ts +0 -254
  313. package/examples/npm-libs/node/ai-conversation.ts +0 -195
  314. package/examples/npm-libs/node/simple-greeting.ts +0 -101
  315. package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +0 -22
  316. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +0 -43
  317. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +0 -15
  318. package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +0 -15
  319. package/examples/step-machine-cli/portfolio-tracker/fetch-prices.js +0 -48
  320. package/examples/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +0 -57
  321. package/examples/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +0 -27
  322. package/examples/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +0 -25
  323. package/examples/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +0 -29
  324. package/examples/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +0 -27
  325. package/examples/step-machine-cli/portfolio-tracker/handlers/status-cli.js +0 -25
  326. package/examples/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +0 -37
  327. package/examples/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +0 -53
  328. package/examples/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +0 -35
  329. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker-task-executor.cjs +0 -96
  330. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +0 -227
  331. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +0 -38
  332. package/examples/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +0 -28
  333. package/step-machine-cli.js +0 -407
  334. /package/{dist/cli → cli}/browser-api/board-live-cards-browser-adapter.js +0 -0
  335. /package/{dist/board-livegraph-runtime → cli/browser-api}/jsonata-sync.cjs +0 -0
  336. /package/{dist/cli → cli}/node/artifacts-store-cli.d.ts +0 -0
  337. /package/{dist/cli/node/source-cli-task-executor.d.cts → cli/node/batch-runner-cli.d.ts} +0 -0
  338. /package/{dist/cli → cli}/node/board-live-cards-cli.d.ts +0 -0
  339. /package/{dist/cli → cli}/node/card-store-cli.d.ts +0 -0
  340. /package/{dist/cli → cli}/node/card-store-cli.js +0 -0
  341. /package/{dist/card-compute → cli/node}/jsonata-sync.cjs +0 -0
  342. /package/{dist/cli → cli}/node/source-cli-task-executor.d.ts +0 -0
  343. /package/{dist/cli → cli}/node/source-cli-task-executor.js +0 -0
  344. /package/examples/{example-board → board}/cards/card-concentration.json +0 -0
  345. /package/examples/{example-board → board}/cards/card-my-identity.json +0 -0
  346. /package/examples/{example-board → board}/cards/card-portfolio-action.json +0 -0
  347. /package/examples/{example-board → board}/cards/card-portfolio-intelligence.json +0 -0
  348. /package/examples/{example-board → board}/cards/card-portfolio-risks.json +0 -0
  349. /package/examples/{example-board → board}/cards/card-rebalance-impact.json +0 -0
  350. /package/examples/{example-board → board}/cards/card-rebalance-sim.json +0 -0
  351. /package/examples/{example-board → board}/cards/cardT-market-prices.json +0 -0
  352. /package/examples/{example-board → board}/cards/cardT-portfolio-value.json +0 -0
  353. /package/examples/{example-board → board}/cards/cardT-portfolio.json +0 -0
  354. /package/examples/{example-board → board}/demo-chat-handler.js +0 -0
  355. /package/examples/{example-board → board}/scripts/copilot_wrapper.bat +0 -0
  356. /package/examples/{example-board → board}/scripts/copilot_wrapper_helper.ps1 +0 -0
  357. /package/examples/{example-board → board}/scripts/workiq_wrapper.mjs +0 -0
  358. /package/examples/{browser/boards/portfolio-tracker → board/test}/portfolio-tracker-sse-worker.js +0 -0
  359. /package/{dist → lib}/batch/index.cjs +0 -0
  360. /package/{dist → lib}/batch/index.d.cts +0 -0
  361. /package/{dist → lib}/batch/index.d.ts +0 -0
  362. /package/{dist → lib}/batch/index.js +0 -0
  363. /package/{dist/cli/browser-api → lib/board-livegraph-runtime}/jsonata-sync.cjs +0 -0
  364. /package/{dist → lib}/card-compute/index.d.cts +0 -0
  365. /package/{dist → lib}/card-compute/index.d.ts +0 -0
  366. /package/{dist/cli/node → lib/card-compute}/jsonata-sync.cjs +0 -0
  367. /package/{dist → lib}/config/index.cjs +0 -0
  368. /package/{dist → lib}/config/index.d.cts +0 -0
  369. /package/{dist → lib}/config/index.d.ts +0 -0
  370. /package/{dist → lib}/config/index.js +0 -0
  371. /package/{dist → lib}/continuous-event-graph/jsonata-sync.cjs +0 -0
  372. /package/{dist → lib}/event-graph/index.cjs +0 -0
  373. /package/{dist → lib}/event-graph/index.js +0 -0
  374. /package/{dist → lib}/execution-refs.cjs +0 -0
  375. /package/{dist → lib}/execution-refs.js +0 -0
  376. /package/{dist → lib}/jsonata-sync.cjs +0 -0
  377. /package/{dist → lib}/server-runtime/jsonata-sync.cjs +0 -0
  378. /package/{dist → lib}/step-machine/index.cjs +0 -0
  379. /package/{dist → lib}/step-machine/index.js +0 -0
  380. /package/{dist → lib}/step-machine-public/jsonata-sync.cjs +0 -0
  381. /package/{dist → lib}/stores/memory.cjs +0 -0
  382. /package/{dist → lib}/stores/memory.js +0 -0
  383. /package/{dist → lib}/types-BBhqYGhE.d.cts +0 -0
  384. /package/{dist → lib}/types-BBhqYGhE.d.ts +0 -0
  385. /package/{dist → lib}/validate-BAVzUJWa.d.ts +0 -0
  386. /package/{dist → lib}/validate-Dbu7ygys.d.cts +0 -0
@@ -1,243 +0,0 @@
1
- /**
2
- * Event Graph Example: CI/CD Pipeline
3
- *
4
- * Demonstrates:
5
- * - External event injection (human approval gate)
6
- * - Conditional routing via `on`
7
- * - Failure tokens via `on_failure`
8
- * - Retry configuration
9
- * - Stuck detection
10
- *
11
- * Run with: npx tsx examples/npm-libs/event-graph/ci-cd-pipeline.ts
12
- */
13
-
14
- import {
15
- next,
16
- apply,
17
- createInitialExecutionState,
18
- } from '../../src/event-graph/index.js';
19
- import type { GraphConfig } from '../../src/event-graph/index.js';
20
-
21
- // ============================================================================
22
- // 1. Define the graph
23
- // ============================================================================
24
-
25
- const graph: GraphConfig = {
26
- id: 'ci-cd-pipeline',
27
- settings: {
28
- completion: 'goal-reached',
29
- goal: ['deployed'],
30
- conflict_strategy: 'alphabetical',
31
- },
32
- tasks: {
33
- build: {
34
- provides: ['build-artifact'],
35
- description: 'Compile the project',
36
- },
37
- unit_tests: {
38
- requires: ['build-artifact'],
39
- provides: ['tests-passed'],
40
- retry: { max_attempts: 2 },
41
- on_failure: ['tests-failed'],
42
- description: 'Run unit tests',
43
- },
44
- lint: {
45
- requires: ['build-artifact'],
46
- provides: ['lint-passed'],
47
- description: 'Run linter',
48
- },
49
- security_scan: {
50
- requires: ['build-artifact'],
51
- provides: ['scan-passed'],
52
- on: {
53
- clean: ['scan-passed'],
54
- vulnerable: ['scan-blocked'],
55
- },
56
- description: 'Run security scan',
57
- },
58
- approve: {
59
- // Needs all checks AND a human approval token
60
- requires: ['tests-passed', 'lint-passed', 'scan-passed', 'human-approval'],
61
- provides: ['approved'],
62
- description: 'Human approval gate',
63
- },
64
- deploy: {
65
- requires: ['approved'],
66
- provides: ['deployed'],
67
- retry: { max_attempts: 3 },
68
- on_failure: ['deploy-failed'],
69
- description: 'Deploy to production',
70
- },
71
- notify_failure: {
72
- // Activates if tests fail, scan is blocked, or deploy fails
73
- requires: ['tests-failed'],
74
- provides: ['failure-notified'],
75
- description: 'Notify team of failure',
76
- },
77
- notify_blocked: {
78
- requires: ['scan-blocked'],
79
- provides: ['block-notified'],
80
- description: 'Notify team of security block',
81
- },
82
- },
83
- };
84
-
85
- // ============================================================================
86
- // 2. Simulated task executor
87
- // ============================================================================
88
-
89
- // Simulate tasks with controlled outcomes
90
- const taskOutcomes: Record<string, { success: boolean; result?: string }> = {
91
- build: { success: true },
92
- unit_tests: { success: true },
93
- lint: { success: true },
94
- security_scan: { success: true, result: 'clean' },
95
- approve: { success: true },
96
- deploy: { success: true },
97
- notify_failure: { success: true },
98
- notify_blocked: { success: true },
99
- };
100
-
101
- async function executeTask(taskName: string): Promise<{ success: boolean; result?: string; error?: string }> {
102
- await new Promise((r) => setTimeout(r, Math.random() * 100 + 20));
103
- const outcome = taskOutcomes[taskName] ?? { success: true };
104
-
105
- if (!outcome.success) {
106
- console.log(` ✗ ${taskName} FAILED`);
107
- return { success: false, error: `${taskName} execution error` };
108
- }
109
-
110
- console.log(` ✓ ${taskName} completed${outcome.result ? ` (result: ${outcome.result})` : ''}`);
111
- return { success: true, result: outcome.result };
112
- }
113
-
114
- // ============================================================================
115
- // 3. Driver loop with external event injection
116
- // ============================================================================
117
-
118
- async function main() {
119
- let state = createInitialExecutionState(graph, 'pipeline-42');
120
- let iteration = 0;
121
- let approvalInjected = false;
122
-
123
- console.log('CI/CD Pipeline — Event Graph Demo');
124
- console.log('==================================\n');
125
-
126
- while (iteration < 20) {
127
- iteration++;
128
-
129
- // Simulate human approval after all automated checks pass
130
- if (
131
- !approvalInjected &&
132
- state.availableOutputs.includes('tests-passed') &&
133
- state.availableOutputs.includes('lint-passed') &&
134
- state.availableOutputs.includes('scan-passed')
135
- ) {
136
- console.log('\n 🔔 All checks passed — simulating human approval...');
137
- state = apply(
138
- state,
139
- { type: 'inject-tokens', tokens: ['human-approval'], timestamp: new Date().toISOString() },
140
- graph
141
- );
142
- approvalInjected = true;
143
- }
144
-
145
- const schedule = next(graph, state);
146
-
147
- console.log(`\n[iteration ${iteration}] eligible: [${schedule.eligibleTasks.join(', ')}]`);
148
-
149
- if (schedule.isComplete) {
150
- console.log('\n✅ Pipeline complete! Deployment successful.');
151
- console.log('Final outputs:', state.availableOutputs);
152
- break;
153
- }
154
-
155
- if (schedule.stuckDetection.is_stuck) {
156
- console.error('\n❌ Pipeline stuck:', schedule.stuckDetection.stuck_description);
157
- console.log('Blocked tasks:', schedule.stuckDetection.tasks_blocked);
158
- break;
159
- }
160
-
161
- if (schedule.eligibleTasks.length === 0) {
162
- console.log(' (no eligible tasks — waiting for events)');
163
- break;
164
- }
165
-
166
- // Start + execute eligible tasks
167
- const ts = new Date().toISOString();
168
- for (const taskName of schedule.eligibleTasks) {
169
- state = apply(state, { type: 'task-started', taskName, timestamp: ts }, graph);
170
- }
171
-
172
- const results = await Promise.all(schedule.eligibleTasks.map(executeTask));
173
-
174
- for (let i = 0; i < results.length; i++) {
175
- const taskName = schedule.eligibleTasks[i];
176
- const r = results[i];
177
- const ts2 = new Date().toISOString();
178
-
179
- if (r.success) {
180
- state = apply(state, { type: 'task-completed', taskName, result: r.result, timestamp: ts2 }, graph);
181
- } else {
182
- state = apply(state, { type: 'task-failed', taskName, error: r.error!, timestamp: ts2 }, graph);
183
- }
184
- }
185
-
186
- console.log(` outputs: [${state.availableOutputs.join(', ')}]`);
187
- }
188
-
189
- // ------------------------------------------------------------------
190
- // Now demonstrate a failure scenario
191
- // ------------------------------------------------------------------
192
- console.log('\n\n========== Failure Scenario ==========\n');
193
-
194
- // Override: make security scan find vulnerabilities
195
- taskOutcomes.security_scan = { success: true, result: 'vulnerable' };
196
-
197
- state = createInitialExecutionState(graph, 'pipeline-43');
198
- iteration = 0;
199
- approvalInjected = false;
200
-
201
- while (iteration < 20) {
202
- iteration++;
203
- const schedule = next(graph, state);
204
-
205
- console.log(`\n[iteration ${iteration}] eligible: [${schedule.eligibleTasks.join(', ')}]`);
206
-
207
- if (schedule.isComplete) {
208
- console.log('\n✅ Complete.');
209
- break;
210
- }
211
-
212
- if (schedule.stuckDetection.is_stuck) {
213
- console.log('\n⚠️ Pipeline blocked (as expected with vulnerability).');
214
- console.log('Reason:', schedule.stuckDetection.stuck_description);
215
- break;
216
- }
217
-
218
- if (schedule.eligibleTasks.length === 0) break;
219
-
220
- const ts = new Date().toISOString();
221
- for (const taskName of schedule.eligibleTasks) {
222
- state = apply(state, { type: 'task-started', taskName, timestamp: ts }, graph);
223
- }
224
-
225
- const results = await Promise.all(schedule.eligibleTasks.map(executeTask));
226
-
227
- for (let i = 0; i < results.length; i++) {
228
- const taskName = schedule.eligibleTasks[i];
229
- const r = results[i];
230
- const ts2 = new Date().toISOString();
231
-
232
- if (r.success) {
233
- state = apply(state, { type: 'task-completed', taskName, result: r.result, timestamp: ts2 }, graph);
234
- } else {
235
- state = apply(state, { type: 'task-failed', taskName, error: r.error!, timestamp: ts2 }, graph);
236
- }
237
- }
238
-
239
- console.log(` outputs: [${state.availableOutputs.join(', ')}]`);
240
- }
241
- }
242
-
243
- main().catch(console.error);
@@ -1,165 +0,0 @@
1
- /**
2
- * Event Graph Example: Executor-driven Diamond DAG (Library Mode)
3
- *
4
- * A diamond-shaped graph with parallel fan-out and fan-in.
5
- * Tasks simulate real-world async work with random delays.
6
- *
7
- * fetch
8
- * / \
9
- * parse validate
10
- * \ /
11
- * combine
12
- * |
13
- * report
14
- *
15
- * Run with: npx tsx examples/npm-libs/event-graph/executor-diamond.ts
16
- */
17
-
18
- import {
19
- next, apply, createInitialExecutionState,
20
- } from '../../src/event-graph/index.js';
21
- import type { GraphConfig, ExecutionState } from '../../src/event-graph/types.js';
22
-
23
- // ============================================================================
24
- // 1. Define the diamond graph
25
- // ============================================================================
26
-
27
- const graph: GraphConfig = {
28
- id: 'diamond-dag',
29
- settings: {
30
- completion: 'all-tasks-done',
31
- execution_mode: 'eligibility-mode',
32
- conflict_strategy: 'parallel-all',
33
- },
34
- tasks: {
35
- fetch: {
36
- provides: ['raw-payload'],
37
- },
38
- parse: {
39
- requires: ['raw-payload'],
40
- provides: ['parsed-records'],
41
- },
42
- validate: {
43
- requires: ['raw-payload'],
44
- provides: ['validation-report'],
45
- },
46
- combine: {
47
- requires: ['parsed-records', 'validation-report'],
48
- provides: ['final-dataset'],
49
- },
50
- report: {
51
- requires: ['final-dataset'],
52
- provides: ['report-sent'],
53
- },
54
- },
55
- };
56
-
57
- // ============================================================================
58
- // 2. Simulate async executors with random delays
59
- // ============================================================================
60
-
61
- const taskSimulations: Record<string, () => Promise<{ ok: boolean; detail: string }>> = {
62
- fetch: async () => {
63
- await sleep(randomMs(100, 300));
64
- return { ok: true, detail: 'fetched 5MB payload' };
65
- },
66
- parse: async () => {
67
- await sleep(randomMs(150, 400));
68
- return { ok: true, detail: 'parsed 12,000 records' };
69
- },
70
- validate: async () => {
71
- await sleep(randomMs(200, 500));
72
- const passRate = 95 + Math.floor(Math.random() * 5);
73
- return { ok: true, detail: `${passRate}% pass rate` };
74
- },
75
- combine: async () => {
76
- await sleep(randomMs(100, 250));
77
- return { ok: true, detail: 'merged parsed + validated' };
78
- },
79
- report: async () => {
80
- await sleep(randomMs(50, 150));
81
- return { ok: true, detail: 'emailed to stakeholders' };
82
- },
83
- };
84
-
85
- // ============================================================================
86
- // 3. Execution loop — you drive, engine decides
87
- // ============================================================================
88
-
89
- async function run() {
90
- console.log('=== Executor-driven Diamond DAG ===\n');
91
- console.log(' Graph shape: fetch → [parse, validate] → combine → report\n');
92
-
93
- let state: ExecutionState = createInitialExecutionState(graph, 'diamond-1');
94
- let iteration = 0;
95
- const startTime = Date.now();
96
-
97
- while (iteration < 20) {
98
- iteration++;
99
- const result = next(graph, state);
100
-
101
- if (result.isComplete) {
102
- const elapsed = Date.now() - startTime;
103
- console.log(`\n✅ All tasks complete in ${elapsed}ms (${iteration} iterations)\n`);
104
- break;
105
- }
106
-
107
- if (result.eligibleTasks.length === 0) {
108
- if (result.stuckDetection.is_stuck) {
109
- console.log(`⚠️ Stuck: ${result.stuckDetection.stuck_description}`);
110
- break;
111
- }
112
- continue;
113
- }
114
-
115
- console.log(`[iteration ${iteration}] dispatching: [${result.eligibleTasks.join(', ')}]`);
116
-
117
- // Start all eligible
118
- const ts = new Date().toISOString();
119
- for (const taskName of result.eligibleTasks) {
120
- state = apply(state, { type: 'task-started', taskName, timestamp: ts }, graph);
121
- }
122
-
123
- // Execute in parallel — this is where your real handlers would go
124
- const execResults = await Promise.all(
125
- result.eligibleTasks.map(async (taskName) => {
126
- const sim = taskSimulations[taskName];
127
- const r = await sim();
128
- console.log(` [${taskName}] ${r.ok ? '✓' : '✗'} ${r.detail}`);
129
- return { taskName, ...r };
130
- }),
131
- );
132
-
133
- // Feed results back
134
- for (const r of execResults) {
135
- const ts2 = new Date().toISOString();
136
- if (r.ok) {
137
- state = apply(state, { type: 'task-completed', taskName: r.taskName, timestamp: ts2 }, graph);
138
- } else {
139
- state = apply(state, { type: 'task-failed', taskName: r.taskName, error: 'failed', timestamp: ts2 }, graph);
140
- }
141
- }
142
-
143
- console.log(` → outputs: [${state.availableOutputs.join(', ')}]`);
144
- }
145
-
146
- // Summary
147
- console.log('=== Execution Summary ===');
148
- for (const [name, task] of Object.entries(state.tasks)) {
149
- console.log(` ${name}: ${task.status}`);
150
- }
151
- }
152
-
153
- run();
154
-
155
- // ============================================================================
156
- // Util
157
- // ============================================================================
158
-
159
- function sleep(ms: number): Promise<void> {
160
- return new Promise(resolve => setTimeout(resolve, ms));
161
- }
162
-
163
- function randomMs(min: number, max: number): number {
164
- return min + Math.floor(Math.random() * (max - min));
165
- }
@@ -1,161 +0,0 @@
1
- /**
2
- * Event Graph Example: Executor-driven Pipeline (Library Mode)
3
- *
4
- * Same ETL pipeline as reactive-pipeline.ts, but YOU drive the loop.
5
- * Each task simulates async work with random sleep.
6
- *
7
- * Demonstrates:
8
- * - Manual executor loop with next/apply
9
- * - validateGraph for static config validation before running
10
- * - validateLiveGraph for runtime state-consistency after running
11
- *
12
- * Contrast with reactive-pipeline.ts where the graph drives itself.
13
- *
14
- * Run with: npx tsx examples/npm-libs/event-graph/executor-pipeline.ts
15
- */
16
-
17
- import {
18
- next, apply, createInitialExecutionState, validateGraph,
19
- } from '../../src/event-graph/index.js';
20
- import type { GraphConfig, ExecutionState } from '../../src/event-graph/types.js';
21
- import { validateLiveGraph } from '../../src/continuous-event-graph/index.js';
22
-
23
- // ============================================================================
24
- // 1. Define the graph (same as reactive-pipeline)
25
- // ============================================================================
26
-
27
- const graph: GraphConfig = {
28
- id: 'etl-pipeline',
29
- settings: {
30
- completion: 'all-tasks-done',
31
- execution_mode: 'eligibility-mode',
32
- conflict_strategy: 'parallel-all',
33
- },
34
- tasks: {
35
- extract: {
36
- provides: ['raw-data'],
37
- },
38
- validate: {
39
- requires: ['raw-data'],
40
- provides: ['valid-data'],
41
- },
42
- enrich: {
43
- requires: ['valid-data'],
44
- provides: ['enriched-data'],
45
- },
46
- load: {
47
- requires: ['enriched-data'],
48
- provides: ['loaded'],
49
- },
50
- },
51
- };
52
-
53
- // ============================================================================
54
- // 2. Task handlers — simulate async work with random sleep
55
- // ============================================================================
56
-
57
- async function executeTask(taskName: string): Promise<{ ok: boolean; error?: string }> {
58
- const delay = 100 + Math.floor(Math.random() * 400); // 100–500ms
59
- console.log(` [${taskName}] executing... (${delay}ms)`);
60
- await sleep(delay);
61
-
62
- // Simulate occasional failure (10% chance)
63
- if (Math.random() < 0.1) {
64
- console.log(` [${taskName}] FAILED`);
65
- return { ok: false, error: `${taskName} timed out` };
66
- }
67
-
68
- console.log(` [${taskName}] done`);
69
- return { ok: true };
70
- }
71
-
72
- // ============================================================================
73
- // 3. YOU drive the execution loop
74
- // ============================================================================
75
-
76
- async function run() {
77
- console.log('=== Executor-driven ETL Pipeline (Library Mode) ===\n');
78
-
79
- // Pre-flight: validate static config before running
80
- const configValidation = validateGraph(graph);
81
- console.log(`Config validation: ${configValidation.valid ? '✅ valid' : '❌ invalid'} (${configValidation.issues.length} issues)`);
82
- for (const issue of configValidation.issues) {
83
- console.log(` [${issue.severity}] ${issue.code}: ${issue.message}`);
84
- }
85
- if (!configValidation.valid) return;
86
-
87
- let state: ExecutionState = createInitialExecutionState(graph, 'exec-1');
88
- let iteration = 0;
89
-
90
- while (iteration < 20) {
91
- iteration++;
92
- const result = next(graph, state);
93
-
94
- console.log(`\n[iteration ${iteration}] eligible: [${result.eligibleTasks.join(', ')}]`);
95
-
96
- if (result.isComplete) {
97
- console.log('\n✅ Pipeline complete!');
98
- break;
99
- }
100
-
101
- if (result.stuckDetection.is_stuck) {
102
- console.log(`\n⚠️ Pipeline stuck: ${result.stuckDetection.stuck_description}`);
103
- break;
104
- }
105
-
106
- if (result.eligibleTasks.length === 0) {
107
- console.log(' (waiting for running tasks...)');
108
- break;
109
- }
110
-
111
- // Mark all eligible tasks as started
112
- const ts = new Date().toISOString();
113
- for (const taskName of result.eligibleTasks) {
114
- state = apply(state, { type: 'task-started', taskName, timestamp: ts }, graph);
115
- }
116
-
117
- // Execute in parallel — simulate real async work
118
- const results = await Promise.all(
119
- result.eligibleTasks.map(async (taskName) => {
120
- const r = await executeTask(taskName);
121
- return { taskName, ...r };
122
- }),
123
- );
124
-
125
- // Feed results back into the reducer
126
- for (const r of results) {
127
- const ts2 = new Date().toISOString();
128
- if (r.ok) {
129
- state = apply(state, { type: 'task-completed', taskName: r.taskName, timestamp: ts2 }, graph);
130
- } else {
131
- state = apply(state, { type: 'task-failed', taskName: r.taskName, error: r.error!, timestamp: ts2 }, graph);
132
- }
133
- }
134
-
135
- console.log(` outputs: [${state.availableOutputs.join(', ')}]`);
136
- }
137
-
138
- // Final state
139
- console.log('\n=== Final State ===');
140
- for (const [name, task] of Object.entries(state.tasks)) {
141
- console.log(` ${name}: ${task.status} (${task.executionCount}x)`);
142
- }
143
-
144
- // Post-run: validate runtime state consistency
145
- console.log('\n=== Runtime Validation ===');
146
- const runtimeValidation = validateLiveGraph({ config: graph, state });
147
- console.log(` Valid: ${runtimeValidation.valid} (${runtimeValidation.issues.length} issues)`);
148
- for (const issue of runtimeValidation.issues) {
149
- console.log(` [${issue.severity}] ${issue.code}: ${issue.message}`);
150
- }
151
- }
152
-
153
- run();
154
-
155
- // ============================================================================
156
- // Util
157
- // ============================================================================
158
-
159
- function sleep(ms: number): Promise<void> {
160
- return new Promise(resolve => setTimeout(resolve, ms));
161
- }
@@ -1,137 +0,0 @@
1
- /**
2
- * Event Graph Example: Research Pipeline
3
- *
4
- * Demonstrates:
5
- * - Parallel task execution (fan-out / fan-in)
6
- * - Goal-based completion
7
- * - The standard next() / apply() driver loop
8
- *
9
- * Run with: npx tsx examples/npm-libs/event-graph/research-pipeline.ts
10
- */
11
-
12
- import {
13
- next,
14
- apply,
15
- createInitialExecutionState,
16
- } from '../../src/event-graph/index.js';
17
- import type { GraphConfig } from '../../src/event-graph/index.js';
18
-
19
- // ============================================================================
20
- // 1. Define the graph
21
- // ============================================================================
22
-
23
- const graph: GraphConfig = {
24
- id: 'research-pipeline',
25
- settings: {
26
- completion: 'goal-reached',
27
- goal: ['final-report'],
28
- conflict_strategy: 'parallel-all',
29
- },
30
- tasks: {
31
- fetch_sources: {
32
- provides: ['raw-asources'],
33
- description: 'Fetch source documents from the web',
34
- },
35
- analyse_sentiment: {
36
- requires: ['raw-asources'],
37
- provides: ['sentiment-result'],
38
- description: 'Run sentiment analysis on source_defs',
39
- },
40
- analyse_entities: {
41
- requires: ['raw-asources'],
42
- provides: ['entity-result'],
43
- description: 'Extract named entities from source_defs',
44
- },
45
- merge_analysis: {
46
- requires: ['sentiment-result', 'entity-result'],
47
- provides: ['merged-analysis'],
48
- description: 'Merge both analysis results',
49
- },
50
- generate_report: {
51
- requires: ['merged-analysis'],
52
- provides: ['final-report'],
53
- description: 'Generate a final report',
54
- },
55
- },
56
- };
57
-
58
- // ============================================================================
59
- // 2. Simulated task executor
60
- // ============================================================================
61
-
62
- async function executeTask(taskName: string): Promise<string | undefined> {
63
- // Simulate varying work durations
64
- const delay = Math.random() * 200 + 50;
65
- await new Promise((r) => setTimeout(r, delay));
66
-
67
- console.log(` ✓ ${taskName} completed (${delay.toFixed(0)}ms)`);
68
- return undefined; // no special result key → default provides
69
- }
70
-
71
- // ============================================================================
72
- // 3. Driver loop
73
- // ============================================================================
74
-
75
- async function main() {
76
- let state = createInitialExecutionState(graph, 'exec-1');
77
- let iteration = 0;
78
-
79
- console.log('Research Pipeline — Event Graph Demo');
80
- console.log('====================================\n');
81
-
82
- while (true) {
83
- iteration++;
84
- const schedule = next(graph, state);
85
-
86
- console.log(`[iteration ${iteration}] eligible: [${schedule.eligibleTasks.join(', ')}]`);
87
-
88
- if (schedule.isComplete) {
89
- console.log('\n✅ Pipeline complete!');
90
- console.log('Available outputs:', state.availableOutputs);
91
- break;
92
- }
93
-
94
- if (schedule.stuckDetection.is_stuck) {
95
- console.error('\n❌ Pipeline stuck:', schedule.stuckDetection.stuck_description);
96
- break;
97
- }
98
-
99
- if (schedule.eligibleTasks.length === 0) {
100
- console.log(' (waiting for running tasks to complete)');
101
- // In a real system you'd await running task results here.
102
- break;
103
- }
104
-
105
- // Mark all eligible tasks as started
106
- const ts = new Date().toISOString();
107
- for (const taskName of schedule.eligibleTasks) {
108
- state = apply(state, { type: 'task-started', taskName, timestamp: ts }, graph);
109
- }
110
-
111
- // Execute in parallel
112
- const results = await Promise.all(
113
- schedule.eligibleTasks.map(async (taskName) => {
114
- try {
115
- const result = await executeTask(taskName);
116
- return { taskName, ok: true, result };
117
- } catch (err: unknown) {
118
- return { taskName, ok: false, error: (err as Error).message };
119
- }
120
- })
121
- );
122
-
123
- // Feed results back into the reducer
124
- for (const r of results) {
125
- const ts = new Date().toISOString();
126
- if (r.ok) {
127
- state = apply(state, { type: 'task-completed', taskName: r.taskName, result: r.result, timestamp: ts }, graph);
128
- } else {
129
- state = apply(state, { type: 'task-failed', taskName: r.taskName, error: r.error!, timestamp: ts }, graph);
130
- }
131
- }
132
-
133
- console.log(` outputs so far: [${state.availableOutputs.join(', ')}]\n`);
134
- }
135
- }
136
-
137
- main().catch(console.error);