@elaraai/e3-core 0.0.1-alpha.2
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/LICENSE.md +50 -0
- package/README.md +103 -0
- package/dist/src/dataflow.d.ts +136 -0
- package/dist/src/dataflow.d.ts.map +1 -0
- package/dist/src/dataflow.js +562 -0
- package/dist/src/dataflow.js.map +1 -0
- package/dist/src/errors.d.ts +125 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +211 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/executions.d.ts +176 -0
- package/dist/src/executions.d.ts.map +1 -0
- package/dist/src/executions.js +585 -0
- package/dist/src/executions.js.map +1 -0
- package/dist/src/formats.d.ts +38 -0
- package/dist/src/formats.d.ts.map +1 -0
- package/dist/src/formats.js +115 -0
- package/dist/src/formats.js.map +1 -0
- package/dist/src/gc.d.ts +54 -0
- package/dist/src/gc.d.ts.map +1 -0
- package/dist/src/gc.js +233 -0
- package/dist/src/gc.js.map +1 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +72 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/objects.d.ts +62 -0
- package/dist/src/objects.d.ts.map +1 -0
- package/dist/src/objects.js +245 -0
- package/dist/src/objects.js.map +1 -0
- package/dist/src/packages.d.ts +93 -0
- package/dist/src/packages.d.ts.map +1 -0
- package/dist/src/packages.js +370 -0
- package/dist/src/packages.js.map +1 -0
- package/dist/src/repository.d.ts +38 -0
- package/dist/src/repository.d.ts.map +1 -0
- package/dist/src/repository.js +103 -0
- package/dist/src/repository.js.map +1 -0
- package/dist/src/tasks.d.ts +63 -0
- package/dist/src/tasks.d.ts.map +1 -0
- package/dist/src/tasks.js +145 -0
- package/dist/src/tasks.js.map +1 -0
- package/dist/src/test-helpers.d.ts +44 -0
- package/dist/src/test-helpers.d.ts.map +1 -0
- package/dist/src/test-helpers.js +141 -0
- package/dist/src/test-helpers.js.map +1 -0
- package/dist/src/trees.d.ts +178 -0
- package/dist/src/trees.d.ts.map +1 -0
- package/dist/src/trees.js +636 -0
- package/dist/src/trees.js.map +1 -0
- package/dist/src/workspaceLock.d.ts +67 -0
- package/dist/src/workspaceLock.d.ts.map +1 -0
- package/dist/src/workspaceLock.js +217 -0
- package/dist/src/workspaceLock.js.map +1 -0
- package/dist/src/workspaceStatus.d.ts +126 -0
- package/dist/src/workspaceStatus.d.ts.map +1 -0
- package/dist/src/workspaceStatus.js +352 -0
- package/dist/src/workspaceStatus.js.map +1 -0
- package/dist/src/workspaces.d.ts +150 -0
- package/dist/src/workspaces.d.ts.map +1 -0
- package/dist/src/workspaces.js +390 -0
- package/dist/src/workspaces.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Workspace status - dry-run analysis of dataflow execution state.
|
|
7
|
+
*
|
|
8
|
+
* Provides a complete view of workspace state including:
|
|
9
|
+
* - Lock status (who holds it, since when)
|
|
10
|
+
* - Dataset status (unset, stale, up-to-date)
|
|
11
|
+
* - Task status (up-to-date, ready, waiting, in-progress)
|
|
12
|
+
*
|
|
13
|
+
* This is read-only and does not require a lock.
|
|
14
|
+
*/
|
|
15
|
+
import { decodeBeast2For, variant } from '@elaraai/east';
|
|
16
|
+
import { PackageObjectType, TaskObjectType, WorkspaceStateType, pathToString, } from '@elaraai/e3-types';
|
|
17
|
+
import { objectRead } from './objects.js';
|
|
18
|
+
import { executionGet, inputsHash, } from './executions.js';
|
|
19
|
+
import { workspaceGetDatasetHash } from './trees.js';
|
|
20
|
+
import { WorkspaceNotFoundError, WorkspaceNotDeployedError, isNotFoundError, } from './errors.js';
|
|
21
|
+
import { getWorkspaceLockHolder } from './workspaceLock.js';
|
|
22
|
+
import * as fs from 'fs/promises';
|
|
23
|
+
import * as path from 'path';
|
|
24
|
+
// =============================================================================
|
|
25
|
+
// Workspace State Reader (duplicated to avoid circular deps)
|
|
26
|
+
// =============================================================================
|
|
27
|
+
/**
|
|
28
|
+
* Read workspace state from file.
|
|
29
|
+
*/
|
|
30
|
+
async function readWorkspaceState(repoPath, ws) {
|
|
31
|
+
const stateFile = path.join(repoPath, 'workspaces', `${ws}.beast2`);
|
|
32
|
+
let data;
|
|
33
|
+
try {
|
|
34
|
+
data = await fs.readFile(stateFile);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
if (isNotFoundError(err)) {
|
|
38
|
+
throw new WorkspaceNotFoundError(ws);
|
|
39
|
+
}
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
42
|
+
if (data.length === 0) {
|
|
43
|
+
throw new WorkspaceNotDeployedError(ws);
|
|
44
|
+
}
|
|
45
|
+
const decoder = decodeBeast2For(WorkspaceStateType);
|
|
46
|
+
return decoder(data);
|
|
47
|
+
}
|
|
48
|
+
// =============================================================================
|
|
49
|
+
// Main Function
|
|
50
|
+
// =============================================================================
|
|
51
|
+
/**
|
|
52
|
+
* Get comprehensive status of a workspace.
|
|
53
|
+
*
|
|
54
|
+
* Performs a dry-run analysis of the workspace to determine:
|
|
55
|
+
* - Whether the workspace is locked (and by whom)
|
|
56
|
+
* - Status of each dataset (unset, stale, up-to-date)
|
|
57
|
+
* - Status of each task (up-to-date, ready, waiting, in-progress)
|
|
58
|
+
*
|
|
59
|
+
* This is a read-only operation that does not modify workspace state
|
|
60
|
+
* and does not require acquiring a lock.
|
|
61
|
+
*
|
|
62
|
+
* @param repoPath - Path to .e3 repository
|
|
63
|
+
* @param ws - Workspace name
|
|
64
|
+
* @returns Complete status report
|
|
65
|
+
* @throws {WorkspaceNotFoundError} If workspace doesn't exist
|
|
66
|
+
* @throws {WorkspaceNotDeployedError} If workspace has no package deployed
|
|
67
|
+
*/
|
|
68
|
+
export async function workspaceStatus(repoPath, ws) {
|
|
69
|
+
// Check lock status first
|
|
70
|
+
const lock = await getWorkspaceLockHolder(repoPath, ws);
|
|
71
|
+
// Read workspace state
|
|
72
|
+
const state = await readWorkspaceState(repoPath, ws);
|
|
73
|
+
// Read package object to get tasks and structure
|
|
74
|
+
const pkgData = await objectRead(repoPath, state.packageHash);
|
|
75
|
+
const pkgDecoder = decodeBeast2For(PackageObjectType);
|
|
76
|
+
const pkgObject = pkgDecoder(Buffer.from(pkgData));
|
|
77
|
+
// Build task nodes
|
|
78
|
+
const taskNodes = new Map();
|
|
79
|
+
const outputToTask = new Map(); // output path -> task name
|
|
80
|
+
const taskDecoder = decodeBeast2For(TaskObjectType);
|
|
81
|
+
for (const [taskName, taskHash] of pkgObject.tasks) {
|
|
82
|
+
const taskData = await objectRead(repoPath, taskHash);
|
|
83
|
+
const task = taskDecoder(Buffer.from(taskData));
|
|
84
|
+
const outputPathStr = pathToString(task.output);
|
|
85
|
+
outputToTask.set(outputPathStr, taskName);
|
|
86
|
+
taskNodes.set(taskName, {
|
|
87
|
+
name: taskName,
|
|
88
|
+
hash: taskHash,
|
|
89
|
+
task,
|
|
90
|
+
inputPaths: task.inputs,
|
|
91
|
+
outputPath: task.output,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
// Collect all dataset paths from structure
|
|
95
|
+
const datasetPaths = [];
|
|
96
|
+
collectDatasetPaths(pkgObject.data.structure, [], datasetPaths);
|
|
97
|
+
// Determine task dependencies
|
|
98
|
+
const taskDependsOn = new Map();
|
|
99
|
+
for (const [taskName, node] of taskNodes) {
|
|
100
|
+
const deps = [];
|
|
101
|
+
for (const inputPath of node.inputPaths) {
|
|
102
|
+
const inputPathStr = pathToString(inputPath);
|
|
103
|
+
const producerTask = outputToTask.get(inputPathStr);
|
|
104
|
+
if (producerTask) {
|
|
105
|
+
deps.push(producerTask);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
taskDependsOn.set(taskName, deps);
|
|
109
|
+
}
|
|
110
|
+
// Determine which tasks are stale (need to rerun)
|
|
111
|
+
// A task is stale if:
|
|
112
|
+
// 1. No cached execution for current inputs, OR
|
|
113
|
+
// 2. Cached output doesn't match current workspace output, OR
|
|
114
|
+
// 3. Any upstream task is stale
|
|
115
|
+
const taskIsStale = new Map();
|
|
116
|
+
const taskStatus = new Map();
|
|
117
|
+
// First pass: determine which tasks have valid cached executions
|
|
118
|
+
for (const [taskName, node] of taskNodes) {
|
|
119
|
+
const status = await computeTaskStatus(repoPath, ws, node, outputToTask, taskNodes, taskIsStale);
|
|
120
|
+
taskStatus.set(taskName, status);
|
|
121
|
+
taskIsStale.set(taskName, status.type !== 'up-to-date');
|
|
122
|
+
}
|
|
123
|
+
// Second pass: mark tasks as waiting if their upstream is stale
|
|
124
|
+
for (const [taskName] of taskNodes) {
|
|
125
|
+
const currentStatus = taskStatus.get(taskName);
|
|
126
|
+
if (currentStatus.type === 'ready') {
|
|
127
|
+
// Check if any upstream task is stale
|
|
128
|
+
const deps = taskDependsOn.get(taskName) ?? [];
|
|
129
|
+
for (const depName of deps) {
|
|
130
|
+
if (taskIsStale.get(depName)) {
|
|
131
|
+
taskStatus.set(taskName, {
|
|
132
|
+
type: 'waiting',
|
|
133
|
+
reason: `Waiting for task '${depName}'`,
|
|
134
|
+
});
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// Build dataset status
|
|
141
|
+
const datasetStatusInfos = [];
|
|
142
|
+
for (const datasetPath of datasetPaths) {
|
|
143
|
+
const pathStr = pathToString(datasetPath);
|
|
144
|
+
const { refType, hash } = await workspaceGetDatasetHash(repoPath, ws, datasetPath);
|
|
145
|
+
const producerTask = outputToTask.get(pathStr) ?? null;
|
|
146
|
+
const isTaskOutput = producerTask !== null;
|
|
147
|
+
let status;
|
|
148
|
+
if (refType === 'unassigned') {
|
|
149
|
+
status = { type: 'unset' };
|
|
150
|
+
}
|
|
151
|
+
else if (isTaskOutput && producerTask && taskIsStale.get(producerTask)) {
|
|
152
|
+
status = { type: 'stale' };
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
status = { type: 'up-to-date' };
|
|
156
|
+
}
|
|
157
|
+
datasetStatusInfos.push({
|
|
158
|
+
path: pathStr,
|
|
159
|
+
status,
|
|
160
|
+
hash,
|
|
161
|
+
isTaskOutput,
|
|
162
|
+
producedBy: producerTask,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
// Build task status info
|
|
166
|
+
const taskStatusInfos = [];
|
|
167
|
+
for (const [taskName, node] of taskNodes) {
|
|
168
|
+
taskStatusInfos.push({
|
|
169
|
+
name: taskName,
|
|
170
|
+
hash: node.hash,
|
|
171
|
+
status: taskStatus.get(taskName),
|
|
172
|
+
inputs: node.inputPaths.map(pathToString),
|
|
173
|
+
output: pathToString(node.outputPath),
|
|
174
|
+
dependsOn: taskDependsOn.get(taskName) ?? [],
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
// Compute summary
|
|
178
|
+
const summary = {
|
|
179
|
+
datasets: {
|
|
180
|
+
total: datasetStatusInfos.length,
|
|
181
|
+
unset: datasetStatusInfos.filter((d) => d.status.type === 'unset').length,
|
|
182
|
+
stale: datasetStatusInfos.filter((d) => d.status.type === 'stale').length,
|
|
183
|
+
upToDate: datasetStatusInfos.filter((d) => d.status.type === 'up-to-date').length,
|
|
184
|
+
},
|
|
185
|
+
tasks: {
|
|
186
|
+
total: taskStatusInfos.length,
|
|
187
|
+
upToDate: taskStatusInfos.filter((t) => t.status.type === 'up-to-date').length,
|
|
188
|
+
ready: taskStatusInfos.filter((t) => t.status.type === 'ready').length,
|
|
189
|
+
waiting: taskStatusInfos.filter((t) => t.status.type === 'waiting').length,
|
|
190
|
+
inProgress: taskStatusInfos.filter((t) => t.status.type === 'in-progress').length,
|
|
191
|
+
failed: taskStatusInfos.filter((t) => t.status.type === 'failed').length,
|
|
192
|
+
error: taskStatusInfos.filter((t) => t.status.type === 'error').length,
|
|
193
|
+
staleRunning: taskStatusInfos.filter((t) => t.status.type === 'stale-running').length,
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
workspace: ws,
|
|
198
|
+
lock,
|
|
199
|
+
datasets: datasetStatusInfos,
|
|
200
|
+
tasks: taskStatusInfos,
|
|
201
|
+
summary,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
// =============================================================================
|
|
205
|
+
// Helper Functions
|
|
206
|
+
// =============================================================================
|
|
207
|
+
/**
|
|
208
|
+
* Recursively collect all dataset paths from a structure.
|
|
209
|
+
*/
|
|
210
|
+
function collectDatasetPaths(structure, currentPath, result) {
|
|
211
|
+
if (structure.type === 'value') {
|
|
212
|
+
result.push(currentPath);
|
|
213
|
+
}
|
|
214
|
+
else if (structure.type === 'struct') {
|
|
215
|
+
for (const [fieldName, childStructure] of structure.value) {
|
|
216
|
+
const childPath = [...currentPath, variant('field', fieldName)];
|
|
217
|
+
collectDatasetPaths(childStructure, childPath, result);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Compute the status of a task.
|
|
223
|
+
*/
|
|
224
|
+
async function computeTaskStatus(repoPath, ws, node, outputToTask, _taskNodes, _taskIsStale) {
|
|
225
|
+
// First, check if execution is in progress
|
|
226
|
+
const inProgressStatus = await checkInProgress(repoPath, node.hash);
|
|
227
|
+
if (inProgressStatus) {
|
|
228
|
+
return inProgressStatus;
|
|
229
|
+
}
|
|
230
|
+
// Gather current input hashes
|
|
231
|
+
const currentInputHashes = [];
|
|
232
|
+
let hasUnsetInputs = false;
|
|
233
|
+
let waitingOnTasks = [];
|
|
234
|
+
for (const inputPath of node.inputPaths) {
|
|
235
|
+
const inputPathStr = pathToString(inputPath);
|
|
236
|
+
const { refType, hash } = await workspaceGetDatasetHash(repoPath, ws, inputPath);
|
|
237
|
+
if (refType === 'unassigned' || hash === null) {
|
|
238
|
+
hasUnsetInputs = true;
|
|
239
|
+
// Check if this is produced by another task
|
|
240
|
+
const producerTask = outputToTask.get(inputPathStr);
|
|
241
|
+
if (producerTask) {
|
|
242
|
+
waitingOnTasks.push(producerTask);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
// External input that is unset
|
|
246
|
+
return {
|
|
247
|
+
type: 'waiting',
|
|
248
|
+
reason: `Input '${inputPathStr}' is not set`,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
currentInputHashes.push(hash);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// If any inputs are unset and produced by tasks, we're waiting
|
|
257
|
+
if (hasUnsetInputs && waitingOnTasks.length > 0) {
|
|
258
|
+
return {
|
|
259
|
+
type: 'waiting',
|
|
260
|
+
reason: `Waiting for task(s): ${waitingOnTasks.join(', ')}`,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
// If any inputs are unset (external), we're waiting
|
|
264
|
+
if (hasUnsetInputs) {
|
|
265
|
+
return {
|
|
266
|
+
type: 'waiting',
|
|
267
|
+
reason: 'Some inputs are not set',
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
// Check the execution status for these inputs
|
|
271
|
+
const inHash = inputsHash(currentInputHashes);
|
|
272
|
+
const execStatus = await executionGet(repoPath, node.hash, inHash);
|
|
273
|
+
if (execStatus === null) {
|
|
274
|
+
// No execution attempted - task is ready to run
|
|
275
|
+
return { type: 'ready' };
|
|
276
|
+
}
|
|
277
|
+
// Check the execution status type
|
|
278
|
+
switch (execStatus.type) {
|
|
279
|
+
case 'running': {
|
|
280
|
+
// Execution was marked as running - check if process is still alive
|
|
281
|
+
// For now, just report it (process liveness check is done in checkInProgress)
|
|
282
|
+
// If we reach here, checkInProgress didn't find it, so it might be stale
|
|
283
|
+
return {
|
|
284
|
+
type: 'stale-running',
|
|
285
|
+
pid: Number(execStatus.value.pid),
|
|
286
|
+
startedAt: execStatus.value.startedAt.toISOString(),
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
case 'failed': {
|
|
290
|
+
// Task ran but returned non-zero exit code
|
|
291
|
+
return {
|
|
292
|
+
type: 'failed',
|
|
293
|
+
exitCode: Number(execStatus.value.exitCode),
|
|
294
|
+
completedAt: execStatus.value.completedAt.toISOString(),
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
case 'error': {
|
|
298
|
+
// Internal error during execution
|
|
299
|
+
return {
|
|
300
|
+
type: 'error',
|
|
301
|
+
message: execStatus.value.message,
|
|
302
|
+
completedAt: execStatus.value.completedAt.toISOString(),
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
case 'success': {
|
|
306
|
+
// Execution succeeded - check if workspace output matches
|
|
307
|
+
const cachedOutputHash = execStatus.value.outputHash;
|
|
308
|
+
const { refType, hash: wsOutputHash } = await workspaceGetDatasetHash(repoPath, ws, node.outputPath);
|
|
309
|
+
if (refType !== 'value' || wsOutputHash !== cachedOutputHash) {
|
|
310
|
+
// Workspace output doesn't match - task needs to run
|
|
311
|
+
// (This might happen if workspace was modified externally)
|
|
312
|
+
return { type: 'ready' };
|
|
313
|
+
}
|
|
314
|
+
// Everything matches - task is up-to-date
|
|
315
|
+
return { type: 'up-to-date', cached: true };
|
|
316
|
+
}
|
|
317
|
+
default:
|
|
318
|
+
// Unknown status type - treat as ready
|
|
319
|
+
return { type: 'ready' };
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Check if an execution is currently in progress for a task.
|
|
324
|
+
*
|
|
325
|
+
* Looks for a 'running' execution status that is still alive.
|
|
326
|
+
*/
|
|
327
|
+
async function checkInProgress(repoPath, taskHash) {
|
|
328
|
+
// List all executions for this task
|
|
329
|
+
const execDir = path.join(repoPath, 'executions', taskHash);
|
|
330
|
+
try {
|
|
331
|
+
const entries = await fs.readdir(execDir);
|
|
332
|
+
for (const inHash of entries) {
|
|
333
|
+
if (!/^[a-f0-9]{64}$/.test(inHash))
|
|
334
|
+
continue;
|
|
335
|
+
const status = await executionGet(repoPath, taskHash, inHash);
|
|
336
|
+
if (status?.type === 'running') {
|
|
337
|
+
// Found a running execution
|
|
338
|
+
// We could also verify the process is still alive here
|
|
339
|
+
return {
|
|
340
|
+
type: 'in-progress',
|
|
341
|
+
pid: Number(status.value.pid),
|
|
342
|
+
startedAt: status.value.startedAt.toISOString(),
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
catch {
|
|
348
|
+
// No executions directory
|
|
349
|
+
}
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=workspaceStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaceStatus.js","sourceRoot":"","sources":["../../src/workspaceStatus.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,YAAY,GAIb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,YAAY,EACZ,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,GAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AA4G7B,gFAAgF;AAChF,6DAA6D;AAC7D,gFAAgF;AAEhF;;GAEG;AACH,KAAK,UAAU,kBAAkB,CAAC,QAAgB,EAAE,EAAU;IAC5D,MAAM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AI,EAAE,aAAa;oBACnB,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;oBAC7B,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE;iBAChD,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,0BAA0B;IAC5B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import type { WorkspaceState } from '@elaraai/e3-types';
|
|
6
|
+
import { type WorkspaceLockHandle } from './workspaceLock.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create an empty workspace.
|
|
9
|
+
*
|
|
10
|
+
* Creates an undeployed workspace (state file with null package info).
|
|
11
|
+
* Use workspaceDeploy to deploy a package.
|
|
12
|
+
*
|
|
13
|
+
* @param repoPath - Path to .e3 repository
|
|
14
|
+
* @param name - Workspace name
|
|
15
|
+
* @throws {WorkspaceExistsError} If workspace already exists
|
|
16
|
+
*/
|
|
17
|
+
export declare function workspaceCreate(repoPath: string, name: string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Options for workspace removal.
|
|
20
|
+
*/
|
|
21
|
+
export interface WorkspaceRemoveOptions {
|
|
22
|
+
/**
|
|
23
|
+
* External workspace lock to use. If provided, the caller is responsible
|
|
24
|
+
* for releasing the lock after the operation. If not provided, workspaceRemove
|
|
25
|
+
* will acquire and release a lock internally.
|
|
26
|
+
*/
|
|
27
|
+
lock?: WorkspaceLockHandle;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Remove a workspace.
|
|
31
|
+
*
|
|
32
|
+
* Objects remain until repoGc is run.
|
|
33
|
+
*
|
|
34
|
+
* Acquires a workspace lock to prevent removing a workspace while a dataflow
|
|
35
|
+
* is running. Throws WorkspaceLockError if the workspace is currently locked.
|
|
36
|
+
*
|
|
37
|
+
* @param repoPath - Path to .e3 repository
|
|
38
|
+
* @param name - Workspace name
|
|
39
|
+
* @param options - Optional settings including external lock
|
|
40
|
+
* @throws {WorkspaceNotFoundError} If workspace doesn't exist
|
|
41
|
+
* @throws {WorkspaceLockError} If workspace is locked by another process
|
|
42
|
+
*/
|
|
43
|
+
export declare function workspaceRemove(repoPath: string, name: string, options?: WorkspaceRemoveOptions): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* List workspace names.
|
|
46
|
+
*
|
|
47
|
+
* @param repoPath - Path to .e3 repository
|
|
48
|
+
* @returns Array of workspace names
|
|
49
|
+
*/
|
|
50
|
+
export declare function workspaceList(repoPath: string): Promise<string[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Get the full state for a workspace.
|
|
53
|
+
*
|
|
54
|
+
* @param repoPath - Path to .e3 repository
|
|
55
|
+
* @param name - Workspace name
|
|
56
|
+
* @returns Workspace state, or null if workspace doesn't exist or is not deployed
|
|
57
|
+
*/
|
|
58
|
+
export declare function workspaceGetState(repoPath: string, name: string): Promise<WorkspaceState | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Get the deployed package for a workspace.
|
|
61
|
+
*
|
|
62
|
+
* @param repoPath - Path to .e3 repository
|
|
63
|
+
* @param name - Workspace name
|
|
64
|
+
* @returns Package name, version, and hash
|
|
65
|
+
* @throws {WorkspaceNotFoundError} If workspace doesn't exist
|
|
66
|
+
* @throws {WorkspaceNotDeployedError} If workspace exists but has no package deployed
|
|
67
|
+
*/
|
|
68
|
+
export declare function workspaceGetPackage(repoPath: string, name: string): Promise<{
|
|
69
|
+
name: string;
|
|
70
|
+
version: string;
|
|
71
|
+
hash: string;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Get the root tree hash for a workspace.
|
|
75
|
+
*
|
|
76
|
+
* @param repoPath - Path to .e3 repository
|
|
77
|
+
* @param name - Workspace name
|
|
78
|
+
* @returns Root tree object hash
|
|
79
|
+
* @throws {WorkspaceNotFoundError} If workspace doesn't exist
|
|
80
|
+
* @throws {WorkspaceNotDeployedError} If workspace exists but has no package deployed
|
|
81
|
+
*/
|
|
82
|
+
export declare function workspaceGetRoot(repoPath: string, name: string): Promise<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Atomically update the root tree hash for a workspace.
|
|
85
|
+
*
|
|
86
|
+
* @param repoPath - Path to .e3 repository
|
|
87
|
+
* @param name - Workspace name
|
|
88
|
+
* @param hash - New root tree object hash
|
|
89
|
+
* @throws {WorkspaceNotFoundError} If workspace doesn't exist
|
|
90
|
+
* @throws {WorkspaceNotDeployedError} If workspace exists but has no package deployed
|
|
91
|
+
*/
|
|
92
|
+
export declare function workspaceSetRoot(repoPath: string, name: string, hash: string): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Options for workspace deployment.
|
|
95
|
+
*/
|
|
96
|
+
export interface WorkspaceDeployOptions {
|
|
97
|
+
/**
|
|
98
|
+
* External workspace lock to use. If provided, the caller is responsible
|
|
99
|
+
* for releasing the lock after the operation. If not provided, workspaceDeploy
|
|
100
|
+
* will acquire and release a lock internally.
|
|
101
|
+
*/
|
|
102
|
+
lock?: WorkspaceLockHandle;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Deploy a package to a workspace.
|
|
106
|
+
*
|
|
107
|
+
* Creates the workspace if it doesn't exist. Writes state file atomically
|
|
108
|
+
* containing deployment info and root hash.
|
|
109
|
+
*
|
|
110
|
+
* Acquires a workspace lock to prevent conflicts with running dataflows
|
|
111
|
+
* or concurrent deploys. Throws WorkspaceLockError if the workspace is
|
|
112
|
+
* currently locked by another process.
|
|
113
|
+
*
|
|
114
|
+
* @param repoPath - Path to .e3 repository
|
|
115
|
+
* @param name - Workspace name
|
|
116
|
+
* @param pkgName - Package name
|
|
117
|
+
* @param pkgVersion - Package version
|
|
118
|
+
* @param options - Optional settings including external lock
|
|
119
|
+
* @throws {WorkspaceLockError} If workspace is locked by another process
|
|
120
|
+
*/
|
|
121
|
+
export declare function workspaceDeploy(repoPath: string, name: string, pkgName: string, pkgVersion: string, options?: WorkspaceDeployOptions): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Result of exporting a workspace
|
|
124
|
+
*/
|
|
125
|
+
export interface WorkspaceExportResult {
|
|
126
|
+
packageHash: string;
|
|
127
|
+
objectCount: number;
|
|
128
|
+
name: string;
|
|
129
|
+
version: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Export a workspace as a package.
|
|
133
|
+
*
|
|
134
|
+
* 1. Read workspace state
|
|
135
|
+
* 2. Read deployed package structure using stored packageHash
|
|
136
|
+
* 3. Create new PackageObject with data.value set to current rootHash
|
|
137
|
+
* 4. Collect all referenced objects
|
|
138
|
+
* 5. Write to .zip
|
|
139
|
+
*
|
|
140
|
+
* @param repoPath - Path to .e3 repository
|
|
141
|
+
* @param name - Workspace name
|
|
142
|
+
* @param zipPath - Path to write the .zip file
|
|
143
|
+
* @param outputName - Package name (default: deployed package name)
|
|
144
|
+
* @param version - Package version (default: <pkgVersion>-<rootHash[0..8]>)
|
|
145
|
+
* @returns Export result with package info
|
|
146
|
+
* @throws {WorkspaceNotFoundError} If workspace doesn't exist
|
|
147
|
+
* @throws {WorkspaceNotDeployedError} If workspace exists but has no package deployed
|
|
148
|
+
*/
|
|
149
|
+
export declare function workspaceExport(repoPath: string, name: string, zipPath: string, outputName?: string, version?: string): Promise<WorkspaceExportResult>;
|
|
150
|
+
//# sourceMappingURL=workspaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../src/workspaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AASvE,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;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