@integrity-labs/agt-cli 0.28.569 → 0.28.570
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 +26 -7
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-7O2TXBWR.js → chunk-6XCGZUSS.js} +25 -8
- package/dist/{chunk-7O2TXBWR.js.map → chunk-6XCGZUSS.js.map} +1 -1
- package/dist/{chunk-JBOJC6PG.js → chunk-LNLLMDJJ.js} +3 -3
- package/dist/{claude-pair-runtime-XVEJ7XLB.js → claude-pair-runtime-NSIF6AYH.js} +2 -2
- package/dist/lib/manager-worker.js +245 -203
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +24 -7
- package/dist/mcp/origami.js +24 -7
- package/dist/mcp/slack-channel.js +24 -7
- package/dist/mcp/telegram-channel.js +24 -7
- package/dist/{persistent-session-WUNZJXCI.js → persistent-session-HY6GUPBQ.js} +2 -2
- package/dist/{responsiveness-probe-V3P5TGBH.js → responsiveness-probe-6EEZKJVV.js} +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-JBOJC6PG.js.map → chunk-LNLLMDJJ.js.map} +0 -0
- /package/dist/{claude-pair-runtime-XVEJ7XLB.js.map → claude-pair-runtime-NSIF6AYH.js.map} +0 -0
- /package/dist/{persistent-session-WUNZJXCI.js.map → persistent-session-HY6GUPBQ.js.map} +0 -0
- /package/dist/{responsiveness-probe-V3P5TGBH.js.map → responsiveness-probe-6EEZKJVV.js.map} +0 -0
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
safeWriteJsonAtomic,
|
|
54
54
|
setConfigHash,
|
|
55
55
|
tripClass
|
|
56
|
-
} from "../chunk-
|
|
56
|
+
} from "../chunk-LNLLMDJJ.js";
|
|
57
57
|
import {
|
|
58
58
|
getProjectDir as getProjectDir2,
|
|
59
59
|
getReadyTasks,
|
|
@@ -182,17 +182,17 @@ import {
|
|
|
182
182
|
toOpencodeModel,
|
|
183
183
|
transcriptActivityAgeSeconds,
|
|
184
184
|
writeEgressAllowlist
|
|
185
|
-
} from "../chunk-
|
|
185
|
+
} from "../chunk-6XCGZUSS.js";
|
|
186
186
|
import {
|
|
187
187
|
reapOrphanChannelMcps
|
|
188
188
|
} from "../chunk-XWVM4KPK.js";
|
|
189
189
|
|
|
190
190
|
// src/lib/manager-worker.ts
|
|
191
191
|
import { createHash as createHash17 } from "crypto";
|
|
192
|
-
import { readFileSync as
|
|
192
|
+
import { readFileSync as readFileSync27, writeFileSync as writeFileSync14, mkdirSync as mkdirSync11, existsSync as existsSync14, rmSync as rmSync5, readdirSync as readdirSync9, statSync as statSync8, copyFileSync } from "fs";
|
|
193
193
|
import { execFileSync as syncExecFile } from "child_process";
|
|
194
|
-
import { join as
|
|
195
|
-
import { homedir as
|
|
194
|
+
import { join as join34, dirname as dirname9, delimiter as pathDelimiter } from "path";
|
|
195
|
+
import { homedir as homedir16 } from "os";
|
|
196
196
|
import { fileURLToPath } from "url";
|
|
197
197
|
|
|
198
198
|
// src/lib/claude-code-upgrade-throttle.ts
|
|
@@ -3504,20 +3504,55 @@ async function reportSkip2(api2, agentId, conversationId, log2, codeName) {
|
|
|
3504
3504
|
}
|
|
3505
3505
|
|
|
3506
3506
|
// src/lib/tool-call-audit.ts
|
|
3507
|
-
import { homedir as
|
|
3508
|
-
import { join as
|
|
3507
|
+
import { homedir as homedir10 } from "os";
|
|
3508
|
+
import { join as join18 } from "path";
|
|
3509
|
+
|
|
3510
|
+
// src/lib/agent-logging-mode.ts
|
|
3511
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
3512
|
+
import { homedir as homedir7 } from "os";
|
|
3513
|
+
import { join as join14 } from "path";
|
|
3514
|
+
var LOGGING_MODES = ["hash-only", "redacted", "full-local"];
|
|
3515
|
+
function charterPath(codeName, homeDir) {
|
|
3516
|
+
const home = homeDir ?? (process.env["HOME"]?.trim() || homedir7());
|
|
3517
|
+
const key = agentRuntimeKey(codeName, homeDir);
|
|
3518
|
+
return join14(home, ".augmented", key, "provision", "CHARTER.md");
|
|
3519
|
+
}
|
|
3520
|
+
function readAgentLoggingMode(codeName, homeDir) {
|
|
3521
|
+
let raw;
|
|
3522
|
+
try {
|
|
3523
|
+
raw = readFileSync11(charterPath(codeName, homeDir), "utf-8");
|
|
3524
|
+
} catch {
|
|
3525
|
+
return { mode: null, reason: "no-charter" };
|
|
3526
|
+
}
|
|
3527
|
+
let frontmatter;
|
|
3528
|
+
try {
|
|
3529
|
+
frontmatter = extractFrontmatter(raw).frontmatter;
|
|
3530
|
+
} catch {
|
|
3531
|
+
return { mode: null, reason: "unparseable" };
|
|
3532
|
+
}
|
|
3533
|
+
if (!frontmatter) return { mode: null, reason: "unparseable" };
|
|
3534
|
+
const declared = frontmatter["logging_mode"];
|
|
3535
|
+
if (declared === void 0 || declared === null) return { mode: null, reason: "not-declared" };
|
|
3536
|
+
if (typeof declared !== "string" || !LOGGING_MODES.includes(declared)) {
|
|
3537
|
+
return { mode: null, reason: "unrecognised" };
|
|
3538
|
+
}
|
|
3539
|
+
return { mode: declared };
|
|
3540
|
+
}
|
|
3541
|
+
function loggingModeWithholdsTargets(reading) {
|
|
3542
|
+
return reading.mode === null || reading.mode === "hash-only";
|
|
3543
|
+
}
|
|
3509
3544
|
|
|
3510
3545
|
// src/lib/tool-call-path-salt.ts
|
|
3511
3546
|
import { randomBytes } from "crypto";
|
|
3512
|
-
import { existsSync as existsSync3, mkdirSync as mkdirSync5, readFileSync as
|
|
3513
|
-
import { homedir as
|
|
3514
|
-
import { dirname as dirname5, join as
|
|
3547
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync5, readFileSync as readFileSync12, renameSync as renameSync3, unlinkSync, writeFileSync as writeFileSync6 } from "fs";
|
|
3548
|
+
import { homedir as homedir8 } from "os";
|
|
3549
|
+
import { dirname as dirname5, join as join15 } from "path";
|
|
3515
3550
|
var SALT_BYTES = 32;
|
|
3516
3551
|
var SALT_RE = /^[0-9a-f]{64}$/;
|
|
3517
3552
|
function pathSaltPath(codeName, homeDir) {
|
|
3518
|
-
const home = homeDir ?? (process.env["HOME"]?.trim() ||
|
|
3553
|
+
const home = homeDir ?? (process.env["HOME"]?.trim() || homedir8());
|
|
3519
3554
|
const key = agentRuntimeKey(codeName, homeDir);
|
|
3520
|
-
return
|
|
3555
|
+
return join15(home, ".augmented", key, "tool-call-path-salt");
|
|
3521
3556
|
}
|
|
3522
3557
|
function readToolCallPathSalt(codeName, homeDir) {
|
|
3523
3558
|
let file;
|
|
@@ -3528,7 +3563,7 @@ function readToolCallPathSalt(codeName, homeDir) {
|
|
|
3528
3563
|
}
|
|
3529
3564
|
try {
|
|
3530
3565
|
if (existsSync3(file)) {
|
|
3531
|
-
const existing =
|
|
3566
|
+
const existing = readFileSync12(file, "utf-8").trim();
|
|
3532
3567
|
if (SALT_RE.test(existing)) return existing;
|
|
3533
3568
|
}
|
|
3534
3569
|
} catch {
|
|
@@ -3554,7 +3589,7 @@ function readToolCallPathSalt(codeName, homeDir) {
|
|
|
3554
3589
|
import { statSync as statSync4 } from "fs";
|
|
3555
3590
|
|
|
3556
3591
|
// src/lib/host-archive-address.ts
|
|
3557
|
-
import { readFileSync as
|
|
3592
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
3558
3593
|
var DEFAULT_ARCHIVE_ADDRESS_PATH = "/var/lib/augmented/session-archive-address.json";
|
|
3559
3594
|
var CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
3560
3595
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -3570,7 +3605,7 @@ function readHostArchiveAddress(path) {
|
|
|
3570
3605
|
if (hit && now - hit.at < CACHE_TTL_MS) return hit.value;
|
|
3571
3606
|
let value = null;
|
|
3572
3607
|
try {
|
|
3573
|
-
const raw =
|
|
3608
|
+
const raw = readFileSync13(file, "utf-8");
|
|
3574
3609
|
const parsed = JSON.parse(raw);
|
|
3575
3610
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
3576
3611
|
const obj = parsed;
|
|
@@ -3593,8 +3628,8 @@ function readHostArchiveAddress(path) {
|
|
|
3593
3628
|
}
|
|
3594
3629
|
|
|
3595
3630
|
// src/lib/tool-call-extractor.ts
|
|
3596
|
-
import { closeSync, fstatSync, openSync, readFileSync as
|
|
3597
|
-
import { basename, join as
|
|
3631
|
+
import { closeSync, fstatSync, openSync, readFileSync as readFileSync14, readSync, readdirSync as readdirSync4 } from "fs";
|
|
3632
|
+
import { basename, join as join16, relative } from "path";
|
|
3598
3633
|
import { StringDecoder } from "string_decoder";
|
|
3599
3634
|
|
|
3600
3635
|
// src/lib/tool-call-redaction.ts
|
|
@@ -3723,7 +3758,7 @@ function redactToolTargetInner(toolName, input, ctx) {
|
|
|
3723
3758
|
var EXTRACTOR_VERSION = "e1";
|
|
3724
3759
|
function enumerateSessionTranscripts(transcriptDir, sessionId, projectsRoot) {
|
|
3725
3760
|
const files = [];
|
|
3726
|
-
const mainAbs =
|
|
3761
|
+
const mainAbs = join16(transcriptDir, `${sessionId}.jsonl`);
|
|
3727
3762
|
files.push({
|
|
3728
3763
|
absPath: mainAbs,
|
|
3729
3764
|
relPath: relative(projectsRoot, mainAbs),
|
|
@@ -3731,7 +3766,7 @@ function enumerateSessionTranscripts(transcriptDir, sessionId, projectsRoot) {
|
|
|
3731
3766
|
isSubagent: false,
|
|
3732
3767
|
subagentId: null
|
|
3733
3768
|
});
|
|
3734
|
-
const subDir =
|
|
3769
|
+
const subDir = join16(transcriptDir, sessionId, "subagents");
|
|
3735
3770
|
let entries;
|
|
3736
3771
|
try {
|
|
3737
3772
|
entries = readdirSync4(subDir);
|
|
@@ -3740,7 +3775,7 @@ function enumerateSessionTranscripts(transcriptDir, sessionId, projectsRoot) {
|
|
|
3740
3775
|
}
|
|
3741
3776
|
for (const name of entries) {
|
|
3742
3777
|
if (!name.endsWith(".jsonl")) continue;
|
|
3743
|
-
const abs =
|
|
3778
|
+
const abs = join16(subDir, name);
|
|
3744
3779
|
const stem = basename(name, ".jsonl");
|
|
3745
3780
|
files.push({
|
|
3746
3781
|
absPath: abs,
|
|
@@ -3925,9 +3960,9 @@ function extractTranscriptWindow(file, opts, from) {
|
|
|
3925
3960
|
}
|
|
3926
3961
|
|
|
3927
3962
|
// src/lib/tool-call-cursor.ts
|
|
3928
|
-
import { existsSync as existsSync4, readFileSync as
|
|
3929
|
-
import { homedir as
|
|
3930
|
-
import { join as
|
|
3963
|
+
import { existsSync as existsSync4, readFileSync as readFileSync15 } from "fs";
|
|
3964
|
+
import { homedir as homedir9 } from "os";
|
|
3965
|
+
import { join as join17 } from "path";
|
|
3931
3966
|
var COVERAGE_DISPOSITIONS = [
|
|
3932
3967
|
"ok",
|
|
3933
3968
|
"not_entitled",
|
|
@@ -3980,15 +4015,15 @@ function parseCursorKey(key) {
|
|
|
3980
4015
|
return { sessionId: sessionId.length > 0 ? sessionId : null, transcriptRef: key.slice(i + 1) };
|
|
3981
4016
|
}
|
|
3982
4017
|
function cursorStatePath(codeName, homeDir) {
|
|
3983
|
-
const home = homeDir ?? (process.env["HOME"]?.trim() ||
|
|
4018
|
+
const home = homeDir ?? (process.env["HOME"]?.trim() || homedir9());
|
|
3984
4019
|
const key = agentRuntimeKey(codeName, homeDir);
|
|
3985
|
-
return
|
|
4020
|
+
return join17(home, ".augmented", key, "tool-call-cursors.json");
|
|
3986
4021
|
}
|
|
3987
4022
|
function loadCursors(path) {
|
|
3988
4023
|
const out = /* @__PURE__ */ new Map();
|
|
3989
4024
|
if (!existsSync4(path)) return out;
|
|
3990
4025
|
try {
|
|
3991
|
-
const parsed = JSON.parse(
|
|
4026
|
+
const parsed = JSON.parse(readFileSync15(path, "utf-8"));
|
|
3992
4027
|
if (!parsed || parsed.version !== 1 || typeof parsed.files !== "object") return out;
|
|
3993
4028
|
for (const [k, v] of Object.entries(parsed.files)) {
|
|
3994
4029
|
if (!v || typeof v !== "object") continue;
|
|
@@ -4355,12 +4390,19 @@ async function maybeScanToolCalls(args) {
|
|
|
4355
4390
|
return;
|
|
4356
4391
|
}
|
|
4357
4392
|
state5.set(codeName, { lastCheckedAt: nowMs, notEntitledAt: existing?.notEntitledAt ?? null });
|
|
4393
|
+
const loggingMode = readAgentLoggingMode(codeName, args.homeDir);
|
|
4394
|
+
const hashOnly = loggingModeWithholdsTargets(loggingMode);
|
|
4395
|
+
if (loggingMode.mode === null) {
|
|
4396
|
+
log2(
|
|
4397
|
+
`[tool-call-audit] ${codeName}: charter logging_mode not established (${loggingMode.reason}) \u2014 withholding ALL targets for this agent`
|
|
4398
|
+
);
|
|
4399
|
+
}
|
|
4358
4400
|
const salt = readToolCallPathSalt(codeName, args.homeDir);
|
|
4359
|
-
if (!salt) {
|
|
4401
|
+
if (!salt && !hashOnly) {
|
|
4360
4402
|
log2(`[tool-call-audit] ${codeName}: no path-hash salt available \u2014 file targets withheld`);
|
|
4361
4403
|
}
|
|
4362
|
-
const home = args.homeDir ?? (process.env["HOME"]?.trim() ||
|
|
4363
|
-
const projectsRoot = args.projectsRoot ??
|
|
4404
|
+
const home = args.homeDir ?? (process.env["HOME"]?.trim() || homedir10());
|
|
4405
|
+
const projectsRoot = args.projectsRoot ?? join18(home, ".claude", "projects");
|
|
4364
4406
|
const transcriptDir = args.transcriptDir ?? sessionTranscriptDir(getProjectDir(codeName));
|
|
4365
4407
|
const current = peekCurrentSession(codeName);
|
|
4366
4408
|
const sessionIds = current ? [current.sessionId] : [];
|
|
@@ -4372,7 +4414,7 @@ async function maybeScanToolCalls(args) {
|
|
|
4372
4414
|
projectsRoot,
|
|
4373
4415
|
sessionIds,
|
|
4374
4416
|
pathHashSalt: salt ?? "",
|
|
4375
|
-
|
|
4417
|
+
hashOnly,
|
|
4376
4418
|
log: log2,
|
|
4377
4419
|
now: nowFn,
|
|
4378
4420
|
...args.homeDir === void 0 ? {} : { homeDir: args.homeDir },
|
|
@@ -4389,11 +4431,11 @@ async function maybeScanToolCalls(args) {
|
|
|
4389
4431
|
}
|
|
4390
4432
|
|
|
4391
4433
|
// src/lib/activity-cache-monitor.ts
|
|
4392
|
-
import { existsSync as existsSync5, readFileSync as
|
|
4393
|
-
import { homedir as
|
|
4394
|
-
import { join as
|
|
4434
|
+
import { existsSync as existsSync5, readFileSync as readFileSync16 } from "fs";
|
|
4435
|
+
import { homedir as homedir11 } from "os";
|
|
4436
|
+
import { join as join19 } from "path";
|
|
4395
4437
|
var MIN_CHECK_INTERVAL_MS7 = 6e4;
|
|
4396
|
-
var STATS_CACHE_PATH =
|
|
4438
|
+
var STATS_CACHE_PATH = join19(homedir11(), ".claude", "stats-cache.json");
|
|
4397
4439
|
var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
4398
4440
|
var state6 = { lastObservedDate: null, lastCheckedAt: 0 };
|
|
4399
4441
|
function selectNewDailyRows(raw, lastObservedDate) {
|
|
@@ -4441,7 +4483,7 @@ async function maybeReportActivityCache(args) {
|
|
|
4441
4483
|
}
|
|
4442
4484
|
let raw;
|
|
4443
4485
|
try {
|
|
4444
|
-
raw =
|
|
4486
|
+
raw = readFileSync16(STATS_CACHE_PATH, "utf-8");
|
|
4445
4487
|
} catch (err) {
|
|
4446
4488
|
log2(`[activity-cache] readFileSync failed: ${err.message}`);
|
|
4447
4489
|
return;
|
|
@@ -4666,18 +4708,18 @@ function computeChannelConfigHash(input) {
|
|
|
4666
4708
|
}
|
|
4667
4709
|
|
|
4668
4710
|
// src/lib/channel-hash-cache.ts
|
|
4669
|
-
import { existsSync as existsSync6, readFileSync as
|
|
4670
|
-
import { join as
|
|
4711
|
+
import { existsSync as existsSync6, readFileSync as readFileSync17, writeFileSync as writeFileSync7 } from "fs";
|
|
4712
|
+
import { join as join20 } from "path";
|
|
4671
4713
|
var CACHE_FILENAME = "channel-hash-cache.json";
|
|
4672
4714
|
function getChannelHashCacheFile(configDir) {
|
|
4673
|
-
return
|
|
4715
|
+
return join20(configDir, CACHE_FILENAME);
|
|
4674
4716
|
}
|
|
4675
4717
|
function loadChannelHashCache(target, configDir) {
|
|
4676
4718
|
const path = getChannelHashCacheFile(configDir);
|
|
4677
4719
|
if (!existsSync6(path)) return;
|
|
4678
4720
|
let parsed;
|
|
4679
4721
|
try {
|
|
4680
|
-
parsed = JSON.parse(
|
|
4722
|
+
parsed = JSON.parse(readFileSync17(path, "utf-8"));
|
|
4681
4723
|
} catch {
|
|
4682
4724
|
return;
|
|
4683
4725
|
}
|
|
@@ -4697,8 +4739,8 @@ function saveChannelHashCache(source, configDir) {
|
|
|
4697
4739
|
}
|
|
4698
4740
|
|
|
4699
4741
|
// src/lib/sender-policy-baseline.ts
|
|
4700
|
-
import { existsSync as existsSync7, readFileSync as
|
|
4701
|
-
import { join as
|
|
4742
|
+
import { existsSync as existsSync7, readFileSync as readFileSync18 } from "fs";
|
|
4743
|
+
import { join as join21 } from "path";
|
|
4702
4744
|
var BASELINE_FILENAME = "sender-policy-baseline.json";
|
|
4703
4745
|
var SENDER_POLICY_BASELINE_VERSION = 1;
|
|
4704
4746
|
var BASELINE_CONCERNS = ["senderPolicy", "slackBehaviour", "msteamsBehaviour"];
|
|
@@ -4710,14 +4752,14 @@ function createDeliveryBaselineMaps() {
|
|
|
4710
4752
|
};
|
|
4711
4753
|
}
|
|
4712
4754
|
function getSenderPolicyBaselineFile(configDir) {
|
|
4713
|
-
return
|
|
4755
|
+
return join21(configDir, BASELINE_FILENAME);
|
|
4714
4756
|
}
|
|
4715
4757
|
function loadSenderPolicyBaseline(target, configDir, log2) {
|
|
4716
4758
|
const path = getSenderPolicyBaselineFile(configDir);
|
|
4717
4759
|
if (!existsSync7(path)) return;
|
|
4718
4760
|
let parsed;
|
|
4719
4761
|
try {
|
|
4720
|
-
parsed = JSON.parse(
|
|
4762
|
+
parsed = JSON.parse(readFileSync18(path, "utf-8"));
|
|
4721
4763
|
} catch (err) {
|
|
4722
4764
|
log2?.(
|
|
4723
4765
|
`[sender-policy] discarding corrupt ${BASELINE_FILENAME} (${err.message}) - restrictive-policy agents will take one fail-closed restart`
|
|
@@ -5240,7 +5282,7 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash, options)
|
|
|
5240
5282
|
}
|
|
5241
5283
|
|
|
5242
5284
|
// src/lib/manager/integration-skill-cache.ts
|
|
5243
|
-
import { join as
|
|
5285
|
+
import { join as join22 } from "path";
|
|
5244
5286
|
function integrationSkillHashKey(agentId, skillId) {
|
|
5245
5287
|
return `plugin-skill:${agentId}:${skillId}`;
|
|
5246
5288
|
}
|
|
@@ -5256,21 +5298,21 @@ function forgetIntegrationSkill(cache3, agentId, skillId) {
|
|
|
5256
5298
|
function removeIntegrationSkillFolder(opts) {
|
|
5257
5299
|
forgetIntegrationSkill(opts.cache, opts.agentId, opts.entry);
|
|
5258
5300
|
for (const dir of opts.dirs) {
|
|
5259
|
-
opts.removeDir(
|
|
5301
|
+
opts.removeDir(join22(dir, opts.entry));
|
|
5260
5302
|
}
|
|
5261
5303
|
}
|
|
5262
5304
|
|
|
5263
5305
|
// src/lib/manager/managed-skill-manifest.ts
|
|
5264
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as
|
|
5265
|
-
import { dirname as dirname6, join as
|
|
5306
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync19, writeFileSync as writeFileSync8 } from "fs";
|
|
5307
|
+
import { dirname as dirname6, join as join23 } from "path";
|
|
5266
5308
|
var MANIFEST_VERSION = 1;
|
|
5267
5309
|
function managedSkillManifestPath(agentRootDir) {
|
|
5268
|
-
return
|
|
5310
|
+
return join23(agentRootDir, "managed-skills.json");
|
|
5269
5311
|
}
|
|
5270
5312
|
function readManagedSkillManifest(path) {
|
|
5271
5313
|
try {
|
|
5272
5314
|
if (!existsSync8(path)) return /* @__PURE__ */ new Set();
|
|
5273
|
-
const parsed = JSON.parse(
|
|
5315
|
+
const parsed = JSON.parse(readFileSync19(path, "utf-8"));
|
|
5274
5316
|
const ids = Array.isArray(parsed?.globalSkillIds) ? parsed.globalSkillIds : [];
|
|
5275
5317
|
return new Set(ids.filter((id) => typeof id === "string" && id.length > 0));
|
|
5276
5318
|
} catch {
|
|
@@ -5383,8 +5425,8 @@ function resolveModelChain(refreshData) {
|
|
|
5383
5425
|
|
|
5384
5426
|
// src/lib/manager/claude-auth.ts
|
|
5385
5427
|
import { existsSync as existsSync9, rmSync as rmSync3 } from "fs";
|
|
5386
|
-
import { join as
|
|
5387
|
-
import { homedir as
|
|
5428
|
+
import { join as join24 } from "path";
|
|
5429
|
+
import { homedir as homedir12 } from "os";
|
|
5388
5430
|
async function applyClaudeAuthToEnv(childEnv, label) {
|
|
5389
5431
|
const apiKey = getApiKey();
|
|
5390
5432
|
if (!apiKey) {
|
|
@@ -5396,9 +5438,9 @@ async function applyClaudeAuthToEnv(childEnv, label) {
|
|
|
5396
5438
|
throw new Error("claude_auth_mode=api_key but /host/exchange returned no decrypted key");
|
|
5397
5439
|
}
|
|
5398
5440
|
childEnv.ANTHROPIC_API_KEY = exchange.anthropicApiKey;
|
|
5399
|
-
const claudeDir =
|
|
5441
|
+
const claudeDir = join24(homedir12(), ".claude");
|
|
5400
5442
|
for (const filename of [".credentials.json", "credentials.json"]) {
|
|
5401
|
-
const p =
|
|
5443
|
+
const p = join24(claudeDir, filename);
|
|
5402
5444
|
if (existsSync9(p)) {
|
|
5403
5445
|
try {
|
|
5404
5446
|
rmSync3(p, { force: true });
|
|
@@ -5480,8 +5522,8 @@ function heartbeatRuntimeAuthFields(probeVerdict) {
|
|
|
5480
5522
|
}
|
|
5481
5523
|
|
|
5482
5524
|
// src/lib/manager/kanban/parsers.ts
|
|
5483
|
-
import { existsSync as existsSync10, readFileSync as
|
|
5484
|
-
import { join as
|
|
5525
|
+
import { existsSync as existsSync10, readFileSync as readFileSync20 } from "fs";
|
|
5526
|
+
import { join as join25 } from "path";
|
|
5485
5527
|
var STANDUP_TEMPLATES = /* @__PURE__ */ new Set(["daily-standup", "end-of-day-summary"]);
|
|
5486
5528
|
var TASK_UPDATE_TEMPLATES = /* @__PURE__ */ new Set(["hourly-status", "task-update"]);
|
|
5487
5529
|
var PLAN_TEMPLATES = /* @__PURE__ */ new Set(["morning-plan"]);
|
|
@@ -5633,12 +5675,12 @@ function getBuiltInSkillContent(skillId) {
|
|
|
5633
5675
|
if (builtInSkillCache.has(skillId)) return builtInSkillCache.get(skillId);
|
|
5634
5676
|
try {
|
|
5635
5677
|
const candidates = [
|
|
5636
|
-
|
|
5637
|
-
|
|
5678
|
+
join25(process.cwd(), "skills", skillId, "SKILL.md"),
|
|
5679
|
+
join25(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
|
|
5638
5680
|
];
|
|
5639
5681
|
for (const candidate of candidates) {
|
|
5640
5682
|
if (existsSync10(candidate)) {
|
|
5641
|
-
const content =
|
|
5683
|
+
const content = readFileSync20(candidate, "utf-8");
|
|
5642
5684
|
const files = [{ relativePath: "SKILL.md", content }];
|
|
5643
5685
|
builtInSkillCache.set(skillId, files);
|
|
5644
5686
|
return files;
|
|
@@ -5779,19 +5821,19 @@ function formatBoardForPrompt(items, template) {
|
|
|
5779
5821
|
}
|
|
5780
5822
|
|
|
5781
5823
|
// src/lib/manager/kanban/nudge-state-cache.ts
|
|
5782
|
-
import { existsSync as existsSync11, readFileSync as
|
|
5783
|
-
import { join as
|
|
5824
|
+
import { existsSync as existsSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
|
|
5825
|
+
import { join as join26 } from "path";
|
|
5784
5826
|
var CACHE_FILENAME2 = "kanban-nudge-state.json";
|
|
5785
5827
|
var KANBAN_NUDGE_STATE_VERSION = 1;
|
|
5786
5828
|
function getKanbanNudgeStateFile(configDir) {
|
|
5787
|
-
return
|
|
5829
|
+
return join26(configDir, CACHE_FILENAME2);
|
|
5788
5830
|
}
|
|
5789
5831
|
function loadKanbanNudgeState(target, configDir) {
|
|
5790
5832
|
const path = getKanbanNudgeStateFile(configDir);
|
|
5791
5833
|
if (!existsSync11(path)) return;
|
|
5792
5834
|
let parsed;
|
|
5793
5835
|
try {
|
|
5794
|
-
parsed = JSON.parse(
|
|
5836
|
+
parsed = JSON.parse(readFileSync21(path, "utf-8"));
|
|
5795
5837
|
} catch {
|
|
5796
5838
|
return;
|
|
5797
5839
|
}
|
|
@@ -6398,9 +6440,9 @@ function closeScheduledRunsForCode(codeName, outcome, reason) {
|
|
|
6398
6440
|
|
|
6399
6441
|
// src/lib/manager/scheduler/kanban-route.ts
|
|
6400
6442
|
import { createHash as createHash12 } from "crypto";
|
|
6401
|
-
import { writeFileSync as writeFileSync10, renameSync as renameSync4, mkdirSync as mkdirSync7, readFileSync as
|
|
6402
|
-
import { homedir as
|
|
6403
|
-
import { join as
|
|
6443
|
+
import { writeFileSync as writeFileSync10, renameSync as renameSync4, mkdirSync as mkdirSync7, readFileSync as readFileSync22, unlinkSync as unlinkSync2 } from "fs";
|
|
6444
|
+
import { homedir as homedir13 } from "os";
|
|
6445
|
+
import { join as join27, dirname as dirname7 } from "path";
|
|
6404
6446
|
|
|
6405
6447
|
// src/lib/manager/scheduler/notify.ts
|
|
6406
6448
|
import { createHash as createHash11 } from "crypto";
|
|
@@ -6759,7 +6801,7 @@ function resolveScheduledSlackTarget(task) {
|
|
|
6759
6801
|
}
|
|
6760
6802
|
function stampScheduledTurnMarker(codeName, taskId, target) {
|
|
6761
6803
|
try {
|
|
6762
|
-
const file =
|
|
6804
|
+
const file = join27(homedir13(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
|
|
6763
6805
|
const marker = { ts: Date.now(), task_id: taskId, ...target ? { target } : {} };
|
|
6764
6806
|
const tmp = `${file}.tmp`;
|
|
6765
6807
|
writeFileSync10(tmp, JSON.stringify(marker), "utf8");
|
|
@@ -6769,9 +6811,9 @@ function stampScheduledTurnMarker(codeName, taskId, target) {
|
|
|
6769
6811
|
}
|
|
6770
6812
|
}
|
|
6771
6813
|
function clearScheduledTurnMarkerForTask(codeName, taskId) {
|
|
6772
|
-
const file =
|
|
6814
|
+
const file = join27(homedir13(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
|
|
6773
6815
|
try {
|
|
6774
|
-
const raw = JSON.parse(
|
|
6816
|
+
const raw = JSON.parse(readFileSync22(file, "utf8"));
|
|
6775
6817
|
if (typeof raw?.task_id !== "string" || raw.task_id !== taskId) return;
|
|
6776
6818
|
unlinkSync2(file);
|
|
6777
6819
|
log(`[scheduled-kanban] scheduled-turn marker cleared for '${codeName}' (task ${taskId} complete)`);
|
|
@@ -6831,7 +6873,7 @@ async function routeScheduledTaskViaKanban(codeName, agentId, task, prompt, dura
|
|
|
6831
6873
|
return false;
|
|
6832
6874
|
}
|
|
6833
6875
|
try {
|
|
6834
|
-
const doorbell = directChatDoorbellPath(agentId,
|
|
6876
|
+
const doorbell = directChatDoorbellPath(agentId, homedir13());
|
|
6835
6877
|
mkdirSync7(dirname7(doorbell), { recursive: true });
|
|
6836
6878
|
writeFileSync10(doorbell, String(Date.now()));
|
|
6837
6879
|
} catch (err) {
|
|
@@ -6983,12 +7025,12 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
6983
7025
|
|
|
6984
7026
|
// src/lib/manager/scheduler/execution.ts
|
|
6985
7027
|
import { createHash as createHash13 } from "crypto";
|
|
6986
|
-
import { homedir as
|
|
6987
|
-
import { join as
|
|
7028
|
+
import { homedir as homedir14 } from "os";
|
|
7029
|
+
import { join as join29 } from "path";
|
|
6988
7030
|
|
|
6989
7031
|
// src/lib/agent-serving-probe.ts
|
|
6990
|
-
import { readFileSync as
|
|
6991
|
-
import { join as
|
|
7032
|
+
import { readFileSync as readFileSync23, readdirSync as readdirSync5, statSync as statSync5 } from "fs";
|
|
7033
|
+
import { join as join28 } from "path";
|
|
6992
7034
|
var RATE_LIMIT_WINDOW_MS = 6 * 60 * 60 * 1e3;
|
|
6993
7035
|
function probeRateLimit(args) {
|
|
6994
7036
|
const now = args.now ?? /* @__PURE__ */ new Date();
|
|
@@ -7004,7 +7046,7 @@ function probeRateLimit(args) {
|
|
|
7004
7046
|
let newest = UNKNOWN_RATE_LIMIT;
|
|
7005
7047
|
for (const name of entries) {
|
|
7006
7048
|
if (!name.endsWith(".jsonl")) continue;
|
|
7007
|
-
const path =
|
|
7049
|
+
const path = join28(dir, name);
|
|
7008
7050
|
try {
|
|
7009
7051
|
const st = statSync5(path);
|
|
7010
7052
|
if (!st.isFile() || st.mtimeMs < startMs) continue;
|
|
@@ -7013,7 +7055,7 @@ function probeRateLimit(args) {
|
|
|
7013
7055
|
}
|
|
7014
7056
|
let content;
|
|
7015
7057
|
try {
|
|
7016
|
-
content =
|
|
7058
|
+
content = readFileSync23(path, "utf-8");
|
|
7017
7059
|
} catch {
|
|
7018
7060
|
continue;
|
|
7019
7061
|
}
|
|
@@ -7075,7 +7117,7 @@ function shouldLogUsageCapDeferral(site, codeName, limitedUntil) {
|
|
|
7075
7117
|
|
|
7076
7118
|
// src/lib/manager/scheduler/execution.ts
|
|
7077
7119
|
function claudePidFilePath() {
|
|
7078
|
-
return
|
|
7120
|
+
return join29(homedir14(), ".augmented", "manager-claude-pids.json");
|
|
7079
7121
|
}
|
|
7080
7122
|
var inFlightClaudePids = /* @__PURE__ */ new Map();
|
|
7081
7123
|
function registerClaudeSpawn(record) {
|
|
@@ -7146,7 +7188,7 @@ async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData
|
|
|
7146
7188
|
|
|
7147
7189
|
// src/lib/occupancy-gate.ts
|
|
7148
7190
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync6, readSync as readSync2, statSync as statSync6 } from "fs";
|
|
7149
|
-
import { join as
|
|
7191
|
+
import { join as join30 } from "path";
|
|
7150
7192
|
var TAIL_BYTES = 256 * 1024;
|
|
7151
7193
|
var MAX_RECORD_ALIGN_BYTES = 8 * 1024 * 1024;
|
|
7152
7194
|
var GATE_MAX_BUCKET_AGE_MS = 30 * 6e4;
|
|
@@ -7232,10 +7274,10 @@ function candidateTranscriptPaths(dir) {
|
|
|
7232
7274
|
let complete = true;
|
|
7233
7275
|
for (const name of top) {
|
|
7234
7276
|
if (name.endsWith(".jsonl")) {
|
|
7235
|
-
paths.push(
|
|
7277
|
+
paths.push(join30(dir, name));
|
|
7236
7278
|
continue;
|
|
7237
7279
|
}
|
|
7238
|
-
const subDir =
|
|
7280
|
+
const subDir = join30(dir, name, "subagents");
|
|
7239
7281
|
let subs;
|
|
7240
7282
|
try {
|
|
7241
7283
|
subs = readdirSync6(subDir);
|
|
@@ -7244,7 +7286,7 @@ function candidateTranscriptPaths(dir) {
|
|
|
7244
7286
|
continue;
|
|
7245
7287
|
}
|
|
7246
7288
|
for (const sub of subs) {
|
|
7247
|
-
if (sub.endsWith(".jsonl")) paths.push(
|
|
7289
|
+
if (sub.endsWith(".jsonl")) paths.push(join30(subDir, sub));
|
|
7248
7290
|
}
|
|
7249
7291
|
}
|
|
7250
7292
|
return { paths, complete };
|
|
@@ -8517,9 +8559,9 @@ async function fireOpencodeScheduledTask(agent, task) {
|
|
|
8517
8559
|
|
|
8518
8560
|
// src/lib/opencode-telegram-ingest.ts
|
|
8519
8561
|
import { createHash as createHash16 } from "crypto";
|
|
8520
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync8, readFileSync as
|
|
8562
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync8, readFileSync as readFileSync24, renameSync as renameSync5, unlinkSync as unlinkSync3, writeFileSync as writeFileSync11 } from "fs";
|
|
8521
8563
|
import { randomUUID } from "crypto";
|
|
8522
|
-
import { join as
|
|
8564
|
+
import { join as join31 } from "path";
|
|
8523
8565
|
|
|
8524
8566
|
// src/lib/telegram-ingest.ts
|
|
8525
8567
|
import https2 from "https";
|
|
@@ -9067,7 +9109,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
|
|
|
9067
9109
|
let filePath;
|
|
9068
9110
|
try {
|
|
9069
9111
|
dir = getFramework("opencode").getAgentDir(codeName);
|
|
9070
|
-
filePath =
|
|
9112
|
+
filePath = join31(dir, "telegram-getupdates-offset-opencode.json");
|
|
9071
9113
|
} catch {
|
|
9072
9114
|
dir = null;
|
|
9073
9115
|
filePath = null;
|
|
@@ -9076,7 +9118,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
|
|
|
9076
9118
|
load() {
|
|
9077
9119
|
if (!filePath) return 0;
|
|
9078
9120
|
try {
|
|
9079
|
-
const parsed = JSON.parse(
|
|
9121
|
+
const parsed = JSON.parse(readFileSync24(filePath, "utf-8"));
|
|
9080
9122
|
if (currentBotId != null && typeof parsed?.bot_id === "number" && parsed.bot_id !== currentBotId) {
|
|
9081
9123
|
log2(`[telegram-ingest:${codeName}] offset cursor belongs to a different bot; ignoring (bot swap)`);
|
|
9082
9124
|
return 0;
|
|
@@ -9346,15 +9388,15 @@ function partitionActionableByPoison(actionable, states, config2) {
|
|
|
9346
9388
|
}
|
|
9347
9389
|
|
|
9348
9390
|
// src/lib/restart-flags.ts
|
|
9349
|
-
import { existsSync as existsSync13, mkdirSync as mkdirSync9, readdirSync as readdirSync7, readFileSync as
|
|
9350
|
-
import { homedir as
|
|
9351
|
-
import { join as
|
|
9391
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync9, readdirSync as readdirSync7, readFileSync as readFileSync25, renameSync as renameSync6, rmSync as rmSync4, writeFileSync as writeFileSync12 } from "fs";
|
|
9392
|
+
import { homedir as homedir15 } from "os";
|
|
9393
|
+
import { join as join32 } from "path";
|
|
9352
9394
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
9353
9395
|
function restartFlagsDir() {
|
|
9354
|
-
return
|
|
9396
|
+
return join32(homedir15(), ".augmented", "restart-flags");
|
|
9355
9397
|
}
|
|
9356
9398
|
function flagPath(codeName) {
|
|
9357
|
-
return
|
|
9399
|
+
return join32(restartFlagsDir(), `${codeName}.flag`);
|
|
9358
9400
|
}
|
|
9359
9401
|
function readRestartFlags() {
|
|
9360
9402
|
const dir = restartFlagsDir();
|
|
@@ -9363,7 +9405,7 @@ function readRestartFlags() {
|
|
|
9363
9405
|
for (const entry of readdirSync7(dir)) {
|
|
9364
9406
|
if (!entry.endsWith(".flag")) continue;
|
|
9365
9407
|
try {
|
|
9366
|
-
const raw =
|
|
9408
|
+
const raw = readFileSync25(join32(dir, entry), "utf8");
|
|
9367
9409
|
const parsed = JSON.parse(raw);
|
|
9368
9410
|
if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
|
|
9369
9411
|
parsed.codeName = entry.replace(/\.flag$/, "");
|
|
@@ -9481,8 +9523,8 @@ async function sendError(flag, opts, text) {
|
|
|
9481
9523
|
}
|
|
9482
9524
|
|
|
9483
9525
|
// src/lib/restart-context.ts
|
|
9484
|
-
import { readdirSync as readdirSync8, readFileSync as
|
|
9485
|
-
import { dirname as dirname8, join as
|
|
9526
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync26, writeFileSync as writeFileSync13, mkdirSync as mkdirSync10, unlinkSync as unlinkSync4 } from "fs";
|
|
9527
|
+
import { dirname as dirname8, join as join33 } from "path";
|
|
9486
9528
|
var SLACK_PENDING_INBOUND_DIRNAME = "slack-pending-inbound";
|
|
9487
9529
|
var SLACK_RESTART_CONTEXT_DIRNAME = "slack-restart-context";
|
|
9488
9530
|
var MAX_TOPIC_CHARS = 140;
|
|
@@ -9494,10 +9536,10 @@ function augmentedAgentDir(codeName) {
|
|
|
9494
9536
|
return dirname8(getProjectDir(codeName));
|
|
9495
9537
|
}
|
|
9496
9538
|
function slackPendingInboundDir(codeName) {
|
|
9497
|
-
return
|
|
9539
|
+
return join33(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
|
|
9498
9540
|
}
|
|
9499
9541
|
function slackRestartContextDir(codeName) {
|
|
9500
|
-
return
|
|
9542
|
+
return join33(augmentedAgentDir(codeName), SLACK_RESTART_CONTEXT_DIRNAME);
|
|
9501
9543
|
}
|
|
9502
9544
|
function sanitizeTopic(raw) {
|
|
9503
9545
|
const cleaned = raw.replace(/\s+/g, " ").trim().replace(/[<>]/g, " ").replace(/\s+/g, " ").trim();
|
|
@@ -9539,7 +9581,7 @@ function safeReaddir(dir) {
|
|
|
9539
9581
|
}
|
|
9540
9582
|
function readStrandedMarker(path) {
|
|
9541
9583
|
try {
|
|
9542
|
-
const parsed = JSON.parse(
|
|
9584
|
+
const parsed = JSON.parse(readFileSync26(path, "utf-8"));
|
|
9543
9585
|
if (typeof parsed.channel === "string" && typeof parsed.thread_ts === "string") {
|
|
9544
9586
|
return { channel: parsed.channel, thread_ts: parsed.thread_ts };
|
|
9545
9587
|
}
|
|
@@ -9557,7 +9599,7 @@ function pruneHintsExcept(codeName, freshFilenames) {
|
|
|
9557
9599
|
if (!filename.endsWith(".json")) continue;
|
|
9558
9600
|
if (freshFilenames.has(filename)) continue;
|
|
9559
9601
|
try {
|
|
9560
|
-
unlinkSync4(
|
|
9602
|
+
unlinkSync4(join33(ctxDir, filename));
|
|
9561
9603
|
} catch {
|
|
9562
9604
|
}
|
|
9563
9605
|
}
|
|
@@ -9578,7 +9620,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
|
|
|
9578
9620
|
}
|
|
9579
9621
|
const markers = [];
|
|
9580
9622
|
for (const filename of markerFilenames.slice(0, cap)) {
|
|
9581
|
-
const parsed = readStrandedMarker(
|
|
9623
|
+
const parsed = readStrandedMarker(join33(markerDir, filename));
|
|
9582
9624
|
if (parsed) markers.push({ filename, channel: parsed.channel, thread_ts: parsed.thread_ts });
|
|
9583
9625
|
}
|
|
9584
9626
|
if (markers.length === 0) {
|
|
@@ -9592,7 +9634,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
|
|
|
9592
9634
|
const freshFilenames = /* @__PURE__ */ new Set();
|
|
9593
9635
|
for (const { filename, hint } of hints) {
|
|
9594
9636
|
try {
|
|
9595
|
-
writeHintFile(
|
|
9637
|
+
writeHintFile(join33(ctxDir, filename), ctxDir, hint);
|
|
9596
9638
|
freshFilenames.add(filename);
|
|
9597
9639
|
} catch (err) {
|
|
9598
9640
|
log2(`[restart-context] ${codeName}: hint write failed for ${filename}: ${err.message}`);
|
|
@@ -11109,7 +11151,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
|
|
|
11109
11151
|
var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
|
|
11110
11152
|
function projectMcpHash(_codeName, projectDir) {
|
|
11111
11153
|
try {
|
|
11112
|
-
const raw =
|
|
11154
|
+
const raw = readFileSync27(join34(projectDir, ".mcp.json"), "utf-8");
|
|
11113
11155
|
return createHash17("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
|
|
11114
11156
|
} catch {
|
|
11115
11157
|
return null;
|
|
@@ -11117,7 +11159,7 @@ function projectMcpHash(_codeName, projectDir) {
|
|
|
11117
11159
|
}
|
|
11118
11160
|
function projectMcpKeys(_codeName, projectDir) {
|
|
11119
11161
|
try {
|
|
11120
|
-
const raw =
|
|
11162
|
+
const raw = readFileSync27(join34(projectDir, ".mcp.json"), "utf-8");
|
|
11121
11163
|
const parsed = JSON.parse(raw);
|
|
11122
11164
|
const servers = parsed.mcpServers;
|
|
11123
11165
|
if (!servers || typeof servers !== "object") return /* @__PURE__ */ new Set();
|
|
@@ -11135,7 +11177,7 @@ function seedSessionLaunchBaselines(codeName, projectDir) {
|
|
|
11135
11177
|
else runningMcpServerKeys.delete(codeName);
|
|
11136
11178
|
let launchStructure = null;
|
|
11137
11179
|
try {
|
|
11138
|
-
const raw =
|
|
11180
|
+
const raw = readFileSync27(join34(projectDir, ".mcp.json"), "utf-8");
|
|
11139
11181
|
launchStructure = managedMcpStructureHashFromFile(
|
|
11140
11182
|
JSON.parse(raw),
|
|
11141
11183
|
isManagedMcpServerKey
|
|
@@ -11245,7 +11287,7 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
|
|
|
11245
11287
|
if (result && result.rebindCandidates.length > 0 && hostFlagStore().getBoolean("session-tool-rebind")) {
|
|
11246
11288
|
let mcpJsonForRebind = null;
|
|
11247
11289
|
try {
|
|
11248
|
-
mcpJsonForRebind = JSON.parse(
|
|
11290
|
+
mcpJsonForRebind = JSON.parse(readFileSync27(join34(projectDir, ".mcp.json"), "utf-8"));
|
|
11249
11291
|
} catch {
|
|
11250
11292
|
mcpJsonForRebind = null;
|
|
11251
11293
|
}
|
|
@@ -11389,7 +11431,7 @@ function checkMcpConfigDriftAndScheduleRestart(codeName, projectDir) {
|
|
|
11389
11431
|
function projectChannelSecretHash(projectDir) {
|
|
11390
11432
|
try {
|
|
11391
11433
|
const entries = parseEnvIntegrations(
|
|
11392
|
-
|
|
11434
|
+
readFileSync27(join34(projectDir, ".env.integrations"), "utf-8")
|
|
11393
11435
|
);
|
|
11394
11436
|
return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
|
|
11395
11437
|
} catch {
|
|
@@ -11485,7 +11527,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
11485
11527
|
var lastVersionCheckAt = 0;
|
|
11486
11528
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
11487
11529
|
var lastResponsivenessProbeAt = 0;
|
|
11488
|
-
var agtCliVersion = true ? "0.28.
|
|
11530
|
+
var agtCliVersion = true ? "0.28.570" : "dev";
|
|
11489
11531
|
function resolveBrewPath(execFileSync2) {
|
|
11490
11532
|
try {
|
|
11491
11533
|
const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -11818,7 +11860,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
|
|
|
11818
11860
|
try {
|
|
11819
11861
|
let settings = {};
|
|
11820
11862
|
if (existsSync14(path)) {
|
|
11821
|
-
const raw =
|
|
11863
|
+
const raw = readFileSync27(path, "utf-8").trim();
|
|
11822
11864
|
if (raw) {
|
|
11823
11865
|
let parsed;
|
|
11824
11866
|
try {
|
|
@@ -11873,7 +11915,7 @@ async function ensureOpencodeBinary() {
|
|
|
11873
11915
|
try {
|
|
11874
11916
|
const prefix = execFileSync2("npm", ["prefix", "-g"], { encoding: "utf-8", timeout: 1e4 }).trim();
|
|
11875
11917
|
if (prefix) {
|
|
11876
|
-
const npmBin =
|
|
11918
|
+
const npmBin = join34(prefix, "bin");
|
|
11877
11919
|
const current = (process.env.PATH ?? "").split(pathDelimiter);
|
|
11878
11920
|
if (!current.includes(npmBin)) {
|
|
11879
11921
|
process.env.PATH = [npmBin, ...current.filter(Boolean)].join(pathDelimiter);
|
|
@@ -11990,7 +12032,7 @@ ${r.stderr}`;
|
|
|
11990
12032
|
}
|
|
11991
12033
|
var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
11992
12034
|
function selfUpdateAppliedMarkerPath() {
|
|
11993
|
-
return
|
|
12035
|
+
return join34(homedir16(), ".augmented", ".last-self-update-applied");
|
|
11994
12036
|
}
|
|
11995
12037
|
var selfUpdateUpToDateLogged = false;
|
|
11996
12038
|
var selfUpdatePinnedLogged = false;
|
|
@@ -12019,7 +12061,7 @@ async function checkAndUpdateCli(opts) {
|
|
|
12019
12061
|
const isNpmGlobal = !isBrewFormula && resolvedPath.includes("node_modules");
|
|
12020
12062
|
if (!isBrewFormula && !isNpmGlobal) return "noop";
|
|
12021
12063
|
const { readFileSync: readF, writeFileSync: writeF } = await import("fs");
|
|
12022
|
-
const markerPath =
|
|
12064
|
+
const markerPath = join34(homedir16(), ".augmented", ".last-update-check");
|
|
12023
12065
|
if (!force) {
|
|
12024
12066
|
try {
|
|
12025
12067
|
const lastCheck = parseInt(readF(markerPath, "utf-8").trim(), 10);
|
|
@@ -12425,7 +12467,7 @@ async function runClaudeRuntimeAuthProbe() {
|
|
|
12425
12467
|
];
|
|
12426
12468
|
try {
|
|
12427
12469
|
const { stdout, stderr } = await execFilePromiseLong(resolveClaudeBinary(), args, {
|
|
12428
|
-
cwd:
|
|
12470
|
+
cwd: homedir16(),
|
|
12429
12471
|
timeout: RUNTIME_AUTH_PROBE_TIMEOUT_MS,
|
|
12430
12472
|
stdin: "ignore",
|
|
12431
12473
|
env: childEnv,
|
|
@@ -12472,12 +12514,12 @@ async function checkClaudeAuth() {
|
|
|
12472
12514
|
var evalEmptyMcpConfigPath = null;
|
|
12473
12515
|
function ensureEvalEmptyMcpConfig() {
|
|
12474
12516
|
if (evalEmptyMcpConfigPath && existsSync14(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
|
|
12475
|
-
const dir =
|
|
12517
|
+
const dir = join34(homedir16(), ".augmented");
|
|
12476
12518
|
try {
|
|
12477
12519
|
mkdirSync11(dir, { recursive: true });
|
|
12478
12520
|
} catch {
|
|
12479
12521
|
}
|
|
12480
|
-
const p =
|
|
12522
|
+
const p = join34(dir, ".eval-empty-mcp.json");
|
|
12481
12523
|
writeFileSync14(p, JSON.stringify({ mcpServers: {} }));
|
|
12482
12524
|
evalEmptyMcpConfigPath = p;
|
|
12483
12525
|
return p;
|
|
@@ -12503,7 +12545,7 @@ async function runEvalClaude(prompt, model) {
|
|
|
12503
12545
|
""
|
|
12504
12546
|
];
|
|
12505
12547
|
const { stdout } = await execFilePromiseLong(resolveClaudeBinary(), args, {
|
|
12506
|
-
cwd:
|
|
12548
|
+
cwd: homedir16(),
|
|
12507
12549
|
timeout: 12e4,
|
|
12508
12550
|
stdin: "ignore",
|
|
12509
12551
|
env: childEnv,
|
|
@@ -12572,10 +12614,10 @@ function resolveConversationEvalBackend() {
|
|
|
12572
12614
|
return conversationEvalBackend;
|
|
12573
12615
|
}
|
|
12574
12616
|
function getStateFile() {
|
|
12575
|
-
return
|
|
12617
|
+
return join34(config?.configDir ?? join34(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
|
|
12576
12618
|
}
|
|
12577
12619
|
function channelHashCacheDir() {
|
|
12578
|
-
return config?.configDir ??
|
|
12620
|
+
return config?.configDir ?? join34(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
12579
12621
|
}
|
|
12580
12622
|
function loadChannelHashCache2() {
|
|
12581
12623
|
loadChannelHashCache(agentState.knownChannelConfigHashes, channelHashCacheDir());
|
|
@@ -12629,7 +12671,7 @@ function removeDeliveryBaselineEntries(agentId) {
|
|
|
12629
12671
|
var _channelQuarantineStore = null;
|
|
12630
12672
|
function channelQuarantineStore() {
|
|
12631
12673
|
if (!_channelQuarantineStore) {
|
|
12632
|
-
const dir = config?.configDir ??
|
|
12674
|
+
const dir = config?.configDir ?? join34(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
12633
12675
|
_channelQuarantineStore = new ChannelQuarantineStore(defaultQuarantinePath(dir));
|
|
12634
12676
|
}
|
|
12635
12677
|
return _channelQuarantineStore;
|
|
@@ -12646,7 +12688,7 @@ function claudeMdSizeFor(codeName) {
|
|
|
12646
12688
|
var _hostFlagStore = null;
|
|
12647
12689
|
function hostFlagStore() {
|
|
12648
12690
|
if (!_hostFlagStore) {
|
|
12649
|
-
const dir = config?.configDir ??
|
|
12691
|
+
const dir = config?.configDir ?? join34(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
12650
12692
|
_hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
|
|
12651
12693
|
}
|
|
12652
12694
|
return _hostFlagStore;
|
|
@@ -12720,12 +12762,12 @@ function parseSkillFrontmatter(content) {
|
|
|
12720
12762
|
}
|
|
12721
12763
|
async function refreshSkillsIndexInClaudeMd(configDir, codeName, log2) {
|
|
12722
12764
|
const { readdirSync: readdirSync10, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync15 } = await import("fs");
|
|
12723
|
-
const skillsDir =
|
|
12724
|
-
const claudeMdPath =
|
|
12765
|
+
const skillsDir = join34(configDir, codeName, "project", ".claude", "skills");
|
|
12766
|
+
const claudeMdPath = join34(configDir, codeName, "project", "CLAUDE.md");
|
|
12725
12767
|
if (!ex(skillsDir) || !ex(claudeMdPath)) return;
|
|
12726
12768
|
const entries = [];
|
|
12727
12769
|
for (const dir of readdirSync10(skillsDir).sort()) {
|
|
12728
|
-
const skillFile =
|
|
12770
|
+
const skillFile = join34(skillsDir, dir, "SKILL.md");
|
|
12729
12771
|
if (!ex(skillFile)) continue;
|
|
12730
12772
|
try {
|
|
12731
12773
|
const { name, description } = parseSkillFrontmatter(rfs(skillFile, "utf-8"));
|
|
@@ -12792,7 +12834,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
12792
12834
|
if (codeNames.length === 0) return;
|
|
12793
12835
|
void (async () => {
|
|
12794
12836
|
try {
|
|
12795
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
12837
|
+
const { collectDiagnostics } = await import("../persistent-session-HY6GUPBQ.js");
|
|
12796
12838
|
await api.post("/host/heartbeat", {
|
|
12797
12839
|
host_id: hostId,
|
|
12798
12840
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics)
|
|
@@ -12900,7 +12942,7 @@ async function pollCycle() {
|
|
|
12900
12942
|
}
|
|
12901
12943
|
try {
|
|
12902
12944
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
12903
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
12945
|
+
const { collectDiagnostics } = await import("../persistent-session-HY6GUPBQ.js");
|
|
12904
12946
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
12905
12947
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics) : void 0;
|
|
12906
12948
|
let tailscaleHostname;
|
|
@@ -13023,7 +13065,7 @@ async function pollCycle() {
|
|
|
13023
13065
|
collectPanelessActivityProbes,
|
|
13024
13066
|
getResponsivenessIntervalMs,
|
|
13025
13067
|
occupancyQualificationClassifications
|
|
13026
|
-
} = await import("../responsiveness-probe-
|
|
13068
|
+
} = await import("../responsiveness-probe-6EEZKJVV.js");
|
|
13027
13069
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
13028
13070
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
13029
13071
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -13114,7 +13156,7 @@ async function pollCycle() {
|
|
|
13114
13156
|
collectResponsivenessProbes,
|
|
13115
13157
|
livePendingInboundOldestAgeSeconds,
|
|
13116
13158
|
parkPendingInbound
|
|
13117
|
-
} = await import("../responsiveness-probe-
|
|
13159
|
+
} = await import("../responsiveness-probe-6EEZKJVV.js");
|
|
13118
13160
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
|
|
13119
13161
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
13120
13162
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -13203,13 +13245,13 @@ async function pollCycle() {
|
|
|
13203
13245
|
);
|
|
13204
13246
|
if (hostFlagStore().getBoolean("wedge-transient-notice")) {
|
|
13205
13247
|
try {
|
|
13206
|
-
const paneTail =
|
|
13248
|
+
const paneTail = readFileSync27(paneLogPath(codeName), "utf8").slice(-65536);
|
|
13207
13249
|
const transient = detectTransientApiErrorInLog(paneTail);
|
|
13208
13250
|
if (transient) {
|
|
13209
|
-
const wedgeHome =
|
|
13251
|
+
const wedgeHome = join34(homedir16(), ".augmented", codeName);
|
|
13210
13252
|
if (existsSync14(wedgeHome)) {
|
|
13211
13253
|
atomicWriteFileSync(
|
|
13212
|
-
|
|
13254
|
+
join34(wedgeHome, "watchdog-give-up.json"),
|
|
13213
13255
|
JSON.stringify({
|
|
13214
13256
|
gave_up_at: wedgeNow.toISOString(),
|
|
13215
13257
|
reason: "transient_overload"
|
|
@@ -13490,7 +13532,7 @@ async function pollCycle() {
|
|
|
13490
13532
|
const adapter = resolveAgentFramework(prev.codeName);
|
|
13491
13533
|
stopAgentRuntime2(prev.codeName, "removed-from-host");
|
|
13492
13534
|
killAgentChannelProcesses(prev.codeName, { log });
|
|
13493
|
-
const agentDir =
|
|
13535
|
+
const agentDir = join34(adapter.getAgentDir(prev.codeName), "provision");
|
|
13494
13536
|
await cleanupAgentFiles(prev.codeName, agentDir);
|
|
13495
13537
|
clearAgentCaches(prev.agentId, prev.codeName);
|
|
13496
13538
|
}
|
|
@@ -13577,10 +13619,10 @@ async function pollCycle() {
|
|
|
13577
13619
|
// pending-inbound marker. Best-effort: a write failure is logged by
|
|
13578
13620
|
// the watchdog, never fails the poll cycle.
|
|
13579
13621
|
signalGiveUp: (codeName) => {
|
|
13580
|
-
const dir =
|
|
13622
|
+
const dir = join34(homedir16(), ".augmented", codeName);
|
|
13581
13623
|
if (!existsSync14(dir)) return;
|
|
13582
13624
|
atomicWriteFileSync(
|
|
13583
|
-
|
|
13625
|
+
join34(dir, "watchdog-give-up.json"),
|
|
13584
13626
|
JSON.stringify({ gave_up_at: (/* @__PURE__ */ new Date()).toISOString() })
|
|
13585
13627
|
);
|
|
13586
13628
|
}
|
|
@@ -13736,7 +13778,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13736
13778
|
}
|
|
13737
13779
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
13738
13780
|
const adapter = resolveAgentFramework(agent.code_name);
|
|
13739
|
-
let agentDir =
|
|
13781
|
+
let agentDir = join34(adapter.getAgentDir(agent.code_name), "provision");
|
|
13740
13782
|
if (agent.status === "draft" || agent.status === "paused") {
|
|
13741
13783
|
if (previousKnownStatus !== agent.status) {
|
|
13742
13784
|
log(`Agent '${agent.code_name}' is ${agent.status}, skipping provisioning`);
|
|
@@ -13910,7 +13952,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13910
13952
|
const frameworkId = refreshData.agent.framework ?? DEFAULT_FRAMEWORK;
|
|
13911
13953
|
agentFrameworkCache.set(agent.code_name, frameworkId);
|
|
13912
13954
|
const frameworkAdapter = getFramework(frameworkId);
|
|
13913
|
-
agentDir =
|
|
13955
|
+
agentDir = join34(frameworkAdapter.getAgentDir(agent.code_name), "provision");
|
|
13914
13956
|
cacheAgentDeliveryMetadata(agent.code_name, refreshData);
|
|
13915
13957
|
agentRestartTimezoneInputs.set(agent.code_name, {
|
|
13916
13958
|
agentTimezone: typeof refreshData.agent.timezone === "string" ? refreshData.agent.timezone : null,
|
|
@@ -13959,7 +14001,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13959
14001
|
const changedFiles = [];
|
|
13960
14002
|
mkdirSync11(agentDir, { recursive: true });
|
|
13961
14003
|
for (const artifact of artifacts) {
|
|
13962
|
-
const filePath =
|
|
14004
|
+
const filePath = join34(agentDir, artifact.relativePath);
|
|
13963
14005
|
let existingHash;
|
|
13964
14006
|
let newHash;
|
|
13965
14007
|
let writeContent = artifact.content;
|
|
@@ -13978,8 +14020,8 @@ async function processAgent(agent, agentStates) {
|
|
|
13978
14020
|
};
|
|
13979
14021
|
newHash = sha256(stripDynamicSections(artifact.content));
|
|
13980
14022
|
try {
|
|
13981
|
-
const projectClaudeMd =
|
|
13982
|
-
const existing =
|
|
14023
|
+
const projectClaudeMd = join34(config.configDir, agent.code_name, "project", "CLAUDE.md");
|
|
14024
|
+
const existing = readFileSync27(projectClaudeMd, "utf-8");
|
|
13983
14025
|
existingHash = sha256(stripDynamicSections(existing));
|
|
13984
14026
|
} catch {
|
|
13985
14027
|
existingHash = null;
|
|
@@ -13997,7 +14039,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13997
14039
|
const generatorKeys = Object.keys(generatorServers);
|
|
13998
14040
|
let existingRaw = "";
|
|
13999
14041
|
try {
|
|
14000
|
-
existingRaw =
|
|
14042
|
+
existingRaw = readFileSync27(filePath, "utf-8");
|
|
14001
14043
|
} catch {
|
|
14002
14044
|
}
|
|
14003
14045
|
const existingServers = parseMcp(existingRaw);
|
|
@@ -14013,7 +14055,7 @@ async function processAgent(agent, agentStates) {
|
|
|
14013
14055
|
} else if (artifact.relativePath === "opencode.json") {
|
|
14014
14056
|
let existingRaw = null;
|
|
14015
14057
|
try {
|
|
14016
|
-
existingRaw =
|
|
14058
|
+
existingRaw = readFileSync27(filePath, "utf-8");
|
|
14017
14059
|
} catch {
|
|
14018
14060
|
}
|
|
14019
14061
|
const mergeResult = mergeOpencodeConfigArtifact(artifact.content, existingRaw);
|
|
@@ -14029,12 +14071,12 @@ async function processAgent(agent, agentStates) {
|
|
|
14029
14071
|
}
|
|
14030
14072
|
}
|
|
14031
14073
|
if (changedFiles.length > 0) {
|
|
14032
|
-
const isFirst = !existsSync14(
|
|
14074
|
+
const isFirst = !existsSync14(join34(agentDir, "CHARTER.md"));
|
|
14033
14075
|
const verb = isFirst ? "Provisioning" : "Updating";
|
|
14034
14076
|
const fileNames = changedFiles.map((f) => f.relativePath).join(", ");
|
|
14035
14077
|
log(`${verb} '${agent.code_name}': ${fileNames}`);
|
|
14036
14078
|
for (const file of changedFiles) {
|
|
14037
|
-
const filePath =
|
|
14079
|
+
const filePath = join34(agentDir, file.relativePath);
|
|
14038
14080
|
mkdirSync11(dirname9(filePath), { recursive: true });
|
|
14039
14081
|
if (file.relativePath === ".mcp.json") {
|
|
14040
14082
|
safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
|
|
@@ -14043,12 +14085,12 @@ async function processAgent(agent, agentStates) {
|
|
|
14043
14085
|
}
|
|
14044
14086
|
}
|
|
14045
14087
|
try {
|
|
14046
|
-
const provSkillsDir =
|
|
14088
|
+
const provSkillsDir = join34(agentDir, ".claude", "skills");
|
|
14047
14089
|
if (existsSync14(provSkillsDir)) {
|
|
14048
14090
|
for (const folder of readdirSync9(provSkillsDir)) {
|
|
14049
14091
|
if (folder.startsWith("knowledge-")) {
|
|
14050
14092
|
try {
|
|
14051
|
-
rmSync5(
|
|
14093
|
+
rmSync5(join34(provSkillsDir, folder), { recursive: true });
|
|
14052
14094
|
} catch {
|
|
14053
14095
|
}
|
|
14054
14096
|
}
|
|
@@ -14061,7 +14103,7 @@ async function processAgent(agent, agentStates) {
|
|
|
14061
14103
|
const trackedFiles2 = frameworkAdapter.driftTrackedFiles();
|
|
14062
14104
|
const hashes = /* @__PURE__ */ new Map();
|
|
14063
14105
|
for (const file of trackedFiles2) {
|
|
14064
|
-
const h = hashFile(
|
|
14106
|
+
const h = hashFile(join34(agentDir, file));
|
|
14065
14107
|
if (h) hashes.set(file, h);
|
|
14066
14108
|
}
|
|
14067
14109
|
agentState.writtenHashes.set(agent.agent_id, hashes);
|
|
@@ -14079,14 +14121,14 @@ async function processAgent(agent, agentStates) {
|
|
|
14079
14121
|
}
|
|
14080
14122
|
if (Array.isArray(refreshData.workflows)) {
|
|
14081
14123
|
try {
|
|
14082
|
-
const provWorkflowsDir =
|
|
14124
|
+
const provWorkflowsDir = join34(agentDir, ".claude", "workflows");
|
|
14083
14125
|
if (existsSync14(provWorkflowsDir)) {
|
|
14084
14126
|
const expected = new Set(refreshData.workflows.map((w) => `${w.name}.js`));
|
|
14085
14127
|
for (const file of readdirSync9(provWorkflowsDir)) {
|
|
14086
14128
|
if (!file.endsWith(".js")) continue;
|
|
14087
14129
|
if (expected.has(file)) continue;
|
|
14088
14130
|
try {
|
|
14089
|
-
rmSync5(
|
|
14131
|
+
rmSync5(join34(provWorkflowsDir, file));
|
|
14090
14132
|
} catch {
|
|
14091
14133
|
}
|
|
14092
14134
|
}
|
|
@@ -14168,7 +14210,7 @@ async function processAgent(agent, agentStates) {
|
|
|
14168
14210
|
if (written && existsSync14(agentDir)) {
|
|
14169
14211
|
const driftedFiles = [];
|
|
14170
14212
|
for (const [file, expectedHash] of written) {
|
|
14171
|
-
const localHash = hashFile(
|
|
14213
|
+
const localHash = hashFile(join34(agentDir, file));
|
|
14172
14214
|
if (localHash && localHash !== expectedHash) {
|
|
14173
14215
|
driftedFiles.push(file);
|
|
14174
14216
|
}
|
|
@@ -14179,7 +14221,7 @@ async function processAgent(agent, agentStates) {
|
|
|
14179
14221
|
try {
|
|
14180
14222
|
const localHashes = {};
|
|
14181
14223
|
for (const file of driftedFiles) {
|
|
14182
|
-
localHashes[file] = hashFile(
|
|
14224
|
+
localHashes[file] = hashFile(join34(agentDir, file));
|
|
14183
14225
|
}
|
|
14184
14226
|
await api.post("/host/drift", {
|
|
14185
14227
|
agent_id: agent.agent_id,
|
|
@@ -14381,7 +14423,7 @@ async function processAgent(agent, agentStates) {
|
|
|
14381
14423
|
const addedChannels = [...restartDecision.added];
|
|
14382
14424
|
const writeDmNoticeMarkers = isChannelAddRestart ? () => {
|
|
14383
14425
|
try {
|
|
14384
|
-
const agentAugmentedDir =
|
|
14426
|
+
const agentAugmentedDir = join34(homedir16(), ".augmented", agent.code_name);
|
|
14385
14427
|
mkdirSync11(agentAugmentedDir, { recursive: true });
|
|
14386
14428
|
const markerJson = JSON.stringify({
|
|
14387
14429
|
version: 1,
|
|
@@ -14389,7 +14431,7 @@ async function processAgent(agent, agentStates) {
|
|
|
14389
14431
|
added: addedChannels
|
|
14390
14432
|
});
|
|
14391
14433
|
for (const file of ["slack-channel-add-restart.json", "telegram-channel-add-restart.json"]) {
|
|
14392
|
-
atomicWriteFileSync(
|
|
14434
|
+
atomicWriteFileSync(join34(agentAugmentedDir, file), markerJson);
|
|
14393
14435
|
}
|
|
14394
14436
|
} catch (err) {
|
|
14395
14437
|
log(`[hot-reload] channel-add DM-notice marker write failed for '${agent.code_name}' (non-fatal): ${err.message}`);
|
|
@@ -14578,18 +14620,18 @@ async function processAgent(agent, agentStates) {
|
|
|
14578
14620
|
if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code") {
|
|
14579
14621
|
try {
|
|
14580
14622
|
const agentProvisionDir = agentDir;
|
|
14581
|
-
const projectDir =
|
|
14623
|
+
const projectDir = join34(homedir16(), ".augmented", agent.code_name, "project");
|
|
14582
14624
|
mkdirSync11(agentProvisionDir, { recursive: true });
|
|
14583
14625
|
mkdirSync11(projectDir, { recursive: true });
|
|
14584
|
-
const provisionMcpPath =
|
|
14585
|
-
const projectMcpPath =
|
|
14626
|
+
const provisionMcpPath = join34(agentProvisionDir, ".mcp.json");
|
|
14627
|
+
const projectMcpPath = join34(projectDir, ".mcp.json");
|
|
14586
14628
|
let mcpConfig = { mcpServers: {} };
|
|
14587
14629
|
try {
|
|
14588
|
-
mcpConfig = JSON.parse(
|
|
14630
|
+
mcpConfig = JSON.parse(readFileSync27(provisionMcpPath, "utf-8"));
|
|
14589
14631
|
if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
|
|
14590
14632
|
} catch {
|
|
14591
14633
|
}
|
|
14592
|
-
const localDirectChatChannel =
|
|
14634
|
+
const localDirectChatChannel = join34(homedir16(), ".augmented", "_mcp", "direct-chat-channel.js");
|
|
14593
14635
|
const directChatTeamSettings = refreshData.team?.settings;
|
|
14594
14636
|
const directChatTz = (() => {
|
|
14595
14637
|
const tz = directChatTeamSettings?.["timezone"];
|
|
@@ -14615,7 +14657,7 @@ async function processAgent(agent, agentStates) {
|
|
|
14615
14657
|
// ~/.augmented/<codeName>/.current-turn-initiator.json. Note getAgentDir
|
|
14616
14658
|
// returns the agent root (NOT the /provision subdir `agentDir` points at),
|
|
14617
14659
|
// so it byte-matches the broker readers' path.
|
|
14618
|
-
AGT_TURN_INITIATOR_FILE:
|
|
14660
|
+
AGT_TURN_INITIATOR_FILE: join34(
|
|
14619
14661
|
frameworkAdapter.getAgentDir(agent.code_name),
|
|
14620
14662
|
".current-turn-initiator.json"
|
|
14621
14663
|
)
|
|
@@ -14635,7 +14677,7 @@ async function processAgent(agent, agentStates) {
|
|
|
14635
14677
|
log(`Channel credentials written for '${agent.code_name}/direct-chat'`);
|
|
14636
14678
|
}
|
|
14637
14679
|
}
|
|
14638
|
-
const staleChannelsPath =
|
|
14680
|
+
const staleChannelsPath = join34(projectDir, ".mcp-channels.json");
|
|
14639
14681
|
if (existsSync14(staleChannelsPath)) {
|
|
14640
14682
|
try {
|
|
14641
14683
|
rmSync5(staleChannelsPath, { force: true });
|
|
@@ -14725,7 +14767,7 @@ async function processAgent(agent, agentStates) {
|
|
|
14725
14767
|
}
|
|
14726
14768
|
if (hostFlagStore().getBoolean("connectivity-probe")) {
|
|
14727
14769
|
try {
|
|
14728
|
-
const probeProjectDir =
|
|
14770
|
+
const probeProjectDir = join34(homedir16(), ".augmented", agent.code_name, "project");
|
|
14729
14771
|
let probeSet = integrations;
|
|
14730
14772
|
try {
|
|
14731
14773
|
const quarantined = await api.post("/host/agent-integrations/quarantined", { agent_id: agent.agent_id });
|
|
@@ -14771,7 +14813,7 @@ async function processAgent(agent, agentStates) {
|
|
|
14771
14813
|
const forceDue = attemptsLeft > 0;
|
|
14772
14814
|
let probeRan = false;
|
|
14773
14815
|
try {
|
|
14774
|
-
const probeProjectDir =
|
|
14816
|
+
const probeProjectDir = join34(homedir16(), ".augmented", agent.code_name, "project");
|
|
14775
14817
|
probeRan = await runAgentSessionToolBindProbes(agent, integrations, probeProjectDir, { forceDue });
|
|
14776
14818
|
} catch (err) {
|
|
14777
14819
|
log(`Session-tool-bind probe failed for '${agent.code_name}': ${err.message}`);
|
|
@@ -14848,11 +14890,11 @@ async function processAgent(agent, agentStates) {
|
|
|
14848
14890
|
const intHash = computeIntegrationsHash(integrations);
|
|
14849
14891
|
const prevIntHash = agentState.knownIntegrationHashes.get(agent.agent_id);
|
|
14850
14892
|
if (intHash !== prevIntHash) {
|
|
14851
|
-
const projectDir =
|
|
14852
|
-
const envIntPath =
|
|
14893
|
+
const projectDir = join34(homedir16(), ".augmented", agent.code_name, "project");
|
|
14894
|
+
const envIntPath = join34(projectDir, ".env.integrations");
|
|
14853
14895
|
let preWriteEnv;
|
|
14854
14896
|
try {
|
|
14855
|
-
preWriteEnv =
|
|
14897
|
+
preWriteEnv = readFileSync27(envIntPath, "utf-8");
|
|
14856
14898
|
} catch {
|
|
14857
14899
|
preWriteEnv = void 0;
|
|
14858
14900
|
}
|
|
@@ -14871,9 +14913,9 @@ async function processAgent(agent, agentStates) {
|
|
|
14871
14913
|
}
|
|
14872
14914
|
if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
|
|
14873
14915
|
try {
|
|
14874
|
-
const projectMcpPath =
|
|
14875
|
-
const postWriteEnv =
|
|
14876
|
-
const mcpContent =
|
|
14916
|
+
const projectMcpPath = join34(projectDir, ".mcp.json");
|
|
14917
|
+
const postWriteEnv = readFileSync27(envIntPath, "utf-8");
|
|
14918
|
+
const mcpContent = readFileSync27(projectMcpPath, "utf-8");
|
|
14877
14919
|
const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
|
|
14878
14920
|
const mcpJsonForReap = JSON.parse(mcpContent);
|
|
14879
14921
|
const affectedServerKeys = findMcpServersUsingVars(mcpJsonForReap, changedVars);
|
|
@@ -15137,16 +15179,16 @@ async function processAgent(agent, agentStates) {
|
|
|
15137
15179
|
}
|
|
15138
15180
|
try {
|
|
15139
15181
|
const { readdirSync: readdirSync10, rmSync: rmSync6 } = await import("fs");
|
|
15140
|
-
const { homedir:
|
|
15182
|
+
const { homedir: homedir17 } = await import("os");
|
|
15141
15183
|
const frameworkId2 = frameworkAdapter.id;
|
|
15142
15184
|
const candidateSkillDirs = [
|
|
15143
15185
|
// Claude Code — framework runtime tree
|
|
15144
|
-
|
|
15186
|
+
join34(homedir17(), ".augmented", agent.code_name, "skills"),
|
|
15145
15187
|
// Claude Code — project tree
|
|
15146
|
-
|
|
15188
|
+
join34(homedir17(), ".augmented", agent.code_name, "project", ".claude", "skills"),
|
|
15147
15189
|
// Defensive: legacy provision-side path, not currently an
|
|
15148
15190
|
// install target but cheap to sweep.
|
|
15149
|
-
|
|
15191
|
+
join34(agentDir, ".claude", "skills")
|
|
15150
15192
|
];
|
|
15151
15193
|
const existingDirs = candidateSkillDirs.filter((d) => existsSync14(d));
|
|
15152
15194
|
const discoveredEntries = /* @__PURE__ */ new Set();
|
|
@@ -15187,7 +15229,7 @@ async function processAgent(agent, agentStates) {
|
|
|
15187
15229
|
const sharedSkillsPayload = refreshAny.shared_skills;
|
|
15188
15230
|
const desiredResolved = globalSkillsPayload !== void 0 || sharedSkillsPayload !== void 0;
|
|
15189
15231
|
const manifestPath = managedSkillManifestPath(
|
|
15190
|
-
|
|
15232
|
+
join34(homedir16(), ".augmented", agent.code_name)
|
|
15191
15233
|
);
|
|
15192
15234
|
const prevIds = /* @__PURE__ */ new Set([
|
|
15193
15235
|
...agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
|
|
@@ -15207,15 +15249,15 @@ async function processAgent(agent, agentStates) {
|
|
|
15207
15249
|
}
|
|
15208
15250
|
if (plan.removes.length) {
|
|
15209
15251
|
const globalSkillDirs = [
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
|
|
15252
|
+
join34(homedir16(), ".augmented", agent.code_name, "skills"),
|
|
15253
|
+
join34(homedir16(), ".augmented", agent.code_name, "project", ".claude", "skills"),
|
|
15254
|
+
join34(agentDir, ".claude", "skills")
|
|
15213
15255
|
];
|
|
15214
15256
|
for (const id of plan.removes) {
|
|
15215
15257
|
let prunedAny = false;
|
|
15216
15258
|
for (const dir of globalSkillDirs) {
|
|
15217
|
-
const p =
|
|
15218
|
-
if (existsSync14(p) && existsSync14(
|
|
15259
|
+
const p = join34(dir, id);
|
|
15260
|
+
if (existsSync14(p) && existsSync14(join34(p, "SKILL.md"))) {
|
|
15219
15261
|
rmSync5(p, { recursive: true, force: true });
|
|
15220
15262
|
prunedAny = true;
|
|
15221
15263
|
}
|
|
@@ -15447,8 +15489,8 @@ async function processAgent(agent, agentStates) {
|
|
|
15447
15489
|
const sess = getSessionState(agent.code_name);
|
|
15448
15490
|
let mcpJsonParsed = null;
|
|
15449
15491
|
try {
|
|
15450
|
-
const mcpPath =
|
|
15451
|
-
mcpJsonParsed = JSON.parse(
|
|
15492
|
+
const mcpPath = join34(getProjectDir(agent.code_name), ".mcp.json");
|
|
15493
|
+
mcpJsonParsed = JSON.parse(readFileSync27(mcpPath, "utf-8"));
|
|
15452
15494
|
} catch {
|
|
15453
15495
|
}
|
|
15454
15496
|
reapMissingMcpSessions({
|
|
@@ -15882,7 +15924,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
|
|
|
15882
15924
|
if (trackedFiles.length > 0 && existsSync14(agentDir)) {
|
|
15883
15925
|
const hashes = /* @__PURE__ */ new Map();
|
|
15884
15926
|
for (const file of trackedFiles) {
|
|
15885
|
-
const h = hashFile(
|
|
15927
|
+
const h = hashFile(join34(agentDir, file));
|
|
15886
15928
|
if (h) hashes.set(file, h);
|
|
15887
15929
|
}
|
|
15888
15930
|
agentState.writtenHashes.set(agent.agent_id, hashes);
|
|
@@ -15897,7 +15939,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
|
|
|
15897
15939
|
refreshData.agent.onboarding_state
|
|
15898
15940
|
);
|
|
15899
15941
|
const obStep = obState.step;
|
|
15900
|
-
const markerPath =
|
|
15942
|
+
const markerPath = join34(homedir16(), ".augmented", agent.code_name, "onboarding-drive.json");
|
|
15901
15943
|
const marker = readOnboardingDriveMarker(markerPath);
|
|
15902
15944
|
const decision = decideOnboardingDrive(obStep, marker, Date.now(), obState.generation ?? 0);
|
|
15903
15945
|
if (decision.clearMarker) {
|
|
@@ -15985,7 +16027,7 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
|
|
|
15985
16027
|
}
|
|
15986
16028
|
stopOpencodeSlackIngest(codeName, log);
|
|
15987
16029
|
stopOpencodeTelegramIngest(codeName, log);
|
|
15988
|
-
const opencodeProjectDir =
|
|
16030
|
+
const opencodeProjectDir = join34(getFramework("opencode").getAgentDir(codeName), "provision");
|
|
15989
16031
|
const serveEnv = {
|
|
15990
16032
|
AGT_HOST: requireHost(),
|
|
15991
16033
|
AGT_API_KEY: getApiKey() ?? void 0,
|
|
@@ -16040,8 +16082,8 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
16040
16082
|
});
|
|
16041
16083
|
}
|
|
16042
16084
|
const projectDir = getProjectDir(codeName);
|
|
16043
|
-
const mcpConfigPath =
|
|
16044
|
-
const claudeMdPath =
|
|
16085
|
+
const mcpConfigPath = join34(projectDir, ".mcp.json");
|
|
16086
|
+
const claudeMdPath = join34(projectDir, "CLAUDE.md");
|
|
16045
16087
|
if (restartBreaker.isTripped(codeName)) {
|
|
16046
16088
|
const trip = restartBreaker.getTrip(codeName);
|
|
16047
16089
|
return {
|
|
@@ -16673,7 +16715,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
16673
16715
|
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}`));
|
|
16674
16716
|
void (async () => {
|
|
16675
16717
|
try {
|
|
16676
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
16718
|
+
const { collectDiagnostics } = await import("../persistent-session-HY6GUPBQ.js");
|
|
16677
16719
|
await api.post("/host/heartbeat", {
|
|
16678
16720
|
host_id: hostId,
|
|
16679
16721
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics)
|
|
@@ -16724,7 +16766,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
16724
16766
|
}
|
|
16725
16767
|
try {
|
|
16726
16768
|
const hostId = await getHostId();
|
|
16727
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
16769
|
+
const { collectDiagnostics } = await import("../persistent-session-HY6GUPBQ.js");
|
|
16728
16770
|
await api.post("/host/heartbeat", {
|
|
16729
16771
|
host_id: hostId,
|
|
16730
16772
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics)
|
|
@@ -17067,7 +17109,7 @@ async function processDirectChatMessage(agent, msg) {
|
|
|
17067
17109
|
const useDoorbell = hostFlagStore().getBoolean("direct-chat-doorbell") || isolationMode(agent.codeName) === "docker";
|
|
17068
17110
|
if (useDoorbell) {
|
|
17069
17111
|
try {
|
|
17070
|
-
const doorbell = directChatDoorbellPath(agent.agentId,
|
|
17112
|
+
const doorbell = directChatDoorbellPath(agent.agentId, homedir16());
|
|
17071
17113
|
mkdirSync11(dirname9(doorbell), { recursive: true });
|
|
17072
17114
|
writeFileSync14(doorbell, String(Date.now()));
|
|
17073
17115
|
log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
|
|
@@ -17196,7 +17238,7 @@ ${formatRunMarker(run_id)}` : KANBAN_CHECK_COMMAND;
|
|
|
17196
17238
|
}
|
|
17197
17239
|
if (run_id) openInjectedRunByCode.set(codeName, run_id);
|
|
17198
17240
|
try {
|
|
17199
|
-
const doorbell = directChatDoorbellPath(agentId,
|
|
17241
|
+
const doorbell = directChatDoorbellPath(agentId, homedir16());
|
|
17200
17242
|
mkdirSync11(dirname9(doorbell), { recursive: true });
|
|
17201
17243
|
writeFileSync14(doorbell, String(Date.now()));
|
|
17202
17244
|
} catch (err) {
|
|
@@ -17302,7 +17344,7 @@ async function processClaudePairSessions(agents) {
|
|
|
17302
17344
|
killPairSession,
|
|
17303
17345
|
pairTmuxSession,
|
|
17304
17346
|
finalizeClaudePairOnboarding
|
|
17305
|
-
} = await import("../claude-pair-runtime-
|
|
17347
|
+
} = await import("../claude-pair-runtime-NSIF6AYH.js");
|
|
17306
17348
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
17307
17349
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
17308
17350
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -17556,8 +17598,8 @@ function parseMemoryFile(raw, fallbackName) {
|
|
|
17556
17598
|
};
|
|
17557
17599
|
}
|
|
17558
17600
|
async function syncMemories(agent, configDir, log2) {
|
|
17559
|
-
const projectDir =
|
|
17560
|
-
const memoryDir =
|
|
17601
|
+
const projectDir = join34(configDir, agent.code_name, "project");
|
|
17602
|
+
const memoryDir = join34(projectDir, "memory");
|
|
17561
17603
|
const isFreshSync = pendingFreshMemorySync.has(agent.agent_id);
|
|
17562
17604
|
if (isFreshSync) {
|
|
17563
17605
|
log2(`[memory-sync] Fresh-sync requested for '${agent.code_name}' \u2014 pulling DB first`);
|
|
@@ -17575,7 +17617,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
17575
17617
|
for (const file of readdirSync9(memoryDir)) {
|
|
17576
17618
|
if (!file.endsWith(".md")) continue;
|
|
17577
17619
|
try {
|
|
17578
|
-
const raw =
|
|
17620
|
+
const raw = readFileSync27(join34(memoryDir, file), "utf-8");
|
|
17579
17621
|
const fileHash = createHash17("sha256").update(raw).digest("hex").slice(0, 16);
|
|
17580
17622
|
currentHashes.set(file, fileHash);
|
|
17581
17623
|
if (prevHashes.get(file) === fileHash) continue;
|
|
@@ -17600,7 +17642,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
17600
17642
|
} catch (err) {
|
|
17601
17643
|
for (const mem of changedMemories) {
|
|
17602
17644
|
for (const [file] of currentHashes) {
|
|
17603
|
-
const parsed = parseMemoryFile(
|
|
17645
|
+
const parsed = parseMemoryFile(readFileSync27(join34(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
|
|
17604
17646
|
if (parsed?.name === mem.name) currentHashes.delete(file);
|
|
17605
17647
|
}
|
|
17606
17648
|
}
|
|
@@ -17635,7 +17677,7 @@ async function downloadMemories(agent, memoryDir, log2, { force }) {
|
|
|
17635
17677
|
const mem = dbMemories.memories[i];
|
|
17636
17678
|
const rawSlug = mem.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "").slice(0, 60);
|
|
17637
17679
|
const slug = rawSlug || `memory-${i}`;
|
|
17638
|
-
const filePath =
|
|
17680
|
+
const filePath = join34(memoryDir, `${slug}.md`);
|
|
17639
17681
|
const desired = `---
|
|
17640
17682
|
name: ${JSON.stringify(mem.name)}
|
|
17641
17683
|
type: ${mem.type}
|
|
@@ -17647,7 +17689,7 @@ ${mem.content}
|
|
|
17647
17689
|
if (existsSync14(filePath)) {
|
|
17648
17690
|
let existing = "";
|
|
17649
17691
|
try {
|
|
17650
|
-
existing =
|
|
17692
|
+
existing = readFileSync27(filePath, "utf-8");
|
|
17651
17693
|
} catch {
|
|
17652
17694
|
}
|
|
17653
17695
|
if (existing === desired) continue;
|
|
@@ -17911,7 +17953,7 @@ function startManager(opts) {
|
|
|
17911
17953
|
try {
|
|
17912
17954
|
const stateFile = getStateFile();
|
|
17913
17955
|
if (existsSync14(stateFile)) {
|
|
17914
|
-
const raw =
|
|
17956
|
+
const raw = readFileSync27(stateFile, "utf-8");
|
|
17915
17957
|
const parsed = JSON.parse(raw);
|
|
17916
17958
|
if (Array.isArray(parsed.agents)) {
|
|
17917
17959
|
state7.agents = parsed.agents;
|
|
@@ -17938,7 +17980,7 @@ function startManager(opts) {
|
|
|
17938
17980
|
log(`[startup] state rehydration failed (continuing with empty state): ${err.message}`);
|
|
17939
17981
|
}
|
|
17940
17982
|
log(
|
|
17941
|
-
`[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${
|
|
17983
|
+
`[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join34(homedir16(), ".augmented", "manager.log")}`
|
|
17942
17984
|
);
|
|
17943
17985
|
deployMcpAssets();
|
|
17944
17986
|
reapOrphanChannelMcps({ log });
|
|
@@ -17967,7 +18009,7 @@ async function reapOrphanedClaudePids() {
|
|
|
17967
18009
|
const looksLikeClaude = (pid) => {
|
|
17968
18010
|
if (process.platform !== "linux") return true;
|
|
17969
18011
|
try {
|
|
17970
|
-
const comm =
|
|
18012
|
+
const comm = readFileSync27(`/proc/${pid}/comm`, "utf-8").trim().toLowerCase();
|
|
17971
18013
|
return comm.includes("claude");
|
|
17972
18014
|
} catch {
|
|
17973
18015
|
return false;
|
|
@@ -18064,14 +18106,14 @@ function restartRunningChannelMcps(basenames) {
|
|
|
18064
18106
|
}
|
|
18065
18107
|
}
|
|
18066
18108
|
function deployMcpAssets() {
|
|
18067
|
-
const targetDir =
|
|
18109
|
+
const targetDir = join34(homedir16(), ".augmented", "_mcp");
|
|
18068
18110
|
mkdirSync11(targetDir, { recursive: true });
|
|
18069
18111
|
const moduleDir = dirname9(fileURLToPath(import.meta.url));
|
|
18070
18112
|
let mcpSourceDir = "";
|
|
18071
18113
|
let dir = moduleDir;
|
|
18072
18114
|
for (let i = 0; i < 6; i++) {
|
|
18073
|
-
const candidate =
|
|
18074
|
-
if (existsSync14(
|
|
18115
|
+
const candidate = join34(dir, "dist", "mcp");
|
|
18116
|
+
if (existsSync14(join34(candidate, "index.js"))) {
|
|
18075
18117
|
mcpSourceDir = candidate;
|
|
18076
18118
|
break;
|
|
18077
18119
|
}
|
|
@@ -18087,7 +18129,7 @@ function deployMcpAssets() {
|
|
|
18087
18129
|
const fileHash = (p) => {
|
|
18088
18130
|
try {
|
|
18089
18131
|
if (!existsSync14(p)) return null;
|
|
18090
|
-
return createHash17("sha256").update(
|
|
18132
|
+
return createHash17("sha256").update(readFileSync27(p)).digest("hex");
|
|
18091
18133
|
} catch {
|
|
18092
18134
|
return null;
|
|
18093
18135
|
}
|
|
@@ -18158,8 +18200,8 @@ function deployMcpAssets() {
|
|
|
18158
18200
|
// needs restarting to pick up a token rotation.
|
|
18159
18201
|
"xero.js"
|
|
18160
18202
|
]) {
|
|
18161
|
-
const src =
|
|
18162
|
-
const dst =
|
|
18203
|
+
const src = join34(mcpSourceDir, file);
|
|
18204
|
+
const dst = join34(targetDir, file);
|
|
18163
18205
|
if (!existsSync14(src)) continue;
|
|
18164
18206
|
const before = fileHash(dst);
|
|
18165
18207
|
try {
|
|
@@ -18177,16 +18219,16 @@ function deployMcpAssets() {
|
|
|
18177
18219
|
log(`[manager] Bundle(s) updated: ${changedBasenames.join(", ")} \u2014 signalling running instances to restart`);
|
|
18178
18220
|
restartRunningChannelMcps(changedBasenames);
|
|
18179
18221
|
}
|
|
18180
|
-
const localMcpPath =
|
|
18222
|
+
const localMcpPath = join34(targetDir, "index.js");
|
|
18181
18223
|
try {
|
|
18182
|
-
const agentsDir =
|
|
18224
|
+
const agentsDir = join34(homedir16(), ".augmented", "agents");
|
|
18183
18225
|
if (existsSync14(agentsDir)) {
|
|
18184
18226
|
for (const entry of readdirSync9(agentsDir, { withFileTypes: true })) {
|
|
18185
18227
|
if (!entry.isDirectory()) continue;
|
|
18186
18228
|
for (const subdir of ["provision", "project"]) {
|
|
18187
|
-
const mcpJsonPath =
|
|
18229
|
+
const mcpJsonPath = join34(agentsDir, entry.name, subdir, ".mcp.json");
|
|
18188
18230
|
try {
|
|
18189
|
-
const raw =
|
|
18231
|
+
const raw = readFileSync27(mcpJsonPath, "utf-8");
|
|
18190
18232
|
if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
|
|
18191
18233
|
const mcpConfig = JSON.parse(raw);
|
|
18192
18234
|
const augServer = mcpConfig.mcpServers?.["augmented"];
|