@integrity-labs/agt-cli 0.28.608 → 0.28.610

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.
package/dist/bin/agt.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-6DELDLX4.js";
43
+ } from "../chunk-RTZ2VC7V.js";
44
44
  import {
45
45
  readDirectChatSessionState
46
46
  } from "../chunk-DESCRVVM.js";
@@ -4909,7 +4909,7 @@ import { execFileSync, execSync } from "child_process";
4909
4909
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4910
4910
  import chalk18 from "chalk";
4911
4911
  import ora16 from "ora";
4912
- var cliVersion = true ? "0.28.608" : "dev";
4912
+ var cliVersion = true ? "0.28.610" : "dev";
4913
4913
  async function fetchLatestVersion() {
4914
4914
  const host2 = getHost();
4915
4915
  if (!host2) return null;
@@ -6089,7 +6089,7 @@ function handleError(err) {
6089
6089
  }
6090
6090
 
6091
6091
  // src/bin/agt.ts
6092
- var cliVersion2 = true ? "0.28.608" : "dev";
6092
+ var cliVersion2 = true ? "0.28.610" : "dev";
6093
6093
  var program = new Command();
6094
6094
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
6095
6095
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6030,7 +6030,7 @@ function exchangeFailureKind(err) {
6030
6030
  }
6031
6031
 
6032
6032
  // src/lib/api-client.ts
6033
- var agtCliVersion = true ? "0.28.608" : "dev";
6033
+ var agtCliVersion = true ? "0.28.610" : "dev";
6034
6034
  var lastConfigHash = null;
6035
6035
  function setConfigHash(hash) {
6036
6036
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -9505,4 +9505,4 @@ export {
9505
9505
  managerInstallSystemUnitCommand,
9506
9506
  managerUninstallSystemUnitCommand
9507
9507
  };
9508
- //# sourceMappingURL=chunk-6DELDLX4.js.map
9508
+ //# sourceMappingURL=chunk-RTZ2VC7V.js.map
@@ -53,7 +53,7 @@ import {
53
53
  safeWriteJsonAtomic,
54
54
  setConfigHash,
55
55
  tripClass
56
- } from "../chunk-6DELDLX4.js";
56
+ } from "../chunk-RTZ2VC7V.js";
57
57
  import {
58
58
  getProjectDir as getProjectDir2,
59
59
  getReadyTasks,
@@ -11284,6 +11284,28 @@ var DEFER_LOG_THROTTLE_MS = 6e5;
11284
11284
  var deferLogThrottle = /* @__PURE__ */ new Map();
11285
11285
  var lastInboundMs = /* @__PURE__ */ new Map();
11286
11286
  var pendingDayRolloverReset = /* @__PURE__ */ new Set();
11287
+ var dayRolloverInboundHold = /* @__PURE__ */ new Map();
11288
+ var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
11289
+ async function channelInboundActivityAgeSecondsFor(codeName) {
11290
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-Z7IFPQCU.js");
11291
+ const newest = newestPendingInboundActivityMtimeMs(dirname9(paneLogPath(codeName)));
11292
+ if (newest === null) return null;
11293
+ return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
11294
+ }
11295
+ function inboundHoldMinutes(prev, nowMs, episodeGapMs = INBOUND_HOLD_EPISODE_GAP_MS) {
11296
+ if (!prev) return 0;
11297
+ const gap = Math.max(0, nowMs - prev.lastHeldMs);
11298
+ if (gap > episodeGapMs) return 0;
11299
+ return (prev.accumulatedMs + gap) / 6e4;
11300
+ }
11301
+ function creditInboundHold(prev, nowMs, episodeGapMs = INBOUND_HOLD_EPISODE_GAP_MS) {
11302
+ const gap = prev ? Math.max(0, nowMs - prev.lastHeldMs) : Infinity;
11303
+ const accumulatedMs = !prev || gap > episodeGapMs ? 0 : prev.accumulatedMs + gap;
11304
+ return { accumulatedMs, lastHeldMs: nowMs };
11305
+ }
11306
+ function inboundHeldMinutesFor(codeName) {
11307
+ return inboundHoldMinutes(dayRolloverInboundHold.get(codeName), Date.now());
11308
+ }
11287
11309
  var consecutiveWedgeCycles = /* @__PURE__ */ new Map();
11288
11310
  var wedgeExemptionLogged = /* @__PURE__ */ new Set();
11289
11311
  var wedgeRestartsByCard = /* @__PURE__ */ new Map();
@@ -11298,7 +11320,15 @@ function inboundAgeSecondsFor(codeName) {
11298
11320
  function decideDayRolloverAction(i) {
11299
11321
  if (!i.staleForToday || !i.sessionHealthy || !i.hasCurrent) return "none";
11300
11322
  if (i.idle) return "defer-idle";
11301
- return i.overdueMin >= i.graceMin ? "force-reset" : "busy-wait";
11323
+ if (i.overdueMin < i.graceMin) return "busy-wait";
11324
+ const age = i.recentInboundAgeSec;
11325
+ const graceSec = i.inboundGraceSec ?? 0;
11326
+ const heldMin = i.inboundDeferredMin ?? 0;
11327
+ const maxHoldMin = i.inboundDeferMaxMin ?? 0;
11328
+ if (age !== null && age !== void 0 && age < graceSec && heldMin < maxHoldMin) {
11329
+ return "inbound-wait";
11330
+ }
11331
+ return "force-reset";
11302
11332
  }
11303
11333
  function classifyLazyDayRolloverReset(i) {
11304
11334
  if (!i.flagged) return "skip";
@@ -11896,7 +11926,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
11896
11926
  var lastVersionCheckAt = 0;
11897
11927
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
11898
11928
  var lastResponsivenessProbeAt = 0;
11899
- var agtCliVersion = true ? "0.28.608" : "dev";
11929
+ var agtCliVersion = true ? "0.28.610" : "dev";
11900
11930
  function resolveBrewPath(execFileSync3) {
11901
11931
  try {
11902
11932
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -13434,7 +13464,7 @@ async function pollCycle() {
13434
13464
  collectPanelessActivityProbes,
13435
13465
  getResponsivenessIntervalMs,
13436
13466
  occupancyQualificationClassifications
13437
- } = await import("../responsiveness-probe-KQGY6RMW.js");
13467
+ } = await import("../responsiveness-probe-Z7IFPQCU.js");
13438
13468
  const probeIntervalMs = getResponsivenessIntervalMs();
13439
13469
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
13440
13470
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -13540,7 +13570,7 @@ async function pollCycle() {
13540
13570
  collectResponsivenessProbes,
13541
13571
  livePendingInboundOldestAgeSeconds,
13542
13572
  parkPendingInbound
13543
- } = await import("../responsiveness-probe-KQGY6RMW.js");
13573
+ } = await import("../responsiveness-probe-Z7IFPQCU.js");
13544
13574
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
13545
13575
  const wedgeNow = /* @__PURE__ */ new Date();
13546
13576
  const liveAgents = agentState.persistentSessionAgents;
@@ -16439,6 +16469,8 @@ var lastMcpFailedBannerCount = /* @__PURE__ */ new Map();
16439
16469
  var lastModelApiErrorSig = /* @__PURE__ */ new Map();
16440
16470
  var lastSessionAuthDetail = /* @__PURE__ */ new Map();
16441
16471
  var DAY_ROLLOVER_FORCE_GRACE_MIN = 30;
16472
+ var DAY_ROLLOVER_INBOUND_GRACE_SEC = 60;
16473
+ var DAY_ROLLOVER_INBOUND_DEFER_MAX_MIN = 10;
16442
16474
  var persistentSessionStuckTracker = new PersistentSessionStuckTracker();
16443
16475
  var claudeAuthTupleBySession = /* @__PURE__ */ new Map();
16444
16476
  var opencodeCredentialFingerprintBySession = /* @__PURE__ */ new Map();
@@ -16695,13 +16727,19 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
16695
16727
  const rolloverSessionHealthy = isSessionHealthy(codeName);
16696
16728
  const rolloverCurrent = staleForToday && rolloverSessionHealthy ? peekCurrentSession(codeName) : null;
16697
16729
  const overdueMin = rolloverCurrent ? minutesSinceLocalMidnight(/* @__PURE__ */ new Date(), agentTimezone) : 0;
16730
+ const rolloverMayForce = staleForToday && rolloverSessionHealthy && rolloverCurrent !== null && overdueMin >= DAY_ROLLOVER_FORCE_GRACE_MIN;
16731
+ const rolloverInboundAgeSec = rolloverMayForce ? await channelInboundActivityAgeSecondsFor(codeName) : null;
16698
16732
  const rolloverDecision = decideDayRolloverAction({
16699
16733
  staleForToday,
16700
16734
  sessionHealthy: rolloverSessionHealthy,
16701
16735
  hasCurrent: rolloverCurrent !== null,
16702
16736
  idle: rolloverCurrent ? isAgentIdle(projectDir, rolloverCurrent.sessionId) : false,
16703
16737
  overdueMin,
16704
- graceMin: DAY_ROLLOVER_FORCE_GRACE_MIN
16738
+ graceMin: DAY_ROLLOVER_FORCE_GRACE_MIN,
16739
+ recentInboundAgeSec: rolloverInboundAgeSec,
16740
+ inboundGraceSec: DAY_ROLLOVER_INBOUND_GRACE_SEC,
16741
+ inboundDeferredMin: inboundHeldMinutesFor(codeName),
16742
+ inboundDeferMaxMin: DAY_ROLLOVER_INBOUND_DEFER_MAX_MIN
16705
16743
  });
16706
16744
  if (rolloverDecision === "defer-idle" && rolloverCurrent) {
16707
16745
  if (!pendingDayRolloverReset.has(codeName)) {
@@ -16717,14 +16755,27 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
16717
16755
  stopPersistentSessionAndForgetMcpBaseline(codeName, "day-rollover");
16718
16756
  agentState.persistentSessionAgents.delete(codeName);
16719
16757
  pendingDayRolloverReset.delete(codeName);
16758
+ dayRolloverInboundHold.delete(codeName);
16720
16759
  restartTrigger = "day-rollover";
16721
16760
  dayRolloverForced = true;
16761
+ } else if (rolloverDecision === "inbound-wait" && rolloverCurrent) {
16762
+ const priorHold = dayRolloverInboundHold.get(codeName);
16763
+ dayRolloverInboundHold.set(codeName, creditInboundHold(priorHold, Date.now()));
16764
+ if (!priorHold) {
16765
+ log(
16766
+ `[persistent-session] Day rollover for '${codeName}' HELD \u2014 channel inbound ${rolloverInboundAgeSec}s ago (grace ${DAY_ROLLOVER_INBOUND_GRACE_SEC}s); not interrupting an agent mid-handoff, will force within ${DAY_ROLLOVER_INBOUND_DEFER_MAX_MIN}m regardless [ENG-8881]`
16767
+ );
16768
+ }
16769
+ dayRolloverDeferred = true;
16722
16770
  } else if (rolloverDecision === "busy-wait" && rolloverCurrent) {
16723
16771
  log(
16724
16772
  `[persistent-session] Day rollover for '${codeName}' deferred \u2014 agent still active on session ${rolloverCurrent.sessionId} (${overdueMin}m past boundary, will force at ${DAY_ROLLOVER_FORCE_GRACE_MIN}m)`
16725
16773
  );
16726
16774
  dayRolloverDeferred = true;
16727
16775
  }
16776
+ if (rolloverDecision !== "inbound-wait") {
16777
+ dayRolloverInboundHold.delete(codeName);
16778
+ }
16728
16779
  if (restartTrigger === "day-rollover") {
16729
16780
  rotatePaneLogForDayRollover(codeName, log, agentTimezone);
16730
16781
  }
@@ -18744,6 +18795,8 @@ process.on("disconnect", () => {
18744
18795
  export {
18745
18796
  BACK_ONLINE_GREETING_GUIDANCE,
18746
18797
  DAY_ROLLOVER_FORCE_GRACE_MIN,
18798
+ DAY_ROLLOVER_INBOUND_DEFER_MAX_MIN,
18799
+ DAY_ROLLOVER_INBOUND_GRACE_SEC,
18747
18800
  applyRestartAcks,
18748
18801
  cancelKanbanNoticeOnDrain,
18749
18802
  classifyLazyDayRolloverReset,
@@ -18751,12 +18804,14 @@ export {
18751
18804
  claudeCodeUpgradeThrottled,
18752
18805
  claudeManagedSettingsPath,
18753
18806
  createManagedToolkitReader,
18807
+ creditInboundHold,
18754
18808
  dashboardRestartBreakerReason,
18755
18809
  decideDayRolloverAction,
18756
18810
  ensureClaudeManagedSettings,
18757
18811
  extractCharterSlackPeers,
18758
18812
  extractCharterTelegramPeers,
18759
18813
  hasRevokedResiduals,
18814
+ inboundHoldMinutes,
18760
18815
  isOlderSemverTuple,
18761
18816
  isPrereleaseVersion,
18762
18817
  markAgentForFreshMemorySync,