@google/gemini-cli 0.60.0-preview.0 → 0.61.0-nightly.20260909.ged2ac40df

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 (69) hide show
  1. package/bundle/{chunk-ZX526LXA.js → chunk-3OTKJGN2.js} +7 -7
  2. package/bundle/{chunk-ZOCA7DR7.js → chunk-3P3BK2TC.js} +2 -2
  3. package/bundle/{chunk-CJ3F2CF4.js → chunk-4GFDY7WB.js} +2 -2
  4. package/bundle/{chunk-RY7G2LHR.js → chunk-6CG3PRXG.js} +1 -1
  5. package/bundle/{chunk-FZ5V6AOR.js → chunk-6SVZC6SZ.js} +1 -1
  6. package/bundle/{chunk-JO3EXXPQ.js → chunk-6TKDB4RW.js} +1 -1
  7. package/bundle/{chunk-WSRDZIEX.js → chunk-72RRXB4E.js} +8 -5
  8. package/bundle/{chunk-MHUSLH6Z.js → chunk-A6ULTOE7.js} +67 -54
  9. package/bundle/{chunk-HSV5XF4Y.js → chunk-AIOZQDNS.js} +1 -1
  10. package/bundle/{chunk-6JC2DFFV.js → chunk-CMP3WNPY.js} +7 -7
  11. package/bundle/{chunk-MOFAO64Q.js → chunk-DHG4ARAF.js} +1 -1
  12. package/bundle/chunk-ESBXUM66.js +399011 -0
  13. package/bundle/{chunk-3BBEM33B.js → chunk-G2HNVZYL.js} +1 -1
  14. package/bundle/{chunk-AS5HUHJQ.js → chunk-GSMKZNYD.js} +1 -1
  15. package/bundle/chunk-GXBVYRZC.js +1571 -0
  16. package/bundle/{chunk-B35ENJ4E.js → chunk-ICEYWU2S.js} +2 -2
  17. package/bundle/{chunk-GXZJHUYG.js → chunk-KG5DGMJV.js} +3 -3
  18. package/bundle/{chunk-QKQP4OAM.js → chunk-L4CU45UU.js} +7748 -14586
  19. package/bundle/{chunk-SZWITNYT.js → chunk-LNLXANUU.js} +1 -1
  20. package/bundle/{chunk-VWG6RSQF.js → chunk-NRI447XR.js} +3 -3
  21. package/bundle/{chunk-OXCETUAV.js → chunk-OFCWTOPE.js} +9 -8
  22. package/bundle/chunk-OGNWA4NU.js +17353 -0
  23. package/bundle/chunk-OHLLQDZK.js +102670 -0
  24. package/bundle/{chunk-MNWBDZEW.js → chunk-OZHDMU2F.js} +1 -1
  25. package/bundle/chunk-PGLYJVDY.js +398 -0
  26. package/bundle/chunk-QNFTNAZ3.js +512 -0
  27. package/bundle/{chunk-KJ3DSGP6.js → chunk-RRFXRV32.js} +7 -7
  28. package/bundle/{chunk-CBLSL3EM.js → chunk-V2DJ3GMS.js} +1 -1
  29. package/bundle/{chunk-Z3ZCNEN5.js → chunk-VT6H7JMR.js} +3 -3
  30. package/bundle/{chunk-IIXMDKNQ.js → chunk-W5JPEXLZ.js} +7 -7
  31. package/bundle/chunk-WGNTEF5G.js +154 -0
  32. package/bundle/chunk-YLYKYWW3.js +118 -0
  33. package/bundle/{cleanup-3NLZUFCB.js → cleanup-CQDZD6OH.js} +2 -2
  34. package/bundle/{cleanup-WA2HUZYP.js → cleanup-MJXZWPAB.js} +2 -2
  35. package/bundle/{cleanup-WSQUEKV4.js → cleanup-NE3WAKA7.js} +2 -2
  36. package/bundle/cleanup-W7HO5CNI.js +32 -0
  37. package/bundle/{core-X7B62CE3.js → core-TD3QT7YV.js} +1 -1
  38. package/bundle/{devtoolsService-IFCLCSNA.js → devtoolsService-5F6M45NJ.js} +2 -2
  39. package/bundle/{devtoolsService-4UGAYGLM.js → devtoolsService-HZ4GVNIF.js} +2 -2
  40. package/bundle/{devtoolsService-77KBSPWB.js → devtoolsService-IEHCU262.js} +4 -3
  41. package/bundle/devtoolsService-ZAAGYX2P.js +4359 -0
  42. package/bundle/{dist-VKHG4X3B.js → dist-5GW7SAKM.js} +1 -1
  43. package/bundle/{core-25XEBKOQ.js → dist-634QHCLR.js} +1 -1
  44. package/bundle/dist-S2NRVNNH.js +2216 -0
  45. package/bundle/docs/changelogs/index.md +12 -0
  46. package/bundle/docs/changelogs/latest.md +22 -32
  47. package/bundle/docs/changelogs/preview.md +54 -17
  48. package/bundle/{gemini-4L7IGTB3.js → gemini-EXHNC3P2.js} +14 -14
  49. package/bundle/{gemini-MPHWQGRY.js → gemini-UH4D7QQO.js} +214 -198
  50. package/bundle/{gemini-CXRDUIMP.js → gemini-ZMC7Y4M5.js} +14 -14
  51. package/bundle/gemini-ZYZPV75S.js +17432 -0
  52. package/bundle/gemini.js +7 -7
  53. package/bundle/{interactiveCli-RJOWMONA.js → interactiveCli-DPNMRBAJ.js} +8 -8
  54. package/bundle/{interactiveCli-JODN5SQN.js → interactiveCli-K2X4WXE2.js} +8 -8
  55. package/bundle/{interactiveCli-DVEN62HN.js → interactiveCli-S4QZUDTB.js} +315 -296
  56. package/bundle/interactiveCli-SHWIRB7J.js +34983 -0
  57. package/bundle/{liteRtServerManager-4SSYZUK3.js → liteRtServerManager-2HEYKFZ4.js} +4 -4
  58. package/bundle/{liteRtServerManager-M3O7V7NG.js → liteRtServerManager-QHUT3M3M.js} +4 -4
  59. package/bundle/{liteRtServerManager-2BNWXU4Z.js → liteRtServerManager-TJZWOKLH.js} +4 -4
  60. package/bundle/liteRtServerManager-YKNVLCAP.js +65 -0
  61. package/bundle/{oauth2-provider-AB6H7OQC.js → oauth2-provider-4A2OGPBN.js} +1 -1
  62. package/bundle/{oauth2-provider-4YN5U44E.js → oauth2-provider-MKQTXOA2.js} +38 -72
  63. package/bundle/oauth2-provider-RGVHFZHN.js +235 -0
  64. package/bundle/{oauth2-provider-RN6EIMPY.js → oauth2-provider-UMQ4PPFM.js} +1 -1
  65. package/bundle/{start-GCL5I7SK.js → start-5UZF6OUJ.js} +6 -6
  66. package/bundle/{start-S3YRO6NU.js → start-JPSB6LGS.js} +6 -6
  67. package/bundle/{start-26ICYOUJ.js → start-OFOFQ2WO.js} +6 -6
  68. package/bundle/start-PQKM3CTE.js +18 -0
  69. 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-GXZJHUYG.js";
5
+ } from "./chunk-VT6H7JMR.js";
6
6
  import {
7
7
  BuiltinCommandLoader,
8
8
  CommandService,
@@ -46,11 +46,11 @@ import {
46
46
  updateExtension,
47
47
  validateAuthMethod,
48
48
  validateContextFilePath
49
- } from "./chunk-MHUSLH6Z.js";
49
+ } from "./chunk-A6ULTOE7.js";
50
50
  import {
51
51
  exitCli,
52
52
  require_source
53
- } from "./chunk-HSV5XF4Y.js";
53
+ } from "./chunk-GXBVYRZC.js";
54
54
  import {
55
55
  appEvents
56
56
  } from "./chunk-5PS3AYFU.js";
@@ -88,11 +88,11 @@ import {
88
88
  resolveGemmaConfig,
89
89
  saveModelChange,
90
90
  stripAnsi
91
- } from "./chunk-CBLSL3EM.js";
91
+ } from "./chunk-6CG3PRXG.js";
92
92
  import {
93
93
  RELAUNCH_EXIT_CODE
94
- } from "./chunk-B35ENJ4E.js";
95
- import "./chunk-OXCETUAV.js";
94
+ } from "./chunk-ICEYWU2S.js";
95
+ import "./chunk-QNFTNAZ3.js";
96
96
  import {
97
97
  cleanupCheckpoints,
98
98
  registerCleanup,
@@ -101,12 +101,15 @@ import {
101
101
  runExitCleanup,
102
102
  runSyncCleanup,
103
103
  setupSignalHandlers
104
- } from "./chunk-MNWBDZEW.js";
104
+ } from "./chunk-GSMKZNYD.js";
105
105
  import {
106
106
  ASK_USER_TOOL_NAME,
107
+ ApprovalMode,
107
108
  AuthType,
108
109
  Client,
109
110
  Config,
111
+ CoreEvent,
112
+ CoreToolCallStatus,
110
113
  DEFAULT_CONTEXT_FILENAME,
111
114
  DEFAULT_FILE_FILTERING_OPTIONS,
112
115
  DEFAULT_GEMINI_EMBEDDING_MODEL,
@@ -128,19 +131,27 @@ import {
128
131
  FolderTrustDiscoveryService,
129
132
  GEMINI_DIR,
130
133
  GEMINI_MODEL_ALIAS_AUTO,
134
+ GeminiEventType,
131
135
  IdeClient,
136
+ IntegrityStatus,
132
137
  InvalidStreamError,
133
138
  JsonFormatter,
139
+ JsonStreamEventType,
140
+ Kind,
134
141
  LegacyAgentSession,
135
142
  Logger,
136
143
  MAX_TOKENS_EXCEEDED_SUGGESTION,
137
144
  MCPServerConfig,
145
+ MCPServerStatus,
146
+ MessageBusType,
138
147
  OTHER_BLOCKED_MESSAGE,
148
+ OutputFormat,
139
149
  PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
140
150
  PREVIEW_GEMINI_3_1_MODEL,
141
151
  PREVIEW_GEMINI_FLASH_LITE_MODEL,
142
152
  PREVIEW_GEMINI_FLASH_MODEL,
143
153
  PREVIEW_GEMINI_MODEL,
154
+ PolicyDecision,
144
155
  PolicyIntegrityManager,
145
156
  RECITATION_BLOCKED_MESSAGE,
146
157
  REFERENCE_CONTENT_START,
@@ -148,6 +159,8 @@ import {
148
159
  ReadManyFilesTool,
149
160
  SAFETY_BLOCKED_MESSAGE,
150
161
  Scheduler,
162
+ SessionEndReason,
163
+ SessionStartSource,
151
164
  ShellExecutionService,
152
165
  SimpleExtensionLoader,
153
166
  Storage,
@@ -156,10 +169,13 @@ import {
156
169
  TRUE_EMPTY_RESPONSE_MESSAGE,
157
170
  ToolCallEvent,
158
171
  ToolConfirmationOutcome,
172
+ ToolErrorType,
173
+ TrustLevel,
159
174
  UserAccountManager,
160
175
  UserPromptEvent,
161
176
  ValidationCancelledError,
162
177
  ValidationRequiredError,
178
+ WarningPriority,
163
179
  applyAdminAllowlist,
164
180
  applyRequiredServers,
165
181
  clearCachedCredentialFile,
@@ -239,7 +255,7 @@ import {
239
255
  updatePolicy,
240
256
  writeToStderr,
241
257
  writeToStdout
242
- } from "./chunk-QKQP4OAM.js";
258
+ } from "./chunk-ESBXUM66.js";
243
259
  import "./chunk-664ZODQF.js";
244
260
  import "./chunk-IUUIT4SU.js";
245
261
  import "./chunk-TUDYL3X4.js";
@@ -5369,7 +5385,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
5369
5385
  async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
5370
5386
  const isStdio = !!config.command;
5371
5387
  if (isStdio && !isTrusted) {
5372
- return "disconnected" /* DISCONNECTED */;
5388
+ return MCPServerStatus.DISCONNECTED;
5373
5389
  }
5374
5390
  const client = new Client({
5375
5391
  name: "mcp-test-client",
@@ -5405,7 +5421,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5405
5421
  transport = await createTransport(serverName, config, false, mcpContext);
5406
5422
  } catch {
5407
5423
  await client.close();
5408
- return "disconnected" /* DISCONNECTED */;
5424
+ return MCPServerStatus.DISCONNECTED;
5409
5425
  }
5410
5426
  try {
5411
5427
  const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
@@ -5419,10 +5435,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5419
5435
  );
5420
5436
  }
5421
5437
  await client.close();
5422
- return "connected" /* CONNECTED */;
5438
+ return MCPServerStatus.CONNECTED;
5423
5439
  } catch {
5424
5440
  await transport.close();
5425
- return "disconnected" /* DISCONNECTED */;
5441
+ return MCPServerStatus.DISCONNECTED;
5426
5442
  }
5427
5443
  }
5428
5444
  async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
@@ -5435,12 +5451,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
5435
5451
  });
5436
5452
  if (!loadResult.allowed) {
5437
5453
  if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
5438
- return "blocked" /* BLOCKED */;
5454
+ return MCPServerStatus.BLOCKED;
5439
5455
  }
5440
- return "disabled" /* DISABLED */;
5456
+ return MCPServerStatus.DISABLED;
5441
5457
  }
5442
5458
  if (!isTrusted) {
5443
- return "disabled" /* DISABLED */;
5459
+ return MCPServerStatus.DISABLED;
5444
5460
  }
5445
5461
  return testMCPConnection(serverName, server, isTrusted, activeSettings);
5446
5462
  }
@@ -5486,23 +5502,23 @@ async function listMcpServers(loadedSettingsArg) {
5486
5502
  let statusIndicator = "";
5487
5503
  let statusText = "";
5488
5504
  switch (status) {
5489
- case "connected" /* CONNECTED */:
5505
+ case MCPServerStatus.CONNECTED:
5490
5506
  statusIndicator = import_chalk.default.green("\u2713");
5491
5507
  statusText = "Connected";
5492
5508
  break;
5493
- case "connecting" /* CONNECTING */:
5509
+ case MCPServerStatus.CONNECTING:
5494
5510
  statusIndicator = import_chalk.default.yellow("\u2026");
5495
5511
  statusText = "Connecting";
5496
5512
  break;
5497
- case "blocked" /* BLOCKED */:
5513
+ case MCPServerStatus.BLOCKED:
5498
5514
  statusIndicator = import_chalk.default.red("\u26D4");
5499
5515
  statusText = "Blocked";
5500
5516
  break;
5501
- case "disabled" /* DISABLED */:
5517
+ case MCPServerStatus.DISABLED:
5502
5518
  statusIndicator = import_chalk.default.gray("\u25CB");
5503
5519
  statusText = "Disabled";
5504
5520
  break;
5505
- case "disconnected" /* DISCONNECTED */:
5521
+ case MCPServerStatus.DISCONNECTED:
5506
5522
  default:
5507
5523
  statusIndicator = import_chalk.default.red("\u2717");
5508
5524
  statusText = "Disconnected";
@@ -5788,7 +5804,7 @@ async function handleInstall(args) {
5788
5804
  );
5789
5805
  if (confirmed) {
5790
5806
  const trustedFolders = loadTrustedFolders();
5791
- await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
5807
+ await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
5792
5808
  } else {
5793
5809
  throw new Error(
5794
5810
  `Installation aborted: Folder "${absolutePath}" is not trusted.`
@@ -7839,7 +7855,7 @@ async function loadSandboxConfig(settings, argv) {
7839
7855
  }
7840
7856
  const command2 = getSandboxCommand(sandboxValue);
7841
7857
  const packageJson = await getPackageJson(__dirname3);
7842
- const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.60.0-preview.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7858
+ const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.61.0-nightly.20260909.ged2ac40df" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7843
7859
  const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
7844
7860
  return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
7845
7861
  }
@@ -7898,9 +7914,9 @@ async function resolveWorkspacePolicyState(options) {
7898
7914
  cwd,
7899
7915
  potentialWorkspacePoliciesDir
7900
7916
  );
7901
- if (integrityResult.status === "MATCH" /* MATCH */) {
7917
+ if (integrityResult.status === IntegrityStatus.MATCH) {
7902
7918
  workspacePoliciesDir = potentialWorkspacePoliciesDir;
7903
- } else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
7919
+ } else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
7904
7920
  workspacePoliciesDir = void 0;
7905
7921
  } else if (interactive && !autoAcceptWorkspacePolicies) {
7906
7922
  policyUpdateConfirmationRequest = {
@@ -8328,23 +8344,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8328
8344
  if (rawApprovalMode) {
8329
8345
  switch (rawApprovalMode) {
8330
8346
  case "yolo":
8331
- approvalMode = "yolo" /* YOLO */;
8347
+ approvalMode = ApprovalMode.YOLO;
8332
8348
  break;
8333
8349
  case "auto_edit":
8334
- approvalMode = "autoEdit" /* AUTO_EDIT */;
8350
+ approvalMode = ApprovalMode.AUTO_EDIT;
8335
8351
  break;
8336
8352
  case "plan":
8337
8353
  if (!(settings.general?.plan?.enabled ?? true)) {
8338
8354
  debugLogger.warn(
8339
8355
  'Approval mode "plan" is disabled in your settings. Falling back to "default".'
8340
8356
  );
8341
- approvalMode = "default" /* DEFAULT */;
8357
+ approvalMode = ApprovalMode.DEFAULT;
8342
8358
  } else {
8343
- approvalMode = "plan" /* PLAN */;
8359
+ approvalMode = ApprovalMode.PLAN;
8344
8360
  }
8345
8361
  break;
8346
8362
  case "default":
8347
- approvalMode = "default" /* DEFAULT */;
8363
+ approvalMode = ApprovalMode.DEFAULT;
8348
8364
  break;
8349
8365
  default:
8350
8366
  throw new Error(
@@ -8352,10 +8368,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8352
8368
  );
8353
8369
  }
8354
8370
  } else {
8355
- approvalMode = "default" /* DEFAULT */;
8371
+ approvalMode = ApprovalMode.DEFAULT;
8356
8372
  }
8357
8373
  if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
8358
- if (approvalMode === "yolo" /* YOLO */) {
8374
+ if (approvalMode === ApprovalMode.YOLO) {
8359
8375
  if (settings.admin?.secureModeEnabled) {
8360
8376
  debugLogger.error(
8361
8377
  'YOLO mode is disabled by "secureModeEnabled" setting.'
@@ -8373,16 +8389,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8373
8389
  )
8374
8390
  );
8375
8391
  }
8376
- } else if (approvalMode === "yolo" /* YOLO */) {
8392
+ } else if (approvalMode === ApprovalMode.YOLO) {
8377
8393
  debugLogger.warn(
8378
8394
  "YOLO mode is enabled. All tool calls will be automatically approved."
8379
8395
  );
8380
8396
  }
8381
- if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
8397
+ if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
8382
8398
  debugLogger.warn(
8383
8399
  `Approval mode overridden to "default" because the current folder is not trusted.`
8384
8400
  );
8385
- approvalMode = "default" /* DEFAULT */;
8401
+ approvalMode = ApprovalMode.DEFAULT;
8386
8402
  }
8387
8403
  let telemetrySettings;
8388
8404
  try {
@@ -10753,7 +10769,7 @@ import path10 from "node:path";
10753
10769
  import process4 from "node:process";
10754
10770
  var homeDirectoryCheck = {
10755
10771
  id: "home-directory",
10756
- priority: "low" /* Low */,
10772
+ priority: WarningPriority.Low,
10757
10773
  check: async (workspaceRoot, settings) => {
10758
10774
  if (settings.ui?.showHomeDirectoryWarning === false) {
10759
10775
  return null;
@@ -10777,7 +10793,7 @@ var homeDirectoryCheck = {
10777
10793
  };
10778
10794
  var rootDirectoryCheck = {
10779
10795
  id: "root-directory",
10780
- priority: "high" /* High */,
10796
+ priority: WarningPriority.High,
10781
10797
  check: async (workspaceRoot, _settings) => {
10782
10798
  try {
10783
10799
  const workspaceRealPath = await fs9.realpath(workspaceRoot);
@@ -10793,7 +10809,7 @@ var rootDirectoryCheck = {
10793
10809
  };
10794
10810
  var folderTrustCheck = {
10795
10811
  id: "folder-trust",
10796
- priority: "high" /* High */,
10812
+ priority: WarningPriority.High,
10797
10813
  check: async (workspaceRoot, settings) => {
10798
10814
  if (!isFolderTrustEnabled(settings)) {
10799
10815
  return null;
@@ -10983,12 +10999,12 @@ function handleError(error, config, customErrorCode) {
10983
10999
  error,
10984
11000
  config.getContentGeneratorConfig()?.authType
10985
11001
  );
10986
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
11002
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10987
11003
  const streamFormatter = new StreamJsonFormatter();
10988
11004
  const errorCode = customErrorCode ?? extractErrorCode(error);
10989
11005
  const metrics = uiTelemetryService.getMetrics();
10990
11006
  streamFormatter.emitEvent({
10991
- type: "result" /* RESULT */,
11007
+ type: JsonStreamEventType.RESULT,
10992
11008
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10993
11009
  status: "error",
10994
11010
  error: {
@@ -10999,7 +11015,7 @@ function handleError(error, config, customErrorCode) {
10999
11015
  });
11000
11016
  runSyncCleanup();
11001
11017
  process.exit(getNumericExitCode(errorCode));
11002
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11018
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11003
11019
  const formatter = new JsonFormatter();
11004
11020
  const errorCode = customErrorCode ?? extractErrorCode(error);
11005
11021
  const formattedError = formatter.formatError(
@@ -11019,11 +11035,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
11019
11035
  const isFatal = isFatalToolError(errorType);
11020
11036
  if (isFatal) {
11021
11037
  const toolExecutionError = new FatalToolExecutionError(errorMessage);
11022
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
11038
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
11023
11039
  const streamFormatter = new StreamJsonFormatter();
11024
11040
  const metrics = uiTelemetryService.getMetrics();
11025
11041
  streamFormatter.emitEvent({
11026
- type: "result" /* RESULT */,
11042
+ type: JsonStreamEventType.RESULT,
11027
11043
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11028
11044
  status: "error",
11029
11045
  error: {
@@ -11032,7 +11048,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
11032
11048
  },
11033
11049
  stats: streamFormatter.convertToStreamStats(metrics, 0)
11034
11050
  });
11035
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11051
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11036
11052
  const formatter = new JsonFormatter();
11037
11053
  const formattedError = formatter.formatError(
11038
11054
  toolExecutionError,
@@ -11050,11 +11066,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
11050
11066
  }
11051
11067
  function handleCancellationError(config) {
11052
11068
  const cancellationError = new FatalCancellationError("Operation cancelled.");
11053
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
11069
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
11054
11070
  const streamFormatter = new StreamJsonFormatter();
11055
11071
  const metrics = uiTelemetryService.getMetrics();
11056
11072
  streamFormatter.emitEvent({
11057
- type: "result" /* RESULT */,
11073
+ type: JsonStreamEventType.RESULT,
11058
11074
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11059
11075
  status: "error",
11060
11076
  error: {
@@ -11065,7 +11081,7 @@ function handleCancellationError(config) {
11065
11081
  });
11066
11082
  runSyncCleanup();
11067
11083
  process.exit(cancellationError.exitCode);
11068
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11084
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11069
11085
  const formatter = new JsonFormatter();
11070
11086
  const formattedError = formatter.formatError(
11071
11087
  cancellationError,
@@ -11085,11 +11101,11 @@ function handleMaxTurnsExceededError(config) {
11085
11101
  const maxTurnsError = new FatalTurnLimitedError(
11086
11102
  "Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
11087
11103
  );
11088
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
11104
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
11089
11105
  const streamFormatter = new StreamJsonFormatter();
11090
11106
  const metrics = uiTelemetryService.getMetrics();
11091
11107
  streamFormatter.emitEvent({
11092
- type: "result" /* RESULT */,
11108
+ type: JsonStreamEventType.RESULT,
11093
11109
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11094
11110
  status: "error",
11095
11111
  error: {
@@ -11100,7 +11116,7 @@ function handleMaxTurnsExceededError(config) {
11100
11116
  });
11101
11117
  runSyncCleanup();
11102
11118
  process.exit(maxTurnsError.exitCode);
11103
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11119
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11104
11120
  const formatter = new JsonFormatter();
11105
11121
  const formattedError = formatter.formatError(
11106
11122
  maxTurnsError,
@@ -11180,7 +11196,7 @@ async function runNonInteractive({
11180
11196
  }
11181
11197
  });
11182
11198
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
11183
- const { setupInitialActivityLogger } = await import("./devtoolsService-77KBSPWB.js");
11199
+ const { setupInitialActivityLogger } = await import("./devtoolsService-5F6M45NJ.js");
11184
11200
  setupInitialActivityLogger(config);
11185
11201
  }
11186
11202
  const { stdout: workingStdout } = createWorkingStdio();
@@ -11196,7 +11212,7 @@ async function runNonInteractive({
11196
11212
  }
11197
11213
  };
11198
11214
  const startTime = Date.now();
11199
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
11215
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
11200
11216
  const abortController = new AbortController();
11201
11217
  let isAborting = false;
11202
11218
  let cancelMessageTimer = null;
@@ -11249,13 +11265,13 @@ async function runNonInteractive({
11249
11265
  };
11250
11266
  try {
11251
11267
  consolePatcher.patch();
11252
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
11268
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
11253
11269
  process.stderr.write(
11254
11270
  "[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"
11255
11271
  );
11256
11272
  }
11257
11273
  setupStdinCancellation();
11258
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
11274
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
11259
11275
  coreEvents.drainBacklogs();
11260
11276
  process.stdout.on("error", (err) => {
11261
11277
  if (err.code === "EPIPE") {
@@ -11281,7 +11297,7 @@ async function runNonInteractive({
11281
11297
  }
11282
11298
  if (streamFormatter) {
11283
11299
  streamFormatter.emitEvent({
11284
- type: "init" /* INIT */,
11300
+ type: JsonStreamEventType.INIT,
11285
11301
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11286
11302
  session_id: config.getSessionId(),
11287
11303
  model: config.getModel()
@@ -11319,7 +11335,7 @@ async function runNonInteractive({
11319
11335
  }
11320
11336
  if (streamFormatter) {
11321
11337
  streamFormatter.emitEvent({
11322
- type: "message" /* MESSAGE */,
11338
+ type: JsonStreamEventType.MESSAGE,
11323
11339
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11324
11340
  role: "user",
11325
11341
  content: input
@@ -11358,12 +11374,12 @@ async function runNonInteractive({
11358
11374
  const metrics = uiTelemetryService.getMetrics();
11359
11375
  const durationMs = Date.now() - startTime;
11360
11376
  streamFormatter.emitEvent({
11361
- type: "result" /* RESULT */,
11377
+ type: JsonStreamEventType.RESULT,
11362
11378
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11363
11379
  status: errorPayload ? "error" : "success",
11364
11380
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
11365
11381
  });
11366
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11382
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11367
11383
  const formatter = new JsonFormatter();
11368
11384
  const stats = uiTelemetryService.getMetrics();
11369
11385
  textOutput.write(
@@ -11456,13 +11472,13 @@ async function runNonInteractive({
11456
11472
  const output = isRaw ? part.text : stripAnsi(part.text);
11457
11473
  if (streamFormatter) {
11458
11474
  streamFormatter.emitEvent({
11459
- type: "message" /* MESSAGE */,
11475
+ type: JsonStreamEventType.MESSAGE,
11460
11476
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11461
11477
  role: "assistant",
11462
11478
  content: output,
11463
11479
  delta: true
11464
11480
  });
11465
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11481
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11466
11482
  responseText += output;
11467
11483
  } else {
11468
11484
  if (part.text) {
@@ -11475,13 +11491,13 @@ async function runNonInteractive({
11475
11491
  break;
11476
11492
  }
11477
11493
  case "tool_request": {
11478
- if (config.getOutputFormat() === "json" /* JSON */) {
11494
+ if (config.getOutputFormat() === OutputFormat.JSON) {
11479
11495
  preToolResponseText = responseText || preToolResponseText;
11480
11496
  responseText = "";
11481
11497
  }
11482
11498
  if (streamFormatter) {
11483
11499
  streamFormatter.emitEvent({
11484
- type: "tool_use" /* TOOL_USE */,
11500
+ type: JsonStreamEventType.TOOL_USE,
11485
11501
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11486
11502
  tool_name: event.name,
11487
11503
  tool_id: event.requestId,
@@ -11497,7 +11513,7 @@ async function runNonInteractive({
11497
11513
  const displayText = displayContentToString(display);
11498
11514
  const errorMsg = getTextContent(event.content) ?? "Tool error";
11499
11515
  streamFormatter.emitEvent({
11500
- type: "tool_result" /* TOOL_RESULT */,
11516
+ type: JsonStreamEventType.TOOL_RESULT,
11501
11517
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11502
11518
  tool_id: event.requestId,
11503
11519
  status: event.isError ? "error" : "success",
@@ -11512,17 +11528,17 @@ async function runNonInteractive({
11512
11528
  const display = event.display?.result;
11513
11529
  const displayText = displayContentToString(display);
11514
11530
  const errorMsg = getTextContent(event.content) ?? "Tool error";
11515
- if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
11516
- if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
11531
+ if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
11532
+ if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
11517
11533
  responseText = preToolResponseText;
11518
11534
  }
11519
11535
  const stopMessage = `Agent execution stopped: ${errorMsg}`;
11520
- if (config.getOutputFormat() === "text" /* TEXT */) {
11536
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11521
11537
  process.stderr.write(`${stopMessage}
11522
11538
  `);
11523
11539
  }
11524
11540
  }
11525
- if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
11541
+ if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
11526
11542
  throw new FatalToolExecutionError(
11527
11543
  "Error executing tool " + event.name + ": " + (displayText || errorMsg)
11528
11544
  );
@@ -11557,12 +11573,12 @@ async function runNonInteractive({
11557
11573
  }
11558
11574
  if (streamFormatter) {
11559
11575
  streamFormatter.emitEvent({
11560
- type: "error" /* ERROR */,
11576
+ type: JsonStreamEventType.ERROR,
11561
11577
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11562
11578
  severity: "error",
11563
11579
  message: errorMessage
11564
11580
  });
11565
- } else if (config.getOutputFormat() === "text" /* TEXT */) {
11581
+ } else if (config.getOutputFormat() === OutputFormat.TEXT) {
11566
11582
  process.stderr.write(`[ERROR] ${errorMessage}
11567
11583
  `);
11568
11584
  }
@@ -11583,12 +11599,12 @@ async function runNonInteractive({
11583
11599
  const errorCode = event._meta?.["code"];
11584
11600
  if (errorCode === "AGENT_EXECUTION_BLOCKED") {
11585
11601
  const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
11586
- if (config.getOutputFormat() === "text" /* TEXT */) {
11602
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11587
11603
  process.stderr.write(`[WARNING] ${blockMessage}
11588
11604
  `);
11589
11605
  } else if (streamFormatter) {
11590
11606
  streamFormatter.emitEvent({
11591
- type: "error" /* ERROR */,
11607
+ type: JsonStreamEventType.ERROR,
11592
11608
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11593
11609
  severity: "warning",
11594
11610
  message: stripAnsi(blockMessage)
@@ -11598,13 +11614,13 @@ async function runNonInteractive({
11598
11614
  break;
11599
11615
  }
11600
11616
  const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
11601
- if (config.getOutputFormat() === "text" /* TEXT */) {
11617
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11602
11618
  process.stderr.write(`[WARNING] ${event.message}
11603
11619
  `);
11604
11620
  }
11605
11621
  if (streamFormatter) {
11606
11622
  streamFormatter.emitEvent({
11607
- type: "error" /* ERROR */,
11623
+ type: JsonStreamEventType.ERROR,
11608
11624
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11609
11625
  severity,
11610
11626
  message: stripAnsi(event.message)
@@ -11624,7 +11640,7 @@ async function runNonInteractive({
11624
11640
  );
11625
11641
  } else if (streamFormatter) {
11626
11642
  streamFormatter.emitEvent({
11627
- type: "error" /* ERROR */,
11643
+ type: JsonStreamEventType.ERROR,
11628
11644
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11629
11645
  severity: "error",
11630
11646
  message: "Maximum session turns exceeded"
@@ -11632,7 +11648,7 @@ async function runNonInteractive({
11632
11648
  }
11633
11649
  }
11634
11650
  const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
11635
- if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
11651
+ if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
11636
11652
  process.stderr.write(`Agent execution stopped: ${stopMessage}
11637
11653
  `);
11638
11654
  }
@@ -11662,7 +11678,7 @@ async function runNonInteractive({
11662
11678
  abortController.signal.removeEventListener("abort", abortSession);
11663
11679
  scheduler?.dispose();
11664
11680
  consolePatcher.cleanup();
11665
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
11681
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
11666
11682
  }
11667
11683
  if (errorToHandle) {
11668
11684
  handleError(errorToHandle, config);
@@ -11690,7 +11706,7 @@ async function runNonInteractive2(params) {
11690
11706
  }
11691
11707
  });
11692
11708
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
11693
- const { setupInitialActivityLogger } = await import("./devtoolsService-77KBSPWB.js");
11709
+ const { setupInitialActivityLogger } = await import("./devtoolsService-5F6M45NJ.js");
11694
11710
  setupInitialActivityLogger(config);
11695
11711
  }
11696
11712
  const { stdout: workingStdout } = createWorkingStdio();
@@ -11706,7 +11722,7 @@ async function runNonInteractive2(params) {
11706
11722
  }
11707
11723
  };
11708
11724
  const startTime = Date.now();
11709
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
11725
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
11710
11726
  const abortController = new AbortController();
11711
11727
  let isAborting = false;
11712
11728
  let cancelMessageTimer = null;
@@ -11757,13 +11773,13 @@ async function runNonInteractive2(params) {
11757
11773
  let scheduler;
11758
11774
  try {
11759
11775
  consolePatcher.patch();
11760
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
11776
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
11761
11777
  process.stderr.write(
11762
11778
  "[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"
11763
11779
  );
11764
11780
  }
11765
11781
  setupStdinCancellation();
11766
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
11782
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
11767
11783
  coreEvents.drainBacklogs();
11768
11784
  process.stdout.on("error", (err) => {
11769
11785
  if (err.code === "EPIPE") {
@@ -11787,7 +11803,7 @@ async function runNonInteractive2(params) {
11787
11803
  }
11788
11804
  if (streamFormatter) {
11789
11805
  streamFormatter.emitEvent({
11790
- type: "init" /* INIT */,
11806
+ type: JsonStreamEventType.INIT,
11791
11807
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11792
11808
  session_id: config.getSessionId(),
11793
11809
  model: config.getModel()
@@ -11825,7 +11841,7 @@ async function runNonInteractive2(params) {
11825
11841
  }
11826
11842
  if (streamFormatter) {
11827
11843
  streamFormatter.emitEvent({
11828
- type: "message" /* MESSAGE */,
11844
+ type: JsonStreamEventType.MESSAGE,
11829
11845
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11830
11846
  role: "user",
11831
11847
  content: input
@@ -11853,28 +11869,28 @@ async function runNonInteractive2(params) {
11853
11869
  if (abortController.signal.aborted) {
11854
11870
  handleCancellationError(config);
11855
11871
  }
11856
- if (event.type === "content" /* Content */) {
11872
+ if (event.type === GeminiEventType.Content) {
11857
11873
  const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
11858
11874
  const output = isRaw ? event.value : stripAnsi(event.value);
11859
11875
  if (streamFormatter) {
11860
11876
  streamFormatter.emitEvent({
11861
- type: "message" /* MESSAGE */,
11877
+ type: JsonStreamEventType.MESSAGE,
11862
11878
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11863
11879
  role: "assistant",
11864
11880
  content: output,
11865
11881
  delta: true
11866
11882
  });
11867
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11883
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11868
11884
  responseText += output;
11869
11885
  } else {
11870
11886
  if (event.value) {
11871
11887
  textOutput.write(output);
11872
11888
  }
11873
11889
  }
11874
- } else if (event.type === "tool_call_request" /* ToolCallRequest */) {
11890
+ } else if (event.type === GeminiEventType.ToolCallRequest) {
11875
11891
  if (streamFormatter) {
11876
11892
  streamFormatter.emitEvent({
11877
- type: "tool_use" /* TOOL_USE */,
11893
+ type: JsonStreamEventType.TOOL_USE,
11878
11894
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11879
11895
  tool_name: event.value.name,
11880
11896
  tool_id: event.value.callId,
@@ -11882,33 +11898,33 @@ async function runNonInteractive2(params) {
11882
11898
  });
11883
11899
  }
11884
11900
  toolCallRequests.push(event.value);
11885
- } else if (event.type === "loop_detected" /* LoopDetected */) {
11901
+ } else if (event.type === GeminiEventType.LoopDetected) {
11886
11902
  const message = "Loop detected, stopping execution";
11887
11903
  if (streamFormatter) {
11888
11904
  streamFormatter.emitEvent({
11889
- type: "error" /* ERROR */,
11905
+ type: JsonStreamEventType.ERROR,
11890
11906
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11891
11907
  severity: "warning",
11892
11908
  message
11893
11909
  });
11894
11910
  }
11895
11911
  warnings.push(message);
11896
- } else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
11912
+ } else if (event.type === GeminiEventType.MaxSessionTurns) {
11897
11913
  const message = "Maximum session turns exceeded";
11898
11914
  if (streamFormatter) {
11899
11915
  streamFormatter.emitEvent({
11900
- type: "error" /* ERROR */,
11916
+ type: JsonStreamEventType.ERROR,
11901
11917
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11902
11918
  severity: "error",
11903
11919
  message
11904
11920
  });
11905
11921
  }
11906
11922
  warnings.push(message);
11907
- } else if (event.type === "error" /* Error */) {
11923
+ } else if (event.type === GeminiEventType.Error) {
11908
11924
  throw event.value.error;
11909
- } else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
11925
+ } else if (event.type === GeminiEventType.AgentExecutionStopped) {
11910
11926
  const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
11911
- if (config.getOutputFormat() === "text" /* TEXT */) {
11927
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11912
11928
  process.stderr.write(`${stopMessage}
11913
11929
  `);
11914
11930
  }
@@ -11916,7 +11932,7 @@ async function runNonInteractive2(params) {
11916
11932
  const metrics = uiTelemetryService.getMetrics();
11917
11933
  const durationMs = Date.now() - startTime;
11918
11934
  streamFormatter.emitEvent({
11919
- type: "result" /* RESULT */,
11935
+ type: JsonStreamEventType.RESULT,
11920
11936
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11921
11937
  status: "success",
11922
11938
  stats: streamFormatter.convertToStreamStats(
@@ -11924,7 +11940,7 @@ async function runNonInteractive2(params) {
11924
11940
  durationMs
11925
11941
  )
11926
11942
  });
11927
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11943
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11928
11944
  const formatter = new JsonFormatter();
11929
11945
  const stats = uiTelemetryService.getMetrics();
11930
11946
  textOutput.write(
@@ -11940,21 +11956,21 @@ async function runNonInteractive2(params) {
11940
11956
  textOutput.ensureTrailingNewline();
11941
11957
  }
11942
11958
  return;
11943
- } else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
11959
+ } else if (event.type === GeminiEventType.AgentExecutionBlocked) {
11944
11960
  const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
11945
- if (config.getOutputFormat() === "text" /* TEXT */) {
11961
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11946
11962
  process.stderr.write(`[WARNING] ${blockMessage}
11947
11963
  `);
11948
11964
  } else if (streamFormatter) {
11949
11965
  streamFormatter.emitEvent({
11950
- type: "error" /* ERROR */,
11966
+ type: JsonStreamEventType.ERROR,
11951
11967
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11952
11968
  severity: "warning",
11953
11969
  message: stripAnsi(blockMessage)
11954
11970
  });
11955
11971
  }
11956
11972
  warnings.push(blockMessage);
11957
- } else if (event.type === "invalid_stream" /* InvalidStream */) {
11973
+ } else if (event.type === GeminiEventType.InvalidStream) {
11958
11974
  const eventValue = event.value;
11959
11975
  if (eventValue?.type === "NO_RESPONSE_TEXT") {
11960
11976
  invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
@@ -11977,12 +11993,12 @@ async function runNonInteractive2(params) {
11977
11993
  );
11978
11994
  if (streamFormatter) {
11979
11995
  streamFormatter.emitEvent({
11980
- type: "error" /* ERROR */,
11996
+ type: JsonStreamEventType.ERROR,
11981
11997
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11982
11998
  severity: "error",
11983
11999
  message: invalidStreamError
11984
12000
  });
11985
- } else if (config.getOutputFormat() === "text" /* TEXT */) {
12001
+ } else if (config.getOutputFormat() === OutputFormat.TEXT) {
11986
12002
  process.stderr.write(`[ERROR] ${invalidStreamError}
11987
12003
  `);
11988
12004
  }
@@ -12002,7 +12018,7 @@ async function runNonInteractive2(params) {
12002
12018
  const requestInfo = completedToolCall.request;
12003
12019
  if (streamFormatter) {
12004
12020
  streamFormatter.emitEvent({
12005
- type: "tool_result" /* TOOL_RESULT */,
12021
+ type: JsonStreamEventType.TOOL_RESULT,
12006
12022
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12007
12023
  tool_id: requestInfo.callId,
12008
12024
  status: completedToolCall.status === "error" ? "error" : "success",
@@ -12036,11 +12052,11 @@ async function runNonInteractive2(params) {
12036
12052
  );
12037
12053
  }
12038
12054
  const stopExecutionTool = completedToolCalls.find(
12039
- (tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
12055
+ (tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
12040
12056
  );
12041
12057
  if (stopExecutionTool && stopExecutionTool.response.error) {
12042
12058
  const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
12043
- if (config.getOutputFormat() === "text" /* TEXT */) {
12059
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
12044
12060
  process.stderr.write(`${stopMessage}
12045
12061
  `);
12046
12062
  }
@@ -12048,7 +12064,7 @@ async function runNonInteractive2(params) {
12048
12064
  const metrics = uiTelemetryService.getMetrics();
12049
12065
  const durationMs = Date.now() - startTime;
12050
12066
  streamFormatter.emitEvent({
12051
- type: "result" /* RESULT */,
12067
+ type: JsonStreamEventType.RESULT,
12052
12068
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12053
12069
  status: "success",
12054
12070
  stats: streamFormatter.convertToStreamStats(
@@ -12056,7 +12072,7 @@ async function runNonInteractive2(params) {
12056
12072
  durationMs
12057
12073
  )
12058
12074
  });
12059
- } else if (config.getOutputFormat() === "json" /* JSON */) {
12075
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
12060
12076
  const formatter = new JsonFormatter();
12061
12077
  const stats = uiTelemetryService.getMetrics();
12062
12078
  textOutput.write(
@@ -12079,12 +12095,12 @@ async function runNonInteractive2(params) {
12079
12095
  const metrics = uiTelemetryService.getMetrics();
12080
12096
  const durationMs = Date.now() - startTime;
12081
12097
  streamFormatter.emitEvent({
12082
- type: "result" /* RESULT */,
12098
+ type: JsonStreamEventType.RESULT,
12083
12099
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12084
12100
  status: invalidStreamError ? "error" : "success",
12085
12101
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
12086
12102
  });
12087
- } else if (config.getOutputFormat() === "json" /* JSON */) {
12103
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
12088
12104
  const formatter = new JsonFormatter();
12089
12105
  const stats = uiTelemetryService.getMetrics();
12090
12106
  textOutput.write(
@@ -12108,7 +12124,7 @@ async function runNonInteractive2(params) {
12108
12124
  cleanupStdinCancellation();
12109
12125
  scheduler?.dispose();
12110
12126
  consolePatcher.cleanup();
12111
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
12127
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
12112
12128
  }
12113
12129
  if (errorToHandle) {
12114
12130
  handleError(errorToHandle, config);
@@ -14499,12 +14515,12 @@ function toToolCallContent(toolResult) {
14499
14515
  }
14500
14516
  var basicPermissionOptions = [
14501
14517
  {
14502
- optionId: "proceed_once" /* ProceedOnce */,
14518
+ optionId: ToolConfirmationOutcome.ProceedOnce,
14503
14519
  name: "Allow",
14504
14520
  kind: "allow_once"
14505
14521
  },
14506
14522
  {
14507
- optionId: "cancel" /* Cancel */,
14523
+ optionId: ToolConfirmationOutcome.Cancel,
14508
14524
  name: "Reject",
14509
14525
  kind: "reject_once"
14510
14526
  }
@@ -14516,13 +14532,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14516
14532
  switch (confirmation.type) {
14517
14533
  case "edit":
14518
14534
  options.push({
14519
- optionId: "proceed_always" /* ProceedAlways */,
14535
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14520
14536
  name: "Allow for this session",
14521
14537
  kind: "allow_always"
14522
14538
  });
14523
14539
  if (enablePermanentToolApproval) {
14524
14540
  options.push({
14525
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14541
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14526
14542
  name: "Allow for this file in all future sessions",
14527
14543
  kind: "allow_always"
14528
14544
  });
@@ -14530,13 +14546,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14530
14546
  break;
14531
14547
  case "exec":
14532
14548
  options.push({
14533
- optionId: "proceed_always" /* ProceedAlways */,
14549
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14534
14550
  name: "Allow for this session",
14535
14551
  kind: "allow_always"
14536
14552
  });
14537
14553
  if (enablePermanentToolApproval) {
14538
14554
  options.push({
14539
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14555
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14540
14556
  name: "Allow this command for all future sessions",
14541
14557
  kind: "allow_always"
14542
14558
  });
@@ -14545,19 +14561,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14545
14561
  case "mcp":
14546
14562
  options.push(
14547
14563
  {
14548
- optionId: "proceed_always_server" /* ProceedAlwaysServer */,
14564
+ optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
14549
14565
  name: "Allow all server tools for this session",
14550
14566
  kind: "allow_always"
14551
14567
  },
14552
14568
  {
14553
- optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
14569
+ optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
14554
14570
  name: "Allow tool for this session",
14555
14571
  kind: "allow_always"
14556
14572
  }
14557
14573
  );
14558
14574
  if (enablePermanentToolApproval) {
14559
14575
  options.push({
14560
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14576
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14561
14577
  name: "Allow tool for all future sessions",
14562
14578
  kind: "allow_always"
14563
14579
  });
@@ -14565,13 +14581,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14565
14581
  break;
14566
14582
  case "info":
14567
14583
  options.push({
14568
- optionId: "proceed_always" /* ProceedAlways */,
14584
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14569
14585
  name: "Allow for this session",
14570
14586
  kind: "allow_always"
14571
14587
  });
14572
14588
  if (enablePermanentToolApproval) {
14573
14589
  options.push({
14574
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14590
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14575
14591
  name: "Allow for all future sessions",
14576
14592
  kind: "allow_always"
14577
14593
  });
@@ -14603,21 +14619,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14603
14619
  }
14604
14620
  function toAcpToolKind(kind) {
14605
14621
  switch (kind) {
14606
- case "read" /* Read */:
14607
- case "edit" /* Edit */:
14608
- case "execute" /* Execute */:
14609
- case "search" /* Search */:
14610
- case "delete" /* Delete */:
14611
- case "move" /* Move */:
14612
- case "think" /* Think */:
14613
- case "fetch" /* Fetch */:
14614
- case "switch_mode" /* SwitchMode */:
14615
- case "other" /* Other */:
14622
+ case Kind.Read:
14623
+ case Kind.Edit:
14624
+ case Kind.Execute:
14625
+ case Kind.Search:
14626
+ case Kind.Delete:
14627
+ case Kind.Move:
14628
+ case Kind.Think:
14629
+ case Kind.Fetch:
14630
+ case Kind.SwitchMode:
14631
+ case Kind.Other:
14616
14632
  return kind;
14617
- case "agent" /* Agent */:
14633
+ case Kind.Agent:
14618
14634
  return "think";
14619
- case "plan" /* Plan */:
14620
- case "communicate" /* Communicate */:
14635
+ case Kind.Plan:
14636
+ case Kind.Communicate:
14621
14637
  default:
14622
14638
  return "other";
14623
14639
  }
@@ -14625,24 +14641,24 @@ function toAcpToolKind(kind) {
14625
14641
  function buildAvailableModes(isPlanEnabled) {
14626
14642
  const modes = [
14627
14643
  {
14628
- id: "default" /* DEFAULT */,
14644
+ id: ApprovalMode.DEFAULT,
14629
14645
  name: "Default",
14630
14646
  description: "Prompts for approval"
14631
14647
  },
14632
14648
  {
14633
- id: "autoEdit" /* AUTO_EDIT */,
14649
+ id: ApprovalMode.AUTO_EDIT,
14634
14650
  name: "Auto Edit",
14635
14651
  description: "Auto-approves edit tools"
14636
14652
  },
14637
14653
  {
14638
- id: "yolo" /* YOLO */,
14654
+ id: ApprovalMode.YOLO,
14639
14655
  name: "YOLO",
14640
14656
  description: "Auto-approves all tools"
14641
14657
  }
14642
14658
  ];
14643
14659
  if (isPlanEnabled) {
14644
14660
  modes.push({
14645
- id: "plan" /* PLAN */,
14661
+ id: ApprovalMode.PLAN,
14646
14662
  name: "Plan",
14647
14663
  description: "Read-only mode"
14648
14664
  });
@@ -14655,7 +14671,7 @@ function buildAvailableModels(config, settings) {
14655
14671
  const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
14656
14672
  const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
14657
14673
  const selectedAuthType = settings.merged.security.auth.selectedType;
14658
- const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
14674
+ const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
14659
14675
  if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
14660
14676
  const options = config.getModelConfigService().getAvailableModelOptions({
14661
14677
  useGemini3_1: useGemini31,
@@ -14741,11 +14757,11 @@ var Session = class {
14741
14757
  this.connection = connection;
14742
14758
  this.settings = settings;
14743
14759
  coreEvents.on(
14744
- "approval-mode-changed" /* ApprovalModeChanged */,
14760
+ CoreEvent.ApprovalModeChanged,
14745
14761
  this.handleApprovalModeChanged
14746
14762
  );
14747
14763
  this.context.config.getMessageBus()?.subscribe(
14748
- "tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
14764
+ MessageBusType.TOOL_CONFIRMATION_REQUEST,
14749
14765
  this.handleToolConfirmationRequest,
14750
14766
  { signal: this.disposeController.signal }
14751
14767
  );
@@ -14769,7 +14785,7 @@ var Session = class {
14769
14785
  "Policy engine missing. Denying tool confirmation request."
14770
14786
  );
14771
14787
  await messageBus.publish({
14772
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14788
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14773
14789
  correlationId: request.correlationId,
14774
14790
  confirmed: false,
14775
14791
  requiresUserConfirmation: false
@@ -14782,7 +14798,7 @@ var Session = class {
14782
14798
  "Tool confirmation request missing tool name. Denying."
14783
14799
  );
14784
14800
  await messageBus.publish({
14785
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14801
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14786
14802
  correlationId: request.correlationId,
14787
14803
  confirmed: false,
14788
14804
  requiresUserConfirmation: false
@@ -14795,7 +14811,7 @@ var Session = class {
14795
14811
  `Tool confirmation request for unknown tool: ${toolName}. Denying.`
14796
14812
  );
14797
14813
  await messageBus.publish({
14798
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14814
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14799
14815
  correlationId: request.correlationId,
14800
14816
  confirmed: false,
14801
14817
  requiresUserConfirmation: false
@@ -14811,15 +14827,15 @@ var Session = class {
14811
14827
  request.subagent
14812
14828
  );
14813
14829
  await messageBus.publish({
14814
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14830
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14815
14831
  correlationId: request.correlationId,
14816
- confirmed: result.decision === "allow" /* ALLOW */,
14817
- requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
14832
+ confirmed: result.decision === PolicyDecision.ALLOW,
14833
+ requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
14818
14834
  });
14819
14835
  } catch (error) {
14820
14836
  debugLogger.error("Error handling tool confirmation request:", error);
14821
14837
  await this.context.config.getMessageBus()?.publish({
14822
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14838
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14823
14839
  correlationId: request.correlationId,
14824
14840
  confirmed: false,
14825
14841
  requiresUserConfirmation: false
@@ -14839,7 +14855,7 @@ var Session = class {
14839
14855
  };
14840
14856
  dispose() {
14841
14857
  coreEvents.off(
14842
- "approval-mode-changed" /* ApprovalModeChanged */,
14858
+ CoreEvent.ApprovalModeChanged,
14843
14859
  this.handleApprovalModeChanged
14844
14860
  );
14845
14861
  this.disposeController.abort();
@@ -14928,7 +14944,7 @@ ${thought.description}`;
14928
14944
  await this.sendUpdate({
14929
14945
  sessionUpdate: "tool_call",
14930
14946
  toolCallId: toolCall.id,
14931
- status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
14947
+ status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
14932
14948
  title: toolCall.displayName || toolCall.name,
14933
14949
  content: toolCallContent,
14934
14950
  kind: tool ? toAcpToolKind(tool.kind) : "other"
@@ -15020,7 +15036,7 @@ ${thought.description}`;
15020
15036
  return { stopReason: "cancelled" };
15021
15037
  }
15022
15038
  switch (event.type) {
15023
- case "content" /* Content */: {
15039
+ case GeminiEventType.Content: {
15024
15040
  const content = {
15025
15041
  type: "text",
15026
15042
  text: event.value
@@ -15031,7 +15047,7 @@ ${thought.description}`;
15031
15047
  });
15032
15048
  break;
15033
15049
  }
15034
- case "thought" /* Thought */: {
15050
+ case GeminiEventType.Thought: {
15035
15051
  const thoughtText = `**${event.value.subject}**
15036
15052
  ${event.value.description}`;
15037
15053
  await this.sendUpdate({
@@ -15040,10 +15056,10 @@ ${event.value.description}`;
15040
15056
  });
15041
15057
  break;
15042
15058
  }
15043
- case "tool_call_request" /* ToolCallRequest */:
15059
+ case GeminiEventType.ToolCallRequest:
15044
15060
  toolCallRequests.push(event.value);
15045
15061
  break;
15046
- case "finished" /* Finished */: {
15062
+ case GeminiEventType.Finished: {
15047
15063
  const usage2 = event.value.usageMetadata;
15048
15064
  if (usage2) {
15049
15065
  turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
@@ -15051,19 +15067,19 @@ ${event.value.description}`;
15051
15067
  }
15052
15068
  break;
15053
15069
  }
15054
- case "model_info" /* ModelInfo */:
15070
+ case GeminiEventType.ModelInfo:
15055
15071
  turnModelId = event.value;
15056
15072
  break;
15057
- case "max_session_turns" /* MaxSessionTurns */:
15073
+ case GeminiEventType.MaxSessionTurns:
15058
15074
  stopReason = "max_turn_requests";
15059
15075
  break;
15060
- case "loop_detected" /* LoopDetected */:
15076
+ case GeminiEventType.LoopDetected:
15061
15077
  stopReason = "max_turn_requests";
15062
15078
  break;
15063
- case "context_window_will_overflow" /* ContextWindowWillOverflow */:
15079
+ case GeminiEventType.ContextWindowWillOverflow:
15064
15080
  stopReason = "max_tokens";
15065
15081
  break;
15066
- case "error" /* Error */: {
15082
+ case GeminiEventType.Error: {
15067
15083
  const parseResult = StructuredErrorSchema.safeParse(
15068
15084
  event.value.error
15069
15085
  );
@@ -15291,7 +15307,7 @@ ${event.value.description}`;
15291
15307
  const output = RequestPermissionResponseSchema.parse(
15292
15308
  await this.connection.requestPermission(params)
15293
15309
  );
15294
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15310
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15295
15311
  await confirmationDetails.onConfirm(outcome);
15296
15312
  await updatePolicy(
15297
15313
  tool,
@@ -15302,16 +15318,16 @@ ${event.value.description}`;
15302
15318
  invocation
15303
15319
  );
15304
15320
  switch (outcome) {
15305
- case "cancel" /* Cancel */:
15321
+ case ToolConfirmationOutcome.Cancel:
15306
15322
  return errorResponse(
15307
15323
  new Error(`Tool "${fc.name}" was canceled by the user.`)
15308
15324
  );
15309
- case "proceed_once" /* ProceedOnce */:
15310
- case "proceed_always" /* ProceedAlways */:
15311
- case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
15312
- case "proceed_always_server" /* ProceedAlwaysServer */:
15313
- case "proceed_always_tool" /* ProceedAlwaysTool */:
15314
- case "modify_with_editor" /* ModifyWithEditor */:
15325
+ case ToolConfirmationOutcome.ProceedOnce:
15326
+ case ToolConfirmationOutcome.ProceedAlways:
15327
+ case ToolConfirmationOutcome.ProceedAlwaysAndSave:
15328
+ case ToolConfirmationOutcome.ProceedAlwaysServer:
15329
+ case ToolConfirmationOutcome.ProceedAlwaysTool:
15330
+ case ToolConfirmationOutcome.ModifyWithEditor:
15315
15331
  break;
15316
15332
  default: {
15317
15333
  const resultOutcome = outcome;
@@ -15365,7 +15381,7 @@ ${event.value.description}`;
15365
15381
  );
15366
15382
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
15367
15383
  {
15368
- status: "success" /* Success */,
15384
+ status: CoreToolCallStatus.Success,
15369
15385
  request: {
15370
15386
  callId,
15371
15387
  name: fc.name,
@@ -15410,7 +15426,7 @@ ${event.value.description}`;
15410
15426
  });
15411
15427
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
15412
15428
  {
15413
- status: "error" /* Error */,
15429
+ status: CoreToolCallStatus.Error,
15414
15430
  request: {
15415
15431
  callId,
15416
15432
  name: fc.name,
@@ -15538,12 +15554,12 @@ ${event.value.description}`;
15538
15554
  sessionId: this.id,
15539
15555
  options: [
15540
15556
  {
15541
- optionId: "proceed_once" /* ProceedOnce */,
15557
+ optionId: ToolConfirmationOutcome.ProceedOnce,
15542
15558
  name: "Allow once",
15543
15559
  kind: "allow_once"
15544
15560
  },
15545
15561
  {
15546
- optionId: "cancel" /* Cancel */,
15562
+ optionId: ToolConfirmationOutcome.Cancel,
15547
15563
  name: "Deny",
15548
15564
  kind: "reject_once"
15549
15565
  }
@@ -15568,8 +15584,8 @@ ${event.value.description}`;
15568
15584
  const output = RequestPermissionResponseSchema.parse(
15569
15585
  await this.connection.requestPermission(params)
15570
15586
  );
15571
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15572
- if (outcome === "proceed_once" /* ProceedOnce */) {
15587
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15588
+ if (outcome === ToolConfirmationOutcome.ProceedOnce) {
15573
15589
  this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
15574
15590
  validationError = null;
15575
15591
  } else {
@@ -16006,7 +16022,7 @@ var AcpSessionManager = class {
16006
16022
  mcpServers,
16007
16023
  loadedSettings
16008
16024
  );
16009
- const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
16025
+ const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
16010
16026
  let isAuthenticated = false;
16011
16027
  let authErrorMessage = "";
16012
16028
  try {
@@ -16018,7 +16034,7 @@ var AcpSessionManager = class {
16018
16034
  );
16019
16035
  isAuthenticated = true;
16020
16036
  const contentGeneratorConfig = config.getContentGeneratorConfig();
16021
- if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
16037
+ if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
16022
16038
  isAuthenticated = false;
16023
16039
  authErrorMessage = "Gemini API key is missing or not configured.";
16024
16040
  }
@@ -16127,7 +16143,7 @@ var AcpSessionManager = class {
16127
16143
  return response;
16128
16144
  }
16129
16145
  async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
16130
- const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
16146
+ const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
16131
16147
  if (!selectedAuthType) {
16132
16148
  throw RequestError.authRequired();
16133
16149
  }
@@ -16228,12 +16244,12 @@ var GeminiAgent = class {
16228
16244
  }
16229
16245
  const authMethods = [
16230
16246
  {
16231
- id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
16247
+ id: AuthType.LOGIN_WITH_GOOGLE,
16232
16248
  name: "Log in with Google",
16233
16249
  description: "Log in with your Google account"
16234
16250
  },
16235
16251
  {
16236
- id: "gemini-api-key" /* USE_GEMINI */,
16252
+ id: AuthType.USE_GEMINI,
16237
16253
  name: "Gemini API key",
16238
16254
  description: "Use an API key with Gemini Developer API",
16239
16255
  _meta: {
@@ -16243,12 +16259,12 @@ var GeminiAgent = class {
16243
16259
  }
16244
16260
  },
16245
16261
  {
16246
- id: "vertex-ai" /* USE_VERTEX_AI */,
16262
+ id: AuthType.USE_VERTEX_AI,
16247
16263
  name: "Vertex AI",
16248
16264
  description: "Use an API key with Vertex AI GenAI API"
16249
16265
  },
16250
16266
  {
16251
- id: "gateway" /* GATEWAY */,
16267
+ id: AuthType.GATEWAY,
16252
16268
  name: "AI API Gateway",
16253
16269
  description: "Use a custom AI API Gateway",
16254
16270
  _meta: {
@@ -16421,7 +16437,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
16421
16437
  }
16422
16438
  return authType;
16423
16439
  } catch (error) {
16424
- if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
16440
+ if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
16425
16441
  handleError(
16426
16442
  error instanceof Error ? error : new Error(String(error)),
16427
16443
  nonInteractiveConfig,
@@ -16616,10 +16632,10 @@ var SlashCommandConflictHandler = class {
16616
16632
  this.handleConflicts = this.handleConflicts.bind(this);
16617
16633
  }
16618
16634
  start() {
16619
- coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
16635
+ coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
16620
16636
  }
16621
16637
  stop() {
16622
- coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
16638
+ coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
16623
16639
  if (this.flushTimeout) {
16624
16640
  clearTimeout(this.flushTimeout);
16625
16641
  this.flushTimeout = null;
@@ -16900,7 +16916,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
16900
16916
  }
16901
16917
  }
16902
16918
  async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
16903
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-DVEN62HN.js");
16919
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-K2X4WXE2.js");
16904
16920
  await doStartUI(
16905
16921
  config,
16906
16922
  settings,
@@ -17003,12 +17019,12 @@ async function main() {
17003
17019
  dns.setDefaultResultOrder(
17004
17020
  validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
17005
17021
  );
17006
- if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
17022
+ if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
17007
17023
  if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
17008
17024
  settings.setValue(
17009
17025
  "User" /* User */,
17010
17026
  "security.auth.selectedType",
17011
- "compute-default-credentials" /* COMPUTE_ADC */
17027
+ AuthType.COMPUTE_ADC
17012
17028
  );
17013
17029
  }
17014
17030
  }
@@ -17109,7 +17125,7 @@ ${finalArgs[promptIndex + 1]}`;
17109
17125
  await config.storage.initialize();
17110
17126
  adminControlsListner.setConfig(config);
17111
17127
  if (config.isInteractive() && settings.merged.general.devtools) {
17112
- const { setupInitialActivityLogger } = await import("./devtoolsService-77KBSPWB.js");
17128
+ const { setupInitialActivityLogger } = await import("./devtoolsService-5F6M45NJ.js");
17113
17129
  setupInitialActivityLogger(config);
17114
17130
  }
17115
17131
  registerTelemetryConfig(config);
@@ -17117,7 +17133,7 @@ ${finalArgs[promptIndex + 1]}`;
17117
17133
  const messageBus = config.getMessageBus();
17118
17134
  createPolicyUpdater2(policyEngine, messageBus, config.storage);
17119
17135
  registerCleanup(async () => {
17120
- await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
17136
+ await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
17121
17137
  });
17122
17138
  if (!config.getAcpMode()) {
17123
17139
  registerCleanup(consolePatcher.cleanup);
@@ -17168,7 +17184,7 @@ ${finalArgs[promptIndex + 1]}`;
17168
17184
  const initAppHandle = startupProfiler.start("initialize_app");
17169
17185
  const initializationResult = await initializeApp(config, settings);
17170
17186
  initAppHandle?.end();
17171
- import("./liteRtServerManager-4SSYZUK3.js").then(({ LiteRtServerManager }) => {
17187
+ import("./liteRtServerManager-TJZWOKLH.js").then(({ LiteRtServerManager }) => {
17172
17188
  const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
17173
17189
  if (!mergedGemma) return;
17174
17190
  const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
@@ -17178,7 +17194,7 @@ ${finalArgs[promptIndex + 1]}`;
17178
17194
  autoStartServer: userGemma?.autoStartServer
17179
17195
  });
17180
17196
  }).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
17181
- if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
17197
+ if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
17182
17198
  await getOauthClient(settings.merged.security.auth.selectedType, config);
17183
17199
  }
17184
17200
  if (config.getAcpMode()) {
@@ -17194,7 +17210,7 @@ ${finalArgs[promptIndex + 1]}`;
17194
17210
  ...rawStartupWarnings.map((message) => ({
17195
17211
  id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
17196
17212
  message,
17197
- priority: "high" /* High */
17213
+ priority: WarningPriority.High
17198
17214
  })),
17199
17215
  ...await getUserStartupWarnings(settings.merged, void 0, {
17200
17216
  isAlternateBuffer: useAlternateBuffer
@@ -17231,7 +17247,7 @@ ${finalArgs[promptIndex + 1]}`;
17231
17247
  ${input}` : stdinData;
17232
17248
  }
17233
17249
  }
17234
- const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
17250
+ const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
17235
17251
  const hookSystem = config?.getHookSystem();
17236
17252
  if (hookSystem) {
17237
17253
  const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
@@ -17288,8 +17304,8 @@ ${input}` : wrappedContext;
17288
17304
  }
17289
17305
  }
17290
17306
  function initializeOutputListenersAndFlush(config) {
17291
- if (coreEvents.listenerCount("output" /* Output */) === 0) {
17292
- coreEvents.on("output" /* Output */, (payload) => {
17307
+ if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
17308
+ coreEvents.on(CoreEvent.Output, (payload) => {
17293
17309
  if (payload.isStderr) {
17294
17310
  writeToStderr(payload.chunk, payload.encoding);
17295
17311
  } else {
@@ -17297,8 +17313,8 @@ function initializeOutputListenersAndFlush(config) {
17297
17313
  }
17298
17314
  });
17299
17315
  }
17300
- if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
17301
- coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
17316
+ if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
17317
+ coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
17302
17318
  if (payload.type === "error" || payload.type === "warn") {
17303
17319
  writeToStderr(payload.content + "\n");
17304
17320
  } else {
@@ -17306,8 +17322,8 @@ function initializeOutputListenersAndFlush(config) {
17306
17322
  }
17307
17323
  });
17308
17324
  }
17309
- if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
17310
- coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
17325
+ if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
17326
+ coreEvents.on(CoreEvent.UserFeedback, (payload) => {
17311
17327
  writeToStderr(payload.message + "\n");
17312
17328
  });
17313
17329
  }
@@ -17315,7 +17331,7 @@ function initializeOutputListenersAndFlush(config) {
17315
17331
  const forceToStderr = outputFormat === "json";
17316
17332
  coreEvents.drainBacklogs(
17317
17333
  (event, args) => {
17318
- if (forceToStderr && event === "output" /* Output */) {
17334
+ if (forceToStderr && event === CoreEvent.Output) {
17319
17335
  const payload = args[0];
17320
17336
  if (!payload.isStderr) {
17321
17337
  return {