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