@shumkov/orchestra 0.6.0 → 0.7.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/README.md +12 -4
- package/docs/CLAUDE_CODE_2_1_220.md +1 -1
- package/docs/codex-app-server-compatibility.md +631 -0
- package/index.js +18 -3
- package/lib/codex/app-server-client.js +2866 -0
- package/lib/codex/app-server-supervisor.mjs +41 -0
- package/lib/codex/preflight.js +1073 -0
- package/lib/codex/protocol-schema.json +237 -0
- package/lib/process/codex-process.js +2814 -0
- package/lib/process/factory.js +345 -1
- package/lib/process/process-manager.js +1140 -84
- package/lib/process/process.js +16 -0
- package/package.json +5 -3
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
const [binary, ...args] = process.argv.slice(2);
|
|
4
|
+
if (!binary) process.exit(64);
|
|
5
|
+
|
|
6
|
+
const child = spawn(binary, args, {
|
|
7
|
+
cwd: process.cwd(),
|
|
8
|
+
env: process.env,
|
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
process.stdin.pipe(child.stdin);
|
|
13
|
+
child.stdout.pipe(process.stdout, { end: false });
|
|
14
|
+
child.stderr.pipe(process.stderr, { end: false });
|
|
15
|
+
child.stdin.on('error', () => {});
|
|
16
|
+
|
|
17
|
+
let childExited = false;
|
|
18
|
+
let outputEnded = false;
|
|
19
|
+
|
|
20
|
+
function finishChild() {
|
|
21
|
+
if (childExited) return;
|
|
22
|
+
childExited = true;
|
|
23
|
+
if (!outputEnded) {
|
|
24
|
+
outputEnded = true;
|
|
25
|
+
process.stdout.end();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
child.once('error', finishChild);
|
|
30
|
+
child.once('close', finishChild);
|
|
31
|
+
child.stdout.once('error', finishChild);
|
|
32
|
+
child.stderr.once('error', finishChild);
|
|
33
|
+
|
|
34
|
+
// The supervisor remains the owned process-group leader while the parent
|
|
35
|
+
// verifies that Codex and every descendant have left the group.
|
|
36
|
+
process.on('SIGTERM', () => {});
|
|
37
|
+
process.on('SIGUSR1', () => {
|
|
38
|
+
if (childExited) process.exit(0);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
setInterval(() => {}, 60_000);
|