codeam-cli 2.72.0 → 2.73.1

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 +27 -0
  2. package/dist/index.js +377 -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);
@@ -1750,7 +1750,12 @@ var INTEGRATION_REGISTRY = {
1750
1750
  label: "Token",
1751
1751
  placeholder: "Your Trello token",
1752
1752
  secret: true,
1753
- help: 'On the API-key page, click the "Token" link to authorize + generate a token (scope read,write, never-expiring).'
1753
+ // WARNING - the Power-Up API-key page also shows a "Secret", and it is
1754
+ // NOT the token: both are 64 hex characters and look identical, so it
1755
+ // is the natural thing to copy. Pasting the Secret fails with Trello's
1756
+ // misleading `invalid key`, which then sends the user to regenerate a
1757
+ // perfectly good API key (owner report, 2026-09-01). Say so here.
1758
+ help: 'On that same API-key page, click the "Token" link to authorize and generate a token (read,write, never-expiring). NOT the "Secret" on that page - it looks identical but will not work.'
1754
1759
  }
1755
1760
  ]
1756
1761
  },
@@ -5860,14 +5865,14 @@ async function addSourceContext(frames) {
5860
5865
  return frames;
5861
5866
  }
5862
5867
  function getContextLinesFromFile(path95, ranges, output) {
5863
- return new Promise((resolve10) => {
5868
+ return new Promise((resolve11) => {
5864
5869
  const stream = (0, import_node_fs.createReadStream)(path95);
5865
5870
  const lineReaded = (0, import_node_readline.createInterface)({
5866
5871
  input: stream
5867
5872
  });
5868
5873
  function destroyStreamAndResolve() {
5869
5874
  stream.destroy();
5870
- resolve10();
5875
+ resolve11();
5871
5876
  }
5872
5877
  let lineNumber = 0;
5873
5878
  let currentRangeIndex = 0;
@@ -7154,9 +7159,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
7154
7159
  if (!waitUntil) return;
7155
7160
  if (this.disabled || this.optedOut) return;
7156
7161
  if (!this._waitUntilCycle) {
7157
- let resolve10;
7162
+ let resolve11;
7158
7163
  const promise = new Promise((r) => {
7159
- resolve10 = r;
7164
+ resolve11 = r;
7160
7165
  });
7161
7166
  try {
7162
7167
  waitUntil(promise);
@@ -7164,7 +7169,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
7164
7169
  return;
7165
7170
  }
7166
7171
  this._waitUntilCycle = {
7167
- resolve: resolve10,
7172
+ resolve: resolve11,
7168
7173
  startedAt: Date.now(),
7169
7174
  timer: void 0
7170
7175
  };
@@ -7188,12 +7193,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
7188
7193
  return cycle?.resolve;
7189
7194
  }
7190
7195
  async resolveWaitUntilFlush() {
7191
- const resolve10 = this._consumeWaitUntilCycle();
7196
+ const resolve11 = this._consumeWaitUntilCycle();
7192
7197
  try {
7193
7198
  await super.flush();
7194
7199
  } catch {
7195
7200
  } finally {
7196
- resolve10?.();
7201
+ resolve11?.();
7197
7202
  }
7198
7203
  }
7199
7204
  getPersistedProperty(key) {
@@ -7285,15 +7290,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
7285
7290
  async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
7286
7291
  if (this.isLocalEvaluationReady()) return true;
7287
7292
  if (void 0 === this.featureFlagsPoller) return false;
7288
- return new Promise((resolve10) => {
7293
+ return new Promise((resolve11) => {
7289
7294
  const timeout = setTimeout(() => {
7290
7295
  cleanup();
7291
- resolve10(false);
7296
+ resolve11(false);
7292
7297
  }, timeoutMs);
7293
7298
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
7294
7299
  clearTimeout(timeout);
7295
7300
  cleanup();
7296
- resolve10(count > 0);
7301
+ resolve11(count > 0);
7297
7302
  });
7298
7303
  });
7299
7304
  }
@@ -7730,13 +7735,13 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
7730
7735
  this.context?.enter(data, options);
7731
7736
  }
7732
7737
  async _shutdown(shutdownTimeoutMs) {
7733
- const resolve10 = this._consumeWaitUntilCycle();
7738
+ const resolve11 = this._consumeWaitUntilCycle();
7734
7739
  await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
7735
7740
  this.errorTracking.shutdown();
7736
7741
  try {
7737
7742
  return await super._shutdown(shutdownTimeoutMs);
7738
7743
  } finally {
7739
- resolve10?.();
7744
+ resolve11?.();
7740
7745
  }
7741
7746
  }
7742
7747
  async _requestRemoteConfigPayload(flagKey) {
@@ -8092,7 +8097,7 @@ function readAnonId() {
8092
8097
  }
8093
8098
  function superProperties() {
8094
8099
  return {
8095
- cliVersion: true ? "2.72.0" : "0.0.0-dev",
8100
+ cliVersion: true ? "2.73.1" : "0.0.0-dev",
8096
8101
  nodeVersion: process.version,
8097
8102
  platform: process.platform,
8098
8103
  arch: process.arch,
@@ -8239,10 +8244,10 @@ var _execSeam = {
8239
8244
  }
8240
8245
  };
8241
8246
  var _execSeamAsync = {
8242
- exec: (file, args2, opts) => new Promise((resolve10, reject) => {
8247
+ exec: (file, args2, opts) => new Promise((resolve11, reject) => {
8243
8248
  (0, import_child_process.execFile)(file, args2, opts, (err, stdout) => {
8244
8249
  if (err) reject(err);
8245
- else resolve10(typeof stdout === "string" ? stdout : stdout.toString("utf8"));
8250
+ else resolve11(typeof stdout === "string" ? stdout : stdout.toString("utf8"));
8246
8251
  });
8247
8252
  })
8248
8253
  };
@@ -8334,7 +8339,7 @@ var http = __toESM(require("http"));
8334
8339
  // package.json
8335
8340
  var package_default = {
8336
8341
  name: "codeam-cli",
8337
- version: "2.72.0",
8342
+ version: "2.73.1",
8338
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.",
8339
8344
  type: "commonjs",
8340
8345
  main: "dist/index.js",
@@ -8466,8 +8471,8 @@ async function requestCode(pluginId, pluginSecretHash) {
8466
8471
  });
8467
8472
  let timer;
8468
8473
  const timeoutSentinel = /* @__PURE__ */ Symbol("request-code-timeout");
8469
- const timeoutPromise = new Promise((resolve10) => {
8470
- timer = setTimeout(() => resolve10(timeoutSentinel), REQUEST_CODE_TIMEOUT_MS);
8474
+ const timeoutPromise = new Promise((resolve11) => {
8475
+ timer = setTimeout(() => resolve11(timeoutSentinel), REQUEST_CODE_TIMEOUT_MS);
8471
8476
  });
8472
8477
  const result = await Promise.race([post2, timeoutPromise]);
8473
8478
  clearTimeout(timer);
@@ -8938,7 +8943,7 @@ async function postBeadsProvisioning(input) {
8938
8943
  }
8939
8944
  }
8940
8945
  async function _postJsonAuthed(url2, body, pluginAuthToken) {
8941
- return new Promise((resolve10, reject) => {
8946
+ return new Promise((resolve11, reject) => {
8942
8947
  const data = JSON.stringify(body);
8943
8948
  const u2 = new URL(url2);
8944
8949
  const transport = u2.protocol === "https:" ? https : http;
@@ -8968,9 +8973,9 @@ async function _postJsonAuthed(url2, body, pluginAuthToken) {
8968
8973
  return;
8969
8974
  }
8970
8975
  try {
8971
- resolve10(JSON.parse(responseBody));
8976
+ resolve11(JSON.parse(responseBody));
8972
8977
  } catch {
8973
- resolve10(null);
8978
+ resolve11(null);
8974
8979
  }
8975
8980
  });
8976
8981
  }
@@ -8996,7 +9001,7 @@ function makeHttpError(statusCode, retryAfterHeader, responseBody) {
8996
9001
  return err;
8997
9002
  }
8998
9003
  async function _postJson(url2, body, extraHeaders) {
8999
- return new Promise((resolve10, reject) => {
9004
+ return new Promise((resolve11, reject) => {
9000
9005
  const data = JSON.stringify(body);
9001
9006
  const u2 = new URL(url2);
9002
9007
  const transport = u2.protocol === "https:" ? https : http;
@@ -9026,9 +9031,9 @@ async function _postJson(url2, body, extraHeaders) {
9026
9031
  return;
9027
9032
  }
9028
9033
  try {
9029
- resolve10(JSON.parse(body2));
9034
+ resolve11(JSON.parse(body2));
9030
9035
  } catch {
9031
- resolve10(null);
9036
+ resolve11(null);
9032
9037
  }
9033
9038
  });
9034
9039
  }
@@ -9043,7 +9048,7 @@ async function _postJson(url2, body, extraHeaders) {
9043
9048
  });
9044
9049
  }
9045
9050
  async function _getJson(url2, extraHeaders) {
9046
- return new Promise((resolve10, reject) => {
9051
+ return new Promise((resolve11, reject) => {
9047
9052
  const u2 = new URL(url2);
9048
9053
  const transport = u2.protocol === "https:" ? https : http;
9049
9054
  const req = transport.request(
@@ -9067,9 +9072,9 @@ async function _getJson(url2, extraHeaders) {
9067
9072
  return;
9068
9073
  }
9069
9074
  try {
9070
- resolve10(JSON.parse(body));
9075
+ resolve11(JSON.parse(body));
9071
9076
  } catch {
9072
- resolve10(null);
9077
+ resolve11(null);
9073
9078
  }
9074
9079
  });
9075
9080
  }
@@ -9410,12 +9415,12 @@ async function probeProxyAliveReal() {
9410
9415
  }
9411
9416
  }
9412
9417
  async function probeProxyPortOpenReal() {
9413
- return new Promise((resolve10) => {
9418
+ return new Promise((resolve11) => {
9414
9419
  const socket = net.connect({ host: "127.0.0.1", port: 8787 });
9415
9420
  const done = (ok) => {
9416
9421
  socket.removeAllListeners();
9417
9422
  socket.destroy();
9418
- resolve10(ok);
9423
+ resolve11(ok);
9419
9424
  };
9420
9425
  socket.setTimeout(2e3);
9421
9426
  socket.once("connect", () => done(true));
@@ -9927,7 +9932,7 @@ var CommandRelayService = class _CommandRelayService {
9927
9932
  // fresh + clear the "CLI update available" banner after a self-update
9928
9933
  // (a codespace that reinstalls @latest reconnects via heartbeat, not
9929
9934
  // pair/reconnect). Older backends ignore the extra field.
9930
- ..."2.72.0" ? { ideVersion: "2.72.0" } : {}
9935
+ ..."2.73.1" ? { ideVersion: "2.73.1" } : {}
9931
9936
  }).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
9932
9937
  }
9933
9938
  /**
@@ -10014,8 +10019,8 @@ async function stopRelayWithGoodbye(relay, timeoutMs = RELAY_GOODBYE_TIMEOUT_MS)
10014
10019
  try {
10015
10020
  await Promise.race([
10016
10021
  relay.stopAndFlush(),
10017
- new Promise((resolve10) => {
10018
- timer = setTimeout(resolve10, timeoutMs);
10022
+ new Promise((resolve11) => {
10023
+ timer = setTimeout(resolve11, timeoutMs);
10019
10024
  })
10020
10025
  ]);
10021
10026
  } catch {
@@ -10124,7 +10129,7 @@ var _transport2 = {
10124
10129
  post: _post
10125
10130
  };
10126
10131
  function _post(url2, headers, payload) {
10127
- return new Promise((resolve10, reject) => {
10132
+ return new Promise((resolve11, reject) => {
10128
10133
  let settled = false;
10129
10134
  const u2 = new URL(url2);
10130
10135
  const lib = u2.protocol === "https:" ? https3 : http3;
@@ -10149,7 +10154,7 @@ function _post(url2, headers, payload) {
10149
10154
  res.on("end", () => {
10150
10155
  if (settled) return;
10151
10156
  settled = true;
10152
- resolve10({ statusCode: res.statusCode ?? 0, body });
10157
+ resolve11({ statusCode: res.statusCode ?? 0, body });
10153
10158
  });
10154
10159
  }
10155
10160
  );
@@ -10837,12 +10842,12 @@ var _gitSeam = {
10837
10842
  run: _runGitImpl
10838
10843
  };
10839
10844
  async function _runGitImpl(cwd, args2, opts = {}) {
10840
- return new Promise((resolve10) => {
10845
+ return new Promise((resolve11) => {
10841
10846
  let proc;
10842
10847
  try {
10843
10848
  proc = (0, import_child_process4.spawn)("git", args2, { cwd, env: process.env });
10844
10849
  } catch {
10845
- resolve10(null);
10850
+ resolve11(null);
10846
10851
  return;
10847
10852
  }
10848
10853
  let stdout = "";
@@ -10853,13 +10858,13 @@ async function _runGitImpl(cwd, args2, opts = {}) {
10853
10858
  proc.stderr?.on("data", (c2) => {
10854
10859
  stderr += c2.toString();
10855
10860
  });
10856
- proc.on("error", () => resolve10(null));
10861
+ proc.on("error", () => resolve11(null));
10857
10862
  proc.on("close", (code) => {
10858
10863
  if (code === 0 || opts.allowNonZeroExit) {
10859
- resolve10(stdout);
10864
+ resolve11(stdout);
10860
10865
  } else {
10861
10866
  log.trace("fileWatcher", `git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`);
10862
- resolve10(null);
10867
+ resolve11(null);
10863
10868
  }
10864
10869
  });
10865
10870
  });
@@ -10945,7 +10950,7 @@ var ChunkEmitter = class {
10945
10950
  if (this.pairingInvalid) {
10946
10951
  return Promise.resolve({ dead: true });
10947
10952
  }
10948
- return new Promise((resolve10) => {
10953
+ return new Promise((resolve11) => {
10949
10954
  let refreshedOnce = false;
10950
10955
  const attempt = (attemptsLeft) => {
10951
10956
  _transport3.post(this.url, this.headers, payload).then(({ statusCode, body: resBody }) => {
@@ -10953,13 +10958,13 @@ var ChunkEmitter = class {
10953
10958
  if (statusCode === 410 || statusCode === 404 && /SESSION_NOT_FOUND|SESSION_GONE/.test(resBody)) {
10954
10959
  process.stderr.write("[codeam] session was deleted/disconnected \u2014 stopping output stream.\n");
10955
10960
  log.info("chunkEmitter", `dead status=${statusCode} took=${tookMs}ms`);
10956
- resolve10({ dead: true });
10961
+ resolve11({ dead: true });
10957
10962
  return;
10958
10963
  }
10959
10964
  if (statusCode === 401 || statusCode === 403) {
10960
10965
  if (refreshedOnce) {
10961
10966
  this.markPairingInvalid(statusCode, tookMs);
10962
- resolve10({ dead: true });
10967
+ resolve11({ dead: true });
10963
10968
  return;
10964
10969
  }
10965
10970
  log.warn("chunkEmitter", `auth ${statusCode} took=${tookMs}ms \u2014 attempting silent refresh`);
@@ -10975,10 +10980,10 @@ var ChunkEmitter = class {
10975
10980
  }
10976
10981
  if (refresh.kind === "gone") {
10977
10982
  this.markPairingInvalid(statusCode, tookMs);
10978
- resolve10({ dead: true });
10983
+ resolve11({ dead: true });
10979
10984
  return;
10980
10985
  }
10981
- resolve10({ dead: false });
10986
+ resolve11({ dead: false });
10982
10987
  })();
10983
10988
  return;
10984
10989
  }
@@ -10989,7 +10994,7 @@ var ChunkEmitter = class {
10989
10994
  } else {
10990
10995
  log.info("chunkEmitter", `ok status=${statusCode} took=${tookMs}ms`);
10991
10996
  }
10992
- resolve10({ dead: false });
10997
+ resolve11({ dead: false });
10993
10998
  }).catch((err) => {
10994
10999
  log.warn(
10995
11000
  "chunkEmitter",
@@ -11000,7 +11005,7 @@ var ChunkEmitter = class {
11000
11005
  const delay = 200 * (maxRetries - attemptsLeft + 1);
11001
11006
  setTimeout(() => attempt(attemptsLeft - 1), delay);
11002
11007
  } else {
11003
- resolve10({ dead: false });
11008
+ resolve11({ dead: false });
11004
11009
  }
11005
11010
  });
11006
11011
  };
@@ -11023,7 +11028,7 @@ var _transport3 = {
11023
11028
  post: _post2
11024
11029
  };
11025
11030
  function _post2(url2, headers, payload) {
11026
- return new Promise((resolve10, reject) => {
11031
+ return new Promise((resolve11, reject) => {
11027
11032
  let settled = false;
11028
11033
  const u2 = new URL(url2);
11029
11034
  const transport = u2.protocol === "https:" ? https4 : http4;
@@ -11047,7 +11052,7 @@ function _post2(url2, headers, payload) {
11047
11052
  res.on("end", () => {
11048
11053
  if (settled) return;
11049
11054
  settled = true;
11050
- resolve10({ statusCode: res.statusCode ?? 0, body: resData });
11055
+ resolve11({ statusCode: res.statusCode ?? 0, body: resData });
11051
11056
  });
11052
11057
  }
11053
11058
  );
@@ -12129,12 +12134,12 @@ async function applyFileReview(workingDir, filePath, action) {
12129
12134
  return { ok: true, action, filePath, repoRoot };
12130
12135
  }
12131
12136
  function runGit2(cwd, args2) {
12132
- return new Promise((resolve10) => {
12137
+ return new Promise((resolve11) => {
12133
12138
  let proc;
12134
12139
  try {
12135
12140
  proc = (0, import_child_process7.spawn)("git", args2, { cwd, env: process.env });
12136
12141
  } catch (err) {
12137
- resolve10({ ok: false, code: -1, stdout: "", stderr: err.message });
12142
+ resolve11({ ok: false, code: -1, stdout: "", stderr: err.message });
12138
12143
  return;
12139
12144
  }
12140
12145
  let stdout = "";
@@ -12147,11 +12152,11 @@ function runGit2(cwd, args2) {
12147
12152
  });
12148
12153
  proc.on(
12149
12154
  "error",
12150
- (err) => resolve10({ ok: false, code: -1, stdout, stderr: stderr + err.message })
12155
+ (err) => resolve11({ ok: false, code: -1, stdout, stderr: stderr + err.message })
12151
12156
  );
12152
12157
  proc.on(
12153
12158
  "close",
12154
- (code) => resolve10({ ok: code === 0, code: code ?? -1, stdout, stderr })
12159
+ (code) => resolve11({ ok: code === 0, code: code ?? -1, stdout, stderr })
12155
12160
  );
12156
12161
  });
12157
12162
  }
@@ -14900,15 +14905,15 @@ function runInstaller() {
14900
14905
  "-Command",
14901
14906
  "irm https://claude.ai/install.ps1 | iex"
14902
14907
  ] : ["-c", "curl -fsSL https://claude.ai/install.sh | bash"];
14903
- return new Promise((resolve10) => {
14908
+ return new Promise((resolve11) => {
14904
14909
  const proc = (0, import_child_process10.spawn)(cmd, args2, { stdio: "inherit" });
14905
14910
  proc.on("error", (err) => {
14906
14911
  console.error(`
14907
14912
  \u2717 Installer failed to launch: ${err.message}`);
14908
- resolve10(false);
14913
+ resolve11(false);
14909
14914
  });
14910
14915
  proc.on("exit", (code) => {
14911
- resolve10(code === 0);
14916
+ resolve11(code === 0);
14912
14917
  });
14913
14918
  });
14914
14919
  }
@@ -15043,7 +15048,7 @@ function extractSetupTokenFromOutput(output) {
15043
15048
  return m ? m[0] : null;
15044
15049
  }
15045
15050
  function captureClaudeSetupToken() {
15046
- return new Promise((resolve10, reject) => {
15051
+ return new Promise((resolve11, reject) => {
15047
15052
  const child = (0, import_node_child_process3.spawn)("claude", ["setup-token"], {
15048
15053
  stdio: ["inherit", "pipe", "inherit"]
15049
15054
  });
@@ -15057,7 +15062,7 @@ function captureClaudeSetupToken() {
15057
15062
  child.on("exit", (code) => {
15058
15063
  const token = extractSetupTokenFromOutput(out2);
15059
15064
  if (token) {
15060
- resolve10({ method: "setup_token", credential: token, source: "setup-token" });
15065
+ resolve11({ method: "setup_token", credential: token, source: "setup-token" });
15061
15066
  return;
15062
15067
  }
15063
15068
  reject(
@@ -15143,17 +15148,17 @@ function parseUsageOutput(raw) {
15143
15148
  return { percent, resetAt };
15144
15149
  }
15145
15150
  async function fetchClaudeQuota() {
15146
- return new Promise((resolve10) => {
15151
+ return new Promise((resolve11) => {
15147
15152
  const claudeCmd = findInPath("claude") ? "claude" : "claude-code";
15148
15153
  if (!claudeCmd) {
15149
- resolve10(null);
15154
+ resolve11(null);
15150
15155
  return;
15151
15156
  }
15152
15157
  const helperPath = path20.join(os14.tmpdir(), "codeam-quota-helper.py");
15153
15158
  fs16.writeFileSync(helperPath, HELPER_SCRIPT, { mode: 420 });
15154
15159
  const python = findInPath("python3") ?? findInPath("python");
15155
15160
  if (!python) {
15156
- resolve10(null);
15161
+ resolve11(null);
15157
15162
  return;
15158
15163
  }
15159
15164
  const proc = (0, import_child_process11.spawn)(python, [helperPath, claudeCmd, "--tools", ""], {
@@ -15180,13 +15185,13 @@ async function fetchClaudeQuota() {
15180
15185
  fs16.unlinkSync(helperPath);
15181
15186
  } catch {
15182
15187
  }
15183
- resolve10(result);
15188
+ resolve11(result);
15184
15189
  }, 5e3);
15185
15190
  }, 8e3);
15186
15191
  setTimeout(() => {
15187
15192
  if (!resolved) {
15188
15193
  resolved = true;
15189
- resolve10(null);
15194
+ resolve11(null);
15190
15195
  }
15191
15196
  try {
15192
15197
  proc.kill();
@@ -15211,12 +15216,12 @@ function killActiveSpawnAndCaptureChildren() {
15211
15216
  }
15212
15217
  async function spawnAndCapture(cmd, args2, opts = {}) {
15213
15218
  const timeoutMs = opts.timeoutMs ?? 6e4;
15214
- return new Promise((resolve10) => {
15219
+ return new Promise((resolve11) => {
15215
15220
  let settled = false;
15216
15221
  const settle = (value) => {
15217
15222
  if (settled) return;
15218
15223
  settled = true;
15219
- resolve10(value);
15224
+ resolve11(value);
15220
15225
  };
15221
15226
  let child;
15222
15227
  try {
@@ -16605,7 +16610,7 @@ function newestRolloutIdSince(sessionsRoot, resolvedCwd, floorMs) {
16605
16610
  return bestId;
16606
16611
  }
16607
16612
  function sleep2(ms) {
16608
- return new Promise((resolve10) => setTimeout(resolve10, ms));
16613
+ return new Promise((resolve11) => setTimeout(resolve11, ms));
16609
16614
  }
16610
16615
  function getCurrentUsage2(historyDir) {
16611
16616
  if (!import_node_fs3.default.existsSync(historyDir)) return null;
@@ -16845,12 +16850,12 @@ function resolveNpm(os68) {
16845
16850
  return os68.id === "win32" ? "npm.cmd" : "npm";
16846
16851
  }
16847
16852
  async function installCodexViaNpm(os68) {
16848
- return new Promise((resolve10, reject) => {
16853
+ return new Promise((resolve11, reject) => {
16849
16854
  const proc = (0, import_node_child_process5.spawn)(resolveNpm(os68), ["install", "-g", "@openai/codex"], {
16850
16855
  stdio: "inherit"
16851
16856
  });
16852
16857
  proc.on("close", (code) => {
16853
- if (code === 0) resolve10();
16858
+ if (code === 0) resolve11();
16854
16859
  else reject(new Error(`npm install -g @openai/codex exited ${code}`));
16855
16860
  });
16856
16861
  proc.on("error", (err) => {
@@ -16971,7 +16976,7 @@ var defaultHeadroomRunner = {
16971
16976
  }
16972
16977
  },
16973
16978
  run(cmd, args2, opts = {}) {
16974
- return new Promise((resolve10) => {
16979
+ return new Promise((resolve11) => {
16975
16980
  const spawnEnv = opts.env ?? process.env;
16976
16981
  const child = (0, import_node_child_process6.spawn)(cmd, args2, { stdio: ["ignore", "pipe", "pipe"], env: spawnEnv });
16977
16982
  let stderrBuf = "";
@@ -16980,7 +16985,7 @@ var defaultHeadroomRunner = {
16980
16985
  const done = (code) => {
16981
16986
  if (settled) return;
16982
16987
  settled = true;
16983
- resolve10({ code, stderr: stderrBuf, stdout: stdoutBuf });
16988
+ resolve11({ code, stderr: stderrBuf, stdout: stdoutBuf });
16984
16989
  };
16985
16990
  child.stdout?.on("data", (b) => {
16986
16991
  const chunk = b.toString();
@@ -17359,7 +17364,7 @@ async function ensureInstallPrerequisites(os68, deps = {}) {
17359
17364
  };
17360
17365
  }
17361
17366
  function defaultRunInstallScript(env) {
17362
- return new Promise((resolve10) => {
17367
+ return new Promise((resolve11) => {
17363
17368
  const proc = (0, import_node_child_process7.spawn)(
17364
17369
  "sh",
17365
17370
  ["-c", `curl -fsSL --connect-timeout 15 --max-time 120 ${INSTALL_URL} | sh`],
@@ -17371,7 +17376,7 @@ function defaultRunInstallScript(env) {
17371
17376
  if (settled) return;
17372
17377
  settled = true;
17373
17378
  clearTimeout(timer);
17374
- resolve10({ code, output });
17379
+ resolve11({ code, output });
17375
17380
  };
17376
17381
  const onData = (b) => {
17377
17382
  const chunk = b.toString();
@@ -17745,7 +17750,7 @@ var CoderabbitRuntimeStrategy = class {
17745
17750
  }
17746
17751
  async runOneShot(input) {
17747
17752
  const launch = await this.prepareInvocation(input);
17748
- return new Promise((resolve10, reject) => {
17753
+ return new Promise((resolve11, reject) => {
17749
17754
  const stdoutBuf = [];
17750
17755
  const stderrBuf = [];
17751
17756
  const proc = (0, import_node_child_process9.spawn)(launch.cmd, launch.args, {
@@ -17757,7 +17762,7 @@ var CoderabbitRuntimeStrategy = class {
17757
17762
  if (settled) return;
17758
17763
  settled = true;
17759
17764
  clearTimeout(timer);
17760
- resolve10(out2);
17765
+ resolve11(out2);
17761
17766
  };
17762
17767
  const timer = setTimeout(() => {
17763
17768
  if (settled) return;
@@ -18375,7 +18380,7 @@ function resolveClaudeNativeBinary(deps = {}) {
18375
18380
  const candidate = import_path4.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
18376
18381
  return existsSync30(candidate) ? candidate : null;
18377
18382
  }
18378
- var realSleep = (ms) => new Promise((resolve10) => setTimeout(resolve10, ms));
18383
+ var realSleep = (ms) => new Promise((resolve11) => setTimeout(resolve11, ms));
18379
18384
  async function waitForClaudeNativeBinary(opts = {}) {
18380
18385
  const timeoutMs = opts.timeoutMs ?? 18e4;
18381
18386
  const pollMs = opts.pollMs ?? 500;
@@ -18487,7 +18492,7 @@ var PERMANENT_ADAPTER_STARTUP_RE = /IneligibleTierError|UNSUPPORTED_CLIENT|no lo
18487
18492
  function probeAdapterModuleGraph(command2, args2, opts = {}) {
18488
18493
  const livenessMs = opts.livenessMs ?? 400;
18489
18494
  const spawnFn = opts.spawnFn ?? import_child_process14.spawn;
18490
- return new Promise((resolve10) => {
18495
+ return new Promise((resolve11) => {
18491
18496
  let settled = false;
18492
18497
  let stderr = "";
18493
18498
  let timer;
@@ -18500,12 +18505,12 @@ function probeAdapterModuleGraph(command2, args2, opts = {}) {
18500
18505
  child?.kill("SIGKILL");
18501
18506
  } catch {
18502
18507
  }
18503
- resolve10(r);
18508
+ resolve11(r);
18504
18509
  };
18505
18510
  try {
18506
18511
  child = spawnFn(command2, [...args2], { stdio: ["pipe", "ignore", "pipe"] });
18507
18512
  } catch {
18508
- resolve10("ok");
18513
+ resolve11("ok");
18509
18514
  return;
18510
18515
  }
18511
18516
  child.stderr?.on("data", (d3) => {
@@ -19092,7 +19097,7 @@ function newestSessionSince(bucket2, floorMs) {
19092
19097
  return bestId;
19093
19098
  }
19094
19099
  function sleep3(ms) {
19095
- return new Promise((resolve10) => setTimeout(resolve10, ms));
19100
+ return new Promise((resolve11) => setTimeout(resolve11, ms));
19096
19101
  }
19097
19102
  function joinTextParts(parts) {
19098
19103
  if (!Array.isArray(parts)) return "";
@@ -19539,7 +19544,7 @@ async function link(args2 = []) {
19539
19544
  waitSpin.start(waitMsg());
19540
19545
  const countdown = setInterval(() => waitSpin.message(waitMsg()), 1e3);
19541
19546
  countdown.unref?.();
19542
- const paired = await new Promise((resolve10, reject) => {
19547
+ const paired = await new Promise((resolve11, reject) => {
19543
19548
  let stopPoll = null;
19544
19549
  const sigint = () => {
19545
19550
  clearInterval(countdown);
@@ -19552,7 +19557,7 @@ async function link(args2 = []) {
19552
19557
  process.removeListener("SIGINT", sigint);
19553
19558
  clearInterval(countdown);
19554
19559
  waitSpin.stop("Paired");
19555
- resolve10(info);
19560
+ resolve11(info);
19556
19561
  },
19557
19562
  () => {
19558
19563
  clearInterval(countdown);
@@ -19710,14 +19715,14 @@ async function captureFreshCredentials(ctx) {
19710
19715
  }
19711
19716
  };
19712
19717
  try {
19713
- const token = await new Promise((resolve10, reject) => {
19718
+ const token = await new Promise((resolve11, reject) => {
19714
19719
  let settled = false;
19715
19720
  const tryExtract = async () => {
19716
19721
  if (settled) return;
19717
19722
  const t2 = await ctx.locator.extract();
19718
19723
  if (t2 && !settled) {
19719
19724
  settled = true;
19720
- resolve10(t2);
19725
+ resolve11(t2);
19721
19726
  }
19722
19727
  };
19723
19728
  watcher.on("add", () => void tryExtract());
@@ -19957,7 +19962,7 @@ function deliverPendingCoderabbitCallback(callbackUrl) {
19957
19962
  function runCoderabbitOAuthLogin(deps) {
19958
19963
  const timeoutMs = deps.timeoutMs ?? 18e4;
19959
19964
  const spawnProc = deps.spawn ?? spawnCoderabbitLoginProc;
19960
- return new Promise((resolve10) => {
19965
+ return new Promise((resolve11) => {
19961
19966
  let settled = false;
19962
19967
  let stdout = "";
19963
19968
  let last = null;
@@ -19970,13 +19975,13 @@ function runCoderabbitOAuthLogin(deps) {
19970
19975
  child.kill("SIGKILL");
19971
19976
  } catch {
19972
19977
  }
19973
- resolve10(r);
19978
+ resolve11(r);
19974
19979
  };
19975
19980
  let child;
19976
19981
  try {
19977
19982
  child = spawnProc("coderabbit", ["auth", "login", "--agent"]);
19978
19983
  } catch (err) {
19979
- resolve10({ ok: false, error: err instanceof Error ? err.message : "spawn failed" });
19984
+ resolve11({ ok: false, error: err instanceof Error ? err.message : "spawn failed" });
19980
19985
  return;
19981
19986
  }
19982
19987
  const timer = setTimeout(
@@ -20449,23 +20454,23 @@ async function reviewPullRequest(params, deps) {
20449
20454
  return report;
20450
20455
  }
20451
20456
  function defaultRunGh(args2) {
20452
- return new Promise((resolve10) => {
20457
+ return new Promise((resolve11) => {
20453
20458
  const stdout = [];
20454
20459
  const stderr = [];
20455
20460
  let proc;
20456
20461
  try {
20457
20462
  proc = (0, import_node_child_process18.spawn)("gh", args2, { stdio: ["ignore", "pipe", "pipe"] });
20458
20463
  } catch (err) {
20459
- 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) });
20460
20465
  return;
20461
20466
  }
20462
20467
  proc.stdout?.on("data", (b) => stdout.push(b));
20463
20468
  proc.stderr?.on("data", (b) => stderr.push(b));
20464
20469
  proc.on("error", (err) => {
20465
- resolve10({ code: -1, stdout: "", stderr: err.message });
20470
+ resolve11({ code: -1, stdout: "", stderr: err.message });
20466
20471
  });
20467
20472
  proc.on("close", (code) => {
20468
- resolve10({
20473
+ resolve11({
20469
20474
  code: code ?? 0,
20470
20475
  stdout: Buffer.concat(stdout).toString("utf8"),
20471
20476
  stderr: Buffer.concat(stderr).toString("utf8")
@@ -20606,7 +20611,7 @@ var os34 = __toESM(require("os"));
20606
20611
  function runAgentInstallScript(script, opts = {}) {
20607
20612
  const timeoutMs = opts.timeoutMs ?? 18e4;
20608
20613
  const scope = opts.logScope ?? "agent-install";
20609
- return new Promise((resolve10) => {
20614
+ return new Promise((resolve11) => {
20610
20615
  const home = process.env.HOME || os34.homedir();
20611
20616
  const child = (0, import_child_process15.spawn)("sh", ["-c", script], {
20612
20617
  env: { ...process.env, HOME: home },
@@ -20622,7 +20627,7 @@ function runAgentInstallScript(script, opts = {}) {
20622
20627
  const done = (result) => {
20623
20628
  if (settled) return;
20624
20629
  settled = true;
20625
- resolve10(result);
20630
+ resolve11(result);
20626
20631
  };
20627
20632
  const timer = setTimeout(() => {
20628
20633
  log.warn(scope, `agent install timed out (${Math.round(timeoutMs / 1e3)}s)`);
@@ -20979,6 +20984,16 @@ function isAbsolutePathTarget(target) {
20979
20984
  function selfHostedWorkspaceRoot() {
20980
20985
  return path45.join(os36.homedir(), ".codeam", "self-hosted");
20981
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
+ }
20982
20997
  function nonInteractiveGitEnv() {
20983
20998
  return {
20984
20999
  ...process.env,
@@ -21518,7 +21533,7 @@ var defaultGitToolingRunner = {
21518
21533
  }
21519
21534
  },
21520
21535
  run(cmd, args2, opts = {}) {
21521
- return new Promise((resolve10) => {
21536
+ return new Promise((resolve11) => {
21522
21537
  const child = (0, import_node_child_process21.spawn)(cmd, args2, {
21523
21538
  stdio: [opts.input !== void 0 ? "pipe" : "ignore", "ignore", "pipe"]
21524
21539
  });
@@ -21527,7 +21542,7 @@ var defaultGitToolingRunner = {
21527
21542
  const done = (code) => {
21528
21543
  if (settled) return;
21529
21544
  settled = true;
21530
- resolve10({ code, stderr });
21545
+ resolve11({ code, stderr });
21531
21546
  };
21532
21547
  child.stderr?.on("data", (b) => {
21533
21548
  stderr += b.toString();
@@ -22084,14 +22099,14 @@ function compareSemver(a, b) {
22084
22099
  return 0;
22085
22100
  }
22086
22101
  function fetchLatest() {
22087
- return new Promise((resolve10) => {
22102
+ return new Promise((resolve11) => {
22088
22103
  const req = https6.get(
22089
22104
  REGISTRY_URL,
22090
22105
  { headers: { Accept: "application/json" }, timeout: REQUEST_TIMEOUT_MS },
22091
22106
  (res) => {
22092
22107
  if (res.statusCode !== 200) {
22093
22108
  res.resume();
22094
- resolve10(null);
22109
+ resolve11(null);
22095
22110
  return;
22096
22111
  }
22097
22112
  let buf = "";
@@ -22103,21 +22118,21 @@ function fetchLatest() {
22103
22118
  try {
22104
22119
  const json = JSON.parse(buf);
22105
22120
  if (typeof json.version === "string") {
22106
- resolve10(json.version);
22121
+ resolve11(json.version);
22107
22122
  } else {
22108
- resolve10(null);
22123
+ resolve11(null);
22109
22124
  }
22110
22125
  } catch {
22111
- resolve10(null);
22126
+ resolve11(null);
22112
22127
  }
22113
22128
  });
22114
22129
  }
22115
22130
  );
22116
22131
  req.on("timeout", () => {
22117
22132
  req.destroy();
22118
- resolve10(null);
22133
+ resolve11(null);
22119
22134
  });
22120
- req.on("error", () => resolve10(null));
22135
+ req.on("error", () => resolve11(null));
22121
22136
  });
22122
22137
  }
22123
22138
  function notifyIfStale(currentVersion, latest) {
@@ -22193,7 +22208,7 @@ async function autoUpgradeBeforeCriticalCommand() {
22193
22208
  if (process.env.NODE_ENV === "test") return;
22194
22209
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
22195
22210
  if (process.env.CI) return;
22196
- const current2 = true ? "2.72.0" : null;
22211
+ const current2 = true ? "2.73.1" : null;
22197
22212
  if (!current2) return;
22198
22213
  const cache = readCache();
22199
22214
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -22210,7 +22225,7 @@ function checkForUpdates() {
22210
22225
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
22211
22226
  if (process.env.CI) return;
22212
22227
  if (!process.stdout.isTTY) return;
22213
- const current2 = true ? "2.72.0" : null;
22228
+ const current2 = true ? "2.73.1" : null;
22214
22229
  if (!current2) return;
22215
22230
  const cache = readCache();
22216
22231
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -22233,7 +22248,7 @@ var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
22233
22248
  var SELF_UPDATE_LS_TIMEOUT_MS = 15e3;
22234
22249
  var SUDO_PREFLIGHT_TIMEOUT_MS = 5e3;
22235
22250
  function currentCliVersion() {
22236
- return true ? "2.72.0" : null;
22251
+ return true ? "2.73.1" : null;
22237
22252
  }
22238
22253
  async function installedVersion(deps) {
22239
22254
  const ls = await deps.run(
@@ -22249,10 +22264,10 @@ async function installedVersion(deps) {
22249
22264
  }
22250
22265
  }
22251
22266
  function runCmd(cmd, args2, timeoutMs) {
22252
- return new Promise((resolve10) => {
22267
+ return new Promise((resolve11) => {
22253
22268
  (0, import_node_child_process23.execFile)(cmd, args2, { timeout: timeoutMs }, (err, stdout, stderr) => {
22254
22269
  const code = err && typeof err.code === "number" ? err.code : err ? null : 0;
22255
- resolve10({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
22270
+ resolve11({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
22256
22271
  });
22257
22272
  });
22258
22273
  }
@@ -22526,6 +22541,14 @@ function isFleetLimits(v) {
22526
22541
  function isFleetCreateBoxPayload(p2) {
22527
22542
  return typeof p2.boxId === "string" && isFleetContainerName(p2.containerName) && typeof p2.enrollToken === "string" && p2.enrollToken.length > 0 && typeof p2.apiOrigin === "string" && p2.apiOrigin.length > 0 && isFleetLimits(p2.limits);
22528
22543
  }
22544
+ function isFleetMigrateBoxImagePayload(p2) {
22545
+ return typeof p2.boxId === "string" && isFleetContainerName(p2.containerName) && typeof p2.apiOrigin === "string" && p2.apiOrigin.length > 0 && isFleetLimits(p2.limits) && // ⚠️ REJECT a token outright rather than ignoring it. A migrate that
22546
+ // carried one would bake a 15-minute credential into a container that may
22547
+ // not start for days — a terminal 4xx at boot, i.e. a box that never comes
22548
+ // back. If a future backend starts sending one, this must fail loudly here
22549
+ // rather than silently produce that box.
22550
+ p2.enrollToken === void 0;
22551
+ }
22529
22552
  function isFleetBoxRefPayload(p2) {
22530
22553
  if (typeof p2.boxId !== "string") return false;
22531
22554
  if (!isFleetContainerName(p2.containerName)) return false;
@@ -22557,6 +22580,9 @@ function isMissingVolumeError(stderr) {
22557
22580
  function resolveFleetBoxImage() {
22558
22581
  return process.env.CODEAM_FLEET_BOX_IMAGE || "ghcr.io/edgar-durand/codeam-box:latest";
22559
22582
  }
22583
+ function buildFleetBoxMigrateArgs(p2) {
22584
+ return buildFleetBoxRunArgs(p2).map((a) => a === "run" ? "create" : a).filter((a) => a !== "--pull=always" && a !== "-d");
22585
+ }
22560
22586
  function buildFleetBoxRunArgs(p2) {
22561
22587
  const userId = fleetUserIdFromContainerName(p2.containerName);
22562
22588
  const image = resolveFleetBoxImage();
@@ -22612,7 +22638,7 @@ var DOCKER_RUN_TIMEOUT_MS = 12e4;
22612
22638
  var DOCKER_RUN_WITH_PULL_TIMEOUT_MS = 6e5;
22613
22639
  var defaultDockerRunner = {
22614
22640
  run(args2, opts = {}) {
22615
- return new Promise((resolve10) => {
22641
+ return new Promise((resolve11) => {
22616
22642
  const child = (0, import_node_child_process25.spawn)("docker", args2, {
22617
22643
  stdio: ["ignore", "pipe", "pipe"],
22618
22644
  env: { ...process.env, ...opts.env }
@@ -22631,7 +22657,7 @@ var defaultDockerRunner = {
22631
22657
  if (settled) return;
22632
22658
  settled = true;
22633
22659
  clearTimeout(timer);
22634
- resolve10({ code, stderr: stderrBuf, stdout: stdoutBuf });
22660
+ resolve11({ code, stderr: stderrBuf, stdout: stdoutBuf });
22635
22661
  };
22636
22662
  child.stdout?.on("data", (b) => {
22637
22663
  stdoutBuf += b.toString();
@@ -22956,6 +22982,14 @@ var HostAgentSupervisor = class {
22956
22982
  await this.fleetCreateBox(cmd.payload);
22957
22983
  return;
22958
22984
  }
22985
+ if (cmd.type === "fleet_migrate_box_image") {
22986
+ if (!isFleetMigrateBoxImagePayload(cmd.payload)) {
22987
+ log.warn("host-agent", `ignoring malformed fleet_migrate_box_image id=${cmd.id}`);
22988
+ return;
22989
+ }
22990
+ await this.fleetMigrateBoxImage(cmd.payload);
22991
+ return;
22992
+ }
22959
22993
  if (cmd.type === "fleet_start_box") {
22960
22994
  if (!isFleetBoxRefPayload(cmd.payload)) {
22961
22995
  log.warn("host-agent", `ignoring malformed fleet_start_box id=${cmd.id}`);
@@ -23126,6 +23160,90 @@ var HostAgentSupervisor = class {
23126
23160
  }
23127
23161
  /** `fleet_start_box` — wake a sleeping box (`docker start`). Idempotent: a
23128
23162
  * container the host already removed is treated as success. */
23163
+ /**
23164
+ * `fleet_migrate_box_image` — re-point a SLEEPING box at the current
23165
+ * `:latest` without waking it, so the version it was pinned to becomes
23166
+ * reclaimable by the (already automated) dangling-image prune.
23167
+ *
23168
+ * WHY THIS IS NEEDED AT ALL. Boxes are created with `--pull=always` on
23169
+ * purpose, so each stays pinned to the image it was born on, and Docker
23170
+ * refuses to delete an image any container references INCLUDING stopped
23171
+ * ones — which is precisely what stops the prune from destroying a sleeping
23172
+ * user's box. So every image release strands ~7.7 GB per lagging box until it
23173
+ * wakes or is reaped on day 7 (fleet-1, 2026-09-02: 9 boxes across 4
23174
+ * versions, ~31 GB held).
23175
+ *
23176
+ * ⚠️ THE HOST RE-CHECKS THAT THE BOX IS STOPPED, even though the backend only
23177
+ * selects `status: 'SLEEPING'`. The DB's view can lag the host by a sweep —
23178
+ * a box that woke seconds ago is still SLEEPING in the row — and re-creating
23179
+ * a RUNNING container kills a live agent mid-turn. The authority on whether a
23180
+ * container is running is the daemon, so we ask it here and refuse rather
23181
+ * than trust the payload.
23182
+ *
23183
+ * ⚠️ `docker create`, and NO enroll token. `run` would start the container,
23184
+ * so migrating the sleeping set in a batch would wake all of them (9 ×
23185
+ * 1536 MB on a 16 GB host) only for the sleep sweep to re-sleep them 30
23186
+ * minutes later. And a token would be a 15-minute credential baked into a
23187
+ * container that may not start for days — a terminal 4xx at boot, i.e. a box
23188
+ * that never comes back. The sealed identity is in the named volume, which
23189
+ * `rm` WITHOUT `-v` preserves.
23190
+ *
23191
+ * Idempotent and best-effort: a box already on `:latest` is skipped, a
23192
+ * missing container is success (a concurrent reap), and nothing here may
23193
+ * throw into the relay — this is housekeeping.
23194
+ */
23195
+ async fleetMigrateBoxImage(payload) {
23196
+ const { containerName } = payload;
23197
+ const state = await this.docker.run([
23198
+ "inspect",
23199
+ "--format",
23200
+ "{{.State.Running}}",
23201
+ containerName
23202
+ ]);
23203
+ if (state.code !== 0) {
23204
+ if (isMissingContainerError(state.stderr)) return;
23205
+ log.warn(
23206
+ "host-agent",
23207
+ `fleet_migrate_box_image: inspect of ${containerName} failed (code=${state.code}) \u2014 skipping`
23208
+ );
23209
+ return;
23210
+ }
23211
+ if (state.stdout.trim() === "true") {
23212
+ log.info(
23213
+ "host-agent",
23214
+ `fleet_migrate_box_image: ${containerName} is RUNNING \u2014 skipping (never touch a live box)`
23215
+ );
23216
+ return;
23217
+ }
23218
+ if (!await this.fleetBoxImageStale(containerName)) {
23219
+ log.info("host-agent", `fleet_migrate_box_image: ${containerName} already current`);
23220
+ return;
23221
+ }
23222
+ const rm = await this.docker.run(["rm", "-f", containerName], {
23223
+ timeoutMs: DOCKER_RUN_TIMEOUT_MS
23224
+ });
23225
+ if (rm.code !== 0 && !isMissingContainerError(rm.stderr)) {
23226
+ log.warn(
23227
+ "host-agent",
23228
+ `fleet_migrate_box_image: rm of ${containerName} failed (code=${rm.code}): ${rm.stderr.trim().slice(-200)} \u2014 NOT creating a replacement`
23229
+ );
23230
+ return;
23231
+ }
23232
+ const res = await this.docker.run(buildFleetBoxMigrateArgs(payload), {
23233
+ timeoutMs: DOCKER_RUN_TIMEOUT_MS
23234
+ });
23235
+ if (res.code !== 0) {
23236
+ log.warn(
23237
+ "host-agent",
23238
+ `fleet_migrate_box_image: create of ${containerName} failed (code=${res.code}): ${res.stderr.trim().slice(-200)}`
23239
+ );
23240
+ return;
23241
+ }
23242
+ log.info(
23243
+ "host-agent",
23244
+ `fleet_migrate_box_image: ${containerName} re-pointed at :latest (still stopped)`
23245
+ );
23246
+ }
23129
23247
  async fleetStartBox(payload) {
23130
23248
  const { containerName } = payload;
23131
23249
  if (fleetRefCanRecreate(payload) && await this.fleetBoxImageStale(containerName)) {
@@ -23555,13 +23673,14 @@ var HostAgentSupervisor = class {
23555
23673
  { ...readHeadroomChildEnv(), ...readHouseProxyChildEnv() },
23556
23674
  cwd
23557
23675
  );
23676
+ const deployId = deployIdFromWorkspace(session.cwd) ?? session.id;
23558
23677
  const child = {
23559
- deployId: session.id,
23678
+ deployId,
23560
23679
  proc,
23561
23680
  agent: session.agent,
23562
23681
  startedAt: Date.now()
23563
23682
  };
23564
- this.children.set(session.id, child);
23683
+ this.children.set(deployId, child);
23565
23684
  let tail = "";
23566
23685
  const appendTail = (buf) => {
23567
23686
  tail = (tail + buf.toString("utf8")).slice(-2e3);
@@ -23569,7 +23688,7 @@ var HostAgentSupervisor = class {
23569
23688
  proc.stdout?.on("data", appendTail);
23570
23689
  proc.stderr?.on("data", appendTail);
23571
23690
  proc.once("exit", (code) => {
23572
- 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);
23573
23692
  if (typeof code === "number" && code !== 0) {
23574
23693
  this.onResumeChildExit(session, code, tail.trim().slice(-300));
23575
23694
  }
@@ -24637,12 +24756,12 @@ async function isExecutableBinary(p2) {
24637
24756
  }
24638
24757
  }
24639
24758
  function extractTgz(tgzPath, destDir) {
24640
- return new Promise((resolve10, reject) => {
24759
+ return new Promise((resolve11, reject) => {
24641
24760
  const child = (0, import_child_process18.spawn)("tar", ["-xzf", tgzPath, "-C", destDir], { stdio: "ignore" });
24642
24761
  child.on("error", (err) => reject(err));
24643
24762
  child.on(
24644
24763
  "exit",
24645
- (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`))
24646
24765
  );
24647
24766
  });
24648
24767
  }
@@ -24891,12 +25010,12 @@ function describeDetectionFailure(raw) {
24891
25010
  // src/services/preview/port-ready.ts
24892
25011
  var net2 = __toESM(require("net"));
24893
25012
  function isPortListening(port, host2 = "127.0.0.1") {
24894
- return new Promise((resolve10) => {
25013
+ return new Promise((resolve11) => {
24895
25014
  const socket = new net2.Socket();
24896
25015
  const done = (result) => {
24897
25016
  socket.removeAllListeners();
24898
25017
  socket.destroy();
24899
- resolve10(result);
25018
+ resolve11(result);
24900
25019
  };
24901
25020
  socket.setTimeout(1e3);
24902
25021
  socket.once("connect", () => done(true));
@@ -24934,14 +25053,14 @@ const { PGLiteSocketServer } = require('@electric-sql/pglite-socket');
24934
25053
  })().catch((e) => { console.error(String(e && e.message)); process.exit(1); });
24935
25054
  `;
24936
25055
  function isListening(port) {
24937
- return new Promise((resolve10) => {
25056
+ return new Promise((resolve11) => {
24938
25057
  const s = net3.connect({ host: "127.0.0.1", port }, () => {
24939
25058
  s.destroy();
24940
- resolve10(true);
24941
- }).on("error", () => resolve10(false));
25059
+ resolve11(true);
25060
+ }).on("error", () => resolve11(false));
24942
25061
  s.setTimeout(1e3, () => {
24943
25062
  s.destroy();
24944
- resolve10(false);
25063
+ resolve11(false);
24945
25064
  });
24946
25065
  });
24947
25066
  }
@@ -24989,7 +25108,7 @@ function stopChild(child) {
24989
25108
  // src/services/preview/run-setup.ts
24990
25109
  var import_child_process21 = require("child_process");
24991
25110
  function runSetupCommand(cmd, args2, cwd, env, opts) {
24992
- return new Promise((resolve10) => {
25111
+ return new Promise((resolve11) => {
24993
25112
  const child = (0, import_child_process21.spawn)(cmd, args2, {
24994
25113
  cwd,
24995
25114
  env: { ...process.env, ...env ?? {} },
@@ -25009,20 +25128,20 @@ function runSetupCommand(cmd, args2, cwd, env, opts) {
25009
25128
  settled = true;
25010
25129
  log.info("preview", `${tag}: timed out after ${opts.timeoutMs}ms \u2014 killing`);
25011
25130
  killQuiet(child);
25012
- resolve10({ status: "timeout", code: null });
25131
+ resolve11({ status: "timeout", code: null });
25013
25132
  }, opts.timeoutMs);
25014
25133
  child.once("exit", (code) => {
25015
25134
  if (settled) return;
25016
25135
  settled = true;
25017
25136
  clearTimeout(timer);
25018
- if (code === 0) resolve10({ status: "ok", code: 0 });
25019
- else resolve10({ status: "failed", code });
25137
+ if (code === 0) resolve11({ status: "ok", code: 0 });
25138
+ else resolve11({ status: "failed", code });
25020
25139
  });
25021
25140
  child.once("error", () => {
25022
25141
  if (settled) return;
25023
25142
  settled = true;
25024
25143
  clearTimeout(timer);
25025
- resolve10({ status: "failed", code: null });
25144
+ resolve11({ status: "failed", code: null });
25026
25145
  });
25027
25146
  });
25028
25147
  }
@@ -25360,23 +25479,23 @@ async function awaitTunnelRegistered(candidate, hostname3, deadlineMs) {
25360
25479
  ac.signal.addEventListener("abort", detach, { once: true });
25361
25480
  };
25362
25481
  try {
25363
- return await new Promise((resolve10) => {
25482
+ return await new Promise((resolve11) => {
25364
25483
  const onChunk = (chunk) => {
25365
25484
  const s = chunk.toString();
25366
25485
  if (!url2) url2 = parseCloudflaredUrl(s);
25367
25486
  if (TUNNEL_REGISTERED_RE.test(s)) registered = true;
25368
25487
  const trimmed = s.replace(/\n+$/g, "");
25369
25488
  if (trimmed.length > 0) log.info("preview", `cloudflared: ${trimmed}`);
25370
- if (url2 && registered) resolve10({ kind: "registered", url: url2 });
25489
+ if (url2 && registered) resolve11({ kind: "registered", url: url2 });
25371
25490
  };
25372
25491
  const onExit = (code) => {
25373
- resolve10({ kind: "exited", sawUrl: url2 != null, code });
25492
+ resolve11({ kind: "exited", sawUrl: url2 != null, code });
25374
25493
  };
25375
25494
  const { stdout, stderr } = candidate;
25376
25495
  if (stdout) scoped(() => stdout.on("data", onChunk), () => stdout.off("data", onChunk));
25377
25496
  if (stderr) scoped(() => stderr.on("data", onChunk), () => stderr.off("data", onChunk));
25378
25497
  scoped(() => candidate.on("exit", onExit), () => candidate.off("exit", onExit));
25379
- timer = setTimeout(() => resolve10({ kind: "timeout", sawUrl: url2 != null }), deadlineMs);
25498
+ timer = setTimeout(() => resolve11({ kind: "timeout", sawUrl: url2 != null }), deadlineMs);
25380
25499
  });
25381
25500
  } finally {
25382
25501
  ac.abort();
@@ -25399,7 +25518,7 @@ function verdictFor(res) {
25399
25518
  }
25400
25519
  return { adopt: true };
25401
25520
  }
25402
- var probePort = (port) => new Promise((resolve10) => {
25521
+ var probePort = (port) => new Promise((resolve11) => {
25403
25522
  const req = http6.get(
25404
25523
  { host: "127.0.0.1", port, path: "/", timeout: PROBE_TIMEOUT_MS },
25405
25524
  (res) => {
@@ -25410,16 +25529,16 @@ var probePort = (port) => new Promise((resolve10) => {
25410
25529
  });
25411
25530
  res.on(
25412
25531
  "end",
25413
- () => resolve10({ contentType: res.headers["content-type"], bodyStart: body })
25532
+ () => resolve11({ contentType: res.headers["content-type"], bodyStart: body })
25414
25533
  );
25415
- res.on("error", () => resolve10(null));
25534
+ res.on("error", () => resolve11(null));
25416
25535
  }
25417
25536
  );
25418
25537
  req.on("timeout", () => {
25419
25538
  req.destroy();
25420
- resolve10(null);
25539
+ resolve11(null);
25421
25540
  });
25422
- req.on("error", () => resolve10(null));
25541
+ req.on("error", () => resolve11(null));
25423
25542
  });
25424
25543
  async function canAdoptPort(port, probe = probePort) {
25425
25544
  try {
@@ -25753,18 +25872,18 @@ async function startInspectorProxy(opts) {
25753
25872
  clientSocket.on("error", drop);
25754
25873
  clientSocket.on("close", drop);
25755
25874
  });
25756
- await new Promise((resolve10, reject) => {
25875
+ await new Promise((resolve11, reject) => {
25757
25876
  server.once("error", reject);
25758
- server.listen(0, "127.0.0.1", () => resolve10());
25877
+ server.listen(0, "127.0.0.1", () => resolve11());
25759
25878
  });
25760
25879
  const port = server.address().port;
25761
25880
  return {
25762
25881
  port,
25763
- close: () => new Promise((resolve10) => {
25882
+ close: () => new Promise((resolve11) => {
25764
25883
  for (const socket of upgraded) socket.destroy();
25765
25884
  upgraded.clear();
25766
25885
  server.closeAllConnections?.();
25767
- server.close(() => resolve10());
25886
+ server.close(() => resolve11());
25768
25887
  })
25769
25888
  };
25770
25889
  }
@@ -26643,12 +26762,12 @@ var _spawnSeam = {
26643
26762
  run: _defaultSpawn
26644
26763
  };
26645
26764
  function _defaultSpawn(binaryPath, args2, opts) {
26646
- return new Promise((resolve10) => {
26765
+ return new Promise((resolve11) => {
26647
26766
  let proc;
26648
26767
  try {
26649
26768
  proc = (0, import_child_process24.spawn)(binaryPath, args2, { cwd: opts.cwd, env: opts.env });
26650
26769
  } catch (err) {
26651
- resolve10({ code: -1, stdout: "", stderr: err.message });
26770
+ resolve11({ code: -1, stdout: "", stderr: err.message });
26652
26771
  return;
26653
26772
  }
26654
26773
  let stdout = "";
@@ -26659,8 +26778,8 @@ function _defaultSpawn(binaryPath, args2, opts) {
26659
26778
  proc.stderr?.on("data", (c2) => {
26660
26779
  stderr += c2.toString();
26661
26780
  });
26662
- proc.on("error", (err) => resolve10({ code: -1, stdout, stderr: err.message }));
26663
- 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 }));
26664
26783
  });
26665
26784
  }
26666
26785
  var _adapterSeam = {
@@ -26837,22 +26956,22 @@ var _installSpawnSeam = {
26837
26956
  run: _defaultInstallSpawn
26838
26957
  };
26839
26958
  function _defaultInstallSpawn(strategy) {
26840
- return new Promise((resolve10) => {
26959
+ return new Promise((resolve11) => {
26841
26960
  let proc;
26842
26961
  try {
26843
26962
  proc = (0, import_child_process25.spawn)(strategy.command, strategy.args, { env: process.env });
26844
26963
  } catch (err) {
26845
- resolve10({ ok: false, code: -1, stderr: err.message });
26964
+ resolve11({ ok: false, code: -1, stderr: err.message });
26846
26965
  return;
26847
26966
  }
26848
26967
  let stderr = "";
26849
26968
  proc.stderr?.on("data", (c2) => {
26850
26969
  stderr += c2.toString();
26851
26970
  });
26852
- 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 }));
26853
26972
  proc.on(
26854
26973
  "close",
26855
- (code) => resolve10({ ok: code === 0, code: code ?? -1, stderr })
26974
+ (code) => resolve11({ ok: code === 0, code: code ?? -1, stderr })
26856
26975
  );
26857
26976
  });
26858
26977
  }
@@ -27021,14 +27140,14 @@ var _doltInstallSpawnSeam = {
27021
27140
  };
27022
27141
  var DOLT_INSTALL_TIMEOUT_MS = 12e4;
27023
27142
  function _defaultDoltInstallSpawn(strategy) {
27024
- return new Promise((resolve10) => {
27143
+ return new Promise((resolve11) => {
27025
27144
  let settled = false;
27026
27145
  let timer;
27027
27146
  const finish = (r) => {
27028
27147
  if (settled) return;
27029
27148
  settled = true;
27030
27149
  if (timer) clearTimeout(timer);
27031
- resolve10(r);
27150
+ resolve11(r);
27032
27151
  };
27033
27152
  let proc;
27034
27153
  try {
@@ -28883,16 +29002,16 @@ async function runNpmInstallLatest() {
28883
29002
  const invocation = buildNpmInstallInvocation({ sudo: useSudo });
28884
29003
  const useShell = process.platform === "win32";
28885
29004
  const command2 = useShell && invocation.command.includes(" ") ? `"${invocation.command}"` : invocation.command;
28886
- const result = await new Promise((resolve10) => {
29005
+ const result = await new Promise((resolve11) => {
28887
29006
  (0, import_child_process28.execFile)(
28888
29007
  command2,
28889
29008
  invocation.args,
28890
29009
  { timeout: CLI_UPDATE_INSTALL_TIMEOUT_MS, shell: useShell },
28891
29010
  (err, _stdout, stderr) => {
28892
29011
  if (!err) {
28893
- resolve10({ ok: true });
29012
+ resolve11({ ok: true });
28894
29013
  } else {
28895
- resolve10({ ok: false, error: (stderr || err.message).slice(0, 300) });
29014
+ resolve11({ ok: false, error: (stderr || err.message).slice(0, 300) });
28896
29015
  }
28897
29016
  }
28898
29017
  );
@@ -29582,7 +29701,7 @@ function buildKeepAlive(ctx) {
29582
29701
  let timer = null;
29583
29702
  async function setIdleTimeout(minutes) {
29584
29703
  if (!ctx.inCodespace || !ctx.codespaceName) return;
29585
- await new Promise((resolve10) => {
29704
+ await new Promise((resolve11) => {
29586
29705
  const proc = (0, import_child_process29.spawn)(
29587
29706
  "gh",
29588
29707
  [
@@ -29596,8 +29715,8 @@ function buildKeepAlive(ctx) {
29596
29715
  { stdio: "ignore", detached: true }
29597
29716
  );
29598
29717
  proc.unref();
29599
- proc.on("exit", () => resolve10());
29600
- proc.on("error", () => resolve10());
29718
+ proc.on("exit", () => resolve11());
29719
+ proc.on("error", () => resolve11());
29601
29720
  });
29602
29721
  }
29603
29722
  return {
@@ -30089,10 +30208,10 @@ function wrapWithHeadroom(launch, opts) {
30089
30208
  var _present;
30090
30209
  function headroomPresent() {
30091
30210
  if (_present !== void 0) return Promise.resolve(_present);
30092
- return new Promise((resolve10) => {
30211
+ return new Promise((resolve11) => {
30093
30212
  (0, import_node_child_process26.execFile)("headroom", ["--version"], (err) => {
30094
30213
  _present = !err;
30095
- resolve10(_present);
30214
+ resolve11(_present);
30096
30215
  });
30097
30216
  });
30098
30217
  }
@@ -30461,10 +30580,10 @@ function augmentKimiPath() {
30461
30580
  }
30462
30581
  var augmentPath2 = augmentKimiPath;
30463
30582
  async function runInstaller2() {
30464
- return new Promise((resolve10) => {
30583
+ return new Promise((resolve11) => {
30465
30584
  const proc = (0, import_node_child_process27.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL2} | bash`], { stdio: "inherit" });
30466
- proc.on("close", (code) => resolve10(code === 0));
30467
- proc.on("error", () => resolve10(false));
30585
+ proc.on("close", (code) => resolve11(code === 0));
30586
+ proc.on("error", () => resolve11(false));
30468
30587
  });
30469
30588
  }
30470
30589
  async function ensureKimiInstalled() {
@@ -30514,10 +30633,10 @@ function augmentOpencodePath() {
30514
30633
  }
30515
30634
  var augmentPath3 = augmentOpencodePath;
30516
30635
  async function runInstaller3() {
30517
- return new Promise((resolve10) => {
30636
+ return new Promise((resolve11) => {
30518
30637
  const proc = (0, import_node_child_process28.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL3} | bash`], { stdio: "inherit" });
30519
- proc.on("close", (code) => resolve10(code === 0));
30520
- proc.on("error", () => resolve10(false));
30638
+ proc.on("close", (code) => resolve11(code === 0));
30639
+ proc.on("error", () => resolve11(false));
30521
30640
  });
30522
30641
  }
30523
30642
  async function ensureOpencodeInstalled() {
@@ -30725,11 +30844,11 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
30725
30844
  const timeoutMs = opts.timeoutMs ?? DEFAULT_ADAPTER_RETRY_TIMEOUT_MS;
30726
30845
  const pollMs = opts.pollMs ?? DEFAULT_ADAPTER_RETRY_POLL_MS;
30727
30846
  const now = opts.now ?? Date.now;
30728
- const sleep5 = opts.sleep ?? ((ms) => new Promise((resolve11) => setTimeout(resolve11, ms)));
30729
- const resolve10 = opts.resolve ?? getAcpAdapter;
30847
+ const sleep5 = opts.sleep ?? ((ms) => new Promise((resolve12) => setTimeout(resolve12, ms)));
30848
+ const resolve11 = opts.resolve ?? getAcpAdapter;
30730
30849
  const attempt = () => {
30731
30850
  try {
30732
- return resolve10(agent);
30851
+ return resolve11(agent);
30733
30852
  } catch {
30734
30853
  return null;
30735
30854
  }
@@ -30836,7 +30955,7 @@ function parseJsonl(filePath) {
30836
30955
  return messages;
30837
30956
  }
30838
30957
  function post(endpoint, body, pluginAuthToken) {
30839
- return new Promise((resolve10) => {
30958
+ return new Promise((resolve11) => {
30840
30959
  const payload = JSON.stringify(body);
30841
30960
  const u2 = new URL(`${API_BASE8}${endpoint}`);
30842
30961
  const transport = u2.protocol === "https:" ? https7 : http8;
@@ -30861,17 +30980,17 @@ function post(endpoint, body, pluginAuthToken) {
30861
30980
  res.resume();
30862
30981
  const ok = res.statusCode !== void 0 && res.statusCode >= 200 && res.statusCode < 300;
30863
30982
  if (!ok) log.warn("history:post", `${endpoint} \u2192 HTTP ${res.statusCode}`);
30864
- resolve10(ok);
30983
+ resolve11(ok);
30865
30984
  }
30866
30985
  );
30867
30986
  req.on("error", (err) => {
30868
30987
  log.warn("history:post", `${endpoint} network error`, err);
30869
- resolve10(false);
30988
+ resolve11(false);
30870
30989
  });
30871
30990
  req.on("timeout", () => {
30872
30991
  log.warn("history:post", `${endpoint} timeout after 15s`);
30873
30992
  req.destroy();
30874
- resolve10(false);
30993
+ resolve11(false);
30875
30994
  });
30876
30995
  req.write(payload);
30877
30996
  req.end();
@@ -33421,12 +33540,12 @@ var Connection = class {
33421
33540
  const id = this.nextRequestId++;
33422
33541
  let cancel = () => {
33423
33542
  };
33424
- const responsePromise = new Promise((resolve10, reject) => {
33543
+ const responsePromise = new Promise((resolve11, reject) => {
33425
33544
  const pendingResponse = {
33426
33545
  resolve: (response) => {
33427
33546
  try {
33428
33547
  const value = mapResponse ? mapResponse(response) : response;
33429
- resolve10(value);
33548
+ resolve11(value);
33430
33549
  } catch (error) {
33431
33550
  reject(error);
33432
33551
  }
@@ -33504,8 +33623,8 @@ var Connection = class {
33504
33623
  initialize(stream, handlers2) {
33505
33624
  this.stream = stream;
33506
33625
  this.staticHandlers = handlers2;
33507
- this.closedPromise = new Promise((resolve10) => {
33508
- this.abortController.signal.addEventListener("abort", () => resolve10());
33626
+ this.closedPromise = new Promise((resolve11) => {
33627
+ this.abortController.signal.addEventListener("abort", () => resolve11());
33509
33628
  });
33510
33629
  void this.receive();
33511
33630
  }
@@ -34293,8 +34412,8 @@ var AsyncQueue = class {
34293
34412
  if (this.failed) {
34294
34413
  return Promise.reject(this.failure);
34295
34414
  }
34296
- return new Promise((resolve10, reject) => {
34297
- this.waiters.push({ resolve: resolve10, reject });
34415
+ return new Promise((resolve11, reject) => {
34416
+ this.waiters.push({ resolve: resolve11, reject });
34298
34417
  });
34299
34418
  }
34300
34419
  };
@@ -35928,7 +36047,7 @@ var AcpClient = class {
35928
36047
  this.pendingToolCalls.clear();
35929
36048
  try {
35930
36049
  const result = await Promise.race([send, idle.promise]);
35931
- await new Promise((resolve10) => setImmediate(resolve10));
36050
+ await new Promise((resolve11) => setImmediate(resolve11));
35932
36051
  log.info(
35933
36052
  "acpClient",
35934
36053
  `prompt \u2190 ok stopReason=${result.stopReason ?? "?"} elapsedMs=${Date.now() - t0}`
@@ -36327,14 +36446,14 @@ var AcpClient = class {
36327
36446
  this.sessionId = null;
36328
36447
  try {
36329
36448
  child.kill("SIGTERM");
36330
- const grace = new Promise((resolve10) => {
36449
+ const grace = new Promise((resolve11) => {
36331
36450
  const t2 = setTimeout(() => {
36332
36451
  killQuiet(child, "SIGKILL");
36333
- resolve10();
36452
+ resolve11();
36334
36453
  }, 2e3);
36335
36454
  child.once("exit", () => {
36336
36455
  clearTimeout(t2);
36337
- resolve10();
36456
+ resolve11();
36338
36457
  });
36339
36458
  });
36340
36459
  await grace;
@@ -36797,7 +36916,7 @@ var _transport4 = {
36797
36916
  get: _get
36798
36917
  };
36799
36918
  function _post3(url2, headers, payload) {
36800
- return new Promise((resolve10, reject) => {
36919
+ return new Promise((resolve11, reject) => {
36801
36920
  let settled = false;
36802
36921
  const u2 = new URL(url2);
36803
36922
  const lib = u2.protocol === "https:" ? https8 : http9;
@@ -36822,7 +36941,7 @@ function _post3(url2, headers, payload) {
36822
36941
  res.on("end", () => {
36823
36942
  if (settled) return;
36824
36943
  settled = true;
36825
- resolve10({ statusCode: res.statusCode ?? 0, body });
36944
+ resolve11({ statusCode: res.statusCode ?? 0, body });
36826
36945
  });
36827
36946
  }
36828
36947
  );
@@ -36839,7 +36958,7 @@ function _post3(url2, headers, payload) {
36839
36958
  });
36840
36959
  }
36841
36960
  function _get(url2, headers) {
36842
- return new Promise((resolve10, reject) => {
36961
+ return new Promise((resolve11, reject) => {
36843
36962
  let settled = false;
36844
36963
  const u2 = new URL(url2);
36845
36964
  const lib = u2.protocol === "https:" ? https8 : http9;
@@ -36863,7 +36982,7 @@ function _get(url2, headers) {
36863
36982
  res.on("end", () => {
36864
36983
  if (settled) return;
36865
36984
  settled = true;
36866
- resolve10({ statusCode: res.statusCode ?? 0, body });
36985
+ resolve11({ statusCode: res.statusCode ?? 0, body });
36867
36986
  });
36868
36987
  }
36869
36988
  );
@@ -38036,12 +38155,12 @@ function runGit3(cwd, args2) {
38036
38155
  return _runGitImpl2.run(cwd, args2);
38037
38156
  }
38038
38157
  function defaultRunGit(cwd, args2) {
38039
- return new Promise((resolve10) => {
38158
+ return new Promise((resolve11) => {
38040
38159
  let proc;
38041
38160
  try {
38042
38161
  proc = (0, import_child_process31.spawn)("git", args2, { cwd, env: process.env });
38043
38162
  } catch {
38044
- resolve10(null);
38163
+ resolve11(null);
38045
38164
  return;
38046
38165
  }
38047
38166
  let stdout = "";
@@ -38052,16 +38171,16 @@ function defaultRunGit(cwd, args2) {
38052
38171
  proc.stderr?.on("data", (c2) => {
38053
38172
  stderr += c2.toString();
38054
38173
  });
38055
- proc.on("error", () => resolve10(null));
38174
+ proc.on("error", () => resolve11(null));
38056
38175
  proc.on("close", (code) => {
38057
38176
  if (code === 0) {
38058
- resolve10(stdout);
38177
+ resolve11(stdout);
38059
38178
  } else {
38060
38179
  log.trace(
38061
38180
  "turnFiles",
38062
38181
  `git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`
38063
38182
  );
38064
- resolve10(null);
38183
+ resolve11(null);
38065
38184
  }
38066
38185
  });
38067
38186
  });
@@ -38470,25 +38589,25 @@ function baselineKey(entry) {
38470
38589
 
38471
38590
  // src/agents/acp/withTimeout.ts
38472
38591
  function withTimeout(p2, ms) {
38473
- return new Promise((resolve10) => {
38592
+ return new Promise((resolve11) => {
38474
38593
  let settled = false;
38475
38594
  const timer = setTimeout(() => {
38476
38595
  if (settled) return;
38477
38596
  settled = true;
38478
- resolve10(void 0);
38597
+ resolve11(void 0);
38479
38598
  }, ms);
38480
38599
  p2.then(
38481
38600
  (v) => {
38482
38601
  if (settled) return;
38483
38602
  settled = true;
38484
38603
  clearTimeout(timer);
38485
- resolve10(v);
38604
+ resolve11(v);
38486
38605
  },
38487
38606
  () => {
38488
38607
  if (settled) return;
38489
38608
  settled = true;
38490
38609
  clearTimeout(timer);
38491
- resolve10(void 0);
38610
+ resolve11(void 0);
38492
38611
  }
38493
38612
  );
38494
38613
  });
@@ -38783,7 +38902,7 @@ async function postBudgetReached(opts, fetchImpl = fetch) {
38783
38902
  var import_node_child_process30 = require("child_process");
38784
38903
  var fs73 = __toESM(require("fs"));
38785
38904
  var path81 = __toESM(require("path"));
38786
- var defaultCommandRunner = (file, args2, cwd, timeoutMs) => new Promise((resolve10) => {
38905
+ var defaultCommandRunner = (file, args2, cwd, timeoutMs) => new Promise((resolve11) => {
38787
38906
  (0, import_node_child_process30.execFile)(
38788
38907
  file,
38789
38908
  args2,
@@ -38794,7 +38913,7 @@ var defaultCommandRunner = (file, args2, cwd, timeoutMs) => new Promise((resolve
38794
38913
  const rawCode = err.code;
38795
38914
  code = typeof rawCode === "number" ? rawCode : 1;
38796
38915
  }
38797
- resolve10({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
38916
+ resolve11({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
38798
38917
  }
38799
38918
  );
38800
38919
  });
@@ -40604,15 +40723,15 @@ async function prewarmNewMcpEntries(manifest, previousIds) {
40604
40723
  );
40605
40724
  await Promise.all(
40606
40725
  fresh.map(
40607
- (e) => new Promise((resolve10) => {
40726
+ (e) => new Promise((resolve11) => {
40608
40727
  const mcp = e.delivery.mcp;
40609
40728
  const child = (0, import_node_child_process31.execFile)(
40610
40729
  mcp.command,
40611
40730
  [...mcp.args, "--help"],
40612
40731
  { timeout: 9e4 },
40613
- () => resolve10()
40732
+ () => resolve11()
40614
40733
  );
40615
- child.on("error", () => resolve10());
40734
+ child.on("error", () => resolve11());
40616
40735
  })
40617
40736
  )
40618
40737
  );
@@ -40837,7 +40956,7 @@ var StreamingState = class {
40837
40956
  * default-reject. Caller is the SDK's `onRequestPermission`.
40838
40957
  */
40839
40958
  registerPermission(args2) {
40840
- return new Promise((resolve10) => {
40959
+ return new Promise((resolve11) => {
40841
40960
  const timeoutTimer = setTimeout(() => {
40842
40961
  if (this.pending?.kind === "permission" && this.pending.questionId === args2.questionId) {
40843
40962
  log.warn(
@@ -40845,7 +40964,7 @@ var StreamingState = class {
40845
40964
  `permission ${args2.questionId.slice(0, 8)} TTL expired \u2014 auto-cancel`
40846
40965
  );
40847
40966
  this.pending = null;
40848
- resolve10({ outcome: { outcome: "cancelled" } });
40967
+ resolve11({ outcome: { outcome: "cancelled" } });
40849
40968
  }
40850
40969
  }, PERMISSION_TIMEOUT_MS);
40851
40970
  this.pending = {
@@ -40853,7 +40972,7 @@ var StreamingState = class {
40853
40972
  questionId: args2.questionId,
40854
40973
  labels: args2.labels,
40855
40974
  optionIdByLabel: args2.optionIdByLabel,
40856
- resolve: resolve10,
40975
+ resolve: resolve11,
40857
40976
  timeoutTimer
40858
40977
  };
40859
40978
  });
@@ -40885,14 +41004,14 @@ var StreamingState = class {
40885
41004
  const label = this.pending.labels[index];
40886
41005
  const optionId = label ? this.pending.optionIdByLabel[label] : void 0;
40887
41006
  clearTimeout(this.pending.timeoutTimer);
40888
- const resolve10 = this.pending.resolve;
41007
+ const resolve11 = this.pending.resolve;
40889
41008
  this.pending = null;
40890
41009
  if (!optionId) {
40891
41010
  log.warn("acpRunner", `select_option index=${index} out of bounds \u2014 cancel`);
40892
- resolve10({ outcome: { outcome: "cancelled" } });
41011
+ resolve11({ outcome: { outcome: "cancelled" } });
40893
41012
  return { kind: "resolved" };
40894
41013
  }
40895
- resolve10({ outcome: { outcome: "selected", optionId } });
41014
+ resolve11({ outcome: { outcome: "selected", optionId } });
40896
41015
  return { kind: "resolved" };
40897
41016
  }
40898
41017
  const text = this.pending.options[index];
@@ -43336,10 +43455,10 @@ var NativeTuiDriver = class _NativeTuiDriver {
43336
43455
  this.lastOutput = this.now();
43337
43456
  }
43338
43457
  whenSafeToYield() {
43339
- return new Promise((resolve10) => {
43458
+ return new Promise((resolve11) => {
43340
43459
  const tick = () => {
43341
43460
  const quietFor = this.now() - this.lastOutput;
43342
- if (quietFor >= this.idleMs) resolve10();
43461
+ if (quietFor >= this.idleMs) resolve11();
43343
43462
  else setTimeout(tick, this.idleMs - quietFor);
43344
43463
  };
43345
43464
  tick();
@@ -43405,10 +43524,10 @@ var AcpDriver = class {
43405
43524
  * one ever is, assume resumable so behaviour is unchanged.
43406
43525
  */
43407
43526
  hasTranscript(conversationId) {
43408
- const resolve10 = this.deps.runtime.resolveHistoryFile;
43409
- if (typeof resolve10 !== "function") return true;
43527
+ const resolve11 = this.deps.runtime.resolveHistoryFile;
43528
+ if (typeof resolve11 !== "function") return true;
43410
43529
  try {
43411
- return resolve10.call(this.deps.runtime, this.deps.opts.cwd, conversationId) !== null;
43530
+ return resolve11.call(this.deps.runtime, this.deps.opts.cwd, conversationId) !== null;
43412
43531
  } catch {
43413
43532
  return true;
43414
43533
  }
@@ -43498,11 +43617,11 @@ var AcpDriver = class {
43498
43617
  this.turnActive = false;
43499
43618
  const waiters = this.waiters;
43500
43619
  this.waiters = [];
43501
- waiters.forEach((resolve10) => resolve10());
43620
+ waiters.forEach((resolve11) => resolve11());
43502
43621
  }
43503
43622
  whenSafeToYield() {
43504
43623
  if (!this.turnActive) return Promise.resolve();
43505
- return new Promise((resolve10) => this.waiters.push(resolve10));
43624
+ return new Promise((resolve11) => this.waiters.push(resolve11));
43506
43625
  }
43507
43626
  };
43508
43627
 
@@ -44080,8 +44199,8 @@ async function start(requestedAgent, presetSession) {
44080
44199
  let gateTimer;
44081
44200
  await Promise.race([
44082
44201
  Promise.all([depsReady, agentBinaryReady]),
44083
- new Promise((resolve10) => {
44084
- gateTimer = setTimeout(resolve10, GATE_TIMEOUT_MS);
44202
+ new Promise((resolve11) => {
44203
+ gateTimer = setTimeout(resolve11, GATE_TIMEOUT_MS);
44085
44204
  })
44086
44205
  ]);
44087
44206
  if (gateTimer) clearTimeout(gateTimer);
@@ -44455,7 +44574,7 @@ async function pair(args2 = []) {
44455
44574
  waitSpin.message(waitMessage());
44456
44575
  }, 1e3);
44457
44576
  countdownInterval.unref?.();
44458
- await new Promise((resolve10) => {
44577
+ await new Promise((resolve11) => {
44459
44578
  let stopPolling = null;
44460
44579
  function sigintHandler() {
44461
44580
  clearInterval(countdownInterval);
@@ -44506,7 +44625,7 @@ async function pair(args2 = []) {
44506
44625
  pluginAuthToken: info.pluginAuthToken
44507
44626
  });
44508
44627
  }
44509
- resolve10();
44628
+ resolve11();
44510
44629
  },
44511
44630
  () => {
44512
44631
  clearInterval(countdownInterval);
@@ -44735,12 +44854,12 @@ var GitHubCodespacesProvider = class {
44735
44854
  }
44736
44855
  if (!isAuthed) {
44737
44856
  resetStdinForChild();
44738
- await new Promise((resolve10, reject) => {
44857
+ await new Promise((resolve11, reject) => {
44739
44858
  const proc = (0, import_child_process32.spawn)("gh", ["auth", "login", "-s", "codespace,repo,read:user"], {
44740
44859
  stdio: "inherit"
44741
44860
  });
44742
44861
  proc.on("exit", (code) => {
44743
- if (code === 0) resolve10();
44862
+ if (code === 0) resolve11();
44744
44863
  else reject(new Error("gh auth login failed."));
44745
44864
  });
44746
44865
  proc.on("error", reject);
@@ -44769,13 +44888,13 @@ var GitHubCodespacesProvider = class {
44769
44888
  }
44770
44889
  wt(noteLines.join("\n"), "One more permission needed");
44771
44890
  resetStdinForChild();
44772
- const refreshCode = await new Promise((resolve10, reject) => {
44891
+ const refreshCode = await new Promise((resolve11, reject) => {
44773
44892
  const proc = (0, import_child_process32.spawn)(
44774
44893
  "gh",
44775
44894
  ["auth", "refresh", "-h", "github.com", "-s", "codespace"],
44776
44895
  { stdio: "inherit" }
44777
44896
  );
44778
- proc.on("exit", (code) => resolve10(code ?? 1));
44897
+ proc.on("exit", (code) => resolve11(code ?? 1));
44779
44898
  proc.on("error", reject);
44780
44899
  });
44781
44900
  if (refreshCode !== 0) {
@@ -44919,10 +45038,10 @@ var GitHubCodespacesProvider = class {
44919
45038
  if (q(proceed) || !proceed) return;
44920
45039
  O2.step(`Installing gh via ${installCmd.describe}\u2026`);
44921
45040
  resetStdinForChild();
44922
- const ok = await new Promise((resolve10) => {
45041
+ const ok = await new Promise((resolve11) => {
44923
45042
  const proc = (0, import_child_process32.spawn)(installCmd.exe, installCmd.args, { stdio: "inherit" });
44924
- proc.on("exit", (code) => resolve10(code === 0));
44925
- proc.on("error", () => resolve10(false));
45043
+ proc.on("exit", (code) => resolve11(code === 0));
45044
+ proc.on("error", () => resolve11(false));
44926
45045
  });
44927
45046
  if (ok) O2.success("gh installed");
44928
45047
  else O2.error("gh install failed");
@@ -44946,14 +45065,14 @@ var GitHubCodespacesProvider = class {
44946
45065
  "Expanding GitHub scopes"
44947
45066
  );
44948
45067
  resetStdinForChild();
44949
- await new Promise((resolve10, reject) => {
45068
+ await new Promise((resolve11, reject) => {
44950
45069
  const proc = (0, import_child_process32.spawn)(
44951
45070
  "gh",
44952
45071
  ["auth", "refresh", "-h", "github.com", "-s", "repo,read:org"],
44953
45072
  { stdio: "inherit" }
44954
45073
  );
44955
45074
  proc.on("exit", (code) => {
44956
- if (code === 0) resolve10();
45075
+ if (code === 0) resolve11();
44957
45076
  else reject(new Error(
44958
45077
  "gh auth refresh failed. Re-run `gh auth refresh -h github.com -s repo,read:org` manually."
44959
45078
  ));
@@ -45124,13 +45243,13 @@ var GitHubCodespacesProvider = class {
45124
45243
  }
45125
45244
  async streamCommand(workspaceId, command2) {
45126
45245
  resetStdinForChild();
45127
- return new Promise((resolve10, reject) => {
45246
+ return new Promise((resolve11, reject) => {
45128
45247
  const proc = (0, import_child_process32.spawn)(
45129
45248
  "gh",
45130
45249
  ["codespace", "ssh", "-c", workspaceId, "--", "-tt", command2],
45131
45250
  { stdio: "inherit" }
45132
45251
  );
45133
- proc.on("exit", (code) => resolve10({ code: code ?? 0 }));
45252
+ proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
45134
45253
  proc.on("error", reject);
45135
45254
  });
45136
45255
  }
@@ -45151,7 +45270,7 @@ var GitHubCodespacesProvider = class {
45151
45270
  "--",
45152
45271
  `mkdir -p ${shellQuote(remoteDir)} && tar -xzf - -C ${shellQuote(remoteDir)}`
45153
45272
  ];
45154
- await new Promise((resolve10, reject) => {
45273
+ await new Promise((resolve11, reject) => {
45155
45274
  const tar = (0, import_child_process32.spawn)("tar", tarArgs, {
45156
45275
  stdio: ["ignore", "pipe", "pipe"],
45157
45276
  env: tarEnv
@@ -45171,7 +45290,7 @@ var GitHubCodespacesProvider = class {
45171
45290
  ssh.on("error", reject);
45172
45291
  ssh.on("exit", (code) => {
45173
45292
  if (code === 0) {
45174
- resolve10();
45293
+ resolve11();
45175
45294
  } else {
45176
45295
  const reason = (sshErr || tarErr || `exit ${code}`).trim().slice(0, 500);
45177
45296
  reject(new Error(`Remote tar failed: ${reason}`));
@@ -45189,7 +45308,7 @@ var GitHubCodespacesProvider = class {
45189
45308
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote(remotePath)}`);
45190
45309
  }
45191
45310
  const cmd = parts.join(" && ");
45192
- await new Promise((resolve10, reject) => {
45311
+ await new Promise((resolve11, reject) => {
45193
45312
  const proc = (0, import_child_process32.spawn)(
45194
45313
  "gh",
45195
45314
  ["codespace", "ssh", "-c", workspaceId, "--", cmd],
@@ -45201,7 +45320,7 @@ var GitHubCodespacesProvider = class {
45201
45320
  });
45202
45321
  proc.on("error", reject);
45203
45322
  proc.on("exit", (code) => {
45204
- if (code === 0) resolve10();
45323
+ if (code === 0) resolve11();
45205
45324
  else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
45206
45325
  });
45207
45326
  proc.stdin?.write(contents);
@@ -45291,10 +45410,10 @@ var GitpodProvider = class {
45291
45410
  "Authenticating Gitpod"
45292
45411
  );
45293
45412
  resetStdinForChild2();
45294
- await new Promise((resolve10, reject) => {
45413
+ await new Promise((resolve11, reject) => {
45295
45414
  const proc = (0, import_child_process33.spawn)("gitpod", ["login"], { stdio: "inherit" });
45296
45415
  proc.on("exit", (code) => {
45297
- if (code === 0) resolve10();
45416
+ if (code === 0) resolve11();
45298
45417
  else reject(new Error("gitpod login failed."));
45299
45418
  });
45300
45419
  proc.on("error", reject);
@@ -45443,13 +45562,13 @@ var GitpodProvider = class {
45443
45562
  }
45444
45563
  async streamCommand(workspaceId, command2) {
45445
45564
  resetStdinForChild2();
45446
- return new Promise((resolve10, reject) => {
45565
+ return new Promise((resolve11, reject) => {
45447
45566
  const proc = (0, import_child_process33.spawn)(
45448
45567
  "gitpod",
45449
45568
  ["workspace", "ssh", workspaceId, "--", "-tt", command2],
45450
45569
  { stdio: "inherit" }
45451
45570
  );
45452
- proc.on("exit", (code) => resolve10({ code: code ?? 0 }));
45571
+ proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
45453
45572
  proc.on("error", reject);
45454
45573
  });
45455
45574
  }
@@ -45463,7 +45582,7 @@ var GitpodProvider = class {
45463
45582
  tarArgs.push(".");
45464
45583
  const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
45465
45584
  const remoteCmd = `mkdir -p ${shellQuote2(remoteDir)} && tar -xzf - -C ${shellQuote2(remoteDir)}`;
45466
- await new Promise((resolve10, reject) => {
45585
+ await new Promise((resolve11, reject) => {
45467
45586
  const tar = (0, import_child_process33.spawn)("tar", tarArgs, {
45468
45587
  stdio: ["ignore", "pipe", "pipe"],
45469
45588
  env: tarEnv
@@ -45484,7 +45603,7 @@ var GitpodProvider = class {
45484
45603
  tar.on("error", reject);
45485
45604
  ssh.on("error", reject);
45486
45605
  ssh.on("exit", (code) => {
45487
- if (code === 0) resolve10();
45606
+ if (code === 0) resolve11();
45488
45607
  else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
45489
45608
  });
45490
45609
  });
@@ -45499,7 +45618,7 @@ var GitpodProvider = class {
45499
45618
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote2(remotePath)}`);
45500
45619
  }
45501
45620
  const cmd = parts.join(" && ");
45502
- await new Promise((resolve10, reject) => {
45621
+ await new Promise((resolve11, reject) => {
45503
45622
  const proc = (0, import_child_process33.spawn)(
45504
45623
  "gitpod",
45505
45624
  ["workspace", "ssh", workspaceId, "--", cmd],
@@ -45511,7 +45630,7 @@ var GitpodProvider = class {
45511
45630
  });
45512
45631
  proc.on("error", reject);
45513
45632
  proc.on("exit", (code) => {
45514
- if (code === 0) resolve10();
45633
+ if (code === 0) resolve11();
45515
45634
  else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
45516
45635
  });
45517
45636
  proc.stdin?.write(contents);
@@ -45568,14 +45687,14 @@ var GitLabWorkspacesProvider = class {
45568
45687
  "Authenticating GitLab"
45569
45688
  );
45570
45689
  resetStdinForChild3();
45571
- await new Promise((resolve10, reject) => {
45690
+ await new Promise((resolve11, reject) => {
45572
45691
  const proc = (0, import_child_process34.spawn)(
45573
45692
  "glab",
45574
45693
  ["auth", "login", "--scopes", "api,read_user,read_repository"],
45575
45694
  { stdio: "inherit" }
45576
45695
  );
45577
45696
  proc.on("exit", (code) => {
45578
- if (code === 0) resolve10();
45697
+ if (code === 0) resolve11();
45579
45698
  else reject(new Error("glab auth login failed."));
45580
45699
  });
45581
45700
  proc.on("error", reject);
@@ -45740,13 +45859,13 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45740
45859
  async streamCommand(workspaceId, command2) {
45741
45860
  const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
45742
45861
  resetStdinForChild3();
45743
- return new Promise((resolve10, reject) => {
45862
+ return new Promise((resolve11, reject) => {
45744
45863
  const proc = (0, import_child_process34.spawn)(
45745
45864
  "ssh",
45746
45865
  ["-tt", "-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, command2],
45747
45866
  { stdio: "inherit" }
45748
45867
  );
45749
- proc.on("exit", (code) => resolve10({ code: code ?? 0 }));
45868
+ proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
45750
45869
  proc.on("error", reject);
45751
45870
  });
45752
45871
  }
@@ -45761,7 +45880,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45761
45880
  tarArgs.push(".");
45762
45881
  const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
45763
45882
  const remoteCmd = `mkdir -p ${shellQuote3(remoteDir)} && tar -xzf - -C ${shellQuote3(remoteDir)}`;
45764
- await new Promise((resolve10, reject) => {
45883
+ await new Promise((resolve11, reject) => {
45765
45884
  const tar = (0, import_child_process34.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
45766
45885
  const ssh = (0, import_child_process34.spawn)(
45767
45886
  "ssh",
@@ -45779,7 +45898,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45779
45898
  tar.on("error", reject);
45780
45899
  ssh.on("error", reject);
45781
45900
  ssh.on("exit", (code) => {
45782
- if (code === 0) resolve10();
45901
+ if (code === 0) resolve11();
45783
45902
  else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
45784
45903
  });
45785
45904
  });
@@ -45792,7 +45911,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45792
45911
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
45793
45912
  }
45794
45913
  const cmd = parts.join(" && ");
45795
- await new Promise((resolve10, reject) => {
45914
+ await new Promise((resolve11, reject) => {
45796
45915
  const proc = (0, import_child_process34.spawn)(
45797
45916
  "ssh",
45798
45917
  ["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, cmd],
@@ -45804,7 +45923,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45804
45923
  });
45805
45924
  proc.on("error", reject);
45806
45925
  proc.on("exit", (code) => {
45807
- if (code === 0) resolve10();
45926
+ if (code === 0) resolve11();
45808
45927
  else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
45809
45928
  });
45810
45929
  proc.stdin?.write(contents);
@@ -45895,10 +46014,10 @@ var RailwayProvider = class {
45895
46014
  "Authenticating Railway"
45896
46015
  );
45897
46016
  resetStdinForChild4();
45898
- await new Promise((resolve10, reject) => {
46017
+ await new Promise((resolve11, reject) => {
45899
46018
  const proc = (0, import_child_process35.spawn)("railway", ["login"], { stdio: "inherit" });
45900
46019
  proc.on("exit", (code) => {
45901
- if (code === 0) resolve10();
46020
+ if (code === 0) resolve11();
45902
46021
  else reject(new Error("railway login failed."));
45903
46022
  });
45904
46023
  proc.on("error", reject);
@@ -46038,13 +46157,13 @@ var RailwayProvider = class {
46038
46157
  throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
46039
46158
  }
46040
46159
  resetStdinForChild4();
46041
- return new Promise((resolve10, reject) => {
46160
+ return new Promise((resolve11, reject) => {
46042
46161
  const proc = (0, import_child_process35.spawn)(
46043
46162
  "railway",
46044
46163
  ["shell", "--project", projectId, "--service", serviceId, "--command", command2],
46045
46164
  { stdio: "inherit" }
46046
46165
  );
46047
- proc.on("exit", (code) => resolve10({ code: code ?? 0 }));
46166
+ proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
46048
46167
  proc.on("error", reject);
46049
46168
  });
46050
46169
  }
@@ -46062,7 +46181,7 @@ var RailwayProvider = class {
46062
46181
  tarArgs.push(".");
46063
46182
  const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
46064
46183
  const remoteCmd = `mkdir -p ${shellQuote4(remoteDir)} && tar -xzf - -C ${shellQuote4(remoteDir)}`;
46065
- await new Promise((resolve10, reject) => {
46184
+ await new Promise((resolve11, reject) => {
46066
46185
  const tar = (0, import_child_process35.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
46067
46186
  const sh = (0, import_child_process35.spawn)(
46068
46187
  "railway",
@@ -46080,7 +46199,7 @@ var RailwayProvider = class {
46080
46199
  tar.on("error", reject);
46081
46200
  sh.on("error", reject);
46082
46201
  sh.on("exit", (code) => {
46083
- if (code === 0) resolve10();
46202
+ if (code === 0) resolve11();
46084
46203
  else reject(new Error(`Remote tar failed: ${(shErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
46085
46204
  });
46086
46205
  });
@@ -46096,7 +46215,7 @@ var RailwayProvider = class {
46096
46215
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
46097
46216
  }
46098
46217
  const cmd = parts.join(" && ");
46099
- await new Promise((resolve10, reject) => {
46218
+ await new Promise((resolve11, reject) => {
46100
46219
  const proc = (0, import_child_process35.spawn)(
46101
46220
  "railway",
46102
46221
  ["shell", "--project", projectId, "--service", serviceId, "--command", cmd],
@@ -46108,7 +46227,7 @@ var RailwayProvider = class {
46108
46227
  });
46109
46228
  proc.on("error", reject);
46110
46229
  proc.on("exit", (code) => {
46111
- if (code === 0) resolve10();
46230
+ if (code === 0) resolve11();
46112
46231
  else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
46113
46232
  });
46114
46233
  proc.stdin?.write(contents);
@@ -46905,7 +47024,7 @@ function checkChokidar() {
46905
47024
  }
46906
47025
  async function doctor(args2 = []) {
46907
47026
  const json = args2.includes("--json");
46908
- const cliVersion = true ? "2.72.0" : "0.0.0-dev";
47027
+ const cliVersion = true ? "2.73.1" : "0.0.0-dev";
46909
47028
  const apiBase2 = resolveApiBaseUrl();
46910
47029
  const diagnosticId = (0, import_node_crypto13.randomUUID)();
46911
47030
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -47296,7 +47415,7 @@ async function mcpRun(args2) {
47296
47415
  // src/commands/version.ts
47297
47416
  var import_picocolors15 = __toESM(require("picocolors"));
47298
47417
  function version2() {
47299
- const v = true ? "2.72.0" : "unknown";
47418
+ const v = true ? "2.73.1" : "unknown";
47300
47419
  console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
47301
47420
  }
47302
47421