@integrity-labs/agt-cli 0.21.2 → 0.21.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 +3 -3
- package/dist/{chunk-HPL4HOZ5.js → chunk-3H3ADCO6.js} +28 -4
- package/dist/chunk-3H3ADCO6.js.map +1 -0
- package/dist/{chunk-UYSBSXV6.js → chunk-E4XLJCJT.js} +57 -17
- package/dist/chunk-E4XLJCJT.js.map +1 -0
- package/dist/{claude-pair-runtime-ABVKSL5L.js → claude-pair-runtime-LXGQZBLL.js} +7 -3
- package/dist/claude-pair-runtime-LXGQZBLL.js.map +1 -0
- package/dist/lib/manager-worker.js +107 -33
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-7Y2QY3QP.js → persistent-session-53VP7AB7.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-HPL4HOZ5.js.map +0 -1
- package/dist/chunk-UYSBSXV6.js.map +0 -1
- package/dist/claude-pair-runtime-ABVKSL5L.js.map +0 -1
- /package/dist/{persistent-session-7Y2QY3QP.js.map → persistent-session-53VP7AB7.js.map} +0 -0
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveChannels,
|
|
23
23
|
resolveDmTarget,
|
|
24
24
|
wrapScheduledTaskPrompt
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-3H3ADCO6.js";
|
|
26
26
|
import {
|
|
27
27
|
findTaskByTemplate,
|
|
28
28
|
getProjectDir,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
startPersistentSession,
|
|
51
51
|
stopAllSessionsAndWait,
|
|
52
52
|
stopPersistentSession
|
|
53
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-E4XLJCJT.js";
|
|
54
54
|
|
|
55
55
|
// src/lib/manager-worker.ts
|
|
56
56
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -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.6" : "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();
|
|
@@ -3302,7 +3355,7 @@ async function pollCycle() {
|
|
|
3302
3355
|
}
|
|
3303
3356
|
try {
|
|
3304
3357
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
3305
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
3358
|
+
const { collectDiagnostics } = await import("../persistent-session-53VP7AB7.js");
|
|
3306
3359
|
const diagCodeNames = [...persistentSessionAgents];
|
|
3307
3360
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
|
|
3308
3361
|
let tailscaleHostname;
|
|
@@ -3953,7 +4006,11 @@ async function processAgent(agent, agentStates) {
|
|
|
3953
4006
|
if (next === "off" || next === "cross_team_only" || next === "all") return next;
|
|
3954
4007
|
return teamSettings?.["telegram_peer_disabled"] === true ? "all" : "off";
|
|
3955
4008
|
})();
|
|
3956
|
-
const
|
|
4009
|
+
const agentTimezone = (() => {
|
|
4010
|
+
const tz = teamSettings?.["timezone"];
|
|
4011
|
+
return typeof tz === "string" && tz.trim() !== "" ? tz.trim() : void 0;
|
|
4012
|
+
})();
|
|
4013
|
+
const teamSettingsForHash = channelId === "telegram" || channelId === "slack" || channelId === "direct-chat" ? { peer_disabled: peerDisabledMode, timezone: agentTimezone ?? null } : null;
|
|
3957
4014
|
const crossTeamData = refreshData;
|
|
3958
4015
|
const refreshHasCrossTeamFields = channelId === "telegram" ? Array.isArray(crossTeamData.team_peer_bot_ids) : channelId === "slack" ? Array.isArray(crossTeamData.team_peer_slack_user_ids) : false;
|
|
3959
4016
|
const gateContext = refreshHasCrossTeamFields ? {
|
|
@@ -3964,7 +4021,7 @@ async function processAgent(agent, agentStates) {
|
|
|
3964
4021
|
} : void 0;
|
|
3965
4022
|
const peersForHash = channelId === "telegram" ? extractCharterTelegramPeers(refreshData.charter?.raw_content ?? "", gateContext) : channelId === "slack" ? extractCharterSlackPeers(refreshData.charter?.raw_content ?? "", gateContext) : null;
|
|
3966
4023
|
const sessionModeForHash = refreshData.agent.session_mode;
|
|
3967
|
-
const CHANNEL_WRITE_VERSION =
|
|
4024
|
+
const CHANNEL_WRITE_VERSION = 5;
|
|
3968
4025
|
const configHash = createHash2("sha256").update(
|
|
3969
4026
|
canonicalJson({
|
|
3970
4027
|
writeVersion: CHANNEL_WRITE_VERSION,
|
|
@@ -4007,7 +4064,8 @@ async function processAgent(agent, agentStates) {
|
|
|
4007
4064
|
telegramPeerDisabled,
|
|
4008
4065
|
peerDisabled,
|
|
4009
4066
|
telegramPeers,
|
|
4010
|
-
slackPeers
|
|
4067
|
+
slackPeers,
|
|
4068
|
+
agentTimezone
|
|
4011
4069
|
}
|
|
4012
4070
|
);
|
|
4013
4071
|
knownChannelConfigHashes.set(cacheKey, configHash);
|
|
@@ -4069,6 +4127,11 @@ async function processAgent(agent, agentStates) {
|
|
|
4069
4127
|
} catch {
|
|
4070
4128
|
}
|
|
4071
4129
|
const localDirectChatChannel = join4(homedir3(), ".augmented", "_mcp", "direct-chat-channel.js");
|
|
4130
|
+
const directChatTeamSettings = refreshData.team?.settings;
|
|
4131
|
+
const directChatTz = (() => {
|
|
4132
|
+
const tz = directChatTeamSettings?.["timezone"];
|
|
4133
|
+
return typeof tz === "string" && tz.trim() !== "" ? tz.trim() : void 0;
|
|
4134
|
+
})();
|
|
4072
4135
|
if (existsSync3(localDirectChatChannel) && !mcpConfig.mcpServers["direct-chat"]) {
|
|
4073
4136
|
mcpConfig.mcpServers["direct-chat"] = {
|
|
4074
4137
|
command: "node",
|
|
@@ -4076,7 +4139,8 @@ async function processAgent(agent, agentStates) {
|
|
|
4076
4139
|
env: {
|
|
4077
4140
|
AGT_HOST: requireHost(),
|
|
4078
4141
|
AGT_API_KEY: getApiKey() ?? "",
|
|
4079
|
-
AGT_AGENT_ID: agent.agent_id
|
|
4142
|
+
AGT_AGENT_ID: agent.agent_id,
|
|
4143
|
+
...directChatTz ? { TZ: directChatTz } : {}
|
|
4080
4144
|
}
|
|
4081
4145
|
};
|
|
4082
4146
|
const serialized = JSON.stringify(mcpConfig, null, 2);
|
|
@@ -5338,6 +5402,11 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
5338
5402
|
const projectDir = getProjectDir2(codeName);
|
|
5339
5403
|
const mcpConfigPath = join4(projectDir, ".mcp.json");
|
|
5340
5404
|
const claudeMdPath = join4(projectDir, "CLAUDE.md");
|
|
5405
|
+
const teamSettingsForTz = refreshData.team?.settings;
|
|
5406
|
+
const agentTimezone = (() => {
|
|
5407
|
+
const tz = teamSettingsForTz?.["timezone"];
|
|
5408
|
+
return typeof tz === "string" && tz.trim() !== "" ? tz.trim() : void 0;
|
|
5409
|
+
})();
|
|
5341
5410
|
const channelConfigs = refreshData.channel_configs;
|
|
5342
5411
|
const channels = [];
|
|
5343
5412
|
const devChannels = [];
|
|
@@ -5419,7 +5488,7 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
5419
5488
|
persistentSessionAgents.delete(codeName);
|
|
5420
5489
|
restartTrigger = "auth-tuple";
|
|
5421
5490
|
}
|
|
5422
|
-
if (isStaleForToday(codeName) && isSessionHealthy(codeName)) {
|
|
5491
|
+
if (isStaleForToday(codeName, /* @__PURE__ */ new Date(), agentTimezone) && isSessionHealthy(codeName)) {
|
|
5423
5492
|
const current = peekCurrentSession(codeName);
|
|
5424
5493
|
if (current) {
|
|
5425
5494
|
const idle = isAgentIdle(projectDir, current.sessionId);
|
|
@@ -5477,6 +5546,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash2("sha256").
|
|
|
5477
5546
|
claudeAuthMode,
|
|
5478
5547
|
anthropicApiKey,
|
|
5479
5548
|
runId: sessionRunResult.run_id,
|
|
5549
|
+
agentTimezone,
|
|
5480
5550
|
log
|
|
5481
5551
|
});
|
|
5482
5552
|
persistentSessionAgents.add(codeName);
|
|
@@ -6825,7 +6895,7 @@ async function processClaudePairSessions(agents) {
|
|
|
6825
6895
|
killPairSession,
|
|
6826
6896
|
pairTmuxSession,
|
|
6827
6897
|
finalizeClaudePairOnboarding
|
|
6828
|
-
} = await import("../claude-pair-runtime-
|
|
6898
|
+
} = await import("../claude-pair-runtime-LXGQZBLL.js");
|
|
6829
6899
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
6830
6900
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
6831
6901
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -7576,11 +7646,15 @@ process.on("disconnect", () => {
|
|
|
7576
7646
|
export {
|
|
7577
7647
|
ChildProcessError,
|
|
7578
7648
|
applyRestartAcks,
|
|
7649
|
+
claudeCodeUpgradeMarkerPath,
|
|
7650
|
+
claudeCodeUpgradeThrottled,
|
|
7579
7651
|
extractCharterSlackPeers,
|
|
7580
7652
|
extractCharterTelegramPeers,
|
|
7581
7653
|
hasRevokedResiduals,
|
|
7582
7654
|
markAgentForFreshMemorySync,
|
|
7655
|
+
maybeUpgradeClaudeCode,
|
|
7583
7656
|
shouldSkipRevokedCleanup,
|
|
7657
|
+
stampClaudeCodeUpgradeMarker,
|
|
7584
7658
|
startManager,
|
|
7585
7659
|
stopManager
|
|
7586
7660
|
};
|