@integrity-labs/agt-cli 0.28.1296 → 0.28.1298
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/{api-client-J7GYTC7I.js → api-client-INS5Y6AC.js} +2 -2
- package/dist/bin/agt.js +6 -6
- package/dist/{chunk-2IJ5OXZZ.js → chunk-FQOXKQXI.js} +14 -2
- package/dist/chunk-FQOXKQXI.js.map +1 -0
- package/dist/{chunk-M6L4UP45.js → chunk-LH6GI45I.js} +2 -2
- package/dist/{chunk-F5ZW7Q4X.js → chunk-QUZDW6JK.js} +372 -349
- package/dist/chunk-QUZDW6JK.js.map +1 -0
- package/dist/{chunk-KNU3KJIM.js → chunk-XVGLZ3BT.js} +2 -1
- package/dist/{claude-pair-runtime-UX23M5HV.js → claude-pair-runtime-43E2YV2S.js} +2 -2
- package/dist/lib/manager-worker.js +227 -32
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/index.js +3 -3
- package/dist/{persistent-session-FA6AKXTO.js → persistent-session-RGMMUKVK.js} +7 -3
- package/dist/{responsiveness-probe-CC2HTG4P.js → responsiveness-probe-I7HNQGP4.js} +3 -3
- package/dist/{session-auth-dead-3GTNMEIP.js → session-auth-dead-JVDVNJR3.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-2IJ5OXZZ.js.map +0 -1
- package/dist/chunk-F5ZW7Q4X.js.map +0 -1
- /package/dist/{api-client-J7GYTC7I.js.map → api-client-INS5Y6AC.js.map} +0 -0
- /package/dist/{chunk-M6L4UP45.js.map → chunk-LH6GI45I.js.map} +0 -0
- /package/dist/{chunk-KNU3KJIM.js.map → chunk-XVGLZ3BT.js.map} +0 -0
- /package/dist/{claude-pair-runtime-UX23M5HV.js.map → claude-pair-runtime-43E2YV2S.js.map} +0 -0
- /package/dist/{persistent-session-FA6AKXTO.js.map → persistent-session-RGMMUKVK.js.map} +0 -0
- /package/dist/{responsiveness-probe-CC2HTG4P.js.map → responsiveness-probe-I7HNQGP4.js.map} +0 -0
- /package/dist/{session-auth-dead-3GTNMEIP.js.map → session-auth-dead-JVDVNJR3.js.map} +0 -0
|
@@ -235,6 +235,7 @@ export {
|
|
|
235
235
|
sessionFileExists,
|
|
236
236
|
sessionTranscriptDir,
|
|
237
237
|
subagentTranscriptDir,
|
|
238
|
+
sessionFilePath,
|
|
238
239
|
transcriptActivityAgeSeconds,
|
|
239
240
|
subagentActivityAgeSeconds,
|
|
240
241
|
isAgentIdle,
|
|
@@ -244,4 +245,4 @@ export {
|
|
|
244
245
|
peekPreviousSession,
|
|
245
246
|
readDailySessionPin
|
|
246
247
|
};
|
|
247
|
-
//# sourceMappingURL=chunk-
|
|
248
|
+
//# sourceMappingURL=chunk-XVGLZ3BT.js.map
|
|
@@ -323,7 +323,7 @@ async function spawnPairSession(session) {
|
|
|
323
323
|
return { ok: true };
|
|
324
324
|
} catch {
|
|
325
325
|
}
|
|
326
|
-
const { resolveClaudeBinary } = await import("./persistent-session-
|
|
326
|
+
const { resolveClaudeBinary } = await import("./persistent-session-RGMMUKVK.js");
|
|
327
327
|
const claudeBin = resolveClaudeBinary();
|
|
328
328
|
const pairEnv = {
|
|
329
329
|
...process.env,
|
|
@@ -838,4 +838,4 @@ export {
|
|
|
838
838
|
startClaudePair,
|
|
839
839
|
submitClaudePairCode
|
|
840
840
|
};
|
|
841
|
-
//# sourceMappingURL=claude-pair-runtime-
|
|
841
|
+
//# sourceMappingURL=claude-pair-runtime-43E2YV2S.js.map
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
tripClass,
|
|
71
71
|
writeEtcEnvironment,
|
|
72
72
|
writeProfileDScript
|
|
73
|
-
} from "../chunk-
|
|
73
|
+
} from "../chunk-QUZDW6JK.js";
|
|
74
74
|
import {
|
|
75
75
|
ApiError,
|
|
76
76
|
adoptHostKeyInProcess,
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
probeHostKey,
|
|
89
89
|
requireHost,
|
|
90
90
|
setConfigHash
|
|
91
|
-
} from "../chunk-
|
|
91
|
+
} from "../chunk-LH6GI45I.js";
|
|
92
92
|
import {
|
|
93
93
|
BLOCKED_ON_PROMPT_DECISION,
|
|
94
94
|
CHANNEL_SECRET_ENV_KEYS,
|
|
@@ -116,6 +116,7 @@ import {
|
|
|
116
116
|
getProjectDir,
|
|
117
117
|
getSessionState,
|
|
118
118
|
hardBoundedCapture,
|
|
119
|
+
hardBoundedExecFile,
|
|
119
120
|
hasTimeoutBinary,
|
|
120
121
|
hashFile,
|
|
121
122
|
injectMessage,
|
|
@@ -127,6 +128,7 @@ import {
|
|
|
127
128
|
isSessionHealthy,
|
|
128
129
|
isolationMode,
|
|
129
130
|
killStragglerProcess,
|
|
131
|
+
launchStartMs,
|
|
130
132
|
log,
|
|
131
133
|
mergeOpencodeConfigArtifact,
|
|
132
134
|
modelPolicyAuthComponent,
|
|
@@ -172,6 +174,7 @@ import {
|
|
|
172
174
|
stopPersistentSession,
|
|
173
175
|
supersedePendingSpawn,
|
|
174
176
|
syncContainerMemory,
|
|
177
|
+
takeUnexpectedExit,
|
|
175
178
|
takeWatchdogGiveUpCount,
|
|
176
179
|
takeWatchdogUnclaimedDialogCount,
|
|
177
180
|
takeZombieDetection,
|
|
@@ -180,18 +183,19 @@ import {
|
|
|
180
183
|
webFetchBaselineValue,
|
|
181
184
|
webFetchRestartNeeded,
|
|
182
185
|
writeEgressAllowlist
|
|
183
|
-
} from "../chunk-
|
|
186
|
+
} from "../chunk-FQOXKQXI.js";
|
|
184
187
|
import {
|
|
185
188
|
isAgentIdle,
|
|
186
189
|
isStaleForToday,
|
|
187
190
|
minutesSinceLocalMidnight,
|
|
188
191
|
peekCurrentSession,
|
|
189
192
|
peekPreviousSession,
|
|
193
|
+
sessionFilePath,
|
|
190
194
|
sessionTranscriptDir,
|
|
191
195
|
subagentActivityAgeSeconds,
|
|
192
196
|
subagentTranscriptDir,
|
|
193
197
|
transcriptActivityAgeSeconds
|
|
194
|
-
} from "../chunk-
|
|
198
|
+
} from "../chunk-XVGLZ3BT.js";
|
|
195
199
|
import {
|
|
196
200
|
classifyUnanswerablePane,
|
|
197
201
|
focusedConfirmDialogBlock,
|
|
@@ -1270,7 +1274,7 @@ var SignalledHostPids = class {
|
|
|
1270
1274
|
|
|
1271
1275
|
// src/lib/manager-worker.ts
|
|
1272
1276
|
import { createHash as createHash21 } from "crypto";
|
|
1273
|
-
import { readFileSync as readFileSync39, writeFileSync as writeFileSync20, mkdirSync as mkdirSync18, existsSync as existsSync20, rmSync as rmSync9, readdirSync as readdirSync15, statSync as statSync15, unlinkSync as unlinkSync6, renameSync as renameSync12, utimesSync as utimesSync4, readlinkSync as readlinkSync2, openSync as
|
|
1277
|
+
import { readFileSync as readFileSync39, writeFileSync as writeFileSync20, mkdirSync as mkdirSync18, existsSync as existsSync20, rmSync as rmSync9, readdirSync as readdirSync15, statSync as statSync15, unlinkSync as unlinkSync6, renameSync as renameSync12, utimesSync as utimesSync4, readlinkSync as readlinkSync2, openSync as openSync7, readSync as readSync6, closeSync as closeSync7 } from "fs";
|
|
1274
1278
|
|
|
1275
1279
|
// src/lib/atomic-file-replace.ts
|
|
1276
1280
|
import { copyFileSync, renameSync, unlinkSync } from "fs";
|
|
@@ -4542,8 +4546,11 @@ function decideRestartGate(opts) {
|
|
|
4542
4546
|
const progressBusy = transcriptAge !== null ? transcriptAge < transcriptThreshold : opts.paneLogAgeSeconds !== null && opts.paneLogAgeSeconds < paneThreshold;
|
|
4543
4547
|
const inboundBusy = opts.inboundAgeSeconds !== null && opts.inboundAgeSeconds < inboundThreshold;
|
|
4544
4548
|
if (progressBusy || inboundBusy) return "defer-idle";
|
|
4549
|
+
const openAge = opts.openToolCallAgeSeconds ?? null;
|
|
4550
|
+
if (openAge !== null && openAge < RESTART_OPEN_TOOL_CALL_MAX_SECONDS) return "defer-idle";
|
|
4545
4551
|
return "proceed";
|
|
4546
4552
|
}
|
|
4553
|
+
var RESTART_OPEN_TOOL_CALL_MAX_SECONDS = 30 * 60;
|
|
4547
4554
|
|
|
4548
4555
|
// src/lib/model-api-error.ts
|
|
4549
4556
|
function classifyHttpStatus(status) {
|
|
@@ -6799,6 +6806,160 @@ function buildSessionActivityReport(args) {
|
|
|
6799
6806
|
}
|
|
6800
6807
|
}
|
|
6801
6808
|
|
|
6809
|
+
// src/lib/open-tool-call.ts
|
|
6810
|
+
import { closeSync as closeSync4, fstatSync as fstatSync2, openSync as openSync4, readSync as readSync3 } from "fs";
|
|
6811
|
+
var OPEN_TOOL_CALL_TAIL_BYTES = 512 * 1024;
|
|
6812
|
+
function newestOpenToolCall(jsonlTail, notBeforeMs = null) {
|
|
6813
|
+
const open = /* @__PURE__ */ new Map();
|
|
6814
|
+
for (const line of jsonlTail.split("\n")) {
|
|
6815
|
+
if (!line.includes('"tool_use') && !line.includes('"tool_result')) continue;
|
|
6816
|
+
let rec;
|
|
6817
|
+
try {
|
|
6818
|
+
rec = JSON.parse(line);
|
|
6819
|
+
} catch {
|
|
6820
|
+
continue;
|
|
6821
|
+
}
|
|
6822
|
+
const r = rec;
|
|
6823
|
+
const content = Array.isArray(r?.message?.content) ? r.message.content : [];
|
|
6824
|
+
for (const part of content) {
|
|
6825
|
+
const p = part;
|
|
6826
|
+
if (p?.type === "tool_use" && typeof p.id === "string") {
|
|
6827
|
+
open.set(p.id, { name: typeof p.name === "string" ? p.name : null, since: typeof r.timestamp === "string" ? r.timestamp : null });
|
|
6828
|
+
} else if (p?.type === "tool_result" && typeof p.tool_use_id === "string") {
|
|
6829
|
+
open.delete(p.tool_use_id);
|
|
6830
|
+
}
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
6833
|
+
let newest = null;
|
|
6834
|
+
for (const [toolUseId, v] of open) {
|
|
6835
|
+
const t = v.since ? Date.parse(v.since) : NaN;
|
|
6836
|
+
if (notBeforeMs !== null && Number.isFinite(t) && t < notBeforeMs) continue;
|
|
6837
|
+
newest = { toolUseId, ...v };
|
|
6838
|
+
}
|
|
6839
|
+
return newest;
|
|
6840
|
+
}
|
|
6841
|
+
function readTail2(path, bytes = OPEN_TOOL_CALL_TAIL_BYTES) {
|
|
6842
|
+
let fd = null;
|
|
6843
|
+
try {
|
|
6844
|
+
fd = openSync4(path, "r");
|
|
6845
|
+
const size = fstatSync2(fd).size;
|
|
6846
|
+
const start = Math.max(0, size - bytes);
|
|
6847
|
+
const buf = Buffer.alloc(size - start);
|
|
6848
|
+
const n = readSync3(fd, buf, 0, buf.length, start);
|
|
6849
|
+
return buf.subarray(0, n).toString("utf8");
|
|
6850
|
+
} catch {
|
|
6851
|
+
return null;
|
|
6852
|
+
} finally {
|
|
6853
|
+
if (fd !== null) {
|
|
6854
|
+
try {
|
|
6855
|
+
closeSync4(fd);
|
|
6856
|
+
} catch {
|
|
6857
|
+
}
|
|
6858
|
+
}
|
|
6859
|
+
}
|
|
6860
|
+
}
|
|
6861
|
+
function openToolCallAgeSeconds(path, now = /* @__PURE__ */ new Date(), sessionStartedAtMs = null) {
|
|
6862
|
+
const tail = readTail2(path);
|
|
6863
|
+
if (tail === null) return null;
|
|
6864
|
+
const open = newestOpenToolCall(tail, sessionStartedAtMs);
|
|
6865
|
+
if (!open) return null;
|
|
6866
|
+
const since = open.since ? Date.parse(open.since) : NaN;
|
|
6867
|
+
if (Number.isFinite(since)) return Math.max(0, Math.floor((now.getTime() - since) / 1e3));
|
|
6868
|
+
const firstSeen = undatedFirstSeen.get(open.toolUseId) ?? now.getTime();
|
|
6869
|
+
undatedFirstSeen.delete(open.toolUseId);
|
|
6870
|
+
undatedFirstSeen.set(open.toolUseId, firstSeen);
|
|
6871
|
+
while (undatedFirstSeen.size > UNDATED_FIRST_SEEN_CAP) undatedFirstSeen.delete(undatedFirstSeen.keys().next().value);
|
|
6872
|
+
return Math.max(0, Math.floor((now.getTime() - firstSeen) / 1e3));
|
|
6873
|
+
}
|
|
6874
|
+
var undatedFirstSeen = /* @__PURE__ */ new Map();
|
|
6875
|
+
var UNDATED_FIRST_SEEN_CAP = 256;
|
|
6876
|
+
|
|
6877
|
+
// src/lib/container-exit.ts
|
|
6878
|
+
function parseContainerDeath(stdout, containerName, notBeforeMs = null) {
|
|
6879
|
+
let last = null;
|
|
6880
|
+
let oomSinceDie = null;
|
|
6881
|
+
for (const line of stdout.split("\n")) {
|
|
6882
|
+
if (!line.trim()) continue;
|
|
6883
|
+
let ev;
|
|
6884
|
+
try {
|
|
6885
|
+
ev = JSON.parse(line);
|
|
6886
|
+
} catch {
|
|
6887
|
+
continue;
|
|
6888
|
+
}
|
|
6889
|
+
const e = ev;
|
|
6890
|
+
if (e.Type !== void 0 && e.Type !== "container") continue;
|
|
6891
|
+
const attrs = e.Actor?.Attributes ?? {};
|
|
6892
|
+
if (attrs.name !== containerName) continue;
|
|
6893
|
+
const action = typeof e.Action === "string" ? e.Action : typeof e.status === "string" ? e.status : "";
|
|
6894
|
+
const at = typeof e.time === "number" && Number.isFinite(e.time) ? e.time : null;
|
|
6895
|
+
if (notBeforeMs !== null) {
|
|
6896
|
+
const evMs = typeof e.timeNano === "number" && Number.isFinite(e.timeNano) ? e.timeNano / 1e6 : at !== null ? at * 1e3 : null;
|
|
6897
|
+
if (evMs === null || evMs < notBeforeMs) continue;
|
|
6898
|
+
}
|
|
6899
|
+
if (action === "oom") {
|
|
6900
|
+
oomSinceDie = at ?? oomSinceDie ?? 0;
|
|
6901
|
+
} else if (action === "die") {
|
|
6902
|
+
const code = typeof attrs.exitCode === "string" ? Number.parseInt(attrs.exitCode, 10) : NaN;
|
|
6903
|
+
last = {
|
|
6904
|
+
exitCode: Number.isFinite(code) ? code : null,
|
|
6905
|
+
oom: oomSinceDie !== null,
|
|
6906
|
+
at: at === null ? null : new Date(at * 1e3).toISOString()
|
|
6907
|
+
};
|
|
6908
|
+
oomSinceDie = null;
|
|
6909
|
+
}
|
|
6910
|
+
}
|
|
6911
|
+
if (oomSinceDie !== null) {
|
|
6912
|
+
return { exitCode: null, oom: true, at: oomSinceDie ? new Date(oomSinceDie * 1e3).toISOString() : null };
|
|
6913
|
+
}
|
|
6914
|
+
return last;
|
|
6915
|
+
}
|
|
6916
|
+
var CONTAINER_DEATH_LOOKBACK_SECONDS = 15 * 60;
|
|
6917
|
+
function containerDeathWindow(nowMs, launchedAtMs) {
|
|
6918
|
+
const until = Math.ceil(nowMs / 1e3);
|
|
6919
|
+
const lookbackSince = Math.floor(nowMs / 1e3) - CONTAINER_DEATH_LOOKBACK_SECONDS;
|
|
6920
|
+
const since = launchedAtMs === null ? lookbackSince : Math.max(lookbackSince, Math.floor(launchedAtMs / 1e3));
|
|
6921
|
+
return { since, until };
|
|
6922
|
+
}
|
|
6923
|
+
function readContainerDeath(codeName, nowMs = Date.now(), launchedAtMs = null) {
|
|
6924
|
+
const { since, until } = containerDeathWindow(nowMs, launchedAtMs);
|
|
6925
|
+
const name = `agt-${codeName}`;
|
|
6926
|
+
const r = hardBoundedExecFile(
|
|
6927
|
+
"docker",
|
|
6928
|
+
[
|
|
6929
|
+
"events",
|
|
6930
|
+
"--since",
|
|
6931
|
+
String(since),
|
|
6932
|
+
"--until",
|
|
6933
|
+
String(until),
|
|
6934
|
+
"--filter",
|
|
6935
|
+
"type=container",
|
|
6936
|
+
"--filter",
|
|
6937
|
+
`container=${name}`,
|
|
6938
|
+
"--filter",
|
|
6939
|
+
"event=die",
|
|
6940
|
+
"--filter",
|
|
6941
|
+
"event=oom",
|
|
6942
|
+
"--format",
|
|
6943
|
+
"{{json .}}"
|
|
6944
|
+
],
|
|
6945
|
+
{ timeoutMs: 5e3 }
|
|
6946
|
+
);
|
|
6947
|
+
if (r.kind !== "ok") return null;
|
|
6948
|
+
return parseContainerDeath(r.stdout, name, launchedAtMs);
|
|
6949
|
+
}
|
|
6950
|
+
function describeContainerDeath(d, memoryCap) {
|
|
6951
|
+
if (d.oom) {
|
|
6952
|
+
return {
|
|
6953
|
+
source: "container-oom",
|
|
6954
|
+
reason: `container killed for exceeding its memory cap${memoryCap ? ` (${memoryCap})` : ""}; any running job was lost`
|
|
6955
|
+
};
|
|
6956
|
+
}
|
|
6957
|
+
return {
|
|
6958
|
+
source: "container-exited",
|
|
6959
|
+
reason: `container exited without a manager stop${d.exitCode !== null ? ` with code ${d.exitCode}` : ""}; any running job was lost`
|
|
6960
|
+
};
|
|
6961
|
+
}
|
|
6962
|
+
|
|
6802
6963
|
// src/lib/workflow-run-reconciler.ts
|
|
6803
6964
|
import { readdirSync as readdirSync5, readFileSync as readFileSync16, statSync as statSync4 } from "fs";
|
|
6804
6965
|
import { join as join22 } from "path";
|
|
@@ -7922,7 +8083,7 @@ function readToolCallPathSalt(codeName, homeDir) {
|
|
|
7922
8083
|
import { statSync as statSync6 } from "fs";
|
|
7923
8084
|
|
|
7924
8085
|
// src/lib/tool-call-extractor.ts
|
|
7925
|
-
import { closeSync as
|
|
8086
|
+
import { closeSync as closeSync5, fstatSync as fstatSync3, openSync as openSync5, readFileSync as readFileSync20, readSync as readSync4, readdirSync as readdirSync7 } from "fs";
|
|
7926
8087
|
import { basename as basename3, join as join26, relative } from "path";
|
|
7927
8088
|
import { StringDecoder } from "string_decoder";
|
|
7928
8089
|
|
|
@@ -8172,7 +8333,7 @@ var WINDOW_BUDGET_BYTES = 4 * 1024 * 1024;
|
|
|
8172
8333
|
function extractTranscriptWindow(file, opts, from) {
|
|
8173
8334
|
let fd;
|
|
8174
8335
|
try {
|
|
8175
|
-
fd =
|
|
8336
|
+
fd = openSync5(file.absPath, "r");
|
|
8176
8337
|
} catch {
|
|
8177
8338
|
return {
|
|
8178
8339
|
records: [],
|
|
@@ -8193,7 +8354,7 @@ function extractTranscriptWindow(file, opts, from) {
|
|
|
8193
8354
|
let rewound = false;
|
|
8194
8355
|
let fileSize = null;
|
|
8195
8356
|
try {
|
|
8196
|
-
const { size } =
|
|
8357
|
+
const { size } = fstatSync3(fd);
|
|
8197
8358
|
fileSize = size;
|
|
8198
8359
|
if (startByte > size) {
|
|
8199
8360
|
startByte = 0;
|
|
@@ -8218,7 +8379,7 @@ function extractTranscriptWindow(file, opts, from) {
|
|
|
8218
8379
|
hitBudget = true;
|
|
8219
8380
|
break;
|
|
8220
8381
|
}
|
|
8221
|
-
const bytesRead =
|
|
8382
|
+
const bytesRead = readSync4(fd, buf, 0, WINDOW_CHUNK_BYTES, position);
|
|
8222
8383
|
if (bytesRead <= 0) break;
|
|
8223
8384
|
position += bytesRead;
|
|
8224
8385
|
carry += decoder.write(buf.subarray(0, bytesRead));
|
|
@@ -8241,7 +8402,7 @@ function extractTranscriptWindow(file, opts, from) {
|
|
|
8241
8402
|
} catch {
|
|
8242
8403
|
} finally {
|
|
8243
8404
|
try {
|
|
8244
|
-
|
|
8405
|
+
closeSync5(fd);
|
|
8245
8406
|
} catch {
|
|
8246
8407
|
}
|
|
8247
8408
|
}
|
|
@@ -13088,7 +13249,7 @@ function respawnedByAnotherCaller(decision, healthyAfter, sessionStartedAt, lane
|
|
|
13088
13249
|
}
|
|
13089
13250
|
|
|
13090
13251
|
// src/lib/occupancy-gate.ts
|
|
13091
|
-
import { closeSync as
|
|
13252
|
+
import { closeSync as closeSync6, openSync as openSync6, readdirSync as readdirSync12, readSync as readSync5, statSync as statSync13 } from "fs";
|
|
13092
13253
|
import { join as join44 } from "path";
|
|
13093
13254
|
function rostersMeasuredZero(mode, attested, runtimeRunning) {
|
|
13094
13255
|
return mode === "enforce" && attested && runtimeRunning;
|
|
@@ -13105,7 +13266,7 @@ function readAlignedTail(path, tailBytes, maxAlignBytes) {
|
|
|
13105
13266
|
try {
|
|
13106
13267
|
const size = statSync13(path).size;
|
|
13107
13268
|
if (size <= 0) return { content: "", complete: true, truncated: false };
|
|
13108
|
-
fd =
|
|
13269
|
+
fd = openSync6(path, "r");
|
|
13109
13270
|
let readStart = Math.max(0, size - tailBytes);
|
|
13110
13271
|
if (readStart > 0) {
|
|
13111
13272
|
const scanFloor = Math.max(0, readStart - maxAlignBytes);
|
|
@@ -13116,7 +13277,7 @@ function readAlignedTail(path, tailBytes, maxAlignBytes) {
|
|
|
13116
13277
|
const from = Math.max(scanFloor, pos - CHUNK);
|
|
13117
13278
|
const len2 = pos - from;
|
|
13118
13279
|
const b = Buffer.allocUnsafe(len2);
|
|
13119
|
-
if (
|
|
13280
|
+
if (readSync5(fd, b, 0, len2, from) !== len2) return null;
|
|
13120
13281
|
const idx = b.lastIndexOf(10);
|
|
13121
13282
|
if (idx !== -1) {
|
|
13122
13283
|
boundary = from + idx + 1;
|
|
@@ -13134,14 +13295,14 @@ function readAlignedTail(path, tailBytes, maxAlignBytes) {
|
|
|
13134
13295
|
}
|
|
13135
13296
|
const len = size - readStart;
|
|
13136
13297
|
const buf = Buffer.allocUnsafe(len);
|
|
13137
|
-
if (
|
|
13298
|
+
if (readSync5(fd, buf, 0, len, readStart) !== len) return null;
|
|
13138
13299
|
return { content: buf.toString("utf-8", 0, len), complete: true, truncated: readStart > 0 };
|
|
13139
13300
|
} catch {
|
|
13140
13301
|
return null;
|
|
13141
13302
|
} finally {
|
|
13142
13303
|
if (fd != null) {
|
|
13143
13304
|
try {
|
|
13144
|
-
|
|
13305
|
+
closeSync6(fd);
|
|
13145
13306
|
} catch {
|
|
13146
13307
|
}
|
|
13147
13308
|
}
|
|
@@ -15613,7 +15774,7 @@ function createFileMigrationReportIO(codeName, log2) {
|
|
|
15613
15774
|
};
|
|
15614
15775
|
}
|
|
15615
15776
|
var managerHostPost = async (path, body) => {
|
|
15616
|
-
const { api: api2, ApiError: ApiError3 } = await import("../api-client-
|
|
15777
|
+
const { api: api2, ApiError: ApiError3 } = await import("../api-client-INS5Y6AC.js");
|
|
15617
15778
|
try {
|
|
15618
15779
|
const json = await api2.post(path, body);
|
|
15619
15780
|
return { status: 200, json };
|
|
@@ -17702,7 +17863,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
|
|
|
17702
17863
|
var dayRolloverInboundHold = /* @__PURE__ */ new Map();
|
|
17703
17864
|
var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
|
|
17704
17865
|
async function channelInboundActivityAgeSecondsFor(codeName) {
|
|
17705
|
-
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-
|
|
17866
|
+
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-I7HNQGP4.js");
|
|
17706
17867
|
const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
|
|
17707
17868
|
if (newest === null) return null;
|
|
17708
17869
|
return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
|
|
@@ -17906,6 +18067,13 @@ function paneLogAgeSecondsFor(codeName) {
|
|
|
17906
18067
|
return 0;
|
|
17907
18068
|
}
|
|
17908
18069
|
}
|
|
18070
|
+
function openToolCallAgeSecondsFor(codeName) {
|
|
18071
|
+
const state10 = getSessionState(codeName);
|
|
18072
|
+
const sessionId = state10?.currentSessionId ?? peekCurrentSession(codeName)?.sessionId ?? null;
|
|
18073
|
+
if (!sessionId) return null;
|
|
18074
|
+
const startedAt = launchStartMs(state10);
|
|
18075
|
+
return openToolCallAgeSeconds(sessionFilePath(getProjectDir2(codeName), sessionId), /* @__PURE__ */ new Date(), startedAt);
|
|
18076
|
+
}
|
|
17909
18077
|
function transcriptAgeSecondsFor(codeName) {
|
|
17910
18078
|
const sessionId = getSessionState(codeName)?.currentSessionId ?? null;
|
|
17911
18079
|
return transcriptActivityAgeSeconds(getProjectDir2(codeName), sessionId, /* @__PURE__ */ new Date());
|
|
@@ -17934,6 +18102,8 @@ function restartGateFor(codeName, reason) {
|
|
|
17934
18102
|
paneLogAgeSeconds: paneLogAgeSecondsFor(codeName),
|
|
17935
18103
|
transcriptAgeSeconds: transcriptAgeSecondsFor(codeName),
|
|
17936
18104
|
inboundAgeSeconds: inboundAgeSecondsFor(codeName),
|
|
18105
|
+
// ENG-12276: a long tool call is a turn in progress even with a quiet transcript.
|
|
18106
|
+
openToolCallAgeSeconds: openToolCallAgeSecondsFor(codeName),
|
|
17937
18107
|
now: /* @__PURE__ */ new Date()
|
|
17938
18108
|
});
|
|
17939
18109
|
const nextStreak = nextWindowDeferStreak(priorStreak, decision);
|
|
@@ -17960,6 +18130,10 @@ function isHostBusyForForcedUpdate(opts) {
|
|
|
17960
18130
|
// the last 5 minutes no longer does. On a 14-agent host the inbound axis
|
|
17961
18131
|
// is what made the gate un-satisfiable in practice.
|
|
17962
18132
|
inboundAgeSeconds: opts?.relaxed ? null : inboundAgeSecondsFor(agent.codeName),
|
|
18133
|
+
// ENG-12276 (Obi Wan 4a40c9eb6fda on #7785): the forced update restarts the
|
|
18134
|
+
// manager and so every agent's session, so a long-running tool call holds
|
|
18135
|
+
// it too. Kept in relaxed mode: a running tool is progress, not inbound.
|
|
18136
|
+
openToolCallAgeSeconds: openToolCallAgeSecondsFor(agent.codeName),
|
|
17963
18137
|
now,
|
|
17964
18138
|
env: {}
|
|
17965
18139
|
});
|
|
@@ -18585,7 +18759,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
18585
18759
|
var lastVersionCheckAt = 0;
|
|
18586
18760
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
18587
18761
|
var lastResponsivenessProbeAt = 0;
|
|
18588
|
-
var agtCliVersion = true ? "0.28.
|
|
18762
|
+
var agtCliVersion = true ? "0.28.1298" : "dev";
|
|
18589
18763
|
function resolveBrewPath(execFileSync5) {
|
|
18590
18764
|
try {
|
|
18591
18765
|
const out = execFileSync5("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -20462,13 +20636,13 @@ var creditPaneCursor = new PaneResultCursor({
|
|
|
20462
20636
|
}
|
|
20463
20637
|
},
|
|
20464
20638
|
read(path, start, end) {
|
|
20465
|
-
const fd =
|
|
20639
|
+
const fd = openSync7(path, "r");
|
|
20466
20640
|
try {
|
|
20467
20641
|
const buf = Buffer.alloc(end - start);
|
|
20468
|
-
const n =
|
|
20642
|
+
const n = readSync6(fd, buf, 0, buf.length, start);
|
|
20469
20643
|
return buf.subarray(0, n);
|
|
20470
20644
|
} finally {
|
|
20471
|
-
|
|
20645
|
+
closeSync7(fd);
|
|
20472
20646
|
}
|
|
20473
20647
|
}
|
|
20474
20648
|
});
|
|
@@ -20711,7 +20885,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
20711
20885
|
if (codeNames.length === 0) return;
|
|
20712
20886
|
void (async () => {
|
|
20713
20887
|
try {
|
|
20714
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
20888
|
+
const { collectDiagnostics } = await import("../persistent-session-RGMMUKVK.js");
|
|
20715
20889
|
await api.post("/host/heartbeat", {
|
|
20716
20890
|
host_id: hostId,
|
|
20717
20891
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -20854,7 +21028,7 @@ async function pollCycleInner() {
|
|
|
20854
21028
|
}
|
|
20855
21029
|
try {
|
|
20856
21030
|
const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
|
|
20857
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
21031
|
+
const { collectDiagnostics } = await import("../persistent-session-RGMMUKVK.js");
|
|
20858
21032
|
const recordedSinceHeartbeat = new Set(spawnOutcomesSinceHeartbeat.drain());
|
|
20859
21033
|
const diagCodeNames = heartbeatDiagnosticsCodeNames(agentState.persistentSessionAgents, recordedSinceHeartbeat);
|
|
20860
21034
|
const heartbeatSpawnOutcomeFor = spawnOutcomeIfRecorded(spawnOutcomeForDiagnostics, recordedSinceHeartbeat);
|
|
@@ -21190,7 +21364,7 @@ async function pollCycleInner() {
|
|
|
21190
21364
|
collectPanelessActivityProbes,
|
|
21191
21365
|
getResponsivenessIntervalMs,
|
|
21192
21366
|
occupancyQualificationClassifications
|
|
21193
|
-
} = await import("../responsiveness-probe-
|
|
21367
|
+
} = await import("../responsiveness-probe-I7HNQGP4.js");
|
|
21194
21368
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
21195
21369
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
21196
21370
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -21307,7 +21481,7 @@ async function pollCycleInner() {
|
|
|
21307
21481
|
collectResponsivenessProbes,
|
|
21308
21482
|
livePendingInboundOldestAgeSeconds,
|
|
21309
21483
|
parkPendingInbound
|
|
21310
|
-
} = await import("../responsiveness-probe-
|
|
21484
|
+
} = await import("../responsiveness-probe-I7HNQGP4.js");
|
|
21311
21485
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-5PCBGRNY.js");
|
|
21312
21486
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
21313
21487
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -21593,7 +21767,7 @@ async function pollCycleInner() {
|
|
|
21593
21767
|
}
|
|
21594
21768
|
}
|
|
21595
21769
|
);
|
|
21596
|
-
const { parkPendingInbound } = await import("../responsiveness-probe-
|
|
21770
|
+
const { parkPendingInbound } = await import("../responsiveness-probe-I7HNQGP4.js");
|
|
21597
21771
|
const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
|
|
21598
21772
|
paneFatalStreak.delete(codeName);
|
|
21599
21773
|
paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
|
|
@@ -21624,7 +21798,7 @@ async function pollCycleInner() {
|
|
|
21624
21798
|
TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
|
|
21625
21799
|
bindSourceEscalations
|
|
21626
21800
|
} = await import("../transcript-mount-health-OHE6IVJV.js");
|
|
21627
|
-
const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-
|
|
21801
|
+
const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-RGMMUKVK.js");
|
|
21628
21802
|
const mountConfig = resolveTranscriptMountConfig();
|
|
21629
21803
|
const liveAgents = agentState.persistentSessionAgents;
|
|
21630
21804
|
for (const tracked of [
|
|
@@ -21789,7 +21963,7 @@ async function pollCycleInner() {
|
|
|
21789
21963
|
}
|
|
21790
21964
|
try {
|
|
21791
21965
|
const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
|
|
21792
|
-
const { probeSessionAuth } = await import("../session-auth-dead-
|
|
21966
|
+
const { probeSessionAuth } = await import("../session-auth-dead-JVDVNJR3.js");
|
|
21793
21967
|
const observations = [];
|
|
21794
21968
|
const pendingCacheCommits = [];
|
|
21795
21969
|
const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
|
|
@@ -26291,6 +26465,27 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash21("sha256")
|
|
|
26291
26465
|
log(`[persistent-session] Failed to forward zombie audit event for '${codeName}': ${err.message}`);
|
|
26292
26466
|
});
|
|
26293
26467
|
}
|
|
26468
|
+
const unexpectedExit = takeUnexpectedExit(codeName);
|
|
26469
|
+
const unexpectedExitAt = unexpectedExit?.at ?? null;
|
|
26470
|
+
const noticedAt = zombie?.kind === "zombie" ? zombie.detectedAt : unexpectedExitAt;
|
|
26471
|
+
if (noticedAt !== null && effectiveIsolationMode(codeName) === "docker") {
|
|
26472
|
+
const launchedAtMs = zombie?.kind === "zombie" ? launchStartMs(getSessionState(codeName)) : unexpectedExit?.launchedAtMs ?? null;
|
|
26473
|
+
const death = readContainerDeath(codeName, noticedAt, launchedAtMs);
|
|
26474
|
+
if (death) {
|
|
26475
|
+
const { source, reason } = describeContainerDeath(death, null);
|
|
26476
|
+
log(
|
|
26477
|
+
`[persistent-session] '${codeName}': container death recorded as ${source} (exit=${death.exitCode ?? "unknown"} oom=${death.oom} at=${death.at ?? "unknown"})`
|
|
26478
|
+
);
|
|
26479
|
+
void api.post("/host/restart-event", {
|
|
26480
|
+
agent_id: agent.agent_id,
|
|
26481
|
+
source,
|
|
26482
|
+
reason,
|
|
26483
|
+
detail: { exit_code: death.exitCode, oom: death.oom, died_at: death.at, detected_at: new Date(noticedAt).toISOString() }
|
|
26484
|
+
}).catch((err) => log(`[persistent-session] Failed to report the container death for '${codeName}': ${err.message}`));
|
|
26485
|
+
} else {
|
|
26486
|
+
log(`[persistent-session] '${codeName}': container gone, but Docker's event log gave no die/oom event for it (cause unknown)`);
|
|
26487
|
+
}
|
|
26488
|
+
}
|
|
26294
26489
|
try {
|
|
26295
26490
|
provisionStopHook(codeName);
|
|
26296
26491
|
} catch (err) {
|
|
@@ -26900,7 +27095,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
26900
27095
|
if (!refreshData) return;
|
|
26901
27096
|
const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
|
|
26902
27097
|
const hostId = await getHostId();
|
|
26903
|
-
const parkForRestart = await import("../responsiveness-probe-
|
|
27098
|
+
const parkForRestart = await import("../responsiveness-probe-I7HNQGP4.js").then(
|
|
26904
27099
|
(m) => m.parkPendingInbound,
|
|
26905
27100
|
(err) => err
|
|
26906
27101
|
);
|
|
@@ -26977,7 +27172,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
26977
27172
|
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}`));
|
|
26978
27173
|
void (async () => {
|
|
26979
27174
|
try {
|
|
26980
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
27175
|
+
const { collectDiagnostics } = await import("../persistent-session-RGMMUKVK.js");
|
|
26981
27176
|
await api.post("/host/heartbeat", {
|
|
26982
27177
|
host_id: hostId,
|
|
26983
27178
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -27030,7 +27225,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
27030
27225
|
}
|
|
27031
27226
|
try {
|
|
27032
27227
|
const hostId = await getHostId();
|
|
27033
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
27228
|
+
const { collectDiagnostics } = await import("../persistent-session-RGMMUKVK.js");
|
|
27034
27229
|
await api.post("/host/heartbeat", {
|
|
27035
27230
|
host_id: hostId,
|
|
27036
27231
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -27909,7 +28104,7 @@ async function processClaudePairSessions(agents) {
|
|
|
27909
28104
|
snapshotPairConfig,
|
|
27910
28105
|
// ENG-11659: result -> report body + the manager.log line that records it.
|
|
27911
28106
|
planPairStartReport
|
|
27912
|
-
} = await import("../claude-pair-runtime-
|
|
28107
|
+
} = await import("../claude-pair-runtime-43E2YV2S.js");
|
|
27913
28108
|
const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
|
|
27914
28109
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
27915
28110
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|