@integrity-labs/agt-cli 0.28.824 → 0.28.826

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.
@@ -18,7 +18,7 @@ import {
18
18
  rotateDailySession,
19
19
  sessionFileExists,
20
20
  todayLocalIso
21
- } from "./chunk-PVPLNARY.js";
21
+ } from "./chunk-GJY3KZG6.js";
22
22
  import {
23
23
  reapOrphanChannelMcps
24
24
  } from "./chunk-XWVM4KPK.js";
@@ -5312,4 +5312,4 @@ export {
5312
5312
  stopAllSessionsAndWait,
5313
5313
  getProjectDir
5314
5314
  };
5315
- //# sourceMappingURL=chunk-2DT4VGWU.js.map
5315
+ //# sourceMappingURL=chunk-Q3JUZZDB.js.map
@@ -0,0 +1,19 @@
1
+ // src/lib/claude-code-brew-result.ts
2
+ var NOT_INSTALLED_RE = /is not installed/i;
3
+ function caskPresenceFromListResult(r) {
4
+ if (r.code === 0) return "present";
5
+ return NOT_INSTALLED_RE.test(`${r.stdout}
6
+ ${r.stderr}`) ? "absent" : "unknown";
7
+ }
8
+ function classifyBrewUpgradeResult(r) {
9
+ const combined = `${r.stdout}
10
+ ${r.stderr}`;
11
+ const noWorkNeeded = combined.includes("already installed") || combined.includes("up-to-date") || combined.includes("not upgraded");
12
+ if (r.code === 0) return noWorkNeeded ? "already-current" : "upgraded";
13
+ return noWorkNeeded ? "already-current" : "failed";
14
+ }
15
+ export {
16
+ caskPresenceFromListResult,
17
+ classifyBrewUpgradeResult
18
+ };
19
+ //# sourceMappingURL=claude-code-brew-result-3A4E7GTC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/claude-code-brew-result.ts"],"sourcesContent":["// ENG-10039: how to read the result of the LEGACY `brew --cask claude-code`\n// path, extracted so it can be tested without importing manager-worker.\n//\n// Same reason `claude-code-upgrade-throttle.ts` was split out under ENG-6418:\n// manager-worker is a 13k-line import graph, evaluating it inside a test's\n// budget flakes under parallel load, so the load-bearing judgement lives here\n// and manager-worker calls it.\n//\n// WHAT WENT WRONG, and it is why this is a module rather than two inline\n// conditionals. On every host provisioned since Claude Code moved to\n// `npm install -g @anthropic-ai/claude-code` (host-bootstrap.ts), there is no\n// Homebrew cask. The manager ran `brew upgrade --cask claude-code` anyway,\n// because its only precondition was \"is there a `claude` on PATH\" — and there\n// is one, at `/usr/bin/claude`, put there by npm. So the upgrade failed with\n// `Error: Cask 'claude-code' is not installed.` every day, on 7 of 10 hosts\n// measured, oldest at least 9 days (the full retained-log window on agt-aws-1:\n// 9 attempts, 9 failures, zero successes).\n//\n// It was invisible because it is only a log line: no alert kind covers it.\n\n/**\n * What `brew list --cask claude-code` actually told us.\n *\n * THREE STATES, NOT TWO, and the third is the one that matters (CodeRabbit on\n * #5616). `runAsync` RESOLVES with a non-zero exit code rather than rejecting,\n * and Homebrew uses non-zero exits for operational errors too — a network\n * failure, a lock, a broken tap. Mapping every non-zero code to `absent` would\n * read a transient brew error as \"this host has no cask\", skip the upgrade, and\n * because the throttle marker is stamped BEFORE the probe, suppress any retry\n * for ~24h. On a genuine cask host that is a silent missed upgrade, which is\n * the same invisible-skip shape this whole ticket exists to remove.\n *\n * So `absent` is claimed ONLY on brew's specific not-installed message.\n * Everything else non-zero is `unknown`: skip this cycle, say so, try again on\n * the next in-window poll.\n */\nexport type CaskPresence = 'present' | 'absent' | 'unknown';\n\n/**\n * Brew's wording for a cask that is not installed, e.g.\n * Error: Cask 'claude-code' is not installed.\n * Matched loosely on the stable half of the sentence rather than the whole\n * line, because the cask name is interpolated and brew has moved the\n * surrounding punctuation before.\n */\nconst NOT_INSTALLED_RE = /is not installed/i;\n\nexport function caskPresenceFromListResult(r: {\n code: number;\n stdout: string;\n stderr: string;\n}): CaskPresence {\n if (r.code === 0) return 'present';\n return NOT_INSTALLED_RE.test(`${r.stdout}\\n${r.stderr}`) ? 'absent' : 'unknown';\n}\n\nexport type BrewUpgradeVerdict = 'upgraded' | 'already-current' | 'failed';\n\n/**\n * Classify a `brew upgrade --cask claude-code` run.\n *\n * THE NON-ZERO-BUT-FINE CASE IS REAL, not defensive padding: brew exits\n * non-zero while printing `already installed` / `up-to-date` / `not upgraded`\n * for a cask that needs no work. Treating that as a failure would have made\n * this monitor cry wolf on exactly the hosts where nothing is wrong, and a\n * version check that cries wolf gets muted — after which it is worth less than\n * nothing, because everyone now believes the case is covered.\n *\n * Both streams are searched because brew is inconsistent about which one\n * carries the notice, and the auto-update banner interleaves them.\n */\nexport function classifyBrewUpgradeResult(r: {\n code: number;\n stdout: string;\n stderr: string;\n}): BrewUpgradeVerdict {\n const combined = `${r.stdout}\\n${r.stderr}`;\n const noWorkNeeded =\n combined.includes('already installed') ||\n combined.includes('up-to-date') ||\n combined.includes('not upgraded');\n\n if (r.code === 0) return noWorkNeeded ? 'already-current' : 'upgraded';\n return noWorkNeeded ? 'already-current' : 'failed';\n}\n"],"mappings":";AA6CA,IAAM,mBAAmB;AAElB,SAAS,2BAA2B,GAI1B;AACf,MAAI,EAAE,SAAS,EAAG,QAAO;AACzB,SAAO,iBAAiB,KAAK,GAAG,EAAE,MAAM;AAAA,EAAK,EAAE,MAAM,EAAE,IAAI,WAAW;AACxE;AAiBO,SAAS,0BAA0B,GAInB;AACrB,QAAM,WAAW,GAAG,EAAE,MAAM;AAAA,EAAK,EAAE,MAAM;AACzC,QAAM,eACJ,SAAS,SAAS,mBAAmB,KACrC,SAAS,SAAS,YAAY,KAC9B,SAAS,SAAS,cAAc;AAElC,MAAI,EAAE,SAAS,EAAG,QAAO,eAAe,oBAAoB;AAC5D,SAAO,eAAe,oBAAoB;AAC5C;","names":[]}
@@ -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-2Y4O3COI.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-BOHUJCZL.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-5QM5OTAZ.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-SWB525DM.js.map
@@ -59,7 +59,7 @@ import {
59
59
  safeWriteJsonAtomic,
60
60
  setConfigHash,
61
61
  tripClass
62
- } from "../chunk-LPCKIZS4.js";
62
+ } from "../chunk-JO7QTVLM.js";
63
63
  import {
64
64
  getProjectDir as getProjectDir2,
65
65
  getReadyTasks,
@@ -124,7 +124,7 @@ import {
124
124
  takeZombieDetection,
125
125
  toOpencodeModel,
126
126
  writeEgressAllowlist
127
- } from "../chunk-2DT4VGWU.js";
127
+ } from "../chunk-Q3JUZZDB.js";
128
128
  import {
129
129
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
130
130
  AnchorSessionClient,
@@ -154,6 +154,7 @@ import {
154
154
  buildFailureCategoryPromptLines,
155
155
  buildHostUsageReading,
156
156
  buildScheduledTaskContextBlocks,
157
+ buildSlackThirdPartyBotsEnvValue,
157
158
  classifyActor,
158
159
  classifyCursorAdvance,
159
160
  classifyOutput,
@@ -195,6 +196,8 @@ import {
195
196
  isVacuousDeliverReason,
196
197
  laneTagFragment,
197
198
  minutesSinceLocalMidnight,
199
+ normaliseSlackPeerAgentMode,
200
+ normaliseSlackPeerGroupIds,
198
201
  pairToolCallBrackets,
199
202
  parseDeliverAssertion,
200
203
  parseDeliveryTarget,
@@ -216,7 +219,7 @@ import {
216
219
  subagentActivityAgeSeconds,
217
220
  sumTranscriptUsageInWindow,
218
221
  transcriptActivityAgeSeconds
219
- } from "../chunk-PVPLNARY.js";
222
+ } from "../chunk-GJY3KZG6.js";
220
223
  import {
221
224
  reapOrphanChannelMcps
222
225
  } from "../chunk-XWVM4KPK.js";
@@ -837,7 +840,11 @@ function extractSlackBehaviourSubset(config2) {
837
840
  skip_reaction: (config2?.["skip_reaction"] ?? "").trim(),
838
841
  // Mirror the adapter's defensive filter exactly — a malformed entry the
839
842
  // adapter would drop must not count as an env change.
840
- allowed_users: Array.isArray(rawAllowed) ? rawAllowed.filter((v) => typeof v === "string" && v.trim().length > 0).map((v) => v.trim()) : []
843
+ allowed_users: Array.isArray(rawAllowed) ? rawAllowed.filter((v) => typeof v === "string" && v.trim().length > 0).map((v) => v.trim()) : [],
844
+ // ENG-10028: the adapter's own functions, not a copy of them.
845
+ peer_agent_mode: normaliseSlackPeerAgentMode(config2?.["peer_agent_mode"]),
846
+ peer_group_ids: normaliseSlackPeerGroupIds(config2?.["peer_group_ids"]),
847
+ third_party_bots: buildSlackThirdPartyBotsEnvValue(config2?.["third_party_bots"]) ?? ""
841
848
  };
842
849
  }
843
850
  function isSlackBehaviourRestrictive(subset) {
@@ -12919,7 +12926,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
12919
12926
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
12920
12927
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
12921
12928
  async function channelInboundActivityAgeSecondsFor(codeName) {
12922
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-OGFPDMFN.js");
12929
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-5DYKPYPP.js");
12923
12930
  const newest = newestPendingInboundActivityMtimeMs(dirname10(paneLogPath(codeName)));
12924
12931
  if (newest === null) return null;
12925
12932
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -13587,7 +13594,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
13587
13594
  var lastVersionCheckAt = 0;
13588
13595
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
13589
13596
  var lastResponsivenessProbeAt = 0;
13590
- var agtCliVersion = true ? "0.28.824" : "dev";
13597
+ var agtCliVersion = true ? "0.28.826" : "dev";
13591
13598
  function resolveBrewPath(execFileSync2) {
13592
13599
  try {
13593
13600
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -14073,20 +14080,43 @@ async function maybeUpgradeClaudeCode() {
14073
14080
  }
14074
14081
  return runAsync(brewPath, args, opts);
14075
14082
  };
14083
+ let proceedToUpgrade = false;
14084
+ let brewResult;
14085
+ try {
14086
+ brewResult = await import("../claude-code-brew-result-3A4E7GTC.js");
14087
+ const caskProbe = await runBrew(["list", "--cask", "claude-code"], { timeout: 6e4 });
14088
+ const presence = brewResult.caskPresenceFromListResult(caskProbe);
14089
+ proceedToUpgrade = presence === "present";
14090
+ if (presence === "absent") {
14091
+ log(
14092
+ "Claude Code is not installed as a Homebrew cask on this host, so the legacy brew upgrade path has nothing to upgrade \u2014 skipping it (ENG-10039). This is not an error. Where Claude Code was installed via npm, claude-code-updater (ENG-5672) keeps it current."
14093
+ );
14094
+ } else if (presence === "unknown") {
14095
+ log(
14096
+ `Claude Code cask probe inconclusive (exit ${caskProbe.code}), skipping this cycle (ENG-10039): ${(caskProbe.stderr || caskProbe.stdout).trim().slice(0, 200)}`
14097
+ );
14098
+ }
14099
+ } catch (err) {
14100
+ log(
14101
+ `Claude Code cask probe failed, skipping this cycle (ENG-10039): ${err instanceof Error ? err.message : String(err)}`
14102
+ );
14103
+ } finally {
14104
+ if (!proceedToUpgrade) claudeCodeUpgradeInFlight = false;
14105
+ }
14106
+ if (!proceedToUpgrade || !brewResult) return;
14107
+ const { classifyBrewUpgradeResult } = brewResult;
14076
14108
  log(`Checking for Claude Code updates in background${isRoot ? " (as ec2-user via sudo)" : ""}...`);
14077
14109
  runBrew(["upgrade", "--cask", "claude-code"], { timeout: 12e4 }).then((r) => {
14078
- const combined = `${r.stdout}
14079
- ${r.stderr}`;
14080
- if (r.code === 0) {
14081
- if (combined.includes("already installed") || combined.includes("up-to-date")) {
14110
+ switch (classifyBrewUpgradeResult(r)) {
14111
+ case "already-current":
14082
14112
  log("Claude Code is already up to date");
14083
- } else {
14113
+ break;
14114
+ case "upgraded":
14084
14115
  log("Claude Code upgraded successfully (will apply on next session start)");
14085
- }
14086
- } else if (combined.includes("already installed") || combined.includes("up-to-date") || combined.includes("not upgraded")) {
14087
- log("Claude Code is already up to date");
14088
- } else {
14089
- log(`Claude Code upgrade failed (exit ${r.code}): ${r.stderr.trim() || r.stdout.trim()}`);
14116
+ break;
14117
+ case "failed":
14118
+ log(`Claude Code upgrade failed (exit ${r.code}): ${r.stderr.trim() || r.stdout.trim()}`);
14119
+ break;
14090
14120
  }
14091
14121
  }).catch((err) => log(`Claude Code upgrade failed: ${err.message}`)).finally(() => {
14092
14122
  claudeCodeUpgradeInFlight = false;
@@ -15154,7 +15184,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
15154
15184
  if (codeNames.length === 0) return;
15155
15185
  void (async () => {
15156
15186
  try {
15157
- const { collectDiagnostics } = await import("../persistent-session-2Y4O3COI.js");
15187
+ const { collectDiagnostics } = await import("../persistent-session-BOHUJCZL.js");
15158
15188
  await api.post("/host/heartbeat", {
15159
15189
  host_id: hostId,
15160
15190
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -15295,7 +15325,7 @@ async function pollCycleInner() {
15295
15325
  }
15296
15326
  try {
15297
15327
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
15298
- const { collectDiagnostics } = await import("../persistent-session-2Y4O3COI.js");
15328
+ const { collectDiagnostics } = await import("../persistent-session-BOHUJCZL.js");
15299
15329
  const diagCodeNames = [...agentState.persistentSessionAgents];
15300
15330
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor) : void 0;
15301
15331
  let tailscaleHostname;
@@ -15464,7 +15494,7 @@ async function pollCycleInner() {
15464
15494
  collectPanelessActivityProbes,
15465
15495
  getResponsivenessIntervalMs,
15466
15496
  occupancyQualificationClassifications
15467
- } = await import("../responsiveness-probe-OGFPDMFN.js");
15497
+ } = await import("../responsiveness-probe-5DYKPYPP.js");
15468
15498
  const probeIntervalMs = getResponsivenessIntervalMs();
15469
15499
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
15470
15500
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -15581,7 +15611,7 @@ async function pollCycleInner() {
15581
15611
  collectResponsivenessProbes,
15582
15612
  livePendingInboundOldestAgeSeconds,
15583
15613
  parkPendingInbound
15584
- } = await import("../responsiveness-probe-OGFPDMFN.js");
15614
+ } = await import("../responsiveness-probe-5DYKPYPP.js");
15585
15615
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
15586
15616
  const wedgeNow = /* @__PURE__ */ new Date();
15587
15617
  const liveAgents = agentState.persistentSessionAgents;
@@ -15737,7 +15767,7 @@ async function pollCycleInner() {
15737
15767
  }
15738
15768
  try {
15739
15769
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-JA437JIB.js");
15740
- const { probeSessionAuth } = await import("../session-auth-dead-UDG6GY3U.js");
15770
+ const { probeSessionAuth } = await import("../session-auth-dead-LFNU6AUU.js");
15741
15771
  const observations = [];
15742
15772
  const pendingCacheCommits = [];
15743
15773
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -19939,7 +19969,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
19939
19969
  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}`));
19940
19970
  void (async () => {
19941
19971
  try {
19942
- const { collectDiagnostics } = await import("../persistent-session-2Y4O3COI.js");
19972
+ const { collectDiagnostics } = await import("../persistent-session-BOHUJCZL.js");
19943
19973
  await api.post("/host/heartbeat", {
19944
19974
  host_id: hostId,
19945
19975
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -19985,7 +20015,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
19985
20015
  }
19986
20016
  try {
19987
20017
  const hostId = await getHostId();
19988
- const { collectDiagnostics } = await import("../persistent-session-2Y4O3COI.js");
20018
+ const { collectDiagnostics } = await import("../persistent-session-BOHUJCZL.js");
19989
20019
  await api.post("/host/heartbeat", {
19990
20020
  host_id: hostId,
19991
20021
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -20621,7 +20651,7 @@ async function processClaudePairSessions(agents) {
20621
20651
  killPairSession,
20622
20652
  pairTmuxSession,
20623
20653
  finalizeClaudePairOnboarding
20624
- } = await import("../claude-pair-runtime-5QM5OTAZ.js");
20654
+ } = await import("../claude-pair-runtime-SWB525DM.js");
20625
20655
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
20626
20656
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
20627
20657
  const killed = await killPairSession(pairTmuxSession(pairId));