@elaraai/e3-core 0.0.2-beta.20 → 0.0.2-beta.21

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 (114) hide show
  1. package/README.md +25 -22
  2. package/dist/src/dataflow/api-compat.d.ts +90 -0
  3. package/dist/src/dataflow/api-compat.d.ts.map +1 -0
  4. package/dist/src/dataflow/api-compat.js +134 -0
  5. package/dist/src/dataflow/api-compat.js.map +1 -0
  6. package/dist/src/dataflow/index.d.ts +18 -0
  7. package/dist/src/dataflow/index.d.ts.map +1 -0
  8. package/dist/src/dataflow/index.js +23 -0
  9. package/dist/src/dataflow/index.js.map +1 -0
  10. package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts +53 -0
  11. package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts.map +1 -0
  12. package/dist/src/dataflow/orchestrator/LocalOrchestrator.js +416 -0
  13. package/dist/src/dataflow/orchestrator/LocalOrchestrator.js.map +1 -0
  14. package/dist/src/dataflow/orchestrator/index.d.ts +12 -0
  15. package/dist/src/dataflow/orchestrator/index.d.ts.map +1 -0
  16. package/dist/src/dataflow/orchestrator/index.js +12 -0
  17. package/dist/src/dataflow/orchestrator/index.js.map +1 -0
  18. package/dist/src/dataflow/orchestrator/interfaces.d.ts +157 -0
  19. package/dist/src/dataflow/orchestrator/interfaces.d.ts.map +1 -0
  20. package/dist/src/dataflow/orchestrator/interfaces.js +51 -0
  21. package/dist/src/dataflow/orchestrator/interfaces.js.map +1 -0
  22. package/dist/src/dataflow/state-store/FileStateStore.d.ts +67 -0
  23. package/dist/src/dataflow/state-store/FileStateStore.d.ts.map +1 -0
  24. package/dist/src/dataflow/state-store/FileStateStore.js +286 -0
  25. package/dist/src/dataflow/state-store/FileStateStore.js.map +1 -0
  26. package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts +42 -0
  27. package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts.map +1 -0
  28. package/dist/src/dataflow/state-store/InMemoryStateStore.js +214 -0
  29. package/dist/src/dataflow/state-store/InMemoryStateStore.js.map +1 -0
  30. package/dist/src/dataflow/state-store/index.d.ts +13 -0
  31. package/dist/src/dataflow/state-store/index.d.ts.map +1 -0
  32. package/dist/src/dataflow/state-store/index.js +13 -0
  33. package/dist/src/dataflow/state-store/index.js.map +1 -0
  34. package/dist/src/dataflow/state-store/interfaces.d.ts +159 -0
  35. package/dist/src/dataflow/state-store/interfaces.d.ts.map +1 -0
  36. package/dist/src/dataflow/state-store/interfaces.js +6 -0
  37. package/dist/src/dataflow/state-store/interfaces.js.map +1 -0
  38. package/dist/src/dataflow/steps.d.ts +176 -0
  39. package/dist/src/dataflow/steps.d.ts.map +1 -0
  40. package/dist/src/dataflow/steps.js +528 -0
  41. package/dist/src/dataflow/steps.js.map +1 -0
  42. package/dist/src/dataflow/types.d.ts +116 -0
  43. package/dist/src/dataflow/types.d.ts.map +1 -0
  44. package/dist/src/dataflow/types.js +7 -0
  45. package/dist/src/dataflow/types.js.map +1 -0
  46. package/dist/src/dataflow.d.ts +9 -0
  47. package/dist/src/dataflow.d.ts.map +1 -1
  48. package/dist/src/dataflow.js +11 -6
  49. package/dist/src/dataflow.js.map +1 -1
  50. package/dist/src/execution/LocalTaskRunner.d.ts +71 -0
  51. package/dist/src/execution/LocalTaskRunner.d.ts.map +1 -0
  52. package/dist/src/execution/LocalTaskRunner.js +360 -0
  53. package/dist/src/execution/LocalTaskRunner.js.map +1 -0
  54. package/dist/src/execution/MockTaskRunner.d.ts +49 -0
  55. package/dist/src/execution/MockTaskRunner.d.ts.map +1 -0
  56. package/dist/src/execution/MockTaskRunner.js +55 -0
  57. package/dist/src/execution/MockTaskRunner.js.map +1 -0
  58. package/dist/src/execution/index.d.ts +2 -0
  59. package/dist/src/execution/index.d.ts.map +1 -1
  60. package/dist/src/execution/index.js +3 -1
  61. package/dist/src/execution/index.js.map +1 -1
  62. package/dist/src/execution/processHelpers.d.ts +20 -0
  63. package/dist/src/execution/processHelpers.d.ts.map +1 -0
  64. package/dist/src/execution/processHelpers.js +62 -0
  65. package/dist/src/execution/processHelpers.js.map +1 -0
  66. package/dist/src/executions.d.ts +1 -69
  67. package/dist/src/executions.d.ts.map +1 -1
  68. package/dist/src/executions.js +6 -365
  69. package/dist/src/executions.js.map +1 -1
  70. package/dist/src/index.d.ts +10 -5
  71. package/dist/src/index.d.ts.map +1 -1
  72. package/dist/src/index.js +19 -12
  73. package/dist/src/index.js.map +1 -1
  74. package/dist/src/objects.d.ts +6 -53
  75. package/dist/src/objects.d.ts.map +1 -1
  76. package/dist/src/objects.js +11 -232
  77. package/dist/src/objects.js.map +1 -1
  78. package/dist/src/storage/local/LocalLockService.d.ts +84 -1
  79. package/dist/src/storage/local/LocalLockService.d.ts.map +1 -1
  80. package/dist/src/storage/local/LocalLockService.js +305 -1
  81. package/dist/src/storage/local/LocalLockService.js.map +1 -1
  82. package/dist/src/storage/local/LocalObjectStore.d.ts +33 -1
  83. package/dist/src/storage/local/LocalObjectStore.d.ts.map +1 -1
  84. package/dist/src/storage/local/LocalObjectStore.js +198 -3
  85. package/dist/src/storage/local/LocalObjectStore.js.map +1 -1
  86. package/dist/src/{gc.d.ts → storage/local/gc.d.ts} +1 -1
  87. package/dist/src/storage/local/gc.d.ts.map +1 -0
  88. package/dist/src/{gc.js → storage/local/gc.js} +5 -2
  89. package/dist/src/storage/local/gc.js.map +1 -0
  90. package/dist/src/storage/local/localHelpers.d.ts +25 -0
  91. package/dist/src/storage/local/localHelpers.d.ts.map +1 -0
  92. package/dist/src/storage/local/localHelpers.js +69 -0
  93. package/dist/src/storage/local/localHelpers.js.map +1 -0
  94. package/dist/src/storage/local/repository.d.ts.map +1 -0
  95. package/dist/src/{repository.js → storage/local/repository.js} +6 -0
  96. package/dist/src/storage/local/repository.js.map +1 -0
  97. package/dist/src/test-helpers.js +1 -1
  98. package/dist/src/test-helpers.js.map +1 -1
  99. package/dist/src/trees.d.ts +2 -1
  100. package/dist/src/trees.d.ts.map +1 -1
  101. package/dist/src/trees.js +2 -0
  102. package/dist/src/trees.js.map +1 -1
  103. package/dist/src/workspaceStatus.js +3 -2
  104. package/dist/src/workspaceStatus.js.map +1 -1
  105. package/package.json +3 -3
  106. package/dist/src/gc.d.ts.map +0 -1
  107. package/dist/src/gc.js.map +0 -1
  108. package/dist/src/repository.d.ts.map +0 -1
  109. package/dist/src/repository.js.map +0 -1
  110. package/dist/src/workspaceLock.d.ts +0 -89
  111. package/dist/src/workspaceLock.d.ts.map +0 -1
  112. package/dist/src/workspaceLock.js +0 -307
  113. package/dist/src/workspaceLock.js.map +0 -1
  114. /package/dist/src/{repository.d.ts → storage/local/repository.d.ts} +0 -0
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import type { StorageBackend } from '../storage/interfaces.js';
6
+ import type { TaskRunner, TaskExecuteOptions, TaskResult } from './interfaces.js';
7
+ /**
8
+ * Record of a single task execution call.
9
+ */
10
+ export interface MockTaskCall {
11
+ taskHash: string;
12
+ inputHashes: string[];
13
+ options?: TaskExecuteOptions;
14
+ }
15
+ /**
16
+ * TaskRunner mock for testing dataflow orchestration without spawning processes.
17
+ *
18
+ * Allows configuring responses per task and records all calls for assertions.
19
+ */
20
+ export declare class MockTaskRunner implements TaskRunner {
21
+ private results;
22
+ private calls;
23
+ private defaultResult;
24
+ /**
25
+ * Set result for a specific task hash.
26
+ *
27
+ * @param taskHash - The task hash to configure
28
+ * @param result - Either a static TaskResult or a function that computes result from inputHashes
29
+ */
30
+ setResult(taskHash: string, result: TaskResult | ((inputHashes: string[]) => TaskResult)): void;
31
+ /**
32
+ * Set default result for tasks without specific results configured.
33
+ *
34
+ * @param result - The default TaskResult to return
35
+ */
36
+ setDefaultResult(result: TaskResult): void;
37
+ /**
38
+ * Get all recorded calls.
39
+ *
40
+ * @returns Readonly array of all execute() calls
41
+ */
42
+ getCalls(): readonly MockTaskCall[];
43
+ /**
44
+ * Clear recorded calls.
45
+ */
46
+ clearCalls(): void;
47
+ execute(_storage: StorageBackend, taskHash: string, inputHashes: string[], options?: TaskExecuteOptions): Promise<TaskResult>;
48
+ }
49
+ //# sourceMappingURL=MockTaskRunner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MockTaskRunner.d.ts","sourceRoot":"","sources":["../../../src/execution/MockTaskRunner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED;;;;GAIG;AACH,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,OAAO,CAA2E;IAC1F,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,aAAa,CAA4E;IAEjG;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,UAAU,CAAC,GAAG,IAAI;IAI/F;;;;OAIG;IACH,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAI1C;;;;OAIG;IACH,QAAQ,IAAI,SAAS,YAAY,EAAE;IAInC;;OAEG;IACH,UAAU,IAAI,IAAI;IAKZ,OAAO,CACX,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EAAE,EACrB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,UAAU,CAAC;CASvB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * TaskRunner mock for testing dataflow orchestration without spawning processes.
7
+ *
8
+ * Allows configuring responses per task and records all calls for assertions.
9
+ */
10
+ export class MockTaskRunner {
11
+ results = new Map();
12
+ calls = [];
13
+ defaultResult = { state: 'success', cached: false, outputHash: 'mock-hash' };
14
+ /**
15
+ * Set result for a specific task hash.
16
+ *
17
+ * @param taskHash - The task hash to configure
18
+ * @param result - Either a static TaskResult or a function that computes result from inputHashes
19
+ */
20
+ setResult(taskHash, result) {
21
+ this.results.set(taskHash, result);
22
+ }
23
+ /**
24
+ * Set default result for tasks without specific results configured.
25
+ *
26
+ * @param result - The default TaskResult to return
27
+ */
28
+ setDefaultResult(result) {
29
+ this.defaultResult = result;
30
+ }
31
+ /**
32
+ * Get all recorded calls.
33
+ *
34
+ * @returns Readonly array of all execute() calls
35
+ */
36
+ getCalls() {
37
+ return this.calls;
38
+ }
39
+ /**
40
+ * Clear recorded calls.
41
+ */
42
+ clearCalls() {
43
+ this.calls = [];
44
+ }
45
+ // eslint-disable-next-line @typescript-eslint/require-await
46
+ async execute(_storage, taskHash, inputHashes, options) {
47
+ this.calls.push({ taskHash, inputHashes, options });
48
+ const configured = this.results.get(taskHash);
49
+ if (configured) {
50
+ return typeof configured === 'function' ? configured(inputHashes) : configured;
51
+ }
52
+ return this.defaultResult;
53
+ }
54
+ }
55
+ //# sourceMappingURL=MockTaskRunner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MockTaskRunner.js","sourceRoot":"","sources":["../../../src/execution/MockTaskRunner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;;;GAIG;AACH,MAAM,OAAO,cAAc;IACjB,OAAO,GAAG,IAAI,GAAG,EAAgE,CAAC;IAClF,KAAK,GAAmB,EAAE,CAAC;IAC3B,aAAa,GAAe,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;IAEjG;;;;;OAKG;IACH,SAAS,CAAC,QAAgB,EAAE,MAA4D;QACtF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CAAC,MAAkB;QACjC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,4DAA4D;IAC5D,KAAK,CAAC,OAAO,CACX,QAAwB,EACxB,QAAgB,EAChB,WAAqB,EACrB,OAA4B;QAE5B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;QAEpD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,OAAO,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QACjF,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;CACF"}
@@ -11,4 +11,6 @@
11
11
  * - StepFunctionsDataflowExecutor: AWS Step Functions orchestration (cloud)
12
12
  */
13
13
  export { type TaskExecuteOptions, type TaskResult, type TaskRunner, type ExecutionHandle, type DataflowStatus, type DataflowExecuteOptions, type DataflowExecuteResult, type DataflowExecutor, type TaskGraph, type DataflowGetGraphFn, type DataflowCheckCacheFn, type DataflowWriteOutputFn, type DataflowGetReadyTasksFn, } from './interfaces.js';
14
+ export { LocalTaskRunner } from './LocalTaskRunner.js';
15
+ export { MockTaskRunner, type MockTaskCall } from './MockTaskRunner.js';
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/execution/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EAErB,KAAK,SAAS,EAEd,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,GAC7B,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/execution/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EAErB,KAAK,SAAS,EAEd,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,GAC7B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
@@ -2,5 +2,7 @@
2
2
  * Copyright (c) 2025 Elara AI Pty Ltd
3
3
  * Licensed under BSL 1.1. See LICENSE for details.
4
4
  */
5
- export {};
5
+ // TaskRunner implementations
6
+ export { LocalTaskRunner } from './LocalTaskRunner.js';
7
+ export { MockTaskRunner } from './MockTaskRunner.js';
6
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/execution/index.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/execution/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+BH,6BAA6B;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAqB,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Get the current system boot ID.
7
+ * Used for detecting stale locks/processes after system reboot.
8
+ */
9
+ export declare function getBootId(): Promise<string>;
10
+ /**
11
+ * Get process start time from /proc/<pid>/stat.
12
+ * Returns the starttime field (field 22) which is jiffies since boot.
13
+ * Used together with boot ID to uniquely identify a process (handles PID reuse).
14
+ */
15
+ export declare function getPidStartTime(pid: number): Promise<number>;
16
+ /**
17
+ * Check if a process is still alive based on stored identification
18
+ */
19
+ export declare function isProcessAlive(pid: number, pidStartTime: number, bootId: string): Promise<boolean>;
20
+ //# sourceMappingURL=processHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processHelpers.d.ts","sourceRoot":"","sources":["../../../src/execution/processHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;;GAGG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAQjD;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAalE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAWlB"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Process identification helpers for crash detection.
7
+ *
8
+ * These functions are used by LocalTaskRunner and LocalLockService
9
+ * to detect stale processes and locks after crashes or reboots.
10
+ */
11
+ import * as fs from 'fs/promises';
12
+ /**
13
+ * Get the current system boot ID.
14
+ * Used for detecting stale locks/processes after system reboot.
15
+ */
16
+ export async function getBootId() {
17
+ try {
18
+ const data = await fs.readFile('/proc/sys/kernel/random/boot_id', 'utf-8');
19
+ return data.trim();
20
+ }
21
+ catch {
22
+ // Not on Linux, use a placeholder
23
+ return 'unknown-boot-id';
24
+ }
25
+ }
26
+ /**
27
+ * Get process start time from /proc/<pid>/stat.
28
+ * Returns the starttime field (field 22) which is jiffies since boot.
29
+ * Used together with boot ID to uniquely identify a process (handles PID reuse).
30
+ */
31
+ export async function getPidStartTime(pid) {
32
+ try {
33
+ const data = await fs.readFile(`/proc/${pid}/stat`, 'utf-8');
34
+ // Fields are space-separated, but comm (field 2) can contain spaces and is in parens
35
+ // Find the closing paren, then split the rest
36
+ const closeParen = data.lastIndexOf(')');
37
+ const fields = data.slice(closeParen + 2).split(' ');
38
+ // After the closing paren, field index 0 is state (field 3), so starttime is at index 19
39
+ // (field 22 - 3 = 19)
40
+ return parseInt(fields[19], 10);
41
+ }
42
+ catch {
43
+ return 0;
44
+ }
45
+ }
46
+ /**
47
+ * Check if a process is still alive based on stored identification
48
+ */
49
+ export async function isProcessAlive(pid, pidStartTime, bootId) {
50
+ // Different boot? Process is dead
51
+ const currentBootId = await getBootId();
52
+ if (currentBootId !== bootId)
53
+ return false;
54
+ // Check if PID exists and has same start time
55
+ const currentStartTime = await getPidStartTime(pid);
56
+ if (currentStartTime === 0)
57
+ return false; // PID doesn't exist
58
+ if (currentStartTime !== pidStartTime)
59
+ return false; // PID reused
60
+ return true;
61
+ }
62
+ //# sourceMappingURL=processHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processHelpers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e,CAAC,GAAG,CAAC,CAAC;IACpD,IAAI,gBAAgB,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,oBAAoB;IAC9D,IAAI,gBAAgB,KAAK,YAAY;QAAE,OAAO,KAAK,CAAC,CAAC,aAAa;IAElE,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2025 Elara AI Pty Ltd
3
3
  * Licensed under BSL 1.1. See LICENSE for details.
4
4
  */
5
- import { type ExecutionStatus } from '@elaraai/e3-types';
5
+ import type { ExecutionStatus } from '@elaraai/e3-types';
6
6
  import type { StorageBackend, LogChunk } from './storage/interfaces.js';
7
7
  /**
8
8
  * Compute the combined hash of input hashes.
@@ -115,72 +115,4 @@ export declare function executionReadLog(storage: StorageBackend, repo: string,
115
115
  * @returns Array of strings to exec
116
116
  */
117
117
  export declare function evaluateCommandIr(storage: StorageBackend, repo: string, commandIrHash: string, inputPaths: string[], outputPath: string): Promise<string[]>;
118
- /**
119
- * Get the current system boot ID.
120
- * Used for detecting stale locks/processes after system reboot.
121
- */
122
- export declare function getBootId(): Promise<string>;
123
- /**
124
- * Get process start time from /proc/<pid>/stat.
125
- * Returns the starttime field (field 22) which is jiffies since boot.
126
- * Used together with boot ID to uniquely identify a process (handles PID reuse).
127
- */
128
- export declare function getPidStartTime(pid: number): Promise<number>;
129
- /**
130
- * Check if a process is still alive based on stored identification
131
- */
132
- export declare function isProcessAlive(pid: number, pidStartTime: number, bootId: string): Promise<boolean>;
133
- /**
134
- * Options for task execution
135
- */
136
- export interface ExecuteOptions {
137
- /** Re-run even if cached (default: false) */
138
- force?: boolean;
139
- /** Timeout in milliseconds (default: none) */
140
- timeout?: number;
141
- /** AbortSignal for cancellation */
142
- signal?: AbortSignal;
143
- /** Stream stdout callback */
144
- onStdout?: (data: string) => void;
145
- /** Stream stderr callback */
146
- onStderr?: (data: string) => void;
147
- }
148
- /**
149
- * Result of task execution
150
- */
151
- export interface ExecutionResult {
152
- /** Combined inputs hash (identifies this execution) */
153
- inputsHash: string;
154
- /** True if result was from cache */
155
- cached: boolean;
156
- /** Final state */
157
- state: 'success' | 'failed' | 'error';
158
- /** Output dataset hash (null on failure) */
159
- outputHash: string | null;
160
- /** Process exit code (null if not applicable) */
161
- exitCode: number | null;
162
- /** Execution time in ms (0 if cached) */
163
- duration: number;
164
- /** Error message on failure */
165
- error: string | null;
166
- }
167
- /**
168
- * Execute a single task.
169
- *
170
- * This is the core execution primitive. It:
171
- * 1. Computes the execution identity from task + inputs
172
- * 2. Checks cache (unless force=true)
173
- * 3. Marshals inputs to a scratch directory
174
- * 4. Evaluates command IR to get exec args
175
- * 5. Runs the command
176
- * 6. Stores the output and updates status
177
- *
178
- * @param storage - Storage backend
179
- * @param repo - Repository identifier (for local storage, the path to e3 repository directory)
180
- * @param taskHash - Hash of the task object
181
- * @param inputHashes - Array of input dataset hashes
182
- * @param options - Execution options
183
- * @returns Execution result
184
- */
185
- export declare function taskExecute(storage: StorageBackend, repo: string, taskHash: string, inputHashes: string[], options?: ExecuteOptions): Promise<ExecutionResult>;
186
118
  //# sourceMappingURL=executions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executions.d.ts","sourceRoot":"","sources":["../../src/executions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAMxE;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,CAGxD;AAMD;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAEjC;AAED;;;;;;;;GAQG;AACH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