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
|
@@ -3,8 +3,8 @@ export { B as BlockedTask, P as PendingTask, S as ScheduleResult, d as Unresolve
|
|
|
3
3
|
import { T as TaskConfig, f as GraphEvent, G as GraphConfig } from '../types-BBhqYGhE.cjs';
|
|
4
4
|
export { c as ExecutionState, e as GraphEngineStore, g as GraphSettings } from '../types-BBhqYGhE.cjs';
|
|
5
5
|
export { s as schedule } from '../schedule-qWNL0RQh.cjs';
|
|
6
|
-
import { R as ReactiveGraph, e as TaskHandlerInput, T as TaskHandlerFn } from '../live-cards-bridge-
|
|
7
|
-
export { L as LiveBoard, a as LiveCard, b as LiveCardsToReactiveOptions, c as LiveCardsToReactiveResult, d as ReactiveGraphOptions, f as TaskHandlerReturn, h as computeDataHash, g as createReactiveGraph, l as liveCardsToReactiveGraph } from '../live-cards-bridge-
|
|
6
|
+
import { R as ReactiveGraph, e as TaskHandlerInput, T as TaskHandlerFn } from '../live-cards-bridge-x5XREkXm.cjs';
|
|
7
|
+
export { L as LiveBoard, a as LiveCard, b as LiveCardsToReactiveOptions, c as LiveCardsToReactiveResult, d as ReactiveGraphOptions, f as TaskHandlerReturn, h as computeDataHash, g as createReactiveGraph, l as liveCardsToReactiveGraph } from '../live-cards-bridge-x5XREkXm.cjs';
|
|
8
8
|
import { a as GraphValidationResult } from '../validate-Dbu7ygys.cjs';
|
|
9
9
|
export { J as Journal, M as MemoryJournal } from '../journal-B-JCfQnh.cjs';
|
|
10
10
|
|
|
@@ -3,8 +3,8 @@ export { B as BlockedTask, P as PendingTask, S as ScheduleResult, d as Unresolve
|
|
|
3
3
|
import { T as TaskConfig, f as GraphEvent, G as GraphConfig } from '../types-BBhqYGhE.js';
|
|
4
4
|
export { c as ExecutionState, e as GraphEngineStore, g as GraphSettings } from '../types-BBhqYGhE.js';
|
|
5
5
|
export { s as schedule } from '../schedule-Cszq9LYY.js';
|
|
6
|
-
import { R as ReactiveGraph, e as TaskHandlerInput, T as TaskHandlerFn } from '../live-cards-bridge-
|
|
7
|
-
export { L as LiveBoard, a as LiveCard, b as LiveCardsToReactiveOptions, c as LiveCardsToReactiveResult, d as ReactiveGraphOptions, f as TaskHandlerReturn, h as computeDataHash, g as createReactiveGraph, l as liveCardsToReactiveGraph } from '../live-cards-bridge-
|
|
6
|
+
import { R as ReactiveGraph, e as TaskHandlerInput, T as TaskHandlerFn } from '../live-cards-bridge-EQjytzI_.js';
|
|
7
|
+
export { L as LiveBoard, a as LiveCard, b as LiveCardsToReactiveOptions, c as LiveCardsToReactiveResult, d as ReactiveGraphOptions, f as TaskHandlerReturn, h as computeDataHash, g as createReactiveGraph, l as liveCardsToReactiveGraph } from '../live-cards-bridge-EQjytzI_.js';
|
|
8
8
|
import { a as GraphValidationResult } from '../validate-BAVzUJWa.js';
|
|
9
9
|
export { J as Journal, M as MemoryJournal } from '../journal-9HEgs7dU.js';
|
|
10
10
|
|
|
@@ -1113,6 +1113,7 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1113
1113
|
const inputQueue = new MemoryJournal();
|
|
1114
1114
|
let live = "state" in configOrLive && "config" in configOrLive ? configOrLive : createLiveGraph(configOrLive, executionId);
|
|
1115
1115
|
let disposed = false;
|
|
1116
|
+
const pendingHandlers = /* @__PURE__ */ new Set();
|
|
1116
1117
|
const handlers = new Map(Object.entries(initialHandlers));
|
|
1117
1118
|
const internalJournal = new MemoryJournal();
|
|
1118
1119
|
let draining = false;
|
|
@@ -1155,7 +1156,7 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1155
1156
|
const taskState = live.state.tasks[taskName];
|
|
1156
1157
|
if (!taskState || taskState.status !== "running") continue;
|
|
1157
1158
|
const callbackToken = encodeCallbackToken(taskName);
|
|
1158
|
-
runPipeline(taskName, callbackToken, update).catch((error) => {
|
|
1159
|
+
const p = runPipeline(taskName, callbackToken, update).catch((error) => {
|
|
1159
1160
|
if (disposed) return;
|
|
1160
1161
|
internalJournal.append({
|
|
1161
1162
|
type: "task-failed",
|
|
@@ -1164,7 +1165,10 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1164
1165
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1165
1166
|
});
|
|
1166
1167
|
drain();
|
|
1168
|
+
}).finally(() => {
|
|
1169
|
+
pendingHandlers.delete(p);
|
|
1167
1170
|
});
|
|
1171
|
+
pendingHandlers.add(p);
|
|
1168
1172
|
}
|
|
1169
1173
|
}
|
|
1170
1174
|
}
|
|
@@ -1224,7 +1228,7 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1224
1228
|
});
|
|
1225
1229
|
drain();
|
|
1226
1230
|
const callbackToken = encodeCallbackToken(taskName);
|
|
1227
|
-
runPipeline(taskName, callbackToken).catch((error) => {
|
|
1231
|
+
const p = runPipeline(taskName, callbackToken).catch((error) => {
|
|
1228
1232
|
if (disposed) return;
|
|
1229
1233
|
internalJournal.append({
|
|
1230
1234
|
type: "task-failed",
|
|
@@ -1233,7 +1237,10 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1233
1237
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1234
1238
|
});
|
|
1235
1239
|
drain();
|
|
1240
|
+
}).finally(() => {
|
|
1241
|
+
pendingHandlers.delete(p);
|
|
1236
1242
|
});
|
|
1243
|
+
pendingHandlers.add(p);
|
|
1237
1244
|
}
|
|
1238
1245
|
return {
|
|
1239
1246
|
push(event) {
|
|
@@ -1347,7 +1354,10 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1347
1354
|
getSchedule() {
|
|
1348
1355
|
return schedule(live);
|
|
1349
1356
|
},
|
|
1350
|
-
dispose() {
|
|
1357
|
+
async dispose(options2) {
|
|
1358
|
+
if (options2?.wait && pendingHandlers.size > 0) {
|
|
1359
|
+
await Promise.allSettled([...pendingHandlers]);
|
|
1360
|
+
}
|
|
1351
1361
|
disposed = true;
|
|
1352
1362
|
}
|
|
1353
1363
|
};
|
|
@@ -1764,6 +1774,7 @@ function resolve(node, path) {
|
|
|
1764
1774
|
var VALID_ELEMENT_KINDS = /* @__PURE__ */ new Set([
|
|
1765
1775
|
"metric",
|
|
1766
1776
|
"table",
|
|
1777
|
+
"editable-table",
|
|
1767
1778
|
"chart",
|
|
1768
1779
|
"form",
|
|
1769
1780
|
"filter",
|
|
@@ -1775,9 +1786,11 @@ var VALID_ELEMENT_KINDS = /* @__PURE__ */ new Set([
|
|
|
1775
1786
|
"badge",
|
|
1776
1787
|
"text",
|
|
1777
1788
|
"markdown",
|
|
1778
|
-
"
|
|
1789
|
+
"ref",
|
|
1790
|
+
"custom",
|
|
1791
|
+
"actions"
|
|
1779
1792
|
]);
|
|
1780
|
-
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "
|
|
1793
|
+
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "source_defs"]);
|
|
1781
1794
|
function validateNode(node) {
|
|
1782
1795
|
const errors = [];
|
|
1783
1796
|
if (!node || typeof node !== "object" || Array.isArray(node)) {
|
|
@@ -1803,15 +1816,15 @@ function validateNode(node) {
|
|
|
1803
1816
|
if (n.requires != null && !Array.isArray(n.requires)) errors.push("requires: must be an array of strings");
|
|
1804
1817
|
if (n.provides != null) {
|
|
1805
1818
|
if (!Array.isArray(n.provides)) {
|
|
1806
|
-
errors.push("provides: must be an array of { bindTo,
|
|
1819
|
+
errors.push("provides: must be an array of { bindTo, ref } bindings");
|
|
1807
1820
|
} else {
|
|
1808
1821
|
n.provides.forEach((p, i) => {
|
|
1809
1822
|
if (!p || typeof p !== "object" || Array.isArray(p)) {
|
|
1810
|
-
errors.push(`provides[${i}]: must be an object with bindTo and
|
|
1823
|
+
errors.push(`provides[${i}]: must be an object with bindTo and ref`);
|
|
1811
1824
|
} else {
|
|
1812
1825
|
const b = p;
|
|
1813
1826
|
if (typeof b.bindTo !== "string" || !b.bindTo) errors.push(`provides[${i}]: missing required "bindTo" string`);
|
|
1814
|
-
if (typeof b.
|
|
1827
|
+
if (typeof b.ref !== "string" || !b.ref) errors.push(`provides[${i}]: missing required "ref" string`);
|
|
1815
1828
|
}
|
|
1816
1829
|
});
|
|
1817
1830
|
}
|
|
@@ -1831,35 +1844,35 @@ function validateNode(node) {
|
|
|
1831
1844
|
});
|
|
1832
1845
|
}
|
|
1833
1846
|
}
|
|
1834
|
-
if (n.
|
|
1835
|
-
if (!Array.isArray(n.
|
|
1836
|
-
errors.push("
|
|
1847
|
+
if (n.source_defs != null) {
|
|
1848
|
+
if (!Array.isArray(n.source_defs)) {
|
|
1849
|
+
errors.push("source_defs: must be an array");
|
|
1837
1850
|
} else {
|
|
1838
1851
|
const bindTos = /* @__PURE__ */ new Set();
|
|
1839
1852
|
const outputFiles = /* @__PURE__ */ new Set();
|
|
1840
|
-
n.
|
|
1853
|
+
n.source_defs.forEach((src, i) => {
|
|
1841
1854
|
if (!src || typeof src !== "object" || Array.isArray(src)) {
|
|
1842
|
-
errors.push(`
|
|
1855
|
+
errors.push(`source_defs[${i}]: must be an object`);
|
|
1843
1856
|
} else {
|
|
1844
1857
|
const s = src;
|
|
1845
1858
|
if (typeof s.bindTo !== "string" || !s.bindTo) {
|
|
1846
|
-
errors.push(`
|
|
1859
|
+
errors.push(`source_defs[${i}]: missing required "bindTo" property`);
|
|
1847
1860
|
} else {
|
|
1848
1861
|
if (bindTos.has(s.bindTo)) {
|
|
1849
|
-
errors.push(`
|
|
1862
|
+
errors.push(`source_defs[${i}]: bindTo "${s.bindTo}" is not unique across source_defs`);
|
|
1850
1863
|
}
|
|
1851
1864
|
bindTos.add(s.bindTo);
|
|
1852
1865
|
}
|
|
1853
1866
|
if (typeof s.outputFile !== "string" || !s.outputFile) {
|
|
1854
|
-
errors.push(`
|
|
1867
|
+
errors.push(`source_defs[${i}]: missing required "outputFile" property`);
|
|
1855
1868
|
} else {
|
|
1856
1869
|
if (outputFiles.has(s.outputFile)) {
|
|
1857
|
-
errors.push(`
|
|
1870
|
+
errors.push(`source_defs[${i}]: outputFile "${s.outputFile}" is not unique across source_defs`);
|
|
1858
1871
|
}
|
|
1859
1872
|
outputFiles.add(s.outputFile);
|
|
1860
1873
|
}
|
|
1861
1874
|
if (s.optionalForCompletionGating != null && typeof s.optionalForCompletionGating !== "boolean") {
|
|
1862
|
-
errors.push(`
|
|
1875
|
+
errors.push(`source_defs[${i}]: optionalForCompletionGating must be a boolean`);
|
|
1863
1876
|
}
|
|
1864
1877
|
}
|
|
1865
1878
|
});
|
|
@@ -1894,14 +1907,29 @@ function validateNode(node) {
|
|
|
1894
1907
|
}
|
|
1895
1908
|
return { ok: errors.length === 0, errors };
|
|
1896
1909
|
}
|
|
1897
|
-
function enrichSources(
|
|
1898
|
-
if (!
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1910
|
+
async function enrichSources(source_defs, context) {
|
|
1911
|
+
if (!source_defs || source_defs.length === 0) return [];
|
|
1912
|
+
const evalCtx = {
|
|
1913
|
+
card_data: context.card_data ?? {},
|
|
1914
|
+
requires: context.requires ?? {}
|
|
1915
|
+
};
|
|
1916
|
+
return Promise.all(
|
|
1917
|
+
source_defs.map(async (src) => {
|
|
1918
|
+
const _projections = {};
|
|
1919
|
+
if (src.projections && typeof src.projections === "object" && !Array.isArray(src.projections)) {
|
|
1920
|
+
for (const [key, expr] of Object.entries(src.projections)) {
|
|
1921
|
+
if (typeof expr === "string" && expr.trim().length > 0) {
|
|
1922
|
+
try {
|
|
1923
|
+
_projections[key] = await jsonata2(expr).evaluate(evalCtx);
|
|
1924
|
+
} catch {
|
|
1925
|
+
_projections[key] = void 0;
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
return { ...src, _projections };
|
|
1931
|
+
})
|
|
1932
|
+
);
|
|
1905
1933
|
}
|
|
1906
1934
|
var CardCompute = {
|
|
1907
1935
|
run,
|
|
@@ -1944,7 +1972,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
1944
1972
|
const allTokens = /* @__PURE__ */ new Set();
|
|
1945
1973
|
const tokenToCardId = /* @__PURE__ */ new Map();
|
|
1946
1974
|
for (const card of cards) {
|
|
1947
|
-
for (const binding of card.provides ?? [{ bindTo: card.id,
|
|
1975
|
+
for (const binding of card.provides ?? [{ bindTo: card.id, ref: "card_data" }]) {
|
|
1948
1976
|
allTokens.add(binding.bindTo);
|
|
1949
1977
|
tokenToCardId.set(binding.bindTo, card.id);
|
|
1950
1978
|
}
|
|
@@ -1958,7 +1986,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
1958
1986
|
}
|
|
1959
1987
|
tasks[card.id] = {
|
|
1960
1988
|
requires: requires.length > 0 ? requires : void 0,
|
|
1961
|
-
provides: (card.provides ?? [{ bindTo: card.id,
|
|
1989
|
+
provides: (card.provides ?? [{ bindTo: card.id, ref: "card_data" }]).map((p) => p.bindTo),
|
|
1962
1990
|
taskHandlers: [card.id],
|
|
1963
1991
|
description: card.meta?.title ?? card.id
|
|
1964
1992
|
};
|
|
@@ -1979,7 +2007,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
1979
2007
|
graphRef.resolveCallback(token, data, errors);
|
|
1980
2008
|
};
|
|
1981
2009
|
for (const card of cards) {
|
|
1982
|
-
if (card.
|
|
2010
|
+
if (card.source_defs && card.source_defs.length > 0) {
|
|
1983
2011
|
handlers[card.id] = buildSourceHandler(card, sourceHandlers, defaultSourceHandler, sharedState, getResolve);
|
|
1984
2012
|
} else {
|
|
1985
2013
|
handlers[card.id] = buildCardHandler(card, cardHandlers, sharedState, cardMap, tokenToCardId, getResolve);
|
|
@@ -2043,8 +2071,8 @@ function buildCardHandler(card, cardHandlers, sharedState, _cardMap, tokenToCard
|
|
|
2043
2071
|
let resultData;
|
|
2044
2072
|
if (card.provides && card.provides.length > 0) {
|
|
2045
2073
|
resultData = {};
|
|
2046
|
-
for (const { bindTo,
|
|
2047
|
-
resultData[bindTo] = CardCompute.resolve(computeNode,
|
|
2074
|
+
for (const { bindTo, ref } of card.provides) {
|
|
2075
|
+
resultData[bindTo] = CardCompute.resolve(computeNode, ref);
|
|
2048
2076
|
}
|
|
2049
2077
|
} else {
|
|
2050
2078
|
resultData = { ...computeNode.card_data, ...computeNode.computed_values };
|