@integrity-labs/agt-cli 0.28.426 → 0.28.428

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.
@@ -2,8 +2,6 @@ import {
2
2
  ApiError,
3
3
  CHANNEL_SECRET_ENV_KEYS,
4
4
  HostFlagStore,
5
- INTEGRATIONS_SECTION_END,
6
- INTEGRATIONS_SECTION_START,
7
5
  SUPERVISOR_RESTART_EXIT_CODE,
8
6
  api,
9
7
  atomicWriteFileSync,
@@ -17,7 +15,6 @@ import {
17
15
  deriveMcpServerKey,
18
16
  diffEnvIntegrations,
19
17
  envOnlyRespawnVars,
20
- estimateActiveTasksTokens,
21
18
  exchangeApiKey,
22
19
  executeConnectivityProbe,
23
20
  extractCommandNotFound,
@@ -45,7 +42,7 @@ import {
45
42
  resolveEffectivePinRaw,
46
43
  safeWriteJsonAtomic,
47
44
  setConfigHash
48
- } from "../chunk-XDODHW3I.js";
45
+ } from "../chunk-AX4F6XJ3.js";
49
46
  import {
50
47
  getProjectDir as getProjectDir2,
51
48
  getReadyTasks,
@@ -55,10 +52,13 @@ import {
55
52
  } from "../chunk-3HLECXMI.js";
56
53
  import {
57
54
  AnchorSessionClient,
55
+ CLAUDE_MD_MAX_CHARS,
58
56
  CONVERSATION_FAILURE_CATEGORIES,
59
57
  DEFAULT_FRAMEWORK,
60
58
  FLAGS_SCHEMA_VERSION,
61
59
  FLAG_REGISTRY,
60
+ INTEGRATIONS_SECTION_END,
61
+ INTEGRATIONS_SECTION_START,
62
62
  KANBAN_CHECK_COMMAND,
63
63
  KANBAN_NUDGE_ACTIONABLE_STATUSES,
64
64
  MAX_AVATAR_ENV_URL_BYTES,
@@ -78,6 +78,7 @@ import {
78
78
  creditWatchdogGiveUpCount,
79
79
  describeOnboardingChannel,
80
80
  egressMode,
81
+ estimateActiveTasksTokens,
81
82
  execFilePromiseLong,
82
83
  extractFrontmatter,
83
84
  formatActorId,
@@ -151,16 +152,16 @@ import {
151
152
  toOpencodeModel,
152
153
  transcriptActivityAgeSeconds,
153
154
  writeEgressAllowlist
154
- } from "../chunk-HXP4I5QZ.js";
155
+ } from "../chunk-IILXBXBL.js";
155
156
  import {
156
157
  reapOrphanChannelMcps
157
158
  } from "../chunk-XWVM4KPK.js";
158
159
 
159
160
  // src/lib/manager-worker.ts
160
161
  import { createHash as createHash15 } from "crypto";
161
- import { readFileSync as readFileSync19, writeFileSync as writeFileSync12, mkdirSync as mkdirSync10, existsSync as existsSync11, rmSync as rmSync5, readdirSync as readdirSync6, statSync as statSync5, copyFileSync } from "fs";
162
+ import { readFileSync as readFileSync20, writeFileSync as writeFileSync12, mkdirSync as mkdirSync10, existsSync as existsSync11, rmSync as rmSync5, readdirSync as readdirSync6, statSync as statSync5, copyFileSync } from "fs";
162
163
  import { execFileSync as syncExecFile } from "child_process";
163
- import { join as join22, dirname as dirname7, delimiter as pathDelimiter } from "path";
164
+ import { join as join23, dirname as dirname7, delimiter as pathDelimiter } from "path";
164
165
  import { homedir as homedir10 } from "os";
165
166
  import { fileURLToPath } from "url";
166
167
 
@@ -801,6 +802,33 @@ function isQuarantineFile(value) {
801
802
  return true;
802
803
  }
803
804
 
805
+ // src/lib/claude-md-size.ts
806
+ import { readFileSync as readFileSync4 } from "fs";
807
+ import { join as join3 } from "path";
808
+ function measureClaudeMd(configDir, codeName, ceiling = CLAUDE_MD_MAX_CHARS) {
809
+ try {
810
+ const buf = readFileSync4(join3(configDir, codeName, "project", "CLAUDE.md"));
811
+ const chars = buf.toString("utf8").length;
812
+ return { chars, bytes: buf.length, ceiling, overCeiling: chars > ceiling };
813
+ } catch {
814
+ return null;
815
+ }
816
+ }
817
+ var lastOverCeiling = /* @__PURE__ */ new Map();
818
+ function logClaudeMdCeilingTransition(codeName, report, log2) {
819
+ if (!report) return null;
820
+ const previous = lastOverCeiling.get(codeName);
821
+ if (previous === void 0 && !report.overCeiling) {
822
+ lastOverCeiling.set(codeName, false);
823
+ return null;
824
+ }
825
+ if (previous === report.overCeiling) return null;
826
+ lastOverCeiling.set(codeName, report.overCeiling);
827
+ const line = report.overCeiling ? `[claude-md] '${codeName}' project/CLAUDE.md is ${report.chars} chars, OVER the ${report.ceiling} ceiling by ${report.chars - report.ceiling} \u2014 Claude Code truncates past this, so the tail of the agent's system prompt is being dropped (ENG-8163)` : `[claude-md] '${codeName}' project/CLAUDE.md back under the ceiling (${report.chars}/${report.ceiling} chars)`;
828
+ log2(line);
829
+ return line;
830
+ }
831
+
804
832
  // src/lib/restart-breaker.ts
805
833
  function reaperRestartBreakerReason(activeKeys) {
806
834
  return activeKeys.length >= 2 ? "mcp-presence-reaper" : void 0;
@@ -1521,7 +1549,7 @@ var DependencyRecoveryLedger = class {
1521
1549
  };
1522
1550
 
1523
1551
  // src/lib/self-update-coalesce.ts
1524
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
1552
+ import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
1525
1553
  import { dirname as dirname3 } from "path";
1526
1554
  var DEFAULT_SELF_UPDATE_COALESCE_MS = 30 * 60 * 1e3;
1527
1555
  function resolveCoalesceWindowMs(env = process.env) {
@@ -1531,7 +1559,7 @@ function resolveCoalesceWindowMs(env = process.env) {
1531
1559
  if (!Number.isFinite(parsed) || parsed < 0) return DEFAULT_SELF_UPDATE_COALESCE_MS;
1532
1560
  return Math.trunc(parsed);
1533
1561
  }
1534
- function readLastSelfUpdateAppliedMs(markerPath, now = Date.now(), read = (p) => readFileSync4(p, "utf-8")) {
1562
+ function readLastSelfUpdateAppliedMs(markerPath, now = Date.now(), read = (p) => readFileSync5(p, "utf-8")) {
1535
1563
  let raw;
1536
1564
  try {
1537
1565
  raw = read(markerPath);
@@ -1786,11 +1814,11 @@ async function reportModelApiError(opts) {
1786
1814
  }
1787
1815
 
1788
1816
  // src/lib/claude-pid-tracker.ts
1789
- import { existsSync, readFileSync as readFileSync5 } from "fs";
1817
+ import { existsSync, readFileSync as readFileSync6 } from "fs";
1790
1818
  function readPidFile(path) {
1791
1819
  if (!existsSync(path)) return { version: 1, spawns: [] };
1792
1820
  try {
1793
- const raw = JSON.parse(readFileSync5(path, "utf-8"));
1821
+ const raw = JSON.parse(readFileSync6(path, "utf-8"));
1794
1822
  if (raw.version !== 1 || !Array.isArray(raw.spawns)) return { version: 1, spawns: [] };
1795
1823
  const spawns = raw.spawns.filter(
1796
1824
  (s) => !!s && typeof s.pid === "number" && Number.isFinite(s.pid) && s.pid > 0
@@ -1840,14 +1868,14 @@ function formatReaperBootLine(opts) {
1840
1868
  }
1841
1869
 
1842
1870
  // src/lib/direct-chat-delivery.ts
1843
- import { join as join3 } from "path";
1871
+ import { join as join4 } from "path";
1844
1872
  var DEFAULT_DIRECT_CHAT_MAX_AGE_MS = 30 * 6e4;
1845
1873
  function directChatMaxAgeMs() {
1846
1874
  const raw = parseInt(process.env["AGT_DIRECT_CHAT_MAX_AGE_MS"] ?? "", 10);
1847
1875
  return Number.isFinite(raw) && raw >= 0 ? raw : DEFAULT_DIRECT_CHAT_MAX_AGE_MS;
1848
1876
  }
1849
1877
  function directChatDoorbellPath(agentId, home) {
1850
- return join3(home, ".augmented", agentId, "direct-chat-doorbell");
1878
+ return join4(home, ".augmented", agentId, "direct-chat-doorbell");
1851
1879
  }
1852
1880
  function isDirectChatMessageExpired(createdAt, nowMs, maxAgeMs) {
1853
1881
  if (!maxAgeMs || maxAgeMs <= 0) return false;
@@ -1884,7 +1912,7 @@ function collectEnvGates(env) {
1884
1912
  }
1885
1913
 
1886
1914
  // src/lib/artifact-stream.ts
1887
- import { join as join4 } from "path";
1915
+ import { join as join5 } from "path";
1888
1916
  import { homedir as homedir2 } from "os";
1889
1917
  import { readdir, stat, readFile } from "fs/promises";
1890
1918
  var ARTEFACT_ENTRY_FILE = "index.html";
@@ -1970,7 +1998,7 @@ var ArtifactStreamScanner = class {
1970
1998
  return;
1971
1999
  }
1972
2000
  for (const name of names) {
1973
- const file = join4(this.artifactsDir, name, ARTEFACT_ENTRY_FILE);
2001
+ const file = join5(this.artifactsDir, name, ARTEFACT_ENTRY_FILE);
1974
2002
  const mtime = await this.fsDeps.mtimeMs(file).catch(() => null);
1975
2003
  if (mtime === null) continue;
1976
2004
  if (this.seenMtime.get(name) === mtime) continue;
@@ -2001,7 +2029,7 @@ var ArtifactStreamScanner = class {
2001
2029
  }
2002
2030
  };
2003
2031
  function artifactsDirFor(codeName) {
2004
- return join4(homedir2(), ".augmented", codeName, "artifacts");
2032
+ return join5(homedir2(), ".augmented", codeName, "artifacts");
2005
2033
  }
2006
2034
  var nodeArtifactFs = {
2007
2035
  async listArtefactNames(artifactsDir) {
@@ -2023,22 +2051,22 @@ var nodeArtifactFs = {
2023
2051
  // src/lib/usage-banner-monitor.ts
2024
2052
  import { mkdirSync as mkdirSync4, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
2025
2053
  import { homedir as homedir3 } from "os";
2026
- import { join as join5 } from "path";
2054
+ import { join as join6 } from "path";
2027
2055
  function syncUsageLimitMarker(args) {
2028
2056
  if (args.pct < 100) {
2029
2057
  clearUsageLimitMarker(args.codeName, args.log);
2030
2058
  return;
2031
2059
  }
2032
- const path = join5(homedir3(), ".augmented", args.codeName, USAGE_LIMIT_MARKER_FILENAME);
2060
+ const path = join6(homedir3(), ".augmented", args.codeName, USAGE_LIMIT_MARKER_FILENAME);
2033
2061
  try {
2034
- mkdirSync4(join5(homedir3(), ".augmented", args.codeName), { recursive: true });
2062
+ mkdirSync4(join6(homedir3(), ".augmented", args.codeName), { recursive: true });
2035
2063
  writeFileSync4(path, serializeUsageLimitMarker(args.weekResetsAt), "utf-8");
2036
2064
  } catch (err) {
2037
2065
  args.log(`[usage-banner] usage-limit marker sync failed for '${args.codeName}': ${err.message}`);
2038
2066
  }
2039
2067
  }
2040
2068
  function clearUsageLimitMarker(codeName, log2) {
2041
- const path = join5(homedir3(), ".augmented", codeName, USAGE_LIMIT_MARKER_FILENAME);
2069
+ const path = join6(homedir3(), ".augmented", codeName, USAGE_LIMIT_MARKER_FILENAME);
2042
2070
  try {
2043
2071
  rmSync2(path, { force: true });
2044
2072
  } catch (err) {
@@ -2121,8 +2149,8 @@ async function maybeReportUsageBanner(args) {
2121
2149
  }
2122
2150
 
2123
2151
  // src/lib/token-usage-monitor.ts
2124
- import { readdirSync, readFileSync as readFileSync6, statSync } from "fs";
2125
- import { join as join6 } from "path";
2152
+ import { readdirSync, readFileSync as readFileSync7, statSync } from "fs";
2153
+ import { join as join7 } from "path";
2126
2154
  var MIN_CHECK_INTERVAL_MS2 = 6e4;
2127
2155
  var TRANSCRIPT_MTIME_WINDOW_MS = 2 * 24 * 60 * 60 * 1e3;
2128
2156
  var MAX_ENTRIES_PER_POST = 200;
@@ -2151,7 +2179,7 @@ async function maybeReportTokenUsage(args) {
2151
2179
  if (!name.endsWith(".jsonl")) continue;
2152
2180
  const sessionId = name.slice(0, -".jsonl".length);
2153
2181
  if (!sessionId) continue;
2154
- const path = join6(dir, name);
2182
+ const path = join7(dir, name);
2155
2183
  let st;
2156
2184
  try {
2157
2185
  st = statSync(path);
@@ -2167,7 +2195,7 @@ async function maybeReportTokenUsage(args) {
2167
2195
  }
2168
2196
  let content;
2169
2197
  try {
2170
- content = readFileSync6(path, "utf-8");
2198
+ content = readFileSync7(path, "utf-8");
2171
2199
  } catch (err) {
2172
2200
  log2(`[token-usage] read failed for '${codeName}/${name}': ${err.message}`);
2173
2201
  continue;
@@ -2248,8 +2276,8 @@ async function maybeReportTokenUsage(args) {
2248
2276
  }
2249
2277
 
2250
2278
  // src/lib/workflow-run-reconciler.ts
2251
- import { readdirSync as readdirSync2, readFileSync as readFileSync7, statSync as statSync2 } from "fs";
2252
- import { join as join7 } from "path";
2279
+ import { readdirSync as readdirSync2, readFileSync as readFileSync8, statSync as statSync2 } from "fs";
2280
+ import { join as join8 } from "path";
2253
2281
  var MIN_CHECK_INTERVAL_MS3 = 5 * 6e4;
2254
2282
  var SETTLE_MS = 3e4;
2255
2283
  var TRANSCRIPT_MTIME_WINDOW_MS2 = 2 * 24 * 60 * 60 * 1e3;
@@ -2268,7 +2296,7 @@ function collectJsonlRecursive(dir, minMtimeMs, out, depth) {
2268
2296
  return;
2269
2297
  }
2270
2298
  for (const name of entries) {
2271
- const p = join7(dir, name);
2299
+ const p = join8(dir, name);
2272
2300
  let st;
2273
2301
  try {
2274
2302
  st = statSync2(p);
@@ -2291,7 +2319,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
2291
2319
  return out;
2292
2320
  }
2293
2321
  for (const name of entries) {
2294
- const path = join7(transcriptDir, name);
2322
+ const path = join8(transcriptDir, name);
2295
2323
  let st;
2296
2324
  try {
2297
2325
  st = statSync2(path);
@@ -2303,7 +2331,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
2303
2331
  continue;
2304
2332
  }
2305
2333
  if (st.isDirectory()) {
2306
- collectJsonlRecursive(join7(path, "subagents"), minMtimeMs, out, 0);
2334
+ collectJsonlRecursive(join8(path, "subagents"), minMtimeMs, out, 0);
2307
2335
  }
2308
2336
  }
2309
2337
  return out;
@@ -2348,7 +2376,7 @@ async function maybeReconcileWorkflowRunTokens(args) {
2348
2376
  const contents = [];
2349
2377
  for (const path of files) {
2350
2378
  try {
2351
- contents.push(readFileSync7(path, "utf-8"));
2379
+ contents.push(readFileSync8(path, "utf-8"));
2352
2380
  } catch {
2353
2381
  }
2354
2382
  }
@@ -2393,8 +2421,8 @@ async function maybeReconcileWorkflowRunTokens(args) {
2393
2421
  }
2394
2422
 
2395
2423
  // src/lib/conversation-evaluator.ts
2396
- import { readdirSync as readdirSync3, readFileSync as readFileSync8, statSync as statSync3 } from "fs";
2397
- import { join as join8 } from "path";
2424
+ import { readdirSync as readdirSync3, readFileSync as readFileSync9, statSync as statSync3 } from "fs";
2425
+ import { join as join9 } from "path";
2398
2426
  var MIN_CHECK_INTERVAL_MS4 = 5 * 6e4;
2399
2427
  var TRANSCRIPT_MTIME_WINDOW_MS3 = 7 * 24 * 60 * 60 * 1e3;
2400
2428
  var WINDOW_PAD_MS = 5 * 6e4;
@@ -2830,7 +2858,7 @@ function readRecentTurns(dir, nowMs) {
2830
2858
  return;
2831
2859
  }
2832
2860
  for (const ent of entries) {
2833
- const full = join8(d, ent.name);
2861
+ const full = join9(d, ent.name);
2834
2862
  if (ent.isDirectory()) {
2835
2863
  visit(full);
2836
2864
  continue;
@@ -2845,7 +2873,7 @@ function readRecentTurns(dir, nowMs) {
2845
2873
  if (nowMs - mtimeMs > TRANSCRIPT_MTIME_WINDOW_MS3) continue;
2846
2874
  let content;
2847
2875
  try {
2848
- content = readFileSync8(full, "utf8");
2876
+ content = readFileSync9(full, "utf8");
2849
2877
  } catch {
2850
2878
  continue;
2851
2879
  }
@@ -3135,11 +3163,11 @@ async function reportSkip2(api2, agentId, conversationId, log2, codeName) {
3135
3163
  }
3136
3164
 
3137
3165
  // src/lib/activity-cache-monitor.ts
3138
- import { existsSync as existsSync2, readFileSync as readFileSync9 } from "fs";
3166
+ import { existsSync as existsSync2, readFileSync as readFileSync10 } from "fs";
3139
3167
  import { homedir as homedir4 } from "os";
3140
- import { join as join9 } from "path";
3168
+ import { join as join10 } from "path";
3141
3169
  var MIN_CHECK_INTERVAL_MS6 = 6e4;
3142
- var STATS_CACHE_PATH = join9(homedir4(), ".claude", "stats-cache.json");
3170
+ var STATS_CACHE_PATH = join10(homedir4(), ".claude", "stats-cache.json");
3143
3171
  var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
3144
3172
  var state5 = { lastObservedDate: null, lastCheckedAt: 0 };
3145
3173
  function selectNewDailyRows(raw, lastObservedDate) {
@@ -3187,7 +3215,7 @@ async function maybeReportActivityCache(args) {
3187
3215
  }
3188
3216
  let raw;
3189
3217
  try {
3190
- raw = readFileSync9(STATS_CACHE_PATH, "utf-8");
3218
+ raw = readFileSync10(STATS_CACHE_PATH, "utf-8");
3191
3219
  } catch (err) {
3192
3220
  log2(`[activity-cache] readFileSync failed: ${err.message}`);
3193
3221
  return;
@@ -3374,7 +3402,7 @@ function bundleFingerprint(files) {
3374
3402
  // src/lib/claude-auth-detect.ts
3375
3403
  import { readFile as readFile2, readdir as readdir2 } from "fs/promises";
3376
3404
  import { homedir as homedir5, platform } from "os";
3377
- import { join as join10 } from "path";
3405
+ import { join as join11 } from "path";
3378
3406
  import { execFile } from "child_process";
3379
3407
  import { promisify } from "util";
3380
3408
  var execFileAsync = promisify(execFile);
@@ -3389,8 +3417,8 @@ async function detectClaudeAuth() {
3389
3417
  }
3390
3418
  async function findClaudeCredentialsPaths() {
3391
3419
  const candidates = [
3392
- join10(homedir5(), ".claude", ".credentials.json"),
3393
- join10(homedir5(), ".claude", "credentials.json")
3420
+ join11(homedir5(), ".claude", ".credentials.json"),
3421
+ join11(homedir5(), ".claude", "credentials.json")
3394
3422
  ];
3395
3423
  const isLinuxRoot = platform() === "linux" && typeof process.getuid === "function" && process.getuid() === 0;
3396
3424
  if (isLinuxRoot) {
@@ -3398,8 +3426,8 @@ async function findClaudeCredentialsPaths() {
3398
3426
  const entries = await readdir2("/home", { withFileTypes: true });
3399
3427
  for (const entry of entries) {
3400
3428
  if (!entry.isDirectory()) continue;
3401
- candidates.push(join10("/home", entry.name, ".claude", ".credentials.json"));
3402
- candidates.push(join10("/home", entry.name, ".claude", "credentials.json"));
3429
+ candidates.push(join11("/home", entry.name, ".claude", ".credentials.json"));
3430
+ candidates.push(join11("/home", entry.name, ".claude", "credentials.json"));
3403
3431
  }
3404
3432
  } catch {
3405
3433
  }
@@ -3495,18 +3523,18 @@ function computeChannelConfigHash(input) {
3495
3523
  }
3496
3524
 
3497
3525
  // src/lib/channel-hash-cache.ts
3498
- import { existsSync as existsSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
3499
- import { join as join11 } from "path";
3526
+ import { existsSync as existsSync3, readFileSync as readFileSync11, writeFileSync as writeFileSync5 } from "fs";
3527
+ import { join as join12 } from "path";
3500
3528
  var CACHE_FILENAME = "channel-hash-cache.json";
3501
3529
  function getChannelHashCacheFile(configDir) {
3502
- return join11(configDir, CACHE_FILENAME);
3530
+ return join12(configDir, CACHE_FILENAME);
3503
3531
  }
3504
3532
  function loadChannelHashCache(target, configDir) {
3505
3533
  const path = getChannelHashCacheFile(configDir);
3506
3534
  if (!existsSync3(path)) return;
3507
3535
  let parsed;
3508
3536
  try {
3509
- parsed = JSON.parse(readFileSync10(path, "utf-8"));
3537
+ parsed = JSON.parse(readFileSync11(path, "utf-8"));
3510
3538
  } catch {
3511
3539
  return;
3512
3540
  }
@@ -3526,8 +3554,8 @@ function saveChannelHashCache(source, configDir) {
3526
3554
  }
3527
3555
 
3528
3556
  // src/lib/sender-policy-baseline.ts
3529
- import { existsSync as existsSync4, readFileSync as readFileSync11 } from "fs";
3530
- import { join as join12 } from "path";
3557
+ import { existsSync as existsSync4, readFileSync as readFileSync12 } from "fs";
3558
+ import { join as join13 } from "path";
3531
3559
  var BASELINE_FILENAME = "sender-policy-baseline.json";
3532
3560
  var SENDER_POLICY_BASELINE_VERSION = 1;
3533
3561
  var BASELINE_CONCERNS = ["senderPolicy", "slackBehaviour", "msteamsBehaviour"];
@@ -3539,14 +3567,14 @@ function createDeliveryBaselineMaps() {
3539
3567
  };
3540
3568
  }
3541
3569
  function getSenderPolicyBaselineFile(configDir) {
3542
- return join12(configDir, BASELINE_FILENAME);
3570
+ return join13(configDir, BASELINE_FILENAME);
3543
3571
  }
3544
3572
  function loadSenderPolicyBaseline(target, configDir, log2) {
3545
3573
  const path = getSenderPolicyBaselineFile(configDir);
3546
3574
  if (!existsSync4(path)) return;
3547
3575
  let parsed;
3548
3576
  try {
3549
- parsed = JSON.parse(readFileSync11(path, "utf-8"));
3577
+ parsed = JSON.parse(readFileSync12(path, "utf-8"));
3550
3578
  } catch (err) {
3551
3579
  log2?.(
3552
3580
  `[sender-policy] discarding corrupt ${BASELINE_FILENAME} (${err.message}) - restrictive-policy agents will take one fail-closed restart`
@@ -4069,16 +4097,16 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash, options)
4069
4097
  }
4070
4098
 
4071
4099
  // src/lib/manager/managed-skill-manifest.ts
4072
- import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync6 } from "fs";
4073
- import { dirname as dirname4, join as join13 } from "path";
4100
+ import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
4101
+ import { dirname as dirname4, join as join14 } from "path";
4074
4102
  var MANIFEST_VERSION = 1;
4075
4103
  function managedSkillManifestPath(agentRootDir) {
4076
- return join13(agentRootDir, "managed-skills.json");
4104
+ return join14(agentRootDir, "managed-skills.json");
4077
4105
  }
4078
4106
  function readManagedSkillManifest(path) {
4079
4107
  try {
4080
4108
  if (!existsSync5(path)) return /* @__PURE__ */ new Set();
4081
- const parsed = JSON.parse(readFileSync12(path, "utf-8"));
4109
+ const parsed = JSON.parse(readFileSync13(path, "utf-8"));
4082
4110
  const ids = Array.isArray(parsed?.globalSkillIds) ? parsed.globalSkillIds : [];
4083
4111
  return new Set(ids.filter((id) => typeof id === "string" && id.length > 0));
4084
4112
  } catch {
@@ -4191,7 +4219,7 @@ function resolveModelChain(refreshData) {
4191
4219
 
4192
4220
  // src/lib/manager/claude-auth.ts
4193
4221
  import { existsSync as existsSync6, rmSync as rmSync3 } from "fs";
4194
- import { join as join14 } from "path";
4222
+ import { join as join15 } from "path";
4195
4223
  import { homedir as homedir6 } from "os";
4196
4224
  async function applyClaudeAuthToEnv(childEnv, label) {
4197
4225
  const apiKey = getApiKey();
@@ -4204,9 +4232,9 @@ async function applyClaudeAuthToEnv(childEnv, label) {
4204
4232
  throw new Error("claude_auth_mode=api_key but /host/exchange returned no decrypted key");
4205
4233
  }
4206
4234
  childEnv.ANTHROPIC_API_KEY = exchange.anthropicApiKey;
4207
- const claudeDir = join14(homedir6(), ".claude");
4235
+ const claudeDir = join15(homedir6(), ".claude");
4208
4236
  for (const filename of [".credentials.json", "credentials.json"]) {
4209
- const p = join14(claudeDir, filename);
4237
+ const p = join15(claudeDir, filename);
4210
4238
  if (existsSync6(p)) {
4211
4239
  try {
4212
4240
  rmSync3(p, { force: true });
@@ -4221,8 +4249,8 @@ async function applyClaudeAuthToEnv(childEnv, label) {
4221
4249
  }
4222
4250
 
4223
4251
  // src/lib/manager/kanban/parsers.ts
4224
- import { existsSync as existsSync7, readFileSync as readFileSync13 } from "fs";
4225
- import { join as join15 } from "path";
4252
+ import { existsSync as existsSync7, readFileSync as readFileSync14 } from "fs";
4253
+ import { join as join16 } from "path";
4226
4254
  var STANDUP_TEMPLATES = /* @__PURE__ */ new Set(["daily-standup", "end-of-day-summary"]);
4227
4255
  var TASK_UPDATE_TEMPLATES = /* @__PURE__ */ new Set(["hourly-status", "task-update"]);
4228
4256
  var PLAN_TEMPLATES = /* @__PURE__ */ new Set(["morning-plan"]);
@@ -4361,12 +4389,12 @@ function getBuiltInSkillContent(skillId) {
4361
4389
  if (builtInSkillCache.has(skillId)) return builtInSkillCache.get(skillId);
4362
4390
  try {
4363
4391
  const candidates = [
4364
- join15(process.cwd(), "skills", skillId, "SKILL.md"),
4365
- join15(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
4392
+ join16(process.cwd(), "skills", skillId, "SKILL.md"),
4393
+ join16(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
4366
4394
  ];
4367
4395
  for (const candidate of candidates) {
4368
4396
  if (existsSync7(candidate)) {
4369
- const content = readFileSync13(candidate, "utf-8");
4397
+ const content = readFileSync14(candidate, "utf-8");
4370
4398
  const files = [{ relativePath: "SKILL.md", content }];
4371
4399
  builtInSkillCache.set(skillId, files);
4372
4400
  return files;
@@ -4507,19 +4535,19 @@ function formatBoardForPrompt(items, template) {
4507
4535
  }
4508
4536
 
4509
4537
  // src/lib/manager/kanban/nudge-state-cache.ts
4510
- import { existsSync as existsSync8, readFileSync as readFileSync14, writeFileSync as writeFileSync7 } from "fs";
4511
- import { join as join16 } from "path";
4538
+ import { existsSync as existsSync8, readFileSync as readFileSync15, writeFileSync as writeFileSync7 } from "fs";
4539
+ import { join as join17 } from "path";
4512
4540
  var CACHE_FILENAME2 = "kanban-nudge-state.json";
4513
4541
  var KANBAN_NUDGE_STATE_VERSION = 1;
4514
4542
  function getKanbanNudgeStateFile(configDir) {
4515
- return join16(configDir, CACHE_FILENAME2);
4543
+ return join17(configDir, CACHE_FILENAME2);
4516
4544
  }
4517
4545
  function loadKanbanNudgeState(target, configDir) {
4518
4546
  const path = getKanbanNudgeStateFile(configDir);
4519
4547
  if (!existsSync8(path)) return;
4520
4548
  let parsed;
4521
4549
  try {
4522
- parsed = JSON.parse(readFileSync14(path, "utf-8"));
4550
+ parsed = JSON.parse(readFileSync15(path, "utf-8"));
4523
4551
  } catch {
4524
4552
  return;
4525
4553
  }
@@ -5085,9 +5113,9 @@ function closeScheduledRunsForCode(codeName, outcome, reason) {
5085
5113
 
5086
5114
  // src/lib/manager/scheduler/kanban-route.ts
5087
5115
  import { createHash as createHash10 } from "crypto";
5088
- import { writeFileSync as writeFileSync8, renameSync, mkdirSync as mkdirSync6, readFileSync as readFileSync15, unlinkSync } from "fs";
5116
+ import { writeFileSync as writeFileSync8, renameSync, mkdirSync as mkdirSync6, readFileSync as readFileSync16, unlinkSync } from "fs";
5089
5117
  import { homedir as homedir7 } from "os";
5090
- import { join as join17, dirname as dirname5 } from "path";
5118
+ import { join as join18, dirname as dirname5 } from "path";
5091
5119
 
5092
5120
  // src/lib/manager/scheduler/notify.ts
5093
5121
  import { createHash as createHash9 } from "crypto";
@@ -5427,7 +5455,7 @@ function resolveScheduledSlackTarget(task) {
5427
5455
  }
5428
5456
  function stampScheduledTurnMarker(codeName, taskId, target) {
5429
5457
  try {
5430
- const file = join17(homedir7(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
5458
+ const file = join18(homedir7(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
5431
5459
  const marker = { ts: Date.now(), task_id: taskId, ...target ? { target } : {} };
5432
5460
  const tmp = `${file}.tmp`;
5433
5461
  writeFileSync8(tmp, JSON.stringify(marker), "utf8");
@@ -5437,9 +5465,9 @@ function stampScheduledTurnMarker(codeName, taskId, target) {
5437
5465
  }
5438
5466
  }
5439
5467
  function clearScheduledTurnMarkerForTask(codeName, taskId) {
5440
- const file = join17(homedir7(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
5468
+ const file = join18(homedir7(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
5441
5469
  try {
5442
- const raw = JSON.parse(readFileSync15(file, "utf8"));
5470
+ const raw = JSON.parse(readFileSync16(file, "utf8"));
5443
5471
  if (typeof raw?.task_id !== "string" || raw.task_id !== taskId) return;
5444
5472
  unlinkSync(file);
5445
5473
  log(`[scheduled-kanban] scheduled-turn marker cleared for '${codeName}' (task ${taskId} complete)`);
@@ -5646,9 +5674,9 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
5646
5674
  // src/lib/manager/scheduler/execution.ts
5647
5675
  import { createHash as createHash11 } from "crypto";
5648
5676
  import { homedir as homedir8 } from "os";
5649
- import { join as join18 } from "path";
5677
+ import { join as join19 } from "path";
5650
5678
  function claudePidFilePath() {
5651
- return join18(homedir8(), ".augmented", "manager-claude-pids.json");
5679
+ return join19(homedir8(), ".augmented", "manager-claude-pids.json");
5652
5680
  }
5653
5681
  var inFlightClaudePids = /* @__PURE__ */ new Map();
5654
5682
  function registerClaudeSpawn(record) {
@@ -6872,9 +6900,9 @@ async function fireOpencodeScheduledTask(agent, task) {
6872
6900
 
6873
6901
  // src/lib/opencode-telegram-ingest.ts
6874
6902
  import { createHash as createHash14 } from "crypto";
6875
- import { existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync16, renameSync as renameSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync9 } from "fs";
6903
+ import { existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync17, renameSync as renameSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync9 } from "fs";
6876
6904
  import { randomUUID } from "crypto";
6877
- import { join as join19 } from "path";
6905
+ import { join as join20 } from "path";
6878
6906
 
6879
6907
  // src/lib/telegram-ingest.ts
6880
6908
  import https2 from "https";
@@ -7422,7 +7450,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
7422
7450
  let filePath;
7423
7451
  try {
7424
7452
  dir = getFramework("opencode").getAgentDir(codeName);
7425
- filePath = join19(dir, "telegram-getupdates-offset-opencode.json");
7453
+ filePath = join20(dir, "telegram-getupdates-offset-opencode.json");
7426
7454
  } catch {
7427
7455
  dir = null;
7428
7456
  filePath = null;
@@ -7431,7 +7459,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
7431
7459
  load() {
7432
7460
  if (!filePath) return 0;
7433
7461
  try {
7434
- const parsed = JSON.parse(readFileSync16(filePath, "utf-8"));
7462
+ const parsed = JSON.parse(readFileSync17(filePath, "utf-8"));
7435
7463
  if (currentBotId != null && typeof parsed?.bot_id === "number" && parsed.bot_id !== currentBotId) {
7436
7464
  log2(`[telegram-ingest:${codeName}] offset cursor belongs to a different bot; ignoring (bot swap)`);
7437
7465
  return 0;
@@ -7681,15 +7709,15 @@ function partitionActionableByPoison(actionable, states, config2) {
7681
7709
  }
7682
7710
 
7683
7711
  // src/lib/restart-flags.ts
7684
- import { existsSync as existsSync10, mkdirSync as mkdirSync8, readdirSync as readdirSync4, readFileSync as readFileSync17, renameSync as renameSync3, rmSync as rmSync4, writeFileSync as writeFileSync10 } from "fs";
7712
+ import { existsSync as existsSync10, mkdirSync as mkdirSync8, readdirSync as readdirSync4, readFileSync as readFileSync18, renameSync as renameSync3, rmSync as rmSync4, writeFileSync as writeFileSync10 } from "fs";
7685
7713
  import { homedir as homedir9 } from "os";
7686
- import { join as join20 } from "path";
7714
+ import { join as join21 } from "path";
7687
7715
  import { randomUUID as randomUUID2 } from "crypto";
7688
7716
  function restartFlagsDir() {
7689
- return join20(homedir9(), ".augmented", "restart-flags");
7717
+ return join21(homedir9(), ".augmented", "restart-flags");
7690
7718
  }
7691
7719
  function flagPath(codeName) {
7692
- return join20(restartFlagsDir(), `${codeName}.flag`);
7720
+ return join21(restartFlagsDir(), `${codeName}.flag`);
7693
7721
  }
7694
7722
  function readRestartFlags() {
7695
7723
  const dir = restartFlagsDir();
@@ -7698,7 +7726,7 @@ function readRestartFlags() {
7698
7726
  for (const entry of readdirSync4(dir)) {
7699
7727
  if (!entry.endsWith(".flag")) continue;
7700
7728
  try {
7701
- const raw = readFileSync17(join20(dir, entry), "utf8");
7729
+ const raw = readFileSync18(join21(dir, entry), "utf8");
7702
7730
  const parsed = JSON.parse(raw);
7703
7731
  if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
7704
7732
  parsed.codeName = entry.replace(/\.flag$/, "");
@@ -7816,8 +7844,8 @@ async function sendError(flag, opts, text) {
7816
7844
  }
7817
7845
 
7818
7846
  // src/lib/restart-context.ts
7819
- import { readdirSync as readdirSync5, readFileSync as readFileSync18, writeFileSync as writeFileSync11, mkdirSync as mkdirSync9, unlinkSync as unlinkSync3 } from "fs";
7820
- import { dirname as dirname6, join as join21 } from "path";
7847
+ import { readdirSync as readdirSync5, readFileSync as readFileSync19, writeFileSync as writeFileSync11, mkdirSync as mkdirSync9, unlinkSync as unlinkSync3 } from "fs";
7848
+ import { dirname as dirname6, join as join22 } from "path";
7821
7849
  var SLACK_PENDING_INBOUND_DIRNAME = "slack-pending-inbound";
7822
7850
  var SLACK_RESTART_CONTEXT_DIRNAME = "slack-restart-context";
7823
7851
  var MAX_TOPIC_CHARS = 140;
@@ -7829,10 +7857,10 @@ function augmentedAgentDir(codeName) {
7829
7857
  return dirname6(getProjectDir(codeName));
7830
7858
  }
7831
7859
  function slackPendingInboundDir(codeName) {
7832
- return join21(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
7860
+ return join22(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
7833
7861
  }
7834
7862
  function slackRestartContextDir(codeName) {
7835
- return join21(augmentedAgentDir(codeName), SLACK_RESTART_CONTEXT_DIRNAME);
7863
+ return join22(augmentedAgentDir(codeName), SLACK_RESTART_CONTEXT_DIRNAME);
7836
7864
  }
7837
7865
  function sanitizeTopic(raw) {
7838
7866
  const cleaned = raw.replace(/\s+/g, " ").trim().replace(/[<>]/g, " ").replace(/\s+/g, " ").trim();
@@ -7874,7 +7902,7 @@ function safeReaddir(dir) {
7874
7902
  }
7875
7903
  function readStrandedMarker(path) {
7876
7904
  try {
7877
- const parsed = JSON.parse(readFileSync18(path, "utf-8"));
7905
+ const parsed = JSON.parse(readFileSync19(path, "utf-8"));
7878
7906
  if (typeof parsed.channel === "string" && typeof parsed.thread_ts === "string") {
7879
7907
  return { channel: parsed.channel, thread_ts: parsed.thread_ts };
7880
7908
  }
@@ -7892,7 +7920,7 @@ function pruneHintsExcept(codeName, freshFilenames) {
7892
7920
  if (!filename.endsWith(".json")) continue;
7893
7921
  if (freshFilenames.has(filename)) continue;
7894
7922
  try {
7895
- unlinkSync3(join21(ctxDir, filename));
7923
+ unlinkSync3(join22(ctxDir, filename));
7896
7924
  } catch {
7897
7925
  }
7898
7926
  }
@@ -7913,7 +7941,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
7913
7941
  }
7914
7942
  const markers = [];
7915
7943
  for (const filename of markerFilenames.slice(0, cap)) {
7916
- const parsed = readStrandedMarker(join21(markerDir, filename));
7944
+ const parsed = readStrandedMarker(join22(markerDir, filename));
7917
7945
  if (parsed) markers.push({ filename, channel: parsed.channel, thread_ts: parsed.thread_ts });
7918
7946
  }
7919
7947
  if (markers.length === 0) {
@@ -7927,7 +7955,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
7927
7955
  const freshFilenames = /* @__PURE__ */ new Set();
7928
7956
  for (const { filename, hint } of hints) {
7929
7957
  try {
7930
- writeHintFile(join21(ctxDir, filename), ctxDir, hint);
7958
+ writeHintFile(join22(ctxDir, filename), ctxDir, hint);
7931
7959
  freshFilenames.add(filename);
7932
7960
  } catch (err) {
7933
7961
  log2(`[restart-context] ${codeName}: hint write failed for ${filename}: ${err.message}`);
@@ -9157,7 +9185,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
9157
9185
  var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
9158
9186
  function projectMcpHash(_codeName, projectDir) {
9159
9187
  try {
9160
- const raw = readFileSync19(join22(projectDir, ".mcp.json"), "utf-8");
9188
+ const raw = readFileSync20(join23(projectDir, ".mcp.json"), "utf-8");
9161
9189
  return createHash15("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
9162
9190
  } catch {
9163
9191
  return null;
@@ -9165,7 +9193,7 @@ function projectMcpHash(_codeName, projectDir) {
9165
9193
  }
9166
9194
  function projectMcpKeys(_codeName, projectDir) {
9167
9195
  try {
9168
- const raw = readFileSync19(join22(projectDir, ".mcp.json"), "utf-8");
9196
+ const raw = readFileSync20(join23(projectDir, ".mcp.json"), "utf-8");
9169
9197
  const parsed = JSON.parse(raw);
9170
9198
  const servers = parsed.mcpServers;
9171
9199
  if (!servers || typeof servers !== "object") return /* @__PURE__ */ new Set();
@@ -9183,7 +9211,7 @@ function seedSessionLaunchBaselines(codeName, projectDir) {
9183
9211
  else runningMcpServerKeys.delete(codeName);
9184
9212
  let launchStructure = null;
9185
9213
  try {
9186
- const raw = readFileSync19(join22(projectDir, ".mcp.json"), "utf-8");
9214
+ const raw = readFileSync20(join23(projectDir, ".mcp.json"), "utf-8");
9187
9215
  launchStructure = managedMcpStructureHashFromFile(
9188
9216
  JSON.parse(raw),
9189
9217
  isManagedMcpServerKey
@@ -9287,7 +9315,7 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
9287
9315
  if (result && result.rebindCandidates.length > 0 && hostFlagStore().getBoolean("session-tool-rebind")) {
9288
9316
  let mcpJsonForRebind = null;
9289
9317
  try {
9290
- mcpJsonForRebind = JSON.parse(readFileSync19(join22(projectDir, ".mcp.json"), "utf-8"));
9318
+ mcpJsonForRebind = JSON.parse(readFileSync20(join23(projectDir, ".mcp.json"), "utf-8"));
9291
9319
  } catch {
9292
9320
  mcpJsonForRebind = null;
9293
9321
  }
@@ -9438,7 +9466,7 @@ function checkMcpConfigDriftAndScheduleRestart(codeName, projectDir) {
9438
9466
  function projectChannelSecretHash(projectDir) {
9439
9467
  try {
9440
9468
  const entries = parseEnvIntegrations(
9441
- readFileSync19(join22(projectDir, ".env.integrations"), "utf-8")
9469
+ readFileSync20(join23(projectDir, ".env.integrations"), "utf-8")
9442
9470
  );
9443
9471
  return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
9444
9472
  } catch {
@@ -9534,7 +9562,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9534
9562
  var lastVersionCheckAt = 0;
9535
9563
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9536
9564
  var lastResponsivenessProbeAt = 0;
9537
- var agtCliVersion = true ? "0.28.426" : "dev";
9565
+ var agtCliVersion = true ? "0.28.428" : "dev";
9538
9566
  function resolveBrewPath(execFileSync2) {
9539
9567
  try {
9540
9568
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -9823,7 +9851,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
9823
9851
  try {
9824
9852
  let settings = {};
9825
9853
  if (existsSync11(path)) {
9826
- const raw = readFileSync19(path, "utf-8").trim();
9854
+ const raw = readFileSync20(path, "utf-8").trim();
9827
9855
  if (raw) {
9828
9856
  let parsed;
9829
9857
  try {
@@ -9878,7 +9906,7 @@ async function ensureOpencodeBinary() {
9878
9906
  try {
9879
9907
  const prefix = execFileSync2("npm", ["prefix", "-g"], { encoding: "utf-8", timeout: 1e4 }).trim();
9880
9908
  if (prefix) {
9881
- const npmBin = join22(prefix, "bin");
9909
+ const npmBin = join23(prefix, "bin");
9882
9910
  const current = (process.env.PATH ?? "").split(pathDelimiter);
9883
9911
  if (!current.includes(npmBin)) {
9884
9912
  process.env.PATH = [npmBin, ...current.filter(Boolean)].join(pathDelimiter);
@@ -9995,7 +10023,7 @@ ${r.stderr}`;
9995
10023
  }
9996
10024
  var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9997
10025
  function selfUpdateAppliedMarkerPath() {
9998
- return join22(homedir10(), ".augmented", ".last-self-update-applied");
10026
+ return join23(homedir10(), ".augmented", ".last-self-update-applied");
9999
10027
  }
10000
10028
  var selfUpdateUpToDateLogged = false;
10001
10029
  var selfUpdatePinnedLogged = false;
@@ -10023,7 +10051,7 @@ async function checkAndUpdateCli(opts) {
10023
10051
  const isNpmGlobal = !isBrewFormula && resolvedPath.includes("node_modules");
10024
10052
  if (!isBrewFormula && !isNpmGlobal) return "noop";
10025
10053
  const { readFileSync: readF, writeFileSync: writeF } = await import("fs");
10026
- const markerPath = join22(homedir10(), ".augmented", ".last-update-check");
10054
+ const markerPath = join23(homedir10(), ".augmented", ".last-update-check");
10027
10055
  if (!force) {
10028
10056
  try {
10029
10057
  const lastCheck = parseInt(readF(markerPath, "utf-8").trim(), 10);
@@ -10383,12 +10411,12 @@ async function checkClaudeAuth() {
10383
10411
  var evalEmptyMcpConfigPath = null;
10384
10412
  function ensureEvalEmptyMcpConfig() {
10385
10413
  if (evalEmptyMcpConfigPath && existsSync11(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
10386
- const dir = join22(homedir10(), ".augmented");
10414
+ const dir = join23(homedir10(), ".augmented");
10387
10415
  try {
10388
10416
  mkdirSync10(dir, { recursive: true });
10389
10417
  } catch {
10390
10418
  }
10391
- const p = join22(dir, ".eval-empty-mcp.json");
10419
+ const p = join23(dir, ".eval-empty-mcp.json");
10392
10420
  writeFileSync12(p, JSON.stringify({ mcpServers: {} }));
10393
10421
  evalEmptyMcpConfigPath = p;
10394
10422
  return p;
@@ -10480,10 +10508,10 @@ function resolveConversationEvalBackend() {
10480
10508
  return conversationEvalBackend;
10481
10509
  }
10482
10510
  function getStateFile() {
10483
- return join22(config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
10511
+ return join23(config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
10484
10512
  }
10485
10513
  function channelHashCacheDir() {
10486
- return config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented");
10514
+ return config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented");
10487
10515
  }
10488
10516
  function loadChannelHashCache2() {
10489
10517
  loadChannelHashCache(agentState.knownChannelConfigHashes, channelHashCacheDir());
@@ -10535,7 +10563,7 @@ function removeDeliveryBaselineEntries(agentId) {
10535
10563
  var _channelQuarantineStore = null;
10536
10564
  function channelQuarantineStore() {
10537
10565
  if (!_channelQuarantineStore) {
10538
- const dir = config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented");
10566
+ const dir = config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented");
10539
10567
  _channelQuarantineStore = new ChannelQuarantineStore(defaultQuarantinePath(dir));
10540
10568
  }
10541
10569
  return _channelQuarantineStore;
@@ -10543,10 +10571,16 @@ function channelQuarantineStore() {
10543
10571
  function quarantineEntriesFor(codeName) {
10544
10572
  return channelQuarantineStore().getQuarantineEntries(codeName);
10545
10573
  }
10574
+ function claudeMdSizeFor(codeName) {
10575
+ if (!config?.configDir) return null;
10576
+ const report = measureClaudeMd(config.configDir, codeName);
10577
+ logClaudeMdCeilingTransition(codeName, report, log);
10578
+ return report;
10579
+ }
10546
10580
  var _hostFlagStore = null;
10547
10581
  function hostFlagStore() {
10548
10582
  if (!_hostFlagStore) {
10549
- const dir = config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented");
10583
+ const dir = config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented");
10550
10584
  _hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
10551
10585
  }
10552
10586
  return _hostFlagStore;
@@ -10614,12 +10648,12 @@ function parseSkillFrontmatter(content) {
10614
10648
  }
10615
10649
  async function refreshSkillsIndexInClaudeMd(configDir, codeName, log2) {
10616
10650
  const { readdirSync: readdirSync7, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync13 } = await import("fs");
10617
- const skillsDir = join22(configDir, codeName, "project", ".claude", "skills");
10618
- const claudeMdPath = join22(configDir, codeName, "project", "CLAUDE.md");
10651
+ const skillsDir = join23(configDir, codeName, "project", ".claude", "skills");
10652
+ const claudeMdPath = join23(configDir, codeName, "project", "CLAUDE.md");
10619
10653
  if (!ex(skillsDir) || !ex(claudeMdPath)) return;
10620
10654
  const entries = [];
10621
10655
  for (const dir of readdirSync7(skillsDir).sort()) {
10622
- const skillFile = join22(skillsDir, dir, "SKILL.md");
10656
+ const skillFile = join23(skillsDir, dir, "SKILL.md");
10623
10657
  if (!ex(skillFile)) continue;
10624
10658
  try {
10625
10659
  const { name, description } = parseSkillFrontmatter(rfs(skillFile, "utf-8"));
@@ -10632,14 +10666,16 @@ async function refreshSkillsIndexInClaudeMd(configDir, codeName, log2) {
10632
10666
  }
10633
10667
  }
10634
10668
  const body = entries.length ? entries.map((e) => `- **${e.name}** \u2014 ${e.description}`).join("\n") : "_(no skills installed)_";
10635
- const section = `${SKILLS_INDEX_START}
10636
- ## Available Skills
10669
+ const injectSkillList = hostFlagStore().getBoolean("claude-md-skills-index");
10670
+ const skillList = injectSkillList ? `## Available Skills
10637
10671
 
10638
10672
  The following skills are installed in \`.claude/skills/\`. Claude Code auto-activates them when relevant \u2014 you don't need to read them manually, but you should know they exist.
10639
10673
 
10640
10674
  ${body}
10641
10675
 
10642
- ## Updating Integrations (ENG-4341)
10676
+ ` : "";
10677
+ const section = `${SKILLS_INDEX_START}
10678
+ ${skillList}## Updating Integrations (ENG-4341)
10643
10679
 
10644
10680
  Integration skills under \`.claude/skills/integration-*/SKILL.md\` are **read-only** and managed by the platform. They are derived from the integration's database row plus any per-agent context overrides, and are re-rendered every time the manager polls or a context change is broadcast over Supabase Realtime.
10645
10681
 
@@ -10662,7 +10698,9 @@ ${SKILLS_INDEX_END}`;
10662
10698
  }
10663
10699
  if (next !== current) {
10664
10700
  writeFileSync13(claudeMdPath, next, "utf-8");
10665
- log2(`Refreshed skills index in CLAUDE.md for '${codeName}' (${entries.length} skills)`);
10701
+ log2(
10702
+ injectSkillList ? `Refreshed skills index in CLAUDE.md for '${codeName}' (${entries.length} skills)` : `Refreshed CLAUDE.md managed block for '${codeName}' (skill list suppressed by claude-md-skills-index=false; ${entries.length} skills on disk)`
10703
+ );
10666
10704
  }
10667
10705
  }
10668
10706
  var consecutivePollFailures = 0;
@@ -10682,10 +10720,10 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
10682
10720
  if (codeNames.length === 0) return;
10683
10721
  void (async () => {
10684
10722
  try {
10685
- const { collectDiagnostics } = await import("../persistent-session-AKMSEWFL.js");
10723
+ const { collectDiagnostics } = await import("../persistent-session-ISMSVPQY.js");
10686
10724
  await api.post("/host/heartbeat", {
10687
10725
  host_id: hostId,
10688
- agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor)
10726
+ agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor)
10689
10727
  });
10690
10728
  } catch (err) {
10691
10729
  log(`[restart] post-respawn diagnostics flush failed: ${err.message}`);
@@ -10789,9 +10827,9 @@ async function pollCycle() {
10789
10827
  }
10790
10828
  try {
10791
10829
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
10792
- const { collectDiagnostics } = await import("../persistent-session-AKMSEWFL.js");
10830
+ const { collectDiagnostics } = await import("../persistent-session-ISMSVPQY.js");
10793
10831
  const diagCodeNames = [...agentState.persistentSessionAgents];
10794
- const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor) : void 0;
10832
+ const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor) : void 0;
10795
10833
  let tailscaleHostname;
10796
10834
  try {
10797
10835
  const { execSync: es } = await import("child_process");
@@ -10903,7 +10941,7 @@ async function pollCycle() {
10903
10941
  collectResponsivenessProbes,
10904
10942
  collectPanelessActivityProbes,
10905
10943
  getResponsivenessIntervalMs
10906
- } = await import("../responsiveness-probe-FAIPVVYA.js");
10944
+ } = await import("../responsiveness-probe-S5E3ZHSR.js");
10907
10945
  const probeIntervalMs = getResponsivenessIntervalMs();
10908
10946
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
10909
10947
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -10967,7 +11005,7 @@ async function pollCycle() {
10967
11005
  collectResponsivenessProbes,
10968
11006
  livePendingInboundOldestAgeSeconds,
10969
11007
  parkPendingInbound
10970
- } = await import("../responsiveness-probe-FAIPVVYA.js");
11008
+ } = await import("../responsiveness-probe-S5E3ZHSR.js");
10971
11009
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
10972
11010
  const wedgeNow = /* @__PURE__ */ new Date();
10973
11011
  const liveAgents = agentState.persistentSessionAgents;
@@ -11056,13 +11094,13 @@ async function pollCycle() {
11056
11094
  );
11057
11095
  if (hostFlagStore().getBoolean("wedge-transient-notice")) {
11058
11096
  try {
11059
- const paneTail = readFileSync19(paneLogPath(codeName), "utf8").slice(-65536);
11097
+ const paneTail = readFileSync20(paneLogPath(codeName), "utf8").slice(-65536);
11060
11098
  const transient = detectTransientApiErrorInLog(paneTail);
11061
11099
  if (transient) {
11062
- const wedgeHome = join22(homedir10(), ".augmented", codeName);
11100
+ const wedgeHome = join23(homedir10(), ".augmented", codeName);
11063
11101
  if (existsSync11(wedgeHome)) {
11064
11102
  atomicWriteFileSync(
11065
- join22(wedgeHome, "watchdog-give-up.json"),
11103
+ join23(wedgeHome, "watchdog-give-up.json"),
11066
11104
  JSON.stringify({
11067
11105
  gave_up_at: wedgeNow.toISOString(),
11068
11106
  reason: "transient_overload"
@@ -11333,7 +11371,7 @@ async function pollCycle() {
11333
11371
  const adapter = resolveAgentFramework(prev.codeName);
11334
11372
  stopAgentRuntime2(prev.codeName, "removed-from-host");
11335
11373
  killAgentChannelProcesses(prev.codeName, { log });
11336
- const agentDir = join22(adapter.getAgentDir(prev.codeName), "provision");
11374
+ const agentDir = join23(adapter.getAgentDir(prev.codeName), "provision");
11337
11375
  await cleanupAgentFiles(prev.codeName, agentDir);
11338
11376
  clearAgentCaches(prev.agentId, prev.codeName);
11339
11377
  }
@@ -11420,10 +11458,10 @@ async function pollCycle() {
11420
11458
  // pending-inbound marker. Best-effort: a write failure is logged by
11421
11459
  // the watchdog, never fails the poll cycle.
11422
11460
  signalGiveUp: (codeName) => {
11423
- const dir = join22(homedir10(), ".augmented", codeName);
11461
+ const dir = join23(homedir10(), ".augmented", codeName);
11424
11462
  if (!existsSync11(dir)) return;
11425
11463
  atomicWriteFileSync(
11426
- join22(dir, "watchdog-give-up.json"),
11464
+ join23(dir, "watchdog-give-up.json"),
11427
11465
  JSON.stringify({ gave_up_at: (/* @__PURE__ */ new Date()).toISOString() })
11428
11466
  );
11429
11467
  }
@@ -11562,7 +11600,7 @@ async function processAgent(agent, agentStates) {
11562
11600
  }
11563
11601
  const now = (/* @__PURE__ */ new Date()).toISOString();
11564
11602
  const adapter = resolveAgentFramework(agent.code_name);
11565
- let agentDir = join22(adapter.getAgentDir(agent.code_name), "provision");
11603
+ let agentDir = join23(adapter.getAgentDir(agent.code_name), "provision");
11566
11604
  if (agent.status === "draft" || agent.status === "paused") {
11567
11605
  if (previousKnownStatus !== agent.status) {
11568
11606
  log(`Agent '${agent.code_name}' is ${agent.status}, skipping provisioning`);
@@ -11735,7 +11773,7 @@ async function processAgent(agent, agentStates) {
11735
11773
  const frameworkId = refreshData.agent.framework ?? DEFAULT_FRAMEWORK;
11736
11774
  agentFrameworkCache.set(agent.code_name, frameworkId);
11737
11775
  const frameworkAdapter = getFramework(frameworkId);
11738
- agentDir = join22(frameworkAdapter.getAgentDir(agent.code_name), "provision");
11776
+ agentDir = join23(frameworkAdapter.getAgentDir(agent.code_name), "provision");
11739
11777
  cacheAgentDeliveryMetadata(agent.code_name, refreshData);
11740
11778
  agentRestartTimezoneInputs.set(agent.code_name, {
11741
11779
  agentTimezone: typeof refreshData.agent.timezone === "string" ? refreshData.agent.timezone : null,
@@ -11782,7 +11820,7 @@ async function processAgent(agent, agentStates) {
11782
11820
  const changedFiles = [];
11783
11821
  mkdirSync10(agentDir, { recursive: true });
11784
11822
  for (const artifact of artifacts) {
11785
- const filePath = join22(agentDir, artifact.relativePath);
11823
+ const filePath = join23(agentDir, artifact.relativePath);
11786
11824
  let existingHash;
11787
11825
  let newHash;
11788
11826
  let writeContent = artifact.content;
@@ -11801,8 +11839,8 @@ async function processAgent(agent, agentStates) {
11801
11839
  };
11802
11840
  newHash = sha256(stripDynamicSections(artifact.content));
11803
11841
  try {
11804
- const projectClaudeMd = join22(config.configDir, agent.code_name, "project", "CLAUDE.md");
11805
- const existing = readFileSync19(projectClaudeMd, "utf-8");
11842
+ const projectClaudeMd = join23(config.configDir, agent.code_name, "project", "CLAUDE.md");
11843
+ const existing = readFileSync20(projectClaudeMd, "utf-8");
11806
11844
  existingHash = sha256(stripDynamicSections(existing));
11807
11845
  } catch {
11808
11846
  existingHash = null;
@@ -11820,7 +11858,7 @@ async function processAgent(agent, agentStates) {
11820
11858
  const generatorKeys = Object.keys(generatorServers);
11821
11859
  let existingRaw = "";
11822
11860
  try {
11823
- existingRaw = readFileSync19(filePath, "utf-8");
11861
+ existingRaw = readFileSync20(filePath, "utf-8");
11824
11862
  } catch {
11825
11863
  }
11826
11864
  const existingServers = parseMcp(existingRaw);
@@ -11836,7 +11874,7 @@ async function processAgent(agent, agentStates) {
11836
11874
  } else if (artifact.relativePath === "opencode.json") {
11837
11875
  let existingRaw = null;
11838
11876
  try {
11839
- existingRaw = readFileSync19(filePath, "utf-8");
11877
+ existingRaw = readFileSync20(filePath, "utf-8");
11840
11878
  } catch {
11841
11879
  }
11842
11880
  const mergeResult = mergeOpencodeConfigArtifact(artifact.content, existingRaw);
@@ -11852,12 +11890,12 @@ async function processAgent(agent, agentStates) {
11852
11890
  }
11853
11891
  }
11854
11892
  if (changedFiles.length > 0) {
11855
- const isFirst = !existsSync11(join22(agentDir, "CHARTER.md"));
11893
+ const isFirst = !existsSync11(join23(agentDir, "CHARTER.md"));
11856
11894
  const verb = isFirst ? "Provisioning" : "Updating";
11857
11895
  const fileNames = changedFiles.map((f) => f.relativePath).join(", ");
11858
11896
  log(`${verb} '${agent.code_name}': ${fileNames}`);
11859
11897
  for (const file of changedFiles) {
11860
- const filePath = join22(agentDir, file.relativePath);
11898
+ const filePath = join23(agentDir, file.relativePath);
11861
11899
  mkdirSync10(dirname7(filePath), { recursive: true });
11862
11900
  if (file.relativePath === ".mcp.json") {
11863
11901
  safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
@@ -11866,12 +11904,12 @@ async function processAgent(agent, agentStates) {
11866
11904
  }
11867
11905
  }
11868
11906
  try {
11869
- const provSkillsDir = join22(agentDir, ".claude", "skills");
11907
+ const provSkillsDir = join23(agentDir, ".claude", "skills");
11870
11908
  if (existsSync11(provSkillsDir)) {
11871
11909
  for (const folder of readdirSync6(provSkillsDir)) {
11872
11910
  if (folder.startsWith("knowledge-")) {
11873
11911
  try {
11874
- rmSync5(join22(provSkillsDir, folder), { recursive: true });
11912
+ rmSync5(join23(provSkillsDir, folder), { recursive: true });
11875
11913
  } catch {
11876
11914
  }
11877
11915
  }
@@ -11884,7 +11922,7 @@ async function processAgent(agent, agentStates) {
11884
11922
  const trackedFiles2 = frameworkAdapter.driftTrackedFiles();
11885
11923
  const hashes = /* @__PURE__ */ new Map();
11886
11924
  for (const file of trackedFiles2) {
11887
- const h = hashFile(join22(agentDir, file));
11925
+ const h = hashFile(join23(agentDir, file));
11888
11926
  if (h) hashes.set(file, h);
11889
11927
  }
11890
11928
  agentState.writtenHashes.set(agent.agent_id, hashes);
@@ -11902,14 +11940,14 @@ async function processAgent(agent, agentStates) {
11902
11940
  }
11903
11941
  if (Array.isArray(refreshData.workflows)) {
11904
11942
  try {
11905
- const provWorkflowsDir = join22(agentDir, ".claude", "workflows");
11943
+ const provWorkflowsDir = join23(agentDir, ".claude", "workflows");
11906
11944
  if (existsSync11(provWorkflowsDir)) {
11907
11945
  const expected = new Set(refreshData.workflows.map((w) => `${w.name}.js`));
11908
11946
  for (const file of readdirSync6(provWorkflowsDir)) {
11909
11947
  if (!file.endsWith(".js")) continue;
11910
11948
  if (expected.has(file)) continue;
11911
11949
  try {
11912
- rmSync5(join22(provWorkflowsDir, file));
11950
+ rmSync5(join23(provWorkflowsDir, file));
11913
11951
  } catch {
11914
11952
  }
11915
11953
  }
@@ -11991,7 +12029,7 @@ async function processAgent(agent, agentStates) {
11991
12029
  if (written && existsSync11(agentDir)) {
11992
12030
  const driftedFiles = [];
11993
12031
  for (const [file, expectedHash] of written) {
11994
- const localHash = hashFile(join22(agentDir, file));
12032
+ const localHash = hashFile(join23(agentDir, file));
11995
12033
  if (localHash && localHash !== expectedHash) {
11996
12034
  driftedFiles.push(file);
11997
12035
  }
@@ -12002,7 +12040,7 @@ async function processAgent(agent, agentStates) {
12002
12040
  try {
12003
12041
  const localHashes = {};
12004
12042
  for (const file of driftedFiles) {
12005
- localHashes[file] = hashFile(join22(agentDir, file));
12043
+ localHashes[file] = hashFile(join23(agentDir, file));
12006
12044
  }
12007
12045
  await api.post("/host/drift", {
12008
12046
  agent_id: agent.agent_id,
@@ -12189,7 +12227,7 @@ async function processAgent(agent, agentStates) {
12189
12227
  const addedChannels = [...restartDecision.added];
12190
12228
  const writeDmNoticeMarkers = isChannelAddRestart ? () => {
12191
12229
  try {
12192
- const agentAugmentedDir = join22(homedir10(), ".augmented", agent.code_name);
12230
+ const agentAugmentedDir = join23(homedir10(), ".augmented", agent.code_name);
12193
12231
  mkdirSync10(agentAugmentedDir, { recursive: true });
12194
12232
  const markerJson = JSON.stringify({
12195
12233
  version: 1,
@@ -12197,7 +12235,7 @@ async function processAgent(agent, agentStates) {
12197
12235
  added: addedChannels
12198
12236
  });
12199
12237
  for (const file of ["slack-channel-add-restart.json", "telegram-channel-add-restart.json"]) {
12200
- atomicWriteFileSync(join22(agentAugmentedDir, file), markerJson);
12238
+ atomicWriteFileSync(join23(agentAugmentedDir, file), markerJson);
12201
12239
  }
12202
12240
  } catch (err) {
12203
12241
  log(`[hot-reload] channel-add DM-notice marker write failed for '${agent.code_name}' (non-fatal): ${err.message}`);
@@ -12386,18 +12424,18 @@ async function processAgent(agent, agentStates) {
12386
12424
  if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code") {
12387
12425
  try {
12388
12426
  const agentProvisionDir = agentDir;
12389
- const projectDir = join22(homedir10(), ".augmented", agent.code_name, "project");
12427
+ const projectDir = join23(homedir10(), ".augmented", agent.code_name, "project");
12390
12428
  mkdirSync10(agentProvisionDir, { recursive: true });
12391
12429
  mkdirSync10(projectDir, { recursive: true });
12392
- const provisionMcpPath = join22(agentProvisionDir, ".mcp.json");
12393
- const projectMcpPath = join22(projectDir, ".mcp.json");
12430
+ const provisionMcpPath = join23(agentProvisionDir, ".mcp.json");
12431
+ const projectMcpPath = join23(projectDir, ".mcp.json");
12394
12432
  let mcpConfig = { mcpServers: {} };
12395
12433
  try {
12396
- mcpConfig = JSON.parse(readFileSync19(provisionMcpPath, "utf-8"));
12434
+ mcpConfig = JSON.parse(readFileSync20(provisionMcpPath, "utf-8"));
12397
12435
  if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
12398
12436
  } catch {
12399
12437
  }
12400
- const localDirectChatChannel = join22(homedir10(), ".augmented", "_mcp", "direct-chat-channel.js");
12438
+ const localDirectChatChannel = join23(homedir10(), ".augmented", "_mcp", "direct-chat-channel.js");
12401
12439
  const directChatTeamSettings = refreshData.team?.settings;
12402
12440
  const directChatTz = (() => {
12403
12441
  const tz = directChatTeamSettings?.["timezone"];
@@ -12423,7 +12461,7 @@ async function processAgent(agent, agentStates) {
12423
12461
  // ~/.augmented/<codeName>/.current-turn-initiator.json. Note getAgentDir
12424
12462
  // returns the agent root (NOT the /provision subdir `agentDir` points at),
12425
12463
  // so it byte-matches the broker readers' path.
12426
- AGT_TURN_INITIATOR_FILE: join22(
12464
+ AGT_TURN_INITIATOR_FILE: join23(
12427
12465
  frameworkAdapter.getAgentDir(agent.code_name),
12428
12466
  ".current-turn-initiator.json"
12429
12467
  )
@@ -12443,7 +12481,7 @@ async function processAgent(agent, agentStates) {
12443
12481
  log(`Channel credentials written for '${agent.code_name}/direct-chat'`);
12444
12482
  }
12445
12483
  }
12446
- const staleChannelsPath = join22(projectDir, ".mcp-channels.json");
12484
+ const staleChannelsPath = join23(projectDir, ".mcp-channels.json");
12447
12485
  if (existsSync11(staleChannelsPath)) {
12448
12486
  try {
12449
12487
  rmSync5(staleChannelsPath, { force: true });
@@ -12533,7 +12571,7 @@ async function processAgent(agent, agentStates) {
12533
12571
  }
12534
12572
  if (hostFlagStore().getBoolean("connectivity-probe")) {
12535
12573
  try {
12536
- const probeProjectDir = join22(homedir10(), ".augmented", agent.code_name, "project");
12574
+ const probeProjectDir = join23(homedir10(), ".augmented", agent.code_name, "project");
12537
12575
  let probeSet = integrations;
12538
12576
  try {
12539
12577
  const quarantined = await api.post("/host/agent-integrations/quarantined", { agent_id: agent.agent_id });
@@ -12579,7 +12617,7 @@ async function processAgent(agent, agentStates) {
12579
12617
  const forceDue = attemptsLeft > 0;
12580
12618
  let probeRan = false;
12581
12619
  try {
12582
- const probeProjectDir = join22(homedir10(), ".augmented", agent.code_name, "project");
12620
+ const probeProjectDir = join23(homedir10(), ".augmented", agent.code_name, "project");
12583
12621
  probeRan = await runAgentSessionToolBindProbes(agent, integrations, probeProjectDir, { forceDue });
12584
12622
  } catch (err) {
12585
12623
  log(`Session-tool-bind probe failed for '${agent.code_name}': ${err.message}`);
@@ -12654,11 +12692,11 @@ async function processAgent(agent, agentStates) {
12654
12692
  const intHash = computeIntegrationsHash(integrations);
12655
12693
  const prevIntHash = agentState.knownIntegrationHashes.get(agent.agent_id);
12656
12694
  if (intHash !== prevIntHash) {
12657
- const projectDir = join22(homedir10(), ".augmented", agent.code_name, "project");
12658
- const envIntPath = join22(projectDir, ".env.integrations");
12695
+ const projectDir = join23(homedir10(), ".augmented", agent.code_name, "project");
12696
+ const envIntPath = join23(projectDir, ".env.integrations");
12659
12697
  let preWriteEnv;
12660
12698
  try {
12661
- preWriteEnv = readFileSync19(envIntPath, "utf-8");
12699
+ preWriteEnv = readFileSync20(envIntPath, "utf-8");
12662
12700
  } catch {
12663
12701
  preWriteEnv = void 0;
12664
12702
  }
@@ -12675,9 +12713,9 @@ async function processAgent(agent, agentStates) {
12675
12713
  }
12676
12714
  if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
12677
12715
  try {
12678
- const projectMcpPath = join22(projectDir, ".mcp.json");
12679
- const postWriteEnv = readFileSync19(envIntPath, "utf-8");
12680
- const mcpContent = readFileSync19(projectMcpPath, "utf-8");
12716
+ const projectMcpPath = join23(projectDir, ".mcp.json");
12717
+ const postWriteEnv = readFileSync20(envIntPath, "utf-8");
12718
+ const mcpContent = readFileSync20(projectMcpPath, "utf-8");
12681
12719
  const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
12682
12720
  const mcpJsonForReap = JSON.parse(mcpContent);
12683
12721
  const affectedServerKeys = findMcpServersUsingVars(mcpJsonForReap, changedVars);
@@ -12928,12 +12966,12 @@ async function processAgent(agent, agentStates) {
12928
12966
  const frameworkId2 = frameworkAdapter.id;
12929
12967
  const candidateSkillDirs = [
12930
12968
  // Claude Code — framework runtime tree
12931
- join22(homedir11(), ".augmented", agent.code_name, "skills"),
12969
+ join23(homedir11(), ".augmented", agent.code_name, "skills"),
12932
12970
  // Claude Code — project tree
12933
- join22(homedir11(), ".augmented", agent.code_name, "project", ".claude", "skills"),
12971
+ join23(homedir11(), ".augmented", agent.code_name, "project", ".claude", "skills"),
12934
12972
  // Defensive: legacy provision-side path, not currently an
12935
12973
  // install target but cheap to sweep.
12936
- join22(agentDir, ".claude", "skills")
12974
+ join23(agentDir, ".claude", "skills")
12937
12975
  ];
12938
12976
  const existingDirs = candidateSkillDirs.filter((d) => existsSync11(d));
12939
12977
  const discoveredEntries = /* @__PURE__ */ new Set();
@@ -12949,7 +12987,7 @@ async function processAgent(agent, agentStates) {
12949
12987
  }
12950
12988
  const removeSkillFolder = (entry, reason) => {
12951
12989
  for (const dir of existingDirs) {
12952
- const p = join22(dir, entry);
12990
+ const p = join23(dir, entry);
12953
12991
  if (existsSync11(p)) {
12954
12992
  rmSync6(p, { recursive: true, force: true });
12955
12993
  }
@@ -12969,7 +13007,7 @@ async function processAgent(agent, agentStates) {
12969
13007
  const sharedSkillsPayload = refreshAny.shared_skills;
12970
13008
  const desiredResolved = globalSkillsPayload !== void 0 || sharedSkillsPayload !== void 0;
12971
13009
  const manifestPath = managedSkillManifestPath(
12972
- join22(homedir10(), ".augmented", agent.code_name)
13010
+ join23(homedir10(), ".augmented", agent.code_name)
12973
13011
  );
12974
13012
  const prevIds = /* @__PURE__ */ new Set([
12975
13013
  ...agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
@@ -12989,15 +13027,15 @@ async function processAgent(agent, agentStates) {
12989
13027
  }
12990
13028
  if (plan.removes.length) {
12991
13029
  const globalSkillDirs = [
12992
- join22(homedir10(), ".augmented", agent.code_name, "skills"),
12993
- join22(homedir10(), ".augmented", agent.code_name, "project", ".claude", "skills"),
12994
- join22(agentDir, ".claude", "skills")
13030
+ join23(homedir10(), ".augmented", agent.code_name, "skills"),
13031
+ join23(homedir10(), ".augmented", agent.code_name, "project", ".claude", "skills"),
13032
+ join23(agentDir, ".claude", "skills")
12995
13033
  ];
12996
13034
  for (const id of plan.removes) {
12997
13035
  let prunedAny = false;
12998
13036
  for (const dir of globalSkillDirs) {
12999
- const p = join22(dir, id);
13000
- if (existsSync11(p) && existsSync11(join22(p, "SKILL.md"))) {
13037
+ const p = join23(dir, id);
13038
+ if (existsSync11(p) && existsSync11(join23(p, "SKILL.md"))) {
13001
13039
  rmSync5(p, { recursive: true, force: true });
13002
13040
  prunedAny = true;
13003
13041
  }
@@ -13216,8 +13254,8 @@ async function processAgent(agent, agentStates) {
13216
13254
  const sess = getSessionState(agent.code_name);
13217
13255
  let mcpJsonParsed = null;
13218
13256
  try {
13219
- const mcpPath = join22(getProjectDir(agent.code_name), ".mcp.json");
13220
- mcpJsonParsed = JSON.parse(readFileSync19(mcpPath, "utf-8"));
13257
+ const mcpPath = join23(getProjectDir(agent.code_name), ".mcp.json");
13258
+ mcpJsonParsed = JSON.parse(readFileSync20(mcpPath, "utf-8"));
13221
13259
  } catch {
13222
13260
  }
13223
13261
  reapMissingMcpSessions({
@@ -13582,7 +13620,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
13582
13620
  if (trackedFiles.length > 0 && existsSync11(agentDir)) {
13583
13621
  const hashes = /* @__PURE__ */ new Map();
13584
13622
  for (const file of trackedFiles) {
13585
- const h = hashFile(join22(agentDir, file));
13623
+ const h = hashFile(join23(agentDir, file));
13586
13624
  if (h) hashes.set(file, h);
13587
13625
  }
13588
13626
  agentState.writtenHashes.set(agent.agent_id, hashes);
@@ -13597,7 +13635,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
13597
13635
  refreshData.agent.onboarding_state
13598
13636
  );
13599
13637
  const obStep = obState.step;
13600
- const markerPath = join22(homedir10(), ".augmented", agent.code_name, "onboarding-drive.json");
13638
+ const markerPath = join23(homedir10(), ".augmented", agent.code_name, "onboarding-drive.json");
13601
13639
  const marker = readOnboardingDriveMarker(markerPath);
13602
13640
  const decision = decideOnboardingDrive(obStep, marker, Date.now(), obState.generation ?? 0);
13603
13641
  if (decision.clearMarker) {
@@ -13685,7 +13723,7 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
13685
13723
  }
13686
13724
  stopOpencodeSlackIngest(codeName, log);
13687
13725
  stopOpencodeTelegramIngest(codeName, log);
13688
- const opencodeProjectDir = join22(getFramework("opencode").getAgentDir(codeName), "provision");
13726
+ const opencodeProjectDir = join23(getFramework("opencode").getAgentDir(codeName), "provision");
13689
13727
  const serveEnv = {
13690
13728
  AGT_HOST: requireHost(),
13691
13729
  AGT_API_KEY: getApiKey() ?? void 0,
@@ -13728,8 +13766,8 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
13728
13766
  async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
13729
13767
  const codeName = agent.code_name;
13730
13768
  const projectDir = getProjectDir(codeName);
13731
- const mcpConfigPath = join22(projectDir, ".mcp.json");
13732
- const claudeMdPath = join22(projectDir, "CLAUDE.md");
13769
+ const mcpConfigPath = join23(projectDir, ".mcp.json");
13770
+ const claudeMdPath = join23(projectDir, "CLAUDE.md");
13733
13771
  if (restartBreaker.isTripped(codeName)) {
13734
13772
  const trip = restartBreaker.getTrip(codeName);
13735
13773
  return {
@@ -14278,10 +14316,10 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
14278
14316
  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}`));
14279
14317
  void (async () => {
14280
14318
  try {
14281
- const { collectDiagnostics } = await import("../persistent-session-AKMSEWFL.js");
14319
+ const { collectDiagnostics } = await import("../persistent-session-ISMSVPQY.js");
14282
14320
  await api.post("/host/heartbeat", {
14283
14321
  host_id: hostId,
14284
- agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor)
14322
+ agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor)
14285
14323
  });
14286
14324
  } catch (err) {
14287
14325
  log(`[restart-lane] post-respawn diagnostics flush failed for '${codeName}': ${err.message}`);
@@ -14328,10 +14366,10 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
14328
14366
  }
14329
14367
  try {
14330
14368
  const hostId = await getHostId();
14331
- const { collectDiagnostics } = await import("../persistent-session-AKMSEWFL.js");
14369
+ const { collectDiagnostics } = await import("../persistent-session-ISMSVPQY.js");
14332
14370
  await api.post("/host/heartbeat", {
14333
14371
  host_id: hostId,
14334
- agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor)
14372
+ agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor)
14335
14373
  });
14336
14374
  } catch (err) {
14337
14375
  log(`[fast-mcp-respawn] post-respawn diagnostics flush failed for '${codeName}': ${err.message}`);
@@ -14781,7 +14819,7 @@ async function processClaudePairSessions(agents) {
14781
14819
  killPairSession,
14782
14820
  pairTmuxSession,
14783
14821
  finalizeClaudePairOnboarding
14784
- } = await import("../claude-pair-runtime-OONIISXX.js");
14822
+ } = await import("../claude-pair-runtime-VQSF5CRA.js");
14785
14823
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
14786
14824
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
14787
14825
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -15031,8 +15069,8 @@ function parseMemoryFile(raw, fallbackName) {
15031
15069
  };
15032
15070
  }
15033
15071
  async function syncMemories(agent, configDir, log2) {
15034
- const projectDir = join22(configDir, agent.code_name, "project");
15035
- const memoryDir = join22(projectDir, "memory");
15072
+ const projectDir = join23(configDir, agent.code_name, "project");
15073
+ const memoryDir = join23(projectDir, "memory");
15036
15074
  const isFreshSync = pendingFreshMemorySync.has(agent.agent_id);
15037
15075
  if (isFreshSync) {
15038
15076
  log2(`[memory-sync] Fresh-sync requested for '${agent.code_name}' \u2014 pulling DB first`);
@@ -15050,7 +15088,7 @@ async function syncMemories(agent, configDir, log2) {
15050
15088
  for (const file of readdirSync6(memoryDir)) {
15051
15089
  if (!file.endsWith(".md")) continue;
15052
15090
  try {
15053
- const raw = readFileSync19(join22(memoryDir, file), "utf-8");
15091
+ const raw = readFileSync20(join23(memoryDir, file), "utf-8");
15054
15092
  const fileHash = createHash15("sha256").update(raw).digest("hex").slice(0, 16);
15055
15093
  currentHashes.set(file, fileHash);
15056
15094
  if (prevHashes.get(file) === fileHash) continue;
@@ -15075,7 +15113,7 @@ async function syncMemories(agent, configDir, log2) {
15075
15113
  } catch (err) {
15076
15114
  for (const mem of changedMemories) {
15077
15115
  for (const [file] of currentHashes) {
15078
- const parsed = parseMemoryFile(readFileSync19(join22(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
15116
+ const parsed = parseMemoryFile(readFileSync20(join23(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
15079
15117
  if (parsed?.name === mem.name) currentHashes.delete(file);
15080
15118
  }
15081
15119
  }
@@ -15110,7 +15148,7 @@ async function downloadMemories(agent, memoryDir, log2, { force }) {
15110
15148
  const mem = dbMemories.memories[i];
15111
15149
  const rawSlug = mem.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "").slice(0, 60);
15112
15150
  const slug = rawSlug || `memory-${i}`;
15113
- const filePath = join22(memoryDir, `${slug}.md`);
15151
+ const filePath = join23(memoryDir, `${slug}.md`);
15114
15152
  const desired = `---
15115
15153
  name: ${JSON.stringify(mem.name)}
15116
15154
  type: ${mem.type}
@@ -15122,7 +15160,7 @@ ${mem.content}
15122
15160
  if (existsSync11(filePath)) {
15123
15161
  let existing = "";
15124
15162
  try {
15125
- existing = readFileSync19(filePath, "utf-8");
15163
+ existing = readFileSync20(filePath, "utf-8");
15126
15164
  } catch {
15127
15165
  }
15128
15166
  if (existing === desired) continue;
@@ -15386,7 +15424,7 @@ function startManager(opts) {
15386
15424
  try {
15387
15425
  const stateFile = getStateFile();
15388
15426
  if (existsSync11(stateFile)) {
15389
- const raw = readFileSync19(stateFile, "utf-8");
15427
+ const raw = readFileSync20(stateFile, "utf-8");
15390
15428
  const parsed = JSON.parse(raw);
15391
15429
  if (Array.isArray(parsed.agents)) {
15392
15430
  state6.agents = parsed.agents;
@@ -15413,7 +15451,7 @@ function startManager(opts) {
15413
15451
  log(`[startup] state rehydration failed (continuing with empty state): ${err.message}`);
15414
15452
  }
15415
15453
  log(
15416
- `[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join22(homedir10(), ".augmented", "manager.log")}`
15454
+ `[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join23(homedir10(), ".augmented", "manager.log")}`
15417
15455
  );
15418
15456
  deployMcpAssets();
15419
15457
  reapOrphanChannelMcps({ log });
@@ -15442,7 +15480,7 @@ async function reapOrphanedClaudePids() {
15442
15480
  const looksLikeClaude = (pid) => {
15443
15481
  if (process.platform !== "linux") return true;
15444
15482
  try {
15445
- const comm = readFileSync19(`/proc/${pid}/comm`, "utf-8").trim().toLowerCase();
15483
+ const comm = readFileSync20(`/proc/${pid}/comm`, "utf-8").trim().toLowerCase();
15446
15484
  return comm.includes("claude");
15447
15485
  } catch {
15448
15486
  return false;
@@ -15539,14 +15577,14 @@ function restartRunningChannelMcps(basenames) {
15539
15577
  }
15540
15578
  }
15541
15579
  function deployMcpAssets() {
15542
- const targetDir = join22(homedir10(), ".augmented", "_mcp");
15580
+ const targetDir = join23(homedir10(), ".augmented", "_mcp");
15543
15581
  mkdirSync10(targetDir, { recursive: true });
15544
15582
  const moduleDir = dirname7(fileURLToPath(import.meta.url));
15545
15583
  let mcpSourceDir = "";
15546
15584
  let dir = moduleDir;
15547
15585
  for (let i = 0; i < 6; i++) {
15548
- const candidate = join22(dir, "dist", "mcp");
15549
- if (existsSync11(join22(candidate, "index.js"))) {
15586
+ const candidate = join23(dir, "dist", "mcp");
15587
+ if (existsSync11(join23(candidate, "index.js"))) {
15550
15588
  mcpSourceDir = candidate;
15551
15589
  break;
15552
15590
  }
@@ -15562,7 +15600,7 @@ function deployMcpAssets() {
15562
15600
  const fileHash = (p) => {
15563
15601
  try {
15564
15602
  if (!existsSync11(p)) return null;
15565
- return createHash15("sha256").update(readFileSync19(p)).digest("hex");
15603
+ return createHash15("sha256").update(readFileSync20(p)).digest("hex");
15566
15604
  } catch {
15567
15605
  return null;
15568
15606
  }
@@ -15626,8 +15664,8 @@ function deployMcpAssets() {
15626
15664
  // needs restarting to pick up a token rotation.
15627
15665
  "xero.js"
15628
15666
  ]) {
15629
- const src = join22(mcpSourceDir, file);
15630
- const dst = join22(targetDir, file);
15667
+ const src = join23(mcpSourceDir, file);
15668
+ const dst = join23(targetDir, file);
15631
15669
  if (!existsSync11(src)) continue;
15632
15670
  const before = fileHash(dst);
15633
15671
  try {
@@ -15645,16 +15683,16 @@ function deployMcpAssets() {
15645
15683
  log(`[manager] Bundle(s) updated: ${changedBasenames.join(", ")} \u2014 signalling running instances to restart`);
15646
15684
  restartRunningChannelMcps(changedBasenames);
15647
15685
  }
15648
- const localMcpPath = join22(targetDir, "index.js");
15686
+ const localMcpPath = join23(targetDir, "index.js");
15649
15687
  try {
15650
- const agentsDir = join22(homedir10(), ".augmented", "agents");
15688
+ const agentsDir = join23(homedir10(), ".augmented", "agents");
15651
15689
  if (existsSync11(agentsDir)) {
15652
15690
  for (const entry of readdirSync6(agentsDir, { withFileTypes: true })) {
15653
15691
  if (!entry.isDirectory()) continue;
15654
15692
  for (const subdir of ["provision", "project"]) {
15655
- const mcpJsonPath = join22(agentsDir, entry.name, subdir, ".mcp.json");
15693
+ const mcpJsonPath = join23(agentsDir, entry.name, subdir, ".mcp.json");
15656
15694
  try {
15657
- const raw = readFileSync19(mcpJsonPath, "utf-8");
15695
+ const raw = readFileSync20(mcpJsonPath, "utf-8");
15658
15696
  if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
15659
15697
  const mcpConfig = JSON.parse(raw);
15660
15698
  const augServer = mcpConfig.mcpServers?.["augmented"];
@@ -15713,6 +15751,7 @@ export {
15713
15751
  markAgentForFreshMemorySync,
15714
15752
  maybeInjectKanbanCheck,
15715
15753
  maybeUpgradeClaudeCode,
15754
+ refreshSkillsIndexInClaudeMd,
15716
15755
  reorderRestartedFirst,
15717
15756
  resolveManagedMcpServerId,
15718
15757
  restartReasonBindsNewMcp,