yaml-flow 2.7.0 → 3.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 +168 -3
- package/browser/ingest-board.js +296 -0
- package/browser/live-cards.js +303 -0
- package/browser/live-cards.schema.json +22 -2
- package/dist/card-compute/index.cjs +6751 -0
- package/dist/card-compute/index.cjs.map +1 -1
- package/dist/card-compute/index.d.cts +24 -1
- package/dist/card-compute/index.d.ts +24 -1
- package/dist/card-compute/index.js +6747 -1
- package/dist/card-compute/index.js.map +1 -1
- package/dist/{constants-BEbO2_OK.d.ts → constants-B_ftYTTE.d.ts} +36 -6
- package/dist/{constants-BNjeIlZ8.d.cts → constants-CiyHX8L-.d.cts} +36 -6
- package/dist/continuous-event-graph/index.cjs +399 -42
- package/dist/continuous-event-graph/index.cjs.map +1 -1
- package/dist/continuous-event-graph/index.d.cts +124 -5
- package/dist/continuous-event-graph/index.d.ts +124 -5
- package/dist/continuous-event-graph/index.js +396 -43
- package/dist/continuous-event-graph/index.js.map +1 -1
- package/dist/event-graph/index.cjs +6784 -44
- 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 +6777 -43
- package/dist/event-graph/index.js.map +1 -1
- package/dist/index.cjs +7678 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +7665 -73
- package/dist/index.js.map +1 -1
- package/dist/inference/index.cjs +17 -8
- 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 +17 -8
- package/dist/inference/index.js.map +1 -1
- package/dist/step-machine/index.cjs +6600 -0
- package/dist/step-machine/index.cjs.map +1 -1
- package/dist/step-machine/index.d.cts +26 -1
- package/dist/step-machine/index.d.ts +26 -1
- package/dist/step-machine/index.js +6596 -1
- package/dist/step-machine/index.js.map +1 -1
- package/dist/{types-DAI_a2as.d.ts → types-BpWrH1sf.d.cts} +16 -7
- package/dist/{types-DAI_a2as.d.cts → types-BpWrH1sf.d.ts} +16 -7
- package/dist/{types-mS_pPftm.d.ts → types-BuEo3wVG.d.ts} +1 -1
- package/dist/{types-C2lOwquM.d.cts → types-CxJg9Jrt.d.cts} +1 -1
- package/package.json +3 -2
- package/schema/event-graph.schema.json +254 -0
- package/schema/live-cards.schema.json +22 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as LiveGraph, N as NodeInfo, b as LiveGraphSnapshot, S as ScheduleResult, D as DownstreamResult, U as UnreachableNodesResult, c as UnreachableTokensResult, e as UpstreamResult, a as LiveGraphHealth } from '../types-
|
|
2
|
-
export { B as BlockedTask, P as PendingTask, d as UnresolvedDependency } from '../types-
|
|
3
|
-
import { T as TaskConfig, e as GraphEvent, G as GraphConfig } from '../types-
|
|
4
|
-
export { c as ExecutionState, f as GraphSettings, l as TaskState } from '../types-
|
|
1
|
+
import { L as LiveGraph, N as NodeInfo, b as LiveGraphSnapshot, S as ScheduleResult, D as DownstreamResult, U as UnreachableNodesResult, c as UnreachableTokensResult, e as UpstreamResult, a as LiveGraphHealth } from '../types-CxJg9Jrt.cjs';
|
|
2
|
+
export { B as BlockedTask, P as PendingTask, d as UnresolvedDependency } from '../types-CxJg9Jrt.cjs';
|
|
3
|
+
import { T as TaskConfig, e as GraphEvent, G as GraphConfig } from '../types-BpWrH1sf.cjs';
|
|
4
|
+
export { c as ExecutionState, f as GraphSettings, l as TaskState } from '../types-BpWrH1sf.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Continuous Event Graph — Core
|
|
@@ -27,6 +27,12 @@ declare function createLiveGraph(config: GraphConfig, executionId?: string): Liv
|
|
|
27
27
|
* Config is NOT mutated by events — only state changes.
|
|
28
28
|
*/
|
|
29
29
|
declare function applyEvent(live: LiveGraph, event: GraphEvent): LiveGraph;
|
|
30
|
+
/**
|
|
31
|
+
* Apply multiple events atomically to a LiveGraph.
|
|
32
|
+
* Events are reduced sequentially, but the caller only sees the final state.
|
|
33
|
+
* Use this for batch processing (e.g. draining a journal of pending events).
|
|
34
|
+
*/
|
|
35
|
+
declare function applyEvents(live: LiveGraph, events: GraphEvent[]): LiveGraph;
|
|
30
36
|
/**
|
|
31
37
|
* Add a node (task) to the live graph. Updates both config and state atomically.
|
|
32
38
|
* If the node already exists, returns the graph unchanged.
|
|
@@ -176,4 +182,117 @@ declare function getUpstream(live: LiveGraph, nodeName: string): UpstreamResult;
|
|
|
176
182
|
*/
|
|
177
183
|
declare function getDownstream(live: LiveGraph, nodeName: string): DownstreamResult;
|
|
178
184
|
|
|
179
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Continuous Event Graph — Journal
|
|
187
|
+
*
|
|
188
|
+
* Append-only event log for the reactive layer.
|
|
189
|
+
* Handlers append events here; drain() reads and clears atomically.
|
|
190
|
+
*
|
|
191
|
+
* Two adapters:
|
|
192
|
+
* - MemoryJournal: in-process array (default)
|
|
193
|
+
* - FileJournal: append to a JSONL file, truncate on drain
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
interface Journal {
|
|
197
|
+
/** Append an event to the journal. Safe to call from concurrent callbacks. */
|
|
198
|
+
append(event: GraphEvent): void;
|
|
199
|
+
/** Read all pending events and clear the journal atomically. */
|
|
200
|
+
drain(): GraphEvent[];
|
|
201
|
+
/** Number of pending events (for observability). */
|
|
202
|
+
readonly size: number;
|
|
203
|
+
}
|
|
204
|
+
declare class MemoryJournal implements Journal {
|
|
205
|
+
private buffer;
|
|
206
|
+
append(event: GraphEvent): void;
|
|
207
|
+
drain(): GraphEvent[];
|
|
208
|
+
get size(): number;
|
|
209
|
+
}
|
|
210
|
+
declare class FileJournal implements Journal {
|
|
211
|
+
private readonly path;
|
|
212
|
+
private pending;
|
|
213
|
+
constructor(path: string);
|
|
214
|
+
append(event: GraphEvent): void;
|
|
215
|
+
drain(): GraphEvent[];
|
|
216
|
+
get size(): number;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Continuous Event Graph — Reactive Layer
|
|
221
|
+
*
|
|
222
|
+
* Push-based, self-sustaining execution wrapper.
|
|
223
|
+
*
|
|
224
|
+
* Pattern:
|
|
225
|
+
* 1. Register handlers for tasks
|
|
226
|
+
* 2. Push an event (or inject tokens)
|
|
227
|
+
* 3. The graph drives itself: drain journal → applyEvents → schedule → dispatch → repeat
|
|
228
|
+
*
|
|
229
|
+
* No daemon, no polling. Each handler callback appends to the journal,
|
|
230
|
+
* which triggers a drain cycle that may dispatch the next wave.
|
|
231
|
+
*
|
|
232
|
+
* Dispatch failures, retries, and timeouts are managed internally
|
|
233
|
+
* without touching the core engine types.
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
/** Context passed to task handlers. */
|
|
237
|
+
interface TaskHandlerContext {
|
|
238
|
+
/** Name of the task being executed */
|
|
239
|
+
taskName: string;
|
|
240
|
+
/** Current snapshot of the live graph (read-only — do not mutate) */
|
|
241
|
+
live: Readonly<LiveGraph>;
|
|
242
|
+
/** The task's own config */
|
|
243
|
+
config: TaskConfig;
|
|
244
|
+
}
|
|
245
|
+
/** A task handler function. Return value becomes the event's `data` payload. */
|
|
246
|
+
type TaskHandler = (ctx: TaskHandlerContext) => Promise<TaskHandlerResult>;
|
|
247
|
+
interface TaskHandlerResult {
|
|
248
|
+
/** Optional result key for conditional routing (task's `on` map) */
|
|
249
|
+
result?: string;
|
|
250
|
+
/** Optional data payload */
|
|
251
|
+
data?: Record<string, unknown>;
|
|
252
|
+
/** Optional content hash for data-changed strategy */
|
|
253
|
+
dataHash?: string;
|
|
254
|
+
}
|
|
255
|
+
/** Internal dispatch tracking — NOT exposed to the core engine. */
|
|
256
|
+
interface DispatchEntry {
|
|
257
|
+
status: 'initiated' | 'dispatch-failed' | 'timed-out' | 'retry-queued' | 'abandoned';
|
|
258
|
+
dispatchedAt: number;
|
|
259
|
+
dispatchAttempts: number;
|
|
260
|
+
lastError?: string;
|
|
261
|
+
}
|
|
262
|
+
interface ReactiveGraphOptions {
|
|
263
|
+
/** Task handlers keyed by task name */
|
|
264
|
+
handlers: Record<string, TaskHandler>;
|
|
265
|
+
/** Max times to retry dispatching a handler that fails to invoke (default: 3) */
|
|
266
|
+
maxDispatchRetries?: number;
|
|
267
|
+
/** Default timeout in ms for handler callbacks (default: 30000). 0 = no timeout. */
|
|
268
|
+
defaultTimeoutMs?: number;
|
|
269
|
+
/** Journal adapter (default: MemoryJournal) */
|
|
270
|
+
journal?: Journal;
|
|
271
|
+
/** Called when a handler fails to dispatch */
|
|
272
|
+
onDispatchFailed?: (taskName: string, error: Error, attempt: number) => void;
|
|
273
|
+
/** Called when a task is abandoned after max dispatch retries */
|
|
274
|
+
onAbandoned?: (taskName: string) => void;
|
|
275
|
+
/** Called after each drain cycle — for observability */
|
|
276
|
+
onDrain?: (events: GraphEvent[], live: LiveGraph, scheduleResult: ScheduleResult) => void;
|
|
277
|
+
}
|
|
278
|
+
interface ReactiveGraph {
|
|
279
|
+
/** Push an event into the graph. Triggers drain → schedule → dispatch cascade. */
|
|
280
|
+
push(event: GraphEvent): void;
|
|
281
|
+
/** Push multiple events. Single drain cycle after all are journaled. */
|
|
282
|
+
pushAll(events: GraphEvent[]): void;
|
|
283
|
+
/** Add a node with its handler. Triggers re-evaluation. */
|
|
284
|
+
addNode(name: string, taskConfig: TaskConfig, handler: TaskHandler): void;
|
|
285
|
+
/** Remove a node and its handler. */
|
|
286
|
+
removeNode(name: string): void;
|
|
287
|
+
/** Read-only snapshot of current LiveGraph state. */
|
|
288
|
+
getState(): LiveGraph;
|
|
289
|
+
/** Current schedule projection. */
|
|
290
|
+
getSchedule(): ScheduleResult;
|
|
291
|
+
/** Internal dispatch tracking (for observability/debugging). */
|
|
292
|
+
getDispatchState(): ReadonlyMap<string, DispatchEntry>;
|
|
293
|
+
/** Cancel pending timeouts and stop dispatching. */
|
|
294
|
+
dispose(): void;
|
|
295
|
+
}
|
|
296
|
+
declare function createReactiveGraph(config: GraphConfig, options: ReactiveGraphOptions, executionId?: string): ReactiveGraph;
|
|
297
|
+
|
|
298
|
+
export { type DispatchEntry, DownstreamResult, FileJournal, GraphConfig, GraphEvent, type Journal, LiveGraph, LiveGraphHealth, LiveGraphSnapshot, MemoryJournal, NodeInfo, type ReactiveGraph, type ReactiveGraphOptions, ScheduleResult, TaskConfig, type TaskHandler, type TaskHandlerContext, type TaskHandlerResult, UnreachableNodesResult, UnreachableTokensResult, UpstreamResult, addNode, addProvides, addRequires, applyEvent, applyEvents, createLiveGraph, createReactiveGraph, disableNode, drainTokens, enableNode, getDownstream, getNode, getUnreachableNodes, getUnreachableTokens, getUpstream, injectTokens, inspect, removeNode, removeProvides, removeRequires, resetNode, restore, schedule, snapshot };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as LiveGraph, N as NodeInfo, b as LiveGraphSnapshot, S as ScheduleResult, D as DownstreamResult, U as UnreachableNodesResult, c as UnreachableTokensResult, e as UpstreamResult, a as LiveGraphHealth } from '../types-
|
|
2
|
-
export { B as BlockedTask, P as PendingTask, d as UnresolvedDependency } from '../types-
|
|
3
|
-
import { T as TaskConfig, e as GraphEvent, G as GraphConfig } from '../types-
|
|
4
|
-
export { c as ExecutionState, f as GraphSettings, l as TaskState } from '../types-
|
|
1
|
+
import { L as LiveGraph, N as NodeInfo, b as LiveGraphSnapshot, S as ScheduleResult, D as DownstreamResult, U as UnreachableNodesResult, c as UnreachableTokensResult, e as UpstreamResult, a as LiveGraphHealth } from '../types-BuEo3wVG.js';
|
|
2
|
+
export { B as BlockedTask, P as PendingTask, d as UnresolvedDependency } from '../types-BuEo3wVG.js';
|
|
3
|
+
import { T as TaskConfig, e as GraphEvent, G as GraphConfig } from '../types-BpWrH1sf.js';
|
|
4
|
+
export { c as ExecutionState, f as GraphSettings, l as TaskState } from '../types-BpWrH1sf.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Continuous Event Graph — Core
|
|
@@ -27,6 +27,12 @@ declare function createLiveGraph(config: GraphConfig, executionId?: string): Liv
|
|
|
27
27
|
* Config is NOT mutated by events — only state changes.
|
|
28
28
|
*/
|
|
29
29
|
declare function applyEvent(live: LiveGraph, event: GraphEvent): LiveGraph;
|
|
30
|
+
/**
|
|
31
|
+
* Apply multiple events atomically to a LiveGraph.
|
|
32
|
+
* Events are reduced sequentially, but the caller only sees the final state.
|
|
33
|
+
* Use this for batch processing (e.g. draining a journal of pending events).
|
|
34
|
+
*/
|
|
35
|
+
declare function applyEvents(live: LiveGraph, events: GraphEvent[]): LiveGraph;
|
|
30
36
|
/**
|
|
31
37
|
* Add a node (task) to the live graph. Updates both config and state atomically.
|
|
32
38
|
* If the node already exists, returns the graph unchanged.
|
|
@@ -176,4 +182,117 @@ declare function getUpstream(live: LiveGraph, nodeName: string): UpstreamResult;
|
|
|
176
182
|
*/
|
|
177
183
|
declare function getDownstream(live: LiveGraph, nodeName: string): DownstreamResult;
|
|
178
184
|
|
|
179
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Continuous Event Graph — Journal
|
|
187
|
+
*
|
|
188
|
+
* Append-only event log for the reactive layer.
|
|
189
|
+
* Handlers append events here; drain() reads and clears atomically.
|
|
190
|
+
*
|
|
191
|
+
* Two adapters:
|
|
192
|
+
* - MemoryJournal: in-process array (default)
|
|
193
|
+
* - FileJournal: append to a JSONL file, truncate on drain
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
interface Journal {
|
|
197
|
+
/** Append an event to the journal. Safe to call from concurrent callbacks. */
|
|
198
|
+
append(event: GraphEvent): void;
|
|
199
|
+
/** Read all pending events and clear the journal atomically. */
|
|
200
|
+
drain(): GraphEvent[];
|
|
201
|
+
/** Number of pending events (for observability). */
|
|
202
|
+
readonly size: number;
|
|
203
|
+
}
|
|
204
|
+
declare class MemoryJournal implements Journal {
|
|
205
|
+
private buffer;
|
|
206
|
+
append(event: GraphEvent): void;
|
|
207
|
+
drain(): GraphEvent[];
|
|
208
|
+
get size(): number;
|
|
209
|
+
}
|
|
210
|
+
declare class FileJournal implements Journal {
|
|
211
|
+
private readonly path;
|
|
212
|
+
private pending;
|
|
213
|
+
constructor(path: string);
|
|
214
|
+
append(event: GraphEvent): void;
|
|
215
|
+
drain(): GraphEvent[];
|
|
216
|
+
get size(): number;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Continuous Event Graph — Reactive Layer
|
|
221
|
+
*
|
|
222
|
+
* Push-based, self-sustaining execution wrapper.
|
|
223
|
+
*
|
|
224
|
+
* Pattern:
|
|
225
|
+
* 1. Register handlers for tasks
|
|
226
|
+
* 2. Push an event (or inject tokens)
|
|
227
|
+
* 3. The graph drives itself: drain journal → applyEvents → schedule → dispatch → repeat
|
|
228
|
+
*
|
|
229
|
+
* No daemon, no polling. Each handler callback appends to the journal,
|
|
230
|
+
* which triggers a drain cycle that may dispatch the next wave.
|
|
231
|
+
*
|
|
232
|
+
* Dispatch failures, retries, and timeouts are managed internally
|
|
233
|
+
* without touching the core engine types.
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
/** Context passed to task handlers. */
|
|
237
|
+
interface TaskHandlerContext {
|
|
238
|
+
/** Name of the task being executed */
|
|
239
|
+
taskName: string;
|
|
240
|
+
/** Current snapshot of the live graph (read-only — do not mutate) */
|
|
241
|
+
live: Readonly<LiveGraph>;
|
|
242
|
+
/** The task's own config */
|
|
243
|
+
config: TaskConfig;
|
|
244
|
+
}
|
|
245
|
+
/** A task handler function. Return value becomes the event's `data` payload. */
|
|
246
|
+
type TaskHandler = (ctx: TaskHandlerContext) => Promise<TaskHandlerResult>;
|
|
247
|
+
interface TaskHandlerResult {
|
|
248
|
+
/** Optional result key for conditional routing (task's `on` map) */
|
|
249
|
+
result?: string;
|
|
250
|
+
/** Optional data payload */
|
|
251
|
+
data?: Record<string, unknown>;
|
|
252
|
+
/** Optional content hash for data-changed strategy */
|
|
253
|
+
dataHash?: string;
|
|
254
|
+
}
|
|
255
|
+
/** Internal dispatch tracking — NOT exposed to the core engine. */
|
|
256
|
+
interface DispatchEntry {
|
|
257
|
+
status: 'initiated' | 'dispatch-failed' | 'timed-out' | 'retry-queued' | 'abandoned';
|
|
258
|
+
dispatchedAt: number;
|
|
259
|
+
dispatchAttempts: number;
|
|
260
|
+
lastError?: string;
|
|
261
|
+
}
|
|
262
|
+
interface ReactiveGraphOptions {
|
|
263
|
+
/** Task handlers keyed by task name */
|
|
264
|
+
handlers: Record<string, TaskHandler>;
|
|
265
|
+
/** Max times to retry dispatching a handler that fails to invoke (default: 3) */
|
|
266
|
+
maxDispatchRetries?: number;
|
|
267
|
+
/** Default timeout in ms for handler callbacks (default: 30000). 0 = no timeout. */
|
|
268
|
+
defaultTimeoutMs?: number;
|
|
269
|
+
/** Journal adapter (default: MemoryJournal) */
|
|
270
|
+
journal?: Journal;
|
|
271
|
+
/** Called when a handler fails to dispatch */
|
|
272
|
+
onDispatchFailed?: (taskName: string, error: Error, attempt: number) => void;
|
|
273
|
+
/** Called when a task is abandoned after max dispatch retries */
|
|
274
|
+
onAbandoned?: (taskName: string) => void;
|
|
275
|
+
/** Called after each drain cycle — for observability */
|
|
276
|
+
onDrain?: (events: GraphEvent[], live: LiveGraph, scheduleResult: ScheduleResult) => void;
|
|
277
|
+
}
|
|
278
|
+
interface ReactiveGraph {
|
|
279
|
+
/** Push an event into the graph. Triggers drain → schedule → dispatch cascade. */
|
|
280
|
+
push(event: GraphEvent): void;
|
|
281
|
+
/** Push multiple events. Single drain cycle after all are journaled. */
|
|
282
|
+
pushAll(events: GraphEvent[]): void;
|
|
283
|
+
/** Add a node with its handler. Triggers re-evaluation. */
|
|
284
|
+
addNode(name: string, taskConfig: TaskConfig, handler: TaskHandler): void;
|
|
285
|
+
/** Remove a node and its handler. */
|
|
286
|
+
removeNode(name: string): void;
|
|
287
|
+
/** Read-only snapshot of current LiveGraph state. */
|
|
288
|
+
getState(): LiveGraph;
|
|
289
|
+
/** Current schedule projection. */
|
|
290
|
+
getSchedule(): ScheduleResult;
|
|
291
|
+
/** Internal dispatch tracking (for observability/debugging). */
|
|
292
|
+
getDispatchState(): ReadonlyMap<string, DispatchEntry>;
|
|
293
|
+
/** Cancel pending timeouts and stop dispatching. */
|
|
294
|
+
dispose(): void;
|
|
295
|
+
}
|
|
296
|
+
declare function createReactiveGraph(config: GraphConfig, options: ReactiveGraphOptions, executionId?: string): ReactiveGraph;
|
|
297
|
+
|
|
298
|
+
export { type DispatchEntry, DownstreamResult, FileJournal, GraphConfig, GraphEvent, type Journal, LiveGraph, LiveGraphHealth, LiveGraphSnapshot, MemoryJournal, NodeInfo, type ReactiveGraph, type ReactiveGraphOptions, ScheduleResult, TaskConfig, type TaskHandler, type TaskHandlerContext, type TaskHandlerResult, UnreachableNodesResult, UnreachableTokensResult, UpstreamResult, addNode, addProvides, addRequires, applyEvent, applyEvents, createLiveGraph, createReactiveGraph, disableNode, drainTokens, enableNode, getDownstream, getNode, getUnreachableNodes, getUnreachableTokens, getUpstream, injectTokens, inspect, removeNode, removeProvides, removeRequires, resetNode, restore, schedule, snapshot };
|