@google/gemini-cli-a2a-server 0.63.0-nightly.20260928.g2fe7c2d3f → 0.63.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.
@@ -68712,7 +68712,7 @@ function sanitizeFilenamePart(part) {
68712
68712
  return part.replace(/[^a-zA-Z0-9_-]/g, "_");
68713
68713
  }
68714
68714
  function formatTruncatedToolOutput(contentStr, outputFile, maxChars) {
68715
- if (contentStr.length <= maxChars)
68715
+ if (maxChars <= 0 || contentStr.length <= maxChars)
68716
68716
  return contentStr;
68717
68717
  const headChars = Math.floor(maxChars * 0.2);
68718
68718
  const tailChars = maxChars - headChars;
@@ -139233,10 +139233,23 @@ var init_keychainService = __esm({
139233
139233
  getKeychain() {
139234
139234
  return this.initializationPromise ??= this.initializeKeychain();
139235
139235
  }
139236
+ isWsl() {
139237
+ if (os17.platform() !== "linux") {
139238
+ return false;
139239
+ }
139240
+ return !!(process.env["WSL_DISTRO_NAME"] || process.env["WSLENV"] || process.env["WSL_INTEROP"]);
139241
+ }
139236
139242
  // High-level orchestration of the loading and testing cycle.
139237
139243
  async initializeKeychain() {
139238
139244
  const forceFileStorage = process.env[FORCE_FILE_STORAGE_ENV_VAR] === "true";
139239
- const nativeKeychain = forceFileStorage ? null : await this.getNativeKeychain();
139245
+ let nativeKeychain = null;
139246
+ if (!forceFileStorage) {
139247
+ if (this.isWsl()) {
139248
+ debugLogger.debug("WSL environment detected; bypassing native keychain to prevent libsecret lockups.");
139249
+ } else {
139250
+ nativeKeychain = await this.getNativeKeychain();
139251
+ }
139252
+ }
139240
139253
  coreEvents.emitTelemetryKeychainAvailability(new KeychainAvailabilityEvent(nativeKeychain !== null));
139241
139254
  if (nativeKeychain) {
139242
139255
  return nativeKeychain;
@@ -140211,6 +140224,24 @@ function getAvailablePort() {
140211
140224
  }
140212
140225
  });
140213
140226
  }
140227
+ async function readOAuthCredsWithRetry(filePath, maxRetries = 3) {
140228
+ let attempt = 0;
140229
+ while (attempt < maxRetries) {
140230
+ try {
140231
+ return await fs32.readFile(filePath, "utf-8");
140232
+ } catch (err2) {
140233
+ if (err2 && typeof err2 === "object" && "code" in err2 && err2.code === "ENOENT") {
140234
+ throw err2;
140235
+ }
140236
+ attempt++;
140237
+ if (attempt >= maxRetries) {
140238
+ throw err2;
140239
+ }
140240
+ await new Promise((resolve23) => setTimeout(resolve23, 25 * attempt));
140241
+ }
140242
+ }
140243
+ return "";
140244
+ }
140214
140245
  async function fetchCachedCredentialsList() {
140215
140246
  const credentialsList = [];
140216
140247
  const useEncryptedStorage = getUseEncryptedStorageFlag();
@@ -140230,7 +140261,7 @@ async function fetchCachedCredentialsList() {
140230
140261
  ].filter((p2) => !!p2);
140231
140262
  for (const keyFile of pathsToTry) {
140232
140263
  try {
140233
- const keyFileString = await fs32.readFile(keyFile, "utf-8");
140264
+ const keyFileString = await readOAuthCredsWithRetry(keyFile);
140234
140265
  const parsed = JSON.parse(keyFileString);
140235
140266
  const isOAuthCreds = (val) => typeof val === "object" && val !== null;
140236
140267
  if (isOAuthCreds(parsed)) {
@@ -140267,10 +140298,11 @@ async function fetchAndCacheUserInfo(client) {
140267
140298
  }
140268
140299
  async function cacheCredentials(credentials3) {
140269
140300
  const filePath = Storage2.getOAuthCredsPath();
140270
- await fs32.mkdir(path27.dirname(filePath), { recursive: true });
140301
+ const dirPath = path27.dirname(filePath);
140302
+ await fs32.mkdir(dirPath, { recursive: true });
140271
140303
  let existing = {};
140272
140304
  try {
140273
- const existingContent = await fs32.readFile(filePath, "utf-8");
140305
+ const existingContent = await readOAuthCredsWithRetry(filePath);
140274
140306
  const parsed = JSON.parse(existingContent);
140275
140307
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
140276
140308
  existing = parsed;
@@ -140287,13 +140319,27 @@ async function cacheCredentials(credentials3) {
140287
140319
  ...cleanCredentials
140288
140320
  };
140289
140321
  const credString = JSON.stringify(finalCredentials, null, 2);
140290
- await fs32.writeFile(filePath, credString, { mode: 384 });
140322
+ const tempPath = path27.join(dirPath, `.${path27.basename(filePath)}.${process.pid}.${Date.now()}.${tempCounter++}.tmp`);
140323
+ try {
140324
+ await fs32.writeFile(tempPath, credString, { mode: 384 });
140325
+ try {
140326
+ await fs32.chmod(tempPath, 384);
140327
+ } catch {
140328
+ }
140329
+ await fs32.rename(tempPath, filePath);
140330
+ } catch {
140331
+ try {
140332
+ await fs32.rm(tempPath, { force: true });
140333
+ } catch {
140334
+ }
140335
+ await fs32.writeFile(filePath, credString, { mode: 384 });
140336
+ }
140291
140337
  try {
140292
140338
  await fs32.chmod(filePath, 384);
140293
140339
  } catch {
140294
140340
  }
140295
140341
  }
140296
- var import_google_auth_library8, authEvents, userAccountManager2, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, OAUTH_SCOPE, HTTP_REDIRECT, SIGN_IN_SUCCESS_URL, SIGN_IN_FAILURE_URL, oauthClientPromises;
140342
+ var import_google_auth_library8, authEvents, userAccountManager2, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, OAUTH_SCOPE, HTTP_REDIRECT, SIGN_IN_SUCCESS_URL, SIGN_IN_FAILURE_URL, oauthClientPromises, tempCounter;
140297
140343
  var init_oauth2 = __esm({
140298
140344
  "packages/core/dist/src/code_assist/oauth2.js"() {
140299
140345
  "use strict";
@@ -140323,6 +140369,7 @@ var init_oauth2 = __esm({
140323
140369
  SIGN_IN_SUCCESS_URL = "https://developers.google.com/gemini-code-assist/auth_success_gemini";
140324
140370
  SIGN_IN_FAILURE_URL = "https://developers.google.com/gemini-code-assist/auth_failure_gemini";
140325
140371
  oauthClientPromises = /* @__PURE__ */ new Map();
140372
+ tempCounter = 0;
140326
140373
  }
140327
140374
  });
140328
140375
 
@@ -221293,8 +221340,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
221293
221340
  var init_git_commit = __esm({
221294
221341
  "packages/core/dist/src/generated/git-commit.js"() {
221295
221342
  "use strict";
221296
- GIT_COMMIT_INFO = "2fe7c2d3f";
221297
- CLI_VERSION = "0.63.0-nightly.20260928.g2fe7c2d3f";
221343
+ GIT_COMMIT_INFO = "d75234cae";
221344
+ CLI_VERSION = "0.63.0-preview.0";
221298
221345
  }
221299
221346
  });
221300
221347
 
@@ -337030,7 +337077,7 @@ function getVersion() {
337030
337077
  }
337031
337078
  versionPromise = (async () => {
337032
337079
  const pkgJson = await getPackageJson(__dirname4);
337033
- return "0.63.0-nightly.20260928.g2fe7c2d3f";
337080
+ return "0.63.0-preview.0";
337034
337081
  })();
337035
337082
  return versionPromise;
337036
337083
  }
@@ -369422,6 +369469,15 @@ You are operating with a persistent file-based task tracking system located at \
369422
369469
  function renderPlanningWorkflow(options) {
369423
369470
  if (!options)
369424
369471
  return "";
369472
+ const consultSection = options.interactive ? `### 2. Consult
369473
+ The depth of your consultation should be proportional to the task's complexity. Before proceeding to Step 3 (Draft), you MUST discuss your findings and proposed strategy with the user to reach an informal agreement.
369474
+ - **Simple Tasks:** Briefly describe your proposed strategy in the chat to ensure alignment, then **STOP and wait** for the user to confirm agreement before drafting the plan.
369475
+ - **Standard Tasks:** If multiple viable approaches exist, present a concise summary (including pros/cons and your recommendation) via ${formatToolName(ASK_USER_TOOL_NAME)} and wait for a decision.
369476
+ - **Complex Tasks:** You MUST present at least two viable approaches with detailed trade-offs via ${formatToolName(ASK_USER_TOOL_NAME)} and obtain approval before drafting the plan.
369477
+
369478
+ **CRITICAL:** You MUST NOT proceed to Step 3 (Draft) or Step 4 (Review & Approval) in the same turn as your initial strategy proposal. You MUST wait for user feedback and reach a clear agreement before drafting or submitting the plan.` : `### 2. Determine Strategy
369479
+ Synthesize your exploration findings to select the best approach and implementation strategy. Because you are running non-interactively, proceed directly to Step 3 (Draft) autonomously without halting or waiting for user confirmation.`;
369480
+ const reviewAndApprovalSection = options.interactive ? `ONLY use the built-in ${formatToolName(EXIT_PLAN_MODE_TOOL_NAME)} tool to present the plan for formal approval AFTER you have reached an informal agreement with the user in the chat regarding the proposed strategy. **CRITICAL: NEVER attempt to call this tool via ${formatToolName(SHELL_TOOL_NAME)}.** When called, this tool will present the plan and formally request approval.` : `Use the built-in ${formatToolName(EXIT_PLAN_MODE_TOOL_NAME)} tool to finalize the plan. **CRITICAL: NEVER attempt to call this tool via ${formatToolName(SHELL_TOOL_NAME)}.** When called, this tool will present the plan and begin implementation.`;
369425
369481
  return `
369426
369482
  # Active Approval Mode: Plan
369427
369483
 
@@ -369436,7 +369492,7 @@ ${options.planModeToolsList}
369436
369492
  ## Rules
369437
369493
  1. **Read-Only:** You cannot modify source code. You may ONLY use read-only tools to explore, and you can only write to \`${options.plansDir}/\`. If the user asks you to modify source code directly, you MUST explain that you are in Plan Mode and must first create a plan and get approval.
369438
369494
  2. **Write Constraint:** ${formatToolName(WRITE_FILE_TOOL_NAME)} and ${formatToolName(EDIT_TOOL_NAME)} may ONLY be used to write .md plan files to \`${options.plansDir}/\`. They cannot modify source code.
369439
- 3. **Efficiency:** Autonomously combine discovery and drafting phases to minimize conversational turns. If the request is ambiguous, use ${formatToolName(ASK_USER_TOOL_NAME)} to clarify. Use multi-select to offer flexibility and include detailed descriptions for each option to help the user understand the implications of their choice.
369495
+ 3. **Efficiency:** Autonomously combine discovery and drafting phases to minimize conversational turns.${options.interactive ? ` If the request is ambiguous, use ${formatToolName(ASK_USER_TOOL_NAME)} to clarify. Use multi-select to offer flexibility and include detailed descriptions for each option to help the user understand the implications of their choice.` : ""}
369440
369496
  4. **Inquiries and Directives:** Distinguish between Inquiries and Directives to minimize unnecessary planning.
369441
369497
  - **Inquiries:** If the request is an **Inquiry** (e.g., "How does X work?"), answer directly. DO NOT create a plan.
369442
369498
  - **Directives:** If the request is a **Directive** (e.g., "Fix bug Y"), follow the workflow below.
@@ -369450,13 +369506,7 @@ Plan Mode uses an adaptive planning workflow where the research depth, plan stru
369450
369506
  ### 1. Explore & Analyze
369451
369507
  Analyze requirements and use search/read tools to explore the codebase. Systematically map affected modules, trace data flow, and identify dependencies.
369452
369508
 
369453
- ### 2. Consult
369454
- The depth of your consultation should be proportional to the task's complexity. Before proceeding to Step 3 (Draft), you MUST discuss your findings and proposed strategy with the user to reach an informal agreement.
369455
- - **Simple Tasks:** Briefly describe your proposed strategy in the chat to ensure alignment, then **STOP and wait** for the user to confirm agreement before drafting the plan.
369456
- - **Standard Tasks:** If multiple viable approaches exist, present a concise summary (including pros/cons and your recommendation) via ${formatToolName(ASK_USER_TOOL_NAME)} and wait for a decision.
369457
- - **Complex Tasks:** You MUST present at least two viable approaches with detailed trade-offs via ${formatToolName(ASK_USER_TOOL_NAME)} and obtain approval before drafting the plan.
369458
-
369459
- **CRITICAL:** You MUST NOT proceed to Step 3 (Draft) or Step 4 (Review & Approval) in the same turn as your initial strategy proposal. You MUST wait for user feedback and reach a clear agreement before drafting or submitting the plan.
369509
+ ${consultSection}
369460
369510
 
369461
369511
  ### 3. Draft
369462
369512
  Write the implementation plan to \`${options.plansDir}/\`. The plan's structure adapts to the task:
@@ -369465,7 +369515,7 @@ Write the implementation plan to \`${options.plansDir}/\`. The plan's structure
369465
369515
  - **Complex Tasks:** Include **Background & Motivation**, **Scope & Impact**, **Proposed Solution**, **Alternatives Considered**, a phased **Implementation Plan**, **Verification**, and **Migration & Rollback** strategies.${options.interactive ? "\n- **Alignment Check:** After drafting the plan, you MUST present it to the user in the chat (adhering to Rule 7 for presenting plans) to ensure alignment on the specific details. Ask for feedback or confirmation, and proceed to Step 4 (Review & Approval) once the user agrees with the detailed plan." : ""}
369466
369516
 
369467
369517
  ### 4. Review & Approval
369468
- ONLY use the built-in ${formatToolName(EXIT_PLAN_MODE_TOOL_NAME)} tool to present the plan for formal approval AFTER you have reached an informal agreement with the user in the chat regarding the proposed strategy. **CRITICAL: NEVER attempt to call this tool via ${formatToolName(SHELL_TOOL_NAME)}.** When called, this tool will present the plan and ${options.interactive ? "formally request approval." : "begin implementation."}
369518
+ ${reviewAndApprovalSection}
369469
369519
 
369470
369520
  ${renderApprovedPlanSection(options.approvedPlanPath)}`.trim();
369471
369521
  }