@elaraai/e3-types 0.0.2-beta.5 → 0.0.2-beta.50

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 (59) hide show
  1. package/README.md +7 -4
  2. package/dist/src/api.d.ts +1111 -0
  3. package/dist/src/api.d.ts.map +1 -0
  4. package/dist/src/api.js +650 -0
  5. package/dist/src/api.js.map +1 -0
  6. package/dist/src/constants.d.ts +12 -0
  7. package/dist/src/constants.d.ts.map +1 -0
  8. package/dist/src/constants.js +12 -0
  9. package/dist/src/constants.js.map +1 -0
  10. package/dist/src/dataflow.d.ts +574 -0
  11. package/dist/src/dataflow.d.ts.map +1 -0
  12. package/dist/src/dataflow.js +366 -0
  13. package/dist/src/dataflow.js.map +1 -0
  14. package/dist/src/dataset-ref.d.ts +86 -0
  15. package/dist/src/dataset-ref.d.ts.map +1 -0
  16. package/dist/src/dataset-ref.js +82 -0
  17. package/dist/src/dataset-ref.js.map +1 -0
  18. package/dist/src/dataset.d.ts +4 -4
  19. package/dist/src/execution.d.ts +29 -21
  20. package/dist/src/execution.d.ts.map +1 -1
  21. package/dist/src/execution.js +8 -0
  22. package/dist/src/execution.js.map +1 -1
  23. package/dist/src/index.d.ts +7 -1
  24. package/dist/src/index.d.ts.map +1 -1
  25. package/dist/src/index.js +39 -1
  26. package/dist/src/index.js.map +1 -1
  27. package/dist/src/lock.d.ts +85 -0
  28. package/dist/src/lock.d.ts.map +1 -0
  29. package/dist/src/lock.js +71 -0
  30. package/dist/src/lock.js.map +1 -0
  31. package/dist/src/package.d.ts +235 -134
  32. package/dist/src/package.d.ts.map +1 -1
  33. package/dist/src/package.js +53 -23
  34. package/dist/src/package.js.map +1 -1
  35. package/dist/src/structure.d.ts +87 -73
  36. package/dist/src/structure.d.ts.map +1 -1
  37. package/dist/src/structure.js +8 -3
  38. package/dist/src/structure.js.map +1 -1
  39. package/dist/src/task.d.ts +5 -5
  40. package/dist/src/transfer.d.ts +52 -0
  41. package/dist/src/transfer.d.ts.map +1 -0
  42. package/dist/src/transfer.js +49 -0
  43. package/dist/src/transfer.js.map +1 -0
  44. package/dist/src/workspace.d.ts +7 -9
  45. package/dist/src/workspace.d.ts.map +1 -1
  46. package/dist/src/workspace.js +3 -5
  47. package/dist/src/workspace.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/api.ts +760 -0
  50. package/src/constants.ts +12 -0
  51. package/src/dataflow.ts +427 -0
  52. package/src/dataset-ref.ts +91 -0
  53. package/src/execution.ts +8 -0
  54. package/src/index.ts +183 -0
  55. package/src/lock.ts +90 -0
  56. package/src/package.ts +72 -23
  57. package/src/structure.ts +8 -3
  58. package/src/transfer.ts +56 -0
  59. package/src/workspace.ts +3 -5
@@ -0,0 +1,366 @@
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
+ /** An input dataset changed during execution (reactive dataflow) */
179
+ input_changed: StructType({
180
+ /** Event sequence number */
181
+ seq: IntegerType,
182
+ /** When the event occurred */
183
+ timestamp: DateTimeType,
184
+ /** Path of the changed input dataset */
185
+ path: StringType,
186
+ /** Previous hash (empty string if was unassigned) */
187
+ previousHash: StringType,
188
+ /** New hash */
189
+ newHash: StringType,
190
+ }),
191
+ /** A task was invalidated due to upstream input change */
192
+ task_invalidated: StructType({
193
+ /** Event sequence number */
194
+ seq: IntegerType,
195
+ /** When the event occurred */
196
+ timestamp: DateTimeType,
197
+ /** Task name */
198
+ task: StringType,
199
+ /** Reason for invalidation */
200
+ reason: StringType,
201
+ }),
202
+ /** A task was deferred due to inconsistent input versions */
203
+ task_deferred: StructType({
204
+ /** Event sequence number */
205
+ seq: IntegerType,
206
+ /** When the event occurred */
207
+ timestamp: DateTimeType,
208
+ /** Task name */
209
+ task: StringType,
210
+ /** Path where version conflict was detected */
211
+ conflictPath: StringType,
212
+ }),
213
+ });
214
+ // =============================================================================
215
+ // Main Execution State
216
+ // =============================================================================
217
+ /**
218
+ * Persistent state for a dataflow execution.
219
+ *
220
+ * Stored in workspaces/<ws>/execution.beast2
221
+ *
222
+ * @remarks
223
+ * - Tasks are stored as a Dict (serializes as object, not array of tuples)
224
+ * - Events are stored inline (not as separate JSONL file)
225
+ * - Dates are Date objects (via DateTimeType)
226
+ */
227
+ export const DataflowExecutionStateType = StructType({
228
+ // Identity
229
+ /** Unique execution ID (local: auto-increment, cloud: UUID) */
230
+ id: StringType,
231
+ /** Repository identifier */
232
+ repo: StringType,
233
+ /** Workspace name */
234
+ workspace: StringType,
235
+ /** When the execution started */
236
+ startedAt: DateTimeType,
237
+ // Config (immutable after initialization)
238
+ /** Maximum concurrent task executions */
239
+ concurrency: IntegerType,
240
+ /** Force re-execution even if cached */
241
+ force: BooleanType,
242
+ /** Filter to run only specific task(s) by exact name */
243
+ filter: OptionType(StringType),
244
+ // Graph (inline or by reference)
245
+ /** The dependency graph (for local execution) */
246
+ graph: OptionType(DataflowGraphType),
247
+ /** Hash/key referencing a separately stored graph (for cloud) */
248
+ graphHash: OptionType(StringType),
249
+ // Task tracking
250
+ /** Map of task name -> task state */
251
+ tasks: DictType(StringType, TaskStateType),
252
+ // Summary counters
253
+ /** Number of tasks executed (not from cache) */
254
+ executed: IntegerType,
255
+ /** Number of tasks served from cache */
256
+ cached: IntegerType,
257
+ /** Number of tasks that failed */
258
+ failed: IntegerType,
259
+ /** Number of tasks skipped due to upstream failure */
260
+ skipped: IntegerType,
261
+ // Status
262
+ /** Current execution status */
263
+ status: StringType, // DataflowExecutionStatus
264
+ /** When the execution completed */
265
+ completedAt: OptionType(DateTimeType),
266
+ /** Error message if status is 'failed' */
267
+ error: OptionType(StringType),
268
+ // Reactive dataflow tracking
269
+ /** Version vectors: dataset keypath -> VersionVector (root input path -> hash) */
270
+ versionVectors: DictType(StringType, DictType(StringType, StringType)),
271
+ /** Input snapshot: root input keypath -> hash at time of last check */
272
+ inputSnapshot: DictType(StringType, StringType),
273
+ /** Set of dataset keypaths that are task outputs */
274
+ taskOutputPaths: ArrayType(StringType),
275
+ /** Number of tasks re-executed due to input changes */
276
+ reexecuted: IntegerType,
277
+ // Events (inline array)
278
+ /** All events for this execution */
279
+ events: ArrayType(ExecutionEventType),
280
+ /** Sequence number for next event (auto-increment) */
281
+ eventSeq: IntegerType,
282
+ });
283
+ // =============================================================================
284
+ // Dataflow Run History
285
+ // =============================================================================
286
+ /**
287
+ * Status of a dataflow run.
288
+ */
289
+ export const DataflowRunStatusType = VariantType({
290
+ /** Run is currently executing */
291
+ running: StructType({}),
292
+ /** Run completed successfully */
293
+ completed: StructType({}),
294
+ /** Run failed with a task error */
295
+ failed: StructType({
296
+ /** Name of the task that failed */
297
+ failedTask: StringType,
298
+ /** Error message */
299
+ error: StringType,
300
+ }),
301
+ /** Run was cancelled */
302
+ cancelled: StructType({}),
303
+ });
304
+ /**
305
+ * Record of a task execution within a dataflow run.
306
+ */
307
+ export const TaskExecutionRecordType = StructType({
308
+ /** Execution ID (UUIDv7) */
309
+ executionId: StringType,
310
+ /** Whether this was a cache hit */
311
+ cached: BooleanType,
312
+ /** Output version vector (which root input versions produced this output) */
313
+ outputVersions: DictType(StringType, StringType),
314
+ /** Number of times this task was executed (including re-executions due to input changes) */
315
+ executionCount: IntegerType,
316
+ });
317
+ /**
318
+ * Summary statistics for a dataflow run.
319
+ */
320
+ export const DataflowRunSummaryType = StructType({
321
+ /** Total number of tasks */
322
+ total: IntegerType,
323
+ /** Number of completed tasks */
324
+ completed: IntegerType,
325
+ /** Number of cached tasks */
326
+ cached: IntegerType,
327
+ /** Number of failed tasks */
328
+ failed: IntegerType,
329
+ /** Number of skipped tasks */
330
+ skipped: IntegerType,
331
+ /** Number of tasks re-executed due to input changes */
332
+ reexecuted: IntegerType,
333
+ });
334
+ /**
335
+ * A dataflow run record, tracking one execution of a workspace's dataflow.
336
+ *
337
+ * Stored in: dataflows/<workspace>/<runId>.beast2
338
+ *
339
+ * This provides execution history and provenance tracking:
340
+ * - Which tasks ran and which were cached
341
+ * - Input/output snapshots for reproducibility
342
+ * - Timing information for performance analysis
343
+ */
344
+ export const DataflowRunType = StructType({
345
+ /** Run ID (UUIDv7) */
346
+ runId: StringType,
347
+ /** Workspace name */
348
+ workspaceName: StringType,
349
+ /** Package reference at run time (name@version) */
350
+ packageRef: StringType,
351
+ /** When the run started */
352
+ startedAt: DateTimeType,
353
+ /** When the run completed (null if still running) */
354
+ completedAt: OptionType(DateTimeType),
355
+ /** Current status of the run */
356
+ status: DataflowRunStatusType,
357
+ /** Input version snapshot at start (root input path -> hash) */
358
+ inputVersions: DictType(StringType, StringType),
359
+ /** Output version snapshot at end (null if still running) */
360
+ outputVersions: OptionType(DictType(StringType, StringType)),
361
+ /** Map of task name -> execution record */
362
+ taskExecutions: DictType(StringType, TaskExecutionRecordType),
363
+ /** Summary statistics */
364
+ summary: DataflowRunSummaryType,
365
+ });
366
+ //# sourceMappingURL=dataflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataflow.js","sourceRoot":"","sources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AC5F,cAAc,EAAE,WAAW;CAC5B,CAAC,CAAC;AAGH;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;IAC/C,4BAA4B;IAC5B,KAAK,EAAE,WAAW;IAClB,gCAAgC;IAChC,SAAS,EAAE,WAAW;IACtB,6BAA6B;IAC7B,MAAM,EAAE,WAAW;IACnB,6BAA6B;IAC7B,MAAM,EAAE,WAAW;IACnB,8BAA8B;IAC9B,OAAO,EAAE,WAAW;IACpB,uDAAuD;IACvD,UAAU,EAAE,WAAW;CACxB,CAAC,CAAC;AAGH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,sBAAsB;IACtB,KAAK,EAAE,UAAU;IACjB,qBAAqB;IACrB,aAAa,EAAE,UAAU;IACzB,mDAAmD;IACnD,UAAU,EAAE,UAAU;IAEtB,2BAA2B;IAC3B,SAAS,EAAE,YAAY;IACvB,qDAAqD;IACrD,WAAW,EAAE,UAAU,CAAC,YAAY,CAAC;IAErC,gCAAgC;IAChC,MAAM,EAAE,qBAAqB;IAE7B,gEAAgE;IAChE,aAAa,EAAE,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAC/C,6DAA6D;IAC7D,cAAc,EAAE,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAE5D,2CAA2C;IAC3C,cAAc,EAAE,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC;IAE7D,yBAAyB;IACzB,OAAO,EAAE,sBAAsB;CAChC,CAAC,CAAC"}
@@ -0,0 +1,86 @@
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
+ * Per-dataset reference types for reactive dataflow.
7
+ *
8
+ * Each dataset in a workspace has its own `.ref` file instead of being
9
+ * part of a single root tree. This enables concurrent writes and
10
+ * reactive re-execution.
11
+ *
12
+ * A DatasetRef tracks:
13
+ * - The current value hash (or unassigned/null state)
14
+ * - A version vector mapping root input paths to their content hashes,
15
+ * enabling consistency checking across task inputs.
16
+ */
17
+ import { VariantType, StructType, DictType, StringType, NullType, type ValueTypeOf } from '@elaraai/east';
18
+ /**
19
+ * Version vector: maps root input dataset path -> content hash.
20
+ *
21
+ * Used to track which version of each root input contributed to a
22
+ * dataset's current value. When a task executes, its output's version
23
+ * vector is the union of all input version vectors (which must agree
24
+ * on shared keys for consistency).
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * // Root input version vector (self-referencing)
29
+ * const inputVV: VersionVector = new Map([
30
+ * ['.inputs.sales', 'abc123...'],
31
+ * ]);
32
+ *
33
+ * // Derived dataset version vector (union of inputs)
34
+ * const derivedVV: VersionVector = new Map([
35
+ * ['.inputs.sales', 'abc123...'],
36
+ * ['.inputs.config', 'def456...'],
37
+ * ]);
38
+ * ```
39
+ */
40
+ export declare const VersionVectorType: DictType<StringType, StringType>;
41
+ export type VersionVectorType = typeof VersionVectorType;
42
+ export type VersionVector = ValueTypeOf<typeof VersionVectorType>;
43
+ /**
44
+ * Per-dataset reference stored in workspace data files.
45
+ *
46
+ * Each dataset has a `.ref` file at `workspaces/<ws>/data/<path>.ref`.
47
+ * The ref tracks the dataset's current state and version provenance.
48
+ *
49
+ * Variants:
50
+ * - `unassigned`: Dataset has no value yet (e.g., pending task output)
51
+ * - `null`: Dataset has been explicitly set to null, with version tracking
52
+ * - `value`: Dataset has a value hash in the object store, with version tracking
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * // Unassigned (initial state for task outputs)
57
+ * const ref: DatasetRef = variant('unassigned', null);
58
+ *
59
+ * // Null value with version tracking
60
+ * const ref: DatasetRef = variant('null', {
61
+ * versions: new Map([['.inputs.sales', 'abc123...']]),
62
+ * });
63
+ *
64
+ * // Value with version tracking
65
+ * const ref: DatasetRef = variant('value', {
66
+ * hash: 'def456...',
67
+ * versions: new Map([['.inputs.sales', 'abc123...']]),
68
+ * });
69
+ * ```
70
+ */
71
+ export declare const DatasetRefType: VariantType<{
72
+ /** Dataset has no value assigned */
73
+ readonly unassigned: NullType;
74
+ /** Dataset value is null, with version provenance */
75
+ readonly null: StructType<{
76
+ readonly versions: DictType<StringType, StringType>;
77
+ }>;
78
+ /** Dataset has a value in the object store, with version provenance */
79
+ readonly value: StructType<{
80
+ readonly hash: StringType;
81
+ readonly versions: DictType<StringType, StringType>;
82
+ }>;
83
+ }>;
84
+ export type DatasetRefType = typeof DatasetRefType;
85
+ export type DatasetRef = ValueTypeOf<typeof DatasetRefType>;
86
+ //# sourceMappingURL=dataset-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset-ref.d.ts","sourceRoot":"","sources":["../../src/dataset-ref.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE1G;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,iBAAiB,kCAAmC,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,cAAc;IACzB,oCAAoC;;IAEpC,qDAAqD;;;;IAIrD,uEAAuE;;;;;EAKvE,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -0,0 +1,82 @@
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
+ * Per-dataset reference types for reactive dataflow.
7
+ *
8
+ * Each dataset in a workspace has its own `.ref` file instead of being
9
+ * part of a single root tree. This enables concurrent writes and
10
+ * reactive re-execution.
11
+ *
12
+ * A DatasetRef tracks:
13
+ * - The current value hash (or unassigned/null state)
14
+ * - A version vector mapping root input paths to their content hashes,
15
+ * enabling consistency checking across task inputs.
16
+ */
17
+ import { VariantType, StructType, DictType, StringType, NullType } from '@elaraai/east';
18
+ /**
19
+ * Version vector: maps root input dataset path -> content hash.
20
+ *
21
+ * Used to track which version of each root input contributed to a
22
+ * dataset's current value. When a task executes, its output's version
23
+ * vector is the union of all input version vectors (which must agree
24
+ * on shared keys for consistency).
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * // Root input version vector (self-referencing)
29
+ * const inputVV: VersionVector = new Map([
30
+ * ['.inputs.sales', 'abc123...'],
31
+ * ]);
32
+ *
33
+ * // Derived dataset version vector (union of inputs)
34
+ * const derivedVV: VersionVector = new Map([
35
+ * ['.inputs.sales', 'abc123...'],
36
+ * ['.inputs.config', 'def456...'],
37
+ * ]);
38
+ * ```
39
+ */
40
+ export const VersionVectorType = DictType(StringType, StringType);
41
+ /**
42
+ * Per-dataset reference stored in workspace data files.
43
+ *
44
+ * Each dataset has a `.ref` file at `workspaces/<ws>/data/<path>.ref`.
45
+ * The ref tracks the dataset's current state and version provenance.
46
+ *
47
+ * Variants:
48
+ * - `unassigned`: Dataset has no value yet (e.g., pending task output)
49
+ * - `null`: Dataset has been explicitly set to null, with version tracking
50
+ * - `value`: Dataset has a value hash in the object store, with version tracking
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * // Unassigned (initial state for task outputs)
55
+ * const ref: DatasetRef = variant('unassigned', null);
56
+ *
57
+ * // Null value with version tracking
58
+ * const ref: DatasetRef = variant('null', {
59
+ * versions: new Map([['.inputs.sales', 'abc123...']]),
60
+ * });
61
+ *
62
+ * // Value with version tracking
63
+ * const ref: DatasetRef = variant('value', {
64
+ * hash: 'def456...',
65
+ * versions: new Map([['.inputs.sales', 'abc123...']]),
66
+ * });
67
+ * ```
68
+ */
69
+ export const DatasetRefType = VariantType({
70
+ /** Dataset has no value assigned */
71
+ unassigned: NullType,
72
+ /** Dataset value is null, with version provenance */
73
+ null: StructType({
74
+ versions: VersionVectorType,
75
+ }),
76
+ /** Dataset has a value in the object store, with version provenance */
77
+ value: StructType({
78
+ hash: StringType,
79
+ versions: VersionVectorType,
80
+ }),
81
+ });
82
+ //# sourceMappingURL=dataset-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset-ref.js","sourceRoot":"","sources":["../../src/dataset-ref.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAoB,MAAM,eAAe,CAAC;AAE1G;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAKlE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;IACxC,oCAAoC;IACpC,UAAU,EAAE,QAAQ;IACpB,qDAAqD;IACrD,IAAI,EAAE,UAAU,CAAC;QACf,QAAQ,EAAE,iBAAiB;KAC5B,CAAC;IACF,uEAAuE;IACvE,KAAK,EAAE,UAAU,CAAC;QAChB,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,iBAAiB;KAC5B,CAAC;CACH,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>;
@@ -30,50 +30,58 @@ import { VariantType, StructType, ArrayType, StringType, IntegerType, DateTimeTy
30
30
  */
31
31
  export declare const ExecutionStatusType: VariantType<{
32
32
  /** Task has been launched but not yet completed */
33
- running: StructType<{
33
+ readonly running: StructType<{
34
+ /** Unique execution ID (UUIDv7) */
35
+ readonly executionId: StringType;
34
36
  /** Input dataset hashes */
35
- inputHashes: ArrayType<StringType>;
37
+ readonly inputHashes: ArrayType<StringType>;
36
38
  /** When execution started */
37
- startedAt: DateTimeType;
39
+ readonly startedAt: DateTimeType;
38
40
  /** Process ID of the runner */
39
- pid: IntegerType;
41
+ readonly pid: IntegerType;
40
42
  /** Process start time in jiffies since boot (from /proc/<pid>/stat field 22) */
41
- pidStartTime: IntegerType;
43
+ readonly pidStartTime: IntegerType;
42
44
  /** System boot ID (from /proc/sys/kernel/random/boot_id) */
43
- bootId: StringType;
45
+ readonly bootId: StringType;
44
46
  }>;
45
47
  /** Task ran and returned exit code 0 */
46
- success: StructType<{
48
+ readonly success: StructType<{
49
+ /** Unique execution ID (UUIDv7) */
50
+ readonly executionId: StringType;
47
51
  /** Input dataset hashes */
48
- inputHashes: ArrayType<StringType>;
52
+ readonly inputHashes: ArrayType<StringType>;
49
53
  /** Hash of the output dataset */
50
- outputHash: StringType;
54
+ readonly outputHash: StringType;
51
55
  /** When execution started */
52
- startedAt: DateTimeType;
56
+ readonly startedAt: DateTimeType;
53
57
  /** When execution completed */
54
- completedAt: DateTimeType;
58
+ readonly completedAt: DateTimeType;
55
59
  }>;
56
60
  /** Task ran and returned non-zero exit code */
57
- failed: StructType<{
61
+ readonly failed: StructType<{
62
+ /** Unique execution ID (UUIDv7) */
63
+ readonly executionId: StringType;
58
64
  /** Input dataset hashes */
59
- inputHashes: ArrayType<StringType>;
65
+ readonly inputHashes: ArrayType<StringType>;
60
66
  /** When execution started */
61
- startedAt: DateTimeType;
67
+ readonly startedAt: DateTimeType;
62
68
  /** When execution completed */
63
- completedAt: DateTimeType;
69
+ readonly completedAt: DateTimeType;
64
70
  /** Process exit code */
65
- exitCode: IntegerType;
71
+ readonly exitCode: IntegerType;
66
72
  }>;
67
73
  /** e3 execution engine had an internal error */
68
- error: StructType<{
74
+ readonly error: StructType<{
75
+ /** Unique execution ID (UUIDv7) */
76
+ readonly executionId: StringType;
69
77
  /** Input dataset hashes */
70
- inputHashes: ArrayType<StringType>;
78
+ readonly inputHashes: ArrayType<StringType>;
71
79
  /** When execution started */
72
- startedAt: DateTimeType;
80
+ readonly startedAt: DateTimeType;
73
81
  /** When execution completed */
74
- completedAt: DateTimeType;
82
+ readonly completedAt: DateTimeType;
75
83
  /** Error message describing what went wrong */
76
- message: StringType;
84
+ readonly message: StringType;
77
85
  }>;
78
86
  }>;
79
87
  export type ExecutionStatus = ValueTypeOf<typeof ExecutionStatusType>;
@@ -1 +1 @@
1
- {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/execution.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB;IAC9B,mDAAmD;;QAEjD,2BAA2B;;QAE3B,6BAA6B;;QAE7B,+BAA+B;;QAE/B,gFAAgF;;QAEhF,4DAA4D;;;IAG9D,wCAAwC;;QAEtC,2BAA2B;;QAE3B,iCAAiC;;QAEjC,6BAA6B;;QAE7B,+BAA+B;;;IAGjC,+CAA+C;;QAE7C,2BAA2B;;QAE3B,6BAA6B;;QAE7B,+BAA+B;;QAE/B,wBAAw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