@integrity-labs/agt-cli 0.28.824 → 0.28.825

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-LPCKIZS4.js";
43
+ } from "../chunk-QICBWFRI.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
@@ -5467,7 +5467,7 @@ import { execFileSync, execSync } from "child_process";
5467
5467
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5468
5468
  import chalk18 from "chalk";
5469
5469
  import ora16 from "ora";
5470
- var cliVersion = true ? "0.28.824" : "dev";
5470
+ var cliVersion = true ? "0.28.825" : "dev";
5471
5471
  async function fetchLatestVersion() {
5472
5472
  const host2 = getHost();
5473
5473
  if (!host2) return null;
@@ -6658,7 +6658,7 @@ function handleError(err) {
6658
6658
  }
6659
6659
 
6660
6660
  // src/bin/agt.ts
6661
- var cliVersion2 = true ? "0.28.824" : "dev";
6661
+ var cliVersion2 = true ? "0.28.825" : "dev";
6662
6662
  var program = new Command();
6663
6663
  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");
6664
6664
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6523,7 +6523,7 @@ function exchangeFailureKind(err) {
6523
6523
  }
6524
6524
 
6525
6525
  // src/lib/api-client.ts
6526
- var agtCliVersion = true ? "0.28.824" : "dev";
6526
+ var agtCliVersion = true ? "0.28.825" : "dev";
6527
6527
  var lastConfigHash = null;
6528
6528
  function setConfigHash(hash) {
6529
6529
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -10830,4 +10830,4 @@ export {
10830
10830
  managerInstallSystemUnitCommand,
10831
10831
  managerUninstallSystemUnitCommand
10832
10832
  };
10833
- //# sourceMappingURL=chunk-LPCKIZS4.js.map
10833
+ //# sourceMappingURL=chunk-QICBWFRI.js.map
@@ -0,0 +1,19 @@
1
+ // src/lib/claude-code-brew-result.ts
2
+ var NOT_INSTALLED_RE = /is not installed/i;
3
+ function caskPresenceFromListResult(r) {
4
+ if (r.code === 0) return "present";
5
+ return NOT_INSTALLED_RE.test(`${r.stdout}
6
+ ${r.stderr}`) ? "absent" : "unknown";
7
+ }
8
+ function classifyBrewUpgradeResult(r) {
9
+ const combined = `${r.stdout}
10
+ ${r.stderr}`;
11
+ const noWorkNeeded = combined.includes("already installed") || combined.includes("up-to-date") || combined.includes("not upgraded");
12
+ if (r.code === 0) return noWorkNeeded ? "already-current" : "upgraded";
13
+ return noWorkNeeded ? "already-current" : "failed";
14
+ }
15
+ export {
16
+ caskPresenceFromListResult,
17
+ classifyBrewUpgradeResult
18
+ };
19
+ //# sourceMappingURL=claude-code-brew-result-3A4E7GTC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/claude-code-brew-result.ts"],"sourcesContent":["// ENG-10039: how to read the result of the LEGACY `brew --cask claude-code`\n// path, extracted so it can be tested without importing manager-worker.\n//\n// Same reason `claude-code-upgrade-throttle.ts` was split out under ENG-6418:\n// manager-worker is a 13k-line import graph, evaluating it inside a test's\n// budget flakes under parallel load, so the load-bearing judgement lives here\n// and manager-worker calls it.\n//\n// WHAT WENT WRONG, and it is why this is a module rather than two inline\n// conditionals. On every host provisioned since Claude Code moved to\n// `npm install -g @anthropic-ai/claude-code` (host-bootstrap.ts), there is no\n// Homebrew cask. The manager ran `brew upgrade --cask claude-code` anyway,\n// because its only precondition was \"is there a `claude` on PATH\" — and there\n// is one, at `/usr/bin/claude`, put there by npm. So the upgrade failed with\n// `Error: Cask 'claude-code' is not installed.` every day, on 7 of 10 hosts\n// measured, oldest at least 9 days (the full retained-log window on agt-aws-1:\n// 9 attempts, 9 failures, zero successes).\n//\n// It was invisible because it is only a log line: no alert kind covers it.\n\n/**\n * What `brew list --cask claude-code` actually told us.\n *\n * THREE STATES, NOT TWO, and the third is the one that matters (CodeRabbit on\n * #5616). `runAsync` RESOLVES with a non-zero exit code rather than rejecting,\n * and Homebrew uses non-zero exits for operational errors too — a network\n * failure, a lock, a broken tap. Mapping every non-zero code to `absent` would\n * read a transient brew error as \"this host has no cask\", skip the upgrade, and\n * because the throttle marker is stamped BEFORE the probe, suppress any retry\n * for ~24h. On a genuine cask host that is a silent missed upgrade, which is\n * the same invisible-skip shape this whole ticket exists to remove.\n *\n * So `absent` is claimed ONLY on brew's specific not-installed message.\n * Everything else non-zero is `unknown`: skip this cycle, say so, try again on\n * the next in-window poll.\n */\nexport type CaskPresence = 'present' | 'absent' | 'unknown';\n\n/**\n * Brew's wording for a cask that is not installed, e.g.\n * Error: Cask 'claude-code' is not installed.\n * Matched loosely on the stable half of the sentence rather than the whole\n * line, because the cask name is interpolated and brew has moved the\n * surrounding punctuation before.\n */\nconst NOT_INSTALLED_RE = /is not installed/i;\n\nexport function caskPresenceFromListResult(r: {\n code: number;\n stdout: string;\n stderr: string;\n}): CaskPresence {\n if (r.code === 0) return 'present';\n return NOT_INSTALLED_RE.test(`${r.stdout}\\n${r.stderr}`) ? 'absent' : 'unknown';\n}\n\nexport type BrewUpgradeVerdict = 'upgraded' | 'already-current' | 'failed';\n\n/**\n * Classify a `brew upgrade --cask claude-code` run.\n *\n * THE NON-ZERO-BUT-FINE CASE IS REAL, not defensive padding: brew exits\n * non-zero while printing `already installed` / `up-to-date` / `not upgraded`\n * for a cask that needs no work. Treating that as a failure would have made\n * this monitor cry wolf on exactly the hosts where nothing is wrong, and a\n * version check that cries wolf gets muted — after which it is worth less than\n * nothing, because everyone now believes the case is covered.\n *\n * Both streams are searched because brew is inconsistent about which one\n * carries the notice, and the auto-update banner interleaves them.\n */\nexport function classifyBrewUpgradeResult(r: {\n code: number;\n stdout: string;\n stderr: string;\n}): BrewUpgradeVerdict {\n const combined = `${r.stdout}\\n${r.stderr}`;\n const noWorkNeeded =\n combined.includes('already installed') ||\n combined.includes('up-to-date') ||\n combined.includes('not upgraded');\n\n if (r.code === 0) return noWorkNeeded ? 'already-current' : 'upgraded';\n return noWorkNeeded ? 'already-current' : 'failed';\n}\n"],"mappings":";AA6CA,IAAM,mBAAmB;AAElB,SAAS,2BAA2B,GAI1B;AACf,MAAI,EAAE,SAAS,EAAG,QAAO;AACzB,SAAO,iBAAiB,KAAK,GAAG,EAAE,MAAM;AAAA,EAAK,EAAE,MAAM,EAAE,IAAI,WAAW;AACxE;AAiBO,SAAS,0BAA0B,GAInB;AACrB,QAAM,WAAW,GAAG,EAAE,MAAM;AAAA,EAAK,EAAE,MAAM;AACzC,QAAM,eACJ,SAAS,SAAS,mBAAmB,KACrC,SAAS,SAAS,YAAY,KAC9B,SAAS,SAAS,cAAc;AAElC,MAAI,EAAE,SAAS,EAAG,QAAO,eAAe,oBAAoB;AAC5D,SAAO,eAAe,oBAAoB;AAC5C;","names":[]}
@@ -59,7 +59,7 @@ import {
59
59
  safeWriteJsonAtomic,
60
60
  setConfigHash,
61
61
  tripClass
62
- } from "../chunk-LPCKIZS4.js";
62
+ } from "../chunk-QICBWFRI.js";
63
63
  import {
64
64
  getProjectDir as getProjectDir2,
65
65
  getReadyTasks,
@@ -13587,7 +13587,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
13587
13587
  var lastVersionCheckAt = 0;
13588
13588
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
13589
13589
  var lastResponsivenessProbeAt = 0;
13590
- var agtCliVersion = true ? "0.28.824" : "dev";
13590
+ var agtCliVersion = true ? "0.28.825" : "dev";
13591
13591
  function resolveBrewPath(execFileSync2) {
13592
13592
  try {
13593
13593
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -14073,20 +14073,43 @@ async function maybeUpgradeClaudeCode() {
14073
14073
  }
14074
14074
  return runAsync(brewPath, args, opts);
14075
14075
  };
14076
+ let proceedToUpgrade = false;
14077
+ let brewResult;
14078
+ try {
14079
+ brewResult = await import("../claude-code-brew-result-3A4E7GTC.js");
14080
+ const caskProbe = await runBrew(["list", "--cask", "claude-code"], { timeout: 6e4 });
14081
+ const presence = brewResult.caskPresenceFromListResult(caskProbe);
14082
+ proceedToUpgrade = presence === "present";
14083
+ if (presence === "absent") {
14084
+ log(
14085
+ "Claude Code is not installed as a Homebrew cask on this host, so the legacy brew upgrade path has nothing to upgrade \u2014 skipping it (ENG-10039). This is not an error. Where Claude Code was installed via npm, claude-code-updater (ENG-5672) keeps it current."
14086
+ );
14087
+ } else if (presence === "unknown") {
14088
+ log(
14089
+ `Claude Code cask probe inconclusive (exit ${caskProbe.code}), skipping this cycle (ENG-10039): ${(caskProbe.stderr || caskProbe.stdout).trim().slice(0, 200)}`
14090
+ );
14091
+ }
14092
+ } catch (err) {
14093
+ log(
14094
+ `Claude Code cask probe failed, skipping this cycle (ENG-10039): ${err instanceof Error ? err.message : String(err)}`
14095
+ );
14096
+ } finally {
14097
+ if (!proceedToUpgrade) claudeCodeUpgradeInFlight = false;
14098
+ }
14099
+ if (!proceedToUpgrade || !brewResult) return;
14100
+ const { classifyBrewUpgradeResult } = brewResult;
14076
14101
  log(`Checking for Claude Code updates in background${isRoot ? " (as ec2-user via sudo)" : ""}...`);
14077
14102
  runBrew(["upgrade", "--cask", "claude-code"], { timeout: 12e4 }).then((r) => {
14078
- const combined = `${r.stdout}
14079
- ${r.stderr}`;
14080
- if (r.code === 0) {
14081
- if (combined.includes("already installed") || combined.includes("up-to-date")) {
14103
+ switch (classifyBrewUpgradeResult(r)) {
14104
+ case "already-current":
14082
14105
  log("Claude Code is already up to date");
14083
- } else {
14106
+ break;
14107
+ case "upgraded":
14084
14108
  log("Claude Code upgraded successfully (will apply on next session start)");
14085
- }
14086
- } else if (combined.includes("already installed") || combined.includes("up-to-date") || combined.includes("not upgraded")) {
14087
- log("Claude Code is already up to date");
14088
- } else {
14089
- log(`Claude Code upgrade failed (exit ${r.code}): ${r.stderr.trim() || r.stdout.trim()}`);
14109
+ break;
14110
+ case "failed":
14111
+ log(`Claude Code upgrade failed (exit ${r.code}): ${r.stderr.trim() || r.stdout.trim()}`);
14112
+ break;
14090
14113
  }
14091
14114
  }).catch((err) => log(`Claude Code upgrade failed: ${err.message}`)).finally(() => {
14092
14115
  claudeCodeUpgradeInFlight = false;