@google/gemini-cli-a2a-server 0.18.3 → 0.18.4
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 +150 -52
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/a2a-server.mjs
CHANGED
|
@@ -303410,6 +303410,11 @@ var FatalAuthenticationError = class extends FatalError {
|
|
|
303410
303410
|
super(message, 41);
|
|
303411
303411
|
}
|
|
303412
303412
|
};
|
|
303413
|
+
var FatalCancellationError = class extends FatalError {
|
|
303414
|
+
constructor(message) {
|
|
303415
|
+
super(message, 130);
|
|
303416
|
+
}
|
|
303417
|
+
};
|
|
303413
303418
|
var ForbiddenError = class extends Error {
|
|
303414
303419
|
};
|
|
303415
303420
|
var UnauthorizedError = class extends Error {
|
|
@@ -304155,7 +304160,63 @@ init_base_token_storage();
|
|
|
304155
304160
|
var DEFAULT_SERVICE_NAME = "gemini-cli-oauth";
|
|
304156
304161
|
var FORCE_ENCRYPTED_FILE_ENV_VAR = "GEMINI_FORCE_ENCRYPTED_FILE_STORAGE";
|
|
304157
304162
|
|
|
304163
|
+
// packages/core/dist/src/utils/stdio.js
|
|
304164
|
+
init_events();
|
|
304165
|
+
var originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
304166
|
+
var originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
304167
|
+
function writeToStdout(...args2) {
|
|
304168
|
+
return originalStdoutWrite(...args2);
|
|
304169
|
+
}
|
|
304170
|
+
function writeToStderr(...args2) {
|
|
304171
|
+
return originalStderrWrite(...args2);
|
|
304172
|
+
}
|
|
304173
|
+
function createInkStdio() {
|
|
304174
|
+
const inkStdout = new Proxy(process.stdout, {
|
|
304175
|
+
get(target, prop, receiver) {
|
|
304176
|
+
if (prop === "write") {
|
|
304177
|
+
return writeToStdout;
|
|
304178
|
+
}
|
|
304179
|
+
const value = Reflect.get(target, prop, receiver);
|
|
304180
|
+
if (typeof value === "function") {
|
|
304181
|
+
return value.bind(target);
|
|
304182
|
+
}
|
|
304183
|
+
return value;
|
|
304184
|
+
}
|
|
304185
|
+
});
|
|
304186
|
+
const inkStderr = new Proxy(process.stderr, {
|
|
304187
|
+
get(target, prop, receiver) {
|
|
304188
|
+
if (prop === "write") {
|
|
304189
|
+
return writeToStderr;
|
|
304190
|
+
}
|
|
304191
|
+
const value = Reflect.get(target, prop, receiver);
|
|
304192
|
+
if (typeof value === "function") {
|
|
304193
|
+
return value.bind(target);
|
|
304194
|
+
}
|
|
304195
|
+
return value;
|
|
304196
|
+
}
|
|
304197
|
+
});
|
|
304198
|
+
return { stdout: inkStdout, stderr: inkStderr };
|
|
304199
|
+
}
|
|
304200
|
+
|
|
304201
|
+
// packages/core/dist/src/utils/terminal.js
|
|
304202
|
+
function disableMouseEvents() {
|
|
304203
|
+
writeToStdout("\x1B[?1006l\x1B[?1002l");
|
|
304204
|
+
}
|
|
304205
|
+
function disableKittyKeyboardProtocol() {
|
|
304206
|
+
writeToStdout("\x1B[<u");
|
|
304207
|
+
}
|
|
304208
|
+
function enableLineWrapping() {
|
|
304209
|
+
writeToStdout("\x1B[?7h");
|
|
304210
|
+
}
|
|
304211
|
+
function enterAlternateScreen() {
|
|
304212
|
+
writeToStdout("\x1B[?1049h");
|
|
304213
|
+
}
|
|
304214
|
+
function exitAlternateScreen() {
|
|
304215
|
+
writeToStdout("\x1B[?1049l");
|
|
304216
|
+
}
|
|
304217
|
+
|
|
304158
304218
|
// packages/core/dist/src/code_assist/oauth2.js
|
|
304219
|
+
init_events();
|
|
304159
304220
|
var userAccountManager = new UserAccountManager();
|
|
304160
304221
|
var OAUTH_CLIENT_ID = "681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com";
|
|
304161
304222
|
var OAUTH_CLIENT_SECRET = "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";
|
|
@@ -304246,18 +304307,31 @@ async function initOauthClient(authType, config3) {
|
|
|
304246
304307
|
if (config3.isBrowserLaunchSuppressed()) {
|
|
304247
304308
|
let success = false;
|
|
304248
304309
|
const maxRetries = 2;
|
|
304249
|
-
|
|
304250
|
-
|
|
304251
|
-
|
|
304252
|
-
|
|
304310
|
+
enterAlternateScreen();
|
|
304311
|
+
writeToStdout("\x1B[2J\x1B[H");
|
|
304312
|
+
disableMouseEvents();
|
|
304313
|
+
disableKittyKeyboardProtocol();
|
|
304314
|
+
enableLineWrapping();
|
|
304315
|
+
try {
|
|
304316
|
+
for (let i4 = 0; !success && i4 < maxRetries; i4++) {
|
|
304317
|
+
success = await authWithUserCode(client);
|
|
304318
|
+
if (!success) {
|
|
304319
|
+
writeToStderr("\nFailed to authenticate with user code." + (i4 === maxRetries - 1 ? "" : " Retrying...\n"));
|
|
304320
|
+
}
|
|
304253
304321
|
}
|
|
304322
|
+
} finally {
|
|
304323
|
+
exitAlternateScreen();
|
|
304324
|
+
coreEvents.emit(CoreEvent.ExternalEditorClosed);
|
|
304254
304325
|
}
|
|
304255
304326
|
if (!success) {
|
|
304327
|
+
writeToStderr("Failed to authenticate with user code.\n");
|
|
304256
304328
|
throw new FatalAuthenticationError("Failed to authenticate with user code.");
|
|
304257
304329
|
}
|
|
304258
304330
|
} else {
|
|
304259
304331
|
const webLogin = await authWithWeb(client);
|
|
304260
|
-
|
|
304332
|
+
coreEvents.emit(CoreEvent.UserFeedback, {
|
|
304333
|
+
severity: "info",
|
|
304334
|
+
message: `
|
|
304261
304335
|
|
|
304262
304336
|
Code Assist login required.
|
|
304263
304337
|
Attempting to open authentication page in your browser.
|
|
@@ -304265,19 +304339,30 @@ Otherwise navigate to:
|
|
|
304265
304339
|
|
|
304266
304340
|
${webLogin.authUrl}
|
|
304267
304341
|
|
|
304268
|
-
|
|
304342
|
+
|
|
304343
|
+
`
|
|
304344
|
+
});
|
|
304269
304345
|
try {
|
|
304270
304346
|
const childProcess2 = await open_default(webLogin.authUrl);
|
|
304271
304347
|
childProcess2.on("error", (error2) => {
|
|
304272
|
-
|
|
304273
|
-
|
|
304348
|
+
coreEvents.emit(CoreEvent.UserFeedback, {
|
|
304349
|
+
severity: "error",
|
|
304350
|
+
message: `Failed to open browser with error: ${getErrorMessage(error2)}
|
|
304351
|
+
Please try running again with NO_BROWSER=true set.`
|
|
304352
|
+
});
|
|
304274
304353
|
});
|
|
304275
304354
|
} catch (err2) {
|
|
304276
|
-
|
|
304277
|
-
|
|
304355
|
+
coreEvents.emit(CoreEvent.UserFeedback, {
|
|
304356
|
+
severity: "error",
|
|
304357
|
+
message: `Failed to open browser with error: ${getErrorMessage(err2)}
|
|
304358
|
+
Please try running again with NO_BROWSER=true set.`
|
|
304359
|
+
});
|
|
304278
304360
|
throw new FatalAuthenticationError(`Failed to open browser: ${getErrorMessage(err2)}`);
|
|
304279
304361
|
}
|
|
304280
|
-
|
|
304362
|
+
coreEvents.emit(CoreEvent.UserFeedback, {
|
|
304363
|
+
severity: "info",
|
|
304364
|
+
message: "Waiting for authentication...\n"
|
|
304365
|
+
});
|
|
304281
304366
|
const authTimeout = 5 * 60 * 1e3;
|
|
304282
304367
|
const timeoutPromise = new Promise((_, reject) => {
|
|
304283
304368
|
setTimeout(() => {
|
|
@@ -304285,6 +304370,10 @@ Please try running again with NO_BROWSER=true set.`);
|
|
|
304285
304370
|
}, authTimeout);
|
|
304286
304371
|
});
|
|
304287
304372
|
await Promise.race([webLogin.loginCompletePromise, timeoutPromise]);
|
|
304373
|
+
coreEvents.emit(CoreEvent.UserFeedback, {
|
|
304374
|
+
severity: "info",
|
|
304375
|
+
message: "Authentication succeeded\n"
|
|
304376
|
+
});
|
|
304288
304377
|
}
|
|
304289
304378
|
return client;
|
|
304290
304379
|
}
|
|
@@ -304295,47 +304384,56 @@ async function getOauthClient(authType, config3) {
|
|
|
304295
304384
|
return oauthClientPromises.get(authType);
|
|
304296
304385
|
}
|
|
304297
304386
|
async function authWithUserCode(client) {
|
|
304298
|
-
const redirectUri = "https://codeassist.google.com/authcode";
|
|
304299
|
-
const codeVerifier = await client.generateCodeVerifierAsync();
|
|
304300
|
-
const state = crypto13.randomBytes(32).toString("hex");
|
|
304301
|
-
const authUrl = client.generateAuthUrl({
|
|
304302
|
-
redirect_uri: redirectUri,
|
|
304303
|
-
access_type: "offline",
|
|
304304
|
-
scope: OAUTH_SCOPE,
|
|
304305
|
-
code_challenge_method: import_google_auth_library8.CodeChallengeMethod.S256,
|
|
304306
|
-
code_challenge: codeVerifier.codeChallenge,
|
|
304307
|
-
state
|
|
304308
|
-
});
|
|
304309
|
-
debugLogger.log("Please visit the following URL to authorize the application:");
|
|
304310
|
-
debugLogger.log("");
|
|
304311
|
-
debugLogger.log(authUrl);
|
|
304312
|
-
debugLogger.log("");
|
|
304313
|
-
const code2 = await new Promise((resolve14) => {
|
|
304314
|
-
const rl = readline.createInterface({
|
|
304315
|
-
input: process.stdin,
|
|
304316
|
-
output: process.stdout
|
|
304317
|
-
});
|
|
304318
|
-
rl.question("Enter the authorization code: ", (code3) => {
|
|
304319
|
-
rl.close();
|
|
304320
|
-
resolve14(code3.trim());
|
|
304321
|
-
});
|
|
304322
|
-
});
|
|
304323
|
-
if (!code2) {
|
|
304324
|
-
debugLogger.error("Authorization code is required.");
|
|
304325
|
-
return false;
|
|
304326
|
-
}
|
|
304327
304387
|
try {
|
|
304328
|
-
const
|
|
304329
|
-
|
|
304330
|
-
|
|
304331
|
-
|
|
304388
|
+
const redirectUri = "https://codeassist.google.com/authcode";
|
|
304389
|
+
const codeVerifier = await client.generateCodeVerifierAsync();
|
|
304390
|
+
const state = crypto13.randomBytes(32).toString("hex");
|
|
304391
|
+
const authUrl = client.generateAuthUrl({
|
|
304392
|
+
redirect_uri: redirectUri,
|
|
304393
|
+
access_type: "offline",
|
|
304394
|
+
scope: OAUTH_SCOPE,
|
|
304395
|
+
code_challenge_method: import_google_auth_library8.CodeChallengeMethod.S256,
|
|
304396
|
+
code_challenge: codeVerifier.codeChallenge,
|
|
304397
|
+
state
|
|
304332
304398
|
});
|
|
304333
|
-
|
|
304334
|
-
|
|
304335
|
-
|
|
304399
|
+
writeToStdout("Please visit the following URL to authorize the application:\n\n" + authUrl + "\n\n");
|
|
304400
|
+
const code2 = await new Promise((resolve14, _) => {
|
|
304401
|
+
const rl = readline.createInterface({
|
|
304402
|
+
input: process.stdin,
|
|
304403
|
+
output: createInkStdio().stdout,
|
|
304404
|
+
terminal: true
|
|
304405
|
+
});
|
|
304406
|
+
rl.question("Enter the authorization code: ", (code3) => {
|
|
304407
|
+
rl.close();
|
|
304408
|
+
resolve14(code3.trim());
|
|
304409
|
+
});
|
|
304410
|
+
});
|
|
304411
|
+
if (!code2) {
|
|
304412
|
+
writeToStderr("Authorization code is required.\n");
|
|
304413
|
+
debugLogger.error("Authorization code is required.");
|
|
304414
|
+
return false;
|
|
304415
|
+
}
|
|
304416
|
+
try {
|
|
304417
|
+
const { tokens } = await client.getToken({
|
|
304418
|
+
code: code2,
|
|
304419
|
+
codeVerifier: codeVerifier.codeVerifier,
|
|
304420
|
+
redirect_uri: redirectUri
|
|
304421
|
+
});
|
|
304422
|
+
client.setCredentials(tokens);
|
|
304423
|
+
} catch (error2) {
|
|
304424
|
+
writeToStderr("Failed to authenticate with authorization code:" + getErrorMessage(error2) + "\n");
|
|
304425
|
+
debugLogger.error("Failed to authenticate with authorization code:", getErrorMessage(error2));
|
|
304426
|
+
return false;
|
|
304427
|
+
}
|
|
304428
|
+
return true;
|
|
304429
|
+
} catch (err2) {
|
|
304430
|
+
if (err2 instanceof FatalCancellationError) {
|
|
304431
|
+
throw err2;
|
|
304432
|
+
}
|
|
304433
|
+
writeToStderr("Failed to authenticate with user code:" + getErrorMessage(err2) + "\n");
|
|
304434
|
+
debugLogger.error("Failed to authenticate with user code:", getErrorMessage(err2));
|
|
304336
304435
|
return false;
|
|
304337
304436
|
}
|
|
304338
|
-
return true;
|
|
304339
304437
|
}
|
|
304340
304438
|
async function authWithWeb(client) {
|
|
304341
304439
|
const port = await getAvailablePort();
|
|
@@ -307590,8 +307688,8 @@ var Float64Vector = import_vector.default.Float64Vector;
|
|
|
307590
307688
|
var PointerVector = import_vector.default.PointerVector;
|
|
307591
307689
|
|
|
307592
307690
|
// packages/core/dist/src/generated/git-commit.js
|
|
307593
|
-
var GIT_COMMIT_INFO = "
|
|
307594
|
-
var CLI_VERSION = "0.18.
|
|
307691
|
+
var GIT_COMMIT_INFO = "2e8d7831c";
|
|
307692
|
+
var CLI_VERSION = "0.18.4";
|
|
307595
307693
|
|
|
307596
307694
|
// packages/core/dist/src/ide/detect-ide.js
|
|
307597
307695
|
var IDE_DEFINITIONS = {
|
|
@@ -310450,7 +310548,7 @@ async function createContentGenerator(config3, gcConfig, sessionId2) {
|
|
|
310450
310548
|
if (gcConfig.fakeResponses) {
|
|
310451
310549
|
return FakeContentGenerator.fromFile(gcConfig.fakeResponses);
|
|
310452
310550
|
}
|
|
310453
|
-
const version4 = "0.18.
|
|
310551
|
+
const version4 = "0.18.4";
|
|
310454
310552
|
const userAgent = `GeminiCLI/${version4} (${process.platform}; ${process.arch})`;
|
|
310455
310553
|
const baseHeaders = {
|
|
310456
310554
|
"User-Agent": userAgent
|
|
@@ -371734,7 +371832,7 @@ async function getClientMetadata() {
|
|
|
371734
371832
|
clientMetadataPromise = (async () => ({
|
|
371735
371833
|
ideName: "IDE_UNSPECIFIED",
|
|
371736
371834
|
pluginType: "GEMINI",
|
|
371737
|
-
ideVersion: "0.18.
|
|
371835
|
+
ideVersion: "0.18.4",
|
|
371738
371836
|
platform: getPlatform(),
|
|
371739
371837
|
updateChannel: await getReleaseChannel(__dirname5)
|
|
371740
371838
|
}))();
|