codex-harness 0.0.0-stage → 0.2.1

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.
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { version } = require('../package.json');
5
+ const platform = `${process.platform}-${process.arch}`;
6
+ const supported = new Set(['darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64', 'win32-arm64', 'win32-x64']);
7
+
8
+ function fail(message) {
9
+ console.error(`codex-harness: ${message}`);
10
+ process.exit(1);
11
+ }
12
+
13
+ if (!supported.has(platform)) fail(`Unsupported platform ${platform}. Build from source: https://github.com/ErzenXz/codex-harness`);
14
+ const name = `@erzenx/codex-harness-${platform}`;
15
+ let binary;
16
+ try {
17
+ const manifest = require.resolve(`${name}/package.json`);
18
+ if (require(manifest).version !== version) fail(`Native package version mismatch. Reinstall codex-harness@${version}.`);
19
+ binary = require('node:path').join(require('node:path').dirname(manifest), 'bin', `codex-harness${process.platform === 'win32' ? '.exe' : ''}`);
20
+ require('node:fs').accessSync(binary, require('node:fs').constants.X_OK);
21
+ } catch {
22
+ fail(`Missing ${name}@${version}. Reinstall with optional dependencies enabled (no --no-optional/--omit=optional). No binary is downloaded at runtime.`);
23
+ }
24
+
25
+ const args = process.argv.slice(2);
26
+ if (args.length === 1 && args[0] === '--print-binary-path') {
27
+ console.log(binary);
28
+ } else if (process.platform !== 'win32' && typeof process.execve === 'function') {
29
+ // Replace Node entirely: no resident launcher, pipe proxy, signal proxy or extra RSS.
30
+ process.execve(binary, [binary, ...args], process.env);
31
+ } else {
32
+ const { spawn } = require('node:child_process');
33
+ const child = spawn(binary, args, { stdio: 'inherit', windowsHide: true });
34
+ // Windows consoles already deliver Ctrl+C to the native child. Sending
35
+ // child.kill('SIGINT') there would forcibly terminate it before cleanup.
36
+ if (process.platform === 'win32') process.on('SIGINT', () => {});
37
+ const signals = process.platform === 'win32' ? ['SIGTERM'] : ['SIGINT', 'SIGTERM', 'SIGHUP'];
38
+ for (const signal of signals) process.on(signal, () => child.kill(signal));
39
+ child.on('error', (error) => fail(`Cannot launch native binary: ${error.message}`));
40
+ child.on('exit', (code, signal) => {
41
+ if (signal && process.platform !== 'win32') {
42
+ process.removeAllListeners(signal);
43
+ process.kill(process.pid, signal);
44
+ } else {
45
+ process.exitCode = code ?? 1;
46
+ }
47
+ });
48
+ }
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "codex-harness",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.1",
4
+ "description": "Small native Rust coding-agent backend: ACP, streaming, subagents, MCP and ChatGPT sign-in",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ErzenXz/codex-harness.git",
9
+ "directory": "npm/cli"
10
+ },
11
+ "homepage": "https://github.com/ErzenXz/codex-harness#readme",
12
+ "bugs": "https://github.com/ErzenXz/codex-harness/issues",
13
+ "keywords": [
14
+ "agent",
15
+ "acp",
16
+ "codex",
17
+ "mcp",
18
+ "rust"
19
+ ],
20
+ "bin": {
21
+ "codex-harness": "bin/codex-harness.cjs"
22
+ },
23
+ "files": [
24
+ "bin",
25
+ "LICENSE",
26
+ "THIRD_PARTY_NOTICES.md",
27
+ "README.md"
28
+ ],
29
+ "engines": {
30
+ "node": ">=22.15.0"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public",
34
+ "registry": "https://registry.npmjs.org/"
35
+ },
36
+ "optionalDependencies": {
37
+ "@erzenx/codex-harness-darwin-arm64": "0.2.1",
38
+ "@erzenx/codex-harness-darwin-x64": "0.2.1",
39
+ "@erzenx/codex-harness-linux-arm64": "0.2.1",
40
+ "@erzenx/codex-harness-linux-x64": "0.2.1",
41
+ "@erzenx/codex-harness-win32-arm64": "0.2.1",
42
+ "@erzenx/codex-harness-win32-x64": "0.2.1"
43
+ }
6
44
  }