@google/gemini-cli 0.65.0-preview.0 → 0.66.0-nightly.20261017.ged96faedf

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 (75) hide show
  1. package/README.md +21 -56
  2. package/bundle/{chunk-NL7ZHGCH.js → chunk-464WBVYM.js} +1 -1
  3. package/bundle/{chunk-QJK54DSE.js → chunk-5VQUE3OF.js} +1 -1
  4. package/bundle/{chunk-VF5WQSOE.js → chunk-7ARQMEMX.js} +1 -1
  5. package/bundle/{chunk-2WVLIJA5.js → chunk-BUG4N6U5.js} +145 -77
  6. package/bundle/{chunk-F6AJM4WN.js → chunk-DPV3ZEOC.js} +3 -3
  7. package/bundle/{chunk-GSQEBEGC.js → chunk-ERBSM2HU.js} +3 -3
  8. package/bundle/{chunk-WTRK3NVX.js → chunk-GEUFOF2X.js} +106 -1500
  9. package/bundle/{chunk-V2R74WAG.js → chunk-H4U2CWBQ.js} +151 -81
  10. package/bundle/chunk-HDP6V6JI.js +1956 -0
  11. package/bundle/{chunk-RPHDSDL6.js → chunk-IDCWFZU3.js} +1 -1
  12. package/bundle/{chunk-SN7QZKXC.js → chunk-IGOTAEJY.js} +170 -1551
  13. package/bundle/chunk-J5QPCO3J.js +101859 -0
  14. package/bundle/{chunk-H2CZXS7F.js → chunk-JY3DYBJT.js} +1 -1
  15. package/bundle/{chunk-HLOOE7YN.js → chunk-LDGJJCVW.js} +9 -8
  16. package/bundle/chunk-MH4KAY5W.js +512 -0
  17. package/bundle/{chunk-LLE5Z636.js → chunk-NAPT3FAL.js} +106 -1500
  18. package/bundle/chunk-NOSWGXRT.js +1956 -0
  19. package/bundle/{chunk-43EXRO7A.js → chunk-NU74STQ5.js} +145 -77
  20. package/bundle/{chunk-K7NOVQ6G.js → chunk-QCWGLPCO.js} +376 -231
  21. package/bundle/{chunk-WGL5FJOS.js → chunk-QF3ALSJN.js} +3 -3
  22. package/bundle/{chunk-K4G5D5ZZ.js → chunk-R4KPURFC.js} +1 -1
  23. package/bundle/chunk-R6XDLHLP.js +1956 -0
  24. package/bundle/chunk-R7UPATQC.js +1956 -0
  25. package/bundle/chunk-RACMC24X.js +118 -0
  26. package/bundle/{chunk-4JGVVJGK.js → chunk-RE4V6I3G.js} +1 -1
  27. package/bundle/{chunk-S7BCRBI4.js → chunk-UTTFPWGQ.js} +1 -1
  28. package/bundle/chunk-VXYA6LA4.js +1571 -0
  29. package/bundle/chunk-XY2QSBID.js +17603 -0
  30. package/bundle/{chunk-K7AA35SP.js → chunk-YOI4DS3V.js} +365 -230
  31. package/bundle/chunk-YP27UYI4.js +154 -0
  32. package/bundle/{chunk-TP236FKO.js → chunk-YPLMNSM4.js} +8243 -15166
  33. package/bundle/chunk-ZFQ347ZN.js +402181 -0
  34. package/bundle/{cleanup-HPADDONA.js → cleanup-6FAZDCL3.js} +2 -2
  35. package/bundle/{cleanup-JOMSXKMP.js → cleanup-GNZLZG55.js} +2 -2
  36. package/bundle/{cleanup-LYRJHMMO.js → cleanup-RX3AC5ET.js} +2 -2
  37. package/bundle/cleanup-WAU2KYGS.js +32 -0
  38. package/bundle/{core-NCJTYARO.js → core-AGGXDQOT.js} +13 -1
  39. package/bundle/{devtoolsService-WP2OPVPB.js → devtoolsService-6XOCGTLC.js} +2 -2
  40. package/bundle/{devtoolsService-JFJBTZ4B.js → devtoolsService-FBTSVQ57.js} +4 -3
  41. package/bundle/{devtoolsService-HIZA3JGR.js → devtoolsService-UO6ZB72B.js} +2 -2
  42. package/bundle/devtoolsService-W5QGZ3SW.js +4359 -0
  43. package/bundle/{dist-GQKLLBDW.js → dist-2ELAEESC.js} +13 -1
  44. package/bundle/{core-IVQAI4S6.js → dist-2R7C2WHA.js} +13 -1
  45. package/bundle/dist-PALH7PJS.js +2280 -0
  46. package/bundle/docs/changelogs/index.md +22 -0
  47. package/bundle/docs/changelogs/latest.md +64 -54
  48. package/bundle/docs/changelogs/preview.md +91 -55
  49. package/bundle/docs/reference/configuration.md +8 -3
  50. package/bundle/docs/reference/keyboard-shortcuts.md +18 -4
  51. package/bundle/{gemini-5TUKZVGS.js → gemini-6MH55Y7F.js} +37 -18
  52. package/bundle/{gemini-7CHJYSHM.js → gemini-DOXUDJDY.js} +37 -18
  53. package/bundle/{gemini-546WMAHG.js → gemini-OHYXI52N.js} +237 -202
  54. package/bundle/gemini-OUEDCH4P.js +17970 -0
  55. package/bundle/gemini.js +14 -15
  56. package/bundle/{interactiveCli-E3PUPYMZ.js → interactiveCli-7LIKGDTJ.js} +1061 -989
  57. package/bundle/{interactiveCli-5XIAIY74.js → interactiveCli-EGQYN3KR.js} +1371 -1280
  58. package/bundle/{interactiveCli-L4PK7YY3.js → interactiveCli-TG7PGV4V.js} +1061 -989
  59. package/bundle/interactiveCli-YEXCUIFZ.js +35601 -0
  60. package/bundle/{liteRtServerManager-JCTYJBV5.js → liteRtServerManager-KAPXZ3EU.js} +4 -4
  61. package/bundle/{liteRtServerManager-JERG6KYC.js → liteRtServerManager-MSJIWMWP.js} +4 -4
  62. package/bundle/{liteRtServerManager-22ISMNN2.js → liteRtServerManager-PD2N3GLD.js} +4 -4
  63. package/bundle/liteRtServerManager-X5SCFYXM.js +65 -0
  64. package/bundle/{oauth2-provider-XRUER2XR.js → oauth2-provider-IUN6Z4IO.js} +1 -1
  65. package/bundle/{oauth2-provider-477UJQX6.js → oauth2-provider-MKJIQNWP.js} +41 -79
  66. package/bundle/{oauth2-provider-MKWWBW4K.js → oauth2-provider-RMF7U2UN.js} +1 -1
  67. package/bundle/oauth2-provider-ZM5GWCNX.js +273 -0
  68. package/bundle/{start-MVIPJNQ5.js → start-5GIUIER3.js} +6 -6
  69. package/bundle/{start-RZWSVT55.js → start-APIVGXZ3.js} +6 -6
  70. package/bundle/{start-AGMBPY3O.js → start-GJ4TH4KZ.js} +6 -6
  71. package/bundle/start-WDS52ZNE.js +18 -0
  72. package/package.json +1 -1
  73. package/bundle/chunk-4DCA4L53.js +0 -425
  74. package/bundle/chunk-BFIV7GTA.js +0 -425
  75. package/bundle/chunk-V72FRESD.js +0 -425
@@ -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-WGL5FJOS.js";
5
+ } from "./chunk-QF3ALSJN.js";
6
6
  import {
7
7
  BuiltinCommandLoader,
8
8
  CommandService,
@@ -35,7 +35,6 @@ import {
35
35
  promptForSetting,
36
36
  renderSkillActionFeedback,
37
37
  requestConsentNonInteractive,
38
- require_semver,
39
38
  skillsConsentString,
40
39
  startAutoMemoryIfEnabled,
41
40
  statusCommand,
@@ -46,11 +45,11 @@ import {
46
45
  updateExtension,
47
46
  validateAuthMethod,
48
47
  validateContextFilePath
49
- } from "./chunk-LLE5Z636.js";
48
+ } from "./chunk-GEUFOF2X.js";
50
49
  import {
51
50
  exitCli,
52
51
  require_source
53
- } from "./chunk-4JGVVJGK.js";
52
+ } from "./chunk-JY3DYBJT.js";
54
53
  import {
55
54
  appEvents
56
55
  } from "./chunk-5PS3AYFU.js";
@@ -89,11 +88,12 @@ import {
89
88
  resolveGemmaConfig,
90
89
  saveModelChange,
91
90
  stripAnsi
92
- } from "./chunk-43EXRO7A.js";
91
+ } from "./chunk-BUG4N6U5.js";
93
92
  import {
94
- RELAUNCH_EXIT_CODE
95
- } from "./chunk-V72FRESD.js";
96
- import "./chunk-HLOOE7YN.js";
93
+ RELAUNCH_EXIT_CODE,
94
+ require_semver
95
+ } from "./chunk-NOSWGXRT.js";
96
+ import "./chunk-LDGJJCVW.js";
97
97
  import {
98
98
  cleanupCheckpoints,
99
99
  registerCleanup,
@@ -102,12 +102,15 @@ import {
102
102
  runExitCleanup,
103
103
  runSyncCleanup,
104
104
  setupSignalHandlers
105
- } from "./chunk-VF5WQSOE.js";
105
+ } from "./chunk-7ARQMEMX.js";
106
106
  import {
107
107
  ASK_USER_TOOL_NAME,
108
+ ApprovalMode,
108
109
  AuthType,
109
110
  Client,
110
111
  Config,
112
+ CoreEvent,
113
+ CoreToolCallStatus,
111
114
  DEFAULT_CONTEXT_FILENAME,
112
115
  DEFAULT_FILE_FILTERING_OPTIONS,
113
116
  DEFAULT_GEMINI_EMBEDDING_MODEL,
@@ -129,19 +132,27 @@ import {
129
132
  FolderTrustDiscoveryService,
130
133
  GEMINI_DIR,
131
134
  GEMINI_MODEL_ALIAS_AUTO,
135
+ GeminiEventType,
132
136
  IdeClient,
137
+ IntegrityStatus,
133
138
  InvalidStreamError,
134
139
  JsonFormatter,
140
+ JsonStreamEventType,
141
+ Kind,
135
142
  LegacyAgentSession,
136
143
  Logger,
137
144
  MAX_TOKENS_EXCEEDED_SUGGESTION,
138
145
  MCPServerConfig,
146
+ MCPServerStatus,
147
+ MessageBusType,
139
148
  OTHER_BLOCKED_MESSAGE,
149
+ OutputFormat,
140
150
  PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
141
151
  PREVIEW_GEMINI_3_1_MODEL,
142
152
  PREVIEW_GEMINI_FLASH_LITE_MODEL,
143
153
  PREVIEW_GEMINI_FLASH_MODEL,
144
154
  PREVIEW_GEMINI_MODEL,
155
+ PolicyDecision,
145
156
  PolicyIntegrityManager,
146
157
  RECITATION_BLOCKED_MESSAGE,
147
158
  REFERENCE_CONTENT_START,
@@ -149,6 +160,8 @@ import {
149
160
  ReadManyFilesTool,
150
161
  SAFETY_BLOCKED_MESSAGE,
151
162
  Scheduler,
163
+ SessionEndReason,
164
+ SessionStartSource,
152
165
  ShellExecutionService,
153
166
  SimpleExtensionLoader,
154
167
  Storage,
@@ -157,10 +170,13 @@ import {
157
170
  TRUE_EMPTY_RESPONSE_MESSAGE,
158
171
  ToolCallEvent,
159
172
  ToolConfirmationOutcome,
173
+ ToolErrorType,
174
+ TrustLevel,
160
175
  UserAccountManager,
161
176
  UserPromptEvent,
162
177
  ValidationCancelledError,
163
178
  ValidationRequiredError,
179
+ WarningPriority,
164
180
  applyAdminAllowlist,
165
181
  applyRequiredServers,
166
182
  clearCachedCredentialFile,
@@ -241,7 +257,7 @@ import {
241
257
  updatePolicy,
242
258
  writeToStderr,
243
259
  writeToStdout
244
- } from "./chunk-TP236FKO.js";
260
+ } from "./chunk-YOI4DS3V.js";
245
261
  import "./chunk-664ZODQF.js";
246
262
  import "./chunk-IUUIT4SU.js";
247
263
  import "./chunk-L6PII3GR.js";
@@ -5390,7 +5406,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
5390
5406
  async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
5391
5407
  const isStdio = !!config.command;
5392
5408
  if (isStdio && !isTrusted) {
5393
- return "disconnected" /* DISCONNECTED */;
5409
+ return MCPServerStatus.DISCONNECTED;
5394
5410
  }
5395
5411
  const client = new Client({
5396
5412
  name: "mcp-test-client",
@@ -5426,7 +5442,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5426
5442
  transport = await createTransport(serverName, config, false, mcpContext);
5427
5443
  } catch {
5428
5444
  await client.close();
5429
- return "disconnected" /* DISCONNECTED */;
5445
+ return MCPServerStatus.DISCONNECTED;
5430
5446
  }
5431
5447
  try {
5432
5448
  const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
@@ -5440,10 +5456,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5440
5456
  );
5441
5457
  }
5442
5458
  await client.close();
5443
- return "connected" /* CONNECTED */;
5459
+ return MCPServerStatus.CONNECTED;
5444
5460
  } catch {
5445
5461
  await transport.close();
5446
- return "disconnected" /* DISCONNECTED */;
5462
+ return MCPServerStatus.DISCONNECTED;
5447
5463
  }
5448
5464
  }
5449
5465
  async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
@@ -5456,12 +5472,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
5456
5472
  });
5457
5473
  if (!loadResult.allowed) {
5458
5474
  if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
5459
- return "blocked" /* BLOCKED */;
5475
+ return MCPServerStatus.BLOCKED;
5460
5476
  }
5461
- return "disabled" /* DISABLED */;
5477
+ return MCPServerStatus.DISABLED;
5462
5478
  }
5463
5479
  if (!isTrusted) {
5464
- return "disabled" /* DISABLED */;
5480
+ return MCPServerStatus.DISABLED;
5465
5481
  }
5466
5482
  return testMCPConnection(serverName, server, isTrusted, activeSettings);
5467
5483
  }
@@ -5507,23 +5523,23 @@ async function listMcpServers(loadedSettingsArg) {
5507
5523
  let statusIndicator = "";
5508
5524
  let statusText = "";
5509
5525
  switch (status) {
5510
- case "connected" /* CONNECTED */:
5526
+ case MCPServerStatus.CONNECTED:
5511
5527
  statusIndicator = import_chalk.default.green("\u2713");
5512
5528
  statusText = "Connected";
5513
5529
  break;
5514
- case "connecting" /* CONNECTING */:
5530
+ case MCPServerStatus.CONNECTING:
5515
5531
  statusIndicator = import_chalk.default.yellow("\u2026");
5516
5532
  statusText = "Connecting";
5517
5533
  break;
5518
- case "blocked" /* BLOCKED */:
5534
+ case MCPServerStatus.BLOCKED:
5519
5535
  statusIndicator = import_chalk.default.red("\u26D4");
5520
5536
  statusText = "Blocked";
5521
5537
  break;
5522
- case "disabled" /* DISABLED */:
5538
+ case MCPServerStatus.DISABLED:
5523
5539
  statusIndicator = import_chalk.default.gray("\u25CB");
5524
5540
  statusText = "Disabled";
5525
5541
  break;
5526
- case "disconnected" /* DISCONNECTED */:
5542
+ case MCPServerStatus.DISCONNECTED:
5527
5543
  default:
5528
5544
  statusIndicator = import_chalk.default.red("\u2717");
5529
5545
  statusText = "Disconnected";
@@ -5809,7 +5825,7 @@ async function handleInstall(args) {
5809
5825
  );
5810
5826
  if (confirmed) {
5811
5827
  const trustedFolders = loadTrustedFolders();
5812
- await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
5828
+ await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
5813
5829
  } else {
5814
5830
  throw new Error(
5815
5831
  `Installation aborted: Folder "${absolutePath}" is not trusted.`
@@ -7860,7 +7876,7 @@ async function loadSandboxConfig(settings, argv) {
7860
7876
  }
7861
7877
  const command2 = getSandboxCommand(sandboxValue);
7862
7878
  const packageJson = await getPackageJson(__dirname3);
7863
- const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.65.0-preview.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7879
+ const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.66.0-nightly.20261017.ged96faedf" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7864
7880
  const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
7865
7881
  return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
7866
7882
  }
@@ -7919,9 +7935,9 @@ async function resolveWorkspacePolicyState(options) {
7919
7935
  cwd,
7920
7936
  potentialWorkspacePoliciesDir
7921
7937
  );
7922
- if (integrityResult.status === "MATCH" /* MATCH */) {
7938
+ if (integrityResult.status === IntegrityStatus.MATCH) {
7923
7939
  workspacePoliciesDir = potentialWorkspacePoliciesDir;
7924
- } else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
7940
+ } else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
7925
7941
  workspacePoliciesDir = void 0;
7926
7942
  } else if (interactive && !autoAcceptWorkspacePolicies) {
7927
7943
  policyUpdateConfirmationRequest = {
@@ -8349,23 +8365,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8349
8365
  if (rawApprovalMode) {
8350
8366
  switch (rawApprovalMode) {
8351
8367
  case "yolo":
8352
- approvalMode = "yolo" /* YOLO */;
8368
+ approvalMode = ApprovalMode.YOLO;
8353
8369
  break;
8354
8370
  case "auto_edit":
8355
- approvalMode = "autoEdit" /* AUTO_EDIT */;
8371
+ approvalMode = ApprovalMode.AUTO_EDIT;
8356
8372
  break;
8357
8373
  case "plan":
8358
8374
  if (!(settings.general?.plan?.enabled ?? true)) {
8359
8375
  debugLogger.warn(
8360
8376
  'Approval mode "plan" is disabled in your settings. Falling back to "default".'
8361
8377
  );
8362
- approvalMode = "default" /* DEFAULT */;
8378
+ approvalMode = ApprovalMode.DEFAULT;
8363
8379
  } else {
8364
- approvalMode = "plan" /* PLAN */;
8380
+ approvalMode = ApprovalMode.PLAN;
8365
8381
  }
8366
8382
  break;
8367
8383
  case "default":
8368
- approvalMode = "default" /* DEFAULT */;
8384
+ approvalMode = ApprovalMode.DEFAULT;
8369
8385
  break;
8370
8386
  default:
8371
8387
  throw new Error(
@@ -8373,10 +8389,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8373
8389
  );
8374
8390
  }
8375
8391
  } else {
8376
- approvalMode = "default" /* DEFAULT */;
8392
+ approvalMode = ApprovalMode.DEFAULT;
8377
8393
  }
8378
8394
  if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
8379
- if (approvalMode === "yolo" /* YOLO */) {
8395
+ if (approvalMode === ApprovalMode.YOLO) {
8380
8396
  if (settings.admin?.secureModeEnabled) {
8381
8397
  debugLogger.error(
8382
8398
  'YOLO mode is disabled by "secureModeEnabled" setting.'
@@ -8394,16 +8410,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8394
8410
  )
8395
8411
  );
8396
8412
  }
8397
- } else if (approvalMode === "yolo" /* YOLO */) {
8413
+ } else if (approvalMode === ApprovalMode.YOLO) {
8398
8414
  debugLogger.warn(
8399
8415
  "YOLO mode is enabled. All tool calls will be automatically approved."
8400
8416
  );
8401
8417
  }
8402
- if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
8418
+ if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
8403
8419
  debugLogger.warn(
8404
8420
  `Approval mode overridden to "default" because the current folder is not trusted.`
8405
8421
  );
8406
- approvalMode = "default" /* DEFAULT */;
8422
+ approvalMode = ApprovalMode.DEFAULT;
8407
8423
  }
8408
8424
  let telemetrySettings;
8409
8425
  try {
@@ -11104,7 +11120,7 @@ import path10 from "node:path";
11104
11120
  import process4 from "node:process";
11105
11121
  var homeDirectoryCheck = {
11106
11122
  id: "home-directory",
11107
- priority: "low" /* Low */,
11123
+ priority: WarningPriority.Low,
11108
11124
  check: async (workspaceRoot, settings) => {
11109
11125
  if (settings.ui?.showHomeDirectoryWarning === false) {
11110
11126
  return null;
@@ -11128,7 +11144,7 @@ var homeDirectoryCheck = {
11128
11144
  };
11129
11145
  var rootDirectoryCheck = {
11130
11146
  id: "root-directory",
11131
- priority: "high" /* High */,
11147
+ priority: WarningPriority.High,
11132
11148
  check: async (workspaceRoot, _settings) => {
11133
11149
  try {
11134
11150
  const workspaceRealPath = await fs9.realpath(workspaceRoot);
@@ -11144,7 +11160,7 @@ var rootDirectoryCheck = {
11144
11160
  };
11145
11161
  var folderTrustCheck = {
11146
11162
  id: "folder-trust",
11147
- priority: "high" /* High */,
11163
+ priority: WarningPriority.High,
11148
11164
  check: async (workspaceRoot, settings) => {
11149
11165
  if (!isFolderTrustEnabled(settings)) {
11150
11166
  return null;
@@ -11334,12 +11350,12 @@ function handleError(error, config, customErrorCode) {
11334
11350
  error,
11335
11351
  config.getContentGeneratorConfig()?.authType
11336
11352
  );
11337
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
11353
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
11338
11354
  const streamFormatter = new StreamJsonFormatter();
11339
11355
  const errorCode = customErrorCode ?? extractErrorCode(error);
11340
11356
  const metrics = uiTelemetryService.getMetrics();
11341
11357
  streamFormatter.emitEvent({
11342
- type: "result" /* RESULT */,
11358
+ type: JsonStreamEventType.RESULT,
11343
11359
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11344
11360
  status: "error",
11345
11361
  error: {
@@ -11350,7 +11366,7 @@ function handleError(error, config, customErrorCode) {
11350
11366
  });
11351
11367
  runSyncCleanup();
11352
11368
  process.exit(getNumericExitCode(errorCode));
11353
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11369
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11354
11370
  const formatter = new JsonFormatter();
11355
11371
  const errorCode = customErrorCode ?? extractErrorCode(error);
11356
11372
  const formattedError = formatter.formatError(
@@ -11370,11 +11386,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
11370
11386
  const isFatal = isFatalToolError(errorType);
11371
11387
  if (isFatal) {
11372
11388
  const toolExecutionError = new FatalToolExecutionError(errorMessage);
11373
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
11389
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
11374
11390
  const streamFormatter = new StreamJsonFormatter();
11375
11391
  const metrics = uiTelemetryService.getMetrics();
11376
11392
  streamFormatter.emitEvent({
11377
- type: "result" /* RESULT */,
11393
+ type: JsonStreamEventType.RESULT,
11378
11394
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11379
11395
  status: "error",
11380
11396
  error: {
@@ -11383,7 +11399,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
11383
11399
  },
11384
11400
  stats: streamFormatter.convertToStreamStats(metrics, 0)
11385
11401
  });
11386
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11402
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11387
11403
  const formatter = new JsonFormatter();
11388
11404
  const formattedError = formatter.formatError(
11389
11405
  toolExecutionError,
@@ -11401,11 +11417,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
11401
11417
  }
11402
11418
  function handleCancellationError(config) {
11403
11419
  const cancellationError = new FatalCancellationError("Operation cancelled.");
11404
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
11420
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
11405
11421
  const streamFormatter = new StreamJsonFormatter();
11406
11422
  const metrics = uiTelemetryService.getMetrics();
11407
11423
  streamFormatter.emitEvent({
11408
- type: "result" /* RESULT */,
11424
+ type: JsonStreamEventType.RESULT,
11409
11425
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11410
11426
  status: "error",
11411
11427
  error: {
@@ -11416,7 +11432,7 @@ function handleCancellationError(config) {
11416
11432
  });
11417
11433
  runSyncCleanup();
11418
11434
  process.exit(cancellationError.exitCode);
11419
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11435
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11420
11436
  const formatter = new JsonFormatter();
11421
11437
  const formattedError = formatter.formatError(
11422
11438
  cancellationError,
@@ -11436,11 +11452,11 @@ function handleMaxTurnsExceededError(config) {
11436
11452
  const maxTurnsError = new FatalTurnLimitedError(
11437
11453
  "Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
11438
11454
  );
11439
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
11455
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
11440
11456
  const streamFormatter = new StreamJsonFormatter();
11441
11457
  const metrics = uiTelemetryService.getMetrics();
11442
11458
  streamFormatter.emitEvent({
11443
- type: "result" /* RESULT */,
11459
+ type: JsonStreamEventType.RESULT,
11444
11460
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11445
11461
  status: "error",
11446
11462
  error: {
@@ -11451,7 +11467,7 @@ function handleMaxTurnsExceededError(config) {
11451
11467
  });
11452
11468
  runSyncCleanup();
11453
11469
  process.exit(maxTurnsError.exitCode);
11454
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11470
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11455
11471
  const formatter = new JsonFormatter();
11456
11472
  const formattedError = formatter.formatError(
11457
11473
  maxTurnsError,
@@ -11531,7 +11547,7 @@ async function runNonInteractive({
11531
11547
  }
11532
11548
  });
11533
11549
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
11534
- const { setupInitialActivityLogger } = await import("./devtoolsService-JFJBTZ4B.js");
11550
+ const { setupInitialActivityLogger } = await import("./devtoolsService-W5QGZ3SW.js");
11535
11551
  setupInitialActivityLogger(config);
11536
11552
  }
11537
11553
  const { stdout: workingStdout } = createWorkingStdio();
@@ -11547,7 +11563,7 @@ async function runNonInteractive({
11547
11563
  }
11548
11564
  };
11549
11565
  const startTime = Date.now();
11550
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
11566
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
11551
11567
  const abortController = new AbortController();
11552
11568
  let isAborting = false;
11553
11569
  let cancelMessageTimer = null;
@@ -11600,13 +11616,13 @@ async function runNonInteractive({
11600
11616
  };
11601
11617
  try {
11602
11618
  consolePatcher.patch();
11603
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
11619
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
11604
11620
  process.stderr.write(
11605
11621
  "[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"
11606
11622
  );
11607
11623
  }
11608
11624
  setupStdinCancellation();
11609
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
11625
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
11610
11626
  coreEvents.drainBacklogs();
11611
11627
  process.stdout.on("error", (err) => {
11612
11628
  if (err.code === "EPIPE") {
@@ -11632,7 +11648,7 @@ async function runNonInteractive({
11632
11648
  }
11633
11649
  if (streamFormatter) {
11634
11650
  streamFormatter.emitEvent({
11635
- type: "init" /* INIT */,
11651
+ type: JsonStreamEventType.INIT,
11636
11652
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11637
11653
  session_id: config.getSessionId(),
11638
11654
  model: config.getModel()
@@ -11670,7 +11686,7 @@ async function runNonInteractive({
11670
11686
  }
11671
11687
  if (streamFormatter) {
11672
11688
  streamFormatter.emitEvent({
11673
- type: "message" /* MESSAGE */,
11689
+ type: JsonStreamEventType.MESSAGE,
11674
11690
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11675
11691
  role: "user",
11676
11692
  content: input
@@ -11709,12 +11725,12 @@ async function runNonInteractive({
11709
11725
  const metrics = uiTelemetryService.getMetrics();
11710
11726
  const durationMs = Date.now() - startTime;
11711
11727
  streamFormatter.emitEvent({
11712
- type: "result" /* RESULT */,
11728
+ type: JsonStreamEventType.RESULT,
11713
11729
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11714
11730
  status: errorPayload ? "error" : "success",
11715
11731
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
11716
11732
  });
11717
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11733
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11718
11734
  const formatter = new JsonFormatter();
11719
11735
  const stats = uiTelemetryService.getMetrics();
11720
11736
  textOutput.write(
@@ -11807,13 +11823,13 @@ async function runNonInteractive({
11807
11823
  const output = isRaw ? part.text : stripAnsi(part.text);
11808
11824
  if (streamFormatter) {
11809
11825
  streamFormatter.emitEvent({
11810
- type: "message" /* MESSAGE */,
11826
+ type: JsonStreamEventType.MESSAGE,
11811
11827
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11812
11828
  role: "assistant",
11813
11829
  content: output,
11814
11830
  delta: true
11815
11831
  });
11816
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11832
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11817
11833
  responseText += output;
11818
11834
  } else {
11819
11835
  if (part.text) {
@@ -11826,13 +11842,13 @@ async function runNonInteractive({
11826
11842
  break;
11827
11843
  }
11828
11844
  case "tool_request": {
11829
- if (config.getOutputFormat() === "json" /* JSON */) {
11845
+ if (config.getOutputFormat() === OutputFormat.JSON) {
11830
11846
  preToolResponseText = responseText || preToolResponseText;
11831
11847
  responseText = "";
11832
11848
  }
11833
11849
  if (streamFormatter) {
11834
11850
  streamFormatter.emitEvent({
11835
- type: "tool_use" /* TOOL_USE */,
11851
+ type: JsonStreamEventType.TOOL_USE,
11836
11852
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11837
11853
  tool_name: event.name,
11838
11854
  tool_id: event.requestId,
@@ -11848,7 +11864,7 @@ async function runNonInteractive({
11848
11864
  const displayText = displayContentToString(display);
11849
11865
  const errorMsg = getTextContent(event.content) ?? "Tool error";
11850
11866
  streamFormatter.emitEvent({
11851
- type: "tool_result" /* TOOL_RESULT */,
11867
+ type: JsonStreamEventType.TOOL_RESULT,
11852
11868
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11853
11869
  tool_id: event.requestId,
11854
11870
  status: event.isError ? "error" : "success",
@@ -11863,17 +11879,17 @@ async function runNonInteractive({
11863
11879
  const display = event.display?.result;
11864
11880
  const displayText = displayContentToString(display);
11865
11881
  const errorMsg = getTextContent(event.content) ?? "Tool error";
11866
- if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
11867
- if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
11882
+ if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
11883
+ if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
11868
11884
  responseText = preToolResponseText;
11869
11885
  }
11870
11886
  const stopMessage = `Agent execution stopped: ${errorMsg}`;
11871
- if (config.getOutputFormat() === "text" /* TEXT */) {
11887
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11872
11888
  process.stderr.write(`${stopMessage}
11873
11889
  `);
11874
11890
  }
11875
11891
  }
11876
- if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
11892
+ if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
11877
11893
  throw new FatalToolExecutionError(
11878
11894
  "Error executing tool " + event.name + ": " + (displayText || errorMsg)
11879
11895
  );
@@ -11908,12 +11924,12 @@ async function runNonInteractive({
11908
11924
  }
11909
11925
  if (streamFormatter) {
11910
11926
  streamFormatter.emitEvent({
11911
- type: "error" /* ERROR */,
11927
+ type: JsonStreamEventType.ERROR,
11912
11928
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11913
11929
  severity: "error",
11914
11930
  message: errorMessage
11915
11931
  });
11916
- } else if (config.getOutputFormat() === "text" /* TEXT */) {
11932
+ } else if (config.getOutputFormat() === OutputFormat.TEXT) {
11917
11933
  process.stderr.write(`[ERROR] ${errorMessage}
11918
11934
  `);
11919
11935
  }
@@ -11934,12 +11950,12 @@ async function runNonInteractive({
11934
11950
  const errorCode = event._meta?.["code"];
11935
11951
  if (errorCode === "AGENT_EXECUTION_BLOCKED") {
11936
11952
  const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
11937
- if (config.getOutputFormat() === "text" /* TEXT */) {
11953
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11938
11954
  process.stderr.write(`[WARNING] ${blockMessage}
11939
11955
  `);
11940
11956
  } else if (streamFormatter) {
11941
11957
  streamFormatter.emitEvent({
11942
- type: "error" /* ERROR */,
11958
+ type: JsonStreamEventType.ERROR,
11943
11959
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11944
11960
  severity: "warning",
11945
11961
  message: stripAnsi(blockMessage)
@@ -11949,13 +11965,13 @@ async function runNonInteractive({
11949
11965
  break;
11950
11966
  }
11951
11967
  const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
11952
- if (config.getOutputFormat() === "text" /* TEXT */) {
11968
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11953
11969
  process.stderr.write(`[WARNING] ${event.message}
11954
11970
  `);
11955
11971
  }
11956
11972
  if (streamFormatter) {
11957
11973
  streamFormatter.emitEvent({
11958
- type: "error" /* ERROR */,
11974
+ type: JsonStreamEventType.ERROR,
11959
11975
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11960
11976
  severity,
11961
11977
  message: stripAnsi(event.message)
@@ -11975,7 +11991,7 @@ async function runNonInteractive({
11975
11991
  );
11976
11992
  } else if (streamFormatter) {
11977
11993
  streamFormatter.emitEvent({
11978
- type: "error" /* ERROR */,
11994
+ type: JsonStreamEventType.ERROR,
11979
11995
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11980
11996
  severity: "error",
11981
11997
  message: "Maximum session turns exceeded"
@@ -11983,7 +11999,7 @@ async function runNonInteractive({
11983
11999
  }
11984
12000
  }
11985
12001
  const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
11986
- if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
12002
+ if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
11987
12003
  process.stderr.write(`Agent execution stopped: ${stopMessage}
11988
12004
  `);
11989
12005
  }
@@ -12013,7 +12029,7 @@ async function runNonInteractive({
12013
12029
  abortController.signal.removeEventListener("abort", abortSession);
12014
12030
  scheduler?.dispose();
12015
12031
  consolePatcher.cleanup();
12016
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
12032
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
12017
12033
  }
12018
12034
  if (errorToHandle) {
12019
12035
  handleError(errorToHandle, config);
@@ -12041,7 +12057,7 @@ async function runNonInteractive2(params) {
12041
12057
  }
12042
12058
  });
12043
12059
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
12044
- const { setupInitialActivityLogger } = await import("./devtoolsService-JFJBTZ4B.js");
12060
+ const { setupInitialActivityLogger } = await import("./devtoolsService-W5QGZ3SW.js");
12045
12061
  setupInitialActivityLogger(config);
12046
12062
  }
12047
12063
  const { stdout: workingStdout } = createWorkingStdio();
@@ -12057,7 +12073,7 @@ async function runNonInteractive2(params) {
12057
12073
  }
12058
12074
  };
12059
12075
  const startTime = Date.now();
12060
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
12076
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
12061
12077
  const abortController = new AbortController();
12062
12078
  let isAborting = false;
12063
12079
  let cancelMessageTimer = null;
@@ -12108,13 +12124,13 @@ async function runNonInteractive2(params) {
12108
12124
  let scheduler;
12109
12125
  try {
12110
12126
  consolePatcher.patch();
12111
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
12127
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
12112
12128
  process.stderr.write(
12113
12129
  "[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"
12114
12130
  );
12115
12131
  }
12116
12132
  setupStdinCancellation();
12117
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
12133
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
12118
12134
  coreEvents.drainBacklogs();
12119
12135
  process.stdout.on("error", (err) => {
12120
12136
  if (err.code === "EPIPE") {
@@ -12138,7 +12154,7 @@ async function runNonInteractive2(params) {
12138
12154
  }
12139
12155
  if (streamFormatter) {
12140
12156
  streamFormatter.emitEvent({
12141
- type: "init" /* INIT */,
12157
+ type: JsonStreamEventType.INIT,
12142
12158
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12143
12159
  session_id: config.getSessionId(),
12144
12160
  model: config.getModel()
@@ -12176,7 +12192,7 @@ async function runNonInteractive2(params) {
12176
12192
  }
12177
12193
  if (streamFormatter) {
12178
12194
  streamFormatter.emitEvent({
12179
- type: "message" /* MESSAGE */,
12195
+ type: JsonStreamEventType.MESSAGE,
12180
12196
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12181
12197
  role: "user",
12182
12198
  content: input
@@ -12204,28 +12220,28 @@ async function runNonInteractive2(params) {
12204
12220
  if (abortController.signal.aborted) {
12205
12221
  handleCancellationError(config);
12206
12222
  }
12207
- if (event.type === "content" /* Content */) {
12223
+ if (event.type === GeminiEventType.Content) {
12208
12224
  const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
12209
12225
  const output = isRaw ? event.value : stripAnsi(event.value);
12210
12226
  if (streamFormatter) {
12211
12227
  streamFormatter.emitEvent({
12212
- type: "message" /* MESSAGE */,
12228
+ type: JsonStreamEventType.MESSAGE,
12213
12229
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12214
12230
  role: "assistant",
12215
12231
  content: output,
12216
12232
  delta: true
12217
12233
  });
12218
- } else if (config.getOutputFormat() === "json" /* JSON */) {
12234
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
12219
12235
  responseText += output;
12220
12236
  } else {
12221
12237
  if (event.value) {
12222
12238
  textOutput.write(output);
12223
12239
  }
12224
12240
  }
12225
- } else if (event.type === "tool_call_request" /* ToolCallRequest */) {
12241
+ } else if (event.type === GeminiEventType.ToolCallRequest) {
12226
12242
  if (streamFormatter) {
12227
12243
  streamFormatter.emitEvent({
12228
- type: "tool_use" /* TOOL_USE */,
12244
+ type: JsonStreamEventType.TOOL_USE,
12229
12245
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12230
12246
  tool_name: event.value.name,
12231
12247
  tool_id: event.value.callId,
@@ -12233,33 +12249,33 @@ async function runNonInteractive2(params) {
12233
12249
  });
12234
12250
  }
12235
12251
  toolCallRequests.push(event.value);
12236
- } else if (event.type === "loop_detected" /* LoopDetected */) {
12252
+ } else if (event.type === GeminiEventType.LoopDetected) {
12237
12253
  const message = "Loop detected, stopping execution";
12238
12254
  if (streamFormatter) {
12239
12255
  streamFormatter.emitEvent({
12240
- type: "error" /* ERROR */,
12256
+ type: JsonStreamEventType.ERROR,
12241
12257
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12242
12258
  severity: "warning",
12243
12259
  message
12244
12260
  });
12245
12261
  }
12246
12262
  warnings.push(message);
12247
- } else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
12263
+ } else if (event.type === GeminiEventType.MaxSessionTurns) {
12248
12264
  const message = "Maximum session turns exceeded";
12249
12265
  if (streamFormatter) {
12250
12266
  streamFormatter.emitEvent({
12251
- type: "error" /* ERROR */,
12267
+ type: JsonStreamEventType.ERROR,
12252
12268
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12253
12269
  severity: "error",
12254
12270
  message
12255
12271
  });
12256
12272
  }
12257
12273
  warnings.push(message);
12258
- } else if (event.type === "error" /* Error */) {
12274
+ } else if (event.type === GeminiEventType.Error) {
12259
12275
  throw event.value.error;
12260
- } else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
12276
+ } else if (event.type === GeminiEventType.AgentExecutionStopped) {
12261
12277
  const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
12262
- if (config.getOutputFormat() === "text" /* TEXT */) {
12278
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
12263
12279
  process.stderr.write(`${stopMessage}
12264
12280
  `);
12265
12281
  }
@@ -12267,7 +12283,7 @@ async function runNonInteractive2(params) {
12267
12283
  const metrics = uiTelemetryService.getMetrics();
12268
12284
  const durationMs = Date.now() - startTime;
12269
12285
  streamFormatter.emitEvent({
12270
- type: "result" /* RESULT */,
12286
+ type: JsonStreamEventType.RESULT,
12271
12287
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12272
12288
  status: "success",
12273
12289
  stats: streamFormatter.convertToStreamStats(
@@ -12275,7 +12291,7 @@ async function runNonInteractive2(params) {
12275
12291
  durationMs
12276
12292
  )
12277
12293
  });
12278
- } else if (config.getOutputFormat() === "json" /* JSON */) {
12294
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
12279
12295
  const formatter = new JsonFormatter();
12280
12296
  const stats = uiTelemetryService.getMetrics();
12281
12297
  textOutput.write(
@@ -12291,21 +12307,21 @@ async function runNonInteractive2(params) {
12291
12307
  textOutput.ensureTrailingNewline();
12292
12308
  }
12293
12309
  return;
12294
- } else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
12310
+ } else if (event.type === GeminiEventType.AgentExecutionBlocked) {
12295
12311
  const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
12296
- if (config.getOutputFormat() === "text" /* TEXT */) {
12312
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
12297
12313
  process.stderr.write(`[WARNING] ${blockMessage}
12298
12314
  `);
12299
12315
  } else if (streamFormatter) {
12300
12316
  streamFormatter.emitEvent({
12301
- type: "error" /* ERROR */,
12317
+ type: JsonStreamEventType.ERROR,
12302
12318
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12303
12319
  severity: "warning",
12304
12320
  message: stripAnsi(blockMessage)
12305
12321
  });
12306
12322
  }
12307
12323
  warnings.push(blockMessage);
12308
- } else if (event.type === "invalid_stream" /* InvalidStream */) {
12324
+ } else if (event.type === GeminiEventType.InvalidStream) {
12309
12325
  const eventValue = event.value;
12310
12326
  if (eventValue?.type === "NO_RESPONSE_TEXT") {
12311
12327
  invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
@@ -12328,12 +12344,12 @@ async function runNonInteractive2(params) {
12328
12344
  );
12329
12345
  if (streamFormatter) {
12330
12346
  streamFormatter.emitEvent({
12331
- type: "error" /* ERROR */,
12347
+ type: JsonStreamEventType.ERROR,
12332
12348
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12333
12349
  severity: "error",
12334
12350
  message: invalidStreamError
12335
12351
  });
12336
- } else if (config.getOutputFormat() === "text" /* TEXT */) {
12352
+ } else if (config.getOutputFormat() === OutputFormat.TEXT) {
12337
12353
  process.stderr.write(`[ERROR] ${invalidStreamError}
12338
12354
  `);
12339
12355
  }
@@ -12353,7 +12369,7 @@ async function runNonInteractive2(params) {
12353
12369
  const requestInfo = completedToolCall.request;
12354
12370
  if (streamFormatter) {
12355
12371
  streamFormatter.emitEvent({
12356
- type: "tool_result" /* TOOL_RESULT */,
12372
+ type: JsonStreamEventType.TOOL_RESULT,
12357
12373
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12358
12374
  tool_id: requestInfo.callId,
12359
12375
  status: completedToolCall.status === "error" ? "error" : "success",
@@ -12387,11 +12403,11 @@ async function runNonInteractive2(params) {
12387
12403
  );
12388
12404
  }
12389
12405
  const stopExecutionTool = completedToolCalls.find(
12390
- (tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
12406
+ (tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
12391
12407
  );
12392
12408
  if (stopExecutionTool && stopExecutionTool.response.error) {
12393
12409
  const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
12394
- if (config.getOutputFormat() === "text" /* TEXT */) {
12410
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
12395
12411
  process.stderr.write(`${stopMessage}
12396
12412
  `);
12397
12413
  }
@@ -12399,7 +12415,7 @@ async function runNonInteractive2(params) {
12399
12415
  const metrics = uiTelemetryService.getMetrics();
12400
12416
  const durationMs = Date.now() - startTime;
12401
12417
  streamFormatter.emitEvent({
12402
- type: "result" /* RESULT */,
12418
+ type: JsonStreamEventType.RESULT,
12403
12419
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12404
12420
  status: "success",
12405
12421
  stats: streamFormatter.convertToStreamStats(
@@ -12407,7 +12423,7 @@ async function runNonInteractive2(params) {
12407
12423
  durationMs
12408
12424
  )
12409
12425
  });
12410
- } else if (config.getOutputFormat() === "json" /* JSON */) {
12426
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
12411
12427
  const formatter = new JsonFormatter();
12412
12428
  const stats = uiTelemetryService.getMetrics();
12413
12429
  textOutput.write(
@@ -12430,12 +12446,12 @@ async function runNonInteractive2(params) {
12430
12446
  const metrics = uiTelemetryService.getMetrics();
12431
12447
  const durationMs = Date.now() - startTime;
12432
12448
  streamFormatter.emitEvent({
12433
- type: "result" /* RESULT */,
12449
+ type: JsonStreamEventType.RESULT,
12434
12450
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12435
12451
  status: invalidStreamError ? "error" : "success",
12436
12452
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
12437
12453
  });
12438
- } else if (config.getOutputFormat() === "json" /* JSON */) {
12454
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
12439
12455
  const formatter = new JsonFormatter();
12440
12456
  const stats = uiTelemetryService.getMetrics();
12441
12457
  textOutput.write(
@@ -12459,7 +12475,7 @@ async function runNonInteractive2(params) {
12459
12475
  cleanupStdinCancellation();
12460
12476
  scheduler?.dispose();
12461
12477
  consolePatcher.cleanup();
12462
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
12478
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
12463
12479
  }
12464
12480
  if (errorToHandle) {
12465
12481
  handleError(errorToHandle, config);
@@ -14850,12 +14866,12 @@ function toToolCallContent(toolResult) {
14850
14866
  }
14851
14867
  var basicPermissionOptions = [
14852
14868
  {
14853
- optionId: "proceed_once" /* ProceedOnce */,
14869
+ optionId: ToolConfirmationOutcome.ProceedOnce,
14854
14870
  name: "Allow",
14855
14871
  kind: "allow_once"
14856
14872
  },
14857
14873
  {
14858
- optionId: "cancel" /* Cancel */,
14874
+ optionId: ToolConfirmationOutcome.Cancel,
14859
14875
  name: "Reject",
14860
14876
  kind: "reject_once"
14861
14877
  }
@@ -14867,13 +14883,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14867
14883
  switch (confirmation.type) {
14868
14884
  case "edit":
14869
14885
  options.push({
14870
- optionId: "proceed_always" /* ProceedAlways */,
14886
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14871
14887
  name: "Allow for this session",
14872
14888
  kind: "allow_always"
14873
14889
  });
14874
14890
  if (enablePermanentToolApproval) {
14875
14891
  options.push({
14876
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14892
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14877
14893
  name: "Allow for this file in all future sessions",
14878
14894
  kind: "allow_always"
14879
14895
  });
@@ -14881,13 +14897,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14881
14897
  break;
14882
14898
  case "exec":
14883
14899
  options.push({
14884
- optionId: "proceed_always" /* ProceedAlways */,
14900
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14885
14901
  name: "Allow for this session",
14886
14902
  kind: "allow_always"
14887
14903
  });
14888
14904
  if (enablePermanentToolApproval) {
14889
14905
  options.push({
14890
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14906
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14891
14907
  name: "Allow this command for all future sessions",
14892
14908
  kind: "allow_always"
14893
14909
  });
@@ -14896,19 +14912,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14896
14912
  case "mcp":
14897
14913
  options.push(
14898
14914
  {
14899
- optionId: "proceed_always_server" /* ProceedAlwaysServer */,
14915
+ optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
14900
14916
  name: "Allow all server tools for this session",
14901
14917
  kind: "allow_always"
14902
14918
  },
14903
14919
  {
14904
- optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
14920
+ optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
14905
14921
  name: "Allow tool for this session",
14906
14922
  kind: "allow_always"
14907
14923
  }
14908
14924
  );
14909
14925
  if (enablePermanentToolApproval) {
14910
14926
  options.push({
14911
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14927
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14912
14928
  name: "Allow tool for all future sessions",
14913
14929
  kind: "allow_always"
14914
14930
  });
@@ -14916,13 +14932,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14916
14932
  break;
14917
14933
  case "info":
14918
14934
  options.push({
14919
- optionId: "proceed_always" /* ProceedAlways */,
14935
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14920
14936
  name: "Allow for this session",
14921
14937
  kind: "allow_always"
14922
14938
  });
14923
14939
  if (enablePermanentToolApproval) {
14924
14940
  options.push({
14925
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14941
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14926
14942
  name: "Allow for all future sessions",
14927
14943
  kind: "allow_always"
14928
14944
  });
@@ -14954,21 +14970,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14954
14970
  }
14955
14971
  function toAcpToolKind(kind) {
14956
14972
  switch (kind) {
14957
- case "read" /* Read */:
14958
- case "edit" /* Edit */:
14959
- case "execute" /* Execute */:
14960
- case "search" /* Search */:
14961
- case "delete" /* Delete */:
14962
- case "move" /* Move */:
14963
- case "think" /* Think */:
14964
- case "fetch" /* Fetch */:
14965
- case "switch_mode" /* SwitchMode */:
14966
- case "other" /* Other */:
14973
+ case Kind.Read:
14974
+ case Kind.Edit:
14975
+ case Kind.Execute:
14976
+ case Kind.Search:
14977
+ case Kind.Delete:
14978
+ case Kind.Move:
14979
+ case Kind.Think:
14980
+ case Kind.Fetch:
14981
+ case Kind.SwitchMode:
14982
+ case Kind.Other:
14967
14983
  return kind;
14968
- case "agent" /* Agent */:
14984
+ case Kind.Agent:
14969
14985
  return "think";
14970
- case "plan" /* Plan */:
14971
- case "communicate" /* Communicate */:
14986
+ case Kind.Plan:
14987
+ case Kind.Communicate:
14972
14988
  default:
14973
14989
  return "other";
14974
14990
  }
@@ -14976,24 +14992,24 @@ function toAcpToolKind(kind) {
14976
14992
  function buildAvailableModes(isPlanEnabled) {
14977
14993
  const modes = [
14978
14994
  {
14979
- id: "default" /* DEFAULT */,
14995
+ id: ApprovalMode.DEFAULT,
14980
14996
  name: "Default",
14981
14997
  description: "Prompts for approval"
14982
14998
  },
14983
14999
  {
14984
- id: "autoEdit" /* AUTO_EDIT */,
15000
+ id: ApprovalMode.AUTO_EDIT,
14985
15001
  name: "Auto Edit",
14986
15002
  description: "Auto-approves edit tools"
14987
15003
  },
14988
15004
  {
14989
- id: "yolo" /* YOLO */,
15005
+ id: ApprovalMode.YOLO,
14990
15006
  name: "YOLO",
14991
15007
  description: "Auto-approves all tools"
14992
15008
  }
14993
15009
  ];
14994
15010
  if (isPlanEnabled) {
14995
15011
  modes.push({
14996
- id: "plan" /* PLAN */,
15012
+ id: ApprovalMode.PLAN,
14997
15013
  name: "Plan",
14998
15014
  description: "Read-only mode"
14999
15015
  });
@@ -15007,7 +15023,7 @@ function buildAvailableModels(config, settings) {
15007
15023
  const useLatestFlash = config.hasLatestFlashGAAccess?.() ?? false;
15008
15024
  const useLatestFlashLite = config.hasLatestFlashLiteGAAccess?.() ?? false;
15009
15025
  const selectedAuthType = settings.merged.security.auth.selectedType;
15010
- const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
15026
+ const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
15011
15027
  if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
15012
15028
  const options = config.getModelConfigService().getAvailableModelOptions({
15013
15029
  useGemini3_1: useGemini31,
@@ -15094,11 +15110,11 @@ var Session = class {
15094
15110
  this.connection = connection;
15095
15111
  this.settings = settings;
15096
15112
  coreEvents.on(
15097
- "approval-mode-changed" /* ApprovalModeChanged */,
15113
+ CoreEvent.ApprovalModeChanged,
15098
15114
  this.handleApprovalModeChanged
15099
15115
  );
15100
15116
  this.context.config.getMessageBus()?.subscribe(
15101
- "tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
15117
+ MessageBusType.TOOL_CONFIRMATION_REQUEST,
15102
15118
  this.handleToolConfirmationRequest,
15103
15119
  { signal: this.disposeController.signal }
15104
15120
  );
@@ -15122,7 +15138,7 @@ var Session = class {
15122
15138
  "Policy engine missing. Denying tool confirmation request."
15123
15139
  );
15124
15140
  await messageBus.publish({
15125
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
15141
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
15126
15142
  correlationId: request.correlationId,
15127
15143
  confirmed: false,
15128
15144
  requiresUserConfirmation: false
@@ -15135,7 +15151,7 @@ var Session = class {
15135
15151
  "Tool confirmation request missing tool name. Denying."
15136
15152
  );
15137
15153
  await messageBus.publish({
15138
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
15154
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
15139
15155
  correlationId: request.correlationId,
15140
15156
  confirmed: false,
15141
15157
  requiresUserConfirmation: false
@@ -15148,7 +15164,7 @@ var Session = class {
15148
15164
  `Tool confirmation request for unknown tool: ${toolName}. Denying.`
15149
15165
  );
15150
15166
  await messageBus.publish({
15151
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
15167
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
15152
15168
  correlationId: request.correlationId,
15153
15169
  confirmed: false,
15154
15170
  requiresUserConfirmation: false
@@ -15164,15 +15180,15 @@ var Session = class {
15164
15180
  request.subagent
15165
15181
  );
15166
15182
  await messageBus.publish({
15167
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
15183
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
15168
15184
  correlationId: request.correlationId,
15169
- confirmed: result.decision === "allow" /* ALLOW */,
15170
- requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
15185
+ confirmed: result.decision === PolicyDecision.ALLOW,
15186
+ requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
15171
15187
  });
15172
15188
  } catch (error) {
15173
15189
  debugLogger.error("Error handling tool confirmation request:", error);
15174
15190
  await this.context.config.getMessageBus()?.publish({
15175
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
15191
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
15176
15192
  correlationId: request.correlationId,
15177
15193
  confirmed: false,
15178
15194
  requiresUserConfirmation: false
@@ -15192,7 +15208,7 @@ var Session = class {
15192
15208
  };
15193
15209
  async dispose() {
15194
15210
  coreEvents.off(
15195
- "approval-mode-changed" /* ApprovalModeChanged */,
15211
+ CoreEvent.ApprovalModeChanged,
15196
15212
  this.handleApprovalModeChanged
15197
15213
  );
15198
15214
  this.disposeController.abort();
@@ -15288,7 +15304,7 @@ ${thought.description}`;
15288
15304
  await this.sendUpdate({
15289
15305
  sessionUpdate: "tool_call",
15290
15306
  toolCallId: toolCall.id,
15291
- status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
15307
+ status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
15292
15308
  title: toolCall.displayName || toolCall.name,
15293
15309
  content: toolCallContent,
15294
15310
  kind: tool ? toAcpToolKind(tool.kind) : "other"
@@ -15397,7 +15413,7 @@ ${thought.description}`;
15397
15413
  return { stopReason: "cancelled" };
15398
15414
  }
15399
15415
  switch (event.type) {
15400
- case "content" /* Content */: {
15416
+ case GeminiEventType.Content: {
15401
15417
  const content = {
15402
15418
  type: "text",
15403
15419
  text: event.value
@@ -15408,7 +15424,7 @@ ${thought.description}`;
15408
15424
  });
15409
15425
  break;
15410
15426
  }
15411
- case "thought" /* Thought */: {
15427
+ case GeminiEventType.Thought: {
15412
15428
  const thoughtText = `**${event.value.subject}**
15413
15429
  ${event.value.description}`;
15414
15430
  await this.sendUpdate({
@@ -15417,10 +15433,10 @@ ${event.value.description}`;
15417
15433
  });
15418
15434
  break;
15419
15435
  }
15420
- case "tool_call_request" /* ToolCallRequest */:
15436
+ case GeminiEventType.ToolCallRequest:
15421
15437
  toolCallRequests.push(event.value);
15422
15438
  break;
15423
- case "finished" /* Finished */: {
15439
+ case GeminiEventType.Finished: {
15424
15440
  const usage2 = event.value.usageMetadata;
15425
15441
  if (usage2) {
15426
15442
  turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
@@ -15437,19 +15453,19 @@ ${event.value.description}`;
15437
15453
  }
15438
15454
  break;
15439
15455
  }
15440
- case "model_info" /* ModelInfo */:
15456
+ case GeminiEventType.ModelInfo:
15441
15457
  turnModelId = event.value;
15442
15458
  break;
15443
- case "max_session_turns" /* MaxSessionTurns */:
15459
+ case GeminiEventType.MaxSessionTurns:
15444
15460
  stopReason = "max_turn_requests";
15445
15461
  break;
15446
- case "loop_detected" /* LoopDetected */:
15462
+ case GeminiEventType.LoopDetected:
15447
15463
  stopReason = "max_turn_requests";
15448
15464
  break;
15449
- case "context_window_will_overflow" /* ContextWindowWillOverflow */:
15465
+ case GeminiEventType.ContextWindowWillOverflow:
15450
15466
  stopReason = "max_tokens";
15451
15467
  break;
15452
- case "error" /* Error */: {
15468
+ case GeminiEventType.Error: {
15453
15469
  const parseResult = StructuredErrorSchema.safeParse(
15454
15470
  event.value.error
15455
15471
  );
@@ -15630,7 +15646,7 @@ ${event.value.description}`;
15630
15646
  const output = RequestPermissionResponseSchema.parse(
15631
15647
  await this.connection.requestPermission(params)
15632
15648
  );
15633
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15649
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15634
15650
  await confirmationDetails.onConfirm(outcome);
15635
15651
  await updatePolicy(
15636
15652
  tool,
@@ -15641,7 +15657,7 @@ ${event.value.description}`;
15641
15657
  invocation
15642
15658
  );
15643
15659
  switch (outcome) {
15644
- case "cancel" /* Cancel */: {
15660
+ case ToolConfirmationOutcome.Cancel: {
15645
15661
  const cancelError = new Error(
15646
15662
  `Tool "${fc.name}" was canceled by the user.`
15647
15663
  );
@@ -15659,12 +15675,12 @@ ${event.value.description}`;
15659
15675
  });
15660
15676
  return errorResponse(cancelError);
15661
15677
  }
15662
- case "proceed_once" /* ProceedOnce */:
15663
- case "proceed_always" /* ProceedAlways */:
15664
- case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
15665
- case "proceed_always_server" /* ProceedAlwaysServer */:
15666
- case "proceed_always_tool" /* ProceedAlwaysTool */:
15667
- case "modify_with_editor" /* ModifyWithEditor */:
15678
+ case ToolConfirmationOutcome.ProceedOnce:
15679
+ case ToolConfirmationOutcome.ProceedAlways:
15680
+ case ToolConfirmationOutcome.ProceedAlwaysAndSave:
15681
+ case ToolConfirmationOutcome.ProceedAlwaysServer:
15682
+ case ToolConfirmationOutcome.ProceedAlwaysTool:
15683
+ case ToolConfirmationOutcome.ModifyWithEditor:
15668
15684
  break;
15669
15685
  default: {
15670
15686
  const resultOutcome = outcome;
@@ -15718,7 +15734,7 @@ ${event.value.description}`;
15718
15734
  );
15719
15735
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
15720
15736
  {
15721
- status: "success" /* Success */,
15737
+ status: CoreToolCallStatus.Success,
15722
15738
  request: {
15723
15739
  callId,
15724
15740
  name: fc.name,
@@ -15763,7 +15779,7 @@ ${event.value.description}`;
15763
15779
  });
15764
15780
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
15765
15781
  {
15766
- status: "error" /* Error */,
15782
+ status: CoreToolCallStatus.Error,
15767
15783
  request: {
15768
15784
  callId,
15769
15785
  name: fc.name,
@@ -15892,12 +15908,12 @@ ${event.value.description}`;
15892
15908
  sessionId: this.id,
15893
15909
  options: [
15894
15910
  {
15895
- optionId: "proceed_once" /* ProceedOnce */,
15911
+ optionId: ToolConfirmationOutcome.ProceedOnce,
15896
15912
  name: "Allow once",
15897
15913
  kind: "allow_once"
15898
15914
  },
15899
15915
  {
15900
- optionId: "cancel" /* Cancel */,
15916
+ optionId: ToolConfirmationOutcome.Cancel,
15901
15917
  name: "Deny",
15902
15918
  kind: "reject_once"
15903
15919
  }
@@ -15922,8 +15938,8 @@ ${event.value.description}`;
15922
15938
  const output = RequestPermissionResponseSchema.parse(
15923
15939
  await this.connection.requestPermission(params)
15924
15940
  );
15925
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15926
- if (outcome === "proceed_once" /* ProceedOnce */) {
15941
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15942
+ if (outcome === ToolConfirmationOutcome.ProceedOnce) {
15927
15943
  this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
15928
15944
  validationError = null;
15929
15945
  } else {
@@ -16364,7 +16380,7 @@ var AcpSessionManager = class {
16364
16380
  mcpServers,
16365
16381
  loadedSettings
16366
16382
  );
16367
- const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
16383
+ const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
16368
16384
  let isAuthenticated = false;
16369
16385
  let authErrorMessage = "";
16370
16386
  try {
@@ -16376,7 +16392,7 @@ var AcpSessionManager = class {
16376
16392
  );
16377
16393
  isAuthenticated = true;
16378
16394
  const contentGeneratorConfig = config.getContentGeneratorConfig();
16379
- if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
16395
+ if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
16380
16396
  isAuthenticated = false;
16381
16397
  authErrorMessage = "Gemini API key is missing or not configured.";
16382
16398
  }
@@ -16560,7 +16576,7 @@ var AcpSessionManager = class {
16560
16576
  }
16561
16577
  }
16562
16578
  async prepareSessionConfig(sessionId, cwd, mcpServers, authDetails) {
16563
- const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
16579
+ const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
16564
16580
  if (!selectedAuthType) {
16565
16581
  throw RequestError.authRequired();
16566
16582
  }
@@ -16672,12 +16688,12 @@ var GeminiAgent = class {
16672
16688
  }
16673
16689
  const authMethods = [
16674
16690
  {
16675
- id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
16691
+ id: AuthType.LOGIN_WITH_GOOGLE,
16676
16692
  name: "Log in with Google",
16677
16693
  description: "Log in with your Google account"
16678
16694
  },
16679
16695
  {
16680
- id: "gemini-api-key" /* USE_GEMINI */,
16696
+ id: AuthType.USE_GEMINI,
16681
16697
  name: "Gemini API key",
16682
16698
  description: "Use an API key with Gemini Developer API",
16683
16699
  _meta: {
@@ -16687,12 +16703,12 @@ var GeminiAgent = class {
16687
16703
  }
16688
16704
  },
16689
16705
  {
16690
- id: "vertex-ai" /* USE_VERTEX_AI */,
16706
+ id: AuthType.USE_VERTEX_AI,
16691
16707
  name: "Vertex AI",
16692
16708
  description: "Use an API key with Vertex AI GenAI API"
16693
16709
  },
16694
16710
  {
16695
- id: "gateway" /* GATEWAY */,
16711
+ id: AuthType.GATEWAY,
16696
16712
  name: "AI API Gateway",
16697
16713
  description: "Use a custom AI API Gateway",
16698
16714
  _meta: {
@@ -16865,7 +16881,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
16865
16881
  }
16866
16882
  return authType;
16867
16883
  } catch (error) {
16868
- if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
16884
+ if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
16869
16885
  handleError(
16870
16886
  error instanceof Error ? error : new Error(String(error)),
16871
16887
  nonInteractiveConfig,
@@ -17060,19 +17076,35 @@ var SlashCommandConflictHandler = class {
17060
17076
  this.handleConflicts = this.handleConflicts.bind(this);
17061
17077
  }
17062
17078
  start() {
17063
- coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
17079
+ coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
17064
17080
  }
17065
17081
  stop() {
17066
- coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
17082
+ coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
17067
17083
  if (this.flushTimeout) {
17068
17084
  clearTimeout(this.flushTimeout);
17069
17085
  this.flushTimeout = null;
17070
17086
  }
17087
+ this.pendingConflicts = [];
17088
+ this.notifiedConflicts.clear();
17089
+ }
17090
+ getConflictKey(c) {
17091
+ const sourceId = c.loserExtensionName || c.loserMcpServerName || c.loserKind;
17092
+ return `${c.name}:${sourceId}:${c.renamedTo}`;
17071
17093
  }
17072
17094
  handleConflicts(payload) {
17095
+ const currentConflictKeys = new Set(
17096
+ payload.conflicts.map((c) => this.getConflictKey(c))
17097
+ );
17098
+ for (const key of this.notifiedConflicts) {
17099
+ if (!currentConflictKeys.has(key)) {
17100
+ this.notifiedConflicts.delete(key);
17101
+ }
17102
+ }
17103
+ this.pendingConflicts = this.pendingConflicts.filter(
17104
+ (c) => currentConflictKeys.has(this.getConflictKey(c))
17105
+ );
17073
17106
  const newConflicts = payload.conflicts.filter((c) => {
17074
- const sourceId = c.loserExtensionName || c.loserMcpServerName || c.loserKind;
17075
- const key = `${c.name}:${sourceId}:${c.renamedTo}`;
17107
+ const key = this.getConflictKey(c);
17076
17108
  if (this.notifiedConflicts.has(key)) {
17077
17109
  return false;
17078
17110
  }
@@ -17082,6 +17114,9 @@ var SlashCommandConflictHandler = class {
17082
17114
  if (newConflicts.length > 0) {
17083
17115
  this.pendingConflicts.push(...newConflicts);
17084
17116
  this.scheduleFlush();
17117
+ } else if (this.pendingConflicts.length === 0 && this.flushTimeout) {
17118
+ clearTimeout(this.flushTimeout);
17119
+ this.flushTimeout = null;
17085
17120
  }
17086
17121
  }
17087
17122
  scheduleFlush() {
@@ -17419,7 +17454,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
17419
17454
  }
17420
17455
  }
17421
17456
  async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
17422
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-5XIAIY74.js");
17457
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-EGQYN3KR.js");
17423
17458
  await doStartUI(
17424
17459
  config,
17425
17460
  settings,
@@ -17522,12 +17557,12 @@ async function main() {
17522
17557
  dns.setDefaultResultOrder(
17523
17558
  validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
17524
17559
  );
17525
- if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
17560
+ if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
17526
17561
  if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
17527
17562
  settings.setValue(
17528
17563
  "User" /* User */,
17529
17564
  "security.auth.selectedType",
17530
- "compute-default-credentials" /* COMPUTE_ADC */
17565
+ AuthType.COMPUTE_ADC
17531
17566
  );
17532
17567
  }
17533
17568
  }
@@ -17628,7 +17663,7 @@ ${finalArgs[promptIndex + 1]}`;
17628
17663
  await config.storage.initialize();
17629
17664
  adminControlsListner.setConfig(config);
17630
17665
  if (config.isInteractive() && settings.merged.general.devtools) {
17631
- const { setupInitialActivityLogger } = await import("./devtoolsService-JFJBTZ4B.js");
17666
+ const { setupInitialActivityLogger } = await import("./devtoolsService-W5QGZ3SW.js");
17632
17667
  setupInitialActivityLogger(config);
17633
17668
  }
17634
17669
  registerTelemetryConfig(config);
@@ -17636,7 +17671,7 @@ ${finalArgs[promptIndex + 1]}`;
17636
17671
  const messageBus = config.getMessageBus();
17637
17672
  createPolicyUpdater2(policyEngine, messageBus, config.storage);
17638
17673
  registerCleanup(async () => {
17639
- await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
17674
+ await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
17640
17675
  });
17641
17676
  if (!config.getAcpMode()) {
17642
17677
  registerCleanup(consolePatcher.cleanup);
@@ -17687,7 +17722,7 @@ ${finalArgs[promptIndex + 1]}`;
17687
17722
  const initAppHandle = startupProfiler.start("initialize_app");
17688
17723
  const initializationResult = await initializeApp(config, settings);
17689
17724
  initAppHandle?.end();
17690
- import("./liteRtServerManager-22ISMNN2.js").then(({ LiteRtServerManager }) => {
17725
+ import("./liteRtServerManager-X5SCFYXM.js").then(({ LiteRtServerManager }) => {
17691
17726
  const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
17692
17727
  if (!mergedGemma) return;
17693
17728
  const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
@@ -17697,7 +17732,7 @@ ${finalArgs[promptIndex + 1]}`;
17697
17732
  autoStartServer: userGemma?.autoStartServer
17698
17733
  });
17699
17734
  }).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
17700
- if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
17735
+ if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
17701
17736
  await getOauthClient(settings.merged.security.auth.selectedType, config);
17702
17737
  }
17703
17738
  if (config.getAcpMode()) {
@@ -17713,7 +17748,7 @@ ${finalArgs[promptIndex + 1]}`;
17713
17748
  ...rawStartupWarnings.map((message) => ({
17714
17749
  id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
17715
17750
  message,
17716
- priority: "high" /* High */
17751
+ priority: WarningPriority.High
17717
17752
  })),
17718
17753
  ...await getUserStartupWarnings(settings.merged, void 0, {
17719
17754
  isAlternateBuffer: useAlternateBuffer
@@ -17750,7 +17785,7 @@ ${finalArgs[promptIndex + 1]}`;
17750
17785
  ${input}` : stdinData;
17751
17786
  }
17752
17787
  }
17753
- const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
17788
+ const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
17754
17789
  const hookSystem = config?.getHookSystem();
17755
17790
  if (hookSystem) {
17756
17791
  const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
@@ -17807,8 +17842,8 @@ ${input}` : wrappedContext;
17807
17842
  }
17808
17843
  }
17809
17844
  function initializeOutputListenersAndFlush(config) {
17810
- if (coreEvents.listenerCount("output" /* Output */) === 0) {
17811
- coreEvents.on("output" /* Output */, (payload) => {
17845
+ if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
17846
+ coreEvents.on(CoreEvent.Output, (payload) => {
17812
17847
  if (payload.isStderr) {
17813
17848
  writeToStderr(payload.chunk, payload.encoding);
17814
17849
  } else {
@@ -17816,8 +17851,8 @@ function initializeOutputListenersAndFlush(config) {
17816
17851
  }
17817
17852
  });
17818
17853
  }
17819
- if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
17820
- coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
17854
+ if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
17855
+ coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
17821
17856
  if (payload.type === "error" || payload.type === "warn") {
17822
17857
  writeToStderr(payload.content + "\n");
17823
17858
  } else {
@@ -17825,8 +17860,8 @@ function initializeOutputListenersAndFlush(config) {
17825
17860
  }
17826
17861
  });
17827
17862
  }
17828
- if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
17829
- coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
17863
+ if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
17864
+ coreEvents.on(CoreEvent.UserFeedback, (payload) => {
17830
17865
  writeToStderr(payload.message + "\n");
17831
17866
  });
17832
17867
  }
@@ -17834,7 +17869,7 @@ function initializeOutputListenersAndFlush(config) {
17834
17869
  const forceToStderr = outputFormat === "json";
17835
17870
  coreEvents.drainBacklogs(
17836
17871
  (event, args) => {
17837
- if (forceToStderr && event === "output" /* Output */) {
17872
+ if (forceToStderr && event === CoreEvent.Output) {
17838
17873
  const payload = args[0];
17839
17874
  if (!payload.isStderr) {
17840
17875
  return {