@elaraai/e3-core 0.0.2-beta.3 → 0.0.2-beta.30
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 +25 -22
- package/dist/src/dataflow/api-compat.d.ts +90 -0
- package/dist/src/dataflow/api-compat.d.ts.map +1 -0
- package/dist/src/dataflow/api-compat.js +134 -0
- package/dist/src/dataflow/api-compat.js.map +1 -0
- package/dist/src/dataflow/index.d.ts +18 -0
- package/dist/src/dataflow/index.d.ts.map +1 -0
- package/dist/src/dataflow/index.js +23 -0
- package/dist/src/dataflow/index.js.map +1 -0
- package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts +53 -0
- package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts.map +1 -0
- package/dist/src/dataflow/orchestrator/LocalOrchestrator.js +416 -0
- package/dist/src/dataflow/orchestrator/LocalOrchestrator.js.map +1 -0
- package/dist/src/dataflow/orchestrator/index.d.ts +12 -0
- package/dist/src/dataflow/orchestrator/index.d.ts.map +1 -0
- package/dist/src/dataflow/orchestrator/index.js +12 -0
- package/dist/src/dataflow/orchestrator/index.js.map +1 -0
- package/dist/src/dataflow/orchestrator/interfaces.d.ts +157 -0
- package/dist/src/dataflow/orchestrator/interfaces.d.ts.map +1 -0
- package/dist/src/dataflow/orchestrator/interfaces.js +51 -0
- package/dist/src/dataflow/orchestrator/interfaces.js.map +1 -0
- package/dist/src/dataflow/state-store/FileStateStore.d.ts +67 -0
- package/dist/src/dataflow/state-store/FileStateStore.d.ts.map +1 -0
- package/dist/src/dataflow/state-store/FileStateStore.js +286 -0
- package/dist/src/dataflow/state-store/FileStateStore.js.map +1 -0
- package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts +42 -0
- package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts.map +1 -0
- package/dist/src/dataflow/state-store/InMemoryStateStore.js +214 -0
- package/dist/src/dataflow/state-store/InMemoryStateStore.js.map +1 -0
- package/dist/src/dataflow/state-store/index.d.ts +13 -0
- package/dist/src/dataflow/state-store/index.d.ts.map +1 -0
- package/dist/src/dataflow/state-store/index.js +13 -0
- package/dist/src/dataflow/state-store/index.js.map +1 -0
- package/dist/src/dataflow/state-store/interfaces.d.ts +159 -0
- package/dist/src/dataflow/state-store/interfaces.d.ts.map +1 -0
- package/dist/src/dataflow/state-store/interfaces.js +6 -0
- package/dist/src/dataflow/state-store/interfaces.js.map +1 -0
- package/dist/src/dataflow/steps.d.ts +176 -0
- package/dist/src/dataflow/steps.d.ts.map +1 -0
- package/dist/src/dataflow/steps.js +528 -0
- package/dist/src/dataflow/steps.js.map +1 -0
- package/dist/src/dataflow/types.d.ts +116 -0
- package/dist/src/dataflow/types.d.ts.map +1 -0
- package/dist/src/dataflow/types.js +7 -0
- package/dist/src/dataflow/types.js.map +1 -0
- package/dist/src/dataflow.d.ts +142 -9
- package/dist/src/dataflow.d.ts.map +1 -1
- package/dist/src/dataflow.js +427 -64
- package/dist/src/dataflow.js.map +1 -1
- package/dist/src/errors.d.ts +39 -9
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +51 -8
- package/dist/src/errors.js.map +1 -1
- package/dist/src/execution/LocalTaskRunner.d.ts +73 -0
- package/dist/src/execution/LocalTaskRunner.d.ts.map +1 -0
- package/dist/src/execution/LocalTaskRunner.js +399 -0
- package/dist/src/execution/LocalTaskRunner.js.map +1 -0
- package/dist/src/execution/MockTaskRunner.d.ts +49 -0
- package/dist/src/execution/MockTaskRunner.d.ts.map +1 -0
- package/dist/src/execution/MockTaskRunner.js +55 -0
- package/dist/src/execution/MockTaskRunner.js.map +1 -0
- package/dist/src/execution/index.d.ts +16 -0
- package/dist/src/execution/index.d.ts.map +1 -0
- package/dist/src/execution/index.js +8 -0
- package/dist/src/execution/index.js.map +1 -0
- package/dist/src/execution/interfaces.d.ts +246 -0
- package/dist/src/execution/interfaces.d.ts.map +1 -0
- package/dist/src/execution/interfaces.js +6 -0
- package/dist/src/execution/interfaces.js.map +1 -0
- package/dist/src/execution/processHelpers.d.ts +20 -0
- package/dist/src/execution/processHelpers.d.ts.map +1 -0
- package/dist/src/execution/processHelpers.js +62 -0
- package/dist/src/execution/processHelpers.js.map +1 -0
- package/dist/src/executions.d.ts +71 -104
- package/dist/src/executions.d.ts.map +1 -1
- package/dist/src/executions.js +110 -476
- package/dist/src/executions.js.map +1 -1
- package/dist/src/index.d.ts +17 -9
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +44 -18
- package/dist/src/index.js.map +1 -1
- package/dist/src/objects.d.ts +6 -53
- package/dist/src/objects.d.ts.map +1 -1
- package/dist/src/objects.js +11 -232
- package/dist/src/objects.js.map +1 -1
- package/dist/src/packages.d.ts +22 -14
- package/dist/src/packages.d.ts.map +1 -1
- package/dist/src/packages.js +116 -83
- package/dist/src/packages.js.map +1 -1
- package/dist/src/storage/in-memory/InMemoryRepoStore.d.ts +35 -0
- package/dist/src/storage/in-memory/InMemoryRepoStore.d.ts.map +1 -0
- package/dist/src/storage/in-memory/InMemoryRepoStore.js +107 -0
- package/dist/src/storage/in-memory/InMemoryRepoStore.js.map +1 -0
- package/dist/src/storage/in-memory/InMemoryStorage.d.ts +114 -0
- package/dist/src/storage/in-memory/InMemoryStorage.d.ts.map +1 -0
- package/dist/src/storage/in-memory/InMemoryStorage.js +349 -0
- package/dist/src/storage/in-memory/InMemoryStorage.js.map +1 -0
- package/dist/src/storage/in-memory/index.d.ts +12 -0
- package/dist/src/storage/in-memory/index.d.ts.map +1 -0
- package/dist/src/storage/in-memory/index.js +12 -0
- package/dist/src/storage/in-memory/index.js.map +1 -0
- package/dist/src/storage/index.d.ts +18 -0
- package/dist/src/storage/index.d.ts.map +1 -0
- package/dist/src/storage/index.js +10 -0
- package/dist/src/storage/index.js.map +1 -0
- package/dist/src/storage/interfaces.d.ts +520 -0
- package/dist/src/storage/interfaces.d.ts.map +1 -0
- package/dist/src/storage/interfaces.js +6 -0
- package/dist/src/storage/interfaces.js.map +1 -0
- package/dist/src/storage/local/LocalBackend.d.ts +54 -0
- package/dist/src/storage/local/LocalBackend.d.ts.map +1 -0
- package/dist/src/storage/local/LocalBackend.js +141 -0
- package/dist/src/storage/local/LocalBackend.js.map +1 -0
- package/dist/src/storage/local/LocalLockService.d.ts +105 -0
- package/dist/src/storage/local/LocalLockService.d.ts.map +1 -0
- package/dist/src/storage/local/LocalLockService.js +342 -0
- package/dist/src/storage/local/LocalLockService.js.map +1 -0
- package/dist/src/storage/local/LocalLogStore.d.ts +23 -0
- package/dist/src/storage/local/LocalLogStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalLogStore.js +66 -0
- package/dist/src/storage/local/LocalLogStore.js.map +1 -0
- package/dist/src/storage/local/LocalObjectStore.d.ts +52 -0
- package/dist/src/storage/local/LocalObjectStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalObjectStore.js +287 -0
- package/dist/src/storage/local/LocalObjectStore.js.map +1 -0
- package/dist/src/storage/local/LocalRefStore.d.ts +50 -0
- package/dist/src/storage/local/LocalRefStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalRefStore.js +337 -0
- package/dist/src/storage/local/LocalRefStore.js.map +1 -0
- package/dist/src/storage/local/LocalRepoStore.d.ts +53 -0
- package/dist/src/storage/local/LocalRepoStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalRepoStore.js +353 -0
- package/dist/src/storage/local/LocalRepoStore.js.map +1 -0
- package/dist/src/storage/local/gc.d.ts +92 -0
- package/dist/src/storage/local/gc.d.ts.map +1 -0
- package/dist/src/storage/local/gc.js +322 -0
- package/dist/src/storage/local/gc.js.map +1 -0
- package/dist/src/storage/local/index.d.ts +17 -0
- package/dist/src/storage/local/index.d.ts.map +1 -0
- package/dist/src/storage/local/index.js +17 -0
- package/dist/src/storage/local/index.js.map +1 -0
- package/dist/src/storage/local/localHelpers.d.ts +25 -0
- package/dist/src/storage/local/localHelpers.d.ts.map +1 -0
- package/dist/src/storage/local/localHelpers.js +69 -0
- package/dist/src/storage/local/localHelpers.js.map +1 -0
- package/dist/src/{repository.d.ts → storage/local/repository.d.ts} +8 -4
- package/dist/src/storage/local/repository.d.ts.map +1 -0
- package/dist/src/{repository.js → storage/local/repository.js} +31 -29
- package/dist/src/storage/local/repository.js.map +1 -0
- package/dist/src/tasks.d.ts +16 -10
- package/dist/src/tasks.d.ts.map +1 -1
- package/dist/src/tasks.js +35 -41
- package/dist/src/tasks.js.map +1 -1
- package/dist/src/test-helpers.d.ts +4 -4
- package/dist/src/test-helpers.d.ts.map +1 -1
- package/dist/src/test-helpers.js +7 -21
- package/dist/src/test-helpers.js.map +1 -1
- package/dist/src/trees.d.ts +89 -27
- package/dist/src/trees.d.ts.map +1 -1
- package/dist/src/trees.js +218 -100
- package/dist/src/trees.js.map +1 -1
- package/dist/src/uuid.d.ts +26 -0
- package/dist/src/uuid.d.ts.map +1 -0
- package/dist/src/uuid.js +80 -0
- package/dist/src/uuid.js.map +1 -0
- package/dist/src/workspaceStatus.d.ts +6 -4
- package/dist/src/workspaceStatus.d.ts.map +1 -1
- package/dist/src/workspaceStatus.js +43 -49
- package/dist/src/workspaceStatus.js.map +1 -1
- package/dist/src/workspaces.d.ts +35 -26
- package/dist/src/workspaces.d.ts.map +1 -1
- package/dist/src/workspaces.js +169 -118
- package/dist/src/workspaces.js.map +1 -1
- package/package.json +4 -4
- package/dist/src/gc.d.ts +0 -54
- package/dist/src/gc.d.ts.map +0 -1
- package/dist/src/gc.js +0 -233
- package/dist/src/gc.js.map +0 -1
- package/dist/src/repository.d.ts.map +0 -1
- package/dist/src/repository.js.map +0 -1
- package/dist/src/workspaceLock.d.ts +0 -67
- package/dist/src/workspaceLock.d.ts.map +0 -1
- package/dist/src/workspaceLock.js +0 -217
- package/dist/src/workspaceLock.js.map +0 -1
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Step functions for resumable dataflow execution.
|
|
7
|
+
*
|
|
8
|
+
* Each step function represents a single unit of work that can be:
|
|
9
|
+
* - Called locally in a loop (LocalOrchestrator)
|
|
10
|
+
* - Invoked as a Lambda handler (Step Functions orchestration)
|
|
11
|
+
*
|
|
12
|
+
* Step functions are designed to be:
|
|
13
|
+
* - Small and focused (one step = one Lambda invocation)
|
|
14
|
+
* - Deterministic where possible (pure functions marked as such)
|
|
15
|
+
* - Idempotent for retries
|
|
16
|
+
*/
|
|
17
|
+
import { variant, some, none } from '@elaraai/east';
|
|
18
|
+
import { dataflowGetGraph, dataflowGetReadyTasks, dataflowGetDependentsToSkip, dataflowResolveInputHashes, dataflowCheckCache, } from '../dataflow.js';
|
|
19
|
+
import { workspaceGetDatasetHash, workspaceSetDatasetByHash, } from '../trees.js';
|
|
20
|
+
/**
|
|
21
|
+
* Initialize a new dataflow execution.
|
|
22
|
+
*
|
|
23
|
+
* Builds the dependency graph and creates the initial execution state.
|
|
24
|
+
* This is an async operation because it reads workspace and package state.
|
|
25
|
+
*
|
|
26
|
+
* @param storage - Storage backend
|
|
27
|
+
* @param repo - Repository identifier
|
|
28
|
+
* @param workspace - Workspace name
|
|
29
|
+
* @param executionId - Unique execution ID
|
|
30
|
+
* @param options - Execution options
|
|
31
|
+
* @returns Initial state and ready tasks
|
|
32
|
+
*
|
|
33
|
+
* @throws {WorkspaceNotFoundError} If workspace doesn't exist
|
|
34
|
+
* @throws {WorkspaceNotDeployedError} If workspace has no package deployed
|
|
35
|
+
* @throws {TaskNotFoundError} If filter specifies a task that doesn't exist
|
|
36
|
+
*/
|
|
37
|
+
export async function stepInitialize(storage, repo, workspace, executionId, options = {}) {
|
|
38
|
+
const concurrency = options.concurrency ?? 4;
|
|
39
|
+
const force = options.force ?? false;
|
|
40
|
+
const filter = options.filter ?? null;
|
|
41
|
+
// Build the dependency graph
|
|
42
|
+
const graph = await dataflowGetGraph(storage, repo, workspace);
|
|
43
|
+
// Validate filter
|
|
44
|
+
if (filter !== null) {
|
|
45
|
+
const taskExists = graph.tasks.some(t => t.name === filter);
|
|
46
|
+
if (!taskExists) {
|
|
47
|
+
// Import here to avoid circular dependency
|
|
48
|
+
const { TaskNotFoundError } = await import('../errors.js');
|
|
49
|
+
throw new TaskNotFoundError(filter);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Initialize task states
|
|
53
|
+
const tasks = new Map();
|
|
54
|
+
for (const task of graph.tasks) {
|
|
55
|
+
tasks.set(task.name, {
|
|
56
|
+
name: task.name,
|
|
57
|
+
status: 'pending',
|
|
58
|
+
cached: none,
|
|
59
|
+
outputHash: none,
|
|
60
|
+
error: none,
|
|
61
|
+
exitCode: none,
|
|
62
|
+
startedAt: none,
|
|
63
|
+
completedAt: none,
|
|
64
|
+
duration: none,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
// Create initial state
|
|
68
|
+
const state = {
|
|
69
|
+
id: executionId,
|
|
70
|
+
repo,
|
|
71
|
+
workspace,
|
|
72
|
+
startedAt: new Date(),
|
|
73
|
+
concurrency: BigInt(concurrency),
|
|
74
|
+
force,
|
|
75
|
+
filter: filter !== null ? some(filter) : none,
|
|
76
|
+
graph: some(graph),
|
|
77
|
+
graphHash: none,
|
|
78
|
+
tasks,
|
|
79
|
+
executed: 0n,
|
|
80
|
+
cached: 0n,
|
|
81
|
+
failed: 0n,
|
|
82
|
+
skipped: 0n,
|
|
83
|
+
status: 'running',
|
|
84
|
+
completedAt: none,
|
|
85
|
+
error: none,
|
|
86
|
+
events: [],
|
|
87
|
+
eventSeq: 0n,
|
|
88
|
+
};
|
|
89
|
+
// Find initially ready tasks
|
|
90
|
+
const readyTasks = stepGetReady(state);
|
|
91
|
+
// Update task states to 'ready' (cast to mutable)
|
|
92
|
+
for (const taskName of readyTasks) {
|
|
93
|
+
const taskState = tasks.get(taskName);
|
|
94
|
+
if (taskState) {
|
|
95
|
+
taskState.status = 'ready';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { state, readyTasks };
|
|
99
|
+
}
|
|
100
|
+
// =============================================================================
|
|
101
|
+
// Helper Functions
|
|
102
|
+
// =============================================================================
|
|
103
|
+
/**
|
|
104
|
+
* Get the graph from state, throwing if not available.
|
|
105
|
+
*
|
|
106
|
+
* For cloud execution, the graph may be stored separately and loaded
|
|
107
|
+
* via graphHash. This helper ensures the graph is present before use.
|
|
108
|
+
*/
|
|
109
|
+
function getGraph(state) {
|
|
110
|
+
if (state.graph.type !== 'some') {
|
|
111
|
+
throw new Error('Execution state has no graph. For cloud execution, load the graph using graphHash before calling step functions.');
|
|
112
|
+
}
|
|
113
|
+
return state.graph.value;
|
|
114
|
+
}
|
|
115
|
+
// =============================================================================
|
|
116
|
+
// Pure Step Functions
|
|
117
|
+
// =============================================================================
|
|
118
|
+
/**
|
|
119
|
+
* Get tasks that are ready to execute.
|
|
120
|
+
*
|
|
121
|
+
* A task is ready when:
|
|
122
|
+
* 1. All tasks it depends on have completed (not just started)
|
|
123
|
+
* 2. It passes the filter (if any)
|
|
124
|
+
* 3. It is not already completed, in-progress, failed, or skipped
|
|
125
|
+
*
|
|
126
|
+
* This is a pure function - it only reads state.
|
|
127
|
+
*
|
|
128
|
+
* @param state - Current execution state
|
|
129
|
+
* @returns Array of task names that are ready to execute
|
|
130
|
+
*/
|
|
131
|
+
export function stepGetReady(state) {
|
|
132
|
+
const completedTasks = new Set();
|
|
133
|
+
for (const [name, taskState] of state.tasks) {
|
|
134
|
+
if (taskState.status === 'completed') {
|
|
135
|
+
completedTasks.add(name);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Get ready tasks from graph
|
|
139
|
+
const graphReady = dataflowGetReadyTasks(getGraph(state), completedTasks);
|
|
140
|
+
// Get filter value (handle Option type)
|
|
141
|
+
const filterValue = state.filter.type === 'some' ? state.filter.value : null;
|
|
142
|
+
// Filter by state and filter option
|
|
143
|
+
return graphReady.filter(taskName => {
|
|
144
|
+
const taskState = state.tasks.get(taskName);
|
|
145
|
+
if (!taskState)
|
|
146
|
+
return false;
|
|
147
|
+
// Skip tasks that are already being processed
|
|
148
|
+
if (taskState.status !== 'pending' && taskState.status !== 'ready') {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
// Apply task filter
|
|
152
|
+
if (filterValue !== null && taskName !== filterValue) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
return true;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Check if the execution is complete.
|
|
160
|
+
*
|
|
161
|
+
* An execution is complete when:
|
|
162
|
+
* - All tasks are in a terminal state (completed, failed, skipped)
|
|
163
|
+
* - Or there are no more ready tasks and no tasks in progress
|
|
164
|
+
*
|
|
165
|
+
* This is a pure function - it only reads state.
|
|
166
|
+
*
|
|
167
|
+
* @param state - Current execution state
|
|
168
|
+
* @returns True if execution is complete
|
|
169
|
+
*/
|
|
170
|
+
export function stepIsComplete(state) {
|
|
171
|
+
const filterValue = state.filter.type === 'some' ? state.filter.value : null;
|
|
172
|
+
for (const taskState of state.tasks.values()) {
|
|
173
|
+
// Check if any task is still in a non-terminal state
|
|
174
|
+
if (taskState.status === 'pending' ||
|
|
175
|
+
taskState.status === 'ready' ||
|
|
176
|
+
taskState.status === 'in_progress') {
|
|
177
|
+
// If in progress, not complete
|
|
178
|
+
if (taskState.status === 'in_progress') {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
// If pending or ready, check if it can ever become ready
|
|
182
|
+
// A task is stuck if it has unmet dependencies that failed/skipped
|
|
183
|
+
const task = getGraph(state).tasks.find(t => t.name === taskState.name);
|
|
184
|
+
if (task) {
|
|
185
|
+
const hasUnmetDeps = task.dependsOn.some(dep => {
|
|
186
|
+
const depState = state.tasks.get(dep);
|
|
187
|
+
return depState && (depState.status === 'failed' || depState.status === 'skipped');
|
|
188
|
+
});
|
|
189
|
+
// If it's stuck due to failed deps, it should have been skipped
|
|
190
|
+
// If not stuck, we're not complete
|
|
191
|
+
if (!hasUnmetDeps) {
|
|
192
|
+
// Check if it passes the filter
|
|
193
|
+
if (filterValue !== null && taskState.name !== filterValue) {
|
|
194
|
+
continue; // Filtered out, doesn't affect completion
|
|
195
|
+
}
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
// =============================================================================
|
|
204
|
+
// Async Step Functions (I/O operations)
|
|
205
|
+
// =============================================================================
|
|
206
|
+
/**
|
|
207
|
+
* Prepare a task for execution by resolving inputs and checking cache.
|
|
208
|
+
*
|
|
209
|
+
* This async operation:
|
|
210
|
+
* 1. Resolves input hashes from current workspace state
|
|
211
|
+
* 2. Checks if there's a valid cached execution
|
|
212
|
+
*
|
|
213
|
+
* @param storage - Storage backend
|
|
214
|
+
* @param state - Current execution state
|
|
215
|
+
* @param taskName - Name of the task to prepare
|
|
216
|
+
* @returns Preparation result with input hashes and cache status
|
|
217
|
+
*/
|
|
218
|
+
export async function stepPrepareTask(storage, state, taskName) {
|
|
219
|
+
const graph = getGraph(state);
|
|
220
|
+
const task = graph.tasks.find(t => t.name === taskName);
|
|
221
|
+
if (!task) {
|
|
222
|
+
throw new Error(`Task '${taskName}' not found in graph`);
|
|
223
|
+
}
|
|
224
|
+
// Resolve input hashes
|
|
225
|
+
const inputHashes = await dataflowResolveInputHashes(storage, state.repo, state.workspace, task);
|
|
226
|
+
// Check for null inputs (unassigned)
|
|
227
|
+
const validInputHashes = [];
|
|
228
|
+
for (const hash of inputHashes) {
|
|
229
|
+
if (hash === null) {
|
|
230
|
+
throw new Error(`Task '${taskName}' has unassigned input`);
|
|
231
|
+
}
|
|
232
|
+
validInputHashes.push(hash);
|
|
233
|
+
}
|
|
234
|
+
// Check cache if not forcing re-execution
|
|
235
|
+
let cachedOutputHash = null;
|
|
236
|
+
if (!state.force) {
|
|
237
|
+
cachedOutputHash = await dataflowCheckCache(storage, state.repo, task.hash, validInputHashes);
|
|
238
|
+
// Also verify the workspace output matches the cached output
|
|
239
|
+
if (cachedOutputHash !== null) {
|
|
240
|
+
const { parsePathString } = await import('../dataflow.js');
|
|
241
|
+
const outputPath = parsePathString(task.output);
|
|
242
|
+
const { refType, hash: wsOutputHash } = await workspaceGetDatasetHash(storage, state.repo, state.workspace, outputPath);
|
|
243
|
+
if (refType !== 'value' || wsOutputHash !== cachedOutputHash) {
|
|
244
|
+
// Workspace output doesn't match cached output, need to re-execute
|
|
245
|
+
cachedOutputHash = null;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
task: taskName,
|
|
251
|
+
taskHash: task.hash,
|
|
252
|
+
inputHashes: validInputHashes,
|
|
253
|
+
outputPath: task.output,
|
|
254
|
+
cachedOutputHash,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
// =============================================================================
|
|
258
|
+
// State Mutation Step Functions
|
|
259
|
+
// =============================================================================
|
|
260
|
+
/**
|
|
261
|
+
* Mark a task as started (in-progress).
|
|
262
|
+
*
|
|
263
|
+
* Mutates the execution state to record that a task has begun execution.
|
|
264
|
+
*
|
|
265
|
+
* @param state - Execution state to mutate
|
|
266
|
+
* @param taskName - Name of the task
|
|
267
|
+
* @returns Event to record
|
|
268
|
+
*/
|
|
269
|
+
export function stepTaskStarted(state, taskName) {
|
|
270
|
+
const taskState = state.tasks.get(taskName);
|
|
271
|
+
if (!taskState) {
|
|
272
|
+
throw new Error(`Task '${taskName}' not found in state`);
|
|
273
|
+
}
|
|
274
|
+
const now = new Date();
|
|
275
|
+
taskState.status = 'in_progress';
|
|
276
|
+
taskState.startedAt = some(now);
|
|
277
|
+
const mutableState = state;
|
|
278
|
+
mutableState.eventSeq = state.eventSeq + 1n;
|
|
279
|
+
const event = variant('task_started', {
|
|
280
|
+
seq: mutableState.eventSeq,
|
|
281
|
+
timestamp: now,
|
|
282
|
+
task: taskName,
|
|
283
|
+
});
|
|
284
|
+
mutableState.events.push(event);
|
|
285
|
+
return event;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Mark a task as completed successfully.
|
|
289
|
+
*
|
|
290
|
+
* Mutates the execution state and returns the newly ready tasks.
|
|
291
|
+
*
|
|
292
|
+
* @param state - Execution state to mutate
|
|
293
|
+
* @param taskName - Name of the task
|
|
294
|
+
* @param outputHash - Hash of the output dataset
|
|
295
|
+
* @param cached - Whether the result was from cache
|
|
296
|
+
* @param duration - Execution duration in milliseconds
|
|
297
|
+
* @returns Result with newly ready tasks and event
|
|
298
|
+
*/
|
|
299
|
+
export function stepTaskCompleted(state, taskName, outputHash, cached, duration) {
|
|
300
|
+
const taskState = state.tasks.get(taskName);
|
|
301
|
+
if (!taskState) {
|
|
302
|
+
throw new Error(`Task '${taskName}' not found in state`);
|
|
303
|
+
}
|
|
304
|
+
const now = new Date();
|
|
305
|
+
const mutableState = state;
|
|
306
|
+
taskState.status = 'completed';
|
|
307
|
+
taskState.cached = some(cached);
|
|
308
|
+
taskState.outputHash = some(outputHash);
|
|
309
|
+
taskState.completedAt = some(now);
|
|
310
|
+
taskState.duration = some(BigInt(duration));
|
|
311
|
+
// Update counters
|
|
312
|
+
if (cached) {
|
|
313
|
+
mutableState.cached = state.cached + 1n;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
mutableState.executed = state.executed + 1n;
|
|
317
|
+
}
|
|
318
|
+
// Find newly ready tasks
|
|
319
|
+
const newlyReady = stepGetReady(state);
|
|
320
|
+
for (const name of newlyReady) {
|
|
321
|
+
const ts = state.tasks.get(name);
|
|
322
|
+
if (ts && ts.status === 'pending') {
|
|
323
|
+
ts.status = 'ready';
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
mutableState.eventSeq = state.eventSeq + 1n;
|
|
327
|
+
const event = variant('task_completed', {
|
|
328
|
+
seq: mutableState.eventSeq,
|
|
329
|
+
timestamp: now,
|
|
330
|
+
task: taskName,
|
|
331
|
+
cached,
|
|
332
|
+
outputHash,
|
|
333
|
+
duration: BigInt(duration),
|
|
334
|
+
});
|
|
335
|
+
mutableState.events.push(event);
|
|
336
|
+
return { result: { newlyReady }, event };
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Mark a task as failed.
|
|
340
|
+
*
|
|
341
|
+
* Mutates the execution state and returns tasks that should be skipped.
|
|
342
|
+
*
|
|
343
|
+
* @param state - Execution state to mutate
|
|
344
|
+
* @param taskName - Name of the failed task
|
|
345
|
+
* @param error - Error message (optional)
|
|
346
|
+
* @param exitCode - Exit code if process failed (optional)
|
|
347
|
+
* @param duration - Execution duration in milliseconds
|
|
348
|
+
* @returns Result with tasks to skip and event
|
|
349
|
+
*/
|
|
350
|
+
export function stepTaskFailed(state, taskName, error, exitCode, duration) {
|
|
351
|
+
const taskState = state.tasks.get(taskName);
|
|
352
|
+
if (!taskState) {
|
|
353
|
+
throw new Error(`Task '${taskName}' not found in state`);
|
|
354
|
+
}
|
|
355
|
+
const now = new Date();
|
|
356
|
+
const mutableState = state;
|
|
357
|
+
taskState.status = 'failed';
|
|
358
|
+
taskState.error = error !== undefined ? some(error) : none;
|
|
359
|
+
taskState.exitCode = exitCode !== undefined ? some(BigInt(exitCode)) : none;
|
|
360
|
+
taskState.completedAt = some(now);
|
|
361
|
+
taskState.duration = some(BigInt(duration));
|
|
362
|
+
// Update counters
|
|
363
|
+
mutableState.failed = state.failed + 1n;
|
|
364
|
+
// Get filter value (handle Option type)
|
|
365
|
+
const filterValue = state.filter.type === 'some' ? state.filter.value : null;
|
|
366
|
+
// Find tasks to skip (transitive dependents)
|
|
367
|
+
const completedSet = new Set();
|
|
368
|
+
const skippedSet = new Set();
|
|
369
|
+
for (const [name, ts] of state.tasks) {
|
|
370
|
+
if (ts.status === 'completed')
|
|
371
|
+
completedSet.add(name);
|
|
372
|
+
if (ts.status === 'skipped')
|
|
373
|
+
skippedSet.add(name);
|
|
374
|
+
}
|
|
375
|
+
const toSkip = dataflowGetDependentsToSkip(getGraph(state), taskName, completedSet, skippedSet).filter(name => {
|
|
376
|
+
// Also exclude in-progress tasks and apply filter
|
|
377
|
+
const ts = state.tasks.get(name);
|
|
378
|
+
if (!ts || ts.status === 'in_progress')
|
|
379
|
+
return false;
|
|
380
|
+
if (filterValue !== null && name !== filterValue)
|
|
381
|
+
return false;
|
|
382
|
+
return true;
|
|
383
|
+
});
|
|
384
|
+
mutableState.eventSeq = state.eventSeq + 1n;
|
|
385
|
+
const event = variant('task_failed', {
|
|
386
|
+
seq: mutableState.eventSeq,
|
|
387
|
+
timestamp: now,
|
|
388
|
+
task: taskName,
|
|
389
|
+
error: error !== undefined ? some(error) : none,
|
|
390
|
+
exitCode: exitCode !== undefined ? some(BigInt(exitCode)) : none,
|
|
391
|
+
duration: BigInt(duration),
|
|
392
|
+
});
|
|
393
|
+
mutableState.events.push(event);
|
|
394
|
+
return { result: { toSkip }, event };
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Mark tasks as skipped due to upstream failure.
|
|
398
|
+
*
|
|
399
|
+
* @param state - Execution state to mutate
|
|
400
|
+
* @param taskNames - Names of tasks to skip
|
|
401
|
+
* @param cause - Name of the task that caused the skip
|
|
402
|
+
* @returns Array of events to record
|
|
403
|
+
*/
|
|
404
|
+
export function stepTasksSkipped(state, taskNames, cause) {
|
|
405
|
+
const events = [];
|
|
406
|
+
const now = new Date();
|
|
407
|
+
const mutableState = state;
|
|
408
|
+
for (const taskName of taskNames) {
|
|
409
|
+
const taskState = state.tasks.get(taskName);
|
|
410
|
+
if (!taskState)
|
|
411
|
+
continue;
|
|
412
|
+
taskState.status = 'skipped';
|
|
413
|
+
taskState.completedAt = some(now);
|
|
414
|
+
taskState.duration = some(0n);
|
|
415
|
+
mutableState.skipped = mutableState.skipped + 1n;
|
|
416
|
+
mutableState.eventSeq = mutableState.eventSeq + 1n;
|
|
417
|
+
const event = variant('task_skipped', {
|
|
418
|
+
seq: mutableState.eventSeq,
|
|
419
|
+
timestamp: now,
|
|
420
|
+
task: taskName,
|
|
421
|
+
cause,
|
|
422
|
+
});
|
|
423
|
+
mutableState.events.push(event);
|
|
424
|
+
events.push(event);
|
|
425
|
+
}
|
|
426
|
+
return events;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Finalize the execution and return the result.
|
|
430
|
+
*
|
|
431
|
+
* Mutates the execution state to mark it as completed or failed.
|
|
432
|
+
*
|
|
433
|
+
* @param state - Execution state to mutate
|
|
434
|
+
* @returns Final result
|
|
435
|
+
*/
|
|
436
|
+
export function stepFinalize(state) {
|
|
437
|
+
const now = new Date();
|
|
438
|
+
const startTime = state.startedAt.getTime();
|
|
439
|
+
const duration = Date.now() - startTime;
|
|
440
|
+
const mutableState = state;
|
|
441
|
+
// Determine success
|
|
442
|
+
const success = state.failed === 0n;
|
|
443
|
+
// Update state
|
|
444
|
+
mutableState.status = success ? 'completed' : 'failed';
|
|
445
|
+
mutableState.completedAt = some(now);
|
|
446
|
+
mutableState.eventSeq = state.eventSeq + 1n;
|
|
447
|
+
const event = variant('execution_completed', {
|
|
448
|
+
seq: mutableState.eventSeq,
|
|
449
|
+
timestamp: now,
|
|
450
|
+
success,
|
|
451
|
+
executed: state.executed,
|
|
452
|
+
cached: state.cached,
|
|
453
|
+
failed: state.failed,
|
|
454
|
+
skipped: state.skipped,
|
|
455
|
+
duration: BigInt(duration),
|
|
456
|
+
});
|
|
457
|
+
mutableState.events.push(event);
|
|
458
|
+
const result = {
|
|
459
|
+
success,
|
|
460
|
+
executed: Number(state.executed),
|
|
461
|
+
cached: Number(state.cached),
|
|
462
|
+
failed: Number(state.failed),
|
|
463
|
+
skipped: Number(state.skipped),
|
|
464
|
+
duration,
|
|
465
|
+
};
|
|
466
|
+
return { result, event };
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Cancel the execution.
|
|
470
|
+
*
|
|
471
|
+
* @param state - Execution state to mutate
|
|
472
|
+
* @param reason - Reason for cancellation
|
|
473
|
+
* @returns Event to record
|
|
474
|
+
*/
|
|
475
|
+
export function stepCancel(state, reason) {
|
|
476
|
+
const now = new Date();
|
|
477
|
+
const mutableState = state;
|
|
478
|
+
mutableState.status = 'cancelled';
|
|
479
|
+
mutableState.completedAt = some(now);
|
|
480
|
+
mutableState.error = some(reason ?? 'Execution was cancelled');
|
|
481
|
+
mutableState.eventSeq = state.eventSeq + 1n;
|
|
482
|
+
const event = variant('execution_cancelled', {
|
|
483
|
+
seq: mutableState.eventSeq,
|
|
484
|
+
timestamp: now,
|
|
485
|
+
reason: reason !== undefined ? some(reason) : none,
|
|
486
|
+
});
|
|
487
|
+
mutableState.events.push(event);
|
|
488
|
+
return event;
|
|
489
|
+
}
|
|
490
|
+
// =============================================================================
|
|
491
|
+
// Tree Update Step Function
|
|
492
|
+
// =============================================================================
|
|
493
|
+
/**
|
|
494
|
+
* Apply a task's output to the workspace tree.
|
|
495
|
+
*
|
|
496
|
+
* This step function handles workspace tree updates, which must be serialized
|
|
497
|
+
* to prevent lost-update race conditions when multiple tasks complete
|
|
498
|
+
* concurrently.
|
|
499
|
+
*
|
|
500
|
+
* For local execution, the LocalOrchestrator handles this internally with
|
|
501
|
+
* an AsyncMutex. For cloud execution (e.g., AWS Step Functions), this should
|
|
502
|
+
* be called in a dedicated "ApplyTreeUpdates" state that processes updates
|
|
503
|
+
* serially.
|
|
504
|
+
*
|
|
505
|
+
* @param storage - Storage backend
|
|
506
|
+
* @param repo - Repository identifier
|
|
507
|
+
* @param workspace - Workspace name
|
|
508
|
+
* @param outputPathStr - Output path as a keypath string (e.g., ".results.data")
|
|
509
|
+
* @param outputHash - Hash of the output dataset to write
|
|
510
|
+
* @returns Result with the new workspace root hash
|
|
511
|
+
*
|
|
512
|
+
* @remarks
|
|
513
|
+
* Tree updates must be serialized to prevent race conditions:
|
|
514
|
+
* - Two tasks complete concurrently, both read the same workspace root
|
|
515
|
+
* - Both compute new roots with their outputs
|
|
516
|
+
* - One write overwrites the other, losing the first task's output
|
|
517
|
+
*
|
|
518
|
+
* Cloud implementations should use a dedicated serialization mechanism
|
|
519
|
+
* (e.g., a single Lambda invocation per update, or DynamoDB transactions).
|
|
520
|
+
*/
|
|
521
|
+
export async function stepApplyTreeUpdate(storage, repo, workspace, outputPathStr, outputHash) {
|
|
522
|
+
const { parsePathString } = await import('../dataflow.js');
|
|
523
|
+
const outputPath = parsePathString(outputPathStr);
|
|
524
|
+
// Write the output to the workspace tree
|
|
525
|
+
const newRootHash = await workspaceSetDatasetByHash(storage, repo, workspace, outputPath, outputHash);
|
|
526
|
+
return { newRootHash };
|
|
527
|
+
}
|
|
528
|
+
//# sourceMappingURL=steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../../src/dataflow/steps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAiCrB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAuB,EACvB,IAAY,EACZ,SAAiB,EACjB,WAAmB,EACnB,UAAiC,EAAE;IAEnC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;IACrC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC;IAEtC,6BAA6B;IAC7B,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,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,MAAM,yBAAyB,CACjD,OAAO,EACP,IAAI,EACJ,SAAS,EACT,UAAU,EACV,UAAU,CACX,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Resumable dataflow execution types.
|
|
7
|
+
*
|
|
8
|
+
* These types support both local and cloud execution by separating
|
|
9
|
+
* execution state from orchestration. The state can be persisted to
|
|
10
|
+
* a file (local) or DynamoDB (cloud) and resumed after interruption.
|
|
11
|
+
*
|
|
12
|
+
* Types are derived from EastType definitions in @elaraai/e3-types using
|
|
13
|
+
* ValueTypeOf for proper branded variant/option support.
|
|
14
|
+
*/
|
|
15
|
+
import { type ValueTypeOf } from '@elaraai/east';
|
|
16
|
+
import { TaskStateType, DataflowGraphTaskType, DataflowGraphType, ExecutionEventType, DataflowExecutionStateType } from '@elaraai/e3-types';
|
|
17
|
+
export { TaskStateType, DataflowGraphTaskType, DataflowGraphType, ExecutionEventType, DataflowExecutionStateType, } from '@elaraai/e3-types';
|
|
18
|
+
export type { DataflowExecutionStatus, TaskStatus } from '@elaraai/e3-types';
|
|
19
|
+
/**
|
|
20
|
+
* Task state information.
|
|
21
|
+
*/
|
|
22
|
+
export type TaskState = ValueTypeOf<typeof TaskStateType>;
|
|
23
|
+
/**
|
|
24
|
+
* Task in the dataflow graph.
|
|
25
|
+
*/
|
|
26
|
+
export type DataflowGraphTask = ValueTypeOf<typeof DataflowGraphTaskType>;
|
|
27
|
+
/**
|
|
28
|
+
* Dataflow dependency graph.
|
|
29
|
+
*/
|
|
30
|
+
export type DataflowGraph = ValueTypeOf<typeof DataflowGraphType>;
|
|
31
|
+
/**
|
|
32
|
+
* Execution event (discriminated union via VariantType).
|
|
33
|
+
*/
|
|
34
|
+
export type ExecutionEvent = ValueTypeOf<typeof ExecutionEventType>;
|
|
35
|
+
/**
|
|
36
|
+
* Dataflow execution state.
|
|
37
|
+
*/
|
|
38
|
+
export type DataflowExecutionState = ValueTypeOf<typeof DataflowExecutionStateType>;
|
|
39
|
+
/**
|
|
40
|
+
* Result of stepInitialize.
|
|
41
|
+
*/
|
|
42
|
+
export interface InitializeResult {
|
|
43
|
+
/** The initialized execution state */
|
|
44
|
+
state: DataflowExecutionState;
|
|
45
|
+
/** Tasks that are immediately ready (no dependencies) */
|
|
46
|
+
readyTasks: string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Result of stepPrepareTask - information needed to execute a task.
|
|
50
|
+
*/
|
|
51
|
+
export interface PrepareTaskResult {
|
|
52
|
+
/** Task name */
|
|
53
|
+
task: string;
|
|
54
|
+
/** Task object hash */
|
|
55
|
+
taskHash: string;
|
|
56
|
+
/** Input dataset hashes (in order) */
|
|
57
|
+
inputHashes: string[];
|
|
58
|
+
/** Output path string */
|
|
59
|
+
outputPath: string;
|
|
60
|
+
/** Cached output hash if available (skip execution) */
|
|
61
|
+
cachedOutputHash: string | null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Result of a task execution (returned by TaskRunner).
|
|
65
|
+
*/
|
|
66
|
+
export interface TaskExecuteResult {
|
|
67
|
+
/** Final state */
|
|
68
|
+
state: 'success' | 'failed' | 'error';
|
|
69
|
+
/** Whether the result was served from cache */
|
|
70
|
+
cached: boolean;
|
|
71
|
+
/** Output hash (if state is 'success') */
|
|
72
|
+
outputHash?: string;
|
|
73
|
+
/** Exit code (if state is 'failed') */
|
|
74
|
+
exitCode?: number;
|
|
75
|
+
/** Error message (if state is 'error') */
|
|
76
|
+
error?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Result of stepTaskCompleted.
|
|
80
|
+
*/
|
|
81
|
+
export interface TaskCompletedResult {
|
|
82
|
+
/** Tasks that became ready after this completion */
|
|
83
|
+
newlyReady: string[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Result of stepTaskFailed.
|
|
87
|
+
*/
|
|
88
|
+
export interface TaskFailedResult {
|
|
89
|
+
/** Tasks that should be skipped due to this failure */
|
|
90
|
+
toSkip: string[];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Result of stepFinalize.
|
|
94
|
+
*/
|
|
95
|
+
export interface FinalizeResult {
|
|
96
|
+
/** Overall success - true if all tasks completed successfully */
|
|
97
|
+
success: boolean;
|
|
98
|
+
/** Number of tasks executed (not from cache) */
|
|
99
|
+
executed: number;
|
|
100
|
+
/** Number of tasks served from cache */
|
|
101
|
+
cached: number;
|
|
102
|
+
/** Number of tasks that failed */
|
|
103
|
+
failed: number;
|
|
104
|
+
/** Number of tasks skipped due to upstream failure */
|
|
105
|
+
skipped: number;
|
|
106
|
+
/** Total duration in milliseconds */
|
|
107
|
+
duration: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Result of stepApplyTreeUpdate.
|
|
111
|
+
*/
|
|
112
|
+
export interface TreeUpdateResult {
|
|
113
|
+
/** The new workspace root hash after the update */
|
|
114
|
+
newRootHash: string;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/dataflow/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAAE,uBAAuB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;IAClC,oDAAoD;IACpD,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
// Re-export EastType schemas for serialization
|
|
6
|
+
export { TaskStateType, DataflowGraphTaskType, DataflowGraphType, ExecutionEventType, DataflowExecutionStateType, } from '@elaraai/e3-types';
|
|
7
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dataflow/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,+CAA+C;AAC/C,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC"}
|