yaml-flow 5.2.6 → 5.2.8

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 (84) hide show
  1. package/README.md +6 -6
  2. package/board-livecards-server-runtime.js +260 -35
  3. package/browser/board-livegraph-engine.js +57 -32
  4. package/browser/board-livegraph-engine.js.map +1 -1
  5. package/browser/card-compute.js +17 -17
  6. package/browser/live-cards.js +139 -12
  7. package/browser/live-cards.schema.json +14 -9
  8. package/dist/board-livegraph-runtime/index.cjs +57 -32
  9. package/dist/board-livegraph-runtime/index.cjs.map +1 -1
  10. package/dist/board-livegraph-runtime/index.d.cts +1 -1
  11. package/dist/board-livegraph-runtime/index.d.ts +1 -1
  12. package/dist/board-livegraph-runtime/index.js +57 -32
  13. package/dist/board-livegraph-runtime/index.js.map +1 -1
  14. package/dist/card-compute/index.cjs +96 -38
  15. package/dist/card-compute/index.cjs.map +1 -1
  16. package/dist/card-compute/index.d.cts +13 -8
  17. package/dist/card-compute/index.d.ts +13 -8
  18. package/dist/card-compute/index.js +96 -38
  19. package/dist/card-compute/index.js.map +1 -1
  20. package/dist/cli/board-live-cards-cli.cjs +7200 -201
  21. package/dist/cli/board-live-cards-cli.cjs.map +1 -1
  22. package/dist/cli/board-live-cards-cli.d.cts +6 -6
  23. package/dist/cli/board-live-cards-cli.d.ts +6 -6
  24. package/dist/cli/board-live-cards-cli.js +7199 -201
  25. package/dist/cli/board-live-cards-cli.js.map +1 -1
  26. package/dist/continuous-event-graph/index.cjs +55 -30
  27. package/dist/continuous-event-graph/index.cjs.map +1 -1
  28. package/dist/continuous-event-graph/index.d.cts +2 -2
  29. package/dist/continuous-event-graph/index.d.ts +2 -2
  30. package/dist/continuous-event-graph/index.js +55 -30
  31. package/dist/continuous-event-graph/index.js.map +1 -1
  32. package/dist/index.cjs +121 -53
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +121 -53
  37. package/dist/index.js.map +1 -1
  38. package/dist/{live-cards-bridge-CeNxiVcm.d.ts → live-cards-bridge-EQjytzI_.d.ts} +10 -5
  39. package/dist/{live-cards-bridge-z_rJCSbi.d.cts → live-cards-bridge-x5XREkXm.d.cts} +10 -5
  40. package/examples/browser/boards/portfolio-tracker/cards/holdings-table.json +1 -1
  41. package/examples/browser/boards/portfolio-tracker/cards/portfolio-form.json +1 -1
  42. package/examples/browser/boards/portfolio-tracker/cards/portfolio-risk-assessment.json +1 -1
  43. package/examples/browser/boards/portfolio-tracker/cards/portfolio-value.json +1 -1
  44. package/examples/browser/boards/portfolio-tracker/cards/price-fetch.json +2 -2
  45. package/examples/browser/boards/portfolio-tracker/cards/rebalancing-strategy.json +1 -1
  46. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +10 -10
  47. package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +1 -1
  48. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +1 -1
  49. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +1 -1
  50. package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +2 -2
  51. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +1 -1
  52. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +1 -1
  53. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +1 -1
  54. package/examples/example-board/agent-instructions-cardlayout.md +1 -1
  55. package/examples/example-board/agent-instructions.md +271 -45
  56. package/examples/example-board/cards/card-concentration.json +8 -5
  57. package/examples/example-board/cards/card-market-prices.json +14 -9
  58. package/examples/example-board/cards/card-my-identity.json +28 -0
  59. package/examples/example-board/cards/card-portfolio-value.json +1 -1
  60. package/examples/example-board/cards/card-portfolio.json +1 -1
  61. package/examples/example-board/cards/card-rebalance-impact.json +65 -0
  62. package/examples/example-board/cards/card-rebalance-sim.json +57 -0
  63. package/examples/example-board/demo-chat-handler.js +2 -1
  64. package/examples/example-board/demo-server-config.json +6 -1
  65. package/examples/example-board/demo-server.js +79 -8
  66. package/examples/example-board/demo-shell-browser.html +6 -6
  67. package/examples/example-board/demo-shell-with-server.html +4 -4
  68. package/examples/example-board/demo-task-executor.js +436 -246
  69. package/examples/example-board/scripts/copilot_wrapper.bat +16 -0
  70. package/examples/example-board/scripts/copilot_wrapper_helper.ps1 +19 -10
  71. package/examples/example-board/scripts/workiq_wrapper.mjs +66 -0
  72. package/examples/npm-libs/continuous-event-graph/live-cards-board.ts +5 -5
  73. package/examples/npm-libs/continuous-event-graph/soc-incident-board.ts +3 -3
  74. package/examples/npm-libs/event-graph/research-pipeline.ts +5 -5
  75. package/examples/npm-libs/graph-of-graphs/multi-stage-etl.ts +9 -9
  76. package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +1 -1
  77. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +1 -1
  78. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +1 -1
  79. package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +3 -3
  80. package/examples/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +1 -1
  81. package/examples/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +1 -1
  82. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +1 -1
  83. package/package.json +2 -2
  84. package/schema/live-cards.schema.json +14 -9
@@ -152,8 +152,13 @@ interface ReactiveGraph {
152
152
  getState(): LiveGraph;
153
153
  /** Current schedule projection. */
154
154
  getSchedule(): ScheduleResult;
155
- /** Stop accepting events. */
156
- dispose(): void;
155
+ /**
156
+ * Stop accepting events.
157
+ * @param options.wait — if true, await all in-flight handler promises before marking disposed.
158
+ */
159
+ dispose(options?: {
160
+ wait?: boolean;
161
+ }): Promise<void>;
157
162
  }
158
163
  declare function createReactiveGraph(configOrLive: GraphConfig | LiveGraph, options: ReactiveGraphOptions, executionId?: string): ReactiveGraph;
159
164
 
@@ -179,7 +184,7 @@ declare function createReactiveGraph(configOrLive: GraphConfig | LiveGraph, opti
179
184
  * import { liveCardsToReactiveGraph } from 'yaml-flow/continuous-event-graph';
180
185
  *
181
186
  * const cards = [
182
- * { id: 'prices', sources: [{ kind: 'api', bindTo: 'raw' }], state: {} },
187
+ * { id: 'prices', source_defs: [{ kind: 'api', bindTo: 'raw' }], state: {} },
183
188
  * { id: 'dashboard', requires: ['prices'], state: {}, compute: [{ bindTo: 'total', fn: 'sum', ... }], view: { ... } },
184
189
  * ];
185
190
  *
@@ -201,7 +206,7 @@ declare function createReactiveGraph(configOrLive: GraphConfig | LiveGraph, opti
201
206
  /** A provides binding: maps a token name to a source path in the card's data namespace. */
202
207
  interface ProvidesBinding {
203
208
  bindTo: string;
204
- src: string;
209
+ ref: string;
205
210
  }
206
211
  interface LiveCard {
207
212
  id: string;
@@ -217,7 +222,7 @@ interface LiveCard {
217
222
  fn: string;
218
223
  [key: string]: unknown;
219
224
  }[];
220
- sources?: {
225
+ source_defs?: {
221
226
  cli?: string;
222
227
  bindTo: string;
223
228
  outputFile: string;
@@ -152,8 +152,13 @@ interface ReactiveGraph {
152
152
  getState(): LiveGraph;
153
153
  /** Current schedule projection. */
154
154
  getSchedule(): ScheduleResult;
155
- /** Stop accepting events. */
156
- dispose(): void;
155
+ /**
156
+ * Stop accepting events.
157
+ * @param options.wait — if true, await all in-flight handler promises before marking disposed.
158
+ */
159
+ dispose(options?: {
160
+ wait?: boolean;
161
+ }): Promise<void>;
157
162
  }
158
163
  declare function createReactiveGraph(configOrLive: GraphConfig | LiveGraph, options: ReactiveGraphOptions, executionId?: string): ReactiveGraph;
159
164
 
@@ -179,7 +184,7 @@ declare function createReactiveGraph(configOrLive: GraphConfig | LiveGraph, opti
179
184
  * import { liveCardsToReactiveGraph } from 'yaml-flow/continuous-event-graph';
180
185
  *
181
186
  * const cards = [
182
- * { id: 'prices', sources: [{ kind: 'api', bindTo: 'raw' }], state: {} },
187
+ * { id: 'prices', source_defs: [{ kind: 'api', bindTo: 'raw' }], state: {} },
183
188
  * { id: 'dashboard', requires: ['prices'], state: {}, compute: [{ bindTo: 'total', fn: 'sum', ... }], view: { ... } },
184
189
  * ];
185
190
  *
@@ -201,7 +206,7 @@ declare function createReactiveGraph(configOrLive: GraphConfig | LiveGraph, opti
201
206
  /** A provides binding: maps a token name to a source path in the card's data namespace. */
202
207
  interface ProvidesBinding {
203
208
  bindTo: string;
204
- src: string;
209
+ ref: string;
205
210
  }
206
211
  interface LiveCard {
207
212
  id: string;
@@ -217,7 +222,7 @@ interface LiveCard {
217
222
  fn: string;
218
223
  [key: string]: unknown;
219
224
  }[];
220
- sources?: {
225
+ source_defs?: {
221
226
  cli?: string;
222
227
  bindTo: string;
223
228
  outputFile: string;
@@ -2,7 +2,7 @@
2
2
  "id": "holdings-table",
3
3
  "meta": { "title": "Holdings Table" },
4
4
  "requires": ["holdings", "prices"],
5
- "provides": [{ "bindTo": "table", "src": "computed_values.table" }],
5
+ "provides": [{ "bindTo": "table", "ref": "computed_values.table" }],
6
6
  "card_data": {},
7
7
  "compute": [
8
8
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "portfolio-form",
3
3
  "meta": { "title": "Portfolio Holdings Form" },
4
- "provides": [{ "bindTo": "holdings", "src": "card_data.holdings" }],
4
+ "provides": [{ "bindTo": "holdings", "ref": "card_data.holdings" }],
5
5
  "card_data": {
6
6
  "holdings": [
7
7
  { "symbol": "AAPL", "qty": 50 },
@@ -3,7 +3,7 @@
3
3
  "meta": { "title": "Portfolio Risk Assessment" },
4
4
  "requires": ["table", "totalValue"],
5
5
  "provides": [
6
- { "bindTo": "riskAssessment", "src": "card_data.llm_task_completion_inference.reason" }
6
+ { "bindTo": "riskAssessment", "ref": "card_data.llm_task_completion_inference.reason" }
7
7
  ],
8
8
  "card_data": {
9
9
  "llm_task_completion_inference": {
@@ -2,7 +2,7 @@
2
2
  "id": "portfolio-value",
3
3
  "meta": { "title": "Portfolio Total Value" },
4
4
  "requires": ["table"],
5
- "provides": [{ "bindTo": "totalValue", "src": "computed_values.totalValue" }],
5
+ "provides": [{ "bindTo": "totalValue", "ref": "computed_values.totalValue" }],
6
6
  "card_data": {},
7
7
  "compute": [
8
8
  { "bindTo": "totalValue", "expr": "$sum(requires.table.rows.value)" }
@@ -2,9 +2,9 @@
2
2
  "id": "price-fetch",
3
3
  "meta": { "title": "Fetch Market Prices" },
4
4
  "requires": ["holdings"],
5
- "provides": [{ "bindTo": "prices", "src": "fetched_sources.prices" }],
5
+ "provides": [{ "bindTo": "prices", "ref": "fetched_sources.prices" }],
6
6
  "card_data": {},
7
- "sources": [
7
+ "source_defs": [
8
8
  { "cli": "node ../fetch-prices.js", "bindTo": "prices", "outputFile": "prices.json" }
9
9
  ],
10
10
  "view": {
@@ -3,7 +3,7 @@
3
3
  "meta": { "title": "Rebalancing Strategy" },
4
4
  "requires": ["table", "totalValue", "riskAssessment"],
5
5
  "provides": [
6
- { "bindTo": "rebalancingPlan", "src": "card_data.llm_task_completion_inference.reason" }
6
+ { "bindTo": "rebalancingPlan", "ref": "card_data.llm_task_completion_inference.reason" }
7
7
  ],
8
8
  "card_data": {
9
9
  "llm_task_completion_inference": {
@@ -201,9 +201,9 @@ function printTaskExecutorLog() {
201
201
  } else {
202
202
  cli('init', BOARD, '--inference-adapter', INFERENCE_ADAPTER);
203
203
  }
204
- cli('add-cards', '--rg', BOARD, '--card-glob', path.join(CARDS, '*.json'));
204
+ cli('upsert-card', '--rg', BOARD, '--card-glob', path.join(CARDS, '*.json'));
205
205
 
206
- console.log('\n--- T0 Status (after add-cards) ---');
206
+ console.log('\n--- T0 Status (after upsert-card) ---');
207
207
  process.stdout.write(statusText());
208
208
 
209
209
  console.log('\n=== T1: Writing market prices ===');
@@ -219,7 +219,7 @@ function printTaskExecutorLog() {
219
219
  const portfolioFormV2 = {
220
220
  id: 'portfolio-form',
221
221
  meta: { title: 'Portfolio Holdings Form' },
222
- provides: [{ bindTo: 'holdings', src: 'card_data.holdings' }],
222
+ provides: [{ bindTo: 'holdings', ref: 'card_data.holdings' }],
223
223
  card_data: {
224
224
  holdings: [
225
225
  { symbol: 'AAPL', qty: 50 },
@@ -235,7 +235,7 @@ function printTaskExecutorLog() {
235
235
  };
236
236
  fs.writeFileSync(portfolioFormPath, JSON.stringify(portfolioFormV2, null, 2));
237
237
 
238
- cli('update-card', '--rg', BOARD, '--card-id', 'portfolio-form', '--restart');
238
+ cli('upsert-card', '--rg', BOARD, '--card', portfolioFormPath, '--restart');
239
239
  await sleep(500);
240
240
  writePrices({ AAPL: 198.50, MSFT: 425.30, GOOG: 178.90, AMZN: 192.40, TSLA: 168.75 });
241
241
  releaseInferenceAdapters('T2');
@@ -260,7 +260,7 @@ function printTaskExecutorLog() {
260
260
  const portfolioFormV3 = {
261
261
  id: 'portfolio-form',
262
262
  meta: { title: 'Portfolio Holdings Form' },
263
- provides: [{ bindTo: 'holdings', src: 'card_data.holdings' }],
263
+ provides: [{ bindTo: 'holdings', ref: 'card_data.holdings' }],
264
264
  card_data: {
265
265
  holdings: [
266
266
  { symbol: 'AAPL', qty: 50 },
@@ -279,7 +279,7 @@ function printTaskExecutorLog() {
279
279
  const portfolioFormV4 = {
280
280
  id: 'portfolio-form',
281
281
  meta: { title: 'Portfolio Holdings Form' },
282
- provides: [{ bindTo: 'holdings', src: 'card_data.holdings' }],
282
+ provides: [{ bindTo: 'holdings', ref: 'card_data.holdings' }],
283
283
  card_data: {
284
284
  holdings: [
285
285
  { symbol: 'AAPL', qty: 45 },
@@ -298,7 +298,7 @@ function printTaskExecutorLog() {
298
298
  const portfolioFormV5 = {
299
299
  id: 'portfolio-form',
300
300
  meta: { title: 'Portfolio Holdings Form' },
301
- provides: [{ bindTo: 'holdings', src: 'card_data.holdings' }],
301
+ provides: [{ bindTo: 'holdings', ref: 'card_data.holdings' }],
302
302
  card_data: {
303
303
  holdings: [
304
304
  { symbol: 'AAPL', qty: 40 },
@@ -316,15 +316,15 @@ function printTaskExecutorLog() {
316
316
 
317
317
  // First update starts a source fetch request.
318
318
  fs.writeFileSync(portfolioFormPath, JSON.stringify(portfolioFormV3, null, 2));
319
- cli('update-card', '--rg', BOARD, '--card-id', 'portfolio-form', '--restart');
319
+ cli('upsert-card', '--rg', BOARD, '--card', portfolioFormPath, '--restart');
320
320
 
321
321
  // Immediate second update should queue a newer checksum while the first request is in-flight.
322
322
  fs.writeFileSync(portfolioFormPath, JSON.stringify(portfolioFormV4, null, 2));
323
- cli('update-card', '--rg', BOARD, '--card-id', 'portfolio-form', '--restart');
323
+ cli('upsert-card', '--rg', BOARD, '--card', portfolioFormPath, '--restart');
324
324
 
325
325
  // Immediate third update should overwrite queued checksum (latest-state wins).
326
326
  fs.writeFileSync(portfolioFormPath, JSON.stringify(portfolioFormV5, null, 2));
327
- cli('update-card', '--rg', BOARD, '--card-id', 'portfolio-form', '--restart');
327
+ cli('upsert-card', '--rg', BOARD, '--card', portfolioFormPath, '--restart');
328
328
 
329
329
  // 7) wait for first request, then 8) write response prices for update #1 tickers.
330
330
  // await readFetchRequest('T4 first fetch', ['AAPL', 'MSFT', 'GOOG', 'AMZN']);
@@ -2,7 +2,7 @@
2
2
  "id": "holdings-table",
3
3
  "meta": { "title": "Holdings Table" },
4
4
  "requires": ["holdings", "prices"],
5
- "provides": [{ "bindTo": "table", "src": "computed_values.table" }],
5
+ "provides": [{ "bindTo": "table", "ref": "computed_values.table" }],
6
6
  "card_data": {},
7
7
  "compute": [
8
8
  {
@@ -6,7 +6,7 @@
6
6
  "provides": [
7
7
  {
8
8
  "bindTo": "holdings",
9
- "src": "card_data.holdings"
9
+ "ref": "card_data.holdings"
10
10
  }
11
11
  ],
12
12
  "card_data": {
@@ -2,7 +2,7 @@
2
2
  "id": "portfolio-value",
3
3
  "meta": { "title": "Portfolio Total Value" },
4
4
  "requires": ["table"],
5
- "provides": [{ "bindTo": "totalValue", "src": "computed_values.totalValue" }],
5
+ "provides": [{ "bindTo": "totalValue", "ref": "computed_values.totalValue" }],
6
6
  "card_data": {},
7
7
  "compute": [
8
8
  { "bindTo": "totalValue", "expr": "$sum(requires.table.rows.value)" }
@@ -2,9 +2,9 @@
2
2
  "id": "price-fetch",
3
3
  "meta": { "title": "Fetch Market Prices" },
4
4
  "requires": ["holdings"],
5
- "provides": [{ "bindTo": "prices", "src": "fetched_sources.prices" }],
5
+ "provides": [{ "bindTo": "prices", "ref": "fetched_sources.prices" }],
6
6
  "card_data": {},
7
- "sources": [
7
+ "source_defs": [
8
8
  { "cli": "node ../fetch-prices.js --tmp-file-name tmp_file1", "bindTo": "prices", "outputFile": "prices.json" }
9
9
  ],
10
10
  "view": {
@@ -12,7 +12,7 @@ try {
12
12
  process.exit(0);
13
13
  }
14
14
 
15
- runBoardCli(['add-cards', '--rg', boardDir, '--card-glob', cardsGlob]);
15
+ runBoardCli(['upsert-card', '--rg', boardDir, '--card-glob', cardsGlob]);
16
16
 
17
17
  writeResult({
18
18
  result: 'success',
@@ -22,7 +22,7 @@ try {
22
22
  card.card_data.holdings = holdings;
23
23
  fs.writeFileSync(cardPath, `${JSON.stringify(card, null, 2)}\n`, 'utf-8');
24
24
 
25
- runBoardCli(['update-card', '--rg', boardDir, '--card-id', 'portfolio-form', '--restart']);
25
+ runBoardCli(['upsert-card', '--rg', boardDir, '--card', cardPath, '--restart']);
26
26
 
27
27
  writeResult({
28
28
  result: 'success',
@@ -44,7 +44,7 @@ steps:
44
44
  expects_data: [board_dir, cards_template_dir]
45
45
  produces_data: [cards_dir]
46
46
  handler:
47
- cli: node %%BOARDCLI_CMD%% add-cards --rg "%%BOARD_DIR%%" --card-glob "%%CARDS_GLOB%%"
47
+ cli: node %%BOARDCLI_CMD%% upsert-card --rg "%%BOARD_DIR%%" --card-glob "%%CARDS_GLOB%%"
48
48
  result-mode: exit-code
49
49
  input-transforms:
50
50
  BOARD_DIR: board_dir
@@ -9,7 +9,7 @@
9
9
  - **No redundancy across cards** — each column on a board should appear on exactly one card. If a value is already visible elsewhere, omit it; the user's eye can join cards mentally.
10
10
  - **Aggregations are distinct** — a metric that summarises data from another card (total, count, average) is not redundant — it is new information. Keep it.
11
11
  - **Separate input from output** — cards with editable elements (`editable-table`, `form`, `filter`) should stay lean; put heavy compute and display in a separate downstream card that `requires` the published token.
12
- - **Propagate data, not display** — use `provides` to pass data between cards; never duplicate a `sources[]` fetch for data another card already provides.
12
+ - **Propagate data, not display** — use `provides` to pass data between cards; never duplicate a `source_defs[]` fetch for data another card already provides.
13
13
  - **KISS** — if you are unsure whether a field adds value, leave it out. A sparse card that is immediately readable is better than a dense card that requires study.
14
14
 
15
15
  ---