@google/gemini-cli 0.41.0-preview.3 → 0.41.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.
Files changed (59) hide show
  1. package/bundle/{chunk-2XTQTWI6.js → chunk-4CB5QYON.js} +1 -1
  2. package/bundle/{chunk-HEEHAPEL.js → chunk-5ECQHX5C.js} +2 -2
  3. package/bundle/{chunk-DHIYDJUL.js → chunk-5ZVQP4WN.js} +1 -1
  4. package/bundle/{chunk-E2QAQW3I.js → chunk-7LNZOOC7.js} +6 -6
  5. package/bundle/{chunk-ZEIIZSJZ.js → chunk-B2LNN6KY.js} +4 -4
  6. package/bundle/{chunk-6XQBPKE2.js → chunk-CSDNDSTO.js} +4 -4
  7. package/bundle/{chunk-SNNRBUKE.js → chunk-CWJ5KY34.js} +1 -1
  8. package/bundle/{chunk-LZNYOS5U.js → chunk-CZW4D4RQ.js} +1 -1
  9. package/bundle/{chunk-HRMW37XV.js → chunk-F6MNV4SZ.js} +6 -6
  10. package/bundle/{chunk-4OVVS5FK.js → chunk-G2G5UOIR.js} +2 -2
  11. package/bundle/{chunk-AZPVBKRA.js → chunk-GLO32GZ3.js} +12456 -6676
  12. package/bundle/{chunk-TQTDR3T2.js → chunk-J7E7PI4S.js} +2 -2
  13. package/bundle/{chunk-SNU5LJTH.js → chunk-KHDD5ZQT.js} +1 -1
  14. package/bundle/{chunk-QFA7YCIS.js → chunk-KMY2ICHB.js} +1 -1
  15. package/bundle/{chunk-F3ZVPM4S.js → chunk-KYES7RJ6.js} +54 -67
  16. package/bundle/{chunk-6HALERSC.js → chunk-RVECIZP6.js} +1 -1
  17. package/bundle/{chunk-WGF4IHWH.js → chunk-TOU7GDCS.js} +3 -3
  18. package/bundle/{chunk-RMXTIDND.js → chunk-V7GQYOIO.js} +12 -14
  19. package/bundle/{cleanup-ROUPI6PW.js → cleanup-KMEBTV6K.js} +2 -2
  20. package/bundle/{cleanup-GBVTVKLA.js → cleanup-OJM7LXCH.js} +2 -2
  21. package/bundle/{cleanup-GC5KHVP3.js → cleanup-PMJYRELA.js} +3 -3
  22. package/bundle/{core-RR2C5DU4.js → core-4PBU56P6.js} +1 -1
  23. package/bundle/{dist-QBYFIZZI.js → core-MMHOAGLI.js} +2 -2
  24. package/bundle/{devtoolsService-KHVNVBBE.js → devtoolsService-ARI22QWG.js} +2 -2
  25. package/bundle/{devtoolsService-FEQD4TFU.js → devtoolsService-BDOWEGHR.js} +4 -5
  26. package/bundle/{devtoolsService-6UWXBYSZ.js → devtoolsService-YPN2GRY7.js} +2 -2
  27. package/bundle/{dist-2V43KQFH.js → dist-V6XXY2AS.js} +1 -1
  28. package/bundle/{gemini-3EY5U3GH.js → gemini-GSCVWK7Y.js} +175 -191
  29. package/bundle/{gemini-EOOBHOT7.js → gemini-LDARUG77.js} +12 -12
  30. package/bundle/{gemini-FX4GAVHU.js → gemini-RGSMPB6F.js} +12 -12
  31. package/bundle/gemini.js +3 -3
  32. package/bundle/{interactiveCli-44QQRQFM.js → interactiveCli-5JCJD3F5.js} +6 -6
  33. package/bundle/{interactiveCli-MX3XGM22.js → interactiveCli-KSSJ4M5C.js} +6 -6
  34. package/bundle/{interactiveCli-HW4YWEAQ.js → interactiveCli-ZNAMZNEE.js} +272 -290
  35. package/bundle/{liteRtServerManager-KL7MAZ5X.js → liteRtServerManager-I6PXKOCJ.js} +3 -3
  36. package/bundle/{liteRtServerManager-NILBXAVA.js → liteRtServerManager-PG57YSDR.js} +3 -3
  37. package/bundle/{liteRtServerManager-AD5OLMNO.js → liteRtServerManager-QZCLWSIV.js} +4 -4
  38. package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
  39. package/bundle/{oauth2-provider-LZ7NU7ZH.js → oauth2-provider-356MTA5N.js} +1 -1
  40. package/bundle/{oauth2-provider-MXRZTMEV.js → oauth2-provider-MV6Q65XJ.js} +1 -1
  41. package/bundle/{oauth2-provider-VV252NYN.js → oauth2-provider-SWABWSBH.js} +73 -39
  42. package/bundle/{start-VKZA44K4.js → start-FWXRAXKY.js} +5 -5
  43. package/bundle/{start-KTHCOJMD.js → start-MWJKRZPA.js} +6 -6
  44. package/bundle/{start-MSGMQRMD.js → start-S2GPZKGW.js} +5 -5
  45. package/package.json +1 -1
  46. package/bundle/chunk-5GNAKSYI.js +0 -80034
  47. package/bundle/chunk-HIKQORHN.js +0 -118
  48. package/bundle/chunk-MPCJF2FJ.js +0 -156
  49. package/bundle/chunk-TK336BKU.js +0 -1571
  50. package/bundle/chunk-UWQLSUAM.js +0 -17656
  51. package/bundle/chunk-ZJCDIA3Q.js +0 -354496
  52. package/bundle/cleanup-IOXAJLSM.js +0 -33
  53. package/bundle/devtoolsService-IDBTYEA7.js +0 -857
  54. package/bundle/dist-TMQSX4TL.js +0 -2068
  55. package/bundle/gemini-ISRYY45M.js +0 -15988
  56. package/bundle/interactiveCli-5F2MHT43.js +0 -35052
  57. package/bundle/liteRtServerManager-YT5WSAHP.js +0 -65
  58. package/bundle/oauth2-provider-YUJLPZXD.js +0 -237
  59. package/bundle/start-O2KCVHVN.js +0 -18
@@ -1,65 +0,0 @@
1
- const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
- import {
3
- DEFAULT_PORT,
4
- getBinaryPath,
5
- isServerRunning
6
- } from "./chunk-RMXTIDND.js";
7
- import "./chunk-AZPVBKRA.js";
8
- import {
9
- debugLogger
10
- } from "./chunk-SAJ72M2G.js";
11
- import "./chunk-664ZODQF.js";
12
- import "./chunk-RJTRUG2J.js";
13
- import "./chunk-IUUIT4SU.js";
14
- import "./chunk-34MYV7JD.js";
15
-
16
- // packages/cli/src/services/liteRtServerManager.ts
17
- import fs from "node:fs";
18
- var LiteRtServerManager = class {
19
- static async ensureRunning(gemmaSettings) {
20
- if (!gemmaSettings?.enabled) return;
21
- if (gemmaSettings.autoStartServer === false) return;
22
- const binaryPath = getBinaryPath();
23
- if (!binaryPath || !fs.existsSync(binaryPath)) {
24
- debugLogger.log(
25
- '[LiteRtServerManager] Binary not installed, skipping auto-start. Run "gemini gemma setup".'
26
- );
27
- return;
28
- }
29
- const port = parseInt(
30
- gemmaSettings.classifier?.host?.match(/:(\d+)/)?.[1] ?? "",
31
- 10
32
- ) || DEFAULT_PORT;
33
- const running = await isServerRunning(port);
34
- if (running) {
35
- debugLogger.log(
36
- `[LiteRtServerManager] Server already running on port ${port}`
37
- );
38
- return;
39
- }
40
- debugLogger.log(
41
- `[LiteRtServerManager] Auto-starting LiteRT server on port ${port}...`
42
- );
43
- try {
44
- const { startServer } = await import("./start-MSGMQRMD.js");
45
- const started = await startServer(binaryPath, port);
46
- if (started) {
47
- debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);
48
- } else {
49
- debugLogger.warn(
50
- `[LiteRtServerManager] Server may not have started correctly on port ${port}`
51
- );
52
- }
53
- } catch (error) {
54
- debugLogger.warn("[LiteRtServerManager] Auto-start failed:", error);
55
- }
56
- }
57
- };
58
- export {
59
- LiteRtServerManager
60
- };
61
- /**
62
- * @license
63
- * Copyright 2026 Google LLC
64
- * SPDX-License-Identifier: Apache-2.0
65
- */
@@ -1,237 +0,0 @@
1
- const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
- import {
3
- BaseA2AAuthProvider,
4
- DefaultAgentCardResolver,
5
- MCPOAuthTokenStorage,
6
- buildAuthorizationUrl,
7
- exchangeCodeForToken,
8
- generatePKCEParams,
9
- getConsentForOauth,
10
- getPortFromUrl,
11
- openBrowserSecurely,
12
- refreshAccessToken,
13
- startCallbackServer
14
- } from "./chunk-ZJCDIA3Q.js";
15
- import {
16
- FatalCancellationError,
17
- Storage,
18
- coreEvents,
19
- debugLogger,
20
- getErrorMessage
21
- } from "./chunk-SAJ72M2G.js";
22
- import "./chunk-664ZODQF.js";
23
- import "./chunk-RJTRUG2J.js";
24
- import "./chunk-IUUIT4SU.js";
25
- import "./chunk-34MYV7JD.js";
26
-
27
- // packages/core/dist/src/agents/auth-provider/oauth2-provider.js
28
- var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
29
- config;
30
- agentName;
31
- agentCardUrl;
32
- type = "oauth2";
33
- tokenStorage;
34
- cachedToken = null;
35
- /** Resolved OAuth URLs — may come from config or agent card. */
36
- authorizationUrl;
37
- tokenUrl;
38
- scopes;
39
- constructor(config, agentName, agentCard, agentCardUrl) {
40
- super();
41
- this.config = config;
42
- this.agentName = agentName;
43
- this.agentCardUrl = agentCardUrl;
44
- this.tokenStorage = new MCPOAuthTokenStorage(Storage.getA2AOAuthTokensPath(), "gemini-cli-a2a");
45
- this.authorizationUrl = config.authorization_url;
46
- this.tokenUrl = config.token_url;
47
- this.scopes = config.scopes;
48
- this.mergeAgentCardDefaults(agentCard);
49
- }
50
- /**
51
- * Initialize the provider by loading any persisted token from storage.
52
- * Also discovers OAuth URLs from the agent card if not yet resolved.
53
- */
54
- async initialize() {
55
- if ((!this.authorizationUrl || !this.tokenUrl) && this.agentCardUrl) {
56
- await this.fetchAgentCardDefaults();
57
- }
58
- const credentials = await this.tokenStorage.getCredentials(this.agentName);
59
- if (credentials && !this.tokenStorage.isTokenExpired(credentials.token)) {
60
- this.cachedToken = credentials.token;
61
- debugLogger.debug(`[OAuth2AuthProvider] Loaded valid cached token for "${this.agentName}"`);
62
- }
63
- }
64
- /**
65
- * Return an Authorization header with a valid Bearer token.
66
- * Refreshes or triggers interactive auth as needed.
67
- */
68
- async headers() {
69
- if (this.cachedToken && !this.tokenStorage.isTokenExpired(this.cachedToken)) {
70
- return { Authorization: `Bearer ${this.cachedToken.accessToken}` };
71
- }
72
- if (this.cachedToken?.refreshToken && this.tokenUrl && this.config.client_id) {
73
- try {
74
- const refreshed = await refreshAccessToken({
75
- clientId: this.config.client_id,
76
- clientSecret: this.config.client_secret,
77
- scopes: this.scopes
78
- }, this.cachedToken.refreshToken, this.tokenUrl);
79
- this.cachedToken = this.toOAuthToken(refreshed, this.cachedToken.refreshToken);
80
- await this.persistToken();
81
- return { Authorization: `Bearer ${this.cachedToken.accessToken}` };
82
- } catch (error) {
83
- debugLogger.debug(`[OAuth2AuthProvider] Refresh failed, falling back to interactive flow: ${getErrorMessage(error)}`);
84
- await this.tokenStorage.deleteCredentials(this.agentName);
85
- }
86
- }
87
- this.cachedToken = await this.authenticateInteractively();
88
- return { Authorization: `Bearer ${this.cachedToken.accessToken}` };
89
- }
90
- /**
91
- * On 401/403, clear the cached token and re-authenticate (up to MAX_AUTH_RETRIES).
92
- */
93
- async shouldRetryWithHeaders(_req, res) {
94
- if (res.status !== 401 && res.status !== 403) {
95
- this.authRetryCount = 0;
96
- return void 0;
97
- }
98
- if (this.authRetryCount >= BaseA2AAuthProvider.MAX_AUTH_RETRIES) {
99
- return void 0;
100
- }
101
- this.authRetryCount++;
102
- debugLogger.debug("[OAuth2AuthProvider] Auth failure, clearing token and re-authenticating");
103
- this.cachedToken = null;
104
- await this.tokenStorage.deleteCredentials(this.agentName);
105
- return this.headers();
106
- }
107
- // ---------------------------------------------------------------------------
108
- // Private helpers
109
- // ---------------------------------------------------------------------------
110
- /**
111
- * Merge authorization_url, token_url, and scopes from the agent card's
112
- * `securitySchemes` when not already provided via user config.
113
- */
114
- mergeAgentCardDefaults(agentCard) {
115
- if (!agentCard?.securitySchemes)
116
- return;
117
- for (const scheme of Object.values(agentCard.securitySchemes)) {
118
- if (scheme.type === "oauth2" && scheme.flows.authorizationCode) {
119
- const flow = scheme.flows.authorizationCode;
120
- this.authorizationUrl ??= flow.authorizationUrl;
121
- this.tokenUrl ??= flow.tokenUrl;
122
- this.scopes ??= Object.keys(flow.scopes);
123
- break;
124
- }
125
- }
126
- }
127
- /**
128
- * Fetch the agent card from `agentCardUrl` using `DefaultAgentCardResolver`
129
- * (which normalizes proto-format cards) and extract OAuth2 URLs.
130
- */
131
- async fetchAgentCardDefaults() {
132
- if (!this.agentCardUrl)
133
- return;
134
- try {
135
- debugLogger.debug(`[OAuth2AuthProvider] Fetching agent card from ${this.agentCardUrl}`);
136
- const resolver = new DefaultAgentCardResolver();
137
- const card = await resolver.resolve(this.agentCardUrl, "");
138
- this.mergeAgentCardDefaults(card);
139
- } catch (error) {
140
- debugLogger.warn(`[OAuth2AuthProvider] Could not fetch agent card for OAuth URL discovery: ${getErrorMessage(error)}`);
141
- }
142
- }
143
- /**
144
- * Run a full OAuth 2.0 Authorization Code + PKCE flow through the browser.
145
- */
146
- async authenticateInteractively() {
147
- if (!this.config.client_id) {
148
- throw new Error(`OAuth2 authentication for agent "${this.agentName}" requires a client_id. Add client_id to the auth config in your agent definition.`);
149
- }
150
- if (!this.authorizationUrl || !this.tokenUrl) {
151
- throw new Error(`OAuth2 authentication for agent "${this.agentName}" requires authorization_url and token_url. Provide them in the auth config or ensure the agent card exposes an oauth2 security scheme.`);
152
- }
153
- const flowConfig = {
154
- clientId: this.config.client_id,
155
- clientSecret: this.config.client_secret,
156
- authorizationUrl: this.authorizationUrl,
157
- tokenUrl: this.tokenUrl,
158
- scopes: this.scopes
159
- };
160
- const pkceParams = generatePKCEParams();
161
- const preferredPort = getPortFromUrl(flowConfig.redirectUri);
162
- const callbackServer = startCallbackServer(pkceParams.state, preferredPort);
163
- const redirectPort = await callbackServer.port;
164
- const authUrl = buildAuthorizationUrl(
165
- flowConfig,
166
- pkceParams,
167
- redirectPort,
168
- /* resource= */
169
- void 0
170
- );
171
- const consent = await getConsentForOauth(`Authentication required for A2A agent: '${this.agentName}'.`);
172
- if (!consent) {
173
- throw new FatalCancellationError("Authentication cancelled by user.");
174
- }
175
- coreEvents.emitFeedback("info", `\u2192 Opening your browser for OAuth sign-in...
176
-
177
- If the browser does not open, copy and paste this URL into your browser:
178
- ${authUrl}
179
-
180
- \u{1F4A1} TIP: Triple-click to select the entire URL, then copy and paste it into your browser.
181
- \u26A0\uFE0F Make sure to copy the COMPLETE URL - it may wrap across multiple lines.`);
182
- try {
183
- await openBrowserSecurely(authUrl);
184
- } catch (error) {
185
- debugLogger.warn("Failed to open browser automatically:", getErrorMessage(error));
186
- }
187
- const { code } = await callbackServer.response;
188
- debugLogger.debug("\u2713 Authorization code received, exchanging for tokens...");
189
- const tokenResponse = await exchangeCodeForToken(
190
- flowConfig,
191
- code,
192
- pkceParams.codeVerifier,
193
- redirectPort,
194
- /* resource= */
195
- void 0
196
- );
197
- if (!tokenResponse.access_token) {
198
- throw new Error("No access token received from token endpoint");
199
- }
200
- const token = this.toOAuthToken(tokenResponse);
201
- this.cachedToken = token;
202
- await this.persistToken();
203
- debugLogger.debug("\u2713 OAuth2 authentication successful! Token saved.");
204
- return token;
205
- }
206
- /**
207
- * Convert an `OAuthTokenResponse` into the internal `OAuthToken` format.
208
- */
209
- toOAuthToken(response, fallbackRefreshToken) {
210
- const token = {
211
- accessToken: response.access_token,
212
- tokenType: response.token_type || "Bearer",
213
- refreshToken: response.refresh_token || fallbackRefreshToken,
214
- scope: response.scope
215
- };
216
- if (response.expires_in) {
217
- token.expiresAt = Date.now() + response.expires_in * 1e3;
218
- }
219
- return token;
220
- }
221
- /**
222
- * Persist the current cached token to disk.
223
- */
224
- async persistToken() {
225
- if (!this.cachedToken)
226
- return;
227
- await this.tokenStorage.saveToken(this.agentName, this.cachedToken, this.config.client_id, this.tokenUrl);
228
- }
229
- };
230
- export {
231
- OAuth2AuthProvider
232
- };
233
- /**
234
- * @license
235
- * Copyright 2026 Google LLC
236
- * SPDX-License-Identifier: Apache-2.0
237
- */
@@ -1,18 +0,0 @@
1
- const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
- import {
3
- startCommand,
4
- startServer
5
- } from "./chunk-WGF4IHWH.js";
6
- import "./chunk-DHIYDJUL.js";
7
- import "./chunk-QFA7YCIS.js";
8
- import "./chunk-MPCJF2FJ.js";
9
- import "./chunk-ZJCDIA3Q.js";
10
- import "./chunk-SAJ72M2G.js";
11
- import "./chunk-664ZODQF.js";
12
- import "./chunk-RJTRUG2J.js";
13
- import "./chunk-IUUIT4SU.js";
14
- import "./chunk-34MYV7JD.js";
15
- export {
16
- startCommand,
17
- startServer
18
- };