@integrity-labs/agt-cli 0.7.4 → 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.
- package/dist/bin/agt.js +5 -5
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-GBTJNYNP.js → chunk-VJ7ZRBAJ.js} +8 -2
- package/dist/chunk-VJ7ZRBAJ.js.map +1 -0
- package/dist/lib/manager-worker.js +70 -2
- package/dist/lib/manager-worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-GBTJNYNP.js.map +0 -1
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
provision,
|
|
9
9
|
requireHost,
|
|
10
10
|
resolveChannels
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-VJ7ZRBAJ.js";
|
|
12
12
|
import {
|
|
13
13
|
findTaskByTemplate,
|
|
14
14
|
getProjectDir,
|
|
@@ -776,6 +776,7 @@ var state = {
|
|
|
776
776
|
var registeredAgentsCache = /* @__PURE__ */ new Map();
|
|
777
777
|
var agentFrameworkCache = /* @__PURE__ */ new Map();
|
|
778
778
|
var frameworkBinaryChecked = /* @__PURE__ */ new Set();
|
|
779
|
+
var agentRuntimeAuthenticated = false;
|
|
779
780
|
function resolveAgentFramework(codeName) {
|
|
780
781
|
const frameworkId = agentFrameworkCache.get(codeName) ?? "openclaw";
|
|
781
782
|
return getFramework(frameworkId);
|
|
@@ -904,6 +905,32 @@ async function ensureFrameworkBinary(frameworkId) {
|
|
|
904
905
|
}
|
|
905
906
|
}
|
|
906
907
|
}
|
|
908
|
+
agentRuntimeAuthenticated = checkClaudeAuth(execFileSync);
|
|
909
|
+
}
|
|
910
|
+
function checkClaudeAuth(execFileSync) {
|
|
911
|
+
try {
|
|
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;
|
|
921
|
+
}
|
|
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;
|
|
930
|
+
} catch {
|
|
931
|
+
log('\u26A0\uFE0F Could not check Claude Code auth status. Run "claude" in a terminal to ensure it is logged in.');
|
|
932
|
+
return false;
|
|
933
|
+
}
|
|
907
934
|
}
|
|
908
935
|
function loadGatewayPorts() {
|
|
909
936
|
try {
|
|
@@ -1225,7 +1252,8 @@ async function pollCycle() {
|
|
|
1225
1252
|
await api.post("/host/heartbeat", {
|
|
1226
1253
|
host_id: hostId,
|
|
1227
1254
|
framework_version: cachedFrameworkVersion ?? void 0,
|
|
1228
|
-
host_security: detectHostSecurity() ?? void 0
|
|
1255
|
+
host_security: detectHostSecurity() ?? void 0,
|
|
1256
|
+
agent_runtime_authenticated: agentRuntimeAuthenticated
|
|
1229
1257
|
});
|
|
1230
1258
|
} catch (err) {
|
|
1231
1259
|
log(`Heartbeat failed: ${err.message}`);
|
|
@@ -2421,6 +2449,14 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
2421
2449
|
devChannels.push("server:slack");
|
|
2422
2450
|
}
|
|
2423
2451
|
}
|
|
2452
|
+
if (!agentRuntimeAuthenticated) {
|
|
2453
|
+
const { execFileSync } = await import("child_process");
|
|
2454
|
+
agentRuntimeAuthenticated = checkClaudeAuth(execFileSync);
|
|
2455
|
+
if (!agentRuntimeAuthenticated) {
|
|
2456
|
+
log(`[persistent-session] Skipping '${codeName}' \u2014 Claude Code not authenticated`);
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2424
2460
|
if (!isSessionHealthy(codeName)) {
|
|
2425
2461
|
if (persistentSessionAgents.has(codeName)) {
|
|
2426
2462
|
log(`[persistent-session] Session for '${codeName}' is unhealthy, will restart`);
|
|
@@ -3456,9 +3492,40 @@ function stopGatewayPool() {
|
|
|
3456
3492
|
gatewayPool = null;
|
|
3457
3493
|
}
|
|
3458
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
|
+
}
|
|
3459
3525
|
function startPolling() {
|
|
3460
3526
|
if (!config || running) return;
|
|
3461
3527
|
running = true;
|
|
3528
|
+
void startCaffeinate();
|
|
3462
3529
|
log(`Starting poll loop (interval=${config.intervalMs}ms, configDir=${config.configDir})`);
|
|
3463
3530
|
void migrateToProfiles().then(() => {
|
|
3464
3531
|
startGatewayPool();
|
|
@@ -3479,6 +3546,7 @@ async function stopPolling() {
|
|
|
3479
3546
|
clearTimeout(pollTimer);
|
|
3480
3547
|
pollTimer = null;
|
|
3481
3548
|
}
|
|
3549
|
+
stopCaffeinate();
|
|
3482
3550
|
stopRealtimeChat();
|
|
3483
3551
|
stopGatewayPool();
|
|
3484
3552
|
await stopAllGateways();
|