@integrity-labs/agt-cli 0.28.223 → 0.28.225

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.
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
100
100
  return { ok: true };
101
101
  } catch {
102
102
  }
103
- const { resolveClaudeBinary } = await import("./persistent-session-JGBNCAKI.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-I4CQEDME.js");
104
104
  const claudeBin = resolveClaudeBinary();
105
105
  const pairEnv = {
106
106
  ...process.env,
@@ -373,4 +373,4 @@ export {
373
373
  startClaudePair,
374
374
  submitClaudePairCode
375
375
  };
376
- //# sourceMappingURL=claude-pair-runtime-VBCNGNZW.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-JFP2N723.js.map
@@ -37,7 +37,7 @@ import {
37
37
  requireHost,
38
38
  safeWriteJsonAtomic,
39
39
  setConfigHash
40
- } from "../chunk-7GJGGLKZ.js";
40
+ } from "../chunk-A36N2XXT.js";
41
41
  import {
42
42
  getProjectDir as getProjectDir2,
43
43
  getReadyTasks,
@@ -122,7 +122,7 @@ import {
122
122
  takeZombieDetection,
123
123
  transcriptActivityAgeSeconds,
124
124
  writeEgressAllowlist
125
- } from "../chunk-MJ2TQQOO.js";
125
+ } from "../chunk-S43WVYAF.js";
126
126
  import {
127
127
  reapOrphanChannelMcps
128
128
  } from "../chunk-XWVM4KPK.js";
@@ -837,6 +837,21 @@ var MANAGED_MCP_SERVER_PREFIXES = [
837
837
  function isManagedMcpServerKey(key) {
838
838
  return MANAGED_MCP_SERVER_PREFIXES.some((p) => key.startsWith(p));
839
839
  }
840
+ function isRemoteMcpEntry(value) {
841
+ if (!value || typeof value !== "object") return false;
842
+ const e = value;
843
+ return e.type === "http" || e.type === "sse" || typeof e.url === "string" && e.command === void 0;
844
+ }
845
+ function orphanedRemoteMcpKeys(mcpServers, expectedIntegrationKeys) {
846
+ const orphans = [];
847
+ for (const [key, entry] of Object.entries(mcpServers)) {
848
+ if (expectedIntegrationKeys.has(key)) continue;
849
+ if (isManagedMcpServerKey(key)) continue;
850
+ if (!isRemoteMcpEntry(entry)) continue;
851
+ orphans.push(key);
852
+ }
853
+ return orphans;
854
+ }
840
855
 
841
856
  // src/lib/auto-resume.ts
842
857
  var DEFAULT_QUIET_MS = 18e5;
@@ -5135,8 +5150,9 @@ function startRealtimeAssignments(config2) {
5135
5150
  const prev = restartRequestFingerprint.get(agentId);
5136
5151
  restartRequestFingerprint.set(agentId, requestedAt);
5137
5152
  if (requestedAt && requestedAt !== prev && onRestartRequested) {
5138
- log2(`[realtime] Restart requested for ${agentId} at ${requestedAt}`);
5139
- onRestartRequested({ agent_id: agentId, restart_requested_at: requestedAt });
5153
+ const restartReason = row.restart_reason ?? null;
5154
+ log2(`[realtime] Restart requested for ${agentId} at ${requestedAt}${restartReason ? ` (reason=${restartReason})` : ""}`);
5155
+ onRestartRequested({ agent_id: agentId, restart_requested_at: requestedAt, restart_reason: restartReason });
5140
5156
  }
5141
5157
  }).on("postgres_changes", {
5142
5158
  event: "DELETE",
@@ -6242,7 +6258,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
6242
6258
  var lastVersionCheckAt = 0;
6243
6259
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
6244
6260
  var lastResponsivenessProbeAt = 0;
6245
- var agtCliVersion = true ? "0.28.223" : "dev";
6261
+ var agtCliVersion = true ? "0.28.225" : "dev";
6246
6262
  function resolveBrewPath(execFileSync2) {
6247
6263
  try {
6248
6264
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -7151,7 +7167,7 @@ async function pollCycle() {
7151
7167
  }
7152
7168
  try {
7153
7169
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
7154
- const { collectDiagnostics } = await import("../persistent-session-JGBNCAKI.js");
7170
+ const { collectDiagnostics } = await import("../persistent-session-I4CQEDME.js");
7155
7171
  const diagCodeNames = [...agentState.persistentSessionAgents];
7156
7172
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
7157
7173
  let tailscaleHostname;
@@ -7299,7 +7315,7 @@ async function pollCycle() {
7299
7315
  const {
7300
7316
  collectResponsivenessProbes,
7301
7317
  getResponsivenessIntervalMs
7302
- } = await import("../responsiveness-probe-3AYQX6CL.js");
7318
+ } = await import("../responsiveness-probe-MIUMXKV4.js");
7303
7319
  const probeIntervalMs = getResponsivenessIntervalMs();
7304
7320
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
7305
7321
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -7331,7 +7347,7 @@ async function pollCycle() {
7331
7347
  collectResponsivenessProbes,
7332
7348
  livePendingInboundOldestAgeSeconds,
7333
7349
  parkPendingInbound
7334
- } = await import("../responsiveness-probe-3AYQX6CL.js");
7350
+ } = await import("../responsiveness-probe-MIUMXKV4.js");
7335
7351
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
7336
7352
  const wedgeNow = /* @__PURE__ */ new Date();
7337
7353
  const liveAgents = agentState.persistentSessionAgents;
@@ -7586,7 +7602,7 @@ async function pollCycle() {
7586
7602
  if (restartedCodeNames.length > 0) {
7587
7603
  void (async () => {
7588
7604
  try {
7589
- const { collectDiagnostics } = await import("../persistent-session-JGBNCAKI.js");
7605
+ const { collectDiagnostics } = await import("../persistent-session-I4CQEDME.js");
7590
7606
  const freshDiagnostics = collectDiagnostics(restartedCodeNames);
7591
7607
  await api.post("/host/heartbeat", {
7592
7608
  host_id: hostId,
@@ -8738,6 +8754,23 @@ async function processAgent(agent, agentStates) {
8738
8754
  log(`Session-tool-bind probe failed for '${agent.code_name}': ${err.message}`);
8739
8755
  }
8740
8756
  }
8757
+ if (frameworkAdapter.removeMcpServer && frameworkAdapter.getMcpPath) {
8758
+ const mcpPath = frameworkAdapter.getMcpPath(agent.code_name);
8759
+ if (mcpPath && existsSync8(mcpPath)) {
8760
+ try {
8761
+ const cfg = JSON.parse(readFileSync14(mcpPath, "utf-8"));
8762
+ const expectedRemoteKeys = new Set(
8763
+ integrations.map((i) => i.definition_id)
8764
+ );
8765
+ for (const key of orphanedRemoteMcpKeys(cfg.mcpServers ?? {}, expectedRemoteKeys)) {
8766
+ frameworkAdapter.removeMcpServer(agent.code_name, key);
8767
+ log(`[hot-reload] Removed orphaned remote MCP server '${key}' for '${agent.code_name}' (integration removed)`);
8768
+ }
8769
+ } catch (err) {
8770
+ log(`[hot-reload] Failed to prune orphaned remote MCP servers for '${agent.code_name}': ${err.message}`);
8771
+ }
8772
+ }
8773
+ }
8741
8774
  if (integrations.length > 0) {
8742
8775
  const intHash = computeIntegrationsHash(integrations);
8743
8776
  const prevIntHash = agentState.knownIntegrationHashes.get(agent.agent_id);
@@ -10021,14 +10054,21 @@ function ensureRealtimeDriftStarted(agentStates) {
10021
10054
  });
10022
10055
  }
10023
10056
  var restartInFlight = /* @__PURE__ */ new Set();
10024
- async function handleRestartDoorbell(agentId, requestedAt) {
10025
- if (!hostFlagStore().getBoolean("restart-doorbell")) return;
10026
- if (restartInFlight.has(agentId)) return;
10057
+ function restartReasonNeedsRender(reason) {
10058
+ return reason != null && reason !== "manual";
10059
+ }
10060
+ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
10027
10061
  const prev = state6.agents.find((a) => a.agentId === agentId);
10028
10062
  const codeName = prev?.codeName;
10029
10063
  if (!codeName) return;
10030
10064
  const lastProcessed = prev?.lastRestartProcessedAt ?? null;
10031
10065
  if (lastProcessed != null && Date.parse(lastProcessed) >= Date.parse(requestedAt)) return;
10066
+ if (restartReasonNeedsRender(restartReason)) {
10067
+ triggerEarlyPoll(`config-change reload for '${codeName}' (reason=${restartReason})`);
10068
+ return;
10069
+ }
10070
+ if (!hostFlagStore().getBoolean("restart-doorbell")) return;
10071
+ if (restartInFlight.has(agentId)) return;
10032
10072
  restartInFlight.add(agentId);
10033
10073
  try {
10034
10074
  log(`[restart-lane] Fast restart for '${codeName}' at ${requestedAt}`);
@@ -10060,7 +10100,7 @@ async function handleRestartDoorbell(agentId, requestedAt) {
10060
10100
  void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
10061
10101
  void (async () => {
10062
10102
  try {
10063
- const { collectDiagnostics } = await import("../persistent-session-JGBNCAKI.js");
10103
+ const { collectDiagnostics } = await import("../persistent-session-I4CQEDME.js");
10064
10104
  await api.post("/host/heartbeat", {
10065
10105
  host_id: hostId,
10066
10106
  agent_diagnostics: collectDiagnostics([codeName])
@@ -10095,7 +10135,7 @@ function ensureRealtimeAssignStarted(agentStates) {
10095
10135
  // flag-gated and backstopped by the slow poll, so wiring it unconditionally
10096
10136
  // is safe (a no-op when the flag is off).
10097
10137
  onRestartRequested: (payload) => {
10098
- void handleRestartDoorbell(payload.agent_id, payload.restart_requested_at).catch(
10138
+ void handleRestartDoorbell(payload.agent_id, payload.restart_requested_at, payload.restart_reason).catch(
10099
10139
  (err) => (
10100
10140
  // Never let a fast-lane failure become an unhandled rejection - the slow
10101
10141
  // poll backstop re-services the (still-set) restart_requested_at.
@@ -10454,7 +10494,7 @@ async function processClaudePairSessions(agents) {
10454
10494
  killPairSession,
10455
10495
  pairTmuxSession,
10456
10496
  finalizeClaudePairOnboarding
10457
- } = await import("../claude-pair-runtime-VBCNGNZW.js");
10497
+ } = await import("../claude-pair-runtime-JFP2N723.js");
10458
10498
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
10459
10499
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
10460
10500
  const killed = await killPairSession(pairTmuxSession(pairId));