@integrity-labs/agt-cli 0.28.591 → 0.28.593

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-D4NE7KEU.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-JLTLTQHQ.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-673RQWL5.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-PBFR6UGJ.js.map
@@ -53,7 +53,7 @@ import {
53
53
  safeWriteJsonAtomic,
54
54
  setConfigHash,
55
55
  tripClass
56
- } from "../chunk-KR4AZ4EF.js";
56
+ } from "../chunk-BYCE4V7Q.js";
57
57
  import {
58
58
  getProjectDir as getProjectDir2,
59
59
  getReadyTasks,
@@ -102,6 +102,7 @@ import {
102
102
  execFilePromiseLong,
103
103
  extractFrontmatter,
104
104
  extractQualifyingTurns,
105
+ findRunMarker,
105
106
  forcedUpdatePendingForMs,
106
107
  formatActorId,
107
108
  formatCursorAdvanceShortfall,
@@ -183,7 +184,7 @@ import {
183
184
  toOpencodeModel,
184
185
  transcriptActivityAgeSeconds,
185
186
  writeEgressAllowlist
186
- } from "../chunk-QDJEEGZB.js";
187
+ } from "../chunk-TKWDYMM3.js";
187
188
  import {
188
189
  reapOrphanChannelMcps
189
190
  } from "../chunk-XWVM4KPK.js";
@@ -3877,9 +3878,10 @@ function enumerateSessionTranscripts(transcriptDir, sessionId, projectsRoot) {
3877
3878
  }
3878
3879
  return files;
3879
3880
  }
3880
- function scanLines(lines, file, opts) {
3881
+ function scanLines(lines, file, opts, initialRunId = null) {
3881
3882
  const pending2 = /* @__PURE__ */ new Map();
3882
3883
  const ordered = [];
3884
+ let currentRunId = initialRunId;
3883
3885
  for (const [lineOffset, rawLine, byteStart] of lines) {
3884
3886
  const trimmed = rawLine.trim();
3885
3887
  if (trimmed.length === 0) continue;
@@ -3891,6 +3893,10 @@ function scanLines(lines, file, opts) {
3891
3893
  }
3892
3894
  if (typeof record !== "object" || record === null) continue;
3893
3895
  const message = record.message;
3896
+ if (record.type === "user" && !file.isSubagent && message && typeof message === "object") {
3897
+ const marked = findRunMarker(message.content);
3898
+ if (marked) currentRunId = marked;
3899
+ }
3894
3900
  const blocks = message && typeof message === "object" && Array.isArray(message.content) ? message.content : null;
3895
3901
  if (!blocks) continue;
3896
3902
  for (const raw of blocks) {
@@ -3931,6 +3937,7 @@ function scanLines(lines, file, opts) {
3931
3937
  subagent_id: file.isSubagent ? typeof record.agentId === "string" && record.agentId ? record.agentId : file.subagentId : null,
3932
3938
  is_error: null,
3933
3939
  // resolved on pairing below
3940
+ run_id: currentRunId,
3934
3941
  input_sha256: hashToolInput(block.input),
3935
3942
  redacted_target: target,
3936
3943
  redacted_target_kind: kind,
@@ -3955,7 +3962,7 @@ function scanLines(lines, file, opts) {
3955
3962
  }
3956
3963
  }
3957
3964
  }
3958
- return { records: ordered, pending: pending2 };
3965
+ return { records: ordered, pending: pending2, endRunId: currentRunId };
3959
3966
  }
3960
3967
  var WINDOW_CHUNK_BYTES = 64 * 1024;
3961
3968
  var WINDOW_BUDGET_BYTES = 4 * 1024 * 1024;
@@ -3971,6 +3978,10 @@ function extractTranscriptWindow(file, opts, from) {
3971
3978
  unpaired: [],
3972
3979
  missing: true,
3973
3980
  rewound: false,
3981
+ // Unread, so nothing was learned and nothing may be revised: hand the
3982
+ // caller's own scope back rather than reporting null, which would read as
3983
+ // "the scope ended" and un-attribute the next window's calls.
3984
+ endRunScopeId: from.runScopeId ?? null,
3974
3985
  truncated: false
3975
3986
  };
3976
3987
  }
@@ -4031,11 +4042,13 @@ function extractTranscriptWindow(file, opts, from) {
4031
4042
  } catch {
4032
4043
  }
4033
4044
  }
4034
- const { records, pending: pending2 } = scanLines(pairs, file, opts);
4045
+ const carriedScope = rewound ? null : from.runScopeId ?? null;
4046
+ const { records, pending: pending2, endRunId } = scanLines(pairs, file, opts, carriedScope);
4035
4047
  const unpaired = [...pending2.values()].map((p) => ({
4036
4048
  toolUseId: p.record.tool_use_id,
4037
4049
  byteStart: p.byteStart,
4038
- lineOffset: p.record.line_offset
4050
+ lineOffset: p.record.line_offset,
4051
+ runScopeId: p.record.run_id
4039
4052
  })).sort((a, b) => a.byteStart - b.byteStart);
4040
4053
  const truncated = hitBudget && (fileSize === null || runningByte < fileSize);
4041
4054
  return {
@@ -4045,6 +4058,7 @@ function extractTranscriptWindow(file, opts, from) {
4045
4058
  unpaired,
4046
4059
  missing: false,
4047
4060
  rewound,
4061
+ endRunScopeId: endRunId,
4048
4062
  truncated
4049
4063
  };
4050
4064
  }
@@ -4142,6 +4156,11 @@ function loadCursors(path) {
4142
4156
  rewindGeneration: typeof v.rewindGeneration === "number" ? v.rewindGeneration : 0,
4143
4157
  lastWindowTruncated: v.lastWindowTruncated === true,
4144
4158
  callsExtracted: typeof v.callsExtracted === "number" ? v.callsExtracted : 0,
4159
+ // A pre-ENG-8832 cursor has no scope. Null is the correct upgrade value
4160
+ // and not merely the convenient one: the host genuinely does not know
4161
+ // which run was in scope, and inventing one would put a fabricated
4162
+ // attribution on the first rows written after every host upgrade.
4163
+ runScopeId: typeof v.runScopeId === "string" && v.runScopeId ? v.runScopeId : null,
4145
4164
  unpairedSince: typeof v.unpairedSince === "string" ? v.unpairedSince : null,
4146
4165
  lastDisposition: COVERAGE_DISPOSITIONS.includes(v.lastDisposition) ? v.lastDisposition : "ok",
4147
4166
  lastScanAt: typeof v.lastScanAt === "string" ? v.lastScanAt : (/* @__PURE__ */ new Date(0)).toISOString(),
@@ -4174,7 +4193,14 @@ function nextCursor(args) {
4174
4193
  rewindGeneration: args.previous.rewindGeneration + 1,
4175
4194
  // The call this was waiting on lived in the old file. Holding its clock
4176
4195
  // would apply an unrelated deadline to the new one.
4177
- unpairedSince: null
4196
+ unpairedSince: null,
4197
+ // Same reasoning for the run scope (ENG-8832): the marker that opened it
4198
+ // was in a file that no longer exists. Re-derive from the new file's own
4199
+ // markers rather than stamping the head of a fresh transcript with a run
4200
+ // that ended somewhere unreadable. (The extractor already dropped it on
4201
+ // its side; this keeps the two from disagreeing on a HOLD, where the
4202
+ // window's value is discarded.)
4203
+ runScopeId: null
4178
4204
  } : args.previous;
4179
4205
  if (!mayAdvance(outcome)) {
4180
4206
  return {
@@ -4197,6 +4223,7 @@ function nextCursor(args) {
4197
4223
  ...covered(endByte, endLine),
4198
4224
  callsExtracted,
4199
4225
  unpairedSince: null,
4226
+ runScopeId: args.endRunScopeId ?? null,
4200
4227
  lastDisposition: disposition,
4201
4228
  lastScanAt: nowIso,
4202
4229
  lastWindowTruncated: truncated
@@ -4212,6 +4239,7 @@ function nextCursor(args) {
4212
4239
  ...covered(endByte, endLine),
4213
4240
  callsExtracted,
4214
4241
  unpairedSince: null,
4242
+ runScopeId: args.endRunScopeId ?? null,
4215
4243
  lastDisposition: disposition,
4216
4244
  lastScanAt: nowIso,
4217
4245
  lastWindowTruncated: truncated
@@ -4230,6 +4258,12 @@ function nextCursor(args) {
4230
4258
  ...covered(resumeByte, resumeLine),
4231
4259
  callsExtracted,
4232
4260
  unpairedSince: since,
4261
+ // The scope AT THE UNPAIRED CALL, not at the end of the window (ENG-8832).
4262
+ // This is the one branch where the two can differ and it matters: the
4263
+ // unpaired call was deliberately not sent, so no stored row protects it, and
4264
+ // a marker between it and the window's end would otherwise file it under the
4265
+ // NEXT run when the re-read attributes it.
4266
+ runScopeId: earliestUnpaired.runScopeId ?? null,
4233
4267
  lastDisposition: disposition,
4234
4268
  lastScanAt: nowIso,
4235
4269
  lastWindowTruncated: truncated
@@ -4247,6 +4281,9 @@ function initialCursor(args) {
4247
4281
  rewindGeneration: 0,
4248
4282
  lastWindowTruncated: false,
4249
4283
  callsExtracted: 0,
4284
+ // No marker has been seen (ENG-8832). On the scan-from-now path the prefix
4285
+ // that held one was never read, so "not determined" is the literal truth.
4286
+ runScopeId: null,
4250
4287
  unpairedSince: null,
4251
4288
  lastDisposition: "ok",
4252
4289
  lastScanAt: iso,
@@ -4363,6 +4400,10 @@ async function scanAgentToolCalls(args) {
4363
4400
  const window = extractTranscriptWindow(file, extractOpts, {
4364
4401
  byteOffset: cursor.byteOffset,
4365
4402
  lineOffset: cursor.lineOffset,
4403
+ // ENG-8832: carry the run scope across ticks. A marker arrives once, at
4404
+ // the head of its run; without this every window after the first would
4405
+ // report NULL and the attribution would silently evaporate.
4406
+ runScopeId: cursor.runScopeId,
4366
4407
  ...args.windowBudgetBytes === void 0 ? {} : { budgetBytes: args.windowBudgetBytes }
4367
4408
  });
4368
4409
  summary.filesScanned += 1;
@@ -4399,6 +4440,7 @@ async function scanAgentToolCalls(args) {
4399
4440
  endByte: window.endByte,
4400
4441
  endLine: window.endLine,
4401
4442
  earliestUnpaired: window.unpaired[0] ?? null,
4443
+ endRunScopeId: window.endRunScopeId,
4402
4444
  outcome,
4403
4445
  callsExtracted: sendable.length,
4404
4446
  nowMs: now(),
@@ -11642,7 +11684,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
11642
11684
  var lastVersionCheckAt = 0;
11643
11685
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
11644
11686
  var lastResponsivenessProbeAt = 0;
11645
- var agtCliVersion = true ? "0.28.591" : "dev";
11687
+ var agtCliVersion = true ? "0.28.593" : "dev";
11646
11688
  function resolveBrewPath(execFileSync2) {
11647
11689
  try {
11648
11690
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -12949,7 +12991,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
12949
12991
  if (codeNames.length === 0) return;
12950
12992
  void (async () => {
12951
12993
  try {
12952
- const { collectDiagnostics } = await import("../persistent-session-D4NE7KEU.js");
12994
+ const { collectDiagnostics } = await import("../persistent-session-JLTLTQHQ.js");
12953
12995
  await api.post("/host/heartbeat", {
12954
12996
  host_id: hostId,
12955
12997
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics)
@@ -13057,7 +13099,7 @@ async function pollCycle() {
13057
13099
  }
13058
13100
  try {
13059
13101
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
13060
- const { collectDiagnostics } = await import("../persistent-session-D4NE7KEU.js");
13102
+ const { collectDiagnostics } = await import("../persistent-session-JLTLTQHQ.js");
13061
13103
  const diagCodeNames = [...agentState.persistentSessionAgents];
13062
13104
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics) : void 0;
13063
13105
  let tailscaleHostname;
@@ -13180,7 +13222,7 @@ async function pollCycle() {
13180
13222
  collectPanelessActivityProbes,
13181
13223
  getResponsivenessIntervalMs,
13182
13224
  occupancyQualificationClassifications
13183
- } = await import("../responsiveness-probe-5JWPNTA7.js");
13225
+ } = await import("../responsiveness-probe-4GJUK5GG.js");
13184
13226
  const probeIntervalMs = getResponsivenessIntervalMs();
13185
13227
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
13186
13228
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -13271,7 +13313,7 @@ async function pollCycle() {
13271
13313
  collectResponsivenessProbes,
13272
13314
  livePendingInboundOldestAgeSeconds,
13273
13315
  parkPendingInbound
13274
- } = await import("../responsiveness-probe-5JWPNTA7.js");
13316
+ } = await import("../responsiveness-probe-4GJUK5GG.js");
13275
13317
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
13276
13318
  const wedgeNow = /* @__PURE__ */ new Date();
13277
13319
  const liveAgents = agentState.persistentSessionAgents;
@@ -16842,7 +16884,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
16842
16884
  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}`));
16843
16885
  void (async () => {
16844
16886
  try {
16845
- const { collectDiagnostics } = await import("../persistent-session-D4NE7KEU.js");
16887
+ const { collectDiagnostics } = await import("../persistent-session-JLTLTQHQ.js");
16846
16888
  await api.post("/host/heartbeat", {
16847
16889
  host_id: hostId,
16848
16890
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics)
@@ -16893,7 +16935,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
16893
16935
  }
16894
16936
  try {
16895
16937
  const hostId = await getHostId();
16896
- const { collectDiagnostics } = await import("../persistent-session-D4NE7KEU.js");
16938
+ const { collectDiagnostics } = await import("../persistent-session-JLTLTQHQ.js");
16897
16939
  await api.post("/host/heartbeat", {
16898
16940
  host_id: hostId,
16899
16941
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics)
@@ -17471,7 +17513,7 @@ async function processClaudePairSessions(agents) {
17471
17513
  killPairSession,
17472
17514
  pairTmuxSession,
17473
17515
  finalizeClaudePairOnboarding
17474
- } = await import("../claude-pair-runtime-673RQWL5.js");
17516
+ } = await import("../claude-pair-runtime-PBFR6UGJ.js");
17475
17517
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
17476
17518
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
17477
17519
  const killed = await killPairSession(pairTmuxSession(pairId));