@codexhost/cli 0.3.3 → 0.3.5

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 CHANGED
@@ -5,7 +5,7 @@ Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install -g @codexhost/cli@0.3.3
8
+ npm install -g @codexhost/cli@0.3.5
9
9
  ```
10
10
 
11
11
  npm automatically installs the matching macOS, Windows, or Linux platform package. Node.js 22 or 24 and the official ChatGPT/Codex Desktop are required.
@@ -17,6 +17,6 @@ codexhost --version
17
17
  codexhost
18
18
  ```
19
19
 
20
- The `codexhost` command starts Codex Desktop and returns immediately: the packaged Launcher keeps supervising in the background and exits after you quit the Desktop. Re-running `codexhost` attaches to the same controlled instance.
20
+ The `codexhost` command starts Codex Desktop. On macOS and Linux it returns immediately while the packaged Launcher keeps supervising in the background. On Windows, the command remains attached until Codex Desktop exits so shells that clean up process trees of completed commands cannot discard the supervisor. Re-running `codexhost` attaches to the same controlled instance.
21
21
 
22
22
  If installation used `--omit=optional`, reinstall without that option so npm can select the native package for the current architecture.
package/bin/codexhost.js CHANGED
@@ -6,7 +6,7 @@ import { homedir } from "node:os";
6
6
  import path from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
 
9
- const version = "0.3.3";
9
+ const version = "0.3.5";
10
10
  const userArguments = process.argv.slice(2);
11
11
  const startupTraceStartedAt = Date.now();
12
12
  function startupTrace(stage) {
@@ -29,7 +29,8 @@ const platformPackages = {
29
29
  "darwin-x64": "@codexhost/cli-darwin-x64",
30
30
  "win32-x64": "@codexhost/cli-win32-x64",
31
31
  "win32-arm64": "@codexhost/cli-win32-arm64",
32
- "linux-x64": "@codexhost/cli-linux-x64"
32
+ "linux-x64": "@codexhost/cli-linux-x64",
33
+ "linux-arm64": "@codexhost/cli-linux-arm64"
33
34
  };
34
35
  const platformKey = `${process.platform}-${process.arch}`;
35
36
  const platformPackage = platformPackages[platformKey];
@@ -275,9 +276,12 @@ if (remoteArguments !== null) {
275
276
  });
276
277
  } else if (launchArguments?.[0] === "launch") {
277
278
  // The Launcher prints "ready" once the Desktop, Controller, and Host chain
278
- // are up, then detaches from the terminal to keep supervising. Return
279
- // success immediately so the terminal is not held open by this command.
279
+ // are up, then detaches from the terminal to keep supervising. Windows
280
+ // command hosts may clean up a completed command's process tree, so keep the
281
+ // npm parent alive there until the managed Desktop exits. Other platforms
282
+ // return immediately after startup as before.
280
283
  startupTrace("spawning Launcher");
284
+ const keepLauncherForeground = process.platform === "win32";
281
285
  const child = spawn(launcher, launchArguments, {
282
286
  env: updateEnvironment,
283
287
  stdio: ["ignore", "pipe", "inherit"],
@@ -291,20 +295,28 @@ if (remoteArguments !== null) {
291
295
  process.exit(code);
292
296
  };
293
297
  child.stdout.setEncoding("utf8");
298
+ let ready = false;
294
299
  let launcherOutput = "";
300
+ const readyMarker = "ready\n";
295
301
  child.stdout.on("data", (chunk) => {
296
- launcherOutput += chunk;
297
- if (launcherOutput.includes("ready\n")) {
302
+ if (ready) return;
303
+ const output = launcherOutput + chunk;
304
+ if (output.includes(readyMarker)) {
305
+ ready = true;
306
+ launcherOutput = "";
298
307
  startupTrace("received Launcher ready");
299
- finish(0);
308
+ if (!keepLauncherForeground) finish(0);
309
+ return;
300
310
  }
311
+ // Only retain the tail needed to recognize a marker split across chunks.
312
+ launcherOutput = output.slice(1 - readyMarker.length);
301
313
  });
302
314
  child.on("error", (error) => {
303
315
  startupTrace("Launcher spawn failed: " + error.message);
304
316
  fail(error.message);
305
317
  });
306
318
  child.on("exit", (code, signal) => {
307
- startupTrace("Launcher exited before ready");
319
+ startupTrace(ready ? "Launcher exited after ready" : "Launcher exited before ready");
308
320
  if (signal) {
309
321
  process.kill(process.pid, signal);
310
322
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codexhost/cli",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,11 +14,12 @@
14
14
  "node": ">=22"
15
15
  },
16
16
  "optionalDependencies": {
17
- "@codexhost/cli-darwin-arm64": "0.3.3",
18
- "@codexhost/cli-darwin-x64": "0.3.3",
19
- "@codexhost/cli-win32-x64": "0.3.3",
20
- "@codexhost/cli-win32-arm64": "0.3.3",
21
- "@codexhost/cli-linux-x64": "0.3.3"
17
+ "@codexhost/cli-darwin-arm64": "0.3.5",
18
+ "@codexhost/cli-darwin-x64": "0.3.5",
19
+ "@codexhost/cli-win32-x64": "0.3.5",
20
+ "@codexhost/cli-win32-arm64": "0.3.5",
21
+ "@codexhost/cli-linux-x64": "0.3.5",
22
+ "@codexhost/cli-linux-arm64": "0.3.5"
22
23
  },
23
24
  "keywords": [
24
25
  "codex",