@integrity-labs/agt-cli 0.28.1006 → 0.28.1008
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 +6 -5
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-O6R6HS2Z.js → chunk-7IA22OU6.js} +73 -8
- package/dist/chunk-7IA22OU6.js.map +1 -0
- package/dist/chunk-EL5MWGGH.js +160 -0
- package/dist/chunk-EL5MWGGH.js.map +1 -0
- package/dist/{chunk-XWMUQR65.js → chunk-KGVYZBS2.js} +1 -1
- package/dist/{chunk-XWMUQR65.js.map → chunk-KGVYZBS2.js.map} +1 -1
- package/dist/{chunk-Z5UDL4AB.js → chunk-VBQU3ATJ.js} +40 -8
- package/dist/chunk-VBQU3ATJ.js.map +1 -0
- package/dist/{claude-code-updater-45MB2AXE.js → claude-code-updater-NEJCTT7S.js} +7 -3
- package/dist/claude-code-updater-NEJCTT7S.js.map +1 -0
- package/dist/{claude-pair-runtime-AW4N6NEE.js → claude-pair-runtime-5JVOLSQY.js} +19 -4
- package/dist/claude-pair-runtime-5JVOLSQY.js.map +1 -0
- package/dist/lib/manager-worker.js +170 -155
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-K4DLZ7KF.js → persistent-session-MMXQ3V3H.js} +6 -3
- package/dist/{responsiveness-probe-DXPEIUH6.js → responsiveness-probe-UE5I7ZXI.js} +4 -3
- package/dist/{responsiveness-probe-DXPEIUH6.js.map → responsiveness-probe-UE5I7ZXI.js.map} +1 -1
- package/dist/{session-auth-dead-4SE5Q7MU.js → session-auth-dead-YAYE7YGZ.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-O6R6HS2Z.js.map +0 -1
- package/dist/chunk-Z5UDL4AB.js.map +0 -1
- package/dist/claude-code-updater-45MB2AXE.js.map +0 -1
- package/dist/claude-pair-runtime-AW4N6NEE.js.map +0 -1
- /package/dist/{persistent-session-K4DLZ7KF.js.map → persistent-session-MMXQ3V3H.js.map} +0 -0
- /package/dist/{session-auth-dead-4SE5Q7MU.js.map → session-auth-dead-YAYE7YGZ.js.map} +0 -0
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
safeWriteJsonAtomic,
|
|
65
65
|
setConfigHash,
|
|
66
66
|
tripClass
|
|
67
|
-
} from "../chunk-
|
|
67
|
+
} from "../chunk-VBQU3ATJ.js";
|
|
68
68
|
import {
|
|
69
69
|
getProjectDir as getProjectDir2,
|
|
70
70
|
getReadyTasks,
|
|
@@ -142,7 +142,7 @@ import {
|
|
|
142
142
|
takeZombieDetection,
|
|
143
143
|
toOpencodeModel,
|
|
144
144
|
writeEgressAllowlist
|
|
145
|
-
} from "../chunk-
|
|
145
|
+
} from "../chunk-7IA22OU6.js";
|
|
146
146
|
import {
|
|
147
147
|
ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
|
|
148
148
|
AnchorSessionClient,
|
|
@@ -241,11 +241,18 @@ import {
|
|
|
241
241
|
subagentActivityAgeSeconds,
|
|
242
242
|
sumTranscriptUsageInWindow,
|
|
243
243
|
transcriptActivityAgeSeconds
|
|
244
|
-
} from "../chunk-
|
|
244
|
+
} from "../chunk-KGVYZBS2.js";
|
|
245
245
|
import "../chunk-DHWNVVX4.js";
|
|
246
246
|
import {
|
|
247
247
|
reapOrphanChannelMcps
|
|
248
248
|
} from "../chunk-XWVM4KPK.js";
|
|
249
|
+
import {
|
|
250
|
+
CLAUDE_CONFIG_DIR_ENV,
|
|
251
|
+
claudeConfigDirFor,
|
|
252
|
+
claudeConfigDirIsReady,
|
|
253
|
+
effectiveClaudeJsonPath,
|
|
254
|
+
seedClaudeConfigFromLegacy
|
|
255
|
+
} from "../chunk-EL5MWGGH.js";
|
|
249
256
|
import "../chunk-DGUM43GV.js";
|
|
250
257
|
|
|
251
258
|
// src/lib/manager-worker.ts
|
|
@@ -276,8 +283,8 @@ function defaultUnique() {
|
|
|
276
283
|
|
|
277
284
|
// src/lib/manager-worker.ts
|
|
278
285
|
import { execFileSync as syncExecFile } from "child_process";
|
|
279
|
-
import { join as
|
|
280
|
-
import { homedir as
|
|
286
|
+
import { join as join42, dirname as dirname11, delimiter as pathDelimiter } from "path";
|
|
287
|
+
import { homedir as homedir17 } from "os";
|
|
281
288
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
282
289
|
|
|
283
290
|
// ../../packages/core/dist/provisioning/channel-policy-env.js
|
|
@@ -6646,10 +6653,8 @@ function pruneStuckStreaksToAgents(maps, activeAgentIds) {
|
|
|
6646
6653
|
|
|
6647
6654
|
// src/lib/claude-device-state.ts
|
|
6648
6655
|
import { readFileSync as readFileSync25, statSync as statSync9 } from "fs";
|
|
6649
|
-
import { homedir as homedir13 } from "os";
|
|
6650
|
-
import { join as join31 } from "path";
|
|
6651
6656
|
function claudeDeviceStatePath(env = process.env) {
|
|
6652
|
-
return
|
|
6657
|
+
return effectiveClaudeJsonPath(void 0, env);
|
|
6653
6658
|
}
|
|
6654
6659
|
function probeClaudeDeviceStatePresence(path = claudeDeviceStatePath()) {
|
|
6655
6660
|
try {
|
|
@@ -7350,7 +7355,7 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash, options)
|
|
|
7350
7355
|
}
|
|
7351
7356
|
|
|
7352
7357
|
// src/lib/manager/integration-skill-cache.ts
|
|
7353
|
-
import { join as
|
|
7358
|
+
import { join as join31 } from "path";
|
|
7354
7359
|
function integrationSkillHashKey(agentId, skillId) {
|
|
7355
7360
|
return `plugin-skill:${agentId}:${skillId}`;
|
|
7356
7361
|
}
|
|
@@ -7366,16 +7371,16 @@ function forgetIntegrationSkill(cache2, agentId, skillId) {
|
|
|
7366
7371
|
function removeIntegrationSkillFolder(opts) {
|
|
7367
7372
|
forgetIntegrationSkill(opts.cache, opts.agentId, opts.entry);
|
|
7368
7373
|
for (const dir of opts.dirs) {
|
|
7369
|
-
opts.removeDir(
|
|
7374
|
+
opts.removeDir(join31(dir, opts.entry));
|
|
7370
7375
|
}
|
|
7371
7376
|
}
|
|
7372
7377
|
|
|
7373
7378
|
// src/lib/manager/managed-skill-manifest.ts
|
|
7374
7379
|
import { existsSync as existsSync13, mkdirSync as mkdirSync10, readFileSync as readFileSync26, writeFileSync as writeFileSync12 } from "fs";
|
|
7375
|
-
import { dirname as dirname8, join as
|
|
7380
|
+
import { dirname as dirname8, join as join32 } from "path";
|
|
7376
7381
|
var MANIFEST_VERSION = 1;
|
|
7377
7382
|
function managedSkillManifestPath(agentRootDir) {
|
|
7378
|
-
return
|
|
7383
|
+
return join32(agentRootDir, "managed-skills.json");
|
|
7379
7384
|
}
|
|
7380
7385
|
function readManagedSkillManifest(path) {
|
|
7381
7386
|
try {
|
|
@@ -7510,8 +7515,8 @@ function resolveModelChain(refreshData) {
|
|
|
7510
7515
|
|
|
7511
7516
|
// src/lib/manager/claude-auth.ts
|
|
7512
7517
|
import { existsSync as existsSync14, rmSync as rmSync6 } from "fs";
|
|
7513
|
-
import { join as
|
|
7514
|
-
import { homedir as
|
|
7518
|
+
import { join as join33 } from "path";
|
|
7519
|
+
import { homedir as homedir13 } from "os";
|
|
7515
7520
|
async function applyClaudeAuthToEnv(childEnv, label) {
|
|
7516
7521
|
const apiKey = getApiKey();
|
|
7517
7522
|
if (!apiKey) {
|
|
@@ -7523,9 +7528,9 @@ async function applyClaudeAuthToEnv(childEnv, label) {
|
|
|
7523
7528
|
throw new Error("claude_auth_mode=api_key but /host/exchange returned no decrypted key");
|
|
7524
7529
|
}
|
|
7525
7530
|
childEnv.ANTHROPIC_API_KEY = exchange.anthropicApiKey;
|
|
7526
|
-
const claudeDir =
|
|
7531
|
+
const claudeDir = join33(homedir13(), ".claude");
|
|
7527
7532
|
for (const filename of [".credentials.json", "credentials.json"]) {
|
|
7528
|
-
const p =
|
|
7533
|
+
const p = join33(claudeDir, filename);
|
|
7529
7534
|
if (existsSync14(p)) {
|
|
7530
7535
|
try {
|
|
7531
7536
|
rmSync6(p, { force: true });
|
|
@@ -7882,11 +7887,11 @@ function formatBoardForPrompt(items, template) {
|
|
|
7882
7887
|
|
|
7883
7888
|
// src/lib/manager/kanban/nudge-state-cache.ts
|
|
7884
7889
|
import { existsSync as existsSync15, readFileSync as readFileSync27, writeFileSync as writeFileSync13 } from "fs";
|
|
7885
|
-
import { join as
|
|
7890
|
+
import { join as join34 } from "path";
|
|
7886
7891
|
var CACHE_FILENAME2 = "kanban-nudge-state.json";
|
|
7887
7892
|
var KANBAN_NUDGE_STATE_VERSION = 1;
|
|
7888
7893
|
function getKanbanNudgeStateFile(configDir) {
|
|
7889
|
-
return
|
|
7894
|
+
return join34(configDir, CACHE_FILENAME2);
|
|
7890
7895
|
}
|
|
7891
7896
|
function loadKanbanNudgeState(target, configDir) {
|
|
7892
7897
|
const path = getKanbanNudgeStateFile(configDir);
|
|
@@ -8512,8 +8517,8 @@ function closeSessionRunForCode(codeName, outcome, reason) {
|
|
|
8512
8517
|
// src/lib/manager/scheduler/kanban-route.ts
|
|
8513
8518
|
import { createHash as createHash15 } from "crypto";
|
|
8514
8519
|
import { writeFileSync as writeFileSync14, renameSync as renameSync8, mkdirSync as mkdirSync11, readFileSync as readFileSync28, unlinkSync as unlinkSync3 } from "fs";
|
|
8515
|
-
import { homedir as
|
|
8516
|
-
import { join as
|
|
8520
|
+
import { homedir as homedir14 } from "os";
|
|
8521
|
+
import { join as join35, dirname as dirname9 } from "path";
|
|
8517
8522
|
|
|
8518
8523
|
// src/lib/manager/scheduler/notify.ts
|
|
8519
8524
|
import { createHash as createHash14 } from "crypto";
|
|
@@ -8872,7 +8877,7 @@ function resolveScheduledSlackTarget(task) {
|
|
|
8872
8877
|
}
|
|
8873
8878
|
function stampScheduledTurnMarker(codeName, taskId, target) {
|
|
8874
8879
|
try {
|
|
8875
|
-
const file =
|
|
8880
|
+
const file = join35(homedir14(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
|
|
8876
8881
|
const marker = { ts: Date.now(), task_id: taskId, ...target ? { target } : {} };
|
|
8877
8882
|
const tmp = `${file}.tmp`;
|
|
8878
8883
|
writeFileSync14(tmp, JSON.stringify(marker), "utf8");
|
|
@@ -8882,7 +8887,7 @@ function stampScheduledTurnMarker(codeName, taskId, target) {
|
|
|
8882
8887
|
}
|
|
8883
8888
|
}
|
|
8884
8889
|
function clearScheduledTurnMarkerForTask(codeName, taskId) {
|
|
8885
|
-
const file =
|
|
8890
|
+
const file = join35(homedir14(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
|
|
8886
8891
|
try {
|
|
8887
8892
|
const raw = JSON.parse(readFileSync28(file, "utf8"));
|
|
8888
8893
|
if (typeof raw?.task_id !== "string" || raw.task_id !== taskId) return;
|
|
@@ -8944,7 +8949,7 @@ async function routeScheduledTaskViaKanban(codeName, agentId, task, prompt, dura
|
|
|
8944
8949
|
return false;
|
|
8945
8950
|
}
|
|
8946
8951
|
try {
|
|
8947
|
-
const doorbell = directChatDoorbellPath(agentId,
|
|
8952
|
+
const doorbell = directChatDoorbellPath(agentId, homedir14());
|
|
8948
8953
|
mkdirSync11(dirname9(doorbell), { recursive: true });
|
|
8949
8954
|
writeFileSync14(doorbell, String(Date.now()));
|
|
8950
8955
|
} catch (err) {
|
|
@@ -9099,12 +9104,12 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
9099
9104
|
|
|
9100
9105
|
// src/lib/manager/scheduler/execution.ts
|
|
9101
9106
|
import { createHash as createHash16 } from "crypto";
|
|
9102
|
-
import { homedir as
|
|
9103
|
-
import { join as
|
|
9107
|
+
import { homedir as homedir15 } from "os";
|
|
9108
|
+
import { join as join37 } from "path";
|
|
9104
9109
|
|
|
9105
9110
|
// src/lib/agent-serving-probe.ts
|
|
9106
9111
|
import { readFileSync as readFileSync29, readdirSync as readdirSync8, statSync as statSync10 } from "fs";
|
|
9107
|
-
import { join as
|
|
9112
|
+
import { join as join36 } from "path";
|
|
9108
9113
|
var RATE_LIMIT_WINDOW_MS = 6 * 60 * 60 * 1e3;
|
|
9109
9114
|
function probeRateLimit(args) {
|
|
9110
9115
|
const now = args.now ?? /* @__PURE__ */ new Date();
|
|
@@ -9120,7 +9125,7 @@ function probeRateLimit(args) {
|
|
|
9120
9125
|
let newest = UNKNOWN_RATE_LIMIT;
|
|
9121
9126
|
for (const name of entries) {
|
|
9122
9127
|
if (!name.endsWith(".jsonl")) continue;
|
|
9123
|
-
const path =
|
|
9128
|
+
const path = join36(dir, name);
|
|
9124
9129
|
try {
|
|
9125
9130
|
const st = statSync10(path);
|
|
9126
9131
|
if (!st.isFile() || st.mtimeMs < startMs) continue;
|
|
@@ -9191,7 +9196,7 @@ function shouldLogUsageCapDeferral(site, codeName, limitedUntil) {
|
|
|
9191
9196
|
|
|
9192
9197
|
// src/lib/manager/scheduler/execution.ts
|
|
9193
9198
|
function claudePidFilePath() {
|
|
9194
|
-
return
|
|
9199
|
+
return join37(homedir15(), ".augmented", "manager-claude-pids.json");
|
|
9195
9200
|
}
|
|
9196
9201
|
var inFlightClaudePids = /* @__PURE__ */ new Map();
|
|
9197
9202
|
function registerClaudeSpawn(record) {
|
|
@@ -9262,7 +9267,7 @@ async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData
|
|
|
9262
9267
|
|
|
9263
9268
|
// src/lib/occupancy-gate.ts
|
|
9264
9269
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync9, readSync as readSync2, statSync as statSync11 } from "fs";
|
|
9265
|
-
import { join as
|
|
9270
|
+
import { join as join38 } from "path";
|
|
9266
9271
|
function rostersMeasuredZero(mode, attested, runtimeRunning) {
|
|
9267
9272
|
return mode === "enforce" && attested && runtimeRunning;
|
|
9268
9273
|
}
|
|
@@ -9353,10 +9358,10 @@ function candidateTranscriptPaths(dir) {
|
|
|
9353
9358
|
let complete = true;
|
|
9354
9359
|
for (const name of top) {
|
|
9355
9360
|
if (name.endsWith(".jsonl")) {
|
|
9356
|
-
paths.push(
|
|
9361
|
+
paths.push(join38(dir, name));
|
|
9357
9362
|
continue;
|
|
9358
9363
|
}
|
|
9359
|
-
const subDir =
|
|
9364
|
+
const subDir = join38(dir, name, "subagents");
|
|
9360
9365
|
let subs;
|
|
9361
9366
|
try {
|
|
9362
9367
|
subs = readdirSync9(subDir);
|
|
@@ -9365,7 +9370,7 @@ function candidateTranscriptPaths(dir) {
|
|
|
9365
9370
|
continue;
|
|
9366
9371
|
}
|
|
9367
9372
|
for (const sub of subs) {
|
|
9368
|
-
if (sub.endsWith(".jsonl")) paths.push(
|
|
9373
|
+
if (sub.endsWith(".jsonl")) paths.push(join38(subDir, sub));
|
|
9369
9374
|
}
|
|
9370
9375
|
}
|
|
9371
9376
|
return { paths, complete };
|
|
@@ -10904,7 +10909,7 @@ async function fireOpencodeScheduledTask(agent, task) {
|
|
|
10904
10909
|
import { createHash as createHash19 } from "crypto";
|
|
10905
10910
|
import { existsSync as existsSync17, mkdirSync as mkdirSync12, readFileSync as readFileSync31, renameSync as renameSync9, unlinkSync as unlinkSync4, writeFileSync as writeFileSync15 } from "fs";
|
|
10906
10911
|
import { randomUUID } from "crypto";
|
|
10907
|
-
import { join as
|
|
10912
|
+
import { join as join39 } from "path";
|
|
10908
10913
|
|
|
10909
10914
|
// src/lib/telegram-ingest.ts
|
|
10910
10915
|
import https2 from "https";
|
|
@@ -11461,7 +11466,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
|
|
|
11461
11466
|
let filePath;
|
|
11462
11467
|
try {
|
|
11463
11468
|
dir = getFramework("opencode").getAgentDir(codeName);
|
|
11464
|
-
filePath =
|
|
11469
|
+
filePath = join39(dir, "telegram-getupdates-offset-opencode.json");
|
|
11465
11470
|
} catch {
|
|
11466
11471
|
dir = null;
|
|
11467
11472
|
filePath = null;
|
|
@@ -11745,14 +11750,14 @@ function partitionActionableByPoison(actionable, states, config2) {
|
|
|
11745
11750
|
|
|
11746
11751
|
// src/lib/restart-flags.ts
|
|
11747
11752
|
import { existsSync as existsSync18, mkdirSync as mkdirSync13, readdirSync as readdirSync10, readFileSync as readFileSync32, renameSync as renameSync10, rmSync as rmSync7, writeFileSync as writeFileSync16 } from "fs";
|
|
11748
|
-
import { homedir as
|
|
11749
|
-
import { join as
|
|
11753
|
+
import { homedir as homedir16 } from "os";
|
|
11754
|
+
import { join as join40 } from "path";
|
|
11750
11755
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
11751
11756
|
function restartFlagsDir() {
|
|
11752
|
-
return
|
|
11757
|
+
return join40(homedir16(), ".augmented", "restart-flags");
|
|
11753
11758
|
}
|
|
11754
11759
|
function flagPath(codeName) {
|
|
11755
|
-
return
|
|
11760
|
+
return join40(restartFlagsDir(), `${codeName}.flag`);
|
|
11756
11761
|
}
|
|
11757
11762
|
function readRestartFlags() {
|
|
11758
11763
|
const dir = restartFlagsDir();
|
|
@@ -11761,7 +11766,7 @@ function readRestartFlags() {
|
|
|
11761
11766
|
for (const entry of readdirSync10(dir)) {
|
|
11762
11767
|
if (!entry.endsWith(".flag")) continue;
|
|
11763
11768
|
try {
|
|
11764
|
-
const raw = readFileSync32(
|
|
11769
|
+
const raw = readFileSync32(join40(dir, entry), "utf8");
|
|
11765
11770
|
const parsed = JSON.parse(raw);
|
|
11766
11771
|
if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
|
|
11767
11772
|
parsed.codeName = entry.replace(/\.flag$/, "");
|
|
@@ -11880,7 +11885,7 @@ async function sendError(flag, opts, text) {
|
|
|
11880
11885
|
|
|
11881
11886
|
// src/lib/restart-context.ts
|
|
11882
11887
|
import { readdirSync as readdirSync11, readFileSync as readFileSync33, writeFileSync as writeFileSync17, mkdirSync as mkdirSync14, unlinkSync as unlinkSync5 } from "fs";
|
|
11883
|
-
import { dirname as dirname10, join as
|
|
11888
|
+
import { dirname as dirname10, join as join41 } from "path";
|
|
11884
11889
|
var SLACK_PENDING_INBOUND_DIRNAME = "slack-pending-inbound";
|
|
11885
11890
|
var SLACK_RESTART_CONTEXT_DIRNAME = "slack-restart-context";
|
|
11886
11891
|
var MAX_TOPIC_CHARS = 140;
|
|
@@ -11892,10 +11897,10 @@ function augmentedAgentDir(codeName) {
|
|
|
11892
11897
|
return dirname10(getProjectDir(codeName));
|
|
11893
11898
|
}
|
|
11894
11899
|
function slackPendingInboundDir(codeName) {
|
|
11895
|
-
return
|
|
11900
|
+
return join41(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
|
|
11896
11901
|
}
|
|
11897
11902
|
function slackRestartContextDir(codeName) {
|
|
11898
|
-
return
|
|
11903
|
+
return join41(augmentedAgentDir(codeName), SLACK_RESTART_CONTEXT_DIRNAME);
|
|
11899
11904
|
}
|
|
11900
11905
|
function sanitizeTopic(raw) {
|
|
11901
11906
|
const cleaned = raw.replace(/\s+/g, " ").trim().replace(/[<>]/g, " ").replace(/\s+/g, " ").trim();
|
|
@@ -11955,7 +11960,7 @@ function pruneHintsExcept(codeName, freshFilenames) {
|
|
|
11955
11960
|
if (!filename.endsWith(".json")) continue;
|
|
11956
11961
|
if (freshFilenames.has(filename)) continue;
|
|
11957
11962
|
try {
|
|
11958
|
-
unlinkSync5(
|
|
11963
|
+
unlinkSync5(join41(ctxDir, filename));
|
|
11959
11964
|
} catch {
|
|
11960
11965
|
}
|
|
11961
11966
|
}
|
|
@@ -11976,7 +11981,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
|
|
|
11976
11981
|
}
|
|
11977
11982
|
const markers = [];
|
|
11978
11983
|
for (const filename of markerFilenames.slice(0, cap)) {
|
|
11979
|
-
const parsed = readStrandedMarker(
|
|
11984
|
+
const parsed = readStrandedMarker(join41(markerDir, filename));
|
|
11980
11985
|
if (parsed) markers.push({ filename, channel: parsed.channel, thread_ts: parsed.thread_ts });
|
|
11981
11986
|
}
|
|
11982
11987
|
if (markers.length === 0) {
|
|
@@ -11990,7 +11995,7 @@ function refreshSlackRestartContextHints(codeNames, opts = {}) {
|
|
|
11990
11995
|
const freshFilenames = /* @__PURE__ */ new Set();
|
|
11991
11996
|
for (const { filename, hint } of hints) {
|
|
11992
11997
|
try {
|
|
11993
|
-
writeHintFile(
|
|
11998
|
+
writeHintFile(join41(ctxDir, filename), ctxDir, hint);
|
|
11994
11999
|
freshFilenames.add(filename);
|
|
11995
12000
|
} catch (err) {
|
|
11996
12001
|
log2(`[restart-context] ${codeName}: hint write failed for ${filename}: ${err.message}`);
|
|
@@ -13460,7 +13465,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
|
|
|
13460
13465
|
var dayRolloverInboundHold = /* @__PURE__ */ new Map();
|
|
13461
13466
|
var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
|
|
13462
13467
|
async function channelInboundActivityAgeSecondsFor(codeName) {
|
|
13463
|
-
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-
|
|
13468
|
+
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-UE5I7ZXI.js");
|
|
13464
13469
|
const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
|
|
13465
13470
|
if (newest === null) return null;
|
|
13466
13471
|
return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
|
|
@@ -13785,7 +13790,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
|
|
|
13785
13790
|
var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
|
|
13786
13791
|
function projectMcpHash(_codeName, projectDir) {
|
|
13787
13792
|
try {
|
|
13788
|
-
const raw = readFileSync34(
|
|
13793
|
+
const raw = readFileSync34(join42(projectDir, ".mcp.json"), "utf-8");
|
|
13789
13794
|
return createHash20("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
|
|
13790
13795
|
} catch {
|
|
13791
13796
|
return null;
|
|
@@ -13793,7 +13798,7 @@ function projectMcpHash(_codeName, projectDir) {
|
|
|
13793
13798
|
}
|
|
13794
13799
|
function projectMcpKeys(_codeName, projectDir) {
|
|
13795
13800
|
try {
|
|
13796
|
-
const raw = readFileSync34(
|
|
13801
|
+
const raw = readFileSync34(join42(projectDir, ".mcp.json"), "utf-8");
|
|
13797
13802
|
const parsed = JSON.parse(raw);
|
|
13798
13803
|
const servers = parsed.mcpServers;
|
|
13799
13804
|
if (!servers || typeof servers !== "object") return /* @__PURE__ */ new Set();
|
|
@@ -13811,7 +13816,7 @@ function seedSessionLaunchBaselines(codeName, projectDir) {
|
|
|
13811
13816
|
else runningMcpServerKeys.delete(codeName);
|
|
13812
13817
|
let launchStructure = null;
|
|
13813
13818
|
try {
|
|
13814
|
-
const raw = readFileSync34(
|
|
13819
|
+
const raw = readFileSync34(join42(projectDir, ".mcp.json"), "utf-8");
|
|
13815
13820
|
launchStructure = managedMcpStructureHashFromFile(
|
|
13816
13821
|
JSON.parse(raw),
|
|
13817
13822
|
isManagedMcpServerKey
|
|
@@ -13946,7 +13951,7 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
|
|
|
13946
13951
|
if (result && result.rebindCandidates.length > 0 && hostFlagStore().getBoolean("session-tool-rebind")) {
|
|
13947
13952
|
let mcpJsonForRebind = null;
|
|
13948
13953
|
try {
|
|
13949
|
-
mcpJsonForRebind = JSON.parse(readFileSync34(
|
|
13954
|
+
mcpJsonForRebind = JSON.parse(readFileSync34(join42(projectDir, ".mcp.json"), "utf-8"));
|
|
13950
13955
|
} catch {
|
|
13951
13956
|
mcpJsonForRebind = null;
|
|
13952
13957
|
}
|
|
@@ -14094,7 +14099,7 @@ function shouldInjectChannelSecrets(agentId) {
|
|
|
14094
14099
|
function projectChannelSecretHash(projectDir) {
|
|
14095
14100
|
try {
|
|
14096
14101
|
const entries = parseEnvIntegrations(
|
|
14097
|
-
readFileSync34(
|
|
14102
|
+
readFileSync34(join42(projectDir, ".env.integrations"), "utf-8")
|
|
14098
14103
|
);
|
|
14099
14104
|
return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
|
|
14100
14105
|
} catch {
|
|
@@ -14203,7 +14208,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
14203
14208
|
var lastVersionCheckAt = 0;
|
|
14204
14209
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
14205
14210
|
var lastResponsivenessProbeAt = 0;
|
|
14206
|
-
var agtCliVersion = true ? "0.28.
|
|
14211
|
+
var agtCliVersion = true ? "0.28.1008" : "dev";
|
|
14207
14212
|
function resolveBrewPath(execFileSync2) {
|
|
14208
14213
|
try {
|
|
14209
14214
|
const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -14530,7 +14535,7 @@ function runAsync(cmd, args, opts) {
|
|
|
14530
14535
|
});
|
|
14531
14536
|
}
|
|
14532
14537
|
function claudeManagedSettingsPath() {
|
|
14533
|
-
return
|
|
14538
|
+
return join42(CLAUDE_MANAGED_SETTINGS_DIR, "managed-settings.json");
|
|
14534
14539
|
}
|
|
14535
14540
|
var MANAGED_SETTINGS_KEYS = ["channelsEnabled", "enableAllProjectMcpServers"];
|
|
14536
14541
|
var MANAGED_SETTINGS_ENV = { DISABLE_AUTOUPDATER: "1" };
|
|
@@ -14605,7 +14610,7 @@ async function ensureOpencodeBinary() {
|
|
|
14605
14610
|
try {
|
|
14606
14611
|
const prefix = execFileSync2("npm", ["prefix", "-g"], { encoding: "utf-8", timeout: 1e4 }).trim();
|
|
14607
14612
|
if (prefix) {
|
|
14608
|
-
const npmBin =
|
|
14613
|
+
const npmBin = join42(prefix, "bin");
|
|
14609
14614
|
const current = (process.env.PATH ?? "").split(pathDelimiter);
|
|
14610
14615
|
if (!current.includes(npmBin)) {
|
|
14611
14616
|
process.env.PATH = [npmBin, ...current.filter(Boolean)].join(pathDelimiter);
|
|
@@ -14745,7 +14750,7 @@ async function maybeUpgradeClaudeCode() {
|
|
|
14745
14750
|
}
|
|
14746
14751
|
var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
14747
14752
|
function selfUpdateAppliedMarkerPath() {
|
|
14748
|
-
return
|
|
14753
|
+
return join42(homedir17(), ".augmented", ".last-self-update-applied");
|
|
14749
14754
|
}
|
|
14750
14755
|
var selfUpdateUpToDateLogged = false;
|
|
14751
14756
|
var selfUpdatePinnedLogged = false;
|
|
@@ -14796,7 +14801,7 @@ async function checkAndUpdateCli(opts) {
|
|
|
14796
14801
|
const isNpmGlobal = !isBrewFormula && resolvedPath.includes("node_modules");
|
|
14797
14802
|
if (!isBrewFormula && !isNpmGlobal) return "noop";
|
|
14798
14803
|
const { readFileSync: readF, writeFileSync: writeF } = await import("fs");
|
|
14799
|
-
const markerPath =
|
|
14804
|
+
const markerPath = join42(homedir17(), ".augmented", ".last-update-check");
|
|
14800
14805
|
if (!force) {
|
|
14801
14806
|
try {
|
|
14802
14807
|
const lastCheck = parseInt(readF(markerPath, "utf-8").trim(), 10);
|
|
@@ -15207,7 +15212,7 @@ async function runClaudeRuntimeAuthProbe() {
|
|
|
15207
15212
|
];
|
|
15208
15213
|
try {
|
|
15209
15214
|
const { stdout, stderr } = await execFilePromiseLong(resolveClaudeBinary(), args, {
|
|
15210
|
-
cwd:
|
|
15215
|
+
cwd: homedir17(),
|
|
15211
15216
|
timeout: RUNTIME_AUTH_PROBE_TIMEOUT_MS,
|
|
15212
15217
|
stdin: "ignore",
|
|
15213
15218
|
env: childEnv,
|
|
@@ -15247,7 +15252,7 @@ async function runHostUsageCommand() {
|
|
|
15247
15252
|
""
|
|
15248
15253
|
];
|
|
15249
15254
|
const { stdout } = await execFilePromiseLong(resolveClaudeBinary(), args, {
|
|
15250
|
-
cwd:
|
|
15255
|
+
cwd: homedir17(),
|
|
15251
15256
|
timeout: HOST_USAGE_POLL_TIMEOUT_MS,
|
|
15252
15257
|
stdin: "ignore",
|
|
15253
15258
|
env: childEnv,
|
|
@@ -15294,12 +15299,12 @@ async function checkClaudeAuth() {
|
|
|
15294
15299
|
var evalEmptyMcpConfigPath = null;
|
|
15295
15300
|
function ensureEvalEmptyMcpConfig() {
|
|
15296
15301
|
if (evalEmptyMcpConfigPath && existsSync19(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
|
|
15297
|
-
const dir =
|
|
15302
|
+
const dir = join42(homedir17(), ".augmented");
|
|
15298
15303
|
try {
|
|
15299
15304
|
mkdirSync15(dir, { recursive: true });
|
|
15300
15305
|
} catch {
|
|
15301
15306
|
}
|
|
15302
|
-
const p =
|
|
15307
|
+
const p = join42(dir, ".eval-empty-mcp.json");
|
|
15303
15308
|
writeFileSync18(p, JSON.stringify({ mcpServers: {} }));
|
|
15304
15309
|
evalEmptyMcpConfigPath = p;
|
|
15305
15310
|
return p;
|
|
@@ -15325,7 +15330,7 @@ async function runEvalClaude(prompt, model) {
|
|
|
15325
15330
|
""
|
|
15326
15331
|
];
|
|
15327
15332
|
const { stdout } = await execFilePromiseLong(resolveClaudeBinary(), args, {
|
|
15328
|
-
cwd:
|
|
15333
|
+
cwd: homedir17(),
|
|
15329
15334
|
timeout: 12e4,
|
|
15330
15335
|
stdin: "ignore",
|
|
15331
15336
|
env: childEnv,
|
|
@@ -15394,10 +15399,10 @@ function resolveConversationEvalBackend() {
|
|
|
15394
15399
|
return conversationEvalBackend;
|
|
15395
15400
|
}
|
|
15396
15401
|
function getStateFile() {
|
|
15397
|
-
return
|
|
15402
|
+
return join42(config?.configDir ?? join42(process.env["HOME"] ?? "/tmp", ".augmented"), "manager-state.json");
|
|
15398
15403
|
}
|
|
15399
15404
|
function channelHashCacheDir() {
|
|
15400
|
-
return config?.configDir ??
|
|
15405
|
+
return config?.configDir ?? join42(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
15401
15406
|
}
|
|
15402
15407
|
function loadChannelHashCache2() {
|
|
15403
15408
|
loadChannelHashCache(agentState.knownChannelConfigHashes, channelHashCacheDir());
|
|
@@ -15610,7 +15615,7 @@ function removeDeliveryBaselineEntries(agentId) {
|
|
|
15610
15615
|
var _channelQuarantineStore = null;
|
|
15611
15616
|
function channelQuarantineStore() {
|
|
15612
15617
|
if (!_channelQuarantineStore) {
|
|
15613
|
-
const dir = config?.configDir ??
|
|
15618
|
+
const dir = config?.configDir ?? join42(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
15614
15619
|
_channelQuarantineStore = new ChannelQuarantineStore(defaultQuarantinePath(dir));
|
|
15615
15620
|
}
|
|
15616
15621
|
return _channelQuarantineStore;
|
|
@@ -15618,7 +15623,7 @@ function channelQuarantineStore() {
|
|
|
15618
15623
|
var _channelResumeHistoryStore = null;
|
|
15619
15624
|
function channelResumeHistoryStore() {
|
|
15620
15625
|
if (!_channelResumeHistoryStore) {
|
|
15621
|
-
const dir = config?.configDir ??
|
|
15626
|
+
const dir = config?.configDir ?? join42(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
15622
15627
|
_channelResumeHistoryStore = new ChannelResumeHistoryStore(defaultResumeHistoryPath(dir));
|
|
15623
15628
|
}
|
|
15624
15629
|
return _channelResumeHistoryStore;
|
|
@@ -15644,12 +15649,12 @@ function claudeMdSizeFor(codeName) {
|
|
|
15644
15649
|
}
|
|
15645
15650
|
function forwardedToolsFor(codeName) {
|
|
15646
15651
|
if (!config?.configDir) return null;
|
|
15647
|
-
return readForwardedToolsReport(
|
|
15652
|
+
return readForwardedToolsReport(join42(config.configDir, codeName));
|
|
15648
15653
|
}
|
|
15649
15654
|
var _hostFlagStore = null;
|
|
15650
15655
|
function hostFlagStore() {
|
|
15651
15656
|
if (!_hostFlagStore) {
|
|
15652
|
-
const dir = config?.configDir ??
|
|
15657
|
+
const dir = config?.configDir ?? join42(process.env["HOME"] ?? "/tmp", ".augmented");
|
|
15653
15658
|
_hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
|
|
15654
15659
|
}
|
|
15655
15660
|
return _hostFlagStore;
|
|
@@ -15723,12 +15728,12 @@ function parseSkillFrontmatter(content) {
|
|
|
15723
15728
|
}
|
|
15724
15729
|
async function refreshSkillsIndexInClaudeMd(configDir, codeName, log2) {
|
|
15725
15730
|
const { readdirSync: readdirSync13, readFileSync: rfs, existsSync: ex, writeFileSync: writeFileSync19 } = await import("fs");
|
|
15726
|
-
const skillsDir =
|
|
15727
|
-
const claudeMdPath =
|
|
15731
|
+
const skillsDir = join42(configDir, codeName, "project", ".claude", "skills");
|
|
15732
|
+
const claudeMdPath = join42(configDir, codeName, "project", "CLAUDE.md");
|
|
15728
15733
|
if (!ex(skillsDir) || !ex(claudeMdPath)) return;
|
|
15729
15734
|
const entries = [];
|
|
15730
15735
|
for (const dir of readdirSync13(skillsDir).sort()) {
|
|
15731
|
-
const skillFile =
|
|
15736
|
+
const skillFile = join42(skillsDir, dir, "SKILL.md");
|
|
15732
15737
|
if (!ex(skillFile)) continue;
|
|
15733
15738
|
try {
|
|
15734
15739
|
const { name, description } = parseSkillFrontmatter(rfs(skillFile, "utf-8"));
|
|
@@ -15837,7 +15842,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
15837
15842
|
if (codeNames.length === 0) return;
|
|
15838
15843
|
void (async () => {
|
|
15839
15844
|
try {
|
|
15840
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
15845
|
+
const { collectDiagnostics } = await import("../persistent-session-MMXQ3V3H.js");
|
|
15841
15846
|
await api.post("/host/heartbeat", {
|
|
15842
15847
|
host_id: hostId,
|
|
15843
15848
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
|
|
@@ -15979,7 +15984,7 @@ async function pollCycleInner() {
|
|
|
15979
15984
|
}
|
|
15980
15985
|
try {
|
|
15981
15986
|
const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
|
|
15982
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
15987
|
+
const { collectDiagnostics } = await import("../persistent-session-MMXQ3V3H.js");
|
|
15983
15988
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
15984
15989
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor) : void 0;
|
|
15985
15990
|
let tailscaleHostname;
|
|
@@ -16135,7 +16140,7 @@ async function pollCycleInner() {
|
|
|
16135
16140
|
try {
|
|
16136
16141
|
const desiredClaudeCodeVersion = hbResp?.desired_claude_code_version?.trim();
|
|
16137
16142
|
if (desiredClaudeCodeVersion && decideMaintenanceWindowGate({ window: cachedMaintenanceWindow, now: /* @__PURE__ */ new Date() }) === "proceed") {
|
|
16138
|
-
const { maybeUpdateClaudeCode } = await import("../claude-code-updater-
|
|
16143
|
+
const { maybeUpdateClaudeCode } = await import("../claude-code-updater-NEJCTT7S.js");
|
|
16139
16144
|
await maybeUpdateClaudeCode({
|
|
16140
16145
|
desiredVersion: desiredClaudeCodeVersion,
|
|
16141
16146
|
currentVersion: cachedFrameworkVersion,
|
|
@@ -16155,7 +16160,7 @@ async function pollCycleInner() {
|
|
|
16155
16160
|
collectPanelessActivityProbes,
|
|
16156
16161
|
getResponsivenessIntervalMs,
|
|
16157
16162
|
occupancyQualificationClassifications
|
|
16158
|
-
} = await import("../responsiveness-probe-
|
|
16163
|
+
} = await import("../responsiveness-probe-UE5I7ZXI.js");
|
|
16159
16164
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
16160
16165
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
16161
16166
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -16272,7 +16277,7 @@ async function pollCycleInner() {
|
|
|
16272
16277
|
collectResponsivenessProbes,
|
|
16273
16278
|
livePendingInboundOldestAgeSeconds,
|
|
16274
16279
|
parkPendingInbound
|
|
16275
|
-
} = await import("../responsiveness-probe-
|
|
16280
|
+
} = await import("../responsiveness-probe-UE5I7ZXI.js");
|
|
16276
16281
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-M6AFZWNU.js");
|
|
16277
16282
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
16278
16283
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -16364,10 +16369,10 @@ async function pollCycleInner() {
|
|
|
16364
16369
|
const paneTail = readFileSync34(paneLogPath(codeName), "utf8").slice(-65536);
|
|
16365
16370
|
const transient = detectTransientApiErrorInLog(paneTail);
|
|
16366
16371
|
if (transient) {
|
|
16367
|
-
const wedgeHome =
|
|
16372
|
+
const wedgeHome = join42(homedir17(), ".augmented", codeName);
|
|
16368
16373
|
if (existsSync19(wedgeHome)) {
|
|
16369
16374
|
atomicWriteFileSync(
|
|
16370
|
-
|
|
16375
|
+
join42(wedgeHome, "watchdog-give-up.json"),
|
|
16371
16376
|
JSON.stringify({
|
|
16372
16377
|
gave_up_at: wedgeNow.toISOString(),
|
|
16373
16378
|
reason: "transient_overload"
|
|
@@ -16428,7 +16433,7 @@ async function pollCycleInner() {
|
|
|
16428
16433
|
}
|
|
16429
16434
|
try {
|
|
16430
16435
|
const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
|
|
16431
|
-
const { probeSessionAuth } = await import("../session-auth-dead-
|
|
16436
|
+
const { probeSessionAuth } = await import("../session-auth-dead-YAYE7YGZ.js");
|
|
16432
16437
|
const observations = [];
|
|
16433
16438
|
const pendingCacheCommits = [];
|
|
16434
16439
|
const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
|
|
@@ -16809,7 +16814,7 @@ async function pollCycleInner() {
|
|
|
16809
16814
|
`[drain-flush] FAILED for '${prev.codeName}': ${err.message} \u2014 proceeding to teardown; this session was NOT shipped (ENG-9491)`
|
|
16810
16815
|
);
|
|
16811
16816
|
}
|
|
16812
|
-
const agentDir =
|
|
16817
|
+
const agentDir = join42(adapter.getAgentDir(prev.codeName), "provision");
|
|
16813
16818
|
await cleanupAgentFiles(prev.codeName, agentDir);
|
|
16814
16819
|
clearAgentCaches(prev.agentId, prev.codeName);
|
|
16815
16820
|
}
|
|
@@ -16896,10 +16901,10 @@ async function pollCycleInner() {
|
|
|
16896
16901
|
// pending-inbound marker. Best-effort: a write failure is logged by
|
|
16897
16902
|
// the watchdog, never fails the poll cycle.
|
|
16898
16903
|
signalGiveUp: (codeName) => {
|
|
16899
|
-
const dir =
|
|
16904
|
+
const dir = join42(homedir17(), ".augmented", codeName);
|
|
16900
16905
|
if (!existsSync19(dir)) return;
|
|
16901
16906
|
atomicWriteFileSync(
|
|
16902
|
-
|
|
16907
|
+
join42(dir, "watchdog-give-up.json"),
|
|
16903
16908
|
JSON.stringify({ gave_up_at: (/* @__PURE__ */ new Date()).toISOString() })
|
|
16904
16909
|
);
|
|
16905
16910
|
},
|
|
@@ -16920,7 +16925,7 @@ async function pollCycleInner() {
|
|
|
16920
16925
|
const dir = getFramework("claude-code").getAgentDir(codeName);
|
|
16921
16926
|
if (!existsSync19(dir)) return;
|
|
16922
16927
|
atomicWriteFileSync(
|
|
16923
|
-
|
|
16928
|
+
join42(dir, "watchdog-give-up.json"),
|
|
16924
16929
|
JSON.stringify({
|
|
16925
16930
|
gave_up_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16926
16931
|
reason: "usage_limit",
|
|
@@ -17185,7 +17190,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17185
17190
|
}
|
|
17186
17191
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
17187
17192
|
const adapter = resolveAgentFramework(agent.code_name);
|
|
17188
|
-
let agentDir =
|
|
17193
|
+
let agentDir = join42(adapter.getAgentDir(agent.code_name), "provision");
|
|
17189
17194
|
if (agent.status === "draft" || agent.status === "paused") {
|
|
17190
17195
|
forgetChannelSyncState(agent.agent_id);
|
|
17191
17196
|
if (previousKnownStatus !== agent.status) {
|
|
@@ -17332,7 +17337,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17332
17337
|
if (refreshData.knowledge_manifest) {
|
|
17333
17338
|
const resolved = await resolveKnowledgeFromManifest({
|
|
17334
17339
|
manifest: refreshData.knowledge_manifest,
|
|
17335
|
-
cacheDir:
|
|
17340
|
+
cacheDir: join42(config.configDir, "_knowledge"),
|
|
17336
17341
|
delivery: refreshData.agent?.knowledge_delivery ?? "both",
|
|
17337
17342
|
fetchContents: async (hashes) => {
|
|
17338
17343
|
const res = await api.post(
|
|
@@ -17349,7 +17354,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17349
17354
|
const resolvedSkills = await resolveSkillsFromManifest({
|
|
17350
17355
|
globals: refreshData.global_skills_manifest ?? [],
|
|
17351
17356
|
shared: refreshData.shared_skills_manifest ?? [],
|
|
17352
|
-
cacheDir:
|
|
17357
|
+
cacheDir: join42(config.configDir, "_skills"),
|
|
17353
17358
|
fetchContents: async (hashes) => {
|
|
17354
17359
|
const res = await api.post(
|
|
17355
17360
|
"/host/skills/contents",
|
|
@@ -17367,7 +17372,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17367
17372
|
if (refreshData.integration_skills_manifest) {
|
|
17368
17373
|
const resolvedIntegrationSkills = await resolveIntegrationSkillsFromManifest({
|
|
17369
17374
|
manifest: refreshData.integration_skills_manifest,
|
|
17370
|
-
cacheDir:
|
|
17375
|
+
cacheDir: join42(config.configDir, "_skills"),
|
|
17371
17376
|
fetchContents: async (hashes) => {
|
|
17372
17377
|
const res = await api.post(
|
|
17373
17378
|
"/host/skills/contents",
|
|
@@ -17429,7 +17434,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17429
17434
|
const frameworkId = refreshData.agent.framework ?? DEFAULT_FRAMEWORK;
|
|
17430
17435
|
agentFrameworkCache.set(agent.code_name, frameworkId);
|
|
17431
17436
|
const frameworkAdapter = getFramework(frameworkId);
|
|
17432
|
-
agentDir =
|
|
17437
|
+
agentDir = join42(frameworkAdapter.getAgentDir(agent.code_name), "provision");
|
|
17433
17438
|
cacheAgentDeliveryMetadata(agent.code_name, refreshData);
|
|
17434
17439
|
agentRestartTimezoneInputs.set(agent.code_name, {
|
|
17435
17440
|
agentTimezone: typeof refreshData.agent.timezone === "string" ? refreshData.agent.timezone : null,
|
|
@@ -17488,7 +17493,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17488
17493
|
const changedFiles = [];
|
|
17489
17494
|
mkdirSync15(agentDir, { recursive: true });
|
|
17490
17495
|
for (const artifact of artifacts) {
|
|
17491
|
-
const filePath =
|
|
17496
|
+
const filePath = join42(agentDir, artifact.relativePath);
|
|
17492
17497
|
let existingHash;
|
|
17493
17498
|
let newHash;
|
|
17494
17499
|
let writeContent = artifact.content;
|
|
@@ -17507,7 +17512,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17507
17512
|
};
|
|
17508
17513
|
newHash = sha256(stripDynamicSections(artifact.content));
|
|
17509
17514
|
try {
|
|
17510
|
-
const projectClaudeMd =
|
|
17515
|
+
const projectClaudeMd = join42(config.configDir, agent.code_name, "project", "CLAUDE.md");
|
|
17511
17516
|
const existing = readFileSync34(projectClaudeMd, "utf-8");
|
|
17512
17517
|
existingHash = sha256(stripDynamicSections(existing));
|
|
17513
17518
|
} catch {
|
|
@@ -17558,12 +17563,12 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17558
17563
|
}
|
|
17559
17564
|
}
|
|
17560
17565
|
if (changedFiles.length > 0) {
|
|
17561
|
-
const isFirst = !existsSync19(
|
|
17566
|
+
const isFirst = !existsSync19(join42(agentDir, "CHARTER.md"));
|
|
17562
17567
|
const verb = isFirst ? "Provisioning" : "Updating";
|
|
17563
17568
|
const fileNames = changedFiles.map((f) => f.relativePath).join(", ");
|
|
17564
17569
|
log(`${verb} '${agent.code_name}': ${fileNames}`);
|
|
17565
17570
|
for (const file of changedFiles) {
|
|
17566
|
-
const filePath =
|
|
17571
|
+
const filePath = join42(agentDir, file.relativePath);
|
|
17567
17572
|
mkdirSync15(dirname11(filePath), { recursive: true });
|
|
17568
17573
|
if (file.relativePath === ".mcp.json") {
|
|
17569
17574
|
safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
|
|
@@ -17572,12 +17577,12 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17572
17577
|
}
|
|
17573
17578
|
}
|
|
17574
17579
|
try {
|
|
17575
|
-
const provSkillsDir =
|
|
17580
|
+
const provSkillsDir = join42(agentDir, ".claude", "skills");
|
|
17576
17581
|
if (existsSync19(provSkillsDir)) {
|
|
17577
17582
|
for (const folder of readdirSync12(provSkillsDir)) {
|
|
17578
17583
|
if (folder.startsWith("knowledge-")) {
|
|
17579
17584
|
try {
|
|
17580
|
-
rmSync8(
|
|
17585
|
+
rmSync8(join42(provSkillsDir, folder), { recursive: true });
|
|
17581
17586
|
} catch {
|
|
17582
17587
|
}
|
|
17583
17588
|
}
|
|
@@ -17590,7 +17595,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17590
17595
|
const trackedFiles2 = frameworkAdapter.driftTrackedFiles();
|
|
17591
17596
|
const hashes = /* @__PURE__ */ new Map();
|
|
17592
17597
|
for (const file of trackedFiles2) {
|
|
17593
|
-
const h = hashFile(
|
|
17598
|
+
const h = hashFile(join42(agentDir, file));
|
|
17594
17599
|
if (h) hashes.set(file, h);
|
|
17595
17600
|
}
|
|
17596
17601
|
agentState.writtenHashes.set(agent.agent_id, hashes);
|
|
@@ -17608,14 +17613,14 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17608
17613
|
}
|
|
17609
17614
|
if (Array.isArray(refreshData.workflows)) {
|
|
17610
17615
|
try {
|
|
17611
|
-
const provWorkflowsDir =
|
|
17616
|
+
const provWorkflowsDir = join42(agentDir, ".claude", "workflows");
|
|
17612
17617
|
if (existsSync19(provWorkflowsDir)) {
|
|
17613
17618
|
const expected = new Set(refreshData.workflows.map((w) => `${w.name}.js`));
|
|
17614
17619
|
for (const file of readdirSync12(provWorkflowsDir)) {
|
|
17615
17620
|
if (!file.endsWith(".js")) continue;
|
|
17616
17621
|
if (expected.has(file)) continue;
|
|
17617
17622
|
try {
|
|
17618
|
-
rmSync8(
|
|
17623
|
+
rmSync8(join42(provWorkflowsDir, file));
|
|
17619
17624
|
} catch {
|
|
17620
17625
|
}
|
|
17621
17626
|
}
|
|
@@ -17697,7 +17702,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17697
17702
|
if (written && existsSync19(agentDir)) {
|
|
17698
17703
|
const driftedFiles = [];
|
|
17699
17704
|
for (const [file, expectedHash] of written) {
|
|
17700
|
-
const localHash = hashFile(
|
|
17705
|
+
const localHash = hashFile(join42(agentDir, file));
|
|
17701
17706
|
if (localHash && localHash !== expectedHash) {
|
|
17702
17707
|
driftedFiles.push(file);
|
|
17703
17708
|
}
|
|
@@ -17708,7 +17713,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17708
17713
|
try {
|
|
17709
17714
|
const localHashes = {};
|
|
17710
17715
|
for (const file of driftedFiles) {
|
|
17711
|
-
localHashes[file] = hashFile(
|
|
17716
|
+
localHashes[file] = hashFile(join42(agentDir, file));
|
|
17712
17717
|
}
|
|
17713
17718
|
await api.post("/host/drift", {
|
|
17714
17719
|
agent_id: agent.agent_id,
|
|
@@ -17986,7 +17991,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17986
17991
|
const addedChannels = [...restartDecision.added];
|
|
17987
17992
|
const writeDmNoticeMarkers = isChannelAddRestart ? () => {
|
|
17988
17993
|
try {
|
|
17989
|
-
const agentAugmentedDir =
|
|
17994
|
+
const agentAugmentedDir = join42(homedir17(), ".augmented", agent.code_name);
|
|
17990
17995
|
mkdirSync15(agentAugmentedDir, { recursive: true });
|
|
17991
17996
|
const markerJson = JSON.stringify({
|
|
17992
17997
|
version: 1,
|
|
@@ -17994,7 +17999,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
17994
17999
|
added: addedChannels
|
|
17995
18000
|
});
|
|
17996
18001
|
for (const file of ["slack-channel-add-restart.json", "telegram-channel-add-restart.json"]) {
|
|
17997
|
-
atomicWriteFileSync(
|
|
18002
|
+
atomicWriteFileSync(join42(agentAugmentedDir, file), markerJson);
|
|
17998
18003
|
}
|
|
17999
18004
|
} catch (err) {
|
|
18000
18005
|
log(`[hot-reload] channel-add DM-notice marker write failed for '${agent.code_name}' (non-fatal): ${err.message}`);
|
|
@@ -18293,18 +18298,18 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18293
18298
|
if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code") {
|
|
18294
18299
|
try {
|
|
18295
18300
|
const agentProvisionDir = agentDir;
|
|
18296
|
-
const projectDir =
|
|
18301
|
+
const projectDir = join42(homedir17(), ".augmented", agent.code_name, "project");
|
|
18297
18302
|
mkdirSync15(agentProvisionDir, { recursive: true });
|
|
18298
18303
|
mkdirSync15(projectDir, { recursive: true });
|
|
18299
|
-
const provisionMcpPath =
|
|
18300
|
-
const projectMcpPath =
|
|
18304
|
+
const provisionMcpPath = join42(agentProvisionDir, ".mcp.json");
|
|
18305
|
+
const projectMcpPath = join42(projectDir, ".mcp.json");
|
|
18301
18306
|
let mcpConfig = { mcpServers: {} };
|
|
18302
18307
|
try {
|
|
18303
18308
|
mcpConfig = JSON.parse(readFileSync34(provisionMcpPath, "utf-8"));
|
|
18304
18309
|
if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
|
|
18305
18310
|
} catch {
|
|
18306
18311
|
}
|
|
18307
|
-
const localDirectChatChannel =
|
|
18312
|
+
const localDirectChatChannel = join42(homedir17(), ".augmented", "_mcp", "direct-chat-channel.js");
|
|
18308
18313
|
const directChatTeamSettings = refreshData.team?.settings;
|
|
18309
18314
|
const directChatTz = (() => {
|
|
18310
18315
|
const tz = directChatTeamSettings?.["timezone"];
|
|
@@ -18330,7 +18335,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18330
18335
|
// ~/.augmented/<codeName>/.current-turn-initiator.json. Note getAgentDir
|
|
18331
18336
|
// returns the agent root (NOT the /provision subdir `agentDir` points at),
|
|
18332
18337
|
// so it byte-matches the broker readers' path.
|
|
18333
|
-
AGT_TURN_INITIATOR_FILE:
|
|
18338
|
+
AGT_TURN_INITIATOR_FILE: join42(
|
|
18334
18339
|
frameworkAdapter.getAgentDir(agent.code_name),
|
|
18335
18340
|
".current-turn-initiator.json"
|
|
18336
18341
|
)
|
|
@@ -18350,7 +18355,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18350
18355
|
log(`Channel credentials written for '${agent.code_name}/direct-chat'`);
|
|
18351
18356
|
}
|
|
18352
18357
|
}
|
|
18353
|
-
const staleChannelsPath =
|
|
18358
|
+
const staleChannelsPath = join42(projectDir, ".mcp-channels.json");
|
|
18354
18359
|
if (existsSync19(staleChannelsPath)) {
|
|
18355
18360
|
try {
|
|
18356
18361
|
rmSync8(staleChannelsPath, { force: true });
|
|
@@ -18463,7 +18468,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18463
18468
|
}
|
|
18464
18469
|
if (hostFlagStore().getBoolean("connectivity-probe")) {
|
|
18465
18470
|
try {
|
|
18466
|
-
const probeProjectDir =
|
|
18471
|
+
const probeProjectDir = join42(homedir17(), ".augmented", agent.code_name, "project");
|
|
18467
18472
|
let probeSet = integrations;
|
|
18468
18473
|
const fetchQuarantined = async () => {
|
|
18469
18474
|
const quarantined = await api.post("/host/agent-integrations/quarantined", { agent_id: agent.agent_id });
|
|
@@ -18523,7 +18528,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18523
18528
|
const forceDue = attemptsLeft > 0;
|
|
18524
18529
|
let probeRan = false;
|
|
18525
18530
|
try {
|
|
18526
|
-
const probeProjectDir =
|
|
18531
|
+
const probeProjectDir = join42(homedir17(), ".augmented", agent.code_name, "project");
|
|
18527
18532
|
probeRan = await runAgentSessionToolBindProbes(agent, integrations, probeProjectDir, { forceDue });
|
|
18528
18533
|
} catch (err) {
|
|
18529
18534
|
log(`Session-tool-bind probe failed for '${agent.code_name}': ${err.message}`);
|
|
@@ -18600,8 +18605,8 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18600
18605
|
const intHash = computeIntegrationsHash(integrations);
|
|
18601
18606
|
const prevIntHash = agentState.knownIntegrationHashes.get(agent.agent_id);
|
|
18602
18607
|
if (intHash !== prevIntHash) {
|
|
18603
|
-
const projectDir =
|
|
18604
|
-
const envIntPath =
|
|
18608
|
+
const projectDir = join42(homedir17(), ".augmented", agent.code_name, "project");
|
|
18609
|
+
const envIntPath = join42(projectDir, ".env.integrations");
|
|
18605
18610
|
let preWriteEnv;
|
|
18606
18611
|
try {
|
|
18607
18612
|
preWriteEnv = readFileSync34(envIntPath, "utf-8");
|
|
@@ -18623,7 +18628,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18623
18628
|
}
|
|
18624
18629
|
if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
|
|
18625
18630
|
try {
|
|
18626
|
-
const projectMcpPath =
|
|
18631
|
+
const projectMcpPath = join42(projectDir, ".mcp.json");
|
|
18627
18632
|
const postWriteEnv = readFileSync34(envIntPath, "utf-8");
|
|
18628
18633
|
const mcpContent = readFileSync34(projectMcpPath, "utf-8");
|
|
18629
18634
|
const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
|
|
@@ -18924,16 +18929,16 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18924
18929
|
}
|
|
18925
18930
|
try {
|
|
18926
18931
|
const { readdirSync: readdirSync13, rmSync: rmSync9 } = await import("fs");
|
|
18927
|
-
const { homedir:
|
|
18932
|
+
const { homedir: homedir18 } = await import("os");
|
|
18928
18933
|
const frameworkId2 = frameworkAdapter.id;
|
|
18929
18934
|
const candidateSkillDirs = [
|
|
18930
18935
|
// Claude Code — framework runtime tree
|
|
18931
|
-
|
|
18936
|
+
join42(homedir18(), ".augmented", agent.code_name, "skills"),
|
|
18932
18937
|
// Claude Code — project tree
|
|
18933
|
-
|
|
18938
|
+
join42(homedir18(), ".augmented", agent.code_name, "project", ".claude", "skills"),
|
|
18934
18939
|
// Defensive: legacy provision-side path, not currently an
|
|
18935
18940
|
// install target but cheap to sweep.
|
|
18936
|
-
|
|
18941
|
+
join42(agentDir, ".claude", "skills")
|
|
18937
18942
|
];
|
|
18938
18943
|
const existingDirs = candidateSkillDirs.filter((d) => existsSync19(d));
|
|
18939
18944
|
const discoveredEntries = /* @__PURE__ */ new Set();
|
|
@@ -18976,7 +18981,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18976
18981
|
const sharedSkillsPayload = refreshAny.shared_skills;
|
|
18977
18982
|
const desiredResolved = globalSkillsPayload !== void 0 || sharedSkillsPayload !== void 0;
|
|
18978
18983
|
const manifestPath = managedSkillManifestPath(
|
|
18979
|
-
|
|
18984
|
+
join42(homedir17(), ".augmented", agent.code_name)
|
|
18980
18985
|
);
|
|
18981
18986
|
const prevIds = /* @__PURE__ */ new Set([
|
|
18982
18987
|
...agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
|
|
@@ -18996,15 +19001,15 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
18996
19001
|
}
|
|
18997
19002
|
if (plan.removes.length) {
|
|
18998
19003
|
const globalSkillDirs = [
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
|
|
19004
|
+
join42(homedir17(), ".augmented", agent.code_name, "skills"),
|
|
19005
|
+
join42(homedir17(), ".augmented", agent.code_name, "project", ".claude", "skills"),
|
|
19006
|
+
join42(agentDir, ".claude", "skills")
|
|
19002
19007
|
];
|
|
19003
19008
|
for (const id of plan.removes) {
|
|
19004
19009
|
let prunedAny = false;
|
|
19005
19010
|
for (const dir of globalSkillDirs) {
|
|
19006
|
-
const p =
|
|
19007
|
-
if (existsSync19(p) && existsSync19(
|
|
19011
|
+
const p = join42(dir, id);
|
|
19012
|
+
if (existsSync19(p) && existsSync19(join42(p, "SKILL.md"))) {
|
|
19008
19013
|
rmSync8(p, { recursive: true, force: true });
|
|
19009
19014
|
prunedAny = true;
|
|
19010
19015
|
}
|
|
@@ -19260,7 +19265,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
19260
19265
|
const sess = getSessionState(agent.code_name);
|
|
19261
19266
|
let mcpJsonParsed = null;
|
|
19262
19267
|
try {
|
|
19263
|
-
const mcpPath =
|
|
19268
|
+
const mcpPath = join42(getProjectDir(agent.code_name), ".mcp.json");
|
|
19264
19269
|
mcpJsonParsed = JSON.parse(readFileSync34(mcpPath, "utf-8"));
|
|
19265
19270
|
} catch {
|
|
19266
19271
|
}
|
|
@@ -19753,7 +19758,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
|
|
|
19753
19758
|
if (trackedFiles.length > 0 && existsSync19(agentDir)) {
|
|
19754
19759
|
const hashes = /* @__PURE__ */ new Map();
|
|
19755
19760
|
for (const file of trackedFiles) {
|
|
19756
|
-
const h = hashFile(
|
|
19761
|
+
const h = hashFile(join42(agentDir, file));
|
|
19757
19762
|
if (h) hashes.set(file, h);
|
|
19758
19763
|
}
|
|
19759
19764
|
agentState.writtenHashes.set(agent.agent_id, hashes);
|
|
@@ -19768,7 +19773,7 @@ Retried to the limit after repeated stalls \u2014 needs a look.`).catch(() => {
|
|
|
19768
19773
|
refreshData.agent.onboarding_state
|
|
19769
19774
|
);
|
|
19770
19775
|
const obStep = obState.step;
|
|
19771
|
-
const markerPath =
|
|
19776
|
+
const markerPath = join42(homedir17(), ".augmented", agent.code_name, "onboarding-drive.json");
|
|
19772
19777
|
const marker = readOnboardingDriveMarker(markerPath);
|
|
19773
19778
|
const obContactRaw = refreshData.agent.manager_last_contacted_at;
|
|
19774
19779
|
const obContact = typeof obContactRaw === "string" && obContactRaw ? obContactRaw : null;
|
|
@@ -19883,7 +19888,7 @@ async function ensureOpencodeRuntime(agent, refreshData, agentTimezone) {
|
|
|
19883
19888
|
}
|
|
19884
19889
|
stopOpencodeSlackIngest(codeName, log);
|
|
19885
19890
|
stopOpencodeTelegramIngest(codeName, log);
|
|
19886
|
-
const opencodeProjectDir =
|
|
19891
|
+
const opencodeProjectDir = join42(getFramework("opencode").getAgentDir(codeName), "provision");
|
|
19887
19892
|
const serveEnv = {
|
|
19888
19893
|
AGT_HOST: requireHost(),
|
|
19889
19894
|
AGT_API_KEY: getApiKey() ?? void 0,
|
|
@@ -19943,8 +19948,8 @@ async function ensurePersistentSessionUnchecked(agent, tasks, boardItems, refres
|
|
|
19943
19948
|
});
|
|
19944
19949
|
}
|
|
19945
19950
|
const projectDir = getProjectDir(codeName);
|
|
19946
|
-
const mcpConfigPath =
|
|
19947
|
-
const claudeMdPath =
|
|
19951
|
+
const mcpConfigPath = join42(projectDir, ".mcp.json");
|
|
19952
|
+
const claudeMdPath = join42(projectDir, "CLAUDE.md");
|
|
19948
19953
|
if (restartBreaker.isTripped(codeName)) {
|
|
19949
19954
|
const trip = restartBreaker.getTrip(codeName);
|
|
19950
19955
|
return {
|
|
@@ -20808,7 +20813,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
20808
20813
|
try {
|
|
20809
20814
|
const freshId = rotateSessionForWedge(codeName);
|
|
20810
20815
|
consecutiveWedgeCycles.delete(codeName);
|
|
20811
|
-
const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-
|
|
20816
|
+
const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-UE5I7ZXI.js");
|
|
20812
20817
|
const { parked, deadLettered } = parkForRestart(codeName, /* @__PURE__ */ new Date());
|
|
20813
20818
|
const parkNote = parked > 0 ? `, ${parked} inbound parked` : "";
|
|
20814
20819
|
const deadNote = deadLettered > 0 ? `, ${deadLettered} undeliverable dead-lettered` : "";
|
|
@@ -20851,7 +20856,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
20851
20856
|
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}`));
|
|
20852
20857
|
void (async () => {
|
|
20853
20858
|
try {
|
|
20854
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
20859
|
+
const { collectDiagnostics } = await import("../persistent-session-MMXQ3V3H.js");
|
|
20855
20860
|
await api.post("/host/heartbeat", {
|
|
20856
20861
|
host_id: hostId,
|
|
20857
20862
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
|
|
@@ -20902,7 +20907,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
20902
20907
|
}
|
|
20903
20908
|
try {
|
|
20904
20909
|
const hostId = await getHostId();
|
|
20905
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
20910
|
+
const { collectDiagnostics } = await import("../persistent-session-MMXQ3V3H.js");
|
|
20906
20911
|
await api.post("/host/heartbeat", {
|
|
20907
20912
|
host_id: hostId,
|
|
20908
20913
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
|
|
@@ -21326,7 +21331,7 @@ async function processDirectChatMessage(agent, msg) {
|
|
|
21326
21331
|
const useDoorbell = hostFlagStore().getBoolean("direct-chat-doorbell") || isolationMode(agent.codeName) === "docker";
|
|
21327
21332
|
if (useDoorbell) {
|
|
21328
21333
|
try {
|
|
21329
|
-
const doorbell = directChatDoorbellPath(agent.agentId,
|
|
21334
|
+
const doorbell = directChatDoorbellPath(agent.agentId, homedir17());
|
|
21330
21335
|
mkdirSync15(dirname11(doorbell), { recursive: true });
|
|
21331
21336
|
writeFileSync18(doorbell, String(Date.now()));
|
|
21332
21337
|
log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
|
|
@@ -21455,7 +21460,7 @@ ${formatRunMarker(run_id)}` : KANBAN_CHECK_COMMAND;
|
|
|
21455
21460
|
}
|
|
21456
21461
|
if (run_id) openInjectedRunByCode.set(codeName, run_id);
|
|
21457
21462
|
try {
|
|
21458
|
-
const doorbell = directChatDoorbellPath(agentId,
|
|
21463
|
+
const doorbell = directChatDoorbellPath(agentId, homedir17());
|
|
21459
21464
|
mkdirSync15(dirname11(doorbell), { recursive: true });
|
|
21460
21465
|
writeFileSync18(doorbell, String(Date.now()));
|
|
21461
21466
|
} catch (err) {
|
|
@@ -21573,7 +21578,7 @@ async function processClaudePairSessions(agents) {
|
|
|
21573
21578
|
// cannot take it for itself — by the time it runs, the write it is looking
|
|
21574
21579
|
// for may already have happened.
|
|
21575
21580
|
snapshotPairConfig
|
|
21576
|
-
} = await import("../claude-pair-runtime-
|
|
21581
|
+
} = await import("../claude-pair-runtime-5JVOLSQY.js");
|
|
21577
21582
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
21578
21583
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
21579
21584
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -21840,10 +21845,10 @@ var lastLocalFileHash = /* @__PURE__ */ new Map();
|
|
|
21840
21845
|
var lastMemoriesBody = /* @__PURE__ */ new Map();
|
|
21841
21846
|
var memoryManifests = /* @__PURE__ */ new Map();
|
|
21842
21847
|
function memoryRetirementDir(configDir, codeName) {
|
|
21843
|
-
return
|
|
21848
|
+
return join42(configDir, "_memory-retirement", codeName);
|
|
21844
21849
|
}
|
|
21845
21850
|
function memoryManifestPath(configDir, codeName) {
|
|
21846
|
-
return
|
|
21851
|
+
return join42(memoryRetirementDir(configDir, codeName), "manifest.json");
|
|
21847
21852
|
}
|
|
21848
21853
|
function loadMemoryManifest(agentId, configDir, codeName) {
|
|
21849
21854
|
const cached = memoryManifests.get(agentId);
|
|
@@ -21878,7 +21883,7 @@ function saveMemoryManifest(agentId, configDir, codeName) {
|
|
|
21878
21883
|
}
|
|
21879
21884
|
}
|
|
21880
21885
|
function retiredMemoryDir(configDir, codeName) {
|
|
21881
|
-
return
|
|
21886
|
+
return join42(memoryRetirementDir(configDir, codeName), "retired");
|
|
21882
21887
|
}
|
|
21883
21888
|
var RETIRED_MEMORY_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
21884
21889
|
var lastRetirementReport = /* @__PURE__ */ new Map();
|
|
@@ -21957,7 +21962,7 @@ function applyMemoryTombstones(opts) {
|
|
|
21957
21962
|
log2(`[memory-retire] ${agent.code_name}: KEPT '${tomb.name}' \u2014 no write record, not ours to remove`);
|
|
21958
21963
|
continue;
|
|
21959
21964
|
}
|
|
21960
|
-
const filePath =
|
|
21965
|
+
const filePath = join42(memoryDir, entry.file);
|
|
21961
21966
|
if (!existsSync19(filePath)) {
|
|
21962
21967
|
outcomes.already_gone++;
|
|
21963
21968
|
delete manifest[tomb.name];
|
|
@@ -21977,9 +21982,9 @@ function applyMemoryTombstones(opts) {
|
|
|
21977
21982
|
const destDir = retiredMemoryDir(configDir, agent.code_name);
|
|
21978
21983
|
mkdirSync15(destDir, { recursive: true });
|
|
21979
21984
|
const stamp = Date.now();
|
|
21980
|
-
let dest =
|
|
21985
|
+
let dest = join42(destDir, `${entry.file}.${stamp}.retired`);
|
|
21981
21986
|
for (let n = 1; existsSync19(dest); n++) {
|
|
21982
|
-
dest =
|
|
21987
|
+
dest = join42(destDir, `${entry.file}.${stamp}-${n}.retired`);
|
|
21983
21988
|
}
|
|
21984
21989
|
renameSync11(filePath, dest);
|
|
21985
21990
|
try {
|
|
@@ -22018,7 +22023,7 @@ function reapRetiredMemories(configDir, codeName, log2) {
|
|
|
22018
22023
|
try {
|
|
22019
22024
|
for (const file of readdirSync12(dir)) {
|
|
22020
22025
|
if (!file.endsWith(".retired")) continue;
|
|
22021
|
-
const path =
|
|
22026
|
+
const path = join42(dir, file);
|
|
22022
22027
|
try {
|
|
22023
22028
|
if (statSync13(path).mtimeMs < cutoff) {
|
|
22024
22029
|
unlinkSync6(path);
|
|
@@ -22033,8 +22038,8 @@ function reapRetiredMemories(configDir, codeName, log2) {
|
|
|
22033
22038
|
if (reaped > 0) log2(`[memory-retire] ${codeName}: reaped ${reaped} retired memory file(s) past TTL`);
|
|
22034
22039
|
}
|
|
22035
22040
|
async function syncMemories(agent, configDir, log2) {
|
|
22036
|
-
const projectDir =
|
|
22037
|
-
const memoryDir =
|
|
22041
|
+
const projectDir = join42(configDir, agent.code_name, "project");
|
|
22042
|
+
const memoryDir = join42(projectDir, "memory");
|
|
22038
22043
|
const isFreshSync = pendingFreshMemorySync.has(agent.agent_id);
|
|
22039
22044
|
if (isFreshSync) {
|
|
22040
22045
|
log2(`[memory-sync] Fresh-sync requested for '${agent.code_name}' \u2014 pulling DB first`);
|
|
@@ -22065,7 +22070,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
22065
22070
|
for (const file of readdirSync12(memoryDir)) {
|
|
22066
22071
|
if (!file.endsWith(".md")) continue;
|
|
22067
22072
|
try {
|
|
22068
|
-
const raw = readFileSync34(
|
|
22073
|
+
const raw = readFileSync34(join42(memoryDir, file), "utf-8");
|
|
22069
22074
|
const fileHash = createHash20("sha256").update(raw).digest("hex").slice(0, 16);
|
|
22070
22075
|
currentHashes.set(file, fileHash);
|
|
22071
22076
|
if (prevHashes.get(file) === fileHash) continue;
|
|
@@ -22090,7 +22095,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
22090
22095
|
} catch (err) {
|
|
22091
22096
|
for (const mem of changedMemories) {
|
|
22092
22097
|
for (const [file] of currentHashes) {
|
|
22093
|
-
const parsed = parseMemoryFile(readFileSync34(
|
|
22098
|
+
const parsed = parseMemoryFile(readFileSync34(join42(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
|
|
22094
22099
|
if (parsed?.name === mem.name) currentHashes.delete(file);
|
|
22095
22100
|
}
|
|
22096
22101
|
}
|
|
@@ -22171,7 +22176,7 @@ async function downloadMemories(agent, memoryDir, log2, { force, configDir }) {
|
|
|
22171
22176
|
// Per-agent, not host-wide: memories are agent-private, so a shared
|
|
22172
22177
|
// store would buy almost no dedupe while exposing one agent's content
|
|
22173
22178
|
// to every other agent on the host. See memory-cache.ts's header.
|
|
22174
|
-
cacheDir:
|
|
22179
|
+
cacheDir: join42(configDir, agent.code_name, "_memory_bodies"),
|
|
22175
22180
|
fetchContents: async (hashes) => {
|
|
22176
22181
|
const res = await api.post(
|
|
22177
22182
|
"/host/memories/contents",
|
|
@@ -22209,7 +22214,7 @@ async function downloadMemories(agent, memoryDir, log2, { force, configDir }) {
|
|
|
22209
22214
|
const rawSlug = mem.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "").slice(0, 60);
|
|
22210
22215
|
const slug = rawSlug || `memory-${i}`;
|
|
22211
22216
|
const fileName = `${slug}.md`;
|
|
22212
|
-
const filePath =
|
|
22217
|
+
const filePath = join42(memoryDir, fileName);
|
|
22213
22218
|
const desired = `---
|
|
22214
22219
|
name: ${JSON.stringify(mem.name)}
|
|
22215
22220
|
type: ${mem.type}
|
|
@@ -22394,6 +22399,16 @@ function startPolling() {
|
|
|
22394
22399
|
livenessTimer.unref();
|
|
22395
22400
|
startPaneOccupancySampler(() => agentState.persistentSessionAgents);
|
|
22396
22401
|
startPidPressureSampler(() => agentState.persistentSessionAgents);
|
|
22402
|
+
{
|
|
22403
|
+
const seedOutcome = seedClaudeConfigFromLegacy({ log });
|
|
22404
|
+
const configDirUsable = claudeConfigDirIsReady();
|
|
22405
|
+
if (configDirUsable && !process.env[CLAUDE_CONFIG_DIR_ENV]?.trim()) {
|
|
22406
|
+
process.env[CLAUDE_CONFIG_DIR_ENV] = claudeConfigDirFor();
|
|
22407
|
+
}
|
|
22408
|
+
log(
|
|
22409
|
+
`[claude-config] ${CLAUDE_CONFIG_DIR_ENV}=${process.env[CLAUDE_CONFIG_DIR_ENV] ?? "<not adopted>"} configDirUsable=${configDirUsable} seed=${seedOutcome}`
|
|
22410
|
+
);
|
|
22411
|
+
}
|
|
22397
22412
|
void startCaffeinate();
|
|
22398
22413
|
loadChannelHashCache2();
|
|
22399
22414
|
loadSenderPolicyBaseline2();
|
|
@@ -22636,7 +22651,7 @@ function startManager(opts) {
|
|
|
22636
22651
|
log(`[startup] state rehydration failed (continuing with empty state): ${err.message}`);
|
|
22637
22652
|
}
|
|
22638
22653
|
log(
|
|
22639
|
-
`[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${
|
|
22654
|
+
`[startup] worker pid=${process.pid} ppid=${process.ppid} node=${process.version} log=${join42(homedir17(), ".augmented", "manager.log")}`
|
|
22640
22655
|
);
|
|
22641
22656
|
deployMcpAssets();
|
|
22642
22657
|
reapOrphanChannelMcps({ log });
|
|
@@ -22762,14 +22777,14 @@ function restartRunningChannelMcps(basenames) {
|
|
|
22762
22777
|
}
|
|
22763
22778
|
}
|
|
22764
22779
|
function deployMcpAssets() {
|
|
22765
|
-
const targetDir =
|
|
22780
|
+
const targetDir = join42(homedir17(), ".augmented", "_mcp");
|
|
22766
22781
|
mkdirSync15(targetDir, { recursive: true });
|
|
22767
22782
|
const moduleDir = dirname11(fileURLToPath2(import.meta.url));
|
|
22768
22783
|
let mcpSourceDir = "";
|
|
22769
22784
|
let dir = moduleDir;
|
|
22770
22785
|
for (let i = 0; i < 6; i++) {
|
|
22771
|
-
const candidate =
|
|
22772
|
-
if (existsSync19(
|
|
22786
|
+
const candidate = join42(dir, "dist", "mcp");
|
|
22787
|
+
if (existsSync19(join42(candidate, "index.js"))) {
|
|
22773
22788
|
mcpSourceDir = candidate;
|
|
22774
22789
|
break;
|
|
22775
22790
|
}
|
|
@@ -22869,8 +22884,8 @@ function deployMcpAssets() {
|
|
|
22869
22884
|
// natural session restart.
|
|
22870
22885
|
"computer-use-proxy.js"
|
|
22871
22886
|
]) {
|
|
22872
|
-
const src =
|
|
22873
|
-
const dst =
|
|
22887
|
+
const src = join42(mcpSourceDir, file);
|
|
22888
|
+
const dst = join42(targetDir, file);
|
|
22874
22889
|
if (!existsSync19(src)) continue;
|
|
22875
22890
|
attemptedFiles.push(file);
|
|
22876
22891
|
const before = fileHash(dst);
|
|
@@ -22896,14 +22911,14 @@ function deployMcpAssets() {
|
|
|
22896
22911
|
log(`[manager] Bundle(s) updated: ${changedBasenames.join(", ")} \u2014 signalling running instances to restart`);
|
|
22897
22912
|
restartRunningChannelMcps(changedBasenames);
|
|
22898
22913
|
}
|
|
22899
|
-
const localMcpPath =
|
|
22914
|
+
const localMcpPath = join42(targetDir, "index.js");
|
|
22900
22915
|
try {
|
|
22901
|
-
const agentsDir =
|
|
22916
|
+
const agentsDir = join42(homedir17(), ".augmented", "agents");
|
|
22902
22917
|
if (existsSync19(agentsDir)) {
|
|
22903
22918
|
for (const entry of readdirSync12(agentsDir, { withFileTypes: true })) {
|
|
22904
22919
|
if (!entry.isDirectory()) continue;
|
|
22905
22920
|
for (const subdir of ["provision", "project"]) {
|
|
22906
|
-
const mcpJsonPath =
|
|
22921
|
+
const mcpJsonPath = join42(agentsDir, entry.name, subdir, ".mcp.json");
|
|
22907
22922
|
try {
|
|
22908
22923
|
const raw = readFileSync34(mcpJsonPath, "utf-8");
|
|
22909
22924
|
if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
|