@elaraai/e3-core 0.0.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +50 -0
- package/README.md +76 -0
- package/dist/src/dataflow.d.ts +96 -0
- package/dist/src/dataflow.d.ts.map +1 -0
- package/dist/src/dataflow.js +433 -0
- package/dist/src/dataflow.js.map +1 -0
- package/dist/src/errors.d.ts +87 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +178 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/executions.d.ts +163 -0
- package/dist/src/executions.d.ts.map +1 -0
- package/dist/src/executions.js +535 -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 +232 -0
- package/dist/src/gc.js.map +1 -0
- package/dist/src/index.d.ts +23 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +68 -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 +85 -0
- package/dist/src/packages.d.ts.map +1 -0
- package/dist/src/packages.js +355 -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 +156 -0
- package/dist/src/trees.d.ts.map +1 -0
- package/dist/src/trees.js +607 -0
- package/dist/src/trees.js.map +1 -0
- package/dist/src/workspaces.d.ts +116 -0
- package/dist/src/workspaces.d.ts.map +1 -0
- package/dist/src/workspaces.js +356 -0
- package/dist/src/workspaces.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,607 @@
|
|
|
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
|
+
* Low-level tree and dataset operations for e3 repositories.
|
|
7
|
+
*
|
|
8
|
+
* Trees are persistent data structures with structural sharing (like git trees).
|
|
9
|
+
* Each tree node contains DataRefs pointing to either other trees or dataset values.
|
|
10
|
+
*
|
|
11
|
+
* Tree operations require a Structure parameter which describes the shape of the
|
|
12
|
+
* tree node. This enables proper encoding/decoding with the correct StructType
|
|
13
|
+
* and supports future tree types (array, variant, etc.).
|
|
14
|
+
*
|
|
15
|
+
* Low-level operations work with hashes directly (by-hash).
|
|
16
|
+
* High-level operations traverse paths from a root (by-path).
|
|
17
|
+
*/
|
|
18
|
+
import { decodeBeast2, decodeBeast2For, encodeBeast2For, StructType, } from '@elaraai/east';
|
|
19
|
+
import { DataRefType, PackageObjectType, WorkspaceStateType } from '@elaraai/e3-types';
|
|
20
|
+
import { objectRead, objectWrite } from './objects.js';
|
|
21
|
+
import { packageRead } from './packages.js';
|
|
22
|
+
import { WorkspaceNotFoundError, WorkspaceNotDeployedError, isNotFoundError, } from './errors.js';
|
|
23
|
+
import * as fs from 'fs/promises';
|
|
24
|
+
import * as path from 'path';
|
|
25
|
+
/**
|
|
26
|
+
* Build the EastType for a tree object based on its structure.
|
|
27
|
+
*
|
|
28
|
+
* For struct trees, creates a StructType with DataRefType for each field.
|
|
29
|
+
* Future: will handle array, variant, and other tree types.
|
|
30
|
+
*
|
|
31
|
+
* @param structure - The structure describing this tree node
|
|
32
|
+
* @returns The EastType for encoding/decoding the tree object
|
|
33
|
+
*/
|
|
34
|
+
function treeTypeFromStructure(structure) {
|
|
35
|
+
if (structure.type === 'struct') {
|
|
36
|
+
const fields = {};
|
|
37
|
+
for (const fieldName of structure.value.keys()) {
|
|
38
|
+
fields[fieldName] = DataRefType;
|
|
39
|
+
}
|
|
40
|
+
return StructType(fields);
|
|
41
|
+
}
|
|
42
|
+
else if (structure.type === 'value') {
|
|
43
|
+
throw new Error('Cannot create tree type for a value structure - this is a dataset, not a tree');
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw new Error(`Unsupported structure type: ${structure.type}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Read and decode a tree object from the object store.
|
|
51
|
+
*
|
|
52
|
+
* @param repoPath - Path to .e3 repository
|
|
53
|
+
* @param hash - Hash of the tree object
|
|
54
|
+
* @param structure - The structure describing this tree node's shape
|
|
55
|
+
* @returns The decoded tree object (field name -> DataRef)
|
|
56
|
+
* @throws If object not found, structure is not a tree, or decoding fails
|
|
57
|
+
*/
|
|
58
|
+
export async function treeRead(repoPath, hash, structure) {
|
|
59
|
+
const treeType = treeTypeFromStructure(structure);
|
|
60
|
+
const data = await objectRead(repoPath, hash);
|
|
61
|
+
const decoder = decodeBeast2For(treeType);
|
|
62
|
+
return decoder(Buffer.from(data));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Encode and write a tree object to the object store.
|
|
66
|
+
*
|
|
67
|
+
* @param repoPath - Path to .e3 repository
|
|
68
|
+
* @param fields - Object mapping field names to DataRefs
|
|
69
|
+
* @param structure - The structure describing this tree node's shape
|
|
70
|
+
* @returns Hash of the written tree object
|
|
71
|
+
* @throws If structure is not a tree or encoding fails
|
|
72
|
+
*/
|
|
73
|
+
export async function treeWrite(repoPath, fields, structure) {
|
|
74
|
+
const treeType = treeTypeFromStructure(structure);
|
|
75
|
+
const encoder = encodeBeast2For(treeType);
|
|
76
|
+
const data = encoder(fields);
|
|
77
|
+
return objectWrite(repoPath, data);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Read and decode a dataset value from the object store.
|
|
81
|
+
*
|
|
82
|
+
* The .beast2 format includes type information in the header, so values
|
|
83
|
+
* can be decoded without knowing the schema in advance.
|
|
84
|
+
*
|
|
85
|
+
* @param repoPath - Path to .e3 repository
|
|
86
|
+
* @param hash - Hash of the dataset value
|
|
87
|
+
* @returns The decoded value and its type
|
|
88
|
+
* @throws If object not found or not a valid beast2 object
|
|
89
|
+
*/
|
|
90
|
+
export async function datasetRead(repoPath, hash) {
|
|
91
|
+
const data = await objectRead(repoPath, hash);
|
|
92
|
+
const result = decodeBeast2(Buffer.from(data));
|
|
93
|
+
return { type: result.type, value: result.value };
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Encode and write a dataset value to the object store.
|
|
97
|
+
*
|
|
98
|
+
* @param repoPath - Path to .e3 repository
|
|
99
|
+
* @param value - The value to encode
|
|
100
|
+
* @param type - The East type for encoding (EastType or EastTypeValue)
|
|
101
|
+
* @returns Hash of the written dataset value
|
|
102
|
+
*/
|
|
103
|
+
export async function datasetWrite(repoPath, value, type) {
|
|
104
|
+
// encodeBeast2For accepts both EastType and EastTypeValue, but TypeScript
|
|
105
|
+
// overloads don't support union types directly. Cast to EastTypeValue since
|
|
106
|
+
// that's the more general case and the runtime handles both.
|
|
107
|
+
const encoder = encodeBeast2For(type);
|
|
108
|
+
const data = encoder(value);
|
|
109
|
+
return objectWrite(repoPath, data);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Traverse a tree from root to a path, co-walking structure and data.
|
|
113
|
+
*
|
|
114
|
+
* @param repoPath - Path to .e3 repository
|
|
115
|
+
* @param rootHash - Hash of the root tree object
|
|
116
|
+
* @param rootStructure - Structure of the root tree
|
|
117
|
+
* @param path - Path to traverse
|
|
118
|
+
* @returns The structure and DataRef at the path location
|
|
119
|
+
* @throws If path is invalid or traversal fails
|
|
120
|
+
*/
|
|
121
|
+
async function traverse(repoPath, rootHash, rootStructure, path) {
|
|
122
|
+
let currentStructure = rootStructure;
|
|
123
|
+
let currentHash = rootHash;
|
|
124
|
+
for (let i = 0; i < path.length; i++) {
|
|
125
|
+
const segment = path[i];
|
|
126
|
+
if (segment.type !== 'field') {
|
|
127
|
+
throw new Error(`Unsupported path segment type: ${segment.type}`);
|
|
128
|
+
}
|
|
129
|
+
const fieldName = segment.value;
|
|
130
|
+
// Current structure must be a struct tree to descend into
|
|
131
|
+
if (currentStructure.type !== 'struct') {
|
|
132
|
+
const pathSoFar = path.slice(0, i).map(s => s.value).join('.');
|
|
133
|
+
throw new Error(`Cannot descend into non-struct at path '${pathSoFar}'`);
|
|
134
|
+
}
|
|
135
|
+
// Read the current tree object
|
|
136
|
+
const treeObject = await treeRead(repoPath, currentHash, currentStructure);
|
|
137
|
+
// Look up the child ref
|
|
138
|
+
const childRef = treeObject[fieldName];
|
|
139
|
+
if (!childRef) {
|
|
140
|
+
const pathSoFar = path.slice(0, i).map(s => s.value).join('.');
|
|
141
|
+
const available = Object.keys(treeObject).join(', ');
|
|
142
|
+
throw new Error(`Field '${fieldName}' not found at '${pathSoFar}'. Available: ${available}`);
|
|
143
|
+
}
|
|
144
|
+
// Look up the child structure
|
|
145
|
+
const childStructure = currentStructure.value.get(fieldName);
|
|
146
|
+
if (!childStructure) {
|
|
147
|
+
throw new Error(`Field '${fieldName}' not found in structure`);
|
|
148
|
+
}
|
|
149
|
+
// If this is the last segment, return the result
|
|
150
|
+
if (i === path.length - 1) {
|
|
151
|
+
return { structure: childStructure, ref: childRef };
|
|
152
|
+
}
|
|
153
|
+
// Otherwise, continue traversing (must be a tree ref)
|
|
154
|
+
if (childRef.type !== 'tree') {
|
|
155
|
+
const pathSoFar = path.slice(0, i + 1).map(s => s.value).join('.');
|
|
156
|
+
throw new Error(`Expected tree ref at '${pathSoFar}', got '${childRef.type}'`);
|
|
157
|
+
}
|
|
158
|
+
currentStructure = childStructure;
|
|
159
|
+
currentHash = childRef.value;
|
|
160
|
+
}
|
|
161
|
+
// Empty path - return root
|
|
162
|
+
return {
|
|
163
|
+
structure: rootStructure,
|
|
164
|
+
ref: { type: 'tree', value: rootHash },
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* List field names at a tree path within a package's data tree.
|
|
169
|
+
*
|
|
170
|
+
* @param repoPath - Path to .e3 repository
|
|
171
|
+
* @param name - Package name
|
|
172
|
+
* @param version - Package version
|
|
173
|
+
* @param path - Path to the tree node
|
|
174
|
+
* @returns Array of field names at the path
|
|
175
|
+
* @throws If package not found, path invalid, or path points to a dataset
|
|
176
|
+
*/
|
|
177
|
+
export async function packageListTree(repoPath, name, version, path) {
|
|
178
|
+
// Read the package to get root structure and hash
|
|
179
|
+
const pkg = await packageRead(repoPath, name, version);
|
|
180
|
+
const rootStructure = pkg.data.structure;
|
|
181
|
+
const rootHash = pkg.data.value;
|
|
182
|
+
if (path.length === 0) {
|
|
183
|
+
// Empty path - list root tree fields
|
|
184
|
+
if (rootStructure.type !== 'struct') {
|
|
185
|
+
throw new Error('Root is not a tree');
|
|
186
|
+
}
|
|
187
|
+
const treeObject = await treeRead(repoPath, rootHash, rootStructure);
|
|
188
|
+
return Object.keys(treeObject);
|
|
189
|
+
}
|
|
190
|
+
// Traverse to the path
|
|
191
|
+
const { structure, ref } = await traverse(repoPath, rootHash, rootStructure, path);
|
|
192
|
+
// Must be a tree structure
|
|
193
|
+
if (structure.type !== 'struct') {
|
|
194
|
+
const pathStr = path.map(s => s.value).join('.');
|
|
195
|
+
throw new Error(`Path '${pathStr}' points to a dataset, not a tree`);
|
|
196
|
+
}
|
|
197
|
+
// Must be a tree ref
|
|
198
|
+
if (ref.type !== 'tree') {
|
|
199
|
+
const pathStr = path.map(s => s.value).join('.');
|
|
200
|
+
throw new Error(`Path '${pathStr}' has ref type '${ref.type}', expected 'tree'`);
|
|
201
|
+
}
|
|
202
|
+
// Read the tree and return field names
|
|
203
|
+
const treeObject = await treeRead(repoPath, ref.value, structure);
|
|
204
|
+
return Object.keys(treeObject);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Read and decode a dataset value at a path within a package's data tree.
|
|
208
|
+
*
|
|
209
|
+
* @param repoPath - Path to .e3 repository
|
|
210
|
+
* @param name - Package name
|
|
211
|
+
* @param version - Package version
|
|
212
|
+
* @param path - Path to the dataset
|
|
213
|
+
* @returns The decoded dataset value
|
|
214
|
+
* @throws If package not found, path invalid, or path points to a tree
|
|
215
|
+
*/
|
|
216
|
+
export async function packageGetDataset(repoPath, name, version, path) {
|
|
217
|
+
// Read the package to get root structure and hash
|
|
218
|
+
const pkg = await packageRead(repoPath, name, version);
|
|
219
|
+
const rootStructure = pkg.data.structure;
|
|
220
|
+
const rootHash = pkg.data.value;
|
|
221
|
+
if (path.length === 0) {
|
|
222
|
+
throw new Error('Cannot get dataset at root path - root is always a tree');
|
|
223
|
+
}
|
|
224
|
+
// Traverse to the path
|
|
225
|
+
const { structure, ref } = await traverse(repoPath, rootHash, rootStructure, path);
|
|
226
|
+
// Must be a value structure
|
|
227
|
+
if (structure.type !== 'value') {
|
|
228
|
+
const pathStr = path.map(s => s.value).join('.');
|
|
229
|
+
throw new Error(`Path '${pathStr}' points to a tree, not a dataset`);
|
|
230
|
+
}
|
|
231
|
+
// Handle different ref types
|
|
232
|
+
if (ref.type === 'unassigned') {
|
|
233
|
+
throw new Error(`Dataset at path is unassigned (pending task output)`);
|
|
234
|
+
}
|
|
235
|
+
if (ref.type === 'null') {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
if (ref.type === 'tree') {
|
|
239
|
+
const pathStr = path.map(s => s.value).join('.');
|
|
240
|
+
throw new Error(`Path '${pathStr}' structure says value but ref is tree`);
|
|
241
|
+
}
|
|
242
|
+
// Read and return the dataset value
|
|
243
|
+
const result = await datasetRead(repoPath, ref.value);
|
|
244
|
+
return result.value;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Update a dataset at a path within a workspace.
|
|
248
|
+
*
|
|
249
|
+
* This creates new tree objects along the path with structural sharing,
|
|
250
|
+
* then atomically updates the workspace root.
|
|
251
|
+
*
|
|
252
|
+
* @param repoPath - Path to .e3 repository
|
|
253
|
+
* @param ws - Workspace name
|
|
254
|
+
* @param treePath - Path to the dataset
|
|
255
|
+
* @param value - The new value to write
|
|
256
|
+
* @param type - The East type for encoding the value (EastType or EastTypeValue)
|
|
257
|
+
* @throws If workspace not deployed, path invalid, or path points to a tree
|
|
258
|
+
*/
|
|
259
|
+
export async function workspaceSetDataset(repoPath, ws, treePath, value, type) {
|
|
260
|
+
if (treePath.length === 0) {
|
|
261
|
+
throw new Error('Cannot set dataset at root path - root is always a tree');
|
|
262
|
+
}
|
|
263
|
+
const state = await readWorkspaceState(repoPath, ws);
|
|
264
|
+
// Read the deployed package object to get the structure
|
|
265
|
+
const pkgData = await objectRead(repoPath, state.packageHash);
|
|
266
|
+
const decoder = decodeBeast2For(PackageObjectType);
|
|
267
|
+
const pkgObject = decoder(Buffer.from(pkgData));
|
|
268
|
+
const rootStructure = pkgObject.data.structure;
|
|
269
|
+
// Validate that the path leads to a value structure
|
|
270
|
+
let currentStructure = rootStructure;
|
|
271
|
+
for (let i = 0; i < treePath.length; i++) {
|
|
272
|
+
const segment = treePath[i];
|
|
273
|
+
if (segment.type !== 'field') {
|
|
274
|
+
throw new Error(`Unsupported path segment type: ${segment.type}`);
|
|
275
|
+
}
|
|
276
|
+
if (currentStructure.type !== 'struct') {
|
|
277
|
+
const pathSoFar = treePath.slice(0, i).map(s => s.value).join('.');
|
|
278
|
+
throw new Error(`Cannot descend into non-struct at path '${pathSoFar}'`);
|
|
279
|
+
}
|
|
280
|
+
const childStructure = currentStructure.value.get(segment.value);
|
|
281
|
+
if (!childStructure) {
|
|
282
|
+
const pathSoFar = treePath.slice(0, i).map(s => s.value).join('.');
|
|
283
|
+
const available = Array.from(currentStructure.value.keys()).join(', ');
|
|
284
|
+
throw new Error(`Field '${segment.value}' not found at '${pathSoFar}'. Available: ${available}`);
|
|
285
|
+
}
|
|
286
|
+
currentStructure = childStructure;
|
|
287
|
+
}
|
|
288
|
+
// Final structure must be a value
|
|
289
|
+
if (currentStructure.type !== 'value') {
|
|
290
|
+
const pathStr = treePath.map(s => s.value).join('.');
|
|
291
|
+
throw new Error(`Path '${pathStr}' points to a tree, not a dataset`);
|
|
292
|
+
}
|
|
293
|
+
// Write the new dataset value
|
|
294
|
+
const newValueHash = await datasetWrite(repoPath, value, type);
|
|
295
|
+
// Now rebuild the tree path from leaf to root (structural sharing)
|
|
296
|
+
// We need to read each tree along the path, modify it, and write a new version
|
|
297
|
+
// Collect all tree hashes and structures along the path
|
|
298
|
+
const treeInfos = [];
|
|
299
|
+
let currentHash = state.rootHash;
|
|
300
|
+
currentStructure = rootStructure;
|
|
301
|
+
// Read all trees along the path (except the last segment which is the dataset)
|
|
302
|
+
for (let i = 0; i < treePath.length - 1; i++) {
|
|
303
|
+
treeInfos.push({ hash: currentHash, structure: currentStructure });
|
|
304
|
+
const segment = treePath[i];
|
|
305
|
+
const treeObject = await treeRead(repoPath, currentHash, currentStructure);
|
|
306
|
+
const childRef = treeObject[segment.value];
|
|
307
|
+
if (!childRef || childRef.type !== 'tree') {
|
|
308
|
+
throw new Error(`Expected tree ref at path segment ${i}`);
|
|
309
|
+
}
|
|
310
|
+
currentHash = childRef.value;
|
|
311
|
+
currentStructure = currentStructure.value.get(segment.value);
|
|
312
|
+
}
|
|
313
|
+
// Add the final tree that contains the dataset
|
|
314
|
+
treeInfos.push({ hash: currentHash, structure: currentStructure });
|
|
315
|
+
// Now rebuild from leaf to root
|
|
316
|
+
// Start with the new value hash as the new ref
|
|
317
|
+
let newRef = { type: 'value', value: newValueHash };
|
|
318
|
+
for (let i = treeInfos.length - 1; i >= 0; i--) {
|
|
319
|
+
const { hash, structure } = treeInfos[i];
|
|
320
|
+
const fieldName = treePath[i].value;
|
|
321
|
+
// Read the current tree
|
|
322
|
+
const treeObject = await treeRead(repoPath, hash, structure);
|
|
323
|
+
// Create modified tree with the new ref
|
|
324
|
+
const newTreeObject = {
|
|
325
|
+
...treeObject,
|
|
326
|
+
[fieldName]: newRef,
|
|
327
|
+
};
|
|
328
|
+
// Write the new tree
|
|
329
|
+
const newTreeHash = await treeWrite(repoPath, newTreeObject, structure);
|
|
330
|
+
// This becomes the new ref for the parent
|
|
331
|
+
newRef = { type: 'tree', value: newTreeHash };
|
|
332
|
+
}
|
|
333
|
+
// The final newRef is always a tree ref pointing to the new root
|
|
334
|
+
// (because we start with a value ref and wrap it in tree refs bottom-up)
|
|
335
|
+
if (newRef.type !== 'tree' || newRef.value === null) {
|
|
336
|
+
throw new Error('Internal error: expected tree ref after rebuilding path');
|
|
337
|
+
}
|
|
338
|
+
const newRootHash = newRef.value;
|
|
339
|
+
// Update workspace state atomically
|
|
340
|
+
await writeWorkspaceState(repoPath, ws, {
|
|
341
|
+
...state,
|
|
342
|
+
rootHash: newRootHash,
|
|
343
|
+
rootUpdatedAt: new Date(),
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
// =============================================================================
|
|
347
|
+
// Workspace Helper Functions
|
|
348
|
+
// =============================================================================
|
|
349
|
+
/**
|
|
350
|
+
* Write workspace state to file atomically.
|
|
351
|
+
*/
|
|
352
|
+
async function writeWorkspaceState(repoPath, ws, state) {
|
|
353
|
+
const wsDir = path.join(repoPath, 'workspaces');
|
|
354
|
+
const stateFile = path.join(wsDir, `${ws}.beast2`);
|
|
355
|
+
// Ensure workspaces directory exists
|
|
356
|
+
await fs.mkdir(wsDir, { recursive: true });
|
|
357
|
+
const encoder = encodeBeast2For(WorkspaceStateType);
|
|
358
|
+
const data = encoder(state);
|
|
359
|
+
// Write atomically: write to temp file, then rename
|
|
360
|
+
const randomSuffix = Math.random().toString(36).slice(2, 10);
|
|
361
|
+
const tempPath = path.join(wsDir, `.${ws}.${Date.now()}.${randomSuffix}.tmp`);
|
|
362
|
+
await fs.writeFile(tempPath, data);
|
|
363
|
+
await fs.rename(tempPath, stateFile);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Read workspace state from file.
|
|
367
|
+
* @throws {WorkspaceNotFoundError} If workspace doesn't exist
|
|
368
|
+
* @throws {WorkspaceNotDeployedError} If workspace exists but not deployed
|
|
369
|
+
*/
|
|
370
|
+
async function readWorkspaceState(repoPath, ws) {
|
|
371
|
+
const stateFile = path.join(repoPath, 'workspaces', `${ws}.beast2`);
|
|
372
|
+
try {
|
|
373
|
+
const data = await fs.readFile(stateFile);
|
|
374
|
+
if (data.length === 0) {
|
|
375
|
+
throw new WorkspaceNotDeployedError(ws);
|
|
376
|
+
}
|
|
377
|
+
const decoder = decodeBeast2For(WorkspaceStateType);
|
|
378
|
+
return decoder(data);
|
|
379
|
+
}
|
|
380
|
+
catch (err) {
|
|
381
|
+
if (err instanceof WorkspaceNotDeployedError)
|
|
382
|
+
throw err;
|
|
383
|
+
if (isNotFoundError(err)) {
|
|
384
|
+
throw new WorkspaceNotFoundError(ws);
|
|
385
|
+
}
|
|
386
|
+
throw err;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Get root structure and hash for a workspace.
|
|
391
|
+
* Reads the deployed package object to get the structure.
|
|
392
|
+
*/
|
|
393
|
+
async function getWorkspaceRootInfo(repoPath, ws) {
|
|
394
|
+
const state = await readWorkspaceState(repoPath, ws);
|
|
395
|
+
// Read the deployed package object using the stored hash
|
|
396
|
+
const pkgData = await objectRead(repoPath, state.packageHash);
|
|
397
|
+
const decoder = decodeBeast2For(PackageObjectType);
|
|
398
|
+
const pkgObject = decoder(Buffer.from(pkgData));
|
|
399
|
+
return {
|
|
400
|
+
rootHash: state.rootHash,
|
|
401
|
+
rootStructure: pkgObject.data.structure,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
// =============================================================================
|
|
405
|
+
// Workspace High-level Operations (by path)
|
|
406
|
+
// =============================================================================
|
|
407
|
+
/**
|
|
408
|
+
* List field names at a tree path within a workspace's data tree.
|
|
409
|
+
*
|
|
410
|
+
* @param repoPath - Path to .e3 repository
|
|
411
|
+
* @param ws - Workspace name
|
|
412
|
+
* @param path - Path to the tree node
|
|
413
|
+
* @returns Array of field names at the path
|
|
414
|
+
* @throws If workspace not deployed, path invalid, or path points to a dataset
|
|
415
|
+
*/
|
|
416
|
+
export async function workspaceListTree(repoPath, ws, treePath) {
|
|
417
|
+
const { rootHash, rootStructure } = await getWorkspaceRootInfo(repoPath, ws);
|
|
418
|
+
if (treePath.length === 0) {
|
|
419
|
+
// Empty path - list root tree fields
|
|
420
|
+
if (rootStructure.type !== 'struct') {
|
|
421
|
+
throw new Error('Root is not a tree');
|
|
422
|
+
}
|
|
423
|
+
const treeObject = await treeRead(repoPath, rootHash, rootStructure);
|
|
424
|
+
return Object.keys(treeObject);
|
|
425
|
+
}
|
|
426
|
+
// Traverse to the path
|
|
427
|
+
const { structure, ref } = await traverse(repoPath, rootHash, rootStructure, treePath);
|
|
428
|
+
// Must be a tree structure
|
|
429
|
+
if (structure.type !== 'struct') {
|
|
430
|
+
const pathStr = treePath.map(s => s.value).join('.');
|
|
431
|
+
throw new Error(`Path '${pathStr}' points to a dataset, not a tree`);
|
|
432
|
+
}
|
|
433
|
+
// Must be a tree ref
|
|
434
|
+
if (ref.type !== 'tree') {
|
|
435
|
+
const pathStr = treePath.map(s => s.value).join('.');
|
|
436
|
+
throw new Error(`Path '${pathStr}' has ref type '${ref.type}', expected 'tree'`);
|
|
437
|
+
}
|
|
438
|
+
// Read the tree and return field names
|
|
439
|
+
const treeObject = await treeRead(repoPath, ref.value, structure);
|
|
440
|
+
return Object.keys(treeObject);
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Read and decode a dataset value at a path within a workspace's data tree.
|
|
444
|
+
*
|
|
445
|
+
* @param repoPath - Path to .e3 repository
|
|
446
|
+
* @param ws - Workspace name
|
|
447
|
+
* @param path - Path to the dataset
|
|
448
|
+
* @returns The decoded dataset value
|
|
449
|
+
* @throws If workspace not deployed, path invalid, or path points to a tree
|
|
450
|
+
*/
|
|
451
|
+
export async function workspaceGetDataset(repoPath, ws, treePath) {
|
|
452
|
+
const { rootHash, rootStructure } = await getWorkspaceRootInfo(repoPath, ws);
|
|
453
|
+
if (treePath.length === 0) {
|
|
454
|
+
throw new Error('Cannot get dataset at root path - root is always a tree');
|
|
455
|
+
}
|
|
456
|
+
// Traverse to the path
|
|
457
|
+
const { structure, ref } = await traverse(repoPath, rootHash, rootStructure, treePath);
|
|
458
|
+
// Must be a value structure
|
|
459
|
+
if (structure.type !== 'value') {
|
|
460
|
+
const pathStr = treePath.map(s => s.value).join('.');
|
|
461
|
+
throw new Error(`Path '${pathStr}' points to a tree, not a dataset`);
|
|
462
|
+
}
|
|
463
|
+
// Handle different ref types
|
|
464
|
+
if (ref.type === 'unassigned') {
|
|
465
|
+
throw new Error(`Dataset at path is unassigned (pending task output)`);
|
|
466
|
+
}
|
|
467
|
+
if (ref.type === 'null') {
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
if (ref.type === 'tree') {
|
|
471
|
+
const pathStr = treePath.map(s => s.value).join('.');
|
|
472
|
+
throw new Error(`Path '${pathStr}' structure says value but ref is tree`);
|
|
473
|
+
}
|
|
474
|
+
// Read and return the dataset value
|
|
475
|
+
const result = await datasetRead(repoPath, ref.value);
|
|
476
|
+
return result.value;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Get the hash of a dataset at a path within a workspace's data tree.
|
|
480
|
+
*
|
|
481
|
+
* Unlike workspaceGetDataset which decodes the value, this returns the raw
|
|
482
|
+
* hash reference. Useful for dataflow execution which operates on hashes.
|
|
483
|
+
*
|
|
484
|
+
* @param repoPath - Path to .e3 repository
|
|
485
|
+
* @param ws - Workspace name
|
|
486
|
+
* @param treePath - Path to the dataset
|
|
487
|
+
* @returns Object with ref type and hash (null for unassigned/null refs)
|
|
488
|
+
* @throws If workspace not deployed, path invalid, or path points to a tree
|
|
489
|
+
*/
|
|
490
|
+
export async function workspaceGetDatasetHash(repoPath, ws, treePath) {
|
|
491
|
+
const { rootHash, rootStructure } = await getWorkspaceRootInfo(repoPath, ws);
|
|
492
|
+
if (treePath.length === 0) {
|
|
493
|
+
throw new Error('Cannot get dataset at root path - root is always a tree');
|
|
494
|
+
}
|
|
495
|
+
// Traverse to the path
|
|
496
|
+
const { structure, ref } = await traverse(repoPath, rootHash, rootStructure, treePath);
|
|
497
|
+
// Must be a value structure
|
|
498
|
+
if (structure.type !== 'value') {
|
|
499
|
+
const pathStr = treePath.map(s => s.value).join('.');
|
|
500
|
+
throw new Error(`Path '${pathStr}' points to a tree, not a dataset`);
|
|
501
|
+
}
|
|
502
|
+
// Return ref type and hash
|
|
503
|
+
if (ref.type === 'unassigned' || ref.type === 'null') {
|
|
504
|
+
return { refType: ref.type, hash: null };
|
|
505
|
+
}
|
|
506
|
+
if (ref.type === 'tree') {
|
|
507
|
+
const pathStr = treePath.map(s => s.value).join('.');
|
|
508
|
+
throw new Error(`Path '${pathStr}' structure says value but ref is tree`);
|
|
509
|
+
}
|
|
510
|
+
return { refType: ref.type, hash: ref.value };
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Set a dataset at a path within a workspace using a pre-computed hash.
|
|
514
|
+
*
|
|
515
|
+
* Unlike workspaceSetDataset which encodes a value, this takes a hash
|
|
516
|
+
* directly. Useful for dataflow execution which already has the output hash.
|
|
517
|
+
*
|
|
518
|
+
* @param repoPath - Path to .e3 repository
|
|
519
|
+
* @param ws - Workspace name
|
|
520
|
+
* @param treePath - Path to the dataset
|
|
521
|
+
* @param valueHash - Hash of the dataset value already in the object store
|
|
522
|
+
* @throws If workspace not deployed, path invalid, or path points to a tree
|
|
523
|
+
*/
|
|
524
|
+
export async function workspaceSetDatasetByHash(repoPath, ws, treePath, valueHash) {
|
|
525
|
+
if (treePath.length === 0) {
|
|
526
|
+
throw new Error('Cannot set dataset at root path - root is always a tree');
|
|
527
|
+
}
|
|
528
|
+
const state = await readWorkspaceState(repoPath, ws);
|
|
529
|
+
// Read the deployed package object to get the structure
|
|
530
|
+
const pkgData = await objectRead(repoPath, state.packageHash);
|
|
531
|
+
const decoder = decodeBeast2For(PackageObjectType);
|
|
532
|
+
const pkgObject = decoder(Buffer.from(pkgData));
|
|
533
|
+
const rootStructure = pkgObject.data.structure;
|
|
534
|
+
// Validate that the path leads to a value structure
|
|
535
|
+
let currentStructure = rootStructure;
|
|
536
|
+
for (let i = 0; i < treePath.length; i++) {
|
|
537
|
+
const segment = treePath[i];
|
|
538
|
+
if (segment.type !== 'field') {
|
|
539
|
+
throw new Error(`Unsupported path segment type: ${segment.type}`);
|
|
540
|
+
}
|
|
541
|
+
if (currentStructure.type !== 'struct') {
|
|
542
|
+
const pathSoFar = treePath.slice(0, i).map(s => s.value).join('.');
|
|
543
|
+
throw new Error(`Cannot descend into non-struct at path '${pathSoFar}'`);
|
|
544
|
+
}
|
|
545
|
+
const childStructure = currentStructure.value.get(segment.value);
|
|
546
|
+
if (!childStructure) {
|
|
547
|
+
const pathSoFar = treePath.slice(0, i).map(s => s.value).join('.');
|
|
548
|
+
const available = Array.from(currentStructure.value.keys()).join(', ');
|
|
549
|
+
throw new Error(`Field '${segment.value}' not found at '${pathSoFar}'. Available: ${available}`);
|
|
550
|
+
}
|
|
551
|
+
currentStructure = childStructure;
|
|
552
|
+
}
|
|
553
|
+
// Final structure must be a value
|
|
554
|
+
if (currentStructure.type !== 'value') {
|
|
555
|
+
const pathStr = treePath.map(s => s.value).join('.');
|
|
556
|
+
throw new Error(`Path '${pathStr}' points to a tree, not a dataset`);
|
|
557
|
+
}
|
|
558
|
+
// Rebuild the tree path from leaf to root (structural sharing)
|
|
559
|
+
// Collect all tree hashes and structures along the path
|
|
560
|
+
const treeInfos = [];
|
|
561
|
+
let currentHash = state.rootHash;
|
|
562
|
+
currentStructure = rootStructure;
|
|
563
|
+
// Read all trees along the path (except the last segment which is the dataset)
|
|
564
|
+
for (let i = 0; i < treePath.length - 1; i++) {
|
|
565
|
+
treeInfos.push({ hash: currentHash, structure: currentStructure });
|
|
566
|
+
const segment = treePath[i];
|
|
567
|
+
const treeObject = await treeRead(repoPath, currentHash, currentStructure);
|
|
568
|
+
const childRef = treeObject[segment.value];
|
|
569
|
+
if (!childRef || childRef.type !== 'tree') {
|
|
570
|
+
throw new Error(`Expected tree ref at path segment ${i}`);
|
|
571
|
+
}
|
|
572
|
+
currentHash = childRef.value;
|
|
573
|
+
currentStructure = currentStructure.value.get(segment.value);
|
|
574
|
+
}
|
|
575
|
+
// Add the final tree that contains the dataset
|
|
576
|
+
treeInfos.push({ hash: currentHash, structure: currentStructure });
|
|
577
|
+
// Now rebuild from leaf to root
|
|
578
|
+
// Start with the provided value hash as the new ref
|
|
579
|
+
let newRef = { type: 'value', value: valueHash };
|
|
580
|
+
for (let i = treeInfos.length - 1; i >= 0; i--) {
|
|
581
|
+
const { hash, structure } = treeInfos[i];
|
|
582
|
+
const fieldName = treePath[i].value;
|
|
583
|
+
// Read the current tree
|
|
584
|
+
const treeObject = await treeRead(repoPath, hash, structure);
|
|
585
|
+
// Create modified tree with the new ref
|
|
586
|
+
const newTreeObject = {
|
|
587
|
+
...treeObject,
|
|
588
|
+
[fieldName]: newRef,
|
|
589
|
+
};
|
|
590
|
+
// Write the new tree
|
|
591
|
+
const newTreeHash = await treeWrite(repoPath, newTreeObject, structure);
|
|
592
|
+
// This becomes the new ref for the parent
|
|
593
|
+
newRef = { type: 'tree', value: newTreeHash };
|
|
594
|
+
}
|
|
595
|
+
// The final newRef is always a tree ref pointing to the new root
|
|
596
|
+
if (newRef.type !== 'tree' || newRef.value === null) {
|
|
597
|
+
throw new Error('Internal error: expected tree ref after rebuilding path');
|
|
598
|
+
}
|
|
599
|
+
const newRootHash = newRef.value;
|
|
600
|
+
// Update workspace state atomically
|
|
601
|
+
await writeWorkspaceState(repoPath, ws, {
|
|
602
|
+
...state,
|
|
603
|
+
rootHash: newRootHash,
|
|
604
|
+
rootUpdatedAt: new Date(),
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
//# sourceMappingURL=trees.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trees.js","sourceRoot":"","sources":["../../src/trees.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,eAAe,EACf,UAAU,GAGX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAoE,MAAM,mBAAmB,CAAC;AACzJ,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EAEzB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAU7B;;;;;;;;GAQG;AACH,SAAS,qBAAqB,CAAC,SAAoB;IACjD,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,MAAM,GAAuC,EAAE,CAAC;QACtD,KAAK,MAAM,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YAC/C,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;QAClC,CAAC;QACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;SAAM,IAAI,SAAS,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;IACnG,CAAC;SAAM,CAAC;QACN,MAAM,IAA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