@integrity-labs/agt-cli 0.9.10 → 0.10.0

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
@@ -32,7 +32,7 @@ import {
32
32
  resolveChannels,
33
33
  serializeManifestForSlackCli,
34
34
  setActiveTeam
35
- } from "../chunk-IT34G2Y2.js";
35
+ } from "../chunk-UWH2MMKY.js";
36
36
 
37
37
  // src/bin/agt.ts
38
38
  import { join as join11 } from "path";
@@ -3411,7 +3411,7 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
3411
3411
  import { execSync } from "child_process";
3412
3412
  import chalk19 from "chalk";
3413
3413
  import ora15 from "ora";
3414
- var cliVersion = true ? "0.9.10" : "dev";
3414
+ var cliVersion = true ? "0.10.0" : "dev";
3415
3415
  async function fetchLatestVersion() {
3416
3416
  const host2 = AGT_HOST;
3417
3417
  if (!host2) return null;
@@ -3440,12 +3440,36 @@ function isNewerVersion(local, remote) {
3440
3440
  if (rMin !== lMin) return rMin > lMin;
3441
3441
  return rPat > lPat;
3442
3442
  }
3443
+ function detectActiveSessions() {
3444
+ let managerPid = null;
3445
+ try {
3446
+ const pid = execSync('pgrep -f "agt.*(manage|manager)" 2>/dev/null || true', { encoding: "utf-8" }).trim();
3447
+ const ownPid = String(process.pid);
3448
+ const pids = pid.split("\n").filter((p) => p && p !== ownPid);
3449
+ managerPid = pids[0] ?? null;
3450
+ } catch {
3451
+ }
3452
+ const tmuxSessions = [];
3453
+ try {
3454
+ const sessions = execSync("tmux ls 2>/dev/null || true", { encoding: "utf-8" }).trim();
3455
+ if (sessions) {
3456
+ for (const line of sessions.split("\n")) {
3457
+ if (line.match(/^(claude-|agt-)/)) {
3458
+ const name = line.split(":")[0];
3459
+ if (name) tmuxSessions.push(name);
3460
+ }
3461
+ }
3462
+ }
3463
+ } catch {
3464
+ }
3465
+ return { managerPid, tmuxSessions };
3466
+ }
3443
3467
  function performUpdate(version) {
3444
3468
  execSync(`npm install -g @integrity-labs/agt-cli@${version} --registry=https://npm.pkg.github.com`, {
3445
3469
  stdio: "inherit"
3446
3470
  });
3447
3471
  }
3448
- async function updateCommand() {
3472
+ async function updateCommand(opts = {}) {
3449
3473
  const json = isJsonMode();
3450
3474
  const spinner = ora15({ text: "Checking for updates\u2026", isSilent: json });
3451
3475
  spinner.start();
@@ -3477,6 +3501,39 @@ async function updateCommand() {
3477
3501
  info(`Changelog: ${versionInfo.changelog_url}`);
3478
3502
  }
3479
3503
  }
3504
+ if (!opts.force) {
3505
+ const { managerPid, tmuxSessions } = detectActiveSessions();
3506
+ if (managerPid || tmuxSessions.length > 0) {
3507
+ if (!json) {
3508
+ warn("Active processes detected:");
3509
+ if (managerPid) {
3510
+ console.error(chalk19.yellow(` \u2022 Manager process running (PID ${managerPid})`));
3511
+ }
3512
+ if (tmuxSessions.length > 0) {
3513
+ console.error(chalk19.yellow(` \u2022 ${tmuxSessions.length} active agent session(s): ${tmuxSessions.join(", ")}`));
3514
+ }
3515
+ console.error();
3516
+ warn("Updating while the manager is running will leave it on the old version until restarted.");
3517
+ warn("Active agent sessions will continue with stale MCP servers.");
3518
+ console.error();
3519
+ info(`Run ${chalk19.bold("agt update --force")} to update anyway, then restart the manager.`);
3520
+ } else {
3521
+ jsonOutput({
3522
+ ok: false,
3523
+ current: cliVersion,
3524
+ latest: versionInfo.latest,
3525
+ update_available: true,
3526
+ updated: false,
3527
+ blocked: true,
3528
+ manager_running: !!managerPid,
3529
+ active_sessions: tmuxSessions,
3530
+ error: "Active manager or agent sessions detected. Use --force to override."
3531
+ });
3532
+ }
3533
+ process.exitCode = 1;
3534
+ return;
3535
+ }
3536
+ }
3480
3537
  const updateSpinner = ora15({ text: "Installing update\u2026", isSilent: json });
3481
3538
  updateSpinner.start();
3482
3539
  try {
@@ -3492,6 +3549,7 @@ async function updateCommand() {
3492
3549
  });
3493
3550
  } else {
3494
3551
  success(`Updated to ${chalk19.bold(versionInfo.latest)}`);
3552
+ info(`If you have a running manager, restart it: ${chalk19.bold("agt manager stop && agt manager start")}`);
3495
3553
  }
3496
3554
  } catch (err) {
3497
3555
  updateSpinner.fail("Update failed");
@@ -3518,8 +3576,7 @@ async function checkForUpdateOnStartup() {
3518
3576
  if (isNewerVersion(cliVersion, versionInfo.latest)) {
3519
3577
  console.error(
3520
3578
  chalk19.yellow(`
3521
- Update available: ${cliVersion} \u2192 ${versionInfo.latest}. Run ${chalk19.bold("agt update")} to install.
3522
- `)
3579
+ Update available: ${cliVersion} \u2192 ${versionInfo.latest}. Run ${chalk19.bold("agt update")} to install.`) + chalk19.dim("\n Note: Restart the manager after updating.\n")
3523
3580
  );
3524
3581
  }
3525
3582
  } catch {
@@ -3527,7 +3584,7 @@ async function checkForUpdateOnStartup() {
3527
3584
  }
3528
3585
 
3529
3586
  // src/bin/agt.ts
3530
- var cliVersion2 = true ? "0.9.10" : "dev";
3587
+ var cliVersion2 = true ? "0.10.0" : "dev";
3531
3588
  var program = new Command();
3532
3589
  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");
3533
3590
  program.hook("preAction", (thisCommand) => {
@@ -3590,7 +3647,7 @@ acpx.command("exec <agent> <prompt>").description("One-shot execution (no sessio
3590
3647
  acpx.command("list-sessions <agent>").description("List active ACP sessions for an agent").action(acpxListSessionsCommand);
3591
3648
  acpx.command("cancel <agent>").description("Send cooperative cancel to the running ACP session").action(acpxCancelCommand);
3592
3649
  acpx.command("close <agent>").description("Soft-close an ACP session (preserves history)").action(acpxCloseCommand);
3593
- program.command("update").description("Check for and install CLI updates").action(updateCommand);
3650
+ program.command("update").description("Check for and install CLI updates").option("--force", "Update even if manager or agent sessions are running").action(updateCommand);
3594
3651
  var skipUpdateCheck = process.argv.includes("--skip-update-check") || process.argv.includes("--json") || process.argv[2] === "update";
3595
3652
  if (!skipUpdateCheck) {
3596
3653
  checkForUpdateOnStartup().catch(() => {