@integrity-labs/agt-cli 0.28.1278 → 0.28.1280

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.
Files changed (34) hide show
  1. package/dist/{api-client-C4Q5225W.js → api-client-QEV6AB73.js} +3 -3
  2. package/dist/bin/agt.js +7 -7
  3. package/dist/{chunk-ZQVYTNLA.js → chunk-47ARAO23.js} +87 -10
  4. package/dist/chunk-47ARAO23.js.map +1 -0
  5. package/dist/{chunk-3POXIX7X.js → chunk-5MI3GRHT.js} +3 -3
  6. package/dist/{chunk-C3NM6OTP.js → chunk-BJKY5764.js} +2 -2
  7. package/dist/{chunk-IEXBHI4X.js → chunk-FVW5O7NY.js} +2 -2
  8. package/dist/{chunk-QDYB6DUP.js → chunk-HHEN4FTL.js} +3 -3
  9. package/dist/{chunk-IASOIXOV.js → chunk-TICHDHYF.js} +5 -5
  10. package/dist/{claude-code-updater-GADHFGSY.js → claude-code-updater-BHSYASF3.js} +3 -3
  11. package/dist/{claude-pair-runtime-CNYIVUOQ.js → claude-pair-runtime-27FK2QO2.js} +3 -3
  12. package/dist/lib/manager-worker.js +188 -73
  13. package/dist/lib/manager-worker.js.map +1 -1
  14. package/dist/mcp/direct-chat-channel.js +41 -2
  15. package/dist/mcp/index.js +41 -2
  16. package/dist/mcp/origami.js +41 -2
  17. package/dist/mcp/slack-channel.js +41 -2
  18. package/dist/mcp/telegram-channel.js +41 -2
  19. package/dist/{persistent-session-6B2DPG4U.js → persistent-session-WBWYC4XL.js} +4 -4
  20. package/dist/{responsiveness-probe-ZN2VIGOX.js → responsiveness-probe-BLLWDXE4.js} +4 -4
  21. package/dist/{session-auth-dead-7NXTFGDV.js → session-auth-dead-NJR7X5T6.js} +3 -3
  22. package/package.json +1 -1
  23. package/dist/chunk-ZQVYTNLA.js.map +0 -1
  24. /package/dist/{api-client-C4Q5225W.js.map → api-client-QEV6AB73.js.map} +0 -0
  25. /package/dist/{chunk-3POXIX7X.js.map → chunk-5MI3GRHT.js.map} +0 -0
  26. /package/dist/{chunk-C3NM6OTP.js.map → chunk-BJKY5764.js.map} +0 -0
  27. /package/dist/{chunk-IEXBHI4X.js.map → chunk-FVW5O7NY.js.map} +0 -0
  28. /package/dist/{chunk-QDYB6DUP.js.map → chunk-HHEN4FTL.js.map} +0 -0
  29. /package/dist/{chunk-IASOIXOV.js.map → chunk-TICHDHYF.js.map} +0 -0
  30. /package/dist/{claude-code-updater-GADHFGSY.js.map → claude-code-updater-BHSYASF3.js.map} +0 -0
  31. /package/dist/{claude-pair-runtime-CNYIVUOQ.js.map → claude-pair-runtime-27FK2QO2.js.map} +0 -0
  32. /package/dist/{persistent-session-6B2DPG4U.js.map → persistent-session-WBWYC4XL.js.map} +0 -0
  33. /package/dist/{responsiveness-probe-ZN2VIGOX.js.map → responsiveness-probe-BLLWDXE4.js.map} +0 -0
  34. /package/dist/{session-auth-dead-7NXTFGDV.js.map → session-auth-dead-NJR7X5T6.js.map} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  rotateDailySession,
5
5
  sessionFileExists,
6
6
  todayLocalIso
7
- } from "./chunk-IEXBHI4X.js";
7
+ } from "./chunk-FVW5O7NY.js";
8
8
  import {
9
9
  classifyUnanswerablePane,
10
10
  customApiKeyDialogKeys,
@@ -54,7 +54,7 @@ import {
54
54
  remoteMcpConnectionEnvInfix,
55
55
  remoteMcpConnectionLabel,
56
56
  remoteMcpConnectionScopedEnvVar
57
- } from "./chunk-ZQVYTNLA.js";
57
+ } from "./chunk-47ARAO23.js";
58
58
  import {
59
59
  CLAUDE_CONFIG_DIR_ENV,
60
60
  approveApiKeyInClaudeConfig,
@@ -6512,4 +6512,4 @@ export {
6512
6512
  stopAllSessionsAndWait,
6513
6513
  getProjectDir
6514
6514
  };
6515
- //# sourceMappingURL=chunk-3POXIX7X.js.map
6515
+ //# sourceMappingURL=chunk-5MI3GRHT.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-XWVM4KPK.js";
5
5
  import {
6
6
  FORCED_UPDATE_HARD_DEADLINE_MS
7
- } from "./chunk-ZQVYTNLA.js";
7
+ } from "./chunk-47ARAO23.js";
8
8
  import {
9
9
  effectiveClaudeJsonPath
10
10
  } from "./chunk-AIUIMEUS.js";
@@ -722,4 +722,4 @@ export {
722
722
  probeClaudeInstalls,
723
723
  maybeUpdateClaudeCode
724
724
  };
725
- //# sourceMappingURL=chunk-C3NM6OTP.js.map
725
+ //# sourceMappingURL=chunk-BJKY5764.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  encodeClaudeProjectPath
3
- } from "./chunk-ZQVYTNLA.js";
3
+ } from "./chunk-47ARAO23.js";
4
4
 
5
5
  // src/lib/daily-session.ts
6
6
  import { randomUUID } from "crypto";
@@ -244,4 +244,4 @@ export {
244
244
  peekPreviousSession,
245
245
  readDailySessionPin
246
246
  };
247
- //# sourceMappingURL=chunk-IEXBHI4X.js.map
247
+ //# sourceMappingURL=chunk-FVW5O7NY.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HOST_ROTATE_KEY_CONFLICT
3
- } from "./chunk-ZQVYTNLA.js";
3
+ } from "./chunk-47ARAO23.js";
4
4
 
5
5
  // src/lib/config.ts
6
6
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
@@ -103,7 +103,7 @@ function exchangeFailureKind(err) {
103
103
  }
104
104
 
105
105
  // src/lib/api-client.ts
106
- var agtCliVersion = true ? "0.28.1278" : "dev";
106
+ var agtCliVersion = true ? "0.28.1280" : "dev";
107
107
  var lastConfigHash = null;
108
108
  function setConfigHash(hash) {
109
109
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -468,4 +468,4 @@ export {
468
468
  api,
469
469
  getHostId
470
470
  };
471
- //# sourceMappingURL=chunk-QDYB6DUP.js.map
471
+ //# sourceMappingURL=chunk-HHEN4FTL.js.map
@@ -2,7 +2,7 @@ import {
2
2
  exchangeApiKey,
3
3
  getApiKey,
4
4
  getHost
5
- } from "./chunk-QDYB6DUP.js";
5
+ } from "./chunk-HHEN4FTL.js";
6
6
  import {
7
7
  LATE_BOUND_VARS,
8
8
  PLATFORM_DENY_PERMISSIONS,
@@ -26,11 +26,11 @@ import {
26
26
  warnIgnoredIsolationAllowlist,
27
27
  withheldRemoteMcpMessage,
28
28
  withheldRemoteMcpReasonFor
29
- } from "./chunk-3POXIX7X.js";
29
+ } from "./chunk-5MI3GRHT.js";
30
30
  import {
31
31
  readDailySessionPin,
32
32
  sessionTranscriptDir
33
- } from "./chunk-IEXBHI4X.js";
33
+ } from "./chunk-FVW5O7NY.js";
34
34
  import {
35
35
  classifyUnanswerablePane,
36
36
  isConsumerTermsDialogVisible,
@@ -102,7 +102,7 @@ import {
102
102
  scanConfigForLiteralSecrets,
103
103
  worseConnectivityOutcome,
104
104
  wrapScheduledTaskPrompt
105
- } from "./chunk-ZQVYTNLA.js";
105
+ } from "./chunk-47ARAO23.js";
106
106
  import {
107
107
  claudeJsonPathFor,
108
108
  effectiveClaudeJsonPath,
@@ -13853,4 +13853,4 @@ export {
13853
13853
  managerInstallSystemUnitCommand,
13854
13854
  managerUninstallSystemUnitCommand
13855
13855
  };
13856
- //# sourceMappingURL=chunk-IASOIXOV.js.map
13856
+ //# sourceMappingURL=chunk-TICHDHYF.js.map
@@ -13,9 +13,9 @@ import {
13
13
  probeClaudeInstalls,
14
14
  readsAsNativeInstall,
15
15
  shouldRunClaudeCodeUpdater
16
- } from "./chunk-C3NM6OTP.js";
16
+ } from "./chunk-BJKY5764.js";
17
17
  import "./chunk-XWVM4KPK.js";
18
- import "./chunk-ZQVYTNLA.js";
18
+ import "./chunk-47ARAO23.js";
19
19
  import "./chunk-AIUIMEUS.js";
20
20
  import "./chunk-DGUM43GV.js";
21
21
  export {
@@ -34,4 +34,4 @@ export {
34
34
  readsAsNativeInstall,
35
35
  shouldRunClaudeCodeUpdater
36
36
  };
37
- //# sourceMappingURL=claude-code-updater-GADHFGSY.js.map
37
+ //# sourceMappingURL=claude-code-updater-BHSYASF3.js.map
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  redactPaneFrame,
12
12
  sanitizeTerminalFrame
13
- } from "./chunk-ZQVYTNLA.js";
13
+ } from "./chunk-47ARAO23.js";
14
14
  import {
15
15
  CLAUDE_CONFIG_DIR_ENV,
16
16
  claudeConfigDirFor,
@@ -323,7 +323,7 @@ async function spawnPairSession(session) {
323
323
  return { ok: true };
324
324
  } catch {
325
325
  }
326
- const { resolveClaudeBinary } = await import("./persistent-session-6B2DPG4U.js");
326
+ const { resolveClaudeBinary } = await import("./persistent-session-WBWYC4XL.js");
327
327
  const claudeBin = resolveClaudeBinary();
328
328
  const pairEnv = {
329
329
  ...process.env,
@@ -838,4 +838,4 @@ export {
838
838
  startClaudePair,
839
839
  submitClaudePairCode
840
840
  };
841
- //# sourceMappingURL=claude-pair-runtime-CNYIVUOQ.js.map
841
+ //# sourceMappingURL=claude-pair-runtime-27FK2QO2.js.map
@@ -70,7 +70,7 @@ import {
70
70
  tripClass,
71
71
  writeEtcEnvironment,
72
72
  writeProfileDScript
73
- } from "../chunk-IASOIXOV.js";
73
+ } from "../chunk-TICHDHYF.js";
74
74
  import {
75
75
  ApiError,
76
76
  adoptHostKeyInProcess,
@@ -88,7 +88,7 @@ import {
88
88
  probeHostKey,
89
89
  requireHost,
90
90
  setConfigHash
91
- } from "../chunk-QDYB6DUP.js";
91
+ } from "../chunk-HHEN4FTL.js";
92
92
  import {
93
93
  BLOCKED_ON_PROMPT_DECISION,
94
94
  CHANNEL_SECRET_ENV_KEYS,
@@ -180,7 +180,7 @@ import {
180
180
  webFetchBaselineValue,
181
181
  webFetchRestartNeeded,
182
182
  writeEgressAllowlist
183
- } from "../chunk-3POXIX7X.js";
183
+ } from "../chunk-5MI3GRHT.js";
184
184
  import {
185
185
  isAgentIdle,
186
186
  isStaleForToday,
@@ -191,7 +191,7 @@ import {
191
191
  subagentActivityAgeSeconds,
192
192
  subagentTranscriptDir,
193
193
  transcriptActivityAgeSeconds
194
- } from "../chunk-IEXBHI4X.js";
194
+ } from "../chunk-FVW5O7NY.js";
195
195
  import {
196
196
  classifyUnanswerablePane,
197
197
  focusedConfirmDialogBlock,
@@ -217,7 +217,7 @@ import {
217
217
  runSafeCleanup,
218
218
  tightestDiskStat,
219
219
  withPackageCacheLock
220
- } from "../chunk-C3NM6OTP.js";
220
+ } from "../chunk-BJKY5764.js";
221
221
  import {
222
222
  parsePsRows,
223
223
  reapOrphanChannelMcps
@@ -346,7 +346,7 @@ import {
346
346
  stabiliseResetInstant,
347
347
  sumTranscriptUsageInWindow,
348
348
  summarizeTranscriptActivity
349
- } from "../chunk-ZQVYTNLA.js";
349
+ } from "../chunk-47ARAO23.js";
350
350
  import {
351
351
  CLAUDE_CONFIG_DIR_ENV,
352
352
  claudeConfigDirFor,
@@ -4979,6 +4979,26 @@ function decideAuthResolveFailureAction(args) {
4979
4979
  };
4980
4980
  }
4981
4981
 
4982
+ // src/lib/manager/not-authenticated-skip.ts
4983
+ function notAuthenticatedSkipOutcome() {
4984
+ return { decision: "skipped-not-authenticated", spawnAttempted: false, sessionHealthyAfter: false, detail: NOT_AUTHENTICATED_CAUSE };
4985
+ }
4986
+ var NOT_AUTHENTICATED_CAUSE = "Claude Code is logged out on this host (subscription mode); log in again as the host user, a manager restart will not fix it";
4987
+
4988
+ // src/lib/heartbeat-claude-auth-absent.ts
4989
+ function fileAuthAfterHeartbeat(current, input) {
4990
+ if (input.rawMode !== "subscription" || input.detectionFailed) return current;
4991
+ if (input.detected === null) return false;
4992
+ if (typeof input.detected === "object" && input.detected.status === "expired") return false;
4993
+ return current;
4994
+ }
4995
+ function heartbeatClaudeAuthAbsentField(input) {
4996
+ if (input.rawMode !== "subscription") return {};
4997
+ if (input.detectionFailed) return {};
4998
+ if (input.detected !== null) return {};
4999
+ return { claude_auth_absent: true };
5000
+ }
5001
+
4982
5002
  // ../../packages/core/dist/host-config/capture.js
4983
5003
  import { createHash as createHash6 } from "crypto";
4984
5004
  var NON_SECRET_ENV_GATES = [
@@ -5459,22 +5479,7 @@ async function detectClaudeAuth() {
5459
5479
  return computeSubscriptionStatus(creds);
5460
5480
  }
5461
5481
  async function findClaudeCredentialsPaths() {
5462
- const candidates = [
5463
- join16(homedir5(), ".claude", ".credentials.json"),
5464
- join16(homedir5(), ".claude", "credentials.json")
5465
- ];
5466
- const isLinuxRoot = platform() === "linux" && typeof process.getuid === "function" && process.getuid() === 0;
5467
- if (isLinuxRoot) {
5468
- try {
5469
- const entries = await readdir2("/home", { withFileTypes: true });
5470
- for (const entry of entries.filter((entry2) => entry2.isDirectory()).sort((a, b) => a.name.localeCompare(b.name))) {
5471
- candidates.push(join16("/home", entry.name, ".claude", ".credentials.json"));
5472
- candidates.push(join16("/home", entry.name, ".claude", "credentials.json"));
5473
- }
5474
- } catch {
5475
- }
5476
- }
5477
- return candidates;
5482
+ return (await discoverCredentialCandidates()).paths;
5478
5483
  }
5479
5484
  async function readOauthCredentials() {
5480
5485
  if (platform() === "darwin") {
@@ -5511,6 +5516,79 @@ async function readJsonSilently(path) {
5511
5516
  return null;
5512
5517
  }
5513
5518
  }
5519
+ function credentialPresenceFrom(outcomes) {
5520
+ if (outcomes.includes("parsed")) return "present";
5521
+ if (outcomes.includes("unreadable")) return "unreadable";
5522
+ return "absent";
5523
+ }
5524
+ async function discoverCredentialCandidates(deps = {}) {
5525
+ const home = deps.home ?? homedir5();
5526
+ const paths = [join16(home, ".claude", ".credentials.json"), join16(home, ".claude", "credentials.json")];
5527
+ const outcomes = [];
5528
+ const linuxRoot = deps.linuxRoot ?? (platform() === "linux" && typeof process.getuid === "function" && process.getuid() === 0);
5529
+ if (linuxRoot) {
5530
+ const list = deps.readdirImpl ?? ((path) => readdir2(path, { withFileTypes: true }));
5531
+ try {
5532
+ const entries = await list("/home");
5533
+ for (const entry of entries.filter((e) => e.isDirectory()).sort((x, y) => x.name.localeCompare(y.name))) {
5534
+ paths.push(join16("/home", entry.name, ".claude", ".credentials.json"));
5535
+ paths.push(join16("/home", entry.name, ".claude", "credentials.json"));
5536
+ }
5537
+ } catch (err) {
5538
+ const code = err.code;
5539
+ outcomes.push(code === "ENOENT" || code === "ENOTDIR" ? "missing" : "unreadable");
5540
+ }
5541
+ }
5542
+ return { paths, outcomes };
5543
+ }
5544
+ function keychainOutcomeFrom(result) {
5545
+ if ("error" in result) return "unreadable";
5546
+ try {
5547
+ JSON.parse(result.stdout.trim());
5548
+ return "parsed";
5549
+ } catch {
5550
+ return "unreadable";
5551
+ }
5552
+ }
5553
+ async function keychainOutcome() {
5554
+ try {
5555
+ const { stdout } = await execFileAsync("security", ["find-generic-password", "-s", "Claude Code-credentials", "-w"], { timeout: 3e3 });
5556
+ return keychainOutcomeFrom({ stdout });
5557
+ } catch (error) {
5558
+ return keychainOutcomeFrom({ error });
5559
+ }
5560
+ }
5561
+ async function claudeCredentialPresence(deps = {}) {
5562
+ if (process.env["ANTHROPIC_API_KEY"] || process.env["ANTHROPIC_AUTH_TOKEN"]) return "present";
5563
+ const outcomes = [];
5564
+ const keychain = deps.keychain === void 0 ? platform() === "darwin" ? keychainOutcome : null : deps.keychain;
5565
+ if (keychain) outcomes.push(await keychain());
5566
+ let paths;
5567
+ if (deps.paths) {
5568
+ paths = deps.paths;
5569
+ } else {
5570
+ const discovered = await discoverCredentialCandidates();
5571
+ paths = discovered.paths;
5572
+ outcomes.push(...discovered.outcomes);
5573
+ }
5574
+ for (const path of paths) {
5575
+ let raw;
5576
+ try {
5577
+ raw = await readFile2(path, "utf-8");
5578
+ } catch (err) {
5579
+ const code = err.code;
5580
+ outcomes.push(code === "ENOENT" || code === "ENOTDIR" ? "missing" : "unreadable");
5581
+ continue;
5582
+ }
5583
+ try {
5584
+ JSON.parse(raw);
5585
+ outcomes.push("parsed");
5586
+ } catch {
5587
+ outcomes.push("unreadable");
5588
+ }
5589
+ }
5590
+ return credentialPresenceFrom(outcomes);
5591
+ }
5514
5592
  function computeSubscriptionStatus(creds) {
5515
5593
  const expiresAtMs = parseExpiresAt(creds.expiresAt);
5516
5594
  const hasRefreshToken = typeof creds.refreshToken === "string" && creds.refreshToken.trim().length > 0;
@@ -10550,6 +10628,12 @@ function foldRuntimeAuthVerdict(input) {
10550
10628
  }
10551
10629
  return { reported: previous, consecutiveFailures };
10552
10630
  }
10631
+ function shouldRecordRuntimeVerdict(input) {
10632
+ const { verdict, before, folded, requiredConsecutiveFailures } = input;
10633
+ if (verdict === "authenticated") return true;
10634
+ if (folded.reported !== before) return true;
10635
+ return verdict === "not-authenticated" && folded.consecutiveFailures >= requiredConsecutiveFailures;
10636
+ }
10553
10637
  function heartbeatRuntimeAuthReport(probeVerdict) {
10554
10638
  return probeVerdict ?? void 0;
10555
10639
  }
@@ -15144,7 +15228,7 @@ function createFileMigrationReportIO(codeName, log2) {
15144
15228
  };
15145
15229
  }
15146
15230
  var managerHostPost = async (path, body) => {
15147
- const { api: api2, ApiError: ApiError3 } = await import("../api-client-C4Q5225W.js");
15231
+ const { api: api2, ApiError: ApiError3 } = await import("../api-client-QEV6AB73.js");
15148
15232
  try {
15149
15233
  const json = await api2.post(path, body);
15150
15234
  return { status: 200, json };
@@ -15673,6 +15757,10 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
15673
15757
  }
15674
15758
 
15675
15759
  // src/lib/persistent-session-stuck-tracker.ts
15760
+ function stuckWarnHint(detail) {
15761
+ const cause = detail?.replace(/\s+/g, " ").trim();
15762
+ return cause ? `cause: ${cause}` : "manager-worker may need restart, or upstream guard is mis-firing (see ENG-5116)";
15763
+ }
15676
15764
  var DEFAULT_STUCK_WARN_THRESHOLD = 3;
15677
15765
  var DEFAULT_SPAWN_LOOP_WARN_THRESHOLD = 3;
15678
15766
  var PersistentSessionStuckTracker = class {
@@ -17195,7 +17283,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
17195
17283
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
17196
17284
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
17197
17285
  async function channelInboundActivityAgeSecondsFor(codeName) {
17198
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-ZN2VIGOX.js");
17286
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-BLLWDXE4.js");
17199
17287
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
17200
17288
  if (newest === null) return null;
17201
17289
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -18076,7 +18164,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
18076
18164
  var lastVersionCheckAt = 0;
18077
18165
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
18078
18166
  var lastResponsivenessProbeAt = 0;
18079
- var agtCliVersion = true ? "0.28.1278" : "dev";
18167
+ var agtCliVersion = true ? "0.28.1280" : "dev";
18080
18168
  function resolveBrewPath(execFileSync5) {
18081
18169
  try {
18082
18170
  const out = execFileSync5("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -19378,7 +19466,12 @@ async function maybeProbeClaudeRuntimeAuth() {
19378
19466
  requiredConsecutiveFailures: RUNTIME_AUTH_PROBE_FAILURES_TO_CONDEMN
19379
19467
  });
19380
19468
  runtimeAuthConsecutiveFailures = folded.consecutiveFailures;
19381
- if (result.verdict === "authenticated" || folded.reported !== before) {
19469
+ if (shouldRecordRuntimeVerdict({
19470
+ verdict: result.verdict,
19471
+ before,
19472
+ folded,
19473
+ requiredConsecutiveFailures: RUNTIME_AUTH_PROBE_FAILURES_TO_CONDEMN
19474
+ })) {
19382
19475
  runtimeAuthProbeVerdict = folded.reported;
19383
19476
  }
19384
19477
  if (folded.reported !== before) {
@@ -20085,7 +20178,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
20085
20178
  if (codeNames.length === 0) return;
20086
20179
  void (async () => {
20087
20180
  try {
20088
- const { collectDiagnostics } = await import("../persistent-session-6B2DPG4U.js");
20181
+ const { collectDiagnostics } = await import("../persistent-session-WBWYC4XL.js");
20089
20182
  await api.post("/host/heartbeat", {
20090
20183
  host_id: hostId,
20091
20184
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -20228,7 +20321,7 @@ async function pollCycleInner() {
20228
20321
  }
20229
20322
  try {
20230
20323
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
20231
- const { collectDiagnostics } = await import("../persistent-session-6B2DPG4U.js");
20324
+ const { collectDiagnostics } = await import("../persistent-session-WBWYC4XL.js");
20232
20325
  const diagCodeNames = [...agentState.persistentSessionAgents];
20233
20326
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor) : void 0;
20234
20327
  let tailscaleHostname;
@@ -20254,15 +20347,29 @@ async function pollCycleInner() {
20254
20347
  } catch {
20255
20348
  }
20256
20349
  let claudeAuth = null;
20350
+ let claudeAuthDetectionFailed = false;
20257
20351
  try {
20258
20352
  claudeAuth = await detectClaudeAuth();
20259
20353
  } catch (err) {
20354
+ claudeAuthDetectionFailed = true;
20260
20355
  const errText = err instanceof Error ? err.message : String(err);
20261
20356
  const errId = createHash21("sha256").update(errText).digest("hex").slice(0, 12);
20262
20357
  log(`Claude auth detection failed (error_id=${errId})`);
20263
20358
  }
20359
+ if (!claudeAuthDetectionFailed && claudeAuth === null) {
20360
+ try {
20361
+ if (await claudeCredentialPresence() !== "absent") claudeAuthDetectionFailed = true;
20362
+ } catch {
20363
+ claudeAuthDetectionFailed = true;
20364
+ }
20365
+ }
20264
20366
  let claudeAccountEmail = null;
20265
20367
  const claudeAuthModeRaw = getCachedClaudeAuthModeRaw();
20368
+ agentRuntimeAuthenticated = fileAuthAfterHeartbeat(agentRuntimeAuthenticated, {
20369
+ rawMode: claudeAuthModeRaw,
20370
+ detected: claudeAuth,
20371
+ detectionFailed: claudeAuthDetectionFailed
20372
+ });
20266
20373
  if (mayReportAccountEmail(claudeAuthModeRaw)) {
20267
20374
  try {
20268
20375
  const observation = await getClaudeAccountEmailObservation();
@@ -20325,6 +20432,13 @@ async function pollCycleInner() {
20325
20432
  hostname: tailscaleHostname,
20326
20433
  os_username: osUsername,
20327
20434
  claude_auth: claudeAuth ?? void 0,
20435
+ // ENG-12236: a subscription host with NO credential says so, instead of
20436
+ // omitting `claude_auth` and leaving a stale `valid` in place.
20437
+ ...heartbeatClaudeAuthAbsentField({
20438
+ rawMode: claudeAuthModeRaw,
20439
+ detected: claudeAuth,
20440
+ detectionFailed: claudeAuthDetectionFailed
20441
+ }),
20328
20442
  // OMITTED rather than sent as null when it cannot be read. The API
20329
20443
  // treats absence as "no observation" and leaves the stored label
20330
20444
  // alone; sending null would let a transient unreadable config WIPE a
@@ -20500,7 +20614,7 @@ async function pollCycleInner() {
20500
20614
  }
20501
20615
  try {
20502
20616
  const desiredClaudeCodeVersion = hbResp?.desired_claude_code_version?.trim();
20503
- const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-GADHFGSY.js");
20617
+ const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-BHSYASF3.js");
20504
20618
  const securityFloor = currentSecurityFloor();
20505
20619
  claudeUpdaterInFlight = true;
20506
20620
  if (desiredClaudeCodeVersion && (claudePairLoop.busy || claudePairingInProgress())) {
@@ -20535,7 +20649,7 @@ async function pollCycleInner() {
20535
20649
  collectPanelessActivityProbes,
20536
20650
  getResponsivenessIntervalMs,
20537
20651
  occupancyQualificationClassifications
20538
- } = await import("../responsiveness-probe-ZN2VIGOX.js");
20652
+ } = await import("../responsiveness-probe-BLLWDXE4.js");
20539
20653
  const probeIntervalMs = getResponsivenessIntervalMs();
20540
20654
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
20541
20655
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -20652,7 +20766,7 @@ async function pollCycleInner() {
20652
20766
  collectResponsivenessProbes,
20653
20767
  livePendingInboundOldestAgeSeconds,
20654
20768
  parkPendingInbound
20655
- } = await import("../responsiveness-probe-ZN2VIGOX.js");
20769
+ } = await import("../responsiveness-probe-BLLWDXE4.js");
20656
20770
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-5PCBGRNY.js");
20657
20771
  const wedgeNow = /* @__PURE__ */ new Date();
20658
20772
  const liveAgents = agentState.persistentSessionAgents;
@@ -20938,7 +21052,7 @@ async function pollCycleInner() {
20938
21052
  }
20939
21053
  }
20940
21054
  );
20941
- const { parkPendingInbound } = await import("../responsiveness-probe-ZN2VIGOX.js");
21055
+ const { parkPendingInbound } = await import("../responsiveness-probe-BLLWDXE4.js");
20942
21056
  const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
20943
21057
  paneFatalStreak.delete(codeName);
20944
21058
  paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
@@ -20969,7 +21083,7 @@ async function pollCycleInner() {
20969
21083
  TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
20970
21084
  bindSourceEscalations
20971
21085
  } = await import("../transcript-mount-health-OHE6IVJV.js");
20972
- const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-6B2DPG4U.js");
21086
+ const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-WBWYC4XL.js");
20973
21087
  const mountConfig = resolveTranscriptMountConfig();
20974
21088
  const liveAgents = agentState.persistentSessionAgents;
20975
21089
  for (const tracked of [
@@ -21134,7 +21248,7 @@ async function pollCycleInner() {
21134
21248
  }
21135
21249
  try {
21136
21250
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
21137
- const { probeSessionAuth } = await import("../session-auth-dead-7NXTFGDV.js");
21251
+ const { probeSessionAuth } = await import("../session-auth-dead-NJR7X5T6.js");
21138
21252
  const observations = [];
21139
21253
  const pendingCacheCommits = [];
21140
21254
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -24327,7 +24441,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
24327
24441
  });
24328
24442
  if (stuck.shouldWarn) {
24329
24443
  log(
24330
- `[persistent-session-stuck] WARN: agent=${agent.code_name} unhealthy with no spawn attempt for ${stuck.consecutiveTicks} consecutive ticks (last_decision=${psResult.decision}) \u2014 manager-worker may need restart, or upstream guard is mis-firing (see ENG-5116)`
24444
+ `[persistent-session-stuck] WARN: agent=${agent.code_name} unhealthy with no spawn attempt for ${stuck.consecutiveTicks} consecutive ticks (last_decision=${psResult.decision}) \u2014 ${stuckWarnHint(psResult.detail)}`
24331
24445
  );
24332
24446
  } else if (stuck.recovered) {
24333
24447
  log(`[persistent-session-stuck] agent=${agent.code_name} recovered from stuck state`);
@@ -25087,6 +25201,38 @@ async function ensurePersistentSession(...args) {
25087
25201
  const blocked = result.sessionHealthyAfter ? sessionBlockedOnPrompt(args[0].code_name) : null;
25088
25202
  return applyBlockedPromptVerdict(result, blocked);
25089
25203
  }
25204
+ function refreshLiveEgressAllowlist(agent, refreshData, modelPolicy) {
25205
+ const codeName = agent.code_name;
25206
+ if (egressMode(codeName) === "allowlist") {
25207
+ const allowlist = deriveEgressAllowlist(
25208
+ refreshData.tools?.raw_content,
25209
+ modelPolicy,
25210
+ integrationEgressDomainsFor(agent, "live-refresh")
25211
+ );
25212
+ const prev = egressAllowlistBySession.get(codeName);
25213
+ if (!prev || !egressAllowlistEqual(prev, allowlist)) {
25214
+ try {
25215
+ writeEgressAllowlist(codeName, allowlist);
25216
+ const removed = prev ? prev.some((d) => !allowlist.includes(d)) : true;
25217
+ const applied = removed ? restartEgressSidecar(codeName) : reloadEgressSidecar(codeName);
25218
+ if (applied) {
25219
+ egressAllowlistBySession.set(codeName, allowlist);
25220
+ log(
25221
+ `[persistent-session] egress allowlist for '${codeName}' changed (${allowlist.length} domains), ${removed ? "restarted" : "reloaded"} squid sidecar`
25222
+ );
25223
+ } else {
25224
+ log(
25225
+ `[persistent-session] egress allowlist for '${codeName}' written (${allowlist.length} domains) but sidecar not running; will apply on next tick/spawn`
25226
+ );
25227
+ }
25228
+ } catch (err) {
25229
+ log(
25230
+ `[persistent-session] egress allowlist refresh for '${codeName}' failed (will retry next tick): ${err.message}`
25231
+ );
25232
+ }
25233
+ }
25234
+ }
25235
+ }
25090
25236
  async function ensurePersistentSessionUnchecked(agent, tasks, boardItems, refreshData) {
25091
25237
  const codeName = agent.code_name;
25092
25238
  if ((agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK) === "claude-code" && !isSessionHealthy(codeName)) {
@@ -25292,11 +25438,8 @@ async function ensurePersistentSessionUnchecked(agent, tasks, boardItems, refres
25292
25438
  agentRuntimeAuthenticated = await checkClaudeAuth();
25293
25439
  if (!agentRuntimeAuthenticated) {
25294
25440
  log(`[persistent-session] Skipping '${codeName}' \u2014 Claude Code not authenticated (subscription mode)`);
25295
- return {
25296
- decision: "skipped-not-authenticated",
25297
- spawnAttempted: false,
25298
- sessionHealthyAfter: isSessionHealthy(codeName)
25299
- };
25441
+ if (isSessionHealthy(codeName)) refreshLiveEgressAllowlist(agent, refreshData, modelPolicy);
25442
+ return notAuthenticatedSkipOutcome();
25300
25443
  }
25301
25444
  }
25302
25445
  } else if (!anthropicApiKey) {
@@ -25796,35 +25939,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash21("sha256")
25796
25939
  scheduleSessionRestart(codeName, 0, "network policy change (ENG-11168)");
25797
25940
  }
25798
25941
  denyWebFetchBySession.set(codeName, liveDenyWebFetch);
25799
- if (egressMode(codeName) === "allowlist") {
25800
- const allowlist = deriveEgressAllowlist(
25801
- refreshData.tools?.raw_content,
25802
- modelPolicy,
25803
- integrationEgressDomainsFor(agent, "live-refresh")
25804
- );
25805
- const prev = egressAllowlistBySession.get(codeName);
25806
- if (!prev || !egressAllowlistEqual(prev, allowlist)) {
25807
- try {
25808
- writeEgressAllowlist(codeName, allowlist);
25809
- const removed = prev ? prev.some((d) => !allowlist.includes(d)) : true;
25810
- const applied = removed ? restartEgressSidecar(codeName) : reloadEgressSidecar(codeName);
25811
- if (applied) {
25812
- egressAllowlistBySession.set(codeName, allowlist);
25813
- log(
25814
- `[persistent-session] egress allowlist for '${codeName}' changed (${allowlist.length} domains), ${removed ? "restarted" : "reloaded"} squid sidecar`
25815
- );
25816
- } else {
25817
- log(
25818
- `[persistent-session] egress allowlist for '${codeName}' written (${allowlist.length} domains) but sidecar not running; will apply on next tick/spawn`
25819
- );
25820
- }
25821
- } catch (err) {
25822
- log(
25823
- `[persistent-session] egress allowlist refresh for '${codeName}' failed (will retry next tick): ${err.message}`
25824
- );
25825
- }
25826
- }
25827
- }
25942
+ refreshLiveEgressAllowlist(agent, refreshData, modelPolicy);
25828
25943
  if (effectiveIsolationMode(codeName) === "docker") {
25829
25944
  syncContainerMemory(
25830
25945
  codeName,
@@ -26202,7 +26317,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
26202
26317
  if (!refreshData) return;
26203
26318
  const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
26204
26319
  const hostId = await getHostId();
26205
- const parkForRestart = await import("../responsiveness-probe-ZN2VIGOX.js").then(
26320
+ const parkForRestart = await import("../responsiveness-probe-BLLWDXE4.js").then(
26206
26321
  (m) => m.parkPendingInbound,
26207
26322
  (err) => err
26208
26323
  );
@@ -26279,7 +26394,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
26279
26394
  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}`));
26280
26395
  void (async () => {
26281
26396
  try {
26282
- const { collectDiagnostics } = await import("../persistent-session-6B2DPG4U.js");
26397
+ const { collectDiagnostics } = await import("../persistent-session-WBWYC4XL.js");
26283
26398
  await api.post("/host/heartbeat", {
26284
26399
  host_id: hostId,
26285
26400
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -26332,7 +26447,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
26332
26447
  }
26333
26448
  try {
26334
26449
  const hostId = await getHostId();
26335
- const { collectDiagnostics } = await import("../persistent-session-6B2DPG4U.js");
26450
+ const { collectDiagnostics } = await import("../persistent-session-WBWYC4XL.js");
26336
26451
  await api.post("/host/heartbeat", {
26337
26452
  host_id: hostId,
26338
26453
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -27059,7 +27174,7 @@ async function processClaudePairSessions(agents) {
27059
27174
  snapshotPairConfig,
27060
27175
  // ENG-11659: result -> report body + the manager.log line that records it.
27061
27176
  planPairStartReport
27062
- } = await import("../claude-pair-runtime-CNYIVUOQ.js");
27177
+ } = await import("../claude-pair-runtime-27FK2QO2.js");
27063
27178
  const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
27064
27179
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
27065
27180
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);