@integrity-labs/agt-cli 0.28.672 → 0.28.673

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-EX6INJDG.js";
43
+ } from "../chunk-RSERKOS7.js";
44
44
  import {
45
45
  readDirectChatSessionState
46
46
  } from "../chunk-YAVWYI5S.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.672" : "dev";
4912
+ var cliVersion = true ? "0.28.673" : "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.672" : "dev";
6092
+ var cliVersion2 = true ? "0.28.673" : "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) => {
@@ -6292,7 +6292,7 @@ function exchangeFailureKind(err) {
6292
6292
  }
6293
6293
 
6294
6294
  // src/lib/api-client.ts
6295
- var agtCliVersion = true ? "0.28.672" : "dev";
6295
+ var agtCliVersion = true ? "0.28.673" : "dev";
6296
6296
  var lastConfigHash = null;
6297
6297
  function setConfigHash(hash) {
6298
6298
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -10033,4 +10033,4 @@ export {
10033
10033
  managerInstallSystemUnitCommand,
10034
10034
  managerUninstallSystemUnitCommand
10035
10035
  };
10036
- //# sourceMappingURL=chunk-EX6INJDG.js.map
10036
+ //# sourceMappingURL=chunk-RSERKOS7.js.map
@@ -54,7 +54,7 @@ import {
54
54
  safeWriteJsonAtomic,
55
55
  setConfigHash,
56
56
  tripClass
57
- } from "../chunk-EX6INJDG.js";
57
+ } from "../chunk-RSERKOS7.js";
58
58
  import {
59
59
  getProjectDir as getProjectDir2,
60
60
  getReadyTasks,
@@ -11824,7 +11824,7 @@ function runPendingForcedUpdate() {
11824
11824
  }
11825
11825
  return false;
11826
11826
  }
11827
- if (selfUpdateInFlight) {
11827
+ if (selfUpdateLatchVerdict(selfUpdateInFlightSince, Date.now()) === "held") {
11828
11828
  log(
11829
11829
  `[self-update] "Update CLI now" requested at ${requestedUpdateAt} \u2014 deferring: a self-update is already in flight. Retrying next poll.`
11830
11830
  );
@@ -12265,7 +12265,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
12265
12265
  var lastVersionCheckAt = 0;
12266
12266
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12267
12267
  var lastResponsivenessProbeAt = 0;
12268
- var agtCliVersion = true ? "0.28.672" : "dev";
12268
+ var agtCliVersion = true ? "0.28.673" : "dev";
12269
12269
  function resolveBrewPath(execFileSync3) {
12270
12270
  try {
12271
12271
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -12780,14 +12780,35 @@ var selfUpdatePinInvalidLogged = false;
12780
12780
  var restartAfterUpgrade = false;
12781
12781
  var pendingUpgradeVersion = null;
12782
12782
  var selfUpdateInFlight = false;
12783
+ var selfUpdateInFlightSince = null;
12784
+ var SELF_UPDATE_LATCH_MAX_HOLD_MS = 20 * 6e4;
12785
+ function selfUpdateLatchVerdict(heldSince, now, maxHoldMs = SELF_UPDATE_LATCH_MAX_HOLD_MS) {
12786
+ if (heldSince === null) return "free";
12787
+ const heldMs = now - heldSince;
12788
+ return heldMs >= maxHoldMs ? "expired" : "held";
12789
+ }
12783
12790
  var upgradeRestartInitiated = false;
12784
12791
  var cachedUpdateRequestedAt = null;
12785
12792
  var forcedUpdateDeferStreak = 0;
12786
12793
  var forcedUpdateRelaxAnnounced = false;
12787
12794
  async function checkAndUpdateCli(opts) {
12788
12795
  const force = opts?.force ?? false;
12789
- if (selfUpdateInFlight) return "failed";
12796
+ const verdict = selfUpdateLatchVerdict(selfUpdateInFlightSince, Date.now());
12797
+ if (verdict === "held") {
12798
+ const heldSec = Math.round((Date.now() - (selfUpdateInFlightSince ?? Date.now())) / 1e3);
12799
+ log(
12800
+ `[self-update] deferring: a self-update has been in flight for ${heldSec}s. Retrying next poll; the latch breaks at ${Math.round(SELF_UPDATE_LATCH_MAX_HOLD_MS / 6e4)}m.`
12801
+ );
12802
+ return "failed";
12803
+ }
12804
+ if (verdict === "expired") {
12805
+ const heldMin = Math.round((Date.now() - (selfUpdateInFlightSince ?? Date.now())) / 6e4);
12806
+ console.warn(
12807
+ `[manager-worker] [self-update] WEDGE: the in-flight latch has been held for ${heldMin}m, past the ${Math.round(SELF_UPDATE_LATCH_MAX_HOLD_MS / 6e4)}m bound. Breaking it and proceeding \u2014 the previous updater never settled (ENG-8624).`
12808
+ );
12809
+ }
12790
12810
  selfUpdateInFlight = true;
12811
+ selfUpdateInFlightSince = Date.now();
12791
12812
  try {
12792
12813
  const cliPath = process.argv[1] ?? "";
12793
12814
  const isDevMode = cliPath.includes("/src/") || cliPath.includes("tsx");
@@ -12822,6 +12843,7 @@ async function checkAndUpdateCli(opts) {
12822
12843
  return outcome;
12823
12844
  } finally {
12824
12845
  selfUpdateInFlight = false;
12846
+ selfUpdateInFlightSince = null;
12825
12847
  }
12826
12848
  }
12827
12849
  async function checkAndUpdateCliViaBrew(force = false) {
@@ -19787,6 +19809,7 @@ export {
19787
19809
  REALTIME_REBIND_IN_FLIGHT_GRACE_MS,
19788
19810
  REALTIME_REBIND_MAX_BACKOFF_MS,
19789
19811
  REALTIME_REBIND_STUCK_AFTER_MS,
19812
+ SELF_UPDATE_LATCH_MAX_HOLD_MS,
19790
19813
  UntrustworthyToolkitResponseError,
19791
19814
  applyMemoryTombstones,
19792
19815
  applyRestartAcks,
@@ -19830,6 +19853,7 @@ export {
19830
19853
  restartReasonBindsNewMcp,
19831
19854
  retiredMemoryDir,
19832
19855
  sameChannelSet,
19856
+ selfUpdateLatchVerdict,
19833
19857
  shouldLogChannelSyncFailure,
19834
19858
  shouldReapOnRetag,
19835
19859
  shouldReportRestartToAudit,