@elaraai/e3-types 0.0.2-beta.2 → 0.0.2-beta.21

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 CHANGED
@@ -11,11 +11,14 @@ npm install @elaraai/e3-types
11
11
  ## Types
12
12
 
13
13
  - **Repository** - Repository configuration and paths
14
- - **Commit** - Task commit types (new, done, error)
15
- - **Task** - Task definition and state
16
14
  - **Package** - Package manifest and metadata
17
15
  - **Dataset** - Dataset schemas and paths
18
- - **Dataflow** - Dataflow definitions
16
+ - **Task** - Task definition and configuration
17
+ - **Dataflow** - Dataflow graph and execution state
18
+ - `TaskStateType` - Individual task execution state
19
+ - `DataflowGraphType` - Task dependency graph
20
+ - `ExecutionEventType` - Execution progress events
21
+ - `DataflowExecutionStateType` - Full execution state
19
22
  - **Runner** - Runner configuration
20
23
 
21
24
 
@@ -41,7 +44,7 @@ Dual AGPL-3.0 / Commercial. See [LICENSE.md](./LICENSE.md).
41
44
  - [@elaraai/e3](https://www.npmjs.com/package/@elaraai/e3): SDK for authoring e3 packages with typed tasks and pipelines
42
45
  - [@elaraai/e3-core](https://www.npmjs.com/package/@elaraai/e3-core): Git-like object store, task queue, result caching
43
46
  - [@elaraai/e3-types](https://www.npmjs.com/package/@elaraai/e3-types): Shared type definitions for e3 packages
44
- - [@elaraai/e3-cli](https://www.npmjs.com/package/@elaraai/e3-cli): `e3 init`, `e3 run`, `e3 logs` commands for managing and monitoring tasks
47
+ - [@elaraai/e3-cli](https://www.npmjs.com/package/@elaraai/e3-cli): `e3 repo`, `e3 workspace`, `e3 start`, `e3 logs` commands for managing repositories, workspaces, and tasks
45
48
  - [@elaraai/e3-api-client](https://www.npmjs.com/package/@elaraai/e3-api-client): HTTP client for remote e3 servers
46
49
  - [@elaraai/e3-api-server](https://www.npmjs.com/package/@elaraai/e3-api-server): REST API server for e3 repositories
47
50
 
@@ -0,0 +1,376 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Dataflow execution state type definitions.
7
+ *
8
+ * These types define the persistent state for dataflow execution,
9
+ * stored in workspaces/<ws>/execution.beast2
10
+ *
11
+ * Key design decisions:
12
+ * - Dates are Date objects (via DateTimeType), not strings
13
+ * - Events stored inline as array (single file, not separate JSONL)
14
+ * - Tasks stored as Dict (not Map) for beast2 compatibility
15
+ */
16
+ import { StructType, VariantType, ArrayType, DictType, StringType, IntegerType, BooleanType, DateTimeType, OptionType, ValueTypeOf } from '@elaraai/east';
17
+ /**
18
+ * Status of a dataflow execution.
19
+ */
20
+ export type DataflowExecutionStatus = 'running' | 'completed' | 'failed' | 'cancelled';
21
+ /**
22
+ * Status of an individual task within an execution.
23
+ */
24
+ export type TaskStatus = 'pending' | 'ready' | 'in_progress' | 'completed' | 'failed' | 'skipped';
25
+ /**
26
+ * Information about a task's execution state.
27
+ *
28
+ * Stored in the tasks Dict of DataflowExecutionStateType.
29
+ */
30
+ export declare const TaskStateType: StructType<{
31
+ /** Task name */
32
+ readonly name: StringType;
33
+ /** Current status (TaskStatus as string) */
34
+ readonly status: StringType;
35
+ /** Whether the result was served from cache */
36
+ readonly cached: OptionType<BooleanType>;
37
+ /** Output hash if completed successfully */
38
+ readonly outputHash: OptionType<StringType>;
39
+ /** Error message if failed */
40
+ readonly error: OptionType<StringType>;
41
+ /** Exit code if task process failed */
42
+ readonly exitCode: OptionType<IntegerType>;
43
+ /** When the task started */
44
+ readonly startedAt: OptionType<DateTimeType>;
45
+ /** When the task completed */
46
+ readonly completedAt: OptionType<DateTimeType>;
47
+ /** Duration in milliseconds */
48
+ readonly duration: OptionType<IntegerType>;
49
+ }>;
50
+ export type TaskState = ValueTypeOf<typeof TaskStateType>;
51
+ /**
52
+ * A task within the dataflow graph.
53
+ */
54
+ export declare const DataflowGraphTaskType: StructType<{
55
+ /** Task name */
56
+ readonly name: StringType;
57
+ /** Task object hash */
58
+ readonly hash: StringType;
59
+ /** Input dataset paths */
60
+ readonly inputs: ArrayType<StringType>;
61
+ /** Output dataset path */
62
+ readonly output: StringType;
63
+ /** Names of tasks this depends on */
64
+ readonly dependsOn: ArrayType<StringType>;
65
+ }>;
66
+ export type DataflowGraphTask = ValueTypeOf<typeof DataflowGraphTaskType>;
67
+ /**
68
+ * The complete dataflow dependency graph.
69
+ */
70
+ export declare const DataflowGraphType: StructType<{
71
+ /** All tasks in the graph */
72
+ readonly tasks: ArrayType<StructType<{
73
+ /** Task name */
74
+ readonly name: StringType;
75
+ /** Task object hash */
76
+ readonly hash: StringType;
77
+ /** Input dataset paths */
78
+ readonly inputs: ArrayType<StringType>;
79
+ /** Output dataset path */
80
+ readonly output: StringType;
81
+ /** Names of tasks this depends on */
82
+ readonly dependsOn: ArrayType<StringType>;
83
+ }>>;
84
+ }>;
85
+ export type DataflowGraph = ValueTypeOf<typeof DataflowGraphType>;
86
+ /**
87
+ * Execution events (VariantType for discriminated union).
88
+ *
89
+ * Events track the progress of a dataflow execution and are stored
90
+ * inline in the execution state (not as a separate JSONL file).
91
+ */
92
+ export declare const ExecutionEventType: VariantType<{
93
+ /** Execution started */
94
+ readonly execution_started: StructType<{
95
+ /** Event sequence number */
96
+ readonly seq: IntegerType;
97
+ /** When the event occurred */
98
+ readonly timestamp: DateTimeType;
99
+ /** Execution ID */
100
+ readonly executionId: StringType;
101
+ /** Total number of tasks in the graph */
102
+ readonly totalTasks: IntegerType;
103
+ }>;
104
+ /** Task became ready to execute */
105
+ readonly task_ready: StructType<{
106
+ /** Event sequence number */
107
+ readonly seq: IntegerType;
108
+ /** When the event occurred */
109
+ readonly timestamp: DateTimeType;
110
+ /** Task name */
111
+ readonly task: StringType;
112
+ }>;
113
+ /** Task execution started */
114
+ readonly task_started: StructType<{
115
+ /** Event sequence number */
116
+ readonly seq: IntegerType;
117
+ /** When the event occurred */
118
+ readonly timestamp: DateTimeType;
119
+ /** Task name */
120
+ readonly task: StringType;
121
+ }>;
122
+ /** Task completed successfully */
123
+ readonly task_completed: StructType<{
124
+ /** Event sequence number */
125
+ readonly seq: IntegerType;
126
+ /** When the event occurred */
127
+ readonly timestamp: DateTimeType;
128
+ /** Task name */
129
+ readonly task: StringType;
130
+ /** Whether the result was served from cache */
131
+ readonly cached: BooleanType;
132
+ /** Output hash */
133
+ readonly outputHash: StringType;
134
+ /** Duration in milliseconds */
135
+ readonly duration: IntegerType;
136
+ }>;
137
+ /** Task failed */
138
+ readonly task_failed: StructType<{
139
+ /** Event sequence number */
140
+ readonly seq: IntegerType;
141
+ /** When the event occurred */
142
+ readonly timestamp: DateTimeType;
143
+ /** Task name */
144
+ readonly task: StringType;
145
+ /** Error message */
146
+ readonly error: OptionType<StringType>;
147
+ /** Exit code if task process failed */
148
+ readonly exitCode: OptionType<IntegerType>;
149
+ /** Duration in milliseconds */
150
+ readonly duration: IntegerType;
151
+ }>;
152
+ /** Task was skipped due to upstream failure */
153
+ readonly task_skipped: StructType<{
154
+ /** Event sequence number */
155
+ readonly seq: IntegerType;
156
+ /** When the event occurred */
157
+ readonly timestamp: DateTimeType;
158
+ /** Task name */
159
+ readonly task: StringType;
160
+ /** Name of the upstream task that caused the skip */
161
+ readonly cause: StringType;
162
+ }>;
163
+ /** Execution completed */
164
+ readonly execution_completed: StructType<{
165
+ /** Event sequence number */
166
+ readonly seq: IntegerType;
167
+ /** When the event occurred */
168
+ readonly timestamp: DateTimeType;
169
+ /** Whether all tasks succeeded */
170
+ readonly success: BooleanType;
171
+ /** Number of tasks executed (not from cache) */
172
+ readonly executed: IntegerType;
173
+ /** Number of tasks served from cache */
174
+ readonly cached: IntegerType;
175
+ /** Number of tasks that failed */
176
+ readonly failed: IntegerType;
177
+ /** Number of tasks skipped */
178
+ readonly skipped: IntegerType;
179
+ /** Total duration in milliseconds */
180
+ readonly duration: IntegerType;
181
+ }>;
182
+ /** Execution was cancelled */
183
+ readonly execution_cancelled: StructType<{
184
+ /** Event sequence number */
185
+ readonly seq: IntegerType;
186
+ /** When the event occurred */
187
+ readonly timestamp: DateTimeType;
188
+ /** Reason for cancellation */
189
+ readonly reason: OptionType<StringType>;
190
+ }>;
191
+ }>;
192
+ export type ExecutionEvent = ValueTypeOf<typeof ExecutionEventType>;
193
+ /**
194
+ * Persistent state for a dataflow execution.
195
+ *
196
+ * Stored in workspaces/<ws>/execution.beast2
197
+ *
198
+ * @remarks
199
+ * - Tasks are stored as a Dict (serializes as object, not array of tuples)
200
+ * - Events are stored inline (not as separate JSONL file)
201
+ * - Dates are Date objects (via DateTimeType)
202
+ */
203
+ export declare const DataflowExecutionStateType: StructType<{
204
+ /** Unique execution ID (local: auto-increment, cloud: UUID) */
205
+ readonly id: StringType;
206
+ /** Repository identifier */
207
+ readonly repo: StringType;
208
+ /** Workspace name */
209
+ readonly workspace: StringType;
210
+ /** When the execution started */
211
+ readonly startedAt: DateTimeType;
212
+ /** Maximum concurrent task executions */
213
+ readonly concurrency: IntegerType;
214
+ /** Force re-execution even if cached */
215
+ readonly force: BooleanType;
216
+ /** Filter to run only specific task(s) by exact name */
217
+ readonly filter: OptionType<StringType>;
218
+ /** The dependency graph (for local execution) */
219
+ readonly graph: OptionType<StructType<{
220
+ /** All tasks in the graph */
221
+ readonly tasks: ArrayType<StructType<{
222
+ /** Task name */
223
+ readonly name: StringType;
224
+ /** Task object hash */
225
+ readonly hash: StringType;
226
+ /** Input dataset paths */
227
+ readonly inputs: ArrayType<StringType>;
228
+ /** Output dataset path */
229
+ readonly output: StringType;
230
+ /** Names of tasks this depends on */
231
+ readonly dependsOn: ArrayType<StringType>;
232
+ }>>;
233
+ }>>;
234
+ /** Hash/key referencing a separately stored graph (for cloud) */
235
+ readonly graphHash: OptionType<StringType>;
236
+ /** Map of task name -> task state */
237
+ readonly tasks: DictType<StringType, StructType<{
238
+ /** Task name */
239
+ readonly name: StringType;
240
+ /** Current status (TaskStatus as string) */
241
+ readonly status: StringType;
242
+ /** Whether the result was served from cache */
243
+ readonly cached: OptionType<BooleanType>;
244
+ /** Output hash if completed successfully */
245
+ readonly outputHash: OptionType<StringType>;
246
+ /** Error message if failed */
247
+ readonly error: OptionType<StringType>;
248
+ /** Exit code if task process failed */
249
+ readonly exitCode: OptionType<IntegerType>;
250
+ /** When the task started */
251
+ readonly startedAt: OptionType<DateTimeType>;
252
+ /** When the task completed */
253
+ readonly completedAt: OptionType<DateTimeType>;
254
+ /** Duration in milliseconds */
255
+ readonly duration: OptionType<IntegerType>;
256
+ }>>;
257
+ /** Number of tasks executed (not from cache) */
258
+ readonly executed: IntegerType;
259
+ /** Number of tasks served from cache */
260
+ readonly cached: IntegerType;
261
+ /** Number of tasks that failed */
262
+ readonly failed: IntegerType;
263
+ /** Number of tasks skipped due to upstream failure */
264
+ readonly skipped: IntegerType;
265
+ /** Current execution status */
266
+ readonly status: StringType;
267
+ /** When the execution completed */
268
+ readonly completedAt: OptionType<DateTimeType>;
269
+ /** Error message if status is 'failed' */
270
+ readonly error: OptionType<StringType>;
271
+ /** All events for this execution */
272
+ readonly events: ArrayType<VariantType<{
273
+ /** Execution started */
274
+ readonly execution_started: StructType<{
275
+ /** Event sequence number */
276
+ readonly seq: IntegerType;
277
+ /** When the event occurred */
278
+ readonly timestamp: DateTimeType;
279
+ /** Execution ID */
280
+ readonly executionId: StringType;
281
+ /** Total number of tasks in the graph */
282
+ readonly totalTasks: IntegerType;
283
+ }>;
284
+ /** Task became ready to execute */
285
+ readonly task_ready: StructType<{
286
+ /** Event sequence number */
287
+ readonly seq: IntegerType;
288
+ /** When the event occurred */
289
+ readonly timestamp: DateTimeType;
290
+ /** Task name */
291
+ readonly task: StringType;
292
+ }>;
293
+ /** Task execution started */
294
+ readonly task_started: StructType<{
295
+ /** Event sequence number */
296
+ readonly seq: IntegerType;
297
+ /** When the event occurred */
298
+ readonly timestamp: DateTimeType;
299
+ /** Task name */
300
+ readonly task: StringType;
301
+ }>;
302
+ /** Task completed successfully */
303
+ readonly task_completed: StructType<{
304
+ /** Event sequence number */
305
+ readonly seq: IntegerType;
306
+ /** When the event occurred */
307
+ readonly timestamp: DateTimeType;
308
+ /** Task name */
309
+ readonly task: StringType;
310
+ /** Whether the result was served from cache */
311
+ readonly cached: BooleanType;
312
+ /** Output hash */
313
+ readonly outputHash: StringType;
314
+ /** Duration in milliseconds */
315
+ readonly duration: IntegerType;
316
+ }>;
317
+ /** Task failed */
318
+ readonly task_failed: StructType<{
319
+ /** Event sequence number */
320
+ readonly seq: IntegerType;
321
+ /** When the event occurred */
322
+ readonly timestamp: DateTimeType;
323
+ /** Task name */
324
+ readonly task: StringType;
325
+ /** Error message */
326
+ readonly error: OptionType<StringType>;
327
+ /** Exit code if task process failed */
328
+ readonly exitCode: OptionType<IntegerType>;
329
+ /** Duration in milliseconds */
330
+ readonly duration: IntegerType;
331
+ }>;
332
+ /** Task was skipped due to upstream failure */
333
+ readonly task_skipped: StructType<{
334
+ /** Event sequence number */
335
+ readonly seq: IntegerType;
336
+ /** When the event occurred */
337
+ readonly timestamp: DateTimeType;
338
+ /** Task name */
339
+ readonly task: StringType;
340
+ /** Name of the upstream task that caused the skip */
341
+ readonly cause: StringType;
342
+ }>;
343
+ /** Execution completed */
344
+ readonly execution_completed: StructType<{
345
+ /** Event sequence number */
346
+ readonly seq: IntegerType;
347
+ /** When the event occurred */
348
+ readonly timestamp: DateTimeType;
349
+ /** Whether all tasks succeeded */
350
+ readonly success: BooleanType;
351
+ /** Number of tasks executed (not from cache) */
352
+ readonly executed: IntegerType;
353
+ /** Number of tasks served from cache */
354
+ readonly cached: IntegerType;
355
+ /** Number of tasks that failed */
356
+ readonly failed: IntegerType;
357
+ /** Number of tasks skipped */
358
+ readonly skipped: IntegerType;
359
+ /** Total duration in milliseconds */
360
+ readonly duration: IntegerType;
361
+ }>;
362
+ /** Execution was cancelled */
363
+ readonly execution_cancelled: StructType<{
364
+ /** Event sequence number */
365
+ readonly seq: IntegerType;
366
+ /** When the event occurred */
367
+ readonly timestamp: DateTimeType;
368
+ /** Reason for cancellation */
369
+ readonly reason: OptionType<StringType>;
370
+ }>;
371
+ }>>;
372
+ /** Sequence number for next event (auto-increment) */
373
+ readonly eventSeq: IntegerType;
374
+ }>;
375
+ export type DataflowExecutionState = ValueTypeOf<typeof DataflowExecutionStateType>;
376
+ //# sourceMappingURL=dataflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataflow.d.ts","sourceRoot":"","sources":["../../src/dataflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EACL,UAAU,EACV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACZ,MAAM,eAAe,CAAC;AAMvB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEvF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAMlG;;;;GAIG;AACH,eAAO,MAAM,aAAa;IACxB,gBAAgB;;IAEhB,4CAA4C;;IAE5C,+CAA+C;;IAE/C,4CAA4C;;IAE5C,8BAA8B;;IAE9B,uCAAuC;;IAEvC,4BAA4B;;IAE5B,8BAA8B;;IAE9B,+BAA+B;;EAE/B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAM1D;;GAEG;AACH,eAAO,MAAM,qBAAqB;IAChC,gBAAgB;;IAEhB,uBAAuB;;IAEvB,0BAA0B;;IAE1B,0BAA0B;;IAE1B,qCAAqC;;EAErC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC5B,6BAA6B;;QAjB7B,gBAAgB;;QAEhB,uB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AAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,239 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Dataflow execution state type definitions.
7
+ *
8
+ * These types define the persistent state for dataflow execution,
9
+ * stored in workspaces/<ws>/execution.beast2
10
+ *
11
+ * Key design decisions:
12
+ * - Dates are Date objects (via DateTimeType), not strings
13
+ * - Events stored inline as array (single file, not separate JSONL)
14
+ * - Tasks stored as Dict (not Map) for beast2 compatibility
15
+ */
16
+ import { StructType, VariantType, ArrayType, DictType, StringType, IntegerType, BooleanType, DateTimeType, OptionType, } from '@elaraai/east';
17
+ // =============================================================================
18
+ // Task State
19
+ // =============================================================================
20
+ /**
21
+ * Information about a task's execution state.
22
+ *
23
+ * Stored in the tasks Dict of DataflowExecutionStateType.
24
+ */
25
+ export const TaskStateType = StructType({
26
+ /** Task name */
27
+ name: StringType,
28
+ /** Current status (TaskStatus as string) */
29
+ status: StringType,
30
+ /** Whether the result was served from cache */
31
+ cached: OptionType(BooleanType),
32
+ /** Output hash if completed successfully */
33
+ outputHash: OptionType(StringType),
34
+ /** Error message if failed */
35
+ error: OptionType(StringType),
36
+ /** Exit code if task process failed */
37
+ exitCode: OptionType(IntegerType),
38
+ /** When the task started */
39
+ startedAt: OptionType(DateTimeType),
40
+ /** When the task completed */
41
+ completedAt: OptionType(DateTimeType),
42
+ /** Duration in milliseconds */
43
+ duration: OptionType(IntegerType),
44
+ });
45
+ // =============================================================================
46
+ // Graph Types
47
+ // =============================================================================
48
+ /**
49
+ * A task within the dataflow graph.
50
+ */
51
+ export const DataflowGraphTaskType = StructType({
52
+ /** Task name */
53
+ name: StringType,
54
+ /** Task object hash */
55
+ hash: StringType,
56
+ /** Input dataset paths */
57
+ inputs: ArrayType(StringType),
58
+ /** Output dataset path */
59
+ output: StringType,
60
+ /** Names of tasks this depends on */
61
+ dependsOn: ArrayType(StringType),
62
+ });
63
+ /**
64
+ * The complete dataflow dependency graph.
65
+ */
66
+ export const DataflowGraphType = StructType({
67
+ /** All tasks in the graph */
68
+ tasks: ArrayType(DataflowGraphTaskType),
69
+ });
70
+ // =============================================================================
71
+ // Event Types
72
+ // =============================================================================
73
+ /**
74
+ * Execution events (VariantType for discriminated union).
75
+ *
76
+ * Events track the progress of a dataflow execution and are stored
77
+ * inline in the execution state (not as a separate JSONL file).
78
+ */
79
+ export const ExecutionEventType = VariantType({
80
+ /** Execution started */
81
+ execution_started: StructType({
82
+ /** Event sequence number */
83
+ seq: IntegerType,
84
+ /** When the event occurred */
85
+ timestamp: DateTimeType,
86
+ /** Execution ID */
87
+ executionId: StringType,
88
+ /** Total number of tasks in the graph */
89
+ totalTasks: IntegerType,
90
+ }),
91
+ /** Task became ready to execute */
92
+ task_ready: StructType({
93
+ /** Event sequence number */
94
+ seq: IntegerType,
95
+ /** When the event occurred */
96
+ timestamp: DateTimeType,
97
+ /** Task name */
98
+ task: StringType,
99
+ }),
100
+ /** Task execution started */
101
+ task_started: StructType({
102
+ /** Event sequence number */
103
+ seq: IntegerType,
104
+ /** When the event occurred */
105
+ timestamp: DateTimeType,
106
+ /** Task name */
107
+ task: StringType,
108
+ }),
109
+ /** Task completed successfully */
110
+ task_completed: StructType({
111
+ /** Event sequence number */
112
+ seq: IntegerType,
113
+ /** When the event occurred */
114
+ timestamp: DateTimeType,
115
+ /** Task name */
116
+ task: StringType,
117
+ /** Whether the result was served from cache */
118
+ cached: BooleanType,
119
+ /** Output hash */
120
+ outputHash: StringType,
121
+ /** Duration in milliseconds */
122
+ duration: IntegerType,
123
+ }),
124
+ /** Task failed */
125
+ task_failed: StructType({
126
+ /** Event sequence number */
127
+ seq: IntegerType,
128
+ /** When the event occurred */
129
+ timestamp: DateTimeType,
130
+ /** Task name */
131
+ task: StringType,
132
+ /** Error message */
133
+ error: OptionType(StringType),
134
+ /** Exit code if task process failed */
135
+ exitCode: OptionType(IntegerType),
136
+ /** Duration in milliseconds */
137
+ duration: IntegerType,
138
+ }),
139
+ /** Task was skipped due to upstream failure */
140
+ task_skipped: StructType({
141
+ /** Event sequence number */
142
+ seq: IntegerType,
143
+ /** When the event occurred */
144
+ timestamp: DateTimeType,
145
+ /** Task name */
146
+ task: StringType,
147
+ /** Name of the upstream task that caused the skip */
148
+ cause: StringType,
149
+ }),
150
+ /** Execution completed */
151
+ execution_completed: StructType({
152
+ /** Event sequence number */
153
+ seq: IntegerType,
154
+ /** When the event occurred */
155
+ timestamp: DateTimeType,
156
+ /** Whether all tasks succeeded */
157
+ success: BooleanType,
158
+ /** Number of tasks executed (not from cache) */
159
+ executed: IntegerType,
160
+ /** Number of tasks served from cache */
161
+ cached: IntegerType,
162
+ /** Number of tasks that failed */
163
+ failed: IntegerType,
164
+ /** Number of tasks skipped */
165
+ skipped: IntegerType,
166
+ /** Total duration in milliseconds */
167
+ duration: IntegerType,
168
+ }),
169
+ /** Execution was cancelled */
170
+ execution_cancelled: StructType({
171
+ /** Event sequence number */
172
+ seq: IntegerType,
173
+ /** When the event occurred */
174
+ timestamp: DateTimeType,
175
+ /** Reason for cancellation */
176
+ reason: OptionType(StringType),
177
+ }),
178
+ });
179
+ // =============================================================================
180
+ // Main Execution State
181
+ // =============================================================================
182
+ /**
183
+ * Persistent state for a dataflow execution.
184
+ *
185
+ * Stored in workspaces/<ws>/execution.beast2
186
+ *
187
+ * @remarks
188
+ * - Tasks are stored as a Dict (serializes as object, not array of tuples)
189
+ * - Events are stored inline (not as separate JSONL file)
190
+ * - Dates are Date objects (via DateTimeType)
191
+ */
192
+ export const DataflowExecutionStateType = StructType({
193
+ // Identity
194
+ /** Unique execution ID (local: auto-increment, cloud: UUID) */
195
+ id: StringType,
196
+ /** Repository identifier */
197
+ repo: StringType,
198
+ /** Workspace name */
199
+ workspace: StringType,
200
+ /** When the execution started */
201
+ startedAt: DateTimeType,
202
+ // Config (immutable after initialization)
203
+ /** Maximum concurrent task executions */
204
+ concurrency: IntegerType,
205
+ /** Force re-execution even if cached */
206
+ force: BooleanType,
207
+ /** Filter to run only specific task(s) by exact name */
208
+ filter: OptionType(StringType),
209
+ // Graph (inline or by reference)
210
+ /** The dependency graph (for local execution) */
211
+ graph: OptionType(DataflowGraphType),
212
+ /** Hash/key referencing a separately stored graph (for cloud) */
213
+ graphHash: OptionType(StringType),
214
+ // Task tracking
215
+ /** Map of task name -> task state */
216
+ tasks: DictType(StringType, TaskStateType),
217
+ // Summary counters
218
+ /** Number of tasks executed (not from cache) */
219
+ executed: IntegerType,
220
+ /** Number of tasks served from cache */
221
+ cached: IntegerType,
222
+ /** Number of tasks that failed */
223
+ failed: IntegerType,
224
+ /** Number of tasks skipped due to upstream failure */
225
+ skipped: IntegerType,
226
+ // Status
227
+ /** Current execution status */
228
+ status: StringType, // DataflowExecutionStatus
229
+ /** When the execution completed */
230
+ completedAt: OptionType(DateTimeType),
231
+ /** Error message if status is 'failed' */
232
+ error: OptionType(StringType),
233
+ // Events (inline array)
234
+ /** All events for this execution */
235
+ events: ArrayType(ExecutionEventType),
236
+ /** Sequence number for next event (auto-increment) */
237
+ eventSeq: IntegerType,
238
+ });
239
+ //# sourceMappingURL=dataflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataflow.js","sourceRoot":"","sources":["../../src/dataflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EACL,UAAU,EACV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,GAEX,MAAM,eAAe,CAAC;AAgBvB,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,gBAAgB;IAChB,IAAI,EAAE,UAAU;IAChB,4CAA4C;IAC5C,MAAM,EAAE,UAAU;IAClB,+CAA+C;IAC/C,MAAM,EAAE,UAAU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C;IACxC,MAAM,EAAE,WAAW;IACnB,kCAAkC;IAClC,MAAM,EAAE,WAAW;IACnB,sDAAsD;IACtD,OAAO,EAAE,WAAW;IAEpB,SAAS;IACT,+BAA+B;IAC/B,MAAM,EAAE,UAAU,EAAE,0BAA0B;IAC9C,mCAAmC;IACnC,WAAW,EAAE,UAAU,CAAC,YAAY,CAAC;IACrC,0CAA0C;IAC1C,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC;IAE7B,wBAAwB;IACxB,oCAAoC;IACpC,MAAM,EAAE,SAAS,CAAC,kBAAkB,CAAC;IACrC,sDAAsD;IACtD,QAAQ,EAAE,WAAW;CACtB,CAAC,CAAC"}
@@ -35,13 +35,13 @@ import { VariantType, StringType, NullType, ValueTypeOf, StructType, EastType }
35
35
  */
36
36
  export declare const DataRefType: VariantType<{
37
37
  /** Unassigned value (e.g., pending task output) */
38
- unassigned: NullType;
38
+ readonly unassigned: NullType;
39
39
  /** Inline null value (optimization for NullType) */
40
- null: NullType;
40
+ readonly null: NullType;
41
41
  /** Hash of a beast2 value blob in objects/ */
42
- value: StringType;
42
+ readonly value: StringType;
43
43
  /** Hash of a tree object in objects/ */
44
- tree: StringType;
44
+ readonly tree: StringType;
45
45
  }>;
46
46
  export type DataRefType = typeof DataRefType;
47
47
  export type DataRef = ValueTypeOf<typeof DataRefType>;