@integrity-labs/agt-cli 0.28.1183 → 0.28.1184
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 -6
- package/dist/{chunk-D4SFIYLR.js → chunk-2DWMFJEV.js} +3 -3
- package/dist/{chunk-44ZVQZCD.js → chunk-5L2UZW22.js} +2 -2
- package/dist/{chunk-VWQ4Y6AV.js → chunk-B57YZ2QD.js} +7 -3
- package/dist/{chunk-VWQ4Y6AV.js.map → chunk-B57YZ2QD.js.map} +1 -1
- package/dist/{chunk-3QZQ2QUY.js → chunk-CIZ2UI77.js} +5 -5
- package/dist/{chunk-6N4BQN7E.js → chunk-TGHAQABK.js} +7 -2
- package/dist/{chunk-6N4BQN7E.js.map → chunk-TGHAQABK.js.map} +1 -1
- package/dist/{claude-code-updater-RZZNG4MI.js → claude-code-updater-JYVD3MJJ.js} +3 -3
- package/dist/{claude-pair-runtime-N4XK2FPH.js → claude-pair-runtime-IJAQHR2V.js} +3 -3
- package/dist/lib/manager-worker.js +173 -99
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +2 -1
- package/dist/mcp/index.js +2 -1
- package/dist/mcp/origami.js +2 -1
- package/dist/mcp/slack-channel.js +2 -1
- package/dist/mcp/telegram-channel.js +2 -1
- package/dist/{persistent-session-3FNAHCU3.js → persistent-session-C7632TPG.js} +4 -4
- package/dist/{responsiveness-probe-4Y4OUCB4.js → responsiveness-probe-NFT3GSDL.js} +4 -4
- package/dist/{session-auth-dead-BOVLUG7N.js → session-auth-dead-BTGGL4MA.js} +3 -3
- package/package.json +1 -1
- /package/dist/{chunk-D4SFIYLR.js.map → chunk-2DWMFJEV.js.map} +0 -0
- /package/dist/{chunk-44ZVQZCD.js.map → chunk-5L2UZW22.js.map} +0 -0
- /package/dist/{chunk-3QZQ2QUY.js.map → chunk-CIZ2UI77.js.map} +0 -0
- /package/dist/{claude-code-updater-RZZNG4MI.js.map → claude-code-updater-JYVD3MJJ.js.map} +0 -0
- /package/dist/{claude-pair-runtime-N4XK2FPH.js.map → claude-pair-runtime-IJAQHR2V.js.map} +0 -0
- /package/dist/{persistent-session-3FNAHCU3.js.map → persistent-session-C7632TPG.js.map} +0 -0
- /package/dist/{responsiveness-probe-4Y4OUCB4.js.map → responsiveness-probe-NFT3GSDL.js.map} +0 -0
- /package/dist/{session-auth-dead-BOVLUG7N.js.map → session-auth-dead-BTGGL4MA.js.map} +0 -0
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
tripClass,
|
|
83
83
|
writeEtcEnvironment,
|
|
84
84
|
writeProfileDScript
|
|
85
|
-
} from "../chunk-
|
|
85
|
+
} from "../chunk-CIZ2UI77.js";
|
|
86
86
|
import {
|
|
87
87
|
CLAUDE_CODE_SECURITY_FLOOR,
|
|
88
88
|
SELF_UPDATE_TIMEOUTS,
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
runSafeCleanup,
|
|
97
97
|
tightestDiskStat,
|
|
98
98
|
withPackageCacheLock
|
|
99
|
-
} from "../chunk-
|
|
99
|
+
} from "../chunk-5L2UZW22.js";
|
|
100
100
|
import {
|
|
101
101
|
rewriteSupervisorApiKey,
|
|
102
102
|
supervisorChannelsRefusing
|
|
@@ -188,16 +188,17 @@ import {
|
|
|
188
188
|
webFetchBaselineValue,
|
|
189
189
|
webFetchRestartNeeded,
|
|
190
190
|
writeEgressAllowlist
|
|
191
|
-
} from "../chunk-
|
|
191
|
+
} from "../chunk-2DWMFJEV.js";
|
|
192
192
|
import {
|
|
193
193
|
isAgentIdle,
|
|
194
194
|
isStaleForToday,
|
|
195
195
|
minutesSinceLocalMidnight,
|
|
196
196
|
peekCurrentSession,
|
|
197
|
+
peekPreviousSession,
|
|
197
198
|
sessionTranscriptDir,
|
|
198
199
|
subagentActivityAgeSeconds,
|
|
199
200
|
transcriptActivityAgeSeconds
|
|
200
|
-
} from "../chunk-
|
|
201
|
+
} from "../chunk-TGHAQABK.js";
|
|
201
202
|
import {
|
|
202
203
|
classifyUnanswerablePane,
|
|
203
204
|
focusedConfirmDialogBlock,
|
|
@@ -320,7 +321,7 @@ import {
|
|
|
320
321
|
stabiliseResetInstant,
|
|
321
322
|
sumTranscriptUsageInWindow,
|
|
322
323
|
summarizeTranscriptActivity
|
|
323
|
-
} from "../chunk-
|
|
324
|
+
} from "../chunk-B57YZ2QD.js";
|
|
324
325
|
import {
|
|
325
326
|
CLAUDE_CONFIG_DIR_ENV,
|
|
326
327
|
claudeConfigDirFor,
|
|
@@ -332,7 +333,7 @@ import "../chunk-DGUM43GV.js";
|
|
|
332
333
|
|
|
333
334
|
// src/lib/manager-worker.ts
|
|
334
335
|
import { createHash as createHash20 } from "crypto";
|
|
335
|
-
import { readFileSync as
|
|
336
|
+
import { readFileSync as readFileSync35, writeFileSync as writeFileSync18, mkdirSync as mkdirSync16, existsSync as existsSync19, rmSync as rmSync8, readdirSync as readdirSync14, statSync as statSync15, unlinkSync as unlinkSync6, renameSync as renameSync11, utimesSync as utimesSync4, readlinkSync as readlinkSync2 } from "fs";
|
|
336
337
|
|
|
337
338
|
// src/lib/atomic-file-replace.ts
|
|
338
339
|
import { copyFileSync, renameSync, unlinkSync } from "fs";
|
|
@@ -3021,11 +3022,11 @@ function isPathInsideDir(candidate, dir) {
|
|
|
3021
3022
|
}
|
|
3022
3023
|
function findMissingMcpBundles(mcpConfigPath, deps = {}) {
|
|
3023
3024
|
const existsSync20 = deps.existsSync ?? nodeExistsSync;
|
|
3024
|
-
const
|
|
3025
|
+
const readFileSync36 = deps.readFileSync ?? nodeReadFileSync;
|
|
3025
3026
|
const mcpDir = deps.mcpDir ?? getSharedMcpDir();
|
|
3026
3027
|
let parsed;
|
|
3027
3028
|
try {
|
|
3028
|
-
parsed = JSON.parse(
|
|
3029
|
+
parsed = JSON.parse(readFileSync36(mcpConfigPath, "utf-8"));
|
|
3029
3030
|
} catch {
|
|
3030
3031
|
return [];
|
|
3031
3032
|
}
|
|
@@ -4826,7 +4827,7 @@ function failingTurnLoops(now = Date.now(), threshold = failingTurnThreshold(),
|
|
|
4826
4827
|
}
|
|
4827
4828
|
|
|
4828
4829
|
// src/lib/session-activity.ts
|
|
4829
|
-
import { readdirSync as readdirSync3, statSync as statSync3 } from "fs";
|
|
4830
|
+
import { readFileSync as readFileSync12, readdirSync as readdirSync3, statSync as statSync3 } from "fs";
|
|
4830
4831
|
import { join as join18 } from "path";
|
|
4831
4832
|
var RULE = /^[─━]{10,}/;
|
|
4832
4833
|
var CARET_LINE = /^\s*❯(\s|$)/;
|
|
@@ -4858,6 +4859,25 @@ function classifyPane(screen, tmuxAlive) {
|
|
|
4858
4859
|
return { state: "idle_at_prompt", promptKind: null };
|
|
4859
4860
|
}
|
|
4860
4861
|
var cache = /* @__PURE__ */ new Map();
|
|
4862
|
+
var liveSessions = /* @__PURE__ */ new Map();
|
|
4863
|
+
function noteLiveSession(codeName, liveId) {
|
|
4864
|
+
let seen = liveSessions.get(codeName);
|
|
4865
|
+
if (!seen) {
|
|
4866
|
+
seen = { current: liveId, currentHasTurn: false, previous: null };
|
|
4867
|
+
liveSessions.set(codeName, seen);
|
|
4868
|
+
} else if (seen.current !== liveId) {
|
|
4869
|
+
if (seen.currentHasTurn) seen.previous = seen.current;
|
|
4870
|
+
seen.current = liveId;
|
|
4871
|
+
seen.currentHasTurn = false;
|
|
4872
|
+
}
|
|
4873
|
+
const entry = seen;
|
|
4874
|
+
return {
|
|
4875
|
+
previous: entry.previous,
|
|
4876
|
+
record: (hasTurn) => {
|
|
4877
|
+
if (hasTurn) entry.currentHasTurn = true;
|
|
4878
|
+
}
|
|
4879
|
+
};
|
|
4880
|
+
}
|
|
4861
4881
|
function newestTranscript(dir) {
|
|
4862
4882
|
let names;
|
|
4863
4883
|
try {
|
|
@@ -4890,14 +4910,14 @@ function sessionTranscript(dir, sessionId) {
|
|
|
4890
4910
|
return null;
|
|
4891
4911
|
}
|
|
4892
4912
|
}
|
|
4893
|
-
function readTranscript(
|
|
4913
|
+
function readTranscript(cacheKey, dir, sessionId, nowMs) {
|
|
4894
4914
|
const session = sessionId ?? null;
|
|
4895
|
-
const prev = cache.get(
|
|
4915
|
+
const prev = cache.get(cacheKey)?.sessionId === session ? cache.get(cacheKey) : void 0;
|
|
4896
4916
|
if (prev && nowMs - prev.checkedAt < MIN_TRANSCRIPT_CHECK_MS) return prev;
|
|
4897
4917
|
const file = sessionTranscript(dir, sessionId);
|
|
4898
4918
|
if (!file) {
|
|
4899
4919
|
const none = { checkedAt: nowMs, sessionId: session, path: null, mtimeMs: null, size: 0, activity: NO_TRANSCRIPT_ACTIVITY };
|
|
4900
|
-
cache.set(
|
|
4920
|
+
cache.set(cacheKey, none);
|
|
4901
4921
|
return none;
|
|
4902
4922
|
}
|
|
4903
4923
|
if (prev && prev.path === file.path && prev.mtimeMs === file.mtimeMs && prev.size === file.size) {
|
|
@@ -4912,9 +4932,32 @@ function readTranscript(codeName, dir, sessionId, nowMs) {
|
|
|
4912
4932
|
size: file.size,
|
|
4913
4933
|
activity: summarizeTranscriptActivity(readTail(file.path, file.size))
|
|
4914
4934
|
};
|
|
4915
|
-
cache.set(
|
|
4935
|
+
cache.set(cacheKey, next);
|
|
4916
4936
|
return next;
|
|
4917
4937
|
}
|
|
4938
|
+
function readRecordedSession(agentDir) {
|
|
4939
|
+
try {
|
|
4940
|
+
const parsed = JSON.parse(readFileSync12(join18(agentDir, "session-state.json"), "utf-8"));
|
|
4941
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
4942
|
+
const { session_id: sessionId, recorded_at: recordedAtMs } = parsed;
|
|
4943
|
+
if (typeof sessionId !== "string" || typeof recordedAtMs !== "number" || !Number.isFinite(recordedAtMs)) return null;
|
|
4944
|
+
return { sessionId, recordedAtMs };
|
|
4945
|
+
} catch {
|
|
4946
|
+
return null;
|
|
4947
|
+
}
|
|
4948
|
+
}
|
|
4949
|
+
function resolveLiveSessionId(args) {
|
|
4950
|
+
const spawn = args.spawnSessionId ?? null;
|
|
4951
|
+
const { recorded, spawnedAtMs } = args;
|
|
4952
|
+
if (!spawn || !recorded || typeof spawnedAtMs !== "number") return spawn;
|
|
4953
|
+
if (!SESSION_ID.test(recorded.sessionId) || recorded.sessionId === spawn) return spawn;
|
|
4954
|
+
return recorded.recordedAtMs >= spawnedAtMs ? recorded.sessionId : spawn;
|
|
4955
|
+
}
|
|
4956
|
+
var SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4957
|
+
var PREVIOUS_SESSION_WINDOW_MS = 10 * 60 * 1e3;
|
|
4958
|
+
function hasTurnActivity(activity) {
|
|
4959
|
+
return activity.hasTurn;
|
|
4960
|
+
}
|
|
4918
4961
|
function iso(ms) {
|
|
4919
4962
|
return ms === null ? null : new Date(ms).toISOString();
|
|
4920
4963
|
}
|
|
@@ -4923,7 +4966,32 @@ function buildSessionActivityReport(args) {
|
|
|
4923
4966
|
try {
|
|
4924
4967
|
const pane = classifyPane(args.screenCapture, args.tmuxAlive);
|
|
4925
4968
|
if (!pane) return null;
|
|
4926
|
-
const
|
|
4969
|
+
const spawnId = args.sessionId ?? null;
|
|
4970
|
+
const liveId = resolveLiveSessionId({
|
|
4971
|
+
spawnSessionId: spawnId,
|
|
4972
|
+
spawnedAtMs: args.spawnedAtMs,
|
|
4973
|
+
recorded: args.recordedSession
|
|
4974
|
+
});
|
|
4975
|
+
let transcript = readTranscript(args.codeName, args.transcriptDir, liveId, nowMs);
|
|
4976
|
+
const seen = noteLiveSession(args.codeName, liveId);
|
|
4977
|
+
seen.record(transcript.activity.hasTurn);
|
|
4978
|
+
const switchedAtMs = liveId !== spawnId ? args.recordedSession?.recordedAtMs ?? null : args.spawnedAtMs ?? null;
|
|
4979
|
+
const seenPrevious = seen.previous !== null && SESSION_ID.test(seen.previous) ? seen.previous : null;
|
|
4980
|
+
const managerPrevious = liveId !== spawnId ? spawnId : args.previousSessionId ?? null;
|
|
4981
|
+
const candidates = [.../* @__PURE__ */ new Set([seenPrevious, managerPrevious])].filter(
|
|
4982
|
+
(id) => id !== null && SESSION_ID.test(id) && id !== liveId
|
|
4983
|
+
);
|
|
4984
|
+
if (candidates.length > 0 && switchedAtMs !== null && !hasTurnActivity(transcript.activity)) {
|
|
4985
|
+
let previous = null;
|
|
4986
|
+
for (const [i, id] of candidates.entries()) {
|
|
4987
|
+
const read = readTranscript(`${args.codeName}\0previous${i}`, args.transcriptDir, id, nowMs);
|
|
4988
|
+
if (!read.activity.hasTurn || read.mtimeMs === null) continue;
|
|
4989
|
+
if (previous === null || (previous.mtimeMs ?? 0) < read.mtimeMs) previous = read;
|
|
4990
|
+
}
|
|
4991
|
+
if (previous !== null && previous.activity.newestTurnOpen && previous.mtimeMs !== null && previous.mtimeMs >= switchedAtMs - PREVIOUS_SESSION_WINDOW_MS) {
|
|
4992
|
+
transcript = previous;
|
|
4993
|
+
}
|
|
4994
|
+
}
|
|
4927
4995
|
const state10 = resolveSessionActivityState({
|
|
4928
4996
|
pane,
|
|
4929
4997
|
transcript: transcript.activity,
|
|
@@ -4947,7 +5015,7 @@ function buildSessionActivityReport(args) {
|
|
|
4947
5015
|
}
|
|
4948
5016
|
|
|
4949
5017
|
// src/lib/workflow-run-reconciler.ts
|
|
4950
|
-
import { readdirSync as readdirSync4, readFileSync as
|
|
5018
|
+
import { readdirSync as readdirSync4, readFileSync as readFileSync13, statSync as statSync4 } from "fs";
|
|
4951
5019
|
import { join as join19 } from "path";
|
|
4952
5020
|
var MIN_CHECK_INTERVAL_MS4 = 5 * 6e4;
|
|
4953
5021
|
var SETTLE_MS = 3e4;
|
|
@@ -5066,7 +5134,7 @@ async function maybeReconcileWorkflowRunTokens(args) {
|
|
|
5066
5134
|
const contents = [];
|
|
5067
5135
|
for (const path of files) {
|
|
5068
5136
|
try {
|
|
5069
|
-
contents.push(
|
|
5137
|
+
contents.push(readFileSync13(path, "utf-8"));
|
|
5070
5138
|
} catch {
|
|
5071
5139
|
}
|
|
5072
5140
|
}
|
|
@@ -5111,7 +5179,7 @@ async function maybeReconcileWorkflowRunTokens(args) {
|
|
|
5111
5179
|
}
|
|
5112
5180
|
|
|
5113
5181
|
// src/lib/conversation-evaluator.ts
|
|
5114
|
-
import { readdirSync as readdirSync5, readFileSync as
|
|
5182
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync14, statSync as statSync5 } from "fs";
|
|
5115
5183
|
import { join as join20 } from "path";
|
|
5116
5184
|
|
|
5117
5185
|
// src/lib/detect-meta-egress.ts
|
|
@@ -5612,7 +5680,7 @@ function readRecentTurns(dir, nowMs) {
|
|
|
5612
5680
|
if (nowMs - mtimeMs > TRANSCRIPT_MTIME_WINDOW_MS3) continue;
|
|
5613
5681
|
let content;
|
|
5614
5682
|
try {
|
|
5615
|
-
content =
|
|
5683
|
+
content = readFileSync14(full, "utf8");
|
|
5616
5684
|
} catch {
|
|
5617
5685
|
continue;
|
|
5618
5686
|
}
|
|
@@ -5988,7 +6056,7 @@ import { homedir as homedir11 } from "os";
|
|
|
5988
6056
|
import { join as join25 } from "path";
|
|
5989
6057
|
|
|
5990
6058
|
// src/lib/agent-logging-mode.ts
|
|
5991
|
-
import { readFileSync as
|
|
6059
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
5992
6060
|
import { homedir as homedir8 } from "os";
|
|
5993
6061
|
import { join as join21 } from "path";
|
|
5994
6062
|
var LOGGING_MODES = ["hash-only", "redacted", "full-local"];
|
|
@@ -6000,7 +6068,7 @@ function charterPath(codeName, homeDir) {
|
|
|
6000
6068
|
function readAgentLoggingMode(codeName, homeDir) {
|
|
6001
6069
|
let raw;
|
|
6002
6070
|
try {
|
|
6003
|
-
raw =
|
|
6071
|
+
raw = readFileSync15(charterPath(codeName, homeDir), "utf-8");
|
|
6004
6072
|
} catch {
|
|
6005
6073
|
return { mode: null, reason: "no-charter" };
|
|
6006
6074
|
}
|
|
@@ -6024,7 +6092,7 @@ function loggingModeWithholdsTargets(reading) {
|
|
|
6024
6092
|
|
|
6025
6093
|
// src/lib/tool-call-path-salt.ts
|
|
6026
6094
|
import { randomBytes } from "crypto";
|
|
6027
|
-
import { existsSync as existsSync4, mkdirSync as mkdirSync6, readFileSync as
|
|
6095
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync6, readFileSync as readFileSync16, renameSync as renameSync4, unlinkSync as unlinkSync2, writeFileSync as writeFileSync7 } from "fs";
|
|
6028
6096
|
import { homedir as homedir9 } from "os";
|
|
6029
6097
|
import { dirname as dirname7, join as join22 } from "path";
|
|
6030
6098
|
var SALT_BYTES = 32;
|
|
@@ -6043,7 +6111,7 @@ function readToolCallPathSalt(codeName, homeDir) {
|
|
|
6043
6111
|
}
|
|
6044
6112
|
try {
|
|
6045
6113
|
if (existsSync4(file)) {
|
|
6046
|
-
const existing =
|
|
6114
|
+
const existing = readFileSync16(file, "utf-8").trim();
|
|
6047
6115
|
if (SALT_RE.test(existing)) return existing;
|
|
6048
6116
|
}
|
|
6049
6117
|
} catch {
|
|
@@ -6069,7 +6137,7 @@ function readToolCallPathSalt(codeName, homeDir) {
|
|
|
6069
6137
|
import { statSync as statSync6 } from "fs";
|
|
6070
6138
|
|
|
6071
6139
|
// src/lib/tool-call-extractor.ts
|
|
6072
|
-
import { closeSync as closeSync2, fstatSync, openSync as openSync2, readFileSync as
|
|
6140
|
+
import { closeSync as closeSync2, fstatSync, openSync as openSync2, readFileSync as readFileSync17, readSync as readSync2, readdirSync as readdirSync6 } from "fs";
|
|
6073
6141
|
import { basename as basename2, join as join23, relative } from "path";
|
|
6074
6142
|
import { StringDecoder } from "string_decoder";
|
|
6075
6143
|
|
|
@@ -6414,7 +6482,7 @@ function extractTranscriptWindow(file, opts, from) {
|
|
|
6414
6482
|
}
|
|
6415
6483
|
|
|
6416
6484
|
// src/lib/tool-call-cursor.ts
|
|
6417
|
-
import { existsSync as existsSync5, readFileSync as
|
|
6485
|
+
import { existsSync as existsSync5, readFileSync as readFileSync18 } from "fs";
|
|
6418
6486
|
import { homedir as homedir10 } from "os";
|
|
6419
6487
|
import { join as join24 } from "path";
|
|
6420
6488
|
var COVERAGE_DISPOSITIONS = [
|
|
@@ -6477,7 +6545,7 @@ function loadCursors(path) {
|
|
|
6477
6545
|
const out = /* @__PURE__ */ new Map();
|
|
6478
6546
|
if (!existsSync5(path)) return out;
|
|
6479
6547
|
try {
|
|
6480
|
-
const parsed = JSON.parse(
|
|
6548
|
+
const parsed = JSON.parse(readFileSync18(path, "utf-8"));
|
|
6481
6549
|
if (!parsed || parsed.version !== 1 || typeof parsed.files !== "object") return out;
|
|
6482
6550
|
for (const [k, v] of Object.entries(parsed.files)) {
|
|
6483
6551
|
if (!v || typeof v !== "object") continue;
|
|
@@ -6913,7 +6981,7 @@ async function maybeScanToolCalls(args) {
|
|
|
6913
6981
|
}
|
|
6914
6982
|
|
|
6915
6983
|
// src/lib/activity-cache-monitor.ts
|
|
6916
|
-
import { existsSync as existsSync6, readFileSync as
|
|
6984
|
+
import { existsSync as existsSync6, readFileSync as readFileSync19 } from "fs";
|
|
6917
6985
|
import { homedir as homedir12 } from "os";
|
|
6918
6986
|
import { join as join26 } from "path";
|
|
6919
6987
|
var MIN_CHECK_INTERVAL_MS8 = 6e4;
|
|
@@ -6965,7 +7033,7 @@ async function maybeReportActivityCache(args) {
|
|
|
6965
7033
|
}
|
|
6966
7034
|
let raw;
|
|
6967
7035
|
try {
|
|
6968
|
-
raw =
|
|
7036
|
+
raw = readFileSync19(STATS_CACHE_PATH, "utf-8");
|
|
6969
7037
|
} catch (err) {
|
|
6970
7038
|
log2(`[activity-cache] readFileSync failed: ${err.message}`);
|
|
6971
7039
|
return;
|
|
@@ -7287,7 +7355,7 @@ import { createHash as createHash9 } from "crypto";
|
|
|
7287
7355
|
import {
|
|
7288
7356
|
existsSync as existsSync7,
|
|
7289
7357
|
mkdirSync as mkdirSync7,
|
|
7290
|
-
readFileSync as
|
|
7358
|
+
readFileSync as readFileSync20,
|
|
7291
7359
|
readdirSync as readdirSync7,
|
|
7292
7360
|
renameSync as renameSync5,
|
|
7293
7361
|
rmSync as rmSync3,
|
|
@@ -7309,7 +7377,7 @@ function cachePath(cacheDir, hash) {
|
|
|
7309
7377
|
function readCachedKnowledge(cacheDir, hash) {
|
|
7310
7378
|
const path = cachePath(cacheDir, hash);
|
|
7311
7379
|
try {
|
|
7312
|
-
const content =
|
|
7380
|
+
const content = readFileSync20(path, "utf-8");
|
|
7313
7381
|
try {
|
|
7314
7382
|
const now = /* @__PURE__ */ new Date();
|
|
7315
7383
|
utimesSync(path, now, now);
|
|
@@ -7390,7 +7458,7 @@ import { createHash as createHash10 } from "crypto";
|
|
|
7390
7458
|
import {
|
|
7391
7459
|
existsSync as existsSync8,
|
|
7392
7460
|
mkdirSync as mkdirSync8,
|
|
7393
|
-
readFileSync as
|
|
7461
|
+
readFileSync as readFileSync21,
|
|
7394
7462
|
readdirSync as readdirSync8,
|
|
7395
7463
|
renameSync as renameSync6,
|
|
7396
7464
|
rmSync as rmSync4,
|
|
@@ -7412,7 +7480,7 @@ function cachePath2(cacheDir, hash) {
|
|
|
7412
7480
|
function readCachedMemory(cacheDir, hash) {
|
|
7413
7481
|
const path = cachePath2(cacheDir, hash);
|
|
7414
7482
|
try {
|
|
7415
|
-
const content =
|
|
7483
|
+
const content = readFileSync21(path, "utf-8");
|
|
7416
7484
|
try {
|
|
7417
7485
|
const now = /* @__PURE__ */ new Date();
|
|
7418
7486
|
utimesSync2(path, now, now);
|
|
@@ -7499,7 +7567,7 @@ import { createHash as createHash11 } from "crypto";
|
|
|
7499
7567
|
import {
|
|
7500
7568
|
existsSync as existsSync9,
|
|
7501
7569
|
mkdirSync as mkdirSync9,
|
|
7502
|
-
readFileSync as
|
|
7570
|
+
readFileSync as readFileSync22,
|
|
7503
7571
|
readdirSync as readdirSync9,
|
|
7504
7572
|
renameSync as renameSync7,
|
|
7505
7573
|
rmSync as rmSync5,
|
|
@@ -7521,7 +7589,7 @@ function cachePath3(cacheDir, hash) {
|
|
|
7521
7589
|
function readCachedSkill(cacheDir, hash) {
|
|
7522
7590
|
const path = cachePath3(cacheDir, hash);
|
|
7523
7591
|
try {
|
|
7524
|
-
const content =
|
|
7592
|
+
const content = readFileSync22(path, "utf-8");
|
|
7525
7593
|
try {
|
|
7526
7594
|
const now = /* @__PURE__ */ new Date();
|
|
7527
7595
|
utimesSync3(path, now, now);
|
|
@@ -7879,7 +7947,7 @@ function resolveConditionalResponse(wire, hasCachedBody) {
|
|
|
7879
7947
|
}
|
|
7880
7948
|
|
|
7881
7949
|
// src/lib/channel-hash-cache.ts
|
|
7882
|
-
import { existsSync as existsSync10, readFileSync as
|
|
7950
|
+
import { existsSync as existsSync10, readFileSync as readFileSync23, writeFileSync as writeFileSync11 } from "fs";
|
|
7883
7951
|
import { join as join30 } from "path";
|
|
7884
7952
|
var CACHE_FILENAME = "channel-hash-cache.json";
|
|
7885
7953
|
function getChannelHashCacheFile(configDir) {
|
|
@@ -7890,7 +7958,7 @@ function loadChannelHashCache(target, configDir) {
|
|
|
7890
7958
|
if (!existsSync10(path)) return;
|
|
7891
7959
|
let parsed;
|
|
7892
7960
|
try {
|
|
7893
|
-
parsed = JSON.parse(
|
|
7961
|
+
parsed = JSON.parse(readFileSync23(path, "utf-8"));
|
|
7894
7962
|
} catch {
|
|
7895
7963
|
return;
|
|
7896
7964
|
}
|
|
@@ -7910,7 +7978,7 @@ function saveChannelHashCache(source, configDir) {
|
|
|
7910
7978
|
}
|
|
7911
7979
|
|
|
7912
7980
|
// src/lib/sender-policy-baseline.ts
|
|
7913
|
-
import { existsSync as existsSync11, readFileSync as
|
|
7981
|
+
import { existsSync as existsSync11, readFileSync as readFileSync24 } from "fs";
|
|
7914
7982
|
import { join as join31 } from "path";
|
|
7915
7983
|
var BASELINE_FILENAME = "sender-policy-baseline.json";
|
|
7916
7984
|
var SENDER_POLICY_BASELINE_VERSION = 1;
|
|
@@ -7965,7 +8033,7 @@ function loadSenderPolicyBaseline(target, configDir, log2) {
|
|
|
7965
8033
|
if (!existsSync11(path)) return;
|
|
7966
8034
|
let parsed;
|
|
7967
8035
|
try {
|
|
7968
|
-
parsed = JSON.parse(
|
|
8036
|
+
parsed = JSON.parse(readFileSync24(path, "utf-8"));
|
|
7969
8037
|
} catch (err) {
|
|
7970
8038
|
log2?.(
|
|
7971
8039
|
`[sender-policy] discarding corrupt ${BASELINE_FILENAME} (${err.message}) - restrictive-policy agents will take one fail-closed restart`
|
|
@@ -8014,7 +8082,7 @@ function saveSenderPolicyBaseline(source, configDir, log2) {
|
|
|
8014
8082
|
}
|
|
8015
8083
|
|
|
8016
8084
|
// src/lib/stuck-streak-store.ts
|
|
8017
|
-
import { existsSync as existsSync12, readFileSync as
|
|
8085
|
+
import { existsSync as existsSync12, readFileSync as readFileSync25 } from "fs";
|
|
8018
8086
|
import { join as join32 } from "path";
|
|
8019
8087
|
var STORE_FILENAME = "stuck-streaks.json";
|
|
8020
8088
|
var STUCK_STREAK_STORE_VERSION = 1;
|
|
@@ -8065,7 +8133,7 @@ function loadStuckStreaks(target, configDir, log2) {
|
|
|
8065
8133
|
if (!existsSync12(path)) return;
|
|
8066
8134
|
let parsed;
|
|
8067
8135
|
try {
|
|
8068
|
-
parsed = JSON.parse(
|
|
8136
|
+
parsed = JSON.parse(readFileSync25(path, "utf-8"));
|
|
8069
8137
|
} catch (err) {
|
|
8070
8138
|
log2?.(
|
|
8071
8139
|
`[stuck-streaks] discarding corrupt ${STORE_FILENAME} (${err.message}) \u2014 stuck-streak ages restart from zero and one spurious "recovered" close may follow`
|
|
@@ -8108,7 +8176,7 @@ function pruneStuckStreaksToAgents(maps, activeAgentIds) {
|
|
|
8108
8176
|
}
|
|
8109
8177
|
|
|
8110
8178
|
// src/lib/claude-device-state.ts
|
|
8111
|
-
import { readFileSync as
|
|
8179
|
+
import { readFileSync as readFileSync26, statSync as statSync11 } from "fs";
|
|
8112
8180
|
function claudeDeviceStatePath(env = process.env) {
|
|
8113
8181
|
return effectiveClaudeJsonPath(void 0, env);
|
|
8114
8182
|
}
|
|
@@ -8133,7 +8201,7 @@ function checkClaudeDeviceState(path = claudeDeviceStatePath()) {
|
|
|
8133
8201
|
}
|
|
8134
8202
|
let raw;
|
|
8135
8203
|
try {
|
|
8136
|
-
raw =
|
|
8204
|
+
raw = readFileSync26(path, "utf-8");
|
|
8137
8205
|
} catch {
|
|
8138
8206
|
return { usable: false, reason: "unreadable" };
|
|
8139
8207
|
}
|
|
@@ -8832,7 +8900,7 @@ function removeIntegrationSkillFolder(opts) {
|
|
|
8832
8900
|
}
|
|
8833
8901
|
|
|
8834
8902
|
// src/lib/manager/managed-skill-manifest.ts
|
|
8835
|
-
import { existsSync as existsSync13, mkdirSync as mkdirSync10, readFileSync as
|
|
8903
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync10, readFileSync as readFileSync27, writeFileSync as writeFileSync12 } from "fs";
|
|
8836
8904
|
import { dirname as dirname8, join as join34 } from "path";
|
|
8837
8905
|
var MANIFEST_VERSION = 1;
|
|
8838
8906
|
function managedSkillManifestPath(agentRootDir) {
|
|
@@ -8841,7 +8909,7 @@ function managedSkillManifestPath(agentRootDir) {
|
|
|
8841
8909
|
function readManagedSkillManifest(path) {
|
|
8842
8910
|
try {
|
|
8843
8911
|
if (!existsSync13(path)) return /* @__PURE__ */ new Set();
|
|
8844
|
-
const parsed = JSON.parse(
|
|
8912
|
+
const parsed = JSON.parse(readFileSync27(path, "utf-8"));
|
|
8845
8913
|
const ids = Array.isArray(parsed?.globalSkillIds) ? parsed.globalSkillIds : [];
|
|
8846
8914
|
return new Set(ids.filter((id) => typeof id === "string" && id.length > 0));
|
|
8847
8915
|
} catch {
|
|
@@ -9366,7 +9434,7 @@ function formatBoardForPrompt(items, template) {
|
|
|
9366
9434
|
}
|
|
9367
9435
|
|
|
9368
9436
|
// src/lib/manager/kanban/nudge-state-cache.ts
|
|
9369
|
-
import { existsSync as existsSync15, readFileSync as
|
|
9437
|
+
import { existsSync as existsSync15, readFileSync as readFileSync28, writeFileSync as writeFileSync13 } from "fs";
|
|
9370
9438
|
import { join as join36 } from "path";
|
|
9371
9439
|
var CACHE_FILENAME2 = "kanban-nudge-state.json";
|
|
9372
9440
|
var KANBAN_NUDGE_STATE_VERSION = 1;
|
|
@@ -9378,7 +9446,7 @@ function loadKanbanNudgeState(target, configDir) {
|
|
|
9378
9446
|
if (!existsSync15(path)) return;
|
|
9379
9447
|
let parsed;
|
|
9380
9448
|
try {
|
|
9381
|
-
parsed = JSON.parse(
|
|
9449
|
+
parsed = JSON.parse(readFileSync28(path, "utf-8"));
|
|
9382
9450
|
} catch {
|
|
9383
9451
|
return;
|
|
9384
9452
|
}
|
|
@@ -10001,7 +10069,7 @@ function closeSessionRunForCode(codeName, outcome, reason) {
|
|
|
10001
10069
|
|
|
10002
10070
|
// src/lib/manager/scheduler/kanban-route.ts
|
|
10003
10071
|
import { createHash as createHash15 } from "crypto";
|
|
10004
|
-
import { writeFileSync as writeFileSync14, renameSync as renameSync8, mkdirSync as mkdirSync12, readFileSync as
|
|
10072
|
+
import { writeFileSync as writeFileSync14, renameSync as renameSync8, mkdirSync as mkdirSync12, readFileSync as readFileSync29, unlinkSync as unlinkSync3 } from "fs";
|
|
10005
10073
|
import { homedir as homedir14 } from "os";
|
|
10006
10074
|
import { join as join37, dirname as dirname9 } from "path";
|
|
10007
10075
|
|
|
@@ -10374,7 +10442,7 @@ function stampScheduledTurnMarker(codeName, taskId, target) {
|
|
|
10374
10442
|
function clearScheduledTurnMarkerForTask(codeName, taskId) {
|
|
10375
10443
|
const file = join37(homedir14(), ".augmented", codeName, SCHEDULED_TURN_MARKER_FILENAME);
|
|
10376
10444
|
try {
|
|
10377
|
-
const raw = JSON.parse(
|
|
10445
|
+
const raw = JSON.parse(readFileSync29(file, "utf8"));
|
|
10378
10446
|
if (typeof raw?.task_id !== "string" || raw.task_id !== taskId) return;
|
|
10379
10447
|
unlinkSync3(file);
|
|
10380
10448
|
log(`[scheduled-kanban] scheduled-turn marker cleared for '${codeName}' (task ${taskId} complete)`);
|
|
@@ -10597,7 +10665,7 @@ import { homedir as homedir15 } from "os";
|
|
|
10597
10665
|
import { join as join39 } from "path";
|
|
10598
10666
|
|
|
10599
10667
|
// src/lib/agent-serving-probe.ts
|
|
10600
|
-
import { readFileSync as
|
|
10668
|
+
import { readFileSync as readFileSync30, readdirSync as readdirSync10, statSync as statSync12 } from "fs";
|
|
10601
10669
|
import { join as join38 } from "path";
|
|
10602
10670
|
var RATE_LIMIT_WINDOW_MS = 6 * 60 * 60 * 1e3;
|
|
10603
10671
|
function probeRateLimit(args) {
|
|
@@ -10623,7 +10691,7 @@ function probeRateLimit(args) {
|
|
|
10623
10691
|
}
|
|
10624
10692
|
let content;
|
|
10625
10693
|
try {
|
|
10626
|
-
content =
|
|
10694
|
+
content = readFileSync30(path, "utf-8");
|
|
10627
10695
|
} catch {
|
|
10628
10696
|
continue;
|
|
10629
10697
|
}
|
|
@@ -11256,7 +11324,7 @@ function stopPaneOccupancySampler() {
|
|
|
11256
11324
|
}
|
|
11257
11325
|
|
|
11258
11326
|
// src/lib/pid-pressure-sampler.ts
|
|
11259
|
-
import { existsSync as existsSync16, readFileSync as
|
|
11327
|
+
import { existsSync as existsSync16, readFileSync as readFileSync31 } from "fs";
|
|
11260
11328
|
var SAMPLE_INTERVAL_MS2 = 3e4;
|
|
11261
11329
|
function warnFraction() {
|
|
11262
11330
|
const raw = Number(process.env.AGT_PID_PRESSURE_WARN_FRACTION);
|
|
@@ -11284,7 +11352,7 @@ function parseMemoryEvents(text) {
|
|
|
11284
11352
|
}
|
|
11285
11353
|
function readTextReal(path) {
|
|
11286
11354
|
try {
|
|
11287
|
-
return
|
|
11355
|
+
return readFileSync31(path, "utf-8");
|
|
11288
11356
|
} catch {
|
|
11289
11357
|
return null;
|
|
11290
11358
|
}
|
|
@@ -12666,7 +12734,7 @@ async function fireOpencodeScheduledTask(agent, task) {
|
|
|
12666
12734
|
|
|
12667
12735
|
// src/lib/opencode-telegram-ingest.ts
|
|
12668
12736
|
import { createHash as createHash19 } from "crypto";
|
|
12669
|
-
import { existsSync as existsSync17, mkdirSync as mkdirSync13, readFileSync as
|
|
12737
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync13, readFileSync as readFileSync32, renameSync as renameSync9, unlinkSync as unlinkSync4, writeFileSync as writeFileSync15 } from "fs";
|
|
12670
12738
|
import { randomUUID } from "crypto";
|
|
12671
12739
|
import { join as join41 } from "path";
|
|
12672
12740
|
|
|
@@ -13330,7 +13398,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
|
|
|
13330
13398
|
load() {
|
|
13331
13399
|
if (!filePath) return 0;
|
|
13332
13400
|
try {
|
|
13333
|
-
const parsed = JSON.parse(
|
|
13401
|
+
const parsed = JSON.parse(readFileSync32(filePath, "utf-8"));
|
|
13334
13402
|
if (currentBotId != null && typeof parsed?.bot_id === "number" && parsed.bot_id !== currentBotId) {
|
|
13335
13403
|
log2(`[telegram-ingest:${codeName}] offset cursor belongs to a different bot; ignoring (bot swap)`);
|
|
13336
13404
|
return 0;
|
|
@@ -13605,7 +13673,7 @@ function partitionActionableByPoison(actionable, states, config2) {
|
|
|
13605
13673
|
}
|
|
13606
13674
|
|
|
13607
13675
|
// src/lib/restart-flags.ts
|
|
13608
|
-
import { existsSync as existsSync18, mkdirSync as mkdirSync14, readdirSync as readdirSync12, readFileSync as
|
|
13676
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync14, readdirSync as readdirSync12, readFileSync as readFileSync33, renameSync as renameSync10, rmSync as rmSync7, writeFileSync as writeFileSync16 } from "fs";
|
|
13609
13677
|
import { homedir as homedir16 } from "os";
|
|
13610
13678
|
import { join as join42 } from "path";
|
|
13611
13679
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -13622,7 +13690,7 @@ function readRestartFlags() {
|
|
|
13622
13690
|
for (const entry of readdirSync12(dir)) {
|
|
13623
13691
|
if (!entry.endsWith(".flag")) continue;
|
|
13624
13692
|
try {
|
|
13625
|
-
const raw =
|
|
13693
|
+
const raw = readFileSync33(join42(dir, entry), "utf8");
|
|
13626
13694
|
const parsed = JSON.parse(raw);
|
|
13627
13695
|
if (typeof parsed.codeName !== "string" || parsed.codeName.length === 0) {
|
|
13628
13696
|
parsed.codeName = entry.replace(/\.flag$/, "");
|
|
@@ -13740,7 +13808,7 @@ async function sendError(flag, opts, text) {
|
|
|
13740
13808
|
}
|
|
13741
13809
|
|
|
13742
13810
|
// src/lib/restart-context.ts
|
|
13743
|
-
import { readdirSync as readdirSync13, readFileSync as
|
|
13811
|
+
import { readdirSync as readdirSync13, readFileSync as readFileSync34, writeFileSync as writeFileSync17, mkdirSync as mkdirSync15, unlinkSync as unlinkSync5 } from "fs";
|
|
13744
13812
|
import { dirname as dirname10, join as join43 } from "path";
|
|
13745
13813
|
var SLACK_PENDING_INBOUND_DIRNAME = "slack-pending-inbound";
|
|
13746
13814
|
var SLACK_RESTART_CONTEXT_DIRNAME = "slack-restart-context";
|
|
@@ -13798,7 +13866,7 @@ function safeReaddir(dir) {
|
|
|
13798
13866
|
}
|
|
13799
13867
|
function readStrandedMarker(path) {
|
|
13800
13868
|
try {
|
|
13801
|
-
const parsed = JSON.parse(
|
|
13869
|
+
const parsed = JSON.parse(readFileSync34(path, "utf-8"));
|
|
13802
13870
|
if (typeof parsed.channel === "string" && typeof parsed.thread_ts === "string") {
|
|
13803
13871
|
return { channel: parsed.channel, thread_ts: parsed.thread_ts };
|
|
13804
13872
|
}
|
|
@@ -14645,7 +14713,7 @@ async function runDangerousRmBackstop(agentId, codeName, pane) {
|
|
|
14645
14713
|
return;
|
|
14646
14714
|
}
|
|
14647
14715
|
const policy = readRmPolicyText(
|
|
14648
|
-
() =>
|
|
14716
|
+
() => readFileSync35(join44(getFramework("claude-code").getAgentDir(codeName), RM_POLICY_RELATIVE_PATH), "utf-8")
|
|
14649
14717
|
);
|
|
14650
14718
|
const decision = decideDangerousRm(action.prompt, policy, {
|
|
14651
14719
|
isolated: isolationMode(codeName) === "docker"
|
|
@@ -15366,7 +15434,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
|
|
|
15366
15434
|
var dayRolloverInboundHold = /* @__PURE__ */ new Map();
|
|
15367
15435
|
var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
|
|
15368
15436
|
async function channelInboundActivityAgeSecondsFor(codeName) {
|
|
15369
|
-
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-
|
|
15437
|
+
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-NFT3GSDL.js");
|
|
15370
15438
|
const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
|
|
15371
15439
|
if (newest === null) return null;
|
|
15372
15440
|
return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
|
|
@@ -15735,7 +15803,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
|
|
|
15735
15803
|
var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
|
|
15736
15804
|
function projectMcpHash(_codeName, projectDir) {
|
|
15737
15805
|
try {
|
|
15738
|
-
const raw =
|
|
15806
|
+
const raw = readFileSync35(join44(projectDir, ".mcp.json"), "utf-8");
|
|
15739
15807
|
return createHash20("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
|
|
15740
15808
|
} catch {
|
|
15741
15809
|
return null;
|
|
@@ -15743,7 +15811,7 @@ function projectMcpHash(_codeName, projectDir) {
|
|
|
15743
15811
|
}
|
|
15744
15812
|
function projectMcpKeys(_codeName, projectDir) {
|
|
15745
15813
|
try {
|
|
15746
|
-
const raw =
|
|
15814
|
+
const raw = readFileSync35(join44(projectDir, ".mcp.json"), "utf-8");
|
|
15747
15815
|
const parsed = JSON.parse(raw);
|
|
15748
15816
|
const servers = parsed.mcpServers;
|
|
15749
15817
|
if (!servers || typeof servers !== "object") return /* @__PURE__ */ new Set();
|
|
@@ -15761,7 +15829,7 @@ function seedSessionLaunchBaselines(codeName, projectDir) {
|
|
|
15761
15829
|
else runningMcpServerKeys.delete(codeName);
|
|
15762
15830
|
let launchStructure = null;
|
|
15763
15831
|
try {
|
|
15764
|
-
const raw =
|
|
15832
|
+
const raw = readFileSync35(join44(projectDir, ".mcp.json"), "utf-8");
|
|
15765
15833
|
launchStructure = managedMcpStructureHashFromFile(
|
|
15766
15834
|
JSON.parse(raw),
|
|
15767
15835
|
isManagedMcpServerKey
|
|
@@ -15898,7 +15966,7 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
|
|
|
15898
15966
|
if (result && result.rebindCandidates.length > 0 && hostFlagStore().getBoolean("session-tool-rebind")) {
|
|
15899
15967
|
let mcpJsonForRebind = null;
|
|
15900
15968
|
try {
|
|
15901
|
-
mcpJsonForRebind = JSON.parse(
|
|
15969
|
+
mcpJsonForRebind = JSON.parse(readFileSync35(join44(projectDir, ".mcp.json"), "utf-8"));
|
|
15902
15970
|
} catch {
|
|
15903
15971
|
mcpJsonForRebind = null;
|
|
15904
15972
|
}
|
|
@@ -16047,7 +16115,7 @@ function shouldInjectChannelSecrets(agentId) {
|
|
|
16047
16115
|
function projectChannelSecretHash(projectDir) {
|
|
16048
16116
|
try {
|
|
16049
16117
|
const entries = parseEnvIntegrations(
|
|
16050
|
-
|
|
16118
|
+
readFileSync35(join44(projectDir, ".env.integrations"), "utf-8")
|
|
16051
16119
|
);
|
|
16052
16120
|
return channelSecretValueHash(entries, CHANNEL_SECRET_ENV_KEYS);
|
|
16053
16121
|
} catch {
|
|
@@ -16163,7 +16231,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
16163
16231
|
var lastVersionCheckAt = 0;
|
|
16164
16232
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
16165
16233
|
var lastResponsivenessProbeAt = 0;
|
|
16166
|
-
var agtCliVersion = true ? "0.28.
|
|
16234
|
+
var agtCliVersion = true ? "0.28.1184" : "dev";
|
|
16167
16235
|
function resolveBrewPath(execFileSync3) {
|
|
16168
16236
|
try {
|
|
16169
16237
|
const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -16731,7 +16799,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
|
|
|
16731
16799
|
try {
|
|
16732
16800
|
let settings = {};
|
|
16733
16801
|
if (existsSync19(path)) {
|
|
16734
|
-
const raw =
|
|
16802
|
+
const raw = readFileSync35(path, "utf-8").trim();
|
|
16735
16803
|
if (raw) {
|
|
16736
16804
|
let parsed;
|
|
16737
16805
|
try {
|
|
@@ -17842,10 +17910,16 @@ function claudeMdSizeFor(codeName) {
|
|
|
17842
17910
|
return report;
|
|
17843
17911
|
}
|
|
17844
17912
|
function sessionActivityFor(codeName, pane) {
|
|
17913
|
+
const session = getSessionState(codeName);
|
|
17914
|
+
const projectDir = getProjectDir(codeName);
|
|
17845
17915
|
return buildSessionActivityReport({
|
|
17846
17916
|
codeName,
|
|
17847
|
-
transcriptDir: sessionTranscriptDir(
|
|
17848
|
-
sessionId:
|
|
17917
|
+
transcriptDir: sessionTranscriptDir(projectDir),
|
|
17918
|
+
sessionId: session?.currentSessionId ?? null,
|
|
17919
|
+
// ENG-11817: `/clear` and rotations change the session under the same pane.
|
|
17920
|
+
spawnedAtMs: session?.startedAt ?? null,
|
|
17921
|
+
recordedSession: readRecordedSession(dirname11(projectDir)),
|
|
17922
|
+
previousSessionId: peekPreviousSession(codeName)?.sessionId ?? null,
|
|
17849
17923
|
tmuxAlive: pane.tmuxAlive,
|
|
17850
17924
|
screenCapture: pane.screenCapture,
|
|
17851
17925
|
log: (msg) => console.error(msg)
|
|
@@ -18061,7 +18135,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
18061
18135
|
if (codeNames.length === 0) return;
|
|
18062
18136
|
void (async () => {
|
|
18063
18137
|
try {
|
|
18064
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
18138
|
+
const { collectDiagnostics } = await import("../persistent-session-C7632TPG.js");
|
|
18065
18139
|
await api.post("/host/heartbeat", {
|
|
18066
18140
|
host_id: hostId,
|
|
18067
18141
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -18204,7 +18278,7 @@ async function pollCycleInner() {
|
|
|
18204
18278
|
}
|
|
18205
18279
|
try {
|
|
18206
18280
|
const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
|
|
18207
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
18281
|
+
const { collectDiagnostics } = await import("../persistent-session-C7632TPG.js");
|
|
18208
18282
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
18209
18283
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor) : void 0;
|
|
18210
18284
|
let tailscaleHostname;
|
|
@@ -18459,7 +18533,7 @@ async function pollCycleInner() {
|
|
|
18459
18533
|
}
|
|
18460
18534
|
try {
|
|
18461
18535
|
const desiredClaudeCodeVersion = hbResp?.desired_claude_code_version?.trim();
|
|
18462
|
-
const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-
|
|
18536
|
+
const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-JYVD3MJJ.js");
|
|
18463
18537
|
const securityFloor = currentSecurityFloor();
|
|
18464
18538
|
claudeUpdaterInFlight = true;
|
|
18465
18539
|
if (desiredClaudeCodeVersion && (claudePairLoop.busy || claudePairingInProgress())) {
|
|
@@ -18494,7 +18568,7 @@ async function pollCycleInner() {
|
|
|
18494
18568
|
collectPanelessActivityProbes,
|
|
18495
18569
|
getResponsivenessIntervalMs,
|
|
18496
18570
|
occupancyQualificationClassifications
|
|
18497
|
-
} = await import("../responsiveness-probe-
|
|
18571
|
+
} = await import("../responsiveness-probe-NFT3GSDL.js");
|
|
18498
18572
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
18499
18573
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
18500
18574
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -18611,7 +18685,7 @@ async function pollCycleInner() {
|
|
|
18611
18685
|
collectResponsivenessProbes,
|
|
18612
18686
|
livePendingInboundOldestAgeSeconds,
|
|
18613
18687
|
parkPendingInbound
|
|
18614
|
-
} = await import("../responsiveness-probe-
|
|
18688
|
+
} = await import("../responsiveness-probe-NFT3GSDL.js");
|
|
18615
18689
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-M6AFZWNU.js");
|
|
18616
18690
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
18617
18691
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -18700,7 +18774,7 @@ async function pollCycleInner() {
|
|
|
18700
18774
|
);
|
|
18701
18775
|
if (hostFlagStore().getBoolean("wedge-transient-notice")) {
|
|
18702
18776
|
try {
|
|
18703
|
-
const paneTail =
|
|
18777
|
+
const paneTail = readFileSync35(paneLogPath(codeName), "utf8").slice(-65536);
|
|
18704
18778
|
const transient = detectTransientApiErrorInLog(paneTail);
|
|
18705
18779
|
if (transient) {
|
|
18706
18780
|
const wedgeHome = join44(homedir17(), ".augmented", codeName);
|
|
@@ -18897,7 +18971,7 @@ async function pollCycleInner() {
|
|
|
18897
18971
|
}
|
|
18898
18972
|
}
|
|
18899
18973
|
);
|
|
18900
|
-
const { parkPendingInbound } = await import("../responsiveness-probe-
|
|
18974
|
+
const { parkPendingInbound } = await import("../responsiveness-probe-NFT3GSDL.js");
|
|
18901
18975
|
const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
|
|
18902
18976
|
paneFatalStreak.delete(codeName);
|
|
18903
18977
|
paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
|
|
@@ -18928,7 +19002,7 @@ async function pollCycleInner() {
|
|
|
18928
19002
|
TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
|
|
18929
19003
|
bindSourceEscalations
|
|
18930
19004
|
} = await import("../transcript-mount-health-OHE6IVJV.js");
|
|
18931
|
-
const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-
|
|
19005
|
+
const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-C7632TPG.js");
|
|
18932
19006
|
const mountConfig = resolveTranscriptMountConfig();
|
|
18933
19007
|
const liveAgents = agentState.persistentSessionAgents;
|
|
18934
19008
|
for (const tracked of [
|
|
@@ -19093,7 +19167,7 @@ async function pollCycleInner() {
|
|
|
19093
19167
|
}
|
|
19094
19168
|
try {
|
|
19095
19169
|
const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
|
|
19096
|
-
const { probeSessionAuth } = await import("../session-auth-dead-
|
|
19170
|
+
const { probeSessionAuth } = await import("../session-auth-dead-BTGGL4MA.js");
|
|
19097
19171
|
const observations = [];
|
|
19098
19172
|
const pendingCacheCommits = [];
|
|
19099
19173
|
const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
|
|
@@ -19721,7 +19795,7 @@ async function pollCycleInner() {
|
|
|
19721
19795
|
const file = join44(dir, "watchdog-give-up.json");
|
|
19722
19796
|
if (!existsSync19(file)) return;
|
|
19723
19797
|
try {
|
|
19724
|
-
const raw = JSON.parse(
|
|
19798
|
+
const raw = JSON.parse(readFileSync35(file, "utf8"));
|
|
19725
19799
|
if (raw["reason"] !== "usage_limit") return;
|
|
19726
19800
|
raw["usage_limit_last_seen_at"] = (/* @__PURE__ */ new Date()).toISOString();
|
|
19727
19801
|
atomicWriteFileSync(file, JSON.stringify(raw));
|
|
@@ -20331,7 +20405,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
20331
20405
|
newHash = sha256(stripDynamicSections(artifact.content));
|
|
20332
20406
|
try {
|
|
20333
20407
|
const projectClaudeMd = join44(config.configDir, agent.code_name, "project", "CLAUDE.md");
|
|
20334
|
-
const existing =
|
|
20408
|
+
const existing = readFileSync35(projectClaudeMd, "utf-8");
|
|
20335
20409
|
existingHash = sha256(stripDynamicSections(existing));
|
|
20336
20410
|
} catch {
|
|
20337
20411
|
existingHash = null;
|
|
@@ -20349,7 +20423,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
20349
20423
|
const generatorKeys = Object.keys(generatorServers);
|
|
20350
20424
|
let existingRaw = "";
|
|
20351
20425
|
try {
|
|
20352
|
-
existingRaw =
|
|
20426
|
+
existingRaw = readFileSync35(filePath, "utf-8");
|
|
20353
20427
|
} catch {
|
|
20354
20428
|
}
|
|
20355
20429
|
const existingServers = parseMcp(existingRaw);
|
|
@@ -20365,7 +20439,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
20365
20439
|
} else if (artifact.relativePath === "opencode.json") {
|
|
20366
20440
|
let existingRaw = null;
|
|
20367
20441
|
try {
|
|
20368
|
-
existingRaw =
|
|
20442
|
+
existingRaw = readFileSync35(filePath, "utf-8");
|
|
20369
20443
|
} catch {
|
|
20370
20444
|
}
|
|
20371
20445
|
const mergeResult = mergeOpencodeConfigArtifact(artifact.content, existingRaw);
|
|
@@ -21130,7 +21204,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
21130
21204
|
const projectMcpPath = join44(projectDir, ".mcp.json");
|
|
21131
21205
|
let mcpConfig = { mcpServers: {} };
|
|
21132
21206
|
try {
|
|
21133
|
-
mcpConfig = JSON.parse(
|
|
21207
|
+
mcpConfig = JSON.parse(readFileSync35(provisionMcpPath, "utf-8"));
|
|
21134
21208
|
if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
|
|
21135
21209
|
} catch {
|
|
21136
21210
|
}
|
|
@@ -21432,7 +21506,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
21432
21506
|
const envIntPath = join44(projectDir, ".env.integrations");
|
|
21433
21507
|
let preWriteEnv;
|
|
21434
21508
|
try {
|
|
21435
|
-
preWriteEnv =
|
|
21509
|
+
preWriteEnv = readFileSync35(envIntPath, "utf-8");
|
|
21436
21510
|
} catch {
|
|
21437
21511
|
preWriteEnv = void 0;
|
|
21438
21512
|
}
|
|
@@ -21453,8 +21527,8 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
21453
21527
|
if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
|
|
21454
21528
|
try {
|
|
21455
21529
|
const projectMcpPath = join44(projectDir, ".mcp.json");
|
|
21456
|
-
const postWriteEnv =
|
|
21457
|
-
const mcpContent =
|
|
21530
|
+
const postWriteEnv = readFileSync35(envIntPath, "utf-8");
|
|
21531
|
+
const mcpContent = readFileSync35(projectMcpPath, "utf-8");
|
|
21458
21532
|
const changedVars = diffEnvIntegrations(preWriteEnv, postWriteEnv);
|
|
21459
21533
|
const mcpJsonForReap = JSON.parse(mcpContent);
|
|
21460
21534
|
const affectedServerKeys = findMcpServersUsingVars(mcpJsonForReap, changedVars);
|
|
@@ -22108,7 +22182,7 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
22108
22182
|
let mcpJsonParsed = null;
|
|
22109
22183
|
try {
|
|
22110
22184
|
const mcpPath = join44(getProjectDir(agent.code_name), ".mcp.json");
|
|
22111
|
-
mcpJsonParsed = JSON.parse(
|
|
22185
|
+
mcpJsonParsed = JSON.parse(readFileSync35(mcpPath, "utf-8"));
|
|
22112
22186
|
} catch {
|
|
22113
22187
|
}
|
|
22114
22188
|
const computerUseIsolated = isolationMode(agent.code_name) === "docker";
|
|
@@ -23782,7 +23856,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
23782
23856
|
try {
|
|
23783
23857
|
const freshId = rotateSessionForWedge(codeName);
|
|
23784
23858
|
consecutiveWedgeCycles.delete(codeName);
|
|
23785
|
-
const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-
|
|
23859
|
+
const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-NFT3GSDL.js");
|
|
23786
23860
|
const { parked, deadLettered } = parkForRestart(codeName, /* @__PURE__ */ new Date());
|
|
23787
23861
|
const parkNote = parked > 0 ? `, ${parked} inbound parked` : "";
|
|
23788
23862
|
const deadNote = deadLettered > 0 ? `, ${deadLettered} undeliverable dead-lettered` : "";
|
|
@@ -23825,7 +23899,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
23825
23899
|
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}`));
|
|
23826
23900
|
void (async () => {
|
|
23827
23901
|
try {
|
|
23828
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
23902
|
+
const { collectDiagnostics } = await import("../persistent-session-C7632TPG.js");
|
|
23829
23903
|
await api.post("/host/heartbeat", {
|
|
23830
23904
|
host_id: hostId,
|
|
23831
23905
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -23876,7 +23950,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
23876
23950
|
}
|
|
23877
23951
|
try {
|
|
23878
23952
|
const hostId = await getHostId();
|
|
23879
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
23953
|
+
const { collectDiagnostics } = await import("../persistent-session-C7632TPG.js");
|
|
23880
23954
|
await api.post("/host/heartbeat", {
|
|
23881
23955
|
host_id: hostId,
|
|
23882
23956
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -24578,7 +24652,7 @@ async function processClaudePairSessions(agents) {
|
|
|
24578
24652
|
snapshotPairConfig,
|
|
24579
24653
|
// ENG-11659: result -> report body + the manager.log line that records it.
|
|
24580
24654
|
planPairStartReport
|
|
24581
|
-
} = await import("../claude-pair-runtime-
|
|
24655
|
+
} = await import("../claude-pair-runtime-IJAQHR2V.js");
|
|
24582
24656
|
const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
|
|
24583
24657
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
24584
24658
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
@@ -24879,7 +24953,7 @@ function loadMemoryManifest(agentId, configDir, codeName) {
|
|
|
24879
24953
|
if (cached) return cached;
|
|
24880
24954
|
let manifest = {};
|
|
24881
24955
|
try {
|
|
24882
|
-
const raw =
|
|
24956
|
+
const raw = readFileSync35(memoryManifestPath(configDir, codeName), "utf-8");
|
|
24883
24957
|
const parsed = JSON.parse(raw);
|
|
24884
24958
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
24885
24959
|
for (const [name, entry] of Object.entries(parsed)) {
|
|
@@ -24994,7 +25068,7 @@ function applyMemoryTombstones(opts) {
|
|
|
24994
25068
|
continue;
|
|
24995
25069
|
}
|
|
24996
25070
|
try {
|
|
24997
|
-
const actual = createHash20("sha256").update(
|
|
25071
|
+
const actual = createHash20("sha256").update(readFileSync35(filePath)).digest("hex");
|
|
24998
25072
|
if (actual !== entry.sha) {
|
|
24999
25073
|
outcomes.kept_modified++;
|
|
25000
25074
|
outcomes.unapplied.push({ name: tomb.name, reason: "kept_modified" });
|
|
@@ -25094,7 +25168,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
25094
25168
|
for (const file of readdirSync14(memoryDir)) {
|
|
25095
25169
|
if (!file.endsWith(".md")) continue;
|
|
25096
25170
|
try {
|
|
25097
|
-
const raw =
|
|
25171
|
+
const raw = readFileSync35(join44(memoryDir, file), "utf-8");
|
|
25098
25172
|
const fileHash = createHash20("sha256").update(raw).digest("hex").slice(0, 16);
|
|
25099
25173
|
currentHashes.set(file, fileHash);
|
|
25100
25174
|
if (prevHashes.get(file) === fileHash) continue;
|
|
@@ -25119,7 +25193,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
25119
25193
|
} catch (err) {
|
|
25120
25194
|
for (const mem of changedMemories) {
|
|
25121
25195
|
for (const [file] of currentHashes) {
|
|
25122
|
-
const parsed = parseMemoryFile(
|
|
25196
|
+
const parsed = parseMemoryFile(readFileSync35(join44(memoryDir, file), "utf-8"), file.replace(/\.md$/, ""));
|
|
25123
25197
|
if (parsed?.name === mem.name) currentHashes.delete(file);
|
|
25124
25198
|
}
|
|
25125
25199
|
}
|
|
@@ -25258,7 +25332,7 @@ ${mem.content}
|
|
|
25258
25332
|
if (existsSync19(filePath)) {
|
|
25259
25333
|
let existing = "";
|
|
25260
25334
|
try {
|
|
25261
|
-
existing =
|
|
25335
|
+
existing = readFileSync35(filePath, "utf-8");
|
|
25262
25336
|
} catch {
|
|
25263
25337
|
}
|
|
25264
25338
|
if (existing === desired) {
|
|
@@ -25654,7 +25728,7 @@ function startManager(opts) {
|
|
|
25654
25728
|
try {
|
|
25655
25729
|
const stateFile = getStateFile();
|
|
25656
25730
|
if (existsSync19(stateFile)) {
|
|
25657
|
-
const raw =
|
|
25731
|
+
const raw = readFileSync35(stateFile, "utf-8");
|
|
25658
25732
|
const parsed = JSON.parse(raw);
|
|
25659
25733
|
if (Array.isArray(parsed.agents)) {
|
|
25660
25734
|
state9.agents = parsed.agents;
|
|
@@ -25717,7 +25791,7 @@ async function reapOrphanedClaudePids() {
|
|
|
25717
25791
|
const looksLikeClaude = (pid) => {
|
|
25718
25792
|
if (process.platform !== "linux") return true;
|
|
25719
25793
|
try {
|
|
25720
|
-
const comm =
|
|
25794
|
+
const comm = readFileSync35(`/proc/${pid}/comm`, "utf-8").trim().toLowerCase();
|
|
25721
25795
|
return comm.includes("claude");
|
|
25722
25796
|
} catch {
|
|
25723
25797
|
return false;
|
|
@@ -25839,7 +25913,7 @@ function deployMcpAssets() {
|
|
|
25839
25913
|
const fileHash = (p) => {
|
|
25840
25914
|
try {
|
|
25841
25915
|
if (!existsSync19(p)) return null;
|
|
25842
|
-
return createHash20("sha256").update(
|
|
25916
|
+
return createHash20("sha256").update(readFileSync35(p)).digest("hex");
|
|
25843
25917
|
} catch {
|
|
25844
25918
|
return null;
|
|
25845
25919
|
}
|
|
@@ -25957,7 +26031,7 @@ function deployMcpAssets() {
|
|
|
25957
26031
|
for (const subdir of ["provision", "project"]) {
|
|
25958
26032
|
const mcpJsonPath = join44(agentsDir, entry.name, subdir, ".mcp.json");
|
|
25959
26033
|
try {
|
|
25960
|
-
const raw =
|
|
26034
|
+
const raw = readFileSync35(mcpJsonPath, "utf-8");
|
|
25961
26035
|
if (!raw.includes("@integrity-labs/augmented-mcp")) continue;
|
|
25962
26036
|
const mcpConfig = JSON.parse(raw);
|
|
25963
26037
|
const augServer = mcpConfig.mcpServers?.["augmented"];
|