@google/gemini-cli 0.57.0-preview.0 → 0.57.0-preview.1

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-ACDZS2RE.js → chunk-3BVBON3V.js} +1 -1
  2. package/bundle/{chunk-2UGGPOEV.js → chunk-3NPMAHLX.js} +1 -1
  3. package/bundle/{chunk-QVDXZMEX.js → chunk-4ALCU2HQ.js} +1 -1
  4. package/bundle/{chunk-NXS624CI.js → chunk-4SNEOO5E.js} +2 -2
  5. package/bundle/{chunk-73OHVDUZ.js → chunk-65C235NM.js} +7 -7
  6. package/bundle/{chunk-HKTHSWSS.js → chunk-AKCYXG7C.js} +7 -7
  7. package/bundle/{chunk-IKGOC5B6.js → chunk-ALVDOQNA.js} +1 -1
  8. package/bundle/{chunk-OFFEM74O.js → chunk-EAK33LFP.js} +1 -1
  9. package/bundle/{chunk-3C6JYNPC.js → chunk-FHDRG5U4.js} +67 -54
  10. package/bundle/{chunk-2UICYJMD.js → chunk-G65GW52B.js} +107 -21
  11. package/bundle/{chunk-WH63Z45A.js → chunk-GK7NUJ35.js} +8 -5
  12. package/bundle/{chunk-SHIJDXMN.js → chunk-GMQ6QNZB.js} +1 -1
  13. package/bundle/chunk-LNXGFWGZ.js +17332 -0
  14. package/bundle/{chunk-O3QB4SVS.js → chunk-MBWROXYM.js} +2 -2
  15. package/bundle/{chunk-W4CY7TCG.js → chunk-NMMXRZ53.js} +2 -2
  16. package/bundle/{chunk-R3JDAZVL.js → chunk-NPOI4K6X.js} +7771 -14363
  17. package/bundle/{chunk-QB46S6FV.js → chunk-NQ4RH42O.js} +9 -8
  18. package/bundle/{chunk-FWGOOSQK.js → chunk-O7SBKM7M.js} +112 -20
  19. package/bundle/{chunk-M6E5CLIH.js → chunk-Q73BPF7A.js} +1 -1
  20. package/bundle/{chunk-XDJMDRLM.js → chunk-QJP6CMLN.js} +3 -3
  21. package/bundle/{chunk-EBKNEOAO.js → chunk-RLDNUS35.js} +1 -1
  22. package/bundle/{chunk-H2URGA7U.js → chunk-S5UX3QS5.js} +3 -3
  23. package/bundle/{chunk-XZF4EZOQ.js → chunk-SCBVGZXH.js} +1 -1
  24. package/bundle/chunk-SWQAIZEQ.js +102506 -0
  25. package/bundle/{chunk-6S4UF4JM.js → chunk-UMQE7UC6.js} +3 -3
  26. package/bundle/{chunk-ZY7Z5W6K.js → chunk-VBK54QCZ.js} +1 -1
  27. package/bundle/chunk-VGGWKRAC.js +154 -0
  28. package/bundle/chunk-W23OOD2C.js +118 -0
  29. package/bundle/chunk-WDFSF5L4.js +397601 -0
  30. package/bundle/chunk-XESAM7IL.js +512 -0
  31. package/bundle/chunk-Y3APL4PE.js +1571 -0
  32. package/bundle/chunk-ZMPGHLGO.js +398 -0
  33. package/bundle/{cleanup-JP2FD3CQ.js → cleanup-2W5DPMY3.js} +2 -2
  34. package/bundle/{cleanup-YFIFTNZ6.js → cleanup-OTHE7RNU.js} +2 -2
  35. package/bundle/{cleanup-Z65H2CUW.js → cleanup-SM67K64R.js} +2 -2
  36. package/bundle/cleanup-XAUT5CMD.js +32 -0
  37. package/bundle/{core-UBOS4Q6R.js → core-US34OW5M.js} +7 -1
  38. package/bundle/{devtoolsService-A34WT2MQ.js → devtoolsService-5J53UK6Z.js} +2 -2
  39. package/bundle/{devtoolsService-ACKZ7HRR.js → devtoolsService-GU2GQSOF.js} +2 -2
  40. package/bundle/{devtoolsService-BHG3WQEY.js → devtoolsService-JBFUXTCT.js} +4 -3
  41. package/bundle/devtoolsService-V46GUHRF.js +4359 -0
  42. package/bundle/{dist-B7OLK6PK.js → dist-5TYMQVIZ.js} +7 -1
  43. package/bundle/{core-EKXLT2AG.js → dist-OWKHVWTR.js} +7 -1
  44. package/bundle/dist-V5VJYW6J.js +2180 -0
  45. package/bundle/{gemini-3U3DNSSI.js → gemini-3M22N2C3.js} +13 -13
  46. package/bundle/{gemini-NJXFBFVJ.js → gemini-LSMTDETS.js} +214 -198
  47. package/bundle/gemini-OZOYJF22.js +17091 -0
  48. package/bundle/{gemini-7Z3ODIIX.js → gemini-W2B6CLJC.js} +13 -13
  49. package/bundle/gemini.js +7 -7
  50. package/bundle/{interactiveCli-FIWFPOOG.js → interactiveCli-D6H37PJQ.js} +40 -18
  51. package/bundle/{interactiveCli-DNV4GCM5.js → interactiveCli-L3ZXOVEV.js} +347 -306
  52. package/bundle/{interactiveCli-LMXAWUCU.js → interactiveCli-LQJM6LRE.js} +40 -18
  53. package/bundle/interactiveCli-RGOYDSMH.js +34984 -0
  54. package/bundle/{liteRtServerManager-P62A6ZVG.js → liteRtServerManager-3BY6TBHG.js} +4 -4
  55. package/bundle/{liteRtServerManager-VBKDVKLU.js → liteRtServerManager-C5WZRQUF.js} +4 -4
  56. package/bundle/{liteRtServerManager-LQMOE7JK.js → liteRtServerManager-IGKUGGP4.js} +4 -4
  57. package/bundle/liteRtServerManager-IJ4I2PZA.js +65 -0
  58. package/bundle/{oauth2-provider-FWKP5A4D.js → oauth2-provider-KSRLPOK3.js} +1 -1
  59. package/bundle/{oauth2-provider-BKNKX6FS.js → oauth2-provider-RWKTMYJF.js} +1 -1
  60. package/bundle/{oauth2-provider-UPRM4Y2J.js → oauth2-provider-VHNLCU4Y.js} +38 -72
  61. package/bundle/oauth2-provider-ZT4OFVMK.js +235 -0
  62. package/bundle/{start-DG3DHS3K.js → start-EXAQFM4Y.js} +6 -6
  63. package/bundle/{start-Y2JKSYXK.js → start-IPZF32E3.js} +6 -6
  64. package/bundle/{start-BMBCT2CF.js → start-SVNTSNHV.js} +6 -6
  65. package/bundle/start-ZXU5BFZY.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-H2URGA7U.js";
5
+ } from "./chunk-W23OOD2C.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-HKTHSWSS.js";
48
+ } from "./chunk-FHDRG5U4.js";
49
49
  import {
50
50
  exitCli,
51
51
  require_source
52
- } from "./chunk-ACDZS2RE.js";
52
+ } from "./chunk-Y3APL4PE.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-WH63Z45A.js";
90
+ } from "./chunk-GK7NUJ35.js";
91
91
  import {
92
92
  RELAUNCH_EXIT_CODE
93
- } from "./chunk-W4CY7TCG.js";
94
- import "./chunk-QB46S6FV.js";
93
+ } from "./chunk-MBWROXYM.js";
94
+ import "./chunk-XESAM7IL.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-2UGGPOEV.js";
103
+ } from "./chunk-3NPMAHLX.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,
@@ -238,7 +254,7 @@ import {
238
254
  updatePolicy,
239
255
  writeToStderr,
240
256
  writeToStdout
241
- } from "./chunk-R3JDAZVL.js";
257
+ } from "./chunk-G65GW52B.js";
242
258
  import "./chunk-664ZODQF.js";
243
259
  import "./chunk-IUUIT4SU.js";
244
260
  import "./chunk-TUDYL3X4.js";
@@ -5368,7 +5384,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
5368
5384
  async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
5369
5385
  const isStdio = !!config.command;
5370
5386
  if (isStdio && !isTrusted) {
5371
- return "disconnected" /* DISCONNECTED */;
5387
+ return MCPServerStatus.DISCONNECTED;
5372
5388
  }
5373
5389
  const client = new Client({
5374
5390
  name: "mcp-test-client",
@@ -5404,7 +5420,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5404
5420
  transport = await createTransport(serverName, config, false, mcpContext);
5405
5421
  } catch {
5406
5422
  await client.close();
5407
- return "disconnected" /* DISCONNECTED */;
5423
+ return MCPServerStatus.DISCONNECTED;
5408
5424
  }
5409
5425
  try {
5410
5426
  const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
@@ -5418,10 +5434,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5418
5434
  );
5419
5435
  }
5420
5436
  await client.close();
5421
- return "connected" /* CONNECTED */;
5437
+ return MCPServerStatus.CONNECTED;
5422
5438
  } catch {
5423
5439
  await transport.close();
5424
- return "disconnected" /* DISCONNECTED */;
5440
+ return MCPServerStatus.DISCONNECTED;
5425
5441
  }
5426
5442
  }
5427
5443
  async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
@@ -5434,12 +5450,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
5434
5450
  });
5435
5451
  if (!loadResult.allowed) {
5436
5452
  if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
5437
- return "blocked" /* BLOCKED */;
5453
+ return MCPServerStatus.BLOCKED;
5438
5454
  }
5439
- return "disabled" /* DISABLED */;
5455
+ return MCPServerStatus.DISABLED;
5440
5456
  }
5441
5457
  if (!isTrusted) {
5442
- return "disabled" /* DISABLED */;
5458
+ return MCPServerStatus.DISABLED;
5443
5459
  }
5444
5460
  return testMCPConnection(serverName, server, isTrusted, activeSettings);
5445
5461
  }
@@ -5485,23 +5501,23 @@ async function listMcpServers(loadedSettingsArg) {
5485
5501
  let statusIndicator = "";
5486
5502
  let statusText = "";
5487
5503
  switch (status) {
5488
- case "connected" /* CONNECTED */:
5504
+ case MCPServerStatus.CONNECTED:
5489
5505
  statusIndicator = import_chalk.default.green("\u2713");
5490
5506
  statusText = "Connected";
5491
5507
  break;
5492
- case "connecting" /* CONNECTING */:
5508
+ case MCPServerStatus.CONNECTING:
5493
5509
  statusIndicator = import_chalk.default.yellow("\u2026");
5494
5510
  statusText = "Connecting";
5495
5511
  break;
5496
- case "blocked" /* BLOCKED */:
5512
+ case MCPServerStatus.BLOCKED:
5497
5513
  statusIndicator = import_chalk.default.red("\u26D4");
5498
5514
  statusText = "Blocked";
5499
5515
  break;
5500
- case "disabled" /* DISABLED */:
5516
+ case MCPServerStatus.DISABLED:
5501
5517
  statusIndicator = import_chalk.default.gray("\u25CB");
5502
5518
  statusText = "Disabled";
5503
5519
  break;
5504
- case "disconnected" /* DISCONNECTED */:
5520
+ case MCPServerStatus.DISCONNECTED:
5505
5521
  default:
5506
5522
  statusIndicator = import_chalk.default.red("\u2717");
5507
5523
  statusText = "Disconnected";
@@ -5787,7 +5803,7 @@ async function handleInstall(args) {
5787
5803
  );
5788
5804
  if (confirmed) {
5789
5805
  const trustedFolders = loadTrustedFolders();
5790
- await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
5806
+ await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
5791
5807
  } else {
5792
5808
  throw new Error(
5793
5809
  `Installation aborted: Folder "${absolutePath}" is not trusted.`
@@ -7832,7 +7848,7 @@ async function loadSandboxConfig(settings, argv) {
7832
7848
  }
7833
7849
  const command2 = getSandboxCommand(sandboxValue);
7834
7850
  const packageJson = await getPackageJson(__dirname3);
7835
- const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.56.0-nightly.20260806.g761f604c1" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7851
+ const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.57.0-preview.1" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7836
7852
  const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
7837
7853
  return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
7838
7854
  }
@@ -7891,9 +7907,9 @@ async function resolveWorkspacePolicyState(options) {
7891
7907
  cwd,
7892
7908
  potentialWorkspacePoliciesDir
7893
7909
  );
7894
- if (integrityResult.status === "MATCH" /* MATCH */) {
7910
+ if (integrityResult.status === IntegrityStatus.MATCH) {
7895
7911
  workspacePoliciesDir = potentialWorkspacePoliciesDir;
7896
- } else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
7912
+ } else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
7897
7913
  workspacePoliciesDir = void 0;
7898
7914
  } else if (interactive && !autoAcceptWorkspacePolicies) {
7899
7915
  policyUpdateConfirmationRequest = {
@@ -8321,23 +8337,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8321
8337
  if (rawApprovalMode) {
8322
8338
  switch (rawApprovalMode) {
8323
8339
  case "yolo":
8324
- approvalMode = "yolo" /* YOLO */;
8340
+ approvalMode = ApprovalMode.YOLO;
8325
8341
  break;
8326
8342
  case "auto_edit":
8327
- approvalMode = "autoEdit" /* AUTO_EDIT */;
8343
+ approvalMode = ApprovalMode.AUTO_EDIT;
8328
8344
  break;
8329
8345
  case "plan":
8330
8346
  if (!(settings.general?.plan?.enabled ?? true)) {
8331
8347
  debugLogger.warn(
8332
8348
  'Approval mode "plan" is disabled in your settings. Falling back to "default".'
8333
8349
  );
8334
- approvalMode = "default" /* DEFAULT */;
8350
+ approvalMode = ApprovalMode.DEFAULT;
8335
8351
  } else {
8336
- approvalMode = "plan" /* PLAN */;
8352
+ approvalMode = ApprovalMode.PLAN;
8337
8353
  }
8338
8354
  break;
8339
8355
  case "default":
8340
- approvalMode = "default" /* DEFAULT */;
8356
+ approvalMode = ApprovalMode.DEFAULT;
8341
8357
  break;
8342
8358
  default:
8343
8359
  throw new Error(
@@ -8345,10 +8361,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8345
8361
  );
8346
8362
  }
8347
8363
  } else {
8348
- approvalMode = "default" /* DEFAULT */;
8364
+ approvalMode = ApprovalMode.DEFAULT;
8349
8365
  }
8350
8366
  if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
8351
- if (approvalMode === "yolo" /* YOLO */) {
8367
+ if (approvalMode === ApprovalMode.YOLO) {
8352
8368
  if (settings.admin?.secureModeEnabled) {
8353
8369
  debugLogger.error(
8354
8370
  'YOLO mode is disabled by "secureModeEnabled" setting.'
@@ -8366,16 +8382,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8366
8382
  )
8367
8383
  );
8368
8384
  }
8369
- } else if (approvalMode === "yolo" /* YOLO */) {
8385
+ } else if (approvalMode === ApprovalMode.YOLO) {
8370
8386
  debugLogger.warn(
8371
8387
  "YOLO mode is enabled. All tool calls will be automatically approved."
8372
8388
  );
8373
8389
  }
8374
- if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
8390
+ if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
8375
8391
  debugLogger.warn(
8376
8392
  `Approval mode overridden to "default" because the current folder is not trusted.`
8377
8393
  );
8378
- approvalMode = "default" /* DEFAULT */;
8394
+ approvalMode = ApprovalMode.DEFAULT;
8379
8395
  }
8380
8396
  let telemetrySettings;
8381
8397
  try {
@@ -10412,7 +10428,7 @@ import path9 from "node:path";
10412
10428
  import process4 from "node:process";
10413
10429
  var homeDirectoryCheck = {
10414
10430
  id: "home-directory",
10415
- priority: "low" /* Low */,
10431
+ priority: WarningPriority.Low,
10416
10432
  check: async (workspaceRoot, settings) => {
10417
10433
  if (settings.ui?.showHomeDirectoryWarning === false) {
10418
10434
  return null;
@@ -10436,7 +10452,7 @@ var homeDirectoryCheck = {
10436
10452
  };
10437
10453
  var rootDirectoryCheck = {
10438
10454
  id: "root-directory",
10439
- priority: "high" /* High */,
10455
+ priority: WarningPriority.High,
10440
10456
  check: async (workspaceRoot, _settings) => {
10441
10457
  try {
10442
10458
  const workspaceRealPath = await fs9.realpath(workspaceRoot);
@@ -10452,7 +10468,7 @@ var rootDirectoryCheck = {
10452
10468
  };
10453
10469
  var folderTrustCheck = {
10454
10470
  id: "folder-trust",
10455
- priority: "high" /* High */,
10471
+ priority: WarningPriority.High,
10456
10472
  check: async (workspaceRoot, settings) => {
10457
10473
  if (!isFolderTrustEnabled(settings)) {
10458
10474
  return null;
@@ -10642,12 +10658,12 @@ function handleError(error, config, customErrorCode) {
10642
10658
  error,
10643
10659
  config.getContentGeneratorConfig()?.authType
10644
10660
  );
10645
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10661
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10646
10662
  const streamFormatter = new StreamJsonFormatter();
10647
10663
  const errorCode = customErrorCode ?? extractErrorCode(error);
10648
10664
  const metrics = uiTelemetryService.getMetrics();
10649
10665
  streamFormatter.emitEvent({
10650
- type: "result" /* RESULT */,
10666
+ type: JsonStreamEventType.RESULT,
10651
10667
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10652
10668
  status: "error",
10653
10669
  error: {
@@ -10658,7 +10674,7 @@ function handleError(error, config, customErrorCode) {
10658
10674
  });
10659
10675
  runSyncCleanup();
10660
10676
  process.exit(getNumericExitCode(errorCode));
10661
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10677
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10662
10678
  const formatter = new JsonFormatter();
10663
10679
  const errorCode = customErrorCode ?? extractErrorCode(error);
10664
10680
  const formattedError = formatter.formatError(
@@ -10678,11 +10694,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
10678
10694
  const isFatal = isFatalToolError(errorType);
10679
10695
  if (isFatal) {
10680
10696
  const toolExecutionError = new FatalToolExecutionError(errorMessage);
10681
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10697
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10682
10698
  const streamFormatter = new StreamJsonFormatter();
10683
10699
  const metrics = uiTelemetryService.getMetrics();
10684
10700
  streamFormatter.emitEvent({
10685
- type: "result" /* RESULT */,
10701
+ type: JsonStreamEventType.RESULT,
10686
10702
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10687
10703
  status: "error",
10688
10704
  error: {
@@ -10691,7 +10707,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
10691
10707
  },
10692
10708
  stats: streamFormatter.convertToStreamStats(metrics, 0)
10693
10709
  });
10694
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10710
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10695
10711
  const formatter = new JsonFormatter();
10696
10712
  const formattedError = formatter.formatError(
10697
10713
  toolExecutionError,
@@ -10709,11 +10725,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
10709
10725
  }
10710
10726
  function handleCancellationError(config) {
10711
10727
  const cancellationError = new FatalCancellationError("Operation cancelled.");
10712
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10728
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10713
10729
  const streamFormatter = new StreamJsonFormatter();
10714
10730
  const metrics = uiTelemetryService.getMetrics();
10715
10731
  streamFormatter.emitEvent({
10716
- type: "result" /* RESULT */,
10732
+ type: JsonStreamEventType.RESULT,
10717
10733
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10718
10734
  status: "error",
10719
10735
  error: {
@@ -10724,7 +10740,7 @@ function handleCancellationError(config) {
10724
10740
  });
10725
10741
  runSyncCleanup();
10726
10742
  process.exit(cancellationError.exitCode);
10727
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10743
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10728
10744
  const formatter = new JsonFormatter();
10729
10745
  const formattedError = formatter.formatError(
10730
10746
  cancellationError,
@@ -10744,11 +10760,11 @@ function handleMaxTurnsExceededError(config) {
10744
10760
  const maxTurnsError = new FatalTurnLimitedError(
10745
10761
  "Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
10746
10762
  );
10747
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10763
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10748
10764
  const streamFormatter = new StreamJsonFormatter();
10749
10765
  const metrics = uiTelemetryService.getMetrics();
10750
10766
  streamFormatter.emitEvent({
10751
- type: "result" /* RESULT */,
10767
+ type: JsonStreamEventType.RESULT,
10752
10768
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10753
10769
  status: "error",
10754
10770
  error: {
@@ -10759,7 +10775,7 @@ function handleMaxTurnsExceededError(config) {
10759
10775
  });
10760
10776
  runSyncCleanup();
10761
10777
  process.exit(maxTurnsError.exitCode);
10762
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10778
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10763
10779
  const formatter = new JsonFormatter();
10764
10780
  const formattedError = formatter.formatError(
10765
10781
  maxTurnsError,
@@ -10839,7 +10855,7 @@ async function runNonInteractive({
10839
10855
  }
10840
10856
  });
10841
10857
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
10842
- const { setupInitialActivityLogger } = await import("./devtoolsService-A34WT2MQ.js");
10858
+ const { setupInitialActivityLogger } = await import("./devtoolsService-JBFUXTCT.js");
10843
10859
  setupInitialActivityLogger(config);
10844
10860
  }
10845
10861
  const { stdout: workingStdout } = createWorkingStdio();
@@ -10855,7 +10871,7 @@ async function runNonInteractive({
10855
10871
  }
10856
10872
  };
10857
10873
  const startTime = Date.now();
10858
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
10874
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
10859
10875
  const abortController = new AbortController();
10860
10876
  let isAborting = false;
10861
10877
  let cancelMessageTimer = null;
@@ -10908,13 +10924,13 @@ async function runNonInteractive({
10908
10924
  };
10909
10925
  try {
10910
10926
  consolePatcher.patch();
10911
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
10927
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
10912
10928
  process.stderr.write(
10913
10929
  "[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"
10914
10930
  );
10915
10931
  }
10916
10932
  setupStdinCancellation();
10917
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
10933
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
10918
10934
  coreEvents.drainBacklogs();
10919
10935
  process.stdout.on("error", (err) => {
10920
10936
  if (err.code === "EPIPE") {
@@ -10940,7 +10956,7 @@ async function runNonInteractive({
10940
10956
  }
10941
10957
  if (streamFormatter) {
10942
10958
  streamFormatter.emitEvent({
10943
- type: "init" /* INIT */,
10959
+ type: JsonStreamEventType.INIT,
10944
10960
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10945
10961
  session_id: config.getSessionId(),
10946
10962
  model: config.getModel()
@@ -10978,7 +10994,7 @@ async function runNonInteractive({
10978
10994
  }
10979
10995
  if (streamFormatter) {
10980
10996
  streamFormatter.emitEvent({
10981
- type: "message" /* MESSAGE */,
10997
+ type: JsonStreamEventType.MESSAGE,
10982
10998
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10983
10999
  role: "user",
10984
11000
  content: input
@@ -11017,12 +11033,12 @@ async function runNonInteractive({
11017
11033
  const metrics = uiTelemetryService.getMetrics();
11018
11034
  const durationMs = Date.now() - startTime;
11019
11035
  streamFormatter.emitEvent({
11020
- type: "result" /* RESULT */,
11036
+ type: JsonStreamEventType.RESULT,
11021
11037
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11022
11038
  status: errorPayload ? "error" : "success",
11023
11039
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
11024
11040
  });
11025
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11041
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11026
11042
  const formatter = new JsonFormatter();
11027
11043
  const stats = uiTelemetryService.getMetrics();
11028
11044
  textOutput.write(
@@ -11115,13 +11131,13 @@ async function runNonInteractive({
11115
11131
  const output = isRaw ? part.text : stripAnsi(part.text);
11116
11132
  if (streamFormatter) {
11117
11133
  streamFormatter.emitEvent({
11118
- type: "message" /* MESSAGE */,
11134
+ type: JsonStreamEventType.MESSAGE,
11119
11135
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11120
11136
  role: "assistant",
11121
11137
  content: output,
11122
11138
  delta: true
11123
11139
  });
11124
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11140
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11125
11141
  responseText += output;
11126
11142
  } else {
11127
11143
  if (part.text) {
@@ -11134,13 +11150,13 @@ async function runNonInteractive({
11134
11150
  break;
11135
11151
  }
11136
11152
  case "tool_request": {
11137
- if (config.getOutputFormat() === "json" /* JSON */) {
11153
+ if (config.getOutputFormat() === OutputFormat.JSON) {
11138
11154
  preToolResponseText = responseText || preToolResponseText;
11139
11155
  responseText = "";
11140
11156
  }
11141
11157
  if (streamFormatter) {
11142
11158
  streamFormatter.emitEvent({
11143
- type: "tool_use" /* TOOL_USE */,
11159
+ type: JsonStreamEventType.TOOL_USE,
11144
11160
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11145
11161
  tool_name: event.name,
11146
11162
  tool_id: event.requestId,
@@ -11156,7 +11172,7 @@ async function runNonInteractive({
11156
11172
  const displayText = displayContentToString(display);
11157
11173
  const errorMsg = getTextContent(event.content) ?? "Tool error";
11158
11174
  streamFormatter.emitEvent({
11159
- type: "tool_result" /* TOOL_RESULT */,
11175
+ type: JsonStreamEventType.TOOL_RESULT,
11160
11176
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11161
11177
  tool_id: event.requestId,
11162
11178
  status: event.isError ? "error" : "success",
@@ -11171,17 +11187,17 @@ async function runNonInteractive({
11171
11187
  const display = event.display?.result;
11172
11188
  const displayText = displayContentToString(display);
11173
11189
  const errorMsg = getTextContent(event.content) ?? "Tool error";
11174
- if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
11175
- if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
11190
+ if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
11191
+ if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
11176
11192
  responseText = preToolResponseText;
11177
11193
  }
11178
11194
  const stopMessage = `Agent execution stopped: ${errorMsg}`;
11179
- if (config.getOutputFormat() === "text" /* TEXT */) {
11195
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11180
11196
  process.stderr.write(`${stopMessage}
11181
11197
  `);
11182
11198
  }
11183
11199
  }
11184
- if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
11200
+ if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
11185
11201
  throw new FatalToolExecutionError(
11186
11202
  "Error executing tool " + event.name + ": " + (displayText || errorMsg)
11187
11203
  );
@@ -11216,12 +11232,12 @@ async function runNonInteractive({
11216
11232
  }
11217
11233
  if (streamFormatter) {
11218
11234
  streamFormatter.emitEvent({
11219
- type: "error" /* ERROR */,
11235
+ type: JsonStreamEventType.ERROR,
11220
11236
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11221
11237
  severity: "error",
11222
11238
  message: errorMessage
11223
11239
  });
11224
- } else if (config.getOutputFormat() === "text" /* TEXT */) {
11240
+ } else if (config.getOutputFormat() === OutputFormat.TEXT) {
11225
11241
  process.stderr.write(`[ERROR] ${errorMessage}
11226
11242
  `);
11227
11243
  }
@@ -11242,12 +11258,12 @@ async function runNonInteractive({
11242
11258
  const errorCode = event._meta?.["code"];
11243
11259
  if (errorCode === "AGENT_EXECUTION_BLOCKED") {
11244
11260
  const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
11245
- if (config.getOutputFormat() === "text" /* TEXT */) {
11261
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11246
11262
  process.stderr.write(`[WARNING] ${blockMessage}
11247
11263
  `);
11248
11264
  } else if (streamFormatter) {
11249
11265
  streamFormatter.emitEvent({
11250
- type: "error" /* ERROR */,
11266
+ type: JsonStreamEventType.ERROR,
11251
11267
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11252
11268
  severity: "warning",
11253
11269
  message: stripAnsi(blockMessage)
@@ -11257,13 +11273,13 @@ async function runNonInteractive({
11257
11273
  break;
11258
11274
  }
11259
11275
  const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
11260
- if (config.getOutputFormat() === "text" /* TEXT */) {
11276
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11261
11277
  process.stderr.write(`[WARNING] ${event.message}
11262
11278
  `);
11263
11279
  }
11264
11280
  if (streamFormatter) {
11265
11281
  streamFormatter.emitEvent({
11266
- type: "error" /* ERROR */,
11282
+ type: JsonStreamEventType.ERROR,
11267
11283
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11268
11284
  severity,
11269
11285
  message: stripAnsi(event.message)
@@ -11283,7 +11299,7 @@ async function runNonInteractive({
11283
11299
  );
11284
11300
  } else if (streamFormatter) {
11285
11301
  streamFormatter.emitEvent({
11286
- type: "error" /* ERROR */,
11302
+ type: JsonStreamEventType.ERROR,
11287
11303
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11288
11304
  severity: "error",
11289
11305
  message: "Maximum session turns exceeded"
@@ -11291,7 +11307,7 @@ async function runNonInteractive({
11291
11307
  }
11292
11308
  }
11293
11309
  const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
11294
- if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
11310
+ if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
11295
11311
  process.stderr.write(`Agent execution stopped: ${stopMessage}
11296
11312
  `);
11297
11313
  }
@@ -11321,7 +11337,7 @@ async function runNonInteractive({
11321
11337
  abortController.signal.removeEventListener("abort", abortSession);
11322
11338
  scheduler?.dispose();
11323
11339
  consolePatcher.cleanup();
11324
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
11340
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
11325
11341
  }
11326
11342
  if (errorToHandle) {
11327
11343
  handleError(errorToHandle, config);
@@ -11349,7 +11365,7 @@ async function runNonInteractive2(params) {
11349
11365
  }
11350
11366
  });
11351
11367
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
11352
- const { setupInitialActivityLogger } = await import("./devtoolsService-A34WT2MQ.js");
11368
+ const { setupInitialActivityLogger } = await import("./devtoolsService-JBFUXTCT.js");
11353
11369
  setupInitialActivityLogger(config);
11354
11370
  }
11355
11371
  const { stdout: workingStdout } = createWorkingStdio();
@@ -11365,7 +11381,7 @@ async function runNonInteractive2(params) {
11365
11381
  }
11366
11382
  };
11367
11383
  const startTime = Date.now();
11368
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
11384
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
11369
11385
  const abortController = new AbortController();
11370
11386
  let isAborting = false;
11371
11387
  let cancelMessageTimer = null;
@@ -11416,13 +11432,13 @@ async function runNonInteractive2(params) {
11416
11432
  let scheduler;
11417
11433
  try {
11418
11434
  consolePatcher.patch();
11419
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
11435
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
11420
11436
  process.stderr.write(
11421
11437
  "[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"
11422
11438
  );
11423
11439
  }
11424
11440
  setupStdinCancellation();
11425
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
11441
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
11426
11442
  coreEvents.drainBacklogs();
11427
11443
  process.stdout.on("error", (err) => {
11428
11444
  if (err.code === "EPIPE") {
@@ -11446,7 +11462,7 @@ async function runNonInteractive2(params) {
11446
11462
  }
11447
11463
  if (streamFormatter) {
11448
11464
  streamFormatter.emitEvent({
11449
- type: "init" /* INIT */,
11465
+ type: JsonStreamEventType.INIT,
11450
11466
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11451
11467
  session_id: config.getSessionId(),
11452
11468
  model: config.getModel()
@@ -11484,7 +11500,7 @@ async function runNonInteractive2(params) {
11484
11500
  }
11485
11501
  if (streamFormatter) {
11486
11502
  streamFormatter.emitEvent({
11487
- type: "message" /* MESSAGE */,
11503
+ type: JsonStreamEventType.MESSAGE,
11488
11504
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11489
11505
  role: "user",
11490
11506
  content: input
@@ -11512,28 +11528,28 @@ async function runNonInteractive2(params) {
11512
11528
  if (abortController.signal.aborted) {
11513
11529
  handleCancellationError(config);
11514
11530
  }
11515
- if (event.type === "content" /* Content */) {
11531
+ if (event.type === GeminiEventType.Content) {
11516
11532
  const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
11517
11533
  const output = isRaw ? event.value : stripAnsi(event.value);
11518
11534
  if (streamFormatter) {
11519
11535
  streamFormatter.emitEvent({
11520
- type: "message" /* MESSAGE */,
11536
+ type: JsonStreamEventType.MESSAGE,
11521
11537
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11522
11538
  role: "assistant",
11523
11539
  content: output,
11524
11540
  delta: true
11525
11541
  });
11526
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11542
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11527
11543
  responseText += output;
11528
11544
  } else {
11529
11545
  if (event.value) {
11530
11546
  textOutput.write(output);
11531
11547
  }
11532
11548
  }
11533
- } else if (event.type === "tool_call_request" /* ToolCallRequest */) {
11549
+ } else if (event.type === GeminiEventType.ToolCallRequest) {
11534
11550
  if (streamFormatter) {
11535
11551
  streamFormatter.emitEvent({
11536
- type: "tool_use" /* TOOL_USE */,
11552
+ type: JsonStreamEventType.TOOL_USE,
11537
11553
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11538
11554
  tool_name: event.value.name,
11539
11555
  tool_id: event.value.callId,
@@ -11541,33 +11557,33 @@ async function runNonInteractive2(params) {
11541
11557
  });
11542
11558
  }
11543
11559
  toolCallRequests.push(event.value);
11544
- } else if (event.type === "loop_detected" /* LoopDetected */) {
11560
+ } else if (event.type === GeminiEventType.LoopDetected) {
11545
11561
  const message = "Loop detected, stopping execution";
11546
11562
  if (streamFormatter) {
11547
11563
  streamFormatter.emitEvent({
11548
- type: "error" /* ERROR */,
11564
+ type: JsonStreamEventType.ERROR,
11549
11565
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11550
11566
  severity: "warning",
11551
11567
  message
11552
11568
  });
11553
11569
  }
11554
11570
  warnings.push(message);
11555
- } else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
11571
+ } else if (event.type === GeminiEventType.MaxSessionTurns) {
11556
11572
  const message = "Maximum session turns exceeded";
11557
11573
  if (streamFormatter) {
11558
11574
  streamFormatter.emitEvent({
11559
- type: "error" /* ERROR */,
11575
+ type: JsonStreamEventType.ERROR,
11560
11576
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11561
11577
  severity: "error",
11562
11578
  message
11563
11579
  });
11564
11580
  }
11565
11581
  warnings.push(message);
11566
- } else if (event.type === "error" /* Error */) {
11582
+ } else if (event.type === GeminiEventType.Error) {
11567
11583
  throw event.value.error;
11568
- } else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
11584
+ } else if (event.type === GeminiEventType.AgentExecutionStopped) {
11569
11585
  const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
11570
- if (config.getOutputFormat() === "text" /* TEXT */) {
11586
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11571
11587
  process.stderr.write(`${stopMessage}
11572
11588
  `);
11573
11589
  }
@@ -11575,7 +11591,7 @@ async function runNonInteractive2(params) {
11575
11591
  const metrics = uiTelemetryService.getMetrics();
11576
11592
  const durationMs = Date.now() - startTime;
11577
11593
  streamFormatter.emitEvent({
11578
- type: "result" /* RESULT */,
11594
+ type: JsonStreamEventType.RESULT,
11579
11595
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11580
11596
  status: "success",
11581
11597
  stats: streamFormatter.convertToStreamStats(
@@ -11583,7 +11599,7 @@ async function runNonInteractive2(params) {
11583
11599
  durationMs
11584
11600
  )
11585
11601
  });
11586
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11602
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11587
11603
  const formatter = new JsonFormatter();
11588
11604
  const stats = uiTelemetryService.getMetrics();
11589
11605
  textOutput.write(
@@ -11599,21 +11615,21 @@ async function runNonInteractive2(params) {
11599
11615
  textOutput.ensureTrailingNewline();
11600
11616
  }
11601
11617
  return;
11602
- } else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
11618
+ } else if (event.type === GeminiEventType.AgentExecutionBlocked) {
11603
11619
  const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
11604
- if (config.getOutputFormat() === "text" /* TEXT */) {
11620
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11605
11621
  process.stderr.write(`[WARNING] ${blockMessage}
11606
11622
  `);
11607
11623
  } else if (streamFormatter) {
11608
11624
  streamFormatter.emitEvent({
11609
- type: "error" /* ERROR */,
11625
+ type: JsonStreamEventType.ERROR,
11610
11626
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11611
11627
  severity: "warning",
11612
11628
  message: stripAnsi(blockMessage)
11613
11629
  });
11614
11630
  }
11615
11631
  warnings.push(blockMessage);
11616
- } else if (event.type === "invalid_stream" /* InvalidStream */) {
11632
+ } else if (event.type === GeminiEventType.InvalidStream) {
11617
11633
  const eventValue = event.value;
11618
11634
  if (eventValue?.type === "NO_RESPONSE_TEXT") {
11619
11635
  invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
@@ -11636,12 +11652,12 @@ async function runNonInteractive2(params) {
11636
11652
  );
11637
11653
  if (streamFormatter) {
11638
11654
  streamFormatter.emitEvent({
11639
- type: "error" /* ERROR */,
11655
+ type: JsonStreamEventType.ERROR,
11640
11656
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11641
11657
  severity: "error",
11642
11658
  message: invalidStreamError
11643
11659
  });
11644
- } else if (config.getOutputFormat() === "text" /* TEXT */) {
11660
+ } else if (config.getOutputFormat() === OutputFormat.TEXT) {
11645
11661
  process.stderr.write(`[ERROR] ${invalidStreamError}
11646
11662
  `);
11647
11663
  }
@@ -11661,7 +11677,7 @@ async function runNonInteractive2(params) {
11661
11677
  const requestInfo = completedToolCall.request;
11662
11678
  if (streamFormatter) {
11663
11679
  streamFormatter.emitEvent({
11664
- type: "tool_result" /* TOOL_RESULT */,
11680
+ type: JsonStreamEventType.TOOL_RESULT,
11665
11681
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11666
11682
  tool_id: requestInfo.callId,
11667
11683
  status: completedToolCall.status === "error" ? "error" : "success",
@@ -11695,11 +11711,11 @@ async function runNonInteractive2(params) {
11695
11711
  );
11696
11712
  }
11697
11713
  const stopExecutionTool = completedToolCalls.find(
11698
- (tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
11714
+ (tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
11699
11715
  );
11700
11716
  if (stopExecutionTool && stopExecutionTool.response.error) {
11701
11717
  const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
11702
- if (config.getOutputFormat() === "text" /* TEXT */) {
11718
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11703
11719
  process.stderr.write(`${stopMessage}
11704
11720
  `);
11705
11721
  }
@@ -11707,7 +11723,7 @@ async function runNonInteractive2(params) {
11707
11723
  const metrics = uiTelemetryService.getMetrics();
11708
11724
  const durationMs = Date.now() - startTime;
11709
11725
  streamFormatter.emitEvent({
11710
- type: "result" /* RESULT */,
11726
+ type: JsonStreamEventType.RESULT,
11711
11727
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11712
11728
  status: "success",
11713
11729
  stats: streamFormatter.convertToStreamStats(
@@ -11715,7 +11731,7 @@ async function runNonInteractive2(params) {
11715
11731
  durationMs
11716
11732
  )
11717
11733
  });
11718
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11734
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11719
11735
  const formatter = new JsonFormatter();
11720
11736
  const stats = uiTelemetryService.getMetrics();
11721
11737
  textOutput.write(
@@ -11738,12 +11754,12 @@ async function runNonInteractive2(params) {
11738
11754
  const metrics = uiTelemetryService.getMetrics();
11739
11755
  const durationMs = Date.now() - startTime;
11740
11756
  streamFormatter.emitEvent({
11741
- type: "result" /* RESULT */,
11757
+ type: JsonStreamEventType.RESULT,
11742
11758
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11743
11759
  status: invalidStreamError ? "error" : "success",
11744
11760
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
11745
11761
  });
11746
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11762
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11747
11763
  const formatter = new JsonFormatter();
11748
11764
  const stats = uiTelemetryService.getMetrics();
11749
11765
  textOutput.write(
@@ -11767,7 +11783,7 @@ async function runNonInteractive2(params) {
11767
11783
  cleanupStdinCancellation();
11768
11784
  scheduler?.dispose();
11769
11785
  consolePatcher.cleanup();
11770
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
11786
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
11771
11787
  }
11772
11788
  if (errorToHandle) {
11773
11789
  handleError(errorToHandle, config);
@@ -14158,12 +14174,12 @@ function toToolCallContent(toolResult) {
14158
14174
  }
14159
14175
  var basicPermissionOptions = [
14160
14176
  {
14161
- optionId: "proceed_once" /* ProceedOnce */,
14177
+ optionId: ToolConfirmationOutcome.ProceedOnce,
14162
14178
  name: "Allow",
14163
14179
  kind: "allow_once"
14164
14180
  },
14165
14181
  {
14166
- optionId: "cancel" /* Cancel */,
14182
+ optionId: ToolConfirmationOutcome.Cancel,
14167
14183
  name: "Reject",
14168
14184
  kind: "reject_once"
14169
14185
  }
@@ -14175,13 +14191,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14175
14191
  switch (confirmation.type) {
14176
14192
  case "edit":
14177
14193
  options.push({
14178
- optionId: "proceed_always" /* ProceedAlways */,
14194
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14179
14195
  name: "Allow for this session",
14180
14196
  kind: "allow_always"
14181
14197
  });
14182
14198
  if (enablePermanentToolApproval) {
14183
14199
  options.push({
14184
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14200
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14185
14201
  name: "Allow for this file in all future sessions",
14186
14202
  kind: "allow_always"
14187
14203
  });
@@ -14189,13 +14205,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14189
14205
  break;
14190
14206
  case "exec":
14191
14207
  options.push({
14192
- optionId: "proceed_always" /* ProceedAlways */,
14208
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14193
14209
  name: "Allow for this session",
14194
14210
  kind: "allow_always"
14195
14211
  });
14196
14212
  if (enablePermanentToolApproval) {
14197
14213
  options.push({
14198
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14214
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14199
14215
  name: "Allow this command for all future sessions",
14200
14216
  kind: "allow_always"
14201
14217
  });
@@ -14204,19 +14220,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14204
14220
  case "mcp":
14205
14221
  options.push(
14206
14222
  {
14207
- optionId: "proceed_always_server" /* ProceedAlwaysServer */,
14223
+ optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
14208
14224
  name: "Allow all server tools for this session",
14209
14225
  kind: "allow_always"
14210
14226
  },
14211
14227
  {
14212
- optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
14228
+ optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
14213
14229
  name: "Allow tool for this session",
14214
14230
  kind: "allow_always"
14215
14231
  }
14216
14232
  );
14217
14233
  if (enablePermanentToolApproval) {
14218
14234
  options.push({
14219
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14235
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14220
14236
  name: "Allow tool for all future sessions",
14221
14237
  kind: "allow_always"
14222
14238
  });
@@ -14224,13 +14240,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14224
14240
  break;
14225
14241
  case "info":
14226
14242
  options.push({
14227
- optionId: "proceed_always" /* ProceedAlways */,
14243
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14228
14244
  name: "Allow for this session",
14229
14245
  kind: "allow_always"
14230
14246
  });
14231
14247
  if (enablePermanentToolApproval) {
14232
14248
  options.push({
14233
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14249
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14234
14250
  name: "Allow for all future sessions",
14235
14251
  kind: "allow_always"
14236
14252
  });
@@ -14262,21 +14278,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14262
14278
  }
14263
14279
  function toAcpToolKind(kind) {
14264
14280
  switch (kind) {
14265
- case "read" /* Read */:
14266
- case "edit" /* Edit */:
14267
- case "execute" /* Execute */:
14268
- case "search" /* Search */:
14269
- case "delete" /* Delete */:
14270
- case "move" /* Move */:
14271
- case "think" /* Think */:
14272
- case "fetch" /* Fetch */:
14273
- case "switch_mode" /* SwitchMode */:
14274
- case "other" /* Other */:
14281
+ case Kind.Read:
14282
+ case Kind.Edit:
14283
+ case Kind.Execute:
14284
+ case Kind.Search:
14285
+ case Kind.Delete:
14286
+ case Kind.Move:
14287
+ case Kind.Think:
14288
+ case Kind.Fetch:
14289
+ case Kind.SwitchMode:
14290
+ case Kind.Other:
14275
14291
  return kind;
14276
- case "agent" /* Agent */:
14292
+ case Kind.Agent:
14277
14293
  return "think";
14278
- case "plan" /* Plan */:
14279
- case "communicate" /* Communicate */:
14294
+ case Kind.Plan:
14295
+ case Kind.Communicate:
14280
14296
  default:
14281
14297
  return "other";
14282
14298
  }
@@ -14284,24 +14300,24 @@ function toAcpToolKind(kind) {
14284
14300
  function buildAvailableModes(isPlanEnabled) {
14285
14301
  const modes = [
14286
14302
  {
14287
- id: "default" /* DEFAULT */,
14303
+ id: ApprovalMode.DEFAULT,
14288
14304
  name: "Default",
14289
14305
  description: "Prompts for approval"
14290
14306
  },
14291
14307
  {
14292
- id: "autoEdit" /* AUTO_EDIT */,
14308
+ id: ApprovalMode.AUTO_EDIT,
14293
14309
  name: "Auto Edit",
14294
14310
  description: "Auto-approves edit tools"
14295
14311
  },
14296
14312
  {
14297
- id: "yolo" /* YOLO */,
14313
+ id: ApprovalMode.YOLO,
14298
14314
  name: "YOLO",
14299
14315
  description: "Auto-approves all tools"
14300
14316
  }
14301
14317
  ];
14302
14318
  if (isPlanEnabled) {
14303
14319
  modes.push({
14304
- id: "plan" /* PLAN */,
14320
+ id: ApprovalMode.PLAN,
14305
14321
  name: "Plan",
14306
14322
  description: "Read-only mode"
14307
14323
  });
@@ -14314,7 +14330,7 @@ function buildAvailableModels(config, settings) {
14314
14330
  const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
14315
14331
  const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
14316
14332
  const selectedAuthType = settings.merged.security.auth.selectedType;
14317
- const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
14333
+ const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
14318
14334
  if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
14319
14335
  const options = config.getModelConfigService().getAvailableModelOptions({
14320
14336
  useGemini3_1: useGemini31,
@@ -14400,11 +14416,11 @@ var Session = class {
14400
14416
  this.connection = connection;
14401
14417
  this.settings = settings;
14402
14418
  coreEvents.on(
14403
- "approval-mode-changed" /* ApprovalModeChanged */,
14419
+ CoreEvent.ApprovalModeChanged,
14404
14420
  this.handleApprovalModeChanged
14405
14421
  );
14406
14422
  this.context.config.getMessageBus()?.subscribe(
14407
- "tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
14423
+ MessageBusType.TOOL_CONFIRMATION_REQUEST,
14408
14424
  this.handleToolConfirmationRequest,
14409
14425
  { signal: this.disposeController.signal }
14410
14426
  );
@@ -14428,7 +14444,7 @@ var Session = class {
14428
14444
  "Policy engine missing. Denying tool confirmation request."
14429
14445
  );
14430
14446
  await messageBus.publish({
14431
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14447
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14432
14448
  correlationId: request.correlationId,
14433
14449
  confirmed: false,
14434
14450
  requiresUserConfirmation: false
@@ -14441,7 +14457,7 @@ var Session = class {
14441
14457
  "Tool confirmation request missing tool name. Denying."
14442
14458
  );
14443
14459
  await messageBus.publish({
14444
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14460
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14445
14461
  correlationId: request.correlationId,
14446
14462
  confirmed: false,
14447
14463
  requiresUserConfirmation: false
@@ -14454,7 +14470,7 @@ var Session = class {
14454
14470
  `Tool confirmation request for unknown tool: ${toolName}. Denying.`
14455
14471
  );
14456
14472
  await messageBus.publish({
14457
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14473
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14458
14474
  correlationId: request.correlationId,
14459
14475
  confirmed: false,
14460
14476
  requiresUserConfirmation: false
@@ -14470,15 +14486,15 @@ var Session = class {
14470
14486
  request.subagent
14471
14487
  );
14472
14488
  await messageBus.publish({
14473
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14489
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14474
14490
  correlationId: request.correlationId,
14475
- confirmed: result.decision === "allow" /* ALLOW */,
14476
- requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
14491
+ confirmed: result.decision === PolicyDecision.ALLOW,
14492
+ requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
14477
14493
  });
14478
14494
  } catch (error) {
14479
14495
  debugLogger.error("Error handling tool confirmation request:", error);
14480
14496
  await this.context.config.getMessageBus()?.publish({
14481
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14497
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14482
14498
  correlationId: request.correlationId,
14483
14499
  confirmed: false,
14484
14500
  requiresUserConfirmation: false
@@ -14498,7 +14514,7 @@ var Session = class {
14498
14514
  };
14499
14515
  dispose() {
14500
14516
  coreEvents.off(
14501
- "approval-mode-changed" /* ApprovalModeChanged */,
14517
+ CoreEvent.ApprovalModeChanged,
14502
14518
  this.handleApprovalModeChanged
14503
14519
  );
14504
14520
  this.disposeController.abort();
@@ -14587,7 +14603,7 @@ ${thought.description}`;
14587
14603
  await this.sendUpdate({
14588
14604
  sessionUpdate: "tool_call",
14589
14605
  toolCallId: toolCall.id,
14590
- status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
14606
+ status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
14591
14607
  title: toolCall.displayName || toolCall.name,
14592
14608
  content: toolCallContent,
14593
14609
  kind: tool ? toAcpToolKind(tool.kind) : "other"
@@ -14679,7 +14695,7 @@ ${thought.description}`;
14679
14695
  return { stopReason: "cancelled" };
14680
14696
  }
14681
14697
  switch (event.type) {
14682
- case "content" /* Content */: {
14698
+ case GeminiEventType.Content: {
14683
14699
  const content = {
14684
14700
  type: "text",
14685
14701
  text: event.value
@@ -14690,7 +14706,7 @@ ${thought.description}`;
14690
14706
  });
14691
14707
  break;
14692
14708
  }
14693
- case "thought" /* Thought */: {
14709
+ case GeminiEventType.Thought: {
14694
14710
  const thoughtText = `**${event.value.subject}**
14695
14711
  ${event.value.description}`;
14696
14712
  await this.sendUpdate({
@@ -14699,10 +14715,10 @@ ${event.value.description}`;
14699
14715
  });
14700
14716
  break;
14701
14717
  }
14702
- case "tool_call_request" /* ToolCallRequest */:
14718
+ case GeminiEventType.ToolCallRequest:
14703
14719
  toolCallRequests.push(event.value);
14704
14720
  break;
14705
- case "finished" /* Finished */: {
14721
+ case GeminiEventType.Finished: {
14706
14722
  const usage2 = event.value.usageMetadata;
14707
14723
  if (usage2) {
14708
14724
  turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
@@ -14710,19 +14726,19 @@ ${event.value.description}`;
14710
14726
  }
14711
14727
  break;
14712
14728
  }
14713
- case "model_info" /* ModelInfo */:
14729
+ case GeminiEventType.ModelInfo:
14714
14730
  turnModelId = event.value;
14715
14731
  break;
14716
- case "max_session_turns" /* MaxSessionTurns */:
14732
+ case GeminiEventType.MaxSessionTurns:
14717
14733
  stopReason = "max_turn_requests";
14718
14734
  break;
14719
- case "loop_detected" /* LoopDetected */:
14735
+ case GeminiEventType.LoopDetected:
14720
14736
  stopReason = "max_turn_requests";
14721
14737
  break;
14722
- case "context_window_will_overflow" /* ContextWindowWillOverflow */:
14738
+ case GeminiEventType.ContextWindowWillOverflow:
14723
14739
  stopReason = "max_tokens";
14724
14740
  break;
14725
- case "error" /* Error */: {
14741
+ case GeminiEventType.Error: {
14726
14742
  const parseResult = StructuredErrorSchema.safeParse(
14727
14743
  event.value.error
14728
14744
  );
@@ -14950,7 +14966,7 @@ ${event.value.description}`;
14950
14966
  const output = RequestPermissionResponseSchema.parse(
14951
14967
  await this.connection.requestPermission(params)
14952
14968
  );
14953
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
14969
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
14954
14970
  await confirmationDetails.onConfirm(outcome);
14955
14971
  await updatePolicy(
14956
14972
  tool,
@@ -14961,16 +14977,16 @@ ${event.value.description}`;
14961
14977
  invocation
14962
14978
  );
14963
14979
  switch (outcome) {
14964
- case "cancel" /* Cancel */:
14980
+ case ToolConfirmationOutcome.Cancel:
14965
14981
  return errorResponse(
14966
14982
  new Error(`Tool "${fc.name}" was canceled by the user.`)
14967
14983
  );
14968
- case "proceed_once" /* ProceedOnce */:
14969
- case "proceed_always" /* ProceedAlways */:
14970
- case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
14971
- case "proceed_always_server" /* ProceedAlwaysServer */:
14972
- case "proceed_always_tool" /* ProceedAlwaysTool */:
14973
- case "modify_with_editor" /* ModifyWithEditor */:
14984
+ case ToolConfirmationOutcome.ProceedOnce:
14985
+ case ToolConfirmationOutcome.ProceedAlways:
14986
+ case ToolConfirmationOutcome.ProceedAlwaysAndSave:
14987
+ case ToolConfirmationOutcome.ProceedAlwaysServer:
14988
+ case ToolConfirmationOutcome.ProceedAlwaysTool:
14989
+ case ToolConfirmationOutcome.ModifyWithEditor:
14974
14990
  break;
14975
14991
  default: {
14976
14992
  const resultOutcome = outcome;
@@ -15024,7 +15040,7 @@ ${event.value.description}`;
15024
15040
  );
15025
15041
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
15026
15042
  {
15027
- status: "success" /* Success */,
15043
+ status: CoreToolCallStatus.Success,
15028
15044
  request: {
15029
15045
  callId,
15030
15046
  name: fc.name,
@@ -15069,7 +15085,7 @@ ${event.value.description}`;
15069
15085
  });
15070
15086
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
15071
15087
  {
15072
- status: "error" /* Error */,
15088
+ status: CoreToolCallStatus.Error,
15073
15089
  request: {
15074
15090
  callId,
15075
15091
  name: fc.name,
@@ -15197,12 +15213,12 @@ ${event.value.description}`;
15197
15213
  sessionId: this.id,
15198
15214
  options: [
15199
15215
  {
15200
- optionId: "proceed_once" /* ProceedOnce */,
15216
+ optionId: ToolConfirmationOutcome.ProceedOnce,
15201
15217
  name: "Allow once",
15202
15218
  kind: "allow_once"
15203
15219
  },
15204
15220
  {
15205
- optionId: "cancel" /* Cancel */,
15221
+ optionId: ToolConfirmationOutcome.Cancel,
15206
15222
  name: "Deny",
15207
15223
  kind: "reject_once"
15208
15224
  }
@@ -15227,8 +15243,8 @@ ${event.value.description}`;
15227
15243
  const output = RequestPermissionResponseSchema.parse(
15228
15244
  await this.connection.requestPermission(params)
15229
15245
  );
15230
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15231
- if (outcome === "proceed_once" /* ProceedOnce */) {
15246
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15247
+ if (outcome === ToolConfirmationOutcome.ProceedOnce) {
15232
15248
  this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
15233
15249
  validationError = null;
15234
15250
  } else {
@@ -15665,7 +15681,7 @@ var AcpSessionManager = class {
15665
15681
  mcpServers,
15666
15682
  loadedSettings
15667
15683
  );
15668
- const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
15684
+ const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
15669
15685
  let isAuthenticated = false;
15670
15686
  let authErrorMessage = "";
15671
15687
  try {
@@ -15677,7 +15693,7 @@ var AcpSessionManager = class {
15677
15693
  );
15678
15694
  isAuthenticated = true;
15679
15695
  const contentGeneratorConfig = config.getContentGeneratorConfig();
15680
- if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
15696
+ if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
15681
15697
  isAuthenticated = false;
15682
15698
  authErrorMessage = "Gemini API key is missing or not configured.";
15683
15699
  }
@@ -15786,7 +15802,7 @@ var AcpSessionManager = class {
15786
15802
  return response;
15787
15803
  }
15788
15804
  async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
15789
- const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
15805
+ const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
15790
15806
  if (!selectedAuthType) {
15791
15807
  throw RequestError.authRequired();
15792
15808
  }
@@ -15887,12 +15903,12 @@ var GeminiAgent = class {
15887
15903
  }
15888
15904
  const authMethods = [
15889
15905
  {
15890
- id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
15906
+ id: AuthType.LOGIN_WITH_GOOGLE,
15891
15907
  name: "Log in with Google",
15892
15908
  description: "Log in with your Google account"
15893
15909
  },
15894
15910
  {
15895
- id: "gemini-api-key" /* USE_GEMINI */,
15911
+ id: AuthType.USE_GEMINI,
15896
15912
  name: "Gemini API key",
15897
15913
  description: "Use an API key with Gemini Developer API",
15898
15914
  _meta: {
@@ -15902,12 +15918,12 @@ var GeminiAgent = class {
15902
15918
  }
15903
15919
  },
15904
15920
  {
15905
- id: "vertex-ai" /* USE_VERTEX_AI */,
15921
+ id: AuthType.USE_VERTEX_AI,
15906
15922
  name: "Vertex AI",
15907
15923
  description: "Use an API key with Vertex AI GenAI API"
15908
15924
  },
15909
15925
  {
15910
- id: "gateway" /* GATEWAY */,
15926
+ id: AuthType.GATEWAY,
15911
15927
  name: "AI API Gateway",
15912
15928
  description: "Use a custom AI API Gateway",
15913
15929
  _meta: {
@@ -16080,7 +16096,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
16080
16096
  }
16081
16097
  return authType;
16082
16098
  } catch (error) {
16083
- if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
16099
+ if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
16084
16100
  handleError(
16085
16101
  error instanceof Error ? error : new Error(String(error)),
16086
16102
  nonInteractiveConfig,
@@ -16275,10 +16291,10 @@ var SlashCommandConflictHandler = class {
16275
16291
  this.handleConflicts = this.handleConflicts.bind(this);
16276
16292
  }
16277
16293
  start() {
16278
- coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
16294
+ coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
16279
16295
  }
16280
16296
  stop() {
16281
- coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
16297
+ coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
16282
16298
  if (this.flushTimeout) {
16283
16299
  clearTimeout(this.flushTimeout);
16284
16300
  this.flushTimeout = null;
@@ -16559,7 +16575,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
16559
16575
  }
16560
16576
  }
16561
16577
  async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
16562
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-DNV4GCM5.js");
16578
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-D6H37PJQ.js");
16563
16579
  await doStartUI(
16564
16580
  config,
16565
16581
  settings,
@@ -16662,12 +16678,12 @@ async function main() {
16662
16678
  dns.setDefaultResultOrder(
16663
16679
  validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
16664
16680
  );
16665
- if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
16681
+ if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
16666
16682
  if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
16667
16683
  settings.setValue(
16668
16684
  "User" /* User */,
16669
16685
  "security.auth.selectedType",
16670
- "compute-default-credentials" /* COMPUTE_ADC */
16686
+ AuthType.COMPUTE_ADC
16671
16687
  );
16672
16688
  }
16673
16689
  }
@@ -16768,7 +16784,7 @@ ${finalArgs[promptIndex + 1]}`;
16768
16784
  await config.storage.initialize();
16769
16785
  adminControlsListner.setConfig(config);
16770
16786
  if (config.isInteractive() && settings.merged.general.devtools) {
16771
- const { setupInitialActivityLogger } = await import("./devtoolsService-A34WT2MQ.js");
16787
+ const { setupInitialActivityLogger } = await import("./devtoolsService-JBFUXTCT.js");
16772
16788
  setupInitialActivityLogger(config);
16773
16789
  }
16774
16790
  registerTelemetryConfig(config);
@@ -16776,7 +16792,7 @@ ${finalArgs[promptIndex + 1]}`;
16776
16792
  const messageBus = config.getMessageBus();
16777
16793
  createPolicyUpdater2(policyEngine, messageBus, config.storage);
16778
16794
  registerCleanup(async () => {
16779
- await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
16795
+ await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
16780
16796
  });
16781
16797
  if (!config.getAcpMode()) {
16782
16798
  registerCleanup(consolePatcher.cleanup);
@@ -16827,7 +16843,7 @@ ${finalArgs[promptIndex + 1]}`;
16827
16843
  const initAppHandle = startupProfiler.start("initialize_app");
16828
16844
  const initializationResult = await initializeApp(config, settings);
16829
16845
  initAppHandle?.end();
16830
- import("./liteRtServerManager-LQMOE7JK.js").then(({ LiteRtServerManager }) => {
16846
+ import("./liteRtServerManager-IGKUGGP4.js").then(({ LiteRtServerManager }) => {
16831
16847
  const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
16832
16848
  if (!mergedGemma) return;
16833
16849
  const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
@@ -16837,7 +16853,7 @@ ${finalArgs[promptIndex + 1]}`;
16837
16853
  autoStartServer: userGemma?.autoStartServer
16838
16854
  });
16839
16855
  }).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
16840
- if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
16856
+ if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
16841
16857
  await getOauthClient(settings.merged.security.auth.selectedType, config);
16842
16858
  }
16843
16859
  if (config.getAcpMode()) {
@@ -16853,7 +16869,7 @@ ${finalArgs[promptIndex + 1]}`;
16853
16869
  ...rawStartupWarnings.map((message) => ({
16854
16870
  id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
16855
16871
  message,
16856
- priority: "high" /* High */
16872
+ priority: WarningPriority.High
16857
16873
  })),
16858
16874
  ...await getUserStartupWarnings(settings.merged, void 0, {
16859
16875
  isAlternateBuffer: useAlternateBuffer
@@ -16890,7 +16906,7 @@ ${finalArgs[promptIndex + 1]}`;
16890
16906
  ${input}` : stdinData;
16891
16907
  }
16892
16908
  }
16893
- const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
16909
+ const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
16894
16910
  const hookSystem = config?.getHookSystem();
16895
16911
  if (hookSystem) {
16896
16912
  const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
@@ -16947,8 +16963,8 @@ ${input}` : wrappedContext;
16947
16963
  }
16948
16964
  }
16949
16965
  function initializeOutputListenersAndFlush(config) {
16950
- if (coreEvents.listenerCount("output" /* Output */) === 0) {
16951
- coreEvents.on("output" /* Output */, (payload) => {
16966
+ if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
16967
+ coreEvents.on(CoreEvent.Output, (payload) => {
16952
16968
  if (payload.isStderr) {
16953
16969
  writeToStderr(payload.chunk, payload.encoding);
16954
16970
  } else {
@@ -16956,8 +16972,8 @@ function initializeOutputListenersAndFlush(config) {
16956
16972
  }
16957
16973
  });
16958
16974
  }
16959
- if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
16960
- coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
16975
+ if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
16976
+ coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
16961
16977
  if (payload.type === "error" || payload.type === "warn") {
16962
16978
  writeToStderr(payload.content + "\n");
16963
16979
  } else {
@@ -16965,8 +16981,8 @@ function initializeOutputListenersAndFlush(config) {
16965
16981
  }
16966
16982
  });
16967
16983
  }
16968
- if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
16969
- coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
16984
+ if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
16985
+ coreEvents.on(CoreEvent.UserFeedback, (payload) => {
16970
16986
  writeToStderr(payload.message + "\n");
16971
16987
  });
16972
16988
  }
@@ -16974,7 +16990,7 @@ function initializeOutputListenersAndFlush(config) {
16974
16990
  const forceToStderr = outputFormat === "json";
16975
16991
  coreEvents.drainBacklogs(
16976
16992
  (event, args) => {
16977
- if (forceToStderr && event === "output" /* Output */) {
16993
+ if (forceToStderr && event === CoreEvent.Output) {
16978
16994
  const payload = args[0];
16979
16995
  if (!payload.isStderr) {
16980
16996
  return {