@integrity-labs/agt-cli 0.28.1140 → 0.28.1141

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-DRAZDG3U.js";
43
+ } from "../chunk-6WHFJSXT.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
@@ -5474,7 +5474,7 @@ import { execFileSync, execSync } from "child_process";
5474
5474
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5475
5475
  import chalk18 from "chalk";
5476
5476
  import ora16 from "ora";
5477
- var cliVersion = true ? "0.28.1140" : "dev";
5477
+ var cliVersion = true ? "0.28.1141" : "dev";
5478
5478
  async function fetchLatestVersion() {
5479
5479
  const host2 = getHost();
5480
5480
  if (!host2) return null;
@@ -6734,7 +6734,7 @@ function handleError(err) {
6734
6734
  }
6735
6735
 
6736
6736
  // src/bin/agt.ts
6737
- var cliVersion2 = true ? "0.28.1140" : "dev";
6737
+ var cliVersion2 = true ? "0.28.1141" : "dev";
6738
6738
  var program = new Command();
6739
6739
  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");
6740
6740
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -8076,7 +8076,7 @@ function exchangeFailureKind(err) {
8076
8076
  }
8077
8077
 
8078
8078
  // src/lib/api-client.ts
8079
- var agtCliVersion = true ? "0.28.1140" : "dev";
8079
+ var agtCliVersion = true ? "0.28.1141" : "dev";
8080
8080
  var lastConfigHash = null;
8081
8081
  function setConfigHash(hash) {
8082
8082
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -13227,4 +13227,4 @@ export {
13227
13227
  managerInstallSystemUnitCommand,
13228
13228
  managerUninstallSystemUnitCommand
13229
13229
  };
13230
- //# sourceMappingURL=chunk-DRAZDG3U.js.map
13230
+ //# sourceMappingURL=chunk-6WHFJSXT.js.map
@@ -76,7 +76,7 @@ import {
76
76
  setConfigHash,
77
77
  shellGuard,
78
78
  tripClass
79
- } from "../chunk-DRAZDG3U.js";
79
+ } from "../chunk-6WHFJSXT.js";
80
80
  import {
81
81
  getProjectDir as getProjectDir2,
82
82
  getReadyTasks,
@@ -343,6 +343,8 @@ var HostNodeConvergence = class {
343
343
  }
344
344
  converged = /* @__PURE__ */ new Set();
345
345
  abandoned = /* @__PURE__ */ new Set();
346
+ /** Pins this platform cannot install at all; see {@link recordUnsupported}. */
347
+ unsupported = /* @__PURE__ */ new Set();
346
348
  failures = /* @__PURE__ */ new Map();
347
349
  retryAfter = /* @__PURE__ */ new Map();
348
350
  /**
@@ -383,6 +385,7 @@ var HostNodeConvergence = class {
383
385
  this.lastDesired = pin;
384
386
  this.converged.clear();
385
387
  this.abandoned.clear();
388
+ this.unsupported.clear();
386
389
  this.failures.clear();
387
390
  this.retryAfter.clear();
388
391
  }
@@ -393,6 +396,7 @@ var HostNodeConvergence = class {
393
396
  stateOf(pin, now = Date.now()) {
394
397
  if (this.converged.has(pin)) return "converged";
395
398
  if (this.abandoned.has(pin)) return "abandoned";
399
+ if (this.unsupported.has(pin)) return "unsupported";
396
400
  if ((this.retryAfter.get(pin) ?? 0) > now) return "cooling";
397
401
  return "ready";
398
402
  }
@@ -447,6 +451,20 @@ var HostNodeConvergence = class {
447
451
  this.failures.delete(pin);
448
452
  this.retryAfter.delete(pin);
449
453
  }
454
+ /**
455
+ * The pin cannot be installed on this platform (no `dnf`). Terminal, so it
456
+ * stops further attempts exactly as success does — hammering an impossible
457
+ * install every poll is worse than stopping — but it reports as itself.
458
+ *
459
+ * Carries the same staleness guard as {@link recordSuccess}: a late call for
460
+ * a superseded pin must not write a conclusion about the pin now wanted.
461
+ */
462
+ recordUnsupported(pin) {
463
+ if (this.lastDesired !== null && pin !== this.lastDesired) return;
464
+ this.unsupported.add(pin);
465
+ this.failures.delete(pin);
466
+ this.retryAfter.delete(pin);
467
+ }
450
468
  /**
451
469
  * An attempt failed. Returns the resulting state so the caller can log the
452
470
  * right thing: 'cooling' means it will retry, 'abandoned' means it will not.
@@ -500,12 +518,32 @@ function normalizeReportedNodeVersion(raw) {
500
518
  return HOST_NODE_PIN_VERSION_RE.test(v) ? v : null;
501
519
  }
502
520
  function parsePathNodeVersion(stdout) {
503
- const m = /^v?(\d+\.\d+\.\d+)/.exec(stdout.trim());
521
+ const m = /^v?(\d+\.\d+\.\d+)$/.exec(stdout.trim());
504
522
  return m ? normalizeReportedNodeVersion(m[1]) : null;
505
523
  }
506
524
  function parseRpmNodeVersion(stdout) {
507
525
  return normalizeReportedNodeVersion(stdout.trim());
508
526
  }
527
+ var RPM_NODE_QUERY_ARGV = ["-q", "--qf", "%{VERSION}", "nodejs"];
528
+ var PATH_NODE_QUERY_ARGV = ["--version"];
529
+ async function probeOrNull(probe) {
530
+ try {
531
+ return await probe();
532
+ } catch {
533
+ return null;
534
+ }
535
+ }
536
+ async function probeHostNode(run) {
537
+ const pathVersion = await probeOrNull(async () => {
538
+ const probe = await run("node", [...PATH_NODE_QUERY_ARGV]);
539
+ return probe.code === 0 ? parsePathNodeVersion(probe.stdout) : null;
540
+ });
541
+ const rpmVersion = await probeOrNull(async () => {
542
+ const rpm = await run("rpm", [...RPM_NODE_QUERY_ARGV]);
543
+ return rpm.code === 0 ? parseRpmNodeVersion(rpm.stdout) : null;
544
+ });
545
+ return { pathVersion, rpmVersion };
546
+ }
509
547
  function heartbeatHostNodeFields(observation, pin, pinState) {
510
548
  if (!observation) return {};
511
549
  return {
@@ -15448,7 +15486,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
15448
15486
  var lastVersionCheckAt = 0;
15449
15487
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
15450
15488
  var lastResponsivenessProbeAt = 0;
15451
- var agtCliVersion = true ? "0.28.1140" : "dev";
15489
+ var agtCliVersion = true ? "0.28.1141" : "dev";
15452
15490
  function resolveBrewPath(execFileSync3) {
15453
15491
  try {
15454
15492
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -15633,22 +15671,18 @@ async function diskNodeVersion() {
15633
15671
  }
15634
15672
  var hostNodeObservation = null;
15635
15673
  var hostNodeObservedAt = 0;
15636
- async function probeOrNull(probe) {
15637
- try {
15638
- return await probe();
15639
- } catch {
15640
- return null;
15674
+ function invalidateHostNodeObservation(pathVersion) {
15675
+ hostNodeObservedAt = 0;
15676
+ if (pathVersion !== void 0 && hostNodeObservation) {
15677
+ hostNodeObservation = { ...hostNodeObservation, pathVersion };
15641
15678
  }
15642
15679
  }
15643
15680
  async function refreshHostNodeObservation(now = Date.now()) {
15644
15681
  if (!shouldReprobeHostNode(hostNodeObservedAt, now)) return;
15645
15682
  hostNodeObservedAt = now;
15646
- const pathVersion = await probeOrNull(() => diskNodeVersion());
15647
- const rpmVersion = await probeOrNull(async () => {
15648
- const rpm = await runAsync("rpm", ["-q", "--qf", "%{VERSION}", "nodejs"], { timeout: 15e3 });
15649
- return rpm.code === 0 ? parseRpmNodeVersion(rpm.stdout) : null;
15650
- });
15651
- hostNodeObservation = { pathVersion, rpmVersion };
15683
+ hostNodeObservation = await probeHostNode(
15684
+ (cmd, args) => runAsync(cmd, args, { timeout: 15e3 })
15685
+ );
15652
15686
  }
15653
15687
  async function ensureHostNodeVersion(rawPin) {
15654
15688
  const pin = normalizeHostNodePinVersion(rawPin);
@@ -15678,7 +15712,7 @@ async function ensureHostNodeVersion(rawPin) {
15678
15712
  hostNodeNoDnfLogged = true;
15679
15713
  log(`[host-node] 'dnf' not found - cannot converge host Node onto ${pin} on this platform (leaving ${current ?? "unknown"} in place)`);
15680
15714
  }
15681
- hostNodeConvergence.recordSuccess(pin);
15715
+ hostNodeConvergence.recordUnsupported(pin);
15682
15716
  return;
15683
15717
  }
15684
15718
  const asRoot = typeof process.getuid === "function" && process.getuid() === 0;
@@ -15699,6 +15733,7 @@ async function ensureHostNodeVersion(rawPin) {
15699
15733
  }
15700
15734
  log(`[host-node] host Node is now ${pin} on disk. Running processes keep the previous binary until they restart - this does NOT restart the manager (ENG-11617).`);
15701
15735
  hostNodeConvergence.recordSuccess(pin);
15736
+ invalidateHostNodeObservation(after);
15702
15737
  } catch (err) {
15703
15738
  recordHostNodeFailure(pin, `install attempt threw: ${isolationImageErrDetail(err)}`);
15704
15739
  } finally {