@integrity-labs/agt-cli 0.28.412 → 0.28.413

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-5ES25OE6.js";
43
+ } from "../chunk-GRXN3X33.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -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.412" : "dev";
4832
+ var cliVersion = true ? "0.28.413" : "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.412" : "dev";
6004
+ var cliVersion2 = true ? "0.28.413" : "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) => {
@@ -6247,7 +6247,7 @@ function requireHost() {
6247
6247
  }
6248
6248
 
6249
6249
  // src/lib/api-client.ts
6250
- var agtCliVersion = true ? "0.28.412" : "dev";
6250
+ var agtCliVersion = true ? "0.28.413" : "dev";
6251
6251
  var lastConfigHash = null;
6252
6252
  function setConfigHash(hash) {
6253
6253
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8751,4 +8751,4 @@ export {
8751
8751
  managerInstallSystemUnitCommand,
8752
8752
  managerUninstallSystemUnitCommand
8753
8753
  };
8754
- //# sourceMappingURL=chunk-5ES25OE6.js.map
8754
+ //# sourceMappingURL=chunk-GRXN3X33.js.map
@@ -45,7 +45,7 @@ import {
45
45
  resolveEffectivePinRaw,
46
46
  safeWriteJsonAtomic,
47
47
  setConfigHash
48
- } from "../chunk-5ES25OE6.js";
48
+ } from "../chunk-GRXN3X33.js";
49
49
  import {
50
50
  getProjectDir as getProjectDir2,
51
51
  getReadyTasks,
@@ -1348,6 +1348,28 @@ function restartTargetsOpencodeServe(framework) {
1348
1348
  return framework === "opencode";
1349
1349
  }
1350
1350
 
1351
+ // src/lib/agent-runtime-teardown.ts
1352
+ function claudeTmuxSession(codeName) {
1353
+ return `agt-${codeName}`;
1354
+ }
1355
+ function stopAgentRuntime(codeName, reason, log2, deps) {
1356
+ const step = (label, run) => {
1357
+ try {
1358
+ run();
1359
+ } catch (err) {
1360
+ log2(`[teardown] ${label} failed for '${codeName}' (${reason}): ${err.message}`);
1361
+ }
1362
+ };
1363
+ step("channel-ingest", () => deps.stopManagerHeldChannelIngest(codeName, log2));
1364
+ step("opencode-serve", () => deps.stopOpencodeServe(codeName, log2));
1365
+ step("claude-session", () => deps.stopClaudePersistentSession(codeName));
1366
+ step("claude-pane", () => {
1367
+ if (deps.killTmuxSession(claudeTmuxSession(codeName))) {
1368
+ log2(`[teardown] killed claude pane '${claudeTmuxSession(codeName)}' for '${codeName}' (${reason})`);
1369
+ }
1370
+ });
1371
+ }
1372
+
1351
1373
  // src/lib/connectivity-probe-runner.ts
1352
1374
  var DEFAULT_INTERVAL_MS = 60 * 60 * 1e3;
1353
1375
  var DEFAULT_MAX_PER_RUN = 25;
@@ -9212,6 +9234,27 @@ function stopPersistentSessionAndForgetMcpBaseline(codeName, breakerReason, gate
9212
9234
  }
9213
9235
  }
9214
9236
  }
9237
+ var agentRuntimeTeardownDeps = {
9238
+ stopOpencodeServe: (codeName, teardownLog) => stopOpencodeSession(codeName, teardownLog),
9239
+ stopManagerHeldChannelIngest: (codeName, teardownLog) => {
9240
+ stopOpencodeSlackIngest(codeName, teardownLog);
9241
+ stopOpencodeTelegramIngest(codeName, teardownLog);
9242
+ },
9243
+ // No breaker reason: a deprovision is intentional and must not count against
9244
+ // the restart circuit breaker (see stopPersistentSessionAndForgetMcpBaseline).
9245
+ stopClaudePersistentSession: (codeName) => stopPersistentSessionAndForgetMcpBaseline(codeName),
9246
+ killTmuxSession: (sessionName) => {
9247
+ try {
9248
+ syncExecFile("tmux", ["kill-session", "-t", sessionName], { stdio: "ignore" });
9249
+ return true;
9250
+ } catch {
9251
+ return false;
9252
+ }
9253
+ }
9254
+ };
9255
+ function stopAgentRuntime2(codeName, reason) {
9256
+ stopAgentRuntime(codeName, reason, log, agentRuntimeTeardownDeps);
9257
+ }
9215
9258
  function checkMcpConfigDriftAndScheduleRestart(codeName, projectDir) {
9216
9259
  const currentHash = projectMcpHash(codeName, projectDir);
9217
9260
  const action = decideMcpDriftAction(currentHash, runningMcpHashes.get(codeName));
@@ -9378,7 +9421,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9378
9421
  var lastVersionCheckAt = 0;
9379
9422
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9380
9423
  var lastResponsivenessProbeAt = 0;
9381
- var agtCliVersion = true ? "0.28.412" : "dev";
9424
+ var agtCliVersion = true ? "0.28.413" : "dev";
9382
9425
  function resolveBrewPath(execFileSync2) {
9383
9426
  try {
9384
9427
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -11142,12 +11185,7 @@ async function pollCycle() {
11142
11185
  if (!currentIds.has(prev.agentId)) {
11143
11186
  log(`Agent '${prev.codeName}' removed from host (deleted or unassigned)`);
11144
11187
  const adapter = resolveAgentFramework(prev.codeName);
11145
- stopPersistentSessionAndForgetMcpBaseline(prev.codeName);
11146
- try {
11147
- const { execSync: es } = await import("child_process");
11148
- es(`tmux kill-session -t agt-${prev.codeName} 2>/dev/null`, { stdio: "ignore" });
11149
- } catch {
11150
- }
11188
+ stopAgentRuntime2(prev.codeName, "removed-from-host");
11151
11189
  killAgentChannelProcesses(prev.codeName, { log });
11152
11190
  const agentDir = join22(adapter.getAgentDir(prev.codeName), "provision");
11153
11191
  await cleanupAgentFiles(prev.codeName, agentDir);
@@ -11393,13 +11431,7 @@ async function processAgent(agent, agentStates) {
11393
11431
  } else if (killPausedCodeNames.delete(agent.code_name)) {
11394
11432
  log(`[kill-switch] '${agent.code_name}' kill switch cleared while still ${agent.status} (no resume \u2014 paused for another reason)`);
11395
11433
  }
11396
- stopPersistentSessionAndForgetMcpBaseline(agent.code_name);
11397
- try {
11398
- const { execSync: es } = await import("child_process");
11399
- es(`tmux kill-session -t agt-${agent.code_name} 2>/dev/null`, { stdio: "ignore" });
11400
- log(`Killed tmux session for paused agent '${agent.code_name}'`);
11401
- } catch {
11402
- }
11434
+ stopAgentRuntime2(agent.code_name, agent.status);
11403
11435
  if (agent.status === "paused" && !agent.kill_switch) {
11404
11436
  maybeAutoResume(agent);
11405
11437
  }
@@ -11447,12 +11479,7 @@ async function processAgent(agent, agentStates) {
11447
11479
  );
11448
11480
  }
11449
11481
  log(`Agent '${agent.code_name}' is revoked, cleaning up`);
11450
- stopPersistentSessionAndForgetMcpBaseline(agent.code_name);
11451
- try {
11452
- const { execSync: es } = await import("child_process");
11453
- es(`tmux kill-session -t agt-${agent.code_name} 2>/dev/null`, { stdio: "ignore" });
11454
- } catch {
11455
- }
11482
+ stopAgentRuntime2(agent.code_name, "revoked");
11456
11483
  killAgentChannelProcesses(agent.code_name, { log });
11457
11484
  await cleanupAgentFiles(agent.code_name, agentDir);
11458
11485
  clearAgentCaches(agent.agent_id, agent.code_name);