@elaraai/e3-api-server 1.0.79 → 1.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -20
- package/dist/src/beast2.js +1 -1
- package/dist/src/beast2.js.map +1 -1
- package/dist/src/cli.js +13 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +8 -1
- package/dist/src/errors.js.map +1 -1
- package/dist/src/handlers/dataflow.d.ts +58 -11
- package/dist/src/handlers/dataflow.d.ts.map +1 -1
- package/dist/src/handlers/dataflow.js +120 -48
- package/dist/src/handlers/dataflow.js.map +1 -1
- package/dist/src/handlers/dataflow.spec.d.ts +6 -0
- package/dist/src/handlers/dataflow.spec.d.ts.map +1 -0
- package/dist/src/handlers/dataflow.spec.js +106 -0
- package/dist/src/handlers/dataflow.spec.js.map +1 -0
- package/dist/src/handlers/datasets.d.ts +60 -34
- package/dist/src/handlers/datasets.d.ts.map +1 -1
- package/dist/src/handlers/datasets.js +452 -306
- package/dist/src/handlers/datasets.js.map +1 -1
- package/dist/src/handlers/datasets.spec.js +338 -119
- package/dist/src/handlers/datasets.spec.js.map +1 -1
- package/dist/src/handlers/functions.d.ts.map +1 -1
- package/dist/src/handlers/functions.js +10 -8
- package/dist/src/handlers/functions.js.map +1 -1
- package/dist/src/handlers/functions.spec.js +2 -2
- package/dist/src/handlers/functions.spec.js.map +1 -1
- package/dist/src/handlers/index.d.ts +2 -2
- package/dist/src/handlers/index.d.ts.map +1 -1
- package/dist/src/handlers/index.js +2 -2
- package/dist/src/handlers/index.js.map +1 -1
- package/dist/src/handlers/records.d.ts.map +1 -1
- package/dist/src/handlers/records.js +15 -12
- package/dist/src/handlers/records.js.map +1 -1
- package/dist/src/handlers/records.spec.js +9 -5
- package/dist/src/handlers/records.spec.js.map +1 -1
- package/dist/src/handlers/repository.d.ts +59 -10
- package/dist/src/handlers/repository.d.ts.map +1 -1
- package/dist/src/handlers/repository.js +147 -40
- package/dist/src/handlers/repository.js.map +1 -1
- package/dist/src/handlers/tasks.d.ts +2 -1
- package/dist/src/handlers/tasks.d.ts.map +1 -1
- package/dist/src/handlers/tasks.js +31 -8
- package/dist/src/handlers/tasks.js.map +1 -1
- package/dist/src/handlers/tasks.spec.d.ts +6 -0
- package/dist/src/handlers/tasks.spec.d.ts.map +1 -0
- package/dist/src/handlers/tasks.spec.js +64 -0
- package/dist/src/handlers/tasks.spec.js.map +1 -0
- package/dist/src/handlers/workspaces.d.ts +63 -6
- package/dist/src/handlers/workspaces.d.ts.map +1 -1
- package/dist/src/handlers/workspaces.js +104 -42
- package/dist/src/handlers/workspaces.js.map +1 -1
- package/dist/src/handlers/workspaces.spec.d.ts +6 -0
- package/dist/src/handlers/workspaces.spec.d.ts.map +1 -0
- package/dist/src/handlers/workspaces.spec.js +214 -0
- package/dist/src/handlers/workspaces.spec.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/local-dataflow.d.ts +14 -0
- package/dist/src/local-dataflow.d.ts.map +1 -0
- package/dist/src/local-dataflow.js +41 -0
- package/dist/src/local-dataflow.js.map +1 -0
- package/dist/src/middleware/repository.d.ts +39 -0
- package/dist/src/middleware/repository.d.ts.map +1 -0
- package/dist/src/middleware/repository.js +77 -0
- package/dist/src/middleware/repository.js.map +1 -0
- package/dist/src/routes/data.d.ts +2 -2
- package/dist/src/routes/data.d.ts.map +1 -1
- package/dist/src/routes/data.js +22 -45
- package/dist/src/routes/data.js.map +1 -1
- package/dist/src/routes/datasets.d.ts +0 -3
- package/dist/src/routes/datasets.d.ts.map +1 -1
- package/dist/src/routes/datasets.js +40 -8
- package/dist/src/routes/datasets.js.map +1 -1
- package/dist/src/routes/executions.d.ts +37 -2
- package/dist/src/routes/executions.d.ts.map +1 -1
- package/dist/src/routes/executions.js +21 -12
- package/dist/src/routes/executions.js.map +1 -1
- package/dist/src/routes/index.d.ts +2 -1
- package/dist/src/routes/index.d.ts.map +1 -1
- package/dist/src/routes/index.js +1 -0
- package/dist/src/routes/index.js.map +1 -1
- package/dist/src/routes/objects.d.ts +16 -2
- package/dist/src/routes/objects.d.ts.map +1 -1
- package/dist/src/routes/objects.js +34 -3
- package/dist/src/routes/objects.js.map +1 -1
- package/dist/src/routes/repositories.d.ts +26 -0
- package/dist/src/routes/repositories.d.ts.map +1 -0
- package/dist/src/routes/repositories.js +58 -0
- package/dist/src/routes/repositories.js.map +1 -0
- package/dist/src/routes/repositories.spec.d.ts +6 -0
- package/dist/src/routes/repositories.spec.d.ts.map +1 -0
- package/dist/src/routes/repositories.spec.js +77 -0
- package/dist/src/routes/repositories.spec.js.map +1 -0
- package/dist/src/routes/repository.d.ts +12 -2
- package/dist/src/routes/repository.d.ts.map +1 -1
- package/dist/src/routes/repository.js +24 -9
- package/dist/src/routes/repository.js.map +1 -1
- package/dist/src/routes/transfer.d.ts +22 -10
- package/dist/src/routes/transfer.d.ts.map +1 -1
- package/dist/src/routes/transfer.js +104 -118
- package/dist/src/routes/transfer.js.map +1 -1
- package/dist/src/routes/workspaces.d.ts +14 -1
- package/dist/src/routes/workspaces.d.ts.map +1 -1
- package/dist/src/routes/workspaces.js +64 -46
- package/dist/src/routes/workspaces.js.map +1 -1
- package/dist/src/server.d.ts +18 -6
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +57 -183
- package/dist/src/server.js.map +1 -1
- package/dist/src/server.spec.d.ts +6 -0
- package/dist/src/server.spec.d.ts.map +1 -0
- package/dist/src/server.spec.js +59 -0
- package/dist/src/server.spec.js.map +1 -0
- package/dist/src/types.d.ts +306 -17
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +7 -3
- package/dist/src/types.js.map +1 -1
- package/package.json +5 -5
- package/dist/src/async-operation-state.d.ts +0 -37
- package/dist/src/async-operation-state.d.ts.map +0 -1
- package/dist/src/async-operation-state.js +0 -118
- package/dist/src/async-operation-state.js.map +0 -1
- package/dist/src/orchestrator-manager.d.ts +0 -45
- package/dist/src/orchestrator-manager.d.ts.map +0 -1
- package/dist/src/orchestrator-manager.js +0 -150
- package/dist/src/orchestrator-manager.js.map +0 -1
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
-
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
-
*/
|
|
5
|
-
import type { GcResult, GcStatusResult } from './types.js';
|
|
6
|
-
/**
|
|
7
|
-
* Create a new GC operation and return its execution ID.
|
|
8
|
-
*/
|
|
9
|
-
export declare function createGcOperation(): string;
|
|
10
|
-
/**
|
|
11
|
-
* Mark a GC operation as succeeded with stats.
|
|
12
|
-
*/
|
|
13
|
-
export declare function completeGcOperation(executionId: string, stats: GcResult): void;
|
|
14
|
-
/**
|
|
15
|
-
* Mark a GC operation as failed with error message.
|
|
16
|
-
*/
|
|
17
|
-
export declare function failGcOperation(executionId: string, error: string): void;
|
|
18
|
-
/**
|
|
19
|
-
* Get the status of a GC operation.
|
|
20
|
-
* Returns null if operation doesn't exist.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getGcOperationStatus(executionId: string): GcStatusResult | null;
|
|
23
|
-
/**
|
|
24
|
-
* Check if a GC operation exists.
|
|
25
|
-
*/
|
|
26
|
-
export declare function hasGcOperation(executionId: string): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Clear a GC operation.
|
|
29
|
-
* Useful for cleanup in tests.
|
|
30
|
-
*/
|
|
31
|
-
export declare function clearGcOperation(executionId: string): void;
|
|
32
|
-
/**
|
|
33
|
-
* Clear all async operation states.
|
|
34
|
-
* Useful for cleanup in tests.
|
|
35
|
-
*/
|
|
36
|
-
export declare function clearAllAsyncOperations(): void;
|
|
37
|
-
//# sourceMappingURL=async-operation-state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-operation-state.d.ts","sourceRoot":"","sources":["../../src/async-operation-state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAuB3D;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAO1C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAa9E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAOxE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAoC/E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAE1D;AAMD;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
-
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* In-memory state storage for async operations (GC, repo deletion).
|
|
7
|
-
*
|
|
8
|
-
* Tracks operation status for each execution, allowing clients to poll
|
|
9
|
-
* for progress updates during long-running operations.
|
|
10
|
-
*
|
|
11
|
-
* This serves as a development/test mock for the Step Function-based
|
|
12
|
-
* execution tracking in e3-aws.
|
|
13
|
-
*/
|
|
14
|
-
import { randomUUID } from 'crypto';
|
|
15
|
-
import { variant, some, none } from '@elaraai/east';
|
|
16
|
-
// Key: executionId (UUID)
|
|
17
|
-
const gcOperations = new Map();
|
|
18
|
-
/**
|
|
19
|
-
* Create a new GC operation and return its execution ID.
|
|
20
|
-
*/
|
|
21
|
-
export function createGcOperation() {
|
|
22
|
-
const executionId = randomUUID();
|
|
23
|
-
gcOperations.set(executionId, {
|
|
24
|
-
status: 'running',
|
|
25
|
-
startedAt: new Date(),
|
|
26
|
-
});
|
|
27
|
-
return executionId;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Mark a GC operation as succeeded with stats.
|
|
31
|
-
*/
|
|
32
|
-
export function completeGcOperation(executionId, stats) {
|
|
33
|
-
const op = gcOperations.get(executionId);
|
|
34
|
-
if (op) {
|
|
35
|
-
op.status = 'succeeded';
|
|
36
|
-
op.completedAt = new Date();
|
|
37
|
-
op.stats = {
|
|
38
|
-
deletedObjects: stats.deletedObjects,
|
|
39
|
-
deletedPartials: stats.deletedPartials,
|
|
40
|
-
retainedObjects: stats.retainedObjects,
|
|
41
|
-
skippedYoung: stats.skippedYoung,
|
|
42
|
-
bytesFreed: stats.bytesFreed,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Mark a GC operation as failed with error message.
|
|
48
|
-
*/
|
|
49
|
-
export function failGcOperation(executionId, error) {
|
|
50
|
-
const op = gcOperations.get(executionId);
|
|
51
|
-
if (op) {
|
|
52
|
-
op.status = 'failed';
|
|
53
|
-
op.completedAt = new Date();
|
|
54
|
-
op.error = error;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Get the status of a GC operation.
|
|
59
|
-
* Returns null if operation doesn't exist.
|
|
60
|
-
*/
|
|
61
|
-
export function getGcOperationStatus(executionId) {
|
|
62
|
-
const op = gcOperations.get(executionId);
|
|
63
|
-
if (!op) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
// Convert status to East variant
|
|
67
|
-
let status;
|
|
68
|
-
switch (op.status) {
|
|
69
|
-
case 'running':
|
|
70
|
-
status = variant('running', null);
|
|
71
|
-
break;
|
|
72
|
-
case 'succeeded':
|
|
73
|
-
status = variant('succeeded', null);
|
|
74
|
-
break;
|
|
75
|
-
case 'failed':
|
|
76
|
-
status = variant('failed', null);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
// Convert stats to East option
|
|
80
|
-
const stats = op.stats
|
|
81
|
-
? some({
|
|
82
|
-
deletedObjects: op.stats.deletedObjects,
|
|
83
|
-
deletedPartials: op.stats.deletedPartials,
|
|
84
|
-
retainedObjects: op.stats.retainedObjects,
|
|
85
|
-
skippedYoung: op.stats.skippedYoung,
|
|
86
|
-
bytesFreed: op.stats.bytesFreed,
|
|
87
|
-
})
|
|
88
|
-
: none;
|
|
89
|
-
return {
|
|
90
|
-
status,
|
|
91
|
-
stats,
|
|
92
|
-
error: op.error ? some(op.error) : none,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Check if a GC operation exists.
|
|
97
|
-
*/
|
|
98
|
-
export function hasGcOperation(executionId) {
|
|
99
|
-
return gcOperations.has(executionId);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Clear a GC operation.
|
|
103
|
-
* Useful for cleanup in tests.
|
|
104
|
-
*/
|
|
105
|
-
export function clearGcOperation(executionId) {
|
|
106
|
-
gcOperations.delete(executionId);
|
|
107
|
-
}
|
|
108
|
-
// =============================================================================
|
|
109
|
-
// Test Utilities
|
|
110
|
-
// =============================================================================
|
|
111
|
-
/**
|
|
112
|
-
* Clear all async operation states.
|
|
113
|
-
* Useful for cleanup in tests.
|
|
114
|
-
*/
|
|
115
|
-
export function clearAllAsyncOperations() {
|
|
116
|
-
gcOperations.clear();
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=async-operation-state.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-operation-state.js","sourceRoot":"","sources":["../../src/async-operation-state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,M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WAAmB;IAClD,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AAED,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,UAAU,uBAAuB;IACrC,YAAY,CAAC,KAAK,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
-
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
-
*/
|
|
5
|
-
import { LocalOrchestrator, type ExecutionHandle, type ExecutionStateStore } from '@elaraai/e3-core';
|
|
6
|
-
/**
|
|
7
|
-
* Get the orchestrator for a repository.
|
|
8
|
-
*/
|
|
9
|
-
export declare function getOrchestrator(repoPath: string): LocalOrchestrator;
|
|
10
|
-
/**
|
|
11
|
-
* Get the state store for a repository.
|
|
12
|
-
*/
|
|
13
|
-
export declare function getStateStore(repoPath: string): ExecutionStateStore;
|
|
14
|
-
/**
|
|
15
|
-
* Set the active execution for a workspace.
|
|
16
|
-
* Replaces any previous execution.
|
|
17
|
-
*/
|
|
18
|
-
export declare function setActiveExecution(repoPath: string, workspace: string, handle: ExecutionHandle): void;
|
|
19
|
-
/**
|
|
20
|
-
* Get the active execution for a workspace.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getActiveExecution(repoPath: string, workspace: string): ExecutionHandle | null;
|
|
23
|
-
/**
|
|
24
|
-
* Clear the active execution for a workspace.
|
|
25
|
-
*/
|
|
26
|
-
export declare function clearActiveExecution(repoPath: string, workspace: string): void;
|
|
27
|
-
/**
|
|
28
|
-
* Check if there's an active (running) execution for a workspace.
|
|
29
|
-
*/
|
|
30
|
-
export declare function hasActiveExecution(repoPath: string, workspace: string): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Get the start time for an execution (for duration calculation).
|
|
33
|
-
*/
|
|
34
|
-
export declare function getExecutionStartTime(repoPath: string, workspace: string, executionId: string): number | null;
|
|
35
|
-
/**
|
|
36
|
-
* Get the latest execution for a workspace (may not be active/running).
|
|
37
|
-
* Useful for polling completed executions.
|
|
38
|
-
*/
|
|
39
|
-
export declare function getLatestExecution(repoPath: string, workspace: string): Promise<ExecutionHandle | null>;
|
|
40
|
-
/**
|
|
41
|
-
* Clear all in-memory state (for testing).
|
|
42
|
-
* Note: This does not clear persisted file-based state.
|
|
43
|
-
*/
|
|
44
|
-
export declare function clearAll(): void;
|
|
45
|
-
//# sourceMappingURL=orchestrator-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-manager.d.ts","sourceRoot":"","sources":["../../src/orchestrator-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EACL,iBAAiB,EAEjB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAgE1B;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAEnE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAEnE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAOrG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAG9F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAQ9E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAE/E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG7G;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAe7G;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,IAAI,CAK/B"}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
-
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Orchestrator manager for e3-api-server.
|
|
7
|
-
*
|
|
8
|
-
* Manages LocalOrchestrator instances per repository, each with its own
|
|
9
|
-
* FileStateStore for durable execution state persistence.
|
|
10
|
-
*/
|
|
11
|
-
import { join } from 'node:path';
|
|
12
|
-
import { LocalOrchestrator, FileStateStore, } from '@elaraai/e3-core';
|
|
13
|
-
/**
|
|
14
|
-
* Map of state stores per repository path.
|
|
15
|
-
*/
|
|
16
|
-
const stateStores = new Map();
|
|
17
|
-
/**
|
|
18
|
-
* Map of orchestrators per repository path.
|
|
19
|
-
*/
|
|
20
|
-
const orchestrators = new Map();
|
|
21
|
-
/**
|
|
22
|
-
* Get or create a FileStateStore for a repository.
|
|
23
|
-
*/
|
|
24
|
-
function getOrCreateStateStore(repoPath) {
|
|
25
|
-
let store = stateStores.get(repoPath);
|
|
26
|
-
if (!store) {
|
|
27
|
-
const workspacesDir = join(repoPath, 'workspaces');
|
|
28
|
-
store = new FileStateStore(workspacesDir);
|
|
29
|
-
stateStores.set(repoPath, store);
|
|
30
|
-
}
|
|
31
|
-
return store;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Get or create a LocalOrchestrator for a repository.
|
|
35
|
-
*/
|
|
36
|
-
function getOrCreateOrchestrator(repoPath) {
|
|
37
|
-
let orch = orchestrators.get(repoPath);
|
|
38
|
-
if (!orch) {
|
|
39
|
-
const stateStore = getOrCreateStateStore(repoPath);
|
|
40
|
-
orch = new LocalOrchestrator(stateStore);
|
|
41
|
-
orchestrators.set(repoPath, orch);
|
|
42
|
-
}
|
|
43
|
-
return orch;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Map of active execution handles by workspace key.
|
|
47
|
-
* Key format: `${repoPath}::${workspace}`
|
|
48
|
-
*/
|
|
49
|
-
const activeExecutions = new Map();
|
|
50
|
-
/**
|
|
51
|
-
* Map of execution start times for duration tracking.
|
|
52
|
-
* Key format: `${repoPath}::${workspace}:${executionId}`
|
|
53
|
-
*/
|
|
54
|
-
const executionStartTimes = new Map();
|
|
55
|
-
/**
|
|
56
|
-
* Generate a key for workspace-level lookups.
|
|
57
|
-
*/
|
|
58
|
-
function makeWorkspaceKey(repoPath, workspace) {
|
|
59
|
-
return `${repoPath}::${workspace}`;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Generate a key for execution-level lookups.
|
|
63
|
-
*/
|
|
64
|
-
function makeExecutionKey(repoPath, workspace, executionId) {
|
|
65
|
-
return `${repoPath}::${workspace}:${executionId}`;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Get the orchestrator for a repository.
|
|
69
|
-
*/
|
|
70
|
-
export function getOrchestrator(repoPath) {
|
|
71
|
-
return getOrCreateOrchestrator(repoPath);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Get the state store for a repository.
|
|
75
|
-
*/
|
|
76
|
-
export function getStateStore(repoPath) {
|
|
77
|
-
return getOrCreateStateStore(repoPath);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Set the active execution for a workspace.
|
|
81
|
-
* Replaces any previous execution.
|
|
82
|
-
*/
|
|
83
|
-
export function setActiveExecution(repoPath, workspace, handle) {
|
|
84
|
-
const key = makeWorkspaceKey(repoPath, workspace);
|
|
85
|
-
activeExecutions.set(key, handle);
|
|
86
|
-
// Record start time for duration tracking
|
|
87
|
-
const execKey = makeExecutionKey(repoPath, workspace, handle.id);
|
|
88
|
-
executionStartTimes.set(execKey, Date.now());
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Get the active execution for a workspace.
|
|
92
|
-
*/
|
|
93
|
-
export function getActiveExecution(repoPath, workspace) {
|
|
94
|
-
const key = makeWorkspaceKey(repoPath, workspace);
|
|
95
|
-
return activeExecutions.get(key) ?? null;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Clear the active execution for a workspace.
|
|
99
|
-
*/
|
|
100
|
-
export function clearActiveExecution(repoPath, workspace) {
|
|
101
|
-
const key = makeWorkspaceKey(repoPath, workspace);
|
|
102
|
-
const handle = activeExecutions.get(key);
|
|
103
|
-
if (handle) {
|
|
104
|
-
const execKey = makeExecutionKey(repoPath, workspace, handle.id);
|
|
105
|
-
executionStartTimes.delete(execKey);
|
|
106
|
-
}
|
|
107
|
-
activeExecutions.delete(key);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Check if there's an active (running) execution for a workspace.
|
|
111
|
-
*/
|
|
112
|
-
export function hasActiveExecution(repoPath, workspace) {
|
|
113
|
-
return activeExecutions.has(makeWorkspaceKey(repoPath, workspace));
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Get the start time for an execution (for duration calculation).
|
|
117
|
-
*/
|
|
118
|
-
export function getExecutionStartTime(repoPath, workspace, executionId) {
|
|
119
|
-
const key = makeExecutionKey(repoPath, workspace, executionId);
|
|
120
|
-
return executionStartTimes.get(key) ?? null;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Get the latest execution for a workspace (may not be active/running).
|
|
124
|
-
* Useful for polling completed executions.
|
|
125
|
-
*/
|
|
126
|
-
export async function getLatestExecution(repoPath, workspace) {
|
|
127
|
-
// First check for active execution
|
|
128
|
-
const active = getActiveExecution(repoPath, workspace);
|
|
129
|
-
if (active) {
|
|
130
|
-
return active;
|
|
131
|
-
}
|
|
132
|
-
// Otherwise check state store for latest
|
|
133
|
-
const stateStore = getOrCreateStateStore(repoPath);
|
|
134
|
-
const state = await stateStore.readLatest(repoPath, workspace);
|
|
135
|
-
if (state) {
|
|
136
|
-
return { id: state.id, repo: repoPath, workspace };
|
|
137
|
-
}
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Clear all in-memory state (for testing).
|
|
142
|
-
* Note: This does not clear persisted file-based state.
|
|
143
|
-
*/
|
|
144
|
-
export function clearAll() {
|
|
145
|
-
activeExecutions.clear();
|
|
146
|
-
executionStartTimes.clear();
|
|
147
|
-
stateStores.clear();
|
|
148
|
-
orchestrators.clear();
|
|
149
|
-
}
|
|
150
|
-
//# sourceMappingURL=orchestrator-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-manager.js","sourceRoot":"","sources":["../../src/orchestrator-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,cAAc,GAGf,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEtD;;GAEG;AACH,MAAM,aAAa,GAAG,IAAI,GAAG,EAA6B,CAAC;AAE3D;;GAEG;AACH,SAAS,qBAAqB,CAAC,QAAgB;IAC7C,IAAI,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACnD,KAAK,GAAG,IAAI,cAAc,CAAC,aAAa,CAAC,CAAC;QAC1C,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACnC,C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