@google/gemini-cli 0.36.0-preview.7 → 0.37.0-preview.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.
- package/bundle/{chunk-NYCY3Q2B.js → chunk-3TN4SOLW.js} +6652 -4181
- package/bundle/{chunk-S2IQOR7T.js → chunk-7UZ4Y32N.js} +214 -66
- package/bundle/{chunk-2RCLDWUX.js → chunk-A62NZYIK.js} +8052 -2969
- package/bundle/{chunk-VA3P26WZ.js → chunk-LEK5YYAR.js} +6296 -4095
- package/bundle/{chunk-MYI75E6G.js → chunk-R5X4CMUM.js} +233 -70
- package/bundle/{chunk-EHC7O4TG.js → chunk-TJ76C6AA.js} +16848 -9497
- package/bundle/chunk-U4FACSVX.js +30 -0
- package/bundle/{chunk-APAYS2LE.js → chunk-ULC3DHVX.js} +8052 -2969
- package/bundle/{chunk-YTGZ6CSI.js → chunk-XX7JYMTE.js} +8106 -3035
- package/bundle/{core-BHH4RB6L.js → core-5OME6LT4.js} +58 -4
- package/bundle/{dist-SWQPYLLV.js → core-CUCGSGCA.js} +58 -4
- package/bundle/{devtoolsService-STAWBGOY.js → devtoolsService-4FIYD6OW.js} +20 -3
- package/bundle/{devtoolsService-GJALET3B.js → devtoolsService-IDLWLZFQ.js} +21 -5
- package/bundle/{devtoolsService-4QGIZO5B.js → devtoolsService-TVWW3DBW.js} +20 -3
- package/bundle/{dist-YOBWJF52.js → dist-YWCADMDD.js} +58 -4
- package/bundle/docs/CONTRIBUTING.md +10 -7
- package/bundle/docs/assets/theme-tokyonight-dark.png +0 -0
- package/bundle/docs/changelogs/index.md +24 -0
- package/bundle/docs/changelogs/latest.md +366 -459
- package/bundle/docs/changelogs/preview.md +362 -356
- package/bundle/docs/cli/acp-mode.md +126 -0
- package/bundle/docs/cli/cli-reference.md +1 -1
- package/bundle/docs/cli/notifications.md +5 -5
- package/bundle/docs/cli/plan-mode.md +12 -8
- package/bundle/docs/cli/sandbox.md +1 -1
- package/bundle/docs/cli/settings.md +14 -13
- package/bundle/docs/cli/themes.md +5 -0
- package/bundle/docs/core/index.md +2 -2
- package/bundle/docs/core/subagents.md +134 -23
- package/bundle/docs/get-started/gemini-3.md +1 -1
- package/bundle/docs/get-started/index.md +127 -1
- package/bundle/docs/ide-integration/index.md +99 -24
- package/bundle/docs/index.md +0 -2
- package/bundle/docs/redirects.json +1 -0
- package/bundle/docs/reference/commands.md +1 -3
- package/bundle/docs/reference/configuration.md +183 -92
- package/bundle/docs/reference/keyboard-shortcuts.md +14 -6
- package/bundle/docs/reference/policy-engine.md +16 -30
- package/bundle/docs/reference/tools.md +56 -23
- package/bundle/docs/resources/quota-and-pricing.md +23 -9
- package/bundle/docs/sidebar.json +11 -4
- package/bundle/docs/tools/planning.md +6 -4
- package/bundle/events-CLX3JQHP.js +12 -0
- package/bundle/gemini.js +342 -52
- package/bundle/{interactiveCli-YJFA3P4G.js → interactiveCli-4WFWOVAQ.js} +5079 -4022
- package/bundle/{interactiveCli-MEBWWWE7.js → interactiveCli-4ZZ72DR3.js} +5079 -4022
- package/bundle/{interactiveCli-B6Y3UISW.js → interactiveCli-6SIGBRWS.js} +5292 -4252
- package/bundle/{memoryDiscovery-BQGYT4OD.js → memoryDiscovery-NS2EGHYH.js} +3 -1
- package/bundle/{memoryDiscovery-FCEPFZ3M.js → memoryDiscovery-VL3OH25S.js} +3 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js +26 -19
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.d.ts +1 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js +1 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js.map +1 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js +35 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js.map +1 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-TIKPJAVU.js → oauth2-provider-HGHECKPY.js} +2 -2
- package/bundle/{oauth2-provider-IGY3DL3D.js → oauth2-provider-TYBJKXSJ.js} +2 -2
- package/bundle/{oauth2-provider-DLPX23GY.js → oauth2-provider-YYRJ44X5.js} +73 -39
- package/bundle/policies/discovered.toml +7 -0
- package/bundle/policies/non-interactive.toml +7 -0
- package/bundle/policies/plan.toml +25 -0
- package/bundle/policies/read-only.toml +6 -0
- package/bundle/policies/sandbox-default.toml +3 -2
- package/bundle/policies/write.toml +21 -0
- package/bundle/policies/yolo.toml +1 -1
- package/package.json +1 -1
- package/bundle/chunk-GDBDMLKR.js +0 -354180
- package/bundle/chunk-QTVUHTZR.js +0 -93293
- package/bundle/devtoolsService-Q6LGZKTJ.js +0 -854
- package/bundle/dist-YHAAIIZP.js +0 -1886
- package/bundle/docs/get-started/examples.md +0 -141
- package/bundle/interactiveCli-HYY2W6AF.js +0 -49298
- package/bundle/oauth2-provider-MKUXMD5I.js +0 -237
|
@@ -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-VA3P26WZ.js";
|
|
15
|
-
import {
|
|
16
|
-
FatalCancellationError,
|
|
17
|
-
Storage,
|
|
18
|
-
coreEvents,
|
|
19
|
-
debugLogger,
|
|
20
|
-
getErrorMessage
|
|
21
|
-
} from "./chunk-S2IQOR7T.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
|
-
*/
|