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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/bundle/builtin/antigravity-support/SKILL.md +55 -18
  2. package/bundle/builtin/skill-creator/SKILL.md +221 -84
  3. package/bundle/{chunk-3KYPKZPU.js → chunk-3BVBON3V.js} +1 -1
  4. package/bundle/{chunk-DGFXNTHD.js → chunk-3NPMAHLX.js} +1 -1
  5. package/bundle/{chunk-IG5K7R25.js → chunk-4ALCU2HQ.js} +1 -1
  6. package/bundle/{chunk-ISEPPPFO.js → chunk-4SNEOO5E.js} +2 -2
  7. package/bundle/{chunk-CNSLGANE.js → chunk-65C235NM.js} +10 -9
  8. package/bundle/{chunk-R34LMPUE.js → chunk-AKCYXG7C.js} +10 -9
  9. package/bundle/{chunk-C5FHWCAU.js → chunk-ALVDOQNA.js} +1 -1
  10. package/bundle/{chunk-3YGHKCB7.js → chunk-EAK33LFP.js} +1 -1
  11. package/bundle/{chunk-7IXYIWSX.js → chunk-FHDRG5U4.js} +70 -56
  12. package/bundle/{chunk-LZUWGCRJ.js → chunk-G65GW52B.js} +1708 -1352
  13. package/bundle/{chunk-KUIZDCN6.js → chunk-GK7NUJ35.js} +8 -5
  14. package/bundle/{chunk-VBIDFL63.js → chunk-GMQ6QNZB.js} +1 -1
  15. package/bundle/chunk-LNXGFWGZ.js +17332 -0
  16. package/bundle/{chunk-TV27OEQP.js → chunk-MBWROXYM.js} +2 -2
  17. package/bundle/{chunk-M6D6BI7B.js → chunk-NMMXRZ53.js} +2 -2
  18. package/bundle/{chunk-NUVMJEWM.js → chunk-NPOI4K6X.js} +9291 -15583
  19. package/bundle/{chunk-435NYDJB.js → chunk-NQ4RH42O.js} +9 -8
  20. package/bundle/{chunk-MYCBWRZE.js → chunk-O7SBKM7M.js} +1770 -1378
  21. package/bundle/{chunk-HAZMOWRC.js → chunk-Q73BPF7A.js} +1 -1
  22. package/bundle/{chunk-Y3KSGWY2.js → chunk-QJP6CMLN.js} +3 -3
  23. package/bundle/{chunk-BIPFNROE.js → chunk-RLDNUS35.js} +1 -1
  24. package/bundle/{chunk-ZXYNNAXR.js → chunk-S5UX3QS5.js} +3 -3
  25. package/bundle/{chunk-Y734TK7O.js → chunk-SCBVGZXH.js} +1 -1
  26. package/bundle/chunk-SWQAIZEQ.js +102506 -0
  27. package/bundle/{chunk-MKKOABMJ.js → chunk-UMQE7UC6.js} +3 -3
  28. package/bundle/{chunk-JFVPVDW6.js → chunk-VBK54QCZ.js} +1 -1
  29. package/bundle/chunk-VGGWKRAC.js +154 -0
  30. package/bundle/chunk-W23OOD2C.js +118 -0
  31. package/bundle/chunk-WDFSF5L4.js +397601 -0
  32. package/bundle/chunk-XESAM7IL.js +512 -0
  33. package/bundle/chunk-Y3APL4PE.js +1571 -0
  34. package/bundle/chunk-ZMPGHLGO.js +398 -0
  35. package/bundle/{cleanup-IZHI7N6V.js → cleanup-2W5DPMY3.js} +2 -2
  36. package/bundle/{cleanup-JZLQPF2L.js → cleanup-OTHE7RNU.js} +2 -2
  37. package/bundle/{cleanup-LJAAR5DT.js → cleanup-SM67K64R.js} +2 -2
  38. package/bundle/cleanup-XAUT5CMD.js +32 -0
  39. package/bundle/{core-TJ2XBV6Y.js → core-US34OW5M.js} +9 -1
  40. package/bundle/{devtoolsService-KFURCXJN.js → devtoolsService-5J53UK6Z.js} +2 -2
  41. package/bundle/{devtoolsService-BFW3BN3D.js → devtoolsService-GU2GQSOF.js} +2 -2
  42. package/bundle/{devtoolsService-NWA77XKC.js → devtoolsService-JBFUXTCT.js} +4 -3
  43. package/bundle/devtoolsService-V46GUHRF.js +4359 -0
  44. package/bundle/{dist-7KO3HJ4C.js → dist-5TYMQVIZ.js} +9 -1
  45. package/bundle/{core-BQJQAXVF.js → dist-OWKHVWTR.js} +9 -1
  46. package/bundle/dist-V5VJYW6J.js +2180 -0
  47. package/bundle/docs/changelogs/latest.md +224 -3
  48. package/bundle/docs/get-started/authentication.mdx +1 -1
  49. package/bundle/docs/reference/commands.md +7 -5
  50. package/bundle/{gemini-54R2PJOR.js → gemini-3M22N2C3.js} +19 -16
  51. package/bundle/{gemini-KK7AERSF.js → gemini-LSMTDETS.js} +19 -16
  52. package/bundle/{gemini-2RHAL2LS.js → gemini-OZOYJF22.js} +219 -200
  53. package/bundle/gemini-W2B6CLJC.js +17091 -0
  54. package/bundle/gemini.js +7 -7
  55. package/bundle/{interactiveCli-QBZRIN4M.js → interactiveCli-D6H37PJQ.js} +60 -30
  56. package/bundle/{interactiveCli-BAGEJ4VO.js → interactiveCli-L3ZXOVEV.js} +367 -318
  57. package/bundle/{interactiveCli-F5YXG24U.js → interactiveCli-LQJM6LRE.js} +60 -30
  58. package/bundle/interactiveCli-RGOYDSMH.js +34984 -0
  59. package/bundle/{liteRtServerManager-CYBHL4LH.js → liteRtServerManager-3BY6TBHG.js} +4 -4
  60. package/bundle/{liteRtServerManager-DMTHAOJH.js → liteRtServerManager-C5WZRQUF.js} +4 -4
  61. package/bundle/{liteRtServerManager-7LTDMYKI.js → liteRtServerManager-IGKUGGP4.js} +4 -4
  62. package/bundle/liteRtServerManager-IJ4I2PZA.js +65 -0
  63. package/bundle/{oauth2-provider-NOSS4GIR.js → oauth2-provider-KSRLPOK3.js} +1 -1
  64. package/bundle/{oauth2-provider-S2564L6K.js → oauth2-provider-RWKTMYJF.js} +1 -1
  65. package/bundle/{oauth2-provider-HNMIIJDH.js → oauth2-provider-VHNLCU4Y.js} +38 -72
  66. package/bundle/oauth2-provider-ZT4OFVMK.js +235 -0
  67. package/bundle/{start-L2WLGVI3.js → start-EXAQFM4Y.js} +6 -6
  68. package/bundle/{start-UGLCJG5Y.js → start-IPZF32E3.js} +6 -6
  69. package/bundle/{start-5F3JQ7EX.js → start-SVNTSNHV.js} +6 -6
  70. package/bundle/start-ZXU5BFZY.js +18 -0
  71. 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-MKKOABMJ.js";
5
+ } from "./chunk-QJP6CMLN.js";
6
6
  import {
7
7
  BuiltinCommandLoader,
8
8
  CommandService,
@@ -45,11 +45,11 @@ import {
45
45
  updateAllUpdatableExtensions,
46
46
  updateExtension,
47
47
  validateAuthMethod
48
- } from "./chunk-R34LMPUE.js";
48
+ } from "./chunk-65C235NM.js";
49
49
  import {
50
50
  exitCli,
51
51
  require_source
52
- } from "./chunk-BIPFNROE.js";
52
+ } from "./chunk-RLDNUS35.js";
53
53
  import {
54
54
  appEvents
55
55
  } from "./chunk-5PS3AYFU.js";
@@ -87,11 +87,11 @@ import {
87
87
  resolveGemmaConfig,
88
88
  saveModelChange,
89
89
  stripAnsi
90
- } from "./chunk-C5FHWCAU.js";
90
+ } from "./chunk-LNXGFWGZ.js";
91
91
  import {
92
92
  RELAUNCH_EXIT_CODE
93
- } from "./chunk-TV27OEQP.js";
94
- import "./chunk-435NYDJB.js";
93
+ } from "./chunk-NMMXRZ53.js";
94
+ import "./chunk-GMQ6QNZB.js";
95
95
  import {
96
96
  cleanupCheckpoints,
97
97
  registerCleanup,
@@ -100,12 +100,15 @@ import {
100
100
  runExitCleanup,
101
101
  runSyncCleanup,
102
102
  setupSignalHandlers
103
- } from "./chunk-DGFXNTHD.js";
103
+ } from "./chunk-EAK33LFP.js";
104
104
  import {
105
105
  ASK_USER_TOOL_NAME,
106
+ ApprovalMode,
106
107
  AuthType,
107
108
  Client,
108
109
  Config,
110
+ CoreEvent,
111
+ CoreToolCallStatus,
109
112
  DEFAULT_CONTEXT_FILENAME,
110
113
  DEFAULT_FILE_FILTERING_OPTIONS,
111
114
  DEFAULT_GEMINI_EMBEDDING_MODEL,
@@ -127,19 +130,27 @@ import {
127
130
  FolderTrustDiscoveryService,
128
131
  GEMINI_DIR,
129
132
  GEMINI_MODEL_ALIAS_AUTO,
133
+ GeminiEventType,
130
134
  IdeClient,
135
+ IntegrityStatus,
131
136
  InvalidStreamError,
132
137
  JsonFormatter,
138
+ JsonStreamEventType,
139
+ Kind,
133
140
  LegacyAgentSession,
134
141
  Logger,
135
142
  MAX_TOKENS_EXCEEDED_SUGGESTION,
136
143
  MCPServerConfig,
144
+ MCPServerStatus,
145
+ MessageBusType,
137
146
  OTHER_BLOCKED_MESSAGE,
147
+ OutputFormat,
138
148
  PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
139
149
  PREVIEW_GEMINI_3_1_MODEL,
140
150
  PREVIEW_GEMINI_FLASH_LITE_MODEL,
141
151
  PREVIEW_GEMINI_FLASH_MODEL,
142
152
  PREVIEW_GEMINI_MODEL,
153
+ PolicyDecision,
143
154
  PolicyIntegrityManager,
144
155
  RECITATION_BLOCKED_MESSAGE,
145
156
  REFERENCE_CONTENT_START,
@@ -147,6 +158,8 @@ import {
147
158
  ReadManyFilesTool,
148
159
  SAFETY_BLOCKED_MESSAGE,
149
160
  Scheduler,
161
+ SessionEndReason,
162
+ SessionStartSource,
150
163
  ShellExecutionService,
151
164
  SimpleExtensionLoader,
152
165
  Storage,
@@ -155,10 +168,13 @@ import {
155
168
  TRUE_EMPTY_RESPONSE_MESSAGE,
156
169
  ToolCallEvent,
157
170
  ToolConfirmationOutcome,
171
+ ToolErrorType,
172
+ TrustLevel,
158
173
  UserAccountManager,
159
174
  UserPromptEvent,
160
175
  ValidationCancelledError,
161
176
  ValidationRequiredError,
177
+ WarningPriority,
162
178
  applyAdminAllowlist,
163
179
  applyRequiredServers,
164
180
  clearCachedCredentialFile,
@@ -196,6 +212,7 @@ import {
196
212
  getProjectRootForWorktree,
197
213
  getPty,
198
214
  getRealPath,
215
+ getSafeGitEnv,
199
216
  getToolCallDataSchema,
200
217
  getVersion,
201
218
  homedir,
@@ -237,7 +254,7 @@ import {
237
254
  updatePolicy,
238
255
  writeToStderr,
239
256
  writeToStdout
240
- } from "./chunk-NUVMJEWM.js";
257
+ } from "./chunk-WDFSF5L4.js";
241
258
  import "./chunk-664ZODQF.js";
242
259
  import "./chunk-IUUIT4SU.js";
243
260
  import "./chunk-TUDYL3X4.js";
@@ -5367,7 +5384,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
5367
5384
  async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
5368
5385
  const isStdio = !!config.command;
5369
5386
  if (isStdio && !isTrusted) {
5370
- return "disconnected" /* DISCONNECTED */;
5387
+ return MCPServerStatus.DISCONNECTED;
5371
5388
  }
5372
5389
  const client = new Client({
5373
5390
  name: "mcp-test-client",
@@ -5403,7 +5420,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5403
5420
  transport = await createTransport(serverName, config, false, mcpContext);
5404
5421
  } catch {
5405
5422
  await client.close();
5406
- return "disconnected" /* DISCONNECTED */;
5423
+ return MCPServerStatus.DISCONNECTED;
5407
5424
  }
5408
5425
  try {
5409
5426
  const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
@@ -5417,10 +5434,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5417
5434
  );
5418
5435
  }
5419
5436
  await client.close();
5420
- return "connected" /* CONNECTED */;
5437
+ return MCPServerStatus.CONNECTED;
5421
5438
  } catch {
5422
5439
  await transport.close();
5423
- return "disconnected" /* DISCONNECTED */;
5440
+ return MCPServerStatus.DISCONNECTED;
5424
5441
  }
5425
5442
  }
5426
5443
  async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
@@ -5433,12 +5450,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
5433
5450
  });
5434
5451
  if (!loadResult.allowed) {
5435
5452
  if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
5436
- return "blocked" /* BLOCKED */;
5453
+ return MCPServerStatus.BLOCKED;
5437
5454
  }
5438
- return "disabled" /* DISABLED */;
5455
+ return MCPServerStatus.DISABLED;
5439
5456
  }
5440
5457
  if (!isTrusted) {
5441
- return "disabled" /* DISABLED */;
5458
+ return MCPServerStatus.DISABLED;
5442
5459
  }
5443
5460
  return testMCPConnection(serverName, server, isTrusted, activeSettings);
5444
5461
  }
@@ -5484,23 +5501,23 @@ async function listMcpServers(loadedSettingsArg) {
5484
5501
  let statusIndicator = "";
5485
5502
  let statusText = "";
5486
5503
  switch (status) {
5487
- case "connected" /* CONNECTED */:
5504
+ case MCPServerStatus.CONNECTED:
5488
5505
  statusIndicator = import_chalk.default.green("\u2713");
5489
5506
  statusText = "Connected";
5490
5507
  break;
5491
- case "connecting" /* CONNECTING */:
5508
+ case MCPServerStatus.CONNECTING:
5492
5509
  statusIndicator = import_chalk.default.yellow("\u2026");
5493
5510
  statusText = "Connecting";
5494
5511
  break;
5495
- case "blocked" /* BLOCKED */:
5512
+ case MCPServerStatus.BLOCKED:
5496
5513
  statusIndicator = import_chalk.default.red("\u26D4");
5497
5514
  statusText = "Blocked";
5498
5515
  break;
5499
- case "disabled" /* DISABLED */:
5516
+ case MCPServerStatus.DISABLED:
5500
5517
  statusIndicator = import_chalk.default.gray("\u25CB");
5501
5518
  statusText = "Disabled";
5502
5519
  break;
5503
- case "disconnected" /* DISCONNECTED */:
5520
+ case MCPServerStatus.DISCONNECTED:
5504
5521
  default:
5505
5522
  statusIndicator = import_chalk.default.red("\u2717");
5506
5523
  statusText = "Disconnected";
@@ -5786,7 +5803,7 @@ async function handleInstall(args) {
5786
5803
  );
5787
5804
  if (confirmed) {
5788
5805
  const trustedFolders = loadTrustedFolders();
5789
- await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
5806
+ await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
5790
5807
  } else {
5791
5808
  throw new Error(
5792
5809
  `Installation aborted: Folder "${absolutePath}" is not trusted.`
@@ -7831,7 +7848,7 @@ async function loadSandboxConfig(settings, argv) {
7831
7848
  }
7832
7849
  const command2 = getSandboxCommand(sandboxValue);
7833
7850
  const packageJson = await getPackageJson(__dirname3);
7834
- const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.56.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7851
+ const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.57.0-preview.1" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7835
7852
  const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
7836
7853
  return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
7837
7854
  }
@@ -7890,9 +7907,9 @@ async function resolveWorkspacePolicyState(options) {
7890
7907
  cwd,
7891
7908
  potentialWorkspacePoliciesDir
7892
7909
  );
7893
- if (integrityResult.status === "MATCH" /* MATCH */) {
7910
+ if (integrityResult.status === IntegrityStatus.MATCH) {
7894
7911
  workspacePoliciesDir = potentialWorkspacePoliciesDir;
7895
- } else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
7912
+ } else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
7896
7913
  workspacePoliciesDir = void 0;
7897
7914
  } else if (interactive && !autoAcceptWorkspacePolicies) {
7898
7915
  policyUpdateConfirmationRequest = {
@@ -8320,23 +8337,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8320
8337
  if (rawApprovalMode) {
8321
8338
  switch (rawApprovalMode) {
8322
8339
  case "yolo":
8323
- approvalMode = "yolo" /* YOLO */;
8340
+ approvalMode = ApprovalMode.YOLO;
8324
8341
  break;
8325
8342
  case "auto_edit":
8326
- approvalMode = "autoEdit" /* AUTO_EDIT */;
8343
+ approvalMode = ApprovalMode.AUTO_EDIT;
8327
8344
  break;
8328
8345
  case "plan":
8329
8346
  if (!(settings.general?.plan?.enabled ?? true)) {
8330
8347
  debugLogger.warn(
8331
8348
  'Approval mode "plan" is disabled in your settings. Falling back to "default".'
8332
8349
  );
8333
- approvalMode = "default" /* DEFAULT */;
8350
+ approvalMode = ApprovalMode.DEFAULT;
8334
8351
  } else {
8335
- approvalMode = "plan" /* PLAN */;
8352
+ approvalMode = ApprovalMode.PLAN;
8336
8353
  }
8337
8354
  break;
8338
8355
  case "default":
8339
- approvalMode = "default" /* DEFAULT */;
8356
+ approvalMode = ApprovalMode.DEFAULT;
8340
8357
  break;
8341
8358
  default:
8342
8359
  throw new Error(
@@ -8344,10 +8361,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8344
8361
  );
8345
8362
  }
8346
8363
  } else {
8347
- approvalMode = "default" /* DEFAULT */;
8364
+ approvalMode = ApprovalMode.DEFAULT;
8348
8365
  }
8349
8366
  if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
8350
- if (approvalMode === "yolo" /* YOLO */) {
8367
+ if (approvalMode === ApprovalMode.YOLO) {
8351
8368
  if (settings.admin?.secureModeEnabled) {
8352
8369
  debugLogger.error(
8353
8370
  'YOLO mode is disabled by "secureModeEnabled" setting.'
@@ -8365,16 +8382,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8365
8382
  )
8366
8383
  );
8367
8384
  }
8368
- } else if (approvalMode === "yolo" /* YOLO */) {
8385
+ } else if (approvalMode === ApprovalMode.YOLO) {
8369
8386
  debugLogger.warn(
8370
8387
  "YOLO mode is enabled. All tool calls will be automatically approved."
8371
8388
  );
8372
8389
  }
8373
- if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
8390
+ if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
8374
8391
  debugLogger.warn(
8375
8392
  `Approval mode overridden to "default" because the current folder is not trusted.`
8376
8393
  );
8377
- approvalMode = "default" /* DEFAULT */;
8394
+ approvalMode = ApprovalMode.DEFAULT;
8378
8395
  }
8379
8396
  let telemetrySettings;
8380
8397
  try {
@@ -8655,7 +8672,8 @@ async function resolveWorktreeSettings(cwd) {
8655
8672
  let worktreePath;
8656
8673
  try {
8657
8674
  const { stdout } = await execa("git", ["rev-parse", "--show-toplevel"], {
8658
- cwd
8675
+ cwd,
8676
+ env: getSafeGitEnv()
8659
8677
  });
8660
8678
  const toplevel = stdout.trim();
8661
8679
  const projectRoot = await getProjectRootForWorktree(toplevel);
@@ -8671,7 +8689,8 @@ async function resolveWorktreeSettings(cwd) {
8671
8689
  let worktreeBaseSha;
8672
8690
  try {
8673
8691
  const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
8674
- cwd: worktreePath
8692
+ cwd: worktreePath,
8693
+ env: getSafeGitEnv()
8675
8694
  });
8676
8695
  worktreeBaseSha = stdout.trim();
8677
8696
  } catch (e) {
@@ -10409,7 +10428,7 @@ import path9 from "node:path";
10409
10428
  import process4 from "node:process";
10410
10429
  var homeDirectoryCheck = {
10411
10430
  id: "home-directory",
10412
- priority: "low" /* Low */,
10431
+ priority: WarningPriority.Low,
10413
10432
  check: async (workspaceRoot, settings) => {
10414
10433
  if (settings.ui?.showHomeDirectoryWarning === false) {
10415
10434
  return null;
@@ -10433,7 +10452,7 @@ var homeDirectoryCheck = {
10433
10452
  };
10434
10453
  var rootDirectoryCheck = {
10435
10454
  id: "root-directory",
10436
- priority: "high" /* High */,
10455
+ priority: WarningPriority.High,
10437
10456
  check: async (workspaceRoot, _settings) => {
10438
10457
  try {
10439
10458
  const workspaceRealPath = await fs9.realpath(workspaceRoot);
@@ -10449,7 +10468,7 @@ var rootDirectoryCheck = {
10449
10468
  };
10450
10469
  var folderTrustCheck = {
10451
10470
  id: "folder-trust",
10452
- priority: "high" /* High */,
10471
+ priority: WarningPriority.High,
10453
10472
  check: async (workspaceRoot, settings) => {
10454
10473
  if (!isFolderTrustEnabled(settings)) {
10455
10474
  return null;
@@ -10639,12 +10658,12 @@ function handleError(error, config, customErrorCode) {
10639
10658
  error,
10640
10659
  config.getContentGeneratorConfig()?.authType
10641
10660
  );
10642
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10661
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10643
10662
  const streamFormatter = new StreamJsonFormatter();
10644
10663
  const errorCode = customErrorCode ?? extractErrorCode(error);
10645
10664
  const metrics = uiTelemetryService.getMetrics();
10646
10665
  streamFormatter.emitEvent({
10647
- type: "result" /* RESULT */,
10666
+ type: JsonStreamEventType.RESULT,
10648
10667
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10649
10668
  status: "error",
10650
10669
  error: {
@@ -10655,7 +10674,7 @@ function handleError(error, config, customErrorCode) {
10655
10674
  });
10656
10675
  runSyncCleanup();
10657
10676
  process.exit(getNumericExitCode(errorCode));
10658
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10677
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10659
10678
  const formatter = new JsonFormatter();
10660
10679
  const errorCode = customErrorCode ?? extractErrorCode(error);
10661
10680
  const formattedError = formatter.formatError(
@@ -10675,11 +10694,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
10675
10694
  const isFatal = isFatalToolError(errorType);
10676
10695
  if (isFatal) {
10677
10696
  const toolExecutionError = new FatalToolExecutionError(errorMessage);
10678
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10697
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10679
10698
  const streamFormatter = new StreamJsonFormatter();
10680
10699
  const metrics = uiTelemetryService.getMetrics();
10681
10700
  streamFormatter.emitEvent({
10682
- type: "result" /* RESULT */,
10701
+ type: JsonStreamEventType.RESULT,
10683
10702
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10684
10703
  status: "error",
10685
10704
  error: {
@@ -10688,7 +10707,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
10688
10707
  },
10689
10708
  stats: streamFormatter.convertToStreamStats(metrics, 0)
10690
10709
  });
10691
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10710
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10692
10711
  const formatter = new JsonFormatter();
10693
10712
  const formattedError = formatter.formatError(
10694
10713
  toolExecutionError,
@@ -10706,11 +10725,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
10706
10725
  }
10707
10726
  function handleCancellationError(config) {
10708
10727
  const cancellationError = new FatalCancellationError("Operation cancelled.");
10709
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10728
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10710
10729
  const streamFormatter = new StreamJsonFormatter();
10711
10730
  const metrics = uiTelemetryService.getMetrics();
10712
10731
  streamFormatter.emitEvent({
10713
- type: "result" /* RESULT */,
10732
+ type: JsonStreamEventType.RESULT,
10714
10733
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10715
10734
  status: "error",
10716
10735
  error: {
@@ -10721,7 +10740,7 @@ function handleCancellationError(config) {
10721
10740
  });
10722
10741
  runSyncCleanup();
10723
10742
  process.exit(cancellationError.exitCode);
10724
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10743
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10725
10744
  const formatter = new JsonFormatter();
10726
10745
  const formattedError = formatter.formatError(
10727
10746
  cancellationError,
@@ -10741,11 +10760,11 @@ function handleMaxTurnsExceededError(config) {
10741
10760
  const maxTurnsError = new FatalTurnLimitedError(
10742
10761
  "Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
10743
10762
  );
10744
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
10763
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
10745
10764
  const streamFormatter = new StreamJsonFormatter();
10746
10765
  const metrics = uiTelemetryService.getMetrics();
10747
10766
  streamFormatter.emitEvent({
10748
- type: "result" /* RESULT */,
10767
+ type: JsonStreamEventType.RESULT,
10749
10768
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10750
10769
  status: "error",
10751
10770
  error: {
@@ -10756,7 +10775,7 @@ function handleMaxTurnsExceededError(config) {
10756
10775
  });
10757
10776
  runSyncCleanup();
10758
10777
  process.exit(maxTurnsError.exitCode);
10759
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10778
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10760
10779
  const formatter = new JsonFormatter();
10761
10780
  const formattedError = formatter.formatError(
10762
10781
  maxTurnsError,
@@ -10836,7 +10855,7 @@ async function runNonInteractive({
10836
10855
  }
10837
10856
  });
10838
10857
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
10839
- const { setupInitialActivityLogger } = await import("./devtoolsService-KFURCXJN.js");
10858
+ const { setupInitialActivityLogger } = await import("./devtoolsService-GU2GQSOF.js");
10840
10859
  setupInitialActivityLogger(config);
10841
10860
  }
10842
10861
  const { stdout: workingStdout } = createWorkingStdio();
@@ -10852,7 +10871,7 @@ async function runNonInteractive({
10852
10871
  }
10853
10872
  };
10854
10873
  const startTime = Date.now();
10855
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
10874
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
10856
10875
  const abortController = new AbortController();
10857
10876
  let isAborting = false;
10858
10877
  let cancelMessageTimer = null;
@@ -10905,13 +10924,13 @@ async function runNonInteractive({
10905
10924
  };
10906
10925
  try {
10907
10926
  consolePatcher.patch();
10908
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
10927
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
10909
10928
  process.stderr.write(
10910
10929
  "[WARNING] --raw-output is enabled. Model output is not sanitized and may contain harmful ANSI sequences (e.g. for phishing or command injection). Use --accept-raw-output-risk to suppress this warning.\n"
10911
10930
  );
10912
10931
  }
10913
10932
  setupStdinCancellation();
10914
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
10933
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
10915
10934
  coreEvents.drainBacklogs();
10916
10935
  process.stdout.on("error", (err) => {
10917
10936
  if (err.code === "EPIPE") {
@@ -10937,7 +10956,7 @@ async function runNonInteractive({
10937
10956
  }
10938
10957
  if (streamFormatter) {
10939
10958
  streamFormatter.emitEvent({
10940
- type: "init" /* INIT */,
10959
+ type: JsonStreamEventType.INIT,
10941
10960
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10942
10961
  session_id: config.getSessionId(),
10943
10962
  model: config.getModel()
@@ -10975,7 +10994,7 @@ async function runNonInteractive({
10975
10994
  }
10976
10995
  if (streamFormatter) {
10977
10996
  streamFormatter.emitEvent({
10978
- type: "message" /* MESSAGE */,
10997
+ type: JsonStreamEventType.MESSAGE,
10979
10998
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10980
10999
  role: "user",
10981
11000
  content: input
@@ -11014,12 +11033,12 @@ async function runNonInteractive({
11014
11033
  const metrics = uiTelemetryService.getMetrics();
11015
11034
  const durationMs = Date.now() - startTime;
11016
11035
  streamFormatter.emitEvent({
11017
- type: "result" /* RESULT */,
11036
+ type: JsonStreamEventType.RESULT,
11018
11037
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11019
11038
  status: errorPayload ? "error" : "success",
11020
11039
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
11021
11040
  });
11022
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11041
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11023
11042
  const formatter = new JsonFormatter();
11024
11043
  const stats = uiTelemetryService.getMetrics();
11025
11044
  textOutput.write(
@@ -11112,13 +11131,13 @@ async function runNonInteractive({
11112
11131
  const output = isRaw ? part.text : stripAnsi(part.text);
11113
11132
  if (streamFormatter) {
11114
11133
  streamFormatter.emitEvent({
11115
- type: "message" /* MESSAGE */,
11134
+ type: JsonStreamEventType.MESSAGE,
11116
11135
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11117
11136
  role: "assistant",
11118
11137
  content: output,
11119
11138
  delta: true
11120
11139
  });
11121
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11140
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11122
11141
  responseText += output;
11123
11142
  } else {
11124
11143
  if (part.text) {
@@ -11131,13 +11150,13 @@ async function runNonInteractive({
11131
11150
  break;
11132
11151
  }
11133
11152
  case "tool_request": {
11134
- if (config.getOutputFormat() === "json" /* JSON */) {
11153
+ if (config.getOutputFormat() === OutputFormat.JSON) {
11135
11154
  preToolResponseText = responseText || preToolResponseText;
11136
11155
  responseText = "";
11137
11156
  }
11138
11157
  if (streamFormatter) {
11139
11158
  streamFormatter.emitEvent({
11140
- type: "tool_use" /* TOOL_USE */,
11159
+ type: JsonStreamEventType.TOOL_USE,
11141
11160
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11142
11161
  tool_name: event.name,
11143
11162
  tool_id: event.requestId,
@@ -11153,7 +11172,7 @@ async function runNonInteractive({
11153
11172
  const displayText = displayContentToString(display);
11154
11173
  const errorMsg = getTextContent(event.content) ?? "Tool error";
11155
11174
  streamFormatter.emitEvent({
11156
- type: "tool_result" /* TOOL_RESULT */,
11175
+ type: JsonStreamEventType.TOOL_RESULT,
11157
11176
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11158
11177
  tool_id: event.requestId,
11159
11178
  status: event.isError ? "error" : "success",
@@ -11168,17 +11187,17 @@ async function runNonInteractive({
11168
11187
  const display = event.display?.result;
11169
11188
  const displayText = displayContentToString(display);
11170
11189
  const errorMsg = getTextContent(event.content) ?? "Tool error";
11171
- if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
11172
- if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
11190
+ if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
11191
+ if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
11173
11192
  responseText = preToolResponseText;
11174
11193
  }
11175
11194
  const stopMessage = `Agent execution stopped: ${errorMsg}`;
11176
- if (config.getOutputFormat() === "text" /* TEXT */) {
11195
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11177
11196
  process.stderr.write(`${stopMessage}
11178
11197
  `);
11179
11198
  }
11180
11199
  }
11181
- if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
11200
+ if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
11182
11201
  throw new FatalToolExecutionError(
11183
11202
  "Error executing tool " + event.name + ": " + (displayText || errorMsg)
11184
11203
  );
@@ -11213,12 +11232,12 @@ async function runNonInteractive({
11213
11232
  }
11214
11233
  if (streamFormatter) {
11215
11234
  streamFormatter.emitEvent({
11216
- type: "error" /* ERROR */,
11235
+ type: JsonStreamEventType.ERROR,
11217
11236
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11218
11237
  severity: "error",
11219
11238
  message: errorMessage
11220
11239
  });
11221
- } else if (config.getOutputFormat() === "text" /* TEXT */) {
11240
+ } else if (config.getOutputFormat() === OutputFormat.TEXT) {
11222
11241
  process.stderr.write(`[ERROR] ${errorMessage}
11223
11242
  `);
11224
11243
  }
@@ -11239,12 +11258,12 @@ async function runNonInteractive({
11239
11258
  const errorCode = event._meta?.["code"];
11240
11259
  if (errorCode === "AGENT_EXECUTION_BLOCKED") {
11241
11260
  const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
11242
- if (config.getOutputFormat() === "text" /* TEXT */) {
11261
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11243
11262
  process.stderr.write(`[WARNING] ${blockMessage}
11244
11263
  `);
11245
11264
  } else if (streamFormatter) {
11246
11265
  streamFormatter.emitEvent({
11247
- type: "error" /* ERROR */,
11266
+ type: JsonStreamEventType.ERROR,
11248
11267
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11249
11268
  severity: "warning",
11250
11269
  message: stripAnsi(blockMessage)
@@ -11254,13 +11273,13 @@ async function runNonInteractive({
11254
11273
  break;
11255
11274
  }
11256
11275
  const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
11257
- if (config.getOutputFormat() === "text" /* TEXT */) {
11276
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11258
11277
  process.stderr.write(`[WARNING] ${event.message}
11259
11278
  `);
11260
11279
  }
11261
11280
  if (streamFormatter) {
11262
11281
  streamFormatter.emitEvent({
11263
- type: "error" /* ERROR */,
11282
+ type: JsonStreamEventType.ERROR,
11264
11283
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11265
11284
  severity,
11266
11285
  message: stripAnsi(event.message)
@@ -11280,7 +11299,7 @@ async function runNonInteractive({
11280
11299
  );
11281
11300
  } else if (streamFormatter) {
11282
11301
  streamFormatter.emitEvent({
11283
- type: "error" /* ERROR */,
11302
+ type: JsonStreamEventType.ERROR,
11284
11303
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11285
11304
  severity: "error",
11286
11305
  message: "Maximum session turns exceeded"
@@ -11288,7 +11307,7 @@ async function runNonInteractive({
11288
11307
  }
11289
11308
  }
11290
11309
  const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
11291
- if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
11310
+ if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
11292
11311
  process.stderr.write(`Agent execution stopped: ${stopMessage}
11293
11312
  `);
11294
11313
  }
@@ -11318,7 +11337,7 @@ async function runNonInteractive({
11318
11337
  abortController.signal.removeEventListener("abort", abortSession);
11319
11338
  scheduler?.dispose();
11320
11339
  consolePatcher.cleanup();
11321
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
11340
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
11322
11341
  }
11323
11342
  if (errorToHandle) {
11324
11343
  handleError(errorToHandle, config);
@@ -11346,7 +11365,7 @@ async function runNonInteractive2(params) {
11346
11365
  }
11347
11366
  });
11348
11367
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
11349
- const { setupInitialActivityLogger } = await import("./devtoolsService-KFURCXJN.js");
11368
+ const { setupInitialActivityLogger } = await import("./devtoolsService-GU2GQSOF.js");
11350
11369
  setupInitialActivityLogger(config);
11351
11370
  }
11352
11371
  const { stdout: workingStdout } = createWorkingStdio();
@@ -11362,7 +11381,7 @@ async function runNonInteractive2(params) {
11362
11381
  }
11363
11382
  };
11364
11383
  const startTime = Date.now();
11365
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
11384
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
11366
11385
  const abortController = new AbortController();
11367
11386
  let isAborting = false;
11368
11387
  let cancelMessageTimer = null;
@@ -11413,13 +11432,13 @@ async function runNonInteractive2(params) {
11413
11432
  let scheduler;
11414
11433
  try {
11415
11434
  consolePatcher.patch();
11416
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
11435
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
11417
11436
  process.stderr.write(
11418
11437
  "[WARNING] --raw-output is enabled. Model output is not sanitized and may contain harmful ANSI sequences (e.g. for phishing or command injection). Use --accept-raw-output-risk to suppress this warning.\n"
11419
11438
  );
11420
11439
  }
11421
11440
  setupStdinCancellation();
11422
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
11441
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
11423
11442
  coreEvents.drainBacklogs();
11424
11443
  process.stdout.on("error", (err) => {
11425
11444
  if (err.code === "EPIPE") {
@@ -11443,7 +11462,7 @@ async function runNonInteractive2(params) {
11443
11462
  }
11444
11463
  if (streamFormatter) {
11445
11464
  streamFormatter.emitEvent({
11446
- type: "init" /* INIT */,
11465
+ type: JsonStreamEventType.INIT,
11447
11466
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11448
11467
  session_id: config.getSessionId(),
11449
11468
  model: config.getModel()
@@ -11481,7 +11500,7 @@ async function runNonInteractive2(params) {
11481
11500
  }
11482
11501
  if (streamFormatter) {
11483
11502
  streamFormatter.emitEvent({
11484
- type: "message" /* MESSAGE */,
11503
+ type: JsonStreamEventType.MESSAGE,
11485
11504
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11486
11505
  role: "user",
11487
11506
  content: input
@@ -11509,28 +11528,28 @@ async function runNonInteractive2(params) {
11509
11528
  if (abortController.signal.aborted) {
11510
11529
  handleCancellationError(config);
11511
11530
  }
11512
- if (event.type === "content" /* Content */) {
11531
+ if (event.type === GeminiEventType.Content) {
11513
11532
  const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
11514
11533
  const output = isRaw ? event.value : stripAnsi(event.value);
11515
11534
  if (streamFormatter) {
11516
11535
  streamFormatter.emitEvent({
11517
- type: "message" /* MESSAGE */,
11536
+ type: JsonStreamEventType.MESSAGE,
11518
11537
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11519
11538
  role: "assistant",
11520
11539
  content: output,
11521
11540
  delta: true
11522
11541
  });
11523
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11542
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11524
11543
  responseText += output;
11525
11544
  } else {
11526
11545
  if (event.value) {
11527
11546
  textOutput.write(output);
11528
11547
  }
11529
11548
  }
11530
- } else if (event.type === "tool_call_request" /* ToolCallRequest */) {
11549
+ } else if (event.type === GeminiEventType.ToolCallRequest) {
11531
11550
  if (streamFormatter) {
11532
11551
  streamFormatter.emitEvent({
11533
- type: "tool_use" /* TOOL_USE */,
11552
+ type: JsonStreamEventType.TOOL_USE,
11534
11553
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11535
11554
  tool_name: event.value.name,
11536
11555
  tool_id: event.value.callId,
@@ -11538,33 +11557,33 @@ async function runNonInteractive2(params) {
11538
11557
  });
11539
11558
  }
11540
11559
  toolCallRequests.push(event.value);
11541
- } else if (event.type === "loop_detected" /* LoopDetected */) {
11560
+ } else if (event.type === GeminiEventType.LoopDetected) {
11542
11561
  const message = "Loop detected, stopping execution";
11543
11562
  if (streamFormatter) {
11544
11563
  streamFormatter.emitEvent({
11545
- type: "error" /* ERROR */,
11564
+ type: JsonStreamEventType.ERROR,
11546
11565
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11547
11566
  severity: "warning",
11548
11567
  message
11549
11568
  });
11550
11569
  }
11551
11570
  warnings.push(message);
11552
- } else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
11571
+ } else if (event.type === GeminiEventType.MaxSessionTurns) {
11553
11572
  const message = "Maximum session turns exceeded";
11554
11573
  if (streamFormatter) {
11555
11574
  streamFormatter.emitEvent({
11556
- type: "error" /* ERROR */,
11575
+ type: JsonStreamEventType.ERROR,
11557
11576
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11558
11577
  severity: "error",
11559
11578
  message
11560
11579
  });
11561
11580
  }
11562
11581
  warnings.push(message);
11563
- } else if (event.type === "error" /* Error */) {
11582
+ } else if (event.type === GeminiEventType.Error) {
11564
11583
  throw event.value.error;
11565
- } else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
11584
+ } else if (event.type === GeminiEventType.AgentExecutionStopped) {
11566
11585
  const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
11567
- if (config.getOutputFormat() === "text" /* TEXT */) {
11586
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11568
11587
  process.stderr.write(`${stopMessage}
11569
11588
  `);
11570
11589
  }
@@ -11572,7 +11591,7 @@ async function runNonInteractive2(params) {
11572
11591
  const metrics = uiTelemetryService.getMetrics();
11573
11592
  const durationMs = Date.now() - startTime;
11574
11593
  streamFormatter.emitEvent({
11575
- type: "result" /* RESULT */,
11594
+ type: JsonStreamEventType.RESULT,
11576
11595
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11577
11596
  status: "success",
11578
11597
  stats: streamFormatter.convertToStreamStats(
@@ -11580,7 +11599,7 @@ async function runNonInteractive2(params) {
11580
11599
  durationMs
11581
11600
  )
11582
11601
  });
11583
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11602
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11584
11603
  const formatter = new JsonFormatter();
11585
11604
  const stats = uiTelemetryService.getMetrics();
11586
11605
  textOutput.write(
@@ -11596,21 +11615,21 @@ async function runNonInteractive2(params) {
11596
11615
  textOutput.ensureTrailingNewline();
11597
11616
  }
11598
11617
  return;
11599
- } else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
11618
+ } else if (event.type === GeminiEventType.AgentExecutionBlocked) {
11600
11619
  const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
11601
- if (config.getOutputFormat() === "text" /* TEXT */) {
11620
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11602
11621
  process.stderr.write(`[WARNING] ${blockMessage}
11603
11622
  `);
11604
11623
  } else if (streamFormatter) {
11605
11624
  streamFormatter.emitEvent({
11606
- type: "error" /* ERROR */,
11625
+ type: JsonStreamEventType.ERROR,
11607
11626
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11608
11627
  severity: "warning",
11609
11628
  message: stripAnsi(blockMessage)
11610
11629
  });
11611
11630
  }
11612
11631
  warnings.push(blockMessage);
11613
- } else if (event.type === "invalid_stream" /* InvalidStream */) {
11632
+ } else if (event.type === GeminiEventType.InvalidStream) {
11614
11633
  const eventValue = event.value;
11615
11634
  if (eventValue?.type === "NO_RESPONSE_TEXT") {
11616
11635
  invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
@@ -11633,12 +11652,12 @@ async function runNonInteractive2(params) {
11633
11652
  );
11634
11653
  if (streamFormatter) {
11635
11654
  streamFormatter.emitEvent({
11636
- type: "error" /* ERROR */,
11655
+ type: JsonStreamEventType.ERROR,
11637
11656
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11638
11657
  severity: "error",
11639
11658
  message: invalidStreamError
11640
11659
  });
11641
- } else if (config.getOutputFormat() === "text" /* TEXT */) {
11660
+ } else if (config.getOutputFormat() === OutputFormat.TEXT) {
11642
11661
  process.stderr.write(`[ERROR] ${invalidStreamError}
11643
11662
  `);
11644
11663
  }
@@ -11658,7 +11677,7 @@ async function runNonInteractive2(params) {
11658
11677
  const requestInfo = completedToolCall.request;
11659
11678
  if (streamFormatter) {
11660
11679
  streamFormatter.emitEvent({
11661
- type: "tool_result" /* TOOL_RESULT */,
11680
+ type: JsonStreamEventType.TOOL_RESULT,
11662
11681
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11663
11682
  tool_id: requestInfo.callId,
11664
11683
  status: completedToolCall.status === "error" ? "error" : "success",
@@ -11692,11 +11711,11 @@ async function runNonInteractive2(params) {
11692
11711
  );
11693
11712
  }
11694
11713
  const stopExecutionTool = completedToolCalls.find(
11695
- (tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
11714
+ (tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
11696
11715
  );
11697
11716
  if (stopExecutionTool && stopExecutionTool.response.error) {
11698
11717
  const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
11699
- if (config.getOutputFormat() === "text" /* TEXT */) {
11718
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
11700
11719
  process.stderr.write(`${stopMessage}
11701
11720
  `);
11702
11721
  }
@@ -11704,7 +11723,7 @@ async function runNonInteractive2(params) {
11704
11723
  const metrics = uiTelemetryService.getMetrics();
11705
11724
  const durationMs = Date.now() - startTime;
11706
11725
  streamFormatter.emitEvent({
11707
- type: "result" /* RESULT */,
11726
+ type: JsonStreamEventType.RESULT,
11708
11727
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11709
11728
  status: "success",
11710
11729
  stats: streamFormatter.convertToStreamStats(
@@ -11712,7 +11731,7 @@ async function runNonInteractive2(params) {
11712
11731
  durationMs
11713
11732
  )
11714
11733
  });
11715
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11734
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11716
11735
  const formatter = new JsonFormatter();
11717
11736
  const stats = uiTelemetryService.getMetrics();
11718
11737
  textOutput.write(
@@ -11735,12 +11754,12 @@ async function runNonInteractive2(params) {
11735
11754
  const metrics = uiTelemetryService.getMetrics();
11736
11755
  const durationMs = Date.now() - startTime;
11737
11756
  streamFormatter.emitEvent({
11738
- type: "result" /* RESULT */,
11757
+ type: JsonStreamEventType.RESULT,
11739
11758
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11740
11759
  status: invalidStreamError ? "error" : "success",
11741
11760
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
11742
11761
  });
11743
- } else if (config.getOutputFormat() === "json" /* JSON */) {
11762
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
11744
11763
  const formatter = new JsonFormatter();
11745
11764
  const stats = uiTelemetryService.getMetrics();
11746
11765
  textOutput.write(
@@ -11764,7 +11783,7 @@ async function runNonInteractive2(params) {
11764
11783
  cleanupStdinCancellation();
11765
11784
  scheduler?.dispose();
11766
11785
  consolePatcher.cleanup();
11767
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
11786
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
11768
11787
  }
11769
11788
  if (errorToHandle) {
11770
11789
  handleError(errorToHandle, config);
@@ -14155,12 +14174,12 @@ function toToolCallContent(toolResult) {
14155
14174
  }
14156
14175
  var basicPermissionOptions = [
14157
14176
  {
14158
- optionId: "proceed_once" /* ProceedOnce */,
14177
+ optionId: ToolConfirmationOutcome.ProceedOnce,
14159
14178
  name: "Allow",
14160
14179
  kind: "allow_once"
14161
14180
  },
14162
14181
  {
14163
- optionId: "cancel" /* Cancel */,
14182
+ optionId: ToolConfirmationOutcome.Cancel,
14164
14183
  name: "Reject",
14165
14184
  kind: "reject_once"
14166
14185
  }
@@ -14172,13 +14191,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14172
14191
  switch (confirmation.type) {
14173
14192
  case "edit":
14174
14193
  options.push({
14175
- optionId: "proceed_always" /* ProceedAlways */,
14194
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14176
14195
  name: "Allow for this session",
14177
14196
  kind: "allow_always"
14178
14197
  });
14179
14198
  if (enablePermanentToolApproval) {
14180
14199
  options.push({
14181
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14200
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14182
14201
  name: "Allow for this file in all future sessions",
14183
14202
  kind: "allow_always"
14184
14203
  });
@@ -14186,13 +14205,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14186
14205
  break;
14187
14206
  case "exec":
14188
14207
  options.push({
14189
- optionId: "proceed_always" /* ProceedAlways */,
14208
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14190
14209
  name: "Allow for this session",
14191
14210
  kind: "allow_always"
14192
14211
  });
14193
14212
  if (enablePermanentToolApproval) {
14194
14213
  options.push({
14195
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14214
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14196
14215
  name: "Allow this command for all future sessions",
14197
14216
  kind: "allow_always"
14198
14217
  });
@@ -14201,19 +14220,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14201
14220
  case "mcp":
14202
14221
  options.push(
14203
14222
  {
14204
- optionId: "proceed_always_server" /* ProceedAlwaysServer */,
14223
+ optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
14205
14224
  name: "Allow all server tools for this session",
14206
14225
  kind: "allow_always"
14207
14226
  },
14208
14227
  {
14209
- optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
14228
+ optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
14210
14229
  name: "Allow tool for this session",
14211
14230
  kind: "allow_always"
14212
14231
  }
14213
14232
  );
14214
14233
  if (enablePermanentToolApproval) {
14215
14234
  options.push({
14216
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14235
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14217
14236
  name: "Allow tool for all future sessions",
14218
14237
  kind: "allow_always"
14219
14238
  });
@@ -14221,13 +14240,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14221
14240
  break;
14222
14241
  case "info":
14223
14242
  options.push({
14224
- optionId: "proceed_always" /* ProceedAlways */,
14243
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14225
14244
  name: "Allow for this session",
14226
14245
  kind: "allow_always"
14227
14246
  });
14228
14247
  if (enablePermanentToolApproval) {
14229
14248
  options.push({
14230
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14249
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14231
14250
  name: "Allow for all future sessions",
14232
14251
  kind: "allow_always"
14233
14252
  });
@@ -14259,21 +14278,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14259
14278
  }
14260
14279
  function toAcpToolKind(kind) {
14261
14280
  switch (kind) {
14262
- case "read" /* Read */:
14263
- case "edit" /* Edit */:
14264
- case "execute" /* Execute */:
14265
- case "search" /* Search */:
14266
- case "delete" /* Delete */:
14267
- case "move" /* Move */:
14268
- case "think" /* Think */:
14269
- case "fetch" /* Fetch */:
14270
- case "switch_mode" /* SwitchMode */:
14271
- case "other" /* Other */:
14281
+ case Kind.Read:
14282
+ case Kind.Edit:
14283
+ case Kind.Execute:
14284
+ case Kind.Search:
14285
+ case Kind.Delete:
14286
+ case Kind.Move:
14287
+ case Kind.Think:
14288
+ case Kind.Fetch:
14289
+ case Kind.SwitchMode:
14290
+ case Kind.Other:
14272
14291
  return kind;
14273
- case "agent" /* Agent */:
14292
+ case Kind.Agent:
14274
14293
  return "think";
14275
- case "plan" /* Plan */:
14276
- case "communicate" /* Communicate */:
14294
+ case Kind.Plan:
14295
+ case Kind.Communicate:
14277
14296
  default:
14278
14297
  return "other";
14279
14298
  }
@@ -14281,24 +14300,24 @@ function toAcpToolKind(kind) {
14281
14300
  function buildAvailableModes(isPlanEnabled) {
14282
14301
  const modes = [
14283
14302
  {
14284
- id: "default" /* DEFAULT */,
14303
+ id: ApprovalMode.DEFAULT,
14285
14304
  name: "Default",
14286
14305
  description: "Prompts for approval"
14287
14306
  },
14288
14307
  {
14289
- id: "autoEdit" /* AUTO_EDIT */,
14308
+ id: ApprovalMode.AUTO_EDIT,
14290
14309
  name: "Auto Edit",
14291
14310
  description: "Auto-approves edit tools"
14292
14311
  },
14293
14312
  {
14294
- id: "yolo" /* YOLO */,
14313
+ id: ApprovalMode.YOLO,
14295
14314
  name: "YOLO",
14296
14315
  description: "Auto-approves all tools"
14297
14316
  }
14298
14317
  ];
14299
14318
  if (isPlanEnabled) {
14300
14319
  modes.push({
14301
- id: "plan" /* PLAN */,
14320
+ id: ApprovalMode.PLAN,
14302
14321
  name: "Plan",
14303
14322
  description: "Read-only mode"
14304
14323
  });
@@ -14311,7 +14330,7 @@ function buildAvailableModels(config, settings) {
14311
14330
  const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
14312
14331
  const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
14313
14332
  const selectedAuthType = settings.merged.security.auth.selectedType;
14314
- const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
14333
+ const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
14315
14334
  if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
14316
14335
  const options = config.getModelConfigService().getAvailableModelOptions({
14317
14336
  useGemini3_1: useGemini31,
@@ -14397,11 +14416,11 @@ var Session = class {
14397
14416
  this.connection = connection;
14398
14417
  this.settings = settings;
14399
14418
  coreEvents.on(
14400
- "approval-mode-changed" /* ApprovalModeChanged */,
14419
+ CoreEvent.ApprovalModeChanged,
14401
14420
  this.handleApprovalModeChanged
14402
14421
  );
14403
14422
  this.context.config.getMessageBus()?.subscribe(
14404
- "tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
14423
+ MessageBusType.TOOL_CONFIRMATION_REQUEST,
14405
14424
  this.handleToolConfirmationRequest,
14406
14425
  { signal: this.disposeController.signal }
14407
14426
  );
@@ -14425,7 +14444,7 @@ var Session = class {
14425
14444
  "Policy engine missing. Denying tool confirmation request."
14426
14445
  );
14427
14446
  await messageBus.publish({
14428
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14447
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14429
14448
  correlationId: request.correlationId,
14430
14449
  confirmed: false,
14431
14450
  requiresUserConfirmation: false
@@ -14438,7 +14457,7 @@ var Session = class {
14438
14457
  "Tool confirmation request missing tool name. Denying."
14439
14458
  );
14440
14459
  await messageBus.publish({
14441
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14460
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14442
14461
  correlationId: request.correlationId,
14443
14462
  confirmed: false,
14444
14463
  requiresUserConfirmation: false
@@ -14451,7 +14470,7 @@ var Session = class {
14451
14470
  `Tool confirmation request for unknown tool: ${toolName}. Denying.`
14452
14471
  );
14453
14472
  await messageBus.publish({
14454
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14473
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14455
14474
  correlationId: request.correlationId,
14456
14475
  confirmed: false,
14457
14476
  requiresUserConfirmation: false
@@ -14467,15 +14486,15 @@ var Session = class {
14467
14486
  request.subagent
14468
14487
  );
14469
14488
  await messageBus.publish({
14470
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14489
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14471
14490
  correlationId: request.correlationId,
14472
- confirmed: result.decision === "allow" /* ALLOW */,
14473
- requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
14491
+ confirmed: result.decision === PolicyDecision.ALLOW,
14492
+ requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
14474
14493
  });
14475
14494
  } catch (error) {
14476
14495
  debugLogger.error("Error handling tool confirmation request:", error);
14477
14496
  await this.context.config.getMessageBus()?.publish({
14478
- type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
14497
+ type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
14479
14498
  correlationId: request.correlationId,
14480
14499
  confirmed: false,
14481
14500
  requiresUserConfirmation: false
@@ -14495,7 +14514,7 @@ var Session = class {
14495
14514
  };
14496
14515
  dispose() {
14497
14516
  coreEvents.off(
14498
- "approval-mode-changed" /* ApprovalModeChanged */,
14517
+ CoreEvent.ApprovalModeChanged,
14499
14518
  this.handleApprovalModeChanged
14500
14519
  );
14501
14520
  this.disposeController.abort();
@@ -14584,7 +14603,7 @@ ${thought.description}`;
14584
14603
  await this.sendUpdate({
14585
14604
  sessionUpdate: "tool_call",
14586
14605
  toolCallId: toolCall.id,
14587
- status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
14606
+ status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
14588
14607
  title: toolCall.displayName || toolCall.name,
14589
14608
  content: toolCallContent,
14590
14609
  kind: tool ? toAcpToolKind(tool.kind) : "other"
@@ -14676,7 +14695,7 @@ ${thought.description}`;
14676
14695
  return { stopReason: "cancelled" };
14677
14696
  }
14678
14697
  switch (event.type) {
14679
- case "content" /* Content */: {
14698
+ case GeminiEventType.Content: {
14680
14699
  const content = {
14681
14700
  type: "text",
14682
14701
  text: event.value
@@ -14687,7 +14706,7 @@ ${thought.description}`;
14687
14706
  });
14688
14707
  break;
14689
14708
  }
14690
- case "thought" /* Thought */: {
14709
+ case GeminiEventType.Thought: {
14691
14710
  const thoughtText = `**${event.value.subject}**
14692
14711
  ${event.value.description}`;
14693
14712
  await this.sendUpdate({
@@ -14696,10 +14715,10 @@ ${event.value.description}`;
14696
14715
  });
14697
14716
  break;
14698
14717
  }
14699
- case "tool_call_request" /* ToolCallRequest */:
14718
+ case GeminiEventType.ToolCallRequest:
14700
14719
  toolCallRequests.push(event.value);
14701
14720
  break;
14702
- case "finished" /* Finished */: {
14721
+ case GeminiEventType.Finished: {
14703
14722
  const usage2 = event.value.usageMetadata;
14704
14723
  if (usage2) {
14705
14724
  turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
@@ -14707,19 +14726,19 @@ ${event.value.description}`;
14707
14726
  }
14708
14727
  break;
14709
14728
  }
14710
- case "model_info" /* ModelInfo */:
14729
+ case GeminiEventType.ModelInfo:
14711
14730
  turnModelId = event.value;
14712
14731
  break;
14713
- case "max_session_turns" /* MaxSessionTurns */:
14732
+ case GeminiEventType.MaxSessionTurns:
14714
14733
  stopReason = "max_turn_requests";
14715
14734
  break;
14716
- case "loop_detected" /* LoopDetected */:
14735
+ case GeminiEventType.LoopDetected:
14717
14736
  stopReason = "max_turn_requests";
14718
14737
  break;
14719
- case "context_window_will_overflow" /* ContextWindowWillOverflow */:
14738
+ case GeminiEventType.ContextWindowWillOverflow:
14720
14739
  stopReason = "max_tokens";
14721
14740
  break;
14722
- case "error" /* Error */: {
14741
+ case GeminiEventType.Error: {
14723
14742
  const parseResult = StructuredErrorSchema.safeParse(
14724
14743
  event.value.error
14725
14744
  );
@@ -14947,7 +14966,7 @@ ${event.value.description}`;
14947
14966
  const output = RequestPermissionResponseSchema.parse(
14948
14967
  await this.connection.requestPermission(params)
14949
14968
  );
14950
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
14969
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
14951
14970
  await confirmationDetails.onConfirm(outcome);
14952
14971
  await updatePolicy(
14953
14972
  tool,
@@ -14958,16 +14977,16 @@ ${event.value.description}`;
14958
14977
  invocation
14959
14978
  );
14960
14979
  switch (outcome) {
14961
- case "cancel" /* Cancel */:
14980
+ case ToolConfirmationOutcome.Cancel:
14962
14981
  return errorResponse(
14963
14982
  new Error(`Tool "${fc.name}" was canceled by the user.`)
14964
14983
  );
14965
- case "proceed_once" /* ProceedOnce */:
14966
- case "proceed_always" /* ProceedAlways */:
14967
- case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
14968
- case "proceed_always_server" /* ProceedAlwaysServer */:
14969
- case "proceed_always_tool" /* ProceedAlwaysTool */:
14970
- case "modify_with_editor" /* ModifyWithEditor */:
14984
+ case ToolConfirmationOutcome.ProceedOnce:
14985
+ case ToolConfirmationOutcome.ProceedAlways:
14986
+ case ToolConfirmationOutcome.ProceedAlwaysAndSave:
14987
+ case ToolConfirmationOutcome.ProceedAlwaysServer:
14988
+ case ToolConfirmationOutcome.ProceedAlwaysTool:
14989
+ case ToolConfirmationOutcome.ModifyWithEditor:
14971
14990
  break;
14972
14991
  default: {
14973
14992
  const resultOutcome = outcome;
@@ -15021,7 +15040,7 @@ ${event.value.description}`;
15021
15040
  );
15022
15041
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
15023
15042
  {
15024
- status: "success" /* Success */,
15043
+ status: CoreToolCallStatus.Success,
15025
15044
  request: {
15026
15045
  callId,
15027
15046
  name: fc.name,
@@ -15066,7 +15085,7 @@ ${event.value.description}`;
15066
15085
  });
15067
15086
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
15068
15087
  {
15069
- status: "error" /* Error */,
15088
+ status: CoreToolCallStatus.Error,
15070
15089
  request: {
15071
15090
  callId,
15072
15091
  name: fc.name,
@@ -15194,12 +15213,12 @@ ${event.value.description}`;
15194
15213
  sessionId: this.id,
15195
15214
  options: [
15196
15215
  {
15197
- optionId: "proceed_once" /* ProceedOnce */,
15216
+ optionId: ToolConfirmationOutcome.ProceedOnce,
15198
15217
  name: "Allow once",
15199
15218
  kind: "allow_once"
15200
15219
  },
15201
15220
  {
15202
- optionId: "cancel" /* Cancel */,
15221
+ optionId: ToolConfirmationOutcome.Cancel,
15203
15222
  name: "Deny",
15204
15223
  kind: "reject_once"
15205
15224
  }
@@ -15224,8 +15243,8 @@ ${event.value.description}`;
15224
15243
  const output = RequestPermissionResponseSchema.parse(
15225
15244
  await this.connection.requestPermission(params)
15226
15245
  );
15227
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15228
- if (outcome === "proceed_once" /* ProceedOnce */) {
15246
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
15247
+ if (outcome === ToolConfirmationOutcome.ProceedOnce) {
15229
15248
  this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
15230
15249
  validationError = null;
15231
15250
  } else {
@@ -15662,7 +15681,7 @@ var AcpSessionManager = class {
15662
15681
  mcpServers,
15663
15682
  loadedSettings
15664
15683
  );
15665
- const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
15684
+ const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
15666
15685
  let isAuthenticated = false;
15667
15686
  let authErrorMessage = "";
15668
15687
  try {
@@ -15674,7 +15693,7 @@ var AcpSessionManager = class {
15674
15693
  );
15675
15694
  isAuthenticated = true;
15676
15695
  const contentGeneratorConfig = config.getContentGeneratorConfig();
15677
- if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
15696
+ if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
15678
15697
  isAuthenticated = false;
15679
15698
  authErrorMessage = "Gemini API key is missing or not configured.";
15680
15699
  }
@@ -15783,7 +15802,7 @@ var AcpSessionManager = class {
15783
15802
  return response;
15784
15803
  }
15785
15804
  async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
15786
- const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
15805
+ const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
15787
15806
  if (!selectedAuthType) {
15788
15807
  throw RequestError.authRequired();
15789
15808
  }
@@ -15884,12 +15903,12 @@ var GeminiAgent = class {
15884
15903
  }
15885
15904
  const authMethods = [
15886
15905
  {
15887
- id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
15906
+ id: AuthType.LOGIN_WITH_GOOGLE,
15888
15907
  name: "Log in with Google",
15889
15908
  description: "Log in with your Google account"
15890
15909
  },
15891
15910
  {
15892
- id: "gemini-api-key" /* USE_GEMINI */,
15911
+ id: AuthType.USE_GEMINI,
15893
15912
  name: "Gemini API key",
15894
15913
  description: "Use an API key with Gemini Developer API",
15895
15914
  _meta: {
@@ -15899,12 +15918,12 @@ var GeminiAgent = class {
15899
15918
  }
15900
15919
  },
15901
15920
  {
15902
- id: "vertex-ai" /* USE_VERTEX_AI */,
15921
+ id: AuthType.USE_VERTEX_AI,
15903
15922
  name: "Vertex AI",
15904
15923
  description: "Use an API key with Vertex AI GenAI API"
15905
15924
  },
15906
15925
  {
15907
- id: "gateway" /* GATEWAY */,
15926
+ id: AuthType.GATEWAY,
15908
15927
  name: "AI API Gateway",
15909
15928
  description: "Use a custom AI API Gateway",
15910
15929
  _meta: {
@@ -16077,7 +16096,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
16077
16096
  }
16078
16097
  return authType;
16079
16098
  } catch (error) {
16080
- if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
16099
+ if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
16081
16100
  handleError(
16082
16101
  error instanceof Error ? error : new Error(String(error)),
16083
16102
  nonInteractiveConfig,
@@ -16272,10 +16291,10 @@ var SlashCommandConflictHandler = class {
16272
16291
  this.handleConflicts = this.handleConflicts.bind(this);
16273
16292
  }
16274
16293
  start() {
16275
- coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
16294
+ coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
16276
16295
  }
16277
16296
  stop() {
16278
- coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
16297
+ coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
16279
16298
  if (this.flushTimeout) {
16280
16299
  clearTimeout(this.flushTimeout);
16281
16300
  this.flushTimeout = null;
@@ -16556,7 +16575,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
16556
16575
  }
16557
16576
  }
16558
16577
  async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
16559
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-F5YXG24U.js");
16578
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-L3ZXOVEV.js");
16560
16579
  await doStartUI(
16561
16580
  config,
16562
16581
  settings,
@@ -16659,12 +16678,12 @@ async function main() {
16659
16678
  dns.setDefaultResultOrder(
16660
16679
  validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
16661
16680
  );
16662
- if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
16681
+ if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
16663
16682
  if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
16664
16683
  settings.setValue(
16665
16684
  "User" /* User */,
16666
16685
  "security.auth.selectedType",
16667
- "compute-default-credentials" /* COMPUTE_ADC */
16686
+ AuthType.COMPUTE_ADC
16668
16687
  );
16669
16688
  }
16670
16689
  }
@@ -16765,7 +16784,7 @@ ${finalArgs[promptIndex + 1]}`;
16765
16784
  await config.storage.initialize();
16766
16785
  adminControlsListner.setConfig(config);
16767
16786
  if (config.isInteractive() && settings.merged.general.devtools) {
16768
- const { setupInitialActivityLogger } = await import("./devtoolsService-KFURCXJN.js");
16787
+ const { setupInitialActivityLogger } = await import("./devtoolsService-GU2GQSOF.js");
16769
16788
  setupInitialActivityLogger(config);
16770
16789
  }
16771
16790
  registerTelemetryConfig(config);
@@ -16773,7 +16792,7 @@ ${finalArgs[promptIndex + 1]}`;
16773
16792
  const messageBus = config.getMessageBus();
16774
16793
  createPolicyUpdater2(policyEngine, messageBus, config.storage);
16775
16794
  registerCleanup(async () => {
16776
- await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
16795
+ await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
16777
16796
  });
16778
16797
  if (!config.getAcpMode()) {
16779
16798
  registerCleanup(consolePatcher.cleanup);
@@ -16824,7 +16843,7 @@ ${finalArgs[promptIndex + 1]}`;
16824
16843
  const initAppHandle = startupProfiler.start("initialize_app");
16825
16844
  const initializationResult = await initializeApp(config, settings);
16826
16845
  initAppHandle?.end();
16827
- import("./liteRtServerManager-DMTHAOJH.js").then(({ LiteRtServerManager }) => {
16846
+ import("./liteRtServerManager-C5WZRQUF.js").then(({ LiteRtServerManager }) => {
16828
16847
  const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
16829
16848
  if (!mergedGemma) return;
16830
16849
  const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
@@ -16834,7 +16853,7 @@ ${finalArgs[promptIndex + 1]}`;
16834
16853
  autoStartServer: userGemma?.autoStartServer
16835
16854
  });
16836
16855
  }).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
16837
- if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
16856
+ if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
16838
16857
  await getOauthClient(settings.merged.security.auth.selectedType, config);
16839
16858
  }
16840
16859
  if (config.getAcpMode()) {
@@ -16850,7 +16869,7 @@ ${finalArgs[promptIndex + 1]}`;
16850
16869
  ...rawStartupWarnings.map((message) => ({
16851
16870
  id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
16852
16871
  message,
16853
- priority: "high" /* High */
16872
+ priority: WarningPriority.High
16854
16873
  })),
16855
16874
  ...await getUserStartupWarnings(settings.merged, void 0, {
16856
16875
  isAlternateBuffer: useAlternateBuffer
@@ -16887,7 +16906,7 @@ ${finalArgs[promptIndex + 1]}`;
16887
16906
  ${input}` : stdinData;
16888
16907
  }
16889
16908
  }
16890
- const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
16909
+ const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
16891
16910
  const hookSystem = config?.getHookSystem();
16892
16911
  if (hookSystem) {
16893
16912
  const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
@@ -16944,8 +16963,8 @@ ${input}` : wrappedContext;
16944
16963
  }
16945
16964
  }
16946
16965
  function initializeOutputListenersAndFlush(config) {
16947
- if (coreEvents.listenerCount("output" /* Output */) === 0) {
16948
- coreEvents.on("output" /* Output */, (payload) => {
16966
+ if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
16967
+ coreEvents.on(CoreEvent.Output, (payload) => {
16949
16968
  if (payload.isStderr) {
16950
16969
  writeToStderr(payload.chunk, payload.encoding);
16951
16970
  } else {
@@ -16953,8 +16972,8 @@ function initializeOutputListenersAndFlush(config) {
16953
16972
  }
16954
16973
  });
16955
16974
  }
16956
- if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
16957
- coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
16975
+ if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
16976
+ coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
16958
16977
  if (payload.type === "error" || payload.type === "warn") {
16959
16978
  writeToStderr(payload.content + "\n");
16960
16979
  } else {
@@ -16962,8 +16981,8 @@ function initializeOutputListenersAndFlush(config) {
16962
16981
  }
16963
16982
  });
16964
16983
  }
16965
- if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
16966
- coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
16984
+ if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
16985
+ coreEvents.on(CoreEvent.UserFeedback, (payload) => {
16967
16986
  writeToStderr(payload.message + "\n");
16968
16987
  });
16969
16988
  }
@@ -16971,7 +16990,7 @@ function initializeOutputListenersAndFlush(config) {
16971
16990
  const forceToStderr = outputFormat === "json";
16972
16991
  coreEvents.drainBacklogs(
16973
16992
  (event, args) => {
16974
- if (forceToStderr && event === "output" /* Output */) {
16993
+ if (forceToStderr && event === CoreEvent.Output) {
16975
16994
  const payload = args[0];
16976
16995
  if (!payload.isStderr) {
16977
16996
  return {