@integrity-labs/agt-cli 0.28.532 → 0.28.534

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.
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
100
100
  return { ok: true };
101
101
  } catch {
102
102
  }
103
- const { resolveClaudeBinary } = await import("./persistent-session-KO2FPI6V.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-D2JEPOKD.js");
104
104
  const claudeBin = resolveClaudeBinary();
105
105
  const pairEnv = {
106
106
  ...process.env,
@@ -373,4 +373,4 @@ export {
373
373
  startClaudePair,
374
374
  submitClaudePairCode
375
375
  };
376
- //# sourceMappingURL=claude-pair-runtime-KMLPAKYF.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-ND4BTXAM.js.map
@@ -53,7 +53,7 @@ import {
53
53
  safeWriteJsonAtomic,
54
54
  setConfigHash,
55
55
  tripClass
56
- } from "../chunk-DVLIHMM7.js";
56
+ } from "../chunk-B6YWCYPP.js";
57
57
  import {
58
58
  getProjectDir as getProjectDir2,
59
59
  getReadyTasks,
@@ -180,7 +180,7 @@ import {
180
180
  toOpencodeModel,
181
181
  transcriptActivityAgeSeconds,
182
182
  writeEgressAllowlist
183
- } from "../chunk-3FCJXTHW.js";
183
+ } from "../chunk-TPJ57PWU.js";
184
184
  import {
185
185
  reapOrphanChannelMcps
186
186
  } from "../chunk-XWVM4KPK.js";
@@ -6137,7 +6137,7 @@ function readAlignedTail(path, tailBytes, maxAlignBytes) {
6137
6137
  let fd = null;
6138
6138
  try {
6139
6139
  const size = statSync5(path).size;
6140
- if (size <= 0) return { content: "", complete: true };
6140
+ if (size <= 0) return { content: "", complete: true, truncated: false };
6141
6141
  fd = openSync(path, "r");
6142
6142
  let readStart = Math.max(0, size - tailBytes);
6143
6143
  if (readStart > 0) {
@@ -6162,13 +6162,13 @@ function readAlignedTail(path, tailBytes, maxAlignBytes) {
6162
6162
  } else if (scanFloor === 0) {
6163
6163
  readStart = 0;
6164
6164
  } else {
6165
- return { content: "", complete: false };
6165
+ return { content: "", complete: false, truncated: true };
6166
6166
  }
6167
6167
  }
6168
6168
  const len = size - readStart;
6169
6169
  const buf = Buffer.allocUnsafe(len);
6170
6170
  if (readSync(fd, buf, 0, len, readStart) !== len) return null;
6171
- return { content: buf.toString("utf-8", 0, len), complete: true };
6171
+ return { content: buf.toString("utf-8", 0, len), complete: true, truncated: readStart > 0 };
6172
6172
  } catch {
6173
6173
  return null;
6174
6174
  } finally {
@@ -6184,6 +6184,24 @@ function isAbsentDirError(err) {
6184
6184
  const code = err.code;
6185
6185
  return code === "ENOENT" || code === "ENOTDIR";
6186
6186
  }
6187
+ function earliestCoveredMs(content) {
6188
+ for (const line of content.split("\n")) {
6189
+ const trimmed = line.trim();
6190
+ if (trimmed.length === 0) continue;
6191
+ let record;
6192
+ try {
6193
+ record = JSON.parse(trimmed);
6194
+ } catch {
6195
+ continue;
6196
+ }
6197
+ if (typeof record !== "object" || record === null) continue;
6198
+ const ts = record.timestamp;
6199
+ if (typeof ts !== "string") continue;
6200
+ const ms = Date.parse(ts);
6201
+ if (Number.isFinite(ms)) return ms;
6202
+ }
6203
+ return null;
6204
+ }
6187
6205
  function candidateTranscriptPaths(dir) {
6188
6206
  const paths = [];
6189
6207
  let top;
@@ -6221,6 +6239,10 @@ function collectQualifyingTurns(codeName, nowMs, opts = {}) {
6221
6239
  const nextCache = /* @__PURE__ */ new Map();
6222
6240
  const all = /* @__PURE__ */ new Set();
6223
6241
  let transcriptsRead = 0;
6242
+ let coveredFromMs = Number.NEGATIVE_INFINITY;
6243
+ const raiseCoverageFloor = (floor) => {
6244
+ if (floor != null && floor > coveredFromMs) coveredFromMs = floor;
6245
+ };
6224
6246
  const { paths, complete: scanComplete } = candidateTranscriptPaths(dir);
6225
6247
  let complete = scanComplete;
6226
6248
  for (const path of paths) {
@@ -6238,6 +6260,7 @@ function collectQualifyingTurns(codeName, nowMs, opts = {}) {
6238
6260
  transcriptsRead += 1;
6239
6261
  nextCache.set(path, seen);
6240
6262
  for (const t of seen.turns) all.add(t);
6263
+ raiseCoverageFloor(seen.coverageFloorMs);
6241
6264
  continue;
6242
6265
  }
6243
6266
  const aligned = readAlignedTail(path, tailBytes, maxAlignBytes);
@@ -6250,13 +6273,19 @@ function collectQualifyingTurns(codeName, nowMs, opts = {}) {
6250
6273
  continue;
6251
6274
  }
6252
6275
  const content = aligned.content;
6276
+ const parsedFloorMs = aligned.truncated ? earliestCoveredMs(content) : null;
6277
+ const floorUnknown = aligned.truncated && parsedFloorMs === null;
6278
+ const coverageFloorMs = aligned.truncated ? parsedFloorMs ?? nowMs : null;
6279
+ raiseCoverageFloor(coverageFloorMs);
6253
6280
  transcriptsRead += 1;
6254
6281
  const turns = extractQualifyingTurns(content, { startMs: sinceMs });
6255
- nextCache.set(path, { mtimeMs: st.mtimeMs, size: st.size, turns });
6282
+ if (!floorUnknown) {
6283
+ nextCache.set(path, { mtimeMs: st.mtimeMs, size: st.size, turns, coverageFloorMs });
6284
+ }
6256
6285
  for (const t of turns) all.add(t);
6257
6286
  }
6258
6287
  cache.set(codeName, nextCache);
6259
- return { turns: [...all].sort((a, b) => a - b), transcriptsRead, complete };
6288
+ return { turns: [...all].sort((a, b) => a - b), transcriptsRead, complete, coveredFromMs };
6260
6289
  }
6261
6290
  function qualifyBuckets(buckets, qualifying, mode, nowMs, neighbourhoodMs = DEFAULT_NEIGHBOURHOOD_MS) {
6262
6291
  const failOpen = !qualifying.complete;
@@ -6264,6 +6293,7 @@ function qualifyBuckets(buckets, qualifying, mode, nowMs, neighbourhoodMs = DEFA
6264
6293
  let qualified = 0;
6265
6294
  let unqualifiedDropped = 0;
6266
6295
  let unreadable = 0;
6296
+ let coverageShortfall = 0;
6267
6297
  for (const b of buckets) {
6268
6298
  const startMs = Date.parse(b.bucket);
6269
6299
  const parsed = Number.isFinite(startMs);
@@ -6276,12 +6306,17 @@ function qualifyBuckets(buckets, qualifying, mode, nowMs, neighbourhoodMs = DEFA
6276
6306
  if (isBucketQualified(startMs, qualifying.turns, neighbourhoodMs)) {
6277
6307
  qualified += 1;
6278
6308
  kept.push(b);
6279
- } else {
6280
- unqualifiedDropped += 1;
6281
- if (mode === "shadow") kept.push(b);
6309
+ continue;
6310
+ }
6311
+ if (startMs - neighbourhoodMs < qualifying.coveredFromMs) {
6312
+ coverageShortfall += 1;
6313
+ kept.push(b);
6314
+ continue;
6282
6315
  }
6316
+ unqualifiedDropped += 1;
6317
+ if (mode === "shadow") kept.push(b);
6283
6318
  }
6284
- return { kept, qualified, unqualifiedDropped, unreadable };
6319
+ return { kept, qualified, unqualifiedDropped, unreadable, coverageShortfall };
6285
6320
  }
6286
6321
 
6287
6322
  // src/lib/pane-occupancy-sampler.ts
@@ -10334,7 +10369,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
10334
10369
  var lastVersionCheckAt = 0;
10335
10370
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
10336
10371
  var lastResponsivenessProbeAt = 0;
10337
- var agtCliVersion = true ? "0.28.532" : "dev";
10372
+ var agtCliVersion = true ? "0.28.534" : "dev";
10338
10373
  function resolveBrewPath(execFileSync2) {
10339
10374
  try {
10340
10375
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -11545,7 +11580,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
11545
11580
  if (codeNames.length === 0) return;
11546
11581
  void (async () => {
11547
11582
  try {
11548
- const { collectDiagnostics } = await import("../persistent-session-KO2FPI6V.js");
11583
+ const { collectDiagnostics } = await import("../persistent-session-D2JEPOKD.js");
11549
11584
  await api.post("/host/heartbeat", {
11550
11585
  host_id: hostId,
11551
11586
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor)
@@ -11652,7 +11687,7 @@ async function pollCycle() {
11652
11687
  }
11653
11688
  try {
11654
11689
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
11655
- const { collectDiagnostics } = await import("../persistent-session-KO2FPI6V.js");
11690
+ const { collectDiagnostics } = await import("../persistent-session-D2JEPOKD.js");
11656
11691
  const diagCodeNames = [...agentState.persistentSessionAgents];
11657
11692
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor) : void 0;
11658
11693
  let tailscaleHostname;
@@ -11768,7 +11803,7 @@ async function pollCycle() {
11768
11803
  collectPanelessActivityProbes,
11769
11804
  getResponsivenessIntervalMs,
11770
11805
  occupancyQualificationClassifications
11771
- } = await import("../responsiveness-probe-DQCG2MB6.js");
11806
+ } = await import("../responsiveness-probe-4LVECRWX.js");
11772
11807
  const probeIntervalMs = getResponsivenessIntervalMs();
11773
11808
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
11774
11809
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -11797,7 +11832,13 @@ async function pollCycle() {
11797
11832
  log(
11798
11833
  `[occupancy-gate] qualification failed for '${codeName}' \u2014 reporting ${raw.length} bucket(s) ungated: ${err.message}`
11799
11834
  );
11800
- q = { kept: raw, qualified: 0, unqualifiedDropped: 0, unreadable: raw.length };
11835
+ q = {
11836
+ kept: raw,
11837
+ qualified: 0,
11838
+ unqualifiedDropped: 0,
11839
+ unreadable: raw.length,
11840
+ coverageShortfall: 0
11841
+ };
11801
11842
  }
11802
11843
  if (q.kept.length > 0) drainedBuckets.set(codeName, q.kept);
11803
11844
  return {
@@ -11853,7 +11894,7 @@ async function pollCycle() {
11853
11894
  collectResponsivenessProbes,
11854
11895
  livePendingInboundOldestAgeSeconds,
11855
11896
  parkPendingInbound
11856
- } = await import("../responsiveness-probe-DQCG2MB6.js");
11897
+ } = await import("../responsiveness-probe-4LVECRWX.js");
11857
11898
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
11858
11899
  const wedgeNow = /* @__PURE__ */ new Date();
11859
11900
  const liveAgents = agentState.persistentSessionAgents;
@@ -15383,7 +15424,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
15383
15424
  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}`));
15384
15425
  void (async () => {
15385
15426
  try {
15386
- const { collectDiagnostics } = await import("../persistent-session-KO2FPI6V.js");
15427
+ const { collectDiagnostics } = await import("../persistent-session-D2JEPOKD.js");
15387
15428
  await api.post("/host/heartbeat", {
15388
15429
  host_id: hostId,
15389
15430
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor)
@@ -15433,7 +15474,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
15433
15474
  }
15434
15475
  try {
15435
15476
  const hostId = await getHostId();
15436
- const { collectDiagnostics } = await import("../persistent-session-KO2FPI6V.js");
15477
+ const { collectDiagnostics } = await import("../persistent-session-D2JEPOKD.js");
15437
15478
  await api.post("/host/heartbeat", {
15438
15479
  host_id: hostId,
15439
15480
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor)
@@ -15957,7 +15998,7 @@ async function processClaudePairSessions(agents) {
15957
15998
  killPairSession,
15958
15999
  pairTmuxSession,
15959
16000
  finalizeClaudePairOnboarding
15960
- } = await import("../claude-pair-runtime-KMLPAKYF.js");
16001
+ } = await import("../claude-pair-runtime-ND4BTXAM.js");
15961
16002
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
15962
16003
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
15963
16004
  const killed = await killPairSession(pairTmuxSession(pairId));