@sudocode-ai/local-server 0.1.6 → 0.1.7
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/dist/execution/process/builders/claude.d.ts +1 -1
- package/dist/execution/process/builders/claude.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70 -11
- package/dist/index.js.map +1 -1
- package/dist/public/assets/index-B3SEMufD.js +580 -0
- package/dist/public/assets/{index-BvlblDHK.js.map → index-B3SEMufD.js.map} +1 -1
- package/dist/public/assets/index-D2YGL3gX.css +1 -0
- package/dist/public/index.html +2 -2
- package/dist/routes/feedback.d.ts.map +1 -1
- package/dist/routes/feedback.js +20 -12
- package/dist/routes/feedback.js.map +1 -1
- package/dist/services/db.d.ts.map +1 -1
- package/dist/services/db.js +19 -14
- package/dist/services/db.js.map +1 -1
- package/dist/services/execution-service.d.ts.map +1 -1
- package/dist/services/execution-service.js +43 -22
- package/dist/services/execution-service.js.map +1 -1
- package/dist/services/executions.d.ts.map +1 -1
- package/dist/services/executions.js +15 -0
- package/dist/services/executions.js.map +1 -1
- package/dist/services/feedback.d.ts +16 -0
- package/dist/services/feedback.d.ts.map +1 -1
- package/dist/services/feedback.js +25 -1
- package/dist/services/feedback.js.map +1 -1
- package/dist/services/repo-info.d.ts +17 -0
- package/dist/services/repo-info.d.ts.map +1 -0
- package/dist/services/repo-info.js +53 -0
- package/dist/services/repo-info.js.map +1 -0
- package/dist/services/websocket.d.ts +25 -3
- package/dist/services/websocket.d.ts.map +1 -1
- package/dist/services/websocket.js +71 -7
- package/dist/services/websocket.js.map +1 -1
- package/package.json +4 -3
- package/dist/execution/engine/engine.d.ts +0 -103
- package/dist/execution/engine/engine.d.ts.map +0 -1
- package/dist/execution/engine/engine.js +0 -10
- package/dist/execution/engine/engine.js.map +0 -1
- package/dist/execution/engine/simple-engine.d.ts +0 -190
- package/dist/execution/engine/simple-engine.d.ts.map +0 -1
- package/dist/execution/engine/simple-engine.js +0 -611
- package/dist/execution/engine/simple-engine.js.map +0 -1
- package/dist/execution/engine/types.d.ts +0 -116
- package/dist/execution/engine/types.d.ts.map +0 -1
- package/dist/execution/engine/types.js +0 -10
- package/dist/execution/engine/types.js.map +0 -1
- package/dist/execution/process/index.d.ts +0 -15
- package/dist/execution/process/index.d.ts.map +0 -1
- package/dist/execution/process/index.js +0 -15
- package/dist/execution/process/index.js.map +0 -1
- package/dist/execution/process/manager.d.ts +0 -133
- package/dist/execution/process/manager.d.ts.map +0 -1
- package/dist/execution/process/manager.js +0 -10
- package/dist/execution/process/manager.js.map +0 -1
- package/dist/execution/process/simple-manager.d.ts +0 -102
- package/dist/execution/process/simple-manager.d.ts.map +0 -1
- package/dist/execution/process/simple-manager.js +0 -336
- package/dist/execution/process/simple-manager.js.map +0 -1
- package/dist/execution/process/types.d.ts +0 -105
- package/dist/execution/process/types.d.ts.map +0 -1
- package/dist/execution/process/types.js +0 -10
- package/dist/execution/process/types.js.map +0 -1
- package/dist/execution/process/utils.d.ts +0 -53
- package/dist/execution/process/utils.d.ts.map +0 -1
- package/dist/execution/process/utils.js +0 -97
- package/dist/execution/process/utils.js.map +0 -1
- package/dist/execution/resilience/circuit-breaker.d.ts +0 -170
- package/dist/execution/resilience/circuit-breaker.d.ts.map +0 -1
- package/dist/execution/resilience/circuit-breaker.js +0 -291
- package/dist/execution/resilience/circuit-breaker.js.map +0 -1
- package/dist/execution/resilience/executor.d.ts +0 -109
- package/dist/execution/resilience/executor.d.ts.map +0 -1
- package/dist/execution/resilience/executor.js +0 -10
- package/dist/execution/resilience/executor.js.map +0 -1
- package/dist/execution/resilience/index.d.ts +0 -14
- package/dist/execution/resilience/index.d.ts.map +0 -1
- package/dist/execution/resilience/index.js +0 -15
- package/dist/execution/resilience/index.js.map +0 -1
- package/dist/execution/resilience/resilient-executor.d.ts +0 -86
- package/dist/execution/resilience/resilient-executor.d.ts.map +0 -1
- package/dist/execution/resilience/resilient-executor.js +0 -261
- package/dist/execution/resilience/resilient-executor.js.map +0 -1
- package/dist/execution/resilience/retry.d.ts +0 -161
- package/dist/execution/resilience/retry.d.ts.map +0 -1
- package/dist/execution/resilience/retry.js +0 -234
- package/dist/execution/resilience/retry.js.map +0 -1
- package/dist/execution/resilience/types.d.ts +0 -226
- package/dist/execution/resilience/types.d.ts.map +0 -1
- package/dist/execution/resilience/types.js +0 -30
- package/dist/execution/resilience/types.js.map +0 -1
- package/dist/execution/workflow/index.d.ts +0 -13
- package/dist/execution/workflow/index.d.ts.map +0 -1
- package/dist/execution/workflow/index.js +0 -13
- package/dist/execution/workflow/index.js.map +0 -1
- package/dist/execution/workflow/linear-orchestrator.d.ts +0 -216
- package/dist/execution/workflow/linear-orchestrator.d.ts.map +0 -1
- package/dist/execution/workflow/linear-orchestrator.js +0 -683
- package/dist/execution/workflow/linear-orchestrator.js.map +0 -1
- package/dist/execution/workflow/memory-storage.d.ts +0 -54
- package/dist/execution/workflow/memory-storage.d.ts.map +0 -1
- package/dist/execution/workflow/memory-storage.js +0 -68
- package/dist/execution/workflow/memory-storage.js.map +0 -1
- package/dist/execution/workflow/orchestrator.d.ts +0 -158
- package/dist/execution/workflow/orchestrator.d.ts.map +0 -1
- package/dist/execution/workflow/orchestrator.js +0 -9
- package/dist/execution/workflow/orchestrator.js.map +0 -1
- package/dist/execution/workflow/types.d.ts +0 -172
- package/dist/execution/workflow/types.d.ts.map +0 -1
- package/dist/execution/workflow/types.js +0 -9
- package/dist/execution/workflow/types.js.map +0 -1
- package/dist/execution/workflow/utils.d.ts +0 -89
- package/dist/execution/workflow/utils.d.ts.map +0 -1
- package/dist/execution/workflow/utils.js +0 -152
- package/dist/execution/workflow/utils.js.map +0 -1
- package/dist/public/assets/index-BvlblDHK.js +0 -570
- package/dist/public/assets/index-BwuKdLgN.css +0 -1
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Engine Layer Types
|
|
3
|
-
*
|
|
4
|
-
* Core types for the Execution Engine (Layer 2) that manages
|
|
5
|
-
* task queueing, concurrency, and multi-agent execution.
|
|
6
|
-
*
|
|
7
|
-
* @module execution/engine/types
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* ExecutionTask - Represents a unit of work to be executed by a Claude Code agent
|
|
11
|
-
*/
|
|
12
|
-
export interface ExecutionTask {
|
|
13
|
-
id: string;
|
|
14
|
-
type: 'issue' | 'spec' | 'custom';
|
|
15
|
-
entityId?: string;
|
|
16
|
-
prompt: string;
|
|
17
|
-
workDir: string;
|
|
18
|
-
priority: number;
|
|
19
|
-
dependencies: string[];
|
|
20
|
-
createdAt: Date;
|
|
21
|
-
config: {
|
|
22
|
-
timeout?: number;
|
|
23
|
-
maxRetries?: number;
|
|
24
|
-
env?: Record<string, string>;
|
|
25
|
-
};
|
|
26
|
-
metadata?: Record<string, any>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* ExecutionResult - The outcome of executing a task
|
|
30
|
-
*/
|
|
31
|
-
export interface ExecutionResult {
|
|
32
|
-
taskId: string;
|
|
33
|
-
executionId: string;
|
|
34
|
-
success: boolean;
|
|
35
|
-
exitCode: number;
|
|
36
|
-
output: string;
|
|
37
|
-
error?: string;
|
|
38
|
-
startedAt: Date;
|
|
39
|
-
completedAt: Date;
|
|
40
|
-
duration: number;
|
|
41
|
-
metadata?: {
|
|
42
|
-
toolsUsed?: string[];
|
|
43
|
-
filesChanged?: string[];
|
|
44
|
-
tokensUsed?: number;
|
|
45
|
-
cost?: number;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* EngineMetrics - Real-time engine performance statistics
|
|
50
|
-
*/
|
|
51
|
-
export interface EngineMetrics {
|
|
52
|
-
maxConcurrent: number;
|
|
53
|
-
currentlyRunning: number;
|
|
54
|
-
availableSlots: number;
|
|
55
|
-
queuedTasks: number;
|
|
56
|
-
completedTasks: number;
|
|
57
|
-
failedTasks: number;
|
|
58
|
-
averageDuration: number;
|
|
59
|
-
successRate: number;
|
|
60
|
-
throughput: number;
|
|
61
|
-
totalProcessesSpawned: number;
|
|
62
|
-
activeProcesses: number;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* TaskStatus - Discriminated union for task state tracking
|
|
66
|
-
*/
|
|
67
|
-
export type TaskStatus = {
|
|
68
|
-
state: 'queued';
|
|
69
|
-
position: number;
|
|
70
|
-
} | {
|
|
71
|
-
state: 'running';
|
|
72
|
-
processId: string;
|
|
73
|
-
startedAt: Date;
|
|
74
|
-
} | {
|
|
75
|
-
state: 'completed';
|
|
76
|
-
result: ExecutionResult;
|
|
77
|
-
} | {
|
|
78
|
-
state: 'failed';
|
|
79
|
-
error: string;
|
|
80
|
-
} | {
|
|
81
|
-
state: 'cancelled';
|
|
82
|
-
cancelledAt: Date;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* TaskCompleteHandler - Callback for task completion events
|
|
86
|
-
*/
|
|
87
|
-
export type TaskCompleteHandler = (result: ExecutionResult) => void;
|
|
88
|
-
/**
|
|
89
|
-
* TaskFailedHandler - Callback for task failure events
|
|
90
|
-
*/
|
|
91
|
-
export type TaskFailedHandler = (taskId: string, error: Error) => void;
|
|
92
|
-
/**
|
|
93
|
-
* EngineConfig - Configuration options for execution engines
|
|
94
|
-
*/
|
|
95
|
-
export interface EngineConfig {
|
|
96
|
-
maxConcurrent?: number;
|
|
97
|
-
claudePath?: string;
|
|
98
|
-
onOutput?: (data: Buffer, type: 'stdout' | 'stderr') => void;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* RunningTask - Internal tracking for currently executing tasks
|
|
102
|
-
*/
|
|
103
|
-
export interface RunningTask {
|
|
104
|
-
task: ExecutionTask;
|
|
105
|
-
process: any;
|
|
106
|
-
startedAt: Date;
|
|
107
|
-
attempt: number;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* TaskResolver - Promise resolver for async task waiting
|
|
111
|
-
*/
|
|
112
|
-
export interface TaskResolver {
|
|
113
|
-
resolve: (result: ExecutionResult) => void;
|
|
114
|
-
reject: (error: Error) => void;
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/execution/engine/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/execution/engine/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Process Layer - Public API
|
|
3
|
-
*
|
|
4
|
-
* Barrel export for the Process Layer (Layer 1) of the execution system.
|
|
5
|
-
* Exports all public types, interfaces, and implementations.
|
|
6
|
-
*
|
|
7
|
-
* @module execution/process
|
|
8
|
-
*/
|
|
9
|
-
export type { ProcessStatus, ProcessConfig, ManagedProcess, OutputHandler, ErrorHandler, ProcessMetrics, } from './types.js';
|
|
10
|
-
export type { IProcessManager } from './manager.js';
|
|
11
|
-
export { SimpleProcessManager } from './simple-manager.js';
|
|
12
|
-
export { generateId, formatDuration, isValidSignal, formatProcessError, } from './utils.js';
|
|
13
|
-
export { buildClaudeConfig } from './builders/claude.js';
|
|
14
|
-
export type { ClaudeCodeConfig } from './builders/claude.js';
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/execution/process/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Process Layer - Public API
|
|
3
|
-
*
|
|
4
|
-
* Barrel export for the Process Layer (Layer 1) of the execution system.
|
|
5
|
-
* Exports all public types, interfaces, and implementations.
|
|
6
|
-
*
|
|
7
|
-
* @module execution/process
|
|
8
|
-
*/
|
|
9
|
-
// Implementations
|
|
10
|
-
export { SimpleProcessManager } from './simple-manager.js';
|
|
11
|
-
// Utilities
|
|
12
|
-
export { generateId, formatDuration, isValidSignal, formatProcessError, } from './utils.js';
|
|
13
|
-
// Configuration Builders
|
|
14
|
-
export { buildClaudeConfig } from './builders/claude.js';
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/execution/process/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,kBAAkB;AAClB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,YAAY;AACZ,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,yBAAyB;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Process Manager Interface
|
|
3
|
-
*
|
|
4
|
-
* Defines the contract for all process managers in the Process Layer.
|
|
5
|
-
* Process managers handle spawning, monitoring, and terminating Claude Code processes.
|
|
6
|
-
*
|
|
7
|
-
* @module execution/process/manager
|
|
8
|
-
*/
|
|
9
|
-
import type { ManagedProcess, ProcessConfig, ProcessMetrics, OutputHandler, ErrorHandler } from './types.js';
|
|
10
|
-
/**
|
|
11
|
-
* Core abstraction for managing Claude Code CLI processes
|
|
12
|
-
*
|
|
13
|
-
* This interface defines the contract that all process manager implementations
|
|
14
|
-
* must follow. It provides methods for:
|
|
15
|
-
* - Process lifecycle management (acquire, release, terminate)
|
|
16
|
-
* - Process communication (I/O)
|
|
17
|
-
* - Monitoring and metrics
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const manager: IProcessManager = new SimpleProcessManager();
|
|
22
|
-
* const process = await manager.acquireProcess({
|
|
23
|
-
* claudePath: 'claude',
|
|
24
|
-
* workDir: '/path/to/project',
|
|
25
|
-
* args: {
|
|
26
|
-
* print: true,
|
|
27
|
-
* outputFormat: 'stream-json',
|
|
28
|
-
* dangerouslySkipPermissions: true,
|
|
29
|
-
* },
|
|
30
|
-
* });
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export interface IProcessManager {
|
|
34
|
-
/**
|
|
35
|
-
* Acquire a new Claude Code process
|
|
36
|
-
*
|
|
37
|
-
* Spawns a new process with the given configuration and returns a managed
|
|
38
|
-
* process handle. The process will be tracked until it exits or is terminated.
|
|
39
|
-
*
|
|
40
|
-
* @param config - Configuration for the process
|
|
41
|
-
* @returns Promise resolving to the managed process
|
|
42
|
-
* @throws Error if process fails to spawn
|
|
43
|
-
*/
|
|
44
|
-
acquireProcess(config: ProcessConfig): Promise<ManagedProcess>;
|
|
45
|
-
/**
|
|
46
|
-
* Release a process (terminate it gracefully)
|
|
47
|
-
*
|
|
48
|
-
* Sends SIGTERM to the process and waits for it to exit. If it doesn't exit
|
|
49
|
-
* within a grace period, SIGKILL is sent.
|
|
50
|
-
*
|
|
51
|
-
* @param processId - ID of the process to release
|
|
52
|
-
* @returns Promise that resolves when process is terminated
|
|
53
|
-
*/
|
|
54
|
-
releaseProcess(processId: string): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Terminate a process with a specific signal
|
|
57
|
-
*
|
|
58
|
-
* Sends the specified signal to the process. Uses graceful shutdown with
|
|
59
|
-
* SIGTERM by default, followed by SIGKILL if needed.
|
|
60
|
-
*
|
|
61
|
-
* @param processId - ID of the process to terminate
|
|
62
|
-
* @param signal - Signal to send (defaults to SIGTERM)
|
|
63
|
-
* @returns Promise that resolves when process is terminated
|
|
64
|
-
*/
|
|
65
|
-
terminateProcess(processId: string, signal?: NodeJS.Signals): Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* Send input to a process's stdin
|
|
68
|
-
*
|
|
69
|
-
* @param processId - ID of the process
|
|
70
|
-
* @param input - Input string to send
|
|
71
|
-
* @returns Promise that resolves when input is written
|
|
72
|
-
* @throws Error if process is not found
|
|
73
|
-
*/
|
|
74
|
-
sendInput(processId: string, input: string): Promise<void>;
|
|
75
|
-
/**
|
|
76
|
-
* Close stdin stream for a process
|
|
77
|
-
*
|
|
78
|
-
* Signals EOF to the process. This is useful for programs like Claude Code
|
|
79
|
-
* in --print mode that wait for stdin to close before processing input.
|
|
80
|
-
*
|
|
81
|
-
* @param processId - ID of the process
|
|
82
|
-
* @throws Error if process is not found
|
|
83
|
-
*/
|
|
84
|
-
closeInput(processId: string): void;
|
|
85
|
-
/**
|
|
86
|
-
* Register a handler for process output (stdout/stderr)
|
|
87
|
-
*
|
|
88
|
-
* The handler will be called whenever the process produces output.
|
|
89
|
-
* Multiple handlers can be registered for the same process.
|
|
90
|
-
*
|
|
91
|
-
* @param processId - ID of the process
|
|
92
|
-
* @param handler - Handler function to call on output
|
|
93
|
-
*/
|
|
94
|
-
onOutput(processId: string, handler: OutputHandler): void;
|
|
95
|
-
/**
|
|
96
|
-
* Register a handler for process errors
|
|
97
|
-
*
|
|
98
|
-
* The handler will be called when the process encounters an error.
|
|
99
|
-
*
|
|
100
|
-
* @param processId - ID of the process
|
|
101
|
-
* @param handler - Handler function to call on error
|
|
102
|
-
*/
|
|
103
|
-
onError(processId: string, handler: ErrorHandler): void;
|
|
104
|
-
/**
|
|
105
|
-
* Get a managed process by ID
|
|
106
|
-
*
|
|
107
|
-
* @param processId - ID of the process
|
|
108
|
-
* @returns The managed process or null if not found
|
|
109
|
-
*/
|
|
110
|
-
getProcess(processId: string): ManagedProcess | null;
|
|
111
|
-
/**
|
|
112
|
-
* Get all currently active processes
|
|
113
|
-
*
|
|
114
|
-
* @returns Array of all active managed processes
|
|
115
|
-
*/
|
|
116
|
-
getActiveProcesses(): ManagedProcess[];
|
|
117
|
-
/**
|
|
118
|
-
* Get aggregate metrics for all processes
|
|
119
|
-
*
|
|
120
|
-
* @returns Process metrics summary
|
|
121
|
-
*/
|
|
122
|
-
getMetrics(): ProcessMetrics;
|
|
123
|
-
/**
|
|
124
|
-
* Shutdown the process manager
|
|
125
|
-
*
|
|
126
|
-
* Terminates all active processes and cleans up resources.
|
|
127
|
-
* This should be called before the application exits.
|
|
128
|
-
*
|
|
129
|
-
* @returns Promise that resolves when all processes are terminated
|
|
130
|
-
*/
|
|
131
|
-
shutdown(): Promise<void>;
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/execution/process/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,eAAe;IAK9B;;;;;;;;;OASG;IACH,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE/D;;;;;;;;OAQG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD;;;;;;;;;OASG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAM5E;;;;;;;OAOG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D;;;;;;;;OAQG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAE1D;;;;;;;OAOG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAMxD;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAAC;IAErD;;;;OAIG;IACH,kBAAkB,IAAI,cAAc,EAAE,CAAC;IAEvC;;;;OAIG;IACH,UAAU,IAAI,cAAc,CAAC;IAM7B;;;;;;;OAOG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Process Manager Interface
|
|
3
|
-
*
|
|
4
|
-
* Defines the contract for all process managers in the Process Layer.
|
|
5
|
-
* Process managers handle spawning, monitoring, and terminating Claude Code processes.
|
|
6
|
-
*
|
|
7
|
-
* @module execution/process/manager
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/execution/process/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple Process Manager Implementation
|
|
3
|
-
*
|
|
4
|
-
* A straightforward implementation of IProcessManager that spawns a fresh
|
|
5
|
-
* process for each task. This is the "simple first" approach that will later
|
|
6
|
-
* be upgraded to support process pooling.
|
|
7
|
-
*
|
|
8
|
-
* Supports any CLI tool/agent (Claude Code, Codex, Gemini CLI, etc.)
|
|
9
|
-
*
|
|
10
|
-
* Key features:
|
|
11
|
-
* - One process per task (no pooling)
|
|
12
|
-
* - Event-based I/O streaming
|
|
13
|
-
* - Graceful termination (SIGTERM → SIGKILL)
|
|
14
|
-
* - Automatic cleanup
|
|
15
|
-
* - Metrics tracking
|
|
16
|
-
* - Agent-agnostic design
|
|
17
|
-
*
|
|
18
|
-
* @module execution/process/simple-manager
|
|
19
|
-
*/
|
|
20
|
-
import type { ManagedProcess, ProcessConfig, ProcessMetrics, OutputHandler, ErrorHandler } from "./types.js";
|
|
21
|
-
import type { IProcessManager } from "./manager.js";
|
|
22
|
-
/**
|
|
23
|
-
* Simple process manager that spawns one process per task
|
|
24
|
-
*
|
|
25
|
-
* This implementation follows the "simple first" principle - it provides
|
|
26
|
-
* a production-ready process manager without the complexity of pooling.
|
|
27
|
-
*
|
|
28
|
-
* Works with any CLI tool/agent by accepting executable path and args.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* // Claude Code example
|
|
33
|
-
* const manager = new SimpleProcessManager({
|
|
34
|
-
* executablePath: 'claude',
|
|
35
|
-
* args: ['--print', '--output-format', 'stream-json'],
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* const process = await manager.acquireProcess({
|
|
39
|
-
* executablePath: 'claude',
|
|
40
|
-
* args: ['--print', '--output-format', 'stream-json'],
|
|
41
|
-
* workDir: '/path/to/project',
|
|
42
|
-
* timeout: 300000,
|
|
43
|
-
* });
|
|
44
|
-
*
|
|
45
|
-
* // Codex example
|
|
46
|
-
* const codexProcess = await manager.acquireProcess({
|
|
47
|
-
* executablePath: 'codex',
|
|
48
|
-
* args: ['--mode', 'agent', '--json'],
|
|
49
|
-
* workDir: '/path/to/project',
|
|
50
|
-
* });
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export declare class SimpleProcessManager implements IProcessManager {
|
|
54
|
-
private readonly _defaultConfig;
|
|
55
|
-
private _activeProcesses;
|
|
56
|
-
private _cleanupTimers;
|
|
57
|
-
private _metrics;
|
|
58
|
-
/**
|
|
59
|
-
* Create a new SimpleProcessManager
|
|
60
|
-
*
|
|
61
|
-
* @param defaultConfig - Default configuration to merge with per-process config
|
|
62
|
-
*/
|
|
63
|
-
constructor(_defaultConfig?: Partial<ProcessConfig>);
|
|
64
|
-
acquireProcess(config: ProcessConfig): Promise<ManagedProcess>;
|
|
65
|
-
/**
|
|
66
|
-
* Spawn a process with the given configuration
|
|
67
|
-
*
|
|
68
|
-
* @param config - Process configuration
|
|
69
|
-
* @returns ChildProcess instance
|
|
70
|
-
*/
|
|
71
|
-
private spawnProcess;
|
|
72
|
-
/**
|
|
73
|
-
* Set up event handlers for a managed process
|
|
74
|
-
*
|
|
75
|
-
* Handles lifecycle events:
|
|
76
|
-
* - exit: Process terminated normally or abnormally
|
|
77
|
-
* - error: Process encountered an error
|
|
78
|
-
* - stdout/stderr data: Track activity for idle detection
|
|
79
|
-
*
|
|
80
|
-
* @param managedProcess - The managed process to set up handlers for
|
|
81
|
-
* @param config - Process configuration (for timeout)
|
|
82
|
-
*/
|
|
83
|
-
private setupProcessHandlers;
|
|
84
|
-
releaseProcess(processId: string): Promise<void>;
|
|
85
|
-
terminateProcess(processId: string, signal?: NodeJS.Signals): Promise<void>;
|
|
86
|
-
sendInput(processId: string, input: string): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Close stdin stream for a process
|
|
89
|
-
*
|
|
90
|
-
* Signals EOF to the process, useful for programs that wait for stdin to close.
|
|
91
|
-
*
|
|
92
|
-
* @param processId - ID of the process
|
|
93
|
-
*/
|
|
94
|
-
closeInput(processId: string): void;
|
|
95
|
-
onOutput(processId: string, handler: OutputHandler): void;
|
|
96
|
-
onError(processId: string, handler: ErrorHandler): void;
|
|
97
|
-
getProcess(processId: string): ManagedProcess | null;
|
|
98
|
-
getActiveProcesses(): ManagedProcess[];
|
|
99
|
-
getMetrics(): ProcessMetrics;
|
|
100
|
-
shutdown(): Promise<void>;
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=simple-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simple-manager.d.ts","sourceRoot":"","sources":["../../../src/execution/process/simple-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IAgB9C,OAAO,CAAC,QAAQ,CAAC,cAAc;IAf3C,OAAO,CAAC,gBAAgB,CAAqC;IAC7D,OAAO,CAAC,cAAc,CAAqC;IAC3D,OAAO,CAAC,QAAQ,CAMd;IAEF;;;;OAIG;gBAC0B,cAAc,GAAE,OAAO,CAAC,aAAa,CAAM;IAElE,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAsDpE;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAapB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,oBAAoB;IA8FtB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,MAAM,CAAC,OAAmB,GACjC,OAAO,CAAC,IAAI,CAAC;IAkDV,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAchE;;;;;;OAMG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IASnC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;IAezD,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;IAWvD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAIpD,kBAAkB,IAAI,cAAc,EAAE;IAItC,UAAU,IAAI,cAAc;IAKtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAahC"}
|