@google/gemini-cli 0.70.0-preview.0 → 0.71.0-nightly.20261120.gd4cb1713f

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 (77) hide show
  1. package/bundle/{chunk-O5EBPO5F.js → chunk-22NLCXU3.js} +2 -2
  2. package/bundle/{chunk-SXOGAWDG.js → chunk-3DBVNRC7.js} +1 -1
  3. package/bundle/{chunk-F6P6PQSG.js → chunk-3VKSDKQA.js} +1 -1
  4. package/bundle/{chunk-65MRMUKB.js → chunk-43QQPZRQ.js} +2 -2
  5. package/bundle/{chunk-NFBC76U4.js → chunk-4FKCNBUM.js} +1 -1
  6. package/bundle/{chunk-CJ7YZ55P.js → chunk-4SEHQOPY.js} +3 -3
  7. package/bundle/{chunk-BOYVA4SV.js → chunk-4V6FXIV7.js} +1 -1
  8. package/bundle/{chunk-ZUQTNDGH.js → chunk-4YWPS6WG.js} +7 -7
  9. package/bundle/{chunk-STY67ND2.js → chunk-6VJSIYX5.js} +9 -8
  10. package/bundle/{chunk-TX3SX2WI.js → chunk-7CGFKAQQ.js} +2 -2
  11. package/bundle/{chunk-CMUPNBQQ.js → chunk-7WRW57EW.js} +2 -2
  12. package/bundle/{chunk-I5QSCSQU.js → chunk-AQR7HAVC.js} +878 -371
  13. package/bundle/{chunk-T7277DWX.js → chunk-AWAS7A4U.js} +1 -1
  14. package/bundle/{chunk-IS5SQ7HP.js → chunk-BFYOZTEC.js} +8 -6
  15. package/bundle/{chunk-6XLLXGZQ.js → chunk-CVDUPOPD.js} +1 -1
  16. package/bundle/{chunk-AMGYQYS7.js → chunk-EV4MLSRK.js} +2 -2
  17. package/bundle/{chunk-NFAJ5FW5.js → chunk-H35O2XC7.js} +1 -1
  18. package/bundle/{chunk-HBTS2REO.js → chunk-HBX5SUG6.js} +1 -1
  19. package/bundle/chunk-ID6HT5PN.js +512 -0
  20. package/bundle/chunk-JUDLPWWJ.js +1962 -0
  21. package/bundle/{chunk-RVYQZ73V.js → chunk-JVBEESQE.js} +3 -3
  22. package/bundle/{chunk-FDIF7V5C.js → chunk-L7GW5P2N.js} +1 -1
  23. package/bundle/{chunk-O2DXIYZO.js → chunk-MFOWRKY4.js} +782 -323
  24. package/bundle/chunk-MPPDWK6R.js +40024 -0
  25. package/bundle/{chunk-FGTABIOQ.js → chunk-NF46UAZ5.js} +1 -1
  26. package/bundle/chunk-P3QKD7NI.js +190 -0
  27. package/bundle/chunk-P5SMSWOI.js +65 -0
  28. package/bundle/{chunk-ECLDXLDB.js → chunk-Q3MSDTUZ.js} +3 -3
  29. package/bundle/{chunk-L5UVIFFB.js → chunk-QYILFI2Q.js} +7 -7
  30. package/bundle/{chunk-RTIGPATB.js → chunk-R5O4JOJ7.js} +1 -1
  31. package/bundle/chunk-T5ERFODG.js +118 -0
  32. package/bundle/{chunk-SA2VIQNQ.js → chunk-TKCJYF6S.js} +8765 -15613
  33. package/bundle/{chunk-BCL7DJOQ.js → chunk-WEQEDCCJ.js} +71 -58
  34. package/bundle/chunk-YGBB6EOP.js +1571 -0
  35. package/bundle/chunk-ZL2NEMMB.js +420386 -0
  36. package/bundle/chunk-ZM7BCSH5.js +60338 -0
  37. package/bundle/{cleanup-44LV7E4R.js → cleanup-2V4YG4JU.js} +2 -2
  38. package/bundle/{cleanup-O4QBMRVU.js → cleanup-577T3DEI.js} +2 -2
  39. package/bundle/{cleanup-WMYSWXJR.js → cleanup-A7BQ5O2C.js} +2 -2
  40. package/bundle/cleanup-BER5KF3M.js +34 -0
  41. package/bundle/{core-LJXCBOFM.js → core-J5GAQUTA.js} +31 -1
  42. package/bundle/{devtoolsService-D4VCGQMJ.js → devtoolsService-5ICQIIYF.js} +2 -2
  43. package/bundle/{devtoolsService-G4CPAW3U.js → devtoolsService-7E2XLRN6.js} +2 -2
  44. package/bundle/{devtoolsService-EBOCEFTO.js → devtoolsService-B2G4MIWC.js} +4 -3
  45. package/bundle/devtoolsService-HFMB7OZU.js +919 -0
  46. package/bundle/{dist-QSS2VWMY.js → dist-63TFONDS.js} +31 -1
  47. package/bundle/{core-DJ7VMWCC.js → dist-J4SRUOE6.js} +31 -1
  48. package/bundle/dist-J54GSUG2.js +2372 -0
  49. package/bundle/docs/changelogs/index.md +46 -0
  50. package/bundle/docs/changelogs/latest.md +82 -100
  51. package/bundle/docs/changelogs/preview.md +82 -115
  52. package/bundle/{formatError-I5Q2HGMN.js → formatError-ISWUYAZB.js} +2 -2
  53. package/bundle/{formatError-NLKMYJNL.js → formatError-IX7HHO6M.js} +2 -2
  54. package/bundle/{formatError-3QIVJAE5.js → formatError-MZRXOV55.js} +2 -2
  55. package/bundle/formatError-U2ZQLJHB.js +14 -0
  56. package/bundle/{gemini-4325ARIU.js → gemini-FRGLIXP7.js} +15 -15
  57. package/bundle/{gemini-LOYZXP6I.js → gemini-GSQARDB2.js} +224 -208
  58. package/bundle/gemini-KZFVMGY3.js +20020 -0
  59. package/bundle/{gemini-J7ZRUAXR.js → gemini-ZZBTL6TA.js} +15 -15
  60. package/bundle/gemini.js +8 -8
  61. package/bundle/{interactiveCli-AQ67IY7V.js → interactiveCli-AHDFCTRR.js} +157 -32
  62. package/bundle/{interactiveCli-CEIWZCYF.js → interactiveCli-MVGIIVAP.js} +157 -32
  63. package/bundle/{interactiveCli-O2L63RLG.js → interactiveCli-UN4BNLK2.js} +468 -324
  64. package/bundle/interactiveCli-XW2S7MKZ.js +36447 -0
  65. package/bundle/{liteRtServerManager-HMCB6A65.js → liteRtServerManager-3MOGK3XY.js} +4 -4
  66. package/bundle/{liteRtServerManager-MH32CAZ5.js → liteRtServerManager-O727KCKA.js} +4 -4
  67. package/bundle/{liteRtServerManager-EZFHT2B3.js → liteRtServerManager-TSG2V5XN.js} +4 -4
  68. package/bundle/liteRtServerManager-YLE7JTV7.js +65 -0
  69. package/bundle/{oauth2-provider-NPOZQDQO.js → oauth2-provider-3EEFSHG4.js} +1 -1
  70. package/bundle/{oauth2-provider-3TFNA7VY.js → oauth2-provider-DWO2KVCY.js} +1 -1
  71. package/bundle/{oauth2-provider-UXC7XFV6.js → oauth2-provider-G25ZRGDY.js} +41 -79
  72. package/bundle/oauth2-provider-RHT5OSMO.js +273 -0
  73. package/bundle/{start-JIKLB3S3.js → start-4XOSRN5A.js} +6 -6
  74. package/bundle/{start-NSYEL7UE.js → start-7JXWL6XR.js} +6 -6
  75. package/bundle/{start-I2GOKFKQ.js → start-CAA6RQBK.js} +6 -6
  76. package/bundle/start-I3RUABAZ.js +18 -0
  77. package/package.json +1 -1
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  normalizeError,
4
4
  safeSerializeErrorValue
5
- } from "./chunk-O2DXIYZO.js";
5
+ } from "./chunk-MFOWRKY4.js";
6
6
 
7
7
  // packages/cli/src/utils/formatError.ts
8
8
  function isCliDebugEnabled(argv = process.argv.slice(2), env = process.env) {
@@ -0,0 +1,190 @@
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
+ ExitCodes,
4
+ ShellExecutionService,
5
+ Storage,
6
+ isTelemetrySdkInitialized,
7
+ resetBrowserSession,
8
+ shutdownTelemetry
9
+ } from "./chunk-ZL2NEMMB.js";
10
+
11
+ // packages/cli/src/utils/cleanup.ts
12
+ import { promises as fs } from "node:fs";
13
+ import { join } from "node:path";
14
+ var cleanupFunctions = [];
15
+ var syncCleanupFunctions = [];
16
+ var configForTelemetry = null;
17
+ var isShuttingDown = false;
18
+ var CleanupState = /* @__PURE__ */ ((CleanupState2) => {
19
+ CleanupState2["IDLE"] = "IDLE";
20
+ CleanupState2["RUNNING"] = "RUNNING";
21
+ CleanupState2["COMPLETED"] = "COMPLETED";
22
+ return CleanupState2;
23
+ })(CleanupState || {});
24
+ var cleanupState = "IDLE" /* IDLE */;
25
+ var cleanupPromise = null;
26
+ function registerCleanup(fn) {
27
+ cleanupFunctions.push(fn);
28
+ }
29
+ function removeCleanup(fn) {
30
+ const index = cleanupFunctions.indexOf(fn);
31
+ if (index !== -1) {
32
+ cleanupFunctions.splice(index, 1);
33
+ }
34
+ }
35
+ function registerSyncCleanup(fn) {
36
+ syncCleanupFunctions.push(fn);
37
+ }
38
+ function removeSyncCleanup(fn) {
39
+ const index = syncCleanupFunctions.indexOf(fn);
40
+ if (index !== -1) {
41
+ syncCleanupFunctions.splice(index, 1);
42
+ }
43
+ }
44
+ function resetCleanupForTesting() {
45
+ cleanupFunctions.length = 0;
46
+ syncCleanupFunctions.length = 0;
47
+ configForTelemetry = null;
48
+ isShuttingDown = false;
49
+ cleanupState = "IDLE" /* IDLE */;
50
+ cleanupPromise = null;
51
+ }
52
+ function runSyncCleanup() {
53
+ for (const fn of syncCleanupFunctions) {
54
+ try {
55
+ fn();
56
+ } catch {
57
+ }
58
+ }
59
+ syncCleanupFunctions.length = 0;
60
+ }
61
+ function registerTelemetryConfig(config) {
62
+ configForTelemetry = config;
63
+ }
64
+ async function runExitCleanup() {
65
+ if (cleanupState === "COMPLETED" /* COMPLETED */) {
66
+ return;
67
+ }
68
+ if (cleanupState === "RUNNING" /* RUNNING */ && cleanupPromise) {
69
+ await cleanupPromise;
70
+ return;
71
+ }
72
+ cleanupState = "RUNNING" /* RUNNING */;
73
+ cleanupPromise = (async () => {
74
+ try {
75
+ try {
76
+ await drainStdin();
77
+ } catch {
78
+ }
79
+ runSyncCleanup();
80
+ for (const fn of cleanupFunctions) {
81
+ try {
82
+ await fn();
83
+ } catch {
84
+ }
85
+ }
86
+ cleanupFunctions.length = 0;
87
+ try {
88
+ await resetBrowserSession();
89
+ } catch {
90
+ }
91
+ try {
92
+ await ShellExecutionService.cleanupAllActiveProcesses();
93
+ } catch {
94
+ }
95
+ if (configForTelemetry) {
96
+ try {
97
+ await configForTelemetry.dispose();
98
+ } catch {
99
+ }
100
+ }
101
+ if (configForTelemetry && isTelemetrySdkInitialized()) {
102
+ try {
103
+ await shutdownTelemetry(configForTelemetry);
104
+ } catch {
105
+ }
106
+ }
107
+ } finally {
108
+ cleanupState = "COMPLETED" /* COMPLETED */;
109
+ cleanupPromise = null;
110
+ }
111
+ })();
112
+ await cleanupPromise;
113
+ }
114
+ async function drainStdin() {
115
+ if (!process.stdin?.isTTY) return;
116
+ process.stdin.resume().removeAllListeners("data").on("data", () => {
117
+ });
118
+ await new Promise((resolve) => setTimeout(resolve, 50));
119
+ }
120
+ async function gracefulShutdown(reason) {
121
+ if (isShuttingDown) {
122
+ return;
123
+ }
124
+ isShuttingDown = true;
125
+ await runExitCleanup();
126
+ const exitCode = reason === "SIGINT" ? 130 : reason === "SIGTERM" ? 143 : reason === "SIGHUP" ? 129 : ExitCodes.SUCCESS;
127
+ process.exit(exitCode);
128
+ }
129
+ function setupSignalHandlers() {
130
+ process.on("SIGHUP", () => gracefulShutdown("SIGHUP"));
131
+ process.on("SIGTERM", () => gracefulShutdown("SIGTERM"));
132
+ process.on("SIGINT", () => gracefulShutdown("SIGINT"));
133
+ }
134
+ function setupTtyCheck() {
135
+ let intervalId = null;
136
+ let isCheckingTty = false;
137
+ intervalId = setInterval(async () => {
138
+ if (isCheckingTty || isShuttingDown) {
139
+ return;
140
+ }
141
+ if (process.env["SANDBOX"]) {
142
+ return;
143
+ }
144
+ if (!process.stdin.isTTY && !process.stdout.isTTY) {
145
+ isCheckingTty = true;
146
+ if (intervalId) {
147
+ clearInterval(intervalId);
148
+ intervalId = null;
149
+ }
150
+ await gracefulShutdown("TTY loss");
151
+ }
152
+ }, 5e3);
153
+ intervalId.unref();
154
+ return () => {
155
+ if (intervalId) {
156
+ clearInterval(intervalId);
157
+ intervalId = null;
158
+ }
159
+ };
160
+ }
161
+ async function cleanupCheckpoints() {
162
+ const storage = new Storage(process.cwd());
163
+ await storage.initialize();
164
+ const tempDir = storage.getProjectTempDir();
165
+ const checkpointsDir = join(tempDir, "checkpoints");
166
+ try {
167
+ await fs.rm(checkpointsDir, { recursive: true, force: true });
168
+ } catch {
169
+ }
170
+ }
171
+
172
+ export {
173
+ CleanupState,
174
+ registerCleanup,
175
+ removeCleanup,
176
+ registerSyncCleanup,
177
+ removeSyncCleanup,
178
+ resetCleanupForTesting,
179
+ runSyncCleanup,
180
+ registerTelemetryConfig,
181
+ runExitCleanup,
182
+ setupSignalHandlers,
183
+ setupTtyCheck,
184
+ cleanupCheckpoints
185
+ };
186
+ /**
187
+ * @license
188
+ * Copyright 2025 Google LLC
189
+ * SPDX-License-Identifier: Apache-2.0
190
+ */
@@ -0,0 +1,65 @@
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
+ normalizeError,
4
+ safeSerializeErrorValue
5
+ } from "./chunk-AQR7HAVC.js";
6
+
7
+ // packages/cli/src/utils/formatError.ts
8
+ function isCliDebugEnabled(argv = process.argv.slice(2), env = process.env) {
9
+ if ([env["DEBUG"], env["DEBUG_MODE"]].some((v) => v === "true" || v === "1")) {
10
+ return true;
11
+ }
12
+ for (const arg of argv) {
13
+ if (arg === "--") {
14
+ break;
15
+ }
16
+ if (arg === "--debug" || arg === "-d" || arg === "--debug=true" || arg === "--debug=1") {
17
+ return true;
18
+ }
19
+ }
20
+ return false;
21
+ }
22
+ function formatStatusSuffix(message, status) {
23
+ const statusText = typeof status === "string" ? status.trim() : status !== void 0 ? String(status) : "";
24
+ if (!statusText) {
25
+ return "";
26
+ }
27
+ if (message.toLowerCase().includes(statusText.toLowerCase())) {
28
+ return "";
29
+ }
30
+ return ` (Status: ${statusText})`;
31
+ }
32
+ function formatCliError(error, options = {}) {
33
+ const normalized = normalizeError(error);
34
+ const prefix = options.prefix ?? "Error: ";
35
+ const statusSuffix = formatStatusSuffix(
36
+ normalized.message,
37
+ normalized.status
38
+ );
39
+ if (options.debug) {
40
+ if (error instanceof Error && error.stack) {
41
+ const stackStartsWithError = error.stack.startsWith("Error: ") || error.name.endsWith("Error") && error.stack.startsWith(`${error.name}: `);
42
+ const stackPrefix = prefix === "Error: " && stackStartsWithError ? "" : prefix;
43
+ let debugOutput = error.stack.includes(normalized.message) && !statusSuffix ? `${stackPrefix}${error.stack}` : `${prefix}${normalized.message}${statusSuffix}
44
+ ${error.stack}`;
45
+ if (normalized.details !== void 0) {
46
+ debugOutput += `
47
+ Debug Details: ${safeSerializeErrorValue(normalized.details, 2)}`;
48
+ }
49
+ return debugOutput;
50
+ }
51
+ return `${prefix}${normalized.message}${statusSuffix}
52
+ Debug Context: ${safeSerializeErrorValue(normalized.originalError, 2)}`;
53
+ }
54
+ return `${prefix}${normalized.message}${statusSuffix}`;
55
+ }
56
+
57
+ export {
58
+ isCliDebugEnabled,
59
+ formatCliError
60
+ };
61
+ /**
62
+ * @license
63
+ * Copyright 2026 Google LLC
64
+ * SPDX-License-Identifier: Apache-2.0
65
+ */
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  exitCli,
4
4
  require_source
5
- } from "./chunk-BOYVA4SV.js";
5
+ } from "./chunk-4V6FXIV7.js";
6
6
  import {
7
7
  DEFAULT_PORT,
8
8
  SERVER_START_WAIT_MS,
@@ -14,10 +14,10 @@ import {
14
14
  isServerRunning,
15
15
  resolveGemmaConfig,
16
16
  writeServerProcessInfo
17
- } from "./chunk-IS5SQ7HP.js";
17
+ } from "./chunk-7CGFKAQQ.js";
18
18
  import {
19
19
  debugLogger
20
- } from "./chunk-I5QSCSQU.js";
20
+ } from "./chunk-TKCJYF6S.js";
21
21
  import {
22
22
  __toESM
23
23
  } from "./chunk-34MYV7JD.js";
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  exitCli,
4
4
  require_source
5
- } from "./chunk-BOYVA4SV.js";
5
+ } from "./chunk-YGBB6EOP.js";
6
6
  import {
7
7
  AppEvent,
8
8
  appEvents
@@ -69,16 +69,16 @@ import {
69
69
  use_stdin_default,
70
70
  use_stdout_default,
71
71
  validateCustomTheme
72
- } from "./chunk-IS5SQ7HP.js";
72
+ } from "./chunk-43QQPZRQ.js";
73
73
  import {
74
74
  isDevelopment,
75
75
  require_semver
76
- } from "./chunk-CMUPNBQQ.js";
76
+ } from "./chunk-7WRW57EW.js";
77
77
  import {
78
78
  emptyIcon,
79
79
  mapCoreStatusToDisplayStatus,
80
80
  require_react
81
- } from "./chunk-STY67ND2.js";
81
+ } from "./chunk-R5O4JOJ7.js";
82
82
  import {
83
83
  ALL_EDITORS,
84
84
  ApprovalMode,
@@ -256,7 +256,7 @@ import {
256
256
  unescapePath,
257
257
  validateUrlDestination,
258
258
  wo
259
- } from "./chunk-I5QSCSQU.js";
259
+ } from "./chunk-AQR7HAVC.js";
260
260
  import {
261
261
  require_src
262
262
  } from "./chunk-L6PII3GR.js";
@@ -35007,7 +35007,7 @@ var authCommand = {
35007
35007
  import process12 from "node:process";
35008
35008
 
35009
35009
  // packages/cli/src/generated/git-commit.ts
35010
- var GIT_COMMIT_INFO = "615d6bc8c";
35010
+ var GIT_COMMIT_INFO = "d4cb1713f";
35011
35011
 
35012
35012
  // packages/cli/src/ui/utils/historyExportUtils.ts
35013
35013
  import * as fsPromises from "node:fs/promises";
@@ -40829,7 +40829,7 @@ Use /mcp auth <server-name> to authenticate.`
40829
40829
  type: "info",
40830
40830
  text: `Starting OAuth authentication for MCP server '${serverName}'...`
40831
40831
  });
40832
- const { MCPOAuthProvider } = await import("./core-DJ7VMWCC.js");
40832
+ const { MCPOAuthProvider } = await import("./core-J5GAQUTA.js");
40833
40833
  let oauthConfig = server.oauth;
40834
40834
  if (!oauthConfig) {
40835
40835
  oauthConfig = { enabled: false };
@@ -1,7 +1,7 @@
1
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
2
  import {
3
3
  checkExhaustive
4
- } from "./chunk-SA2VIQNQ.js";
4
+ } from "./chunk-AQR7HAVC.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __toESM
@@ -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-H35O2XC7.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-BFYOZTEC.js";
18
+ import {
19
+ debugLogger
20
+ } from "./chunk-MFOWRKY4.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
+ */