@atlasharness/atlascode 0.1.74 → 0.1.76
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 +127 -382
- 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) => {
|
|
@@ -167957,7 +167950,7 @@ var init_hooks3 = __esm(() => {
|
|
|
167957
167950
|
});
|
|
167958
167951
|
|
|
167959
167952
|
// src/tui/services/mcp/types.ts
|
|
167960
|
-
var ConfigScopeSchema3, TransportSchema2, McpStdioServerConfigSchema3, McpXaaConfigSchema2, McpOAuthConfigSchema2, McpSSEServerConfigSchema3, McpSSEIDEServerConfigSchema, McpWebSocketIDEServerConfigSchema, McpHTTPServerConfigSchema2, McpWebSocketServerConfigSchema2, McpSdkServerConfigSchema2, McpServerConfigSchema2, McpJsonConfigSchema2;
|
|
167953
|
+
var ConfigScopeSchema3, TransportSchema2, McpStdioServerConfigSchema3, McpXaaConfigSchema2, McpOauthGatedMarkerSchema, McpOAuthConfigSchema2, McpSSEServerConfigSchema3, McpSSEIDEServerConfigSchema, McpWebSocketIDEServerConfigSchema, McpHTTPServerConfigSchema2, McpWebSocketServerConfigSchema2, McpSdkServerConfigSchema2, McpServerConfigSchema2, McpJsonConfigSchema2;
|
|
167961
167954
|
var init_types9 = __esm(() => {
|
|
167962
167955
|
init_v4();
|
|
167963
167956
|
ConfigScopeSchema3 = lazySchema2(() => _enum([
|
|
@@ -167977,6 +167970,7 @@ var init_types9 = __esm(() => {
|
|
|
167977
167970
|
env: record(string2(), string2()).optional()
|
|
167978
167971
|
}));
|
|
167979
167972
|
McpXaaConfigSchema2 = lazySchema2(() => boolean2());
|
|
167973
|
+
McpOauthGatedMarkerSchema = lazySchema2(() => boolean2().optional());
|
|
167980
167974
|
McpOAuthConfigSchema2 = lazySchema2(() => object({
|
|
167981
167975
|
clientId: string2().optional(),
|
|
167982
167976
|
callbackPort: number2().int().positive().optional(),
|
|
@@ -167993,7 +167987,8 @@ var init_types9 = __esm(() => {
|
|
|
167993
167987
|
url: string2(),
|
|
167994
167988
|
headers: record(string2(), string2()).optional(),
|
|
167995
167989
|
headersHelper: string2().optional(),
|
|
167996
|
-
oauth: McpOAuthConfigSchema2().optional()
|
|
167990
|
+
oauth: McpOAuthConfigSchema2().optional(),
|
|
167991
|
+
oauthGated: McpOauthGatedMarkerSchema()
|
|
167997
167992
|
}));
|
|
167998
167993
|
McpSSEIDEServerConfigSchema = lazySchema2(() => object({
|
|
167999
167994
|
type: literal("sse-ide"),
|
|
@@ -168013,7 +168008,8 @@ var init_types9 = __esm(() => {
|
|
|
168013
168008
|
url: string2(),
|
|
168014
168009
|
headers: record(string2(), string2()).optional(),
|
|
168015
168010
|
headersHelper: string2().optional(),
|
|
168016
|
-
oauth: McpOAuthConfigSchema2().optional()
|
|
168011
|
+
oauth: McpOAuthConfigSchema2().optional(),
|
|
168012
|
+
oauthGated: McpOauthGatedMarkerSchema()
|
|
168017
168013
|
}));
|
|
168018
168014
|
McpWebSocketServerConfigSchema2 = lazySchema2(() => object({
|
|
168019
168015
|
type: literal("ws"),
|
|
@@ -181783,28 +181779,6 @@ var init_argumentSubstitution2 = __esm(() => {
|
|
|
181783
181779
|
init_shellQuote2();
|
|
181784
181780
|
});
|
|
181785
181781
|
|
|
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
181782
|
// src/tui/utils/generatedFiles.ts
|
|
181809
181783
|
import { basename as basename18, extname as extname7, posix as posix4, sep as sep15 } from "path";
|
|
181810
181784
|
function isGeneratedFile(filePath) {
|
|
@@ -193150,6 +193124,63 @@ var init_oauthPort = __esm(() => {
|
|
|
193150
193124
|
REDIRECT_PORT_RANGE = getPlatform3() === "windows" ? { min: 39152, max: 49151 } : { min: 49152, max: 65535 };
|
|
193151
193125
|
});
|
|
193152
193126
|
|
|
193127
|
+
// src/tui/services/mcp/oauthScopeGate.ts
|
|
193128
|
+
function parseMcpOauthTrustedServersEnv(raw) {
|
|
193129
|
+
if (raw === undefined || raw === null) {
|
|
193130
|
+
return new Set;
|
|
193131
|
+
}
|
|
193132
|
+
const names = new Set;
|
|
193133
|
+
for (const part of raw.split(",")) {
|
|
193134
|
+
const name = part.trim().toLowerCase();
|
|
193135
|
+
if (name !== "") {
|
|
193136
|
+
names.add(name);
|
|
193137
|
+
}
|
|
193138
|
+
}
|
|
193139
|
+
return names;
|
|
193140
|
+
}
|
|
193141
|
+
function getMcpOauthTrustedServers() {
|
|
193142
|
+
return parseMcpOauthTrustedServersEnv(process.env[MCP_OAUTH_TRUSTED_SERVERS_ENV]);
|
|
193143
|
+
}
|
|
193144
|
+
function isMcpOauthUntrustedScope(scope, pluginSource) {
|
|
193145
|
+
if (scope === "project") {
|
|
193146
|
+
return true;
|
|
193147
|
+
}
|
|
193148
|
+
return scope === "dynamic" && pluginSource !== undefined;
|
|
193149
|
+
}
|
|
193150
|
+
function isMcpOauthBlockGated(serverName, scope, pluginSource, allowlist = getMcpOauthTrustedServers()) {
|
|
193151
|
+
if (!isMcpOauthUntrustedScope(scope, pluginSource)) {
|
|
193152
|
+
return false;
|
|
193153
|
+
}
|
|
193154
|
+
return !allowlist.has(serverName.toLowerCase());
|
|
193155
|
+
}
|
|
193156
|
+
function applyMcpOauthScopeGate(serverName, server) {
|
|
193157
|
+
if (server.type !== "sse" && server.type !== "http") {
|
|
193158
|
+
return server;
|
|
193159
|
+
}
|
|
193160
|
+
const remote = server;
|
|
193161
|
+
if (remote.oauth === undefined) {
|
|
193162
|
+
return server;
|
|
193163
|
+
}
|
|
193164
|
+
if (!isMcpOauthBlockGated(serverName, server.scope, server.pluginSource)) {
|
|
193165
|
+
return server;
|
|
193166
|
+
}
|
|
193167
|
+
const { oauth: _gatedOAuth, ...rest } = remote;
|
|
193168
|
+
return { ...rest, oauthGated: true };
|
|
193169
|
+
}
|
|
193170
|
+
function isMcpOauthDisplayGated(serverName, config) {
|
|
193171
|
+
if (config.oauthGated === true) {
|
|
193172
|
+
return true;
|
|
193173
|
+
}
|
|
193174
|
+
if (config.oauth === undefined || config.oauth === null) {
|
|
193175
|
+
return false;
|
|
193176
|
+
}
|
|
193177
|
+
return isMcpOauthBlockGated(serverName, config.scope, config.pluginSource);
|
|
193178
|
+
}
|
|
193179
|
+
function mcpOauthGatedMessage(serverName) {
|
|
193180
|
+
return `MCP server "${serverName}" 的 oauth 块为 untrusted scope(project/plugin 来源),` + `操作者 allowlist 后启用:将 server 名加入 env ${MCP_OAUTH_TRUSTED_SERVERS_ENV}(逗号分隔)后重启。` + `当前该 oauth 块整体视为缺席,不发起 OAuth 流。`;
|
|
193181
|
+
}
|
|
193182
|
+
var MCP_OAUTH_TRUSTED_SERVERS_ENV = "ATLAS_MCP_OAUTH_TRUSTED_SERVERS";
|
|
193183
|
+
|
|
193153
193184
|
// src/tui/services/mcp/envExpansion.ts
|
|
193154
193185
|
function expandEnvVarsInString2(value) {
|
|
193155
193186
|
const missingVars = [];
|
|
@@ -193511,7 +193542,7 @@ function addScopeToServers(servers, scope) {
|
|
|
193511
193542
|
}
|
|
193512
193543
|
const scopedServers = {};
|
|
193513
193544
|
for (const [name, config] of Object.entries(servers)) {
|
|
193514
|
-
scopedServers[name] = { ...config, scope };
|
|
193545
|
+
scopedServers[name] = applyMcpOauthScopeGate(name, { ...config, scope });
|
|
193515
193546
|
}
|
|
193516
193547
|
return scopedServers;
|
|
193517
193548
|
}
|
|
@@ -194198,7 +194229,7 @@ async function getMcpConfigs(dynamicServers = {}, extraDedupTargets = Promise.re
|
|
|
194198
194229
|
if (!isMcpServerAllowedByPolicy(name, serverConfig)) {
|
|
194199
194230
|
continue;
|
|
194200
194231
|
}
|
|
194201
|
-
filtered[name] = serverConfig;
|
|
194232
|
+
filtered[name] = applyMcpOauthScopeGate(name, serverConfig);
|
|
194202
194233
|
}
|
|
194203
194234
|
return { servers: filtered, errors: mcpErrors };
|
|
194204
194235
|
}
|
|
@@ -195567,6 +195598,9 @@ async function performMCPXaaAuth(serverName, serverConfig, onAuthorizationUrl, a
|
|
|
195567
195598
|
}
|
|
195568
195599
|
}
|
|
195569
195600
|
async function performMCPOAuthFlow(serverName, serverConfig, onAuthorizationUrl, abortSignal, options) {
|
|
195601
|
+
if (isMcpOauthDisplayGated(serverName, serverConfig)) {
|
|
195602
|
+
throw new Error(mcpOauthGatedMessage(serverName));
|
|
195603
|
+
}
|
|
195570
195604
|
if (serverConfig.oauth?.xaa) {
|
|
195571
195605
|
if (!isXaaEnabled()) {
|
|
195572
195606
|
throw new Error(`XAA is not enabled (set ATLAS_ENABLE_XAA=1). Remove 'oauth.xaa' from server '${serverName}' to use the standard consent flow.`);
|
|
@@ -196597,6 +196631,14 @@ function createMcpAuthTool(serverName, config) {
|
|
|
196597
196631
|
}
|
|
196598
196632
|
};
|
|
196599
196633
|
}
|
|
196634
|
+
if (isMcpOauthDisplayGated(serverName, config)) {
|
|
196635
|
+
return {
|
|
196636
|
+
data: {
|
|
196637
|
+
status: "error",
|
|
196638
|
+
message: mcpOauthGatedMessage(serverName)
|
|
196639
|
+
}
|
|
196640
|
+
};
|
|
196641
|
+
}
|
|
196600
196642
|
const sseOrHttpConfig = config;
|
|
196601
196643
|
let resolveAuthUrl;
|
|
196602
196644
|
const authUrlPromise = new Promise((resolve) => {
|
|
@@ -197438,7 +197480,7 @@ function getApiKeyFromFileDescriptor() {
|
|
|
197438
197480
|
setCached: setApiKeyFromFd
|
|
197439
197481
|
});
|
|
197440
197482
|
}
|
|
197441
|
-
var CCR_TOKEN_DIR, CCR_OAUTH_TOKEN_PATH, CCR_API_KEY_PATH
|
|
197483
|
+
var CCR_TOKEN_DIR, CCR_OAUTH_TOKEN_PATH, CCR_API_KEY_PATH;
|
|
197442
197484
|
var init_authFileDescriptor = __esm(() => {
|
|
197443
197485
|
init_bootstrapState();
|
|
197444
197486
|
init_debug();
|
|
@@ -197448,7 +197490,6 @@ var init_authFileDescriptor = __esm(() => {
|
|
|
197448
197490
|
CCR_TOKEN_DIR = join82(getAtlasConfigHomeDir3(), "remote");
|
|
197449
197491
|
CCR_OAUTH_TOKEN_PATH = `${CCR_TOKEN_DIR}/.oauth_token`;
|
|
197450
197492
|
CCR_API_KEY_PATH = `${CCR_TOKEN_DIR}/.api_key`;
|
|
197451
|
-
CCR_SESSION_INGRESS_TOKEN_PATH = `${CCR_TOKEN_DIR}/.session_ingress_token`;
|
|
197452
197493
|
});
|
|
197453
197494
|
|
|
197454
197495
|
// src/tui/utils/authPortable.ts
|
|
@@ -200939,63 +200980,6 @@ function recursivelySanitizeUnicode2(value) {
|
|
|
200939
200980
|
return value;
|
|
200940
200981
|
}
|
|
200941
200982
|
|
|
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
200983
|
// src/tui/utils/subprocessEnv.ts
|
|
201000
200984
|
function subprocessEnv() {
|
|
201001
200985
|
const proxyEnv = _getUpstreamProxyEnv?.() ?? {};
|
|
@@ -209988,7 +209972,6 @@ var init_client4 = __esm(() => {
|
|
|
209988
209972
|
init_memoize2();
|
|
209989
209973
|
init_mtls();
|
|
209990
209974
|
init_proxy();
|
|
209991
|
-
init_sessionIngressAuth();
|
|
209992
209975
|
init_subprocessEnv();
|
|
209993
209976
|
init_toolResultStorage();
|
|
209994
209977
|
init_elicitationHandler();
|
|
@@ -210040,7 +210023,6 @@ var init_client4 = __esm(() => {
|
|
|
210040
210023
|
let inProcessServer;
|
|
210041
210024
|
try {
|
|
210042
210025
|
let transport;
|
|
210043
|
-
const sessionIngressToken = getSessionIngressAuthToken();
|
|
210044
210026
|
if (serverRef.type === "sse") {
|
|
210045
210027
|
const authProvider = new ClaudeAuthProvider(name, serverRef);
|
|
210046
210028
|
const combinedHeaders = await getMcpServerHeaders(name, serverRef);
|
|
@@ -210126,16 +210108,12 @@ var init_client4 = __esm(() => {
|
|
|
210126
210108
|
const tlsOptions = getWebSocketTLSOptions();
|
|
210127
210109
|
const wsHeaders = {
|
|
210128
210110
|
"User-Agent": getMCPUserAgent(),
|
|
210129
|
-
...sessionIngressToken && {
|
|
210130
|
-
Authorization: `Bearer ${sessionIngressToken}`
|
|
210131
|
-
},
|
|
210132
210111
|
...combinedHeaders
|
|
210133
210112
|
};
|
|
210134
210113
|
const wsHeadersForLogging = mapValues_default(wsHeaders, (value, key) => key.toLowerCase() === "authorization" ? "[REDACTED]" : value);
|
|
210135
210114
|
logMCPDebug(name, `WebSocket transport options: ${jsonStringify5({
|
|
210136
210115
|
url: serverRef.url,
|
|
210137
|
-
headers: wsHeadersForLogging
|
|
210138
|
-
hasSessionAuth: !!sessionIngressToken
|
|
210116
|
+
headers: wsHeadersForLogging
|
|
210139
210117
|
})}`);
|
|
210140
210118
|
let wsClient;
|
|
210141
210119
|
if (typeof Bun !== "undefined") {
|
|
@@ -210165,7 +210143,6 @@ var init_client4 = __esm(() => {
|
|
|
210165
210143
|
})}`);
|
|
210166
210144
|
const authProvider = new ClaudeAuthProvider(name, serverRef);
|
|
210167
210145
|
const combinedHeaders = await getMcpServerHeaders(name, serverRef);
|
|
210168
|
-
const hasOAuthTokens = !!await authProvider.tokens();
|
|
210169
210146
|
const proxyOptions = getProxyFetchOptions();
|
|
210170
210147
|
logMCPDebug(name, `Proxy options: ${proxyOptions.dispatcher ? "custom dispatcher" : "default"}`);
|
|
210171
210148
|
const transportOptions = {
|
|
@@ -210175,9 +210152,6 @@ var init_client4 = __esm(() => {
|
|
|
210175
210152
|
...proxyOptions,
|
|
210176
210153
|
headers: {
|
|
210177
210154
|
"User-Agent": getMCPUserAgent(),
|
|
210178
|
-
...sessionIngressToken && !hasOAuthTokens && {
|
|
210179
|
-
Authorization: `Bearer ${sessionIngressToken}`
|
|
210180
|
-
},
|
|
210181
210155
|
...combinedHeaders
|
|
210182
210156
|
}
|
|
210183
210157
|
}
|
|
@@ -254826,17 +254800,6 @@ function buildPRTrailers(_attributionData, _attribution) {
|
|
|
254826
254800
|
// src/tui/utils/attribution.ts
|
|
254827
254801
|
import { stat as stat30 } from "fs/promises";
|
|
254828
254802
|
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
254803
|
const model = getMainLoopModel();
|
|
254841
254804
|
const isKnownPublicModel = getPublicModelDisplayName(model) !== null;
|
|
254842
254805
|
const modelName = isInternalModelRepoCached() || isKnownPublicModel ? getPublicModelName(model) : "Atlas Opus 4.6";
|
|
@@ -254949,16 +254912,6 @@ async function getTranscriptStats() {
|
|
|
254949
254912
|
}
|
|
254950
254913
|
}
|
|
254951
254914
|
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
254915
|
const settings = getInitialSettings2();
|
|
254963
254916
|
if (settings.attribution?.pr) {
|
|
254964
254917
|
return settings.attribution.pr;
|
|
@@ -255006,7 +254959,6 @@ ${trailers.join(`
|
|
|
255006
254959
|
var MEMORY_ACCESS_TOOL_NAMES;
|
|
255007
254960
|
var init_attribution = __esm(() => {
|
|
255008
254961
|
init_shared();
|
|
255009
|
-
init_bootstrap();
|
|
255010
254962
|
init_xml();
|
|
255011
254963
|
init_constants8();
|
|
255012
254964
|
init_prompt2();
|
|
@@ -311079,9 +311031,6 @@ function gracefulShutdownSync(exitCode = 0, reason = "other", options) {
|
|
|
311079
311031
|
forceExit(exitCode);
|
|
311080
311032
|
}).catch(() => {});
|
|
311081
311033
|
}
|
|
311082
|
-
function isShuttingDown() {
|
|
311083
|
-
return shutdownInProgress;
|
|
311084
|
-
}
|
|
311085
311034
|
async function gracefulShutdown(exitCode = 0, reason = "other", options) {
|
|
311086
311035
|
if (shutdownInProgress) {
|
|
311087
311036
|
return;
|
|
@@ -347228,183 +347177,6 @@ var init_fileSuggestions = __esm(() => {
|
|
|
347228
347177
|
cachedTrackedDirs = [];
|
|
347229
347178
|
});
|
|
347230
347179
|
|
|
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
347180
|
// src/tui/utils/hooks/postSamplingHooks.ts
|
|
347409
347181
|
function registerPostSamplingHook(hook) {
|
|
347410
347182
|
postSamplingHooks.push(hook);
|
|
@@ -347672,7 +347444,6 @@ function clearSessionCaches(preservedAgentIds = new Set) {
|
|
|
347672
347444
|
resetSentSkillNames();
|
|
347673
347445
|
resetGetMemoryFilesCache("session_start");
|
|
347674
347446
|
clearStoredImagePaths();
|
|
347675
|
-
clearAllSessions();
|
|
347676
347447
|
if (!hasPreserved)
|
|
347677
347448
|
clearAllPendingCallbacks2();
|
|
347678
347449
|
if (feature("COMMIT_ATTRIBUTION")) {
|
|
@@ -347703,7 +347474,6 @@ var init_caches = __esm(() => {
|
|
|
347703
347474
|
init_useSwarmPermissionPoller();
|
|
347704
347475
|
init_dumpPrompts();
|
|
347705
347476
|
init_promptCacheBreakDetection();
|
|
347706
|
-
init_sessionIngress();
|
|
347707
347477
|
init_engineCompat();
|
|
347708
347478
|
init_LSPDiagnosticRegistry();
|
|
347709
347479
|
init_magicDocs();
|
|
@@ -368566,6 +368336,10 @@ function MCPListPanel(t0) {
|
|
|
368566
368336
|
statusIcon = color("error", theme)(figures_default.cross);
|
|
368567
368337
|
statusText = "failed";
|
|
368568
368338
|
}
|
|
368339
|
+
if (server_3.oauthGated === true) {
|
|
368340
|
+
statusIcon = color("warning", theme)(figures_default.triangleUpOutline);
|
|
368341
|
+
statusText = "oauth gated (untrusted scope) — operator allowlist to enable: " + MCP_OAUTH_TRUSTED_SERVERS_ENV;
|
|
368342
|
+
}
|
|
368569
368343
|
}
|
|
368570
368344
|
}
|
|
368571
368345
|
}
|
|
@@ -370039,6 +369813,7 @@ function MCPRemoteServerMenu({
|
|
|
370039
369813
|
}
|
|
370040
369814
|
}, []);
|
|
370041
369815
|
const isEffectivelyAuthenticated = server.isAuthenticated || server.client.type === "connected" && serverToolsCount > 0;
|
|
369816
|
+
const isOauthGated = server.config ? isMcpOauthDisplayGated(server.name, server.config) : false;
|
|
370042
369817
|
const reconnectMcpServer = useMcpReconnect();
|
|
370043
369818
|
useKeybinding("confirm:no", () => {
|
|
370044
369819
|
authAbortControllerRef.current?.abort();
|
|
@@ -370390,7 +370165,13 @@ function MCPRemoteServerMenu({
|
|
|
370390
370165
|
bold: true,
|
|
370391
370166
|
children: "Auth: "
|
|
370392
370167
|
}, undefined, false, undefined, this),
|
|
370393
|
-
|
|
370168
|
+
isOauthGated ? /* @__PURE__ */ jsx_dev_runtime193.jsxDEV(ThemedText, {
|
|
370169
|
+
children: [
|
|
370170
|
+
color("warning", theme)(figures_default.triangleUpOutline),
|
|
370171
|
+
" oauth gated (untrusted scope) — operator allowlist to enable: ",
|
|
370172
|
+
MCP_OAUTH_TRUSTED_SERVERS_ENV
|
|
370173
|
+
]
|
|
370174
|
+
}, undefined, true, undefined, this) : isEffectivelyAuthenticated ? /* @__PURE__ */ jsx_dev_runtime193.jsxDEV(ThemedText, {
|
|
370394
370175
|
children: [
|
|
370395
370176
|
color("success", theme)(figures_default.tick),
|
|
370396
370177
|
" authenticated"
|
|
@@ -371399,9 +371180,8 @@ function MCPSettings(t0) {
|
|
|
371399
371180
|
if (isSSE || isHTTP) {
|
|
371400
371181
|
const authProvider = new ClaudeAuthProvider(client_0.name, client_0.config);
|
|
371401
371182
|
const tokens = await authProvider.tokens();
|
|
371402
|
-
const hasSessionAuth = getSessionIngressAuthToken() !== null && client_0.type === "connected";
|
|
371403
371183
|
const hasToolsAndConnected = client_0.type === "connected" && filterToolsByServer(mcp.tools, client_0.name).length > 0;
|
|
371404
|
-
isAuthenticated = Boolean(tokens) ||
|
|
371184
|
+
isAuthenticated = Boolean(tokens) || hasToolsAndConnected;
|
|
371405
371185
|
}
|
|
371406
371186
|
const baseInfo = {
|
|
371407
371187
|
name: client_0.name,
|
|
@@ -371413,6 +371193,7 @@ function MCPSettings(t0) {
|
|
|
371413
371193
|
...baseInfo,
|
|
371414
371194
|
transport: "sse",
|
|
371415
371195
|
isAuthenticated,
|
|
371196
|
+
oauthGated: isMcpOauthDisplayGated(client_0.name, client_0.config),
|
|
371416
371197
|
config: client_0.config
|
|
371417
371198
|
};
|
|
371418
371199
|
} else {
|
|
@@ -371421,6 +371202,7 @@ function MCPSettings(t0) {
|
|
|
371421
371202
|
...baseInfo,
|
|
371422
371203
|
transport: "http",
|
|
371423
371204
|
isAuthenticated,
|
|
371205
|
+
oauthGated: isMcpOauthDisplayGated(client_0.name, client_0.config),
|
|
371424
371206
|
config: client_0.config
|
|
371425
371207
|
};
|
|
371426
371208
|
} else {
|
|
@@ -371739,7 +371521,6 @@ var init_MCPSettings = __esm(() => {
|
|
|
371739
371521
|
init_auth3();
|
|
371740
371522
|
init_utils6();
|
|
371741
371523
|
init_AppState();
|
|
371742
|
-
init_sessionIngressAuth();
|
|
371743
371524
|
init_MCPAgentServerMenu();
|
|
371744
371525
|
init_MCPListPanel();
|
|
371745
371526
|
init_MCPRemoteServerMenu();
|
|
@@ -421740,10 +421521,6 @@ class Project2 {
|
|
|
421740
421521
|
currentSessionPrRepository;
|
|
421741
421522
|
sessionFile = null;
|
|
421742
421523
|
pendingEntries = [];
|
|
421743
|
-
remoteIngressUrl = null;
|
|
421744
|
-
internalEventWriter = null;
|
|
421745
|
-
internalEventReader = null;
|
|
421746
|
-
internalSubagentEventReader = null;
|
|
421747
421524
|
pendingWriteCount = 0;
|
|
421748
421525
|
flushResolvers = [];
|
|
421749
421526
|
writeQueues = new Map;
|
|
@@ -422207,9 +421984,6 @@ class Project2 {
|
|
|
422207
421984
|
this.enqueueWrite(targetFile, entry);
|
|
422208
421985
|
if (!isAgentSidechain) {
|
|
422209
421986
|
messageSet.add(entry.uuid);
|
|
422210
|
-
if (isTranscriptMessage2(entry)) {
|
|
422211
|
-
await this.persistToRemote(sessionId, entry);
|
|
422212
|
-
}
|
|
422213
421987
|
}
|
|
422214
421988
|
}
|
|
422215
421989
|
}
|
|
@@ -422237,55 +422011,6 @@ class Project2 {
|
|
|
422237
422011
|
throw e;
|
|
422238
422012
|
}
|
|
422239
422013
|
}
|
|
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
422014
|
}
|
|
422290
422015
|
async function recordTranscript2(messages, teamInfo, startingParentUuidHint, allMessages) {
|
|
422291
422016
|
const cleanedMessages = cleanMessagesForLogging2(messages, allMessages);
|
|
@@ -424144,7 +423869,7 @@ async function enrichLogs(allLogs, startIndex, count) {
|
|
|
424144
423869
|
}
|
|
424145
423870
|
return { logs: result, nextIndex: i };
|
|
424146
423871
|
}
|
|
424147
|
-
var VERSION6, MAX_TOMBSTONE_REWRITE_BYTES, SKIP_FIRST_PROMPT_PATTERN2, EPHEMERAL_PROGRESS_TYPES2, MAX_TRANSCRIPT_READ_BYTES2, agentTranscriptSubdirs2, getProjectDir3, project2 = null, cleanupRegistered3 = false,
|
|
423872
|
+
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
423873
|
var init_sessionStorage = __esm(() => {
|
|
424149
423874
|
init_memoize();
|
|
424150
423875
|
init_bootstrap();
|
|
@@ -424153,21 +423878,18 @@ var init_sessionStorage = __esm(() => {
|
|
|
424153
423878
|
init_commands5();
|
|
424154
423879
|
init_xml();
|
|
424155
423880
|
init_growthbook();
|
|
424156
|
-
init_sessionIngress();
|
|
424157
423881
|
init_constants9();
|
|
424158
423882
|
init_ids();
|
|
424159
423883
|
init_cleanupRegistry3();
|
|
424160
423884
|
init_concurrentSessions2();
|
|
424161
423885
|
init_cwd3();
|
|
424162
423886
|
init_debug();
|
|
424163
|
-
init_diagLogs();
|
|
424164
423887
|
init_envUtils2();
|
|
424165
423888
|
init_errors4();
|
|
424166
423889
|
init_format2();
|
|
424167
423890
|
init_fsOperations();
|
|
424168
423891
|
init_getWorktreePaths();
|
|
424169
423892
|
init_git2();
|
|
424170
|
-
init_gracefulShutdown();
|
|
424171
423893
|
init_json2();
|
|
424172
423894
|
init_log5();
|
|
424173
423895
|
init_messages3();
|
|
@@ -434520,6 +434242,18 @@ var init_client5 = __esm(() => {
|
|
|
434520
434242
|
init_config6();
|
|
434521
434243
|
});
|
|
434522
434244
|
|
|
434245
|
+
// src/tui/constants/oauth.ts
|
|
434246
|
+
function getOauthConfig() {
|
|
434247
|
+
return PROD_OAUTH_CONFIG;
|
|
434248
|
+
}
|
|
434249
|
+
var PROD_OAUTH_CONFIG;
|
|
434250
|
+
var init_oauth = __esm(() => {
|
|
434251
|
+
PROD_OAUTH_CONFIG = {
|
|
434252
|
+
BASE_API_URL: undefined,
|
|
434253
|
+
CLAUDE_AI_ORIGIN: undefined
|
|
434254
|
+
};
|
|
434255
|
+
});
|
|
434256
|
+
|
|
434523
434257
|
// src/tui/utils/apiPreconnect.ts
|
|
434524
434258
|
function preconnectAtlasApi() {
|
|
434525
434259
|
if (fired)
|
|
@@ -434715,8 +434449,19 @@ function withoutMcpOauthCimdVars(env) {
|
|
|
434715
434449
|
}
|
|
434716
434450
|
return out;
|
|
434717
434451
|
}
|
|
434452
|
+
function withoutMcpOauthTrustedServersVars(env) {
|
|
434453
|
+
if (!env)
|
|
434454
|
+
return {};
|
|
434455
|
+
const out = {};
|
|
434456
|
+
for (const [key, value] of Object.entries(env)) {
|
|
434457
|
+
if (key.toUpperCase() !== MCP_OAUTH_TRUSTED_SERVERS_ENV) {
|
|
434458
|
+
out[key] = value;
|
|
434459
|
+
}
|
|
434460
|
+
}
|
|
434461
|
+
return out;
|
|
434462
|
+
}
|
|
434718
434463
|
function filterSettingsEnv(env) {
|
|
434719
|
-
return withoutCcdSpawnEnvKeys(withoutMcpOauthCimdVars(withoutHostManagedProviderVars(withoutSSHTunnelVars(env))));
|
|
434464
|
+
return withoutCcdSpawnEnvKeys(withoutMcpOauthTrustedServersVars(withoutMcpOauthCimdVars(withoutHostManagedProviderVars(withoutSSHTunnelVars(env)))));
|
|
434720
434465
|
}
|
|
434721
434466
|
function applySafeConfigEnvironmentVariables2() {
|
|
434722
434467
|
if (ccdSpawnEnvKeys === undefined) {
|
|
@@ -490349,7 +490094,9 @@ async function mcpGetHandler2(name) {
|
|
|
490349
490094
|
console.log(` ${key}: ${value}`);
|
|
490350
490095
|
}
|
|
490351
490096
|
}
|
|
490352
|
-
if (
|
|
490097
|
+
if (isMcpOauthDisplayGated(name, server)) {
|
|
490098
|
+
console.log(` OAuth: gated (untrusted scope) — operator allowlist to enable: ${MCP_OAUTH_TRUSTED_SERVERS_ENV}`);
|
|
490099
|
+
} else if (server.oauth?.clientId || server.oauth?.callbackPort || server.oauth?.clientMetadataUrl) {
|
|
490353
490100
|
const parts = [];
|
|
490354
490101
|
if (server.oauth.clientId) {
|
|
490355
490102
|
parts.push("client_id configured");
|
|
@@ -490372,7 +490119,9 @@ async function mcpGetHandler2(name) {
|
|
|
490372
490119
|
console.log(` ${key}: ${value}`);
|
|
490373
490120
|
}
|
|
490374
490121
|
}
|
|
490375
|
-
if (
|
|
490122
|
+
if (isMcpOauthDisplayGated(name, server)) {
|
|
490123
|
+
console.log(` OAuth: gated (untrusted scope) — operator allowlist to enable: ${MCP_OAUTH_TRUSTED_SERVERS_ENV}`);
|
|
490124
|
+
} else if (server.oauth?.clientId || server.oauth?.callbackPort || server.oauth?.clientMetadataUrl) {
|
|
490376
490125
|
const parts = [];
|
|
490377
490126
|
if (server.oauth.clientId) {
|
|
490378
490127
|
parts.push("client_id configured");
|
|
@@ -492760,17 +492509,13 @@ async function main2() {
|
|
|
492760
492509
|
return "local-agent";
|
|
492761
492510
|
if (process.env.ATLAS_ENTRYPOINT === "claude-desktop")
|
|
492762
492511
|
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
492512
|
return "cli";
|
|
492768
492513
|
})();
|
|
492769
492514
|
setClientType(clientType);
|
|
492770
492515
|
const previewFormat = process.env.ATLAS_QUESTION_PREVIEW_FORMAT;
|
|
492771
492516
|
if (previewFormat === "markdown" || previewFormat === "html") {
|
|
492772
492517
|
setQuestionPreviewFormat(previewFormat);
|
|
492773
|
-
} else if (!clientType.startsWith("sdk-") && clientType !== "claude-desktop" && clientType !== "local-agent"
|
|
492518
|
+
} else if (!clientType.startsWith("sdk-") && clientType !== "claude-desktop" && clientType !== "local-agent") {
|
|
492774
492519
|
setQuestionPreviewFormat("markdown");
|
|
492775
492520
|
}
|
|
492776
492521
|
profileCheckpoint("main_client_type_determined");
|
package/package.json
CHANGED