@google/gemini-cli 0.71.0-nightly.20261123.geecccfcd5 → 0.72.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-74F5ZRXI.js → chunk-2LHOWVR4.js} +2 -2
- package/bundle/{chunk-NBZ3S2OI.js → chunk-357SHFSP.js} +1 -1
- package/bundle/{chunk-DNLZQS6M.js → chunk-5URPLR2H.js} +1 -1
- package/bundle/{chunk-6FOUJKOM.js → chunk-7554FKWM.js} +4 -4
- package/bundle/{chunk-YHOSX4HX.js → chunk-7ZTBMXIU.js} +2 -2
- package/bundle/{chunk-L2ISE4LK.js → chunk-AJWHZBWZ.js} +6 -8
- package/bundle/{chunk-66M6QVYR.js → chunk-BRYTKVAX.js} +4 -4
- package/bundle/{chunk-DWF6VLET.js → chunk-BZ5FSDRR.js} +3 -3
- package/bundle/{chunk-6MLLHGAR.js → chunk-CIX33OUZ.js} +2 -2
- package/bundle/{chunk-3IQPEEFT.js → chunk-DDPEWL4G.js} +1 -1
- package/bundle/{chunk-RJEQTG6S.js → chunk-DIMNI6AC.js} +2 -2
- package/bundle/{chunk-QADAHCRT.js → chunk-ENSJIXBN.js} +1 -1
- package/bundle/{chunk-L2B5JJZC.js → chunk-EUWUJXIY.js} +1 -1
- package/bundle/{chunk-BTUHEN4Y.js → chunk-IGFGTPGV.js} +1 -1
- package/bundle/{chunk-YYWNIP3F.js → chunk-JTWV2RYT.js} +1 -1
- package/bundle/{chunk-GNXMAFUR.js → chunk-MNOSCPOM.js} +7 -7
- package/bundle/{chunk-A3SNIZ4K.js → chunk-N4ZMA5CZ.js} +1 -1
- package/bundle/{chunk-BVNLNGFD.js → chunk-QESC7SGF.js} +7 -7
- package/bundle/{chunk-4DJQWGT3.js → chunk-SJKJH5QA.js} +1 -1
- package/bundle/{chunk-QWS2TBZG.js → chunk-SMYIRL3Y.js} +3 -3
- package/bundle/{chunk-3OVOJOQV.js → chunk-TLQ4STKV.js} +58 -71
- package/bundle/{chunk-YEEWGYBU.js → chunk-UUAR3JIA.js} +2 -2
- package/bundle/{chunk-EUUDSNXQ.js → chunk-WHSJKDVL.js} +1 -1
- package/bundle/{chunk-PL6IIPTX.js → chunk-XER4IQTC.js} +1 -1
- package/bundle/{chunk-NLZKOWER.js → chunk-Y2AE7RGI.js} +8 -9
- package/bundle/{chunk-6NXCSVSN.js → chunk-YFNHROPZ.js} +15422 -8067
- package/bundle/{chunk-SLTPPXVT.js → chunk-Z4LLSOJM.js} +3 -3
- package/bundle/{cleanup-JXHWEYF4.js → cleanup-A7CTJL7Z.js} +2 -2
- package/bundle/{cleanup-NXI65SJI.js → cleanup-ACKRM2TX.js} +2 -2
- package/bundle/{cleanup-PQFQN5PN.js → cleanup-DSTWENO3.js} +2 -2
- package/bundle/{dist-YWJAC3IM.js → core-3V44EMV6.js} +1 -1
- package/bundle/{core-DQSJHYG4.js → core-UF6OK2YN.js} +1 -1
- package/bundle/{devtoolsService-CVJOOHGM.js → devtoolsService-7MR7MUMD.js} +2 -2
- package/bundle/{devtoolsService-NOXMAH56.js → devtoolsService-NP7EGEMK.js} +2 -2
- package/bundle/{devtoolsService-UZFFGBEG.js → devtoolsService-Q5HYPUU7.js} +3 -4
- package/bundle/{dist-G5K3DGI7.js → dist-J3MSC3FF.js} +1 -1
- package/bundle/{formatError-CAMIQWHM.js → formatError-EFFRJTZP.js} +2 -2
- package/bundle/{formatError-PB6SEHWE.js → formatError-RG2BTO6O.js} +2 -2
- package/bundle/{formatError-Q33TSKEK.js → formatError-RZ6FNHFK.js} +2 -2
- package/bundle/{gemini-QKY2KKYF.js → gemini-5N7SJRYD.js} +208 -224
- package/bundle/{gemini-TQYJRVJP.js → gemini-DQYZ2M5M.js} +14 -14
- package/bundle/{gemini-OAKFBKMR.js → gemini-NGMQM6D3.js} +15 -15
- package/bundle/gemini.js +8 -8
- package/bundle/{interactiveCli-L5IOZTYF.js → interactiveCli-3QAMPJPK.js} +8 -8
- package/bundle/{interactiveCli-3FEZU7GJ.js → interactiveCli-DBUWQW3L.js} +300 -319
- package/bundle/{interactiveCli-W4IK4C6F.js → interactiveCli-M2IE6ZF4.js} +8 -8
- package/bundle/{liteRtServerManager-7GQLUYCC.js → liteRtServerManager-LX6B5CI3.js} +4 -4
- package/bundle/{liteRtServerManager-GSYRGOB6.js → liteRtServerManager-TI6LO5RU.js} +4 -4
- package/bundle/{liteRtServerManager-TVKXINGU.js → liteRtServerManager-TW3MMGOA.js} +4 -4
- package/bundle/{oauth2-provider-XADKJYM3.js → oauth2-provider-2JRAM5FI.js} +1 -1
- package/bundle/{oauth2-provider-JAYH53PG.js → oauth2-provider-3PBBHV75.js} +1 -1
- package/bundle/{oauth2-provider-LZKJKLFG.js → oauth2-provider-PG5AFZDD.js} +79 -41
- package/bundle/{start-4GERR54C.js → start-2XM3XTTW.js} +6 -6
- package/bundle/{start-5Q2AJMC5.js → start-HGHTVHPT.js} +6 -6
- package/bundle/{start-7ZXOELXX.js → start-TDNB5CJ6.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-5VAAW2SW.js +0 -118
- package/bundle/chunk-CPZ55WK4.js +0 -40031
- package/bundle/chunk-GPIHTZ7M.js +0 -190
- package/bundle/chunk-IOX7QOR4.js +0 -1962
- package/bundle/chunk-M2J4XK5W.js +0 -60338
- package/bundle/chunk-OSBXDFYN.js +0 -512
- package/bundle/chunk-TE62WOO3.js +0 -65
- package/bundle/chunk-VTIY77BF.js +0 -1571
- package/bundle/chunk-Y3VJ5NLZ.js +0 -420386
- package/bundle/cleanup-UNQWTWUR.js +0 -34
- package/bundle/devtoolsService-OCTFSUNQ.js +0 -919
- package/bundle/dist-GPX2ZA4V.js +0 -2372
- package/bundle/formatError-QRSNJJ27.js +0 -14
- package/bundle/gemini-Z66TS6IL.js +0 -20021
- package/bundle/interactiveCli-DBDBYD65.js +0 -36447
- package/bundle/liteRtServerManager-YUBDDMLI.js +0 -65
- package/bundle/oauth2-provider-ZOXGSM7Y.js +0 -273
- package/bundle/start-O7HDURUW.js +0 -18
|
@@ -149,10 +149,10 @@ import {
|
|
|
149
149
|
useUIState,
|
|
150
150
|
useVimMode,
|
|
151
151
|
validateAuthMethod
|
|
152
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-MNOSCPOM.js";
|
|
153
153
|
import {
|
|
154
154
|
require_source
|
|
155
|
-
} from "./chunk-
|
|
155
|
+
} from "./chunk-N4ZMA5CZ.js";
|
|
156
156
|
import {
|
|
157
157
|
appEvents
|
|
158
158
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -226,25 +226,25 @@ import {
|
|
|
226
226
|
widestLineFromStyledChars,
|
|
227
227
|
wordBreakStyledChars,
|
|
228
228
|
wrapStyledChars
|
|
229
|
-
} from "./chunk-
|
|
229
|
+
} from "./chunk-7ZTBMXIU.js";
|
|
230
230
|
import {
|
|
231
231
|
handleAutoUpdate,
|
|
232
232
|
isDevelopment,
|
|
233
233
|
relaunchApp,
|
|
234
234
|
require_semver,
|
|
235
235
|
setUpdateHandler
|
|
236
|
-
} from "./chunk-
|
|
236
|
+
} from "./chunk-CIX33OUZ.js";
|
|
237
237
|
import {
|
|
238
238
|
isTodoList,
|
|
239
239
|
mapCoreStatusToDisplayStatus,
|
|
240
240
|
require_react
|
|
241
|
-
} from "./chunk-
|
|
241
|
+
} from "./chunk-357SHFSP.js";
|
|
242
242
|
import {
|
|
243
243
|
registerCleanup,
|
|
244
244
|
removeCleanup,
|
|
245
245
|
runExitCleanup,
|
|
246
246
|
setupTtyCheck
|
|
247
|
-
} from "./chunk-
|
|
247
|
+
} from "./chunk-IGFGTPGV.js";
|
|
248
248
|
import {
|
|
249
249
|
ACTIVATE_SKILL_TOOL_NAME,
|
|
250
250
|
AGENT_TOOL_NAME,
|
|
@@ -466,7 +466,7 @@ import {
|
|
|
466
466
|
validatePlanContent,
|
|
467
467
|
validatePlanPath,
|
|
468
468
|
writeToStdout
|
|
469
|
-
} from "./chunk-
|
|
469
|
+
} from "./chunk-BRYTKVAX.js";
|
|
470
470
|
import "./chunk-W2AJR23G.js";
|
|
471
471
|
import "./chunk-N7J54YNL.js";
|
|
472
472
|
import "./chunk-L6PII3GR.js";
|
|
@@ -35410,7 +35410,7 @@ ${queuedText}` : queuedText;
|
|
|
35410
35410
|
if (keyMatchers["app.showErrorDetails" /* SHOW_ERROR_DETAILS */](key)) {
|
|
35411
35411
|
if (settings.merged.general.devtools) {
|
|
35412
35412
|
void (async () => {
|
|
35413
|
-
const { toggleDevToolsPanel } = await import("./devtoolsService-
|
|
35413
|
+
const { toggleDevToolsPanel } = await import("./devtoolsService-7MR7MUMD.js");
|
|
35414
35414
|
await toggleDevToolsPanel(
|
|
35415
35415
|
config,
|
|
35416
35416
|
showErrorDetails,
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
DEFAULT_PORT,
|
|
4
4
|
getBinaryPath,
|
|
5
5
|
isServerRunning
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-7ZTBMXIU.js";
|
|
7
|
+
import "./chunk-357SHFSP.js";
|
|
8
8
|
import {
|
|
9
9
|
debugLogger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BRYTKVAX.js";
|
|
11
11
|
import "./chunk-W2AJR23G.js";
|
|
12
12
|
import "./chunk-N7J54YNL.js";
|
|
13
13
|
import "./chunk-L6PII3GR.js";
|
|
@@ -41,7 +41,7 @@ var LiteRtServerManager = class {
|
|
|
41
41
|
`[LiteRtServerManager] Auto-starting LiteRT server on port ${port}...`
|
|
42
42
|
);
|
|
43
43
|
try {
|
|
44
|
-
const { startServer } = await import("./start-
|
|
44
|
+
const { startServer } = await import("./start-TDNB5CJ6.js");
|
|
45
45
|
const started = await startServer(binaryPath, port);
|
|
46
46
|
if (started) {
|
|
47
47
|
debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
DEFAULT_PORT,
|
|
4
4
|
getBinaryPath,
|
|
5
5
|
isServerRunning
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-2LHOWVR4.js";
|
|
7
|
+
import "./chunk-Y2AE7RGI.js";
|
|
8
8
|
import {
|
|
9
9
|
debugLogger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7554FKWM.js";
|
|
11
11
|
import "./chunk-W2AJR23G.js";
|
|
12
12
|
import "./chunk-N7J54YNL.js";
|
|
13
13
|
import "./chunk-L6PII3GR.js";
|
|
@@ -41,7 +41,7 @@ var LiteRtServerManager = class {
|
|
|
41
41
|
`[LiteRtServerManager] Auto-starting LiteRT server on port ${port}...`
|
|
42
42
|
);
|
|
43
43
|
try {
|
|
44
|
-
const { startServer } = await import("./start-
|
|
44
|
+
const { startServer } = await import("./start-HGHTVHPT.js");
|
|
45
45
|
const started = await startServer(binaryPath, port);
|
|
46
46
|
if (started) {
|
|
47
47
|
debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
DEFAULT_PORT,
|
|
4
4
|
getBinaryPath,
|
|
5
5
|
isServerRunning
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-AJWHZBWZ.js";
|
|
7
|
+
import "./chunk-JTWV2RYT.js";
|
|
8
8
|
import {
|
|
9
9
|
debugLogger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YFNHROPZ.js";
|
|
11
11
|
import "./chunk-W2AJR23G.js";
|
|
12
12
|
import "./chunk-N7J54YNL.js";
|
|
13
13
|
import "./chunk-L6PII3GR.js";
|
|
@@ -41,7 +41,7 @@ var LiteRtServerManager = class {
|
|
|
41
41
|
`[LiteRtServerManager] Auto-starting LiteRT server on port ${port}...`
|
|
42
42
|
);
|
|
43
43
|
try {
|
|
44
|
-
const { startServer } = await import("./start-
|
|
44
|
+
const { startServer } = await import("./start-2XM3XTTW.js");
|
|
45
45
|
const started = await startServer(binaryPath, port);
|
|
46
46
|
if (started) {
|
|
47
47
|
debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);
|
|
@@ -16,36 +16,36 @@ import {
|
|
|
16
16
|
openBrowserSecurely,
|
|
17
17
|
refreshAccessToken,
|
|
18
18
|
startCallbackServer
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-7554FKWM.js";
|
|
20
20
|
import "./chunk-W2AJR23G.js";
|
|
21
21
|
import "./chunk-N7J54YNL.js";
|
|
22
22
|
import "./chunk-L6PII3GR.js";
|
|
23
23
|
import "./chunk-34MYV7JD.js";
|
|
24
24
|
|
|
25
|
-
// packages/core/
|
|
25
|
+
// packages/core/src/agents/auth-provider/oauth2-provider.ts
|
|
26
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
27
|
constructor(config, agentName, agentCard, agentCardUrl) {
|
|
39
28
|
super();
|
|
40
29
|
this.config = config;
|
|
41
30
|
this.agentName = agentName;
|
|
42
31
|
this.agentCardUrl = agentCardUrl;
|
|
43
|
-
this.tokenStorage = new MCPOAuthTokenStorage(
|
|
32
|
+
this.tokenStorage = new MCPOAuthTokenStorage(
|
|
33
|
+
Storage.getA2AOAuthTokensPath(),
|
|
34
|
+
"gemini-cli-a2a"
|
|
35
|
+
);
|
|
44
36
|
this.authorizationUrl = config.authorization_url;
|
|
45
37
|
this.tokenUrl = config.token_url;
|
|
46
38
|
this.scopes = config.scopes;
|
|
47
39
|
this.mergeAgentCardDefaults(agentCard);
|
|
48
40
|
}
|
|
41
|
+
type = "oauth2";
|
|
42
|
+
tokenStorage;
|
|
43
|
+
cachedToken = null;
|
|
44
|
+
pendingAuthPromise = null;
|
|
45
|
+
/** Resolved OAuth URLs — may come from config or agent card. */
|
|
46
|
+
authorizationUrl;
|
|
47
|
+
tokenUrl;
|
|
48
|
+
scopes;
|
|
49
49
|
/**
|
|
50
50
|
* Initialize the provider by loading any persisted token from storage.
|
|
51
51
|
* Also discovers OAuth URLs from the agent card if not yet resolved.
|
|
@@ -57,7 +57,9 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
|
|
|
57
57
|
const credentials = await this.tokenStorage.getCredentials(this.agentName);
|
|
58
58
|
if (credentials && !this.tokenStorage.isTokenExpired(credentials.token)) {
|
|
59
59
|
this.cachedToken = credentials.token;
|
|
60
|
-
debugLogger.debug(
|
|
60
|
+
debugLogger.debug(
|
|
61
|
+
`[OAuth2AuthProvider] Loaded valid cached token for "${this.agentName}"`
|
|
62
|
+
);
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
@@ -84,16 +86,25 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
|
|
|
84
86
|
async acquireToken() {
|
|
85
87
|
if (this.cachedToken?.refreshToken && this.tokenUrl && this.config.client_id) {
|
|
86
88
|
try {
|
|
87
|
-
const refreshed = await refreshAccessToken(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
const refreshed = await refreshAccessToken(
|
|
90
|
+
{
|
|
91
|
+
clientId: this.config.client_id,
|
|
92
|
+
clientSecret: this.config.client_secret,
|
|
93
|
+
scopes: this.scopes
|
|
94
|
+
},
|
|
95
|
+
this.cachedToken.refreshToken,
|
|
96
|
+
this.tokenUrl
|
|
97
|
+
);
|
|
98
|
+
this.cachedToken = this.toOAuthToken(
|
|
99
|
+
refreshed,
|
|
100
|
+
this.cachedToken.refreshToken
|
|
101
|
+
);
|
|
93
102
|
await this.persistToken();
|
|
94
103
|
return this.cachedToken;
|
|
95
104
|
} catch (error) {
|
|
96
|
-
debugLogger.debug(
|
|
105
|
+
debugLogger.debug(
|
|
106
|
+
`[OAuth2AuthProvider] Refresh failed, falling back to interactive flow: ${getErrorMessage(error)}`
|
|
107
|
+
);
|
|
97
108
|
this.cachedToken = null;
|
|
98
109
|
await this.tokenStorage.deleteCredentials(this.agentName);
|
|
99
110
|
}
|
|
@@ -118,7 +129,9 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
|
|
|
118
129
|
const reqHeaders = new Headers(req.headers);
|
|
119
130
|
const reqToken = reqHeaders.get("Authorization")?.split(" ")[1];
|
|
120
131
|
if (reqToken && (!this.cachedToken || reqToken !== this.cachedToken.accessToken)) {
|
|
121
|
-
debugLogger.debug(
|
|
132
|
+
debugLogger.debug(
|
|
133
|
+
"[OAuth2AuthProvider] Token already cleared or updated by another request, retrying with new token"
|
|
134
|
+
);
|
|
122
135
|
const retryCount = this.authRetryCount;
|
|
123
136
|
const headers2 = await this.headers();
|
|
124
137
|
this.authRetryCount = Math.max(this.authRetryCount, retryCount);
|
|
@@ -129,7 +142,9 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
|
|
|
129
142
|
}
|
|
130
143
|
const nextRetryCount = this.authRetryCount + 1;
|
|
131
144
|
this.authRetryCount = nextRetryCount;
|
|
132
|
-
debugLogger.debug(
|
|
145
|
+
debugLogger.debug(
|
|
146
|
+
"[OAuth2AuthProvider] Auth failure, clearing token and re-authenticating"
|
|
147
|
+
);
|
|
133
148
|
this.cachedToken = null;
|
|
134
149
|
await this.tokenStorage.deleteCredentials(this.agentName);
|
|
135
150
|
const headers = await this.headers();
|
|
@@ -144,8 +159,7 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
|
|
|
144
159
|
* `securitySchemes` when not already provided via user config.
|
|
145
160
|
*/
|
|
146
161
|
mergeAgentCardDefaults(agentCard) {
|
|
147
|
-
if (!agentCard?.securitySchemes)
|
|
148
|
-
return;
|
|
162
|
+
if (!agentCard?.securitySchemes) return;
|
|
149
163
|
for (const scheme of Object.values(agentCard.securitySchemes)) {
|
|
150
164
|
if (scheme.type === "oauth2" && scheme.flows.authorizationCode) {
|
|
151
165
|
const flow = scheme.flows.authorizationCode;
|
|
@@ -161,15 +175,18 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
|
|
|
161
175
|
* (which normalizes proto-format cards) and extract OAuth2 URLs.
|
|
162
176
|
*/
|
|
163
177
|
async fetchAgentCardDefaults() {
|
|
164
|
-
if (!this.agentCardUrl)
|
|
165
|
-
return;
|
|
178
|
+
if (!this.agentCardUrl) return;
|
|
166
179
|
try {
|
|
167
|
-
debugLogger.debug(
|
|
180
|
+
debugLogger.debug(
|
|
181
|
+
`[OAuth2AuthProvider] Fetching agent card from ${this.agentCardUrl}`
|
|
182
|
+
);
|
|
168
183
|
const resolver = new DefaultAgentCardResolver();
|
|
169
184
|
const card = await resolver.resolve(this.agentCardUrl, "");
|
|
170
185
|
this.mergeAgentCardDefaults(card);
|
|
171
186
|
} catch (error) {
|
|
172
|
-
debugLogger.warn(
|
|
187
|
+
debugLogger.warn(
|
|
188
|
+
`[OAuth2AuthProvider] Could not fetch agent card for OAuth URL discovery: ${getErrorMessage(error)}`
|
|
189
|
+
);
|
|
173
190
|
}
|
|
174
191
|
}
|
|
175
192
|
/**
|
|
@@ -177,10 +194,14 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
|
|
|
177
194
|
*/
|
|
178
195
|
async authenticateInteractively() {
|
|
179
196
|
if (!this.config.client_id) {
|
|
180
|
-
throw new Error(
|
|
197
|
+
throw new Error(
|
|
198
|
+
`OAuth2 authentication for agent "${this.agentName}" requires a client_id. Add client_id to the auth config in your agent definition.`
|
|
199
|
+
);
|
|
181
200
|
}
|
|
182
201
|
if (!this.authorizationUrl || !this.tokenUrl) {
|
|
183
|
-
throw new Error(
|
|
202
|
+
throw new Error(
|
|
203
|
+
`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.`
|
|
204
|
+
);
|
|
184
205
|
}
|
|
185
206
|
const flowConfig = {
|
|
186
207
|
clientId: this.config.client_id,
|
|
@@ -199,29 +220,42 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
|
|
|
199
220
|
redirectPort,
|
|
200
221
|
/* resource= */
|
|
201
222
|
void 0
|
|
223
|
+
// No MCP resource parameter for A2A.
|
|
224
|
+
);
|
|
225
|
+
const consent = await getConsentForOauth(
|
|
226
|
+
`Authentication required for A2A agent: '${this.agentName}'.`
|
|
202
227
|
);
|
|
203
|
-
const consent = await getConsentForOauth(`Authentication required for A2A agent: '${this.agentName}'.`);
|
|
204
228
|
if (!consent) {
|
|
205
|
-
const cancelError = new FatalCancellationError(
|
|
229
|
+
const cancelError = new FatalCancellationError(
|
|
230
|
+
"Authentication cancelled by user."
|
|
231
|
+
);
|
|
206
232
|
callbackServer.response.catch(() => {
|
|
207
233
|
});
|
|
208
234
|
callbackServer.cancel?.(cancelError);
|
|
209
235
|
throw cancelError;
|
|
210
236
|
}
|
|
211
|
-
coreEvents.emitFeedback(
|
|
237
|
+
coreEvents.emitFeedback(
|
|
238
|
+
"info",
|
|
239
|
+
`\u2192 Opening your browser for OAuth sign-in...
|
|
212
240
|
|
|
213
241
|
If the browser does not open, copy and paste this URL into your browser:
|
|
214
242
|
${authUrl}
|
|
215
243
|
|
|
216
244
|
\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.`
|
|
245
|
+
\u26A0\uFE0F Make sure to copy the COMPLETE URL - it may wrap across multiple lines.`
|
|
246
|
+
);
|
|
218
247
|
try {
|
|
219
248
|
await openBrowserSecurely(authUrl);
|
|
220
249
|
} catch (error) {
|
|
221
|
-
debugLogger.warn(
|
|
250
|
+
debugLogger.warn(
|
|
251
|
+
"Failed to open browser automatically:",
|
|
252
|
+
getErrorMessage(error)
|
|
253
|
+
);
|
|
222
254
|
}
|
|
223
255
|
const { code } = await callbackServer.response;
|
|
224
|
-
debugLogger.debug(
|
|
256
|
+
debugLogger.debug(
|
|
257
|
+
"\u2713 Authorization code received, exchanging for tokens..."
|
|
258
|
+
);
|
|
225
259
|
const tokenResponse = await exchangeCodeForToken(
|
|
226
260
|
flowConfig,
|
|
227
261
|
code,
|
|
@@ -258,9 +292,13 @@ ${authUrl}
|
|
|
258
292
|
* Persist the current cached token to disk.
|
|
259
293
|
*/
|
|
260
294
|
async persistToken() {
|
|
261
|
-
if (!this.cachedToken)
|
|
262
|
-
|
|
263
|
-
|
|
295
|
+
if (!this.cachedToken) return;
|
|
296
|
+
await this.tokenStorage.saveToken(
|
|
297
|
+
this.agentName,
|
|
298
|
+
this.cachedToken,
|
|
299
|
+
this.config.client_id,
|
|
300
|
+
this.tokenUrl
|
|
301
|
+
);
|
|
264
302
|
}
|
|
265
303
|
};
|
|
266
304
|
export {
|
|
@@ -2,12 +2,12 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
startCommand,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-BZ5FSDRR.js";
|
|
6
|
+
import "./chunk-SJKJH5QA.js";
|
|
7
|
+
import "./chunk-AJWHZBWZ.js";
|
|
8
|
+
import "./chunk-JTWV2RYT.js";
|
|
9
|
+
import "./chunk-WHSJKDVL.js";
|
|
10
|
+
import "./chunk-YFNHROPZ.js";
|
|
11
11
|
import "./chunk-W2AJR23G.js";
|
|
12
12
|
import "./chunk-N7J54YNL.js";
|
|
13
13
|
import "./chunk-L6PII3GR.js";
|
|
@@ -2,12 +2,12 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
startCommand,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-Z4LLSOJM.js";
|
|
6
|
+
import "./chunk-EUWUJXIY.js";
|
|
7
|
+
import "./chunk-2LHOWVR4.js";
|
|
8
|
+
import "./chunk-Y2AE7RGI.js";
|
|
9
|
+
import "./chunk-DDPEWL4G.js";
|
|
10
|
+
import "./chunk-7554FKWM.js";
|
|
11
11
|
import "./chunk-W2AJR23G.js";
|
|
12
12
|
import "./chunk-N7J54YNL.js";
|
|
13
13
|
import "./chunk-L6PII3GR.js";
|
|
@@ -2,12 +2,12 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
startCommand,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-SMYIRL3Y.js";
|
|
6
|
+
import "./chunk-N4ZMA5CZ.js";
|
|
7
|
+
import "./chunk-7ZTBMXIU.js";
|
|
8
|
+
import "./chunk-357SHFSP.js";
|
|
9
|
+
import "./chunk-IGFGTPGV.js";
|
|
10
|
+
import "./chunk-BRYTKVAX.js";
|
|
11
11
|
import "./chunk-W2AJR23G.js";
|
|
12
12
|
import "./chunk-N7J54YNL.js";
|
|
13
13
|
import "./chunk-L6PII3GR.js";
|
package/package.json
CHANGED
package/bundle/chunk-5VAAW2SW.js
DELETED
|
@@ -1,118 +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
|
-
exitCli,
|
|
4
|
-
require_source
|
|
5
|
-
} from "./chunk-4DJQWGT3.js";
|
|
6
|
-
import {
|
|
7
|
-
DEFAULT_PORT,
|
|
8
|
-
SERVER_START_WAIT_MS,
|
|
9
|
-
getBinaryPath,
|
|
10
|
-
getLiteRtBinDir,
|
|
11
|
-
getLogFilePath,
|
|
12
|
-
getPidFilePath,
|
|
13
|
-
isBinaryInstalled,
|
|
14
|
-
isServerRunning,
|
|
15
|
-
resolveGemmaConfig,
|
|
16
|
-
writeServerProcessInfo
|
|
17
|
-
} from "./chunk-CPZ55WK4.js";
|
|
18
|
-
import {
|
|
19
|
-
debugLogger
|
|
20
|
-
} from "./chunk-Y3VJ5NLZ.js";
|
|
21
|
-
import {
|
|
22
|
-
__toESM
|
|
23
|
-
} from "./chunk-34MYV7JD.js";
|
|
24
|
-
|
|
25
|
-
// packages/cli/src/commands/gemma/start.ts
|
|
26
|
-
var import_chalk = __toESM(require_source(), 1);
|
|
27
|
-
import fs from "node:fs";
|
|
28
|
-
import path from "node:path";
|
|
29
|
-
import { spawn } from "node:child_process";
|
|
30
|
-
async function startServer(binaryPath, port) {
|
|
31
|
-
const alreadyRunning = await isServerRunning(port);
|
|
32
|
-
if (alreadyRunning) {
|
|
33
|
-
debugLogger.log(`LiteRT server already running on port ${port}`);
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
const logPath = getLogFilePath();
|
|
37
|
-
fs.mkdirSync(getLiteRtBinDir(), { recursive: true });
|
|
38
|
-
const tmpDir = path.dirname(getPidFilePath());
|
|
39
|
-
fs.mkdirSync(tmpDir, { recursive: true });
|
|
40
|
-
const logFd = fs.openSync(logPath, "a");
|
|
41
|
-
try {
|
|
42
|
-
const child = spawn(binaryPath, ["serve", `--port=${port}`, "--verbose"], {
|
|
43
|
-
detached: true,
|
|
44
|
-
stdio: ["ignore", logFd, logFd]
|
|
45
|
-
});
|
|
46
|
-
if (child.pid) {
|
|
47
|
-
writeServerProcessInfo({
|
|
48
|
-
pid: child.pid,
|
|
49
|
-
binaryPath,
|
|
50
|
-
port
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
child.unref();
|
|
54
|
-
} finally {
|
|
55
|
-
fs.closeSync(logFd);
|
|
56
|
-
}
|
|
57
|
-
await new Promise((resolve) => setTimeout(resolve, SERVER_START_WAIT_MS));
|
|
58
|
-
return isServerRunning(port);
|
|
59
|
-
}
|
|
60
|
-
var startCommand = {
|
|
61
|
-
command: "start",
|
|
62
|
-
describe: "Start the LiteRT-LM server",
|
|
63
|
-
builder: (yargs) => yargs.option("port", {
|
|
64
|
-
type: "number",
|
|
65
|
-
description: "Port for the LiteRT server"
|
|
66
|
-
}),
|
|
67
|
-
handler: async (argv) => {
|
|
68
|
-
let port;
|
|
69
|
-
if (argv["port"] !== void 0) {
|
|
70
|
-
port = Number(argv["port"]);
|
|
71
|
-
}
|
|
72
|
-
if (!port) {
|
|
73
|
-
const { configuredPort } = resolveGemmaConfig(DEFAULT_PORT);
|
|
74
|
-
port = configuredPort;
|
|
75
|
-
}
|
|
76
|
-
const binaryPath = getBinaryPath();
|
|
77
|
-
if (!binaryPath || !isBinaryInstalled(binaryPath)) {
|
|
78
|
-
debugLogger.error(
|
|
79
|
-
import_chalk.default.red(
|
|
80
|
-
'LiteRT-LM binary not found. Run "gemini gemma setup" first.'
|
|
81
|
-
)
|
|
82
|
-
);
|
|
83
|
-
await exitCli(1);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const alreadyRunning = await isServerRunning(port);
|
|
87
|
-
if (alreadyRunning) {
|
|
88
|
-
debugLogger.log(
|
|
89
|
-
import_chalk.default.green(`LiteRT server is already running on port ${port}.`)
|
|
90
|
-
);
|
|
91
|
-
await exitCli(0);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
debugLogger.log(`Starting LiteRT server on port ${port}...`);
|
|
95
|
-
const started = await startServer(binaryPath, port);
|
|
96
|
-
if (started) {
|
|
97
|
-
debugLogger.log(import_chalk.default.green(`LiteRT server started on port ${port}.`));
|
|
98
|
-
debugLogger.log(import_chalk.default.dim(`Logs: ${getLogFilePath()}`));
|
|
99
|
-
await exitCli(0);
|
|
100
|
-
} else {
|
|
101
|
-
debugLogger.error(
|
|
102
|
-
import_chalk.default.red("Server may not have started correctly. Check logs:")
|
|
103
|
-
);
|
|
104
|
-
debugLogger.error(import_chalk.default.dim(` ${getLogFilePath()}`));
|
|
105
|
-
await exitCli(1);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export {
|
|
111
|
-
startServer,
|
|
112
|
-
startCommand
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* @license
|
|
116
|
-
* Copyright 2026 Google LLC
|
|
117
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
118
|
-
*/
|