@google/gemini-cli 0.67.0-nightly.20261104.g89e9d25d6 → 0.67.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 (74) hide show
  1. package/README.md +24 -18
  2. package/bundle/{chunk-TAYMSEDM.js → chunk-2E3ETS5J.js} +2 -2
  3. package/bundle/{chunk-2VRD7O3N.js → chunk-4JH2G4F4.js} +3 -3
  4. package/bundle/{chunk-AT7K3IZG.js → chunk-56IGTM4O.js} +1 -1
  5. package/bundle/{chunk-B2FKXXUH.js → chunk-5RNHNFYV.js} +106 -327
  6. package/bundle/{chunk-R7UEKGMB.js → chunk-7LX6MRZ6.js} +1 -1
  7. package/bundle/{chunk-HU3K5KGK.js → chunk-BW65QRZA.js} +11 -9
  8. package/bundle/{chunk-5WHCLVFH.js → chunk-CJFBYU4J.js} +157 -391
  9. package/bundle/{chunk-NMKJ47HQ.js → chunk-GBUWHRK6.js} +3 -3
  10. package/bundle/{chunk-VBHMFLBY.js → chunk-IDJ4QXBF.js} +1 -1
  11. package/bundle/{chunk-JMHCFAD6.js → chunk-IGE3G3WZ.js} +1 -1
  12. package/bundle/{chunk-RCF66HCI.js → chunk-LAR4JEC7.js} +1008 -1627
  13. package/bundle/{chunk-CXMHAFLN.js → chunk-M73CYIV5.js} +2 -2
  14. package/bundle/{chunk-TB5I5645.js → chunk-MQNW2IRI.js} +2 -2
  15. package/bundle/{chunk-DKKEYKSG.js → chunk-NGQU3QTQ.js} +996 -1558
  16. package/bundle/{chunk-VLYI5NP4.js → chunk-O7MGOE2I.js} +16023 -9466
  17. package/bundle/{chunk-RD2EMHV2.js → chunk-OJ62HCXG.js} +1 -1
  18. package/bundle/{chunk-HRM7UWGB.js → chunk-P62CI7AR.js} +11 -9
  19. package/bundle/{chunk-H3WGFU7D.js → chunk-PUNFASKY.js} +1 -1
  20. package/bundle/{chunk-L77QEOSK.js → chunk-QA5FT4VY.js} +3 -3
  21. package/bundle/{chunk-WY3X2UP2.js → chunk-QTXJG3I3.js} +8 -9
  22. package/bundle/{chunk-XBEZPOEF.js → chunk-VK766A3F.js} +1 -1
  23. package/bundle/{chunk-3DAQUNXR.js → chunk-VO6PFWLY.js} +15 -15
  24. package/bundle/{chunk-ILNZCTNC.js → chunk-XETHQLRU.js} +106 -327
  25. package/bundle/{chunk-7SSKD5HN.js → chunk-YUO7RUF4.js} +1 -1
  26. package/bundle/{cleanup-3ALSKRBJ.js → cleanup-B6AOSVD4.js} +2 -2
  27. package/bundle/{cleanup-6DVNSRQY.js → cleanup-BRFB47DL.js} +2 -2
  28. package/bundle/{cleanup-HRNPECKR.js → cleanup-S5QFYCEP.js} +2 -2
  29. package/bundle/{core-NQRKBS47.js → core-GTUUQBGE.js} +1 -3
  30. package/bundle/{dist-QYTQZ6QW.js → core-N27LU4DK.js} +1 -3
  31. package/bundle/{devtoolsService-EWNQDTC7.js → devtoolsService-6V46WMXX.js} +2 -2
  32. package/bundle/{devtoolsService-64TPRUWQ.js → devtoolsService-E74ZMDMM.js} +2 -2
  33. package/bundle/{devtoolsService-E6I4WSAL.js → devtoolsService-EFJXZRFD.js} +3 -4
  34. package/bundle/{dist-L5NYU7FF.js → dist-E6RCLXQU.js} +1 -3
  35. package/bundle/docs/changelogs/index.md +0 -24
  36. package/bundle/docs/changelogs/latest.md +90 -83
  37. package/bundle/docs/changelogs/preview.md +87 -89
  38. package/bundle/docs/cli/sandbox.md +2 -8
  39. package/bundle/docs/cli/themes.md +3 -6
  40. package/bundle/docs/extensions/releasing.md +0 -32
  41. package/bundle/docs/reference/configuration.md +10 -2
  42. package/bundle/{gemini-YFCTZ76S.js → gemini-4JPKPLQN.js} +24 -122
  43. package/bundle/{gemini-QAVNR7N4.js → gemini-QWDTSJTS.js} +209 -323
  44. package/bundle/{gemini-7USJ6MGR.js → gemini-VF5FS3OM.js} +24 -122
  45. package/bundle/gemini.js +7 -7
  46. package/bundle/{interactiveCli-X54KN2EM.js → interactiveCli-F2YYMYTP.js} +1145 -1350
  47. package/bundle/{interactiveCli-XN43CGES.js → interactiveCli-FQ3YKGOG.js} +1428 -1652
  48. package/bundle/{interactiveCli-3VTQP4GH.js → interactiveCli-QJZZISQQ.js} +1145 -1350
  49. package/bundle/{liteRtServerManager-E4PDEWY3.js → liteRtServerManager-27R2M6XE.js} +4 -4
  50. package/bundle/{liteRtServerManager-ENSSU4TN.js → liteRtServerManager-JAV3GR4V.js} +4 -4
  51. package/bundle/{liteRtServerManager-FLPMMDNM.js → liteRtServerManager-X5CCMKM6.js} +4 -4
  52. package/bundle/{oauth2-provider-3MJNDLJF.js → oauth2-provider-6UCP23AQ.js} +1 -1
  53. package/bundle/{oauth2-provider-VMBYZOC7.js → oauth2-provider-C65IJMNQ.js} +1 -1
  54. package/bundle/{oauth2-provider-ZIZQIT7D.js → oauth2-provider-H2KV36NU.js} +79 -41
  55. package/bundle/{start-B63MUWDV.js → start-E4ZL44QM.js} +6 -6
  56. package/bundle/{start-DFHM4HI4.js → start-GNOA75NQ.js} +6 -6
  57. package/bundle/{start-OHBUJSIL.js → start-K2AYYNST.js} +6 -6
  58. package/package.json +1 -1
  59. package/bundle/chunk-674DJGDU.js +0 -512
  60. package/bundle/chunk-M4REEHDQ.js +0 -185
  61. package/bundle/chunk-NOMIJA6W.js +0 -1956
  62. package/bundle/chunk-ORXIIXSA.js +0 -80453
  63. package/bundle/chunk-Q3OUSMTD.js +0 -39405
  64. package/bundle/chunk-Q76ZDILI.js +0 -118
  65. package/bundle/chunk-T6YNV33L.js +0 -1571
  66. package/bundle/chunk-YTSRA7S6.js +0 -403181
  67. package/bundle/cleanup-OQV2G5Y3.js +0 -34
  68. package/bundle/devtoolsService-PG47POWV.js +0 -4422
  69. package/bundle/dist-LJVRZOCO.js +0 -2298
  70. package/bundle/gemini-QVVNPYKF.js +0 -19271
  71. package/bundle/interactiveCli-ELN2VGHK.js +0 -35871
  72. package/bundle/liteRtServerManager-TYCQMNCE.js +0 -65
  73. package/bundle/oauth2-provider-NLSE3P5W.js +0 -273
  74. package/bundle/start-V3EP7MBL.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-HU3K5KGK.js";
7
- import "./chunk-674DJGDU.js";
8
- import {
9
- debugLogger
10
- } from "./chunk-YTSRA7S6.js";
11
- import "./chunk-664ZODQF.js";
12
- import "./chunk-IUUIT4SU.js";
13
- import "./chunk-L6PII3GR.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-V3EP7MBL.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,273 +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
- FatalCancellationError,
6
- MCPOAuthTokenStorage,
7
- Storage,
8
- buildAuthorizationUrl,
9
- coreEvents,
10
- debugLogger,
11
- exchangeCodeForToken,
12
- generatePKCEParams,
13
- getConsentForOauth,
14
- getErrorMessage,
15
- getPortFromUrl,
16
- openBrowserSecurely,
17
- refreshAccessToken,
18
- startCallbackServer
19
- } from "./chunk-DKKEYKSG.js";
20
- import "./chunk-664ZODQF.js";
21
- import "./chunk-IUUIT4SU.js";
22
- import "./chunk-L6PII3GR.js";
23
- import "./chunk-34MYV7JD.js";
24
-
25
- // packages/core/dist/src/agents/auth-provider/oauth2-provider.js
26
- var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
27
- config;
28
- agentName;
29
- agentCardUrl;
30
- type = "oauth2";
31
- tokenStorage;
32
- cachedToken = null;
33
- pendingAuthPromise = null;
34
- /** Resolved OAuth URLs — may come from config or agent card. */
35
- authorizationUrl;
36
- tokenUrl;
37
- scopes;
38
- constructor(config, agentName, agentCard, agentCardUrl) {
39
- super();
40
- this.config = config;
41
- this.agentName = agentName;
42
- this.agentCardUrl = agentCardUrl;
43
- this.tokenStorage = new MCPOAuthTokenStorage(Storage.getA2AOAuthTokensPath(), "gemini-cli-a2a");
44
- this.authorizationUrl = config.authorization_url;
45
- this.tokenUrl = config.token_url;
46
- this.scopes = config.scopes;
47
- this.mergeAgentCardDefaults(agentCard);
48
- }
49
- /**
50
- * Initialize the provider by loading any persisted token from storage.
51
- * Also discovers OAuth URLs from the agent card if not yet resolved.
52
- */
53
- async initialize() {
54
- if ((!this.authorizationUrl || !this.tokenUrl) && this.agentCardUrl) {
55
- await this.fetchAgentCardDefaults();
56
- }
57
- const credentials = await this.tokenStorage.getCredentials(this.agentName);
58
- if (credentials && !this.tokenStorage.isTokenExpired(credentials.token)) {
59
- this.cachedToken = credentials.token;
60
- debugLogger.debug(`[OAuth2AuthProvider] Loaded valid cached token for "${this.agentName}"`);
61
- }
62
- }
63
- /**
64
- * Return an Authorization header with a valid Bearer token.
65
- * Refreshes or triggers interactive auth as needed, deduplicating concurrent requests.
66
- */
67
- async headers() {
68
- if (this.cachedToken && !this.tokenStorage.isTokenExpired(this.cachedToken)) {
69
- this.authRetryCount = 0;
70
- return { Authorization: `Bearer ${this.cachedToken.accessToken}` };
71
- }
72
- if (!this.pendingAuthPromise) {
73
- this.pendingAuthPromise = this.acquireToken().finally(() => {
74
- this.pendingAuthPromise = null;
75
- });
76
- }
77
- const token = await this.pendingAuthPromise;
78
- this.authRetryCount = 0;
79
- return { Authorization: `Bearer ${token.accessToken}` };
80
- }
81
- /**
82
- * Refresh an expired token or run interactive browser-based authentication.
83
- */
84
- async acquireToken() {
85
- if (this.cachedToken?.refreshToken && this.tokenUrl && this.config.client_id) {
86
- try {
87
- const refreshed = await refreshAccessToken({
88
- clientId: this.config.client_id,
89
- clientSecret: this.config.client_secret,
90
- scopes: this.scopes
91
- }, this.cachedToken.refreshToken, this.tokenUrl);
92
- this.cachedToken = this.toOAuthToken(refreshed, this.cachedToken.refreshToken);
93
- await this.persistToken();
94
- return this.cachedToken;
95
- } catch (error) {
96
- debugLogger.debug(`[OAuth2AuthProvider] Refresh failed, falling back to interactive flow: ${getErrorMessage(error)}`);
97
- this.cachedToken = null;
98
- await this.tokenStorage.deleteCredentials(this.agentName);
99
- }
100
- }
101
- this.cachedToken = await this.authenticateInteractively();
102
- return this.cachedToken;
103
- }
104
- /**
105
- * Return the maximum number of consecutive authentication retries allowed.
106
- */
107
- getMaxAuthRetries() {
108
- return BaseA2AAuthProvider.MAX_AUTH_RETRIES;
109
- }
110
- /**
111
- * On 401/403, clear the cached token and re-authenticate (up to MAX_AUTH_RETRIES).
112
- */
113
- async shouldRetryWithHeaders(req, res) {
114
- if (res.status !== 401 && res.status !== 403) {
115
- this.authRetryCount = 0;
116
- return void 0;
117
- }
118
- const reqHeaders = new Headers(req.headers);
119
- const reqToken = reqHeaders.get("Authorization")?.split(" ")[1];
120
- if (reqToken && (!this.cachedToken || reqToken !== this.cachedToken.accessToken)) {
121
- debugLogger.debug("[OAuth2AuthProvider] Token already cleared or updated by another request, retrying with new token");
122
- const retryCount = this.authRetryCount;
123
- const headers2 = await this.headers();
124
- this.authRetryCount = Math.max(this.authRetryCount, retryCount);
125
- return headers2;
126
- }
127
- if (this.authRetryCount >= this.getMaxAuthRetries()) {
128
- return void 0;
129
- }
130
- const nextRetryCount = this.authRetryCount + 1;
131
- this.authRetryCount = nextRetryCount;
132
- debugLogger.debug("[OAuth2AuthProvider] Auth failure, clearing token and re-authenticating");
133
- this.cachedToken = null;
134
- await this.tokenStorage.deleteCredentials(this.agentName);
135
- const headers = await this.headers();
136
- this.authRetryCount = nextRetryCount;
137
- return headers;
138
- }
139
- // ---------------------------------------------------------------------------
140
- // Private helpers
141
- // ---------------------------------------------------------------------------
142
- /**
143
- * Merge authorization_url, token_url, and scopes from the agent card's
144
- * `securitySchemes` when not already provided via user config.
145
- */
146
- mergeAgentCardDefaults(agentCard) {
147
- if (!agentCard?.securitySchemes)
148
- return;
149
- for (const scheme of Object.values(agentCard.securitySchemes)) {
150
- if (scheme.type === "oauth2" && scheme.flows.authorizationCode) {
151
- const flow = scheme.flows.authorizationCode;
152
- this.authorizationUrl ??= flow.authorizationUrl;
153
- this.tokenUrl ??= flow.tokenUrl;
154
- this.scopes ??= Object.keys(flow.scopes);
155
- break;
156
- }
157
- }
158
- }
159
- /**
160
- * Fetch the agent card from `agentCardUrl` using `DefaultAgentCardResolver`
161
- * (which normalizes proto-format cards) and extract OAuth2 URLs.
162
- */
163
- async fetchAgentCardDefaults() {
164
- if (!this.agentCardUrl)
165
- return;
166
- try {
167
- debugLogger.debug(`[OAuth2AuthProvider] Fetching agent card from ${this.agentCardUrl}`);
168
- const resolver = new DefaultAgentCardResolver();
169
- const card = await resolver.resolve(this.agentCardUrl, "");
170
- this.mergeAgentCardDefaults(card);
171
- } catch (error) {
172
- debugLogger.warn(`[OAuth2AuthProvider] Could not fetch agent card for OAuth URL discovery: ${getErrorMessage(error)}`);
173
- }
174
- }
175
- /**
176
- * Run a full OAuth 2.0 Authorization Code + PKCE flow through the browser.
177
- */
178
- async authenticateInteractively() {
179
- if (!this.config.client_id) {
180
- throw new Error(`OAuth2 authentication for agent "${this.agentName}" requires a client_id. Add client_id to the auth config in your agent definition.`);
181
- }
182
- if (!this.authorizationUrl || !this.tokenUrl) {
183
- 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.`);
184
- }
185
- const flowConfig = {
186
- clientId: this.config.client_id,
187
- clientSecret: this.config.client_secret,
188
- authorizationUrl: this.authorizationUrl,
189
- tokenUrl: this.tokenUrl,
190
- scopes: this.scopes
191
- };
192
- const pkceParams = generatePKCEParams();
193
- const preferredPort = getPortFromUrl(flowConfig.redirectUri);
194
- const callbackServer = startCallbackServer(pkceParams.state, preferredPort);
195
- const redirectPort = await callbackServer.port;
196
- const authUrl = buildAuthorizationUrl(
197
- flowConfig,
198
- pkceParams,
199
- redirectPort,
200
- /* resource= */
201
- void 0
202
- );
203
- const consent = await getConsentForOauth(`Authentication required for A2A agent: '${this.agentName}'.`);
204
- if (!consent) {
205
- const cancelError = new FatalCancellationError("Authentication cancelled by user.");
206
- callbackServer.response.catch(() => {
207
- });
208
- callbackServer.cancel?.(cancelError);
209
- throw cancelError;
210
- }
211
- coreEvents.emitFeedback("info", `\u2192 Opening your browser for OAuth sign-in...
212
-
213
- If the browser does not open, copy and paste this URL into your browser:
214
- ${authUrl}
215
-
216
- \u{1F4A1} TIP: Triple-click to select the entire URL, then copy and paste it into your browser.
217
- \u26A0\uFE0F Make sure to copy the COMPLETE URL - it may wrap across multiple lines.`);
218
- try {
219
- await openBrowserSecurely(authUrl);
220
- } catch (error) {
221
- debugLogger.warn("Failed to open browser automatically:", getErrorMessage(error));
222
- }
223
- const { code } = await callbackServer.response;
224
- debugLogger.debug("\u2713 Authorization code received, exchanging for tokens...");
225
- const tokenResponse = await exchangeCodeForToken(
226
- flowConfig,
227
- code,
228
- pkceParams.codeVerifier,
229
- redirectPort,
230
- /* resource= */
231
- void 0
232
- );
233
- if (!tokenResponse.access_token) {
234
- throw new Error("No access token received from token endpoint");
235
- }
236
- const token = this.toOAuthToken(tokenResponse);
237
- this.cachedToken = token;
238
- await this.persistToken();
239
- debugLogger.debug("\u2713 OAuth2 authentication successful! Token saved.");
240
- return token;
241
- }
242
- /**
243
- * Convert an `OAuthTokenResponse` into the internal `OAuthToken` format.
244
- */
245
- toOAuthToken(response, fallbackRefreshToken) {
246
- const token = {
247
- accessToken: response.access_token,
248
- tokenType: response.token_type || "Bearer",
249
- refreshToken: response.refresh_token || fallbackRefreshToken,
250
- scope: response.scope
251
- };
252
- if (response.expires_in) {
253
- token.expiresAt = Date.now() + response.expires_in * 1e3;
254
- }
255
- return token;
256
- }
257
- /**
258
- * Persist the current cached token to disk.
259
- */
260
- async persistToken() {
261
- if (!this.cachedToken)
262
- return;
263
- await this.tokenStorage.saveToken(this.agentName, this.cachedToken, this.config.client_id, this.tokenUrl);
264
- }
265
- };
266
- export {
267
- OAuth2AuthProvider
268
- };
269
- /**
270
- * @license
271
- * Copyright 2026 Google LLC
272
- * SPDX-License-Identifier: Apache-2.0
273
- */
@@ -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-NMKJ47HQ.js";
6
- import "./chunk-R7UEKGMB.js";
7
- import "./chunk-HU3K5KGK.js";
8
- import "./chunk-674DJGDU.js";
9
- import "./chunk-H3WGFU7D.js";
10
- import "./chunk-YTSRA7S6.js";
11
- import "./chunk-664ZODQF.js";
12
- import "./chunk-IUUIT4SU.js";
13
- import "./chunk-L6PII3GR.js";
14
- import "./chunk-34MYV7JD.js";
15
- export {
16
- startCommand,
17
- startServer
18
- };