@4pm/cli 1.19.2 → 1.19.3

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 (2) hide show
  1. package/dist/index.js +15 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -39514,6 +39514,13 @@ function appendCommandOutput(commandId, text) {
39514
39514
  } catch {
39515
39515
  }
39516
39516
  }
39517
+ function resetCommandOutput(commandId) {
39518
+ if (!dir) return;
39519
+ try {
39520
+ rmSync4(join13(dir, `${commandId}.log`), { force: true });
39521
+ } catch {
39522
+ }
39523
+ }
39517
39524
  function readCommandOutput(commandId) {
39518
39525
  if (!dir) return null;
39519
39526
  const path = join13(dir, `${commandId}.log`);
@@ -40479,6 +40486,7 @@ async function runCommand(dispatch, emit, opts) {
40479
40486
  }
40480
40487
 
40481
40488
  // src/core/ai-runner.ts
40489
+ var TIMEOUT_EXIT = 124;
40482
40490
  function isAuthFailure(text) {
40483
40491
  return /\b401\b|invalid authentication|authentication credentials|oauth[^]*revoked|not authenticated|please run.*login/i.test(
40484
40492
  text
@@ -40546,7 +40554,7 @@ async function runAiFailover(plan, commandId, cwd2, handlers, timeoutMs = 0) {
40546
40554
  };
40547
40555
  }
40548
40556
  if (finalExit === 0 && apiErr.isError) finalExit = apiErr.status && apiErr.status > 0 ? apiErr.status : 1;
40549
- const reason = isAuthFailure(captured) ? "auth" : apiErr.status === 429 || isOutOfCredits(captured) ? "credits" : isSessionLimit(captured) ? "limit" : "other";
40557
+ const reason = finalExit === TIMEOUT_EXIT ? "timeout" : isAuthFailure(captured) ? "auth" : apiErr.status === 429 || isOutOfCredits(captured) ? "credits" : isSessionLimit(captured) ? "limit" : "other";
40550
40558
  if (i === total - 1) break;
40551
40559
  handlers.onAttemptFail(attempt.label, reason);
40552
40560
  }
@@ -41294,13 +41302,18 @@ ${guardedPrompt}`;
41294
41302
  }
41295
41303
  },
41296
41304
  onAttemptStart: (label, index, total, cmd2) => {
41305
+ if (index > 0) {
41306
+ answerText = "";
41307
+ resetCommandOutput(commandId);
41308
+ ctx.send(WsChannels.COMMAND_OUTPUT, { commandId, seq: seq++, chunk: "", reset: true });
41309
+ }
41297
41310
  const text = `\u2192 trying ${cmd2} profile "${label}" (${index + 1}/${total})\u2026`;
41298
41311
  ctx.bus.push({ source: origin, kind: "log", text });
41299
41312
  ctx.send(WsChannels.COMMAND_OUTPUT, { commandId, seq: seq++, chunk: `${text}
41300
41313
  `, log: true });
41301
41314
  },
41302
41315
  onAttemptFail: (label, reason) => {
41303
- const text = reason === "limit" ? `profile "${label}" hit its session limit \u2014 trying next` : reason === "credits" ? `profile "${label}" is out of usage credits \u2014 trying next` : reason === "auth" ? `profile "${label}" failed to authenticate \u2014 trying next` : `profile "${label}" run failed \u2014 trying next`;
41316
+ const text = reason === "limit" ? `profile "${label}" hit its session limit \u2014 trying next` : reason === "credits" ? `profile "${label}" is out of usage credits \u2014 trying next` : reason === "auth" ? `profile "${label}" failed to authenticate \u2014 trying next` : reason === "timeout" ? `profile "${label}" timed out \u2014 trying next` : `profile "${label}" run failed \u2014 trying next`;
41304
41317
  ctx.bus.push({ source: origin, kind: "log", text, level: "warn" });
41305
41318
  ctx.send(WsChannels.COMMAND_OUTPUT, { commandId, seq: seq++, chunk: `${text}
41306
41319
  `, log: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4pm/cli",
3
- "version": "1.19.2",
3
+ "version": "1.19.3",
4
4
  "private": false,
5
5
  "description": "4PM CLI — drives Claude/Codex CLIs on AI worker machines (Node + TypeScript)",
6
6
  "license": "LicenseRef-4PM-Source-Available",