@integrity-labs/agt-cli 0.28.1273 → 0.28.1275

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{api-client-PENFPEFF.js → api-client-5S4JHNCY.js} +3 -3
  2. package/dist/bin/agt.js +7 -7
  3. package/dist/{chunk-5J56SF6P.js → chunk-4UXZAUEY.js} +2 -2
  4. package/dist/{chunk-QLNKB2E3.js → chunk-7D6EMIHG.js} +30 -15
  5. package/dist/chunk-7D6EMIHG.js.map +1 -0
  6. package/dist/{chunk-3WRBN6EY.js → chunk-7PIMV2ID.js} +10 -8
  7. package/dist/{chunk-3WRBN6EY.js.map → chunk-7PIMV2ID.js.map} +1 -1
  8. package/dist/{chunk-3P3COJTT.js → chunk-BSVQWPBC.js} +3 -3
  9. package/dist/{chunk-H2CESPPE.js → chunk-GRWU34ID.js} +2 -2
  10. package/dist/{chunk-QOH2AE5I.js → chunk-V2BS3IN3.js} +9 -2
  11. package/dist/{chunk-QOH2AE5I.js.map → chunk-V2BS3IN3.js.map} +1 -1
  12. package/dist/{claude-code-updater-NWNHKBJE.js → claude-code-updater-EC3JMSNJ.js} +3 -3
  13. package/dist/{claude-pair-runtime-EMBJDR4W.js → claude-pair-runtime-NPBFKJSQ.js} +3 -3
  14. package/dist/lib/manager-worker.js +765 -447
  15. package/dist/lib/manager-worker.js.map +1 -1
  16. package/dist/mcp/direct-chat-channel.js +9 -2
  17. package/dist/mcp/index.js +8 -1
  18. package/dist/mcp/origami.js +8 -1
  19. package/dist/mcp/slack-channel.js +9 -2
  20. package/dist/mcp/telegram-channel.js +9 -2
  21. package/dist/{persistent-session-7VJJ4AD7.js → persistent-session-EJUOBWXJ.js} +8 -4
  22. package/dist/{responsiveness-probe-XGTPNCKO.js → responsiveness-probe-GBYZCGXX.js} +4 -4
  23. package/dist/{session-auth-dead-4CCOVCU3.js → session-auth-dead-4U6NDCWN.js} +3 -3
  24. package/package.json +1 -1
  25. package/dist/chunk-QLNKB2E3.js.map +0 -1
  26. /package/dist/{api-client-PENFPEFF.js.map → api-client-5S4JHNCY.js.map} +0 -0
  27. /package/dist/{chunk-5J56SF6P.js.map → chunk-4UXZAUEY.js.map} +0 -0
  28. /package/dist/{chunk-3P3COJTT.js.map → chunk-BSVQWPBC.js.map} +0 -0
  29. /package/dist/{chunk-H2CESPPE.js.map → chunk-GRWU34ID.js.map} +0 -0
  30. /package/dist/{claude-code-updater-NWNHKBJE.js.map → claude-code-updater-EC3JMSNJ.js.map} +0 -0
  31. /package/dist/{claude-pair-runtime-EMBJDR4W.js.map → claude-pair-runtime-NPBFKJSQ.js.map} +0 -0
  32. /package/dist/{persistent-session-7VJJ4AD7.js.map → persistent-session-EJUOBWXJ.js.map} +0 -0
  33. /package/dist/{responsiveness-probe-XGTPNCKO.js.map → responsiveness-probe-GBYZCGXX.js.map} +0 -0
  34. /package/dist/{session-auth-dead-4CCOVCU3.js.map → session-auth-dead-4U6NDCWN.js.map} +0 -0
@@ -70,7 +70,7 @@ import {
70
70
  tripClass,
71
71
  writeEtcEnvironment,
72
72
  writeProfileDScript
73
- } from "../chunk-3WRBN6EY.js";
73
+ } from "../chunk-7PIMV2ID.js";
74
74
  import {
75
75
  ApiError,
76
76
  adoptHostKeyInProcess,
@@ -88,7 +88,7 @@ import {
88
88
  probeHostKey,
89
89
  requireHost,
90
90
  setConfigHash
91
- } from "../chunk-3P3COJTT.js";
91
+ } from "../chunk-BSVQWPBC.js";
92
92
  import {
93
93
  BLOCKED_ON_PROMPT_DECISION,
94
94
  CHANNEL_SECRET_ENV_KEYS,
@@ -175,10 +175,11 @@ import {
175
175
  takeWatchdogUnclaimedDialogCount,
176
176
  takeZombieDetection,
177
177
  toOpencodeModel,
178
+ warnIgnoredIsolationAllowlist,
178
179
  webFetchBaselineValue,
179
180
  webFetchRestartNeeded,
180
181
  writeEgressAllowlist
181
- } from "../chunk-QLNKB2E3.js";
182
+ } from "../chunk-7D6EMIHG.js";
182
183
  import {
183
184
  isAgentIdle,
184
185
  isStaleForToday,
@@ -189,7 +190,7 @@ import {
189
190
  subagentActivityAgeSeconds,
190
191
  subagentTranscriptDir,
191
192
  transcriptActivityAgeSeconds
192
- } from "../chunk-H2CESPPE.js";
193
+ } from "../chunk-GRWU34ID.js";
193
194
  import {
194
195
  classifyUnanswerablePane,
195
196
  focusedConfirmDialogBlock,
@@ -215,7 +216,7 @@ import {
215
216
  runSafeCleanup,
216
217
  tightestDiskStat,
217
218
  withPackageCacheLock
218
- } from "../chunk-5J56SF6P.js";
219
+ } from "../chunk-4UXZAUEY.js";
219
220
  import {
220
221
  parsePsRows,
221
222
  reapOrphanChannelMcps
@@ -344,7 +345,7 @@ import {
344
345
  stabiliseResetInstant,
345
346
  sumTranscriptUsageInWindow,
346
347
  summarizeTranscriptActivity
347
- } from "../chunk-QOH2AE5I.js";
348
+ } from "../chunk-V2BS3IN3.js";
348
349
  import {
349
350
  CLAUDE_CONFIG_DIR_ENV,
350
351
  claudeConfigDirFor,
@@ -675,6 +676,10 @@ function confirmConfigReloadOnce(input, deps, onHold) {
675
676
  var BLIND_SPAWN_AGE_MARGIN_S = 5;
676
677
  var STRAGGLER_TERM_ATTEMPTS = 2;
677
678
  function stragglerSpawnGate(codeName, deps) {
679
+ if (deps.signalledHostPids && deps.isDocker(codeName) && deps.signalledHostPids.survivors(codeName).length > 0) {
680
+ const held = hostStragglerGate(codeName, () => ({ kind: "none" }), deps);
681
+ if (held) return held;
682
+ }
678
683
  const tmux = deps.probeTmux?.(codeName) ?? "dead";
679
684
  if (tmux !== "dead") {
680
685
  deps.deferStreak?.clear(codeName);
@@ -684,6 +689,10 @@ function stragglerSpawnGate(codeName, deps) {
684
689
  return "spawn-unknown";
685
690
  }
686
691
  const state10 = deps.probeProcess(codeName);
692
+ if (state10 === "dead" && deps.scanHostStragglers && deps.isDocker(codeName)) {
693
+ const deferred = hostStragglerGate(codeName, deps.scanHostStragglers, deps);
694
+ if (deferred) return deferred;
695
+ }
687
696
  if (state10 !== "alive") deps.deferStreak?.clear(codeName);
688
697
  if (state10 === "dead") return "spawn";
689
698
  if (state10 === "unknown") {
@@ -714,16 +723,304 @@ function stragglerSpawnGate(codeName, deps) {
714
723
  }
715
724
  return "defer";
716
725
  }
726
+ function hostStragglerGate(codeName, scan, deps) {
727
+ const result = scan(codeName);
728
+ const lingering = deps.signalledHostPids?.survivors(codeName) ?? [];
729
+ if (result.kind === "none" && lingering.length === 0) return null;
730
+ const streak = deps.deferStreak?.note(codeName, (deps.now ?? Date.now)());
731
+ const attempt = streak?.count ?? 1;
732
+ if (result.kind === "unknown") {
733
+ deps.log(
734
+ `[persistent-session] '${codeName}': deferring spawn - HOST_STRAGGLER_SCAN_UNKNOWN (attempt ${attempt}): ${result.reason}; a host claude left from before Docker isolation cannot be ruled out, and nothing is signalled (ENG-11871)`
735
+ );
736
+ if (streak?.alert) {
737
+ deps.alert?.(
738
+ codeName,
739
+ `agent '${codeName}' has been held offline for ${Math.round(streak.forMs / 6e4)} min: a host claude left from before Docker isolation cannot be ruled out (${result.reason}; ${attempt} attempts). Check the host by hand (ENG-11871)`
740
+ );
741
+ }
742
+ return "defer";
743
+ }
744
+ const found = result.kind === "found" ? result : { roots: [], pids: [] };
745
+ const verified = lingering.filter((l) => l.state === "alive" && !found.pids.includes(l.pid));
746
+ const unverified = lingering.filter((l) => l.state === "unverified" && !found.pids.includes(l.pid));
747
+ for (const u of unverified) {
748
+ deps.log(
749
+ `[persistent-session] HOST_STRAGGLER_UNVERIFIED code_name=${codeName} pid=${u.pid} argv0=${u.argv0} - a host process signalled earlier is not confirmed gone and its identity cannot be confirmed; not signalled, spawn held (ENG-11871)`
750
+ );
751
+ }
752
+ const roots = [...found.roots, ...verified.map((l) => ({ pid: l.pid, argv0: l.argv0 }))];
753
+ const argv0Of = (pid) => roots.find((r) => r.pid === pid)?.argv0 ?? "descendant";
754
+ const scanStart = new Map((result.kind === "found" ? result.identities ?? [] : []).map((i) => [i.pid, i.startTime]));
755
+ const targets = [
756
+ ...found.pids.map((pid) => ({ pid, startTime: scanStart.get(pid) ?? null, argv0: argv0Of(pid) })),
757
+ ...verified.map((l) => ({ pid: l.pid, startTime: l.startTime, argv0: l.argv0 }))
758
+ ];
759
+ const verify = (t) => deps.signalledHostPids ? deps.signalledHostPids.verify(t) : "alive";
760
+ const checked = targets.map((t) => ({ ...t, now: verify(t) }));
761
+ const aliveTargets = checked.filter((t, i) => t.now === "alive" && checked.findIndex((c) => c.pid === t.pid) === i);
762
+ const pids = aliveTargets.map((t) => t.pid);
763
+ for (const t of checked.filter((c) => c.now === "unverified")) {
764
+ deps.log(
765
+ `[persistent-session] HOST_STRAGGLER_UNVERIFIED code_name=${codeName} pid=${t.pid} argv0=${t.argv0} - its identity cannot be confirmed before signalling; not signalled, spawn held (ENG-11871)`
766
+ );
767
+ }
768
+ const signal = attempt > STRAGGLER_TERM_ATTEMPTS ? "KILL" : "TERM";
769
+ const sent = new Set(
770
+ deps.killHostStragglers && aliveTargets.length > 0 ? deps.killHostStragglers(
771
+ aliveTargets.map((t) => ({ pid: t.pid, startTime: t.startTime })),
772
+ signal
773
+ ) : []
774
+ );
775
+ deps.signalledHostPids?.remember(
776
+ codeName,
777
+ checked.filter((t) => t.now !== "gone")
778
+ );
779
+ for (const root of roots.filter((r) => pids.includes(r.pid))) {
780
+ const delivered = sent.has(root.pid);
781
+ deps.log(
782
+ `[persistent-session] HOST_STRAGGLER_KILL code_name=${codeName} pid=${root.pid} argv0=${root.argv0} signal=SIG${signal} sent=${delivered} attempt=${attempt} tree=${pids.length} delivered=${sent.size} - a host claude outlived the move to Docker isolation (ENG-11871)`
783
+ );
784
+ deps.reportHostKill?.(codeName, root, signal, delivered);
785
+ }
786
+ deps.log(
787
+ `[persistent-session] '${codeName}': deferring spawn - a host claude from before Docker isolation is still running; the container starts once it is gone (ENG-11871)`
788
+ );
789
+ if (streak?.alert) {
790
+ deps.alert?.(
791
+ codeName,
792
+ `agent '${codeName}' has been held offline for ${Math.round(streak.forMs / 6e4)} min by a host claude left from before Docker isolation that survives ${signal === "KILL" ? "SIGTERM and SIGKILL" : "SIGTERM (SIGKILL follows from the next attempt)"} (${attempt} attempts, pids ${[...roots, ...unverified].map((r) => r.pid).join(", ")}). Kill it by hand if it persists (ENG-11871)`
793
+ );
794
+ }
795
+ return "defer";
796
+ }
797
+
798
+ // src/lib/host-straggler.ts
799
+ import { execFileSync as execFileSync2 } from "child_process";
800
+ import { readFileSync, readdirSync } from "fs";
801
+ import { basename, join } from "path";
802
+ var NOT_CLAUDE_ARGV0 = /* @__PURE__ */ new Set([
803
+ "docker",
804
+ "dockerd",
805
+ "containerd",
806
+ "runc",
807
+ "tini",
808
+ "tmux",
809
+ "sh",
810
+ "bash",
811
+ "dash",
812
+ "zsh",
813
+ "env",
814
+ "sudo",
815
+ "timeout",
816
+ "nohup",
817
+ "script"
818
+ ]);
819
+ function isNotClaudeArgv0(argv0) {
820
+ const b = basename(argv0);
821
+ return NOT_CLAUDE_ARGV0.has(b) || b.startsWith("containerd-shim");
822
+ }
823
+ function isContainerCgroup(cgroup) {
824
+ return /(^|[/:])(docker|containerd|libpod|kubepods)([-/.]|$)|docker-[0-9a-f]{12,}\.scope/m.test(cgroup);
825
+ }
826
+ function argvHasExactName(argv, codeName) {
827
+ const want = `agt-${codeName}`;
828
+ for (let i = 0; i < argv.length; i++) {
829
+ if (argv[i] === "--name" && argv[i + 1] === want) return true;
830
+ if (argv[i] === `--name=${want}`) return true;
831
+ }
832
+ return false;
833
+ }
834
+ function findHostStragglers(procs, codeName, selfPid = process.pid) {
835
+ const roots = [];
836
+ for (const p of procs) {
837
+ if (p.pid === selfPid || p.argv.length === 0) continue;
838
+ if (!argvHasExactName(p.argv, codeName)) continue;
839
+ if (isNotClaudeArgv0(p.argv[0])) continue;
840
+ if (p.cgroup !== null && isContainerCgroup(p.cgroup)) continue;
841
+ roots.push({ pid: p.pid, argv0: p.argv[0] });
842
+ }
843
+ const children = /* @__PURE__ */ new Map();
844
+ for (const p of procs) {
845
+ const list = children.get(p.ppid);
846
+ if (list) list.push(p.pid);
847
+ else children.set(p.ppid, [p.pid]);
848
+ }
849
+ const seen = /* @__PURE__ */ new Set();
850
+ const queue = roots.map((r) => r.pid);
851
+ while (queue.length > 0) {
852
+ const pid = queue.shift();
853
+ if (seen.has(pid) || pid === selfPid) continue;
854
+ seen.add(pid);
855
+ for (const c of children.get(pid) ?? []) queue.push(c);
856
+ }
857
+ const startOf = new Map(procs.map((p) => [p.pid, p.startTime ?? null]));
858
+ const pids = [...seen];
859
+ return { roots, pids, identities: pids.map((pid) => ({ pid, startTime: startOf.get(pid) ?? null })) };
860
+ }
861
+ function ppidFromStat(stat2) {
862
+ const close = stat2.lastIndexOf(")");
863
+ if (close < 0) return null;
864
+ const fields = stat2.slice(close + 2).split(" ");
865
+ const ppid = Number(fields[1]);
866
+ return Number.isInteger(ppid) ? ppid : null;
867
+ }
868
+ function isExitedError(err) {
869
+ const code = err?.code;
870
+ return code === "ENOENT" || code === "ESRCH";
871
+ }
872
+ function readHostProcs(procRoot = "/proc", read = (path) => readFileSync(path, "utf8")) {
873
+ let entries;
874
+ try {
875
+ entries = readdirSync(procRoot);
876
+ } catch {
877
+ return null;
878
+ }
879
+ const procs = [];
880
+ for (const name of entries) {
881
+ if (!/^\d+$/.test(name)) continue;
882
+ const dir = join(procRoot, name);
883
+ let argv;
884
+ let ppid;
885
+ let statText;
886
+ let startBefore;
887
+ try {
888
+ startBefore = startTimeFromStat(read(join(dir, "stat")));
889
+ argv = read(join(dir, "cmdline")).split("\0");
890
+ statText = read(join(dir, "stat"));
891
+ ppid = ppidFromStat(statText);
892
+ } catch (err) {
893
+ if (isExitedError(err)) continue;
894
+ return { unreadable: `process ${name} could not be read (${err.code ?? "error"})` };
895
+ }
896
+ if (ppid === null) return { unreadable: `process ${name} has an unparseable /proc stat` };
897
+ while (argv.length > 0 && argv[argv.length - 1] === "") argv.pop();
898
+ let cgroup = null;
899
+ try {
900
+ cgroup = read(join(dir, "cgroup"));
901
+ } catch (err) {
902
+ if (isExitedError(err)) continue;
903
+ cgroup = null;
904
+ }
905
+ const startAfter = startTimeFromStat(statText);
906
+ if (startBefore === null || startBefore !== startAfter) {
907
+ return { unreadable: `process ${name} changed or had no readable start time while it was being read` };
908
+ }
909
+ procs.push({ pid: Number(name), ppid, argv, cgroup, startTime: startBefore });
910
+ }
911
+ return { procs, argvExact: true };
912
+ }
913
+ function hostProcsFromPs(psOut) {
914
+ const procs = [];
915
+ for (const line of psOut.split("\n")) {
916
+ const m = /^\s*(\d+)\s+(\d+)\s+(.*\S)\s*$/.exec(line);
917
+ if (!m) continue;
918
+ procs.push({ pid: Number(m[1]), ppid: Number(m[2]), argv: m[3].split(/\s+/), cgroup: null });
919
+ }
920
+ return procs;
921
+ }
922
+ function readHostProcsAnyPlatform(readProc = readHostProcs, runPs = () => execFileSync2("ps", ["-A", "-ww", "-o", "pid=,ppid=,command="], {
923
+ encoding: "utf-8",
924
+ timeout: 3e3,
925
+ maxBuffer: 16 * 1024 * 1024
926
+ })) {
927
+ const fromProc = readProc();
928
+ if (fromProc !== null) return fromProc;
929
+ try {
930
+ return { procs: hostProcsFromPs(runPs()), argvExact: false };
931
+ } catch {
932
+ return { unreadable: "the host process table could not be read (neither /proc nor ps)" };
933
+ }
934
+ }
935
+ function scanHostStragglers(codeName, readTable = () => readHostProcsAnyPlatform()) {
936
+ const table = readTable();
937
+ if ("unreadable" in table) return { kind: "unknown", reason: table.unreadable };
938
+ const { roots, pids, identities } = findHostStragglers(table.procs, codeName);
939
+ if (roots.length > 0 && !table.argvExact) {
940
+ return {
941
+ kind: "unknown",
942
+ reason: `ps shows a process matching --name agt-${codeName} (pids ${roots.map((r) => r.pid).join(", ")}) but cannot show its argument boundaries, so it is not signalled`
943
+ };
944
+ }
945
+ return roots.length === 0 ? { kind: "none" } : { kind: "found", roots, pids, identities };
946
+ }
947
+ function killHostStragglers(targets, signal, kill = (pid, sig) => process.kill(pid, sig), verify = (t) => signalledProcState(t.pid, t.startTime)) {
948
+ const sent = [];
949
+ for (const t of targets) {
950
+ if (verify(t) !== "alive") continue;
951
+ try {
952
+ kill(t.pid, `SIG${signal}`);
953
+ sent.push(t.pid);
954
+ } catch {
955
+ }
956
+ }
957
+ return sent;
958
+ }
959
+ function startTimeFromStat(stat2) {
960
+ const close = stat2.lastIndexOf(")");
961
+ if (close < 0) return null;
962
+ const v = stat2.slice(close + 2).split(" ")[19];
963
+ return v !== void 0 && /^\d+$/.test(v) ? v : null;
964
+ }
965
+ function signalledProcState(pid, startTime, procRoot = "/proc") {
966
+ let stat2;
967
+ try {
968
+ stat2 = readFileSync(join(procRoot, String(pid), "stat"), "utf8");
969
+ } catch (err) {
970
+ return isExitedError(err) ? "gone" : "unverified";
971
+ }
972
+ const now = startTimeFromStat(stat2);
973
+ if (now === null || startTime === null) return "unverified";
974
+ return now === startTime ? "alive" : "gone";
975
+ }
976
+ var SignalledHostPids = class {
977
+ constructor(state10 = (pid, st) => signalledProcState(pid, st)) {
978
+ this.state = state10;
979
+ }
980
+ byAgent = /* @__PURE__ */ new Map();
981
+ /**
982
+ * Is this the same process the identity was taken from (CodeRabbit on #7365)?
983
+ * Called right before a signal: only 'alive' authorises one.
984
+ */
985
+ verify(identity) {
986
+ return this.state(identity.pid, identity.startTime);
987
+ }
988
+ /**
989
+ * Record targets with the identity taken BEFORE they were signalled (the scan's
990
+ * start time, or the one already tracked), never re-read after the signal.
991
+ */
992
+ remember(codeName, targets) {
993
+ const list = this.byAgent.get(codeName) ?? [];
994
+ for (const t of targets) {
995
+ if (list.some((p) => p.pid === t.pid)) continue;
996
+ list.push({ pid: t.pid, startTime: t.startTime, argv0: t.argv0 });
997
+ }
998
+ if (list.length > 0) this.byAgent.set(codeName, list);
999
+ }
1000
+ /** Signalled processes not confirmed gone; the confirmed-gone ones are forgotten. */
1001
+ survivors(codeName) {
1002
+ const list = this.byAgent.get(codeName);
1003
+ if (!list) return [];
1004
+ const out = [];
1005
+ for (const p of list) {
1006
+ const st = this.state(p.pid, p.startTime);
1007
+ if (st !== "gone") out.push({ ...p, state: st });
1008
+ }
1009
+ if (out.length === 0) this.byAgent.delete(codeName);
1010
+ else this.byAgent.set(codeName, out.map(({ state: _s, ...p }) => p));
1011
+ return out;
1012
+ }
1013
+ };
717
1014
 
718
1015
  // src/lib/manager-worker.ts
719
1016
  import { createHash as createHash21 } from "crypto";
720
- import { readFileSync as readFileSync38, writeFileSync as writeFileSync20, mkdirSync as mkdirSync18, existsSync as existsSync20, rmSync as rmSync9, readdirSync as readdirSync14, statSync as statSync15, unlinkSync as unlinkSync6, renameSync as renameSync12, utimesSync as utimesSync4, readlinkSync as readlinkSync2 } from "fs";
1017
+ import { readFileSync as readFileSync39, writeFileSync as writeFileSync20, mkdirSync as mkdirSync18, existsSync as existsSync20, rmSync as rmSync9, readdirSync as readdirSync15, statSync as statSync15, unlinkSync as unlinkSync6, renameSync as renameSync12, utimesSync as utimesSync4, readlinkSync as readlinkSync2 } from "fs";
721
1018
 
722
1019
  // src/lib/atomic-file-replace.ts
723
1020
  import { copyFileSync, renameSync, unlinkSync } from "fs";
724
- import { join, dirname, basename } from "path";
1021
+ import { join as join2, dirname, basename as basename2 } from "path";
725
1022
  function atomicCopyFileSync(src, dst, unique = defaultUnique) {
726
- const tmp = join(dirname(dst), `.${basename(dst)}.tmp-${unique()}`);
1023
+ const tmp = join2(dirname(dst), `.${basename2(dst)}.tmp-${unique()}`);
727
1024
  try {
728
1025
  copyFileSync(src, tmp);
729
1026
  renameSync(tmp, dst);
@@ -1134,7 +1431,7 @@ function clearEpisode(codeName) {
1134
1431
  }
1135
1432
 
1136
1433
  // src/lib/manager-worker.ts
1137
- import { join as join47, dirname as dirname11, delimiter as pathDelimiter } from "path";
1434
+ import { join as join48, dirname as dirname11, delimiter as pathDelimiter } from "path";
1138
1435
  import { homedir as homedir17, hostname, platform as platform3 } from "os";
1139
1436
  import { fileURLToPath as fileURLToPath2 } from "url";
1140
1437
 
@@ -1343,12 +1640,12 @@ function createPollRateLimiter(opts) {
1343
1640
  }
1344
1641
 
1345
1642
  // src/lib/claude-code-upgrade-throttle.ts
1346
- import { mkdirSync, readFileSync, writeFileSync } from "fs";
1347
- import { dirname as dirname2, join as join2 } from "path";
1643
+ import { mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
1644
+ import { dirname as dirname2, join as join3 } from "path";
1348
1645
  import { homedir } from "os";
1349
1646
  var CLAUDE_CODE_UPGRADE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
1350
1647
  function claudeCodeUpgradeMarkerPath() {
1351
- return join2(homedir(), ".augmented", ".last-claude-code-upgrade-check");
1648
+ return join3(homedir(), ".augmented", ".last-claude-code-upgrade-check");
1352
1649
  }
1353
1650
  function stampClaudeCodeUpgradeMarker() {
1354
1651
  try {
@@ -1360,7 +1657,7 @@ function stampClaudeCodeUpgradeMarker() {
1360
1657
  }
1361
1658
  function claudeCodeUpgradeThrottled() {
1362
1659
  try {
1363
- const lastCheck = parseInt(readFileSync(claudeCodeUpgradeMarkerPath(), "utf-8").trim(), 10);
1660
+ const lastCheck = parseInt(readFileSync2(claudeCodeUpgradeMarkerPath(), "utf-8").trim(), 10);
1364
1661
  if (!Number.isFinite(lastCheck)) return false;
1365
1662
  return Date.now() - lastCheck < CLAUDE_CODE_UPGRADE_CHECK_INTERVAL_MS;
1366
1663
  } catch {
@@ -2231,7 +2528,7 @@ function isSlackBehaviourRestrictive(subset) {
2231
2528
  }
2232
2529
 
2233
2530
  // src/lib/onboarding-drive.ts
2234
- import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, rmSync, writeFileSync as writeFileSync2 } from "fs";
2531
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync, writeFileSync as writeFileSync2 } from "fs";
2235
2532
  import { dirname as dirname3 } from "path";
2236
2533
  var ONBOARDING_REINJECT_INTERVAL_MS = 45 * 6e4;
2237
2534
  var ONBOARDING_MAX_NUDGES = 3;
@@ -2358,7 +2655,7 @@ function onboardingNudgeReachedSession(result) {
2358
2655
  }
2359
2656
  function readOnboardingDriveMarker(path) {
2360
2657
  try {
2361
- const raw = JSON.parse(readFileSync2(path, "utf8"));
2658
+ const raw = JSON.parse(readFileSync3(path, "utf8"));
2362
2659
  if (typeof raw.step === "string" && isOnboardingArea(raw.step) && typeof raw.injectedAtMs === "number" && Number.isFinite(raw.injectedAtMs)) {
2363
2660
  const legacyInjects = typeof raw.nudgeCount === "number" && Number.isFinite(raw.nudgeCount) && raw.nudgeCount >= 1 ? Math.floor(raw.nudgeCount) : 1;
2364
2661
  const hasNewCounters = typeof raw.injectCount === "number" && Number.isFinite(raw.injectCount) && raw.injectCount >= 1;
@@ -2394,15 +2691,15 @@ function clearOnboardingDriveMarker(path) {
2394
2691
  }
2395
2692
 
2396
2693
  // src/lib/channel-auto-resume.ts
2397
- import { readFileSync as readFileSync3 } from "fs";
2398
- import { join as join3 } from "path";
2694
+ import { readFileSync as readFileSync4 } from "fs";
2695
+ import { join as join4 } from "path";
2399
2696
  var AUTO_RESUME_BASE_MS = 2 * 60 * 6e4;
2400
2697
  var AUTO_RESUME_MAX_MS = 24 * 60 * 6e4;
2401
2698
  var AUTO_RESUME_MAX_ATTEMPTS = 5;
2402
2699
  var QUARANTINE_DWELL_FLOOR_MS = 18e4;
2403
2700
  var AUTO_RESUME_SUCCESS_GRACE_MS = 2 * (DEAD_CHANNEL_MS + QUARANTINE_DWELL_FLOOR_MS);
2404
2701
  function defaultResumeHistoryPath(configDir) {
2405
- return join3(configDir, "channel-quarantine-resumes.json");
2702
+ return join4(configDir, "channel-quarantine-resumes.json");
2406
2703
  }
2407
2704
  function isResumeFile(value) {
2408
2705
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;
@@ -2430,7 +2727,7 @@ var ChannelResumeHistoryStore = class {
2430
2727
  load() {
2431
2728
  if (this.cache) return this.cache;
2432
2729
  try {
2433
- const parsed = JSON.parse(readFileSync3(this.path, "utf-8"));
2730
+ const parsed = JSON.parse(readFileSync4(this.path, "utf-8"));
2434
2731
  this.cache = isResumeFile(parsed) ? parsed : {};
2435
2732
  } catch {
2436
2733
  this.cache = {};
@@ -2542,8 +2839,8 @@ function decideChannelAutoResume(input) {
2542
2839
  }
2543
2840
 
2544
2841
  // src/lib/channel-quarantine.ts
2545
- import { readFileSync as readFileSync4 } from "fs";
2546
- import { join as join4 } from "path";
2842
+ import { readFileSync as readFileSync5 } from "fs";
2843
+ import { join as join5 } from "path";
2547
2844
  var ESSENTIAL_CHANNEL_KEYS = /* @__PURE__ */ new Set(["direct-chat", "augmented"]);
2548
2845
  var OPTIONAL_CHANNEL_KEYS = /* @__PURE__ */ new Set([
2549
2846
  "telegram",
@@ -2575,7 +2872,7 @@ function classifyChannelCriticality(serverKey, entry) {
2575
2872
  return "essential";
2576
2873
  }
2577
2874
  function defaultQuarantinePath(configDir) {
2578
- return join4(configDir, "channel-quarantine.json");
2875
+ return join5(configDir, "channel-quarantine.json");
2579
2876
  }
2580
2877
  var ChannelQuarantineStore = class {
2581
2878
  path;
@@ -2586,7 +2883,7 @@ var ChannelQuarantineStore = class {
2586
2883
  load() {
2587
2884
  if (this.cache) return this.cache;
2588
2885
  try {
2589
- const raw = readFileSync4(this.path, "utf-8");
2886
+ const raw = readFileSync5(this.path, "utf-8");
2590
2887
  const parsed = JSON.parse(raw);
2591
2888
  this.cache = isQuarantineFile(parsed) ? parsed : {};
2592
2889
  } catch {
@@ -2674,14 +2971,14 @@ function isQuarantineFile(value) {
2674
2971
  }
2675
2972
 
2676
2973
  // src/lib/claude-md-size.ts
2677
- import { readFileSync as readFileSync5 } from "fs";
2678
- import { join as join5 } from "path";
2974
+ import { readFileSync as readFileSync6 } from "fs";
2975
+ import { join as join6 } from "path";
2679
2976
  function measureClaudeMd(configDir, codeName, ceiling = CLAUDE_MD_CONTEXT_ALARM_CHARS, graftHeadroomChars = CLAUDE_MD_MANAGER_APPEND_HEADROOM_CHARS) {
2680
2977
  let chars;
2681
2978
  let bytes;
2682
2979
  let text;
2683
2980
  try {
2684
- const buf = readFileSync5(join5(configDir, codeName, "project", "CLAUDE.md"));
2981
+ const buf = readFileSync6(join6(configDir, codeName, "project", "CLAUDE.md"));
2685
2982
  text = buf.toString("utf8");
2686
2983
  chars = text.length;
2687
2984
  bytes = buf.length;
@@ -2706,8 +3003,8 @@ function measureClaudeMd(configDir, codeName, ceiling = CLAUDE_MD_CONTEXT_ALARM_
2706
3003
  function measureCoreKnowledgeDescription(configDir, codeName) {
2707
3004
  let text;
2708
3005
  try {
2709
- text = readFileSync5(
2710
- join5(configDir, codeName, "project", ".claude", "skills", "core-knowledge", "SKILL.md"),
3006
+ text = readFileSync6(
3007
+ join6(configDir, codeName, "project", ".claude", "skills", "core-knowledge", "SKILL.md"),
2711
3008
  "utf8"
2712
3009
  );
2713
3010
  } catch {
@@ -2752,7 +3049,7 @@ function measureManagedGraft(text, generated) {
2752
3049
  }
2753
3050
  function readProvisionClaudeMd(configDir, codeName) {
2754
3051
  try {
2755
- return readFileSync5(join5(configDir, codeName, "provision", "CLAUDE.md"), "utf8");
3052
+ return readFileSync6(join6(configDir, codeName, "provision", "CLAUDE.md"), "utf8");
2756
3053
  } catch {
2757
3054
  return null;
2758
3055
  }
@@ -2787,11 +3084,11 @@ function logClaudeMdGraftTransition(codeName, report, log2) {
2787
3084
  }
2788
3085
 
2789
3086
  // ../../packages/core/dist/integrations/forwarded-tools-report.js
2790
- import { readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
2791
- import { join as join6 } from "path";
3087
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync3 } from "fs";
3088
+ import { join as join7 } from "path";
2792
3089
  var FORWARDED_TOOLS_REPORT_FILENAME = "forwarded-tools.json";
2793
3090
  function forwardedToolsReportPath(agentDir) {
2794
- return join6(agentDir, FORWARDED_TOOLS_REPORT_FILENAME);
3091
+ return join7(agentDir, FORWARDED_TOOLS_REPORT_FILENAME);
2795
3092
  }
2796
3093
  function stringList(value) {
2797
3094
  return Array.isArray(value) && value.every((n) => typeof n === "string");
@@ -2799,7 +3096,7 @@ function stringList(value) {
2799
3096
  function readForwardedToolsReport(agentDir) {
2800
3097
  let raw;
2801
3098
  try {
2802
- raw = readFileSync6(forwardedToolsReportPath(agentDir), "utf-8");
3099
+ raw = readFileSync7(forwardedToolsReportPath(agentDir), "utf-8");
2803
3100
  } catch {
2804
3101
  return null;
2805
3102
  }
@@ -3045,15 +3342,15 @@ import {
3045
3342
  lstatSync as lstatSync2,
3046
3343
  mkdirSync as mkdirSync3,
3047
3344
  openSync,
3048
- readFileSync as readFileSync7,
3345
+ readFileSync as readFileSync8,
3049
3346
  writeSync
3050
3347
  } from "fs";
3051
- import { join as join7 } from "path";
3348
+ import { join as join8 } from "path";
3052
3349
  import { createHash as createHash4 } from "crypto";
3053
- var SPAWN_MCP_CONFIG_RELATIVE = join7(".claude", "spawn-mcp.json");
3350
+ var SPAWN_MCP_CONFIG_RELATIVE = join8(".claude", "spawn-mcp.json");
3054
3351
  var SPAWN_MCP_FILE_MODE = 384;
3055
3352
  function writeSpawnConfigNoFollow(projectDir, relativePath, content) {
3056
- const claudeDir = join7(projectDir, ".claude");
3353
+ const claudeDir = join8(projectDir, ".claude");
3057
3354
  mkdirSync3(projectDir, { recursive: true });
3058
3355
  try {
3059
3356
  mkdirSync3(claudeDir);
@@ -3064,7 +3361,7 @@ function writeSpawnConfigNoFollow(projectDir, relativePath, content) {
3064
3361
  if (dirStat.isSymbolicLink() || !dirStat.isDirectory()) {
3065
3362
  throw new Error(`${claudeDir} is not a real directory (refusing to follow it)`);
3066
3363
  }
3067
- const path = join7(projectDir, relativePath);
3364
+ const path = join8(projectDir, relativePath);
3068
3365
  const fd = openSync(
3069
3366
  path,
3070
3367
  fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK,
@@ -3107,7 +3404,7 @@ function spawnViewOfMcpConfig(parsed, integrations) {
3107
3404
  function spawnDroppedServerKeys(mcpConfigPath, integrations) {
3108
3405
  if (integrations === void 0) return /* @__PURE__ */ new Set();
3109
3406
  try {
3110
- const parsed = JSON.parse(readFileSync7(mcpConfigPath, "utf-8"));
3407
+ const parsed = JSON.parse(readFileSync8(mcpConfigPath, "utf-8"));
3111
3408
  const servers = parsed?.mcpServers;
3112
3409
  if (!servers || typeof servers !== "object" || Array.isArray(servers)) return /* @__PURE__ */ new Set();
3113
3410
  return new Set(filterOrphanRemoteMcpForSpawn(servers, expectedRemoteMcpKeys(integrations)).dropped);
@@ -3125,7 +3422,7 @@ function prepareSpawnMcpConfig(input) {
3125
3422
  }
3126
3423
  let config2;
3127
3424
  try {
3128
- config2 = JSON.parse(readFileSync7(mcpConfigPath, "utf-8"));
3425
+ config2 = JSON.parse(readFileSync8(mcpConfigPath, "utf-8"));
3129
3426
  } catch {
3130
3427
  return mcpConfigPath;
3131
3428
  }
@@ -3142,7 +3439,7 @@ function prepareSpawnMcpConfig(input) {
3142
3439
  }
3143
3440
  try {
3144
3441
  sanitizeMcpJson(mcpConfigPath, apiHost);
3145
- const reread = JSON.parse(readFileSync7(mcpConfigPath, "utf-8"));
3442
+ const reread = JSON.parse(readFileSync8(mcpConfigPath, "utf-8"));
3146
3443
  if (reread && typeof reread === "object" && !Array.isArray(reread)) config2 = reread;
3147
3444
  } catch {
3148
3445
  }
@@ -3243,7 +3540,7 @@ var SpawnCopyFailureTracker = class {
3243
3540
  function retryHeldSpawnCopy(input) {
3244
3541
  const { tracker, codeName, projectDir, held, integrations, resolveApiHost, log: log2, nowMs = Date.now() } = input;
3245
3542
  if (integrations === void 0) return held;
3246
- const mcpConfigPath = join7(projectDir, ".mcp.json");
3543
+ const mcpConfigPath = join8(projectDir, ".mcp.json");
3247
3544
  const outcome = {
3248
3545
  failed: null,
3249
3546
  nothingToDrop: false
@@ -3701,9 +3998,9 @@ var DependencyRecoveryLedger = class {
3701
3998
  // src/lib/mcp-assets-ready.ts
3702
3999
  import { existsSync as nodeExistsSync, readFileSync as nodeReadFileSync } from "fs";
3703
4000
  import { homedir as homedir2 } from "os";
3704
- import { join as join8, resolve, sep } from "path";
4001
+ import { join as join9, resolve, sep } from "path";
3705
4002
  function getSharedMcpDir(homeDir = homedir2()) {
3706
- return join8(homeDir, ".augmented", "_mcp");
4003
+ return join9(homeDir, ".augmented", "_mcp");
3707
4004
  }
3708
4005
  function isPathInsideDir(candidate, dir) {
3709
4006
  const resolvedDir = resolve(dir);
@@ -3713,11 +4010,11 @@ function isPathInsideDir(candidate, dir) {
3713
4010
  }
3714
4011
  function findMissingMcpBundles(mcpConfigPath, deps = {}) {
3715
4012
  const existsSync21 = deps.existsSync ?? nodeExistsSync;
3716
- const readFileSync39 = deps.readFileSync ?? nodeReadFileSync;
4013
+ const readFileSync40 = deps.readFileSync ?? nodeReadFileSync;
3717
4014
  const mcpDir = deps.mcpDir ?? getSharedMcpDir();
3718
4015
  let parsed;
3719
4016
  try {
3720
- parsed = JSON.parse(readFileSync39(mcpConfigPath, "utf-8"));
4017
+ parsed = JSON.parse(readFileSync40(mcpConfigPath, "utf-8"));
3721
4018
  } catch {
3722
4019
  return [];
3723
4020
  }
@@ -3756,7 +4053,7 @@ function formatMissingMcpBundles(missing) {
3756
4053
  }
3757
4054
 
3758
4055
  // src/lib/self-update-coalesce.ts
3759
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4 } from "fs";
4056
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4 } from "fs";
3760
4057
  import { dirname as dirname4 } from "path";
3761
4058
  var DEFAULT_SELF_UPDATE_COALESCE_MS = 30 * 60 * 1e3;
3762
4059
  function resolveCoalesceWindowMs(env = process.env) {
@@ -3766,7 +4063,7 @@ function resolveCoalesceWindowMs(env = process.env) {
3766
4063
  if (!Number.isFinite(parsed) || parsed < 0) return DEFAULT_SELF_UPDATE_COALESCE_MS;
3767
4064
  return Math.trunc(parsed);
3768
4065
  }
3769
- function readLastSelfUpdateAppliedMs(markerPath, now = Date.now(), read = (p) => readFileSync8(p, "utf-8")) {
4066
+ function readLastSelfUpdateAppliedMs(markerPath, now = Date.now(), read = (p) => readFileSync9(p, "utf-8")) {
3770
4067
  let raw;
3771
4068
  try {
3772
4069
  raw = read(markerPath);
@@ -4071,11 +4368,11 @@ async function reportModelApiError(opts) {
4071
4368
  }
4072
4369
 
4073
4370
  // src/lib/claude-pid-tracker.ts
4074
- import { existsSync, readFileSync as readFileSync9 } from "fs";
4371
+ import { existsSync, readFileSync as readFileSync10 } from "fs";
4075
4372
  function readPidFile(path) {
4076
4373
  if (!existsSync(path)) return { version: 1, spawns: [] };
4077
4374
  try {
4078
- const raw = JSON.parse(readFileSync9(path, "utf-8"));
4375
+ const raw = JSON.parse(readFileSync10(path, "utf-8"));
4079
4376
  if (raw.version !== 1 || !Array.isArray(raw.spawns)) return { version: 1, spawns: [] };
4080
4377
  const spawns = raw.spawns.filter(
4081
4378
  (s) => !!s && typeof s.pid === "number" && Number.isFinite(s.pid) && s.pid > 0
@@ -4175,14 +4472,14 @@ async function killSessionsConcurrently(sessions, killOne) {
4175
4472
  }
4176
4473
 
4177
4474
  // src/lib/direct-chat-delivery.ts
4178
- import { join as join9 } from "path";
4475
+ import { join as join10 } from "path";
4179
4476
  var DEFAULT_DIRECT_CHAT_MAX_AGE_MS = 30 * 6e4;
4180
4477
  function directChatMaxAgeMs() {
4181
4478
  const raw = parseInt(process.env["AGT_DIRECT_CHAT_MAX_AGE_MS"] ?? "", 10);
4182
4479
  return Number.isFinite(raw) && raw >= 0 ? raw : DEFAULT_DIRECT_CHAT_MAX_AGE_MS;
4183
4480
  }
4184
4481
  function directChatDoorbellPath(agentId, home) {
4185
- return join9(home, ".augmented", agentId, "direct-chat-doorbell");
4482
+ return join10(home, ".augmented", agentId, "direct-chat-doorbell");
4186
4483
  }
4187
4484
  function isDirectChatMessageExpired(createdAt, nowMs, maxAgeMs) {
4188
4485
  if (!maxAgeMs || maxAgeMs <= 0) return false;
@@ -4193,8 +4490,8 @@ function isDirectChatMessageExpired(createdAt, nowMs, maxAgeMs) {
4193
4490
  }
4194
4491
 
4195
4492
  // src/lib/review-poster-asset.ts
4196
- import { copyFileSync as copyFileSync2, chmodSync, existsSync as existsSync2, mkdirSync as mkdirSync5, readFileSync as readFileSync10 } from "fs";
4197
- import { dirname as dirname5, join as join10 } from "path";
4493
+ import { copyFileSync as copyFileSync2, chmodSync, existsSync as existsSync2, mkdirSync as mkdirSync5, readFileSync as readFileSync11 } from "fs";
4494
+ import { dirname as dirname5, join as join11 } from "path";
4198
4495
  import { fileURLToPath } from "url";
4199
4496
  var POSTER_FILENAME = "post-review-findings.mjs";
4200
4497
  var AUTH_FILENAME = "obiwan-auth.mjs";
@@ -4207,14 +4504,14 @@ function resolveBundledReviewAssetDir() {
4207
4504
  const moduleDir = dirname5(fileURLToPath(import.meta.url));
4208
4505
  const candidates = [
4209
4506
  // Built output: dist/<chunk>.js → dist/assets/review
4210
- join10(moduleDir, "assets", REVIEW_ASSET_DIRNAME),
4507
+ join11(moduleDir, "assets", REVIEW_ASSET_DIRNAME),
4211
4508
  // Built output sibling case: dist/<sub>/<chunk>.js → dist/assets/review
4212
- join10(moduleDir, "..", "assets", REVIEW_ASSET_DIRNAME),
4509
+ join11(moduleDir, "..", "assets", REVIEW_ASSET_DIRNAME),
4213
4510
  // Dev source: src/lib/review-poster-asset.ts → ../../assets/review
4214
- join10(moduleDir, "..", "..", "assets", REVIEW_ASSET_DIRNAME)
4511
+ join11(moduleDir, "..", "..", "assets", REVIEW_ASSET_DIRNAME)
4215
4512
  ];
4216
4513
  for (const candidate of candidates) {
4217
- if (existsSync2(join10(candidate, POSTER_FILENAME))) return candidate;
4514
+ if (existsSync2(join11(candidate, POSTER_FILENAME))) return candidate;
4218
4515
  }
4219
4516
  throw new Error(
4220
4517
  `[review-poster] could not locate bundled assets; tried:
@@ -4222,18 +4519,18 @@ function resolveBundledReviewAssetDir() {
4222
4519
  );
4223
4520
  }
4224
4521
  function reviewPosterDir(codeName) {
4225
- return join10(getFramework("claude-code").getAgentDir(codeName), REVIEW_ASSET_DIRNAME);
4522
+ return join11(getFramework("claude-code").getAgentDir(codeName), REVIEW_ASSET_DIRNAME);
4226
4523
  }
4227
4524
  function provisionReviewPoster(codeName, sourceDir = resolveBundledReviewAssetDir()) {
4228
4525
  const destDir = reviewPosterDir(codeName);
4229
4526
  mkdirSync5(destDir, { recursive: true });
4230
4527
  for (const [name, mode] of ASSET_FILES) {
4231
- const src = join10(sourceDir, name);
4232
- const dest = join10(destDir, name);
4528
+ const src = join11(sourceDir, name);
4529
+ const dest = join11(destDir, name);
4233
4530
  if (!existsSync2(src)) {
4234
4531
  throw new Error(`[review-poster] bundled asset missing: ${src}`);
4235
4532
  }
4236
- if (!existsSync2(dest) || !readFileSync10(src).equals(readFileSync10(dest))) {
4533
+ if (!existsSync2(dest) || !readFileSync11(src).equals(readFileSync11(dest))) {
4237
4534
  copyFileSync2(src, dest);
4238
4535
  }
4239
4536
  chmodSync(dest, mode);
@@ -4241,8 +4538,8 @@ function provisionReviewPoster(codeName, sourceDir = resolveBundledReviewAssetDi
4241
4538
  }
4242
4539
 
4243
4540
  // src/lib/scratch-sweep-policy.ts
4244
- import { existsSync as existsSync3, mkdirSync as mkdirSync6, readFileSync as readFileSync11, rmSync as rmSync2, writeFileSync as writeFileSync5 } from "fs";
4245
- import { join as join11 } from "path";
4541
+ import { existsSync as existsSync3, mkdirSync as mkdirSync6, readFileSync as readFileSync12, rmSync as rmSync2, writeFileSync as writeFileSync5 } from "fs";
4542
+ import { join as join12 } from "path";
4246
4543
  var SCRATCH_POLICY_LOG_INTERVAL_MS = 60 * 60 * 1e3;
4247
4544
  var SCRATCH_HOLD_LIFT_DELAY_MS = 10 * 60 * 1e3;
4248
4545
  var SCRATCH_HOLD_MAX_OBSERVATION_GAP_MS = 5 * 60 * 1e3;
@@ -4273,7 +4570,7 @@ function resolveScratchSweepPolicy(input) {
4273
4570
  note(input, "kept=all reason=invalid-agent-id");
4274
4571
  return HELD;
4275
4572
  }
4276
- const marker = join11(input.holdsDir, input.agentId);
4573
+ const marker = join12(input.holdsDir, input.agentId);
4277
4574
  if (unrecordedHolds.has(input.agentId) || input.flag("scratch-sweep-held", input.agentId)) {
4278
4575
  mkdirSync6(input.holdsDir, { recursive: true });
4279
4576
  writeFileSync5(marker, HELD_MARKER);
@@ -4288,7 +4585,7 @@ function resolveScratchSweepPolicy(input) {
4288
4585
  return HELD;
4289
4586
  }
4290
4587
  const now = (input.now ?? Date.now)();
4291
- const off = OFF_SINCE.exec(readFileSync11(marker, "utf8"));
4588
+ const off = OFF_SINCE.exec(readFileSync12(marker, "utf8"));
4292
4589
  if (!off) {
4293
4590
  writeFileSync5(marker, offSince(now, now));
4294
4591
  return HELD;
@@ -4341,7 +4638,7 @@ function recordScratchHoldsFromHeartbeat(input) {
4341
4638
  let held = false;
4342
4639
  try {
4343
4640
  held = input.flag("scratch-sweep-held", id);
4344
- const marker = join11(input.holdsDir, id);
4641
+ const marker = join12(input.holdsDir, id);
4345
4642
  if (held) {
4346
4643
  mkdirSync6(input.holdsDir, { recursive: true });
4347
4644
  writeFileSync5(marker, HELD_MARKER);
@@ -4349,7 +4646,7 @@ function recordScratchHoldsFromHeartbeat(input) {
4349
4646
  continue;
4350
4647
  }
4351
4648
  if (!existsSync3(marker)) continue;
4352
- const off = OFF_SINCE.exec(readFileSync11(marker, "utf8"));
4649
+ const off = OFF_SINCE.exec(readFileSync12(marker, "utf8"));
4353
4650
  if (!off) continue;
4354
4651
  const since = Number(off[1]);
4355
4652
  const seen = Number(off[2] ?? off[1]);
@@ -4366,7 +4663,7 @@ function recordScratchHoldsFromHeartbeat(input) {
4366
4663
  if (!safe(id) || evaluated.has(id)) continue;
4367
4664
  try {
4368
4665
  mkdirSync6(input.holdsDir, { recursive: true });
4369
- writeFileSync5(join11(input.holdsDir, id), HELD_MARKER);
4666
+ writeFileSync5(join12(input.holdsDir, id), HELD_MARKER);
4370
4667
  } catch (err) {
4371
4668
  unrecordedHolds.add(id);
4372
4669
  const code = err?.code ?? "unknown";
@@ -4378,7 +4675,7 @@ function recordScratchHoldsFromHeartbeat(input) {
4378
4675
 
4379
4676
  // src/lib/id-keyed-migration.ts
4380
4677
  import { existsSync as existsSync4, lstatSync as lstatSync3, readlinkSync, renameSync as renameSync2 } from "fs";
4381
- import { join as join12 } from "path";
4678
+ import { join as join13 } from "path";
4382
4679
  import { homedir as homedir3 } from "os";
4383
4680
  var ID_KEYED_MIGRATION_FLAG = "id-keyed-layout-migration";
4384
4681
  function agentHasActiveWhatsapp(channelConfigs, codeNameDir) {
@@ -4386,7 +4683,7 @@ function agentHasActiveWhatsapp(channelConfigs, codeNameDir) {
4386
4683
  return true;
4387
4684
  }
4388
4685
  try {
4389
- if (existsSync4(join12(codeNameDir, "whatsapp-pending-inbound"))) return true;
4686
+ if (existsSync4(join13(codeNameDir, "whatsapp-pending-inbound"))) return true;
4390
4687
  } catch {
4391
4688
  }
4392
4689
  return false;
@@ -4418,10 +4715,10 @@ function finishTranscriptMove(oldCwd, newCwd, codeName, log2) {
4418
4715
  function maybeMigrateAgentToIdKeyedLayout(agent, deps) {
4419
4716
  const home = deps.home ?? homedir3();
4420
4717
  const { code_name: codeName, agent_id: agentId } = agent;
4421
- const codeNamePath = join12(home, ".augmented", codeName);
4422
- const idPath = join12(home, ".augmented", agentId);
4423
- const oldCwd = join12(home, ".augmented", codeName, "project");
4424
- const newCwd = join12(idPath, "project");
4718
+ const codeNamePath = join13(home, ".augmented", codeName);
4719
+ const idPath = join13(home, ".augmented", agentId);
4720
+ const oldCwd = join13(home, ".augmented", codeName, "project");
4721
+ const newCwd = join13(idPath, "project");
4425
4722
  let codeNameKind;
4426
4723
  try {
4427
4724
  codeNameKind = lstatSync3(codeNamePath).isSymbolicLink() ? "symlink" : "realdir";
@@ -4720,8 +5017,8 @@ function collectEnvGates(env) {
4720
5017
  }
4721
5018
 
4722
5019
  // ../../packages/core/dist/direct-chat/cursor-advance-telemetry.js
4723
- import { readFileSync as readFileSync12, writeFileSync as writeFileSync6 } from "fs";
4724
- import { join as join13 } from "path";
5020
+ import { readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
5021
+ import { join as join14 } from "path";
4725
5022
  var CURSOR_SHORTFALL_COUNTER_SUFFIX = "-cursor-advance-classifications.json";
4726
5023
  function recordCursorAdvanceOutcome(agentDir, source, route, verdict) {
4727
5024
  if (!agentDir)
@@ -4729,10 +5026,10 @@ function recordCursorAdvanceOutcome(agentDir, source, route, verdict) {
4729
5026
  const key = cursorAdvanceCounterKey(route, verdict);
4730
5027
  if (key === null)
4731
5028
  return;
4732
- const path = join13(agentDir, `${source}${CURSOR_SHORTFALL_COUNTER_SUFFIX}`);
5029
+ const path = join14(agentDir, `${source}${CURSOR_SHORTFALL_COUNTER_SUFFIX}`);
4733
5030
  const counts = {};
4734
5031
  try {
4735
- const parsed = JSON.parse(readFileSync12(path, "utf-8"));
5032
+ const parsed = JSON.parse(readFileSync13(path, "utf-8"));
4736
5033
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
4737
5034
  for (const [k, v] of Object.entries(parsed)) {
4738
5035
  if (typeof v === "number" && Number.isInteger(v) && v >= 0)
@@ -4749,7 +5046,7 @@ function recordCursorAdvanceOutcome(agentDir, source, route, verdict) {
4749
5046
  }
4750
5047
 
4751
5048
  // src/lib/artifact-stream.ts
4752
- import { join as join14 } from "path";
5049
+ import { join as join15 } from "path";
4753
5050
  import { homedir as homedir4 } from "os";
4754
5051
  import { readdir, stat, readFile } from "fs/promises";
4755
5052
  var ARTEFACT_ENTRY_FILE = "index.html";
@@ -4835,7 +5132,7 @@ var ArtifactStreamScanner = class {
4835
5132
  return;
4836
5133
  }
4837
5134
  for (const name of names) {
4838
- const file = join14(this.artifactsDir, name, ARTEFACT_ENTRY_FILE);
5135
+ const file = join15(this.artifactsDir, name, ARTEFACT_ENTRY_FILE);
4839
5136
  const mtime = await this.fsDeps.mtimeMs(file).catch(() => null);
4840
5137
  if (mtime === null) continue;
4841
5138
  if (this.seenMtime.get(name) === mtime) continue;
@@ -4866,7 +5163,7 @@ var ArtifactStreamScanner = class {
4866
5163
  }
4867
5164
  };
4868
5165
  function artifactsDirFor(codeName) {
4869
- return join14(homedir4(), ".augmented", codeName, "artifacts");
5166
+ return join15(homedir4(), ".augmented", codeName, "artifacts");
4870
5167
  }
4871
5168
  var nodeArtifactFs = {
4872
5169
  async listArtefactNames(artifactsDir) {
@@ -5142,12 +5439,12 @@ async function maybePollHostUsage(deps) {
5142
5439
  import { createHash as createHash7 } from "crypto";
5143
5440
  import { readFile as readFile3, readdir as readdir3 } from "fs/promises";
5144
5441
  import { homedir as homedir6, platform as platform2 } from "os";
5145
- import { dirname as dirname6, join as join16 } from "path";
5442
+ import { dirname as dirname6, join as join17 } from "path";
5146
5443
 
5147
5444
  // src/lib/claude-auth-detect.ts
5148
5445
  import { readFile as readFile2, readdir as readdir2 } from "fs/promises";
5149
5446
  import { homedir as homedir5, platform } from "os";
5150
- import { join as join15 } from "path";
5447
+ import { join as join16 } from "path";
5151
5448
  import { execFile } from "child_process";
5152
5449
  import { promisify } from "util";
5153
5450
  var execFileAsync = promisify(execFile);
@@ -5162,16 +5459,16 @@ async function detectClaudeAuth() {
5162
5459
  }
5163
5460
  async function findClaudeCredentialsPaths() {
5164
5461
  const candidates = [
5165
- join15(homedir5(), ".claude", ".credentials.json"),
5166
- join15(homedir5(), ".claude", "credentials.json")
5462
+ join16(homedir5(), ".claude", ".credentials.json"),
5463
+ join16(homedir5(), ".claude", "credentials.json")
5167
5464
  ];
5168
5465
  const isLinuxRoot = platform() === "linux" && typeof process.getuid === "function" && process.getuid() === 0;
5169
5466
  if (isLinuxRoot) {
5170
5467
  try {
5171
5468
  const entries = await readdir2("/home", { withFileTypes: true });
5172
5469
  for (const entry of entries.filter((entry2) => entry2.isDirectory()).sort((a, b) => a.name.localeCompare(b.name))) {
5173
- candidates.push(join15("/home", entry.name, ".claude", ".credentials.json"));
5174
- candidates.push(join15("/home", entry.name, ".claude", "credentials.json"));
5470
+ candidates.push(join16("/home", entry.name, ".claude", ".credentials.json"));
5471
+ candidates.push(join16("/home", entry.name, ".claude", "credentials.json"));
5175
5472
  }
5176
5473
  } catch {
5177
5474
  }
@@ -5255,7 +5552,7 @@ async function candidateHomes() {
5255
5552
  try {
5256
5553
  const entries = await readdir3("/home", { withFileTypes: true });
5257
5554
  for (const entry of entries.filter((e) => e.isDirectory()).sort((a, b) => a.name.localeCompare(b.name))) {
5258
- homes.push(join16("/home", entry.name));
5555
+ homes.push(join17("/home", entry.name));
5259
5556
  }
5260
5557
  } catch {
5261
5558
  }
@@ -5275,11 +5572,11 @@ async function homeOfActiveCredentials() {
5275
5572
  async function claudeConfigCandidatePaths() {
5276
5573
  const paths = [];
5277
5574
  const configDir = process.env["CLAUDE_CONFIG_DIR"]?.trim();
5278
- if (configDir) paths.push(join16(configDir, ".claude.json"));
5575
+ if (configDir) paths.push(join17(configDir, ".claude.json"));
5279
5576
  const activeHome = await homeOfActiveCredentials();
5280
- if (activeHome) paths.push(join16(activeHome, ".claude.json"));
5577
+ if (activeHome) paths.push(join17(activeHome, ".claude.json"));
5281
5578
  for (const home of await candidateHomes()) {
5282
- const path = join16(home, ".claude.json");
5579
+ const path = join17(home, ".claude.json");
5283
5580
  if (!paths.includes(path)) paths.push(path);
5284
5581
  }
5285
5582
  return paths;
@@ -5445,9 +5742,9 @@ function diffAuthTuples(recorded, current) {
5445
5742
  // src/lib/account-enforcement-marker.ts
5446
5743
  import { mkdirSync as mkdirSync7, renameSync as renameSync3, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "fs";
5447
5744
  import { homedir as homedir7 } from "os";
5448
- import { join as join17 } from "path";
5745
+ import { join as join18 } from "path";
5449
5746
  function accountEnforcementMarkerPath(codeName) {
5450
- return join17(homedir7(), ".augmented", codeName, ACCOUNT_ENFORCEMENT_MARKER_FILENAME);
5747
+ return join18(homedir7(), ".augmented", codeName, ACCOUNT_ENFORCEMENT_MARKER_FILENAME);
5451
5748
  }
5452
5749
  function syncAccountEnforcementMarker(codeName, level, log2 = (m) => process.stderr.write(`${m}
5453
5750
  `), text) {
@@ -5455,8 +5752,8 @@ function syncAccountEnforcementMarker(codeName, level, log2 = (m) => process.std
5455
5752
  clearAccountEnforcementMarker(codeName, log2);
5456
5753
  return;
5457
5754
  }
5458
- const dir = join17(homedir7(), ".augmented", codeName);
5459
- const path = join17(dir, ACCOUNT_ENFORCEMENT_MARKER_FILENAME);
5755
+ const dir = join18(homedir7(), ".augmented", codeName);
5756
+ const path = join18(dir, ACCOUNT_ENFORCEMENT_MARKER_FILENAME);
5460
5757
  const tempPath = `${path}.${process.pid}.tmp`;
5461
5758
  try {
5462
5759
  mkdirSync7(dir, { recursive: true });
@@ -5481,8 +5778,8 @@ function clearAccountEnforcementMarker(codeName, log2 = (m) => process.stderr.wr
5481
5778
  }
5482
5779
 
5483
5780
  // src/lib/token-usage-monitor.ts
5484
- import { readdirSync, readFileSync as readFileSync13, statSync } from "fs";
5485
- import { join as join18 } from "path";
5781
+ import { readdirSync as readdirSync2, readFileSync as readFileSync14, statSync } from "fs";
5782
+ import { join as join19 } from "path";
5486
5783
  var MIN_CHECK_INTERVAL_MS2 = 6e4;
5487
5784
  var TRANSCRIPT_MTIME_WINDOW_MS = 2 * 24 * 60 * 60 * 1e3;
5488
5785
  var MAX_ENTRIES_PER_POST = 200;
@@ -5500,7 +5797,7 @@ async function maybeReportTokenUsage(args) {
5500
5797
  const next = { files, lastCheckedAt: nowMs };
5501
5798
  let dirEntries;
5502
5799
  try {
5503
- dirEntries = readdirSync(dir);
5800
+ dirEntries = readdirSync2(dir);
5504
5801
  } catch {
5505
5802
  state3.set(codeName, next);
5506
5803
  return;
@@ -5511,7 +5808,7 @@ async function maybeReportTokenUsage(args) {
5511
5808
  if (!name.endsWith(".jsonl")) continue;
5512
5809
  const sessionId = name.slice(0, -".jsonl".length);
5513
5810
  if (!sessionId) continue;
5514
- const path = join18(dir, name);
5811
+ const path = join19(dir, name);
5515
5812
  let st;
5516
5813
  try {
5517
5814
  st = statSync(path);
@@ -5527,7 +5824,7 @@ async function maybeReportTokenUsage(args) {
5527
5824
  }
5528
5825
  let content;
5529
5826
  try {
5530
- content = readFileSync13(path, "utf-8");
5827
+ content = readFileSync14(path, "utf-8");
5531
5828
  } catch (err) {
5532
5829
  log2(`[token-usage] read failed for '${codeName}/${name}': ${err.message}`);
5533
5830
  continue;
@@ -5608,8 +5905,8 @@ async function maybeReportTokenUsage(args) {
5608
5905
  }
5609
5906
 
5610
5907
  // src/lib/failing-turn-monitor.ts
5611
- import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync2, readSync, statSync as statSync2 } from "fs";
5612
- import { join as join19 } from "path";
5908
+ import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync3, readSync, statSync as statSync2 } from "fs";
5909
+ import { join as join20 } from "path";
5613
5910
  var MIN_CHECK_INTERVAL_MS3 = 3e4;
5614
5911
  var FAILING_TURN_TAIL_BYTES = 512 * 1024;
5615
5912
  var ACTIVE_TRANSCRIPT_WINDOW_MS = 60 * 60 * 1e3;
@@ -5634,14 +5931,14 @@ function failingTurnMaxMs() {
5634
5931
  function newestActiveTranscript(dir, nowMs) {
5635
5932
  let names;
5636
5933
  try {
5637
- names = readdirSync2(dir);
5934
+ names = readdirSync3(dir);
5638
5935
  } catch {
5639
5936
  return null;
5640
5937
  }
5641
5938
  let best = null;
5642
5939
  for (const name of names) {
5643
5940
  if (!name.endsWith(".jsonl")) continue;
5644
- const path = join19(dir, name);
5941
+ const path = join20(dir, name);
5645
5942
  try {
5646
5943
  const st = statSync2(path);
5647
5944
  if (!st.isFile() || nowMs - st.mtimeMs > ACTIVE_TRANSCRIPT_WINDOW_MS) continue;
@@ -5713,8 +6010,8 @@ function failingTurnLoops(now = Date.now(), threshold = failingTurnThreshold(),
5713
6010
  }
5714
6011
 
5715
6012
  // src/lib/session-activity.ts
5716
- import { closeSync as closeSync3, openSync as openSync3, readFileSync as readFileSync14, readSync as readSync2, readdirSync as readdirSync3, statSync as statSync3 } from "fs";
5717
- import { join as join20 } from "path";
6013
+ import { closeSync as closeSync3, openSync as openSync3, readFileSync as readFileSync15, readSync as readSync2, readdirSync as readdirSync4, statSync as statSync3 } from "fs";
6014
+ import { join as join21 } from "path";
5718
6015
  var RULE = /^[─━]{10,}/;
5719
6016
  var CARET_LINE = /^\s*❯(\s|$)/;
5720
6017
  var NON_BLOCKING_PICKER = { title: "We recommend compacting earlier", footer: "esc not now", kind: "compaction-suggestion" };
@@ -5767,14 +6064,14 @@ function noteLiveSession(codeName, liveId) {
5767
6064
  function newestTranscript(dir) {
5768
6065
  let names;
5769
6066
  try {
5770
- names = readdirSync3(dir);
6067
+ names = readdirSync4(dir);
5771
6068
  } catch {
5772
6069
  return null;
5773
6070
  }
5774
6071
  let best = null;
5775
6072
  for (const name of names) {
5776
6073
  if (!name.endsWith(".jsonl")) continue;
5777
- const path = join20(dir, name);
6074
+ const path = join21(dir, name);
5778
6075
  try {
5779
6076
  const st = statSync3(path);
5780
6077
  if (st.isFile() && (best === null || st.mtimeMs > best.mtimeMs)) {
@@ -5788,7 +6085,7 @@ function newestTranscript(dir) {
5788
6085
  }
5789
6086
  function sessionTranscript(dir, sessionId) {
5790
6087
  if (!sessionId) return newestTranscript(dir);
5791
- const path = join20(dir, `${sessionId}.jsonl`);
6088
+ const path = join21(dir, `${sessionId}.jsonl`);
5792
6089
  try {
5793
6090
  const st = statSync3(path);
5794
6091
  return st.isFile() ? { path, mtimeMs: st.mtimeMs, size: st.size } : null;
@@ -5869,14 +6166,14 @@ function scanNewLines(path, size, scan, budget, log2) {
5869
6166
  function subagentFiles(dir) {
5870
6167
  let names;
5871
6168
  try {
5872
- names = readdirSync3(dir);
6169
+ names = readdirSync4(dir);
5873
6170
  } catch (err) {
5874
6171
  if (err.code === "ENOENT") return [];
5875
6172
  throw err;
5876
6173
  }
5877
6174
  return names.flatMap((name) => {
5878
6175
  if (!name.endsWith(".jsonl")) return [];
5879
- const path = join20(dir, name);
6176
+ const path = join21(dir, name);
5880
6177
  try {
5881
6178
  const st = statSync3(path);
5882
6179
  return st.isFile() ? [{ path, mtimeMs: st.mtimeMs, size: st.size }] : [];
@@ -5890,7 +6187,7 @@ function knownProcessStartMs(session) {
5890
6187
  return session.startedAt === session.estimatedStartedAt ? null : session.startedAt;
5891
6188
  }
5892
6189
  function drainScan(scan, dir, log2) {
5893
- const main = join20(dir, `${scan.sessionId}.jsonl`);
6190
+ const main = join21(dir, `${scan.sessionId}.jsonl`);
5894
6191
  let budget = BACKGROUND_SCAN_BYTES_PER_POLL;
5895
6192
  try {
5896
6193
  budget -= scanNewLines(main, statSync3(main).size, scan, budget, log2);
@@ -5907,7 +6204,7 @@ function readBackgroundActivity(codeName, dir, sessionId, spawnedAtMs, isSpawnSe
5907
6204
  const sameRun = prev?.sessionId === sessionId && prev.spawnedAtMs === spawnedAtMs;
5908
6205
  if (prev && sameRun && minCheckMs > 0 && nowMs - prev.checkedAt < minCheckMs) return prev;
5909
6206
  try {
5910
- const main = join20(dir, `${sessionId}.jsonl`);
6207
+ const main = join21(dir, `${sessionId}.jsonl`);
5911
6208
  let size;
5912
6209
  try {
5913
6210
  size = statSync3(main).size;
@@ -5955,7 +6252,7 @@ function readBackgroundActivity(codeName, dir, sessionId, spawnedAtMs, isSpawnSe
5955
6252
  }
5956
6253
  function readRecordedSession(agentDir) {
5957
6254
  try {
5958
- const parsed = JSON.parse(readFileSync14(join20(agentDir, "session-state.json"), "utf-8"));
6255
+ const parsed = JSON.parse(readFileSync15(join21(agentDir, "session-state.json"), "utf-8"));
5959
6256
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
5960
6257
  const { session_id: sessionId, recorded_at: recordedAtMs } = parsed;
5961
6258
  if (typeof sessionId !== "string" || typeof recordedAtMs !== "number" || !Number.isFinite(recordedAtMs)) return null;
@@ -6047,8 +6344,8 @@ function buildSessionActivityReport(args) {
6047
6344
  }
6048
6345
 
6049
6346
  // src/lib/workflow-run-reconciler.ts
6050
- import { readdirSync as readdirSync4, readFileSync as readFileSync15, statSync as statSync4 } from "fs";
6051
- import { join as join21 } from "path";
6347
+ import { readdirSync as readdirSync5, readFileSync as readFileSync16, statSync as statSync4 } from "fs";
6348
+ import { join as join22 } from "path";
6052
6349
  var MIN_CHECK_INTERVAL_MS4 = 5 * 6e4;
6053
6350
  var SETTLE_MS = 3e4;
6054
6351
  var TRANSCRIPT_MTIME_WINDOW_MS2 = 2 * 24 * 60 * 60 * 1e3;
@@ -6082,12 +6379,12 @@ function collectJsonlRecursive(dir, minMtimeMs, out, depth) {
6082
6379
  if (depth > MAX_SUBAGENT_DEPTH) return;
6083
6380
  let entries;
6084
6381
  try {
6085
- entries = readdirSync4(dir);
6382
+ entries = readdirSync5(dir);
6086
6383
  } catch {
6087
6384
  return;
6088
6385
  }
6089
6386
  for (const name of entries) {
6090
- const p = join21(dir, name);
6387
+ const p = join22(dir, name);
6091
6388
  let st;
6092
6389
  try {
6093
6390
  st = statSync4(p);
@@ -6105,12 +6402,12 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
6105
6402
  const out = [];
6106
6403
  let entries;
6107
6404
  try {
6108
- entries = readdirSync4(transcriptDir);
6405
+ entries = readdirSync5(transcriptDir);
6109
6406
  } catch {
6110
6407
  return out;
6111
6408
  }
6112
6409
  for (const name of entries) {
6113
- const path = join21(transcriptDir, name);
6410
+ const path = join22(transcriptDir, name);
6114
6411
  let st;
6115
6412
  try {
6116
6413
  st = statSync4(path);
@@ -6122,7 +6419,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
6122
6419
  continue;
6123
6420
  }
6124
6421
  if (st.isDirectory()) {
6125
- collectJsonlRecursive(join21(path, "subagents"), minMtimeMs, out, 0);
6422
+ collectJsonlRecursive(join22(path, "subagents"), minMtimeMs, out, 0);
6126
6423
  }
6127
6424
  }
6128
6425
  return out;
@@ -6166,7 +6463,7 @@ async function maybeReconcileWorkflowRunTokens(args) {
6166
6463
  const contents = [];
6167
6464
  for (const path of files) {
6168
6465
  try {
6169
- contents.push(readFileSync15(path, "utf-8"));
6466
+ contents.push(readFileSync16(path, "utf-8"));
6170
6467
  } catch {
6171
6468
  }
6172
6469
  }
@@ -6211,8 +6508,8 @@ async function maybeReconcileWorkflowRunTokens(args) {
6211
6508
  }
6212
6509
 
6213
6510
  // src/lib/conversation-evaluator.ts
6214
- import { readdirSync as readdirSync5, readFileSync as readFileSync16, statSync as statSync5 } from "fs";
6215
- import { join as join22 } from "path";
6511
+ import { readdirSync as readdirSync6, readFileSync as readFileSync17, statSync as statSync5 } from "fs";
6512
+ import { join as join23 } from "path";
6216
6513
 
6217
6514
  // src/lib/detect-meta-egress.ts
6218
6515
  var REPOST_PREAMBLE_WINDOW = 200;
@@ -6692,12 +6989,12 @@ function readRecentTurns(dir, nowMs) {
6692
6989
  const visit = (d) => {
6693
6990
  let entries;
6694
6991
  try {
6695
- entries = readdirSync5(d, { withFileTypes: true });
6992
+ entries = readdirSync6(d, { withFileTypes: true });
6696
6993
  } catch {
6697
6994
  return;
6698
6995
  }
6699
6996
  for (const ent of entries) {
6700
- const full = join22(d, ent.name);
6997
+ const full = join23(d, ent.name);
6701
6998
  if (ent.isDirectory()) {
6702
6999
  visit(full);
6703
7000
  continue;
@@ -6712,7 +7009,7 @@ function readRecentTurns(dir, nowMs) {
6712
7009
  if (nowMs - mtimeMs > TRANSCRIPT_MTIME_WINDOW_MS3) continue;
6713
7010
  let content;
6714
7011
  try {
6715
- content = readFileSync16(full, "utf8");
7012
+ content = readFileSync17(full, "utf8");
6716
7013
  } catch {
6717
7014
  continue;
6718
7015
  }
@@ -7085,22 +7382,22 @@ async function reportSkip2(api2, agentId, conversationId, log2, codeName) {
7085
7382
 
7086
7383
  // src/lib/tool-call-audit.ts
7087
7384
  import { homedir as homedir11 } from "os";
7088
- import { join as join27 } from "path";
7385
+ import { join as join28 } from "path";
7089
7386
 
7090
7387
  // src/lib/agent-logging-mode.ts
7091
- import { readFileSync as readFileSync17 } from "fs";
7388
+ import { readFileSync as readFileSync18 } from "fs";
7092
7389
  import { homedir as homedir8 } from "os";
7093
- import { join as join23 } from "path";
7390
+ import { join as join24 } from "path";
7094
7391
  var LOGGING_MODES = ["hash-only", "redacted", "full-local"];
7095
7392
  function charterPath(codeName, homeDir) {
7096
7393
  const home = homeDir ?? (process.env["HOME"]?.trim() || homedir8());
7097
7394
  const key = agentRuntimeKey(codeName, homeDir);
7098
- return join23(home, ".augmented", key, "provision", "CHARTER.md");
7395
+ return join24(home, ".augmented", key, "provision", "CHARTER.md");
7099
7396
  }
7100
7397
  function readAgentLoggingMode(codeName, homeDir) {
7101
7398
  let raw;
7102
7399
  try {
7103
- raw = readFileSync17(charterPath(codeName, homeDir), "utf-8");
7400
+ raw = readFileSync18(charterPath(codeName, homeDir), "utf-8");
7104
7401
  } catch {
7105
7402
  return { mode: null, reason: "no-charter" };
7106
7403
  }
@@ -7124,15 +7421,15 @@ function loggingModeWithholdsTargets(reading) {
7124
7421
 
7125
7422
  // src/lib/tool-call-path-salt.ts
7126
7423
  import { randomBytes } from "crypto";
7127
- import { existsSync as existsSync5, mkdirSync as mkdirSync8, readFileSync as readFileSync18, renameSync as renameSync4, unlinkSync as unlinkSync2, writeFileSync as writeFileSync8 } from "fs";
7424
+ import { existsSync as existsSync5, mkdirSync as mkdirSync8, readFileSync as readFileSync19, renameSync as renameSync4, unlinkSync as unlinkSync2, writeFileSync as writeFileSync8 } from "fs";
7128
7425
  import { homedir as homedir9 } from "os";
7129
- import { dirname as dirname7, join as join24 } from "path";
7426
+ import { dirname as dirname7, join as join25 } from "path";
7130
7427
  var SALT_BYTES = 32;
7131
7428
  var SALT_RE = /^[0-9a-f]{64}$/;
7132
7429
  function pathSaltPath(codeName, homeDir) {
7133
7430
  const home = homeDir ?? (process.env["HOME"]?.trim() || homedir9());
7134
7431
  const key = agentRuntimeKey(codeName, homeDir);
7135
- return join24(home, ".augmented", key, "tool-call-path-salt");
7432
+ return join25(home, ".augmented", key, "tool-call-path-salt");
7136
7433
  }
7137
7434
  function readToolCallPathSalt(codeName, homeDir) {
7138
7435
  let file;
@@ -7143,7 +7440,7 @@ function readToolCallPathSalt(codeName, homeDir) {
7143
7440
  }
7144
7441
  try {
7145
7442
  if (existsSync5(file)) {
7146
- const existing = readFileSync18(file, "utf-8").trim();
7443
+ const existing = readFileSync19(file, "utf-8").trim();
7147
7444
  if (SALT_RE.test(existing)) return existing;
7148
7445
  }
7149
7446
  } catch {
@@ -7169,8 +7466,8 @@ function readToolCallPathSalt(codeName, homeDir) {
7169
7466
  import { statSync as statSync6 } from "fs";
7170
7467
 
7171
7468
  // src/lib/tool-call-extractor.ts
7172
- import { closeSync as closeSync4, fstatSync as fstatSync2, openSync as openSync4, readFileSync as readFileSync19, readSync as readSync3, readdirSync as readdirSync6 } from "fs";
7173
- import { basename as basename2, join as join25, relative } from "path";
7469
+ import { closeSync as closeSync4, fstatSync as fstatSync2, openSync as openSync4, readFileSync as readFileSync20, readSync as readSync3, readdirSync as readdirSync7 } from "fs";
7470
+ import { basename as basename3, join as join26, relative } from "path";
7174
7471
  import { StringDecoder } from "string_decoder";
7175
7472
 
7176
7473
  // src/lib/tool-call-redaction.ts
@@ -7299,7 +7596,7 @@ function redactToolTargetInner(toolName, input, ctx) {
7299
7596
  var EXTRACTOR_VERSION = "e1";
7300
7597
  function enumerateSessionTranscripts(transcriptDir, sessionId, projectsRoot) {
7301
7598
  const files = [];
7302
- const mainAbs = join25(transcriptDir, `${sessionId}.jsonl`);
7599
+ const mainAbs = join26(transcriptDir, `${sessionId}.jsonl`);
7303
7600
  files.push({
7304
7601
  absPath: mainAbs,
7305
7602
  relPath: relative(projectsRoot, mainAbs),
@@ -7307,17 +7604,17 @@ function enumerateSessionTranscripts(transcriptDir, sessionId, projectsRoot) {
7307
7604
  isSubagent: false,
7308
7605
  subagentId: null
7309
7606
  });
7310
- const subDir = join25(transcriptDir, sessionId, "subagents");
7607
+ const subDir = join26(transcriptDir, sessionId, "subagents");
7311
7608
  let entries;
7312
7609
  try {
7313
- entries = readdirSync6(subDir);
7610
+ entries = readdirSync7(subDir);
7314
7611
  } catch {
7315
7612
  return files;
7316
7613
  }
7317
7614
  for (const name of entries) {
7318
7615
  if (!name.endsWith(".jsonl")) continue;
7319
- const abs = join25(subDir, name);
7320
- const stem = basename2(name, ".jsonl");
7616
+ const abs = join26(subDir, name);
7617
+ const stem = basename3(name, ".jsonl");
7321
7618
  files.push({
7322
7619
  absPath: abs,
7323
7620
  relPath: relative(projectsRoot, abs),
@@ -7514,9 +7811,9 @@ function extractTranscriptWindow(file, opts, from) {
7514
7811
  }
7515
7812
 
7516
7813
  // src/lib/tool-call-cursor.ts
7517
- import { existsSync as existsSync6, readFileSync as readFileSync20 } from "fs";
7814
+ import { existsSync as existsSync6, readFileSync as readFileSync21 } from "fs";
7518
7815
  import { homedir as homedir10 } from "os";
7519
- import { join as join26 } from "path";
7816
+ import { join as join27 } from "path";
7520
7817
  var COVERAGE_DISPOSITIONS = [
7521
7818
  "ok",
7522
7819
  "not_entitled",
@@ -7571,13 +7868,13 @@ function parseCursorKey(key) {
7571
7868
  function cursorStatePath(codeName, homeDir) {
7572
7869
  const home = homeDir ?? (process.env["HOME"]?.trim() || homedir10());
7573
7870
  const key = agentRuntimeKey(codeName, homeDir);
7574
- return join26(home, ".augmented", key, "tool-call-cursors.json");
7871
+ return join27(home, ".augmented", key, "tool-call-cursors.json");
7575
7872
  }
7576
7873
  function loadCursors(path) {
7577
7874
  const out = /* @__PURE__ */ new Map();
7578
7875
  if (!existsSync6(path)) return out;
7579
7876
  try {
7580
- const parsed = JSON.parse(readFileSync20(path, "utf-8"));
7877
+ const parsed = JSON.parse(readFileSync21(path, "utf-8"));
7581
7878
  if (!parsed || parsed.version !== 1 || typeof parsed.files !== "object") return out;
7582
7879
  for (const [k, v] of Object.entries(parsed.files)) {
7583
7880
  if (!v || typeof v !== "object") continue;
@@ -7984,7 +8281,7 @@ async function maybeScanToolCalls(args) {
7984
8281
  log2(`[tool-call-audit] ${codeName}: no path-hash salt available \u2014 file targets withheld`);
7985
8282
  }
7986
8283
  const home = args.homeDir ?? (process.env["HOME"]?.trim() || homedir11());
7987
- const projectsRoot = args.projectsRoot ?? join27(home, ".claude", "projects");
8284
+ const projectsRoot = args.projectsRoot ?? join28(home, ".claude", "projects");
7988
8285
  const transcriptDir = args.transcriptDir ?? sessionTranscriptDir(getProjectDir(codeName));
7989
8286
  const current = peekCurrentSession(codeName);
7990
8287
  const sessionIds = current ? [current.sessionId] : [];
@@ -8013,11 +8310,11 @@ async function maybeScanToolCalls(args) {
8013
8310
  }
8014
8311
 
8015
8312
  // src/lib/activity-cache-monitor.ts
8016
- import { existsSync as existsSync7, readFileSync as readFileSync21 } from "fs";
8313
+ import { existsSync as existsSync7, readFileSync as readFileSync22 } from "fs";
8017
8314
  import { homedir as homedir12 } from "os";
8018
- import { join as join28 } from "path";
8315
+ import { join as join29 } from "path";
8019
8316
  var MIN_CHECK_INTERVAL_MS8 = 6e4;
8020
- var STATS_CACHE_PATH = join28(homedir12(), ".claude", "stats-cache.json");
8317
+ var STATS_CACHE_PATH = join29(homedir12(), ".claude", "stats-cache.json");
8021
8318
  var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
8022
8319
  var state8 = { lastObservedDate: null, lastCheckedAt: 0 };
8023
8320
  function selectNewDailyRows(raw, lastObservedDate) {
@@ -8065,7 +8362,7 @@ async function maybeReportActivityCache(args) {
8065
8362
  }
8066
8363
  let raw;
8067
8364
  try {
8068
- raw = readFileSync21(STATS_CACHE_PATH, "utf-8");
8365
+ raw = readFileSync22(STATS_CACHE_PATH, "utf-8");
8069
8366
  } catch (err) {
8070
8367
  log2(`[activity-cache] readFileSync failed: ${err.message}`);
8071
8368
  return;
@@ -8387,15 +8684,15 @@ import { createHash as createHash10 } from "crypto";
8387
8684
  import {
8388
8685
  existsSync as existsSync8,
8389
8686
  mkdirSync as mkdirSync9,
8390
- readFileSync as readFileSync22,
8391
- readdirSync as readdirSync7,
8687
+ readFileSync as readFileSync23,
8688
+ readdirSync as readdirSync8,
8392
8689
  renameSync as renameSync5,
8393
8690
  rmSync as rmSync4,
8394
8691
  statSync as statSync8,
8395
8692
  utimesSync,
8396
8693
  writeFileSync as writeFileSync9
8397
8694
  } from "fs";
8398
- import { join as join29 } from "path";
8695
+ import { join as join30 } from "path";
8399
8696
  var KNOWLEDGE_FETCH_CHUNK = 100;
8400
8697
  var CACHE_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
8401
8698
  var SWEEP_INTERVAL_MS = 24 * 60 * 60 * 1e3;
@@ -8404,12 +8701,12 @@ function knowledgeHash(content) {
8404
8701
  return createHash10("sha256").update(content, "utf8").digest("hex");
8405
8702
  }
8406
8703
  function cachePath(cacheDir, hash) {
8407
- return join29(cacheDir, hash);
8704
+ return join30(cacheDir, hash);
8408
8705
  }
8409
8706
  function readCachedKnowledge(cacheDir, hash) {
8410
8707
  const path = cachePath(cacheDir, hash);
8411
8708
  try {
8412
- const content = readFileSync22(path, "utf-8");
8709
+ const content = readFileSync23(path, "utf-8");
8413
8710
  try {
8414
8711
  const now = /* @__PURE__ */ new Date();
8415
8712
  utimesSync(path, now, now);
@@ -8437,8 +8734,8 @@ function sweepKnowledgeCache(cacheDir, now = Date.now()) {
8437
8734
  lastSweepAt = now;
8438
8735
  try {
8439
8736
  if (!existsSync8(cacheDir)) return;
8440
- for (const name of readdirSync7(cacheDir)) {
8441
- const path = join29(cacheDir, name);
8737
+ for (const name of readdirSync8(cacheDir)) {
8738
+ const path = join30(cacheDir, name);
8442
8739
  try {
8443
8740
  if (now - statSync8(path).mtimeMs > CACHE_TTL_MS) rmSync4(path, { force: true });
8444
8741
  } catch {
@@ -8490,15 +8787,15 @@ import { createHash as createHash11 } from "crypto";
8490
8787
  import {
8491
8788
  existsSync as existsSync9,
8492
8789
  mkdirSync as mkdirSync10,
8493
- readFileSync as readFileSync23,
8494
- readdirSync as readdirSync8,
8790
+ readFileSync as readFileSync24,
8791
+ readdirSync as readdirSync9,
8495
8792
  renameSync as renameSync6,
8496
8793
  rmSync as rmSync5,
8497
8794
  statSync as statSync9,
8498
8795
  utimesSync as utimesSync2,
8499
8796
  writeFileSync as writeFileSync10
8500
8797
  } from "fs";
8501
- import { join as join30 } from "path";
8798
+ import { join as join31 } from "path";
8502
8799
  var MEMORY_FETCH_CHUNK = 100;
8503
8800
  var CACHE_TTL_MS2 = 30 * 24 * 60 * 60 * 1e3;
8504
8801
  var SWEEP_INTERVAL_MS2 = 24 * 60 * 60 * 1e3;
@@ -8507,12 +8804,12 @@ function memoryHash(content) {
8507
8804
  return createHash11("sha256").update(content, "utf8").digest("hex");
8508
8805
  }
8509
8806
  function cachePath2(cacheDir, hash) {
8510
- return join30(cacheDir, hash);
8807
+ return join31(cacheDir, hash);
8511
8808
  }
8512
8809
  function readCachedMemory(cacheDir, hash) {
8513
8810
  const path = cachePath2(cacheDir, hash);
8514
8811
  try {
8515
- const content = readFileSync23(path, "utf-8");
8812
+ const content = readFileSync24(path, "utf-8");
8516
8813
  try {
8517
8814
  const now = /* @__PURE__ */ new Date();
8518
8815
  utimesSync2(path, now, now);
@@ -8540,8 +8837,8 @@ function sweepMemoryCache(cacheDir, now = Date.now()) {
8540
8837
  lastSweepAt2.set(cacheDir, now);
8541
8838
  try {
8542
8839
  if (!existsSync9(cacheDir)) return;
8543
- for (const name of readdirSync8(cacheDir)) {
8544
- const path = join30(cacheDir, name);
8840
+ for (const name of readdirSync9(cacheDir)) {
8841
+ const path = join31(cacheDir, name);
8545
8842
  try {
8546
8843
  if (now - statSync9(path).mtimeMs > CACHE_TTL_MS2) rmSync5(path, { force: true });
8547
8844
  } catch {
@@ -8599,15 +8896,15 @@ import { createHash as createHash12 } from "crypto";
8599
8896
  import {
8600
8897
  existsSync as existsSync10,
8601
8898
  mkdirSync as mkdirSync11,
8602
- readFileSync as readFileSync24,
8603
- readdirSync as readdirSync9,
8899
+ readFileSync as readFileSync25,
8900
+ readdirSync as readdirSync10,
8604
8901
  renameSync as renameSync7,
8605
8902
  rmSync as rmSync6,
8606
8903
  statSync as statSync10,
8607
8904
  utimesSync as utimesSync3,
8608
8905
  writeFileSync as writeFileSync11
8609
8906
  } from "fs";
8610
- import { join as join31 } from "path";
8907
+ import { join as join32 } from "path";
8611
8908
  var SKILL_FETCH_CHUNK = 100;
8612
8909
  var CACHE_TTL_MS3 = 30 * 24 * 60 * 60 * 1e3;
8613
8910
  var SWEEP_INTERVAL_MS3 = 24 * 60 * 60 * 1e3;
@@ -8616,12 +8913,12 @@ function skillHash(content) {
8616
8913
  return createHash12("sha256").update(content, "utf8").digest("hex");
8617
8914
  }
8618
8915
  function cachePath3(cacheDir, hash) {
8619
- return join31(cacheDir, hash);
8916
+ return join32(cacheDir, hash);
8620
8917
  }
8621
8918
  function readCachedSkill(cacheDir, hash) {
8622
8919
  const path = cachePath3(cacheDir, hash);
8623
8920
  try {
8624
- const content = readFileSync24(path, "utf-8");
8921
+ const content = readFileSync25(path, "utf-8");
8625
8922
  try {
8626
8923
  const now = /* @__PURE__ */ new Date();
8627
8924
  utimesSync3(path, now, now);
@@ -8649,8 +8946,8 @@ function sweepSkillCache(cacheDir, now = Date.now()) {
8649
8946
  lastSweepAt3 = now;
8650
8947
  try {
8651
8948
  if (!existsSync10(cacheDir)) return;
8652
- for (const name of readdirSync9(cacheDir)) {
8653
- const path = join31(cacheDir, name);
8949
+ for (const name of readdirSync10(cacheDir)) {
8950
+ const path = join32(cacheDir, name);
8654
8951
  try {
8655
8952
  if (now - statSync10(path).mtimeMs > CACHE_TTL_MS3) rmSync6(path, { force: true });
8656
8953
  } catch {
@@ -8979,18 +9276,18 @@ function resolveConditionalResponse(wire, hasCachedBody) {
8979
9276
  }
8980
9277
 
8981
9278
  // src/lib/channel-hash-cache.ts
8982
- import { existsSync as existsSync11, readFileSync as readFileSync25, writeFileSync as writeFileSync12 } from "fs";
8983
- import { join as join32 } from "path";
9279
+ import { existsSync as existsSync11, readFileSync as readFileSync26, writeFileSync as writeFileSync12 } from "fs";
9280
+ import { join as join33 } from "path";
8984
9281
  var CACHE_FILENAME = "channel-hash-cache.json";
8985
9282
  function getChannelHashCacheFile(configDir) {
8986
- return join32(configDir, CACHE_FILENAME);
9283
+ return join33(configDir, CACHE_FILENAME);
8987
9284
  }
8988
9285
  function loadChannelHashCache(target, configDir) {
8989
9286
  const path = getChannelHashCacheFile(configDir);
8990
9287
  if (!existsSync11(path)) return;
8991
9288
  let parsed;
8992
9289
  try {
8993
- parsed = JSON.parse(readFileSync25(path, "utf-8"));
9290
+ parsed = JSON.parse(readFileSync26(path, "utf-8"));
8994
9291
  } catch {
8995
9292
  return;
8996
9293
  }
@@ -9010,8 +9307,8 @@ function saveChannelHashCache(source, configDir) {
9010
9307
  }
9011
9308
 
9012
9309
  // src/lib/sender-policy-baseline.ts
9013
- import { existsSync as existsSync12, readFileSync as readFileSync26 } from "fs";
9014
- import { join as join33 } from "path";
9310
+ import { existsSync as existsSync12, readFileSync as readFileSync27 } from "fs";
9311
+ import { join as join34 } from "path";
9015
9312
  var BASELINE_FILENAME = "sender-policy-baseline.json";
9016
9313
  var SENDER_POLICY_BASELINE_VERSION = 1;
9017
9314
  var BASELINE_CONCERNS = [
@@ -9067,14 +9364,14 @@ function createDeliveryBaselineMaps() {
9067
9364
  };
9068
9365
  }
9069
9366
  function getSenderPolicyBaselineFile(configDir) {
9070
- return join33(configDir, BASELINE_FILENAME);
9367
+ return join34(configDir, BASELINE_FILENAME);
9071
9368
  }
9072
9369
  function loadSenderPolicyBaseline(target, configDir, log2) {
9073
9370
  const path = getSenderPolicyBaselineFile(configDir);
9074
9371
  if (!existsSync12(path)) return;
9075
9372
  let parsed;
9076
9373
  try {
9077
- parsed = JSON.parse(readFileSync26(path, "utf-8"));
9374
+ parsed = JSON.parse(readFileSync27(path, "utf-8"));
9078
9375
  } catch (err) {
9079
9376
  log2?.(
9080
9377
  `[sender-policy] discarding corrupt ${BASELINE_FILENAME} (${err.message}) - restrictive-policy agents will take one fail-closed restart`
@@ -9153,8 +9450,8 @@ function resolveIntegrationEgressDomains(fetched, persisted) {
9153
9450
  }
9154
9451
 
9155
9452
  // src/lib/stuck-streak-store.ts
9156
- import { existsSync as existsSync13, readFileSync as readFileSync27 } from "fs";
9157
- import { join as join34 } from "path";
9453
+ import { existsSync as existsSync13, readFileSync as readFileSync28 } from "fs";
9454
+ import { join as join35 } from "path";
9158
9455
  var STORE_FILENAME = "stuck-streaks.json";
9159
9456
  var STUCK_STREAK_STORE_VERSION = 1;
9160
9457
  var STUCK_STREAK_CONCERNS = ["channelSync", "realtimeRebind"];
@@ -9162,7 +9459,7 @@ function createStuckStreakMaps() {
9162
9459
  return { channelSync: /* @__PURE__ */ new Map(), realtimeRebind: /* @__PURE__ */ new Map() };
9163
9460
  }
9164
9461
  function getStuckStreakStoreFile(configDir) {
9165
- return join34(configDir, STORE_FILENAME);
9462
+ return join35(configDir, STORE_FILENAME);
9166
9463
  }
9167
9464
  function isValidPersistedStreak(value) {
9168
9465
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;
@@ -9204,7 +9501,7 @@ function loadStuckStreaks(target, configDir, log2) {
9204
9501
  if (!existsSync13(path)) return;
9205
9502
  let parsed;
9206
9503
  try {
9207
- parsed = JSON.parse(readFileSync27(path, "utf-8"));
9504
+ parsed = JSON.parse(readFileSync28(path, "utf-8"));
9208
9505
  } catch (err) {
9209
9506
  log2?.(
9210
9507
  `[stuck-streaks] discarding corrupt ${STORE_FILENAME} (${err.message}) \u2014 stuck-streak ages restart from zero and one spurious "recovered" close may follow`
@@ -9247,7 +9544,7 @@ function pruneStuckStreaksToAgents(maps, activeAgentIds) {
9247
9544
  }
9248
9545
 
9249
9546
  // src/lib/claude-device-state.ts
9250
- import { readFileSync as readFileSync28, statSync as statSync11 } from "fs";
9547
+ import { readFileSync as readFileSync29, statSync as statSync11 } from "fs";
9251
9548
  function claudeDeviceStatePath(env = process.env) {
9252
9549
  return effectiveClaudeJsonPath(void 0, env);
9253
9550
  }
@@ -9272,7 +9569,7 @@ function checkClaudeDeviceState(path = claudeDeviceStatePath()) {
9272
9569
  }
9273
9570
  let raw;
9274
9571
  try {
9275
- raw = readFileSync28(path, "utf-8");
9572
+ raw = readFileSync29(path, "utf-8");
9276
9573
  } catch {
9277
9574
  return { usable: false, reason: "unreadable" };
9278
9575
  }
@@ -9383,7 +9680,7 @@ var DeviceStateRotationGate = class {
9383
9680
  };
9384
9681
 
9385
9682
  // src/lib/channel-sweep.ts
9386
- import { execFileSync as execFileSync2 } from "child_process";
9683
+ import { execFileSync as execFileSync3 } from "child_process";
9387
9684
  var CHANNEL_BASENAMES = [
9388
9685
  "slack-channel",
9389
9686
  "direct-chat-channel",
@@ -9546,7 +9843,7 @@ function resolveLiveAnchorPids(agentCodeNames) {
9546
9843
  for (const codeName of agentCodeNames) {
9547
9844
  const pids = /* @__PURE__ */ new Set();
9548
9845
  try {
9549
- const out = execFileSync2("tmux", ["list-panes", "-t", tmuxPaneTarget(`agt-${codeName}`), "-F", "#{pane_pid}"], {
9846
+ const out = execFileSync3("tmux", ["list-panes", "-t", tmuxPaneTarget(`agt-${codeName}`), "-F", "#{pane_pid}"], {
9550
9847
  encoding: "utf-8",
9551
9848
  timeout: 2e3,
9552
9849
  stdio: ["ignore", "pipe", "ignore"]
@@ -9566,7 +9863,7 @@ async function sweepChannelProcesses(opts) {
9566
9863
  const kill = opts.killFn ?? defaultKill;
9567
9864
  let psOutput = "";
9568
9865
  try {
9569
- psOutput = execFileSync2("ps", ["eww", "-o", "pid=,ppid=,etime=,command="], {
9866
+ psOutput = execFileSync3("ps", ["eww", "-o", "pid=,ppid=,etime=,command="], {
9570
9867
  encoding: "utf-8",
9571
9868
  timeout: 5e3,
9572
9869
  maxBuffer: 10 * 1024 * 1024
@@ -9603,7 +9900,7 @@ function defaultKillSignal(pid, signal) {
9603
9900
  }
9604
9901
  }
9605
9902
  function defaultPs() {
9606
- return execFileSync2("ps", ["eww", "-o", "pid=,ppid=,etime=,command="], {
9903
+ return execFileSync3("ps", ["eww", "-o", "pid=,ppid=,etime=,command="], {
9607
9904
  encoding: "utf-8",
9608
9905
  timeout: 5e3,
9609
9906
  maxBuffer: 10 * 1024 * 1024
@@ -9964,7 +10261,7 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash, options)
9964
10261
  }
9965
10262
 
9966
10263
  // src/lib/manager/integration-skill-cache.ts
9967
- import { join as join35 } from "path";
10264
+ import { join as join36 } from "path";
9968
10265
  function integrationSkillHashKey(agentId, skillId) {
9969
10266
  return `plugin-skill:${agentId}:${skillId}`;
9970
10267
  }
@@ -9980,21 +10277,21 @@ function forgetIntegrationSkill(cache3, agentId, skillId) {
9980
10277
  function removeIntegrationSkillFolder(opts) {
9981
10278
  forgetIntegrationSkill(opts.cache, opts.agentId, opts.entry);
9982
10279
  for (const dir of opts.dirs) {
9983
- opts.removeDir(join35(dir, opts.entry));
10280
+ opts.removeDir(join36(dir, opts.entry));
9984
10281
  }
9985
10282
  }
9986
10283
 
9987
10284
  // src/lib/manager/managed-skill-manifest.ts
9988
- import { existsSync as existsSync14, mkdirSync as mkdirSync12, readFileSync as readFileSync29, writeFileSync as writeFileSync13 } from "fs";
9989
- import { dirname as dirname8, join as join36 } from "path";
10285
+ import { existsSync as existsSync14, mkdirSync as mkdirSync12, readFileSync as readFileSync30, writeFileSync as writeFileSync13 } from "fs";
10286
+ import { dirname as dirname8, join as join37 } from "path";
9990
10287
  var MANIFEST_VERSION = 1;
9991
10288
  function managedSkillManifestPath(agentRootDir) {
9992
- return join36(agentRootDir, "managed-skills.json");
10289
+ return join37(agentRootDir, "managed-skills.json");
9993
10290
  }
9994
10291
  function readManagedSkillManifest(path) {
9995
10292
  try {
9996
10293
  if (!existsSync14(path)) return /* @__PURE__ */ new Set();
9997
- const parsed = JSON.parse(readFileSync29(path, "utf-8"));
10294
+ const parsed = JSON.parse(readFileSync30(path, "utf-8"));
9998
10295
  const ids = Array.isArray(parsed?.globalSkillIds) ? parsed.globalSkillIds : [];
9999
10296
  return new Set(ids.filter((id) => typeof id === "string" && id.length > 0));
10000
10297
  } catch {
@@ -10144,7 +10441,7 @@ function resolveModelChain(refreshData) {
10144
10441
 
10145
10442
  // src/lib/manager/claude-auth.ts
10146
10443
  import { chmodSync as chmodSync2, existsSync as existsSync15, lstatSync as lstatSync4, mkdirSync as mkdirSync13, rmSync as rmSync7 } from "fs";
10147
- import { join as join37 } from "path";
10444
+ import { join as join38 } from "path";
10148
10445
  import { homedir as homedir13 } from "os";
10149
10446
  async function applyClaudeAuthToEnv(childEnv, label, options = {}) {
10150
10447
  const apiKey = getApiKey();
@@ -10163,7 +10460,7 @@ async function applyClaudeAuthToEnv(childEnv, label, options = {}) {
10163
10460
  }
10164
10461
  const claudeDir = claudeConfigDirForChild(childEnv);
10165
10462
  for (const filename of [".credentials.json", "credentials.json"]) {
10166
- const p = join37(claudeDir, filename);
10463
+ const p = join38(claudeDir, filename);
10167
10464
  if (existsSync15(p)) {
10168
10465
  try {
10169
10466
  rmSync7(p, { force: true });
@@ -10178,7 +10475,7 @@ async function applyClaudeAuthToEnv(childEnv, label, options = {}) {
10178
10475
  return { isolated: false };
10179
10476
  }
10180
10477
  function claudeConfigDirForChild(childEnv) {
10181
- return childEnv.CLAUDE_CONFIG_DIR?.trim() || join37(homedir13(), ".claude");
10478
+ return childEnv.CLAUDE_CONFIG_DIR?.trim() || join38(homedir13(), ".claude");
10182
10479
  }
10183
10480
  function ensurePrivateConfigDir(dir, platform4 = process.platform, chmod = chmodSync2) {
10184
10481
  mkdirSync13(dir, { recursive: true, mode: 448 });
@@ -10194,7 +10491,7 @@ function ensurePrivateConfigDir(dir, platform4 = process.platform, chmod = chmod
10194
10491
  }
10195
10492
  }
10196
10493
  function oneShotIsolatedConfigDir() {
10197
- return join37(homedir13(), ".augmented", "claude-oneshot");
10494
+ return join38(homedir13(), ".augmented", "claude-oneshot");
10198
10495
  }
10199
10496
 
10200
10497
  // src/lib/claude-runtime-auth-probe.ts
@@ -10539,19 +10836,19 @@ function formatBoardForPrompt(items, template) {
10539
10836
  }
10540
10837
 
10541
10838
  // src/lib/manager/kanban/nudge-state-cache.ts
10542
- import { existsSync as existsSync16, readFileSync as readFileSync30, writeFileSync as writeFileSync14 } from "fs";
10543
- import { join as join38 } from "path";
10839
+ import { existsSync as existsSync16, readFileSync as readFileSync31, writeFileSync as writeFileSync14 } from "fs";
10840
+ import { join as join39 } from "path";
10544
10841
  var CACHE_FILENAME2 = "kanban-nudge-state.json";
10545
10842
  var KANBAN_NUDGE_STATE_VERSION = 1;
10546
10843
  function getKanbanNudgeStateFile(configDir) {
10547
- return join38(configDir, CACHE_FILENAME2);
10844
+ return join39(configDir, CACHE_FILENAME2);
10548
10845
  }
10549
10846
  function loadKanbanNudgeState(target, configDir) {
10550
10847
  const path = getKanbanNudgeStateFile(configDir);
10551
10848
  if (!existsSync16(path)) return;
10552
10849
  let parsed;
10553
10850
  try {
10554
- parsed = JSON.parse(readFileSync30(path, "utf-8"));
10851
+ parsed = JSON.parse(readFileSync31(path, "utf-8"));
10555
10852
  } catch {
10556
10853
  return;
10557
10854
  }
@@ -11261,9 +11558,9 @@ function closeSessionRunForCode(codeName, outcome, reason) {
11261
11558
 
11262
11559
  // src/lib/manager/scheduler/kanban-route.ts
11263
11560
  import { createHash as createHash16 } from "crypto";
11264
- import { writeFileSync as writeFileSync15, renameSync as renameSync8, mkdirSync as mkdirSync14, readFileSync as readFileSync31, unlinkSync as unlinkSync3 } from "fs";
11561
+ import { writeFileSync as writeFileSync15, renameSync as renameSync8, mkdirSync as mkdirSync14, readFileSync as readFileSync32, unlinkSync as unlinkSync3 } from "fs";
11265
11562
  import { homedir as homedir14 } from "os";
11266
- import { join as join39, dirname as dirname9 } from "path";
11563
+ import { join as join40, dirname as dirname9 } from "path";
11267
11564
 
11268
11565
  // src/lib/manager/scheduler/notify.ts
11269
11566
  import { createHash as createHash15 } from "crypto";
@@ -11626,7 +11923,7 @@ function resolveScheduledSlackTarget(task) {
11626
11923
  }
11627
11924
  function stampScheduledTurnMarker(codeName, taskId, target) {
11628
11925
  try {
11629
- const file = join39(homedir14(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
11926
+ const file = join40(homedir14(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
11630
11927
  const marker = { ts: Date.now(), task_id: taskId, ...target ? { target } : {} };
11631
11928
  const tmp = `${file}.tmp`;
11632
11929
  writeFileSync15(tmp, JSON.stringify(marker), "utf8");
@@ -11636,9 +11933,9 @@ function stampScheduledTurnMarker(codeName, taskId, target) {
11636
11933
  }
11637
11934
  }
11638
11935
  function clearScheduledTurnMarkerForTask(codeName, taskId) {
11639
- const file = join39(homedir14(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
11936
+ const file = join40(homedir14(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
11640
11937
  try {
11641
- const raw = JSON.parse(readFileSync31(file, "utf8"));
11938
+ const raw = JSON.parse(readFileSync32(file, "utf8"));
11642
11939
  if (typeof raw?.task_id !== "string" || raw.task_id !== taskId) return;
11643
11940
  unlinkSync3(file);
11644
11941
  log(`[scheduled-kanban] scheduled-turn marker cleared for '${codeName}' (task ${taskId} complete)`);
@@ -11887,11 +12184,11 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
11887
12184
  // src/lib/manager/scheduler/execution.ts
11888
12185
  import { createHash as createHash17 } from "crypto";
11889
12186
  import { homedir as homedir15 } from "os";
11890
- import { join as join41 } from "path";
12187
+ import { join as join42 } from "path";
11891
12188
 
11892
12189
  // src/lib/agent-serving-probe.ts
11893
- import { readFileSync as readFileSync32, readdirSync as readdirSync10, statSync as statSync12 } from "fs";
11894
- import { join as join40 } from "path";
12190
+ import { readFileSync as readFileSync33, readdirSync as readdirSync11, statSync as statSync12 } from "fs";
12191
+ import { join as join41 } from "path";
11895
12192
  var RATE_LIMIT_WINDOW_MS = 6 * 60 * 60 * 1e3;
11896
12193
  function probeRateLimit(args) {
11897
12194
  const now = args.now ?? /* @__PURE__ */ new Date();
@@ -11900,14 +12197,14 @@ function probeRateLimit(args) {
11900
12197
  const dir = args.transcriptDir ?? sessionTranscriptDir(args.projectDir);
11901
12198
  let entries;
11902
12199
  try {
11903
- entries = readdirSync10(dir);
12200
+ entries = readdirSync11(dir);
11904
12201
  } catch {
11905
12202
  return UNKNOWN_RATE_LIMIT;
11906
12203
  }
11907
12204
  let newest = UNKNOWN_RATE_LIMIT;
11908
12205
  for (const name of entries) {
11909
12206
  if (!name.endsWith(".jsonl")) continue;
11910
- const path = join40(dir, name);
12207
+ const path = join41(dir, name);
11911
12208
  try {
11912
12209
  const st = statSync12(path);
11913
12210
  if (!st.isFile() || st.mtimeMs < startMs) continue;
@@ -11916,7 +12213,7 @@ function probeRateLimit(args) {
11916
12213
  }
11917
12214
  let content;
11918
12215
  try {
11919
- content = readFileSync32(path, "utf-8");
12216
+ content = readFileSync33(path, "utf-8");
11920
12217
  } catch {
11921
12218
  continue;
11922
12219
  }
@@ -11978,7 +12275,7 @@ function shouldLogUsageCapDeferral(site, codeName, limitedUntil) {
11978
12275
 
11979
12276
  // src/lib/manager/scheduler/execution.ts
11980
12277
  function claudePidFilePath() {
11981
- return join41(homedir15(), ".augmented", "manager-claude-pids.json");
12278
+ return join42(homedir15(), ".augmented", "manager-claude-pids.json");
11982
12279
  }
11983
12280
  var inFlightClaudePids = /* @__PURE__ */ new Map();
11984
12281
  function registerClaudeSpawn(record) {
@@ -12219,12 +12516,12 @@ var BlockedPromptReportCadence = class {
12219
12516
  };
12220
12517
 
12221
12518
  // ../../packages/core/dist/runtime/direct-chat-inflight.js
12222
- import { renameSync as renameSync9, readFileSync as readFileSync33, writeFileSync as writeFileSync16 } from "fs";
12223
- import { join as join42 } from "path";
12519
+ import { renameSync as renameSync9, readFileSync as readFileSync34, writeFileSync as writeFileSync16 } from "fs";
12520
+ import { join as join43 } from "path";
12224
12521
  var DIRECT_CHAT_INFLIGHT_FILE = "direct-chat-inflight.json";
12225
12522
  var DIRECT_CHAT_INFLIGHT_MAX_AGE_MS = 5 * 6e4;
12226
12523
  function directChatInflightPath(agentDir) {
12227
- return join42(agentDir, DIRECT_CHAT_INFLIGHT_FILE);
12524
+ return join43(agentDir, DIRECT_CHAT_INFLIGHT_FILE);
12228
12525
  }
12229
12526
  function decideDirectChatInflight(input) {
12230
12527
  if (input.raw === null)
@@ -12259,7 +12556,7 @@ function processIsAlive(pid) {
12259
12556
  return err?.code === "EPERM";
12260
12557
  }
12261
12558
  }
12262
- function readDirectChatInflight(agentDir, nowMs = Date.now(), pidAlive = processIsAlive, read = (p) => readFileSync33(p, "utf8")) {
12559
+ function readDirectChatInflight(agentDir, nowMs = Date.now(), pidAlive = processIsAlive, read = (p) => readFileSync34(p, "utf8")) {
12263
12560
  let raw;
12264
12561
  try {
12265
12562
  raw = read(directChatInflightPath(agentDir));
@@ -12321,8 +12618,8 @@ function respawnedByAnotherCaller(decision, healthyAfter, sessionStartedAt, lane
12321
12618
  }
12322
12619
 
12323
12620
  // src/lib/occupancy-gate.ts
12324
- import { closeSync as closeSync5, openSync as openSync5, readdirSync as readdirSync11, readSync as readSync4, statSync as statSync13 } from "fs";
12325
- import { join as join43 } from "path";
12621
+ import { closeSync as closeSync5, openSync as openSync5, readdirSync as readdirSync12, readSync as readSync4, statSync as statSync13 } from "fs";
12622
+ import { join as join44 } from "path";
12326
12623
  function rostersMeasuredZero(mode, attested, runtimeRunning) {
12327
12624
  return mode === "enforce" && attested && runtimeRunning;
12328
12625
  }
@@ -12406,26 +12703,26 @@ function candidateTranscriptPaths(dir) {
12406
12703
  const paths = [];
12407
12704
  let top;
12408
12705
  try {
12409
- top = readdirSync11(dir);
12706
+ top = readdirSync12(dir);
12410
12707
  } catch {
12411
12708
  return { paths, complete: false };
12412
12709
  }
12413
12710
  let complete = true;
12414
12711
  for (const name of top) {
12415
12712
  if (name.endsWith(".jsonl")) {
12416
- paths.push(join43(dir, name));
12713
+ paths.push(join44(dir, name));
12417
12714
  continue;
12418
12715
  }
12419
- const subDir = join43(dir, name, "subagents");
12716
+ const subDir = join44(dir, name, "subagents");
12420
12717
  let subs;
12421
12718
  try {
12422
- subs = readdirSync11(subDir);
12719
+ subs = readdirSync12(subDir);
12423
12720
  } catch (err) {
12424
12721
  if (!isAbsentDirError(err)) complete = false;
12425
12722
  continue;
12426
12723
  }
12427
12724
  for (const sub of subs) {
12428
- if (sub.endsWith(".jsonl")) paths.push(join43(subDir, sub));
12725
+ if (sub.endsWith(".jsonl")) paths.push(join44(subDir, sub));
12429
12726
  }
12430
12727
  }
12431
12728
  return { paths, complete };
@@ -12651,7 +12948,7 @@ function stopPaneOccupancySampler() {
12651
12948
  }
12652
12949
 
12653
12950
  // src/lib/pid-pressure-sampler.ts
12654
- import { existsSync as existsSync17, readFileSync as readFileSync34 } from "fs";
12951
+ import { existsSync as existsSync17, readFileSync as readFileSync35 } from "fs";
12655
12952
  var SAMPLE_INTERVAL_MS2 = 3e4;
12656
12953
  function warnFraction() {
12657
12954
  const raw = Number(process.env.AGT_PID_PRESSURE_WARN_FRACTION);
@@ -12679,7 +12976,7 @@ function parseMemoryEvents(text) {
12679
12976
  }
12680
12977
  function readTextReal(path) {
12681
12978
  try {
12682
- return readFileSync34(path, "utf-8");
12979
+ return readFileSync35(path, "utf-8");
12683
12980
  } catch {
12684
12981
  return null;
12685
12982
  }
@@ -12740,7 +13037,7 @@ function countDefunct(cgroupDir, readText) {
12740
13037
  return defunct;
12741
13038
  }
12742
13039
  function samplePidPressureFor(codeName, io = {}) {
12743
- const isolated = io.isolatedFor?.(codeName) ?? isolationMode(codeName) === "docker";
13040
+ const isolated = io.isolatedFor?.(codeName) ?? effectiveIsolationMode(codeName) === "docker";
12744
13041
  if (!isolated) return null;
12745
13042
  const readText = io.readText ?? readTextReal;
12746
13043
  const resolveDir = io.resolveCgroupDir ?? resolveCgroupDirReal;
@@ -12820,7 +13117,7 @@ function stopPidPressureSampler() {
12820
13117
  }
12821
13118
 
12822
13119
  // src/lib/runtime-version-sampler.ts
12823
- import { execFileSync as execFileSync3 } from "child_process";
13120
+ import { execFileSync as execFileSync4 } from "child_process";
12824
13121
  import { execFile as execFileCb } from "child_process";
12825
13122
  import { promisify as promisify2 } from "util";
12826
13123
  var execFileAsync2 = promisify2(execFileCb);
@@ -12829,7 +13126,7 @@ var lastSample2 = /* @__PURE__ */ new Map();
12829
13126
  var failureCount = /* @__PURE__ */ new Map();
12830
13127
  async function readVersionReal(codeName) {
12831
13128
  const timeoutMs = 1e4;
12832
- timeoutBinaryAvailable ??= hasTimeoutBinary(execFileSync3);
13129
+ timeoutBinaryAvailable ??= hasTimeoutBinary(execFileSync4);
12833
13130
  const { execFile: file, execArgs } = boundedArgv(
12834
13131
  "docker",
12835
13132
  ["exec", `agt-${codeName}`, "claude", "--version"],
@@ -14061,9 +14358,9 @@ async function fireOpencodeScheduledTask(agent, task) {
14061
14358
 
14062
14359
  // src/lib/opencode-telegram-ingest.ts
14063
14360
  import { createHash as createHash20 } from "crypto";
14064
- import { existsSync as existsSync18, mkdirSync as mkdirSync15, readFileSync as readFileSync35, renameSync as renameSync10, unlinkSync as unlinkSync4, writeFileSync as writeFileSync17 } from "fs";
14361
+ import { existsSync as existsSync18, mkdirSync as mkdirSync15, readFileSync as readFileSync36, renameSync as renameSync10, unlinkSync as unlinkSync4, writeFileSync as writeFileSync17 } from "fs";
14065
14362
  import { randomUUID } from "crypto";
14066
- import { join as join44 } from "path";
14363
+ import { join as join45 } from "path";
14067
14364
 
14068
14365
  // src/lib/telegram-ingest.ts
14069
14366
  import https2 from "https";
@@ -14766,7 +15063,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
14766
15063
  let filePath;
14767
15064
  try {
14768
15065
  dir = getFramework("opencode").getAgentDir(codeName);
14769
- filePath = join44(dir, "telegram-getupdates-offset-opencode.json");
15066
+ filePath = join45(dir, "telegram-getupdates-offset-opencode.json");
14770
15067
  } catch {
14771
15068
  dir = null;
14772
15069
  filePath = null;
@@ -14775,7 +15072,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
14775
15072
  load() {
14776
15073
  if (!filePath) return 0;
14777
15074
  try {
14778
- const parsed = JSON.parse(readFileSync35(filePath, "utf-8"));
15075
+ const parsed = JSON.parse(readFileSync36(filePath, "utf-8"));
14779
15076
  if (currentBotId != null && typeof parsed?.bot_id === "number" && parsed.bot_id !== currentBotId) {
14780
15077
  log2(`[telegram-ingest:${codeName}] offset cursor belongs to a different bot; ignoring (bot swap)`);
14781
15078
  return 0;
@@ -14820,7 +15117,7 @@ function createFileMigrationReportIO(codeName, log2) {
14820
15117
  let filePath;
14821
15118
  try {
14822
15119
  dir = getFramework("opencode").getAgentDir(codeName);
14823
- filePath = join44(dir, "telegram-migration-reports-opencode.json");
15120
+ filePath = join45(dir, "telegram-migration-reports-opencode.json");
14824
15121
  } catch {
14825
15122
  dir = null;
14826
15123
  filePath = null;
@@ -14829,7 +15126,7 @@ function createFileMigrationReportIO(codeName, log2) {
14829
15126
  load() {
14830
15127
  if (!filePath) return null;
14831
15128
  try {
14832
- return readFileSync35(filePath, "utf-8");
15129
+ return readFileSync36(filePath, "utf-8");
14833
15130
  } catch {
14834
15131
  return null;
14835
15132
  }
@@ -14846,7 +15143,7 @@ function createFileMigrationReportIO(codeName, log2) {
14846
15143
  };
14847
15144
  }
14848
15145
  var managerHostPost = async (path, body) => {
14849
- const { api: api2, ApiError: ApiError3 } = await import("../api-client-PENFPEFF.js");
15146
+ const { api: api2, ApiError: ApiError3 } = await import("../api-client-5S4JHNCY.js");
14850
15147
  try {
14851
15148
  const json = await api2.post(path, body);
14852
15149
  return { status: 200, json };
@@ -15112,24 +15409,24 @@ function partitionActionableByPoison(actionable, states, config2) {
15112
15409
  }
15113
15410
 
15114
15411
  // src/lib/restart-flags.ts
15115
- import { existsSync as existsSync19, mkdirSync as mkdirSync16, readdirSync as readdirSync12, readFileSync as readFileSync36, renameSync as renameSync11, rmSync as rmSync8, writeFileSync as writeFileSync18 } from "fs";
15412
+ import { existsSync as existsSync19, mkdirSync as mkdirSync16, readdirSync as readdirSync13, readFileSync as readFileSync37, renameSync as renameSync11, rmSync as rmSync8, writeFileSync as writeFileSync18 } from "fs";
15116
15413
  import { homedir as homedir16 } from "os";
15117
- import { join as join45 } from "path";
15414
+ import { join as join46 } from "path";
15118
15415
  import { randomUUID as randomUUID2 } from "crypto";
15119
15416
  function restartFlagsDir() {
15120
- return join45(homedir16(), ".augmented", "restart-flags");
15417
+ return join46(homedir16(), ".augmented", "restart-flags");
15121
15418
  }
15122
15419
  function flagPath(codeName) {
15123
- return join45(restartFlagsDir(), `${codeName}.flag`);
15420
+ return join46(restartFlagsDir(), `${codeName}.flag`);
15124
15421
  }
15125
15422
  function readRestartFlags() {
15126
15423
  const dir = restartFlagsDir();
15127
15424
  if (!existsSync19(dir)) return [];
15128
15425
  const out = [];
15129
- for (const entry of readdirSync12(dir)) {
15426
+ for (const entry of readdirSync13(dir)) {
15130
15427
  if (!entry.endsWith(".flag")) continue;
15131
15428
  try {
15132
- const raw = readFileSync36(join45(dir, entry), "utf8");
15429
+ const raw = readFileSync37(join46(dir, entry), "utf8");
15133
15430
  const parsed = JSON.parse(raw);
15134
15431
  if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
15135
15432
  parsed.codeName = entry.replace(/\.flag$/, "");
@@ -15247,8 +15544,8 @@ async function sendError(flag, opts, text) {
15247
15544
  }
15248
15545
 
15249
15546
  // src/lib/restart-context.ts
15250
- import { readdirSync as readdirSync13, readFileSync as readFileSync37, writeFileSync as writeFileSync19, mkdirSync as mkdirSync17, unlinkSync as unlinkSync5 } from "fs";
15251
- import { dirname as dirname10, join as join46 } from "path";
15547
+ import { readdirSync as readdirSync14, readFileSync as readFileSync38, writeFileSync as writeFileSync19, mkdirSync as mkdirSync17, unlinkSync as unlinkSync5 } from "fs";
15548
+ import { dirname as dirname10, join as join47 } from "path";
15252
15549
  var SLACK_PENDING_INBOUND_DIRNAME = "slack-pending-inbound";
15253
15550
  var SLACK_RESTART_CONTEXT_DIRNAME = "slack-restart-context";
15254
15551
  var MAX_TOPIC_CHARS = 140;
@@ -15260,10 +15557,10 @@ function augmentedAgentDir(codeName) {
15260
15557
  return dirname10(getProjectDir(codeName));
15261
15558
  }
15262
15559
  function slackPendingInboundDir(codeName) {
15263
- return join46(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
15560
+ return join47(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
15264
15561
  }
15265
15562
  function slackRestartContextDir(codeName) {
15266
- return join46(augmentedAgentDir(codeName), SLACK_RESTART_CONTEXT_DIRNAME);
15563
+ return join47(augmentedAgentDir(codeName), SLACK_RESTART_CONTEXT_DIRNAME);
15267
15564
  }
15268
15565
  function sanitizeTopic(raw) {
15269
15566
  const cleaned = raw.replace(/\s+/g, " ").trim().replace(/[<>]/g, " ").replace(/\s+/g, " ").trim();
@@ -15298,14 +15595,14 @@ function computeRestartContextHints(markers, allTurns, nowMs, reconstruct = reco
15298
15595
  }
15299
15596
  function safeReaddir(dir) {
15300
15597
  try {
15301
- return readdirSync13(dir);
15598
+ return readdirSync14(dir);
15302
15599
  } catch {
15303
15600
  return [];
15304
15601
  }
15305
15602
  }
15306
15603
  function readStrandedMarker(path) {
15307
15604
  try {
15308
- const parsed = JSON.parse(readFileSync37(path, "utf-8"));
15605
+ const parsed = JSON.parse(readFileSync38(path, "utf-8"));
15309
15606
  if (typeof parsed.channel === "string" && typeof parsed.thread_ts === "string") {
15310
15607
  return { channel: parsed.channel, thread_ts: parsed.thread_ts };
15311
15608
  }
@@ -15323,7 +15620,7 @@ function pruneHintsExcept(codeName, freshFilenames) {
15323
15620
  if (!filename.endsWith(".json")) continue;
15324
15621
  if (freshFilenames.has(filename)) continue;
15325
15622
  try {
15326
- unlinkSync5(join46(ctxDir, filename));
15623
+ unlinkSync5(join47(ctxDir, filename));
15327
15624
  } catch {
15328
15625
  }
15329
15626
  }
@@ -15344,7 +15641,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
15344
15641
  }
15345
15642
  const markers = [];
15346
15643
  for (const filename of markerFilenames.slice(0, cap)) {
15347
- const parsed = readStrandedMarker(join46(markerDir, filename));
15644
+ const parsed = readStrandedMarker(join47(markerDir, filename));
15348
15645
  if (parsed) markers.push({ filename, channel: parsed.channel, thread_ts: parsed.thread_ts });
15349
15646
  }
15350
15647
  if (markers.length === 0) {
@@ -15358,7 +15655,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
15358
15655
  const freshFilenames = /* @__PURE__ */ new Set();
15359
15656
  for (const { filename, hint } of hints) {
15360
15657
  try {
15361
- writeHintFile(join46(ctxDir, filename), ctxDir, hint);
15658
+ writeHintFile(join47(ctxDir, filename), ctxDir, hint);
15362
15659
  freshFilenames.add(filename);
15363
15660
  } catch (err) {
15364
15661
  log2(`[restart-context] ${codeName}: hint write failed for ${filename}: ${err.message}`);
@@ -16135,6 +16432,7 @@ function recordConfigChurnEvent(agentId, codeName, channel, signature) {
16135
16432
  var reloadUnknownStreak = new UnknownStreak();
16136
16433
  var reloadBlindSpawns = /* @__PURE__ */ new Set();
16137
16434
  var stragglerDeferStreak = new UnknownStreak();
16435
+ var signalledHostPids = new SignalledHostPids();
16138
16436
  function reloadSessionSpawnedAt(codeName) {
16139
16437
  const s = getSessionState(codeName);
16140
16438
  if (!s || s.startedAt === null) return null;
@@ -16173,10 +16471,12 @@ async function runDangerousRmBackstop(agentId, codeName, pane) {
16173
16471
  return;
16174
16472
  }
16175
16473
  const policy = readRmPolicyText(
16176
- () => readFileSync38(join47(getFramework("claude-code").getAgentDir(codeName), RM_POLICY_RELATIVE_PATH), "utf-8")
16474
+ () => readFileSync39(join48(getFramework("claude-code").getAgentDir(codeName), RM_POLICY_RELATIVE_PATH), "utf-8")
16177
16475
  );
16178
16476
  const decision = decideDangerousRm(action.prompt, policy, {
16179
- isolated: isolationMode(codeName) === "docker"
16477
+ // ENG-11871: where the agent ACTUALLY runs (fails safe to host rules if
16478
+ // Docker is unusable), not the operator's request.
16479
+ isolated: effectiveIsolationMode(codeName) === "docker"
16180
16480
  });
16181
16481
  const shown = { ...decision, command: decision.command === null ? null : scrub(decision.command) };
16182
16482
  const plan = planAnswer(pane, decision);
@@ -16894,7 +17194,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
16894
17194
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
16895
17195
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
16896
17196
  async function channelInboundActivityAgeSecondsFor(codeName) {
16897
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-XGTPNCKO.js");
17197
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-GBYZCGXX.js");
16898
17198
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
16899
17199
  if (newest === null) return null;
16900
17200
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -17262,7 +17562,7 @@ var runningMcpServerKeys = /* @__PURE__ */ new Map();
17262
17562
  var runningChannelSecretHashes = /* @__PURE__ */ new Map();
17263
17563
  var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
17264
17564
  function readSpawnViewMcpConfig(codeName, projectDir) {
17265
- const parsed = JSON.parse(readFileSync38(join47(projectDir, ".mcp.json"), "utf-8"));
17565
+ const parsed = JSON.parse(readFileSync39(join48(projectDir, ".mcp.json"), "utf-8"));
17266
17566
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return parsed;
17267
17567
  const agentId = agentState.codeNameToAgentId.get(codeName);
17268
17568
  const integrations = agentId ? lastIntegrationsPayload.get(agentId) : void 0;
@@ -17283,7 +17583,7 @@ function reportSpawnCopyFailure(codeName, f) {
17283
17583
  function refreshHeldDropped(codeName, projectDir, held) {
17284
17584
  const agentId = agentState.codeNameToAgentId.get(codeName);
17285
17585
  const integrations = agentId ? lastIntegrationsPayload.get(agentId) : void 0;
17286
- const now = [...spawnDroppedServerKeys(join47(projectDir, ".mcp.json"), integrations)];
17586
+ const now = [...spawnDroppedServerKeys(join48(projectDir, ".mcp.json"), integrations)];
17287
17587
  if (spawnCopyFailures.noteDropped(codeName, now)) {
17288
17588
  log(
17289
17589
  `[spawn-mcp-filter] ORPHAN_SPAWN_UNFILTERED_CHANGED agent='${codeName}' servers=${now.map((k) => `'${k}'`).join(", ")}: the set of removed servers still loaded changed while the copy failure is held (ENG-12048)`
@@ -17299,14 +17599,14 @@ function retryHeldSpawnCopy2(codeName, projectDir, held) {
17299
17599
  }
17300
17600
  function readSpawnedMcpConfig(path) {
17301
17601
  try {
17302
- const parsed = JSON.parse(readFileSync38(path, "utf-8"));
17602
+ const parsed = JSON.parse(readFileSync39(path, "utf-8"));
17303
17603
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
17304
17604
  } catch {
17305
17605
  return null;
17306
17606
  }
17307
17607
  }
17308
17608
  function readRawMcpConfig(projectDir) {
17309
- return JSON.parse(readFileSync38(join47(projectDir, ".mcp.json"), "utf-8"));
17609
+ return JSON.parse(readFileSync39(join48(projectDir, ".mcp.json"), "utf-8"));
17310
17610
  }
17311
17611
  function readMcpConfigFor(codeName, projectDir, source) {
17312
17612
  return source === "raw" ? readRawMcpConfig(projectDir) : readSpawnViewMcpConfig(codeName, projectDir);
@@ -17339,7 +17639,7 @@ function seedSessionLaunchBaselines(codeName, projectDir, spawnMcpConfigPath) {
17339
17639
  else runningMcpServerKeys.delete(codeName);
17340
17640
  let launchStructure = null;
17341
17641
  try {
17342
- const raw = readFileSync38(join47(projectDir, ".mcp.json"), "utf-8");
17642
+ const raw = readFileSync39(join48(projectDir, ".mcp.json"), "utf-8");
17343
17643
  launchStructure = managedMcpStructureHashFromFile(
17344
17644
  JSON.parse(raw),
17345
17645
  isManagedMcpServerKey
@@ -17491,11 +17791,11 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
17491
17791
  if (result && result.rebindCandidates.length > 0 && hostFlagStore().getBoolean("session-tool-rebind")) {
17492
17792
  let mcpJsonForRebind = null;
17493
17793
  try {
17494
- mcpJsonForRebind = JSON.parse(readFileSync38(join47(projectDir, ".mcp.json"), "utf-8"));
17794
+ mcpJsonForRebind = JSON.parse(readFileSync39(join48(projectDir, ".mcp.json"), "utf-8"));
17495
17795
  } catch {
17496
17796
  mcpJsonForRebind = null;
17497
17797
  }
17498
- const isolated = isolationMode(agent.code_name) === "docker";
17798
+ const isolated = effectiveIsolationMode(agent.code_name) === "docker";
17499
17799
  const now = Date.now();
17500
17800
  for (const candidate of result.rebindCandidates) {
17501
17801
  const keysToReap = candidate.serverKeys.filter((k) => {
@@ -17655,7 +17955,7 @@ function shouldInjectChannelSecrets(agentId) {
17655
17955
  function projectChannelSecretHash(projectDir) {
17656
17956
  try {
17657
17957
  const entries = parseEnvIntegrations(
17658
- readFileSync38(join47(projectDir, ".env.integrations"), "utf-8")
17958
+ readFileSync39(join48(projectDir, ".env.integrations"), "utf-8")
17659
17959
  );
17660
17960
  return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
17661
17961
  } catch {
@@ -17775,10 +18075,10 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
17775
18075
  var lastVersionCheckAt = 0;
17776
18076
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
17777
18077
  var lastResponsivenessProbeAt = 0;
17778
- var agtCliVersion = true ? "0.28.1273" : "dev";
17779
- function resolveBrewPath(execFileSync4) {
18078
+ var agtCliVersion = true ? "0.28.1275" : "dev";
18079
+ function resolveBrewPath(execFileSync5) {
17780
18080
  try {
17781
- const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
18081
+ const out = execFileSync5("which", ["brew"], { timeout: 5e3 }).toString().trim();
17782
18082
  if (out) return out;
17783
18083
  } catch {
17784
18084
  }
@@ -17792,7 +18092,7 @@ function resolveBrewPath(execFileSync4) {
17792
18092
  }
17793
18093
  return null;
17794
18094
  }
17795
- function claudeBinaryInstalled(execFileSync4) {
18095
+ function claudeBinaryInstalled(execFileSync5) {
17796
18096
  const canonical = [
17797
18097
  "/home/linuxbrew/.linuxbrew/bin/claude",
17798
18098
  "/opt/homebrew/bin/claude",
@@ -17800,7 +18100,7 @@ function claudeBinaryInstalled(execFileSync4) {
17800
18100
  ];
17801
18101
  if (canonical.some((path) => existsSync20(path))) return true;
17802
18102
  try {
17803
- execFileSync4("which", ["claude"], { timeout: 5e3 });
18103
+ execFileSync5("which", ["claude"], { timeout: 5e3 });
17804
18104
  return true;
17805
18105
  } catch {
17806
18106
  return false;
@@ -17840,12 +18140,12 @@ async function ensureToolkitCliInner(toolkitSlug) {
17840
18140
  }
17841
18141
  const { binary, installer, package: pkg, script } = integration.cli_tool;
17842
18142
  const resolvedInstaller = installer ?? "manual";
17843
- const { execFileSync: execFileSync4, execFile: execFile2, exec } = await import("child_process");
18143
+ const { execFileSync: execFileSync5, execFile: execFile2, exec } = await import("child_process");
17844
18144
  const { promisify: promisify3 } = await import("util");
17845
18145
  const execFileAsync3 = promisify3(execFile2);
17846
18146
  const execAsync = promisify3(exec);
17847
18147
  try {
17848
- execFileSync4("which", [binary], { timeout: 5e3, stdio: "pipe" });
18148
+ execFileSync5("which", [binary], { timeout: 5e3, stdio: "pipe" });
17849
18149
  toolkitCliEnsured.add(toolkitSlug);
17850
18150
  toolkitCliRetryAfter.delete(toolkitSlug);
17851
18151
  toolkitCliFailureCount.delete(toolkitSlug);
@@ -17876,7 +18176,7 @@ async function ensureToolkitCliInner(toolkitSlug) {
17876
18176
  toolkitCliEnsured.add(toolkitSlug);
17877
18177
  return;
17878
18178
  }
17879
- const brewPath = resolveBrewPath(execFileSync4);
18179
+ const brewPath = resolveBrewPath(execFileSync5);
17880
18180
  if (!brewPath) {
17881
18181
  log(`[toolkit-install] ${toolkitSlug}: installer=brew but Homebrew not available \u2014 install manually: brew install ${pkg}`);
17882
18182
  toolkitCliEnsured.add(toolkitSlug);
@@ -17910,7 +18210,7 @@ async function ensureToolkitCliInner(toolkitSlug) {
17910
18210
  process.env.PATH = `${brewBinDir}:${process.env.PATH ?? ""}`;
17911
18211
  }
17912
18212
  try {
17913
- execFileSync4("which", [binary], { timeout: 5e3, stdio: "pipe" });
18213
+ execFileSync5("which", [binary], { timeout: 5e3, stdio: "pipe" });
17914
18214
  log(`[toolkit-install] ${toolkitSlug}: installed \u2014 ${binary} now on PATH`);
17915
18215
  toolkitCliEnsured.add(toolkitSlug);
17916
18216
  toolkitCliRetryAfter.delete(toolkitSlug);
@@ -18127,9 +18427,9 @@ async function ensureHostNodeVersion(rawPin) {
18127
18427
  hostNodeConvergence.recordSuccess(pin);
18128
18428
  return;
18129
18429
  }
18130
- const { execFileSync: execFileSync4 } = await import("child_process");
18430
+ const { execFileSync: execFileSync5 } = await import("child_process");
18131
18431
  try {
18132
- execFileSync4("which", ["dnf"], { timeout: 5e3, stdio: "pipe" });
18432
+ execFileSync5("which", ["dnf"], { timeout: 5e3, stdio: "pipe" });
18133
18433
  } catch {
18134
18434
  if (!hostNodeNoDnfLogged) {
18135
18435
  hostNodeNoDnfLogged = true;
@@ -18179,16 +18479,16 @@ async function ensureIsolationImage(imageUri) {
18179
18479
  }
18180
18480
  isolationImageInFlight.add(imageUri);
18181
18481
  try {
18182
- const { execFileSync: execFileSync4 } = await import("child_process");
18482
+ const { execFileSync: execFileSync5 } = await import("child_process");
18183
18483
  try {
18184
- execFileSync4("which", ["docker"], { timeout: 5e3, stdio: "pipe" });
18484
+ execFileSync5("which", ["docker"], { timeout: 5e3, stdio: "pipe" });
18185
18485
  } catch {
18186
18486
  recordIsolationImageFailure(imageUri, `'docker' not found on host - required to pull the isolation image (install it, then the manager retries)`);
18187
18487
  return;
18188
18488
  }
18189
18489
  const hasAws = (() => {
18190
18490
  try {
18191
- execFileSync4("which", ["aws"], { timeout: 5e3, stdio: "pipe" });
18491
+ execFileSync5("which", ["aws"], { timeout: 5e3, stdio: "pipe" });
18192
18492
  return true;
18193
18493
  } catch {
18194
18494
  return false;
@@ -18197,11 +18497,11 @@ async function ensureIsolationImage(imageUri) {
18197
18497
  if (isPublic) {
18198
18498
  if (hasAws) {
18199
18499
  try {
18200
- const password = execFileSync4("aws", ["ecr-public", "get-login-password", "--region", "us-east-1"], {
18500
+ const password = execFileSync5("aws", ["ecr-public", "get-login-password", "--region", "us-east-1"], {
18201
18501
  timeout: 3e4,
18202
18502
  stdio: ["ignore", "pipe", "pipe"]
18203
18503
  }).toString().trim();
18204
- execFileSync4("docker", ["login", "--username", "AWS", "--password-stdin", "public.ecr.aws"], {
18504
+ execFileSync5("docker", ["login", "--username", "AWS", "--password-stdin", "public.ecr.aws"], {
18205
18505
  input: password,
18206
18506
  timeout: 3e4,
18207
18507
  stdio: ["pipe", "pipe", "pipe"]
@@ -18216,11 +18516,11 @@ async function ensureIsolationImage(imageUri) {
18216
18516
  return;
18217
18517
  }
18218
18518
  try {
18219
- const password = execFileSync4("aws", ["ecr", "get-login-password", "--region", privRegion], {
18519
+ const password = execFileSync5("aws", ["ecr", "get-login-password", "--region", privRegion], {
18220
18520
  timeout: 3e4,
18221
18521
  stdio: ["ignore", "pipe", "pipe"]
18222
18522
  }).toString().trim();
18223
- execFileSync4("docker", ["login", "--username", "AWS", "--password-stdin", registry], {
18523
+ execFileSync5("docker", ["login", "--username", "AWS", "--password-stdin", registry], {
18224
18524
  input: password,
18225
18525
  timeout: 3e4,
18226
18526
  stdio: ["pipe", "pipe", "pipe"]
@@ -18335,7 +18635,7 @@ function runAsync(cmd, args, opts) {
18335
18635
  });
18336
18636
  }
18337
18637
  function claudeManagedSettingsPath() {
18338
- return join47(CLAUDE_MANAGED_SETTINGS_DIR, "managed-settings.json");
18638
+ return join48(CLAUDE_MANAGED_SETTINGS_DIR, "managed-settings.json");
18339
18639
  }
18340
18640
  var MANAGED_SETTINGS_KEYS = ["channelsEnabled", "enableAllProjectMcpServers"];
18341
18641
  var MANAGED_SETTINGS_ENV = { DISABLE_AUTOUPDATER: "1" };
@@ -18358,7 +18658,7 @@ function deniedTools(settings) {
18358
18658
  }
18359
18659
  function readCrossSessionBlockStatus(path = claudeManagedSettingsPath()) {
18360
18660
  try {
18361
- const parsed = JSON.parse(readFileSync38(path, "utf-8"));
18661
+ const parsed = JSON.parse(readFileSync39(path, "utf-8"));
18362
18662
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return "missing";
18363
18663
  const settings = parsed;
18364
18664
  const deny = deniedTools(settings);
@@ -18398,7 +18698,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath(), write =
18398
18698
  try {
18399
18699
  let settings = {};
18400
18700
  if (existsSync20(path)) {
18401
- const raw = readFileSync38(path, "utf-8").trim();
18701
+ const raw = readFileSync39(path, "utf-8").trim();
18402
18702
  if (raw) {
18403
18703
  let parsed;
18404
18704
  try {
@@ -18461,11 +18761,11 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath(), write =
18461
18761
  }
18462
18762
  var OPENCODE_NPM_VERSION = "1.18.3";
18463
18763
  async function ensureOpencodeBinary() {
18464
- const { execFileSync: execFileSync4 } = await import("child_process");
18764
+ const { execFileSync: execFileSync5 } = await import("child_process");
18465
18765
  const bin = process.env["AGT_OPENCODE_BIN"]?.trim() || "opencode";
18466
18766
  const probe = () => {
18467
18767
  try {
18468
- execFileSync4(bin, ["--version"], { stdio: "ignore", timeout: 1e4 });
18768
+ execFileSync5(bin, ["--version"], { stdio: "ignore", timeout: 1e4 });
18469
18769
  return true;
18470
18770
  } catch {
18471
18771
  return false;
@@ -18489,9 +18789,9 @@ async function ensureOpencodeBinary() {
18489
18789
  return false;
18490
18790
  }
18491
18791
  try {
18492
- const prefix = execFileSync4("npm", ["prefix", "-g"], { encoding: "utf-8", timeout: 1e4 }).trim();
18792
+ const prefix = execFileSync5("npm", ["prefix", "-g"], { encoding: "utf-8", timeout: 1e4 }).trim();
18493
18793
  if (prefix) {
18494
- const npmBin = join47(prefix, "bin");
18794
+ const npmBin = join48(prefix, "bin");
18495
18795
  const current = (process.env.PATH ?? "").split(pathDelimiter);
18496
18796
  if (!current.includes(npmBin)) {
18497
18797
  process.env.PATH = [npmBin, ...current.filter(Boolean)].join(pathDelimiter);
@@ -18521,8 +18821,8 @@ async function ensureFrameworkBinary(frameworkId) {
18521
18821
  }
18522
18822
  frameworkBinaryChecked.add(frameworkId);
18523
18823
  lastManagedSettingsStatus = ensureClaudeManagedSettings();
18524
- const { execFileSync: execFileSync4 } = await import("child_process");
18525
- const brewPath = resolveBrewPath(execFileSync4);
18824
+ const { execFileSync: execFileSync5 } = await import("child_process");
18825
+ const brewPath = resolveBrewPath(execFileSync5);
18526
18826
  if (!brewPath) {
18527
18827
  log("Homebrew not found (no `brew` on PATH, no /home/linuxbrew/.linuxbrew/bin/brew). Cannot auto-install Claude Code. Install manually: https://claude.ai/download");
18528
18828
  return;
@@ -18535,7 +18835,7 @@ async function ensureFrameworkBinary(frameworkId) {
18535
18835
  }
18536
18836
  return runAsync(brewPath, args, opts);
18537
18837
  };
18538
- const claudeExists = claudeBinaryInstalled(execFileSync4);
18838
+ const claudeExists = claudeBinaryInstalled(execFileSync5);
18539
18839
  if (!claudeExists) {
18540
18840
  log(`Claude Code binary not found \u2014 installing via Homebrew${isRoot ? " (as ec2-user via sudo)" : ""}...`);
18541
18841
  try {
@@ -18562,7 +18862,7 @@ async function ensureFrameworkBinary(frameworkId) {
18562
18862
  agentRuntimeAuthenticated = await checkClaudeAuth();
18563
18863
  }
18564
18864
  var claudeCodeUpgradeInFlight = false;
18565
- var SCRATCH_HOLDS_DIR = () => join47(homedir17(), ".augmented", ".manager-scratch-holds");
18865
+ var SCRATCH_HOLDS_DIR = () => join48(homedir17(), ".augmented", ".manager-scratch-holds");
18566
18866
  setScratchSweepPolicyResolver(
18567
18867
  (codeName) => resolveScratchSweepPolicy({
18568
18868
  agentId: agentState.codeNameToAgentId.get(codeName),
@@ -18580,13 +18880,13 @@ async function maybeUpgradeClaudeCode() {
18580
18880
  }
18581
18881
  claudeCodeUpgradeInFlight = true;
18582
18882
  stampClaudeCodeUpgradeMarker();
18583
- const { execFileSync: execFileSync4 } = await import("child_process");
18584
- const brewPath = resolveBrewPath(execFileSync4);
18883
+ const { execFileSync: execFileSync5 } = await import("child_process");
18884
+ const brewPath = resolveBrewPath(execFileSync5);
18585
18885
  if (!brewPath) {
18586
18886
  claudeCodeUpgradeInFlight = false;
18587
18887
  return;
18588
18888
  }
18589
- if (!claudeBinaryInstalled(execFileSync4)) {
18889
+ if (!claudeBinaryInstalled(execFileSync5)) {
18590
18890
  claudeCodeUpgradeInFlight = false;
18591
18891
  return;
18592
18892
  }
@@ -18641,7 +18941,7 @@ async function maybeUpgradeClaudeCode() {
18641
18941
  }
18642
18942
  var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
18643
18943
  function selfUpdateAppliedMarkerPath() {
18644
- return join47(homedir17(), ".augmented", ".last-self-update-applied");
18944
+ return join48(homedir17(), ".augmented", ".last-self-update-applied");
18645
18945
  }
18646
18946
  var selfUpdateUpToDateLogged = false;
18647
18947
  var selfUpdatePinnedLogged = false;
@@ -18692,7 +18992,7 @@ async function checkAndUpdateCli(opts) {
18692
18992
  const isNpmGlobal = !isBrewFormula && resolvedPath.includes("node_modules");
18693
18993
  if (!isBrewFormula && !isNpmGlobal) return "noop";
18694
18994
  const { readFileSync: readF, writeFileSync: writeF } = await import("fs");
18695
- const markerPath = join47(homedir17(), ".augmented", ".last-update-check");
18995
+ const markerPath = join48(homedir17(), ".augmented", ".last-update-check");
18696
18996
  if (!force) {
18697
18997
  try {
18698
18998
  const lastCheck = parseInt(readF(markerPath, "utf-8").trim(), 10);
@@ -18716,8 +19016,8 @@ async function checkAndUpdateCli(opts) {
18716
19016
  }
18717
19017
  }
18718
19018
  async function checkAndUpdateCliViaBrew(force = false) {
18719
- const { execFileSync: execFileSync4 } = await import("child_process");
18720
- const brewPath = resolveBrewPath(execFileSync4);
19019
+ const { execFileSync: execFileSync5 } = await import("child_process");
19020
+ const brewPath = resolveBrewPath(execFileSync5);
18721
19021
  if (!brewPath) return "noop";
18722
19022
  {
18723
19023
  const brewPinRaw = resolveAgtCliPinRaw();
@@ -18744,13 +19044,13 @@ async function checkAndUpdateCliViaBrew(force = false) {
18744
19044
  }
18745
19045
  let metadataFresh = true;
18746
19046
  try {
18747
- execFileSync4(brewPath, ["update", "--quiet"], { timeout: SELF_UPDATE_TIMEOUTS.brewUpdateMs, stdio: "pipe" });
19047
+ execFileSync5(brewPath, ["update", "--quiet"], { timeout: SELF_UPDATE_TIMEOUTS.brewUpdateMs, stdio: "pipe" });
18748
19048
  } catch (err) {
18749
19049
  metadataFresh = false;
18750
19050
  log(`[self-update] brew update failed (continuing with stale cache): ${err.message}`);
18751
19051
  }
18752
19052
  try {
18753
- const outdated = execFileSync4(brewPath, ["outdated", "--json=v2"], {
19053
+ const outdated = execFileSync5(brewPath, ["outdated", "--json=v2"], {
18754
19054
  timeout: SELF_UPDATE_TIMEOUTS.brewOutdatedMs,
18755
19055
  encoding: "utf-8"
18756
19056
  });
@@ -18791,7 +19091,7 @@ async function checkAndUpdateCliViaBrew(force = false) {
18791
19091
  }
18792
19092
  try {
18793
19093
  try {
18794
- execFileSync4(brewPath, ["upgrade", "integrity-labs/tap/agt"], {
19094
+ execFileSync5(brewPath, ["upgrade", "integrity-labs/tap/agt"], {
18795
19095
  timeout: SELF_UPDATE_TIMEOUTS.brewUpgradeMs,
18796
19096
  stdio: "pipe"
18797
19097
  });
@@ -18971,7 +19271,7 @@ async function fetchUrgentDistTagVersion() {
18971
19271
  }
18972
19272
  }
18973
19273
  async function installAgtCliViaNpm(version, reasonLabel, force = false) {
18974
- const { execFileSync: execFileSync4 } = await import("child_process");
19274
+ const { execFileSync: execFileSync5 } = await import("child_process");
18975
19275
  const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
18976
19276
  const cmd = isRoot ? "npm" : "sudo";
18977
19277
  const installArgs = [
@@ -18989,7 +19289,7 @@ async function installAgtCliViaNpm(version, reasonLabel, force = false) {
18989
19289
  return npmInstallHold;
18990
19290
  }
18991
19291
  try {
18992
- execFileSync4(cmd, args, { timeout: SELF_UPDATE_TIMEOUTS.npmInstallMs, stdio: "pipe" });
19292
+ execFileSync5(cmd, args, { timeout: SELF_UPDATE_TIMEOUTS.npmInstallMs, stdio: "pipe" });
18993
19293
  } catch (err) {
18994
19294
  log(`[self-update] npm upgrade failed: ${err.message}`);
18995
19295
  return "failed";
@@ -18998,7 +19298,7 @@ async function installAgtCliViaNpm(version, reasonLabel, force = false) {
18998
19298
  }
18999
19299
  let smokeOk = false;
19000
19300
  try {
19001
- const out = execFileSync4("agt", ["--version"], { timeout: SELF_UPDATE_TIMEOUTS.smokeCheckMs, stdio: "pipe" }).toString();
19301
+ const out = execFileSync5("agt", ["--version"], { timeout: SELF_UPDATE_TIMEOUTS.smokeCheckMs, stdio: "pipe" }).toString();
19002
19302
  smokeOk = isAgtVersionSmokeOk(out, version);
19003
19303
  if (!smokeOk) {
19004
19304
  log(
@@ -19063,8 +19363,8 @@ function effectiveRuntimeAuthenticated() {
19063
19363
  async function maybeProbeClaudeRuntimeAuth() {
19064
19364
  if (runtimeAuthProbeInFlight) return;
19065
19365
  if (Date.now() - lastRuntimeAuthProbeAt < RUNTIME_AUTH_PROBE_INTERVAL_MS) return;
19066
- const { execFileSync: execFileSync4 } = await import("child_process");
19067
- if (!claudeBinaryInstalled(execFileSync4)) return;
19366
+ const { execFileSync: execFileSync5 } = await import("child_process");
19367
+ if (!claudeBinaryInstalled(execFileSync5)) return;
19068
19368
  runtimeAuthProbeInFlight = true;
19069
19369
  lastRuntimeAuthProbeAt = Date.now();
19070
19370
  try {
@@ -19163,8 +19463,8 @@ async function runHostUsageCommand() {
19163
19463
  }
19164
19464
  }
19165
19465
  async function maybePollHostUsageFromCycle() {
19166
- const { execFileSync: execFileSync4 } = await import("child_process");
19167
- if (!claudeBinaryInstalled(execFileSync4)) return;
19466
+ const { execFileSync: execFileSync5 } = await import("child_process");
19467
+ if (!claudeBinaryInstalled(execFileSync5)) return;
19168
19468
  await maybePollHostUsage({
19169
19469
  api,
19170
19470
  runUsageCommand: runHostUsageCommand,
@@ -19196,12 +19496,12 @@ async function checkClaudeAuth() {
19196
19496
  var evalEmptyMcpConfigPath = null;
19197
19497
  function ensureEvalEmptyMcpConfig() {
19198
19498
  if (evalEmptyMcpConfigPath && existsSync20(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
19199
- const dir = join47(homedir17(), ".augmented");
19499
+ const dir = join48(homedir17(), ".augmented");
19200
19500
  try {
19201
19501
  mkdirSync18(dir, { recursive: true });
19202
19502
  } catch {
19203
19503
  }
19204
- const p = join47(dir, ".eval-empty-mcp.json");
19504
+ const p = join48(dir, ".eval-empty-mcp.json");
19205
19505
  writeFileSync20(p, JSON.stringify({ mcpServers: {} }));
19206
19506
  evalEmptyMcpConfigPath = p;
19207
19507
  return p;
@@ -19292,10 +19592,10 @@ function resolveConversationEvalBackend() {
19292
19592
  return conversationEvalBackend;
19293
19593
  }
19294
19594
  function getStateFile() {
19295
- return join47(config?.configDir ?? join47(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
19595
+ return join48(config?.configDir ?? join48(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
19296
19596
  }
19297
19597
  function channelHashCacheDir() {
19298
- return config?.configDir ?? join47(process.env["HOME"] ?? "/tmp", ".augmented");
19598
+ return config?.configDir ?? join48(process.env["HOME"] ?? "/tmp", ".augmented");
19299
19599
  }
19300
19600
  function loadChannelHashCache2() {
19301
19601
  loadChannelHashCache(agentState.knownChannelConfigHashes, channelHashCacheDir());
@@ -19508,7 +19808,7 @@ function removeDeliveryBaselineEntries(agentId) {
19508
19808
  var _channelQuarantineStore = null;
19509
19809
  function channelQuarantineStore() {
19510
19810
  if (!_channelQuarantineStore) {
19511
- const dir = config?.configDir ?? join47(process.env["HOME"] ?? "/tmp", ".augmented");
19811
+ const dir = config?.configDir ?? join48(process.env["HOME"] ?? "/tmp", ".augmented");
19512
19812
  _channelQuarantineStore = new ChannelQuarantineStore(defaultQuarantinePath(dir));
19513
19813
  }
19514
19814
  return _channelQuarantineStore;
@@ -19516,7 +19816,7 @@ function channelQuarantineStore() {
19516
19816
  var _channelResumeHistoryStore = null;
19517
19817
  function channelResumeHistoryStore() {
19518
19818
  if (!_channelResumeHistoryStore) {
19519
- const dir = config?.configDir ?? join47(process.env["HOME"] ?? "/tmp", ".augmented");
19819
+ const dir = config?.configDir ?? join48(process.env["HOME"] ?? "/tmp", ".augmented");
19520
19820
  _channelResumeHistoryStore = new ChannelResumeHistoryStore(defaultResumeHistoryPath(dir));
19521
19821
  }
19522
19822
  return _channelResumeHistoryStore;
@@ -19561,12 +19861,12 @@ function sessionActivityFor(codeName, pane, opts = {}) {
19561
19861
  }
19562
19862
  function forwardedToolsFor(codeName) {
19563
19863
  if (!config?.configDir) return null;
19564
- return readForwardedToolsReport(join47(config.configDir, codeName));
19864
+ return readForwardedToolsReport(join48(config.configDir, codeName));
19565
19865
  }
19566
19866
  var _hostFlagStore = null;
19567
19867
  function hostFlagStore() {
19568
19868
  if (!_hostFlagStore) {
19569
- const dir = config?.configDir ?? join47(process.env["HOME"] ?? "/tmp", ".augmented");
19869
+ const dir = config?.configDir ?? join48(process.env["HOME"] ?? "/tmp", ".augmented");
19570
19870
  _hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
19571
19871
  }
19572
19872
  return _hostFlagStore;
@@ -19639,13 +19939,13 @@ function parseSkillFrontmatter(content) {
19639
19939
  return out;
19640
19940
  }
19641
19941
  async function refreshSkillsIndexInClaudeMd(configDir, codeName, log2) {
19642
- const { readdirSync: readdirSync15, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync21 } = await import("fs");
19643
- const skillsDir = join47(configDir, codeName, "project", ".claude", "skills");
19644
- const claudeMdPath = join47(configDir, codeName, "project", "CLAUDE.md");
19942
+ const { readdirSync: readdirSync16, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync21 } = await import("fs");
19943
+ const skillsDir = join48(configDir, codeName, "project", ".claude", "skills");
19944
+ const claudeMdPath = join48(configDir, codeName, "project", "CLAUDE.md");
19645
19945
  if (!ex(skillsDir) || !ex(claudeMdPath)) return;
19646
19946
  const entries = [];
19647
- for (const dir of readdirSync15(skillsDir).sort()) {
19648
- const skillFile = join47(skillsDir, dir, "SKILL.md");
19947
+ for (const dir of readdirSync16(skillsDir).sort()) {
19948
+ const skillFile = join48(skillsDir, dir, "SKILL.md");
19649
19949
  if (!ex(skillFile)) continue;
19650
19950
  try {
19651
19951
  const { name, description } = parseSkillFrontmatter(rfs(skillFile, "utf-8"));
@@ -19784,7 +20084,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
19784
20084
  if (codeNames.length === 0) return;
19785
20085
  void (async () => {
19786
20086
  try {
19787
- const { collectDiagnostics } = await import("../persistent-session-7VJJ4AD7.js");
20087
+ const { collectDiagnostics } = await import("../persistent-session-EJUOBWXJ.js");
19788
20088
  await api.post("/host/heartbeat", {
19789
20089
  host_id: hostId,
19790
20090
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -19927,7 +20227,7 @@ async function pollCycleInner() {
19927
20227
  }
19928
20228
  try {
19929
20229
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
19930
- const { collectDiagnostics } = await import("../persistent-session-7VJJ4AD7.js");
20230
+ const { collectDiagnostics } = await import("../persistent-session-EJUOBWXJ.js");
19931
20231
  const diagCodeNames = [...agentState.persistentSessionAgents];
19932
20232
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor) : void 0;
19933
20233
  let tailscaleHostname;
@@ -20198,7 +20498,7 @@ async function pollCycleInner() {
20198
20498
  }
20199
20499
  try {
20200
20500
  const desiredClaudeCodeVersion = hbResp?.desired_claude_code_version?.trim();
20201
- const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-NWNHKBJE.js");
20501
+ const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-EC3JMSNJ.js");
20202
20502
  const securityFloor = currentSecurityFloor();
20203
20503
  claudeUpdaterInFlight = true;
20204
20504
  if (desiredClaudeCodeVersion && (claudePairLoop.busy || claudePairingInProgress())) {
@@ -20233,7 +20533,7 @@ async function pollCycleInner() {
20233
20533
  collectPanelessActivityProbes,
20234
20534
  getResponsivenessIntervalMs,
20235
20535
  occupancyQualificationClassifications
20236
- } = await import("../responsiveness-probe-XGTPNCKO.js");
20536
+ } = await import("../responsiveness-probe-GBYZCGXX.js");
20237
20537
  const probeIntervalMs = getResponsivenessIntervalMs();
20238
20538
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
20239
20539
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -20350,7 +20650,7 @@ async function pollCycleInner() {
20350
20650
  collectResponsivenessProbes,
20351
20651
  livePendingInboundOldestAgeSeconds,
20352
20652
  parkPendingInbound
20353
- } = await import("../responsiveness-probe-XGTPNCKO.js");
20653
+ } = await import("../responsiveness-probe-GBYZCGXX.js");
20354
20654
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-5PCBGRNY.js");
20355
20655
  const wedgeNow = /* @__PURE__ */ new Date();
20356
20656
  const liveAgents = agentState.persistentSessionAgents;
@@ -20439,13 +20739,13 @@ async function pollCycleInner() {
20439
20739
  );
20440
20740
  if (hostFlagStore().getBoolean("wedge-transient-notice")) {
20441
20741
  try {
20442
- const paneTail = readFileSync38(paneLogPath(codeName), "utf8").slice(-65536);
20742
+ const paneTail = readFileSync39(paneLogPath(codeName), "utf8").slice(-65536);
20443
20743
  const transient = detectTransientApiErrorInLog(paneTail);
20444
20744
  if (transient) {
20445
- const wedgeHome = join47(homedir17(), ".augmented", codeName);
20745
+ const wedgeHome = join48(homedir17(), ".augmented", codeName);
20446
20746
  if (existsSync20(wedgeHome)) {
20447
20747
  atomicWriteFileSync(
20448
- join47(wedgeHome, "watchdog-give-up.json"),
20748
+ join48(wedgeHome, "watchdog-give-up.json"),
20449
20749
  JSON.stringify({
20450
20750
  gave_up_at: wedgeNow.toISOString(),
20451
20751
  reason: "transient_overload"
@@ -20636,7 +20936,7 @@ async function pollCycleInner() {
20636
20936
  }
20637
20937
  }
20638
20938
  );
20639
- const { parkPendingInbound } = await import("../responsiveness-probe-XGTPNCKO.js");
20939
+ const { parkPendingInbound } = await import("../responsiveness-probe-GBYZCGXX.js");
20640
20940
  const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
20641
20941
  paneFatalStreak.delete(codeName);
20642
20942
  paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
@@ -20667,7 +20967,7 @@ async function pollCycleInner() {
20667
20967
  TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
20668
20968
  bindSourceEscalations
20669
20969
  } = await import("../transcript-mount-health-OHE6IVJV.js");
20670
- const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-7VJJ4AD7.js");
20970
+ const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-EJUOBWXJ.js");
20671
20971
  const mountConfig = resolveTranscriptMountConfig();
20672
20972
  const liveAgents = agentState.persistentSessionAgents;
20673
20973
  for (const tracked of [
@@ -20832,7 +21132,7 @@ async function pollCycleInner() {
20832
21132
  }
20833
21133
  try {
20834
21134
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
20835
- const { probeSessionAuth } = await import("../session-auth-dead-4CCOVCU3.js");
21135
+ const { probeSessionAuth } = await import("../session-auth-dead-4U6NDCWN.js");
20836
21136
  const observations = [];
20837
21137
  const pendingCacheCommits = [];
20838
21138
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -21386,7 +21686,7 @@ async function pollCycleInner() {
21386
21686
  `[drain-flush] FAILED for '${prev.codeName}': ${err.message} \u2014 proceeding to teardown; this session was NOT shipped (ENG-9491)`
21387
21687
  );
21388
21688
  }
21389
- const agentDir = join47(adapter.getAgentDir(prev.codeName), "provision");
21689
+ const agentDir = join48(adapter.getAgentDir(prev.codeName), "provision");
21390
21690
  await cleanupAgentFiles(prev.codeName, agentDir);
21391
21691
  clearAgentCaches(prev.agentId, prev.codeName);
21392
21692
  }
@@ -21394,7 +21694,7 @@ async function pollCycleInner() {
21394
21694
  if (Date.now() - lastChannelSweepAt >= CHANNEL_SWEEP_INTERVAL_MS) {
21395
21695
  lastChannelSweepAt = Date.now();
21396
21696
  const agentCodeNames = new Set(
21397
- agentStates.map((a) => a.codeName).filter((c) => isolationMode(c) !== "docker")
21697
+ agentStates.map((a) => a.codeName).filter((c) => effectiveIsolationMode(c) !== "docker")
21398
21698
  );
21399
21699
  sweepChannelProcesses({
21400
21700
  agentCodeNames,
@@ -21465,10 +21765,10 @@ async function pollCycleInner() {
21465
21765
  // pending-inbound marker. Best-effort: a write failure is logged by
21466
21766
  // the watchdog, never fails the poll cycle.
21467
21767
  signalGiveUp: (codeName) => {
21468
- const dir = join47(homedir17(), ".augmented", codeName);
21768
+ const dir = join48(homedir17(), ".augmented", codeName);
21469
21769
  if (!existsSync20(dir)) return;
21470
21770
  atomicWriteFileSync(
21471
- join47(dir, "watchdog-give-up.json"),
21771
+ join48(dir, "watchdog-give-up.json"),
21472
21772
  JSON.stringify({ gave_up_at: (/* @__PURE__ */ new Date()).toISOString() })
21473
21773
  );
21474
21774
  },
@@ -21496,20 +21796,20 @@ async function pollCycleInner() {
21496
21796
  const dir = getFramework("claude-code").getAgentDir(codeName);
21497
21797
  if (!existsSync20(dir)) return;
21498
21798
  atomicWriteFileSync(
21499
- join47(dir, "blocked-prompt.json"),
21799
+ join48(dir, "blocked-prompt.json"),
21500
21800
  JSON.stringify({ kind, last_seen_at: (/* @__PURE__ */ new Date()).toISOString() })
21501
21801
  );
21502
21802
  },
21503
21803
  clearBlockedPromptLiveness: (codeName) => {
21504
- const file = join47(getFramework("claude-code").getAgentDir(codeName), "blocked-prompt.json");
21804
+ const file = join48(getFramework("claude-code").getAgentDir(codeName), "blocked-prompt.json");
21505
21805
  if (existsSync20(file)) rmSync9(file, { force: true });
21506
21806
  },
21507
21807
  refreshUsageLimitLiveness: (codeName) => {
21508
21808
  const dir = getFramework("claude-code").getAgentDir(codeName);
21509
- const file = join47(dir, "watchdog-give-up.json");
21809
+ const file = join48(dir, "watchdog-give-up.json");
21510
21810
  if (!existsSync20(file)) return;
21511
21811
  try {
21512
- const raw = JSON.parse(readFileSync38(file, "utf8"));
21812
+ const raw = JSON.parse(readFileSync39(file, "utf8"));
21513
21813
  if (raw["reason"] !== "usage_limit") return;
21514
21814
  raw["usage_limit_last_seen_at"] = (/* @__PURE__ */ new Date()).toISOString();
21515
21815
  atomicWriteFileSync(file, JSON.stringify(raw));
@@ -21520,7 +21820,7 @@ async function pollCycleInner() {
21520
21820
  const dir = getFramework("claude-code").getAgentDir(codeName);
21521
21821
  if (!existsSync20(dir)) return;
21522
21822
  atomicWriteFileSync(
21523
- join47(dir, "watchdog-give-up.json"),
21823
+ join48(dir, "watchdog-give-up.json"),
21524
21824
  JSON.stringify({
21525
21825
  gave_up_at: (/* @__PURE__ */ new Date()).toISOString(),
21526
21826
  reason: "usage_limit",
@@ -21797,7 +22097,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
21797
22097
  }
21798
22098
  const now = (/* @__PURE__ */ new Date()).toISOString();
21799
22099
  const adapter = resolveAgentFramework(agent.code_name);
21800
- let agentDir = join47(adapter.getAgentDir(agent.code_name), "provision");
22100
+ let agentDir = join48(adapter.getAgentDir(agent.code_name), "provision");
21801
22101
  if (agent.status === "draft" || agent.status === "paused") {
21802
22102
  forgetChannelSyncState(agent.agent_id);
21803
22103
  reapLegacyTokenFileEdgeWarned(agent.code_name, log);
@@ -21945,7 +22245,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
21945
22245
  if (refreshData.knowledge_manifest) {
21946
22246
  const resolved = await resolveKnowledgeFromManifest({
21947
22247
  manifest: refreshData.knowledge_manifest,
21948
- cacheDir: join47(config.configDir, "_knowledge"),
22248
+ cacheDir: join48(config.configDir, "_knowledge"),
21949
22249
  delivery: refreshData.agent?.knowledge_delivery ?? "both",
21950
22250
  fetchContents: async (hashes) => {
21951
22251
  const res = await api.post(
@@ -21962,7 +22262,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
21962
22262
  const resolvedSkills = await resolveSkillsFromManifest({
21963
22263
  globals: refreshData.global_skills_manifest ?? [],
21964
22264
  shared: refreshData.shared_skills_manifest ?? [],
21965
- cacheDir: join47(config.configDir, "_skills"),
22265
+ cacheDir: join48(config.configDir, "_skills"),
21966
22266
  fetchContents: async (hashes) => {
21967
22267
  const res = await api.post(
21968
22268
  "/host/skills/contents",
@@ -21980,7 +22280,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
21980
22280
  if (refreshData.integration_skills_manifest) {
21981
22281
  const resolvedIntegrationSkills = await resolveIntegrationSkillsFromManifest({
21982
22282
  manifest: refreshData.integration_skills_manifest,
21983
- cacheDir: join47(config.configDir, "_skills"),
22283
+ cacheDir: join48(config.configDir, "_skills"),
21984
22284
  fetchContents: async (hashes) => {
21985
22285
  const res = await api.post(
21986
22286
  "/host/skills/contents",
@@ -22042,7 +22342,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
22042
22342
  const frameworkId = refreshData.agent.framework ?? DEFAULT_FRAMEWORK;
22043
22343
  agentFrameworkCache.set(agent.code_name, frameworkId);
22044
22344
  const frameworkAdapter = getFramework(frameworkId);
22045
- agentDir = join47(frameworkAdapter.getAgentDir(agent.code_name), "provision");
22345
+ agentDir = join48(frameworkAdapter.getAgentDir(agent.code_name), "provision");
22046
22346
  cacheAgentDeliveryMetadata(agent.code_name, refreshData);
22047
22347
  agentRestartTimezoneInputs.set(agent.code_name, {
22048
22348
  agentTimezone: typeof refreshData.agent.timezone === "string" ? refreshData.agent.timezone : null,
@@ -22120,7 +22420,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
22120
22420
  const changedFiles = [];
22121
22421
  mkdirSync18(agentDir, { recursive: true });
22122
22422
  for (const artifact of artifacts) {
22123
- const filePath = join47(agentDir, artifact.relativePath);
22423
+ const filePath = join48(agentDir, artifact.relativePath);
22124
22424
  let existingHash;
22125
22425
  let newHash;
22126
22426
  let writeContent = artifact.content;
@@ -22139,8 +22439,8 @@ async function processAgent(agent, agentStates, managedToolkits) {
22139
22439
  };
22140
22440
  newHash = sha256(stripDynamicSections(artifact.content));
22141
22441
  try {
22142
- const projectClaudeMd = join47(config.configDir, agent.code_name, "project", "CLAUDE.md");
22143
- const existing = readFileSync38(projectClaudeMd, "utf-8");
22442
+ const projectClaudeMd = join48(config.configDir, agent.code_name, "project", "CLAUDE.md");
22443
+ const existing = readFileSync39(projectClaudeMd, "utf-8");
22144
22444
  existingHash = sha256(stripDynamicSections(existing));
22145
22445
  } catch {
22146
22446
  existingHash = null;
@@ -22158,7 +22458,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
22158
22458
  const generatorKeys = Object.keys(generatorServers);
22159
22459
  let existingRaw = "";
22160
22460
  try {
22161
- existingRaw = readFileSync38(filePath, "utf-8");
22461
+ existingRaw = readFileSync39(filePath, "utf-8");
22162
22462
  } catch {
22163
22463
  }
22164
22464
  const existingServers = parseMcp(existingRaw);
@@ -22174,7 +22474,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
22174
22474
  } else if (artifact.relativePath === "opencode.json") {
22175
22475
  let existingRaw = null;
22176
22476
  try {
22177
- existingRaw = readFileSync38(filePath, "utf-8");
22477
+ existingRaw = readFileSync39(filePath, "utf-8");
22178
22478
  } catch {
22179
22479
  }
22180
22480
  const mergeResult = mergeOpencodeConfigArtifact(artifact.content, existingRaw);
@@ -22190,12 +22490,12 @@ async function processAgent(agent, agentStates, managedToolkits) {
22190
22490
  }
22191
22491
  }
22192
22492
  if (changedFiles.length > 0) {
22193
- const isFirst = !existsSync20(join47(agentDir, "CHARTER.md"));
22493
+ const isFirst = !existsSync20(join48(agentDir, "CHARTER.md"));
22194
22494
  const verb = isFirst ? "Provisioning" : "Updating";
22195
22495
  const fileNames = changedFiles.map((f) => f.relativePath).join(", ");
22196
22496
  log(`${verb} '${agent.code_name}': ${fileNames}`);
22197
22497
  for (const file of changedFiles) {
22198
- const filePath = join47(agentDir, file.relativePath);
22498
+ const filePath = join48(agentDir, file.relativePath);
22199
22499
  mkdirSync18(dirname11(filePath), { recursive: true });
22200
22500
  if (file.relativePath === ".mcp.json") {
22201
22501
  safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
@@ -22204,12 +22504,12 @@ async function processAgent(agent, agentStates, managedToolkits) {
22204
22504
  }
22205
22505
  }
22206
22506
  try {
22207
- const provSkillsDir = join47(agentDir, ".claude", "skills");
22507
+ const provSkillsDir = join48(agentDir, ".claude", "skills");
22208
22508
  if (existsSync20(provSkillsDir)) {
22209
- for (const folder of readdirSync14(provSkillsDir)) {
22509
+ for (const folder of readdirSync15(provSkillsDir)) {
22210
22510
  if (folder.startsWith("knowledge-")) {
22211
22511
  try {
22212
- rmSync9(join47(provSkillsDir, folder), { recursive: true });
22512
+ rmSync9(join48(provSkillsDir, folder), { recursive: true });
22213
22513
  } catch {
22214
22514
  }
22215
22515
  }
@@ -22222,7 +22522,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
22222
22522
  const trackedFiles2 = frameworkAdapter.driftTrackedFiles();
22223
22523
  const hashes = /* @__PURE__ */ new Map();
22224
22524
  for (const file of trackedFiles2) {
22225
- const h = hashFile(join47(agentDir, file));
22525
+ const h = hashFile(join48(agentDir, file));
22226
22526
  if (h) hashes.set(file, h);
22227
22527
  }
22228
22528
  agentState.writtenHashes.set(agent.agent_id, hashes);
@@ -22240,14 +22540,14 @@ async function processAgent(agent, agentStates, managedToolkits) {
22240
22540
  }
22241
22541
  if (Array.isArray(refreshData.workflows)) {
22242
22542
  try {
22243
- const provWorkflowsDir = join47(agentDir, ".claude", "workflows");
22543
+ const provWorkflowsDir = join48(agentDir, ".claude", "workflows");
22244
22544
  if (existsSync20(provWorkflowsDir)) {
22245
22545
  const expected = new Set(refreshData.workflows.map((w) => `${w.name}.js`));
22246
- for (const file of readdirSync14(provWorkflowsDir)) {
22546
+ for (const file of readdirSync15(provWorkflowsDir)) {
22247
22547
  if (!file.endsWith(".js")) continue;
22248
22548
  if (expected.has(file)) continue;
22249
22549
  try {
22250
- rmSync9(join47(provWorkflowsDir, file));
22550
+ rmSync9(join48(provWorkflowsDir, file));
22251
22551
  } catch {
22252
22552
  }
22253
22553
  }
@@ -22342,7 +22642,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
22342
22642
  if (written && existsSync20(agentDir)) {
22343
22643
  const driftedFiles = [];
22344
22644
  for (const [file, expectedHash] of written) {
22345
- const localHash = hashFile(join47(agentDir, file));
22645
+ const localHash = hashFile(join48(agentDir, file));
22346
22646
  if (localHash && localHash !== expectedHash) {
22347
22647
  driftedFiles.push(file);
22348
22648
  }
@@ -22353,7 +22653,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
22353
22653
  try {
22354
22654
  const localHashes = {};
22355
22655
  for (const file of driftedFiles) {
22356
- localHashes[file] = hashFile(join47(agentDir, file));
22656
+ localHashes[file] = hashFile(join48(agentDir, file));
22357
22657
  }
22358
22658
  await api.post("/host/drift", {
22359
22659
  agent_id: agent.agent_id,
@@ -22638,7 +22938,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
22638
22938
  const addedChannels = [...restartDecision.added];
22639
22939
  const writeDmNoticeMarkers = isChannelAddRestart ? () => {
22640
22940
  try {
22641
- const agentAugmentedDir = join47(homedir17(), ".augmented", agent.code_name);
22941
+ const agentAugmentedDir = join48(homedir17(), ".augmented", agent.code_name);
22642
22942
  mkdirSync18(agentAugmentedDir, { recursive: true });
22643
22943
  const markerJson = JSON.stringify({
22644
22944
  version: 1,
@@ -22646,7 +22946,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
22646
22946
  added: addedChannels
22647
22947
  });
22648
22948
  for (const file of ["slack-channel-add-restart.json", "telegram-channel-add-restart.json"]) {
22649
- atomicWriteFileSync(join47(agentAugmentedDir, file), markerJson);
22949
+ atomicWriteFileSync(join48(agentAugmentedDir, file), markerJson);
22650
22950
  }
22651
22951
  } catch (err) {
22652
22952
  log(`[hot-reload] channel-add DM-notice marker write failed for '${agent.code_name}' (non-fatal): ${err.message}`);
@@ -22950,18 +23250,18 @@ async function processAgent(agent, agentStates, managedToolkits) {
22950
23250
  if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code") {
22951
23251
  try {
22952
23252
  const agentProvisionDir = agentDir;
22953
- const projectDir = join47(homedir17(), ".augmented", agent.code_name, "project");
23253
+ const projectDir = join48(homedir17(), ".augmented", agent.code_name, "project");
22954
23254
  mkdirSync18(agentProvisionDir, { recursive: true });
22955
23255
  mkdirSync18(projectDir, { recursive: true });
22956
- const provisionMcpPath = join47(agentProvisionDir, ".mcp.json");
22957
- const projectMcpPath = join47(projectDir, ".mcp.json");
23256
+ const provisionMcpPath = join48(agentProvisionDir, ".mcp.json");
23257
+ const projectMcpPath = join48(projectDir, ".mcp.json");
22958
23258
  let mcpConfig = { mcpServers: {} };
22959
23259
  try {
22960
- mcpConfig = JSON.parse(readFileSync38(provisionMcpPath, "utf-8"));
23260
+ mcpConfig = JSON.parse(readFileSync39(provisionMcpPath, "utf-8"));
22961
23261
  if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
22962
23262
  } catch {
22963
23263
  }
22964
- const localDirectChatChannel = join47(homedir17(), ".augmented", "_mcp", "direct-chat-channel.js");
23264
+ const localDirectChatChannel = join48(homedir17(), ".augmented", "_mcp", "direct-chat-channel.js");
22965
23265
  const directChatTeamSettings = refreshData.team?.settings;
22966
23266
  const directChatTz = (() => {
22967
23267
  const tz = directChatTeamSettings?.["timezone"];
@@ -22987,7 +23287,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
22987
23287
  // ~/.augmented/<codeName>/.current-turn-initiator.json. Note getAgentDir
22988
23288
  // returns the agent root (NOT the /provision subdir `agentDir` points at),
22989
23289
  // so it byte-matches the broker readers' path.
22990
- AGT_TURN_INITIATOR_FILE: join47(
23290
+ AGT_TURN_INITIATOR_FILE: join48(
22991
23291
  frameworkAdapter.getAgentDir(agent.code_name),
22992
23292
  ".current-turn-initiator.json"
22993
23293
  )
@@ -23007,7 +23307,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
23007
23307
  log(`Channel credentials written for '${agent.code_name}/direct-chat'`);
23008
23308
  }
23009
23309
  }
23010
- const staleChannelsPath = join47(projectDir, ".mcp-channels.json");
23310
+ const staleChannelsPath = join48(projectDir, ".mcp-channels.json");
23011
23311
  if (existsSync20(staleChannelsPath)) {
23012
23312
  try {
23013
23313
  rmSync9(staleChannelsPath, { force: true });
@@ -23135,7 +23435,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
23135
23435
  }
23136
23436
  if (hostFlagStore().getBoolean("connectivity-probe")) {
23137
23437
  try {
23138
- const probeProjectDir = join47(homedir17(), ".augmented", agent.code_name, "project");
23438
+ const probeProjectDir = join48(homedir17(), ".augmented", agent.code_name, "project");
23139
23439
  let probeSet = integrations;
23140
23440
  const fetchQuarantined = async () => {
23141
23441
  const quarantined = await api.post("/host/agent-integrations/quarantined", { agent_id: agent.agent_id });
@@ -23195,7 +23495,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
23195
23495
  const forceDue = attemptsLeft > 0;
23196
23496
  let probeRan = false;
23197
23497
  try {
23198
- const probeProjectDir = join47(homedir17(), ".augmented", agent.code_name, "project");
23498
+ const probeProjectDir = join48(homedir17(), ".augmented", agent.code_name, "project");
23199
23499
  const renderPending = integrationRenderPending(
23200
23500
  integrations,
23201
23501
  agentState.knownIntegrationHashes.get(agent.agent_id)
@@ -23324,11 +23624,11 @@ async function processAgent(agent, agentStates, managedToolkits) {
23324
23624
  const intHash = computeIntegrationsHash(integrations);
23325
23625
  const prevIntHash = agentState.knownIntegrationHashes.get(agent.agent_id);
23326
23626
  if (intHash !== prevIntHash) {
23327
- const projectDir = join47(homedir17(), ".augmented", agent.code_name, "project");
23328
- const envIntPath = join47(projectDir, ".env.integrations");
23627
+ const projectDir = join48(homedir17(), ".augmented", agent.code_name, "project");
23628
+ const envIntPath = join48(projectDir, ".env.integrations");
23329
23629
  let preWriteEnv;
23330
23630
  try {
23331
- preWriteEnv = readFileSync38(envIntPath, "utf-8");
23631
+ preWriteEnv = readFileSync39(envIntPath, "utf-8");
23332
23632
  } catch {
23333
23633
  preWriteEnv = void 0;
23334
23634
  }
@@ -23356,9 +23656,9 @@ async function processAgent(agent, agentStates, managedToolkits) {
23356
23656
  }
23357
23657
  if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
23358
23658
  try {
23359
- const projectMcpPath = join47(projectDir, ".mcp.json");
23360
- const postWriteEnv = readFileSync38(envIntPath, "utf-8");
23361
- const mcpContent = readFileSync38(projectMcpPath, "utf-8");
23659
+ const projectMcpPath = join48(projectDir, ".mcp.json");
23660
+ const postWriteEnv = readFileSync39(envIntPath, "utf-8");
23661
+ const mcpContent = readFileSync39(projectMcpPath, "utf-8");
23362
23662
  const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
23363
23663
  const mcpJsonForReap = JSON.parse(mcpContent);
23364
23664
  const affectedServerKeys = findMcpServersUsingVars(mcpJsonForReap, changedVars);
@@ -23371,7 +23671,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
23371
23671
  // ENG-6670: enumerate + signal in the container PID namespace
23372
23672
  // for Docker-isolated agents (host ps can't see in-container
23373
23673
  // children; a host kill on a container pid would be wrong).
23374
- isolated: isolationMode(agent.code_name) === "docker"
23674
+ isolated: effectiveIsolationMode(agent.code_name) === "docker"
23375
23675
  });
23376
23676
  }
23377
23677
  const liveProxyVars = /* @__PURE__ */ new Set([
@@ -23706,23 +24006,23 @@ async function processAgent(agent, agentStates, managedToolkits) {
23706
24006
  }
23707
24007
  }
23708
24008
  try {
23709
- const { readdirSync: readdirSync15, rmSync: rmSync10 } = await import("fs");
24009
+ const { readdirSync: readdirSync16, rmSync: rmSync10 } = await import("fs");
23710
24010
  const { homedir: homedir18 } = await import("os");
23711
24011
  const frameworkId2 = frameworkAdapter.id;
23712
24012
  const candidateSkillDirs = [
23713
24013
  // Claude Code — framework runtime tree
23714
- join47(homedir18(), ".augmented", agent.code_name, "skills"),
24014
+ join48(homedir18(), ".augmented", agent.code_name, "skills"),
23715
24015
  // Claude Code — project tree
23716
- join47(homedir18(), ".augmented", agent.code_name, "project", ".claude", "skills"),
24016
+ join48(homedir18(), ".augmented", agent.code_name, "project", ".claude", "skills"),
23717
24017
  // Defensive: legacy provision-side path, not currently an
23718
24018
  // install target but cheap to sweep.
23719
- join47(agentDir, ".claude", "skills")
24019
+ join48(agentDir, ".claude", "skills")
23720
24020
  ];
23721
24021
  const existingDirs = candidateSkillDirs.filter((d) => existsSync20(d));
23722
24022
  const discoveredEntries = /* @__PURE__ */ new Set();
23723
24023
  for (const dir of existingDirs) {
23724
24024
  try {
23725
- for (const entry of readdirSync15(dir)) {
24025
+ for (const entry of readdirSync16(dir)) {
23726
24026
  if (entry.startsWith("plugin-") || entry.startsWith("integration-")) {
23727
24027
  discoveredEntries.add(entry);
23728
24028
  }
@@ -23759,7 +24059,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
23759
24059
  const sharedSkillsPayload = refreshAny.shared_skills;
23760
24060
  const desiredResolved = globalSkillsPayload !== void 0 || sharedSkillsPayload !== void 0;
23761
24061
  const manifestPath = managedSkillManifestPath(
23762
- join47(homedir17(), ".augmented", agent.code_name)
24062
+ join48(homedir17(), ".augmented", agent.code_name)
23763
24063
  );
23764
24064
  const prevIds = /* @__PURE__ */ new Set([
23765
24065
  ...agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
@@ -23779,15 +24079,15 @@ async function processAgent(agent, agentStates, managedToolkits) {
23779
24079
  }
23780
24080
  if (plan.removes.length) {
23781
24081
  const globalSkillDirs = [
23782
- join47(homedir17(), ".augmented", agent.code_name, "skills"),
23783
- join47(homedir17(), ".augmented", agent.code_name, "project", ".claude", "skills"),
23784
- join47(agentDir, ".claude", "skills")
24082
+ join48(homedir17(), ".augmented", agent.code_name, "skills"),
24083
+ join48(homedir17(), ".augmented", agent.code_name, "project", ".claude", "skills"),
24084
+ join48(agentDir, ".claude", "skills")
23785
24085
  ];
23786
24086
  for (const id of plan.removes) {
23787
24087
  let prunedAny = false;
23788
24088
  for (const dir of globalSkillDirs) {
23789
- const p = join47(dir, id);
23790
- if (existsSync20(p) && existsSync20(join47(p, "SKILL.md"))) {
24089
+ const p = join48(dir, id);
24090
+ if (existsSync20(p) && existsSync20(join48(p, "SKILL.md"))) {
23791
24091
  rmSync9(p, { recursive: true, force: true });
23792
24092
  prunedAny = true;
23793
24093
  }
@@ -24063,7 +24363,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
24063
24363
  );
24064
24364
  } catch {
24065
24365
  }
24066
- const computerUseIsolated = isolationMode(agent.code_name) === "docker";
24366
+ const computerUseIsolated = effectiveIsolationMode(agent.code_name) === "docker";
24067
24367
  const computerUseVerdict = computerUseTunnels.observe(
24068
24368
  agent.code_name,
24069
24369
  mcpJsonParsed?.mcpServers?.[COMPUTER_USE_MCP_KEY]?.args,
@@ -24573,7 +24873,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
24573
24873
  if (trackedFiles.length > 0 && existsSync20(agentDir)) {
24574
24874
  const hashes = /* @__PURE__ */ new Map();
24575
24875
  for (const file of trackedFiles) {
24576
- const h = hashFile(join47(agentDir, file));
24876
+ const h = hashFile(join48(agentDir, file));
24577
24877
  if (h) hashes.set(file, h);
24578
24878
  }
24579
24879
  agentState.writtenHashes.set(agent.agent_id, hashes);
@@ -24588,7 +24888,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
24588
24888
  refreshData.agent.onboarding_state
24589
24889
  );
24590
24890
  const obStep = obState.step;
24591
- const markerPath = join47(homedir17(), ".augmented", agent.code_name, "onboarding-drive.json");
24891
+ const markerPath = join48(homedir17(), ".augmented", agent.code_name, "onboarding-drive.json");
24592
24892
  const marker = readOnboardingDriveMarker(markerPath);
24593
24893
  const obContactRaw = refreshData.agent.manager_last_contacted_at;
24594
24894
  const obContact = typeof obContactRaw === "string" && obContactRaw ? obContactRaw : null;
@@ -24721,7 +25021,7 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
24721
25021
  }
24722
25022
  stopOpencodeSlackIngest(codeName, log);
24723
25023
  stopOpencodeTelegramIngest(codeName, log);
24724
- const opencodeProjectDir = join47(getFramework("opencode").getAgentDir(codeName), "provision");
25024
+ const opencodeProjectDir = join48(getFramework("opencode").getAgentDir(codeName), "provision");
24725
25025
  const serveEnv = {
24726
25026
  AGT_HOST: requireHost(),
24727
25027
  AGT_API_KEY: getApiKey() ?? void 0,
@@ -24744,6 +25044,9 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
24744
25044
  // ADR-0047: the opencode container launcher is not built, so the launcher
24745
25045
  // refuses to spawn under Docker isolation rather than run unisolated on a
24746
25046
  // multi-tenant host. Single-agent / dedicated hosts (isolation off) run bare.
25047
+ // isolation-intent: the REQUEST is the right signal here. With isolation
25048
+ // requested, opencode must refuse rather than run unisolated on a
25049
+ // multi-tenant host, even when Docker is unusable (ADR-0047).
24747
25050
  isolated: isolationMode(codeName) === "docker",
24748
25051
  log
24749
25052
  });
@@ -24792,8 +25095,8 @@ async function ensurePersistentSessionUnchecked(agent, tasks, boardItems, refres
24792
25095
  });
24793
25096
  }
24794
25097
  const projectDir = getProjectDir(codeName);
24795
- const mcpConfigPath = join47(projectDir, ".mcp.json");
24796
- const claudeMdPath = join47(projectDir, "CLAUDE.md");
25098
+ const mcpConfigPath = join48(projectDir, ".mcp.json");
25099
+ const claudeMdPath = join48(projectDir, "CLAUDE.md");
24797
25100
  if (restartBreaker.isTripped(codeName)) {
24798
25101
  const trip = restartBreaker.getTrip(codeName);
24799
25102
  return {
@@ -24835,7 +25138,21 @@ async function ensurePersistentSessionUnchecked(agent, tasks, boardItems, refres
24835
25138
  // Obi Wan 417cd9e6ce9a: under 'reload-confirm', which /host/reaper-event
24836
25139
  // accepts (REAPER_EVENT_ALLOWLIST); an unlisted reaper name is a 400 and
24837
25140
  // the alert would never open.
24838
- alert: (_code, reason) => void reportReaperEvent(agent.agent_id, "reload-confirm", "alert", reason)
25141
+ alert: (_code, reason) => void reportReaperEvent(agent.agent_id, "reload-confirm", "alert", reason),
25142
+ // ENG-11871 (Sherlock's option A on #7365): under Docker isolation with
25143
+ // the container absent, stop a host claude (and its channel MCPs) left
25144
+ // from before the move. Each signal is a reload-confirm 'alert' reaper
25145
+ // event (a signal SENT, not a confirmed exit: CodeRabbit on #7365), so
25146
+ // prod can count them.
25147
+ scanHostStragglers,
25148
+ killHostStragglers,
25149
+ signalledHostPids,
25150
+ reportHostKill: (_code, root, signal, sent) => void reportReaperEvent(
25151
+ agent.agent_id,
25152
+ "reload-confirm",
25153
+ "alert",
25154
+ `HOST_STRAGGLER_KILL: ${sent ? "sent" : "FAILED to send"} SIG${signal} to host pid ${root.pid} (${root.argv0}), left from before the move to Docker isolation; the container starts once it has exited (ENG-11871)`
25155
+ )
24839
25156
  });
24840
25157
  if (gate === "spawn-unknown" && effectiveIsolationMode(codeName) !== "docker") reloadBlindSpawns.add(codeName);
24841
25158
  else if (gate !== "defer") reloadBlindSpawns.delete(codeName);
@@ -25148,7 +25465,7 @@ async function ensurePersistentSessionUnchecked(agent, tasks, boardItems, refres
25148
25465
  }
25149
25466
  if (restartTrigger === null) {
25150
25467
  try {
25151
- const recycleMode = isolationMode(codeName) === "docker" ? "container" : "host";
25468
+ const recycleMode = effectiveIsolationMode(codeName) === "docker" ? "container" : "host";
25152
25469
  const recycleSessionHealthy = isSessionHealthy(codeName);
25153
25470
  const recycleCurrent = recycleSessionHealthy ? peekCurrentSession(codeName) : null;
25154
25471
  const recycleIdle = recycleCurrent ? isAgentIdle(projectDir, recycleCurrent.sessionId) : false;
@@ -25808,8 +26125,8 @@ async function managerRestartMayKill(agentId, codeName, requestedAt, lane, frame
25808
26125
  pane.tmuxAlive === null ? null : sessionActivityFor(codeName, { tmuxAlive: pane.tmuxAlive, screenCapture: pane.screenCapture }, { fresh: true })
25809
26126
  );
25810
26127
  }
25811
- if (verdict.kill && isolationMode(codeName) !== "docker") {
25812
- const dc = readDirectChatInflight(join47(homedir17(), ".augmented", agentId));
26128
+ if (verdict.kill && effectiveIsolationMode(codeName) !== "docker") {
26129
+ const dc = readDirectChatInflight(join48(homedir17(), ".augmented", agentId));
25813
26130
  if (dc.inFlight) {
25814
26131
  verdict = { kill: false, reason: "direct_chat_in_flight", runningBackgroundTasks: null };
25815
26132
  log(`[${lane}] manager restart for '${codeName}': ${dc.ids.length} Direct Chat message(s) claimed and not yet answered [ENG-12100]`);
@@ -25883,7 +26200,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
25883
26200
  if (!refreshData) return;
25884
26201
  const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
25885
26202
  const hostId = await getHostId();
25886
- const parkForRestart = await import("../responsiveness-probe-XGTPNCKO.js").then(
26203
+ const parkForRestart = await import("../responsiveness-probe-GBYZCGXX.js").then(
25887
26204
  (m) => m.parkPendingInbound,
25888
26205
  (err) => err
25889
26206
  );
@@ -25960,7 +26277,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
25960
26277
  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}`));
25961
26278
  void (async () => {
25962
26279
  try {
25963
- const { collectDiagnostics } = await import("../persistent-session-7VJJ4AD7.js");
26280
+ const { collectDiagnostics } = await import("../persistent-session-EJUOBWXJ.js");
25964
26281
  await api.post("/host/heartbeat", {
25965
26282
  host_id: hostId,
25966
26283
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -26013,7 +26330,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
26013
26330
  }
26014
26331
  try {
26015
26332
  const hostId = await getHostId();
26016
- const { collectDiagnostics } = await import("../persistent-session-7VJJ4AD7.js");
26333
+ const { collectDiagnostics } = await import("../persistent-session-EJUOBWXJ.js");
26017
26334
  await api.post("/host/heartbeat", {
26018
26335
  host_id: hostId,
26019
26336
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -26446,7 +26763,7 @@ async function processDirectChatMessage(agent, msg) {
26446
26763
  }
26447
26764
  }
26448
26765
  if (!blockedOnPrompt && isSessionHealthy(agent.codeName)) {
26449
- const useDoorbell = hostFlagStore().getBoolean("direct-chat-doorbell") || isolationMode(agent.codeName) === "docker";
26766
+ const useDoorbell = hostFlagStore().getBoolean("direct-chat-doorbell") || effectiveIsolationMode(agent.codeName) === "docker";
26450
26767
  if (useDoorbell) {
26451
26768
  try {
26452
26769
  const doorbell = directChatDoorbellPath(agent.agentId, homedir17());
@@ -26455,7 +26772,7 @@ async function processDirectChatMessage(agent, msg) {
26455
26772
  log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
26456
26773
  return;
26457
26774
  } catch (err) {
26458
- if (isolationMode(agent.codeName) === "docker") {
26775
+ if (effectiveIsolationMode(agent.codeName) === "docker") {
26459
26776
  log(`[direct-chat] Doorbell ring failed for isolated '${agent.codeName}' (msg=${msg.id}): ${err.message} \u2014 leaving pending for the in-session safety-net poll`);
26460
26777
  return;
26461
26778
  }
@@ -26740,7 +27057,7 @@ async function processClaudePairSessions(agents) {
26740
27057
  snapshotPairConfig,
26741
27058
  // ENG-11659: result -> report body + the manager.log line that records it.
26742
27059
  planPairStartReport
26743
- } = await import("../claude-pair-runtime-EMBJDR4W.js");
27060
+ } = await import("../claude-pair-runtime-NPBFKJSQ.js");
26744
27061
  const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
26745
27062
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
26746
27063
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
@@ -27039,17 +27356,17 @@ var lastLocalFileHash = /* @__PURE__ */ new Map();
27039
27356
  var lastMemoriesBody = /* @__PURE__ */ new Map();
27040
27357
  var memoryManifests = /* @__PURE__ */ new Map();
27041
27358
  function memoryRetirementDir(configDir, codeName) {
27042
- return join47(configDir, "_memory-retirement", codeName);
27359
+ return join48(configDir, "_memory-retirement", codeName);
27043
27360
  }
27044
27361
  function memoryManifestPath(configDir, codeName) {
27045
- return join47(memoryRetirementDir(configDir, codeName), "manifest.json");
27362
+ return join48(memoryRetirementDir(configDir, codeName), "manifest.json");
27046
27363
  }
27047
27364
  function loadMemoryManifest(agentId, configDir, codeName) {
27048
27365
  const cached = memoryManifests.get(agentId);
27049
27366
  if (cached) return cached;
27050
27367
  let manifest = {};
27051
27368
  try {
27052
- const raw = readFileSync38(memoryManifestPath(configDir, codeName), "utf-8");
27369
+ const raw = readFileSync39(memoryManifestPath(configDir, codeName), "utf-8");
27053
27370
  const parsed = JSON.parse(raw);
27054
27371
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
27055
27372
  for (const [name, entry] of Object.entries(parsed)) {
@@ -27077,7 +27394,7 @@ function saveMemoryManifest(agentId, configDir, codeName) {
27077
27394
  }
27078
27395
  }
27079
27396
  function retiredMemoryDir(configDir, codeName) {
27080
- return join47(memoryRetirementDir(configDir, codeName), "retired");
27397
+ return join48(memoryRetirementDir(configDir, codeName), "retired");
27081
27398
  }
27082
27399
  var RETIRED_MEMORY_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
27083
27400
  var lastRetirementReport = /* @__PURE__ */ new Map();
@@ -27156,7 +27473,7 @@ function applyMemoryTombstones(opts) {
27156
27473
  log2(`[memory-retire] ${agent.code_name}: KEPT '${tomb.name}' \u2014 no write record, not ours to remove`);
27157
27474
  continue;
27158
27475
  }
27159
- const filePath = join47(memoryDir, entry.file);
27476
+ const filePath = join48(memoryDir, entry.file);
27160
27477
  if (!existsSync20(filePath)) {
27161
27478
  outcomes.already_gone++;
27162
27479
  delete manifest[tomb.name];
@@ -27164,7 +27481,7 @@ function applyMemoryTombstones(opts) {
27164
27481
  continue;
27165
27482
  }
27166
27483
  try {
27167
- const actual = createHash21("sha256").update(readFileSync38(filePath)).digest("hex");
27484
+ const actual = createHash21("sha256").update(readFileSync39(filePath)).digest("hex");
27168
27485
  if (actual !== entry.sha) {
27169
27486
  outcomes.kept_modified++;
27170
27487
  outcomes.unapplied.push({ name: tomb.name, reason: "kept_modified" });
@@ -27176,9 +27493,9 @@ function applyMemoryTombstones(opts) {
27176
27493
  const destDir = retiredMemoryDir(configDir, agent.code_name);
27177
27494
  mkdirSync18(destDir, { recursive: true });
27178
27495
  const stamp = Date.now();
27179
- let dest = join47(destDir, `${entry.file}.${stamp}.retired`);
27496
+ let dest = join48(destDir, `${entry.file}.${stamp}.retired`);
27180
27497
  for (let n = 1; existsSync20(dest); n++) {
27181
- dest = join47(destDir, `${entry.file}.${stamp}-${n}.retired`);
27498
+ dest = join48(destDir, `${entry.file}.${stamp}-${n}.retired`);
27182
27499
  }
27183
27500
  renameSync12(filePath, dest);
27184
27501
  try {
@@ -27215,9 +27532,9 @@ function reapRetiredMemories(configDir, codeName, log2) {
27215
27532
  const cutoff = Date.now() - RETIRED_MEMORY_TTL_MS;
27216
27533
  let reaped = 0;
27217
27534
  try {
27218
- for (const file of readdirSync14(dir)) {
27535
+ for (const file of readdirSync15(dir)) {
27219
27536
  if (!file.endsWith(".retired")) continue;
27220
- const path = join47(dir, file);
27537
+ const path = join48(dir, file);
27221
27538
  try {
27222
27539
  if (statSync15(path).mtimeMs < cutoff) {
27223
27540
  unlinkSync6(path);
@@ -27232,8 +27549,8 @@ function reapRetiredMemories(configDir, codeName, log2) {
27232
27549
  if (reaped > 0) log2(`[memory-retire] ${codeName}: reaped ${reaped} retired memory file(s) past TTL`);
27233
27550
  }
27234
27551
  async function syncMemories(agent, configDir, log2) {
27235
- const projectDir = join47(configDir, agent.code_name, "project");
27236
- const memoryDir = join47(projectDir, "memory");
27552
+ const projectDir = join48(configDir, agent.code_name, "project");
27553
+ const memoryDir = join48(projectDir, "memory");
27237
27554
  const isFreshSync = pendingFreshMemorySync.has(agent.agent_id);
27238
27555
  if (isFreshSync) {
27239
27556
  log2(`[memory-sync] Fresh-sync requested for '${agent.code_name}' \u2014 pulling DB first`);
@@ -27261,10 +27578,10 @@ async function syncMemories(agent, configDir, log2) {
27261
27578
  const prevHashes = memoryFileHashes.get(agent.agent_id) ?? /* @__PURE__ */ new Map();
27262
27579
  const currentHashes = /* @__PURE__ */ new Map();
27263
27580
  const changedMemories = [];
27264
- for (const file of readdirSync14(memoryDir)) {
27581
+ for (const file of readdirSync15(memoryDir)) {
27265
27582
  if (!file.endsWith(".md")) continue;
27266
27583
  try {
27267
- const raw = readFileSync38(join47(memoryDir, file), "utf-8");
27584
+ const raw = readFileSync39(join48(memoryDir, file), "utf-8");
27268
27585
  const fileHash = createHash21("sha256").update(raw).digest("hex").slice(0, 16);
27269
27586
  currentHashes.set(file, fileHash);
27270
27587
  if (prevHashes.get(file) === fileHash) continue;
@@ -27289,7 +27606,7 @@ async function syncMemories(agent, configDir, log2) {
27289
27606
  } catch (err) {
27290
27607
  for (const mem of changedMemories) {
27291
27608
  for (const [file] of currentHashes) {
27292
- const parsed = parseMemoryFile(readFileSync38(join47(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
27609
+ const parsed = parseMemoryFile(readFileSync39(join48(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
27293
27610
  if (parsed?.name === mem.name) currentHashes.delete(file);
27294
27611
  }
27295
27612
  }
@@ -27315,7 +27632,7 @@ async function syncMemories(agent, configDir, log2) {
27315
27632
  }
27316
27633
  }
27317
27634
  async function downloadMemories(agent, memoryDir, log2, { force, configDir }) {
27318
- const localFiles = existsSync20(memoryDir) ? readdirSync14(memoryDir).filter((f) => f.endsWith(".md")).sort() : [];
27635
+ const localFiles = existsSync20(memoryDir) ? readdirSync15(memoryDir).filter((f) => f.endsWith(".md")).sort() : [];
27319
27636
  const localListHash = createHash21("sha256").update(localFiles.join(",")).digest("hex").slice(0, 16);
27320
27637
  const prevLocalHash = lastLocalFileHash.get(agent.agent_id);
27321
27638
  const prevDownload = lastDownloadHash.get(agent.agent_id);
@@ -27370,7 +27687,7 @@ async function downloadMemories(agent, memoryDir, log2, { force, configDir }) {
27370
27687
  // Per-agent, not host-wide: memories are agent-private, so a shared
27371
27688
  // store would buy almost no dedupe while exposing one agent's content
27372
27689
  // to every other agent on the host. See memory-cache.ts's header.
27373
- cacheDir: join47(configDir, agent.code_name, "_memory_bodies"),
27690
+ cacheDir: join48(configDir, agent.code_name, "_memory_bodies"),
27374
27691
  fetchContents: async (hashes) => {
27375
27692
  const res = await api.post(
27376
27693
  "/host/memories/contents",
@@ -27408,7 +27725,7 @@ async function downloadMemories(agent, memoryDir, log2, { force, configDir }) {
27408
27725
  const rawSlug = mem.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "").slice(0, 60);
27409
27726
  const slug = rawSlug || `memory-${i}`;
27410
27727
  const fileName = `${slug}.md`;
27411
- const filePath = join47(memoryDir, fileName);
27728
+ const filePath = join48(memoryDir, fileName);
27412
27729
  const desired = `---
27413
27730
  name: ${JSON.stringify(mem.name)}
27414
27731
  type: ${mem.type}
@@ -27428,7 +27745,7 @@ ${mem.content}
27428
27745
  if (existsSync20(filePath)) {
27429
27746
  let existing = "";
27430
27747
  try {
27431
- existing = readFileSync38(filePath, "utf-8");
27748
+ existing = readFileSync39(filePath, "utf-8");
27432
27749
  } catch {
27433
27750
  }
27434
27751
  if (existing === desired) {
@@ -27446,7 +27763,7 @@ ${mem.content}
27446
27763
  if (manifestDirty) saveMemoryManifest(agent.agent_id, configDir, agent.code_name);
27447
27764
  }
27448
27765
  if (written > 0 || overwritten > 0) {
27449
- const updatedFiles = readdirSync14(memoryDir).filter((f) => f.endsWith(".md")).sort();
27766
+ const updatedFiles = readdirSync15(memoryDir).filter((f) => f.endsWith(".md")).sort();
27450
27767
  lastLocalFileHash.set(agent.agent_id, createHash21("sha256").update(updatedFiles.join(",")).digest("hex").slice(0, 16));
27451
27768
  log2(`Memory download for '${agent.code_name}': wrote ${written} new, overwrote ${overwritten} stale`);
27452
27769
  }
@@ -27825,11 +28142,12 @@ function startManager(opts) {
27825
28142
  log(`[startup] begin (pid=${process.pid}, node=${process.version}, interval=${opts.intervalMs}ms)`);
27826
28143
  armManagerShutdown();
27827
28144
  process.env["DISABLE_AUTOUPDATER"] = "1";
28145
+ warnIgnoredIsolationAllowlist(log);
27828
28146
  config = opts;
27829
28147
  try {
27830
28148
  const stateFile = getStateFile();
27831
28149
  if (existsSync20(stateFile)) {
27832
- const raw = readFileSync38(stateFile, "utf-8");
28150
+ const raw = readFileSync39(stateFile, "utf-8");
27833
28151
  const parsed = JSON.parse(raw);
27834
28152
  if (Array.isArray(parsed.agents)) {
27835
28153
  state9.agents = parsed.agents;
@@ -27863,7 +28181,7 @@ function startManager(opts) {
27863
28181
  log(`[startup] state rehydration failed (continuing with empty state): ${err.message}`);
27864
28182
  }
27865
28183
  log(
27866
- `[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join47(homedir17(), ".augmented", "manager.log")}`
28184
+ `[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join48(homedir17(), ".augmented", "manager.log")}`
27867
28185
  );
27868
28186
  deployMcpAssets();
27869
28187
  reapOrphanChannelMcps({ log });
@@ -27892,7 +28210,7 @@ async function reapOrphanedClaudePids() {
27892
28210
  const looksLikeClaude = (pid) => {
27893
28211
  if (process.platform !== "linux") return true;
27894
28212
  try {
27895
- const comm = readFileSync38(`/proc/${pid}/comm`, "utf-8").trim().toLowerCase();
28213
+ const comm = readFileSync39(`/proc/${pid}/comm`, "utf-8").trim().toLowerCase();
27896
28214
  return comm.includes("claude");
27897
28215
  } catch {
27898
28216
  return false;
@@ -27989,14 +28307,14 @@ function restartRunningChannelMcps(basenames) {
27989
28307
  }
27990
28308
  }
27991
28309
  function deployMcpAssets() {
27992
- const targetDir = join47(homedir17(), ".augmented", "_mcp");
28310
+ const targetDir = join48(homedir17(), ".augmented", "_mcp");
27993
28311
  mkdirSync18(targetDir, { recursive: true });
27994
28312
  const moduleDir = dirname11(fileURLToPath2(import.meta.url));
27995
28313
  let mcpSourceDir = "";
27996
28314
  let dir = moduleDir;
27997
28315
  for (let i = 0; i < 6; i++) {
27998
- const candidate = join47(dir, "dist", "mcp");
27999
- if (existsSync20(join47(candidate, "index.js"))) {
28316
+ const candidate = join48(dir, "dist", "mcp");
28317
+ if (existsSync20(join48(candidate, "index.js"))) {
28000
28318
  mcpSourceDir = candidate;
28001
28319
  break;
28002
28320
  }
@@ -28014,7 +28332,7 @@ function deployMcpAssets() {
28014
28332
  const fileHash = (p) => {
28015
28333
  try {
28016
28334
  if (!existsSync20(p)) return null;
28017
- return createHash21("sha256").update(readFileSync38(p)).digest("hex");
28335
+ return createHash21("sha256").update(readFileSync39(p)).digest("hex");
28018
28336
  } catch {
28019
28337
  return null;
28020
28338
  }
@@ -28096,8 +28414,8 @@ function deployMcpAssets() {
28096
28414
  // natural session restart.
28097
28415
  "computer-use-proxy.js"
28098
28416
  ]) {
28099
- const src = join47(mcpSourceDir, file);
28100
- const dst = join47(targetDir, file);
28417
+ const src = join48(mcpSourceDir, file);
28418
+ const dst = join48(targetDir, file);
28101
28419
  if (!existsSync20(src)) continue;
28102
28420
  attemptedFiles.push(file);
28103
28421
  const before = fileHash(dst);
@@ -28123,16 +28441,16 @@ function deployMcpAssets() {
28123
28441
  log(`[manager] Bundle(s) updated: ${changedBasenames.join(", ")} \u2014 signalling running instances to restart`);
28124
28442
  restartRunningChannelMcps(changedBasenames);
28125
28443
  }
28126
- const localMcpPath = join47(targetDir, "index.js");
28444
+ const localMcpPath = join48(targetDir, "index.js");
28127
28445
  try {
28128
- const agentsDir = join47(homedir17(), ".augmented", "agents");
28446
+ const agentsDir = join48(homedir17(), ".augmented", "agents");
28129
28447
  if (existsSync20(agentsDir)) {
28130
- for (const entry of readdirSync14(agentsDir, { withFileTypes: true })) {
28448
+ for (const entry of readdirSync15(agentsDir, { withFileTypes: true })) {
28131
28449
  if (!entry.isDirectory()) continue;
28132
28450
  for (const subdir of ["provision", "project"]) {
28133
- const mcpJsonPath = join47(agentsDir, entry.name, subdir, ".mcp.json");
28451
+ const mcpJsonPath = join48(agentsDir, entry.name, subdir, ".mcp.json");
28134
28452
  try {
28135
- const raw = readFileSync38(mcpJsonPath, "utf-8");
28453
+ const raw = readFileSync39(mcpJsonPath, "utf-8");
28136
28454
  if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
28137
28455
  const mcpConfig = JSON.parse(raw);
28138
28456
  const augServer = mcpConfig.mcpServers?.["augmented"];