@integrity-labs/agt-cli 0.10.21 → 0.10.22
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-QALSARWM.js} +50 -14
- package/dist/chunk-QALSARWM.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 +40 -3
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-EBTRDD7A.js → persistent-session-RPSYBZYO.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-RPSYBZYO.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-QALSARWM.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-RPSYBZYO.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);
|
|
@@ -2827,6 +2828,36 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
2827
2828
|
return;
|
|
2828
2829
|
}
|
|
2829
2830
|
}
|
|
2831
|
+
let claudeAuthMode;
|
|
2832
|
+
let anthropicApiKey;
|
|
2833
|
+
let anthropicApiKeyFingerprint;
|
|
2834
|
+
try {
|
|
2835
|
+
const apiKey = getApiKey();
|
|
2836
|
+
if (!apiKey) {
|
|
2837
|
+
log(`[persistent-session] Skipping '${codeName}' \u2014 AGT_API_KEY not set`);
|
|
2838
|
+
return;
|
|
2839
|
+
}
|
|
2840
|
+
const exchange = await exchangeApiKey(apiKey, false, { forceRefresh: true });
|
|
2841
|
+
claudeAuthMode = exchange.claudeAuthMode;
|
|
2842
|
+
anthropicApiKey = exchange.anthropicApiKey;
|
|
2843
|
+
anthropicApiKeyFingerprint = exchange.anthropicApiKeyFingerprint;
|
|
2844
|
+
} catch (err) {
|
|
2845
|
+
const msg = err.message;
|
|
2846
|
+
log(`[persistent-session] Failed to resolve auth for '${codeName}': ${msg} \u2014 refusing to spawn`);
|
|
2847
|
+
if (isSessionHealthy(codeName)) {
|
|
2848
|
+
stopPersistentSession(codeName, log);
|
|
2849
|
+
persistentSessionAgents.delete(codeName);
|
|
2850
|
+
claudeAuthTupleBySession.delete(codeName);
|
|
2851
|
+
}
|
|
2852
|
+
return;
|
|
2853
|
+
}
|
|
2854
|
+
const currentAuthTuple = `${claudeAuthMode}:${anthropicApiKeyFingerprint ?? "none"}`;
|
|
2855
|
+
const recordedAuthTuple = claudeAuthTupleBySession.get(codeName);
|
|
2856
|
+
if (recordedAuthTuple && recordedAuthTuple !== currentAuthTuple && isSessionHealthy(codeName)) {
|
|
2857
|
+
log(`[persistent-session] Auth config changed for '${codeName}' (${recordedAuthTuple} \u2192 ${currentAuthTuple}) \u2014 restarting session`);
|
|
2858
|
+
stopPersistentSession(codeName, log);
|
|
2859
|
+
persistentSessionAgents.delete(codeName);
|
|
2860
|
+
}
|
|
2830
2861
|
if (!isSessionHealthy(codeName)) {
|
|
2831
2862
|
if (persistentSessionAgents.has(codeName)) {
|
|
2832
2863
|
log(`[persistent-session] Session for '${codeName}' is unhealthy, will restart`);
|
|
@@ -2850,12 +2881,18 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
2850
2881
|
channels,
|
|
2851
2882
|
devChannels,
|
|
2852
2883
|
apiHost: requireHost(),
|
|
2884
|
+
claudeAuthMode,
|
|
2885
|
+
anthropicApiKey,
|
|
2853
2886
|
log
|
|
2854
2887
|
});
|
|
2855
2888
|
persistentSessionAgents.add(codeName);
|
|
2889
|
+
claudeAuthTupleBySession.set(codeName, currentAuthTuple);
|
|
2856
2890
|
return;
|
|
2857
2891
|
}
|
|
2858
2892
|
resetRestartCount(codeName);
|
|
2893
|
+
if (!claudeAuthTupleBySession.has(codeName)) {
|
|
2894
|
+
claudeAuthTupleBySession.set(codeName, currentAuthTuple);
|
|
2895
|
+
}
|
|
2859
2896
|
const stableTasksHash = createHash("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
2860
2897
|
const prevHash = knownTasksHashes.get(agent.agent_id);
|
|
2861
2898
|
if (stableTasksHash !== prevHash) {
|