@integrity-labs/agt-cli 0.28.411 → 0.28.413

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-YE2Q5LSK.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-EDUFOS36.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-253N4REG.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-BMYJSZIZ.js.map
@@ -45,7 +45,7 @@ import {
45
45
  resolveEffectivePinRaw,
46
46
  safeWriteJsonAtomic,
47
47
  setConfigHash
48
- } from "../chunk-JIT5ORMO.js";
48
+ } from "../chunk-GRXN3X33.js";
49
49
  import {
50
50
  getProjectDir as getProjectDir2,
51
51
  getReadyTasks,
@@ -148,7 +148,7 @@ import {
148
148
  toOpencodeModel,
149
149
  transcriptActivityAgeSeconds,
150
150
  writeEgressAllowlist
151
- } from "../chunk-D4MDIZ3T.js";
151
+ } from "../chunk-QZUKHEMO.js";
152
152
  import {
153
153
  reapOrphanChannelMcps
154
154
  } from "../chunk-XWVM4KPK.js";
@@ -1348,6 +1348,28 @@ function restartTargetsOpencodeServe(framework) {
1348
1348
  return framework === "opencode";
1349
1349
  }
1350
1350
 
1351
+ // src/lib/agent-runtime-teardown.ts
1352
+ function claudeTmuxSession(codeName) {
1353
+ return `agt-${codeName}`;
1354
+ }
1355
+ function stopAgentRuntime(codeName, reason, log2, deps) {
1356
+ const step = (label, run) => {
1357
+ try {
1358
+ run();
1359
+ } catch (err) {
1360
+ log2(`[teardown] ${label} failed for '${codeName}' (${reason}): ${err.message}`);
1361
+ }
1362
+ };
1363
+ step("channel-ingest", () => deps.stopManagerHeldChannelIngest(codeName, log2));
1364
+ step("opencode-serve", () => deps.stopOpencodeServe(codeName, log2));
1365
+ step("claude-session", () => deps.stopClaudePersistentSession(codeName));
1366
+ step("claude-pane", () => {
1367
+ if (deps.killTmuxSession(claudeTmuxSession(codeName))) {
1368
+ log2(`[teardown] killed claude pane '${claudeTmuxSession(codeName)}' for '${codeName}' (${reason})`);
1369
+ }
1370
+ });
1371
+ }
1372
+
1351
1373
  // src/lib/connectivity-probe-runner.ts
1352
1374
  var DEFAULT_INTERVAL_MS = 60 * 60 * 1e3;
1353
1375
  var DEFAULT_MAX_PER_RUN = 25;
@@ -9212,6 +9234,27 @@ function stopPersistentSessionAndForgetMcpBaseline(codeName, breakerReason, gate
9212
9234
  }
9213
9235
  }
9214
9236
  }
9237
+ var agentRuntimeTeardownDeps = {
9238
+ stopOpencodeServe: (codeName, teardownLog) => stopOpencodeSession(codeName, teardownLog),
9239
+ stopManagerHeldChannelIngest: (codeName, teardownLog) => {
9240
+ stopOpencodeSlackIngest(codeName, teardownLog);
9241
+ stopOpencodeTelegramIngest(codeName, teardownLog);
9242
+ },
9243
+ // No breaker reason: a deprovision is intentional and must not count against
9244
+ // the restart circuit breaker (see stopPersistentSessionAndForgetMcpBaseline).
9245
+ stopClaudePersistentSession: (codeName) => stopPersistentSessionAndForgetMcpBaseline(codeName),
9246
+ killTmuxSession: (sessionName) => {
9247
+ try {
9248
+ syncExecFile("tmux", ["kill-session", "-t", sessionName], { stdio: "ignore" });
9249
+ return true;
9250
+ } catch {
9251
+ return false;
9252
+ }
9253
+ }
9254
+ };
9255
+ function stopAgentRuntime2(codeName, reason) {
9256
+ stopAgentRuntime(codeName, reason, log, agentRuntimeTeardownDeps);
9257
+ }
9215
9258
  function checkMcpConfigDriftAndScheduleRestart(codeName, projectDir) {
9216
9259
  const currentHash = projectMcpHash(codeName, projectDir);
9217
9260
  const action = decideMcpDriftAction(currentHash, runningMcpHashes.get(codeName));
@@ -9378,7 +9421,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9378
9421
  var lastVersionCheckAt = 0;
9379
9422
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9380
9423
  var lastResponsivenessProbeAt = 0;
9381
- var agtCliVersion = true ? "0.28.411" : "dev";
9424
+ var agtCliVersion = true ? "0.28.413" : "dev";
9382
9425
  function resolveBrewPath(execFileSync2) {
9383
9426
  try {
9384
9427
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -10526,7 +10569,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
10526
10569
  if (codeNames.length === 0) return;
10527
10570
  void (async () => {
10528
10571
  try {
10529
- const { collectDiagnostics } = await import("../persistent-session-YE2Q5LSK.js");
10572
+ const { collectDiagnostics } = await import("../persistent-session-EDUFOS36.js");
10530
10573
  await api.post("/host/heartbeat", {
10531
10574
  host_id: hostId,
10532
10575
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor)
@@ -10633,7 +10676,7 @@ async function pollCycle() {
10633
10676
  }
10634
10677
  try {
10635
10678
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
10636
- const { collectDiagnostics } = await import("../persistent-session-YE2Q5LSK.js");
10679
+ const { collectDiagnostics } = await import("../persistent-session-EDUFOS36.js");
10637
10680
  const diagCodeNames = [...agentState.persistentSessionAgents];
10638
10681
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor) : void 0;
10639
10682
  let tailscaleHostname;
@@ -10746,7 +10789,7 @@ async function pollCycle() {
10746
10789
  const {
10747
10790
  collectResponsivenessProbes,
10748
10791
  getResponsivenessIntervalMs
10749
- } = await import("../responsiveness-probe-QO4EHFCH.js");
10792
+ } = await import("../responsiveness-probe-SVTUFKX5.js");
10750
10793
  const probeIntervalMs = getResponsivenessIntervalMs();
10751
10794
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
10752
10795
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -10778,7 +10821,7 @@ async function pollCycle() {
10778
10821
  collectResponsivenessProbes,
10779
10822
  livePendingInboundOldestAgeSeconds,
10780
10823
  parkPendingInbound
10781
- } = await import("../responsiveness-probe-QO4EHFCH.js");
10824
+ } = await import("../responsiveness-probe-SVTUFKX5.js");
10782
10825
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-HYOOQV4A.js");
10783
10826
  const wedgeNow = /* @__PURE__ */ new Date();
10784
10827
  const liveAgents = agentState.persistentSessionAgents;
@@ -11142,12 +11185,7 @@ async function pollCycle() {
11142
11185
  if (!currentIds.has(prev.agentId)) {
11143
11186
  log(`Agent '${prev.codeName}' removed from host (deleted or unassigned)`);
11144
11187
  const adapter = resolveAgentFramework(prev.codeName);
11145
- stopPersistentSessionAndForgetMcpBaseline(prev.codeName);
11146
- try {
11147
- const { execSync: es } = await import("child_process");
11148
- es(`tmux kill-session -t agt-${prev.codeName} 2>/dev/null`, { stdio: "ignore" });
11149
- } catch {
11150
- }
11188
+ stopAgentRuntime2(prev.codeName, "removed-from-host");
11151
11189
  killAgentChannelProcesses(prev.codeName, { log });
11152
11190
  const agentDir = join22(adapter.getAgentDir(prev.codeName), "provision");
11153
11191
  await cleanupAgentFiles(prev.codeName, agentDir);
@@ -11393,13 +11431,7 @@ async function processAgent(agent, agentStates) {
11393
11431
  } else if (killPausedCodeNames.delete(agent.code_name)) {
11394
11432
  log(`[kill-switch] '${agent.code_name}' kill switch cleared while still ${agent.status} (no resume \u2014 paused for another reason)`);
11395
11433
  }
11396
- stopPersistentSessionAndForgetMcpBaseline(agent.code_name);
11397
- try {
11398
- const { execSync: es } = await import("child_process");
11399
- es(`tmux kill-session -t agt-${agent.code_name} 2>/dev/null`, { stdio: "ignore" });
11400
- log(`Killed tmux session for paused agent '${agent.code_name}'`);
11401
- } catch {
11402
- }
11434
+ stopAgentRuntime2(agent.code_name, agent.status);
11403
11435
  if (agent.status === "paused" && !agent.kill_switch) {
11404
11436
  maybeAutoResume(agent);
11405
11437
  }
@@ -11447,12 +11479,7 @@ async function processAgent(agent, agentStates) {
11447
11479
  );
11448
11480
  }
11449
11481
  log(`Agent '${agent.code_name}' is revoked, cleaning up`);
11450
- stopPersistentSessionAndForgetMcpBaseline(agent.code_name);
11451
- try {
11452
- const { execSync: es } = await import("child_process");
11453
- es(`tmux kill-session -t agt-${agent.code_name} 2>/dev/null`, { stdio: "ignore" });
11454
- } catch {
11455
- }
11482
+ stopAgentRuntime2(agent.code_name, "revoked");
11456
11483
  killAgentChannelProcesses(agent.code_name, { log });
11457
11484
  await cleanupAgentFiles(agent.code_name, agentDir);
11458
11485
  clearAgentCaches(agent.agent_id, agent.code_name);
@@ -14082,7 +14109,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
14082
14109
  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}`));
14083
14110
  void (async () => {
14084
14111
  try {
14085
- const { collectDiagnostics } = await import("../persistent-session-YE2Q5LSK.js");
14112
+ const { collectDiagnostics } = await import("../persistent-session-EDUFOS36.js");
14086
14113
  await api.post("/host/heartbeat", {
14087
14114
  host_id: hostId,
14088
14115
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor)
@@ -14132,7 +14159,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
14132
14159
  }
14133
14160
  try {
14134
14161
  const hostId = await getHostId();
14135
- const { collectDiagnostics } = await import("../persistent-session-YE2Q5LSK.js");
14162
+ const { collectDiagnostics } = await import("../persistent-session-EDUFOS36.js");
14136
14163
  await api.post("/host/heartbeat", {
14137
14164
  host_id: hostId,
14138
14165
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor)
@@ -14585,7 +14612,7 @@ async function processClaudePairSessions(agents) {
14585
14612
  killPairSession,
14586
14613
  pairTmuxSession,
14587
14614
  finalizeClaudePairOnboarding
14588
- } = await import("../claude-pair-runtime-253N4REG.js");
14615
+ } = await import("../claude-pair-runtime-BMYJSZIZ.js");
14589
14616
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
14590
14617
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
14591
14618
  const killed = await killPairSession(pairTmuxSession(pairId));