codeam-cli 2.73.0 → 2.73.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/index.js +310 -258
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -128,11 +128,11 @@ var init_stdio_proxy = __esm({
128
128
  rl.on("close", () => this.child?.stdin?.end());
129
129
  const timer = setInterval(() => this.checkRestart(stdout), RESTART_CHECK_INTERVAL_MS);
130
130
  timer.unref();
131
- return new Promise((resolve10) => {
131
+ return new Promise((resolve11) => {
132
132
  this.ended = (code) => {
133
133
  clearInterval(timer);
134
134
  process.exitCode = code;
135
- resolve10();
135
+ resolve11();
136
136
  };
137
137
  });
138
138
  }
@@ -542,7 +542,7 @@ async function runHttpRelay(delivery, client3, id) {
542
542
  requestInit: { headers: buildHttpHeaders(delivery.httpHeaders, token) }
543
543
  });
544
544
  const stdioTransport = new StdioServerTransport();
545
- await new Promise((resolve10, reject) => {
545
+ await new Promise((resolve11, reject) => {
546
546
  let done = false;
547
547
  const watchdog = createToolCallWatchdog({
548
548
  timeoutMs: TOOL_CALL_TIMEOUT_MS,
@@ -556,7 +556,7 @@ async function runHttpRelay(delivery, client3, id) {
556
556
  void httpTransport.close().catch(() => void 0);
557
557
  void stdioTransport.close().catch(() => void 0);
558
558
  if (err) reject(err);
559
- else resolve10();
559
+ else resolve11();
560
560
  };
561
561
  stdioTransport.onmessage = (msg) => {
562
562
  watchdog.onClientMessage(msg);
@@ -5865,14 +5865,14 @@ async function addSourceContext(frames) {
5865
5865
  return frames;
5866
5866
  }
5867
5867
  function getContextLinesFromFile(path95, ranges, output) {
5868
- return new Promise((resolve10) => {
5868
+ return new Promise((resolve11) => {
5869
5869
  const stream = (0, import_node_fs.createReadStream)(path95);
5870
5870
  const lineReaded = (0, import_node_readline.createInterface)({
5871
5871
  input: stream
5872
5872
  });
5873
5873
  function destroyStreamAndResolve() {
5874
5874
  stream.destroy();
5875
- resolve10();
5875
+ resolve11();
5876
5876
  }
5877
5877
  let lineNumber = 0;
5878
5878
  let currentRangeIndex = 0;
@@ -7159,9 +7159,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
7159
7159
  if (!waitUntil) return;
7160
7160
  if (this.disabled || this.optedOut) return;
7161
7161
  if (!this._waitUntilCycle) {
7162
- let resolve10;
7162
+ let resolve11;
7163
7163
  const promise = new Promise((r) => {
7164
- resolve10 = r;
7164
+ resolve11 = r;
7165
7165
  });
7166
7166
  try {
7167
7167
  waitUntil(promise);
@@ -7169,7 +7169,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
7169
7169
  return;
7170
7170
  }
7171
7171
  this._waitUntilCycle = {
7172
- resolve: resolve10,
7172
+ resolve: resolve11,
7173
7173
  startedAt: Date.now(),
7174
7174
  timer: void 0
7175
7175
  };
@@ -7193,12 +7193,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
7193
7193
  return cycle?.resolve;
7194
7194
  }
7195
7195
  async resolveWaitUntilFlush() {
7196
- const resolve10 = this._consumeWaitUntilCycle();
7196
+ const resolve11 = this._consumeWaitUntilCycle();
7197
7197
  try {
7198
7198
  await super.flush();
7199
7199
  } catch {
7200
7200
  } finally {
7201
- resolve10?.();
7201
+ resolve11?.();
7202
7202
  }
7203
7203
  }
7204
7204
  getPersistedProperty(key) {
@@ -7290,15 +7290,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
7290
7290
  async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
7291
7291
  if (this.isLocalEvaluationReady()) return true;
7292
7292
  if (void 0 === this.featureFlagsPoller) return false;
7293
- return new Promise((resolve10) => {
7293
+ return new Promise((resolve11) => {
7294
7294
  const timeout = setTimeout(() => {
7295
7295
  cleanup();
7296
- resolve10(false);
7296
+ resolve11(false);
7297
7297
  }, timeoutMs);
7298
7298
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
7299
7299
  clearTimeout(timeout);
7300
7300
  cleanup();
7301
- resolve10(count > 0);
7301
+ resolve11(count > 0);
7302
7302
  });
7303
7303
  });
7304
7304
  }
@@ -7735,13 +7735,13 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
7735
7735
  this.context?.enter(data, options);
7736
7736
  }
7737
7737
  async _shutdown(shutdownTimeoutMs) {
7738
- const resolve10 = this._consumeWaitUntilCycle();
7738
+ const resolve11 = this._consumeWaitUntilCycle();
7739
7739
  await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
7740
7740
  this.errorTracking.shutdown();
7741
7741
  try {
7742
7742
  return await super._shutdown(shutdownTimeoutMs);
7743
7743
  } finally {
7744
- resolve10?.();
7744
+ resolve11?.();
7745
7745
  }
7746
7746
  }
7747
7747
  async _requestRemoteConfigPayload(flagKey) {
@@ -8097,7 +8097,7 @@ function readAnonId() {
8097
8097
  }
8098
8098
  function superProperties() {
8099
8099
  return {
8100
- cliVersion: true ? "2.73.0" : "0.0.0-dev",
8100
+ cliVersion: true ? "2.73.2" : "0.0.0-dev",
8101
8101
  nodeVersion: process.version,
8102
8102
  platform: process.platform,
8103
8103
  arch: process.arch,
@@ -8244,10 +8244,10 @@ var _execSeam = {
8244
8244
  }
8245
8245
  };
8246
8246
  var _execSeamAsync = {
8247
- exec: (file, args2, opts) => new Promise((resolve10, reject) => {
8247
+ exec: (file, args2, opts) => new Promise((resolve11, reject) => {
8248
8248
  (0, import_child_process.execFile)(file, args2, opts, (err, stdout) => {
8249
8249
  if (err) reject(err);
8250
- else resolve10(typeof stdout === "string" ? stdout : stdout.toString("utf8"));
8250
+ else resolve11(typeof stdout === "string" ? stdout : stdout.toString("utf8"));
8251
8251
  });
8252
8252
  })
8253
8253
  };
@@ -8339,7 +8339,7 @@ var http = __toESM(require("http"));
8339
8339
  // package.json
8340
8340
  var package_default = {
8341
8341
  name: "codeam-cli",
8342
- version: "2.73.0",
8342
+ version: "2.73.2",
8343
8343
  description: "Workflow-continuity bridge for AI coding agents. Wrap Claude Code or Codex in a PTY and supervise, approve, and redirect the session from any device \u2014 async. The terminal companion for CodeAgent Mobile.",
8344
8344
  type: "commonjs",
8345
8345
  main: "dist/index.js",
@@ -8471,8 +8471,8 @@ async function requestCode(pluginId, pluginSecretHash) {
8471
8471
  });
8472
8472
  let timer;
8473
8473
  const timeoutSentinel = /* @__PURE__ */ Symbol("request-code-timeout");
8474
- const timeoutPromise = new Promise((resolve10) => {
8475
- timer = setTimeout(() => resolve10(timeoutSentinel), REQUEST_CODE_TIMEOUT_MS);
8474
+ const timeoutPromise = new Promise((resolve11) => {
8475
+ timer = setTimeout(() => resolve11(timeoutSentinel), REQUEST_CODE_TIMEOUT_MS);
8476
8476
  });
8477
8477
  const result = await Promise.race([post2, timeoutPromise]);
8478
8478
  clearTimeout(timer);
@@ -8943,7 +8943,7 @@ async function postBeadsProvisioning(input) {
8943
8943
  }
8944
8944
  }
8945
8945
  async function _postJsonAuthed(url2, body, pluginAuthToken) {
8946
- return new Promise((resolve10, reject) => {
8946
+ return new Promise((resolve11, reject) => {
8947
8947
  const data = JSON.stringify(body);
8948
8948
  const u2 = new URL(url2);
8949
8949
  const transport = u2.protocol === "https:" ? https : http;
@@ -8973,9 +8973,9 @@ async function _postJsonAuthed(url2, body, pluginAuthToken) {
8973
8973
  return;
8974
8974
  }
8975
8975
  try {
8976
- resolve10(JSON.parse(responseBody));
8976
+ resolve11(JSON.parse(responseBody));
8977
8977
  } catch {
8978
- resolve10(null);
8978
+ resolve11(null);
8979
8979
  }
8980
8980
  });
8981
8981
  }
@@ -9001,7 +9001,7 @@ function makeHttpError(statusCode, retryAfterHeader, responseBody) {
9001
9001
  return err;
9002
9002
  }
9003
9003
  async function _postJson(url2, body, extraHeaders) {
9004
- return new Promise((resolve10, reject) => {
9004
+ return new Promise((resolve11, reject) => {
9005
9005
  const data = JSON.stringify(body);
9006
9006
  const u2 = new URL(url2);
9007
9007
  const transport = u2.protocol === "https:" ? https : http;
@@ -9031,9 +9031,9 @@ async function _postJson(url2, body, extraHeaders) {
9031
9031
  return;
9032
9032
  }
9033
9033
  try {
9034
- resolve10(JSON.parse(body2));
9034
+ resolve11(JSON.parse(body2));
9035
9035
  } catch {
9036
- resolve10(null);
9036
+ resolve11(null);
9037
9037
  }
9038
9038
  });
9039
9039
  }
@@ -9048,7 +9048,7 @@ async function _postJson(url2, body, extraHeaders) {
9048
9048
  });
9049
9049
  }
9050
9050
  async function _getJson(url2, extraHeaders) {
9051
- return new Promise((resolve10, reject) => {
9051
+ return new Promise((resolve11, reject) => {
9052
9052
  const u2 = new URL(url2);
9053
9053
  const transport = u2.protocol === "https:" ? https : http;
9054
9054
  const req = transport.request(
@@ -9072,9 +9072,9 @@ async function _getJson(url2, extraHeaders) {
9072
9072
  return;
9073
9073
  }
9074
9074
  try {
9075
- resolve10(JSON.parse(body));
9075
+ resolve11(JSON.parse(body));
9076
9076
  } catch {
9077
- resolve10(null);
9077
+ resolve11(null);
9078
9078
  }
9079
9079
  });
9080
9080
  }
@@ -9415,12 +9415,12 @@ async function probeProxyAliveReal() {
9415
9415
  }
9416
9416
  }
9417
9417
  async function probeProxyPortOpenReal() {
9418
- return new Promise((resolve10) => {
9418
+ return new Promise((resolve11) => {
9419
9419
  const socket = net.connect({ host: "127.0.0.1", port: 8787 });
9420
9420
  const done = (ok) => {
9421
9421
  socket.removeAllListeners();
9422
9422
  socket.destroy();
9423
- resolve10(ok);
9423
+ resolve11(ok);
9424
9424
  };
9425
9425
  socket.setTimeout(2e3);
9426
9426
  socket.once("connect", () => done(true));
@@ -9932,7 +9932,7 @@ var CommandRelayService = class _CommandRelayService {
9932
9932
  // fresh + clear the "CLI update available" banner after a self-update
9933
9933
  // (a codespace that reinstalls @latest reconnects via heartbeat, not
9934
9934
  // pair/reconnect). Older backends ignore the extra field.
9935
- ..."2.73.0" ? { ideVersion: "2.73.0" } : {}
9935
+ ..."2.73.2" ? { ideVersion: "2.73.2" } : {}
9936
9936
  }).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
9937
9937
  }
9938
9938
  /**
@@ -10019,8 +10019,8 @@ async function stopRelayWithGoodbye(relay, timeoutMs = RELAY_GOODBYE_TIMEOUT_MS)
10019
10019
  try {
10020
10020
  await Promise.race([
10021
10021
  relay.stopAndFlush(),
10022
- new Promise((resolve10) => {
10023
- timer = setTimeout(resolve10, timeoutMs);
10022
+ new Promise((resolve11) => {
10023
+ timer = setTimeout(resolve11, timeoutMs);
10024
10024
  })
10025
10025
  ]);
10026
10026
  } catch {
@@ -10129,7 +10129,7 @@ var _transport2 = {
10129
10129
  post: _post
10130
10130
  };
10131
10131
  function _post(url2, headers, payload) {
10132
- return new Promise((resolve10, reject) => {
10132
+ return new Promise((resolve11, reject) => {
10133
10133
  let settled = false;
10134
10134
  const u2 = new URL(url2);
10135
10135
  const lib = u2.protocol === "https:" ? https3 : http3;
@@ -10154,7 +10154,7 @@ function _post(url2, headers, payload) {
10154
10154
  res.on("end", () => {
10155
10155
  if (settled) return;
10156
10156
  settled = true;
10157
- resolve10({ statusCode: res.statusCode ?? 0, body });
10157
+ resolve11({ statusCode: res.statusCode ?? 0, body });
10158
10158
  });
10159
10159
  }
10160
10160
  );
@@ -10842,12 +10842,12 @@ var _gitSeam = {
10842
10842
  run: _runGitImpl
10843
10843
  };
10844
10844
  async function _runGitImpl(cwd, args2, opts = {}) {
10845
- return new Promise((resolve10) => {
10845
+ return new Promise((resolve11) => {
10846
10846
  let proc;
10847
10847
  try {
10848
10848
  proc = (0, import_child_process4.spawn)("git", args2, { cwd, env: process.env });
10849
10849
  } catch {
10850
- resolve10(null);
10850
+ resolve11(null);
10851
10851
  return;
10852
10852
  }
10853
10853
  let stdout = "";
@@ -10858,13 +10858,13 @@ async function _runGitImpl(cwd, args2, opts = {}) {
10858
10858
  proc.stderr?.on("data", (c2) => {
10859
10859
  stderr += c2.toString();
10860
10860
  });
10861
- proc.on("error", () => resolve10(null));
10861
+ proc.on("error", () => resolve11(null));
10862
10862
  proc.on("close", (code) => {
10863
10863
  if (code === 0 || opts.allowNonZeroExit) {
10864
- resolve10(stdout);
10864
+ resolve11(stdout);
10865
10865
  } else {
10866
10866
  log.trace("fileWatcher", `git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`);
10867
- resolve10(null);
10867
+ resolve11(null);
10868
10868
  }
10869
10869
  });
10870
10870
  });
@@ -10950,7 +10950,7 @@ var ChunkEmitter = class {
10950
10950
  if (this.pairingInvalid) {
10951
10951
  return Promise.resolve({ dead: true });
10952
10952
  }
10953
- return new Promise((resolve10) => {
10953
+ return new Promise((resolve11) => {
10954
10954
  let refreshedOnce = false;
10955
10955
  const attempt = (attemptsLeft) => {
10956
10956
  _transport3.post(this.url, this.headers, payload).then(({ statusCode, body: resBody }) => {
@@ -10958,13 +10958,13 @@ var ChunkEmitter = class {
10958
10958
  if (statusCode === 410 || statusCode === 404 && /SESSION_NOT_FOUND|SESSION_GONE/.test(resBody)) {
10959
10959
  process.stderr.write("[codeam] session was deleted/disconnected \u2014 stopping output stream.\n");
10960
10960
  log.info("chunkEmitter", `dead status=${statusCode} took=${tookMs}ms`);
10961
- resolve10({ dead: true });
10961
+ resolve11({ dead: true });
10962
10962
  return;
10963
10963
  }
10964
10964
  if (statusCode === 401 || statusCode === 403) {
10965
10965
  if (refreshedOnce) {
10966
10966
  this.markPairingInvalid(statusCode, tookMs);
10967
- resolve10({ dead: true });
10967
+ resolve11({ dead: true });
10968
10968
  return;
10969
10969
  }
10970
10970
  log.warn("chunkEmitter", `auth ${statusCode} took=${tookMs}ms \u2014 attempting silent refresh`);
@@ -10980,10 +10980,10 @@ var ChunkEmitter = class {
10980
10980
  }
10981
10981
  if (refresh.kind === "gone") {
10982
10982
  this.markPairingInvalid(statusCode, tookMs);
10983
- resolve10({ dead: true });
10983
+ resolve11({ dead: true });
10984
10984
  return;
10985
10985
  }
10986
- resolve10({ dead: false });
10986
+ resolve11({ dead: false });
10987
10987
  })();
10988
10988
  return;
10989
10989
  }
@@ -10994,7 +10994,7 @@ var ChunkEmitter = class {
10994
10994
  } else {
10995
10995
  log.info("chunkEmitter", `ok status=${statusCode} took=${tookMs}ms`);
10996
10996
  }
10997
- resolve10({ dead: false });
10997
+ resolve11({ dead: false });
10998
10998
  }).catch((err) => {
10999
10999
  log.warn(
11000
11000
  "chunkEmitter",
@@ -11005,7 +11005,7 @@ var ChunkEmitter = class {
11005
11005
  const delay = 200 * (maxRetries - attemptsLeft + 1);
11006
11006
  setTimeout(() => attempt(attemptsLeft - 1), delay);
11007
11007
  } else {
11008
- resolve10({ dead: false });
11008
+ resolve11({ dead: false });
11009
11009
  }
11010
11010
  });
11011
11011
  };
@@ -11028,7 +11028,7 @@ var _transport3 = {
11028
11028
  post: _post2
11029
11029
  };
11030
11030
  function _post2(url2, headers, payload) {
11031
- return new Promise((resolve10, reject) => {
11031
+ return new Promise((resolve11, reject) => {
11032
11032
  let settled = false;
11033
11033
  const u2 = new URL(url2);
11034
11034
  const transport = u2.protocol === "https:" ? https4 : http4;
@@ -11052,7 +11052,7 @@ function _post2(url2, headers, payload) {
11052
11052
  res.on("end", () => {
11053
11053
  if (settled) return;
11054
11054
  settled = true;
11055
- resolve10({ statusCode: res.statusCode ?? 0, body: resData });
11055
+ resolve11({ statusCode: res.statusCode ?? 0, body: resData });
11056
11056
  });
11057
11057
  }
11058
11058
  );
@@ -12134,12 +12134,12 @@ async function applyFileReview(workingDir, filePath, action) {
12134
12134
  return { ok: true, action, filePath, repoRoot };
12135
12135
  }
12136
12136
  function runGit2(cwd, args2) {
12137
- return new Promise((resolve10) => {
12137
+ return new Promise((resolve11) => {
12138
12138
  let proc;
12139
12139
  try {
12140
12140
  proc = (0, import_child_process7.spawn)("git", args2, { cwd, env: process.env });
12141
12141
  } catch (err) {
12142
- resolve10({ ok: false, code: -1, stdout: "", stderr: err.message });
12142
+ resolve11({ ok: false, code: -1, stdout: "", stderr: err.message });
12143
12143
  return;
12144
12144
  }
12145
12145
  let stdout = "";
@@ -12152,11 +12152,11 @@ function runGit2(cwd, args2) {
12152
12152
  });
12153
12153
  proc.on(
12154
12154
  "error",
12155
- (err) => resolve10({ ok: false, code: -1, stdout, stderr: stderr + err.message })
12155
+ (err) => resolve11({ ok: false, code: -1, stdout, stderr: stderr + err.message })
12156
12156
  );
12157
12157
  proc.on(
12158
12158
  "close",
12159
- (code) => resolve10({ ok: code === 0, code: code ?? -1, stdout, stderr })
12159
+ (code) => resolve11({ ok: code === 0, code: code ?? -1, stdout, stderr })
12160
12160
  );
12161
12161
  });
12162
12162
  }
@@ -14905,15 +14905,15 @@ function runInstaller() {
14905
14905
  "-Command",
14906
14906
  "irm https://claude.ai/install.ps1 | iex"
14907
14907
  ] : ["-c", "curl -fsSL https://claude.ai/install.sh | bash"];
14908
- return new Promise((resolve10) => {
14908
+ return new Promise((resolve11) => {
14909
14909
  const proc = (0, import_child_process10.spawn)(cmd, args2, { stdio: "inherit" });
14910
14910
  proc.on("error", (err) => {
14911
14911
  console.error(`
14912
14912
  \u2717 Installer failed to launch: ${err.message}`);
14913
- resolve10(false);
14913
+ resolve11(false);
14914
14914
  });
14915
14915
  proc.on("exit", (code) => {
14916
- resolve10(code === 0);
14916
+ resolve11(code === 0);
14917
14917
  });
14918
14918
  });
14919
14919
  }
@@ -15048,7 +15048,7 @@ function extractSetupTokenFromOutput(output) {
15048
15048
  return m ? m[0] : null;
15049
15049
  }
15050
15050
  function captureClaudeSetupToken() {
15051
- return new Promise((resolve10, reject) => {
15051
+ return new Promise((resolve11, reject) => {
15052
15052
  const child = (0, import_node_child_process3.spawn)("claude", ["setup-token"], {
15053
15053
  stdio: ["inherit", "pipe", "inherit"]
15054
15054
  });
@@ -15062,7 +15062,7 @@ function captureClaudeSetupToken() {
15062
15062
  child.on("exit", (code) => {
15063
15063
  const token = extractSetupTokenFromOutput(out2);
15064
15064
  if (token) {
15065
- resolve10({ method: "setup_token", credential: token, source: "setup-token" });
15065
+ resolve11({ method: "setup_token", credential: token, source: "setup-token" });
15066
15066
  return;
15067
15067
  }
15068
15068
  reject(
@@ -15148,17 +15148,17 @@ function parseUsageOutput(raw) {
15148
15148
  return { percent, resetAt };
15149
15149
  }
15150
15150
  async function fetchClaudeQuota() {
15151
- return new Promise((resolve10) => {
15151
+ return new Promise((resolve11) => {
15152
15152
  const claudeCmd = findInPath("claude") ? "claude" : "claude-code";
15153
15153
  if (!claudeCmd) {
15154
- resolve10(null);
15154
+ resolve11(null);
15155
15155
  return;
15156
15156
  }
15157
15157
  const helperPath = path20.join(os14.tmpdir(), "codeam-quota-helper.py");
15158
15158
  fs16.writeFileSync(helperPath, HELPER_SCRIPT, { mode: 420 });
15159
15159
  const python = findInPath("python3") ?? findInPath("python");
15160
15160
  if (!python) {
15161
- resolve10(null);
15161
+ resolve11(null);
15162
15162
  return;
15163
15163
  }
15164
15164
  const proc = (0, import_child_process11.spawn)(python, [helperPath, claudeCmd, "--tools", ""], {
@@ -15185,13 +15185,13 @@ async function fetchClaudeQuota() {
15185
15185
  fs16.unlinkSync(helperPath);
15186
15186
  } catch {
15187
15187
  }
15188
- resolve10(result);
15188
+ resolve11(result);
15189
15189
  }, 5e3);
15190
15190
  }, 8e3);
15191
15191
  setTimeout(() => {
15192
15192
  if (!resolved) {
15193
15193
  resolved = true;
15194
- resolve10(null);
15194
+ resolve11(null);
15195
15195
  }
15196
15196
  try {
15197
15197
  proc.kill();
@@ -15216,12 +15216,12 @@ function killActiveSpawnAndCaptureChildren() {
15216
15216
  }
15217
15217
  async function spawnAndCapture(cmd, args2, opts = {}) {
15218
15218
  const timeoutMs = opts.timeoutMs ?? 6e4;
15219
- return new Promise((resolve10) => {
15219
+ return new Promise((resolve11) => {
15220
15220
  let settled = false;
15221
15221
  const settle = (value) => {
15222
15222
  if (settled) return;
15223
15223
  settled = true;
15224
- resolve10(value);
15224
+ resolve11(value);
15225
15225
  };
15226
15226
  let child;
15227
15227
  try {
@@ -16610,7 +16610,7 @@ function newestRolloutIdSince(sessionsRoot, resolvedCwd, floorMs) {
16610
16610
  return bestId;
16611
16611
  }
16612
16612
  function sleep2(ms) {
16613
- return new Promise((resolve10) => setTimeout(resolve10, ms));
16613
+ return new Promise((resolve11) => setTimeout(resolve11, ms));
16614
16614
  }
16615
16615
  function getCurrentUsage2(historyDir) {
16616
16616
  if (!import_node_fs3.default.existsSync(historyDir)) return null;
@@ -16850,12 +16850,12 @@ function resolveNpm(os68) {
16850
16850
  return os68.id === "win32" ? "npm.cmd" : "npm";
16851
16851
  }
16852
16852
  async function installCodexViaNpm(os68) {
16853
- return new Promise((resolve10, reject) => {
16853
+ return new Promise((resolve11, reject) => {
16854
16854
  const proc = (0, import_node_child_process5.spawn)(resolveNpm(os68), ["install", "-g", "@openai/codex"], {
16855
16855
  stdio: "inherit"
16856
16856
  });
16857
16857
  proc.on("close", (code) => {
16858
- if (code === 0) resolve10();
16858
+ if (code === 0) resolve11();
16859
16859
  else reject(new Error(`npm install -g @openai/codex exited ${code}`));
16860
16860
  });
16861
16861
  proc.on("error", (err) => {
@@ -16976,7 +16976,7 @@ var defaultHeadroomRunner = {
16976
16976
  }
16977
16977
  },
16978
16978
  run(cmd, args2, opts = {}) {
16979
- return new Promise((resolve10) => {
16979
+ return new Promise((resolve11) => {
16980
16980
  const spawnEnv = opts.env ?? process.env;
16981
16981
  const child = (0, import_node_child_process6.spawn)(cmd, args2, { stdio: ["ignore", "pipe", "pipe"], env: spawnEnv });
16982
16982
  let stderrBuf = "";
@@ -16985,7 +16985,7 @@ var defaultHeadroomRunner = {
16985
16985
  const done = (code) => {
16986
16986
  if (settled) return;
16987
16987
  settled = true;
16988
- resolve10({ code, stderr: stderrBuf, stdout: stdoutBuf });
16988
+ resolve11({ code, stderr: stderrBuf, stdout: stdoutBuf });
16989
16989
  };
16990
16990
  child.stdout?.on("data", (b) => {
16991
16991
  const chunk = b.toString();
@@ -17364,7 +17364,7 @@ async function ensureInstallPrerequisites(os68, deps = {}) {
17364
17364
  };
17365
17365
  }
17366
17366
  function defaultRunInstallScript(env) {
17367
- return new Promise((resolve10) => {
17367
+ return new Promise((resolve11) => {
17368
17368
  const proc = (0, import_node_child_process7.spawn)(
17369
17369
  "sh",
17370
17370
  ["-c", `curl -fsSL --connect-timeout 15 --max-time 120 ${INSTALL_URL} | sh`],
@@ -17376,7 +17376,7 @@ function defaultRunInstallScript(env) {
17376
17376
  if (settled) return;
17377
17377
  settled = true;
17378
17378
  clearTimeout(timer);
17379
- resolve10({ code, output });
17379
+ resolve11({ code, output });
17380
17380
  };
17381
17381
  const onData = (b) => {
17382
17382
  const chunk = b.toString();
@@ -17750,7 +17750,7 @@ var CoderabbitRuntimeStrategy = class {
17750
17750
  }
17751
17751
  async runOneShot(input) {
17752
17752
  const launch = await this.prepareInvocation(input);
17753
- return new Promise((resolve10, reject) => {
17753
+ return new Promise((resolve11, reject) => {
17754
17754
  const stdoutBuf = [];
17755
17755
  const stderrBuf = [];
17756
17756
  const proc = (0, import_node_child_process9.spawn)(launch.cmd, launch.args, {
@@ -17762,7 +17762,7 @@ var CoderabbitRuntimeStrategy = class {
17762
17762
  if (settled) return;
17763
17763
  settled = true;
17764
17764
  clearTimeout(timer);
17765
- resolve10(out2);
17765
+ resolve11(out2);
17766
17766
  };
17767
17767
  const timer = setTimeout(() => {
17768
17768
  if (settled) return;
@@ -18380,7 +18380,7 @@ function resolveClaudeNativeBinary(deps = {}) {
18380
18380
  const candidate = import_path4.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
18381
18381
  return existsSync30(candidate) ? candidate : null;
18382
18382
  }
18383
- var realSleep = (ms) => new Promise((resolve10) => setTimeout(resolve10, ms));
18383
+ var realSleep = (ms) => new Promise((resolve11) => setTimeout(resolve11, ms));
18384
18384
  async function waitForClaudeNativeBinary(opts = {}) {
18385
18385
  const timeoutMs = opts.timeoutMs ?? 18e4;
18386
18386
  const pollMs = opts.pollMs ?? 500;
@@ -18492,7 +18492,7 @@ var PERMANENT_ADAPTER_STARTUP_RE = /IneligibleTierError|UNSUPPORTED_CLIENT|no lo
18492
18492
  function probeAdapterModuleGraph(command2, args2, opts = {}) {
18493
18493
  const livenessMs = opts.livenessMs ?? 400;
18494
18494
  const spawnFn = opts.spawnFn ?? import_child_process14.spawn;
18495
- return new Promise((resolve10) => {
18495
+ return new Promise((resolve11) => {
18496
18496
  let settled = false;
18497
18497
  let stderr = "";
18498
18498
  let timer;
@@ -18505,12 +18505,12 @@ function probeAdapterModuleGraph(command2, args2, opts = {}) {
18505
18505
  child?.kill("SIGKILL");
18506
18506
  } catch {
18507
18507
  }
18508
- resolve10(r);
18508
+ resolve11(r);
18509
18509
  };
18510
18510
  try {
18511
18511
  child = spawnFn(command2, [...args2], { stdio: ["pipe", "ignore", "pipe"] });
18512
18512
  } catch {
18513
- resolve10("ok");
18513
+ resolve11("ok");
18514
18514
  return;
18515
18515
  }
18516
18516
  child.stderr?.on("data", (d3) => {
@@ -19097,7 +19097,7 @@ function newestSessionSince(bucket2, floorMs) {
19097
19097
  return bestId;
19098
19098
  }
19099
19099
  function sleep3(ms) {
19100
- return new Promise((resolve10) => setTimeout(resolve10, ms));
19100
+ return new Promise((resolve11) => setTimeout(resolve11, ms));
19101
19101
  }
19102
19102
  function joinTextParts(parts) {
19103
19103
  if (!Array.isArray(parts)) return "";
@@ -19544,7 +19544,7 @@ async function link(args2 = []) {
19544
19544
  waitSpin.start(waitMsg());
19545
19545
  const countdown = setInterval(() => waitSpin.message(waitMsg()), 1e3);
19546
19546
  countdown.unref?.();
19547
- const paired = await new Promise((resolve10, reject) => {
19547
+ const paired = await new Promise((resolve11, reject) => {
19548
19548
  let stopPoll = null;
19549
19549
  const sigint = () => {
19550
19550
  clearInterval(countdown);
@@ -19557,7 +19557,7 @@ async function link(args2 = []) {
19557
19557
  process.removeListener("SIGINT", sigint);
19558
19558
  clearInterval(countdown);
19559
19559
  waitSpin.stop("Paired");
19560
- resolve10(info);
19560
+ resolve11(info);
19561
19561
  },
19562
19562
  () => {
19563
19563
  clearInterval(countdown);
@@ -19715,14 +19715,14 @@ async function captureFreshCredentials(ctx) {
19715
19715
  }
19716
19716
  };
19717
19717
  try {
19718
- const token = await new Promise((resolve10, reject) => {
19718
+ const token = await new Promise((resolve11, reject) => {
19719
19719
  let settled = false;
19720
19720
  const tryExtract = async () => {
19721
19721
  if (settled) return;
19722
19722
  const t2 = await ctx.locator.extract();
19723
19723
  if (t2 && !settled) {
19724
19724
  settled = true;
19725
- resolve10(t2);
19725
+ resolve11(t2);
19726
19726
  }
19727
19727
  };
19728
19728
  watcher.on("add", () => void tryExtract());
@@ -19962,7 +19962,7 @@ function deliverPendingCoderabbitCallback(callbackUrl) {
19962
19962
  function runCoderabbitOAuthLogin(deps) {
19963
19963
  const timeoutMs = deps.timeoutMs ?? 18e4;
19964
19964
  const spawnProc = deps.spawn ?? spawnCoderabbitLoginProc;
19965
- return new Promise((resolve10) => {
19965
+ return new Promise((resolve11) => {
19966
19966
  let settled = false;
19967
19967
  let stdout = "";
19968
19968
  let last = null;
@@ -19975,13 +19975,13 @@ function runCoderabbitOAuthLogin(deps) {
19975
19975
  child.kill("SIGKILL");
19976
19976
  } catch {
19977
19977
  }
19978
- resolve10(r);
19978
+ resolve11(r);
19979
19979
  };
19980
19980
  let child;
19981
19981
  try {
19982
19982
  child = spawnProc("coderabbit", ["auth", "login", "--agent"]);
19983
19983
  } catch (err) {
19984
- resolve10({ ok: false, error: err instanceof Error ? err.message : "spawn failed" });
19984
+ resolve11({ ok: false, error: err instanceof Error ? err.message : "spawn failed" });
19985
19985
  return;
19986
19986
  }
19987
19987
  const timer = setTimeout(
@@ -20454,23 +20454,23 @@ async function reviewPullRequest(params, deps) {
20454
20454
  return report;
20455
20455
  }
20456
20456
  function defaultRunGh(args2) {
20457
- return new Promise((resolve10) => {
20457
+ return new Promise((resolve11) => {
20458
20458
  const stdout = [];
20459
20459
  const stderr = [];
20460
20460
  let proc;
20461
20461
  try {
20462
20462
  proc = (0, import_node_child_process18.spawn)("gh", args2, { stdio: ["ignore", "pipe", "pipe"] });
20463
20463
  } catch (err) {
20464
- resolve10({ code: -1, stdout: "", stderr: err instanceof Error ? err.message : String(err) });
20464
+ resolve11({ code: -1, stdout: "", stderr: err instanceof Error ? err.message : String(err) });
20465
20465
  return;
20466
20466
  }
20467
20467
  proc.stdout?.on("data", (b) => stdout.push(b));
20468
20468
  proc.stderr?.on("data", (b) => stderr.push(b));
20469
20469
  proc.on("error", (err) => {
20470
- resolve10({ code: -1, stdout: "", stderr: err.message });
20470
+ resolve11({ code: -1, stdout: "", stderr: err.message });
20471
20471
  });
20472
20472
  proc.on("close", (code) => {
20473
- resolve10({
20473
+ resolve11({
20474
20474
  code: code ?? 0,
20475
20475
  stdout: Buffer.concat(stdout).toString("utf8"),
20476
20476
  stderr: Buffer.concat(stderr).toString("utf8")
@@ -20611,7 +20611,7 @@ var os34 = __toESM(require("os"));
20611
20611
  function runAgentInstallScript(script, opts = {}) {
20612
20612
  const timeoutMs = opts.timeoutMs ?? 18e4;
20613
20613
  const scope = opts.logScope ?? "agent-install";
20614
- return new Promise((resolve10) => {
20614
+ return new Promise((resolve11) => {
20615
20615
  const home = process.env.HOME || os34.homedir();
20616
20616
  const child = (0, import_child_process15.spawn)("sh", ["-c", script], {
20617
20617
  env: { ...process.env, HOME: home },
@@ -20627,7 +20627,7 @@ function runAgentInstallScript(script, opts = {}) {
20627
20627
  const done = (result) => {
20628
20628
  if (settled) return;
20629
20629
  settled = true;
20630
- resolve10(result);
20630
+ resolve11(result);
20631
20631
  };
20632
20632
  const timer = setTimeout(() => {
20633
20633
  log.warn(scope, `agent install timed out (${Math.round(timeoutMs / 1e3)}s)`);
@@ -20984,6 +20984,16 @@ function isAbsolutePathTarget(target) {
20984
20984
  function selfHostedWorkspaceRoot() {
20985
20985
  return path45.join(os36.homedir(), ".codeam", "self-hosted");
20986
20986
  }
20987
+ function deployIdFromWorkspace(cwd) {
20988
+ if (!cwd) return null;
20989
+ const root = selfHostedWorkspaceRoot();
20990
+ const resolved = path45.resolve(cwd);
20991
+ const rel = path45.relative(root, resolved);
20992
+ if (!rel || rel.startsWith("..") || path45.isAbsolute(rel)) return null;
20993
+ const parts = rel.split(path45.sep).filter(Boolean);
20994
+ if (parts.length !== 1) return null;
20995
+ return parts[0];
20996
+ }
20987
20997
  function nonInteractiveGitEnv() {
20988
20998
  return {
20989
20999
  ...process.env,
@@ -21523,7 +21533,7 @@ var defaultGitToolingRunner = {
21523
21533
  }
21524
21534
  },
21525
21535
  run(cmd, args2, opts = {}) {
21526
- return new Promise((resolve10) => {
21536
+ return new Promise((resolve11) => {
21527
21537
  const child = (0, import_node_child_process21.spawn)(cmd, args2, {
21528
21538
  stdio: [opts.input !== void 0 ? "pipe" : "ignore", "ignore", "pipe"]
21529
21539
  });
@@ -21532,7 +21542,7 @@ var defaultGitToolingRunner = {
21532
21542
  const done = (code) => {
21533
21543
  if (settled) return;
21534
21544
  settled = true;
21535
- resolve10({ code, stderr });
21545
+ resolve11({ code, stderr });
21536
21546
  };
21537
21547
  child.stderr?.on("data", (b) => {
21538
21548
  stderr += b.toString();
@@ -22089,14 +22099,14 @@ function compareSemver(a, b) {
22089
22099
  return 0;
22090
22100
  }
22091
22101
  function fetchLatest() {
22092
- return new Promise((resolve10) => {
22102
+ return new Promise((resolve11) => {
22093
22103
  const req = https6.get(
22094
22104
  REGISTRY_URL,
22095
22105
  { headers: { Accept: "application/json" }, timeout: REQUEST_TIMEOUT_MS },
22096
22106
  (res) => {
22097
22107
  if (res.statusCode !== 200) {
22098
22108
  res.resume();
22099
- resolve10(null);
22109
+ resolve11(null);
22100
22110
  return;
22101
22111
  }
22102
22112
  let buf = "";
@@ -22108,21 +22118,21 @@ function fetchLatest() {
22108
22118
  try {
22109
22119
  const json = JSON.parse(buf);
22110
22120
  if (typeof json.version === "string") {
22111
- resolve10(json.version);
22121
+ resolve11(json.version);
22112
22122
  } else {
22113
- resolve10(null);
22123
+ resolve11(null);
22114
22124
  }
22115
22125
  } catch {
22116
- resolve10(null);
22126
+ resolve11(null);
22117
22127
  }
22118
22128
  });
22119
22129
  }
22120
22130
  );
22121
22131
  req.on("timeout", () => {
22122
22132
  req.destroy();
22123
- resolve10(null);
22133
+ resolve11(null);
22124
22134
  });
22125
- req.on("error", () => resolve10(null));
22135
+ req.on("error", () => resolve11(null));
22126
22136
  });
22127
22137
  }
22128
22138
  function notifyIfStale(currentVersion, latest) {
@@ -22198,7 +22208,7 @@ async function autoUpgradeBeforeCriticalCommand() {
22198
22208
  if (process.env.NODE_ENV === "test") return;
22199
22209
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
22200
22210
  if (process.env.CI) return;
22201
- const current2 = true ? "2.73.0" : null;
22211
+ const current2 = true ? "2.73.2" : null;
22202
22212
  if (!current2) return;
22203
22213
  const cache = readCache();
22204
22214
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -22215,7 +22225,7 @@ function checkForUpdates() {
22215
22225
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
22216
22226
  if (process.env.CI) return;
22217
22227
  if (!process.stdout.isTTY) return;
22218
- const current2 = true ? "2.73.0" : null;
22228
+ const current2 = true ? "2.73.2" : null;
22219
22229
  if (!current2) return;
22220
22230
  const cache = readCache();
22221
22231
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -22238,7 +22248,7 @@ var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
22238
22248
  var SELF_UPDATE_LS_TIMEOUT_MS = 15e3;
22239
22249
  var SUDO_PREFLIGHT_TIMEOUT_MS = 5e3;
22240
22250
  function currentCliVersion() {
22241
- return true ? "2.73.0" : null;
22251
+ return true ? "2.73.2" : null;
22242
22252
  }
22243
22253
  async function installedVersion(deps) {
22244
22254
  const ls = await deps.run(
@@ -22254,10 +22264,10 @@ async function installedVersion(deps) {
22254
22264
  }
22255
22265
  }
22256
22266
  function runCmd(cmd, args2, timeoutMs) {
22257
- return new Promise((resolve10) => {
22267
+ return new Promise((resolve11) => {
22258
22268
  (0, import_node_child_process23.execFile)(cmd, args2, { timeout: timeoutMs }, (err, stdout, stderr) => {
22259
22269
  const code = err && typeof err.code === "number" ? err.code : err ? null : 0;
22260
- resolve10({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
22270
+ resolve11({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
22261
22271
  });
22262
22272
  });
22263
22273
  }
@@ -22628,7 +22638,7 @@ var DOCKER_RUN_TIMEOUT_MS = 12e4;
22628
22638
  var DOCKER_RUN_WITH_PULL_TIMEOUT_MS = 6e5;
22629
22639
  var defaultDockerRunner = {
22630
22640
  run(args2, opts = {}) {
22631
- return new Promise((resolve10) => {
22641
+ return new Promise((resolve11) => {
22632
22642
  const child = (0, import_node_child_process25.spawn)("docker", args2, {
22633
22643
  stdio: ["ignore", "pipe", "pipe"],
22634
22644
  env: { ...process.env, ...opts.env }
@@ -22647,7 +22657,7 @@ var defaultDockerRunner = {
22647
22657
  if (settled) return;
22648
22658
  settled = true;
22649
22659
  clearTimeout(timer);
22650
- resolve10({ code, stderr: stderrBuf, stdout: stdoutBuf });
22660
+ resolve11({ code, stderr: stderrBuf, stdout: stdoutBuf });
22651
22661
  };
22652
22662
  child.stdout?.on("data", (b) => {
22653
22663
  stdoutBuf += b.toString();
@@ -23663,13 +23673,14 @@ var HostAgentSupervisor = class {
23663
23673
  { ...readHeadroomChildEnv(), ...readHouseProxyChildEnv() },
23664
23674
  cwd
23665
23675
  );
23676
+ const deployId = deployIdFromWorkspace(session.cwd) ?? session.id;
23666
23677
  const child = {
23667
- deployId: session.id,
23678
+ deployId,
23668
23679
  proc,
23669
23680
  agent: session.agent,
23670
23681
  startedAt: Date.now()
23671
23682
  };
23672
- this.children.set(session.id, child);
23683
+ this.children.set(deployId, child);
23673
23684
  let tail = "";
23674
23685
  const appendTail = (buf) => {
23675
23686
  tail = (tail + buf.toString("utf8")).slice(-2e3);
@@ -23677,7 +23688,7 @@ var HostAgentSupervisor = class {
23677
23688
  proc.stdout?.on("data", appendTail);
23678
23689
  proc.stderr?.on("data", appendTail);
23679
23690
  proc.once("exit", (code) => {
23680
- if (this.children.get(session.id)?.proc === proc) this.children.delete(session.id);
23691
+ if (this.children.get(deployId)?.proc === proc) this.children.delete(deployId);
23681
23692
  if (typeof code === "number" && code !== 0) {
23682
23693
  this.onResumeChildExit(session, code, tail.trim().slice(-300));
23683
23694
  }
@@ -24745,12 +24756,12 @@ async function isExecutableBinary(p2) {
24745
24756
  }
24746
24757
  }
24747
24758
  function extractTgz(tgzPath, destDir) {
24748
- return new Promise((resolve10, reject) => {
24759
+ return new Promise((resolve11, reject) => {
24749
24760
  const child = (0, import_child_process18.spawn)("tar", ["-xzf", tgzPath, "-C", destDir], { stdio: "ignore" });
24750
24761
  child.on("error", (err) => reject(err));
24751
24762
  child.on(
24752
24763
  "exit",
24753
- (code) => code === 0 ? resolve10() : reject(new Error(`tar exited with code ${code} while extracting cloudflared`))
24764
+ (code) => code === 0 ? resolve11() : reject(new Error(`tar exited with code ${code} while extracting cloudflared`))
24754
24765
  );
24755
24766
  });
24756
24767
  }
@@ -24999,12 +25010,12 @@ function describeDetectionFailure(raw) {
24999
25010
  // src/services/preview/port-ready.ts
25000
25011
  var net2 = __toESM(require("net"));
25001
25012
  function isPortListening(port, host2 = "127.0.0.1") {
25002
- return new Promise((resolve10) => {
25013
+ return new Promise((resolve11) => {
25003
25014
  const socket = new net2.Socket();
25004
25015
  const done = (result) => {
25005
25016
  socket.removeAllListeners();
25006
25017
  socket.destroy();
25007
- resolve10(result);
25018
+ resolve11(result);
25008
25019
  };
25009
25020
  socket.setTimeout(1e3);
25010
25021
  socket.once("connect", () => done(true));
@@ -25042,14 +25053,14 @@ const { PGLiteSocketServer } = require('@electric-sql/pglite-socket');
25042
25053
  })().catch((e) => { console.error(String(e && e.message)); process.exit(1); });
25043
25054
  `;
25044
25055
  function isListening(port) {
25045
- return new Promise((resolve10) => {
25056
+ return new Promise((resolve11) => {
25046
25057
  const s = net3.connect({ host: "127.0.0.1", port }, () => {
25047
25058
  s.destroy();
25048
- resolve10(true);
25049
- }).on("error", () => resolve10(false));
25059
+ resolve11(true);
25060
+ }).on("error", () => resolve11(false));
25050
25061
  s.setTimeout(1e3, () => {
25051
25062
  s.destroy();
25052
- resolve10(false);
25063
+ resolve11(false);
25053
25064
  });
25054
25065
  });
25055
25066
  }
@@ -25097,7 +25108,7 @@ function stopChild(child) {
25097
25108
  // src/services/preview/run-setup.ts
25098
25109
  var import_child_process21 = require("child_process");
25099
25110
  function runSetupCommand(cmd, args2, cwd, env, opts) {
25100
- return new Promise((resolve10) => {
25111
+ return new Promise((resolve11) => {
25101
25112
  const child = (0, import_child_process21.spawn)(cmd, args2, {
25102
25113
  cwd,
25103
25114
  env: { ...process.env, ...env ?? {} },
@@ -25117,20 +25128,20 @@ function runSetupCommand(cmd, args2, cwd, env, opts) {
25117
25128
  settled = true;
25118
25129
  log.info("preview", `${tag}: timed out after ${opts.timeoutMs}ms \u2014 killing`);
25119
25130
  killQuiet(child);
25120
- resolve10({ status: "timeout", code: null });
25131
+ resolve11({ status: "timeout", code: null });
25121
25132
  }, opts.timeoutMs);
25122
25133
  child.once("exit", (code) => {
25123
25134
  if (settled) return;
25124
25135
  settled = true;
25125
25136
  clearTimeout(timer);
25126
- if (code === 0) resolve10({ status: "ok", code: 0 });
25127
- else resolve10({ status: "failed", code });
25137
+ if (code === 0) resolve11({ status: "ok", code: 0 });
25138
+ else resolve11({ status: "failed", code });
25128
25139
  });
25129
25140
  child.once("error", () => {
25130
25141
  if (settled) return;
25131
25142
  settled = true;
25132
25143
  clearTimeout(timer);
25133
- resolve10({ status: "failed", code: null });
25144
+ resolve11({ status: "failed", code: null });
25134
25145
  });
25135
25146
  });
25136
25147
  }
@@ -25468,23 +25479,23 @@ async function awaitTunnelRegistered(candidate, hostname3, deadlineMs) {
25468
25479
  ac.signal.addEventListener("abort", detach, { once: true });
25469
25480
  };
25470
25481
  try {
25471
- return await new Promise((resolve10) => {
25482
+ return await new Promise((resolve11) => {
25472
25483
  const onChunk = (chunk) => {
25473
25484
  const s = chunk.toString();
25474
25485
  if (!url2) url2 = parseCloudflaredUrl(s);
25475
25486
  if (TUNNEL_REGISTERED_RE.test(s)) registered = true;
25476
25487
  const trimmed = s.replace(/\n+$/g, "");
25477
25488
  if (trimmed.length > 0) log.info("preview", `cloudflared: ${trimmed}`);
25478
- if (url2 && registered) resolve10({ kind: "registered", url: url2 });
25489
+ if (url2 && registered) resolve11({ kind: "registered", url: url2 });
25479
25490
  };
25480
25491
  const onExit = (code) => {
25481
- resolve10({ kind: "exited", sawUrl: url2 != null, code });
25492
+ resolve11({ kind: "exited", sawUrl: url2 != null, code });
25482
25493
  };
25483
25494
  const { stdout, stderr } = candidate;
25484
25495
  if (stdout) scoped(() => stdout.on("data", onChunk), () => stdout.off("data", onChunk));
25485
25496
  if (stderr) scoped(() => stderr.on("data", onChunk), () => stderr.off("data", onChunk));
25486
25497
  scoped(() => candidate.on("exit", onExit), () => candidate.off("exit", onExit));
25487
- timer = setTimeout(() => resolve10({ kind: "timeout", sawUrl: url2 != null }), deadlineMs);
25498
+ timer = setTimeout(() => resolve11({ kind: "timeout", sawUrl: url2 != null }), deadlineMs);
25488
25499
  });
25489
25500
  } finally {
25490
25501
  ac.abort();
@@ -25507,7 +25518,7 @@ function verdictFor(res) {
25507
25518
  }
25508
25519
  return { adopt: true };
25509
25520
  }
25510
- var probePort = (port) => new Promise((resolve10) => {
25521
+ var probePort = (port) => new Promise((resolve11) => {
25511
25522
  const req = http6.get(
25512
25523
  { host: "127.0.0.1", port, path: "/", timeout: PROBE_TIMEOUT_MS },
25513
25524
  (res) => {
@@ -25518,16 +25529,16 @@ var probePort = (port) => new Promise((resolve10) => {
25518
25529
  });
25519
25530
  res.on(
25520
25531
  "end",
25521
- () => resolve10({ contentType: res.headers["content-type"], bodyStart: body })
25532
+ () => resolve11({ contentType: res.headers["content-type"], bodyStart: body })
25522
25533
  );
25523
- res.on("error", () => resolve10(null));
25534
+ res.on("error", () => resolve11(null));
25524
25535
  }
25525
25536
  );
25526
25537
  req.on("timeout", () => {
25527
25538
  req.destroy();
25528
- resolve10(null);
25539
+ resolve11(null);
25529
25540
  });
25530
- req.on("error", () => resolve10(null));
25541
+ req.on("error", () => resolve11(null));
25531
25542
  });
25532
25543
  async function canAdoptPort(port, probe = probePort) {
25533
25544
  try {
@@ -25861,18 +25872,18 @@ async function startInspectorProxy(opts) {
25861
25872
  clientSocket.on("error", drop);
25862
25873
  clientSocket.on("close", drop);
25863
25874
  });
25864
- await new Promise((resolve10, reject) => {
25875
+ await new Promise((resolve11, reject) => {
25865
25876
  server.once("error", reject);
25866
- server.listen(0, "127.0.0.1", () => resolve10());
25877
+ server.listen(0, "127.0.0.1", () => resolve11());
25867
25878
  });
25868
25879
  const port = server.address().port;
25869
25880
  return {
25870
25881
  port,
25871
- close: () => new Promise((resolve10) => {
25882
+ close: () => new Promise((resolve11) => {
25872
25883
  for (const socket of upgraded) socket.destroy();
25873
25884
  upgraded.clear();
25874
25885
  server.closeAllConnections?.();
25875
- server.close(() => resolve10());
25886
+ server.close(() => resolve11());
25876
25887
  })
25877
25888
  };
25878
25889
  }
@@ -26751,12 +26762,12 @@ var _spawnSeam = {
26751
26762
  run: _defaultSpawn
26752
26763
  };
26753
26764
  function _defaultSpawn(binaryPath, args2, opts) {
26754
- return new Promise((resolve10) => {
26765
+ return new Promise((resolve11) => {
26755
26766
  let proc;
26756
26767
  try {
26757
26768
  proc = (0, import_child_process24.spawn)(binaryPath, args2, { cwd: opts.cwd, env: opts.env });
26758
26769
  } catch (err) {
26759
- resolve10({ code: -1, stdout: "", stderr: err.message });
26770
+ resolve11({ code: -1, stdout: "", stderr: err.message });
26760
26771
  return;
26761
26772
  }
26762
26773
  let stdout = "";
@@ -26767,8 +26778,8 @@ function _defaultSpawn(binaryPath, args2, opts) {
26767
26778
  proc.stderr?.on("data", (c2) => {
26768
26779
  stderr += c2.toString();
26769
26780
  });
26770
- proc.on("error", (err) => resolve10({ code: -1, stdout, stderr: err.message }));
26771
- proc.on("close", (code) => resolve10({ code: code ?? -1, stdout, stderr }));
26781
+ proc.on("error", (err) => resolve11({ code: -1, stdout, stderr: err.message }));
26782
+ proc.on("close", (code) => resolve11({ code: code ?? -1, stdout, stderr }));
26772
26783
  });
26773
26784
  }
26774
26785
  var _adapterSeam = {
@@ -26945,22 +26956,22 @@ var _installSpawnSeam = {
26945
26956
  run: _defaultInstallSpawn
26946
26957
  };
26947
26958
  function _defaultInstallSpawn(strategy) {
26948
- return new Promise((resolve10) => {
26959
+ return new Promise((resolve11) => {
26949
26960
  let proc;
26950
26961
  try {
26951
26962
  proc = (0, import_child_process25.spawn)(strategy.command, strategy.args, { env: process.env });
26952
26963
  } catch (err) {
26953
- resolve10({ ok: false, code: -1, stderr: err.message });
26964
+ resolve11({ ok: false, code: -1, stderr: err.message });
26954
26965
  return;
26955
26966
  }
26956
26967
  let stderr = "";
26957
26968
  proc.stderr?.on("data", (c2) => {
26958
26969
  stderr += c2.toString();
26959
26970
  });
26960
- proc.on("error", (err) => resolve10({ ok: false, code: -1, stderr: err.message }));
26971
+ proc.on("error", (err) => resolve11({ ok: false, code: -1, stderr: err.message }));
26961
26972
  proc.on(
26962
26973
  "close",
26963
- (code) => resolve10({ ok: code === 0, code: code ?? -1, stderr })
26974
+ (code) => resolve11({ ok: code === 0, code: code ?? -1, stderr })
26964
26975
  );
26965
26976
  });
26966
26977
  }
@@ -27129,14 +27140,14 @@ var _doltInstallSpawnSeam = {
27129
27140
  };
27130
27141
  var DOLT_INSTALL_TIMEOUT_MS = 12e4;
27131
27142
  function _defaultDoltInstallSpawn(strategy) {
27132
- return new Promise((resolve10) => {
27143
+ return new Promise((resolve11) => {
27133
27144
  let settled = false;
27134
27145
  let timer;
27135
27146
  const finish = (r) => {
27136
27147
  if (settled) return;
27137
27148
  settled = true;
27138
27149
  if (timer) clearTimeout(timer);
27139
- resolve10(r);
27150
+ resolve11(r);
27140
27151
  };
27141
27152
  let proc;
27142
27153
  try {
@@ -28991,16 +29002,16 @@ async function runNpmInstallLatest() {
28991
29002
  const invocation = buildNpmInstallInvocation({ sudo: useSudo });
28992
29003
  const useShell = process.platform === "win32";
28993
29004
  const command2 = useShell && invocation.command.includes(" ") ? `"${invocation.command}"` : invocation.command;
28994
- const result = await new Promise((resolve10) => {
29005
+ const result = await new Promise((resolve11) => {
28995
29006
  (0, import_child_process28.execFile)(
28996
29007
  command2,
28997
29008
  invocation.args,
28998
29009
  { timeout: CLI_UPDATE_INSTALL_TIMEOUT_MS, shell: useShell },
28999
29010
  (err, _stdout, stderr) => {
29000
29011
  if (!err) {
29001
- resolve10({ ok: true });
29012
+ resolve11({ ok: true });
29002
29013
  } else {
29003
- resolve10({ ok: false, error: (stderr || err.message).slice(0, 300) });
29014
+ resolve11({ ok: false, error: (stderr || err.message).slice(0, 300) });
29004
29015
  }
29005
29016
  }
29006
29017
  );
@@ -29690,7 +29701,7 @@ function buildKeepAlive(ctx) {
29690
29701
  let timer = null;
29691
29702
  async function setIdleTimeout(minutes) {
29692
29703
  if (!ctx.inCodespace || !ctx.codespaceName) return;
29693
- await new Promise((resolve10) => {
29704
+ await new Promise((resolve11) => {
29694
29705
  const proc = (0, import_child_process29.spawn)(
29695
29706
  "gh",
29696
29707
  [
@@ -29704,8 +29715,8 @@ function buildKeepAlive(ctx) {
29704
29715
  { stdio: "ignore", detached: true }
29705
29716
  );
29706
29717
  proc.unref();
29707
- proc.on("exit", () => resolve10());
29708
- proc.on("error", () => resolve10());
29718
+ proc.on("exit", () => resolve11());
29719
+ proc.on("error", () => resolve11());
29709
29720
  });
29710
29721
  }
29711
29722
  return {
@@ -30197,10 +30208,10 @@ function wrapWithHeadroom(launch, opts) {
30197
30208
  var _present;
30198
30209
  function headroomPresent() {
30199
30210
  if (_present !== void 0) return Promise.resolve(_present);
30200
- return new Promise((resolve10) => {
30211
+ return new Promise((resolve11) => {
30201
30212
  (0, import_node_child_process26.execFile)("headroom", ["--version"], (err) => {
30202
30213
  _present = !err;
30203
- resolve10(_present);
30214
+ resolve11(_present);
30204
30215
  });
30205
30216
  });
30206
30217
  }
@@ -30569,10 +30580,10 @@ function augmentKimiPath() {
30569
30580
  }
30570
30581
  var augmentPath2 = augmentKimiPath;
30571
30582
  async function runInstaller2() {
30572
- return new Promise((resolve10) => {
30583
+ return new Promise((resolve11) => {
30573
30584
  const proc = (0, import_node_child_process27.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL2} | bash`], { stdio: "inherit" });
30574
- proc.on("close", (code) => resolve10(code === 0));
30575
- proc.on("error", () => resolve10(false));
30585
+ proc.on("close", (code) => resolve11(code === 0));
30586
+ proc.on("error", () => resolve11(false));
30576
30587
  });
30577
30588
  }
30578
30589
  async function ensureKimiInstalled() {
@@ -30622,10 +30633,10 @@ function augmentOpencodePath() {
30622
30633
  }
30623
30634
  var augmentPath3 = augmentOpencodePath;
30624
30635
  async function runInstaller3() {
30625
- return new Promise((resolve10) => {
30636
+ return new Promise((resolve11) => {
30626
30637
  const proc = (0, import_node_child_process28.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL3} | bash`], { stdio: "inherit" });
30627
- proc.on("close", (code) => resolve10(code === 0));
30628
- proc.on("error", () => resolve10(false));
30638
+ proc.on("close", (code) => resolve11(code === 0));
30639
+ proc.on("error", () => resolve11(false));
30629
30640
  });
30630
30641
  }
30631
30642
  async function ensureOpencodeInstalled() {
@@ -30833,11 +30844,11 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
30833
30844
  const timeoutMs = opts.timeoutMs ?? DEFAULT_ADAPTER_RETRY_TIMEOUT_MS;
30834
30845
  const pollMs = opts.pollMs ?? DEFAULT_ADAPTER_RETRY_POLL_MS;
30835
30846
  const now = opts.now ?? Date.now;
30836
- const sleep5 = opts.sleep ?? ((ms) => new Promise((resolve11) => setTimeout(resolve11, ms)));
30837
- const resolve10 = opts.resolve ?? getAcpAdapter;
30847
+ const sleep5 = opts.sleep ?? ((ms) => new Promise((resolve12) => setTimeout(resolve12, ms)));
30848
+ const resolve11 = opts.resolve ?? getAcpAdapter;
30838
30849
  const attempt = () => {
30839
30850
  try {
30840
- return resolve10(agent);
30851
+ return resolve11(agent);
30841
30852
  } catch {
30842
30853
  return null;
30843
30854
  }
@@ -30944,7 +30955,7 @@ function parseJsonl(filePath) {
30944
30955
  return messages;
30945
30956
  }
30946
30957
  function post(endpoint, body, pluginAuthToken) {
30947
- return new Promise((resolve10) => {
30958
+ return new Promise((resolve11) => {
30948
30959
  const payload = JSON.stringify(body);
30949
30960
  const u2 = new URL(`${API_BASE8}${endpoint}`);
30950
30961
  const transport = u2.protocol === "https:" ? https7 : http8;
@@ -30969,17 +30980,17 @@ function post(endpoint, body, pluginAuthToken) {
30969
30980
  res.resume();
30970
30981
  const ok = res.statusCode !== void 0 && res.statusCode >= 200 && res.statusCode < 300;
30971
30982
  if (!ok) log.warn("history:post", `${endpoint} \u2192 HTTP ${res.statusCode}`);
30972
- resolve10(ok);
30983
+ resolve11(ok);
30973
30984
  }
30974
30985
  );
30975
30986
  req.on("error", (err) => {
30976
30987
  log.warn("history:post", `${endpoint} network error`, err);
30977
- resolve10(false);
30988
+ resolve11(false);
30978
30989
  });
30979
30990
  req.on("timeout", () => {
30980
30991
  log.warn("history:post", `${endpoint} timeout after 15s`);
30981
30992
  req.destroy();
30982
- resolve10(false);
30993
+ resolve11(false);
30983
30994
  });
30984
30995
  req.write(payload);
30985
30996
  req.end();
@@ -33529,12 +33540,12 @@ var Connection = class {
33529
33540
  const id = this.nextRequestId++;
33530
33541
  let cancel = () => {
33531
33542
  };
33532
- const responsePromise = new Promise((resolve10, reject) => {
33543
+ const responsePromise = new Promise((resolve11, reject) => {
33533
33544
  const pendingResponse = {
33534
33545
  resolve: (response) => {
33535
33546
  try {
33536
33547
  const value = mapResponse ? mapResponse(response) : response;
33537
- resolve10(value);
33548
+ resolve11(value);
33538
33549
  } catch (error) {
33539
33550
  reject(error);
33540
33551
  }
@@ -33612,8 +33623,8 @@ var Connection = class {
33612
33623
  initialize(stream, handlers2) {
33613
33624
  this.stream = stream;
33614
33625
  this.staticHandlers = handlers2;
33615
- this.closedPromise = new Promise((resolve10) => {
33616
- this.abortController.signal.addEventListener("abort", () => resolve10());
33626
+ this.closedPromise = new Promise((resolve11) => {
33627
+ this.abortController.signal.addEventListener("abort", () => resolve11());
33617
33628
  });
33618
33629
  void this.receive();
33619
33630
  }
@@ -34401,8 +34412,8 @@ var AsyncQueue = class {
34401
34412
  if (this.failed) {
34402
34413
  return Promise.reject(this.failure);
34403
34414
  }
34404
- return new Promise((resolve10, reject) => {
34405
- this.waiters.push({ resolve: resolve10, reject });
34415
+ return new Promise((resolve11, reject) => {
34416
+ this.waiters.push({ resolve: resolve11, reject });
34406
34417
  });
34407
34418
  }
34408
34419
  };
@@ -35736,6 +35747,17 @@ var AcpClient = class {
35736
35747
  * them mid-turn and break turn A's idle watchdog (mobile "send-while-active"
35737
35748
  * can fire two prompts back-to-back). See {@link prompt}. */
35738
35749
  promptChain = Promise.resolve();
35750
+ /**
35751
+ * Coalescing state for {@link reprovisionMcp}. A burst of integration events
35752
+ * (the user linking several connectors in a row) used to fire one respawn per
35753
+ * event, each killing the adapter the previous had just started — see the
35754
+ * comment on that method.
35755
+ */
35756
+ /** True once a start has fully succeeded (handshake + session). Distinguishes
35757
+ * "never started" (a programming error) from "the adapter died" (recoverable). */
35758
+ startedOnce = false;
35759
+ mcpReprovisionQueued = false;
35760
+ mcpReprovisionPending = null;
35739
35761
  /** Last few adapter stderr lines — so a startup failure surfaces the REAL
35740
35762
  * cause (e.g. gemini's `IneligibleTierError`) instead of a bare timeout. */
35741
35763
  recentStderr = [];
@@ -35927,6 +35949,7 @@ var AcpClient = class {
35927
35949
  }
35928
35950
  this.startAbortReject = null;
35929
35951
  this.sessionId = newSession.sessionId;
35952
+ this.startedOnce = true;
35930
35953
  this.captureModelConfig(newSession.configOptions ?? []);
35931
35954
  this.captureModes(newSession.modes ?? null);
35932
35955
  const tier = nonEmptyString(
@@ -35987,7 +36010,16 @@ var AcpClient = class {
35987
36010
  }
35988
36011
  async runPrompt(input) {
35989
36012
  if (!this.connection || !this.sessionId) {
35990
- throw new Error("AcpClient.prompt called before start()");
36013
+ if (!this.startedOnce) {
36014
+ throw new Error("AcpClient.prompt called before start()");
36015
+ }
36016
+ log.warn("acpClient", "adapter is gone \u2014 restarting it before this turn");
36017
+ this.stopping = false;
36018
+ await this.startOnce();
36019
+ if (!this.connection || !this.sessionId) {
36020
+ throw new Error("AcpClient.prompt: adapter could not be restarted");
36021
+ }
36022
+ log.info("acpClient", "adapter restarted \u2014 resuming the turn");
35991
36023
  }
35992
36024
  await ensureHeadroomProxyReady(makeRealProxySupervisorDeps()).catch(() => void 0);
35993
36025
  const blocks = typeof input === "string" ? [{ type: "text", text: input }] : input;
@@ -36036,7 +36068,7 @@ var AcpClient = class {
36036
36068
  this.pendingToolCalls.clear();
36037
36069
  try {
36038
36070
  const result = await Promise.race([send, idle.promise]);
36039
- await new Promise((resolve10) => setImmediate(resolve10));
36071
+ await new Promise((resolve11) => setImmediate(resolve11));
36040
36072
  log.info(
36041
36073
  "acpClient",
36042
36074
  `prompt \u2190 ok stopReason=${result.stopReason ?? "?"} elapsedMs=${Date.now() - t0}`
@@ -36233,6 +36265,26 @@ var AcpClient = class {
36233
36265
  * the caller can tell the user "active now" vs "active on next restart".
36234
36266
  */
36235
36267
  async reprovisionMcp(servers) {
36268
+ this.opts.mcpServers = servers;
36269
+ if (!this.connection || !this.sessionId) return "deferred";
36270
+ this.mcpReprovisionPending = servers;
36271
+ if (this.mcpReprovisionQueued) return "deferred";
36272
+ this.mcpReprovisionQueued = true;
36273
+ const run = this.promptChain.then(() => {
36274
+ this.mcpReprovisionQueued = false;
36275
+ const latest = this.mcpReprovisionPending ?? servers;
36276
+ this.mcpReprovisionPending = null;
36277
+ return this.runReprovisionMcp(latest);
36278
+ });
36279
+ this.promptChain = run.then(
36280
+ () => void 0,
36281
+ () => void 0
36282
+ );
36283
+ return run;
36284
+ }
36285
+ /** The actual respawn. Only ever called from {@link reprovisionMcp}'s queued
36286
+ * slot, so it can assume no turn and no other respawn is running. */
36287
+ async runReprovisionMcp(servers) {
36236
36288
  this.opts.mcpServers = servers;
36237
36289
  const prevConversationId = this.sessionId;
36238
36290
  if (!this.connection || !prevConversationId) return "deferred";
@@ -36435,14 +36487,14 @@ var AcpClient = class {
36435
36487
  this.sessionId = null;
36436
36488
  try {
36437
36489
  child.kill("SIGTERM");
36438
- const grace = new Promise((resolve10) => {
36490
+ const grace = new Promise((resolve11) => {
36439
36491
  const t2 = setTimeout(() => {
36440
36492
  killQuiet(child, "SIGKILL");
36441
- resolve10();
36493
+ resolve11();
36442
36494
  }, 2e3);
36443
36495
  child.once("exit", () => {
36444
36496
  clearTimeout(t2);
36445
- resolve10();
36497
+ resolve11();
36446
36498
  });
36447
36499
  });
36448
36500
  await grace;
@@ -36905,7 +36957,7 @@ var _transport4 = {
36905
36957
  get: _get
36906
36958
  };
36907
36959
  function _post3(url2, headers, payload) {
36908
- return new Promise((resolve10, reject) => {
36960
+ return new Promise((resolve11, reject) => {
36909
36961
  let settled = false;
36910
36962
  const u2 = new URL(url2);
36911
36963
  const lib = u2.protocol === "https:" ? https8 : http9;
@@ -36930,7 +36982,7 @@ function _post3(url2, headers, payload) {
36930
36982
  res.on("end", () => {
36931
36983
  if (settled) return;
36932
36984
  settled = true;
36933
- resolve10({ statusCode: res.statusCode ?? 0, body });
36985
+ resolve11({ statusCode: res.statusCode ?? 0, body });
36934
36986
  });
36935
36987
  }
36936
36988
  );
@@ -36947,7 +36999,7 @@ function _post3(url2, headers, payload) {
36947
36999
  });
36948
37000
  }
36949
37001
  function _get(url2, headers) {
36950
- return new Promise((resolve10, reject) => {
37002
+ return new Promise((resolve11, reject) => {
36951
37003
  let settled = false;
36952
37004
  const u2 = new URL(url2);
36953
37005
  const lib = u2.protocol === "https:" ? https8 : http9;
@@ -36971,7 +37023,7 @@ function _get(url2, headers) {
36971
37023
  res.on("end", () => {
36972
37024
  if (settled) return;
36973
37025
  settled = true;
36974
- resolve10({ statusCode: res.statusCode ?? 0, body });
37026
+ resolve11({ statusCode: res.statusCode ?? 0, body });
36975
37027
  });
36976
37028
  }
36977
37029
  );
@@ -38144,12 +38196,12 @@ function runGit3(cwd, args2) {
38144
38196
  return _runGitImpl2.run(cwd, args2);
38145
38197
  }
38146
38198
  function defaultRunGit(cwd, args2) {
38147
- return new Promise((resolve10) => {
38199
+ return new Promise((resolve11) => {
38148
38200
  let proc;
38149
38201
  try {
38150
38202
  proc = (0, import_child_process31.spawn)("git", args2, { cwd, env: process.env });
38151
38203
  } catch {
38152
- resolve10(null);
38204
+ resolve11(null);
38153
38205
  return;
38154
38206
  }
38155
38207
  let stdout = "";
@@ -38160,16 +38212,16 @@ function defaultRunGit(cwd, args2) {
38160
38212
  proc.stderr?.on("data", (c2) => {
38161
38213
  stderr += c2.toString();
38162
38214
  });
38163
- proc.on("error", () => resolve10(null));
38215
+ proc.on("error", () => resolve11(null));
38164
38216
  proc.on("close", (code) => {
38165
38217
  if (code === 0) {
38166
- resolve10(stdout);
38218
+ resolve11(stdout);
38167
38219
  } else {
38168
38220
  log.trace(
38169
38221
  "turnFiles",
38170
38222
  `git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`
38171
38223
  );
38172
- resolve10(null);
38224
+ resolve11(null);
38173
38225
  }
38174
38226
  });
38175
38227
  });
@@ -38578,25 +38630,25 @@ function baselineKey(entry) {
38578
38630
 
38579
38631
  // src/agents/acp/withTimeout.ts
38580
38632
  function withTimeout(p2, ms) {
38581
- return new Promise((resolve10) => {
38633
+ return new Promise((resolve11) => {
38582
38634
  let settled = false;
38583
38635
  const timer = setTimeout(() => {
38584
38636
  if (settled) return;
38585
38637
  settled = true;
38586
- resolve10(void 0);
38638
+ resolve11(void 0);
38587
38639
  }, ms);
38588
38640
  p2.then(
38589
38641
  (v) => {
38590
38642
  if (settled) return;
38591
38643
  settled = true;
38592
38644
  clearTimeout(timer);
38593
- resolve10(v);
38645
+ resolve11(v);
38594
38646
  },
38595
38647
  () => {
38596
38648
  if (settled) return;
38597
38649
  settled = true;
38598
38650
  clearTimeout(timer);
38599
- resolve10(void 0);
38651
+ resolve11(void 0);
38600
38652
  }
38601
38653
  );
38602
38654
  });
@@ -38891,7 +38943,7 @@ async function postBudgetReached(opts, fetchImpl = fetch) {
38891
38943
  var import_node_child_process30 = require("child_process");
38892
38944
  var fs73 = __toESM(require("fs"));
38893
38945
  var path81 = __toESM(require("path"));
38894
- var defaultCommandRunner = (file, args2, cwd, timeoutMs) => new Promise((resolve10) => {
38946
+ var defaultCommandRunner = (file, args2, cwd, timeoutMs) => new Promise((resolve11) => {
38895
38947
  (0, import_node_child_process30.execFile)(
38896
38948
  file,
38897
38949
  args2,
@@ -38902,7 +38954,7 @@ var defaultCommandRunner = (file, args2, cwd, timeoutMs) => new Promise((resolve
38902
38954
  const rawCode = err.code;
38903
38955
  code = typeof rawCode === "number" ? rawCode : 1;
38904
38956
  }
38905
- resolve10({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
38957
+ resolve11({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
38906
38958
  }
38907
38959
  );
38908
38960
  });
@@ -40712,15 +40764,15 @@ async function prewarmNewMcpEntries(manifest, previousIds) {
40712
40764
  );
40713
40765
  await Promise.all(
40714
40766
  fresh.map(
40715
- (e) => new Promise((resolve10) => {
40767
+ (e) => new Promise((resolve11) => {
40716
40768
  const mcp = e.delivery.mcp;
40717
40769
  const child = (0, import_node_child_process31.execFile)(
40718
40770
  mcp.command,
40719
40771
  [...mcp.args, "--help"],
40720
40772
  { timeout: 9e4 },
40721
- () => resolve10()
40773
+ () => resolve11()
40722
40774
  );
40723
- child.on("error", () => resolve10());
40775
+ child.on("error", () => resolve11());
40724
40776
  })
40725
40777
  )
40726
40778
  );
@@ -40945,7 +40997,7 @@ var StreamingState = class {
40945
40997
  * default-reject. Caller is the SDK's `onRequestPermission`.
40946
40998
  */
40947
40999
  registerPermission(args2) {
40948
- return new Promise((resolve10) => {
41000
+ return new Promise((resolve11) => {
40949
41001
  const timeoutTimer = setTimeout(() => {
40950
41002
  if (this.pending?.kind === "permission" && this.pending.questionId === args2.questionId) {
40951
41003
  log.warn(
@@ -40953,7 +41005,7 @@ var StreamingState = class {
40953
41005
  `permission ${args2.questionId.slice(0, 8)} TTL expired \u2014 auto-cancel`
40954
41006
  );
40955
41007
  this.pending = null;
40956
- resolve10({ outcome: { outcome: "cancelled" } });
41008
+ resolve11({ outcome: { outcome: "cancelled" } });
40957
41009
  }
40958
41010
  }, PERMISSION_TIMEOUT_MS);
40959
41011
  this.pending = {
@@ -40961,7 +41013,7 @@ var StreamingState = class {
40961
41013
  questionId: args2.questionId,
40962
41014
  labels: args2.labels,
40963
41015
  optionIdByLabel: args2.optionIdByLabel,
40964
- resolve: resolve10,
41016
+ resolve: resolve11,
40965
41017
  timeoutTimer
40966
41018
  };
40967
41019
  });
@@ -40993,14 +41045,14 @@ var StreamingState = class {
40993
41045
  const label = this.pending.labels[index];
40994
41046
  const optionId = label ? this.pending.optionIdByLabel[label] : void 0;
40995
41047
  clearTimeout(this.pending.timeoutTimer);
40996
- const resolve10 = this.pending.resolve;
41048
+ const resolve11 = this.pending.resolve;
40997
41049
  this.pending = null;
40998
41050
  if (!optionId) {
40999
41051
  log.warn("acpRunner", `select_option index=${index} out of bounds \u2014 cancel`);
41000
- resolve10({ outcome: { outcome: "cancelled" } });
41052
+ resolve11({ outcome: { outcome: "cancelled" } });
41001
41053
  return { kind: "resolved" };
41002
41054
  }
41003
- resolve10({ outcome: { outcome: "selected", optionId } });
41055
+ resolve11({ outcome: { outcome: "selected", optionId } });
41004
41056
  return { kind: "resolved" };
41005
41057
  }
41006
41058
  const text = this.pending.options[index];
@@ -43444,10 +43496,10 @@ var NativeTuiDriver = class _NativeTuiDriver {
43444
43496
  this.lastOutput = this.now();
43445
43497
  }
43446
43498
  whenSafeToYield() {
43447
- return new Promise((resolve10) => {
43499
+ return new Promise((resolve11) => {
43448
43500
  const tick = () => {
43449
43501
  const quietFor = this.now() - this.lastOutput;
43450
- if (quietFor >= this.idleMs) resolve10();
43502
+ if (quietFor >= this.idleMs) resolve11();
43451
43503
  else setTimeout(tick, this.idleMs - quietFor);
43452
43504
  };
43453
43505
  tick();
@@ -43513,10 +43565,10 @@ var AcpDriver = class {
43513
43565
  * one ever is, assume resumable so behaviour is unchanged.
43514
43566
  */
43515
43567
  hasTranscript(conversationId) {
43516
- const resolve10 = this.deps.runtime.resolveHistoryFile;
43517
- if (typeof resolve10 !== "function") return true;
43568
+ const resolve11 = this.deps.runtime.resolveHistoryFile;
43569
+ if (typeof resolve11 !== "function") return true;
43518
43570
  try {
43519
- return resolve10.call(this.deps.runtime, this.deps.opts.cwd, conversationId) !== null;
43571
+ return resolve11.call(this.deps.runtime, this.deps.opts.cwd, conversationId) !== null;
43520
43572
  } catch {
43521
43573
  return true;
43522
43574
  }
@@ -43606,11 +43658,11 @@ var AcpDriver = class {
43606
43658
  this.turnActive = false;
43607
43659
  const waiters = this.waiters;
43608
43660
  this.waiters = [];
43609
- waiters.forEach((resolve10) => resolve10());
43661
+ waiters.forEach((resolve11) => resolve11());
43610
43662
  }
43611
43663
  whenSafeToYield() {
43612
43664
  if (!this.turnActive) return Promise.resolve();
43613
- return new Promise((resolve10) => this.waiters.push(resolve10));
43665
+ return new Promise((resolve11) => this.waiters.push(resolve11));
43614
43666
  }
43615
43667
  };
43616
43668
 
@@ -44188,8 +44240,8 @@ async function start(requestedAgent, presetSession) {
44188
44240
  let gateTimer;
44189
44241
  await Promise.race([
44190
44242
  Promise.all([depsReady, agentBinaryReady]),
44191
- new Promise((resolve10) => {
44192
- gateTimer = setTimeout(resolve10, GATE_TIMEOUT_MS);
44243
+ new Promise((resolve11) => {
44244
+ gateTimer = setTimeout(resolve11, GATE_TIMEOUT_MS);
44193
44245
  })
44194
44246
  ]);
44195
44247
  if (gateTimer) clearTimeout(gateTimer);
@@ -44563,7 +44615,7 @@ async function pair(args2 = []) {
44563
44615
  waitSpin.message(waitMessage());
44564
44616
  }, 1e3);
44565
44617
  countdownInterval.unref?.();
44566
- await new Promise((resolve10) => {
44618
+ await new Promise((resolve11) => {
44567
44619
  let stopPolling = null;
44568
44620
  function sigintHandler() {
44569
44621
  clearInterval(countdownInterval);
@@ -44614,7 +44666,7 @@ async function pair(args2 = []) {
44614
44666
  pluginAuthToken: info.pluginAuthToken
44615
44667
  });
44616
44668
  }
44617
- resolve10();
44669
+ resolve11();
44618
44670
  },
44619
44671
  () => {
44620
44672
  clearInterval(countdownInterval);
@@ -44843,12 +44895,12 @@ var GitHubCodespacesProvider = class {
44843
44895
  }
44844
44896
  if (!isAuthed) {
44845
44897
  resetStdinForChild();
44846
- await new Promise((resolve10, reject) => {
44898
+ await new Promise((resolve11, reject) => {
44847
44899
  const proc = (0, import_child_process32.spawn)("gh", ["auth", "login", "-s", "codespace,repo,read:user"], {
44848
44900
  stdio: "inherit"
44849
44901
  });
44850
44902
  proc.on("exit", (code) => {
44851
- if (code === 0) resolve10();
44903
+ if (code === 0) resolve11();
44852
44904
  else reject(new Error("gh auth login failed."));
44853
44905
  });
44854
44906
  proc.on("error", reject);
@@ -44877,13 +44929,13 @@ var GitHubCodespacesProvider = class {
44877
44929
  }
44878
44930
  wt(noteLines.join("\n"), "One more permission needed");
44879
44931
  resetStdinForChild();
44880
- const refreshCode = await new Promise((resolve10, reject) => {
44932
+ const refreshCode = await new Promise((resolve11, reject) => {
44881
44933
  const proc = (0, import_child_process32.spawn)(
44882
44934
  "gh",
44883
44935
  ["auth", "refresh", "-h", "github.com", "-s", "codespace"],
44884
44936
  { stdio: "inherit" }
44885
44937
  );
44886
- proc.on("exit", (code) => resolve10(code ?? 1));
44938
+ proc.on("exit", (code) => resolve11(code ?? 1));
44887
44939
  proc.on("error", reject);
44888
44940
  });
44889
44941
  if (refreshCode !== 0) {
@@ -45027,10 +45079,10 @@ var GitHubCodespacesProvider = class {
45027
45079
  if (q(proceed) || !proceed) return;
45028
45080
  O2.step(`Installing gh via ${installCmd.describe}\u2026`);
45029
45081
  resetStdinForChild();
45030
- const ok = await new Promise((resolve10) => {
45082
+ const ok = await new Promise((resolve11) => {
45031
45083
  const proc = (0, import_child_process32.spawn)(installCmd.exe, installCmd.args, { stdio: "inherit" });
45032
- proc.on("exit", (code) => resolve10(code === 0));
45033
- proc.on("error", () => resolve10(false));
45084
+ proc.on("exit", (code) => resolve11(code === 0));
45085
+ proc.on("error", () => resolve11(false));
45034
45086
  });
45035
45087
  if (ok) O2.success("gh installed");
45036
45088
  else O2.error("gh install failed");
@@ -45054,14 +45106,14 @@ var GitHubCodespacesProvider = class {
45054
45106
  "Expanding GitHub scopes"
45055
45107
  );
45056
45108
  resetStdinForChild();
45057
- await new Promise((resolve10, reject) => {
45109
+ await new Promise((resolve11, reject) => {
45058
45110
  const proc = (0, import_child_process32.spawn)(
45059
45111
  "gh",
45060
45112
  ["auth", "refresh", "-h", "github.com", "-s", "repo,read:org"],
45061
45113
  { stdio: "inherit" }
45062
45114
  );
45063
45115
  proc.on("exit", (code) => {
45064
- if (code === 0) resolve10();
45116
+ if (code === 0) resolve11();
45065
45117
  else reject(new Error(
45066
45118
  "gh auth refresh failed. Re-run `gh auth refresh -h github.com -s repo,read:org` manually."
45067
45119
  ));
@@ -45232,13 +45284,13 @@ var GitHubCodespacesProvider = class {
45232
45284
  }
45233
45285
  async streamCommand(workspaceId, command2) {
45234
45286
  resetStdinForChild();
45235
- return new Promise((resolve10, reject) => {
45287
+ return new Promise((resolve11, reject) => {
45236
45288
  const proc = (0, import_child_process32.spawn)(
45237
45289
  "gh",
45238
45290
  ["codespace", "ssh", "-c", workspaceId, "--", "-tt", command2],
45239
45291
  { stdio: "inherit" }
45240
45292
  );
45241
- proc.on("exit", (code) => resolve10({ code: code ?? 0 }));
45293
+ proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
45242
45294
  proc.on("error", reject);
45243
45295
  });
45244
45296
  }
@@ -45259,7 +45311,7 @@ var GitHubCodespacesProvider = class {
45259
45311
  "--",
45260
45312
  `mkdir -p ${shellQuote(remoteDir)} && tar -xzf - -C ${shellQuote(remoteDir)}`
45261
45313
  ];
45262
- await new Promise((resolve10, reject) => {
45314
+ await new Promise((resolve11, reject) => {
45263
45315
  const tar = (0, import_child_process32.spawn)("tar", tarArgs, {
45264
45316
  stdio: ["ignore", "pipe", "pipe"],
45265
45317
  env: tarEnv
@@ -45279,7 +45331,7 @@ var GitHubCodespacesProvider = class {
45279
45331
  ssh.on("error", reject);
45280
45332
  ssh.on("exit", (code) => {
45281
45333
  if (code === 0) {
45282
- resolve10();
45334
+ resolve11();
45283
45335
  } else {
45284
45336
  const reason = (sshErr || tarErr || `exit ${code}`).trim().slice(0, 500);
45285
45337
  reject(new Error(`Remote tar failed: ${reason}`));
@@ -45297,7 +45349,7 @@ var GitHubCodespacesProvider = class {
45297
45349
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote(remotePath)}`);
45298
45350
  }
45299
45351
  const cmd = parts.join(" && ");
45300
- await new Promise((resolve10, reject) => {
45352
+ await new Promise((resolve11, reject) => {
45301
45353
  const proc = (0, import_child_process32.spawn)(
45302
45354
  "gh",
45303
45355
  ["codespace", "ssh", "-c", workspaceId, "--", cmd],
@@ -45309,7 +45361,7 @@ var GitHubCodespacesProvider = class {
45309
45361
  });
45310
45362
  proc.on("error", reject);
45311
45363
  proc.on("exit", (code) => {
45312
- if (code === 0) resolve10();
45364
+ if (code === 0) resolve11();
45313
45365
  else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
45314
45366
  });
45315
45367
  proc.stdin?.write(contents);
@@ -45399,10 +45451,10 @@ var GitpodProvider = class {
45399
45451
  "Authenticating Gitpod"
45400
45452
  );
45401
45453
  resetStdinForChild2();
45402
- await new Promise((resolve10, reject) => {
45454
+ await new Promise((resolve11, reject) => {
45403
45455
  const proc = (0, import_child_process33.spawn)("gitpod", ["login"], { stdio: "inherit" });
45404
45456
  proc.on("exit", (code) => {
45405
- if (code === 0) resolve10();
45457
+ if (code === 0) resolve11();
45406
45458
  else reject(new Error("gitpod login failed."));
45407
45459
  });
45408
45460
  proc.on("error", reject);
@@ -45551,13 +45603,13 @@ var GitpodProvider = class {
45551
45603
  }
45552
45604
  async streamCommand(workspaceId, command2) {
45553
45605
  resetStdinForChild2();
45554
- return new Promise((resolve10, reject) => {
45606
+ return new Promise((resolve11, reject) => {
45555
45607
  const proc = (0, import_child_process33.spawn)(
45556
45608
  "gitpod",
45557
45609
  ["workspace", "ssh", workspaceId, "--", "-tt", command2],
45558
45610
  { stdio: "inherit" }
45559
45611
  );
45560
- proc.on("exit", (code) => resolve10({ code: code ?? 0 }));
45612
+ proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
45561
45613
  proc.on("error", reject);
45562
45614
  });
45563
45615
  }
@@ -45571,7 +45623,7 @@ var GitpodProvider = class {
45571
45623
  tarArgs.push(".");
45572
45624
  const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
45573
45625
  const remoteCmd = `mkdir -p ${shellQuote2(remoteDir)} && tar -xzf - -C ${shellQuote2(remoteDir)}`;
45574
- await new Promise((resolve10, reject) => {
45626
+ await new Promise((resolve11, reject) => {
45575
45627
  const tar = (0, import_child_process33.spawn)("tar", tarArgs, {
45576
45628
  stdio: ["ignore", "pipe", "pipe"],
45577
45629
  env: tarEnv
@@ -45592,7 +45644,7 @@ var GitpodProvider = class {
45592
45644
  tar.on("error", reject);
45593
45645
  ssh.on("error", reject);
45594
45646
  ssh.on("exit", (code) => {
45595
- if (code === 0) resolve10();
45647
+ if (code === 0) resolve11();
45596
45648
  else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
45597
45649
  });
45598
45650
  });
@@ -45607,7 +45659,7 @@ var GitpodProvider = class {
45607
45659
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote2(remotePath)}`);
45608
45660
  }
45609
45661
  const cmd = parts.join(" && ");
45610
- await new Promise((resolve10, reject) => {
45662
+ await new Promise((resolve11, reject) => {
45611
45663
  const proc = (0, import_child_process33.spawn)(
45612
45664
  "gitpod",
45613
45665
  ["workspace", "ssh", workspaceId, "--", cmd],
@@ -45619,7 +45671,7 @@ var GitpodProvider = class {
45619
45671
  });
45620
45672
  proc.on("error", reject);
45621
45673
  proc.on("exit", (code) => {
45622
- if (code === 0) resolve10();
45674
+ if (code === 0) resolve11();
45623
45675
  else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
45624
45676
  });
45625
45677
  proc.stdin?.write(contents);
@@ -45676,14 +45728,14 @@ var GitLabWorkspacesProvider = class {
45676
45728
  "Authenticating GitLab"
45677
45729
  );
45678
45730
  resetStdinForChild3();
45679
- await new Promise((resolve10, reject) => {
45731
+ await new Promise((resolve11, reject) => {
45680
45732
  const proc = (0, import_child_process34.spawn)(
45681
45733
  "glab",
45682
45734
  ["auth", "login", "--scopes", "api,read_user,read_repository"],
45683
45735
  { stdio: "inherit" }
45684
45736
  );
45685
45737
  proc.on("exit", (code) => {
45686
- if (code === 0) resolve10();
45738
+ if (code === 0) resolve11();
45687
45739
  else reject(new Error("glab auth login failed."));
45688
45740
  });
45689
45741
  proc.on("error", reject);
@@ -45848,13 +45900,13 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45848
45900
  async streamCommand(workspaceId, command2) {
45849
45901
  const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
45850
45902
  resetStdinForChild3();
45851
- return new Promise((resolve10, reject) => {
45903
+ return new Promise((resolve11, reject) => {
45852
45904
  const proc = (0, import_child_process34.spawn)(
45853
45905
  "ssh",
45854
45906
  ["-tt", "-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, command2],
45855
45907
  { stdio: "inherit" }
45856
45908
  );
45857
- proc.on("exit", (code) => resolve10({ code: code ?? 0 }));
45909
+ proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
45858
45910
  proc.on("error", reject);
45859
45911
  });
45860
45912
  }
@@ -45869,7 +45921,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45869
45921
  tarArgs.push(".");
45870
45922
  const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
45871
45923
  const remoteCmd = `mkdir -p ${shellQuote3(remoteDir)} && tar -xzf - -C ${shellQuote3(remoteDir)}`;
45872
- await new Promise((resolve10, reject) => {
45924
+ await new Promise((resolve11, reject) => {
45873
45925
  const tar = (0, import_child_process34.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
45874
45926
  const ssh = (0, import_child_process34.spawn)(
45875
45927
  "ssh",
@@ -45887,7 +45939,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45887
45939
  tar.on("error", reject);
45888
45940
  ssh.on("error", reject);
45889
45941
  ssh.on("exit", (code) => {
45890
- if (code === 0) resolve10();
45942
+ if (code === 0) resolve11();
45891
45943
  else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
45892
45944
  });
45893
45945
  });
@@ -45900,7 +45952,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45900
45952
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
45901
45953
  }
45902
45954
  const cmd = parts.join(" && ");
45903
- await new Promise((resolve10, reject) => {
45955
+ await new Promise((resolve11, reject) => {
45904
45956
  const proc = (0, import_child_process34.spawn)(
45905
45957
  "ssh",
45906
45958
  ["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, cmd],
@@ -45912,7 +45964,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45912
45964
  });
45913
45965
  proc.on("error", reject);
45914
45966
  proc.on("exit", (code) => {
45915
- if (code === 0) resolve10();
45967
+ if (code === 0) resolve11();
45916
45968
  else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
45917
45969
  });
45918
45970
  proc.stdin?.write(contents);
@@ -46003,10 +46055,10 @@ var RailwayProvider = class {
46003
46055
  "Authenticating Railway"
46004
46056
  );
46005
46057
  resetStdinForChild4();
46006
- await new Promise((resolve10, reject) => {
46058
+ await new Promise((resolve11, reject) => {
46007
46059
  const proc = (0, import_child_process35.spawn)("railway", ["login"], { stdio: "inherit" });
46008
46060
  proc.on("exit", (code) => {
46009
- if (code === 0) resolve10();
46061
+ if (code === 0) resolve11();
46010
46062
  else reject(new Error("railway login failed."));
46011
46063
  });
46012
46064
  proc.on("error", reject);
@@ -46146,13 +46198,13 @@ var RailwayProvider = class {
46146
46198
  throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
46147
46199
  }
46148
46200
  resetStdinForChild4();
46149
- return new Promise((resolve10, reject) => {
46201
+ return new Promise((resolve11, reject) => {
46150
46202
  const proc = (0, import_child_process35.spawn)(
46151
46203
  "railway",
46152
46204
  ["shell", "--project", projectId, "--service", serviceId, "--command", command2],
46153
46205
  { stdio: "inherit" }
46154
46206
  );
46155
- proc.on("exit", (code) => resolve10({ code: code ?? 0 }));
46207
+ proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
46156
46208
  proc.on("error", reject);
46157
46209
  });
46158
46210
  }
@@ -46170,7 +46222,7 @@ var RailwayProvider = class {
46170
46222
  tarArgs.push(".");
46171
46223
  const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
46172
46224
  const remoteCmd = `mkdir -p ${shellQuote4(remoteDir)} && tar -xzf - -C ${shellQuote4(remoteDir)}`;
46173
- await new Promise((resolve10, reject) => {
46225
+ await new Promise((resolve11, reject) => {
46174
46226
  const tar = (0, import_child_process35.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
46175
46227
  const sh = (0, import_child_process35.spawn)(
46176
46228
  "railway",
@@ -46188,7 +46240,7 @@ var RailwayProvider = class {
46188
46240
  tar.on("error", reject);
46189
46241
  sh.on("error", reject);
46190
46242
  sh.on("exit", (code) => {
46191
- if (code === 0) resolve10();
46243
+ if (code === 0) resolve11();
46192
46244
  else reject(new Error(`Remote tar failed: ${(shErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
46193
46245
  });
46194
46246
  });
@@ -46204,7 +46256,7 @@ var RailwayProvider = class {
46204
46256
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
46205
46257
  }
46206
46258
  const cmd = parts.join(" && ");
46207
- await new Promise((resolve10, reject) => {
46259
+ await new Promise((resolve11, reject) => {
46208
46260
  const proc = (0, import_child_process35.spawn)(
46209
46261
  "railway",
46210
46262
  ["shell", "--project", projectId, "--service", serviceId, "--command", cmd],
@@ -46216,7 +46268,7 @@ var RailwayProvider = class {
46216
46268
  });
46217
46269
  proc.on("error", reject);
46218
46270
  proc.on("exit", (code) => {
46219
- if (code === 0) resolve10();
46271
+ if (code === 0) resolve11();
46220
46272
  else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
46221
46273
  });
46222
46274
  proc.stdin?.write(contents);
@@ -47013,7 +47065,7 @@ function checkChokidar() {
47013
47065
  }
47014
47066
  async function doctor(args2 = []) {
47015
47067
  const json = args2.includes("--json");
47016
- const cliVersion = true ? "2.73.0" : "0.0.0-dev";
47068
+ const cliVersion = true ? "2.73.2" : "0.0.0-dev";
47017
47069
  const apiBase2 = resolveApiBaseUrl();
47018
47070
  const diagnosticId = (0, import_node_crypto13.randomUUID)();
47019
47071
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -47404,7 +47456,7 @@ async function mcpRun(args2) {
47404
47456
  // src/commands/version.ts
47405
47457
  var import_picocolors15 = __toESM(require("picocolors"));
47406
47458
  function version2() {
47407
- const v = true ? "2.73.0" : "unknown";
47459
+ const v = true ? "2.73.2" : "unknown";
47408
47460
  console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
47409
47461
  }
47410
47462