@integrity-labs/agt-cli 0.28.636 → 0.28.638

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.
@@ -16,7 +16,7 @@ import {
16
16
  rotateDailySession,
17
17
  sessionFileExists,
18
18
  todayLocalIso
19
- } from "./chunk-O4ADFO57.js";
19
+ } from "./chunk-MAZUBHNT.js";
20
20
  import {
21
21
  reapOrphanChannelMcps
22
22
  } from "./chunk-XWVM4KPK.js";
@@ -4313,4 +4313,4 @@ export {
4313
4313
  stopAllSessionsAndWait,
4314
4314
  getProjectDir
4315
4315
  };
4316
- //# sourceMappingURL=chunk-4HVSMJFM.js.map
4316
+ //# sourceMappingURL=chunk-MRQ2GRTN.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-7UX2BZMT.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-NMGMDXTO.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-TROVZ3M5.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-EZUIIJYB.js.map
@@ -15,6 +15,7 @@ import {
15
15
  decidePin,
16
16
  defaultFlagsCachePath,
17
17
  deriveMcpServerKey,
18
+ describeStartupCompletion,
18
19
  diffEnvIntegrations,
19
20
  envOnlyRespawnVars,
20
21
  exchangeApiKey,
@@ -54,7 +55,7 @@ import {
54
55
  safeWriteJsonAtomic,
55
56
  setConfigHash,
56
57
  tripClass
57
- } from "../chunk-KIOTRBOI.js";
58
+ } from "../chunk-LCKKFDCR.js";
58
59
  import {
59
60
  getProjectDir as getProjectDir2,
60
61
  getReadyTasks,
@@ -110,7 +111,7 @@ import {
110
111
  takeZombieDetection,
111
112
  toOpencodeModel,
112
113
  writeEgressAllowlist
113
- } from "../chunk-4HVSMJFM.js";
114
+ } from "../chunk-MRQ2GRTN.js";
114
115
  import {
115
116
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
116
117
  AnchorSessionClient,
@@ -187,7 +188,7 @@ import {
187
188
  subagentActivityAgeSeconds,
188
189
  sumTranscriptUsageInWindow,
189
190
  transcriptActivityAgeSeconds
190
- } from "../chunk-O4ADFO57.js";
191
+ } from "../chunk-MAZUBHNT.js";
191
192
  import {
192
193
  reapOrphanChannelMcps
193
194
  } from "../chunk-XWVM4KPK.js";
@@ -1273,15 +1274,21 @@ function decideStaleTripClear(opts) {
1273
1274
 
1274
1275
  // src/lib/pending-suppression-reports.ts
1275
1276
  var pending = /* @__PURE__ */ new Map();
1276
- function queueSuppressionReport(codeName, payload) {
1277
- pending.set(codeName, payload);
1278
- }
1279
- function takeSuppressionReport(codeName, agentId) {
1280
- const payload = pending.get(codeName);
1281
- if (!payload) return null;
1282
- if (!agentId) return null;
1277
+ function queueSuppressionReport(codeName, reason, payload) {
1278
+ let byReason = pending.get(codeName);
1279
+ if (!byReason) {
1280
+ byReason = /* @__PURE__ */ new Map();
1281
+ pending.set(codeName, byReason);
1282
+ }
1283
+ byReason.set(reason, { ...payload, reason });
1284
+ }
1285
+ function takeSuppressionReports(codeName, agentId) {
1286
+ const byReason = pending.get(codeName);
1287
+ if (!byReason || byReason.size === 0) return [];
1288
+ if (!agentId) return [];
1289
+ const payloads = [...byReason.values()];
1283
1290
  pending.delete(codeName);
1284
- return payload;
1291
+ return payloads;
1285
1292
  }
1286
1293
 
1287
1294
  // src/lib/resume-reconciler.ts
@@ -1612,32 +1619,6 @@ function formatMissingMcpBundles(missing) {
1612
1619
  return `MCP bundle(s) not yet on disk in the host-shared _mcp mount: ${detail}`;
1613
1620
  }
1614
1621
 
1615
- // src/lib/startup-telemetry.ts
1616
- var SLOW_STARTUP_WARN_MS = 6e4;
1617
- function shouldWarnSlowStartup(elapsedMs, opts = {}) {
1618
- if (!Number.isFinite(elapsedMs) || elapsedMs < 0) return false;
1619
- const threshold = opts.thresholdMs ?? SLOW_STARTUP_WARN_MS;
1620
- if (!Number.isFinite(threshold) || threshold < 0) return false;
1621
- return elapsedMs >= threshold;
1622
- }
1623
- function formatStartupElapsed(elapsedMs) {
1624
- if (!Number.isFinite(elapsedMs) || elapsedMs < 0) return "unknown";
1625
- const seconds = elapsedMs / 1e3;
1626
- if (seconds < 60) return `${seconds.toFixed(1)}s`;
1627
- return `${seconds.toFixed(1)}s (${(seconds / 60).toFixed(1)} min)`;
1628
- }
1629
- function describeStartupCompletion(elapsedMs, opts = {}) {
1630
- const elapsed = formatStartupElapsed(elapsedMs);
1631
- if (!shouldWarnSlowStartup(elapsedMs, opts)) {
1632
- return { warn: false, message: `[startup] ready in ${elapsed}` };
1633
- }
1634
- const threshold = opts.thresholdMs ?? SLOW_STARTUP_WARN_MS;
1635
- return {
1636
- warn: true,
1637
- message: `[startup] SLOW BOOT \u2014 ready in ${elapsed}, over the ${formatStartupElapsed(threshold)} threshold. MCP bundles are deployed during startup, so agents spawning in this window can come up with no MCP tools (ENG-9129). Check for a build/install running on the host.`
1638
- };
1639
- }
1640
-
1641
1622
  // src/lib/self-update-coalesce.ts
1642
1623
  import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
1643
1624
  import { dirname as dirname3 } from "path";
@@ -10895,6 +10876,28 @@ function recordRestartForBreaker(codeName, reason) {
10895
10876
  }
10896
10877
  }
10897
10878
  const result = restartBreaker.record(codeName, reason, integrationKey);
10879
+ if (result.scheduledLoop) {
10880
+ const { count, windowMs, reason: loopReason } = result.scheduledLoop;
10881
+ const windowMins = Math.round(windowMs / 6e4);
10882
+ log(
10883
+ `[restart-breaker] agent=${codeName} SCHEDULED-RESTART LOOP: ${count} '${loopReason}' restarts in ${windowMins}m. A correct day rollover fires ONCE per agent per day, so this is a platform bug, not an unhealthy agent. The agent is deliberately NOT paused (ENG-9138) \u2014 reporting it instead so somebody fixes the rollover.`
10884
+ );
10885
+ queueSuppressionReport(codeName, "scheduled_rollover_loop", {
10886
+ trip_class: "scheduled",
10887
+ // No integration is involved in a scheduled restart, and the route renders
10888
+ // an empty key as "an unattributed integration" rather than inventing one.
10889
+ bucket_key: "",
10890
+ bucket_count: count,
10891
+ scheduled_window_ms: windowMs,
10892
+ scheduled_reason: loopReason,
10893
+ // Not applicable: this suppression has nothing to do with the agent's age
10894
+ // or the new-agent grace. Sent as null rather than 0, which would read as
10895
+ // "brand new" — the one wrong answer (same reasoning as ENG-8679 AC4).
10896
+ agent_age_ms: null,
10897
+ grace_expires_at: null
10898
+ });
10899
+ maybeReportPendingSuppression(codeName);
10900
+ }
10898
10901
  if (!result.tripped || !result.trip) {
10899
10902
  if (isProvisioningReloadReason(reason) && result.maxProvisioningBucket >= RESTART_BREAKER_PROVISIONING_MAX) {
10900
10903
  const culprit = result.maxProvisioningBucketKey ? ` [${result.maxProvisioningBucketKey}]` : "";
@@ -10928,7 +10931,7 @@ function recordRestartForBreaker(codeName, reason) {
10928
10931
  agent_age_ms: sup ? sup.agentAgeMs : null,
10929
10932
  grace_expires_at: result.newAgentGraceExpiresAt ?? null
10930
10933
  };
10931
- queueSuppressionReport(codeName, suppressionPayload);
10934
+ queueSuppressionReport(codeName, "new_agent_grace", suppressionPayload);
10932
10935
  if (!agentState.codeNameToAgentId.has(codeName)) {
10933
10936
  log(
10934
10937
  `[restart-breaker] agent=${codeName} suppression report DEFERRED: no agent_id known yet (cold-start before processAgent). The local suppression still applied; the report is queued and will be sent on the next poll once the id is cached (ENG-8679).`
@@ -10966,13 +10969,15 @@ function maybeReportCurrentTrip(codeName) {
10966
10969
  }
10967
10970
  function maybeReportPendingSuppression(codeName) {
10968
10971
  const agentId = agentState.codeNameToAgentId.get(codeName);
10969
- const payload = takeSuppressionReport(codeName, agentId);
10970
- if (!payload || !agentId) return;
10971
- void api.post("/host/circuit-breaker/suppressed", { agent_id: agentId, ...payload }).catch((err) => {
10972
- log(
10973
- `[restart-breaker] agent=${codeName} suppression report failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`
10974
- );
10975
- });
10972
+ const payloads = takeSuppressionReports(codeName, agentId);
10973
+ if (payloads.length === 0 || !agentId) return;
10974
+ for (const payload of payloads) {
10975
+ void api.post("/host/circuit-breaker/suppressed", { agent_id: agentId, ...payload }).catch((err) => {
10976
+ log(
10977
+ `[restart-breaker] agent=${codeName} suppression report failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`
10978
+ );
10979
+ });
10980
+ }
10976
10981
  }
10977
10982
  function maybeClearStaleTrip(agent) {
10978
10983
  const codeName = agent.code_name;
@@ -11492,7 +11497,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
11492
11497
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
11493
11498
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
11494
11499
  async function channelInboundActivityAgeSecondsFor(codeName) {
11495
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-BQCFTEK5.js");
11500
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-ZUFKGLDN.js");
11496
11501
  const newest = newestPendingInboundActivityMtimeMs(dirname9(paneLogPath(codeName)));
11497
11502
  if (newest === null) return null;
11498
11503
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -12135,7 +12140,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
12135
12140
  var lastVersionCheckAt = 0;
12136
12141
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12137
12142
  var lastResponsivenessProbeAt = 0;
12138
- var agtCliVersion = true ? "0.28.636" : "dev";
12143
+ var agtCliVersion = true ? "0.28.638" : "dev";
12139
12144
  function resolveBrewPath(execFileSync3) {
12140
12145
  try {
12141
12146
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -13442,7 +13447,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
13442
13447
  if (codeNames.length === 0) return;
13443
13448
  void (async () => {
13444
13449
  try {
13445
- const { collectDiagnostics } = await import("../persistent-session-7UX2BZMT.js");
13450
+ const { collectDiagnostics } = await import("../persistent-session-NMGMDXTO.js");
13446
13451
  await api.post("/host/heartbeat", {
13447
13452
  host_id: hostId,
13448
13453
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -13558,7 +13563,7 @@ async function pollCycleInner() {
13558
13563
  }
13559
13564
  try {
13560
13565
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
13561
- const { collectDiagnostics } = await import("../persistent-session-7UX2BZMT.js");
13566
+ const { collectDiagnostics } = await import("../persistent-session-NMGMDXTO.js");
13562
13567
  const diagCodeNames = [...agentState.persistentSessionAgents];
13563
13568
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor) : void 0;
13564
13569
  let tailscaleHostname;
@@ -13681,7 +13686,7 @@ async function pollCycleInner() {
13681
13686
  collectPanelessActivityProbes,
13682
13687
  getResponsivenessIntervalMs,
13683
13688
  occupancyQualificationClassifications
13684
- } = await import("../responsiveness-probe-BQCFTEK5.js");
13689
+ } = await import("../responsiveness-probe-ZUFKGLDN.js");
13685
13690
  const probeIntervalMs = getResponsivenessIntervalMs();
13686
13691
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
13687
13692
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -13787,7 +13792,7 @@ async function pollCycleInner() {
13787
13792
  collectResponsivenessProbes,
13788
13793
  livePendingInboundOldestAgeSeconds,
13789
13794
  parkPendingInbound
13790
- } = await import("../responsiveness-probe-BQCFTEK5.js");
13795
+ } = await import("../responsiveness-probe-ZUFKGLDN.js");
13791
13796
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
13792
13797
  const wedgeNow = /* @__PURE__ */ new Date();
13793
13798
  const liveAgents = agentState.persistentSessionAgents;
@@ -13943,7 +13948,7 @@ async function pollCycleInner() {
13943
13948
  }
13944
13949
  try {
13945
13950
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-JA437JIB.js");
13946
- const { probeSessionAuth } = await import("../session-auth-dead-TV2M6AFN.js");
13951
+ const { probeSessionAuth } = await import("../session-auth-dead-TDWEX7R5.js");
13947
13952
  const observations = [];
13948
13953
  const pendingCacheCommits = [];
13949
13954
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -17510,7 +17515,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
17510
17515
  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}`));
17511
17516
  void (async () => {
17512
17517
  try {
17513
- const { collectDiagnostics } = await import("../persistent-session-7UX2BZMT.js");
17518
+ const { collectDiagnostics } = await import("../persistent-session-NMGMDXTO.js");
17514
17519
  await api.post("/host/heartbeat", {
17515
17520
  host_id: hostId,
17516
17521
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -17561,7 +17566,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
17561
17566
  }
17562
17567
  try {
17563
17568
  const hostId = await getHostId();
17564
- const { collectDiagnostics } = await import("../persistent-session-7UX2BZMT.js");
17569
+ const { collectDiagnostics } = await import("../persistent-session-NMGMDXTO.js");
17565
17570
  await api.post("/host/heartbeat", {
17566
17571
  host_id: hostId,
17567
17572
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -18157,7 +18162,7 @@ async function processClaudePairSessions(agents) {
18157
18162
  killPairSession,
18158
18163
  pairTmuxSession,
18159
18164
  finalizeClaudePairOnboarding
18160
- } = await import("../claude-pair-runtime-TROVZ3M5.js");
18165
+ } = await import("../claude-pair-runtime-EZUIIJYB.js");
18161
18166
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
18162
18167
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
18163
18168
  const killed = await killPairSession(pairTmuxSession(pairId));