@integrity-labs/agt-cli 0.28.403 → 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-VASIOHUO.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.403" : "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.403" : "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";
@@ -4571,6 +4571,18 @@ function buildMcpJson(input) {
4571
4571
  }
4572
4572
  return { mcpServers };
4573
4573
  }
4574
+ function reconstructQuarantinedMcpServerEntry(agent, integration) {
4575
+ const built = buildMcpJson({
4576
+ agent: { agent_id: agent.agent_id, code_name: agent.code_name },
4577
+ integrations: [integration]
4578
+ });
4579
+ const servers = built.mcpServers ?? {};
4580
+ const keys = Object.keys(servers).filter((k) => k !== "augmented");
4581
+ if (keys.length !== 1)
4582
+ return void 0;
4583
+ const only = keys[0];
4584
+ return only ? servers[only] : void 0;
4585
+ }
4574
4586
  function parseIntervalMinutes(scheduleEvery) {
4575
4587
  if (!scheduleEvery)
4576
4588
  return 60;
@@ -6213,7 +6225,7 @@ function requireHost() {
6213
6225
  }
6214
6226
 
6215
6227
  // src/lib/api-client.ts
6216
- var agtCliVersion = true ? "0.28.403" : "dev";
6228
+ var agtCliVersion = true ? "0.28.405" : "dev";
6217
6229
  var lastConfigHash = null;
6218
6230
  function setConfigHash(hash) {
6219
6231
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7006,6 +7018,7 @@ var BACKOFF_MAX_MS = 30 * 6e4;
7006
7018
  var BACKOFF_WINDOW_MS = 60 * 6e4;
7007
7019
  var BACKOFF_GIVE_UP_RESTARTS = 2 * MAX_PRESENCE_RESTART_ATTEMPTS;
7008
7020
  var BACKOFF_STABLE_RESET_MS = 5 * 6e4;
7021
+ var DEAD_CHANNEL_MS = 15 * 6e4;
7009
7022
  var presenceReaperState = /* @__PURE__ */ new Map();
7010
7023
  function stateKey(codeName, serverKey) {
7011
7024
  return `${codeName}\0${serverKey}`;
@@ -7068,6 +7081,7 @@ function reapMissingMcpSessions(args) {
7068
7081
  // essential, mode off) so legacy callers/tests are unaffected.
7069
7082
  classifyKey = () => "essential",
7070
7083
  quarantineDwellMs = 0,
7084
+ deadChannelMs = DEAD_CHANNEL_MS,
7071
7085
  quarantineMode = "off",
7072
7086
  onQuarantine,
7073
7087
  isolated = false,
@@ -7136,6 +7150,8 @@ function reapMissingMcpSessions(args) {
7136
7150
  state.gaveUpLogged = false;
7137
7151
  state.firstMissingAt = null;
7138
7152
  state.quarantineLogged = false;
7153
+ state.continuouslyMissingSince = null;
7154
+ state.deadChannelLogged = false;
7139
7155
  state.gaveUp = false;
7140
7156
  if (state.stableLiveSince === null) state.stableLiveSince = now();
7141
7157
  if (now() - state.stableLiveSince >= BACKOFF_STABLE_RESET_MS) {
@@ -7158,6 +7174,7 @@ function reapMissingMcpSessions(args) {
7158
7174
  const newGenerationKeys = /* @__PURE__ */ new Set();
7159
7175
  const quarantined = [];
7160
7176
  const wouldQuarantine = [];
7177
+ const genuinelyDead = [];
7161
7178
  for (const key of missing) {
7162
7179
  const sk = stateKey(codeName, key);
7163
7180
  const state = presenceReaperState.get(sk) ?? {
@@ -7169,15 +7186,31 @@ function reapMissingMcpSessions(args) {
7169
7186
  quarantineLogged: false,
7170
7187
  restartHistory: [],
7171
7188
  stableLiveSince: null,
7189
+ continuouslyMissingSince: null,
7190
+ deadChannelLogged: false,
7172
7191
  gaveUp: false
7173
7192
  };
7174
- 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) {
7175
7208
  state.firstMissingAt = nowMs;
7176
7209
  }
7177
7210
  state.stableLiveSince = null;
7178
7211
  if (state.lastAttemptedSessionStartedAt !== sessionStartedAt) {
7179
7212
  state.lastAttemptedSessionStartedAt = sessionStartedAt;
7180
- if (!currentGenerationExternallyStarted) {
7213
+ if (!suppressAsChurn) {
7181
7214
  state.attempts += 1;
7182
7215
  newGenerationKeys.add(key);
7183
7216
  }
@@ -7260,7 +7293,8 @@ function reapMissingMcpSessions(args) {
7260
7293
  backingOff: backingOff.length > 0 ? backingOff : void 0,
7261
7294
  rotationGraced: rotationGraced.length > 0 ? rotationGraced : void 0,
7262
7295
  quarantined: quarantined.length > 0 ? quarantined : void 0,
7263
- wouldQuarantine: wouldQuarantine.length > 0 ? wouldQuarantine : void 0
7296
+ wouldQuarantine: wouldQuarantine.length > 0 ? wouldQuarantine : void 0,
7297
+ genuinelyDead: genuinelyDead.length > 0 ? genuinelyDead : void 0
7264
7298
  };
7265
7299
  }
7266
7300
  const givenUpSuffix = givenUp.length > 0 ? ` (skipping over-cap: [${givenUp.join(", ")}])` : "";
@@ -7296,7 +7330,8 @@ function reapMissingMcpSessions(args) {
7296
7330
  backingOff: backingOff.length > 0 ? backingOff : void 0,
7297
7331
  rotationGraced: rotationGraced.length > 0 ? rotationGraced : void 0,
7298
7332
  quarantined: quarantined.length > 0 ? quarantined : void 0,
7299
- wouldQuarantine: wouldQuarantine.length > 0 ? wouldQuarantine : void 0
7333
+ wouldQuarantine: wouldQuarantine.length > 0 ? wouldQuarantine : void 0,
7334
+ genuinelyDead: genuinelyDead.length > 0 ? genuinelyDead : void 0
7300
7335
  };
7301
7336
  }
7302
7337
 
@@ -8633,6 +8668,7 @@ export {
8633
8668
  provisionOrientHook,
8634
8669
  provisionPreCompactHook,
8635
8670
  provisionSessionStateHook,
8671
+ reconstructQuarantinedMcpServerEntry,
8636
8672
  setJsonMode,
8637
8673
  isJsonMode,
8638
8674
  jsonOutput,
@@ -8693,4 +8729,4 @@ export {
8693
8729
  managerInstallSystemUnitCommand,
8694
8730
  managerUninstallSystemUnitCommand
8695
8731
  };
8696
- //# sourceMappingURL=chunk-VASIOHUO.js.map
8732
+ //# sourceMappingURL=chunk-AAWYAPKX.js.map