@integrity-labs/agt-cli 0.28.187 → 0.28.188

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.
@@ -16,7 +16,7 @@ import {
16
16
  resolveConnectivityProbe,
17
17
  worseConnectivityOutcome,
18
18
  wrapScheduledTaskPrompt
19
- } from "./chunk-ERHHYBVS.js";
19
+ } from "./chunk-C7VSGFDC.js";
20
20
 
21
21
  // ../../packages/core/dist/provisioning/mcp-config-guards.js
22
22
  import { chmodSync, existsSync, readFileSync, renameSync, writeFileSync, unlinkSync } from "fs";
@@ -6120,7 +6120,7 @@ function requireHost() {
6120
6120
  }
6121
6121
 
6122
6122
  // src/lib/api-client.ts
6123
- var agtCliVersion = true ? "0.28.187" : "dev";
6123
+ var agtCliVersion = true ? "0.28.188" : "dev";
6124
6124
  var lastConfigHash = null;
6125
6125
  function setConfigHash(hash) {
6126
6126
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7425,4 +7425,4 @@ export {
7425
7425
  managerInstallSystemUnitCommand,
7426
7426
  managerUninstallSystemUnitCommand
7427
7427
  };
7428
- //# sourceMappingURL=chunk-MK42LWDV.js.map
7428
+ //# sourceMappingURL=chunk-LRUP3ZIO.js.map
@@ -3,7 +3,7 @@ import {
3
3
  formatMissingVar,
4
4
  isClaudeFastMode,
5
5
  probeMcpEnvSubstitution
6
- } from "./chunk-ERHHYBVS.js";
6
+ } from "./chunk-C7VSGFDC.js";
7
7
  import {
8
8
  reapOrphanChannelMcps
9
9
  } from "./chunk-XWVM4KPK.js";
@@ -1588,4 +1588,4 @@ export {
1588
1588
  stopAllSessionsAndWait,
1589
1589
  getProjectDir
1590
1590
  };
1591
- //# sourceMappingURL=chunk-ORO4YLTN.js.map
1591
+ //# sourceMappingURL=chunk-SJ3TWGEN.js.map
@@ -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-SNLNY2VB.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-HXTMZX67.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-VBTV4KZO.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-NOZN3WKM.js.map
@@ -28,7 +28,7 @@ import {
28
28
  requireHost,
29
29
  safeWriteJsonAtomic,
30
30
  setConfigHash
31
- } from "../chunk-MK42LWDV.js";
31
+ } from "../chunk-LRUP3ZIO.js";
32
32
  import {
33
33
  getProjectDir as getProjectDir2,
34
34
  getReadyTasks,
@@ -70,7 +70,7 @@ import {
70
70
  takeZombieDetection,
71
71
  transcriptActivityAgeSeconds,
72
72
  writeEgressAllowlist
73
- } from "../chunk-ORO4YLTN.js";
73
+ } from "../chunk-SJ3TWGEN.js";
74
74
  import {
75
75
  CONVERSATION_FAILURE_CATEGORIES,
76
76
  DEFAULT_FRAMEWORK,
@@ -92,12 +92,14 @@ import {
92
92
  formatActorId,
93
93
  formatRunMarker,
94
94
  getFramework,
95
+ isBareAck,
95
96
  isConversationFailureCategory,
96
97
  isEmptyTotals,
97
98
  isOnboardingArea,
98
99
  isParseError,
99
100
  isResolveError,
100
101
  isSelfCompletion,
102
+ isSystemInjectedContent,
101
103
  isUnsetTimezone,
102
104
  isVacuousDeliverReason,
103
105
  laneTagFragment,
@@ -111,7 +113,7 @@ import {
111
113
  resolveChannels,
112
114
  resolveDmTarget,
113
115
  sumTranscriptUsageInWindow
114
- } from "../chunk-ERHHYBVS.js";
116
+ } from "../chunk-C7VSGFDC.js";
115
117
  import {
116
118
  parsePsRows,
117
119
  reapOrphanChannelMcps
@@ -2295,7 +2297,7 @@ async function maybeReconcileWorkflowRunTokens(args) {
2295
2297
  import { readdirSync as readdirSync3, readFileSync as readFileSync8, statSync as statSync3 } from "fs";
2296
2298
  import { join as join7 } from "path";
2297
2299
  var MIN_CHECK_INTERVAL_MS4 = 5 * 6e4;
2298
- var TRANSCRIPT_MTIME_WINDOW_MS3 = 3 * 24 * 60 * 60 * 1e3;
2300
+ var TRANSCRIPT_MTIME_WINDOW_MS3 = 7 * 24 * 60 * 60 * 1e3;
2299
2301
  var WINDOW_PAD_MS = 5 * 6e4;
2300
2302
  var MAX_TURN_CHARS = 1500;
2301
2303
  var MAX_TRANSCRIPT_CHARS = 6e3;
@@ -2423,6 +2425,12 @@ var state3 = /* @__PURE__ */ new Map();
2423
2425
  function channelRefTokens(channelRef) {
2424
2426
  return channelRef.split(":").slice(1).filter((p) => p && p !== "dm");
2425
2427
  }
2428
+ function channelRefRoutingTokens(channelRef) {
2429
+ const parts = channelRef.split(":").slice(1);
2430
+ const dmIdx = parts.indexOf("dm");
2431
+ const kept = dmIdx === -1 ? parts : parts.slice(0, dmIdx);
2432
+ return kept.filter((p) => p && p !== "dm");
2433
+ }
2426
2434
  function contentToText(content) {
2427
2435
  if (typeof content === "string") return content;
2428
2436
  if (Array.isArray(content)) {
@@ -2436,7 +2444,37 @@ function contentToText(content) {
2436
2444
  }
2437
2445
  return "";
2438
2446
  }
2439
- function parseTranscriptTurns(jsonl) {
2447
+ function safeStringify(value) {
2448
+ try {
2449
+ return JSON.stringify(value) ?? "";
2450
+ } catch {
2451
+ return "";
2452
+ }
2453
+ }
2454
+ function extractAssistantContent(content) {
2455
+ if (typeof content === "string") return { text: content.trim(), refs: "" };
2456
+ if (!Array.isArray(content)) return { text: "", refs: "" };
2457
+ const texts = [];
2458
+ const refParts = [];
2459
+ for (const b of content) {
2460
+ if (typeof b === "string") {
2461
+ if (b.trim()) texts.push(b.trim());
2462
+ continue;
2463
+ }
2464
+ if (!b || typeof b !== "object") continue;
2465
+ const block = b;
2466
+ if (block.type === "text" && typeof block.text === "string") {
2467
+ const t = block.text.trim();
2468
+ if (t) texts.push(t);
2469
+ } else if (block.type === "tool_use" && block.input && typeof block.input === "object") {
2470
+ const { text: replyText, ...routing } = block.input;
2471
+ refParts.push(safeStringify(routing));
2472
+ if (typeof replyText === "string" && replyText.trim()) texts.push(replyText.trim());
2473
+ }
2474
+ }
2475
+ return { text: texts.join(" ").trim(), refs: refParts.join(" ").trim() };
2476
+ }
2477
+ function parseTranscriptTurns(jsonl, session) {
2440
2478
  const turns = [];
2441
2479
  for (const line of jsonl.split("\n")) {
2442
2480
  const trimmed = line.trim();
@@ -2449,33 +2487,59 @@ function parseTranscriptTurns(jsonl) {
2449
2487
  }
2450
2488
  const role = obj.type === "user" || obj.type === "assistant" ? obj.type : void 0;
2451
2489
  if (!role) continue;
2452
- const text = contentToText(obj.message?.content).trim();
2453
- if (!text) continue;
2454
2490
  const ts = obj.timestamp ? Date.parse(obj.timestamp) : NaN;
2455
- turns.push({ role, text, ts: Number.isFinite(ts) ? ts : 0 });
2491
+ if (!Number.isFinite(ts)) continue;
2492
+ if (role === "assistant") {
2493
+ const { text, refs } = extractAssistantContent(obj.message?.content);
2494
+ if (!text) continue;
2495
+ turns.push({ role, text, ts, ...refs ? { refs } : {}, ...session ? { session } : {} });
2496
+ } else {
2497
+ const text = contentToText(obj.message?.content).trim();
2498
+ if (!text) continue;
2499
+ turns.push({ role, text, ts, ...session ? { session } : {} });
2500
+ }
2456
2501
  }
2457
2502
  return turns;
2458
2503
  }
2459
2504
  function stripChannelTag(text) {
2460
2505
  return text.replace(/<channel\b[^>]*\/?>/i, "").replace(/<\/channel>/i, "").trim();
2461
2506
  }
2462
- function reconstructConversation(allTurns, tokens, windowStartMs, windowEndMs) {
2463
- if (tokens.length === 0) return [];
2507
+ function reconstructConversation(allTurns, channelRef, windowStartMs, windowEndMs) {
2508
+ const userTokens = channelRefTokens(channelRef);
2509
+ if (userTokens.length === 0) return [];
2510
+ const routingTokens = channelRefRoutingTokens(channelRef);
2464
2511
  const sorted = [...allTurns].sort((a, b) => a.ts - b.ts);
2465
2512
  const out = [];
2466
- let inConversation = false;
2513
+ let hasMatchedUser = false;
2514
+ let openUserSession = null;
2515
+ const hasAll = (haystack, toks) => toks.length > 0 && toks.every((t) => haystack.includes(t));
2467
2516
  for (const turn of sorted) {
2468
2517
  if (turn.ts && (turn.ts < windowStartMs || turn.ts > windowEndMs)) continue;
2469
2518
  if (turn.role === "user") {
2470
- inConversation = tokens.every((t) => turn.text.includes(t));
2471
- if (inConversation) {
2519
+ if (hasAll(turn.text, userTokens)) {
2520
+ hasMatchedUser = true;
2521
+ openUserSession = turn.session;
2472
2522
  out.push({ ...turn, text: stripChannelTag(turn.text) });
2523
+ } else if (turn.session === openUserSession) {
2524
+ openUserSession = null;
2473
2525
  }
2474
- } else if (inConversation) {
2526
+ } else if (turn.refs) {
2527
+ if (hasMatchedUser && hasAll(turn.refs, routingTokens)) out.push(turn);
2528
+ } else if (turn.session === openUserSession) {
2475
2529
  out.push(turn);
2476
2530
  }
2477
2531
  }
2478
- return out;
2532
+ return hasMatchedUser ? out : [];
2533
+ }
2534
+ function conversationExclusionReason(turns) {
2535
+ if (turns.some((t) => t.role === "user" && isSystemInjectedContent(t.text))) {
2536
+ return "synthetic_probe";
2537
+ }
2538
+ const assistant = turns.filter((t) => t.role === "assistant");
2539
+ if (assistant.length > 0 && assistant.every((t) => isBareAck(t.text))) {
2540
+ return "ack_only";
2541
+ }
2542
+ return null;
2479
2543
  }
2480
2544
  function renderTranscript(turns) {
2481
2545
  const lines = [];
@@ -2562,14 +2626,23 @@ async function maybeEvaluateConversations(args) {
2562
2626
  let backendSucceeded = false;
2563
2627
  let backendError = null;
2564
2628
  for (const conv of pending) {
2565
- const tokens = channelRefTokens(conv.channel_ref);
2566
2629
  const windowStart = Date.parse(conv.started_at) - WINDOW_PAD_MS;
2567
2630
  const windowEnd = Date.parse(conv.last_message_at) + WINDOW_PAD_MS;
2568
- const turns = reconstructConversation(allTurns, tokens, windowStart, windowEnd);
2631
+ const turns = reconstructConversation(allTurns, conv.channel_ref, windowStart, windowEnd);
2569
2632
  if (turns.length === 0) {
2570
2633
  await reportSkip(api2, agentId, conv.conversation_id, "not_reconstructable", log2, codeName);
2571
2634
  continue;
2572
2635
  }
2636
+ const exclusion = conversationExclusionReason(turns);
2637
+ if (exclusion) {
2638
+ await reportSkip(api2, agentId, conv.conversation_id, exclusion, log2, codeName);
2639
+ continue;
2640
+ }
2641
+ if (!turns.some((t) => t.role === "assistant")) {
2642
+ log2(
2643
+ `[conversation-eval] ${codeName}: ${conv.conversation_id.slice(0, 8)} reconstructed user-only (${turns.length} turn(s), 0 agent replies)`
2644
+ );
2645
+ }
2573
2646
  const transcript = renderTranscript(turns);
2574
2647
  if (!transcript.trim()) {
2575
2648
  await reportSkip(api2, agentId, conv.conversation_id, "empty_transcript", log2, codeName);
@@ -2644,31 +2717,38 @@ async function reportBackendHealth(api2, log2, codeName, health) {
2644
2717
  }
2645
2718
  }
2646
2719
  function readRecentTurns(dir, nowMs) {
2647
- let entries;
2648
- try {
2649
- entries = readdirSync3(dir);
2650
- } catch {
2651
- return [];
2652
- }
2653
2720
  const turns = [];
2654
- for (const name of entries) {
2655
- if (!name.endsWith(".jsonl")) continue;
2656
- const full = join7(dir, name);
2657
- let mtimeMs;
2721
+ const visit = (d) => {
2722
+ let entries;
2658
2723
  try {
2659
- mtimeMs = statSync3(full).mtimeMs;
2724
+ entries = readdirSync3(d, { withFileTypes: true });
2660
2725
  } catch {
2661
- continue;
2726
+ return;
2662
2727
  }
2663
- if (nowMs - mtimeMs > TRANSCRIPT_MTIME_WINDOW_MS3) continue;
2664
- let content;
2665
- try {
2666
- content = readFileSync8(full, "utf8");
2667
- } catch {
2668
- continue;
2728
+ for (const ent of entries) {
2729
+ const full = join7(d, ent.name);
2730
+ if (ent.isDirectory()) {
2731
+ visit(full);
2732
+ continue;
2733
+ }
2734
+ if (!ent.isFile() || !ent.name.endsWith(".jsonl")) continue;
2735
+ let mtimeMs;
2736
+ try {
2737
+ mtimeMs = statSync3(full).mtimeMs;
2738
+ } catch {
2739
+ continue;
2740
+ }
2741
+ if (nowMs - mtimeMs > TRANSCRIPT_MTIME_WINDOW_MS3) continue;
2742
+ let content;
2743
+ try {
2744
+ content = readFileSync8(full, "utf8");
2745
+ } catch {
2746
+ continue;
2747
+ }
2748
+ turns.push(...parseTranscriptTurns(content, ent.name));
2669
2749
  }
2670
- turns.push(...parseTranscriptTurns(content));
2671
- }
2750
+ };
2751
+ visit(dir);
2672
2752
  return turns;
2673
2753
  }
2674
2754
 
@@ -2772,10 +2852,9 @@ async function maybeExtractMemories(args) {
2772
2852
  return;
2773
2853
  }
2774
2854
  for (const conv of pending) {
2775
- const tokens = channelRefTokens(conv.channel_ref);
2776
2855
  const windowStart = Date.parse(conv.started_at) - WINDOW_PAD_MS2;
2777
2856
  const windowEnd = Date.parse(conv.last_message_at) + WINDOW_PAD_MS2;
2778
- const turns = reconstructConversation(allTurns, tokens, windowStart, windowEnd);
2857
+ const turns = reconstructConversation(allTurns, conv.channel_ref, windowStart, windowEnd);
2779
2858
  if (turns.length === 0) {
2780
2859
  await reportSkip2(api2, agentId, conv.conversation_id, log2, codeName);
2781
2860
  continue;
@@ -6602,7 +6681,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
6602
6681
  var lastVersionCheckAt = 0;
6603
6682
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
6604
6683
  var lastResponsivenessProbeAt = 0;
6605
- var agtCliVersion = true ? "0.28.187" : "dev";
6684
+ var agtCliVersion = true ? "0.28.188" : "dev";
6606
6685
  function resolveBrewPath(execFileSync4) {
6607
6686
  try {
6608
6687
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -7495,7 +7574,7 @@ async function pollCycle() {
7495
7574
  }
7496
7575
  try {
7497
7576
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
7498
- const { collectDiagnostics } = await import("../persistent-session-SNLNY2VB.js");
7577
+ const { collectDiagnostics } = await import("../persistent-session-HXTMZX67.js");
7499
7578
  const diagCodeNames = [...agentState.persistentSessionAgents];
7500
7579
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
7501
7580
  let tailscaleHostname;
@@ -7643,7 +7722,7 @@ async function pollCycle() {
7643
7722
  const {
7644
7723
  collectResponsivenessProbes,
7645
7724
  getResponsivenessIntervalMs
7646
- } = await import("../responsiveness-probe-6HC3PENG.js");
7725
+ } = await import("../responsiveness-probe-2OV5K45J.js");
7647
7726
  const probeIntervalMs = getResponsivenessIntervalMs();
7648
7727
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
7649
7728
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -7675,7 +7754,7 @@ async function pollCycle() {
7675
7754
  collectResponsivenessProbes,
7676
7755
  livePendingInboundOldestAgeSeconds,
7677
7756
  parkPendingInbound
7678
- } = await import("../responsiveness-probe-6HC3PENG.js");
7757
+ } = await import("../responsiveness-probe-2OV5K45J.js");
7679
7758
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
7680
7759
  const wedgeNow = /* @__PURE__ */ new Date();
7681
7760
  const liveAgents = agentState.persistentSessionAgents;
@@ -10650,7 +10729,7 @@ async function processClaudePairSessions(agents) {
10650
10729
  killPairSession,
10651
10730
  pairTmuxSession,
10652
10731
  finalizeClaudePairOnboarding
10653
- } = await import("../claude-pair-runtime-VBTV4KZO.js");
10732
+ } = await import("../claude-pair-runtime-NOZN3WKM.js");
10654
10733
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
10655
10734
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
10656
10735
  const killed = await killPairSession(pairTmuxSession(pairId));