yaml-flow 2.3.0 → 2.5.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.
@@ -1,191 +1,6 @@
1
+ import { G as GraphConfig, c as ExecutionState, S as SchedulerResult, e as GraphEvent, T as TaskConfig, l as TaskState, g as StuckDetection, C as CompletionStrategy, a as ConflictStrategy, b as ExecutionMode, d as ExecutionStatus, m as TaskStatus } from './types-DAI_a2as.cjs';
1
2
  import { e as StepFlowConfig } from './types-FZ_eyErS.cjs';
2
3
 
3
- /**
4
- * Event Graph — Core Types
5
- *
6
- * Type definitions for the stateless event-graph engine.
7
- * Pure: f(state, event) → newState
8
- */
9
- interface GraphConfig {
10
- id?: string;
11
- settings: GraphSettings;
12
- tasks: Record<string, TaskConfig>;
13
- }
14
- interface GraphSettings {
15
- /** Completion strategy */
16
- completion: CompletionStrategy;
17
- /** Conflict resolution strategy */
18
- conflict_strategy?: ConflictStrategy;
19
- /** Execution mode */
20
- execution_mode?: ExecutionMode;
21
- /** Goal outputs — used with 'goal-reached' completion */
22
- goal?: string[];
23
- /** Max total scheduler iterations (safety limit, default: 1000) */
24
- max_iterations?: number;
25
- /** Timeout in ms (declared for drivers, not enforced by pure engine) */
26
- timeout_ms?: number;
27
- }
28
- interface TaskConfig {
29
- /** What this task needs to become eligible */
30
- requires?: string[];
31
- /** What this task produces on successful completion */
32
- provides: string[];
33
- /** Conditional provides based on handler result */
34
- on?: Record<string, string[]>;
35
- /** Tokens to inject into available outputs on failure */
36
- on_failure?: string[];
37
- /** Task execution method (informational — driver concern) */
38
- method?: string;
39
- /** Arbitrary task configuration (driver concern) */
40
- config?: Record<string, unknown>;
41
- /** Task priority (higher = preferred in conflict resolution) */
42
- priority?: number;
43
- /** Estimated duration in ms (used by duration-first strategy) */
44
- estimatedDuration?: number;
45
- /** Estimated cost (used by cost-optimized strategy) */
46
- estimatedCost?: number;
47
- /** Resource requirements (used by resource-aware strategy) */
48
- estimatedResources?: Record<string, number>;
49
- /** Retry configuration */
50
- retry?: TaskRetryConfig;
51
- /** Repeatable task configuration */
52
- repeatable?: boolean | RepeatableConfig;
53
- /** Circuit breaker: max executions before breaking */
54
- circuit_breaker?: TaskCircuitBreakerConfig;
55
- /** Description */
56
- description?: string;
57
- }
58
- interface TaskRetryConfig {
59
- max_attempts: number;
60
- delay_ms?: number;
61
- backoff_multiplier?: number;
62
- }
63
- interface RepeatableConfig {
64
- /** Max times this task can repeat (undefined = unlimited) */
65
- max?: number;
66
- }
67
- interface TaskCircuitBreakerConfig {
68
- /** Max executions before injecting break tokens */
69
- max_executions: number;
70
- /** Tokens to inject when breaker trips */
71
- on_break: string[];
72
- }
73
- interface ExecutionState {
74
- /** Current status of the execution */
75
- status: ExecutionStatus;
76
- /** Task states keyed by task name */
77
- tasks: Record<string, TaskState>;
78
- /** Tokens currently available in the system */
79
- availableOutputs: string[];
80
- /** Stuck detection result */
81
- stuckDetection: StuckDetection;
82
- /** Last update timestamp */
83
- lastUpdated: string;
84
- /** Execution ID for this run */
85
- executionId: string | null;
86
- /** Execution configuration */
87
- executionConfig: ExecutionConfig;
88
- }
89
- interface ExecutionConfig {
90
- executionMode: ExecutionMode;
91
- conflictStrategy: ConflictStrategy;
92
- completionStrategy: CompletionStrategy;
93
- }
94
- interface TaskState {
95
- status: TaskStatus;
96
- executionCount: number;
97
- retryCount: number;
98
- lastEpoch: number;
99
- startedAt?: string;
100
- completedAt?: string;
101
- failedAt?: string;
102
- lastUpdated?: string;
103
- error?: string;
104
- messages?: TaskMessage[];
105
- progress?: number | null;
106
- }
107
- interface TaskMessage {
108
- message: string;
109
- timestamp: string;
110
- status: string;
111
- }
112
- interface StuckDetection {
113
- is_stuck: boolean;
114
- stuck_description: string | null;
115
- outputs_unresolvable: string[];
116
- tasks_blocked: string[];
117
- }
118
- type GraphEvent = TaskStartedEvent | TaskCompletedEvent | TaskFailedEvent | TaskProgressEvent | InjectTokensEvent | AgentActionEvent | TaskCreationEvent;
119
- interface TaskStartedEvent {
120
- type: 'task-started';
121
- taskName: string;
122
- timestamp: string;
123
- executionId?: string;
124
- }
125
- interface TaskCompletedEvent {
126
- type: 'task-completed';
127
- taskName: string;
128
- /** Handler result key — used for conditional routing via `on` */
129
- result?: string;
130
- /** Data payload from task execution */
131
- data?: Record<string, unknown>;
132
- timestamp: string;
133
- executionId?: string;
134
- }
135
- interface TaskFailedEvent {
136
- type: 'task-failed';
137
- taskName: string;
138
- error: string;
139
- timestamp: string;
140
- executionId?: string;
141
- }
142
- interface TaskProgressEvent {
143
- type: 'task-progress';
144
- taskName: string;
145
- message?: string;
146
- progress?: number;
147
- timestamp: string;
148
- executionId?: string;
149
- }
150
- interface InjectTokensEvent {
151
- type: 'inject-tokens';
152
- tokens: string[];
153
- timestamp: string;
154
- }
155
- interface AgentActionEvent {
156
- type: 'agent-action';
157
- action: 'start' | 'stop' | 'pause' | 'resume';
158
- timestamp: string;
159
- config?: Partial<ExecutionConfig>;
160
- }
161
- interface TaskCreationEvent {
162
- type: 'task-creation';
163
- taskName: string;
164
- taskConfig: TaskConfig;
165
- timestamp: string;
166
- }
167
- interface SchedulerResult {
168
- /** Tasks eligible for execution */
169
- eligibleTasks: string[];
170
- /** Whether the graph execution is complete */
171
- isComplete: boolean;
172
- /** Stuck detection result */
173
- stuckDetection: StuckDetection;
174
- /** Whether conflicts were detected */
175
- hasConflicts: boolean;
176
- /** Conflict groups: output → competing task names */
177
- conflicts: Record<string, string[]>;
178
- /** Strategy used for conflict resolution */
179
- strategy: ConflictStrategy;
180
- /** Processing log for diagnostics */
181
- processingLog: string[];
182
- }
183
- type TaskStatus = 'not-started' | 'running' | 'completed' | 'failed' | 'inactivated';
184
- type ExecutionStatus = 'created' | 'running' | 'paused' | 'stopped' | 'completed' | 'failed';
185
- type CompletionStrategy = 'all-tasks-done' | 'all-outputs-done' | 'only-resolved' | 'goal-reached' | 'manual';
186
- type ExecutionMode = 'dependency-mode' | 'eligibility-mode';
187
- type ConflictStrategy = 'alphabetical' | 'priority-first' | 'duration-first' | 'cost-optimized' | 'resource-aware' | 'random-select' | 'user-choice' | 'parallel-all' | 'skip-conflicts' | 'round-robin';
188
-
189
4
  /**
190
5
  * Event Graph — Scheduler
191
6
  *
@@ -504,4 +319,4 @@ declare const DEFAULTS: {
504
319
  readonly MAX_ITERATIONS: 1000;
505
320
  };
506
321
 
507
- export { isTaskCompleted as $, type AgentActionEvent as A, applyAll as B, COMPLETION_STRATEGIES as C, DEFAULTS as D, EXECUTION_MODES as E, computeAvailableOutputs as F, type GraphConfig as G, createDefaultTaskState as H, type InjectTokensEvent as I, createInitialExecutionState as J, detectStuckState as K, exportGraphConfig as L, type MermaidOptions as M, exportGraphConfigToFile as N, flowToMermaid as O, getAllTasks as P, getCandidateTasks as Q, getProvides as R, type SchedulerResult as S, type TaskConfig as T, getRequires as U, getTask as V, graphToMermaid as W, hasTask as X, isExecutionComplete as Y, isNonActiveTask as Z, isRepeatableTask as _, CONFLICT_STRATEGIES as a, isTaskRunning as a0, loadGraphConfig as a1, next as a2, planExecution as a3, validateGraph as a4, validateGraphConfig as a5, type RepeatableConfig as a6, type TaskCircuitBreakerConfig as a7, type TaskMessage as a8, type TaskProgressEvent as a9, type TaskRetryConfig as aa, addKeyToProvides as ab, addKeyToRequires as ac, getRepeatableMax as ad, groupTasksByProvides as ae, hasOutputConflict as af, removeKeyFromProvides as ag, removeKeyFromRequires as ah, type CompletionResult as b, type CompletionStrategy as c, type ConflictStrategy as d, EXECUTION_STATUS as e, type ExecutionConfig as f, type ExecutionMode as g, type ExecutionPlan as h, type ExecutionState as i, type ExecutionStatus as j, type ExportOptions as k, type GraphEvent as l, type GraphIssue as m, type GraphSettings as n, type GraphValidationResult as o, type IssueSeverity as p, type StuckDetection as q, TASK_STATUS as r, type TaskCompletedEvent as s, type TaskCreationEvent as t, type TaskFailedEvent as u, type TaskStartedEvent as v, type TaskState as w, type TaskStatus as x, addDynamicTask as y, apply as z };
322
+ export { isTaskCompleted as A, isTaskRunning as B, COMPLETION_STRATEGIES as C, DEFAULTS as D, EXECUTION_MODES as E, loadGraphConfig as F, type GraphIssue as G, next as H, type IssueSeverity as I, planExecution as J, validateGraph as K, validateGraphConfig as L, type MermaidOptions as M, addKeyToProvides as N, addKeyToRequires as O, getRepeatableMax as P, groupTasksByProvides as Q, hasOutputConflict as R, removeKeyFromProvides as S, TASK_STATUS as T, removeKeyFromRequires as U, CONFLICT_STRATEGIES as a, type CompletionResult as b, EXECUTION_STATUS as c, type ExecutionPlan as d, type ExportOptions as e, type GraphValidationResult as f, addDynamicTask as g, apply as h, applyAll as i, computeAvailableOutputs as j, createDefaultTaskState as k, createInitialExecutionState as l, detectStuckState as m, exportGraphConfig as n, exportGraphConfigToFile as o, flowToMermaid as p, getAllTasks as q, getCandidateTasks as r, getProvides as s, getRequires as t, getTask as u, graphToMermaid as v, hasTask as w, isExecutionComplete as x, isNonActiveTask as y, isRepeatableTask as z };