@atlasharness/atlascode 0.1.74 → 0.1.75
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/cli.js +19 -373
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -28664,9 +28664,6 @@ function setIsInteractive(v) {
|
|
|
28664
28664
|
function setClientType(t) {
|
|
28665
28665
|
_clientType = t;
|
|
28666
28666
|
}
|
|
28667
|
-
function getClientType() {
|
|
28668
|
-
return _clientType;
|
|
28669
|
-
}
|
|
28670
28667
|
function setQuestionPreviewFormat(f) {
|
|
28671
28668
|
_questionPreviewFormat = f;
|
|
28672
28669
|
}
|
|
@@ -85413,17 +85410,13 @@ async function main() {
|
|
|
85413
85410
|
return "local-agent";
|
|
85414
85411
|
if (process.env.ATLAS_ENTRYPOINT === "claude-desktop")
|
|
85415
85412
|
return "claude-desktop";
|
|
85416
|
-
const hasSessionIngressToken = process.env.ATLAS_SESSION_ACCESS_TOKEN || process.env.ATLAS_WEBSOCKET_AUTH_FILE_DESCRIPTOR;
|
|
85417
|
-
if (process.env.ATLAS_ENTRYPOINT === "remote" || hasSessionIngressToken) {
|
|
85418
|
-
return "remote";
|
|
85419
|
-
}
|
|
85420
85413
|
return "cli";
|
|
85421
85414
|
})();
|
|
85422
85415
|
setClientType(clientType);
|
|
85423
85416
|
const previewFormat = process.env.ATLAS_QUESTION_PREVIEW_FORMAT;
|
|
85424
85417
|
if (previewFormat === "markdown" || previewFormat === "html") {
|
|
85425
85418
|
setQuestionPreviewFormat(previewFormat);
|
|
85426
|
-
} else if (!clientType.startsWith("sdk-") && clientType !== "claude-desktop" && clientType !== "local-agent"
|
|
85419
|
+
} else if (!clientType.startsWith("sdk-") && clientType !== "claude-desktop" && clientType !== "local-agent") {
|
|
85427
85420
|
setQuestionPreviewFormat("markdown");
|
|
85428
85421
|
}
|
|
85429
85422
|
eagerLoadSettings();
|
|
@@ -125692,7 +125685,7 @@ var _spSectionCache, _agentColorMap, _invokedSkillsByAgent, _invokedSkillAgentKe
|
|
|
125692
125685
|
_spSectionCache.clear();
|
|
125693
125686
|
}, getSystemPromptSectionCache = () => _spSectionCache, setSystemPromptSectionCacheEntry = (name, value) => {
|
|
125694
125687
|
_spSectionCache.set(name, value);
|
|
125695
|
-
}, setCachedClaudeMdContent = () => ({}), getLastApiCompletionTimestamp = () => ({}), getPromptCache1hAllowlist = () => null, getPromptCache1hEligible = () => null, setPromptCache1hAllowlist = () => ({}), setPromptCache1hEligible = () => ({}), setLastApiCompletionTimestamp = () => ({}), hasExitedPlanModeInSession = () => ({}), getLastEmittedDate = () => ({}), preferThirdPartyAuthentication = () => ({}), getApiKeyFromFd = () => ({}), getOauthTokenFromFd = () => ({}), setApiKeyFromFd = () => ({}), setOauthTokenFromFd = () => ({}), onSessionSwitch = () => ({}), getSessionCronTasks = () => ({}), removeSessionCronTasks = () => ({}), addSessionCronTask = () => ({}), getCachedClaudeMdContent = () => ({}), setLastClassifierRequests = () => ({}), clearRegisteredPluginHooks = () => ({}),
|
|
125688
|
+
}, setCachedClaudeMdContent = () => ({}), getLastApiCompletionTimestamp = () => ({}), getPromptCache1hAllowlist = () => null, getPromptCache1hEligible = () => null, setPromptCache1hAllowlist = () => ({}), setPromptCache1hEligible = () => ({}), setLastApiCompletionTimestamp = () => ({}), hasExitedPlanModeInSession = () => ({}), getLastEmittedDate = () => ({}), preferThirdPartyAuthentication = () => ({}), getApiKeyFromFd = () => ({}), getOauthTokenFromFd = () => ({}), setApiKeyFromFd = () => ({}), setOauthTokenFromFd = () => ({}), onSessionSwitch = () => ({}), getSessionCronTasks = () => ({}), removeSessionCronTasks = () => ({}), addSessionCronTask = () => ({}), getCachedClaudeMdContent = () => ({}), setLastClassifierRequests = () => ({}), clearRegisteredPluginHooks = () => ({}), getSessionProjectDir = () => null, getLastMainRequestId = () => ({}), getStatsStore = () => null, getFlagSettingsPath = () => "/tmp/.claude-flags.json", needsPlanModeExitAttachment = () => ({}), needsAutoModeExitAttachment = () => ({}), getScheduledTasksEnabled = () => ({}), _turnHookDurationMs = 0, _turnHookCount = 0, _turnToolDurationMs = 0, _turnToolCount = 0, _turnClassifierDurationMs = 0, _turnClassifierCount = 0, addToTurnHookDuration = (durationMs) => {
|
|
125696
125689
|
_turnHookDurationMs += durationMs;
|
|
125697
125690
|
_turnHookCount++;
|
|
125698
125691
|
}, handleAutoModeTransition = () => ({}), addToTurnClassifierDuration = (durationMs) => {
|
|
@@ -181783,28 +181776,6 @@ var init_argumentSubstitution2 = __esm(() => {
|
|
|
181783
181776
|
init_shellQuote2();
|
|
181784
181777
|
});
|
|
181785
181778
|
|
|
181786
|
-
// src/tui/constants/product.ts
|
|
181787
|
-
function isRemoteSessionStaging(sessionId, ingressUrl) {
|
|
181788
|
-
return sessionId?.includes("_staging_") === true || ingressUrl?.includes("staging") === true;
|
|
181789
|
-
}
|
|
181790
|
-
function isRemoteSessionLocal(sessionId, ingressUrl) {
|
|
181791
|
-
return sessionId?.includes("_local_") === true || ingressUrl?.includes("localhost") === true;
|
|
181792
|
-
}
|
|
181793
|
-
function getClaudeAiBaseUrl(sessionId, ingressUrl) {
|
|
181794
|
-
if (isRemoteSessionLocal(sessionId, ingressUrl)) {
|
|
181795
|
-
return CLAUDE_AI_LOCAL_BASE_URL;
|
|
181796
|
-
}
|
|
181797
|
-
if (isRemoteSessionStaging(sessionId, ingressUrl)) {
|
|
181798
|
-
return CLAUDE_AI_STAGING_BASE_URL;
|
|
181799
|
-
}
|
|
181800
|
-
return CLAUDE_AI_BASE_URL;
|
|
181801
|
-
}
|
|
181802
|
-
function getRemoteSessionUrl(sessionId, ingressUrl) {
|
|
181803
|
-
const baseUrl = getClaudeAiBaseUrl(sessionId, ingressUrl);
|
|
181804
|
-
return `${baseUrl}/code/${sessionId}`;
|
|
181805
|
-
}
|
|
181806
|
-
var CLAUDE_AI_BASE_URL = "https://claude.ai", CLAUDE_AI_STAGING_BASE_URL = "https://claude-ai.staging.ant.dev", CLAUDE_AI_LOCAL_BASE_URL = "http://localhost:4000";
|
|
181807
|
-
|
|
181808
181779
|
// src/tui/utils/generatedFiles.ts
|
|
181809
181780
|
import { basename as basename18, extname as extname7, posix as posix4, sep as sep15 } from "path";
|
|
181810
181781
|
function isGeneratedFile(filePath) {
|
|
@@ -197438,7 +197409,7 @@ function getApiKeyFromFileDescriptor() {
|
|
|
197438
197409
|
setCached: setApiKeyFromFd
|
|
197439
197410
|
});
|
|
197440
197411
|
}
|
|
197441
|
-
var CCR_TOKEN_DIR, CCR_OAUTH_TOKEN_PATH, CCR_API_KEY_PATH
|
|
197412
|
+
var CCR_TOKEN_DIR, CCR_OAUTH_TOKEN_PATH, CCR_API_KEY_PATH;
|
|
197442
197413
|
var init_authFileDescriptor = __esm(() => {
|
|
197443
197414
|
init_bootstrapState();
|
|
197444
197415
|
init_debug();
|
|
@@ -197448,7 +197419,6 @@ var init_authFileDescriptor = __esm(() => {
|
|
|
197448
197419
|
CCR_TOKEN_DIR = join82(getAtlasConfigHomeDir3(), "remote");
|
|
197449
197420
|
CCR_OAUTH_TOKEN_PATH = `${CCR_TOKEN_DIR}/.oauth_token`;
|
|
197450
197421
|
CCR_API_KEY_PATH = `${CCR_TOKEN_DIR}/.api_key`;
|
|
197451
|
-
CCR_SESSION_INGRESS_TOKEN_PATH = `${CCR_TOKEN_DIR}/.session_ingress_token`;
|
|
197452
197422
|
});
|
|
197453
197423
|
|
|
197454
197424
|
// src/tui/utils/authPortable.ts
|
|
@@ -200939,63 +200909,6 @@ function recursivelySanitizeUnicode2(value) {
|
|
|
200939
200909
|
return value;
|
|
200940
200910
|
}
|
|
200941
200911
|
|
|
200942
|
-
// src/tui/utils/sessionIngressAuth.ts
|
|
200943
|
-
function getTokenFromFileDescriptor() {
|
|
200944
|
-
const cachedToken = getSessionIngressToken();
|
|
200945
|
-
if (cachedToken !== undefined) {
|
|
200946
|
-
return cachedToken;
|
|
200947
|
-
}
|
|
200948
|
-
const fdEnv = process.env.ATLAS_WEBSOCKET_AUTH_FILE_DESCRIPTOR;
|
|
200949
|
-
if (!fdEnv) {
|
|
200950
|
-
const path = process.env.ATLAS_SESSION_INGRESS_TOKEN_FILE ?? CCR_SESSION_INGRESS_TOKEN_PATH;
|
|
200951
|
-
const fromFile = readTokenFromWellKnownFile(path, "session ingress token");
|
|
200952
|
-
setSessionIngressToken(fromFile);
|
|
200953
|
-
return fromFile;
|
|
200954
|
-
}
|
|
200955
|
-
const fd = parseInt(fdEnv, 10);
|
|
200956
|
-
if (Number.isNaN(fd)) {
|
|
200957
|
-
logForDebugging3(`ATLAS_WEBSOCKET_AUTH_FILE_DESCRIPTOR must be a valid file descriptor number, got: ${fdEnv}`, { level: "error" });
|
|
200958
|
-
setSessionIngressToken(null);
|
|
200959
|
-
return null;
|
|
200960
|
-
}
|
|
200961
|
-
try {
|
|
200962
|
-
const fsOps = getFsImplementation2();
|
|
200963
|
-
const fdPath = process.platform === "darwin" || process.platform === "freebsd" ? `/dev/fd/${fd}` : `/proc/self/fd/${fd}`;
|
|
200964
|
-
const token = fsOps.readFileSync(fdPath, { encoding: "utf8" }).trim();
|
|
200965
|
-
if (!token) {
|
|
200966
|
-
logForDebugging3("File descriptor contained empty token", {
|
|
200967
|
-
level: "error"
|
|
200968
|
-
});
|
|
200969
|
-
setSessionIngressToken(null);
|
|
200970
|
-
return null;
|
|
200971
|
-
}
|
|
200972
|
-
logForDebugging3(`Successfully read token from file descriptor ${fd}`);
|
|
200973
|
-
setSessionIngressToken(token);
|
|
200974
|
-
maybePersistTokenForSubprocesses(CCR_SESSION_INGRESS_TOKEN_PATH, token, "session ingress token");
|
|
200975
|
-
return token;
|
|
200976
|
-
} catch (error) {
|
|
200977
|
-
logForDebugging3(`Failed to read token from file descriptor ${fd}: ${errorMessage2(error)}`, { level: "error" });
|
|
200978
|
-
const path = process.env.ATLAS_SESSION_INGRESS_TOKEN_FILE ?? CCR_SESSION_INGRESS_TOKEN_PATH;
|
|
200979
|
-
const fromFile = readTokenFromWellKnownFile(path, "session ingress token");
|
|
200980
|
-
setSessionIngressToken(fromFile);
|
|
200981
|
-
return fromFile;
|
|
200982
|
-
}
|
|
200983
|
-
}
|
|
200984
|
-
function getSessionIngressAuthToken() {
|
|
200985
|
-
const envToken = process.env.ATLAS_SESSION_ACCESS_TOKEN;
|
|
200986
|
-
if (envToken) {
|
|
200987
|
-
return envToken;
|
|
200988
|
-
}
|
|
200989
|
-
return getTokenFromFileDescriptor();
|
|
200990
|
-
}
|
|
200991
|
-
var init_sessionIngressAuth = __esm(() => {
|
|
200992
|
-
init_bootstrapState();
|
|
200993
|
-
init_authFileDescriptor();
|
|
200994
|
-
init_debug();
|
|
200995
|
-
init_errors4();
|
|
200996
|
-
init_fsOperations();
|
|
200997
|
-
});
|
|
200998
|
-
|
|
200999
200912
|
// src/tui/utils/subprocessEnv.ts
|
|
201000
200913
|
function subprocessEnv() {
|
|
201001
200914
|
const proxyEnv = _getUpstreamProxyEnv?.() ?? {};
|
|
@@ -209988,7 +209901,6 @@ var init_client4 = __esm(() => {
|
|
|
209988
209901
|
init_memoize2();
|
|
209989
209902
|
init_mtls();
|
|
209990
209903
|
init_proxy();
|
|
209991
|
-
init_sessionIngressAuth();
|
|
209992
209904
|
init_subprocessEnv();
|
|
209993
209905
|
init_toolResultStorage();
|
|
209994
209906
|
init_elicitationHandler();
|
|
@@ -210040,7 +209952,6 @@ var init_client4 = __esm(() => {
|
|
|
210040
209952
|
let inProcessServer;
|
|
210041
209953
|
try {
|
|
210042
209954
|
let transport;
|
|
210043
|
-
const sessionIngressToken = getSessionIngressAuthToken();
|
|
210044
209955
|
if (serverRef.type === "sse") {
|
|
210045
209956
|
const authProvider = new ClaudeAuthProvider(name, serverRef);
|
|
210046
209957
|
const combinedHeaders = await getMcpServerHeaders(name, serverRef);
|
|
@@ -210126,16 +210037,12 @@ var init_client4 = __esm(() => {
|
|
|
210126
210037
|
const tlsOptions = getWebSocketTLSOptions();
|
|
210127
210038
|
const wsHeaders = {
|
|
210128
210039
|
"User-Agent": getMCPUserAgent(),
|
|
210129
|
-
...sessionIngressToken && {
|
|
210130
|
-
Authorization: `Bearer ${sessionIngressToken}`
|
|
210131
|
-
},
|
|
210132
210040
|
...combinedHeaders
|
|
210133
210041
|
};
|
|
210134
210042
|
const wsHeadersForLogging = mapValues_default(wsHeaders, (value, key) => key.toLowerCase() === "authorization" ? "[REDACTED]" : value);
|
|
210135
210043
|
logMCPDebug(name, `WebSocket transport options: ${jsonStringify5({
|
|
210136
210044
|
url: serverRef.url,
|
|
210137
|
-
headers: wsHeadersForLogging
|
|
210138
|
-
hasSessionAuth: !!sessionIngressToken
|
|
210045
|
+
headers: wsHeadersForLogging
|
|
210139
210046
|
})}`);
|
|
210140
210047
|
let wsClient;
|
|
210141
210048
|
if (typeof Bun !== "undefined") {
|
|
@@ -210165,7 +210072,6 @@ var init_client4 = __esm(() => {
|
|
|
210165
210072
|
})}`);
|
|
210166
210073
|
const authProvider = new ClaudeAuthProvider(name, serverRef);
|
|
210167
210074
|
const combinedHeaders = await getMcpServerHeaders(name, serverRef);
|
|
210168
|
-
const hasOAuthTokens = !!await authProvider.tokens();
|
|
210169
210075
|
const proxyOptions = getProxyFetchOptions();
|
|
210170
210076
|
logMCPDebug(name, `Proxy options: ${proxyOptions.dispatcher ? "custom dispatcher" : "default"}`);
|
|
210171
210077
|
const transportOptions = {
|
|
@@ -210175,9 +210081,6 @@ var init_client4 = __esm(() => {
|
|
|
210175
210081
|
...proxyOptions,
|
|
210176
210082
|
headers: {
|
|
210177
210083
|
"User-Agent": getMCPUserAgent(),
|
|
210178
|
-
...sessionIngressToken && !hasOAuthTokens && {
|
|
210179
|
-
Authorization: `Bearer ${sessionIngressToken}`
|
|
210180
|
-
},
|
|
210181
210084
|
...combinedHeaders
|
|
210182
210085
|
}
|
|
210183
210086
|
}
|
|
@@ -254826,17 +254729,6 @@ function buildPRTrailers(_attributionData, _attribution) {
|
|
|
254826
254729
|
// src/tui/utils/attribution.ts
|
|
254827
254730
|
import { stat as stat30 } from "fs/promises";
|
|
254828
254731
|
function getAttributionTexts() {
|
|
254829
|
-
if (getClientType() === "remote") {
|
|
254830
|
-
const remoteSessionId = process.env.ATLAS_REMOTE_SESSION_ID;
|
|
254831
|
-
if (remoteSessionId) {
|
|
254832
|
-
const ingressUrl = process.env.SESSION_INGRESS_URL;
|
|
254833
|
-
if (!isRemoteSessionLocal(remoteSessionId, ingressUrl)) {
|
|
254834
|
-
const sessionUrl = getRemoteSessionUrl(remoteSessionId, ingressUrl);
|
|
254835
|
-
return { commit: sessionUrl, pr: sessionUrl };
|
|
254836
|
-
}
|
|
254837
|
-
}
|
|
254838
|
-
return { commit: "", pr: "" };
|
|
254839
|
-
}
|
|
254840
254732
|
const model = getMainLoopModel();
|
|
254841
254733
|
const isKnownPublicModel = getPublicModelDisplayName(model) !== null;
|
|
254842
254734
|
const modelName = isInternalModelRepoCached() || isKnownPublicModel ? getPublicModelName(model) : "Atlas Opus 4.6";
|
|
@@ -254949,16 +254841,6 @@ async function getTranscriptStats() {
|
|
|
254949
254841
|
}
|
|
254950
254842
|
}
|
|
254951
254843
|
async function getEnhancedPRAttribution(getAppState) {
|
|
254952
|
-
if (getClientType() === "remote") {
|
|
254953
|
-
const remoteSessionId = process.env.ATLAS_REMOTE_SESSION_ID;
|
|
254954
|
-
if (remoteSessionId) {
|
|
254955
|
-
const ingressUrl = process.env.SESSION_INGRESS_URL;
|
|
254956
|
-
if (!isRemoteSessionLocal(remoteSessionId, ingressUrl)) {
|
|
254957
|
-
return getRemoteSessionUrl(remoteSessionId, ingressUrl);
|
|
254958
|
-
}
|
|
254959
|
-
}
|
|
254960
|
-
return "";
|
|
254961
|
-
}
|
|
254962
254844
|
const settings = getInitialSettings2();
|
|
254963
254845
|
if (settings.attribution?.pr) {
|
|
254964
254846
|
return settings.attribution.pr;
|
|
@@ -255006,7 +254888,6 @@ ${trailers.join(`
|
|
|
255006
254888
|
var MEMORY_ACCESS_TOOL_NAMES;
|
|
255007
254889
|
var init_attribution = __esm(() => {
|
|
255008
254890
|
init_shared();
|
|
255009
|
-
init_bootstrap();
|
|
255010
254891
|
init_xml();
|
|
255011
254892
|
init_constants8();
|
|
255012
254893
|
init_prompt2();
|
|
@@ -311079,9 +310960,6 @@ function gracefulShutdownSync(exitCode = 0, reason = "other", options) {
|
|
|
311079
310960
|
forceExit(exitCode);
|
|
311080
310961
|
}).catch(() => {});
|
|
311081
310962
|
}
|
|
311082
|
-
function isShuttingDown() {
|
|
311083
|
-
return shutdownInProgress;
|
|
311084
|
-
}
|
|
311085
310963
|
async function gracefulShutdown(exitCode = 0, reason = "other", options) {
|
|
311086
310964
|
if (shutdownInProgress) {
|
|
311087
310965
|
return;
|
|
@@ -347228,183 +347106,6 @@ var init_fileSuggestions = __esm(() => {
|
|
|
347228
347106
|
cachedTrackedDirs = [];
|
|
347229
347107
|
});
|
|
347230
347108
|
|
|
347231
|
-
// src/tui/constants/oauth.ts
|
|
347232
|
-
function getOauthConfig() {
|
|
347233
|
-
return PROD_OAUTH_CONFIG;
|
|
347234
|
-
}
|
|
347235
|
-
var PROD_OAUTH_CONFIG;
|
|
347236
|
-
var init_oauth = __esm(() => {
|
|
347237
|
-
PROD_OAUTH_CONFIG = {
|
|
347238
|
-
BASE_API_URL: undefined,
|
|
347239
|
-
CLAUDE_AI_ORIGIN: undefined
|
|
347240
|
-
};
|
|
347241
|
-
});
|
|
347242
|
-
|
|
347243
|
-
// src/tui/services/api/sessionIngress.ts
|
|
347244
|
-
function getOrCreateSequentialAppend(sessionId) {
|
|
347245
|
-
let sequentialAppend = sequentialAppendBySession.get(sessionId);
|
|
347246
|
-
if (!sequentialAppend) {
|
|
347247
|
-
sequentialAppend = sequential(async (entry, url, headers) => await appendSessionLogImpl(sessionId, entry, url, headers));
|
|
347248
|
-
sequentialAppendBySession.set(sessionId, sequentialAppend);
|
|
347249
|
-
}
|
|
347250
|
-
return sequentialAppend;
|
|
347251
|
-
}
|
|
347252
|
-
async function appendSessionLogImpl(sessionId, entry, url, headers) {
|
|
347253
|
-
for (let attempt = 1;attempt <= MAX_RETRIES; attempt++) {
|
|
347254
|
-
try {
|
|
347255
|
-
const lastUuid = lastUuidMap.get(sessionId);
|
|
347256
|
-
const requestHeaders = { ...headers };
|
|
347257
|
-
if (lastUuid) {
|
|
347258
|
-
requestHeaders["Last-Uuid"] = lastUuid;
|
|
347259
|
-
}
|
|
347260
|
-
const response = await axios_default.put(url, entry, {
|
|
347261
|
-
headers: requestHeaders,
|
|
347262
|
-
validateStatus: (status) => status < 500
|
|
347263
|
-
});
|
|
347264
|
-
if (response.status === 200 || response.status === 201) {
|
|
347265
|
-
lastUuidMap.set(sessionId, entry.uuid);
|
|
347266
|
-
logForDebugging3(`Successfully persisted session log entry for session ${sessionId}`);
|
|
347267
|
-
return true;
|
|
347268
|
-
}
|
|
347269
|
-
if (response.status === 409) {
|
|
347270
|
-
const serverLastUuid = response.headers["x-last-uuid"];
|
|
347271
|
-
if (serverLastUuid === entry.uuid) {
|
|
347272
|
-
lastUuidMap.set(sessionId, entry.uuid);
|
|
347273
|
-
logForDebugging3(`Session entry ${entry.uuid} already present on server, recovering from stale state`);
|
|
347274
|
-
logForDiagnosticsNoPII("info", "session_persist_recovered_from_409");
|
|
347275
|
-
return true;
|
|
347276
|
-
}
|
|
347277
|
-
if (serverLastUuid) {
|
|
347278
|
-
lastUuidMap.set(sessionId, serverLastUuid);
|
|
347279
|
-
logForDebugging3(`Session 409: adopting server lastUuid=${serverLastUuid} from header, retrying entry ${entry.uuid}`);
|
|
347280
|
-
} else {
|
|
347281
|
-
const logs = await fetchSessionLogsFromUrl(sessionId, url, headers);
|
|
347282
|
-
const adoptedUuid = findLastUuid(logs);
|
|
347283
|
-
if (adoptedUuid) {
|
|
347284
|
-
lastUuidMap.set(sessionId, adoptedUuid);
|
|
347285
|
-
logForDebugging3(`Session 409: re-fetched ${logs.length} entries, adopting lastUuid=${adoptedUuid}, retrying entry ${entry.uuid}`);
|
|
347286
|
-
} else {
|
|
347287
|
-
const errorData = response.data;
|
|
347288
|
-
const errorMessage = errorData.error?.message || "Concurrent modification detected";
|
|
347289
|
-
logError3(new Error(`Session persistence conflict: UUID mismatch for session ${sessionId}, entry ${entry.uuid}. ${errorMessage}`));
|
|
347290
|
-
logForDiagnosticsNoPII("error", "session_persist_fail_concurrent_modification");
|
|
347291
|
-
return false;
|
|
347292
|
-
}
|
|
347293
|
-
}
|
|
347294
|
-
logForDiagnosticsNoPII("info", "session_persist_409_adopt_server_uuid");
|
|
347295
|
-
continue;
|
|
347296
|
-
}
|
|
347297
|
-
if (response.status === 401) {
|
|
347298
|
-
logForDebugging3("Session token expired or invalid");
|
|
347299
|
-
logForDiagnosticsNoPII("error", "session_persist_fail_bad_token");
|
|
347300
|
-
return false;
|
|
347301
|
-
}
|
|
347302
|
-
logForDebugging3(`Failed to persist session log: ${response.status} ${response.statusText}`);
|
|
347303
|
-
logForDiagnosticsNoPII("error", "session_persist_fail_status", {
|
|
347304
|
-
status: response.status,
|
|
347305
|
-
attempt
|
|
347306
|
-
});
|
|
347307
|
-
} catch (error) {
|
|
347308
|
-
const axiosError = error;
|
|
347309
|
-
logError3(new Error(`Error persisting session log: ${axiosError.message}`));
|
|
347310
|
-
logForDiagnosticsNoPII("error", "session_persist_fail_status", {
|
|
347311
|
-
status: axiosError.status,
|
|
347312
|
-
attempt
|
|
347313
|
-
});
|
|
347314
|
-
}
|
|
347315
|
-
if (attempt === MAX_RETRIES) {
|
|
347316
|
-
logForDebugging3(`Remote persistence failed after ${MAX_RETRIES} attempts`);
|
|
347317
|
-
logForDiagnosticsNoPII("error", "session_persist_error_retries_exhausted", { attempt });
|
|
347318
|
-
return false;
|
|
347319
|
-
}
|
|
347320
|
-
const delayMs = Math.min(BASE_DELAY_MS2 * Math.pow(2, attempt - 1), 8000);
|
|
347321
|
-
logForDebugging3(`Remote persistence attempt ${attempt}/${MAX_RETRIES} failed, retrying in ${delayMs}ms…`);
|
|
347322
|
-
await sleep9(delayMs);
|
|
347323
|
-
}
|
|
347324
|
-
return false;
|
|
347325
|
-
}
|
|
347326
|
-
async function appendSessionLog(sessionId, entry, url) {
|
|
347327
|
-
const sessionToken = getSessionIngressAuthToken();
|
|
347328
|
-
if (!sessionToken) {
|
|
347329
|
-
logForDebugging3("No session token available for session persistence");
|
|
347330
|
-
logForDiagnosticsNoPII("error", "session_persist_fail_jwt_no_token");
|
|
347331
|
-
return false;
|
|
347332
|
-
}
|
|
347333
|
-
const headers = {
|
|
347334
|
-
Authorization: `Bearer ${sessionToken}`,
|
|
347335
|
-
"Content-Type": "application/json"
|
|
347336
|
-
};
|
|
347337
|
-
const sequentialAppend = getOrCreateSequentialAppend(sessionId);
|
|
347338
|
-
return sequentialAppend(entry, url, headers);
|
|
347339
|
-
}
|
|
347340
|
-
async function fetchSessionLogsFromUrl(sessionId, url, headers) {
|
|
347341
|
-
try {
|
|
347342
|
-
const response = await axios_default.get(url, {
|
|
347343
|
-
headers,
|
|
347344
|
-
timeout: 20000,
|
|
347345
|
-
validateStatus: (status) => status < 500,
|
|
347346
|
-
params: isEnvTruthy2(process.env.ATLAS_AFTER_LAST_COMPACT) ? { after_last_compact: true } : undefined
|
|
347347
|
-
});
|
|
347348
|
-
if (response.status === 200) {
|
|
347349
|
-
const data = response.data;
|
|
347350
|
-
if (!data || typeof data !== "object" || !Array.isArray(data.loglines)) {
|
|
347351
|
-
logError3(new Error(`Invalid session logs response format: ${jsonStringify5(data)}`));
|
|
347352
|
-
logForDiagnosticsNoPII("error", "session_get_fail_invalid_response");
|
|
347353
|
-
return null;
|
|
347354
|
-
}
|
|
347355
|
-
const logs = data.loglines;
|
|
347356
|
-
logForDebugging3(`Fetched ${logs.length} session logs for session ${sessionId}`);
|
|
347357
|
-
return logs;
|
|
347358
|
-
}
|
|
347359
|
-
if (response.status === 404) {
|
|
347360
|
-
logForDebugging3(`No existing logs for session ${sessionId}`);
|
|
347361
|
-
logForDiagnosticsNoPII("warn", "session_get_no_logs_for_session");
|
|
347362
|
-
return [];
|
|
347363
|
-
}
|
|
347364
|
-
if (response.status === 401) {
|
|
347365
|
-
logForDebugging3("Auth token expired or invalid");
|
|
347366
|
-
logForDiagnosticsNoPII("error", "session_get_fail_bad_token");
|
|
347367
|
-
throw new Error("Your session has expired. Please run /login to sign in again.");
|
|
347368
|
-
}
|
|
347369
|
-
logForDebugging3(`Failed to fetch session logs: ${response.status} ${response.statusText}`);
|
|
347370
|
-
logForDiagnosticsNoPII("error", "session_get_fail_status", {
|
|
347371
|
-
status: response.status
|
|
347372
|
-
});
|
|
347373
|
-
return null;
|
|
347374
|
-
} catch (error) {
|
|
347375
|
-
const axiosError = error;
|
|
347376
|
-
logError3(new Error(`Error fetching session logs: ${axiosError.message}`));
|
|
347377
|
-
logForDiagnosticsNoPII("error", "session_get_fail_status", {
|
|
347378
|
-
status: axiosError.status
|
|
347379
|
-
});
|
|
347380
|
-
return null;
|
|
347381
|
-
}
|
|
347382
|
-
}
|
|
347383
|
-
function findLastUuid(logs) {
|
|
347384
|
-
if (!logs) {
|
|
347385
|
-
return;
|
|
347386
|
-
}
|
|
347387
|
-
const entry = logs.findLast((e) => ("uuid" in e) && e.uuid);
|
|
347388
|
-
return entry && "uuid" in entry ? entry.uuid : undefined;
|
|
347389
|
-
}
|
|
347390
|
-
function clearAllSessions() {
|
|
347391
|
-
lastUuidMap.clear();
|
|
347392
|
-
sequentialAppendBySession.clear();
|
|
347393
|
-
}
|
|
347394
|
-
var lastUuidMap, MAX_RETRIES = 10, BASE_DELAY_MS2 = 500, sequentialAppendBySession;
|
|
347395
|
-
var init_sessionIngress = __esm(() => {
|
|
347396
|
-
init_axios2();
|
|
347397
|
-
init_oauth();
|
|
347398
|
-
init_debug();
|
|
347399
|
-
init_diagLogs();
|
|
347400
|
-
init_envUtils2();
|
|
347401
|
-
init_log5();
|
|
347402
|
-
init_sessionIngressAuth();
|
|
347403
|
-
init_slowOperations();
|
|
347404
|
-
lastUuidMap = new Map;
|
|
347405
|
-
sequentialAppendBySession = new Map;
|
|
347406
|
-
});
|
|
347407
|
-
|
|
347408
347109
|
// src/tui/utils/hooks/postSamplingHooks.ts
|
|
347409
347110
|
function registerPostSamplingHook(hook) {
|
|
347410
347111
|
postSamplingHooks.push(hook);
|
|
@@ -347672,7 +347373,6 @@ function clearSessionCaches(preservedAgentIds = new Set) {
|
|
|
347672
347373
|
resetSentSkillNames();
|
|
347673
347374
|
resetGetMemoryFilesCache("session_start");
|
|
347674
347375
|
clearStoredImagePaths();
|
|
347675
|
-
clearAllSessions();
|
|
347676
347376
|
if (!hasPreserved)
|
|
347677
347377
|
clearAllPendingCallbacks2();
|
|
347678
347378
|
if (feature("COMMIT_ATTRIBUTION")) {
|
|
@@ -347703,7 +347403,6 @@ var init_caches = __esm(() => {
|
|
|
347703
347403
|
init_useSwarmPermissionPoller();
|
|
347704
347404
|
init_dumpPrompts();
|
|
347705
347405
|
init_promptCacheBreakDetection();
|
|
347706
|
-
init_sessionIngress();
|
|
347707
347406
|
init_engineCompat();
|
|
347708
347407
|
init_LSPDiagnosticRegistry();
|
|
347709
347408
|
init_magicDocs();
|
|
@@ -371399,9 +371098,8 @@ function MCPSettings(t0) {
|
|
|
371399
371098
|
if (isSSE || isHTTP) {
|
|
371400
371099
|
const authProvider = new ClaudeAuthProvider(client_0.name, client_0.config);
|
|
371401
371100
|
const tokens = await authProvider.tokens();
|
|
371402
|
-
const hasSessionAuth = getSessionIngressAuthToken() !== null && client_0.type === "connected";
|
|
371403
371101
|
const hasToolsAndConnected = client_0.type === "connected" && filterToolsByServer(mcp.tools, client_0.name).length > 0;
|
|
371404
|
-
isAuthenticated = Boolean(tokens) ||
|
|
371102
|
+
isAuthenticated = Boolean(tokens) || hasToolsAndConnected;
|
|
371405
371103
|
}
|
|
371406
371104
|
const baseInfo = {
|
|
371407
371105
|
name: client_0.name,
|
|
@@ -371739,7 +371437,6 @@ var init_MCPSettings = __esm(() => {
|
|
|
371739
371437
|
init_auth3();
|
|
371740
371438
|
init_utils6();
|
|
371741
371439
|
init_AppState();
|
|
371742
|
-
init_sessionIngressAuth();
|
|
371743
371440
|
init_MCPAgentServerMenu();
|
|
371744
371441
|
init_MCPListPanel();
|
|
371745
371442
|
init_MCPRemoteServerMenu();
|
|
@@ -421740,10 +421437,6 @@ class Project2 {
|
|
|
421740
421437
|
currentSessionPrRepository;
|
|
421741
421438
|
sessionFile = null;
|
|
421742
421439
|
pendingEntries = [];
|
|
421743
|
-
remoteIngressUrl = null;
|
|
421744
|
-
internalEventWriter = null;
|
|
421745
|
-
internalEventReader = null;
|
|
421746
|
-
internalSubagentEventReader = null;
|
|
421747
421440
|
pendingWriteCount = 0;
|
|
421748
421441
|
flushResolvers = [];
|
|
421749
421442
|
writeQueues = new Map;
|
|
@@ -422207,9 +421900,6 @@ class Project2 {
|
|
|
422207
421900
|
this.enqueueWrite(targetFile, entry);
|
|
422208
421901
|
if (!isAgentSidechain) {
|
|
422209
421902
|
messageSet.add(entry.uuid);
|
|
422210
|
-
if (isTranscriptMessage2(entry)) {
|
|
422211
|
-
await this.persistToRemote(sessionId, entry);
|
|
422212
|
-
}
|
|
422213
421903
|
}
|
|
422214
421904
|
}
|
|
422215
421905
|
}
|
|
@@ -422237,55 +421927,6 @@ class Project2 {
|
|
|
422237
421927
|
throw e;
|
|
422238
421928
|
}
|
|
422239
421929
|
}
|
|
422240
|
-
async persistToRemote(sessionId, entry) {
|
|
422241
|
-
if (isShuttingDown()) {
|
|
422242
|
-
return;
|
|
422243
|
-
}
|
|
422244
|
-
if (this.internalEventWriter) {
|
|
422245
|
-
try {
|
|
422246
|
-
await this.internalEventWriter("transcript", entry, {
|
|
422247
|
-
...isCompactBoundaryMessage2(entry) && { isCompaction: true },
|
|
422248
|
-
...entry.agentId && { agentId: entry.agentId }
|
|
422249
|
-
});
|
|
422250
|
-
} catch {
|
|
422251
|
-
logForDebugging3("Failed to write transcript as internal event");
|
|
422252
|
-
}
|
|
422253
|
-
return;
|
|
422254
|
-
}
|
|
422255
|
-
if (!isEnvTruthy2(process.env.ENABLE_SESSION_PERSISTENCE) || !this.remoteIngressUrl) {
|
|
422256
|
-
return;
|
|
422257
|
-
}
|
|
422258
|
-
const success = await appendSessionLog(sessionId, entry, this.remoteIngressUrl);
|
|
422259
|
-
if (!success) {
|
|
422260
|
-
gracefulShutdownSync(1, "other");
|
|
422261
|
-
}
|
|
422262
|
-
}
|
|
422263
|
-
setRemoteIngressUrl(url) {
|
|
422264
|
-
this.remoteIngressUrl = url;
|
|
422265
|
-
logForDebugging3(`Remote persistence enabled with URL: ${url}`);
|
|
422266
|
-
if (url) {
|
|
422267
|
-
this.FLUSH_INTERVAL_MS = REMOTE_FLUSH_INTERVAL_MS;
|
|
422268
|
-
}
|
|
422269
|
-
}
|
|
422270
|
-
setInternalEventWriter(writer) {
|
|
422271
|
-
this.internalEventWriter = writer;
|
|
422272
|
-
logForDebugging3("CCR v2 internal event writer registered for transcript persistence");
|
|
422273
|
-
this.FLUSH_INTERVAL_MS = REMOTE_FLUSH_INTERVAL_MS;
|
|
422274
|
-
}
|
|
422275
|
-
setInternalEventReader(reader) {
|
|
422276
|
-
this.internalEventReader = reader;
|
|
422277
|
-
logForDebugging3("CCR v2 internal event reader registered for session resume");
|
|
422278
|
-
}
|
|
422279
|
-
setInternalSubagentEventReader(reader) {
|
|
422280
|
-
this.internalSubagentEventReader = reader;
|
|
422281
|
-
logForDebugging3("CCR v2 subagent event reader registered for session resume");
|
|
422282
|
-
}
|
|
422283
|
-
getInternalEventReader() {
|
|
422284
|
-
return this.internalEventReader;
|
|
422285
|
-
}
|
|
422286
|
-
getInternalSubagentEventReader() {
|
|
422287
|
-
return this.internalSubagentEventReader;
|
|
422288
|
-
}
|
|
422289
421930
|
}
|
|
422290
421931
|
async function recordTranscript2(messages, teamInfo, startingParentUuidHint, allMessages) {
|
|
422291
421932
|
const cleanedMessages = cleanMessagesForLogging2(messages, allMessages);
|
|
@@ -424144,7 +423785,7 @@ async function enrichLogs(allLogs, startIndex, count) {
|
|
|
424144
423785
|
}
|
|
424145
423786
|
return { logs: result, nextIndex: i };
|
|
424146
423787
|
}
|
|
424147
|
-
var VERSION6, MAX_TOMBSTONE_REWRITE_BYTES, SKIP_FIRST_PROMPT_PATTERN2, EPHEMERAL_PROGRESS_TYPES2, MAX_TRANSCRIPT_READ_BYTES2, agentTranscriptSubdirs2, getProjectDir3, project2 = null, cleanupRegistered3 = false,
|
|
423788
|
+
var VERSION6, MAX_TOMBSTONE_REWRITE_BYTES, SKIP_FIRST_PROMPT_PATTERN2, EPHEMERAL_PROGRESS_TYPES2, MAX_TRANSCRIPT_READ_BYTES2, agentTranscriptSubdirs2, getProjectDir3, project2 = null, cleanupRegistered3 = false, METADATA_TYPE_MARKERS2, METADATA_MARKER_BUFS2, METADATA_PREFIX_BOUND2 = 25, getSessionMessages2 = (sessionId) => getSessionMessages(sessionId), INITIAL_ENRICH_COUNT = 50;
|
|
424148
423789
|
var init_sessionStorage = __esm(() => {
|
|
424149
423790
|
init_memoize();
|
|
424150
423791
|
init_bootstrap();
|
|
@@ -424153,21 +423794,18 @@ var init_sessionStorage = __esm(() => {
|
|
|
424153
423794
|
init_commands5();
|
|
424154
423795
|
init_xml();
|
|
424155
423796
|
init_growthbook();
|
|
424156
|
-
init_sessionIngress();
|
|
424157
423797
|
init_constants9();
|
|
424158
423798
|
init_ids();
|
|
424159
423799
|
init_cleanupRegistry3();
|
|
424160
423800
|
init_concurrentSessions2();
|
|
424161
423801
|
init_cwd3();
|
|
424162
423802
|
init_debug();
|
|
424163
|
-
init_diagLogs();
|
|
424164
423803
|
init_envUtils2();
|
|
424165
423804
|
init_errors4();
|
|
424166
423805
|
init_format2();
|
|
424167
423806
|
init_fsOperations();
|
|
424168
423807
|
init_getWorktreePaths();
|
|
424169
423808
|
init_git2();
|
|
424170
|
-
init_gracefulShutdown();
|
|
424171
423809
|
init_json2();
|
|
424172
423810
|
init_log5();
|
|
424173
423811
|
init_messages3();
|
|
@@ -434520,6 +434158,18 @@ var init_client5 = __esm(() => {
|
|
|
434520
434158
|
init_config6();
|
|
434521
434159
|
});
|
|
434522
434160
|
|
|
434161
|
+
// src/tui/constants/oauth.ts
|
|
434162
|
+
function getOauthConfig() {
|
|
434163
|
+
return PROD_OAUTH_CONFIG;
|
|
434164
|
+
}
|
|
434165
|
+
var PROD_OAUTH_CONFIG;
|
|
434166
|
+
var init_oauth = __esm(() => {
|
|
434167
|
+
PROD_OAUTH_CONFIG = {
|
|
434168
|
+
BASE_API_URL: undefined,
|
|
434169
|
+
CLAUDE_AI_ORIGIN: undefined
|
|
434170
|
+
};
|
|
434171
|
+
});
|
|
434172
|
+
|
|
434523
434173
|
// src/tui/utils/apiPreconnect.ts
|
|
434524
434174
|
function preconnectAtlasApi() {
|
|
434525
434175
|
if (fired)
|
|
@@ -492760,17 +492410,13 @@ async function main2() {
|
|
|
492760
492410
|
return "local-agent";
|
|
492761
492411
|
if (process.env.ATLAS_ENTRYPOINT === "claude-desktop")
|
|
492762
492412
|
return "claude-desktop";
|
|
492763
|
-
const hasSessionIngressToken = process.env.ATLAS_SESSION_ACCESS_TOKEN || process.env.ATLAS_WEBSOCKET_AUTH_FILE_DESCRIPTOR;
|
|
492764
|
-
if (process.env.ATLAS_ENTRYPOINT === "remote" || hasSessionIngressToken) {
|
|
492765
|
-
return "remote";
|
|
492766
|
-
}
|
|
492767
492413
|
return "cli";
|
|
492768
492414
|
})();
|
|
492769
492415
|
setClientType(clientType);
|
|
492770
492416
|
const previewFormat = process.env.ATLAS_QUESTION_PREVIEW_FORMAT;
|
|
492771
492417
|
if (previewFormat === "markdown" || previewFormat === "html") {
|
|
492772
492418
|
setQuestionPreviewFormat(previewFormat);
|
|
492773
|
-
} else if (!clientType.startsWith("sdk-") && clientType !== "claude-desktop" && clientType !== "local-agent"
|
|
492419
|
+
} else if (!clientType.startsWith("sdk-") && clientType !== "claude-desktop" && clientType !== "local-agent") {
|
|
492774
492420
|
setQuestionPreviewFormat("markdown");
|
|
492775
492421
|
}
|
|
492776
492422
|
profileCheckpoint("main_client_type_determined");
|
package/package.json
CHANGED