@integrity-labs/agt-cli 0.28.344 → 0.28.346

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.
@@ -46,7 +46,7 @@ import {
46
46
  resolveEffectivePinRaw,
47
47
  safeWriteJsonAtomic,
48
48
  setConfigHash
49
- } from "../chunk-AJ23F3MU.js";
49
+ } from "../chunk-2ZXC5NUI.js";
50
50
  import {
51
51
  getProjectDir as getProjectDir2,
52
52
  getReadyTasks,
@@ -66,6 +66,7 @@ import {
66
66
  SCHEDULED_TURN_MARKER_FILENAME,
67
67
  SUPPRESS_SENTINEL,
68
68
  StreamEncoder,
69
+ USAGE_LIMIT_MARKER_FILENAME,
69
70
  appendDmFooter,
70
71
  attributeTranscriptUsageByRun,
71
72
  buildEgressAllowlist,
@@ -125,6 +126,7 @@ import {
125
126
  restartEgressSidecar,
126
127
  rotateSessionForWedge,
127
128
  sendToAgent,
129
+ serializeUsageLimitMarker,
128
130
  sessionTranscriptDir,
129
131
  startPersistentSession,
130
132
  stopAllSessionsAndWait,
@@ -135,17 +137,17 @@ import {
135
137
  takeZombieDetection,
136
138
  transcriptActivityAgeSeconds,
137
139
  writeEgressAllowlist
138
- } from "../chunk-7MP37HYR.js";
140
+ } from "../chunk-NUL7IYDV.js";
139
141
  import {
140
142
  reapOrphanChannelMcps
141
143
  } from "../chunk-XWVM4KPK.js";
142
144
 
143
145
  // src/lib/manager-worker.ts
144
146
  import { createHash as createHash14 } from "crypto";
145
- import { readFileSync as readFileSync19, writeFileSync as writeFileSync10, mkdirSync as mkdirSync9, existsSync as existsSync13, rmSync as rmSync4, readdirSync as readdirSync5, statSync as statSync4, copyFileSync } from "fs";
147
+ import { readFileSync as readFileSync19, writeFileSync as writeFileSync11, mkdirSync as mkdirSync10, existsSync as existsSync13, rmSync as rmSync5, readdirSync as readdirSync5, statSync as statSync4, copyFileSync } from "fs";
146
148
  import { execFileSync as syncExecFile } from "child_process";
147
- import { join as join22, dirname as dirname6 } from "path";
148
- import { homedir as homedir11 } from "os";
149
+ import { join as join23, dirname as dirname6 } from "path";
150
+ import { homedir as homedir12 } from "os";
149
151
  import { fileURLToPath } from "url";
150
152
 
151
153
  // src/lib/claude-code-upgrade-throttle.ts
@@ -1860,6 +1862,41 @@ var nodeArtifactFs = {
1860
1862
  };
1861
1863
 
1862
1864
  // src/lib/usage-banner-monitor.ts
1865
+ import { mkdirSync as mkdirSync4, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
1866
+ import { homedir as homedir3 } from "os";
1867
+ import { join as join5 } from "path";
1868
+ function syncUsageLimitMarker(args) {
1869
+ if (args.pct < 100) {
1870
+ clearUsageLimitMarker(args.codeName, args.log);
1871
+ return;
1872
+ }
1873
+ const path = join5(homedir3(), ".augmented", args.codeName, USAGE_LIMIT_MARKER_FILENAME);
1874
+ try {
1875
+ mkdirSync4(join5(homedir3(), ".augmented", args.codeName), { recursive: true });
1876
+ writeFileSync4(path, serializeUsageLimitMarker(args.weekResetsAt), "utf-8");
1877
+ } catch (err) {
1878
+ args.log(`[usage-banner] usage-limit marker sync failed for '${args.codeName}': ${err.message}`);
1879
+ }
1880
+ }
1881
+ function clearUsageLimitMarker(codeName, log2) {
1882
+ const path = join5(homedir3(), ".augmented", codeName, USAGE_LIMIT_MARKER_FILENAME);
1883
+ try {
1884
+ rmSync2(path, { force: true });
1885
+ } catch (err) {
1886
+ log2(`[usage-banner] usage-limit marker clear failed for '${codeName}': ${err.message}`);
1887
+ }
1888
+ }
1889
+ var SPAWN_MARKER = /--- spawn \S+ \(session [^)]*\) ---/g;
1890
+ function scopeToCurrentPaneEpoch(tail) {
1891
+ SPAWN_MARKER.lastIndex = 0;
1892
+ let lastIndex = -1;
1893
+ let match;
1894
+ while ((match = SPAWN_MARKER.exec(tail)) !== null) {
1895
+ lastIndex = match.index;
1896
+ }
1897
+ if (lastIndex < 0) return { epochText: tail, sawSpawnMarker: false };
1898
+ return { epochText: tail.slice(lastIndex), sawSpawnMarker: true };
1899
+ }
1863
1900
  var MIN_CHECK_INTERVAL_MS = 6e4;
1864
1901
  var PANE_TAIL_LINES_FOR_BANNER = 5e3;
1865
1902
  var state = /* @__PURE__ */ new Map();
@@ -1887,11 +1924,21 @@ async function maybeReportUsageBanner(args) {
1887
1924
  state.set(codeName, next);
1888
1925
  return;
1889
1926
  }
1890
- const observation = parseUsageBanner(tail, now);
1927
+ const { epochText, sawSpawnMarker } = scopeToCurrentPaneEpoch(tail);
1928
+ const observation = parseUsageBanner(epochText, now);
1891
1929
  if (!observation) {
1930
+ if (sawSpawnMarker) {
1931
+ clearUsageLimitMarker(codeName, log2);
1932
+ }
1892
1933
  state.set(codeName, next);
1893
1934
  return;
1894
1935
  }
1936
+ syncUsageLimitMarker({
1937
+ codeName,
1938
+ pct: observation.pct,
1939
+ weekResetsAt: observation.weekResetsAt,
1940
+ log: log2
1941
+ });
1895
1942
  const observedAtIso = next.lastWeekResetsAt;
1896
1943
  const weekResetsAtIso = observation.weekResetsAt.toISOString();
1897
1944
  if (existing && existing.lastPct === observation.pct && observedAtIso === weekResetsAtIso) {
@@ -1916,7 +1963,7 @@ async function maybeReportUsageBanner(args) {
1916
1963
 
1917
1964
  // src/lib/token-usage-monitor.ts
1918
1965
  import { readdirSync, readFileSync as readFileSync6, statSync } from "fs";
1919
- import { join as join5 } from "path";
1966
+ import { join as join6 } from "path";
1920
1967
  var MIN_CHECK_INTERVAL_MS2 = 6e4;
1921
1968
  var TRANSCRIPT_MTIME_WINDOW_MS = 2 * 24 * 60 * 60 * 1e3;
1922
1969
  var MAX_ENTRIES_PER_POST = 200;
@@ -1945,7 +1992,7 @@ async function maybeReportTokenUsage(args) {
1945
1992
  if (!name.endsWith(".jsonl")) continue;
1946
1993
  const sessionId = name.slice(0, -".jsonl".length);
1947
1994
  if (!sessionId) continue;
1948
- const path = join5(dir, name);
1995
+ const path = join6(dir, name);
1949
1996
  let st;
1950
1997
  try {
1951
1998
  st = statSync(path);
@@ -2043,7 +2090,7 @@ async function maybeReportTokenUsage(args) {
2043
2090
 
2044
2091
  // src/lib/workflow-run-reconciler.ts
2045
2092
  import { readdirSync as readdirSync2, readFileSync as readFileSync7, statSync as statSync2 } from "fs";
2046
- import { join as join6 } from "path";
2093
+ import { join as join7 } from "path";
2047
2094
  var MIN_CHECK_INTERVAL_MS3 = 5 * 6e4;
2048
2095
  var SETTLE_MS = 3e4;
2049
2096
  var TRANSCRIPT_MTIME_WINDOW_MS2 = 2 * 24 * 60 * 60 * 1e3;
@@ -2062,7 +2109,7 @@ function collectJsonlRecursive(dir, minMtimeMs, out, depth) {
2062
2109
  return;
2063
2110
  }
2064
2111
  for (const name of entries) {
2065
- const p = join6(dir, name);
2112
+ const p = join7(dir, name);
2066
2113
  let st;
2067
2114
  try {
2068
2115
  st = statSync2(p);
@@ -2085,7 +2132,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
2085
2132
  return out;
2086
2133
  }
2087
2134
  for (const name of entries) {
2088
- const path = join6(transcriptDir, name);
2135
+ const path = join7(transcriptDir, name);
2089
2136
  let st;
2090
2137
  try {
2091
2138
  st = statSync2(path);
@@ -2097,7 +2144,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
2097
2144
  continue;
2098
2145
  }
2099
2146
  if (st.isDirectory()) {
2100
- collectJsonlRecursive(join6(path, "subagents"), minMtimeMs, out, 0);
2147
+ collectJsonlRecursive(join7(path, "subagents"), minMtimeMs, out, 0);
2101
2148
  }
2102
2149
  }
2103
2150
  return out;
@@ -2188,7 +2235,7 @@ async function maybeReconcileWorkflowRunTokens(args) {
2188
2235
 
2189
2236
  // src/lib/conversation-evaluator.ts
2190
2237
  import { readdirSync as readdirSync3, readFileSync as readFileSync8, statSync as statSync3 } from "fs";
2191
- import { join as join7 } from "path";
2238
+ import { join as join8 } from "path";
2192
2239
  var MIN_CHECK_INTERVAL_MS4 = 5 * 6e4;
2193
2240
  var TRANSCRIPT_MTIME_WINDOW_MS3 = 7 * 24 * 60 * 60 * 1e3;
2194
2241
  var WINDOW_PAD_MS = 5 * 6e4;
@@ -2624,7 +2671,7 @@ function readRecentTurns(dir, nowMs) {
2624
2671
  return;
2625
2672
  }
2626
2673
  for (const ent of entries) {
2627
- const full = join7(d, ent.name);
2674
+ const full = join8(d, ent.name);
2628
2675
  if (ent.isDirectory()) {
2629
2676
  visit(full);
2630
2677
  continue;
@@ -2930,10 +2977,10 @@ async function reportSkip2(api2, agentId, conversationId, log2, codeName) {
2930
2977
 
2931
2978
  // src/lib/activity-cache-monitor.ts
2932
2979
  import { existsSync as existsSync2, readFileSync as readFileSync9 } from "fs";
2933
- import { homedir as homedir3 } from "os";
2934
- import { join as join8 } from "path";
2980
+ import { homedir as homedir4 } from "os";
2981
+ import { join as join9 } from "path";
2935
2982
  var MIN_CHECK_INTERVAL_MS6 = 6e4;
2936
- var STATS_CACHE_PATH = join8(homedir3(), ".claude", "stats-cache.json");
2983
+ var STATS_CACHE_PATH = join9(homedir4(), ".claude", "stats-cache.json");
2937
2984
  var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
2938
2985
  var state5 = { lastObservedDate: null, lastCheckedAt: 0 };
2939
2986
  function selectNewDailyRows(raw, lastObservedDate) {
@@ -3167,8 +3214,8 @@ function bundleFingerprint(files) {
3167
3214
 
3168
3215
  // src/lib/claude-auth-detect.ts
3169
3216
  import { readFile as readFile2, readdir as readdir2 } from "fs/promises";
3170
- import { homedir as homedir4, platform } from "os";
3171
- import { join as join9 } from "path";
3217
+ import { homedir as homedir5, platform } from "os";
3218
+ import { join as join10 } from "path";
3172
3219
  import { execFile } from "child_process";
3173
3220
  import { promisify } from "util";
3174
3221
  var execFileAsync = promisify(execFile);
@@ -3183,8 +3230,8 @@ async function detectClaudeAuth() {
3183
3230
  }
3184
3231
  async function findClaudeCredentialsPaths() {
3185
3232
  const candidates = [
3186
- join9(homedir4(), ".claude", ".credentials.json"),
3187
- join9(homedir4(), ".claude", "credentials.json")
3233
+ join10(homedir5(), ".claude", ".credentials.json"),
3234
+ join10(homedir5(), ".claude", "credentials.json")
3188
3235
  ];
3189
3236
  const isLinuxRoot = platform() === "linux" && typeof process.getuid === "function" && process.getuid() === 0;
3190
3237
  if (isLinuxRoot) {
@@ -3192,8 +3239,8 @@ async function findClaudeCredentialsPaths() {
3192
3239
  const entries = await readdir2("/home", { withFileTypes: true });
3193
3240
  for (const entry of entries) {
3194
3241
  if (!entry.isDirectory()) continue;
3195
- candidates.push(join9("/home", entry.name, ".claude", ".credentials.json"));
3196
- candidates.push(join9("/home", entry.name, ".claude", "credentials.json"));
3242
+ candidates.push(join10("/home", entry.name, ".claude", ".credentials.json"));
3243
+ candidates.push(join10("/home", entry.name, ".claude", "credentials.json"));
3197
3244
  }
3198
3245
  } catch {
3199
3246
  }
@@ -3289,11 +3336,11 @@ function computeChannelConfigHash(input) {
3289
3336
  }
3290
3337
 
3291
3338
  // src/lib/channel-hash-cache.ts
3292
- import { existsSync as existsSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync4 } from "fs";
3293
- import { join as join10 } from "path";
3339
+ import { existsSync as existsSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
3340
+ import { join as join11 } from "path";
3294
3341
  var CACHE_FILENAME = "channel-hash-cache.json";
3295
3342
  function getChannelHashCacheFile(configDir) {
3296
- return join10(configDir, CACHE_FILENAME);
3343
+ return join11(configDir, CACHE_FILENAME);
3297
3344
  }
3298
3345
  function loadChannelHashCache(target, configDir) {
3299
3346
  const path = getChannelHashCacheFile(configDir);
@@ -3314,14 +3361,14 @@ function saveChannelHashCache(source, configDir) {
3314
3361
  const obj = {};
3315
3362
  for (const [key, value] of source) obj[key] = value;
3316
3363
  try {
3317
- writeFileSync4(path, JSON.stringify(obj, null, 2));
3364
+ writeFileSync5(path, JSON.stringify(obj, null, 2));
3318
3365
  } catch {
3319
3366
  }
3320
3367
  }
3321
3368
 
3322
3369
  // src/lib/sender-policy-baseline.ts
3323
3370
  import { existsSync as existsSync4, readFileSync as readFileSync11 } from "fs";
3324
- import { join as join11 } from "path";
3371
+ import { join as join12 } from "path";
3325
3372
  var BASELINE_FILENAME = "sender-policy-baseline.json";
3326
3373
  var SENDER_POLICY_BASELINE_VERSION = 1;
3327
3374
  var BASELINE_CONCERNS = ["senderPolicy", "slackBehaviour", "msteamsBehaviour"];
@@ -3333,7 +3380,7 @@ function createDeliveryBaselineMaps() {
3333
3380
  };
3334
3381
  }
3335
3382
  function getSenderPolicyBaselineFile(configDir) {
3336
- return join11(configDir, BASELINE_FILENAME);
3383
+ return join12(configDir, BASELINE_FILENAME);
3337
3384
  }
3338
3385
  function loadSenderPolicyBaseline(target, configDir, log2) {
3339
3386
  const path = getSenderPolicyBaselineFile(configDir);
@@ -3827,11 +3874,11 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash, options)
3827
3874
  }
3828
3875
 
3829
3876
  // src/lib/manager/managed-skill-manifest.ts
3830
- import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync12, writeFileSync as writeFileSync5 } from "fs";
3831
- import { dirname as dirname4, join as join12 } from "path";
3877
+ import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync6 } from "fs";
3878
+ import { dirname as dirname4, join as join13 } from "path";
3832
3879
  var MANIFEST_VERSION = 1;
3833
3880
  function managedSkillManifestPath(agentRootDir) {
3834
- return join12(agentRootDir, "managed-skills.json");
3881
+ return join13(agentRootDir, "managed-skills.json");
3835
3882
  }
3836
3883
  function readManagedSkillManifest(path) {
3837
3884
  try {
@@ -3845,21 +3892,21 @@ function readManagedSkillManifest(path) {
3845
3892
  }
3846
3893
  function writeManagedSkillManifest(path, ids) {
3847
3894
  try {
3848
- mkdirSync4(dirname4(path), { recursive: true });
3895
+ mkdirSync5(dirname4(path), { recursive: true });
3849
3896
  const body = {
3850
3897
  version: MANIFEST_VERSION,
3851
3898
  globalSkillIds: [...ids].sort()
3852
3899
  };
3853
- writeFileSync5(path, JSON.stringify(body, null, 2));
3900
+ writeFileSync6(path, JSON.stringify(body, null, 2));
3854
3901
  } catch {
3855
3902
  }
3856
3903
  }
3857
3904
 
3858
3905
  // src/lib/manager/runtime.ts
3859
3906
  import { createHash as createHash6 } from "crypto";
3860
- import { readFileSync as readFileSync13, appendFileSync, mkdirSync as mkdirSync5, chmodSync, existsSync as existsSync6 } from "fs";
3861
- import { join as join13, dirname as dirname5 } from "path";
3862
- import { homedir as homedir5 } from "os";
3907
+ import { readFileSync as readFileSync13, appendFileSync, mkdirSync as mkdirSync6, chmodSync, existsSync as existsSync6 } from "fs";
3908
+ import { join as join14, dirname as dirname5 } from "path";
3909
+ import { homedir as homedir6 } from "os";
3863
3910
  function redactForDiskLog(value) {
3864
3911
  try {
3865
3912
  return value.replace(/\b(Bearer\s+)[A-Za-z0-9._-]+\b/gi, "$1[REDACTED]").replace(/\bxox[baprs]-[A-Za-z0-9-]+\b/g, "[REDACTED-SLACK]").replace(/\btlk_[A-Za-z0-9._-]+\b/g, "[REDACTED-HOST]").replace(/\bsk-ant-[A-Za-z0-9_-]+\b/g, "[REDACTED-ANTHROPIC]").replace(/\b\d{8,12}:[A-Za-z0-9_-]{30,}\b/g, "[REDACTED-TELEGRAM]").replace(
@@ -3879,8 +3926,8 @@ function log(msg) {
3879
3926
  `;
3880
3927
  if (!managerLogPath) {
3881
3928
  try {
3882
- managerLogPath = join13(homedir5(), ".augmented", "manager.log");
3883
- mkdirSync5(dirname5(managerLogPath), { recursive: true });
3929
+ managerLogPath = join14(homedir6(), ".augmented", "manager.log");
3930
+ mkdirSync6(dirname5(managerLogPath), { recursive: true });
3884
3931
  if (existsSync6(managerLogPath)) {
3885
3932
  chmodSync(managerLogPath, 384);
3886
3933
  }
@@ -4067,9 +4114,9 @@ function resolveModelChain(refreshData) {
4067
4114
  }
4068
4115
 
4069
4116
  // src/lib/manager/claude-auth.ts
4070
- import { existsSync as existsSync7, rmSync as rmSync2 } from "fs";
4071
- import { join as join14 } from "path";
4072
- import { homedir as homedir6 } from "os";
4117
+ import { existsSync as existsSync7, rmSync as rmSync3 } from "fs";
4118
+ import { join as join15 } from "path";
4119
+ import { homedir as homedir7 } from "os";
4073
4120
  async function applyClaudeAuthToEnv(childEnv, label) {
4074
4121
  const apiKey = getApiKey();
4075
4122
  if (!apiKey) {
@@ -4081,12 +4128,12 @@ async function applyClaudeAuthToEnv(childEnv, label) {
4081
4128
  throw new Error("claude_auth_mode=api_key but /host/exchange returned no decrypted key");
4082
4129
  }
4083
4130
  childEnv.ANTHROPIC_API_KEY = exchange.anthropicApiKey;
4084
- const claudeDir = join14(homedir6(), ".claude");
4131
+ const claudeDir = join15(homedir7(), ".claude");
4085
4132
  for (const filename of [".credentials.json", "credentials.json"]) {
4086
- const p = join14(claudeDir, filename);
4133
+ const p = join15(claudeDir, filename);
4087
4134
  if (existsSync7(p)) {
4088
4135
  try {
4089
- rmSync2(p, { force: true });
4136
+ rmSync3(p, { force: true });
4090
4137
  log(`[${label}] Removed ${p} (api_key mode \u2014 preventing OAuth fallback)`);
4091
4138
  } catch {
4092
4139
  }
@@ -4099,7 +4146,7 @@ async function applyClaudeAuthToEnv(childEnv, label) {
4099
4146
 
4100
4147
  // src/lib/manager/kanban/parsers.ts
4101
4148
  import { existsSync as existsSync8, readFileSync as readFileSync14 } from "fs";
4102
- import { join as join15 } from "path";
4149
+ import { join as join16 } from "path";
4103
4150
  var STANDUP_TEMPLATES = /* @__PURE__ */ new Set(["daily-standup", "end-of-day-summary"]);
4104
4151
  var TASK_UPDATE_TEMPLATES = /* @__PURE__ */ new Set(["hourly-status", "task-update"]);
4105
4152
  var PLAN_TEMPLATES = /* @__PURE__ */ new Set(["morning-plan"]);
@@ -4235,8 +4282,8 @@ function getBuiltInSkillContent(skillId) {
4235
4282
  if (builtInSkillCache.has(skillId)) return builtInSkillCache.get(skillId);
4236
4283
  try {
4237
4284
  const candidates = [
4238
- join15(process.cwd(), "skills", skillId, "SKILL.md"),
4239
- join15(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
4285
+ join16(process.cwd(), "skills", skillId, "SKILL.md"),
4286
+ join16(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
4240
4287
  ];
4241
4288
  for (const candidate of candidates) {
4242
4289
  if (existsSync8(candidate)) {
@@ -4381,12 +4428,12 @@ function formatBoardForPrompt(items, template) {
4381
4428
  }
4382
4429
 
4383
4430
  // src/lib/manager/kanban/nudge-state-cache.ts
4384
- import { existsSync as existsSync9, readFileSync as readFileSync15, writeFileSync as writeFileSync6 } from "fs";
4385
- import { join as join16 } from "path";
4431
+ import { existsSync as existsSync9, readFileSync as readFileSync15, writeFileSync as writeFileSync7 } from "fs";
4432
+ import { join as join17 } from "path";
4386
4433
  var CACHE_FILENAME2 = "kanban-nudge-state.json";
4387
4434
  var KANBAN_NUDGE_STATE_VERSION = 1;
4388
4435
  function getKanbanNudgeStateFile(configDir) {
4389
- return join16(configDir, CACHE_FILENAME2);
4436
+ return join17(configDir, CACHE_FILENAME2);
4390
4437
  }
4391
4438
  function loadKanbanNudgeState(target, configDir) {
4392
4439
  const path = getKanbanNudgeStateFile(configDir);
@@ -4418,7 +4465,7 @@ function saveKanbanNudgeState(source, configDir) {
4418
4465
  const agents = {};
4419
4466
  for (const [codeName, state7] of source) agents[codeName] = state7;
4420
4467
  try {
4421
- writeFileSync6(path, JSON.stringify({ version: KANBAN_NUDGE_STATE_VERSION, agents }, null, 2));
4468
+ writeFileSync7(path, JSON.stringify({ version: KANBAN_NUDGE_STATE_VERSION, agents }, null, 2));
4422
4469
  } catch {
4423
4470
  }
4424
4471
  }
@@ -4959,9 +5006,9 @@ function closeScheduledRunsForCode(codeName, outcome, reason) {
4959
5006
 
4960
5007
  // src/lib/manager/scheduler/kanban-route.ts
4961
5008
  import { createHash as createHash9 } from "crypto";
4962
- import { writeFileSync as writeFileSync7, renameSync } from "fs";
4963
- import { homedir as homedir7 } from "os";
4964
- import { join as join17 } from "path";
5009
+ import { writeFileSync as writeFileSync8, renameSync } from "fs";
5010
+ import { homedir as homedir8 } from "os";
5011
+ import { join as join18 } from "path";
4965
5012
 
4966
5013
  // src/lib/manager/delivery/scheduled-output.ts
4967
5014
  async function deliverScheduledTaskOutput(agentCodeName, agentId, rawTarget, body, taskId) {
@@ -5265,10 +5312,10 @@ function resolveScheduledSlackTarget(task) {
5265
5312
  }
5266
5313
  function stampScheduledTurnMarker(codeName, taskId, target) {
5267
5314
  try {
5268
- const file = join17(homedir7(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
5315
+ const file = join18(homedir8(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
5269
5316
  const marker = { ts: Date.now(), task_id: taskId, ...target ? { target } : {} };
5270
5317
  const tmp = `${file}.tmp`;
5271
- writeFileSync7(tmp, JSON.stringify(marker), "utf8");
5318
+ writeFileSync8(tmp, JSON.stringify(marker), "utf8");
5272
5319
  renameSync(tmp, file);
5273
5320
  } catch (err) {
5274
5321
  log(`[scheduled-kanban] scheduled-turn marker write failed for '${codeName}': ${err.message}`);
@@ -5451,10 +5498,10 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
5451
5498
 
5452
5499
  // src/lib/manager/scheduler/execution.ts
5453
5500
  import { createHash as createHash10 } from "crypto";
5454
- import { homedir as homedir8 } from "os";
5455
- import { join as join18 } from "path";
5501
+ import { homedir as homedir9 } from "os";
5502
+ import { join as join19 } from "path";
5456
5503
  function claudePidFilePath() {
5457
- return join18(homedir8(), ".augmented", "manager-claude-pids.json");
5504
+ return join19(homedir9(), ".augmented", "manager-claude-pids.json");
5458
5505
  }
5459
5506
  var inFlightClaudePids = /* @__PURE__ */ new Map();
5460
5507
  function registerClaudeSpawn(record) {
@@ -5518,9 +5565,9 @@ async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData
5518
5565
  import { spawn, execSync } from "child_process";
5519
5566
  import { createServer } from "net";
5520
5567
  import { randomBytes } from "crypto";
5521
- import { existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync16 } from "fs";
5522
- import { homedir as homedir9, userInfo } from "os";
5523
- import { join as join19 } from "path";
5568
+ import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync16 } from "fs";
5569
+ import { homedir as homedir10, userInfo } from "os";
5570
+ import { join as join20 } from "path";
5524
5571
  var OPENCODE_BIN = process.env["AGT_OPENCODE_BIN"]?.trim() || "opencode";
5525
5572
  var sessions = /* @__PURE__ */ new Map();
5526
5573
  var bridges = /* @__PURE__ */ new Map();
@@ -5528,7 +5575,7 @@ function opencodeTmuxSession(codeName) {
5528
5575
  return `agt-oc-${codeName}`;
5529
5576
  }
5530
5577
  function opencodePaneLogPath(codeName) {
5531
- return join19(homedir9(), ".augmented", codeName, "opencode-serve.log");
5578
+ return join20(homedir10(), ".augmented", codeName, "opencode-serve.log");
5532
5579
  }
5533
5580
  function baseUrlFor(port) {
5534
5581
  return `http://127.0.0.1:${port}`;
@@ -5595,7 +5642,7 @@ async function startOpencodeSession(config2) {
5595
5642
  }
5596
5643
  async function spawnServe(config2, session) {
5597
5644
  const { codeName, projectDir, log: log2 } = config2;
5598
- if (!existsSync10(join19(projectDir, "opencode.json"))) {
5645
+ if (!existsSync10(join20(projectDir, "opencode.json"))) {
5599
5646
  log2(`[opencode-session] warning: no opencode.json in ${projectDir} for '${codeName}' (provisioning may not have run)`);
5600
5647
  }
5601
5648
  const tmuxSession = opencodeTmuxSession(codeName);
@@ -5605,13 +5652,13 @@ async function spawnServe(config2, session) {
5605
5652
  execSync(`tmux kill-session -t ${tmuxSession} 2>/dev/null`, { stdio: "ignore" });
5606
5653
  } catch {
5607
5654
  }
5608
- mkdirSync6(join19(homedir9(), ".augmented", codeName), { recursive: true });
5655
+ mkdirSync7(join20(homedir10(), ".augmented", codeName), { recursive: true });
5609
5656
  const serveEnv = {
5610
5657
  ...process.env,
5611
5658
  ...readAgentProviderEnv(codeName),
5612
5659
  ...stripUndefined(config2.serveEnv ?? {}),
5613
5660
  OPENCODE_SERVER_PASSWORD: password,
5614
- HOME: process.env.HOME?.trim() || homedir9(),
5661
+ HOME: process.env.HOME?.trim() || homedir10(),
5615
5662
  USER: process.env.USER?.trim() || userInfo().username
5616
5663
  };
5617
5664
  if (config2.runId) serveEnv["AGT_RUN_ID"] = config2.runId;
@@ -5697,7 +5744,7 @@ function stripUndefined(env) {
5697
5744
  }
5698
5745
  var PROVIDER_KEY_RE = /^[A-Z][A-Z0-9_]*_API_KEY$/;
5699
5746
  function readAgentProviderEnv(codeName, dir) {
5700
- const file = join19(dir ?? join19(homedir9(), ".augmented", codeName), ".env");
5747
+ const file = join20(dir ?? join20(homedir10(), ".augmented", codeName), ".env");
5701
5748
  const out = {};
5702
5749
  try {
5703
5750
  if (!existsSync10(file)) return out;
@@ -6830,9 +6877,9 @@ async function fireOpencodeScheduledTask(agent, task) {
6830
6877
 
6831
6878
  // src/lib/opencode-telegram-ingest.ts
6832
6879
  import { createHash as createHash13 } from "crypto";
6833
- import { existsSync as existsSync11, mkdirSync as mkdirSync7, readFileSync as readFileSync17, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync8 } from "fs";
6880
+ import { existsSync as existsSync11, mkdirSync as mkdirSync8, readFileSync as readFileSync17, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync9 } from "fs";
6834
6881
  import { randomUUID } from "crypto";
6835
- import { join as join20 } from "path";
6882
+ import { join as join21 } from "path";
6836
6883
 
6837
6884
  // src/lib/telegram-ingest.ts
6838
6885
  import https2 from "https";
@@ -7380,7 +7427,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
7380
7427
  let filePath;
7381
7428
  try {
7382
7429
  dir = getFramework("opencode").getAgentDir(codeName);
7383
- filePath = join20(dir, "telegram-getupdates-offset-opencode.json");
7430
+ filePath = join21(dir, "telegram-getupdates-offset-opencode.json");
7384
7431
  } catch {
7385
7432
  dir = null;
7386
7433
  filePath = null;
@@ -7407,8 +7454,8 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
7407
7454
  if (!filePath || !dir) return;
7408
7455
  const tmpPath = `${filePath}.${process.pid}.${randomUUID()}.tmp`;
7409
7456
  try {
7410
- mkdirSync7(dir, { recursive: true, mode: 448 });
7411
- writeFileSync8(
7457
+ mkdirSync8(dir, { recursive: true, mode: 448 });
7458
+ writeFileSync9(
7412
7459
  tmpPath,
7413
7460
  JSON.stringify({
7414
7461
  offset,
@@ -7639,15 +7686,15 @@ function partitionActionableByPoison(actionable, states, config2) {
7639
7686
  }
7640
7687
 
7641
7688
  // src/lib/restart-flags.ts
7642
- import { existsSync as existsSync12, mkdirSync as mkdirSync8, readdirSync as readdirSync4, readFileSync as readFileSync18, renameSync as renameSync3, rmSync as rmSync3, writeFileSync as writeFileSync9 } from "fs";
7643
- import { homedir as homedir10 } from "os";
7644
- import { join as join21 } from "path";
7689
+ import { existsSync as existsSync12, mkdirSync as mkdirSync9, readdirSync as readdirSync4, readFileSync as readFileSync18, renameSync as renameSync3, rmSync as rmSync4, writeFileSync as writeFileSync10 } from "fs";
7690
+ import { homedir as homedir11 } from "os";
7691
+ import { join as join22 } from "path";
7645
7692
  import { randomUUID as randomUUID2 } from "crypto";
7646
7693
  function restartFlagsDir() {
7647
- return join21(homedir10(), ".augmented", "restart-flags");
7694
+ return join22(homedir11(), ".augmented", "restart-flags");
7648
7695
  }
7649
7696
  function flagPath(codeName) {
7650
- return join21(restartFlagsDir(), `${codeName}.flag`);
7697
+ return join22(restartFlagsDir(), `${codeName}.flag`);
7651
7698
  }
7652
7699
  function readRestartFlags() {
7653
7700
  const dir = restartFlagsDir();
@@ -7656,7 +7703,7 @@ function readRestartFlags() {
7656
7703
  for (const entry of readdirSync4(dir)) {
7657
7704
  if (!entry.endsWith(".flag")) continue;
7658
7705
  try {
7659
- const raw = readFileSync18(join21(dir, entry), "utf8");
7706
+ const raw = readFileSync18(join22(dir, entry), "utf8");
7660
7707
  const parsed = JSON.parse(raw);
7661
7708
  if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
7662
7709
  parsed.codeName = entry.replace(/\.flag$/, "");
@@ -7675,7 +7722,7 @@ function readRestartFlags() {
7675
7722
  function deleteRestartFlag(codeName) {
7676
7723
  const path = flagPath(codeName);
7677
7724
  if (existsSync12(path)) {
7678
- rmSync3(path, { force: true });
7725
+ rmSync4(path, { force: true });
7679
7726
  }
7680
7727
  }
7681
7728
 
@@ -8908,7 +8955,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
8908
8955
  var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
8909
8956
  function projectMcpHash(_codeName, projectDir) {
8910
8957
  try {
8911
- const raw = readFileSync19(join22(projectDir, ".mcp.json"), "utf-8");
8958
+ const raw = readFileSync19(join23(projectDir, ".mcp.json"), "utf-8");
8912
8959
  return createHash14("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
8913
8960
  } catch {
8914
8961
  return null;
@@ -8916,7 +8963,7 @@ function projectMcpHash(_codeName, projectDir) {
8916
8963
  }
8917
8964
  function projectMcpKeys(_codeName, projectDir) {
8918
8965
  try {
8919
- const raw = readFileSync19(join22(projectDir, ".mcp.json"), "utf-8");
8966
+ const raw = readFileSync19(join23(projectDir, ".mcp.json"), "utf-8");
8920
8967
  const parsed = JSON.parse(raw);
8921
8968
  const servers = parsed.mcpServers;
8922
8969
  if (!servers || typeof servers !== "object") return /* @__PURE__ */ new Set();
@@ -8934,7 +8981,7 @@ function seedSessionLaunchBaselines(codeName, projectDir) {
8934
8981
  else runningMcpServerKeys.delete(codeName);
8935
8982
  let launchStructure = null;
8936
8983
  try {
8937
- const raw = readFileSync19(join22(projectDir, ".mcp.json"), "utf-8");
8984
+ const raw = readFileSync19(join23(projectDir, ".mcp.json"), "utf-8");
8938
8985
  launchStructure = managedMcpStructureHashFromFile(
8939
8986
  JSON.parse(raw),
8940
8987
  isManagedMcpServerKey
@@ -9034,7 +9081,7 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
9034
9081
  if (result && result.rebindCandidates.length > 0 && hostFlagStore().getBoolean("session-tool-rebind")) {
9035
9082
  let mcpJsonForRebind = null;
9036
9083
  try {
9037
- mcpJsonForRebind = JSON.parse(readFileSync19(join22(projectDir, ".mcp.json"), "utf-8"));
9084
+ mcpJsonForRebind = JSON.parse(readFileSync19(join23(projectDir, ".mcp.json"), "utf-8"));
9038
9085
  } catch {
9039
9086
  mcpJsonForRebind = null;
9040
9087
  }
@@ -9163,7 +9210,7 @@ function checkMcpConfigDriftAndScheduleRestart(codeName, projectDir) {
9163
9210
  function projectChannelSecretHash(projectDir) {
9164
9211
  try {
9165
9212
  const entries = parseEnvIntegrations(
9166
- readFileSync19(join22(projectDir, ".env.integrations"), "utf-8")
9213
+ readFileSync19(join23(projectDir, ".env.integrations"), "utf-8")
9167
9214
  );
9168
9215
  return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
9169
9216
  } catch {
@@ -9256,7 +9303,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9256
9303
  var lastVersionCheckAt = 0;
9257
9304
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9258
9305
  var lastResponsivenessProbeAt = 0;
9259
- var agtCliVersion = true ? "0.28.344" : "dev";
9306
+ var agtCliVersion = true ? "0.28.346" : "dev";
9260
9307
  function resolveBrewPath(execFileSync2) {
9261
9308
  try {
9262
9309
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -9451,8 +9498,8 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
9451
9498
  }
9452
9499
  if (settings.channelsEnabled === true) return "ok";
9453
9500
  settings.channelsEnabled = true;
9454
- mkdirSync9(dirname6(path), { recursive: true });
9455
- writeFileSync10(path, `${JSON.stringify(settings, null, 2)}
9501
+ mkdirSync10(dirname6(path), { recursive: true });
9502
+ writeFileSync11(path, `${JSON.stringify(settings, null, 2)}
9456
9503
  `);
9457
9504
  log(`[managed-settings] set channelsEnabled:true in ${path} (ENG-5786 \u2014 unblocks Claude Code channels)`);
9458
9505
  return "ok";
@@ -9553,7 +9600,7 @@ ${r.stderr}`;
9553
9600
  }
9554
9601
  var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9555
9602
  function selfUpdateAppliedMarkerPath() {
9556
- return join22(homedir11(), ".augmented", ".last-self-update-applied");
9603
+ return join23(homedir12(), ".augmented", ".last-self-update-applied");
9557
9604
  }
9558
9605
  var selfUpdateUpToDateLogged = false;
9559
9606
  var selfUpdatePinnedLogged = false;
@@ -9579,7 +9626,7 @@ async function checkAndUpdateCli(opts) {
9579
9626
  const isNpmGlobal = !isBrewFormula && resolvedPath.includes("node_modules");
9580
9627
  if (!isBrewFormula && !isNpmGlobal) return "noop";
9581
9628
  const { readFileSync: readF, writeFileSync: writeF } = await import("fs");
9582
- const markerPath = join22(homedir11(), ".augmented", ".last-update-check");
9629
+ const markerPath = join23(homedir12(), ".augmented", ".last-update-check");
9583
9630
  if (!force) {
9584
9631
  try {
9585
9632
  const lastCheck = parseInt(readF(markerPath, "utf-8").trim(), 10);
@@ -9925,13 +9972,13 @@ async function checkClaudeAuth() {
9925
9972
  var evalEmptyMcpConfigPath = null;
9926
9973
  function ensureEvalEmptyMcpConfig() {
9927
9974
  if (evalEmptyMcpConfigPath && existsSync13(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
9928
- const dir = join22(homedir11(), ".augmented");
9975
+ const dir = join23(homedir12(), ".augmented");
9929
9976
  try {
9930
- mkdirSync9(dir, { recursive: true });
9977
+ mkdirSync10(dir, { recursive: true });
9931
9978
  } catch {
9932
9979
  }
9933
- const p = join22(dir, ".eval-empty-mcp.json");
9934
- writeFileSync10(p, JSON.stringify({ mcpServers: {} }));
9980
+ const p = join23(dir, ".eval-empty-mcp.json");
9981
+ writeFileSync11(p, JSON.stringify({ mcpServers: {} }));
9935
9982
  evalEmptyMcpConfigPath = p;
9936
9983
  return p;
9937
9984
  }
@@ -9956,7 +10003,7 @@ async function runEvalClaude(prompt, model) {
9956
10003
  ""
9957
10004
  ];
9958
10005
  const { stdout } = await execFilePromiseLong(resolveClaudeBinary(), args, {
9959
- cwd: homedir11(),
10006
+ cwd: homedir12(),
9960
10007
  timeout: 12e4,
9961
10008
  stdin: "ignore",
9962
10009
  env: childEnv,
@@ -10022,10 +10069,10 @@ function resolveConversationEvalBackend() {
10022
10069
  return conversationEvalBackend;
10023
10070
  }
10024
10071
  function getStateFile() {
10025
- return join22(config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
10072
+ return join23(config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
10026
10073
  }
10027
10074
  function channelHashCacheDir() {
10028
- return config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented");
10075
+ return config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented");
10029
10076
  }
10030
10077
  function loadChannelHashCache2() {
10031
10078
  loadChannelHashCache(agentState.knownChannelConfigHashes, channelHashCacheDir());
@@ -10077,7 +10124,7 @@ function removeDeliveryBaselineEntries(agentId) {
10077
10124
  var _channelQuarantineStore = null;
10078
10125
  function channelQuarantineStore() {
10079
10126
  if (!_channelQuarantineStore) {
10080
- const dir = config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented");
10127
+ const dir = config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented");
10081
10128
  _channelQuarantineStore = new ChannelQuarantineStore(defaultQuarantinePath(dir));
10082
10129
  }
10083
10130
  return _channelQuarantineStore;
@@ -10085,7 +10132,7 @@ function channelQuarantineStore() {
10085
10132
  var _hostFlagStore = null;
10086
10133
  function hostFlagStore() {
10087
10134
  if (!_hostFlagStore) {
10088
- const dir = config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented");
10135
+ const dir = config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented");
10089
10136
  _hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
10090
10137
  }
10091
10138
  return _hostFlagStore;
@@ -10152,13 +10199,13 @@ function parseSkillFrontmatter(content) {
10152
10199
  return out;
10153
10200
  }
10154
10201
  async function refreshSkillsIndexInClaudeMd(configDir, codeName, log2) {
10155
- const { readdirSync: readdirSync6, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync11 } = await import("fs");
10156
- const skillsDir = join22(configDir, codeName, "project", ".claude", "skills");
10157
- const claudeMdPath = join22(configDir, codeName, "project", "CLAUDE.md");
10202
+ const { readdirSync: readdirSync6, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync12 } = await import("fs");
10203
+ const skillsDir = join23(configDir, codeName, "project", ".claude", "skills");
10204
+ const claudeMdPath = join23(configDir, codeName, "project", "CLAUDE.md");
10158
10205
  if (!ex(skillsDir) || !ex(claudeMdPath)) return;
10159
10206
  const entries = [];
10160
10207
  for (const dir of readdirSync6(skillsDir).sort()) {
10161
- const skillFile = join22(skillsDir, dir, "SKILL.md");
10208
+ const skillFile = join23(skillsDir, dir, "SKILL.md");
10162
10209
  if (!ex(skillFile)) continue;
10163
10210
  try {
10164
10211
  const { name, description } = parseSkillFrontmatter(rfs(skillFile, "utf-8"));
@@ -10200,7 +10247,7 @@ ${SKILLS_INDEX_END}`;
10200
10247
  next = current.trimEnd() + "\n\n" + section + "\n";
10201
10248
  }
10202
10249
  if (next !== current) {
10203
- writeFileSync11(claudeMdPath, next, "utf-8");
10250
+ writeFileSync12(claudeMdPath, next, "utf-8");
10204
10251
  log2(`Refreshed skills index in CLAUDE.md for '${codeName}' (${entries.length} skills)`);
10205
10252
  }
10206
10253
  }
@@ -10221,7 +10268,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
10221
10268
  if (codeNames.length === 0) return;
10222
10269
  void (async () => {
10223
10270
  try {
10224
- const { collectDiagnostics } = await import("../persistent-session-IDWQO7QL.js");
10271
+ const { collectDiagnostics } = await import("../persistent-session-2UIVPYXX.js");
10225
10272
  await api.post("/host/heartbeat", {
10226
10273
  host_id: hostId,
10227
10274
  agent_diagnostics: collectDiagnostics(codeNames)
@@ -10320,7 +10367,7 @@ async function pollCycle() {
10320
10367
  }
10321
10368
  try {
10322
10369
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
10323
- const { collectDiagnostics } = await import("../persistent-session-IDWQO7QL.js");
10370
+ const { collectDiagnostics } = await import("../persistent-session-2UIVPYXX.js");
10324
10371
  const diagCodeNames = [...agentState.persistentSessionAgents];
10325
10372
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
10326
10373
  let tailscaleHostname;
@@ -10475,7 +10522,7 @@ async function pollCycle() {
10475
10522
  const {
10476
10523
  collectResponsivenessProbes,
10477
10524
  getResponsivenessIntervalMs
10478
- } = await import("../responsiveness-probe-WF3SMLS6.js");
10525
+ } = await import("../responsiveness-probe-CPMALCAG.js");
10479
10526
  const probeIntervalMs = getResponsivenessIntervalMs();
10480
10527
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
10481
10528
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -10507,7 +10554,7 @@ async function pollCycle() {
10507
10554
  collectResponsivenessProbes,
10508
10555
  livePendingInboundOldestAgeSeconds,
10509
10556
  parkPendingInbound
10510
- } = await import("../responsiveness-probe-WF3SMLS6.js");
10557
+ } = await import("../responsiveness-probe-CPMALCAG.js");
10511
10558
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-HYOOQV4A.js");
10512
10559
  const wedgeNow = /* @__PURE__ */ new Date();
10513
10560
  const liveAgents = agentState.persistentSessionAgents;
@@ -10599,10 +10646,10 @@ async function pollCycle() {
10599
10646
  const paneTail = readFileSync19(paneLogPath(codeName), "utf8").slice(-65536);
10600
10647
  const transient = detectTransientApiErrorInLog(paneTail);
10601
10648
  if (transient) {
10602
- const wedgeHome = join22(homedir11(), ".augmented", codeName);
10649
+ const wedgeHome = join23(homedir12(), ".augmented", codeName);
10603
10650
  if (existsSync13(wedgeHome)) {
10604
10651
  atomicWriteFileSync(
10605
- join22(wedgeHome, "watchdog-give-up.json"),
10652
+ join23(wedgeHome, "watchdog-give-up.json"),
10606
10653
  JSON.stringify({
10607
10654
  gave_up_at: wedgeNow.toISOString(),
10608
10655
  reason: "transient_overload"
@@ -10851,7 +10898,7 @@ async function pollCycle() {
10851
10898
  } catch {
10852
10899
  }
10853
10900
  killAgentChannelProcesses(prev.codeName, { log });
10854
- const agentDir = join22(adapter.getAgentDir(prev.codeName), "provision");
10901
+ const agentDir = join23(adapter.getAgentDir(prev.codeName), "provision");
10855
10902
  await cleanupAgentFiles(prev.codeName, agentDir);
10856
10903
  clearAgentCaches(prev.agentId, prev.codeName);
10857
10904
  }
@@ -10938,10 +10985,10 @@ async function pollCycle() {
10938
10985
  // pending-inbound marker. Best-effort: a write failure is logged by
10939
10986
  // the watchdog, never fails the poll cycle.
10940
10987
  signalGiveUp: (codeName) => {
10941
- const dir = join22(homedir11(), ".augmented", codeName);
10988
+ const dir = join23(homedir12(), ".augmented", codeName);
10942
10989
  if (!existsSync13(dir)) return;
10943
10990
  atomicWriteFileSync(
10944
- join22(dir, "watchdog-give-up.json"),
10991
+ join23(dir, "watchdog-give-up.json"),
10945
10992
  JSON.stringify({ gave_up_at: (/* @__PURE__ */ new Date()).toISOString() })
10946
10993
  );
10947
10994
  }
@@ -11080,7 +11127,7 @@ async function processAgent(agent, agentStates) {
11080
11127
  }
11081
11128
  const now = (/* @__PURE__ */ new Date()).toISOString();
11082
11129
  const adapter = resolveAgentFramework(agent.code_name);
11083
- let agentDir = join22(adapter.getAgentDir(agent.code_name), "provision");
11130
+ let agentDir = join23(adapter.getAgentDir(agent.code_name), "provision");
11084
11131
  if (agent.status === "draft" || agent.status === "paused") {
11085
11132
  if (previousKnownStatus !== agent.status) {
11086
11133
  log(`Agent '${agent.code_name}' is ${agent.status}, skipping provisioning`);
@@ -11264,7 +11311,7 @@ async function processAgent(agent, agentStates) {
11264
11311
  const frameworkId = refreshData.agent.framework ?? DEFAULT_FRAMEWORK;
11265
11312
  agentFrameworkCache.set(agent.code_name, frameworkId);
11266
11313
  const frameworkAdapter = getFramework(frameworkId);
11267
- agentDir = join22(frameworkAdapter.getAgentDir(agent.code_name), "provision");
11314
+ agentDir = join23(frameworkAdapter.getAgentDir(agent.code_name), "provision");
11268
11315
  cacheAgentDeliveryMetadata(agent.code_name, refreshData);
11269
11316
  agentRestartTimezoneInputs.set(agent.code_name, {
11270
11317
  agentTimezone: typeof refreshData.agent.timezone === "string" ? refreshData.agent.timezone : null,
@@ -11309,9 +11356,9 @@ async function processAgent(agent, agentStates) {
11309
11356
  try {
11310
11357
  const artifacts = generateArtifacts(agent, refreshData, frameworkAdapter);
11311
11358
  const changedFiles = [];
11312
- mkdirSync9(agentDir, { recursive: true });
11359
+ mkdirSync10(agentDir, { recursive: true });
11313
11360
  for (const artifact of artifacts) {
11314
- const filePath = join22(agentDir, artifact.relativePath);
11361
+ const filePath = join23(agentDir, artifact.relativePath);
11315
11362
  let existingHash;
11316
11363
  let newHash;
11317
11364
  let writeContent = artifact.content;
@@ -11330,7 +11377,7 @@ async function processAgent(agent, agentStates) {
11330
11377
  };
11331
11378
  newHash = sha256(stripDynamicSections(artifact.content));
11332
11379
  try {
11333
- const projectClaudeMd = join22(config.configDir, agent.code_name, "project", "CLAUDE.md");
11380
+ const projectClaudeMd = join23(config.configDir, agent.code_name, "project", "CLAUDE.md");
11334
11381
  const existing = readFileSync19(projectClaudeMd, "utf-8");
11335
11382
  existingHash = sha256(stripDynamicSections(existing));
11336
11383
  } catch {
@@ -11371,26 +11418,26 @@ async function processAgent(agent, agentStates) {
11371
11418
  }
11372
11419
  }
11373
11420
  if (changedFiles.length > 0) {
11374
- const isFirst = !existsSync13(join22(agentDir, "CHARTER.md"));
11421
+ const isFirst = !existsSync13(join23(agentDir, "CHARTER.md"));
11375
11422
  const verb = isFirst ? "Provisioning" : "Updating";
11376
11423
  const fileNames = changedFiles.map((f) => f.relativePath).join(", ");
11377
11424
  log(`${verb} '${agent.code_name}': ${fileNames}`);
11378
11425
  for (const file of changedFiles) {
11379
- const filePath = join22(agentDir, file.relativePath);
11380
- mkdirSync9(dirname6(filePath), { recursive: true });
11426
+ const filePath = join23(agentDir, file.relativePath);
11427
+ mkdirSync10(dirname6(filePath), { recursive: true });
11381
11428
  if (file.relativePath === ".mcp.json") {
11382
11429
  safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
11383
11430
  } else {
11384
- writeFileSync10(filePath, file.content);
11431
+ writeFileSync11(filePath, file.content);
11385
11432
  }
11386
11433
  }
11387
11434
  try {
11388
- const provSkillsDir = join22(agentDir, ".claude", "skills");
11435
+ const provSkillsDir = join23(agentDir, ".claude", "skills");
11389
11436
  if (existsSync13(provSkillsDir)) {
11390
11437
  for (const folder of readdirSync5(provSkillsDir)) {
11391
11438
  if (folder.startsWith("knowledge-")) {
11392
11439
  try {
11393
- rmSync4(join22(provSkillsDir, folder), { recursive: true });
11440
+ rmSync5(join23(provSkillsDir, folder), { recursive: true });
11394
11441
  } catch {
11395
11442
  }
11396
11443
  }
@@ -11403,7 +11450,7 @@ async function processAgent(agent, agentStates) {
11403
11450
  const trackedFiles2 = frameworkAdapter.driftTrackedFiles();
11404
11451
  const hashes = /* @__PURE__ */ new Map();
11405
11452
  for (const file of trackedFiles2) {
11406
- const h = hashFile(join22(agentDir, file));
11453
+ const h = hashFile(join23(agentDir, file));
11407
11454
  if (h) hashes.set(file, h);
11408
11455
  }
11409
11456
  agentState.writtenHashes.set(agent.agent_id, hashes);
@@ -11421,14 +11468,14 @@ async function processAgent(agent, agentStates) {
11421
11468
  }
11422
11469
  if (Array.isArray(refreshData.workflows)) {
11423
11470
  try {
11424
- const provWorkflowsDir = join22(agentDir, ".claude", "workflows");
11471
+ const provWorkflowsDir = join23(agentDir, ".claude", "workflows");
11425
11472
  if (existsSync13(provWorkflowsDir)) {
11426
11473
  const expected = new Set(refreshData.workflows.map((w) => `${w.name}.js`));
11427
11474
  for (const file of readdirSync5(provWorkflowsDir)) {
11428
11475
  if (!file.endsWith(".js")) continue;
11429
11476
  if (expected.has(file)) continue;
11430
11477
  try {
11431
- rmSync4(join22(provWorkflowsDir, file));
11478
+ rmSync5(join23(provWorkflowsDir, file));
11432
11479
  } catch {
11433
11480
  }
11434
11481
  }
@@ -11488,7 +11535,7 @@ async function processAgent(agent, agentStates) {
11488
11535
  if (written && existsSync13(agentDir)) {
11489
11536
  const driftedFiles = [];
11490
11537
  for (const [file, expectedHash] of written) {
11491
- const localHash = hashFile(join22(agentDir, file));
11538
+ const localHash = hashFile(join23(agentDir, file));
11492
11539
  if (localHash && localHash !== expectedHash) {
11493
11540
  driftedFiles.push(file);
11494
11541
  }
@@ -11499,7 +11546,7 @@ async function processAgent(agent, agentStates) {
11499
11546
  try {
11500
11547
  const localHashes = {};
11501
11548
  for (const file of driftedFiles) {
11502
- localHashes[file] = hashFile(join22(agentDir, file));
11549
+ localHashes[file] = hashFile(join23(agentDir, file));
11503
11550
  }
11504
11551
  await api.post("/host/drift", {
11505
11552
  agent_id: agent.agent_id,
@@ -11686,15 +11733,15 @@ async function processAgent(agent, agentStates) {
11686
11733
  const addedChannels = [...restartDecision.added];
11687
11734
  const writeDmNoticeMarkers = isChannelAddRestart ? () => {
11688
11735
  try {
11689
- const agentAugmentedDir = join22(homedir11(), ".augmented", agent.code_name);
11690
- mkdirSync9(agentAugmentedDir, { recursive: true });
11736
+ const agentAugmentedDir = join23(homedir12(), ".augmented", agent.code_name);
11737
+ mkdirSync10(agentAugmentedDir, { recursive: true });
11691
11738
  const markerJson = JSON.stringify({
11692
11739
  version: 1,
11693
11740
  at: (/* @__PURE__ */ new Date()).toISOString(),
11694
11741
  added: addedChannels
11695
11742
  });
11696
11743
  for (const file of ["slack-channel-add-restart.json", "telegram-channel-add-restart.json"]) {
11697
- atomicWriteFileSync(join22(agentAugmentedDir, file), markerJson);
11744
+ atomicWriteFileSync(join23(agentAugmentedDir, file), markerJson);
11698
11745
  }
11699
11746
  } catch (err) {
11700
11747
  log(`[hot-reload] channel-add DM-notice marker write failed for '${agent.code_name}' (non-fatal): ${err.message}`);
@@ -11883,18 +11930,18 @@ async function processAgent(agent, agentStates) {
11883
11930
  if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code") {
11884
11931
  try {
11885
11932
  const agentProvisionDir = agentDir;
11886
- const projectDir = join22(homedir11(), ".augmented", agent.code_name, "project");
11887
- mkdirSync9(agentProvisionDir, { recursive: true });
11888
- mkdirSync9(projectDir, { recursive: true });
11889
- const provisionMcpPath = join22(agentProvisionDir, ".mcp.json");
11890
- const projectMcpPath = join22(projectDir, ".mcp.json");
11933
+ const projectDir = join23(homedir12(), ".augmented", agent.code_name, "project");
11934
+ mkdirSync10(agentProvisionDir, { recursive: true });
11935
+ mkdirSync10(projectDir, { recursive: true });
11936
+ const provisionMcpPath = join23(agentProvisionDir, ".mcp.json");
11937
+ const projectMcpPath = join23(projectDir, ".mcp.json");
11891
11938
  let mcpConfig = { mcpServers: {} };
11892
11939
  try {
11893
11940
  mcpConfig = JSON.parse(readFileSync19(provisionMcpPath, "utf-8"));
11894
11941
  if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
11895
11942
  } catch {
11896
11943
  }
11897
- const localDirectChatChannel = join22(homedir11(), ".augmented", "_mcp", "direct-chat-channel.js");
11944
+ const localDirectChatChannel = join23(homedir12(), ".augmented", "_mcp", "direct-chat-channel.js");
11898
11945
  const directChatTeamSettings = refreshData.team?.settings;
11899
11946
  const directChatTz = (() => {
11900
11947
  const tz = directChatTeamSettings?.["timezone"];
@@ -11920,7 +11967,7 @@ async function processAgent(agent, agentStates) {
11920
11967
  // ~/.augmented/<codeName>/.current-turn-initiator.json. Note getAgentDir
11921
11968
  // returns the agent root (NOT the /provision subdir `agentDir` points at),
11922
11969
  // so it byte-matches the broker readers' path.
11923
- AGT_TURN_INITIATOR_FILE: join22(
11970
+ AGT_TURN_INITIATOR_FILE: join23(
11924
11971
  frameworkAdapter.getAgentDir(agent.code_name),
11925
11972
  ".current-turn-initiator.json"
11926
11973
  )
@@ -11940,10 +11987,10 @@ async function processAgent(agent, agentStates) {
11940
11987
  log(`Channel credentials written for '${agent.code_name}/direct-chat'`);
11941
11988
  }
11942
11989
  }
11943
- const staleChannelsPath = join22(projectDir, ".mcp-channels.json");
11990
+ const staleChannelsPath = join23(projectDir, ".mcp-channels.json");
11944
11991
  if (existsSync13(staleChannelsPath)) {
11945
11992
  try {
11946
- rmSync4(staleChannelsPath, { force: true });
11993
+ rmSync5(staleChannelsPath, { force: true });
11947
11994
  } catch {
11948
11995
  }
11949
11996
  }
@@ -12030,7 +12077,7 @@ async function processAgent(agent, agentStates) {
12030
12077
  }
12031
12078
  if (hostFlagStore().getBoolean("connectivity-probe")) {
12032
12079
  try {
12033
- const probeProjectDir = join22(homedir11(), ".augmented", agent.code_name, "project");
12080
+ const probeProjectDir = join23(homedir12(), ".augmented", agent.code_name, "project");
12034
12081
  await runAgentConnectivityProbes(agent, integrations, probeProjectDir);
12035
12082
  } catch (err) {
12036
12083
  log(`Connectivity probe failed for '${agent.code_name}': ${err.message}`);
@@ -12041,7 +12088,7 @@ async function processAgent(agent, agentStates) {
12041
12088
  const forceDue = attemptsLeft > 0;
12042
12089
  let probeRan = false;
12043
12090
  try {
12044
- const probeProjectDir = join22(homedir11(), ".augmented", agent.code_name, "project");
12091
+ const probeProjectDir = join23(homedir12(), ".augmented", agent.code_name, "project");
12045
12092
  probeRan = await runAgentSessionToolBindProbes(agent, integrations, probeProjectDir, { forceDue });
12046
12093
  } catch (err) {
12047
12094
  log(`Session-tool-bind probe failed for '${agent.code_name}': ${err.message}`);
@@ -12081,8 +12128,8 @@ async function processAgent(agent, agentStates) {
12081
12128
  recordConfigChurnEvent(agent.agent_id, agent.code_name, FLAP_CHANNEL_INTEGRATIONS, intMembership);
12082
12129
  }
12083
12130
  if (intHash !== prevIntHash) {
12084
- const projectDir = join22(homedir11(), ".augmented", agent.code_name, "project");
12085
- const envIntPath = join22(projectDir, ".env.integrations");
12131
+ const projectDir = join23(homedir12(), ".augmented", agent.code_name, "project");
12132
+ const envIntPath = join23(projectDir, ".env.integrations");
12086
12133
  let preWriteEnv;
12087
12134
  try {
12088
12135
  preWriteEnv = readFileSync19(envIntPath, "utf-8");
@@ -12097,7 +12144,7 @@ async function processAgent(agent, agentStates) {
12097
12144
  let rotationHandled = true;
12098
12145
  if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
12099
12146
  try {
12100
- const projectMcpPath = join22(projectDir, ".mcp.json");
12147
+ const projectMcpPath = join23(projectDir, ".mcp.json");
12101
12148
  const postWriteEnv = readFileSync19(envIntPath, "utf-8");
12102
12149
  const mcpContent = readFileSync19(projectMcpPath, "utf-8");
12103
12150
  const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
@@ -12344,17 +12391,17 @@ async function processAgent(agent, agentStates) {
12344
12391
  }
12345
12392
  }
12346
12393
  try {
12347
- const { readdirSync: readdirSync6, rmSync: rmSync5 } = await import("fs");
12348
- const { homedir: homedir12 } = await import("os");
12394
+ const { readdirSync: readdirSync6, rmSync: rmSync6 } = await import("fs");
12395
+ const { homedir: homedir13 } = await import("os");
12349
12396
  const frameworkId2 = frameworkAdapter.id;
12350
12397
  const candidateSkillDirs = [
12351
12398
  // Claude Code — framework runtime tree
12352
- join22(homedir12(), ".augmented", agent.code_name, "skills"),
12399
+ join23(homedir13(), ".augmented", agent.code_name, "skills"),
12353
12400
  // Claude Code — project tree
12354
- join22(homedir12(), ".augmented", agent.code_name, "project", ".claude", "skills"),
12401
+ join23(homedir13(), ".augmented", agent.code_name, "project", ".claude", "skills"),
12355
12402
  // Defensive: legacy provision-side path, not currently an
12356
12403
  // install target but cheap to sweep.
12357
- join22(agentDir, ".claude", "skills")
12404
+ join23(agentDir, ".claude", "skills")
12358
12405
  ];
12359
12406
  const existingDirs = candidateSkillDirs.filter((d) => existsSync13(d));
12360
12407
  const discoveredEntries = /* @__PURE__ */ new Set();
@@ -12370,9 +12417,9 @@ async function processAgent(agent, agentStates) {
12370
12417
  }
12371
12418
  const removeSkillFolder = (entry, reason) => {
12372
12419
  for (const dir of existingDirs) {
12373
- const p = join22(dir, entry);
12420
+ const p = join23(dir, entry);
12374
12421
  if (existsSync13(p)) {
12375
- rmSync5(p, { recursive: true, force: true });
12422
+ rmSync6(p, { recursive: true, force: true });
12376
12423
  }
12377
12424
  }
12378
12425
  log(`Removed ${reason} '${entry}' for '${agent.code_name}' (framework=${frameworkId2})`);
@@ -12390,7 +12437,7 @@ async function processAgent(agent, agentStates) {
12390
12437
  const sharedSkillsPayload = refreshAny.shared_skills;
12391
12438
  const desiredResolved = globalSkillsPayload !== void 0 || sharedSkillsPayload !== void 0;
12392
12439
  const manifestPath = managedSkillManifestPath(
12393
- join22(homedir11(), ".augmented", agent.code_name)
12440
+ join23(homedir12(), ".augmented", agent.code_name)
12394
12441
  );
12395
12442
  const prevIds = /* @__PURE__ */ new Set([
12396
12443
  ...agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
@@ -12410,16 +12457,16 @@ async function processAgent(agent, agentStates) {
12410
12457
  }
12411
12458
  if (plan.removes.length) {
12412
12459
  const globalSkillDirs = [
12413
- join22(homedir11(), ".augmented", agent.code_name, "skills"),
12414
- join22(homedir11(), ".augmented", agent.code_name, "project", ".claude", "skills"),
12415
- join22(agentDir, ".claude", "skills")
12460
+ join23(homedir12(), ".augmented", agent.code_name, "skills"),
12461
+ join23(homedir12(), ".augmented", agent.code_name, "project", ".claude", "skills"),
12462
+ join23(agentDir, ".claude", "skills")
12416
12463
  ];
12417
12464
  for (const id of plan.removes) {
12418
12465
  let prunedAny = false;
12419
12466
  for (const dir of globalSkillDirs) {
12420
- const p = join22(dir, id);
12421
- if (existsSync13(p) && existsSync13(join22(p, "SKILL.md"))) {
12422
- rmSync4(p, { recursive: true, force: true });
12467
+ const p = join23(dir, id);
12468
+ if (existsSync13(p) && existsSync13(join23(p, "SKILL.md"))) {
12469
+ rmSync5(p, { recursive: true, force: true });
12423
12470
  prunedAny = true;
12424
12471
  }
12425
12472
  }
@@ -12624,7 +12671,7 @@ async function processAgent(agent, agentStates) {
12624
12671
  const sess = getSessionState(agent.code_name);
12625
12672
  let mcpJsonParsed = null;
12626
12673
  try {
12627
- const mcpPath = join22(getProjectDir(agent.code_name), ".mcp.json");
12674
+ const mcpPath = join23(getProjectDir(agent.code_name), ".mcp.json");
12628
12675
  mcpJsonParsed = JSON.parse(readFileSync19(mcpPath, "utf-8"));
12629
12676
  } catch {
12630
12677
  }
@@ -12957,7 +13004,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
12957
13004
  if (trackedFiles.length > 0 && existsSync13(agentDir)) {
12958
13005
  const hashes = /* @__PURE__ */ new Map();
12959
13006
  for (const file of trackedFiles) {
12960
- const h = hashFile(join22(agentDir, file));
13007
+ const h = hashFile(join23(agentDir, file));
12961
13008
  if (h) hashes.set(file, h);
12962
13009
  }
12963
13010
  agentState.writtenHashes.set(agent.agent_id, hashes);
@@ -12972,7 +13019,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
12972
13019
  refreshData.agent.onboarding_state
12973
13020
  );
12974
13021
  const obStep = obState.step;
12975
- const markerPath = join22(homedir11(), ".augmented", agent.code_name, "onboarding-drive.json");
13022
+ const markerPath = join23(homedir12(), ".augmented", agent.code_name, "onboarding-drive.json");
12976
13023
  const marker = readOnboardingDriveMarker(markerPath);
12977
13024
  const decision = decideOnboardingDrive(obStep, marker, Date.now(), obState.generation ?? 0);
12978
13025
  if (decision.clearMarker) {
@@ -13042,7 +13089,7 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
13042
13089
  }
13043
13090
  stopOpencodeSlackIngest(codeName, log);
13044
13091
  stopOpencodeTelegramIngest(codeName, log);
13045
- const opencodeProjectDir = join22(getFramework("opencode").getAgentDir(codeName), "provision");
13092
+ const opencodeProjectDir = join23(getFramework("opencode").getAgentDir(codeName), "provision");
13046
13093
  const openRouterRaw = refreshData.openrouter ?? null;
13047
13094
  const serveEnv = {
13048
13095
  AGT_HOST: requireHost(),
@@ -13082,8 +13129,8 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
13082
13129
  async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
13083
13130
  const codeName = agent.code_name;
13084
13131
  const projectDir = getProjectDir(codeName);
13085
- const mcpConfigPath = join22(projectDir, ".mcp.json");
13086
- const claudeMdPath = join22(projectDir, "CLAUDE.md");
13132
+ const mcpConfigPath = join23(projectDir, ".mcp.json");
13133
+ const claudeMdPath = join23(projectDir, "CLAUDE.md");
13087
13134
  if (restartBreaker.isTripped(codeName)) {
13088
13135
  const trip = restartBreaker.getTrip(codeName);
13089
13136
  return {
@@ -13621,7 +13668,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
13621
13668
  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}`));
13622
13669
  void (async () => {
13623
13670
  try {
13624
- const { collectDiagnostics } = await import("../persistent-session-IDWQO7QL.js");
13671
+ const { collectDiagnostics } = await import("../persistent-session-2UIVPYXX.js");
13625
13672
  await api.post("/host/heartbeat", {
13626
13673
  host_id: hostId,
13627
13674
  agent_diagnostics: collectDiagnostics([codeName])
@@ -13671,7 +13718,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
13671
13718
  }
13672
13719
  try {
13673
13720
  const hostId = await getHostId();
13674
- const { collectDiagnostics } = await import("../persistent-session-IDWQO7QL.js");
13721
+ const { collectDiagnostics } = await import("../persistent-session-2UIVPYXX.js");
13675
13722
  await api.post("/host/heartbeat", {
13676
13723
  host_id: hostId,
13677
13724
  agent_diagnostics: collectDiagnostics([codeName])
@@ -13956,9 +14003,9 @@ async function processDirectChatMessage(agent, msg) {
13956
14003
  const useDoorbell = hostFlagStore().getBoolean("direct-chat-doorbell") || isolationMode(agent.codeName) === "docker";
13957
14004
  if (useDoorbell) {
13958
14005
  try {
13959
- const doorbell = directChatDoorbellPath(agent.agentId, homedir11());
13960
- mkdirSync9(dirname6(doorbell), { recursive: true });
13961
- writeFileSync10(doorbell, String(Date.now()));
14006
+ const doorbell = directChatDoorbellPath(agent.agentId, homedir12());
14007
+ mkdirSync10(dirname6(doorbell), { recursive: true });
14008
+ writeFileSync11(doorbell, String(Date.now()));
13962
14009
  log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
13963
14010
  return;
13964
14011
  } catch (err) {
@@ -14066,9 +14113,9 @@ ${formatRunMarker(run_id)}` : KANBAN_CHECK_COMMAND;
14066
14113
  }
14067
14114
  if (run_id) openInjectedRunByCode.set(codeName, run_id);
14068
14115
  try {
14069
- const doorbell = directChatDoorbellPath(agentId, homedir11());
14070
- mkdirSync9(dirname6(doorbell), { recursive: true });
14071
- writeFileSync10(doorbell, String(Date.now()));
14116
+ const doorbell = directChatDoorbellPath(agentId, homedir12());
14117
+ mkdirSync10(dirname6(doorbell), { recursive: true });
14118
+ writeFileSync11(doorbell, String(Date.now()));
14072
14119
  } catch (err) {
14073
14120
  log(`[kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
14074
14121
  }
@@ -14169,7 +14216,7 @@ async function processClaudePairSessions(agents) {
14169
14216
  killPairSession,
14170
14217
  pairTmuxSession,
14171
14218
  finalizeClaudePairOnboarding
14172
- } = await import("../claude-pair-runtime-JU3CVFUU.js");
14219
+ } = await import("../claude-pair-runtime-6ZLQEZU6.js");
14173
14220
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
14174
14221
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
14175
14222
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -14419,8 +14466,8 @@ function parseMemoryFile(raw, fallbackName) {
14419
14466
  };
14420
14467
  }
14421
14468
  async function syncMemories(agent, configDir, log2) {
14422
- const projectDir = join22(configDir, agent.code_name, "project");
14423
- const memoryDir = join22(projectDir, "memory");
14469
+ const projectDir = join23(configDir, agent.code_name, "project");
14470
+ const memoryDir = join23(projectDir, "memory");
14424
14471
  const isFreshSync = pendingFreshMemorySync.has(agent.agent_id);
14425
14472
  if (isFreshSync) {
14426
14473
  log2(`[memory-sync] Fresh-sync requested for '${agent.code_name}' \u2014 pulling DB first`);
@@ -14438,7 +14485,7 @@ async function syncMemories(agent, configDir, log2) {
14438
14485
  for (const file of readdirSync5(memoryDir)) {
14439
14486
  if (!file.endsWith(".md")) continue;
14440
14487
  try {
14441
- const raw = readFileSync19(join22(memoryDir, file), "utf-8");
14488
+ const raw = readFileSync19(join23(memoryDir, file), "utf-8");
14442
14489
  const fileHash = createHash14("sha256").update(raw).digest("hex").slice(0, 16);
14443
14490
  currentHashes.set(file, fileHash);
14444
14491
  if (prevHashes.get(file) === fileHash) continue;
@@ -14463,7 +14510,7 @@ async function syncMemories(agent, configDir, log2) {
14463
14510
  } catch (err) {
14464
14511
  for (const mem of changedMemories) {
14465
14512
  for (const [file] of currentHashes) {
14466
- const parsed = parseMemoryFile(readFileSync19(join22(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
14513
+ const parsed = parseMemoryFile(readFileSync19(join23(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
14467
14514
  if (parsed?.name === mem.name) currentHashes.delete(file);
14468
14515
  }
14469
14516
  }
@@ -14491,14 +14538,14 @@ async function downloadMemories(agent, memoryDir, log2, { force }) {
14491
14538
  lastDownloadHash.set(agent.agent_id, responseHash);
14492
14539
  lastLocalFileHash.set(agent.agent_id, localListHash);
14493
14540
  if (dbMemories.memories?.length) {
14494
- mkdirSync9(memoryDir, { recursive: true });
14541
+ mkdirSync10(memoryDir, { recursive: true });
14495
14542
  let written = 0;
14496
14543
  let overwritten = 0;
14497
14544
  for (let i = 0; i < dbMemories.memories.length; i++) {
14498
14545
  const mem = dbMemories.memories[i];
14499
14546
  const rawSlug = mem.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "").slice(0, 60);
14500
14547
  const slug = rawSlug || `memory-${i}`;
14501
- const filePath = join22(memoryDir, `${slug}.md`);
14548
+ const filePath = join23(memoryDir, `${slug}.md`);
14502
14549
  const desired = `---
14503
14550
  name: ${JSON.stringify(mem.name)}
14504
14551
  type: ${mem.type}
@@ -14514,10 +14561,10 @@ ${mem.content}
14514
14561
  } catch {
14515
14562
  }
14516
14563
  if (existing === desired) continue;
14517
- writeFileSync10(filePath, desired);
14564
+ writeFileSync11(filePath, desired);
14518
14565
  overwritten++;
14519
14566
  } else {
14520
- writeFileSync10(filePath, desired);
14567
+ writeFileSync11(filePath, desired);
14521
14568
  written++;
14522
14569
  }
14523
14570
  }
@@ -14536,7 +14583,7 @@ ${mem.content}
14536
14583
  async function cleanupAgentFiles(codeName, agentDir) {
14537
14584
  if (existsSync13(agentDir)) {
14538
14585
  try {
14539
- rmSync4(agentDir, { recursive: true, force: true });
14586
+ rmSync5(agentDir, { recursive: true, force: true });
14540
14587
  log(`Removed provision directory for '${codeName}'`);
14541
14588
  } catch (err) {
14542
14589
  log(`Failed to remove provision dir for '${codeName}': ${err.message}`);
@@ -14799,7 +14846,7 @@ function startManager(opts) {
14799
14846
  log(`[startup] state rehydration failed (continuing with empty state): ${err.message}`);
14800
14847
  }
14801
14848
  log(
14802
- `[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join22(homedir11(), ".augmented", "manager.log")}`
14849
+ `[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join23(homedir12(), ".augmented", "manager.log")}`
14803
14850
  );
14804
14851
  deployMcpAssets();
14805
14852
  reapOrphanChannelMcps({ log });
@@ -14917,14 +14964,14 @@ function restartRunningChannelMcps(basenames) {
14917
14964
  }
14918
14965
  }
14919
14966
  function deployMcpAssets() {
14920
- const targetDir = join22(homedir11(), ".augmented", "_mcp");
14921
- mkdirSync9(targetDir, { recursive: true });
14967
+ const targetDir = join23(homedir12(), ".augmented", "_mcp");
14968
+ mkdirSync10(targetDir, { recursive: true });
14922
14969
  const moduleDir = dirname6(fileURLToPath(import.meta.url));
14923
14970
  let mcpSourceDir = "";
14924
14971
  let dir = moduleDir;
14925
14972
  for (let i = 0; i < 6; i++) {
14926
- const candidate = join22(dir, "dist", "mcp");
14927
- if (existsSync13(join22(candidate, "index.js"))) {
14973
+ const candidate = join23(dir, "dist", "mcp");
14974
+ if (existsSync13(join23(candidate, "index.js"))) {
14928
14975
  mcpSourceDir = candidate;
14929
14976
  break;
14930
14977
  }
@@ -15004,8 +15051,8 @@ function deployMcpAssets() {
15004
15051
  // needs restarting to pick up a token rotation.
15005
15052
  "xero.js"
15006
15053
  ]) {
15007
- const src = join22(mcpSourceDir, file);
15008
- const dst = join22(targetDir, file);
15054
+ const src = join23(mcpSourceDir, file);
15055
+ const dst = join23(targetDir, file);
15009
15056
  if (!existsSync13(src)) continue;
15010
15057
  const before = fileHash(dst);
15011
15058
  try {
@@ -15023,14 +15070,14 @@ function deployMcpAssets() {
15023
15070
  log(`[manager] Bundle(s) updated: ${changedBasenames.join(", ")} \u2014 signalling running instances to restart`);
15024
15071
  restartRunningChannelMcps(changedBasenames);
15025
15072
  }
15026
- const localMcpPath = join22(targetDir, "index.js");
15073
+ const localMcpPath = join23(targetDir, "index.js");
15027
15074
  try {
15028
- const agentsDir = join22(homedir11(), ".augmented", "agents");
15075
+ const agentsDir = join23(homedir12(), ".augmented", "agents");
15029
15076
  if (existsSync13(agentsDir)) {
15030
15077
  for (const entry of readdirSync5(agentsDir, { withFileTypes: true })) {
15031
15078
  if (!entry.isDirectory()) continue;
15032
15079
  for (const subdir of ["provision", "project"]) {
15033
- const mcpJsonPath = join22(agentsDir, entry.name, subdir, ".mcp.json");
15080
+ const mcpJsonPath = join23(agentsDir, entry.name, subdir, ".mcp.json");
15034
15081
  try {
15035
15082
  const raw = readFileSync19(mcpJsonPath, "utf-8");
15036
15083
  if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
@@ -15039,7 +15086,7 @@ function deployMcpAssets() {
15039
15086
  if (!augServer) continue;
15040
15087
  augServer.command = "node";
15041
15088
  augServer.args = [localMcpPath];
15042
- writeFileSync10(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
15089
+ writeFileSync11(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
15043
15090
  log(`[manager] Patched ${entry.name}/${subdir}/.mcp.json: npx \u2192 node`);
15044
15091
  } catch {
15045
15092
  }