yaml-flow 5.4.0 → 6.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/board-live-cards-cli.js +2 -2
- package/board-livecards-server-runtime.js +488 -551
- package/browser/asset-integrity.json +10 -0
- package/browser/board-livecards-runtime-client.js +0 -6
- package/browser/board-livegraph-engine.js +2 -1676
- package/browser/board-livegraph-engine.js.map +1 -1
- package/browser/live-cards.js +347 -26
- package/browser/live-cards.schema.json +418 -132
- package/card-store.js +37 -0
- package/dist/batch/index.cjs +1 -108
- package/dist/batch/index.cjs.map +1 -1
- package/dist/batch/index.js +1 -106
- package/dist/batch/index.js.map +1 -1
- package/dist/board-live-cards-lib-Bg6EvCo5.d.cts +136 -0
- package/dist/board-live-cards-lib-jM2uYG1v.d.ts +136 -0
- package/dist/board-live-cards-public-CltXYgaY.d.cts +314 -0
- package/dist/board-live-cards-public-f-E-FAyp.d.ts +314 -0
- package/dist/board-livegraph-runtime/index.cjs +2 -1671
- package/dist/board-livegraph-runtime/index.cjs.map +1 -1
- package/dist/board-livegraph-runtime/index.d.cts +1 -2
- package/dist/board-livegraph-runtime/index.d.ts +1 -2
- package/dist/board-livegraph-runtime/index.js +2 -1662
- package/dist/board-livegraph-runtime/index.js.map +1 -1
- package/dist/board-livegraph-runtime/jsonata-sync.cjs +7587 -0
- package/dist/card-compute/index.cjs +9 -7159
- package/dist/card-compute/index.cjs.map +1 -1
- package/dist/card-compute/index.d.cts +22 -0
- package/dist/card-compute/index.d.ts +22 -0
- package/dist/card-compute/index.js +9 -7145
- package/dist/card-compute/index.js.map +1 -1
- package/dist/card-compute/jsonata-sync.cjs +7587 -0
- package/dist/cli/browser-api/board-live-cards-browser-adapter.cjs +2 -0
- package/dist/cli/browser-api/board-live-cards-browser-adapter.cjs.map +1 -0
- package/dist/cli/browser-api/board-live-cards-browser-adapter.d.cts +24 -0
- package/dist/cli/browser-api/board-live-cards-browser-adapter.d.ts +24 -0
- package/dist/cli/browser-api/board-live-cards-browser-adapter.js +2 -0
- package/dist/cli/browser-api/board-live-cards-browser-adapter.js.map +1 -0
- package/dist/cli/browser-api/card-store-browser-api.cjs +2 -0
- package/dist/cli/browser-api/card-store-browser-api.cjs.map +1 -0
- package/dist/cli/browser-api/card-store-browser-api.d.cts +26 -0
- package/dist/cli/browser-api/card-store-browser-api.d.ts +26 -0
- package/dist/cli/browser-api/card-store-browser-api.js +2 -0
- package/dist/cli/browser-api/card-store-browser-api.js.map +1 -0
- package/dist/cli/browser-api/jsonata-sync.cjs +7587 -0
- package/dist/cli/node/artifacts-store-cli.cjs +11 -0
- package/dist/cli/node/artifacts-store-cli.cjs.map +1 -0
- package/dist/cli/node/artifacts-store-cli.d.cts +8 -0
- package/dist/cli/node/artifacts-store-cli.d.ts +8 -0
- package/dist/cli/node/artifacts-store-cli.js +11 -0
- package/dist/cli/node/artifacts-store-cli.js.map +1 -0
- package/dist/cli/node/board-live-cards-cli.cjs +15 -0
- package/dist/cli/node/board-live-cards-cli.cjs.map +1 -0
- package/dist/cli/node/board-live-cards-cli.d.cts +20 -0
- package/dist/cli/node/board-live-cards-cli.d.ts +20 -0
- package/dist/cli/node/board-live-cards-cli.js +15 -0
- package/dist/cli/node/board-live-cards-cli.js.map +1 -0
- package/dist/cli/node/card-store-cli.cjs +8 -0
- package/dist/cli/node/card-store-cli.cjs.map +1 -0
- package/dist/cli/node/card-store-cli.d.cts +15 -0
- package/dist/cli/node/card-store-cli.d.ts +15 -0
- package/dist/cli/node/card-store-cli.js +8 -0
- package/dist/cli/node/card-store-cli.js.map +1 -0
- package/dist/cli/node/fs-board-adapter.cjs +14 -0
- package/dist/cli/node/fs-board-adapter.cjs.map +1 -0
- package/dist/cli/node/fs-board-adapter.d.cts +204 -0
- package/dist/cli/node/fs-board-adapter.d.ts +204 -0
- package/dist/cli/node/fs-board-adapter.js +14 -0
- package/dist/cli/node/fs-board-adapter.js.map +1 -0
- package/dist/cli/node/jsonata-sync.cjs +7587 -0
- package/dist/cli/node/source-cli-task-executor.cjs +11 -0
- package/dist/cli/node/source-cli-task-executor.cjs.map +1 -0
- package/dist/cli/node/source-cli-task-executor.d.cts +1 -0
- package/dist/cli/node/source-cli-task-executor.d.ts +1 -0
- package/dist/cli/node/source-cli-task-executor.js +11 -0
- package/dist/cli/node/source-cli-task-executor.js.map +1 -0
- package/dist/config/index.cjs +1 -79
- package/dist/config/index.cjs.map +1 -1
- package/dist/config/index.js +1 -76
- package/dist/config/index.js.map +1 -1
- package/dist/continuous-event-graph/index.cjs +2 -2129
- package/dist/continuous-event-graph/index.cjs.map +1 -1
- package/dist/continuous-event-graph/index.d.cts +81 -5
- package/dist/continuous-event-graph/index.d.ts +81 -5
- package/dist/continuous-event-graph/index.js +2 -2088
- package/dist/continuous-event-graph/index.js.map +1 -1
- package/dist/continuous-event-graph/jsonata-sync.cjs +7587 -0
- package/dist/event-graph/index.cjs +22 -8292
- package/dist/event-graph/index.cjs.map +1 -1
- package/dist/event-graph/index.js +22 -8237
- package/dist/event-graph/index.js.map +1 -1
- package/dist/execution-refs.cjs +2 -0
- package/dist/execution-refs.cjs.map +1 -0
- package/dist/execution-refs.d.cts +222 -0
- package/dist/execution-refs.d.ts +222 -0
- package/dist/execution-refs.js +2 -0
- package/dist/execution-refs.js.map +1 -0
- package/dist/index.cjs +29 -13221
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +29 -13112
- package/dist/index.js.map +1 -1
- package/dist/inference/index.cjs +5 -617
- package/dist/inference/index.cjs.map +1 -1
- package/dist/inference/index.js +5 -610
- package/dist/inference/index.js.map +1 -1
- package/dist/jsonata-sync.cjs +7587 -0
- package/dist/{live-cards-bridge-x5XREkXm.d.cts → live-cards-bridge-BXbVTsna.d.cts} +27 -4
- package/dist/{live-cards-bridge-EQjytzI_.d.ts → live-cards-bridge-Ds28XR15.d.ts} +27 -4
- package/dist/pycli/quickjs-board-runtime.global.js +9 -0
- package/dist/pycli/quickjs-board-runtime.global.js.map +1 -0
- package/dist/pycli/quickjs-step-machine-runtime.global.js +5 -0
- package/dist/pycli/quickjs-step-machine-runtime.global.js.map +1 -0
- package/dist/step-machine/index.cjs +11 -7129
- package/dist/step-machine/index.cjs.map +1 -1
- package/dist/step-machine/index.js +11 -7113
- package/dist/step-machine/index.js.map +1 -1
- package/dist/storage-refs.cjs +10 -0
- package/dist/storage-refs.cjs.map +1 -0
- package/dist/storage-refs.d.cts +92 -0
- package/dist/storage-refs.d.ts +92 -0
- package/dist/storage-refs.js +10 -0
- package/dist/storage-refs.js.map +1 -0
- package/dist/stores/file.cjs +1 -114
- package/dist/stores/file.cjs.map +1 -1
- package/dist/stores/file.js +1 -112
- package/dist/stores/file.js.map +1 -1
- package/dist/stores/index.cjs +1 -231
- package/dist/stores/index.cjs.map +1 -1
- package/dist/stores/index.js +1 -227
- package/dist/stores/index.js.map +1 -1
- package/dist/stores/localStorage.cjs +1 -76
- package/dist/stores/localStorage.cjs.map +1 -1
- package/dist/stores/localStorage.js +1 -74
- package/dist/stores/localStorage.js.map +1 -1
- package/dist/stores/memory.cjs +1 -47
- package/dist/stores/memory.cjs.map +1 -1
- package/dist/stores/memory.js +1 -45
- package/dist/stores/memory.js.map +1 -1
- package/examples/browser/boards/portfolio-tracker/portfolio-t4.js +292 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-fetch-prices.js +218 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-fetch-prices.py +201 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-inference-adapter.js +25 -16
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-public.js +553 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.py +365 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/--base-ref/.runtime-out +1 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/--base-ref/board-graph.json +32 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +53 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +15 -6
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +6 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/poll-status-cli.js +57 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +1 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/status-cli.js +1 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +7 -2
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +6 -2
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/_board_pycli.py +97 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/add-cards.py +50 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/init-board.py +44 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/poll-status.py +70 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/reset-board-dir.py +36 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/inline-python-demo.flow.yaml +26 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/inline-python-handlers.py +39 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker-pycli.flow.yaml +80 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +25 -172
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +40 -34
- package/examples/cli/step-machine-cli/portfolio-tracker/run-inline-python-demo-pycli.py +46 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker-pycli.py +77 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +1 -2
- package/examples/example-board/agent-instructions.md +11 -5
- package/examples/example-board/demo-chat-handler.js +14 -4
- package/examples/example-board/demo-server-config.json +1 -0
- package/examples/example-board/demo-server.js +19 -34
- package/examples/example-board/demo-shell-browser.html +5 -4
- package/examples/example-board/demo-shell-with-server.html +10 -6
- package/examples/example-board/demo-task-executor.js +81 -35
- package/examples/index.html +0 -14
- package/examples/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +0 -1
- package/examples/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +1 -2
- package/package.json +39 -3
- package/schema/live-cards.schema.json +418 -132
- package/dist/cli/board-live-cards-cli.cjs +0 -10644
- package/dist/cli/board-live-cards-cli.cjs.map +0 -1
- package/dist/cli/board-live-cards-cli.d.cts +0 -179
- package/dist/cli/board-live-cards-cli.d.ts +0 -179
- package/dist/cli/board-live-cards-cli.js +0 -10592
- package/dist/cli/board-live-cards-cli.js.map +0 -1
- package/dist/journal-9HEgs7dU.d.ts +0 -28
- package/dist/journal-B-JCfQnh.d.cts +0 -28
- package/dist/schedule-Cszq9LYY.d.ts +0 -21
- package/dist/schedule-qWNL0RQh.d.cts +0 -21
- package/examples/browser/boards/portfolio-tracker/cards/holdings-table.json +0 -22
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-form.json +0 -16
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-risk-assessment.json +0 -28
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-value.json +0 -15
- package/examples/browser/boards/portfolio-tracker/cards/price-fetch.json +0 -15
- package/examples/browser/boards/portfolio-tracker/cards/rebalancing-strategy.json +0 -28
- package/examples/browser/boards/portfolio-tracker/fetch-prices.js +0 -43
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-task-executor.cjs +0 -96
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.bat +0 -7
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +0 -351
|
@@ -32,7 +32,10 @@
|
|
|
32
32
|
* "boardId": "<board id>", // e.g. "default"
|
|
33
33
|
* "boardRuntimeDir": "<relative>", // e.g. "runtime"
|
|
34
34
|
* "runtimeStatusDir": "<relative>", // e.g. "runtime-out"
|
|
35
|
-
* "cardsDir": "<relative>"
|
|
35
|
+
* "cardsDir": "<relative>", // e.g. "surface/tmp-cards"
|
|
36
|
+
* "serverUrl": "<base url>", // optional; e.g. "http://127.0.0.1:7799"
|
|
37
|
+
* "boardLiveCardsCliJs":"<abs path>", // optional; path to board-live-cards-cli.js
|
|
38
|
+
* "stepMachineCliPath":"<abs path>" // optional; path to step-machine-cli.js
|
|
36
39
|
* }
|
|
37
40
|
*
|
|
38
41
|
* Supported source kinds (based on custom fields in --in):
|
|
@@ -58,6 +61,7 @@ import os from 'node:os';
|
|
|
58
61
|
import crypto from 'node:crypto';
|
|
59
62
|
import { execFileSync } from 'node:child_process';
|
|
60
63
|
import { fileURLToPath } from 'node:url';
|
|
64
|
+
import { parseRef, blobStorageForRef, reportComplete, reportFailed } from 'yaml-flow/storage-refs';
|
|
61
65
|
|
|
62
66
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
63
67
|
|
|
@@ -103,7 +107,7 @@ function readCache(key, ttlMs = CACHE_TTL_MS) {
|
|
|
103
107
|
|
|
104
108
|
// Shared single-URL fetch helper used by both url and url-list.
|
|
105
109
|
// cacheTimeoutSec: override TTL in seconds (null → use CACHE_TTL_MS default).
|
|
106
|
-
function doFetchApi(url, method, headers, cacheTimeoutSec
|
|
110
|
+
function doFetchApi(url, method, headers, cacheTimeoutSec) {
|
|
107
111
|
const ttlMs = cacheTimeoutSec != null ? cacheTimeoutSec * 1000 : CACHE_TTL_MS;
|
|
108
112
|
const k = cacheKey(`url:${method}:${url}`);
|
|
109
113
|
const cached = readCache(k, ttlMs);
|
|
@@ -265,14 +269,14 @@ function fail(msg, errFile) {
|
|
|
265
269
|
}
|
|
266
270
|
|
|
267
271
|
function runSourceFetchSubcommand(argv) {
|
|
268
|
-
const inIdx = argv.indexOf('--in');
|
|
269
|
-
const outIdx = argv.indexOf('--out');
|
|
270
|
-
const errIdx = argv.indexOf('--err');
|
|
272
|
+
const inIdx = argv.indexOf('--in-ref');
|
|
273
|
+
const outIdx = argv.indexOf('--out-ref');
|
|
274
|
+
const errIdx = argv.indexOf('--err-ref');
|
|
271
275
|
const extraIdx = argv.indexOf('--extra');
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
const
|
|
275
|
-
const extraB64
|
|
276
|
+
const inRefStr = inIdx !== -1 ? argv[inIdx + 1] : undefined;
|
|
277
|
+
const outRefStr = outIdx !== -1 ? argv[outIdx + 1] : undefined;
|
|
278
|
+
const errRefStr = errIdx !== -1 ? argv[errIdx + 1] : undefined;
|
|
279
|
+
const extraB64 = extraIdx !== -1 ? argv[extraIdx + 1] : undefined;
|
|
276
280
|
|
|
277
281
|
let extra = {};
|
|
278
282
|
if (extraB64) {
|
|
@@ -280,19 +284,50 @@ function runSourceFetchSubcommand(argv) {
|
|
|
280
284
|
catch { console.warn('[demo-task-executor] bad --extra base64, ignoring'); }
|
|
281
285
|
}
|
|
282
286
|
|
|
283
|
-
if (!
|
|
284
|
-
fail('Usage: run-source-fetch --in
|
|
287
|
+
if (!inRefStr || !outRefStr) {
|
|
288
|
+
fail('Usage: run-source-fetch --in-ref <::kind::value> --out-ref <::kind::value> [--err-ref <::kind::value>]');
|
|
285
289
|
}
|
|
286
290
|
|
|
287
|
-
|
|
288
|
-
|
|
291
|
+
let inRef, outRef, errRef;
|
|
292
|
+
try {
|
|
293
|
+
inRef = parseRef(inRefStr);
|
|
294
|
+
outRef = parseRef(outRefStr);
|
|
295
|
+
if (errRefStr) errRef = parseRef(errRefStr);
|
|
296
|
+
} catch (e) {
|
|
297
|
+
fail(`invalid ref argument: ${e.message}`);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const inStorage = blobStorageForRef(inRef);
|
|
301
|
+
const outStorage = blobStorageForRef(outRef);
|
|
302
|
+
const errStorage = errRef ? blobStorageForRef(errRef) : undefined;
|
|
303
|
+
|
|
304
|
+
// Local error reporter — writes to errStorage and calls back to board if callback present.
|
|
305
|
+
const failRef = (msg, callback) => {
|
|
306
|
+
if (errStorage && errRef) { try { errStorage.write(errRef.value, msg); } catch {} }
|
|
307
|
+
console.error(`[demo-task-executor] ${msg}`);
|
|
308
|
+
if (callback) { try { reportFailed(callback, msg); } catch {} }
|
|
309
|
+
process.exit(1);
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
const rawIn = inStorage.read(inRef.value);
|
|
313
|
+
if (rawIn === null) {
|
|
314
|
+
failRef(`Input not found: ${inRefStr}`);
|
|
289
315
|
}
|
|
290
316
|
|
|
317
|
+
// Payload may be { source_def, callback } (new protocol) or raw source def (legacy).
|
|
318
|
+
let envelope;
|
|
319
|
+
try {
|
|
320
|
+
envelope = JSON.parse(rawIn);
|
|
321
|
+
} catch (err) {
|
|
322
|
+
failRef(`Cannot parse input: ${String(err && err.message || err)}`);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const callback = envelope.source_def ? envelope.callback : undefined;
|
|
291
326
|
let sourceDef;
|
|
292
327
|
try {
|
|
293
|
-
sourceDef =
|
|
328
|
+
sourceDef = envelope.source_def ?? envelope;
|
|
294
329
|
} catch (err) {
|
|
295
|
-
|
|
330
|
+
failRef(`Cannot resolve source_def: ${String(err && err.message || err)}`, callback);
|
|
296
331
|
}
|
|
297
332
|
|
|
298
333
|
let resultValue;
|
|
@@ -321,14 +356,14 @@ function runSourceFetchSubcommand(argv) {
|
|
|
321
356
|
}
|
|
322
357
|
}
|
|
323
358
|
if (sourceDef.tickersFrom && !fetchArgs.tickers) {
|
|
324
|
-
|
|
359
|
+
failRef('url: tickersFrom resolved to empty list — skipping fetch', callback);
|
|
325
360
|
}
|
|
326
361
|
const urlContext = { ...(sourceDef._projections || {}), ...fetchArgs };
|
|
327
362
|
const url = interpolatePrompt(cfg.url, urlContext);
|
|
328
363
|
try {
|
|
329
|
-
resultValue = doFetchApi(url, method, headers, cacheTimeoutSec
|
|
364
|
+
resultValue = doFetchApi(url, method, headers, cacheTimeoutSec);
|
|
330
365
|
} catch (err) {
|
|
331
|
-
|
|
366
|
+
failRef(`url failed: ${err.message}`, callback);
|
|
332
367
|
}
|
|
333
368
|
|
|
334
369
|
} else if (sourceDef['url-list']) {
|
|
@@ -346,15 +381,15 @@ function runSourceFetchSubcommand(argv) {
|
|
|
346
381
|
? sourceDef._projections.url_list : null;
|
|
347
382
|
|
|
348
383
|
if (!urlList || urlList.length === 0) {
|
|
349
|
-
|
|
384
|
+
failRef('url-list: _projections.url_list must be a non-empty string array', callback);
|
|
350
385
|
}
|
|
351
386
|
|
|
352
387
|
const results = [];
|
|
353
388
|
for (const u of urlList) {
|
|
354
389
|
try {
|
|
355
|
-
results.push(doFetchApi(u, method, headers, cacheTimeoutSec
|
|
390
|
+
results.push(doFetchApi(u, method, headers, cacheTimeoutSec));
|
|
356
391
|
} catch (err) {
|
|
357
|
-
|
|
392
|
+
failRef(`url-list fetch failed for ${u}: ${err.message}`, callback);
|
|
358
393
|
}
|
|
359
394
|
}
|
|
360
395
|
resultValue = results;
|
|
@@ -362,7 +397,7 @@ function runSourceFetchSubcommand(argv) {
|
|
|
362
397
|
} else if (sourceDef.copilot || sourceDef.prompt_template) {
|
|
363
398
|
const prompt = resolveCopilotPrompt(sourceDef);
|
|
364
399
|
if (!prompt) {
|
|
365
|
-
|
|
400
|
+
failRef('Source definition missing copilot.prompt_template (or prompt_template)', callback);
|
|
366
401
|
}
|
|
367
402
|
|
|
368
403
|
// Use boardSetupRoot (from --extra) as copilot working directory
|
|
@@ -382,11 +417,11 @@ function runSourceFetchSubcommand(argv) {
|
|
|
382
417
|
'copilot-sessions',
|
|
383
418
|
String(sourceDef.bindTo || 'default').replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
384
419
|
);
|
|
385
|
-
const wrapperOutFile =
|
|
420
|
+
const wrapperOutFile = outRef.value + '.wrapper-out.json';
|
|
386
421
|
try {
|
|
387
422
|
resultValue = runCopilotViaWrapper(prompt, sourceDef, wrapperOutFile, sessionDir, copilotCwd);
|
|
388
423
|
} catch (err) {
|
|
389
|
-
|
|
424
|
+
failRef(`copilot invocation failed: ${String(err && err.message || err)}`, callback);
|
|
390
425
|
} finally {
|
|
391
426
|
try { fs.unlinkSync(wrapperOutFile); } catch {}
|
|
392
427
|
}
|
|
@@ -402,7 +437,7 @@ function runSourceFetchSubcommand(argv) {
|
|
|
402
437
|
...(copilotCwd ? { cwd: copilotCwd } : {}),
|
|
403
438
|
});
|
|
404
439
|
} catch (err) {
|
|
405
|
-
|
|
440
|
+
failRef(`copilot invocation failed: ${String(err && err.message || err)}`, callback);
|
|
406
441
|
}
|
|
407
442
|
// Basic JSON extraction: find first { or [ in output
|
|
408
443
|
const firstBrace = rawOutput.indexOf('{');
|
|
@@ -424,17 +459,17 @@ function runSourceFetchSubcommand(argv) {
|
|
|
424
459
|
} else if (sourceDef.workiq) {
|
|
425
460
|
const cfg = typeof sourceDef.workiq === 'object' ? sourceDef.workiq : {};
|
|
426
461
|
if (!cfg.query_template || typeof cfg.query_template !== 'string') {
|
|
427
|
-
|
|
462
|
+
failRef('Source definition missing workiq.query_template', callback);
|
|
428
463
|
}
|
|
429
464
|
const interpolationContext = { ...sourceDef._projections, ...(cfg.args ?? {}) };
|
|
430
465
|
const query = interpolatePrompt(cfg.query_template, interpolationContext);
|
|
431
466
|
|
|
432
467
|
const wrapperPath = path.join(__dirname, 'scripts', 'workiq_wrapper.mjs');
|
|
433
468
|
if (!fs.existsSync(wrapperPath)) {
|
|
434
|
-
|
|
469
|
+
failRef('workiq source kind requires workiq_wrapper.js in scripts/', callback);
|
|
435
470
|
}
|
|
436
471
|
try {
|
|
437
|
-
execFileSync(process.execPath, [wrapperPath,
|
|
472
|
+
execFileSync(process.execPath, [wrapperPath, outRef.value], {
|
|
438
473
|
encoding: 'utf-8',
|
|
439
474
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
440
475
|
maxBuffer: 10 * 1024 * 1024,
|
|
@@ -444,25 +479,34 @@ function runSourceFetchSubcommand(argv) {
|
|
|
444
479
|
...(extra.serverUrl ? { WORKIQ_SERVER_URL: extra.serverUrl } : {}),
|
|
445
480
|
},
|
|
446
481
|
});
|
|
447
|
-
return; // wrapper wrote directly to
|
|
482
|
+
return; // wrapper wrote directly to out file
|
|
448
483
|
} catch (err) {
|
|
449
|
-
|
|
484
|
+
failRef(`workiq invocation failed: ${String(err && err.message || err)}`, callback);
|
|
450
485
|
}
|
|
451
486
|
} else if (sourceDef.mock) {
|
|
452
487
|
// MOCK_DB lookup — data hardcoded at the top of this file
|
|
453
488
|
resultValue = MOCK_DB[sourceDef.mock];
|
|
454
489
|
if (resultValue === undefined) {
|
|
455
|
-
|
|
490
|
+
failRef(`Key "${sourceDef.mock}" not found in MOCK_DB`, callback);
|
|
456
491
|
}
|
|
457
492
|
} else {
|
|
458
|
-
|
|
493
|
+
failRef('Source definition has no recognised kind (url, url-list, copilot, workiq, mock)', callback);
|
|
459
494
|
}
|
|
460
495
|
|
|
461
|
-
// Write result to --out
|
|
496
|
+
// Write result to --out via storage abstraction, then report back to board.
|
|
462
497
|
try {
|
|
463
|
-
|
|
498
|
+
outStorage.write(outRef.value, JSON.stringify(resultValue, null, 2));
|
|
464
499
|
} catch (err) {
|
|
465
|
-
|
|
500
|
+
failRef(`Cannot write output: ${String(err && err.message || err)}`, callback);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
if (callback) {
|
|
504
|
+
try {
|
|
505
|
+
reportComplete(callback, outRef);
|
|
506
|
+
} catch (err) {
|
|
507
|
+
console.error(`[demo-task-executor] reportComplete failed: ${String(err && err.message || err)}`);
|
|
508
|
+
process.exit(1);
|
|
509
|
+
}
|
|
466
510
|
}
|
|
467
511
|
|
|
468
512
|
}
|
|
@@ -650,6 +694,8 @@ const CAPABILITIES = {
|
|
|
650
694
|
runtimeStatusDir: { type: 'string', description: 'Relative path to runtime-out dir.' },
|
|
651
695
|
cardsDir: { type: 'string', description: 'Relative path to cards dir.' },
|
|
652
696
|
serverUrl: { type: 'string', description: 'Base URL of the hosting server (e.g. http://127.0.0.1:7799). Used by source kinds that call server-side proxy endpoints.' },
|
|
697
|
+
boardLiveCardsCliJs: { type: 'string', description: 'Absolute path to board-live-cards-cli.js when configured by the runtime.' },
|
|
698
|
+
stepMachineCliPath: { type: 'string', description: 'Absolute path to step-machine-cli.js when configured by the runtime.' },
|
|
653
699
|
},
|
|
654
700
|
},
|
|
655
701
|
};
|
package/examples/index.html
CHANGED
|
@@ -454,19 +454,6 @@
|
|
|
454
454
|
<div class="command"><code>Open browser/step-machine-browser/index.html</code><button class="copy-btn" data-copy="browser/step-machine-browser/index.html">Copy path</button></div>
|
|
455
455
|
</article>
|
|
456
456
|
|
|
457
|
-
<article class="example-card" data-surface="browser" data-model="livecards" data-search="portfolio tracker browser boards portfolio-tracker node javascript board-live-cards cli">
|
|
458
|
-
<div class="chip-row"><span class="chip">Browser support</span><span class="chip">LiveCards</span><span class="chip advanced">Advanced</span></div>
|
|
459
|
-
<h3>Portfolio Tracker Board Driver</h3>
|
|
460
|
-
<p>Node-driven portfolio tracker demo that exercises end-to-end board-live-cards orchestration for a browser-facing board workflow.</p>
|
|
461
|
-
<div class="command"><code>node examples/browser/boards/portfolio-tracker/portfolio-tracker.js</code><button class="copy-btn" data-copy="node examples/browser/boards/portfolio-tracker/portfolio-tracker.js">Copy</button></div>
|
|
462
|
-
</article>
|
|
463
|
-
|
|
464
|
-
<article class="example-card" data-surface="browser" data-model="livecards" data-search="portfolio tracker task-executor external source cli delegation custom">
|
|
465
|
-
<div class="chip-row"><span class="chip">Browser support</span><span class="chip">LiveCards</span><span class="chip">Task-Executor</span></div>
|
|
466
|
-
<h3>Portfolio Tracker with Task-Executor</h3>
|
|
467
|
-
<p>Portfolio tracker with external source execution via task-executor. Demonstrates delegating source.cli execution to a custom executor script.</p>
|
|
468
|
-
<div class="command"><code>node examples/browser/boards/portfolio-tracker/portfolio-tracker.js --task-executor "node C:\path\to\portfolio-tracker-task-executor.cjs"</code><button class="copy-btn" data-copy="node examples/browser/boards/portfolio-tracker/portfolio-tracker.js --task-executor "node C:\path\to\portfolio-tracker-task-executor.cjs"">Copy</button></div>
|
|
469
|
-
</article>
|
|
470
457
|
</div>
|
|
471
458
|
</div>
|
|
472
459
|
</section>
|
|
@@ -708,7 +695,6 @@
|
|
|
708
695
|
<tbody>
|
|
709
696
|
<tr data-surface="browser" data-model="livecards"><td><a href="example-board/demo-shell.html"><code>examples/example-board/demo-shell.html</code></a></td><td>Browser</td><td>LiveCards</td><td><code>Open example-board/demo-shell.html</code></td><td>Maintained example-board browser demo for board/canvas rendering and compute-backed cards</td></tr>
|
|
710
697
|
<tr data-surface="browser" data-model="step-machine"><td><a href="browser/step-machine-browser/index.html"><code>examples/browser/step-machine-browser/index.html</code></a></td><td>Browser</td><td>Step Machine</td><td><code>Open browser/step-machine-browser/index.html</code></td><td>Simple browser-side step-machine demo</td></tr>
|
|
711
|
-
<tr data-surface="browser" data-model="livecards"><td><code>examples/browser/boards/portfolio-tracker/portfolio-tracker.js</code></td><td>Browser support</td><td>LiveCards</td><td><code>node examples/browser/boards/portfolio-tracker/portfolio-tracker.js</code></td><td>End-to-end board-live-cards portfolio driver</td></tr>
|
|
712
698
|
<tr data-surface="cli" data-model="step-machine"><td><code>examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat</code></td><td>CLI</td><td>Step Machine</td><td><code>run-portfolio-tracker.bat</code></td><td>Portfolio tracker YAML flow orchestration</td></tr>
|
|
713
699
|
<tr data-surface="cli" data-model="step-machine"><td><code>examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml</code></td><td>CLI</td><td>Step Machine</td><td><code>node step-machine-cli.js examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml --initial-data '{...baseline...}'</code></td><td>Direct baseline portfolio tracker invocation</td></tr>
|
|
714
700
|
<tr data-surface="cli" data-model="step-machine"><td><code>examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml</code></td><td>CLI</td><td>Step Machine</td><td><code>node step-machine-cli.js examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml --initial-data '{...price-shock...}'</code></td><td>Direct price-shock portfolio tracker invocation</td></tr>
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
setlocal
|
|
3
3
|
cd /d "%~dp0"
|
|
4
4
|
|
|
5
|
-
set "BOARD_LIVE_CARDS_NO_SPAWN=1"
|
|
6
5
|
set "EXAMPLE_TEMP_ROOT=%TEMP%\yaml-flow-step-machine-portfolio-tracker"
|
|
7
6
|
set "STORE_DIR=%EXAMPLE_TEMP_ROOT%\store"
|
|
8
7
|
set "RUNTIME_ROOT=%EXAMPLE_TEMP_ROOT%\runtime"
|
|
@@ -25,5 +24,5 @@ node ..\..\..\step-machine-cli.js --store file --store-dir "%STORE_DIR%" --statu
|
|
|
25
24
|
exit /b %ERRORLEVEL%
|
|
26
25
|
|
|
27
26
|
: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
|
|
27
|
+
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});process.exit(r.status??1);"
|
|
29
28
|
exit /b %ERRORLEVEL%
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yaml-flow",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.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",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"bin": {
|
|
12
12
|
"board-live-cards-cli": "./board-live-cards-cli.js",
|
|
13
|
+
"card-store": "./card-store.js",
|
|
13
14
|
"step-machine-cli": "./step-machine-cli.js"
|
|
14
15
|
},
|
|
15
16
|
"exports": {
|
|
@@ -83,6 +84,28 @@
|
|
|
83
84
|
"import": "./dist/runtime-artifacts/index.js",
|
|
84
85
|
"require": "./dist/runtime-artifacts/index.cjs"
|
|
85
86
|
},
|
|
87
|
+
"./storage-refs": {
|
|
88
|
+
"types": "./dist/storage-refs.d.ts",
|
|
89
|
+
"import": "./dist/storage-refs.js",
|
|
90
|
+
"require": "./dist/storage-refs.cjs"
|
|
91
|
+
},
|
|
92
|
+
"./execution-refs": {
|
|
93
|
+
"types": "./dist/execution-refs.d.ts",
|
|
94
|
+
"import": "./dist/execution-refs.js",
|
|
95
|
+
"require": "./dist/execution-refs.cjs"
|
|
96
|
+
},
|
|
97
|
+
"./board-live-cards-browser": {
|
|
98
|
+
"types": "./dist/cli/browser-api/board-live-cards-browser-adapter.d.ts",
|
|
99
|
+
"import": "./dist/cli/browser-api/board-live-cards-browser-adapter.js"
|
|
100
|
+
},
|
|
101
|
+
"./board-live-cards-node": {
|
|
102
|
+
"types": "./dist/cli/node/fs-board-adapter.d.ts",
|
|
103
|
+
"import": "./dist/cli/node/fs-board-adapter.js"
|
|
104
|
+
},
|
|
105
|
+
"./card-store-browser": {
|
|
106
|
+
"types": "./dist/cli/browser-api/card-store-browser-api.d.ts",
|
|
107
|
+
"import": "./dist/cli/browser-api/card-store-browser-api.js"
|
|
108
|
+
},
|
|
86
109
|
"./board-livecards-server-runtime": "./board-livecards-server-runtime.js",
|
|
87
110
|
"./package.json": "./package.json"
|
|
88
111
|
},
|
|
@@ -91,6 +114,7 @@
|
|
|
91
114
|
},
|
|
92
115
|
"files": [
|
|
93
116
|
"board-live-cards-cli.js",
|
|
117
|
+
"storage-refs.js",
|
|
94
118
|
"step-machine-cli.js",
|
|
95
119
|
"board-livecards-server-runtime.js",
|
|
96
120
|
"dist",
|
|
@@ -100,17 +124,29 @@
|
|
|
100
124
|
],
|
|
101
125
|
"scripts": {
|
|
102
126
|
"build": "tsup",
|
|
103
|
-
"build:browser": "tsup --config tsup.browser.config.ts",
|
|
127
|
+
"build:browser": "tsup --config tsup.browser.config.ts && node scripts/generate-browser-integrity.mjs",
|
|
128
|
+
"build:quickjs": "tsup --config tsup.quickjs.config.ts",
|
|
129
|
+
"check:bundle-budget": "node scripts/check-bundle-budgets.mjs",
|
|
130
|
+
"check:browser-bundle": "node scripts/check-browser-bundle-safety.mjs",
|
|
131
|
+
"release:gate": "npm run -s build && npm run -s build:browser && npm run -s build:quickjs && npm run -s test:run && npm run -s check:bundle-budget && npm run -s check:browser-bundle",
|
|
132
|
+
"standalone": "npm run -s test:cli-parity && npm run -s build && npm run -s build:quickjs && node scripts/build-standalone.mjs",
|
|
133
|
+
"pycli:install": "python -m pip install -r pycli/requirements.txt",
|
|
134
|
+
"pycli:install:venv": "c:/Users/sreenaga/ADO/ai-tool-evolver/.venv/Scripts/python.exe -m pip install -r pycli/requirements.txt",
|
|
135
|
+
"pycli:install:py312": "py -3.12 -m pip install -r pycli/requirements.txt",
|
|
136
|
+
"pycli:install:venv312": "./.venv312/Scripts/python.exe -m pip install -r pycli/requirements.txt",
|
|
104
137
|
"build:example": "node demo-src/example-board/build.js",
|
|
105
138
|
"dev": "tsup --watch",
|
|
106
139
|
"test": "vitest",
|
|
107
140
|
"test:run": "vitest run",
|
|
141
|
+
"test:cli-parity": "npm run -s build:quickjs && python scripts/cli_parity_check.py",
|
|
142
|
+
"test:cli-parity:full": "npm run -s build:quickjs && python scripts/cli_parity_check.py --include-portfolio",
|
|
143
|
+
"test:e2e": "npm run -s build:quickjs && .\\.venv312\\Scripts\\python.exe examples/browser/boards/portfolio-tracker/portfolio-tracker.py --run-pycli",
|
|
108
144
|
"test:example-board": "vitest run tests/examples/example-board.test.ts",
|
|
109
145
|
"check:example-board": "npm run test:example-board && npm run validate:cards -- \"examples/example-board/cards/*.json\"",
|
|
110
146
|
"validate:cards": "tsx scripts/validate-live-cards.ts",
|
|
111
147
|
"lint": "eslint src/",
|
|
112
148
|
"typecheck": "tsc --noEmit",
|
|
113
|
-
"prepublishOnly": "npm run build && npm run build:browser"
|
|
149
|
+
"prepublishOnly": "npm run build && npm run build:browser && npm run build:quickjs && npm run check:bundle-budget && npm run check:browser-bundle"
|
|
114
150
|
},
|
|
115
151
|
"devDependencies": {
|
|
116
152
|
"@types/node": "^20.10.0",
|