@integrity-labs/agt-cli 0.28.5 → 0.28.7
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 +4 -4
- package/dist/{chunk-NS4G4HHD.js → chunk-CHUL4CPY.js} +11 -1
- package/dist/{chunk-NS4G4HHD.js.map → chunk-CHUL4CPY.js.map} +1 -1
- package/dist/{chunk-LIB6VTH3.js → chunk-QG553V7F.js} +2 -2
- package/dist/{chunk-4DTVE2UF.js → chunk-QHW6NHCZ.js} +2 -2
- package/dist/{claude-pair-runtime-OACH27NE.js → claude-pair-runtime-KOXXDT6B.js} +2 -2
- package/dist/lib/manager-worker.js +153 -138
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +141 -4
- package/dist/mcp/slack-channel.js +39 -0
- package/dist/mcp/telegram-channel.js +39 -0
- package/dist/{persistent-session-DSG4HI4R.js → persistent-session-S6H3P6WD.js} +3 -3
- package/dist/{responsiveness-probe-GX5W4ZMI.js → responsiveness-probe-6BLLBJB4.js} +5 -3
- package/dist/responsiveness-probe-6BLLBJB4.js.map +1 -0
- package/package.json +1 -1
- package/dist/responsiveness-probe-GX5W4ZMI.js.map +0 -1
- /package/dist/{chunk-LIB6VTH3.js.map → chunk-QG553V7F.js.map} +0 -0
- /package/dist/{chunk-4DTVE2UF.js.map → chunk-QHW6NHCZ.js.map} +0 -0
- /package/dist/{claude-pair-runtime-OACH27NE.js.map → claude-pair-runtime-KOXXDT6B.js.map} +0 -0
- /package/dist/{persistent-session-DSG4HI4R.js.map → persistent-session-S6H3P6WD.js.map} +0 -0
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
provisionStopHook,
|
|
23
23
|
requireHost,
|
|
24
24
|
safeWriteJsonAtomic
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-QHW6NHCZ.js";
|
|
26
26
|
import {
|
|
27
27
|
getProjectDir as getProjectDir2,
|
|
28
28
|
getReadyTasks,
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
takeWatchdogGiveUpCount,
|
|
65
65
|
takeZombieDetection,
|
|
66
66
|
transcriptActivityAgeSeconds
|
|
67
|
-
} from "../chunk-
|
|
67
|
+
} from "../chunk-QG553V7F.js";
|
|
68
68
|
import {
|
|
69
69
|
FLAGS_SCHEMA_VERSION,
|
|
70
70
|
KANBAN_CHECK_COMMAND,
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
sumTranscriptUsageInWindow,
|
|
97
97
|
worseConnectivityOutcome,
|
|
98
98
|
wrapScheduledTaskPrompt
|
|
99
|
-
} from "../chunk-
|
|
99
|
+
} from "../chunk-CHUL4CPY.js";
|
|
100
100
|
import {
|
|
101
101
|
parsePsRows,
|
|
102
102
|
reapOrphanChannelMcps
|
|
@@ -107,7 +107,7 @@ import { createHash as createHash3 } from "crypto";
|
|
|
107
107
|
import { readFileSync as readFileSync10, writeFileSync as writeFileSync4, appendFileSync, mkdirSync as mkdirSync3, chmodSync, existsSync as existsSync5, rmSync as rmSync2, readdirSync as readdirSync5, statSync as statSync4, unlinkSync, copyFileSync } from "fs";
|
|
108
108
|
import https from "https";
|
|
109
109
|
import { execFileSync as syncExecFile } from "child_process";
|
|
110
|
-
import { join as
|
|
110
|
+
import { join as join11, dirname as dirname2 } from "path";
|
|
111
111
|
import { homedir as homedir5 } from "os";
|
|
112
112
|
import { fileURLToPath } from "url";
|
|
113
113
|
|
|
@@ -1573,6 +1573,7 @@ function formatReaperBootLine(opts) {
|
|
|
1573
1573
|
}
|
|
1574
1574
|
|
|
1575
1575
|
// src/lib/direct-chat-spawn-gate.ts
|
|
1576
|
+
import { join as join2 } from "path";
|
|
1576
1577
|
var DEFAULT_DIRECT_CHAT_HOST_CONCURRENCY = 2;
|
|
1577
1578
|
var DEFAULT_DIRECT_CHAT_PER_AGENT_CONCURRENCY = 1;
|
|
1578
1579
|
var DEFAULT_DIRECT_CHAT_MAX_AGE_MS = 30 * 6e4;
|
|
@@ -1584,6 +1585,9 @@ function directChatMaxAgeMs() {
|
|
|
1584
1585
|
const raw = parseInt(process.env["AGT_DIRECT_CHAT_MAX_AGE_MS"] ?? "", 10);
|
|
1585
1586
|
return Number.isFinite(raw) && raw >= 0 ? raw : DEFAULT_DIRECT_CHAT_MAX_AGE_MS;
|
|
1586
1587
|
}
|
|
1588
|
+
function directChatDoorbellPath(agentId, home) {
|
|
1589
|
+
return join2(home, ".augmented", agentId, "direct-chat-doorbell");
|
|
1590
|
+
}
|
|
1587
1591
|
function isDirectChatMessageExpired(createdAt, nowMs, maxAgeMs) {
|
|
1588
1592
|
if (!maxAgeMs || maxAgeMs <= 0) return false;
|
|
1589
1593
|
if (!createdAt) return false;
|
|
@@ -1659,7 +1663,7 @@ var DirectChatSpawnGate = class {
|
|
|
1659
1663
|
};
|
|
1660
1664
|
|
|
1661
1665
|
// src/lib/artifact-stream.ts
|
|
1662
|
-
import { join as
|
|
1666
|
+
import { join as join3 } from "path";
|
|
1663
1667
|
import { homedir } from "os";
|
|
1664
1668
|
import { readdir, stat, readFile } from "fs/promises";
|
|
1665
1669
|
var ARTEFACT_ENTRY_FILE = "index.html";
|
|
@@ -1745,7 +1749,7 @@ var ArtifactStreamScanner = class {
|
|
|
1745
1749
|
return;
|
|
1746
1750
|
}
|
|
1747
1751
|
for (const name of names) {
|
|
1748
|
-
const file =
|
|
1752
|
+
const file = join3(this.artifactsDir, name, ARTEFACT_ENTRY_FILE);
|
|
1749
1753
|
const mtime = await this.fsDeps.mtimeMs(file).catch(() => null);
|
|
1750
1754
|
if (mtime === null) continue;
|
|
1751
1755
|
if (this.seenMtime.get(name) === mtime) continue;
|
|
@@ -1776,7 +1780,7 @@ var ArtifactStreamScanner = class {
|
|
|
1776
1780
|
}
|
|
1777
1781
|
};
|
|
1778
1782
|
function artifactsDirFor(codeName) {
|
|
1779
|
-
return
|
|
1783
|
+
return join3(homedir(), ".augmented", codeName, "artifacts");
|
|
1780
1784
|
}
|
|
1781
1785
|
var nodeArtifactFs = {
|
|
1782
1786
|
async listArtefactNames(artifactsDir) {
|
|
@@ -1852,7 +1856,7 @@ async function maybeReportUsageBanner(args) {
|
|
|
1852
1856
|
|
|
1853
1857
|
// src/lib/token-usage-monitor.ts
|
|
1854
1858
|
import { readdirSync, readFileSync as readFileSync4, statSync } from "fs";
|
|
1855
|
-
import { join as
|
|
1859
|
+
import { join as join4 } from "path";
|
|
1856
1860
|
var MIN_CHECK_INTERVAL_MS2 = 6e4;
|
|
1857
1861
|
var TRANSCRIPT_MTIME_WINDOW_MS = 2 * 24 * 60 * 60 * 1e3;
|
|
1858
1862
|
var MAX_ENTRIES_PER_POST = 200;
|
|
@@ -1881,7 +1885,7 @@ async function maybeReportTokenUsage(args) {
|
|
|
1881
1885
|
if (!name.endsWith(".jsonl")) continue;
|
|
1882
1886
|
const sessionId = name.slice(0, -".jsonl".length);
|
|
1883
1887
|
if (!sessionId) continue;
|
|
1884
|
-
const path =
|
|
1888
|
+
const path = join4(dir, name);
|
|
1885
1889
|
let st;
|
|
1886
1890
|
try {
|
|
1887
1891
|
st = statSync(path);
|
|
@@ -1979,7 +1983,7 @@ async function maybeReportTokenUsage(args) {
|
|
|
1979
1983
|
|
|
1980
1984
|
// src/lib/workflow-run-reconciler.ts
|
|
1981
1985
|
import { readdirSync as readdirSync2, readFileSync as readFileSync5, statSync as statSync2 } from "fs";
|
|
1982
|
-
import { join as
|
|
1986
|
+
import { join as join5 } from "path";
|
|
1983
1987
|
var MIN_CHECK_INTERVAL_MS3 = 5 * 6e4;
|
|
1984
1988
|
var SETTLE_MS = 3e4;
|
|
1985
1989
|
var TRANSCRIPT_MTIME_WINDOW_MS2 = 2 * 24 * 60 * 60 * 1e3;
|
|
@@ -1998,7 +2002,7 @@ function collectJsonlRecursive(dir, minMtimeMs, out, depth) {
|
|
|
1998
2002
|
return;
|
|
1999
2003
|
}
|
|
2000
2004
|
for (const name of entries) {
|
|
2001
|
-
const p =
|
|
2005
|
+
const p = join5(dir, name);
|
|
2002
2006
|
let st;
|
|
2003
2007
|
try {
|
|
2004
2008
|
st = statSync2(p);
|
|
@@ -2021,7 +2025,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
|
|
|
2021
2025
|
return out;
|
|
2022
2026
|
}
|
|
2023
2027
|
for (const name of entries) {
|
|
2024
|
-
const path =
|
|
2028
|
+
const path = join5(transcriptDir, name);
|
|
2025
2029
|
let st;
|
|
2026
2030
|
try {
|
|
2027
2031
|
st = statSync2(path);
|
|
@@ -2033,7 +2037,7 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
|
|
|
2033
2037
|
continue;
|
|
2034
2038
|
}
|
|
2035
2039
|
if (st.isDirectory()) {
|
|
2036
|
-
collectJsonlRecursive(
|
|
2040
|
+
collectJsonlRecursive(join5(path, "subagents"), minMtimeMs, out, 0);
|
|
2037
2041
|
}
|
|
2038
2042
|
}
|
|
2039
2043
|
return out;
|
|
@@ -2124,7 +2128,7 @@ async function maybeReconcileWorkflowRunTokens(args) {
|
|
|
2124
2128
|
|
|
2125
2129
|
// src/lib/conversation-evaluator.ts
|
|
2126
2130
|
import { readdirSync as readdirSync3, readFileSync as readFileSync6, statSync as statSync3 } from "fs";
|
|
2127
|
-
import { join as
|
|
2131
|
+
import { join as join6 } from "path";
|
|
2128
2132
|
var MIN_CHECK_INTERVAL_MS4 = 5 * 6e4;
|
|
2129
2133
|
var TRANSCRIPT_MTIME_WINDOW_MS3 = 3 * 24 * 60 * 60 * 1e3;
|
|
2130
2134
|
var WINDOW_PAD_MS = 5 * 6e4;
|
|
@@ -2361,7 +2365,7 @@ function readRecentTurns(dir, nowMs) {
|
|
|
2361
2365
|
const turns = [];
|
|
2362
2366
|
for (const name of entries) {
|
|
2363
2367
|
if (!name.endsWith(".jsonl")) continue;
|
|
2364
|
-
const full =
|
|
2368
|
+
const full = join6(dir, name);
|
|
2365
2369
|
let mtimeMs;
|
|
2366
2370
|
try {
|
|
2367
2371
|
mtimeMs = statSync3(full).mtimeMs;
|
|
@@ -2542,9 +2546,9 @@ async function reportSkip2(api2, agentId, conversationId, log2, codeName) {
|
|
|
2542
2546
|
// src/lib/activity-cache-monitor.ts
|
|
2543
2547
|
import { existsSync as existsSync2, readFileSync as readFileSync7 } from "fs";
|
|
2544
2548
|
import { homedir as homedir2 } from "os";
|
|
2545
|
-
import { join as
|
|
2549
|
+
import { join as join7 } from "path";
|
|
2546
2550
|
var MIN_CHECK_INTERVAL_MS6 = 6e4;
|
|
2547
|
-
var STATS_CACHE_PATH =
|
|
2551
|
+
var STATS_CACHE_PATH = join7(homedir2(), ".claude", "stats-cache.json");
|
|
2548
2552
|
var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
2549
2553
|
var state5 = { lastObservedDate: null, lastCheckedAt: 0 };
|
|
2550
2554
|
function selectNewDailyRows(raw, lastObservedDate) {
|
|
@@ -3042,7 +3046,7 @@ var GatewayClientPool = class extends EventEmitter {
|
|
|
3042
3046
|
// src/lib/claude-auth-detect.ts
|
|
3043
3047
|
import { readFile as readFile2, readdir as readdir2 } from "fs/promises";
|
|
3044
3048
|
import { homedir as homedir3, platform } from "os";
|
|
3045
|
-
import { join as
|
|
3049
|
+
import { join as join8 } from "path";
|
|
3046
3050
|
import { execFile as execFile2 } from "child_process";
|
|
3047
3051
|
import { promisify } from "util";
|
|
3048
3052
|
var execFileAsync = promisify(execFile2);
|
|
@@ -3057,8 +3061,8 @@ async function detectClaudeAuth() {
|
|
|
3057
3061
|
}
|
|
3058
3062
|
async function findClaudeCredentialsPaths() {
|
|
3059
3063
|
const candidates = [
|
|
3060
|
-
|
|
3061
|
-
|
|
3064
|
+
join8(homedir3(), ".claude", ".credentials.json"),
|
|
3065
|
+
join8(homedir3(), ".claude", "credentials.json")
|
|
3062
3066
|
];
|
|
3063
3067
|
const isLinuxRoot = platform() === "linux" && typeof process.getuid === "function" && process.getuid() === 0;
|
|
3064
3068
|
if (isLinuxRoot) {
|
|
@@ -3066,8 +3070,8 @@ async function findClaudeCredentialsPaths() {
|
|
|
3066
3070
|
const entries = await readdir2("/home", { withFileTypes: true });
|
|
3067
3071
|
for (const entry of entries) {
|
|
3068
3072
|
if (!entry.isDirectory()) continue;
|
|
3069
|
-
candidates.push(
|
|
3070
|
-
candidates.push(
|
|
3073
|
+
candidates.push(join8("/home", entry.name, ".claude", ".credentials.json"));
|
|
3074
|
+
candidates.push(join8("/home", entry.name, ".claude", "credentials.json"));
|
|
3071
3075
|
}
|
|
3072
3076
|
} catch {
|
|
3073
3077
|
}
|
|
@@ -3160,10 +3164,10 @@ function normalize(value) {
|
|
|
3160
3164
|
|
|
3161
3165
|
// src/lib/channel-hash-cache.ts
|
|
3162
3166
|
import { existsSync as existsSync3, readFileSync as readFileSync8, writeFileSync as writeFileSync2 } from "fs";
|
|
3163
|
-
import { join as
|
|
3167
|
+
import { join as join9 } from "path";
|
|
3164
3168
|
var CACHE_FILENAME = "channel-hash-cache.json";
|
|
3165
3169
|
function getChannelHashCacheFile(configDir) {
|
|
3166
|
-
return
|
|
3170
|
+
return join9(configDir, CACHE_FILENAME);
|
|
3167
3171
|
}
|
|
3168
3172
|
function loadChannelHashCache(target, configDir) {
|
|
3169
3173
|
const path = getChannelHashCacheFile(configDir);
|
|
@@ -3811,13 +3815,13 @@ function partitionActionableByPoison(actionable, states, config2) {
|
|
|
3811
3815
|
// src/lib/restart-flags.ts
|
|
3812
3816
|
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readdirSync as readdirSync4, readFileSync as readFileSync9, renameSync, rmSync, writeFileSync as writeFileSync3 } from "fs";
|
|
3813
3817
|
import { homedir as homedir4 } from "os";
|
|
3814
|
-
import { join as
|
|
3818
|
+
import { join as join10 } from "path";
|
|
3815
3819
|
import { randomUUID } from "crypto";
|
|
3816
3820
|
function restartFlagsDir() {
|
|
3817
|
-
return
|
|
3821
|
+
return join10(homedir4(), ".augmented", "restart-flags");
|
|
3818
3822
|
}
|
|
3819
3823
|
function flagPath(codeName) {
|
|
3820
|
-
return
|
|
3824
|
+
return join10(restartFlagsDir(), `${codeName}.flag`);
|
|
3821
3825
|
}
|
|
3822
3826
|
function readRestartFlags() {
|
|
3823
3827
|
const dir = restartFlagsDir();
|
|
@@ -3826,7 +3830,7 @@ function readRestartFlags() {
|
|
|
3826
3830
|
for (const entry of readdirSync4(dir)) {
|
|
3827
3831
|
if (!entry.endsWith(".flag")) continue;
|
|
3828
3832
|
try {
|
|
3829
|
-
const raw = readFileSync9(
|
|
3833
|
+
const raw = readFileSync9(join10(dir, entry), "utf8");
|
|
3830
3834
|
const parsed = JSON.parse(raw);
|
|
3831
3835
|
if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
|
|
3832
3836
|
parsed.codeName = entry.replace(/\.flag$/, "");
|
|
@@ -4374,8 +4378,8 @@ function applyRestartAcks(args) {
|
|
|
4374
4378
|
var GATEWAY_PORT_BASE = 18800;
|
|
4375
4379
|
var GATEWAY_PORT_STEP = 10;
|
|
4376
4380
|
var GATEWAY_PORT_MAX = 18899;
|
|
4377
|
-
var AUGMENTED_DIR =
|
|
4378
|
-
var GATEWAY_PORTS_FILE =
|
|
4381
|
+
var AUGMENTED_DIR = join11(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
4382
|
+
var GATEWAY_PORTS_FILE = join11(AUGMENTED_DIR, "gateway-ports.json");
|
|
4379
4383
|
var CHANNEL_SWEEP_INTERVAL_MS = (() => {
|
|
4380
4384
|
const raw = parseInt(process.env["AGT_CHANNEL_SWEEP_INTERVAL_MS"] ?? "", 10);
|
|
4381
4385
|
if (!Number.isFinite(raw)) return 5 * 60 * 1e3;
|
|
@@ -4750,7 +4754,7 @@ var runningMcpServerKeys = /* @__PURE__ */ new Map();
|
|
|
4750
4754
|
var runningChannelSecretHashes = /* @__PURE__ */ new Map();
|
|
4751
4755
|
function projectMcpHash(_codeName, projectDir) {
|
|
4752
4756
|
try {
|
|
4753
|
-
const raw = readFileSync10(
|
|
4757
|
+
const raw = readFileSync10(join11(projectDir, ".mcp.json"), "utf-8");
|
|
4754
4758
|
return createHash3("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
|
|
4755
4759
|
} catch {
|
|
4756
4760
|
return null;
|
|
@@ -4758,7 +4762,7 @@ function projectMcpHash(_codeName, projectDir) {
|
|
|
4758
4762
|
}
|
|
4759
4763
|
function projectMcpKeys(_codeName, projectDir) {
|
|
4760
4764
|
try {
|
|
4761
|
-
const raw = readFileSync10(
|
|
4765
|
+
const raw = readFileSync10(join11(projectDir, ".mcp.json"), "utf-8");
|
|
4762
4766
|
const parsed = JSON.parse(raw);
|
|
4763
4767
|
const servers = parsed.mcpServers;
|
|
4764
4768
|
if (!servers || typeof servers !== "object") return /* @__PURE__ */ new Set();
|
|
@@ -4769,7 +4773,7 @@ function projectMcpKeys(_codeName, projectDir) {
|
|
|
4769
4773
|
}
|
|
4770
4774
|
function readMcpHttpServerConfig(projectDir, serverKey, env) {
|
|
4771
4775
|
try {
|
|
4772
|
-
const raw = readFileSync10(
|
|
4776
|
+
const raw = readFileSync10(join11(projectDir, ".mcp.json"), "utf-8");
|
|
4773
4777
|
const servers = JSON.parse(raw).mcpServers ?? {};
|
|
4774
4778
|
const entry = servers[serverKey];
|
|
4775
4779
|
if (entry && typeof entry.url === "string" && (entry.type === "http" || entry.type === void 0)) {
|
|
@@ -4797,7 +4801,7 @@ async function runAgentConnectivityProbes(agent, integrations, projectDir) {
|
|
|
4797
4801
|
if (integrations.length === 0) return;
|
|
4798
4802
|
const probeEnv = { ...process.env };
|
|
4799
4803
|
try {
|
|
4800
|
-
const envIntPath =
|
|
4804
|
+
const envIntPath = join11(projectDir, ".env.integrations");
|
|
4801
4805
|
if (existsSync5(envIntPath)) {
|
|
4802
4806
|
Object.assign(probeEnv, parseEnvIntegrations(readFileSync10(envIntPath, "utf-8")));
|
|
4803
4807
|
}
|
|
@@ -4987,7 +4991,7 @@ function checkMcpConfigDriftAndScheduleRestart(codeName, projectDir) {
|
|
|
4987
4991
|
function projectChannelSecretHash(projectDir) {
|
|
4988
4992
|
try {
|
|
4989
4993
|
const entries = parseEnvIntegrations(
|
|
4990
|
-
readFileSync10(
|
|
4994
|
+
readFileSync10(join11(projectDir, ".env.integrations"), "utf-8")
|
|
4991
4995
|
);
|
|
4992
4996
|
return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
|
|
4993
4997
|
} catch {
|
|
@@ -5079,7 +5083,7 @@ var cachedMaintenanceWindow = null;
|
|
|
5079
5083
|
var lastVersionCheckAt = 0;
|
|
5080
5084
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
5081
5085
|
var lastResponsivenessProbeAt = 0;
|
|
5082
|
-
var agtCliVersion = true ? "0.28.
|
|
5086
|
+
var agtCliVersion = true ? "0.28.7" : "dev";
|
|
5083
5087
|
function resolveBrewPath(execFileSync4) {
|
|
5084
5088
|
try {
|
|
5085
5089
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -5330,7 +5334,7 @@ async function ensureFrameworkBinary(frameworkId) {
|
|
|
5330
5334
|
var CLAUDE_CODE_UPGRADE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
5331
5335
|
var claudeCodeUpgradeInFlight = false;
|
|
5332
5336
|
function claudeCodeUpgradeMarkerPath() {
|
|
5333
|
-
return
|
|
5337
|
+
return join11(homedir5(), ".augmented", ".last-claude-code-upgrade-check");
|
|
5334
5338
|
}
|
|
5335
5339
|
function stampClaudeCodeUpgradeMarker() {
|
|
5336
5340
|
try {
|
|
@@ -5393,7 +5397,7 @@ ${r.stderr}`;
|
|
|
5393
5397
|
}
|
|
5394
5398
|
var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
5395
5399
|
function selfUpdateAppliedMarkerPath() {
|
|
5396
|
-
return
|
|
5400
|
+
return join11(homedir5(), ".augmented", ".last-self-update-applied");
|
|
5397
5401
|
}
|
|
5398
5402
|
var selfUpdateUpToDateLogged = false;
|
|
5399
5403
|
var restartAfterUpgrade = false;
|
|
@@ -5416,7 +5420,7 @@ async function checkAndUpdateCli() {
|
|
|
5416
5420
|
const isNpmGlobal = !isBrewFormula && resolvedPath.includes("node_modules");
|
|
5417
5421
|
if (!isBrewFormula && !isNpmGlobal) return;
|
|
5418
5422
|
const { readFileSync: readF, writeFileSync: writeF } = await import("fs");
|
|
5419
|
-
const markerPath =
|
|
5423
|
+
const markerPath = join11(homedir5(), ".augmented", ".last-update-check");
|
|
5420
5424
|
try {
|
|
5421
5425
|
const lastCheck = parseInt(readF(markerPath, "utf-8").trim(), 10);
|
|
5422
5426
|
if (Date.now() - lastCheck < UPDATE_CHECK_INTERVAL_MS) return;
|
|
@@ -5682,9 +5686,9 @@ async function applyClaudeAuthToEnv(childEnv, label) {
|
|
|
5682
5686
|
throw new Error("claude_auth_mode=api_key but /host/exchange returned no decrypted key");
|
|
5683
5687
|
}
|
|
5684
5688
|
childEnv.ANTHROPIC_API_KEY = exchange.anthropicApiKey;
|
|
5685
|
-
const claudeDir =
|
|
5689
|
+
const claudeDir = join11(homedir5(), ".claude");
|
|
5686
5690
|
for (const filename of [".credentials.json", "credentials.json"]) {
|
|
5687
|
-
const p =
|
|
5691
|
+
const p = join11(claudeDir, filename);
|
|
5688
5692
|
if (existsSync5(p)) {
|
|
5689
5693
|
try {
|
|
5690
5694
|
rmSync2(p, { force: true });
|
|
@@ -5700,12 +5704,12 @@ async function applyClaudeAuthToEnv(childEnv, label) {
|
|
|
5700
5704
|
var evalEmptyMcpConfigPath = null;
|
|
5701
5705
|
function ensureEvalEmptyMcpConfig() {
|
|
5702
5706
|
if (evalEmptyMcpConfigPath && existsSync5(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
|
|
5703
|
-
const dir =
|
|
5707
|
+
const dir = join11(homedir5(), ".augmented");
|
|
5704
5708
|
try {
|
|
5705
5709
|
mkdirSync3(dir, { recursive: true });
|
|
5706
5710
|
} catch {
|
|
5707
5711
|
}
|
|
5708
|
-
const p =
|
|
5712
|
+
const p = join11(dir, ".eval-empty-mcp.json");
|
|
5709
5713
|
writeFileSync4(p, JSON.stringify({ mcpServers: {} }));
|
|
5710
5714
|
evalEmptyMcpConfigPath = p;
|
|
5711
5715
|
return p;
|
|
@@ -5810,10 +5814,10 @@ function freePort(codeName) {
|
|
|
5810
5814
|
}
|
|
5811
5815
|
}
|
|
5812
5816
|
function getStateFile() {
|
|
5813
|
-
return
|
|
5817
|
+
return join11(config?.configDir ?? join11(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
|
|
5814
5818
|
}
|
|
5815
5819
|
function channelHashCacheDir() {
|
|
5816
|
-
return config?.configDir ??
|
|
5820
|
+
return config?.configDir ?? join11(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
5817
5821
|
}
|
|
5818
5822
|
function loadChannelHashCache2() {
|
|
5819
5823
|
loadChannelHashCache(agentState.knownChannelConfigHashes, channelHashCacheDir());
|
|
@@ -5824,7 +5828,7 @@ function saveChannelHashCache2() {
|
|
|
5824
5828
|
var _channelQuarantineStore = null;
|
|
5825
5829
|
function channelQuarantineStore() {
|
|
5826
5830
|
if (!_channelQuarantineStore) {
|
|
5827
|
-
const dir = config?.configDir ??
|
|
5831
|
+
const dir = config?.configDir ?? join11(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
5828
5832
|
_channelQuarantineStore = new ChannelQuarantineStore(defaultQuarantinePath(dir));
|
|
5829
5833
|
}
|
|
5830
5834
|
return _channelQuarantineStore;
|
|
@@ -5832,7 +5836,7 @@ function channelQuarantineStore() {
|
|
|
5832
5836
|
var _hostFlagStore = null;
|
|
5833
5837
|
function hostFlagStore() {
|
|
5834
5838
|
if (!_hostFlagStore) {
|
|
5835
|
-
const dir = config?.configDir ??
|
|
5839
|
+
const dir = config?.configDir ?? join11(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
5836
5840
|
_hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
|
|
5837
5841
|
}
|
|
5838
5842
|
return _hostFlagStore;
|
|
@@ -5884,7 +5888,7 @@ function log(msg) {
|
|
|
5884
5888
|
`;
|
|
5885
5889
|
if (!managerLogPath) {
|
|
5886
5890
|
try {
|
|
5887
|
-
managerLogPath =
|
|
5891
|
+
managerLogPath = join11(homedir5(), ".augmented", "manager.log");
|
|
5888
5892
|
mkdirSync3(dirname2(managerLogPath), { recursive: true });
|
|
5889
5893
|
if (existsSync5(managerLogPath)) {
|
|
5890
5894
|
chmodSync(managerLogPath, 384);
|
|
@@ -5939,12 +5943,12 @@ function parseSkillFrontmatter(content) {
|
|
|
5939
5943
|
}
|
|
5940
5944
|
async function refreshSkillsIndexInClaudeMd(configDir, codeName, log2) {
|
|
5941
5945
|
const { readdirSync: readdirSync6, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync5 } = await import("fs");
|
|
5942
|
-
const skillsDir =
|
|
5943
|
-
const claudeMdPath =
|
|
5946
|
+
const skillsDir = join11(configDir, codeName, "project", ".claude", "skills");
|
|
5947
|
+
const claudeMdPath = join11(configDir, codeName, "project", "CLAUDE.md");
|
|
5944
5948
|
if (!ex(skillsDir) || !ex(claudeMdPath)) return;
|
|
5945
5949
|
const entries = [];
|
|
5946
5950
|
for (const dir of readdirSync6(skillsDir).sort()) {
|
|
5947
|
-
const skillFile =
|
|
5951
|
+
const skillFile = join11(skillsDir, dir, "SKILL.md");
|
|
5948
5952
|
if (!ex(skillFile)) continue;
|
|
5949
5953
|
try {
|
|
5950
5954
|
const { name, description } = parseSkillFrontmatter(rfs(skillFile, "utf-8"));
|
|
@@ -5992,7 +5996,7 @@ ${SKILLS_INDEX_END}`;
|
|
|
5992
5996
|
}
|
|
5993
5997
|
async function migrateToProfiles() {
|
|
5994
5998
|
const homeDir = process.env["HOME"] ?? "/tmp";
|
|
5995
|
-
const sharedConfigPath =
|
|
5999
|
+
const sharedConfigPath = join11(homeDir, ".openclaw", "openclaw.json");
|
|
5996
6000
|
let sharedConfig;
|
|
5997
6001
|
try {
|
|
5998
6002
|
sharedConfig = JSON.parse(readFileSync10(sharedConfigPath, "utf-8"));
|
|
@@ -6008,19 +6012,19 @@ async function migrateToProfiles() {
|
|
|
6008
6012
|
const codeName = agentEntry["id"];
|
|
6009
6013
|
if (!codeName) continue;
|
|
6010
6014
|
if (codeName === "main") continue;
|
|
6011
|
-
const profileDir =
|
|
6012
|
-
if (existsSync5(
|
|
6015
|
+
const profileDir = join11(homeDir, `.openclaw-${codeName}`);
|
|
6016
|
+
if (existsSync5(join11(profileDir, "openclaw.json"))) continue;
|
|
6013
6017
|
log(`Migrating agent '${codeName}' to per-agent profile`);
|
|
6014
6018
|
if (adapter.seedProfileConfig) {
|
|
6015
6019
|
adapter.seedProfileConfig(codeName);
|
|
6016
6020
|
}
|
|
6017
|
-
const sharedAuthDir =
|
|
6018
|
-
const profileAuthDir =
|
|
6019
|
-
const authFile =
|
|
6021
|
+
const sharedAuthDir = join11(homeDir, ".openclaw", "agents", codeName, "agent");
|
|
6022
|
+
const profileAuthDir = join11(profileDir, "agents", codeName, "agent");
|
|
6023
|
+
const authFile = join11(sharedAuthDir, "auth-profiles.json");
|
|
6020
6024
|
if (existsSync5(authFile)) {
|
|
6021
6025
|
mkdirSync3(profileAuthDir, { recursive: true });
|
|
6022
6026
|
const authContent = readFileSync10(authFile, "utf-8");
|
|
6023
|
-
writeFileSync4(
|
|
6027
|
+
writeFileSync4(join11(profileAuthDir, "auth-profiles.json"), authContent);
|
|
6024
6028
|
}
|
|
6025
6029
|
allocatePort(codeName);
|
|
6026
6030
|
migrated++;
|
|
@@ -6058,7 +6062,7 @@ function readGatewayToken(codeName) {
|
|
|
6058
6062
|
}
|
|
6059
6063
|
const homeDir = process.env["HOME"] ?? "/tmp";
|
|
6060
6064
|
try {
|
|
6061
|
-
const cfg = JSON.parse(readFileSync10(
|
|
6065
|
+
const cfg = JSON.parse(readFileSync10(join11(homeDir, `.openclaw-${codeName}`, "openclaw.json"), "utf-8"));
|
|
6062
6066
|
return cfg?.gateway?.auth?.token;
|
|
6063
6067
|
} catch {
|
|
6064
6068
|
return void 0;
|
|
@@ -6067,7 +6071,7 @@ function readGatewayToken(codeName) {
|
|
|
6067
6071
|
var GATEWAY_HUNG_TIMEOUT_MS = 5 * 6e4;
|
|
6068
6072
|
function isGatewayHung(codeName) {
|
|
6069
6073
|
const homeDir = process.env["HOME"] ?? "/tmp";
|
|
6070
|
-
const jobsPath =
|
|
6074
|
+
const jobsPath = join11(homeDir, `.openclaw-${codeName}`, "cron", "jobs.json");
|
|
6071
6075
|
if (!existsSync5(jobsPath)) return false;
|
|
6072
6076
|
try {
|
|
6073
6077
|
const data = JSON.parse(readFileSync10(jobsPath, "utf-8"));
|
|
@@ -6103,13 +6107,13 @@ async function ensureGatewayRunning(codeName, adapter) {
|
|
|
6103
6107
|
}
|
|
6104
6108
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
6105
6109
|
const homeDir = process.env["HOME"] ?? "/tmp";
|
|
6106
|
-
const cronJobsPath =
|
|
6110
|
+
const cronJobsPath = join11(homeDir, `.openclaw-${codeName}`, "cron", "jobs.json");
|
|
6107
6111
|
clearStaleCronRunState(cronJobsPath);
|
|
6108
6112
|
} else {
|
|
6109
6113
|
if (status.port) {
|
|
6110
6114
|
try {
|
|
6111
6115
|
const homeDir = process.env["HOME"] ?? "/tmp";
|
|
6112
|
-
const configPath =
|
|
6116
|
+
const configPath = join11(homeDir, `.openclaw-${codeName}`, "openclaw.json");
|
|
6113
6117
|
if (existsSync5(configPath)) {
|
|
6114
6118
|
const cfg = JSON.parse(readFileSync10(configPath, "utf-8"));
|
|
6115
6119
|
if (cfg.gateway?.port !== status.port) {
|
|
@@ -6135,7 +6139,7 @@ async function ensureGatewayRunning(codeName, adapter) {
|
|
|
6135
6139
|
gatewaysStartedThisCycle.add(codeName);
|
|
6136
6140
|
try {
|
|
6137
6141
|
const homeDir = process.env["HOME"] ?? "/tmp";
|
|
6138
|
-
const configPath =
|
|
6142
|
+
const configPath = join11(homeDir, `.openclaw-${codeName}`, "openclaw.json");
|
|
6139
6143
|
if (existsSync5(configPath)) {
|
|
6140
6144
|
const cfg = JSON.parse(readFileSync10(configPath, "utf-8"));
|
|
6141
6145
|
if (!cfg.gateway) cfg.gateway = {};
|
|
@@ -6291,7 +6295,7 @@ async function pollCycle() {
|
|
|
6291
6295
|
}
|
|
6292
6296
|
try {
|
|
6293
6297
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
6294
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
6298
|
+
const { collectDiagnostics } = await import("../persistent-session-S6H3P6WD.js");
|
|
6295
6299
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
6296
6300
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
|
|
6297
6301
|
let tailscaleHostname;
|
|
@@ -6385,7 +6389,7 @@ async function pollCycle() {
|
|
|
6385
6389
|
const {
|
|
6386
6390
|
collectResponsivenessProbes,
|
|
6387
6391
|
getResponsivenessIntervalMs
|
|
6388
|
-
} = await import("../responsiveness-probe-
|
|
6392
|
+
} = await import("../responsiveness-probe-6BLLBJB4.js");
|
|
6389
6393
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
6390
6394
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
6391
6395
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -6417,7 +6421,7 @@ async function pollCycle() {
|
|
|
6417
6421
|
collectResponsivenessProbes,
|
|
6418
6422
|
livePendingInboundOldestAgeSeconds,
|
|
6419
6423
|
parkPendingInbound
|
|
6420
|
-
} = await import("../responsiveness-probe-
|
|
6424
|
+
} = await import("../responsiveness-probe-6BLLBJB4.js");
|
|
6421
6425
|
const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
|
|
6422
6426
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
6423
6427
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -6674,7 +6678,7 @@ async function pollCycle() {
|
|
|
6674
6678
|
}
|
|
6675
6679
|
killAgentChannelProcesses(prev.codeName, { log });
|
|
6676
6680
|
freePort(prev.codeName);
|
|
6677
|
-
const agentDir =
|
|
6681
|
+
const agentDir = join11(adapter.getAgentDir(prev.codeName), "provision");
|
|
6678
6682
|
await cleanupAgentFiles(prev.codeName, agentDir);
|
|
6679
6683
|
clearAgentCaches(prev.agentId, prev.codeName);
|
|
6680
6684
|
}
|
|
@@ -6760,10 +6764,10 @@ async function pollCycle() {
|
|
|
6760
6764
|
// pending-inbound marker. Best-effort: a write failure is logged by
|
|
6761
6765
|
// the watchdog, never fails the poll cycle.
|
|
6762
6766
|
signalGiveUp: (codeName) => {
|
|
6763
|
-
const dir =
|
|
6767
|
+
const dir = join11(homedir5(), ".augmented", codeName);
|
|
6764
6768
|
if (!existsSync5(dir)) return;
|
|
6765
6769
|
atomicWriteFileSync(
|
|
6766
|
-
|
|
6770
|
+
join11(dir, "watchdog-give-up.json"),
|
|
6767
6771
|
JSON.stringify({ gave_up_at: (/* @__PURE__ */ new Date()).toISOString() })
|
|
6768
6772
|
);
|
|
6769
6773
|
}
|
|
@@ -6890,7 +6894,7 @@ async function processAgent(agent, agentStates) {
|
|
|
6890
6894
|
}
|
|
6891
6895
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
6892
6896
|
const adapter = resolveAgentFramework(agent.code_name);
|
|
6893
|
-
let agentDir =
|
|
6897
|
+
let agentDir = join11(adapter.getAgentDir(agent.code_name), "provision");
|
|
6894
6898
|
if (agent.status === "draft" || agent.status === "paused") {
|
|
6895
6899
|
if (previousKnownStatus !== agent.status) {
|
|
6896
6900
|
log(`Agent '${agent.code_name}' is ${agent.status}, skipping provisioning`);
|
|
@@ -7094,7 +7098,7 @@ async function processAgent(agent, agentStates) {
|
|
|
7094
7098
|
const frameworkId = refreshData.agent.framework ?? "openclaw";
|
|
7095
7099
|
agentFrameworkCache.set(agent.code_name, frameworkId);
|
|
7096
7100
|
const frameworkAdapter = getFramework(frameworkId);
|
|
7097
|
-
agentDir =
|
|
7101
|
+
agentDir = join11(frameworkAdapter.getAgentDir(agent.code_name), "provision");
|
|
7098
7102
|
cacheAgentDeliveryMetadata(agent.code_name, refreshData);
|
|
7099
7103
|
if (frameworkAdapter.migrateSecretStorage && !migratedSecretStorage.has(agent.code_name)) {
|
|
7100
7104
|
try {
|
|
@@ -7137,7 +7141,7 @@ async function processAgent(agent, agentStates) {
|
|
|
7137
7141
|
const changedFiles = [];
|
|
7138
7142
|
mkdirSync3(agentDir, { recursive: true });
|
|
7139
7143
|
for (const artifact of artifacts) {
|
|
7140
|
-
const filePath =
|
|
7144
|
+
const filePath = join11(agentDir, artifact.relativePath);
|
|
7141
7145
|
let existingHash;
|
|
7142
7146
|
let newHash;
|
|
7143
7147
|
let writeContent = artifact.content;
|
|
@@ -7156,7 +7160,7 @@ async function processAgent(agent, agentStates) {
|
|
|
7156
7160
|
};
|
|
7157
7161
|
newHash = sha256(stripDynamicSections(artifact.content));
|
|
7158
7162
|
try {
|
|
7159
|
-
const projectClaudeMd =
|
|
7163
|
+
const projectClaudeMd = join11(config.configDir, agent.code_name, "project", "CLAUDE.md");
|
|
7160
7164
|
const existing = readFileSync10(projectClaudeMd, "utf-8");
|
|
7161
7165
|
existingHash = sha256(stripDynamicSections(existing));
|
|
7162
7166
|
} catch {
|
|
@@ -7197,12 +7201,12 @@ async function processAgent(agent, agentStates) {
|
|
|
7197
7201
|
}
|
|
7198
7202
|
}
|
|
7199
7203
|
if (changedFiles.length > 0) {
|
|
7200
|
-
const isFirst = !existsSync5(
|
|
7204
|
+
const isFirst = !existsSync5(join11(agentDir, "CHARTER.md"));
|
|
7201
7205
|
const verb = isFirst ? "Provisioning" : "Updating";
|
|
7202
7206
|
const fileNames = changedFiles.map((f) => f.relativePath).join(", ");
|
|
7203
7207
|
log(`${verb} '${agent.code_name}': ${fileNames}`);
|
|
7204
7208
|
for (const file of changedFiles) {
|
|
7205
|
-
const filePath =
|
|
7209
|
+
const filePath = join11(agentDir, file.relativePath);
|
|
7206
7210
|
mkdirSync3(dirname2(filePath), { recursive: true });
|
|
7207
7211
|
if (file.relativePath === ".mcp.json") {
|
|
7208
7212
|
safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
|
|
@@ -7211,12 +7215,12 @@ async function processAgent(agent, agentStates) {
|
|
|
7211
7215
|
}
|
|
7212
7216
|
}
|
|
7213
7217
|
try {
|
|
7214
|
-
const provSkillsDir =
|
|
7218
|
+
const provSkillsDir = join11(agentDir, ".claude", "skills");
|
|
7215
7219
|
if (existsSync5(provSkillsDir)) {
|
|
7216
7220
|
for (const folder of readdirSync5(provSkillsDir)) {
|
|
7217
7221
|
if (folder.startsWith("knowledge-")) {
|
|
7218
7222
|
try {
|
|
7219
|
-
rmSync2(
|
|
7223
|
+
rmSync2(join11(provSkillsDir, folder), { recursive: true });
|
|
7220
7224
|
} catch {
|
|
7221
7225
|
}
|
|
7222
7226
|
}
|
|
@@ -7229,7 +7233,7 @@ async function processAgent(agent, agentStates) {
|
|
|
7229
7233
|
const trackedFiles2 = frameworkAdapter.driftTrackedFiles();
|
|
7230
7234
|
const hashes = /* @__PURE__ */ new Map();
|
|
7231
7235
|
for (const file of trackedFiles2) {
|
|
7232
|
-
const h = hashFile(
|
|
7236
|
+
const h = hashFile(join11(agentDir, file));
|
|
7233
7237
|
if (h) hashes.set(file, h);
|
|
7234
7238
|
}
|
|
7235
7239
|
agentState.writtenHashes.set(agent.agent_id, hashes);
|
|
@@ -7247,14 +7251,14 @@ async function processAgent(agent, agentStates) {
|
|
|
7247
7251
|
}
|
|
7248
7252
|
if (Array.isArray(refreshData.workflows)) {
|
|
7249
7253
|
try {
|
|
7250
|
-
const provWorkflowsDir =
|
|
7254
|
+
const provWorkflowsDir = join11(agentDir, ".claude", "workflows");
|
|
7251
7255
|
if (existsSync5(provWorkflowsDir)) {
|
|
7252
7256
|
const expected = new Set(refreshData.workflows.map((w) => `${w.name}.js`));
|
|
7253
7257
|
for (const file of readdirSync5(provWorkflowsDir)) {
|
|
7254
7258
|
if (!file.endsWith(".js")) continue;
|
|
7255
7259
|
if (expected.has(file)) continue;
|
|
7256
7260
|
try {
|
|
7257
|
-
rmSync2(
|
|
7261
|
+
rmSync2(join11(provWorkflowsDir, file));
|
|
7258
7262
|
} catch {
|
|
7259
7263
|
}
|
|
7260
7264
|
}
|
|
@@ -7314,7 +7318,7 @@ async function processAgent(agent, agentStates) {
|
|
|
7314
7318
|
if (written && existsSync5(agentDir)) {
|
|
7315
7319
|
const driftedFiles = [];
|
|
7316
7320
|
for (const [file, expectedHash] of written) {
|
|
7317
|
-
const localHash = hashFile(
|
|
7321
|
+
const localHash = hashFile(join11(agentDir, file));
|
|
7318
7322
|
if (localHash && localHash !== expectedHash) {
|
|
7319
7323
|
driftedFiles.push(file);
|
|
7320
7324
|
}
|
|
@@ -7325,7 +7329,7 @@ async function processAgent(agent, agentStates) {
|
|
|
7325
7329
|
try {
|
|
7326
7330
|
const localHashes = {};
|
|
7327
7331
|
for (const file of driftedFiles) {
|
|
7328
|
-
localHashes[file] = hashFile(
|
|
7332
|
+
localHashes[file] = hashFile(join11(agentDir, file));
|
|
7329
7333
|
}
|
|
7330
7334
|
await api.post("/host/drift", {
|
|
7331
7335
|
agent_id: agent.agent_id,
|
|
@@ -7649,18 +7653,18 @@ async function processAgent(agent, agentStates) {
|
|
|
7649
7653
|
if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? "openclaw") === "claude-code") {
|
|
7650
7654
|
try {
|
|
7651
7655
|
const agentProvisionDir = agentDir;
|
|
7652
|
-
const projectDir =
|
|
7656
|
+
const projectDir = join11(homedir5(), ".augmented", agent.code_name, "project");
|
|
7653
7657
|
mkdirSync3(agentProvisionDir, { recursive: true });
|
|
7654
7658
|
mkdirSync3(projectDir, { recursive: true });
|
|
7655
|
-
const provisionMcpPath =
|
|
7656
|
-
const projectMcpPath =
|
|
7659
|
+
const provisionMcpPath = join11(agentProvisionDir, ".mcp.json");
|
|
7660
|
+
const projectMcpPath = join11(projectDir, ".mcp.json");
|
|
7657
7661
|
let mcpConfig = { mcpServers: {} };
|
|
7658
7662
|
try {
|
|
7659
7663
|
mcpConfig = JSON.parse(readFileSync10(provisionMcpPath, "utf-8"));
|
|
7660
7664
|
if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
|
|
7661
7665
|
} catch {
|
|
7662
7666
|
}
|
|
7663
|
-
const localDirectChatChannel =
|
|
7667
|
+
const localDirectChatChannel = join11(homedir5(), ".augmented", "_mcp", "direct-chat-channel.js");
|
|
7664
7668
|
const directChatTeamSettings = refreshData.team?.settings;
|
|
7665
7669
|
const directChatTz = (() => {
|
|
7666
7670
|
const tz = directChatTeamSettings?.["timezone"];
|
|
@@ -7690,7 +7694,7 @@ async function processAgent(agent, agentStates) {
|
|
|
7690
7694
|
log(`Channel credentials written for '${agent.code_name}/direct-chat'`);
|
|
7691
7695
|
}
|
|
7692
7696
|
}
|
|
7693
|
-
const staleChannelsPath =
|
|
7697
|
+
const staleChannelsPath = join11(projectDir, ".mcp-channels.json");
|
|
7694
7698
|
if (existsSync5(staleChannelsPath)) {
|
|
7695
7699
|
try {
|
|
7696
7700
|
rmSync2(staleChannelsPath, { force: true });
|
|
@@ -7755,7 +7759,7 @@ async function processAgent(agent, agentStates) {
|
|
|
7755
7759
|
}
|
|
7756
7760
|
if (process.env.AGT_CONNECTIVITY_PROBE_ENABLED === "true") {
|
|
7757
7761
|
try {
|
|
7758
|
-
const probeProjectDir =
|
|
7762
|
+
const probeProjectDir = join11(homedir5(), ".augmented", agent.code_name, "project");
|
|
7759
7763
|
await runAgentConnectivityProbes(agent, integrations, probeProjectDir);
|
|
7760
7764
|
} catch (err) {
|
|
7761
7765
|
log(`Connectivity probe failed for '${agent.code_name}': ${err.message}`);
|
|
@@ -7773,8 +7777,8 @@ async function processAgent(agent, agentStates) {
|
|
|
7773
7777
|
recordConfigChurnEvent(agent.agent_id, agent.code_name, FLAP_CHANNEL_INTEGRATIONS, intMembership);
|
|
7774
7778
|
}
|
|
7775
7779
|
if (intHash !== prevIntHash) {
|
|
7776
|
-
const projectDir =
|
|
7777
|
-
const envIntPath =
|
|
7780
|
+
const projectDir = join11(homedir5(), ".augmented", agent.code_name, "project");
|
|
7781
|
+
const envIntPath = join11(projectDir, ".env.integrations");
|
|
7778
7782
|
let preWriteEnv;
|
|
7779
7783
|
try {
|
|
7780
7784
|
preWriteEnv = readFileSync10(envIntPath, "utf-8");
|
|
@@ -7789,7 +7793,7 @@ async function processAgent(agent, agentStates) {
|
|
|
7789
7793
|
let rotationHandled = true;
|
|
7790
7794
|
if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
|
|
7791
7795
|
try {
|
|
7792
|
-
const projectMcpPath =
|
|
7796
|
+
const projectMcpPath = join11(projectDir, ".mcp.json");
|
|
7793
7797
|
const postWriteEnv = readFileSync10(envIntPath, "utf-8");
|
|
7794
7798
|
const mcpContent = readFileSync10(projectMcpPath, "utf-8");
|
|
7795
7799
|
const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
|
|
@@ -7973,7 +7977,7 @@ async function processAgent(agent, agentStates) {
|
|
|
7973
7977
|
if (agent.status === "active") {
|
|
7974
7978
|
if (frameworkAdapter.installPlugin) {
|
|
7975
7979
|
try {
|
|
7976
|
-
const pluginPath =
|
|
7980
|
+
const pluginPath = join11(process.cwd(), "packages", "openclaw-plugin-augmented", "src", "index.ts");
|
|
7977
7981
|
if (existsSync5(pluginPath)) {
|
|
7978
7982
|
frameworkAdapter.installPlugin(agent.code_name, "augmented", pluginPath, {
|
|
7979
7983
|
agtHost: requireHost(),
|
|
@@ -8044,14 +8048,14 @@ async function processAgent(agent, agentStates) {
|
|
|
8044
8048
|
const frameworkId2 = frameworkAdapter.id;
|
|
8045
8049
|
const candidateSkillDirs = [
|
|
8046
8050
|
// Claude Code — framework runtime tree
|
|
8047
|
-
|
|
8051
|
+
join11(homedir6(), ".augmented", agent.code_name, "skills"),
|
|
8048
8052
|
// Claude Code — project tree
|
|
8049
|
-
|
|
8053
|
+
join11(homedir6(), ".augmented", agent.code_name, "project", ".claude", "skills"),
|
|
8050
8054
|
// OpenClaw — framework runtime tree
|
|
8051
|
-
|
|
8055
|
+
join11(homedir6(), `.openclaw-${agent.code_name}`, "skills"),
|
|
8052
8056
|
// Defensive: legacy provision-side path, not currently an
|
|
8053
8057
|
// install target but cheap to sweep.
|
|
8054
|
-
|
|
8058
|
+
join11(agentDir, ".claude", "skills")
|
|
8055
8059
|
];
|
|
8056
8060
|
const existingDirs = candidateSkillDirs.filter((d) => existsSync5(d));
|
|
8057
8061
|
const discoveredEntries = /* @__PURE__ */ new Set();
|
|
@@ -8067,7 +8071,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8067
8071
|
}
|
|
8068
8072
|
const removeSkillFolder = (entry, reason) => {
|
|
8069
8073
|
for (const dir of existingDirs) {
|
|
8070
|
-
const p =
|
|
8074
|
+
const p = join11(dir, entry);
|
|
8071
8075
|
if (existsSync5(p)) {
|
|
8072
8076
|
rmSync3(p, { recursive: true, force: true });
|
|
8073
8077
|
}
|
|
@@ -8098,14 +8102,14 @@ async function processAgent(agent, agentStates) {
|
|
|
8098
8102
|
const { rmSync: rmSync3 } = await import("fs");
|
|
8099
8103
|
const { homedir: homedir6 } = await import("os");
|
|
8100
8104
|
const globalSkillDirs = [
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
+
join11(homedir6(), ".augmented", agent.code_name, "skills"),
|
|
8106
|
+
join11(homedir6(), ".augmented", agent.code_name, "project", ".claude", "skills"),
|
|
8107
|
+
join11(homedir6(), `.openclaw-${agent.code_name}`, "skills"),
|
|
8108
|
+
join11(agentDir, ".claude", "skills")
|
|
8105
8109
|
];
|
|
8106
8110
|
for (const id of plan.removes) {
|
|
8107
8111
|
for (const dir of globalSkillDirs) {
|
|
8108
|
-
const p =
|
|
8112
|
+
const p = join11(dir, id);
|
|
8109
8113
|
if (existsSync5(p)) rmSync3(p, { recursive: true, force: true });
|
|
8110
8114
|
}
|
|
8111
8115
|
agentState.knownSkillHashes.delete(`global-skill:${agent.agent_id}:${id}`);
|
|
@@ -8281,7 +8285,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8281
8285
|
const sess = getSessionState(agent.code_name);
|
|
8282
8286
|
let mcpJsonParsed = null;
|
|
8283
8287
|
try {
|
|
8284
|
-
const mcpPath =
|
|
8288
|
+
const mcpPath = join11(getProjectDir(agent.code_name), ".mcp.json");
|
|
8285
8289
|
mcpJsonParsed = JSON.parse(readFileSync10(mcpPath, "utf-8"));
|
|
8286
8290
|
} catch {
|
|
8287
8291
|
}
|
|
@@ -8491,7 +8495,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8491
8495
|
lastWorkTriggerAt.set(agent.code_name, triggerTs);
|
|
8492
8496
|
if (agentFw === "openclaw" && gatewayRunning && gatewayPort) {
|
|
8493
8497
|
const homeDir = process.env["HOME"] ?? "/tmp";
|
|
8494
|
-
const jobsPath =
|
|
8498
|
+
const jobsPath = join11(homeDir, `.openclaw-${agent.code_name}`, "cron", "jobs.json");
|
|
8495
8499
|
if (existsSync5(jobsPath)) {
|
|
8496
8500
|
try {
|
|
8497
8501
|
const jobsData = JSON.parse(readFileSync10(jobsPath, "utf-8"));
|
|
@@ -8631,7 +8635,7 @@ In progress for ${age} minutes \u2014 auto-failed`).catch(() => {
|
|
|
8631
8635
|
if (trackedFiles.length > 0 && existsSync5(agentDir)) {
|
|
8632
8636
|
const hashes = /* @__PURE__ */ new Map();
|
|
8633
8637
|
for (const file of trackedFiles) {
|
|
8634
|
-
const h = hashFile(
|
|
8638
|
+
const h = hashFile(join11(agentDir, file));
|
|
8635
8639
|
if (h) hashes.set(file, h);
|
|
8636
8640
|
}
|
|
8637
8641
|
agentState.writtenHashes.set(agent.agent_id, hashes);
|
|
@@ -8665,16 +8669,16 @@ function cleanupStaleSessions(codeName) {
|
|
|
8665
8669
|
lastCleanupAt.set(codeName, Date.now());
|
|
8666
8670
|
const homeDir = process.env["HOME"] ?? "/tmp";
|
|
8667
8671
|
for (const agentDir of ["main", codeName]) {
|
|
8668
|
-
const sessionsDir =
|
|
8672
|
+
const sessionsDir = join11(homeDir, `.openclaw-${codeName}`, "agents", agentDir, "sessions");
|
|
8669
8673
|
cleanupCronSessions(sessionsDir, CRON_SESSION_KEEP_COUNT);
|
|
8670
8674
|
}
|
|
8671
|
-
const cronRunsDir =
|
|
8675
|
+
const cronRunsDir = join11(homeDir, `.openclaw-${codeName}`, "cron", "runs");
|
|
8672
8676
|
cleanupOldFiles(cronRunsDir, CRON_RUN_RETENTION_DAYS, ".jsonl");
|
|
8673
|
-
const cronJobsPath =
|
|
8677
|
+
const cronJobsPath = join11(homeDir, `.openclaw-${codeName}`, "cron", "jobs.json");
|
|
8674
8678
|
clearStaleCronRunState(cronJobsPath);
|
|
8675
8679
|
}
|
|
8676
8680
|
function cleanupCronSessions(sessionsDir, keepCount) {
|
|
8677
|
-
const indexPath =
|
|
8681
|
+
const indexPath = join11(sessionsDir, "sessions.json");
|
|
8678
8682
|
if (!existsSync5(indexPath)) return;
|
|
8679
8683
|
try {
|
|
8680
8684
|
const raw = readFileSync10(indexPath, "utf-8");
|
|
@@ -8690,7 +8694,7 @@ function cleanupCronSessions(sessionsDir, keepCount) {
|
|
|
8690
8694
|
for (const entry of toDelete) {
|
|
8691
8695
|
delete index[entry.key];
|
|
8692
8696
|
if (entry.sessionId) {
|
|
8693
|
-
const sessionFile =
|
|
8697
|
+
const sessionFile = join11(sessionsDir, `${entry.sessionId}.jsonl`);
|
|
8694
8698
|
try {
|
|
8695
8699
|
if (existsSync5(sessionFile)) {
|
|
8696
8700
|
unlinkSync(sessionFile);
|
|
@@ -8712,7 +8716,7 @@ function cleanupCronSessions(sessionsDir, keepCount) {
|
|
|
8712
8716
|
delete index[parentKey];
|
|
8713
8717
|
if (parentSessionId) {
|
|
8714
8718
|
try {
|
|
8715
|
-
const f =
|
|
8719
|
+
const f = join11(sessionsDir, `${parentSessionId}.jsonl`);
|
|
8716
8720
|
if (existsSync5(f)) {
|
|
8717
8721
|
unlinkSync(f);
|
|
8718
8722
|
deletedFiles++;
|
|
@@ -8770,7 +8774,7 @@ function cleanupOldFiles(dir, maxAgeDays, ext) {
|
|
|
8770
8774
|
try {
|
|
8771
8775
|
for (const f of readdirSync5(dir)) {
|
|
8772
8776
|
if (!f.endsWith(ext)) continue;
|
|
8773
|
-
const fullPath =
|
|
8777
|
+
const fullPath = join11(dir, f);
|
|
8774
8778
|
try {
|
|
8775
8779
|
const st = statSync4(fullPath);
|
|
8776
8780
|
if (st.mtimeMs < cutoff) {
|
|
@@ -8810,7 +8814,7 @@ var inFlightClaudeTasks = /* @__PURE__ */ new Set();
|
|
|
8810
8814
|
var claudeTaskConcurrency = /* @__PURE__ */ new Map();
|
|
8811
8815
|
var MAX_CLAUDE_CONCURRENCY = 2;
|
|
8812
8816
|
function claudePidFilePath() {
|
|
8813
|
-
return
|
|
8817
|
+
return join11(homedir5(), ".augmented", "manager-claude-pids.json");
|
|
8814
8818
|
}
|
|
8815
8819
|
var inFlightClaudePids = /* @__PURE__ */ new Map();
|
|
8816
8820
|
function registerClaudeSpawn(record) {
|
|
@@ -9150,7 +9154,7 @@ async function fireScheduledTaskViaKanban(codeName, agentId, task, prompt) {
|
|
|
9150
9154
|
}
|
|
9151
9155
|
async function executeAndProcessClaudeTask(codeName, agentId, task, prompt) {
|
|
9152
9156
|
const projectDir = getProjectDir2(codeName);
|
|
9153
|
-
const mcpConfigPath =
|
|
9157
|
+
const mcpConfigPath = join11(projectDir, ".mcp.json");
|
|
9154
9158
|
let runId = null;
|
|
9155
9159
|
let kanbanItemId = null;
|
|
9156
9160
|
let taskResult;
|
|
@@ -9158,7 +9162,7 @@ async function executeAndProcessClaudeTask(codeName, agentId, task, prompt) {
|
|
|
9158
9162
|
const priorRuns = await fetchPriorScheduledRuns(agentId, task.taskId);
|
|
9159
9163
|
prompt = wrapScheduledTaskPrompt(prompt, { priorRuns });
|
|
9160
9164
|
try {
|
|
9161
|
-
const claudeMdPath =
|
|
9165
|
+
const claudeMdPath = join11(projectDir, "CLAUDE.md");
|
|
9162
9166
|
const serverNames = [];
|
|
9163
9167
|
if (existsSync5(mcpConfigPath)) {
|
|
9164
9168
|
try {
|
|
@@ -9185,7 +9189,7 @@ async function executeAndProcessClaudeTask(codeName, agentId, task, prompt) {
|
|
|
9185
9189
|
claudeArgs.push("--system-prompt-file", claudeMdPath);
|
|
9186
9190
|
}
|
|
9187
9191
|
const childEnv = { ...process.env };
|
|
9188
|
-
const envIntPath =
|
|
9192
|
+
const envIntPath = join11(projectDir, ".env.integrations");
|
|
9189
9193
|
if (existsSync5(envIntPath)) {
|
|
9190
9194
|
try {
|
|
9191
9195
|
Object.assign(childEnv, parseEnvIntegrations(readFileSync10(envIntPath, "utf-8")));
|
|
@@ -9360,8 +9364,8 @@ var claudeAuthTupleBySession = /* @__PURE__ */ new Map();
|
|
|
9360
9364
|
async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
9361
9365
|
const codeName = agent.code_name;
|
|
9362
9366
|
const projectDir = getProjectDir(codeName);
|
|
9363
|
-
const mcpConfigPath =
|
|
9364
|
-
const claudeMdPath =
|
|
9367
|
+
const mcpConfigPath = join11(projectDir, ".mcp.json");
|
|
9368
|
+
const claudeMdPath = join11(projectDir, "CLAUDE.md");
|
|
9365
9369
|
if (restartBreaker.isTripped(codeName)) {
|
|
9366
9370
|
const trip = restartBreaker.getTrip(codeName);
|
|
9367
9371
|
return {
|
|
@@ -9958,6 +9962,17 @@ async function processDirectChatMessage(agent, msg) {
|
|
|
9958
9962
|
return;
|
|
9959
9963
|
}
|
|
9960
9964
|
if (isSessionHealthy(agent.codeName)) {
|
|
9965
|
+
if (hostFlagStore().getBoolean("direct-chat-doorbell")) {
|
|
9966
|
+
try {
|
|
9967
|
+
const doorbell = directChatDoorbellPath(agent.agentId, homedir5());
|
|
9968
|
+
mkdirSync3(dirname2(doorbell), { recursive: true });
|
|
9969
|
+
writeFileSync4(doorbell, String(Date.now()));
|
|
9970
|
+
log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
|
|
9971
|
+
return;
|
|
9972
|
+
} catch (err) {
|
|
9973
|
+
log(`[direct-chat] Doorbell ring failed for '${agent.codeName}' (msg=${msg.id}): ${err.message} \u2014 falling back to send-keys inject`);
|
|
9974
|
+
}
|
|
9975
|
+
}
|
|
9961
9976
|
const escapeXml = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
9962
9977
|
const channelEnvelope = `<channel source="direct-chat" session_id="${escapeXml(msg.session_id)}" user="webapp">
|
|
9963
9978
|
${escapeXml(msg.content)}
|
|
@@ -9995,7 +10010,7 @@ ${escapeXml(msg.content)}
|
|
|
9995
10010
|
log(`[direct-chat] One-shot spawn for '${agent.codeName}' (msg=${msg.id}; host in-flight=${directChatSpawnGate.hostInFlight}, queued=${directChatSpawnGate.queuedCount})`);
|
|
9996
10011
|
const { getProjectDir: ccProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
|
|
9997
10012
|
const projDir = ccProjectDir(agent.codeName);
|
|
9998
|
-
const mcpConfigPath =
|
|
10013
|
+
const mcpConfigPath = join11(projDir, ".mcp.json");
|
|
9999
10014
|
const serverNames = [];
|
|
10000
10015
|
if (existsSync5(mcpConfigPath)) {
|
|
10001
10016
|
try {
|
|
@@ -10018,11 +10033,11 @@ ${escapeXml(msg.content)}
|
|
|
10018
10033
|
"--allowedTools",
|
|
10019
10034
|
allowedTools
|
|
10020
10035
|
];
|
|
10021
|
-
const chatClaudeMd =
|
|
10036
|
+
const chatClaudeMd = join11(projDir, "CLAUDE.md");
|
|
10022
10037
|
if (existsSync5(chatClaudeMd)) {
|
|
10023
10038
|
chatArgs.push("--system-prompt-file", chatClaudeMd);
|
|
10024
10039
|
}
|
|
10025
|
-
const envIntPath =
|
|
10040
|
+
const envIntPath = join11(projDir, ".env.integrations");
|
|
10026
10041
|
const childEnv = { ...process.env };
|
|
10027
10042
|
if (existsSync5(envIntPath)) {
|
|
10028
10043
|
try {
|
|
@@ -10404,8 +10419,8 @@ function getBuiltInSkillContent(skillId) {
|
|
|
10404
10419
|
if (builtInSkillCache.has(skillId)) return builtInSkillCache.get(skillId);
|
|
10405
10420
|
try {
|
|
10406
10421
|
const candidates = [
|
|
10407
|
-
|
|
10408
|
-
|
|
10422
|
+
join11(process.cwd(), "skills", skillId, "SKILL.md"),
|
|
10423
|
+
join11(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "skills", skillId, "SKILL.md")
|
|
10409
10424
|
];
|
|
10410
10425
|
for (const candidate of candidates) {
|
|
10411
10426
|
if (existsSync5(candidate)) {
|
|
@@ -11064,7 +11079,7 @@ async function processClaudePairSessions(agents) {
|
|
|
11064
11079
|
killPairSession,
|
|
11065
11080
|
pairTmuxSession,
|
|
11066
11081
|
finalizeClaudePairOnboarding
|
|
11067
|
-
} = await import("../claude-pair-runtime-
|
|
11082
|
+
} = await import("../claude-pair-runtime-KOXXDT6B.js");
|
|
11068
11083
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
11069
11084
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
11070
11085
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -11378,8 +11393,8 @@ function parseMemoryFile(raw, fallbackName) {
|
|
|
11378
11393
|
};
|
|
11379
11394
|
}
|
|
11380
11395
|
async function syncMemories(agent, configDir, log2) {
|
|
11381
|
-
const projectDir =
|
|
11382
|
-
const memoryDir =
|
|
11396
|
+
const projectDir = join11(configDir, agent.code_name, "project");
|
|
11397
|
+
const memoryDir = join11(projectDir, "memory");
|
|
11383
11398
|
const isFreshSync = pendingFreshMemorySync.has(agent.agent_id);
|
|
11384
11399
|
if (isFreshSync) {
|
|
11385
11400
|
log2(`[memory-sync] Fresh-sync requested for '${agent.code_name}' \u2014 pulling DB first`);
|
|
@@ -11397,7 +11412,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
11397
11412
|
for (const file of readdirSync5(memoryDir)) {
|
|
11398
11413
|
if (!file.endsWith(".md")) continue;
|
|
11399
11414
|
try {
|
|
11400
|
-
const raw = readFileSync10(
|
|
11415
|
+
const raw = readFileSync10(join11(memoryDir, file), "utf-8");
|
|
11401
11416
|
const fileHash = createHash3("sha256").update(raw).digest("hex").slice(0, 16);
|
|
11402
11417
|
currentHashes.set(file, fileHash);
|
|
11403
11418
|
if (prevHashes.get(file) === fileHash) continue;
|
|
@@ -11422,7 +11437,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
11422
11437
|
} catch (err) {
|
|
11423
11438
|
for (const mem of changedMemories) {
|
|
11424
11439
|
for (const [file] of currentHashes) {
|
|
11425
|
-
const parsed = parseMemoryFile(readFileSync10(
|
|
11440
|
+
const parsed = parseMemoryFile(readFileSync10(join11(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
|
|
11426
11441
|
if (parsed?.name === mem.name) currentHashes.delete(file);
|
|
11427
11442
|
}
|
|
11428
11443
|
}
|
|
@@ -11457,7 +11472,7 @@ async function downloadMemories(agent, memoryDir, log2, { force }) {
|
|
|
11457
11472
|
const mem = dbMemories.memories[i];
|
|
11458
11473
|
const rawSlug = mem.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "").slice(0, 60);
|
|
11459
11474
|
const slug = rawSlug || `memory-${i}`;
|
|
11460
|
-
const filePath =
|
|
11475
|
+
const filePath = join11(memoryDir, `${slug}.md`);
|
|
11461
11476
|
const desired = `---
|
|
11462
11477
|
name: ${JSON.stringify(mem.name)}
|
|
11463
11478
|
type: ${mem.type}
|
|
@@ -11745,7 +11760,7 @@ function startManager(opts) {
|
|
|
11745
11760
|
log(`[startup] state rehydration failed (continuing with empty state): ${err.message}`);
|
|
11746
11761
|
}
|
|
11747
11762
|
log(
|
|
11748
|
-
`[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${
|
|
11763
|
+
`[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join11(homedir5(), ".augmented", "manager.log")}`
|
|
11749
11764
|
);
|
|
11750
11765
|
deployMcpAssets();
|
|
11751
11766
|
reapOrphanChannelMcps({ log });
|
|
@@ -11876,14 +11891,14 @@ function restartRunningChannelMcps(basenames) {
|
|
|
11876
11891
|
}
|
|
11877
11892
|
}
|
|
11878
11893
|
function deployMcpAssets() {
|
|
11879
|
-
const targetDir =
|
|
11894
|
+
const targetDir = join11(homedir5(), ".augmented", "_mcp");
|
|
11880
11895
|
mkdirSync3(targetDir, { recursive: true });
|
|
11881
11896
|
const moduleDir = dirname2(fileURLToPath(import.meta.url));
|
|
11882
11897
|
let mcpSourceDir = "";
|
|
11883
11898
|
let dir = moduleDir;
|
|
11884
11899
|
for (let i = 0; i < 6; i++) {
|
|
11885
|
-
const candidate =
|
|
11886
|
-
if (existsSync5(
|
|
11900
|
+
const candidate = join11(dir, "dist", "mcp");
|
|
11901
|
+
if (existsSync5(join11(candidate, "index.js"))) {
|
|
11887
11902
|
mcpSourceDir = candidate;
|
|
11888
11903
|
break;
|
|
11889
11904
|
}
|
|
@@ -11926,8 +11941,8 @@ function deployMcpAssets() {
|
|
|
11926
11941
|
// natural session restart.
|
|
11927
11942
|
"augmented-admin.js"
|
|
11928
11943
|
]) {
|
|
11929
|
-
const src =
|
|
11930
|
-
const dst =
|
|
11944
|
+
const src = join11(mcpSourceDir, file);
|
|
11945
|
+
const dst = join11(targetDir, file);
|
|
11931
11946
|
if (!existsSync5(src)) continue;
|
|
11932
11947
|
const before = fileHash(dst);
|
|
11933
11948
|
try {
|
|
@@ -11945,14 +11960,14 @@ function deployMcpAssets() {
|
|
|
11945
11960
|
log(`[manager] Bundle(s) updated: ${changedBasenames.join(", ")} \u2014 signalling running instances to restart`);
|
|
11946
11961
|
restartRunningChannelMcps(changedBasenames);
|
|
11947
11962
|
}
|
|
11948
|
-
const localMcpPath =
|
|
11963
|
+
const localMcpPath = join11(targetDir, "index.js");
|
|
11949
11964
|
try {
|
|
11950
|
-
const agentsDir =
|
|
11965
|
+
const agentsDir = join11(homedir5(), ".augmented", "agents");
|
|
11951
11966
|
if (existsSync5(agentsDir)) {
|
|
11952
11967
|
for (const entry of readdirSync5(agentsDir, { withFileTypes: true })) {
|
|
11953
11968
|
if (!entry.isDirectory()) continue;
|
|
11954
11969
|
for (const subdir of ["provision", "project"]) {
|
|
11955
|
-
const mcpJsonPath =
|
|
11970
|
+
const mcpJsonPath = join11(agentsDir, entry.name, subdir, ".mcp.json");
|
|
11956
11971
|
try {
|
|
11957
11972
|
const raw = readFileSync10(mcpJsonPath, "utf-8");
|
|
11958
11973
|
if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
|