@integrity-labs/agt-cli 0.27.156 → 0.27.158

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-AIM4U3AL.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-EWHFMQRC.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-UQFPB2BE.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-FTU6NTBF.js.map
@@ -19,7 +19,7 @@ import {
19
19
  provisionStopHook,
20
20
  requireHost,
21
21
  safeWriteJsonAtomic
22
- } from "../chunk-25VLOVMK.js";
22
+ } from "../chunk-ELEMDMTQ.js";
23
23
  import {
24
24
  getProjectDir as getProjectDir2,
25
25
  getReadyTasks,
@@ -57,10 +57,11 @@ import {
57
57
  startPersistentSession,
58
58
  stopAllSessionsAndWait,
59
59
  stopPersistentSession,
60
+ subagentActivityAgeSeconds,
60
61
  takeWatchdogGiveUpCount,
61
62
  takeZombieDetection,
62
63
  transcriptActivityAgeSeconds
63
- } from "../chunk-FR2MNN2P.js";
64
+ } from "../chunk-GJVY7WKU.js";
64
65
  import {
65
66
  KANBAN_CHECK_COMMAND,
66
67
  MAX_AVATAR_ENV_URL_BYTES,
@@ -90,7 +91,7 @@ import {
90
91
  resolveDmTarget,
91
92
  worseConnectivityOutcome,
92
93
  wrapScheduledTaskPrompt
93
- } from "../chunk-3X6V4SVW.js";
94
+ } from "../chunk-5E5B4T7K.js";
94
95
  import {
95
96
  parsePsRows,
96
97
  reapOrphanChannelMcps
@@ -3568,11 +3569,19 @@ function resolveWedgeConfig(env = process.env) {
3568
3569
  };
3569
3570
  }
3570
3571
  function isSessionProducing(signals, config2) {
3572
+ const subagentAge = signals.subagentActivityAgeSeconds;
3573
+ if (subagentAge !== null && subagentAge < config2.transcriptStaleSeconds) return true;
3571
3574
  const transcriptAge = signals.transcriptActivityAgeSeconds;
3572
3575
  if (transcriptAge !== null) return transcriptAge < config2.transcriptStaleSeconds;
3573
3576
  const paneAge = signals.paneActivityAgeSeconds;
3574
3577
  return paneAge !== null && paneAge < config2.paneStaleSeconds;
3575
3578
  }
3579
+ function wedgeExemptionReason(signals, config2) {
3580
+ if (signals.subagentActivityAgeSeconds === null) return null;
3581
+ if (isWedgeCandidateCycle(signals, config2)) return null;
3582
+ const withoutSubagent = { ...signals, subagentActivityAgeSeconds: null };
3583
+ return isWedgeCandidateCycle(withoutSubagent, config2) ? "background-task-in-flight" : null;
3584
+ }
3576
3585
  function isWedgeCandidateCycle(signals, config2) {
3577
3586
  const inboundAge = signals.pendingInboundOldestAgeSeconds;
3578
3587
  if (inboundAge === null) return false;
@@ -4548,6 +4557,7 @@ var DEFER_LOG_THROTTLE_MS = 6e5;
4548
4557
  var deferLogThrottle = /* @__PURE__ */ new Map();
4549
4558
  var lastInboundMs = /* @__PURE__ */ new Map();
4550
4559
  var consecutiveWedgeCycles = /* @__PURE__ */ new Map();
4560
+ var wedgeExemptionLogged = /* @__PURE__ */ new Set();
4551
4561
  var wedgeRestartsByCard = /* @__PURE__ */ new Map();
4552
4562
  function noteInbound(codeName) {
4553
4563
  lastInboundMs.set(codeName, Date.now());
@@ -4914,7 +4924,7 @@ var cachedMaintenanceWindow = null;
4914
4924
  var lastVersionCheckAt = 0;
4915
4925
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
4916
4926
  var lastResponsivenessProbeAt = 0;
4917
- var agtCliVersion = true ? "0.27.156" : "dev";
4927
+ var agtCliVersion = true ? "0.27.158" : "dev";
4918
4928
  function resolveBrewPath(execFileSync4) {
4919
4929
  try {
4920
4930
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -6112,7 +6122,7 @@ async function pollCycle() {
6112
6122
  }
6113
6123
  try {
6114
6124
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
6115
- const { collectDiagnostics } = await import("../persistent-session-AIM4U3AL.js");
6125
+ const { collectDiagnostics } = await import("../persistent-session-EWHFMQRC.js");
6116
6126
  const diagCodeNames = [...agentState.persistentSessionAgents];
6117
6127
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
6118
6128
  let tailscaleHostname;
@@ -6199,12 +6209,12 @@ async function pollCycle() {
6199
6209
  const {
6200
6210
  collectResponsivenessProbes,
6201
6211
  getResponsivenessIntervalMs
6202
- } = await import("../responsiveness-probe-6L2XS27G.js");
6212
+ } = await import("../responsiveness-probe-SWHB27QI.js");
6203
6213
  const probeIntervalMs = getResponsivenessIntervalMs();
6204
6214
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
6205
6215
  const probeCodeNames = [...agentState.persistentSessionAgents];
6206
6216
  if (probeCodeNames.length > 0) {
6207
- const { takeAcpxExecFailureCount, creditAcpxExecFailureCount } = await import("../persistent-session-AIM4U3AL.js");
6217
+ const { takeAcpxExecFailureCount, creditAcpxExecFailureCount } = await import("../persistent-session-EWHFMQRC.js");
6208
6218
  const drainedGiveUps = /* @__PURE__ */ new Map();
6209
6219
  const drainedAcpxFailures = /* @__PURE__ */ new Map();
6210
6220
  const probes = collectResponsivenessProbes(probeCodeNames).map((p) => {
@@ -6237,14 +6247,17 @@ async function pollCycle() {
6237
6247
  const {
6238
6248
  collectResponsivenessProbes,
6239
6249
  livePendingInboundOldestAgeSeconds,
6240
- deadLetterPendingInbound
6241
- } = await import("../responsiveness-probe-6L2XS27G.js");
6250
+ parkPendingInbound
6251
+ } = await import("../responsiveness-probe-SWHB27QI.js");
6242
6252
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
6243
6253
  const wedgeNow = /* @__PURE__ */ new Date();
6244
6254
  const liveAgents = agentState.persistentSessionAgents;
6245
6255
  for (const tracked of consecutiveWedgeCycles.keys()) {
6246
6256
  if (!liveAgents.has(tracked)) consecutiveWedgeCycles.delete(tracked);
6247
6257
  }
6258
+ for (const tracked of wedgeExemptionLogged) {
6259
+ if (!liveAgents.has(tracked)) wedgeExemptionLogged.delete(tracked);
6260
+ }
6248
6261
  for (const tracked of wedgeRestartsByCard.keys()) {
6249
6262
  if (!liveAgents.has(tracked)) wedgeRestartsByCard.delete(tracked);
6250
6263
  }
@@ -6253,6 +6266,7 @@ async function pollCycle() {
6253
6266
  const codeName = probe.code_name;
6254
6267
  if (!isSessionHealthy(codeName)) {
6255
6268
  consecutiveWedgeCycles.delete(codeName);
6269
+ wedgeExemptionLogged.delete(codeName);
6256
6270
  continue;
6257
6271
  }
6258
6272
  const wedgeSession = getSessionState(codeName);
@@ -6262,9 +6276,15 @@ async function pollCycle() {
6262
6276
  wedgeSession?.currentSessionId ?? null,
6263
6277
  wedgeNow
6264
6278
  );
6279
+ const subagentAge = subagentActivityAgeSeconds(
6280
+ wedgeProjectDir(codeName),
6281
+ wedgeSession?.currentSessionId ?? null,
6282
+ wedgeNow
6283
+ );
6265
6284
  const signals = {
6266
6285
  paneActivityAgeSeconds: probe.pane_activity_age_seconds,
6267
6286
  transcriptActivityAgeSeconds: transcriptAge,
6287
+ subagentActivityAgeSeconds: subagentAge,
6268
6288
  pendingInboundOldestAgeSeconds: livePendingInboundOldestAgeSeconds(
6269
6289
  codeName,
6270
6290
  sessionStartMs,
@@ -6273,8 +6293,20 @@ async function pollCycle() {
6273
6293
  };
6274
6294
  if (!isWedgeCandidateCycle(signals, wedgeConfig)) {
6275
6295
  consecutiveWedgeCycles.delete(codeName);
6296
+ const exemption = wedgeExemptionReason(signals, wedgeConfig);
6297
+ if (exemption !== null) {
6298
+ if (!wedgeExemptionLogged.has(codeName)) {
6299
+ wedgeExemptionLogged.add(codeName);
6300
+ log(
6301
+ `[wedge] exempt agent=${codeName} reason=${exemption} subagentAge=${subagentAge}s inboundAge=${signals.pendingInboundOldestAgeSeconds}s transcriptAge=${transcriptAge === null ? "n/a" : `${transcriptAge}s`}`
6302
+ );
6303
+ }
6304
+ } else {
6305
+ wedgeExemptionLogged.delete(codeName);
6306
+ }
6276
6307
  continue;
6277
6308
  }
6309
+ wedgeExemptionLogged.delete(codeName);
6278
6310
  const streak = (consecutiveWedgeCycles.get(codeName) ?? 0) + 1;
6279
6311
  consecutiveWedgeCycles.set(codeName, streak);
6280
6312
  if (decideWedgeRestart({ ...signals, consecutiveWedgeCycles: streak }, wedgeConfig) !== "wedged") {
@@ -6297,17 +6329,23 @@ async function pollCycle() {
6297
6329
  }
6298
6330
  stopPersistentSessionAndForgetMcpBaseline(codeName);
6299
6331
  consecutiveWedgeCycles.delete(codeName);
6300
- const deadLettered = deadLetterPendingInbound(codeName, wedgeNow);
6301
- const deadNote = deadLettered > 0 ? `, ${deadLettered} stale inbound dead-lettered` : "";
6332
+ const { parked, deadLettered } = parkPendingInbound(codeName, wedgeNow);
6333
+ const parkNote = parked > 0 ? `, ${parked} inbound parked for fresh session` : "";
6334
+ const deadNote = deadLettered > 0 ? `, ${deadLettered} undeliverable inbound dead-lettered` : "";
6302
6335
  log(
6303
- `[wedge] forced fresh respawn ${detail} \u2192 new session ${newId} (transcript preserved${deadNote})`
6336
+ `[wedge] forced fresh respawn ${detail} \u2192 new session ${newId} (transcript preserved${parkNote}${deadNote})`
6304
6337
  );
6305
6338
  const wedgeAgentId = agentState.codeNameToAgentId.get(codeName);
6306
6339
  if (wedgeAgentId) {
6307
6340
  api.post("/host/wedge-respawn", {
6308
6341
  agent_id: wedgeAgentId,
6309
6342
  code_name: codeName,
6343
+ // dead_lettered_count keeps its "messages actually dropped"
6344
+ // alarm semantics (DeadLetteredInboundHourly fires on the
6345
+ // first one); parked messages are recoverable, reported
6346
+ // separately. Older APIs ignore the unknown field.
6310
6347
  dead_lettered_count: deadLettered,
6348
+ parked_count: parked,
6311
6349
  pane_age_seconds: signals.paneActivityAgeSeconds,
6312
6350
  inbound_age_seconds: signals.pendingInboundOldestAgeSeconds,
6313
6351
  transcript_age_seconds: transcriptAge
@@ -10800,7 +10838,7 @@ async function processClaudePairSessions(agents) {
10800
10838
  killPairSession,
10801
10839
  pairTmuxSession,
10802
10840
  finalizeClaudePairOnboarding
10803
- } = await import("../claude-pair-runtime-UQFPB2BE.js");
10841
+ } = await import("../claude-pair-runtime-FTU6NTBF.js");
10804
10842
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
10805
10843
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
10806
10844
  const killed = await killPairSession(pairTmuxSession(pairId));