@integrity-labs/agt-cli 0.28.1067 → 0.28.1068

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.
Files changed (25) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-OW6XCSOU.js → chunk-65F44JJJ.js} +2 -2
  3. package/dist/{chunk-PN7B4DLS.js → chunk-CFJONCHN.js} +11 -1
  4. package/dist/{chunk-PN7B4DLS.js.map → chunk-CFJONCHN.js.map} +1 -1
  5. package/dist/{chunk-NZF55T6D.js → chunk-WLB2E3PO.js} +7 -4
  6. package/dist/{chunk-NZF55T6D.js.map → chunk-WLB2E3PO.js.map} +1 -1
  7. package/dist/{claude-pair-runtime-NCDM5KHM.js → claude-pair-runtime-4BISLPPZ.js} +2 -2
  8. package/dist/lib/manager-worker.js +163 -14
  9. package/dist/lib/manager-worker.js.map +1 -1
  10. package/dist/mcp/direct-chat-channel.js +10 -0
  11. package/dist/mcp/index.js +10 -0
  12. package/dist/mcp/origami.js +10 -0
  13. package/dist/mcp/slack-channel.js +10 -0
  14. package/dist/mcp/telegram-channel.js +10 -0
  15. package/dist/pane-fatal-error-EL336LRO.js +127 -0
  16. package/dist/pane-fatal-error-EL336LRO.js.map +1 -0
  17. package/dist/{persistent-session-ELDC5JFR.js → persistent-session-VRAVB743.js} +3 -3
  18. package/dist/{responsiveness-probe-HUUU2MFX.js → responsiveness-probe-QTYKXBH7.js} +3 -3
  19. package/dist/{session-auth-dead-BRMWKA3Y.js → session-auth-dead-JJPNV3YQ.js} +2 -2
  20. package/package.json +1 -1
  21. /package/dist/{chunk-OW6XCSOU.js.map → chunk-65F44JJJ.js.map} +0 -0
  22. /package/dist/{claude-pair-runtime-NCDM5KHM.js.map → claude-pair-runtime-4BISLPPZ.js.map} +0 -0
  23. /package/dist/{persistent-session-ELDC5JFR.js.map → persistent-session-VRAVB743.js.map} +0 -0
  24. /package/dist/{responsiveness-probe-HUUU2MFX.js.map → responsiveness-probe-QTYKXBH7.js.map} +0 -0
  25. /package/dist/{session-auth-dead-BRMWKA3Y.js.map → session-auth-dead-JJPNV3YQ.js.map} +0 -0
@@ -266,7 +266,7 @@ async function spawnPairSession(session) {
266
266
  return { ok: true };
267
267
  } catch {
268
268
  }
269
- const { resolveClaudeBinary } = await import("./persistent-session-ELDC5JFR.js");
269
+ const { resolveClaudeBinary } = await import("./persistent-session-VRAVB743.js");
270
270
  const claudeBin = resolveClaudeBinary();
271
271
  const pairEnv = {
272
272
  ...process.env,
@@ -734,4 +734,4 @@ export {
734
734
  startClaudePair,
735
735
  submitClaudePairCode
736
736
  };
737
- //# sourceMappingURL=claude-pair-runtime-NCDM5KHM.js.map
737
+ //# sourceMappingURL=claude-pair-runtime-4BISLPPZ.js.map
@@ -67,7 +67,7 @@ import {
67
67
  safeWriteJsonAtomic,
68
68
  setConfigHash,
69
69
  tripClass
70
- } from "../chunk-NZF55T6D.js";
70
+ } from "../chunk-WLB2E3PO.js";
71
71
  import {
72
72
  getProjectDir as getProjectDir2,
73
73
  getReadyTasks,
@@ -154,7 +154,7 @@ import {
154
154
  webFetchBaselineValue,
155
155
  webFetchRestartNeeded,
156
156
  writeEgressAllowlist
157
- } from "../chunk-OW6XCSOU.js";
157
+ } from "../chunk-65F44JJJ.js";
158
158
  import {
159
159
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
160
160
  AnchorSessionClient,
@@ -263,7 +263,7 @@ import {
263
263
  subagentActivityAgeSeconds,
264
264
  sumTranscriptUsageInWindow,
265
265
  transcriptActivityAgeSeconds
266
- } from "../chunk-PN7B4DLS.js";
266
+ } from "../chunk-CFJONCHN.js";
267
267
  import {
268
268
  classifyUnanswerablePane,
269
269
  paneRemedy
@@ -14123,7 +14123,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
14123
14123
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
14124
14124
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
14125
14125
  async function channelInboundActivityAgeSecondsFor(codeName) {
14126
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-HUUU2MFX.js");
14126
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-QTYKXBH7.js");
14127
14127
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
14128
14128
  if (newest === null) return null;
14129
14129
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -14144,6 +14144,10 @@ function inboundHeldMinutesFor(codeName) {
14144
14144
  }
14145
14145
  var consecutiveWedgeCycles = /* @__PURE__ */ new Map();
14146
14146
  var wedgeExemptionLogged = /* @__PURE__ */ new Set();
14147
+ var paneFatalStreak = /* @__PURE__ */ new Map();
14148
+ var paneFatalRestarts = /* @__PURE__ */ new Map();
14149
+ var paneFatalReported = /* @__PURE__ */ new Set();
14150
+ var paneBannerWarned = /* @__PURE__ */ new Set();
14147
14151
  var wedgeRestartsByCard = /* @__PURE__ */ new Map();
14148
14152
  function noteInbound(codeName) {
14149
14153
  lastInboundMs.set(codeName, Date.now());
@@ -14871,7 +14875,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
14871
14875
  var lastVersionCheckAt = 0;
14872
14876
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
14873
14877
  var lastResponsivenessProbeAt = 0;
14874
- var agtCliVersion = true ? "0.28.1067" : "dev";
14878
+ var agtCliVersion = true ? "0.28.1068" : "dev";
14875
14879
  function resolveBrewPath(execFileSync3) {
14876
14880
  try {
14877
14881
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -16506,7 +16510,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
16506
16510
  if (codeNames.length === 0) return;
16507
16511
  void (async () => {
16508
16512
  try {
16509
- const { collectDiagnostics } = await import("../persistent-session-ELDC5JFR.js");
16513
+ const { collectDiagnostics } = await import("../persistent-session-VRAVB743.js");
16510
16514
  await api.post("/host/heartbeat", {
16511
16515
  host_id: hostId,
16512
16516
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -16648,7 +16652,7 @@ async function pollCycleInner() {
16648
16652
  }
16649
16653
  try {
16650
16654
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
16651
- const { collectDiagnostics } = await import("../persistent-session-ELDC5JFR.js");
16655
+ const { collectDiagnostics } = await import("../persistent-session-VRAVB743.js");
16652
16656
  const diagCodeNames = [...agentState.persistentSessionAgents];
16653
16657
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor) : void 0;
16654
16658
  let tailscaleHostname;
@@ -16856,7 +16860,7 @@ async function pollCycleInner() {
16856
16860
  collectPanelessActivityProbes,
16857
16861
  getResponsivenessIntervalMs,
16858
16862
  occupancyQualificationClassifications
16859
- } = await import("../responsiveness-probe-HUUU2MFX.js");
16863
+ } = await import("../responsiveness-probe-QTYKXBH7.js");
16860
16864
  const probeIntervalMs = getResponsivenessIntervalMs();
16861
16865
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
16862
16866
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -16973,7 +16977,7 @@ async function pollCycleInner() {
16973
16977
  collectResponsivenessProbes,
16974
16978
  livePendingInboundOldestAgeSeconds,
16975
16979
  parkPendingInbound
16976
- } = await import("../responsiveness-probe-HUUU2MFX.js");
16980
+ } = await import("../responsiveness-probe-QTYKXBH7.js");
16977
16981
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-M6AFZWNU.js");
16978
16982
  const wedgeNow = /* @__PURE__ */ new Date();
16979
16983
  const liveAgents = agentState.persistentSessionAgents;
@@ -17127,9 +17131,154 @@ async function pollCycleInner() {
17127
17131
  } catch (err) {
17128
17132
  log(`[wedge] detection failed: ${err.message}`);
17129
17133
  }
17134
+ try {
17135
+ const {
17136
+ classifyPane,
17137
+ decidePaneFatalAction,
17138
+ pruneRestartHistory,
17139
+ resolvePaneFatalConfig
17140
+ } = await import("../pane-fatal-error-EL336LRO.js");
17141
+ const fatalConfig = resolvePaneFatalConfig();
17142
+ const liveAgents = agentState.persistentSessionAgents;
17143
+ for (const tracked of [
17144
+ ...paneFatalStreak.keys(),
17145
+ ...paneFatalRestarts.keys(),
17146
+ ...paneFatalReported,
17147
+ ...paneBannerWarned
17148
+ ]) {
17149
+ if (!liveAgents.has(tracked)) {
17150
+ paneFatalStreak.delete(tracked);
17151
+ paneFatalRestarts.delete(tracked);
17152
+ paneFatalReported.delete(tracked);
17153
+ paneBannerWarned.delete(tracked);
17154
+ }
17155
+ }
17156
+ if (fatalConfig.mode !== "off") {
17157
+ const fatalNowMs = Date.now();
17158
+ for (const codeName of liveAgents) {
17159
+ if ((agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK) !== "claude-code") continue;
17160
+ if (!isSessionHealthy(codeName)) {
17161
+ paneFatalStreak.delete(codeName);
17162
+ continue;
17163
+ }
17164
+ let pane = null;
17165
+ try {
17166
+ pane = syncExecFile("tmux", ["capture-pane", "-t", `agt-${codeName}`, "-p", "-J"], {
17167
+ stdio: ["ignore", "pipe", "ignore"],
17168
+ timeout: 2e3
17169
+ }).toString();
17170
+ } catch {
17171
+ pane = null;
17172
+ }
17173
+ const verdict = classifyPane(pane);
17174
+ const kind = verdict.kind;
17175
+ if (!verdict.transcriptBanner) paneBannerWarned.delete(codeName);
17176
+ if (kind === null) {
17177
+ paneFatalStreak.delete(codeName);
17178
+ paneFatalReported.delete(codeName);
17179
+ continue;
17180
+ }
17181
+ const prev = paneFatalStreak.get(codeName);
17182
+ const cycles = prev && prev.kind === kind ? prev.cycles + 1 : 1;
17183
+ paneFatalStreak.set(codeName, { kind, cycles });
17184
+ const history = pruneRestartHistory(paneFatalRestarts.get(codeName) ?? [], fatalNowMs, fatalConfig);
17185
+ paneFatalRestarts.set(codeName, history);
17186
+ const action = decidePaneFatalAction(
17187
+ { kind, consecutiveCycles: cycles, recentRestartsMs: history, nowMs: fatalNowMs },
17188
+ fatalConfig
17189
+ );
17190
+ if (action === "none") continue;
17191
+ const fatalAgentId = agentState.codeNameToAgentId.get(codeName);
17192
+ const detail = `agent=${codeName} kind=${kind} fatalTurns=${verdict.fatalTurns} transcriptBanner=${verdict.transcriptBanner} cycles=${cycles} restartsInWindow=${history.length}`;
17193
+ if (action === "warn") {
17194
+ if (!paneBannerWarned.has(codeName)) {
17195
+ paneBannerWarned.add(codeName);
17196
+ log(
17197
+ `[pane-fatal] "Transcript writes are failing" in the status bar but turns are still being answered \u2014 NOT respawning; recommend a restart at a quiet moment ${detail}`
17198
+ );
17199
+ if (fatalAgentId) {
17200
+ void reportReaperEvent(
17201
+ fatalAgentId,
17202
+ "session-fatal-error-reaper",
17203
+ "alert",
17204
+ 'Claude Code reports "Transcript writes are failing" while the session is still answering; transcripts and compaction may be lost, a restart is recommended'
17205
+ );
17206
+ }
17207
+ }
17208
+ continue;
17209
+ }
17210
+ if (action === "would-restart") {
17211
+ if (!paneFatalReported.has(codeName)) {
17212
+ paneFatalReported.add(codeName);
17213
+ log(`[pane-fatal] SHADOW would force-fresh respawn ${detail}`);
17214
+ }
17215
+ continue;
17216
+ }
17217
+ if (action === "give-up") {
17218
+ if (!paneFatalReported.has(codeName)) {
17219
+ paneFatalReported.add(codeName);
17220
+ log(
17221
+ `[pane-fatal] restart budget spent (${fatalConfig.maxRestartsInWindow} in ${Math.round(fatalConfig.restartWindowMs / 6e4)}m) and the fatal error is back \u2014 NOT restarting again; a human has to look ${detail}`
17222
+ );
17223
+ if (fatalAgentId) {
17224
+ void reportReaperEvent(
17225
+ fatalAgentId,
17226
+ "session-fatal-error-reaper",
17227
+ "blocked",
17228
+ `Session keeps failing with "${kind}" after ${history.length} fresh respawn(s); stopped auto-restarting`
17229
+ );
17230
+ }
17231
+ }
17232
+ continue;
17233
+ }
17234
+ try {
17235
+ const newId = rotateSessionForWedge(codeName);
17236
+ try {
17237
+ syncExecFile("tmux", ["kill-session", "-t", `agt-${codeName}`], { stdio: "ignore" });
17238
+ } catch {
17239
+ }
17240
+ stopPersistentSessionAndForgetMcpBaseline(
17241
+ codeName,
17242
+ "pane-fatal-error",
17243
+ void 0,
17244
+ { outcome: "failed", message: `pane fatal error (${kind})` },
17245
+ {
17246
+ reason: `session answered every turn with "${kind}"; forced a fresh respawn (ENG-11278)`,
17247
+ detail: {
17248
+ fatal_kind: kind,
17249
+ fatal_turns: verdict.fatalTurns,
17250
+ transcript_banner: verdict.transcriptBanner,
17251
+ consecutive_cycles: cycles,
17252
+ restarts_in_window: history.length
17253
+ }
17254
+ }
17255
+ );
17256
+ const { parkPendingInbound } = await import("../responsiveness-probe-QTYKXBH7.js");
17257
+ const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
17258
+ paneFatalStreak.delete(codeName);
17259
+ paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
17260
+ log(
17261
+ `[pane-fatal] forced fresh respawn ${detail} \u2192 new session ${newId} (transcript preserved, ${parked} inbound parked, ${deadLettered} dead-lettered)`
17262
+ );
17263
+ if (fatalAgentId) {
17264
+ void reportReaperEvent(
17265
+ fatalAgentId,
17266
+ "session-fatal-error-reaper",
17267
+ "restart",
17268
+ `Session was answering every turn with "${kind}"; forced a fresh respawn`
17269
+ );
17270
+ }
17271
+ } catch (err) {
17272
+ log(`[pane-fatal] force-fresh respawn failed for ${codeName}: ${err.message}`);
17273
+ }
17274
+ }
17275
+ }
17276
+ } catch (err) {
17277
+ log(`[pane-fatal] detection failed: ${err.message}`);
17278
+ }
17130
17279
  try {
17131
17280
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
17132
- const { probeSessionAuth } = await import("../session-auth-dead-BRMWKA3Y.js");
17281
+ const { probeSessionAuth } = await import("../session-auth-dead-JJPNV3YQ.js");
17133
17282
  const observations = [];
17134
17283
  const pendingCacheCommits = [];
17135
17284
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -21694,7 +21843,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
21694
21843
  try {
21695
21844
  const freshId = rotateSessionForWedge(codeName);
21696
21845
  consecutiveWedgeCycles.delete(codeName);
21697
- const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-HUUU2MFX.js");
21846
+ const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-QTYKXBH7.js");
21698
21847
  const { parked, deadLettered } = parkForRestart(codeName, /* @__PURE__ */ new Date());
21699
21848
  const parkNote = parked > 0 ? `, ${parked} inbound parked` : "";
21700
21849
  const deadNote = deadLettered > 0 ? `, ${deadLettered} undeliverable dead-lettered` : "";
@@ -21737,7 +21886,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
21737
21886
  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}`));
21738
21887
  void (async () => {
21739
21888
  try {
21740
- const { collectDiagnostics } = await import("../persistent-session-ELDC5JFR.js");
21889
+ const { collectDiagnostics } = await import("../persistent-session-VRAVB743.js");
21741
21890
  await api.post("/host/heartbeat", {
21742
21891
  host_id: hostId,
21743
21892
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -21788,7 +21937,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
21788
21937
  }
21789
21938
  try {
21790
21939
  const hostId = await getHostId();
21791
- const { collectDiagnostics } = await import("../persistent-session-ELDC5JFR.js");
21940
+ const { collectDiagnostics } = await import("../persistent-session-VRAVB743.js");
21792
21941
  await api.post("/host/heartbeat", {
21793
21942
  host_id: hostId,
21794
21943
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -22460,7 +22609,7 @@ async function processClaudePairSessions(agents) {
22460
22609
  // cannot take it for itself — by the time it runs, the write it is looking
22461
22610
  // for may already have happened.
22462
22611
  snapshotPairConfig
22463
- } = await import("../claude-pair-runtime-NCDM5KHM.js");
22612
+ } = await import("../claude-pair-runtime-4BISLPPZ.js");
22464
22613
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
22465
22614
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
22466
22615
  const killed = await killPairSession(pairTmuxSession(pairId));