yaml-flow 5.1.0 → 5.2.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/{examples/example-board/reusable-server-runtime.js → board-livecards-server-runtime.js} +42 -20
- package/{examples/example-board/reusable-board-runtime-client.js → browser/board-livecards-runtime-client.js} +6 -2
- package/browser/{board-livegraph-runtime.js → board-livegraph-engine.js} +212 -16
- package/browser/board-livegraph-engine.js.map +1 -0
- package/browser/live-cards.js +362 -38
- package/browser/live-cards.schema.json +20 -4
- package/dist/board-livegraph-runtime/index.cjs +210 -14
- package/dist/board-livegraph-runtime/index.cjs.map +1 -1
- package/dist/board-livegraph-runtime/index.d.cts +49 -5
- package/dist/board-livegraph-runtime/index.d.ts +49 -5
- package/dist/board-livegraph-runtime/index.js +209 -15
- package/dist/board-livegraph-runtime/index.js.map +1 -1
- package/dist/card-compute/index.cjs +63 -7
- package/dist/card-compute/index.cjs.map +1 -1
- package/dist/card-compute/index.d.cts +2 -2
- package/dist/card-compute/index.d.ts +2 -2
- package/dist/card-compute/index.js +63 -7
- package/dist/card-compute/index.js.map +1 -1
- package/dist/cli/board-live-cards-cli.cjs +664 -75
- package/dist/cli/board-live-cards-cli.cjs.map +1 -1
- package/dist/cli/board-live-cards-cli.d.cts +33 -5
- package/dist/cli/board-live-cards-cli.d.ts +33 -5
- package/dist/cli/board-live-cards-cli.js +661 -76
- package/dist/cli/board-live-cards-cli.js.map +1 -1
- package/dist/{constants-ozjf1Ejw.d.cts → constants-BzZUyYlp.d.cts} +1 -1
- package/dist/{constants-DuzE5n03.d.ts → constants-oCEbNpul.d.ts} +1 -1
- package/dist/continuous-event-graph/index.cjs +47 -14
- package/dist/continuous-event-graph/index.cjs.map +1 -1
- package/dist/continuous-event-graph/index.d.cts +9 -9
- package/dist/continuous-event-graph/index.d.ts +9 -9
- package/dist/continuous-event-graph/index.js +47 -14
- package/dist/continuous-event-graph/index.js.map +1 -1
- package/dist/event-graph/index.cjs +29 -12
- package/dist/event-graph/index.cjs.map +1 -1
- package/dist/event-graph/index.d.cts +5 -5
- package/dist/event-graph/index.d.ts +5 -5
- package/dist/event-graph/index.js +29 -12
- package/dist/event-graph/index.js.map +1 -1
- package/dist/index.cjs +93 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +93 -20
- package/dist/index.js.map +1 -1
- package/dist/inference/index.cjs +29 -12
- package/dist/inference/index.cjs.map +1 -1
- package/dist/inference/index.d.cts +2 -2
- package/dist/inference/index.d.ts +2 -2
- package/dist/inference/index.js +29 -12
- package/dist/inference/index.js.map +1 -1
- package/dist/{journal-NLYuqege.d.ts → journal-9HEgs7dU.d.ts} +1 -1
- package/dist/{journal-DRfJiheM.d.cts → journal-B-JCfQnh.d.cts} +1 -1
- package/dist/{live-cards-bridge-Or7fdEJV.d.ts → live-cards-bridge-CeNxiVcm.d.ts} +6 -2
- package/dist/{live-cards-bridge-vGJ6tMzN.d.cts → live-cards-bridge-z_rJCSbi.d.cts} +6 -2
- package/dist/{schedule-CMcZe5Ny.d.ts → schedule-Cszq9LYY.d.ts} +1 -1
- package/dist/{schedule-CiucyCan.d.cts → schedule-qWNL0RQh.d.cts} +1 -1
- package/dist/{types-CMFSIjpc.d.cts → types-BBhqYGhE.d.cts} +4 -0
- package/dist/{types-CMFSIjpc.d.ts → types-BBhqYGhE.d.ts} +4 -0
- package/dist/{types-BzLD8bjb.d.cts → types-CHSdoAAA.d.cts} +1 -1
- package/dist/{types-C2eJ7DAV.d.ts → types-CoW0gQl3.d.ts} +1 -1
- package/dist/{validate-DJQTQ6bP.d.ts → validate-BAVzUJWa.d.ts} +1 -1
- package/dist/{validate-ke92Cleg.d.cts → validate-Dbu7ygys.d.cts} +1 -1
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-risk-assessment.json +28 -0
- package/examples/browser/boards/portfolio-tracker/cards/rebalancing-strategy.json +28 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-inference-adapter.js +187 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +139 -5
- package/examples/example-board/agent-instructions-cardlayout.md +28 -0
- package/examples/example-board/agent-instructions.md +603 -0
- package/examples/example-board/cards/card-concentration.json +42 -0
- package/examples/example-board/cards/card-market-prices.json +51 -0
- package/examples/example-board/cards/card-portfolio-action.json +19 -0
- package/examples/example-board/cards/card-portfolio-risks.json +19 -0
- package/examples/example-board/cards/card-portfolio-value.json +62 -0
- package/examples/example-board/cards/card-portfolio.json +44 -0
- package/examples/example-board/demo-chat-handler.js +373 -33
- package/examples/example-board/demo-server-config.json +0 -2
- package/examples/example-board/demo-server.js +46 -7
- package/examples/example-board/demo-shell-browser.html +75 -207
- package/examples/example-board/demo-shell-with-server.html +14 -9
- package/examples/example-board/demo-shell.html +1 -1
- package/examples/example-board/demo-task-executor.js +259 -41
- package/package.json +6 -2
- package/schema/live-cards.schema.json +20 -4
- package/browser/board-livegraph-runtime.js.map +0 -1
- package/examples/example-board/board.yaml +0 -23
- package/examples/example-board/bootstrap_payload.json +0 -1
- package/examples/example-board/cards/card-chain-region-alert.json +0 -39
- package/examples/example-board/cards/card-chain-region-totals.json +0 -26
- package/examples/example-board/cards/card-chain-top-region.json +0 -24
- package/examples/example-board/cards/card-ex-actions.json +0 -32
- package/examples/example-board/cards/card-ex-chart.json +0 -30
- package/examples/example-board/cards/card-ex-filter.json +0 -36
- package/examples/example-board/cards/card-ex-filtered-by-preference.json +0 -59
- package/examples/example-board/cards/card-ex-form.json +0 -91
- package/examples/example-board/cards/card-ex-list.json +0 -22
- package/examples/example-board/cards/card-ex-markdown.json +0 -17
- package/examples/example-board/cards/card-ex-metric.json +0 -19
- package/examples/example-board/cards/card-ex-narrative.json +0 -36
- package/examples/example-board/cards/card-ex-source-http.json +0 -28
- package/examples/example-board/cards/card-ex-source.json +0 -21
- package/examples/example-board/cards/card-ex-status.json +0 -35
- package/examples/example-board/cards/card-ex-table.json +0 -30
- package/examples/example-board/cards/card-ex-todo.json +0 -29
- package/examples/example-board/mock.db +0 -15
- package/examples/example-board/reusable-runtime-artifacts-adapter.js +0 -233
package/dist/index.cjs
CHANGED
|
@@ -8590,15 +8590,30 @@ function selectOptimalTasks(candidates, graph, state, conflictStrategy) {
|
|
|
8590
8590
|
}
|
|
8591
8591
|
|
|
8592
8592
|
// src/event-graph/task-transitions.ts
|
|
8593
|
-
function applyTaskStart(state, taskName) {
|
|
8593
|
+
function applyTaskStart(state, taskName, graph) {
|
|
8594
8594
|
const existingTask = state.tasks[taskName] ?? createDefaultGraphEngineStore2();
|
|
8595
|
+
const startConsumedHashes = {};
|
|
8596
|
+
if (graph) {
|
|
8597
|
+
const taskConfig = graph.tasks[taskName];
|
|
8598
|
+
const requires = getRequires(taskConfig);
|
|
8599
|
+
for (const token of requires) {
|
|
8600
|
+
for (const [otherName, otherConfig] of Object.entries(graph.tasks)) {
|
|
8601
|
+
if (getProvides(otherConfig).includes(token)) {
|
|
8602
|
+
const otherState = state.tasks[otherName];
|
|
8603
|
+
if (otherState?.lastDataHash) startConsumedHashes[token] = otherState.lastDataHash;
|
|
8604
|
+
break;
|
|
8605
|
+
}
|
|
8606
|
+
}
|
|
8607
|
+
}
|
|
8608
|
+
}
|
|
8595
8609
|
const updatedTask = {
|
|
8596
8610
|
...existingTask,
|
|
8597
8611
|
status: "running",
|
|
8598
8612
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8599
8613
|
lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8600
8614
|
progress: 0,
|
|
8601
|
-
error: void 0
|
|
8615
|
+
error: void 0,
|
|
8616
|
+
startConsumedHashes
|
|
8602
8617
|
};
|
|
8603
8618
|
return {
|
|
8604
8619
|
...state,
|
|
@@ -8618,16 +8633,18 @@ function applyTaskCompletion(state, graph, taskName, result, dataHash, data) {
|
|
|
8618
8633
|
} else {
|
|
8619
8634
|
outputTokens = getProvides(taskConfig);
|
|
8620
8635
|
}
|
|
8621
|
-
const lastConsumedHashes = { ...existingTask.lastConsumedHashes };
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
for (const
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8636
|
+
const lastConsumedHashes = existingTask.startConsumedHashes ? { ...existingTask.startConsumedHashes } : { ...existingTask.lastConsumedHashes };
|
|
8637
|
+
if (!existingTask.startConsumedHashes) {
|
|
8638
|
+
const requires = taskConfig.requires ?? [];
|
|
8639
|
+
for (const token of requires) {
|
|
8640
|
+
for (const [otherName, otherConfig] of Object.entries(graph.tasks)) {
|
|
8641
|
+
if (getProvides(otherConfig).includes(token)) {
|
|
8642
|
+
const otherState = state.tasks[otherName];
|
|
8643
|
+
if (otherState?.lastDataHash) {
|
|
8644
|
+
lastConsumedHashes[token] = otherState.lastDataHash;
|
|
8645
|
+
}
|
|
8646
|
+
break;
|
|
8629
8647
|
}
|
|
8630
|
-
break;
|
|
8631
8648
|
}
|
|
8632
8649
|
}
|
|
8633
8650
|
}
|
|
@@ -8749,7 +8766,7 @@ function apply(state, event, graph) {
|
|
|
8749
8766
|
}
|
|
8750
8767
|
switch (event.type) {
|
|
8751
8768
|
case "task-started":
|
|
8752
|
-
return applyTaskStart(state, event.taskName);
|
|
8769
|
+
return applyTaskStart(state, event.taskName, graph);
|
|
8753
8770
|
case "task-completed":
|
|
8754
8771
|
return applyTaskCompletion(state, graph, event.taskName, event.result, event.dataHash, event.data);
|
|
8755
8772
|
case "task-failed":
|
|
@@ -10103,7 +10120,7 @@ function applyEvent(live, event) {
|
|
|
10103
10120
|
switch (event.type) {
|
|
10104
10121
|
// --- Execution state transitions ---
|
|
10105
10122
|
case "task-started":
|
|
10106
|
-
return { config, state: applyTaskStart(state, event.taskName) };
|
|
10123
|
+
return { config, state: applyTaskStart(state, event.taskName, config) };
|
|
10107
10124
|
case "task-completed":
|
|
10108
10125
|
return { config, state: applyTaskCompletion(state, config, event.taskName, event.result, event.dataHash, event.data) };
|
|
10109
10126
|
case "task-failed":
|
|
@@ -11671,9 +11688,9 @@ var live_cards_schema_default = {
|
|
|
11671
11688
|
}
|
|
11672
11689
|
},
|
|
11673
11690
|
source_def: {
|
|
11674
|
-
description: "One source entry. The engine
|
|
11691
|
+
description: "One source entry. The engine requires 'bindTo' (compute namespace key) and 'outputFile' (delivery signal path). bindTo and outputFile must be unique across all sources in a card. Every other property is yours \u2014 add whatever your task-executor needs: kind, url, headers, mailbox, channel, model, query, etc. The full object is passed verbatim as the --in JSON to the executor.",
|
|
11675
11692
|
type: "object",
|
|
11676
|
-
required: ["bindTo"],
|
|
11693
|
+
required: ["bindTo", "outputFile"],
|
|
11677
11694
|
additionalProperties: true,
|
|
11678
11695
|
properties: {
|
|
11679
11696
|
bindTo: { type: "string", description: "Key under fetched_sources.* available in compute expressions" },
|
|
@@ -11692,6 +11709,7 @@ var live_cards_schema_default = {
|
|
|
11692
11709
|
enum: [
|
|
11693
11710
|
"metric",
|
|
11694
11711
|
"table",
|
|
11712
|
+
"editable-table",
|
|
11695
11713
|
"chart",
|
|
11696
11714
|
"form",
|
|
11697
11715
|
"filter",
|
|
@@ -11809,7 +11827,7 @@ var live_cards_schema_default = {
|
|
|
11809
11827
|
view: { $ref: "#/definitions/view" },
|
|
11810
11828
|
card_data: {
|
|
11811
11829
|
type: "object",
|
|
11812
|
-
description: "Authored card data
|
|
11830
|
+
description: "Authored card data and runtime metadata. Includes uploaded-file metadata maintained by host handlers and inference evaluation results.",
|
|
11813
11831
|
properties: {
|
|
11814
11832
|
files: {
|
|
11815
11833
|
type: "array",
|
|
@@ -11837,6 +11855,18 @@ var live_cards_schema_default = {
|
|
|
11837
11855
|
},
|
|
11838
11856
|
additionalProperties: false
|
|
11839
11857
|
}
|
|
11858
|
+
},
|
|
11859
|
+
llm_task_completion_inference: {
|
|
11860
|
+
type: "object",
|
|
11861
|
+
description: "Runtime state written by the inference adapter (advanced/undocumented). Prefer the standard sources \u2192 compute \u2192 provides pattern for LLM-based signals.",
|
|
11862
|
+
properties: {
|
|
11863
|
+
inferenceRequested: { type: "string", format: "date-time", description: "Timestamp when the latest inference request was initiated" },
|
|
11864
|
+
inferenceCompletedAt: { type: "string", format: "date-time", description: "Timestamp when the latest inference request completed" },
|
|
11865
|
+
isTaskCompleted: { type: "boolean", description: "Whether the task is considered complete by the adapter" },
|
|
11866
|
+
reasoning: { type: "string", description: "Explanation of completion decision" },
|
|
11867
|
+
evidence: { type: "array", description: "Supporting evidence from sources/compute" }
|
|
11868
|
+
},
|
|
11869
|
+
additionalProperties: true
|
|
11840
11870
|
}
|
|
11841
11871
|
},
|
|
11842
11872
|
additionalProperties: true
|
|
@@ -11850,6 +11880,10 @@ var live_cards_schema_default = {
|
|
|
11850
11880
|
type: "array",
|
|
11851
11881
|
description: "Ordered array of compute steps. Each reads card_data.*/requires.*/fetched_sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",
|
|
11852
11882
|
items: { $ref: "#/definitions/compute_step" }
|
|
11883
|
+
},
|
|
11884
|
+
when_is_task_completed: {
|
|
11885
|
+
type: "string",
|
|
11886
|
+
description: "Advanced/undocumented: invokes a registered inference adapter instead of the default source-delivery completion gate. Prefer the standard pattern: use an LLM-backed source, compute a verdict token, and publish it via provides."
|
|
11853
11887
|
}
|
|
11854
11888
|
}
|
|
11855
11889
|
};
|
|
@@ -11918,12 +11952,35 @@ function getValidator3() {
|
|
|
11918
11952
|
function validateLiveCardSchema(node) {
|
|
11919
11953
|
const validate = getValidator3();
|
|
11920
11954
|
const valid = validate(node);
|
|
11921
|
-
if (valid) return { ok: true, errors: [] };
|
|
11922
11955
|
const errors = (validate.errors ?? []).map((e) => {
|
|
11923
11956
|
const path = e.instancePath || "/";
|
|
11924
11957
|
return `${path}: ${e.message ?? "unknown error"}`;
|
|
11925
11958
|
});
|
|
11926
|
-
|
|
11959
|
+
if (node && typeof node === "object" && !Array.isArray(node)) {
|
|
11960
|
+
const sources = node.sources;
|
|
11961
|
+
if (Array.isArray(sources)) {
|
|
11962
|
+
const bindTos = /* @__PURE__ */ new Set();
|
|
11963
|
+
const outputFiles = /* @__PURE__ */ new Set();
|
|
11964
|
+
sources.forEach((src, i) => {
|
|
11965
|
+
if (!src || typeof src !== "object" || Array.isArray(src)) return;
|
|
11966
|
+
const s = src;
|
|
11967
|
+
if (typeof s.bindTo === "string" && s.bindTo) {
|
|
11968
|
+
if (bindTos.has(s.bindTo)) {
|
|
11969
|
+
errors.push(`/sources/${i}/bindTo: bindTo "${s.bindTo}" must be unique across all sources`);
|
|
11970
|
+
}
|
|
11971
|
+
bindTos.add(s.bindTo);
|
|
11972
|
+
}
|
|
11973
|
+
if (typeof s.outputFile === "string" && s.outputFile) {
|
|
11974
|
+
if (outputFiles.has(s.outputFile)) {
|
|
11975
|
+
errors.push(`/sources/${i}/outputFile: outputFile "${s.outputFile}" must be unique across all sources`);
|
|
11976
|
+
}
|
|
11977
|
+
outputFiles.add(s.outputFile);
|
|
11978
|
+
}
|
|
11979
|
+
});
|
|
11980
|
+
}
|
|
11981
|
+
}
|
|
11982
|
+
if (!valid || errors.length > 0) return { ok: false, errors };
|
|
11983
|
+
return { ok: true, errors: [] };
|
|
11927
11984
|
}
|
|
11928
11985
|
function validateLiveCardRuntimeExpressions(node) {
|
|
11929
11986
|
const errors = [];
|
|
@@ -12093,13 +12150,29 @@ function validateNode(node) {
|
|
|
12093
12150
|
if (!Array.isArray(n.sources)) {
|
|
12094
12151
|
errors.push("sources: must be an array");
|
|
12095
12152
|
} else {
|
|
12153
|
+
const bindTos = /* @__PURE__ */ new Set();
|
|
12154
|
+
const outputFiles = /* @__PURE__ */ new Set();
|
|
12096
12155
|
n.sources.forEach((src, i) => {
|
|
12097
12156
|
if (!src || typeof src !== "object" || Array.isArray(src)) {
|
|
12098
12157
|
errors.push(`sources[${i}]: must be an object`);
|
|
12099
12158
|
} else {
|
|
12100
12159
|
const s = src;
|
|
12101
|
-
if (typeof s.bindTo !== "string" || !s.bindTo)
|
|
12102
|
-
|
|
12160
|
+
if (typeof s.bindTo !== "string" || !s.bindTo) {
|
|
12161
|
+
errors.push(`sources[${i}]: missing required "bindTo" property`);
|
|
12162
|
+
} else {
|
|
12163
|
+
if (bindTos.has(s.bindTo)) {
|
|
12164
|
+
errors.push(`sources[${i}]: bindTo "${s.bindTo}" is not unique across sources`);
|
|
12165
|
+
}
|
|
12166
|
+
bindTos.add(s.bindTo);
|
|
12167
|
+
}
|
|
12168
|
+
if (typeof s.outputFile !== "string" || !s.outputFile) {
|
|
12169
|
+
errors.push(`sources[${i}]: missing required "outputFile" property`);
|
|
12170
|
+
} else {
|
|
12171
|
+
if (outputFiles.has(s.outputFile)) {
|
|
12172
|
+
errors.push(`sources[${i}]: outputFile "${s.outputFile}" is not unique across sources`);
|
|
12173
|
+
}
|
|
12174
|
+
outputFiles.add(s.outputFile);
|
|
12175
|
+
}
|
|
12103
12176
|
if (s.optionalForCompletionGating != null && typeof s.optionalForCompletionGating !== "boolean") {
|
|
12104
12177
|
errors.push(`sources[${i}]: optionalForCompletionGating must be a boolean`);
|
|
12105
12178
|
}
|