@integrity-labs/agt-cli 0.10.21 → 0.10.23
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 +13 -4
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-UJJDJME5.js → chunk-4TBTAMRH.js} +51 -14
- package/dist/chunk-4TBTAMRH.js.map +1 -0
- package/dist/{chunk-XTETZ2D5.js → chunk-VWYAPGHB.js} +44 -5
- package/dist/chunk-VWYAPGHB.js.map +1 -0
- package/dist/lib/manager-worker.js +49 -7
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-EBTRDD7A.js → persistent-session-SXBLRKM6.js} +2 -2
- package/package.json +4 -1
- package/dist/chunk-UJJDJME5.js.map +0 -1
- package/dist/chunk-XTETZ2D5.js.map +0 -1
- /package/dist/{persistent-session-EBTRDD7A.js.map → persistent-session-SXBLRKM6.js.map} +0 -0
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
provisionStopHook,
|
|
11
11
|
requireHost,
|
|
12
12
|
resolveChannels
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-VWYAPGHB.js";
|
|
14
14
|
import {
|
|
15
15
|
findTaskByTemplate,
|
|
16
16
|
getProjectDir,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
startPersistentSession,
|
|
29
29
|
stopAllSessionsAndWait,
|
|
30
30
|
stopPersistentSession
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-4TBTAMRH.js";
|
|
32
32
|
|
|
33
33
|
// src/lib/manager-worker.ts
|
|
34
34
|
import { createHash } from "crypto";
|
|
@@ -1332,7 +1332,7 @@ async function pollCycle() {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
try {
|
|
1334
1334
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
1335
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
1335
|
+
const { collectDiagnostics } = await import("../persistent-session-SXBLRKM6.js");
|
|
1336
1336
|
const diagCodeNames = [...persistentSessionAgents];
|
|
1337
1337
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
|
|
1338
1338
|
let tailscaleHostname;
|
|
@@ -2800,6 +2800,7 @@ function fireClaudeWorkTrigger(codeName, agentId, boardItems) {
|
|
|
2800
2800
|
});
|
|
2801
2801
|
}
|
|
2802
2802
|
var persistentSessionAgents = /* @__PURE__ */ new Set();
|
|
2803
|
+
var claudeAuthTupleBySession = /* @__PURE__ */ new Map();
|
|
2803
2804
|
async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
2804
2805
|
const codeName = agent.code_name;
|
|
2805
2806
|
const projectDir = getProjectDir2(codeName);
|
|
@@ -2820,12 +2821,47 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
2820
2821
|
}
|
|
2821
2822
|
}
|
|
2822
2823
|
devChannels.push("server:direct-chat");
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2824
|
+
let claudeAuthMode;
|
|
2825
|
+
let anthropicApiKey;
|
|
2826
|
+
let anthropicApiKeyFingerprint;
|
|
2827
|
+
try {
|
|
2828
|
+
const apiKey = getApiKey();
|
|
2829
|
+
if (!apiKey) {
|
|
2830
|
+
log(`[persistent-session] Skipping '${codeName}' \u2014 AGT_API_KEY not set`);
|
|
2827
2831
|
return;
|
|
2828
2832
|
}
|
|
2833
|
+
const exchange = await exchangeApiKey(apiKey, false, { forceRefresh: true });
|
|
2834
|
+
claudeAuthMode = exchange.claudeAuthMode;
|
|
2835
|
+
anthropicApiKey = exchange.anthropicApiKey;
|
|
2836
|
+
anthropicApiKeyFingerprint = exchange.anthropicApiKeyFingerprint;
|
|
2837
|
+
} catch (err) {
|
|
2838
|
+
const msg = err.message;
|
|
2839
|
+
log(`[persistent-session] Failed to resolve auth for '${codeName}': ${msg} \u2014 refusing to spawn`);
|
|
2840
|
+
if (isSessionHealthy(codeName)) {
|
|
2841
|
+
stopPersistentSession(codeName, log);
|
|
2842
|
+
persistentSessionAgents.delete(codeName);
|
|
2843
|
+
claudeAuthTupleBySession.delete(codeName);
|
|
2844
|
+
}
|
|
2845
|
+
return;
|
|
2846
|
+
}
|
|
2847
|
+
if (claudeAuthMode === "subscription") {
|
|
2848
|
+
if (!agentRuntimeAuthenticated) {
|
|
2849
|
+
agentRuntimeAuthenticated = await checkClaudeAuth();
|
|
2850
|
+
if (!agentRuntimeAuthenticated) {
|
|
2851
|
+
log(`[persistent-session] Skipping '${codeName}' \u2014 Claude Code not authenticated (subscription mode)`);
|
|
2852
|
+
return;
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
} else if (!anthropicApiKey) {
|
|
2856
|
+
log(`[persistent-session] Skipping '${codeName}' \u2014 api_key mode but no key returned from exchange`);
|
|
2857
|
+
return;
|
|
2858
|
+
}
|
|
2859
|
+
const currentAuthTuple = `${claudeAuthMode}:${anthropicApiKeyFingerprint ?? "none"}`;
|
|
2860
|
+
const recordedAuthTuple = claudeAuthTupleBySession.get(codeName);
|
|
2861
|
+
if (recordedAuthTuple && recordedAuthTuple !== currentAuthTuple && isSessionHealthy(codeName)) {
|
|
2862
|
+
log(`[persistent-session] Auth config changed for '${codeName}' (${recordedAuthTuple} \u2192 ${currentAuthTuple}) \u2014 restarting session`);
|
|
2863
|
+
stopPersistentSession(codeName, log);
|
|
2864
|
+
persistentSessionAgents.delete(codeName);
|
|
2829
2865
|
}
|
|
2830
2866
|
if (!isSessionHealthy(codeName)) {
|
|
2831
2867
|
if (persistentSessionAgents.has(codeName)) {
|
|
@@ -2850,12 +2886,18 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
2850
2886
|
channels,
|
|
2851
2887
|
devChannels,
|
|
2852
2888
|
apiHost: requireHost(),
|
|
2889
|
+
claudeAuthMode,
|
|
2890
|
+
anthropicApiKey,
|
|
2853
2891
|
log
|
|
2854
2892
|
});
|
|
2855
2893
|
persistentSessionAgents.add(codeName);
|
|
2894
|
+
claudeAuthTupleBySession.set(codeName, currentAuthTuple);
|
|
2856
2895
|
return;
|
|
2857
2896
|
}
|
|
2858
2897
|
resetRestartCount(codeName);
|
|
2898
|
+
if (!claudeAuthTupleBySession.has(codeName)) {
|
|
2899
|
+
claudeAuthTupleBySession.set(codeName, currentAuthTuple);
|
|
2900
|
+
}
|
|
2859
2901
|
const stableTasksHash = createHash("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
2860
2902
|
const prevHash = knownTasksHashes.get(agent.agent_id);
|
|
2861
2903
|
if (stableTasksHash !== prevHash) {
|