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.
Files changed (49) hide show
  1. package/README.md +168 -3
  2. package/browser/ingest-board.js +296 -0
  3. package/browser/live-cards.js +303 -0
  4. package/browser/live-cards.schema.json +22 -2
  5. package/dist/card-compute/index.cjs +6751 -0
  6. package/dist/card-compute/index.cjs.map +1 -1
  7. package/dist/card-compute/index.d.cts +24 -1
  8. package/dist/card-compute/index.d.ts +24 -1
  9. package/dist/card-compute/index.js +6747 -1
  10. package/dist/card-compute/index.js.map +1 -1
  11. package/dist/{constants-BEbO2_OK.d.ts → constants-B_ftYTTE.d.ts} +36 -6
  12. package/dist/{constants-BNjeIlZ8.d.cts → constants-CiyHX8L-.d.cts} +36 -6
  13. package/dist/continuous-event-graph/index.cjs +399 -42
  14. package/dist/continuous-event-graph/index.cjs.map +1 -1
  15. package/dist/continuous-event-graph/index.d.cts +124 -5
  16. package/dist/continuous-event-graph/index.d.ts +124 -5
  17. package/dist/continuous-event-graph/index.js +396 -43
  18. package/dist/continuous-event-graph/index.js.map +1 -1
  19. package/dist/event-graph/index.cjs +6784 -44
  20. package/dist/event-graph/index.cjs.map +1 -1
  21. package/dist/event-graph/index.d.cts +5 -5
  22. package/dist/event-graph/index.d.ts +5 -5
  23. package/dist/event-graph/index.js +6777 -43
  24. package/dist/event-graph/index.js.map +1 -1
  25. package/dist/index.cjs +7678 -73
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +6 -6
  28. package/dist/index.d.ts +6 -6
  29. package/dist/index.js +7665 -73
  30. package/dist/index.js.map +1 -1
  31. package/dist/inference/index.cjs +17 -8
  32. package/dist/inference/index.cjs.map +1 -1
  33. package/dist/inference/index.d.cts +2 -2
  34. package/dist/inference/index.d.ts +2 -2
  35. package/dist/inference/index.js +17 -8
  36. package/dist/inference/index.js.map +1 -1
  37. package/dist/step-machine/index.cjs +6600 -0
  38. package/dist/step-machine/index.cjs.map +1 -1
  39. package/dist/step-machine/index.d.cts +26 -1
  40. package/dist/step-machine/index.d.ts +26 -1
  41. package/dist/step-machine/index.js +6596 -1
  42. package/dist/step-machine/index.js.map +1 -1
  43. package/dist/{types-DAI_a2as.d.ts → types-BpWrH1sf.d.cts} +16 -7
  44. package/dist/{types-DAI_a2as.d.cts → types-BpWrH1sf.d.ts} +16 -7
  45. package/dist/{types-mS_pPftm.d.ts → types-BuEo3wVG.d.ts} +1 -1
  46. package/dist/{types-C2lOwquM.d.cts → types-CxJg9Jrt.d.cts} +1 -1
  47. package/package.json +3 -2
  48. package/schema/event-graph.schema.json +254 -0
  49. package/schema/live-cards.schema.json +22 -2
@@ -16,6 +16,8 @@ interface GraphSettings {
16
16
  conflict_strategy?: ConflictStrategy;
17
17
  /** Execution mode */
18
18
  execution_mode?: ExecutionMode;
19
+ /** Default refresh strategy for all tasks (default: 'data-changed') */
20
+ refreshStrategy?: RefreshStrategy;
19
21
  /** Goal outputs — used with 'goal-reached' completion */
20
22
  goal?: string[];
21
23
  /** Max total scheduler iterations (safety limit, default: 1000) */
@@ -46,8 +48,12 @@ interface TaskConfig {
46
48
  estimatedResources?: Record<string, number>;
47
49
  /** Retry configuration */
48
50
  retry?: TaskRetryConfig;
49
- /** Repeatable task configuration */
50
- repeatable?: boolean | RepeatableConfig;
51
+ /** Refresh strategy — controls when a completed task re-runs (default: 'data-changed') */
52
+ refreshStrategy?: RefreshStrategy;
53
+ /** Refresh interval in seconds — only used with 'time-based' strategy */
54
+ refreshInterval?: number;
55
+ /** Max executions cap (safety limit, optional) */
56
+ maxExecutions?: number;
51
57
  /** Circuit breaker: max executions before breaking */
52
58
  circuit_breaker?: TaskCircuitBreakerConfig;
53
59
  /** Description */
@@ -69,10 +75,6 @@ interface TaskRetryConfig {
69
75
  delay_ms?: number;
70
76
  backoff_multiplier?: number;
71
77
  }
72
- interface RepeatableConfig {
73
- /** Max times this task can repeat (undefined = unlimited) */
74
- max?: number;
75
- }
76
78
  interface TaskCircuitBreakerConfig {
77
79
  /** Max executions before injecting break tokens */
78
80
  max_executions: number;
@@ -105,6 +107,10 @@ interface TaskState {
105
107
  executionCount: number;
106
108
  retryCount: number;
107
109
  lastEpoch: number;
110
+ /** Hash of this task's last output (for data-changed strategy) */
111
+ lastDataHash?: string;
112
+ /** Per-require token: the data hash consumed on last run */
113
+ lastConsumedHashes?: Record<string, string>;
108
114
  startedAt?: string;
109
115
  completedAt?: string;
110
116
  failedAt?: string;
@@ -138,6 +144,8 @@ interface TaskCompletedEvent {
138
144
  result?: string;
139
145
  /** Data payload from task execution */
140
146
  data?: Record<string, unknown>;
147
+ /** Content hash of the output — used by 'data-changed' refresh strategy */
148
+ dataHash?: string;
141
149
  timestamp: string;
142
150
  executionId?: string;
143
151
  }
@@ -194,5 +202,6 @@ type ExecutionStatus = 'created' | 'running' | 'paused' | 'stopped' | 'completed
194
202
  type CompletionStrategy = 'all-tasks-done' | 'all-outputs-done' | 'only-resolved' | 'goal-reached' | 'manual';
195
203
  type ExecutionMode = 'dependency-mode' | 'eligibility-mode';
196
204
  type ConflictStrategy = 'alphabetical' | 'priority-first' | 'duration-first' | 'cost-optimized' | 'resource-aware' | 'random-select' | 'user-choice' | 'parallel-all' | 'skip-conflicts' | 'round-robin';
205
+ type RefreshStrategy = 'data-changed' | 'epoch-changed' | 'time-based' | 'manual' | 'once';
197
206
 
198
- export type { AgentActionEvent as A, CompletionStrategy as C, ExecutionConfig as E, GraphConfig as G, InjectTokensEvent as I, RepeatableConfig as R, SchedulerResult as S, TaskConfig as T, ConflictStrategy as a, ExecutionMode as b, ExecutionState as c, ExecutionStatus as d, GraphEvent as e, GraphSettings as f, StuckDetection as g, TaskCompletedEvent as h, TaskCreationEvent as i, TaskFailedEvent as j, TaskStartedEvent as k, TaskState as l, TaskStatus as m, TaskCircuitBreakerConfig as n, TaskMessage as o, TaskProgressEvent as p, TaskRetryConfig as q };
207
+ 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, GraphEvent as e, GraphSettings as f, StuckDetection as g, TaskCompletedEvent as h, TaskCreationEvent as i, TaskFailedEvent as j, TaskStartedEvent as k, TaskState as l, TaskStatus as m, TaskCircuitBreakerConfig as n, TaskMessage as o, TaskProgressEvent as p, TaskRetryConfig as q };
@@ -16,6 +16,8 @@ interface GraphSettings {
16
16
  conflict_strategy?: ConflictStrategy;
17
17
  /** Execution mode */
18
18
  execution_mode?: ExecutionMode;
19
+ /** Default refresh strategy for all tasks (default: 'data-changed') */
20
+ refreshStrategy?: RefreshStrategy;
19
21
  /** Goal outputs — used with 'goal-reached' completion */
20
22
  goal?: string[];
21
23
  /** Max total scheduler iterations (safety limit, default: 1000) */
@@ -46,8 +48,12 @@ interface TaskConfig {
46
48
  estimatedResources?: Record<string, number>;
47
49
  /** Retry configuration */
48
50
  retry?: TaskRetryConfig;
49
- /** Repeatable task configuration */
50
- repeatable?: boolean | RepeatableConfig;
51
+ /** Refresh strategy — controls when a completed task re-runs (default: 'data-changed') */
52
+ refreshStrategy?: RefreshStrategy;
53
+ /** Refresh interval in seconds — only used with 'time-based' strategy */
54
+ refreshInterval?: number;
55
+ /** Max executions cap (safety limit, optional) */
56
+ maxExecutions?: number;
51
57
  /** Circuit breaker: max executions before breaking */
52
58
  circuit_breaker?: TaskCircuitBreakerConfig;
53
59
  /** Description */
@@ -69,10 +75,6 @@ interface TaskRetryConfig {
69
75
  delay_ms?: number;
70
76
  backoff_multiplier?: number;
71
77
  }
72
- interface RepeatableConfig {
73
- /** Max times this task can repeat (undefined = unlimited) */
74
- max?: number;
75
- }
76
78
  interface TaskCircuitBreakerConfig {
77
79
  /** Max executions before injecting break tokens */
78
80
  max_executions: number;
@@ -105,6 +107,10 @@ interface TaskState {
105
107
  executionCount: number;
106
108
  retryCount: number;
107
109
  lastEpoch: number;
110
+ /** Hash of this task's last output (for data-changed strategy) */
111
+ lastDataHash?: string;
112
+ /** Per-require token: the data hash consumed on last run */
113
+ lastConsumedHashes?: Record<string, string>;
108
114
  startedAt?: string;
109
115
  completedAt?: string;
110
116
  failedAt?: string;
@@ -138,6 +144,8 @@ interface TaskCompletedEvent {
138
144
  result?: string;
139
145
  /** Data payload from task execution */
140
146
  data?: Record<string, unknown>;
147
+ /** Content hash of the output — used by 'data-changed' refresh strategy */
148
+ dataHash?: string;
141
149
  timestamp: string;
142
150
  executionId?: string;
143
151
  }
@@ -194,5 +202,6 @@ type ExecutionStatus = 'created' | 'running' | 'paused' | 'stopped' | 'completed
194
202
  type CompletionStrategy = 'all-tasks-done' | 'all-outputs-done' | 'only-resolved' | 'goal-reached' | 'manual';
195
203
  type ExecutionMode = 'dependency-mode' | 'eligibility-mode';
196
204
  type ConflictStrategy = 'alphabetical' | 'priority-first' | 'duration-first' | 'cost-optimized' | 'resource-aware' | 'random-select' | 'user-choice' | 'parallel-all' | 'skip-conflicts' | 'round-robin';
205
+ type RefreshStrategy = 'data-changed' | 'epoch-changed' | 'time-based' | 'manual' | 'once';
197
206
 
198
- export type { AgentActionEvent as A, CompletionStrategy as C, ExecutionConfig as E, GraphConfig as G, InjectTokensEvent as I, RepeatableConfig as R, SchedulerResult as S, TaskConfig as T, ConflictStrategy as a, ExecutionMode as b, ExecutionState as c, ExecutionStatus as d, GraphEvent as e, GraphSettings as f, StuckDetection as g, TaskCompletedEvent as h, TaskCreationEvent as i, TaskFailedEvent as j, TaskStartedEvent as k, TaskState as l, TaskStatus as m, TaskCircuitBreakerConfig as n, TaskMessage as o, TaskProgressEvent as p, TaskRetryConfig as q };
207
+ 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, GraphEvent as e, GraphSettings as f, StuckDetection as g, TaskCompletedEvent as h, TaskCreationEvent as i, TaskFailedEvent as j, TaskStartedEvent as k, TaskState as l, TaskStatus as m, TaskCircuitBreakerConfig as n, TaskMessage as o, TaskProgressEvent as p, TaskRetryConfig as q };
@@ -1,4 +1,4 @@
1
- import { G as GraphConfig, c as ExecutionState, T as TaskConfig, l as TaskState } from './types-DAI_a2as.js';
1
+ import { G as GraphConfig, c as ExecutionState, T as TaskConfig, l as TaskState } from './types-BpWrH1sf.js';
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, l as TaskState } from './types-DAI_a2as.cjs';
1
+ import { G as GraphConfig, c as ExecutionState, T as TaskConfig, l as TaskState } from './types-BpWrH1sf.cjs';
2
2
 
3
3
  /**
4
4
  * Continuous Event Graph — Types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml-flow",
3
- "version": "2.7.0",
3
+ "version": "3.0.0",
4
4
  "description": "Unified workflow engine: step-machine (sequential) + event-graph (stateless DAG) with pluggable storage",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -94,10 +94,11 @@
94
94
  "vitest": "^1.0.0"
95
95
  },
96
96
  "dependencies": {
97
+ "ajv-formats": "^3.0.1",
97
98
  "yaml": "^2.3.4"
98
99
  },
99
100
  "optionalDependencies": {
100
- "ajv": "^8.12.0"
101
+ "ajv": "^8.18.0"
101
102
  },
102
103
  "keywords": [
103
104
  "workflow",
@@ -0,0 +1,254 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://github.com/yaml-flow/schema/event-graph.json",
4
+ "title": "Event Graph Configuration",
5
+ "description": "Schema for stateless event-graph (DAG) workflow definitions in yaml-flow",
6
+ "type": "object",
7
+ "required": ["settings", "tasks"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "id": {
11
+ "type": "string",
12
+ "description": "Optional graph identifier"
13
+ },
14
+ "settings": {
15
+ "$ref": "#/definitions/settings"
16
+ },
17
+ "tasks": {
18
+ "type": "object",
19
+ "description": "Task definitions keyed by name",
20
+ "minProperties": 1,
21
+ "additionalProperties": {
22
+ "$ref": "#/definitions/task"
23
+ }
24
+ }
25
+ },
26
+
27
+ "definitions": {
28
+
29
+ "settings": {
30
+ "type": "object",
31
+ "required": ["completion"],
32
+ "properties": {
33
+ "completion": {
34
+ "type": "string",
35
+ "enum": [
36
+ "all-tasks-done",
37
+ "all-outputs-done",
38
+ "only-resolved",
39
+ "goal-reached",
40
+ "manual"
41
+ ],
42
+ "description": "Completion strategy"
43
+ },
44
+ "conflict_strategy": {
45
+ "type": "string",
46
+ "enum": [
47
+ "alphabetical",
48
+ "priority-first",
49
+ "duration-first",
50
+ "cost-optimized",
51
+ "resource-aware",
52
+ "random-select",
53
+ "user-choice",
54
+ "parallel-all",
55
+ "skip-conflicts",
56
+ "round-robin"
57
+ ],
58
+ "description": "Conflict resolution strategy"
59
+ },
60
+ "execution_mode": {
61
+ "type": "string",
62
+ "enum": ["dependency-mode", "eligibility-mode"],
63
+ "description": "Execution mode"
64
+ },
65
+ "goal": {
66
+ "type": "array",
67
+ "items": { "type": "string" },
68
+ "minItems": 1,
69
+ "description": "Goal outputs — required when completion is 'goal-reached'"
70
+ },
71
+ "max_iterations": {
72
+ "type": "integer",
73
+ "minimum": 1,
74
+ "description": "Max scheduler iterations (safety limit, default: 1000)"
75
+ },
76
+ "timeout_ms": {
77
+ "type": "integer",
78
+ "minimum": 0,
79
+ "description": "Timeout in ms (declared for drivers, not enforced by pure engine)"
80
+ },
81
+ "refreshStrategy": {
82
+ "$ref": "#/definitions/refresh_strategy",
83
+ "description": "Default refresh strategy for all tasks (default: 'data-changed')"
84
+ }
85
+ },
86
+ "additionalProperties": false,
87
+ "if": {
88
+ "properties": { "completion": { "const": "goal-reached" } }
89
+ },
90
+ "then": {
91
+ "required": ["completion", "goal"]
92
+ }
93
+ },
94
+
95
+ "task": {
96
+ "type": "object",
97
+ "required": ["provides"],
98
+ "properties": {
99
+ "requires": {
100
+ "type": "array",
101
+ "items": { "type": "string" },
102
+ "description": "Tokens this task needs to become eligible"
103
+ },
104
+ "provides": {
105
+ "type": "array",
106
+ "items": { "type": "string" },
107
+ "description": "Tokens this task produces on successful completion"
108
+ },
109
+ "on": {
110
+ "type": "object",
111
+ "description": "Conditional provides based on handler result key",
112
+ "additionalProperties": {
113
+ "type": "array",
114
+ "items": { "type": "string" }
115
+ }
116
+ },
117
+ "on_failure": {
118
+ "type": "array",
119
+ "items": { "type": "string" },
120
+ "description": "Tokens to inject when this task fails"
121
+ },
122
+ "method": {
123
+ "type": "string",
124
+ "description": "Task execution method (informational — driver concern)"
125
+ },
126
+ "config": {
127
+ "type": "object",
128
+ "description": "Arbitrary task configuration (driver concern)"
129
+ },
130
+ "priority": {
131
+ "type": "number",
132
+ "description": "Higher = preferred in conflict resolution"
133
+ },
134
+ "estimatedDuration": {
135
+ "type": "number",
136
+ "minimum": 0,
137
+ "description": "Estimated duration in ms (used by duration-first strategy)"
138
+ },
139
+ "estimatedCost": {
140
+ "type": "number",
141
+ "minimum": 0,
142
+ "description": "Estimated cost (used by cost-optimized strategy)"
143
+ },
144
+ "estimatedResources": {
145
+ "type": "object",
146
+ "additionalProperties": { "type": "number" },
147
+ "description": "Resource requirements (used by resource-aware strategy)"
148
+ },
149
+ "retry": {
150
+ "$ref": "#/definitions/task_retry"
151
+ },
152
+ "refreshStrategy": {
153
+ "$ref": "#/definitions/refresh_strategy",
154
+ "description": "Task-level refresh strategy (overrides settings default)"
155
+ },
156
+ "refreshInterval": {
157
+ "type": "number",
158
+ "minimum": 0,
159
+ "description": "Interval in seconds for time-based refresh strategy"
160
+ },
161
+ "maxExecutions": {
162
+ "type": "integer",
163
+ "minimum": 1,
164
+ "description": "Maximum number of times this task can execute"
165
+ },
166
+ "circuit_breaker": {
167
+ "$ref": "#/definitions/task_circuit_breaker"
168
+ },
169
+ "description": {
170
+ "type": "string",
171
+ "description": "Human-readable description"
172
+ },
173
+ "inference": {
174
+ "$ref": "#/definitions/inference_hints"
175
+ }
176
+ },
177
+ "additionalProperties": false
178
+ },
179
+
180
+ "task_retry": {
181
+ "type": "object",
182
+ "required": ["max_attempts"],
183
+ "properties": {
184
+ "max_attempts": {
185
+ "type": "integer",
186
+ "minimum": 1,
187
+ "description": "Maximum retry attempts"
188
+ },
189
+ "delay_ms": {
190
+ "type": "integer",
191
+ "minimum": 0,
192
+ "description": "Delay between retries in ms"
193
+ },
194
+ "backoff_multiplier": {
195
+ "type": "number",
196
+ "minimum": 1,
197
+ "description": "Backoff multiplier (e.g., 2 for exponential)"
198
+ }
199
+ },
200
+ "additionalProperties": false
201
+ },
202
+
203
+ "refresh_strategy": {
204
+ "type": "string",
205
+ "enum": ["data-changed", "epoch-changed", "time-based", "manual", "once"],
206
+ "description": "Strategy for determining when a completed task should re-run"
207
+ },
208
+
209
+ "task_circuit_breaker": {
210
+ "type": "object",
211
+ "required": ["max_executions", "on_break"],
212
+ "properties": {
213
+ "max_executions": {
214
+ "type": "integer",
215
+ "minimum": 1,
216
+ "description": "Max executions before breaker trips"
217
+ },
218
+ "on_break": {
219
+ "type": "array",
220
+ "items": { "type": "string" },
221
+ "minItems": 1,
222
+ "description": "Tokens to inject when breaker trips"
223
+ }
224
+ },
225
+ "additionalProperties": false
226
+ },
227
+
228
+ "inference_hints": {
229
+ "type": "object",
230
+ "description": "LLM inference hints — opt-in metadata for AI-assisted completion detection",
231
+ "properties": {
232
+ "criteria": {
233
+ "type": "string",
234
+ "description": "Human-readable completion criteria"
235
+ },
236
+ "keywords": {
237
+ "type": "array",
238
+ "items": { "type": "string" },
239
+ "description": "Keywords to help the LLM understand the domain"
240
+ },
241
+ "suggestedChecks": {
242
+ "type": "array",
243
+ "items": { "type": "string" },
244
+ "description": "Suggested checks for verification"
245
+ },
246
+ "autoDetectable": {
247
+ "type": "boolean",
248
+ "description": "Whether the LLM should attempt to auto-detect completion (default: false)"
249
+ }
250
+ },
251
+ "additionalProperties": false
252
+ }
253
+ }
254
+ }
@@ -116,7 +116,7 @@
116
116
  "kind": {
117
117
  "enum": ["metric", "table", "chart", "form", "filter", "list",
118
118
  "notes", "todo", "alert", "narrative", "badge", "text",
119
- "markdown", "custom"]
119
+ "markdown", "custom", "file-upload", "chat", "actions"]
120
120
  },
121
121
  "label": { "type": "string", "description": "Heading above this element" },
122
122
  "className": { "type": "string", "description": "Bootstrap grid class, e.g. 'col-12 col-md-6'" },
@@ -141,7 +141,27 @@
141
141
  }
142
142
  },
143
143
  "colorMap": { "type": "object", "description": "badge: value → Bootstrap color" },
144
- "style": { "enum": ["heading", "muted", "default"], "description": "text: display style" }
144
+ "style": { "enum": ["heading", "muted", "default"], "description": "text: display style" },
145
+ "upload": { "type": "boolean", "default": true, "description": "file-upload: show drop zone (false = read-only file list)" },
146
+ "accept": { "type": "array", "items": { "type": "string" }, "description": "file-upload: allowed extensions" },
147
+ "multiple": { "type": "boolean", "default": true, "description": "file-upload: allow multiple files" },
148
+ "fileAttach": { "type": "boolean", "default": false, "description": "chat: enable inline file attachments" },
149
+ "fileAccept": { "type": "array", "items": { "type": "string" }, "description": "chat: allowed attachment extensions" },
150
+ "buttons": {
151
+ "type": "array",
152
+ "description": "actions: button definitions",
153
+ "items": {
154
+ "type": "object",
155
+ "required": ["id", "label"],
156
+ "properties": {
157
+ "id": { "type": "string" },
158
+ "label": { "type": "string" },
159
+ "style": { "type": "string", "description": "Bootstrap button variant, e.g. 'success', 'outline-danger'" },
160
+ "size": { "type": "string", "default": "sm" },
161
+ "disabled": { "oneOf": [{ "type": "boolean" }, { "type": "string", "description": "state path — truthy = disabled" }] }
162
+ }
163
+ }
164
+ }
145
165
  }
146
166
  }
147
167
  }