@google/gemini-cli 0.55.0-preview.1 → 0.55.0-preview.3
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-DMPPAMW5.js → chunk-2K3N3YWJ.js} +1 -1
- package/bundle/{chunk-F3GEJ37M.js → chunk-2YAEBNH4.js} +1 -1
- package/bundle/{chunk-G3NJ32VD.js → chunk-3JEIIDY3.js} +1 -1
- package/bundle/{chunk-YU5UI6S7.js → chunk-3KVUW3GS.js} +1 -1
- package/bundle/{chunk-3Q3RSCXS.js → chunk-4MK4F3LQ.js} +2 -2
- package/bundle/{chunk-SEQ766WD.js → chunk-4PVLKN7E.js} +1 -1
- package/bundle/{chunk-7LAM3MXG.js → chunk-5C4IPSFG.js} +1 -1
- package/bundle/{chunk-I535IUEN.js → chunk-6VBVRJ2T.js} +1 -1
- package/bundle/{chunk-LXWZUVJW.js → chunk-7U5FKJMS.js} +3 -3
- package/bundle/{chunk-GL46CQLD.js → chunk-BXJWVB6T.js} +7 -7
- package/bundle/chunk-CF6HJK4T.js +1571 -0
- package/bundle/{chunk-APDWRUAP.js → chunk-D7NKQXI3.js} +27 -14
- package/bundle/{chunk-AKJETY2D.js → chunk-DIJFIQU5.js} +9 -8
- package/bundle/{chunk-RXENTUH3.js → chunk-DW2J2NTU.js} +8 -5
- package/bundle/{chunk-UM7AN6ZZ.js → chunk-EBUEQDL4.js} +3 -3
- package/bundle/chunk-ENEDM4X3.js +512 -0
- package/bundle/{chunk-VHRT3UPF.js → chunk-ETEDB3N6.js} +2 -2
- package/bundle/{chunk-MWEFWYTU.js → chunk-FQNLDGXL.js} +1 -1
- package/bundle/{chunk-IBEJG5F5.js → chunk-GJBRSFPM.js} +7 -7
- package/bundle/{chunk-QQVXLF7U.js → chunk-IKOQM4YN.js} +3 -3
- package/bundle/chunk-MOTK2J3L.js +154 -0
- package/bundle/{chunk-A7NLEV6J.js → chunk-NQ7ACVH7.js} +2 -2
- package/bundle/{chunk-O6HG25DV.js → chunk-OKM3M2PX.js} +1 -1
- package/bundle/{chunk-TQPJD4W5.js → chunk-QJZS4YYR.js} +67 -54
- package/bundle/{chunk-KNRWWK34.js → chunk-QY6VB26P.js} +7659 -14286
- package/bundle/chunk-S35HA76T.js +398 -0
- package/bundle/chunk-V6HSKTFR.js +118 -0
- package/bundle/{chunk-G4NBAJCP.js → chunk-VPMDE76T.js} +46 -25
- package/bundle/chunk-WWUS7UCO.js +397244 -0
- package/bundle/{chunk-GPP3RO7B.js → chunk-XLLOEYE5.js} +1 -1
- package/bundle/chunk-XNQ2USVV.js +17332 -0
- package/bundle/chunk-YOSR3LGH.js +102505 -0
- package/bundle/{cleanup-2EQCXKR2.js → cleanup-6PJC7KVH.js} +2 -2
- package/bundle/{cleanup-CVITZEST.js → cleanup-AA32XASX.js} +2 -2
- package/bundle/{cleanup-JPURY2FN.js → cleanup-KJNT5CKE.js} +2 -2
- package/bundle/cleanup-W4XFBOYU.js +32 -0
- package/bundle/{core-M7EWVE7C.js → core-PJ4GTWLE.js} +1 -1
- package/bundle/{devtoolsService-LTCUHAKD.js → devtoolsService-BPCHKSK6.js} +2 -2
- package/bundle/{devtoolsService-2PJHOM3Z.js → devtoolsService-DDIV43LO.js} +2 -2
- package/bundle/{devtoolsService-G4J2W6MV.js → devtoolsService-SFT4J3TP.js} +4 -3
- package/bundle/devtoolsService-X4SBEWHU.js +4359 -0
- package/bundle/{dist-TXQI77ZL.js → dist-6SIQ6JNU.js} +1 -1
- package/bundle/{core-2KFPOGVU.js → dist-UVDHLJPD.js} +1 -1
- package/bundle/dist-VQ3F4FS5.js +2172 -0
- package/bundle/{gemini-QFKS36ZW.js → gemini-BMC63EGW.js} +14 -14
- package/bundle/{gemini-TOJXXBJZ.js → gemini-EYTXXZKY.js} +214 -198
- package/bundle/{gemini-4GL7B4FQ.js → gemini-MSC5T5EU.js} +14 -14
- package/bundle/gemini-PA23YMHK.js +17088 -0
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-NWP4ENQW.js → interactiveCli-5Y6AY63C.js} +67 -25
- package/bundle/{interactiveCli-UPSM5SHZ.js → interactiveCli-G6PWBLT5.js} +373 -312
- package/bundle/{interactiveCli-QFVYPM2G.js → interactiveCli-OUPTNZ47.js} +67 -25
- package/bundle/interactiveCli-T32DVN2I.js +34954 -0
- package/bundle/{liteRtServerManager-MU2XFPN4.js → liteRtServerManager-3MCOW5QD.js} +4 -4
- package/bundle/{liteRtServerManager-T2WZMOZK.js → liteRtServerManager-7IWRFNTW.js} +4 -4
- package/bundle/{liteRtServerManager-DILFQEEZ.js → liteRtServerManager-IRFTOINI.js} +4 -4
- package/bundle/liteRtServerManager-LVW27XGD.js +65 -0
- package/bundle/{oauth2-provider-VWRIMKTD.js → oauth2-provider-BPEC44QP.js} +1 -1
- package/bundle/{oauth2-provider-2QGZS53A.js → oauth2-provider-FSAA6HVA.js} +38 -72
- package/bundle/{oauth2-provider-QNQQSC5U.js → oauth2-provider-IVUO6NTZ.js} +1 -1
- package/bundle/oauth2-provider-PH6ZPS7W.js +235 -0
- package/bundle/{start-YV56XGWM.js → start-3M54SR5N.js} +6 -6
- package/bundle/{start-YWLQDUFC.js → start-EEVFRHCK.js} +6 -6
- package/bundle/{start-M7PLRASE.js → start-FC7N6JMG.js} +6 -6
- package/bundle/start-N5PPVI4S.js +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,398 @@
|
|
|
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
|
+
runExitCleanup
|
|
4
|
+
} from "./chunk-4PVLKN7E.js";
|
|
5
|
+
import {
|
|
6
|
+
RELEASE_CHANNEL_STABILITY,
|
|
7
|
+
debugLogger,
|
|
8
|
+
getChannelFromVersion,
|
|
9
|
+
isGitRepository
|
|
10
|
+
} from "./chunk-VPMDE76T.js";
|
|
11
|
+
|
|
12
|
+
// packages/cli/src/utils/installationInfo.ts
|
|
13
|
+
import * as fs from "node:fs";
|
|
14
|
+
import * as path from "node:path";
|
|
15
|
+
import * as childProcess from "node:child_process";
|
|
16
|
+
import process2 from "node:process";
|
|
17
|
+
var isDevelopment = process2.env["NODE_ENV"] === "development";
|
|
18
|
+
function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
|
|
19
|
+
const cliPath = process2.argv[1];
|
|
20
|
+
if (!cliPath) {
|
|
21
|
+
return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
if (process2.env["IS_BINARY"] === "true") {
|
|
25
|
+
return {
|
|
26
|
+
packageManager: "binary" /* BINARY */,
|
|
27
|
+
isGlobal: true,
|
|
28
|
+
updateMessage: "Running as a standalone binary. Please update by downloading the latest version from GitHub."
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const realPath = fs.realpathSync(cliPath).replace(/\\/g, "/");
|
|
32
|
+
const normalizedProjectRoot = projectRoot?.replace(/\\/g, "/");
|
|
33
|
+
const isGit = isGitRepository(process2.cwd());
|
|
34
|
+
if (isGit && normalizedProjectRoot && realPath.startsWith(normalizedProjectRoot) && !realPath.includes("/node_modules/")) {
|
|
35
|
+
return {
|
|
36
|
+
packageManager: "unknown" /* UNKNOWN */,
|
|
37
|
+
// Not managed by a package manager in this sense
|
|
38
|
+
isGlobal: false,
|
|
39
|
+
updateMessage: 'Running from a local git clone. Please update with "git pull".'
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (realPath.includes("/.npm/_npx") || realPath.includes("/npm/_npx")) {
|
|
43
|
+
return {
|
|
44
|
+
packageManager: "npx" /* NPX */,
|
|
45
|
+
isGlobal: false,
|
|
46
|
+
updateMessage: "Running via npx, update not applicable."
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (realPath.includes("/.pnpm/_pnpx") || realPath.includes("/.cache/pnpm/dlx")) {
|
|
50
|
+
return {
|
|
51
|
+
packageManager: "pnpx" /* PNPX */,
|
|
52
|
+
isGlobal: false,
|
|
53
|
+
updateMessage: "Running via pnpx, update not applicable."
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (process2.platform === "darwin") {
|
|
57
|
+
try {
|
|
58
|
+
const brewPrefix = childProcess.execSync("brew --prefix gemini-cli", {
|
|
59
|
+
encoding: "utf8",
|
|
60
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
61
|
+
}).trim();
|
|
62
|
+
const brewRealPath = fs.realpathSync(brewPrefix);
|
|
63
|
+
if (realPath.startsWith(brewRealPath)) {
|
|
64
|
+
return {
|
|
65
|
+
packageManager: "homebrew" /* HOMEBREW */,
|
|
66
|
+
isGlobal: true,
|
|
67
|
+
updateMessage: 'Installed via Homebrew. Please update with "brew upgrade gemini-cli".'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (realPath.includes("/.volta/") || realPath.includes("/Volta/")) {
|
|
74
|
+
const updateCommand2 = "volta install @google/gemini-cli@latest";
|
|
75
|
+
return {
|
|
76
|
+
packageManager: "volta" /* VOLTA */,
|
|
77
|
+
isGlobal: true,
|
|
78
|
+
updateCommand: updateCommand2,
|
|
79
|
+
updateMessage: isAutoUpdateEnabled ? "Installed with Volta. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (realPath.includes("/.pnpm/global") || realPath.includes("/.local/share/pnpm") || realPath.includes("/Library/pnpm/global/") || realPath.includes("/AppData/Local/pnpm/global/")) {
|
|
83
|
+
const updateCommand2 = "pnpm add -g @google/gemini-cli@latest";
|
|
84
|
+
return {
|
|
85
|
+
packageManager: "pnpm" /* PNPM */,
|
|
86
|
+
isGlobal: true,
|
|
87
|
+
updateCommand: updateCommand2,
|
|
88
|
+
updateMessage: isAutoUpdateEnabled ? "Installed with pnpm. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (realPath.includes("/.yarn/global")) {
|
|
92
|
+
const updateCommand2 = "yarn global add @google/gemini-cli@latest";
|
|
93
|
+
return {
|
|
94
|
+
packageManager: "yarn" /* YARN */,
|
|
95
|
+
isGlobal: true,
|
|
96
|
+
updateCommand: updateCommand2,
|
|
97
|
+
updateMessage: isAutoUpdateEnabled ? "Installed with yarn. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (realPath.includes("/.bun/install/cache")) {
|
|
101
|
+
return {
|
|
102
|
+
packageManager: "bunx" /* BUNX */,
|
|
103
|
+
isGlobal: false,
|
|
104
|
+
updateMessage: "Running via bunx, update not applicable."
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (realPath.includes("/.bun/install/global")) {
|
|
108
|
+
const updateCommand2 = "bun add -g @google/gemini-cli@latest";
|
|
109
|
+
return {
|
|
110
|
+
packageManager: "bun" /* BUN */,
|
|
111
|
+
isGlobal: true,
|
|
112
|
+
updateCommand: updateCommand2,
|
|
113
|
+
updateMessage: isAutoUpdateEnabled ? "Installed with bun. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (normalizedProjectRoot && realPath.startsWith(`${normalizedProjectRoot}/node_modules`)) {
|
|
117
|
+
let pm = "npm" /* NPM */;
|
|
118
|
+
if (fs.existsSync(path.join(projectRoot, "yarn.lock"))) {
|
|
119
|
+
pm = "yarn" /* YARN */;
|
|
120
|
+
} else if (fs.existsSync(path.join(projectRoot, "pnpm-lock.yaml"))) {
|
|
121
|
+
pm = "pnpm" /* PNPM */;
|
|
122
|
+
} else if (fs.existsSync(path.join(projectRoot, "bun.lockb"))) {
|
|
123
|
+
pm = "bun" /* BUN */;
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
packageManager: pm,
|
|
127
|
+
isGlobal: false,
|
|
128
|
+
updateMessage: "Locally installed. Please update via your project's package.json."
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
const updateCommand = "npm install -g @google/gemini-cli@latest";
|
|
132
|
+
return {
|
|
133
|
+
packageManager: "npm" /* NPM */,
|
|
134
|
+
isGlobal: true,
|
|
135
|
+
updateCommand,
|
|
136
|
+
updateMessage: isAutoUpdateEnabled ? "Installed with npm. Attempting to automatically update now..." : `Please run ${updateCommand} to update`
|
|
137
|
+
};
|
|
138
|
+
} catch (error) {
|
|
139
|
+
debugLogger.log(error);
|
|
140
|
+
return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// packages/cli/src/utils/updateEventEmitter.ts
|
|
145
|
+
import { EventEmitter } from "node:events";
|
|
146
|
+
var updateEventEmitter = new EventEmitter();
|
|
147
|
+
|
|
148
|
+
// packages/cli/src/utils/spawnWrapper.ts
|
|
149
|
+
import { spawn } from "node:child_process";
|
|
150
|
+
var spawnWrapper = spawn;
|
|
151
|
+
|
|
152
|
+
// packages/cli/src/utils/handleAutoUpdate.ts
|
|
153
|
+
var _updateInProgress = false;
|
|
154
|
+
async function waitForUpdateCompletion(timeoutMs = 3e4) {
|
|
155
|
+
if (!_updateInProgress) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
debugLogger.log(
|
|
159
|
+
"\nGemini CLI is waiting for a background update to complete before restarting..."
|
|
160
|
+
);
|
|
161
|
+
return new Promise((resolve) => {
|
|
162
|
+
if (!_updateInProgress) {
|
|
163
|
+
resolve();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const timer = setTimeout(cleanup, timeoutMs);
|
|
167
|
+
function cleanup() {
|
|
168
|
+
clearTimeout(timer);
|
|
169
|
+
updateEventEmitter.off("update-success", cleanup);
|
|
170
|
+
updateEventEmitter.off("update-failed", cleanup);
|
|
171
|
+
resolve();
|
|
172
|
+
}
|
|
173
|
+
updateEventEmitter.once("update-success", cleanup);
|
|
174
|
+
updateEventEmitter.once("update-failed", cleanup);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function handleAutoUpdate(info, settings, projectRoot, isSandboxEnabled, spawnFn = spawnWrapper) {
|
|
178
|
+
if (!info) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (isSandboxEnabled) {
|
|
182
|
+
updateEventEmitter.emit("update-info", {
|
|
183
|
+
message: `${info.message}
|
|
184
|
+
Automatic update is not available in sandbox mode.`
|
|
185
|
+
});
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (!settings.merged.general.enableAutoUpdateNotification) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const installationInfo = getInstallationInfo(
|
|
192
|
+
projectRoot,
|
|
193
|
+
settings.merged.general.enableAutoUpdate
|
|
194
|
+
);
|
|
195
|
+
if ([
|
|
196
|
+
"npx" /* NPX */,
|
|
197
|
+
"pnpx" /* PNPX */,
|
|
198
|
+
"bunx" /* BUNX */,
|
|
199
|
+
"binary" /* BINARY */
|
|
200
|
+
].includes(installationInfo.packageManager)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
let combinedMessage = info.message;
|
|
204
|
+
if (installationInfo.updateMessage) {
|
|
205
|
+
combinedMessage += `
|
|
206
|
+
${installationInfo.updateMessage}`;
|
|
207
|
+
}
|
|
208
|
+
if (!installationInfo.updateCommand || !settings.merged.general.enableAutoUpdate) {
|
|
209
|
+
updateEventEmitter.emit("update-received", {
|
|
210
|
+
...info,
|
|
211
|
+
message: combinedMessage,
|
|
212
|
+
isUpdating: false
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
updateEventEmitter.emit("update-received", {
|
|
217
|
+
...info,
|
|
218
|
+
message: combinedMessage,
|
|
219
|
+
isUpdating: true
|
|
220
|
+
});
|
|
221
|
+
if (_updateInProgress) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const currentVersion = info.update.current;
|
|
225
|
+
if (!currentVersion) {
|
|
226
|
+
debugLogger.warn(
|
|
227
|
+
"Update check: current version is missing. Skipping automatic update for safety."
|
|
228
|
+
);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const currentChannel = getChannelFromVersion(currentVersion);
|
|
232
|
+
const targetChannel = getChannelFromVersion(info.update.latest);
|
|
233
|
+
if (RELEASE_CHANNEL_STABILITY[targetChannel] < RELEASE_CHANNEL_STABILITY[currentChannel]) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const isNightly = info.update.latest.includes("nightly");
|
|
237
|
+
const updateCommand = installationInfo.updateCommand.replace(
|
|
238
|
+
"@latest",
|
|
239
|
+
isNightly ? "@nightly" : `@${info.update.latest}`
|
|
240
|
+
);
|
|
241
|
+
const updateProcess = spawnFn(updateCommand, {
|
|
242
|
+
stdio: "ignore",
|
|
243
|
+
shell: true,
|
|
244
|
+
detached: true
|
|
245
|
+
});
|
|
246
|
+
_updateInProgress = true;
|
|
247
|
+
updateProcess.unref();
|
|
248
|
+
updateProcess.on("close", (code) => {
|
|
249
|
+
_updateInProgress = false;
|
|
250
|
+
if (code === 0) {
|
|
251
|
+
updateEventEmitter.emit("update-success", {
|
|
252
|
+
message: "Update successful! The new version will be used on your next run."
|
|
253
|
+
});
|
|
254
|
+
} else {
|
|
255
|
+
updateEventEmitter.emit("update-failed", {
|
|
256
|
+
message: `Automatic update failed. Please try updating manually:
|
|
257
|
+
|
|
258
|
+
${updateCommand}`
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
updateProcess.on("error", (err) => {
|
|
263
|
+
_updateInProgress = false;
|
|
264
|
+
updateEventEmitter.emit("update-failed", {
|
|
265
|
+
message: `Automatic update failed. Please try updating manually. (error: ${err.message})
|
|
266
|
+
|
|
267
|
+
${updateCommand}`
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
return updateProcess;
|
|
271
|
+
}
|
|
272
|
+
function setUpdateHandler(addItem, setUpdateInfo) {
|
|
273
|
+
let successfullyInstalled = false;
|
|
274
|
+
const handleUpdateReceived = (info) => {
|
|
275
|
+
setUpdateInfo(info);
|
|
276
|
+
const savedMessage = info.message;
|
|
277
|
+
setTimeout(() => {
|
|
278
|
+
if (!successfullyInstalled) {
|
|
279
|
+
addItem(
|
|
280
|
+
{
|
|
281
|
+
type: "info" /* INFO */,
|
|
282
|
+
text: savedMessage
|
|
283
|
+
},
|
|
284
|
+
Date.now()
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
setUpdateInfo(null);
|
|
288
|
+
}, 6e4);
|
|
289
|
+
};
|
|
290
|
+
const handleUpdateFailed = (data) => {
|
|
291
|
+
setUpdateInfo(null);
|
|
292
|
+
addItem(
|
|
293
|
+
{
|
|
294
|
+
type: "error" /* ERROR */,
|
|
295
|
+
text: data?.message || `Automatic update failed. Please try updating manually`
|
|
296
|
+
},
|
|
297
|
+
Date.now()
|
|
298
|
+
);
|
|
299
|
+
};
|
|
300
|
+
const handleUpdateSuccess = () => {
|
|
301
|
+
successfullyInstalled = true;
|
|
302
|
+
setUpdateInfo(null);
|
|
303
|
+
addItem(
|
|
304
|
+
{
|
|
305
|
+
type: "info" /* INFO */,
|
|
306
|
+
text: `Update successful! The new version will be used on your next run.`
|
|
307
|
+
},
|
|
308
|
+
Date.now()
|
|
309
|
+
);
|
|
310
|
+
};
|
|
311
|
+
const handleUpdateInfo = (data) => {
|
|
312
|
+
addItem(
|
|
313
|
+
{
|
|
314
|
+
type: "info" /* INFO */,
|
|
315
|
+
text: data.message
|
|
316
|
+
},
|
|
317
|
+
Date.now()
|
|
318
|
+
);
|
|
319
|
+
};
|
|
320
|
+
updateEventEmitter.on("update-received", handleUpdateReceived);
|
|
321
|
+
updateEventEmitter.on("update-failed", handleUpdateFailed);
|
|
322
|
+
updateEventEmitter.on("update-success", handleUpdateSuccess);
|
|
323
|
+
updateEventEmitter.on("update-info", handleUpdateInfo);
|
|
324
|
+
return () => {
|
|
325
|
+
updateEventEmitter.off("update-received", handleUpdateReceived);
|
|
326
|
+
updateEventEmitter.off("update-failed", handleUpdateFailed);
|
|
327
|
+
updateEventEmitter.off("update-success", handleUpdateSuccess);
|
|
328
|
+
updateEventEmitter.off("update-info", handleUpdateInfo);
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// packages/cli/src/utils/processUtils.ts
|
|
333
|
+
var RELAUNCH_EXIT_CODE = 199;
|
|
334
|
+
var isRelaunching = false;
|
|
335
|
+
async function relaunchApp() {
|
|
336
|
+
if (isRelaunching) return;
|
|
337
|
+
isRelaunching = true;
|
|
338
|
+
await waitForUpdateCompletion();
|
|
339
|
+
await runExitCleanup();
|
|
340
|
+
process.exit(RELAUNCH_EXIT_CODE);
|
|
341
|
+
}
|
|
342
|
+
function isStandardSea() {
|
|
343
|
+
return process.argv[0] !== process.argv[1] && (process.env["IS_BINARY"] === "true" || process.isSea?.() === true);
|
|
344
|
+
}
|
|
345
|
+
function getScriptArgs() {
|
|
346
|
+
return process.argv.slice(isStandardSea() ? 1 : 2);
|
|
347
|
+
}
|
|
348
|
+
function isSeaEnvironment() {
|
|
349
|
+
return process.env["IS_BINARY"] === "true" || process.isSea?.() === true || process.argv[0] === process.argv[1];
|
|
350
|
+
}
|
|
351
|
+
function getSpawnConfig(nodeArgs, scriptArgs) {
|
|
352
|
+
const isBinary = isSeaEnvironment();
|
|
353
|
+
const newEnv = {
|
|
354
|
+
...process.env,
|
|
355
|
+
GEMINI_CLI_NO_RELAUNCH: "true"
|
|
356
|
+
};
|
|
357
|
+
const finalSpawnArgs = [];
|
|
358
|
+
if (isBinary) {
|
|
359
|
+
if (nodeArgs.length > 0) {
|
|
360
|
+
for (const arg of nodeArgs) {
|
|
361
|
+
if (/[\s"'\\]/.test(arg)) {
|
|
362
|
+
throw new Error(
|
|
363
|
+
`Unsupported node argument for SEA relaunch: ${arg}. Complex escaping is not supported.`
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
const existingNodeOptions = process.env["NODE_OPTIONS"] || "";
|
|
368
|
+
newEnv["NODE_OPTIONS"] = `${existingNodeOptions} ${nodeArgs.join(" ")}`.trim();
|
|
369
|
+
}
|
|
370
|
+
finalSpawnArgs.push(process.execPath, ...scriptArgs);
|
|
371
|
+
} else {
|
|
372
|
+
finalSpawnArgs.push(
|
|
373
|
+
...process.execArgv,
|
|
374
|
+
...nodeArgs,
|
|
375
|
+
process.argv[1],
|
|
376
|
+
...scriptArgs
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
spawnArgs: finalSpawnArgs,
|
|
381
|
+
env: newEnv
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export {
|
|
386
|
+
isDevelopment,
|
|
387
|
+
handleAutoUpdate,
|
|
388
|
+
setUpdateHandler,
|
|
389
|
+
RELAUNCH_EXIT_CODE,
|
|
390
|
+
relaunchApp,
|
|
391
|
+
getScriptArgs,
|
|
392
|
+
getSpawnConfig
|
|
393
|
+
};
|
|
394
|
+
/**
|
|
395
|
+
* @license
|
|
396
|
+
* Copyright 2025 Google LLC
|
|
397
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
398
|
+
*/
|
|
@@ -0,0 +1,118 @@
|
|
|
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-2YAEBNH4.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-XNQ2USVV.js";
|
|
18
|
+
import {
|
|
19
|
+
debugLogger
|
|
20
|
+
} from "./chunk-D7NKQXI3.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
|
+
*/
|
|
@@ -282830,8 +282830,8 @@ function isValidToolName(name3, options = {}) {
|
|
|
282830
282830
|
}
|
|
282831
282831
|
|
|
282832
282832
|
// packages/core/src/generated/git-commit.ts
|
|
282833
|
-
var GIT_COMMIT_INFO = "
|
|
282834
|
-
var CLI_VERSION = "0.55.0-
|
|
282833
|
+
var GIT_COMMIT_INFO = "da3710eb9";
|
|
282834
|
+
var CLI_VERSION = "0.55.0-preview.2";
|
|
282835
282835
|
|
|
282836
282836
|
// packages/core/src/ide/detect-ide.ts
|
|
282837
282837
|
var IDE_DEFINITIONS = {
|
|
@@ -306413,7 +306413,7 @@ function getVersion() {
|
|
|
306413
306413
|
}
|
|
306414
306414
|
versionPromise = (async () => {
|
|
306415
306415
|
const pkgJson = await getPackageJson(__dirname4);
|
|
306416
|
-
return "0.55.0-
|
|
306416
|
+
return "0.55.0-preview.2";
|
|
306417
306417
|
})();
|
|
306418
306418
|
return versionPromise;
|
|
306419
306419
|
}
|
|
@@ -307221,14 +307221,17 @@ function classifyGoogleError(error40) {
|
|
|
307221
307221
|
return new RetryableQuotaError(errorMessage, cause, retryDelaySeconds);
|
|
307222
307222
|
}
|
|
307223
307223
|
} else if (status2 === 429 || status2 === 499 || status2 === 503) {
|
|
307224
|
-
|
|
307225
|
-
|
|
307226
|
-
|
|
307227
|
-
|
|
307228
|
-
|
|
307229
|
-
|
|
307230
|
-
|
|
307231
|
-
)
|
|
307224
|
+
const cause = googleApiError ?? {
|
|
307225
|
+
code: status2,
|
|
307226
|
+
message: errorMessage,
|
|
307227
|
+
details: []
|
|
307228
|
+
};
|
|
307229
|
+
if (/exhausted your capacity|capacity exceeded|MODEL_CAPACITY_EXHAUSTED/i.test(
|
|
307230
|
+
errorMessage
|
|
307231
|
+
)) {
|
|
307232
|
+
return new TerminalQuotaError(errorMessage, cause);
|
|
307233
|
+
}
|
|
307234
|
+
return new RetryableQuotaError(errorMessage, cause);
|
|
307232
307235
|
}
|
|
307233
307236
|
return error40;
|
|
307234
307237
|
}
|
|
@@ -307260,7 +307263,7 @@ function classifyGoogleError(error40) {
|
|
|
307260
307263
|
}
|
|
307261
307264
|
}
|
|
307262
307265
|
if (errorInfo) {
|
|
307263
|
-
if (errorInfo.reason === "
|
|
307266
|
+
if (errorInfo.reason === "MODEL_CAPACITY_EXHAUSTED" || errorInfo.reason === "MODEL_CAPACITY_EXCEEDED") {
|
|
307264
307267
|
return new TerminalQuotaError(
|
|
307265
307268
|
googleApiError.message,
|
|
307266
307269
|
googleApiError,
|
|
@@ -307268,20 +307271,26 @@ function classifyGoogleError(error40) {
|
|
|
307268
307271
|
errorInfo.reason
|
|
307269
307272
|
);
|
|
307270
307273
|
}
|
|
307271
|
-
if (errorInfo.reason === "
|
|
307272
|
-
|
|
307273
|
-
|
|
307274
|
-
|
|
307275
|
-
|
|
307276
|
-
|
|
307277
|
-
|
|
307278
|
-
);
|
|
307279
|
-
}
|
|
307274
|
+
if (errorInfo.reason === "INSUFFICIENT_G1_CREDITS_BALANCE") {
|
|
307275
|
+
return new TerminalQuotaError(
|
|
307276
|
+
googleApiError.message,
|
|
307277
|
+
googleApiError,
|
|
307278
|
+
delaySeconds,
|
|
307279
|
+
errorInfo.reason
|
|
307280
|
+
);
|
|
307280
307281
|
}
|
|
307281
307282
|
if (errorInfo.domain) {
|
|
307282
307283
|
if (isCloudCodeDomain(errorInfo.domain)) {
|
|
307283
307284
|
if (errorInfo.reason === "RATE_LIMIT_EXCEEDED") {
|
|
307284
|
-
|
|
307285
|
+
if (delaySeconds === void 0) {
|
|
307286
|
+
return new TerminalQuotaError(
|
|
307287
|
+
googleApiError.message,
|
|
307288
|
+
googleApiError,
|
|
307289
|
+
void 0,
|
|
307290
|
+
errorInfo.reason
|
|
307291
|
+
);
|
|
307292
|
+
}
|
|
307293
|
+
const effectiveDelay = delaySeconds;
|
|
307285
307294
|
if (effectiveDelay > MAX_RETRYABLE_DELAY_SECONDS) {
|
|
307286
307295
|
return new TerminalQuotaError(
|
|
307287
307296
|
googleApiError.message,
|
|
@@ -307347,6 +307356,11 @@ Suggested retry after 60s.`,
|
|
|
307347
307356
|
);
|
|
307348
307357
|
}
|
|
307349
307358
|
}
|
|
307359
|
+
if (/exhausted your capacity|capacity exceeded|MODEL_CAPACITY_EXHAUSTED/i.test(
|
|
307360
|
+
errorMessage
|
|
307361
|
+
)) {
|
|
307362
|
+
return new TerminalQuotaError(errorMessage, googleApiError);
|
|
307363
|
+
}
|
|
307350
307364
|
return new RetryableQuotaError(errorMessage, googleApiError);
|
|
307351
307365
|
}
|
|
307352
307366
|
function extractErrorMessage(error40) {
|
|
@@ -341222,7 +341236,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
|
|
|
341222
341236
|
return provider;
|
|
341223
341237
|
}
|
|
341224
341238
|
case "oauth2": {
|
|
341225
|
-
const { OAuth2AuthProvider } = await import("./oauth2-provider-
|
|
341239
|
+
const { OAuth2AuthProvider } = await import("./oauth2-provider-IVUO6NTZ.js");
|
|
341226
341240
|
const provider = new OAuth2AuthProvider(
|
|
341227
341241
|
authConfig,
|
|
341228
341242
|
options.agentName ?? "unknown",
|
|
@@ -382797,6 +382811,9 @@ var Config = class {
|
|
|
382797
382811
|
this.modelAvailabilityService.reset();
|
|
382798
382812
|
}
|
|
382799
382813
|
activateFallbackMode(model, failedModel) {
|
|
382814
|
+
debugLogger.log(
|
|
382815
|
+
`Model fallback activated: switching from ${failedModel ?? "unknown"} to ${model}`
|
|
382816
|
+
);
|
|
382800
382817
|
if (this.getActiveModel() !== model) {
|
|
382801
382818
|
this.setModel(model, true);
|
|
382802
382819
|
}
|
|
@@ -383083,17 +383100,21 @@ var Config = class {
|
|
|
383083
383100
|
if (!bucket.modelId || bucket.remainingFraction == null) {
|
|
383084
383101
|
continue;
|
|
383085
383102
|
}
|
|
383103
|
+
let modelId = bucket.modelId;
|
|
383104
|
+
if (modelId === SECONDARY_GEMINI_3_5_FLASH_MODEL) {
|
|
383105
|
+
modelId = DEFAULT_GEMINI_3_5_FLASH_MODEL;
|
|
383106
|
+
}
|
|
383086
383107
|
let remaining;
|
|
383087
383108
|
let limit;
|
|
383088
383109
|
if (bucket.remainingAmount) {
|
|
383089
383110
|
remaining = parseInt(bucket.remainingAmount, 10);
|
|
383090
|
-
limit = bucket.remainingFraction > 0 ? Math.round(remaining / bucket.remainingFraction) : this.modelQuotas.get(
|
|
383111
|
+
limit = bucket.remainingFraction > 0 ? Math.round(remaining / bucket.remainingFraction) : this.modelQuotas.get(modelId)?.limit ?? 0;
|
|
383091
383112
|
} else {
|
|
383092
383113
|
limit = 100;
|
|
383093
383114
|
remaining = Math.round(bucket.remainingFraction * limit);
|
|
383094
383115
|
}
|
|
383095
383116
|
if (!isNaN(remaining) && Number.isFinite(limit) && limit > 0) {
|
|
383096
|
-
this.modelQuotas.set(
|
|
383117
|
+
this.modelQuotas.set(modelId, {
|
|
383097
383118
|
remaining,
|
|
383098
383119
|
limit,
|
|
383099
383120
|
resetTime: bucket.resetTime
|