@integrity-labs/agt-cli 0.27.149 → 0.27.150-test.15

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-ZLEK4KBF.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-35PWSTLO.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-3ZIOY3Z5.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-GIUCD7IG.js.map
@@ -0,0 +1,27 @@
1
+ import {
2
+ _internals,
3
+ getOrCreateDailySession,
4
+ isAgentIdle,
5
+ isStaleForToday,
6
+ markDailySessionSpawn,
7
+ peekCurrentSession,
8
+ rotateDailySession,
9
+ sessionFileExists,
10
+ sessionFilePath,
11
+ sessionTranscriptDir,
12
+ transcriptActivityAgeSeconds
13
+ } from "./chunk-354FAVQR.js";
14
+ export {
15
+ _internals,
16
+ getOrCreateDailySession,
17
+ isAgentIdle,
18
+ isStaleForToday,
19
+ markDailySessionSpawn,
20
+ peekCurrentSession,
21
+ rotateDailySession,
22
+ sessionFileExists,
23
+ sessionFilePath,
24
+ sessionTranscriptDir,
25
+ transcriptActivityAgeSeconds
26
+ };
27
+ //# sourceMappingURL=daily-session-PNQX5URX.js.map
@@ -15,11 +15,10 @@ import {
15
15
  provisionAutoKanbanProgressHook,
16
16
  provisionIsolationHook,
17
17
  provisionOrientHook,
18
- provisionSessionStateHook,
19
18
  provisionStopHook,
20
19
  requireHost,
21
20
  safeWriteJsonAtomic
22
- } from "../chunk-XWZMKHHG.js";
21
+ } from "../chunk-24FTY53Z.js";
23
22
  import {
24
23
  getProjectDir as getProjectDir2,
25
24
  getReadyTasks,
@@ -38,13 +37,10 @@ import {
38
37
  getSessionState,
39
38
  injectMessage,
40
39
  injectMessageWithStatus,
41
- isAgentIdle,
42
40
  isAgentPromptReady,
43
41
  isSessionHealthy,
44
- isStaleForToday,
45
42
  paneLogPath,
46
43
  parseEnvIntegrations,
47
- peekCurrentSession,
48
44
  prepareForRespawn,
49
45
  probeMcpEnvSubstitution,
50
46
  readPaneLogTail,
@@ -53,14 +49,12 @@ import {
53
49
  rotateSessionForWedge,
54
50
  sanitizeMcpJson,
55
51
  sendToAgent,
56
- sessionTranscriptDir,
57
52
  startPersistentSession,
58
53
  stopAllSessionsAndWait,
59
54
  stopPersistentSession,
60
55
  takeWatchdogGiveUpCount,
61
- takeZombieDetection,
62
- transcriptActivityAgeSeconds
63
- } from "../chunk-JLS7NQFE.js";
56
+ takeZombieDetection
57
+ } from "../chunk-7GKJZBTB.js";
64
58
  import {
65
59
  KANBAN_CHECK_COMMAND,
66
60
  MAX_AVATAR_ENV_URL_BYTES,
@@ -89,7 +83,13 @@ import {
89
83
  resolveDmTarget,
90
84
  worseConnectivityOutcome,
91
85
  wrapScheduledTaskPrompt
92
- } from "../chunk-A75AOK6E.js";
86
+ } from "../chunk-WOOYOAPG.js";
87
+ import {
88
+ isAgentIdle,
89
+ isStaleForToday,
90
+ peekCurrentSession,
91
+ sessionTranscriptDir
92
+ } from "../chunk-354FAVQR.js";
93
93
  import {
94
94
  parsePsRows,
95
95
  reapOrphanChannelMcps
@@ -1515,7 +1515,6 @@ function isUrgentUpgrade(opts) {
1515
1515
  }
1516
1516
  var RESTART_IDLE_THRESHOLD_SECONDS = 120;
1517
1517
  var RESTART_INBOUND_QUIET_SECONDS = 300;
1518
- var RESTART_TRANSCRIPT_STALE_SECONDS = 60;
1519
1518
  var GATEABLE_RESTART_REASONS = /* @__PURE__ */ new Set([
1520
1519
  "model-change",
1521
1520
  "channel-set-change",
@@ -1534,11 +1533,9 @@ function decideRestartGate(opts) {
1534
1533
  }
1535
1534
  const paneThreshold = opts.idleThresholdSeconds ?? RESTART_IDLE_THRESHOLD_SECONDS;
1536
1535
  const inboundThreshold = opts.inboundQuietSeconds ?? RESTART_INBOUND_QUIET_SECONDS;
1537
- const transcriptThreshold = opts.transcriptStaleSeconds ?? RESTART_TRANSCRIPT_STALE_SECONDS;
1538
- const transcriptAge = opts.transcriptAgeSeconds ?? null;
1539
- const progressBusy = transcriptAge !== null ? transcriptAge < transcriptThreshold : opts.paneLogAgeSeconds !== null && opts.paneLogAgeSeconds < paneThreshold;
1536
+ const paneBusy = opts.paneLogAgeSeconds !== null && opts.paneLogAgeSeconds < paneThreshold;
1540
1537
  const inboundBusy = opts.inboundAgeSeconds !== null && opts.inboundAgeSeconds < inboundThreshold;
1541
- if (progressBusy || inboundBusy) return "defer-idle";
1538
+ if (paneBusy || inboundBusy) return "defer-idle";
1542
1539
  return "proceed";
1543
1540
  }
1544
1541
 
@@ -3380,18 +3377,13 @@ function clearAgentState(agentId, codeName) {
3380
3377
  // src/lib/wedge-detection.ts
3381
3378
  var DEFAULTS = {
3382
3379
  inboundWaitSeconds: 120,
3383
- // ENG-6264: DISABLED by default (0). A session that's actively producing
3384
- // tokens is never force-respawned a working agent must not be killed just
3385
- // because a message has been queued behind its turn, no matter how long.
3386
- // ENG-6238 made this an absolute backstop (1200s) to still catch a
3387
- // producing-but-never-draining runaway loop, but that re-introduced the exact
3388
- // failure we set out to kill: cutting off real work on a long turn. Runaway
3389
- // token burn is owned by the cost guardrail (ENG-5556); a producing-but-silent
3390
- // loop still trips the synthetic-probe alarm. So the backstop is now opt-in:
3391
- // set AGT_WEDGE_INBOUND_HARD_WAIT_SECONDS to a positive value to re-enable it
3392
- // (floored at inboundWaitSeconds). 0 = the frozen/hung wedge (transcript
3393
- // static) is still caught by the soft path; only the *producing* path is spared.
3394
- inboundHardWaitSeconds: 0,
3380
+ // ENG-6238: the hard cap is now an ABSOLUTE BACKSTOP, not the primary
3381
+ // discriminator a still-producing session (e.g. a runaway loop) is only
3382
+ // reaped here. Raised 300→1200 because the soft path now reliably catches
3383
+ // the frozen-turn wedge via the transcript signal, so the hard cap no longer
3384
+ // needs to fire early (which is exactly what false-killed kylie's long
3385
+ // legitimate turns, ENG-6238).
3386
+ inboundHardWaitSeconds: 1200,
3395
3387
  paneStaleSeconds: 120,
3396
3388
  transcriptStaleSeconds: 60,
3397
3389
  minCycles: 3
@@ -3410,12 +3402,10 @@ function resolveWedgeConfig(env = process.env) {
3410
3402
  DEFAULTS.inboundWaitSeconds,
3411
3403
  30
3412
3404
  );
3413
- const inboundHardWaitRaw = parsePositiveInt(
3414
- env.AGT_WEDGE_INBOUND_HARD_WAIT_SECONDS,
3415
- DEFAULTS.inboundHardWaitSeconds,
3416
- 0
3405
+ const inboundHardWaitSeconds = Math.max(
3406
+ inboundWaitSeconds,
3407
+ parsePositiveInt(env.AGT_WEDGE_INBOUND_HARD_WAIT_SECONDS, DEFAULTS.inboundHardWaitSeconds, 30)
3417
3408
  );
3418
- const inboundHardWaitSeconds = inboundHardWaitRaw <= 0 ? 0 : Math.max(inboundWaitSeconds, inboundHardWaitRaw);
3419
3409
  return {
3420
3410
  mode: parseMode(env.AGT_WEDGE_RESTART_MODE),
3421
3411
  inboundWaitSeconds,
@@ -3440,7 +3430,6 @@ function isWedgeCandidateCycle(signals, config2) {
3440
3430
  if (inboundAge === null) return false;
3441
3431
  if (inboundAge < config2.inboundWaitSeconds) return false;
3442
3432
  if (isSessionProducing(signals, config2)) {
3443
- if (config2.inboundHardWaitSeconds <= 0) return false;
3444
3433
  return inboundAge >= config2.inboundHardWaitSeconds;
3445
3434
  }
3446
3435
  return true;
@@ -4428,16 +4417,11 @@ function paneLogAgeSecondsFor(codeName) {
4428
4417
  return 0;
4429
4418
  }
4430
4419
  }
4431
- function transcriptAgeSecondsFor(codeName) {
4432
- const sessionId = getSessionState(codeName)?.currentSessionId ?? null;
4433
- return transcriptActivityAgeSeconds(getProjectDir2(codeName), sessionId, /* @__PURE__ */ new Date());
4434
- }
4435
- function restartGateFor(codeName, reason) {
4436
- if (!isGateableRestartReason(reason)) return "bypass";
4420
+ function restartGateFor(codeName, breakerReason) {
4421
+ if (!isGateableRestartReason(breakerReason)) return "bypass";
4437
4422
  return decideRestartGate({
4438
4423
  window: cachedMaintenanceWindow,
4439
4424
  paneLogAgeSeconds: paneLogAgeSecondsFor(codeName),
4440
- transcriptAgeSeconds: transcriptAgeSecondsFor(codeName),
4441
4425
  inboundAgeSeconds: inboundAgeSecondsFor(codeName),
4442
4426
  now: /* @__PURE__ */ new Date()
4443
4427
  });
@@ -4596,10 +4580,10 @@ async function runAgentConnectivityProbes(agent, integrations, projectDir) {
4596
4580
  );
4597
4581
  }
4598
4582
  }
4599
- function stopPersistentSessionAndForgetMcpBaseline(codeName, breakerReason, gateReason = breakerReason) {
4600
- const gate = restartGateFor(codeName, gateReason);
4583
+ function stopPersistentSessionAndForgetMcpBaseline(codeName, breakerReason) {
4584
+ const gate = restartGateFor(codeName, breakerReason);
4601
4585
  if (gate !== "bypass" && gate !== "proceed") {
4602
- log(`[maintenance-window] Deferring '${gateReason}' restart for '${codeName}' (${gate})`);
4586
+ log(`[maintenance-window] Deferring '${breakerReason}' restart for '${codeName}' (${gate})`);
4603
4587
  return;
4604
4588
  }
4605
4589
  cancelPendingSessionRestart(codeName);
@@ -4776,7 +4760,7 @@ var cachedMaintenanceWindow = null;
4776
4760
  var lastVersionCheckAt = 0;
4777
4761
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
4778
4762
  var lastResponsivenessProbeAt = 0;
4779
- var agtCliVersion = true ? "0.27.149" : "dev";
4763
+ var agtCliVersion = true ? "0.27.150-test.15" : "dev";
4780
4764
  function resolveBrewPath(execFileSync4) {
4781
4765
  try {
4782
4766
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -5974,7 +5958,7 @@ async function pollCycle() {
5974
5958
  }
5975
5959
  try {
5976
5960
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
5977
- const { collectDiagnostics } = await import("../persistent-session-ZLEK4KBF.js");
5961
+ const { collectDiagnostics } = await import("../persistent-session-35PWSTLO.js");
5978
5962
  const diagCodeNames = [...agentState.persistentSessionAgents];
5979
5963
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
5980
5964
  let tailscaleHostname;
@@ -6061,12 +6045,12 @@ async function pollCycle() {
6061
6045
  const {
6062
6046
  collectResponsivenessProbes,
6063
6047
  getResponsivenessIntervalMs
6064
- } = await import("../responsiveness-probe-3EUNCJDU.js");
6048
+ } = await import("../responsiveness-probe-MA4M2QM4.js");
6065
6049
  const probeIntervalMs = getResponsivenessIntervalMs();
6066
6050
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
6067
6051
  const probeCodeNames = [...agentState.persistentSessionAgents];
6068
6052
  if (probeCodeNames.length > 0) {
6069
- const { takeAcpxExecFailureCount, creditAcpxExecFailureCount } = await import("../persistent-session-ZLEK4KBF.js");
6053
+ const { takeAcpxExecFailureCount, creditAcpxExecFailureCount } = await import("../persistent-session-35PWSTLO.js");
6070
6054
  const drainedGiveUps = /* @__PURE__ */ new Map();
6071
6055
  const drainedAcpxFailures = /* @__PURE__ */ new Map();
6072
6056
  const probes = collectResponsivenessProbes(probeCodeNames).map((p) => {
@@ -6100,7 +6084,8 @@ async function pollCycle() {
6100
6084
  collectResponsivenessProbes,
6101
6085
  livePendingInboundOldestAgeSeconds,
6102
6086
  deadLetterPendingInbound
6103
- } = await import("../responsiveness-probe-3EUNCJDU.js");
6087
+ } = await import("../responsiveness-probe-MA4M2QM4.js");
6088
+ const { transcriptActivityAgeSeconds } = await import("../daily-session-PNQX5URX.js");
6104
6089
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
6105
6090
  const wedgeNow = /* @__PURE__ */ new Date();
6106
6091
  const liveAgents = agentState.persistentSessionAgents;
@@ -6164,21 +6149,6 @@ async function pollCycle() {
6164
6149
  log(
6165
6150
  `[wedge] forced fresh respawn ${detail} \u2192 new session ${newId} (transcript preserved${deadNote})`
6166
6151
  );
6167
- const wedgeAgentId = agentState.codeNameToAgentId.get(codeName);
6168
- if (wedgeAgentId) {
6169
- api.post("/host/wedge-respawn", {
6170
- agent_id: wedgeAgentId,
6171
- code_name: codeName,
6172
- dead_lettered_count: deadLettered,
6173
- pane_age_seconds: signals.paneActivityAgeSeconds,
6174
- inbound_age_seconds: signals.pendingInboundOldestAgeSeconds,
6175
- transcript_age_seconds: transcriptAge
6176
- }).catch((err) => {
6177
- log(
6178
- `[wedge] failed to record respawn event for '${codeName}' (ENG-6265): ${err.message} \u2014 respawn proceeded; CloudWatch metric will under-count this event`
6179
- );
6180
- });
6181
- }
6182
6152
  const inProgressCardIds = (kanbanBoardCache.get(codeName) ?? []).filter((item) => item.status === "in_progress" && isHybridActionable(item)).map((item) => item.id);
6183
6153
  const cardStates = wedgeRestartsByCard.get(codeName) ?? /* @__PURE__ */ new Map();
6184
6154
  const { next, newlyPoisoned } = recordWedgeForCards(
@@ -7898,19 +7868,7 @@ async function processAgent(agent, agentStates) {
7898
7868
  // isolated and the agent keeps running degraded instead of being
7899
7869
  // paused wholesale. reaperRestartBreakerReason() encodes that
7900
7870
  // single-vs-multi decision; undefined means "restart, don't count".
7901
- //
7902
- // ENG-6264: the breaker-count reason (above, undefined for a single dead
7903
- // MCP) is decoupled from the GATE reason. Pre-6264 an undefined breaker
7904
- // reason also made the restart non-gateable → 'bypass' → the session was
7905
- // torn down mid-turn (the common single-MCP case interrupted busy
7906
- // agents). Always pass 'mcp-presence-reaper' as the gate reason so the
7907
- // restart defers-until-idle, while breakerReason still governs whether it
7908
- // counts against the breaker.
7909
- stopSession: (codeName, ctx) => stopPersistentSessionAndForgetMcpBaseline(
7910
- codeName,
7911
- reaperRestartBreakerReason(ctx.activeKeys),
7912
- "mcp-presence-reaper"
7913
- ),
7871
+ stopSession: (codeName, ctx) => stopPersistentSessionAndForgetMcpBaseline(codeName, reaperRestartBreakerReason(ctx.activeKeys)),
7914
7872
  // ENG-5292: when the reaper gives up on a managed MCP (cap from
7915
7873
  // ENG-5279 + state-preservation from ENG-5285 both said "this
7916
7874
  // MCP keeps failing after 3 restart cycles"), mark the matching
@@ -9129,11 +9087,6 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash3("sha256").
9129
9087
  } catch (err) {
9130
9088
  log(`[persistent-session] Failed to provision auto-progress hook for '${codeName}': ${err.message}`);
9131
9089
  }
9132
- try {
9133
- provisionSessionStateHook(codeName);
9134
- } catch (err) {
9135
- log(`[persistent-session] Failed to provision session-state hook for '${codeName}': ${err.message}`);
9136
- }
9137
9090
  const sessionRunResult = await startRun({
9138
9091
  agent_id: agent.agent_id,
9139
9092
  source_type: "system",
@@ -10662,7 +10615,7 @@ async function processClaudePairSessions(agents) {
10662
10615
  killPairSession,
10663
10616
  pairTmuxSession,
10664
10617
  finalizeClaudePairOnboarding
10665
- } = await import("../claude-pair-runtime-3ZIOY3Z5.js");
10618
+ } = await import("../claude-pair-runtime-GIUCD7IG.js");
10666
10619
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
10667
10620
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
10668
10621
  const killed = await killPairSession(pairTmuxSession(pairId));