@codexhost/cli-darwin-x64 0.6.1 → 0.7.0

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.
@@ -20183,6 +20183,7 @@ var KiroAcpTransport = class {
20183
20183
  #replay = null;
20184
20184
  #sessionId = null;
20185
20185
  #stderrTail = "";
20186
+ #configUpdates = /* @__PURE__ */ new Set();
20186
20187
  constructor(options) {
20187
20188
  this.#options = options;
20188
20189
  this.#commandTimeoutMs = options.commandTimeoutMs ?? 3e4;
@@ -20341,13 +20342,28 @@ var KiroAcpTransport = class {
20341
20342
  };
20342
20343
  }
20343
20344
  async #setConfigOptionOnSession(connection, sessionId, configId, value) {
20345
+ const confirmation = Promise.withResolvers();
20346
+ const listener = {
20347
+ update: (params) => {
20348
+ if (params.sessionId !== sessionId || params.update.sessionUpdate !== "config_option_update")
20349
+ return;
20350
+ try {
20351
+ confirmation.resolve(confirmedKiroConfig(params.update, configId, value));
20352
+ } catch {
20353
+ }
20354
+ },
20355
+ cancel: () => confirmation.reject(new KiroTransportError("unavailable", "Kiro Session closed during configuration"))
20356
+ };
20357
+ void confirmation.promise.catch(() => void 0);
20358
+ this.#configUpdates.add(listener);
20344
20359
  try {
20345
- const result = await withTimeout(connection.setSessionConfigOption({
20346
- sessionId,
20347
- configId,
20348
- value
20349
- }), this.#commandTimeoutMs, `Kiro set_config_option (${configId})`);
20350
- return confirmedKiroConfig(result, configId, value);
20360
+ return await withTimeout((async () => {
20361
+ const result = await connection.setSessionConfigOption({ sessionId, configId, value });
20362
+ if (configId === "model" && Array.isArray(result.configOptions) && !result.configOptions.some((option) => option.id === "model")) {
20363
+ return confirmation.promise;
20364
+ }
20365
+ return confirmedKiroConfig(result, configId, value);
20366
+ })(), this.#commandTimeoutMs, `Kiro set_config_option (${configId})`);
20351
20367
  } catch (error51) {
20352
20368
  if (error51 instanceof KiroRequestTimeoutError) {
20353
20369
  this.#fault(error51);
@@ -20356,6 +20372,8 @@ var KiroAcpTransport = class {
20356
20372
  throw new KiroTransportError("unavailable", `Failed to set ${configId} config option`, {
20357
20373
  cause: error51
20358
20374
  });
20375
+ } finally {
20376
+ this.#configUpdates.delete(listener);
20359
20377
  }
20360
20378
  }
20361
20379
  async #forkSession(params) {
@@ -20506,6 +20524,8 @@ var KiroAcpTransport = class {
20506
20524
  return initialize;
20507
20525
  }
20508
20526
  #handleUpdate(params) {
20527
+ for (const listener of this.#configUpdates)
20528
+ listener.update(params);
20509
20529
  const update = params.update;
20510
20530
  const meta3 = isRecord4(update) && isRecord4(update._meta) ? update._meta : void 0;
20511
20531
  const kiroMeta = meta3 && isRecord4(meta3.kiro) ? meta3.kiro : void 0;
@@ -20608,6 +20628,9 @@ var KiroAcpTransport = class {
20608
20628
  return;
20609
20629
  this.#closed = true;
20610
20630
  this.#closing = true;
20631
+ for (const listener of this.#configUpdates)
20632
+ listener.cancel();
20633
+ this.#configUpdates.clear();
20611
20634
  try {
20612
20635
  if (this.#child) {
20613
20636
  const child = this.#child;
@@ -17437,7 +17437,6 @@ var PiRpcSession = class {
17437
17437
  #closePromise = null;
17438
17438
  #compactionActive = false;
17439
17439
  #compactionTurn = null;
17440
- #compactionTimeout = null;
17441
17440
  #failed = false;
17442
17441
  #pending = /* @__PURE__ */ new Map();
17443
17442
  #state = null;
@@ -17453,7 +17452,6 @@ var PiRpcSession = class {
17453
17452
  }
17454
17453
  this.#options = {
17455
17454
  commandTimeoutMs: 3e4,
17456
- compactionTimeoutMs: 3e5,
17457
17455
  cancelTimeoutMs: 2e3,
17458
17456
  closeTimeoutMs: 2e3,
17459
17457
  ...options
@@ -17795,10 +17793,6 @@ var PiRpcSession = class {
17795
17793
  if (value.type === "compaction_start") {
17796
17794
  this.#compactionActive = true;
17797
17795
  this.#compactionTurn = this.#activeTurn;
17798
- this.#compactionTimeout ??= setTimeout(() => {
17799
- this.#compactionTimeout = null;
17800
- this.#fail(new PiRpcFaultError("protocolError", `Pi RPC compaction timed out after ${this.#options.compactionTimeoutMs}ms`));
17801
- }, this.#options.compactionTimeoutMs);
17802
17796
  const onEvent = this.#activeTurn?.onEvent ?? this.#manualCompaction?.onEvent;
17803
17797
  onEvent?.({ type: "compaction.started" });
17804
17798
  for (const pending of this.#pending.values()) {
@@ -17811,9 +17805,6 @@ var PiRpcSession = class {
17811
17805
  }
17812
17806
  if (value.type === "compaction_end") {
17813
17807
  this.#compactionActive = false;
17814
- if (this.#compactionTimeout)
17815
- clearTimeout(this.#compactionTimeout);
17816
- this.#compactionTimeout = null;
17817
17808
  const compactionTurn = this.#compactionTurn;
17818
17809
  this.#compactionTurn = null;
17819
17810
  for (const [id, pending] of this.#pending) {
@@ -18303,9 +18294,6 @@ var PiRpcSession = class {
18303
18294
  }
18304
18295
  }
18305
18296
  #rejectAll(error51) {
18306
- if (this.#compactionTimeout)
18307
- clearTimeout(this.#compactionTimeout);
18308
- this.#compactionTimeout = null;
18309
18297
  for (const pending of this.#pending.values()) {
18310
18298
  if (pending.timeout)
18311
18299
  clearTimeout(pending.timeout);