@overlordai/worker 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ansi-stripper.d.ts +11 -0
- package/dist/ansi-stripper.d.ts.map +1 -0
- package/dist/ansi-stripper.js +19 -0
- package/dist/ansi-stripper.js.map +1 -0
- package/dist/capability-detector.d.ts +5 -0
- package/dist/capability-detector.d.ts.map +1 -0
- package/dist/capability-detector.js +43 -0
- package/dist/capability-detector.js.map +1 -0
- package/dist/config.d.ts +27 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +144 -0
- package/dist/config.js.map +1 -0
- package/dist/executor/base.executor.d.ts +55 -0
- package/dist/executor/base.executor.d.ts.map +1 -0
- package/dist/executor/base.executor.js +30 -0
- package/dist/executor/base.executor.js.map +1 -0
- package/dist/executor/claude.executor.d.ts +23 -0
- package/dist/executor/claude.executor.d.ts.map +1 -0
- package/dist/executor/claude.executor.js +106 -0
- package/dist/executor/claude.executor.js.map +1 -0
- package/dist/executor/codex.executor.d.ts +20 -0
- package/dist/executor/codex.executor.d.ts.map +1 -0
- package/dist/executor/codex.executor.js +51 -0
- package/dist/executor/codex.executor.js.map +1 -0
- package/dist/executor/cursor.executor.d.ts +19 -0
- package/dist/executor/cursor.executor.d.ts.map +1 -0
- package/dist/executor/cursor.executor.js +46 -0
- package/dist/executor/cursor.executor.js.map +1 -0
- package/dist/executor/custom.executor.d.ts +21 -0
- package/dist/executor/custom.executor.d.ts.map +1 -0
- package/dist/executor/custom.executor.js +57 -0
- package/dist/executor/custom.executor.js.map +1 -0
- package/dist/executor/executor.factory.d.ts +9 -0
- package/dist/executor/executor.factory.d.ts.map +1 -0
- package/dist/executor/executor.factory.js +29 -0
- package/dist/executor/executor.factory.js.map +1 -0
- package/dist/git-operations.d.ts +23 -0
- package/dist/git-operations.d.ts.map +1 -0
- package/dist/git-operations.js +94 -0
- package/dist/git-operations.js.map +1 -0
- package/dist/hardware.d.ts +14 -0
- package/dist/hardware.d.ts.map +1 -0
- package/dist/hardware.js +92 -0
- package/dist/hardware.js.map +1 -0
- package/dist/healthz.d.ts +14 -0
- package/dist/healthz.d.ts.map +1 -0
- package/dist/healthz.js +104 -0
- package/dist/healthz.js.map +1 -0
- package/dist/jwt-manager.d.ts +23 -0
- package/dist/jwt-manager.d.ts.map +1 -0
- package/dist/jwt-manager.js +169 -0
- package/dist/jwt-manager.js.map +1 -0
- package/dist/lease-manager.d.ts +17 -0
- package/dist/lease-manager.d.ts.map +1 -0
- package/dist/lease-manager.js +62 -0
- package/dist/lease-manager.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +497 -0
- package/dist/main.js.map +1 -0
- package/dist/orphan-reaper.d.ts +6 -0
- package/dist/orphan-reaper.d.ts.map +1 -0
- package/dist/orphan-reaper.js +148 -0
- package/dist/orphan-reaper.js.map +1 -0
- package/dist/pipeline-parser.d.ts +14 -0
- package/dist/pipeline-parser.d.ts.map +1 -0
- package/dist/pipeline-parser.js +183 -0
- package/dist/pipeline-parser.js.map +1 -0
- package/dist/pipeline-runner.d.ts +120 -0
- package/dist/pipeline-runner.d.ts.map +1 -0
- package/dist/pipeline-runner.js +568 -0
- package/dist/pipeline-runner.js.map +1 -0
- package/dist/project-mutex.d.ts +14 -0
- package/dist/project-mutex.d.ts.map +1 -0
- package/dist/project-mutex.js +25 -0
- package/dist/project-mutex.js.map +1 -0
- package/dist/pty-manager.d.ts +50 -0
- package/dist/pty-manager.d.ts.map +1 -0
- package/dist/pty-manager.js +203 -0
- package/dist/pty-manager.js.map +1 -0
- package/dist/ringbuffer.d.ts +22 -0
- package/dist/ringbuffer.d.ts.map +1 -0
- package/dist/ringbuffer.js +57 -0
- package/dist/ringbuffer.js.map +1 -0
- package/dist/safe-env.d.ts +6 -0
- package/dist/safe-env.d.ts.map +1 -0
- package/dist/safe-env.js +19 -0
- package/dist/safe-env.js.map +1 -0
- package/dist/stage-detector.d.ts +62 -0
- package/dist/stage-detector.d.ts.map +1 -0
- package/dist/stage-detector.js +140 -0
- package/dist/stage-detector.js.map +1 -0
- package/dist/task-handler.d.ts +56 -0
- package/dist/task-handler.d.ts.map +1 -0
- package/dist/task-handler.js +296 -0
- package/dist/task-handler.js.map +1 -0
- package/dist/tunnel-manager.d.ts +34 -0
- package/dist/tunnel-manager.d.ts.map +1 -0
- package/dist/tunnel-manager.js +165 -0
- package/dist/tunnel-manager.js.map +1 -0
- package/dist/worker-client.d.ts +62 -0
- package/dist/worker-client.d.ts.map +1 -0
- package/dist/worker-client.js +303 -0
- package/dist/worker-client.js.map +1 -0
- package/dist/workspace-manager.d.ts +51 -0
- package/dist/workspace-manager.d.ts.map +1 -0
- package/dist/workspace-manager.js +276 -0
- package/dist/workspace-manager.js.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip ANSI escape sequences from a string.
|
|
3
|
+
*
|
|
4
|
+
* Handles:
|
|
5
|
+
* - CSI sequences (colors, cursor movement, etc.)
|
|
6
|
+
* - OSC sequences (window titles, hyperlinks, etc.)
|
|
7
|
+
* - Single-character escape sequences
|
|
8
|
+
* - Control characters
|
|
9
|
+
*/
|
|
10
|
+
export declare function stripAnsi(input: string): string;
|
|
11
|
+
//# sourceMappingURL=ansi-stripper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi-stripper.d.ts","sourceRoot":"","sources":["../src/ansi-stripper.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Strip ANSI escape sequences from a string.
|
|
4
|
+
*
|
|
5
|
+
* Handles:
|
|
6
|
+
* - CSI sequences (colors, cursor movement, etc.)
|
|
7
|
+
* - OSC sequences (window titles, hyperlinks, etc.)
|
|
8
|
+
* - Single-character escape sequences
|
|
9
|
+
* - Control characters
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.stripAnsi = stripAnsi;
|
|
13
|
+
// Combined regex for ANSI escape sequences
|
|
14
|
+
// eslint-disable-next-line no-control-regex
|
|
15
|
+
const ANSI_REGEX = /[\u001B\u009B][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><~]|[\u001B]\].*?(?:\u0007|\u001B\\)|[\u001B][^[(\]0-9]/g;
|
|
16
|
+
function stripAnsi(input) {
|
|
17
|
+
return input.replace(ANSI_REGEX, '');
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ansi-stripper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi-stripper.js","sourceRoot":"","sources":["../src/ansi-stripper.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAMH,8BAEC;AAND,2CAA2C;AAC3C,4CAA4C;AAC5C,MAAM,UAAU,GAAG,kIAAkI,CAAC;AAEtJ,SAAgB,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-detector.d.ts","sourceRoot":"","sources":["../src/capability-detector.ts"],"names":[],"mappings":"AAaA,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,IAAI,MAAM,EAAE;IAiBzB,OAAO,CAAC,MAAM,CAAC,WAAW;CAS3B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CapabilityDetector = void 0;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const pino_1 = __importDefault(require("pino"));
|
|
9
|
+
const safe_env_js_1 = require("./safe-env.js");
|
|
10
|
+
const log = (0, pino_1.default)({ name: 'capability-detector' });
|
|
11
|
+
const KNOWN_AGENTS = [
|
|
12
|
+
{ name: 'claude', binary: 'claude' },
|
|
13
|
+
{ name: 'cursor', binary: 'cursor' },
|
|
14
|
+
{ name: 'codex', binary: 'codex' },
|
|
15
|
+
{ name: 'vscode', binary: 'code' },
|
|
16
|
+
];
|
|
17
|
+
class CapabilityDetector {
|
|
18
|
+
static detect() {
|
|
19
|
+
const capabilities = [];
|
|
20
|
+
for (const agent of KNOWN_AGENTS) {
|
|
21
|
+
if (CapabilityDetector.isAvailable(agent.binary)) {
|
|
22
|
+
capabilities.push(agent.name);
|
|
23
|
+
log.info({ capability: agent.name, binary: agent.binary }, 'Capability detected');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (capabilities.length === 0) {
|
|
27
|
+
log.warn('No agent capabilities detected');
|
|
28
|
+
}
|
|
29
|
+
return capabilities;
|
|
30
|
+
}
|
|
31
|
+
static isAvailable(binary) {
|
|
32
|
+
try {
|
|
33
|
+
const cmd = process.platform === 'win32' ? 'where' : 'which';
|
|
34
|
+
(0, node_child_process_1.execFileSync)(cmd, [binary], { stdio: 'pipe', timeout: 5000, env: (0, safe_env_js_1.buildSafeEnv)() });
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.CapabilityDetector = CapabilityDetector;
|
|
43
|
+
//# sourceMappingURL=capability-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-detector.js","sourceRoot":"","sources":["../src/capability-detector.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAkD;AACl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AAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAA,0BAAY,GAAE,EAAE,CAAC,CAAC;YACnF,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AA3BD,gDA2BC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface WorkerConfigData {
|
|
2
|
+
overlordHost: string;
|
|
3
|
+
workerToken: string;
|
|
4
|
+
machineName: string;
|
|
5
|
+
machineId: string;
|
|
6
|
+
recoverySecret: string;
|
|
7
|
+
workspaceRoot: string;
|
|
8
|
+
maxSlots: number;
|
|
9
|
+
dataDir: string;
|
|
10
|
+
sshKeyPath: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class WorkerConfig implements WorkerConfigData {
|
|
13
|
+
overlordHost: string;
|
|
14
|
+
workerToken: string;
|
|
15
|
+
machineName: string;
|
|
16
|
+
machineId: string;
|
|
17
|
+
recoverySecret: string;
|
|
18
|
+
workspaceRoot: string;
|
|
19
|
+
maxSlots: number;
|
|
20
|
+
dataDir: string;
|
|
21
|
+
sshKeyPath: string;
|
|
22
|
+
private envPath;
|
|
23
|
+
static load(): WorkerConfig;
|
|
24
|
+
persist(key: string, value: string): void;
|
|
25
|
+
private readEnvFile;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,YAAa,YAAW,gBAAgB;IACnD,YAAY,SAAM;IAClB,WAAW,SAAM;IACjB,WAAW,SAAM;IACjB,SAAS,SAAM;IACf,cAAc,SAAM;IACpB,aAAa,SAAM;IACnB,QAAQ,SAAK;IACb,OAAO,SAAM;IACb,UAAU,SAAM;IAEhB,OAAO,CAAC,OAAO,CAAM;IAErB,MAAM,CAAC,IAAI,IAAI,YAAY;IA2C3B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAoCzC,OAAO,CAAC,WAAW;CAiBpB"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.WorkerConfig = void 0;
|
|
40
|
+
const fs = __importStar(require("node:fs"));
|
|
41
|
+
const path = __importStar(require("node:path"));
|
|
42
|
+
const pino_1 = __importDefault(require("pino"));
|
|
43
|
+
const log = (0, pino_1.default)({ name: 'worker-config' });
|
|
44
|
+
class WorkerConfig {
|
|
45
|
+
overlordHost = '';
|
|
46
|
+
workerToken = '';
|
|
47
|
+
machineName = '';
|
|
48
|
+
machineId = '';
|
|
49
|
+
recoverySecret = '';
|
|
50
|
+
workspaceRoot = '';
|
|
51
|
+
maxSlots = 2;
|
|
52
|
+
dataDir = '';
|
|
53
|
+
sshKeyPath = '';
|
|
54
|
+
envPath = '';
|
|
55
|
+
static load() {
|
|
56
|
+
const config = new WorkerConfig();
|
|
57
|
+
const dataDir = process.env['OVERLORD_DATA_DIR'] || path.join(process.env['HOME'] || '/tmp', '.overlord-worker');
|
|
58
|
+
config.dataDir = dataDir;
|
|
59
|
+
config.envPath = path.join(dataDir, '.env');
|
|
60
|
+
if (!fs.existsSync(dataDir)) {
|
|
61
|
+
fs.mkdirSync(dataDir, { recursive: true, mode: 0o700 });
|
|
62
|
+
}
|
|
63
|
+
// Load from environment first, then from .env file
|
|
64
|
+
const envValues = config.readEnvFile();
|
|
65
|
+
config.overlordHost = process.env['OVERLORD_HOST'] || envValues['OVERLORD_HOST'] || '';
|
|
66
|
+
config.workerToken = process.env['OVERLORD_WORKER_TOKEN'] || envValues['OVERLORD_WORKER_TOKEN'] || '';
|
|
67
|
+
config.machineName = process.env['OVERLORD_MACHINE_NAME'] || envValues['OVERLORD_MACHINE_NAME'] || '';
|
|
68
|
+
config.machineId = process.env['OVERLORD_MACHINE_ID'] || envValues['OVERLORD_MACHINE_ID'] || '';
|
|
69
|
+
config.recoverySecret = process.env['OVERLORD_RECOVERY_SECRET'] || envValues['OVERLORD_RECOVERY_SECRET'] || '';
|
|
70
|
+
config.workspaceRoot = process.env['OVERLORD_WORKSPACE_ROOT'] || envValues['OVERLORD_WORKSPACE_ROOT'] || path.join(dataDir, 'workspaces');
|
|
71
|
+
config.maxSlots = parseInt(process.env['OVERLORD_MAX_SLOTS'] || envValues['OVERLORD_MAX_SLOTS'] || '2', 10);
|
|
72
|
+
config.sshKeyPath = process.env['OVERLORD_SSH_KEY_PATH'] || envValues['OVERLORD_SSH_KEY_PATH'] || '';
|
|
73
|
+
if (!config.overlordHost) {
|
|
74
|
+
throw new Error('OVERLORD_HOST is required');
|
|
75
|
+
}
|
|
76
|
+
if (!config.workerToken && !config.machineId) {
|
|
77
|
+
throw new Error('OVERLORD_WORKER_TOKEN or OVERLORD_MACHINE_ID is required');
|
|
78
|
+
}
|
|
79
|
+
if (!config.machineName) {
|
|
80
|
+
const os = require('node:os');
|
|
81
|
+
config.machineName = os.hostname();
|
|
82
|
+
}
|
|
83
|
+
// Ensure workspace root exists
|
|
84
|
+
if (!fs.existsSync(config.workspaceRoot)) {
|
|
85
|
+
fs.mkdirSync(config.workspaceRoot, { recursive: true, mode: 0o755 });
|
|
86
|
+
}
|
|
87
|
+
log.info({ dataDir: config.dataDir, overlordHost: config.overlordHost, machineName: config.machineName }, 'Config loaded');
|
|
88
|
+
return config;
|
|
89
|
+
}
|
|
90
|
+
persist(key, value) {
|
|
91
|
+
// Reject values containing newlines or control characters to prevent .env injection
|
|
92
|
+
if (/[\n\r\0]/.test(value)) {
|
|
93
|
+
throw new Error(`Cannot persist value for ${key}: contains newline or control character`);
|
|
94
|
+
}
|
|
95
|
+
const envValues = this.readEnvFile();
|
|
96
|
+
envValues[key] = value;
|
|
97
|
+
const lines = [];
|
|
98
|
+
for (const [k, v] of Object.entries(envValues)) {
|
|
99
|
+
lines.push(`${k}=${v}`);
|
|
100
|
+
}
|
|
101
|
+
fs.writeFileSync(this.envPath, lines.join('\n') + '\n', { mode: 0o600 });
|
|
102
|
+
// Update in-memory value
|
|
103
|
+
const propMap = {
|
|
104
|
+
'OVERLORD_HOST': 'overlordHost',
|
|
105
|
+
'OVERLORD_WORKER_TOKEN': 'workerToken',
|
|
106
|
+
'OVERLORD_MACHINE_NAME': 'machineName',
|
|
107
|
+
'OVERLORD_MACHINE_ID': 'machineId',
|
|
108
|
+
'OVERLORD_RECOVERY_SECRET': 'recoverySecret',
|
|
109
|
+
'OVERLORD_WORKSPACE_ROOT': 'workspaceRoot',
|
|
110
|
+
'OVERLORD_MAX_SLOTS': 'maxSlots',
|
|
111
|
+
'OVERLORD_SSH_KEY_PATH': 'sshKeyPath',
|
|
112
|
+
};
|
|
113
|
+
const prop = propMap[key];
|
|
114
|
+
if (prop) {
|
|
115
|
+
if (prop === 'maxSlots') {
|
|
116
|
+
this[prop] = parseInt(value, 10);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
this[prop] = value;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
readEnvFile() {
|
|
124
|
+
const result = {};
|
|
125
|
+
if (!fs.existsSync(this.envPath)) {
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
const content = fs.readFileSync(this.envPath, 'utf-8');
|
|
129
|
+
for (const line of content.split('\n')) {
|
|
130
|
+
const trimmed = line.trim();
|
|
131
|
+
if (!trimmed || trimmed.startsWith('#'))
|
|
132
|
+
continue;
|
|
133
|
+
const eqIndex = trimmed.indexOf('=');
|
|
134
|
+
if (eqIndex === -1)
|
|
135
|
+
continue;
|
|
136
|
+
const k = trimmed.substring(0, eqIndex).trim();
|
|
137
|
+
const v = trimmed.substring(eqIndex + 1).trim();
|
|
138
|
+
result[k] = v;
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.WorkerConfig = WorkerConfig;
|
|
144
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAClC,gDAAwB;AAExB,MAAM,GAAG,GAAG,IAAA,cAAI,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;AAc5C,MAAa,YAAY;IACvB,YAAY,GAAG,EAAE,CAAC;IAClB,WAAW,GAAG,EAAE,CAAC;IACjB,WAAW,GAAG,EAAE,CAAC;IACjB,SAAS,GAAG,EAAE,CAAC;IACf,cAAc,GAAG,EAAE,CAAC;IACpB,aAAa,GAAG,EAAE,CAAC;IACnB,QAAQ,GAAG,CAAC,CAAC;IACb,OAAO,GAAG,EAAE,CAAC;IACb,UAAU,GAAG,EAAE,CAAC;IAER,OAAO,GAAG,EAAE,CAAC;IAErB,MAAM,CAAC,IAAI;QACT,MAAM,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAElC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,MAAM,EAAE,kBAAkB,CAAC,CAAC;QACjH,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,O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IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACvC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,SAAS;YAClD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACrC,IAAI,OAAO,KAAK,CAAC,CAAC;gBAAE,SAAS;YAC7B,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;YAC/C,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAChD,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA7GD,oCA6GC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { IPty } from 'node-pty';
|
|
2
|
+
import type { AgentType, ConfigSnapshot, StageConfig } from '@overlordai/protocol';
|
|
3
|
+
export type FailureType = 'binary_missing' | 'auth_failure' | 'rate_limit' | 'unknown';
|
|
4
|
+
export interface AuthErrorResult {
|
|
5
|
+
detected: boolean;
|
|
6
|
+
failureType: FailureType;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Abstract base class for agent executors.
|
|
10
|
+
* Each supported agent CLI (Claude, Cursor, etc.) extends this class
|
|
11
|
+
* to provide agent-specific argument building, prompt detection, and error handling.
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class AgentExecutor {
|
|
14
|
+
abstract readonly agentType: AgentType;
|
|
15
|
+
/**
|
|
16
|
+
* Build CLI arguments for the agent command.
|
|
17
|
+
* @param config - The task's configuration snapshot.
|
|
18
|
+
* @param workspacePath - The workspace directory path (for checking local config files).
|
|
19
|
+
*/
|
|
20
|
+
abstract buildArgs(config: ConfigSnapshot, workspacePath: string): string[];
|
|
21
|
+
/**
|
|
22
|
+
* Return the CLI command to invoke (e.g. 'claude', 'cursor').
|
|
23
|
+
*/
|
|
24
|
+
abstract getStartCommand(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Detect whether the agent CLI is showing an interactive prompt,
|
|
27
|
+
* indicating it is waiting for user input.
|
|
28
|
+
* @param cleanOutput - ANSI-stripped recent PTY output.
|
|
29
|
+
*/
|
|
30
|
+
abstract detectPrompt(cleanOutput: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Detect whether a pipeline stage has completed, by checking for
|
|
33
|
+
* the STAGE_DONE_SENTINEL marker in the output.
|
|
34
|
+
* @param cleanOutput - ANSI-stripped recent PTY output.
|
|
35
|
+
* @param stage - The current stage name to check for.
|
|
36
|
+
*/
|
|
37
|
+
abstract detectStageComplete(cleanOutput: string, stage: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Detect authentication or availability errors in early PTY output.
|
|
40
|
+
* Returns null if no error detected.
|
|
41
|
+
* @param cleanOutput - ANSI-stripped recent PTY output.
|
|
42
|
+
*/
|
|
43
|
+
abstract detectAuthError(cleanOutput: string): AuthErrorResult | null;
|
|
44
|
+
/**
|
|
45
|
+
* Format a stage command as input text to send to the agent CLI.
|
|
46
|
+
* @param stage - The pipeline stage configuration.
|
|
47
|
+
*/
|
|
48
|
+
abstract formatCommand(stage: StageConfig): string;
|
|
49
|
+
/**
|
|
50
|
+
* Spawn a PTY process for this agent.
|
|
51
|
+
* Uses node-pty to create the pseudo-terminal.
|
|
52
|
+
*/
|
|
53
|
+
spawn(workspacePath: string, env: Record<string, string>, config: ConfigSnapshot): IPty;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=base.executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.executor.d.ts","sourceRoot":"","sources":["../../src/executor/base.executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnF,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,cAAc,GAAG,YAAY,GAAG,SAAS,CAAC;AAEvF,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED;;;;GAIG;AACH,8BAAsB,aAAa;IACjC,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE;IAE3E;;OAEG;IACH,QAAQ,CAAC,eAAe,IAAI,MAAM;IAElC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAEnD;;;;;OAKG;IACH,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAEzE;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAErE;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;IAElD;;;OAGG;IACH,KAAK,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI;CAexF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentExecutor = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Abstract base class for agent executors.
|
|
6
|
+
* Each supported agent CLI (Claude, Cursor, etc.) extends this class
|
|
7
|
+
* to provide agent-specific argument building, prompt detection, and error handling.
|
|
8
|
+
*/
|
|
9
|
+
class AgentExecutor {
|
|
10
|
+
/**
|
|
11
|
+
* Spawn a PTY process for this agent.
|
|
12
|
+
* Uses node-pty to create the pseudo-terminal.
|
|
13
|
+
*/
|
|
14
|
+
spawn(workspacePath, env, config) {
|
|
15
|
+
// Lazy require to avoid issues if node-pty native module isn't available at import time
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
17
|
+
const pty = require('node-pty');
|
|
18
|
+
const command = this.getStartCommand();
|
|
19
|
+
const args = this.buildArgs(config, workspacePath);
|
|
20
|
+
return pty.spawn(command, args, {
|
|
21
|
+
name: 'xterm-256color',
|
|
22
|
+
cols: 120,
|
|
23
|
+
rows: 40,
|
|
24
|
+
cwd: workspacePath,
|
|
25
|
+
env,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.AgentExecutor = AgentExecutor;
|
|
30
|
+
//# sourceMappingURL=base.executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.executor.js","sourceRoot":"","sources":["../../src/executor/base.executor.ts"],"names":[],"mappings":";;;AAUA;;;;GAIG;AACH,MAAsB,aAAa;IA2CjC;;;OAGG;IACH,KAAK,CAAC,aAAqB,EAAE,GAA2B,EAAE,MAAsB;QAC9E,wFAAwF;QACxF,iEAAiE;QACjE,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAA8B,CAAC;QAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAEnD,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YAC9B,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,EAAE;YACR,GAAG,EAAE,aAAa;YAClB,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;CACF;AA9DD,sCA8DC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AgentType } from '@overlordai/protocol';
|
|
2
|
+
import type { ConfigSnapshot, StageConfig } from '@overlordai/protocol';
|
|
3
|
+
import { AgentExecutor } from './base.executor.js';
|
|
4
|
+
import type { AuthErrorResult } from './base.executor.js';
|
|
5
|
+
/**
|
|
6
|
+
* Executor for Claude Code CLI.
|
|
7
|
+
*
|
|
8
|
+
* Uses FAIL_CLOSED permission strategy:
|
|
9
|
+
* - If allowedTools is 'DANGEROUSLY_SKIP' → --dangerously-skip-permissions
|
|
10
|
+
* - If allowedTools is set → --allowedTools <value>
|
|
11
|
+
* - Otherwise → project must have .claude/settings.json or throw
|
|
12
|
+
*/
|
|
13
|
+
export declare class ClaudeExecutor extends AgentExecutor {
|
|
14
|
+
readonly agentType = AgentType.CLAUDE;
|
|
15
|
+
getStartCommand(): string;
|
|
16
|
+
buildArgs(config: ConfigSnapshot, workspacePath: string): string[];
|
|
17
|
+
detectPrompt(cleanOutput: string): boolean;
|
|
18
|
+
detectStageComplete(cleanOutput: string, stage: string): boolean;
|
|
19
|
+
detectAuthError(cleanOutput: string): AuthErrorResult | null;
|
|
20
|
+
formatCommand(stage: StageConfig): string;
|
|
21
|
+
private hasProjectSettings;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=claude.executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.executor.d.ts","sourceRoot":"","sources":["../../src/executor/claude.executor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAuB,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAC/C,QAAQ,CAAC,SAAS,oBAAoB;IAEtC,eAAe,IAAI,MAAM;IAIzB,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE;IAwBlE,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAK1C,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAShE,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAa5D,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;IAIzC,OAAO,CAAC,kBAAkB;CAI3B"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ClaudeExecutor = void 0;
|
|
37
|
+
const fs = __importStar(require("node:fs"));
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
const protocol_1 = require("@overlordai/protocol");
|
|
40
|
+
const base_executor_js_1 = require("./base.executor.js");
|
|
41
|
+
/**
|
|
42
|
+
* Executor for Claude Code CLI.
|
|
43
|
+
*
|
|
44
|
+
* Uses FAIL_CLOSED permission strategy:
|
|
45
|
+
* - If allowedTools is 'DANGEROUSLY_SKIP' → --dangerously-skip-permissions
|
|
46
|
+
* - If allowedTools is set → --allowedTools <value>
|
|
47
|
+
* - Otherwise → project must have .claude/settings.json or throw
|
|
48
|
+
*/
|
|
49
|
+
class ClaudeExecutor extends base_executor_js_1.AgentExecutor {
|
|
50
|
+
agentType = protocol_1.AgentType.CLAUDE;
|
|
51
|
+
getStartCommand() {
|
|
52
|
+
return 'claude';
|
|
53
|
+
}
|
|
54
|
+
buildArgs(config, workspacePath) {
|
|
55
|
+
const args = [];
|
|
56
|
+
// Permission strategy: FAIL_CLOSED
|
|
57
|
+
if (config.allowedTools === 'DANGEROUSLY_SKIP') {
|
|
58
|
+
args.push('--dangerously-skip-permissions');
|
|
59
|
+
}
|
|
60
|
+
else if (config.allowedTools) {
|
|
61
|
+
args.push('--allowedTools', config.allowedTools);
|
|
62
|
+
}
|
|
63
|
+
else if (!this.hasProjectSettings(workspacePath)) {
|
|
64
|
+
throw new Error('FAIL_CLOSED: Project has no permission configuration. ' +
|
|
65
|
+
'Set allowedTools in project config or provide .claude/settings.json in the workspace.');
|
|
66
|
+
}
|
|
67
|
+
args.push('--max-turns', String(config.maxTurns ?? 50));
|
|
68
|
+
if (config.skillsPath) {
|
|
69
|
+
args.push('--skills-path', config.skillsPath);
|
|
70
|
+
}
|
|
71
|
+
return args;
|
|
72
|
+
}
|
|
73
|
+
detectPrompt(cleanOutput) {
|
|
74
|
+
// Match Claude Code's ❯ or > prompt at end of output
|
|
75
|
+
return /[❯>]\s*$/.test(cleanOutput.trimEnd());
|
|
76
|
+
}
|
|
77
|
+
detectStageComplete(cleanOutput, stage) {
|
|
78
|
+
// Priority 1: Sentinel marker
|
|
79
|
+
if (cleanOutput.includes(`${protocol_1.STAGE_DONE_SENTINEL}${stage}]]`)) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
// Priority 2/3: Determined by Pipeline Runner
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
detectAuthError(cleanOutput) {
|
|
86
|
+
if (/Authentication failed|Please log in/i.test(cleanOutput)) {
|
|
87
|
+
return { detected: true, failureType: 'auth_failure' };
|
|
88
|
+
}
|
|
89
|
+
if (/Rate limit exceeded/i.test(cleanOutput)) {
|
|
90
|
+
return { detected: true, failureType: 'rate_limit' };
|
|
91
|
+
}
|
|
92
|
+
if (/command not found|ENOENT/i.test(cleanOutput)) {
|
|
93
|
+
return { detected: true, failureType: 'binary_missing' };
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
formatCommand(stage) {
|
|
98
|
+
return stage.command ?? stage.name;
|
|
99
|
+
}
|
|
100
|
+
hasProjectSettings(workspacePath) {
|
|
101
|
+
const settingsPath = path.join(workspacePath, '.claude', 'settings.json');
|
|
102
|
+
return fs.existsSync(settingsPath);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.ClaudeExecutor = ClaudeExecutor;
|
|
106
|
+
//# sourceMappingURL=claude.executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.executor.js","sourceRoot":"","sources":["../../src/executor/claude.executor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAClC,mDAAsE;AAEtE,yDAAmD;AAGnD;;;;;;;GAOG;AACH,MAAa,cAAe,SAAQ,gCAAa;IACtC,SAAS,GAAG,oBAAS,CAAC,MAAM,CAAC;IAEtC,eAAe;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,SAAS,CAAC,MAAsB,EAAE,aAAqB;QACrD,MAAM,IAAI,GAAa,EAAE,CAAC;QAE1B,mCAAmC;QACnC,IAAI,MAAM,CAAC,YAAY,KAAK,kBAAkB,EAAE,CAAC;YAC/C,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;QACnD,CAAC;aAAM,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CACb,wDAAwD;gBACxD,uFAAuF,CACxF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;QAExD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,CAAC,WAAmB;QAC9B,qDAAqD;QACrD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
|
3
|
+
import { AgentExecutor } from './base.executor.js';
|
|
4
|
+
import type { AuthErrorResult } from './base.executor.js';
|
|
5
|
+
/**
|
|
6
|
+
* Executor for OpenAI Codex CLI.
|
|
7
|
+
*
|
|
8
|
+
* Provides basic integration with the codex CLI tool.
|
|
9
|
+
* Uses --full-auto flag for fully automated mode.
|
|
10
|
+
*/
|
|
11
|
+
export declare class CodexExecutor extends AgentExecutor {
|
|
12
|
+
readonly agentType = AgentType.CODEX;
|
|
13
|
+
getStartCommand(): string;
|
|
14
|
+
buildArgs(config: ConfigSnapshot, _workspacePath: string): string[];
|
|
15
|
+
detectPrompt(cleanOutput: string): boolean;
|
|
16
|
+
detectStageComplete(cleanOutput: string, stage: string): boolean;
|
|
17
|
+
detectAuthError(cleanOutput: string): AuthErrorResult | null;
|
|
18
|
+
formatCommand(stage: StageConfig): string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=codex.executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.executor.d.ts","sourceRoot":"","sources":["../../src/executor/codex.executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,aAAa;IAC9C,QAAQ,CAAC,SAAS,mBAAmB;IAErC,eAAe,IAAI,MAAM;IAIzB,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE;IAUnE,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAK1C,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAOhE,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAa5D,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;CAG1C"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodexExecutor = void 0;
|
|
4
|
+
const protocol_1 = require("@overlordai/protocol");
|
|
5
|
+
const base_executor_js_1 = require("./base.executor.js");
|
|
6
|
+
/**
|
|
7
|
+
* Executor for OpenAI Codex CLI.
|
|
8
|
+
*
|
|
9
|
+
* Provides basic integration with the codex CLI tool.
|
|
10
|
+
* Uses --full-auto flag for fully automated mode.
|
|
11
|
+
*/
|
|
12
|
+
class CodexExecutor extends base_executor_js_1.AgentExecutor {
|
|
13
|
+
agentType = protocol_1.AgentType.CODEX;
|
|
14
|
+
getStartCommand() {
|
|
15
|
+
return 'codex';
|
|
16
|
+
}
|
|
17
|
+
buildArgs(config, _workspacePath) {
|
|
18
|
+
const args = ['--full-auto'];
|
|
19
|
+
if (config.maxTurns) {
|
|
20
|
+
args.push('--max-turns', String(config.maxTurns));
|
|
21
|
+
}
|
|
22
|
+
return args;
|
|
23
|
+
}
|
|
24
|
+
detectPrompt(cleanOutput) {
|
|
25
|
+
// Match Codex's prompt indicators at end of output
|
|
26
|
+
return /[>❯]\s*$/.test(cleanOutput.trimEnd());
|
|
27
|
+
}
|
|
28
|
+
detectStageComplete(cleanOutput, stage) {
|
|
29
|
+
if (cleanOutput.includes(`${protocol_1.STAGE_DONE_SENTINEL}${stage}]]`)) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
detectAuthError(cleanOutput) {
|
|
35
|
+
if (/Authentication failed|Please log in|invalid.*api.*key/i.test(cleanOutput)) {
|
|
36
|
+
return { detected: true, failureType: 'auth_failure' };
|
|
37
|
+
}
|
|
38
|
+
if (/Rate limit exceeded|too many requests/i.test(cleanOutput)) {
|
|
39
|
+
return { detected: true, failureType: 'rate_limit' };
|
|
40
|
+
}
|
|
41
|
+
if (/command not found|ENOENT/i.test(cleanOutput)) {
|
|
42
|
+
return { detected: true, failureType: 'binary_missing' };
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
formatCommand(stage) {
|
|
47
|
+
return stage.command ?? stage.name;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.CodexExecutor = CodexExecutor;
|
|
51
|
+
//# sourceMappingURL=codex.executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.executor.js","sourceRoot":"","sources":["../../src/executor/codex.executor.ts"],"names":[],"mappings":";;;AAAA,mDAAsE;AAEtE,yDAAmD;AAGnD;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,gCAAa;IACrC,SAAS,GAAG,oBAAS,CAAC,KAAK,CAAC;IAErC,eAAe;QACb,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS,CAAC,MAAsB,EAAE,cAAsB;QACtD,MAAM,IAAI,GAAa,CAAC,aAAa,CAAC,CAAC;QAEvC,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACpD,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,CAAC,WAAmB;QAC9B,mDAAmD;QACnD,OAAO,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,mBAAmB,CAAC,WAAmB,EAAE,KAAa;QACpD,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,8BAAmB,GAAG,KAAK,IAAI,CAAC,EAAE,CAAC;YAC7D,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAe,CAAC,WAAmB;QACjC,IAAI,wDAAwD,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/E,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;QACzD,CAAC;QACD,IAAI,wCAAwC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;QACvD,CAAC;QACD,IAAI,2BAA2B,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAClD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,KAAkB;QAC9B,OAAO,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC;IACrC,CAAC;CACF;AA7CD,sCA6CC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AgentType } from '@overlordai/protocol';
|
|
2
|
+
import type { ConfigSnapshot, StageConfig } from '@overlordai/protocol';
|
|
3
|
+
import { AgentExecutor } from './base.executor.js';
|
|
4
|
+
import type { AuthErrorResult } from './base.executor.js';
|
|
5
|
+
/**
|
|
6
|
+
* Executor for Cursor Agent CLI.
|
|
7
|
+
*
|
|
8
|
+
* Uses --yolo flag for fully automated mode.
|
|
9
|
+
*/
|
|
10
|
+
export declare class CursorExecutor extends AgentExecutor {
|
|
11
|
+
readonly agentType = AgentType.CURSOR;
|
|
12
|
+
getStartCommand(): string;
|
|
13
|
+
buildArgs(_config: ConfigSnapshot, _workspacePath: string): string[];
|
|
14
|
+
detectPrompt(cleanOutput: string): boolean;
|
|
15
|
+
detectStageComplete(cleanOutput: string, stage: string): boolean;
|
|
16
|
+
detectAuthError(cleanOutput: string): AuthErrorResult | null;
|
|
17
|
+
formatCommand(stage: StageConfig): string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=cursor.executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.executor.d.ts","sourceRoot":"","sources":["../../src/executor/cursor.executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAC/C,QAAQ,CAAC,SAAS,oBAAoB;IAEtC,eAAe,IAAI,MAAM;IAIzB,SAAS,CAAC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE;IAIpE,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAK1C,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAOhE,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAa5D,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;CAG1C"}
|