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
|
@@ -69,6 +69,7 @@ var BoardLiveGraph = (function (exports) {
|
|
|
69
69
|
var VALID_ELEMENT_KINDS = /* @__PURE__ */ new Set([
|
|
70
70
|
"metric",
|
|
71
71
|
"table",
|
|
72
|
+
"editable-table",
|
|
72
73
|
"chart",
|
|
73
74
|
"form",
|
|
74
75
|
"filter",
|
|
@@ -80,9 +81,11 @@ var BoardLiveGraph = (function (exports) {
|
|
|
80
81
|
"badge",
|
|
81
82
|
"text",
|
|
82
83
|
"markdown",
|
|
83
|
-
"
|
|
84
|
+
"ref",
|
|
85
|
+
"custom",
|
|
86
|
+
"actions"
|
|
84
87
|
]);
|
|
85
|
-
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "
|
|
88
|
+
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "source_defs"]);
|
|
86
89
|
function validateNode(node) {
|
|
87
90
|
const errors = [];
|
|
88
91
|
if (!node || typeof node !== "object" || Array.isArray(node)) {
|
|
@@ -108,15 +111,15 @@ var BoardLiveGraph = (function (exports) {
|
|
|
108
111
|
if (n.requires != null && !Array.isArray(n.requires)) errors.push("requires: must be an array of strings");
|
|
109
112
|
if (n.provides != null) {
|
|
110
113
|
if (!Array.isArray(n.provides)) {
|
|
111
|
-
errors.push("provides: must be an array of { bindTo,
|
|
114
|
+
errors.push("provides: must be an array of { bindTo, ref } bindings");
|
|
112
115
|
} else {
|
|
113
116
|
n.provides.forEach((p, i) => {
|
|
114
117
|
if (!p || typeof p !== "object" || Array.isArray(p)) {
|
|
115
|
-
errors.push(`provides[${i}]: must be an object with bindTo and
|
|
118
|
+
errors.push(`provides[${i}]: must be an object with bindTo and ref`);
|
|
116
119
|
} else {
|
|
117
120
|
const b = p;
|
|
118
121
|
if (typeof b.bindTo !== "string" || !b.bindTo) errors.push(`provides[${i}]: missing required "bindTo" string`);
|
|
119
|
-
if (typeof b.
|
|
122
|
+
if (typeof b.ref !== "string" || !b.ref) errors.push(`provides[${i}]: missing required "ref" string`);
|
|
120
123
|
}
|
|
121
124
|
});
|
|
122
125
|
}
|
|
@@ -136,35 +139,35 @@ var BoardLiveGraph = (function (exports) {
|
|
|
136
139
|
});
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
|
-
if (n.
|
|
140
|
-
if (!Array.isArray(n.
|
|
141
|
-
errors.push("
|
|
142
|
+
if (n.source_defs != null) {
|
|
143
|
+
if (!Array.isArray(n.source_defs)) {
|
|
144
|
+
errors.push("source_defs: must be an array");
|
|
142
145
|
} else {
|
|
143
146
|
const bindTos = /* @__PURE__ */ new Set();
|
|
144
147
|
const outputFiles = /* @__PURE__ */ new Set();
|
|
145
|
-
n.
|
|
148
|
+
n.source_defs.forEach((src, i) => {
|
|
146
149
|
if (!src || typeof src !== "object" || Array.isArray(src)) {
|
|
147
|
-
errors.push(`
|
|
150
|
+
errors.push(`source_defs[${i}]: must be an object`);
|
|
148
151
|
} else {
|
|
149
152
|
const s = src;
|
|
150
153
|
if (typeof s.bindTo !== "string" || !s.bindTo) {
|
|
151
|
-
errors.push(`
|
|
154
|
+
errors.push(`source_defs[${i}]: missing required "bindTo" property`);
|
|
152
155
|
} else {
|
|
153
156
|
if (bindTos.has(s.bindTo)) {
|
|
154
|
-
errors.push(`
|
|
157
|
+
errors.push(`source_defs[${i}]: bindTo "${s.bindTo}" is not unique across source_defs`);
|
|
155
158
|
}
|
|
156
159
|
bindTos.add(s.bindTo);
|
|
157
160
|
}
|
|
158
161
|
if (typeof s.outputFile !== "string" || !s.outputFile) {
|
|
159
|
-
errors.push(`
|
|
162
|
+
errors.push(`source_defs[${i}]: missing required "outputFile" property`);
|
|
160
163
|
} else {
|
|
161
164
|
if (outputFiles.has(s.outputFile)) {
|
|
162
|
-
errors.push(`
|
|
165
|
+
errors.push(`source_defs[${i}]: outputFile "${s.outputFile}" is not unique across source_defs`);
|
|
163
166
|
}
|
|
164
167
|
outputFiles.add(s.outputFile);
|
|
165
168
|
}
|
|
166
169
|
if (s.optionalForCompletionGating != null && typeof s.optionalForCompletionGating !== "boolean") {
|
|
167
|
-
errors.push(`
|
|
170
|
+
errors.push(`source_defs[${i}]: optionalForCompletionGating must be a boolean`);
|
|
168
171
|
}
|
|
169
172
|
}
|
|
170
173
|
});
|
|
@@ -199,14 +202,29 @@ var BoardLiveGraph = (function (exports) {
|
|
|
199
202
|
}
|
|
200
203
|
return { ok: errors.length === 0, errors };
|
|
201
204
|
}
|
|
202
|
-
function enrichSources(
|
|
203
|
-
if (!
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
async function enrichSources(source_defs, context) {
|
|
206
|
+
if (!source_defs || source_defs.length === 0) return [];
|
|
207
|
+
const evalCtx = {
|
|
208
|
+
card_data: context.card_data ?? {},
|
|
209
|
+
requires: context.requires ?? {}
|
|
210
|
+
};
|
|
211
|
+
return Promise.all(
|
|
212
|
+
source_defs.map(async (src) => {
|
|
213
|
+
const _projections = {};
|
|
214
|
+
if (src.projections && typeof src.projections === "object" && !Array.isArray(src.projections)) {
|
|
215
|
+
for (const [key, expr] of Object.entries(src.projections)) {
|
|
216
|
+
if (typeof expr === "string" && expr.trim().length > 0) {
|
|
217
|
+
try {
|
|
218
|
+
_projections[key] = await jsonata_shim_default(expr).evaluate(evalCtx);
|
|
219
|
+
} catch {
|
|
220
|
+
_projections[key] = void 0;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return { ...src, _projections };
|
|
226
|
+
})
|
|
227
|
+
);
|
|
210
228
|
}
|
|
211
229
|
var CardCompute = {
|
|
212
230
|
run,
|
|
@@ -909,6 +927,7 @@ var BoardLiveGraph = (function (exports) {
|
|
|
909
927
|
const inputQueue = new MemoryJournal();
|
|
910
928
|
let live = "state" in configOrLive && "config" in configOrLive ? configOrLive : createLiveGraph(configOrLive, executionId);
|
|
911
929
|
let disposed = false;
|
|
930
|
+
const pendingHandlers = /* @__PURE__ */ new Set();
|
|
912
931
|
const handlers = new Map(Object.entries(initialHandlers));
|
|
913
932
|
const internalJournal = new MemoryJournal();
|
|
914
933
|
let draining = false;
|
|
@@ -951,7 +970,7 @@ var BoardLiveGraph = (function (exports) {
|
|
|
951
970
|
const taskState = live.state.tasks[taskName];
|
|
952
971
|
if (!taskState || taskState.status !== "running") continue;
|
|
953
972
|
const callbackToken = encodeCallbackToken(taskName);
|
|
954
|
-
runPipeline(taskName, callbackToken, update).catch((error) => {
|
|
973
|
+
const p = runPipeline(taskName, callbackToken, update).catch((error) => {
|
|
955
974
|
if (disposed) return;
|
|
956
975
|
internalJournal.append({
|
|
957
976
|
type: "task-failed",
|
|
@@ -960,7 +979,10 @@ var BoardLiveGraph = (function (exports) {
|
|
|
960
979
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
961
980
|
});
|
|
962
981
|
drain();
|
|
982
|
+
}).finally(() => {
|
|
983
|
+
pendingHandlers.delete(p);
|
|
963
984
|
});
|
|
985
|
+
pendingHandlers.add(p);
|
|
964
986
|
}
|
|
965
987
|
}
|
|
966
988
|
}
|
|
@@ -1020,7 +1042,7 @@ var BoardLiveGraph = (function (exports) {
|
|
|
1020
1042
|
});
|
|
1021
1043
|
drain();
|
|
1022
1044
|
const callbackToken = encodeCallbackToken(taskName);
|
|
1023
|
-
runPipeline(taskName, callbackToken).catch((error) => {
|
|
1045
|
+
const p = runPipeline(taskName, callbackToken).catch((error) => {
|
|
1024
1046
|
if (disposed) return;
|
|
1025
1047
|
internalJournal.append({
|
|
1026
1048
|
type: "task-failed",
|
|
@@ -1029,7 +1051,10 @@ var BoardLiveGraph = (function (exports) {
|
|
|
1029
1051
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1030
1052
|
});
|
|
1031
1053
|
drain();
|
|
1054
|
+
}).finally(() => {
|
|
1055
|
+
pendingHandlers.delete(p);
|
|
1032
1056
|
});
|
|
1057
|
+
pendingHandlers.add(p);
|
|
1033
1058
|
}
|
|
1034
1059
|
return {
|
|
1035
1060
|
push(event) {
|
|
@@ -1143,7 +1168,10 @@ var BoardLiveGraph = (function (exports) {
|
|
|
1143
1168
|
getSchedule() {
|
|
1144
1169
|
return schedule(live);
|
|
1145
1170
|
},
|
|
1146
|
-
dispose() {
|
|
1171
|
+
async dispose(options2) {
|
|
1172
|
+
if (options2?.wait && pendingHandlers.size > 0) {
|
|
1173
|
+
await Promise.allSettled([...pendingHandlers]);
|
|
1174
|
+
}
|
|
1147
1175
|
disposed = true;
|
|
1148
1176
|
}
|
|
1149
1177
|
};
|
|
@@ -1165,7 +1193,7 @@ var BoardLiveGraph = (function (exports) {
|
|
|
1165
1193
|
function buildTokenProviders(cards) {
|
|
1166
1194
|
const tokenToCardId = /* @__PURE__ */ new Map();
|
|
1167
1195
|
for (const [cardId, card] of cards.entries()) {
|
|
1168
|
-
const bindings = card.provides && card.provides.length > 0 ? card.provides : [{ bindTo: cardId,
|
|
1196
|
+
const bindings = card.provides && card.provides.length > 0 ? card.provides : [{ bindTo: cardId, ref: "card_data" }];
|
|
1169
1197
|
for (const binding of bindings) tokenToCardId.set(binding.bindTo, cardId);
|
|
1170
1198
|
}
|
|
1171
1199
|
return tokenToCardId;
|
|
@@ -1311,14 +1339,14 @@ var BoardLiveGraph = (function (exports) {
|
|
|
1311
1339
|
requiresData[token] = providesData2[token];
|
|
1312
1340
|
}
|
|
1313
1341
|
const sourcesData = {};
|
|
1314
|
-
if (card.
|
|
1342
|
+
if (card.source_defs && card.source_defs.length > 0) {
|
|
1315
1343
|
const adapter = sourceAdapters[cardId] ?? defaultSourceAdapter;
|
|
1316
1344
|
const fetched = taskExecutor ? await taskExecutor({ card, input: inputArgs }) : adapter ? await adapter({ card, input: inputArgs }) : void 0;
|
|
1317
1345
|
if (fetched && typeof fetched === "object") {
|
|
1318
|
-
for (const src of card.
|
|
1346
|
+
for (const src of card.source_defs) {
|
|
1319
1347
|
if (Object.prototype.hasOwnProperty.call(fetched, src.bindTo)) {
|
|
1320
1348
|
sourcesData[src.bindTo] = fetched[src.bindTo];
|
|
1321
|
-
} else if (card.
|
|
1349
|
+
} else if (card.source_defs.length === 1) {
|
|
1322
1350
|
sourcesData[src.bindTo] = fetched;
|
|
1323
1351
|
}
|
|
1324
1352
|
}
|
|
@@ -1328,7 +1356,7 @@ var BoardLiveGraph = (function (exports) {
|
|
|
1328
1356
|
id: card.id,
|
|
1329
1357
|
card_data: deepClone(card.card_data ?? {}),
|
|
1330
1358
|
requires: requiresData,
|
|
1331
|
-
|
|
1359
|
+
source_defs: card.source_defs,
|
|
1332
1360
|
compute: card.compute
|
|
1333
1361
|
};
|
|
1334
1362
|
computeNode._sourcesData = sourcesData;
|
|
@@ -1337,8 +1365,8 @@ var BoardLiveGraph = (function (exports) {
|
|
|
1337
1365
|
}
|
|
1338
1366
|
const providesData = {};
|
|
1339
1367
|
if (card.provides && card.provides.length > 0) {
|
|
1340
|
-
for (const { bindTo,
|
|
1341
|
-
providesData[bindTo] = CardCompute.resolve(computeNode,
|
|
1368
|
+
for (const { bindTo, ref } of card.provides) {
|
|
1369
|
+
providesData[bindTo] = CardCompute.resolve(computeNode, ref);
|
|
1342
1370
|
}
|
|
1343
1371
|
} else {
|
|
1344
1372
|
providesData[card.id] = {
|