@integrity-labs/agt-cli 0.28.636 → 0.28.637

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,10 +40,10 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-KIOTRBOI.js";
43
+ } from "../chunk-3JBA6RYG.js";
44
44
  import {
45
45
  readDirectChatSessionState
46
- } from "../chunk-4HVSMJFM.js";
46
+ } from "../chunk-W4GVD3KK.js";
47
47
  import {
48
48
  AnchorSessionClient,
49
49
  CHANNEL_REGISTRY,
@@ -73,7 +73,7 @@ import {
73
73
  requiredMcpWildcard,
74
74
  resolveChannels,
75
75
  serializeManifestForSlackCli
76
- } from "../chunk-O4ADFO57.js";
76
+ } from "../chunk-JT2JQUK3.js";
77
77
  import "../chunk-XWVM4KPK.js";
78
78
 
79
79
  // src/bin/agt.ts
@@ -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.636" : "dev";
4912
+ var cliVersion = true ? "0.28.637" : "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.636" : "dev";
6092
+ var cliVersion2 = true ? "0.28.637" : "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) => {
@@ -7,7 +7,7 @@ import {
7
7
  expandTemplateVars,
8
8
  isolationMode,
9
9
  parseEnvIntegrations
10
- } from "./chunk-4HVSMJFM.js";
10
+ } from "./chunk-W4GVD3KK.js";
11
11
  import {
12
12
  BIND_FAILURE_QUARANTINE_THRESHOLD,
13
13
  INTEGRATIONS_SECTION_END,
@@ -21,6 +21,8 @@ import {
21
21
  RESTART_BREAKER_OPERATOR_MAX,
22
22
  RESTART_BREAKER_PROVISIONING_MAX,
23
23
  RESTART_BREAKER_PROVISIONING_WINDOW_MS,
24
+ RESTART_BREAKER_SCHEDULED_MAX,
25
+ RESTART_BREAKER_SCHEDULED_WINDOW_MS,
24
26
  SCRATCH_RETENTION_DAYS,
25
27
  SLACK_SOCKET_STATE_FILENAME,
26
28
  bestConnectivityEvidence,
@@ -52,7 +54,7 @@ import {
52
54
  resolveConnectivityProbe,
53
55
  worseConnectivityOutcome,
54
56
  wrapScheduledTaskPrompt
55
- } from "./chunk-O4ADFO57.js";
57
+ } from "./chunk-JT2JQUK3.js";
56
58
  import {
57
59
  parsePsRows
58
60
  } from "./chunk-XWVM4KPK.js";
@@ -6070,7 +6072,7 @@ function exchangeFailureKind(err) {
6070
6072
  }
6071
6073
 
6072
6074
  // src/lib/api-client.ts
6073
- var agtCliVersion = true ? "0.28.636" : "dev";
6075
+ var agtCliVersion = true ? "0.28.637" : "dev";
6074
6076
  var lastConfigHash = null;
6075
6077
  function setConfigHash(hash) {
6076
6078
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7466,7 +7468,12 @@ var KNOWN_REASON_CLASS_MAP = {
7466
7468
  // forced by the Record type, which is exactly why that shape was chosen over
7467
7469
  // a Set literal (ENG-7577, CodeRabbit on #3861) - a new union member cannot
7468
7470
  // be silently omitted from the rehydration allowlist.
7469
- "self-healing": true
7471
+ "self-healing": true,
7472
+ // ENG-9138: the platform-scheduled class. Same Record-not-Set reasoning: the
7473
+ // compiler forces every new class into this allowlist, so a `trippedClass`
7474
+ // rehydrated from manager-state.json can never name a class this build does
7475
+ // not know about.
7476
+ scheduled: true
7470
7477
  };
7471
7478
  var KNOWN_REASON_CLASSES = new Set(
7472
7479
  Object.keys(KNOWN_REASON_CLASS_MAP)
@@ -7507,6 +7514,12 @@ var SELF_HEALING_REASONS = /* @__PURE__ */ new Set([
7507
7514
  function isSelfHealingReason(reason) {
7508
7515
  return SELF_HEALING_REASONS.has(reason);
7509
7516
  }
7517
+ var SCHEDULED_REASONS = /* @__PURE__ */ new Set([
7518
+ "day-rollover"
7519
+ ]);
7520
+ function isScheduledRestartReason(reason) {
7521
+ return SCHEDULED_REASONS.has(reason);
7522
+ }
7510
7523
  var OPERATOR_CONFIG_REASONS = /* @__PURE__ */ new Set([
7511
7524
  "operator-integration-change"
7512
7525
  ]);
@@ -7520,6 +7533,7 @@ function restartReasonClass(reason) {
7520
7533
  if (isCredentialRotationReason(reason)) return "credential-rotation";
7521
7534
  if (isSelfHealingReason(reason)) return "self-healing";
7522
7535
  if (isOperatorConfigReason(reason)) return "operator-config";
7536
+ if (isScheduledRestartReason(reason)) return "scheduled";
7523
7537
  return isProvisioningReloadReason(reason) ? "provisioning" : "crash";
7524
7538
  }
7525
7539
  function countByClass(events) {
@@ -7528,12 +7542,14 @@ function countByClass(events) {
7528
7542
  let credentialRotation = 0;
7529
7543
  let selfHealing = 0;
7530
7544
  let operatorConfig = 0;
7545
+ let scheduled = 0;
7531
7546
  for (const e of events) {
7532
7547
  const klass = restartReasonClass(e.reason);
7533
7548
  if (klass === "provisioning") provisioning += 1;
7534
7549
  else if (klass === "credential-rotation") credentialRotation += 1;
7535
7550
  else if (klass === "self-healing") selfHealing += 1;
7536
7551
  else if (klass === "operator-config") operatorConfig += 1;
7552
+ else if (klass === "scheduled") scheduled += 1;
7537
7553
  else crash += 1;
7538
7554
  }
7539
7555
  return {
@@ -7541,7 +7557,8 @@ function countByClass(events) {
7541
7557
  provisioning,
7542
7558
  "credential-rotation": credentialRotation,
7543
7559
  "self-healing": selfHealing,
7544
- "operator-config": operatorConfig
7560
+ "operator-config": operatorConfig,
7561
+ scheduled
7545
7562
  };
7546
7563
  }
7547
7564
  function maxProvisioningBucket(events) {
@@ -7571,6 +7588,8 @@ var DEFAULT_WINDOW_MS = 6e5;
7571
7588
  var DEFAULT_PROVISIONING_MAX = RESTART_BREAKER_PROVISIONING_MAX;
7572
7589
  var DEFAULT_PROVISIONING_WINDOW_MS = RESTART_BREAKER_PROVISIONING_WINDOW_MS;
7573
7590
  var DEFAULT_OPERATOR_MAX = RESTART_BREAKER_OPERATOR_MAX;
7591
+ var DEFAULT_SCHEDULED_MAX = RESTART_BREAKER_SCHEDULED_MAX;
7592
+ var DEFAULT_SCHEDULED_WINDOW_MS = RESTART_BREAKER_SCHEDULED_WINDOW_MS;
7574
7593
  function readEnvNumber(name, fallback) {
7575
7594
  const raw = process.env[name];
7576
7595
  if (!raw) return fallback;
@@ -7598,7 +7617,15 @@ var RestartBreaker = class {
7598
7617
  * env var without the other cannot invert the two tallies.
7599
7618
  */
7600
7619
  operatorMax;
7601
- /** Longest window either tally needs — how long the events log must retain. */
7620
+ /**
7621
+ * ENG-9138: the scheduled class's LOOP bar. Readonly and deliberately NOT
7622
+ * floored against any other tally: it gates a REPORT, not a pause, so it
7623
+ * cannot invert anything the way operatorMax/provisioningMax can.
7624
+ */
7625
+ scheduledMax;
7626
+ /** ENG-9138: sliding window for the scheduled tally. */
7627
+ scheduledWindowMs;
7628
+ /** Longest window any tally needs — how long the events log must retain. */
7602
7629
  retentionMs;
7603
7630
  now;
7604
7631
  /** ENG-7891 slice 5b: code_name → durable runtime key (agent_id when id-keyed). Identity on the legacy fleet. */
@@ -7624,6 +7651,8 @@ var RestartBreaker = class {
7624
7651
  this.provisioningMax = opts.provisioningMax ?? readEnvNumber("AGT_RESTART_BREAKER_PROVISIONING_MAX", DEFAULT_PROVISIONING_MAX);
7625
7652
  this.provisioningWindowMs = opts.provisioningWindowMs ?? readEnvNumber("AGT_RESTART_BREAKER_PROVISIONING_WINDOW_MS", DEFAULT_PROVISIONING_WINDOW_MS);
7626
7653
  this.operatorMax = opts.operatorMax ?? readEnvNumber("AGT_RESTART_BREAKER_OPERATOR_MAX", DEFAULT_OPERATOR_MAX);
7654
+ this.scheduledMax = opts.scheduledMax ?? readEnvNumber("AGT_RESTART_BREAKER_SCHEDULED_MAX", DEFAULT_SCHEDULED_MAX);
7655
+ this.scheduledWindowMs = opts.scheduledWindowMs ?? readEnvNumber("AGT_RESTART_BREAKER_SCHEDULED_WINDOW_MS", DEFAULT_SCHEDULED_WINDOW_MS);
7627
7656
  this.now = opts.now ?? Date.now;
7628
7657
  this.runtimeKey = opts.runtimeKey ?? ((codeName) => codeName);
7629
7658
  this.agentCreatedAt = opts.agentCreatedAt ?? (() => void 0);
@@ -7665,7 +7694,7 @@ var RestartBreaker = class {
7665
7694
  if (this.newAgentGraceCeiling < minimumGraceCeiling) {
7666
7695
  this.newAgentGraceCeiling = minimumGraceCeiling;
7667
7696
  }
7668
- this.retentionMs = Math.max(this.windowMs, this.provisioningWindowMs);
7697
+ this.retentionMs = Math.max(this.windowMs, this.provisioningWindowMs, this.scheduledWindowMs);
7669
7698
  }
7670
7699
  /**
7671
7700
  * ENG-8215: the clamp record, if the configured provisioning max had to be
@@ -7754,14 +7783,23 @@ var RestartBreaker = class {
7754
7783
  const operatorEvents = prior.filter(
7755
7784
  (e) => e.at >= at - this.provisioningWindowMs && isOperatorConfigReason(e.reason)
7756
7785
  );
7786
+ const scheduledEvents = prior.filter(
7787
+ (e) => e.at >= at - this.scheduledWindowMs && isScheduledRestartReason(e.reason)
7788
+ );
7757
7789
  const windowCount = prior.filter((e) => e.at >= at - this.windowMs).length;
7758
7790
  const classCounts = {
7759
7791
  crash: crashCount,
7760
7792
  provisioning: provEvents.length,
7761
7793
  "credential-rotation": credRotCount,
7762
7794
  "self-healing": selfHealCount,
7763
- "operator-config": operatorEvents.length
7795
+ "operator-config": operatorEvents.length,
7796
+ scheduled: scheduledEvents.length
7764
7797
  };
7798
+ const scheduledLoop = scheduledEvents.length > this.scheduledMax ? {
7799
+ count: scheduledEvents.length,
7800
+ windowMs: this.scheduledWindowMs,
7801
+ reason: scheduledEvents[scheduledEvents.length - 1].reason
7802
+ } : void 0;
7765
7803
  const provBucket = maxProvisioningBucket(provEvents);
7766
7804
  const operatorBucket = maxBucketWhere(operatorEvents, isOperatorConfigReason);
7767
7805
  const createdAt = this.newAgentGraceMs > 0 ? this.agentCreatedAt(codeName) : void 0;
@@ -7821,7 +7859,9 @@ var RestartBreaker = class {
7821
7859
  trippedClass,
7822
7860
  maxProvisioningBucket: provBucket.count,
7823
7861
  maxProvisioningBucketKey: provBucket.key,
7824
- ...graceCeilingExceeded ? { newAgentGraceCeilingExceeded: true } : {}
7862
+ ...graceCeilingExceeded ? { newAgentGraceCeilingExceeded: true } : {},
7863
+ // ENG-9138: a co-occurring rollover loop still reports on a real trip.
7864
+ ...scheduledLoop ? { scheduledLoop } : {}
7825
7865
  };
7826
7866
  }
7827
7867
  const suppressedOperator = operatorBucket.count > this.operatorMax;
@@ -7833,6 +7873,7 @@ var RestartBreaker = class {
7833
7873
  classCounts,
7834
7874
  maxProvisioningBucket: provBucket.count,
7835
7875
  maxProvisioningBucketKey: provBucket.key,
7876
+ ...scheduledLoop ? { scheduledLoop } : {},
7836
7877
  ...newAgentGraceActive ? {
7837
7878
  newAgentGraceSuppressedTrip: wouldHaveTripped,
7838
7879
  ...newAgentGraceExpiresAt !== void 0 ? { newAgentGraceExpiresAt } : {},
@@ -9699,4 +9740,4 @@ export {
9699
9740
  managerInstallSystemUnitCommand,
9700
9741
  managerUninstallSystemUnitCommand
9701
9742
  };
9702
- //# sourceMappingURL=chunk-KIOTRBOI.js.map
9743
+ //# sourceMappingURL=chunk-3JBA6RYG.js.map