@integrity-labs/agt-cli 0.21.2 → 0.21.3
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.
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveChannels,
|
|
23
23
|
resolveDmTarget,
|
|
24
24
|
wrapScheduledTaskPrompt
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-O52NTHB2.js";
|
|
26
26
|
import {
|
|
27
27
|
findTaskByTemplate,
|
|
28
28
|
getProjectDir,
|
|
@@ -2398,7 +2398,7 @@ function clearAgentCaches(agentId, codeName) {
|
|
|
2398
2398
|
var cachedFrameworkVersion = null;
|
|
2399
2399
|
var lastVersionCheckAt = 0;
|
|
2400
2400
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
2401
|
-
var agtCliVersion = true ? "0.21.
|
|
2401
|
+
var agtCliVersion = true ? "0.21.3" : "dev";
|
|
2402
2402
|
function resolveBrewPath(execFileSync4) {
|
|
2403
2403
|
try {
|
|
2404
2404
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -2415,6 +2415,20 @@ function resolveBrewPath(execFileSync4) {
|
|
|
2415
2415
|
}
|
|
2416
2416
|
return null;
|
|
2417
2417
|
}
|
|
2418
|
+
function claudeBinaryInstalled(execFileSync4) {
|
|
2419
|
+
const canonical = [
|
|
2420
|
+
"/home/linuxbrew/.linuxbrew/bin/claude",
|
|
2421
|
+
"/opt/homebrew/bin/claude",
|
|
2422
|
+
"/usr/local/bin/claude"
|
|
2423
|
+
];
|
|
2424
|
+
if (canonical.some((path) => existsSync3(path))) return true;
|
|
2425
|
+
try {
|
|
2426
|
+
execFileSync4("which", ["claude"], { timeout: 5e3 });
|
|
2427
|
+
return true;
|
|
2428
|
+
} catch {
|
|
2429
|
+
return false;
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2418
2432
|
var toolkitCliEnsured = /* @__PURE__ */ new Set();
|
|
2419
2433
|
var toolkitCliRetryAfter = /* @__PURE__ */ new Map();
|
|
2420
2434
|
var toolkitCliFailureCount = /* @__PURE__ */ new Map();
|
|
@@ -2572,14 +2586,7 @@ async function ensureFrameworkBinary(frameworkId) {
|
|
|
2572
2586
|
}
|
|
2573
2587
|
return runAsync(brewPath, args, opts);
|
|
2574
2588
|
};
|
|
2575
|
-
|
|
2576
|
-
if (!claudeExists) {
|
|
2577
|
-
try {
|
|
2578
|
-
execFileSync4("which", ["claude"], { timeout: 5e3 });
|
|
2579
|
-
claudeExists = true;
|
|
2580
|
-
} catch {
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2589
|
+
const claudeExists = claudeBinaryInstalled(execFileSync4);
|
|
2583
2590
|
if (!claudeExists) {
|
|
2584
2591
|
log(`Claude Code binary not found \u2014 installing via Homebrew${isRoot ? " (as ec2-user via sudo)" : ""}...`);
|
|
2585
2592
|
try {
|
|
@@ -2601,25 +2608,70 @@ async function ensureFrameworkBinary(frameworkId) {
|
|
|
2601
2608
|
} else {
|
|
2602
2609
|
log("Claude Code install completed but binary not found at expected path \u2014 check brew logs");
|
|
2603
2610
|
}
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2611
|
+
stampClaudeCodeUpgradeMarker();
|
|
2612
|
+
}
|
|
2613
|
+
agentRuntimeAuthenticated = await checkClaudeAuth();
|
|
2614
|
+
}
|
|
2615
|
+
var CLAUDE_CODE_UPGRADE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
2616
|
+
var claudeCodeUpgradeInFlight = false;
|
|
2617
|
+
function claudeCodeUpgradeMarkerPath() {
|
|
2618
|
+
return join4(homedir3(), ".augmented", ".last-claude-code-upgrade-check");
|
|
2619
|
+
}
|
|
2620
|
+
function stampClaudeCodeUpgradeMarker() {
|
|
2621
|
+
try {
|
|
2622
|
+
writeFileSync3(claudeCodeUpgradeMarkerPath(), String(Date.now()));
|
|
2623
|
+
} catch {
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
function claudeCodeUpgradeThrottled() {
|
|
2627
|
+
try {
|
|
2628
|
+
const lastCheck = parseInt(readFileSync3(claudeCodeUpgradeMarkerPath(), "utf-8").trim(), 10);
|
|
2629
|
+
if (!Number.isFinite(lastCheck)) return false;
|
|
2630
|
+
return Date.now() - lastCheck < CLAUDE_CODE_UPGRADE_CHECK_INTERVAL_MS;
|
|
2631
|
+
} catch {
|
|
2632
|
+
return false;
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
async function maybeUpgradeClaudeCode() {
|
|
2636
|
+
if (claudeCodeUpgradeInFlight) return;
|
|
2637
|
+
if (claudeCodeUpgradeThrottled()) return;
|
|
2638
|
+
claudeCodeUpgradeInFlight = true;
|
|
2639
|
+
stampClaudeCodeUpgradeMarker();
|
|
2640
|
+
const { execFileSync: execFileSync4 } = await import("child_process");
|
|
2641
|
+
const brewPath = resolveBrewPath(execFileSync4);
|
|
2642
|
+
if (!brewPath) {
|
|
2643
|
+
claudeCodeUpgradeInFlight = false;
|
|
2644
|
+
return;
|
|
2645
|
+
}
|
|
2646
|
+
if (!claudeBinaryInstalled(execFileSync4)) {
|
|
2647
|
+
claudeCodeUpgradeInFlight = false;
|
|
2648
|
+
return;
|
|
2649
|
+
}
|
|
2650
|
+
const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
|
|
2651
|
+
const runBrew = (args, opts) => {
|
|
2652
|
+
if (isRoot) {
|
|
2653
|
+
return runAsync("sudo", ["-u", "ec2-user", "-H", brewPath, ...args], { ...opts, cwd: "/tmp" });
|
|
2654
|
+
}
|
|
2655
|
+
return runAsync(brewPath, args, opts);
|
|
2656
|
+
};
|
|
2657
|
+
log(`Checking for Claude Code updates in background${isRoot ? " (as ec2-user via sudo)" : ""}...`);
|
|
2658
|
+
runBrew(["upgrade", "--cask", "claude-code"], { timeout: 12e4 }).then((r) => {
|
|
2659
|
+
const combined = `${r.stdout}
|
|
2608
2660
|
${r.stderr}`;
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
log("Claude Code is already up to date");
|
|
2612
|
-
} else {
|
|
2613
|
-
log("Claude Code upgraded successfully (will apply on next session start)");
|
|
2614
|
-
}
|
|
2615
|
-
} else if (combined.includes("already installed") || combined.includes("up-to-date") || combined.includes("not upgraded")) {
|
|
2661
|
+
if (r.code === 0) {
|
|
2662
|
+
if (combined.includes("already installed") || combined.includes("up-to-date")) {
|
|
2616
2663
|
log("Claude Code is already up to date");
|
|
2617
2664
|
} else {
|
|
2618
|
-
log(
|
|
2665
|
+
log("Claude Code upgraded successfully (will apply on next session start)");
|
|
2619
2666
|
}
|
|
2620
|
-
}
|
|
2621
|
-
|
|
2622
|
-
|
|
2667
|
+
} else if (combined.includes("already installed") || combined.includes("up-to-date") || combined.includes("not upgraded")) {
|
|
2668
|
+
log("Claude Code is already up to date");
|
|
2669
|
+
} else {
|
|
2670
|
+
log(`Claude Code upgrade failed (exit ${r.code}): ${r.stderr.trim() || r.stdout.trim()}`);
|
|
2671
|
+
}
|
|
2672
|
+
}).catch((err) => log(`Claude Code upgrade failed: ${err.message}`)).finally(() => {
|
|
2673
|
+
claudeCodeUpgradeInFlight = false;
|
|
2674
|
+
});
|
|
2623
2675
|
}
|
|
2624
2676
|
var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
2625
2677
|
var selfUpdateUpToDateLogged = false;
|
|
@@ -3280,6 +3332,7 @@ async function pollCycle() {
|
|
|
3280
3332
|
log(`[restart-handler] processRestartFlags threw: ${err.message}`);
|
|
3281
3333
|
}
|
|
3282
3334
|
checkAndUpdateCli().catch((err) => log(`[self-update] Check failed: ${err.message}`));
|
|
3335
|
+
maybeUpgradeClaudeCode().catch((err) => log(`[claude-code-upgrade] Check failed: ${err.message}`));
|
|
3283
3336
|
try {
|
|
3284
3337
|
registeredAgentsCache.clear();
|
|
3285
3338
|
gatewaysStartedThisCycle.clear();
|
|
@@ -7576,11 +7629,15 @@ process.on("disconnect", () => {
|
|
|
7576
7629
|
export {
|
|
7577
7630
|
ChildProcessError,
|
|
7578
7631
|
applyRestartAcks,
|
|
7632
|
+
claudeCodeUpgradeMarkerPath,
|
|
7633
|
+
claudeCodeUpgradeThrottled,
|
|
7579
7634
|
extractCharterSlackPeers,
|
|
7580
7635
|
extractCharterTelegramPeers,
|
|
7581
7636
|
hasRevokedResiduals,
|
|
7582
7637
|
markAgentForFreshMemorySync,
|
|
7638
|
+
maybeUpgradeClaudeCode,
|
|
7583
7639
|
shouldSkipRevokedCleanup,
|
|
7640
|
+
stampClaudeCodeUpgradeMarker,
|
|
7584
7641
|
startManager,
|
|
7585
7642
|
stopManager
|
|
7586
7643
|
};
|