@integrity-labs/agt-cli 0.28.57 → 0.28.59

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.
@@ -3,7 +3,7 @@ import {
3
3
  formatMissingVar,
4
4
  isClaudeFastMode,
5
5
  probeMcpEnvSubstitution
6
- } from "./chunk-SJRG5VUF.js";
6
+ } from "./chunk-OEZEWEEG.js";
7
7
  import {
8
8
  reapOrphanChannelMcps
9
9
  } from "./chunk-XWVM4KPK.js";
@@ -1395,4 +1395,4 @@ export {
1395
1395
  stopAllSessionsAndWait,
1396
1396
  getProjectDir
1397
1397
  };
1398
- //# sourceMappingURL=chunk-MKKTPM6J.js.map
1398
+ //# sourceMappingURL=chunk-UA3LEZL4.js.map
@@ -22,7 +22,7 @@ import {
22
22
  resolveConnectivityProbe,
23
23
  worseConnectivityOutcome,
24
24
  wrapScheduledTaskPrompt
25
- } from "./chunk-SJRG5VUF.js";
25
+ } from "./chunk-OEZEWEEG.js";
26
26
 
27
27
  // ../../packages/core/dist/integrations/registry.js
28
28
  var INTEGRATION_REGISTRY = [
@@ -7355,7 +7355,7 @@ function requireHost() {
7355
7355
  }
7356
7356
 
7357
7357
  // src/lib/api-client.ts
7358
- var agtCliVersion = true ? "0.28.57" : "dev";
7358
+ var agtCliVersion = true ? "0.28.59" : "dev";
7359
7359
  var lastConfigHash = null;
7360
7360
  function setConfigHash(hash) {
7361
7361
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8651,4 +8651,4 @@ export {
8651
8651
  managerInstallSystemUnitCommand,
8652
8652
  managerUninstallSystemUnitCommand
8653
8653
  };
8654
- //# sourceMappingURL=chunk-F45T5XPH.js.map
8654
+ //# sourceMappingURL=chunk-ZNOAT5RQ.js.map
@@ -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-INTCKEG6.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-42V6NGMR.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-RAAIXOKO.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-VSXYDPST.js.map
@@ -27,7 +27,7 @@ import {
27
27
  requireHost,
28
28
  safeWriteJsonAtomic,
29
29
  setConfigHash
30
- } from "../chunk-F45T5XPH.js";
30
+ } from "../chunk-ZNOAT5RQ.js";
31
31
  import {
32
32
  getProjectDir as getProjectDir2,
33
33
  getReadyTasks,
@@ -65,7 +65,7 @@ import {
65
65
  takeWatchdogGiveUpCount,
66
66
  takeZombieDetection,
67
67
  transcriptActivityAgeSeconds
68
- } from "../chunk-MKKTPM6J.js";
68
+ } from "../chunk-UA3LEZL4.js";
69
69
  import {
70
70
  FLAGS_SCHEMA_VERSION,
71
71
  FLAG_REGISTRY,
@@ -96,7 +96,7 @@ import {
96
96
  resolveDmTarget,
97
97
  sumTranscriptUsageInWindow,
98
98
  wrapScheduledTaskPrompt
99
- } from "../chunk-SJRG5VUF.js";
99
+ } from "../chunk-OEZEWEEG.js";
100
100
  import {
101
101
  parsePsRows,
102
102
  reapOrphanChannelMcps
@@ -1512,9 +1512,13 @@ var GATEABLE_RESTART_REASONS = /* @__PURE__ */ new Set([
1512
1512
  function isGateableRestartReason(reason) {
1513
1513
  return reason != null && GATEABLE_RESTART_REASONS.has(reason);
1514
1514
  }
1515
+ var WINDOW_EXEMPT_RESTART_REASONS = /* @__PURE__ */ new Set(["channel-set-change"]);
1516
+ function isWindowExemptRestartReason(reason) {
1517
+ return reason != null && WINDOW_EXEMPT_RESTART_REASONS.has(reason);
1518
+ }
1515
1519
  function decideRestartGate(opts) {
1516
1520
  if (isMaintenanceWindowDisabled(opts.env)) return "proceed";
1517
- if (opts.window && !isWithinMaintenanceWindow(opts.window, opts.now)) {
1521
+ if (!opts.windowExempt && opts.window && !isWithinMaintenanceWindow(opts.window, opts.now)) {
1518
1522
  return "defer-window";
1519
1523
  }
1520
1524
  const paneThreshold = opts.idleThresholdSeconds ?? RESTART_IDLE_THRESHOLD_SECONDS;
@@ -6281,10 +6285,17 @@ async function maybeResumeReconcile(agent) {
6281
6285
  autoResumeInFlight.delete(codeName);
6282
6286
  }
6283
6287
  }
6284
- function scheduleSessionRestart(codeName, delayMs, reason, breakerReason = "hot-reload-mcp") {
6288
+ function scheduleSessionRestart(codeName, delayMs, reason, breakerReason = "hot-reload-mcp", beforeStop) {
6285
6289
  const existing = pendingSessionRestarts.get(codeName);
6286
6290
  if (existing) {
6287
- clearTimeout(existing);
6291
+ const keepExistingWindowExempt = isWindowExemptRestartReason(existing.breakerReason) && !isWindowExemptRestartReason(breakerReason);
6292
+ if (keepExistingWindowExempt) {
6293
+ log(
6294
+ `[hot-reload] Coalesced restart for '${codeName}': keeping the already-scheduled window-exempt '${existing.reason}' (${existing.breakerReason}); ignoring lower-priority '${reason}' (${breakerReason}) (ENG-6491)`
6295
+ );
6296
+ return;
6297
+ }
6298
+ clearTimeout(existing.timer);
6288
6299
  log(`[hot-reload] Coalesced restart for '${codeName}': replacing pending timer with ${reason}`);
6289
6300
  }
6290
6301
  const timer = setTimeout(() => {
@@ -6298,7 +6309,7 @@ function scheduleSessionRestart(codeName, delayMs, reason, breakerReason = "hot-
6298
6309
  );
6299
6310
  deferLogThrottle.set(codeName, Date.now());
6300
6311
  }
6301
- scheduleSessionRestart(codeName, RESTART_DEFER_RECHECK_MS, reason, breakerReason);
6312
+ scheduleSessionRestart(codeName, RESTART_DEFER_RECHECK_MS, reason, breakerReason, beforeStop);
6302
6313
  return;
6303
6314
  }
6304
6315
  deferLogThrottle.delete(codeName);
@@ -6308,11 +6319,18 @@ function scheduleSessionRestart(codeName, delayMs, reason, breakerReason = "hot-
6308
6319
  );
6309
6320
  return;
6310
6321
  }
6322
+ if (beforeStop) {
6323
+ try {
6324
+ beforeStop();
6325
+ } catch (err) {
6326
+ log(`[hot-reload] beforeStop hook threw for '${codeName}' (non-fatal): ${err.message}`);
6327
+ }
6328
+ }
6311
6329
  stopPersistentSession(codeName, log);
6312
6330
  runningMcpHashes.delete(codeName);
6313
6331
  recordRestartForBreaker(codeName, breakerReason);
6314
6332
  log(`[hot-reload] Session stopped for '${codeName}' \u2014 will respawn with ${reason}`);
6315
- if (breakerReason === "hot-reload-mcp" || breakerReason === "bind-remediation") {
6333
+ if (breakerReason === "hot-reload-mcp" || breakerReason === "bind-remediation" || breakerReason === "channel-set-change") {
6316
6334
  const prior = pendingRestartVerifications.get(codeName);
6317
6335
  pendingRestartVerifications.set(codeName, {
6318
6336
  firedAt: Date.now(),
@@ -6321,13 +6339,13 @@ function scheduleSessionRestart(codeName, delayMs, reason, breakerReason = "hot-
6321
6339
  }
6322
6340
  }, delayMs);
6323
6341
  timer.unref?.();
6324
- pendingSessionRestarts.set(codeName, timer);
6342
+ pendingSessionRestarts.set(codeName, { timer, reason, breakerReason, beforeStop });
6325
6343
  }
6326
6344
  function cancelPendingSessionRestart(codeName) {
6327
6345
  pendingRestartVerifications.delete(codeName);
6328
6346
  const existing = pendingSessionRestarts.get(codeName);
6329
6347
  if (!existing) return;
6330
- clearTimeout(existing);
6348
+ clearTimeout(existing.timer);
6331
6349
  pendingSessionRestarts.delete(codeName);
6332
6350
  deferLogThrottle.delete(codeName);
6333
6351
  log(`[hot-reload] Cancelled pending restart timer for '${codeName}' (another teardown path is handling it)`);
@@ -6415,6 +6433,9 @@ function restartGateFor(codeName, reason) {
6415
6433
  if (!isGateableRestartReason(reason)) return "bypass";
6416
6434
  return decideRestartGate({
6417
6435
  window: cachedMaintenanceWindow,
6436
+ // ENG-6491: channel adds (channel-set-change) skip the off-peak window but
6437
+ // still defer-until-idle — they come online as soon as the agent is quiet.
6438
+ windowExempt: isWindowExemptRestartReason(reason),
6418
6439
  paneLogAgeSeconds: paneLogAgeSecondsFor(codeName),
6419
6440
  transcriptAgeSeconds: transcriptAgeSecondsFor(codeName),
6420
6441
  inboundAgeSeconds: inboundAgeSecondsFor(codeName),
@@ -6680,7 +6701,7 @@ var cachedMaintenanceWindow = null;
6680
6701
  var lastVersionCheckAt = 0;
6681
6702
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
6682
6703
  var lastResponsivenessProbeAt = 0;
6683
- var agtCliVersion = true ? "0.28.57" : "dev";
6704
+ var agtCliVersion = true ? "0.28.59" : "dev";
6684
6705
  function resolveBrewPath(execFileSync4) {
6685
6706
  try {
6686
6707
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -7788,7 +7809,7 @@ async function pollCycle() {
7788
7809
  }
7789
7810
  try {
7790
7811
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
7791
- const { collectDiagnostics } = await import("../persistent-session-INTCKEG6.js");
7812
+ const { collectDiagnostics } = await import("../persistent-session-42V6NGMR.js");
7792
7813
  const diagCodeNames = [...agentState.persistentSessionAgents];
7793
7814
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
7794
7815
  let tailscaleHostname;
@@ -7889,7 +7910,7 @@ async function pollCycle() {
7889
7910
  const {
7890
7911
  collectResponsivenessProbes,
7891
7912
  getResponsivenessIntervalMs
7892
- } = await import("../responsiveness-probe-XAYQAVLV.js");
7913
+ } = await import("../responsiveness-probe-YSSYWWTG.js");
7893
7914
  const probeIntervalMs = getResponsivenessIntervalMs();
7894
7915
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
7895
7916
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -7921,7 +7942,7 @@ async function pollCycle() {
7921
7942
  collectResponsivenessProbes,
7922
7943
  livePendingInboundOldestAgeSeconds,
7923
7944
  parkPendingInbound
7924
- } = await import("../responsiveness-probe-XAYQAVLV.js");
7945
+ } = await import("../responsiveness-probe-YSSYWWTG.js");
7925
7946
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
7926
7947
  const wedgeNow = /* @__PURE__ */ new Date();
7927
7948
  const liveAgents = agentState.persistentSessionAgents;
@@ -9012,7 +9033,31 @@ async function processAgent(agent, agentStates) {
9012
9033
  if (!delivered) {
9013
9034
  log(`[hot-reload] Inject notification unconfirmed for '${agent.code_name}' \u2014 proceeding with shorter delay`);
9014
9035
  }
9015
- scheduleSessionRestart(agent.code_name, delay, "new channel set");
9036
+ const isChannelAddRestart = restartDecision.added.length > 0;
9037
+ const addedChannels = [...restartDecision.added];
9038
+ const writeDmNoticeMarkers = isChannelAddRestart ? () => {
9039
+ try {
9040
+ const agentAugmentedDir = join16(homedir9(), ".augmented", agent.code_name);
9041
+ mkdirSync5(agentAugmentedDir, { recursive: true });
9042
+ const markerJson = JSON.stringify({
9043
+ version: 1,
9044
+ at: (/* @__PURE__ */ new Date()).toISOString(),
9045
+ added: addedChannels
9046
+ });
9047
+ for (const file of ["slack-channel-add-restart.json", "telegram-channel-add-restart.json"]) {
9048
+ atomicWriteFileSync(join16(agentAugmentedDir, file), markerJson);
9049
+ }
9050
+ } catch (err) {
9051
+ log(`[hot-reload] channel-add DM-notice marker write failed for '${agent.code_name}' (non-fatal): ${err.message}`);
9052
+ }
9053
+ } : void 0;
9054
+ scheduleSessionRestart(
9055
+ agent.code_name,
9056
+ delay,
9057
+ "new channel set",
9058
+ isChannelAddRestart ? "channel-set-change" : "hot-reload-mcp",
9059
+ writeDmNoticeMarkers
9060
+ );
9016
9061
  }
9017
9062
  if (channelConfigConverged) {
9018
9063
  const hasSenderPolicyChannel = currentChannelIds.has("slack") || currentChannelIds.has("msteams");
@@ -11331,7 +11376,7 @@ async function processClaudePairSessions(agents) {
11331
11376
  killPairSession,
11332
11377
  pairTmuxSession,
11333
11378
  finalizeClaudePairOnboarding
11334
- } = await import("../claude-pair-runtime-RAAIXOKO.js");
11379
+ } = await import("../claude-pair-runtime-VSXYDPST.js");
11335
11380
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
11336
11381
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
11337
11382
  const killed = await killPairSession(pairTmuxSession(pairId));