@google/gemini-cli 0.51.0-preview.0 → 0.52.0-nightly.20260713.gf354eebaf

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-YCMQYVOL.js → chunk-2T7DHFUF.js} +7 -7
  2. package/bundle/{chunk-ZLW5C5RW.js → chunk-2YX7REYH.js} +1 -1
  3. package/bundle/{chunk-KKZMWOPL.js → chunk-36XJOV7D.js} +1 -1
  4. package/bundle/{chunk-FIVDQWYP.js → chunk-3E5UN72A.js} +1 -1
  5. package/bundle/{chunk-YITANI4H.js → chunk-3QARMH4K.js} +8 -5
  6. package/bundle/{chunk-DY72VNA7.js → chunk-APFEBPRN.js} +2 -2
  7. package/bundle/{chunk-PUQ6F6LT.js → chunk-AXDCPZK4.js} +1 -1
  8. package/bundle/{chunk-FPNPAIJS.js → chunk-AZMX5CAR.js} +3 -3
  9. package/bundle/{chunk-MTJEEJK4.js → chunk-BWWM7236.js} +23 -11
  10. package/bundle/{chunk-KKH6C2EN.js → chunk-DB7X2Y2C.js} +7616 -14196
  11. package/bundle/{chunk-CCS4FZN3.js → chunk-DL66YX6H.js} +1 -1
  12. package/bundle/{chunk-JYUWXRQN.js → chunk-DZIOGU7O.js} +1 -1
  13. package/bundle/{chunk-NZPKN6HX.js → chunk-EBDB2GKX.js} +1 -1
  14. package/bundle/{chunk-4ZTDUVGF.js → chunk-ELOFTD3I.js} +3 -3
  15. package/bundle/{chunk-ZCZJ3EHG.js → chunk-EQJS4COG.js} +67 -54
  16. package/bundle/chunk-HWYSVU2Y.js +154 -0
  17. package/bundle/{chunk-Y6OKNB2O.js → chunk-JK366WXF.js} +1 -1
  18. package/bundle/{chunk-SN3AWJMJ.js → chunk-LZWVXAKV.js} +1 -1
  19. package/bundle/{chunk-G6N5TBIV.js → chunk-M2W3BJNE.js} +2 -2
  20. package/bundle/chunk-MNVSGXFA.js +17332 -0
  21. package/bundle/{chunk-IT3MCILF.js → chunk-NPBRF4SI.js} +1 -1
  22. package/bundle/{chunk-CR7DJZQQ.js → chunk-PUNBJ76K.js} +9 -8
  23. package/bundle/{chunk-4NX72DYK.js → chunk-QKLXGOQQ.js} +34 -16
  24. package/bundle/{chunk-TTSEXUPD.js → chunk-RXBKF467.js} +3 -3
  25. package/bundle/chunk-SJG3YDOW.js +102505 -0
  26. package/bundle/chunk-SWWOMF5U.js +388063 -0
  27. package/bundle/{chunk-Z6DCMYAX.js → chunk-TIH7TS2I.js} +2 -2
  28. package/bundle/chunk-XQM42LAM.js +118 -0
  29. package/bundle/chunk-Y2HXPFYB.js +1571 -0
  30. package/bundle/{chunk-DO2TG64U.js → chunk-YY7XHIP5.js} +7 -7
  31. package/bundle/chunk-Z3HRZRKL.js +398 -0
  32. package/bundle/chunk-Z6YPLHBH.js +512 -0
  33. package/bundle/{cleanup-FQDKYMP7.js → cleanup-5AQQMD23.js} +2 -2
  34. package/bundle/{cleanup-KYHKAOAV.js → cleanup-BJXMNJTU.js} +2 -2
  35. package/bundle/{cleanup-RKALUUIS.js → cleanup-BZE7CX3F.js} +2 -2
  36. package/bundle/cleanup-DPHUXC5P.js +32 -0
  37. package/bundle/{core-ZPLCY7CF.js → core-2VB5TAAN.js} +1 -1
  38. package/bundle/{devtoolsService-JKRU3MYU.js → devtoolsService-JRDPPU42.js} +2 -2
  39. package/bundle/{devtoolsService-XZY2NAWE.js → devtoolsService-LJGLJGJV.js} +4 -3
  40. package/bundle/devtoolsService-MG4V53EK.js +4359 -0
  41. package/bundle/{devtoolsService-MDNGNUVW.js → devtoolsService-SADMX7SY.js} +2 -2
  42. package/bundle/{dist-KYS2OS5Q.js → dist-CGC3DE3I.js} +1 -1
  43. package/bundle/{core-YY6I7TM7.js → dist-O7KA2L4U.js} +1 -1
  44. package/bundle/dist-V7MGOCX5.js +2152 -0
  45. package/bundle/docs/changelogs/index.md +13 -0
  46. package/bundle/docs/changelogs/latest.md +18 -49
  47. package/bundle/docs/changelogs/preview.md +44 -57
  48. package/bundle/{gemini-ZFN5ZWKT.js → gemini-24LLUGUQ.js} +14 -14
  49. package/bundle/{gemini-DFLM6FZF.js → gemini-EV7YQC7F.js} +14 -14
  50. package/bundle/{gemini-6JOWJJRI.js → gemini-UEPAA26P.js} +212 -196
  51. package/bundle/gemini-VWRUY5RU.js +29270 -0
  52. package/bundle/gemini.js +7 -7
  53. package/bundle/{interactiveCli-U33KFJYX.js → interactiveCli-CZLGBQJS.js} +52 -12
  54. package/bundle/{interactiveCli-642BSKOD.js → interactiveCli-GSUQ3DVQ.js} +359 -300
  55. package/bundle/interactiveCli-LAC2GT5E.js +34816 -0
  56. package/bundle/{interactiveCli-OIN4AGBD.js → interactiveCli-ZT2EUQKA.js} +52 -12
  57. package/bundle/{liteRtServerManager-6B6QVC3X.js → liteRtServerManager-2GSYVKDP.js} +4 -4
  58. package/bundle/{liteRtServerManager-6DL4RPYQ.js → liteRtServerManager-BWZ2W62M.js} +4 -4
  59. package/bundle/{liteRtServerManager-2KULLNCR.js → liteRtServerManager-NIEOMPFD.js} +4 -4
  60. package/bundle/liteRtServerManager-ZUHIUYXB.js +65 -0
  61. package/bundle/{oauth2-provider-7MN7TDIH.js → oauth2-provider-5VAK2NYV.js} +1 -1
  62. package/bundle/{oauth2-provider-YYHCEEAO.js → oauth2-provider-L7BJUHV4.js} +38 -72
  63. package/bundle/{oauth2-provider-XRJ2KE2Y.js → oauth2-provider-MT25IEBC.js} +1 -1
  64. package/bundle/oauth2-provider-R2QBZWOH.js +235 -0
  65. package/bundle/{start-HPGDHGIK.js → start-33JI6F6O.js} +6 -6
  66. package/bundle/{start-N7GSPBDS.js → start-HJTAEHPM.js} +6 -6
  67. package/bundle/{start-EKMJOLSQ.js → start-RCFRASLC.js} +6 -6
  68. package/bundle/start-XNCBFLHI.js +18 -0
  69. package/package.json +1 -1
@@ -41,18 +41,18 @@ import {
41
41
  updateAllUpdatableExtensions,
42
42
  updateExtension,
43
43
  validateAuthMethod
44
- } from "./chunk-ZCZJ3EHG.js";
44
+ } from "./chunk-2T7DHFUF.js";
45
45
  import {
46
46
  appEvents
47
47
  } from "./chunk-5PS3AYFU.js";
48
48
  import {
49
49
  startCommand,
50
50
  startServer
51
- } from "./chunk-4ZTDUVGF.js";
51
+ } from "./chunk-RXBKF467.js";
52
52
  import {
53
53
  exitCli,
54
54
  require_source
55
- } from "./chunk-FIVDQWYP.js";
55
+ } from "./chunk-Y2HXPFYB.js";
56
56
  import {
57
57
  DEFAULT_PORT,
58
58
  GEMMA_MODEL_NAME,
@@ -87,11 +87,11 @@ import {
87
87
  resolveGemmaConfig,
88
88
  saveModelChange,
89
89
  stripAnsi
90
- } from "./chunk-YITANI4H.js";
90
+ } from "./chunk-MNVSGXFA.js";
91
91
  import {
92
92
  RELAUNCH_EXIT_CODE
93
- } from "./chunk-Z6DCMYAX.js";
94
- import "./chunk-IT3MCILF.js";
93
+ } from "./chunk-Z3HRZRKL.js";
94
+ import "./chunk-PUNBJ76K.js";
95
95
  import {
96
96
  cleanupCheckpoints,
97
97
  registerCleanup,
@@ -100,11 +100,14 @@ import {
100
100
  runExitCleanup,
101
101
  runSyncCleanup,
102
102
  setupSignalHandlers
103
- } from "./chunk-JYUWXRQN.js";
103
+ } from "./chunk-HWYSVU2Y.js";
104
104
  import {
105
105
  ASK_USER_TOOL_NAME,
106
+ ApprovalMode,
106
107
  AuthType,
107
108
  Config,
109
+ CoreEvent,
110
+ CoreToolCallStatus,
108
111
  DEFAULT_CONTEXT_FILENAME,
109
112
  DEFAULT_FILE_FILTERING_OPTIONS,
110
113
  DEFAULT_GEMINI_EMBEDDING_MODEL,
@@ -126,32 +129,45 @@ import {
126
129
  FolderTrustDiscoveryService,
127
130
  GEMINI_DIR,
128
131
  GEMINI_MODEL_ALIAS_AUTO,
132
+ GeminiEventType,
129
133
  IdeClient,
134
+ IntegrityStatus,
130
135
  InvalidStreamError,
131
136
  JsonFormatter,
137
+ JsonStreamEventType,
138
+ Kind,
132
139
  LegacyAgentSession,
133
140
  Logger,
134
141
  MCPServerConfig,
142
+ MCPServerStatus,
143
+ MessageBusType,
144
+ OutputFormat,
135
145
  PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
136
146
  PREVIEW_GEMINI_3_1_MODEL,
137
147
  PREVIEW_GEMINI_FLASH_LITE_MODEL,
138
148
  PREVIEW_GEMINI_FLASH_MODEL,
139
149
  PREVIEW_GEMINI_MODEL,
150
+ PolicyDecision,
140
151
  PolicyIntegrityManager,
141
152
  REFERENCE_CONTENT_START,
142
153
  ROOT_SCHEDULER_ID,
143
154
  ReadManyFilesTool,
144
155
  Scheduler,
156
+ SessionEndReason,
157
+ SessionStartSource,
145
158
  ShellExecutionService,
146
159
  SimpleExtensionLoader,
147
160
  Storage,
148
161
  StreamJsonFormatter,
149
162
  ToolCallEvent,
150
163
  ToolConfirmationOutcome,
164
+ ToolErrorType,
165
+ TrustLevel,
151
166
  UserAccountManager,
152
167
  UserPromptEvent,
153
168
  ValidationCancelledError,
154
169
  ValidationRequiredError,
170
+ WarningPriority,
155
171
  applyAdminAllowlist,
156
172
  applyRequiredServers,
157
173
  clearCachedCredentialFile,
@@ -233,7 +249,7 @@ import {
233
249
  updatePolicy,
234
250
  writeToStderr,
235
251
  writeToStdout
236
- } from "./chunk-4NX72DYK.js";
252
+ } from "./chunk-DB7X2Y2C.js";
237
253
  import "./chunk-664ZODQF.js";
238
254
  import "./chunk-TUDYL3X4.js";
239
255
  import "./chunk-IUUIT4SU.js";
@@ -18204,7 +18220,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
18204
18220
  async function testMCPConnection(serverName, config2, isTrusted, activeSettings) {
18205
18221
  const isStdio = !!config2.command;
18206
18222
  if (isStdio && !isTrusted) {
18207
- return "disconnected" /* DISCONNECTED */;
18223
+ return MCPServerStatus.DISCONNECTED;
18208
18224
  }
18209
18225
  const client = new Client({
18210
18226
  name: "mcp-test-client",
@@ -18240,7 +18256,7 @@ async function testMCPConnection(serverName, config2, isTrusted, activeSettings)
18240
18256
  transport = await createTransport(serverName, config2, false, mcpContext);
18241
18257
  } catch {
18242
18258
  await client.close();
18243
- return "disconnected" /* DISCONNECTED */;
18259
+ return MCPServerStatus.DISCONNECTED;
18244
18260
  }
18245
18261
  try {
18246
18262
  const timeout = config2.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
@@ -18254,10 +18270,10 @@ async function testMCPConnection(serverName, config2, isTrusted, activeSettings)
18254
18270
  );
18255
18271
  }
18256
18272
  await client.close();
18257
- return "connected" /* CONNECTED */;
18273
+ return MCPServerStatus.CONNECTED;
18258
18274
  } catch {
18259
18275
  await transport.close();
18260
- return "disconnected" /* DISCONNECTED */;
18276
+ return MCPServerStatus.DISCONNECTED;
18261
18277
  }
18262
18278
  }
18263
18279
  async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
@@ -18270,12 +18286,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
18270
18286
  });
18271
18287
  if (!loadResult.allowed) {
18272
18288
  if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
18273
- return "blocked" /* BLOCKED */;
18289
+ return MCPServerStatus.BLOCKED;
18274
18290
  }
18275
- return "disabled" /* DISABLED */;
18291
+ return MCPServerStatus.DISABLED;
18276
18292
  }
18277
18293
  if (!isTrusted) {
18278
- return "disabled" /* DISABLED */;
18294
+ return MCPServerStatus.DISABLED;
18279
18295
  }
18280
18296
  return testMCPConnection(serverName, server, isTrusted, activeSettings);
18281
18297
  }
@@ -18321,23 +18337,23 @@ async function listMcpServers(loadedSettingsArg) {
18321
18337
  let statusIndicator = "";
18322
18338
  let statusText = "";
18323
18339
  switch (status) {
18324
- case "connected" /* CONNECTED */:
18340
+ case MCPServerStatus.CONNECTED:
18325
18341
  statusIndicator = import_chalk.default.green("\u2713");
18326
18342
  statusText = "Connected";
18327
18343
  break;
18328
- case "connecting" /* CONNECTING */:
18344
+ case MCPServerStatus.CONNECTING:
18329
18345
  statusIndicator = import_chalk.default.yellow("\u2026");
18330
18346
  statusText = "Connecting";
18331
18347
  break;
18332
- case "blocked" /* BLOCKED */:
18348
+ case MCPServerStatus.BLOCKED:
18333
18349
  statusIndicator = import_chalk.default.red("\u26D4");
18334
18350
  statusText = "Blocked";
18335
18351
  break;
18336
- case "disabled" /* DISABLED */:
18352
+ case MCPServerStatus.DISABLED:
18337
18353
  statusIndicator = import_chalk.default.gray("\u25CB");
18338
18354
  statusText = "Disabled";
18339
18355
  break;
18340
- case "disconnected" /* DISCONNECTED */:
18356
+ case MCPServerStatus.DISCONNECTED:
18341
18357
  default:
18342
18358
  statusIndicator = import_chalk.default.red("\u2717");
18343
18359
  statusText = "Disconnected";
@@ -18623,7 +18639,7 @@ async function handleInstall(args) {
18623
18639
  );
18624
18640
  if (confirmed) {
18625
18641
  const trustedFolders = loadTrustedFolders();
18626
- await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
18642
+ await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
18627
18643
  } else {
18628
18644
  throw new Error(
18629
18645
  `Installation aborted: Folder "${absolutePath}" is not trusted.`
@@ -20668,7 +20684,7 @@ async function loadSandboxConfig(settings, argv) {
20668
20684
  }
20669
20685
  const command2 = getSandboxCommand(sandboxValue);
20670
20686
  const packageJson = await getPackageJson(__dirname3);
20671
- const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.51.0-nightly.20260625.g3fbf93e26" ?? customImage ?? packageJson?.config?.sandboxImageUri;
20687
+ const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.52.0-nightly.20260713.gf354eebaf" ?? customImage ?? packageJson?.config?.sandboxImageUri;
20672
20688
  const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
20673
20689
  return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
20674
20690
  }
@@ -20727,9 +20743,9 @@ async function resolveWorkspacePolicyState(options) {
20727
20743
  cwd,
20728
20744
  potentialWorkspacePoliciesDir
20729
20745
  );
20730
- if (integrityResult.status === "MATCH" /* MATCH */) {
20746
+ if (integrityResult.status === IntegrityStatus.MATCH) {
20731
20747
  workspacePoliciesDir = potentialWorkspacePoliciesDir;
20732
- } else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
20748
+ } else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
20733
20749
  workspacePoliciesDir = void 0;
20734
20750
  } else if (interactive && !autoAcceptWorkspacePolicies) {
20735
20751
  policyUpdateConfirmationRequest = {
@@ -21157,23 +21173,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
21157
21173
  if (rawApprovalMode) {
21158
21174
  switch (rawApprovalMode) {
21159
21175
  case "yolo":
21160
- approvalMode = "yolo" /* YOLO */;
21176
+ approvalMode = ApprovalMode.YOLO;
21161
21177
  break;
21162
21178
  case "auto_edit":
21163
- approvalMode = "autoEdit" /* AUTO_EDIT */;
21179
+ approvalMode = ApprovalMode.AUTO_EDIT;
21164
21180
  break;
21165
21181
  case "plan":
21166
21182
  if (!(settings.general?.plan?.enabled ?? true)) {
21167
21183
  debugLogger.warn(
21168
21184
  'Approval mode "plan" is disabled in your settings. Falling back to "default".'
21169
21185
  );
21170
- approvalMode = "default" /* DEFAULT */;
21186
+ approvalMode = ApprovalMode.DEFAULT;
21171
21187
  } else {
21172
- approvalMode = "plan" /* PLAN */;
21188
+ approvalMode = ApprovalMode.PLAN;
21173
21189
  }
21174
21190
  break;
21175
21191
  case "default":
21176
- approvalMode = "default" /* DEFAULT */;
21192
+ approvalMode = ApprovalMode.DEFAULT;
21177
21193
  break;
21178
21194
  default:
21179
21195
  throw new Error(
@@ -21181,10 +21197,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
21181
21197
  );
21182
21198
  }
21183
21199
  } else {
21184
- approvalMode = "default" /* DEFAULT */;
21200
+ approvalMode = ApprovalMode.DEFAULT;
21185
21201
  }
21186
21202
  if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
21187
- if (approvalMode === "yolo" /* YOLO */) {
21203
+ if (approvalMode === ApprovalMode.YOLO) {
21188
21204
  if (settings.admin?.secureModeEnabled) {
21189
21205
  debugLogger.error(
21190
21206
  'YOLO mode is disabled by "secureModeEnabled" setting.'
@@ -21202,16 +21218,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
21202
21218
  )
21203
21219
  );
21204
21220
  }
21205
- } else if (approvalMode === "yolo" /* YOLO */) {
21221
+ } else if (approvalMode === ApprovalMode.YOLO) {
21206
21222
  debugLogger.warn(
21207
21223
  "YOLO mode is enabled. All tool calls will be automatically approved."
21208
21224
  );
21209
21225
  }
21210
- if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
21226
+ if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
21211
21227
  debugLogger.warn(
21212
21228
  `Approval mode overridden to "default" because the current folder is not trusted.`
21213
21229
  );
21214
- approvalMode = "default" /* DEFAULT */;
21230
+ approvalMode = ApprovalMode.DEFAULT;
21215
21231
  }
21216
21232
  let telemetrySettings;
21217
21233
  try {
@@ -22649,7 +22665,7 @@ import path9 from "node:path";
22649
22665
  import process5 from "node:process";
22650
22666
  var homeDirectoryCheck = {
22651
22667
  id: "home-directory",
22652
- priority: "low" /* Low */,
22668
+ priority: WarningPriority.Low,
22653
22669
  check: async (workspaceRoot, settings) => {
22654
22670
  if (settings.ui?.showHomeDirectoryWarning === false) {
22655
22671
  return null;
@@ -22673,7 +22689,7 @@ var homeDirectoryCheck = {
22673
22689
  };
22674
22690
  var rootDirectoryCheck = {
22675
22691
  id: "root-directory",
22676
- priority: "high" /* High */,
22692
+ priority: WarningPriority.High,
22677
22693
  check: async (workspaceRoot, _settings) => {
22678
22694
  try {
22679
22695
  const workspaceRealPath = await fs9.realpath(workspaceRoot);
@@ -22689,7 +22705,7 @@ var rootDirectoryCheck = {
22689
22705
  };
22690
22706
  var folderTrustCheck = {
22691
22707
  id: "folder-trust",
22692
- priority: "high" /* High */,
22708
+ priority: WarningPriority.High,
22693
22709
  check: async (workspaceRoot, settings) => {
22694
22710
  if (!isFolderTrustEnabled(settings)) {
22695
22711
  return null;
@@ -22879,12 +22895,12 @@ function handleError(error, config2, customErrorCode) {
22879
22895
  error,
22880
22896
  config2.getContentGeneratorConfig()?.authType
22881
22897
  );
22882
- if (config2.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
22898
+ if (config2.getOutputFormat() === OutputFormat.STREAM_JSON) {
22883
22899
  const streamFormatter = new StreamJsonFormatter();
22884
22900
  const errorCode = customErrorCode ?? extractErrorCode(error);
22885
22901
  const metrics = uiTelemetryService.getMetrics();
22886
22902
  streamFormatter.emitEvent({
22887
- type: "result" /* RESULT */,
22903
+ type: JsonStreamEventType.RESULT,
22888
22904
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
22889
22905
  status: "error",
22890
22906
  error: {
@@ -22895,7 +22911,7 @@ function handleError(error, config2, customErrorCode) {
22895
22911
  });
22896
22912
  runSyncCleanup();
22897
22913
  process.exit(getNumericExitCode(errorCode));
22898
- } else if (config2.getOutputFormat() === "json" /* JSON */) {
22914
+ } else if (config2.getOutputFormat() === OutputFormat.JSON) {
22899
22915
  const formatter = new JsonFormatter();
22900
22916
  const errorCode = customErrorCode ?? extractErrorCode(error);
22901
22917
  const formattedError = formatter.formatError(
@@ -22915,11 +22931,11 @@ function handleToolError(toolName, toolError, config2, errorType, resultDisplay)
22915
22931
  const isFatal = isFatalToolError(errorType);
22916
22932
  if (isFatal) {
22917
22933
  const toolExecutionError = new FatalToolExecutionError(errorMessage);
22918
- if (config2.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
22934
+ if (config2.getOutputFormat() === OutputFormat.STREAM_JSON) {
22919
22935
  const streamFormatter = new StreamJsonFormatter();
22920
22936
  const metrics = uiTelemetryService.getMetrics();
22921
22937
  streamFormatter.emitEvent({
22922
- type: "result" /* RESULT */,
22938
+ type: JsonStreamEventType.RESULT,
22923
22939
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
22924
22940
  status: "error",
22925
22941
  error: {
@@ -22928,7 +22944,7 @@ function handleToolError(toolName, toolError, config2, errorType, resultDisplay)
22928
22944
  },
22929
22945
  stats: streamFormatter.convertToStreamStats(metrics, 0)
22930
22946
  });
22931
- } else if (config2.getOutputFormat() === "json" /* JSON */) {
22947
+ } else if (config2.getOutputFormat() === OutputFormat.JSON) {
22932
22948
  const formatter = new JsonFormatter();
22933
22949
  const formattedError = formatter.formatError(
22934
22950
  toolExecutionError,
@@ -22946,11 +22962,11 @@ function handleToolError(toolName, toolError, config2, errorType, resultDisplay)
22946
22962
  }
22947
22963
  function handleCancellationError(config2) {
22948
22964
  const cancellationError = new FatalCancellationError("Operation cancelled.");
22949
- if (config2.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
22965
+ if (config2.getOutputFormat() === OutputFormat.STREAM_JSON) {
22950
22966
  const streamFormatter = new StreamJsonFormatter();
22951
22967
  const metrics = uiTelemetryService.getMetrics();
22952
22968
  streamFormatter.emitEvent({
22953
- type: "result" /* RESULT */,
22969
+ type: JsonStreamEventType.RESULT,
22954
22970
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
22955
22971
  status: "error",
22956
22972
  error: {
@@ -22961,7 +22977,7 @@ function handleCancellationError(config2) {
22961
22977
  });
22962
22978
  runSyncCleanup();
22963
22979
  process.exit(cancellationError.exitCode);
22964
- } else if (config2.getOutputFormat() === "json" /* JSON */) {
22980
+ } else if (config2.getOutputFormat() === OutputFormat.JSON) {
22965
22981
  const formatter = new JsonFormatter();
22966
22982
  const formattedError = formatter.formatError(
22967
22983
  cancellationError,
@@ -22981,11 +22997,11 @@ function handleMaxTurnsExceededError(config2) {
22981
22997
  const maxTurnsError = new FatalTurnLimitedError(
22982
22998
  "Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
22983
22999
  );
22984
- if (config2.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
23000
+ if (config2.getOutputFormat() === OutputFormat.STREAM_JSON) {
22985
23001
  const streamFormatter = new StreamJsonFormatter();
22986
23002
  const metrics = uiTelemetryService.getMetrics();
22987
23003
  streamFormatter.emitEvent({
22988
- type: "result" /* RESULT */,
23004
+ type: JsonStreamEventType.RESULT,
22989
23005
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
22990
23006
  status: "error",
22991
23007
  error: {
@@ -22996,7 +23012,7 @@ function handleMaxTurnsExceededError(config2) {
22996
23012
  });
22997
23013
  runSyncCleanup();
22998
23014
  process.exit(maxTurnsError.exitCode);
22999
- } else if (config2.getOutputFormat() === "json" /* JSON */) {
23015
+ } else if (config2.getOutputFormat() === OutputFormat.JSON) {
23000
23016
  const formatter = new JsonFormatter();
23001
23017
  const formattedError = formatter.formatError(
23002
23018
  maxTurnsError,
@@ -23076,7 +23092,7 @@ async function runNonInteractive({
23076
23092
  }
23077
23093
  });
23078
23094
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
23079
- const { setupInitialActivityLogger } = await import("./devtoolsService-XZY2NAWE.js");
23095
+ const { setupInitialActivityLogger } = await import("./devtoolsService-MG4V53EK.js");
23080
23096
  setupInitialActivityLogger(config2);
23081
23097
  }
23082
23098
  const { stdout: workingStdout } = createWorkingStdio();
@@ -23092,7 +23108,7 @@ async function runNonInteractive({
23092
23108
  }
23093
23109
  };
23094
23110
  const startTime = Date.now();
23095
- const streamFormatter = config2.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
23111
+ const streamFormatter = config2.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
23096
23112
  const abortController = new AbortController();
23097
23113
  let isAborting = false;
23098
23114
  let cancelMessageTimer = null;
@@ -23145,13 +23161,13 @@ async function runNonInteractive({
23145
23161
  };
23146
23162
  try {
23147
23163
  consolePatcher.patch();
23148
- if (config2.getRawOutput() && !config2.getAcceptRawOutputRisk() && config2.getOutputFormat() === "text" /* TEXT */) {
23164
+ if (config2.getRawOutput() && !config2.getAcceptRawOutputRisk() && config2.getOutputFormat() === OutputFormat.TEXT) {
23149
23165
  process.stderr.write(
23150
23166
  "[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"
23151
23167
  );
23152
23168
  }
23153
23169
  setupStdinCancellation();
23154
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
23170
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
23155
23171
  coreEvents.drainBacklogs();
23156
23172
  process.stdout.on("error", (err) => {
23157
23173
  if (err.code === "EPIPE") {
@@ -23177,7 +23193,7 @@ async function runNonInteractive({
23177
23193
  }
23178
23194
  if (streamFormatter) {
23179
23195
  streamFormatter.emitEvent({
23180
- type: "init" /* INIT */,
23196
+ type: JsonStreamEventType.INIT,
23181
23197
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23182
23198
  session_id: config2.getSessionId(),
23183
23199
  model: config2.getModel()
@@ -23215,7 +23231,7 @@ async function runNonInteractive({
23215
23231
  }
23216
23232
  if (streamFormatter) {
23217
23233
  streamFormatter.emitEvent({
23218
- type: "message" /* MESSAGE */,
23234
+ type: JsonStreamEventType.MESSAGE,
23219
23235
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23220
23236
  role: "user",
23221
23237
  content: input
@@ -23254,12 +23270,12 @@ async function runNonInteractive({
23254
23270
  const metrics = uiTelemetryService.getMetrics();
23255
23271
  const durationMs = Date.now() - startTime;
23256
23272
  streamFormatter.emitEvent({
23257
- type: "result" /* RESULT */,
23273
+ type: JsonStreamEventType.RESULT,
23258
23274
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23259
23275
  status: "success",
23260
23276
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
23261
23277
  });
23262
- } else if (config2.getOutputFormat() === "json" /* JSON */) {
23278
+ } else if (config2.getOutputFormat() === OutputFormat.JSON) {
23263
23279
  const formatter = new JsonFormatter();
23264
23280
  const stats = uiTelemetryService.getMetrics();
23265
23281
  textOutput.write(
@@ -23352,13 +23368,13 @@ async function runNonInteractive({
23352
23368
  const output = isRaw ? part.text : stripAnsi(part.text);
23353
23369
  if (streamFormatter) {
23354
23370
  streamFormatter.emitEvent({
23355
- type: "message" /* MESSAGE */,
23371
+ type: JsonStreamEventType.MESSAGE,
23356
23372
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23357
23373
  role: "assistant",
23358
23374
  content: output,
23359
23375
  delta: true
23360
23376
  });
23361
- } else if (config2.getOutputFormat() === "json" /* JSON */) {
23377
+ } else if (config2.getOutputFormat() === OutputFormat.JSON) {
23362
23378
  responseText += output;
23363
23379
  } else {
23364
23380
  if (part.text) {
@@ -23371,13 +23387,13 @@ async function runNonInteractive({
23371
23387
  break;
23372
23388
  }
23373
23389
  case "tool_request": {
23374
- if (config2.getOutputFormat() === "json" /* JSON */) {
23390
+ if (config2.getOutputFormat() === OutputFormat.JSON) {
23375
23391
  preToolResponseText = responseText || preToolResponseText;
23376
23392
  responseText = "";
23377
23393
  }
23378
23394
  if (streamFormatter) {
23379
23395
  streamFormatter.emitEvent({
23380
- type: "tool_use" /* TOOL_USE */,
23396
+ type: JsonStreamEventType.TOOL_USE,
23381
23397
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23382
23398
  tool_name: event.name,
23383
23399
  tool_id: event.requestId,
@@ -23393,7 +23409,7 @@ async function runNonInteractive({
23393
23409
  const displayText = displayContentToString(display);
23394
23410
  const errorMsg = getTextContent(event.content) ?? "Tool error";
23395
23411
  streamFormatter.emitEvent({
23396
- type: "tool_result" /* TOOL_RESULT */,
23412
+ type: JsonStreamEventType.TOOL_RESULT,
23397
23413
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23398
23414
  tool_id: event.requestId,
23399
23415
  status: event.isError ? "error" : "success",
@@ -23408,17 +23424,17 @@ async function runNonInteractive({
23408
23424
  const display = event.display?.result;
23409
23425
  const displayText = displayContentToString(display);
23410
23426
  const errorMsg = getTextContent(event.content) ?? "Tool error";
23411
- if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
23412
- if (config2.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
23427
+ if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
23428
+ if (config2.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
23413
23429
  responseText = preToolResponseText;
23414
23430
  }
23415
23431
  const stopMessage = `Agent execution stopped: ${errorMsg}`;
23416
- if (config2.getOutputFormat() === "text" /* TEXT */) {
23432
+ if (config2.getOutputFormat() === OutputFormat.TEXT) {
23417
23433
  process.stderr.write(`${stopMessage}
23418
23434
  `);
23419
23435
  }
23420
23436
  }
23421
- if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
23437
+ if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
23422
23438
  throw new FatalToolExecutionError(
23423
23439
  "Error executing tool " + event.name + ": " + (displayText || errorMsg)
23424
23440
  );
@@ -23440,12 +23456,12 @@ async function runNonInteractive({
23440
23456
  const errorCode = event._meta?.["code"];
23441
23457
  if (errorCode === "AGENT_EXECUTION_BLOCKED") {
23442
23458
  const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
23443
- if (config2.getOutputFormat() === "text" /* TEXT */) {
23459
+ if (config2.getOutputFormat() === OutputFormat.TEXT) {
23444
23460
  process.stderr.write(`[WARNING] ${blockMessage}
23445
23461
  `);
23446
23462
  } else if (streamFormatter) {
23447
23463
  streamFormatter.emitEvent({
23448
- type: "error" /* ERROR */,
23464
+ type: JsonStreamEventType.ERROR,
23449
23465
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23450
23466
  severity: "warning",
23451
23467
  message: stripAnsi(blockMessage)
@@ -23455,13 +23471,13 @@ async function runNonInteractive({
23455
23471
  break;
23456
23472
  }
23457
23473
  const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
23458
- if (config2.getOutputFormat() === "text" /* TEXT */) {
23474
+ if (config2.getOutputFormat() === OutputFormat.TEXT) {
23459
23475
  process.stderr.write(`[WARNING] ${event.message}
23460
23476
  `);
23461
23477
  }
23462
23478
  if (streamFormatter) {
23463
23479
  streamFormatter.emitEvent({
23464
- type: "error" /* ERROR */,
23480
+ type: JsonStreamEventType.ERROR,
23465
23481
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23466
23482
  severity,
23467
23483
  message: stripAnsi(event.message)
@@ -23481,7 +23497,7 @@ async function runNonInteractive({
23481
23497
  );
23482
23498
  } else if (streamFormatter) {
23483
23499
  streamFormatter.emitEvent({
23484
- type: "error" /* ERROR */,
23500
+ type: JsonStreamEventType.ERROR,
23485
23501
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23486
23502
  severity: "error",
23487
23503
  message: "Maximum session turns exceeded"
@@ -23489,7 +23505,7 @@ async function runNonInteractive({
23489
23505
  }
23490
23506
  }
23491
23507
  const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
23492
- if (stopMessage && config2.getOutputFormat() === "text" /* TEXT */) {
23508
+ if (stopMessage && config2.getOutputFormat() === OutputFormat.TEXT) {
23493
23509
  process.stderr.write(`Agent execution stopped: ${stopMessage}
23494
23510
  `);
23495
23511
  }
@@ -23519,7 +23535,7 @@ async function runNonInteractive({
23519
23535
  abortController.signal.removeEventListener("abort", abortSession);
23520
23536
  scheduler?.dispose();
23521
23537
  consolePatcher.cleanup();
23522
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
23538
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
23523
23539
  }
23524
23540
  if (errorToHandle) {
23525
23541
  handleError(errorToHandle, config2);
@@ -23547,7 +23563,7 @@ async function runNonInteractive2(params) {
23547
23563
  }
23548
23564
  });
23549
23565
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
23550
- const { setupInitialActivityLogger } = await import("./devtoolsService-XZY2NAWE.js");
23566
+ const { setupInitialActivityLogger } = await import("./devtoolsService-MG4V53EK.js");
23551
23567
  setupInitialActivityLogger(config2);
23552
23568
  }
23553
23569
  const { stdout: workingStdout } = createWorkingStdio();
@@ -23563,7 +23579,7 @@ async function runNonInteractive2(params) {
23563
23579
  }
23564
23580
  };
23565
23581
  const startTime = Date.now();
23566
- const streamFormatter = config2.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
23582
+ const streamFormatter = config2.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
23567
23583
  const abortController = new AbortController();
23568
23584
  let isAborting = false;
23569
23585
  let cancelMessageTimer = null;
@@ -23614,13 +23630,13 @@ async function runNonInteractive2(params) {
23614
23630
  let scheduler;
23615
23631
  try {
23616
23632
  consolePatcher.patch();
23617
- if (config2.getRawOutput() && !config2.getAcceptRawOutputRisk() && config2.getOutputFormat() === "text" /* TEXT */) {
23633
+ if (config2.getRawOutput() && !config2.getAcceptRawOutputRisk() && config2.getOutputFormat() === OutputFormat.TEXT) {
23618
23634
  process.stderr.write(
23619
23635
  "[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"
23620
23636
  );
23621
23637
  }
23622
23638
  setupStdinCancellation();
23623
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
23639
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
23624
23640
  coreEvents.drainBacklogs();
23625
23641
  process.stdout.on("error", (err) => {
23626
23642
  if (err.code === "EPIPE") {
@@ -23644,7 +23660,7 @@ async function runNonInteractive2(params) {
23644
23660
  }
23645
23661
  if (streamFormatter) {
23646
23662
  streamFormatter.emitEvent({
23647
- type: "init" /* INIT */,
23663
+ type: JsonStreamEventType.INIT,
23648
23664
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23649
23665
  session_id: config2.getSessionId(),
23650
23666
  model: config2.getModel()
@@ -23682,7 +23698,7 @@ async function runNonInteractive2(params) {
23682
23698
  }
23683
23699
  if (streamFormatter) {
23684
23700
  streamFormatter.emitEvent({
23685
- type: "message" /* MESSAGE */,
23701
+ type: JsonStreamEventType.MESSAGE,
23686
23702
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23687
23703
  role: "user",
23688
23704
  content: input
@@ -23710,28 +23726,28 @@ async function runNonInteractive2(params) {
23710
23726
  if (abortController.signal.aborted) {
23711
23727
  handleCancellationError(config2);
23712
23728
  }
23713
- if (event.type === "content" /* Content */) {
23729
+ if (event.type === GeminiEventType.Content) {
23714
23730
  const isRaw = config2.getRawOutput() || config2.getAcceptRawOutputRisk();
23715
23731
  const output = isRaw ? event.value : stripAnsi(event.value);
23716
23732
  if (streamFormatter) {
23717
23733
  streamFormatter.emitEvent({
23718
- type: "message" /* MESSAGE */,
23734
+ type: JsonStreamEventType.MESSAGE,
23719
23735
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23720
23736
  role: "assistant",
23721
23737
  content: output,
23722
23738
  delta: true
23723
23739
  });
23724
- } else if (config2.getOutputFormat() === "json" /* JSON */) {
23740
+ } else if (config2.getOutputFormat() === OutputFormat.JSON) {
23725
23741
  responseText += output;
23726
23742
  } else {
23727
23743
  if (event.value) {
23728
23744
  textOutput.write(output);
23729
23745
  }
23730
23746
  }
23731
- } else if (event.type === "tool_call_request" /* ToolCallRequest */) {
23747
+ } else if (event.type === GeminiEventType.ToolCallRequest) {
23732
23748
  if (streamFormatter) {
23733
23749
  streamFormatter.emitEvent({
23734
- type: "tool_use" /* TOOL_USE */,
23750
+ type: JsonStreamEventType.TOOL_USE,
23735
23751
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23736
23752
  tool_name: event.value.name,
23737
23753
  tool_id: event.value.callId,
@@ -23739,33 +23755,33 @@ async function runNonInteractive2(params) {
23739
23755
  });
23740
23756
  }
23741
23757
  toolCallRequests.push(event.value);
23742
- } else if (event.type === "loop_detected" /* LoopDetected */) {
23758
+ } else if (event.type === GeminiEventType.LoopDetected) {
23743
23759
  const message = "Loop detected, stopping execution";
23744
23760
  if (streamFormatter) {
23745
23761
  streamFormatter.emitEvent({
23746
- type: "error" /* ERROR */,
23762
+ type: JsonStreamEventType.ERROR,
23747
23763
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23748
23764
  severity: "warning",
23749
23765
  message
23750
23766
  });
23751
23767
  }
23752
23768
  warnings.push(message);
23753
- } else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
23769
+ } else if (event.type === GeminiEventType.MaxSessionTurns) {
23754
23770
  const message = "Maximum session turns exceeded";
23755
23771
  if (streamFormatter) {
23756
23772
  streamFormatter.emitEvent({
23757
- type: "error" /* ERROR */,
23773
+ type: JsonStreamEventType.ERROR,
23758
23774
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23759
23775
  severity: "error",
23760
23776
  message
23761
23777
  });
23762
23778
  }
23763
23779
  warnings.push(message);
23764
- } else if (event.type === "error" /* Error */) {
23780
+ } else if (event.type === GeminiEventType.Error) {
23765
23781
  throw event.value.error;
23766
- } else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
23782
+ } else if (event.type === GeminiEventType.AgentExecutionStopped) {
23767
23783
  const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
23768
- if (config2.getOutputFormat() === "text" /* TEXT */) {
23784
+ if (config2.getOutputFormat() === OutputFormat.TEXT) {
23769
23785
  process.stderr.write(`${stopMessage}
23770
23786
  `);
23771
23787
  }
@@ -23773,7 +23789,7 @@ async function runNonInteractive2(params) {
23773
23789
  const metrics = uiTelemetryService.getMetrics();
23774
23790
  const durationMs = Date.now() - startTime;
23775
23791
  streamFormatter.emitEvent({
23776
- type: "result" /* RESULT */,
23792
+ type: JsonStreamEventType.RESULT,
23777
23793
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23778
23794
  status: "success",
23779
23795
  stats: streamFormatter.convertToStreamStats(
@@ -23781,7 +23797,7 @@ async function runNonInteractive2(params) {
23781
23797
  durationMs
23782
23798
  )
23783
23799
  });
23784
- } else if (config2.getOutputFormat() === "json" /* JSON */) {
23800
+ } else if (config2.getOutputFormat() === OutputFormat.JSON) {
23785
23801
  const formatter = new JsonFormatter();
23786
23802
  const stats = uiTelemetryService.getMetrics();
23787
23803
  textOutput.write(
@@ -23797,30 +23813,30 @@ async function runNonInteractive2(params) {
23797
23813
  textOutput.ensureTrailingNewline();
23798
23814
  }
23799
23815
  return;
23800
- } else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
23816
+ } else if (event.type === GeminiEventType.AgentExecutionBlocked) {
23801
23817
  const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
23802
- if (config2.getOutputFormat() === "text" /* TEXT */) {
23818
+ if (config2.getOutputFormat() === OutputFormat.TEXT) {
23803
23819
  process.stderr.write(`[WARNING] ${blockMessage}
23804
23820
  `);
23805
23821
  } else if (streamFormatter) {
23806
23822
  streamFormatter.emitEvent({
23807
- type: "error" /* ERROR */,
23823
+ type: JsonStreamEventType.ERROR,
23808
23824
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23809
23825
  severity: "warning",
23810
23826
  message: stripAnsi(blockMessage)
23811
23827
  });
23812
23828
  }
23813
23829
  warnings.push(blockMessage);
23814
- } else if (event.type === "invalid_stream" /* InvalidStream */) {
23830
+ } else if (event.type === GeminiEventType.InvalidStream) {
23815
23831
  invalidStreamError = "Invalid stream: The model returned an empty response or malformed tool call.";
23816
23832
  if (streamFormatter) {
23817
23833
  streamFormatter.emitEvent({
23818
- type: "error" /* ERROR */,
23834
+ type: JsonStreamEventType.ERROR,
23819
23835
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23820
23836
  severity: "error",
23821
23837
  message: invalidStreamError
23822
23838
  });
23823
- } else if (config2.getOutputFormat() === "text" /* TEXT */) {
23839
+ } else if (config2.getOutputFormat() === OutputFormat.TEXT) {
23824
23840
  process.stderr.write(`[ERROR] ${invalidStreamError}
23825
23841
  `);
23826
23842
  }
@@ -23840,7 +23856,7 @@ async function runNonInteractive2(params) {
23840
23856
  const requestInfo = completedToolCall.request;
23841
23857
  if (streamFormatter) {
23842
23858
  streamFormatter.emitEvent({
23843
- type: "tool_result" /* TOOL_RESULT */,
23859
+ type: JsonStreamEventType.TOOL_RESULT,
23844
23860
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23845
23861
  tool_id: requestInfo.callId,
23846
23862
  status: completedToolCall.status === "error" ? "error" : "success",
@@ -23874,11 +23890,11 @@ async function runNonInteractive2(params) {
23874
23890
  );
23875
23891
  }
23876
23892
  const stopExecutionTool = completedToolCalls.find(
23877
- (tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
23893
+ (tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
23878
23894
  );
23879
23895
  if (stopExecutionTool && stopExecutionTool.response.error) {
23880
23896
  const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
23881
- if (config2.getOutputFormat() === "text" /* TEXT */) {
23897
+ if (config2.getOutputFormat() === OutputFormat.TEXT) {
23882
23898
  process.stderr.write(`${stopMessage}
23883
23899
  `);
23884
23900
  }
@@ -23886,7 +23902,7 @@ async function runNonInteractive2(params) {
23886
23902
  const metrics = uiTelemetryService.getMetrics();
23887
23903
  const durationMs = Date.now() - startTime;
23888
23904
  streamFormatter.emitEvent({
23889
- type: "result" /* RESULT */,
23905
+ type: JsonStreamEventType.RESULT,
23890
23906
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23891
23907
  status: "success",
23892
23908
  stats: streamFormatter.convertToStreamStats(
@@ -23894,7 +23910,7 @@ async function runNonInteractive2(params) {
23894
23910
  durationMs
23895
23911
  )
23896
23912
  });
23897
- } else if (config2.getOutputFormat() === "json" /* JSON */) {
23913
+ } else if (config2.getOutputFormat() === OutputFormat.JSON) {
23898
23914
  const formatter = new JsonFormatter();
23899
23915
  const stats = uiTelemetryService.getMetrics();
23900
23916
  textOutput.write(
@@ -23917,12 +23933,12 @@ async function runNonInteractive2(params) {
23917
23933
  const metrics = uiTelemetryService.getMetrics();
23918
23934
  const durationMs = Date.now() - startTime;
23919
23935
  streamFormatter.emitEvent({
23920
- type: "result" /* RESULT */,
23936
+ type: JsonStreamEventType.RESULT,
23921
23937
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23922
23938
  status: invalidStreamError ? "error" : "success",
23923
23939
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
23924
23940
  });
23925
- } else if (config2.getOutputFormat() === "json" /* JSON */) {
23941
+ } else if (config2.getOutputFormat() === OutputFormat.JSON) {
23926
23942
  const formatter = new JsonFormatter();
23927
23943
  const stats = uiTelemetryService.getMetrics();
23928
23944
  textOutput.write(
@@ -23946,7 +23962,7 @@ async function runNonInteractive2(params) {
23946
23962
  cleanupStdinCancellation();
23947
23963
  scheduler?.dispose();
23948
23964
  consolePatcher.cleanup();
23949
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
23965
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
23950
23966
  }
23951
23967
  if (errorToHandle) {
23952
23968
  handleError(errorToHandle, config2);
@@ -26337,12 +26353,12 @@ function toToolCallContent(toolResult) {
26337
26353
  }
26338
26354
  var basicPermissionOptions = [
26339
26355
  {
26340
- optionId: "proceed_once" /* ProceedOnce */,
26356
+ optionId: ToolConfirmationOutcome.ProceedOnce,
26341
26357
  name: "Allow",
26342
26358
  kind: "allow_once"
26343
26359
  },
26344
26360
  {
26345
- optionId: "cancel" /* Cancel */,
26361
+ optionId: ToolConfirmationOutcome.Cancel,
26346
26362
  name: "Reject",
26347
26363
  kind: "reject_once"
26348
26364
  }
@@ -26354,13 +26370,13 @@ function toPermissionOptions(confirmation, config2, enablePermanentToolApproval
26354
26370
  switch (confirmation.type) {
26355
26371
  case "edit":
26356
26372
  options.push({
26357
- optionId: "proceed_always" /* ProceedAlways */,
26373
+ optionId: ToolConfirmationOutcome.ProceedAlways,
26358
26374
  name: "Allow for this session",
26359
26375
  kind: "allow_always"
26360
26376
  });
26361
26377
  if (enablePermanentToolApproval) {
26362
26378
  options.push({
26363
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
26379
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
26364
26380
  name: "Allow for this file in all future sessions",
26365
26381
  kind: "allow_always"
26366
26382
  });
@@ -26368,13 +26384,13 @@ function toPermissionOptions(confirmation, config2, enablePermanentToolApproval
26368
26384
  break;
26369
26385
  case "exec":
26370
26386
  options.push({
26371
- optionId: "proceed_always" /* ProceedAlways */,
26387
+ optionId: ToolConfirmationOutcome.ProceedAlways,
26372
26388
  name: "Allow for this session",
26373
26389
  kind: "allow_always"
26374
26390
  });
26375
26391
  if (enablePermanentToolApproval) {
26376
26392
  options.push({
26377
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
26393
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
26378
26394
  name: "Allow this command for all future sessions",
26379
26395
  kind: "allow_always"
26380
26396
  });
@@ -26383,19 +26399,19 @@ function toPermissionOptions(confirmation, config2, enablePermanentToolApproval
26383
26399
  case "mcp":
26384
26400
  options.push(
26385
26401
  {
26386
- optionId: "proceed_always_server" /* ProceedAlwaysServer */,
26402
+ optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
26387
26403
  name: "Allow all server tools for this session",
26388
26404
  kind: "allow_always"
26389
26405
  },
26390
26406
  {
26391
- optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
26407
+ optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
26392
26408
  name: "Allow tool for this session",
26393
26409
  kind: "allow_always"
26394
26410
  }
26395
26411
  );
26396
26412
  if (enablePermanentToolApproval) {
26397
26413
  options.push({
26398
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
26414
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
26399
26415
  name: "Allow tool for all future sessions",
26400
26416
  kind: "allow_always"
26401
26417
  });
@@ -26403,13 +26419,13 @@ function toPermissionOptions(confirmation, config2, enablePermanentToolApproval
26403
26419
  break;
26404
26420
  case "info":
26405
26421
  options.push({
26406
- optionId: "proceed_always" /* ProceedAlways */,
26422
+ optionId: ToolConfirmationOutcome.ProceedAlways,
26407
26423
  name: "Allow for this session",
26408
26424
  kind: "allow_always"
26409
26425
  });
26410
26426
  if (enablePermanentToolApproval) {
26411
26427
  options.push({
26412
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
26428
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
26413
26429
  name: "Allow for all future sessions",
26414
26430
  kind: "allow_always"
26415
26431
  });
@@ -26441,21 +26457,21 @@ function toPermissionOptions(confirmation, config2, enablePermanentToolApproval
26441
26457
  }
26442
26458
  function toAcpToolKind(kind) {
26443
26459
  switch (kind) {
26444
- case "read" /* Read */:
26445
- case "edit" /* Edit */:
26446
- case "execute" /* Execute */:
26447
- case "search" /* Search */:
26448
- case "delete" /* Delete */:
26449
- case "move" /* Move */:
26450
- case "think" /* Think */:
26451
- case "fetch" /* Fetch */:
26452
- case "switch_mode" /* SwitchMode */:
26453
- case "other" /* Other */:
26460
+ case Kind.Read:
26461
+ case Kind.Edit:
26462
+ case Kind.Execute:
26463
+ case Kind.Search:
26464
+ case Kind.Delete:
26465
+ case Kind.Move:
26466
+ case Kind.Think:
26467
+ case Kind.Fetch:
26468
+ case Kind.SwitchMode:
26469
+ case Kind.Other:
26454
26470
  return kind;
26455
- case "agent" /* Agent */:
26471
+ case Kind.Agent:
26456
26472
  return "think";
26457
- case "plan" /* Plan */:
26458
- case "communicate" /* Communicate */:
26473
+ case Kind.Plan:
26474
+ case Kind.Communicate:
26459
26475
  default:
26460
26476
  return "other";
26461
26477
  }
@@ -26463,24 +26479,24 @@ function toAcpToolKind(kind) {
26463
26479
  function buildAvailableModes(isPlanEnabled) {
26464
26480
  const modes = [
26465
26481
  {
26466
- id: "default" /* DEFAULT */,
26482
+ id: ApprovalMode.DEFAULT,
26467
26483
  name: "Default",
26468
26484
  description: "Prompts for approval"
26469
26485
  },
26470
26486
  {
26471
- id: "autoEdit" /* AUTO_EDIT */,
26487
+ id: ApprovalMode.AUTO_EDIT,
26472
26488
  name: "Auto Edit",
26473
26489
  description: "Auto-approves edit tools"
26474
26490
  },
26475
26491
  {
26476
- id: "yolo" /* YOLO */,
26492
+ id: ApprovalMode.YOLO,
26477
26493
  name: "YOLO",
26478
26494
  description: "Auto-approves all tools"
26479
26495
  }
26480
26496
  ];
26481
26497
  if (isPlanEnabled) {
26482
26498
  modes.push({
26483
- id: "plan" /* PLAN */,
26499
+ id: ApprovalMode.PLAN,
26484
26500
  name: "Plan",
26485
26501
  description: "Read-only mode"
26486
26502
  });
@@ -26493,7 +26509,7 @@ function buildAvailableModels(config2, settings) {
26493
26509
  const useGemini31 = config2.getGemini31LaunchedSync?.() ?? false;
26494
26510
  const useGemini3_5Flash = config2.hasGemini35FlashGAAccess?.() ?? false;
26495
26511
  const selectedAuthType = settings.merged.security.auth.selectedType;
26496
- const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
26512
+ const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
26497
26513
  if (config2.getExperimentalDynamicModelConfiguration?.() === true && config2.getModelConfigService) {
26498
26514
  const options = config2.getModelConfigService().getAvailableModelOptions({
26499
26515
  useGemini3_1: useGemini31,
@@ -26579,11 +26595,11 @@ var Session = class {
26579
26595
  this.connection = connection;
26580
26596
  this.settings = settings;
26581
26597
  coreEvents.on(
26582
- "approval-mode-changed" /* ApprovalModeChanged */,
26598
+ CoreEvent.ApprovalModeChanged,
26583
26599
  this.handleApprovalModeChanged
26584
26600
  );
26585
26601
  this.context.config.getMessageBus()?.subscribe(
26586
- "tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
26602
+ MessageBusType.TOOL_CONFIRMATION_REQUEST,
26587
26603
  this.handleToolConfirmationRequest,
26588
26604
  { signal: this.disposeController.signal }
26589
26605
  );
@@ -26607,7 +26623,7 @@ var Session = class {
26607
26623
  "Policy engine missing. Denying tool confirmation request."
26608
26624
  );
26609
26625
  await messageBus.publish({
26610
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
26626
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
26611
26627
  correlationId: request.correlationId,
26612
26628
  confirmed: false,
26613
26629
  requiresUserConfirmation: false
@@ -26620,7 +26636,7 @@ var Session = class {
26620
26636
  "Tool confirmation request missing tool name. Denying."
26621
26637
  );
26622
26638
  await messageBus.publish({
26623
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
26639
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
26624
26640
  correlationId: request.correlationId,
26625
26641
  confirmed: false,
26626
26642
  requiresUserConfirmation: false
@@ -26633,7 +26649,7 @@ var Session = class {
26633
26649
  `Tool confirmation request for unknown tool: ${toolName}. Denying.`
26634
26650
  );
26635
26651
  await messageBus.publish({
26636
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
26652
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
26637
26653
  correlationId: request.correlationId,
26638
26654
  confirmed: false,
26639
26655
  requiresUserConfirmation: false
@@ -26649,15 +26665,15 @@ var Session = class {
26649
26665
  request.subagent
26650
26666
  );
26651
26667
  await messageBus.publish({
26652
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
26668
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
26653
26669
  correlationId: request.correlationId,
26654
- confirmed: result.decision === "allow" /* ALLOW */,
26655
- requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
26670
+ confirmed: result.decision === PolicyDecision.ALLOW,
26671
+ requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
26656
26672
  });
26657
26673
  } catch (error) {
26658
26674
  debugLogger.error("Error handling tool confirmation request:", error);
26659
26675
  await this.context.config.getMessageBus()?.publish({
26660
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
26676
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
26661
26677
  correlationId: request.correlationId,
26662
26678
  confirmed: false,
26663
26679
  requiresUserConfirmation: false
@@ -26677,7 +26693,7 @@ var Session = class {
26677
26693
  };
26678
26694
  dispose() {
26679
26695
  coreEvents.off(
26680
- "approval-mode-changed" /* ApprovalModeChanged */,
26696
+ CoreEvent.ApprovalModeChanged,
26681
26697
  this.handleApprovalModeChanged
26682
26698
  );
26683
26699
  this.disposeController.abort();
@@ -26766,7 +26782,7 @@ ${thought.description}`;
26766
26782
  await this.sendUpdate({
26767
26783
  sessionUpdate: "tool_call",
26768
26784
  toolCallId: toolCall.id,
26769
- status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
26785
+ status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
26770
26786
  title: toolCall.displayName || toolCall.name,
26771
26787
  content: toolCallContent,
26772
26788
  kind: tool ? toAcpToolKind(tool.kind) : "other"
@@ -26858,7 +26874,7 @@ ${thought.description}`;
26858
26874
  return { stopReason: "cancelled" };
26859
26875
  }
26860
26876
  switch (event.type) {
26861
- case "content" /* Content */: {
26877
+ case GeminiEventType.Content: {
26862
26878
  const content = {
26863
26879
  type: "text",
26864
26880
  text: event.value
@@ -26869,7 +26885,7 @@ ${thought.description}`;
26869
26885
  });
26870
26886
  break;
26871
26887
  }
26872
- case "thought" /* Thought */: {
26888
+ case GeminiEventType.Thought: {
26873
26889
  const thoughtText = `**${event.value.subject}**
26874
26890
  ${event.value.description}`;
26875
26891
  await this.sendUpdate({
@@ -26878,10 +26894,10 @@ ${event.value.description}`;
26878
26894
  });
26879
26895
  break;
26880
26896
  }
26881
- case "tool_call_request" /* ToolCallRequest */:
26897
+ case GeminiEventType.ToolCallRequest:
26882
26898
  toolCallRequests.push(event.value);
26883
26899
  break;
26884
- case "finished" /* Finished */: {
26900
+ case GeminiEventType.Finished: {
26885
26901
  const usage2 = event.value.usageMetadata;
26886
26902
  if (usage2) {
26887
26903
  turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
@@ -26889,19 +26905,19 @@ ${event.value.description}`;
26889
26905
  }
26890
26906
  break;
26891
26907
  }
26892
- case "model_info" /* ModelInfo */:
26908
+ case GeminiEventType.ModelInfo:
26893
26909
  turnModelId = event.value;
26894
26910
  break;
26895
- case "max_session_turns" /* MaxSessionTurns */:
26911
+ case GeminiEventType.MaxSessionTurns:
26896
26912
  stopReason = "max_turn_requests";
26897
26913
  break;
26898
- case "loop_detected" /* LoopDetected */:
26914
+ case GeminiEventType.LoopDetected:
26899
26915
  stopReason = "max_turn_requests";
26900
26916
  break;
26901
- case "context_window_will_overflow" /* ContextWindowWillOverflow */:
26917
+ case GeminiEventType.ContextWindowWillOverflow:
26902
26918
  stopReason = "max_tokens";
26903
26919
  break;
26904
- case "error" /* Error */: {
26920
+ case GeminiEventType.Error: {
26905
26921
  const parseResult = StructuredErrorSchema.safeParse(
26906
26922
  event.value.error
26907
26923
  );
@@ -27129,7 +27145,7 @@ ${event.value.description}`;
27129
27145
  const output = RequestPermissionResponseSchema.parse(
27130
27146
  await this.connection.requestPermission(params)
27131
27147
  );
27132
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
27148
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
27133
27149
  await confirmationDetails.onConfirm(outcome);
27134
27150
  await updatePolicy(
27135
27151
  tool,
@@ -27140,16 +27156,16 @@ ${event.value.description}`;
27140
27156
  invocation
27141
27157
  );
27142
27158
  switch (outcome) {
27143
- case "cancel" /* Cancel */:
27159
+ case ToolConfirmationOutcome.Cancel:
27144
27160
  return errorResponse(
27145
27161
  new Error(`Tool "${fc.name}" was canceled by the user.`)
27146
27162
  );
27147
- case "proceed_once" /* ProceedOnce */:
27148
- case "proceed_always" /* ProceedAlways */:
27149
- case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
27150
- case "proceed_always_server" /* ProceedAlwaysServer */:
27151
- case "proceed_always_tool" /* ProceedAlwaysTool */:
27152
- case "modify_with_editor" /* ModifyWithEditor */:
27163
+ case ToolConfirmationOutcome.ProceedOnce:
27164
+ case ToolConfirmationOutcome.ProceedAlways:
27165
+ case ToolConfirmationOutcome.ProceedAlwaysAndSave:
27166
+ case ToolConfirmationOutcome.ProceedAlwaysServer:
27167
+ case ToolConfirmationOutcome.ProceedAlwaysTool:
27168
+ case ToolConfirmationOutcome.ModifyWithEditor:
27153
27169
  break;
27154
27170
  default: {
27155
27171
  const resultOutcome = outcome;
@@ -27203,7 +27219,7 @@ ${event.value.description}`;
27203
27219
  );
27204
27220
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
27205
27221
  {
27206
- status: "success" /* Success */,
27222
+ status: CoreToolCallStatus.Success,
27207
27223
  request: {
27208
27224
  callId,
27209
27225
  name: fc.name,
@@ -27248,7 +27264,7 @@ ${event.value.description}`;
27248
27264
  });
27249
27265
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
27250
27266
  {
27251
- status: "error" /* Error */,
27267
+ status: CoreToolCallStatus.Error,
27252
27268
  request: {
27253
27269
  callId,
27254
27270
  name: fc.name,
@@ -27376,12 +27392,12 @@ ${event.value.description}`;
27376
27392
  sessionId: this.id,
27377
27393
  options: [
27378
27394
  {
27379
- optionId: "proceed_once" /* ProceedOnce */,
27395
+ optionId: ToolConfirmationOutcome.ProceedOnce,
27380
27396
  name: "Allow once",
27381
27397
  kind: "allow_once"
27382
27398
  },
27383
27399
  {
27384
- optionId: "cancel" /* Cancel */,
27400
+ optionId: ToolConfirmationOutcome.Cancel,
27385
27401
  name: "Deny",
27386
27402
  kind: "reject_once"
27387
27403
  }
@@ -27406,8 +27422,8 @@ ${event.value.description}`;
27406
27422
  const output = RequestPermissionResponseSchema.parse(
27407
27423
  await this.connection.requestPermission(params)
27408
27424
  );
27409
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
27410
- if (outcome === "proceed_once" /* ProceedOnce */) {
27425
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
27426
+ if (outcome === ToolConfirmationOutcome.ProceedOnce) {
27411
27427
  this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
27412
27428
  validationError = null;
27413
27429
  } else {
@@ -27844,7 +27860,7 @@ var AcpSessionManager = class {
27844
27860
  mcpServers,
27845
27861
  loadedSettings
27846
27862
  );
27847
- const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
27863
+ const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
27848
27864
  let isAuthenticated = false;
27849
27865
  let authErrorMessage = "";
27850
27866
  try {
@@ -27856,7 +27872,7 @@ var AcpSessionManager = class {
27856
27872
  );
27857
27873
  isAuthenticated = true;
27858
27874
  const contentGeneratorConfig = config2.getContentGeneratorConfig();
27859
- if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
27875
+ if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
27860
27876
  isAuthenticated = false;
27861
27877
  authErrorMessage = "Gemini API key is missing or not configured.";
27862
27878
  }
@@ -27965,7 +27981,7 @@ var AcpSessionManager = class {
27965
27981
  return response;
27966
27982
  }
27967
27983
  async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
27968
- const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
27984
+ const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
27969
27985
  if (!selectedAuthType) {
27970
27986
  throw RequestError.authRequired();
27971
27987
  }
@@ -28066,12 +28082,12 @@ var GeminiAgent = class {
28066
28082
  }
28067
28083
  const authMethods = [
28068
28084
  {
28069
- id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
28085
+ id: AuthType.LOGIN_WITH_GOOGLE,
28070
28086
  name: "Log in with Google",
28071
28087
  description: "Log in with your Google account"
28072
28088
  },
28073
28089
  {
28074
- id: "gemini-api-key" /* USE_GEMINI */,
28090
+ id: AuthType.USE_GEMINI,
28075
28091
  name: "Gemini API key",
28076
28092
  description: "Use an API key with Gemini Developer API",
28077
28093
  _meta: {
@@ -28081,12 +28097,12 @@ var GeminiAgent = class {
28081
28097
  }
28082
28098
  },
28083
28099
  {
28084
- id: "vertex-ai" /* USE_VERTEX_AI */,
28100
+ id: AuthType.USE_VERTEX_AI,
28085
28101
  name: "Vertex AI",
28086
28102
  description: "Use an API key with Vertex AI GenAI API"
28087
28103
  },
28088
28104
  {
28089
- id: "gateway" /* GATEWAY */,
28105
+ id: AuthType.GATEWAY,
28090
28106
  name: "AI API Gateway",
28091
28107
  description: "Use a custom AI API Gateway",
28092
28108
  _meta: {
@@ -28259,7 +28275,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
28259
28275
  }
28260
28276
  return authType;
28261
28277
  } catch (error) {
28262
- if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
28278
+ if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
28263
28279
  handleError(
28264
28280
  error instanceof Error ? error : new Error(String(error)),
28265
28281
  nonInteractiveConfig,
@@ -28454,10 +28470,10 @@ var SlashCommandConflictHandler = class {
28454
28470
  this.handleConflicts = this.handleConflicts.bind(this);
28455
28471
  }
28456
28472
  start() {
28457
- coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
28473
+ coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
28458
28474
  }
28459
28475
  stop() {
28460
- coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
28476
+ coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
28461
28477
  if (this.flushTimeout) {
28462
28478
  clearTimeout(this.flushTimeout);
28463
28479
  this.flushTimeout = null;
@@ -28738,7 +28754,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
28738
28754
  }
28739
28755
  }
28740
28756
  async function startInteractiveUI(config2, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
28741
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-642BSKOD.js");
28757
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-GSUQ3DVQ.js");
28742
28758
  await doStartUI(
28743
28759
  config2,
28744
28760
  settings,
@@ -28841,12 +28857,12 @@ async function main() {
28841
28857
  dns.setDefaultResultOrder(
28842
28858
  validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
28843
28859
  );
28844
- if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
28860
+ if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
28845
28861
  if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
28846
28862
  settings.setValue(
28847
28863
  "User" /* User */,
28848
28864
  "security.auth.selectedType",
28849
- "compute-default-credentials" /* COMPUTE_ADC */
28865
+ AuthType.COMPUTE_ADC
28850
28866
  );
28851
28867
  }
28852
28868
  }
@@ -28947,7 +28963,7 @@ ${finalArgs[promptIndex + 1]}`;
28947
28963
  await config2.storage.initialize();
28948
28964
  adminControlsListner.setConfig(config2);
28949
28965
  if (config2.isInteractive() && settings.merged.general.devtools) {
28950
- const { setupInitialActivityLogger } = await import("./devtoolsService-XZY2NAWE.js");
28966
+ const { setupInitialActivityLogger } = await import("./devtoolsService-MG4V53EK.js");
28951
28967
  setupInitialActivityLogger(config2);
28952
28968
  }
28953
28969
  registerTelemetryConfig(config2);
@@ -28955,7 +28971,7 @@ ${finalArgs[promptIndex + 1]}`;
28955
28971
  const messageBus = config2.getMessageBus();
28956
28972
  createPolicyUpdater2(policyEngine, messageBus, config2.storage);
28957
28973
  registerCleanup(async () => {
28958
- await config2?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
28974
+ await config2?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
28959
28975
  });
28960
28976
  if (!config2.getAcpMode()) {
28961
28977
  registerCleanup(consolePatcher.cleanup);
@@ -29006,7 +29022,7 @@ ${finalArgs[promptIndex + 1]}`;
29006
29022
  const initAppHandle = startupProfiler.start("initialize_app");
29007
29023
  const initializationResult = await initializeApp(config2, settings);
29008
29024
  initAppHandle?.end();
29009
- import("./liteRtServerManager-6DL4RPYQ.js").then(({ LiteRtServerManager }) => {
29025
+ import("./liteRtServerManager-NIEOMPFD.js").then(({ LiteRtServerManager }) => {
29010
29026
  const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
29011
29027
  if (!mergedGemma) return;
29012
29028
  const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
@@ -29016,7 +29032,7 @@ ${finalArgs[promptIndex + 1]}`;
29016
29032
  autoStartServer: userGemma?.autoStartServer
29017
29033
  });
29018
29034
  }).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
29019
- if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config2.isBrowserLaunchSuppressed()) {
29035
+ if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config2.isBrowserLaunchSuppressed()) {
29020
29036
  await getOauthClient(settings.merged.security.auth.selectedType, config2);
29021
29037
  }
29022
29038
  if (config2.getAcpMode()) {
@@ -29032,7 +29048,7 @@ ${finalArgs[promptIndex + 1]}`;
29032
29048
  ...rawStartupWarnings.map((message) => ({
29033
29049
  id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
29034
29050
  message,
29035
- priority: "high" /* High */
29051
+ priority: WarningPriority.High
29036
29052
  })),
29037
29053
  ...await getUserStartupWarnings(settings.merged, void 0, {
29038
29054
  isAlternateBuffer: useAlternateBuffer
@@ -29069,7 +29085,7 @@ ${finalArgs[promptIndex + 1]}`;
29069
29085
  ${input}` : stdinData;
29070
29086
  }
29071
29087
  }
29072
- const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
29088
+ const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
29073
29089
  const hookSystem = config2?.getHookSystem();
29074
29090
  if (hookSystem) {
29075
29091
  const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
@@ -29126,8 +29142,8 @@ ${input}` : wrappedContext;
29126
29142
  }
29127
29143
  }
29128
29144
  function initializeOutputListenersAndFlush(config2) {
29129
- if (coreEvents.listenerCount("output" /* Output */) === 0) {
29130
- coreEvents.on("output" /* Output */, (payload) => {
29145
+ if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
29146
+ coreEvents.on(CoreEvent.Output, (payload) => {
29131
29147
  if (payload.isStderr) {
29132
29148
  writeToStderr(payload.chunk, payload.encoding);
29133
29149
  } else {
@@ -29135,8 +29151,8 @@ function initializeOutputListenersAndFlush(config2) {
29135
29151
  }
29136
29152
  });
29137
29153
  }
29138
- if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
29139
- coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
29154
+ if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
29155
+ coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
29140
29156
  if (payload.type === "error" || payload.type === "warn") {
29141
29157
  writeToStderr(payload.content + "\n");
29142
29158
  } else {
@@ -29144,8 +29160,8 @@ function initializeOutputListenersAndFlush(config2) {
29144
29160
  }
29145
29161
  });
29146
29162
  }
29147
- if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
29148
- coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
29163
+ if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
29164
+ coreEvents.on(CoreEvent.UserFeedback, (payload) => {
29149
29165
  writeToStderr(payload.message + "\n");
29150
29166
  });
29151
29167
  }
@@ -29153,7 +29169,7 @@ function initializeOutputListenersAndFlush(config2) {
29153
29169
  const forceToStderr = outputFormat === "json";
29154
29170
  coreEvents.drainBacklogs(
29155
29171
  (event, args) => {
29156
- if (forceToStderr && event === "output" /* Output */) {
29172
+ if (forceToStderr && event === CoreEvent.Output) {
29157
29173
  const payload = args[0];
29158
29174
  if (!payload.isStderr) {
29159
29175
  return {