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.
- package/README.md +81 -20
- package/board-live-cards-cli.js +37 -0
- package/browser/board-livegraph-runtime.js +1453 -0
- package/browser/board-livegraph-runtime.js.map +1 -0
- package/browser/card-compute.js +153 -433
- package/browser/live-cards.js +868 -115
- package/browser/live-cards.schema.json +90 -83
- package/dist/board-livegraph-runtime/index.cjs +1448 -0
- package/dist/board-livegraph-runtime/index.cjs.map +1 -0
- package/dist/board-livegraph-runtime/index.d.cts +101 -0
- package/dist/board-livegraph-runtime/index.d.ts +101 -0
- package/dist/board-livegraph-runtime/index.js +1441 -0
- package/dist/board-livegraph-runtime/index.js.map +1 -0
- package/dist/card-compute/index.cjs +266 -431
- package/dist/card-compute/index.cjs.map +1 -1
- package/dist/card-compute/index.d.cts +77 -49
- package/dist/card-compute/index.d.ts +77 -49
- package/dist/card-compute/index.js +263 -432
- package/dist/card-compute/index.js.map +1 -1
- package/dist/cli/board-live-cards-cli.cjs +2750 -0
- package/dist/cli/board-live-cards-cli.cjs.map +1 -0
- package/dist/cli/board-live-cards-cli.d.cts +205 -0
- package/dist/cli/board-live-cards-cli.d.ts +205 -0
- package/dist/cli/board-live-cards-cli.js +2702 -0
- package/dist/cli/board-live-cards-cli.js.map +1 -0
- package/dist/{constants-B2zqu10b.d.ts → constants-DuzE5n03.d.ts} +2 -2
- package/dist/{constants-DJZU1pwJ.d.cts → constants-ozjf1Ejw.d.cts} +2 -2
- package/dist/continuous-event-graph/index.cjs +258 -464
- package/dist/continuous-event-graph/index.cjs.map +1 -1
- package/dist/continuous-event-graph/index.d.cts +18 -358
- package/dist/continuous-event-graph/index.d.ts +18 -358
- package/dist/continuous-event-graph/index.js +255 -464
- package/dist/continuous-event-graph/index.js.map +1 -1
- package/dist/event-graph/index.cjs +4 -4
- package/dist/event-graph/index.cjs.map +1 -1
- package/dist/event-graph/index.d.cts +5 -5
- package/dist/event-graph/index.d.ts +5 -5
- package/dist/event-graph/index.js +4 -4
- package/dist/event-graph/index.js.map +1 -1
- package/dist/index.cjs +1684 -555
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -7
- package/dist/index.d.ts +26 -7
- package/dist/index.js +1678 -555
- package/dist/index.js.map +1 -1
- package/dist/inference/index.cjs +138 -19
- package/dist/inference/index.cjs.map +1 -1
- package/dist/inference/index.d.cts +2 -2
- package/dist/inference/index.d.ts +2 -2
- package/dist/inference/index.js +138 -19
- package/dist/inference/index.js.map +1 -1
- package/dist/journal-DRfJiheM.d.cts +28 -0
- package/dist/journal-NLYuqege.d.ts +28 -0
- package/dist/live-cards-bridge-Or7fdEJV.d.ts +316 -0
- package/dist/live-cards-bridge-vGJ6tMzN.d.cts +316 -0
- package/dist/schedule-CMcZe5Ny.d.ts +21 -0
- package/dist/schedule-CiucyCan.d.cts +21 -0
- package/dist/step-machine/index.cjs +18 -1
- package/dist/step-machine/index.cjs.map +1 -1
- package/dist/step-machine/index.d.cts +2 -2
- package/dist/step-machine/index.d.ts +2 -2
- package/dist/step-machine/index.js +18 -1
- package/dist/step-machine/index.js.map +1 -1
- package/dist/stores/file.d.cts +1 -1
- package/dist/stores/file.d.ts +1 -1
- package/dist/stores/index.d.cts +1 -1
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/localStorage.d.cts +1 -1
- package/dist/stores/localStorage.d.ts +1 -1
- package/dist/stores/memory.d.cts +1 -1
- package/dist/stores/memory.d.ts +1 -1
- package/dist/{types-BwvgvlOO.d.cts → types-BzLD8bjb.d.cts} +1 -1
- package/dist/{types-ClRA8hzC.d.ts → types-C2eJ7DAV.d.ts} +1 -1
- package/dist/{types-DEj7OakX.d.cts → types-CMFSIjpc.d.cts} +39 -4
- package/dist/{types-DEj7OakX.d.ts → types-CMFSIjpc.d.ts} +39 -4
- package/dist/{types-FZ_eyErS.d.cts → types-ycun84cq.d.cts} +1 -0
- package/dist/{types-FZ_eyErS.d.ts → types-ycun84cq.d.ts} +1 -0
- package/dist/{validate-DEZ2Ymdb.d.ts → validate-DJQTQ6bP.d.ts} +1 -1
- package/dist/{validate-DqKTZg_o.d.cts → validate-ke92Cleg.d.cts} +1 -1
- package/examples/browser/boards/portfolio-tracker/cards/holdings-table.json +22 -0
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-form.json +16 -0
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-value.json +15 -0
- package/examples/browser/boards/portfolio-tracker/cards/price-fetch.json +15 -0
- package/examples/browser/boards/portfolio-tracker/fetch-prices.js +43 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.bat +7 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +217 -0
- package/examples/browser/livecards-browser/index.html +41 -0
- package/examples/browser/{index.html → step-machine-browser/index.html} +53 -53
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +22 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +43 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +15 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +15 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/fetch-prices.js +48 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +58 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +27 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +25 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +29 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +27 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/status-cli.js +25 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +37 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +53 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +35 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +227 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +38 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +29 -0
- package/examples/cli/step-machine-demo/jsonata-init-board-cli.js +36 -0
- package/examples/cli/step-machine-demo/jsonata-init-board.flow.yaml +30 -0
- package/examples/cli/step-machine-demo/one-step-cli-only.flow.yaml +19 -0
- package/examples/cli/step-machine-demo/step-cli-echo-y.js +15 -0
- package/examples/cli/step-machine-demo/step2-double-cli.js +39 -0
- package/examples/cli/step-machine-demo/two-step-math-handlers.js +32 -0
- package/examples/cli/step-machine-demo/two-step-math.flow.yaml +31 -0
- package/examples/cli/step-machine-demo/two-step-mixed-handlers.js +24 -0
- package/examples/cli/step-machine-demo/two-step-mixed.flow.yaml +35 -0
- package/examples/example-board/board.yaml +23 -0
- package/examples/example-board/bootstrap_payload.json +1 -0
- package/examples/example-board/cards/card-chain-region-alert.json +39 -0
- package/examples/example-board/cards/card-chain-region-totals.json +26 -0
- package/examples/example-board/cards/card-chain-top-region.json +24 -0
- package/examples/example-board/cards/card-ex-actions.json +32 -0
- package/examples/example-board/cards/card-ex-chart.json +30 -0
- package/examples/example-board/cards/card-ex-filter.json +36 -0
- package/examples/example-board/cards/card-ex-filtered-by-preference.json +59 -0
- package/examples/example-board/cards/card-ex-form.json +91 -0
- package/examples/example-board/cards/card-ex-list.json +22 -0
- package/examples/example-board/cards/card-ex-markdown.json +17 -0
- package/examples/example-board/cards/card-ex-metric.json +19 -0
- package/examples/example-board/cards/card-ex-narrative.json +36 -0
- package/examples/example-board/cards/card-ex-source-http.json +28 -0
- package/examples/example-board/cards/card-ex-source.json +21 -0
- package/examples/example-board/cards/card-ex-status.json +35 -0
- package/examples/example-board/cards/card-ex-table.json +30 -0
- package/examples/example-board/cards/card-ex-todo.json +29 -0
- package/examples/example-board/demo-chat-handler.js +69 -0
- package/examples/example-board/demo-server.js +87 -0
- package/examples/example-board/demo-shell-browser.html +806 -0
- package/examples/example-board/demo-shell-with-server.html +280 -0
- package/examples/example-board/demo-shell.html +62 -0
- package/examples/example-board/demo-task-executor.js +255 -0
- package/examples/example-board/mock.db +15 -0
- package/examples/example-board/reusable-board-runtime-client.js +265 -0
- package/examples/example-board/reusable-runtime-artifacts-adapter.js +233 -0
- package/examples/example-board/reusable-server-runtime.js +1284 -0
- package/examples/index.html +799 -0
- package/examples/{batch → npm-libs/batch}/batch-step-machine.ts +1 -1
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/live-cards-board.ts +18 -18
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/live-portfolio-dashboard.ts +24 -24
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/portfolio-tracker.ts +1 -1
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/reactive-monitoring.ts +1 -1
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/reactive-pipeline.ts +1 -1
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/soc-incident-board.ts +1 -1
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/stock-dashboard.ts +1 -1
- package/examples/{event-graph → npm-libs/event-graph}/ci-cd-pipeline.ts +1 -1
- package/examples/{event-graph → npm-libs/event-graph}/executor-diamond.ts +1 -1
- package/examples/{event-graph → npm-libs/event-graph}/executor-pipeline.ts +1 -1
- package/examples/{event-graph → npm-libs/event-graph}/research-pipeline.ts +1 -1
- package/examples/{graph-of-graphs → npm-libs/graph-of-graphs}/multi-stage-etl.ts +1 -1
- package/examples/{graph-of-graphs → npm-libs/graph-of-graphs}/url-processing-pipeline.ts +1 -1
- package/examples/{inference → npm-libs/inference}/azure-deployment.ts +1 -1
- package/examples/{inference → npm-libs/inference}/copilot-cli.ts +1 -1
- package/examples/{inference → npm-libs/inference}/data-pipeline.ts +1 -1
- package/examples/{inference → npm-libs/inference}/pluggable-adapters.ts +1 -1
- package/examples/{node → npm-libs/node}/ai-conversation.ts +1 -1
- package/examples/{node → npm-libs/node}/simple-greeting.ts +2 -2
- package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +22 -0
- package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +43 -0
- package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +15 -0
- package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +15 -0
- package/examples/step-machine-cli/portfolio-tracker/fetch-prices.js +48 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +58 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +27 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +25 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +29 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +27 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/status-cli.js +25 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +37 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +53 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +35 -0
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +227 -0
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +38 -0
- package/examples/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +29 -0
- package/package.json +27 -2
- package/schema/board-status.schema.json +118 -0
- package/schema/card-runtime.schema.json +25 -0
- package/schema/flow.schema.json +5 -0
- package/schema/live-cards.schema.json +90 -83
- package/step-machine-cli.js +674 -0
- package/browser/ingest-board.js +0 -296
- package/examples/ingest.js +0 -733
- /package/examples/{flows → npm-libs/flows}/ai-conversation.yaml +0 -0
- /package/examples/{flows → npm-libs/flows}/order-processing.yaml +0 -0
- /package/examples/{flows → npm-libs/flows}/simple-greeting.yaml +0 -0
package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/live-cards-board.ts
RENAMED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - LiveBoard overload — board.id, board.settings forwarded to GraphConfig
|
|
17
17
|
* - validateReactiveGraph on the resulting graph
|
|
18
18
|
*
|
|
19
|
-
* Run with: npx tsx examples/continuous-event-graph/live-cards-board.ts
|
|
19
|
+
* Run with: npx tsx examples/npm-libs/continuous-event-graph/live-cards-board.ts
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import {
|
|
@@ -36,31 +36,31 @@ const cards: LiveCard[] = [
|
|
|
36
36
|
id: 'market-feed',
|
|
37
37
|
type: 'source',
|
|
38
38
|
meta: { title: 'Live Market Prices' },
|
|
39
|
-
|
|
40
|
-
source: { kind: 'static', bindTo: '
|
|
39
|
+
card_data: { prices: [142.5, 305.8, 89.2, 211.0, 178.3] },
|
|
40
|
+
source: { kind: 'static', bindTo: 'card_data.prices' },
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
id: 'stats',
|
|
44
44
|
type: 'card',
|
|
45
45
|
meta: { title: 'Price Statistics' },
|
|
46
|
-
|
|
46
|
+
card_data: {},
|
|
47
47
|
data: { requires: ['market-feed'] },
|
|
48
48
|
compute: {
|
|
49
|
-
total: { fn: 'sum', input: '
|
|
50
|
-
avg: { fn: 'avg', input: '
|
|
51
|
-
count: { fn: 'count', input: '
|
|
49
|
+
total: { fn: 'sum', input: 'sources.market-feed.prices' },
|
|
50
|
+
avg: { fn: 'avg', input: 'sources.market-feed.prices' },
|
|
51
|
+
count: { fn: 'count', input: 'sources.market-feed.prices' },
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
id: 'summary',
|
|
56
56
|
type: 'card',
|
|
57
57
|
meta: { title: 'Summary Label' },
|
|
58
|
-
|
|
58
|
+
card_data: {},
|
|
59
59
|
data: { requires: ['stats'] },
|
|
60
60
|
compute: {
|
|
61
61
|
label: {
|
|
62
62
|
fn: 'template',
|
|
63
|
-
input: '
|
|
63
|
+
input: 'computed_values.stats',
|
|
64
64
|
format: '{{count}} stocks — total ${{total}}, avg ${{avg}}',
|
|
65
65
|
},
|
|
66
66
|
},
|
|
@@ -115,37 +115,37 @@ const board: LiveBoard = {
|
|
|
115
115
|
id: 'equity-feed',
|
|
116
116
|
type: 'source',
|
|
117
117
|
meta: { title: 'Equity Prices' },
|
|
118
|
-
|
|
119
|
-
source: { kind: 'api', bindTo: '
|
|
118
|
+
card_data: {},
|
|
119
|
+
source: { kind: 'api', bindTo: 'card_data.raw', url_template: 'https://api.example.com/equity' },
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
122
|
id: 'bond-feed',
|
|
123
123
|
type: 'source',
|
|
124
124
|
meta: { title: 'Bond Yields' },
|
|
125
|
-
|
|
126
|
-
source: { kind: 'static', bindTo: '
|
|
125
|
+
card_data: { yields: [3.2, 4.1, 2.8, 5.0] },
|
|
126
|
+
source: { kind: 'static', bindTo: 'card_data.yields' },
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
id: 'portfolio-mix',
|
|
130
130
|
type: 'card',
|
|
131
131
|
meta: { title: 'Portfolio Mix Calculator' },
|
|
132
|
-
|
|
132
|
+
card_data: {},
|
|
133
133
|
data: { requires: ['equity-feed', 'bond-feed'] },
|
|
134
134
|
compute: {
|
|
135
|
-
equity_total: { fn: 'sum', input: '
|
|
136
|
-
bond_total: { fn: 'sum', input: '
|
|
135
|
+
equity_total: { fn: 'sum', input: 'sources.equity-feed.prices' },
|
|
136
|
+
bond_total: { fn: 'sum', input: 'sources.bond-feed.yields' },
|
|
137
137
|
},
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
id: 'risk-summary',
|
|
141
141
|
type: 'card',
|
|
142
142
|
meta: { title: 'Risk Summary' },
|
|
143
|
-
|
|
143
|
+
card_data: {},
|
|
144
144
|
data: { requires: ['portfolio-mix'] },
|
|
145
145
|
compute: {
|
|
146
146
|
label: {
|
|
147
147
|
fn: 'template',
|
|
148
|
-
input: '
|
|
148
|
+
input: 'computed_values.portfolio-mix',
|
|
149
149
|
format: 'Equities: ${{equity_total}} | Bonds: {{bond_total}}%',
|
|
150
150
|
},
|
|
151
151
|
},
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* Dynamically added: allocation-chart, risk-score, daily-pnl,
|
|
23
23
|
* value-alert, summary, correlation, combined-view
|
|
24
24
|
*
|
|
25
|
-
* Run with: npx tsx examples/continuous-event-graph/live-portfolio-dashboard.ts
|
|
25
|
+
* Run with: npx tsx examples/npm-libs/continuous-event-graph/live-portfolio-dashboard.ts
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import * as fs from 'node:fs';
|
|
@@ -69,8 +69,8 @@ const cards: LiveCard[] = [
|
|
|
69
69
|
{
|
|
70
70
|
id: 'holdings', type: 'source',
|
|
71
71
|
meta: { title: 'Portfolio Holdings' },
|
|
72
|
-
data: { provides: { holdings: '
|
|
73
|
-
|
|
72
|
+
data: { provides: { holdings: 'card_data.holdings' } },
|
|
73
|
+
card_data: {
|
|
74
74
|
holdings: [
|
|
75
75
|
{ symbol: 'AAPL', shares: 50, sector: 'tech' },
|
|
76
76
|
{ symbol: 'MSFT', shares: 30, sector: 'tech' },
|
|
@@ -83,13 +83,13 @@ const cards: LiveCard[] = [
|
|
|
83
83
|
{
|
|
84
84
|
id: 'price-feed', type: 'source',
|
|
85
85
|
meta: { title: 'Live Price Feed' },
|
|
86
|
-
data: { provides: { prices: '
|
|
87
|
-
|
|
86
|
+
data: { provides: { prices: 'card_data.prices' } },
|
|
87
|
+
card_data: { prices: { AAPL: 195.50, MSFT: 420.10, GOOG: 176.30, JPM: 198.20, JNJ: 155.80 } },
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
id: 'news-feed', type: 'source',
|
|
91
91
|
meta: { title: 'Market News Feed' },
|
|
92
|
-
|
|
92
|
+
card_data: {
|
|
93
93
|
headlines: [
|
|
94
94
|
{ symbol: 'AAPL', headline: 'Apple beats Q4 estimates', sentiment: 0.8 },
|
|
95
95
|
{ symbol: 'JPM', headline: 'JPMorgan raises dividend', sentiment: 0.6 },
|
|
@@ -100,32 +100,32 @@ const cards: LiveCard[] = [
|
|
|
100
100
|
{
|
|
101
101
|
id: 'benchmark', type: 'source',
|
|
102
102
|
meta: { title: 'S&P 500 Benchmark' },
|
|
103
|
-
|
|
103
|
+
card_data: { index: 'SPY', value: 5280.50, dailyReturn: 0.45 },
|
|
104
104
|
},
|
|
105
105
|
// Compute cards
|
|
106
106
|
{
|
|
107
107
|
id: 'valuator', type: 'card',
|
|
108
108
|
meta: { title: 'Position Valuator' },
|
|
109
109
|
data: { requires: ['holdings', 'price-feed'] },
|
|
110
|
-
|
|
110
|
+
card_data: {},
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
id: 'portfolio-value', type: 'card',
|
|
114
114
|
meta: { title: 'Total Portfolio Value' },
|
|
115
115
|
data: { requires: ['valuator'] },
|
|
116
|
-
|
|
116
|
+
card_data: {},
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
id: 'sector-breakdown', type: 'card',
|
|
120
120
|
meta: { title: 'Sector Breakdown' },
|
|
121
121
|
data: { requires: ['valuator'] },
|
|
122
|
-
|
|
122
|
+
card_data: {},
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
id: 'sentiment', type: 'card',
|
|
126
126
|
meta: { title: 'News Sentiment Score' },
|
|
127
127
|
data: { requires: ['news-feed'] },
|
|
128
|
-
|
|
128
|
+
card_data: {},
|
|
129
129
|
},
|
|
130
130
|
];
|
|
131
131
|
|
|
@@ -144,7 +144,7 @@ function makeHandler(
|
|
|
144
144
|
const result = computeFn(graphRef!.getState());
|
|
145
145
|
try {
|
|
146
146
|
const diskCard = readCard(dir, id);
|
|
147
|
-
diskCard.
|
|
147
|
+
diskCard.card_data = { ...diskCard.card_data, ...result };
|
|
148
148
|
writeCard(dir, diskCard);
|
|
149
149
|
} catch { /* card may not exist yet */ }
|
|
150
150
|
graphRef!.resolveCallback(input.callbackToken, result);
|
|
@@ -225,7 +225,7 @@ async function main() {
|
|
|
225
225
|
if (taskState.data && Object.keys(taskState.data).length > 0) {
|
|
226
226
|
try {
|
|
227
227
|
const diskCard = readCard(tmpDir, taskName);
|
|
228
|
-
diskCard.
|
|
228
|
+
diskCard.card_data = { ...diskCard.card_data, ...taskState.data };
|
|
229
229
|
writeCard(tmpDir, diskCard);
|
|
230
230
|
} catch { /* not on disk yet */ }
|
|
231
231
|
}
|
|
@@ -251,7 +251,7 @@ async function main() {
|
|
|
251
251
|
log('PHASE 2', 'Adding 7 dynamic cards → 15 total');
|
|
252
252
|
|
|
253
253
|
addDynamicCard(rg, tmpDir, {
|
|
254
|
-
id: 'allocation-chart', type: 'card', data: { requires: ['valuator', 'portfolio-value'] },
|
|
254
|
+
id: 'allocation-chart', type: 'card', data: { requires: ['valuator', 'portfolio-value'] }, card_data: {},
|
|
255
255
|
}, (e) => {
|
|
256
256
|
const pos = (e.state.tasks.valuator?.data as any)?.positions ?? [];
|
|
257
257
|
const tot = (e.state.tasks['portfolio-value']?.data as any)?.totalValue ?? 0;
|
|
@@ -259,7 +259,7 @@ async function main() {
|
|
|
259
259
|
}, { requires: ['valuator', 'portfolio-value'] });
|
|
260
260
|
|
|
261
261
|
addDynamicCard(rg, tmpDir, {
|
|
262
|
-
id: 'risk-score', type: 'card', data: { requires: ['valuator'] },
|
|
262
|
+
id: 'risk-score', type: 'card', data: { requires: ['valuator'] }, card_data: {},
|
|
263
263
|
}, (e) => {
|
|
264
264
|
const pos = (e.state.tasks.valuator?.data as any)?.positions ?? [];
|
|
265
265
|
const vals = pos.map((p: any) => p.value);
|
|
@@ -269,7 +269,7 @@ async function main() {
|
|
|
269
269
|
}, { requires: ['valuator'] });
|
|
270
270
|
|
|
271
271
|
addDynamicCard(rg, tmpDir, {
|
|
272
|
-
id: 'daily-pnl', type: 'card', data: { requires: ['portfolio-value', 'benchmark'] },
|
|
272
|
+
id: 'daily-pnl', type: 'card', data: { requires: ['portfolio-value', 'benchmark'] }, card_data: {},
|
|
273
273
|
}, (e) => {
|
|
274
274
|
const tv = (e.state.tasks['portfolio-value']?.data as any)?.totalValue ?? 0;
|
|
275
275
|
const benchReturn = (e.state.tasks.benchmark?.data as any)?.dailyReturn ?? 0;
|
|
@@ -278,14 +278,14 @@ async function main() {
|
|
|
278
278
|
}, { requires: ['portfolio-value', 'benchmark'] });
|
|
279
279
|
|
|
280
280
|
addDynamicCard(rg, tmpDir, {
|
|
281
|
-
id: 'value-alert', type: 'card', data: { requires: ['portfolio-value'] },
|
|
281
|
+
id: 'value-alert', type: 'card', data: { requires: ['portfolio-value'] }, card_data: {},
|
|
282
282
|
}, (e) => {
|
|
283
283
|
const tv = (e.state.tasks['portfolio-value']?.data as any)?.totalValue ?? 0;
|
|
284
284
|
return { triggered: tv > 25000, threshold: 25000, currentValue: tv };
|
|
285
285
|
}, { requires: ['portfolio-value'] });
|
|
286
286
|
|
|
287
287
|
addDynamicCard(rg, tmpDir, {
|
|
288
|
-
id: 'summary', type: 'card', data: { requires: ['portfolio-value', 'sentiment'] },
|
|
288
|
+
id: 'summary', type: 'card', data: { requires: ['portfolio-value', 'sentiment'] }, card_data: {},
|
|
289
289
|
}, (e) => {
|
|
290
290
|
const tv = (e.state.tasks['portfolio-value']?.data as any)?.totalValue ?? 0;
|
|
291
291
|
const mood = (e.state.tasks.sentiment?.data as any)?.bullish ? 'bullish' : 'bearish';
|
|
@@ -293,7 +293,7 @@ async function main() {
|
|
|
293
293
|
}, { requires: ['portfolio-value', 'sentiment'] });
|
|
294
294
|
|
|
295
295
|
addDynamicCard(rg, tmpDir, {
|
|
296
|
-
id: 'correlation', type: 'card', data: { requires: ['valuator', 'benchmark'] },
|
|
296
|
+
id: 'correlation', type: 'card', data: { requires: ['valuator', 'benchmark'] }, card_data: {},
|
|
297
297
|
}, (e) => {
|
|
298
298
|
const pos = (e.state.tasks.valuator?.data as any)?.positions ?? [];
|
|
299
299
|
const techVal = pos.filter((p: any) => p.sector === 'tech').reduce((s: number, p: any) => s + p.value, 0);
|
|
@@ -302,7 +302,7 @@ async function main() {
|
|
|
302
302
|
}, { requires: ['valuator', 'benchmark'] });
|
|
303
303
|
|
|
304
304
|
addDynamicCard(rg, tmpDir, {
|
|
305
|
-
id: 'combined-view', type: 'card', data: { requires: ['summary', 'sector-breakdown', 'risk-score'] },
|
|
305
|
+
id: 'combined-view', type: 'card', data: { requires: ['summary', 'sector-breakdown', 'risk-score'] }, card_data: {},
|
|
306
306
|
}, (e) => ({
|
|
307
307
|
summaryMood: (e.state.tasks.summary?.data as any)?.mood ?? '?',
|
|
308
308
|
sectors: (e.state.tasks['sector-breakdown']?.data as any)?.sectorCount ?? 0,
|
|
@@ -326,7 +326,7 @@ async function main() {
|
|
|
326
326
|
console.log(' benchmark provides:', rg.getState().config.tasks.benchmark.provides);
|
|
327
327
|
|
|
328
328
|
addDynamicCard(rg, tmpDir, {
|
|
329
|
-
id: 'market-context', type: 'card', data: { requires: ['market-data'] },
|
|
329
|
+
id: 'market-context', type: 'card', data: { requires: ['market-data'] }, card_data: {},
|
|
330
330
|
}, (e) => {
|
|
331
331
|
const bench = e.state.tasks.benchmark?.data as any ?? {};
|
|
332
332
|
return { indexValue: bench.value ?? 0, context: 'provided via market-data token' };
|
|
@@ -409,7 +409,7 @@ async function main() {
|
|
|
409
409
|
console.log(' combined-view requires:', rg.getState().config.tasks['combined-view'].requires);
|
|
410
410
|
|
|
411
411
|
addDynamicCard(rg, tmpDir, {
|
|
412
|
-
id: 'allocation-chart', type: 'card', data: { requires: ['valuator'] },
|
|
412
|
+
id: 'allocation-chart', type: 'card', data: { requires: ['valuator'] }, card_data: {},
|
|
413
413
|
}, (e) => {
|
|
414
414
|
const pos = (e.state.tasks.valuator?.data as any)?.positions ?? [];
|
|
415
415
|
const total = pos.reduce((s: number, p: any) => s + p.value, 0);
|
|
@@ -436,7 +436,7 @@ async function main() {
|
|
|
436
436
|
id: 'watchlist', type: 'source',
|
|
437
437
|
meta: { title: 'Watchlist (User Input)' },
|
|
438
438
|
data: { provides: { watchlist: 'state.symbols' } },
|
|
439
|
-
|
|
439
|
+
card_data: { symbols: ['NVDA', 'AMD', 'AMZN'] },
|
|
440
440
|
};
|
|
441
441
|
writeCard(tmpDir, watchlistCard);
|
|
442
442
|
rg.registerHandler('watchlist', makeHandler('watchlist', (engine) => {
|
|
@@ -463,7 +463,7 @@ async function main() {
|
|
|
463
463
|
addDynamicCard(rg, tmpDir, {
|
|
464
464
|
id: 'watchlist-prices', type: 'card',
|
|
465
465
|
meta: { title: 'Watchlist Latest Prices' },
|
|
466
|
-
data: { requires: ['watchlist', 'price-feed'] },
|
|
466
|
+
data: { requires: ['watchlist', 'price-feed'] }, card_data: {},
|
|
467
467
|
}, (engine) => {
|
|
468
468
|
const symbols: string[] = (engine.state.tasks.watchlist?.data as any)?.symbols ?? [];
|
|
469
469
|
const allPrices: Record<string, number> = (engine.state.tasks['price-feed']?.data as any)?.prices ?? {};
|
package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/portfolio-tracker.ts
RENAMED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* T3: Force price refresh without form change → retrigger('price-fetch')
|
|
30
30
|
* T4: Quiescent
|
|
31
31
|
*
|
|
32
|
-
* Run with: npx tsx examples/continuous-event-graph/portfolio-tracker.ts
|
|
32
|
+
* Run with: npx tsx examples/npm-libs/continuous-event-graph/portfolio-tracker.ts
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
import type { GraphConfig } from '../../src/event-graph/types.js';
|
package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/reactive-monitoring.ts
RENAMED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* Scenario: A monitoring system that collects metrics, evaluates alerts,
|
|
16
16
|
* and dynamically adds notification channels at runtime.
|
|
17
17
|
*
|
|
18
|
-
* Run with: npx tsx examples/continuous-event-graph/reactive-monitoring.ts
|
|
18
|
+
* Run with: npx tsx examples/npm-libs/continuous-event-graph/reactive-monitoring.ts
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import {
|
package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/reactive-pipeline.ts
RENAMED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - validateLiveGraph for runtime state-consistency checks
|
|
10
10
|
* - validateReactiveGraph for handler/dispatch checks
|
|
11
11
|
*
|
|
12
|
-
* Run with: npx tsx examples/continuous-event-graph/reactive-pipeline.ts
|
|
12
|
+
* Run with: npx tsx examples/npm-libs/continuous-event-graph/reactive-pipeline.ts
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import {
|
package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/soc-incident-board.ts
RENAMED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* T1: New intel arrives → retrigger threat-intel → data-changed cascade
|
|
32
32
|
* create-ticket skipped (once) — slack re-fires
|
|
33
33
|
*
|
|
34
|
-
* Run with: npx tsx examples/continuous-event-graph/soc-incident-board.ts
|
|
34
|
+
* Run with: npx tsx examples/npm-libs/continuous-event-graph/soc-incident-board.ts
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
import type { GraphConfig } from '../../src/event-graph/types.js';
|
package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/stock-dashboard.ts
RENAMED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - Scheduling adapts as the graph evolves
|
|
11
11
|
* - Snapshots allow persistence and restore
|
|
12
12
|
*
|
|
13
|
-
* Run with: npx tsx examples/continuous-event-graph/stock-dashboard.ts
|
|
13
|
+
* Run with: npx tsx examples/npm-libs/continuous-event-graph/stock-dashboard.ts
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Inner transform flow (step-machine, per record):
|
|
22
22
|
* parse → validate → normalize → enrich → (accept | reject)
|
|
23
23
|
*
|
|
24
|
-
* Run with: npx tsx examples/graph-of-graphs/multi-stage-etl.ts
|
|
24
|
+
* Run with: npx tsx examples/npm-libs/graph-of-graphs/multi-stage-etl.ts
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
import {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* - resolveConfigTemplates() for DRY task configs
|
|
20
20
|
* - Parallel fan-out inside inner graph
|
|
21
21
|
*
|
|
22
|
-
* Run with: npx tsx examples/graph-of-graphs/url-processing-pipeline.ts
|
|
22
|
+
* Run with: npx tsx examples/npm-libs/graph-of-graphs/url-processing-pipeline.ts
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - GitHub Copilot CLI installed (comes with VS Code / GitHub Copilot extension)
|
|
9
9
|
* - `copilot` available on PATH
|
|
10
10
|
*
|
|
11
|
-
* Run with: npx tsx examples/inference/copilot-cli.ts
|
|
11
|
+
* Run with: npx tsx examples/npm-libs/inference/copilot-cli.ts
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { createLiveGraph, schedule } from '../../src/continuous-event-graph/index.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demonstrates iterative inference — run the LLM multiple times as
|
|
5
5
|
* new evidence arrives. Each round may unlock more tasks.
|
|
6
6
|
*
|
|
7
|
-
* Run with: npx tsx examples/inference/data-pipeline.ts
|
|
7
|
+
* Run with: npx tsx examples/npm-libs/inference/data-pipeline.ts
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Shows how to create adapters for different LLM providers.
|
|
5
5
|
* Each adapter implements InferenceAdapter.analyze(prompt) → string.
|
|
6
6
|
*
|
|
7
|
-
* Run with: npx tsx examples/inference/pluggable-adapters.ts
|
|
7
|
+
* Run with: npx tsx examples/npm-libs/inference/pluggable-adapters.ts
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Demonstrates basic usage with file-based persistence.
|
|
5
5
|
*
|
|
6
|
-
* Run with: npx ts-node examples/node/simple-greeting.ts
|
|
7
|
-
* Or after build: node examples/node/simple-greeting.js
|
|
6
|
+
* Run with: npx ts-node examples/npm-libs/node/simple-greeting.ts
|
|
7
|
+
* Or after build: node examples/npm-libs/node/simple-greeting.js
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { createEngine, loadFlow, FileStore } from '../../src/index.js';
|
|
@@ -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,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "portfolio-form",
|
|
3
|
+
"meta": {
|
|
4
|
+
"title": "Portfolio Holdings Form"
|
|
5
|
+
},
|
|
6
|
+
"provides": [
|
|
7
|
+
{
|
|
8
|
+
"bindTo": "holdings",
|
|
9
|
+
"src": "card_data.holdings"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"card_data": {
|
|
13
|
+
"holdings": [
|
|
14
|
+
{
|
|
15
|
+
"symbol": "AAPL",
|
|
16
|
+
"qty": 50
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"symbol": "MSFT",
|
|
20
|
+
"qty": 30
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"symbol": "GOOG",
|
|
24
|
+
"qty": 100
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"view": {
|
|
29
|
+
"elements": [
|
|
30
|
+
{
|
|
31
|
+
"kind": "table",
|
|
32
|
+
"label": "Holdings",
|
|
33
|
+
"data": {
|
|
34
|
+
"bind": "card_data.holdings",
|
|
35
|
+
"columns": [
|
|
36
|
+
"symbol",
|
|
37
|
+
"qty"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -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": "sources.prices" }],
|
|
6
|
+
"card_data": {},
|
|
7
|
+
"sources": [
|
|
8
|
+
{ "cli": "node ../fetch-prices.js --tmp-file-name tmp_file1", "bindTo": "prices", "outputFile": "prices.json" }
|
|
9
|
+
],
|
|
10
|
+
"view": {
|
|
11
|
+
"elements": [
|
|
12
|
+
{ "kind": "table", "label": "Market Prices", "data": { "bind": "sources.prices" } }
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
function getArgValue(flagName) {
|
|
9
|
+
const idx = process.argv.indexOf(flagName);
|
|
10
|
+
if (idx < 0) return undefined;
|
|
11
|
+
return process.argv[idx + 1];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const envBoardDir = (process.env.BOARD_DIR ?? '').trim();
|
|
15
|
+
const tmpFileName = String(getArgValue('--tmp-file-name') ?? process.env.TMP_FILE_NAME ?? 'tmp_file1').trim();
|
|
16
|
+
const tmpFilePath = envBoardDir ? path.join(envBoardDir, tmpFileName) : '';
|
|
17
|
+
|
|
18
|
+
if (!tmpFilePath) {
|
|
19
|
+
console.error('BOARD_DIR environment variable is required for fetch-prices.js');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function getReadableTmpFile() {
|
|
24
|
+
if (!fs.existsSync(tmpFilePath)) return undefined;
|
|
25
|
+
const content = fs.readFileSync(tmpFilePath, 'utf-8').trim();
|
|
26
|
+
if (!content) return undefined;
|
|
27
|
+
return { tmpFile: tmpFilePath, content };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function waitForFile(timeoutMs = 120000) {
|
|
31
|
+
const started = Date.now();
|
|
32
|
+
const interval = setInterval(() => {
|
|
33
|
+
if (Date.now() - started > timeoutMs) {
|
|
34
|
+
clearInterval(interval);
|
|
35
|
+
console.error('Timed out waiting for tmp_file1 market prices input.');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const ready = getReadableTmpFile();
|
|
40
|
+
if (!ready) return;
|
|
41
|
+
|
|
42
|
+
clearInterval(interval);
|
|
43
|
+
fs.writeFileSync(ready.tmpFile, '', 'utf-8');
|
|
44
|
+
process.stdout.write(`${ready.content}\n`);
|
|
45
|
+
}, 250);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
waitForFile();
|