@codexhost/cli 0.12.0 → 0.12.2

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.12.0
8
+ npm install -g @codexhost/cli@0.12.2
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.
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.12.0";
9
+ const version = "0.12.2";
10
10
  const userArguments = process.argv.slice(2);
11
11
  const repositoryUrl = "https://github.com/BytePioneer-AI/codex-host";
12
12
  const startupTraceStartedAt = Date.now();
@@ -206,6 +206,7 @@ const updateEnvironment = {
206
206
  const remoteSshBootstrapEnvironment = [
207
207
  "CODEX_INSTALL_DIR",
208
208
  "CODEXHOST_DATA_DIR",
209
+ // Retired; older remote profile blocks still export it.
209
210
  "CODEXHOST_DEFAULT_AGENT",
210
211
  "CODEXHOST_HOST_NODE_PATH",
211
212
  "CODEXHOST_HOST_RUNTIME_PATH",
@@ -228,7 +229,7 @@ if (userArguments.length === 0) {
228
229
  launchArguments = userArguments;
229
230
  } else if (userArguments[0] === "inspect") {
230
231
  launchArguments = userArguments;
231
- } else if (userArguments[0] === "console") {
232
+ } else if (userArguments[0] === "console" || userArguments[0] === "update") {
232
233
  launchArguments = null;
233
234
  consoleArguments = userArguments.slice(1);
234
235
  } else if (userArguments[0] === "remote") {
@@ -252,6 +253,7 @@ if (userArguments.length === 0) {
252
253
  " codexhost --version",
253
254
  " codexhost inspect",
254
255
  " codexhost console",
256
+ " codexhost update",
255
257
  " codexhost launch [launcher options]",
256
258
  " codexhost remote install|start|stop|status|uninstall",
257
259
  " codexhost broker install|status|stop|uninstall",
@@ -298,9 +300,9 @@ if (launchArguments?.[0] === "launch") {
298
300
  }
299
301
 
300
302
  if (consoleArguments !== null) {
301
- if (consoleArguments.length > 0) fail("console accepts no arguments");
303
+ if (consoleArguments.length > 0) fail(userArguments[0] + " accepts no arguments");
302
304
  if (!existsSync(consoleServer)) fail(`missing console: ${consoleServer}`);
303
- const child = spawn(process.execPath, [consoleServer, "open"], {
305
+ const child = spawn(process.execPath, [consoleServer, userArguments[0] === "update" ? "update" : "open"], {
304
306
  env: { ...updateEnvironment, CODEXHOST_LAUNCHER_EXECUTABLE: launcher },
305
307
  stdio: "inherit",
306
308
  windowsHide: true,
@@ -351,26 +353,50 @@ if (consoleArguments !== null) {
351
353
  process.exit(code ?? 1);
352
354
  });
353
355
  } else if (remoteArguments !== null) {
356
+ // Every Harness whose plugin selects a BrokeredHarnessAdapter for a managed
357
+ // macOS remote Host needs its own Aqua LaunchAgent. Keep this list in sync with
358
+ // those plugin factories; Claude Code keeps the legacy unlabelled invocation.
359
+ // Install only registers them: the remote Host starts a broker on demand for an
360
+ // installed Harness and the broker exits when idle.
361
+ const nativeBrokerHarnessIds = ["claude-code", "codebuddy", "workbuddy", "cursor-cli"];
354
362
  const runNativeBroker = (command) => {
355
- const broker = spawn(
356
- launcher,
357
- ["broker", command, "--node", process.execPath, "--host-runtime", hostRuntime],
358
- {
359
- env: updateEnvironment,
360
- // remote status is a stable JSON stdout surface. Keep the broker's
361
- // human-readable status beside it on stderr instead of corrupting JSON.
362
- stdio: command === "status" ? ["inherit", process.stderr, "inherit"] : "inherit",
363
- windowsHide: true,
364
- },
365
- );
366
- broker.on("error", (error) => fail(error.message));
367
- broker.on("exit", (code, signal) => {
368
- if (signal) {
369
- process.kill(process.pid, signal);
363
+ let index = 0;
364
+ let firstFailure = 0;
365
+ // Run every broker even after a failure so one broken service cannot leave
366
+ // the others stale or installed, then report the first failure.
367
+ const next = () => {
368
+ if (index >= nativeBrokerHarnessIds.length) {
369
+ process.exit(firstFailure);
370
370
  return;
371
371
  }
372
- process.exit(code ?? 1);
373
- });
372
+ const harnessId = nativeBrokerHarnessIds[index++];
373
+ const broker = spawn(
374
+ launcher,
375
+ [
376
+ "broker",
377
+ command,
378
+ ...(harnessId === "claude-code" ? [] : ["--harness", harnessId]),
379
+ "--node", process.execPath, "--host-runtime", hostRuntime,
380
+ ],
381
+ {
382
+ env: updateEnvironment,
383
+ // remote status is a stable JSON stdout surface. Keep the broker's
384
+ // human-readable status beside it on stderr instead of corrupting JSON.
385
+ stdio: command === "status" ? ["inherit", process.stderr, "inherit"] : "inherit",
386
+ windowsHide: true,
387
+ },
388
+ );
389
+ broker.on("error", (error) => fail(error.message));
390
+ broker.on("exit", (code, signal) => {
391
+ if (signal) {
392
+ process.kill(process.pid, signal);
393
+ return;
394
+ }
395
+ if (code !== 0 && firstFailure === 0) firstFailure = code ?? 1;
396
+ next();
397
+ });
398
+ };
399
+ next();
374
400
  };
375
401
  const child = spawn(
376
402
  process.execPath,
@@ -410,6 +436,11 @@ if (consoleArguments !== null) {
410
436
  runNativeBroker("uninstall");
411
437
  return;
412
438
  }
439
+ if (remoteArguments[0] === "stop") {
440
+ // Brokers stay registered for on-demand starts by the next remote Host.
441
+ runNativeBroker("stop");
442
+ return;
443
+ }
413
444
  }
414
445
  process.exit(code ?? 1);
415
446
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codexhost/cli",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,12 +14,12 @@
14
14
  "node": ">=22"
15
15
  },
16
16
  "optionalDependencies": {
17
- "@codexhost/cli-darwin-arm64": "0.12.0",
18
- "@codexhost/cli-darwin-x64": "0.12.0",
19
- "@codexhost/cli-win32-x64": "0.12.0",
20
- "@codexhost/cli-win32-arm64": "0.12.0",
21
- "@codexhost/cli-linux-x64": "0.12.0",
22
- "@codexhost/cli-linux-arm64": "0.12.0"
17
+ "@codexhost/cli-darwin-arm64": "0.12.2",
18
+ "@codexhost/cli-darwin-x64": "0.12.2",
19
+ "@codexhost/cli-win32-x64": "0.12.2",
20
+ "@codexhost/cli-win32-arm64": "0.12.2",
21
+ "@codexhost/cli-linux-x64": "0.12.2",
22
+ "@codexhost/cli-linux-arm64": "0.12.2"
23
23
  },
24
24
  "keywords": [
25
25
  "codex",