@google/gemini-cli-a2a-server 0.16.0-preview.4 → 0.16.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 +352 -156
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/a2a-server.mjs
CHANGED
|
@@ -295944,8 +295944,8 @@ var Float64Vector = import_vector.default.Float64Vector;
|
|
|
295944
295944
|
var PointerVector = import_vector.default.PointerVector;
|
|
295945
295945
|
|
|
295946
295946
|
// packages/core/dist/src/generated/git-commit.js
|
|
295947
|
-
var GIT_COMMIT_INFO = "
|
|
295948
|
-
var CLI_VERSION = "0.16.0
|
|
295947
|
+
var GIT_COMMIT_INFO = "56f9e597c";
|
|
295948
|
+
var CLI_VERSION = "0.16.0";
|
|
295949
295949
|
|
|
295950
295950
|
// packages/core/dist/src/ide/detect-ide.js
|
|
295951
295951
|
var IDE_DEFINITIONS = {
|
|
@@ -295957,12 +295957,16 @@ var IDE_DEFINITIONS = {
|
|
|
295957
295957
|
firebasestudio: { name: "firebasestudio", displayName: "Firebase Studio" },
|
|
295958
295958
|
trae: { name: "trae", displayName: "Trae" },
|
|
295959
295959
|
vscode: { name: "vscode", displayName: "VS Code" },
|
|
295960
|
-
vscodefork: { name: "vscodefork", displayName: "IDE" }
|
|
295960
|
+
vscodefork: { name: "vscodefork", displayName: "IDE" },
|
|
295961
|
+
antigravity: { name: "antigravity", displayName: "Antigravity" }
|
|
295961
295962
|
};
|
|
295962
295963
|
function isCloudShell() {
|
|
295963
295964
|
return !!(process.env["EDITOR_IN_CLOUD_SHELL"] || process.env["CLOUD_SHELL"]);
|
|
295964
295965
|
}
|
|
295965
295966
|
function detectIdeFromEnv() {
|
|
295967
|
+
if (process.env["ANTIGRAVITY_CLI_ALIAS"]) {
|
|
295968
|
+
return IDE_DEFINITIONS.antigravity;
|
|
295969
|
+
}
|
|
295966
295970
|
if (process.env["__COG_BASHRC_SOURCED"]) {
|
|
295967
295971
|
return IDE_DEFINITIONS.devin;
|
|
295968
295972
|
}
|
|
@@ -298790,7 +298794,7 @@ async function createContentGenerator(config2, gcConfig, sessionId2) {
|
|
|
298790
298794
|
if (gcConfig.fakeResponses) {
|
|
298791
298795
|
return FakeContentGenerator.fromFile(gcConfig.fakeResponses);
|
|
298792
298796
|
}
|
|
298793
|
-
const version3 = "0.16.0
|
|
298797
|
+
const version3 = "0.16.0";
|
|
298794
298798
|
const userAgent = `GeminiCLI/${version3} (${process.platform}; ${process.arch})`;
|
|
298795
298799
|
const baseHeaders = {
|
|
298796
298800
|
"User-Agent": userAgent
|
|
@@ -328902,9 +328906,10 @@ var IdeClient = class _IdeClient {
|
|
|
328902
328906
|
removeTrustChangeListener(listener) {
|
|
328903
328907
|
this.trustChangeListeners.delete(listener);
|
|
328904
328908
|
}
|
|
328905
|
-
async connect() {
|
|
328909
|
+
async connect(options2 = {}) {
|
|
328910
|
+
const logError2 = options2.logToConsole ?? true;
|
|
328906
328911
|
if (!this.currentIde) {
|
|
328907
|
-
this.setState(IDEConnectionStatus.Disconnected, `IDE integration is not supported in your current environment. To use this feature, run Gemini CLI in one of these supported IDEs: VS Code or VS Code forks
|
|
328912
|
+
this.setState(IDEConnectionStatus.Disconnected, `IDE integration is not supported in your current environment. To use this feature, run Gemini CLI in one of these supported IDEs: Antigravity, VS Code, or VS Code forks.`, false);
|
|
328908
328913
|
return;
|
|
328909
328914
|
}
|
|
328910
328915
|
this.setState(IDEConnectionStatus.Connecting);
|
|
@@ -328915,7 +328920,7 @@ var IdeClient = class _IdeClient {
|
|
|
328915
328920
|
const workspacePath = this.connectionConfig?.workspacePath ?? process.env["GEMINI_CLI_IDE_WORKSPACE_PATH"];
|
|
328916
328921
|
const { isValid: isValid2, error } = _IdeClient.validateWorkspacePath(workspacePath, process.cwd());
|
|
328917
328922
|
if (!isValid2) {
|
|
328918
|
-
this.setState(IDEConnectionStatus.Disconnected, error,
|
|
328923
|
+
this.setState(IDEConnectionStatus.Disconnected, error, logError2);
|
|
328919
328924
|
return;
|
|
328920
328925
|
}
|
|
328921
328926
|
if (this.connectionConfig) {
|
|
@@ -328946,7 +328951,7 @@ var IdeClient = class _IdeClient {
|
|
|
328946
328951
|
return;
|
|
328947
328952
|
}
|
|
328948
328953
|
}
|
|
328949
|
-
this.setState(IDEConnectionStatus.Disconnected, `Failed to connect to IDE companion extension in ${this.currentIde.displayName}. Please ensure the extension is running. To install the extension, run /ide install.`,
|
|
328954
|
+
this.setState(IDEConnectionStatus.Disconnected, `Failed to connect to IDE companion extension in ${this.currentIde.displayName}. Please ensure the extension is running. To install the extension, run /ide install.`, logError2);
|
|
328950
328955
|
}
|
|
328951
328956
|
/**
|
|
328952
328957
|
* Opens a diff view in the IDE, allowing the user to review and accept or
|
|
@@ -329817,7 +329822,8 @@ function isValidEditorType(editor) {
|
|
|
329817
329822
|
"vim",
|
|
329818
329823
|
"neovim",
|
|
329819
329824
|
"zed",
|
|
329820
|
-
"emacs"
|
|
329825
|
+
"emacs",
|
|
329826
|
+
"antigravity"
|
|
329821
329827
|
].includes(editor);
|
|
329822
329828
|
}
|
|
329823
329829
|
function commandExists(cmd) {
|
|
@@ -329836,7 +329842,8 @@ var editorCommands = {
|
|
|
329836
329842
|
vim: { win32: ["vim"], default: ["vim"] },
|
|
329837
329843
|
neovim: { win32: ["nvim"], default: ["nvim"] },
|
|
329838
329844
|
zed: { win32: ["zed"], default: ["zed", "zeditor"] },
|
|
329839
|
-
emacs: { win32: ["emacs.exe"], default: ["emacs"] }
|
|
329845
|
+
emacs: { win32: ["emacs.exe"], default: ["emacs"] },
|
|
329846
|
+
antigravity: { win32: ["agy.cmd"], default: ["agy"] }
|
|
329840
329847
|
};
|
|
329841
329848
|
function getDiffCommand(oldPath, newPath, editor) {
|
|
329842
329849
|
if (!isValidEditorType(editor)) {
|
|
@@ -329851,6 +329858,7 @@ function getDiffCommand(oldPath, newPath, editor) {
|
|
|
329851
329858
|
case "windsurf":
|
|
329852
329859
|
case "cursor":
|
|
329853
329860
|
case "zed":
|
|
329861
|
+
case "antigravity":
|
|
329854
329862
|
return { command, args: ["--wait", "--diff", oldPath, newPath] };
|
|
329855
329863
|
case "vim":
|
|
329856
329864
|
case "neovim":
|
|
@@ -330246,13 +330254,39 @@ function fromApiError(errorObj) {
|
|
|
330246
330254
|
return outerError;
|
|
330247
330255
|
}
|
|
330248
330256
|
|
|
330257
|
+
// packages/core/dist/src/utils/httpErrors.js
|
|
330258
|
+
function getErrorStatus(error) {
|
|
330259
|
+
if (typeof error === "object" && error !== null) {
|
|
330260
|
+
if ("status" in error && typeof error.status === "number") {
|
|
330261
|
+
return error.status;
|
|
330262
|
+
}
|
|
330263
|
+
if ("response" in error && typeof error.response === "object" && error.response !== null) {
|
|
330264
|
+
const response = error.response;
|
|
330265
|
+
if ("status" in response && typeof response.status === "number") {
|
|
330266
|
+
return response.status;
|
|
330267
|
+
}
|
|
330268
|
+
}
|
|
330269
|
+
}
|
|
330270
|
+
return void 0;
|
|
330271
|
+
}
|
|
330272
|
+
var ModelNotFoundError = class extends Error {
|
|
330273
|
+
code;
|
|
330274
|
+
constructor(message, code2) {
|
|
330275
|
+
super(message);
|
|
330276
|
+
this.name = "ModelNotFoundError";
|
|
330277
|
+
this.code = code2 ? code2 : 404;
|
|
330278
|
+
}
|
|
330279
|
+
};
|
|
330280
|
+
|
|
330249
330281
|
// packages/core/dist/src/utils/googleQuotaErrors.js
|
|
330250
330282
|
var TerminalQuotaError = class extends Error {
|
|
330251
330283
|
cause;
|
|
330252
|
-
|
|
330284
|
+
retryDelayMs;
|
|
330285
|
+
constructor(message, cause, retryDelayMs) {
|
|
330253
330286
|
super(message);
|
|
330254
330287
|
this.cause = cause;
|
|
330255
330288
|
this.name = "TerminalQuotaError";
|
|
330289
|
+
this.retryDelayMs = retryDelayMs ? retryDelayMs * 1e3 : void 0;
|
|
330256
330290
|
}
|
|
330257
330291
|
};
|
|
330258
330292
|
var RetryableQuotaError = class extends Error {
|
|
@@ -330278,6 +330312,11 @@ function parseDurationInSeconds(duration) {
|
|
|
330278
330312
|
}
|
|
330279
330313
|
function classifyGoogleError(error) {
|
|
330280
330314
|
const googleApiError = parseGoogleApiError(error);
|
|
330315
|
+
const status = googleApiError?.code ?? getErrorStatus(error);
|
|
330316
|
+
if (status === 404) {
|
|
330317
|
+
const message = googleApiError?.message || (error instanceof Error ? error.message : "Model not found");
|
|
330318
|
+
return new ModelNotFoundError(message, status);
|
|
330319
|
+
}
|
|
330281
330320
|
if (!googleApiError || googleApiError.code !== 429) {
|
|
330282
330321
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
330283
330322
|
const match2 = errorMessage.match(/Please retry in ([0-9.]+(?:ms|s))/);
|
|
@@ -330304,6 +330343,13 @@ function classifyGoogleError(error) {
|
|
|
330304
330343
|
}
|
|
330305
330344
|
}
|
|
330306
330345
|
}
|
|
330346
|
+
let delaySeconds;
|
|
330347
|
+
if (retryInfo?.retryDelay) {
|
|
330348
|
+
const parsedDelay = parseDurationInSeconds(retryInfo.retryDelay);
|
|
330349
|
+
if (parsedDelay) {
|
|
330350
|
+
delaySeconds = parsedDelay;
|
|
330351
|
+
}
|
|
330352
|
+
}
|
|
330307
330353
|
if (errorInfo) {
|
|
330308
330354
|
if (errorInfo.domain) {
|
|
330309
330355
|
const validDomains = [
|
|
@@ -330313,17 +330359,10 @@ function classifyGoogleError(error) {
|
|
|
330313
330359
|
];
|
|
330314
330360
|
if (validDomains.includes(errorInfo.domain)) {
|
|
330315
330361
|
if (errorInfo.reason === "RATE_LIMIT_EXCEEDED") {
|
|
330316
|
-
|
|
330317
|
-
if (retryInfo?.retryDelay) {
|
|
330318
|
-
const parsedDelay = parseDurationInSeconds(retryInfo.retryDelay);
|
|
330319
|
-
if (parsedDelay) {
|
|
330320
|
-
delaySeconds = parsedDelay;
|
|
330321
|
-
}
|
|
330322
|
-
}
|
|
330323
|
-
return new RetryableQuotaError(`${googleApiError.message}`, googleApiError, delaySeconds);
|
|
330362
|
+
return new RetryableQuotaError(`${googleApiError.message}`, googleApiError, delaySeconds ?? 10);
|
|
330324
330363
|
}
|
|
330325
330364
|
if (errorInfo.reason === "QUOTA_EXHAUSTED") {
|
|
330326
|
-
return new TerminalQuotaError(`${googleApiError.message}`, googleApiError);
|
|
330365
|
+
return new TerminalQuotaError(`${googleApiError.message}`, googleApiError, delaySeconds);
|
|
330327
330366
|
}
|
|
330328
330367
|
}
|
|
330329
330368
|
}
|
|
@@ -330333,11 +330372,10 @@ function classifyGoogleError(error) {
|
|
|
330333
330372
|
}
|
|
330334
330373
|
}
|
|
330335
330374
|
if (retryInfo?.retryDelay) {
|
|
330336
|
-
const delaySeconds = parseDurationInSeconds(retryInfo.retryDelay);
|
|
330337
330375
|
if (delaySeconds) {
|
|
330338
330376
|
if (delaySeconds > 120) {
|
|
330339
330377
|
return new TerminalQuotaError(`${googleApiError.message}
|
|
330340
|
-
Suggested retry after ${retryInfo.retryDelay}.`, googleApiError);
|
|
330378
|
+
Suggested retry after ${retryInfo.retryDelay}.`, googleApiError, delaySeconds);
|
|
330341
330379
|
}
|
|
330342
330380
|
return new RetryableQuotaError(`${googleApiError.message}
|
|
330343
330381
|
Suggested retry after ${retryInfo.retryDelay}.`, googleApiError, delaySeconds);
|
|
@@ -330447,7 +330485,8 @@ async function retryWithBackoff(fn, options2) {
|
|
|
330447
330485
|
throw error;
|
|
330448
330486
|
}
|
|
330449
330487
|
const classifiedError = classifyGoogleError(error);
|
|
330450
|
-
|
|
330488
|
+
const errorCode = getErrorStatus(error);
|
|
330489
|
+
if (classifiedError instanceof TerminalQuotaError || classifiedError instanceof ModelNotFoundError) {
|
|
330451
330490
|
if (onPersistent429 && authType === AuthType2.LOGIN_WITH_GOOGLE) {
|
|
330452
330491
|
try {
|
|
330453
330492
|
const fallbackModel = await onPersistent429(authType, classifiedError);
|
|
@@ -330462,7 +330501,8 @@ async function retryWithBackoff(fn, options2) {
|
|
|
330462
330501
|
}
|
|
330463
330502
|
throw classifiedError;
|
|
330464
330503
|
}
|
|
330465
|
-
|
|
330504
|
+
const is500 = errorCode !== void 0 && errorCode >= 500 && errorCode < 600;
|
|
330505
|
+
if (classifiedError instanceof RetryableQuotaError || is500) {
|
|
330466
330506
|
if (attempt >= maxAttempts) {
|
|
330467
330507
|
if (onPersistent429 && authType === AuthType2.LOGIN_WITH_GOOGLE) {
|
|
330468
330508
|
try {
|
|
@@ -330476,11 +330516,21 @@ async function retryWithBackoff(fn, options2) {
|
|
|
330476
330516
|
console.warn("Model fallback failed:", fallbackError);
|
|
330477
330517
|
}
|
|
330478
330518
|
}
|
|
330479
|
-
throw classifiedError;
|
|
330519
|
+
throw classifiedError instanceof RetryableQuotaError ? classifiedError : error;
|
|
330520
|
+
}
|
|
330521
|
+
if (classifiedError instanceof RetryableQuotaError) {
|
|
330522
|
+
console.warn(`Attempt ${attempt} failed: ${classifiedError.message}. Retrying after ${classifiedError.retryDelayMs}ms...`);
|
|
330523
|
+
await delay2(classifiedError.retryDelayMs, signal);
|
|
330524
|
+
continue;
|
|
330525
|
+
} else {
|
|
330526
|
+
const errorStatus2 = getErrorStatus(error);
|
|
330527
|
+
logRetryAttempt(attempt, error, errorStatus2);
|
|
330528
|
+
const jitter2 = currentDelay * 0.3 * (Math.random() * 2 - 1);
|
|
330529
|
+
const delayWithJitter2 = Math.max(0, currentDelay + jitter2);
|
|
330530
|
+
await delay2(delayWithJitter2, signal);
|
|
330531
|
+
currentDelay = Math.min(maxDelayMs, currentDelay * 2);
|
|
330532
|
+
continue;
|
|
330480
330533
|
}
|
|
330481
|
-
console.warn(`Attempt ${attempt} failed: ${classifiedError.message}. Retrying after ${classifiedError.retryDelayMs}ms...`);
|
|
330482
|
-
await delay2(classifiedError.retryDelayMs, signal);
|
|
330483
|
-
continue;
|
|
330484
330534
|
}
|
|
330485
330535
|
if (attempt >= maxAttempts || !shouldRetryOnError(error, retryFetchErrors)) {
|
|
330486
330536
|
throw error;
|
|
@@ -330495,20 +330545,6 @@ async function retryWithBackoff(fn, options2) {
|
|
|
330495
330545
|
}
|
|
330496
330546
|
throw new Error("Retry attempts exhausted");
|
|
330497
330547
|
}
|
|
330498
|
-
function getErrorStatus(error) {
|
|
330499
|
-
if (typeof error === "object" && error !== null) {
|
|
330500
|
-
if ("status" in error && typeof error.status === "number") {
|
|
330501
|
-
return error.status;
|
|
330502
|
-
}
|
|
330503
|
-
if ("response" in error && typeof error.response === "object" && error.response !== null) {
|
|
330504
|
-
const response = error.response;
|
|
330505
|
-
if ("status" in response && typeof response.status === "number") {
|
|
330506
|
-
return response.status;
|
|
330507
|
-
}
|
|
330508
|
-
}
|
|
330509
|
-
}
|
|
330510
|
-
return void 0;
|
|
330511
|
-
}
|
|
330512
330548
|
function logRetryAttempt(attempt, error, errorStatus) {
|
|
330513
330549
|
let message = `Attempt ${attempt} failed. Retrying with backoff...`;
|
|
330514
330550
|
if (errorStatus) {
|
|
@@ -343174,20 +343210,46 @@ My setup is complete. I will provide my first command in the next turn.
|
|
|
343174
343210
|
}
|
|
343175
343211
|
|
|
343176
343212
|
// packages/core/dist/src/config/models.js
|
|
343213
|
+
var PREVIEW_GEMINI_MODEL = "gemini-3-pro-preview";
|
|
343177
343214
|
var DEFAULT_GEMINI_MODEL = "gemini-2.5-pro";
|
|
343178
343215
|
var DEFAULT_GEMINI_FLASH_MODEL = "gemini-2.5-flash";
|
|
343216
|
+
var DEFAULT_GEMINI_FLASH_LITE_MODEL = "gemini-2.5-flash-lite";
|
|
343179
343217
|
var DEFAULT_GEMINI_MODEL_AUTO = "auto";
|
|
343218
|
+
var GEMINI_MODEL_ALIAS_PRO = "pro";
|
|
343219
|
+
var GEMINI_MODEL_ALIAS_FLASH = "flash";
|
|
343220
|
+
var GEMINI_MODEL_ALIAS_FLASH_LITE = "flash-lite";
|
|
343180
343221
|
var DEFAULT_GEMINI_EMBEDDING_MODEL = "gemini-embedding-001";
|
|
343181
343222
|
var DEFAULT_THINKING_MODE = 8192;
|
|
343182
|
-
function
|
|
343223
|
+
function resolveModel(requestedModel, previewFeaturesEnabled) {
|
|
343224
|
+
switch (requestedModel) {
|
|
343225
|
+
case DEFAULT_GEMINI_MODEL_AUTO:
|
|
343226
|
+
case GEMINI_MODEL_ALIAS_PRO: {
|
|
343227
|
+
return previewFeaturesEnabled ? PREVIEW_GEMINI_MODEL : DEFAULT_GEMINI_MODEL;
|
|
343228
|
+
}
|
|
343229
|
+
case GEMINI_MODEL_ALIAS_FLASH: {
|
|
343230
|
+
return DEFAULT_GEMINI_FLASH_MODEL;
|
|
343231
|
+
}
|
|
343232
|
+
case GEMINI_MODEL_ALIAS_FLASH_LITE: {
|
|
343233
|
+
return DEFAULT_GEMINI_FLASH_LITE_MODEL;
|
|
343234
|
+
}
|
|
343235
|
+
default: {
|
|
343236
|
+
return requestedModel;
|
|
343237
|
+
}
|
|
343238
|
+
}
|
|
343239
|
+
}
|
|
343240
|
+
function getEffectiveModel(isInFallbackMode, requestedModel, previewFeaturesEnabled) {
|
|
343241
|
+
const resolvedModel = resolveModel(requestedModel, previewFeaturesEnabled);
|
|
343183
343242
|
if (!isInFallbackMode) {
|
|
343184
|
-
return
|
|
343243
|
+
return resolvedModel;
|
|
343185
343244
|
}
|
|
343186
|
-
if (
|
|
343187
|
-
return
|
|
343245
|
+
if (resolvedModel.includes("lite")) {
|
|
343246
|
+
return resolvedModel;
|
|
343188
343247
|
}
|
|
343189
343248
|
return DEFAULT_GEMINI_FLASH_MODEL;
|
|
343190
343249
|
}
|
|
343250
|
+
function isGemini2Model(model) {
|
|
343251
|
+
return /^gemini-2(\.|$)/.test(model);
|
|
343252
|
+
}
|
|
343191
343253
|
|
|
343192
343254
|
// packages/core/dist/src/utils/generateContentResponseUtilities.js
|
|
343193
343255
|
function getResponseTextFromParts(parts2) {
|
|
@@ -344237,25 +344299,131 @@ var ChatRecordingService = class {
|
|
|
344237
344299
|
|
|
344238
344300
|
// packages/core/dist/src/fallback/handler.js
|
|
344239
344301
|
init_events();
|
|
344302
|
+
|
|
344303
|
+
// packages/core/dist/src/utils/secure-browser-launcher.js
|
|
344304
|
+
import { execFile as execFile6 } from "node:child_process";
|
|
344305
|
+
import { promisify as promisify12 } from "node:util";
|
|
344306
|
+
import { platform as platform9 } from "node:os";
|
|
344307
|
+
import { URL as URL7 } from "node:url";
|
|
344308
|
+
var execFileAsync5 = promisify12(execFile6);
|
|
344309
|
+
function validateUrl(url4) {
|
|
344310
|
+
let parsedUrl;
|
|
344311
|
+
try {
|
|
344312
|
+
parsedUrl = new URL7(url4);
|
|
344313
|
+
} catch (_error) {
|
|
344314
|
+
throw new Error(`Invalid URL: ${url4}`);
|
|
344315
|
+
}
|
|
344316
|
+
if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
|
|
344317
|
+
throw new Error(`Unsafe protocol: ${parsedUrl.protocol}. Only HTTP and HTTPS are allowed.`);
|
|
344318
|
+
}
|
|
344319
|
+
if (/[\r\n\x00-\x1f]/.test(url4)) {
|
|
344320
|
+
throw new Error("URL contains invalid characters");
|
|
344321
|
+
}
|
|
344322
|
+
}
|
|
344323
|
+
async function openBrowserSecurely(url4) {
|
|
344324
|
+
validateUrl(url4);
|
|
344325
|
+
const platformName = platform9();
|
|
344326
|
+
let command;
|
|
344327
|
+
let args2;
|
|
344328
|
+
switch (platformName) {
|
|
344329
|
+
case "darwin":
|
|
344330
|
+
command = "open";
|
|
344331
|
+
args2 = [url4];
|
|
344332
|
+
break;
|
|
344333
|
+
case "win32":
|
|
344334
|
+
command = "powershell.exe";
|
|
344335
|
+
args2 = [
|
|
344336
|
+
"-NoProfile",
|
|
344337
|
+
"-NonInteractive",
|
|
344338
|
+
"-WindowStyle",
|
|
344339
|
+
"Hidden",
|
|
344340
|
+
"-Command",
|
|
344341
|
+
`Start-Process '${url4.replace(/'/g, "''")}'`
|
|
344342
|
+
];
|
|
344343
|
+
break;
|
|
344344
|
+
case "linux":
|
|
344345
|
+
case "freebsd":
|
|
344346
|
+
case "openbsd":
|
|
344347
|
+
command = "xdg-open";
|
|
344348
|
+
args2 = [url4];
|
|
344349
|
+
break;
|
|
344350
|
+
default:
|
|
344351
|
+
throw new Error(`Unsupported platform: ${platformName}`);
|
|
344352
|
+
}
|
|
344353
|
+
const options2 = {
|
|
344354
|
+
// Don't inherit parent's environment to avoid potential issues
|
|
344355
|
+
env: {
|
|
344356
|
+
...process.env,
|
|
344357
|
+
// Ensure we're not in a shell that might interpret special characters
|
|
344358
|
+
SHELL: void 0
|
|
344359
|
+
},
|
|
344360
|
+
// Detach the browser process so it doesn't block
|
|
344361
|
+
detached: true,
|
|
344362
|
+
stdio: "ignore"
|
|
344363
|
+
};
|
|
344364
|
+
try {
|
|
344365
|
+
await execFileAsync5(command, args2, options2);
|
|
344366
|
+
} catch (error) {
|
|
344367
|
+
if ((platformName === "linux" || platformName === "freebsd" || platformName === "openbsd") && command === "xdg-open") {
|
|
344368
|
+
const fallbackCommands = [
|
|
344369
|
+
"gnome-open",
|
|
344370
|
+
"kde-open",
|
|
344371
|
+
"firefox",
|
|
344372
|
+
"chromium",
|
|
344373
|
+
"google-chrome"
|
|
344374
|
+
];
|
|
344375
|
+
for (const fallbackCommand of fallbackCommands) {
|
|
344376
|
+
try {
|
|
344377
|
+
await execFileAsync5(fallbackCommand, [url4], options2);
|
|
344378
|
+
return;
|
|
344379
|
+
} catch {
|
|
344380
|
+
continue;
|
|
344381
|
+
}
|
|
344382
|
+
}
|
|
344383
|
+
}
|
|
344384
|
+
throw new Error(`Failed to open browser: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
344385
|
+
}
|
|
344386
|
+
}
|
|
344387
|
+
|
|
344388
|
+
// packages/core/dist/src/fallback/handler.js
|
|
344389
|
+
var UPGRADE_URL_PAGE = "https://goo.gle/set-up-gemini-code-assist";
|
|
344240
344390
|
async function handleFallback(config2, failedModel, authType, error) {
|
|
344241
344391
|
if (authType !== AuthType2.LOGIN_WITH_GOOGLE)
|
|
344242
344392
|
return null;
|
|
344243
|
-
|
|
344393
|
+
if (error instanceof ModelNotFoundError && failedModel !== PREVIEW_GEMINI_MODEL) {
|
|
344394
|
+
return null;
|
|
344395
|
+
}
|
|
344396
|
+
if (failedModel === PREVIEW_GEMINI_MODEL) {
|
|
344397
|
+
config2.setPreviewModelBypassMode(true);
|
|
344398
|
+
if (config2.isPreviewModelFallbackMode()) {
|
|
344399
|
+
return true;
|
|
344400
|
+
}
|
|
344401
|
+
}
|
|
344402
|
+
const fallbackModel = failedModel === PREVIEW_GEMINI_MODEL ? DEFAULT_GEMINI_MODEL : DEFAULT_GEMINI_FLASH_MODEL;
|
|
344244
344403
|
const fallbackModelHandler = config2.fallbackModelHandler;
|
|
344245
344404
|
if (typeof fallbackModelHandler !== "function")
|
|
344246
344405
|
return null;
|
|
344247
344406
|
try {
|
|
344248
344407
|
const intent = await fallbackModelHandler(failedModel, fallbackModel, error);
|
|
344249
344408
|
switch (intent) {
|
|
344250
|
-
case "
|
|
344251
|
-
|
|
344409
|
+
case "retry_always":
|
|
344410
|
+
if (failedModel === PREVIEW_GEMINI_MODEL) {
|
|
344411
|
+
activatePreviewModelFallbackMode(config2);
|
|
344412
|
+
} else {
|
|
344413
|
+
activateFallbackMode(config2, authType);
|
|
344414
|
+
}
|
|
344252
344415
|
return true;
|
|
344253
344416
|
// Signal retryWithBackoff to continue.
|
|
344417
|
+
case "retry_once":
|
|
344418
|
+
return true;
|
|
344254
344419
|
case "stop":
|
|
344255
344420
|
activateFallbackMode(config2, authType);
|
|
344256
344421
|
return false;
|
|
344257
344422
|
case "retry_later":
|
|
344258
344423
|
return false;
|
|
344424
|
+
case "upgrade":
|
|
344425
|
+
await handleUpgrade();
|
|
344426
|
+
return false;
|
|
344259
344427
|
default:
|
|
344260
344428
|
throw new Error(`Unexpected fallback intent received from fallbackModelHandler: "${intent}"`);
|
|
344261
344429
|
}
|
|
@@ -344264,6 +344432,13 @@ async function handleFallback(config2, failedModel, authType, error) {
|
|
|
344264
344432
|
return null;
|
|
344265
344433
|
}
|
|
344266
344434
|
}
|
|
344435
|
+
async function handleUpgrade() {
|
|
344436
|
+
try {
|
|
344437
|
+
await openBrowserSecurely(UPGRADE_URL_PAGE);
|
|
344438
|
+
} catch (error) {
|
|
344439
|
+
debugLogger.warn("Failed to open browser automatically:", getErrorMessage(error));
|
|
344440
|
+
}
|
|
344441
|
+
}
|
|
344267
344442
|
function activateFallbackMode(config2, authType) {
|
|
344268
344443
|
if (!config2.isInFallbackMode()) {
|
|
344269
344444
|
config2.setFallbackMode(true);
|
|
@@ -344273,6 +344448,11 @@ function activateFallbackMode(config2, authType) {
|
|
|
344273
344448
|
}
|
|
344274
344449
|
}
|
|
344275
344450
|
}
|
|
344451
|
+
function activatePreviewModelFallbackMode(config2) {
|
|
344452
|
+
if (!config2.isPreviewModelFallbackMode()) {
|
|
344453
|
+
config2.setPreviewModelFallbackMode(true);
|
|
344454
|
+
}
|
|
344455
|
+
}
|
|
344276
344456
|
|
|
344277
344457
|
// packages/core/dist/src/core/geminiRequest.js
|
|
344278
344458
|
function partListUnionToString(value) {
|
|
@@ -344290,6 +344470,7 @@ var INVALID_CONTENT_RETRY_OPTIONS = {
|
|
|
344290
344470
|
// 1 initial call + 1 retry
|
|
344291
344471
|
initialDelayMs: 500
|
|
344292
344472
|
};
|
|
344473
|
+
var SYNTHETIC_THOUGHT_SIGNATURE = "skip_thought_signature_validator";
|
|
344293
344474
|
function isValidResponse2(response) {
|
|
344294
344475
|
if (response.candidates === void 0 || response.candidates.length === 0) {
|
|
344295
344476
|
return false;
|
|
@@ -344407,6 +344588,7 @@ var GeminiChat = class {
|
|
|
344407
344588
|
*/
|
|
344408
344589
|
async sendMessageStream(model, params, prompt_id) {
|
|
344409
344590
|
await this.sendPromise;
|
|
344591
|
+
this.config.setPreviewModelBypassMode(false);
|
|
344410
344592
|
let streamDoneResolver;
|
|
344411
344593
|
const streamDonePromise = new Promise((resolve14) => {
|
|
344412
344594
|
streamDoneResolver = resolve14;
|
|
@@ -344428,7 +344610,11 @@ var GeminiChat = class {
|
|
|
344428
344610
|
return async function* () {
|
|
344429
344611
|
try {
|
|
344430
344612
|
let lastError = new Error("Request failed after all retries.");
|
|
344431
|
-
|
|
344613
|
+
let maxAttempts = INVALID_CONTENT_RETRY_OPTIONS.maxAttempts;
|
|
344614
|
+
if (self2.config.isPreviewModelFallbackMode() && model === PREVIEW_GEMINI_MODEL) {
|
|
344615
|
+
maxAttempts = 1;
|
|
344616
|
+
}
|
|
344617
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
344432
344618
|
try {
|
|
344433
344619
|
if (attempt > 0) {
|
|
344434
344620
|
yield { type: StreamEventType.RETRY };
|
|
@@ -344449,8 +344635,8 @@ var GeminiChat = class {
|
|
|
344449
344635
|
} catch (error) {
|
|
344450
344636
|
lastError = error;
|
|
344451
344637
|
const isContentError = error instanceof InvalidStreamError;
|
|
344452
|
-
if (isContentError) {
|
|
344453
|
-
if (attempt <
|
|
344638
|
+
if (isContentError && isGemini2Model(model)) {
|
|
344639
|
+
if (attempt < maxAttempts - 1) {
|
|
344454
344640
|
logContentRetry(self2.config, new ContentRetryEvent(attempt, error.type, INVALID_CONTENT_RETRY_OPTIONS.initialDelayMs, model));
|
|
344455
344641
|
await new Promise((res) => setTimeout(res, INVALID_CONTENT_RETRY_OPTIONS.initialDelayMs * (attempt + 1)));
|
|
344456
344642
|
continue;
|
|
@@ -344460,10 +344646,14 @@ var GeminiChat = class {
|
|
|
344460
344646
|
}
|
|
344461
344647
|
}
|
|
344462
344648
|
if (lastError) {
|
|
344463
|
-
if (lastError instanceof InvalidStreamError) {
|
|
344464
|
-
logContentRetryFailure(self2.config, new ContentRetryFailureEvent(
|
|
344649
|
+
if (lastError instanceof InvalidStreamError && isGemini2Model(model)) {
|
|
344650
|
+
logContentRetryFailure(self2.config, new ContentRetryFailureEvent(maxAttempts, lastError.type, model));
|
|
344465
344651
|
}
|
|
344466
344652
|
throw lastError;
|
|
344653
|
+
} else {
|
|
344654
|
+
if (model === PREVIEW_GEMINI_MODEL && !self2.config.isPreviewModelBypassMode()) {
|
|
344655
|
+
self2.config.setPreviewModelFallbackMode(false);
|
|
344656
|
+
}
|
|
344467
344657
|
}
|
|
344468
344658
|
} finally {
|
|
344469
344659
|
streamDoneResolver();
|
|
@@ -344471,23 +344661,27 @@ var GeminiChat = class {
|
|
|
344471
344661
|
}();
|
|
344472
344662
|
}
|
|
344473
344663
|
async makeApiCallAndProcessStream(model, requestContents, params, prompt_id) {
|
|
344664
|
+
let effectiveModel = model;
|
|
344665
|
+
const contentsForPreviewModel = this.ensureActiveLoopHasThoughtSignatures(requestContents);
|
|
344474
344666
|
const apiCall = () => {
|
|
344475
|
-
|
|
344476
|
-
if (this.config.
|
|
344477
|
-
|
|
344667
|
+
let modelToUse = getEffectiveModel(this.config.isInFallbackMode(), model, this.config.getPreviewFeatures());
|
|
344668
|
+
if (this.config.isPreviewModelBypassMode() && modelToUse === PREVIEW_GEMINI_MODEL) {
|
|
344669
|
+
modelToUse = DEFAULT_GEMINI_MODEL;
|
|
344478
344670
|
}
|
|
344671
|
+
effectiveModel = modelToUse;
|
|
344479
344672
|
return this.config.getContentGenerator().generateContentStream({
|
|
344480
344673
|
model: modelToUse,
|
|
344481
|
-
contents: requestContents,
|
|
344674
|
+
contents: modelToUse === PREVIEW_GEMINI_MODEL ? contentsForPreviewModel : requestContents,
|
|
344482
344675
|
config: { ...this.generationConfig, ...params.config }
|
|
344483
344676
|
}, prompt_id);
|
|
344484
344677
|
};
|
|
344485
|
-
const onPersistent429Callback = async (authType, error) => await handleFallback(this.config,
|
|
344678
|
+
const onPersistent429Callback = async (authType, error) => await handleFallback(this.config, effectiveModel, authType, error);
|
|
344486
344679
|
const streamResponse = await retryWithBackoff(apiCall, {
|
|
344487
344680
|
onPersistent429: onPersistent429Callback,
|
|
344488
344681
|
authType: this.config.getContentGeneratorConfig()?.authType,
|
|
344489
344682
|
retryFetchErrors: this.config.getRetryFetchErrors(),
|
|
344490
|
-
signal: params.config?.abortSignal
|
|
344683
|
+
signal: params.config?.abortSignal,
|
|
344684
|
+
maxAttempts: this.config.isPreviewModelFallbackMode() && model === PREVIEW_GEMINI_MODEL ? 1 : void 0
|
|
344491
344685
|
});
|
|
344492
344686
|
return this.processStreamResponse(model, streamResponse);
|
|
344493
344687
|
}
|
|
@@ -344549,6 +344743,46 @@ var GeminiChat = class {
|
|
|
344549
344743
|
return newContent;
|
|
344550
344744
|
});
|
|
344551
344745
|
}
|
|
344746
|
+
// To ensure our requests validate, the first function call in every model
|
|
344747
|
+
// turn within the active loop must have a `thoughtSignature` property.
|
|
344748
|
+
// If we do not do this, we will get back 400 errors from the API.
|
|
344749
|
+
ensureActiveLoopHasThoughtSignatures(requestContents) {
|
|
344750
|
+
let activeLoopStartIndex = -1;
|
|
344751
|
+
for (let i3 = requestContents.length - 1; i3 >= 0; i3--) {
|
|
344752
|
+
const content = requestContents[i3];
|
|
344753
|
+
if (content.role === "user" && content.parts?.some((part) => part.text)) {
|
|
344754
|
+
activeLoopStartIndex = i3;
|
|
344755
|
+
break;
|
|
344756
|
+
}
|
|
344757
|
+
}
|
|
344758
|
+
if (activeLoopStartIndex === -1) {
|
|
344759
|
+
return requestContents;
|
|
344760
|
+
}
|
|
344761
|
+
const newContents = requestContents.slice();
|
|
344762
|
+
for (let i3 = activeLoopStartIndex; i3 < newContents.length; i3++) {
|
|
344763
|
+
const content = newContents[i3];
|
|
344764
|
+
if (content.role === "model" && content.parts) {
|
|
344765
|
+
const newParts = content.parts.slice();
|
|
344766
|
+
for (let j = 0; j < newParts.length; j++) {
|
|
344767
|
+
const part = newParts[j];
|
|
344768
|
+
if (part.functionCall) {
|
|
344769
|
+
if (!part.thoughtSignature) {
|
|
344770
|
+
newParts[j] = {
|
|
344771
|
+
...part,
|
|
344772
|
+
thoughtSignature: SYNTHETIC_THOUGHT_SIGNATURE
|
|
344773
|
+
};
|
|
344774
|
+
newContents[i3] = {
|
|
344775
|
+
...content,
|
|
344776
|
+
parts: newParts
|
|
344777
|
+
};
|
|
344778
|
+
}
|
|
344779
|
+
break;
|
|
344780
|
+
}
|
|
344781
|
+
}
|
|
344782
|
+
}
|
|
344783
|
+
}
|
|
344784
|
+
return newContents;
|
|
344785
|
+
}
|
|
344552
344786
|
setTools(tools) {
|
|
344553
344787
|
this.generationConfig.tools = tools;
|
|
344554
344788
|
}
|
|
@@ -346037,7 +346271,7 @@ var ChatCompressionService = class {
|
|
|
346037
346271
|
|
|
346038
346272
|
// packages/core/dist/src/core/client.js
|
|
346039
346273
|
function isThinkingSupported(model) {
|
|
346040
|
-
return model.startsWith("gemini-2.5") || model === DEFAULT_GEMINI_MODEL_AUTO;
|
|
346274
|
+
return model.startsWith("gemini-2.5") || model.startsWith("gemini-3") || model === DEFAULT_GEMINI_MODEL_AUTO;
|
|
346041
346275
|
}
|
|
346042
346276
|
var MAX_TURNS = 100;
|
|
346043
346277
|
var GeminiClient = class {
|
|
@@ -346292,8 +346526,7 @@ var GeminiClient = class {
|
|
|
346292
346526
|
return this.currentSequenceModel;
|
|
346293
346527
|
}
|
|
346294
346528
|
const configModel = this.config.getModel();
|
|
346295
|
-
|
|
346296
|
-
return getEffectiveModel(this.config.isInFallbackMode(), model);
|
|
346529
|
+
return getEffectiveModel(this.config.isInFallbackMode(), configModel, this.config.getPreviewFeatures());
|
|
346297
346530
|
}
|
|
346298
346531
|
async *sendMessageStream(request3, signal, prompt_id, turns = MAX_TURNS, isInvalidStreamRetry = false) {
|
|
346299
346532
|
if (this.lastPromptId !== prompt_id) {
|
|
@@ -351482,7 +351715,7 @@ var ClassifierResponseSchema = external_exports.object({
|
|
|
351482
351715
|
});
|
|
351483
351716
|
var ClassifierStrategy = class {
|
|
351484
351717
|
name = "classifier";
|
|
351485
|
-
async route(context2,
|
|
351718
|
+
async route(context2, config2, baseLlmClient) {
|
|
351486
351719
|
const startTime = Date.now();
|
|
351487
351720
|
try {
|
|
351488
351721
|
let promptId = promptIdContext.getStore();
|
|
@@ -351506,7 +351739,7 @@ var ClassifierStrategy = class {
|
|
|
351506
351739
|
const latencyMs = Date.now() - startTime;
|
|
351507
351740
|
if (routerResponse.model_choice === FLASH_MODEL) {
|
|
351508
351741
|
return {
|
|
351509
|
-
model:
|
|
351742
|
+
model: resolveModel(GEMINI_MODEL_ALIAS_FLASH, config2.getPreviewFeatures()),
|
|
351510
351743
|
metadata: {
|
|
351511
351744
|
source: "Classifier",
|
|
351512
351745
|
latencyMs,
|
|
@@ -351515,7 +351748,7 @@ var ClassifierStrategy = class {
|
|
|
351515
351748
|
};
|
|
351516
351749
|
} else {
|
|
351517
351750
|
return {
|
|
351518
|
-
model:
|
|
351751
|
+
model: resolveModel(GEMINI_MODEL_ALIAS_PRO, config2.getPreviewFeatures()),
|
|
351519
351752
|
metadata: {
|
|
351520
351753
|
source: "Classifier",
|
|
351521
351754
|
reasoning,
|
|
@@ -351592,7 +351825,7 @@ var FallbackStrategy = class {
|
|
|
351592
351825
|
if (!isInFallbackMode) {
|
|
351593
351826
|
return null;
|
|
351594
351827
|
}
|
|
351595
|
-
const effectiveModel = getEffectiveModel(isInFallbackMode, config2.getModel());
|
|
351828
|
+
const effectiveModel = getEffectiveModel(isInFallbackMode, config2.getModel(), config2.getPreviewFeatures());
|
|
351596
351829
|
return {
|
|
351597
351830
|
model: effectiveModel,
|
|
351598
351831
|
metadata: {
|
|
@@ -351612,7 +351845,7 @@ var OverrideStrategy = class {
|
|
|
351612
351845
|
if (overrideModel === DEFAULT_GEMINI_MODEL_AUTO)
|
|
351613
351846
|
return null;
|
|
351614
351847
|
return {
|
|
351615
|
-
model: overrideModel,
|
|
351848
|
+
model: resolveModel(overrideModel, config2.getPreviewFeatures()),
|
|
351616
351849
|
metadata: {
|
|
351617
351850
|
source: this.name,
|
|
351618
351851
|
latencyMs: 0,
|
|
@@ -351649,6 +351882,11 @@ var ModelRouterService = class {
|
|
|
351649
351882
|
let decision;
|
|
351650
351883
|
try {
|
|
351651
351884
|
decision = await this.strategy.route(context2, this.config, this.config.getBaseLlmClient());
|
|
351885
|
+
if (decision.model === DEFAULT_GEMINI_MODEL && this.config.getPreviewFeatures() && decision.metadata.source !== "override") {
|
|
351886
|
+
decision.model = PREVIEW_GEMINI_MODEL;
|
|
351887
|
+
decision.metadata.source += " (Preview Model)";
|
|
351888
|
+
decision.metadata.reasoning += " (Upgraded to Preview Model)";
|
|
351889
|
+
}
|
|
351652
351890
|
const event = new ModelRoutingEvent(
|
|
351653
351891
|
decision.model,
|
|
351654
351892
|
decision.metadata.source,
|
|
@@ -354864,7 +355102,7 @@ async function getClientMetadata() {
|
|
|
354864
355102
|
clientMetadataPromise = (async () => ({
|
|
354865
355103
|
ideName: "IDE_UNSPECIFIED",
|
|
354866
355104
|
pluginType: "GEMINI",
|
|
354867
|
-
ideVersion: "0.16.0
|
|
355105
|
+
ideVersion: "0.16.0",
|
|
354868
355106
|
platform: getPlatform(),
|
|
354869
355107
|
updateChannel: await getReleaseChannel(__dirname5)
|
|
354870
355108
|
}))();
|
|
@@ -354901,7 +355139,10 @@ function parseExperiments(response) {
|
|
|
354901
355139
|
// packages/core/dist/src/code_assist/experiments/flagNames.js
|
|
354902
355140
|
var ExperimentFlags = {
|
|
354903
355141
|
CONTEXT_COMPRESSION_THRESHOLD: 45740197,
|
|
354904
|
-
USER_CACHING: 45740198
|
|
355142
|
+
USER_CACHING: 45740198,
|
|
355143
|
+
BANNER_TEXT_NO_CAPACITY_ISSUES: 45740199,
|
|
355144
|
+
BANNER_TEXT_CAPACITY_ISSUES: 45740200,
|
|
355145
|
+
ENABLE_PREVIEW: 45740196
|
|
354905
355146
|
};
|
|
354906
355147
|
|
|
354907
355148
|
// packages/core/dist/src/utils/memoryDiscovery.js
|
|
@@ -358615,91 +358856,6 @@ import * as http5 from "node:http";
|
|
|
358615
358856
|
import * as crypto21 from "node:crypto";
|
|
358616
358857
|
import { URL as URL8 } from "node:url";
|
|
358617
358858
|
|
|
358618
|
-
// packages/core/dist/src/utils/secure-browser-launcher.js
|
|
358619
|
-
import { execFile as execFile6 } from "node:child_process";
|
|
358620
|
-
import { promisify as promisify12 } from "node:util";
|
|
358621
|
-
import { platform as platform9 } from "node:os";
|
|
358622
|
-
import { URL as URL7 } from "node:url";
|
|
358623
|
-
var execFileAsync5 = promisify12(execFile6);
|
|
358624
|
-
function validateUrl(url4) {
|
|
358625
|
-
let parsedUrl;
|
|
358626
|
-
try {
|
|
358627
|
-
parsedUrl = new URL7(url4);
|
|
358628
|
-
} catch (_error) {
|
|
358629
|
-
throw new Error(`Invalid URL: ${url4}`);
|
|
358630
|
-
}
|
|
358631
|
-
if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
|
|
358632
|
-
throw new Error(`Unsafe protocol: ${parsedUrl.protocol}. Only HTTP and HTTPS are allowed.`);
|
|
358633
|
-
}
|
|
358634
|
-
if (/[\r\n\x00-\x1f]/.test(url4)) {
|
|
358635
|
-
throw new Error("URL contains invalid characters");
|
|
358636
|
-
}
|
|
358637
|
-
}
|
|
358638
|
-
async function openBrowserSecurely(url4) {
|
|
358639
|
-
validateUrl(url4);
|
|
358640
|
-
const platformName = platform9();
|
|
358641
|
-
let command;
|
|
358642
|
-
let args2;
|
|
358643
|
-
switch (platformName) {
|
|
358644
|
-
case "darwin":
|
|
358645
|
-
command = "open";
|
|
358646
|
-
args2 = [url4];
|
|
358647
|
-
break;
|
|
358648
|
-
case "win32":
|
|
358649
|
-
command = "powershell.exe";
|
|
358650
|
-
args2 = [
|
|
358651
|
-
"-NoProfile",
|
|
358652
|
-
"-NonInteractive",
|
|
358653
|
-
"-WindowStyle",
|
|
358654
|
-
"Hidden",
|
|
358655
|
-
"-Command",
|
|
358656
|
-
`Start-Process '${url4.replace(/'/g, "''")}'`
|
|
358657
|
-
];
|
|
358658
|
-
break;
|
|
358659
|
-
case "linux":
|
|
358660
|
-
case "freebsd":
|
|
358661
|
-
case "openbsd":
|
|
358662
|
-
command = "xdg-open";
|
|
358663
|
-
args2 = [url4];
|
|
358664
|
-
break;
|
|
358665
|
-
default:
|
|
358666
|
-
throw new Error(`Unsupported platform: ${platformName}`);
|
|
358667
|
-
}
|
|
358668
|
-
const options2 = {
|
|
358669
|
-
// Don't inherit parent's environment to avoid potential issues
|
|
358670
|
-
env: {
|
|
358671
|
-
...process.env,
|
|
358672
|
-
// Ensure we're not in a shell that might interpret special characters
|
|
358673
|
-
SHELL: void 0
|
|
358674
|
-
},
|
|
358675
|
-
// Detach the browser process so it doesn't block
|
|
358676
|
-
detached: true,
|
|
358677
|
-
stdio: "ignore"
|
|
358678
|
-
};
|
|
358679
|
-
try {
|
|
358680
|
-
await execFileAsync5(command, args2, options2);
|
|
358681
|
-
} catch (error) {
|
|
358682
|
-
if ((platformName === "linux" || platformName === "freebsd" || platformName === "openbsd") && command === "xdg-open") {
|
|
358683
|
-
const fallbackCommands = [
|
|
358684
|
-
"gnome-open",
|
|
358685
|
-
"kde-open",
|
|
358686
|
-
"firefox",
|
|
358687
|
-
"chromium",
|
|
358688
|
-
"google-chrome"
|
|
358689
|
-
];
|
|
358690
|
-
for (const fallbackCommand of fallbackCommands) {
|
|
358691
|
-
try {
|
|
358692
|
-
await execFileAsync5(fallbackCommand, [url4], options2);
|
|
358693
|
-
return;
|
|
358694
|
-
} catch {
|
|
358695
|
-
continue;
|
|
358696
|
-
}
|
|
358697
|
-
}
|
|
358698
|
-
}
|
|
358699
|
-
throw new Error(`Failed to open browser: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
358700
|
-
}
|
|
358701
|
-
}
|
|
358702
|
-
|
|
358703
358859
|
// packages/core/dist/src/mcp/oauth-token-storage.js
|
|
358704
358860
|
init_events();
|
|
358705
358861
|
import { promises as fs54 } from "node:fs";
|
|
@@ -360341,6 +360497,7 @@ var Config = class {
|
|
|
360341
360497
|
cwd;
|
|
360342
360498
|
bugCommand;
|
|
360343
360499
|
model;
|
|
360500
|
+
previewFeatures;
|
|
360344
360501
|
noBrowser;
|
|
360345
360502
|
folderTrust;
|
|
360346
360503
|
ideMode;
|
|
@@ -360396,6 +360553,8 @@ var Config = class {
|
|
|
360396
360553
|
hooks;
|
|
360397
360554
|
experiments;
|
|
360398
360555
|
experimentsPromise;
|
|
360556
|
+
previewModelFallbackMode = false;
|
|
360557
|
+
previewModelBypassMode = false;
|
|
360399
360558
|
constructor(params) {
|
|
360400
360559
|
this.sessionId = params.sessionId;
|
|
360401
360560
|
this.embeddingModel = params.embeddingModel ?? DEFAULT_GEMINI_EMBEDDING_MODEL;
|
|
@@ -360442,6 +360601,7 @@ var Config = class {
|
|
|
360442
360601
|
this.fileDiscoveryService = params.fileDiscoveryService ?? null;
|
|
360443
360602
|
this.bugCommand = params.bugCommand;
|
|
360444
360603
|
this.model = params.model;
|
|
360604
|
+
this.previewFeatures = params.previewFeatures ?? void 0;
|
|
360445
360605
|
this.maxSessionTurns = params.maxSessionTurns ?? -1;
|
|
360446
360606
|
this.experimentalZedIntegration = params.experimentalZedIntegration ?? false;
|
|
360447
360607
|
this.listSessions = params.listSessions ?? false;
|
|
@@ -360566,17 +360726,24 @@ var Config = class {
|
|
|
360566
360726
|
this.model = DEFAULT_GEMINI_MODEL;
|
|
360567
360727
|
}
|
|
360568
360728
|
}
|
|
360569
|
-
if (this.contentGeneratorConfig?.authType === AuthType2.USE_GEMINI && authMethod
|
|
360729
|
+
if (this.contentGeneratorConfig?.authType === AuthType2.USE_GEMINI && authMethod !== AuthType2.USE_GEMINI) {
|
|
360570
360730
|
this.geminiClient.stripThoughtsFromHistory();
|
|
360571
360731
|
}
|
|
360572
360732
|
const newContentGeneratorConfig = await createContentGeneratorConfig(this, authMethod);
|
|
360573
360733
|
this.contentGenerator = await createContentGenerator(newContentGeneratorConfig, this, this.getSessionId());
|
|
360574
360734
|
this.contentGeneratorConfig = newContentGeneratorConfig;
|
|
360575
360735
|
this.baseLlmClient = new BaseLlmClient(this.contentGenerator, this);
|
|
360736
|
+
const previewFeatures = this.getPreviewFeatures();
|
|
360576
360737
|
const codeAssistServer = getCodeAssistServer(this);
|
|
360577
360738
|
if (codeAssistServer) {
|
|
360578
360739
|
this.experimentsPromise = getExperiments(codeAssistServer).then((experiments) => {
|
|
360579
360740
|
this.setExperiments(experiments);
|
|
360741
|
+
if (previewFeatures === void 0) {
|
|
360742
|
+
const remotePreviewFeatures = experiments.flags[ExperimentFlags.ENABLE_PREVIEW]?.boolValue;
|
|
360743
|
+
if (remotePreviewFeatures === true) {
|
|
360744
|
+
this.setPreviewFeatures(remotePreviewFeatures);
|
|
360745
|
+
}
|
|
360746
|
+
}
|
|
360580
360747
|
}).catch((e2) => {
|
|
360581
360748
|
debugLogger.error("Failed to fetch experiments", e2);
|
|
360582
360749
|
});
|
|
@@ -360639,6 +360806,21 @@ var Config = class {
|
|
|
360639
360806
|
setFallbackModelHandler(handler) {
|
|
360640
360807
|
this.fallbackModelHandler = handler;
|
|
360641
360808
|
}
|
|
360809
|
+
getFallbackModelHandler() {
|
|
360810
|
+
return this.fallbackModelHandler;
|
|
360811
|
+
}
|
|
360812
|
+
isPreviewModelFallbackMode() {
|
|
360813
|
+
return this.previewModelFallbackMode;
|
|
360814
|
+
}
|
|
360815
|
+
setPreviewModelFallbackMode(active) {
|
|
360816
|
+
this.previewModelFallbackMode = active;
|
|
360817
|
+
}
|
|
360818
|
+
isPreviewModelBypassMode() {
|
|
360819
|
+
return this.previewModelBypassMode;
|
|
360820
|
+
}
|
|
360821
|
+
setPreviewModelBypassMode(active) {
|
|
360822
|
+
this.previewModelBypassMode = active;
|
|
360823
|
+
}
|
|
360642
360824
|
getMaxSessionTurns() {
|
|
360643
360825
|
return this.maxSessionTurns;
|
|
360644
360826
|
}
|
|
@@ -360683,6 +360865,12 @@ var Config = class {
|
|
|
360683
360865
|
getQuestion() {
|
|
360684
360866
|
return this.question;
|
|
360685
360867
|
}
|
|
360868
|
+
getPreviewFeatures() {
|
|
360869
|
+
return this.previewFeatures;
|
|
360870
|
+
}
|
|
360871
|
+
setPreviewFeatures(previewFeatures) {
|
|
360872
|
+
this.previewFeatures = previewFeatures;
|
|
360873
|
+
}
|
|
360686
360874
|
getCoreTools() {
|
|
360687
360875
|
return this.coreTools;
|
|
360688
360876
|
}
|
|
@@ -360934,6 +361122,14 @@ var Config = class {
|
|
|
360934
361122
|
await this.ensureExperimentsLoaded();
|
|
360935
361123
|
return this.experiments?.flags[ExperimentFlags.USER_CACHING]?.boolValue;
|
|
360936
361124
|
}
|
|
361125
|
+
async getBannerTextNoCapacityIssues() {
|
|
361126
|
+
await this.ensureExperimentsLoaded();
|
|
361127
|
+
return this.experiments?.flags[ExperimentFlags.BANNER_TEXT_NO_CAPACITY_ISSUES]?.stringValue ?? "";
|
|
361128
|
+
}
|
|
361129
|
+
async getBannerTextCapacityIssues() {
|
|
361130
|
+
await this.ensureExperimentsLoaded();
|
|
361131
|
+
return this.experiments?.flags[ExperimentFlags.BANNER_TEXT_CAPACITY_ISSUES]?.stringValue ?? "";
|
|
361132
|
+
}
|
|
360937
361133
|
async ensureExperimentsLoaded() {
|
|
360938
361134
|
if (!this.experimentsPromise) {
|
|
360939
361135
|
return;
|