@google/gemini-cli-a2a-server 0.64.0-preview.0 → 0.65.0-nightly.20261007.gef59c532f
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 +100 -32
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/a2a-server.mjs
CHANGED
|
@@ -221367,8 +221367,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
221367
221367
|
var init_git_commit = __esm({
|
|
221368
221368
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
221369
221369
|
"use strict";
|
|
221370
|
-
GIT_COMMIT_INFO = "
|
|
221371
|
-
CLI_VERSION = "0.
|
|
221370
|
+
GIT_COMMIT_INFO = "ef59c532f";
|
|
221371
|
+
CLI_VERSION = "0.65.0-nightly.20261007.gef59c532f";
|
|
221372
221372
|
}
|
|
221373
221373
|
});
|
|
221374
221374
|
|
|
@@ -292506,7 +292506,7 @@ function isResumableMessageRecord(message) {
|
|
|
292506
292506
|
return false;
|
|
292507
292507
|
}
|
|
292508
292508
|
function hasResumableConversationContent(messages) {
|
|
292509
|
-
return messages
|
|
292509
|
+
return messages?.some((message) => isResumableMessageRecord(message)) ?? false;
|
|
292510
292510
|
}
|
|
292511
292511
|
function createJsonlRecordAccumulator(options) {
|
|
292512
292512
|
let metadata2 = {};
|
|
@@ -292907,6 +292907,8 @@ var init_chatRecordingService = __esm({
|
|
|
292907
292907
|
queuedThoughts = [];
|
|
292908
292908
|
queuedTokens = null;
|
|
292909
292909
|
context;
|
|
292910
|
+
isResumedSession = false;
|
|
292911
|
+
initializationPromise = null;
|
|
292910
292912
|
messageOrder = [];
|
|
292911
292913
|
messageMetaMap = /* @__PURE__ */ new Map();
|
|
292912
292914
|
toolCallMetaMap = /* @__PURE__ */ new Map();
|
|
@@ -292918,7 +292920,18 @@ var init_chatRecordingService = __esm({
|
|
|
292918
292920
|
this.sessionId = context2.promptId;
|
|
292919
292921
|
this.projectHash = getProjectHash(context2.config.getProjectRoot());
|
|
292920
292922
|
}
|
|
292923
|
+
getIsResumedSession() {
|
|
292924
|
+
return this.isResumedSession;
|
|
292925
|
+
}
|
|
292926
|
+
setIsResumedSession(isResumed) {
|
|
292927
|
+
this.isResumedSession = isResumed;
|
|
292928
|
+
}
|
|
292921
292929
|
async initialize(resumedSessionData, kind) {
|
|
292930
|
+
this.isResumedSession = Boolean(resumedSessionData);
|
|
292931
|
+
this.initializationPromise = this.doInitialize(resumedSessionData, kind);
|
|
292932
|
+
return this.initializationPromise;
|
|
292933
|
+
}
|
|
292934
|
+
async doInitialize(resumedSessionData, kind) {
|
|
292922
292935
|
try {
|
|
292923
292936
|
this.kind = kind;
|
|
292924
292937
|
if (resumedSessionData) {
|
|
@@ -292927,7 +292940,10 @@ var init_chatRecordingService = __esm({
|
|
|
292927
292940
|
this.kind = resumedSessionData.conversation.kind;
|
|
292928
292941
|
const loadedRecord = await loadConversationRecord(this.conversationFile);
|
|
292929
292942
|
if (loadedRecord) {
|
|
292930
|
-
this.cachedConversation =
|
|
292943
|
+
this.cachedConversation = {
|
|
292944
|
+
...loadedRecord,
|
|
292945
|
+
messages: loadedRecord.messages ?? []
|
|
292946
|
+
};
|
|
292931
292947
|
this.projectHash = this.cachedConversation.projectHash;
|
|
292932
292948
|
if (this.conversationFile.endsWith(".json")) {
|
|
292933
292949
|
this.conversationFile = this.conversationFile + "l";
|
|
@@ -292995,20 +293011,39 @@ var init_chatRecordingService = __esm({
|
|
|
292995
293011
|
const directories = this.kind === "subagent" ? [
|
|
292996
293012
|
...this.context.config.getWorkspaceContext()?.getDirectories() ?? []
|
|
292997
293013
|
] : void 0;
|
|
292998
|
-
|
|
292999
|
-
|
|
293000
|
-
|
|
293001
|
-
|
|
293002
|
-
|
|
293003
|
-
|
|
293004
|
-
|
|
293005
|
-
|
|
293006
|
-
|
|
293007
|
-
|
|
293008
|
-
|
|
293009
|
-
|
|
293010
|
-
|
|
293011
|
-
|
|
293014
|
+
let fileAlreadyExisted = false;
|
|
293015
|
+
if (fs36.existsSync(this.conversationFile)) {
|
|
293016
|
+
fileAlreadyExisted = true;
|
|
293017
|
+
const loadedRecord = await loadConversationRecord(this.conversationFile);
|
|
293018
|
+
if (loadedRecord) {
|
|
293019
|
+
this.cachedConversation = {
|
|
293020
|
+
...loadedRecord,
|
|
293021
|
+
messages: loadedRecord.messages ?? []
|
|
293022
|
+
};
|
|
293023
|
+
this.projectHash = this.cachedConversation.projectHash;
|
|
293024
|
+
if (loadedRecord.hasResumableContent || hasResumableConversationContent(this.cachedConversation.messages)) {
|
|
293025
|
+
this.isResumedSession = true;
|
|
293026
|
+
}
|
|
293027
|
+
}
|
|
293028
|
+
}
|
|
293029
|
+
if (!fileAlreadyExisted || !this.cachedConversation) {
|
|
293030
|
+
const initialMetadata = {
|
|
293031
|
+
sessionId: this.sessionId,
|
|
293032
|
+
projectHash: this.projectHash,
|
|
293033
|
+
startTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
293034
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
293035
|
+
kind: this.kind,
|
|
293036
|
+
directories
|
|
293037
|
+
};
|
|
293038
|
+
this.appendRecord(initialMetadata);
|
|
293039
|
+
this.cachedConversation = {
|
|
293040
|
+
...initialMetadata,
|
|
293041
|
+
messages: []
|
|
293042
|
+
};
|
|
293043
|
+
this.rebuildIndexAndWindow([]);
|
|
293044
|
+
} else {
|
|
293045
|
+
this.rebuildIndexAndWindow(this.cachedConversation.messages);
|
|
293046
|
+
}
|
|
293012
293047
|
}
|
|
293013
293048
|
this.queuedThoughts = [];
|
|
293014
293049
|
this.queuedTokens = null;
|
|
@@ -293053,14 +293088,15 @@ var init_chatRecordingService = __esm({
|
|
|
293053
293088
|
this.hasEvictedMessages = msgs.length < this.messageOrder.length;
|
|
293054
293089
|
}
|
|
293055
293090
|
rebuildIndexAndWindow(messages) {
|
|
293091
|
+
const safeMessages = messages ?? [];
|
|
293056
293092
|
this.messageOrder = [];
|
|
293057
293093
|
this.messageMetaMap.clear();
|
|
293058
293094
|
this.toolCallMetaMap.clear();
|
|
293059
|
-
for (const msg of
|
|
293095
|
+
for (const msg of safeMessages) {
|
|
293060
293096
|
this.indexMessage(msg);
|
|
293061
293097
|
}
|
|
293062
293098
|
if (this.cachedConversation) {
|
|
293063
|
-
this.cachedConversation.messages =
|
|
293099
|
+
this.cachedConversation.messages = safeMessages.length > MAX_HISTORY_MESSAGES ? safeMessages.slice(-MAX_HISTORY_MESSAGES) : [...safeMessages];
|
|
293064
293100
|
this.hasEvictedMessages = this.cachedConversation.messages.length < this.messageOrder.length;
|
|
293065
293101
|
} else {
|
|
293066
293102
|
this.hasEvictedMessages = false;
|
|
@@ -293367,12 +293403,30 @@ var init_chatRecordingService = __esm({
|
|
|
293367
293403
|
* session with a real user prompt, model response, or tool activity.
|
|
293368
293404
|
*/
|
|
293369
293405
|
async deleteCurrentSessionIfNotResumableAsync() {
|
|
293370
|
-
if (
|
|
293406
|
+
if (this.initializationPromise) {
|
|
293407
|
+
try {
|
|
293408
|
+
await this.initializationPromise;
|
|
293409
|
+
} catch {
|
|
293410
|
+
}
|
|
293411
|
+
}
|
|
293412
|
+
if (this.isResumedSession) {
|
|
293413
|
+
return;
|
|
293414
|
+
}
|
|
293415
|
+
if (!this.conversationFile) {
|
|
293371
293416
|
return;
|
|
293372
293417
|
}
|
|
293373
|
-
if (hasResumableConversationContent(this.cachedConversation.messages) || Array.from(this.messageMetaMap.values()).some((m3) => m3.isResumable)) {
|
|
293418
|
+
if (this.cachedConversation && hasResumableConversationContent(this.cachedConversation.messages ?? []) || Array.from(this.messageMetaMap.values()).some((m3) => m3.isResumable)) {
|
|
293374
293419
|
return;
|
|
293375
293420
|
}
|
|
293421
|
+
if (fs36.existsSync(this.conversationFile)) {
|
|
293422
|
+
try {
|
|
293423
|
+
const fileRecord = await loadConversationRecord(this.conversationFile);
|
|
293424
|
+
if (fileRecord && (fileRecord.hasResumableContent || hasResumableConversationContent(fileRecord.messages ?? []))) {
|
|
293425
|
+
return;
|
|
293426
|
+
}
|
|
293427
|
+
} catch {
|
|
293428
|
+
}
|
|
293429
|
+
}
|
|
293376
293430
|
await this.deleteCurrentSessionAsync();
|
|
293377
293431
|
}
|
|
293378
293432
|
/**
|
|
@@ -337592,7 +337646,7 @@ function getVersion() {
|
|
|
337592
337646
|
}
|
|
337593
337647
|
versionPromise = (async () => {
|
|
337594
337648
|
const pkgJson = await getPackageJson(__dirname4);
|
|
337595
|
-
return "0.
|
|
337649
|
+
return "0.65.0-nightly.20261007.gef59c532f";
|
|
337596
337650
|
})();
|
|
337597
337651
|
return versionPromise;
|
|
337598
337652
|
}
|
|
@@ -376673,7 +376727,13 @@ var init_oauth_utils = __esm({
|
|
|
376673
376727
|
issuer: metadata2.issuer,
|
|
376674
376728
|
tokenUrl: metadata2.token_endpoint,
|
|
376675
376729
|
scopes: metadata2.scopes_supported || [],
|
|
376676
|
-
registrationUrl: metadata2.registration_endpoint
|
|
376730
|
+
registrationUrl: metadata2.registration_endpoint,
|
|
376731
|
+
// RFC 9207 Section 3: the flag defaults to false when omitted. Discovered
|
|
376732
|
+
// configurations therefore always carry an explicit boolean, which lets
|
|
376733
|
+
// the callback policy distinguish them from an explicitly configured issuer.
|
|
376734
|
+
// Only a literal boolean `true` enables the flag, so loosely typed values
|
|
376735
|
+
// returned by some servers (e.g. "false" or "0") are not coerced to true.
|
|
376736
|
+
authorizationResponseIssParameterSupported: metadata2.authorization_response_iss_parameter_supported === true
|
|
376677
376737
|
};
|
|
376678
376738
|
}
|
|
376679
376739
|
/**
|
|
@@ -380473,7 +380533,7 @@ function areIssuersEqual(issuerA, issuerB) {
|
|
|
380473
380533
|
}
|
|
380474
380534
|
return normA === normB;
|
|
380475
380535
|
}
|
|
380476
|
-
function startCallbackServer(expectedState, port, expectedIssuer) {
|
|
380536
|
+
function startCallbackServer(expectedState, port, expectedIssuer, requireIssInResponse) {
|
|
380477
380537
|
let portResolve;
|
|
380478
380538
|
let portReject;
|
|
380479
380539
|
const portPromise = new Promise((resolve23, reject) => {
|
|
@@ -380527,8 +380587,9 @@ function startCallbackServer(expectedState, port, expectedIssuer) {
|
|
|
380527
380587
|
return;
|
|
380528
380588
|
}
|
|
380529
380589
|
if (expectedIssuer) {
|
|
380530
|
-
|
|
380531
|
-
|
|
380590
|
+
const requireIss = requireIssInResponse ?? true;
|
|
380591
|
+
if (requireIss && !iss) {
|
|
380592
|
+
debugLogger.error('OAuth callback rejected: Missing required "iss" parameter for the expected authorization server (RFC 9207).');
|
|
380532
380593
|
res.writeHead(400, { "Content-Type": "text/html" });
|
|
380533
380594
|
res.end(`
|
|
380534
380595
|
<html>
|
|
@@ -380543,7 +380604,7 @@ function startCallbackServer(expectedState, port, expectedIssuer) {
|
|
|
380543
380604
|
reject(new Error('Missing "iss" parameter in authorization response per RFC 9207'));
|
|
380544
380605
|
return;
|
|
380545
380606
|
}
|
|
380546
|
-
if (!areIssuersEqual(iss, expectedIssuer)) {
|
|
380607
|
+
if (iss && !areIssuersEqual(iss, expectedIssuer)) {
|
|
380547
380608
|
debugLogger.error("OAuth callback rejected: Issuer mismatch between authorization response and expected authorization server. Possible IdP mix-up attack (RFC 9207).");
|
|
380548
380609
|
res.writeHead(400, { "Content-Type": "text/html" });
|
|
380549
380610
|
res.end(`
|
|
@@ -380559,7 +380620,9 @@ function startCallbackServer(expectedState, port, expectedIssuer) {
|
|
|
380559
380620
|
reject(new Error("Issuer mismatch in authorization response - possible OAuth mix-up attack"));
|
|
380560
380621
|
return;
|
|
380561
380622
|
}
|
|
380562
|
-
|
|
380623
|
+
if (iss) {
|
|
380624
|
+
debugLogger.debug("\u2713 OAuth callback issuer validated successfully.");
|
|
380625
|
+
}
|
|
380563
380626
|
} else if (iss) {
|
|
380564
380627
|
debugLogger.debug('OAuth callback received "iss" parameter (no expected issuer was configured).');
|
|
380565
380628
|
}
|
|
@@ -410196,6 +410259,7 @@ var init_oauth_provider = __esm({
|
|
|
410196
410259
|
issuer: discoveredConfig.issuer,
|
|
410197
410260
|
tokenUrl: discoveredConfig.tokenUrl,
|
|
410198
410261
|
scopes: config2.scopes || discoveredConfig.scopes || [],
|
|
410262
|
+
authorizationResponseIssParameterSupported: config2.authorizationResponseIssParameterSupported ?? discoveredConfig.authorizationResponseIssParameterSupported,
|
|
410199
410263
|
// Preserve existing client credentials
|
|
410200
410264
|
clientId: config2.clientId,
|
|
410201
410265
|
clientSecret: config2.clientSecret
|
|
@@ -410219,6 +410283,7 @@ var init_oauth_provider = __esm({
|
|
|
410219
410283
|
issuer: discoveredConfig.issuer,
|
|
410220
410284
|
scopes: config2.scopes || discoveredConfig.scopes || [],
|
|
410221
410285
|
registrationUrl: discoveredConfig.registrationUrl,
|
|
410286
|
+
authorizationResponseIssParameterSupported: config2.authorizationResponseIssParameterSupported ?? discoveredConfig.authorizationResponseIssParameterSupported,
|
|
410222
410287
|
// Preserve existing client credentials
|
|
410223
410288
|
clientId: config2.clientId,
|
|
410224
410289
|
clientSecret: config2.clientSecret
|
|
@@ -410231,7 +410296,8 @@ var init_oauth_provider = __esm({
|
|
|
410231
410296
|
const pkceParams = generatePKCEParams();
|
|
410232
410297
|
const preferredPort = getPortFromUrl(config2.redirectUri);
|
|
410233
410298
|
debugLogger.debug(`Starting callback server for "${serverName}" (expected issuer: ${config2.issuer || "none"})...`);
|
|
410234
|
-
const
|
|
410299
|
+
const requireIssInResponse = config2.authorizationResponseIssParameterSupported ?? Boolean(config2.issuer);
|
|
410300
|
+
const callbackServer = startCallbackServer(pkceParams.state, preferredPort, config2.issuer, requireIssInResponse);
|
|
410235
410301
|
const redirectPort = await callbackServer.port;
|
|
410236
410302
|
debugLogger.debug(`Callback server listening on port ${redirectPort}`);
|
|
410237
410303
|
if (!config2.clientId) {
|
|
@@ -410628,7 +410694,8 @@ async function handleAutomaticOAuth(mcpServerName, mcpServerConfig, wwwAuthentic
|
|
|
410628
410694
|
authorizationUrl: oauthConfig.authorizationUrl,
|
|
410629
410695
|
issuer: oauthConfig.issuer,
|
|
410630
410696
|
tokenUrl: oauthConfig.tokenUrl,
|
|
410631
|
-
scopes: oauthConfig.scopes || []
|
|
410697
|
+
scopes: oauthConfig.scopes || [],
|
|
410698
|
+
authorizationResponseIssParameterSupported: mcpServerConfig.oauth?.authorizationResponseIssParameterSupported ?? oauthConfig.authorizationResponseIssParameterSupported
|
|
410632
410699
|
};
|
|
410633
410700
|
debugLogger.log(`Starting OAuth authentication for server '${mcpServerName}'...`);
|
|
410634
410701
|
const authProvider = new MCPOAuthProvider(new MCPOAuthTokenStorage());
|
|
@@ -411044,7 +411111,8 @@ async function connectToMcpServer(clientVersion, mcpServerName, mcpServerConfig,
|
|
|
411044
411111
|
authorizationUrl: oauthConfig.authorizationUrl,
|
|
411045
411112
|
issuer: oauthConfig.issuer,
|
|
411046
411113
|
tokenUrl: oauthConfig.tokenUrl,
|
|
411047
|
-
scopes: oauthConfig.scopes || []
|
|
411114
|
+
scopes: oauthConfig.scopes || [],
|
|
411115
|
+
authorizationResponseIssParameterSupported: mcpServerConfig.oauth?.authorizationResponseIssParameterSupported ?? oauthConfig.authorizationResponseIssParameterSupported
|
|
411048
411116
|
};
|
|
411049
411117
|
const authServerUrl = mcpServerConfig.httpUrl || mcpServerConfig.url;
|
|
411050
411118
|
debugLogger.log(`Starting OAuth authentication for server '${mcpServerName}'...`);
|