@integrity-labs/agt-cli 0.28.404 → 0.28.405

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-SW3FOBHR.js";
43
+ } from "../chunk-AAWYAPKX.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -70,7 +70,7 @@ import {
70
70
  renderTemplate,
71
71
  resolveChannels,
72
72
  serializeManifestForSlackCli
73
- } from "../chunk-V5CRVBVC.js";
73
+ } from "../chunk-UYBG62IQ.js";
74
74
  import "../chunk-XWVM4KPK.js";
75
75
 
76
76
  // src/bin/agt.ts
@@ -4829,7 +4829,7 @@ import { execFileSync, execSync } from "child_process";
4829
4829
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4830
4830
  import chalk18 from "chalk";
4831
4831
  import ora16 from "ora";
4832
- var cliVersion = true ? "0.28.404" : "dev";
4832
+ var cliVersion = true ? "0.28.405" : "dev";
4833
4833
  async function fetchLatestVersion() {
4834
4834
  const host2 = getHost();
4835
4835
  if (!host2) return null;
@@ -6001,7 +6001,7 @@ function handleError(err) {
6001
6001
  }
6002
6002
 
6003
6003
  // src/bin/agt.ts
6004
- var cliVersion2 = true ? "0.28.404" : "dev";
6004
+ var cliVersion2 = true ? "0.28.405" : "dev";
6005
6005
  var program = new Command();
6006
6006
  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");
6007
6007
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -25,7 +25,7 @@ import {
25
25
  resolveConnectivityProbe,
26
26
  worseConnectivityOutcome,
27
27
  wrapScheduledTaskPrompt
28
- } from "./chunk-V5CRVBVC.js";
28
+ } from "./chunk-UYBG62IQ.js";
29
29
  import {
30
30
  parsePsRows
31
31
  } from "./chunk-XWVM4KPK.js";
@@ -6225,7 +6225,7 @@ function requireHost() {
6225
6225
  }
6226
6226
 
6227
6227
  // src/lib/api-client.ts
6228
- var agtCliVersion = true ? "0.28.404" : "dev";
6228
+ var agtCliVersion = true ? "0.28.405" : "dev";
6229
6229
  var lastConfigHash = null;
6230
6230
  function setConfigHash(hash) {
6231
6231
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7018,6 +7018,7 @@ var BACKOFF_MAX_MS = 30 * 6e4;
7018
7018
  var BACKOFF_WINDOW_MS = 60 * 6e4;
7019
7019
  var BACKOFF_GIVE_UP_RESTARTS = 2 * MAX_PRESENCE_RESTART_ATTEMPTS;
7020
7020
  var BACKOFF_STABLE_RESET_MS = 5 * 6e4;
7021
+ var DEAD_CHANNEL_MS = 15 * 6e4;
7021
7022
  var presenceReaperState = /* @__PURE__ */ new Map();
7022
7023
  function stateKey(codeName, serverKey) {
7023
7024
  return `${codeName}\0${serverKey}`;
@@ -7080,6 +7081,7 @@ function reapMissingMcpSessions(args) {
7080
7081
  // essential, mode off) so legacy callers/tests are unaffected.
7081
7082
  classifyKey = () => "essential",
7082
7083
  quarantineDwellMs = 0,
7084
+ deadChannelMs = DEAD_CHANNEL_MS,
7083
7085
  quarantineMode = "off",
7084
7086
  onQuarantine,
7085
7087
  isolated = false,
@@ -7148,6 +7150,8 @@ function reapMissingMcpSessions(args) {
7148
7150
  state.gaveUpLogged = false;
7149
7151
  state.firstMissingAt = null;
7150
7152
  state.quarantineLogged = false;
7153
+ state.continuouslyMissingSince = null;
7154
+ state.deadChannelLogged = false;
7151
7155
  state.gaveUp = false;
7152
7156
  if (state.stableLiveSince === null) state.stableLiveSince = now();
7153
7157
  if (now() - state.stableLiveSince >= BACKOFF_STABLE_RESET_MS) {
@@ -7170,6 +7174,7 @@ function reapMissingMcpSessions(args) {
7170
7174
  const newGenerationKeys = /* @__PURE__ */ new Set();
7171
7175
  const quarantined = [];
7172
7176
  const wouldQuarantine = [];
7177
+ const genuinelyDead = [];
7173
7178
  for (const key of missing) {
7174
7179
  const sk = stateKey(codeName, key);
7175
7180
  const state = presenceReaperState.get(sk) ?? {
@@ -7181,15 +7186,31 @@ function reapMissingMcpSessions(args) {
7181
7186
  quarantineLogged: false,
7182
7187
  restartHistory: [],
7183
7188
  stableLiveSince: null,
7189
+ continuouslyMissingSince: null,
7190
+ deadChannelLogged: false,
7184
7191
  gaveUp: false
7185
7192
  };
7186
- if (state.firstMissingAt === null || currentGenerationExternallyStarted) {
7193
+ if (state.continuouslyMissingSince === null) {
7194
+ state.continuouslyMissingSince = nowMs;
7195
+ }
7196
+ const isGenuinelyDead = nowMs - state.continuouslyMissingSince >= deadChannelMs;
7197
+ const suppressAsChurn = currentGenerationExternallyStarted && !isGenuinelyDead;
7198
+ if (isGenuinelyDead) {
7199
+ genuinelyDead.push(key);
7200
+ if (currentGenerationExternallyStarted && !state.deadChannelLogged) {
7201
+ state.deadChannelLogged = true;
7202
+ log(
7203
+ `[mcp-presence-reaper] '${codeName}:${key}' continuously missing ${Math.round((nowMs - state.continuouslyMissingSince) / 6e4)}m (> ${Math.round(deadChannelMs / 6e4)}m) \u2014 genuinely dead, overriding storm-awareness so it can reach give-up/quarantine instead of churning (ENG-8062)`
7204
+ );
7205
+ }
7206
+ }
7207
+ if (state.firstMissingAt === null || suppressAsChurn) {
7187
7208
  state.firstMissingAt = nowMs;
7188
7209
  }
7189
7210
  state.stableLiveSince = null;
7190
7211
  if (state.lastAttemptedSessionStartedAt !== sessionStartedAt) {
7191
7212
  state.lastAttemptedSessionStartedAt = sessionStartedAt;
7192
- if (!currentGenerationExternallyStarted) {
7213
+ if (!suppressAsChurn) {
7193
7214
  state.attempts += 1;
7194
7215
  newGenerationKeys.add(key);
7195
7216
  }
@@ -7272,7 +7293,8 @@ function reapMissingMcpSessions(args) {
7272
7293
  backingOff: backingOff.length > 0 ? backingOff : void 0,
7273
7294
  rotationGraced: rotationGraced.length > 0 ? rotationGraced : void 0,
7274
7295
  quarantined: quarantined.length > 0 ? quarantined : void 0,
7275
- wouldQuarantine: wouldQuarantine.length > 0 ? wouldQuarantine : void 0
7296
+ wouldQuarantine: wouldQuarantine.length > 0 ? wouldQuarantine : void 0,
7297
+ genuinelyDead: genuinelyDead.length > 0 ? genuinelyDead : void 0
7276
7298
  };
7277
7299
  }
7278
7300
  const givenUpSuffix = givenUp.length > 0 ? ` (skipping over-cap: [${givenUp.join(", ")}])` : "";
@@ -7308,7 +7330,8 @@ function reapMissingMcpSessions(args) {
7308
7330
  backingOff: backingOff.length > 0 ? backingOff : void 0,
7309
7331
  rotationGraced: rotationGraced.length > 0 ? rotationGraced : void 0,
7310
7332
  quarantined: quarantined.length > 0 ? quarantined : void 0,
7311
- wouldQuarantine: wouldQuarantine.length > 0 ? wouldQuarantine : void 0
7333
+ wouldQuarantine: wouldQuarantine.length > 0 ? wouldQuarantine : void 0,
7334
+ genuinelyDead: genuinelyDead.length > 0 ? genuinelyDead : void 0
7312
7335
  };
7313
7336
  }
7314
7337
 
@@ -8706,4 +8729,4 @@ export {
8706
8729
  managerInstallSystemUnitCommand,
8707
8730
  managerUninstallSystemUnitCommand
8708
8731
  };
8709
- //# sourceMappingURL=chunk-SW3FOBHR.js.map
8732
+ //# sourceMappingURL=chunk-AAWYAPKX.js.map