yaml-flow 3.0.0 → 3.1.1
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 +44 -23
- package/dist/{constants-B_ftYTTE.d.ts → constants-B2zqu10b.d.ts} +7 -57
- package/dist/{constants-CiyHX8L-.d.cts → constants-DJZU1pwJ.d.cts} +7 -57
- package/dist/continuous-event-graph/index.cjs +1161 -182
- package/dist/continuous-event-graph/index.cjs.map +1 -1
- package/dist/continuous-event-graph/index.d.cts +567 -48
- package/dist/continuous-event-graph/index.d.ts +567 -48
- package/dist/continuous-event-graph/index.js +1151 -183
- package/dist/continuous-event-graph/index.js.map +1 -1
- package/dist/event-graph/index.cjs +35 -11
- package/dist/event-graph/index.cjs.map +1 -1
- package/dist/event-graph/index.d.cts +14 -5
- package/dist/event-graph/index.d.ts +14 -5
- package/dist/event-graph/index.js +34 -11
- package/dist/event-graph/index.js.map +1 -1
- package/dist/index.cjs +945 -414
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +936 -415
- package/dist/index.js.map +1 -1
- package/dist/inference/index.cjs +31 -7
- 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 +31 -7
- package/dist/inference/index.js.map +1 -1
- package/dist/{types-CxJg9Jrt.d.cts → types-BwvgvlOO.d.cts} +2 -2
- package/dist/{types-BuEo3wVG.d.ts → types-ClRA8hzC.d.ts} +2 -2
- package/dist/{types-BpWrH1sf.d.cts → types-DEj7OakX.d.cts} +14 -4
- package/dist/{types-BpWrH1sf.d.ts → types-DEj7OakX.d.ts} +14 -4
- package/dist/validate-DEZ2Ymdb.d.ts +53 -0
- package/dist/validate-DqKTZg_o.d.cts +53 -0
- package/examples/batch/batch-step-machine.ts +121 -0
- package/examples/browser/index.html +367 -0
- package/examples/continuous-event-graph/live-cards-board.ts +215 -0
- package/examples/continuous-event-graph/live-portfolio-dashboard.ts +555 -0
- package/examples/continuous-event-graph/portfolio-tracker.ts +287 -0
- package/examples/continuous-event-graph/reactive-monitoring.ts +265 -0
- package/examples/continuous-event-graph/reactive-pipeline.ts +168 -0
- package/examples/continuous-event-graph/soc-incident-board.ts +287 -0
- package/examples/continuous-event-graph/stock-dashboard.ts +229 -0
- package/examples/event-graph/ci-cd-pipeline.ts +243 -0
- package/examples/event-graph/executor-diamond.ts +165 -0
- package/examples/event-graph/executor-pipeline.ts +161 -0
- package/examples/event-graph/research-pipeline.ts +137 -0
- package/examples/flows/ai-conversation.yaml +116 -0
- package/examples/flows/order-processing.yaml +143 -0
- package/examples/flows/simple-greeting.yaml +54 -0
- package/examples/graph-of-graphs/multi-stage-etl.ts +307 -0
- package/examples/graph-of-graphs/url-processing-pipeline.ts +254 -0
- package/examples/inference/azure-deployment.ts +149 -0
- package/examples/inference/copilot-cli.ts +138 -0
- package/examples/inference/data-pipeline.ts +145 -0
- package/examples/inference/pluggable-adapters.ts +254 -0
- package/examples/ingest.js +733 -0
- package/examples/node/ai-conversation.ts +195 -0
- package/examples/node/simple-greeting.ts +101 -0
- package/package.json +3 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions,
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions, M as MermaidOptions, T as TASK_STATUS, f as addDynamicTask, L as addKeyToProvides, N as addKeyToRequires, g as apply, h as applyAll, i as computeAvailableOutputs, j as createDefaultGraphEngineStore, k as createInitialExecutionState, l as detectStuckState, m as exportGraphConfig, n as exportGraphConfigToFile, o as flowToMermaid, p as getAllTasks, q as getCandidateTasks, r as getMaxExecutions, s as getProvides, t as getRefreshStrategy, u as getRequires, v as getTask, w as graphToMermaid, O as groupTasksByProvides, P as hasOutputConflict, x as hasTask, y as isExecutionComplete, z as isNonActiveTask, A as isRerunnable, B as isTaskCompleted, F as isTaskRunning, G as loadGraphConfig, H as next, I as planExecution, Q as removeKeyFromProvides, R as removeKeyFromRequires, J as validateGraphConfig, K as validateGraphSchema } from '../constants-DJZU1pwJ.cjs';
|
|
2
|
+
export { G as GraphIssue, a as GraphValidationResult, I as IssueSeverity, v as validateGraph } from '../validate-DqKTZg_o.cjs';
|
|
3
|
+
import { T as TaskConfig, c as ExecutionState, a as ConflictStrategy, G as GraphConfig } from '../types-DEj7OakX.cjs';
|
|
4
|
+
export { A as AgentActionEvent, C as CompletionStrategy, E as ExecutionConfig, b as ExecutionMode, d as ExecutionStatus, e as GraphEngineStore, f as GraphEvent, g as GraphSettings, I as InjectTokensEvent, R as RefreshStrategy, S as SchedulerResult, h as StuckDetection, n as TaskCircuitBreakerConfig, i as TaskCompletedEvent, j as TaskCreationEvent, k as TaskFailedEvent, o as TaskMessage, p as TaskProgressEvent, q as TaskRestartEvent, r as TaskRetryConfig, l as TaskStartedEvent, m as TaskStatus } from '../types-DEj7OakX.cjs';
|
|
4
5
|
import '../types-FZ_eyErS.cjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -40,7 +41,7 @@ declare function applyTaskStart(state: ExecutionState, taskName: string): Execut
|
|
|
40
41
|
* Handles: default provides, conditional provides (on), refresh strategy, data hash tracking.
|
|
41
42
|
* Pure function.
|
|
42
43
|
*/
|
|
43
|
-
declare function applyTaskCompletion(state: ExecutionState, graph: GraphConfig, taskName: string, result?: string, dataHash?: string): ExecutionState;
|
|
44
|
+
declare function applyTaskCompletion(state: ExecutionState, graph: GraphConfig, taskName: string, result?: string, dataHash?: string, data?: Record<string, unknown>): ExecutionState;
|
|
44
45
|
/**
|
|
45
46
|
* Apply task failure to execution state.
|
|
46
47
|
* Handles: retry logic, on_failure token injection, circuit breaker.
|
|
@@ -51,5 +52,13 @@ declare function applyTaskFailure(state: ExecutionState, graph: GraphConfig, tas
|
|
|
51
52
|
* Apply task progress update. Pure function.
|
|
52
53
|
*/
|
|
53
54
|
declare function applyTaskProgress(state: ExecutionState, taskName: string, message?: string, progress?: number): ExecutionState;
|
|
55
|
+
/**
|
|
56
|
+
* Apply task restart to execution state.
|
|
57
|
+
* Resets the task to not-started, preserving executionCount and lastEpoch
|
|
58
|
+
* (history). Clears data, error, progress. The task becomes eligible for
|
|
59
|
+
* scheduling again on the next drain cycle.
|
|
60
|
+
* Pure function.
|
|
61
|
+
*/
|
|
62
|
+
declare function applyTaskRestart(state: ExecutionState, taskName: string): ExecutionState;
|
|
54
63
|
|
|
55
|
-
export { ConflictStrategy, ExecutionState, GraphConfig, TaskConfig, applyTaskCompletion, applyTaskFailure, applyTaskProgress, applyTaskStart, getNonConflictingTasks, selectBestAlternative, selectRandomTasks };
|
|
64
|
+
export { ConflictStrategy, ExecutionState, GraphConfig, TaskConfig, applyTaskCompletion, applyTaskFailure, applyTaskProgress, applyTaskRestart, applyTaskStart, getNonConflictingTasks, selectBestAlternative, selectRandomTasks };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions,
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions, M as MermaidOptions, T as TASK_STATUS, f as addDynamicTask, L as addKeyToProvides, N as addKeyToRequires, g as apply, h as applyAll, i as computeAvailableOutputs, j as createDefaultGraphEngineStore, k as createInitialExecutionState, l as detectStuckState, m as exportGraphConfig, n as exportGraphConfigToFile, o as flowToMermaid, p as getAllTasks, q as getCandidateTasks, r as getMaxExecutions, s as getProvides, t as getRefreshStrategy, u as getRequires, v as getTask, w as graphToMermaid, O as groupTasksByProvides, P as hasOutputConflict, x as hasTask, y as isExecutionComplete, z as isNonActiveTask, A as isRerunnable, B as isTaskCompleted, F as isTaskRunning, G as loadGraphConfig, H as next, I as planExecution, Q as removeKeyFromProvides, R as removeKeyFromRequires, J as validateGraphConfig, K as validateGraphSchema } from '../constants-B2zqu10b.js';
|
|
2
|
+
export { G as GraphIssue, a as GraphValidationResult, I as IssueSeverity, v as validateGraph } from '../validate-DEZ2Ymdb.js';
|
|
3
|
+
import { T as TaskConfig, c as ExecutionState, a as ConflictStrategy, G as GraphConfig } from '../types-DEj7OakX.js';
|
|
4
|
+
export { A as AgentActionEvent, C as CompletionStrategy, E as ExecutionConfig, b as ExecutionMode, d as ExecutionStatus, e as GraphEngineStore, f as GraphEvent, g as GraphSettings, I as InjectTokensEvent, R as RefreshStrategy, S as SchedulerResult, h as StuckDetection, n as TaskCircuitBreakerConfig, i as TaskCompletedEvent, j as TaskCreationEvent, k as TaskFailedEvent, o as TaskMessage, p as TaskProgressEvent, q as TaskRestartEvent, r as TaskRetryConfig, l as TaskStartedEvent, m as TaskStatus } from '../types-DEj7OakX.js';
|
|
4
5
|
import '../types-FZ_eyErS.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -40,7 +41,7 @@ declare function applyTaskStart(state: ExecutionState, taskName: string): Execut
|
|
|
40
41
|
* Handles: default provides, conditional provides (on), refresh strategy, data hash tracking.
|
|
41
42
|
* Pure function.
|
|
42
43
|
*/
|
|
43
|
-
declare function applyTaskCompletion(state: ExecutionState, graph: GraphConfig, taskName: string, result?: string, dataHash?: string): ExecutionState;
|
|
44
|
+
declare function applyTaskCompletion(state: ExecutionState, graph: GraphConfig, taskName: string, result?: string, dataHash?: string, data?: Record<string, unknown>): ExecutionState;
|
|
44
45
|
/**
|
|
45
46
|
* Apply task failure to execution state.
|
|
46
47
|
* Handles: retry logic, on_failure token injection, circuit breaker.
|
|
@@ -51,5 +52,13 @@ declare function applyTaskFailure(state: ExecutionState, graph: GraphConfig, tas
|
|
|
51
52
|
* Apply task progress update. Pure function.
|
|
52
53
|
*/
|
|
53
54
|
declare function applyTaskProgress(state: ExecutionState, taskName: string, message?: string, progress?: number): ExecutionState;
|
|
55
|
+
/**
|
|
56
|
+
* Apply task restart to execution state.
|
|
57
|
+
* Resets the task to not-started, preserving executionCount and lastEpoch
|
|
58
|
+
* (history). Clears data, error, progress. The task becomes eligible for
|
|
59
|
+
* scheduling again on the next drain cycle.
|
|
60
|
+
* Pure function.
|
|
61
|
+
*/
|
|
62
|
+
declare function applyTaskRestart(state: ExecutionState, taskName: string): ExecutionState;
|
|
54
63
|
|
|
55
|
-
export { ConflictStrategy, ExecutionState, GraphConfig, TaskConfig, applyTaskCompletion, applyTaskFailure, applyTaskProgress, applyTaskStart, getNonConflictingTasks, selectBestAlternative, selectRandomTasks };
|
|
64
|
+
export { ConflictStrategy, ExecutionState, GraphConfig, TaskConfig, applyTaskCompletion, applyTaskFailure, applyTaskProgress, applyTaskRestart, applyTaskStart, getNonConflictingTasks, selectBestAlternative, selectRandomTasks };
|
|
@@ -6560,7 +6560,7 @@ function addDynamicTask(graph, taskName, taskConfig) {
|
|
|
6560
6560
|
}
|
|
6561
6561
|
};
|
|
6562
6562
|
}
|
|
6563
|
-
function
|
|
6563
|
+
function createDefaultGraphEngineStore() {
|
|
6564
6564
|
return {
|
|
6565
6565
|
status: "not-started",
|
|
6566
6566
|
executionCount: 0,
|
|
@@ -6573,7 +6573,7 @@ function createDefaultTaskState() {
|
|
|
6573
6573
|
function createInitialExecutionState(graph, executionId) {
|
|
6574
6574
|
const tasks = {};
|
|
6575
6575
|
for (const taskName of Object.keys(graph.tasks)) {
|
|
6576
|
-
tasks[taskName] =
|
|
6576
|
+
tasks[taskName] = createDefaultGraphEngineStore();
|
|
6577
6577
|
}
|
|
6578
6578
|
return {
|
|
6579
6579
|
status: "running",
|
|
@@ -7094,7 +7094,7 @@ function selectOptimalTasks(candidates, graph, state, conflictStrategy) {
|
|
|
7094
7094
|
|
|
7095
7095
|
// src/event-graph/task-transitions.ts
|
|
7096
7096
|
function applyTaskStart(state, taskName) {
|
|
7097
|
-
const existingTask = state.tasks[taskName] ??
|
|
7097
|
+
const existingTask = state.tasks[taskName] ?? createDefaultGraphEngineStore2();
|
|
7098
7098
|
const updatedTask = {
|
|
7099
7099
|
...existingTask,
|
|
7100
7100
|
status: "running",
|
|
@@ -7109,8 +7109,8 @@ function applyTaskStart(state, taskName) {
|
|
|
7109
7109
|
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
7110
7110
|
};
|
|
7111
7111
|
}
|
|
7112
|
-
function applyTaskCompletion(state, graph, taskName, result, dataHash) {
|
|
7113
|
-
const existingTask = state.tasks[taskName] ??
|
|
7112
|
+
function applyTaskCompletion(state, graph, taskName, result, dataHash, data) {
|
|
7113
|
+
const existingTask = state.tasks[taskName] ?? createDefaultGraphEngineStore2();
|
|
7114
7114
|
const taskConfig = graph.tasks[taskName];
|
|
7115
7115
|
if (!taskConfig) {
|
|
7116
7116
|
throw new Error(`Task "${taskName}" not found in graph`);
|
|
@@ -7142,6 +7142,7 @@ function applyTaskCompletion(state, graph, taskName, result, dataHash) {
|
|
|
7142
7142
|
executionCount: existingTask.executionCount + 1,
|
|
7143
7143
|
lastEpoch: existingTask.executionCount + 1,
|
|
7144
7144
|
lastDataHash: dataHash,
|
|
7145
|
+
data,
|
|
7145
7146
|
lastConsumedHashes,
|
|
7146
7147
|
error: void 0
|
|
7147
7148
|
};
|
|
@@ -7154,7 +7155,7 @@ function applyTaskCompletion(state, graph, taskName, result, dataHash) {
|
|
|
7154
7155
|
};
|
|
7155
7156
|
}
|
|
7156
7157
|
function applyTaskFailure(state, graph, taskName, error) {
|
|
7157
|
-
const existingTask = state.tasks[taskName] ??
|
|
7158
|
+
const existingTask = state.tasks[taskName] ?? createDefaultGraphEngineStore2();
|
|
7158
7159
|
const taskConfig = graph.tasks[taskName];
|
|
7159
7160
|
if (taskConfig?.retry) {
|
|
7160
7161
|
const retryCount = existingTask.retryCount + 1;
|
|
@@ -7197,7 +7198,7 @@ function applyTaskFailure(state, graph, taskName, error) {
|
|
|
7197
7198
|
};
|
|
7198
7199
|
}
|
|
7199
7200
|
function applyTaskProgress(state, taskName, message, progress) {
|
|
7200
|
-
const existingTask = state.tasks[taskName] ??
|
|
7201
|
+
const existingTask = state.tasks[taskName] ?? createDefaultGraphEngineStore2();
|
|
7201
7202
|
const updatedTask = {
|
|
7202
7203
|
...existingTask,
|
|
7203
7204
|
progress: typeof progress === "number" ? progress : existingTask.progress,
|
|
@@ -7213,7 +7214,27 @@ function applyTaskProgress(state, taskName, message, progress) {
|
|
|
7213
7214
|
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
7214
7215
|
};
|
|
7215
7216
|
}
|
|
7216
|
-
function
|
|
7217
|
+
function applyTaskRestart(state, taskName) {
|
|
7218
|
+
const existingTask = state.tasks[taskName];
|
|
7219
|
+
if (!existingTask) return state;
|
|
7220
|
+
const updatedTask = {
|
|
7221
|
+
...existingTask,
|
|
7222
|
+
status: "not-started",
|
|
7223
|
+
startedAt: void 0,
|
|
7224
|
+
completedAt: void 0,
|
|
7225
|
+
failedAt: void 0,
|
|
7226
|
+
error: void 0,
|
|
7227
|
+
data: void 0,
|
|
7228
|
+
progress: null,
|
|
7229
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
7230
|
+
};
|
|
7231
|
+
return {
|
|
7232
|
+
...state,
|
|
7233
|
+
tasks: { ...state.tasks, [taskName]: updatedTask },
|
|
7234
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
7235
|
+
};
|
|
7236
|
+
}
|
|
7237
|
+
function createDefaultGraphEngineStore2() {
|
|
7217
7238
|
return {
|
|
7218
7239
|
status: "not-started",
|
|
7219
7240
|
executionCount: 0,
|
|
@@ -7233,11 +7254,13 @@ function apply(state, event, graph) {
|
|
|
7233
7254
|
case "task-started":
|
|
7234
7255
|
return applyTaskStart(state, event.taskName);
|
|
7235
7256
|
case "task-completed":
|
|
7236
|
-
return applyTaskCompletion(state, graph, event.taskName, event.result, event.dataHash);
|
|
7257
|
+
return applyTaskCompletion(state, graph, event.taskName, event.result, event.dataHash, event.data);
|
|
7237
7258
|
case "task-failed":
|
|
7238
7259
|
return applyTaskFailure(state, graph, event.taskName, event.error);
|
|
7239
7260
|
case "task-progress":
|
|
7240
7261
|
return applyTaskProgress(state, event.taskName, event.message, event.progress);
|
|
7262
|
+
case "task-restart":
|
|
7263
|
+
return applyTaskRestart(state, event.taskName);
|
|
7241
7264
|
case "inject-tokens":
|
|
7242
7265
|
return applyInjectTokens(state, event.tokens);
|
|
7243
7266
|
case "agent-action":
|
|
@@ -7308,7 +7331,7 @@ function applyTaskCreation(state, taskName, taskConfig) {
|
|
|
7308
7331
|
...state,
|
|
7309
7332
|
tasks: {
|
|
7310
7333
|
...state.tasks,
|
|
7311
|
-
[taskName]:
|
|
7334
|
+
[taskName]: createDefaultGraphEngineStore()
|
|
7312
7335
|
},
|
|
7313
7336
|
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
7314
7337
|
};
|
|
@@ -8193,6 +8216,6 @@ function validateGraphSchema(config) {
|
|
|
8193
8216
|
return { ok: false, errors };
|
|
8194
8217
|
}
|
|
8195
8218
|
|
|
8196
|
-
export { COMPLETION_STRATEGIES, CONFLICT_STRATEGIES, DEFAULTS, EXECUTION_MODES, EXECUTION_STATUS, TASK_STATUS, addDynamicTask, addKeyToProvides, addKeyToRequires, apply, applyAll, applyTaskCompletion, applyTaskFailure, applyTaskProgress, applyTaskStart, computeAvailableOutputs,
|
|
8219
|
+
export { COMPLETION_STRATEGIES, CONFLICT_STRATEGIES, DEFAULTS, EXECUTION_MODES, EXECUTION_STATUS, TASK_STATUS, addDynamicTask, addKeyToProvides, addKeyToRequires, apply, applyAll, applyTaskCompletion, applyTaskFailure, applyTaskProgress, applyTaskRestart, applyTaskStart, computeAvailableOutputs, createDefaultGraphEngineStore, createInitialExecutionState, detectStuckState, exportGraphConfig, exportGraphConfigToFile, flowToMermaid, getAllTasks, getCandidateTasks, getMaxExecutions, getNonConflictingTasks, getProvides, getRefreshStrategy, getRequires, getTask, graphToMermaid, groupTasksByProvides, hasOutputConflict, hasTask, isExecutionComplete, isNonActiveTask, isRerunnable, isTaskCompleted, isTaskRunning, loadGraphConfig, next, planExecution, removeKeyFromProvides, removeKeyFromRequires, selectBestAlternative, selectRandomTasks, validateGraph, validateGraphConfig, validateGraphSchema };
|
|
8197
8220
|
//# sourceMappingURL=index.js.map
|
|
8198
8221
|
//# sourceMappingURL=index.js.map
|