@codexhost/cli-darwin-arm64 0.17.3 → 0.17.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
@@ -7,7 +7,7 @@ Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm install -g @codexhost/cli@0.17.3
10
+ npm install -g @codexhost/cli@0.17.4
11
11
  ```
12
12
 
13
13
  Do not install this package directly. npm selects it through the optional dependencies of `@codexhost/cli`.
@@ -1 +1 @@
1
- {"schemaVersion":1,"version":"0.17.3","distribution":"npm","target":"macos-arm64"}
1
+ {"schemaVersion":1,"version":"0.17.4","distribution":"npm","target":"macos-arm64"}
@@ -65,6 +65,12 @@ async function openRendererLocalPage(execute, url2, targets) {
65
65
  }
66
66
 
67
67
  // packages/desktop-control/src/cdp-client.ts
68
+ var CdpConnectionClosedError = class extends Error {
69
+ constructor(message) {
70
+ super(message);
71
+ this.name = "CdpConnectionClosedError";
72
+ }
73
+ };
68
74
  function cdpExceptionMessage(details, fallback) {
69
75
  const exception = details.exception;
70
76
  if (isRecord(exception) && typeof exception.description === "string" && exception.description) {
@@ -152,8 +158,14 @@ var CdpClient = class _CdpClient {
152
158
  this.#socket = socket;
153
159
  this.#commandTimeoutMs = commandTimeoutMs;
154
160
  socket.addEventListener("message", (event) => this.#onMessage(event));
155
- socket.addEventListener("error", () => this.#fail(new Error("CDP WebSocket failed")));
156
- socket.addEventListener("close", () => this.#fail(new Error("CDP WebSocket closed")));
161
+ socket.addEventListener(
162
+ "error",
163
+ () => this.#disconnect(new CdpConnectionClosedError("CDP WebSocket failed"))
164
+ );
165
+ socket.addEventListener(
166
+ "close",
167
+ () => this.#disconnect(new CdpConnectionClosedError("CDP WebSocket closed"))
168
+ );
157
169
  }
158
170
  static async connect(url2, options = {}) {
159
171
  loopbackUrl(url2, ["ws:", "wss:"]);
@@ -201,7 +213,7 @@ var CdpClient = class _CdpClient {
201
213
  };
202
214
  }
203
215
  #send(method, params, sessionId) {
204
- if (this.#closed) return Promise.reject(new Error("CDP client is closed"));
216
+ if (this.#closed) return Promise.reject(new CdpConnectionClosedError("CDP client is closed"));
205
217
  const id = this.#nextId++;
206
218
  return new Promise((resolve, reject) => {
207
219
  const timeout = setTimeout(() => {
@@ -255,9 +267,12 @@ var CdpClient = class _CdpClient {
255
267
  }
256
268
  }
257
269
  close() {
270
+ this.#disconnect(new CdpConnectionClosedError("CDP client closed"));
271
+ }
272
+ #disconnect(error51) {
258
273
  if (this.#closed) return;
259
274
  this.#closed = true;
260
- this.#fail(new Error("CDP client closed"));
275
+ this.#fail(error51);
261
276
  this.#listeners.clear();
262
277
  this.#socket.close();
263
278
  }
@@ -19284,6 +19299,7 @@ async function waitForBinding(renderer, enabledAgents, timeoutMs, pollIntervalMs
19284
19299
  if (value !== null) return validateBindingStatus(value, enabledAgents);
19285
19300
  } catch (error51) {
19286
19301
  lastError = error51;
19302
+ if (error51 instanceof CdpConnectionClosedError) throw error51;
19287
19303
  if (error51 instanceof RendererAdapterReadinessError && error51.state !== "installing") {
19288
19304
  throw error51;
19289
19305
  }
@@ -19561,6 +19577,7 @@ function parseDesktopControllerArguments(arguments_) {
19561
19577
  function isTransientRendererInstallError(error51) {
19562
19578
  let current = error51;
19563
19579
  for (let depth = 0; depth < 4; depth += 1) {
19580
+ if (current instanceof CdpConnectionClosedError) return true;
19564
19581
  const message = current instanceof Error ? current.message : String(current);
19565
19582
  if (message.includes("Execution context was destroyed") || message.includes("Promise was collected")) {
19566
19583
  return true;
@@ -22113,6 +22113,12 @@ function createLocalPageOpener(environment) {
22113
22113
  }
22114
22114
 
22115
22115
  // packages/desktop-control/dist/cdp-client.js
22116
+ var CdpConnectionClosedError = class extends Error {
22117
+ constructor(message2) {
22118
+ super(message2);
22119
+ this.name = "CdpConnectionClosedError";
22120
+ }
22121
+ };
22116
22122
  function cdpExceptionMessage(details, fallback) {
22117
22123
  const exception = details.exception;
22118
22124
  if (isRecord(exception) && typeof exception.description === "string" && exception.description) {
@@ -22207,8 +22213,8 @@ var CdpClient = class _CdpClient {
22207
22213
  this.#socket = socket;
22208
22214
  this.#commandTimeoutMs = commandTimeoutMs;
22209
22215
  socket.addEventListener("message", (event) => this.#onMessage(event));
22210
- socket.addEventListener("error", () => this.#fail(new Error("CDP WebSocket failed")));
22211
- socket.addEventListener("close", () => this.#fail(new Error("CDP WebSocket closed")));
22216
+ socket.addEventListener("error", () => this.#disconnect(new CdpConnectionClosedError("CDP WebSocket failed")));
22217
+ socket.addEventListener("close", () => this.#disconnect(new CdpConnectionClosedError("CDP WebSocket closed")));
22212
22218
  }
22213
22219
  static async connect(url2, options = {}) {
22214
22220
  loopbackUrl(url2, ["ws:", "wss:"]);
@@ -22259,7 +22265,7 @@ var CdpClient = class _CdpClient {
22259
22265
  }
22260
22266
  #send(method, params, sessionId) {
22261
22267
  if (this.#closed)
22262
- return Promise.reject(new Error("CDP client is closed"));
22268
+ return Promise.reject(new CdpConnectionClosedError("CDP client is closed"));
22263
22269
  const id2 = this.#nextId++;
22264
22270
  return new Promise((resolve, reject) => {
22265
22271
  const timeout = setTimeout(() => {
@@ -22302,10 +22308,13 @@ var CdpClient = class _CdpClient {
22302
22308
  }
22303
22309
  }
22304
22310
  close() {
22311
+ this.#disconnect(new CdpConnectionClosedError("CDP client closed"));
22312
+ }
22313
+ #disconnect(error51) {
22305
22314
  if (this.#closed)
22306
22315
  return;
22307
22316
  this.#closed = true;
22308
- this.#fail(new Error("CDP client closed"));
22317
+ this.#fail(error51);
22309
22318
  this.#listeners.clear();
22310
22319
  this.#socket.close();
22311
22320
  }
@@ -25185,6 +25194,8 @@ async function waitForBinding(renderer, enabledAgents, timeoutMs, pollIntervalMs
25185
25194
  return validateBindingStatus(value2, enabledAgents);
25186
25195
  } catch (error51) {
25187
25196
  lastError = error51;
25197
+ if (error51 instanceof CdpConnectionClosedError)
25198
+ throw error51;
25188
25199
  if (error51 instanceof RendererAdapterReadinessError && error51.state !== "installing") {
25189
25200
  throw error51;
25190
25201
  }
@@ -32621,7 +32632,6 @@ var NativeAccountObserver = class {
32621
32632
  this.#initialized = true;
32622
32633
  this.#lastGeneration = nativeGeneration ?? -1;
32623
32634
  this.#scheduleAccountUpdate();
32624
- if (nativeGeneration !== void 0) this.observe({ method: "account/updated" });
32625
32635
  }
32626
32636
  /** Called after forwarding the native frame. Identity read failure cannot alter its outcome. */
32627
32637
  observe(value2) {
@@ -47054,9 +47064,6 @@ async function prepareLocalCodex(input) {
47054
47064
  current = currentCodexAccountFromOfficialRead(response.result);
47055
47065
  return snapshot2();
47056
47066
  });
47057
- void accounts.refresh?.()?.catch(() => {
47058
- input.diagnosticOutput.write("codexhost: Codex Account identity could not be read\n");
47059
- });
47060
47067
  return {
47061
47068
  officialRuntimeScope: scope,
47062
47069
  accountControl: accounts,
package/bin/codexhost CHANGED
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codexhost/cli-darwin-arm64",
3
- "version": "0.17.3",
3
+ "version": "0.17.4",
4
4
  "description": "Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.",
5
5
  "type": "module",
6
6
  "files": [