@integrity-labs/agt-cli 0.10.15 → 0.10.16

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
@@ -3705,7 +3705,7 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
3705
3705
  import { execSync } from "child_process";
3706
3706
  import chalk20 from "chalk";
3707
3707
  import ora15 from "ora";
3708
- var cliVersion = true ? "0.10.15" : "dev";
3708
+ var cliVersion = true ? "0.10.16" : "dev";
3709
3709
  async function fetchLatestVersion() {
3710
3710
  const host2 = getHost();
3711
3711
  if (!host2) return null;
@@ -4104,7 +4104,7 @@ function handleError(err) {
4104
4104
  }
4105
4105
 
4106
4106
  // src/bin/agt.ts
4107
- var cliVersion2 = true ? "0.10.15" : "dev";
4107
+ var cliVersion2 = true ? "0.10.16" : "dev";
4108
4108
  var program = new Command();
4109
4109
  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");
4110
4110
  program.hook("preAction", (thisCommand) => {
@@ -340,7 +340,7 @@ var GatewayClientPool = class extends EventEmitter {
340
340
  };
341
341
 
342
342
  // src/lib/claude-auth-detect.ts
343
- import { readFile } from "fs/promises";
343
+ import { readFile, readdir } from "fs/promises";
344
344
  import { homedir, platform } from "os";
345
345
  import { join } from "path";
346
346
  import { execFile } from "child_process";
@@ -364,6 +364,18 @@ async function readOauthCredentials() {
364
364
  join(homedir(), ".claude", ".credentials.json"),
365
365
  join(homedir(), ".claude", "credentials.json")
366
366
  ];
367
+ const isLinuxRoot = platform() === "linux" && typeof process.getuid === "function" && process.getuid() === 0;
368
+ if (isLinuxRoot) {
369
+ try {
370
+ const entries = await readdir("/home", { withFileTypes: true });
371
+ for (const entry of entries) {
372
+ if (!entry.isDirectory()) continue;
373
+ candidates.push(join("/home", entry.name, ".claude", ".credentials.json"));
374
+ candidates.push(join("/home", entry.name, ".claude", "credentials.json"));
375
+ }
376
+ } catch {
377
+ }
378
+ }
367
379
  for (const path of candidates) {
368
380
  const parsed = await readJsonSilently(path);
369
381
  if (parsed) {
@@ -849,7 +861,7 @@ async function ensureFrameworkBinary(frameworkId) {
849
861
  }
850
862
  }
851
863
  }
852
- agentRuntimeAuthenticated = checkClaudeAuth(execFileSync);
864
+ agentRuntimeAuthenticated = await checkClaudeAuth();
853
865
  }
854
866
  var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
855
867
  async function checkAndUpdateCli() {
@@ -901,28 +913,23 @@ async function checkAndUpdateCli() {
901
913
  } catch {
902
914
  }
903
915
  }
904
- function checkClaudeAuth(execFileSync) {
916
+ async function checkClaudeAuth() {
905
917
  try {
906
- const authOutput = execFileSync("claude", ["auth", "status"], { timeout: 1e4, stdio: "pipe" }).toString().trim();
907
- let loggedIn = null;
908
- try {
909
- const parsed = JSON.parse(authOutput);
910
- if (typeof parsed.loggedIn === "boolean") loggedIn = parsed.loggedIn;
911
- } catch {
912
- const lower = authOutput.toLowerCase();
913
- if (lower.includes("not logged in") || lower.includes("logged out")) loggedIn = false;
914
- else if (lower.includes("logged in")) loggedIn = true;
915
- }
916
- if (loggedIn === false) {
917
- log('\u26A0\uFE0F Claude Code is not authenticated. Run "claude" in a terminal to log in, then restart the manager.');
918
+ const report = await detectClaudeAuth();
919
+ if (!report) {
920
+ log("\u26A0\uFE0F Claude Code is not authenticated. Run `claude /login` (or set `ANTHROPIC_API_KEY`) on the host, then the manager will pick it up on the next cycle.");
918
921
  return false;
919
- } else if (loggedIn === null) {
920
- log('\u26A0\uFE0F Could not determine Claude Code auth state. Run "claude" in a terminal to verify login.');
922
+ }
923
+ if (report.status === "expired") {
924
+ log(`\u26A0\uFE0F Claude Code auth expired (${report.mode}). Re-run \`claude /login\` to refresh.`);
921
925
  return false;
922
926
  }
927
+ if (report.status === "expiring_soon") {
928
+ log(`[auth] Claude Code token expiring soon (expires_at=${report.expires_at}) \u2014 still valid, proceeding`);
929
+ }
923
930
  return true;
924
- } catch {
925
- log('\u26A0\uFE0F Could not check Claude Code auth status. Run "claude" in a terminal to ensure it is logged in.');
931
+ } catch (err) {
932
+ log(`\u26A0\uFE0F Claude Code auth probe failed: ${err.message}`);
926
933
  return false;
927
934
  }
928
935
  }
@@ -2804,8 +2811,7 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
2804
2811
  }
2805
2812
  devChannels.push("server:direct-chat");
2806
2813
  if (!agentRuntimeAuthenticated) {
2807
- const { execFileSync } = await import("child_process");
2808
- agentRuntimeAuthenticated = checkClaudeAuth(execFileSync);
2814
+ agentRuntimeAuthenticated = await checkClaudeAuth();
2809
2815
  if (!agentRuntimeAuthenticated) {
2810
2816
  log(`[persistent-session] Skipping '${codeName}' \u2014 Claude Code not authenticated`);
2811
2817
  return;