@integrity-labs/agt-cli 0.28.239 → 0.28.241

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-RRCU7CQJ.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-W2MICXSS.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-422CI7SM.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-4NHJGZBH.js.map
@@ -37,7 +37,7 @@ import {
37
37
  requireHost,
38
38
  safeWriteJsonAtomic,
39
39
  setConfigHash
40
- } from "../chunk-O3MVFYYC.js";
40
+ } from "../chunk-ALYKJRFJ.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-GO4VMK2P.js";
125
+ } from "../chunk-LSOXMJYA.js";
126
126
  import {
127
127
  reapOrphanChannelMcps
128
128
  } from "../chunk-XWVM4KPK.js";
@@ -6005,6 +6005,9 @@ async function maybeResumeReconcile(agent) {
6005
6005
  autoResumeInFlight.delete(codeName);
6006
6006
  }
6007
6007
  }
6008
+ function restartReasonBindsNewMcp(breakerReason) {
6009
+ return breakerReason === "hot-reload-mcp" || breakerReason === "managed-mcp-churn" || breakerReason === "bind-remediation" || breakerReason === "channel-set-change";
6010
+ }
6008
6011
  function scheduleSessionRestart(codeName, delayMs, reason, breakerReason = "hot-reload-mcp", beforeStop) {
6009
6012
  const existing = pendingSessionRestarts.get(codeName);
6010
6013
  if (existing) {
@@ -6051,13 +6054,17 @@ function scheduleSessionRestart(codeName, delayMs, reason, breakerReason = "hot-
6051
6054
  runningMcpHashes.delete(codeName);
6052
6055
  recordRestartForBreaker(codeName, breakerReason);
6053
6056
  log(`[hot-reload] Session stopped for '${codeName}' \u2014 will respawn with ${reason}`);
6054
- if (breakerReason === "hot-reload-mcp" || breakerReason === "managed-mcp-churn" || breakerReason === "bind-remediation" || breakerReason === "channel-set-change") {
6057
+ const bindsNewMcp = restartReasonBindsNewMcp(breakerReason);
6058
+ if (bindsNewMcp) {
6055
6059
  const prior = pendingRestartVerifications.get(codeName);
6056
6060
  pendingRestartVerifications.set(codeName, {
6057
6061
  firedAt: Date.now(),
6058
6062
  attempts: prior?.attempts ?? 0
6059
6063
  });
6060
6064
  }
6065
+ if (bindsNewMcp && hostFlagStore().getBoolean("fast-mcp-restart-respawn")) {
6066
+ void respawnAgentAfterMcpStop(codeName, reason);
6067
+ }
6061
6068
  }, delayMs);
6062
6069
  timer.unref?.();
6063
6070
  pendingSessionRestarts.set(codeName, { timer, reason, breakerReason, beforeStop });
@@ -6502,7 +6509,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
6502
6509
  var lastVersionCheckAt = 0;
6503
6510
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
6504
6511
  var lastResponsivenessProbeAt = 0;
6505
- var agtCliVersion = true ? "0.28.239" : "dev";
6512
+ var agtCliVersion = true ? "0.28.241" : "dev";
6506
6513
  function resolveBrewPath(execFileSync2) {
6507
6514
  try {
6508
6515
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -7427,7 +7434,7 @@ async function pollCycle() {
7427
7434
  }
7428
7435
  try {
7429
7436
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
7430
- const { collectDiagnostics } = await import("../persistent-session-RRCU7CQJ.js");
7437
+ const { collectDiagnostics } = await import("../persistent-session-W2MICXSS.js");
7431
7438
  const diagCodeNames = [...agentState.persistentSessionAgents];
7432
7439
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
7433
7440
  let tailscaleHostname;
@@ -7575,7 +7582,7 @@ async function pollCycle() {
7575
7582
  const {
7576
7583
  collectResponsivenessProbes,
7577
7584
  getResponsivenessIntervalMs
7578
- } = await import("../responsiveness-probe-K5HFFW5F.js");
7585
+ } = await import("../responsiveness-probe-R7NX5NRH.js");
7579
7586
  const probeIntervalMs = getResponsivenessIntervalMs();
7580
7587
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
7581
7588
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -7607,7 +7614,7 @@ async function pollCycle() {
7607
7614
  collectResponsivenessProbes,
7608
7615
  livePendingInboundOldestAgeSeconds,
7609
7616
  parkPendingInbound
7610
- } = await import("../responsiveness-probe-K5HFFW5F.js");
7617
+ } = await import("../responsiveness-probe-R7NX5NRH.js");
7611
7618
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
7612
7619
  const wedgeNow = /* @__PURE__ */ new Date();
7613
7620
  const liveAgents = agentState.persistentSessionAgents;
@@ -7903,7 +7910,7 @@ async function pollCycle() {
7903
7910
  if (restartedCodeNames.length > 0) {
7904
7911
  void (async () => {
7905
7912
  try {
7906
- const { collectDiagnostics } = await import("../persistent-session-RRCU7CQJ.js");
7913
+ const { collectDiagnostics } = await import("../persistent-session-W2MICXSS.js");
7907
7914
  const freshDiagnostics = collectDiagnostics(restartedCodeNames);
7908
7915
  await api.post("/host/heartbeat", {
7909
7916
  host_id: hostId,
@@ -10422,7 +10429,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
10422
10429
  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}`));
10423
10430
  void (async () => {
10424
10431
  try {
10425
- const { collectDiagnostics } = await import("../persistent-session-RRCU7CQJ.js");
10432
+ const { collectDiagnostics } = await import("../persistent-session-W2MICXSS.js");
10426
10433
  await api.post("/host/heartbeat", {
10427
10434
  host_id: hostId,
10428
10435
  agent_diagnostics: collectDiagnostics([codeName])
@@ -10442,6 +10449,53 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
10442
10449
  restartInFlight.delete(agentId);
10443
10450
  }
10444
10451
  }
10452
+ async function respawnAgentAfterMcpStop(codeName, reason) {
10453
+ const prev = state6.agents.find((a) => a.codeName === codeName);
10454
+ if (!prev) return;
10455
+ const agentId = prev.agentId;
10456
+ if (restartInFlight.has(agentId)) return;
10457
+ restartInFlight.add(agentId);
10458
+ try {
10459
+ if (isSessionHealthy(codeName)) return;
10460
+ let refreshData;
10461
+ try {
10462
+ refreshData = await api.post("/host/refresh", { agent_id: agentId });
10463
+ } catch (err) {
10464
+ log(`[fast-mcp-respawn] refresh failed for '${codeName}', leaving for slow poll: ${err.message}`);
10465
+ return;
10466
+ }
10467
+ const displayName = refreshData.agent?.display_name ?? codeName;
10468
+ const result = await ensurePersistentSession(
10469
+ { agent_id: agentId, code_name: codeName, display_name: displayName },
10470
+ [],
10471
+ [],
10472
+ refreshData
10473
+ );
10474
+ if (result.decision !== "spawn" || !result.sessionHealthyAfter) {
10475
+ log(
10476
+ `[fast-mcp-respawn] respawn not confirmed for '${codeName}' (decision=${result.decision}) - leaving for slow poll`
10477
+ );
10478
+ return;
10479
+ }
10480
+ try {
10481
+ const hostId = await getHostId();
10482
+ const { collectDiagnostics } = await import("../persistent-session-W2MICXSS.js");
10483
+ await api.post("/host/heartbeat", {
10484
+ host_id: hostId,
10485
+ agent_diagnostics: collectDiagnostics([codeName])
10486
+ });
10487
+ } catch (err) {
10488
+ log(`[fast-mcp-respawn] post-respawn diagnostics flush failed for '${codeName}': ${err.message}`);
10489
+ }
10490
+ log(
10491
+ `[fast-mcp-respawn] '${codeName}' respawned immediately after '${reason}' stop - skipped the ~poll-cycle wait (ENG-7401)`
10492
+ );
10493
+ } catch (err) {
10494
+ log(`[fast-mcp-respawn] unexpected error for '${codeName}', leaving for slow poll: ${err.message}`);
10495
+ } finally {
10496
+ restartInFlight.delete(agentId);
10497
+ }
10498
+ }
10445
10499
  function ensureRealtimeAssignStarted(agentStates) {
10446
10500
  if (realtimeAssignStarted) return;
10447
10501
  const apiKey = process.env["AGT_API_KEY"];
@@ -10816,7 +10870,7 @@ async function processClaudePairSessions(agents) {
10816
10870
  killPairSession,
10817
10871
  pairTmuxSession,
10818
10872
  finalizeClaudePairOnboarding
10819
- } = await import("../claude-pair-runtime-422CI7SM.js");
10873
+ } = await import("../claude-pair-runtime-4NHJGZBH.js");
10820
10874
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
10821
10875
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
10822
10876
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -11713,6 +11767,7 @@ export {
11713
11767
  markAgentForFreshMemorySync,
11714
11768
  maybeInjectKanbanCheck,
11715
11769
  maybeUpgradeClaudeCode,
11770
+ restartReasonBindsNewMcp,
11716
11771
  shouldSkipRevokedCleanup,
11717
11772
  shouldUpdateOnLatest,
11718
11773
  stampClaudeCodeUpgradeMarker,