@integrity-labs/agt-cli 0.28.784 → 0.28.785

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-VY6C5UIH.js";
43
+ } from "../chunk-7DP5AYK4.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.784" : "dev";
5470
+ var cliVersion = true ? "0.28.785" : "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.784" : "dev";
6661
+ var cliVersion2 = true ? "0.28.785" : "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) => {
@@ -6518,7 +6518,7 @@ function exchangeFailureKind(err) {
6518
6518
  }
6519
6519
 
6520
6520
  // src/lib/api-client.ts
6521
- var agtCliVersion = true ? "0.28.784" : "dev";
6521
+ var agtCliVersion = true ? "0.28.785" : "dev";
6522
6522
  var lastConfigHash = null;
6523
6523
  function setConfigHash(hash) {
6524
6524
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -10755,4 +10755,4 @@ export {
10755
10755
  managerInstallSystemUnitCommand,
10756
10756
  managerUninstallSystemUnitCommand
10757
10757
  };
10758
- //# sourceMappingURL=chunk-VY6C5UIH.js.map
10758
+ //# sourceMappingURL=chunk-7DP5AYK4.js.map
@@ -58,7 +58,7 @@ import {
58
58
  safeWriteJsonAtomic,
59
59
  setConfigHash,
60
60
  tripClass
61
- } from "../chunk-VY6C5UIH.js";
61
+ } from "../chunk-7DP5AYK4.js";
62
62
  import {
63
63
  getProjectDir as getProjectDir2,
64
64
  getReadyTasks,
@@ -2637,15 +2637,27 @@ async function maybeReportUsageBanner(args) {
2637
2637
  lastLimitScope: existing?.lastLimitScope ?? null,
2638
2638
  lastCheckedAt: nowMs,
2639
2639
  lastPostedAt: existing?.lastPostedAt ?? null,
2640
- consecutiveAbsences: existing?.consecutiveAbsences ?? 0
2640
+ consecutiveAbsences: existing?.consecutiveAbsences ?? 0,
2641
+ coldClearPosted: existing?.coldClearPosted ?? false
2641
2642
  };
2642
2643
  const observation = tail ? parseUsageBanner(scopeToCurrentPaneEpoch(tail), now) : null;
2643
2644
  if (!observation) {
2644
2645
  if (!existing || existing.lastPct === null) {
2645
- state.set(codeName, next);
2646
- return;
2646
+ if (!args.openUsageAlert) {
2647
+ state.set(codeName, next);
2648
+ return;
2649
+ }
2650
+ if (next.coldClearPosted) {
2651
+ state.set(codeName, next);
2652
+ return;
2653
+ }
2654
+ if ((existing?.consecutiveAbsences ?? 0) === 0) {
2655
+ log2(
2656
+ `[usage-banner] '${codeName}': no banner in the current pane epoch, but the control plane holds an open usage_limit_reached alert; counting absences from cold so the clear can be posted`
2657
+ );
2658
+ }
2647
2659
  }
2648
- next.consecutiveAbsences = (existing.consecutiveAbsences ?? 0) + 1;
2660
+ next.consecutiveAbsences = (existing?.consecutiveAbsences ?? 0) + 1;
2649
2661
  if (next.consecutiveAbsences < ABSENCE_CONFIRMATIONS) {
2650
2662
  state.set(codeName, next);
2651
2663
  return;
@@ -2661,9 +2673,9 @@ async function maybeReportUsageBanner(args) {
2661
2673
  // Carry the last known window so the row stays coherent with the one it
2662
2674
  // supersedes. The server short-circuits on `source` before it reasons
2663
2675
  // about this instant, so it is provenance, not an input to the decision.
2664
- week_resets_at: existing.lastWeekResetsAt ?? now.toISOString(),
2676
+ week_resets_at: existing?.lastWeekResetsAt ?? now.toISOString(),
2665
2677
  reset_precision: "unknown",
2666
- limit_scope: existing.lastLimitScope ?? "unknown",
2678
+ limit_scope: existing?.lastLimitScope ?? "unknown",
2667
2679
  // ENG-8631: the server keys its `banner_cleared` recovery off exactly
2668
2680
  // this string. `source` is a free-form text column, so this needs no
2669
2681
  // migration and an older API simply stores it and behaves as before.
@@ -2675,6 +2687,7 @@ async function maybeReportUsageBanner(args) {
2675
2687
  next.lastPct = null;
2676
2688
  next.lastWeekResetsAt = null;
2677
2689
  next.lastLimitScope = null;
2690
+ next.coldClearPosted = true;
2678
2691
  next.consecutiveAbsences = 0;
2679
2692
  next.lastPostedAt = nowMs;
2680
2693
  } catch (err) {
@@ -2686,6 +2699,7 @@ async function maybeReportUsageBanner(args) {
2686
2699
  return;
2687
2700
  }
2688
2701
  next.consecutiveAbsences = 0;
2702
+ next.coldClearPosted = false;
2689
2703
  const weekResetsAtIso = observation.weekResetsAt.toISOString();
2690
2704
  const unchanged = existing !== void 0 && existing.lastPct === observation.pct && existing.lastWeekResetsAt === weekResetsAtIso && existing.lastLimitScope === observation.limitScope;
2691
2705
  const dueToReaffirm = next.lastPostedAt === null || nowMs - next.lastPostedAt >= REAFFIRM_INTERVAL_MS;
@@ -13561,7 +13575,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
13561
13575
  var lastVersionCheckAt = 0;
13562
13576
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
13563
13577
  var lastResponsivenessProbeAt = 0;
13564
- var agtCliVersion = true ? "0.28.784" : "dev";
13578
+ var agtCliVersion = true ? "0.28.785" : "dev";
13565
13579
  function resolveBrewPath(execFileSync2) {
13566
13580
  try {
13567
13581
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -16271,7 +16285,13 @@ async function processAgent(agent, agentStates, managedToolkits) {
16271
16285
  api,
16272
16286
  codeName: agent.code_name,
16273
16287
  agentId: agent.agent_id,
16274
- log
16288
+ log,
16289
+ // ENG-9634: the monitor's last-seen-banner map is module memory and does
16290
+ // not survive a restart, and its clear POST is gated on having seen a
16291
+ // banner in THIS process. For a cap that already lifted there is no
16292
+ // banner left to see, so the gate could never re-open. This is the
16293
+ // memory it lost, carried on the roster we just polled.
16294
+ openUsageAlert: agent.usage_limit_alert_open === true
16275
16295
  });
16276
16296
  void maybeReportTokenUsage({
16277
16297
  api,