@integrity-labs/agt-cli 0.28.846 → 0.28.848
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.
- package/dist/bin/agt.js +5 -5
- package/dist/{chunk-FMA2UULO.js → chunk-MFU2FD4N.js} +19 -2
- package/dist/{chunk-FMA2UULO.js.map → chunk-MFU2FD4N.js.map} +1 -1
- package/dist/{chunk-37YAM7WC.js → chunk-N4TMATK2.js} +4 -4
- package/dist/{chunk-WDYMHXJP.js → chunk-PMQNTU7W.js} +2 -2
- package/dist/{claude-pair-runtime-VMDY3RD6.js → claude-pair-runtime-BQ5JUW5F.js} +2 -2
- package/dist/lib/manager-worker.js +197 -232
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-OWPX7UQX.js → persistent-session-JKES3FMW.js} +3 -3
- package/dist/{responsiveness-probe-ULCOBFNG.js → responsiveness-probe-P7EAWN6J.js} +3 -3
- package/dist/{session-auth-dead-AQBSFCQO.js → session-auth-dead-IFU2XLHO.js} +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-37YAM7WC.js.map → chunk-N4TMATK2.js.map} +0 -0
- /package/dist/{chunk-WDYMHXJP.js.map → chunk-PMQNTU7W.js.map} +0 -0
- /package/dist/{claude-pair-runtime-VMDY3RD6.js.map → claude-pair-runtime-BQ5JUW5F.js.map} +0 -0
- /package/dist/{persistent-session-OWPX7UQX.js.map → persistent-session-JKES3FMW.js.map} +0 -0
- /package/dist/{responsiveness-probe-ULCOBFNG.js.map → responsiveness-probe-P7EAWN6J.js.map} +0 -0
- /package/dist/{session-auth-dead-AQBSFCQO.js.map → session-auth-dead-IFU2XLHO.js.map} +0 -0
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
safeWriteJsonAtomic,
|
|
61
61
|
setConfigHash,
|
|
62
62
|
tripClass
|
|
63
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-N4TMATK2.js";
|
|
64
64
|
import {
|
|
65
65
|
getProjectDir as getProjectDir2,
|
|
66
66
|
getReadyTasks,
|
|
@@ -126,7 +126,7 @@ import {
|
|
|
126
126
|
takeZombieDetection,
|
|
127
127
|
toOpencodeModel,
|
|
128
128
|
writeEgressAllowlist
|
|
129
|
-
} from "../chunk-
|
|
129
|
+
} from "../chunk-PMQNTU7W.js";
|
|
130
130
|
import {
|
|
131
131
|
ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
|
|
132
132
|
AnchorSessionClient,
|
|
@@ -221,14 +221,14 @@ import {
|
|
|
221
221
|
subagentActivityAgeSeconds,
|
|
222
222
|
sumTranscriptUsageInWindow,
|
|
223
223
|
transcriptActivityAgeSeconds
|
|
224
|
-
} from "../chunk-
|
|
224
|
+
} from "../chunk-MFU2FD4N.js";
|
|
225
225
|
import {
|
|
226
226
|
reapOrphanChannelMcps
|
|
227
227
|
} from "../chunk-XWVM4KPK.js";
|
|
228
228
|
|
|
229
229
|
// src/lib/manager-worker.ts
|
|
230
230
|
import { createHash as createHash20 } from "crypto";
|
|
231
|
-
import { readFileSync as
|
|
231
|
+
import { readFileSync as readFileSync32, writeFileSync as writeFileSync18, mkdirSync as mkdirSync15, existsSync as existsSync19, rmSync as rmSync8, readdirSync as readdirSync12, statSync as statSync11, unlinkSync as unlinkSync6, renameSync as renameSync11, utimesSync as utimesSync4 } from "fs";
|
|
232
232
|
|
|
233
233
|
// src/lib/atomic-file-replace.ts
|
|
234
234
|
import { copyFileSync, renameSync, unlinkSync } from "fs";
|
|
@@ -254,7 +254,7 @@ function defaultUnique() {
|
|
|
254
254
|
|
|
255
255
|
// src/lib/manager-worker.ts
|
|
256
256
|
import { execFileSync as syncExecFile } from "child_process";
|
|
257
|
-
import { join as
|
|
257
|
+
import { join as join41, dirname as dirname11, delimiter as pathDelimiter } from "path";
|
|
258
258
|
import { homedir as homedir17 } from "os";
|
|
259
259
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
260
260
|
|
|
@@ -1847,12 +1847,12 @@ function isPathInsideDir(candidate, dir) {
|
|
|
1847
1847
|
return resolvedCandidate.startsWith(resolvedDir.endsWith(sep) ? resolvedDir : resolvedDir + sep);
|
|
1848
1848
|
}
|
|
1849
1849
|
function findMissingMcpBundles(mcpConfigPath, deps = {}) {
|
|
1850
|
-
const
|
|
1851
|
-
const
|
|
1850
|
+
const existsSync20 = deps.existsSync ?? nodeExistsSync;
|
|
1851
|
+
const readFileSync33 = deps.readFileSync ?? nodeReadFileSync;
|
|
1852
1852
|
const mcpDir = deps.mcpDir ?? getSharedMcpDir();
|
|
1853
1853
|
let parsed;
|
|
1854
1854
|
try {
|
|
1855
|
-
parsed = JSON.parse(
|
|
1855
|
+
parsed = JSON.parse(readFileSync33(mcpConfigPath, "utf-8"));
|
|
1856
1856
|
} catch {
|
|
1857
1857
|
return [];
|
|
1858
1858
|
}
|
|
@@ -1872,7 +1872,7 @@ function findMissingMcpBundles(mcpConfigPath, deps = {}) {
|
|
|
1872
1872
|
if (seenPaths.has(resolvedBundlePath)) continue;
|
|
1873
1873
|
let present;
|
|
1874
1874
|
try {
|
|
1875
|
-
present =
|
|
1875
|
+
present = existsSync20(bundlePath);
|
|
1876
1876
|
} catch {
|
|
1877
1877
|
continue;
|
|
1878
1878
|
}
|
|
@@ -7138,8 +7138,6 @@ function heartbeatRuntimeAuthFields(probeVerdict) {
|
|
|
7138
7138
|
}
|
|
7139
7139
|
|
|
7140
7140
|
// src/lib/manager/kanban/parsers.ts
|
|
7141
|
-
import { existsSync as existsSync15, readFileSync as readFileSync25 } from "fs";
|
|
7142
|
-
import { join as join33 } from "path";
|
|
7143
7141
|
var STANDUP_TEMPLATES = /* @__PURE__ */ new Set(["daily-standup", "end-of-day-summary"]);
|
|
7144
7142
|
var TASK_UPDATE_TEMPLATES = /* @__PURE__ */ new Set(["hourly-status", "task-update"]);
|
|
7145
7143
|
var PLAN_TEMPLATES = /* @__PURE__ */ new Set(["morning-plan"]);
|
|
@@ -7286,29 +7284,6 @@ function sanitizeBoardItem(item) {
|
|
|
7286
7284
|
...item.deliverable ? { deliverable: sanitizeKanbanString(item.deliverable, 500) } : {}
|
|
7287
7285
|
};
|
|
7288
7286
|
}
|
|
7289
|
-
var builtInSkillCache = /* @__PURE__ */ new Map();
|
|
7290
|
-
function getBuiltInSkillContent(skillId) {
|
|
7291
|
-
if (builtInSkillCache.has(skillId)) return builtInSkillCache.get(skillId);
|
|
7292
|
-
try {
|
|
7293
|
-
const candidates = [
|
|
7294
|
-
join33(process.cwd(), "skills", skillId, "SKILL.md"),
|
|
7295
|
-
join33(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
|
|
7296
|
-
];
|
|
7297
|
-
for (const candidate of candidates) {
|
|
7298
|
-
if (existsSync15(candidate)) {
|
|
7299
|
-
const content = readFileSync25(candidate, "utf-8");
|
|
7300
|
-
const files = [{ relativePath: "SKILL.md", content }];
|
|
7301
|
-
builtInSkillCache.set(skillId, files);
|
|
7302
|
-
return files;
|
|
7303
|
-
}
|
|
7304
|
-
}
|
|
7305
|
-
builtInSkillCache.set(skillId, null);
|
|
7306
|
-
return null;
|
|
7307
|
-
} catch {
|
|
7308
|
-
builtInSkillCache.set(skillId, null);
|
|
7309
|
-
return null;
|
|
7310
|
-
}
|
|
7311
|
-
}
|
|
7312
7287
|
function parseKanbanUpdates(summary) {
|
|
7313
7288
|
const updates = [];
|
|
7314
7289
|
const markerMatch = /kanban update:/i.exec(summary);
|
|
@@ -7437,19 +7412,19 @@ function formatBoardForPrompt(items, template) {
|
|
|
7437
7412
|
}
|
|
7438
7413
|
|
|
7439
7414
|
// src/lib/manager/kanban/nudge-state-cache.ts
|
|
7440
|
-
import { existsSync as
|
|
7441
|
-
import { join as
|
|
7415
|
+
import { existsSync as existsSync15, readFileSync as readFileSync25, writeFileSync as writeFileSync13 } from "fs";
|
|
7416
|
+
import { join as join33 } from "path";
|
|
7442
7417
|
var CACHE_FILENAME2 = "kanban-nudge-state.json";
|
|
7443
7418
|
var KANBAN_NUDGE_STATE_VERSION = 1;
|
|
7444
7419
|
function getKanbanNudgeStateFile(configDir) {
|
|
7445
|
-
return
|
|
7420
|
+
return join33(configDir, CACHE_FILENAME2);
|
|
7446
7421
|
}
|
|
7447
7422
|
function loadKanbanNudgeState(target, configDir) {
|
|
7448
7423
|
const path = getKanbanNudgeStateFile(configDir);
|
|
7449
|
-
if (!
|
|
7424
|
+
if (!existsSync15(path)) return;
|
|
7450
7425
|
let parsed;
|
|
7451
7426
|
try {
|
|
7452
|
-
parsed = JSON.parse(
|
|
7427
|
+
parsed = JSON.parse(readFileSync25(path, "utf-8"));
|
|
7453
7428
|
} catch {
|
|
7454
7429
|
return;
|
|
7455
7430
|
}
|
|
@@ -8067,9 +8042,9 @@ function closeSessionRunForCode(codeName, outcome, reason) {
|
|
|
8067
8042
|
|
|
8068
8043
|
// src/lib/manager/scheduler/kanban-route.ts
|
|
8069
8044
|
import { createHash as createHash15 } from "crypto";
|
|
8070
|
-
import { writeFileSync as writeFileSync14, renameSync as renameSync8, mkdirSync as mkdirSync11, readFileSync as
|
|
8045
|
+
import { writeFileSync as writeFileSync14, renameSync as renameSync8, mkdirSync as mkdirSync11, readFileSync as readFileSync26, unlinkSync as unlinkSync3 } from "fs";
|
|
8071
8046
|
import { homedir as homedir14 } from "os";
|
|
8072
|
-
import { join as
|
|
8047
|
+
import { join as join34, dirname as dirname9 } from "path";
|
|
8073
8048
|
|
|
8074
8049
|
// src/lib/manager/scheduler/notify.ts
|
|
8075
8050
|
import { createHash as createHash14 } from "crypto";
|
|
@@ -8428,7 +8403,7 @@ function resolveScheduledSlackTarget(task) {
|
|
|
8428
8403
|
}
|
|
8429
8404
|
function stampScheduledTurnMarker(codeName, taskId, target) {
|
|
8430
8405
|
try {
|
|
8431
|
-
const file =
|
|
8406
|
+
const file = join34(homedir14(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
|
|
8432
8407
|
const marker = { ts: Date.now(), task_id: taskId, ...target ? { target } : {} };
|
|
8433
8408
|
const tmp = `${file}.tmp`;
|
|
8434
8409
|
writeFileSync14(tmp, JSON.stringify(marker), "utf8");
|
|
@@ -8438,9 +8413,9 @@ function stampScheduledTurnMarker(codeName, taskId, target) {
|
|
|
8438
8413
|
}
|
|
8439
8414
|
}
|
|
8440
8415
|
function clearScheduledTurnMarkerForTask(codeName, taskId) {
|
|
8441
|
-
const file =
|
|
8416
|
+
const file = join34(homedir14(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
|
|
8442
8417
|
try {
|
|
8443
|
-
const raw = JSON.parse(
|
|
8418
|
+
const raw = JSON.parse(readFileSync26(file, "utf8"));
|
|
8444
8419
|
if (typeof raw?.task_id !== "string" || raw.task_id !== taskId) return;
|
|
8445
8420
|
unlinkSync3(file);
|
|
8446
8421
|
log(`[scheduled-kanban] scheduled-turn marker cleared for '${codeName}' (task ${taskId} complete)`);
|
|
@@ -8653,11 +8628,11 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
8653
8628
|
// src/lib/manager/scheduler/execution.ts
|
|
8654
8629
|
import { createHash as createHash16 } from "crypto";
|
|
8655
8630
|
import { homedir as homedir15 } from "os";
|
|
8656
|
-
import { join as
|
|
8631
|
+
import { join as join36 } from "path";
|
|
8657
8632
|
|
|
8658
8633
|
// src/lib/agent-serving-probe.ts
|
|
8659
|
-
import { readFileSync as
|
|
8660
|
-
import { join as
|
|
8634
|
+
import { readFileSync as readFileSync27, readdirSync as readdirSync8, statSync as statSync8 } from "fs";
|
|
8635
|
+
import { join as join35 } from "path";
|
|
8661
8636
|
var RATE_LIMIT_WINDOW_MS = 6 * 60 * 60 * 1e3;
|
|
8662
8637
|
function probeRateLimit(args) {
|
|
8663
8638
|
const now = args.now ?? /* @__PURE__ */ new Date();
|
|
@@ -8673,7 +8648,7 @@ function probeRateLimit(args) {
|
|
|
8673
8648
|
let newest = UNKNOWN_RATE_LIMIT;
|
|
8674
8649
|
for (const name of entries) {
|
|
8675
8650
|
if (!name.endsWith(".jsonl")) continue;
|
|
8676
|
-
const path =
|
|
8651
|
+
const path = join35(dir, name);
|
|
8677
8652
|
try {
|
|
8678
8653
|
const st = statSync8(path);
|
|
8679
8654
|
if (!st.isFile() || st.mtimeMs < startMs) continue;
|
|
@@ -8682,7 +8657,7 @@ function probeRateLimit(args) {
|
|
|
8682
8657
|
}
|
|
8683
8658
|
let content;
|
|
8684
8659
|
try {
|
|
8685
|
-
content =
|
|
8660
|
+
content = readFileSync27(path, "utf-8");
|
|
8686
8661
|
} catch {
|
|
8687
8662
|
continue;
|
|
8688
8663
|
}
|
|
@@ -8744,7 +8719,7 @@ function shouldLogUsageCapDeferral(site, codeName, limitedUntil) {
|
|
|
8744
8719
|
|
|
8745
8720
|
// src/lib/manager/scheduler/execution.ts
|
|
8746
8721
|
function claudePidFilePath() {
|
|
8747
|
-
return
|
|
8722
|
+
return join36(homedir15(), ".augmented", "manager-claude-pids.json");
|
|
8748
8723
|
}
|
|
8749
8724
|
var inFlightClaudePids = /* @__PURE__ */ new Map();
|
|
8750
8725
|
function registerClaudeSpawn(record) {
|
|
@@ -8815,7 +8790,7 @@ async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData
|
|
|
8815
8790
|
|
|
8816
8791
|
// src/lib/occupancy-gate.ts
|
|
8817
8792
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync9, readSync as readSync2, statSync as statSync9 } from "fs";
|
|
8818
|
-
import { join as
|
|
8793
|
+
import { join as join37 } from "path";
|
|
8819
8794
|
function rostersMeasuredZero(mode, attested, runtimeRunning) {
|
|
8820
8795
|
return mode === "enforce" && attested && runtimeRunning;
|
|
8821
8796
|
}
|
|
@@ -8906,10 +8881,10 @@ function candidateTranscriptPaths(dir) {
|
|
|
8906
8881
|
let complete = true;
|
|
8907
8882
|
for (const name of top) {
|
|
8908
8883
|
if (name.endsWith(".jsonl")) {
|
|
8909
|
-
paths.push(
|
|
8884
|
+
paths.push(join37(dir, name));
|
|
8910
8885
|
continue;
|
|
8911
8886
|
}
|
|
8912
|
-
const subDir =
|
|
8887
|
+
const subDir = join37(dir, name, "subagents");
|
|
8913
8888
|
let subs;
|
|
8914
8889
|
try {
|
|
8915
8890
|
subs = readdirSync9(subDir);
|
|
@@ -8918,7 +8893,7 @@ function candidateTranscriptPaths(dir) {
|
|
|
8918
8893
|
continue;
|
|
8919
8894
|
}
|
|
8920
8895
|
for (const sub of subs) {
|
|
8921
|
-
if (sub.endsWith(".jsonl")) paths.push(
|
|
8896
|
+
if (sub.endsWith(".jsonl")) paths.push(join37(subDir, sub));
|
|
8922
8897
|
}
|
|
8923
8898
|
}
|
|
8924
8899
|
return { paths, complete };
|
|
@@ -9144,7 +9119,7 @@ function stopPaneOccupancySampler() {
|
|
|
9144
9119
|
}
|
|
9145
9120
|
|
|
9146
9121
|
// src/lib/pid-pressure-sampler.ts
|
|
9147
|
-
import { existsSync as
|
|
9122
|
+
import { existsSync as existsSync16, readFileSync as readFileSync28 } from "fs";
|
|
9148
9123
|
var SAMPLE_INTERVAL_MS2 = 3e4;
|
|
9149
9124
|
function warnFraction() {
|
|
9150
9125
|
const raw = Number(process.env.AGT_PID_PRESSURE_WARN_FRACTION);
|
|
@@ -9157,7 +9132,7 @@ function configuredCeiling() {
|
|
|
9157
9132
|
}
|
|
9158
9133
|
function readTextReal(path) {
|
|
9159
9134
|
try {
|
|
9160
|
-
return
|
|
9135
|
+
return readFileSync28(path, "utf-8");
|
|
9161
9136
|
} catch {
|
|
9162
9137
|
return null;
|
|
9163
9138
|
}
|
|
@@ -9166,7 +9141,7 @@ var cgroupDirCache = /* @__PURE__ */ new Map();
|
|
|
9166
9141
|
var resolveRetryAfter = /* @__PURE__ */ new Map();
|
|
9167
9142
|
var RESOLVE_RETRY_BACKOFF_MS = 5 * 6e4;
|
|
9168
9143
|
function resolveCgroupDirReal(codeName, deps = {}) {
|
|
9169
|
-
const exists = deps.exists ??
|
|
9144
|
+
const exists = deps.exists ?? existsSync16;
|
|
9170
9145
|
const inspectId = deps.inspectId ?? inspectContainerId;
|
|
9171
9146
|
const now = deps.now ?? Date.now;
|
|
9172
9147
|
const cached = cgroupDirCache.get(codeName);
|
|
@@ -10468,9 +10443,9 @@ async function fireOpencodeScheduledTask(agent, task) {
|
|
|
10468
10443
|
|
|
10469
10444
|
// src/lib/opencode-telegram-ingest.ts
|
|
10470
10445
|
import { createHash as createHash19 } from "crypto";
|
|
10471
|
-
import { existsSync as
|
|
10446
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync12, readFileSync as readFileSync29, renameSync as renameSync9, unlinkSync as unlinkSync4, writeFileSync as writeFileSync15 } from "fs";
|
|
10472
10447
|
import { randomUUID } from "crypto";
|
|
10473
|
-
import { join as
|
|
10448
|
+
import { join as join38 } from "path";
|
|
10474
10449
|
|
|
10475
10450
|
// src/lib/telegram-ingest.ts
|
|
10476
10451
|
import https2 from "https";
|
|
@@ -11027,7 +11002,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
|
|
|
11027
11002
|
let filePath;
|
|
11028
11003
|
try {
|
|
11029
11004
|
dir = getFramework("opencode").getAgentDir(codeName);
|
|
11030
|
-
filePath =
|
|
11005
|
+
filePath = join38(dir, "telegram-getupdates-offset-opencode.json");
|
|
11031
11006
|
} catch {
|
|
11032
11007
|
dir = null;
|
|
11033
11008
|
filePath = null;
|
|
@@ -11036,7 +11011,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
|
|
|
11036
11011
|
load() {
|
|
11037
11012
|
if (!filePath) return 0;
|
|
11038
11013
|
try {
|
|
11039
|
-
const parsed = JSON.parse(
|
|
11014
|
+
const parsed = JSON.parse(readFileSync29(filePath, "utf-8"));
|
|
11040
11015
|
if (currentBotId != null && typeof parsed?.bot_id === "number" && parsed.bot_id !== currentBotId) {
|
|
11041
11016
|
log2(`[telegram-ingest:${codeName}] offset cursor belongs to a different bot; ignoring (bot swap)`);
|
|
11042
11017
|
return 0;
|
|
@@ -11069,7 +11044,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
|
|
|
11069
11044
|
} catch (err) {
|
|
11070
11045
|
log2(`[telegram-ingest:${codeName}] offset persist failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
11071
11046
|
try {
|
|
11072
|
-
if (
|
|
11047
|
+
if (existsSync17(tmpPath)) unlinkSync4(tmpPath);
|
|
11073
11048
|
} catch {
|
|
11074
11049
|
}
|
|
11075
11050
|
}
|
|
@@ -11306,24 +11281,24 @@ function partitionActionableByPoison(actionable, states, config2) {
|
|
|
11306
11281
|
}
|
|
11307
11282
|
|
|
11308
11283
|
// src/lib/restart-flags.ts
|
|
11309
|
-
import { existsSync as
|
|
11284
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync13, readdirSync as readdirSync10, readFileSync as readFileSync30, renameSync as renameSync10, rmSync as rmSync7, writeFileSync as writeFileSync16 } from "fs";
|
|
11310
11285
|
import { homedir as homedir16 } from "os";
|
|
11311
|
-
import { join as
|
|
11286
|
+
import { join as join39 } from "path";
|
|
11312
11287
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
11313
11288
|
function restartFlagsDir() {
|
|
11314
|
-
return
|
|
11289
|
+
return join39(homedir16(), ".augmented", "restart-flags");
|
|
11315
11290
|
}
|
|
11316
11291
|
function flagPath(codeName) {
|
|
11317
|
-
return
|
|
11292
|
+
return join39(restartFlagsDir(), `${codeName}.flag`);
|
|
11318
11293
|
}
|
|
11319
11294
|
function readRestartFlags() {
|
|
11320
11295
|
const dir = restartFlagsDir();
|
|
11321
|
-
if (!
|
|
11296
|
+
if (!existsSync18(dir)) return [];
|
|
11322
11297
|
const out = [];
|
|
11323
11298
|
for (const entry of readdirSync10(dir)) {
|
|
11324
11299
|
if (!entry.endsWith(".flag")) continue;
|
|
11325
11300
|
try {
|
|
11326
|
-
const raw =
|
|
11301
|
+
const raw = readFileSync30(join39(dir, entry), "utf8");
|
|
11327
11302
|
const parsed = JSON.parse(raw);
|
|
11328
11303
|
if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
|
|
11329
11304
|
parsed.codeName = entry.replace(/\.flag$/, "");
|
|
@@ -11341,7 +11316,7 @@ function readRestartFlags() {
|
|
|
11341
11316
|
}
|
|
11342
11317
|
function deleteRestartFlag(codeName) {
|
|
11343
11318
|
const path = flagPath(codeName);
|
|
11344
|
-
if (
|
|
11319
|
+
if (existsSync18(path)) {
|
|
11345
11320
|
rmSync7(path, { force: true });
|
|
11346
11321
|
}
|
|
11347
11322
|
}
|
|
@@ -11441,8 +11416,8 @@ async function sendError(flag, opts, text) {
|
|
|
11441
11416
|
}
|
|
11442
11417
|
|
|
11443
11418
|
// src/lib/restart-context.ts
|
|
11444
|
-
import { readdirSync as readdirSync11, readFileSync as
|
|
11445
|
-
import { dirname as dirname10, join as
|
|
11419
|
+
import { readdirSync as readdirSync11, readFileSync as readFileSync31, writeFileSync as writeFileSync17, mkdirSync as mkdirSync14, unlinkSync as unlinkSync5 } from "fs";
|
|
11420
|
+
import { dirname as dirname10, join as join40 } from "path";
|
|
11446
11421
|
var SLACK_PENDING_INBOUND_DIRNAME = "slack-pending-inbound";
|
|
11447
11422
|
var SLACK_RESTART_CONTEXT_DIRNAME = "slack-restart-context";
|
|
11448
11423
|
var MAX_TOPIC_CHARS = 140;
|
|
@@ -11454,10 +11429,10 @@ function augmentedAgentDir(codeName) {
|
|
|
11454
11429
|
return dirname10(getProjectDir(codeName));
|
|
11455
11430
|
}
|
|
11456
11431
|
function slackPendingInboundDir(codeName) {
|
|
11457
|
-
return
|
|
11432
|
+
return join40(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
|
|
11458
11433
|
}
|
|
11459
11434
|
function slackRestartContextDir(codeName) {
|
|
11460
|
-
return
|
|
11435
|
+
return join40(augmentedAgentDir(codeName), SLACK_RESTART_CONTEXT_DIRNAME);
|
|
11461
11436
|
}
|
|
11462
11437
|
function sanitizeTopic(raw) {
|
|
11463
11438
|
const cleaned = raw.replace(/\s+/g, " ").trim().replace(/[<>]/g, " ").replace(/\s+/g, " ").trim();
|
|
@@ -11499,7 +11474,7 @@ function safeReaddir(dir) {
|
|
|
11499
11474
|
}
|
|
11500
11475
|
function readStrandedMarker(path) {
|
|
11501
11476
|
try {
|
|
11502
|
-
const parsed = JSON.parse(
|
|
11477
|
+
const parsed = JSON.parse(readFileSync31(path, "utf-8"));
|
|
11503
11478
|
if (typeof parsed.channel === "string" && typeof parsed.thread_ts === "string") {
|
|
11504
11479
|
return { channel: parsed.channel, thread_ts: parsed.thread_ts };
|
|
11505
11480
|
}
|
|
@@ -11517,7 +11492,7 @@ function pruneHintsExcept(codeName, freshFilenames) {
|
|
|
11517
11492
|
if (!filename.endsWith(".json")) continue;
|
|
11518
11493
|
if (freshFilenames.has(filename)) continue;
|
|
11519
11494
|
try {
|
|
11520
|
-
unlinkSync5(
|
|
11495
|
+
unlinkSync5(join40(ctxDir, filename));
|
|
11521
11496
|
} catch {
|
|
11522
11497
|
}
|
|
11523
11498
|
}
|
|
@@ -11538,7 +11513,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
|
|
|
11538
11513
|
}
|
|
11539
11514
|
const markers = [];
|
|
11540
11515
|
for (const filename of markerFilenames.slice(0, cap)) {
|
|
11541
|
-
const parsed = readStrandedMarker(
|
|
11516
|
+
const parsed = readStrandedMarker(join40(markerDir, filename));
|
|
11542
11517
|
if (parsed) markers.push({ filename, channel: parsed.channel, thread_ts: parsed.thread_ts });
|
|
11543
11518
|
}
|
|
11544
11519
|
if (markers.length === 0) {
|
|
@@ -11552,7 +11527,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
|
|
|
11552
11527
|
const freshFilenames = /* @__PURE__ */ new Set();
|
|
11553
11528
|
for (const { filename, hint } of hints) {
|
|
11554
11529
|
try {
|
|
11555
|
-
writeHintFile(
|
|
11530
|
+
writeHintFile(join40(ctxDir, filename), ctxDir, hint);
|
|
11556
11531
|
freshFilenames.add(filename);
|
|
11557
11532
|
} catch (err) {
|
|
11558
11533
|
log2(`[restart-context] ${codeName}: hint write failed for ${filename}: ${err.message}`);
|
|
@@ -13021,7 +12996,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
|
|
|
13021
12996
|
var dayRolloverInboundHold = /* @__PURE__ */ new Map();
|
|
13022
12997
|
var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
|
|
13023
12998
|
async function channelInboundActivityAgeSecondsFor(codeName) {
|
|
13024
|
-
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-
|
|
12999
|
+
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-P7EAWN6J.js");
|
|
13025
13000
|
const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
|
|
13026
13001
|
if (newest === null) return null;
|
|
13027
13002
|
return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
|
|
@@ -13271,7 +13246,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
|
|
|
13271
13246
|
var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
|
|
13272
13247
|
function projectMcpHash(_codeName, projectDir) {
|
|
13273
13248
|
try {
|
|
13274
|
-
const raw =
|
|
13249
|
+
const raw = readFileSync32(join41(projectDir, ".mcp.json"), "utf-8");
|
|
13275
13250
|
return createHash20("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
|
|
13276
13251
|
} catch {
|
|
13277
13252
|
return null;
|
|
@@ -13279,7 +13254,7 @@ function projectMcpHash(_codeName, projectDir) {
|
|
|
13279
13254
|
}
|
|
13280
13255
|
function projectMcpKeys(_codeName, projectDir) {
|
|
13281
13256
|
try {
|
|
13282
|
-
const raw =
|
|
13257
|
+
const raw = readFileSync32(join41(projectDir, ".mcp.json"), "utf-8");
|
|
13283
13258
|
const parsed = JSON.parse(raw);
|
|
13284
13259
|
const servers = parsed.mcpServers;
|
|
13285
13260
|
if (!servers || typeof servers !== "object") return /* @__PURE__ */ new Set();
|
|
@@ -13297,7 +13272,7 @@ function seedSessionLaunchBaselines(codeName, projectDir) {
|
|
|
13297
13272
|
else runningMcpServerKeys.delete(codeName);
|
|
13298
13273
|
let launchStructure = null;
|
|
13299
13274
|
try {
|
|
13300
|
-
const raw =
|
|
13275
|
+
const raw = readFileSync32(join41(projectDir, ".mcp.json"), "utf-8");
|
|
13301
13276
|
launchStructure = managedMcpStructureHashFromFile(
|
|
13302
13277
|
JSON.parse(raw),
|
|
13303
13278
|
isManagedMcpServerKey
|
|
@@ -13432,7 +13407,7 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
|
|
|
13432
13407
|
if (result && result.rebindCandidates.length > 0 && hostFlagStore().getBoolean("session-tool-rebind")) {
|
|
13433
13408
|
let mcpJsonForRebind = null;
|
|
13434
13409
|
try {
|
|
13435
|
-
mcpJsonForRebind = JSON.parse(
|
|
13410
|
+
mcpJsonForRebind = JSON.parse(readFileSync32(join41(projectDir, ".mcp.json"), "utf-8"));
|
|
13436
13411
|
} catch {
|
|
13437
13412
|
mcpJsonForRebind = null;
|
|
13438
13413
|
}
|
|
@@ -13580,7 +13555,7 @@ function shouldInjectChannelSecrets(agentId) {
|
|
|
13580
13555
|
function projectChannelSecretHash(projectDir) {
|
|
13581
13556
|
try {
|
|
13582
13557
|
const entries = parseEnvIntegrations(
|
|
13583
|
-
|
|
13558
|
+
readFileSync32(join41(projectDir, ".env.integrations"), "utf-8")
|
|
13584
13559
|
);
|
|
13585
13560
|
return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
|
|
13586
13561
|
} catch {
|
|
@@ -13689,7 +13664,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
13689
13664
|
var lastVersionCheckAt = 0;
|
|
13690
13665
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
13691
13666
|
var lastResponsivenessProbeAt = 0;
|
|
13692
|
-
var agtCliVersion = true ? "0.28.
|
|
13667
|
+
var agtCliVersion = true ? "0.28.848" : "dev";
|
|
13693
13668
|
function resolveBrewPath(execFileSync2) {
|
|
13694
13669
|
try {
|
|
13695
13670
|
const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -13702,7 +13677,7 @@ function resolveBrewPath(execFileSync2) {
|
|
|
13702
13677
|
"/usr/local/bin/brew"
|
|
13703
13678
|
];
|
|
13704
13679
|
for (const path of fallbacks) {
|
|
13705
|
-
if (
|
|
13680
|
+
if (existsSync19(path)) return path;
|
|
13706
13681
|
}
|
|
13707
13682
|
return null;
|
|
13708
13683
|
}
|
|
@@ -13712,7 +13687,7 @@ function claudeBinaryInstalled(execFileSync2) {
|
|
|
13712
13687
|
"/opt/homebrew/bin/claude",
|
|
13713
13688
|
"/usr/local/bin/claude"
|
|
13714
13689
|
];
|
|
13715
|
-
if (canonical.some((path) =>
|
|
13690
|
+
if (canonical.some((path) => existsSync19(path))) return true;
|
|
13716
13691
|
try {
|
|
13717
13692
|
execFileSync2("which", ["claude"], { timeout: 5e3 });
|
|
13718
13693
|
return true;
|
|
@@ -14022,8 +13997,8 @@ var MANAGED_SETTINGS_KEYS = ["channelsEnabled", "enableAllProjectMcpServers"];
|
|
|
14022
13997
|
function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
|
|
14023
13998
|
try {
|
|
14024
13999
|
let settings = {};
|
|
14025
|
-
if (
|
|
14026
|
-
const raw =
|
|
14000
|
+
if (existsSync19(path)) {
|
|
14001
|
+
const raw = readFileSync32(path, "utf-8").trim();
|
|
14027
14002
|
if (raw) {
|
|
14028
14003
|
let parsed;
|
|
14029
14004
|
try {
|
|
@@ -14079,7 +14054,7 @@ async function ensureOpencodeBinary() {
|
|
|
14079
14054
|
try {
|
|
14080
14055
|
const prefix = execFileSync2("npm", ["prefix", "-g"], { encoding: "utf-8", timeout: 1e4 }).trim();
|
|
14081
14056
|
if (prefix) {
|
|
14082
|
-
const npmBin =
|
|
14057
|
+
const npmBin = join41(prefix, "bin");
|
|
14083
14058
|
const current = (process.env.PATH ?? "").split(pathDelimiter);
|
|
14084
14059
|
if (!current.includes(npmBin)) {
|
|
14085
14060
|
process.env.PATH = [npmBin, ...current.filter(Boolean)].join(pathDelimiter);
|
|
@@ -14140,7 +14115,7 @@ async function ensureFrameworkBinary(frameworkId) {
|
|
|
14140
14115
|
if (!process.env.PATH?.split(":").includes(brewBinDir)) {
|
|
14141
14116
|
process.env.PATH = `${brewBinDir}:${process.env.PATH ?? ""}`;
|
|
14142
14117
|
}
|
|
14143
|
-
if (
|
|
14118
|
+
if (existsSync19("/home/linuxbrew/.linuxbrew/bin/claude")) {
|
|
14144
14119
|
log("Claude Code installed successfully");
|
|
14145
14120
|
} else {
|
|
14146
14121
|
log("Claude Code install completed but binary not found at expected path \u2014 check brew logs");
|
|
@@ -14219,7 +14194,7 @@ async function maybeUpgradeClaudeCode() {
|
|
|
14219
14194
|
}
|
|
14220
14195
|
var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
14221
14196
|
function selfUpdateAppliedMarkerPath() {
|
|
14222
|
-
return
|
|
14197
|
+
return join41(homedir17(), ".augmented", ".last-self-update-applied");
|
|
14223
14198
|
}
|
|
14224
14199
|
var selfUpdateUpToDateLogged = false;
|
|
14225
14200
|
var selfUpdatePinnedLogged = false;
|
|
@@ -14270,7 +14245,7 @@ async function checkAndUpdateCli(opts) {
|
|
|
14270
14245
|
const isNpmGlobal = !isBrewFormula && resolvedPath.includes("node_modules");
|
|
14271
14246
|
if (!isBrewFormula && !isNpmGlobal) return "noop";
|
|
14272
14247
|
const { readFileSync: readF, writeFileSync: writeF } = await import("fs");
|
|
14273
|
-
const markerPath =
|
|
14248
|
+
const markerPath = join41(homedir17(), ".augmented", ".last-update-check");
|
|
14274
14249
|
if (!force) {
|
|
14275
14250
|
try {
|
|
14276
14251
|
const lastCheck = parseInt(readF(markerPath, "utf-8").trim(), 10);
|
|
@@ -14763,13 +14738,13 @@ async function checkClaudeAuth() {
|
|
|
14763
14738
|
}
|
|
14764
14739
|
var evalEmptyMcpConfigPath = null;
|
|
14765
14740
|
function ensureEvalEmptyMcpConfig() {
|
|
14766
|
-
if (evalEmptyMcpConfigPath &&
|
|
14767
|
-
const dir =
|
|
14741
|
+
if (evalEmptyMcpConfigPath && existsSync19(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
|
|
14742
|
+
const dir = join41(homedir17(), ".augmented");
|
|
14768
14743
|
try {
|
|
14769
14744
|
mkdirSync15(dir, { recursive: true });
|
|
14770
14745
|
} catch {
|
|
14771
14746
|
}
|
|
14772
|
-
const p =
|
|
14747
|
+
const p = join41(dir, ".eval-empty-mcp.json");
|
|
14773
14748
|
writeFileSync18(p, JSON.stringify({ mcpServers: {} }));
|
|
14774
14749
|
evalEmptyMcpConfigPath = p;
|
|
14775
14750
|
return p;
|
|
@@ -14864,10 +14839,10 @@ function resolveConversationEvalBackend() {
|
|
|
14864
14839
|
return conversationEvalBackend;
|
|
14865
14840
|
}
|
|
14866
14841
|
function getStateFile() {
|
|
14867
|
-
return
|
|
14842
|
+
return join41(config?.configDir ?? join41(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
|
|
14868
14843
|
}
|
|
14869
14844
|
function channelHashCacheDir() {
|
|
14870
|
-
return config?.configDir ??
|
|
14845
|
+
return config?.configDir ?? join41(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
14871
14846
|
}
|
|
14872
14847
|
function loadChannelHashCache2() {
|
|
14873
14848
|
loadChannelHashCache(agentState.knownChannelConfigHashes, channelHashCacheDir());
|
|
@@ -15080,7 +15055,7 @@ function removeDeliveryBaselineEntries(agentId) {
|
|
|
15080
15055
|
var _channelQuarantineStore = null;
|
|
15081
15056
|
function channelQuarantineStore() {
|
|
15082
15057
|
if (!_channelQuarantineStore) {
|
|
15083
|
-
const dir = config?.configDir ??
|
|
15058
|
+
const dir = config?.configDir ?? join41(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
15084
15059
|
_channelQuarantineStore = new ChannelQuarantineStore(defaultQuarantinePath(dir));
|
|
15085
15060
|
}
|
|
15086
15061
|
return _channelQuarantineStore;
|
|
@@ -15096,12 +15071,12 @@ function claudeMdSizeFor(codeName) {
|
|
|
15096
15071
|
}
|
|
15097
15072
|
function forwardedToolsFor(codeName) {
|
|
15098
15073
|
if (!config?.configDir) return null;
|
|
15099
|
-
return readForwardedToolsReport(
|
|
15074
|
+
return readForwardedToolsReport(join41(config.configDir, codeName));
|
|
15100
15075
|
}
|
|
15101
15076
|
var _hostFlagStore = null;
|
|
15102
15077
|
function hostFlagStore() {
|
|
15103
15078
|
if (!_hostFlagStore) {
|
|
15104
|
-
const dir = config?.configDir ??
|
|
15079
|
+
const dir = config?.configDir ?? join41(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
15105
15080
|
_hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
|
|
15106
15081
|
}
|
|
15107
15082
|
return _hostFlagStore;
|
|
@@ -15175,12 +15150,12 @@ function parseSkillFrontmatter(content) {
|
|
|
15175
15150
|
}
|
|
15176
15151
|
async function refreshSkillsIndexInClaudeMd(configDir, codeName, log2) {
|
|
15177
15152
|
const { readdirSync: readdirSync13, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync19 } = await import("fs");
|
|
15178
|
-
const skillsDir =
|
|
15179
|
-
const claudeMdPath =
|
|
15153
|
+
const skillsDir = join41(configDir, codeName, "project", ".claude", "skills");
|
|
15154
|
+
const claudeMdPath = join41(configDir, codeName, "project", "CLAUDE.md");
|
|
15180
15155
|
if (!ex(skillsDir) || !ex(claudeMdPath)) return;
|
|
15181
15156
|
const entries = [];
|
|
15182
15157
|
for (const dir of readdirSync13(skillsDir).sort()) {
|
|
15183
|
-
const skillFile =
|
|
15158
|
+
const skillFile = join41(skillsDir, dir, "SKILL.md");
|
|
15184
15159
|
if (!ex(skillFile)) continue;
|
|
15185
15160
|
try {
|
|
15186
15161
|
const { name, description } = parseSkillFrontmatter(rfs(skillFile, "utf-8"));
|
|
@@ -15279,7 +15254,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
15279
15254
|
if (codeNames.length === 0) return;
|
|
15280
15255
|
void (async () => {
|
|
15281
15256
|
try {
|
|
15282
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
15257
|
+
const { collectDiagnostics } = await import("../persistent-session-JKES3FMW.js");
|
|
15283
15258
|
await api.post("/host/heartbeat", {
|
|
15284
15259
|
host_id: hostId,
|
|
15285
15260
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
|
|
@@ -15421,7 +15396,7 @@ async function pollCycleInner() {
|
|
|
15421
15396
|
}
|
|
15422
15397
|
try {
|
|
15423
15398
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
15424
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
15399
|
+
const { collectDiagnostics } = await import("../persistent-session-JKES3FMW.js");
|
|
15425
15400
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
15426
15401
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor) : void 0;
|
|
15427
15402
|
let tailscaleHostname;
|
|
@@ -15590,7 +15565,7 @@ async function pollCycleInner() {
|
|
|
15590
15565
|
collectPanelessActivityProbes,
|
|
15591
15566
|
getResponsivenessIntervalMs,
|
|
15592
15567
|
occupancyQualificationClassifications
|
|
15593
|
-
} = await import("../responsiveness-probe-
|
|
15568
|
+
} = await import("../responsiveness-probe-P7EAWN6J.js");
|
|
15594
15569
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
15595
15570
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
15596
15571
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -15707,7 +15682,7 @@ async function pollCycleInner() {
|
|
|
15707
15682
|
collectResponsivenessProbes,
|
|
15708
15683
|
livePendingInboundOldestAgeSeconds,
|
|
15709
15684
|
parkPendingInbound
|
|
15710
|
-
} = await import("../responsiveness-probe-
|
|
15685
|
+
} = await import("../responsiveness-probe-P7EAWN6J.js");
|
|
15711
15686
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
|
|
15712
15687
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
15713
15688
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -15796,13 +15771,13 @@ async function pollCycleInner() {
|
|
|
15796
15771
|
);
|
|
15797
15772
|
if (hostFlagStore().getBoolean("wedge-transient-notice")) {
|
|
15798
15773
|
try {
|
|
15799
|
-
const paneTail =
|
|
15774
|
+
const paneTail = readFileSync32(paneLogPath(codeName), "utf8").slice(-65536);
|
|
15800
15775
|
const transient = detectTransientApiErrorInLog(paneTail);
|
|
15801
15776
|
if (transient) {
|
|
15802
|
-
const wedgeHome =
|
|
15803
|
-
if (
|
|
15777
|
+
const wedgeHome = join41(homedir17(), ".augmented", codeName);
|
|
15778
|
+
if (existsSync19(wedgeHome)) {
|
|
15804
15779
|
atomicWriteFileSync(
|
|
15805
|
-
|
|
15780
|
+
join41(wedgeHome, "watchdog-give-up.json"),
|
|
15806
15781
|
JSON.stringify({
|
|
15807
15782
|
gave_up_at: wedgeNow.toISOString(),
|
|
15808
15783
|
reason: "transient_overload"
|
|
@@ -15863,7 +15838,7 @@ async function pollCycleInner() {
|
|
|
15863
15838
|
}
|
|
15864
15839
|
try {
|
|
15865
15840
|
const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-JA437JIB.js");
|
|
15866
|
-
const { probeSessionAuth } = await import("../session-auth-dead-
|
|
15841
|
+
const { probeSessionAuth } = await import("../session-auth-dead-IFU2XLHO.js");
|
|
15867
15842
|
const observations = [];
|
|
15868
15843
|
const pendingCacheCommits = [];
|
|
15869
15844
|
const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
|
|
@@ -16132,7 +16107,7 @@ async function pollCycleInner() {
|
|
|
16132
16107
|
`[drain-flush] FAILED for '${prev.codeName}': ${err.message} \u2014 proceeding to teardown; this session was NOT shipped (ENG-9491)`
|
|
16133
16108
|
);
|
|
16134
16109
|
}
|
|
16135
|
-
const agentDir =
|
|
16110
|
+
const agentDir = join41(adapter.getAgentDir(prev.codeName), "provision");
|
|
16136
16111
|
await cleanupAgentFiles(prev.codeName, agentDir);
|
|
16137
16112
|
clearAgentCaches(prev.agentId, prev.codeName);
|
|
16138
16113
|
}
|
|
@@ -16219,10 +16194,10 @@ async function pollCycleInner() {
|
|
|
16219
16194
|
// pending-inbound marker. Best-effort: a write failure is logged by
|
|
16220
16195
|
// the watchdog, never fails the poll cycle.
|
|
16221
16196
|
signalGiveUp: (codeName) => {
|
|
16222
|
-
const dir =
|
|
16223
|
-
if (!
|
|
16197
|
+
const dir = join41(homedir17(), ".augmented", codeName);
|
|
16198
|
+
if (!existsSync19(dir)) return;
|
|
16224
16199
|
atomicWriteFileSync(
|
|
16225
|
-
|
|
16200
|
+
join41(dir, "watchdog-give-up.json"),
|
|
16226
16201
|
JSON.stringify({ gave_up_at: (/* @__PURE__ */ new Date()).toISOString() })
|
|
16227
16202
|
);
|
|
16228
16203
|
},
|
|
@@ -16241,9 +16216,9 @@ async function pollCycleInner() {
|
|
|
16241
16216
|
// parser elsewhere can only reconstruct an hour (ENG-8901).
|
|
16242
16217
|
signalUsageLimit: (codeName, resetsHint) => {
|
|
16243
16218
|
const dir = getFramework("claude-code").getAgentDir(codeName);
|
|
16244
|
-
if (!
|
|
16219
|
+
if (!existsSync19(dir)) return;
|
|
16245
16220
|
atomicWriteFileSync(
|
|
16246
|
-
|
|
16221
|
+
join41(dir, "watchdog-give-up.json"),
|
|
16247
16222
|
JSON.stringify({
|
|
16248
16223
|
gave_up_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16249
16224
|
reason: "usage_limit",
|
|
@@ -16511,7 +16486,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16511
16486
|
}
|
|
16512
16487
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
16513
16488
|
const adapter = resolveAgentFramework(agent.code_name);
|
|
16514
|
-
let agentDir =
|
|
16489
|
+
let agentDir = join41(adapter.getAgentDir(agent.code_name), "provision");
|
|
16515
16490
|
if (agent.status === "draft" || agent.status === "paused") {
|
|
16516
16491
|
forgetChannelSyncState(agent.agent_id);
|
|
16517
16492
|
if (previousKnownStatus !== agent.status) {
|
|
@@ -16552,7 +16527,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16552
16527
|
const residuals = {
|
|
16553
16528
|
gatewayRunning: false,
|
|
16554
16529
|
portAllocated: false,
|
|
16555
|
-
provisionDirExists:
|
|
16530
|
+
provisionDirExists: existsSync19(agentDir)
|
|
16556
16531
|
};
|
|
16557
16532
|
if (!hasRevokedResiduals(residuals)) {
|
|
16558
16533
|
agentStates.push({
|
|
@@ -16658,7 +16633,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16658
16633
|
if (refreshData.knowledge_manifest) {
|
|
16659
16634
|
const resolved = await resolveKnowledgeFromManifest({
|
|
16660
16635
|
manifest: refreshData.knowledge_manifest,
|
|
16661
|
-
cacheDir:
|
|
16636
|
+
cacheDir: join41(config.configDir, "_knowledge"),
|
|
16662
16637
|
delivery: refreshData.agent?.knowledge_delivery ?? "both",
|
|
16663
16638
|
fetchContents: async (hashes) => {
|
|
16664
16639
|
const res = await api.post(
|
|
@@ -16675,7 +16650,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16675
16650
|
const resolvedSkills = await resolveSkillsFromManifest({
|
|
16676
16651
|
globals: refreshData.global_skills_manifest ?? [],
|
|
16677
16652
|
shared: refreshData.shared_skills_manifest ?? [],
|
|
16678
|
-
cacheDir:
|
|
16653
|
+
cacheDir: join41(config.configDir, "_skills"),
|
|
16679
16654
|
fetchContents: async (hashes) => {
|
|
16680
16655
|
const res = await api.post(
|
|
16681
16656
|
"/host/skills/contents",
|
|
@@ -16693,7 +16668,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16693
16668
|
if (refreshData.integration_skills_manifest) {
|
|
16694
16669
|
const resolvedIntegrationSkills = await resolveIntegrationSkillsFromManifest({
|
|
16695
16670
|
manifest: refreshData.integration_skills_manifest,
|
|
16696
|
-
cacheDir:
|
|
16671
|
+
cacheDir: join41(config.configDir, "_skills"),
|
|
16697
16672
|
fetchContents: async (hashes) => {
|
|
16698
16673
|
const res = await api.post(
|
|
16699
16674
|
"/host/skills/contents",
|
|
@@ -16755,7 +16730,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16755
16730
|
const frameworkId = refreshData.agent.framework ?? DEFAULT_FRAMEWORK;
|
|
16756
16731
|
agentFrameworkCache.set(agent.code_name, frameworkId);
|
|
16757
16732
|
const frameworkAdapter = getFramework(frameworkId);
|
|
16758
|
-
agentDir =
|
|
16733
|
+
agentDir = join41(frameworkAdapter.getAgentDir(agent.code_name), "provision");
|
|
16759
16734
|
cacheAgentDeliveryMetadata(agent.code_name, refreshData);
|
|
16760
16735
|
agentRestartTimezoneInputs.set(agent.code_name, {
|
|
16761
16736
|
agentTimezone: typeof refreshData.agent.timezone === "string" ? refreshData.agent.timezone : null,
|
|
@@ -16814,7 +16789,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16814
16789
|
const changedFiles = [];
|
|
16815
16790
|
mkdirSync15(agentDir, { recursive: true });
|
|
16816
16791
|
for (const artifact of artifacts) {
|
|
16817
|
-
const filePath =
|
|
16792
|
+
const filePath = join41(agentDir, artifact.relativePath);
|
|
16818
16793
|
let existingHash;
|
|
16819
16794
|
let newHash;
|
|
16820
16795
|
let writeContent = artifact.content;
|
|
@@ -16833,8 +16808,8 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16833
16808
|
};
|
|
16834
16809
|
newHash = sha256(stripDynamicSections(artifact.content));
|
|
16835
16810
|
try {
|
|
16836
|
-
const projectClaudeMd =
|
|
16837
|
-
const existing =
|
|
16811
|
+
const projectClaudeMd = join41(config.configDir, agent.code_name, "project", "CLAUDE.md");
|
|
16812
|
+
const existing = readFileSync32(projectClaudeMd, "utf-8");
|
|
16838
16813
|
existingHash = sha256(stripDynamicSections(existing));
|
|
16839
16814
|
} catch {
|
|
16840
16815
|
existingHash = null;
|
|
@@ -16852,7 +16827,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16852
16827
|
const generatorKeys = Object.keys(generatorServers);
|
|
16853
16828
|
let existingRaw = "";
|
|
16854
16829
|
try {
|
|
16855
|
-
existingRaw =
|
|
16830
|
+
existingRaw = readFileSync32(filePath, "utf-8");
|
|
16856
16831
|
} catch {
|
|
16857
16832
|
}
|
|
16858
16833
|
const existingServers = parseMcp(existingRaw);
|
|
@@ -16868,7 +16843,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16868
16843
|
} else if (artifact.relativePath === "opencode.json") {
|
|
16869
16844
|
let existingRaw = null;
|
|
16870
16845
|
try {
|
|
16871
|
-
existingRaw =
|
|
16846
|
+
existingRaw = readFileSync32(filePath, "utf-8");
|
|
16872
16847
|
} catch {
|
|
16873
16848
|
}
|
|
16874
16849
|
const mergeResult = mergeOpencodeConfigArtifact(artifact.content, existingRaw);
|
|
@@ -16884,12 +16859,12 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16884
16859
|
}
|
|
16885
16860
|
}
|
|
16886
16861
|
if (changedFiles.length > 0) {
|
|
16887
|
-
const isFirst = !
|
|
16862
|
+
const isFirst = !existsSync19(join41(agentDir, "CHARTER.md"));
|
|
16888
16863
|
const verb = isFirst ? "Provisioning" : "Updating";
|
|
16889
16864
|
const fileNames = changedFiles.map((f) => f.relativePath).join(", ");
|
|
16890
16865
|
log(`${verb} '${agent.code_name}': ${fileNames}`);
|
|
16891
16866
|
for (const file of changedFiles) {
|
|
16892
|
-
const filePath =
|
|
16867
|
+
const filePath = join41(agentDir, file.relativePath);
|
|
16893
16868
|
mkdirSync15(dirname11(filePath), { recursive: true });
|
|
16894
16869
|
if (file.relativePath === ".mcp.json") {
|
|
16895
16870
|
safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
|
|
@@ -16898,12 +16873,12 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16898
16873
|
}
|
|
16899
16874
|
}
|
|
16900
16875
|
try {
|
|
16901
|
-
const provSkillsDir =
|
|
16902
|
-
if (
|
|
16876
|
+
const provSkillsDir = join41(agentDir, ".claude", "skills");
|
|
16877
|
+
if (existsSync19(provSkillsDir)) {
|
|
16903
16878
|
for (const folder of readdirSync12(provSkillsDir)) {
|
|
16904
16879
|
if (folder.startsWith("knowledge-")) {
|
|
16905
16880
|
try {
|
|
16906
|
-
rmSync8(
|
|
16881
|
+
rmSync8(join41(provSkillsDir, folder), { recursive: true });
|
|
16907
16882
|
} catch {
|
|
16908
16883
|
}
|
|
16909
16884
|
}
|
|
@@ -16916,7 +16891,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16916
16891
|
const trackedFiles2 = frameworkAdapter.driftTrackedFiles();
|
|
16917
16892
|
const hashes = /* @__PURE__ */ new Map();
|
|
16918
16893
|
for (const file of trackedFiles2) {
|
|
16919
|
-
const h = hashFile(
|
|
16894
|
+
const h = hashFile(join41(agentDir, file));
|
|
16920
16895
|
if (h) hashes.set(file, h);
|
|
16921
16896
|
}
|
|
16922
16897
|
agentState.writtenHashes.set(agent.agent_id, hashes);
|
|
@@ -16934,14 +16909,14 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
16934
16909
|
}
|
|
16935
16910
|
if (Array.isArray(refreshData.workflows)) {
|
|
16936
16911
|
try {
|
|
16937
|
-
const provWorkflowsDir =
|
|
16938
|
-
if (
|
|
16912
|
+
const provWorkflowsDir = join41(agentDir, ".claude", "workflows");
|
|
16913
|
+
if (existsSync19(provWorkflowsDir)) {
|
|
16939
16914
|
const expected = new Set(refreshData.workflows.map((w) => `${w.name}.js`));
|
|
16940
16915
|
for (const file of readdirSync12(provWorkflowsDir)) {
|
|
16941
16916
|
if (!file.endsWith(".js")) continue;
|
|
16942
16917
|
if (expected.has(file)) continue;
|
|
16943
16918
|
try {
|
|
16944
|
-
rmSync8(
|
|
16919
|
+
rmSync8(join41(provWorkflowsDir, file));
|
|
16945
16920
|
} catch {
|
|
16946
16921
|
}
|
|
16947
16922
|
}
|
|
@@ -17020,10 +16995,10 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17020
16995
|
}
|
|
17021
16996
|
let lastDriftCheckAt = now;
|
|
17022
16997
|
const written = agentState.writtenHashes.get(agent.agent_id);
|
|
17023
|
-
if (written &&
|
|
16998
|
+
if (written && existsSync19(agentDir)) {
|
|
17024
16999
|
const driftedFiles = [];
|
|
17025
17000
|
for (const [file, expectedHash] of written) {
|
|
17026
|
-
const localHash = hashFile(
|
|
17001
|
+
const localHash = hashFile(join41(agentDir, file));
|
|
17027
17002
|
if (localHash && localHash !== expectedHash) {
|
|
17028
17003
|
driftedFiles.push(file);
|
|
17029
17004
|
}
|
|
@@ -17034,7 +17009,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17034
17009
|
try {
|
|
17035
17010
|
const localHashes = {};
|
|
17036
17011
|
for (const file of driftedFiles) {
|
|
17037
|
-
localHashes[file] = hashFile(
|
|
17012
|
+
localHashes[file] = hashFile(join41(agentDir, file));
|
|
17038
17013
|
}
|
|
17039
17014
|
await api.post("/host/drift", {
|
|
17040
17015
|
agent_id: agent.agent_id,
|
|
@@ -17312,7 +17287,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17312
17287
|
const addedChannels = [...restartDecision.added];
|
|
17313
17288
|
const writeDmNoticeMarkers = isChannelAddRestart ? () => {
|
|
17314
17289
|
try {
|
|
17315
|
-
const agentAugmentedDir =
|
|
17290
|
+
const agentAugmentedDir = join41(homedir17(), ".augmented", agent.code_name);
|
|
17316
17291
|
mkdirSync15(agentAugmentedDir, { recursive: true });
|
|
17317
17292
|
const markerJson = JSON.stringify({
|
|
17318
17293
|
version: 1,
|
|
@@ -17320,7 +17295,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17320
17295
|
added: addedChannels
|
|
17321
17296
|
});
|
|
17322
17297
|
for (const file of ["slack-channel-add-restart.json", "telegram-channel-add-restart.json"]) {
|
|
17323
|
-
atomicWriteFileSync(
|
|
17298
|
+
atomicWriteFileSync(join41(agentAugmentedDir, file), markerJson);
|
|
17324
17299
|
}
|
|
17325
17300
|
} catch (err) {
|
|
17326
17301
|
log(`[hot-reload] channel-add DM-notice marker write failed for '${agent.code_name}' (non-fatal): ${err.message}`);
|
|
@@ -17619,24 +17594,24 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17619
17594
|
if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code") {
|
|
17620
17595
|
try {
|
|
17621
17596
|
const agentProvisionDir = agentDir;
|
|
17622
|
-
const projectDir =
|
|
17597
|
+
const projectDir = join41(homedir17(), ".augmented", agent.code_name, "project");
|
|
17623
17598
|
mkdirSync15(agentProvisionDir, { recursive: true });
|
|
17624
17599
|
mkdirSync15(projectDir, { recursive: true });
|
|
17625
|
-
const provisionMcpPath =
|
|
17626
|
-
const projectMcpPath =
|
|
17600
|
+
const provisionMcpPath = join41(agentProvisionDir, ".mcp.json");
|
|
17601
|
+
const projectMcpPath = join41(projectDir, ".mcp.json");
|
|
17627
17602
|
let mcpConfig = { mcpServers: {} };
|
|
17628
17603
|
try {
|
|
17629
|
-
mcpConfig = JSON.parse(
|
|
17604
|
+
mcpConfig = JSON.parse(readFileSync32(provisionMcpPath, "utf-8"));
|
|
17630
17605
|
if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
|
|
17631
17606
|
} catch {
|
|
17632
17607
|
}
|
|
17633
|
-
const localDirectChatChannel =
|
|
17608
|
+
const localDirectChatChannel = join41(homedir17(), ".augmented", "_mcp", "direct-chat-channel.js");
|
|
17634
17609
|
const directChatTeamSettings = refreshData.team?.settings;
|
|
17635
17610
|
const directChatTz = (() => {
|
|
17636
17611
|
const tz = directChatTeamSettings?.["timezone"];
|
|
17637
17612
|
return typeof tz === "string" && tz.trim() !== "" ? tz.trim() : void 0;
|
|
17638
17613
|
})();
|
|
17639
|
-
if (
|
|
17614
|
+
if (existsSync19(localDirectChatChannel)) {
|
|
17640
17615
|
const directChatEnv = {
|
|
17641
17616
|
AGT_HOST: requireHost(),
|
|
17642
17617
|
// ENG-5901 Track D: templated — the manager exports the real
|
|
@@ -17656,7 +17631,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17656
17631
|
// ~/.augmented/<codeName>/.current-turn-initiator.json. Note getAgentDir
|
|
17657
17632
|
// returns the agent root (NOT the /provision subdir `agentDir` points at),
|
|
17658
17633
|
// so it byte-matches the broker readers' path.
|
|
17659
|
-
AGT_TURN_INITIATOR_FILE:
|
|
17634
|
+
AGT_TURN_INITIATOR_FILE: join41(
|
|
17660
17635
|
frameworkAdapter.getAgentDir(agent.code_name),
|
|
17661
17636
|
".current-turn-initiator.json"
|
|
17662
17637
|
)
|
|
@@ -17676,8 +17651,8 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17676
17651
|
log(`Channel credentials written for '${agent.code_name}/direct-chat'`);
|
|
17677
17652
|
}
|
|
17678
17653
|
}
|
|
17679
|
-
const staleChannelsPath =
|
|
17680
|
-
if (
|
|
17654
|
+
const staleChannelsPath = join41(projectDir, ".mcp-channels.json");
|
|
17655
|
+
if (existsSync19(staleChannelsPath)) {
|
|
17681
17656
|
try {
|
|
17682
17657
|
rmSync8(staleChannelsPath, { force: true });
|
|
17683
17658
|
} catch {
|
|
@@ -17789,7 +17764,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17789
17764
|
}
|
|
17790
17765
|
if (hostFlagStore().getBoolean("connectivity-probe")) {
|
|
17791
17766
|
try {
|
|
17792
|
-
const probeProjectDir =
|
|
17767
|
+
const probeProjectDir = join41(homedir17(), ".augmented", agent.code_name, "project");
|
|
17793
17768
|
let probeSet = integrations;
|
|
17794
17769
|
const fetchQuarantined = async () => {
|
|
17795
17770
|
const quarantined = await api.post("/host/agent-integrations/quarantined", { agent_id: agent.agent_id });
|
|
@@ -17849,7 +17824,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17849
17824
|
const forceDue = attemptsLeft > 0;
|
|
17850
17825
|
let probeRan = false;
|
|
17851
17826
|
try {
|
|
17852
|
-
const probeProjectDir =
|
|
17827
|
+
const probeProjectDir = join41(homedir17(), ".augmented", agent.code_name, "project");
|
|
17853
17828
|
probeRan = await runAgentSessionToolBindProbes(agent, integrations, probeProjectDir, { forceDue });
|
|
17854
17829
|
} catch (err) {
|
|
17855
17830
|
log(`Session-tool-bind probe failed for '${agent.code_name}': ${err.message}`);
|
|
@@ -17926,11 +17901,11 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17926
17901
|
const intHash = computeIntegrationsHash(integrations);
|
|
17927
17902
|
const prevIntHash = agentState.knownIntegrationHashes.get(agent.agent_id);
|
|
17928
17903
|
if (intHash !== prevIntHash) {
|
|
17929
|
-
const projectDir =
|
|
17930
|
-
const envIntPath =
|
|
17904
|
+
const projectDir = join41(homedir17(), ".augmented", agent.code_name, "project");
|
|
17905
|
+
const envIntPath = join41(projectDir, ".env.integrations");
|
|
17931
17906
|
let preWriteEnv;
|
|
17932
17907
|
try {
|
|
17933
|
-
preWriteEnv =
|
|
17908
|
+
preWriteEnv = readFileSync32(envIntPath, "utf-8");
|
|
17934
17909
|
} catch {
|
|
17935
17910
|
preWriteEnv = void 0;
|
|
17936
17911
|
}
|
|
@@ -17949,9 +17924,9 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17949
17924
|
}
|
|
17950
17925
|
if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
|
|
17951
17926
|
try {
|
|
17952
|
-
const projectMcpPath =
|
|
17953
|
-
const postWriteEnv =
|
|
17954
|
-
const mcpContent =
|
|
17927
|
+
const projectMcpPath = join41(projectDir, ".mcp.json");
|
|
17928
|
+
const postWriteEnv = readFileSync32(envIntPath, "utf-8");
|
|
17929
|
+
const mcpContent = readFileSync32(projectMcpPath, "utf-8");
|
|
17955
17930
|
const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
|
|
17956
17931
|
const mcpJsonForReap = JSON.parse(mcpContent);
|
|
17957
17932
|
const affectedServerKeys = findMcpServersUsingVars(mcpJsonForReap, changedVars);
|
|
@@ -18186,16 +18161,6 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18186
18161
|
tasks = tasks.filter((t) => t.template_id !== "kanban-work");
|
|
18187
18162
|
}
|
|
18188
18163
|
if (agent.status === "active") {
|
|
18189
|
-
if (frameworkAdapter.installSkillFiles) {
|
|
18190
|
-
try {
|
|
18191
|
-
const skillContent = getBuiltInSkillContent("kanban");
|
|
18192
|
-
if (skillContent) {
|
|
18193
|
-
frameworkAdapter.installSkillFiles(agent.code_name, "kanban", skillContent);
|
|
18194
|
-
}
|
|
18195
|
-
} catch (err) {
|
|
18196
|
-
log(`Kanban skill install failed for '${agent.code_name}': ${err.message}`);
|
|
18197
|
-
}
|
|
18198
|
-
}
|
|
18199
18164
|
if (frameworkAdapter.installSkillFiles) {
|
|
18200
18165
|
const currentIntegrationSkillIds = /* @__PURE__ */ new Set();
|
|
18201
18166
|
const installedIntegrationSkills = [];
|
|
@@ -18264,14 +18229,14 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18264
18229
|
const frameworkId2 = frameworkAdapter.id;
|
|
18265
18230
|
const candidateSkillDirs = [
|
|
18266
18231
|
// Claude Code — framework runtime tree
|
|
18267
|
-
|
|
18232
|
+
join41(homedir18(), ".augmented", agent.code_name, "skills"),
|
|
18268
18233
|
// Claude Code — project tree
|
|
18269
|
-
|
|
18234
|
+
join41(homedir18(), ".augmented", agent.code_name, "project", ".claude", "skills"),
|
|
18270
18235
|
// Defensive: legacy provision-side path, not currently an
|
|
18271
18236
|
// install target but cheap to sweep.
|
|
18272
|
-
|
|
18237
|
+
join41(agentDir, ".claude", "skills")
|
|
18273
18238
|
];
|
|
18274
|
-
const existingDirs = candidateSkillDirs.filter((d) =>
|
|
18239
|
+
const existingDirs = candidateSkillDirs.filter((d) => existsSync19(d));
|
|
18275
18240
|
const discoveredEntries = /* @__PURE__ */ new Set();
|
|
18276
18241
|
for (const dir of existingDirs) {
|
|
18277
18242
|
try {
|
|
@@ -18290,7 +18255,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18290
18255
|
entry,
|
|
18291
18256
|
dirs: existingDirs,
|
|
18292
18257
|
removeDir: (p) => {
|
|
18293
|
-
if (
|
|
18258
|
+
if (existsSync19(p)) {
|
|
18294
18259
|
rmSync9(p, { recursive: true, force: true });
|
|
18295
18260
|
}
|
|
18296
18261
|
}
|
|
@@ -18312,7 +18277,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18312
18277
|
const sharedSkillsPayload = refreshAny.shared_skills;
|
|
18313
18278
|
const desiredResolved = globalSkillsPayload !== void 0 || sharedSkillsPayload !== void 0;
|
|
18314
18279
|
const manifestPath = managedSkillManifestPath(
|
|
18315
|
-
|
|
18280
|
+
join41(homedir17(), ".augmented", agent.code_name)
|
|
18316
18281
|
);
|
|
18317
18282
|
const prevIds = /* @__PURE__ */ new Set([
|
|
18318
18283
|
...agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
|
|
@@ -18332,15 +18297,15 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18332
18297
|
}
|
|
18333
18298
|
if (plan.removes.length) {
|
|
18334
18299
|
const globalSkillDirs = [
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18300
|
+
join41(homedir17(), ".augmented", agent.code_name, "skills"),
|
|
18301
|
+
join41(homedir17(), ".augmented", agent.code_name, "project", ".claude", "skills"),
|
|
18302
|
+
join41(agentDir, ".claude", "skills")
|
|
18338
18303
|
];
|
|
18339
18304
|
for (const id of plan.removes) {
|
|
18340
18305
|
let prunedAny = false;
|
|
18341
18306
|
for (const dir of globalSkillDirs) {
|
|
18342
|
-
const p =
|
|
18343
|
-
if (
|
|
18307
|
+
const p = join41(dir, id);
|
|
18308
|
+
if (existsSync19(p) && existsSync19(join41(p, "SKILL.md"))) {
|
|
18344
18309
|
rmSync8(p, { recursive: true, force: true });
|
|
18345
18310
|
prunedAny = true;
|
|
18346
18311
|
}
|
|
@@ -18596,8 +18561,8 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18596
18561
|
const sess = getSessionState(agent.code_name);
|
|
18597
18562
|
let mcpJsonParsed = null;
|
|
18598
18563
|
try {
|
|
18599
|
-
const mcpPath =
|
|
18600
|
-
mcpJsonParsed = JSON.parse(
|
|
18564
|
+
const mcpPath = join41(getProjectDir(agent.code_name), ".mcp.json");
|
|
18565
|
+
mcpJsonParsed = JSON.parse(readFileSync32(mcpPath, "utf-8"));
|
|
18601
18566
|
} catch {
|
|
18602
18567
|
}
|
|
18603
18568
|
reapMissingMcpSessions({
|
|
@@ -19068,10 +19033,10 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
|
|
|
19068
19033
|
}
|
|
19069
19034
|
}
|
|
19070
19035
|
const trackedFiles = frameworkAdapter.driftTrackedFiles();
|
|
19071
|
-
if (trackedFiles.length > 0 &&
|
|
19036
|
+
if (trackedFiles.length > 0 && existsSync19(agentDir)) {
|
|
19072
19037
|
const hashes = /* @__PURE__ */ new Map();
|
|
19073
19038
|
for (const file of trackedFiles) {
|
|
19074
|
-
const h = hashFile(
|
|
19039
|
+
const h = hashFile(join41(agentDir, file));
|
|
19075
19040
|
if (h) hashes.set(file, h);
|
|
19076
19041
|
}
|
|
19077
19042
|
agentState.writtenHashes.set(agent.agent_id, hashes);
|
|
@@ -19086,7 +19051,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
|
|
|
19086
19051
|
refreshData.agent.onboarding_state
|
|
19087
19052
|
);
|
|
19088
19053
|
const obStep = obState.step;
|
|
19089
|
-
const markerPath =
|
|
19054
|
+
const markerPath = join41(homedir17(), ".augmented", agent.code_name, "onboarding-drive.json");
|
|
19090
19055
|
const marker = readOnboardingDriveMarker(markerPath);
|
|
19091
19056
|
const obContactRaw = refreshData.agent.manager_last_contacted_at;
|
|
19092
19057
|
const obContact = typeof obContactRaw === "string" && obContactRaw ? obContactRaw : null;
|
|
@@ -19190,7 +19155,7 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
|
|
|
19190
19155
|
}
|
|
19191
19156
|
stopOpencodeSlackIngest(codeName, log);
|
|
19192
19157
|
stopOpencodeTelegramIngest(codeName, log);
|
|
19193
|
-
const opencodeProjectDir =
|
|
19158
|
+
const opencodeProjectDir = join41(getFramework("opencode").getAgentDir(codeName), "provision");
|
|
19194
19159
|
const serveEnv = {
|
|
19195
19160
|
AGT_HOST: requireHost(),
|
|
19196
19161
|
AGT_API_KEY: getApiKey() ?? void 0,
|
|
@@ -19245,8 +19210,8 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
19245
19210
|
});
|
|
19246
19211
|
}
|
|
19247
19212
|
const projectDir = getProjectDir(codeName);
|
|
19248
|
-
const mcpConfigPath =
|
|
19249
|
-
const claudeMdPath =
|
|
19213
|
+
const mcpConfigPath = join41(projectDir, ".mcp.json");
|
|
19214
|
+
const claudeMdPath = join41(projectDir, "CLAUDE.md");
|
|
19250
19215
|
if (restartBreaker.isTripped(codeName)) {
|
|
19251
19216
|
const trip = restartBreaker.getTrip(codeName);
|
|
19252
19217
|
return {
|
|
@@ -20106,7 +20071,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
20106
20071
|
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}`));
|
|
20107
20072
|
void (async () => {
|
|
20108
20073
|
try {
|
|
20109
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
20074
|
+
const { collectDiagnostics } = await import("../persistent-session-JKES3FMW.js");
|
|
20110
20075
|
await api.post("/host/heartbeat", {
|
|
20111
20076
|
host_id: hostId,
|
|
20112
20077
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
|
|
@@ -20152,7 +20117,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
20152
20117
|
}
|
|
20153
20118
|
try {
|
|
20154
20119
|
const hostId = await getHostId();
|
|
20155
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
20120
|
+
const { collectDiagnostics } = await import("../persistent-session-JKES3FMW.js");
|
|
20156
20121
|
await api.post("/host/heartbeat", {
|
|
20157
20122
|
host_id: hostId,
|
|
20158
20123
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
|
|
@@ -20788,7 +20753,7 @@ async function processClaudePairSessions(agents) {
|
|
|
20788
20753
|
killPairSession,
|
|
20789
20754
|
pairTmuxSession,
|
|
20790
20755
|
finalizeClaudePairOnboarding
|
|
20791
|
-
} = await import("../claude-pair-runtime-
|
|
20756
|
+
} = await import("../claude-pair-runtime-BQ5JUW5F.js");
|
|
20792
20757
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
20793
20758
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
20794
20759
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -21018,17 +20983,17 @@ var lastLocalFileHash = /* @__PURE__ */ new Map();
|
|
|
21018
20983
|
var lastMemoriesBody = /* @__PURE__ */ new Map();
|
|
21019
20984
|
var memoryManifests = /* @__PURE__ */ new Map();
|
|
21020
20985
|
function memoryRetirementDir(configDir, codeName) {
|
|
21021
|
-
return
|
|
20986
|
+
return join41(configDir, "_memory-retirement", codeName);
|
|
21022
20987
|
}
|
|
21023
20988
|
function memoryManifestPath(configDir, codeName) {
|
|
21024
|
-
return
|
|
20989
|
+
return join41(memoryRetirementDir(configDir, codeName), "manifest.json");
|
|
21025
20990
|
}
|
|
21026
20991
|
function loadMemoryManifest(agentId, configDir, codeName) {
|
|
21027
20992
|
const cached = memoryManifests.get(agentId);
|
|
21028
20993
|
if (cached) return cached;
|
|
21029
20994
|
let manifest = {};
|
|
21030
20995
|
try {
|
|
21031
|
-
const raw =
|
|
20996
|
+
const raw = readFileSync32(memoryManifestPath(configDir, codeName), "utf-8");
|
|
21032
20997
|
const parsed = JSON.parse(raw);
|
|
21033
20998
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
21034
20999
|
for (const [name, entry] of Object.entries(parsed)) {
|
|
@@ -21056,7 +21021,7 @@ function saveMemoryManifest(agentId, configDir, codeName) {
|
|
|
21056
21021
|
}
|
|
21057
21022
|
}
|
|
21058
21023
|
function retiredMemoryDir(configDir, codeName) {
|
|
21059
|
-
return
|
|
21024
|
+
return join41(memoryRetirementDir(configDir, codeName), "retired");
|
|
21060
21025
|
}
|
|
21061
21026
|
var RETIRED_MEMORY_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
21062
21027
|
var lastRetirementReport = /* @__PURE__ */ new Map();
|
|
@@ -21135,15 +21100,15 @@ function applyMemoryTombstones(opts) {
|
|
|
21135
21100
|
log2(`[memory-retire] ${agent.code_name}: KEPT '${tomb.name}' \u2014 no write record, not ours to remove`);
|
|
21136
21101
|
continue;
|
|
21137
21102
|
}
|
|
21138
|
-
const filePath =
|
|
21139
|
-
if (!
|
|
21103
|
+
const filePath = join41(memoryDir, entry.file);
|
|
21104
|
+
if (!existsSync19(filePath)) {
|
|
21140
21105
|
outcomes.already_gone++;
|
|
21141
21106
|
delete manifest[tomb.name];
|
|
21142
21107
|
manifestDirty = true;
|
|
21143
21108
|
continue;
|
|
21144
21109
|
}
|
|
21145
21110
|
try {
|
|
21146
|
-
const actual = createHash20("sha256").update(
|
|
21111
|
+
const actual = createHash20("sha256").update(readFileSync32(filePath)).digest("hex");
|
|
21147
21112
|
if (actual !== entry.sha) {
|
|
21148
21113
|
outcomes.kept_modified++;
|
|
21149
21114
|
outcomes.unapplied.push({ name: tomb.name, reason: "kept_modified" });
|
|
@@ -21155,9 +21120,9 @@ function applyMemoryTombstones(opts) {
|
|
|
21155
21120
|
const destDir = retiredMemoryDir(configDir, agent.code_name);
|
|
21156
21121
|
mkdirSync15(destDir, { recursive: true });
|
|
21157
21122
|
const stamp = Date.now();
|
|
21158
|
-
let dest =
|
|
21159
|
-
for (let n = 1;
|
|
21160
|
-
dest =
|
|
21123
|
+
let dest = join41(destDir, `${entry.file}.${stamp}.retired`);
|
|
21124
|
+
for (let n = 1; existsSync19(dest); n++) {
|
|
21125
|
+
dest = join41(destDir, `${entry.file}.${stamp}-${n}.retired`);
|
|
21161
21126
|
}
|
|
21162
21127
|
renameSync11(filePath, dest);
|
|
21163
21128
|
try {
|
|
@@ -21190,13 +21155,13 @@ function applyMemoryTombstones(opts) {
|
|
|
21190
21155
|
}
|
|
21191
21156
|
function reapRetiredMemories(configDir, codeName, log2) {
|
|
21192
21157
|
const dir = retiredMemoryDir(configDir, codeName);
|
|
21193
|
-
if (!
|
|
21158
|
+
if (!existsSync19(dir)) return;
|
|
21194
21159
|
const cutoff = Date.now() - RETIRED_MEMORY_TTL_MS;
|
|
21195
21160
|
let reaped = 0;
|
|
21196
21161
|
try {
|
|
21197
21162
|
for (const file of readdirSync12(dir)) {
|
|
21198
21163
|
if (!file.endsWith(".retired")) continue;
|
|
21199
|
-
const path =
|
|
21164
|
+
const path = join41(dir, file);
|
|
21200
21165
|
try {
|
|
21201
21166
|
if (statSync11(path).mtimeMs < cutoff) {
|
|
21202
21167
|
unlinkSync6(path);
|
|
@@ -21211,8 +21176,8 @@ function reapRetiredMemories(configDir, codeName, log2) {
|
|
|
21211
21176
|
if (reaped > 0) log2(`[memory-retire] ${codeName}: reaped ${reaped} retired memory file(s) past TTL`);
|
|
21212
21177
|
}
|
|
21213
21178
|
async function syncMemories(agent, configDir, log2) {
|
|
21214
|
-
const projectDir =
|
|
21215
|
-
const memoryDir =
|
|
21179
|
+
const projectDir = join41(configDir, agent.code_name, "project");
|
|
21180
|
+
const memoryDir = join41(projectDir, "memory");
|
|
21216
21181
|
const isFreshSync = pendingFreshMemorySync.has(agent.agent_id);
|
|
21217
21182
|
if (isFreshSync) {
|
|
21218
21183
|
log2(`[memory-sync] Fresh-sync requested for '${agent.code_name}' \u2014 pulling DB first`);
|
|
@@ -21236,14 +21201,14 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
21236
21201
|
}
|
|
21237
21202
|
pendingFreshMemorySync.delete(agent.agent_id);
|
|
21238
21203
|
}
|
|
21239
|
-
if (
|
|
21204
|
+
if (existsSync19(memoryDir)) {
|
|
21240
21205
|
const prevHashes = memoryFileHashes.get(agent.agent_id) ?? /* @__PURE__ */ new Map();
|
|
21241
21206
|
const currentHashes = /* @__PURE__ */ new Map();
|
|
21242
21207
|
const changedMemories = [];
|
|
21243
21208
|
for (const file of readdirSync12(memoryDir)) {
|
|
21244
21209
|
if (!file.endsWith(".md")) continue;
|
|
21245
21210
|
try {
|
|
21246
|
-
const raw =
|
|
21211
|
+
const raw = readFileSync32(join41(memoryDir, file), "utf-8");
|
|
21247
21212
|
const fileHash = createHash20("sha256").update(raw).digest("hex").slice(0, 16);
|
|
21248
21213
|
currentHashes.set(file, fileHash);
|
|
21249
21214
|
if (prevHashes.get(file) === fileHash) continue;
|
|
@@ -21268,7 +21233,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
21268
21233
|
} catch (err) {
|
|
21269
21234
|
for (const mem of changedMemories) {
|
|
21270
21235
|
for (const [file] of currentHashes) {
|
|
21271
|
-
const parsed = parseMemoryFile(
|
|
21236
|
+
const parsed = parseMemoryFile(readFileSync32(join41(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
|
|
21272
21237
|
if (parsed?.name === mem.name) currentHashes.delete(file);
|
|
21273
21238
|
}
|
|
21274
21239
|
}
|
|
@@ -21294,7 +21259,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
21294
21259
|
}
|
|
21295
21260
|
}
|
|
21296
21261
|
async function downloadMemories(agent, memoryDir, log2, { force, configDir }) {
|
|
21297
|
-
const localFiles =
|
|
21262
|
+
const localFiles = existsSync19(memoryDir) ? readdirSync12(memoryDir).filter((f) => f.endsWith(".md")).sort() : [];
|
|
21298
21263
|
const localListHash = createHash20("sha256").update(localFiles.join(",")).digest("hex").slice(0, 16);
|
|
21299
21264
|
const prevLocalHash = lastLocalFileHash.get(agent.agent_id);
|
|
21300
21265
|
const prevDownload = lastDownloadHash.get(agent.agent_id);
|
|
@@ -21349,7 +21314,7 @@ async function downloadMemories(agent, memoryDir, log2, { force, configDir }) {
|
|
|
21349
21314
|
// Per-agent, not host-wide: memories are agent-private, so a shared
|
|
21350
21315
|
// store would buy almost no dedupe while exposing one agent's content
|
|
21351
21316
|
// to every other agent on the host. See memory-cache.ts's header.
|
|
21352
|
-
cacheDir:
|
|
21317
|
+
cacheDir: join41(configDir, agent.code_name, "_memory_bodies"),
|
|
21353
21318
|
fetchContents: async (hashes) => {
|
|
21354
21319
|
const res = await api.post(
|
|
21355
21320
|
"/host/memories/contents",
|
|
@@ -21387,7 +21352,7 @@ async function downloadMemories(agent, memoryDir, log2, { force, configDir }) {
|
|
|
21387
21352
|
const rawSlug = mem.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "").slice(0, 60);
|
|
21388
21353
|
const slug = rawSlug || `memory-${i}`;
|
|
21389
21354
|
const fileName = `${slug}.md`;
|
|
21390
|
-
const filePath =
|
|
21355
|
+
const filePath = join41(memoryDir, fileName);
|
|
21391
21356
|
const desired = `---
|
|
21392
21357
|
name: ${JSON.stringify(mem.name)}
|
|
21393
21358
|
type: ${mem.type}
|
|
@@ -21404,10 +21369,10 @@ ${mem.content}
|
|
|
21404
21369
|
return true;
|
|
21405
21370
|
};
|
|
21406
21371
|
let manifestDirty = false;
|
|
21407
|
-
if (
|
|
21372
|
+
if (existsSync19(filePath)) {
|
|
21408
21373
|
let existing = "";
|
|
21409
21374
|
try {
|
|
21410
|
-
existing =
|
|
21375
|
+
existing = readFileSync32(filePath, "utf-8");
|
|
21411
21376
|
} catch {
|
|
21412
21377
|
}
|
|
21413
21378
|
if (existing === desired) {
|
|
@@ -21437,7 +21402,7 @@ ${mem.content}
|
|
|
21437
21402
|
}
|
|
21438
21403
|
}
|
|
21439
21404
|
async function cleanupAgentFiles(codeName, agentDir) {
|
|
21440
|
-
if (
|
|
21405
|
+
if (existsSync19(agentDir)) {
|
|
21441
21406
|
try {
|
|
21442
21407
|
rmSync8(agentDir, { recursive: true, force: true });
|
|
21443
21408
|
log(`Removed provision directory for '${codeName}'`);
|
|
@@ -21707,8 +21672,8 @@ function startManager(opts) {
|
|
|
21707
21672
|
config = opts;
|
|
21708
21673
|
try {
|
|
21709
21674
|
const stateFile = getStateFile();
|
|
21710
|
-
if (
|
|
21711
|
-
const raw =
|
|
21675
|
+
if (existsSync19(stateFile)) {
|
|
21676
|
+
const raw = readFileSync32(stateFile, "utf-8");
|
|
21712
21677
|
const parsed = JSON.parse(raw);
|
|
21713
21678
|
if (Array.isArray(parsed.agents)) {
|
|
21714
21679
|
state8.agents = parsed.agents;
|
|
@@ -21735,7 +21700,7 @@ function startManager(opts) {
|
|
|
21735
21700
|
log(`[startup] state rehydration failed (continuing with empty state): ${err.message}`);
|
|
21736
21701
|
}
|
|
21737
21702
|
log(
|
|
21738
|
-
`[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${
|
|
21703
|
+
`[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join41(homedir17(), ".augmented", "manager.log")}`
|
|
21739
21704
|
);
|
|
21740
21705
|
deployMcpAssets();
|
|
21741
21706
|
reapOrphanChannelMcps({ log });
|
|
@@ -21764,7 +21729,7 @@ async function reapOrphanedClaudePids() {
|
|
|
21764
21729
|
const looksLikeClaude = (pid) => {
|
|
21765
21730
|
if (process.platform !== "linux") return true;
|
|
21766
21731
|
try {
|
|
21767
|
-
const comm =
|
|
21732
|
+
const comm = readFileSync32(`/proc/${pid}/comm`, "utf-8").trim().toLowerCase();
|
|
21768
21733
|
return comm.includes("claude");
|
|
21769
21734
|
} catch {
|
|
21770
21735
|
return false;
|
|
@@ -21861,14 +21826,14 @@ function restartRunningChannelMcps(basenames) {
|
|
|
21861
21826
|
}
|
|
21862
21827
|
}
|
|
21863
21828
|
function deployMcpAssets() {
|
|
21864
|
-
const targetDir =
|
|
21829
|
+
const targetDir = join41(homedir17(), ".augmented", "_mcp");
|
|
21865
21830
|
mkdirSync15(targetDir, { recursive: true });
|
|
21866
21831
|
const moduleDir = dirname11(fileURLToPath2(import.meta.url));
|
|
21867
21832
|
let mcpSourceDir = "";
|
|
21868
21833
|
let dir = moduleDir;
|
|
21869
21834
|
for (let i = 0; i < 6; i++) {
|
|
21870
|
-
const candidate =
|
|
21871
|
-
if (
|
|
21835
|
+
const candidate = join41(dir, "dist", "mcp");
|
|
21836
|
+
if (existsSync19(join41(candidate, "index.js"))) {
|
|
21872
21837
|
mcpSourceDir = candidate;
|
|
21873
21838
|
break;
|
|
21874
21839
|
}
|
|
@@ -21885,8 +21850,8 @@ function deployMcpAssets() {
|
|
|
21885
21850
|
const failedFiles = [];
|
|
21886
21851
|
const fileHash = (p) => {
|
|
21887
21852
|
try {
|
|
21888
|
-
if (!
|
|
21889
|
-
return createHash20("sha256").update(
|
|
21853
|
+
if (!existsSync19(p)) return null;
|
|
21854
|
+
return createHash20("sha256").update(readFileSync32(p)).digest("hex");
|
|
21890
21855
|
} catch {
|
|
21891
21856
|
return null;
|
|
21892
21857
|
}
|
|
@@ -21957,9 +21922,9 @@ function deployMcpAssets() {
|
|
|
21957
21922
|
// needs restarting to pick up a token rotation.
|
|
21958
21923
|
"xero.js"
|
|
21959
21924
|
]) {
|
|
21960
|
-
const src =
|
|
21961
|
-
const dst =
|
|
21962
|
-
if (!
|
|
21925
|
+
const src = join41(mcpSourceDir, file);
|
|
21926
|
+
const dst = join41(targetDir, file);
|
|
21927
|
+
if (!existsSync19(src)) continue;
|
|
21963
21928
|
attemptedFiles.push(file);
|
|
21964
21929
|
const before = fileHash(dst);
|
|
21965
21930
|
try {
|
|
@@ -21984,16 +21949,16 @@ function deployMcpAssets() {
|
|
|
21984
21949
|
log(`[manager] Bundle(s) updated: ${changedBasenames.join(", ")} \u2014 signalling running instances to restart`);
|
|
21985
21950
|
restartRunningChannelMcps(changedBasenames);
|
|
21986
21951
|
}
|
|
21987
|
-
const localMcpPath =
|
|
21952
|
+
const localMcpPath = join41(targetDir, "index.js");
|
|
21988
21953
|
try {
|
|
21989
|
-
const agentsDir =
|
|
21990
|
-
if (
|
|
21954
|
+
const agentsDir = join41(homedir17(), ".augmented", "agents");
|
|
21955
|
+
if (existsSync19(agentsDir)) {
|
|
21991
21956
|
for (const entry of readdirSync12(agentsDir, { withFileTypes: true })) {
|
|
21992
21957
|
if (!entry.isDirectory()) continue;
|
|
21993
21958
|
for (const subdir of ["provision", "project"]) {
|
|
21994
|
-
const mcpJsonPath =
|
|
21959
|
+
const mcpJsonPath = join41(agentsDir, entry.name, subdir, ".mcp.json");
|
|
21995
21960
|
try {
|
|
21996
|
-
const raw =
|
|
21961
|
+
const raw = readFileSync32(mcpJsonPath, "utf-8");
|
|
21997
21962
|
if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
|
|
21998
21963
|
const mcpConfig = JSON.parse(raw);
|
|
21999
21964
|
const augServer = mcpConfig.mcpServers?.["augmented"];
|