@integrity-labs/agt-cli 0.28.344 → 0.28.345

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-GJ5TGARW.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-O5IINJDB.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,22 @@ 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
+ const path = join5(homedir3(), ".augmented", args.codeName, USAGE_LIMIT_MARKER_FILENAME);
1870
+ try {
1871
+ if (args.pct >= 100) {
1872
+ mkdirSync4(join5(homedir3(), ".augmented", args.codeName), { recursive: true });
1873
+ writeFileSync4(path, serializeUsageLimitMarker(args.weekResetsAt), "utf-8");
1874
+ } else {
1875
+ rmSync2(path, { force: true });
1876
+ }
1877
+ } catch (err) {
1878
+ args.log(`[usage-banner] usage-limit marker sync failed for '${args.codeName}': ${err.message}`);
1879
+ }
1880
+ }
1863
1881
  var MIN_CHECK_INTERVAL_MS = 6e4;
1864
1882
  var PANE_TAIL_LINES_FOR_BANNER = 5e3;
1865
1883
  var state = /* @__PURE__ */ new Map();
@@ -1892,6 +1910,12 @@ async function maybeReportUsageBanner(args) {
1892
1910
  state.set(codeName, next);
1893
1911
  return;
1894
1912
  }
1913
+ syncUsageLimitMarker({
1914
+ codeName,
1915
+ pct: observation.pct,
1916
+ weekResetsAt: observation.weekResetsAt,
1917
+ log: log2
1918
+ });
1895
1919
  const observedAtIso = next.lastWeekResetsAt;
1896
1920
  const weekResetsAtIso = observation.weekResetsAt.toISOString();
1897
1921
  if (existing && existing.lastPct === observation.pct && observedAtIso === weekResetsAtIso) {
@@ -1916,7 +1940,7 @@ async function maybeReportUsageBanner(args) {
1916
1940
 
1917
1941
  // src/lib/token-usage-monitor.ts
1918
1942
  import { readdirSync, readFileSync as readFileSync6, statSync } from "fs";
1919
- import { join as join5 } from "path";
1943
+ import { join as join6 } from "path";
1920
1944
  var MIN_CHECK_INTERVAL_MS2 = 6e4;
1921
1945
  var TRANSCRIPT_MTIME_WINDOW_MS = 2 * 24 * 60 * 60 * 1e3;
1922
1946
  var MAX_ENTRIES_PER_POST = 200;
@@ -1945,7 +1969,7 @@ async function maybeReportTokenUsage(args) {
1945
1969
  if (!name.endsWith(".jsonl")) continue;
1946
1970
  const sessionId = name.slice(0, -".jsonl".length);
1947
1971
  if (!sessionId) continue;
1948
- const path = join5(dir, name);
1972
+ const path = join6(dir, name);
1949
1973
  let st;
1950
1974
  try {
1951
1975
  st = statSync(path);
@@ -2043,7 +2067,7 @@ async function maybeReportTokenUsage(args) {
2043
2067
 
2044
2068
  // src/lib/workflow-run-reconciler.ts
2045
2069
  import { readdirSync as readdirSync2, readFileSync as readFileSync7, statSync as statSync2 } from "fs";
2046
- import { join as join6 } from "path";
2070
+ import { join as join7 } from "path";
2047
2071
  var MIN_CHECK_INTERVAL_MS3 = 5 * 6e4;
2048
2072
  var SETTLE_MS = 3e4;
2049
2073
  var TRANSCRIPT_MTIME_WINDOW_MS2 = 2 * 24 * 60 * 60 * 1e3;
@@ -2062,7 +2086,7 @@ function collectJsonlRecursive(dir, minMtimeMs, out, depth) {
2062
2086
  return;
2063
2087
  }
2064
2088
  for (const name of entries) {
2065
- const p = join6(dir, name);
2089
+ const p = join7(dir, name);
2066
2090
  let st;
2067
2091
  try {
2068
2092
  st = statSync2(p);
@@ -2085,7 +2109,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
2085
2109
  return out;
2086
2110
  }
2087
2111
  for (const name of entries) {
2088
- const path = join6(transcriptDir, name);
2112
+ const path = join7(transcriptDir, name);
2089
2113
  let st;
2090
2114
  try {
2091
2115
  st = statSync2(path);
@@ -2097,7 +2121,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
2097
2121
  continue;
2098
2122
  }
2099
2123
  if (st.isDirectory()) {
2100
- collectJsonlRecursive(join6(path, "subagents"), minMtimeMs, out, 0);
2124
+ collectJsonlRecursive(join7(path, "subagents"), minMtimeMs, out, 0);
2101
2125
  }
2102
2126
  }
2103
2127
  return out;
@@ -2188,7 +2212,7 @@ async function maybeReconcileWorkflowRunTokens(args) {
2188
2212
 
2189
2213
  // src/lib/conversation-evaluator.ts
2190
2214
  import { readdirSync as readdirSync3, readFileSync as readFileSync8, statSync as statSync3 } from "fs";
2191
- import { join as join7 } from "path";
2215
+ import { join as join8 } from "path";
2192
2216
  var MIN_CHECK_INTERVAL_MS4 = 5 * 6e4;
2193
2217
  var TRANSCRIPT_MTIME_WINDOW_MS3 = 7 * 24 * 60 * 60 * 1e3;
2194
2218
  var WINDOW_PAD_MS = 5 * 6e4;
@@ -2624,7 +2648,7 @@ function readRecentTurns(dir, nowMs) {
2624
2648
  return;
2625
2649
  }
2626
2650
  for (const ent of entries) {
2627
- const full = join7(d, ent.name);
2651
+ const full = join8(d, ent.name);
2628
2652
  if (ent.isDirectory()) {
2629
2653
  visit(full);
2630
2654
  continue;
@@ -2930,10 +2954,10 @@ async function reportSkip2(api2, agentId, conversationId, log2, codeName) {
2930
2954
 
2931
2955
  // src/lib/activity-cache-monitor.ts
2932
2956
  import { existsSync as existsSync2, readFileSync as readFileSync9 } from "fs";
2933
- import { homedir as homedir3 } from "os";
2934
- import { join as join8 } from "path";
2957
+ import { homedir as homedir4 } from "os";
2958
+ import { join as join9 } from "path";
2935
2959
  var MIN_CHECK_INTERVAL_MS6 = 6e4;
2936
- var STATS_CACHE_PATH = join8(homedir3(), ".claude", "stats-cache.json");
2960
+ var STATS_CACHE_PATH = join9(homedir4(), ".claude", "stats-cache.json");
2937
2961
  var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
2938
2962
  var state5 = { lastObservedDate: null, lastCheckedAt: 0 };
2939
2963
  function selectNewDailyRows(raw, lastObservedDate) {
@@ -3167,8 +3191,8 @@ function bundleFingerprint(files) {
3167
3191
 
3168
3192
  // src/lib/claude-auth-detect.ts
3169
3193
  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";
3194
+ import { homedir as homedir5, platform } from "os";
3195
+ import { join as join10 } from "path";
3172
3196
  import { execFile } from "child_process";
3173
3197
  import { promisify } from "util";
3174
3198
  var execFileAsync = promisify(execFile);
@@ -3183,8 +3207,8 @@ async function detectClaudeAuth() {
3183
3207
  }
3184
3208
  async function findClaudeCredentialsPaths() {
3185
3209
  const candidates = [
3186
- join9(homedir4(), ".claude", ".credentials.json"),
3187
- join9(homedir4(), ".claude", "credentials.json")
3210
+ join10(homedir5(), ".claude", ".credentials.json"),
3211
+ join10(homedir5(), ".claude", "credentials.json")
3188
3212
  ];
3189
3213
  const isLinuxRoot = platform() === "linux" && typeof process.getuid === "function" && process.getuid() === 0;
3190
3214
  if (isLinuxRoot) {
@@ -3192,8 +3216,8 @@ async function findClaudeCredentialsPaths() {
3192
3216
  const entries = await readdir2("/home", { withFileTypes: true });
3193
3217
  for (const entry of entries) {
3194
3218
  if (!entry.isDirectory()) continue;
3195
- candidates.push(join9("/home", entry.name, ".claude", ".credentials.json"));
3196
- candidates.push(join9("/home", entry.name, ".claude", "credentials.json"));
3219
+ candidates.push(join10("/home", entry.name, ".claude", ".credentials.json"));
3220
+ candidates.push(join10("/home", entry.name, ".claude", "credentials.json"));
3197
3221
  }
3198
3222
  } catch {
3199
3223
  }
@@ -3289,11 +3313,11 @@ function computeChannelConfigHash(input) {
3289
3313
  }
3290
3314
 
3291
3315
  // 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";
3316
+ import { existsSync as existsSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
3317
+ import { join as join11 } from "path";
3294
3318
  var CACHE_FILENAME = "channel-hash-cache.json";
3295
3319
  function getChannelHashCacheFile(configDir) {
3296
- return join10(configDir, CACHE_FILENAME);
3320
+ return join11(configDir, CACHE_FILENAME);
3297
3321
  }
3298
3322
  function loadChannelHashCache(target, configDir) {
3299
3323
  const path = getChannelHashCacheFile(configDir);
@@ -3314,14 +3338,14 @@ function saveChannelHashCache(source, configDir) {
3314
3338
  const obj = {};
3315
3339
  for (const [key, value] of source) obj[key] = value;
3316
3340
  try {
3317
- writeFileSync4(path, JSON.stringify(obj, null, 2));
3341
+ writeFileSync5(path, JSON.stringify(obj, null, 2));
3318
3342
  } catch {
3319
3343
  }
3320
3344
  }
3321
3345
 
3322
3346
  // src/lib/sender-policy-baseline.ts
3323
3347
  import { existsSync as existsSync4, readFileSync as readFileSync11 } from "fs";
3324
- import { join as join11 } from "path";
3348
+ import { join as join12 } from "path";
3325
3349
  var BASELINE_FILENAME = "sender-policy-baseline.json";
3326
3350
  var SENDER_POLICY_BASELINE_VERSION = 1;
3327
3351
  var BASELINE_CONCERNS = ["senderPolicy", "slackBehaviour", "msteamsBehaviour"];
@@ -3333,7 +3357,7 @@ function createDeliveryBaselineMaps() {
3333
3357
  };
3334
3358
  }
3335
3359
  function getSenderPolicyBaselineFile(configDir) {
3336
- return join11(configDir, BASELINE_FILENAME);
3360
+ return join12(configDir, BASELINE_FILENAME);
3337
3361
  }
3338
3362
  function loadSenderPolicyBaseline(target, configDir, log2) {
3339
3363
  const path = getSenderPolicyBaselineFile(configDir);
@@ -3827,11 +3851,11 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash, options)
3827
3851
  }
3828
3852
 
3829
3853
  // 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";
3854
+ import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync6 } from "fs";
3855
+ import { dirname as dirname4, join as join13 } from "path";
3832
3856
  var MANIFEST_VERSION = 1;
3833
3857
  function managedSkillManifestPath(agentRootDir) {
3834
- return join12(agentRootDir, "managed-skills.json");
3858
+ return join13(agentRootDir, "managed-skills.json");
3835
3859
  }
3836
3860
  function readManagedSkillManifest(path) {
3837
3861
  try {
@@ -3845,21 +3869,21 @@ function readManagedSkillManifest(path) {
3845
3869
  }
3846
3870
  function writeManagedSkillManifest(path, ids) {
3847
3871
  try {
3848
- mkdirSync4(dirname4(path), { recursive: true });
3872
+ mkdirSync5(dirname4(path), { recursive: true });
3849
3873
  const body = {
3850
3874
  version: MANIFEST_VERSION,
3851
3875
  globalSkillIds: [...ids].sort()
3852
3876
  };
3853
- writeFileSync5(path, JSON.stringify(body, null, 2));
3877
+ writeFileSync6(path, JSON.stringify(body, null, 2));
3854
3878
  } catch {
3855
3879
  }
3856
3880
  }
3857
3881
 
3858
3882
  // src/lib/manager/runtime.ts
3859
3883
  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";
3884
+ import { readFileSync as readFileSync13, appendFileSync, mkdirSync as mkdirSync6, chmodSync, existsSync as existsSync6 } from "fs";
3885
+ import { join as join14, dirname as dirname5 } from "path";
3886
+ import { homedir as homedir6 } from "os";
3863
3887
  function redactForDiskLog(value) {
3864
3888
  try {
3865
3889
  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 +3903,8 @@ function log(msg) {
3879
3903
  `;
3880
3904
  if (!managerLogPath) {
3881
3905
  try {
3882
- managerLogPath = join13(homedir5(), ".augmented", "manager.log");
3883
- mkdirSync5(dirname5(managerLogPath), { recursive: true });
3906
+ managerLogPath = join14(homedir6(), ".augmented", "manager.log");
3907
+ mkdirSync6(dirname5(managerLogPath), { recursive: true });
3884
3908
  if (existsSync6(managerLogPath)) {
3885
3909
  chmodSync(managerLogPath, 384);
3886
3910
  }
@@ -4067,9 +4091,9 @@ function resolveModelChain(refreshData) {
4067
4091
  }
4068
4092
 
4069
4093
  // 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";
4094
+ import { existsSync as existsSync7, rmSync as rmSync3 } from "fs";
4095
+ import { join as join15 } from "path";
4096
+ import { homedir as homedir7 } from "os";
4073
4097
  async function applyClaudeAuthToEnv(childEnv, label) {
4074
4098
  const apiKey = getApiKey();
4075
4099
  if (!apiKey) {
@@ -4081,12 +4105,12 @@ async function applyClaudeAuthToEnv(childEnv, label) {
4081
4105
  throw new Error("claude_auth_mode=api_key but /host/exchange returned no decrypted key");
4082
4106
  }
4083
4107
  childEnv.ANTHROPIC_API_KEY = exchange.anthropicApiKey;
4084
- const claudeDir = join14(homedir6(), ".claude");
4108
+ const claudeDir = join15(homedir7(), ".claude");
4085
4109
  for (const filename of [".credentials.json", "credentials.json"]) {
4086
- const p = join14(claudeDir, filename);
4110
+ const p = join15(claudeDir, filename);
4087
4111
  if (existsSync7(p)) {
4088
4112
  try {
4089
- rmSync2(p, { force: true });
4113
+ rmSync3(p, { force: true });
4090
4114
  log(`[${label}] Removed ${p} (api_key mode \u2014 preventing OAuth fallback)`);
4091
4115
  } catch {
4092
4116
  }
@@ -4099,7 +4123,7 @@ async function applyClaudeAuthToEnv(childEnv, label) {
4099
4123
 
4100
4124
  // src/lib/manager/kanban/parsers.ts
4101
4125
  import { existsSync as existsSync8, readFileSync as readFileSync14 } from "fs";
4102
- import { join as join15 } from "path";
4126
+ import { join as join16 } from "path";
4103
4127
  var STANDUP_TEMPLATES = /* @__PURE__ */ new Set(["daily-standup", "end-of-day-summary"]);
4104
4128
  var TASK_UPDATE_TEMPLATES = /* @__PURE__ */ new Set(["hourly-status", "task-update"]);
4105
4129
  var PLAN_TEMPLATES = /* @__PURE__ */ new Set(["morning-plan"]);
@@ -4235,8 +4259,8 @@ function getBuiltInSkillContent(skillId) {
4235
4259
  if (builtInSkillCache.has(skillId)) return builtInSkillCache.get(skillId);
4236
4260
  try {
4237
4261
  const candidates = [
4238
- join15(process.cwd(), "skills", skillId, "SKILL.md"),
4239
- join15(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
4262
+ join16(process.cwd(), "skills", skillId, "SKILL.md"),
4263
+ join16(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
4240
4264
  ];
4241
4265
  for (const candidate of candidates) {
4242
4266
  if (existsSync8(candidate)) {
@@ -4381,12 +4405,12 @@ function formatBoardForPrompt(items, template) {
4381
4405
  }
4382
4406
 
4383
4407
  // 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";
4408
+ import { existsSync as existsSync9, readFileSync as readFileSync15, writeFileSync as writeFileSync7 } from "fs";
4409
+ import { join as join17 } from "path";
4386
4410
  var CACHE_FILENAME2 = "kanban-nudge-state.json";
4387
4411
  var KANBAN_NUDGE_STATE_VERSION = 1;
4388
4412
  function getKanbanNudgeStateFile(configDir) {
4389
- return join16(configDir, CACHE_FILENAME2);
4413
+ return join17(configDir, CACHE_FILENAME2);
4390
4414
  }
4391
4415
  function loadKanbanNudgeState(target, configDir) {
4392
4416
  const path = getKanbanNudgeStateFile(configDir);
@@ -4418,7 +4442,7 @@ function saveKanbanNudgeState(source, configDir) {
4418
4442
  const agents = {};
4419
4443
  for (const [codeName, state7] of source) agents[codeName] = state7;
4420
4444
  try {
4421
- writeFileSync6(path, JSON.stringify({ version: KANBAN_NUDGE_STATE_VERSION, agents }, null, 2));
4445
+ writeFileSync7(path, JSON.stringify({ version: KANBAN_NUDGE_STATE_VERSION, agents }, null, 2));
4422
4446
  } catch {
4423
4447
  }
4424
4448
  }
@@ -4959,9 +4983,9 @@ function closeScheduledRunsForCode(codeName, outcome, reason) {
4959
4983
 
4960
4984
  // src/lib/manager/scheduler/kanban-route.ts
4961
4985
  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";
4986
+ import { writeFileSync as writeFileSync8, renameSync } from "fs";
4987
+ import { homedir as homedir8 } from "os";
4988
+ import { join as join18 } from "path";
4965
4989
 
4966
4990
  // src/lib/manager/delivery/scheduled-output.ts
4967
4991
  async function deliverScheduledTaskOutput(agentCodeName, agentId, rawTarget, body, taskId) {
@@ -5265,10 +5289,10 @@ function resolveScheduledSlackTarget(task) {
5265
5289
  }
5266
5290
  function stampScheduledTurnMarker(codeName, taskId, target) {
5267
5291
  try {
5268
- const file = join17(homedir7(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
5292
+ const file = join18(homedir8(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
5269
5293
  const marker = { ts: Date.now(), task_id: taskId, ...target ? { target } : {} };
5270
5294
  const tmp = `${file}.tmp`;
5271
- writeFileSync7(tmp, JSON.stringify(marker), "utf8");
5295
+ writeFileSync8(tmp, JSON.stringify(marker), "utf8");
5272
5296
  renameSync(tmp, file);
5273
5297
  } catch (err) {
5274
5298
  log(`[scheduled-kanban] scheduled-turn marker write failed for '${codeName}': ${err.message}`);
@@ -5451,10 +5475,10 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
5451
5475
 
5452
5476
  // src/lib/manager/scheduler/execution.ts
5453
5477
  import { createHash as createHash10 } from "crypto";
5454
- import { homedir as homedir8 } from "os";
5455
- import { join as join18 } from "path";
5478
+ import { homedir as homedir9 } from "os";
5479
+ import { join as join19 } from "path";
5456
5480
  function claudePidFilePath() {
5457
- return join18(homedir8(), ".augmented", "manager-claude-pids.json");
5481
+ return join19(homedir9(), ".augmented", "manager-claude-pids.json");
5458
5482
  }
5459
5483
  var inFlightClaudePids = /* @__PURE__ */ new Map();
5460
5484
  function registerClaudeSpawn(record) {
@@ -5518,9 +5542,9 @@ async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData
5518
5542
  import { spawn, execSync } from "child_process";
5519
5543
  import { createServer } from "net";
5520
5544
  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";
5545
+ import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync16 } from "fs";
5546
+ import { homedir as homedir10, userInfo } from "os";
5547
+ import { join as join20 } from "path";
5524
5548
  var OPENCODE_BIN = process.env["AGT_OPENCODE_BIN"]?.trim() || "opencode";
5525
5549
  var sessions = /* @__PURE__ */ new Map();
5526
5550
  var bridges = /* @__PURE__ */ new Map();
@@ -5528,7 +5552,7 @@ function opencodeTmuxSession(codeName) {
5528
5552
  return `agt-oc-${codeName}`;
5529
5553
  }
5530
5554
  function opencodePaneLogPath(codeName) {
5531
- return join19(homedir9(), ".augmented", codeName, "opencode-serve.log");
5555
+ return join20(homedir10(), ".augmented", codeName, "opencode-serve.log");
5532
5556
  }
5533
5557
  function baseUrlFor(port) {
5534
5558
  return `http://127.0.0.1:${port}`;
@@ -5595,7 +5619,7 @@ async function startOpencodeSession(config2) {
5595
5619
  }
5596
5620
  async function spawnServe(config2, session) {
5597
5621
  const { codeName, projectDir, log: log2 } = config2;
5598
- if (!existsSync10(join19(projectDir, "opencode.json"))) {
5622
+ if (!existsSync10(join20(projectDir, "opencode.json"))) {
5599
5623
  log2(`[opencode-session] warning: no opencode.json in ${projectDir} for '${codeName}' (provisioning may not have run)`);
5600
5624
  }
5601
5625
  const tmuxSession = opencodeTmuxSession(codeName);
@@ -5605,13 +5629,13 @@ async function spawnServe(config2, session) {
5605
5629
  execSync(`tmux kill-session -t ${tmuxSession} 2>/dev/null`, { stdio: "ignore" });
5606
5630
  } catch {
5607
5631
  }
5608
- mkdirSync6(join19(homedir9(), ".augmented", codeName), { recursive: true });
5632
+ mkdirSync7(join20(homedir10(), ".augmented", codeName), { recursive: true });
5609
5633
  const serveEnv = {
5610
5634
  ...process.env,
5611
5635
  ...readAgentProviderEnv(codeName),
5612
5636
  ...stripUndefined(config2.serveEnv ?? {}),
5613
5637
  OPENCODE_SERVER_PASSWORD: password,
5614
- HOME: process.env.HOME?.trim() || homedir9(),
5638
+ HOME: process.env.HOME?.trim() || homedir10(),
5615
5639
  USER: process.env.USER?.trim() || userInfo().username
5616
5640
  };
5617
5641
  if (config2.runId) serveEnv["AGT_RUN_ID"] = config2.runId;
@@ -5697,7 +5721,7 @@ function stripUndefined(env) {
5697
5721
  }
5698
5722
  var PROVIDER_KEY_RE = /^[A-Z][A-Z0-9_]*_API_KEY$/;
5699
5723
  function readAgentProviderEnv(codeName, dir) {
5700
- const file = join19(dir ?? join19(homedir9(), ".augmented", codeName), ".env");
5724
+ const file = join20(dir ?? join20(homedir10(), ".augmented", codeName), ".env");
5701
5725
  const out = {};
5702
5726
  try {
5703
5727
  if (!existsSync10(file)) return out;
@@ -6830,9 +6854,9 @@ async function fireOpencodeScheduledTask(agent, task) {
6830
6854
 
6831
6855
  // src/lib/opencode-telegram-ingest.ts
6832
6856
  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";
6857
+ import { existsSync as existsSync11, mkdirSync as mkdirSync8, readFileSync as readFileSync17, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync9 } from "fs";
6834
6858
  import { randomUUID } from "crypto";
6835
- import { join as join20 } from "path";
6859
+ import { join as join21 } from "path";
6836
6860
 
6837
6861
  // src/lib/telegram-ingest.ts
6838
6862
  import https2 from "https";
@@ -7380,7 +7404,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
7380
7404
  let filePath;
7381
7405
  try {
7382
7406
  dir = getFramework("opencode").getAgentDir(codeName);
7383
- filePath = join20(dir, "telegram-getupdates-offset-opencode.json");
7407
+ filePath = join21(dir, "telegram-getupdates-offset-opencode.json");
7384
7408
  } catch {
7385
7409
  dir = null;
7386
7410
  filePath = null;
@@ -7407,8 +7431,8 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
7407
7431
  if (!filePath || !dir) return;
7408
7432
  const tmpPath = `${filePath}.${process.pid}.${randomUUID()}.tmp`;
7409
7433
  try {
7410
- mkdirSync7(dir, { recursive: true, mode: 448 });
7411
- writeFileSync8(
7434
+ mkdirSync8(dir, { recursive: true, mode: 448 });
7435
+ writeFileSync9(
7412
7436
  tmpPath,
7413
7437
  JSON.stringify({
7414
7438
  offset,
@@ -7639,15 +7663,15 @@ function partitionActionableByPoison(actionable, states, config2) {
7639
7663
  }
7640
7664
 
7641
7665
  // 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";
7666
+ import { existsSync as existsSync12, mkdirSync as mkdirSync9, readdirSync as readdirSync4, readFileSync as readFileSync18, renameSync as renameSync3, rmSync as rmSync4, writeFileSync as writeFileSync10 } from "fs";
7667
+ import { homedir as homedir11 } from "os";
7668
+ import { join as join22 } from "path";
7645
7669
  import { randomUUID as randomUUID2 } from "crypto";
7646
7670
  function restartFlagsDir() {
7647
- return join21(homedir10(), ".augmented", "restart-flags");
7671
+ return join22(homedir11(), ".augmented", "restart-flags");
7648
7672
  }
7649
7673
  function flagPath(codeName) {
7650
- return join21(restartFlagsDir(), `${codeName}.flag`);
7674
+ return join22(restartFlagsDir(), `${codeName}.flag`);
7651
7675
  }
7652
7676
  function readRestartFlags() {
7653
7677
  const dir = restartFlagsDir();
@@ -7656,7 +7680,7 @@ function readRestartFlags() {
7656
7680
  for (const entry of readdirSync4(dir)) {
7657
7681
  if (!entry.endsWith(".flag")) continue;
7658
7682
  try {
7659
- const raw = readFileSync18(join21(dir, entry), "utf8");
7683
+ const raw = readFileSync18(join22(dir, entry), "utf8");
7660
7684
  const parsed = JSON.parse(raw);
7661
7685
  if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
7662
7686
  parsed.codeName = entry.replace(/\.flag$/, "");
@@ -7675,7 +7699,7 @@ function readRestartFlags() {
7675
7699
  function deleteRestartFlag(codeName) {
7676
7700
  const path = flagPath(codeName);
7677
7701
  if (existsSync12(path)) {
7678
- rmSync3(path, { force: true });
7702
+ rmSync4(path, { force: true });
7679
7703
  }
7680
7704
  }
7681
7705
 
@@ -8908,7 +8932,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
8908
8932
  var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
8909
8933
  function projectMcpHash(_codeName, projectDir) {
8910
8934
  try {
8911
- const raw = readFileSync19(join22(projectDir, ".mcp.json"), "utf-8");
8935
+ const raw = readFileSync19(join23(projectDir, ".mcp.json"), "utf-8");
8912
8936
  return createHash14("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
8913
8937
  } catch {
8914
8938
  return null;
@@ -8916,7 +8940,7 @@ function projectMcpHash(_codeName, projectDir) {
8916
8940
  }
8917
8941
  function projectMcpKeys(_codeName, projectDir) {
8918
8942
  try {
8919
- const raw = readFileSync19(join22(projectDir, ".mcp.json"), "utf-8");
8943
+ const raw = readFileSync19(join23(projectDir, ".mcp.json"), "utf-8");
8920
8944
  const parsed = JSON.parse(raw);
8921
8945
  const servers = parsed.mcpServers;
8922
8946
  if (!servers || typeof servers !== "object") return /* @__PURE__ */ new Set();
@@ -8934,7 +8958,7 @@ function seedSessionLaunchBaselines(codeName, projectDir) {
8934
8958
  else runningMcpServerKeys.delete(codeName);
8935
8959
  let launchStructure = null;
8936
8960
  try {
8937
- const raw = readFileSync19(join22(projectDir, ".mcp.json"), "utf-8");
8961
+ const raw = readFileSync19(join23(projectDir, ".mcp.json"), "utf-8");
8938
8962
  launchStructure = managedMcpStructureHashFromFile(
8939
8963
  JSON.parse(raw),
8940
8964
  isManagedMcpServerKey
@@ -9034,7 +9058,7 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
9034
9058
  if (result && result.rebindCandidates.length > 0 && hostFlagStore().getBoolean("session-tool-rebind")) {
9035
9059
  let mcpJsonForRebind = null;
9036
9060
  try {
9037
- mcpJsonForRebind = JSON.parse(readFileSync19(join22(projectDir, ".mcp.json"), "utf-8"));
9061
+ mcpJsonForRebind = JSON.parse(readFileSync19(join23(projectDir, ".mcp.json"), "utf-8"));
9038
9062
  } catch {
9039
9063
  mcpJsonForRebind = null;
9040
9064
  }
@@ -9163,7 +9187,7 @@ function checkMcpConfigDriftAndScheduleRestart(codeName, projectDir) {
9163
9187
  function projectChannelSecretHash(projectDir) {
9164
9188
  try {
9165
9189
  const entries = parseEnvIntegrations(
9166
- readFileSync19(join22(projectDir, ".env.integrations"), "utf-8")
9190
+ readFileSync19(join23(projectDir, ".env.integrations"), "utf-8")
9167
9191
  );
9168
9192
  return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
9169
9193
  } catch {
@@ -9256,7 +9280,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9256
9280
  var lastVersionCheckAt = 0;
9257
9281
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9258
9282
  var lastResponsivenessProbeAt = 0;
9259
- var agtCliVersion = true ? "0.28.344" : "dev";
9283
+ var agtCliVersion = true ? "0.28.345" : "dev";
9260
9284
  function resolveBrewPath(execFileSync2) {
9261
9285
  try {
9262
9286
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -9451,8 +9475,8 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
9451
9475
  }
9452
9476
  if (settings.channelsEnabled === true) return "ok";
9453
9477
  settings.channelsEnabled = true;
9454
- mkdirSync9(dirname6(path), { recursive: true });
9455
- writeFileSync10(path, `${JSON.stringify(settings, null, 2)}
9478
+ mkdirSync10(dirname6(path), { recursive: true });
9479
+ writeFileSync11(path, `${JSON.stringify(settings, null, 2)}
9456
9480
  `);
9457
9481
  log(`[managed-settings] set channelsEnabled:true in ${path} (ENG-5786 \u2014 unblocks Claude Code channels)`);
9458
9482
  return "ok";
@@ -9553,7 +9577,7 @@ ${r.stderr}`;
9553
9577
  }
9554
9578
  var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9555
9579
  function selfUpdateAppliedMarkerPath() {
9556
- return join22(homedir11(), ".augmented", ".last-self-update-applied");
9580
+ return join23(homedir12(), ".augmented", ".last-self-update-applied");
9557
9581
  }
9558
9582
  var selfUpdateUpToDateLogged = false;
9559
9583
  var selfUpdatePinnedLogged = false;
@@ -9579,7 +9603,7 @@ async function checkAndUpdateCli(opts) {
9579
9603
  const isNpmGlobal = !isBrewFormula && resolvedPath.includes("node_modules");
9580
9604
  if (!isBrewFormula && !isNpmGlobal) return "noop";
9581
9605
  const { readFileSync: readF, writeFileSync: writeF } = await import("fs");
9582
- const markerPath = join22(homedir11(), ".augmented", ".last-update-check");
9606
+ const markerPath = join23(homedir12(), ".augmented", ".last-update-check");
9583
9607
  if (!force) {
9584
9608
  try {
9585
9609
  const lastCheck = parseInt(readF(markerPath, "utf-8").trim(), 10);
@@ -9925,13 +9949,13 @@ async function checkClaudeAuth() {
9925
9949
  var evalEmptyMcpConfigPath = null;
9926
9950
  function ensureEvalEmptyMcpConfig() {
9927
9951
  if (evalEmptyMcpConfigPath && existsSync13(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
9928
- const dir = join22(homedir11(), ".augmented");
9952
+ const dir = join23(homedir12(), ".augmented");
9929
9953
  try {
9930
- mkdirSync9(dir, { recursive: true });
9954
+ mkdirSync10(dir, { recursive: true });
9931
9955
  } catch {
9932
9956
  }
9933
- const p = join22(dir, ".eval-empty-mcp.json");
9934
- writeFileSync10(p, JSON.stringify({ mcpServers: {} }));
9957
+ const p = join23(dir, ".eval-empty-mcp.json");
9958
+ writeFileSync11(p, JSON.stringify({ mcpServers: {} }));
9935
9959
  evalEmptyMcpConfigPath = p;
9936
9960
  return p;
9937
9961
  }
@@ -9956,7 +9980,7 @@ async function runEvalClaude(prompt, model) {
9956
9980
  ""
9957
9981
  ];
9958
9982
  const { stdout } = await execFilePromiseLong(resolveClaudeBinary(), args, {
9959
- cwd: homedir11(),
9983
+ cwd: homedir12(),
9960
9984
  timeout: 12e4,
9961
9985
  stdin: "ignore",
9962
9986
  env: childEnv,
@@ -10022,10 +10046,10 @@ function resolveConversationEvalBackend() {
10022
10046
  return conversationEvalBackend;
10023
10047
  }
10024
10048
  function getStateFile() {
10025
- return join22(config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
10049
+ return join23(config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
10026
10050
  }
10027
10051
  function channelHashCacheDir() {
10028
- return config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented");
10052
+ return config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented");
10029
10053
  }
10030
10054
  function loadChannelHashCache2() {
10031
10055
  loadChannelHashCache(agentState.knownChannelConfigHashes, channelHashCacheDir());
@@ -10077,7 +10101,7 @@ function removeDeliveryBaselineEntries(agentId) {
10077
10101
  var _channelQuarantineStore = null;
10078
10102
  function channelQuarantineStore() {
10079
10103
  if (!_channelQuarantineStore) {
10080
- const dir = config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented");
10104
+ const dir = config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented");
10081
10105
  _channelQuarantineStore = new ChannelQuarantineStore(defaultQuarantinePath(dir));
10082
10106
  }
10083
10107
  return _channelQuarantineStore;
@@ -10085,7 +10109,7 @@ function channelQuarantineStore() {
10085
10109
  var _hostFlagStore = null;
10086
10110
  function hostFlagStore() {
10087
10111
  if (!_hostFlagStore) {
10088
- const dir = config?.configDir ?? join22(process.env["HOME"] ?? "/tmp", ".augmented");
10112
+ const dir = config?.configDir ?? join23(process.env["HOME"] ?? "/tmp", ".augmented");
10089
10113
  _hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
10090
10114
  }
10091
10115
  return _hostFlagStore;
@@ -10152,13 +10176,13 @@ function parseSkillFrontmatter(content) {
10152
10176
  return out;
10153
10177
  }
10154
10178
  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");
10179
+ const { readdirSync: readdirSync6, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync12 } = await import("fs");
10180
+ const skillsDir = join23(configDir, codeName, "project", ".claude", "skills");
10181
+ const claudeMdPath = join23(configDir, codeName, "project", "CLAUDE.md");
10158
10182
  if (!ex(skillsDir) || !ex(claudeMdPath)) return;
10159
10183
  const entries = [];
10160
10184
  for (const dir of readdirSync6(skillsDir).sort()) {
10161
- const skillFile = join22(skillsDir, dir, "SKILL.md");
10185
+ const skillFile = join23(skillsDir, dir, "SKILL.md");
10162
10186
  if (!ex(skillFile)) continue;
10163
10187
  try {
10164
10188
  const { name, description } = parseSkillFrontmatter(rfs(skillFile, "utf-8"));
@@ -10200,7 +10224,7 @@ ${SKILLS_INDEX_END}`;
10200
10224
  next = current.trimEnd() + "\n\n" + section + "\n";
10201
10225
  }
10202
10226
  if (next !== current) {
10203
- writeFileSync11(claudeMdPath, next, "utf-8");
10227
+ writeFileSync12(claudeMdPath, next, "utf-8");
10204
10228
  log2(`Refreshed skills index in CLAUDE.md for '${codeName}' (${entries.length} skills)`);
10205
10229
  }
10206
10230
  }
@@ -10221,7 +10245,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
10221
10245
  if (codeNames.length === 0) return;
10222
10246
  void (async () => {
10223
10247
  try {
10224
- const { collectDiagnostics } = await import("../persistent-session-IDWQO7QL.js");
10248
+ const { collectDiagnostics } = await import("../persistent-session-6ADHOTEG.js");
10225
10249
  await api.post("/host/heartbeat", {
10226
10250
  host_id: hostId,
10227
10251
  agent_diagnostics: collectDiagnostics(codeNames)
@@ -10320,7 +10344,7 @@ async function pollCycle() {
10320
10344
  }
10321
10345
  try {
10322
10346
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
10323
- const { collectDiagnostics } = await import("../persistent-session-IDWQO7QL.js");
10347
+ const { collectDiagnostics } = await import("../persistent-session-6ADHOTEG.js");
10324
10348
  const diagCodeNames = [...agentState.persistentSessionAgents];
10325
10349
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
10326
10350
  let tailscaleHostname;
@@ -10475,7 +10499,7 @@ async function pollCycle() {
10475
10499
  const {
10476
10500
  collectResponsivenessProbes,
10477
10501
  getResponsivenessIntervalMs
10478
- } = await import("../responsiveness-probe-WF3SMLS6.js");
10502
+ } = await import("../responsiveness-probe-UYVXWW5D.js");
10479
10503
  const probeIntervalMs = getResponsivenessIntervalMs();
10480
10504
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
10481
10505
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -10507,7 +10531,7 @@ async function pollCycle() {
10507
10531
  collectResponsivenessProbes,
10508
10532
  livePendingInboundOldestAgeSeconds,
10509
10533
  parkPendingInbound
10510
- } = await import("../responsiveness-probe-WF3SMLS6.js");
10534
+ } = await import("../responsiveness-probe-UYVXWW5D.js");
10511
10535
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-HYOOQV4A.js");
10512
10536
  const wedgeNow = /* @__PURE__ */ new Date();
10513
10537
  const liveAgents = agentState.persistentSessionAgents;
@@ -10599,10 +10623,10 @@ async function pollCycle() {
10599
10623
  const paneTail = readFileSync19(paneLogPath(codeName), "utf8").slice(-65536);
10600
10624
  const transient = detectTransientApiErrorInLog(paneTail);
10601
10625
  if (transient) {
10602
- const wedgeHome = join22(homedir11(), ".augmented", codeName);
10626
+ const wedgeHome = join23(homedir12(), ".augmented", codeName);
10603
10627
  if (existsSync13(wedgeHome)) {
10604
10628
  atomicWriteFileSync(
10605
- join22(wedgeHome, "watchdog-give-up.json"),
10629
+ join23(wedgeHome, "watchdog-give-up.json"),
10606
10630
  JSON.stringify({
10607
10631
  gave_up_at: wedgeNow.toISOString(),
10608
10632
  reason: "transient_overload"
@@ -10851,7 +10875,7 @@ async function pollCycle() {
10851
10875
  } catch {
10852
10876
  }
10853
10877
  killAgentChannelProcesses(prev.codeName, { log });
10854
- const agentDir = join22(adapter.getAgentDir(prev.codeName), "provision");
10878
+ const agentDir = join23(adapter.getAgentDir(prev.codeName), "provision");
10855
10879
  await cleanupAgentFiles(prev.codeName, agentDir);
10856
10880
  clearAgentCaches(prev.agentId, prev.codeName);
10857
10881
  }
@@ -10938,10 +10962,10 @@ async function pollCycle() {
10938
10962
  // pending-inbound marker. Best-effort: a write failure is logged by
10939
10963
  // the watchdog, never fails the poll cycle.
10940
10964
  signalGiveUp: (codeName) => {
10941
- const dir = join22(homedir11(), ".augmented", codeName);
10965
+ const dir = join23(homedir12(), ".augmented", codeName);
10942
10966
  if (!existsSync13(dir)) return;
10943
10967
  atomicWriteFileSync(
10944
- join22(dir, "watchdog-give-up.json"),
10968
+ join23(dir, "watchdog-give-up.json"),
10945
10969
  JSON.stringify({ gave_up_at: (/* @__PURE__ */ new Date()).toISOString() })
10946
10970
  );
10947
10971
  }
@@ -11080,7 +11104,7 @@ async function processAgent(agent, agentStates) {
11080
11104
  }
11081
11105
  const now = (/* @__PURE__ */ new Date()).toISOString();
11082
11106
  const adapter = resolveAgentFramework(agent.code_name);
11083
- let agentDir = join22(adapter.getAgentDir(agent.code_name), "provision");
11107
+ let agentDir = join23(adapter.getAgentDir(agent.code_name), "provision");
11084
11108
  if (agent.status === "draft" || agent.status === "paused") {
11085
11109
  if (previousKnownStatus !== agent.status) {
11086
11110
  log(`Agent '${agent.code_name}' is ${agent.status}, skipping provisioning`);
@@ -11264,7 +11288,7 @@ async function processAgent(agent, agentStates) {
11264
11288
  const frameworkId = refreshData.agent.framework ?? DEFAULT_FRAMEWORK;
11265
11289
  agentFrameworkCache.set(agent.code_name, frameworkId);
11266
11290
  const frameworkAdapter = getFramework(frameworkId);
11267
- agentDir = join22(frameworkAdapter.getAgentDir(agent.code_name), "provision");
11291
+ agentDir = join23(frameworkAdapter.getAgentDir(agent.code_name), "provision");
11268
11292
  cacheAgentDeliveryMetadata(agent.code_name, refreshData);
11269
11293
  agentRestartTimezoneInputs.set(agent.code_name, {
11270
11294
  agentTimezone: typeof refreshData.agent.timezone === "string" ? refreshData.agent.timezone : null,
@@ -11309,9 +11333,9 @@ async function processAgent(agent, agentStates) {
11309
11333
  try {
11310
11334
  const artifacts = generateArtifacts(agent, refreshData, frameworkAdapter);
11311
11335
  const changedFiles = [];
11312
- mkdirSync9(agentDir, { recursive: true });
11336
+ mkdirSync10(agentDir, { recursive: true });
11313
11337
  for (const artifact of artifacts) {
11314
- const filePath = join22(agentDir, artifact.relativePath);
11338
+ const filePath = join23(agentDir, artifact.relativePath);
11315
11339
  let existingHash;
11316
11340
  let newHash;
11317
11341
  let writeContent = artifact.content;
@@ -11330,7 +11354,7 @@ async function processAgent(agent, agentStates) {
11330
11354
  };
11331
11355
  newHash = sha256(stripDynamicSections(artifact.content));
11332
11356
  try {
11333
- const projectClaudeMd = join22(config.configDir, agent.code_name, "project", "CLAUDE.md");
11357
+ const projectClaudeMd = join23(config.configDir, agent.code_name, "project", "CLAUDE.md");
11334
11358
  const existing = readFileSync19(projectClaudeMd, "utf-8");
11335
11359
  existingHash = sha256(stripDynamicSections(existing));
11336
11360
  } catch {
@@ -11371,26 +11395,26 @@ async function processAgent(agent, agentStates) {
11371
11395
  }
11372
11396
  }
11373
11397
  if (changedFiles.length > 0) {
11374
- const isFirst = !existsSync13(join22(agentDir, "CHARTER.md"));
11398
+ const isFirst = !existsSync13(join23(agentDir, "CHARTER.md"));
11375
11399
  const verb = isFirst ? "Provisioning" : "Updating";
11376
11400
  const fileNames = changedFiles.map((f) => f.relativePath).join(", ");
11377
11401
  log(`${verb} '${agent.code_name}': ${fileNames}`);
11378
11402
  for (const file of changedFiles) {
11379
- const filePath = join22(agentDir, file.relativePath);
11380
- mkdirSync9(dirname6(filePath), { recursive: true });
11403
+ const filePath = join23(agentDir, file.relativePath);
11404
+ mkdirSync10(dirname6(filePath), { recursive: true });
11381
11405
  if (file.relativePath === ".mcp.json") {
11382
11406
  safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
11383
11407
  } else {
11384
- writeFileSync10(filePath, file.content);
11408
+ writeFileSync11(filePath, file.content);
11385
11409
  }
11386
11410
  }
11387
11411
  try {
11388
- const provSkillsDir = join22(agentDir, ".claude", "skills");
11412
+ const provSkillsDir = join23(agentDir, ".claude", "skills");
11389
11413
  if (existsSync13(provSkillsDir)) {
11390
11414
  for (const folder of readdirSync5(provSkillsDir)) {
11391
11415
  if (folder.startsWith("knowledge-")) {
11392
11416
  try {
11393
- rmSync4(join22(provSkillsDir, folder), { recursive: true });
11417
+ rmSync5(join23(provSkillsDir, folder), { recursive: true });
11394
11418
  } catch {
11395
11419
  }
11396
11420
  }
@@ -11403,7 +11427,7 @@ async function processAgent(agent, agentStates) {
11403
11427
  const trackedFiles2 = frameworkAdapter.driftTrackedFiles();
11404
11428
  const hashes = /* @__PURE__ */ new Map();
11405
11429
  for (const file of trackedFiles2) {
11406
- const h = hashFile(join22(agentDir, file));
11430
+ const h = hashFile(join23(agentDir, file));
11407
11431
  if (h) hashes.set(file, h);
11408
11432
  }
11409
11433
  agentState.writtenHashes.set(agent.agent_id, hashes);
@@ -11421,14 +11445,14 @@ async function processAgent(agent, agentStates) {
11421
11445
  }
11422
11446
  if (Array.isArray(refreshData.workflows)) {
11423
11447
  try {
11424
- const provWorkflowsDir = join22(agentDir, ".claude", "workflows");
11448
+ const provWorkflowsDir = join23(agentDir, ".claude", "workflows");
11425
11449
  if (existsSync13(provWorkflowsDir)) {
11426
11450
  const expected = new Set(refreshData.workflows.map((w) => `${w.name}.js`));
11427
11451
  for (const file of readdirSync5(provWorkflowsDir)) {
11428
11452
  if (!file.endsWith(".js")) continue;
11429
11453
  if (expected.has(file)) continue;
11430
11454
  try {
11431
- rmSync4(join22(provWorkflowsDir, file));
11455
+ rmSync5(join23(provWorkflowsDir, file));
11432
11456
  } catch {
11433
11457
  }
11434
11458
  }
@@ -11488,7 +11512,7 @@ async function processAgent(agent, agentStates) {
11488
11512
  if (written && existsSync13(agentDir)) {
11489
11513
  const driftedFiles = [];
11490
11514
  for (const [file, expectedHash] of written) {
11491
- const localHash = hashFile(join22(agentDir, file));
11515
+ const localHash = hashFile(join23(agentDir, file));
11492
11516
  if (localHash && localHash !== expectedHash) {
11493
11517
  driftedFiles.push(file);
11494
11518
  }
@@ -11499,7 +11523,7 @@ async function processAgent(agent, agentStates) {
11499
11523
  try {
11500
11524
  const localHashes = {};
11501
11525
  for (const file of driftedFiles) {
11502
- localHashes[file] = hashFile(join22(agentDir, file));
11526
+ localHashes[file] = hashFile(join23(agentDir, file));
11503
11527
  }
11504
11528
  await api.post("/host/drift", {
11505
11529
  agent_id: agent.agent_id,
@@ -11686,15 +11710,15 @@ async function processAgent(agent, agentStates) {
11686
11710
  const addedChannels = [...restartDecision.added];
11687
11711
  const writeDmNoticeMarkers = isChannelAddRestart ? () => {
11688
11712
  try {
11689
- const agentAugmentedDir = join22(homedir11(), ".augmented", agent.code_name);
11690
- mkdirSync9(agentAugmentedDir, { recursive: true });
11713
+ const agentAugmentedDir = join23(homedir12(), ".augmented", agent.code_name);
11714
+ mkdirSync10(agentAugmentedDir, { recursive: true });
11691
11715
  const markerJson = JSON.stringify({
11692
11716
  version: 1,
11693
11717
  at: (/* @__PURE__ */ new Date()).toISOString(),
11694
11718
  added: addedChannels
11695
11719
  });
11696
11720
  for (const file of ["slack-channel-add-restart.json", "telegram-channel-add-restart.json"]) {
11697
- atomicWriteFileSync(join22(agentAugmentedDir, file), markerJson);
11721
+ atomicWriteFileSync(join23(agentAugmentedDir, file), markerJson);
11698
11722
  }
11699
11723
  } catch (err) {
11700
11724
  log(`[hot-reload] channel-add DM-notice marker write failed for '${agent.code_name}' (non-fatal): ${err.message}`);
@@ -11883,18 +11907,18 @@ async function processAgent(agent, agentStates) {
11883
11907
  if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code") {
11884
11908
  try {
11885
11909
  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");
11910
+ const projectDir = join23(homedir12(), ".augmented", agent.code_name, "project");
11911
+ mkdirSync10(agentProvisionDir, { recursive: true });
11912
+ mkdirSync10(projectDir, { recursive: true });
11913
+ const provisionMcpPath = join23(agentProvisionDir, ".mcp.json");
11914
+ const projectMcpPath = join23(projectDir, ".mcp.json");
11891
11915
  let mcpConfig = { mcpServers: {} };
11892
11916
  try {
11893
11917
  mcpConfig = JSON.parse(readFileSync19(provisionMcpPath, "utf-8"));
11894
11918
  if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
11895
11919
  } catch {
11896
11920
  }
11897
- const localDirectChatChannel = join22(homedir11(), ".augmented", "_mcp", "direct-chat-channel.js");
11921
+ const localDirectChatChannel = join23(homedir12(), ".augmented", "_mcp", "direct-chat-channel.js");
11898
11922
  const directChatTeamSettings = refreshData.team?.settings;
11899
11923
  const directChatTz = (() => {
11900
11924
  const tz = directChatTeamSettings?.["timezone"];
@@ -11920,7 +11944,7 @@ async function processAgent(agent, agentStates) {
11920
11944
  // ~/.augmented/<codeName>/.current-turn-initiator.json. Note getAgentDir
11921
11945
  // returns the agent root (NOT the /provision subdir `agentDir` points at),
11922
11946
  // so it byte-matches the broker readers' path.
11923
- AGT_TURN_INITIATOR_FILE: join22(
11947
+ AGT_TURN_INITIATOR_FILE: join23(
11924
11948
  frameworkAdapter.getAgentDir(agent.code_name),
11925
11949
  ".current-turn-initiator.json"
11926
11950
  )
@@ -11940,10 +11964,10 @@ async function processAgent(agent, agentStates) {
11940
11964
  log(`Channel credentials written for '${agent.code_name}/direct-chat'`);
11941
11965
  }
11942
11966
  }
11943
- const staleChannelsPath = join22(projectDir, ".mcp-channels.json");
11967
+ const staleChannelsPath = join23(projectDir, ".mcp-channels.json");
11944
11968
  if (existsSync13(staleChannelsPath)) {
11945
11969
  try {
11946
- rmSync4(staleChannelsPath, { force: true });
11970
+ rmSync5(staleChannelsPath, { force: true });
11947
11971
  } catch {
11948
11972
  }
11949
11973
  }
@@ -12030,7 +12054,7 @@ async function processAgent(agent, agentStates) {
12030
12054
  }
12031
12055
  if (hostFlagStore().getBoolean("connectivity-probe")) {
12032
12056
  try {
12033
- const probeProjectDir = join22(homedir11(), ".augmented", agent.code_name, "project");
12057
+ const probeProjectDir = join23(homedir12(), ".augmented", agent.code_name, "project");
12034
12058
  await runAgentConnectivityProbes(agent, integrations, probeProjectDir);
12035
12059
  } catch (err) {
12036
12060
  log(`Connectivity probe failed for '${agent.code_name}': ${err.message}`);
@@ -12041,7 +12065,7 @@ async function processAgent(agent, agentStates) {
12041
12065
  const forceDue = attemptsLeft > 0;
12042
12066
  let probeRan = false;
12043
12067
  try {
12044
- const probeProjectDir = join22(homedir11(), ".augmented", agent.code_name, "project");
12068
+ const probeProjectDir = join23(homedir12(), ".augmented", agent.code_name, "project");
12045
12069
  probeRan = await runAgentSessionToolBindProbes(agent, integrations, probeProjectDir, { forceDue });
12046
12070
  } catch (err) {
12047
12071
  log(`Session-tool-bind probe failed for '${agent.code_name}': ${err.message}`);
@@ -12081,8 +12105,8 @@ async function processAgent(agent, agentStates) {
12081
12105
  recordConfigChurnEvent(agent.agent_id, agent.code_name, FLAP_CHANNEL_INTEGRATIONS, intMembership);
12082
12106
  }
12083
12107
  if (intHash !== prevIntHash) {
12084
- const projectDir = join22(homedir11(), ".augmented", agent.code_name, "project");
12085
- const envIntPath = join22(projectDir, ".env.integrations");
12108
+ const projectDir = join23(homedir12(), ".augmented", agent.code_name, "project");
12109
+ const envIntPath = join23(projectDir, ".env.integrations");
12086
12110
  let preWriteEnv;
12087
12111
  try {
12088
12112
  preWriteEnv = readFileSync19(envIntPath, "utf-8");
@@ -12097,7 +12121,7 @@ async function processAgent(agent, agentStates) {
12097
12121
  let rotationHandled = true;
12098
12122
  if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
12099
12123
  try {
12100
- const projectMcpPath = join22(projectDir, ".mcp.json");
12124
+ const projectMcpPath = join23(projectDir, ".mcp.json");
12101
12125
  const postWriteEnv = readFileSync19(envIntPath, "utf-8");
12102
12126
  const mcpContent = readFileSync19(projectMcpPath, "utf-8");
12103
12127
  const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
@@ -12344,17 +12368,17 @@ async function processAgent(agent, agentStates) {
12344
12368
  }
12345
12369
  }
12346
12370
  try {
12347
- const { readdirSync: readdirSync6, rmSync: rmSync5 } = await import("fs");
12348
- const { homedir: homedir12 } = await import("os");
12371
+ const { readdirSync: readdirSync6, rmSync: rmSync6 } = await import("fs");
12372
+ const { homedir: homedir13 } = await import("os");
12349
12373
  const frameworkId2 = frameworkAdapter.id;
12350
12374
  const candidateSkillDirs = [
12351
12375
  // Claude Code — framework runtime tree
12352
- join22(homedir12(), ".augmented", agent.code_name, "skills"),
12376
+ join23(homedir13(), ".augmented", agent.code_name, "skills"),
12353
12377
  // Claude Code — project tree
12354
- join22(homedir12(), ".augmented", agent.code_name, "project", ".claude", "skills"),
12378
+ join23(homedir13(), ".augmented", agent.code_name, "project", ".claude", "skills"),
12355
12379
  // Defensive: legacy provision-side path, not currently an
12356
12380
  // install target but cheap to sweep.
12357
- join22(agentDir, ".claude", "skills")
12381
+ join23(agentDir, ".claude", "skills")
12358
12382
  ];
12359
12383
  const existingDirs = candidateSkillDirs.filter((d) => existsSync13(d));
12360
12384
  const discoveredEntries = /* @__PURE__ */ new Set();
@@ -12370,9 +12394,9 @@ async function processAgent(agent, agentStates) {
12370
12394
  }
12371
12395
  const removeSkillFolder = (entry, reason) => {
12372
12396
  for (const dir of existingDirs) {
12373
- const p = join22(dir, entry);
12397
+ const p = join23(dir, entry);
12374
12398
  if (existsSync13(p)) {
12375
- rmSync5(p, { recursive: true, force: true });
12399
+ rmSync6(p, { recursive: true, force: true });
12376
12400
  }
12377
12401
  }
12378
12402
  log(`Removed ${reason} '${entry}' for '${agent.code_name}' (framework=${frameworkId2})`);
@@ -12390,7 +12414,7 @@ async function processAgent(agent, agentStates) {
12390
12414
  const sharedSkillsPayload = refreshAny.shared_skills;
12391
12415
  const desiredResolved = globalSkillsPayload !== void 0 || sharedSkillsPayload !== void 0;
12392
12416
  const manifestPath = managedSkillManifestPath(
12393
- join22(homedir11(), ".augmented", agent.code_name)
12417
+ join23(homedir12(), ".augmented", agent.code_name)
12394
12418
  );
12395
12419
  const prevIds = /* @__PURE__ */ new Set([
12396
12420
  ...agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
@@ -12410,16 +12434,16 @@ async function processAgent(agent, agentStates) {
12410
12434
  }
12411
12435
  if (plan.removes.length) {
12412
12436
  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")
12437
+ join23(homedir12(), ".augmented", agent.code_name, "skills"),
12438
+ join23(homedir12(), ".augmented", agent.code_name, "project", ".claude", "skills"),
12439
+ join23(agentDir, ".claude", "skills")
12416
12440
  ];
12417
12441
  for (const id of plan.removes) {
12418
12442
  let prunedAny = false;
12419
12443
  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 });
12444
+ const p = join23(dir, id);
12445
+ if (existsSync13(p) && existsSync13(join23(p, "SKILL.md"))) {
12446
+ rmSync5(p, { recursive: true, force: true });
12423
12447
  prunedAny = true;
12424
12448
  }
12425
12449
  }
@@ -12624,7 +12648,7 @@ async function processAgent(agent, agentStates) {
12624
12648
  const sess = getSessionState(agent.code_name);
12625
12649
  let mcpJsonParsed = null;
12626
12650
  try {
12627
- const mcpPath = join22(getProjectDir(agent.code_name), ".mcp.json");
12651
+ const mcpPath = join23(getProjectDir(agent.code_name), ".mcp.json");
12628
12652
  mcpJsonParsed = JSON.parse(readFileSync19(mcpPath, "utf-8"));
12629
12653
  } catch {
12630
12654
  }
@@ -12957,7 +12981,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
12957
12981
  if (trackedFiles.length > 0 && existsSync13(agentDir)) {
12958
12982
  const hashes = /* @__PURE__ */ new Map();
12959
12983
  for (const file of trackedFiles) {
12960
- const h = hashFile(join22(agentDir, file));
12984
+ const h = hashFile(join23(agentDir, file));
12961
12985
  if (h) hashes.set(file, h);
12962
12986
  }
12963
12987
  agentState.writtenHashes.set(agent.agent_id, hashes);
@@ -12972,7 +12996,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
12972
12996
  refreshData.agent.onboarding_state
12973
12997
  );
12974
12998
  const obStep = obState.step;
12975
- const markerPath = join22(homedir11(), ".augmented", agent.code_name, "onboarding-drive.json");
12999
+ const markerPath = join23(homedir12(), ".augmented", agent.code_name, "onboarding-drive.json");
12976
13000
  const marker = readOnboardingDriveMarker(markerPath);
12977
13001
  const decision = decideOnboardingDrive(obStep, marker, Date.now(), obState.generation ?? 0);
12978
13002
  if (decision.clearMarker) {
@@ -13042,7 +13066,7 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
13042
13066
  }
13043
13067
  stopOpencodeSlackIngest(codeName, log);
13044
13068
  stopOpencodeTelegramIngest(codeName, log);
13045
- const opencodeProjectDir = join22(getFramework("opencode").getAgentDir(codeName), "provision");
13069
+ const opencodeProjectDir = join23(getFramework("opencode").getAgentDir(codeName), "provision");
13046
13070
  const openRouterRaw = refreshData.openrouter ?? null;
13047
13071
  const serveEnv = {
13048
13072
  AGT_HOST: requireHost(),
@@ -13082,8 +13106,8 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
13082
13106
  async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
13083
13107
  const codeName = agent.code_name;
13084
13108
  const projectDir = getProjectDir(codeName);
13085
- const mcpConfigPath = join22(projectDir, ".mcp.json");
13086
- const claudeMdPath = join22(projectDir, "CLAUDE.md");
13109
+ const mcpConfigPath = join23(projectDir, ".mcp.json");
13110
+ const claudeMdPath = join23(projectDir, "CLAUDE.md");
13087
13111
  if (restartBreaker.isTripped(codeName)) {
13088
13112
  const trip = restartBreaker.getTrip(codeName);
13089
13113
  return {
@@ -13621,7 +13645,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
13621
13645
  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
13646
  void (async () => {
13623
13647
  try {
13624
- const { collectDiagnostics } = await import("../persistent-session-IDWQO7QL.js");
13648
+ const { collectDiagnostics } = await import("../persistent-session-6ADHOTEG.js");
13625
13649
  await api.post("/host/heartbeat", {
13626
13650
  host_id: hostId,
13627
13651
  agent_diagnostics: collectDiagnostics([codeName])
@@ -13671,7 +13695,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
13671
13695
  }
13672
13696
  try {
13673
13697
  const hostId = await getHostId();
13674
- const { collectDiagnostics } = await import("../persistent-session-IDWQO7QL.js");
13698
+ const { collectDiagnostics } = await import("../persistent-session-6ADHOTEG.js");
13675
13699
  await api.post("/host/heartbeat", {
13676
13700
  host_id: hostId,
13677
13701
  agent_diagnostics: collectDiagnostics([codeName])
@@ -13956,9 +13980,9 @@ async function processDirectChatMessage(agent, msg) {
13956
13980
  const useDoorbell = hostFlagStore().getBoolean("direct-chat-doorbell") || isolationMode(agent.codeName) === "docker";
13957
13981
  if (useDoorbell) {
13958
13982
  try {
13959
- const doorbell = directChatDoorbellPath(agent.agentId, homedir11());
13960
- mkdirSync9(dirname6(doorbell), { recursive: true });
13961
- writeFileSync10(doorbell, String(Date.now()));
13983
+ const doorbell = directChatDoorbellPath(agent.agentId, homedir12());
13984
+ mkdirSync10(dirname6(doorbell), { recursive: true });
13985
+ writeFileSync11(doorbell, String(Date.now()));
13962
13986
  log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
13963
13987
  return;
13964
13988
  } catch (err) {
@@ -14066,9 +14090,9 @@ ${formatRunMarker(run_id)}` : KANBAN_CHECK_COMMAND;
14066
14090
  }
14067
14091
  if (run_id) openInjectedRunByCode.set(codeName, run_id);
14068
14092
  try {
14069
- const doorbell = directChatDoorbellPath(agentId, homedir11());
14070
- mkdirSync9(dirname6(doorbell), { recursive: true });
14071
- writeFileSync10(doorbell, String(Date.now()));
14093
+ const doorbell = directChatDoorbellPath(agentId, homedir12());
14094
+ mkdirSync10(dirname6(doorbell), { recursive: true });
14095
+ writeFileSync11(doorbell, String(Date.now()));
14072
14096
  } catch (err) {
14073
14097
  log(`[kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
14074
14098
  }
@@ -14169,7 +14193,7 @@ async function processClaudePairSessions(agents) {
14169
14193
  killPairSession,
14170
14194
  pairTmuxSession,
14171
14195
  finalizeClaudePairOnboarding
14172
- } = await import("../claude-pair-runtime-JU3CVFUU.js");
14196
+ } = await import("../claude-pair-runtime-2ZQZVFKF.js");
14173
14197
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
14174
14198
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
14175
14199
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -14419,8 +14443,8 @@ function parseMemoryFile(raw, fallbackName) {
14419
14443
  };
14420
14444
  }
14421
14445
  async function syncMemories(agent, configDir, log2) {
14422
- const projectDir = join22(configDir, agent.code_name, "project");
14423
- const memoryDir = join22(projectDir, "memory");
14446
+ const projectDir = join23(configDir, agent.code_name, "project");
14447
+ const memoryDir = join23(projectDir, "memory");
14424
14448
  const isFreshSync = pendingFreshMemorySync.has(agent.agent_id);
14425
14449
  if (isFreshSync) {
14426
14450
  log2(`[memory-sync] Fresh-sync requested for '${agent.code_name}' \u2014 pulling DB first`);
@@ -14438,7 +14462,7 @@ async function syncMemories(agent, configDir, log2) {
14438
14462
  for (const file of readdirSync5(memoryDir)) {
14439
14463
  if (!file.endsWith(".md")) continue;
14440
14464
  try {
14441
- const raw = readFileSync19(join22(memoryDir, file), "utf-8");
14465
+ const raw = readFileSync19(join23(memoryDir, file), "utf-8");
14442
14466
  const fileHash = createHash14("sha256").update(raw).digest("hex").slice(0, 16);
14443
14467
  currentHashes.set(file, fileHash);
14444
14468
  if (prevHashes.get(file) === fileHash) continue;
@@ -14463,7 +14487,7 @@ async function syncMemories(agent, configDir, log2) {
14463
14487
  } catch (err) {
14464
14488
  for (const mem of changedMemories) {
14465
14489
  for (const [file] of currentHashes) {
14466
- const parsed = parseMemoryFile(readFileSync19(join22(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
14490
+ const parsed = parseMemoryFile(readFileSync19(join23(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
14467
14491
  if (parsed?.name === mem.name) currentHashes.delete(file);
14468
14492
  }
14469
14493
  }
@@ -14491,14 +14515,14 @@ async function downloadMemories(agent, memoryDir, log2, { force }) {
14491
14515
  lastDownloadHash.set(agent.agent_id, responseHash);
14492
14516
  lastLocalFileHash.set(agent.agent_id, localListHash);
14493
14517
  if (dbMemories.memories?.length) {
14494
- mkdirSync9(memoryDir, { recursive: true });
14518
+ mkdirSync10(memoryDir, { recursive: true });
14495
14519
  let written = 0;
14496
14520
  let overwritten = 0;
14497
14521
  for (let i = 0; i < dbMemories.memories.length; i++) {
14498
14522
  const mem = dbMemories.memories[i];
14499
14523
  const rawSlug = mem.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "").slice(0, 60);
14500
14524
  const slug = rawSlug || `memory-${i}`;
14501
- const filePath = join22(memoryDir, `${slug}.md`);
14525
+ const filePath = join23(memoryDir, `${slug}.md`);
14502
14526
  const desired = `---
14503
14527
  name: ${JSON.stringify(mem.name)}
14504
14528
  type: ${mem.type}
@@ -14514,10 +14538,10 @@ ${mem.content}
14514
14538
  } catch {
14515
14539
  }
14516
14540
  if (existing === desired) continue;
14517
- writeFileSync10(filePath, desired);
14541
+ writeFileSync11(filePath, desired);
14518
14542
  overwritten++;
14519
14543
  } else {
14520
- writeFileSync10(filePath, desired);
14544
+ writeFileSync11(filePath, desired);
14521
14545
  written++;
14522
14546
  }
14523
14547
  }
@@ -14536,7 +14560,7 @@ ${mem.content}
14536
14560
  async function cleanupAgentFiles(codeName, agentDir) {
14537
14561
  if (existsSync13(agentDir)) {
14538
14562
  try {
14539
- rmSync4(agentDir, { recursive: true, force: true });
14563
+ rmSync5(agentDir, { recursive: true, force: true });
14540
14564
  log(`Removed provision directory for '${codeName}'`);
14541
14565
  } catch (err) {
14542
14566
  log(`Failed to remove provision dir for '${codeName}': ${err.message}`);
@@ -14799,7 +14823,7 @@ function startManager(opts) {
14799
14823
  log(`[startup] state rehydration failed (continuing with empty state): ${err.message}`);
14800
14824
  }
14801
14825
  log(
14802
- `[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join22(homedir11(), ".augmented", "manager.log")}`
14826
+ `[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join23(homedir12(), ".augmented", "manager.log")}`
14803
14827
  );
14804
14828
  deployMcpAssets();
14805
14829
  reapOrphanChannelMcps({ log });
@@ -14917,14 +14941,14 @@ function restartRunningChannelMcps(basenames) {
14917
14941
  }
14918
14942
  }
14919
14943
  function deployMcpAssets() {
14920
- const targetDir = join22(homedir11(), ".augmented", "_mcp");
14921
- mkdirSync9(targetDir, { recursive: true });
14944
+ const targetDir = join23(homedir12(), ".augmented", "_mcp");
14945
+ mkdirSync10(targetDir, { recursive: true });
14922
14946
  const moduleDir = dirname6(fileURLToPath(import.meta.url));
14923
14947
  let mcpSourceDir = "";
14924
14948
  let dir = moduleDir;
14925
14949
  for (let i = 0; i < 6; i++) {
14926
- const candidate = join22(dir, "dist", "mcp");
14927
- if (existsSync13(join22(candidate, "index.js"))) {
14950
+ const candidate = join23(dir, "dist", "mcp");
14951
+ if (existsSync13(join23(candidate, "index.js"))) {
14928
14952
  mcpSourceDir = candidate;
14929
14953
  break;
14930
14954
  }
@@ -15004,8 +15028,8 @@ function deployMcpAssets() {
15004
15028
  // needs restarting to pick up a token rotation.
15005
15029
  "xero.js"
15006
15030
  ]) {
15007
- const src = join22(mcpSourceDir, file);
15008
- const dst = join22(targetDir, file);
15031
+ const src = join23(mcpSourceDir, file);
15032
+ const dst = join23(targetDir, file);
15009
15033
  if (!existsSync13(src)) continue;
15010
15034
  const before = fileHash(dst);
15011
15035
  try {
@@ -15023,14 +15047,14 @@ function deployMcpAssets() {
15023
15047
  log(`[manager] Bundle(s) updated: ${changedBasenames.join(", ")} \u2014 signalling running instances to restart`);
15024
15048
  restartRunningChannelMcps(changedBasenames);
15025
15049
  }
15026
- const localMcpPath = join22(targetDir, "index.js");
15050
+ const localMcpPath = join23(targetDir, "index.js");
15027
15051
  try {
15028
- const agentsDir = join22(homedir11(), ".augmented", "agents");
15052
+ const agentsDir = join23(homedir12(), ".augmented", "agents");
15029
15053
  if (existsSync13(agentsDir)) {
15030
15054
  for (const entry of readdirSync5(agentsDir, { withFileTypes: true })) {
15031
15055
  if (!entry.isDirectory()) continue;
15032
15056
  for (const subdir of ["provision", "project"]) {
15033
- const mcpJsonPath = join22(agentsDir, entry.name, subdir, ".mcp.json");
15057
+ const mcpJsonPath = join23(agentsDir, entry.name, subdir, ".mcp.json");
15034
15058
  try {
15035
15059
  const raw = readFileSync19(mcpJsonPath, "utf-8");
15036
15060
  if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
@@ -15039,7 +15063,7 @@ function deployMcpAssets() {
15039
15063
  if (!augServer) continue;
15040
15064
  augServer.command = "node";
15041
15065
  augServer.args = [localMcpPath];
15042
- writeFileSync10(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
15066
+ writeFileSync11(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
15043
15067
  log(`[manager] Patched ${entry.name}/${subdir}/.mcp.json: npx \u2192 node`);
15044
15068
  } catch {
15045
15069
  }