@integrity-labs/agt-cli 0.28.510 → 0.28.511
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-EQW3EHDQ.js → chunk-I3DZ3LI5.js} +3 -3
- package/dist/{chunk-7DZNVMMX.js → chunk-OQBHTDWK.js} +1 -1
- package/dist/{claude-pair-runtime-4CYSUXLF.js → claude-pair-runtime-AK6RLKSR.js} +2 -2
- package/dist/lib/manager-worker.js +162 -125
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-4VF7V4HB.js → persistent-session-CMG4VWT6.js} +2 -2
- package/dist/{responsiveness-probe-PWS3FIRF.js → responsiveness-probe-COMUJVPF.js} +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-EQW3EHDQ.js.map → chunk-I3DZ3LI5.js.map} +0 -0
- /package/dist/{chunk-7DZNVMMX.js.map → chunk-OQBHTDWK.js.map} +0 -0
- /package/dist/{claude-pair-runtime-4CYSUXLF.js.map → claude-pair-runtime-AK6RLKSR.js.map} +0 -0
- /package/dist/{persistent-session-4VF7V4HB.js.map → persistent-session-CMG4VWT6.js.map} +0 -0
- /package/dist/{responsiveness-probe-PWS3FIRF.js.map → responsiveness-probe-COMUJVPF.js.map} +0 -0
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
safeWriteJsonAtomic,
|
|
54
54
|
setConfigHash,
|
|
55
55
|
tripClass
|
|
56
|
-
} from "../chunk-
|
|
56
|
+
} from "../chunk-I3DZ3LI5.js";
|
|
57
57
|
import {
|
|
58
58
|
getProjectDir as getProjectDir2,
|
|
59
59
|
getReadyTasks,
|
|
@@ -173,7 +173,7 @@ import {
|
|
|
173
173
|
toOpencodeModel,
|
|
174
174
|
transcriptActivityAgeSeconds,
|
|
175
175
|
writeEgressAllowlist
|
|
176
|
-
} from "../chunk-
|
|
176
|
+
} from "../chunk-OQBHTDWK.js";
|
|
177
177
|
import {
|
|
178
178
|
reapOrphanChannelMcps
|
|
179
179
|
} from "../chunk-XWVM4KPK.js";
|
|
@@ -182,7 +182,7 @@ import {
|
|
|
182
182
|
import { createHash as createHash16 } from "crypto";
|
|
183
183
|
import { readFileSync as readFileSync22, writeFileSync as writeFileSync13, mkdirSync as mkdirSync10, existsSync as existsSync12, rmSync as rmSync5, readdirSync as readdirSync7, statSync as statSync6, copyFileSync } from "fs";
|
|
184
184
|
import { execFileSync as syncExecFile } from "child_process";
|
|
185
|
-
import { join as
|
|
185
|
+
import { join as join28, dirname as dirname8, delimiter as pathDelimiter } from "path";
|
|
186
186
|
import { homedir as homedir12 } from "os";
|
|
187
187
|
import { fileURLToPath } from "url";
|
|
188
188
|
|
|
@@ -4302,12 +4302,33 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash, options)
|
|
|
4302
4302
|
return { installs, removes, currentIds };
|
|
4303
4303
|
}
|
|
4304
4304
|
|
|
4305
|
+
// src/lib/manager/integration-skill-cache.ts
|
|
4306
|
+
import { join as join17 } from "path";
|
|
4307
|
+
function integrationSkillHashKey(agentId, skillId) {
|
|
4308
|
+
return `plugin-skill:${agentId}:${skillId}`;
|
|
4309
|
+
}
|
|
4310
|
+
function shouldWriteIntegrationSkill(cache, agentId, skillId, contentHash) {
|
|
4311
|
+
return cache.get(integrationSkillHashKey(agentId, skillId)) !== contentHash;
|
|
4312
|
+
}
|
|
4313
|
+
function rememberIntegrationSkill(cache, agentId, skillId, contentHash) {
|
|
4314
|
+
cache.set(integrationSkillHashKey(agentId, skillId), contentHash);
|
|
4315
|
+
}
|
|
4316
|
+
function forgetIntegrationSkill(cache, agentId, skillId) {
|
|
4317
|
+
cache.delete(integrationSkillHashKey(agentId, skillId));
|
|
4318
|
+
}
|
|
4319
|
+
function removeIntegrationSkillFolder(opts) {
|
|
4320
|
+
forgetIntegrationSkill(opts.cache, opts.agentId, opts.entry);
|
|
4321
|
+
for (const dir of opts.dirs) {
|
|
4322
|
+
opts.removeDir(join17(dir, opts.entry));
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4305
4326
|
// src/lib/manager/managed-skill-manifest.ts
|
|
4306
4327
|
import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync14, writeFileSync as writeFileSync7 } from "fs";
|
|
4307
|
-
import { dirname as dirname5, join as
|
|
4328
|
+
import { dirname as dirname5, join as join18 } from "path";
|
|
4308
4329
|
var MANIFEST_VERSION = 1;
|
|
4309
4330
|
function managedSkillManifestPath(agentRootDir) {
|
|
4310
|
-
return
|
|
4331
|
+
return join18(agentRootDir, "managed-skills.json");
|
|
4311
4332
|
}
|
|
4312
4333
|
function readManagedSkillManifest(path) {
|
|
4313
4334
|
try {
|
|
@@ -4425,7 +4446,7 @@ function resolveModelChain(refreshData) {
|
|
|
4425
4446
|
|
|
4426
4447
|
// src/lib/manager/claude-auth.ts
|
|
4427
4448
|
import { existsSync as existsSync7, rmSync as rmSync3 } from "fs";
|
|
4428
|
-
import { join as
|
|
4449
|
+
import { join as join19 } from "path";
|
|
4429
4450
|
import { homedir as homedir8 } from "os";
|
|
4430
4451
|
async function applyClaudeAuthToEnv(childEnv, label) {
|
|
4431
4452
|
const apiKey = getApiKey();
|
|
@@ -4438,9 +4459,9 @@ async function applyClaudeAuthToEnv(childEnv, label) {
|
|
|
4438
4459
|
throw new Error("claude_auth_mode=api_key but /host/exchange returned no decrypted key");
|
|
4439
4460
|
}
|
|
4440
4461
|
childEnv.ANTHROPIC_API_KEY = exchange.anthropicApiKey;
|
|
4441
|
-
const claudeDir =
|
|
4462
|
+
const claudeDir = join19(homedir8(), ".claude");
|
|
4442
4463
|
for (const filename of [".credentials.json", "credentials.json"]) {
|
|
4443
|
-
const p =
|
|
4464
|
+
const p = join19(claudeDir, filename);
|
|
4444
4465
|
if (existsSync7(p)) {
|
|
4445
4466
|
try {
|
|
4446
4467
|
rmSync3(p, { force: true });
|
|
@@ -4456,7 +4477,7 @@ async function applyClaudeAuthToEnv(childEnv, label) {
|
|
|
4456
4477
|
|
|
4457
4478
|
// src/lib/manager/kanban/parsers.ts
|
|
4458
4479
|
import { existsSync as existsSync8, readFileSync as readFileSync15 } from "fs";
|
|
4459
|
-
import { join as
|
|
4480
|
+
import { join as join20 } from "path";
|
|
4460
4481
|
var STANDUP_TEMPLATES = /* @__PURE__ */ new Set(["daily-standup", "end-of-day-summary"]);
|
|
4461
4482
|
var TASK_UPDATE_TEMPLATES = /* @__PURE__ */ new Set(["hourly-status", "task-update"]);
|
|
4462
4483
|
var PLAN_TEMPLATES = /* @__PURE__ */ new Set(["morning-plan"]);
|
|
@@ -4595,8 +4616,8 @@ function getBuiltInSkillContent(skillId) {
|
|
|
4595
4616
|
if (builtInSkillCache.has(skillId)) return builtInSkillCache.get(skillId);
|
|
4596
4617
|
try {
|
|
4597
4618
|
const candidates = [
|
|
4598
|
-
|
|
4599
|
-
|
|
4619
|
+
join20(process.cwd(), "skills", skillId, "SKILL.md"),
|
|
4620
|
+
join20(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", "..", "..", "skills", skillId, "SKILL.md")
|
|
4600
4621
|
];
|
|
4601
4622
|
for (const candidate of candidates) {
|
|
4602
4623
|
if (existsSync8(candidate)) {
|
|
@@ -4742,11 +4763,11 @@ function formatBoardForPrompt(items, template) {
|
|
|
4742
4763
|
|
|
4743
4764
|
// src/lib/manager/kanban/nudge-state-cache.ts
|
|
4744
4765
|
import { existsSync as existsSync9, readFileSync as readFileSync16, writeFileSync as writeFileSync8 } from "fs";
|
|
4745
|
-
import { join as
|
|
4766
|
+
import { join as join21 } from "path";
|
|
4746
4767
|
var CACHE_FILENAME2 = "kanban-nudge-state.json";
|
|
4747
4768
|
var KANBAN_NUDGE_STATE_VERSION = 1;
|
|
4748
4769
|
function getKanbanNudgeStateFile(configDir) {
|
|
4749
|
-
return
|
|
4770
|
+
return join21(configDir, CACHE_FILENAME2);
|
|
4750
4771
|
}
|
|
4751
4772
|
function loadKanbanNudgeState(target, configDir) {
|
|
4752
4773
|
const path = getKanbanNudgeStateFile(configDir);
|
|
@@ -5355,7 +5376,7 @@ function closeScheduledRunsForCode(codeName, outcome, reason) {
|
|
|
5355
5376
|
import { createHash as createHash11 } from "crypto";
|
|
5356
5377
|
import { writeFileSync as writeFileSync9, renameSync as renameSync3, mkdirSync as mkdirSync6, readFileSync as readFileSync17, unlinkSync } from "fs";
|
|
5357
5378
|
import { homedir as homedir9 } from "os";
|
|
5358
|
-
import { join as
|
|
5379
|
+
import { join as join22, dirname as dirname6 } from "path";
|
|
5359
5380
|
|
|
5360
5381
|
// src/lib/manager/scheduler/notify.ts
|
|
5361
5382
|
import { createHash as createHash10 } from "crypto";
|
|
@@ -5696,7 +5717,7 @@ function resolveScheduledSlackTarget(task) {
|
|
|
5696
5717
|
}
|
|
5697
5718
|
function stampScheduledTurnMarker(codeName, taskId, target) {
|
|
5698
5719
|
try {
|
|
5699
|
-
const file =
|
|
5720
|
+
const file = join22(homedir9(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
|
|
5700
5721
|
const marker = { ts: Date.now(), task_id: taskId, ...target ? { target } : {} };
|
|
5701
5722
|
const tmp = `${file}.tmp`;
|
|
5702
5723
|
writeFileSync9(tmp, JSON.stringify(marker), "utf8");
|
|
@@ -5706,7 +5727,7 @@ function stampScheduledTurnMarker(codeName, taskId, target) {
|
|
|
5706
5727
|
}
|
|
5707
5728
|
}
|
|
5708
5729
|
function clearScheduledTurnMarkerForTask(codeName, taskId) {
|
|
5709
|
-
const file =
|
|
5730
|
+
const file = join22(homedir9(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
|
|
5710
5731
|
try {
|
|
5711
5732
|
const raw = JSON.parse(readFileSync17(file, "utf8"));
|
|
5712
5733
|
if (typeof raw?.task_id !== "string" || raw.task_id !== taskId) return;
|
|
@@ -5921,11 +5942,11 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
5921
5942
|
// src/lib/manager/scheduler/execution.ts
|
|
5922
5943
|
import { createHash as createHash12 } from "crypto";
|
|
5923
5944
|
import { homedir as homedir10 } from "os";
|
|
5924
|
-
import { join as
|
|
5945
|
+
import { join as join24 } from "path";
|
|
5925
5946
|
|
|
5926
5947
|
// src/lib/agent-serving-probe.ts
|
|
5927
5948
|
import { readFileSync as readFileSync18, readdirSync as readdirSync4, statSync as statSync4 } from "fs";
|
|
5928
|
-
import { join as
|
|
5949
|
+
import { join as join23 } from "path";
|
|
5929
5950
|
var RATE_LIMIT_WINDOW_MS = 6 * 60 * 60 * 1e3;
|
|
5930
5951
|
function probeRateLimit(args) {
|
|
5931
5952
|
const now = args.now ?? /* @__PURE__ */ new Date();
|
|
@@ -5941,7 +5962,7 @@ function probeRateLimit(args) {
|
|
|
5941
5962
|
let newest = UNKNOWN_RATE_LIMIT;
|
|
5942
5963
|
for (const name of entries) {
|
|
5943
5964
|
if (!name.endsWith(".jsonl")) continue;
|
|
5944
|
-
const path =
|
|
5965
|
+
const path = join23(dir, name);
|
|
5945
5966
|
try {
|
|
5946
5967
|
const st = statSync4(path);
|
|
5947
5968
|
if (!st.isFile() || st.mtimeMs < startMs) continue;
|
|
@@ -6012,7 +6033,7 @@ function shouldLogUsageCapDeferral(site, codeName, limitedUntil) {
|
|
|
6012
6033
|
|
|
6013
6034
|
// src/lib/manager/scheduler/execution.ts
|
|
6014
6035
|
function claudePidFilePath() {
|
|
6015
|
-
return
|
|
6036
|
+
return join24(homedir10(), ".augmented", "manager-claude-pids.json");
|
|
6016
6037
|
}
|
|
6017
6038
|
var inFlightClaudePids = /* @__PURE__ */ new Map();
|
|
6018
6039
|
function registerClaudeSpawn(record) {
|
|
@@ -7247,7 +7268,7 @@ async function fireOpencodeScheduledTask(agent, task) {
|
|
|
7247
7268
|
import { createHash as createHash15 } from "crypto";
|
|
7248
7269
|
import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync19, renameSync as renameSync4, unlinkSync as unlinkSync2, writeFileSync as writeFileSync10 } from "fs";
|
|
7249
7270
|
import { randomUUID } from "crypto";
|
|
7250
|
-
import { join as
|
|
7271
|
+
import { join as join25 } from "path";
|
|
7251
7272
|
|
|
7252
7273
|
// src/lib/telegram-ingest.ts
|
|
7253
7274
|
import https2 from "https";
|
|
@@ -7795,7 +7816,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
|
|
|
7795
7816
|
let filePath;
|
|
7796
7817
|
try {
|
|
7797
7818
|
dir = getFramework("opencode").getAgentDir(codeName);
|
|
7798
|
-
filePath =
|
|
7819
|
+
filePath = join25(dir, "telegram-getupdates-offset-opencode.json");
|
|
7799
7820
|
} catch {
|
|
7800
7821
|
dir = null;
|
|
7801
7822
|
filePath = null;
|
|
@@ -8076,13 +8097,13 @@ function partitionActionableByPoison(actionable, states, config2) {
|
|
|
8076
8097
|
// src/lib/restart-flags.ts
|
|
8077
8098
|
import { existsSync as existsSync11, mkdirSync as mkdirSync8, readdirSync as readdirSync5, readFileSync as readFileSync20, renameSync as renameSync5, rmSync as rmSync4, writeFileSync as writeFileSync11 } from "fs";
|
|
8078
8099
|
import { homedir as homedir11 } from "os";
|
|
8079
|
-
import { join as
|
|
8100
|
+
import { join as join26 } from "path";
|
|
8080
8101
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
8081
8102
|
function restartFlagsDir() {
|
|
8082
|
-
return
|
|
8103
|
+
return join26(homedir11(), ".augmented", "restart-flags");
|
|
8083
8104
|
}
|
|
8084
8105
|
function flagPath(codeName) {
|
|
8085
|
-
return
|
|
8106
|
+
return join26(restartFlagsDir(), `${codeName}.flag`);
|
|
8086
8107
|
}
|
|
8087
8108
|
function readRestartFlags() {
|
|
8088
8109
|
const dir = restartFlagsDir();
|
|
@@ -8091,7 +8112,7 @@ function readRestartFlags() {
|
|
|
8091
8112
|
for (const entry of readdirSync5(dir)) {
|
|
8092
8113
|
if (!entry.endsWith(".flag")) continue;
|
|
8093
8114
|
try {
|
|
8094
|
-
const raw = readFileSync20(
|
|
8115
|
+
const raw = readFileSync20(join26(dir, entry), "utf8");
|
|
8095
8116
|
const parsed = JSON.parse(raw);
|
|
8096
8117
|
if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
|
|
8097
8118
|
parsed.codeName = entry.replace(/\.flag$/, "");
|
|
@@ -8210,7 +8231,7 @@ async function sendError(flag, opts, text) {
|
|
|
8210
8231
|
|
|
8211
8232
|
// src/lib/restart-context.ts
|
|
8212
8233
|
import { readdirSync as readdirSync6, readFileSync as readFileSync21, writeFileSync as writeFileSync12, mkdirSync as mkdirSync9, unlinkSync as unlinkSync3 } from "fs";
|
|
8213
|
-
import { dirname as dirname7, join as
|
|
8234
|
+
import { dirname as dirname7, join as join27 } from "path";
|
|
8214
8235
|
var SLACK_PENDING_INBOUND_DIRNAME = "slack-pending-inbound";
|
|
8215
8236
|
var SLACK_RESTART_CONTEXT_DIRNAME = "slack-restart-context";
|
|
8216
8237
|
var MAX_TOPIC_CHARS = 140;
|
|
@@ -8222,10 +8243,10 @@ function augmentedAgentDir(codeName) {
|
|
|
8222
8243
|
return dirname7(getProjectDir(codeName));
|
|
8223
8244
|
}
|
|
8224
8245
|
function slackPendingInboundDir(codeName) {
|
|
8225
|
-
return
|
|
8246
|
+
return join27(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
|
|
8226
8247
|
}
|
|
8227
8248
|
function slackRestartContextDir(codeName) {
|
|
8228
|
-
return
|
|
8249
|
+
return join27(augmentedAgentDir(codeName), SLACK_RESTART_CONTEXT_DIRNAME);
|
|
8229
8250
|
}
|
|
8230
8251
|
function sanitizeTopic(raw) {
|
|
8231
8252
|
const cleaned = raw.replace(/\s+/g, " ").trim().replace(/[<>]/g, " ").replace(/\s+/g, " ").trim();
|
|
@@ -8285,7 +8306,7 @@ function pruneHintsExcept(codeName, freshFilenames) {
|
|
|
8285
8306
|
if (!filename.endsWith(".json")) continue;
|
|
8286
8307
|
if (freshFilenames.has(filename)) continue;
|
|
8287
8308
|
try {
|
|
8288
|
-
unlinkSync3(
|
|
8309
|
+
unlinkSync3(join27(ctxDir, filename));
|
|
8289
8310
|
} catch {
|
|
8290
8311
|
}
|
|
8291
8312
|
}
|
|
@@ -8306,7 +8327,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
|
|
|
8306
8327
|
}
|
|
8307
8328
|
const markers = [];
|
|
8308
8329
|
for (const filename of markerFilenames.slice(0, cap)) {
|
|
8309
|
-
const parsed = readStrandedMarker(
|
|
8330
|
+
const parsed = readStrandedMarker(join27(markerDir, filename));
|
|
8310
8331
|
if (parsed) markers.push({ filename, channel: parsed.channel, thread_ts: parsed.thread_ts });
|
|
8311
8332
|
}
|
|
8312
8333
|
if (markers.length === 0) {
|
|
@@ -8320,7 +8341,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
|
|
|
8320
8341
|
const freshFilenames = /* @__PURE__ */ new Set();
|
|
8321
8342
|
for (const { filename, hint } of hints) {
|
|
8322
8343
|
try {
|
|
8323
|
-
writeHintFile(
|
|
8344
|
+
writeHintFile(join27(ctxDir, filename), ctxDir, hint);
|
|
8324
8345
|
freshFilenames.add(filename);
|
|
8325
8346
|
} catch (err) {
|
|
8326
8347
|
log2(`[restart-context] ${codeName}: hint write failed for ${filename}: ${err.message}`);
|
|
@@ -9674,7 +9695,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
|
|
|
9674
9695
|
var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
|
|
9675
9696
|
function projectMcpHash(_codeName, projectDir) {
|
|
9676
9697
|
try {
|
|
9677
|
-
const raw = readFileSync22(
|
|
9698
|
+
const raw = readFileSync22(join28(projectDir, ".mcp.json"), "utf-8");
|
|
9678
9699
|
return createHash16("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
|
|
9679
9700
|
} catch {
|
|
9680
9701
|
return null;
|
|
@@ -9682,7 +9703,7 @@ function projectMcpHash(_codeName, projectDir) {
|
|
|
9682
9703
|
}
|
|
9683
9704
|
function projectMcpKeys(_codeName, projectDir) {
|
|
9684
9705
|
try {
|
|
9685
|
-
const raw = readFileSync22(
|
|
9706
|
+
const raw = readFileSync22(join28(projectDir, ".mcp.json"), "utf-8");
|
|
9686
9707
|
const parsed = JSON.parse(raw);
|
|
9687
9708
|
const servers = parsed.mcpServers;
|
|
9688
9709
|
if (!servers || typeof servers !== "object") return /* @__PURE__ */ new Set();
|
|
@@ -9700,7 +9721,7 @@ function seedSessionLaunchBaselines(codeName, projectDir) {
|
|
|
9700
9721
|
else runningMcpServerKeys.delete(codeName);
|
|
9701
9722
|
let launchStructure = null;
|
|
9702
9723
|
try {
|
|
9703
|
-
const raw = readFileSync22(
|
|
9724
|
+
const raw = readFileSync22(join28(projectDir, ".mcp.json"), "utf-8");
|
|
9704
9725
|
launchStructure = managedMcpStructureHashFromFile(
|
|
9705
9726
|
JSON.parse(raw),
|
|
9706
9727
|
isManagedMcpServerKey
|
|
@@ -9810,7 +9831,7 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
|
|
|
9810
9831
|
if (result && result.rebindCandidates.length > 0 && hostFlagStore().getBoolean("session-tool-rebind")) {
|
|
9811
9832
|
let mcpJsonForRebind = null;
|
|
9812
9833
|
try {
|
|
9813
|
-
mcpJsonForRebind = JSON.parse(readFileSync22(
|
|
9834
|
+
mcpJsonForRebind = JSON.parse(readFileSync22(join28(projectDir, ".mcp.json"), "utf-8"));
|
|
9814
9835
|
} catch {
|
|
9815
9836
|
mcpJsonForRebind = null;
|
|
9816
9837
|
}
|
|
@@ -9954,7 +9975,7 @@ function checkMcpConfigDriftAndScheduleRestart(codeName, projectDir) {
|
|
|
9954
9975
|
function projectChannelSecretHash(projectDir) {
|
|
9955
9976
|
try {
|
|
9956
9977
|
const entries = parseEnvIntegrations(
|
|
9957
|
-
readFileSync22(
|
|
9978
|
+
readFileSync22(join28(projectDir, ".env.integrations"), "utf-8")
|
|
9958
9979
|
);
|
|
9959
9980
|
return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
|
|
9960
9981
|
} catch {
|
|
@@ -10050,7 +10071,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
10050
10071
|
var lastVersionCheckAt = 0;
|
|
10051
10072
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
10052
10073
|
var lastResponsivenessProbeAt = 0;
|
|
10053
|
-
var agtCliVersion = true ? "0.28.
|
|
10074
|
+
var agtCliVersion = true ? "0.28.511" : "dev";
|
|
10054
10075
|
function resolveBrewPath(execFileSync2) {
|
|
10055
10076
|
try {
|
|
10056
10077
|
const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -10438,7 +10459,7 @@ async function ensureOpencodeBinary() {
|
|
|
10438
10459
|
try {
|
|
10439
10460
|
const prefix = execFileSync2("npm", ["prefix", "-g"], { encoding: "utf-8", timeout: 1e4 }).trim();
|
|
10440
10461
|
if (prefix) {
|
|
10441
|
-
const npmBin =
|
|
10462
|
+
const npmBin = join28(prefix, "bin");
|
|
10442
10463
|
const current = (process.env.PATH ?? "").split(pathDelimiter);
|
|
10443
10464
|
if (!current.includes(npmBin)) {
|
|
10444
10465
|
process.env.PATH = [npmBin, ...current.filter(Boolean)].join(pathDelimiter);
|
|
@@ -10555,7 +10576,7 @@ ${r.stderr}`;
|
|
|
10555
10576
|
}
|
|
10556
10577
|
var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
10557
10578
|
function selfUpdateAppliedMarkerPath() {
|
|
10558
|
-
return
|
|
10579
|
+
return join28(homedir12(), ".augmented", ".last-self-update-applied");
|
|
10559
10580
|
}
|
|
10560
10581
|
var selfUpdateUpToDateLogged = false;
|
|
10561
10582
|
var selfUpdatePinnedLogged = false;
|
|
@@ -10583,7 +10604,7 @@ async function checkAndUpdateCli(opts) {
|
|
|
10583
10604
|
const isNpmGlobal = !isBrewFormula && resolvedPath.includes("node_modules");
|
|
10584
10605
|
if (!isBrewFormula && !isNpmGlobal) return "noop";
|
|
10585
10606
|
const { readFileSync: readF, writeFileSync: writeF } = await import("fs");
|
|
10586
|
-
const markerPath =
|
|
10607
|
+
const markerPath = join28(homedir12(), ".augmented", ".last-update-check");
|
|
10587
10608
|
if (!force) {
|
|
10588
10609
|
try {
|
|
10589
10610
|
const lastCheck = parseInt(readF(markerPath, "utf-8").trim(), 10);
|
|
@@ -10943,12 +10964,12 @@ async function checkClaudeAuth() {
|
|
|
10943
10964
|
var evalEmptyMcpConfigPath = null;
|
|
10944
10965
|
function ensureEvalEmptyMcpConfig() {
|
|
10945
10966
|
if (evalEmptyMcpConfigPath && existsSync12(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
|
|
10946
|
-
const dir =
|
|
10967
|
+
const dir = join28(homedir12(), ".augmented");
|
|
10947
10968
|
try {
|
|
10948
10969
|
mkdirSync10(dir, { recursive: true });
|
|
10949
10970
|
} catch {
|
|
10950
10971
|
}
|
|
10951
|
-
const p =
|
|
10972
|
+
const p = join28(dir, ".eval-empty-mcp.json");
|
|
10952
10973
|
writeFileSync13(p, JSON.stringify({ mcpServers: {} }));
|
|
10953
10974
|
evalEmptyMcpConfigPath = p;
|
|
10954
10975
|
return p;
|
|
@@ -11040,10 +11061,10 @@ function resolveConversationEvalBackend() {
|
|
|
11040
11061
|
return conversationEvalBackend;
|
|
11041
11062
|
}
|
|
11042
11063
|
function getStateFile() {
|
|
11043
|
-
return
|
|
11064
|
+
return join28(config?.configDir ?? join28(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
|
|
11044
11065
|
}
|
|
11045
11066
|
function channelHashCacheDir() {
|
|
11046
|
-
return config?.configDir ??
|
|
11067
|
+
return config?.configDir ?? join28(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
11047
11068
|
}
|
|
11048
11069
|
function loadChannelHashCache2() {
|
|
11049
11070
|
loadChannelHashCache(agentState.knownChannelConfigHashes, channelHashCacheDir());
|
|
@@ -11097,7 +11118,7 @@ function removeDeliveryBaselineEntries(agentId) {
|
|
|
11097
11118
|
var _channelQuarantineStore = null;
|
|
11098
11119
|
function channelQuarantineStore() {
|
|
11099
11120
|
if (!_channelQuarantineStore) {
|
|
11100
|
-
const dir = config?.configDir ??
|
|
11121
|
+
const dir = config?.configDir ?? join28(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
11101
11122
|
_channelQuarantineStore = new ChannelQuarantineStore(defaultQuarantinePath(dir));
|
|
11102
11123
|
}
|
|
11103
11124
|
return _channelQuarantineStore;
|
|
@@ -11114,7 +11135,7 @@ function claudeMdSizeFor(codeName) {
|
|
|
11114
11135
|
var _hostFlagStore = null;
|
|
11115
11136
|
function hostFlagStore() {
|
|
11116
11137
|
if (!_hostFlagStore) {
|
|
11117
|
-
const dir = config?.configDir ??
|
|
11138
|
+
const dir = config?.configDir ?? join28(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
11118
11139
|
_hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
|
|
11119
11140
|
}
|
|
11120
11141
|
return _hostFlagStore;
|
|
@@ -11185,12 +11206,12 @@ function parseSkillFrontmatter(content) {
|
|
|
11185
11206
|
}
|
|
11186
11207
|
async function refreshSkillsIndexInClaudeMd(configDir, codeName, log2) {
|
|
11187
11208
|
const { readdirSync: readdirSync8, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync14 } = await import("fs");
|
|
11188
|
-
const skillsDir =
|
|
11189
|
-
const claudeMdPath =
|
|
11209
|
+
const skillsDir = join28(configDir, codeName, "project", ".claude", "skills");
|
|
11210
|
+
const claudeMdPath = join28(configDir, codeName, "project", "CLAUDE.md");
|
|
11190
11211
|
if (!ex(skillsDir) || !ex(claudeMdPath)) return;
|
|
11191
11212
|
const entries = [];
|
|
11192
11213
|
for (const dir of readdirSync8(skillsDir).sort()) {
|
|
11193
|
-
const skillFile =
|
|
11214
|
+
const skillFile = join28(skillsDir, dir, "SKILL.md");
|
|
11194
11215
|
if (!ex(skillFile)) continue;
|
|
11195
11216
|
try {
|
|
11196
11217
|
const { name, description } = parseSkillFrontmatter(rfs(skillFile, "utf-8"));
|
|
@@ -11257,7 +11278,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
11257
11278
|
if (codeNames.length === 0) return;
|
|
11258
11279
|
void (async () => {
|
|
11259
11280
|
try {
|
|
11260
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
11281
|
+
const { collectDiagnostics } = await import("../persistent-session-CMG4VWT6.js");
|
|
11261
11282
|
await api.post("/host/heartbeat", {
|
|
11262
11283
|
host_id: hostId,
|
|
11263
11284
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor)
|
|
@@ -11364,7 +11385,7 @@ async function pollCycle() {
|
|
|
11364
11385
|
}
|
|
11365
11386
|
try {
|
|
11366
11387
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
11367
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
11388
|
+
const { collectDiagnostics } = await import("../persistent-session-CMG4VWT6.js");
|
|
11368
11389
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
11369
11390
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor) : void 0;
|
|
11370
11391
|
let tailscaleHostname;
|
|
@@ -11479,7 +11500,7 @@ async function pollCycle() {
|
|
|
11479
11500
|
collectResponsivenessProbes,
|
|
11480
11501
|
collectPanelessActivityProbes,
|
|
11481
11502
|
getResponsivenessIntervalMs
|
|
11482
|
-
} = await import("../responsiveness-probe-
|
|
11503
|
+
} = await import("../responsiveness-probe-COMUJVPF.js");
|
|
11483
11504
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
11484
11505
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
11485
11506
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -11543,7 +11564,7 @@ async function pollCycle() {
|
|
|
11543
11564
|
collectResponsivenessProbes,
|
|
11544
11565
|
livePendingInboundOldestAgeSeconds,
|
|
11545
11566
|
parkPendingInbound
|
|
11546
|
-
} = await import("../responsiveness-probe-
|
|
11567
|
+
} = await import("../responsiveness-probe-COMUJVPF.js");
|
|
11547
11568
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
|
|
11548
11569
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
11549
11570
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -11635,10 +11656,10 @@ async function pollCycle() {
|
|
|
11635
11656
|
const paneTail = readFileSync22(paneLogPath(codeName), "utf8").slice(-65536);
|
|
11636
11657
|
const transient = detectTransientApiErrorInLog(paneTail);
|
|
11637
11658
|
if (transient) {
|
|
11638
|
-
const wedgeHome =
|
|
11659
|
+
const wedgeHome = join28(homedir12(), ".augmented", codeName);
|
|
11639
11660
|
if (existsSync12(wedgeHome)) {
|
|
11640
11661
|
atomicWriteFileSync(
|
|
11641
|
-
|
|
11662
|
+
join28(wedgeHome, "watchdog-give-up.json"),
|
|
11642
11663
|
JSON.stringify({
|
|
11643
11664
|
gave_up_at: wedgeNow.toISOString(),
|
|
11644
11665
|
reason: "transient_overload"
|
|
@@ -11909,7 +11930,7 @@ async function pollCycle() {
|
|
|
11909
11930
|
const adapter = resolveAgentFramework(prev.codeName);
|
|
11910
11931
|
stopAgentRuntime2(prev.codeName, "removed-from-host");
|
|
11911
11932
|
killAgentChannelProcesses(prev.codeName, { log });
|
|
11912
|
-
const agentDir =
|
|
11933
|
+
const agentDir = join28(adapter.getAgentDir(prev.codeName), "provision");
|
|
11913
11934
|
await cleanupAgentFiles(prev.codeName, agentDir);
|
|
11914
11935
|
clearAgentCaches(prev.agentId, prev.codeName);
|
|
11915
11936
|
}
|
|
@@ -11996,10 +12017,10 @@ async function pollCycle() {
|
|
|
11996
12017
|
// pending-inbound marker. Best-effort: a write failure is logged by
|
|
11997
12018
|
// the watchdog, never fails the poll cycle.
|
|
11998
12019
|
signalGiveUp: (codeName) => {
|
|
11999
|
-
const dir =
|
|
12020
|
+
const dir = join28(homedir12(), ".augmented", codeName);
|
|
12000
12021
|
if (!existsSync12(dir)) return;
|
|
12001
12022
|
atomicWriteFileSync(
|
|
12002
|
-
|
|
12023
|
+
join28(dir, "watchdog-give-up.json"),
|
|
12003
12024
|
JSON.stringify({ gave_up_at: (/* @__PURE__ */ new Date()).toISOString() })
|
|
12004
12025
|
);
|
|
12005
12026
|
}
|
|
@@ -12141,7 +12162,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12141
12162
|
}
|
|
12142
12163
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12143
12164
|
const adapter = resolveAgentFramework(agent.code_name);
|
|
12144
|
-
let agentDir =
|
|
12165
|
+
let agentDir = join28(adapter.getAgentDir(agent.code_name), "provision");
|
|
12145
12166
|
if (agent.status === "draft" || agent.status === "paused") {
|
|
12146
12167
|
if (previousKnownStatus !== agent.status) {
|
|
12147
12168
|
log(`Agent '${agent.code_name}' is ${agent.status}, skipping provisioning`);
|
|
@@ -12315,7 +12336,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12315
12336
|
const frameworkId = refreshData.agent.framework ?? DEFAULT_FRAMEWORK;
|
|
12316
12337
|
agentFrameworkCache.set(agent.code_name, frameworkId);
|
|
12317
12338
|
const frameworkAdapter = getFramework(frameworkId);
|
|
12318
|
-
agentDir =
|
|
12339
|
+
agentDir = join28(frameworkAdapter.getAgentDir(agent.code_name), "provision");
|
|
12319
12340
|
cacheAgentDeliveryMetadata(agent.code_name, refreshData);
|
|
12320
12341
|
agentRestartTimezoneInputs.set(agent.code_name, {
|
|
12321
12342
|
agentTimezone: typeof refreshData.agent.timezone === "string" ? refreshData.agent.timezone : null,
|
|
@@ -12364,7 +12385,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12364
12385
|
const changedFiles = [];
|
|
12365
12386
|
mkdirSync10(agentDir, { recursive: true });
|
|
12366
12387
|
for (const artifact of artifacts) {
|
|
12367
|
-
const filePath =
|
|
12388
|
+
const filePath = join28(agentDir, artifact.relativePath);
|
|
12368
12389
|
let existingHash;
|
|
12369
12390
|
let newHash;
|
|
12370
12391
|
let writeContent = artifact.content;
|
|
@@ -12383,7 +12404,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12383
12404
|
};
|
|
12384
12405
|
newHash = sha256(stripDynamicSections(artifact.content));
|
|
12385
12406
|
try {
|
|
12386
|
-
const projectClaudeMd =
|
|
12407
|
+
const projectClaudeMd = join28(config.configDir, agent.code_name, "project", "CLAUDE.md");
|
|
12387
12408
|
const existing = readFileSync22(projectClaudeMd, "utf-8");
|
|
12388
12409
|
existingHash = sha256(stripDynamicSections(existing));
|
|
12389
12410
|
} catch {
|
|
@@ -12434,12 +12455,12 @@ async function processAgent(agent, agentStates) {
|
|
|
12434
12455
|
}
|
|
12435
12456
|
}
|
|
12436
12457
|
if (changedFiles.length > 0) {
|
|
12437
|
-
const isFirst = !existsSync12(
|
|
12458
|
+
const isFirst = !existsSync12(join28(agentDir, "CHARTER.md"));
|
|
12438
12459
|
const verb = isFirst ? "Provisioning" : "Updating";
|
|
12439
12460
|
const fileNames = changedFiles.map((f) => f.relativePath).join(", ");
|
|
12440
12461
|
log(`${verb} '${agent.code_name}': ${fileNames}`);
|
|
12441
12462
|
for (const file of changedFiles) {
|
|
12442
|
-
const filePath =
|
|
12463
|
+
const filePath = join28(agentDir, file.relativePath);
|
|
12443
12464
|
mkdirSync10(dirname8(filePath), { recursive: true });
|
|
12444
12465
|
if (file.relativePath === ".mcp.json") {
|
|
12445
12466
|
safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
|
|
@@ -12448,12 +12469,12 @@ async function processAgent(agent, agentStates) {
|
|
|
12448
12469
|
}
|
|
12449
12470
|
}
|
|
12450
12471
|
try {
|
|
12451
|
-
const provSkillsDir =
|
|
12472
|
+
const provSkillsDir = join28(agentDir, ".claude", "skills");
|
|
12452
12473
|
if (existsSync12(provSkillsDir)) {
|
|
12453
12474
|
for (const folder of readdirSync7(provSkillsDir)) {
|
|
12454
12475
|
if (folder.startsWith("knowledge-")) {
|
|
12455
12476
|
try {
|
|
12456
|
-
rmSync5(
|
|
12477
|
+
rmSync5(join28(provSkillsDir, folder), { recursive: true });
|
|
12457
12478
|
} catch {
|
|
12458
12479
|
}
|
|
12459
12480
|
}
|
|
@@ -12466,7 +12487,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12466
12487
|
const trackedFiles2 = frameworkAdapter.driftTrackedFiles();
|
|
12467
12488
|
const hashes = /* @__PURE__ */ new Map();
|
|
12468
12489
|
for (const file of trackedFiles2) {
|
|
12469
|
-
const h = hashFile(
|
|
12490
|
+
const h = hashFile(join28(agentDir, file));
|
|
12470
12491
|
if (h) hashes.set(file, h);
|
|
12471
12492
|
}
|
|
12472
12493
|
agentState.writtenHashes.set(agent.agent_id, hashes);
|
|
@@ -12484,14 +12505,14 @@ async function processAgent(agent, agentStates) {
|
|
|
12484
12505
|
}
|
|
12485
12506
|
if (Array.isArray(refreshData.workflows)) {
|
|
12486
12507
|
try {
|
|
12487
|
-
const provWorkflowsDir =
|
|
12508
|
+
const provWorkflowsDir = join28(agentDir, ".claude", "workflows");
|
|
12488
12509
|
if (existsSync12(provWorkflowsDir)) {
|
|
12489
12510
|
const expected = new Set(refreshData.workflows.map((w) => `${w.name}.js`));
|
|
12490
12511
|
for (const file of readdirSync7(provWorkflowsDir)) {
|
|
12491
12512
|
if (!file.endsWith(".js")) continue;
|
|
12492
12513
|
if (expected.has(file)) continue;
|
|
12493
12514
|
try {
|
|
12494
|
-
rmSync5(
|
|
12515
|
+
rmSync5(join28(provWorkflowsDir, file));
|
|
12495
12516
|
} catch {
|
|
12496
12517
|
}
|
|
12497
12518
|
}
|
|
@@ -12573,7 +12594,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12573
12594
|
if (written && existsSync12(agentDir)) {
|
|
12574
12595
|
const driftedFiles = [];
|
|
12575
12596
|
for (const [file, expectedHash] of written) {
|
|
12576
|
-
const localHash = hashFile(
|
|
12597
|
+
const localHash = hashFile(join28(agentDir, file));
|
|
12577
12598
|
if (localHash && localHash !== expectedHash) {
|
|
12578
12599
|
driftedFiles.push(file);
|
|
12579
12600
|
}
|
|
@@ -12584,7 +12605,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12584
12605
|
try {
|
|
12585
12606
|
const localHashes = {};
|
|
12586
12607
|
for (const file of driftedFiles) {
|
|
12587
|
-
localHashes[file] = hashFile(
|
|
12608
|
+
localHashes[file] = hashFile(join28(agentDir, file));
|
|
12588
12609
|
}
|
|
12589
12610
|
await api.post("/host/drift", {
|
|
12590
12611
|
agent_id: agent.agent_id,
|
|
@@ -12786,7 +12807,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12786
12807
|
const addedChannels = [...restartDecision.added];
|
|
12787
12808
|
const writeDmNoticeMarkers = isChannelAddRestart ? () => {
|
|
12788
12809
|
try {
|
|
12789
|
-
const agentAugmentedDir =
|
|
12810
|
+
const agentAugmentedDir = join28(homedir12(), ".augmented", agent.code_name);
|
|
12790
12811
|
mkdirSync10(agentAugmentedDir, { recursive: true });
|
|
12791
12812
|
const markerJson = JSON.stringify({
|
|
12792
12813
|
version: 1,
|
|
@@ -12794,7 +12815,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12794
12815
|
added: addedChannels
|
|
12795
12816
|
});
|
|
12796
12817
|
for (const file of ["slack-channel-add-restart.json", "telegram-channel-add-restart.json"]) {
|
|
12797
|
-
atomicWriteFileSync(
|
|
12818
|
+
atomicWriteFileSync(join28(agentAugmentedDir, file), markerJson);
|
|
12798
12819
|
}
|
|
12799
12820
|
} catch (err) {
|
|
12800
12821
|
log(`[hot-reload] channel-add DM-notice marker write failed for '${agent.code_name}' (non-fatal): ${err.message}`);
|
|
@@ -12983,18 +13004,18 @@ async function processAgent(agent, agentStates) {
|
|
|
12983
13004
|
if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code") {
|
|
12984
13005
|
try {
|
|
12985
13006
|
const agentProvisionDir = agentDir;
|
|
12986
|
-
const projectDir =
|
|
13007
|
+
const projectDir = join28(homedir12(), ".augmented", agent.code_name, "project");
|
|
12987
13008
|
mkdirSync10(agentProvisionDir, { recursive: true });
|
|
12988
13009
|
mkdirSync10(projectDir, { recursive: true });
|
|
12989
|
-
const provisionMcpPath =
|
|
12990
|
-
const projectMcpPath =
|
|
13010
|
+
const provisionMcpPath = join28(agentProvisionDir, ".mcp.json");
|
|
13011
|
+
const projectMcpPath = join28(projectDir, ".mcp.json");
|
|
12991
13012
|
let mcpConfig = { mcpServers: {} };
|
|
12992
13013
|
try {
|
|
12993
13014
|
mcpConfig = JSON.parse(readFileSync22(provisionMcpPath, "utf-8"));
|
|
12994
13015
|
if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
|
|
12995
13016
|
} catch {
|
|
12996
13017
|
}
|
|
12997
|
-
const localDirectChatChannel =
|
|
13018
|
+
const localDirectChatChannel = join28(homedir12(), ".augmented", "_mcp", "direct-chat-channel.js");
|
|
12998
13019
|
const directChatTeamSettings = refreshData.team?.settings;
|
|
12999
13020
|
const directChatTz = (() => {
|
|
13000
13021
|
const tz = directChatTeamSettings?.["timezone"];
|
|
@@ -13020,7 +13041,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13020
13041
|
// ~/.augmented/<codeName>/.current-turn-initiator.json. Note getAgentDir
|
|
13021
13042
|
// returns the agent root (NOT the /provision subdir `agentDir` points at),
|
|
13022
13043
|
// so it byte-matches the broker readers' path.
|
|
13023
|
-
AGT_TURN_INITIATOR_FILE:
|
|
13044
|
+
AGT_TURN_INITIATOR_FILE: join28(
|
|
13024
13045
|
frameworkAdapter.getAgentDir(agent.code_name),
|
|
13025
13046
|
".current-turn-initiator.json"
|
|
13026
13047
|
)
|
|
@@ -13040,7 +13061,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13040
13061
|
log(`Channel credentials written for '${agent.code_name}/direct-chat'`);
|
|
13041
13062
|
}
|
|
13042
13063
|
}
|
|
13043
|
-
const staleChannelsPath =
|
|
13064
|
+
const staleChannelsPath = join28(projectDir, ".mcp-channels.json");
|
|
13044
13065
|
if (existsSync12(staleChannelsPath)) {
|
|
13045
13066
|
try {
|
|
13046
13067
|
rmSync5(staleChannelsPath, { force: true });
|
|
@@ -13130,7 +13151,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13130
13151
|
}
|
|
13131
13152
|
if (hostFlagStore().getBoolean("connectivity-probe")) {
|
|
13132
13153
|
try {
|
|
13133
|
-
const probeProjectDir =
|
|
13154
|
+
const probeProjectDir = join28(homedir12(), ".augmented", agent.code_name, "project");
|
|
13134
13155
|
let probeSet = integrations;
|
|
13135
13156
|
try {
|
|
13136
13157
|
const quarantined = await api.post("/host/agent-integrations/quarantined", { agent_id: agent.agent_id });
|
|
@@ -13176,7 +13197,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13176
13197
|
const forceDue = attemptsLeft > 0;
|
|
13177
13198
|
let probeRan = false;
|
|
13178
13199
|
try {
|
|
13179
|
-
const probeProjectDir =
|
|
13200
|
+
const probeProjectDir = join28(homedir12(), ".augmented", agent.code_name, "project");
|
|
13180
13201
|
probeRan = await runAgentSessionToolBindProbes(agent, integrations, probeProjectDir, { forceDue });
|
|
13181
13202
|
} catch (err) {
|
|
13182
13203
|
log(`Session-tool-bind probe failed for '${agent.code_name}': ${err.message}`);
|
|
@@ -13253,8 +13274,8 @@ async function processAgent(agent, agentStates) {
|
|
|
13253
13274
|
const intHash = computeIntegrationsHash(integrations);
|
|
13254
13275
|
const prevIntHash = agentState.knownIntegrationHashes.get(agent.agent_id);
|
|
13255
13276
|
if (intHash !== prevIntHash) {
|
|
13256
|
-
const projectDir =
|
|
13257
|
-
const envIntPath =
|
|
13277
|
+
const projectDir = join28(homedir12(), ".augmented", agent.code_name, "project");
|
|
13278
|
+
const envIntPath = join28(projectDir, ".env.integrations");
|
|
13258
13279
|
let preWriteEnv;
|
|
13259
13280
|
try {
|
|
13260
13281
|
preWriteEnv = readFileSync22(envIntPath, "utf-8");
|
|
@@ -13276,7 +13297,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13276
13297
|
}
|
|
13277
13298
|
if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
|
|
13278
13299
|
try {
|
|
13279
|
-
const projectMcpPath =
|
|
13300
|
+
const projectMcpPath = join28(projectDir, ".mcp.json");
|
|
13280
13301
|
const postWriteEnv = readFileSync22(envIntPath, "utf-8");
|
|
13281
13302
|
const mcpContent = readFileSync22(projectMcpPath, "utf-8");
|
|
13282
13303
|
const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
|
|
@@ -13519,10 +13540,21 @@ async function processAgent(agent, agentStates) {
|
|
|
13519
13540
|
}));
|
|
13520
13541
|
const bundle = buildIntegrationBundle(renderedScopes);
|
|
13521
13542
|
const contentHash = createHash17("sha256").update(bundleFingerprint(bundle.files)).digest("hex").slice(0, 12);
|
|
13522
|
-
|
|
13523
|
-
|
|
13543
|
+
if (!shouldWriteIntegrationSkill(
|
|
13544
|
+
agentState.knownSkillHashes,
|
|
13545
|
+
agent.agent_id,
|
|
13546
|
+
integrationSkillId,
|
|
13547
|
+
contentHash
|
|
13548
|
+
)) {
|
|
13549
|
+
continue;
|
|
13550
|
+
}
|
|
13524
13551
|
frameworkAdapter.installSkillFiles(agent.code_name, integrationSkillId, bundle.files);
|
|
13525
|
-
|
|
13552
|
+
rememberIntegrationSkill(
|
|
13553
|
+
agentState.knownSkillHashes,
|
|
13554
|
+
agent.agent_id,
|
|
13555
|
+
integrationSkillId,
|
|
13556
|
+
contentHash
|
|
13557
|
+
);
|
|
13526
13558
|
for (const s of scopes) installedIntegrationSkills.push(s.skill_name);
|
|
13527
13559
|
log(`Installed integration skill bundle '${integrationSkillId}' for '${agent.code_name}' (${scopes.length} scope(s))`);
|
|
13528
13560
|
} catch (err) {
|
|
@@ -13535,12 +13567,12 @@ async function processAgent(agent, agentStates) {
|
|
|
13535
13567
|
const frameworkId2 = frameworkAdapter.id;
|
|
13536
13568
|
const candidateSkillDirs = [
|
|
13537
13569
|
// Claude Code — framework runtime tree
|
|
13538
|
-
|
|
13570
|
+
join28(homedir13(), ".augmented", agent.code_name, "skills"),
|
|
13539
13571
|
// Claude Code — project tree
|
|
13540
|
-
|
|
13572
|
+
join28(homedir13(), ".augmented", agent.code_name, "project", ".claude", "skills"),
|
|
13541
13573
|
// Defensive: legacy provision-side path, not currently an
|
|
13542
13574
|
// install target but cheap to sweep.
|
|
13543
|
-
|
|
13575
|
+
join28(agentDir, ".claude", "skills")
|
|
13544
13576
|
];
|
|
13545
13577
|
const existingDirs = candidateSkillDirs.filter((d) => existsSync12(d));
|
|
13546
13578
|
const discoveredEntries = /* @__PURE__ */ new Set();
|
|
@@ -13555,12 +13587,17 @@ async function processAgent(agent, agentStates) {
|
|
|
13555
13587
|
}
|
|
13556
13588
|
}
|
|
13557
13589
|
const removeSkillFolder = (entry, reason) => {
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
|
|
13561
|
-
|
|
13590
|
+
removeIntegrationSkillFolder({
|
|
13591
|
+
cache: agentState.knownSkillHashes,
|
|
13592
|
+
agentId: agent.agent_id,
|
|
13593
|
+
entry,
|
|
13594
|
+
dirs: existingDirs,
|
|
13595
|
+
removeDir: (p) => {
|
|
13596
|
+
if (existsSync12(p)) {
|
|
13597
|
+
rmSync6(p, { recursive: true, force: true });
|
|
13598
|
+
}
|
|
13562
13599
|
}
|
|
13563
|
-
}
|
|
13600
|
+
});
|
|
13564
13601
|
log(`Removed ${reason} '${entry}' for '${agent.code_name}' (framework=${frameworkId2})`);
|
|
13565
13602
|
};
|
|
13566
13603
|
for (const entry of discoveredEntries) {
|
|
@@ -13576,7 +13613,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13576
13613
|
const sharedSkillsPayload = refreshAny.shared_skills;
|
|
13577
13614
|
const desiredResolved = globalSkillsPayload !== void 0 || sharedSkillsPayload !== void 0;
|
|
13578
13615
|
const manifestPath = managedSkillManifestPath(
|
|
13579
|
-
|
|
13616
|
+
join28(homedir12(), ".augmented", agent.code_name)
|
|
13580
13617
|
);
|
|
13581
13618
|
const prevIds = /* @__PURE__ */ new Set([
|
|
13582
13619
|
...agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
|
|
@@ -13596,15 +13633,15 @@ async function processAgent(agent, agentStates) {
|
|
|
13596
13633
|
}
|
|
13597
13634
|
if (plan.removes.length) {
|
|
13598
13635
|
const globalSkillDirs = [
|
|
13599
|
-
|
|
13600
|
-
|
|
13601
|
-
|
|
13636
|
+
join28(homedir12(), ".augmented", agent.code_name, "skills"),
|
|
13637
|
+
join28(homedir12(), ".augmented", agent.code_name, "project", ".claude", "skills"),
|
|
13638
|
+
join28(agentDir, ".claude", "skills")
|
|
13602
13639
|
];
|
|
13603
13640
|
for (const id of plan.removes) {
|
|
13604
13641
|
let prunedAny = false;
|
|
13605
13642
|
for (const dir of globalSkillDirs) {
|
|
13606
|
-
const p =
|
|
13607
|
-
if (existsSync12(p) && existsSync12(
|
|
13643
|
+
const p = join28(dir, id);
|
|
13644
|
+
if (existsSync12(p) && existsSync12(join28(p, "SKILL.md"))) {
|
|
13608
13645
|
rmSync5(p, { recursive: true, force: true });
|
|
13609
13646
|
prunedAny = true;
|
|
13610
13647
|
}
|
|
@@ -13835,7 +13872,7 @@ async function processAgent(agent, agentStates) {
|
|
|
13835
13872
|
const sess = getSessionState(agent.code_name);
|
|
13836
13873
|
let mcpJsonParsed = null;
|
|
13837
13874
|
try {
|
|
13838
|
-
const mcpPath =
|
|
13875
|
+
const mcpPath = join28(getProjectDir(agent.code_name), ".mcp.json");
|
|
13839
13876
|
mcpJsonParsed = JSON.parse(readFileSync22(mcpPath, "utf-8"));
|
|
13840
13877
|
} catch {
|
|
13841
13878
|
}
|
|
@@ -14262,7 +14299,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
|
|
|
14262
14299
|
if (trackedFiles.length > 0 && existsSync12(agentDir)) {
|
|
14263
14300
|
const hashes = /* @__PURE__ */ new Map();
|
|
14264
14301
|
for (const file of trackedFiles) {
|
|
14265
|
-
const h = hashFile(
|
|
14302
|
+
const h = hashFile(join28(agentDir, file));
|
|
14266
14303
|
if (h) hashes.set(file, h);
|
|
14267
14304
|
}
|
|
14268
14305
|
agentState.writtenHashes.set(agent.agent_id, hashes);
|
|
@@ -14277,7 +14314,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
|
|
|
14277
14314
|
refreshData.agent.onboarding_state
|
|
14278
14315
|
);
|
|
14279
14316
|
const obStep = obState.step;
|
|
14280
|
-
const markerPath =
|
|
14317
|
+
const markerPath = join28(homedir12(), ".augmented", agent.code_name, "onboarding-drive.json");
|
|
14281
14318
|
const marker = readOnboardingDriveMarker(markerPath);
|
|
14282
14319
|
const decision = decideOnboardingDrive(obStep, marker, Date.now(), obState.generation ?? 0);
|
|
14283
14320
|
if (decision.clearMarker) {
|
|
@@ -14365,7 +14402,7 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
|
|
|
14365
14402
|
}
|
|
14366
14403
|
stopOpencodeSlackIngest(codeName, log);
|
|
14367
14404
|
stopOpencodeTelegramIngest(codeName, log);
|
|
14368
|
-
const opencodeProjectDir =
|
|
14405
|
+
const opencodeProjectDir = join28(getFramework("opencode").getAgentDir(codeName), "provision");
|
|
14369
14406
|
const serveEnv = {
|
|
14370
14407
|
AGT_HOST: requireHost(),
|
|
14371
14408
|
AGT_API_KEY: getApiKey() ?? void 0,
|
|
@@ -14415,8 +14452,8 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
14415
14452
|
});
|
|
14416
14453
|
}
|
|
14417
14454
|
const projectDir = getProjectDir(codeName);
|
|
14418
|
-
const mcpConfigPath =
|
|
14419
|
-
const claudeMdPath =
|
|
14455
|
+
const mcpConfigPath = join28(projectDir, ".mcp.json");
|
|
14456
|
+
const claudeMdPath = join28(projectDir, "CLAUDE.md");
|
|
14420
14457
|
if (restartBreaker.isTripped(codeName)) {
|
|
14421
14458
|
const trip = restartBreaker.getTrip(codeName);
|
|
14422
14459
|
return {
|
|
@@ -15035,7 +15072,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
15035
15072
|
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}`));
|
|
15036
15073
|
void (async () => {
|
|
15037
15074
|
try {
|
|
15038
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
15075
|
+
const { collectDiagnostics } = await import("../persistent-session-CMG4VWT6.js");
|
|
15039
15076
|
await api.post("/host/heartbeat", {
|
|
15040
15077
|
host_id: hostId,
|
|
15041
15078
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor)
|
|
@@ -15085,7 +15122,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
15085
15122
|
}
|
|
15086
15123
|
try {
|
|
15087
15124
|
const hostId = await getHostId();
|
|
15088
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
15125
|
+
const { collectDiagnostics } = await import("../persistent-session-CMG4VWT6.js");
|
|
15089
15126
|
await api.post("/host/heartbeat", {
|
|
15090
15127
|
host_id: hostId,
|
|
15091
15128
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor)
|
|
@@ -15603,7 +15640,7 @@ async function processClaudePairSessions(agents) {
|
|
|
15603
15640
|
killPairSession,
|
|
15604
15641
|
pairTmuxSession,
|
|
15605
15642
|
finalizeClaudePairOnboarding
|
|
15606
|
-
} = await import("../claude-pair-runtime-
|
|
15643
|
+
} = await import("../claude-pair-runtime-AK6RLKSR.js");
|
|
15607
15644
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
15608
15645
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
15609
15646
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -15857,8 +15894,8 @@ function parseMemoryFile(raw, fallbackName) {
|
|
|
15857
15894
|
};
|
|
15858
15895
|
}
|
|
15859
15896
|
async function syncMemories(agent, configDir, log2) {
|
|
15860
|
-
const projectDir =
|
|
15861
|
-
const memoryDir =
|
|
15897
|
+
const projectDir = join28(configDir, agent.code_name, "project");
|
|
15898
|
+
const memoryDir = join28(projectDir, "memory");
|
|
15862
15899
|
const isFreshSync = pendingFreshMemorySync.has(agent.agent_id);
|
|
15863
15900
|
if (isFreshSync) {
|
|
15864
15901
|
log2(`[memory-sync] Fresh-sync requested for '${agent.code_name}' \u2014 pulling DB first`);
|
|
@@ -15876,7 +15913,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
15876
15913
|
for (const file of readdirSync7(memoryDir)) {
|
|
15877
15914
|
if (!file.endsWith(".md")) continue;
|
|
15878
15915
|
try {
|
|
15879
|
-
const raw = readFileSync22(
|
|
15916
|
+
const raw = readFileSync22(join28(memoryDir, file), "utf-8");
|
|
15880
15917
|
const fileHash = createHash16("sha256").update(raw).digest("hex").slice(0, 16);
|
|
15881
15918
|
currentHashes.set(file, fileHash);
|
|
15882
15919
|
if (prevHashes.get(file) === fileHash) continue;
|
|
@@ -15901,7 +15938,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
15901
15938
|
} catch (err) {
|
|
15902
15939
|
for (const mem of changedMemories) {
|
|
15903
15940
|
for (const [file] of currentHashes) {
|
|
15904
|
-
const parsed = parseMemoryFile(readFileSync22(
|
|
15941
|
+
const parsed = parseMemoryFile(readFileSync22(join28(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
|
|
15905
15942
|
if (parsed?.name === mem.name) currentHashes.delete(file);
|
|
15906
15943
|
}
|
|
15907
15944
|
}
|
|
@@ -15936,7 +15973,7 @@ async function downloadMemories(agent, memoryDir, log2, { force }) {
|
|
|
15936
15973
|
const mem = dbMemories.memories[i];
|
|
15937
15974
|
const rawSlug = mem.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "").slice(0, 60);
|
|
15938
15975
|
const slug = rawSlug || `memory-${i}`;
|
|
15939
|
-
const filePath =
|
|
15976
|
+
const filePath = join28(memoryDir, `${slug}.md`);
|
|
15940
15977
|
const desired = `---
|
|
15941
15978
|
name: ${JSON.stringify(mem.name)}
|
|
15942
15979
|
type: ${mem.type}
|
|
@@ -16239,7 +16276,7 @@ function startManager(opts) {
|
|
|
16239
16276
|
log(`[startup] state rehydration failed (continuing with empty state): ${err.message}`);
|
|
16240
16277
|
}
|
|
16241
16278
|
log(
|
|
16242
|
-
`[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${
|
|
16279
|
+
`[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join28(homedir12(), ".augmented", "manager.log")}`
|
|
16243
16280
|
);
|
|
16244
16281
|
deployMcpAssets();
|
|
16245
16282
|
reapOrphanChannelMcps({ log });
|
|
@@ -16365,14 +16402,14 @@ function restartRunningChannelMcps(basenames) {
|
|
|
16365
16402
|
}
|
|
16366
16403
|
}
|
|
16367
16404
|
function deployMcpAssets() {
|
|
16368
|
-
const targetDir =
|
|
16405
|
+
const targetDir = join28(homedir12(), ".augmented", "_mcp");
|
|
16369
16406
|
mkdirSync10(targetDir, { recursive: true });
|
|
16370
16407
|
const moduleDir = dirname8(fileURLToPath(import.meta.url));
|
|
16371
16408
|
let mcpSourceDir = "";
|
|
16372
16409
|
let dir = moduleDir;
|
|
16373
16410
|
for (let i = 0; i < 6; i++) {
|
|
16374
|
-
const candidate =
|
|
16375
|
-
if (existsSync12(
|
|
16411
|
+
const candidate = join28(dir, "dist", "mcp");
|
|
16412
|
+
if (existsSync12(join28(candidate, "index.js"))) {
|
|
16376
16413
|
mcpSourceDir = candidate;
|
|
16377
16414
|
break;
|
|
16378
16415
|
}
|
|
@@ -16452,8 +16489,8 @@ function deployMcpAssets() {
|
|
|
16452
16489
|
// needs restarting to pick up a token rotation.
|
|
16453
16490
|
"xero.js"
|
|
16454
16491
|
]) {
|
|
16455
|
-
const src =
|
|
16456
|
-
const dst =
|
|
16492
|
+
const src = join28(mcpSourceDir, file);
|
|
16493
|
+
const dst = join28(targetDir, file);
|
|
16457
16494
|
if (!existsSync12(src)) continue;
|
|
16458
16495
|
const before = fileHash(dst);
|
|
16459
16496
|
try {
|
|
@@ -16471,14 +16508,14 @@ function deployMcpAssets() {
|
|
|
16471
16508
|
log(`[manager] Bundle(s) updated: ${changedBasenames.join(", ")} \u2014 signalling running instances to restart`);
|
|
16472
16509
|
restartRunningChannelMcps(changedBasenames);
|
|
16473
16510
|
}
|
|
16474
|
-
const localMcpPath =
|
|
16511
|
+
const localMcpPath = join28(targetDir, "index.js");
|
|
16475
16512
|
try {
|
|
16476
|
-
const agentsDir =
|
|
16513
|
+
const agentsDir = join28(homedir12(), ".augmented", "agents");
|
|
16477
16514
|
if (existsSync12(agentsDir)) {
|
|
16478
16515
|
for (const entry of readdirSync7(agentsDir, { withFileTypes: true })) {
|
|
16479
16516
|
if (!entry.isDirectory()) continue;
|
|
16480
16517
|
for (const subdir of ["provision", "project"]) {
|
|
16481
|
-
const mcpJsonPath =
|
|
16518
|
+
const mcpJsonPath = join28(agentsDir, entry.name, subdir, ".mcp.json");
|
|
16482
16519
|
try {
|
|
16483
16520
|
const raw = readFileSync22(mcpJsonPath, "utf-8");
|
|
16484
16521
|
if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
|