yaml-flow 5.2.6 → 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 +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 +14 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { G as GraphConfig, f as GraphEvent } from '../types-BBhqYGhE.cjs';
|
|
2
2
|
import { L as LiveGraph } from '../types-CHSdoAAA.cjs';
|
|
3
3
|
import { s as schedule } from '../schedule-qWNL0RQh.cjs';
|
|
4
|
-
import { R as ReactiveGraph, a as LiveCard, e as TaskHandlerInput, d as ReactiveGraphOptions, L as LiveBoard } from '../live-cards-bridge-
|
|
4
|
+
import { R as ReactiveGraph, a as LiveCard, e as TaskHandlerInput, d as ReactiveGraphOptions, L as LiveBoard } from '../live-cards-bridge-x5XREkXm.cjs';
|
|
5
5
|
|
|
6
6
|
interface BrowserSourceAdapterContext {
|
|
7
7
|
card: LiveCard;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { G as GraphConfig, f as GraphEvent } from '../types-BBhqYGhE.js';
|
|
2
2
|
import { L as LiveGraph } from '../types-CoW0gQl3.js';
|
|
3
3
|
import { s as schedule } from '../schedule-Cszq9LYY.js';
|
|
4
|
-
import { R as ReactiveGraph, a as LiveCard, e as TaskHandlerInput, d as ReactiveGraphOptions, L as LiveBoard } from '../live-cards-bridge-
|
|
4
|
+
import { R as ReactiveGraph, a as LiveCard, e as TaskHandlerInput, d as ReactiveGraphOptions, L as LiveBoard } from '../live-cards-bridge-EQjytzI_.js';
|
|
5
5
|
|
|
6
6
|
interface BrowserSourceAdapterContext {
|
|
7
7
|
card: LiveCard;
|
|
@@ -77,7 +77,7 @@ var VALID_ELEMENT_KINDS = /* @__PURE__ */ new Set([
|
|
|
77
77
|
"markdown",
|
|
78
78
|
"custom"
|
|
79
79
|
]);
|
|
80
|
-
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "
|
|
80
|
+
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "source_defs"]);
|
|
81
81
|
function validateNode(node) {
|
|
82
82
|
const errors = [];
|
|
83
83
|
if (!node || typeof node !== "object" || Array.isArray(node)) {
|
|
@@ -103,15 +103,15 @@ function validateNode(node) {
|
|
|
103
103
|
if (n.requires != null && !Array.isArray(n.requires)) errors.push("requires: must be an array of strings");
|
|
104
104
|
if (n.provides != null) {
|
|
105
105
|
if (!Array.isArray(n.provides)) {
|
|
106
|
-
errors.push("provides: must be an array of { bindTo,
|
|
106
|
+
errors.push("provides: must be an array of { bindTo, ref } bindings");
|
|
107
107
|
} else {
|
|
108
108
|
n.provides.forEach((p, i) => {
|
|
109
109
|
if (!p || typeof p !== "object" || Array.isArray(p)) {
|
|
110
|
-
errors.push(`provides[${i}]: must be an object with bindTo and
|
|
110
|
+
errors.push(`provides[${i}]: must be an object with bindTo and ref`);
|
|
111
111
|
} else {
|
|
112
112
|
const b = p;
|
|
113
113
|
if (typeof b.bindTo !== "string" || !b.bindTo) errors.push(`provides[${i}]: missing required "bindTo" string`);
|
|
114
|
-
if (typeof b.
|
|
114
|
+
if (typeof b.ref !== "string" || !b.ref) errors.push(`provides[${i}]: missing required "ref" string`);
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
}
|
|
@@ -131,35 +131,35 @@ function validateNode(node) {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
if (n.
|
|
135
|
-
if (!Array.isArray(n.
|
|
136
|
-
errors.push("
|
|
134
|
+
if (n.source_defs != null) {
|
|
135
|
+
if (!Array.isArray(n.source_defs)) {
|
|
136
|
+
errors.push("source_defs: must be an array");
|
|
137
137
|
} else {
|
|
138
138
|
const bindTos = /* @__PURE__ */ new Set();
|
|
139
139
|
const outputFiles = /* @__PURE__ */ new Set();
|
|
140
|
-
n.
|
|
140
|
+
n.source_defs.forEach((src, i) => {
|
|
141
141
|
if (!src || typeof src !== "object" || Array.isArray(src)) {
|
|
142
|
-
errors.push(`
|
|
142
|
+
errors.push(`source_defs[${i}]: must be an object`);
|
|
143
143
|
} else {
|
|
144
144
|
const s = src;
|
|
145
145
|
if (typeof s.bindTo !== "string" || !s.bindTo) {
|
|
146
|
-
errors.push(`
|
|
146
|
+
errors.push(`source_defs[${i}]: missing required "bindTo" property`);
|
|
147
147
|
} else {
|
|
148
148
|
if (bindTos.has(s.bindTo)) {
|
|
149
|
-
errors.push(`
|
|
149
|
+
errors.push(`source_defs[${i}]: bindTo "${s.bindTo}" is not unique across source_defs`);
|
|
150
150
|
}
|
|
151
151
|
bindTos.add(s.bindTo);
|
|
152
152
|
}
|
|
153
153
|
if (typeof s.outputFile !== "string" || !s.outputFile) {
|
|
154
|
-
errors.push(`
|
|
154
|
+
errors.push(`source_defs[${i}]: missing required "outputFile" property`);
|
|
155
155
|
} else {
|
|
156
156
|
if (outputFiles.has(s.outputFile)) {
|
|
157
|
-
errors.push(`
|
|
157
|
+
errors.push(`source_defs[${i}]: outputFile "${s.outputFile}" is not unique across source_defs`);
|
|
158
158
|
}
|
|
159
159
|
outputFiles.add(s.outputFile);
|
|
160
160
|
}
|
|
161
161
|
if (s.optionalForCompletionGating != null && typeof s.optionalForCompletionGating !== "boolean") {
|
|
162
|
-
errors.push(`
|
|
162
|
+
errors.push(`source_defs[${i}]: optionalForCompletionGating must be a boolean`);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
});
|
|
@@ -194,14 +194,29 @@ function validateNode(node) {
|
|
|
194
194
|
}
|
|
195
195
|
return { ok: errors.length === 0, errors };
|
|
196
196
|
}
|
|
197
|
-
function enrichSources(
|
|
198
|
-
if (!
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
197
|
+
async function enrichSources(source_defs, context) {
|
|
198
|
+
if (!source_defs || source_defs.length === 0) return [];
|
|
199
|
+
const evalCtx = {
|
|
200
|
+
card_data: context.card_data ?? {},
|
|
201
|
+
requires: context.requires ?? {}
|
|
202
|
+
};
|
|
203
|
+
return Promise.all(
|
|
204
|
+
source_defs.map(async (src) => {
|
|
205
|
+
const _projections = {};
|
|
206
|
+
if (src.projections && typeof src.projections === "object" && !Array.isArray(src.projections)) {
|
|
207
|
+
for (const [key, expr] of Object.entries(src.projections)) {
|
|
208
|
+
if (typeof expr === "string" && expr.trim().length > 0) {
|
|
209
|
+
try {
|
|
210
|
+
_projections[key] = await jsonata2(expr).evaluate(evalCtx);
|
|
211
|
+
} catch {
|
|
212
|
+
_projections[key] = void 0;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return { ...src, _projections };
|
|
218
|
+
})
|
|
219
|
+
);
|
|
205
220
|
}
|
|
206
221
|
var CardCompute = {
|
|
207
222
|
run,
|
|
@@ -902,6 +917,7 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
902
917
|
const inputQueue = new MemoryJournal();
|
|
903
918
|
let live = "state" in configOrLive && "config" in configOrLive ? configOrLive : createLiveGraph(configOrLive, executionId);
|
|
904
919
|
let disposed = false;
|
|
920
|
+
const pendingHandlers = /* @__PURE__ */ new Set();
|
|
905
921
|
const handlers = new Map(Object.entries(initialHandlers));
|
|
906
922
|
const internalJournal = new MemoryJournal();
|
|
907
923
|
let draining = false;
|
|
@@ -944,7 +960,7 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
944
960
|
const taskState = live.state.tasks[taskName];
|
|
945
961
|
if (!taskState || taskState.status !== "running") continue;
|
|
946
962
|
const callbackToken = encodeCallbackToken(taskName);
|
|
947
|
-
runPipeline(taskName, callbackToken, update).catch((error) => {
|
|
963
|
+
const p = runPipeline(taskName, callbackToken, update).catch((error) => {
|
|
948
964
|
if (disposed) return;
|
|
949
965
|
internalJournal.append({
|
|
950
966
|
type: "task-failed",
|
|
@@ -953,7 +969,10 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
953
969
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
954
970
|
});
|
|
955
971
|
drain();
|
|
972
|
+
}).finally(() => {
|
|
973
|
+
pendingHandlers.delete(p);
|
|
956
974
|
});
|
|
975
|
+
pendingHandlers.add(p);
|
|
957
976
|
}
|
|
958
977
|
}
|
|
959
978
|
}
|
|
@@ -1013,7 +1032,7 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1013
1032
|
});
|
|
1014
1033
|
drain();
|
|
1015
1034
|
const callbackToken = encodeCallbackToken(taskName);
|
|
1016
|
-
runPipeline(taskName, callbackToken).catch((error) => {
|
|
1035
|
+
const p = runPipeline(taskName, callbackToken).catch((error) => {
|
|
1017
1036
|
if (disposed) return;
|
|
1018
1037
|
internalJournal.append({
|
|
1019
1038
|
type: "task-failed",
|
|
@@ -1022,7 +1041,10 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1022
1041
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1023
1042
|
});
|
|
1024
1043
|
drain();
|
|
1044
|
+
}).finally(() => {
|
|
1045
|
+
pendingHandlers.delete(p);
|
|
1025
1046
|
});
|
|
1047
|
+
pendingHandlers.add(p);
|
|
1026
1048
|
}
|
|
1027
1049
|
return {
|
|
1028
1050
|
push(event) {
|
|
@@ -1136,7 +1158,10 @@ function createReactiveGraph(configOrLive, options, executionId) {
|
|
|
1136
1158
|
getSchedule() {
|
|
1137
1159
|
return schedule(live);
|
|
1138
1160
|
},
|
|
1139
|
-
dispose() {
|
|
1161
|
+
async dispose(options2) {
|
|
1162
|
+
if (options2?.wait && pendingHandlers.size > 0) {
|
|
1163
|
+
await Promise.allSettled([...pendingHandlers]);
|
|
1164
|
+
}
|
|
1140
1165
|
disposed = true;
|
|
1141
1166
|
}
|
|
1142
1167
|
};
|
|
@@ -1158,7 +1183,7 @@ function toTaskConfig(card) {
|
|
|
1158
1183
|
function buildTokenProviders(cards) {
|
|
1159
1184
|
const tokenToCardId = /* @__PURE__ */ new Map();
|
|
1160
1185
|
for (const [cardId, card] of cards.entries()) {
|
|
1161
|
-
const bindings = card.provides && card.provides.length > 0 ? card.provides : [{ bindTo: cardId,
|
|
1186
|
+
const bindings = card.provides && card.provides.length > 0 ? card.provides : [{ bindTo: cardId, ref: "card_data" }];
|
|
1162
1187
|
for (const binding of bindings) tokenToCardId.set(binding.bindTo, cardId);
|
|
1163
1188
|
}
|
|
1164
1189
|
return tokenToCardId;
|
|
@@ -1304,14 +1329,14 @@ function createBoardLiveGraphRuntime(input, options = {}) {
|
|
|
1304
1329
|
requiresData[token] = providesData2[token];
|
|
1305
1330
|
}
|
|
1306
1331
|
const sourcesData = {};
|
|
1307
|
-
if (card.
|
|
1332
|
+
if (card.source_defs && card.source_defs.length > 0) {
|
|
1308
1333
|
const adapter = sourceAdapters[cardId] ?? defaultSourceAdapter;
|
|
1309
1334
|
const fetched = taskExecutor ? await taskExecutor({ card, input: inputArgs }) : adapter ? await adapter({ card, input: inputArgs }) : void 0;
|
|
1310
1335
|
if (fetched && typeof fetched === "object") {
|
|
1311
|
-
for (const src of card.
|
|
1336
|
+
for (const src of card.source_defs) {
|
|
1312
1337
|
if (Object.prototype.hasOwnProperty.call(fetched, src.bindTo)) {
|
|
1313
1338
|
sourcesData[src.bindTo] = fetched[src.bindTo];
|
|
1314
|
-
} else if (card.
|
|
1339
|
+
} else if (card.source_defs.length === 1) {
|
|
1315
1340
|
sourcesData[src.bindTo] = fetched;
|
|
1316
1341
|
}
|
|
1317
1342
|
}
|
|
@@ -1321,7 +1346,7 @@ function createBoardLiveGraphRuntime(input, options = {}) {
|
|
|
1321
1346
|
id: card.id,
|
|
1322
1347
|
card_data: deepClone(card.card_data ?? {}),
|
|
1323
1348
|
requires: requiresData,
|
|
1324
|
-
|
|
1349
|
+
source_defs: card.source_defs,
|
|
1325
1350
|
compute: card.compute
|
|
1326
1351
|
};
|
|
1327
1352
|
computeNode._sourcesData = sourcesData;
|
|
@@ -1330,8 +1355,8 @@ function createBoardLiveGraphRuntime(input, options = {}) {
|
|
|
1330
1355
|
}
|
|
1331
1356
|
const providesData = {};
|
|
1332
1357
|
if (card.provides && card.provides.length > 0) {
|
|
1333
|
-
for (const { bindTo,
|
|
1334
|
-
providesData[bindTo] = CardCompute.resolve(computeNode,
|
|
1358
|
+
for (const { bindTo, ref } of card.provides) {
|
|
1359
|
+
providesData[bindTo] = CardCompute.resolve(computeNode, ref);
|
|
1335
1360
|
}
|
|
1336
1361
|
} else {
|
|
1337
1362
|
providesData[card.id] = {
|