@google/gemini-cli-a2a-server 0.11.0-nightly.20251021.e72c00cf → 0.11.0-preview.0
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/a2a-server.mjs
CHANGED
|
@@ -285059,6 +285059,23 @@ var Storage2 = class _Storage {
|
|
|
285059
285059
|
}
|
|
285060
285060
|
};
|
|
285061
285061
|
|
|
285062
|
+
// packages/core/dist/src/utils/debugLogger.js
|
|
285063
|
+
var DebugLogger = class {
|
|
285064
|
+
log(...args2) {
|
|
285065
|
+
console.log(...args2);
|
|
285066
|
+
}
|
|
285067
|
+
warn(...args2) {
|
|
285068
|
+
console.warn(...args2);
|
|
285069
|
+
}
|
|
285070
|
+
error(...args2) {
|
|
285071
|
+
console.error(...args2);
|
|
285072
|
+
}
|
|
285073
|
+
debug(...args2) {
|
|
285074
|
+
console.debug(...args2);
|
|
285075
|
+
}
|
|
285076
|
+
};
|
|
285077
|
+
var debugLogger = new DebugLogger();
|
|
285078
|
+
|
|
285062
285079
|
// packages/core/dist/src/utils/userAccountManager.js
|
|
285063
285080
|
var UserAccountManager = class {
|
|
285064
285081
|
getGoogleAccountsCachePath() {
|
|
@@ -285076,13 +285093,13 @@ var UserAccountManager = class {
|
|
|
285076
285093
|
}
|
|
285077
285094
|
const parsed = JSON.parse(content);
|
|
285078
285095
|
if (typeof parsed !== "object" || parsed === null) {
|
|
285079
|
-
|
|
285096
|
+
debugLogger.log("Invalid accounts file schema, starting fresh.");
|
|
285080
285097
|
return defaultState;
|
|
285081
285098
|
}
|
|
285082
285099
|
const { active, old } = parsed;
|
|
285083
285100
|
const isValid2 = (active === void 0 || active === null || typeof active === "string") && (old === void 0 || Array.isArray(old) && old.every((i3) => typeof i3 === "string"));
|
|
285084
285101
|
if (!isValid2) {
|
|
285085
|
-
|
|
285102
|
+
debugLogger.log("Invalid accounts file schema, starting fresh.");
|
|
285086
285103
|
return defaultState;
|
|
285087
285104
|
}
|
|
285088
285105
|
return {
|
|
@@ -285099,7 +285116,7 @@ var UserAccountManager = class {
|
|
|
285099
285116
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
285100
285117
|
return defaultState;
|
|
285101
285118
|
}
|
|
285102
|
-
|
|
285119
|
+
debugLogger.log("Error during sync read of accounts, starting fresh.", error);
|
|
285103
285120
|
return defaultState;
|
|
285104
285121
|
}
|
|
285105
285122
|
}
|
|
@@ -285112,7 +285129,7 @@ var UserAccountManager = class {
|
|
|
285112
285129
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
285113
285130
|
return defaultState;
|
|
285114
285131
|
}
|
|
285115
|
-
|
|
285132
|
+
debugLogger.log("Could not parse accounts file, starting fresh.", error);
|
|
285116
285133
|
return defaultState;
|
|
285117
285134
|
}
|
|
285118
285135
|
}
|
|
@@ -285512,21 +285529,21 @@ async function initOauthClient(authType, config2) {
|
|
|
285512
285529
|
try {
|
|
285513
285530
|
await fetchAndCacheUserInfo(client);
|
|
285514
285531
|
} catch (error) {
|
|
285515
|
-
|
|
285532
|
+
debugLogger.warn("Failed to fetch user info:", getErrorMessage(error));
|
|
285516
285533
|
}
|
|
285517
285534
|
}
|
|
285518
|
-
|
|
285535
|
+
debugLogger.log("Loaded cached credentials.");
|
|
285519
285536
|
return client;
|
|
285520
285537
|
}
|
|
285521
285538
|
if (authType === AuthType2.CLOUD_SHELL) {
|
|
285522
285539
|
try {
|
|
285523
|
-
|
|
285540
|
+
debugLogger.log("Attempting to authenticate via Cloud Shell VM's ADC.");
|
|
285524
285541
|
const computeClient = new import_google_auth_library8.Compute({
|
|
285525
285542
|
// We can leave this empty, since the metadata server will provide
|
|
285526
285543
|
// the service account email.
|
|
285527
285544
|
});
|
|
285528
285545
|
await computeClient.getAccessToken();
|
|
285529
|
-
|
|
285546
|
+
debugLogger.log("Authentication successful.");
|
|
285530
285547
|
return computeClient;
|
|
285531
285548
|
} catch (e2) {
|
|
285532
285549
|
throw new Error(`Could not authenticate using Cloud Shell credentials. Please select a different authentication method or ensure you are in a properly configured environment. Error: ${getErrorMessage(e2)}`);
|
|
@@ -285546,7 +285563,7 @@ async function initOauthClient(authType, config2) {
|
|
|
285546
285563
|
}
|
|
285547
285564
|
} else {
|
|
285548
285565
|
const webLogin = await authWithWeb(client);
|
|
285549
|
-
|
|
285566
|
+
debugLogger.log(`
|
|
285550
285567
|
|
|
285551
285568
|
Code Assist login required.
|
|
285552
285569
|
Attempting to open authentication page in your browser.
|
|
@@ -285565,7 +285582,7 @@ ${webLogin.authUrl}
|
|
|
285565
285582
|
console.error("An unexpected error occurred while trying to open the browser:", getErrorMessage(err2), "\nThis might be due to browser compatibility issues or system configuration.", "\nPlease try running again with NO_BROWSER=true set for manual authentication.");
|
|
285566
285583
|
throw new FatalAuthenticationError(`Failed to open browser: ${getErrorMessage(err2)}`);
|
|
285567
285584
|
}
|
|
285568
|
-
|
|
285585
|
+
debugLogger.log("Waiting for authentication...");
|
|
285569
285586
|
const authTimeout = 5 * 60 * 1e3;
|
|
285570
285587
|
const timeoutPromise = new Promise((_, reject) => {
|
|
285571
285588
|
setTimeout(() => {
|
|
@@ -285594,10 +285611,10 @@ async function authWithUserCode(client) {
|
|
|
285594
285611
|
code_challenge: codeVerifier.codeChallenge,
|
|
285595
285612
|
state
|
|
285596
285613
|
});
|
|
285597
|
-
|
|
285598
|
-
|
|
285599
|
-
|
|
285600
|
-
|
|
285614
|
+
debugLogger.log("Please visit the following URL to authorize the application:");
|
|
285615
|
+
debugLogger.log("");
|
|
285616
|
+
debugLogger.log(authUrl);
|
|
285617
|
+
debugLogger.log("");
|
|
285601
285618
|
const code2 = await new Promise((resolve13) => {
|
|
285602
285619
|
const rl = readline.createInterface({
|
|
285603
285620
|
input: process.stdin,
|
|
@@ -285664,7 +285681,7 @@ async function authWithWeb(client) {
|
|
|
285664
285681
|
try {
|
|
285665
285682
|
await fetchAndCacheUserInfo(client);
|
|
285666
285683
|
} catch (error) {
|
|
285667
|
-
|
|
285684
|
+
debugLogger.warn("Failed to retrieve Google Account ID during authentication:", getErrorMessage(error));
|
|
285668
285685
|
}
|
|
285669
285686
|
res.writeHead(HTTP_REDIRECT, { Location: SIGN_IN_SUCCESS_URL });
|
|
285670
285687
|
res.end();
|
|
@@ -285751,7 +285768,7 @@ async function loadCachedCredentials(client) {
|
|
|
285751
285768
|
await client.getTokenInfo(token2);
|
|
285752
285769
|
return true;
|
|
285753
285770
|
} catch (error) {
|
|
285754
|
-
|
|
285771
|
+
debugLogger.debug(`Failed to load credentials from ${keyFile}:`, getErrorMessage(error));
|
|
285755
285772
|
}
|
|
285756
285773
|
}
|
|
285757
285774
|
return false;
|
|
@@ -286424,7 +286441,8 @@ var DeclarativeTool = class {
|
|
|
286424
286441
|
isOutputMarkdown;
|
|
286425
286442
|
canUpdateOutput;
|
|
286426
286443
|
messageBus;
|
|
286427
|
-
|
|
286444
|
+
extensionId;
|
|
286445
|
+
constructor(name4, displayName, description, kind, parameterSchema, isOutputMarkdown = true, canUpdateOutput = false, messageBus, extensionId) {
|
|
286428
286446
|
this.name = name4;
|
|
286429
286447
|
this.displayName = displayName;
|
|
286430
286448
|
this.description = description;
|
|
@@ -286433,6 +286451,7 @@ var DeclarativeTool = class {
|
|
|
286433
286451
|
this.isOutputMarkdown = isOutputMarkdown;
|
|
286434
286452
|
this.canUpdateOutput = canUpdateOutput;
|
|
286435
286453
|
this.messageBus = messageBus;
|
|
286454
|
+
this.extensionId = extensionId;
|
|
286436
286455
|
}
|
|
286437
286456
|
get schema() {
|
|
286438
286457
|
return {
|
|
@@ -286738,7 +286757,8 @@ var DiscoveredMCPTool = class _DiscoveredMCPTool extends BaseDeclarativeTool {
|
|
|
286738
286757
|
parameterSchema;
|
|
286739
286758
|
trust;
|
|
286740
286759
|
cliConfig;
|
|
286741
|
-
|
|
286760
|
+
extensionId;
|
|
286761
|
+
constructor(mcpTool, serverName, serverToolName, description, parameterSchema, trust, nameOverride, cliConfig, extensionId) {
|
|
286742
286762
|
super(
|
|
286743
286763
|
nameOverride ?? generateValidName(serverToolName),
|
|
286744
286764
|
`${serverToolName} (${serverName} MCP Server)`,
|
|
@@ -286747,7 +286767,11 @@ var DiscoveredMCPTool = class _DiscoveredMCPTool extends BaseDeclarativeTool {
|
|
|
286747
286767
|
parameterSchema,
|
|
286748
286768
|
true,
|
|
286749
286769
|
// isOutputMarkdown
|
|
286750
|
-
false
|
|
286770
|
+
false,
|
|
286771
|
+
// canUpdateOutput
|
|
286772
|
+
void 0,
|
|
286773
|
+
// messageBus
|
|
286774
|
+
extensionId
|
|
286751
286775
|
);
|
|
286752
286776
|
this.mcpTool = mcpTool;
|
|
286753
286777
|
this.serverName = serverName;
|
|
@@ -286755,9 +286779,10 @@ var DiscoveredMCPTool = class _DiscoveredMCPTool extends BaseDeclarativeTool {
|
|
|
286755
286779
|
this.parameterSchema = parameterSchema;
|
|
286756
286780
|
this.trust = trust;
|
|
286757
286781
|
this.cliConfig = cliConfig;
|
|
286782
|
+
this.extensionId = extensionId;
|
|
286758
286783
|
}
|
|
286759
286784
|
asFullyQualifiedTool() {
|
|
286760
|
-
return new _DiscoveredMCPTool(this.mcpTool, this.serverName, this.serverToolName, this.description, this.parameterSchema, this.trust, `${this.serverName}__${this.serverToolName}`, this.cliConfig);
|
|
286785
|
+
return new _DiscoveredMCPTool(this.mcpTool, this.serverName, this.serverToolName, this.description, this.parameterSchema, this.trust, `${this.serverName}__${this.serverToolName}`, this.cliConfig, this.extensionId);
|
|
286761
286786
|
}
|
|
286762
286787
|
createInvocation(params) {
|
|
286763
286788
|
return new DiscoveredMCPToolInvocation(this.mcpTool, this.serverName, this.serverToolName, this.displayName, this.trust, params, this.cliConfig);
|
|
@@ -286963,6 +286988,8 @@ var StartSessionEvent = class {
|
|
|
286963
286988
|
mcp_tools_count;
|
|
286964
286989
|
mcp_tools;
|
|
286965
286990
|
output_format;
|
|
286991
|
+
extensions_count;
|
|
286992
|
+
extension_ids;
|
|
286966
286993
|
constructor(config2, toolRegistry) {
|
|
286967
286994
|
const generatorConfig = config2.getContentGeneratorConfig();
|
|
286968
286995
|
const mcpServers = config2.getMcpServers();
|
|
@@ -286988,6 +287015,9 @@ var StartSessionEvent = class {
|
|
|
286988
287015
|
this.file_filtering_respect_git_ignore = config2.getFileFilteringRespectGitIgnore();
|
|
286989
287016
|
this.mcp_servers_count = mcpServers ? Object.keys(mcpServers).length : 0;
|
|
286990
287017
|
this.output_format = config2.getOutputFormat();
|
|
287018
|
+
const extensions = config2.getExtensions();
|
|
287019
|
+
this.extensions_count = extensions.length;
|
|
287020
|
+
this.extension_ids = extensions.map((e2) => e2.id).join(",");
|
|
286991
287021
|
if (toolRegistry) {
|
|
286992
287022
|
const mcpTools = toolRegistry.getAllTools().filter((tool) => tool instanceof DiscoveredMCPTool);
|
|
286993
287023
|
this.mcp_tools_count = mcpTools.length;
|
|
@@ -287013,7 +287043,9 @@ var StartSessionEvent = class {
|
|
|
287013
287043
|
mcp_servers_count: this.mcp_servers_count,
|
|
287014
287044
|
mcp_tools: this.mcp_tools,
|
|
287015
287045
|
mcp_tools_count: this.mcp_tools_count,
|
|
287016
|
-
output_format: this.output_format
|
|
287046
|
+
output_format: this.output_format,
|
|
287047
|
+
extensions_count: this.extensions_count,
|
|
287048
|
+
extension_ids: this.extension_ids
|
|
287017
287049
|
};
|
|
287018
287050
|
}
|
|
287019
287051
|
toLogBody() {
|
|
@@ -287035,6 +287067,7 @@ var ToolCallEvent = class {
|
|
|
287035
287067
|
tool_type;
|
|
287036
287068
|
content_length;
|
|
287037
287069
|
mcp_server_name;
|
|
287070
|
+
extension_id;
|
|
287038
287071
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
287039
287072
|
metadata;
|
|
287040
287073
|
constructor(call, function_name, function_args, duration_ms, success, prompt_id, tool_type, error) {
|
|
@@ -287053,6 +287086,7 @@ var ToolCallEvent = class {
|
|
|
287053
287086
|
if (typeof call.tool !== "undefined" && call.tool instanceof DiscoveredMCPTool) {
|
|
287054
287087
|
this.tool_type = "mcp";
|
|
287055
287088
|
this.mcp_server_name = call.tool.serverName;
|
|
287089
|
+
this.extension_id = call.tool.extensionId;
|
|
287056
287090
|
} else {
|
|
287057
287091
|
this.tool_type = "native";
|
|
287058
287092
|
}
|
|
@@ -287095,6 +287129,7 @@ var ToolCallEvent = class {
|
|
|
287095
287129
|
tool_type: this.tool_type,
|
|
287096
287130
|
content_length: this.content_length,
|
|
287097
287131
|
mcp_server_name: this.mcp_server_name,
|
|
287132
|
+
extension_id: this.extension_id,
|
|
287098
287133
|
metadata: this.metadata
|
|
287099
287134
|
};
|
|
287100
287135
|
if (this.error) {
|
|
@@ -288417,12 +288452,15 @@ var EventMetadataKey;
|
|
|
288417
288452
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_CONTENT_RETRY_FAILURE_TOTAL_DURATION_MS"] = 81] = "GEMINI_CLI_CONTENT_RETRY_FAILURE_TOTAL_DURATION_MS";
|
|
288418
288453
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_NODE_VERSION"] = 83] = "GEMINI_CLI_NODE_VERSION";
|
|
288419
288454
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_EXTENSION_NAME"] = 85] = "GEMINI_CLI_EXTENSION_NAME";
|
|
288455
|
+
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_EXTENSION_ID"] = 121] = "GEMINI_CLI_EXTENSION_ID";
|
|
288420
288456
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_EXTENSION_VERSION"] = 86] = "GEMINI_CLI_EXTENSION_VERSION";
|
|
288421
288457
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_EXTENSION_PREVIOUS_VERSION"] = 117] = "GEMINI_CLI_EXTENSION_PREVIOUS_VERSION";
|
|
288422
288458
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_EXTENSION_SOURCE"] = 87] = "GEMINI_CLI_EXTENSION_SOURCE";
|
|
288423
288459
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_EXTENSION_INSTALL_STATUS"] = 88] = "GEMINI_CLI_EXTENSION_INSTALL_STATUS";
|
|
288424
288460
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_EXTENSION_UNINSTALL_STATUS"] = 96] = "GEMINI_CLI_EXTENSION_UNINSTALL_STATUS";
|
|
288425
288461
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_EXTENSION_UPDATE_STATUS"] = 118] = "GEMINI_CLI_EXTENSION_UPDATE_STATUS";
|
|
288462
|
+
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_START_SESSION_EXTENSIONS_COUNT"] = 119] = "GEMINI_CLI_START_SESSION_EXTENSIONS_COUNT";
|
|
288463
|
+
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_START_SESSION_EXTENSION_IDS"] = 120] = "GEMINI_CLI_START_SESSION_EXTENSION_IDS";
|
|
288426
288464
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_EXTENSION_ENABLE_SETTING_SCOPE"] = 102] = "GEMINI_CLI_EXTENSION_ENABLE_SETTING_SCOPE";
|
|
288427
288465
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_EXTENSION_DISABLE_SETTING_SCOPE"] = 107] = "GEMINI_CLI_EXTENSION_DISABLE_SETTING_SCOPE";
|
|
288428
288466
|
EventMetadataKey2[EventMetadataKey2["GEMINI_CLI_TOOL_OUTPUT_TRUNCATED_ORIGINAL_LENGTH"] = 89] = "GEMINI_CLI_TOOL_OUTPUT_TRUNCATED_ORIGINAL_LENGTH";
|
|
@@ -288465,8 +288503,8 @@ var Float64Vector = import_vector.default.Float64Vector;
|
|
|
288465
288503
|
var PointerVector = import_vector.default.PointerVector;
|
|
288466
288504
|
|
|
288467
288505
|
// packages/core/dist/src/generated/git-commit.js
|
|
288468
|
-
var GIT_COMMIT_INFO = "
|
|
288469
|
-
var CLI_VERSION = "0.11.0-
|
|
288506
|
+
var GIT_COMMIT_INFO = "0542de95";
|
|
288507
|
+
var CLI_VERSION = "0.11.0-preview.0";
|
|
288470
288508
|
|
|
288471
288509
|
// packages/core/dist/src/ide/detect-ide.js
|
|
288472
288510
|
var IDE_DEFINITIONS = {
|
|
@@ -288643,7 +288681,7 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
288643
288681
|
}
|
|
288644
288682
|
]);
|
|
288645
288683
|
if (wasAtCapacity && this.config?.getDebugMode()) {
|
|
288646
|
-
|
|
288684
|
+
debugLogger.debug(`ClearcutLogger: Dropped old event to prevent memory leak (queue size: ${this.events.size})`);
|
|
288647
288685
|
}
|
|
288648
288686
|
} catch (error) {
|
|
288649
288687
|
if (this.config?.getDebugMode()) {
|
|
@@ -288677,20 +288715,20 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
288677
288715
|
return;
|
|
288678
288716
|
}
|
|
288679
288717
|
this.flushToClearcut().catch((error) => {
|
|
288680
|
-
|
|
288718
|
+
debugLogger.debug("Error flushing to Clearcut:", error);
|
|
288681
288719
|
});
|
|
288682
288720
|
}
|
|
288683
288721
|
async flushToClearcut() {
|
|
288684
288722
|
if (this.flushing) {
|
|
288685
288723
|
if (this.config?.getDebugMode()) {
|
|
288686
|
-
|
|
288724
|
+
debugLogger.debug("ClearcutLogger: Flush already in progress, marking pending flush.");
|
|
288687
288725
|
}
|
|
288688
288726
|
this.pendingFlush = true;
|
|
288689
288727
|
return Promise.resolve({});
|
|
288690
288728
|
}
|
|
288691
288729
|
this.flushing = true;
|
|
288692
288730
|
if (this.config?.getDebugMode()) {
|
|
288693
|
-
|
|
288731
|
+
debugLogger.log("Flushing log events to Clearcut.");
|
|
288694
288732
|
}
|
|
288695
288733
|
const eventsToSend = this.events.toArray();
|
|
288696
288734
|
this.events.clear();
|
|
@@ -288735,7 +288773,7 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
288735
288773
|
this.pendingFlush = false;
|
|
288736
288774
|
this.flushToClearcut().catch((error) => {
|
|
288737
288775
|
if (this.config?.getDebugMode()) {
|
|
288738
|
-
|
|
288776
|
+
debugLogger.debug("Error in pending flush to Clearcut:", error);
|
|
288739
288777
|
}
|
|
288740
288778
|
});
|
|
288741
288779
|
}
|
|
@@ -288806,12 +288844,20 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
288806
288844
|
{
|
|
288807
288845
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_START_SESSION_MCP_TOOLS,
|
|
288808
288846
|
value: event.mcp_tools ? event.mcp_tools : ""
|
|
288847
|
+
},
|
|
288848
|
+
{
|
|
288849
|
+
gemini_cli_key: EventMetadataKey.GEMINI_CLI_START_SESSION_EXTENSIONS_COUNT,
|
|
288850
|
+
value: event.extensions_count.toString()
|
|
288851
|
+
},
|
|
288852
|
+
{
|
|
288853
|
+
gemini_cli_key: EventMetadataKey.GEMINI_CLI_START_SESSION_EXTENSION_IDS,
|
|
288854
|
+
value: event.extension_ids.toString()
|
|
288809
288855
|
}
|
|
288810
288856
|
];
|
|
288811
288857
|
this.sessionData = data;
|
|
288812
288858
|
this.enqueueLogEvent(this.createLogEvent(EventNames.START_SESSION, data));
|
|
288813
288859
|
this.flushToClearcut().catch((error) => {
|
|
288814
|
-
|
|
288860
|
+
debugLogger.debug("Error flushing to Clearcut:", error);
|
|
288815
288861
|
});
|
|
288816
288862
|
}
|
|
288817
288863
|
logNewPromptEvent(event) {
|
|
@@ -289003,13 +289049,13 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289003
289049
|
logFlashFallbackEvent() {
|
|
289004
289050
|
this.enqueueLogEvent(this.createLogEvent(EventNames.FLASH_FALLBACK, []));
|
|
289005
289051
|
this.flushToClearcut().catch((error) => {
|
|
289006
|
-
|
|
289052
|
+
debugLogger.debug("Error flushing to Clearcut:", error);
|
|
289007
289053
|
});
|
|
289008
289054
|
}
|
|
289009
289055
|
logRipgrepFallbackEvent() {
|
|
289010
289056
|
this.enqueueLogEvent(this.createLogEvent(EventNames.RIPGREP_FALLBACK, []));
|
|
289011
289057
|
this.flushToClearcut().catch((error) => {
|
|
289012
|
-
|
|
289058
|
+
debugLogger.debug("Error flushing to Clearcut:", error);
|
|
289013
289059
|
});
|
|
289014
289060
|
}
|
|
289015
289061
|
logLoopDetectedEvent(event) {
|
|
@@ -289114,7 +289160,7 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289114
289160
|
logEndSessionEvent() {
|
|
289115
289161
|
this.enqueueLogEvent(this.createLogEvent(EventNames.END_SESSION, []));
|
|
289116
289162
|
this.flushToClearcut().catch((error) => {
|
|
289117
|
-
|
|
289163
|
+
debugLogger.debug("Error flushing to Clearcut:", error);
|
|
289118
289164
|
});
|
|
289119
289165
|
}
|
|
289120
289166
|
logInvalidChunkEvent(event) {
|
|
@@ -289180,6 +289226,10 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289180
289226
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_NAME,
|
|
289181
289227
|
value: event.extension_name
|
|
289182
289228
|
},
|
|
289229
|
+
{
|
|
289230
|
+
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_ID,
|
|
289231
|
+
value: event.extension_id
|
|
289232
|
+
},
|
|
289183
289233
|
{
|
|
289184
289234
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_VERSION,
|
|
289185
289235
|
value: event.extension_version
|
|
@@ -289195,7 +289245,7 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289195
289245
|
];
|
|
289196
289246
|
this.enqueueLogEvent(this.createLogEvent(EventNames.EXTENSION_INSTALL, data));
|
|
289197
289247
|
this.flushToClearcut().catch((error) => {
|
|
289198
|
-
|
|
289248
|
+
debugLogger.debug("Error flushing to Clearcut:", error);
|
|
289199
289249
|
});
|
|
289200
289250
|
}
|
|
289201
289251
|
logExtensionUninstallEvent(event) {
|
|
@@ -289204,6 +289254,10 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289204
289254
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_NAME,
|
|
289205
289255
|
value: event.extension_name
|
|
289206
289256
|
},
|
|
289257
|
+
{
|
|
289258
|
+
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_ID,
|
|
289259
|
+
value: event.extension_id
|
|
289260
|
+
},
|
|
289207
289261
|
{
|
|
289208
289262
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_UNINSTALL_STATUS,
|
|
289209
289263
|
value: event.status
|
|
@@ -289211,7 +289265,7 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289211
289265
|
];
|
|
289212
289266
|
this.enqueueLogEvent(this.createLogEvent(EventNames.EXTENSION_UNINSTALL, data));
|
|
289213
289267
|
this.flushToClearcut().catch((error) => {
|
|
289214
|
-
|
|
289268
|
+
debugLogger.debug("Error flushing to Clearcut:", error);
|
|
289215
289269
|
});
|
|
289216
289270
|
}
|
|
289217
289271
|
logExtensionUpdateEvent(event) {
|
|
@@ -289220,6 +289274,10 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289220
289274
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_NAME,
|
|
289221
289275
|
value: event.extension_name
|
|
289222
289276
|
},
|
|
289277
|
+
{
|
|
289278
|
+
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_ID,
|
|
289279
|
+
value: event.extension_id
|
|
289280
|
+
},
|
|
289223
289281
|
{
|
|
289224
289282
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_VERSION,
|
|
289225
289283
|
value: event.extension_version
|
|
@@ -289239,7 +289297,7 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289239
289297
|
];
|
|
289240
289298
|
this.enqueueLogEvent(this.createLogEvent(EventNames.EXTENSION_UPDATE, data));
|
|
289241
289299
|
this.flushToClearcut().catch((error) => {
|
|
289242
|
-
|
|
289300
|
+
debugLogger.debug("Error flushing to Clearcut:", error);
|
|
289243
289301
|
});
|
|
289244
289302
|
}
|
|
289245
289303
|
logToolOutputTruncatedEvent(event) {
|
|
@@ -289302,6 +289360,10 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289302
289360
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_NAME,
|
|
289303
289361
|
value: event.extension_name
|
|
289304
289362
|
},
|
|
289363
|
+
{
|
|
289364
|
+
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_ID,
|
|
289365
|
+
value: event.extension_id
|
|
289366
|
+
},
|
|
289305
289367
|
{
|
|
289306
289368
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_ENABLE_SETTING_SCOPE,
|
|
289307
289369
|
value: event.setting_scope
|
|
@@ -289309,7 +289371,7 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289309
289371
|
];
|
|
289310
289372
|
this.enqueueLogEvent(this.createLogEvent(EventNames.EXTENSION_ENABLE, data));
|
|
289311
289373
|
this.flushToClearcut().catch((error) => {
|
|
289312
|
-
|
|
289374
|
+
debugLogger.debug("Error flushing to Clearcut:", error);
|
|
289313
289375
|
});
|
|
289314
289376
|
}
|
|
289315
289377
|
logModelSlashCommandEvent(event) {
|
|
@@ -289328,6 +289390,10 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289328
289390
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_NAME,
|
|
289329
289391
|
value: event.extension_name
|
|
289330
289392
|
},
|
|
289393
|
+
{
|
|
289394
|
+
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_ID,
|
|
289395
|
+
value: event.extension_id
|
|
289396
|
+
},
|
|
289331
289397
|
{
|
|
289332
289398
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EXTENSION_DISABLE_SETTING_SCOPE,
|
|
289333
289399
|
value: event.setting_scope
|
|
@@ -289335,7 +289401,7 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289335
289401
|
];
|
|
289336
289402
|
this.enqueueLogEvent(this.createLogEvent(EventNames.EXTENSION_DISABLE, data));
|
|
289337
289403
|
this.flushToClearcut().catch((error) => {
|
|
289338
|
-
|
|
289404
|
+
debugLogger.debug("Error flushing to Clearcut:", error);
|
|
289339
289405
|
});
|
|
289340
289406
|
}
|
|
289341
289407
|
logSmartEditStrategyEvent(event) {
|
|
@@ -289469,8 +289535,6 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289469
289535
|
}
|
|
289470
289536
|
}
|
|
289471
289537
|
getConfigJson() {
|
|
289472
|
-
const configJson = safeJsonStringifyBooleanValuesOnly(this.config);
|
|
289473
|
-
console.debug(configJson);
|
|
289474
289538
|
return safeJsonStringifyBooleanValuesOnly(this.config);
|
|
289475
289539
|
}
|
|
289476
289540
|
shutdown() {
|
|
@@ -289479,13 +289543,13 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289479
289543
|
requeueFailedEvents(eventsToSend) {
|
|
289480
289544
|
const eventsToRetry = eventsToSend.slice(-MAX_RETRY_EVENTS);
|
|
289481
289545
|
if (eventsToSend.length > MAX_RETRY_EVENTS && this.config?.getDebugMode()) {
|
|
289482
|
-
|
|
289546
|
+
debugLogger.warn(`ClearcutLogger: Dropping ${eventsToSend.length - MAX_RETRY_EVENTS} events due to retry queue limit. Total events: ${eventsToSend.length}, keeping: ${MAX_RETRY_EVENTS}`);
|
|
289483
289547
|
}
|
|
289484
289548
|
const availableSpace = MAX_EVENTS - this.events.size;
|
|
289485
289549
|
const numEventsToRequeue = Math.min(eventsToRetry.length, availableSpace);
|
|
289486
289550
|
if (numEventsToRequeue === 0) {
|
|
289487
289551
|
if (this.config?.getDebugMode()) {
|
|
289488
|
-
|
|
289552
|
+
debugLogger.debug(`ClearcutLogger: No events re-queued (queue size: ${this.events.size})`);
|
|
289489
289553
|
}
|
|
289490
289554
|
return;
|
|
289491
289555
|
}
|
|
@@ -289497,7 +289561,7 @@ var ClearcutLogger = class _ClearcutLogger {
|
|
|
289497
289561
|
this.events.pop();
|
|
289498
289562
|
}
|
|
289499
289563
|
if (this.config?.getDebugMode()) {
|
|
289500
|
-
|
|
289564
|
+
debugLogger.debug(`ClearcutLogger: Re-queued ${numEventsToRequeue} events for retry (queue size: ${this.events.size})`);
|
|
289501
289565
|
}
|
|
289502
289566
|
}
|
|
289503
289567
|
};
|
|
@@ -290423,7 +290487,7 @@ function initializeTelemetry(config2) {
|
|
|
290423
290487
|
try {
|
|
290424
290488
|
sdk.start();
|
|
290425
290489
|
if (config2.getDebugMode()) {
|
|
290426
|
-
|
|
290490
|
+
debugLogger.log("OpenTelemetry SDK started successfully.");
|
|
290427
290491
|
}
|
|
290428
290492
|
telemetryInitialized = true;
|
|
290429
290493
|
initializeMetrics(config2);
|
|
@@ -290448,7 +290512,7 @@ async function shutdownTelemetry(config2) {
|
|
|
290448
290512
|
ClearcutLogger.getInstance()?.shutdown();
|
|
290449
290513
|
await sdk.shutdown();
|
|
290450
290514
|
if (config2.getDebugMode()) {
|
|
290451
|
-
|
|
290515
|
+
debugLogger.log("OpenTelemetry SDK shut down successfully.");
|
|
290452
290516
|
}
|
|
290453
290517
|
} catch (error) {
|
|
290454
290518
|
console.error("Error shutting down SDK:", error);
|
|
@@ -290943,7 +291007,7 @@ function createContentGeneratorConfig(config2, authType) {
|
|
|
290943
291007
|
return contentGeneratorConfig;
|
|
290944
291008
|
}
|
|
290945
291009
|
async function createContentGenerator(config2, gcConfig, sessionId2) {
|
|
290946
|
-
const version3 = "0.11.0-
|
|
291010
|
+
const version3 = "0.11.0-preview.0";
|
|
290947
291011
|
const userAgent = `GeminiCLI/${version3} (${process.platform}; ${process.arch})`;
|
|
290948
291012
|
const baseHeaders = {
|
|
290949
291013
|
"User-Agent": userAgent
|
|
@@ -290983,7 +291047,7 @@ var PromptRegistry = class {
|
|
|
290983
291047
|
registerPrompt(prompt) {
|
|
290984
291048
|
if (this.prompts.has(prompt.name)) {
|
|
290985
291049
|
const newName = `${prompt.serverName}_${prompt.name}`;
|
|
290986
|
-
|
|
291050
|
+
debugLogger.warn(`Prompt with name "${prompt.name}" is already registered. Renaming to "${newName}".`);
|
|
290987
291051
|
this.prompts.set(newName, { ...prompt, name: newName });
|
|
290988
291052
|
} else {
|
|
290989
291053
|
this.prompts.set(prompt.name, prompt);
|
|
@@ -298708,7 +298772,7 @@ var OAuthUtils = class {
|
|
|
298708
298772
|
}
|
|
298709
298773
|
return await response.json();
|
|
298710
298774
|
} catch (error) {
|
|
298711
|
-
|
|
298775
|
+
debugLogger.debug(`Failed to fetch protected resource metadata from ${resourceMetadataUrl}: ${getErrorMessage(error)}`);
|
|
298712
298776
|
return null;
|
|
298713
298777
|
}
|
|
298714
298778
|
}
|
|
@@ -298726,7 +298790,7 @@ var OAuthUtils = class {
|
|
|
298726
298790
|
}
|
|
298727
298791
|
return await response.json();
|
|
298728
298792
|
} catch (error) {
|
|
298729
|
-
|
|
298793
|
+
debugLogger.debug(`Failed to fetch authorization server metadata from ${authServerMetadataUrl}: ${getErrorMessage(error)}`);
|
|
298730
298794
|
return null;
|
|
298731
298795
|
}
|
|
298732
298796
|
}
|
|
@@ -298768,7 +298832,7 @@ var OAuthUtils = class {
|
|
|
298768
298832
|
return authServerMetadata;
|
|
298769
298833
|
}
|
|
298770
298834
|
}
|
|
298771
|
-
|
|
298835
|
+
debugLogger.debug(`Metadata discovery failed for authorization server ${authServerUrl}`);
|
|
298772
298836
|
return null;
|
|
298773
298837
|
}
|
|
298774
298838
|
/**
|
|
@@ -298794,23 +298858,23 @@ var OAuthUtils = class {
|
|
|
298794
298858
|
if (authServerMetadata2) {
|
|
298795
298859
|
const config2 = this.metadataToOAuthConfig(authServerMetadata2);
|
|
298796
298860
|
if (authServerMetadata2.registration_endpoint) {
|
|
298797
|
-
|
|
298861
|
+
debugLogger.log("Dynamic client registration is supported at:", authServerMetadata2.registration_endpoint);
|
|
298798
298862
|
}
|
|
298799
298863
|
return config2;
|
|
298800
298864
|
}
|
|
298801
298865
|
}
|
|
298802
|
-
|
|
298866
|
+
debugLogger.debug(`Trying OAuth discovery fallback at ${serverUrl}`);
|
|
298803
298867
|
const authServerMetadata = await this.discoverAuthorizationServerMetadata(serverUrl);
|
|
298804
298868
|
if (authServerMetadata) {
|
|
298805
298869
|
const config2 = this.metadataToOAuthConfig(authServerMetadata);
|
|
298806
298870
|
if (authServerMetadata.registration_endpoint) {
|
|
298807
|
-
|
|
298871
|
+
debugLogger.log("Dynamic client registration is supported at:", authServerMetadata.registration_endpoint);
|
|
298808
298872
|
}
|
|
298809
298873
|
return config2;
|
|
298810
298874
|
}
|
|
298811
298875
|
return null;
|
|
298812
298876
|
} catch (error) {
|
|
298813
|
-
|
|
298877
|
+
debugLogger.debug(`Failed to discover OAuth configuration: ${getErrorMessage(error)}`);
|
|
298814
298878
|
return null;
|
|
298815
298879
|
}
|
|
298816
298880
|
}
|
|
@@ -298876,7 +298940,7 @@ var OAuthUtils = class {
|
|
|
298876
298940
|
*/
|
|
298877
298941
|
static buildResourceParameter(endpointUrl) {
|
|
298878
298942
|
const url4 = new URL(endpointUrl);
|
|
298879
|
-
return `${url4.protocol}//${url4.host}`;
|
|
298943
|
+
return `${url4.protocol}//${url4.host}${url4.pathname}`;
|
|
298880
298944
|
}
|
|
298881
298945
|
};
|
|
298882
298946
|
|
|
@@ -299008,7 +299072,7 @@ var MCPOAuthProvider = class {
|
|
|
299008
299072
|
});
|
|
299009
299073
|
server.on("error", reject);
|
|
299010
299074
|
server.listen(REDIRECT_PORT, () => {
|
|
299011
|
-
|
|
299075
|
+
debugLogger.log(`OAuth callback server listening on port ${REDIRECT_PORT}`);
|
|
299012
299076
|
});
|
|
299013
299077
|
setTimeout(() => {
|
|
299014
299078
|
server.close();
|
|
@@ -299044,7 +299108,7 @@ var MCPOAuthProvider = class {
|
|
|
299044
299108
|
try {
|
|
299045
299109
|
params.append("resource", OAuthUtils.buildResourceParameter(mcpServerUrl));
|
|
299046
299110
|
} catch (error) {
|
|
299047
|
-
|
|
299111
|
+
debugLogger.warn(`Could not add resource parameter: ${getErrorMessage(error)}`);
|
|
299048
299112
|
}
|
|
299049
299113
|
}
|
|
299050
299114
|
const url4 = new URL7(config2.authorizationUrl);
|
|
@@ -299082,7 +299146,7 @@ var MCPOAuthProvider = class {
|
|
|
299082
299146
|
try {
|
|
299083
299147
|
params.append("resource", OAuthUtils.buildResourceParameter(resourceUrl));
|
|
299084
299148
|
} catch (error) {
|
|
299085
|
-
|
|
299149
|
+
debugLogger.warn(`Could not add resource parameter: ${getErrorMessage(error)}`);
|
|
299086
299150
|
}
|
|
299087
299151
|
}
|
|
299088
299152
|
const response = await fetch(config2.tokenUrl, {
|
|
@@ -299109,7 +299173,7 @@ var MCPOAuthProvider = class {
|
|
|
299109
299173
|
throw new Error(errorMessage || `Token exchange failed: ${response.status} - ${responseText}`);
|
|
299110
299174
|
}
|
|
299111
299175
|
if (!contentType.includes("application/json") && !contentType.includes("application/x-www-form-urlencoded")) {
|
|
299112
|
-
|
|
299176
|
+
debugLogger.warn(`Token endpoint returned unexpected content-type: ${contentType}. Expected application/json or application/x-www-form-urlencoded. Will attempt to parse response.`);
|
|
299113
299177
|
}
|
|
299114
299178
|
try {
|
|
299115
299179
|
return JSON.parse(responseText);
|
|
@@ -299162,7 +299226,7 @@ var MCPOAuthProvider = class {
|
|
|
299162
299226
|
try {
|
|
299163
299227
|
params.append("resource", OAuthUtils.buildResourceParameter(mcpServerUrl));
|
|
299164
299228
|
} catch (error) {
|
|
299165
|
-
|
|
299229
|
+
debugLogger.warn(`Could not add resource parameter: ${getErrorMessage(error)}`);
|
|
299166
299230
|
}
|
|
299167
299231
|
}
|
|
299168
299232
|
const response = await fetch(tokenUrl, {
|
|
@@ -299189,7 +299253,7 @@ var MCPOAuthProvider = class {
|
|
|
299189
299253
|
throw new Error(errorMessage || `Token refresh failed: ${response.status} - ${responseText}`);
|
|
299190
299254
|
}
|
|
299191
299255
|
if (!contentType.includes("application/json") && !contentType.includes("application/x-www-form-urlencoded")) {
|
|
299192
|
-
|
|
299256
|
+
debugLogger.warn(`Token refresh endpoint returned unexpected content-type: ${contentType}. Expected application/json or application/x-www-form-urlencoded. Will attempt to parse response.`);
|
|
299193
299257
|
}
|
|
299194
299258
|
try {
|
|
299195
299259
|
return JSON.parse(responseText);
|
|
@@ -299228,11 +299292,11 @@ var MCPOAuthProvider = class {
|
|
|
299228
299292
|
if (events) {
|
|
299229
299293
|
events.emit(OAUTH_DISPLAY_MESSAGE_EVENT, message);
|
|
299230
299294
|
} else {
|
|
299231
|
-
|
|
299295
|
+
debugLogger.log(message);
|
|
299232
299296
|
}
|
|
299233
299297
|
};
|
|
299234
299298
|
if (!config2.authorizationUrl && mcpServerUrl) {
|
|
299235
|
-
|
|
299299
|
+
debugLogger.debug(`Starting OAuth for MCP server "${serverName}"\u2026
|
|
299236
299300
|
\u2713 No authorization URL; using OAuth discovery`);
|
|
299237
299301
|
try {
|
|
299238
299302
|
const headers = OAuthUtils.isSSEEndpoint(mcpServerUrl) ? { Accept: "text/event-stream" } : { Accept: "application/json" };
|
|
@@ -299258,7 +299322,7 @@ var MCPOAuthProvider = class {
|
|
|
299258
299322
|
}
|
|
299259
299323
|
}
|
|
299260
299324
|
} catch (error) {
|
|
299261
|
-
|
|
299325
|
+
debugLogger.debug(`Failed to check endpoint for authentication requirements: ${getErrorMessage(error)}`);
|
|
299262
299326
|
}
|
|
299263
299327
|
if (!config2.authorizationUrl) {
|
|
299264
299328
|
const discoveredConfig = await this.discoverOAuthFromMCPServer(mcpServerUrl);
|
|
@@ -299286,7 +299350,7 @@ var MCPOAuthProvider = class {
|
|
|
299286
299350
|
}
|
|
299287
299351
|
const authUrl2 = new URL7(config2.authorizationUrl);
|
|
299288
299352
|
const serverUrl = `${authUrl2.protocol}//${authUrl2.host}`;
|
|
299289
|
-
|
|
299353
|
+
debugLogger.debug("\u2192 Attempting dynamic client registration...");
|
|
299290
299354
|
const authServerMetadata = await OAuthUtils.discoverAuthorizationServerMetadata(serverUrl);
|
|
299291
299355
|
if (!authServerMetadata) {
|
|
299292
299356
|
throw new Error("Failed to fetch authorization server metadata for client registration");
|
|
@@ -299299,7 +299363,7 @@ var MCPOAuthProvider = class {
|
|
|
299299
299363
|
if (clientRegistration.client_secret) {
|
|
299300
299364
|
config2.clientSecret = clientRegistration.client_secret;
|
|
299301
299365
|
}
|
|
299302
|
-
|
|
299366
|
+
debugLogger.debug("\u2713 Dynamic client registration successful");
|
|
299303
299367
|
} else {
|
|
299304
299368
|
throw new Error("No client ID provided and dynamic registration not supported");
|
|
299305
299369
|
}
|
|
@@ -299320,10 +299384,10 @@ ${authUrl}
|
|
|
299320
299384
|
try {
|
|
299321
299385
|
await openBrowserSecurely(authUrl);
|
|
299322
299386
|
} catch (error) {
|
|
299323
|
-
|
|
299387
|
+
debugLogger.warn("Failed to open browser automatically:", getErrorMessage(error));
|
|
299324
299388
|
}
|
|
299325
299389
|
const { code: code2 } = await callbackPromise;
|
|
299326
|
-
|
|
299390
|
+
debugLogger.debug("\u2713 Authorization code received, exchanging for tokens...");
|
|
299327
299391
|
const tokenResponse = await this.exchangeCodeForToken(config2, code2, pkceParams.codeVerifier, mcpServerUrl);
|
|
299328
299392
|
if (!tokenResponse.access_token) {
|
|
299329
299393
|
throw new Error("No access token received from token endpoint");
|
|
@@ -299339,11 +299403,11 @@ ${authUrl}
|
|
|
299339
299403
|
}
|
|
299340
299404
|
try {
|
|
299341
299405
|
await this.tokenStorage.saveToken(serverName, token2, config2.clientId, config2.tokenUrl, mcpServerUrl);
|
|
299342
|
-
|
|
299406
|
+
debugLogger.debug("\u2713 Authentication successful! Token saved.");
|
|
299343
299407
|
const savedToken = await this.tokenStorage.getCredentials(serverName);
|
|
299344
299408
|
if (savedToken && savedToken.token && savedToken.token.accessToken) {
|
|
299345
299409
|
const tokenFingerprint = crypto18.createHash("sha256").update(savedToken.token.accessToken).digest("hex").slice(0, 8);
|
|
299346
|
-
|
|
299410
|
+
debugLogger.debug(`\u2713 Token verification successful (fingerprint: ${tokenFingerprint})`);
|
|
299347
299411
|
} else {
|
|
299348
299412
|
console.error("Token verification failed: token not found or invalid after save");
|
|
299349
299413
|
}
|
|
@@ -299361,21 +299425,21 @@ ${authUrl}
|
|
|
299361
299425
|
* @returns A valid access token or null if not authenticated
|
|
299362
299426
|
*/
|
|
299363
299427
|
async getValidToken(serverName, config2) {
|
|
299364
|
-
|
|
299428
|
+
debugLogger.debug(`Getting valid token for server: ${serverName}`);
|
|
299365
299429
|
const credentials = await this.tokenStorage.getCredentials(serverName);
|
|
299366
299430
|
if (!credentials) {
|
|
299367
|
-
|
|
299431
|
+
debugLogger.debug(`No credentials found for server: ${serverName}`);
|
|
299368
299432
|
return null;
|
|
299369
299433
|
}
|
|
299370
299434
|
const { token: token2 } = credentials;
|
|
299371
|
-
|
|
299435
|
+
debugLogger.debug(`Found token for server: ${serverName}, expired: ${this.tokenStorage.isTokenExpired(token2)}`);
|
|
299372
299436
|
if (!this.tokenStorage.isTokenExpired(token2)) {
|
|
299373
|
-
|
|
299437
|
+
debugLogger.debug(`Returning valid token for server: ${serverName}`);
|
|
299374
299438
|
return token2.accessToken;
|
|
299375
299439
|
}
|
|
299376
299440
|
if (token2.refreshToken && config2.clientId && credentials.tokenUrl) {
|
|
299377
299441
|
try {
|
|
299378
|
-
|
|
299442
|
+
debugLogger.log(`Refreshing expired token for MCP server: ${serverName}`);
|
|
299379
299443
|
const newTokenResponse = await this.refreshAccessToken(config2, token2.refreshToken, credentials.tokenUrl, credentials.mcpServerUrl);
|
|
299380
299444
|
const newToken = {
|
|
299381
299445
|
accessToken: newTokenResponse.access_token,
|
|
@@ -299542,7 +299606,7 @@ function extractWWWAuthenticateHeader(errorString) {
|
|
|
299542
299606
|
}
|
|
299543
299607
|
async function handleAutomaticOAuth(mcpServerName, mcpServerConfig, wwwAuthenticate) {
|
|
299544
299608
|
try {
|
|
299545
|
-
|
|
299609
|
+
debugLogger.log(`\u{1F510} '${mcpServerName}' requires OAuth authentication`);
|
|
299546
299610
|
let oauthConfig;
|
|
299547
299611
|
const resourceMetadataUri = OAuthUtils.parseWWWAuthenticateHeader(wwwAuthenticate);
|
|
299548
299612
|
if (resourceMetadataUri) {
|
|
@@ -299563,10 +299627,10 @@ async function handleAutomaticOAuth(mcpServerName, mcpServerConfig, wwwAuthentic
|
|
|
299563
299627
|
scopes: oauthConfig.scopes || []
|
|
299564
299628
|
};
|
|
299565
299629
|
const serverUrl = mcpServerConfig.httpUrl || mcpServerConfig.url;
|
|
299566
|
-
|
|
299630
|
+
debugLogger.log(`Starting OAuth authentication for server '${mcpServerName}'...`);
|
|
299567
299631
|
const authProvider = new MCPOAuthProvider(new MCPOAuthTokenStorage());
|
|
299568
299632
|
await authProvider.authenticate(mcpServerName, oauthAuthConfig, serverUrl);
|
|
299569
|
-
|
|
299633
|
+
debugLogger.log(`OAuth authentication successful for server '${mcpServerName}'`);
|
|
299570
299634
|
return true;
|
|
299571
299635
|
} catch (error) {
|
|
299572
299636
|
console.error(`Failed to handle automatic OAuth for server '${mcpServerName}': ${getErrorMessage(error)}`);
|
|
@@ -299658,7 +299722,7 @@ async function discoverTools(mcpServerName, mcpServerConfig, mcpClient, cliConfi
|
|
|
299658
299722
|
if (!isEnabled(funcDecl, mcpServerName, mcpServerConfig)) {
|
|
299659
299723
|
continue;
|
|
299660
299724
|
}
|
|
299661
|
-
discoveredTools.push(new DiscoveredMCPTool(mcpCallableTool, mcpServerName, funcDecl.name, funcDecl.description ?? "", funcDecl.parametersJsonSchema ?? { type: "object", properties: {} }, mcpServerConfig.trust, void 0, cliConfig));
|
|
299725
|
+
discoveredTools.push(new DiscoveredMCPTool(mcpCallableTool, mcpServerName, funcDecl.name, funcDecl.description ?? "", funcDecl.parametersJsonSchema ?? { type: "object", properties: {} }, mcpServerConfig.trust, void 0, cliConfig, mcpServerConfig.extension?.id));
|
|
299662
299726
|
} catch (error) {
|
|
299663
299727
|
console.error(`Error discovering tool: '${funcDecl.name}' from MCP server '${mcpServerName}': ${error.message}`);
|
|
299664
299728
|
}
|
|
@@ -299775,16 +299839,16 @@ async function connectToMcpServer(mcpServerName, mcpServerConfig, debugMode, wor
|
|
|
299775
299839
|
clientId: credentials.clientId
|
|
299776
299840
|
});
|
|
299777
299841
|
if (hasStoredTokens) {
|
|
299778
|
-
|
|
299842
|
+
debugLogger.log(`Stored OAuth token for SSE server '${mcpServerName}' was rejected. Please re-authenticate using: /mcp auth ${mcpServerName}`);
|
|
299779
299843
|
} else {
|
|
299780
|
-
|
|
299844
|
+
debugLogger.log(`401 error received for SSE server '${mcpServerName}' without OAuth configuration. Please authenticate using: /mcp auth ${mcpServerName}`);
|
|
299781
299845
|
}
|
|
299782
299846
|
}
|
|
299783
299847
|
throw new Error(`401 error received for SSE server '${mcpServerName}' without OAuth configuration. Please authenticate using: /mcp auth ${mcpServerName}`);
|
|
299784
299848
|
}
|
|
299785
299849
|
let wwwAuthenticate = extractWWWAuthenticateHeader(errorString);
|
|
299786
299850
|
if (!wwwAuthenticate && hasNetworkTransport(mcpServerConfig)) {
|
|
299787
|
-
|
|
299851
|
+
debugLogger.log(`No www-authenticate header in error, trying to fetch it from server...`);
|
|
299788
299852
|
try {
|
|
299789
299853
|
const urlToFetch = mcpServerConfig.httpUrl || mcpServerConfig.url;
|
|
299790
299854
|
const response = await fetch(urlToFetch, {
|
|
@@ -299797,18 +299861,18 @@ async function connectToMcpServer(mcpServerName, mcpServerConfig, debugMode, wor
|
|
|
299797
299861
|
if (response.status === 401) {
|
|
299798
299862
|
wwwAuthenticate = response.headers.get("www-authenticate");
|
|
299799
299863
|
if (wwwAuthenticate) {
|
|
299800
|
-
|
|
299864
|
+
debugLogger.log(`Found www-authenticate header from server: ${wwwAuthenticate}`);
|
|
299801
299865
|
}
|
|
299802
299866
|
}
|
|
299803
299867
|
} catch (fetchError) {
|
|
299804
|
-
|
|
299868
|
+
debugLogger.debug(`Failed to fetch www-authenticate header: ${getErrorMessage(fetchError)}`);
|
|
299805
299869
|
}
|
|
299806
299870
|
}
|
|
299807
299871
|
if (wwwAuthenticate) {
|
|
299808
|
-
|
|
299872
|
+
debugLogger.log(`Received 401 with www-authenticate header: ${wwwAuthenticate}`);
|
|
299809
299873
|
const oauthSuccess = await handleAutomaticOAuth(mcpServerName, mcpServerConfig, wwwAuthenticate);
|
|
299810
299874
|
if (oauthSuccess) {
|
|
299811
|
-
|
|
299875
|
+
debugLogger.log(`Retrying connection to '${mcpServerName}' with OAuth token...`);
|
|
299812
299876
|
const tokenStorage = new MCPOAuthTokenStorage();
|
|
299813
299877
|
const credentials = await tokenStorage.getCredentials(mcpServerName);
|
|
299814
299878
|
if (credentials) {
|
|
@@ -299857,21 +299921,21 @@ async function connectToMcpServer(mcpServerName, mcpServerConfig, debugMode, wor
|
|
|
299857
299921
|
clientId: credentials.clientId
|
|
299858
299922
|
});
|
|
299859
299923
|
if (hasStoredTokens) {
|
|
299860
|
-
|
|
299924
|
+
debugLogger.log(`Stored OAuth token for SSE server '${mcpServerName}' was rejected. Please re-authenticate using: /mcp auth ${mcpServerName}`);
|
|
299861
299925
|
} else {
|
|
299862
|
-
|
|
299926
|
+
debugLogger.log(`401 error received for SSE server '${mcpServerName}' without OAuth configuration. Please authenticate using: /mcp auth ${mcpServerName}`);
|
|
299863
299927
|
}
|
|
299864
299928
|
}
|
|
299865
299929
|
throw new Error(`401 error received for SSE server '${mcpServerName}' without OAuth configuration. Please authenticate using: /mcp auth ${mcpServerName}`);
|
|
299866
299930
|
}
|
|
299867
|
-
|
|
299931
|
+
debugLogger.log(`\u{1F50D} Attempting OAuth discovery for '${mcpServerName}'...`);
|
|
299868
299932
|
if (hasNetworkTransport(mcpServerConfig)) {
|
|
299869
299933
|
const serverUrl = new URL(mcpServerConfig.httpUrl || mcpServerConfig.url);
|
|
299870
299934
|
const baseUrl = `${serverUrl.protocol}//${serverUrl.host}`;
|
|
299871
299935
|
try {
|
|
299872
299936
|
const oauthConfig = await OAuthUtils.discoverOAuthConfig(baseUrl);
|
|
299873
299937
|
if (oauthConfig) {
|
|
299874
|
-
|
|
299938
|
+
debugLogger.log(`Discovered OAuth configuration from base URL for server '${mcpServerName}'`);
|
|
299875
299939
|
const oauthAuthConfig = {
|
|
299876
299940
|
enabled: true,
|
|
299877
299941
|
authorizationUrl: oauthConfig.authorizationUrl,
|
|
@@ -299879,7 +299943,7 @@ async function connectToMcpServer(mcpServerName, mcpServerConfig, debugMode, wor
|
|
|
299879
299943
|
scopes: oauthConfig.scopes || []
|
|
299880
299944
|
};
|
|
299881
299945
|
const authServerUrl = mcpServerConfig.httpUrl || mcpServerConfig.url;
|
|
299882
|
-
|
|
299946
|
+
debugLogger.log(`Starting OAuth authentication for server '${mcpServerName}'...`);
|
|
299883
299947
|
const authProvider = new MCPOAuthProvider(new MCPOAuthTokenStorage());
|
|
299884
299948
|
await authProvider.authenticate(mcpServerName, oauthAuthConfig, authServerUrl);
|
|
299885
299949
|
const tokenStorage = new MCPOAuthTokenStorage();
|
|
@@ -299989,7 +300053,7 @@ async function createTransport(mcpServerName, mcpServerConfig, debugMode) {
|
|
|
299989
300053
|
});
|
|
299990
300054
|
if (accessToken) {
|
|
299991
300055
|
hasOAuthConfig = true;
|
|
299992
|
-
|
|
300056
|
+
debugLogger.log(`Found stored OAuth token for server '${mcpServerName}'`);
|
|
299993
300057
|
}
|
|
299994
300058
|
}
|
|
299995
300059
|
}
|
|
@@ -300039,7 +300103,7 @@ async function createTransport(mcpServerName, mcpServerConfig, debugMode) {
|
|
|
300039
300103
|
if (debugMode) {
|
|
300040
300104
|
transport.stderr.on("data", (data) => {
|
|
300041
300105
|
const stderrStr = data.toString().trim();
|
|
300042
|
-
|
|
300106
|
+
debugLogger.debug(`[DEBUG] [MCP STDERR (${mcpServerName})]: `, stderrStr);
|
|
300043
300107
|
});
|
|
300044
300108
|
}
|
|
300045
300109
|
return transport;
|
|
@@ -300048,7 +300112,7 @@ async function createTransport(mcpServerName, mcpServerConfig, debugMode) {
|
|
|
300048
300112
|
}
|
|
300049
300113
|
function isEnabled(funcDecl, mcpServerName, mcpServerConfig) {
|
|
300050
300114
|
if (!funcDecl.name) {
|
|
300051
|
-
|
|
300115
|
+
debugLogger.warn(`Discovered a function declaration without a name from MCP server '${mcpServerName}'. Skipping.`);
|
|
300052
300116
|
return false;
|
|
300053
300117
|
}
|
|
300054
300118
|
const { includeTools, excludeTools } = mcpServerConfig;
|
|
@@ -300252,7 +300316,7 @@ var ToolRegistry = class {
|
|
|
300252
300316
|
if (tool instanceof DiscoveredMCPTool) {
|
|
300253
300317
|
tool = tool.asFullyQualifiedTool();
|
|
300254
300318
|
} else {
|
|
300255
|
-
|
|
300319
|
+
debugLogger.warn(`Tool with name "${tool.name}" is already registered. Overwriting.`);
|
|
300256
300320
|
}
|
|
300257
300321
|
}
|
|
300258
300322
|
this.tools.set(tool.name, tool);
|
|
@@ -300395,7 +300459,7 @@ var ToolRegistry = class {
|
|
|
300395
300459
|
}
|
|
300396
300460
|
for (const func2 of functions) {
|
|
300397
300461
|
if (!func2.name) {
|
|
300398
|
-
|
|
300462
|
+
debugLogger.warn("Discovered a tool with no name. Skipping.");
|
|
300399
300463
|
continue;
|
|
300400
300464
|
}
|
|
300401
300465
|
const parameters = func2.parametersJsonSchema && typeof func2.parametersJsonSchema === "object" && !Array.isArray(func2.parametersJsonSchema) ? func2.parametersJsonSchema : {};
|
|
@@ -302514,14 +302578,14 @@ async function isBinaryFile(filePath) {
|
|
|
302514
302578
|
}
|
|
302515
302579
|
return nonPrintableCount / bytesRead > 0.3;
|
|
302516
302580
|
} catch (error) {
|
|
302517
|
-
|
|
302581
|
+
debugLogger.warn(`Failed to check if file is binary: ${filePath}`, error instanceof Error ? error.message : String(error));
|
|
302518
302582
|
return false;
|
|
302519
302583
|
} finally {
|
|
302520
302584
|
if (fh) {
|
|
302521
302585
|
try {
|
|
302522
302586
|
await fh.close();
|
|
302523
302587
|
} catch (closeError) {
|
|
302524
|
-
|
|
302588
|
+
debugLogger.warn(`Failed to close file handle for: ${filePath}`, closeError instanceof Error ? closeError.message : String(closeError));
|
|
302525
302589
|
}
|
|
302526
302590
|
}
|
|
302527
302591
|
}
|
|
@@ -308428,23 +308492,6 @@ function isGitRepository(directory) {
|
|
|
308428
308492
|
}
|
|
308429
308493
|
}
|
|
308430
308494
|
|
|
308431
|
-
// packages/core/dist/src/utils/debugLogger.js
|
|
308432
|
-
var DebugLogger = class {
|
|
308433
|
-
log(...args2) {
|
|
308434
|
-
console.log(...args2);
|
|
308435
|
-
}
|
|
308436
|
-
warn(...args2) {
|
|
308437
|
-
console.warn(...args2);
|
|
308438
|
-
}
|
|
308439
|
-
error(...args2) {
|
|
308440
|
-
console.error(...args2);
|
|
308441
|
-
}
|
|
308442
|
-
debug(...args2) {
|
|
308443
|
-
console.debug(...args2);
|
|
308444
|
-
}
|
|
308445
|
-
};
|
|
308446
|
-
var debugLogger = new DebugLogger();
|
|
308447
|
-
|
|
308448
308495
|
// packages/core/dist/src/tools/grep.js
|
|
308449
308496
|
var GrepToolInvocation = class extends BaseToolInvocation {
|
|
308450
308497
|
config;
|
|
@@ -308698,10 +308745,10 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
308698
308745
|
});
|
|
308699
308746
|
return this.parseGrepOutput(output, absolutePath);
|
|
308700
308747
|
} catch (gitError) {
|
|
308701
|
-
|
|
308748
|
+
debugLogger.debug(`GrepLogic: git grep failed: ${getErrorMessage(gitError)}. Falling back...`);
|
|
308702
308749
|
}
|
|
308703
308750
|
}
|
|
308704
|
-
|
|
308751
|
+
debugLogger.debug("GrepLogic: System grep is being considered as fallback strategy.");
|
|
308705
308752
|
const grepAvailable = await this.isCommandAvailable("grep");
|
|
308706
308753
|
if (grepAvailable) {
|
|
308707
308754
|
strategyUsed = "system grep";
|
|
@@ -308778,10 +308825,10 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
308778
308825
|
});
|
|
308779
308826
|
return this.parseGrepOutput(output, absolutePath);
|
|
308780
308827
|
} catch (grepError) {
|
|
308781
|
-
|
|
308828
|
+
debugLogger.debug(`GrepLogic: System grep failed: ${getErrorMessage(grepError)}. Falling back...`);
|
|
308782
308829
|
}
|
|
308783
308830
|
}
|
|
308784
|
-
|
|
308831
|
+
debugLogger.debug("GrepLogic: Falling back to JavaScript grep implementation.");
|
|
308785
308832
|
strategyUsed = "javascript fallback";
|
|
308786
308833
|
const globPattern = include ? include : "**/*";
|
|
308787
308834
|
const ignorePatterns = this.fileExclusions.getGlobExcludes();
|
|
@@ -308811,7 +308858,7 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
308811
308858
|
});
|
|
308812
308859
|
} catch (readError) {
|
|
308813
308860
|
if (!isNodeError(readError) || readError.code !== "ENOENT") {
|
|
308814
|
-
|
|
308861
|
+
debugLogger.debug(`GrepLogic: Could not read/process ${fileAbsolutePath}: ${getErrorMessage(readError)}`);
|
|
308815
308862
|
}
|
|
308816
308863
|
}
|
|
308817
308864
|
}
|
|
@@ -321958,7 +322005,7 @@ var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
|
321958
322005
|
let allMatches = [];
|
|
321959
322006
|
const totalMaxMatches = DEFAULT_TOTAL_MAX_MATCHES;
|
|
321960
322007
|
if (this.config.getDebugMode()) {
|
|
321961
|
-
|
|
322008
|
+
debugLogger.log(`[GrepTool] Total result limit: ${totalMaxMatches}`);
|
|
321962
322009
|
}
|
|
321963
322010
|
for (const searchDir of searchDirectories) {
|
|
321964
322011
|
const searchResult = await this.performRipgrepSearch({
|
|
@@ -323352,7 +323399,7 @@ import * as os10 from "node:os";
|
|
|
323352
323399
|
import * as path37 from "node:path";
|
|
323353
323400
|
var logger2 = {
|
|
323354
323401
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
323355
|
-
debug: (...args2) =>
|
|
323402
|
+
debug: (...args2) => debugLogger.debug("[DEBUG] [IDEClient]", ...args2),
|
|
323356
323403
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
323357
323404
|
error: (...args2) => console.error("[ERROR] [IDEClient]", ...args2)
|
|
323358
323405
|
};
|
|
@@ -324071,11 +324118,11 @@ var EditToolInvocation = class {
|
|
|
324071
324118
|
throw error;
|
|
324072
324119
|
}
|
|
324073
324120
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
324074
|
-
|
|
324121
|
+
debugLogger.log(`Error preparing edit: ${errorMsg}`);
|
|
324075
324122
|
return false;
|
|
324076
324123
|
}
|
|
324077
324124
|
if (editData.error) {
|
|
324078
|
-
|
|
324125
|
+
debugLogger.log(`Error: ${editData.error.display}`);
|
|
324079
324126
|
return false;
|
|
324080
324127
|
}
|
|
324081
324128
|
const fileName = path38.basename(this.params.file_path);
|
|
@@ -324714,7 +324761,7 @@ async function retryWithBackoff(fn, options2) {
|
|
|
324714
324761
|
throw error;
|
|
324715
324762
|
}
|
|
324716
324763
|
} catch (fallbackError) {
|
|
324717
|
-
|
|
324764
|
+
debugLogger.warn("Fallback to Flash model failed:", fallbackError);
|
|
324718
324765
|
}
|
|
324719
324766
|
}
|
|
324720
324767
|
if (errorStatus === 429 && authType === AuthType2.LOGIN_WITH_GOOGLE && !isProQuotaExceededError(error) && isGenericQuotaExceededError(error) && onPersistent429) {
|
|
@@ -324729,7 +324776,7 @@ async function retryWithBackoff(fn, options2) {
|
|
|
324729
324776
|
throw error;
|
|
324730
324777
|
}
|
|
324731
324778
|
} catch (fallbackError) {
|
|
324732
|
-
|
|
324779
|
+
debugLogger.warn("Fallback to Flash model failed:", fallbackError);
|
|
324733
324780
|
}
|
|
324734
324781
|
}
|
|
324735
324782
|
if (errorStatus === 429) {
|
|
@@ -324749,7 +324796,7 @@ async function retryWithBackoff(fn, options2) {
|
|
|
324749
324796
|
throw error;
|
|
324750
324797
|
}
|
|
324751
324798
|
} catch (fallbackError) {
|
|
324752
|
-
|
|
324799
|
+
debugLogger.warn("Fallback to Flash model failed:", fallbackError);
|
|
324753
324800
|
}
|
|
324754
324801
|
}
|
|
324755
324802
|
if (attempt >= maxAttempts || !shouldRetryOnError(error, retryFetchErrors)) {
|
|
@@ -324757,7 +324804,7 @@ async function retryWithBackoff(fn, options2) {
|
|
|
324757
324804
|
}
|
|
324758
324805
|
const { delayDurationMs, errorStatus: delayErrorStatus } = getDelayDurationAndStatus(error);
|
|
324759
324806
|
if (delayDurationMs > 0) {
|
|
324760
|
-
|
|
324807
|
+
debugLogger.warn(`Attempt ${attempt} failed with status ${delayErrorStatus ?? "unknown"}. Retrying after explicit delay of ${delayDurationMs}ms...`, error);
|
|
324761
324808
|
await delay2(delayDurationMs, signal);
|
|
324762
324809
|
currentDelay = initialDelayMs;
|
|
324763
324810
|
} else {
|
|
@@ -324821,19 +324868,19 @@ function logRetryAttempt(attempt, error, errorStatus) {
|
|
|
324821
324868
|
message = `Attempt ${attempt} failed with status ${errorStatus}. Retrying with backoff...`;
|
|
324822
324869
|
}
|
|
324823
324870
|
if (errorStatus === 429) {
|
|
324824
|
-
|
|
324871
|
+
debugLogger.warn(message, error);
|
|
324825
324872
|
} else if (errorStatus && errorStatus >= 500 && errorStatus < 600) {
|
|
324826
324873
|
console.error(message, error);
|
|
324827
324874
|
} else if (error instanceof Error) {
|
|
324828
324875
|
if (error.message.includes("429")) {
|
|
324829
|
-
|
|
324876
|
+
debugLogger.warn(`Attempt ${attempt} failed with 429 error (no Retry-After header). Retrying with backoff...`, error);
|
|
324830
324877
|
} else if (error.message.match(/5\d{2}/)) {
|
|
324831
324878
|
console.error(`Attempt ${attempt} failed with 5xx error. Retrying with backoff...`, error);
|
|
324832
324879
|
} else {
|
|
324833
|
-
|
|
324880
|
+
debugLogger.warn(message, error);
|
|
324834
324881
|
}
|
|
324835
324882
|
} else {
|
|
324836
|
-
|
|
324883
|
+
debugLogger.warn(message, error);
|
|
324837
324884
|
}
|
|
324838
324885
|
}
|
|
324839
324886
|
|
|
@@ -324997,7 +325044,7 @@ async function FixLLMEditWithInstruction(instruction, old_string, new_string, er
|
|
|
324997
325044
|
let promptId = promptIdContext.getStore();
|
|
324998
325045
|
if (!promptId) {
|
|
324999
325046
|
promptId = `llm-fixer-fallback-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
325000
|
-
|
|
325047
|
+
debugLogger.warn(`Could not find promptId in context. This is unexpected. Using a fallback ID: ${promptId}`);
|
|
325001
325048
|
}
|
|
325002
325049
|
const cacheKey = createHash8("sha256").update(JSON.stringify([
|
|
325003
325050
|
current_content,
|
|
@@ -325414,11 +325461,11 @@ var EditToolInvocation2 = class {
|
|
|
325414
325461
|
throw error;
|
|
325415
325462
|
}
|
|
325416
325463
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
325417
|
-
|
|
325464
|
+
debugLogger.log(`Error preparing edit: ${errorMsg}`);
|
|
325418
325465
|
return false;
|
|
325419
325466
|
}
|
|
325420
325467
|
if (editData.error) {
|
|
325421
|
-
|
|
325468
|
+
debugLogger.log(`Error: ${editData.error.display}`);
|
|
325422
325469
|
return false;
|
|
325423
325470
|
}
|
|
325424
325471
|
const fileName = path42.basename(this.params.file_path);
|
|
@@ -325773,7 +325820,7 @@ function getSystemEncoding() {
|
|
|
325773
325820
|
}
|
|
325774
325821
|
throw new Error(`Unable to parse Windows code page from 'chcp' output "${output.trim()}". `);
|
|
325775
325822
|
} catch (error) {
|
|
325776
|
-
|
|
325823
|
+
debugLogger.warn(`Failed to get Windows code page using 'chcp' command: ${error instanceof Error ? error.message : String(error)}. Will attempt to detect encoding from command output instead.`);
|
|
325777
325824
|
}
|
|
325778
325825
|
return null;
|
|
325779
325826
|
}
|
|
@@ -325783,7 +325830,7 @@ function getSystemEncoding() {
|
|
|
325783
325830
|
try {
|
|
325784
325831
|
locale = execSync2("locale charmap", { encoding: "utf8" }).toString().trim();
|
|
325785
325832
|
} catch (_e) {
|
|
325786
|
-
|
|
325833
|
+
debugLogger.warn("Failed to get locale charmap.");
|
|
325787
325834
|
return null;
|
|
325788
325835
|
}
|
|
325789
325836
|
}
|
|
@@ -325823,7 +325870,7 @@ function windowsCodePageToEncoding(cp) {
|
|
|
325823
325870
|
if (map2[cp]) {
|
|
325824
325871
|
return map2[cp];
|
|
325825
325872
|
}
|
|
325826
|
-
|
|
325873
|
+
debugLogger.warn(`Unable to determine encoding for windows code page ${cp}.`);
|
|
325827
325874
|
return null;
|
|
325828
325875
|
}
|
|
325829
325876
|
function detectEncodingFromBuffer(buffer) {
|
|
@@ -325833,7 +325880,7 @@ function detectEncodingFromBuffer(buffer) {
|
|
|
325833
325880
|
return detected.toLowerCase();
|
|
325834
325881
|
}
|
|
325835
325882
|
} catch (error) {
|
|
325836
|
-
|
|
325883
|
+
debugLogger.warn("Failed to detect encoding with chardet:", error);
|
|
325837
325884
|
}
|
|
325838
325885
|
return null;
|
|
325839
325886
|
}
|
|
@@ -331215,7 +331262,7 @@ var ShellExecutionService = class {
|
|
|
331215
331262
|
activePty.ptyProcess.resize(cols, rows);
|
|
331216
331263
|
activePty.headlessTerminal.resize(cols, rows);
|
|
331217
331264
|
} catch (e2) {
|
|
331218
|
-
if (e2 instanceof Error && "code" in e2 && e2.code === "ESRCH") {
|
|
331265
|
+
if (e2 instanceof Error && ("code" in e2 && e2.code === "ESRCH" || e2.message === "Cannot resize a pty that has already exited")) {
|
|
331219
331266
|
} else {
|
|
331220
331267
|
throw e2;
|
|
331221
331268
|
}
|
|
@@ -336921,7 +336968,7 @@ ${textContent2}
|
|
|
336921
336968
|
// Pass signal
|
|
336922
336969
|
DEFAULT_GEMINI_FLASH_MODEL
|
|
336923
336970
|
);
|
|
336924
|
-
|
|
336971
|
+
debugLogger.debug(`[WebFetchTool] Full response for prompt "${userPrompt.substring(0, 50)}...":`, JSON.stringify(response, null, 2));
|
|
336925
336972
|
let responseText = getResponseText(response) || "";
|
|
336926
336973
|
const urlContextMeta = response.candidates?.[0]?.urlContextMetadata;
|
|
336927
336974
|
const groundingMetadata = response.candidates?.[0]?.groundingMetadata;
|
|
@@ -336976,7 +337023,7 @@ ${sourceListFormatted.join("\n")}`;
|
|
|
336976
337023
|
}
|
|
336977
337024
|
}
|
|
336978
337025
|
const llmContent = responseText;
|
|
336979
|
-
|
|
337026
|
+
debugLogger.debug(`[WebFetchTool] Formatted tool response for prompt "${userPrompt}:
|
|
336980
337027
|
|
|
336981
337028
|
":`, llmContent);
|
|
336982
337029
|
return {
|
|
@@ -337565,7 +337612,7 @@ async function readFullStructure(rootPath, options2) {
|
|
|
337565
337612
|
entries2 = rawEntries.sort((a2, b) => a2.name.localeCompare(b.name));
|
|
337566
337613
|
} catch (error) {
|
|
337567
337614
|
if (isNodeError(error) && (error.code === "EACCES" || error.code === "ENOENT")) {
|
|
337568
|
-
|
|
337615
|
+
debugLogger.warn(`Warning: Could not read directory ${currentPath}: ${error.message}`);
|
|
337569
337616
|
if (currentPath === rootPath && error.code === "ENOENT") {
|
|
337570
337617
|
return null;
|
|
337571
337618
|
}
|
|
@@ -339452,7 +339499,7 @@ function resolvePathFromEnv(envVar) {
|
|
|
339452
339499
|
customPath = path49.join(home, customPath.slice(2));
|
|
339453
339500
|
}
|
|
339454
339501
|
} catch (error) {
|
|
339455
|
-
|
|
339502
|
+
debugLogger.warn(`Could not resolve home directory for path: ${trimmedEnvVar}`, error);
|
|
339456
339503
|
return { isSwitch: false, value: null, isDisabled: false };
|
|
339457
339504
|
}
|
|
339458
339505
|
}
|
|
@@ -339769,7 +339816,7 @@ async function checkNextSpeaker(chat, baseLlmClient, abortSignal, promptId) {
|
|
|
339769
339816
|
}
|
|
339770
339817
|
return null;
|
|
339771
339818
|
} catch (error) {
|
|
339772
|
-
|
|
339819
|
+
debugLogger.warn("Failed to talk to Gemini endpoint when seeing if conversation should continue.", error);
|
|
339773
339820
|
return null;
|
|
339774
339821
|
}
|
|
339775
339822
|
}
|
|
@@ -340060,13 +340107,13 @@ var LoopDetectionService = class {
|
|
|
340060
340107
|
promptId: this.promptId
|
|
340061
340108
|
});
|
|
340062
340109
|
} catch (e2) {
|
|
340063
|
-
this.config.getDebugMode() ? console.error(e2) :
|
|
340110
|
+
this.config.getDebugMode() ? console.error(e2) : debugLogger.debug(e2);
|
|
340064
340111
|
return false;
|
|
340065
340112
|
}
|
|
340066
340113
|
if (typeof result["confidence"] === "number") {
|
|
340067
340114
|
if (result["confidence"] > 0.9) {
|
|
340068
340115
|
if (typeof result["reasoning"] === "string" && result["reasoning"]) {
|
|
340069
|
-
|
|
340116
|
+
debugLogger.warn(result["reasoning"]);
|
|
340070
340117
|
}
|
|
340071
340118
|
logLoopDetected(this.config, new LoopDetectedEvent(LoopType.LLM_DETECTED_LOOP, this.promptId));
|
|
340072
340119
|
return true;
|
|
@@ -340294,7 +340341,7 @@ My setup is complete. I will provide my first command in the next turn.
|
|
|
340294
340341
|
"```"
|
|
340295
340342
|
];
|
|
340296
340343
|
if (this.config.getDebugMode()) {
|
|
340297
|
-
|
|
340344
|
+
debugLogger.log(contextParts.join("\n"));
|
|
340298
340345
|
}
|
|
340299
340346
|
return {
|
|
340300
340347
|
contextParts,
|
|
@@ -340377,7 +340424,7 @@ My setup is complete. I will provide my first command in the next turn.
|
|
|
340377
340424
|
"```"
|
|
340378
340425
|
];
|
|
340379
340426
|
if (this.config.getDebugMode()) {
|
|
340380
|
-
|
|
340427
|
+
debugLogger.log(contextParts.join("\n"));
|
|
340381
340428
|
}
|
|
340382
340429
|
return {
|
|
340383
340430
|
contextParts,
|
|
@@ -345535,6 +345582,12 @@ function shouldAttemptBrowserLaunch() {
|
|
|
345535
345582
|
}
|
|
345536
345583
|
|
|
345537
345584
|
// packages/core/dist/src/tools/write-todos.js
|
|
345585
|
+
var TODO_STATUSES = [
|
|
345586
|
+
"pending",
|
|
345587
|
+
"in_progress",
|
|
345588
|
+
"completed",
|
|
345589
|
+
"cancelled"
|
|
345590
|
+
];
|
|
345538
345591
|
var WRITE_TODOS_DESCRIPTION = `This tool can help you list out the current subtasks that are required to be completed for a given user request. The list of subtasks helps you keep track of the current task, organize complex queries and help ensure that you don't miss any steps. With this list, the user can also see the current progress you are making in executing a given task.
|
|
345539
345592
|
|
|
345540
345593
|
Depending on the task complexity, you should first divide a given task into subtasks and then use this tool to list out the subtasks that are required to be completed for a given user request.
|
|
@@ -345638,7 +345691,7 @@ var WriteTodosTool = class _WriteTodosTool extends BaseDeclarativeTool {
|
|
|
345638
345691
|
status: {
|
|
345639
345692
|
type: "string",
|
|
345640
345693
|
description: "The current status of the task.",
|
|
345641
|
-
enum:
|
|
345694
|
+
enum: TODO_STATUSES
|
|
345642
345695
|
}
|
|
345643
345696
|
},
|
|
345644
345697
|
required: ["description", "status"]
|
|
@@ -345660,8 +345713,8 @@ var WriteTodosTool = class _WriteTodosTool extends BaseDeclarativeTool {
|
|
|
345660
345713
|
if (typeof todo.description !== "string" || !todo.description.trim()) {
|
|
345661
345714
|
return "Each todo must have a non-empty description string";
|
|
345662
345715
|
}
|
|
345663
|
-
if (!
|
|
345664
|
-
return
|
|
345716
|
+
if (!TODO_STATUSES.includes(todo.status)) {
|
|
345717
|
+
return `Each todo must have a valid status (${TODO_STATUSES.join(", ")})`;
|
|
345665
345718
|
}
|
|
345666
345719
|
}
|
|
345667
345720
|
const inProgressCount = todos.filter((todo) => todo.status === "in_progress").length;
|
|
@@ -345823,7 +345876,7 @@ var ClassifierStrategy = class {
|
|
|
345823
345876
|
let promptId = promptIdContext.getStore();
|
|
345824
345877
|
if (!promptId) {
|
|
345825
345878
|
promptId = `classifier-router-fallback-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
345826
|
-
|
|
345879
|
+
debugLogger.warn(`Could not find promptId in context. This is unexpected. Using a fallback ID: ${promptId}`);
|
|
345827
345880
|
}
|
|
345828
345881
|
const historySlice = context2.history.slice(-HISTORY_SEARCH_WINDOW);
|
|
345829
345882
|
const cleanHistory = historySlice.filter((content) => !isFunctionCall(content) && !isFunctionResponse(content));
|
|
@@ -345860,7 +345913,7 @@ var ClassifierStrategy = class {
|
|
|
345860
345913
|
};
|
|
345861
345914
|
}
|
|
345862
345915
|
} catch (error) {
|
|
345863
|
-
|
|
345916
|
+
debugLogger.warn(`[Routing] ClassifierStrategy failed:`, error);
|
|
345864
345917
|
return null;
|
|
345865
345918
|
}
|
|
345866
345919
|
}
|
|
@@ -346086,7 +346139,7 @@ var WorkspaceContext = class {
|
|
|
346086
346139
|
this.directories.add(resolved);
|
|
346087
346140
|
this.notifyDirectoriesChanged();
|
|
346088
346141
|
} catch (err2) {
|
|
346089
|
-
|
|
346142
|
+
debugLogger.warn(`[WARN] Skipping unreadable directory: ${directory} (${err2 instanceof Error ? err2.message : String(err2)})`);
|
|
346090
346143
|
}
|
|
346091
346144
|
}
|
|
346092
346145
|
resolveAndValidateDir(directory, basePath = process21.cwd()) {
|
|
@@ -346403,7 +346456,7 @@ var AgentRegistry = class {
|
|
|
346403
346456
|
async initialize() {
|
|
346404
346457
|
this.loadBuiltInAgents();
|
|
346405
346458
|
if (this.config.getDebugMode()) {
|
|
346406
|
-
|
|
346459
|
+
debugLogger.log(`[AgentRegistry] Initialized with ${this.agents.size} agents.`);
|
|
346407
346460
|
}
|
|
346408
346461
|
}
|
|
346409
346462
|
loadBuiltInAgents() {
|
|
@@ -346432,11 +346485,11 @@ var AgentRegistry = class {
|
|
|
346432
346485
|
*/
|
|
346433
346486
|
registerAgent(definition) {
|
|
346434
346487
|
if (!definition.name || !definition.description) {
|
|
346435
|
-
|
|
346488
|
+
debugLogger.warn(`[AgentRegistry] Skipping invalid agent definition. Missing name or description.`);
|
|
346436
346489
|
return;
|
|
346437
346490
|
}
|
|
346438
346491
|
if (this.agents.has(definition.name) && this.config.getDebugMode()) {
|
|
346439
|
-
|
|
346492
|
+
debugLogger.log(`[AgentRegistry] Overriding agent '${definition.name}'`);
|
|
346440
346493
|
}
|
|
346441
346494
|
this.agents.set(definition.name, definition);
|
|
346442
346495
|
}
|
|
@@ -348110,7 +348163,7 @@ var AgentExecutor = class _AgentExecutor {
|
|
|
348110
348163
|
}
|
|
348111
348164
|
if (!allowedToolNames.has(functionCall.name)) {
|
|
348112
348165
|
const error = `Unauthorized tool call: '${functionCall.name}' is not available to this agent.`;
|
|
348113
|
-
|
|
348166
|
+
debugLogger.warn(`[AgentExecutor] Blocked call: ${error}`);
|
|
348114
348167
|
syncResponseParts.push({
|
|
348115
348168
|
functionResponse: {
|
|
348116
348169
|
name: functionCall.name,
|
|
@@ -348596,7 +348649,7 @@ var Config = class {
|
|
|
348596
348649
|
this.useModelRouter = params.useModelRouter ?? false;
|
|
348597
348650
|
this.enableMessageBusIntegration = params.enableMessageBusIntegration ?? false;
|
|
348598
348651
|
this.codebaseInvestigatorSettings = {
|
|
348599
|
-
enabled: params.codebaseInvestigatorSettings?.enabled ??
|
|
348652
|
+
enabled: params.codebaseInvestigatorSettings?.enabled ?? false,
|
|
348600
348653
|
maxNumTurns: params.codebaseInvestigatorSettings?.maxNumTurns ?? 15,
|
|
348601
348654
|
maxTimeMinutes: params.codebaseInvestigatorSettings?.maxTimeMinutes ?? 5,
|
|
348602
348655
|
thinkingBudget: params.codebaseInvestigatorSettings?.thinkingBudget ?? DEFAULT_THINKING_MODE,
|
|
@@ -349048,11 +349101,11 @@ var Config = class {
|
|
|
349048
349101
|
if (isEnabled2) {
|
|
349049
349102
|
const messageBusEnabled = this.getEnableMessageBusIntegration();
|
|
349050
349103
|
if (this.debugMode && messageBusEnabled) {
|
|
349051
|
-
|
|
349104
|
+
debugLogger.log(`[DEBUG] enableMessageBusIntegration setting: ${messageBusEnabled}`);
|
|
349052
349105
|
}
|
|
349053
349106
|
const toolArgs = messageBusEnabled ? [...args2, this.getMessageBus()] : args2;
|
|
349054
349107
|
if (this.debugMode && messageBusEnabled) {
|
|
349055
|
-
|
|
349108
|
+
debugLogger.log(`[DEBUG] Registering ${className} with messageBus: ${messageBusEnabled ? "YES" : "NO"}`);
|
|
349056
349109
|
}
|
|
349057
349110
|
registry.registerTool(new ToolClass(...toolArgs));
|
|
349058
349111
|
}
|
|
@@ -349107,7 +349160,7 @@ var Config = class {
|
|
|
349107
349160
|
console.error(`Failed to wrap agent '${definition.name}' as a tool:`, error);
|
|
349108
349161
|
}
|
|
349109
349162
|
} else if (this.getDebugMode()) {
|
|
349110
|
-
|
|
349163
|
+
debugLogger.log(`[Config] Skipping registration of agent '${definition.name}' due to allow/exclude configuration.`);
|
|
349111
349164
|
}
|
|
349112
349165
|
}
|
|
349113
349166
|
}
|
|
@@ -349133,7 +349186,7 @@ import * as fs53 from "node:fs/promises";
|
|
|
349133
349186
|
import * as path57 from "node:path";
|
|
349134
349187
|
var logger3 = {
|
|
349135
349188
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
349136
|
-
debug: (...args2) =>
|
|
349189
|
+
debug: (...args2) => debugLogger.debug("[DEBUG] [BfsFileSearch]", ...args2)
|
|
349137
349190
|
};
|
|
349138
349191
|
async function bfsFileSearch(rootDir, options2) {
|
|
349139
349192
|
const { fileName, ignoreDirs = [], maxDirs = Infinity, debug: debug2 = false, fileService } = options2;
|
|
@@ -349167,7 +349220,7 @@ async function bfsFileSearch(rootDir, options2) {
|
|
|
349167
349220
|
return { currentDir, entries: entries2 };
|
|
349168
349221
|
} catch (error) {
|
|
349169
349222
|
const message = error?.message ?? "Unknown error";
|
|
349170
|
-
|
|
349223
|
+
debugLogger.warn(`[WARN] Skipping unreadable directory: ${currentDir} (${message})`);
|
|
349171
349224
|
if (debug2) {
|
|
349172
349225
|
logger3.debug(`Full error for ${currentDir}:`, error);
|
|
349173
349226
|
}
|
|
@@ -351346,9 +351399,9 @@ var lexer = _Lexer.lex;
|
|
|
351346
351399
|
// packages/core/dist/src/utils/memoryImportProcessor.js
|
|
351347
351400
|
var logger4 = {
|
|
351348
351401
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
351349
|
-
debug: (...args2) =>
|
|
351402
|
+
debug: (...args2) => debugLogger.debug("[DEBUG] [ImportProcessor]", ...args2),
|
|
351350
351403
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
351351
|
-
warn: (...args2) =>
|
|
351404
|
+
warn: (...args2) => debugLogger.warn("[WARN] [ImportProcessor]", ...args2),
|
|
351352
351405
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
351353
351406
|
error: (...args2) => console.error("[ERROR] [ImportProcessor]", ...args2)
|
|
351354
351407
|
};
|
|
@@ -351566,9 +351619,9 @@ function validateImportPath(importPath, basePath, allowedDirectories) {
|
|
|
351566
351619
|
// packages/core/dist/src/utils/memoryDiscovery.js
|
|
351567
351620
|
var logger5 = {
|
|
351568
351621
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
351569
|
-
debug: (...args2) =>
|
|
351622
|
+
debug: (...args2) => debugLogger.debug("[DEBUG] [MemoryDiscovery]", ...args2),
|
|
351570
351623
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
351571
|
-
warn: (...args2) =>
|
|
351624
|
+
warn: (...args2) => debugLogger.warn("[WARN] [MemoryDiscovery]", ...args2),
|
|
351572
351625
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
351573
351626
|
error: (...args2) => console.error("[ERROR] [MemoryDiscovery]", ...args2)
|
|
351574
351627
|
};
|
|
@@ -351940,7 +351993,7 @@ function mergeMcpServers(settings, extensions) {
|
|
|
351940
351993
|
for (const extension of extensions) {
|
|
351941
351994
|
Object.entries(extension.mcpServers || {}).forEach(([key, server]) => {
|
|
351942
351995
|
if (mcpServers[key]) {
|
|
351943
|
-
|
|
351996
|
+
debugLogger.warn(
|
|
351944
351997
|
`Skipping extension MCP config for server with key "${key}" as it already exists.`
|
|
351945
351998
|
);
|
|
351946
351999
|
return;
|