@integrity-labs/agt-cli 0.28.449 → 0.28.451

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-MDD7H7EP.js";
43
+ } from "../chunk-MY5HPJUW.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -4830,7 +4830,7 @@ import { execFileSync, execSync } from "child_process";
4830
4830
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4831
4831
  import chalk18 from "chalk";
4832
4832
  import ora16 from "ora";
4833
- var cliVersion = true ? "0.28.449" : "dev";
4833
+ var cliVersion = true ? "0.28.451" : "dev";
4834
4834
  async function fetchLatestVersion() {
4835
4835
  const host2 = getHost();
4836
4836
  if (!host2) return null;
@@ -6002,7 +6002,7 @@ function handleError(err) {
6002
6002
  }
6003
6003
 
6004
6004
  // src/bin/agt.ts
6005
- var cliVersion2 = true ? "0.28.449" : "dev";
6005
+ var cliVersion2 = true ? "0.28.451" : "dev";
6006
6006
  var program = new Command();
6007
6007
  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");
6008
6008
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -4910,7 +4910,7 @@ function requireHost() {
4910
4910
  }
4911
4911
 
4912
4912
  // src/lib/api-client.ts
4913
- var agtCliVersion = true ? "0.28.449" : "dev";
4913
+ var agtCliVersion = true ? "0.28.451" : "dev";
4914
4914
  var lastConfigHash = null;
4915
4915
  function setConfigHash(hash) {
4916
4916
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7411,4 +7411,4 @@ export {
7411
7411
  managerInstallSystemUnitCommand,
7412
7412
  managerUninstallSystemUnitCommand
7413
7413
  };
7414
- //# sourceMappingURL=chunk-MDD7H7EP.js.map
7414
+ //# sourceMappingURL=chunk-MY5HPJUW.js.map
@@ -42,7 +42,7 @@ import {
42
42
  resolveEffectivePinRaw,
43
43
  safeWriteJsonAtomic,
44
44
  setConfigHash
45
- } from "../chunk-MDD7H7EP.js";
45
+ } from "../chunk-MY5HPJUW.js";
46
46
  import {
47
47
  getProjectDir as getProjectDir2,
48
48
  getReadyTasks,
@@ -1726,12 +1726,22 @@ var WINDOW_EXEMPT_RESTART_REASONS = /* @__PURE__ */ new Set([
1726
1726
  "sender-policy-change",
1727
1727
  "channel-mcp-down"
1728
1728
  ]);
1729
+ var RESTART_WINDOW_DEFER_ESCALATE_AFTER = 20;
1730
+ function shouldRelaxRestartWindowGate(deferStreak) {
1731
+ return deferStreak >= RESTART_WINDOW_DEFER_ESCALATE_AFTER;
1732
+ }
1733
+ function nextWindowDeferStreak(priorStreak, decision) {
1734
+ if (decision === "proceed") return 0;
1735
+ if (decision === "defer-window") return priorStreak + 1;
1736
+ return priorStreak;
1737
+ }
1729
1738
  function isWindowExemptRestartReason(reason) {
1730
1739
  return reason != null && WINDOW_EXEMPT_RESTART_REASONS.has(reason);
1731
1740
  }
1732
1741
  function decideRestartGate(opts) {
1733
1742
  if (isMaintenanceWindowDisabled(opts.env)) return "proceed";
1734
- if (!opts.windowExempt && opts.window && !isWithinMaintenanceWindow(opts.window, opts.now)) {
1743
+ const windowAxisApplies = !opts.windowExempt && !shouldRelaxRestartWindowGate(opts.windowDeferStreak ?? 0);
1744
+ if (windowAxisApplies && opts.window && !isWithinMaintenanceWindow(opts.window, opts.now)) {
1735
1745
  return "defer-window";
1736
1746
  }
1737
1747
  const paneThreshold = opts.idleThresholdSeconds ?? RESTART_IDLE_THRESHOLD_SECONDS;
@@ -9299,6 +9309,7 @@ function transcriptAgeSecondsFor(codeName) {
9299
9309
  const sessionId = getSessionState(codeName)?.currentSessionId ?? null;
9300
9310
  return transcriptActivityAgeSeconds(getProjectDir2(codeName), sessionId, /* @__PURE__ */ new Date());
9301
9311
  }
9312
+ var restartGateDeferStreaks = /* @__PURE__ */ new Map();
9302
9313
  function restartGateFor(codeName, reason) {
9303
9314
  if (!isGateableRestartReason(reason)) return "bypass";
9304
9315
  const tzInputs = agentRestartTimezoneInputs.get(codeName);
@@ -9311,16 +9322,28 @@ function restartGateFor(codeName, reason) {
9311
9322
  tzInputs?.agentTimezoneExpiresAt ?? null
9312
9323
  )
9313
9324
  } : cachedMaintenanceWindow;
9314
- return decideRestartGate({
9325
+ const streakKey = `${codeName}::${reason}`;
9326
+ const priorStreak = restartGateDeferStreaks.get(streakKey) ?? 0;
9327
+ const decision = decideRestartGate({
9315
9328
  window: perAgentWindow,
9316
9329
  // ENG-6491: channel adds (channel-set-change) skip the off-peak window but
9317
9330
  // still defer-until-idle — they come online as soon as the agent is quiet.
9318
9331
  windowExempt: isWindowExemptRestartReason(reason),
9332
+ windowDeferStreak: priorStreak,
9319
9333
  paneLogAgeSeconds: paneLogAgeSecondsFor(codeName),
9320
9334
  transcriptAgeSeconds: transcriptAgeSecondsFor(codeName),
9321
9335
  inboundAgeSeconds: inboundAgeSecondsFor(codeName),
9322
9336
  now: /* @__PURE__ */ new Date()
9323
9337
  });
9338
+ const nextStreak = nextWindowDeferStreak(priorStreak, decision);
9339
+ if (nextStreak === 0) restartGateDeferStreaks.delete(streakKey);
9340
+ else restartGateDeferStreaks.set(streakKey, nextStreak);
9341
+ if (nextStreak === RESTART_WINDOW_DEFER_ESCALATE_AFTER && nextStreak !== priorStreak) {
9342
+ log(
9343
+ `[maintenance-window] '${codeName}': '${reason}' restart deferred ${nextStreak}\xD7 by the window \u2014 dropping the maintenance-window wait (ENG-8224). Still defer-until-idle: it will fire on the next quiet gap, never mid-turn.`
9344
+ );
9345
+ }
9346
+ return decision;
9324
9347
  }
9325
9348
  function isHostBusyForForcedUpdate(opts) {
9326
9349
  const now = /* @__PURE__ */ new Date();
@@ -9787,7 +9810,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9787
9810
  var lastVersionCheckAt = 0;
9788
9811
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9789
9812
  var lastResponsivenessProbeAt = 0;
9790
- var agtCliVersion = true ? "0.28.449" : "dev";
9813
+ var agtCliVersion = true ? "0.28.451" : "dev";
9791
9814
  function resolveBrewPath(execFileSync2) {
9792
9815
  try {
9793
9816
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();