@integrity-labs/agt-cli 0.28.228 → 0.28.230

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.
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
100
100
  return { ok: true };
101
101
  } catch {
102
102
  }
103
- const { resolveClaudeBinary } = await import("./persistent-session-VZ44GVA4.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-XYM2DWZU.js");
104
104
  const claudeBin = resolveClaudeBinary();
105
105
  const pairEnv = {
106
106
  ...process.env,
@@ -373,4 +373,4 @@ export {
373
373
  startClaudePair,
374
374
  submitClaudePairCode
375
375
  };
376
- //# sourceMappingURL=claude-pair-runtime-CGFYM63W.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-CGUFXCYJ.js.map
@@ -37,7 +37,7 @@ import {
37
37
  requireHost,
38
38
  safeWriteJsonAtomic,
39
39
  setConfigHash
40
- } from "../chunk-STDJAYQQ.js";
40
+ } from "../chunk-L55H4BIT.js";
41
41
  import {
42
42
  getProjectDir as getProjectDir2,
43
43
  getReadyTasks,
@@ -122,7 +122,7 @@ import {
122
122
  takeZombieDetection,
123
123
  transcriptActivityAgeSeconds,
124
124
  writeEgressAllowlist
125
- } from "../chunk-VV5IXUN6.js";
125
+ } from "../chunk-X4FOPVGZ.js";
126
126
  import {
127
127
  reapOrphanChannelMcps
128
128
  } from "../chunk-XWVM4KPK.js";
@@ -5114,6 +5114,52 @@ var PersistentSessionStuckTracker = class {
5114
5114
  }
5115
5115
  };
5116
5116
 
5117
+ // src/lib/transient-api-error-log.ts
5118
+ var CODE_KIND = {
5119
+ "429": "rate_limit",
5120
+ "500": "server_error",
5121
+ "503": "unavailable",
5122
+ "529": "overloaded"
5123
+ };
5124
+ function stripAnsi(s) {
5125
+ return s.replace(/\x1b\[[0-9;]*[A-Za-z]/g, "");
5126
+ }
5127
+ function matchAnchored(candidate) {
5128
+ const head = candidate.replace(/^\s+/, "").slice(0, 200);
5129
+ const code = head.match(/^api error:\s*(\d{3})\b/i)?.[1] ?? head.match(
5130
+ /^(\d{3})\s+(?:overloaded|service unavailable|internal server error|too many requests|server error)\b/i
5131
+ )?.[1];
5132
+ if (code) {
5133
+ const kind = CODE_KIND[code];
5134
+ if (kind) return { code, kind };
5135
+ }
5136
+ const typeToken = head.match(/^[^a-z0-9]*(overloaded_error|rate_limit_error)\b/i)?.[1];
5137
+ if (typeToken) {
5138
+ return typeToken.toLowerCase() === "overloaded_error" ? { code: "529", kind: "overloaded" } : { code: "429", kind: "rate_limit" };
5139
+ }
5140
+ return null;
5141
+ }
5142
+ function detectTransientApiErrorInLog(logTail, opts = {}) {
5143
+ if (!logTail) return null;
5144
+ const maxLines = opts.maxLines ?? 200;
5145
+ const lines = logTail.split(/\r?\n/);
5146
+ const start = Math.max(0, lines.length - maxLines);
5147
+ for (let i = lines.length - 1; i >= start; i--) {
5148
+ const line = stripAnsi(lines[i] ?? "").replace(/^\s+/, "");
5149
+ if (!line) continue;
5150
+ const candidates = [line];
5151
+ const idxApiErr = line.search(/api error:/i);
5152
+ if (idxApiErr > 0) candidates.push(line.slice(idxApiErr));
5153
+ const idxType = line.search(/(?:overloaded_error|rate_limit_error)\b/i);
5154
+ if (idxType > 0) candidates.push(line.slice(idxType));
5155
+ for (const candidate of candidates) {
5156
+ const match = matchAnchored(candidate);
5157
+ if (match) return match;
5158
+ }
5159
+ }
5160
+ return null;
5161
+ }
5162
+
5117
5163
  // src/lib/realtime-chat.ts
5118
5164
  import { createClient } from "@supabase/supabase-js";
5119
5165
  var client = null;
@@ -6373,7 +6419,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
6373
6419
  var lastVersionCheckAt = 0;
6374
6420
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
6375
6421
  var lastResponsivenessProbeAt = 0;
6376
- var agtCliVersion = true ? "0.28.228" : "dev";
6422
+ var agtCliVersion = true ? "0.28.230" : "dev";
6377
6423
  function resolveBrewPath(execFileSync2) {
6378
6424
  try {
6379
6425
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -7298,7 +7344,7 @@ async function pollCycle() {
7298
7344
  }
7299
7345
  try {
7300
7346
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
7301
- const { collectDiagnostics } = await import("../persistent-session-VZ44GVA4.js");
7347
+ const { collectDiagnostics } = await import("../persistent-session-XYM2DWZU.js");
7302
7348
  const diagCodeNames = [...agentState.persistentSessionAgents];
7303
7349
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
7304
7350
  let tailscaleHostname;
@@ -7446,7 +7492,7 @@ async function pollCycle() {
7446
7492
  const {
7447
7493
  collectResponsivenessProbes,
7448
7494
  getResponsivenessIntervalMs
7449
- } = await import("../responsiveness-probe-DLIVXYKX.js");
7495
+ } = await import("../responsiveness-probe-MUPAYTJF.js");
7450
7496
  const probeIntervalMs = getResponsivenessIntervalMs();
7451
7497
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
7452
7498
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -7478,7 +7524,7 @@ async function pollCycle() {
7478
7524
  collectResponsivenessProbes,
7479
7525
  livePendingInboundOldestAgeSeconds,
7480
7526
  parkPendingInbound
7481
- } = await import("../responsiveness-probe-DLIVXYKX.js");
7527
+ } = await import("../responsiveness-probe-MUPAYTJF.js");
7482
7528
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
7483
7529
  const wedgeNow = /* @__PURE__ */ new Date();
7484
7530
  const liveAgents = agentState.persistentSessionAgents;
@@ -7565,6 +7611,31 @@ async function pollCycle() {
7565
7611
  log(
7566
7612
  `[wedge] forced fresh respawn ${detail} \u2192 new session ${newId} (transcript preserved${parkNote}${deadNote})`
7567
7613
  );
7614
+ if (hostFlagStore().getBoolean("wedge-transient-notice")) {
7615
+ try {
7616
+ const paneTail = readFileSync14(paneLogPath(codeName), "utf8").slice(-65536);
7617
+ const transient = detectTransientApiErrorInLog(paneTail);
7618
+ if (transient) {
7619
+ const wedgeHome = join16(homedir9(), ".augmented", codeName);
7620
+ if (existsSync8(wedgeHome)) {
7621
+ atomicWriteFileSync(
7622
+ join16(wedgeHome, "watchdog-give-up.json"),
7623
+ JSON.stringify({
7624
+ gave_up_at: wedgeNow.toISOString(),
7625
+ reason: "transient_overload"
7626
+ })
7627
+ );
7628
+ log(
7629
+ `[wedge] transient API error (${transient.code}/${transient.kind}) preceded the wedge for '${codeName}' \u2014 wrote transient-overload give-up signal so pending conversations get a friendly resend notice (ENG-7360)`
7630
+ );
7631
+ }
7632
+ }
7633
+ } catch (err) {
7634
+ log(
7635
+ `[wedge] transient-notice check failed for '${codeName}' (ENG-7360): ${err.message} \u2014 respawn unaffected`
7636
+ );
7637
+ }
7638
+ }
7568
7639
  const wedgeAgentId = agentState.codeNameToAgentId.get(codeName);
7569
7640
  if (wedgeAgentId) {
7570
7641
  api.post("/host/wedge-respawn", {
@@ -7749,7 +7820,7 @@ async function pollCycle() {
7749
7820
  if (restartedCodeNames.length > 0) {
7750
7821
  void (async () => {
7751
7822
  try {
7752
- const { collectDiagnostics } = await import("../persistent-session-VZ44GVA4.js");
7823
+ const { collectDiagnostics } = await import("../persistent-session-XYM2DWZU.js");
7753
7824
  const freshDiagnostics = collectDiagnostics(restartedCodeNames);
7754
7825
  await api.post("/host/heartbeat", {
7755
7826
  host_id: hostId,
@@ -10252,7 +10323,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
10252
10323
  void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
10253
10324
  void (async () => {
10254
10325
  try {
10255
- const { collectDiagnostics } = await import("../persistent-session-VZ44GVA4.js");
10326
+ const { collectDiagnostics } = await import("../persistent-session-XYM2DWZU.js");
10256
10327
  await api.post("/host/heartbeat", {
10257
10328
  host_id: hostId,
10258
10329
  agent_diagnostics: collectDiagnostics([codeName])
@@ -10646,7 +10717,7 @@ async function processClaudePairSessions(agents) {
10646
10717
  killPairSession,
10647
10718
  pairTmuxSession,
10648
10719
  finalizeClaudePairOnboarding
10649
- } = await import("../claude-pair-runtime-CGFYM63W.js");
10720
+ } = await import("../claude-pair-runtime-CGUFXCYJ.js");
10650
10721
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
10651
10722
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
10652
10723
  const killed = await killPairSession(pairTmuxSession(pairId));