@codexhost/cli 0.3.3 → 0.3.4

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.4
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.4";
10
10
  const userArguments = process.argv.slice(2);
11
11
  const startupTraceStartedAt = Date.now();
12
12
  function startupTrace(stage) {
@@ -275,9 +275,12 @@ if (remoteArguments !== null) {
275
275
  });
276
276
  } else if (launchArguments?.[0] === "launch") {
277
277
  // 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.
278
+ // are up, then detaches from the terminal to keep supervising. Windows
279
+ // command hosts may clean up a completed command's process tree, so keep the
280
+ // npm parent alive there until the managed Desktop exits. Other platforms
281
+ // return immediately after startup as before.
280
282
  startupTrace("spawning Launcher");
283
+ const keepLauncherForeground = process.platform === "win32";
281
284
  const child = spawn(launcher, launchArguments, {
282
285
  env: updateEnvironment,
283
286
  stdio: ["ignore", "pipe", "inherit"],
@@ -291,20 +294,28 @@ if (remoteArguments !== null) {
291
294
  process.exit(code);
292
295
  };
293
296
  child.stdout.setEncoding("utf8");
297
+ let ready = false;
294
298
  let launcherOutput = "";
299
+ const readyMarker = "ready\n";
295
300
  child.stdout.on("data", (chunk) => {
296
- launcherOutput += chunk;
297
- if (launcherOutput.includes("ready\n")) {
301
+ if (ready) return;
302
+ const output = launcherOutput + chunk;
303
+ if (output.includes(readyMarker)) {
304
+ ready = true;
305
+ launcherOutput = "";
298
306
  startupTrace("received Launcher ready");
299
- finish(0);
307
+ if (!keepLauncherForeground) finish(0);
308
+ return;
300
309
  }
310
+ // Only retain the tail needed to recognize a marker split across chunks.
311
+ launcherOutput = output.slice(1 - readyMarker.length);
301
312
  });
302
313
  child.on("error", (error) => {
303
314
  startupTrace("Launcher spawn failed: " + error.message);
304
315
  fail(error.message);
305
316
  });
306
317
  child.on("exit", (code, signal) => {
307
- startupTrace("Launcher exited before ready");
318
+ startupTrace(ready ? "Launcher exited after ready" : "Launcher exited before ready");
308
319
  if (signal) {
309
320
  process.kill(process.pid, signal);
310
321
  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.4",
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,11 @@
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.4",
18
+ "@codexhost/cli-darwin-x64": "0.3.4",
19
+ "@codexhost/cli-win32-x64": "0.3.4",
20
+ "@codexhost/cli-win32-arm64": "0.3.4",
21
+ "@codexhost/cli-linux-x64": "0.3.4"
22
22
  },
23
23
  "keywords": [
24
24
  "codex",