yaml-flow 5.2.6 → 5.3.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 +6 -6
- package/board-livecards-server-runtime.js +260 -35
- package/browser/board-livegraph-engine.js +61 -33
- package/browser/board-livegraph-engine.js.map +1 -1
- package/browser/card-compute.js +18 -18
- package/browser/live-cards.js +317 -156
- package/browser/live-cards.schema.json +15 -10
- package/dist/board-livegraph-runtime/index.cjs +61 -33
- package/dist/board-livegraph-runtime/index.cjs.map +1 -1
- package/dist/board-livegraph-runtime/index.d.cts +1 -1
- package/dist/board-livegraph-runtime/index.d.ts +1 -1
- package/dist/board-livegraph-runtime/index.js +61 -33
- package/dist/board-livegraph-runtime/index.js.map +1 -1
- package/dist/card-compute/index.cjs +101 -39
- package/dist/card-compute/index.cjs.map +1 -1
- package/dist/card-compute/index.d.cts +13 -8
- package/dist/card-compute/index.d.ts +13 -8
- package/dist/card-compute/index.js +101 -39
- package/dist/card-compute/index.js.map +1 -1
- package/dist/cli/board-live-cards-cli.cjs +7205 -202
- package/dist/cli/board-live-cards-cli.cjs.map +1 -1
- package/dist/cli/board-live-cards-cli.d.cts +6 -6
- package/dist/cli/board-live-cards-cli.d.ts +6 -6
- package/dist/cli/board-live-cards-cli.js +7204 -202
- package/dist/cli/board-live-cards-cli.js.map +1 -1
- package/dist/continuous-event-graph/index.cjs +59 -31
- package/dist/continuous-event-graph/index.cjs.map +1 -1
- package/dist/continuous-event-graph/index.d.cts +2 -2
- package/dist/continuous-event-graph/index.d.ts +2 -2
- package/dist/continuous-event-graph/index.js +59 -31
- package/dist/continuous-event-graph/index.js.map +1 -1
- package/dist/index.cjs +126 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +126 -54
- package/dist/index.js.map +1 -1
- package/dist/{live-cards-bridge-CeNxiVcm.d.ts → live-cards-bridge-EQjytzI_.d.ts} +10 -5
- package/dist/{live-cards-bridge-z_rJCSbi.d.cts → live-cards-bridge-x5XREkXm.d.cts} +10 -5
- package/examples/browser/boards/portfolio-tracker/cards/holdings-table.json +1 -1
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-form.json +1 -1
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-risk-assessment.json +1 -1
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-value.json +1 -1
- package/examples/browser/boards/portfolio-tracker/cards/price-fetch.json +2 -2
- package/examples/browser/boards/portfolio-tracker/cards/rebalancing-strategy.json +1 -1
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +10 -10
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +1 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +1 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +1 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +2 -2
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +1 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +1 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +1 -1
- package/examples/example-board/agent-instructions-cardlayout.md +29 -1
- package/examples/example-board/agent-instructions.md +271 -45
- package/examples/example-board/cards/card-concentration.json +8 -5
- package/examples/example-board/cards/card-market-prices.json +14 -9
- package/examples/example-board/cards/card-my-identity.json +28 -0
- package/examples/example-board/cards/card-portfolio-value.json +1 -1
- package/examples/example-board/cards/card-portfolio.json +1 -1
- package/examples/example-board/cards/card-rebalance-impact.json +65 -0
- package/examples/example-board/cards/card-rebalance-sim.json +67 -0
- package/examples/example-board/demo-chat-handler.js +2 -1
- package/examples/example-board/demo-server-config.json +6 -1
- package/examples/example-board/demo-server.js +91 -8
- package/examples/example-board/demo-shell-browser.html +6 -6
- package/examples/example-board/demo-shell-with-server.html +4 -4
- package/examples/example-board/demo-task-executor.js +457 -246
- package/examples/example-board/scripts/copilot_wrapper.bat +16 -0
- package/examples/example-board/scripts/copilot_wrapper_helper.ps1 +19 -10
- package/examples/example-board/scripts/workiq_wrapper.mjs +66 -0
- package/examples/npm-libs/continuous-event-graph/live-cards-board.ts +5 -5
- package/examples/npm-libs/continuous-event-graph/soc-incident-board.ts +3 -3
- package/examples/npm-libs/event-graph/research-pipeline.ts +5 -5
- package/examples/npm-libs/graph-of-graphs/multi-stage-etl.ts +9 -9
- package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +1 -1
- package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +1 -1
- package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +1 -1
- package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +3 -3
- package/examples/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +1 -1
- package/examples/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +1 -1
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +1 -1
- package/package.json +2 -2
- package/schema/live-cards.schema.json +15 -10
|
@@ -1119,6 +1119,7 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1119
1119
|
const inputQueue = new MemoryJournal();
|
|
1120
1120
|
let live = "state" in configOrLive && "config" in configOrLive ? configOrLive : createLiveGraph(configOrLive, executionId);
|
|
1121
1121
|
let disposed = false;
|
|
1122
|
+
const pendingHandlers = /* @__PURE__ */ new Set();
|
|
1122
1123
|
const handlers = new Map(Object.entries(initialHandlers));
|
|
1123
1124
|
const internalJournal = new MemoryJournal();
|
|
1124
1125
|
let draining = false;
|
|
@@ -1161,7 +1162,7 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1161
1162
|
const taskState = live.state.tasks[taskName];
|
|
1162
1163
|
if (!taskState || taskState.status !== "running") continue;
|
|
1163
1164
|
const callbackToken = encodeCallbackToken(taskName);
|
|
1164
|
-
runPipeline(taskName, callbackToken, update).catch((error) => {
|
|
1165
|
+
const p = runPipeline(taskName, callbackToken, update).catch((error) => {
|
|
1165
1166
|
if (disposed) return;
|
|
1166
1167
|
internalJournal.append({
|
|
1167
1168
|
type: "task-failed",
|
|
@@ -1170,7 +1171,10 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1170
1171
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1171
1172
|
});
|
|
1172
1173
|
drain();
|
|
1174
|
+
}).finally(() => {
|
|
1175
|
+
pendingHandlers.delete(p);
|
|
1173
1176
|
});
|
|
1177
|
+
pendingHandlers.add(p);
|
|
1174
1178
|
}
|
|
1175
1179
|
}
|
|
1176
1180
|
}
|
|
@@ -1230,7 +1234,7 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1230
1234
|
});
|
|
1231
1235
|
drain();
|
|
1232
1236
|
const callbackToken = encodeCallbackToken(taskName);
|
|
1233
|
-
runPipeline(taskName, callbackToken).catch((error) => {
|
|
1237
|
+
const p = runPipeline(taskName, callbackToken).catch((error) => {
|
|
1234
1238
|
if (disposed) return;
|
|
1235
1239
|
internalJournal.append({
|
|
1236
1240
|
type: "task-failed",
|
|
@@ -1239,7 +1243,10 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1239
1243
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1240
1244
|
});
|
|
1241
1245
|
drain();
|
|
1246
|
+
}).finally(() => {
|
|
1247
|
+
pendingHandlers.delete(p);
|
|
1242
1248
|
});
|
|
1249
|
+
pendingHandlers.add(p);
|
|
1243
1250
|
}
|
|
1244
1251
|
return {
|
|
1245
1252
|
push(event) {
|
|
@@ -1353,7 +1360,10 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1353
1360
|
getSchedule() {
|
|
1354
1361
|
return schedule(live);
|
|
1355
1362
|
},
|
|
1356
|
-
dispose() {
|
|
1363
|
+
async dispose(options2) {
|
|
1364
|
+
if (options2?.wait && pendingHandlers.size > 0) {
|
|
1365
|
+
await Promise.allSettled([...pendingHandlers]);
|
|
1366
|
+
}
|
|
1357
1367
|
disposed = true;
|
|
1358
1368
|
}
|
|
1359
1369
|
};
|
|
@@ -1770,6 +1780,7 @@ function resolve(node, path) {
|
|
|
1770
1780
|
var VALID_ELEMENT_KINDS = /* @__PURE__ */ new Set([
|
|
1771
1781
|
"metric",
|
|
1772
1782
|
"table",
|
|
1783
|
+
"editable-table",
|
|
1773
1784
|
"chart",
|
|
1774
1785
|
"form",
|
|
1775
1786
|
"filter",
|
|
@@ -1781,9 +1792,11 @@ var VALID_ELEMENT_KINDS = /* @__PURE__ */ new Set([
|
|
|
1781
1792
|
"badge",
|
|
1782
1793
|
"text",
|
|
1783
1794
|
"markdown",
|
|
1784
|
-
"
|
|
1795
|
+
"ref",
|
|
1796
|
+
"custom",
|
|
1797
|
+
"actions"
|
|
1785
1798
|
]);
|
|
1786
|
-
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "
|
|
1799
|
+
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "source_defs"]);
|
|
1787
1800
|
function validateNode(node) {
|
|
1788
1801
|
const errors = [];
|
|
1789
1802
|
if (!node || typeof node !== "object" || Array.isArray(node)) {
|
|
@@ -1809,15 +1822,15 @@ function validateNode(node) {
|
|
|
1809
1822
|
if (n.requires != null && !Array.isArray(n.requires)) errors.push("requires: must be an array of strings");
|
|
1810
1823
|
if (n.provides != null) {
|
|
1811
1824
|
if (!Array.isArray(n.provides)) {
|
|
1812
|
-
errors.push("provides: must be an array of { bindTo,
|
|
1825
|
+
errors.push("provides: must be an array of { bindTo, ref } bindings");
|
|
1813
1826
|
} else {
|
|
1814
1827
|
n.provides.forEach((p, i) => {
|
|
1815
1828
|
if (!p || typeof p !== "object" || Array.isArray(p)) {
|
|
1816
|
-
errors.push(`provides[${i}]: must be an object with bindTo and
|
|
1829
|
+
errors.push(`provides[${i}]: must be an object with bindTo and ref`);
|
|
1817
1830
|
} else {
|
|
1818
1831
|
const b = p;
|
|
1819
1832
|
if (typeof b.bindTo !== "string" || !b.bindTo) errors.push(`provides[${i}]: missing required "bindTo" string`);
|
|
1820
|
-
if (typeof b.
|
|
1833
|
+
if (typeof b.ref !== "string" || !b.ref) errors.push(`provides[${i}]: missing required "ref" string`);
|
|
1821
1834
|
}
|
|
1822
1835
|
});
|
|
1823
1836
|
}
|
|
@@ -1837,35 +1850,35 @@ function validateNode(node) {
|
|
|
1837
1850
|
});
|
|
1838
1851
|
}
|
|
1839
1852
|
}
|
|
1840
|
-
if (n.
|
|
1841
|
-
if (!Array.isArray(n.
|
|
1842
|
-
errors.push("
|
|
1853
|
+
if (n.source_defs != null) {
|
|
1854
|
+
if (!Array.isArray(n.source_defs)) {
|
|
1855
|
+
errors.push("source_defs: must be an array");
|
|
1843
1856
|
} else {
|
|
1844
1857
|
const bindTos = /* @__PURE__ */ new Set();
|
|
1845
1858
|
const outputFiles = /* @__PURE__ */ new Set();
|
|
1846
|
-
n.
|
|
1859
|
+
n.source_defs.forEach((src, i) => {
|
|
1847
1860
|
if (!src || typeof src !== "object" || Array.isArray(src)) {
|
|
1848
|
-
errors.push(`
|
|
1861
|
+
errors.push(`source_defs[${i}]: must be an object`);
|
|
1849
1862
|
} else {
|
|
1850
1863
|
const s = src;
|
|
1851
1864
|
if (typeof s.bindTo !== "string" || !s.bindTo) {
|
|
1852
|
-
errors.push(`
|
|
1865
|
+
errors.push(`source_defs[${i}]: missing required "bindTo" property`);
|
|
1853
1866
|
} else {
|
|
1854
1867
|
if (bindTos.has(s.bindTo)) {
|
|
1855
|
-
errors.push(`
|
|
1868
|
+
errors.push(`source_defs[${i}]: bindTo "${s.bindTo}" is not unique across source_defs`);
|
|
1856
1869
|
}
|
|
1857
1870
|
bindTos.add(s.bindTo);
|
|
1858
1871
|
}
|
|
1859
1872
|
if (typeof s.outputFile !== "string" || !s.outputFile) {
|
|
1860
|
-
errors.push(`
|
|
1873
|
+
errors.push(`source_defs[${i}]: missing required "outputFile" property`);
|
|
1861
1874
|
} else {
|
|
1862
1875
|
if (outputFiles.has(s.outputFile)) {
|
|
1863
|
-
errors.push(`
|
|
1876
|
+
errors.push(`source_defs[${i}]: outputFile "${s.outputFile}" is not unique across source_defs`);
|
|
1864
1877
|
}
|
|
1865
1878
|
outputFiles.add(s.outputFile);
|
|
1866
1879
|
}
|
|
1867
1880
|
if (s.optionalForCompletionGating != null && typeof s.optionalForCompletionGating !== "boolean") {
|
|
1868
|
-
errors.push(`
|
|
1881
|
+
errors.push(`source_defs[${i}]: optionalForCompletionGating must be a boolean`);
|
|
1869
1882
|
}
|
|
1870
1883
|
}
|
|
1871
1884
|
});
|
|
@@ -1900,14 +1913,29 @@ function validateNode(node) {
|
|
|
1900
1913
|
}
|
|
1901
1914
|
return { ok: errors.length === 0, errors };
|
|
1902
1915
|
}
|
|
1903
|
-
function enrichSources(
|
|
1904
|
-
if (!
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1916
|
+
async function enrichSources(source_defs, context) {
|
|
1917
|
+
if (!source_defs || source_defs.length === 0) return [];
|
|
1918
|
+
const evalCtx = {
|
|
1919
|
+
card_data: context.card_data ?? {},
|
|
1920
|
+
requires: context.requires ?? {}
|
|
1921
|
+
};
|
|
1922
|
+
return Promise.all(
|
|
1923
|
+
source_defs.map(async (src) => {
|
|
1924
|
+
const _projections = {};
|
|
1925
|
+
if (src.projections && typeof src.projections === "object" && !Array.isArray(src.projections)) {
|
|
1926
|
+
for (const [key, expr] of Object.entries(src.projections)) {
|
|
1927
|
+
if (typeof expr === "string" && expr.trim().length > 0) {
|
|
1928
|
+
try {
|
|
1929
|
+
_projections[key] = await jsonata2__default.default(expr).evaluate(evalCtx);
|
|
1930
|
+
} catch {
|
|
1931
|
+
_projections[key] = void 0;
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
return { ...src, _projections };
|
|
1937
|
+
})
|
|
1938
|
+
);
|
|
1911
1939
|
}
|
|
1912
1940
|
var CardCompute = {
|
|
1913
1941
|
run,
|
|
@@ -1950,7 +1978,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
1950
1978
|
const allTokens = /* @__PURE__ */ new Set();
|
|
1951
1979
|
const tokenToCardId = /* @__PURE__ */ new Map();
|
|
1952
1980
|
for (const card of cards) {
|
|
1953
|
-
for (const binding of card.provides ?? [{ bindTo: card.id,
|
|
1981
|
+
for (const binding of card.provides ?? [{ bindTo: card.id, ref: "card_data" }]) {
|
|
1954
1982
|
allTokens.add(binding.bindTo);
|
|
1955
1983
|
tokenToCardId.set(binding.bindTo, card.id);
|
|
1956
1984
|
}
|
|
@@ -1964,7 +1992,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
1964
1992
|
}
|
|
1965
1993
|
tasks[card.id] = {
|
|
1966
1994
|
requires: requires.length > 0 ? requires : void 0,
|
|
1967
|
-
provides: (card.provides ?? [{ bindTo: card.id,
|
|
1995
|
+
provides: (card.provides ?? [{ bindTo: card.id, ref: "card_data" }]).map((p) => p.bindTo),
|
|
1968
1996
|
taskHandlers: [card.id],
|
|
1969
1997
|
description: card.meta?.title ?? card.id
|
|
1970
1998
|
};
|
|
@@ -1985,7 +2013,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
1985
2013
|
graphRef.resolveCallback(token, data, errors);
|
|
1986
2014
|
};
|
|
1987
2015
|
for (const card of cards) {
|
|
1988
|
-
if (card.
|
|
2016
|
+
if (card.source_defs && card.source_defs.length > 0) {
|
|
1989
2017
|
handlers[card.id] = buildSourceHandler(card, sourceHandlers, defaultSourceHandler, sharedState, getResolve);
|
|
1990
2018
|
} else {
|
|
1991
2019
|
handlers[card.id] = buildCardHandler(card, cardHandlers, sharedState, cardMap, tokenToCardId, getResolve);
|
|
@@ -2049,8 +2077,8 @@ function buildCardHandler(card, cardHandlers, sharedState, _cardMap, tokenToCard
|
|
|
2049
2077
|
let resultData;
|
|
2050
2078
|
if (card.provides && card.provides.length > 0) {
|
|
2051
2079
|
resultData = {};
|
|
2052
|
-
for (const { bindTo,
|
|
2053
|
-
resultData[bindTo] = CardCompute.resolve(computeNode,
|
|
2080
|
+
for (const { bindTo, ref } of card.provides) {
|
|
2081
|
+
resultData[bindTo] = CardCompute.resolve(computeNode, ref);
|
|
2054
2082
|
}
|
|
2055
2083
|
} else {
|
|
2056
2084
|
resultData = { ...computeNode.card_data, ...computeNode.computed_values };
|