@google/gemini-cli 0.39.0-preview.0 → 0.39.0-preview.2

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 (40) hide show
  1. package/bundle/{chunk-NMO6M2JW.js → chunk-3R2FLB3Z.js} +4 -4
  2. package/bundle/{chunk-UCJYTRQH.js → chunk-45GIY5RT.js} +1 -1
  3. package/bundle/{chunk-CB4IHCOV.js → chunk-4UUOHXDW.js} +354 -296
  4. package/bundle/{chunk-ZFUMNFZD.js → chunk-5J5LWISO.js} +6536 -11870
  5. package/bundle/{chunk-DY3XSEN6.js → chunk-AZ7QQWNX.js} +2 -2
  6. package/bundle/{chunk-L5FKR6GE.js → chunk-GX4YOB7T.js} +4 -4
  7. package/bundle/{chunk-KMWY7IVQ.js → chunk-N3GUGFOL.js} +72 -60
  8. package/bundle/chunk-OXCH4FS3.js +360288 -0
  9. package/bundle/{chunk-5ZBBJS2A.js → chunk-QC6EGBZW.js} +1 -1
  10. package/bundle/chunk-RTX4LTWK.js +101702 -0
  11. package/bundle/chunk-SS4CWRZ5.js +156 -0
  12. package/bundle/{chunk-LF246RTE.js → chunk-TKGFTY3B.js} +404 -307
  13. package/bundle/{cleanup-INA6FKQG.js → cleanup-3EICKDDN.js} +2 -2
  14. package/bundle/{cleanup-DKDGF4IA.js → cleanup-4SLYOL44.js} +3 -3
  15. package/bundle/{cleanup-B7STSNY5.js → cleanup-6N6E742H.js} +2 -2
  16. package/bundle/cleanup-OG2MXKZ7.js +33 -0
  17. package/bundle/{core-6MCGZ334.js → core-KLYK3V6Z.js} +3 -1
  18. package/bundle/{devtoolsService-QN4BQSIF.js → devtoolsService-FS7WXGBF.js} +2 -2
  19. package/bundle/{devtoolsService-BXBCDCC2.js → devtoolsService-K4DENTYF.js} +2 -2
  20. package/bundle/{devtoolsService-DDDJINQW.js → devtoolsService-RLXZWLDT.js} +5 -4
  21. package/bundle/devtoolsService-X4577PYZ.js +871 -0
  22. package/bundle/{dist-2M52ZJGU.js → dist-5ET5G5PC.js} +3 -1
  23. package/bundle/{core-MYQB6KXT.js → dist-DQVXGLSO.js} +4 -2
  24. package/bundle/dist-P4XAO4SC.js +2010 -0
  25. package/bundle/docs/cli/plan-mode.md +1 -2
  26. package/bundle/{gemini-TS2LMZH4.js → gemini-6GWCDHXK.js} +8 -8
  27. package/bundle/{gemini-BA3BDBJT.js → gemini-FLGPH5GJ.js} +8 -8
  28. package/bundle/{gemini-JFTJVXU4.js → gemini-NBKLSVA3.js} +184 -169
  29. package/bundle/gemini-YOFQ5KF4.js +15321 -0
  30. package/bundle/gemini.js +3 -3
  31. package/bundle/{interactiveCli-7ZBDFPFP.js → interactiveCli-AGSLCKNH.js} +6 -5
  32. package/bundle/{interactiveCli-W43ANBCL.js → interactiveCli-H3NLGP7Z.js} +6 -5
  33. package/bundle/{interactiveCli-K6QHA2GI.js → interactiveCli-NAPN3E2K.js} +277 -259
  34. package/bundle/interactiveCli-TCZBSTKU.js +34493 -0
  35. package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
  36. package/bundle/{oauth2-provider-53ZABNLX.js → oauth2-provider-CWUR5RGE.js} +1 -1
  37. package/bundle/{oauth2-provider-T4YYJWZG.js → oauth2-provider-EA452S4C.js} +39 -73
  38. package/bundle/oauth2-provider-LV6VPYTU.js +237 -0
  39. package/bundle/{oauth2-provider-3YCIQHIN.js → oauth2-provider-YKYTKUWD.js} +1 -1
  40. package/package.json +1 -1
@@ -58,7 +58,7 @@ import {
58
58
  updateAllUpdatableExtensions,
59
59
  updateExtension,
60
60
  validateAuthMethod
61
- } from "./chunk-NMO6M2JW.js";
61
+ } from "./chunk-N3GUGFOL.js";
62
62
  import {
63
63
  appEvents
64
64
  } from "./chunk-5PS3AYFU.js";
@@ -70,32 +70,43 @@ import {
70
70
  runExitCleanup,
71
71
  runSyncCleanup,
72
72
  setupSignalHandlers
73
- } from "./chunk-DY3XSEN6.js";
73
+ } from "./chunk-SS4CWRZ5.js";
74
74
  import {
75
75
  AuthType,
76
76
  ChatRecordingService,
77
77
  Client,
78
78
  Config,
79
+ CoreToolCallStatus,
79
80
  ExitCodes,
80
81
  FileDiscoveryService,
81
82
  FolderTrustDiscoveryService,
83
+ GeminiEventType,
82
84
  IdeClient,
85
+ IntegrityStatus,
83
86
  InvalidStreamError,
84
87
  JsonFormatter,
88
+ JsonStreamEventType,
85
89
  LegacyAgentSession,
90
+ LlmRole,
86
91
  Logger,
87
92
  MCPServerConfig,
93
+ MCPServerStatus,
94
+ OutputFormat,
88
95
  PolicyIntegrityManager,
89
96
  ROOT_SCHEDULER_ID,
90
97
  ReadManyFilesTool,
91
98
  Scheduler,
99
+ SessionEndReason,
100
+ SessionStartSource,
92
101
  ShellExecutionService,
102
+ StreamEventType,
93
103
  StreamJsonFormatter,
94
104
  ToolCallEvent,
95
105
  UserAccountManager,
96
106
  UserPromptEvent,
97
107
  ValidationCancelledError,
98
108
  ValidationRequiredError,
109
+ WarningPriority,
99
110
  addMemory,
100
111
  applyAdminAllowlist,
101
112
  applyRequiredServers,
@@ -156,9 +167,11 @@ import {
156
167
  updatePolicy,
157
168
  writeToStderr,
158
169
  writeToStdout
159
- } from "./chunk-LF246RTE.js";
170
+ } from "./chunk-5J5LWISO.js";
160
171
  import {
161
172
  ASK_USER_TOOL_NAME,
173
+ ApprovalMode,
174
+ CoreEvent,
162
175
  DEFAULT_FILE_FILTERING_OPTIONS,
163
176
  DEFAULT_GEMINI_EMBEDDING_MODEL,
164
177
  DEFAULT_GEMINI_FLASH_LITE_MODEL,
@@ -177,6 +190,7 @@ import {
177
190
  FatalTurnLimitedError,
178
191
  GEMINI_DIR,
179
192
  GEMINI_MODEL_ALIAS_AUTO,
193
+ Kind,
180
194
  PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
181
195
  PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
182
196
  PREVIEW_GEMINI_3_1_MODEL,
@@ -186,6 +200,7 @@ import {
186
200
  REFERENCE_CONTENT_START,
187
201
  Storage,
188
202
  ToolConfirmationOutcome,
203
+ ToolErrorType,
189
204
  coreEvents,
190
205
  debugLogger,
191
206
  external_exports,
@@ -199,7 +214,7 @@ import {
199
214
  loadServerHierarchicalMemory,
200
215
  resolveToRealPath,
201
216
  setGeminiMdFilename
202
- } from "./chunk-QM5IP3NK.js";
217
+ } from "./chunk-67TFD6HC.js";
203
218
  import "./chunk-664ZODQF.js";
204
219
  import "./chunk-RJTRUG2J.js";
205
220
  import "./chunk-IUUIT4SU.js";
@@ -5490,7 +5505,7 @@ async function getMcpServersFromConfig(settings) {
5490
5505
  async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
5491
5506
  const isStdio = !!config.command;
5492
5507
  if (isStdio && !isTrusted) {
5493
- return "disconnected" /* DISCONNECTED */;
5508
+ return MCPServerStatus.DISCONNECTED;
5494
5509
  }
5495
5510
  const client = new Client({
5496
5511
  name: "mcp-test-client",
@@ -5526,16 +5541,16 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5526
5541
  transport = await createTransport(serverName, config, false, mcpContext);
5527
5542
  } catch {
5528
5543
  await client.close();
5529
- return "disconnected" /* DISCONNECTED */;
5544
+ return MCPServerStatus.DISCONNECTED;
5530
5545
  }
5531
5546
  try {
5532
5547
  await client.connect(transport, { timeout: 5e3 });
5533
5548
  await client.ping();
5534
5549
  await client.close();
5535
- return "connected" /* CONNECTED */;
5550
+ return MCPServerStatus.CONNECTED;
5536
5551
  } catch {
5537
5552
  await transport.close();
5538
- return "disconnected" /* DISCONNECTED */;
5553
+ return MCPServerStatus.DISCONNECTED;
5539
5554
  }
5540
5555
  }
5541
5556
  async function getServerStatus(serverName, server, isTrusted, activeSettings) {
@@ -5548,9 +5563,9 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
5548
5563
  });
5549
5564
  if (!loadResult.allowed) {
5550
5565
  if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
5551
- return "blocked" /* BLOCKED */;
5566
+ return MCPServerStatus.BLOCKED;
5552
5567
  }
5553
- return "disabled" /* DISABLED */;
5568
+ return MCPServerStatus.DISABLED;
5554
5569
  }
5555
5570
  return testMCPConnection(serverName, server, isTrusted, activeSettings);
5556
5571
  }
@@ -5584,23 +5599,23 @@ async function listMcpServers(loadedSettingsArg) {
5584
5599
  let statusIndicator = "";
5585
5600
  let statusText = "";
5586
5601
  switch (status) {
5587
- case "connected" /* CONNECTED */:
5602
+ case MCPServerStatus.CONNECTED:
5588
5603
  statusIndicator = import_chalk.default.green("\u2713");
5589
5604
  statusText = "Connected";
5590
5605
  break;
5591
- case "connecting" /* CONNECTING */:
5606
+ case MCPServerStatus.CONNECTING:
5592
5607
  statusIndicator = import_chalk.default.yellow("\u2026");
5593
5608
  statusText = "Connecting";
5594
5609
  break;
5595
- case "blocked" /* BLOCKED */:
5610
+ case MCPServerStatus.BLOCKED:
5596
5611
  statusIndicator = import_chalk.default.red("\u26D4");
5597
5612
  statusText = "Blocked";
5598
5613
  break;
5599
- case "disabled" /* DISABLED */:
5614
+ case MCPServerStatus.DISABLED:
5600
5615
  statusIndicator = import_chalk.default.gray("\u25CB");
5601
5616
  statusText = "Disabled";
5602
5617
  break;
5603
- case "disconnected" /* DISCONNECTED */:
5618
+ case MCPServerStatus.DISCONNECTED:
5604
5619
  default:
5605
5620
  statusIndicator = import_chalk.default.red("\u2717");
5606
5621
  statusText = "Disconnected";
@@ -7250,7 +7265,7 @@ async function loadSandboxConfig(settings, argv) {
7250
7265
  }
7251
7266
  const command2 = getSandboxCommand(sandboxValue);
7252
7267
  const packageJson = await getPackageJson(__dirname3);
7253
- const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.39.0-nightly.20260408.e77b22e63" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7268
+ const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.39.0-preview.2" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7254
7269
  const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
7255
7270
  return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
7256
7271
  }
@@ -7309,9 +7324,9 @@ async function resolveWorkspacePolicyState(options) {
7309
7324
  cwd,
7310
7325
  potentialWorkspacePoliciesDir
7311
7326
  );
7312
- if (integrityResult.status === "MATCH" /* MATCH */) {
7327
+ if (integrityResult.status === IntegrityStatus.MATCH) {
7313
7328
  workspacePoliciesDir = potentialWorkspacePoliciesDir;
7314
- } else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
7329
+ } else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
7315
7330
  workspacePoliciesDir = void 0;
7316
7331
  } else if (interactive && !autoAcceptWorkspacePolicies) {
7317
7332
  policyUpdateConfirmationRequest = {
@@ -7705,23 +7720,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7705
7720
  if (rawApprovalMode) {
7706
7721
  switch (rawApprovalMode) {
7707
7722
  case "yolo":
7708
- approvalMode = "yolo" /* YOLO */;
7723
+ approvalMode = ApprovalMode.YOLO;
7709
7724
  break;
7710
7725
  case "auto_edit":
7711
- approvalMode = "autoEdit" /* AUTO_EDIT */;
7726
+ approvalMode = ApprovalMode.AUTO_EDIT;
7712
7727
  break;
7713
7728
  case "plan":
7714
7729
  if (!(settings.general?.plan?.enabled ?? true)) {
7715
7730
  debugLogger.warn(
7716
7731
  'Approval mode "plan" is disabled in your settings. Falling back to "default".'
7717
7732
  );
7718
- approvalMode = "default" /* DEFAULT */;
7733
+ approvalMode = ApprovalMode.DEFAULT;
7719
7734
  } else {
7720
- approvalMode = "plan" /* PLAN */;
7735
+ approvalMode = ApprovalMode.PLAN;
7721
7736
  }
7722
7737
  break;
7723
7738
  case "default":
7724
- approvalMode = "default" /* DEFAULT */;
7739
+ approvalMode = ApprovalMode.DEFAULT;
7725
7740
  break;
7726
7741
  default:
7727
7742
  throw new Error(
@@ -7729,10 +7744,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7729
7744
  );
7730
7745
  }
7731
7746
  } else {
7732
- approvalMode = "default" /* DEFAULT */;
7747
+ approvalMode = ApprovalMode.DEFAULT;
7733
7748
  }
7734
7749
  if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
7735
- if (approvalMode === "yolo" /* YOLO */) {
7750
+ if (approvalMode === ApprovalMode.YOLO) {
7736
7751
  if (settings.admin?.secureModeEnabled) {
7737
7752
  debugLogger.error(
7738
7753
  'YOLO mode is disabled by "secureModeEnabled" setting.'
@@ -7750,16 +7765,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7750
7765
  )
7751
7766
  );
7752
7767
  }
7753
- } else if (approvalMode === "yolo" /* YOLO */) {
7768
+ } else if (approvalMode === ApprovalMode.YOLO) {
7754
7769
  debugLogger.warn(
7755
7770
  "YOLO mode is enabled. All tool calls will be automatically approved."
7756
7771
  );
7757
7772
  }
7758
- if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
7773
+ if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
7759
7774
  debugLogger.warn(
7760
7775
  `Approval mode overridden to "default" because the current folder is not trusted.`
7761
7776
  );
7762
- approvalMode = "default" /* DEFAULT */;
7777
+ approvalMode = ApprovalMode.DEFAULT;
7763
7778
  }
7764
7779
  let telemetrySettings;
7765
7780
  try {
@@ -9142,7 +9157,7 @@ import path8 from "node:path";
9142
9157
  import process4 from "node:process";
9143
9158
  var homeDirectoryCheck = {
9144
9159
  id: "home-directory",
9145
- priority: "low" /* Low */,
9160
+ priority: WarningPriority.Low,
9146
9161
  check: async (workspaceRoot, settings) => {
9147
9162
  if (settings.ui?.showHomeDirectoryWarning === false) {
9148
9163
  return null;
@@ -9166,7 +9181,7 @@ var homeDirectoryCheck = {
9166
9181
  };
9167
9182
  var rootDirectoryCheck = {
9168
9183
  id: "root-directory",
9169
- priority: "high" /* High */,
9184
+ priority: WarningPriority.High,
9170
9185
  check: async (workspaceRoot, _settings) => {
9171
9186
  try {
9172
9187
  const workspaceRealPath = await fs6.realpath(workspaceRoot);
@@ -9350,12 +9365,12 @@ function handleError(error, config, customErrorCode) {
9350
9365
  error,
9351
9366
  config.getContentGeneratorConfig()?.authType
9352
9367
  );
9353
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
9368
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
9354
9369
  const streamFormatter = new StreamJsonFormatter();
9355
9370
  const errorCode = customErrorCode ?? extractErrorCode(error);
9356
9371
  const metrics = uiTelemetryService.getMetrics();
9357
9372
  streamFormatter.emitEvent({
9358
- type: "result" /* RESULT */,
9373
+ type: JsonStreamEventType.RESULT,
9359
9374
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9360
9375
  status: "error",
9361
9376
  error: {
@@ -9366,7 +9381,7 @@ function handleError(error, config, customErrorCode) {
9366
9381
  });
9367
9382
  runSyncCleanup();
9368
9383
  process.exit(getNumericExitCode(errorCode));
9369
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9384
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9370
9385
  const formatter = new JsonFormatter();
9371
9386
  const errorCode = customErrorCode ?? extractErrorCode(error);
9372
9387
  const formattedError = formatter.formatError(
@@ -9386,11 +9401,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
9386
9401
  const isFatal = isFatalToolError(errorType);
9387
9402
  if (isFatal) {
9388
9403
  const toolExecutionError = new FatalToolExecutionError(errorMessage);
9389
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
9404
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
9390
9405
  const streamFormatter = new StreamJsonFormatter();
9391
9406
  const metrics = uiTelemetryService.getMetrics();
9392
9407
  streamFormatter.emitEvent({
9393
- type: "result" /* RESULT */,
9408
+ type: JsonStreamEventType.RESULT,
9394
9409
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9395
9410
  status: "error",
9396
9411
  error: {
@@ -9399,7 +9414,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
9399
9414
  },
9400
9415
  stats: streamFormatter.convertToStreamStats(metrics, 0)
9401
9416
  });
9402
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9417
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9403
9418
  const formatter = new JsonFormatter();
9404
9419
  const formattedError = formatter.formatError(
9405
9420
  toolExecutionError,
@@ -9417,11 +9432,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
9417
9432
  }
9418
9433
  function handleCancellationError(config) {
9419
9434
  const cancellationError = new FatalCancellationError("Operation cancelled.");
9420
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
9435
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
9421
9436
  const streamFormatter = new StreamJsonFormatter();
9422
9437
  const metrics = uiTelemetryService.getMetrics();
9423
9438
  streamFormatter.emitEvent({
9424
- type: "result" /* RESULT */,
9439
+ type: JsonStreamEventType.RESULT,
9425
9440
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9426
9441
  status: "error",
9427
9442
  error: {
@@ -9432,7 +9447,7 @@ function handleCancellationError(config) {
9432
9447
  });
9433
9448
  runSyncCleanup();
9434
9449
  process.exit(cancellationError.exitCode);
9435
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9450
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9436
9451
  const formatter = new JsonFormatter();
9437
9452
  const formattedError = formatter.formatError(
9438
9453
  cancellationError,
@@ -9452,11 +9467,11 @@ function handleMaxTurnsExceededError(config) {
9452
9467
  const maxTurnsError = new FatalTurnLimitedError(
9453
9468
  "Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
9454
9469
  );
9455
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
9470
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
9456
9471
  const streamFormatter = new StreamJsonFormatter();
9457
9472
  const metrics = uiTelemetryService.getMetrics();
9458
9473
  streamFormatter.emitEvent({
9459
- type: "result" /* RESULT */,
9474
+ type: JsonStreamEventType.RESULT,
9460
9475
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9461
9476
  status: "error",
9462
9477
  error: {
@@ -9467,7 +9482,7 @@ function handleMaxTurnsExceededError(config) {
9467
9482
  });
9468
9483
  runSyncCleanup();
9469
9484
  process.exit(maxTurnsError.exitCode);
9470
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9485
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9471
9486
  const formatter = new JsonFormatter();
9472
9487
  const formattedError = formatter.formatError(
9473
9488
  maxTurnsError,
@@ -9547,7 +9562,7 @@ async function runNonInteractive({
9547
9562
  }
9548
9563
  });
9549
9564
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
9550
- const { setupInitialActivityLogger } = await import("./devtoolsService-DDDJINQW.js");
9565
+ const { setupInitialActivityLogger } = await import("./devtoolsService-X4577PYZ.js");
9551
9566
  await setupInitialActivityLogger(config);
9552
9567
  }
9553
9568
  const { stdout: workingStdout } = createWorkingStdio();
@@ -9563,7 +9578,7 @@ async function runNonInteractive({
9563
9578
  }
9564
9579
  };
9565
9580
  const startTime = Date.now();
9566
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
9581
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
9567
9582
  const abortController = new AbortController();
9568
9583
  let isAborting = false;
9569
9584
  let cancelMessageTimer = null;
@@ -9616,13 +9631,13 @@ async function runNonInteractive({
9616
9631
  };
9617
9632
  try {
9618
9633
  consolePatcher.patch();
9619
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
9634
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
9620
9635
  process.stderr.write(
9621
9636
  "[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"
9622
9637
  );
9623
9638
  }
9624
9639
  setupStdinCancellation();
9625
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
9640
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
9626
9641
  coreEvents.drainBacklogs();
9627
9642
  process.stdout.on("error", (err) => {
9628
9643
  if (err.code === "EPIPE") {
@@ -9648,7 +9663,7 @@ async function runNonInteractive({
9648
9663
  }
9649
9664
  if (streamFormatter) {
9650
9665
  streamFormatter.emitEvent({
9651
- type: "init" /* INIT */,
9666
+ type: JsonStreamEventType.INIT,
9652
9667
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9653
9668
  session_id: config.getSessionId(),
9654
9669
  model: config.getModel()
@@ -9686,7 +9701,7 @@ async function runNonInteractive({
9686
9701
  }
9687
9702
  if (streamFormatter) {
9688
9703
  streamFormatter.emitEvent({
9689
- type: "message" /* MESSAGE */,
9704
+ type: JsonStreamEventType.MESSAGE,
9690
9705
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9691
9706
  role: "user",
9692
9707
  content: input
@@ -9725,12 +9740,12 @@ async function runNonInteractive({
9725
9740
  const metrics = uiTelemetryService.getMetrics();
9726
9741
  const durationMs = Date.now() - startTime;
9727
9742
  streamFormatter.emitEvent({
9728
- type: "result" /* RESULT */,
9743
+ type: JsonStreamEventType.RESULT,
9729
9744
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9730
9745
  status: "success",
9731
9746
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
9732
9747
  });
9733
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9748
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9734
9749
  const formatter = new JsonFormatter();
9735
9750
  const stats = uiTelemetryService.getMetrics();
9736
9751
  textOutput.write(
@@ -9816,13 +9831,13 @@ async function runNonInteractive({
9816
9831
  const output = isRaw ? part.text : stripAnsi(part.text);
9817
9832
  if (streamFormatter) {
9818
9833
  streamFormatter.emitEvent({
9819
- type: "message" /* MESSAGE */,
9834
+ type: JsonStreamEventType.MESSAGE,
9820
9835
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9821
9836
  role: "assistant",
9822
9837
  content: output,
9823
9838
  delta: true
9824
9839
  });
9825
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9840
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9826
9841
  responseText += output;
9827
9842
  } else {
9828
9843
  if (part.text) {
@@ -9835,13 +9850,13 @@ async function runNonInteractive({
9835
9850
  break;
9836
9851
  }
9837
9852
  case "tool_request": {
9838
- if (config.getOutputFormat() === "json" /* JSON */) {
9853
+ if (config.getOutputFormat() === OutputFormat.JSON) {
9839
9854
  preToolResponseText = responseText || preToolResponseText;
9840
9855
  responseText = "";
9841
9856
  }
9842
9857
  if (streamFormatter) {
9843
9858
  streamFormatter.emitEvent({
9844
- type: "tool_use" /* TOOL_USE */,
9859
+ type: JsonStreamEventType.TOOL_USE,
9845
9860
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9846
9861
  tool_name: event.name,
9847
9862
  tool_id: event.requestId,
@@ -9857,7 +9872,7 @@ async function runNonInteractive({
9857
9872
  const displayText = displayContentToString(display);
9858
9873
  const errorMsg = getTextContent(event.content) ?? "Tool error";
9859
9874
  streamFormatter.emitEvent({
9860
- type: "tool_result" /* TOOL_RESULT */,
9875
+ type: JsonStreamEventType.TOOL_RESULT,
9861
9876
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9862
9877
  tool_id: event.requestId,
9863
9878
  status: event.isError ? "error" : "success",
@@ -9872,17 +9887,17 @@ async function runNonInteractive({
9872
9887
  const display = event.display?.result;
9873
9888
  const displayText = displayContentToString(display);
9874
9889
  const errorMsg = getTextContent(event.content) ?? "Tool error";
9875
- if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
9876
- if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
9890
+ if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
9891
+ if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
9877
9892
  responseText = preToolResponseText;
9878
9893
  }
9879
9894
  const stopMessage = `Agent execution stopped: ${errorMsg}`;
9880
- if (config.getOutputFormat() === "text" /* TEXT */) {
9895
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
9881
9896
  process.stderr.write(`${stopMessage}
9882
9897
  `);
9883
9898
  }
9884
9899
  }
9885
- if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
9900
+ if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
9886
9901
  throw new FatalToolExecutionError(
9887
9902
  "Error executing tool " + event.name + ": " + (displayText || errorMsg)
9888
9903
  );
@@ -9903,20 +9918,20 @@ async function runNonInteractive({
9903
9918
  }
9904
9919
  const errorCode = event._meta?.["code"];
9905
9920
  if (errorCode === "AGENT_EXECUTION_BLOCKED") {
9906
- if (config.getOutputFormat() === "text" /* TEXT */) {
9921
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
9907
9922
  process.stderr.write(`[WARNING] ${event.message}
9908
9923
  `);
9909
9924
  }
9910
9925
  break;
9911
9926
  }
9912
9927
  const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
9913
- if (config.getOutputFormat() === "text" /* TEXT */) {
9928
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
9914
9929
  process.stderr.write(`[WARNING] ${event.message}
9915
9930
  `);
9916
9931
  }
9917
9932
  if (streamFormatter) {
9918
9933
  streamFormatter.emitEvent({
9919
- type: "error" /* ERROR */,
9934
+ type: JsonStreamEventType.ERROR,
9920
9935
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9921
9936
  severity,
9922
9937
  message: event.message
@@ -9935,7 +9950,7 @@ async function runNonInteractive({
9935
9950
  );
9936
9951
  } else if (streamFormatter) {
9937
9952
  streamFormatter.emitEvent({
9938
- type: "error" /* ERROR */,
9953
+ type: JsonStreamEventType.ERROR,
9939
9954
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9940
9955
  severity: "error",
9941
9956
  message: "Maximum session turns exceeded"
@@ -9943,7 +9958,7 @@ async function runNonInteractive({
9943
9958
  }
9944
9959
  }
9945
9960
  const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
9946
- if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
9961
+ if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
9947
9962
  process.stderr.write(`Agent execution stopped: ${stopMessage}
9948
9963
  `);
9949
9964
  }
@@ -9973,7 +9988,7 @@ async function runNonInteractive({
9973
9988
  abortController.signal.removeEventListener("abort", abortSession);
9974
9989
  scheduler?.dispose();
9975
9990
  consolePatcher.cleanup();
9976
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
9991
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
9977
9992
  }
9978
9993
  if (errorToHandle) {
9979
9994
  handleError(errorToHandle, config);
@@ -9998,7 +10013,7 @@ async function runNonInteractive2(params) {
9998
10013
  }
9999
10014
  });
10000
10015
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
10001
- const { setupInitialActivityLogger } = await import("./devtoolsService-DDDJINQW.js");
10016
+ const { setupInitialActivityLogger } = await import("./devtoolsService-X4577PYZ.js");
10002
10017
  await setupInitialActivityLogger(config);
10003
10018
  }
10004
10019
  const { stdout: workingStdout } = createWorkingStdio();
@@ -10014,7 +10029,7 @@ async function runNonInteractive2(params) {
10014
10029
  }
10015
10030
  };
10016
10031
  const startTime = Date.now();
10017
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
10032
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
10018
10033
  const abortController = new AbortController();
10019
10034
  let isAborting = false;
10020
10035
  let cancelMessageTimer = null;
@@ -10065,13 +10080,13 @@ async function runNonInteractive2(params) {
10065
10080
  let scheduler;
10066
10081
  try {
10067
10082
  consolePatcher.patch();
10068
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
10083
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
10069
10084
  process.stderr.write(
10070
10085
  "[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"
10071
10086
  );
10072
10087
  }
10073
10088
  setupStdinCancellation();
10074
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
10089
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
10075
10090
  coreEvents.drainBacklogs();
10076
10091
  process.stdout.on("error", (err) => {
10077
10092
  if (err.code === "EPIPE") {
@@ -10095,7 +10110,7 @@ async function runNonInteractive2(params) {
10095
10110
  }
10096
10111
  if (streamFormatter) {
10097
10112
  streamFormatter.emitEvent({
10098
- type: "init" /* INIT */,
10113
+ type: JsonStreamEventType.INIT,
10099
10114
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10100
10115
  session_id: config.getSessionId(),
10101
10116
  model: config.getModel()
@@ -10133,7 +10148,7 @@ async function runNonInteractive2(params) {
10133
10148
  }
10134
10149
  if (streamFormatter) {
10135
10150
  streamFormatter.emitEvent({
10136
- type: "message" /* MESSAGE */,
10151
+ type: JsonStreamEventType.MESSAGE,
10137
10152
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10138
10153
  role: "user",
10139
10154
  content: input
@@ -10160,28 +10175,28 @@ async function runNonInteractive2(params) {
10160
10175
  if (abortController.signal.aborted) {
10161
10176
  handleCancellationError(config);
10162
10177
  }
10163
- if (event.type === "content" /* Content */) {
10178
+ if (event.type === GeminiEventType.Content) {
10164
10179
  const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
10165
10180
  const output = isRaw ? event.value : stripAnsi(event.value);
10166
10181
  if (streamFormatter) {
10167
10182
  streamFormatter.emitEvent({
10168
- type: "message" /* MESSAGE */,
10183
+ type: JsonStreamEventType.MESSAGE,
10169
10184
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10170
10185
  role: "assistant",
10171
10186
  content: output,
10172
10187
  delta: true
10173
10188
  });
10174
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10189
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10175
10190
  responseText += output;
10176
10191
  } else {
10177
10192
  if (event.value) {
10178
10193
  textOutput.write(output);
10179
10194
  }
10180
10195
  }
10181
- } else if (event.type === "tool_call_request" /* ToolCallRequest */) {
10196
+ } else if (event.type === GeminiEventType.ToolCallRequest) {
10182
10197
  if (streamFormatter) {
10183
10198
  streamFormatter.emitEvent({
10184
- type: "tool_use" /* TOOL_USE */,
10199
+ type: JsonStreamEventType.TOOL_USE,
10185
10200
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10186
10201
  tool_name: event.value.name,
10187
10202
  tool_id: event.value.callId,
@@ -10189,29 +10204,29 @@ async function runNonInteractive2(params) {
10189
10204
  });
10190
10205
  }
10191
10206
  toolCallRequests.push(event.value);
10192
- } else if (event.type === "loop_detected" /* LoopDetected */) {
10207
+ } else if (event.type === GeminiEventType.LoopDetected) {
10193
10208
  if (streamFormatter) {
10194
10209
  streamFormatter.emitEvent({
10195
- type: "error" /* ERROR */,
10210
+ type: JsonStreamEventType.ERROR,
10196
10211
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10197
10212
  severity: "warning",
10198
10213
  message: "Loop detected, stopping execution"
10199
10214
  });
10200
10215
  }
10201
- } else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
10216
+ } else if (event.type === GeminiEventType.MaxSessionTurns) {
10202
10217
  if (streamFormatter) {
10203
10218
  streamFormatter.emitEvent({
10204
- type: "error" /* ERROR */,
10219
+ type: JsonStreamEventType.ERROR,
10205
10220
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10206
10221
  severity: "error",
10207
10222
  message: "Maximum session turns exceeded"
10208
10223
  });
10209
10224
  }
10210
- } else if (event.type === "error" /* Error */) {
10225
+ } else if (event.type === GeminiEventType.Error) {
10211
10226
  throw event.value.error;
10212
- } else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
10227
+ } else if (event.type === GeminiEventType.AgentExecutionStopped) {
10213
10228
  const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
10214
- if (config.getOutputFormat() === "text" /* TEXT */) {
10229
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
10215
10230
  process.stderr.write(`${stopMessage}
10216
10231
  `);
10217
10232
  }
@@ -10219,7 +10234,7 @@ async function runNonInteractive2(params) {
10219
10234
  const metrics = uiTelemetryService.getMetrics();
10220
10235
  const durationMs = Date.now() - startTime;
10221
10236
  streamFormatter.emitEvent({
10222
- type: "result" /* RESULT */,
10237
+ type: JsonStreamEventType.RESULT,
10223
10238
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10224
10239
  status: "success",
10225
10240
  stats: streamFormatter.convertToStreamStats(
@@ -10229,9 +10244,9 @@ async function runNonInteractive2(params) {
10229
10244
  });
10230
10245
  }
10231
10246
  return;
10232
- } else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
10247
+ } else if (event.type === GeminiEventType.AgentExecutionBlocked) {
10233
10248
  const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
10234
- if (config.getOutputFormat() === "text" /* TEXT */) {
10249
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
10235
10250
  process.stderr.write(`[WARNING] ${blockMessage}
10236
10251
  `);
10237
10252
  }
@@ -10249,7 +10264,7 @@ async function runNonInteractive2(params) {
10249
10264
  const requestInfo = completedToolCall.request;
10250
10265
  if (streamFormatter) {
10251
10266
  streamFormatter.emitEvent({
10252
- type: "tool_result" /* TOOL_RESULT */,
10267
+ type: JsonStreamEventType.TOOL_RESULT,
10253
10268
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10254
10269
  tool_id: requestInfo.callId,
10255
10270
  status: completedToolCall.status === "error" ? "error" : "success",
@@ -10283,11 +10298,11 @@ async function runNonInteractive2(params) {
10283
10298
  );
10284
10299
  }
10285
10300
  const stopExecutionTool = completedToolCalls.find(
10286
- (tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
10301
+ (tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
10287
10302
  );
10288
10303
  if (stopExecutionTool && stopExecutionTool.response.error) {
10289
10304
  const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
10290
- if (config.getOutputFormat() === "text" /* TEXT */) {
10305
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
10291
10306
  process.stderr.write(`${stopMessage}
10292
10307
  `);
10293
10308
  }
@@ -10295,7 +10310,7 @@ async function runNonInteractive2(params) {
10295
10310
  const metrics = uiTelemetryService.getMetrics();
10296
10311
  const durationMs = Date.now() - startTime;
10297
10312
  streamFormatter.emitEvent({
10298
- type: "result" /* RESULT */,
10313
+ type: JsonStreamEventType.RESULT,
10299
10314
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10300
10315
  status: "success",
10301
10316
  stats: streamFormatter.convertToStreamStats(
@@ -10303,7 +10318,7 @@ async function runNonInteractive2(params) {
10303
10318
  durationMs
10304
10319
  )
10305
10320
  });
10306
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10321
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10307
10322
  const formatter = new JsonFormatter();
10308
10323
  const stats = uiTelemetryService.getMetrics();
10309
10324
  textOutput.write(
@@ -10320,12 +10335,12 @@ async function runNonInteractive2(params) {
10320
10335
  const metrics = uiTelemetryService.getMetrics();
10321
10336
  const durationMs = Date.now() - startTime;
10322
10337
  streamFormatter.emitEvent({
10323
- type: "result" /* RESULT */,
10338
+ type: JsonStreamEventType.RESULT,
10324
10339
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10325
10340
  status: "success",
10326
10341
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
10327
10342
  });
10328
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10343
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10329
10344
  const formatter = new JsonFormatter();
10330
10345
  const stats = uiTelemetryService.getMetrics();
10331
10346
  textOutput.write(
@@ -10343,7 +10358,7 @@ async function runNonInteractive2(params) {
10343
10358
  cleanupStdinCancellation();
10344
10359
  scheduler?.dispose();
10345
10360
  consolePatcher.cleanup();
10346
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
10361
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
10347
10362
  }
10348
10363
  if (errorToHandle) {
10349
10364
  handleError(errorToHandle, config);
@@ -12814,12 +12829,12 @@ var GeminiAgent = class _GeminiAgent {
12814
12829
  this.clientCapabilities = args.clientCapabilities;
12815
12830
  const authMethods = [
12816
12831
  {
12817
- id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
12832
+ id: AuthType.LOGIN_WITH_GOOGLE,
12818
12833
  name: "Log in with Google",
12819
12834
  description: "Log in with your Google account"
12820
12835
  },
12821
12836
  {
12822
- id: "gemini-api-key" /* USE_GEMINI */,
12837
+ id: AuthType.USE_GEMINI,
12823
12838
  name: "Gemini API key",
12824
12839
  description: "Use an API key with Gemini Developer API",
12825
12840
  _meta: {
@@ -12829,12 +12844,12 @@ var GeminiAgent = class _GeminiAgent {
12829
12844
  }
12830
12845
  },
12831
12846
  {
12832
- id: "vertex-ai" /* USE_VERTEX_AI */,
12847
+ id: AuthType.USE_VERTEX_AI,
12833
12848
  name: "Vertex AI",
12834
12849
  description: "Use an API key with Vertex AI GenAI API"
12835
12850
  },
12836
12851
  {
12837
- id: "gateway" /* GATEWAY */,
12852
+ id: AuthType.GATEWAY,
12838
12853
  name: "AI API Gateway",
12839
12854
  description: "Use a custom AI API Gateway",
12840
12855
  _meta: {
@@ -12929,7 +12944,7 @@ var GeminiAgent = class _GeminiAgent {
12929
12944
  mcpServers,
12930
12945
  loadedSettings
12931
12946
  );
12932
- const authType = loadedSettings.merged.security.auth.selectedType || "gemini-api-key" /* USE_GEMINI */;
12947
+ const authType = loadedSettings.merged.security.auth.selectedType || AuthType.USE_GEMINI;
12933
12948
  let isAuthenticated = false;
12934
12949
  let authErrorMessage = "";
12935
12950
  try {
@@ -12941,7 +12956,7 @@ var GeminiAgent = class _GeminiAgent {
12941
12956
  );
12942
12957
  isAuthenticated = true;
12943
12958
  const contentGeneratorConfig = config.getContentGeneratorConfig();
12944
- if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
12959
+ if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
12945
12960
  isAuthenticated = false;
12946
12961
  authErrorMessage = "Gemini API key is missing or not configured.";
12947
12962
  }
@@ -13249,7 +13264,7 @@ ${thought.description}`;
13249
13264
  await this.sendUpdate({
13250
13265
  sessionUpdate: "tool_call",
13251
13266
  toolCallId: toolCall.id,
13252
- status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
13267
+ status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
13253
13268
  title: toolCall.displayName || toolCall.name,
13254
13269
  content: toolCallContent,
13255
13270
  kind: tool ? toAcpToolKind(tool.kind) : "other"
@@ -13302,7 +13317,7 @@ ${thought.description}`;
13302
13317
  while (nextMessage !== null) {
13303
13318
  if (pendingSend.signal.aborted) {
13304
13319
  chat.addHistory(nextMessage);
13305
- return { stopReason: "cancelled" /* Cancelled */ };
13320
+ return { stopReason: CoreToolCallStatus.Cancelled };
13306
13321
  }
13307
13322
  const functionCalls = [];
13308
13323
  try {
@@ -13322,7 +13337,7 @@ ${thought.description}`;
13322
13337
  nextMessage?.parts ?? [],
13323
13338
  promptId,
13324
13339
  pendingSend.signal,
13325
- "main" /* MAIN */
13340
+ LlmRole.MAIN
13326
13341
  );
13327
13342
  nextMessage = null;
13328
13343
  let turnInputTokens = 0;
@@ -13330,16 +13345,16 @@ ${thought.description}`;
13330
13345
  let turnModelId = model;
13331
13346
  for await (const resp of responseStream) {
13332
13347
  if (pendingSend.signal.aborted) {
13333
- return { stopReason: "cancelled" /* Cancelled */ };
13348
+ return { stopReason: CoreToolCallStatus.Cancelled };
13334
13349
  }
13335
- if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
13350
+ if (resp.type === StreamEventType.CHUNK && resp.value.usageMetadata) {
13336
13351
  turnInputTokens = resp.value.usageMetadata.promptTokenCount ?? turnInputTokens;
13337
13352
  turnOutputTokens = resp.value.usageMetadata.candidatesTokenCount ?? turnOutputTokens;
13338
13353
  if (resp.value.modelVersion) {
13339
13354
  turnModelId = resp.value.modelVersion;
13340
13355
  }
13341
13356
  }
13342
- if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
13357
+ if (resp.type === StreamEventType.CHUNK && resp.value.candidates && resp.value.candidates.length > 0) {
13343
13358
  const candidate = resp.value.candidates[0];
13344
13359
  for (const part of candidate.content?.parts ?? []) {
13345
13360
  if (!part.text) {
@@ -13355,7 +13370,7 @@ ${thought.description}`;
13355
13370
  });
13356
13371
  }
13357
13372
  }
13358
- if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
13373
+ if (resp.type === StreamEventType.CHUNK && resp.value.functionCalls) {
13359
13374
  functionCalls.push(...resp.value.functionCalls);
13360
13375
  }
13361
13376
  }
@@ -13371,7 +13386,7 @@ ${thought.description}`;
13371
13386
  modelUsageMap.set(turnModelId, existing);
13372
13387
  }
13373
13388
  if (pendingSend.signal.aborted) {
13374
- return { stopReason: "cancelled" /* Cancelled */ };
13389
+ return { stopReason: CoreToolCallStatus.Cancelled };
13375
13390
  }
13376
13391
  } catch (error) {
13377
13392
  if (getErrorStatus(error) === 429) {
@@ -13381,7 +13396,7 @@ ${thought.description}`;
13381
13396
  );
13382
13397
  }
13383
13398
  if (pendingSend.signal.aborted || error instanceof Error && error.name === "AbortError") {
13384
- return { stopReason: "cancelled" /* Cancelled */ };
13399
+ return { stopReason: CoreToolCallStatus.Cancelled };
13385
13400
  }
13386
13401
  if (error instanceof InvalidStreamError || error && typeof error === "object" && "type" in error && (error.type === "NO_RESPONSE_TEXT" || error.type === "NO_FINISH_REASON" || error.type === "MALFORMED_FUNCTION_CALL" || error.type === "UNEXPECTED_TOOL_CALL")) {
13387
13402
  return {
@@ -13545,7 +13560,7 @@ ${thought.description}`;
13545
13560
  const output = RequestPermissionResponseSchema.parse(
13546
13561
  await this.connection.requestPermission(params)
13547
13562
  );
13548
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
13563
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
13549
13564
  await confirmationDetails.onConfirm(outcome);
13550
13565
  await updatePolicy(
13551
13566
  tool,
@@ -13556,16 +13571,16 @@ ${thought.description}`;
13556
13571
  invocation
13557
13572
  );
13558
13573
  switch (outcome) {
13559
- case "cancel" /* Cancel */:
13574
+ case ToolConfirmationOutcome.Cancel:
13560
13575
  return errorResponse(
13561
13576
  new Error(`Tool "${fc.name}" was canceled by the user.`)
13562
13577
  );
13563
- case "proceed_once" /* ProceedOnce */:
13564
- case "proceed_always" /* ProceedAlways */:
13565
- case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
13566
- case "proceed_always_server" /* ProceedAlwaysServer */:
13567
- case "proceed_always_tool" /* ProceedAlwaysTool */:
13568
- case "modify_with_editor" /* ModifyWithEditor */:
13578
+ case ToolConfirmationOutcome.ProceedOnce:
13579
+ case ToolConfirmationOutcome.ProceedAlways:
13580
+ case ToolConfirmationOutcome.ProceedAlwaysAndSave:
13581
+ case ToolConfirmationOutcome.ProceedAlwaysServer:
13582
+ case ToolConfirmationOutcome.ProceedAlwaysTool:
13583
+ case ToolConfirmationOutcome.ModifyWithEditor:
13569
13584
  break;
13570
13585
  default: {
13571
13586
  const resultOutcome = outcome;
@@ -13613,7 +13628,7 @@ ${thought.description}`;
13613
13628
  );
13614
13629
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
13615
13630
  {
13616
- status: "success" /* Success */,
13631
+ status: CoreToolCallStatus.Success,
13617
13632
  request: {
13618
13633
  callId,
13619
13634
  name: fc.name,
@@ -13658,7 +13673,7 @@ ${thought.description}`;
13658
13673
  });
13659
13674
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
13660
13675
  {
13661
- status: "error" /* Error */,
13676
+ status: CoreToolCallStatus.Error,
13662
13677
  request: {
13663
13678
  callId,
13664
13679
  name: fc.name,
@@ -13773,12 +13788,12 @@ ${thought.description}`;
13773
13788
  sessionId: this.id,
13774
13789
  options: [
13775
13790
  {
13776
- optionId: "proceed_once" /* ProceedOnce */,
13791
+ optionId: ToolConfirmationOutcome.ProceedOnce,
13777
13792
  name: "Allow once",
13778
13793
  kind: "allow_once"
13779
13794
  },
13780
13795
  {
13781
- optionId: "cancel" /* Cancel */,
13796
+ optionId: ToolConfirmationOutcome.Cancel,
13782
13797
  name: "Deny",
13783
13798
  kind: "reject_once"
13784
13799
  }
@@ -13803,8 +13818,8 @@ ${thought.description}`;
13803
13818
  const output = RequestPermissionResponseSchema.parse(
13804
13819
  await this.connection.requestPermission(params)
13805
13820
  );
13806
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
13807
- if (outcome === "proceed_once" /* ProceedOnce */) {
13821
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
13822
+ if (outcome === ToolConfirmationOutcome.ProceedOnce) {
13808
13823
  this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
13809
13824
  validationError = null;
13810
13825
  } else {
@@ -14181,12 +14196,12 @@ function toToolCallContent(toolResult) {
14181
14196
  }
14182
14197
  var basicPermissionOptions = [
14183
14198
  {
14184
- optionId: "proceed_once" /* ProceedOnce */,
14199
+ optionId: ToolConfirmationOutcome.ProceedOnce,
14185
14200
  name: "Allow",
14186
14201
  kind: "allow_once"
14187
14202
  },
14188
14203
  {
14189
- optionId: "cancel" /* Cancel */,
14204
+ optionId: ToolConfirmationOutcome.Cancel,
14190
14205
  name: "Reject",
14191
14206
  kind: "reject_once"
14192
14207
  }
@@ -14198,13 +14213,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14198
14213
  switch (confirmation.type) {
14199
14214
  case "edit":
14200
14215
  options.push({
14201
- optionId: "proceed_always" /* ProceedAlways */,
14216
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14202
14217
  name: "Allow for this session",
14203
14218
  kind: "allow_always"
14204
14219
  });
14205
14220
  if (enablePermanentToolApproval) {
14206
14221
  options.push({
14207
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14222
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14208
14223
  name: "Allow for this file in all future sessions",
14209
14224
  kind: "allow_always"
14210
14225
  });
@@ -14212,13 +14227,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14212
14227
  break;
14213
14228
  case "exec":
14214
14229
  options.push({
14215
- optionId: "proceed_always" /* ProceedAlways */,
14230
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14216
14231
  name: "Allow for this session",
14217
14232
  kind: "allow_always"
14218
14233
  });
14219
14234
  if (enablePermanentToolApproval) {
14220
14235
  options.push({
14221
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14236
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14222
14237
  name: "Allow this command for all future sessions",
14223
14238
  kind: "allow_always"
14224
14239
  });
@@ -14227,19 +14242,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14227
14242
  case "mcp":
14228
14243
  options.push(
14229
14244
  {
14230
- optionId: "proceed_always_server" /* ProceedAlwaysServer */,
14245
+ optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
14231
14246
  name: "Allow all server tools for this session",
14232
14247
  kind: "allow_always"
14233
14248
  },
14234
14249
  {
14235
- optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
14250
+ optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
14236
14251
  name: "Allow tool for this session",
14237
14252
  kind: "allow_always"
14238
14253
  }
14239
14254
  );
14240
14255
  if (enablePermanentToolApproval) {
14241
14256
  options.push({
14242
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14257
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14243
14258
  name: "Allow tool for all future sessions",
14244
14259
  kind: "allow_always"
14245
14260
  });
@@ -14247,13 +14262,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14247
14262
  break;
14248
14263
  case "info":
14249
14264
  options.push({
14250
- optionId: "proceed_always" /* ProceedAlways */,
14265
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14251
14266
  name: "Allow for this session",
14252
14267
  kind: "allow_always"
14253
14268
  });
14254
14269
  if (enablePermanentToolApproval) {
14255
14270
  options.push({
14256
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14271
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14257
14272
  name: "Allow for all future sessions",
14258
14273
  kind: "allow_always"
14259
14274
  });
@@ -14285,21 +14300,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14285
14300
  }
14286
14301
  function toAcpToolKind(kind) {
14287
14302
  switch (kind) {
14288
- case "read" /* Read */:
14289
- case "edit" /* Edit */:
14290
- case "execute" /* Execute */:
14291
- case "search" /* Search */:
14292
- case "delete" /* Delete */:
14293
- case "move" /* Move */:
14294
- case "think" /* Think */:
14295
- case "fetch" /* Fetch */:
14296
- case "switch_mode" /* SwitchMode */:
14297
- case "other" /* Other */:
14303
+ case Kind.Read:
14304
+ case Kind.Edit:
14305
+ case Kind.Execute:
14306
+ case Kind.Search:
14307
+ case Kind.Delete:
14308
+ case Kind.Move:
14309
+ case Kind.Think:
14310
+ case Kind.Fetch:
14311
+ case Kind.SwitchMode:
14312
+ case Kind.Other:
14298
14313
  return kind;
14299
- case "agent" /* Agent */:
14314
+ case Kind.Agent:
14300
14315
  return "think";
14301
- case "plan" /* Plan */:
14302
- case "communicate" /* Communicate */:
14316
+ case Kind.Plan:
14317
+ case Kind.Communicate:
14303
14318
  default:
14304
14319
  return "other";
14305
14320
  }
@@ -14307,24 +14322,24 @@ function toAcpToolKind(kind) {
14307
14322
  function buildAvailableModes(isPlanEnabled) {
14308
14323
  const modes = [
14309
14324
  {
14310
- id: "default" /* DEFAULT */,
14325
+ id: ApprovalMode.DEFAULT,
14311
14326
  name: "Default",
14312
14327
  description: "Prompts for approval"
14313
14328
  },
14314
14329
  {
14315
- id: "autoEdit" /* AUTO_EDIT */,
14330
+ id: ApprovalMode.AUTO_EDIT,
14316
14331
  name: "Auto Edit",
14317
14332
  description: "Auto-approves edit tools"
14318
14333
  },
14319
14334
  {
14320
- id: "yolo" /* YOLO */,
14335
+ id: ApprovalMode.YOLO,
14321
14336
  name: "YOLO",
14322
14337
  description: "Auto-approves all tools"
14323
14338
  }
14324
14339
  ];
14325
14340
  if (isPlanEnabled) {
14326
14341
  modes.push({
14327
- id: "plan" /* PLAN */,
14342
+ id: ApprovalMode.PLAN,
14328
14343
  name: "Plan",
14329
14344
  description: "Read-only mode"
14330
14345
  });
@@ -14337,7 +14352,7 @@ function buildAvailableModels(config, settings) {
14337
14352
  const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
14338
14353
  const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
14339
14354
  const selectedAuthType = settings.merged.security.auth.selectedType;
14340
- const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
14355
+ const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
14341
14356
  if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
14342
14357
  const options = config.getModelConfigService().getAvailableModelOptions({
14343
14358
  useGemini3_1: useGemini31,
@@ -14435,7 +14450,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
14435
14450
  }
14436
14451
  return authType;
14437
14452
  } catch (error) {
14438
- if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
14453
+ if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
14439
14454
  handleError(
14440
14455
  error instanceof Error ? error : new Error(String(error)),
14441
14456
  nonInteractiveConfig,
@@ -14631,10 +14646,10 @@ var SlashCommandConflictHandler = class {
14631
14646
  this.handleConflicts = this.handleConflicts.bind(this);
14632
14647
  }
14633
14648
  start() {
14634
- coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
14649
+ coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
14635
14650
  }
14636
14651
  stop() {
14637
- coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
14652
+ coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
14638
14653
  if (this.flushTimeout) {
14639
14654
  clearTimeout(this.flushTimeout);
14640
14655
  this.flushTimeout = null;
@@ -14845,7 +14860,7 @@ async function resolveSessionId(resumeArg) {
14845
14860
  }
14846
14861
  }
14847
14862
  async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
14848
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-K6QHA2GI.js");
14863
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-H3NLGP7Z.js");
14849
14864
  await doStartUI(
14850
14865
  config,
14851
14866
  settings,
@@ -14944,12 +14959,12 @@ async function main() {
14944
14959
  dns.setDefaultResultOrder(
14945
14960
  validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
14946
14961
  );
14947
- if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
14962
+ if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
14948
14963
  if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
14949
14964
  settings.setValue(
14950
14965
  "User" /* User */,
14951
14966
  "security.auth.selectedType",
14952
- "compute-default-credentials" /* COMPUTE_ADC */
14967
+ AuthType.COMPUTE_ADC
14953
14968
  );
14954
14969
  }
14955
14970
  }
@@ -15047,7 +15062,7 @@ ${finalArgs[promptIndex + 1]}`;
15047
15062
  await config.storage.initialize();
15048
15063
  adminControlsListner.setConfig(config);
15049
15064
  if (config.isInteractive() && settings.merged.general.devtools) {
15050
- const { setupInitialActivityLogger } = await import("./devtoolsService-DDDJINQW.js");
15065
+ const { setupInitialActivityLogger } = await import("./devtoolsService-X4577PYZ.js");
15051
15066
  await setupInitialActivityLogger(config);
15052
15067
  }
15053
15068
  registerTelemetryConfig(config);
@@ -15055,7 +15070,7 @@ ${finalArgs[promptIndex + 1]}`;
15055
15070
  const messageBus = config.getMessageBus();
15056
15071
  createPolicyUpdater2(policyEngine, messageBus, config.storage);
15057
15072
  registerCleanup(async () => {
15058
- await config.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
15073
+ await config.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
15059
15074
  });
15060
15075
  cleanupExpiredSessions(config, settings.merged).catch((e) => {
15061
15076
  debugLogger.error("Failed to cleanup expired sessions:", e);
@@ -15103,7 +15118,7 @@ ${finalArgs[promptIndex + 1]}`;
15103
15118
  const initAppHandle = startupProfiler.start("initialize_app");
15104
15119
  const initializationResult = await initializeApp(config, settings);
15105
15120
  initAppHandle?.end();
15106
- if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
15121
+ if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
15107
15122
  await getOauthClient(settings.merged.security.auth.selectedType, config);
15108
15123
  }
15109
15124
  if (config.getAcpMode()) {
@@ -15119,7 +15134,7 @@ ${finalArgs[promptIndex + 1]}`;
15119
15134
  ...rawStartupWarnings.map((message) => ({
15120
15135
  id: `startup-${createHash("sha256").update(message).digest("hex").substring(0, 16)}`,
15121
15136
  message,
15122
- priority: "high" /* High */
15137
+ priority: WarningPriority.High
15123
15138
  })),
15124
15139
  ...await getUserStartupWarnings(settings.merged, void 0, {
15125
15140
  isAlternateBuffer: useAlternateBuffer
@@ -15151,7 +15166,7 @@ ${finalArgs[promptIndex + 1]}`;
15151
15166
  ${input}` : stdinData;
15152
15167
  }
15153
15168
  }
15154
- const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
15169
+ const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
15155
15170
  const hookSystem = config?.getHookSystem();
15156
15171
  if (hookSystem) {
15157
15172
  const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
@@ -15208,16 +15223,16 @@ ${input}` : wrappedContext;
15208
15223
  }
15209
15224
  }
15210
15225
  function initializeOutputListenersAndFlush() {
15211
- if (coreEvents.listenerCount("output" /* Output */) === 0) {
15212
- coreEvents.on("output" /* Output */, (payload) => {
15226
+ if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
15227
+ coreEvents.on(CoreEvent.Output, (payload) => {
15213
15228
  if (payload.isStderr) {
15214
15229
  writeToStderr(payload.chunk, payload.encoding);
15215
15230
  } else {
15216
15231
  writeToStdout(payload.chunk, payload.encoding);
15217
15232
  }
15218
15233
  });
15219
- if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
15220
- coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
15234
+ if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
15235
+ coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
15221
15236
  if (payload.type === "error" || payload.type === "warn") {
15222
15237
  writeToStderr(payload.content);
15223
15238
  } else {
@@ -15225,8 +15240,8 @@ function initializeOutputListenersAndFlush() {
15225
15240
  }
15226
15241
  });
15227
15242
  }
15228
- if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
15229
- coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
15243
+ if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
15244
+ coreEvents.on(CoreEvent.UserFeedback, (payload) => {
15230
15245
  if (payload.severity === "error" || payload.severity === "warning") {
15231
15246
  writeToStderr(payload.message);
15232
15247
  } else {