@google/gemini-cli-a2a-server 0.30.0-preview.6 → 0.30.1
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 +158 -19
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/a2a-server.mjs
CHANGED
|
@@ -131345,7 +131345,7 @@ function getVersion() {
|
|
|
131345
131345
|
}
|
|
131346
131346
|
versionPromise = (async () => {
|
|
131347
131347
|
const pkgJson = await getPackageJson(__dirname3);
|
|
131348
|
-
return "0.30.
|
|
131348
|
+
return "0.30.1";
|
|
131349
131349
|
})();
|
|
131350
131350
|
return versionPromise;
|
|
131351
131351
|
}
|
|
@@ -208745,8 +208745,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
208745
208745
|
var init_git_commit = __esm({
|
|
208746
208746
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
208747
208747
|
"use strict";
|
|
208748
|
-
GIT_COMMIT_INFO = "
|
|
208749
|
-
CLI_VERSION = "0.30.
|
|
208748
|
+
GIT_COMMIT_INFO = "0fc15382a";
|
|
208749
|
+
CLI_VERSION = "0.30.1";
|
|
208750
208750
|
}
|
|
208751
208751
|
});
|
|
208752
208752
|
|
|
@@ -399642,6 +399642,105 @@ ${authUrl}
|
|
|
399642
399642
|
}
|
|
399643
399643
|
});
|
|
399644
399644
|
|
|
399645
|
+
// node_modules/dotenv-expand/lib/main.js
|
|
399646
|
+
var require_main = __commonJS({
|
|
399647
|
+
"node_modules/dotenv-expand/lib/main.js"(exports2, module2) {
|
|
399648
|
+
"use strict";
|
|
399649
|
+
function _resolveEscapeSequences(value) {
|
|
399650
|
+
return value.replace(/\\\$/g, "$");
|
|
399651
|
+
}
|
|
399652
|
+
function expandValue(value, processEnv, runningParsed) {
|
|
399653
|
+
const env2 = { ...runningParsed, ...processEnv };
|
|
399654
|
+
const regex2 = /(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
399655
|
+
let result2 = value;
|
|
399656
|
+
let match2;
|
|
399657
|
+
const seen = /* @__PURE__ */ new Set();
|
|
399658
|
+
while ((match2 = regex2.exec(result2)) !== null) {
|
|
399659
|
+
seen.add(result2);
|
|
399660
|
+
const [template, bracedExpression, unbracedExpression] = match2;
|
|
399661
|
+
const expression = bracedExpression || unbracedExpression;
|
|
399662
|
+
const opRegex = /(:\+|\+|:-|-)/;
|
|
399663
|
+
const opMatch = expression.match(opRegex);
|
|
399664
|
+
const splitter = opMatch ? opMatch[0] : null;
|
|
399665
|
+
const r3 = expression.split(splitter);
|
|
399666
|
+
let defaultValue;
|
|
399667
|
+
let value2;
|
|
399668
|
+
const key = r3.shift();
|
|
399669
|
+
if ([":+", "+"].includes(splitter)) {
|
|
399670
|
+
defaultValue = env2[key] ? r3.join(splitter) : "";
|
|
399671
|
+
value2 = null;
|
|
399672
|
+
} else {
|
|
399673
|
+
defaultValue = r3.join(splitter);
|
|
399674
|
+
value2 = env2[key];
|
|
399675
|
+
}
|
|
399676
|
+
if (value2) {
|
|
399677
|
+
if (seen.has(value2)) {
|
|
399678
|
+
result2 = result2.replace(template, defaultValue);
|
|
399679
|
+
} else {
|
|
399680
|
+
result2 = result2.replace(template, value2);
|
|
399681
|
+
}
|
|
399682
|
+
} else {
|
|
399683
|
+
result2 = result2.replace(template, defaultValue);
|
|
399684
|
+
}
|
|
399685
|
+
if (result2 === runningParsed[key]) {
|
|
399686
|
+
break;
|
|
399687
|
+
}
|
|
399688
|
+
regex2.lastIndex = 0;
|
|
399689
|
+
}
|
|
399690
|
+
return result2;
|
|
399691
|
+
}
|
|
399692
|
+
function expand3(options) {
|
|
399693
|
+
const runningParsed = {};
|
|
399694
|
+
let processEnv = process.env;
|
|
399695
|
+
if (options && options.processEnv != null) {
|
|
399696
|
+
processEnv = options.processEnv;
|
|
399697
|
+
}
|
|
399698
|
+
for (const key in options.parsed) {
|
|
399699
|
+
let value = options.parsed[key];
|
|
399700
|
+
if (processEnv[key] && processEnv[key] !== value) {
|
|
399701
|
+
value = processEnv[key];
|
|
399702
|
+
} else {
|
|
399703
|
+
value = expandValue(value, processEnv, runningParsed);
|
|
399704
|
+
}
|
|
399705
|
+
options.parsed[key] = _resolveEscapeSequences(value);
|
|
399706
|
+
runningParsed[key] = _resolveEscapeSequences(value);
|
|
399707
|
+
}
|
|
399708
|
+
for (const processKey in options.parsed) {
|
|
399709
|
+
processEnv[processKey] = options.parsed[processKey];
|
|
399710
|
+
}
|
|
399711
|
+
return options;
|
|
399712
|
+
}
|
|
399713
|
+
module2.exports.expand = expand3;
|
|
399714
|
+
}
|
|
399715
|
+
});
|
|
399716
|
+
|
|
399717
|
+
// packages/core/dist/src/utils/envExpansion.js
|
|
399718
|
+
function expandEnvVars(str2, env2) {
|
|
399719
|
+
if (!str2)
|
|
399720
|
+
return str2;
|
|
399721
|
+
const isWindows5 = process.platform === "win32";
|
|
399722
|
+
const processedStr = isWindows5 ? str2.replace(/%(\w+)%/g, (_, name4) => env2[name4] ?? "") : str2;
|
|
399723
|
+
const dummyKey = "__GCLI_EXPAND_TARGET__";
|
|
399724
|
+
const processEnv = {};
|
|
399725
|
+
for (const [key, value] of Object.entries(env2)) {
|
|
399726
|
+
if (value !== void 0) {
|
|
399727
|
+
processEnv[key] = value;
|
|
399728
|
+
}
|
|
399729
|
+
}
|
|
399730
|
+
const result2 = (0, import_dotenv_expand.expand)({
|
|
399731
|
+
parsed: { [dummyKey]: processedStr },
|
|
399732
|
+
processEnv
|
|
399733
|
+
});
|
|
399734
|
+
return result2.parsed?.[dummyKey] ?? "";
|
|
399735
|
+
}
|
|
399736
|
+
var import_dotenv_expand;
|
|
399737
|
+
var init_envExpansion = __esm({
|
|
399738
|
+
"packages/core/dist/src/utils/envExpansion.js"() {
|
|
399739
|
+
"use strict";
|
|
399740
|
+
import_dotenv_expand = __toESM(require_main(), 1);
|
|
399741
|
+
}
|
|
399742
|
+
});
|
|
399743
|
+
|
|
399645
399744
|
// packages/core/dist/src/tools/mcp-client.js
|
|
399646
399745
|
import { basename as basename11 } from "node:path";
|
|
399647
399746
|
import { pathToFileURL } from "node:url";
|
|
@@ -399702,10 +399801,22 @@ async function handleAutomaticOAuth(mcpServerName, mcpServerConfig, wwwAuthentic
|
|
|
399702
399801
|
return false;
|
|
399703
399802
|
}
|
|
399704
399803
|
}
|
|
399705
|
-
function createTransportRequestInit(mcpServerConfig, headers) {
|
|
399804
|
+
function createTransportRequestInit(mcpServerConfig, headers, sanitizationConfig) {
|
|
399805
|
+
const extensionEnv = getExtensionEnvironment(mcpServerConfig.extension);
|
|
399806
|
+
const expansionEnv = { ...process.env, ...extensionEnv };
|
|
399807
|
+
const sanitizedEnv = sanitizeEnvironment(expansionEnv, {
|
|
399808
|
+
...sanitizationConfig,
|
|
399809
|
+
enableEnvironmentVariableRedaction: true
|
|
399810
|
+
});
|
|
399811
|
+
const expandedHeaders = {};
|
|
399812
|
+
if (mcpServerConfig.headers) {
|
|
399813
|
+
for (const [key, value] of Object.entries(mcpServerConfig.headers)) {
|
|
399814
|
+
expandedHeaders[key] = expandEnvVars(value, sanitizedEnv);
|
|
399815
|
+
}
|
|
399816
|
+
}
|
|
399706
399817
|
return {
|
|
399707
399818
|
headers: {
|
|
399708
|
-
...
|
|
399819
|
+
...expandedHeaders,
|
|
399709
399820
|
...headers
|
|
399710
399821
|
}
|
|
399711
399822
|
};
|
|
@@ -399719,13 +399830,13 @@ function createAuthProvider(mcpServerConfig) {
|
|
|
399719
399830
|
}
|
|
399720
399831
|
return void 0;
|
|
399721
399832
|
}
|
|
399722
|
-
async function createTransportWithOAuth(mcpServerName, mcpServerConfig, accessToken) {
|
|
399833
|
+
async function createTransportWithOAuth(mcpServerName, mcpServerConfig, accessToken, sanitizationConfig) {
|
|
399723
399834
|
try {
|
|
399724
399835
|
const headers = {
|
|
399725
399836
|
Authorization: `Bearer ${accessToken}`
|
|
399726
399837
|
};
|
|
399727
399838
|
const transportOptions = {
|
|
399728
|
-
requestInit: createTransportRequestInit(mcpServerConfig, headers)
|
|
399839
|
+
requestInit: createTransportRequestInit(mcpServerConfig, headers, sanitizationConfig)
|
|
399729
399840
|
};
|
|
399730
399841
|
return createUrlTransport(mcpServerName, mcpServerConfig, transportOptions);
|
|
399731
399842
|
} catch (error2) {
|
|
@@ -399887,7 +399998,7 @@ async function showAuthRequiredMessage(serverName) {
|
|
|
399887
399998
|
coreEvents.emitFeedback("info", message);
|
|
399888
399999
|
throw new UnauthorizedError(message);
|
|
399889
400000
|
}
|
|
399890
|
-
async function retryWithOAuth(client, serverName, config3, accessToken, httpReturned404) {
|
|
400001
|
+
async function retryWithOAuth(client, serverName, config3, accessToken, httpReturned404, sanitizationConfig) {
|
|
399891
400002
|
if (httpReturned404) {
|
|
399892
400003
|
debugLogger.log(`Retrying SSE connection to '${serverName}' with OAuth token...`);
|
|
399893
400004
|
await connectWithSSETransport(client, config3, accessToken);
|
|
@@ -399895,7 +400006,7 @@ async function retryWithOAuth(client, serverName, config3, accessToken, httpRetu
|
|
|
399895
400006
|
return;
|
|
399896
400007
|
}
|
|
399897
400008
|
debugLogger.log(`Retrying connection to '${serverName}' with OAuth token...`);
|
|
399898
|
-
const httpTransport = await createTransportWithOAuth(serverName, config3, accessToken);
|
|
400009
|
+
const httpTransport = await createTransportWithOAuth(serverName, config3, accessToken, sanitizationConfig);
|
|
399899
400010
|
if (!httpTransport) {
|
|
399900
400011
|
throw new Error(`Failed to create OAuth transport for server '${serverName}'`);
|
|
399901
400012
|
}
|
|
@@ -400045,7 +400156,7 @@ async function connectToMcpServer(clientVersion, mcpServerName, mcpServerConfig,
|
|
|
400045
400156
|
if (!accessToken) {
|
|
400046
400157
|
throw new Error(`Failed to get OAuth token for server '${mcpServerName}'`);
|
|
400047
400158
|
}
|
|
400048
|
-
await retryWithOAuth(mcpClient, mcpServerName, mcpServerConfig, accessToken, httpReturned404);
|
|
400159
|
+
await retryWithOAuth(mcpClient, mcpServerName, mcpServerConfig, accessToken, httpReturned404, sanitizationConfig);
|
|
400049
400160
|
return mcpClient;
|
|
400050
400161
|
} else {
|
|
400051
400162
|
throw new Error(`Failed to handle automatic OAuth for server '${mcpServerName}'`);
|
|
@@ -400076,7 +400187,7 @@ async function connectToMcpServer(clientVersion, mcpServerName, mcpServerConfig,
|
|
|
400076
400187
|
if (!accessToken) {
|
|
400077
400188
|
throw new Error(`Failed to get OAuth token for server '${mcpServerName}'`);
|
|
400078
400189
|
}
|
|
400079
|
-
const oauthTransport = await createTransportWithOAuth(mcpServerName, mcpServerConfig, accessToken);
|
|
400190
|
+
const oauthTransport = await createTransportWithOAuth(mcpServerName, mcpServerConfig, accessToken, sanitizationConfig);
|
|
400080
400191
|
if (!oauthTransport) {
|
|
400081
400192
|
throw new Error(`Failed to create OAuth transport for server '${mcpServerName}'`);
|
|
400082
400193
|
}
|
|
@@ -400148,20 +400259,36 @@ async function createTransport(mcpServerName, mcpServerConfig, debugMode, saniti
|
|
|
400148
400259
|
}
|
|
400149
400260
|
}
|
|
400150
400261
|
const transportOptions = {
|
|
400151
|
-
requestInit: createTransportRequestInit(mcpServerConfig, headers),
|
|
400262
|
+
requestInit: createTransportRequestInit(mcpServerConfig, headers, sanitizationConfig),
|
|
400152
400263
|
authProvider
|
|
400153
400264
|
};
|
|
400154
400265
|
return createUrlTransport(mcpServerName, mcpServerConfig, transportOptions);
|
|
400155
400266
|
}
|
|
400156
400267
|
if (mcpServerConfig.command) {
|
|
400268
|
+
const extensionEnv = getExtensionEnvironment(mcpServerConfig.extension);
|
|
400269
|
+
const expansionEnv = { ...process.env, ...extensionEnv };
|
|
400270
|
+
const sanitizedEnv = sanitizeEnvironment(expansionEnv, {
|
|
400271
|
+
...sanitizationConfig,
|
|
400272
|
+
enableEnvironmentVariableRedaction: true
|
|
400273
|
+
});
|
|
400274
|
+
const finalEnv = {
|
|
400275
|
+
[GEMINI_CLI_IDENTIFICATION_ENV_VAR]: GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE,
|
|
400276
|
+
...extensionEnv
|
|
400277
|
+
};
|
|
400278
|
+
for (const [key, value] of Object.entries(sanitizedEnv)) {
|
|
400279
|
+
if (value !== void 0) {
|
|
400280
|
+
finalEnv[key] = value;
|
|
400281
|
+
}
|
|
400282
|
+
}
|
|
400283
|
+
if (mcpServerConfig.env) {
|
|
400284
|
+
for (const [key, value] of Object.entries(mcpServerConfig.env)) {
|
|
400285
|
+
finalEnv[key] = expandEnvVars(value, expansionEnv);
|
|
400286
|
+
}
|
|
400287
|
+
}
|
|
400157
400288
|
let transport = new StdioClientTransport({
|
|
400158
400289
|
command: mcpServerConfig.command,
|
|
400159
400290
|
args: mcpServerConfig.args || [],
|
|
400160
|
-
env:
|
|
400161
|
-
...sanitizeEnvironment(process.env, sanitizationConfig),
|
|
400162
|
-
...mcpServerConfig.env || {},
|
|
400163
|
-
[GEMINI_CLI_IDENTIFICATION_ENV_VAR]: GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE
|
|
400164
|
-
},
|
|
400291
|
+
env: finalEnv,
|
|
400165
400292
|
cwd: mcpServerConfig.cwd,
|
|
400166
400293
|
stderr: "pipe"
|
|
400167
400294
|
});
|
|
@@ -400184,6 +400311,17 @@ async function createTransport(mcpServerName, mcpServerConfig, debugMode, saniti
|
|
|
400184
400311
|
}
|
|
400185
400312
|
throw new Error(`Invalid configuration: missing httpUrl (for Streamable HTTP), url (for SSE), and command (for stdio).`);
|
|
400186
400313
|
}
|
|
400314
|
+
function getExtensionEnvironment(extension) {
|
|
400315
|
+
const env2 = {};
|
|
400316
|
+
if (extension?.resolvedSettings) {
|
|
400317
|
+
for (const setting of extension.resolvedSettings) {
|
|
400318
|
+
if (setting.value !== void 0) {
|
|
400319
|
+
env2[setting.envVar] = setting.value;
|
|
400320
|
+
}
|
|
400321
|
+
}
|
|
400322
|
+
}
|
|
400323
|
+
return env2;
|
|
400324
|
+
}
|
|
400187
400325
|
function isEnabled(funcDecl, mcpServerName, mcpServerConfig) {
|
|
400188
400326
|
if (!funcDecl.name) {
|
|
400189
400327
|
debugLogger.warn(`Discovered a function declaration without a name from MCP server '${mcpServerName}'. Skipping.`);
|
|
@@ -400220,6 +400358,7 @@ var init_mcp_client = __esm({
|
|
|
400220
400358
|
init_message_bus();
|
|
400221
400359
|
init_events();
|
|
400222
400360
|
init_environmentSanitization();
|
|
400361
|
+
init_envExpansion();
|
|
400223
400362
|
init_shellExecutionService();
|
|
400224
400363
|
MCP_DEFAULT_TIMEOUT_MSEC = 10 * 60 * 1e3;
|
|
400225
400364
|
(function(MCPServerStatus2) {
|
|
@@ -407842,7 +407981,7 @@ var require_package13 = __commonJS({
|
|
|
407842
407981
|
});
|
|
407843
407982
|
|
|
407844
407983
|
// packages/a2a-server/node_modules/dotenv/lib/main.js
|
|
407845
|
-
var
|
|
407984
|
+
var require_main2 = __commonJS({
|
|
407846
407985
|
"packages/a2a-server/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
407847
407986
|
var fs73 = __require("fs");
|
|
407848
407987
|
var path86 = __require("path");
|
|
@@ -426060,7 +426199,7 @@ import { promises as fsPromises11, createReadStream as createReadStream5 } from
|
|
|
426060
426199
|
import { join as join25 } from "node:path";
|
|
426061
426200
|
|
|
426062
426201
|
// packages/a2a-server/src/config/config.ts
|
|
426063
|
-
var dotenv = __toESM(
|
|
426202
|
+
var dotenv = __toESM(require_main2(), 1);
|
|
426064
426203
|
init_dist7();
|
|
426065
426204
|
import * as fs67 from "node:fs";
|
|
426066
426205
|
import * as path79 from "node:path";
|