yaml-flow 5.2.5 → 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.
- package/README.md +6 -6
- package/board-livecards-server-runtime.js +260 -35
- package/browser/board-livegraph-engine.js +57 -32
- package/browser/board-livegraph-engine.js.map +1 -1
- package/browser/card-compute.js +17 -17
- package/browser/live-cards.js +139 -12
- package/browser/live-cards.schema.json +14 -9
- package/dist/board-livegraph-runtime/index.cjs +57 -32
- 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 +57 -32
- package/dist/board-livegraph-runtime/index.js.map +1 -1
- package/dist/card-compute/index.cjs +96 -38
- 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 +96 -38
- package/dist/card-compute/index.js.map +1 -1
- package/dist/cli/board-live-cards-cli.cjs +7200 -201
- 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 +7199 -201
- package/dist/cli/board-live-cards-cli.js.map +1 -1
- package/dist/continuous-event-graph/index.cjs +55 -30
- 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 +55 -30
- package/dist/continuous-event-graph/index.js.map +1 -1
- package/dist/index.cjs +121 -53
- 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 +121 -53
- 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 +1 -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 +57 -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 +79 -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 +436 -246
- package/examples/example-board/scripts/copilot_wrapper.bat +157 -0
- package/examples/example-board/scripts/copilot_wrapper_helper.ps1 +190 -0
- 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 +14 -9
|
@@ -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
|
};
|
|
@@ -1783,7 +1793,7 @@ var VALID_ELEMENT_KINDS = /* @__PURE__ */ new Set([
|
|
|
1783
1793
|
"markdown",
|
|
1784
1794
|
"custom"
|
|
1785
1795
|
]);
|
|
1786
|
-
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "
|
|
1796
|
+
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "source_defs"]);
|
|
1787
1797
|
function validateNode(node) {
|
|
1788
1798
|
const errors = [];
|
|
1789
1799
|
if (!node || typeof node !== "object" || Array.isArray(node)) {
|
|
@@ -1809,15 +1819,15 @@ function validateNode(node) {
|
|
|
1809
1819
|
if (n.requires != null && !Array.isArray(n.requires)) errors.push("requires: must be an array of strings");
|
|
1810
1820
|
if (n.provides != null) {
|
|
1811
1821
|
if (!Array.isArray(n.provides)) {
|
|
1812
|
-
errors.push("provides: must be an array of { bindTo,
|
|
1822
|
+
errors.push("provides: must be an array of { bindTo, ref } bindings");
|
|
1813
1823
|
} else {
|
|
1814
1824
|
n.provides.forEach((p, i) => {
|
|
1815
1825
|
if (!p || typeof p !== "object" || Array.isArray(p)) {
|
|
1816
|
-
errors.push(`provides[${i}]: must be an object with bindTo and
|
|
1826
|
+
errors.push(`provides[${i}]: must be an object with bindTo and ref`);
|
|
1817
1827
|
} else {
|
|
1818
1828
|
const b = p;
|
|
1819
1829
|
if (typeof b.bindTo !== "string" || !b.bindTo) errors.push(`provides[${i}]: missing required "bindTo" string`);
|
|
1820
|
-
if (typeof b.
|
|
1830
|
+
if (typeof b.ref !== "string" || !b.ref) errors.push(`provides[${i}]: missing required "ref" string`);
|
|
1821
1831
|
}
|
|
1822
1832
|
});
|
|
1823
1833
|
}
|
|
@@ -1837,35 +1847,35 @@ function validateNode(node) {
|
|
|
1837
1847
|
});
|
|
1838
1848
|
}
|
|
1839
1849
|
}
|
|
1840
|
-
if (n.
|
|
1841
|
-
if (!Array.isArray(n.
|
|
1842
|
-
errors.push("
|
|
1850
|
+
if (n.source_defs != null) {
|
|
1851
|
+
if (!Array.isArray(n.source_defs)) {
|
|
1852
|
+
errors.push("source_defs: must be an array");
|
|
1843
1853
|
} else {
|
|
1844
1854
|
const bindTos = /* @__PURE__ */ new Set();
|
|
1845
1855
|
const outputFiles = /* @__PURE__ */ new Set();
|
|
1846
|
-
n.
|
|
1856
|
+
n.source_defs.forEach((src, i) => {
|
|
1847
1857
|
if (!src || typeof src !== "object" || Array.isArray(src)) {
|
|
1848
|
-
errors.push(`
|
|
1858
|
+
errors.push(`source_defs[${i}]: must be an object`);
|
|
1849
1859
|
} else {
|
|
1850
1860
|
const s = src;
|
|
1851
1861
|
if (typeof s.bindTo !== "string" || !s.bindTo) {
|
|
1852
|
-
errors.push(`
|
|
1862
|
+
errors.push(`source_defs[${i}]: missing required "bindTo" property`);
|
|
1853
1863
|
} else {
|
|
1854
1864
|
if (bindTos.has(s.bindTo)) {
|
|
1855
|
-
errors.push(`
|
|
1865
|
+
errors.push(`source_defs[${i}]: bindTo "${s.bindTo}" is not unique across source_defs`);
|
|
1856
1866
|
}
|
|
1857
1867
|
bindTos.add(s.bindTo);
|
|
1858
1868
|
}
|
|
1859
1869
|
if (typeof s.outputFile !== "string" || !s.outputFile) {
|
|
1860
|
-
errors.push(`
|
|
1870
|
+
errors.push(`source_defs[${i}]: missing required "outputFile" property`);
|
|
1861
1871
|
} else {
|
|
1862
1872
|
if (outputFiles.has(s.outputFile)) {
|
|
1863
|
-
errors.push(`
|
|
1873
|
+
errors.push(`source_defs[${i}]: outputFile "${s.outputFile}" is not unique across source_defs`);
|
|
1864
1874
|
}
|
|
1865
1875
|
outputFiles.add(s.outputFile);
|
|
1866
1876
|
}
|
|
1867
1877
|
if (s.optionalForCompletionGating != null && typeof s.optionalForCompletionGating !== "boolean") {
|
|
1868
|
-
errors.push(`
|
|
1878
|
+
errors.push(`source_defs[${i}]: optionalForCompletionGating must be a boolean`);
|
|
1869
1879
|
}
|
|
1870
1880
|
}
|
|
1871
1881
|
});
|
|
@@ -1900,14 +1910,29 @@ function validateNode(node) {
|
|
|
1900
1910
|
}
|
|
1901
1911
|
return { ok: errors.length === 0, errors };
|
|
1902
1912
|
}
|
|
1903
|
-
function enrichSources(
|
|
1904
|
-
if (!
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1913
|
+
async function enrichSources(source_defs, context) {
|
|
1914
|
+
if (!source_defs || source_defs.length === 0) return [];
|
|
1915
|
+
const evalCtx = {
|
|
1916
|
+
card_data: context.card_data ?? {},
|
|
1917
|
+
requires: context.requires ?? {}
|
|
1918
|
+
};
|
|
1919
|
+
return Promise.all(
|
|
1920
|
+
source_defs.map(async (src) => {
|
|
1921
|
+
const _projections = {};
|
|
1922
|
+
if (src.projections && typeof src.projections === "object" && !Array.isArray(src.projections)) {
|
|
1923
|
+
for (const [key, expr] of Object.entries(src.projections)) {
|
|
1924
|
+
if (typeof expr === "string" && expr.trim().length > 0) {
|
|
1925
|
+
try {
|
|
1926
|
+
_projections[key] = await jsonata2__default.default(expr).evaluate(evalCtx);
|
|
1927
|
+
} catch {
|
|
1928
|
+
_projections[key] = void 0;
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
return { ...src, _projections };
|
|
1934
|
+
})
|
|
1935
|
+
);
|
|
1911
1936
|
}
|
|
1912
1937
|
var CardCompute = {
|
|
1913
1938
|
run,
|
|
@@ -1950,7 +1975,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
1950
1975
|
const allTokens = /* @__PURE__ */ new Set();
|
|
1951
1976
|
const tokenToCardId = /* @__PURE__ */ new Map();
|
|
1952
1977
|
for (const card of cards) {
|
|
1953
|
-
for (const binding of card.provides ?? [{ bindTo: card.id,
|
|
1978
|
+
for (const binding of card.provides ?? [{ bindTo: card.id, ref: "card_data" }]) {
|
|
1954
1979
|
allTokens.add(binding.bindTo);
|
|
1955
1980
|
tokenToCardId.set(binding.bindTo, card.id);
|
|
1956
1981
|
}
|
|
@@ -1964,7 +1989,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
1964
1989
|
}
|
|
1965
1990
|
tasks[card.id] = {
|
|
1966
1991
|
requires: requires.length > 0 ? requires : void 0,
|
|
1967
|
-
provides: (card.provides ?? [{ bindTo: card.id,
|
|
1992
|
+
provides: (card.provides ?? [{ bindTo: card.id, ref: "card_data" }]).map((p) => p.bindTo),
|
|
1968
1993
|
taskHandlers: [card.id],
|
|
1969
1994
|
description: card.meta?.title ?? card.id
|
|
1970
1995
|
};
|
|
@@ -1985,7 +2010,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
1985
2010
|
graphRef.resolveCallback(token, data, errors);
|
|
1986
2011
|
};
|
|
1987
2012
|
for (const card of cards) {
|
|
1988
|
-
if (card.
|
|
2013
|
+
if (card.source_defs && card.source_defs.length > 0) {
|
|
1989
2014
|
handlers[card.id] = buildSourceHandler(card, sourceHandlers, defaultSourceHandler, sharedState, getResolve);
|
|
1990
2015
|
} else {
|
|
1991
2016
|
handlers[card.id] = buildCardHandler(card, cardHandlers, sharedState, cardMap, tokenToCardId, getResolve);
|
|
@@ -2049,8 +2074,8 @@ function buildCardHandler(card, cardHandlers, sharedState, _cardMap, tokenToCard
|
|
|
2049
2074
|
let resultData;
|
|
2050
2075
|
if (card.provides && card.provides.length > 0) {
|
|
2051
2076
|
resultData = {};
|
|
2052
|
-
for (const { bindTo,
|
|
2053
|
-
resultData[bindTo] = CardCompute.resolve(computeNode,
|
|
2077
|
+
for (const { bindTo, ref } of card.provides) {
|
|
2078
|
+
resultData[bindTo] = CardCompute.resolve(computeNode, ref);
|
|
2054
2079
|
}
|
|
2055
2080
|
} else {
|
|
2056
2081
|
resultData = { ...computeNode.card_data, ...computeNode.computed_values };
|