yaml-flow 7.0.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 (393) 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 -3307
  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/cli/browser-api/board-live-cards-browser-adapter.js +3 -0
  8. package/{dist/cli → cli}/browser-api/card-store-browser-api.d.ts +1 -2
  9. package/{dist/cli → cli}/browser-api/card-store-browser-api.js +1 -1
  10. package/cli/execution-interface-C_A6WCiK.d.ts +284 -0
  11. package/cli/node/artifacts-store-cli.js +11 -0
  12. package/cli/node/batch-runner-cli.js +3 -0
  13. package/cli/node/board-live-cards-cli.js +15 -0
  14. package/cli/node/card-store-cli.js +8 -0
  15. package/{dist/cli → cli}/node/execution-adapter.d.ts +3 -3
  16. package/cli/node/execution-adapter.js +3 -0
  17. package/{dist/cli → cli}/node/fs-board-adapter.d.ts +24 -11
  18. package/cli/node/fs-board-adapter.js +14 -0
  19. package/{dist/cli → cli}/node/source-cli-task-executor.js +2 -2
  20. package/cli/node/step-machine-cli.d.ts +7 -0
  21. package/cli/node/step-machine-cli.js +5 -0
  22. package/{dist/board-live-cards-public-CW5074xr.d.cts → cli/types-CziUxkiv.d.ts} +69 -7
  23. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.config/card-store-ref.json +1 -0
  24. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.config/chat-handler.json +1 -0
  25. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.config/outputs-store-ref.json +1 -0
  26. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.config/task-executor.json +1 -0
  27. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.state-snapshot/board/graph.json +29 -0
  28. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime/.state-snapshot/board/lastJournalProcessedId.json +1 -0
  29. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/gandalf-runtime-out/.outputs/status.json +25 -0
  30. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/cards/card-market-prices/computed_values.json +67 -0
  31. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/cards/card-portfolio/computed_values.json +1 -0
  32. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/cards/card-portfolio-value/computed_values.json +52 -0
  33. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/data-objects/holdings.json +22 -0
  34. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/data-objects/positions.json +46 -0
  35. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/data-objects/quotes.json +35 -0
  36. package/examples/board/.demo-setup/run-1778643703151-3360-dopnpv/board-default/runtime-out/.outputs/status.json +113 -0
  37. package/examples/{example-board/cards/card-market-prices.json → board/cards/cardT-market-prices.json} +2 -2
  38. package/examples/{example-board/cards/card-portfolio.json → board/cards/cardT-portfolio.json} +3 -13
  39. package/examples/{example-board → board}/demo-server-config.json +0 -1
  40. package/examples/{example-board → board}/demo-server.js +70 -72
  41. package/examples/{example-board → board}/demo-shell-with-server.html +3 -3
  42. package/examples/{example-board → board}/demo-task-executor.js +75 -32
  43. package/examples/board/gandalf-cards/card-source-kinds.json +36 -0
  44. package/examples/board/gandalf-cards/cards/_index.json +7 -0
  45. package/examples/board/gandalf-cards/cards/card-source-kinds.json +64 -0
  46. package/examples/board/source-def-flows/copilot.flow.json +33 -0
  47. package/examples/board/source-def-flows/mock.flow.json +35 -0
  48. package/examples/board/source-def-flows/url-list.flow.json +33 -0
  49. package/examples/board/source-def-flows/url.flow.json +33 -0
  50. package/examples/board/source-def-flows/workiq.flow.json +34 -0
  51. package/examples/board/source-def-handlers/copilot-source-handler.js +141 -0
  52. package/examples/board/source-def-handlers/http-source-handler.js +145 -0
  53. package/examples/board/source_def_flows.json +249 -0
  54. package/examples/board/test/demo-http-test.js +317 -0
  55. package/examples/{example-board → board-local}/demo-shell-localstorage.html +4 -4
  56. package/examples/{browser/boards/portfolio-tracker → portfolio-tracker/handlers}/portfolio-tracker-fetch-prices.js +1 -1
  57. package/examples/{browser/boards/portfolio-tracker/portfolio-tracker-public.js → portfolio-tracker/portfolio-tracker.js} +11 -14
  58. package/examples/{browser/boards/portfolio-tracker → portfolio-tracker/test}/portfolio-t4.js +32 -50
  59. package/lib/artifacts-store-lib-public-BABrgFkV.d.ts +119 -0
  60. package/lib/artifacts-store-lib-public-DGa8BpJT.d.cts +119 -0
  61. package/lib/artifacts-store-public.cjs +2 -0
  62. package/lib/artifacts-store-public.d.cts +5 -0
  63. package/lib/artifacts-store-public.d.ts +5 -0
  64. package/lib/artifacts-store-public.js +2 -0
  65. package/lib/board-live-cards-node.cjs +14 -0
  66. package/{dist/cli/node/execution-adapter.d.cts → lib/board-live-cards-node.d.cts} +45 -85
  67. package/lib/board-live-cards-node.d.ts +134 -0
  68. package/lib/board-live-cards-node.js +14 -0
  69. package/lib/board-live-cards-public-BnmRAbQV.d.cts +383 -0
  70. package/{dist/board-live-cards-public-hnZo0mAf.d.ts → lib/board-live-cards-public-CsmYrvpd.d.ts} +142 -77
  71. package/lib/board-live-cards-public.cjs +3 -0
  72. package/lib/board-live-cards-public.d.cts +4 -0
  73. package/lib/board-live-cards-public.d.ts +4 -0
  74. package/lib/board-live-cards-public.js +3 -0
  75. package/lib/board-live-cards-server-runtime.cjs +9 -0
  76. package/lib/board-live-cards-server-runtime.d.cts +6 -0
  77. package/lib/board-live-cards-server-runtime.d.ts +6 -0
  78. package/lib/board-live-cards-server-runtime.js +9 -0
  79. package/lib/board-livegraph-runtime/index.cjs +3 -0
  80. package/{dist → lib}/board-livegraph-runtime/index.d.cts +1 -2
  81. package/{dist → lib}/board-livegraph-runtime/index.d.ts +1 -2
  82. package/lib/board-livegraph-runtime/index.js +3 -0
  83. package/lib/board-worker-adapter.cjs +10 -0
  84. package/{dist/storage-refs.d.cts → lib/board-worker-adapter.d.cts} +5 -5
  85. package/{dist/storage-refs.d.ts → lib/board-worker-adapter.d.ts} +5 -5
  86. package/lib/board-worker-adapter.js +10 -0
  87. package/{dist → lib}/card-compute/index.cjs +1 -1
  88. package/{dist → lib}/card-compute/index.js +1 -1
  89. package/lib/card-store-public.cjs +2 -0
  90. package/lib/card-store-public.d.cts +61 -0
  91. package/lib/card-store-public.d.ts +61 -0
  92. package/lib/card-store-public.js +2 -0
  93. package/lib/card-validation.cjs +10 -0
  94. package/lib/card-validation.d.cts +35 -0
  95. package/lib/card-validation.d.ts +35 -0
  96. package/lib/card-validation.js +10 -0
  97. package/{dist/constants-oCEbNpul.d.ts → lib/constants-BPVLb3Es.d.ts} +1 -1
  98. package/{dist/constants-BzZUyYlp.d.cts → lib/constants-DXxsRN9y.d.cts} +1 -1
  99. package/{dist → lib}/continuous-event-graph/index.cjs +2 -2
  100. package/{dist → lib}/continuous-event-graph/index.d.cts +3 -5
  101. package/{dist → lib}/continuous-event-graph/index.d.ts +3 -5
  102. package/{dist → lib}/continuous-event-graph/index.js +2 -2
  103. package/{dist → lib}/event-graph/index.d.cts +2 -2
  104. package/{dist → lib}/event-graph/index.d.ts +2 -2
  105. package/lib/execution-refs.cjs +3 -0
  106. package/{dist → lib}/execution-refs.d.cts +38 -14
  107. package/{dist → lib}/execution-refs.d.ts +38 -14
  108. package/lib/execution-refs.js +3 -0
  109. package/lib/index.cjs +25 -0
  110. package/{dist → lib}/index.d.cts +7 -8
  111. package/{dist → lib}/index.d.ts +7 -8
  112. package/lib/index.js +25 -0
  113. package/{dist/live-cards-bridge-BXbVTsna.d.cts → lib/live-cards-bridge-DC_ZU0eS.d.ts} +134 -3
  114. package/{dist/live-cards-bridge-Ds28XR15.d.ts → lib/live-cards-bridge-b25aAVvE.d.cts} +134 -3
  115. package/lib/loader-CuuLjxVA.d.cts +42 -0
  116. package/lib/loader-Zborm2pq.d.ts +42 -0
  117. package/lib/server-runtime/index.cjs +9 -0
  118. package/{dist → lib}/server-runtime/index.d.cts +4 -4
  119. package/{dist → lib}/server-runtime/index.d.ts +4 -4
  120. package/lib/server-runtime/index.js +9 -0
  121. package/lib/step-machine/index.d.cts +64 -0
  122. package/lib/step-machine/index.d.ts +64 -0
  123. package/lib/step-machine-public/index.cjs +5 -0
  124. package/{dist → lib}/step-machine-public/index.d.cts +21 -1
  125. package/{dist → lib}/step-machine-public/index.d.ts +21 -1
  126. package/lib/step-machine-public/index.js +5 -0
  127. package/lib/storage-interface-BhAON-gW.d.cts +84 -0
  128. package/lib/storage-interface-BhAON-gW.d.ts +84 -0
  129. package/lib/stores/index.cjs +3 -0
  130. package/lib/stores/index.d.cts +4 -0
  131. package/lib/stores/index.d.ts +4 -0
  132. package/lib/stores/index.js +3 -0
  133. package/lib/stores/kv.cjs +3 -0
  134. package/lib/stores/kv.d.cts +32 -0
  135. package/lib/stores/kv.d.ts +32 -0
  136. package/lib/stores/kv.js +3 -0
  137. package/{dist → lib}/stores/memory.d.cts +1 -1
  138. package/{dist → lib}/stores/memory.d.ts +1 -1
  139. package/{dist/types-B1ZRa4aI.d.ts → lib/types-CBxkYuLY.d.ts} +2 -1
  140. package/{dist/types-ycun84cq.d.cts → lib/types-DQ1bKuB1.d.cts} +11 -0
  141. package/{dist/types-ycun84cq.d.ts → lib/types-DQ1bKuB1.d.ts} +11 -0
  142. package/{dist/types-BxEFcVK9.d.cts → lib/types-DkFvgxwq.d.cts} +2 -1
  143. package/package.json +79 -119
  144. package/board-live-cards-cli.js +0 -37
  145. package/browser/board-livecards-client.js.map +0 -1
  146. package/browser/board-livecards-localstorage.js.map +0 -1
  147. package/browser/board-livegraph-engine.js +0 -3
  148. package/browser/board-livegraph-engine.js.map +0 -1
  149. package/browser/card-compute.js +0 -266
  150. package/browser/compute-jsonata.js.map +0 -1
  151. package/card-store.js +0 -37
  152. package/dist/batch/index.cjs.map +0 -1
  153. package/dist/batch/index.js.map +0 -1
  154. package/dist/board-live-cards-lib-Bg6EvCo5.d.cts +0 -136
  155. package/dist/board-live-cards-lib-jM2uYG1v.d.ts +0 -136
  156. package/dist/board-livegraph-runtime/index.cjs +0 -3
  157. package/dist/board-livegraph-runtime/index.cjs.map +0 -1
  158. package/dist/board-livegraph-runtime/index.js +0 -3
  159. package/dist/board-livegraph-runtime/index.js.map +0 -1
  160. package/dist/card-compute/index.cjs.map +0 -1
  161. package/dist/card-compute/index.js.map +0 -1
  162. package/dist/cli/browser-api/board-live-cards-browser-adapter.cjs +0 -3
  163. package/dist/cli/browser-api/board-live-cards-browser-adapter.cjs.map +0 -1
  164. package/dist/cli/browser-api/board-live-cards-browser-adapter.d.cts +0 -37
  165. package/dist/cli/browser-api/board-live-cards-browser-adapter.js +0 -3
  166. package/dist/cli/browser-api/board-live-cards-browser-adapter.js.map +0 -1
  167. package/dist/cli/browser-api/card-store-browser-api.cjs +0 -2
  168. package/dist/cli/browser-api/card-store-browser-api.cjs.map +0 -1
  169. package/dist/cli/browser-api/card-store-browser-api.d.cts +0 -26
  170. package/dist/cli/browser-api/card-store-browser-api.js.map +0 -1
  171. package/dist/cli/node/artifacts-store-cli.cjs +0 -11
  172. package/dist/cli/node/artifacts-store-cli.cjs.map +0 -1
  173. package/dist/cli/node/artifacts-store-cli.d.cts +0 -8
  174. package/dist/cli/node/artifacts-store-cli.js +0 -11
  175. package/dist/cli/node/artifacts-store-cli.js.map +0 -1
  176. package/dist/cli/node/board-live-cards-cli.cjs +0 -15
  177. package/dist/cli/node/board-live-cards-cli.cjs.map +0 -1
  178. package/dist/cli/node/board-live-cards-cli.d.cts +0 -20
  179. package/dist/cli/node/board-live-cards-cli.js +0 -15
  180. package/dist/cli/node/board-live-cards-cli.js.map +0 -1
  181. package/dist/cli/node/card-store-cli.cjs +0 -8
  182. package/dist/cli/node/card-store-cli.cjs.map +0 -1
  183. package/dist/cli/node/card-store-cli.d.cts +0 -15
  184. package/dist/cli/node/card-store-cli.js +0 -8
  185. package/dist/cli/node/card-store-cli.js.map +0 -1
  186. package/dist/cli/node/execution-adapter.cjs +0 -3
  187. package/dist/cli/node/execution-adapter.cjs.map +0 -1
  188. package/dist/cli/node/execution-adapter.js +0 -3
  189. package/dist/cli/node/execution-adapter.js.map +0 -1
  190. package/dist/cli/node/fs-board-adapter.cjs +0 -14
  191. package/dist/cli/node/fs-board-adapter.cjs.map +0 -1
  192. package/dist/cli/node/fs-board-adapter.d.cts +0 -204
  193. package/dist/cli/node/fs-board-adapter.js +0 -14
  194. package/dist/cli/node/fs-board-adapter.js.map +0 -1
  195. package/dist/cli/node/source-cli-task-executor.cjs +0 -11
  196. package/dist/cli/node/source-cli-task-executor.cjs.map +0 -1
  197. package/dist/cli/node/source-cli-task-executor.js.map +0 -1
  198. package/dist/config/index.cjs.map +0 -1
  199. package/dist/config/index.js.map +0 -1
  200. package/dist/continuous-event-graph/index.cjs.map +0 -1
  201. package/dist/continuous-event-graph/index.js.map +0 -1
  202. package/dist/event-graph/index.cjs.map +0 -1
  203. package/dist/event-graph/index.js.map +0 -1
  204. package/dist/execution-refs.cjs +0 -3
  205. package/dist/execution-refs.cjs.map +0 -1
  206. package/dist/execution-refs.js +0 -3
  207. package/dist/execution-refs.js.map +0 -1
  208. package/dist/index.cjs +0 -30
  209. package/dist/index.cjs.map +0 -1
  210. package/dist/index.js +0 -30
  211. package/dist/index.js.map +0 -1
  212. package/dist/inference/index.cjs +0 -7
  213. package/dist/inference/index.cjs.map +0 -1
  214. package/dist/inference/index.d.cts +0 -229
  215. package/dist/inference/index.d.ts +0 -229
  216. package/dist/inference/index.js +0 -7
  217. package/dist/inference/index.js.map +0 -1
  218. package/dist/server-runtime/index.cjs +0 -9
  219. package/dist/server-runtime/index.cjs.map +0 -1
  220. package/dist/server-runtime/index.js +0 -9
  221. package/dist/server-runtime/index.js.map +0 -1
  222. package/dist/step-machine/index.cjs.map +0 -1
  223. package/dist/step-machine/index.d.cts +0 -102
  224. package/dist/step-machine/index.d.ts +0 -102
  225. package/dist/step-machine/index.js.map +0 -1
  226. package/dist/step-machine-public/index.cjs +0 -2
  227. package/dist/step-machine-public/index.cjs.map +0 -1
  228. package/dist/step-machine-public/index.js +0 -2
  229. package/dist/step-machine-public/index.js.map +0 -1
  230. package/dist/storage-refs.cjs +0 -10
  231. package/dist/storage-refs.cjs.map +0 -1
  232. package/dist/storage-refs.js +0 -10
  233. package/dist/storage-refs.js.map +0 -1
  234. package/dist/stores/file.cjs +0 -2
  235. package/dist/stores/file.cjs.map +0 -1
  236. package/dist/stores/file.d.cts +0 -36
  237. package/dist/stores/file.d.ts +0 -36
  238. package/dist/stores/file.js +0 -2
  239. package/dist/stores/file.js.map +0 -1
  240. package/dist/stores/index.cjs +0 -2
  241. package/dist/stores/index.cjs.map +0 -1
  242. package/dist/stores/index.d.cts +0 -4
  243. package/dist/stores/index.d.ts +0 -4
  244. package/dist/stores/index.js +0 -2
  245. package/dist/stores/index.js.map +0 -1
  246. package/dist/stores/localStorage.cjs +0 -2
  247. package/dist/stores/localStorage.cjs.map +0 -1
  248. package/dist/stores/localStorage.d.cts +0 -34
  249. package/dist/stores/localStorage.d.ts +0 -34
  250. package/dist/stores/localStorage.js +0 -2
  251. package/dist/stores/localStorage.js.map +0 -1
  252. package/dist/stores/memory.cjs.map +0 -1
  253. package/dist/stores/memory.js.map +0 -1
  254. package/dist/types-CHSdoAAA.d.cts +0 -135
  255. package/dist/types-CoW0gQl3.d.ts +0 -135
  256. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-fetch-prices.py +0 -201
  257. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-http-test.js +0 -357
  258. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-inference-adapter.js +0 -196
  259. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-server.js +0 -300
  260. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-server.py +0 -617
  261. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.py +0 -366
  262. package/examples/browser/livecards-browser/index.html +0 -41
  263. package/examples/browser/step-machine-browser/index.html +0 -367
  264. package/examples/cli/step-machine-cli/portfolio-tracker/--base-ref/.runtime-out +0 -1
  265. package/examples/cli/step-machine-cli/portfolio-tracker/--base-ref/board-graph.json +0 -32
  266. package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +0 -22
  267. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +0 -43
  268. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +0 -15
  269. package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +0 -15
  270. package/examples/cli/step-machine-cli/portfolio-tracker/fetch-prices.js +0 -48
  271. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +0 -125
  272. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +0 -32
  273. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +0 -26
  274. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/poll-status-cli.js +0 -49
  275. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +0 -25
  276. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +0 -23
  277. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/status-cli.js +0 -21
  278. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +0 -38
  279. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +0 -48
  280. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +0 -31
  281. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/_board_pycli.py +0 -107
  282. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/add-cards.py +0 -51
  283. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/init-board.py +0 -45
  284. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/poll-status.py +0 -71
  285. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/reset-board-dir.py +0 -36
  286. package/examples/cli/step-machine-cli/portfolio-tracker/inline-python-demo.flow.yaml +0 -26
  287. package/examples/cli/step-machine-cli/portfolio-tracker/inline-python-handlers.py +0 -39
  288. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker-pycli.flow.yaml +0 -80
  289. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +0 -76
  290. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +0 -44
  291. package/examples/cli/step-machine-cli/portfolio-tracker/run-inline-python-demo-pycli.py +0 -43
  292. package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker-pycli.py +0 -77
  293. package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +0 -28
  294. package/examples/cli/step-machine-demo/jsonata-init-board-cli.js +0 -31
  295. package/examples/cli/step-machine-demo/jsonata-init-board.flow.yaml +0 -54
  296. package/examples/cli/step-machine-demo/one-step-cli-only.flow.yaml +0 -21
  297. package/examples/cli/step-machine-demo/step-cli-echo-y.js +0 -15
  298. package/examples/cli/step-machine-demo/step2-double-cli.js +0 -33
  299. package/examples/cli/step-machine-demo/two-step-math.flow.yaml +0 -93
  300. package/examples/cli/step-machine-demo/two-step-mixed.flow.yaml +0 -43
  301. package/examples/example-board/agent-instructions-cardlayout.md +0 -56
  302. package/examples/example-board/agent-instructions.md +0 -834
  303. package/examples/example-board/cards/_index.json +0 -47
  304. package/examples/example-board/demo-shell.html +0 -63
  305. package/examples/index.html +0 -785
  306. package/examples/npm-libs/batch/batch-step-machine.ts +0 -121
  307. package/examples/npm-libs/continuous-event-graph/live-cards-board.ts +0 -215
  308. package/examples/npm-libs/continuous-event-graph/live-portfolio-dashboard.ts +0 -555
  309. package/examples/npm-libs/continuous-event-graph/portfolio-tracker.ts +0 -287
  310. package/examples/npm-libs/continuous-event-graph/reactive-monitoring.ts +0 -265
  311. package/examples/npm-libs/continuous-event-graph/reactive-pipeline.ts +0 -168
  312. package/examples/npm-libs/continuous-event-graph/soc-incident-board.ts +0 -287
  313. package/examples/npm-libs/continuous-event-graph/stock-dashboard.ts +0 -229
  314. package/examples/npm-libs/event-graph/ci-cd-pipeline.ts +0 -243
  315. package/examples/npm-libs/event-graph/executor-diamond.ts +0 -165
  316. package/examples/npm-libs/event-graph/executor-pipeline.ts +0 -161
  317. package/examples/npm-libs/event-graph/research-pipeline.ts +0 -137
  318. package/examples/npm-libs/flows/ai-conversation.yaml +0 -116
  319. package/examples/npm-libs/flows/order-processing.yaml +0 -143
  320. package/examples/npm-libs/flows/simple-greeting.yaml +0 -54
  321. package/examples/npm-libs/graph-of-graphs/multi-stage-etl.ts +0 -307
  322. package/examples/npm-libs/graph-of-graphs/url-processing-pipeline.ts +0 -254
  323. package/examples/npm-libs/inference/azure-deployment.ts +0 -149
  324. package/examples/npm-libs/inference/copilot-cli.ts +0 -138
  325. package/examples/npm-libs/inference/data-pipeline.ts +0 -145
  326. package/examples/npm-libs/inference/pluggable-adapters.ts +0 -254
  327. package/examples/npm-libs/node/ai-conversation.ts +0 -195
  328. package/examples/npm-libs/node/simple-greeting.ts +0 -101
  329. package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +0 -22
  330. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +0 -43
  331. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +0 -15
  332. package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +0 -15
  333. package/examples/step-machine-cli/portfolio-tracker/fetch-prices.js +0 -48
  334. package/examples/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +0 -57
  335. package/examples/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +0 -27
  336. package/examples/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +0 -25
  337. package/examples/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +0 -29
  338. package/examples/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +0 -27
  339. package/examples/step-machine-cli/portfolio-tracker/handlers/status-cli.js +0 -25
  340. package/examples/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +0 -37
  341. package/examples/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +0 -53
  342. package/examples/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +0 -35
  343. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker-task-executor.cjs +0 -96
  344. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +0 -227
  345. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +0 -38
  346. package/examples/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +0 -28
  347. package/step-machine-cli.js +0 -407
  348. /package/{dist/board-livegraph-runtime → cli/browser-api}/jsonata-sync.cjs +0 -0
  349. /package/{dist/cli → cli}/node/artifacts-store-cli.d.ts +0 -0
  350. /package/{dist/cli/node/source-cli-task-executor.d.cts → cli/node/batch-runner-cli.d.ts} +0 -0
  351. /package/{dist/cli → cli}/node/board-live-cards-cli.d.ts +0 -0
  352. /package/{dist/cli → cli}/node/card-store-cli.d.ts +0 -0
  353. /package/{dist/card-compute → cli/node}/jsonata-sync.cjs +0 -0
  354. /package/{dist/cli → cli}/node/source-cli-task-executor.d.ts +0 -0
  355. /package/examples/{example-board → board}/cards/card-concentration.json +0 -0
  356. /package/examples/{example-board → board}/cards/card-my-identity.json +0 -0
  357. /package/examples/{example-board → board}/cards/card-portfolio-action.json +0 -0
  358. /package/examples/{example-board → board}/cards/card-portfolio-intelligence.json +0 -0
  359. /package/examples/{example-board → board}/cards/card-portfolio-risks.json +0 -0
  360. /package/examples/{example-board → board}/cards/card-rebalance-impact.json +0 -0
  361. /package/examples/{example-board → board}/cards/card-rebalance-sim.json +0 -0
  362. /package/examples/{example-board/cards/card-portfolio-value.json → board/cards/cardT-portfolio-value.json} +0 -0
  363. /package/examples/{example-board → board}/demo-chat-handler.js +0 -0
  364. /package/examples/{example-board → board}/scripts/copilot_wrapper.bat +0 -0
  365. /package/examples/{example-board → board}/scripts/copilot_wrapper_helper.ps1 +0 -0
  366. /package/examples/{example-board → board}/scripts/workiq_wrapper.mjs +0 -0
  367. /package/examples/{browser/boards/portfolio-tracker → board/test}/portfolio-tracker-sse-worker.js +0 -0
  368. /package/{dist → lib}/batch/index.cjs +0 -0
  369. /package/{dist → lib}/batch/index.d.cts +0 -0
  370. /package/{dist → lib}/batch/index.d.ts +0 -0
  371. /package/{dist → lib}/batch/index.js +0 -0
  372. /package/{dist/cli/browser-api → lib/board-livegraph-runtime}/jsonata-sync.cjs +0 -0
  373. /package/{dist → lib}/card-compute/index.d.cts +0 -0
  374. /package/{dist → lib}/card-compute/index.d.ts +0 -0
  375. /package/{dist/cli/node → lib/card-compute}/jsonata-sync.cjs +0 -0
  376. /package/{dist → lib}/config/index.cjs +0 -0
  377. /package/{dist → lib}/config/index.d.cts +0 -0
  378. /package/{dist → lib}/config/index.d.ts +0 -0
  379. /package/{dist → lib}/config/index.js +0 -0
  380. /package/{dist → lib}/continuous-event-graph/jsonata-sync.cjs +0 -0
  381. /package/{dist → lib}/event-graph/index.cjs +0 -0
  382. /package/{dist → lib}/event-graph/index.js +0 -0
  383. /package/{dist → lib}/jsonata-sync.cjs +0 -0
  384. /package/{dist → lib}/server-runtime/jsonata-sync.cjs +0 -0
  385. /package/{dist → lib}/step-machine/index.cjs +0 -0
  386. /package/{dist → lib}/step-machine/index.js +0 -0
  387. /package/{dist → lib}/step-machine-public/jsonata-sync.cjs +0 -0
  388. /package/{dist → lib}/stores/memory.cjs +0 -0
  389. /package/{dist → lib}/stores/memory.js +0 -0
  390. /package/{dist → lib}/types-BBhqYGhE.d.cts +0 -0
  391. /package/{dist → lib}/types-BBhqYGhE.d.ts +0 -0
  392. /package/{dist → lib}/validate-BAVzUJWa.d.ts +0 -0
  393. /package/{dist → lib}/validate-Dbu7ygys.d.cts +0 -0
@@ -1,168 +0,0 @@
1
- /**
2
- * Reactive Graph Example: Data Pipeline
3
- *
4
- * A simple ETL pipeline that drives itself.
5
- * Register handlers → push one event → the graph runs to completion.
6
- *
7
- * Demonstrates:
8
- * - createCallbackHandler for wrapping async functions
9
- * - validateLiveGraph for runtime state-consistency checks
10
- * - validateReactiveGraph for handler/dispatch checks
11
- *
12
- * Run with: npx tsx examples/npm-libs/continuous-event-graph/reactive-pipeline.ts
13
- */
14
-
15
- import {
16
- createReactiveGraph,
17
- createCallbackHandler,
18
- validateLiveGraph,
19
- validateReactiveGraph,
20
- } from '../../src/continuous-event-graph/index.js';
21
- import type { GraphConfig } from '../../src/continuous-event-graph/types.js';
22
- import type { ReactiveGraph } from '../../src/continuous-event-graph/reactive.js';
23
- import type { ResolveCallbackFn } from '../../src/continuous-event-graph/handlers.js';
24
-
25
- // ============================================================================
26
- // 1. Define the graph
27
- // ============================================================================
28
-
29
- const config: GraphConfig = {
30
- id: 'etl-pipeline',
31
- settings: {
32
- completion: 'all-tasks-done',
33
- execution_mode: 'eligibility-mode',
34
- },
35
- tasks: {
36
- extract: {
37
- provides: ['raw-data'],
38
- taskHandlers: ['extract'],
39
- description: 'Pull records from source API',
40
- },
41
- validate: {
42
- requires: ['raw-data'],
43
- provides: ['valid-data'],
44
- taskHandlers: ['validate'],
45
- description: 'Validate and clean records',
46
- },
47
- enrich: {
48
- requires: ['valid-data'],
49
- provides: ['enriched-data'],
50
- taskHandlers: ['enrich'],
51
- description: 'Enrich with external metadata',
52
- },
53
- load: {
54
- requires: ['enriched-data'],
55
- provides: ['loaded'],
56
- taskHandlers: ['load'],
57
- description: 'Write to destination database',
58
- },
59
- },
60
- };
61
-
62
- // ============================================================================
63
- // 2. Create the reactive graph with handlers
64
- // ============================================================================
65
-
66
- // Handlers use createCallbackHandler — a thin wrapper for type safety.
67
- // Lazy resolver pattern: graph doesn't exist at handler-creation time.
68
- // Note: no explicit dataHash! The reactive layer auto-computes SHA-256
69
- // from the data payload, so the data-changed refresh strategy works
70
- // out of the box with zero handler effort.
71
-
72
- let graphRef: ReactiveGraph;
73
- const getResolve = (): ResolveCallbackFn => graphRef.resolveCallback.bind(graphRef);
74
-
75
- const handlers = {
76
- extract: createCallbackHandler(async ({ nodeId }) => {
77
- console.log(` [${nodeId}] Fetching 1,000 records from source API...`);
78
- await sleep(200);
79
- return { recordCount: 1000 };
80
- }, getResolve),
81
-
82
- validate: createCallbackHandler(async ({ nodeId }) => {
83
- console.log(` [${nodeId}] Validating records...`);
84
- await sleep(100);
85
- console.log(` [${nodeId}] 980 valid, 20 rejected`);
86
- return { valid: 980, rejected: 20 };
87
- }, getResolve),
88
-
89
- enrich: createCallbackHandler(async ({ nodeId }) => {
90
- console.log(` [${nodeId}] Enriching with geo + company data...`);
91
- await sleep(150);
92
- return { enrichedCount: 980 };
93
- }, getResolve),
94
-
95
- load: createCallbackHandler(async ({ nodeId }) => {
96
- console.log(` [${nodeId}] Writing 980 records to database...`);
97
- await sleep(100);
98
- console.log(` [${nodeId}] Done.`);
99
- return { written: 980 };
100
- }, getResolve),
101
- };
102
-
103
- const rg = createReactiveGraph(config, {
104
- handlers,
105
-
106
- onDrain: (events, live, scheduleResult) => {
107
- const completedCount = Object.values(live.state.tasks)
108
- .filter(t => t.status === 'completed').length;
109
- const total = Object.keys(live.config.tasks).length;
110
- console.log(
111
- ` [drain] ${events.length} events processed, ` +
112
- `${completedCount}/${total} tasks done, ` +
113
- `${scheduleResult.eligible.length} eligible`,
114
- );
115
- },
116
- });
117
- graphRef = rg;
118
-
119
- // ============================================================================
120
- // 3. Push one event — the graph drives itself
121
- // ============================================================================
122
-
123
- console.log('=== Reactive ETL Pipeline ===\n');
124
- console.log('Pushing initial trigger...\n');
125
-
126
- rg.push({ type: 'inject-tokens', tokens: [], timestamp: new Date().toISOString() });
127
-
128
- // Wait for the pipeline to complete
129
- await sleep(2000);
130
-
131
- // Check final state
132
- const state = rg.getState();
133
- console.log('\n=== Final State ===');
134
- for (const [name, task] of Object.entries(state.state.tasks)) {
135
- const hash = task.lastDataHash ? ` (hash: ${task.lastDataHash})` : '';
136
- console.log(` ${name}: ${task.status} (executed ${task.executionCount}x)${hash}`);
137
- }
138
- console.log(`\n Outputs: [${state.state.availableOutputs.join(', ')}]`);
139
-
140
- // ============================================================================
141
- // 4. Validate — runtime state-consistency checks
142
- // ============================================================================
143
-
144
- console.log('\n=== Validation ===');
145
-
146
- // validateLiveGraph: checks state/config consistency
147
- const liveResult = validateLiveGraph(state);
148
- console.log(` LiveGraph valid: ${liveResult.valid} (${liveResult.issues.length} issues)`);
149
- for (const issue of liveResult.issues) {
150
- console.log(` [${issue.severity}] ${issue.code}: ${issue.message}`);
151
- }
152
-
153
- // validateReactiveGraph: checks handler/dispatch consistency + all live checks
154
- const reactiveResult = validateReactiveGraph({ graph: rg, handlers });
155
- console.log(` ReactiveGraph valid: ${reactiveResult.valid} (${reactiveResult.issues.length} issues)`);
156
- for (const issue of reactiveResult.issues) {
157
- console.log(` [${issue.severity}] ${issue.code}: ${issue.message}`);
158
- }
159
-
160
- rg.dispose();
161
-
162
- // ============================================================================
163
- // Util
164
- // ============================================================================
165
-
166
- function sleep(ms: number): Promise<void> {
167
- return new Promise(resolve => setTimeout(resolve, ms));
168
- }
@@ -1,287 +0,0 @@
1
- /**
2
- * SOC Incident Board — Correct Model
3
- *
4
- * A Security Operations Center dashboard demonstrating:
5
- * • External data source_defs (alert-feed, threat-intel) — NO handlers
6
- * • Handler-driven compute (severity-score, blast-radius)
7
- * • Fire-and-forget side effects (slack-alert, create-ticket)
8
- * • Per-task refreshStrategy: 'once' on create-ticket (no duplicate tickets)
9
- * • retrigger for data refresh without resetting the entire graph
10
- * • All data read from engine state — no sharedState workaround
11
- *
12
- * Topology:
13
- * ┌─────────────┐ ┌──────────────┐
14
- * │ alert-feed │ │ threat-intel │ ← external push (no handler)
15
- * └──────┬───────┘ └──────┬───────┘
16
- * └────────┬─────────┘
17
- * ▼
18
- * ┌───────────────┐
19
- * │ severity-score │ ← compute (handler)
20
- * └───────┬───────┘
21
- * │
22
- * ┌────────┼──────────┐
23
- * ▼ ▼ ▼
24
- * ┌────────────┐ ┌────────┐ ┌──────────────┐
25
- * │blast-radius│ │ slack │ │create-ticket │ ← side-effect handlers
26
- * └────────────┘ └────────┘ └──────────────┘
27
- * (once only)
28
- *
29
- * Timeline:
30
- * T0: External push of alert-feed + threat-intel data → cascade
31
- * T1: New intel arrives → retrigger threat-intel → data-changed cascade
32
- * create-ticket skipped (once) — slack re-fires
33
- *
34
- * Run with: npx tsx examples/npm-libs/continuous-event-graph/soc-incident-board.ts
35
- */
36
-
37
- import type { GraphConfig } from '../../src/event-graph/types.js';
38
- import { createReactiveGraph } from '../../src/continuous-event-graph/reactive.js';
39
- import { validateReactiveGraph } from '../../src/continuous-event-graph/validate.js';
40
- import { createCallbackHandler, createFireAndForgetHandler } from '../../src/continuous-event-graph/handlers.js';
41
- import type { TaskHandlerFn, ReactiveGraph } from '../../src/continuous-event-graph/reactive.js';
42
- import type { ResolveCallbackFn } from '../../src/continuous-event-graph/handlers.js';
43
-
44
- // ============================================================================
45
- // Simulated data
46
- // ============================================================================
47
-
48
- const siemAlerts = [
49
- { id: 'A-001', ioc: '185.220.101.42', severity: 'high', type: 'brute-force' },
50
- { id: 'A-002', ioc: 'evil-payload.exe', severity: 'critical', type: 'malware' },
51
- ];
52
-
53
- const threatIntelV1 = [
54
- { ioc: '185.220.101.42', classification: 'known-attacker', confidence: 0.92 },
55
- { ioc: 'evil-payload.exe', classification: 'apt-tool', confidence: 0.88 },
56
- ];
57
-
58
- const threatIntelV2 = [
59
- { ioc: '185.220.101.42', classification: 'false-positive', confidence: 0.15 },
60
- { ioc: 'evil-payload.exe', classification: 'apt-tool', confidence: 0.88 },
61
- { ioc: 'new-c2-domain.net', classification: 'c2-server', confidence: 0.95 },
62
- ];
63
-
64
- // Side-effect log for verification
65
- const sideEffects: string[] = [];
66
-
67
- // ============================================================================
68
- // 1. Define the graph config
69
- // ============================================================================
70
-
71
- const config: GraphConfig = {
72
- id: 'soc-incident-board',
73
- settings: {
74
- completion: 'manual',
75
- execution_mode: 'eligibility-mode',
76
- refreshStrategy: 'data-changed',
77
- },
78
- tasks: {
79
- // External source_defs — no handler, data pushed externally
80
- 'alert-feed': {
81
- provides: ['alert-feed'],
82
- description: 'SIEM alert feed (external push)',
83
- },
84
- 'threat-intel': {
85
- provides: ['threat-intel'],
86
- description: 'Threat intelligence STIX feed (external push)',
87
- },
88
-
89
- // Compute: correlate alerts against threat intel
90
- 'severity-score': {
91
- requires: ['alert-feed', 'threat-intel'],
92
- provides: ['severity-score'],
93
- taskHandlers: ['severity-score'],
94
- description: 'Severity scoring engine',
95
- },
96
-
97
- // Side-effect: blast radius analysis
98
- 'blast-radius': {
99
- requires: ['severity-score'],
100
- provides: ['blast-radius'],
101
- taskHandlers: ['blast-radius'],
102
- description: 'Blast radius: affected services',
103
- },
104
-
105
- // Side-effect: Slack alert (fires on every data change)
106
- 'slack-alert': {
107
- requires: ['severity-score'],
108
- provides: ['slack-alert'],
109
- taskHandlers: ['slack-alert'],
110
- description: 'Slack #incident-response notification',
111
- },
112
-
113
- // Side-effect: ServiceNow ticket (runs ONCE — no duplicate tickets)
114
- 'create-ticket': {
115
- requires: ['severity-score'],
116
- provides: ['create-ticket'],
117
- taskHandlers: ['create-ticket'],
118
- refreshStrategy: 'once',
119
- description: 'ServiceNow ticket creation (once only)',
120
- },
121
- },
122
- };
123
-
124
- // ============================================================================
125
- // 2. Define handlers — only for compute + side-effect tasks
126
- // (alert-feed, threat-intel have NO handler — externally driven)
127
- // ============================================================================
128
-
129
- // Lazy resolver — graph doesn't exist at handler-creation time
130
- let graphRef: ReactiveGraph;
131
- const getResolve = (): ResolveCallbackFn => graphRef.resolveCallback.bind(graphRef);
132
-
133
- const handlers: Record<string, TaskHandlerFn> = {
134
- 'severity-score': createCallbackHandler(async ({ state }) => {
135
- await sleep(50);
136
- const alerts = (state['alert-feed'] as
137
- { alerts?: typeof siemAlerts })?.alerts ?? [];
138
- const intel = (state['threat-intel'] as
139
- { intel?: typeof threatIntelV1 })?.intel ?? [];
140
-
141
- const iocSet = new Set(intel.map(i => i.ioc));
142
- const matched = alerts.filter(a => iocSet.has(a.ioc));
143
- const score = Math.round((matched.length / Math.max(alerts.length, 1)) * 100);
144
- const avgConfidence = intel.length > 0
145
- ? Math.round(intel.reduce((s, i) => s + i.confidence, 0) / intel.length * 100)
146
- : 0;
147
- console.log(` [severity-score] Score: ${score}/100, Confidence: ${avgConfidence}%, Matched IOCs: ${matched.length}`);
148
- return { score, matchedCount: matched.length, avgConfidence, alertCount: alerts.length };
149
- }, getResolve),
150
-
151
- 'blast-radius': createCallbackHandler(async ({ state }) => {
152
- await sleep(30);
153
- const scoreData = state['severity-score'] as
154
- { alertCount?: number } | undefined;
155
- const services = ['auth-service', 'api-gateway', 'user-db', 'payment-service'];
156
- const affected = services.slice(0, Math.min(scoreData?.alertCount ?? 0, services.length));
157
- console.log(` [blast-radius] ${affected.length} services affected: ${affected.join(', ')}`);
158
- return { affected_services: affected, count: affected.length };
159
- }, getResolve),
160
-
161
- 'slack-alert': createFireAndForgetHandler(async ({ state }) => {
162
- await sleep(20);
163
- const scoreData = state['severity-score'] as
164
- { alertCount?: number; score?: number } | undefined;
165
- const msg = `INCIDENT: ${scoreData?.alertCount ?? '?'} alerts, severity ${scoreData?.score ?? '?'}/100`;
166
- console.log(` [slack-alert] → #incident-response: "${msg}"`);
167
- sideEffects.push(`slack: ${msg}`);
168
- }, getResolve),
169
-
170
- 'create-ticket': createCallbackHandler(async () => {
171
- await sleep(20);
172
- const ticketId = `INC${Date.now().toString().slice(-6)}`;
173
- console.log(` [create-ticket] → ServiceNow ticket ${ticketId} created`);
174
- sideEffects.push(`ticket: ${ticketId}`);
175
- return { ticketId, status: 'open' };
176
- }, getResolve),
177
- };
178
-
179
- // ============================================================================
180
- // 3. Create the reactive graph
181
- // ============================================================================
182
-
183
- const graph = createReactiveGraph(config, {
184
- handlers,
185
- onDrain: (events, live, result) => {
186
- const done = Object.values(live.state.tasks).filter(t => t.status === 'completed').length;
187
- const total = Object.keys(live.config.tasks).length;
188
- if (events.length > 0) {
189
- console.log(` [drain] ${events.length} events, ${done}/${total} tasks done, eligible: [${result.eligible.join(', ')}]`);
190
- }
191
- },
192
- });
193
- graphRef = graph;
194
-
195
- // ============================================================================
196
- // 4. T0: Initial incident — push alert data + threat intel externally
197
- // ============================================================================
198
-
199
- console.log('=== SOC Incident Board ===');
200
- console.log(`Tasks: ${Object.keys(config.tasks).join(', ')}`);
201
- console.log(`alert-feed, threat-intel: NO handler (external push)`);
202
- console.log(`create-ticket: refreshStrategy 'once' (no duplicate tickets)\n`);
203
-
204
- console.log(`--- T0: Initial incident (${siemAlerts.length} alerts, ${threatIntelV1.length} IOCs) ---\n`);
205
-
206
- // Push both source_defs simultaneously — engine stores data, auto-hash computed
207
- graph.pushAll([
208
- {
209
- type: 'task-completed',
210
- taskName: 'alert-feed',
211
- data: { alerts: siemAlerts },
212
- timestamp: new Date().toISOString(),
213
- },
214
- {
215
- type: 'task-completed',
216
- taskName: 'threat-intel',
217
- data: { intel: threatIntelV1 },
218
- timestamp: new Date().toISOString(),
219
- },
220
- ]);
221
-
222
- await sleep(2000);
223
-
224
- console.log('\n--- T0 Result ---');
225
- printState();
226
- console.log(` Side effects: ${sideEffects.length} fired`);
227
- sideEffects.forEach(se => console.log(` • ${se}`));
228
-
229
- // ============================================================================
230
- // 5. T1: New threat intel arrives — retrigger via external push
231
- // ============================================================================
232
-
233
- console.log(`\n--- T1: Threat intel update (false-positive reclassification + new C2) ---\n`);
234
-
235
- // Push new intel data. Auto-hash will differ → data-changed cascade.
236
- // alert-feed data unchanged → its hash stays the same.
237
- // severity-score re-runs because one upstream (threat-intel) hash changed.
238
- // create-ticket: refreshStrategy 'once' → already completed → NOT re-triggered.
239
- // slack-alert: data-changed → re-fires with updated score.
240
- graph.push({
241
- type: 'task-completed',
242
- taskName: 'threat-intel',
243
- data: { intel: threatIntelV2 },
244
- timestamp: new Date().toISOString(),
245
- });
246
-
247
- await sleep(2000);
248
-
249
- console.log('\n--- T1 Result ---');
250
- printState();
251
- console.log(` Side effects: ${sideEffects.length} total`);
252
- sideEffects.forEach(se => console.log(` • ${se}`));
253
-
254
- const ticketExecs = graph.getState().state.tasks['create-ticket'].executionCount;
255
- const slackExecs = graph.getState().state.tasks['slack-alert'].executionCount;
256
- console.log(`\n create-ticket ran ${ticketExecs}x (once strategy — no duplicate)`);
257
- console.log(` slack-alert ran ${slackExecs}x (re-notified on updated severity)`);
258
-
259
- // ============================================================================
260
- // 6. Validate
261
- // ============================================================================
262
-
263
- console.log('\n--- Validation ---');
264
- const validation = validateReactiveGraph({ graph, handlers });
265
- console.log(` Valid: ${validation.valid} (${validation.issues.length} issues)`);
266
- for (const issue of validation.issues) {
267
- console.log(` [${issue.severity}] ${issue.code}: ${issue.message}`);
268
- }
269
-
270
- graph.dispose();
271
- console.log('\nDone.');
272
-
273
- // ============================================================================
274
- // Helpers
275
- // ============================================================================
276
-
277
- function printState(): void {
278
- const state = graph.getState();
279
- for (const [name, task] of Object.entries(state.state.tasks)) {
280
- const hash = task.lastDataHash ? ` (hash: ${task.lastDataHash.slice(0, 8)}…)` : '';
281
- console.log(` ${name}: ${task.status} (${task.executionCount}x)${hash}`);
282
- }
283
- }
284
-
285
- function sleep(ms: number): Promise<void> {
286
- return new Promise(resolve => setTimeout(resolve, ms));
287
- }
@@ -1,229 +0,0 @@
1
- /**
2
- * Continuous Event Graph Example: Stock Dashboard
3
- *
4
- * Demonstrates a long-lived, evolving graph where:
5
- * - Nodes are added/removed at runtime (new data feeds)
6
- * - Tokens are injected/drained (market data, signals)
7
- * - mutateGraph applies multiple structural changes atomically
8
- * - validateLiveGraph checks runtime state-consistency
9
- * - Upstream/downstream analysis answers "what feeds X?" and "what breaks if X goes down?"
10
- * - Scheduling adapts as the graph evolves
11
- * - Snapshots allow persistence and restore
12
- *
13
- * Run with: npx tsx examples/npm-libs/continuous-event-graph/stock-dashboard.ts
14
- */
15
-
16
- import {
17
- createLiveGraph,
18
- applyEvent,
19
- addNode,
20
- removeNode,
21
- injectTokens,
22
- drainTokens,
23
- schedule,
24
- inspect,
25
- disableNode,
26
- enableNode,
27
- getNode,
28
- getUpstream,
29
- getDownstream,
30
- getUnreachableTokens,
31
- snapshot,
32
- restore,
33
- mutateGraph,
34
- validateLiveGraph,
35
- } from '../../src/continuous-event-graph/index.js';
36
- import type { GraphConfig } from '../../src/continuous-event-graph/types.js';
37
-
38
- // ============================================================================
39
- // 1. Bootstrap: define the initial graph
40
- // ============================================================================
41
-
42
- const config: GraphConfig = {
43
- id: 'stock-dashboard',
44
- settings: {
45
- completion: 'manual', // never auto-completes — runs indefinitely
46
- execution_mode: 'eligibility-mode',
47
- },
48
- tasks: {
49
- fetch_prices: {
50
- provides: ['price-data'],
51
- description: 'Fetch live stock prices from market API',
52
- },
53
- fetch_news: {
54
- provides: ['news-data'],
55
- description: 'Fetch latest financial news',
56
- },
57
- compute_indicators: {
58
- requires: ['price-data'],
59
- provides: ['indicators'],
60
- description: 'Compute technical indicators (RSI, MACD, etc.)',
61
- },
62
- sentiment_analysis: {
63
- requires: ['news-data'],
64
- provides: ['sentiment'],
65
- description: 'Run NLP sentiment analysis on news',
66
- },
67
- generate_signals: {
68
- requires: ['indicators', 'sentiment'],
69
- provides: ['trade-signals'],
70
- description: 'Generate buy/sell signals from indicators + sentiment',
71
- },
72
- render_dashboard: {
73
- requires: ['price-data', 'trade-signals'],
74
- provides: ['dashboard-rendered'],
75
- description: 'Render the live dashboard UI',
76
- },
77
- },
78
- };
79
-
80
- let live = createLiveGraph(config);
81
- console.log('=== Initial Graph ===');
82
- console.log('Health:', inspect(live));
83
- console.log('Schedule:', schedule(live));
84
-
85
- // ============================================================================
86
- // 2. Simulate first cycle: fetch data
87
- // ============================================================================
88
-
89
- // fetch_prices and fetch_news have no requires — they're eligible immediately
90
- const sched1 = schedule(live);
91
- console.log('\n=== Eligible tasks:', sched1.eligible);
92
-
93
- // Simulate running fetch_prices
94
- live = applyEvent(live, { type: 'task-started', taskName: 'fetch_prices', timestamp: new Date().toISOString() });
95
- live = applyEvent(live, { type: 'task-completed', taskName: 'fetch_prices', timestamp: new Date().toISOString() });
96
-
97
- // Simulate running fetch_news
98
- live = applyEvent(live, { type: 'task-started', taskName: 'fetch_news', timestamp: new Date().toISOString() });
99
- live = applyEvent(live, { type: 'task-completed', taskName: 'fetch_news', timestamp: new Date().toISOString() });
100
-
101
- console.log('\n=== After data fetched ===');
102
- console.log('Available tokens:', live.state.availableOutputs);
103
- console.log('Schedule:', schedule(live));
104
-
105
- // ============================================================================
106
- // 3. Upstream/downstream analysis
107
- // ============================================================================
108
-
109
- console.log('\n=== Upstream of generate_signals ===');
110
- const upstream = getUpstream(live, 'generate_signals');
111
- console.log('Nodes:', upstream.nodes.map(n => `${n.nodeName} (provides: ${n.providesTokens})`));
112
- console.log('Tokens in chain:', upstream.tokens);
113
-
114
- console.log('\n=== Downstream of fetch_prices ===');
115
- const downstream = getDownstream(live, 'fetch_prices');
116
- console.log('Nodes:', downstream.nodes.map(n => `${n.nodeName} (requires: ${n.requiresTokens})`));
117
- console.log('Tokens in chain:', downstream.tokens);
118
-
119
- // ============================================================================
120
- // 4. Dynamic evolution: add 3 new nodes atomically with mutateGraph
121
- // ============================================================================
122
-
123
- console.log('\n=== Adding social media nodes (batch mutation) ===');
124
- live = mutateGraph(live, [
125
- {
126
- type: 'add-node',
127
- name: 'social_media_feed',
128
- config: {
129
- provides: ['social-data'],
130
- description: 'Fetch social media mentions for sentiment',
131
- },
132
- },
133
- {
134
- type: 'add-node',
135
- name: 'social_sentiment',
136
- config: {
137
- requires: ['social-data'],
138
- provides: ['social-sentiment'],
139
- description: 'Analyze social media sentiment',
140
- },
141
- },
142
- {
143
- type: 'add-node',
144
- name: 'enhanced_signals',
145
- config: {
146
- requires: ['trade-signals', 'social-sentiment'],
147
- provides: ['enhanced-signals'],
148
- description: 'Combine traditional + social signals',
149
- },
150
- },
151
- ]);
152
-
153
- console.log('Health after adding nodes:', inspect(live));
154
- console.log('New downstream of social_media_feed:', getDownstream(live, 'social_media_feed'));
155
-
156
- // ============================================================================
157
- // 5. Token lifecycle: drain stale data + re-inject (batch mutation)
158
- // ============================================================================
159
-
160
- console.log('\n=== Draining stale price-data and re-injecting ===');
161
- live = mutateGraph(live, [
162
- { type: 'drain-tokens', tokens: ['price-data'] },
163
- ]);
164
- console.log('Available tokens after drain:', live.state.availableOutputs);
165
-
166
- // Check what became unreachable
167
- const unreachable = getUnreachableTokens(live);
168
- console.log('Unreachable tokens:', unreachable.tokens.map(t => `${t.token} (${t.reason})`));
169
-
170
- // Re-inject fresh data
171
- live = mutateGraph(live, [
172
- { type: 'inject-tokens', tokens: ['price-data'] },
173
- ]);
174
- console.log('Tokens after re-inject:', live.state.availableOutputs);
175
-
176
- // ============================================================================
177
- // 6. Disable/enable a failing feed (batch mutation)
178
- // ============================================================================
179
-
180
- console.log('\n=== Disabling social_media_feed ===');
181
- live = mutateGraph(live, [
182
- { type: 'disable-node', name: 'social_media_feed' },
183
- ]);
184
- console.log('Node info:', getNode(live, 'social_media_feed'));
185
-
186
- // Check impact
187
- const impacted = getDownstream(live, 'social_media_feed');
188
- console.log('Downstream impact:', impacted.nodes.map(n => n.nodeName));
189
-
190
- // Re-enable after fix
191
- live = mutateGraph(live, [
192
- { type: 'enable-node', name: 'social_media_feed' },
193
- ]);
194
- console.log('Re-enabled:', getNode(live, 'social_media_feed')?.state.status);
195
-
196
- // ============================================================================
197
- // 7. Snapshot & restore (persistence)
198
- // ============================================================================
199
-
200
- console.log('\n=== Snapshot ===');
201
- const snap = snapshot(live);
202
- console.log('Snapshot version:', snap.version, 'at:', snap.snapshotAt);
203
-
204
- // Simulate restore (e.g. after process restart)
205
- const restored = restore(snap);
206
- console.log('Restored graph tasks:', Object.keys(restored.config.tasks));
207
- console.log('Restored available outputs:', restored.state.availableOutputs);
208
-
209
- // ============================================================================
210
- // 8. Remove a node cleanly
211
- // ============================================================================
212
-
213
- console.log('\n=== Removing enhanced_signals node ===');
214
- live = removeNode(live, 'enhanced_signals');
215
- console.log('Tasks after removal:', Object.keys(live.config.tasks));
216
-
217
- console.log('\n=== Final Health ===');
218
- console.log(inspect(live));
219
-
220
- // ============================================================================
221
- // 9. Validate — runtime state-consistency check
222
- // ============================================================================
223
-
224
- console.log('\n=== Validation ===');
225
- const validation = validateLiveGraph(live);
226
- console.log(` Valid: ${validation.valid} (${validation.issues.length} issues)`);
227
- for (const issue of validation.issues) {
228
- console.log(` [${issue.severity}] ${issue.code}: ${issue.message}`);
229
- }