@integrity-labs/agt-cli 0.28.407 → 0.28.409

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-2AC3P5DJ.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-W5QSIM7F.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-W5Z4K7XK.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-XGPENQB7.js.map
@@ -45,7 +45,7 @@ import {
45
45
  resolveEffectivePinRaw,
46
46
  safeWriteJsonAtomic,
47
47
  setConfigHash
48
- } from "../chunk-5YCE2JNY.js";
48
+ } from "../chunk-QEWIZCQC.js";
49
49
  import {
50
50
  getProjectDir as getProjectDir2,
51
51
  getReadyTasks,
@@ -147,7 +147,7 @@ import {
147
147
  toOpencodeModel,
148
148
  transcriptActivityAgeSeconds,
149
149
  writeEgressAllowlist
150
- } from "../chunk-RD7MIR3G.js";
150
+ } from "../chunk-YLLK4G3B.js";
151
151
  import {
152
152
  reapOrphanChannelMcps
153
153
  } from "../chunk-XWVM4KPK.js";
@@ -1207,7 +1207,7 @@ function isManagedMcpServerKey(key) {
1207
1207
  function isRemoteMcpEntry(value) {
1208
1208
  if (!value || typeof value !== "object") return false;
1209
1209
  const e = value;
1210
- return e.type === "http" || e.type === "sse" || typeof e.url === "string" && e.command === void 0;
1210
+ return e.type === "http" || e.type === "sse" || e.type === "remote" || typeof e.url === "string" && e.command === void 0;
1211
1211
  }
1212
1212
  function orphanedRemoteMcpKeys(mcpServers, expectedIntegrationKeys) {
1213
1213
  const orphans = [];
@@ -1342,6 +1342,11 @@ function decideOpencodeModelRestart(input) {
1342
1342
  return { restart, recordModel: true };
1343
1343
  }
1344
1344
 
1345
+ // src/lib/restart-stop-strategy.ts
1346
+ function restartTargetsOpencodeServe(framework) {
1347
+ return framework === "opencode";
1348
+ }
1349
+
1345
1350
  // src/lib/connectivity-probe-runner.ts
1346
1351
  var DEFAULT_INTERVAL_MS = 60 * 60 * 1e3;
1347
1352
  var DEFAULT_MAX_PER_RUN = 25;
@@ -9302,7 +9307,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9302
9307
  var lastVersionCheckAt = 0;
9303
9308
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9304
9309
  var lastResponsivenessProbeAt = 0;
9305
- var agtCliVersion = true ? "0.28.407" : "dev";
9310
+ var agtCliVersion = true ? "0.28.409" : "dev";
9306
9311
  function resolveBrewPath(execFileSync2) {
9307
9312
  try {
9308
9313
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -10434,7 +10439,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
10434
10439
  if (codeNames.length === 0) return;
10435
10440
  void (async () => {
10436
10441
  try {
10437
- const { collectDiagnostics } = await import("../persistent-session-2AC3P5DJ.js");
10442
+ const { collectDiagnostics } = await import("../persistent-session-W5QSIM7F.js");
10438
10443
  await api.post("/host/heartbeat", {
10439
10444
  host_id: hostId,
10440
10445
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor)
@@ -10533,7 +10538,7 @@ async function pollCycle() {
10533
10538
  }
10534
10539
  try {
10535
10540
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
10536
- const { collectDiagnostics } = await import("../persistent-session-2AC3P5DJ.js");
10541
+ const { collectDiagnostics } = await import("../persistent-session-W5QSIM7F.js");
10537
10542
  const diagCodeNames = [...agentState.persistentSessionAgents];
10538
10543
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor) : void 0;
10539
10544
  let tailscaleHostname;
@@ -10688,7 +10693,7 @@ async function pollCycle() {
10688
10693
  const {
10689
10694
  collectResponsivenessProbes,
10690
10695
  getResponsivenessIntervalMs
10691
- } = await import("../responsiveness-probe-LGJNUSPU.js");
10696
+ } = await import("../responsiveness-probe-B7XCQQN4.js");
10692
10697
  const probeIntervalMs = getResponsivenessIntervalMs();
10693
10698
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
10694
10699
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -10720,7 +10725,7 @@ async function pollCycle() {
10720
10725
  collectResponsivenessProbes,
10721
10726
  livePendingInboundOldestAgeSeconds,
10722
10727
  parkPendingInbound
10723
- } = await import("../responsiveness-probe-LGJNUSPU.js");
10728
+ } = await import("../responsiveness-probe-B7XCQQN4.js");
10724
10729
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-HYOOQV4A.js");
10725
10730
  const wedgeNow = /* @__PURE__ */ new Date();
10726
10731
  const liveAgents = agentState.persistentSessionAgents;
@@ -10943,26 +10948,31 @@ async function pollCycle() {
10943
10948
  log(
10944
10949
  `[restart] Dashboard requested restart for '${agent.code_name}' at ${requested} (reason=${restartReason ?? "manual"})`
10945
10950
  );
10946
- try {
10947
- const { execSync: es } = await import("child_process");
10948
- es(`tmux kill-session -t agt-${agent.code_name} 2>/dev/null`, { stdio: "ignore" });
10949
- } catch {
10950
- }
10951
- const breakerReason = dashboardRestartBreakerReason(restartReason);
10952
- stopPersistentSessionAndForgetMcpBaseline(agent.code_name, breakerReason);
10953
- if (breakerReason && restartReasonBindsNewMcp(breakerReason)) {
10954
- noteRestartRequested(agent.code_name, requested);
10955
- beginRestartTiming(
10956
- agent.code_name,
10957
- { reason: "integration-change (dashboard restart)", delivered: null, injectDelayMs: null },
10958
- log
10959
- );
10960
- markRestartStopped(agent.code_name, log);
10961
- const prior = pendingRestartVerifications.get(agent.code_name);
10962
- pendingRestartVerifications.set(agent.code_name, {
10963
- firedAt: Date.now(),
10964
- attempts: prior?.attempts ?? 0
10965
- });
10951
+ const framework = agent.framework ?? agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK;
10952
+ if (restartTargetsOpencodeServe(framework)) {
10953
+ stopOpencodeSession(agent.code_name, log);
10954
+ } else {
10955
+ try {
10956
+ const { execSync: es } = await import("child_process");
10957
+ es(`tmux kill-session -t agt-${agent.code_name} 2>/dev/null`, { stdio: "ignore" });
10958
+ } catch {
10959
+ }
10960
+ const breakerReason = dashboardRestartBreakerReason(restartReason);
10961
+ stopPersistentSessionAndForgetMcpBaseline(agent.code_name, breakerReason);
10962
+ if (breakerReason && restartReasonBindsNewMcp(breakerReason)) {
10963
+ noteRestartRequested(agent.code_name, requested);
10964
+ beginRestartTiming(
10965
+ agent.code_name,
10966
+ { reason: "integration-change (dashboard restart)", delivered: null, injectDelayMs: null },
10967
+ log
10968
+ );
10969
+ markRestartStopped(agent.code_name, log);
10970
+ const prior = pendingRestartVerifications.get(agent.code_name);
10971
+ pendingRestartVerifications.set(agent.code_name, {
10972
+ firedAt: Date.now(),
10973
+ attempts: prior?.attempts ?? 0
10974
+ });
10975
+ }
10966
10976
  }
10967
10977
  restartAcks.set(agent.agent_id, requested);
10968
10978
  }
@@ -12354,21 +12364,18 @@ async function processAgent(agent, agentStates) {
12354
12364
  else promptBindProbeAttempts.delete(agent.code_name);
12355
12365
  }
12356
12366
  }
12357
- if (frameworkAdapter.removeMcpServer && frameworkAdapter.getMcpPath) {
12358
- const mcpPath = frameworkAdapter.getMcpPath(agent.code_name);
12359
- if (mcpPath && existsSync11(mcpPath)) {
12360
- try {
12361
- const cfg = JSON.parse(readFileSync18(mcpPath, "utf-8"));
12362
- const expectedRemoteKeys = new Set(
12363
- integrations.map((i) => i.definition_id)
12364
- );
12365
- for (const key of orphanedRemoteMcpKeys(cfg.mcpServers ?? {}, expectedRemoteKeys)) {
12366
- frameworkAdapter.removeMcpServer(agent.code_name, key);
12367
- log(`[hot-reload] Removed orphaned remote MCP server '${key}' for '${agent.code_name}' (integration removed)`);
12368
- }
12369
- } catch (err) {
12370
- log(`[hot-reload] Failed to prune orphaned remote MCP servers for '${agent.code_name}': ${err.message}`);
12367
+ if (frameworkAdapter.removeMcpServer && frameworkAdapter.readMcpServers) {
12368
+ try {
12369
+ const declaredServers = frameworkAdapter.readMcpServers(agent.code_name);
12370
+ const expectedRemoteKeys = new Set(
12371
+ integrations.map((i) => i.definition_id)
12372
+ );
12373
+ for (const key of orphanedRemoteMcpKeys(declaredServers, expectedRemoteKeys)) {
12374
+ frameworkAdapter.removeMcpServer(agent.code_name, key);
12375
+ log(`[hot-reload] Removed orphaned remote MCP server '${key}' for '${agent.code_name}' (integration removed)`);
12371
12376
  }
12377
+ } catch (err) {
12378
+ log(`[hot-reload] Failed to prune orphaned remote MCP servers for '${agent.code_name}': ${err.message}`);
12372
12379
  }
12373
12380
  }
12374
12381
  const currentIntIds = integrations.map((i) => i.definition_id);
@@ -12550,22 +12557,15 @@ async function processAgent(agent, agentStates) {
12550
12557
  const urlHash = createHash14("sha256").update(e.url).digest("hex").slice(0, 12);
12551
12558
  log(`[managed-toolkit] ${agent.code_name}: wrote '${e.name}' (serverId=${e.serverId}, url_hash=${urlHash})`);
12552
12559
  }
12553
- if (frameworkAdapter.removeMcpServer && frameworkAdapter.getMcpPath) {
12554
- const mcpPath = frameworkAdapter.getMcpPath(agent.code_name);
12555
- if (mcpPath) {
12556
- try {
12557
- const { readFileSync: readFileSync19 } = await import("fs");
12558
- const mcpConfig = JSON.parse(readFileSync19(mcpPath, "utf-8"));
12559
- if (mcpConfig.mcpServers) {
12560
- for (const key of Object.keys(mcpConfig.mcpServers)) {
12561
- if (isManagedMcpServerKey(key) && !expectedServerIds.has(key)) {
12562
- frameworkAdapter.removeMcpServer(agent.code_name, key);
12563
- log(`[managed-toolkit] Removed stale MCP server '${key}' for '${agent.code_name}'`);
12564
- }
12565
- }
12560
+ if (frameworkAdapter.removeMcpServer && frameworkAdapter.readMcpServers) {
12561
+ try {
12562
+ for (const key of Object.keys(frameworkAdapter.readMcpServers(agent.code_name))) {
12563
+ if (isManagedMcpServerKey(key) && !expectedServerIds.has(key)) {
12564
+ frameworkAdapter.removeMcpServer(agent.code_name, key);
12565
+ log(`[managed-toolkit] Removed stale MCP server '${key}' for '${agent.code_name}'`);
12566
12566
  }
12567
- } catch {
12568
12567
  }
12568
+ } catch {
12569
12569
  }
12570
12570
  }
12571
12571
  agentState.knownManagedMcpHashes.set(agent.agent_id, mcpHash);
@@ -14003,12 +14003,17 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
14003
14003
  return;
14004
14004
  }
14005
14005
  const displayName = refreshData.agent?.display_name ?? codeName;
14006
- try {
14007
- const { execSync: es } = await import("child_process");
14008
- es(`tmux kill-session -t agt-${codeName} 2>/dev/null`, { stdio: "ignore" });
14009
- } catch {
14006
+ const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
14007
+ if (restartTargetsOpencodeServe(framework)) {
14008
+ stopOpencodeSession(codeName, log);
14009
+ } else {
14010
+ try {
14011
+ const { execSync: es } = await import("child_process");
14012
+ es(`tmux kill-session -t agt-${codeName} 2>/dev/null`, { stdio: "ignore" });
14013
+ } catch {
14014
+ }
14015
+ stopPersistentSessionAndForgetMcpBaseline(codeName);
14010
14016
  }
14011
- stopPersistentSessionAndForgetMcpBaseline(codeName);
14012
14017
  const result = await ensurePersistentSession(
14013
14018
  { agent_id: agentId, code_name: codeName, display_name: displayName },
14014
14019
  [],
@@ -14022,7 +14027,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
14022
14027
  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}`));
14023
14028
  void (async () => {
14024
14029
  try {
14025
- const { collectDiagnostics } = await import("../persistent-session-2AC3P5DJ.js");
14030
+ const { collectDiagnostics } = await import("../persistent-session-W5QSIM7F.js");
14026
14031
  await api.post("/host/heartbeat", {
14027
14032
  host_id: hostId,
14028
14033
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor)
@@ -14072,7 +14077,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
14072
14077
  }
14073
14078
  try {
14074
14079
  const hostId = await getHostId();
14075
- const { collectDiagnostics } = await import("../persistent-session-2AC3P5DJ.js");
14080
+ const { collectDiagnostics } = await import("../persistent-session-W5QSIM7F.js");
14076
14081
  await api.post("/host/heartbeat", {
14077
14082
  host_id: hostId,
14078
14083
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor)
@@ -14525,7 +14530,7 @@ async function processClaudePairSessions(agents) {
14525
14530
  killPairSession,
14526
14531
  pairTmuxSession,
14527
14532
  finalizeClaudePairOnboarding
14528
- } = await import("../claude-pair-runtime-W5Z4K7XK.js");
14533
+ } = await import("../claude-pair-runtime-XGPENQB7.js");
14529
14534
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
14530
14535
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
14531
14536
  const killed = await killPairSession(pairTmuxSession(pairId));