yaml-flow 3.1.1 → 5.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 (194) hide show
  1. package/README.md +81 -20
  2. package/board-live-cards-cli.js +37 -0
  3. package/browser/board-livegraph-runtime.js +1453 -0
  4. package/browser/board-livegraph-runtime.js.map +1 -0
  5. package/browser/card-compute.js +153 -433
  6. package/browser/live-cards.js +868 -115
  7. package/browser/live-cards.schema.json +90 -83
  8. package/dist/board-livegraph-runtime/index.cjs +1448 -0
  9. package/dist/board-livegraph-runtime/index.cjs.map +1 -0
  10. package/dist/board-livegraph-runtime/index.d.cts +101 -0
  11. package/dist/board-livegraph-runtime/index.d.ts +101 -0
  12. package/dist/board-livegraph-runtime/index.js +1441 -0
  13. package/dist/board-livegraph-runtime/index.js.map +1 -0
  14. package/dist/card-compute/index.cjs +266 -431
  15. package/dist/card-compute/index.cjs.map +1 -1
  16. package/dist/card-compute/index.d.cts +77 -49
  17. package/dist/card-compute/index.d.ts +77 -49
  18. package/dist/card-compute/index.js +263 -432
  19. package/dist/card-compute/index.js.map +1 -1
  20. package/dist/cli/board-live-cards-cli.cjs +2750 -0
  21. package/dist/cli/board-live-cards-cli.cjs.map +1 -0
  22. package/dist/cli/board-live-cards-cli.d.cts +205 -0
  23. package/dist/cli/board-live-cards-cli.d.ts +205 -0
  24. package/dist/cli/board-live-cards-cli.js +2702 -0
  25. package/dist/cli/board-live-cards-cli.js.map +1 -0
  26. package/dist/{constants-B2zqu10b.d.ts → constants-DuzE5n03.d.ts} +2 -2
  27. package/dist/{constants-DJZU1pwJ.d.cts → constants-ozjf1Ejw.d.cts} +2 -2
  28. package/dist/continuous-event-graph/index.cjs +258 -464
  29. package/dist/continuous-event-graph/index.cjs.map +1 -1
  30. package/dist/continuous-event-graph/index.d.cts +18 -358
  31. package/dist/continuous-event-graph/index.d.ts +18 -358
  32. package/dist/continuous-event-graph/index.js +255 -464
  33. package/dist/continuous-event-graph/index.js.map +1 -1
  34. package/dist/event-graph/index.cjs +4 -4
  35. package/dist/event-graph/index.cjs.map +1 -1
  36. package/dist/event-graph/index.d.cts +5 -5
  37. package/dist/event-graph/index.d.ts +5 -5
  38. package/dist/event-graph/index.js +4 -4
  39. package/dist/event-graph/index.js.map +1 -1
  40. package/dist/index.cjs +1684 -555
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +26 -7
  43. package/dist/index.d.ts +26 -7
  44. package/dist/index.js +1678 -555
  45. package/dist/index.js.map +1 -1
  46. package/dist/inference/index.cjs +138 -19
  47. package/dist/inference/index.cjs.map +1 -1
  48. package/dist/inference/index.d.cts +2 -2
  49. package/dist/inference/index.d.ts +2 -2
  50. package/dist/inference/index.js +138 -19
  51. package/dist/inference/index.js.map +1 -1
  52. package/dist/journal-DRfJiheM.d.cts +28 -0
  53. package/dist/journal-NLYuqege.d.ts +28 -0
  54. package/dist/live-cards-bridge-Or7fdEJV.d.ts +316 -0
  55. package/dist/live-cards-bridge-vGJ6tMzN.d.cts +316 -0
  56. package/dist/schedule-CMcZe5Ny.d.ts +21 -0
  57. package/dist/schedule-CiucyCan.d.cts +21 -0
  58. package/dist/step-machine/index.cjs +18 -1
  59. package/dist/step-machine/index.cjs.map +1 -1
  60. package/dist/step-machine/index.d.cts +2 -2
  61. package/dist/step-machine/index.d.ts +2 -2
  62. package/dist/step-machine/index.js +18 -1
  63. package/dist/step-machine/index.js.map +1 -1
  64. package/dist/stores/file.d.cts +1 -1
  65. package/dist/stores/file.d.ts +1 -1
  66. package/dist/stores/index.d.cts +1 -1
  67. package/dist/stores/index.d.ts +1 -1
  68. package/dist/stores/localStorage.d.cts +1 -1
  69. package/dist/stores/localStorage.d.ts +1 -1
  70. package/dist/stores/memory.d.cts +1 -1
  71. package/dist/stores/memory.d.ts +1 -1
  72. package/dist/{types-BwvgvlOO.d.cts → types-BzLD8bjb.d.cts} +1 -1
  73. package/dist/{types-ClRA8hzC.d.ts → types-C2eJ7DAV.d.ts} +1 -1
  74. package/dist/{types-DEj7OakX.d.cts → types-CMFSIjpc.d.cts} +39 -4
  75. package/dist/{types-DEj7OakX.d.ts → types-CMFSIjpc.d.ts} +39 -4
  76. package/dist/{types-FZ_eyErS.d.cts → types-ycun84cq.d.cts} +1 -0
  77. package/dist/{types-FZ_eyErS.d.ts → types-ycun84cq.d.ts} +1 -0
  78. package/dist/{validate-DEZ2Ymdb.d.ts → validate-DJQTQ6bP.d.ts} +1 -1
  79. package/dist/{validate-DqKTZg_o.d.cts → validate-ke92Cleg.d.cts} +1 -1
  80. package/examples/browser/boards/portfolio-tracker/cards/holdings-table.json +22 -0
  81. package/examples/browser/boards/portfolio-tracker/cards/portfolio-form.json +16 -0
  82. package/examples/browser/boards/portfolio-tracker/cards/portfolio-value.json +15 -0
  83. package/examples/browser/boards/portfolio-tracker/cards/price-fetch.json +15 -0
  84. package/examples/browser/boards/portfolio-tracker/fetch-prices.js +43 -0
  85. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
  86. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.bat +7 -0
  87. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +217 -0
  88. package/examples/browser/livecards-browser/index.html +41 -0
  89. package/examples/browser/{index.html → step-machine-browser/index.html} +53 -53
  90. package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +22 -0
  91. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +43 -0
  92. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +15 -0
  93. package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +15 -0
  94. package/examples/cli/step-machine-cli/portfolio-tracker/fetch-prices.js +48 -0
  95. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +58 -0
  96. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +27 -0
  97. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +25 -0
  98. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +29 -0
  99. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +27 -0
  100. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/status-cli.js +25 -0
  101. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +37 -0
  102. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +53 -0
  103. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +35 -0
  104. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +227 -0
  105. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +38 -0
  106. package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +29 -0
  107. package/examples/cli/step-machine-demo/jsonata-init-board-cli.js +36 -0
  108. package/examples/cli/step-machine-demo/jsonata-init-board.flow.yaml +30 -0
  109. package/examples/cli/step-machine-demo/one-step-cli-only.flow.yaml +19 -0
  110. package/examples/cli/step-machine-demo/step-cli-echo-y.js +15 -0
  111. package/examples/cli/step-machine-demo/step2-double-cli.js +39 -0
  112. package/examples/cli/step-machine-demo/two-step-math-handlers.js +32 -0
  113. package/examples/cli/step-machine-demo/two-step-math.flow.yaml +31 -0
  114. package/examples/cli/step-machine-demo/two-step-mixed-handlers.js +24 -0
  115. package/examples/cli/step-machine-demo/two-step-mixed.flow.yaml +35 -0
  116. package/examples/example-board/board.yaml +23 -0
  117. package/examples/example-board/bootstrap_payload.json +1 -0
  118. package/examples/example-board/cards/card-chain-region-alert.json +39 -0
  119. package/examples/example-board/cards/card-chain-region-totals.json +26 -0
  120. package/examples/example-board/cards/card-chain-top-region.json +24 -0
  121. package/examples/example-board/cards/card-ex-actions.json +32 -0
  122. package/examples/example-board/cards/card-ex-chart.json +30 -0
  123. package/examples/example-board/cards/card-ex-filter.json +36 -0
  124. package/examples/example-board/cards/card-ex-filtered-by-preference.json +59 -0
  125. package/examples/example-board/cards/card-ex-form.json +91 -0
  126. package/examples/example-board/cards/card-ex-list.json +22 -0
  127. package/examples/example-board/cards/card-ex-markdown.json +17 -0
  128. package/examples/example-board/cards/card-ex-metric.json +19 -0
  129. package/examples/example-board/cards/card-ex-narrative.json +36 -0
  130. package/examples/example-board/cards/card-ex-source-http.json +28 -0
  131. package/examples/example-board/cards/card-ex-source.json +21 -0
  132. package/examples/example-board/cards/card-ex-status.json +35 -0
  133. package/examples/example-board/cards/card-ex-table.json +30 -0
  134. package/examples/example-board/cards/card-ex-todo.json +29 -0
  135. package/examples/example-board/demo-chat-handler.js +69 -0
  136. package/examples/example-board/demo-server.js +87 -0
  137. package/examples/example-board/demo-shell-browser.html +806 -0
  138. package/examples/example-board/demo-shell-with-server.html +280 -0
  139. package/examples/example-board/demo-shell.html +62 -0
  140. package/examples/example-board/demo-task-executor.js +255 -0
  141. package/examples/example-board/mock.db +15 -0
  142. package/examples/example-board/reusable-board-runtime-client.js +265 -0
  143. package/examples/example-board/reusable-runtime-artifacts-adapter.js +233 -0
  144. package/examples/example-board/reusable-server-runtime.js +1284 -0
  145. package/examples/index.html +799 -0
  146. package/examples/{batch → npm-libs/batch}/batch-step-machine.ts +1 -1
  147. package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/live-cards-board.ts +18 -18
  148. package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/live-portfolio-dashboard.ts +24 -24
  149. package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/portfolio-tracker.ts +1 -1
  150. package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/reactive-monitoring.ts +1 -1
  151. package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/reactive-pipeline.ts +1 -1
  152. package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/soc-incident-board.ts +1 -1
  153. package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/stock-dashboard.ts +1 -1
  154. package/examples/{event-graph → npm-libs/event-graph}/ci-cd-pipeline.ts +1 -1
  155. package/examples/{event-graph → npm-libs/event-graph}/executor-diamond.ts +1 -1
  156. package/examples/{event-graph → npm-libs/event-graph}/executor-pipeline.ts +1 -1
  157. package/examples/{event-graph → npm-libs/event-graph}/research-pipeline.ts +1 -1
  158. package/examples/{graph-of-graphs → npm-libs/graph-of-graphs}/multi-stage-etl.ts +1 -1
  159. package/examples/{graph-of-graphs → npm-libs/graph-of-graphs}/url-processing-pipeline.ts +1 -1
  160. package/examples/{inference → npm-libs/inference}/azure-deployment.ts +1 -1
  161. package/examples/{inference → npm-libs/inference}/copilot-cli.ts +1 -1
  162. package/examples/{inference → npm-libs/inference}/data-pipeline.ts +1 -1
  163. package/examples/{inference → npm-libs/inference}/pluggable-adapters.ts +1 -1
  164. package/examples/{node → npm-libs/node}/ai-conversation.ts +1 -1
  165. package/examples/{node → npm-libs/node}/simple-greeting.ts +2 -2
  166. package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +22 -0
  167. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +43 -0
  168. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +15 -0
  169. package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +15 -0
  170. package/examples/step-machine-cli/portfolio-tracker/fetch-prices.js +48 -0
  171. package/examples/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +58 -0
  172. package/examples/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +27 -0
  173. package/examples/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +25 -0
  174. package/examples/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +29 -0
  175. package/examples/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +27 -0
  176. package/examples/step-machine-cli/portfolio-tracker/handlers/status-cli.js +25 -0
  177. package/examples/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +37 -0
  178. package/examples/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +53 -0
  179. package/examples/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +35 -0
  180. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
  181. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +227 -0
  182. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +38 -0
  183. package/examples/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +29 -0
  184. package/package.json +27 -2
  185. package/schema/board-status.schema.json +118 -0
  186. package/schema/card-runtime.schema.json +25 -0
  187. package/schema/flow.schema.json +5 -0
  188. package/schema/live-cards.schema.json +90 -83
  189. package/step-machine-cli.js +674 -0
  190. package/browser/ingest-board.js +0 -296
  191. package/examples/ingest.js +0 -733
  192. /package/examples/{flows → npm-libs/flows}/ai-conversation.yaml +0 -0
  193. /package/examples/{flows → npm-libs/flows}/order-processing.yaml +0 -0
  194. /package/examples/{flows → npm-libs/flows}/simple-greeting.yaml +0 -0
@@ -1,4 +1,4 @@
1
- import { l as StepMachineStore, k as StepMachineState } from '../types-FZ_eyErS.cjs';
1
+ import { l as StepMachineStore, k as StepMachineState } from '../types-ycun84cq.cjs';
2
2
 
3
3
  /**
4
4
  * yaml-flow - File Store
@@ -1,4 +1,4 @@
1
- import { l as StepMachineStore, k as StepMachineState } from '../types-FZ_eyErS.js';
1
+ import { l as StepMachineStore, k as StepMachineState } from '../types-ycun84cq.js';
2
2
 
3
3
  /**
4
4
  * yaml-flow - File Store
@@ -1,4 +1,4 @@
1
1
  export { MemoryStore } from './memory.cjs';
2
2
  export { LocalStorageStore } from './localStorage.cjs';
3
3
  export { FileStore } from './file.cjs';
4
- import '../types-FZ_eyErS.cjs';
4
+ import '../types-ycun84cq.cjs';
@@ -1,4 +1,4 @@
1
1
  export { MemoryStore } from './memory.js';
2
2
  export { LocalStorageStore } from './localStorage.js';
3
3
  export { FileStore } from './file.js';
4
- import '../types-FZ_eyErS.js';
4
+ import '../types-ycun84cq.js';
@@ -1,4 +1,4 @@
1
- import { l as StepMachineStore, k as StepMachineState } from '../types-FZ_eyErS.cjs';
1
+ import { l as StepMachineStore, k as StepMachineState } from '../types-ycun84cq.cjs';
2
2
 
3
3
  /**
4
4
  * yaml-flow - LocalStorage Store
@@ -1,4 +1,4 @@
1
- import { l as StepMachineStore, k as StepMachineState } from '../types-FZ_eyErS.js';
1
+ import { l as StepMachineStore, k as StepMachineState } from '../types-ycun84cq.js';
2
2
 
3
3
  /**
4
4
  * yaml-flow - LocalStorage Store
@@ -1,4 +1,4 @@
1
- import { l as StepMachineStore, k as StepMachineState } from '../types-FZ_eyErS.cjs';
1
+ import { l as StepMachineStore, k as StepMachineState } from '../types-ycun84cq.cjs';
2
2
 
3
3
  /**
4
4
  * yaml-flow - Memory Store
@@ -1,4 +1,4 @@
1
- import { l as StepMachineStore, k as StepMachineState } from '../types-FZ_eyErS.js';
1
+ import { l as StepMachineStore, k as StepMachineState } from '../types-ycun84cq.js';
2
2
 
3
3
  /**
4
4
  * yaml-flow - Memory Store
@@ -1,4 +1,4 @@
1
- import { G as GraphConfig, c as ExecutionState, T as TaskConfig, e as GraphEngineStore } from './types-DEj7OakX.cjs';
1
+ import { G as GraphConfig, c as ExecutionState, T as TaskConfig, e as GraphEngineStore } from './types-CMFSIjpc.cjs';
2
2
 
3
3
  /**
4
4
  * Continuous Event Graph — Types
@@ -1,4 +1,4 @@
1
- import { G as GraphConfig, c as ExecutionState, T as TaskConfig, e as GraphEngineStore } from './types-DEj7OakX.js';
1
+ import { G as GraphConfig, c as ExecutionState, T as TaskConfig, e as GraphEngineStore } from './types-CMFSIjpc.js';
2
2
 
3
3
  /**
4
4
  * Continuous Event Graph — Types
@@ -134,7 +134,7 @@ interface StuckDetection {
134
134
  outputs_unresolvable: string[];
135
135
  tasks_blocked: string[];
136
136
  }
137
- type GraphEvent = TaskStartedEvent | TaskCompletedEvent | TaskFailedEvent | TaskProgressEvent | TaskRestartEvent | InjectTokensEvent | AgentActionEvent | TaskCreationEvent;
137
+ type GraphEvent = TaskStartedEvent | TaskCompletedEvent | TaskFailedEvent | TaskProgressEvent | TaskRestartEvent | InjectTokensEvent | AgentActionEvent | TaskUpsertEvent | TaskRemovalEvent | NodeRequiresAddEvent | NodeRequiresRemoveEvent | NodeProvidesAddEvent | NodeProvidesRemoveEvent;
138
138
  interface TaskStartedEvent {
139
139
  type: 'task-started';
140
140
  taskName: string;
@@ -165,6 +165,12 @@ interface TaskProgressEvent {
165
165
  taskName: string;
166
166
  message?: string;
167
167
  progress?: number;
168
+ /**
169
+ * Arbitrary update payload — used by source delivery to carry
170
+ * { bindTo, fetchedAt, dest } or { bindTo, failure, reason }.
171
+ * card-handler receives this via TaskHandlerInput.update.
172
+ */
173
+ update?: Record<string, unknown>;
168
174
  timestamp: string;
169
175
  executionId?: string;
170
176
  }
@@ -185,12 +191,41 @@ interface AgentActionEvent {
185
191
  timestamp: string;
186
192
  config?: Partial<ExecutionConfig>;
187
193
  }
188
- interface TaskCreationEvent {
189
- type: 'task-creation';
194
+ interface TaskUpsertEvent {
195
+ type: 'task-upsert';
190
196
  taskName: string;
191
197
  taskConfig: TaskConfig;
192
198
  timestamp: string;
193
199
  }
200
+ interface TaskRemovalEvent {
201
+ type: 'task-removal';
202
+ taskName: string;
203
+ timestamp: string;
204
+ }
205
+ interface NodeRequiresAddEvent {
206
+ type: 'node-requires-add';
207
+ nodeName: string;
208
+ tokens: string[];
209
+ timestamp: string;
210
+ }
211
+ interface NodeRequiresRemoveEvent {
212
+ type: 'node-requires-remove';
213
+ nodeName: string;
214
+ tokens: string[];
215
+ timestamp: string;
216
+ }
217
+ interface NodeProvidesAddEvent {
218
+ type: 'node-provides-add';
219
+ nodeName: string;
220
+ tokens: string[];
221
+ timestamp: string;
222
+ }
223
+ interface NodeProvidesRemoveEvent {
224
+ type: 'node-provides-remove';
225
+ nodeName: string;
226
+ tokens: string[];
227
+ timestamp: string;
228
+ }
194
229
  interface SchedulerResult {
195
230
  /** Tasks eligible for execution */
196
231
  eligibleTasks: string[];
@@ -214,4 +249,4 @@ type ExecutionMode = 'dependency-mode' | 'eligibility-mode';
214
249
  type ConflictStrategy = 'alphabetical' | 'priority-first' | 'duration-first' | 'cost-optimized' | 'resource-aware' | 'random-select' | 'user-choice' | 'parallel-all' | 'skip-conflicts' | 'round-robin';
215
250
  type RefreshStrategy = 'data-changed' | 'epoch-changed' | 'time-based' | 'manual' | 'once';
216
251
 
217
- export type { AgentActionEvent as A, CompletionStrategy as C, ExecutionConfig as E, GraphConfig as G, InjectTokensEvent as I, RefreshStrategy as R, SchedulerResult as S, TaskConfig as T, ConflictStrategy as a, ExecutionMode as b, ExecutionState as c, ExecutionStatus as d, GraphEngineStore as e, GraphEvent as f, GraphSettings as g, StuckDetection as h, TaskCompletedEvent as i, TaskCreationEvent as j, TaskFailedEvent as k, TaskStartedEvent as l, TaskStatus as m, TaskCircuitBreakerConfig as n, TaskMessage as o, TaskProgressEvent as p, TaskRestartEvent as q, TaskRetryConfig as r };
252
+ export type { AgentActionEvent as A, CompletionStrategy as C, ExecutionConfig as E, GraphConfig as G, InjectTokensEvent as I, RefreshStrategy as R, SchedulerResult as S, TaskConfig as T, ConflictStrategy as a, ExecutionMode as b, ExecutionState as c, ExecutionStatus as d, GraphEngineStore as e, GraphEvent as f, GraphSettings as g, StuckDetection as h, TaskCompletedEvent as i, TaskFailedEvent as j, TaskStartedEvent as k, TaskStatus as l, TaskCircuitBreakerConfig as m, TaskMessage as n, TaskProgressEvent as o, TaskRestartEvent as p, TaskRetryConfig as q };
@@ -134,7 +134,7 @@ interface StuckDetection {
134
134
  outputs_unresolvable: string[];
135
135
  tasks_blocked: string[];
136
136
  }
137
- type GraphEvent = TaskStartedEvent | TaskCompletedEvent | TaskFailedEvent | TaskProgressEvent | TaskRestartEvent | InjectTokensEvent | AgentActionEvent | TaskCreationEvent;
137
+ type GraphEvent = TaskStartedEvent | TaskCompletedEvent | TaskFailedEvent | TaskProgressEvent | TaskRestartEvent | InjectTokensEvent | AgentActionEvent | TaskUpsertEvent | TaskRemovalEvent | NodeRequiresAddEvent | NodeRequiresRemoveEvent | NodeProvidesAddEvent | NodeProvidesRemoveEvent;
138
138
  interface TaskStartedEvent {
139
139
  type: 'task-started';
140
140
  taskName: string;
@@ -165,6 +165,12 @@ interface TaskProgressEvent {
165
165
  taskName: string;
166
166
  message?: string;
167
167
  progress?: number;
168
+ /**
169
+ * Arbitrary update payload — used by source delivery to carry
170
+ * { bindTo, fetchedAt, dest } or { bindTo, failure, reason }.
171
+ * card-handler receives this via TaskHandlerInput.update.
172
+ */
173
+ update?: Record<string, unknown>;
168
174
  timestamp: string;
169
175
  executionId?: string;
170
176
  }
@@ -185,12 +191,41 @@ interface AgentActionEvent {
185
191
  timestamp: string;
186
192
  config?: Partial<ExecutionConfig>;
187
193
  }
188
- interface TaskCreationEvent {
189
- type: 'task-creation';
194
+ interface TaskUpsertEvent {
195
+ type: 'task-upsert';
190
196
  taskName: string;
191
197
  taskConfig: TaskConfig;
192
198
  timestamp: string;
193
199
  }
200
+ interface TaskRemovalEvent {
201
+ type: 'task-removal';
202
+ taskName: string;
203
+ timestamp: string;
204
+ }
205
+ interface NodeRequiresAddEvent {
206
+ type: 'node-requires-add';
207
+ nodeName: string;
208
+ tokens: string[];
209
+ timestamp: string;
210
+ }
211
+ interface NodeRequiresRemoveEvent {
212
+ type: 'node-requires-remove';
213
+ nodeName: string;
214
+ tokens: string[];
215
+ timestamp: string;
216
+ }
217
+ interface NodeProvidesAddEvent {
218
+ type: 'node-provides-add';
219
+ nodeName: string;
220
+ tokens: string[];
221
+ timestamp: string;
222
+ }
223
+ interface NodeProvidesRemoveEvent {
224
+ type: 'node-provides-remove';
225
+ nodeName: string;
226
+ tokens: string[];
227
+ timestamp: string;
228
+ }
194
229
  interface SchedulerResult {
195
230
  /** Tasks eligible for execution */
196
231
  eligibleTasks: string[];
@@ -214,4 +249,4 @@ type ExecutionMode = 'dependency-mode' | 'eligibility-mode';
214
249
  type ConflictStrategy = 'alphabetical' | 'priority-first' | 'duration-first' | 'cost-optimized' | 'resource-aware' | 'random-select' | 'user-choice' | 'parallel-all' | 'skip-conflicts' | 'round-robin';
215
250
  type RefreshStrategy = 'data-changed' | 'epoch-changed' | 'time-based' | 'manual' | 'once';
216
251
 
217
- export type { AgentActionEvent as A, CompletionStrategy as C, ExecutionConfig as E, GraphConfig as G, InjectTokensEvent as I, RefreshStrategy as R, SchedulerResult as S, TaskConfig as T, ConflictStrategy as a, ExecutionMode as b, ExecutionState as c, ExecutionStatus as d, GraphEngineStore as e, GraphEvent as f, GraphSettings as g, StuckDetection as h, TaskCompletedEvent as i, TaskCreationEvent as j, TaskFailedEvent as k, TaskStartedEvent as l, TaskStatus as m, TaskCircuitBreakerConfig as n, TaskMessage as o, TaskProgressEvent as p, TaskRestartEvent as q, TaskRetryConfig as r };
252
+ export type { AgentActionEvent as A, CompletionStrategy as C, ExecutionConfig as E, GraphConfig as G, InjectTokensEvent as I, RefreshStrategy as R, SchedulerResult as S, TaskConfig as T, ConflictStrategy as a, ExecutionMode as b, ExecutionState as c, ExecutionStatus as d, GraphEngineStore as e, GraphEvent as f, GraphSettings as g, StuckDetection as h, TaskCompletedEvent as i, TaskFailedEvent as j, TaskStartedEvent as k, TaskStatus as l, TaskCircuitBreakerConfig as m, TaskMessage as n, TaskProgressEvent as o, TaskRestartEvent as p, TaskRetryConfig as q };
@@ -21,6 +21,7 @@ interface StepConfig {
21
21
  expects_data?: string[];
22
22
  produces_data?: string[];
23
23
  transitions: Record<string, string>;
24
+ failure_transitions?: Record<string, string>;
24
25
  retry?: RetryConfig;
25
26
  circuit_breaker?: CircuitBreakerConfig;
26
27
  }
@@ -21,6 +21,7 @@ interface StepConfig {
21
21
  expects_data?: string[];
22
22
  produces_data?: string[];
23
23
  transitions: Record<string, string>;
24
+ failure_transitions?: Record<string, string>;
24
25
  retry?: RetryConfig;
25
26
  circuit_breaker?: CircuitBreakerConfig;
26
27
  }
@@ -1,4 +1,4 @@
1
- import { G as GraphConfig } from './types-DEj7OakX.js';
1
+ import { G as GraphConfig } from './types-CMFSIjpc.js';
2
2
 
3
3
  /**
4
4
  * Event Graph — Semantic Graph Validation
@@ -1,4 +1,4 @@
1
- import { G as GraphConfig } from './types-DEj7OakX.cjs';
1
+ import { G as GraphConfig } from './types-CMFSIjpc.cjs';
2
2
 
3
3
  /**
4
4
  * Event Graph — Semantic Graph Validation
@@ -0,0 +1,22 @@
1
+ {
2
+ "id": "holdings-table",
3
+ "meta": { "title": "Holdings Table" },
4
+ "requires": ["holdings", "prices"],
5
+ "provides": [{ "bindTo": "table", "src": "computed_values.table" }],
6
+ "card_data": {},
7
+ "compute": [
8
+ {
9
+ "bindTo": "table",
10
+ "expr": "{ \"rows\": $map(requires.holdings, function($h) { { \"symbol\": $h.symbol, \"qty\": $h.qty, \"price\": $lookup(requires.prices, $h.symbol), \"value\": $h.qty * $lookup(requires.prices, $h.symbol) } }) }"
11
+ }
12
+ ],
13
+ "view": {
14
+ "elements": [
15
+ {
16
+ "kind": "table",
17
+ "label": "Portfolio Positions",
18
+ "data": { "bind": "computed_values.table.rows", "columns": ["symbol", "qty", "price", "value"] }
19
+ }
20
+ ]
21
+ }
22
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "portfolio-form",
3
+ "meta": { "title": "Portfolio Holdings Form" },
4
+ "provides": [{ "bindTo": "holdings", "src": "card_data.holdings" }],
5
+ "card_data": {
6
+ "holdings": [
7
+ { "symbol": "AAPL", "qty": 50 },
8
+ { "symbol": "MSFT", "qty": 30 }
9
+ ]
10
+ },
11
+ "view": {
12
+ "elements": [
13
+ { "kind": "table", "label": "Holdings", "data": { "bind": "card_data.holdings", "columns": ["symbol", "qty"] } }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "id": "portfolio-value",
3
+ "meta": { "title": "Portfolio Total Value" },
4
+ "requires": ["table"],
5
+ "provides": [{ "bindTo": "totalValue", "src": "computed_values.totalValue" }],
6
+ "card_data": {},
7
+ "compute": [
8
+ { "bindTo": "totalValue", "expr": "$sum(requires.table.rows.value)" }
9
+ ],
10
+ "view": {
11
+ "elements": [
12
+ { "kind": "metric", "label": "Total Portfolio Value", "data": { "bind": "computed_values.totalValue" } }
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "id": "price-fetch",
3
+ "meta": { "title": "Fetch Market Prices" },
4
+ "requires": ["holdings"],
5
+ "provides": [{ "bindTo": "prices", "src": "fetched_sources.prices" }],
6
+ "card_data": {},
7
+ "sources": [
8
+ { "cli": "node ../fetch-prices.js", "bindTo": "prices", "outputFile": "prices.json" }
9
+ ],
10
+ "view": {
11
+ "elements": [
12
+ { "kind": "table", "label": "Market Prices", "data": { "bind": "fetched_sources.prices" } }
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * fetch-prices.js
3
+ * Polls for tmp_file1 payload and outputs JSON to stdout once available.
4
+ */
5
+ import * as fs from 'node:fs';
6
+ import * as path from 'node:path';
7
+
8
+ const envBoardDir = (process.env.BOARD_DIR ?? '').trim();
9
+ const tmpFileCandidates = [
10
+ envBoardDir ? path.join(envBoardDir, 'tmp_file1') : '',
11
+ path.join(process.cwd(), 'tmp_file1'),
12
+ path.join(process.cwd(), 'board-runtime', 'tmp_file1'),
13
+ path.join(process.cwd(), '..', 'board-runtime', 'tmp_file1'),
14
+ ].filter(Boolean);
15
+
16
+ function getReadableTmpFile() {
17
+ for (const tmpFile of tmpFileCandidates) {
18
+ if (!fs.existsSync(tmpFile)) continue;
19
+ const content = fs.readFileSync(tmpFile, 'utf-8').trim();
20
+ if (content) return { tmpFile, content };
21
+ }
22
+ return undefined;
23
+ }
24
+
25
+ function waitForFile(timeoutMs = 120000) {
26
+ const started = Date.now();
27
+ const interval = setInterval(() => {
28
+ if (Date.now() - started > timeoutMs) {
29
+ clearInterval(interval);
30
+ console.error('Timed out waiting for tmp_file1 market prices input.');
31
+ process.exit(1);
32
+ }
33
+
34
+ const ready = getReadableTmpFile();
35
+ if (!ready) return;
36
+
37
+ clearInterval(interval);
38
+ fs.writeFileSync(ready.tmpFile, '', 'utf-8');
39
+ process.stdout.write(`${ready.content}\n`);
40
+ }, 250);
41
+ }
42
+
43
+ waitForFile();
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Portfolio Tracker Task-Executor
4
+ *
5
+ * Implements the run-source-fetch protocol for board-live-cards.
6
+ * This script acts as an external task-executor that can be registered via .task-executor file.
7
+ *
8
+ * Contract:
9
+ * portfolio-tracker-task-executor.js run-source-fetch --in <defFile> --out <resultFile> --err <errFile>
10
+ *
11
+ * Input (--in file):
12
+ * JSON source definition with { cli: "...", bindTo: "...", outputFile: "...", ... }
13
+ *
14
+ * Output (on success):
15
+ * --out file contains the execution result
16
+ * Exit code: 0
17
+ *
18
+ * Output (on error):
19
+ * --err file contains error message
20
+ * Exit code: 1
21
+ */
22
+
23
+ const fs = require('fs');
24
+ const path = require('path');
25
+ const { execSync } = require('child_process');
26
+
27
+ // Parse command line arguments
28
+ const args = process.argv.slice(2);
29
+ let subcommand = '';
30
+ let inFile = '';
31
+ let outFile = '';
32
+ let errFile = '';
33
+
34
+ for (let i = 0; i < args.length; i++) {
35
+ if (args[i] === 'run-source-fetch') {
36
+ subcommand = 'run-source-fetch';
37
+ } else if (args[i] === '--in' && i + 1 < args.length) {
38
+ inFile = args[i + 1];
39
+ } else if (args[i] === '--out' && i + 1 < args.length) {
40
+ outFile = args[i + 1];
41
+ } else if (args[i] === '--err' && i + 1 < args.length) {
42
+ errFile = args[i + 1];
43
+ }
44
+ }
45
+
46
+ if (subcommand !== 'run-source-fetch' || !inFile || !outFile || !errFile) {
47
+ console.error('Usage: portfolio-tracker-task-executor.js run-source-fetch --in <defFile> --out <resultFile> --err <errFile>');
48
+ process.exit(1);
49
+ }
50
+
51
+ try {
52
+ // 1. Read source definition from --in file
53
+ console.log(`[portfolio-tracker-task-executor] Reading source definition from ${inFile}`);
54
+ const sourceDefStr = fs.readFileSync(inFile, 'utf-8');
55
+ const sourceDef = JSON.parse(sourceDefStr);
56
+
57
+ // 2. Extract cli command from source definition
58
+ const { cli: sourceCliCommand } = sourceDef;
59
+ if (!sourceCliCommand) {
60
+ throw new Error('cli is required in source definition');
61
+ }
62
+
63
+ console.log(`[portfolio-tracker-task-executor] Executing: ${sourceCliCommand}`);
64
+
65
+ // 3. Execute source.cli synchronously and capture output
66
+ let output;
67
+ try {
68
+ output = execSync(sourceCliCommand, {
69
+ encoding: 'utf-8',
70
+ timeout: (sourceDef.timeout ?? 120) * 1000, // Convert to ms
71
+ cwd: sourceDef.cwd,
72
+ shell: true,
73
+ stdio: ['pipe', 'pipe', 'pipe'], // Capture stdout/stderr
74
+ });
75
+ } catch (execErr) {
76
+ // Even on error, try to use what output we got
77
+ output = execErr.stdout || '';
78
+ if (!output) {
79
+ throw new Error(`Command execution failed: ${execErr.message}`);
80
+ }
81
+ }
82
+
83
+ // 4. Write output to --out file
84
+ console.log(`[portfolio-tracker-task-executor] Writing result to ${outFile}`);
85
+ fs.writeFileSync(outFile, output.trim(), 'utf-8');
86
+
87
+ console.log(`[portfolio-tracker-task-executor] Success`);
88
+ process.exit(0);
89
+ } catch (error) {
90
+ // 3a. On error: write error message to --err file and exit non-zero
91
+ const errorMsg = error instanceof Error ? error.message : String(error);
92
+ console.error(`[portfolio-tracker-task-executor] Error:`, errorMsg);
93
+
94
+ fs.writeFileSync(errFile, errorMsg, 'utf-8');
95
+ process.exit(1);
96
+ }
@@ -0,0 +1,7 @@
1
+ @echo off
2
+ setlocal
3
+
4
+ set "BOARD_LIVE_CARDS_NO_SPAWN=1"
5
+ node "%~dp0portfolio-tracker.js"
6
+
7
+ endlocal