@integrity-labs/agt-cli 0.28.705 → 0.28.707

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.
@@ -54,7 +54,7 @@ import {
54
54
  safeWriteJsonAtomic,
55
55
  setConfigHash,
56
56
  tripClass
57
- } from "../chunk-CPR6JCAB.js";
57
+ } from "../chunk-5U45RQEM.js";
58
58
  import {
59
59
  getProjectDir as getProjectDir2,
60
60
  getReadyTasks,
@@ -112,7 +112,7 @@ import {
112
112
  takeZombieDetection,
113
113
  toOpencodeModel,
114
114
  writeEgressAllowlist
115
- } from "../chunk-ERBFMEWB.js";
115
+ } from "../chunk-326G325O.js";
116
116
  import {
117
117
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
118
118
  AnchorSessionClient,
@@ -197,14 +197,14 @@ import {
197
197
  subagentActivityAgeSeconds,
198
198
  sumTranscriptUsageInWindow,
199
199
  transcriptActivityAgeSeconds
200
- } from "../chunk-VDHPDNC4.js";
200
+ } from "../chunk-QRGNDW6C.js";
201
201
  import {
202
202
  reapOrphanChannelMcps
203
203
  } from "../chunk-XWVM4KPK.js";
204
204
 
205
205
  // src/lib/manager-worker.ts
206
206
  import { createHash as createHash17 } from "crypto";
207
- import { readFileSync as readFileSync29, writeFileSync as writeFileSync14, mkdirSync as mkdirSync11, existsSync as existsSync17, rmSync as rmSync5, readdirSync as readdirSync10, statSync as statSync8, unlinkSync as unlinkSync6, renameSync as renameSync8, utimesSync } from "fs";
207
+ import { readFileSync as readFileSync30, writeFileSync as writeFileSync15, mkdirSync as mkdirSync11, existsSync as existsSync17, rmSync as rmSync5, readdirSync as readdirSync10, statSync as statSync8, unlinkSync as unlinkSync6, renameSync as renameSync8, utimesSync } from "fs";
208
208
 
209
209
  // src/lib/atomic-file-replace.ts
210
210
  import { copyFileSync, renameSync, unlinkSync } from "fs";
@@ -230,7 +230,7 @@ function defaultUnique() {
230
230
 
231
231
  // src/lib/manager-worker.ts
232
232
  import { execFileSync as syncExecFile } from "child_process";
233
- import { join as join38, dirname as dirname10, delimiter as pathDelimiter } from "path";
233
+ import { join as join39, dirname as dirname10, delimiter as pathDelimiter } from "path";
234
234
  import { homedir as homedir18 } from "os";
235
235
  import { fileURLToPath } from "url";
236
236
 
@@ -1241,6 +1241,48 @@ function logClaudeMdCeilingTransition(codeName, report, log2) {
1241
1241
  return line;
1242
1242
  }
1243
1243
 
1244
+ // ../../packages/core/dist/integrations/forwarded-tools-report.js
1245
+ import { readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
1246
+ import { join as join6 } from "path";
1247
+ var FORWARDED_TOOLS_REPORT_FILENAME = "forwarded-tools.json";
1248
+ function forwardedToolsReportPath(agentDir) {
1249
+ return join6(agentDir, FORWARDED_TOOLS_REPORT_FILENAME);
1250
+ }
1251
+ function readForwardedToolsReport(agentDir) {
1252
+ let raw;
1253
+ try {
1254
+ raw = readFileSync6(forwardedToolsReportPath(agentDir), "utf-8");
1255
+ } catch {
1256
+ return null;
1257
+ }
1258
+ let parsed;
1259
+ try {
1260
+ parsed = JSON.parse(raw);
1261
+ } catch {
1262
+ return null;
1263
+ }
1264
+ if (!parsed || typeof parsed !== "object")
1265
+ return null;
1266
+ const r = parsed;
1267
+ const nums = ["expected", "registered", "skipped"];
1268
+ for (const k of nums) {
1269
+ if (typeof r[k] !== "number" || !Number.isFinite(r[k]))
1270
+ return null;
1271
+ }
1272
+ if (!Array.isArray(r["failed"]) || r["failed"].some((n) => typeof n !== "string")) {
1273
+ return null;
1274
+ }
1275
+ if (typeof r["at"] !== "string" || !r["at"])
1276
+ return null;
1277
+ return {
1278
+ expected: r["expected"],
1279
+ registered: r["registered"],
1280
+ skipped: r["skipped"],
1281
+ failed: r["failed"],
1282
+ at: r["at"]
1283
+ };
1284
+ }
1285
+
1244
1286
  // src/lib/mcp-flap-dampener.ts
1245
1287
  var DEFAULT_WINDOW_MS = 6e5;
1246
1288
  var DEFAULT_MIN_TRANSITIONS = 4;
@@ -1797,9 +1839,9 @@ var DependencyRecoveryLedger = class {
1797
1839
  // src/lib/mcp-assets-ready.ts
1798
1840
  import { existsSync as nodeExistsSync, readFileSync as nodeReadFileSync } from "fs";
1799
1841
  import { homedir as homedir3 } from "os";
1800
- import { join as join6, resolve, sep as sep2 } from "path";
1842
+ import { join as join7, resolve, sep as sep2 } from "path";
1801
1843
  function getSharedMcpDir(homeDir = homedir3()) {
1802
- return join6(homeDir, ".augmented", "_mcp");
1844
+ return join7(homeDir, ".augmented", "_mcp");
1803
1845
  }
1804
1846
  function isPathInsideDir(candidate, dir) {
1805
1847
  const resolvedDir = resolve(dir);
@@ -1809,11 +1851,11 @@ function isPathInsideDir(candidate, dir) {
1809
1851
  }
1810
1852
  function findMissingMcpBundles(mcpConfigPath, deps = {}) {
1811
1853
  const existsSync18 = deps.existsSync ?? nodeExistsSync;
1812
- const readFileSync30 = deps.readFileSync ?? nodeReadFileSync;
1854
+ const readFileSync31 = deps.readFileSync ?? nodeReadFileSync;
1813
1855
  const mcpDir = deps.mcpDir ?? getSharedMcpDir();
1814
1856
  let parsed;
1815
1857
  try {
1816
- parsed = JSON.parse(readFileSync30(mcpConfigPath, "utf-8"));
1858
+ parsed = JSON.parse(readFileSync31(mcpConfigPath, "utf-8"));
1817
1859
  } catch {
1818
1860
  return [];
1819
1861
  }
@@ -1851,7 +1893,7 @@ function formatMissingMcpBundles(missing) {
1851
1893
  }
1852
1894
 
1853
1895
  // src/lib/self-update-coalesce.ts
1854
- import { readFileSync as readFileSync6, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
1896
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync4, mkdirSync as mkdirSync3 } from "fs";
1855
1897
  import { dirname as dirname4 } from "path";
1856
1898
  var DEFAULT_SELF_UPDATE_COALESCE_MS = 30 * 60 * 1e3;
1857
1899
  function resolveCoalesceWindowMs(env = process.env) {
@@ -1861,7 +1903,7 @@ function resolveCoalesceWindowMs(env = process.env) {
1861
1903
  if (!Number.isFinite(parsed) || parsed < 0) return DEFAULT_SELF_UPDATE_COALESCE_MS;
1862
1904
  return Math.trunc(parsed);
1863
1905
  }
1864
- function readLastSelfUpdateAppliedMs(markerPath, now = Date.now(), read = (p) => readFileSync6(p, "utf-8")) {
1906
+ function readLastSelfUpdateAppliedMs(markerPath, now = Date.now(), read = (p) => readFileSync7(p, "utf-8")) {
1865
1907
  let raw;
1866
1908
  try {
1867
1909
  raw = read(markerPath);
@@ -1875,7 +1917,7 @@ function readLastSelfUpdateAppliedMs(markerPath, now = Date.now(), read = (p) =>
1875
1917
  }
1876
1918
  function stampLastSelfUpdateApplied(markerPath, now = Date.now(), write = (p, v) => {
1877
1919
  mkdirSync3(dirname4(p), { recursive: true });
1878
- writeFileSync3(p, v);
1920
+ writeFileSync4(p, v);
1879
1921
  }) {
1880
1922
  try {
1881
1923
  write(markerPath, String(now));
@@ -2165,11 +2207,11 @@ async function reportModelApiError(opts) {
2165
2207
  }
2166
2208
 
2167
2209
  // src/lib/claude-pid-tracker.ts
2168
- import { existsSync as existsSync2, readFileSync as readFileSync7 } from "fs";
2210
+ import { existsSync as existsSync2, readFileSync as readFileSync8 } from "fs";
2169
2211
  function readPidFile(path) {
2170
2212
  if (!existsSync2(path)) return { version: 1, spawns: [] };
2171
2213
  try {
2172
- const raw = JSON.parse(readFileSync7(path, "utf-8"));
2214
+ const raw = JSON.parse(readFileSync8(path, "utf-8"));
2173
2215
  if (raw.version !== 1 || !Array.isArray(raw.spawns)) return { version: 1, spawns: [] };
2174
2216
  const spawns = raw.spawns.filter(
2175
2217
  (s) => !!s && typeof s.pid === "number" && Number.isFinite(s.pid) && s.pid > 0
@@ -2219,14 +2261,14 @@ function formatReaperBootLine(opts) {
2219
2261
  }
2220
2262
 
2221
2263
  // src/lib/direct-chat-delivery.ts
2222
- import { join as join7 } from "path";
2264
+ import { join as join8 } from "path";
2223
2265
  var DEFAULT_DIRECT_CHAT_MAX_AGE_MS = 30 * 6e4;
2224
2266
  function directChatMaxAgeMs() {
2225
2267
  const raw = parseInt(process.env["AGT_DIRECT_CHAT_MAX_AGE_MS"] ?? "", 10);
2226
2268
  return Number.isFinite(raw) && raw >= 0 ? raw : DEFAULT_DIRECT_CHAT_MAX_AGE_MS;
2227
2269
  }
2228
2270
  function directChatDoorbellPath(agentId, home) {
2229
- return join7(home, ".augmented", agentId, "direct-chat-doorbell");
2271
+ return join8(home, ".augmented", agentId, "direct-chat-doorbell");
2230
2272
  }
2231
2273
  function isDirectChatMessageExpired(createdAt, nowMs, maxAgeMs) {
2232
2274
  if (!maxAgeMs || maxAgeMs <= 0) return false;
@@ -2238,7 +2280,7 @@ function isDirectChatMessageExpired(createdAt, nowMs, maxAgeMs) {
2238
2280
 
2239
2281
  // src/lib/id-keyed-migration.ts
2240
2282
  import { existsSync as existsSync3, lstatSync, readlinkSync, renameSync as renameSync2 } from "fs";
2241
- import { join as join8 } from "path";
2283
+ import { join as join9 } from "path";
2242
2284
  import { homedir as homedir4 } from "os";
2243
2285
  var ID_KEYED_MIGRATION_FLAG = "id-keyed-layout-migration";
2244
2286
  function agentHasActiveWhatsapp(channelConfigs, codeNameDir) {
@@ -2246,7 +2288,7 @@ function agentHasActiveWhatsapp(channelConfigs, codeNameDir) {
2246
2288
  return true;
2247
2289
  }
2248
2290
  try {
2249
- if (existsSync3(join8(codeNameDir, "whatsapp-pending-inbound"))) return true;
2291
+ if (existsSync3(join9(codeNameDir, "whatsapp-pending-inbound"))) return true;
2250
2292
  } catch {
2251
2293
  }
2252
2294
  return false;
@@ -2278,10 +2320,10 @@ function finishTranscriptMove(oldCwd, newCwd, codeName, log2) {
2278
2320
  function maybeMigrateAgentToIdKeyedLayout(agent, deps) {
2279
2321
  const home = deps.home ?? homedir4();
2280
2322
  const { code_name: codeName, agent_id: agentId } = agent;
2281
- const codeNamePath = join8(home, ".augmented", codeName);
2282
- const idPath = join8(home, ".augmented", agentId);
2283
- const oldCwd = join8(home, ".augmented", codeName, "project");
2284
- const newCwd = join8(idPath, "project");
2323
+ const codeNamePath = join9(home, ".augmented", codeName);
2324
+ const idPath = join9(home, ".augmented", agentId);
2325
+ const oldCwd = join9(home, ".augmented", codeName, "project");
2326
+ const newCwd = join9(idPath, "project");
2285
2327
  let codeNameKind;
2286
2328
  try {
2287
2329
  codeNameKind = lstatSync(codeNamePath).isSymbolicLink() ? "symlink" : "realdir";
@@ -2408,8 +2450,8 @@ function collectEnvGates(env) {
2408
2450
  }
2409
2451
 
2410
2452
  // ../../packages/core/dist/direct-chat/cursor-advance-telemetry.js
2411
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
2412
- import { join as join9 } from "path";
2453
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
2454
+ import { join as join10 } from "path";
2413
2455
  var CURSOR_SHORTFALL_COUNTER_SUFFIX = "-cursor-advance-classifications.json";
2414
2456
  function recordCursorAdvanceOutcome(agentDir, source, route, verdict) {
2415
2457
  if (!agentDir)
@@ -2417,10 +2459,10 @@ function recordCursorAdvanceOutcome(agentDir, source, route, verdict) {
2417
2459
  const key = cursorAdvanceCounterKey(route, verdict);
2418
2460
  if (key === null)
2419
2461
  return;
2420
- const path = join9(agentDir, `${source}${CURSOR_SHORTFALL_COUNTER_SUFFIX}`);
2462
+ const path = join10(agentDir, `${source}${CURSOR_SHORTFALL_COUNTER_SUFFIX}`);
2421
2463
  const counts = {};
2422
2464
  try {
2423
- const parsed = JSON.parse(readFileSync8(path, "utf-8"));
2465
+ const parsed = JSON.parse(readFileSync9(path, "utf-8"));
2424
2466
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
2425
2467
  for (const [k, v] of Object.entries(parsed)) {
2426
2468
  if (typeof v === "number" && Number.isInteger(v) && v >= 0)
@@ -2431,13 +2473,13 @@ function recordCursorAdvanceOutcome(agentDir, source, route, verdict) {
2431
2473
  }
2432
2474
  counts[key] = (counts[key] ?? 0) + 1;
2433
2475
  try {
2434
- writeFileSync4(path, JSON.stringify(counts), { mode: 384 });
2476
+ writeFileSync5(path, JSON.stringify(counts), { mode: 384 });
2435
2477
  } catch {
2436
2478
  }
2437
2479
  }
2438
2480
 
2439
2481
  // src/lib/artifact-stream.ts
2440
- import { join as join10 } from "path";
2482
+ import { join as join11 } from "path";
2441
2483
  import { homedir as homedir5 } from "os";
2442
2484
  import { readdir, stat, readFile } from "fs/promises";
2443
2485
  var ARTEFACT_ENTRY_FILE = "index.html";
@@ -2523,7 +2565,7 @@ var ArtifactStreamScanner = class {
2523
2565
  return;
2524
2566
  }
2525
2567
  for (const name of names) {
2526
- const file = join10(this.artifactsDir, name, ARTEFACT_ENTRY_FILE);
2568
+ const file = join11(this.artifactsDir, name, ARTEFACT_ENTRY_FILE);
2527
2569
  const mtime = await this.fsDeps.mtimeMs(file).catch(() => null);
2528
2570
  if (mtime === null) continue;
2529
2571
  if (this.seenMtime.get(name) === mtime) continue;
@@ -2554,7 +2596,7 @@ var ArtifactStreamScanner = class {
2554
2596
  }
2555
2597
  };
2556
2598
  function artifactsDirFor(codeName) {
2557
- return join10(homedir5(), ".augmented", codeName, "artifacts");
2599
+ return join11(homedir5(), ".augmented", codeName, "artifacts");
2558
2600
  }
2559
2601
  var nodeArtifactFs = {
2560
2602
  async listArtefactNames(artifactsDir) {
@@ -2808,12 +2850,12 @@ async function maybePollHostUsage(deps) {
2808
2850
  import { createHash as createHash6 } from "crypto";
2809
2851
  import { readFile as readFile3, readdir as readdir3 } from "fs/promises";
2810
2852
  import { homedir as homedir7, platform as platform2 } from "os";
2811
- import { dirname as dirname5, join as join12 } from "path";
2853
+ import { dirname as dirname5, join as join13 } from "path";
2812
2854
 
2813
2855
  // src/lib/claude-auth-detect.ts
2814
2856
  import { readFile as readFile2, readdir as readdir2 } from "fs/promises";
2815
2857
  import { homedir as homedir6, platform } from "os";
2816
- import { join as join11 } from "path";
2858
+ import { join as join12 } from "path";
2817
2859
  import { execFile } from "child_process";
2818
2860
  import { promisify } from "util";
2819
2861
  var execFileAsync = promisify(execFile);
@@ -2828,16 +2870,16 @@ async function detectClaudeAuth() {
2828
2870
  }
2829
2871
  async function findClaudeCredentialsPaths() {
2830
2872
  const candidates = [
2831
- join11(homedir6(), ".claude", ".credentials.json"),
2832
- join11(homedir6(), ".claude", "credentials.json")
2873
+ join12(homedir6(), ".claude", ".credentials.json"),
2874
+ join12(homedir6(), ".claude", "credentials.json")
2833
2875
  ];
2834
2876
  const isLinuxRoot = platform() === "linux" && typeof process.getuid === "function" && process.getuid() === 0;
2835
2877
  if (isLinuxRoot) {
2836
2878
  try {
2837
2879
  const entries = await readdir2("/home", { withFileTypes: true });
2838
2880
  for (const entry of entries.filter((entry2) => entry2.isDirectory()).sort((a, b) => a.name.localeCompare(b.name))) {
2839
- candidates.push(join11("/home", entry.name, ".claude", ".credentials.json"));
2840
- candidates.push(join11("/home", entry.name, ".claude", "credentials.json"));
2881
+ candidates.push(join12("/home", entry.name, ".claude", ".credentials.json"));
2882
+ candidates.push(join12("/home", entry.name, ".claude", "credentials.json"));
2841
2883
  }
2842
2884
  } catch {
2843
2885
  }
@@ -2921,7 +2963,7 @@ async function candidateHomes() {
2921
2963
  try {
2922
2964
  const entries = await readdir3("/home", { withFileTypes: true });
2923
2965
  for (const entry of entries.filter((e) => e.isDirectory()).sort((a, b) => a.name.localeCompare(b.name))) {
2924
- homes.push(join12("/home", entry.name));
2966
+ homes.push(join13("/home", entry.name));
2925
2967
  }
2926
2968
  } catch {
2927
2969
  }
@@ -2941,11 +2983,11 @@ async function homeOfActiveCredentials() {
2941
2983
  async function claudeConfigCandidatePaths() {
2942
2984
  const paths = [];
2943
2985
  const configDir = process.env["CLAUDE_CONFIG_DIR"]?.trim();
2944
- if (configDir) paths.push(join12(configDir, ".claude.json"));
2986
+ if (configDir) paths.push(join13(configDir, ".claude.json"));
2945
2987
  const activeHome = await homeOfActiveCredentials();
2946
- if (activeHome) paths.push(join12(activeHome, ".claude.json"));
2988
+ if (activeHome) paths.push(join13(activeHome, ".claude.json"));
2947
2989
  for (const home of await candidateHomes()) {
2948
- const path = join12(home, ".claude.json");
2990
+ const path = join13(home, ".claude.json");
2949
2991
  if (!paths.includes(path)) paths.push(path);
2950
2992
  }
2951
2993
  return paths;
@@ -3042,11 +3084,11 @@ function diffAuthTuples(recorded, current) {
3042
3084
  }
3043
3085
 
3044
3086
  // src/lib/account-enforcement-marker.ts
3045
- import { mkdirSync as mkdirSync4, renameSync as renameSync3, rmSync as rmSync2, writeFileSync as writeFileSync5 } from "fs";
3087
+ import { mkdirSync as mkdirSync4, renameSync as renameSync3, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
3046
3088
  import { homedir as homedir8 } from "os";
3047
- import { join as join13 } from "path";
3089
+ import { join as join14 } from "path";
3048
3090
  function accountEnforcementMarkerPath(codeName) {
3049
- return join13(homedir8(), ".augmented", codeName, ACCOUNT_ENFORCEMENT_MARKER_FILENAME);
3091
+ return join14(homedir8(), ".augmented", codeName, ACCOUNT_ENFORCEMENT_MARKER_FILENAME);
3050
3092
  }
3051
3093
  function syncAccountEnforcementMarker(codeName, level, log2 = (m) => process.stderr.write(`${m}
3052
3094
  `), text) {
@@ -3054,12 +3096,12 @@ function syncAccountEnforcementMarker(codeName, level, log2 = (m) => process.std
3054
3096
  clearAccountEnforcementMarker(codeName, log2);
3055
3097
  return;
3056
3098
  }
3057
- const dir = join13(homedir8(), ".augmented", codeName);
3058
- const path = join13(dir, ACCOUNT_ENFORCEMENT_MARKER_FILENAME);
3099
+ const dir = join14(homedir8(), ".augmented", codeName);
3100
+ const path = join14(dir, ACCOUNT_ENFORCEMENT_MARKER_FILENAME);
3059
3101
  const tempPath = `${path}.${process.pid}.tmp`;
3060
3102
  try {
3061
3103
  mkdirSync4(dir, { recursive: true });
3062
- writeFileSync5(tempPath, serializeAccountEnforcementMarker(level, text), "utf-8");
3104
+ writeFileSync6(tempPath, serializeAccountEnforcementMarker(level, text), "utf-8");
3063
3105
  renameSync3(tempPath, path);
3064
3106
  } catch (err) {
3065
3107
  try {
@@ -3080,8 +3122,8 @@ function clearAccountEnforcementMarker(codeName, log2 = (m) => process.stderr.wr
3080
3122
  }
3081
3123
 
3082
3124
  // src/lib/token-usage-monitor.ts
3083
- import { readdirSync as readdirSync2, readFileSync as readFileSync9, statSync } from "fs";
3084
- import { join as join14 } from "path";
3125
+ import { readdirSync as readdirSync2, readFileSync as readFileSync10, statSync } from "fs";
3126
+ import { join as join15 } from "path";
3085
3127
  var MIN_CHECK_INTERVAL_MS2 = 6e4;
3086
3128
  var TRANSCRIPT_MTIME_WINDOW_MS = 2 * 24 * 60 * 60 * 1e3;
3087
3129
  var MAX_ENTRIES_PER_POST = 200;
@@ -3110,7 +3152,7 @@ async function maybeReportTokenUsage(args) {
3110
3152
  if (!name.endsWith(".jsonl")) continue;
3111
3153
  const sessionId = name.slice(0, -".jsonl".length);
3112
3154
  if (!sessionId) continue;
3113
- const path = join14(dir, name);
3155
+ const path = join15(dir, name);
3114
3156
  let st;
3115
3157
  try {
3116
3158
  st = statSync(path);
@@ -3126,7 +3168,7 @@ async function maybeReportTokenUsage(args) {
3126
3168
  }
3127
3169
  let content;
3128
3170
  try {
3129
- content = readFileSync9(path, "utf-8");
3171
+ content = readFileSync10(path, "utf-8");
3130
3172
  } catch (err) {
3131
3173
  log2(`[token-usage] read failed for '${codeName}/${name}': ${err.message}`);
3132
3174
  continue;
@@ -3207,8 +3249,8 @@ async function maybeReportTokenUsage(args) {
3207
3249
  }
3208
3250
 
3209
3251
  // src/lib/workflow-run-reconciler.ts
3210
- import { readdirSync as readdirSync3, readFileSync as readFileSync10, statSync as statSync2 } from "fs";
3211
- import { join as join15 } from "path";
3252
+ import { readdirSync as readdirSync3, readFileSync as readFileSync11, statSync as statSync2 } from "fs";
3253
+ import { join as join16 } from "path";
3212
3254
  var MIN_CHECK_INTERVAL_MS3 = 5 * 6e4;
3213
3255
  var SETTLE_MS = 3e4;
3214
3256
  var TRANSCRIPT_MTIME_WINDOW_MS2 = 2 * 24 * 60 * 60 * 1e3;
@@ -3227,7 +3269,7 @@ function collectJsonlRecursive(dir, minMtimeMs, out, depth) {
3227
3269
  return;
3228
3270
  }
3229
3271
  for (const name of entries) {
3230
- const p = join15(dir, name);
3272
+ const p = join16(dir, name);
3231
3273
  let st;
3232
3274
  try {
3233
3275
  st = statSync2(p);
@@ -3250,7 +3292,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
3250
3292
  return out;
3251
3293
  }
3252
3294
  for (const name of entries) {
3253
- const path = join15(transcriptDir, name);
3295
+ const path = join16(transcriptDir, name);
3254
3296
  let st;
3255
3297
  try {
3256
3298
  st = statSync2(path);
@@ -3262,7 +3304,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
3262
3304
  continue;
3263
3305
  }
3264
3306
  if (st.isDirectory()) {
3265
- collectJsonlRecursive(join15(path, "subagents"), minMtimeMs, out, 0);
3307
+ collectJsonlRecursive(join16(path, "subagents"), minMtimeMs, out, 0);
3266
3308
  }
3267
3309
  }
3268
3310
  return out;
@@ -3307,7 +3349,7 @@ async function maybeReconcileWorkflowRunTokens(args) {
3307
3349
  const contents = [];
3308
3350
  for (const path of files) {
3309
3351
  try {
3310
- contents.push(readFileSync10(path, "utf-8"));
3352
+ contents.push(readFileSync11(path, "utf-8"));
3311
3353
  } catch {
3312
3354
  }
3313
3355
  }
@@ -3352,8 +3394,8 @@ async function maybeReconcileWorkflowRunTokens(args) {
3352
3394
  }
3353
3395
 
3354
3396
  // src/lib/conversation-evaluator.ts
3355
- import { readdirSync as readdirSync4, readFileSync as readFileSync11, statSync as statSync3 } from "fs";
3356
- import { join as join16 } from "path";
3397
+ import { readdirSync as readdirSync4, readFileSync as readFileSync12, statSync as statSync3 } from "fs";
3398
+ import { join as join17 } from "path";
3357
3399
  var MIN_CHECK_INTERVAL_MS4 = 5 * 6e4;
3358
3400
  var TRANSCRIPT_MTIME_WINDOW_MS3 = 7 * 24 * 60 * 60 * 1e3;
3359
3401
  var WINDOW_PAD_MS = 5 * 6e4;
@@ -3789,7 +3831,7 @@ function readRecentTurns(dir, nowMs) {
3789
3831
  return;
3790
3832
  }
3791
3833
  for (const ent of entries) {
3792
- const full = join16(d, ent.name);
3834
+ const full = join17(d, ent.name);
3793
3835
  if (ent.isDirectory()) {
3794
3836
  visit(full);
3795
3837
  continue;
@@ -3804,7 +3846,7 @@ function readRecentTurns(dir, nowMs) {
3804
3846
  if (nowMs - mtimeMs > TRANSCRIPT_MTIME_WINDOW_MS3) continue;
3805
3847
  let content;
3806
3848
  try {
3807
- content = readFileSync11(full, "utf8");
3849
+ content = readFileSync12(full, "utf8");
3808
3850
  } catch {
3809
3851
  continue;
3810
3852
  }
@@ -4095,22 +4137,22 @@ async function reportSkip2(api2, agentId, conversationId, log2, codeName) {
4095
4137
 
4096
4138
  // src/lib/tool-call-audit.ts
4097
4139
  import { homedir as homedir12 } from "os";
4098
- import { join as join21 } from "path";
4140
+ import { join as join22 } from "path";
4099
4141
 
4100
4142
  // src/lib/agent-logging-mode.ts
4101
- import { readFileSync as readFileSync12 } from "fs";
4143
+ import { readFileSync as readFileSync13 } from "fs";
4102
4144
  import { homedir as homedir9 } from "os";
4103
- import { join as join17 } from "path";
4145
+ import { join as join18 } from "path";
4104
4146
  var LOGGING_MODES = ["hash-only", "redacted", "full-local"];
4105
4147
  function charterPath(codeName, homeDir) {
4106
4148
  const home = homeDir ?? (process.env["HOME"]?.trim() || homedir9());
4107
4149
  const key = agentRuntimeKey(codeName, homeDir);
4108
- return join17(home, ".augmented", key, "provision", "CHARTER.md");
4150
+ return join18(home, ".augmented", key, "provision", "CHARTER.md");
4109
4151
  }
4110
4152
  function readAgentLoggingMode(codeName, homeDir) {
4111
4153
  let raw;
4112
4154
  try {
4113
- raw = readFileSync12(charterPath(codeName, homeDir), "utf-8");
4155
+ raw = readFileSync13(charterPath(codeName, homeDir), "utf-8");
4114
4156
  } catch {
4115
4157
  return { mode: null, reason: "no-charter" };
4116
4158
  }
@@ -4134,15 +4176,15 @@ function loggingModeWithholdsTargets(reading) {
4134
4176
 
4135
4177
  // src/lib/tool-call-path-salt.ts
4136
4178
  import { randomBytes } from "crypto";
4137
- import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync13, renameSync as renameSync4, unlinkSync as unlinkSync2, writeFileSync as writeFileSync6 } from "fs";
4179
+ import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync14, renameSync as renameSync4, unlinkSync as unlinkSync2, writeFileSync as writeFileSync7 } from "fs";
4138
4180
  import { homedir as homedir10 } from "os";
4139
- import { dirname as dirname6, join as join18 } from "path";
4181
+ import { dirname as dirname6, join as join19 } from "path";
4140
4182
  var SALT_BYTES = 32;
4141
4183
  var SALT_RE = /^[0-9a-f]{64}$/;
4142
4184
  function pathSaltPath(codeName, homeDir) {
4143
4185
  const home = homeDir ?? (process.env["HOME"]?.trim() || homedir10());
4144
4186
  const key = agentRuntimeKey(codeName, homeDir);
4145
- return join18(home, ".augmented", key, "tool-call-path-salt");
4187
+ return join19(home, ".augmented", key, "tool-call-path-salt");
4146
4188
  }
4147
4189
  function readToolCallPathSalt(codeName, homeDir) {
4148
4190
  let file;
@@ -4153,7 +4195,7 @@ function readToolCallPathSalt(codeName, homeDir) {
4153
4195
  }
4154
4196
  try {
4155
4197
  if (existsSync4(file)) {
4156
- const existing = readFileSync13(file, "utf-8").trim();
4198
+ const existing = readFileSync14(file, "utf-8").trim();
4157
4199
  if (SALT_RE.test(existing)) return existing;
4158
4200
  }
4159
4201
  } catch {
@@ -4162,7 +4204,7 @@ function readToolCallPathSalt(codeName, homeDir) {
4162
4204
  const tmp = `${file}.tmp.${process.pid}`;
4163
4205
  try {
4164
4206
  mkdirSync5(dirname6(file), { recursive: true, mode: 448 });
4165
- writeFileSync6(tmp, `${salt}
4207
+ writeFileSync7(tmp, `${salt}
4166
4208
  `, { encoding: "utf-8", mode: 384 });
4167
4209
  renameSync4(tmp, file);
4168
4210
  } catch {
@@ -4179,8 +4221,8 @@ function readToolCallPathSalt(codeName, homeDir) {
4179
4221
  import { statSync as statSync4 } from "fs";
4180
4222
 
4181
4223
  // src/lib/tool-call-extractor.ts
4182
- import { closeSync, fstatSync, openSync, readFileSync as readFileSync14, readSync, readdirSync as readdirSync5 } from "fs";
4183
- import { basename as basename2, join as join19, relative as relative2 } from "path";
4224
+ import { closeSync, fstatSync, openSync, readFileSync as readFileSync15, readSync, readdirSync as readdirSync5 } from "fs";
4225
+ import { basename as basename2, join as join20, relative as relative2 } from "path";
4184
4226
  import { StringDecoder } from "string_decoder";
4185
4227
 
4186
4228
  // src/lib/tool-call-redaction.ts
@@ -4309,7 +4351,7 @@ function redactToolTargetInner(toolName, input, ctx) {
4309
4351
  var EXTRACTOR_VERSION = "e1";
4310
4352
  function enumerateSessionTranscripts(transcriptDir, sessionId, projectsRoot) {
4311
4353
  const files = [];
4312
- const mainAbs = join19(transcriptDir, `${sessionId}.jsonl`);
4354
+ const mainAbs = join20(transcriptDir, `${sessionId}.jsonl`);
4313
4355
  files.push({
4314
4356
  absPath: mainAbs,
4315
4357
  relPath: relative2(projectsRoot, mainAbs),
@@ -4317,7 +4359,7 @@ function enumerateSessionTranscripts(transcriptDir, sessionId, projectsRoot) {
4317
4359
  isSubagent: false,
4318
4360
  subagentId: null
4319
4361
  });
4320
- const subDir = join19(transcriptDir, sessionId, "subagents");
4362
+ const subDir = join20(transcriptDir, sessionId, "subagents");
4321
4363
  let entries;
4322
4364
  try {
4323
4365
  entries = readdirSync5(subDir);
@@ -4326,7 +4368,7 @@ function enumerateSessionTranscripts(transcriptDir, sessionId, projectsRoot) {
4326
4368
  }
4327
4369
  for (const name of entries) {
4328
4370
  if (!name.endsWith(".jsonl")) continue;
4329
- const abs = join19(subDir, name);
4371
+ const abs = join20(subDir, name);
4330
4372
  const stem = basename2(name, ".jsonl");
4331
4373
  files.push({
4332
4374
  absPath: abs,
@@ -4524,9 +4566,9 @@ function extractTranscriptWindow(file, opts, from) {
4524
4566
  }
4525
4567
 
4526
4568
  // src/lib/tool-call-cursor.ts
4527
- import { existsSync as existsSync5, readFileSync as readFileSync15 } from "fs";
4569
+ import { existsSync as existsSync5, readFileSync as readFileSync16 } from "fs";
4528
4570
  import { homedir as homedir11 } from "os";
4529
- import { join as join20 } from "path";
4571
+ import { join as join21 } from "path";
4530
4572
  var COVERAGE_DISPOSITIONS = [
4531
4573
  "ok",
4532
4574
  "not_entitled",
@@ -4581,13 +4623,13 @@ function parseCursorKey(key) {
4581
4623
  function cursorStatePath(codeName, homeDir) {
4582
4624
  const home = homeDir ?? (process.env["HOME"]?.trim() || homedir11());
4583
4625
  const key = agentRuntimeKey(codeName, homeDir);
4584
- return join20(home, ".augmented", key, "tool-call-cursors.json");
4626
+ return join21(home, ".augmented", key, "tool-call-cursors.json");
4585
4627
  }
4586
4628
  function loadCursors(path) {
4587
4629
  const out = /* @__PURE__ */ new Map();
4588
4630
  if (!existsSync5(path)) return out;
4589
4631
  try {
4590
- const parsed = JSON.parse(readFileSync15(path, "utf-8"));
4632
+ const parsed = JSON.parse(readFileSync16(path, "utf-8"));
4591
4633
  if (!parsed || parsed.version !== 1 || typeof parsed.files !== "object") return out;
4592
4634
  for (const [k, v] of Object.entries(parsed.files)) {
4593
4635
  if (!v || typeof v !== "object") continue;
@@ -4994,7 +5036,7 @@ async function maybeScanToolCalls(args) {
4994
5036
  log2(`[tool-call-audit] ${codeName}: no path-hash salt available \u2014 file targets withheld`);
4995
5037
  }
4996
5038
  const home = args.homeDir ?? (process.env["HOME"]?.trim() || homedir12());
4997
- const projectsRoot = args.projectsRoot ?? join21(home, ".claude", "projects");
5039
+ const projectsRoot = args.projectsRoot ?? join22(home, ".claude", "projects");
4998
5040
  const transcriptDir = args.transcriptDir ?? sessionTranscriptDir(getProjectDir(codeName));
4999
5041
  const current = peekCurrentSession(codeName);
5000
5042
  const sessionIds = current ? [current.sessionId] : [];
@@ -5023,11 +5065,11 @@ async function maybeScanToolCalls(args) {
5023
5065
  }
5024
5066
 
5025
5067
  // src/lib/activity-cache-monitor.ts
5026
- import { existsSync as existsSync6, readFileSync as readFileSync16 } from "fs";
5068
+ import { existsSync as existsSync6, readFileSync as readFileSync17 } from "fs";
5027
5069
  import { homedir as homedir13 } from "os";
5028
- import { join as join22 } from "path";
5070
+ import { join as join23 } from "path";
5029
5071
  var MIN_CHECK_INTERVAL_MS7 = 6e4;
5030
- var STATS_CACHE_PATH = join22(homedir13(), ".claude", "stats-cache.json");
5072
+ var STATS_CACHE_PATH = join23(homedir13(), ".claude", "stats-cache.json");
5031
5073
  var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
5032
5074
  var state7 = { lastObservedDate: null, lastCheckedAt: 0 };
5033
5075
  function selectNewDailyRows(raw, lastObservedDate) {
@@ -5075,7 +5117,7 @@ async function maybeReportActivityCache(args) {
5075
5117
  }
5076
5118
  let raw;
5077
5119
  try {
5078
- raw = readFileSync16(STATS_CACHE_PATH, "utf-8");
5120
+ raw = readFileSync17(STATS_CACHE_PATH, "utf-8");
5079
5121
  } catch (err) {
5080
5122
  log2(`[activity-cache] readFileSync failed: ${err.message}`);
5081
5123
  return;
@@ -5312,18 +5354,18 @@ function computeChannelConfigHash(input) {
5312
5354
  }
5313
5355
 
5314
5356
  // src/lib/channel-hash-cache.ts
5315
- import { existsSync as existsSync7, readFileSync as readFileSync17, writeFileSync as writeFileSync7 } from "fs";
5316
- import { join as join23 } from "path";
5357
+ import { existsSync as existsSync7, readFileSync as readFileSync18, writeFileSync as writeFileSync8 } from "fs";
5358
+ import { join as join24 } from "path";
5317
5359
  var CACHE_FILENAME = "channel-hash-cache.json";
5318
5360
  function getChannelHashCacheFile(configDir) {
5319
- return join23(configDir, CACHE_FILENAME);
5361
+ return join24(configDir, CACHE_FILENAME);
5320
5362
  }
5321
5363
  function loadChannelHashCache(target, configDir) {
5322
5364
  const path = getChannelHashCacheFile(configDir);
5323
5365
  if (!existsSync7(path)) return;
5324
5366
  let parsed;
5325
5367
  try {
5326
- parsed = JSON.parse(readFileSync17(path, "utf-8"));
5368
+ parsed = JSON.parse(readFileSync18(path, "utf-8"));
5327
5369
  } catch {
5328
5370
  return;
5329
5371
  }
@@ -5337,14 +5379,14 @@ function saveChannelHashCache(source, configDir) {
5337
5379
  const obj = {};
5338
5380
  for (const [key, value] of source) obj[key] = value;
5339
5381
  try {
5340
- writeFileSync7(path, JSON.stringify(obj, null, 2));
5382
+ writeFileSync8(path, JSON.stringify(obj, null, 2));
5341
5383
  } catch {
5342
5384
  }
5343
5385
  }
5344
5386
 
5345
5387
  // src/lib/sender-policy-baseline.ts
5346
- import { existsSync as existsSync8, readFileSync as readFileSync18 } from "fs";
5347
- import { join as join24 } from "path";
5388
+ import { existsSync as existsSync8, readFileSync as readFileSync19 } from "fs";
5389
+ import { join as join25 } from "path";
5348
5390
  var BASELINE_FILENAME = "sender-policy-baseline.json";
5349
5391
  var SENDER_POLICY_BASELINE_VERSION = 1;
5350
5392
  var BASELINE_CONCERNS = ["senderPolicy", "slackBehaviour", "msteamsBehaviour"];
@@ -5356,14 +5398,14 @@ function createDeliveryBaselineMaps() {
5356
5398
  };
5357
5399
  }
5358
5400
  function getSenderPolicyBaselineFile(configDir) {
5359
- return join24(configDir, BASELINE_FILENAME);
5401
+ return join25(configDir, BASELINE_FILENAME);
5360
5402
  }
5361
5403
  function loadSenderPolicyBaseline(target, configDir, log2) {
5362
5404
  const path = getSenderPolicyBaselineFile(configDir);
5363
5405
  if (!existsSync8(path)) return;
5364
5406
  let parsed;
5365
5407
  try {
5366
- parsed = JSON.parse(readFileSync18(path, "utf-8"));
5408
+ parsed = JSON.parse(readFileSync19(path, "utf-8"));
5367
5409
  } catch (err) {
5368
5410
  log2?.(
5369
5411
  `[sender-policy] discarding corrupt ${BASELINE_FILENAME} (${err.message}) - restrictive-policy agents will take one fail-closed restart`
@@ -5412,8 +5454,8 @@ function saveSenderPolicyBaseline(source, configDir, log2) {
5412
5454
  }
5413
5455
 
5414
5456
  // src/lib/stuck-streak-store.ts
5415
- import { existsSync as existsSync9, readFileSync as readFileSync19 } from "fs";
5416
- import { join as join25 } from "path";
5457
+ import { existsSync as existsSync9, readFileSync as readFileSync20 } from "fs";
5458
+ import { join as join26 } from "path";
5417
5459
  var STORE_FILENAME = "stuck-streaks.json";
5418
5460
  var STUCK_STREAK_STORE_VERSION = 1;
5419
5461
  var STUCK_STREAK_CONCERNS = ["channelSync", "realtimeRebind"];
@@ -5421,7 +5463,7 @@ function createStuckStreakMaps() {
5421
5463
  return { channelSync: /* @__PURE__ */ new Map(), realtimeRebind: /* @__PURE__ */ new Map() };
5422
5464
  }
5423
5465
  function getStuckStreakStoreFile(configDir) {
5424
- return join25(configDir, STORE_FILENAME);
5466
+ return join26(configDir, STORE_FILENAME);
5425
5467
  }
5426
5468
  function isValidPersistedStreak(value) {
5427
5469
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;
@@ -5463,7 +5505,7 @@ function loadStuckStreaks(target, configDir, log2) {
5463
5505
  if (!existsSync9(path)) return;
5464
5506
  let parsed;
5465
5507
  try {
5466
- parsed = JSON.parse(readFileSync19(path, "utf-8"));
5508
+ parsed = JSON.parse(readFileSync20(path, "utf-8"));
5467
5509
  } catch (err) {
5468
5510
  log2?.(
5469
5511
  `[stuck-streaks] discarding corrupt ${STORE_FILENAME} (${err.message}) \u2014 stuck-streak ages restart from zero and one spurious "recovered" close may follow`
@@ -5980,7 +6022,7 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash, options)
5980
6022
  }
5981
6023
 
5982
6024
  // src/lib/manager/integration-skill-cache.ts
5983
- import { join as join26 } from "path";
6025
+ import { join as join27 } from "path";
5984
6026
  function integrationSkillHashKey(agentId, skillId) {
5985
6027
  return `plugin-skill:${agentId}:${skillId}`;
5986
6028
  }
@@ -5996,21 +6038,21 @@ function forgetIntegrationSkill(cache3, agentId, skillId) {
5996
6038
  function removeIntegrationSkillFolder(opts) {
5997
6039
  forgetIntegrationSkill(opts.cache, opts.agentId, opts.entry);
5998
6040
  for (const dir of opts.dirs) {
5999
- opts.removeDir(join26(dir, opts.entry));
6041
+ opts.removeDir(join27(dir, opts.entry));
6000
6042
  }
6001
6043
  }
6002
6044
 
6003
6045
  // src/lib/manager/managed-skill-manifest.ts
6004
- import { existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync20, writeFileSync as writeFileSync8 } from "fs";
6005
- import { dirname as dirname7, join as join27 } from "path";
6046
+ import { existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
6047
+ import { dirname as dirname7, join as join28 } from "path";
6006
6048
  var MANIFEST_VERSION = 1;
6007
6049
  function managedSkillManifestPath(agentRootDir) {
6008
- return join27(agentRootDir, "managed-skills.json");
6050
+ return join28(agentRootDir, "managed-skills.json");
6009
6051
  }
6010
6052
  function readManagedSkillManifest(path) {
6011
6053
  try {
6012
6054
  if (!existsSync10(path)) return /* @__PURE__ */ new Set();
6013
- const parsed = JSON.parse(readFileSync20(path, "utf-8"));
6055
+ const parsed = JSON.parse(readFileSync21(path, "utf-8"));
6014
6056
  const ids = Array.isArray(parsed?.globalSkillIds) ? parsed.globalSkillIds : [];
6015
6057
  return new Set(ids.filter((id) => typeof id === "string" && id.length > 0));
6016
6058
  } catch {
@@ -6024,7 +6066,7 @@ function writeManagedSkillManifest(path, ids) {
6024
6066
  version: MANIFEST_VERSION,
6025
6067
  globalSkillIds: [...ids].sort()
6026
6068
  };
6027
- writeFileSync8(path, JSON.stringify(body, null, 2));
6069
+ writeFileSync9(path, JSON.stringify(body, null, 2));
6028
6070
  } catch {
6029
6071
  }
6030
6072
  }
@@ -6137,7 +6179,7 @@ function resolveModelChain(refreshData) {
6137
6179
 
6138
6180
  // src/lib/manager/claude-auth.ts
6139
6181
  import { existsSync as existsSync11, rmSync as rmSync3 } from "fs";
6140
- import { join as join28 } from "path";
6182
+ import { join as join29 } from "path";
6141
6183
  import { homedir as homedir14 } from "os";
6142
6184
  async function applyClaudeAuthToEnv(childEnv, label) {
6143
6185
  const apiKey = getApiKey();
@@ -6150,9 +6192,9 @@ async function applyClaudeAuthToEnv(childEnv, label) {
6150
6192
  throw new Error("claude_auth_mode=api_key but /host/exchange returned no decrypted key");
6151
6193
  }
6152
6194
  childEnv.ANTHROPIC_API_KEY = exchange.anthropicApiKey;
6153
- const claudeDir = join28(homedir14(), ".claude");
6195
+ const claudeDir = join29(homedir14(), ".claude");
6154
6196
  for (const filename of [".credentials.json", "credentials.json"]) {
6155
- const p = join28(claudeDir, filename);
6197
+ const p = join29(claudeDir, filename);
6156
6198
  if (existsSync11(p)) {
6157
6199
  try {
6158
6200
  rmSync3(p, { force: true });
@@ -6234,8 +6276,8 @@ function heartbeatRuntimeAuthFields(probeVerdict) {
6234
6276
  }
6235
6277
 
6236
6278
  // src/lib/manager/kanban/parsers.ts
6237
- import { existsSync as existsSync12, readFileSync as readFileSync21 } from "fs";
6238
- import { join as join29 } from "path";
6279
+ import { existsSync as existsSync12, readFileSync as readFileSync22 } from "fs";
6280
+ import { join as join30 } from "path";
6239
6281
  var STANDUP_TEMPLATES = /* @__PURE__ */ new Set(["daily-standup", "end-of-day-summary"]);
6240
6282
  var TASK_UPDATE_TEMPLATES = /* @__PURE__ */ new Set(["hourly-status", "task-update"]);
6241
6283
  var PLAN_TEMPLATES = /* @__PURE__ */ new Set(["morning-plan"]);
@@ -6387,12 +6429,12 @@ function getBuiltInSkillContent(skillId) {
6387
6429
  if (builtInSkillCache.has(skillId)) return builtInSkillCache.get(skillId);
6388
6430
  try {
6389
6431
  const candidates = [
6390
- join29(process.cwd(), "skills", skillId, "SKILL.md"),
6391
- join29(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
6432
+ join30(process.cwd(), "skills", skillId, "SKILL.md"),
6433
+ join30(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
6392
6434
  ];
6393
6435
  for (const candidate of candidates) {
6394
6436
  if (existsSync12(candidate)) {
6395
- const content = readFileSync21(candidate, "utf-8");
6437
+ const content = readFileSync22(candidate, "utf-8");
6396
6438
  const files = [{ relativePath: "SKILL.md", content }];
6397
6439
  builtInSkillCache.set(skillId, files);
6398
6440
  return files;
@@ -6533,19 +6575,19 @@ function formatBoardForPrompt(items, template) {
6533
6575
  }
6534
6576
 
6535
6577
  // src/lib/manager/kanban/nudge-state-cache.ts
6536
- import { existsSync as existsSync13, readFileSync as readFileSync22, writeFileSync as writeFileSync9 } from "fs";
6537
- import { join as join30 } from "path";
6578
+ import { existsSync as existsSync13, readFileSync as readFileSync23, writeFileSync as writeFileSync10 } from "fs";
6579
+ import { join as join31 } from "path";
6538
6580
  var CACHE_FILENAME2 = "kanban-nudge-state.json";
6539
6581
  var KANBAN_NUDGE_STATE_VERSION = 1;
6540
6582
  function getKanbanNudgeStateFile(configDir) {
6541
- return join30(configDir, CACHE_FILENAME2);
6583
+ return join31(configDir, CACHE_FILENAME2);
6542
6584
  }
6543
6585
  function loadKanbanNudgeState(target, configDir) {
6544
6586
  const path = getKanbanNudgeStateFile(configDir);
6545
6587
  if (!existsSync13(path)) return;
6546
6588
  let parsed;
6547
6589
  try {
6548
- parsed = JSON.parse(readFileSync22(path, "utf-8"));
6590
+ parsed = JSON.parse(readFileSync23(path, "utf-8"));
6549
6591
  } catch {
6550
6592
  return;
6551
6593
  }
@@ -6577,7 +6619,7 @@ function saveKanbanNudgeState(source, configDir) {
6577
6619
  const agents = {};
6578
6620
  for (const [codeName, state9] of source) agents[codeName] = state9;
6579
6621
  try {
6580
- writeFileSync9(path, JSON.stringify({ version: KANBAN_NUDGE_STATE_VERSION, agents }, null, 2));
6622
+ writeFileSync10(path, JSON.stringify({ version: KANBAN_NUDGE_STATE_VERSION, agents }, null, 2));
6581
6623
  } catch {
6582
6624
  }
6583
6625
  }
@@ -7163,9 +7205,9 @@ function closeSessionRunForCode(codeName, outcome, reason) {
7163
7205
 
7164
7206
  // src/lib/manager/scheduler/kanban-route.ts
7165
7207
  import { createHash as createHash12 } from "crypto";
7166
- import { writeFileSync as writeFileSync10, renameSync as renameSync5, mkdirSync as mkdirSync7, readFileSync as readFileSync23, unlinkSync as unlinkSync3 } from "fs";
7208
+ import { writeFileSync as writeFileSync11, renameSync as renameSync5, mkdirSync as mkdirSync7, readFileSync as readFileSync24, unlinkSync as unlinkSync3 } from "fs";
7167
7209
  import { homedir as homedir15 } from "os";
7168
- import { join as join31, dirname as dirname8 } from "path";
7210
+ import { join as join32, dirname as dirname8 } from "path";
7169
7211
 
7170
7212
  // src/lib/manager/scheduler/notify.ts
7171
7213
  import { createHash as createHash11 } from "crypto";
@@ -7524,19 +7566,19 @@ function resolveScheduledSlackTarget(task) {
7524
7566
  }
7525
7567
  function stampScheduledTurnMarker(codeName, taskId, target) {
7526
7568
  try {
7527
- const file = join31(homedir15(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
7569
+ const file = join32(homedir15(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
7528
7570
  const marker = { ts: Date.now(), task_id: taskId, ...target ? { target } : {} };
7529
7571
  const tmp = `${file}.tmp`;
7530
- writeFileSync10(tmp, JSON.stringify(marker), "utf8");
7572
+ writeFileSync11(tmp, JSON.stringify(marker), "utf8");
7531
7573
  renameSync5(tmp, file);
7532
7574
  } catch (err) {
7533
7575
  log(`[scheduled-kanban] scheduled-turn marker write failed for '${codeName}': ${err.message}`);
7534
7576
  }
7535
7577
  }
7536
7578
  function clearScheduledTurnMarkerForTask(codeName, taskId) {
7537
- const file = join31(homedir15(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
7579
+ const file = join32(homedir15(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
7538
7580
  try {
7539
- const raw = JSON.parse(readFileSync23(file, "utf8"));
7581
+ const raw = JSON.parse(readFileSync24(file, "utf8"));
7540
7582
  if (typeof raw?.task_id !== "string" || raw.task_id !== taskId) return;
7541
7583
  unlinkSync3(file);
7542
7584
  log(`[scheduled-kanban] scheduled-turn marker cleared for '${codeName}' (task ${taskId} complete)`);
@@ -7598,7 +7640,7 @@ async function routeScheduledTaskViaKanban(codeName, agentId, task, prompt, dura
7598
7640
  try {
7599
7641
  const doorbell = directChatDoorbellPath(agentId, homedir15());
7600
7642
  mkdirSync7(dirname8(doorbell), { recursive: true });
7601
- writeFileSync10(doorbell, String(Date.now()));
7643
+ writeFileSync11(doorbell, String(Date.now()));
7602
7644
  } catch (err) {
7603
7645
  log(`[scheduled-kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
7604
7646
  }
@@ -7749,11 +7791,11 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
7749
7791
  // src/lib/manager/scheduler/execution.ts
7750
7792
  import { createHash as createHash13 } from "crypto";
7751
7793
  import { homedir as homedir16 } from "os";
7752
- import { join as join33 } from "path";
7794
+ import { join as join34 } from "path";
7753
7795
 
7754
7796
  // src/lib/agent-serving-probe.ts
7755
- import { readFileSync as readFileSync24, readdirSync as readdirSync6, statSync as statSync5 } from "fs";
7756
- import { join as join32 } from "path";
7797
+ import { readFileSync as readFileSync25, readdirSync as readdirSync6, statSync as statSync5 } from "fs";
7798
+ import { join as join33 } from "path";
7757
7799
  var RATE_LIMIT_WINDOW_MS = 6 * 60 * 60 * 1e3;
7758
7800
  function probeRateLimit(args) {
7759
7801
  const now = args.now ?? /* @__PURE__ */ new Date();
@@ -7769,7 +7811,7 @@ function probeRateLimit(args) {
7769
7811
  let newest = UNKNOWN_RATE_LIMIT;
7770
7812
  for (const name of entries) {
7771
7813
  if (!name.endsWith(".jsonl")) continue;
7772
- const path = join32(dir, name);
7814
+ const path = join33(dir, name);
7773
7815
  try {
7774
7816
  const st = statSync5(path);
7775
7817
  if (!st.isFile() || st.mtimeMs < startMs) continue;
@@ -7778,7 +7820,7 @@ function probeRateLimit(args) {
7778
7820
  }
7779
7821
  let content;
7780
7822
  try {
7781
- content = readFileSync24(path, "utf-8");
7823
+ content = readFileSync25(path, "utf-8");
7782
7824
  } catch {
7783
7825
  continue;
7784
7826
  }
@@ -7840,7 +7882,7 @@ function shouldLogUsageCapDeferral(site, codeName, limitedUntil) {
7840
7882
 
7841
7883
  // src/lib/manager/scheduler/execution.ts
7842
7884
  function claudePidFilePath() {
7843
- return join33(homedir16(), ".augmented", "manager-claude-pids.json");
7885
+ return join34(homedir16(), ".augmented", "manager-claude-pids.json");
7844
7886
  }
7845
7887
  var inFlightClaudePids = /* @__PURE__ */ new Map();
7846
7888
  function registerClaudeSpawn(record) {
@@ -7911,7 +7953,7 @@ async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData
7911
7953
 
7912
7954
  // src/lib/occupancy-gate.ts
7913
7955
  import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync7, readSync as readSync2, statSync as statSync6 } from "fs";
7914
- import { join as join34 } from "path";
7956
+ import { join as join35 } from "path";
7915
7957
  function rostersMeasuredZero(mode, attested, runtimeRunning) {
7916
7958
  return mode === "enforce" && attested && runtimeRunning;
7917
7959
  }
@@ -8002,10 +8044,10 @@ function candidateTranscriptPaths(dir) {
8002
8044
  let complete = true;
8003
8045
  for (const name of top) {
8004
8046
  if (name.endsWith(".jsonl")) {
8005
- paths.push(join34(dir, name));
8047
+ paths.push(join35(dir, name));
8006
8048
  continue;
8007
8049
  }
8008
- const subDir = join34(dir, name, "subagents");
8050
+ const subDir = join35(dir, name, "subagents");
8009
8051
  let subs;
8010
8052
  try {
8011
8053
  subs = readdirSync7(subDir);
@@ -8014,7 +8056,7 @@ function candidateTranscriptPaths(dir) {
8014
8056
  continue;
8015
8057
  }
8016
8058
  for (const sub of subs) {
8017
- if (sub.endsWith(".jsonl")) paths.push(join34(subDir, sub));
8059
+ if (sub.endsWith(".jsonl")) paths.push(join35(subDir, sub));
8018
8060
  }
8019
8061
  }
8020
8062
  return { paths, complete };
@@ -8241,7 +8283,7 @@ function stopPaneOccupancySampler() {
8241
8283
 
8242
8284
  // src/lib/pid-pressure-sampler.ts
8243
8285
  import { execFileSync as execFileSync2 } from "child_process";
8244
- import { existsSync as existsSync14, readFileSync as readFileSync25 } from "fs";
8286
+ import { existsSync as existsSync14, readFileSync as readFileSync26 } from "fs";
8245
8287
  var SAMPLE_INTERVAL_MS2 = 3e4;
8246
8288
  function warnFraction() {
8247
8289
  const raw = Number(process.env.AGT_PID_PRESSURE_WARN_FRACTION);
@@ -8254,7 +8296,7 @@ function configuredCeiling() {
8254
8296
  }
8255
8297
  function readTextReal(path) {
8256
8298
  try {
8257
- return readFileSync25(path, "utf-8");
8299
+ return readFileSync26(path, "utf-8");
8258
8300
  } catch {
8259
8301
  return null;
8260
8302
  }
@@ -9562,9 +9604,9 @@ async function fireOpencodeScheduledTask(agent, task) {
9562
9604
 
9563
9605
  // src/lib/opencode-telegram-ingest.ts
9564
9606
  import { createHash as createHash16 } from "crypto";
9565
- import { existsSync as existsSync15, mkdirSync as mkdirSync8, readFileSync as readFileSync26, renameSync as renameSync6, unlinkSync as unlinkSync4, writeFileSync as writeFileSync11 } from "fs";
9607
+ import { existsSync as existsSync15, mkdirSync as mkdirSync8, readFileSync as readFileSync27, renameSync as renameSync6, unlinkSync as unlinkSync4, writeFileSync as writeFileSync12 } from "fs";
9566
9608
  import { randomUUID } from "crypto";
9567
- import { join as join35 } from "path";
9609
+ import { join as join36 } from "path";
9568
9610
 
9569
9611
  // src/lib/telegram-ingest.ts
9570
9612
  import https2 from "https";
@@ -10112,7 +10154,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
10112
10154
  let filePath;
10113
10155
  try {
10114
10156
  dir = getFramework("opencode").getAgentDir(codeName);
10115
- filePath = join35(dir, "telegram-getupdates-offset-opencode.json");
10157
+ filePath = join36(dir, "telegram-getupdates-offset-opencode.json");
10116
10158
  } catch {
10117
10159
  dir = null;
10118
10160
  filePath = null;
@@ -10121,7 +10163,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
10121
10163
  load() {
10122
10164
  if (!filePath) return 0;
10123
10165
  try {
10124
- const parsed = JSON.parse(readFileSync26(filePath, "utf-8"));
10166
+ const parsed = JSON.parse(readFileSync27(filePath, "utf-8"));
10125
10167
  if (currentBotId != null && typeof parsed?.bot_id === "number" && parsed.bot_id !== currentBotId) {
10126
10168
  log2(`[telegram-ingest:${codeName}] offset cursor belongs to a different bot; ignoring (bot swap)`);
10127
10169
  return 0;
@@ -10140,7 +10182,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
10140
10182
  const tmpPath = `${filePath}.${process.pid}.${randomUUID()}.tmp`;
10141
10183
  try {
10142
10184
  mkdirSync8(dir, { recursive: true, mode: 448 });
10143
- writeFileSync11(
10185
+ writeFileSync12(
10144
10186
  tmpPath,
10145
10187
  JSON.stringify({
10146
10188
  offset,
@@ -10391,15 +10433,15 @@ function partitionActionableByPoison(actionable, states, config2) {
10391
10433
  }
10392
10434
 
10393
10435
  // src/lib/restart-flags.ts
10394
- import { existsSync as existsSync16, mkdirSync as mkdirSync9, readdirSync as readdirSync8, readFileSync as readFileSync27, renameSync as renameSync7, rmSync as rmSync4, writeFileSync as writeFileSync12 } from "fs";
10436
+ import { existsSync as existsSync16, mkdirSync as mkdirSync9, readdirSync as readdirSync8, readFileSync as readFileSync28, renameSync as renameSync7, rmSync as rmSync4, writeFileSync as writeFileSync13 } from "fs";
10395
10437
  import { homedir as homedir17 } from "os";
10396
- import { join as join36 } from "path";
10438
+ import { join as join37 } from "path";
10397
10439
  import { randomUUID as randomUUID2 } from "crypto";
10398
10440
  function restartFlagsDir() {
10399
- return join36(homedir17(), ".augmented", "restart-flags");
10441
+ return join37(homedir17(), ".augmented", "restart-flags");
10400
10442
  }
10401
10443
  function flagPath(codeName) {
10402
- return join36(restartFlagsDir(), `${codeName}.flag`);
10444
+ return join37(restartFlagsDir(), `${codeName}.flag`);
10403
10445
  }
10404
10446
  function readRestartFlags() {
10405
10447
  const dir = restartFlagsDir();
@@ -10408,7 +10450,7 @@ function readRestartFlags() {
10408
10450
  for (const entry of readdirSync8(dir)) {
10409
10451
  if (!entry.endsWith(".flag")) continue;
10410
10452
  try {
10411
- const raw = readFileSync27(join36(dir, entry), "utf8");
10453
+ const raw = readFileSync28(join37(dir, entry), "utf8");
10412
10454
  const parsed = JSON.parse(raw);
10413
10455
  if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
10414
10456
  parsed.codeName = entry.replace(/\.flag$/, "");
@@ -10526,8 +10568,8 @@ async function sendError(flag, opts, text) {
10526
10568
  }
10527
10569
 
10528
10570
  // src/lib/restart-context.ts
10529
- import { readdirSync as readdirSync9, readFileSync as readFileSync28, writeFileSync as writeFileSync13, mkdirSync as mkdirSync10, unlinkSync as unlinkSync5 } from "fs";
10530
- import { dirname as dirname9, join as join37 } from "path";
10571
+ import { readdirSync as readdirSync9, readFileSync as readFileSync29, writeFileSync as writeFileSync14, mkdirSync as mkdirSync10, unlinkSync as unlinkSync5 } from "fs";
10572
+ import { dirname as dirname9, join as join38 } from "path";
10531
10573
  var SLACK_PENDING_INBOUND_DIRNAME = "slack-pending-inbound";
10532
10574
  var SLACK_RESTART_CONTEXT_DIRNAME = "slack-restart-context";
10533
10575
  var MAX_TOPIC_CHARS = 140;
@@ -10539,10 +10581,10 @@ function augmentedAgentDir(codeName) {
10539
10581
  return dirname9(getProjectDir(codeName));
10540
10582
  }
10541
10583
  function slackPendingInboundDir(codeName) {
10542
- return join37(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
10584
+ return join38(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
10543
10585
  }
10544
10586
  function slackRestartContextDir(codeName) {
10545
- return join37(augmentedAgentDir(codeName), SLACK_RESTART_CONTEXT_DIRNAME);
10587
+ return join38(augmentedAgentDir(codeName), SLACK_RESTART_CONTEXT_DIRNAME);
10546
10588
  }
10547
10589
  function sanitizeTopic(raw) {
10548
10590
  const cleaned = raw.replace(/\s+/g, " ").trim().replace(/[<>]/g, " ").replace(/\s+/g, " ").trim();
@@ -10584,7 +10626,7 @@ function safeReaddir(dir) {
10584
10626
  }
10585
10627
  function readStrandedMarker(path) {
10586
10628
  try {
10587
- const parsed = JSON.parse(readFileSync28(path, "utf-8"));
10629
+ const parsed = JSON.parse(readFileSync29(path, "utf-8"));
10588
10630
  if (typeof parsed.channel === "string" && typeof parsed.thread_ts === "string") {
10589
10631
  return { channel: parsed.channel, thread_ts: parsed.thread_ts };
10590
10632
  }
@@ -10594,7 +10636,7 @@ function readStrandedMarker(path) {
10594
10636
  }
10595
10637
  function writeHintFile(path, dir, hint) {
10596
10638
  mkdirSync10(dir, { recursive: true, mode: 448 });
10597
- writeFileSync13(path, JSON.stringify(hint), { mode: 384 });
10639
+ writeFileSync14(path, JSON.stringify(hint), { mode: 384 });
10598
10640
  }
10599
10641
  function pruneHintsExcept(codeName, freshFilenames) {
10600
10642
  const ctxDir = slackRestartContextDir(codeName);
@@ -10602,7 +10644,7 @@ function pruneHintsExcept(codeName, freshFilenames) {
10602
10644
  if (!filename.endsWith(".json")) continue;
10603
10645
  if (freshFilenames.has(filename)) continue;
10604
10646
  try {
10605
- unlinkSync5(join37(ctxDir, filename));
10647
+ unlinkSync5(join38(ctxDir, filename));
10606
10648
  } catch {
10607
10649
  }
10608
10650
  }
@@ -10623,7 +10665,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
10623
10665
  }
10624
10666
  const markers = [];
10625
10667
  for (const filename of markerFilenames.slice(0, cap)) {
10626
- const parsed = readStrandedMarker(join37(markerDir, filename));
10668
+ const parsed = readStrandedMarker(join38(markerDir, filename));
10627
10669
  if (parsed) markers.push({ filename, channel: parsed.channel, thread_ts: parsed.thread_ts });
10628
10670
  }
10629
10671
  if (markers.length === 0) {
@@ -10637,7 +10679,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
10637
10679
  const freshFilenames = /* @__PURE__ */ new Set();
10638
10680
  for (const { filename, hint } of hints) {
10639
10681
  try {
10640
- writeHintFile(join37(ctxDir, filename), ctxDir, hint);
10682
+ writeHintFile(join38(ctxDir, filename), ctxDir, hint);
10641
10683
  freshFilenames.add(filename);
10642
10684
  } catch (err) {
10643
10685
  log2(`[restart-context] ${codeName}: hint write failed for ${filename}: ${err.message}`);
@@ -12015,7 +12057,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
12015
12057
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
12016
12058
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
12017
12059
  async function channelInboundActivityAgeSecondsFor(codeName) {
12018
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-Y7HORWZE.js");
12060
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-3HITHSYU.js");
12019
12061
  const newest = newestPendingInboundActivityMtimeMs(dirname10(paneLogPath(codeName)));
12020
12062
  if (newest === null) return null;
12021
12063
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -12265,7 +12307,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
12265
12307
  var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
12266
12308
  function projectMcpHash(_codeName, projectDir) {
12267
12309
  try {
12268
- const raw = readFileSync29(join38(projectDir, ".mcp.json"), "utf-8");
12310
+ const raw = readFileSync30(join39(projectDir, ".mcp.json"), "utf-8");
12269
12311
  return createHash17("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
12270
12312
  } catch {
12271
12313
  return null;
@@ -12273,7 +12315,7 @@ function projectMcpHash(_codeName, projectDir) {
12273
12315
  }
12274
12316
  function projectMcpKeys(_codeName, projectDir) {
12275
12317
  try {
12276
- const raw = readFileSync29(join38(projectDir, ".mcp.json"), "utf-8");
12318
+ const raw = readFileSync30(join39(projectDir, ".mcp.json"), "utf-8");
12277
12319
  const parsed = JSON.parse(raw);
12278
12320
  const servers = parsed.mcpServers;
12279
12321
  if (!servers || typeof servers !== "object") return /* @__PURE__ */ new Set();
@@ -12291,7 +12333,7 @@ function seedSessionLaunchBaselines(codeName, projectDir) {
12291
12333
  else runningMcpServerKeys.delete(codeName);
12292
12334
  let launchStructure = null;
12293
12335
  try {
12294
- const raw = readFileSync29(join38(projectDir, ".mcp.json"), "utf-8");
12336
+ const raw = readFileSync30(join39(projectDir, ".mcp.json"), "utf-8");
12295
12337
  launchStructure = managedMcpStructureHashFromFile(
12296
12338
  JSON.parse(raw),
12297
12339
  isManagedMcpServerKey
@@ -12417,7 +12459,7 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
12417
12459
  if (result && result.rebindCandidates.length > 0 && hostFlagStore().getBoolean("session-tool-rebind")) {
12418
12460
  let mcpJsonForRebind = null;
12419
12461
  try {
12420
- mcpJsonForRebind = JSON.parse(readFileSync29(join38(projectDir, ".mcp.json"), "utf-8"));
12462
+ mcpJsonForRebind = JSON.parse(readFileSync30(join39(projectDir, ".mcp.json"), "utf-8"));
12421
12463
  } catch {
12422
12464
  mcpJsonForRebind = null;
12423
12465
  }
@@ -12565,7 +12607,7 @@ function shouldInjectChannelSecrets(agentId) {
12565
12607
  function projectChannelSecretHash(projectDir) {
12566
12608
  try {
12567
12609
  const entries = parseEnvIntegrations(
12568
- readFileSync29(join38(projectDir, ".env.integrations"), "utf-8")
12610
+ readFileSync30(join39(projectDir, ".env.integrations"), "utf-8")
12569
12611
  );
12570
12612
  return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
12571
12613
  } catch {
@@ -12663,7 +12705,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
12663
12705
  var lastVersionCheckAt = 0;
12664
12706
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12665
12707
  var lastResponsivenessProbeAt = 0;
12666
- var agtCliVersion = true ? "0.28.705" : "dev";
12708
+ var agtCliVersion = true ? "0.28.707" : "dev";
12667
12709
  function resolveBrewPath(execFileSync3) {
12668
12710
  try {
12669
12711
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -12997,7 +13039,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
12997
13039
  try {
12998
13040
  let settings = {};
12999
13041
  if (existsSync17(path)) {
13000
- const raw = readFileSync29(path, "utf-8").trim();
13042
+ const raw = readFileSync30(path, "utf-8").trim();
13001
13043
  if (raw) {
13002
13044
  let parsed;
13003
13045
  try {
@@ -13015,7 +13057,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
13015
13057
  if (missing.length === 0) return "ok";
13016
13058
  for (const key of missing) settings[key] = true;
13017
13059
  mkdirSync11(dirname10(path), { recursive: true });
13018
- writeFileSync14(path, `${JSON.stringify(settings, null, 2)}
13060
+ writeFileSync15(path, `${JSON.stringify(settings, null, 2)}
13019
13061
  `);
13020
13062
  log(`[managed-settings] set ${missing.map((k) => `${k}:true`).join(", ")} in ${path} (ENG-5786 unblocks Claude Code channels; ENG-9223 pre-approves project MCP servers so a headless session never freezes on the trust prompt)`);
13021
13063
  return "ok";
@@ -13053,7 +13095,7 @@ async function ensureOpencodeBinary() {
13053
13095
  try {
13054
13096
  const prefix = execFileSync3("npm", ["prefix", "-g"], { encoding: "utf-8", timeout: 1e4 }).trim();
13055
13097
  if (prefix) {
13056
- const npmBin = join38(prefix, "bin");
13098
+ const npmBin = join39(prefix, "bin");
13057
13099
  const current = (process.env.PATH ?? "").split(pathDelimiter);
13058
13100
  if (!current.includes(npmBin)) {
13059
13101
  process.env.PATH = [npmBin, ...current.filter(Boolean)].join(pathDelimiter);
@@ -13170,7 +13212,7 @@ ${r.stderr}`;
13170
13212
  }
13171
13213
  var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
13172
13214
  function selfUpdateAppliedMarkerPath() {
13173
- return join38(homedir18(), ".augmented", ".last-self-update-applied");
13215
+ return join39(homedir18(), ".augmented", ".last-self-update-applied");
13174
13216
  }
13175
13217
  var selfUpdateUpToDateLogged = false;
13176
13218
  var selfUpdatePinnedLogged = false;
@@ -13221,7 +13263,7 @@ async function checkAndUpdateCli(opts) {
13221
13263
  const isNpmGlobal = !isBrewFormula && resolvedPath.includes("node_modules");
13222
13264
  if (!isBrewFormula && !isNpmGlobal) return "noop";
13223
13265
  const { readFileSync: readF, writeFileSync: writeF } = await import("fs");
13224
- const markerPath = join38(homedir18(), ".augmented", ".last-update-check");
13266
+ const markerPath = join39(homedir18(), ".augmented", ".last-update-check");
13225
13267
  if (!force) {
13226
13268
  try {
13227
13269
  const lastCheck = parseInt(readF(markerPath, "utf-8").trim(), 10);
@@ -13715,13 +13757,13 @@ async function checkClaudeAuth() {
13715
13757
  var evalEmptyMcpConfigPath = null;
13716
13758
  function ensureEvalEmptyMcpConfig() {
13717
13759
  if (evalEmptyMcpConfigPath && existsSync17(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
13718
- const dir = join38(homedir18(), ".augmented");
13760
+ const dir = join39(homedir18(), ".augmented");
13719
13761
  try {
13720
13762
  mkdirSync11(dir, { recursive: true });
13721
13763
  } catch {
13722
13764
  }
13723
- const p = join38(dir, ".eval-empty-mcp.json");
13724
- writeFileSync14(p, JSON.stringify({ mcpServers: {} }));
13765
+ const p = join39(dir, ".eval-empty-mcp.json");
13766
+ writeFileSync15(p, JSON.stringify({ mcpServers: {} }));
13725
13767
  evalEmptyMcpConfigPath = p;
13726
13768
  return p;
13727
13769
  }
@@ -13815,10 +13857,10 @@ function resolveConversationEvalBackend() {
13815
13857
  return conversationEvalBackend;
13816
13858
  }
13817
13859
  function getStateFile() {
13818
- return join38(config?.configDir ?? join38(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
13860
+ return join39(config?.configDir ?? join39(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
13819
13861
  }
13820
13862
  function channelHashCacheDir() {
13821
- return config?.configDir ?? join38(process.env["HOME"] ?? "/tmp", ".augmented");
13863
+ return config?.configDir ?? join39(process.env["HOME"] ?? "/tmp", ".augmented");
13822
13864
  }
13823
13865
  function loadChannelHashCache2() {
13824
13866
  loadChannelHashCache(agentState.knownChannelConfigHashes, channelHashCacheDir());
@@ -13830,6 +13872,7 @@ var channelWriteFailureCounts = /* @__PURE__ */ new Map();
13830
13872
  var CHANNEL_WRITE_FAILURE_ESCALATE_EVERY = 90;
13831
13873
  var channelSyncFailures = /* @__PURE__ */ new Map();
13832
13874
  var channelSyncAttemptedSets = /* @__PURE__ */ new Map();
13875
+ var channelCredentialVerdicts = /* @__PURE__ */ new Map();
13833
13876
  function sameChannelSet(a, b) {
13834
13877
  if (a === void 0) return false;
13835
13878
  if (a.size !== b.size) return false;
@@ -13839,6 +13882,7 @@ function sameChannelSet(a, b) {
13839
13882
  function forgetChannelSyncState(agentId) {
13840
13883
  channelSyncFailures.delete(agentId);
13841
13884
  channelSyncAttemptedSets.delete(agentId);
13885
+ channelCredentialVerdicts.delete(agentId);
13842
13886
  }
13843
13887
  var CHANNEL_SYNC_FREE_ATTEMPTS = 3;
13844
13888
  var CHANNEL_SYNC_MAX_BACKOFF_MS = 5 * 6e4;
@@ -13882,6 +13926,26 @@ function stuckChannelSyncs(failures, now, thresholdMs = CHANNEL_SYNC_STUCK_AFTER
13882
13926
  out.sort((a, b) => b.stuck_for_seconds - a.stuck_for_seconds);
13883
13927
  return out;
13884
13928
  }
13929
+ function verifiedChannelCredentials(verdicts) {
13930
+ const out = [];
13931
+ for (const [agentId, channels] of verdicts) {
13932
+ for (const [channelId, verdict] of channels) {
13933
+ out.push({
13934
+ agent_id: agentId,
13935
+ channel_id: channelId,
13936
+ verified: verdict.verified,
13937
+ // Omitted rather than sent as null when converged: a reason only means
13938
+ // anything alongside a failure, and a stale one travelling with
13939
+ // `verified: true` reads as a warning about a healthy channel.
13940
+ ...verdict.verified || !verdict.reason ? {} : { reason: verdict.reason }
13941
+ });
13942
+ }
13943
+ }
13944
+ out.sort(
13945
+ (a, b) => a.agent_id === b.agent_id ? a.channel_id.localeCompare(b.channel_id) : a.agent_id.localeCompare(b.agent_id)
13946
+ );
13947
+ return out;
13948
+ }
13885
13949
  var persistedDeliveryBaseline = createDeliveryBaselineMaps();
13886
13950
  function loadSenderPolicyBaseline2() {
13887
13951
  loadSenderPolicyBaseline(persistedDeliveryBaseline, channelHashCacheDir(), log);
@@ -14001,7 +14065,7 @@ function removeDeliveryBaselineEntries(agentId) {
14001
14065
  var _channelQuarantineStore = null;
14002
14066
  function channelQuarantineStore() {
14003
14067
  if (!_channelQuarantineStore) {
14004
- const dir = config?.configDir ?? join38(process.env["HOME"] ?? "/tmp", ".augmented");
14068
+ const dir = config?.configDir ?? join39(process.env["HOME"] ?? "/tmp", ".augmented");
14005
14069
  _channelQuarantineStore = new ChannelQuarantineStore(defaultQuarantinePath(dir));
14006
14070
  }
14007
14071
  return _channelQuarantineStore;
@@ -14015,10 +14079,14 @@ function claudeMdSizeFor(codeName) {
14015
14079
  logClaudeMdCeilingTransition(codeName, report, log);
14016
14080
  return report;
14017
14081
  }
14082
+ function forwardedToolsFor(codeName) {
14083
+ if (!config?.configDir) return null;
14084
+ return readForwardedToolsReport(join39(config.configDir, codeName));
14085
+ }
14018
14086
  var _hostFlagStore = null;
14019
14087
  function hostFlagStore() {
14020
14088
  if (!_hostFlagStore) {
14021
- const dir = config?.configDir ?? join38(process.env["HOME"] ?? "/tmp", ".augmented");
14089
+ const dir = config?.configDir ?? join39(process.env["HOME"] ?? "/tmp", ".augmented");
14022
14090
  _hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
14023
14091
  }
14024
14092
  return _hostFlagStore;
@@ -14091,13 +14159,13 @@ function parseSkillFrontmatter(content) {
14091
14159
  return out;
14092
14160
  }
14093
14161
  async function refreshSkillsIndexInClaudeMd(configDir, codeName, log2) {
14094
- const { readdirSync: readdirSync11, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync15 } = await import("fs");
14095
- const skillsDir = join38(configDir, codeName, "project", ".claude", "skills");
14096
- const claudeMdPath = join38(configDir, codeName, "project", "CLAUDE.md");
14162
+ const { readdirSync: readdirSync11, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync16 } = await import("fs");
14163
+ const skillsDir = join39(configDir, codeName, "project", ".claude", "skills");
14164
+ const claudeMdPath = join39(configDir, codeName, "project", "CLAUDE.md");
14097
14165
  if (!ex(skillsDir) || !ex(claudeMdPath)) return;
14098
14166
  const entries = [];
14099
14167
  for (const dir of readdirSync11(skillsDir).sort()) {
14100
- const skillFile = join38(skillsDir, dir, "SKILL.md");
14168
+ const skillFile = join39(skillsDir, dir, "SKILL.md");
14101
14169
  if (!ex(skillFile)) continue;
14102
14170
  try {
14103
14171
  const { name, description } = parseSkillFrontmatter(rfs(skillFile, "utf-8"));
@@ -14141,7 +14209,7 @@ ${SKILLS_INDEX_END}`;
14141
14209
  next = current.trimEnd() + "\n\n" + section + "\n";
14142
14210
  }
14143
14211
  if (next !== current) {
14144
- writeFileSync15(claudeMdPath, next, "utf-8");
14212
+ writeFileSync16(claudeMdPath, next, "utf-8");
14145
14213
  log2(
14146
14214
  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)`
14147
14215
  );
@@ -14164,10 +14232,10 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
14164
14232
  if (codeNames.length === 0) return;
14165
14233
  void (async () => {
14166
14234
  try {
14167
- const { collectDiagnostics } = await import("../persistent-session-UQBJRLLZ.js");
14235
+ const { collectDiagnostics } = await import("../persistent-session-TPP35O6H.js");
14168
14236
  await api.post("/host/heartbeat", {
14169
14237
  host_id: hostId,
14170
- agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
14238
+ agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
14171
14239
  });
14172
14240
  } catch (err) {
14173
14241
  log(`[restart] post-respawn diagnostics flush failed: ${err.message}`);
@@ -14282,9 +14350,9 @@ async function pollCycleInner() {
14282
14350
  }
14283
14351
  try {
14284
14352
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
14285
- const { collectDiagnostics } = await import("../persistent-session-UQBJRLLZ.js");
14353
+ const { collectDiagnostics } = await import("../persistent-session-TPP35O6H.js");
14286
14354
  const diagCodeNames = [...agentState.persistentSessionAgents];
14287
- const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor) : void 0;
14355
+ const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor) : void 0;
14288
14356
  let tailscaleHostname;
14289
14357
  try {
14290
14358
  const { execSync: es } = await import("child_process");
@@ -14369,6 +14437,23 @@ async function pollCycleInner() {
14369
14437
  // close a resolved alert on the edge. Omitting it when empty would make
14370
14438
  // "recovered" and "this CLI is too old to report" the same wire value.
14371
14439
  channel_sync_stuck: stuckChannelSyncs(channelSyncFailures, Date.now()),
14440
+ // ENG-9517: the POSITIVE direction of the field above — the current
14441
+ // per-channel on-disk credential verdict. Without it the control plane
14442
+ // could only ever learn that a channel was broken, and only after ten
14443
+ // minutes; it had no way to learn that one was working, so "installed"
14444
+ // and "never reached the host" were the same row.
14445
+ //
14446
+ // SAME absent-vs-empty contract as its neighbours, and it matters more
14447
+ // here because this field drives a UI completion state: an older CLI
14448
+ // omits it and the consumer must change nothing, while `[]` is an
14449
+ // affirmative "this manager checked and has no channels to report".
14450
+ // Collapsing the two would let a stale CLI read as an all-clear.
14451
+ //
14452
+ // Note this is NOT the complement of `channel_sync_stuck`. A channel
14453
+ // can be absent from both — not yet attempted, deferred by the backoff,
14454
+ // or on an adapter that cannot probe — and that third state has to stay
14455
+ // distinguishable from success.
14456
+ channel_credential_status: verifiedChannelCredentials(channelCredentialVerdicts),
14372
14457
  // ENG-9265: agents whose realtime token-rotation subscription has been
14373
14458
  // failing to bind for longer than the stuck threshold. Same contract as
14374
14459
  // the field above — ALWAYS sent, including as an empty array, because
@@ -14434,7 +14519,7 @@ async function pollCycleInner() {
14434
14519
  collectPanelessActivityProbes,
14435
14520
  getResponsivenessIntervalMs,
14436
14521
  occupancyQualificationClassifications
14437
- } = await import("../responsiveness-probe-Y7HORWZE.js");
14522
+ } = await import("../responsiveness-probe-3HITHSYU.js");
14438
14523
  const probeIntervalMs = getResponsivenessIntervalMs();
14439
14524
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
14440
14525
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -14544,7 +14629,7 @@ async function pollCycleInner() {
14544
14629
  collectResponsivenessProbes,
14545
14630
  livePendingInboundOldestAgeSeconds,
14546
14631
  parkPendingInbound
14547
- } = await import("../responsiveness-probe-Y7HORWZE.js");
14632
+ } = await import("../responsiveness-probe-3HITHSYU.js");
14548
14633
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
14549
14634
  const wedgeNow = /* @__PURE__ */ new Date();
14550
14635
  const liveAgents = agentState.persistentSessionAgents;
@@ -14633,13 +14718,13 @@ async function pollCycleInner() {
14633
14718
  );
14634
14719
  if (hostFlagStore().getBoolean("wedge-transient-notice")) {
14635
14720
  try {
14636
- const paneTail = readFileSync29(paneLogPath(codeName), "utf8").slice(-65536);
14721
+ const paneTail = readFileSync30(paneLogPath(codeName), "utf8").slice(-65536);
14637
14722
  const transient = detectTransientApiErrorInLog(paneTail);
14638
14723
  if (transient) {
14639
- const wedgeHome = join38(homedir18(), ".augmented", codeName);
14724
+ const wedgeHome = join39(homedir18(), ".augmented", codeName);
14640
14725
  if (existsSync17(wedgeHome)) {
14641
14726
  atomicWriteFileSync(
14642
- join38(wedgeHome, "watchdog-give-up.json"),
14727
+ join39(wedgeHome, "watchdog-give-up.json"),
14643
14728
  JSON.stringify({
14644
14729
  gave_up_at: wedgeNow.toISOString(),
14645
14730
  reason: "transient_overload"
@@ -14700,7 +14785,7 @@ async function pollCycleInner() {
14700
14785
  }
14701
14786
  try {
14702
14787
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-JA437JIB.js");
14703
- const { probeSessionAuth } = await import("../session-auth-dead-DE4KM7PS.js");
14788
+ const { probeSessionAuth } = await import("../session-auth-dead-LY5264IN.js");
14704
14789
  const observations = [];
14705
14790
  const pendingCacheCommits = [];
14706
14791
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -14955,7 +15040,7 @@ async function pollCycleInner() {
14955
15040
  `[drain-flush] FAILED for '${prev.codeName}': ${err.message} \u2014 proceeding to teardown; this session was NOT shipped (ENG-9491)`
14956
15041
  );
14957
15042
  }
14958
- const agentDir = join38(adapter.getAgentDir(prev.codeName), "provision");
15043
+ const agentDir = join39(adapter.getAgentDir(prev.codeName), "provision");
14959
15044
  await cleanupAgentFiles(prev.codeName, agentDir);
14960
15045
  clearAgentCaches(prev.agentId, prev.codeName);
14961
15046
  }
@@ -15042,10 +15127,10 @@ async function pollCycleInner() {
15042
15127
  // pending-inbound marker. Best-effort: a write failure is logged by
15043
15128
  // the watchdog, never fails the poll cycle.
15044
15129
  signalGiveUp: (codeName) => {
15045
- const dir = join38(homedir18(), ".augmented", codeName);
15130
+ const dir = join39(homedir18(), ".augmented", codeName);
15046
15131
  if (!existsSync17(dir)) return;
15047
15132
  atomicWriteFileSync(
15048
- join38(dir, "watchdog-give-up.json"),
15133
+ join39(dir, "watchdog-give-up.json"),
15049
15134
  JSON.stringify({ gave_up_at: (/* @__PURE__ */ new Date()).toISOString() })
15050
15135
  );
15051
15136
  },
@@ -15066,7 +15151,7 @@ async function pollCycleInner() {
15066
15151
  const dir = getFramework("claude-code").getAgentDir(codeName);
15067
15152
  if (!existsSync17(dir)) return;
15068
15153
  atomicWriteFileSync(
15069
- join38(dir, "watchdog-give-up.json"),
15154
+ join39(dir, "watchdog-give-up.json"),
15070
15155
  JSON.stringify({
15071
15156
  gave_up_at: (/* @__PURE__ */ new Date()).toISOString(),
15072
15157
  reason: "usage_limit",
@@ -15328,7 +15413,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
15328
15413
  }
15329
15414
  const now = (/* @__PURE__ */ new Date()).toISOString();
15330
15415
  const adapter = resolveAgentFramework(agent.code_name);
15331
- let agentDir = join38(adapter.getAgentDir(agent.code_name), "provision");
15416
+ let agentDir = join39(adapter.getAgentDir(agent.code_name), "provision");
15332
15417
  if (agent.status === "draft" || agent.status === "paused") {
15333
15418
  forgetChannelSyncState(agent.agent_id);
15334
15419
  if (previousKnownStatus !== agent.status) {
@@ -15503,7 +15588,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
15503
15588
  const frameworkId = refreshData.agent.framework ?? DEFAULT_FRAMEWORK;
15504
15589
  agentFrameworkCache.set(agent.code_name, frameworkId);
15505
15590
  const frameworkAdapter = getFramework(frameworkId);
15506
- agentDir = join38(frameworkAdapter.getAgentDir(agent.code_name), "provision");
15591
+ agentDir = join39(frameworkAdapter.getAgentDir(agent.code_name), "provision");
15507
15592
  cacheAgentDeliveryMetadata(agent.code_name, refreshData);
15508
15593
  agentRestartTimezoneInputs.set(agent.code_name, {
15509
15594
  agentTimezone: typeof refreshData.agent.timezone === "string" ? refreshData.agent.timezone : null,
@@ -15561,7 +15646,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
15561
15646
  const changedFiles = [];
15562
15647
  mkdirSync11(agentDir, { recursive: true });
15563
15648
  for (const artifact of artifacts) {
15564
- const filePath = join38(agentDir, artifact.relativePath);
15649
+ const filePath = join39(agentDir, artifact.relativePath);
15565
15650
  let existingHash;
15566
15651
  let newHash;
15567
15652
  let writeContent = artifact.content;
@@ -15580,8 +15665,8 @@ async function processAgent(agent, agentStates, managedToolkits) {
15580
15665
  };
15581
15666
  newHash = sha256(stripDynamicSections(artifact.content));
15582
15667
  try {
15583
- const projectClaudeMd = join38(config.configDir, agent.code_name, "project", "CLAUDE.md");
15584
- const existing = readFileSync29(projectClaudeMd, "utf-8");
15668
+ const projectClaudeMd = join39(config.configDir, agent.code_name, "project", "CLAUDE.md");
15669
+ const existing = readFileSync30(projectClaudeMd, "utf-8");
15585
15670
  existingHash = sha256(stripDynamicSections(existing));
15586
15671
  } catch {
15587
15672
  existingHash = null;
@@ -15599,7 +15684,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
15599
15684
  const generatorKeys = Object.keys(generatorServers);
15600
15685
  let existingRaw = "";
15601
15686
  try {
15602
- existingRaw = readFileSync29(filePath, "utf-8");
15687
+ existingRaw = readFileSync30(filePath, "utf-8");
15603
15688
  } catch {
15604
15689
  }
15605
15690
  const existingServers = parseMcp(existingRaw);
@@ -15615,7 +15700,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
15615
15700
  } else if (artifact.relativePath === "opencode.json") {
15616
15701
  let existingRaw = null;
15617
15702
  try {
15618
- existingRaw = readFileSync29(filePath, "utf-8");
15703
+ existingRaw = readFileSync30(filePath, "utf-8");
15619
15704
  } catch {
15620
15705
  }
15621
15706
  const mergeResult = mergeOpencodeConfigArtifact(artifact.content, existingRaw);
@@ -15631,26 +15716,26 @@ async function processAgent(agent, agentStates, managedToolkits) {
15631
15716
  }
15632
15717
  }
15633
15718
  if (changedFiles.length > 0) {
15634
- const isFirst = !existsSync17(join38(agentDir, "CHARTER.md"));
15719
+ const isFirst = !existsSync17(join39(agentDir, "CHARTER.md"));
15635
15720
  const verb = isFirst ? "Provisioning" : "Updating";
15636
15721
  const fileNames = changedFiles.map((f) => f.relativePath).join(", ");
15637
15722
  log(`${verb} '${agent.code_name}': ${fileNames}`);
15638
15723
  for (const file of changedFiles) {
15639
- const filePath = join38(agentDir, file.relativePath);
15724
+ const filePath = join39(agentDir, file.relativePath);
15640
15725
  mkdirSync11(dirname10(filePath), { recursive: true });
15641
15726
  if (file.relativePath === ".mcp.json") {
15642
15727
  safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
15643
15728
  } else {
15644
- writeFileSync14(filePath, file.content);
15729
+ writeFileSync15(filePath, file.content);
15645
15730
  }
15646
15731
  }
15647
15732
  try {
15648
- const provSkillsDir = join38(agentDir, ".claude", "skills");
15733
+ const provSkillsDir = join39(agentDir, ".claude", "skills");
15649
15734
  if (existsSync17(provSkillsDir)) {
15650
15735
  for (const folder of readdirSync10(provSkillsDir)) {
15651
15736
  if (folder.startsWith("knowledge-")) {
15652
15737
  try {
15653
- rmSync5(join38(provSkillsDir, folder), { recursive: true });
15738
+ rmSync5(join39(provSkillsDir, folder), { recursive: true });
15654
15739
  } catch {
15655
15740
  }
15656
15741
  }
@@ -15663,7 +15748,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
15663
15748
  const trackedFiles2 = frameworkAdapter.driftTrackedFiles();
15664
15749
  const hashes = /* @__PURE__ */ new Map();
15665
15750
  for (const file of trackedFiles2) {
15666
- const h = hashFile(join38(agentDir, file));
15751
+ const h = hashFile(join39(agentDir, file));
15667
15752
  if (h) hashes.set(file, h);
15668
15753
  }
15669
15754
  agentState.writtenHashes.set(agent.agent_id, hashes);
@@ -15681,14 +15766,14 @@ async function processAgent(agent, agentStates, managedToolkits) {
15681
15766
  }
15682
15767
  if (Array.isArray(refreshData.workflows)) {
15683
15768
  try {
15684
- const provWorkflowsDir = join38(agentDir, ".claude", "workflows");
15769
+ const provWorkflowsDir = join39(agentDir, ".claude", "workflows");
15685
15770
  if (existsSync17(provWorkflowsDir)) {
15686
15771
  const expected = new Set(refreshData.workflows.map((w) => `${w.name}.js`));
15687
15772
  for (const file of readdirSync10(provWorkflowsDir)) {
15688
15773
  if (!file.endsWith(".js")) continue;
15689
15774
  if (expected.has(file)) continue;
15690
15775
  try {
15691
- rmSync5(join38(provWorkflowsDir, file));
15776
+ rmSync5(join39(provWorkflowsDir, file));
15692
15777
  } catch {
15693
15778
  }
15694
15779
  }
@@ -15770,7 +15855,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
15770
15855
  if (written && existsSync17(agentDir)) {
15771
15856
  const driftedFiles = [];
15772
15857
  for (const [file, expectedHash] of written) {
15773
- const localHash = hashFile(join38(agentDir, file));
15858
+ const localHash = hashFile(join39(agentDir, file));
15774
15859
  if (localHash && localHash !== expectedHash) {
15775
15860
  driftedFiles.push(file);
15776
15861
  }
@@ -15781,7 +15866,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
15781
15866
  try {
15782
15867
  const localHashes = {};
15783
15868
  for (const file of driftedFiles) {
15784
- localHashes[file] = hashFile(join38(agentDir, file));
15869
+ localHashes[file] = hashFile(join39(agentDir, file));
15785
15870
  }
15786
15871
  await api.post("/host/drift", {
15787
15872
  agent_id: agent.agent_id,
@@ -15996,6 +16081,29 @@ async function processAgent(agent, agentStates, managedToolkits) {
15996
16081
  }
15997
16082
  }
15998
16083
  const channelConfigConvergedThisTick = channelConfigConverged && !channelSyncDeferred;
16084
+ if (agent.status === "active" && !channelSyncDeferred && frameworkAdapter.hasChannelCredentials) {
16085
+ const verdicts = /* @__PURE__ */ new Map();
16086
+ for (const channelId of currentChannelIds) {
16087
+ if (quarantinedChannels.has(channelId)) continue;
16088
+ let onDisk = false;
16089
+ try {
16090
+ onDisk = frameworkAdapter.hasChannelCredentials(agent.code_name, channelId);
16091
+ } catch (err) {
16092
+ onDisk = false;
16093
+ log(
16094
+ `[channels] credential verification threw for '${agent.code_name}/${channelId}': ${err.message} \u2014 reporting as unverified (ENG-9517)`
16095
+ );
16096
+ }
16097
+ verdicts.set(channelId, {
16098
+ verified: onDisk,
16099
+ ...onDisk ? {} : { reason: channelConfigFailureReason || "credential not present on disk" }
16100
+ });
16101
+ }
16102
+ if (verdicts.size > 0) channelCredentialVerdicts.set(agent.agent_id, verdicts);
16103
+ else channelCredentialVerdicts.delete(agent.agent_id);
16104
+ } else {
16105
+ channelCredentialVerdicts.delete(agent.agent_id);
16106
+ }
15999
16107
  const restartDecision = channelConfigConvergedThisTick ? decideChannelRestart({
16000
16108
  previousChannelIds,
16001
16109
  currentChannelIds,
@@ -16026,7 +16134,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
16026
16134
  const addedChannels = [...restartDecision.added];
16027
16135
  const writeDmNoticeMarkers = isChannelAddRestart ? () => {
16028
16136
  try {
16029
- const agentAugmentedDir = join38(homedir18(), ".augmented", agent.code_name);
16137
+ const agentAugmentedDir = join39(homedir18(), ".augmented", agent.code_name);
16030
16138
  mkdirSync11(agentAugmentedDir, { recursive: true });
16031
16139
  const markerJson = JSON.stringify({
16032
16140
  version: 1,
@@ -16034,7 +16142,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
16034
16142
  added: addedChannels
16035
16143
  });
16036
16144
  for (const file of ["slack-channel-add-restart.json", "telegram-channel-add-restart.json"]) {
16037
- atomicWriteFileSync(join38(agentAugmentedDir, file), markerJson);
16145
+ atomicWriteFileSync(join39(agentAugmentedDir, file), markerJson);
16038
16146
  }
16039
16147
  } catch (err) {
16040
16148
  log(`[hot-reload] channel-add DM-notice marker write failed for '${agent.code_name}' (non-fatal): ${err.message}`);
@@ -16223,18 +16331,18 @@ async function processAgent(agent, agentStates, managedToolkits) {
16223
16331
  if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code") {
16224
16332
  try {
16225
16333
  const agentProvisionDir = agentDir;
16226
- const projectDir = join38(homedir18(), ".augmented", agent.code_name, "project");
16334
+ const projectDir = join39(homedir18(), ".augmented", agent.code_name, "project");
16227
16335
  mkdirSync11(agentProvisionDir, { recursive: true });
16228
16336
  mkdirSync11(projectDir, { recursive: true });
16229
- const provisionMcpPath = join38(agentProvisionDir, ".mcp.json");
16230
- const projectMcpPath = join38(projectDir, ".mcp.json");
16337
+ const provisionMcpPath = join39(agentProvisionDir, ".mcp.json");
16338
+ const projectMcpPath = join39(projectDir, ".mcp.json");
16231
16339
  let mcpConfig = { mcpServers: {} };
16232
16340
  try {
16233
- mcpConfig = JSON.parse(readFileSync29(provisionMcpPath, "utf-8"));
16341
+ mcpConfig = JSON.parse(readFileSync30(provisionMcpPath, "utf-8"));
16234
16342
  if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
16235
16343
  } catch {
16236
16344
  }
16237
- const localDirectChatChannel = join38(homedir18(), ".augmented", "_mcp", "direct-chat-channel.js");
16345
+ const localDirectChatChannel = join39(homedir18(), ".augmented", "_mcp", "direct-chat-channel.js");
16238
16346
  const directChatTeamSettings = refreshData.team?.settings;
16239
16347
  const directChatTz = (() => {
16240
16348
  const tz = directChatTeamSettings?.["timezone"];
@@ -16260,7 +16368,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
16260
16368
  // ~/.augmented/<codeName>/.current-turn-initiator.json. Note getAgentDir
16261
16369
  // returns the agent root (NOT the /provision subdir `agentDir` points at),
16262
16370
  // so it byte-matches the broker readers' path.
16263
- AGT_TURN_INITIATOR_FILE: join38(
16371
+ AGT_TURN_INITIATOR_FILE: join39(
16264
16372
  frameworkAdapter.getAgentDir(agent.code_name),
16265
16373
  ".current-turn-initiator.json"
16266
16374
  )
@@ -16280,7 +16388,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
16280
16388
  log(`Channel credentials written for '${agent.code_name}/direct-chat'`);
16281
16389
  }
16282
16390
  }
16283
- const staleChannelsPath = join38(projectDir, ".mcp-channels.json");
16391
+ const staleChannelsPath = join39(projectDir, ".mcp-channels.json");
16284
16392
  if (existsSync17(staleChannelsPath)) {
16285
16393
  try {
16286
16394
  rmSync5(staleChannelsPath, { force: true });
@@ -16370,7 +16478,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
16370
16478
  }
16371
16479
  if (hostFlagStore().getBoolean("connectivity-probe")) {
16372
16480
  try {
16373
- const probeProjectDir = join38(homedir18(), ".augmented", agent.code_name, "project");
16481
+ const probeProjectDir = join39(homedir18(), ".augmented", agent.code_name, "project");
16374
16482
  let probeSet = integrations;
16375
16483
  try {
16376
16484
  const quarantined = await api.post("/host/agent-integrations/quarantined", { agent_id: agent.agent_id });
@@ -16416,7 +16524,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
16416
16524
  const forceDue = attemptsLeft > 0;
16417
16525
  let probeRan = false;
16418
16526
  try {
16419
- const probeProjectDir = join38(homedir18(), ".augmented", agent.code_name, "project");
16527
+ const probeProjectDir = join39(homedir18(), ".augmented", agent.code_name, "project");
16420
16528
  probeRan = await runAgentSessionToolBindProbes(agent, integrations, probeProjectDir, { forceDue });
16421
16529
  } catch (err) {
16422
16530
  log(`Session-tool-bind probe failed for '${agent.code_name}': ${err.message}`);
@@ -16493,11 +16601,11 @@ async function processAgent(agent, agentStates, managedToolkits) {
16493
16601
  const intHash = computeIntegrationsHash(integrations);
16494
16602
  const prevIntHash = agentState.knownIntegrationHashes.get(agent.agent_id);
16495
16603
  if (intHash !== prevIntHash) {
16496
- const projectDir = join38(homedir18(), ".augmented", agent.code_name, "project");
16497
- const envIntPath = join38(projectDir, ".env.integrations");
16604
+ const projectDir = join39(homedir18(), ".augmented", agent.code_name, "project");
16605
+ const envIntPath = join39(projectDir, ".env.integrations");
16498
16606
  let preWriteEnv;
16499
16607
  try {
16500
- preWriteEnv = readFileSync29(envIntPath, "utf-8");
16608
+ preWriteEnv = readFileSync30(envIntPath, "utf-8");
16501
16609
  } catch {
16502
16610
  preWriteEnv = void 0;
16503
16611
  }
@@ -16516,9 +16624,9 @@ async function processAgent(agent, agentStates, managedToolkits) {
16516
16624
  }
16517
16625
  if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
16518
16626
  try {
16519
- const projectMcpPath = join38(projectDir, ".mcp.json");
16520
- const postWriteEnv = readFileSync29(envIntPath, "utf-8");
16521
- const mcpContent = readFileSync29(projectMcpPath, "utf-8");
16627
+ const projectMcpPath = join39(projectDir, ".mcp.json");
16628
+ const postWriteEnv = readFileSync30(envIntPath, "utf-8");
16629
+ const mcpContent = readFileSync30(projectMcpPath, "utf-8");
16522
16630
  const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
16523
16631
  const mcpJsonForReap = JSON.parse(mcpContent);
16524
16632
  const affectedServerKeys = findMcpServersUsingVars(mcpJsonForReap, changedVars);
@@ -16786,12 +16894,12 @@ async function processAgent(agent, agentStates, managedToolkits) {
16786
16894
  const frameworkId2 = frameworkAdapter.id;
16787
16895
  const candidateSkillDirs = [
16788
16896
  // Claude Code — framework runtime tree
16789
- join38(homedir19(), ".augmented", agent.code_name, "skills"),
16897
+ join39(homedir19(), ".augmented", agent.code_name, "skills"),
16790
16898
  // Claude Code — project tree
16791
- join38(homedir19(), ".augmented", agent.code_name, "project", ".claude", "skills"),
16899
+ join39(homedir19(), ".augmented", agent.code_name, "project", ".claude", "skills"),
16792
16900
  // Defensive: legacy provision-side path, not currently an
16793
16901
  // install target but cheap to sweep.
16794
- join38(agentDir, ".claude", "skills")
16902
+ join39(agentDir, ".claude", "skills")
16795
16903
  ];
16796
16904
  const existingDirs = candidateSkillDirs.filter((d) => existsSync17(d));
16797
16905
  const discoveredEntries = /* @__PURE__ */ new Set();
@@ -16832,7 +16940,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
16832
16940
  const sharedSkillsPayload = refreshAny.shared_skills;
16833
16941
  const desiredResolved = globalSkillsPayload !== void 0 || sharedSkillsPayload !== void 0;
16834
16942
  const manifestPath = managedSkillManifestPath(
16835
- join38(homedir18(), ".augmented", agent.code_name)
16943
+ join39(homedir18(), ".augmented", agent.code_name)
16836
16944
  );
16837
16945
  const prevIds = /* @__PURE__ */ new Set([
16838
16946
  ...agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
@@ -16852,15 +16960,15 @@ async function processAgent(agent, agentStates, managedToolkits) {
16852
16960
  }
16853
16961
  if (plan.removes.length) {
16854
16962
  const globalSkillDirs = [
16855
- join38(homedir18(), ".augmented", agent.code_name, "skills"),
16856
- join38(homedir18(), ".augmented", agent.code_name, "project", ".claude", "skills"),
16857
- join38(agentDir, ".claude", "skills")
16963
+ join39(homedir18(), ".augmented", agent.code_name, "skills"),
16964
+ join39(homedir18(), ".augmented", agent.code_name, "project", ".claude", "skills"),
16965
+ join39(agentDir, ".claude", "skills")
16858
16966
  ];
16859
16967
  for (const id of plan.removes) {
16860
16968
  let prunedAny = false;
16861
16969
  for (const dir of globalSkillDirs) {
16862
- const p = join38(dir, id);
16863
- if (existsSync17(p) && existsSync17(join38(p, "SKILL.md"))) {
16970
+ const p = join39(dir, id);
16971
+ if (existsSync17(p) && existsSync17(join39(p, "SKILL.md"))) {
16864
16972
  rmSync5(p, { recursive: true, force: true });
16865
16973
  prunedAny = true;
16866
16974
  }
@@ -17096,8 +17204,8 @@ async function processAgent(agent, agentStates, managedToolkits) {
17096
17204
  const sess = getSessionState(agent.code_name);
17097
17205
  let mcpJsonParsed = null;
17098
17206
  try {
17099
- const mcpPath = join38(getProjectDir(agent.code_name), ".mcp.json");
17100
- mcpJsonParsed = JSON.parse(readFileSync29(mcpPath, "utf-8"));
17207
+ const mcpPath = join39(getProjectDir(agent.code_name), ".mcp.json");
17208
+ mcpJsonParsed = JSON.parse(readFileSync30(mcpPath, "utf-8"));
17101
17209
  } catch {
17102
17210
  }
17103
17211
  reapMissingMcpSessions({
@@ -17531,7 +17639,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
17531
17639
  if (trackedFiles.length > 0 && existsSync17(agentDir)) {
17532
17640
  const hashes = /* @__PURE__ */ new Map();
17533
17641
  for (const file of trackedFiles) {
17534
- const h = hashFile(join38(agentDir, file));
17642
+ const h = hashFile(join39(agentDir, file));
17535
17643
  if (h) hashes.set(file, h);
17536
17644
  }
17537
17645
  agentState.writtenHashes.set(agent.agent_id, hashes);
@@ -17546,7 +17654,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
17546
17654
  refreshData.agent.onboarding_state
17547
17655
  );
17548
17656
  const obStep = obState.step;
17549
- const markerPath = join38(homedir18(), ".augmented", agent.code_name, "onboarding-drive.json");
17657
+ const markerPath = join39(homedir18(), ".augmented", agent.code_name, "onboarding-drive.json");
17550
17658
  const marker = readOnboardingDriveMarker(markerPath);
17551
17659
  const obContactRaw = refreshData.agent.manager_last_contacted_at;
17552
17660
  const obContact = typeof obContactRaw === "string" && obContactRaw ? obContactRaw : null;
@@ -17648,7 +17756,7 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
17648
17756
  }
17649
17757
  stopOpencodeSlackIngest(codeName, log);
17650
17758
  stopOpencodeTelegramIngest(codeName, log);
17651
- const opencodeProjectDir = join38(getFramework("opencode").getAgentDir(codeName), "provision");
17759
+ const opencodeProjectDir = join39(getFramework("opencode").getAgentDir(codeName), "provision");
17652
17760
  const serveEnv = {
17653
17761
  AGT_HOST: requireHost(),
17654
17762
  AGT_API_KEY: getApiKey() ?? void 0,
@@ -17703,8 +17811,8 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
17703
17811
  });
17704
17812
  }
17705
17813
  const projectDir = getProjectDir(codeName);
17706
- const mcpConfigPath = join38(projectDir, ".mcp.json");
17707
- const claudeMdPath = join38(projectDir, "CLAUDE.md");
17814
+ const mcpConfigPath = join39(projectDir, ".mcp.json");
17815
+ const claudeMdPath = join39(projectDir, "CLAUDE.md");
17708
17816
  if (restartBreaker.isTripped(codeName)) {
17709
17817
  const trip = restartBreaker.getTrip(codeName);
17710
17818
  return {
@@ -18479,10 +18587,10 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
18479
18587
  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}`));
18480
18588
  void (async () => {
18481
18589
  try {
18482
- const { collectDiagnostics } = await import("../persistent-session-UQBJRLLZ.js");
18590
+ const { collectDiagnostics } = await import("../persistent-session-TPP35O6H.js");
18483
18591
  await api.post("/host/heartbeat", {
18484
18592
  host_id: hostId,
18485
- agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
18593
+ agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
18486
18594
  });
18487
18595
  } catch (err) {
18488
18596
  log(`[restart-lane] post-respawn diagnostics flush failed for '${codeName}': ${err.message}`);
@@ -18530,10 +18638,10 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
18530
18638
  }
18531
18639
  try {
18532
18640
  const hostId = await getHostId();
18533
- const { collectDiagnostics } = await import("../persistent-session-UQBJRLLZ.js");
18641
+ const { collectDiagnostics } = await import("../persistent-session-TPP35O6H.js");
18534
18642
  await api.post("/host/heartbeat", {
18535
18643
  host_id: hostId,
18536
- agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
18644
+ agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
18537
18645
  });
18538
18646
  } catch (err) {
18539
18647
  log(`[fast-mcp-respawn] post-respawn diagnostics flush failed for '${codeName}': ${err.message}`);
@@ -18929,7 +19037,7 @@ async function processDirectChatMessage(agent, msg) {
18929
19037
  try {
18930
19038
  const doorbell = directChatDoorbellPath(agent.agentId, homedir18());
18931
19039
  mkdirSync11(dirname10(doorbell), { recursive: true });
18932
- writeFileSync14(doorbell, String(Date.now()));
19040
+ writeFileSync15(doorbell, String(Date.now()));
18933
19041
  log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
18934
19042
  return;
18935
19043
  } catch (err) {
@@ -19058,7 +19166,7 @@ ${formatRunMarker(run_id)}` : KANBAN_CHECK_COMMAND;
19058
19166
  try {
19059
19167
  const doorbell = directChatDoorbellPath(agentId, homedir18());
19060
19168
  mkdirSync11(dirname10(doorbell), { recursive: true });
19061
- writeFileSync14(doorbell, String(Date.now()));
19169
+ writeFileSync15(doorbell, String(Date.now()));
19062
19170
  } catch (err) {
19063
19171
  log(`[kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
19064
19172
  }
@@ -19162,7 +19270,7 @@ async function processClaudePairSessions(agents) {
19162
19270
  killPairSession,
19163
19271
  pairTmuxSession,
19164
19272
  finalizeClaudePairOnboarding
19165
- } = await import("../claude-pair-runtime-GKB2QQCX.js");
19273
+ } = await import("../claude-pair-runtime-HPYSFXPP.js");
19166
19274
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
19167
19275
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
19168
19276
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -19387,17 +19495,17 @@ var lastDownloadHash = /* @__PURE__ */ new Map();
19387
19495
  var lastLocalFileHash = /* @__PURE__ */ new Map();
19388
19496
  var memoryManifests = /* @__PURE__ */ new Map();
19389
19497
  function memoryRetirementDir(configDir, codeName) {
19390
- return join38(configDir, "_memory-retirement", codeName);
19498
+ return join39(configDir, "_memory-retirement", codeName);
19391
19499
  }
19392
19500
  function memoryManifestPath(configDir, codeName) {
19393
- return join38(memoryRetirementDir(configDir, codeName), "manifest.json");
19501
+ return join39(memoryRetirementDir(configDir, codeName), "manifest.json");
19394
19502
  }
19395
19503
  function loadMemoryManifest(agentId, configDir, codeName) {
19396
19504
  const cached = memoryManifests.get(agentId);
19397
19505
  if (cached) return cached;
19398
19506
  let manifest = {};
19399
19507
  try {
19400
- const raw = readFileSync29(memoryManifestPath(configDir, codeName), "utf-8");
19508
+ const raw = readFileSync30(memoryManifestPath(configDir, codeName), "utf-8");
19401
19509
  const parsed = JSON.parse(raw);
19402
19510
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
19403
19511
  for (const [name, entry] of Object.entries(parsed)) {
@@ -19419,13 +19527,13 @@ function saveMemoryManifest(agentId, configDir, codeName) {
19419
19527
  const path = memoryManifestPath(configDir, codeName);
19420
19528
  mkdirSync11(memoryRetirementDir(configDir, codeName), { recursive: true });
19421
19529
  const tmp = `${path}.tmp`;
19422
- writeFileSync14(tmp, JSON.stringify(manifest, null, 2));
19530
+ writeFileSync15(tmp, JSON.stringify(manifest, null, 2));
19423
19531
  renameSync8(tmp, path);
19424
19532
  } catch {
19425
19533
  }
19426
19534
  }
19427
19535
  function retiredMemoryDir(configDir, codeName) {
19428
- return join38(memoryRetirementDir(configDir, codeName), "retired");
19536
+ return join39(memoryRetirementDir(configDir, codeName), "retired");
19429
19537
  }
19430
19538
  var RETIRED_MEMORY_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
19431
19539
  var lastRetirementReport = /* @__PURE__ */ new Map();
@@ -19503,7 +19611,7 @@ function applyMemoryTombstones(opts) {
19503
19611
  log2(`[memory-retire] ${agent.code_name}: KEPT '${tomb.name}' \u2014 no write record, not ours to remove`);
19504
19612
  continue;
19505
19613
  }
19506
- const filePath = join38(memoryDir, entry.file);
19614
+ const filePath = join39(memoryDir, entry.file);
19507
19615
  if (!existsSync17(filePath)) {
19508
19616
  outcomes.already_gone++;
19509
19617
  delete manifest[tomb.name];
@@ -19511,7 +19619,7 @@ function applyMemoryTombstones(opts) {
19511
19619
  continue;
19512
19620
  }
19513
19621
  try {
19514
- const actual = createHash17("sha256").update(readFileSync29(filePath)).digest("hex");
19622
+ const actual = createHash17("sha256").update(readFileSync30(filePath)).digest("hex");
19515
19623
  if (actual !== entry.sha) {
19516
19624
  outcomes.kept_modified++;
19517
19625
  outcomes.unapplied.push({ name: tomb.name, reason: "kept_modified" });
@@ -19523,9 +19631,9 @@ function applyMemoryTombstones(opts) {
19523
19631
  const destDir = retiredMemoryDir(configDir, agent.code_name);
19524
19632
  mkdirSync11(destDir, { recursive: true });
19525
19633
  const stamp = Date.now();
19526
- let dest = join38(destDir, `${entry.file}.${stamp}.retired`);
19634
+ let dest = join39(destDir, `${entry.file}.${stamp}.retired`);
19527
19635
  for (let n = 1; existsSync17(dest); n++) {
19528
- dest = join38(destDir, `${entry.file}.${stamp}-${n}.retired`);
19636
+ dest = join39(destDir, `${entry.file}.${stamp}-${n}.retired`);
19529
19637
  }
19530
19638
  renameSync8(filePath, dest);
19531
19639
  try {
@@ -19564,7 +19672,7 @@ function reapRetiredMemories(configDir, codeName, log2) {
19564
19672
  try {
19565
19673
  for (const file of readdirSync10(dir)) {
19566
19674
  if (!file.endsWith(".retired")) continue;
19567
- const path = join38(dir, file);
19675
+ const path = join39(dir, file);
19568
19676
  try {
19569
19677
  if (statSync8(path).mtimeMs < cutoff) {
19570
19678
  unlinkSync6(path);
@@ -19579,8 +19687,8 @@ function reapRetiredMemories(configDir, codeName, log2) {
19579
19687
  if (reaped > 0) log2(`[memory-retire] ${codeName}: reaped ${reaped} retired memory file(s) past TTL`);
19580
19688
  }
19581
19689
  async function syncMemories(agent, configDir, log2) {
19582
- const projectDir = join38(configDir, agent.code_name, "project");
19583
- const memoryDir = join38(projectDir, "memory");
19690
+ const projectDir = join39(configDir, agent.code_name, "project");
19691
+ const memoryDir = join39(projectDir, "memory");
19584
19692
  const isFreshSync = pendingFreshMemorySync.has(agent.agent_id);
19585
19693
  if (isFreshSync) {
19586
19694
  log2(`[memory-sync] Fresh-sync requested for '${agent.code_name}' \u2014 pulling DB first`);
@@ -19611,7 +19719,7 @@ async function syncMemories(agent, configDir, log2) {
19611
19719
  for (const file of readdirSync10(memoryDir)) {
19612
19720
  if (!file.endsWith(".md")) continue;
19613
19721
  try {
19614
- const raw = readFileSync29(join38(memoryDir, file), "utf-8");
19722
+ const raw = readFileSync30(join39(memoryDir, file), "utf-8");
19615
19723
  const fileHash = createHash17("sha256").update(raw).digest("hex").slice(0, 16);
19616
19724
  currentHashes.set(file, fileHash);
19617
19725
  if (prevHashes.get(file) === fileHash) continue;
@@ -19636,7 +19744,7 @@ async function syncMemories(agent, configDir, log2) {
19636
19744
  } catch (err) {
19637
19745
  for (const mem of changedMemories) {
19638
19746
  for (const [file] of currentHashes) {
19639
- const parsed = parseMemoryFile(readFileSync29(join38(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
19747
+ const parsed = parseMemoryFile(readFileSync30(join39(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
19640
19748
  if (parsed?.name === mem.name) currentHashes.delete(file);
19641
19749
  }
19642
19750
  }
@@ -19687,7 +19795,7 @@ async function downloadMemories(agent, memoryDir, log2, { force, configDir }) {
19687
19795
  const rawSlug = mem.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "").slice(0, 60);
19688
19796
  const slug = rawSlug || `memory-${i}`;
19689
19797
  const fileName = `${slug}.md`;
19690
- const filePath = join38(memoryDir, fileName);
19798
+ const filePath = join39(memoryDir, fileName);
19691
19799
  const desired = `---
19692
19800
  name: ${JSON.stringify(mem.name)}
19693
19801
  type: ${mem.type}
@@ -19707,7 +19815,7 @@ ${mem.content}
19707
19815
  if (existsSync17(filePath)) {
19708
19816
  let existing = "";
19709
19817
  try {
19710
- existing = readFileSync29(filePath, "utf-8");
19818
+ existing = readFileSync30(filePath, "utf-8");
19711
19819
  } catch {
19712
19820
  }
19713
19821
  if (existing === desired) {
@@ -19715,10 +19823,10 @@ ${mem.content}
19715
19823
  if (manifestDirty) saveMemoryManifest(agent.agent_id, configDir, agent.code_name);
19716
19824
  continue;
19717
19825
  }
19718
- writeFileSync14(filePath, desired);
19826
+ writeFileSync15(filePath, desired);
19719
19827
  overwritten++;
19720
19828
  } else {
19721
- writeFileSync14(filePath, desired);
19829
+ writeFileSync15(filePath, desired);
19722
19830
  written++;
19723
19831
  }
19724
19832
  if (record()) manifestDirty = true;
@@ -20007,7 +20115,7 @@ function startManager(opts) {
20007
20115
  try {
20008
20116
  const stateFile = getStateFile();
20009
20117
  if (existsSync17(stateFile)) {
20010
- const raw = readFileSync29(stateFile, "utf-8");
20118
+ const raw = readFileSync30(stateFile, "utf-8");
20011
20119
  const parsed = JSON.parse(raw);
20012
20120
  if (Array.isArray(parsed.agents)) {
20013
20121
  state8.agents = parsed.agents;
@@ -20034,7 +20142,7 @@ function startManager(opts) {
20034
20142
  log(`[startup] state rehydration failed (continuing with empty state): ${err.message}`);
20035
20143
  }
20036
20144
  log(
20037
- `[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join38(homedir18(), ".augmented", "manager.log")}`
20145
+ `[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join39(homedir18(), ".augmented", "manager.log")}`
20038
20146
  );
20039
20147
  deployMcpAssets();
20040
20148
  reapOrphanChannelMcps({ log });
@@ -20063,7 +20171,7 @@ async function reapOrphanedClaudePids() {
20063
20171
  const looksLikeClaude = (pid) => {
20064
20172
  if (process.platform !== "linux") return true;
20065
20173
  try {
20066
- const comm = readFileSync29(`/proc/${pid}/comm`, "utf-8").trim().toLowerCase();
20174
+ const comm = readFileSync30(`/proc/${pid}/comm`, "utf-8").trim().toLowerCase();
20067
20175
  return comm.includes("claude");
20068
20176
  } catch {
20069
20177
  return false;
@@ -20160,14 +20268,14 @@ function restartRunningChannelMcps(basenames) {
20160
20268
  }
20161
20269
  }
20162
20270
  function deployMcpAssets() {
20163
- const targetDir = join38(homedir18(), ".augmented", "_mcp");
20271
+ const targetDir = join39(homedir18(), ".augmented", "_mcp");
20164
20272
  mkdirSync11(targetDir, { recursive: true });
20165
20273
  const moduleDir = dirname10(fileURLToPath(import.meta.url));
20166
20274
  let mcpSourceDir = "";
20167
20275
  let dir = moduleDir;
20168
20276
  for (let i = 0; i < 6; i++) {
20169
- const candidate = join38(dir, "dist", "mcp");
20170
- if (existsSync17(join38(candidate, "index.js"))) {
20277
+ const candidate = join39(dir, "dist", "mcp");
20278
+ if (existsSync17(join39(candidate, "index.js"))) {
20171
20279
  mcpSourceDir = candidate;
20172
20280
  break;
20173
20281
  }
@@ -20185,7 +20293,7 @@ function deployMcpAssets() {
20185
20293
  const fileHash = (p) => {
20186
20294
  try {
20187
20295
  if (!existsSync17(p)) return null;
20188
- return createHash17("sha256").update(readFileSync29(p)).digest("hex");
20296
+ return createHash17("sha256").update(readFileSync30(p)).digest("hex");
20189
20297
  } catch {
20190
20298
  return null;
20191
20299
  }
@@ -20256,8 +20364,8 @@ function deployMcpAssets() {
20256
20364
  // needs restarting to pick up a token rotation.
20257
20365
  "xero.js"
20258
20366
  ]) {
20259
- const src = join38(mcpSourceDir, file);
20260
- const dst = join38(targetDir, file);
20367
+ const src = join39(mcpSourceDir, file);
20368
+ const dst = join39(targetDir, file);
20261
20369
  if (!existsSync17(src)) continue;
20262
20370
  attemptedFiles.push(file);
20263
20371
  const before = fileHash(dst);
@@ -20283,23 +20391,23 @@ function deployMcpAssets() {
20283
20391
  log(`[manager] Bundle(s) updated: ${changedBasenames.join(", ")} \u2014 signalling running instances to restart`);
20284
20392
  restartRunningChannelMcps(changedBasenames);
20285
20393
  }
20286
- const localMcpPath = join38(targetDir, "index.js");
20394
+ const localMcpPath = join39(targetDir, "index.js");
20287
20395
  try {
20288
- const agentsDir = join38(homedir18(), ".augmented", "agents");
20396
+ const agentsDir = join39(homedir18(), ".augmented", "agents");
20289
20397
  if (existsSync17(agentsDir)) {
20290
20398
  for (const entry of readdirSync10(agentsDir, { withFileTypes: true })) {
20291
20399
  if (!entry.isDirectory()) continue;
20292
20400
  for (const subdir of ["provision", "project"]) {
20293
- const mcpJsonPath = join38(agentsDir, entry.name, subdir, ".mcp.json");
20401
+ const mcpJsonPath = join39(agentsDir, entry.name, subdir, ".mcp.json");
20294
20402
  try {
20295
- const raw = readFileSync29(mcpJsonPath, "utf-8");
20403
+ const raw = readFileSync30(mcpJsonPath, "utf-8");
20296
20404
  if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
20297
20405
  const mcpConfig = JSON.parse(raw);
20298
20406
  const augServer = mcpConfig.mcpServers?.["augmented"];
20299
20407
  if (!augServer) continue;
20300
20408
  augServer.command = "node";
20301
20409
  augServer.args = [localMcpPath];
20302
- writeFileSync14(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
20410
+ writeFileSync15(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
20303
20411
  log(`[manager] Patched ${entry.name}/${subdir}/.mcp.json: npx \u2192 node`);
20304
20412
  } catch {
20305
20413
  }
@@ -20400,6 +20508,7 @@ export {
20400
20508
  stopManager,
20401
20509
  stuckChannelSyncs,
20402
20510
  stuckRealtimeRebinds,
20403
- supersededRuntimeImageIds
20511
+ supersededRuntimeImageIds,
20512
+ verifiedChannelCredentials
20404
20513
  };
20405
20514
  //# sourceMappingURL=manager-worker.js.map