@google/gemini-cli 0.55.0-preview.1 → 0.55.0-preview.2

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 (66) hide show
  1. package/bundle/{chunk-3Q3RSCXS.js → chunk-2NTEXQZI.js} +2 -2
  2. package/bundle/{chunk-O6HG25DV.js → chunk-2ZWCUTMN.js} +1 -1
  3. package/bundle/{chunk-DMPPAMW5.js → chunk-3OPKUUXP.js} +1 -1
  4. package/bundle/{chunk-I535IUEN.js → chunk-4C7ON4TD.js} +1 -1
  5. package/bundle/{chunk-YU5UI6S7.js → chunk-4SFKECJB.js} +1 -1
  6. package/bundle/{chunk-F3GEJ37M.js → chunk-57ZLFNIU.js} +1 -1
  7. package/bundle/{chunk-SEQ766WD.js → chunk-7IYUUE2H.js} +1 -1
  8. package/bundle/{chunk-APDWRUAP.js → chunk-A4YWS44A.js} +19 -10
  9. package/bundle/{chunk-7LAM3MXG.js → chunk-CBX65YIB.js} +1 -1
  10. package/bundle/{chunk-G3NJ32VD.js → chunk-CYJHOZAD.js} +1 -1
  11. package/bundle/{chunk-AKJETY2D.js → chunk-DBPSBJMI.js} +9 -8
  12. package/bundle/{chunk-VHRT3UPF.js → chunk-DRN2VYCZ.js} +2 -2
  13. package/bundle/{chunk-LXWZUVJW.js → chunk-DSCF5EA6.js} +3 -3
  14. package/bundle/{chunk-A7NLEV6J.js → chunk-FH7GCVZY.js} +2 -2
  15. package/bundle/{chunk-G4NBAJCP.js → chunk-HZZM77SO.js} +40 -23
  16. package/bundle/{chunk-UM7AN6ZZ.js → chunk-IHR5TZ6N.js} +3 -3
  17. package/bundle/{chunk-MWEFWYTU.js → chunk-J27NXCYL.js} +1 -1
  18. package/bundle/chunk-J6DC57TM.js +1571 -0
  19. package/bundle/{chunk-QQVXLF7U.js → chunk-KII3XXCP.js} +3 -3
  20. package/bundle/chunk-L6Q242KC.js +512 -0
  21. package/bundle/chunk-LVOM4PEE.js +398 -0
  22. package/bundle/{chunk-KNRWWK34.js → chunk-MLTI5CK6.js} +7653 -14284
  23. package/bundle/{chunk-RXENTUH3.js → chunk-O5GQF2L7.js} +8 -5
  24. package/bundle/{chunk-IBEJG5F5.js → chunk-OC55SY62.js} +7 -7
  25. package/bundle/chunk-PTZIAOG5.js +118 -0
  26. package/bundle/{chunk-TQPJD4W5.js → chunk-QPGTVRXP.js} +67 -54
  27. package/bundle/chunk-R3S5PP5S.js +397240 -0
  28. package/bundle/chunk-S3XRZJYO.js +154 -0
  29. package/bundle/chunk-SEHUSFSL.js +17332 -0
  30. package/bundle/{chunk-GL46CQLD.js → chunk-T36P7MFE.js} +7 -7
  31. package/bundle/chunk-UXD5COS4.js +102505 -0
  32. package/bundle/{chunk-GPP3RO7B.js → chunk-XWGJPCDB.js} +1 -1
  33. package/bundle/{cleanup-2EQCXKR2.js → cleanup-PYHN72B4.js} +2 -2
  34. package/bundle/{cleanup-CVITZEST.js → cleanup-QOIB4MC5.js} +2 -2
  35. package/bundle/{cleanup-JPURY2FN.js → cleanup-X7SPIVY6.js} +2 -2
  36. package/bundle/cleanup-XHKLOUOX.js +32 -0
  37. package/bundle/{core-M7EWVE7C.js → core-TM4S2KC6.js} +1 -1
  38. package/bundle/{devtoolsService-LTCUHAKD.js → devtoolsService-QXH36QMO.js} +2 -2
  39. package/bundle/{devtoolsService-2PJHOM3Z.js → devtoolsService-XNULR5OM.js} +2 -2
  40. package/bundle/{devtoolsService-G4J2W6MV.js → devtoolsService-XP7RODGG.js} +4 -3
  41. package/bundle/devtoolsService-YBK5NQJR.js +4359 -0
  42. package/bundle/{dist-TXQI77ZL.js → dist-DUXHKH4A.js} +1 -1
  43. package/bundle/{core-2KFPOGVU.js → dist-FCM7NH26.js} +1 -1
  44. package/bundle/dist-LH5DRLX7.js +2172 -0
  45. package/bundle/{gemini-QFKS36ZW.js → gemini-A7HOBIKY.js} +13 -13
  46. package/bundle/{gemini-TOJXXBJZ.js → gemini-HDAYOIW2.js} +214 -198
  47. package/bundle/gemini-ORTIIX7J.js +17088 -0
  48. package/bundle/{gemini-4GL7B4FQ.js → gemini-ZUILAPR6.js} +13 -13
  49. package/bundle/gemini.js +7 -7
  50. package/bundle/{interactiveCli-QFVYPM2G.js → interactiveCli-H524RKEH.js} +8 -8
  51. package/bundle/{interactiveCli-NWP4ENQW.js → interactiveCli-KX3U7SFD.js} +8 -8
  52. package/bundle/interactiveCli-O4YSZIKG.js +34912 -0
  53. package/bundle/{interactiveCli-UPSM5SHZ.js → interactiveCli-YAAI2B6S.js} +315 -296
  54. package/bundle/{liteRtServerManager-MU2XFPN4.js → liteRtServerManager-FTW42YZF.js} +4 -4
  55. package/bundle/{liteRtServerManager-T2WZMOZK.js → liteRtServerManager-NW33H3DY.js} +4 -4
  56. package/bundle/{liteRtServerManager-DILFQEEZ.js → liteRtServerManager-PRXJGWUQ.js} +4 -4
  57. package/bundle/liteRtServerManager-RP2Z5PSZ.js +65 -0
  58. package/bundle/{oauth2-provider-QNQQSC5U.js → oauth2-provider-AXFTVNOH.js} +1 -1
  59. package/bundle/{oauth2-provider-VWRIMKTD.js → oauth2-provider-JZQDXWRM.js} +1 -1
  60. package/bundle/{oauth2-provider-2QGZS53A.js → oauth2-provider-UKW3UFLQ.js} +38 -72
  61. package/bundle/oauth2-provider-X4GQTJLG.js +235 -0
  62. package/bundle/{start-YV56XGWM.js → start-EIHA5TWI.js} +6 -6
  63. package/bundle/{start-YWLQDUFC.js → start-ODF2OV65.js} +6 -6
  64. package/bundle/{start-M7PLRASE.js → start-ONHNJJG7.js} +6 -6
  65. package/bundle/start-TSZCFX4W.js +18 -0
  66. 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
  startCommand,
4
4
  startServer
5
- } from "./chunk-LXWZUVJW.js";
5
+ } from "./chunk-IHR5TZ6N.js";
6
6
  import {
7
7
  BuiltinCommandLoader,
8
8
  CommandService,
@@ -45,11 +45,11 @@ import {
45
45
  updateAllUpdatableExtensions,
46
46
  updateExtension,
47
47
  validateAuthMethod
48
- } from "./chunk-GL46CQLD.js";
48
+ } from "./chunk-OC55SY62.js";
49
49
  import {
50
50
  exitCli,
51
51
  require_source
52
- } from "./chunk-F3GEJ37M.js";
52
+ } from "./chunk-3OPKUUXP.js";
53
53
  import {
54
54
  appEvents
55
55
  } from "./chunk-5PS3AYFU.js";
@@ -87,11 +87,11 @@ import {
87
87
  resolveGemmaConfig,
88
88
  saveModelChange,
89
89
  stripAnsi
90
- } from "./chunk-GPP3RO7B.js";
90
+ } from "./chunk-SEHUSFSL.js";
91
91
  import {
92
92
  RELAUNCH_EXIT_CODE
93
- } from "./chunk-A7NLEV6J.js";
94
- import "./chunk-AKJETY2D.js";
93
+ } from "./chunk-DRN2VYCZ.js";
94
+ import "./chunk-L6Q242KC.js";
95
95
  import {
96
96
  cleanupCheckpoints,
97
97
  registerCleanup,
@@ -100,12 +100,15 @@ import {
100
100
  runExitCleanup,
101
101
  runSyncCleanup,
102
102
  setupSignalHandlers
103
- } from "./chunk-MWEFWYTU.js";
103
+ } from "./chunk-CBX65YIB.js";
104
104
  import {
105
105
  ASK_USER_TOOL_NAME,
106
+ ApprovalMode,
106
107
  AuthType,
107
108
  Client,
108
109
  Config,
110
+ CoreEvent,
111
+ CoreToolCallStatus,
109
112
  DEFAULT_CONTEXT_FILENAME,
110
113
  DEFAULT_FILE_FILTERING_OPTIONS,
111
114
  DEFAULT_GEMINI_EMBEDDING_MODEL,
@@ -127,19 +130,27 @@ import {
127
130
  FolderTrustDiscoveryService,
128
131
  GEMINI_DIR,
129
132
  GEMINI_MODEL_ALIAS_AUTO,
133
+ GeminiEventType,
130
134
  IdeClient,
135
+ IntegrityStatus,
131
136
  InvalidStreamError,
132
137
  JsonFormatter,
138
+ JsonStreamEventType,
139
+ Kind,
133
140
  LegacyAgentSession,
134
141
  Logger,
135
142
  MAX_TOKENS_EXCEEDED_SUGGESTION,
136
143
  MCPServerConfig,
144
+ MCPServerStatus,
145
+ MessageBusType,
137
146
  OTHER_BLOCKED_MESSAGE,
147
+ OutputFormat,
138
148
  PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
139
149
  PREVIEW_GEMINI_3_1_MODEL,
140
150
  PREVIEW_GEMINI_FLASH_LITE_MODEL,
141
151
  PREVIEW_GEMINI_FLASH_MODEL,
142
152
  PREVIEW_GEMINI_MODEL,
153
+ PolicyDecision,
143
154
  PolicyIntegrityManager,
144
155
  RECITATION_BLOCKED_MESSAGE,
145
156
  REFERENCE_CONTENT_START,
@@ -147,6 +158,8 @@ import {
147
158
  ReadManyFilesTool,
148
159
  SAFETY_BLOCKED_MESSAGE,
149
160
  Scheduler,
161
+ SessionEndReason,
162
+ SessionStartSource,
150
163
  ShellExecutionService,
151
164
  SimpleExtensionLoader,
152
165
  Storage,
@@ -155,10 +168,13 @@ import {
155
168
  TRUE_EMPTY_RESPONSE_MESSAGE,
156
169
  ToolCallEvent,
157
170
  ToolConfirmationOutcome,
171
+ ToolErrorType,
172
+ TrustLevel,
158
173
  UserAccountManager,
159
174
  UserPromptEvent,
160
175
  ValidationCancelledError,
161
176
  ValidationRequiredError,
177
+ WarningPriority,
162
178
  applyAdminAllowlist,
163
179
  applyRequiredServers,
164
180
  clearCachedCredentialFile,
@@ -237,7 +253,7 @@ import {
237
253
  updatePolicy,
238
254
  writeToStderr,
239
255
  writeToStdout
240
- } from "./chunk-G4NBAJCP.js";
256
+ } from "./chunk-R3S5PP5S.js";
241
257
  import "./chunk-664ZODQF.js";
242
258
  import "./chunk-IUUIT4SU.js";
243
259
  import "./chunk-TUDYL3X4.js";
@@ -5367,7 +5383,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
5367
5383
  async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
5368
5384
  const isStdio = !!config.command;
5369
5385
  if (isStdio && !isTrusted) {
5370
- return "disconnected" /* DISCONNECTED */;
5386
+ return MCPServerStatus.DISCONNECTED;
5371
5387
  }
5372
5388
  const client = new Client({
5373
5389
  name: "mcp-test-client",
@@ -5403,7 +5419,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5403
5419
  transport = await createTransport(serverName, config, false, mcpContext);
5404
5420
  } catch {
5405
5421
  await client.close();
5406
- return "disconnected" /* DISCONNECTED */;
5422
+ return MCPServerStatus.DISCONNECTED;
5407
5423
  }
5408
5424
  try {
5409
5425
  const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
@@ -5417,10 +5433,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5417
5433
  );
5418
5434
  }
5419
5435
  await client.close();
5420
- return "connected" /* CONNECTED */;
5436
+ return MCPServerStatus.CONNECTED;
5421
5437
  } catch {
5422
5438
  await transport.close();
5423
- return "disconnected" /* DISCONNECTED */;
5439
+ return MCPServerStatus.DISCONNECTED;
5424
5440
  }
5425
5441
  }
5426
5442
  async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
@@ -5433,12 +5449,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
5433
5449
  });
5434
5450
  if (!loadResult.allowed) {
5435
5451
  if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
5436
- return "blocked" /* BLOCKED */;
5452
+ return MCPServerStatus.BLOCKED;
5437
5453
  }
5438
- return "disabled" /* DISABLED */;
5454
+ return MCPServerStatus.DISABLED;
5439
5455
  }
5440
5456
  if (!isTrusted) {
5441
- return "disabled" /* DISABLED */;
5457
+ return MCPServerStatus.DISABLED;
5442
5458
  }
5443
5459
  return testMCPConnection(serverName, server, isTrusted, activeSettings);
5444
5460
  }
@@ -5484,23 +5500,23 @@ async function listMcpServers(loadedSettingsArg) {
5484
5500
  let statusIndicator = "";
5485
5501
  let statusText = "";
5486
5502
  switch (status) {
5487
- case "connected" /* CONNECTED */:
5503
+ case MCPServerStatus.CONNECTED:
5488
5504
  statusIndicator = import_chalk.default.green("\u2713");
5489
5505
  statusText = "Connected";
5490
5506
  break;
5491
- case "connecting" /* CONNECTING */:
5507
+ case MCPServerStatus.CONNECTING:
5492
5508
  statusIndicator = import_chalk.default.yellow("\u2026");
5493
5509
  statusText = "Connecting";
5494
5510
  break;
5495
- case "blocked" /* BLOCKED */:
5511
+ case MCPServerStatus.BLOCKED:
5496
5512
  statusIndicator = import_chalk.default.red("\u26D4");
5497
5513
  statusText = "Blocked";
5498
5514
  break;
5499
- case "disabled" /* DISABLED */:
5515
+ case MCPServerStatus.DISABLED:
5500
5516
  statusIndicator = import_chalk.default.gray("\u25CB");
5501
5517
  statusText = "Disabled";
5502
5518
  break;
5503
- case "disconnected" /* DISCONNECTED */:
5519
+ case MCPServerStatus.DISCONNECTED:
5504
5520
  default:
5505
5521
  statusIndicator = import_chalk.default.red("\u2717");
5506
5522
  statusText = "Disconnected";
@@ -5786,7 +5802,7 @@ async function handleInstall(args) {
5786
5802
  );
5787
5803
  if (confirmed) {
5788
5804
  const trustedFolders = loadTrustedFolders();
5789
- await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
5805
+ await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
5790
5806
  } else {
5791
5807
  throw new Error(
5792
5808
  `Installation aborted: Folder "${absolutePath}" is not trusted.`
@@ -7831,7 +7847,7 @@ async function loadSandboxConfig(settings, argv) {
7831
7847
  }
7832
7848
  const command2 = getSandboxCommand(sandboxValue);
7833
7849
  const packageJson = await getPackageJson(__dirname3);
7834
- const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.55.0-nightly.20260729.g3499c84f7" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7850
+ const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.55.0-preview.2" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7835
7851
  const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
7836
7852
  return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
7837
7853
  }
@@ -7890,9 +7906,9 @@ async function resolveWorkspacePolicyState(options) {
7890
7906
  cwd,
7891
7907
  potentialWorkspacePoliciesDir
7892
7908
  );
7893
- if (integrityResult.status === "MATCH" /* MATCH */) {
7909
+ if (integrityResult.status === IntegrityStatus.MATCH) {
7894
7910
  workspacePoliciesDir = potentialWorkspacePoliciesDir;
7895
- } else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
7911
+ } else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
7896
7912
  workspacePoliciesDir = void 0;
7897
7913
  } else if (interactive && !autoAcceptWorkspacePolicies) {
7898
7914
  policyUpdateConfirmationRequest = {
@@ -8320,23 +8336,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8320
8336
  if (rawApprovalMode) {
8321
8337
  switch (rawApprovalMode) {
8322
8338
  case "yolo":
8323
- approvalMode = "yolo" /* YOLO */;
8339
+ approvalMode = ApprovalMode.YOLO;
8324
8340
  break;
8325
8341
  case "auto_edit":
8326
- approvalMode = "autoEdit" /* AUTO_EDIT */;
8342
+ approvalMode = ApprovalMode.AUTO_EDIT;
8327
8343
  break;
8328
8344
  case "plan":
8329
8345
  if (!(settings.general?.plan?.enabled ?? true)) {
8330
8346
  debugLogger.warn(
8331
8347
  'Approval mode "plan" is disabled in your settings. Falling back to "default".'
8332
8348
  );
8333
- approvalMode = "default" /* DEFAULT */;
8349
+ approvalMode = ApprovalMode.DEFAULT;
8334
8350
  } else {
8335
- approvalMode = "plan" /* PLAN */;
8351
+ approvalMode = ApprovalMode.PLAN;
8336
8352
  }
8337
8353
  break;
8338
8354
  case "default":
8339
- approvalMode = "default" /* DEFAULT */;
8355
+ approvalMode = ApprovalMode.DEFAULT;
8340
8356
  break;
8341
8357
  default:
8342
8358
  throw new Error(
@@ -8344,10 +8360,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8344
8360
  );
8345
8361
  }
8346
8362
  } else {
8347
- approvalMode = "default" /* DEFAULT */;
8363
+ approvalMode = ApprovalMode.DEFAULT;
8348
8364
  }
8349
8365
  if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
8350
- if (approvalMode === "yolo" /* YOLO */) {
8366
+ if (approvalMode === ApprovalMode.YOLO) {
8351
8367
  if (settings.admin?.secureModeEnabled) {
8352
8368
  debugLogger.error(
8353
8369
  'YOLO mode is disabled by "secureModeEnabled" setting.'
@@ -8365,16 +8381,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8365
8381
  )
8366
8382
  );
8367
8383
  }
8368
- } else if (approvalMode === "yolo" /* YOLO */) {
8384
+ } else if (approvalMode === ApprovalMode.YOLO) {
8369
8385
  debugLogger.warn(
8370
8386
  "YOLO mode is enabled. All tool calls will be automatically approved."
8371
8387
  );
8372
8388
  }
8373
- if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
8389
+ if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
8374
8390
  debugLogger.warn(
8375
8391
  `Approval mode overridden to "default" because the current folder is not trusted.`
8376
8392
  );
8377
- approvalMode = "default" /* DEFAULT */;
8393
+ approvalMode = ApprovalMode.DEFAULT;
8378
8394
  }
8379
8395
  let telemetrySettings;
8380
8396
  try {
@@ -10409,7 +10425,7 @@ import path9 from "node:path";
10409
10425
  import process4 from "node:process";
10410
10426
  var homeDirectoryCheck = {
10411
10427
  id: "home-directory",
10412
- priority: "low" /* Low */,
10428
+ priority: WarningPriority.Low,
10413
10429
  check: async (workspaceRoot, settings) => {
10414
10430
  if (settings.ui?.showHomeDirectoryWarning === false) {
10415
10431
  return null;
@@ -10433,7 +10449,7 @@ var homeDirectoryCheck = {
10433
10449
  };
10434
10450
  var rootDirectoryCheck = {
10435
10451
  id: "root-directory",
10436
- priority: "high" /* High */,
10452
+ priority: WarningPriority.High,
10437
10453
  check: async (workspaceRoot, _settings) => {
10438
10454
  try {
10439
10455
  const workspaceRealPath = await fs9.realpath(workspaceRoot);
@@ -10449,7 +10465,7 @@ var rootDirectoryCheck = {
10449
10465
  };
10450
10466
  var folderTrustCheck = {
10451
10467
  id: "folder-trust",
10452
- priority: "high" /* High */,
10468
+ priority: WarningPriority.High,
10453
10469
  check: async (workspaceRoot, settings) => {
10454
10470
  if (!isFolderTrustEnabled(settings)) {
10455
10471
  return null;
@@ -10639,12 +10655,12 @@ function handleError(error, config, customErrorCode) {
10639
10655
  error,
10640
10656
  config.getContentGeneratorConfig()?.authType
10641
10657
  );
10642
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10658
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10643
10659
  const streamFormatter = new StreamJsonFormatter();
10644
10660
  const errorCode = customErrorCode ?? extractErrorCode(error);
10645
10661
  const metrics = uiTelemetryService.getMetrics();
10646
10662
  streamFormatter.emitEvent({
10647
- type: "result" /* RESULT */,
10663
+ type: JsonStreamEventType.RESULT,
10648
10664
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10649
10665
  status: "error",
10650
10666
  error: {
@@ -10655,7 +10671,7 @@ function handleError(error, config, customErrorCode) {
10655
10671
  });
10656
10672
  runSyncCleanup();
10657
10673
  process.exit(getNumericExitCode(errorCode));
10658
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10674
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10659
10675
  const formatter = new JsonFormatter();
10660
10676
  const errorCode = customErrorCode ?? extractErrorCode(error);
10661
10677
  const formattedError = formatter.formatError(
@@ -10675,11 +10691,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
10675
10691
  const isFatal = isFatalToolError(errorType);
10676
10692
  if (isFatal) {
10677
10693
  const toolExecutionError = new FatalToolExecutionError(errorMessage);
10678
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10694
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10679
10695
  const streamFormatter = new StreamJsonFormatter();
10680
10696
  const metrics = uiTelemetryService.getMetrics();
10681
10697
  streamFormatter.emitEvent({
10682
- type: "result" /* RESULT */,
10698
+ type: JsonStreamEventType.RESULT,
10683
10699
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10684
10700
  status: "error",
10685
10701
  error: {
@@ -10688,7 +10704,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
10688
10704
  },
10689
10705
  stats: streamFormatter.convertToStreamStats(metrics, 0)
10690
10706
  });
10691
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10707
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10692
10708
  const formatter = new JsonFormatter();
10693
10709
  const formattedError = formatter.formatError(
10694
10710
  toolExecutionError,
@@ -10706,11 +10722,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
10706
10722
  }
10707
10723
  function handleCancellationError(config) {
10708
10724
  const cancellationError = new FatalCancellationError("Operation cancelled.");
10709
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10725
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10710
10726
  const streamFormatter = new StreamJsonFormatter();
10711
10727
  const metrics = uiTelemetryService.getMetrics();
10712
10728
  streamFormatter.emitEvent({
10713
- type: "result" /* RESULT */,
10729
+ type: JsonStreamEventType.RESULT,
10714
10730
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10715
10731
  status: "error",
10716
10732
  error: {
@@ -10721,7 +10737,7 @@ function handleCancellationError(config) {
10721
10737
  });
10722
10738
  runSyncCleanup();
10723
10739
  process.exit(cancellationError.exitCode);
10724
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10740
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10725
10741
  const formatter = new JsonFormatter();
10726
10742
  const formattedError = formatter.formatError(
10727
10743
  cancellationError,
@@ -10741,11 +10757,11 @@ function handleMaxTurnsExceededError(config) {
10741
10757
  const maxTurnsError = new FatalTurnLimitedError(
10742
10758
  "Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
10743
10759
  );
10744
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10760
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10745
10761
  const streamFormatter = new StreamJsonFormatter();
10746
10762
  const metrics = uiTelemetryService.getMetrics();
10747
10763
  streamFormatter.emitEvent({
10748
- type: "result" /* RESULT */,
10764
+ type: JsonStreamEventType.RESULT,
10749
10765
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10750
10766
  status: "error",
10751
10767
  error: {
@@ -10756,7 +10772,7 @@ function handleMaxTurnsExceededError(config) {
10756
10772
  });
10757
10773
  runSyncCleanup();
10758
10774
  process.exit(maxTurnsError.exitCode);
10759
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10775
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10760
10776
  const formatter = new JsonFormatter();
10761
10777
  const formattedError = formatter.formatError(
10762
10778
  maxTurnsError,
@@ -10836,7 +10852,7 @@ async function runNonInteractive({
10836
10852
  }
10837
10853
  });
10838
10854
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
10839
- const { setupInitialActivityLogger } = await import("./devtoolsService-2PJHOM3Z.js");
10855
+ const { setupInitialActivityLogger } = await import("./devtoolsService-YBK5NQJR.js");
10840
10856
  setupInitialActivityLogger(config);
10841
10857
  }
10842
10858
  const { stdout: workingStdout } = createWorkingStdio();
@@ -10852,7 +10868,7 @@ async function runNonInteractive({
10852
10868
  }
10853
10869
  };
10854
10870
  const startTime = Date.now();
10855
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
10871
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
10856
10872
  const abortController = new AbortController();
10857
10873
  let isAborting = false;
10858
10874
  let cancelMessageTimer = null;
@@ -10905,13 +10921,13 @@ async function runNonInteractive({
10905
10921
  };
10906
10922
  try {
10907
10923
  consolePatcher.patch();
10908
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
10924
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
10909
10925
  process.stderr.write(
10910
10926
  "[WARNING] --raw-output is enabled. Model output is not sanitized and may contain harmful ANSI sequences (e.g. for phishing or command injection). Use --accept-raw-output-risk to suppress this warning.\n"
10911
10927
  );
10912
10928
  }
10913
10929
  setupStdinCancellation();
10914
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
10930
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
10915
10931
  coreEvents.drainBacklogs();
10916
10932
  process.stdout.on("error", (err) => {
10917
10933
  if (err.code === "EPIPE") {
@@ -10937,7 +10953,7 @@ async function runNonInteractive({
10937
10953
  }
10938
10954
  if (streamFormatter) {
10939
10955
  streamFormatter.emitEvent({
10940
- type: "init" /* INIT */,
10956
+ type: JsonStreamEventType.INIT,
10941
10957
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10942
10958
  session_id: config.getSessionId(),
10943
10959
  model: config.getModel()
@@ -10975,7 +10991,7 @@ async function runNonInteractive({
10975
10991
  }
10976
10992
  if (streamFormatter) {
10977
10993
  streamFormatter.emitEvent({
10978
- type: "message" /* MESSAGE */,
10994
+ type: JsonStreamEventType.MESSAGE,
10979
10995
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10980
10996
  role: "user",
10981
10997
  content: input
@@ -11014,12 +11030,12 @@ async function runNonInteractive({
11014
11030
  const metrics = uiTelemetryService.getMetrics();
11015
11031
  const durationMs = Date.now() - startTime;
11016
11032
  streamFormatter.emitEvent({
11017
- type: "result" /* RESULT */,
11033
+ type: JsonStreamEventType.RESULT,
11018
11034
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11019
11035
  status: errorPayload ? "error" : "success",
11020
11036
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
11021
11037
  });
11022
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11038
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11023
11039
  const formatter = new JsonFormatter();
11024
11040
  const stats = uiTelemetryService.getMetrics();
11025
11041
  textOutput.write(
@@ -11112,13 +11128,13 @@ async function runNonInteractive({
11112
11128
  const output = isRaw ? part.text : stripAnsi(part.text);
11113
11129
  if (streamFormatter) {
11114
11130
  streamFormatter.emitEvent({
11115
- type: "message" /* MESSAGE */,
11131
+ type: JsonStreamEventType.MESSAGE,
11116
11132
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11117
11133
  role: "assistant",
11118
11134
  content: output,
11119
11135
  delta: true
11120
11136
  });
11121
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11137
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11122
11138
  responseText += output;
11123
11139
  } else {
11124
11140
  if (part.text) {
@@ -11131,13 +11147,13 @@ async function runNonInteractive({
11131
11147
  break;
11132
11148
  }
11133
11149
  case "tool_request": {
11134
- if (config.getOutputFormat() === "json" /* JSON */) {
11150
+ if (config.getOutputFormat() === OutputFormat.JSON) {
11135
11151
  preToolResponseText = responseText || preToolResponseText;
11136
11152
  responseText = "";
11137
11153
  }
11138
11154
  if (streamFormatter) {
11139
11155
  streamFormatter.emitEvent({
11140
- type: "tool_use" /* TOOL_USE */,
11156
+ type: JsonStreamEventType.TOOL_USE,
11141
11157
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11142
11158
  tool_name: event.name,
11143
11159
  tool_id: event.requestId,
@@ -11153,7 +11169,7 @@ async function runNonInteractive({
11153
11169
  const displayText = displayContentToString(display);
11154
11170
  const errorMsg = getTextContent(event.content) ?? "Tool error";
11155
11171
  streamFormatter.emitEvent({
11156
- type: "tool_result" /* TOOL_RESULT */,
11172
+ type: JsonStreamEventType.TOOL_RESULT,
11157
11173
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11158
11174
  tool_id: event.requestId,
11159
11175
  status: event.isError ? "error" : "success",
@@ -11168,17 +11184,17 @@ async function runNonInteractive({
11168
11184
  const display = event.display?.result;
11169
11185
  const displayText = displayContentToString(display);
11170
11186
  const errorMsg = getTextContent(event.content) ?? "Tool error";
11171
- if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
11172
- if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
11187
+ if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
11188
+ if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
11173
11189
  responseText = preToolResponseText;
11174
11190
  }
11175
11191
  const stopMessage = `Agent execution stopped: ${errorMsg}`;
11176
- if (config.getOutputFormat() === "text" /* TEXT */) {
11192
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11177
11193
  process.stderr.write(`${stopMessage}
11178
11194
  `);
11179
11195
  }
11180
11196
  }
11181
- if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
11197
+ if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
11182
11198
  throw new FatalToolExecutionError(
11183
11199
  "Error executing tool " + event.name + ": " + (displayText || errorMsg)
11184
11200
  );
@@ -11213,12 +11229,12 @@ async function runNonInteractive({
11213
11229
  }
11214
11230
  if (streamFormatter) {
11215
11231
  streamFormatter.emitEvent({
11216
- type: "error" /* ERROR */,
11232
+ type: JsonStreamEventType.ERROR,
11217
11233
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11218
11234
  severity: "error",
11219
11235
  message: errorMessage
11220
11236
  });
11221
- } else if (config.getOutputFormat() === "text" /* TEXT */) {
11237
+ } else if (config.getOutputFormat() === OutputFormat.TEXT) {
11222
11238
  process.stderr.write(`[ERROR] ${errorMessage}
11223
11239
  `);
11224
11240
  }
@@ -11239,12 +11255,12 @@ async function runNonInteractive({
11239
11255
  const errorCode = event._meta?.["code"];
11240
11256
  if (errorCode === "AGENT_EXECUTION_BLOCKED") {
11241
11257
  const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
11242
- if (config.getOutputFormat() === "text" /* TEXT */) {
11258
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11243
11259
  process.stderr.write(`[WARNING] ${blockMessage}
11244
11260
  `);
11245
11261
  } else if (streamFormatter) {
11246
11262
  streamFormatter.emitEvent({
11247
- type: "error" /* ERROR */,
11263
+ type: JsonStreamEventType.ERROR,
11248
11264
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11249
11265
  severity: "warning",
11250
11266
  message: stripAnsi(blockMessage)
@@ -11254,13 +11270,13 @@ async function runNonInteractive({
11254
11270
  break;
11255
11271
  }
11256
11272
  const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
11257
- if (config.getOutputFormat() === "text" /* TEXT */) {
11273
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11258
11274
  process.stderr.write(`[WARNING] ${event.message}
11259
11275
  `);
11260
11276
  }
11261
11277
  if (streamFormatter) {
11262
11278
  streamFormatter.emitEvent({
11263
- type: "error" /* ERROR */,
11279
+ type: JsonStreamEventType.ERROR,
11264
11280
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11265
11281
  severity,
11266
11282
  message: stripAnsi(event.message)
@@ -11280,7 +11296,7 @@ async function runNonInteractive({
11280
11296
  );
11281
11297
  } else if (streamFormatter) {
11282
11298
  streamFormatter.emitEvent({
11283
- type: "error" /* ERROR */,
11299
+ type: JsonStreamEventType.ERROR,
11284
11300
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11285
11301
  severity: "error",
11286
11302
  message: "Maximum session turns exceeded"
@@ -11288,7 +11304,7 @@ async function runNonInteractive({
11288
11304
  }
11289
11305
  }
11290
11306
  const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
11291
- if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
11307
+ if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
11292
11308
  process.stderr.write(`Agent execution stopped: ${stopMessage}
11293
11309
  `);
11294
11310
  }
@@ -11318,7 +11334,7 @@ async function runNonInteractive({
11318
11334
  abortController.signal.removeEventListener("abort", abortSession);
11319
11335
  scheduler?.dispose();
11320
11336
  consolePatcher.cleanup();
11321
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
11337
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
11322
11338
  }
11323
11339
  if (errorToHandle) {
11324
11340
  handleError(errorToHandle, config);
@@ -11346,7 +11362,7 @@ async function runNonInteractive2(params) {
11346
11362
  }
11347
11363
  });
11348
11364
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
11349
- const { setupInitialActivityLogger } = await import("./devtoolsService-2PJHOM3Z.js");
11365
+ const { setupInitialActivityLogger } = await import("./devtoolsService-YBK5NQJR.js");
11350
11366
  setupInitialActivityLogger(config);
11351
11367
  }
11352
11368
  const { stdout: workingStdout } = createWorkingStdio();
@@ -11362,7 +11378,7 @@ async function runNonInteractive2(params) {
11362
11378
  }
11363
11379
  };
11364
11380
  const startTime = Date.now();
11365
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
11381
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
11366
11382
  const abortController = new AbortController();
11367
11383
  let isAborting = false;
11368
11384
  let cancelMessageTimer = null;
@@ -11413,13 +11429,13 @@ async function runNonInteractive2(params) {
11413
11429
  let scheduler;
11414
11430
  try {
11415
11431
  consolePatcher.patch();
11416
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
11432
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
11417
11433
  process.stderr.write(
11418
11434
  "[WARNING] --raw-output is enabled. Model output is not sanitized and may contain harmful ANSI sequences (e.g. for phishing or command injection). Use --accept-raw-output-risk to suppress this warning.\n"
11419
11435
  );
11420
11436
  }
11421
11437
  setupStdinCancellation();
11422
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
11438
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
11423
11439
  coreEvents.drainBacklogs();
11424
11440
  process.stdout.on("error", (err) => {
11425
11441
  if (err.code === "EPIPE") {
@@ -11443,7 +11459,7 @@ async function runNonInteractive2(params) {
11443
11459
  }
11444
11460
  if (streamFormatter) {
11445
11461
  streamFormatter.emitEvent({
11446
- type: "init" /* INIT */,
11462
+ type: JsonStreamEventType.INIT,
11447
11463
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11448
11464
  session_id: config.getSessionId(),
11449
11465
  model: config.getModel()
@@ -11481,7 +11497,7 @@ async function runNonInteractive2(params) {
11481
11497
  }
11482
11498
  if (streamFormatter) {
11483
11499
  streamFormatter.emitEvent({
11484
- type: "message" /* MESSAGE */,
11500
+ type: JsonStreamEventType.MESSAGE,
11485
11501
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11486
11502
  role: "user",
11487
11503
  content: input
@@ -11509,28 +11525,28 @@ async function runNonInteractive2(params) {
11509
11525
  if (abortController.signal.aborted) {
11510
11526
  handleCancellationError(config);
11511
11527
  }
11512
- if (event.type === "content" /* Content */) {
11528
+ if (event.type === GeminiEventType.Content) {
11513
11529
  const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
11514
11530
  const output = isRaw ? event.value : stripAnsi(event.value);
11515
11531
  if (streamFormatter) {
11516
11532
  streamFormatter.emitEvent({
11517
- type: "message" /* MESSAGE */,
11533
+ type: JsonStreamEventType.MESSAGE,
11518
11534
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11519
11535
  role: "assistant",
11520
11536
  content: output,
11521
11537
  delta: true
11522
11538
  });
11523
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11539
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11524
11540
  responseText += output;
11525
11541
  } else {
11526
11542
  if (event.value) {
11527
11543
  textOutput.write(output);
11528
11544
  }
11529
11545
  }
11530
- } else if (event.type === "tool_call_request" /* ToolCallRequest */) {
11546
+ } else if (event.type === GeminiEventType.ToolCallRequest) {
11531
11547
  if (streamFormatter) {
11532
11548
  streamFormatter.emitEvent({
11533
- type: "tool_use" /* TOOL_USE */,
11549
+ type: JsonStreamEventType.TOOL_USE,
11534
11550
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11535
11551
  tool_name: event.value.name,
11536
11552
  tool_id: event.value.callId,
@@ -11538,33 +11554,33 @@ async function runNonInteractive2(params) {
11538
11554
  });
11539
11555
  }
11540
11556
  toolCallRequests.push(event.value);
11541
- } else if (event.type === "loop_detected" /* LoopDetected */) {
11557
+ } else if (event.type === GeminiEventType.LoopDetected) {
11542
11558
  const message = "Loop detected, stopping execution";
11543
11559
  if (streamFormatter) {
11544
11560
  streamFormatter.emitEvent({
11545
- type: "error" /* ERROR */,
11561
+ type: JsonStreamEventType.ERROR,
11546
11562
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11547
11563
  severity: "warning",
11548
11564
  message
11549
11565
  });
11550
11566
  }
11551
11567
  warnings.push(message);
11552
- } else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
11568
+ } else if (event.type === GeminiEventType.MaxSessionTurns) {
11553
11569
  const message = "Maximum session turns exceeded";
11554
11570
  if (streamFormatter) {
11555
11571
  streamFormatter.emitEvent({
11556
- type: "error" /* ERROR */,
11572
+ type: JsonStreamEventType.ERROR,
11557
11573
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11558
11574
  severity: "error",
11559
11575
  message
11560
11576
  });
11561
11577
  }
11562
11578
  warnings.push(message);
11563
- } else if (event.type === "error" /* Error */) {
11579
+ } else if (event.type === GeminiEventType.Error) {
11564
11580
  throw event.value.error;
11565
- } else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
11581
+ } else if (event.type === GeminiEventType.AgentExecutionStopped) {
11566
11582
  const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
11567
- if (config.getOutputFormat() === "text" /* TEXT */) {
11583
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11568
11584
  process.stderr.write(`${stopMessage}
11569
11585
  `);
11570
11586
  }
@@ -11572,7 +11588,7 @@ async function runNonInteractive2(params) {
11572
11588
  const metrics = uiTelemetryService.getMetrics();
11573
11589
  const durationMs = Date.now() - startTime;
11574
11590
  streamFormatter.emitEvent({
11575
- type: "result" /* RESULT */,
11591
+ type: JsonStreamEventType.RESULT,
11576
11592
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11577
11593
  status: "success",
11578
11594
  stats: streamFormatter.convertToStreamStats(
@@ -11580,7 +11596,7 @@ async function runNonInteractive2(params) {
11580
11596
  durationMs
11581
11597
  )
11582
11598
  });
11583
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11599
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11584
11600
  const formatter = new JsonFormatter();
11585
11601
  const stats = uiTelemetryService.getMetrics();
11586
11602
  textOutput.write(
@@ -11596,21 +11612,21 @@ async function runNonInteractive2(params) {
11596
11612
  textOutput.ensureTrailingNewline();
11597
11613
  }
11598
11614
  return;
11599
- } else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
11615
+ } else if (event.type === GeminiEventType.AgentExecutionBlocked) {
11600
11616
  const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
11601
- if (config.getOutputFormat() === "text" /* TEXT */) {
11617
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11602
11618
  process.stderr.write(`[WARNING] ${blockMessage}
11603
11619
  `);
11604
11620
  } else if (streamFormatter) {
11605
11621
  streamFormatter.emitEvent({
11606
- type: "error" /* ERROR */,
11622
+ type: JsonStreamEventType.ERROR,
11607
11623
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11608
11624
  severity: "warning",
11609
11625
  message: stripAnsi(blockMessage)
11610
11626
  });
11611
11627
  }
11612
11628
  warnings.push(blockMessage);
11613
- } else if (event.type === "invalid_stream" /* InvalidStream */) {
11629
+ } else if (event.type === GeminiEventType.InvalidStream) {
11614
11630
  const eventValue = event.value;
11615
11631
  if (eventValue?.type === "NO_RESPONSE_TEXT") {
11616
11632
  invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
@@ -11633,12 +11649,12 @@ async function runNonInteractive2(params) {
11633
11649
  );
11634
11650
  if (streamFormatter) {
11635
11651
  streamFormatter.emitEvent({
11636
- type: "error" /* ERROR */,
11652
+ type: JsonStreamEventType.ERROR,
11637
11653
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11638
11654
  severity: "error",
11639
11655
  message: invalidStreamError
11640
11656
  });
11641
- } else if (config.getOutputFormat() === "text" /* TEXT */) {
11657
+ } else if (config.getOutputFormat() === OutputFormat.TEXT) {
11642
11658
  process.stderr.write(`[ERROR] ${invalidStreamError}
11643
11659
  `);
11644
11660
  }
@@ -11658,7 +11674,7 @@ async function runNonInteractive2(params) {
11658
11674
  const requestInfo = completedToolCall.request;
11659
11675
  if (streamFormatter) {
11660
11676
  streamFormatter.emitEvent({
11661
- type: "tool_result" /* TOOL_RESULT */,
11677
+ type: JsonStreamEventType.TOOL_RESULT,
11662
11678
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11663
11679
  tool_id: requestInfo.callId,
11664
11680
  status: completedToolCall.status === "error" ? "error" : "success",
@@ -11692,11 +11708,11 @@ async function runNonInteractive2(params) {
11692
11708
  );
11693
11709
  }
11694
11710
  const stopExecutionTool = completedToolCalls.find(
11695
- (tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
11711
+ (tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
11696
11712
  );
11697
11713
  if (stopExecutionTool && stopExecutionTool.response.error) {
11698
11714
  const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
11699
- if (config.getOutputFormat() === "text" /* TEXT */) {
11715
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11700
11716
  process.stderr.write(`${stopMessage}
11701
11717
  `);
11702
11718
  }
@@ -11704,7 +11720,7 @@ async function runNonInteractive2(params) {
11704
11720
  const metrics = uiTelemetryService.getMetrics();
11705
11721
  const durationMs = Date.now() - startTime;
11706
11722
  streamFormatter.emitEvent({
11707
- type: "result" /* RESULT */,
11723
+ type: JsonStreamEventType.RESULT,
11708
11724
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11709
11725
  status: "success",
11710
11726
  stats: streamFormatter.convertToStreamStats(
@@ -11712,7 +11728,7 @@ async function runNonInteractive2(params) {
11712
11728
  durationMs
11713
11729
  )
11714
11730
  });
11715
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11731
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11716
11732
  const formatter = new JsonFormatter();
11717
11733
  const stats = uiTelemetryService.getMetrics();
11718
11734
  textOutput.write(
@@ -11735,12 +11751,12 @@ async function runNonInteractive2(params) {
11735
11751
  const metrics = uiTelemetryService.getMetrics();
11736
11752
  const durationMs = Date.now() - startTime;
11737
11753
  streamFormatter.emitEvent({
11738
- type: "result" /* RESULT */,
11754
+ type: JsonStreamEventType.RESULT,
11739
11755
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11740
11756
  status: invalidStreamError ? "error" : "success",
11741
11757
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
11742
11758
  });
11743
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11759
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11744
11760
  const formatter = new JsonFormatter();
11745
11761
  const stats = uiTelemetryService.getMetrics();
11746
11762
  textOutput.write(
@@ -11764,7 +11780,7 @@ async function runNonInteractive2(params) {
11764
11780
  cleanupStdinCancellation();
11765
11781
  scheduler?.dispose();
11766
11782
  consolePatcher.cleanup();
11767
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
11783
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
11768
11784
  }
11769
11785
  if (errorToHandle) {
11770
11786
  handleError(errorToHandle, config);
@@ -14155,12 +14171,12 @@ function toToolCallContent(toolResult) {
14155
14171
  }
14156
14172
  var basicPermissionOptions = [
14157
14173
  {
14158
- optionId: "proceed_once" /* ProceedOnce */,
14174
+ optionId: ToolConfirmationOutcome.ProceedOnce,
14159
14175
  name: "Allow",
14160
14176
  kind: "allow_once"
14161
14177
  },
14162
14178
  {
14163
- optionId: "cancel" /* Cancel */,
14179
+ optionId: ToolConfirmationOutcome.Cancel,
14164
14180
  name: "Reject",
14165
14181
  kind: "reject_once"
14166
14182
  }
@@ -14172,13 +14188,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14172
14188
  switch (confirmation.type) {
14173
14189
  case "edit":
14174
14190
  options.push({
14175
- optionId: "proceed_always" /* ProceedAlways */,
14191
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14176
14192
  name: "Allow for this session",
14177
14193
  kind: "allow_always"
14178
14194
  });
14179
14195
  if (enablePermanentToolApproval) {
14180
14196
  options.push({
14181
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14197
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14182
14198
  name: "Allow for this file in all future sessions",
14183
14199
  kind: "allow_always"
14184
14200
  });
@@ -14186,13 +14202,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14186
14202
  break;
14187
14203
  case "exec":
14188
14204
  options.push({
14189
- optionId: "proceed_always" /* ProceedAlways */,
14205
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14190
14206
  name: "Allow for this session",
14191
14207
  kind: "allow_always"
14192
14208
  });
14193
14209
  if (enablePermanentToolApproval) {
14194
14210
  options.push({
14195
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14211
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14196
14212
  name: "Allow this command for all future sessions",
14197
14213
  kind: "allow_always"
14198
14214
  });
@@ -14201,19 +14217,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14201
14217
  case "mcp":
14202
14218
  options.push(
14203
14219
  {
14204
- optionId: "proceed_always_server" /* ProceedAlwaysServer */,
14220
+ optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
14205
14221
  name: "Allow all server tools for this session",
14206
14222
  kind: "allow_always"
14207
14223
  },
14208
14224
  {
14209
- optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
14225
+ optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
14210
14226
  name: "Allow tool for this session",
14211
14227
  kind: "allow_always"
14212
14228
  }
14213
14229
  );
14214
14230
  if (enablePermanentToolApproval) {
14215
14231
  options.push({
14216
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14232
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14217
14233
  name: "Allow tool for all future sessions",
14218
14234
  kind: "allow_always"
14219
14235
  });
@@ -14221,13 +14237,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14221
14237
  break;
14222
14238
  case "info":
14223
14239
  options.push({
14224
- optionId: "proceed_always" /* ProceedAlways */,
14240
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14225
14241
  name: "Allow for this session",
14226
14242
  kind: "allow_always"
14227
14243
  });
14228
14244
  if (enablePermanentToolApproval) {
14229
14245
  options.push({
14230
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14246
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14231
14247
  name: "Allow for all future sessions",
14232
14248
  kind: "allow_always"
14233
14249
  });
@@ -14259,21 +14275,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14259
14275
  }
14260
14276
  function toAcpToolKind(kind) {
14261
14277
  switch (kind) {
14262
- case "read" /* Read */:
14263
- case "edit" /* Edit */:
14264
- case "execute" /* Execute */:
14265
- case "search" /* Search */:
14266
- case "delete" /* Delete */:
14267
- case "move" /* Move */:
14268
- case "think" /* Think */:
14269
- case "fetch" /* Fetch */:
14270
- case "switch_mode" /* SwitchMode */:
14271
- case "other" /* Other */:
14278
+ case Kind.Read:
14279
+ case Kind.Edit:
14280
+ case Kind.Execute:
14281
+ case Kind.Search:
14282
+ case Kind.Delete:
14283
+ case Kind.Move:
14284
+ case Kind.Think:
14285
+ case Kind.Fetch:
14286
+ case Kind.SwitchMode:
14287
+ case Kind.Other:
14272
14288
  return kind;
14273
- case "agent" /* Agent */:
14289
+ case Kind.Agent:
14274
14290
  return "think";
14275
- case "plan" /* Plan */:
14276
- case "communicate" /* Communicate */:
14291
+ case Kind.Plan:
14292
+ case Kind.Communicate:
14277
14293
  default:
14278
14294
  return "other";
14279
14295
  }
@@ -14281,24 +14297,24 @@ function toAcpToolKind(kind) {
14281
14297
  function buildAvailableModes(isPlanEnabled) {
14282
14298
  const modes = [
14283
14299
  {
14284
- id: "default" /* DEFAULT */,
14300
+ id: ApprovalMode.DEFAULT,
14285
14301
  name: "Default",
14286
14302
  description: "Prompts for approval"
14287
14303
  },
14288
14304
  {
14289
- id: "autoEdit" /* AUTO_EDIT */,
14305
+ id: ApprovalMode.AUTO_EDIT,
14290
14306
  name: "Auto Edit",
14291
14307
  description: "Auto-approves edit tools"
14292
14308
  },
14293
14309
  {
14294
- id: "yolo" /* YOLO */,
14310
+ id: ApprovalMode.YOLO,
14295
14311
  name: "YOLO",
14296
14312
  description: "Auto-approves all tools"
14297
14313
  }
14298
14314
  ];
14299
14315
  if (isPlanEnabled) {
14300
14316
  modes.push({
14301
- id: "plan" /* PLAN */,
14317
+ id: ApprovalMode.PLAN,
14302
14318
  name: "Plan",
14303
14319
  description: "Read-only mode"
14304
14320
  });
@@ -14311,7 +14327,7 @@ function buildAvailableModels(config, settings) {
14311
14327
  const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
14312
14328
  const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
14313
14329
  const selectedAuthType = settings.merged.security.auth.selectedType;
14314
- const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
14330
+ const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
14315
14331
  if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
14316
14332
  const options = config.getModelConfigService().getAvailableModelOptions({
14317
14333
  useGemini3_1: useGemini31,
@@ -14397,11 +14413,11 @@ var Session = class {
14397
14413
  this.connection = connection;
14398
14414
  this.settings = settings;
14399
14415
  coreEvents.on(
14400
- "approval-mode-changed" /* ApprovalModeChanged */,
14416
+ CoreEvent.ApprovalModeChanged,
14401
14417
  this.handleApprovalModeChanged
14402
14418
  );
14403
14419
  this.context.config.getMessageBus()?.subscribe(
14404
- "tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
14420
+ MessageBusType.TOOL_CONFIRMATION_REQUEST,
14405
14421
  this.handleToolConfirmationRequest,
14406
14422
  { signal: this.disposeController.signal }
14407
14423
  );
@@ -14425,7 +14441,7 @@ var Session = class {
14425
14441
  "Policy engine missing. Denying tool confirmation request."
14426
14442
  );
14427
14443
  await messageBus.publish({
14428
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14444
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14429
14445
  correlationId: request.correlationId,
14430
14446
  confirmed: false,
14431
14447
  requiresUserConfirmation: false
@@ -14438,7 +14454,7 @@ var Session = class {
14438
14454
  "Tool confirmation request missing tool name. Denying."
14439
14455
  );
14440
14456
  await messageBus.publish({
14441
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14457
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14442
14458
  correlationId: request.correlationId,
14443
14459
  confirmed: false,
14444
14460
  requiresUserConfirmation: false
@@ -14451,7 +14467,7 @@ var Session = class {
14451
14467
  `Tool confirmation request for unknown tool: ${toolName}. Denying.`
14452
14468
  );
14453
14469
  await messageBus.publish({
14454
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14470
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14455
14471
  correlationId: request.correlationId,
14456
14472
  confirmed: false,
14457
14473
  requiresUserConfirmation: false
@@ -14467,15 +14483,15 @@ var Session = class {
14467
14483
  request.subagent
14468
14484
  );
14469
14485
  await messageBus.publish({
14470
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14486
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14471
14487
  correlationId: request.correlationId,
14472
- confirmed: result.decision === "allow" /* ALLOW */,
14473
- requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
14488
+ confirmed: result.decision === PolicyDecision.ALLOW,
14489
+ requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
14474
14490
  });
14475
14491
  } catch (error) {
14476
14492
  debugLogger.error("Error handling tool confirmation request:", error);
14477
14493
  await this.context.config.getMessageBus()?.publish({
14478
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14494
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14479
14495
  correlationId: request.correlationId,
14480
14496
  confirmed: false,
14481
14497
  requiresUserConfirmation: false
@@ -14495,7 +14511,7 @@ var Session = class {
14495
14511
  };
14496
14512
  dispose() {
14497
14513
  coreEvents.off(
14498
- "approval-mode-changed" /* ApprovalModeChanged */,
14514
+ CoreEvent.ApprovalModeChanged,
14499
14515
  this.handleApprovalModeChanged
14500
14516
  );
14501
14517
  this.disposeController.abort();
@@ -14584,7 +14600,7 @@ ${thought.description}`;
14584
14600
  await this.sendUpdate({
14585
14601
  sessionUpdate: "tool_call",
14586
14602
  toolCallId: toolCall.id,
14587
- status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
14603
+ status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
14588
14604
  title: toolCall.displayName || toolCall.name,
14589
14605
  content: toolCallContent,
14590
14606
  kind: tool ? toAcpToolKind(tool.kind) : "other"
@@ -14676,7 +14692,7 @@ ${thought.description}`;
14676
14692
  return { stopReason: "cancelled" };
14677
14693
  }
14678
14694
  switch (event.type) {
14679
- case "content" /* Content */: {
14695
+ case GeminiEventType.Content: {
14680
14696
  const content = {
14681
14697
  type: "text",
14682
14698
  text: event.value
@@ -14687,7 +14703,7 @@ ${thought.description}`;
14687
14703
  });
14688
14704
  break;
14689
14705
  }
14690
- case "thought" /* Thought */: {
14706
+ case GeminiEventType.Thought: {
14691
14707
  const thoughtText = `**${event.value.subject}**
14692
14708
  ${event.value.description}`;
14693
14709
  await this.sendUpdate({
@@ -14696,10 +14712,10 @@ ${event.value.description}`;
14696
14712
  });
14697
14713
  break;
14698
14714
  }
14699
- case "tool_call_request" /* ToolCallRequest */:
14715
+ case GeminiEventType.ToolCallRequest:
14700
14716
  toolCallRequests.push(event.value);
14701
14717
  break;
14702
- case "finished" /* Finished */: {
14718
+ case GeminiEventType.Finished: {
14703
14719
  const usage2 = event.value.usageMetadata;
14704
14720
  if (usage2) {
14705
14721
  turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
@@ -14707,19 +14723,19 @@ ${event.value.description}`;
14707
14723
  }
14708
14724
  break;
14709
14725
  }
14710
- case "model_info" /* ModelInfo */:
14726
+ case GeminiEventType.ModelInfo:
14711
14727
  turnModelId = event.value;
14712
14728
  break;
14713
- case "max_session_turns" /* MaxSessionTurns */:
14729
+ case GeminiEventType.MaxSessionTurns:
14714
14730
  stopReason = "max_turn_requests";
14715
14731
  break;
14716
- case "loop_detected" /* LoopDetected */:
14732
+ case GeminiEventType.LoopDetected:
14717
14733
  stopReason = "max_turn_requests";
14718
14734
  break;
14719
- case "context_window_will_overflow" /* ContextWindowWillOverflow */:
14735
+ case GeminiEventType.ContextWindowWillOverflow:
14720
14736
  stopReason = "max_tokens";
14721
14737
  break;
14722
- case "error" /* Error */: {
14738
+ case GeminiEventType.Error: {
14723
14739
  const parseResult = StructuredErrorSchema.safeParse(
14724
14740
  event.value.error
14725
14741
  );
@@ -14947,7 +14963,7 @@ ${event.value.description}`;
14947
14963
  const output = RequestPermissionResponseSchema.parse(
14948
14964
  await this.connection.requestPermission(params)
14949
14965
  );
14950
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
14966
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
14951
14967
  await confirmationDetails.onConfirm(outcome);
14952
14968
  await updatePolicy(
14953
14969
  tool,
@@ -14958,16 +14974,16 @@ ${event.value.description}`;
14958
14974
  invocation
14959
14975
  );
14960
14976
  switch (outcome) {
14961
- case "cancel" /* Cancel */:
14977
+ case ToolConfirmationOutcome.Cancel:
14962
14978
  return errorResponse(
14963
14979
  new Error(`Tool "${fc.name}" was canceled by the user.`)
14964
14980
  );
14965
- case "proceed_once" /* ProceedOnce */:
14966
- case "proceed_always" /* ProceedAlways */:
14967
- case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
14968
- case "proceed_always_server" /* ProceedAlwaysServer */:
14969
- case "proceed_always_tool" /* ProceedAlwaysTool */:
14970
- case "modify_with_editor" /* ModifyWithEditor */:
14981
+ case ToolConfirmationOutcome.ProceedOnce:
14982
+ case ToolConfirmationOutcome.ProceedAlways:
14983
+ case ToolConfirmationOutcome.ProceedAlwaysAndSave:
14984
+ case ToolConfirmationOutcome.ProceedAlwaysServer:
14985
+ case ToolConfirmationOutcome.ProceedAlwaysTool:
14986
+ case ToolConfirmationOutcome.ModifyWithEditor:
14971
14987
  break;
14972
14988
  default: {
14973
14989
  const resultOutcome = outcome;
@@ -15021,7 +15037,7 @@ ${event.value.description}`;
15021
15037
  );
15022
15038
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
15023
15039
  {
15024
- status: "success" /* Success */,
15040
+ status: CoreToolCallStatus.Success,
15025
15041
  request: {
15026
15042
  callId,
15027
15043
  name: fc.name,
@@ -15066,7 +15082,7 @@ ${event.value.description}`;
15066
15082
  });
15067
15083
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
15068
15084
  {
15069
- status: "error" /* Error */,
15085
+ status: CoreToolCallStatus.Error,
15070
15086
  request: {
15071
15087
  callId,
15072
15088
  name: fc.name,
@@ -15194,12 +15210,12 @@ ${event.value.description}`;
15194
15210
  sessionId: this.id,
15195
15211
  options: [
15196
15212
  {
15197
- optionId: "proceed_once" /* ProceedOnce */,
15213
+ optionId: ToolConfirmationOutcome.ProceedOnce,
15198
15214
  name: "Allow once",
15199
15215
  kind: "allow_once"
15200
15216
  },
15201
15217
  {
15202
- optionId: "cancel" /* Cancel */,
15218
+ optionId: ToolConfirmationOutcome.Cancel,
15203
15219
  name: "Deny",
15204
15220
  kind: "reject_once"
15205
15221
  }
@@ -15224,8 +15240,8 @@ ${event.value.description}`;
15224
15240
  const output = RequestPermissionResponseSchema.parse(
15225
15241
  await this.connection.requestPermission(params)
15226
15242
  );
15227
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15228
- if (outcome === "proceed_once" /* ProceedOnce */) {
15243
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15244
+ if (outcome === ToolConfirmationOutcome.ProceedOnce) {
15229
15245
  this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
15230
15246
  validationError = null;
15231
15247
  } else {
@@ -15662,7 +15678,7 @@ var AcpSessionManager = class {
15662
15678
  mcpServers,
15663
15679
  loadedSettings
15664
15680
  );
15665
- const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
15681
+ const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
15666
15682
  let isAuthenticated = false;
15667
15683
  let authErrorMessage = "";
15668
15684
  try {
@@ -15674,7 +15690,7 @@ var AcpSessionManager = class {
15674
15690
  );
15675
15691
  isAuthenticated = true;
15676
15692
  const contentGeneratorConfig = config.getContentGeneratorConfig();
15677
- if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
15693
+ if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
15678
15694
  isAuthenticated = false;
15679
15695
  authErrorMessage = "Gemini API key is missing or not configured.";
15680
15696
  }
@@ -15783,7 +15799,7 @@ var AcpSessionManager = class {
15783
15799
  return response;
15784
15800
  }
15785
15801
  async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
15786
- const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
15802
+ const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
15787
15803
  if (!selectedAuthType) {
15788
15804
  throw RequestError.authRequired();
15789
15805
  }
@@ -15884,12 +15900,12 @@ var GeminiAgent = class {
15884
15900
  }
15885
15901
  const authMethods = [
15886
15902
  {
15887
- id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
15903
+ id: AuthType.LOGIN_WITH_GOOGLE,
15888
15904
  name: "Log in with Google",
15889
15905
  description: "Log in with your Google account"
15890
15906
  },
15891
15907
  {
15892
- id: "gemini-api-key" /* USE_GEMINI */,
15908
+ id: AuthType.USE_GEMINI,
15893
15909
  name: "Gemini API key",
15894
15910
  description: "Use an API key with Gemini Developer API",
15895
15911
  _meta: {
@@ -15899,12 +15915,12 @@ var GeminiAgent = class {
15899
15915
  }
15900
15916
  },
15901
15917
  {
15902
- id: "vertex-ai" /* USE_VERTEX_AI */,
15918
+ id: AuthType.USE_VERTEX_AI,
15903
15919
  name: "Vertex AI",
15904
15920
  description: "Use an API key with Vertex AI GenAI API"
15905
15921
  },
15906
15922
  {
15907
- id: "gateway" /* GATEWAY */,
15923
+ id: AuthType.GATEWAY,
15908
15924
  name: "AI API Gateway",
15909
15925
  description: "Use a custom AI API Gateway",
15910
15926
  _meta: {
@@ -16077,7 +16093,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
16077
16093
  }
16078
16094
  return authType;
16079
16095
  } catch (error) {
16080
- if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
16096
+ if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
16081
16097
  handleError(
16082
16098
  error instanceof Error ? error : new Error(String(error)),
16083
16099
  nonInteractiveConfig,
@@ -16272,10 +16288,10 @@ var SlashCommandConflictHandler = class {
16272
16288
  this.handleConflicts = this.handleConflicts.bind(this);
16273
16289
  }
16274
16290
  start() {
16275
- coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
16291
+ coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
16276
16292
  }
16277
16293
  stop() {
16278
- coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
16294
+ coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
16279
16295
  if (this.flushTimeout) {
16280
16296
  clearTimeout(this.flushTimeout);
16281
16297
  this.flushTimeout = null;
@@ -16556,7 +16572,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
16556
16572
  }
16557
16573
  }
16558
16574
  async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
16559
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-UPSM5SHZ.js");
16575
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-O4YSZIKG.js");
16560
16576
  await doStartUI(
16561
16577
  config,
16562
16578
  settings,
@@ -16659,12 +16675,12 @@ async function main() {
16659
16675
  dns.setDefaultResultOrder(
16660
16676
  validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
16661
16677
  );
16662
- if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
16678
+ if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
16663
16679
  if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
16664
16680
  settings.setValue(
16665
16681
  "User" /* User */,
16666
16682
  "security.auth.selectedType",
16667
- "compute-default-credentials" /* COMPUTE_ADC */
16683
+ AuthType.COMPUTE_ADC
16668
16684
  );
16669
16685
  }
16670
16686
  }
@@ -16765,7 +16781,7 @@ ${finalArgs[promptIndex + 1]}`;
16765
16781
  await config.storage.initialize();
16766
16782
  adminControlsListner.setConfig(config);
16767
16783
  if (config.isInteractive() && settings.merged.general.devtools) {
16768
- const { setupInitialActivityLogger } = await import("./devtoolsService-2PJHOM3Z.js");
16784
+ const { setupInitialActivityLogger } = await import("./devtoolsService-YBK5NQJR.js");
16769
16785
  setupInitialActivityLogger(config);
16770
16786
  }
16771
16787
  registerTelemetryConfig(config);
@@ -16773,7 +16789,7 @@ ${finalArgs[promptIndex + 1]}`;
16773
16789
  const messageBus = config.getMessageBus();
16774
16790
  createPolicyUpdater2(policyEngine, messageBus, config.storage);
16775
16791
  registerCleanup(async () => {
16776
- await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
16792
+ await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
16777
16793
  });
16778
16794
  if (!config.getAcpMode()) {
16779
16795
  registerCleanup(consolePatcher.cleanup);
@@ -16824,7 +16840,7 @@ ${finalArgs[promptIndex + 1]}`;
16824
16840
  const initAppHandle = startupProfiler.start("initialize_app");
16825
16841
  const initializationResult = await initializeApp(config, settings);
16826
16842
  initAppHandle?.end();
16827
- import("./liteRtServerManager-MU2XFPN4.js").then(({ LiteRtServerManager }) => {
16843
+ import("./liteRtServerManager-NW33H3DY.js").then(({ LiteRtServerManager }) => {
16828
16844
  const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
16829
16845
  if (!mergedGemma) return;
16830
16846
  const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
@@ -16834,7 +16850,7 @@ ${finalArgs[promptIndex + 1]}`;
16834
16850
  autoStartServer: userGemma?.autoStartServer
16835
16851
  });
16836
16852
  }).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
16837
- if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
16853
+ if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
16838
16854
  await getOauthClient(settings.merged.security.auth.selectedType, config);
16839
16855
  }
16840
16856
  if (config.getAcpMode()) {
@@ -16850,7 +16866,7 @@ ${finalArgs[promptIndex + 1]}`;
16850
16866
  ...rawStartupWarnings.map((message) => ({
16851
16867
  id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
16852
16868
  message,
16853
- priority: "high" /* High */
16869
+ priority: WarningPriority.High
16854
16870
  })),
16855
16871
  ...await getUserStartupWarnings(settings.merged, void 0, {
16856
16872
  isAlternateBuffer: useAlternateBuffer
@@ -16887,7 +16903,7 @@ ${finalArgs[promptIndex + 1]}`;
16887
16903
  ${input}` : stdinData;
16888
16904
  }
16889
16905
  }
16890
- const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
16906
+ const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
16891
16907
  const hookSystem = config?.getHookSystem();
16892
16908
  if (hookSystem) {
16893
16909
  const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
@@ -16944,8 +16960,8 @@ ${input}` : wrappedContext;
16944
16960
  }
16945
16961
  }
16946
16962
  function initializeOutputListenersAndFlush(config) {
16947
- if (coreEvents.listenerCount("output" /* Output */) === 0) {
16948
- coreEvents.on("output" /* Output */, (payload) => {
16963
+ if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
16964
+ coreEvents.on(CoreEvent.Output, (payload) => {
16949
16965
  if (payload.isStderr) {
16950
16966
  writeToStderr(payload.chunk, payload.encoding);
16951
16967
  } else {
@@ -16953,8 +16969,8 @@ function initializeOutputListenersAndFlush(config) {
16953
16969
  }
16954
16970
  });
16955
16971
  }
16956
- if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
16957
- coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
16972
+ if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
16973
+ coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
16958
16974
  if (payload.type === "error" || payload.type === "warn") {
16959
16975
  writeToStderr(payload.content + "\n");
16960
16976
  } else {
@@ -16962,8 +16978,8 @@ function initializeOutputListenersAndFlush(config) {
16962
16978
  }
16963
16979
  });
16964
16980
  }
16965
- if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
16966
- coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
16981
+ if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
16982
+ coreEvents.on(CoreEvent.UserFeedback, (payload) => {
16967
16983
  writeToStderr(payload.message + "\n");
16968
16984
  });
16969
16985
  }
@@ -16971,7 +16987,7 @@ function initializeOutputListenersAndFlush(config) {
16971
16987
  const forceToStderr = outputFormat === "json";
16972
16988
  coreEvents.drainBacklogs(
16973
16989
  (event, args) => {
16974
- if (forceToStderr && event === "output" /* Output */) {
16990
+ if (forceToStderr && event === CoreEvent.Output) {
16975
16991
  const payload = args[0];
16976
16992
  if (!payload.isStderr) {
16977
16993
  return {