@integrity-labs/agt-cli 0.28.335 → 0.28.337

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.
@@ -14,6 +14,7 @@ import {
14
14
  classifyEnvIntegrationsDiff,
15
15
  clearPresenceReaperState,
16
16
  clearPresenceReaperStateForKeys,
17
+ decidePin,
17
18
  defaultFlagsCachePath,
18
19
  deriveMcpServerKey,
19
20
  diffEnvIntegrations,
@@ -29,6 +30,7 @@ import {
29
30
  getHostId,
30
31
  givenUpMcpServerKeys,
31
32
  liveProxyExtraHeaderVars,
33
+ pinAllowsUrgent,
32
34
  provision,
33
35
  provisionAutoKanbanProgressHook,
34
36
  provisionChannelProgressHook,
@@ -43,7 +45,7 @@ import {
43
45
  requireHost,
44
46
  safeWriteJsonAtomic,
45
47
  setConfigHash
46
- } from "../chunk-VJYEJQDY.js";
48
+ } from "../chunk-N7XPDFCW.js";
47
49
  import {
48
50
  getProjectDir as getProjectDir2,
49
51
  getReadyTasks,
@@ -8386,7 +8388,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
8386
8388
  var lastVersionCheckAt = 0;
8387
8389
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
8388
8390
  var lastResponsivenessProbeAt = 0;
8389
- var agtCliVersion = true ? "0.28.335" : "dev";
8391
+ var agtCliVersion = true ? "0.28.337" : "dev";
8390
8392
  function resolveBrewPath(execFileSync2) {
8391
8393
  try {
8392
8394
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -8686,6 +8688,8 @@ function selfUpdateAppliedMarkerPath() {
8686
8688
  return join21(homedir11(), ".augmented", ".last-self-update-applied");
8687
8689
  }
8688
8690
  var selfUpdateUpToDateLogged = false;
8691
+ var selfUpdatePinnedLogged = false;
8692
+ var selfUpdatePinInvalidLogged = false;
8689
8693
  var restartAfterUpgrade = false;
8690
8694
  var pendingUpgradeVersion = null;
8691
8695
  var selfUpdateInFlight = false;
@@ -8733,6 +8737,25 @@ async function checkAndUpdateCliViaBrew(force = false) {
8733
8737
  const { execFileSync: execFileSync2 } = await import("child_process");
8734
8738
  const brewPath = resolveBrewPath(execFileSync2);
8735
8739
  if (!brewPath) return "noop";
8740
+ {
8741
+ const brewPin = decidePin({ installed: agtCliVersion, pinRaw: process.env.AGT_CLI_PIN_VERSION });
8742
+ if (brewPin.kind === "satisfied") {
8743
+ if (!selfUpdatePinnedLogged) {
8744
+ log(`[self-update] agt CLI pinned to ${brewPin.version} (AGT_CLI_PIN_VERSION); already satisfied on this brew install.`);
8745
+ selfUpdatePinnedLogged = true;
8746
+ }
8747
+ return "noop";
8748
+ }
8749
+ if (brewPin.kind === "install") {
8750
+ if (!selfUpdatePinnedLogged) {
8751
+ log(
8752
+ `[self-update] agt CLI is pinned to ${brewPin.version} (AGT_CLI_PIN_VERSION) but this is a Homebrew install (currently ${agtCliVersion}); brew can't install an exact version, so the pin CANNOT be satisfied here. Not upgrading. Switch to the npm-global install (or hold the formula) to pin exactly.`
8753
+ );
8754
+ selfUpdatePinnedLogged = true;
8755
+ }
8756
+ return "noop";
8757
+ }
8758
+ }
8736
8759
  let metadataFresh = true;
8737
8760
  try {
8738
8761
  execFileSync2(brewPath, ["update", "--quiet"], { timeout: 6e4, stdio: "pipe" });
@@ -8800,6 +8823,44 @@ async function checkAndUpdateCliViaBrew(force = false) {
8800
8823
  async function checkAndUpdateCliViaNpm(force = false) {
8801
8824
  if (agtCliVersion === "dev") return "noop";
8802
8825
  const channel = process.env.AGT_CLI_RELEASE_CHANNEL || "latest";
8826
+ const pinRaw = process.env.AGT_CLI_PIN_VERSION;
8827
+ const pinDecision = decidePin({ installed: agtCliVersion, pinRaw });
8828
+ if (pinDecision.kind === "invalid") {
8829
+ if (!selfUpdatePinInvalidLogged) {
8830
+ log(
8831
+ `[self-update] AGT_CLI_PIN_VERSION="${pinDecision.raw}" is not a valid version; ignoring the pin and tracking channel=${channel} as usual.`
8832
+ );
8833
+ selfUpdatePinInvalidLogged = true;
8834
+ }
8835
+ } else if (pinDecision.kind !== "unpinned") {
8836
+ if (pinAllowsUrgent(process.env.AGT_CLI_PIN_ALLOW_URGENT)) {
8837
+ const urgentTarget2 = await fetchUrgentDistTagVersion();
8838
+ if (urgentTarget2 && urgentTarget2 === agtCliVersion) {
8839
+ return "noop";
8840
+ }
8841
+ if (isUrgentUpgrade({
8842
+ urgentTarget: urgentTarget2,
8843
+ installed: agtCliVersion,
8844
+ isNewer: (installed, candidate) => candidate !== installed && !isOlderSemverTuple(installed, candidate)
8845
+ })) {
8846
+ log(
8847
+ `[self-update] URGENT agt CLI hotfix ${agtCliVersion} \u2192 ${urgentTarget2} overrides pin=${pinDecision.version} (AGT_CLI_PIN_ALLOW_URGENT). Upgrading via npm...`
8848
+ );
8849
+ return await installAgtCliViaNpm(urgentTarget2, "urgent(pin-allow-urgent)");
8850
+ }
8851
+ }
8852
+ if (pinDecision.kind === "satisfied") {
8853
+ if (!selfUpdatePinnedLogged) {
8854
+ log(`[self-update] agt CLI pinned to ${pinDecision.version} (AGT_CLI_PIN_VERSION); up to date.`);
8855
+ selfUpdatePinnedLogged = true;
8856
+ }
8857
+ return "noop";
8858
+ }
8859
+ log(
8860
+ `[self-update] agt CLI pinned to ${pinDecision.version} (AGT_CLI_PIN_VERSION); installing exact version (${agtCliVersion} \u2192 ${pinDecision.version})...`
8861
+ );
8862
+ return await installAgtCliViaNpm(pinDecision.version, `pin=${pinDecision.version}`);
8863
+ }
8803
8864
  let latest;
8804
8865
  try {
8805
8866
  const res = await fetch(