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
@@ -0,0 +1,29 @@
1
+ @echo off
2
+ setlocal
3
+ cd /d "%~dp0"
4
+
5
+ set "BOARD_LIVE_CARDS_NO_SPAWN=1"
6
+ set "EXAMPLE_TEMP_ROOT=%TEMP%\yaml-flow-step-machine-portfolio-tracker"
7
+ set "STORE_DIR=%EXAMPLE_TEMP_ROOT%\store"
8
+ set "RUNTIME_ROOT=%EXAMPLE_TEMP_ROOT%\runtime"
9
+
10
+ if /I "%~1"=="pause" goto :pause
11
+ if /I "%~1"=="resume" goto :resume
12
+ if /I "%~1"=="status" goto :status
13
+ goto :run
14
+
15
+ :pause
16
+ node ..\..\..\step-machine-cli.js --store file --store-dir "%STORE_DIR%" --pause
17
+ exit /b %ERRORLEVEL%
18
+
19
+ :resume
20
+ node ..\..\..\step-machine-cli.js portfolio-tracker.flow.yaml --store file --store-dir "%STORE_DIR%" --resume
21
+ exit /b %ERRORLEVEL%
22
+
23
+ :status
24
+ node ..\..\..\step-machine-cli.js --store file --store-dir "%STORE_DIR%" --status
25
+ exit /b %ERRORLEVEL%
26
+
27
+ :run
28
+ node -e "const fs=require('fs');const cp=require('child_process');const raw=JSON.parse(fs.readFileSync('portfolio-tracker.input.json','utf8'));raw.runtime_root=(process.env.RUNTIME_ROOT||'').replace(/\\\\/g,'/');const input=JSON.stringify(raw);const r=cp.spawnSync(process.execPath,['..\\..\\..\\step-machine-cli.js','portfolio-tracker.flow.yaml','--store','file','--store-dir',process.env.STORE_DIR,'--initial-data',input],{stdio:'inherit',windowsHide:true,env:{...process.env,BOARD_LIVE_CARDS_NO_SPAWN:'1'}});process.exit(r.status??1);"
29
+ exit /b %ERRORLEVEL%
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml-flow",
3
- "version": "3.1.1",
3
+ "version": "5.0.0",
4
4
  "description": "Unified workflow engine: step-machine (sequential) + event-graph (stateless DAG) with pluggable storage",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -8,6 +8,10 @@
8
8
  "main": "./dist/index.cjs",
9
9
  "module": "./dist/index.js",
10
10
  "types": "./dist/index.d.ts",
11
+ "bin": {
12
+ "board-live-cards-cli": "./board-live-cards-cli.js",
13
+ "step-machine-cli": "./step-machine-cli.js"
14
+ },
11
15
  "exports": {
12
16
  ".": {
13
17
  "types": "./dist/index.d.ts",
@@ -59,6 +63,11 @@
59
63
  "import": "./dist/continuous-event-graph/index.js",
60
64
  "require": "./dist/continuous-event-graph/index.cjs"
61
65
  },
66
+ "./board-livegraph-runtime": {
67
+ "types": "./dist/board-livegraph-runtime/index.d.ts",
68
+ "import": "./dist/board-livegraph-runtime/index.js",
69
+ "require": "./dist/board-livegraph-runtime/index.cjs"
70
+ },
62
71
  "./inference": {
63
72
  "types": "./dist/inference/index.d.ts",
64
73
  "import": "./dist/inference/index.js",
@@ -68,12 +77,19 @@
68
77
  "types": "./dist/card-compute/index.d.ts",
69
78
  "import": "./dist/card-compute/index.js",
70
79
  "require": "./dist/card-compute/index.cjs"
80
+ },
81
+ "./runtime-artifacts": {
82
+ "types": "./dist/runtime-artifacts/index.d.ts",
83
+ "import": "./dist/runtime-artifacts/index.js",
84
+ "require": "./dist/runtime-artifacts/index.cjs"
71
85
  }
72
86
  },
73
87
  "browser": {
74
88
  "./stores/file": false
75
89
  },
76
90
  "files": [
91
+ "board-live-cards-cli.js",
92
+ "step-machine-cli.js",
77
93
  "dist",
78
94
  "schema",
79
95
  "browser",
@@ -81,21 +97,30 @@
81
97
  ],
82
98
  "scripts": {
83
99
  "build": "tsup",
100
+ "build:browser": "tsup --config tsup.browser.config.ts",
84
101
  "dev": "tsup --watch",
85
102
  "test": "vitest",
86
103
  "test:run": "vitest run",
104
+ "test:example-board": "vitest run tests/examples/example-board.test.ts",
105
+ "check:example-board": "npm run test:example-board && npm run validate:cards -- \"examples/example-board/cards/*.json\"",
106
+ "validate:cards": "tsx scripts/validate-live-cards.ts",
87
107
  "lint": "eslint src/",
88
108
  "typecheck": "tsc --noEmit",
89
- "prepublishOnly": "npm run build"
109
+ "prepublishOnly": "npm run build && npm run build:browser"
90
110
  },
91
111
  "devDependencies": {
92
112
  "@types/node": "^20.10.0",
113
+ "@types/proper-lockfile": "^4.1.4",
93
114
  "tsup": "^8.0.0",
115
+ "tsx": "^4.21.0",
94
116
  "typescript": "^5.3.0",
95
117
  "vitest": "^1.0.0"
96
118
  },
97
119
  "dependencies": {
98
120
  "ajv-formats": "^3.0.1",
121
+ "fast-glob": "^3.3.3",
122
+ "jsonata": "^2.1.0",
123
+ "proper-lockfile": "^4.1.2",
99
124
  "yaml": "^2.3.4"
100
125
  },
101
126
  "optionalDependencies": {
@@ -0,0 +1,118 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://yaml-flow.dev/schema/board-status.schema.json",
4
+ "title": "Board Status Object",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "meta", "summary", "cards"],
8
+ "properties": {
9
+ "schema_version": {
10
+ "type": "string",
11
+ "const": "v1"
12
+ },
13
+ "meta": {
14
+ "type": "object",
15
+ "additionalProperties": false,
16
+ "required": ["board"],
17
+ "properties": {
18
+ "board": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "required": ["path"],
22
+ "properties": {
23
+ "path": { "type": "string" }
24
+ }
25
+ }
26
+ }
27
+ },
28
+ "summary": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": ["card_count", "completed", "eligible", "pending", "blocked", "unresolved"],
32
+ "properties": {
33
+ "card_count": { "type": "integer", "minimum": 0 },
34
+ "completed": { "type": "integer", "minimum": 0 },
35
+ "eligible": { "type": "integer", "minimum": 0 },
36
+ "pending": { "type": "integer", "minimum": 0 },
37
+ "blocked": { "type": "integer", "minimum": 0 },
38
+ "unresolved": { "type": "integer", "minimum": 0 },
39
+ "failed": { "type": "integer", "minimum": 0 },
40
+ "in_progress": { "type": "integer", "minimum": 0 },
41
+ "orphan_cards": { "type": "integer", "minimum": 0 },
42
+ "topology": {
43
+ "type": "object",
44
+ "additionalProperties": false,
45
+ "required": ["edge_count", "max_fan_out_card", "max_fan_out"],
46
+ "properties": {
47
+ "edge_count": { "type": "integer", "minimum": 0 },
48
+ "max_fan_out_card": { "type": ["string", "null"] },
49
+ "max_fan_out": { "type": "integer", "minimum": 0 }
50
+ }
51
+ }
52
+ }
53
+ },
54
+ "cards": {
55
+ "type": "array",
56
+ "items": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "required": [
60
+ "name",
61
+ "status",
62
+ "requires",
63
+ "requires_satisfied",
64
+ "requires_missing",
65
+ "provides_declared",
66
+ "provides_runtime",
67
+ "blocked_by",
68
+ "unblocks",
69
+ "runtime"
70
+ ],
71
+ "properties": {
72
+ "name": { "type": "string" },
73
+ "status": { "type": "string" },
74
+ "error": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "required": ["message"],
78
+ "properties": {
79
+ "message": { "type": "string" },
80
+ "code": { "type": "string" },
81
+ "at": { "type": ["string", "null"] },
82
+ "source": { "type": "string" }
83
+ }
84
+ },
85
+ "requires": { "type": "array", "items": { "type": "string" } },
86
+ "requires_satisfied": { "type": "array", "items": { "type": "string" } },
87
+ "requires_missing": { "type": "array", "items": { "type": "string" } },
88
+ "provides_declared": { "type": "array", "items": { "type": "string" } },
89
+ "provides_runtime": { "type": "array", "items": { "type": "string" } },
90
+ "blocked_by": { "type": "array", "items": { "type": "string" } },
91
+ "unblocks": { "type": "array", "items": { "type": "string" } },
92
+ "runtime": {
93
+ "type": "object",
94
+ "additionalProperties": false,
95
+ "required": [
96
+ "attempt_count",
97
+ "restart_count",
98
+ "in_progress_since",
99
+ "last_transition_at",
100
+ "last_completed_at",
101
+ "last_restarted_at",
102
+ "status_age_ms"
103
+ ],
104
+ "properties": {
105
+ "attempt_count": { "type": "integer", "minimum": 0 },
106
+ "restart_count": { "type": "integer", "minimum": 0 },
107
+ "in_progress_since": { "type": ["string", "null"] },
108
+ "last_transition_at": { "type": ["string", "null"] },
109
+ "last_completed_at": { "type": ["string", "null"] },
110
+ "last_restarted_at": { "type": ["string", "null"] },
111
+ "status_age_ms": { "type": ["integer", "null"], "minimum": 0 }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://yaml-flow.dev/schema/card-runtime.schema.json",
4
+ "title": "Card Runtime Computed Artifact",
5
+ "description": "Published per-card runtime artifact written to runtime-out/cards/<card-id>.computed.json. Contains only values produced by the compute step.",
6
+ "type": "object",
7
+ "required": ["schema_version", "card_id", "computed_values"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "schema_version": {
11
+ "type": "string",
12
+ "const": "v1",
13
+ "description": "Artifact schema version."
14
+ },
15
+ "card_id": {
16
+ "type": "string",
17
+ "description": "The ID of the card this artifact belongs to."
18
+ },
19
+ "computed_values": {
20
+ "type": "object",
21
+ "description": "Key/value map of outputs produced by the card's JSONata compute steps.",
22
+ "additionalProperties": true
23
+ }
24
+ }
25
+ }
@@ -77,6 +77,11 @@
77
77
  "additionalProperties": { "type": "string" },
78
78
  "minProperties": 1
79
79
  },
80
+ "failure_transitions": {
81
+ "type": "object",
82
+ "description": "Mapping of failure-like results (e.g. failure, timeout) -> next step name",
83
+ "additionalProperties": { "type": "string" }
84
+ },
80
85
  "retry": {
81
86
  "$ref": "#/definitions/retry_config"
82
87
  },
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "https://nsreehari.github.io/boards/live-cards.schema.json",
4
- "title": "LiveCards Node Schema",
5
- "description": "Schema for Card and ExternalSource nodes in the LiveCards Board/Canvas engine",
6
4
 
7
5
  "definitions": {
8
6
 
9
7
  "bind_ref": {
10
- "description": "A state path reference, e.g. 'state.raw_quotes' or 'state.compute_vars.total'",
8
+ "description": "A card data path reference, e.g. 'card_data.raw_quotes' or 'requires.upstream'",
11
9
  "type": "string",
12
- "pattern": "^state\\."
10
+ "pattern": "^(card_data|requires|fetched_sources|computed_values)(\\.|$)"
13
11
  },
14
12
 
15
13
  "bind_or_literal": {
@@ -46,7 +44,7 @@
46
44
  ]
47
45
  },
48
46
  "input": {
49
- "description": "state.path, literal, array of inputs, or nested compute_expr",
47
+ "description": "card_data.path, literal, array of inputs, or nested compute_expr",
50
48
  "oneOf": [
51
49
  { "type": "string" },
52
50
  { "type": "number" },
@@ -72,39 +70,46 @@
72
70
  }
73
71
  },
74
72
 
75
- "data": {
73
+ "requires": {
74
+ "type": "array",
75
+ "items": { "type": "string" },
76
+ "description": "IDs of upstream nodes this node depends on"
77
+ },
78
+
79
+ "provides": {
80
+ "type": "array",
81
+ "items": {
82
+ "type": "object",
83
+ "required": ["bindTo", "src"],
84
+ "properties": {
85
+ "bindTo": { "type": "string", "description": "Token name published downstream" },
86
+ "src": { "type": "string", "description": "Path to read value from (card_data.*, requires.*, fetched_sources.*, computed_values.*)" }
87
+ }
88
+ },
89
+ "description": "Explicit bindings exposing computed or card_data values downstream as named tokens"
90
+ },
91
+
92
+ "compute_step": {
93
+ "description": "A single ordered compute step: reads card_data.*/requires.*/computed_values.*, writes to computed_values[bindTo]",
76
94
  "type": "object",
95
+ "required": ["bindTo", "expr"],
77
96
  "properties": {
78
- "requires": {
79
- "type": "array",
80
- "items": { "type": "string" },
81
- "description": "IDs of upstream nodes this node depends on"
82
- },
83
- "provides": {
84
- "type": "object",
85
- "description": "Subset of state exposed downstream. Keys are published names, values are bind refs.",
86
- "additionalProperties": { "$ref": "#/definitions/bind_or_literal" }
87
- }
97
+ "bindTo": { "type": "string", "description": "Key in computed_values to write result" },
98
+ "expr": { "type": "string", "description": "JSONata expression evaluated against { card_data, requires, fetched_sources, computed_values }" }
88
99
  }
89
100
  },
90
101
 
91
102
  "source_def": {
103
+ "description": "One source entry. The engine only cares about 'bindTo' (compute namespace key) and 'outputFile' (delivery signal). Every other property is yours — add whatever your task-executor needs: kind, url, headers, mailbox, channel, model, query, etc. The full object is passed verbatim as the --in JSON to the executor.",
92
104
  "type": "object",
93
- "required": ["kind", "bindTo"],
105
+ "required": ["bindTo"],
106
+ "additionalProperties": true,
94
107
  "properties": {
95
- "kind": { "enum": ["api", "websocket", "static", "llm"] },
96
- "bindTo": { "$ref": "#/definitions/bind_ref", "description": "state path to write fetched data into" },
97
- "method": { "enum": ["GET", "POST", "PUT", "DELETE"], "default": "GET" },
98
- "url_template": { "type": "string", "description": "URL with {{var}} placeholders" },
99
- "headers": { "type": "object", "additionalProperties": { "$ref": "#/definitions/bind_or_literal" } },
100
- "body_template": { "type": "object", "description": "Request body with {{var}} placeholders or bind refs" },
101
- "template_vars": {
102
- "type": "object",
103
- "additionalProperties": { "$ref": "#/definitions/bind_or_literal" },
104
- "description": "Variables for url/body templates — static values or bind refs"
105
- },
106
- "poll_interval": { "type": "integer", "minimum": 0, "description": "Auto-refresh in seconds (0 = manual)" },
107
- "transform": { "type": "string", "description": "Dot-path to extract from response, e.g. 'data.items'" }
108
+ "bindTo": { "type": "string", "description": "Key under fetched_sources.* available in compute expressions" },
109
+ "outputFile": { "type": "string", "description": "Board-relative path the executor writes its JSON result to. Presence of this file signals delivery." },
110
+ "optionalForCompletionGating": { "type": "boolean", "default": false, "description": "When true this source does not gate card completion. Default false when absent, so sources are completion-gating by default." },
111
+ "timeout": { "type": "integer", "minimum": 0, "default": 120000, "description": "Executor/script timeout in ms. Default: 120 000 (2 min)." },
112
+ "script": { "type": "string", "description": "Legacy direct-run: shell command executed when no .task-executor is registered. stdout is captured as the result." }
108
113
  }
109
114
  },
110
115
 
@@ -116,16 +121,16 @@
116
121
  "kind": {
117
122
  "enum": ["metric", "table", "chart", "form", "filter", "list",
118
123
  "notes", "todo", "alert", "narrative", "badge", "text",
119
- "markdown", "custom", "file-upload", "chat", "actions"]
124
+ "markdown", "custom", "actions"]
120
125
  },
121
126
  "label": { "type": "string", "description": "Heading above this element" },
122
127
  "className": { "type": "string", "description": "Bootstrap grid class, e.g. 'col-12 col-md-6'" },
123
- "visible": { "type": "string", "description": "state path — element shown only if truthy" },
128
+ "visible": { "type": "string", "description": "card_data/requires/fetched_sources/computed_values path — element shown only if truthy" },
124
129
  "data": {
125
130
  "type": "object",
126
131
  "properties": {
127
- "bind": { "$ref": "#/definitions/bind_ref", "description": "state path to read data from" },
128
- "writeTo": { "$ref": "#/definitions/bind_ref", "description": "state path for user input (form, filter, todo, notes)" },
132
+ "bind": { "$ref": "#/definitions/bind_ref", "description": "card_data/requires/fetched_sources/computed_values path to read data from" },
133
+ "writeTo": { "$ref": "#/definitions/bind_ref", "description": "card_data path for user input (form, filter, todo, notes)" },
129
134
  "columns": { "type": "array", "items": { "type": "string" }, "description": "table: visible columns" },
130
135
  "maxRows": { "type": "integer", "description": "table/list: max rows to display" },
131
136
  "sortable": { "type": "boolean", "default": true, "description": "table: enable click-to-sort" },
@@ -158,7 +163,7 @@
158
163
  "label": { "type": "string" },
159
164
  "style": { "type": "string", "description": "Bootstrap button variant, e.g. 'success', 'outline-danger'" },
160
165
  "size": { "type": "string", "default": "sm" },
161
- "disabled": { "oneOf": [{ "type": "boolean" }, { "type": "string", "description": "state path — truthy = disabled" }] }
166
+ "disabled": { "oneOf": [{ "type": "boolean" }, { "type": "string", "description": "card_data/requires/fetched_sources/computed_values path — truthy = disabled" }] }
162
167
  }
163
168
  }
164
169
  }
@@ -209,58 +214,60 @@
209
214
  }
210
215
  },
211
216
 
212
- "oneOf": [
213
- {
214
- "title": "Card",
215
- "description": "A renderable card node with view elements",
217
+ "title": "LiveCard",
218
+ "description": "A unified card node. Behavior depends on which sections are present (sources, compute, view, etc.)",
219
+ "type": "object",
220
+ "required": ["id"],
221
+ "additionalProperties": false,
222
+ "properties": {
223
+ "id": { "type": "string" },
224
+ "requires": { "$ref": "#/definitions/requires" },
225
+ "provides": { "$ref": "#/definitions/provides" },
226
+ "meta": { "$ref": "#/definitions/meta" },
227
+ "view": { "$ref": "#/definitions/view" },
228
+ "card_data": {
216
229
  "type": "object",
217
- "required": ["id", "type", "view", "state"],
218
- "additionalProperties": false,
230
+ "description": "Authored card data supplied in the card definition",
219
231
  "properties": {
220
- "id": { "type": "string" },
221
- "type": { "const": "card" },
222
- "meta": { "$ref": "#/definitions/meta" },
223
- "data": { "$ref": "#/definitions/data" },
224
- "view": { "$ref": "#/definitions/view" },
225
- "state": { "type": "object", "additionalProperties": true,
226
- "properties": {
227
- "status": { "enum": ["fresh", "stale", "loading", "error"] },
228
- "lastRun": { "type": "string", "format": "date-time" },
229
- "error": { "type": "string" }
232
+ "files": {
233
+ "type": "array",
234
+ "description": "Optional uploaded-file metadata maintained by host handlers. Stored name is normalized and serial-prefixed (for example 001-my_file.pdf).",
235
+ "items": {
236
+ "type": "object",
237
+ "required": ["name", "stored_name"],
238
+ "properties": {
239
+ "name": { "type": "string", "minLength": 1 },
240
+ "stored_name": {
241
+ "type": "string",
242
+ "minLength": 5,
243
+ "maxLength": 32,
244
+ "pattern": "^[0-9]{3,}-[a-z0-9._-]+$"
245
+ },
246
+ "size": {
247
+ "oneOf": [
248
+ { "type": "integer", "minimum": 0 },
249
+ { "type": "null" }
250
+ ]
251
+ },
252
+ "mime_type": { "type": "string" },
253
+ "path": { "type": "string", "pattern": "^[^\\s]+/files/[0-9]{3,}-[a-z0-9._-]+$" },
254
+ "uploaded_at": { "type": "string", "format": "date-time" }
255
+ },
256
+ "additionalProperties": false
230
257
  }
231
- },
232
- "compute": {
233
- "type": "object",
234
- "description": "Derived state: key = state path to write, value = compute_expr",
235
- "additionalProperties": { "$ref": "#/definitions/compute_expr" }
236
258
  }
237
- }
259
+ },
260
+ "additionalProperties": true
238
261
  },
239
- {
240
- "title": "ExternalSource",
241
- "description": "A data-only node that fetches from external systems (no view)",
242
- "type": "object",
243
- "required": ["id", "type", "source", "state"],
244
- "additionalProperties": false,
245
- "properties": {
246
- "id": { "type": "string" },
247
- "type": { "const": "source" },
248
- "meta": { "$ref": "#/definitions/meta" },
249
- "data": { "$ref": "#/definitions/data" },
250
- "source": { "$ref": "#/definitions/source_def" },
251
- "state": { "type": "object", "additionalProperties": true,
252
- "properties": {
253
- "status": { "enum": ["fresh", "stale", "loading", "error"] },
254
- "lastRun": { "type": "string", "format": "date-time" },
255
- "error": { "type": "string" }
256
- }
257
- },
258
- "compute": {
259
- "type": "object",
260
- "description": "Derived state: key = state path to write, value = compute_expr",
261
- "additionalProperties": { "$ref": "#/definitions/compute_expr" }
262
- }
263
- }
262
+ "sources": {
263
+ "type": "array",
264
+ "description": "Source entries. Each entry is passed verbatim to the board's .task-executor (registered via init --task-executor) as the --in JSON file. The executor fetches/generates the data and writes JSON to --out. If no executor is registered, the built-in executor runs the entry's 'cli' command directly. Sources gate completion by default. Set optionalForCompletionGating: true for enrichment-only sources that should not block task-completed.",
265
+ "items": { "$ref": "#/definitions/source_def" }
266
+ },
267
+ "compute": {
268
+ "type": "array",
269
+ "description": "Ordered array of compute steps. Each reads card_data.*/requires.*/fetched_sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",
270
+ "items": { "$ref": "#/definitions/compute_step" }
264
271
  }
265
- ]
272
+ }
266
273
  }