@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.
Files changed (55) hide show
  1. package/LICENSE.md +50 -0
  2. package/README.md +76 -0
  3. package/dist/src/dataflow.d.ts +96 -0
  4. package/dist/src/dataflow.d.ts.map +1 -0
  5. package/dist/src/dataflow.js +433 -0
  6. package/dist/src/dataflow.js.map +1 -0
  7. package/dist/src/errors.d.ts +87 -0
  8. package/dist/src/errors.d.ts.map +1 -0
  9. package/dist/src/errors.js +178 -0
  10. package/dist/src/errors.js.map +1 -0
  11. package/dist/src/executions.d.ts +163 -0
  12. package/dist/src/executions.d.ts.map +1 -0
  13. package/dist/src/executions.js +535 -0
  14. package/dist/src/executions.js.map +1 -0
  15. package/dist/src/formats.d.ts +38 -0
  16. package/dist/src/formats.d.ts.map +1 -0
  17. package/dist/src/formats.js +115 -0
  18. package/dist/src/formats.js.map +1 -0
  19. package/dist/src/gc.d.ts +54 -0
  20. package/dist/src/gc.d.ts.map +1 -0
  21. package/dist/src/gc.js +232 -0
  22. package/dist/src/gc.js.map +1 -0
  23. package/dist/src/index.d.ts +23 -0
  24. package/dist/src/index.d.ts.map +1 -0
  25. package/dist/src/index.js +68 -0
  26. package/dist/src/index.js.map +1 -0
  27. package/dist/src/objects.d.ts +62 -0
  28. package/dist/src/objects.d.ts.map +1 -0
  29. package/dist/src/objects.js +245 -0
  30. package/dist/src/objects.js.map +1 -0
  31. package/dist/src/packages.d.ts +85 -0
  32. package/dist/src/packages.d.ts.map +1 -0
  33. package/dist/src/packages.js +355 -0
  34. package/dist/src/packages.js.map +1 -0
  35. package/dist/src/repository.d.ts +38 -0
  36. package/dist/src/repository.d.ts.map +1 -0
  37. package/dist/src/repository.js +103 -0
  38. package/dist/src/repository.js.map +1 -0
  39. package/dist/src/tasks.d.ts +63 -0
  40. package/dist/src/tasks.d.ts.map +1 -0
  41. package/dist/src/tasks.js +145 -0
  42. package/dist/src/tasks.js.map +1 -0
  43. package/dist/src/test-helpers.d.ts +44 -0
  44. package/dist/src/test-helpers.d.ts.map +1 -0
  45. package/dist/src/test-helpers.js +141 -0
  46. package/dist/src/test-helpers.js.map +1 -0
  47. package/dist/src/trees.d.ts +156 -0
  48. package/dist/src/trees.d.ts.map +1 -0
  49. package/dist/src/trees.js +607 -0
  50. package/dist/src/trees.js.map +1 -0
  51. package/dist/src/workspaces.d.ts +116 -0
  52. package/dist/src/workspaces.d.ts.map +1 -0
  53. package/dist/src/workspaces.js +356 -0
  54. package/dist/src/workspaces.js.map +1 -0
  55. package/package.json +50 -0
@@ -0,0 +1,535 @@
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
+ * Task execution for e3 repositories.
7
+ *
8
+ * Provides APIs for:
9
+ * - Computing execution identity (inputsHash)
10
+ * - Querying execution status and results
11
+ * - Reading execution logs
12
+ * - Running tasks with caching
13
+ */
14
+ import * as fs from 'fs/promises';
15
+ import * as path from 'path';
16
+ import { spawn } from 'child_process';
17
+ import { createWriteStream } from 'fs';
18
+ import { tmpdir } from 'os';
19
+ import { decodeBeast2For, encodeBeast2For, variant, EastIR, IRType } from '@elaraai/east';
20
+ import { ExecutionStatusType, TaskObjectType, } from '@elaraai/e3-types';
21
+ import { computeHash, objectRead, objectWrite } from './objects.js';
22
+ import { ExecutionCorruptError, isNotFoundError } from './errors.js';
23
+ // ============================================================================
24
+ // Execution Identity
25
+ // ============================================================================
26
+ /**
27
+ * Compute the combined hash of input hashes.
28
+ *
29
+ * Used to create a unique identifier for an execution based on its inputs.
30
+ * The order of inputs matters - different orderings produce different hashes.
31
+ *
32
+ * @param inputHashes - Array of input dataset hashes
33
+ * @returns Combined SHA256 hash
34
+ */
35
+ export function inputsHash(inputHashes) {
36
+ const data = inputHashes.join('\0');
37
+ return computeHash(new TextEncoder().encode(data));
38
+ }
39
+ /**
40
+ * Get the filesystem path for an execution directory.
41
+ *
42
+ * @param repoPath - Path to .e3 repository
43
+ * @param taskHash - Hash of the task object
44
+ * @param inHash - Combined hash of input hashes
45
+ * @returns Path to execution directory: executions/<taskHash>/<inputsHash>/
46
+ */
47
+ export function executionPath(repoPath, taskHash, inHash) {
48
+ return path.join(repoPath, 'executions', taskHash, inHash);
49
+ }
50
+ // ============================================================================
51
+ // Execution Status
52
+ // ============================================================================
53
+ /**
54
+ * Get execution status.
55
+ *
56
+ * @param repoPath - Path to .e3 repository
57
+ * @param taskHash - Hash of the task object
58
+ * @param inHash - Combined hash of input hashes
59
+ * @returns ExecutionStatus or null if execution doesn't exist
60
+ * @throws {ExecutionCorruptError} If status file exists but cannot be decoded
61
+ */
62
+ export async function executionGet(repoPath, taskHash, inHash) {
63
+ const execDir = executionPath(repoPath, taskHash, inHash);
64
+ const statusPath = path.join(execDir, 'status.beast2');
65
+ let data;
66
+ try {
67
+ data = await fs.readFile(statusPath);
68
+ }
69
+ catch (err) {
70
+ if (isNotFoundError(err)) {
71
+ return null;
72
+ }
73
+ throw err;
74
+ }
75
+ try {
76
+ const decoder = decodeBeast2For(ExecutionStatusType);
77
+ return decoder(data);
78
+ }
79
+ catch (err) {
80
+ throw new ExecutionCorruptError(taskHash, inHash, err instanceof Error ? err : new Error(String(err)));
81
+ }
82
+ }
83
+ /**
84
+ * Get output hash for a completed execution.
85
+ *
86
+ * @param repoPath - Path to .e3 repository
87
+ * @param taskHash - Hash of the task object
88
+ * @param inHash - Combined hash of input hashes
89
+ * @returns Output hash or null if not complete or failed
90
+ */
91
+ export async function executionGetOutput(repoPath, taskHash, inHash) {
92
+ const execDir = executionPath(repoPath, taskHash, inHash);
93
+ const outputPath = path.join(execDir, 'output');
94
+ try {
95
+ const content = await fs.readFile(outputPath, 'utf-8');
96
+ return content.trim();
97
+ }
98
+ catch (err) {
99
+ if (isNotFoundError(err)) {
100
+ return null;
101
+ }
102
+ throw err;
103
+ }
104
+ }
105
+ /**
106
+ * List all input hashes that have executions for a given task.
107
+ *
108
+ * @param repoPath - Path to .e3 repository
109
+ * @param taskHash - Hash of the task object
110
+ * @returns Array of input hashes
111
+ */
112
+ export async function executionListForTask(repoPath, taskHash) {
113
+ const taskDir = path.join(repoPath, 'executions', taskHash);
114
+ try {
115
+ const entries = await fs.readdir(taskDir);
116
+ // Filter to only valid hash directories (64 hex chars)
117
+ return entries.filter((e) => /^[a-f0-9]{64}$/.test(e));
118
+ }
119
+ catch {
120
+ return [];
121
+ }
122
+ }
123
+ /**
124
+ * List all executions in the repository.
125
+ *
126
+ * @param repoPath - Path to .e3 repository
127
+ * @returns Array of { taskHash, inputsHash } objects
128
+ */
129
+ export async function executionList(repoPath) {
130
+ const executionsDir = path.join(repoPath, 'executions');
131
+ const result = [];
132
+ try {
133
+ const taskDirs = await fs.readdir(executionsDir);
134
+ for (const taskHash of taskDirs) {
135
+ if (!/^[a-f0-9]{64}$/.test(taskHash))
136
+ continue;
137
+ const taskDir = path.join(executionsDir, taskHash);
138
+ const stat = await fs.stat(taskDir);
139
+ if (!stat.isDirectory())
140
+ continue;
141
+ const inputsDirs = await fs.readdir(taskDir);
142
+ for (const inputsHash of inputsDirs) {
143
+ if (/^[a-f0-9]{64}$/.test(inputsHash)) {
144
+ result.push({ taskHash, inputsHash });
145
+ }
146
+ }
147
+ }
148
+ }
149
+ catch {
150
+ // Executions directory doesn't exist
151
+ }
152
+ return result;
153
+ }
154
+ /**
155
+ * Read execution logs with pagination support.
156
+ *
157
+ * @param repoPath - Path to .e3 repository
158
+ * @param taskHash - Hash of the task object
159
+ * @param inHash - Combined hash of input hashes
160
+ * @param stream - Which log stream to read ('stdout' or 'stderr')
161
+ * @param options - Pagination options
162
+ * @returns Log chunk with data and metadata
163
+ */
164
+ export async function executionReadLog(repoPath, taskHash, inHash, stream, options = {}) {
165
+ const execDir = executionPath(repoPath, taskHash, inHash);
166
+ const logPath = path.join(execDir, `${stream}.txt`);
167
+ const offset = options.offset ?? 0;
168
+ const limit = options.limit ?? 65536; // 64KB default
169
+ try {
170
+ const stat = await fs.stat(logPath);
171
+ const totalSize = stat.size;
172
+ // Open file and read chunk
173
+ const fd = await fs.open(logPath, 'r');
174
+ try {
175
+ const buffer = Buffer.alloc(Math.min(limit, totalSize - offset));
176
+ const { bytesRead } = await fd.read(buffer, 0, buffer.length, offset);
177
+ return {
178
+ data: buffer.slice(0, bytesRead).toString('utf-8'),
179
+ offset,
180
+ size: bytesRead,
181
+ totalSize,
182
+ complete: offset + bytesRead >= totalSize,
183
+ };
184
+ }
185
+ finally {
186
+ await fd.close();
187
+ }
188
+ }
189
+ catch {
190
+ // Log file doesn't exist yet
191
+ return {
192
+ data: '',
193
+ offset: 0,
194
+ size: 0,
195
+ totalSize: 0,
196
+ complete: true,
197
+ };
198
+ }
199
+ }
200
+ // ============================================================================
201
+ // Command IR Evaluation
202
+ // ============================================================================
203
+ /**
204
+ * Evaluate command IR to get exec args.
205
+ *
206
+ * The IR is an East function: (inputs: Array<String>, output: String) -> Array<String>
207
+ *
208
+ * @param repoPath - Path to .e3 repository
209
+ * @param commandIrHash - Hash of the IR object
210
+ * @param inputPaths - Paths to staged input files
211
+ * @param outputPath - Path where output should be written
212
+ * @returns Array of strings to exec
213
+ */
214
+ export async function evaluateCommandIr(repoPath, commandIrHash, inputPaths, outputPath) {
215
+ const irData = await objectRead(repoPath, commandIrHash);
216
+ try {
217
+ // Decode the IR from beast2 format
218
+ const decoder = decodeBeast2For(IRType);
219
+ const ir = decoder(Buffer.from(irData));
220
+ // Create EastIR wrapper and compile it (no platform functions needed)
221
+ const eastIr = new EastIR(ir);
222
+ const compiledFn = eastIr.compile([]);
223
+ // Execute the compiled function with inputPaths and outputPath
224
+ const result = compiledFn(inputPaths, outputPath);
225
+ // Validate result is an array of strings
226
+ if (!Array.isArray(result)) {
227
+ throw new Error(`Command IR returned ${typeof result}, expected array`);
228
+ }
229
+ for (const item of result) {
230
+ if (typeof item !== 'string') {
231
+ throw new Error(`Command IR returned array containing ${typeof item}, expected strings`);
232
+ }
233
+ }
234
+ return result;
235
+ }
236
+ catch (err) {
237
+ throw new Error(`Failed to evaluate command IR: ${err}`);
238
+ }
239
+ }
240
+ // ============================================================================
241
+ // Process Identification (for crash detection)
242
+ // ============================================================================
243
+ /**
244
+ * Get the current system boot ID
245
+ */
246
+ async function getBootId() {
247
+ try {
248
+ const data = await fs.readFile('/proc/sys/kernel/random/boot_id', 'utf-8');
249
+ return data.trim();
250
+ }
251
+ catch {
252
+ // Not on Linux, use a placeholder
253
+ return 'unknown-boot-id';
254
+ }
255
+ }
256
+ /**
257
+ * Get process start time from /proc/<pid>/stat
258
+ * Returns the starttime field (field 22) which is jiffies since boot
259
+ */
260
+ async function getPidStartTime(pid) {
261
+ try {
262
+ const data = await fs.readFile(`/proc/${pid}/stat`, 'utf-8');
263
+ // Fields are space-separated, but comm (field 2) can contain spaces and is in parens
264
+ // Find the closing paren, then split the rest
265
+ const closeParen = data.lastIndexOf(')');
266
+ const fields = data.slice(closeParen + 2).split(' ');
267
+ // After the closing paren, field index 0 is state (field 3), so starttime is at index 19
268
+ // (field 22 - 3 = 19)
269
+ return parseInt(fields[19], 10);
270
+ }
271
+ catch {
272
+ return 0;
273
+ }
274
+ }
275
+ /**
276
+ * Check if a process is still alive based on stored identification
277
+ */
278
+ export async function isProcessAlive(pid, pidStartTime, bootId) {
279
+ // Different boot? Process is dead
280
+ const currentBootId = await getBootId();
281
+ if (currentBootId !== bootId)
282
+ return false;
283
+ // Check if PID exists and has same start time
284
+ const currentStartTime = await getPidStartTime(pid);
285
+ if (currentStartTime === 0)
286
+ return false; // PID doesn't exist
287
+ if (currentStartTime !== pidStartTime)
288
+ return false; // PID reused
289
+ return true;
290
+ }
291
+ /**
292
+ * Execute a single task.
293
+ *
294
+ * This is the core execution primitive. It:
295
+ * 1. Computes the execution identity from task + inputs
296
+ * 2. Checks cache (unless force=true)
297
+ * 3. Marshals inputs to a scratch directory
298
+ * 4. Evaluates command IR to get exec args
299
+ * 5. Runs the command
300
+ * 6. Stores the output and updates status
301
+ *
302
+ * @param repoPath - Path to .e3 repository
303
+ * @param taskHash - Hash of the task object
304
+ * @param inputHashes - Array of input dataset hashes
305
+ * @param options - Execution options
306
+ * @returns Execution result
307
+ */
308
+ export async function taskExecute(repoPath, taskHash, inputHashes, options = {}) {
309
+ const inHash = inputsHash(inputHashes);
310
+ const execDir = executionPath(repoPath, taskHash, inHash);
311
+ const startTime = Date.now();
312
+ // Step 1: Check cache (unless force)
313
+ if (!options.force) {
314
+ const existingOutput = await executionGetOutput(repoPath, taskHash, inHash);
315
+ if (existingOutput !== null) {
316
+ const status = await executionGet(repoPath, taskHash, inHash);
317
+ if (status && status.type === 'success') {
318
+ return {
319
+ inputsHash: inHash,
320
+ cached: true,
321
+ state: 'success',
322
+ outputHash: existingOutput,
323
+ exitCode: 0,
324
+ duration: 0,
325
+ error: null,
326
+ };
327
+ }
328
+ }
329
+ }
330
+ // Step 2: Read task object
331
+ let task;
332
+ try {
333
+ const taskData = await objectRead(repoPath, taskHash);
334
+ const decoder = decodeBeast2For(TaskObjectType);
335
+ task = decoder(Buffer.from(taskData));
336
+ }
337
+ catch (err) {
338
+ return {
339
+ inputsHash: inHash,
340
+ cached: false,
341
+ state: 'error',
342
+ outputHash: null,
343
+ exitCode: null,
344
+ duration: Date.now() - startTime,
345
+ error: `Failed to read task object: ${err}`,
346
+ };
347
+ }
348
+ // Step 3: Create scratch directory
349
+ const scratchDir = path.join(tmpdir(), `e3-exec-${taskHash.slice(0, 8)}-${inHash.slice(0, 8)}-${Date.now()}`);
350
+ await fs.mkdir(scratchDir, { recursive: true });
351
+ try {
352
+ // Step 4: Marshal inputs to scratch dir
353
+ const inputPaths = [];
354
+ for (let i = 0; i < inputHashes.length; i++) {
355
+ const inputPath = path.join(scratchDir, `input-${i}.beast2`);
356
+ const inputData = await objectRead(repoPath, inputHashes[i]);
357
+ await fs.writeFile(inputPath, inputData);
358
+ inputPaths.push(inputPath);
359
+ }
360
+ // Step 5: Evaluate command IR to get exec args
361
+ const outputPath = path.join(scratchDir, 'output.beast2');
362
+ let args;
363
+ try {
364
+ args = await evaluateCommandIr(repoPath, task.commandIr, inputPaths, outputPath);
365
+ }
366
+ catch (err) {
367
+ return {
368
+ inputsHash: inHash,
369
+ cached: false,
370
+ state: 'error',
371
+ outputHash: null,
372
+ exitCode: null,
373
+ duration: Date.now() - startTime,
374
+ error: `Failed to evaluate command IR: ${err}`,
375
+ };
376
+ }
377
+ if (args.length === 0) {
378
+ return {
379
+ inputsHash: inHash,
380
+ cached: false,
381
+ state: 'error',
382
+ outputHash: null,
383
+ exitCode: null,
384
+ duration: Date.now() - startTime,
385
+ error: 'Command IR produced empty command',
386
+ };
387
+ }
388
+ // Step 6: Create execution directory
389
+ await fs.mkdir(execDir, { recursive: true });
390
+ // Step 7: Get boot ID for crash detection
391
+ const bootId = await getBootId();
392
+ // Step 8: Execute command
393
+ const result = await runCommand(args, execDir, inputHashes, bootId, options);
394
+ // Step 9: Handle result
395
+ if (result.exitCode === 0) {
396
+ // Success - read and store output
397
+ try {
398
+ const outputData = await fs.readFile(outputPath);
399
+ const outputHash = await objectWrite(repoPath, outputData);
400
+ // Write output ref
401
+ await fs.writeFile(path.join(execDir, 'output'), outputHash + '\n');
402
+ // Write success status
403
+ const status = variant('success', {
404
+ inputHashes,
405
+ outputHash,
406
+ startedAt: new Date(startTime),
407
+ completedAt: new Date(),
408
+ });
409
+ const encoder = encodeBeast2For(ExecutionStatusType);
410
+ await fs.writeFile(path.join(execDir, 'status.beast2'), encoder(status));
411
+ return {
412
+ inputsHash: inHash,
413
+ cached: false,
414
+ state: 'success',
415
+ outputHash,
416
+ exitCode: 0,
417
+ duration: Date.now() - startTime,
418
+ error: null,
419
+ };
420
+ }
421
+ catch (err) {
422
+ // Output file missing or unreadable
423
+ const status = variant('error', {
424
+ inputHashes,
425
+ startedAt: new Date(startTime),
426
+ completedAt: new Date(),
427
+ message: `Failed to read output: ${err}`,
428
+ });
429
+ const encoder = encodeBeast2For(ExecutionStatusType);
430
+ await fs.writeFile(path.join(execDir, 'status.beast2'), encoder(status));
431
+ return {
432
+ inputsHash: inHash,
433
+ cached: false,
434
+ state: 'error',
435
+ outputHash: null,
436
+ exitCode: 0,
437
+ duration: Date.now() - startTime,
438
+ error: `Failed to read output: ${err}`,
439
+ };
440
+ }
441
+ }
442
+ else {
443
+ // Failed - write failed status
444
+ const status = variant('failed', {
445
+ inputHashes,
446
+ startedAt: new Date(startTime),
447
+ completedAt: new Date(),
448
+ exitCode: BigInt(result?.exitCode ?? -1),
449
+ });
450
+ const encoder = encodeBeast2For(ExecutionStatusType);
451
+ await fs.writeFile(path.join(execDir, 'status.beast2'), encoder(status));
452
+ return {
453
+ inputsHash: inHash,
454
+ cached: false,
455
+ state: 'failed',
456
+ outputHash: null,
457
+ exitCode: result.exitCode,
458
+ duration: Date.now() - startTime,
459
+ error: result.error,
460
+ };
461
+ }
462
+ }
463
+ finally {
464
+ // Cleanup scratch directory
465
+ try {
466
+ await fs.rm(scratchDir, { recursive: true, force: true });
467
+ }
468
+ catch {
469
+ // Ignore cleanup errors
470
+ }
471
+ }
472
+ }
473
+ /**
474
+ * Run a command and capture output
475
+ */
476
+ async function runCommand(args, execDir, inputHashes, bootId, options) {
477
+ const [cmd, ...cmdArgs] = args;
478
+ const child = spawn(cmd, cmdArgs, {
479
+ stdio: ['ignore', 'pipe', 'pipe'],
480
+ });
481
+ // Set up event listeners IMMEDIATELY before any async work
482
+ // to avoid missing events if the process completes quickly
483
+ const resultPromise = new Promise((resolve) => {
484
+ child.on('error', (err) => {
485
+ resolve({ exitCode: null, error: `Failed to spawn: ${err.message}` });
486
+ });
487
+ child.on('close', (code) => {
488
+ resolve({ exitCode: code, error: code !== 0 ? `Exit code: ${code}` : null });
489
+ });
490
+ });
491
+ // Open log files for writing
492
+ const stdoutStream = createWriteStream(path.join(execDir, 'stdout.txt'));
493
+ const stderrStream = createWriteStream(path.join(execDir, 'stderr.txt'));
494
+ // Tee stdout
495
+ child.stdout?.on('data', (data) => {
496
+ stdoutStream.write(data);
497
+ if (options.onStdout) {
498
+ options.onStdout(data.toString('utf-8'));
499
+ }
500
+ });
501
+ // Tee stderr
502
+ child.stderr?.on('data', (data) => {
503
+ stderrStream.write(data);
504
+ if (options.onStderr) {
505
+ options.onStderr(data.toString('utf-8'));
506
+ }
507
+ });
508
+ // Handle timeout
509
+ let timeoutId;
510
+ if (options.timeout) {
511
+ timeoutId = setTimeout(() => {
512
+ child.kill('SIGKILL');
513
+ }, options.timeout);
514
+ }
515
+ // Write running status with actual child PID (can be async now)
516
+ const pidStartTime = await getPidStartTime(child.pid);
517
+ const status = variant('running', {
518
+ inputHashes,
519
+ startedAt: new Date(),
520
+ pid: BigInt(child.pid ?? -1),
521
+ pidStartTime: BigInt(pidStartTime ?? -1),
522
+ bootId,
523
+ });
524
+ const encoder = encodeBeast2For(ExecutionStatusType);
525
+ await fs.writeFile(path.join(execDir, 'status.beast2'), encoder(status));
526
+ // Wait for process to complete
527
+ const result = await resultPromise;
528
+ // Cleanup
529
+ if (timeoutId)
530
+ clearTimeout(timeoutId);
531
+ stdoutStream.end();
532
+ stderrStream.end();
533
+ return result;
534
+ }
535
+ //# sourceMappingURL=executions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executions.js","sourceRoot":"","sources":["../../src/executions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1F,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,MAAM,CAAC,CAAC,CAAC;IAEzE,+BAA+B;IAC/B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;IAEnC,UAAU;IACV,IAAI,SAAS;QAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACvC,YAAY,CAAC,GAAG,EAAE,CAAC;IACnB,YAAY,CAAC,GAAG,EAAE,CAAC;IAEnB,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,38 @@
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
+ import { type IR } from '@elaraai/east';
6
+ /**
7
+ * Load IR from a file (.json, .east, or .beast2)
8
+ */
9
+ export declare function loadIR(filePath: string): Promise<IR>;
10
+ /**
11
+ * Encode IR to Beast2 format
12
+ */
13
+ export declare function irToBeast2(ir: IR): Uint8Array;
14
+ /**
15
+ * Write a ReadableStream to a file
16
+ */
17
+ export declare function writeStreamToFile(stream: ReadableStream<Uint8Array>, filePath: string): Promise<void>;
18
+ /**
19
+ * Load a value from Beast2 file
20
+ */
21
+ export declare function loadBeast2(filePath: string, type: any): Promise<any>;
22
+ /**
23
+ * Format a value as .east format
24
+ */
25
+ export declare function formatEast(value: any, type: any): string;
26
+ /**
27
+ * Parse a value from .east format
28
+ */
29
+ export declare function parseEast(text: string, type: any): any;
30
+ /**
31
+ * Load a value from any format (.json, .east, or .beast2)
32
+ */
33
+ export declare function loadValue(filePath: string, type: any): Promise<any>;
34
+ /**
35
+ * Encode a value to Beast2 format
36
+ */
37
+ export declare function valueToBeast2(value: any, type: any): Uint8Array;
38
+ //# sourceMappingURL=formats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../../src/formats.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAOL,KAAK,EAAE,EACR,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,CA4B1D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,UAAU,CAG7C;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAI1E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,MAAM,CAGxD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,CAStD;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAkBzE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,UAAU,CAG/D"}