@google/gemini-cli-a2a-server 0.34.0-preview.1 → 0.34.0-preview.3

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.
@@ -94139,161 +94139,6 @@ var init_base_token_storage = __esm({
94139
94139
  }
94140
94140
  });
94141
94141
 
94142
- // packages/core/dist/src/mcp/token-storage/file-token-storage.js
94143
- import { promises as fs16 } from "node:fs";
94144
- import * as path9 from "node:path";
94145
- import * as os6 from "node:os";
94146
- import * as crypto11 from "node:crypto";
94147
- var FileTokenStorage;
94148
- var init_file_token_storage = __esm({
94149
- "packages/core/dist/src/mcp/token-storage/file-token-storage.js"() {
94150
- "use strict";
94151
- init_base_token_storage();
94152
- init_paths();
94153
- FileTokenStorage = class extends BaseTokenStorage {
94154
- tokenFilePath;
94155
- encryptionKey;
94156
- constructor(serviceName) {
94157
- super(serviceName);
94158
- const configDir = path9.join(homedir(), GEMINI_DIR);
94159
- this.tokenFilePath = path9.join(configDir, "mcp-oauth-tokens-v2.json");
94160
- this.encryptionKey = this.deriveEncryptionKey();
94161
- }
94162
- deriveEncryptionKey() {
94163
- const salt = `${os6.hostname()}-${os6.userInfo().username}-gemini-cli`;
94164
- return crypto11.scryptSync("gemini-cli-oauth", salt, 32);
94165
- }
94166
- encrypt(text) {
94167
- const iv = crypto11.randomBytes(16);
94168
- const cipher = crypto11.createCipheriv("aes-256-gcm", this.encryptionKey, iv);
94169
- let encrypted = cipher.update(text, "utf8", "hex");
94170
- encrypted += cipher.final("hex");
94171
- const authTag = cipher.getAuthTag();
94172
- return iv.toString("hex") + ":" + authTag.toString("hex") + ":" + encrypted;
94173
- }
94174
- decrypt(encryptedData) {
94175
- const parts2 = encryptedData.split(":");
94176
- if (parts2.length !== 3) {
94177
- throw new Error("Invalid encrypted data format");
94178
- }
94179
- const iv = Buffer.from(parts2[0], "hex");
94180
- const authTag = Buffer.from(parts2[1], "hex");
94181
- const encrypted = parts2[2];
94182
- const decipher = crypto11.createDecipheriv("aes-256-gcm", this.encryptionKey, iv);
94183
- decipher.setAuthTag(authTag);
94184
- let decrypted = decipher.update(encrypted, "hex", "utf8");
94185
- decrypted += decipher.final("utf8");
94186
- return decrypted;
94187
- }
94188
- async ensureDirectoryExists() {
94189
- const dir = path9.dirname(this.tokenFilePath);
94190
- await fs16.mkdir(dir, { recursive: true, mode: 448 });
94191
- }
94192
- async loadTokens() {
94193
- try {
94194
- const data = await fs16.readFile(this.tokenFilePath, "utf-8");
94195
- const decrypted = this.decrypt(data);
94196
- const tokens = JSON.parse(decrypted);
94197
- return new Map(Object.entries(tokens));
94198
- } catch (error2) {
94199
- const err2 = error2;
94200
- if (err2.code === "ENOENT") {
94201
- return /* @__PURE__ */ new Map();
94202
- }
94203
- if (err2.message?.includes("Invalid encrypted data format") || err2.message?.includes("Unsupported state or unable to authenticate data")) {
94204
- throw new Error(`Corrupted token file detected at: ${this.tokenFilePath}
94205
- Please delete or rename this file to resolve the issue.`);
94206
- }
94207
- throw error2;
94208
- }
94209
- }
94210
- async saveTokens(tokens) {
94211
- await this.ensureDirectoryExists();
94212
- const data = Object.fromEntries(tokens);
94213
- const json2 = JSON.stringify(data, null, 2);
94214
- const encrypted = this.encrypt(json2);
94215
- await fs16.writeFile(this.tokenFilePath, encrypted, { mode: 384 });
94216
- }
94217
- async getCredentials(serverName) {
94218
- const tokens = await this.loadTokens();
94219
- const credentials2 = tokens.get(serverName);
94220
- if (!credentials2) {
94221
- return null;
94222
- }
94223
- if (this.isTokenExpired(credentials2)) {
94224
- return null;
94225
- }
94226
- return credentials2;
94227
- }
94228
- async setCredentials(credentials2) {
94229
- this.validateCredentials(credentials2);
94230
- const tokens = await this.loadTokens();
94231
- const updatedCredentials = {
94232
- ...credentials2,
94233
- updatedAt: Date.now()
94234
- };
94235
- tokens.set(credentials2.serverName, updatedCredentials);
94236
- await this.saveTokens(tokens);
94237
- }
94238
- async deleteCredentials(serverName) {
94239
- const tokens = await this.loadTokens();
94240
- if (!tokens.has(serverName)) {
94241
- throw new Error(`No credentials found for ${serverName}`);
94242
- }
94243
- tokens.delete(serverName);
94244
- if (tokens.size === 0) {
94245
- try {
94246
- await fs16.unlink(this.tokenFilePath);
94247
- } catch (error2) {
94248
- const err2 = error2;
94249
- if (err2.code !== "ENOENT") {
94250
- throw error2;
94251
- }
94252
- }
94253
- } else {
94254
- await this.saveTokens(tokens);
94255
- }
94256
- }
94257
- async listServers() {
94258
- const tokens = await this.loadTokens();
94259
- return Array.from(tokens.keys());
94260
- }
94261
- async getAllCredentials() {
94262
- const tokens = await this.loadTokens();
94263
- const result2 = /* @__PURE__ */ new Map();
94264
- for (const [serverName, credentials2] of tokens) {
94265
- if (!this.isTokenExpired(credentials2)) {
94266
- result2.set(serverName, credentials2);
94267
- }
94268
- }
94269
- return result2;
94270
- }
94271
- async clearAll() {
94272
- try {
94273
- await fs16.unlink(this.tokenFilePath);
94274
- } catch (error2) {
94275
- const err2 = error2;
94276
- if (err2.code !== "ENOENT") {
94277
- throw error2;
94278
- }
94279
- }
94280
- }
94281
- };
94282
- }
94283
- });
94284
-
94285
- // packages/core/dist/src/mcp/token-storage/types.js
94286
- var TokenStorageType;
94287
- var init_types = __esm({
94288
- "packages/core/dist/src/mcp/token-storage/types.js"() {
94289
- "use strict";
94290
- (function(TokenStorageType2) {
94291
- TokenStorageType2["KEYCHAIN"] = "keychain";
94292
- TokenStorageType2["ENCRYPTED_FILE"] = "encrypted_file";
94293
- })(TokenStorageType || (TokenStorageType = {}));
94294
- }
94295
- });
94296
-
94297
94142
  // packages/core/dist/src/utils/events.js
94298
94143
  import { EventEmitter as EventEmitter2 } from "node:events";
94299
94144
  var CoreEvent, CoreEventEmitter, coreEvents;
@@ -94477,7 +94322,7 @@ var init_events = __esm({
94477
94322
 
94478
94323
  // packages/core/dist/src/policy/types.js
94479
94324
  var PolicyDecision, ApprovalMode, InProcessCheckerType, PRIORITY_SUBAGENT_TOOL;
94480
- var init_types2 = __esm({
94325
+ var init_types = __esm({
94481
94326
  "packages/core/dist/src/policy/types.js"() {
94482
94327
  "use strict";
94483
94328
  (function(PolicyDecision2) {
@@ -94501,10 +94346,10 @@ var init_types2 = __esm({
94501
94346
 
94502
94347
  // packages/core/dist/src/scheduler/types.js
94503
94348
  var ROOT_SCHEDULER_ID, CoreToolCallStatus;
94504
- var init_types3 = __esm({
94349
+ var init_types2 = __esm({
94505
94350
  "packages/core/dist/src/scheduler/types.js"() {
94506
94351
  "use strict";
94507
- init_types2();
94352
+ init_types();
94508
94353
  ROOT_SCHEDULER_ID = "root";
94509
94354
  (function(CoreToolCallStatus2) {
94510
94355
  CoreToolCallStatus2["Validating"] = "validating";
@@ -107903,7 +107748,7 @@ var init_schemaValidator = __esm({
107903
107748
 
107904
107749
  // packages/core/dist/src/confirmation-bus/types.js
107905
107750
  var MessageBusType, QuestionType;
107906
- var init_types4 = __esm({
107751
+ var init_types3 = __esm({
107907
107752
  "packages/core/dist/src/confirmation-bus/types.js"() {
107908
107753
  "use strict";
107909
107754
  init_node();
@@ -107998,8 +107843,8 @@ var init_tools = __esm({
107998
107843
  "use strict";
107999
107844
  init_tool_error();
108000
107845
  init_schemaValidator();
108001
- init_types4();
108002
- init_types2();
107846
+ init_types3();
107847
+ init_types();
108003
107848
  BaseToolInvocation = class {
108004
107849
  params;
108005
107850
  messageBus;
@@ -108591,7 +108436,7 @@ var init_mcp_tool = __esm({
108591
108436
  return safeJsonStringify(this.params);
108592
108437
  }
108593
108438
  };
108594
- DiscoveredMCPTool = class _DiscoveredMCPTool extends BaseDeclarativeTool {
108439
+ DiscoveredMCPTool = class extends BaseDeclarativeTool {
108595
108440
  mcpTool;
108596
108441
  serverName;
108597
108442
  serverToolName;
@@ -108643,9 +108488,6 @@ var init_mcp_tool = __esm({
108643
108488
  getFullyQualifiedName() {
108644
108489
  return generateValidName(`${this.serverName}${MCP_QUALIFIED_NAME_SEPARATOR}${this.serverToolName}`);
108645
108490
  }
108646
- asFullyQualifiedTool() {
108647
- return new _DiscoveredMCPTool(this.mcpTool, this.serverName, this.serverToolName, this.description, this.parameterSchema, this.messageBus, this.trust, this.isReadOnly, this.getFullyQualifiedName(), this.cliConfig, this.extensionName, this.extensionId, this._toolAnnotations);
108648
- }
108649
108491
  createInvocation(params, messageBus, _toolName, _displayName) {
108650
108492
  return new DiscoveredMCPToolInvocation(this.mcpTool, this.serverName, this.serverToolName, _displayName ?? this.displayName, messageBus, this.trust, params, this.cliConfig, this.description, this.parameterSchema, this._toolAnnotations);
108651
108493
  }
@@ -108923,7 +108765,7 @@ var init_ComponentLogger = __esm({
108923
108765
 
108924
108766
  // node_modules/@opentelemetry/api/build/esm/diag/types.js
108925
108767
  var DiagLogLevel;
108926
- var init_types5 = __esm({
108768
+ var init_types4 = __esm({
108927
108769
  "node_modules/@opentelemetry/api/build/esm/diag/types.js"() {
108928
108770
  (function(DiagLogLevel2) {
108929
108771
  DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
@@ -108963,7 +108805,7 @@ function createLogLevelDiagLogger(maxLevel, logger7) {
108963
108805
  }
108964
108806
  var init_logLevelLogger = __esm({
108965
108807
  "node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"() {
108966
- init_types5();
108808
+ init_types4();
108967
108809
  }
108968
108810
  });
108969
108811
 
@@ -108973,7 +108815,7 @@ var init_diag = __esm({
108973
108815
  "node_modules/@opentelemetry/api/build/esm/api/diag.js"() {
108974
108816
  init_ComponentLogger();
108975
108817
  init_logLevelLogger();
108976
- init_types5();
108818
+ init_types4();
108977
108819
  init_global_utils();
108978
108820
  __read2 = function(o3, n3) {
108979
108821
  var m3 = typeof Symbol === "function" && o3[Symbol.iterator];
@@ -110282,7 +110124,7 @@ var init_esm = __esm({
110282
110124
  init_utils();
110283
110125
  init_context();
110284
110126
  init_consoleLogger();
110285
- init_types5();
110127
+ init_types4();
110286
110128
  init_NoopMeter();
110287
110129
  init_Metric();
110288
110130
  init_TextMapPropagator();
@@ -110344,9 +110186,9 @@ var init_constants = __esm({
110344
110186
  });
110345
110187
 
110346
110188
  // packages/core/dist/src/utils/installationManager.js
110347
- import * as fs17 from "node:fs";
110189
+ import * as fs16 from "node:fs";
110348
110190
  import { randomUUID as randomUUID4 } from "node:crypto";
110349
- import * as path10 from "node:path";
110191
+ import * as path9 from "node:path";
110350
110192
  var InstallationManager;
110351
110193
  var init_installationManager = __esm({
110352
110194
  "packages/core/dist/src/utils/installationManager.js"() {
@@ -110359,17 +110201,17 @@ var init_installationManager = __esm({
110359
110201
  }
110360
110202
  readInstallationIdFromFile() {
110361
110203
  const installationIdFile = this.getInstallationIdPath();
110362
- if (fs17.existsSync(installationIdFile)) {
110363
- const installationid = fs17.readFileSync(installationIdFile, "utf-8").trim();
110204
+ if (fs16.existsSync(installationIdFile)) {
110205
+ const installationid = fs16.readFileSync(installationIdFile, "utf-8").trim();
110364
110206
  return installationid || null;
110365
110207
  }
110366
110208
  return null;
110367
110209
  }
110368
110210
  writeInstallationIdToFile(installationId) {
110369
110211
  const installationIdFile = this.getInstallationIdPath();
110370
- const dir = path10.dirname(installationIdFile);
110371
- fs17.mkdirSync(dir, { recursive: true });
110372
- fs17.writeFileSync(installationIdFile, installationId, "utf-8");
110212
+ const dir = path9.dirname(installationIdFile);
110213
+ fs16.mkdirSync(dir, { recursive: true });
110214
+ fs16.writeFileSync(installationIdFile, installationId, "utf-8");
110373
110215
  }
110374
110216
  /**
110375
110217
  * Retrieves the installation ID from a file, creating it if it doesn't exist.
@@ -113705,10 +113547,10 @@ function makeChatCompressionEvent({ tokens_before, tokens_after }) {
113705
113547
  };
113706
113548
  }
113707
113549
  var EVENT_TOOL_CALL, ToolCallEvent, EVENT_API_REQUEST, ApiRequestEvent, EVENT_API_ERROR, ApiErrorEvent, EVENT_API_RESPONSE, EVENT_GEN_AI_OPERATION_DETAILS, ApiResponseEvent, EVENT_FLASH_FALLBACK, FlashFallbackEvent, EVENT_RIPGREP_FALLBACK, RipgrepFallbackEvent, LoopType, LoopDetectedEvent, LoopDetectionDisabledEvent, EVENT_NEXT_SPEAKER_CHECK, NextSpeakerCheckEvent, EVENT_CONSECA_POLICY_GENERATION, ConsecaPolicyGenerationEvent, EVENT_CONSECA_VERDICT, ConsecaVerdictEvent, SlashCommandStatus, EVENT_CHAT_COMPRESSION2, EVENT_MALFORMED_JSON_RESPONSE, MalformedJsonResponseEvent, IdeConnectionType, EVENT_FILE_OPERATION, FileOperationEvent, EVENT_INVALID_CHUNK, InvalidChunkEvent, EVENT_CONTENT_RETRY, ContentRetryEvent, EVENT_CONTENT_RETRY_FAILURE, ContentRetryFailureEvent, EVENT_MODEL_ROUTING, ModelRoutingEvent, EVENT_TOOL_OUTPUT_TRUNCATED, ToolOutputTruncatedEvent, EVENT_TOOL_OUTPUT_MASKING, ToolOutputMaskingEvent, EVENT_LLM_LOOP_CHECK, LlmLoopCheckEvent, EVENT_EDIT_STRATEGY, EditStrategyEvent, EVENT_EDIT_CORRECTION, EditCorrectionEvent, EVENT_STARTUP_STATS, StartupStatsEvent, BaseAgentEvent, EVENT_AGENT_START, AgentStartEvent, EVENT_AGENT_FINISH, AgentFinishEvent, EVENT_AGENT_RECOVERY_ATTEMPT, RecoveryAttemptEvent, EVENT_WEB_FETCH_FALLBACK_ATTEMPT, WebFetchFallbackAttemptEvent, EVENT_HOOK_CALL, EVENT_APPROVAL_MODE_SWITCH, ApprovalModeSwitchEvent, EVENT_APPROVAL_MODE_DURATION, ApprovalModeDurationEvent, EVENT_PLAN_EXECUTION, PlanExecutionEvent, HookCallEvent, EVENT_KEYCHAIN_AVAILABILITY, KeychainAvailabilityEvent, EVENT_TOKEN_STORAGE_INITIALIZATION, TokenStorageInitializationEvent;
113708
- var init_types6 = __esm({
113550
+ var init_types5 = __esm({
113709
113551
  "packages/core/dist/src/telemetry/types.js"() {
113710
113552
  "use strict";
113711
- init_types3();
113553
+ init_types2();
113712
113554
  init_mcp_tool();
113713
113555
  init_contentGenerator();
113714
113556
  init_tool_call_decision();
@@ -115680,7 +115522,7 @@ function custom(check2, _params = {}, fatal) {
115680
115522
  return ZodAny.create();
115681
115523
  }
115682
115524
  var ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, instanceOfType, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, ostring, onumber, oboolean, coerce, NEVER;
115683
- var init_types7 = __esm({
115525
+ var init_types6 = __esm({
115684
115526
  "node_modules/zod/v3/types.js"() {
115685
115527
  init_ZodError();
115686
115528
  init_errors2();
@@ -119060,7 +118902,7 @@ var init_external = __esm({
119060
118902
  init_parseUtil();
119061
118903
  init_typeAliases();
119062
118904
  init_util();
119063
- init_types7();
118905
+ init_types6();
119064
118906
  init_ZodError();
119065
118907
  }
119066
118908
  });
@@ -119182,17 +119024,137 @@ var init_markdownUtils = __esm({
119182
119024
  }
119183
119025
  });
119184
119026
 
119027
+ // packages/core/dist/src/services/fileKeychain.js
119028
+ import { promises as fs17 } from "node:fs";
119029
+ import * as path10 from "node:path";
119030
+ import * as os6 from "node:os";
119031
+ import * as crypto11 from "node:crypto";
119032
+ var FileKeychain;
119033
+ var init_fileKeychain = __esm({
119034
+ "packages/core/dist/src/services/fileKeychain.js"() {
119035
+ "use strict";
119036
+ init_paths();
119037
+ FileKeychain = class {
119038
+ tokenFilePath;
119039
+ encryptionKey;
119040
+ constructor() {
119041
+ const configDir = path10.join(homedir(), GEMINI_DIR);
119042
+ this.tokenFilePath = path10.join(configDir, "gemini-credentials.json");
119043
+ this.encryptionKey = this.deriveEncryptionKey();
119044
+ }
119045
+ deriveEncryptionKey() {
119046
+ const salt = `${os6.hostname()}-${os6.userInfo().username}-gemini-cli`;
119047
+ return crypto11.scryptSync("gemini-cli-oauth", salt, 32);
119048
+ }
119049
+ encrypt(text) {
119050
+ const iv = crypto11.randomBytes(16);
119051
+ const cipher = crypto11.createCipheriv("aes-256-gcm", this.encryptionKey, iv);
119052
+ let encrypted = cipher.update(text, "utf8", "hex");
119053
+ encrypted += cipher.final("hex");
119054
+ const authTag = cipher.getAuthTag();
119055
+ return iv.toString("hex") + ":" + authTag.toString("hex") + ":" + encrypted;
119056
+ }
119057
+ decrypt(encryptedData) {
119058
+ const parts2 = encryptedData.split(":");
119059
+ if (parts2.length !== 3) {
119060
+ throw new Error("Invalid encrypted data format");
119061
+ }
119062
+ const iv = Buffer.from(parts2[0], "hex");
119063
+ const authTag = Buffer.from(parts2[1], "hex");
119064
+ const encrypted = parts2[2];
119065
+ const decipher = crypto11.createDecipheriv("aes-256-gcm", this.encryptionKey, iv);
119066
+ decipher.setAuthTag(authTag);
119067
+ let decrypted = decipher.update(encrypted, "hex", "utf8");
119068
+ decrypted += decipher.final("utf8");
119069
+ return decrypted;
119070
+ }
119071
+ async ensureDirectoryExists() {
119072
+ const dir = path10.dirname(this.tokenFilePath);
119073
+ await fs17.mkdir(dir, { recursive: true, mode: 448 });
119074
+ }
119075
+ async loadData() {
119076
+ try {
119077
+ const data = await fs17.readFile(this.tokenFilePath, "utf-8");
119078
+ const decrypted = this.decrypt(data);
119079
+ return JSON.parse(decrypted);
119080
+ } catch (error2) {
119081
+ const err2 = error2;
119082
+ if (err2.code === "ENOENT") {
119083
+ return {};
119084
+ }
119085
+ if (err2.message?.includes("Invalid encrypted data format") || err2.message?.includes("Unsupported state or unable to authenticate data")) {
119086
+ throw new Error(`Corrupted credentials file detected at: ${this.tokenFilePath}
119087
+ Please delete or rename this file to resolve the issue.`);
119088
+ }
119089
+ throw error2;
119090
+ }
119091
+ }
119092
+ async saveData(data) {
119093
+ await this.ensureDirectoryExists();
119094
+ const json2 = JSON.stringify(data, null, 2);
119095
+ const encrypted = this.encrypt(json2);
119096
+ await fs17.writeFile(this.tokenFilePath, encrypted, { mode: 384 });
119097
+ }
119098
+ async getPassword(service, account) {
119099
+ const data = await this.loadData();
119100
+ return data[service]?.[account] ?? null;
119101
+ }
119102
+ async setPassword(service, account, password) {
119103
+ const data = await this.loadData();
119104
+ if (!data[service]) {
119105
+ data[service] = {};
119106
+ }
119107
+ data[service][account] = password;
119108
+ await this.saveData(data);
119109
+ }
119110
+ async deletePassword(service, account) {
119111
+ const data = await this.loadData();
119112
+ if (data[service] && account in data[service]) {
119113
+ delete data[service][account];
119114
+ if (Object.keys(data[service]).length === 0) {
119115
+ delete data[service];
119116
+ }
119117
+ if (Object.keys(data).length === 0) {
119118
+ try {
119119
+ await fs17.unlink(this.tokenFilePath);
119120
+ } catch (error2) {
119121
+ const err2 = error2;
119122
+ if (err2.code !== "ENOENT") {
119123
+ throw error2;
119124
+ }
119125
+ }
119126
+ } else {
119127
+ await this.saveData(data);
119128
+ }
119129
+ return true;
119130
+ }
119131
+ return false;
119132
+ }
119133
+ async findCredentials(service) {
119134
+ const data = await this.loadData();
119135
+ const serviceData = data[service] || {};
119136
+ return Object.entries(serviceData).map(([account, password]) => ({
119137
+ account,
119138
+ password
119139
+ }));
119140
+ }
119141
+ };
119142
+ }
119143
+ });
119144
+
119185
119145
  // packages/core/dist/src/services/keychainService.js
119186
119146
  import * as crypto12 from "node:crypto";
119187
- var KeychainService;
119147
+ var FORCE_FILE_STORAGE_ENV_VAR, KeychainService;
119188
119148
  var init_keychainService = __esm({
119189
119149
  "packages/core/dist/src/services/keychainService.js"() {
119190
119150
  "use strict";
119191
119151
  init_events();
119192
- init_types6();
119152
+ init_types5();
119193
119153
  init_debugLogger();
119194
119154
  init_keychainTypes();
119195
119155
  init_markdownUtils();
119156
+ init_fileKeychain();
119157
+ FORCE_FILE_STORAGE_ENV_VAR = "GEMINI_FORCE_FILE_STORAGE";
119196
119158
  KeychainService = class {
119197
119159
  serviceName;
119198
119160
  // Track an ongoing initialization attempt to avoid race conditions.
@@ -119206,6 +119168,13 @@ var init_keychainService = __esm({
119206
119168
  async isAvailable() {
119207
119169
  return await this.getKeychain() !== null;
119208
119170
  }
119171
+ /**
119172
+ * Returns true if the service is using the encrypted file fallback backend.
119173
+ */
119174
+ async isUsingFileFallback() {
119175
+ const keychain = await this.getKeychain();
119176
+ return keychain instanceof FileKeychain;
119177
+ }
119209
119178
  /**
119210
119179
  * Retrieves a secret for the given account.
119211
119180
  * @throws Error if the keychain is unavailable.
@@ -119252,20 +119221,27 @@ var init_keychainService = __esm({
119252
119221
  // High-level orchestration of the loading and testing cycle.
119253
119222
  async initializeKeychain() {
119254
119223
  let resultKeychain = null;
119255
- try {
119256
- const keychainModule = await this.loadKeychainModule();
119257
- if (keychainModule) {
119258
- if (await this.isKeychainFunctional(keychainModule)) {
119259
- resultKeychain = keychainModule;
119260
- } else {
119261
- debugLogger.log("Keychain functional verification failed");
119224
+ const forceFileStorage = process.env[FORCE_FILE_STORAGE_ENV_VAR] === "true";
119225
+ if (!forceFileStorage) {
119226
+ try {
119227
+ const keychainModule = await this.loadKeychainModule();
119228
+ if (keychainModule) {
119229
+ if (await this.isKeychainFunctional(keychainModule)) {
119230
+ resultKeychain = keychainModule;
119231
+ } else {
119232
+ debugLogger.log("Keychain functional verification failed");
119233
+ }
119262
119234
  }
119235
+ } catch (error2) {
119236
+ const message = error2 instanceof Error ? error2.message : String(error2);
119237
+ debugLogger.log("Keychain initialization encountered an error:", message);
119263
119238
  }
119264
- } catch (error2) {
119265
- const message = error2 instanceof Error ? error2.message : String(error2);
119266
- debugLogger.log("Keychain initialization encountered an error:", message);
119267
119239
  }
119268
- coreEvents.emitTelemetryKeychainAvailability(new KeychainAvailabilityEvent(resultKeychain !== null));
119240
+ coreEvents.emitTelemetryKeychainAvailability(new KeychainAvailabilityEvent(resultKeychain !== null && !forceFileStorage));
119241
+ if (!resultKeychain) {
119242
+ resultKeychain = new FileKeychain();
119243
+ debugLogger.log("Using FileKeychain fallback for secure storage.");
119244
+ }
119269
119245
  return resultKeychain;
119270
119246
  }
119271
119247
  // Low-level dynamic loading and structural validation.
@@ -119294,10 +119270,6 @@ var init_keychainService = __esm({
119294
119270
  });
119295
119271
 
119296
119272
  // packages/core/dist/src/mcp/token-storage/keychain-token-storage.js
119297
- var keychain_token_storage_exports = {};
119298
- __export(keychain_token_storage_exports, {
119299
- KeychainTokenStorage: () => KeychainTokenStorage
119300
- });
119301
119273
  var KeychainTokenStorage;
119302
119274
  var init_keychain_token_storage = __esm({
119303
119275
  "packages/core/dist/src/mcp/token-storage/keychain-token-storage.js"() {
@@ -119398,6 +119370,9 @@ var init_keychain_token_storage = __esm({
119398
119370
  async isAvailable() {
119399
119371
  return this.keychainService.isAvailable();
119400
119372
  }
119373
+ async isUsingFileFallback() {
119374
+ return this.keychainService.isUsingFileFallback();
119375
+ }
119401
119376
  async setSecret(key, value) {
119402
119377
  await this.keychainService.setPassword(`${SECRET_PREFIX}${key}`, value);
119403
119378
  }
@@ -119423,17 +119398,29 @@ var init_keychain_token_storage = __esm({
119423
119398
  }
119424
119399
  });
119425
119400
 
119401
+ // packages/core/dist/src/mcp/token-storage/types.js
119402
+ var TokenStorageType;
119403
+ var init_types7 = __esm({
119404
+ "packages/core/dist/src/mcp/token-storage/types.js"() {
119405
+ "use strict";
119406
+ (function(TokenStorageType2) {
119407
+ TokenStorageType2["KEYCHAIN"] = "keychain";
119408
+ TokenStorageType2["ENCRYPTED_FILE"] = "encrypted_file";
119409
+ })(TokenStorageType || (TokenStorageType = {}));
119410
+ }
119411
+ });
119412
+
119426
119413
  // packages/core/dist/src/mcp/token-storage/hybrid-token-storage.js
119427
- var FORCE_FILE_STORAGE_ENV_VAR, HybridTokenStorage;
119414
+ var HybridTokenStorage;
119428
119415
  var init_hybrid_token_storage = __esm({
119429
119416
  "packages/core/dist/src/mcp/token-storage/hybrid-token-storage.js"() {
119430
119417
  "use strict";
119431
119418
  init_base_token_storage();
119432
- init_file_token_storage();
119433
- init_types();
119419
+ init_keychain_token_storage();
119420
+ init_types7();
119434
119421
  init_events();
119435
- init_types6();
119436
- FORCE_FILE_STORAGE_ENV_VAR = "GEMINI_FORCE_FILE_STORAGE";
119422
+ init_types5();
119423
+ init_keychainService();
119437
119424
  HybridTokenStorage = class extends BaseTokenStorage {
119438
119425
  storage = null;
119439
119426
  storageType = null;
@@ -119443,23 +119430,11 @@ var init_hybrid_token_storage = __esm({
119443
119430
  }
119444
119431
  async initializeStorage() {
119445
119432
  const forceFileStorage = process.env[FORCE_FILE_STORAGE_ENV_VAR] === "true";
119446
- if (!forceFileStorage) {
119447
- try {
119448
- const { KeychainTokenStorage: KeychainTokenStorage2 } = await Promise.resolve().then(() => (init_keychain_token_storage(), keychain_token_storage_exports));
119449
- const keychainStorage = new KeychainTokenStorage2(this.serviceName);
119450
- const isAvailable = await keychainStorage.isAvailable();
119451
- if (isAvailable) {
119452
- this.storage = keychainStorage;
119453
- this.storageType = TokenStorageType.KEYCHAIN;
119454
- coreEvents.emitTelemetryTokenStorageType(new TokenStorageInitializationEvent("keychain", forceFileStorage));
119455
- return this.storage;
119456
- }
119457
- } catch (_e2) {
119458
- }
119459
- }
119460
- this.storage = new FileTokenStorage(this.serviceName);
119461
- this.storageType = TokenStorageType.ENCRYPTED_FILE;
119462
- coreEvents.emitTelemetryTokenStorageType(new TokenStorageInitializationEvent("encrypted_file", forceFileStorage));
119433
+ const keychainStorage = new KeychainTokenStorage(this.serviceName);
119434
+ this.storage = keychainStorage;
119435
+ const isUsingFileFallback = await keychainStorage.isUsingFileFallback();
119436
+ this.storageType = isUsingFileFallback ? TokenStorageType.ENCRYPTED_FILE : TokenStorageType.KEYCHAIN;
119437
+ coreEvents.emitTelemetryTokenStorageType(new TokenStorageInitializationEvent(isUsingFileFallback ? "encrypted_file" : "keychain", forceFileStorage));
119463
119438
  return this.storage;
119464
119439
  }
119465
119440
  async getStorage() {
@@ -119607,10 +119582,10 @@ var DEFAULT_SERVICE_NAME, FORCE_ENCRYPTED_FILE_ENV_VAR;
119607
119582
  var init_token_storage = __esm({
119608
119583
  "packages/core/dist/src/mcp/token-storage/index.js"() {
119609
119584
  "use strict";
119610
- init_types();
119585
+ init_types7();
119611
119586
  init_base_token_storage();
119612
- init_file_token_storage();
119613
119587
  init_hybrid_token_storage();
119588
+ init_keychain_token_storage();
119614
119589
  DEFAULT_SERVICE_NAME = "gemini-cli-oauth";
119615
119590
  FORCE_ENCRYPTED_FILE_ENV_VAR = "GEMINI_FORCE_ENCRYPTED_FILE_STORAGE";
119616
119591
  }
@@ -198647,18 +198622,28 @@ function isValidToolName(name3, options = {}) {
198647
198622
  if (options.allowWildcards && name3 === "*") {
198648
198623
  return true;
198649
198624
  }
198650
- if (name3.includes("__")) {
198651
- const parts2 = name3.split("__");
198652
- if (parts2.length !== 2 || parts2[0].length === 0 || parts2[1].length === 0) {
198625
+ if (isMcpToolName(name3)) {
198626
+ if (name3 === `${MCP_TOOL_PREFIX}*` && options.allowWildcards) {
198627
+ return true;
198628
+ }
198629
+ if (name3.startsWith(`${MCP_TOOL_PREFIX}_`)) {
198653
198630
  return false;
198654
198631
  }
198655
- const server = parts2[0];
198656
- const tool = parts2[1];
198657
- if (tool === "*") {
198658
- return !!options.allowWildcards;
198632
+ const parsed = parseMcpToolName(name3);
198633
+ if (parsed.serverName && parsed.toolName) {
198634
+ const slugRegex = /^[a-z0-9_.:-]+$/i;
198635
+ if (!slugRegex.test(parsed.serverName)) {
198636
+ return false;
198637
+ }
198638
+ if (parsed.toolName === "*") {
198639
+ return options.allowWildcards === true;
198640
+ }
198641
+ if (/^_*$/.test(parsed.toolName)) {
198642
+ return false;
198643
+ }
198644
+ return slugRegex.test(parsed.toolName);
198659
198645
  }
198660
- const slugRegex = /^[a-z0-9_.:-]+$/i;
198661
- return slugRegex.test(server) && slugRegex.test(tool);
198646
+ return false;
198662
198647
  }
198663
198648
  return false;
198664
198649
  }
@@ -198667,6 +198652,7 @@ var init_tool_names = __esm({
198667
198652
  "packages/core/dist/src/tools/tool-names.js"() {
198668
198653
  "use strict";
198669
198654
  init_coreTools();
198655
+ init_mcp_tool();
198670
198656
  EDIT_TOOL_NAMES = /* @__PURE__ */ new Set([EDIT_TOOL_NAME, WRITE_FILE_TOOL_NAME]);
198671
198657
  TRACKER_CREATE_TASK_TOOL_NAME = "tracker_create_task";
198672
198658
  TRACKER_UPDATE_TASK_TOOL_NAME = "tracker_update_task";
@@ -200231,8 +200217,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
200231
200217
  var init_git_commit = __esm({
200232
200218
  "packages/core/dist/src/generated/git-commit.js"() {
200233
200219
  "use strict";
200234
- GIT_COMMIT_INFO = "c56e58d7a";
200235
- CLI_VERSION = "0.34.0-preview.1";
200220
+ GIT_COMMIT_INFO = "810cd6716";
200221
+ CLI_VERSION = "0.34.0-preview.3";
200236
200222
  }
200237
200223
  });
200238
200224
 
@@ -270277,7 +270263,7 @@ var createInitialRoleMetrics, createInitialModelMetrics, createInitialMetrics, U
270277
270263
  var init_uiTelemetry = __esm({
270278
270264
  "packages/core/dist/src/telemetry/uiTelemetry.js"() {
270279
270265
  "use strict";
270280
- init_types6();
270266
+ init_types5();
270281
270267
  init_tool_call_decision();
270282
270268
  createInitialRoleMetrics = () => ({
270283
270269
  totalRequests: 0,
@@ -271158,7 +271144,7 @@ var init_startupProfiler = __esm({
271158
271144
  "use strict";
271159
271145
  init_metrics2();
271160
271146
  init_debugLogger();
271161
- init_types6();
271147
+ init_types5();
271162
271148
  init_loggers();
271163
271149
  StartupProfiler = class _StartupProfiler {
271164
271150
  phases = /* @__PURE__ */ new Map();
@@ -271316,9 +271302,9 @@ var init_telemetry = __esm({
271316
271302
  init_gcp_exporters();
271317
271303
  init_loggers();
271318
271304
  init_conseca_logger();
271319
- init_types6();
271305
+ init_types5();
271320
271306
  init_llmRole();
271321
- init_types6();
271307
+ init_types5();
271322
271308
  init_uiTelemetry();
271323
271309
  init_billingEvents();
271324
271310
  init_memory_monitor();
@@ -272068,7 +272054,7 @@ var init_loggers = __esm({
272068
272054
  "use strict";
272069
272055
  import_api_logs2 = __toESM(require_src17(), 1);
272070
272056
  init_constants();
272071
- init_types6();
272057
+ init_types5();
272072
272058
  init_metrics2();
272073
272059
  init_sdk();
272074
272060
  init_uiTelemetry();
@@ -314522,7 +314508,7 @@ var init_baseLlmClient = __esm({
314522
314508
  init_errorReporting();
314523
314509
  init_errors();
314524
314510
  init_loggers();
314525
- init_types6();
314511
+ init_types5();
314526
314512
  init_retry();
314527
314513
  init_policyHelpers();
314528
314514
  DEFAULT_MAX_ATTEMPTS2 = 5;
@@ -314750,7 +314736,7 @@ var init_llm_edit_fixer = __esm({
314750
314736
  init_mnemonist();
314751
314737
  init_promptIdContext();
314752
314738
  init_debugLogger();
314753
- init_types6();
314739
+ init_types5();
314754
314740
  MAX_CACHE_SIZE = 50;
314755
314741
  GENERATE_JSON_TIMEOUT_MS = 4e4;
314756
314742
  EDIT_SYS_PROMPT = `
@@ -315321,15 +315307,15 @@ var init_edit = __esm({
315321
315307
  init_paths();
315322
315308
  init_errors();
315323
315309
  init_pathCorrector();
315310
+ init_types();
315324
315311
  init_types2();
315325
- init_types3();
315326
315312
  init_diffOptions();
315327
315313
  init_diff_utils();
315328
315314
  init_modifiable_tool();
315329
315315
  init_ide_client();
315330
315316
  init_llm_edit_fixer();
315331
315317
  init_textUtils();
315332
- init_types6();
315318
+ init_types5();
315333
315319
  init_loggers();
315334
315320
  init_tool_names();
315335
315321
  init_debugLogger();
@@ -315918,7 +315904,7 @@ var init_editCorrector = __esm({
315918
315904
  init_promptIdContext();
315919
315905
  init_debugLogger();
315920
315906
  init_mnemonist();
315921
- init_types6();
315907
+ init_types5();
315922
315908
  CODE_CORRECTION_SYSTEM_PROMPT = `
315923
315909
  You are an expert code-editing assistant. Your task is to analyze a failed edit attempt and provide a corrected version of the text snippets.
315924
315910
  The correction should be as minimal as possible, staying very close to the original.
@@ -317197,7 +317183,7 @@ var init_write_file = __esm({
317197
317183
  "use strict";
317198
317184
  init_libesm();
317199
317185
  init_tool_names();
317200
- init_types2();
317186
+ init_types();
317201
317187
  init_tools();
317202
317188
  init_utils4();
317203
317189
  init_tool_error();
@@ -317209,7 +317195,7 @@ var init_write_file = __esm({
317209
317195
  init_diff_utils();
317210
317196
  init_ide_client();
317211
317197
  init_loggers();
317212
- init_types6();
317198
+ init_types5();
317213
317199
  init_metrics2();
317214
317200
  init_fileUtils();
317215
317201
  init_language_detection();
@@ -322624,7 +322610,7 @@ function getVersion() {
322624
322610
  }
322625
322611
  versionPromise = (async () => {
322626
322612
  const pkgJson = await getPackageJson(__dirname3);
322627
- return "0.34.0-preview.1";
322613
+ return "0.34.0-preview.3";
322628
322614
  })();
322629
322615
  return versionPromise;
322630
322616
  }
@@ -322708,7 +322694,7 @@ var init_server = __esm({
322708
322694
  init_converter();
322709
322695
  init_telemetry2();
322710
322696
  init_client_metadata();
322711
- init_types6();
322697
+ init_types5();
322712
322698
  CODE_ASSIST_ENDPOINT = "https://cloudcode-pa.googleapis.com";
322713
322699
  CODE_ASSIST_API_VERSION = "v1internal";
322714
322700
  GENERATE_CONTENT_RETRY_DELAY_IN_MILLISECONDS = 1e3;
@@ -323440,7 +323426,7 @@ var LoggingContentGenerator;
323440
323426
  var init_loggingContentGenerator = __esm({
323441
323427
  "packages/core/dist/src/core/loggingContentGenerator.js"() {
323442
323428
  "use strict";
323443
- init_types6();
323429
+ init_types5();
323444
323430
  init_loggers();
323445
323431
  init_server();
323446
323432
  init_converter();
@@ -324377,7 +324363,7 @@ var init_tool_registry = __esm({
324377
324363
  "packages/core/dist/src/tools/tool-registry.js"() {
324378
324364
  "use strict";
324379
324365
  init_tools();
324380
- init_types2();
324366
+ init_types();
324381
324367
  init_mcp_tool();
324382
324368
  import_shell_quote = __toESM(require_shell_quote(), 1);
324383
324369
  init_tool_error();
@@ -324525,11 +324511,7 @@ Signal: Signal number or \`(none)\` if no signal was received.
324525
324511
  */
324526
324512
  registerTool(tool) {
324527
324513
  if (this.allKnownTools.has(tool.name)) {
324528
- if (tool instanceof DiscoveredMCPTool) {
324529
- tool = tool.asFullyQualifiedTool();
324530
- } else {
324531
- debugLogger.warn(`Tool with name "${tool.name}" is already registered. Overwriting.`);
324532
- }
324514
+ debugLogger.warn(`Tool with name "${tool.name}" is already registered. Overwriting.`);
324533
324515
  }
324534
324516
  this.allKnownTools.set(tool.name, tool);
324535
324517
  }
@@ -324803,7 +324785,14 @@ Signal: Signal number or \`(none)\` if no signal was received.
324803
324785
  for (const name3 of toolNames) {
324804
324786
  const tool = this.getTool(name3);
324805
324787
  if (tool) {
324806
- declarations.push(tool.getSchema(modelId));
324788
+ let schema2 = tool.getSchema(modelId);
324789
+ if (tool instanceof DiscoveredMCPTool) {
324790
+ schema2 = {
324791
+ ...schema2,
324792
+ name: tool.getFullyQualifiedName()
324793
+ };
324794
+ }
324795
+ declarations.push(schema2);
324807
324796
  }
324808
324797
  }
324809
324798
  return declarations;
@@ -324863,16 +324852,6 @@ Signal: Signal number or \`(none)\` if no signal was received.
324863
324852
  debugLogger.debug(`Resolved legacy tool name "${name3}" to current name "${currentName}"`);
324864
324853
  }
324865
324854
  }
324866
- if (!tool && name3.includes("__")) {
324867
- for (const t3 of this.allKnownTools.values()) {
324868
- if (t3 instanceof DiscoveredMCPTool) {
324869
- if (t3.getFullyQualifiedName() === name3) {
324870
- tool = t3;
324871
- break;
324872
- }
324873
- }
324874
- }
324875
- }
324876
324855
  if (tool && this.isActiveTool(tool)) {
324877
324856
  return tool;
324878
324857
  }
@@ -325949,7 +325928,7 @@ var init_read_file = __esm({
325949
325928
  init_metrics2();
325950
325929
  init_telemetry_utils();
325951
325930
  init_loggers();
325952
- init_types6();
325931
+ init_types5();
325953
325932
  init_tool_names();
325954
325933
  init_fileDiscoveryService();
325955
325934
  init_coreTools();
@@ -374308,7 +374287,7 @@ var init_web_fetch = __esm({
374308
374287
  init_utils4();
374309
374288
  init_tool_error();
374310
374289
  init_errors();
374311
- init_types2();
374290
+ init_types();
374312
374291
  init_partUtils();
374313
374292
  init_fetch();
374314
374293
  init_textUtils();
@@ -374912,7 +374891,7 @@ var init_ask_user = __esm({
374912
374891
  "use strict";
374913
374892
  init_tools();
374914
374893
  init_tool_error();
374915
- init_types4();
374894
+ init_types3();
374916
374895
  init_tool_names();
374917
374896
  init_coreTools();
374918
374897
  init_resolver();
@@ -375109,7 +375088,7 @@ function getPlanModeExitMessage(newMode, isManual = false) {
375109
375088
  var init_approvalModeUtils = __esm({
375110
375089
  "packages/core/dist/src/utils/approvalModeUtils.js"() {
375111
375090
  "use strict";
375112
- init_types2();
375091
+ init_types();
375113
375092
  init_checks4();
375114
375093
  }
375115
375094
  });
@@ -375123,10 +375102,10 @@ var init_exit_plan_mode = __esm({
375123
375102
  init_tools();
375124
375103
  init_tool_names();
375125
375104
  init_planUtils();
375126
- init_types2();
375105
+ init_types();
375127
375106
  init_paths();
375128
375107
  init_loggers();
375129
- init_types6();
375108
+ init_types5();
375130
375109
  init_coreTools();
375131
375110
  init_resolver();
375132
375111
  init_approvalModeUtils();
@@ -375277,7 +375256,7 @@ var init_enter_plan_mode = __esm({
375277
375256
  "use strict";
375278
375257
  init_tools();
375279
375258
  init_tool_names();
375280
- init_types2();
375259
+ init_types();
375281
375260
  init_coreTools();
375282
375261
  init_resolver();
375283
375262
  EnterPlanModeTool = class _EnterPlanModeTool extends BaseDeclarativeTool {
@@ -375490,8 +375469,8 @@ var init_tool_utils = __esm({
375490
375469
  init_src2();
375491
375470
  init_shell_utils();
375492
375471
  import_fast_levenshtein2 = __toESM(require_levenshtein(), 1);
375472
+ init_types();
375493
375473
  init_types2();
375494
- init_types3();
375495
375474
  init_tool_names();
375496
375475
  }
375497
375476
  });
@@ -376096,7 +376075,7 @@ var init_tool_executor = __esm({
376096
376075
  init_coreToolHookTriggers();
376097
376076
  init_fileUtils();
376098
376077
  init_generateContentResponseUtilities();
376099
- init_types3();
376078
+ init_types2();
376100
376079
  init_constants();
376101
376080
  ToolExecutor = class {
376102
376081
  config;
@@ -376422,8 +376401,8 @@ var init_policy = __esm({
376422
376401
  "packages/core/dist/src/scheduler/policy.js"() {
376423
376402
  "use strict";
376424
376403
  init_tool_error();
376425
- init_types2();
376426
- init_types4();
376404
+ init_types();
376405
+ init_types3();
376427
376406
  init_tools();
376428
376407
  init_utils4();
376429
376408
  init_paths();
@@ -376438,15 +376417,15 @@ var init_coreToolScheduler = __esm({
376438
376417
  "packages/core/dist/src/core/coreToolScheduler.js"() {
376439
376418
  "use strict";
376440
376419
  init_tools();
376441
- init_types2();
376420
+ init_types();
376442
376421
  init_loggers();
376443
376422
  init_tool_error();
376444
- init_types6();
376423
+ init_types5();
376445
376424
  init_trace3();
376446
376425
  init_tool_modifier();
376447
376426
  init_tool_utils();
376448
- init_types4();
376449
376427
  init_types3();
376428
+ init_types2();
376450
376429
  init_tool_executor();
376451
376430
  init_mcp_tool();
376452
376431
  init_policy();
@@ -377642,7 +377621,7 @@ var init_geminiChat = __esm({
377642
377621
  init_tools();
377643
377622
  init_loggers();
377644
377623
  init_chatRecordingService();
377645
- init_types6();
377624
+ init_types5();
377646
377625
  init_handler();
377647
377626
  init_messageInspectors();
377648
377627
  init_geminiRequest();
@@ -378219,8 +378198,8 @@ var init_turn = __esm({
378219
378198
  init_geminiChat();
378220
378199
  init_thoughtUtils();
378221
378200
  init_generateContentResponseUtilities();
378222
- init_types6();
378223
- init_types3();
378201
+ init_types5();
378202
+ init_types2();
378224
378203
  (function(GeminiEventType2) {
378225
378204
  GeminiEventType2["Content"] = "content";
378226
378205
  GeminiEventType2["ToolCallRequest"] = "tool_call_request";
@@ -379840,7 +379819,7 @@ var init_promptProvider = __esm({
379840
379819
  "packages/core/dist/src/prompts/promptProvider.js"() {
379841
379820
  "use strict";
379842
379821
  init_paths();
379843
- init_types2();
379822
+ init_types();
379844
379823
  init_snippets();
379845
379824
  init_snippets_legacy();
379846
379825
  init_utils6();
@@ -380047,7 +380026,7 @@ var init_nextSpeakerChecker = __esm({
380047
380026
  "use strict";
380048
380027
  init_messageInspectors();
380049
380028
  init_debugLogger();
380050
- init_types6();
380029
+ init_types5();
380051
380030
  CHECK_PROMPT = `Analyze *only* the content and structure of your immediately preceding response (your last turn in the conversation history). Based *strictly* on that response, determine who should logically speak next: the 'user' or the 'model' (you).
380052
380031
  **Decision Rules (apply in order):**
380053
380032
  1. **Model Continues:** If your last response explicitly states an immediate next action *you* intend to take (e.g., "Next, I will...", "Now I'll process...", "Moving on to analyze...", indicates an intended tool call that didn't execute), OR if the response seems clearly incomplete (cut off mid-thought without a natural conclusion), then the **'model'** should speak next.
@@ -380101,7 +380080,7 @@ var init_loopDetectionService = __esm({
380101
380080
  "use strict";
380102
380081
  init_turn();
380103
380082
  init_loggers();
380104
- init_types6();
380083
+ init_types5();
380105
380084
  init_messageInspectors();
380106
380085
  init_debugLogger();
380107
380086
  TOOL_CALL_LOOP_THRESHOLD = 5;
@@ -380686,7 +380665,7 @@ var init_chatCompressionService = __esm({
380686
380665
  init_prompts();
380687
380666
  init_partUtils();
380688
380667
  init_loggers();
380689
- init_types6();
380668
+ init_types5();
380690
380669
  init_fileUtils();
380691
380670
  init_debugLogger();
380692
380671
  init_environmentContext();
@@ -380878,7 +380857,7 @@ var init_toolOutputMaskingService = __esm({
380878
380857
  init_fileUtils();
380879
380858
  init_loggers();
380880
380859
  init_tool_names();
380881
- init_types6();
380860
+ init_types5();
380882
380861
  DEFAULT_TOOL_PROTECTION_THRESHOLD = 5e4;
380883
380862
  DEFAULT_MIN_PRUNABLE_TOKENS_THRESHOLD = 3e4;
380884
380863
  DEFAULT_PROTECT_LATEST_TURN = true;
@@ -381122,7 +381101,7 @@ var init_client3 = __esm({
381122
381101
  init_chatCompressionService();
381123
381102
  init_ideContext();
381124
381103
  init_loggers();
381125
- init_types6();
381104
+ init_types5();
381126
381105
  init_uiTelemetry();
381127
381106
  init_handler();
381128
381107
  init_debugLogger();
@@ -387511,7 +387490,7 @@ var init_classifierStrategy = __esm({
387511
387490
  init_node();
387512
387491
  init_messageInspectors();
387513
387492
  init_debugLogger();
387514
- init_types6();
387493
+ init_types5();
387515
387494
  HISTORY_TURNS_FOR_CONTEXT2 = 4;
387516
387495
  HISTORY_SEARCH_WINDOW2 = 20;
387517
387496
  FLASH_MODEL2 = "flash";
@@ -387676,7 +387655,7 @@ var init_numericalClassifierStrategy = __esm({
387676
387655
  init_models();
387677
387656
  init_node();
387678
387657
  init_debugLogger();
387679
- init_types6();
387658
+ init_types5();
387680
387659
  HISTORY_TURNS_FOR_CONTEXT3 = 8;
387681
387660
  FLASH_MODEL3 = "flash";
387682
387661
  PRO_MODEL3 = "pro";
@@ -387946,7 +387925,7 @@ var init_approvalModeStrategy = __esm({
387946
387925
  "packages/core/dist/src/routing/strategies/approvalModeStrategy.js"() {
387947
387926
  "use strict";
387948
387927
  init_models();
387949
- init_types2();
387928
+ init_types();
387950
387929
  ApprovalModeStrategy = class {
387951
387930
  name = "approval-mode";
387952
387931
  async route(context2, config3, _baseLlmClient) {
@@ -388005,7 +387984,7 @@ var init_modelRouterService = __esm({
388005
387984
  init_overrideStrategy();
388006
387985
  init_approvalModeStrategy();
388007
387986
  init_loggers();
388008
- init_types6();
387987
+ init_types5();
388009
387988
  init_debugLogger();
388010
387989
  ModelRouterService = class {
388011
387990
  config;
@@ -389728,8 +389707,8 @@ var MessageBus;
389728
389707
  var init_message_bus = __esm({
389729
389708
  "packages/core/dist/src/confirmation-bus/message-bus.js"() {
389730
389709
  "use strict";
389731
- init_types2();
389732
- init_types4();
389710
+ init_types();
389711
+ init_types3();
389733
389712
  init_safeJsonStringify();
389734
389713
  init_debugLogger();
389735
389714
  MessageBus = class extends EventEmitter10 {
@@ -389989,7 +389968,7 @@ var init_policy_engine = __esm({
389989
389968
  "packages/core/dist/src/policy/policy-engine.js"() {
389990
389969
  "use strict";
389991
389970
  init_node();
389992
- init_types2();
389971
+ init_types();
389993
389972
  init_stable_stringify();
389994
389973
  init_debugLogger();
389995
389974
  init_protocol2();
@@ -391374,7 +391353,7 @@ var init_hookEventHandler = __esm({
391374
391353
  init_types16();
391375
391354
  init_hookTranslator();
391376
391355
  init_loggers();
391377
- init_types6();
391356
+ init_types5();
391378
391357
  init_debugLogger();
391379
391358
  init_events();
391380
391359
  HookEventHandler = class {
@@ -394987,7 +394966,7 @@ var init_agentLoader = __esm({
394987
394966
  name: nameSchema,
394988
394967
  description: external_exports.string().min(1),
394989
394968
  display_name: external_exports.string().optional(),
394990
- tools: external_exports.array(external_exports.string().refine((val) => isValidToolName(val), {
394969
+ tools: external_exports.array(external_exports.string().refine((val) => isValidToolName(val, { allowWildcards: true }), {
394991
394970
  message: "Invalid tool name"
394992
394971
  })).optional(),
394993
394972
  model: external_exports.string().optional(),
@@ -400137,7 +400116,7 @@ var init_registry = __esm({
400137
400116
  init_debugLogger();
400138
400117
  init_models();
400139
400118
  init_modelConfigService();
400140
- init_types2();
400119
+ init_types();
400141
400120
  init_a2a_errors();
400142
400121
  AgentRegistry = class {
400143
400122
  config;
@@ -400603,8 +400582,8 @@ var SchedulerStateManager;
400603
400582
  var init_state_manager = __esm({
400604
400583
  "packages/core/dist/src/scheduler/state-manager.js"() {
400605
400584
  "use strict";
400585
+ init_types2();
400606
400586
  init_types3();
400607
- init_types4();
400608
400587
  init_tool_utils();
400609
400588
  SchedulerStateManager = class {
400610
400589
  messageBus;
@@ -401129,9 +401108,9 @@ async function waitForConfirmation(messageBus, correlationId, signal, ideConfirm
401129
401108
  var init_confirmation = __esm({
401130
401109
  "packages/core/dist/src/scheduler/confirmation.js"() {
401131
401110
  "use strict";
401132
- init_types4();
401133
- init_tools();
401134
401111
  init_types3();
401112
+ init_tools();
401113
+ init_types2();
401135
401114
  init_editor();
401136
401115
  init_debugLogger();
401137
401116
  init_events();
@@ -401148,15 +401127,15 @@ var init_scheduler2 = __esm({
401148
401127
  init_policy();
401149
401128
  init_tool_executor();
401150
401129
  init_tool_modifier();
401151
- init_types3();
401152
- init_tool_error();
401153
401130
  init_types2();
401131
+ init_tool_error();
401132
+ init_types();
401154
401133
  init_tools();
401155
401134
  init_tool_utils();
401156
401135
  init_trace3();
401157
401136
  init_loggers();
401158
- init_types6();
401159
- init_types4();
401137
+ init_types5();
401138
+ init_types3();
401160
401139
  init_toolCallContext();
401161
401140
  init_events();
401162
401141
  init_constants();
@@ -401740,15 +401719,16 @@ var init_local_executor = __esm({
401740
401719
  init_geminiChat();
401741
401720
  init_node();
401742
401721
  init_tool_registry();
401722
+ init_tools();
401743
401723
  init_mcp_tool();
401744
401724
  init_turn();
401725
+ init_types2();
401745
401726
  init_types3();
401746
- init_types4();
401747
401727
  init_chatCompressionService();
401748
401728
  init_environmentContext();
401749
401729
  init_promptIdContext();
401750
401730
  init_loggers();
401751
- init_types6();
401731
+ init_types5();
401752
401732
  init_types18();
401753
401733
  init_errors();
401754
401734
  init_utils8();
@@ -401799,18 +401779,40 @@ var init_local_executor = __esm({
401799
401779
  const agentToolRegistry = new ToolRegistry(runtimeContext, subagentMessageBus);
401800
401780
  const parentToolRegistry = runtimeContext.getToolRegistry();
401801
401781
  const allAgentNames = new Set(runtimeContext.getAgentRegistry().getAllAgentNames());
401782
+ const registerToolInstance = (tool) => {
401783
+ if (allAgentNames.has(tool.name)) {
401784
+ debugLogger.warn(`[LocalAgentExecutor] Skipping subagent tool '${tool.name}' for agent '${definition.name}' to prevent recursion.`);
401785
+ return;
401786
+ }
401787
+ agentToolRegistry.registerTool(tool);
401788
+ };
401802
401789
  const registerToolByName = (toolName) => {
401803
- if (allAgentNames.has(toolName)) {
401804
- debugLogger.warn(`[LocalAgentExecutor] Skipping subagent tool '${toolName}' for agent '${definition.name}' to prevent recursion.`);
401790
+ if (toolName === "*") {
401791
+ for (const tool2 of parentToolRegistry.getAllTools()) {
401792
+ registerToolInstance(tool2);
401793
+ }
401805
401794
  return;
401806
401795
  }
401796
+ if (isMcpToolName(toolName)) {
401797
+ if (toolName === `${MCP_TOOL_PREFIX}*`) {
401798
+ for (const tool2 of parentToolRegistry.getAllTools()) {
401799
+ if (tool2 instanceof DiscoveredMCPTool) {
401800
+ registerToolInstance(tool2);
401801
+ }
401802
+ }
401803
+ return;
401804
+ }
401805
+ const parsed = parseMcpToolName(toolName);
401806
+ if (parsed.serverName && parsed.toolName === "*") {
401807
+ for (const tool2 of parentToolRegistry.getToolsByServer(parsed.serverName)) {
401808
+ registerToolInstance(tool2);
401809
+ }
401810
+ return;
401811
+ }
401812
+ }
401807
401813
  const tool = parentToolRegistry.getTool(toolName);
401808
401814
  if (tool) {
401809
- if (tool instanceof DiscoveredMCPTool) {
401810
- agentToolRegistry.registerTool(tool.asFullyQualifiedTool());
401811
- } else {
401812
- agentToolRegistry.registerTool(tool);
401813
- }
401815
+ registerToolInstance(tool);
401814
401816
  }
401815
401817
  };
401816
401818
  if (definition.toolConfig) {
@@ -402473,17 +402475,12 @@ var init_local_executor = __esm({
402473
402475
  const toolsList = [];
402474
402476
  const { toolConfig, outputConfig } = this.definition;
402475
402477
  if (toolConfig) {
402476
- const toolNamesToLoad = [];
402477
402478
  for (const toolRef of toolConfig.tools) {
402478
- if (typeof toolRef === "string") {
402479
- toolNamesToLoad.push(toolRef);
402480
- } else if (typeof toolRef === "object" && "schema" in toolRef) {
402481
- toolsList.push(toolRef.schema);
402482
- } else {
402479
+ if (typeof toolRef === "object" && !("schema" in toolRef)) {
402483
402480
  toolsList.push(toolRef);
402484
402481
  }
402485
402482
  }
402486
- toolsList.push(...this.toolRegistry.getFunctionDeclarationsFiltered(toolNamesToLoad));
402483
+ toolsList.push(...this.toolRegistry.getFunctionDeclarations());
402487
402484
  }
402488
402485
  const completeTool = {
402489
402486
  name: TASK_COMPLETE_TOOL_NAME,
@@ -421419,7 +421416,7 @@ var import_fast_levenshtein3, import_toml, MAX_TYPO_DISTANCE, PolicyRuleSchema,
421419
421416
  var init_toml_loader = __esm({
421420
421417
  "packages/core/dist/src/policy/toml-loader.js"() {
421421
421418
  "use strict";
421422
- init_types2();
421419
+ init_types();
421423
421420
  init_utils4();
421424
421421
  init_tool_names();
421425
421422
  init_tool_utils();
@@ -421500,11 +421497,11 @@ var init_config3 = __esm({
421500
421497
  "packages/core/dist/src/policy/config.js"() {
421501
421498
  "use strict";
421502
421499
  init_storage();
421503
- init_types2();
421500
+ init_types();
421504
421501
  init_toml_loader();
421505
421502
  init_utils4();
421506
421503
  import_toml2 = __toESM(require_toml(), 1);
421507
- init_types4();
421504
+ init_types3();
421508
421505
  init_message_bus();
421509
421506
  init_events();
421510
421507
  init_debugLogger();
@@ -422275,7 +422272,7 @@ var init_registry2 = __esm({
422275
422272
  "packages/core/dist/src/safety/registry.js"() {
422276
422273
  "use strict";
422277
422274
  init_built_in();
422278
- init_types2();
422275
+ init_types();
422279
422276
  init_conseca();
422280
422277
  CheckerRegistry = class _CheckerRegistry {
422281
422278
  checkersPath;
@@ -425577,7 +425574,7 @@ var init_config4 = __esm({
425577
425574
  init_fileSystemService();
425578
425575
  init_trackerTools2();
425579
425576
  init_loggers();
425580
- init_types6();
425577
+ init_types5();
425581
425578
  init_modelAvailabilityService();
425582
425579
  init_modelRouterService();
425583
425580
  init_types17();
@@ -425590,7 +425587,7 @@ var init_config4 = __esm({
425590
425587
  init_ignorePatterns();
425591
425588
  init_message_bus();
425592
425589
  init_policy_engine();
425593
- init_types2();
425590
+ init_types();
425594
425591
  init_hooks();
425595
425592
  init_codeAssist();
425596
425593
  init_experiments();
@@ -430322,7 +430319,7 @@ var init_sessionSummaryService = __esm({
430322
430319
  init_geminiRequest();
430323
430320
  init_debugLogger();
430324
430321
  init_partUtils();
430325
- init_types6();
430322
+ init_types5();
430326
430323
  }
430327
430324
  });
430328
430325
 
@@ -430368,7 +430365,7 @@ var init_read_many_files = __esm({
430368
430365
  init_metrics2();
430369
430366
  init_telemetry_utils();
430370
430367
  init_loggers();
430371
- init_types6();
430368
+ init_types5();
430372
430369
  init_tool_error();
430373
430370
  init_tool_names();
430374
430371
  init_coreTools();
@@ -430411,13 +430408,13 @@ var init_src2 = __esm({
430411
430408
  init_types17();
430412
430409
  init_json_formatter();
430413
430410
  init_stream_json_formatter();
430414
- init_types2();
430411
+ init_types();
430415
430412
  init_policy_engine();
430416
430413
  init_toml_loader();
430417
430414
  init_config3();
430418
430415
  init_integrity();
430419
430416
  init_billing2();
430420
- init_types4();
430417
+ init_types3();
430421
430418
  init_message_bus();
430422
430419
  init_extensions();
430423
430420
  init_restore();
@@ -430436,7 +430433,7 @@ var init_src2 = __esm({
430436
430433
  init_geminiRequest();
430437
430434
  init_coreToolScheduler();
430438
430435
  init_scheduler2();
430439
- init_types3();
430436
+ init_types2();
430440
430437
  init_tool_executor();
430441
430438
  init_recordingContentGenerator();
430442
430439
  init_types20();
@@ -430475,7 +430472,7 @@ var init_src2 = __esm({
430475
430472
  init_fileDiffUtils();
430476
430473
  init_retry();
430477
430474
  init_shell_utils();
430478
- init_types2();
430475
+ init_types();
430479
430476
  init_tool_utils();
430480
430477
  init_terminalSerializer();
430481
430478
  init_systemEncoding();
@@ -430600,7 +430597,7 @@ var init_dist7 = __esm({
430600
430597
  init_config4();
430601
430598
  init_detect_ide();
430602
430599
  init_loggers();
430603
- init_types6();
430600
+ init_types5();
430604
430601
  init_config5();
430605
430602
  init_pathReader();
430606
430603
  init_clearcut_logger();