yaml-flow 3.1.1 → 5.0.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 +81 -20
- package/board-live-cards-cli.js +37 -0
- package/browser/board-livegraph-runtime.js +1453 -0
- package/browser/board-livegraph-runtime.js.map +1 -0
- package/browser/card-compute.js +153 -433
- package/browser/live-cards.js +868 -115
- package/browser/live-cards.schema.json +90 -83
- package/dist/board-livegraph-runtime/index.cjs +1448 -0
- package/dist/board-livegraph-runtime/index.cjs.map +1 -0
- package/dist/board-livegraph-runtime/index.d.cts +101 -0
- package/dist/board-livegraph-runtime/index.d.ts +101 -0
- package/dist/board-livegraph-runtime/index.js +1441 -0
- package/dist/board-livegraph-runtime/index.js.map +1 -0
- package/dist/card-compute/index.cjs +266 -431
- package/dist/card-compute/index.cjs.map +1 -1
- package/dist/card-compute/index.d.cts +77 -49
- package/dist/card-compute/index.d.ts +77 -49
- package/dist/card-compute/index.js +263 -432
- package/dist/card-compute/index.js.map +1 -1
- package/dist/cli/board-live-cards-cli.cjs +2750 -0
- package/dist/cli/board-live-cards-cli.cjs.map +1 -0
- package/dist/cli/board-live-cards-cli.d.cts +205 -0
- package/dist/cli/board-live-cards-cli.d.ts +205 -0
- package/dist/cli/board-live-cards-cli.js +2702 -0
- package/dist/cli/board-live-cards-cli.js.map +1 -0
- package/dist/{constants-B2zqu10b.d.ts → constants-DuzE5n03.d.ts} +2 -2
- package/dist/{constants-DJZU1pwJ.d.cts → constants-ozjf1Ejw.d.cts} +2 -2
- package/dist/continuous-event-graph/index.cjs +258 -464
- package/dist/continuous-event-graph/index.cjs.map +1 -1
- package/dist/continuous-event-graph/index.d.cts +18 -358
- package/dist/continuous-event-graph/index.d.ts +18 -358
- package/dist/continuous-event-graph/index.js +255 -464
- package/dist/continuous-event-graph/index.js.map +1 -1
- package/dist/event-graph/index.cjs +4 -4
- 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 +4 -4
- package/dist/event-graph/index.js.map +1 -1
- package/dist/index.cjs +1684 -555
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -7
- package/dist/index.d.ts +26 -7
- package/dist/index.js +1678 -555
- package/dist/index.js.map +1 -1
- package/dist/inference/index.cjs +138 -19
- 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 +138 -19
- package/dist/inference/index.js.map +1 -1
- package/dist/journal-DRfJiheM.d.cts +28 -0
- package/dist/journal-NLYuqege.d.ts +28 -0
- package/dist/live-cards-bridge-Or7fdEJV.d.ts +316 -0
- package/dist/live-cards-bridge-vGJ6tMzN.d.cts +316 -0
- package/dist/schedule-CMcZe5Ny.d.ts +21 -0
- package/dist/schedule-CiucyCan.d.cts +21 -0
- package/dist/step-machine/index.cjs +18 -1
- package/dist/step-machine/index.cjs.map +1 -1
- package/dist/step-machine/index.d.cts +2 -2
- package/dist/step-machine/index.d.ts +2 -2
- package/dist/step-machine/index.js +18 -1
- package/dist/step-machine/index.js.map +1 -1
- package/dist/stores/file.d.cts +1 -1
- package/dist/stores/file.d.ts +1 -1
- package/dist/stores/index.d.cts +1 -1
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/localStorage.d.cts +1 -1
- package/dist/stores/localStorage.d.ts +1 -1
- package/dist/stores/memory.d.cts +1 -1
- package/dist/stores/memory.d.ts +1 -1
- package/dist/{types-BwvgvlOO.d.cts → types-BzLD8bjb.d.cts} +1 -1
- package/dist/{types-ClRA8hzC.d.ts → types-C2eJ7DAV.d.ts} +1 -1
- package/dist/{types-DEj7OakX.d.cts → types-CMFSIjpc.d.cts} +39 -4
- package/dist/{types-DEj7OakX.d.ts → types-CMFSIjpc.d.ts} +39 -4
- package/dist/{types-FZ_eyErS.d.cts → types-ycun84cq.d.cts} +1 -0
- package/dist/{types-FZ_eyErS.d.ts → types-ycun84cq.d.ts} +1 -0
- package/dist/{validate-DEZ2Ymdb.d.ts → validate-DJQTQ6bP.d.ts} +1 -1
- package/dist/{validate-DqKTZg_o.d.cts → validate-ke92Cleg.d.cts} +1 -1
- package/examples/browser/boards/portfolio-tracker/cards/holdings-table.json +22 -0
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-form.json +16 -0
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-value.json +15 -0
- package/examples/browser/boards/portfolio-tracker/cards/price-fetch.json +15 -0
- package/examples/browser/boards/portfolio-tracker/fetch-prices.js +43 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.bat +7 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +217 -0
- package/examples/browser/livecards-browser/index.html +41 -0
- package/examples/browser/{index.html → step-machine-browser/index.html} +53 -53
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +22 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +43 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +15 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +15 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/fetch-prices.js +48 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +58 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +27 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +25 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +29 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +27 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/status-cli.js +25 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +37 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +53 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +35 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +227 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +38 -0
- package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +29 -0
- package/examples/cli/step-machine-demo/jsonata-init-board-cli.js +36 -0
- package/examples/cli/step-machine-demo/jsonata-init-board.flow.yaml +30 -0
- package/examples/cli/step-machine-demo/one-step-cli-only.flow.yaml +19 -0
- package/examples/cli/step-machine-demo/step-cli-echo-y.js +15 -0
- package/examples/cli/step-machine-demo/step2-double-cli.js +39 -0
- package/examples/cli/step-machine-demo/two-step-math-handlers.js +32 -0
- package/examples/cli/step-machine-demo/two-step-math.flow.yaml +31 -0
- package/examples/cli/step-machine-demo/two-step-mixed-handlers.js +24 -0
- package/examples/cli/step-machine-demo/two-step-mixed.flow.yaml +35 -0
- package/examples/example-board/board.yaml +23 -0
- package/examples/example-board/bootstrap_payload.json +1 -0
- package/examples/example-board/cards/card-chain-region-alert.json +39 -0
- package/examples/example-board/cards/card-chain-region-totals.json +26 -0
- package/examples/example-board/cards/card-chain-top-region.json +24 -0
- package/examples/example-board/cards/card-ex-actions.json +32 -0
- package/examples/example-board/cards/card-ex-chart.json +30 -0
- package/examples/example-board/cards/card-ex-filter.json +36 -0
- package/examples/example-board/cards/card-ex-filtered-by-preference.json +59 -0
- package/examples/example-board/cards/card-ex-form.json +91 -0
- package/examples/example-board/cards/card-ex-list.json +22 -0
- package/examples/example-board/cards/card-ex-markdown.json +17 -0
- package/examples/example-board/cards/card-ex-metric.json +19 -0
- package/examples/example-board/cards/card-ex-narrative.json +36 -0
- package/examples/example-board/cards/card-ex-source-http.json +28 -0
- package/examples/example-board/cards/card-ex-source.json +21 -0
- package/examples/example-board/cards/card-ex-status.json +35 -0
- package/examples/example-board/cards/card-ex-table.json +30 -0
- package/examples/example-board/cards/card-ex-todo.json +29 -0
- package/examples/example-board/demo-chat-handler.js +69 -0
- package/examples/example-board/demo-server.js +87 -0
- package/examples/example-board/demo-shell-browser.html +806 -0
- package/examples/example-board/demo-shell-with-server.html +280 -0
- package/examples/example-board/demo-shell.html +62 -0
- package/examples/example-board/demo-task-executor.js +255 -0
- package/examples/example-board/mock.db +15 -0
- package/examples/example-board/reusable-board-runtime-client.js +265 -0
- package/examples/example-board/reusable-runtime-artifacts-adapter.js +233 -0
- package/examples/example-board/reusable-server-runtime.js +1284 -0
- package/examples/index.html +799 -0
- package/examples/{batch → npm-libs/batch}/batch-step-machine.ts +1 -1
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/live-cards-board.ts +18 -18
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/live-portfolio-dashboard.ts +24 -24
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/portfolio-tracker.ts +1 -1
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/reactive-monitoring.ts +1 -1
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/reactive-pipeline.ts +1 -1
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/soc-incident-board.ts +1 -1
- package/examples/{continuous-event-graph → npm-libs/continuous-event-graph}/stock-dashboard.ts +1 -1
- package/examples/{event-graph → npm-libs/event-graph}/ci-cd-pipeline.ts +1 -1
- package/examples/{event-graph → npm-libs/event-graph}/executor-diamond.ts +1 -1
- package/examples/{event-graph → npm-libs/event-graph}/executor-pipeline.ts +1 -1
- package/examples/{event-graph → npm-libs/event-graph}/research-pipeline.ts +1 -1
- package/examples/{graph-of-graphs → npm-libs/graph-of-graphs}/multi-stage-etl.ts +1 -1
- package/examples/{graph-of-graphs → npm-libs/graph-of-graphs}/url-processing-pipeline.ts +1 -1
- package/examples/{inference → npm-libs/inference}/azure-deployment.ts +1 -1
- package/examples/{inference → npm-libs/inference}/copilot-cli.ts +1 -1
- package/examples/{inference → npm-libs/inference}/data-pipeline.ts +1 -1
- package/examples/{inference → npm-libs/inference}/pluggable-adapters.ts +1 -1
- package/examples/{node → npm-libs/node}/ai-conversation.ts +1 -1
- package/examples/{node → npm-libs/node}/simple-greeting.ts +2 -2
- package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +22 -0
- package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +43 -0
- package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +15 -0
- package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +15 -0
- package/examples/step-machine-cli/portfolio-tracker/fetch-prices.js +48 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +58 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +27 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +25 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +29 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +27 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/status-cli.js +25 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +37 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +53 -0
- package/examples/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +35 -0
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +227 -0
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +38 -0
- package/examples/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +29 -0
- package/package.json +27 -2
- package/schema/board-status.schema.json +118 -0
- package/schema/card-runtime.schema.json +25 -0
- package/schema/flow.schema.json +5 -0
- package/schema/live-cards.schema.json +90 -83
- package/step-machine-cli.js +674 -0
- package/browser/ingest-board.js +0 -296
- package/examples/ingest.js +0 -733
- /package/examples/{flows → npm-libs/flows}/ai-conversation.yaml +0 -0
- /package/examples/{flows → npm-libs/flows}/order-processing.yaml +0 -0
- /package/examples/{flows → npm-libs/flows}/simple-greeting.yaml +0 -0
package/dist/stores/file.d.cts
CHANGED
package/dist/stores/file.d.ts
CHANGED
package/dist/stores/index.d.cts
CHANGED
package/dist/stores/index.d.ts
CHANGED
package/dist/stores/memory.d.cts
CHANGED
package/dist/stores/memory.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GraphConfig, c as ExecutionState, T as TaskConfig, e as GraphEngineStore } from './types-
|
|
1
|
+
import { G as GraphConfig, c as ExecutionState, T as TaskConfig, e as GraphEngineStore } from './types-CMFSIjpc.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Continuous Event Graph — Types
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GraphConfig, c as ExecutionState, T as TaskConfig, e as GraphEngineStore } from './types-
|
|
1
|
+
import { G as GraphConfig, c as ExecutionState, T as TaskConfig, e as GraphEngineStore } from './types-CMFSIjpc.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Continuous Event Graph — Types
|
|
@@ -134,7 +134,7 @@ interface StuckDetection {
|
|
|
134
134
|
outputs_unresolvable: string[];
|
|
135
135
|
tasks_blocked: string[];
|
|
136
136
|
}
|
|
137
|
-
type GraphEvent = TaskStartedEvent | TaskCompletedEvent | TaskFailedEvent | TaskProgressEvent | TaskRestartEvent | InjectTokensEvent | AgentActionEvent |
|
|
137
|
+
type GraphEvent = TaskStartedEvent | TaskCompletedEvent | TaskFailedEvent | TaskProgressEvent | TaskRestartEvent | InjectTokensEvent | AgentActionEvent | TaskUpsertEvent | TaskRemovalEvent | NodeRequiresAddEvent | NodeRequiresRemoveEvent | NodeProvidesAddEvent | NodeProvidesRemoveEvent;
|
|
138
138
|
interface TaskStartedEvent {
|
|
139
139
|
type: 'task-started';
|
|
140
140
|
taskName: string;
|
|
@@ -165,6 +165,12 @@ interface TaskProgressEvent {
|
|
|
165
165
|
taskName: string;
|
|
166
166
|
message?: string;
|
|
167
167
|
progress?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Arbitrary update payload — used by source delivery to carry
|
|
170
|
+
* { bindTo, fetchedAt, dest } or { bindTo, failure, reason }.
|
|
171
|
+
* card-handler receives this via TaskHandlerInput.update.
|
|
172
|
+
*/
|
|
173
|
+
update?: Record<string, unknown>;
|
|
168
174
|
timestamp: string;
|
|
169
175
|
executionId?: string;
|
|
170
176
|
}
|
|
@@ -185,12 +191,41 @@ interface AgentActionEvent {
|
|
|
185
191
|
timestamp: string;
|
|
186
192
|
config?: Partial<ExecutionConfig>;
|
|
187
193
|
}
|
|
188
|
-
interface
|
|
189
|
-
type: 'task-
|
|
194
|
+
interface TaskUpsertEvent {
|
|
195
|
+
type: 'task-upsert';
|
|
190
196
|
taskName: string;
|
|
191
197
|
taskConfig: TaskConfig;
|
|
192
198
|
timestamp: string;
|
|
193
199
|
}
|
|
200
|
+
interface TaskRemovalEvent {
|
|
201
|
+
type: 'task-removal';
|
|
202
|
+
taskName: string;
|
|
203
|
+
timestamp: string;
|
|
204
|
+
}
|
|
205
|
+
interface NodeRequiresAddEvent {
|
|
206
|
+
type: 'node-requires-add';
|
|
207
|
+
nodeName: string;
|
|
208
|
+
tokens: string[];
|
|
209
|
+
timestamp: string;
|
|
210
|
+
}
|
|
211
|
+
interface NodeRequiresRemoveEvent {
|
|
212
|
+
type: 'node-requires-remove';
|
|
213
|
+
nodeName: string;
|
|
214
|
+
tokens: string[];
|
|
215
|
+
timestamp: string;
|
|
216
|
+
}
|
|
217
|
+
interface NodeProvidesAddEvent {
|
|
218
|
+
type: 'node-provides-add';
|
|
219
|
+
nodeName: string;
|
|
220
|
+
tokens: string[];
|
|
221
|
+
timestamp: string;
|
|
222
|
+
}
|
|
223
|
+
interface NodeProvidesRemoveEvent {
|
|
224
|
+
type: 'node-provides-remove';
|
|
225
|
+
nodeName: string;
|
|
226
|
+
tokens: string[];
|
|
227
|
+
timestamp: string;
|
|
228
|
+
}
|
|
194
229
|
interface SchedulerResult {
|
|
195
230
|
/** Tasks eligible for execution */
|
|
196
231
|
eligibleTasks: string[];
|
|
@@ -214,4 +249,4 @@ type ExecutionMode = 'dependency-mode' | 'eligibility-mode';
|
|
|
214
249
|
type ConflictStrategy = 'alphabetical' | 'priority-first' | 'duration-first' | 'cost-optimized' | 'resource-aware' | 'random-select' | 'user-choice' | 'parallel-all' | 'skip-conflicts' | 'round-robin';
|
|
215
250
|
type RefreshStrategy = 'data-changed' | 'epoch-changed' | 'time-based' | 'manual' | 'once';
|
|
216
251
|
|
|
217
|
-
export type { AgentActionEvent as A, CompletionStrategy as C, ExecutionConfig as E, GraphConfig as G, InjectTokensEvent as I, RefreshStrategy as R, SchedulerResult as S, TaskConfig as T, ConflictStrategy as a, ExecutionMode as b, ExecutionState as c, ExecutionStatus as d, GraphEngineStore as e, GraphEvent as f, GraphSettings as g, StuckDetection as h, TaskCompletedEvent as i,
|
|
252
|
+
export type { AgentActionEvent as A, CompletionStrategy as C, ExecutionConfig as E, GraphConfig as G, InjectTokensEvent as I, RefreshStrategy as R, SchedulerResult as S, TaskConfig as T, ConflictStrategy as a, ExecutionMode as b, ExecutionState as c, ExecutionStatus as d, GraphEngineStore as e, GraphEvent as f, GraphSettings as g, StuckDetection as h, TaskCompletedEvent as i, TaskFailedEvent as j, TaskStartedEvent as k, TaskStatus as l, TaskCircuitBreakerConfig as m, TaskMessage as n, TaskProgressEvent as o, TaskRestartEvent as p, TaskRetryConfig as q };
|
|
@@ -134,7 +134,7 @@ interface StuckDetection {
|
|
|
134
134
|
outputs_unresolvable: string[];
|
|
135
135
|
tasks_blocked: string[];
|
|
136
136
|
}
|
|
137
|
-
type GraphEvent = TaskStartedEvent | TaskCompletedEvent | TaskFailedEvent | TaskProgressEvent | TaskRestartEvent | InjectTokensEvent | AgentActionEvent |
|
|
137
|
+
type GraphEvent = TaskStartedEvent | TaskCompletedEvent | TaskFailedEvent | TaskProgressEvent | TaskRestartEvent | InjectTokensEvent | AgentActionEvent | TaskUpsertEvent | TaskRemovalEvent | NodeRequiresAddEvent | NodeRequiresRemoveEvent | NodeProvidesAddEvent | NodeProvidesRemoveEvent;
|
|
138
138
|
interface TaskStartedEvent {
|
|
139
139
|
type: 'task-started';
|
|
140
140
|
taskName: string;
|
|
@@ -165,6 +165,12 @@ interface TaskProgressEvent {
|
|
|
165
165
|
taskName: string;
|
|
166
166
|
message?: string;
|
|
167
167
|
progress?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Arbitrary update payload — used by source delivery to carry
|
|
170
|
+
* { bindTo, fetchedAt, dest } or { bindTo, failure, reason }.
|
|
171
|
+
* card-handler receives this via TaskHandlerInput.update.
|
|
172
|
+
*/
|
|
173
|
+
update?: Record<string, unknown>;
|
|
168
174
|
timestamp: string;
|
|
169
175
|
executionId?: string;
|
|
170
176
|
}
|
|
@@ -185,12 +191,41 @@ interface AgentActionEvent {
|
|
|
185
191
|
timestamp: string;
|
|
186
192
|
config?: Partial<ExecutionConfig>;
|
|
187
193
|
}
|
|
188
|
-
interface
|
|
189
|
-
type: 'task-
|
|
194
|
+
interface TaskUpsertEvent {
|
|
195
|
+
type: 'task-upsert';
|
|
190
196
|
taskName: string;
|
|
191
197
|
taskConfig: TaskConfig;
|
|
192
198
|
timestamp: string;
|
|
193
199
|
}
|
|
200
|
+
interface TaskRemovalEvent {
|
|
201
|
+
type: 'task-removal';
|
|
202
|
+
taskName: string;
|
|
203
|
+
timestamp: string;
|
|
204
|
+
}
|
|
205
|
+
interface NodeRequiresAddEvent {
|
|
206
|
+
type: 'node-requires-add';
|
|
207
|
+
nodeName: string;
|
|
208
|
+
tokens: string[];
|
|
209
|
+
timestamp: string;
|
|
210
|
+
}
|
|
211
|
+
interface NodeRequiresRemoveEvent {
|
|
212
|
+
type: 'node-requires-remove';
|
|
213
|
+
nodeName: string;
|
|
214
|
+
tokens: string[];
|
|
215
|
+
timestamp: string;
|
|
216
|
+
}
|
|
217
|
+
interface NodeProvidesAddEvent {
|
|
218
|
+
type: 'node-provides-add';
|
|
219
|
+
nodeName: string;
|
|
220
|
+
tokens: string[];
|
|
221
|
+
timestamp: string;
|
|
222
|
+
}
|
|
223
|
+
interface NodeProvidesRemoveEvent {
|
|
224
|
+
type: 'node-provides-remove';
|
|
225
|
+
nodeName: string;
|
|
226
|
+
tokens: string[];
|
|
227
|
+
timestamp: string;
|
|
228
|
+
}
|
|
194
229
|
interface SchedulerResult {
|
|
195
230
|
/** Tasks eligible for execution */
|
|
196
231
|
eligibleTasks: string[];
|
|
@@ -214,4 +249,4 @@ type ExecutionMode = 'dependency-mode' | 'eligibility-mode';
|
|
|
214
249
|
type ConflictStrategy = 'alphabetical' | 'priority-first' | 'duration-first' | 'cost-optimized' | 'resource-aware' | 'random-select' | 'user-choice' | 'parallel-all' | 'skip-conflicts' | 'round-robin';
|
|
215
250
|
type RefreshStrategy = 'data-changed' | 'epoch-changed' | 'time-based' | 'manual' | 'once';
|
|
216
251
|
|
|
217
|
-
export type { AgentActionEvent as A, CompletionStrategy as C, ExecutionConfig as E, GraphConfig as G, InjectTokensEvent as I, RefreshStrategy as R, SchedulerResult as S, TaskConfig as T, ConflictStrategy as a, ExecutionMode as b, ExecutionState as c, ExecutionStatus as d, GraphEngineStore as e, GraphEvent as f, GraphSettings as g, StuckDetection as h, TaskCompletedEvent as i,
|
|
252
|
+
export type { AgentActionEvent as A, CompletionStrategy as C, ExecutionConfig as E, GraphConfig as G, InjectTokensEvent as I, RefreshStrategy as R, SchedulerResult as S, TaskConfig as T, ConflictStrategy as a, ExecutionMode as b, ExecutionState as c, ExecutionStatus as d, GraphEngineStore as e, GraphEvent as f, GraphSettings as g, StuckDetection as h, TaskCompletedEvent as i, TaskFailedEvent as j, TaskStartedEvent as k, TaskStatus as l, TaskCircuitBreakerConfig as m, TaskMessage as n, TaskProgressEvent as o, TaskRestartEvent as p, TaskRetryConfig as q };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "holdings-table",
|
|
3
|
+
"meta": { "title": "Holdings Table" },
|
|
4
|
+
"requires": ["holdings", "prices"],
|
|
5
|
+
"provides": [{ "bindTo": "table", "src": "computed_values.table" }],
|
|
6
|
+
"card_data": {},
|
|
7
|
+
"compute": [
|
|
8
|
+
{
|
|
9
|
+
"bindTo": "table",
|
|
10
|
+
"expr": "{ \"rows\": $map(requires.holdings, function($h) { { \"symbol\": $h.symbol, \"qty\": $h.qty, \"price\": $lookup(requires.prices, $h.symbol), \"value\": $h.qty * $lookup(requires.prices, $h.symbol) } }) }"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"view": {
|
|
14
|
+
"elements": [
|
|
15
|
+
{
|
|
16
|
+
"kind": "table",
|
|
17
|
+
"label": "Portfolio Positions",
|
|
18
|
+
"data": { "bind": "computed_values.table.rows", "columns": ["symbol", "qty", "price", "value"] }
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "portfolio-form",
|
|
3
|
+
"meta": { "title": "Portfolio Holdings Form" },
|
|
4
|
+
"provides": [{ "bindTo": "holdings", "src": "card_data.holdings" }],
|
|
5
|
+
"card_data": {
|
|
6
|
+
"holdings": [
|
|
7
|
+
{ "symbol": "AAPL", "qty": 50 },
|
|
8
|
+
{ "symbol": "MSFT", "qty": 30 }
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"view": {
|
|
12
|
+
"elements": [
|
|
13
|
+
{ "kind": "table", "label": "Holdings", "data": { "bind": "card_data.holdings", "columns": ["symbol", "qty"] } }
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "portfolio-value",
|
|
3
|
+
"meta": { "title": "Portfolio Total Value" },
|
|
4
|
+
"requires": ["table"],
|
|
5
|
+
"provides": [{ "bindTo": "totalValue", "src": "computed_values.totalValue" }],
|
|
6
|
+
"card_data": {},
|
|
7
|
+
"compute": [
|
|
8
|
+
{ "bindTo": "totalValue", "expr": "$sum(requires.table.rows.value)" }
|
|
9
|
+
],
|
|
10
|
+
"view": {
|
|
11
|
+
"elements": [
|
|
12
|
+
{ "kind": "metric", "label": "Total Portfolio Value", "data": { "bind": "computed_values.totalValue" } }
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "price-fetch",
|
|
3
|
+
"meta": { "title": "Fetch Market Prices" },
|
|
4
|
+
"requires": ["holdings"],
|
|
5
|
+
"provides": [{ "bindTo": "prices", "src": "fetched_sources.prices" }],
|
|
6
|
+
"card_data": {},
|
|
7
|
+
"sources": [
|
|
8
|
+
{ "cli": "node ../fetch-prices.js", "bindTo": "prices", "outputFile": "prices.json" }
|
|
9
|
+
],
|
|
10
|
+
"view": {
|
|
11
|
+
"elements": [
|
|
12
|
+
{ "kind": "table", "label": "Market Prices", "data": { "bind": "fetched_sources.prices" } }
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fetch-prices.js
|
|
3
|
+
* Polls for tmp_file1 payload and outputs JSON to stdout once available.
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'node:fs';
|
|
6
|
+
import * as path from 'node:path';
|
|
7
|
+
|
|
8
|
+
const envBoardDir = (process.env.BOARD_DIR ?? '').trim();
|
|
9
|
+
const tmpFileCandidates = [
|
|
10
|
+
envBoardDir ? path.join(envBoardDir, 'tmp_file1') : '',
|
|
11
|
+
path.join(process.cwd(), 'tmp_file1'),
|
|
12
|
+
path.join(process.cwd(), 'board-runtime', 'tmp_file1'),
|
|
13
|
+
path.join(process.cwd(), '..', 'board-runtime', 'tmp_file1'),
|
|
14
|
+
].filter(Boolean);
|
|
15
|
+
|
|
16
|
+
function getReadableTmpFile() {
|
|
17
|
+
for (const tmpFile of tmpFileCandidates) {
|
|
18
|
+
if (!fs.existsSync(tmpFile)) continue;
|
|
19
|
+
const content = fs.readFileSync(tmpFile, 'utf-8').trim();
|
|
20
|
+
if (content) return { tmpFile, content };
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function waitForFile(timeoutMs = 120000) {
|
|
26
|
+
const started = Date.now();
|
|
27
|
+
const interval = setInterval(() => {
|
|
28
|
+
if (Date.now() - started > timeoutMs) {
|
|
29
|
+
clearInterval(interval);
|
|
30
|
+
console.error('Timed out waiting for tmp_file1 market prices input.');
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const ready = getReadableTmpFile();
|
|
35
|
+
if (!ready) return;
|
|
36
|
+
|
|
37
|
+
clearInterval(interval);
|
|
38
|
+
fs.writeFileSync(ready.tmpFile, '', 'utf-8');
|
|
39
|
+
process.stdout.write(`${ready.content}\n`);
|
|
40
|
+
}, 250);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
waitForFile();
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Portfolio Tracker Task-Executor
|
|
4
|
+
*
|
|
5
|
+
* Implements the run-source-fetch protocol for board-live-cards.
|
|
6
|
+
* This script acts as an external task-executor that can be registered via .task-executor file.
|
|
7
|
+
*
|
|
8
|
+
* Contract:
|
|
9
|
+
* portfolio-tracker-task-executor.js run-source-fetch --in <defFile> --out <resultFile> --err <errFile>
|
|
10
|
+
*
|
|
11
|
+
* Input (--in file):
|
|
12
|
+
* JSON source definition with { cli: "...", bindTo: "...", outputFile: "...", ... }
|
|
13
|
+
*
|
|
14
|
+
* Output (on success):
|
|
15
|
+
* --out file contains the execution result
|
|
16
|
+
* Exit code: 0
|
|
17
|
+
*
|
|
18
|
+
* Output (on error):
|
|
19
|
+
* --err file contains error message
|
|
20
|
+
* Exit code: 1
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const fs = require('fs');
|
|
24
|
+
const path = require('path');
|
|
25
|
+
const { execSync } = require('child_process');
|
|
26
|
+
|
|
27
|
+
// Parse command line arguments
|
|
28
|
+
const args = process.argv.slice(2);
|
|
29
|
+
let subcommand = '';
|
|
30
|
+
let inFile = '';
|
|
31
|
+
let outFile = '';
|
|
32
|
+
let errFile = '';
|
|
33
|
+
|
|
34
|
+
for (let i = 0; i < args.length; i++) {
|
|
35
|
+
if (args[i] === 'run-source-fetch') {
|
|
36
|
+
subcommand = 'run-source-fetch';
|
|
37
|
+
} else if (args[i] === '--in' && i + 1 < args.length) {
|
|
38
|
+
inFile = args[i + 1];
|
|
39
|
+
} else if (args[i] === '--out' && i + 1 < args.length) {
|
|
40
|
+
outFile = args[i + 1];
|
|
41
|
+
} else if (args[i] === '--err' && i + 1 < args.length) {
|
|
42
|
+
errFile = args[i + 1];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (subcommand !== 'run-source-fetch' || !inFile || !outFile || !errFile) {
|
|
47
|
+
console.error('Usage: portfolio-tracker-task-executor.js run-source-fetch --in <defFile> --out <resultFile> --err <errFile>');
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
// 1. Read source definition from --in file
|
|
53
|
+
console.log(`[portfolio-tracker-task-executor] Reading source definition from ${inFile}`);
|
|
54
|
+
const sourceDefStr = fs.readFileSync(inFile, 'utf-8');
|
|
55
|
+
const sourceDef = JSON.parse(sourceDefStr);
|
|
56
|
+
|
|
57
|
+
// 2. Extract cli command from source definition
|
|
58
|
+
const { cli: sourceCliCommand } = sourceDef;
|
|
59
|
+
if (!sourceCliCommand) {
|
|
60
|
+
throw new Error('cli is required in source definition');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
console.log(`[portfolio-tracker-task-executor] Executing: ${sourceCliCommand}`);
|
|
64
|
+
|
|
65
|
+
// 3. Execute source.cli synchronously and capture output
|
|
66
|
+
let output;
|
|
67
|
+
try {
|
|
68
|
+
output = execSync(sourceCliCommand, {
|
|
69
|
+
encoding: 'utf-8',
|
|
70
|
+
timeout: (sourceDef.timeout ?? 120) * 1000, // Convert to ms
|
|
71
|
+
cwd: sourceDef.cwd,
|
|
72
|
+
shell: true,
|
|
73
|
+
stdio: ['pipe', 'pipe', 'pipe'], // Capture stdout/stderr
|
|
74
|
+
});
|
|
75
|
+
} catch (execErr) {
|
|
76
|
+
// Even on error, try to use what output we got
|
|
77
|
+
output = execErr.stdout || '';
|
|
78
|
+
if (!output) {
|
|
79
|
+
throw new Error(`Command execution failed: ${execErr.message}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 4. Write output to --out file
|
|
84
|
+
console.log(`[portfolio-tracker-task-executor] Writing result to ${outFile}`);
|
|
85
|
+
fs.writeFileSync(outFile, output.trim(), 'utf-8');
|
|
86
|
+
|
|
87
|
+
console.log(`[portfolio-tracker-task-executor] Success`);
|
|
88
|
+
process.exit(0);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
// 3a. On error: write error message to --err file and exit non-zero
|
|
91
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
92
|
+
console.error(`[portfolio-tracker-task-executor] Error:`, errorMsg);
|
|
93
|
+
|
|
94
|
+
fs.writeFileSync(errFile, errorMsg, 'utf-8');
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|