@integrity-labs/agt-cli 0.7.5 → 0.7.6

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.
@@ -8,7 +8,7 @@ import {
8
8
  provision,
9
9
  requireHost,
10
10
  resolveChannels
11
- } from "../chunk-GBTJNYNP.js";
11
+ } from "../chunk-VJ7ZRBAJ.js";
12
12
  import {
13
13
  findTaskByTemplate,
14
14
  getProjectDir,
@@ -909,13 +909,24 @@ async function ensureFrameworkBinary(frameworkId) {
909
909
  }
910
910
  function checkClaudeAuth(execFileSync) {
911
911
  try {
912
- const authOutput = execFileSync("claude", ["auth", "status"], { timeout: 1e4, stdio: "pipe" }).toString();
913
- const authStatus = JSON.parse(authOutput);
914
- if (authStatus.loggedIn) {
915
- return true;
912
+ const authOutput = execFileSync("claude", ["auth", "status"], { timeout: 1e4, stdio: "pipe" }).toString().trim();
913
+ let loggedIn = null;
914
+ try {
915
+ const parsed = JSON.parse(authOutput);
916
+ if (typeof parsed.loggedIn === "boolean") loggedIn = parsed.loggedIn;
917
+ } catch {
918
+ const lower = authOutput.toLowerCase();
919
+ if (lower.includes("not logged in") || lower.includes("logged out")) loggedIn = false;
920
+ else if (lower.includes("logged in")) loggedIn = true;
916
921
  }
917
- log('\u26A0\uFE0F Claude Code is not authenticated. Run "claude" in a terminal to log in, then restart the manager.');
918
- return false;
922
+ if (loggedIn === false) {
923
+ log('\u26A0\uFE0F Claude Code is not authenticated. Run "claude" in a terminal to log in, then restart the manager.');
924
+ return false;
925
+ } else if (loggedIn === null) {
926
+ log('\u26A0\uFE0F Could not determine Claude Code auth state. Run "claude" in a terminal to verify login.');
927
+ return false;
928
+ }
929
+ return true;
919
930
  } catch {
920
931
  log('\u26A0\uFE0F Could not check Claude Code auth status. Run "claude" in a terminal to ensure it is logged in.');
921
932
  return false;
@@ -3481,9 +3492,40 @@ function stopGatewayPool() {
3481
3492
  gatewayPool = null;
3482
3493
  }
3483
3494
  }
3495
+ var caffeinateProc = null;
3496
+ async function startCaffeinate() {
3497
+ if (process.platform !== "darwin") return;
3498
+ try {
3499
+ const { spawn: spawn2 } = await import("child_process");
3500
+ caffeinateProc = spawn2("caffeinate", ["-dims"], {
3501
+ stdio: "ignore",
3502
+ detached: false
3503
+ });
3504
+ caffeinateProc.on("error", (err) => {
3505
+ log(`caffeinate failed: ${err.message} \u2014 Mac may sleep during operation`);
3506
+ caffeinateProc = null;
3507
+ });
3508
+ caffeinateProc.on("exit", () => {
3509
+ caffeinateProc = null;
3510
+ });
3511
+ if (caffeinateProc.pid) {
3512
+ log(`caffeinate started (PID ${caffeinateProc.pid}) \u2014 Mac sleep prevented while manager is running`);
3513
+ }
3514
+ } catch (err) {
3515
+ log(`caffeinate not available: ${err.message} \u2014 Mac may sleep during operation`);
3516
+ }
3517
+ }
3518
+ function stopCaffeinate() {
3519
+ if (caffeinateProc) {
3520
+ caffeinateProc.kill();
3521
+ caffeinateProc = null;
3522
+ log("caffeinate stopped");
3523
+ }
3524
+ }
3484
3525
  function startPolling() {
3485
3526
  if (!config || running) return;
3486
3527
  running = true;
3528
+ void startCaffeinate();
3487
3529
  log(`Starting poll loop (interval=${config.intervalMs}ms, configDir=${config.configDir})`);
3488
3530
  void migrateToProfiles().then(() => {
3489
3531
  startGatewayPool();
@@ -3504,6 +3546,7 @@ async function stopPolling() {
3504
3546
  clearTimeout(pollTimer);
3505
3547
  pollTimer = null;
3506
3548
  }
3549
+ stopCaffeinate();
3507
3550
  stopRealtimeChat();
3508
3551
  stopGatewayPool();
3509
3552
  await stopAllGateways();