@google/gemini-cli 0.39.0 → 0.39.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 (46) hide show
  1. package/bundle/{chunk-NWD4JYMB.js → chunk-APBWRLCM.js} +1590 -6638
  2. package/bundle/{chunk-5GTZHSZV.js → chunk-BEUOMVKF.js} +1587 -6636
  3. package/bundle/{chunk-67TFD6HC.js → chunk-FNPZLVJU.js} +16 -0
  4. package/bundle/{chunk-UQGLVPZQ.js → chunk-GDRLBWZL.js} +3884 -2279
  5. package/bundle/{chunk-BL3XXS2L.js → chunk-GRNHS2XR.js} +2 -2
  6. package/bundle/{chunk-LUWQB4AS.js → chunk-N6R5LJKJ.js} +2 -2
  7. package/bundle/{chunk-6NW5RNNH.js → chunk-QPDKVNK5.js} +1656 -6692
  8. package/bundle/{chunk-QM5IP3NK.js → chunk-R32ABRMT.js} +16 -0
  9. package/bundle/chunk-RNWNACRD.js +96654 -0
  10. package/bundle/{chunk-YYY7NKKR.js → chunk-RVSGPQMZ.js} +2 -2
  11. package/bundle/{chunk-RTKRL6Y5.js → chunk-UGFPG7AM.js} +10090 -13916
  12. package/bundle/chunk-UIBQS45C.js +361893 -0
  13. package/bundle/{chunk-3YUTTNJ7.js → chunk-WFCK2Z32.js} +3916 -2286
  14. package/bundle/chunk-ZIXTYG56.js +156 -0
  15. package/bundle/{cleanup-3LELZME2.js → cleanup-DORKD3KW.js} +3 -3
  16. package/bundle/{cleanup-JJEXOHOA.js → cleanup-ROCPAQIR.js} +3 -3
  17. package/bundle/{cleanup-TTGHQXQN.js → cleanup-RV4C23S4.js} +3 -3
  18. package/bundle/cleanup-VFR4VRPU.js +33 -0
  19. package/bundle/{core-LKKLDF4Z.js → core-NHADWRAT.js} +28 -2
  20. package/bundle/{devtoolsService-UQCUIXV5.js → devtoolsService-65SKYXJR.js} +3 -3
  21. package/bundle/{devtoolsService-H64VB4IA.js → devtoolsService-6GKOMHGW.js} +3 -3
  22. package/bundle/{devtoolsService-L5LFSMIR.js → devtoolsService-OIMHTGLW.js} +5 -4
  23. package/bundle/devtoolsService-XJQQUBHU.js +871 -0
  24. package/bundle/{core-Z2SYVMM5.js → dist-2DBCGLDI.js} +28 -2
  25. package/bundle/{dist-FWHS5IHN.js → dist-7UL5MZ3N.js} +28 -2
  26. package/bundle/dist-FMEYWTZB.js +2036 -0
  27. package/bundle/docs/cli/cli-reference.md +1 -0
  28. package/bundle/docs/cli/trusted-folders.md +28 -0
  29. package/bundle/docs/reference/configuration.md +14 -0
  30. package/bundle/{gemini-BI2PCDUT.js → gemini-APY42TPN.js} +62 -18
  31. package/bundle/{gemini-CMXEUOSI.js → gemini-ASA6UVNB.js} +60 -17
  32. package/bundle/{gemini-YNLABPKW.js → gemini-JN2NUSDI.js} +238 -179
  33. package/bundle/gemini-ZVQNZBQE.js +15365 -0
  34. package/bundle/gemini.js +3 -3
  35. package/bundle/{interactiveCli-C46TDPVW.js → interactiveCli-7OEI5K4E.js} +15 -165
  36. package/bundle/{interactiveCli-P35Q3KZ2.js → interactiveCli-F6YUYJT5.js} +28 -177
  37. package/bundle/{interactiveCli-LXXBYVNU.js → interactiveCli-MSV2JUI2.js} +298 -430
  38. package/bundle/interactiveCli-WY7NQZAW.js +34344 -0
  39. package/bundle/{memoryDiscovery-U3XUU4QY.js → memoryDiscovery-OGUXPAKW.js} +1 -1
  40. package/bundle/{memoryDiscovery-MYQ3ZWKM.js → memoryDiscovery-OJZ52WPE.js} +1 -1
  41. package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
  42. package/bundle/{oauth2-provider-7ZDLUOSM.js → oauth2-provider-5GKHTO3W.js} +2 -2
  43. package/bundle/{oauth2-provider-CRWFOXYR.js → oauth2-provider-J42P6NQU.js} +2 -2
  44. package/bundle/{oauth2-provider-FEM5AIRT.js → oauth2-provider-MJYS4GHA.js} +39 -73
  45. package/bundle/oauth2-provider-UI5C6WYR.js +237 -0
  46. package/package.json +1 -1
@@ -25,7 +25,6 @@ import {
25
25
  configureSpecificSetting,
26
26
  disableSkill,
27
27
  enableSkill,
28
- execa,
29
28
  formatRelativeTime,
30
29
  getExtensionManager,
31
30
  getThemeTypeFromBackgroundColor,
@@ -35,6 +34,7 @@ import {
35
34
  installSkill,
36
35
  isAlternateBufferEnabled,
37
36
  isFolderTrustEnabled,
37
+ isRecord,
38
38
  isSlashCommand,
39
39
  isWorkspaceTrusted,
40
40
  isWorktreeEnabled,
@@ -58,7 +58,7 @@ import {
58
58
  updateAllUpdatableExtensions,
59
59
  updateExtension,
60
60
  validateAuthMethod
61
- } from "./chunk-5GTZHSZV.js";
61
+ } from "./chunk-APBWRLCM.js";
62
62
  import {
63
63
  appEvents
64
64
  } from "./chunk-5PS3AYFU.js";
@@ -70,32 +70,44 @@ import {
70
70
  runExitCleanup,
71
71
  runSyncCleanup,
72
72
  setupSignalHandlers
73
- } from "./chunk-YYY7NKKR.js";
73
+ } from "./chunk-N6R5LJKJ.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,
105
+ TrustLevel,
95
106
  UserAccountManager,
96
107
  UserPromptEvent,
97
108
  ValidationCancelledError,
98
109
  ValidationRequiredError,
110
+ WarningPriority,
99
111
  addMemory,
100
112
  applyAdminAllowlist,
101
113
  applyRequiredServers,
@@ -110,6 +122,7 @@ import {
110
122
  createWorktreeService,
111
123
  detectIdeFromEnv,
112
124
  displayContentToString,
125
+ execa,
113
126
  external_exports as external_exports2,
114
127
  geminiPartsToContentParts,
115
128
  generalistProfile,
@@ -156,9 +169,11 @@ import {
156
169
  updatePolicy,
157
170
  writeToStderr,
158
171
  writeToStdout
159
- } from "./chunk-3YUTTNJ7.js";
172
+ } from "./chunk-UIBQS45C.js";
160
173
  import {
161
174
  ASK_USER_TOOL_NAME,
175
+ ApprovalMode,
176
+ CoreEvent,
162
177
  DEFAULT_FILE_FILTERING_OPTIONS,
163
178
  DEFAULT_GEMINI_EMBEDDING_MODEL,
164
179
  DEFAULT_GEMINI_FLASH_LITE_MODEL,
@@ -175,8 +190,10 @@ import {
175
190
  FatalSandboxError,
176
191
  FatalToolExecutionError,
177
192
  FatalTurnLimitedError,
193
+ FatalUntrustedWorkspaceError,
178
194
  GEMINI_DIR,
179
195
  GEMINI_MODEL_ALIAS_AUTO,
196
+ Kind,
180
197
  PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
181
198
  PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
182
199
  PREVIEW_GEMINI_3_1_MODEL,
@@ -186,6 +203,7 @@ import {
186
203
  REFERENCE_CONTENT_START,
187
204
  Storage,
188
205
  ToolConfirmationOutcome,
206
+ ToolErrorType,
189
207
  coreEvents,
190
208
  debugLogger,
191
209
  external_exports,
@@ -199,7 +217,7 @@ import {
199
217
  loadServerHierarchicalMemory,
200
218
  resolveToRealPath,
201
219
  setGeminiMdFilename
202
- } from "./chunk-QM5IP3NK.js";
220
+ } from "./chunk-FNPZLVJU.js";
203
221
  import "./chunk-664ZODQF.js";
204
222
  import "./chunk-RJTRUG2J.js";
205
223
  import "./chunk-IUUIT4SU.js";
@@ -5490,7 +5508,7 @@ async function getMcpServersFromConfig(settings) {
5490
5508
  async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
5491
5509
  const isStdio = !!config.command;
5492
5510
  if (isStdio && !isTrusted) {
5493
- return "disconnected" /* DISCONNECTED */;
5511
+ return MCPServerStatus.DISCONNECTED;
5494
5512
  }
5495
5513
  const client = new Client({
5496
5514
  name: "mcp-test-client",
@@ -5526,16 +5544,16 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
5526
5544
  transport = await createTransport(serverName, config, false, mcpContext);
5527
5545
  } catch {
5528
5546
  await client.close();
5529
- return "disconnected" /* DISCONNECTED */;
5547
+ return MCPServerStatus.DISCONNECTED;
5530
5548
  }
5531
5549
  try {
5532
5550
  await client.connect(transport, { timeout: 5e3 });
5533
5551
  await client.ping();
5534
5552
  await client.close();
5535
- return "connected" /* CONNECTED */;
5553
+ return MCPServerStatus.CONNECTED;
5536
5554
  } catch {
5537
5555
  await transport.close();
5538
- return "disconnected" /* DISCONNECTED */;
5556
+ return MCPServerStatus.DISCONNECTED;
5539
5557
  }
5540
5558
  }
5541
5559
  async function getServerStatus(serverName, server, isTrusted, activeSettings) {
@@ -5548,9 +5566,9 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
5548
5566
  });
5549
5567
  if (!loadResult.allowed) {
5550
5568
  if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
5551
- return "blocked" /* BLOCKED */;
5569
+ return MCPServerStatus.BLOCKED;
5552
5570
  }
5553
- return "disabled" /* DISABLED */;
5571
+ return MCPServerStatus.DISABLED;
5554
5572
  }
5555
5573
  return testMCPConnection(serverName, server, isTrusted, activeSettings);
5556
5574
  }
@@ -5584,23 +5602,23 @@ async function listMcpServers(loadedSettingsArg) {
5584
5602
  let statusIndicator = "";
5585
5603
  let statusText = "";
5586
5604
  switch (status) {
5587
- case "connected" /* CONNECTED */:
5605
+ case MCPServerStatus.CONNECTED:
5588
5606
  statusIndicator = import_chalk.default.green("\u2713");
5589
5607
  statusText = "Connected";
5590
5608
  break;
5591
- case "connecting" /* CONNECTING */:
5609
+ case MCPServerStatus.CONNECTING:
5592
5610
  statusIndicator = import_chalk.default.yellow("\u2026");
5593
5611
  statusText = "Connecting";
5594
5612
  break;
5595
- case "blocked" /* BLOCKED */:
5613
+ case MCPServerStatus.BLOCKED:
5596
5614
  statusIndicator = import_chalk.default.red("\u26D4");
5597
5615
  statusText = "Blocked";
5598
5616
  break;
5599
- case "disabled" /* DISABLED */:
5617
+ case MCPServerStatus.DISABLED:
5600
5618
  statusIndicator = import_chalk.default.gray("\u25CB");
5601
5619
  statusText = "Disabled";
5602
5620
  break;
5603
- case "disconnected" /* DISCONNECTED */:
5621
+ case MCPServerStatus.DISCONNECTED:
5604
5622
  default:
5605
5623
  statusIndicator = import_chalk.default.red("\u2717");
5606
5624
  statusText = "Disconnected";
@@ -5886,7 +5904,7 @@ async function handleInstall(args) {
5886
5904
  );
5887
5905
  if (confirmed) {
5888
5906
  const trustedFolders = loadTrustedFolders();
5889
- await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
5907
+ await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
5890
5908
  } else {
5891
5909
  throw new Error(
5892
5910
  `Installation aborted: Folder "${absolutePath}" is not trusted.`
@@ -7250,7 +7268,7 @@ async function loadSandboxConfig(settings, argv) {
7250
7268
  }
7251
7269
  const command2 = getSandboxCommand(sandboxValue);
7252
7270
  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-preview.2" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7271
+ const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.39.1" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7254
7272
  const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
7255
7273
  return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
7256
7274
  }
@@ -7309,9 +7327,9 @@ async function resolveWorkspacePolicyState(options) {
7309
7327
  cwd,
7310
7328
  potentialWorkspacePoliciesDir
7311
7329
  );
7312
- if (integrityResult.status === "MATCH" /* MATCH */) {
7330
+ if (integrityResult.status === IntegrityStatus.MATCH) {
7313
7331
  workspacePoliciesDir = potentialWorkspacePoliciesDir;
7314
- } else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
7332
+ } else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
7315
7333
  workspacePoliciesDir = void 0;
7316
7334
  } else if (interactive && !autoAcceptWorkspacePolicies) {
7317
7335
  policyUpdateConfirmationRequest = {
@@ -7460,6 +7478,10 @@ async function parseArguments(settings) {
7460
7478
  type: "string",
7461
7479
  nargs: 1,
7462
7480
  description: "Execute the provided prompt and continue in interactive mode"
7481
+ }).option("skip-trust", {
7482
+ type: "boolean",
7483
+ description: "Trust the current workspace for this session.",
7484
+ default: false
7463
7485
  }).option("worktree", {
7464
7486
  alias: "w",
7465
7487
  type: "string",
@@ -7581,9 +7603,16 @@ async function parseArguments(settings) {
7581
7603
  yargsInstance.wrap(yargsInstance.terminalWidth());
7582
7604
  let result;
7583
7605
  try {
7584
- result = await yargsInstance.parse();
7606
+ const parsed = await yargsInstance.parse();
7607
+ if (!isRecord(parsed)) {
7608
+ throw new Error("Failed to parse arguments");
7609
+ }
7610
+ result = parsed;
7611
+ if (result["skip-trust"]) {
7612
+ process3.env["GEMINI_CLI_TRUST_WORKSPACE"] = "true";
7613
+ }
7585
7614
  } catch (e) {
7586
- const msg = e instanceof Error ? e.message : String(e);
7615
+ const msg = getErrorMessage(e);
7587
7616
  debugLogger.error(msg);
7588
7617
  yargsInstance.showHelp();
7589
7618
  await runExitCleanup();
@@ -7593,8 +7622,13 @@ async function parseArguments(settings) {
7593
7622
  await runExitCleanup();
7594
7623
  process3.exit(0);
7595
7624
  }
7596
- const queryArg = result.query;
7597
- const q = Array.isArray(queryArg) ? queryArg.join(" ") : queryArg;
7625
+ const queryArg = result["query"];
7626
+ let q;
7627
+ if (Array.isArray(queryArg)) {
7628
+ q = queryArg.join(" ");
7629
+ } else if (typeof queryArg === "string") {
7630
+ q = queryArg;
7631
+ }
7598
7632
  if (q && !result["prompt"]) {
7599
7633
  if (!isHeadlessMode()) {
7600
7634
  startupMessages.push(
@@ -7625,7 +7659,7 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7625
7659
  const includeDirectoryTree = settings.context?.includeDirectoryTree ?? true;
7626
7660
  const ideMode = settings.ide?.enabled ?? false;
7627
7661
  const folderTrust = process3.env["GEMINI_CLI_INTEGRATION_TEST"] === "true" || process3.env["VITEST"] === "true" ? false : settings.security?.folderTrust?.enabled ?? false;
7628
- const trustedFolder = isWorkspaceTrusted(settings, cwd, void 0, {
7662
+ const trustedFolder = isWorkspaceTrusted(settings, cwd, {
7629
7663
  prompt: argv.prompt,
7630
7664
  query: argv.query
7631
7665
  })?.isTrusted ?? false;
@@ -7654,7 +7688,7 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7654
7688
  return resolveToRealPath(trimmedPath) !== realCwd;
7655
7689
  } catch (e) {
7656
7690
  debugLogger.debug(
7657
- `[IDE] Skipping inaccessible workspace folder: ${trimmedPath} (${e instanceof Error ? e.message : String(e)})`
7691
+ `[IDE] Skipping inaccessible workspace folder: ${trimmedPath} (${getErrorMessage(e)})`
7658
7692
  );
7659
7693
  return false;
7660
7694
  }
@@ -7705,23 +7739,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7705
7739
  if (rawApprovalMode) {
7706
7740
  switch (rawApprovalMode) {
7707
7741
  case "yolo":
7708
- approvalMode = "yolo" /* YOLO */;
7742
+ approvalMode = ApprovalMode.YOLO;
7709
7743
  break;
7710
7744
  case "auto_edit":
7711
- approvalMode = "autoEdit" /* AUTO_EDIT */;
7745
+ approvalMode = ApprovalMode.AUTO_EDIT;
7712
7746
  break;
7713
7747
  case "plan":
7714
7748
  if (!(settings.general?.plan?.enabled ?? true)) {
7715
7749
  debugLogger.warn(
7716
7750
  'Approval mode "plan" is disabled in your settings. Falling back to "default".'
7717
7751
  );
7718
- approvalMode = "default" /* DEFAULT */;
7752
+ approvalMode = ApprovalMode.DEFAULT;
7719
7753
  } else {
7720
- approvalMode = "plan" /* PLAN */;
7754
+ approvalMode = ApprovalMode.PLAN;
7721
7755
  }
7722
7756
  break;
7723
7757
  case "default":
7724
- approvalMode = "default" /* DEFAULT */;
7758
+ approvalMode = ApprovalMode.DEFAULT;
7725
7759
  break;
7726
7760
  default:
7727
7761
  throw new Error(
@@ -7729,10 +7763,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7729
7763
  );
7730
7764
  }
7731
7765
  } else {
7732
- approvalMode = "default" /* DEFAULT */;
7766
+ approvalMode = ApprovalMode.DEFAULT;
7733
7767
  }
7734
7768
  if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
7735
- if (approvalMode === "yolo" /* YOLO */) {
7769
+ if (approvalMode === ApprovalMode.YOLO) {
7736
7770
  if (settings.admin?.secureModeEnabled) {
7737
7771
  debugLogger.error(
7738
7772
  'YOLO mode is disabled by "secureModeEnabled" setting.'
@@ -7750,16 +7784,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7750
7784
  )
7751
7785
  );
7752
7786
  }
7753
- } else if (approvalMode === "yolo" /* YOLO */) {
7787
+ } else if (approvalMode === ApprovalMode.YOLO) {
7754
7788
  debugLogger.warn(
7755
7789
  "YOLO mode is enabled. All tool calls will be automatically approved."
7756
7790
  );
7757
7791
  }
7758
- if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
7792
+ if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
7759
7793
  debugLogger.warn(
7760
7794
  `Approval mode overridden to "default" because the current folder is not trusted.`
7761
7795
  );
7762
- approvalMode = "default" /* DEFAULT */;
7796
+ approvalMode = ApprovalMode.DEFAULT;
7763
7797
  }
7764
7798
  let telemetrySettings;
7765
7799
  try {
@@ -8045,7 +8079,7 @@ async function resolveWorktreeSettings(cwd) {
8045
8079
  worktreeBaseSha = stdout.trim();
8046
8080
  } catch (e) {
8047
8081
  debugLogger.debug(
8048
- `Failed to resolve worktree base SHA at ${worktreePath}: ${e instanceof Error ? e.message : String(e)}`
8082
+ `Failed to resolve worktree base SHA at ${worktreePath}: ${getErrorMessage(e)}`
8049
8083
  );
8050
8084
  }
8051
8085
  if (!worktreeBaseSha) {
@@ -9142,7 +9176,7 @@ import path8 from "node:path";
9142
9176
  import process4 from "node:process";
9143
9177
  var homeDirectoryCheck = {
9144
9178
  id: "home-directory",
9145
- priority: "low" /* Low */,
9179
+ priority: WarningPriority.Low,
9146
9180
  check: async (workspaceRoot, settings) => {
9147
9181
  if (settings.ui?.showHomeDirectoryWarning === false) {
9148
9182
  return null;
@@ -9166,7 +9200,7 @@ var homeDirectoryCheck = {
9166
9200
  };
9167
9201
  var rootDirectoryCheck = {
9168
9202
  id: "root-directory",
9169
- priority: "high" /* High */,
9203
+ priority: WarningPriority.High,
9170
9204
  check: async (workspaceRoot, _settings) => {
9171
9205
  try {
9172
9206
  const workspaceRealPath = await fs6.realpath(workspaceRoot);
@@ -9180,9 +9214,29 @@ var rootDirectoryCheck = {
9180
9214
  }
9181
9215
  }
9182
9216
  };
9217
+ var folderTrustCheck = {
9218
+ id: "folder-trust",
9219
+ priority: WarningPriority.High,
9220
+ check: async (workspaceRoot, settings) => {
9221
+ if (!isFolderTrustEnabled(settings)) {
9222
+ return null;
9223
+ }
9224
+ const { isTrusted } = isWorkspaceTrusted(settings, workspaceRoot);
9225
+ if (isTrusted === true) {
9226
+ return null;
9227
+ }
9228
+ if (isHeadlessMode()) {
9229
+ throw new FatalUntrustedWorkspaceError(
9230
+ "Gemini CLI is not running in a trusted directory. To proceed, either use `--skip-trust`, set the `GEMINI_CLI_TRUST_WORKSPACE=true` environment variable, or trust this directory in interactive mode. For more details, see https://geminicli.com/docs/cli/trusted-folders/#headless-and-automated-environments"
9231
+ );
9232
+ }
9233
+ return null;
9234
+ }
9235
+ };
9183
9236
  var WARNING_CHECKS = [
9184
9237
  homeDirectoryCheck,
9185
- rootDirectoryCheck
9238
+ rootDirectoryCheck,
9239
+ folderTrustCheck
9186
9240
  ];
9187
9241
  async function getUserStartupWarnings(settings, workspaceRoot = process4.cwd(), options) {
9188
9242
  const results = await Promise.all(
@@ -9350,12 +9404,12 @@ function handleError(error, config, customErrorCode) {
9350
9404
  error,
9351
9405
  config.getContentGeneratorConfig()?.authType
9352
9406
  );
9353
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
9407
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
9354
9408
  const streamFormatter = new StreamJsonFormatter();
9355
9409
  const errorCode = customErrorCode ?? extractErrorCode(error);
9356
9410
  const metrics = uiTelemetryService.getMetrics();
9357
9411
  streamFormatter.emitEvent({
9358
- type: "result" /* RESULT */,
9412
+ type: JsonStreamEventType.RESULT,
9359
9413
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9360
9414
  status: "error",
9361
9415
  error: {
@@ -9366,7 +9420,7 @@ function handleError(error, config, customErrorCode) {
9366
9420
  });
9367
9421
  runSyncCleanup();
9368
9422
  process.exit(getNumericExitCode(errorCode));
9369
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9423
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9370
9424
  const formatter = new JsonFormatter();
9371
9425
  const errorCode = customErrorCode ?? extractErrorCode(error);
9372
9426
  const formattedError = formatter.formatError(
@@ -9386,11 +9440,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
9386
9440
  const isFatal = isFatalToolError(errorType);
9387
9441
  if (isFatal) {
9388
9442
  const toolExecutionError = new FatalToolExecutionError(errorMessage);
9389
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
9443
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
9390
9444
  const streamFormatter = new StreamJsonFormatter();
9391
9445
  const metrics = uiTelemetryService.getMetrics();
9392
9446
  streamFormatter.emitEvent({
9393
- type: "result" /* RESULT */,
9447
+ type: JsonStreamEventType.RESULT,
9394
9448
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9395
9449
  status: "error",
9396
9450
  error: {
@@ -9399,7 +9453,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
9399
9453
  },
9400
9454
  stats: streamFormatter.convertToStreamStats(metrics, 0)
9401
9455
  });
9402
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9456
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9403
9457
  const formatter = new JsonFormatter();
9404
9458
  const formattedError = formatter.formatError(
9405
9459
  toolExecutionError,
@@ -9417,11 +9471,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
9417
9471
  }
9418
9472
  function handleCancellationError(config) {
9419
9473
  const cancellationError = new FatalCancellationError("Operation cancelled.");
9420
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
9474
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
9421
9475
  const streamFormatter = new StreamJsonFormatter();
9422
9476
  const metrics = uiTelemetryService.getMetrics();
9423
9477
  streamFormatter.emitEvent({
9424
- type: "result" /* RESULT */,
9478
+ type: JsonStreamEventType.RESULT,
9425
9479
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9426
9480
  status: "error",
9427
9481
  error: {
@@ -9432,7 +9486,7 @@ function handleCancellationError(config) {
9432
9486
  });
9433
9487
  runSyncCleanup();
9434
9488
  process.exit(cancellationError.exitCode);
9435
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9489
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9436
9490
  const formatter = new JsonFormatter();
9437
9491
  const formattedError = formatter.formatError(
9438
9492
  cancellationError,
@@ -9452,11 +9506,11 @@ function handleMaxTurnsExceededError(config) {
9452
9506
  const maxTurnsError = new FatalTurnLimitedError(
9453
9507
  "Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
9454
9508
  );
9455
- if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
9509
+ if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
9456
9510
  const streamFormatter = new StreamJsonFormatter();
9457
9511
  const metrics = uiTelemetryService.getMetrics();
9458
9512
  streamFormatter.emitEvent({
9459
- type: "result" /* RESULT */,
9513
+ type: JsonStreamEventType.RESULT,
9460
9514
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9461
9515
  status: "error",
9462
9516
  error: {
@@ -9467,7 +9521,7 @@ function handleMaxTurnsExceededError(config) {
9467
9521
  });
9468
9522
  runSyncCleanup();
9469
9523
  process.exit(maxTurnsError.exitCode);
9470
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9524
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9471
9525
  const formatter = new JsonFormatter();
9472
9526
  const formattedError = formatter.formatError(
9473
9527
  maxTurnsError,
@@ -9547,7 +9601,7 @@ async function runNonInteractive({
9547
9601
  }
9548
9602
  });
9549
9603
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
9550
- const { setupInitialActivityLogger } = await import("./devtoolsService-UQCUIXV5.js");
9604
+ const { setupInitialActivityLogger } = await import("./devtoolsService-6GKOMHGW.js");
9551
9605
  await setupInitialActivityLogger(config);
9552
9606
  }
9553
9607
  const { stdout: workingStdout } = createWorkingStdio();
@@ -9563,7 +9617,7 @@ async function runNonInteractive({
9563
9617
  }
9564
9618
  };
9565
9619
  const startTime = Date.now();
9566
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
9620
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
9567
9621
  const abortController = new AbortController();
9568
9622
  let isAborting = false;
9569
9623
  let cancelMessageTimer = null;
@@ -9616,13 +9670,13 @@ async function runNonInteractive({
9616
9670
  };
9617
9671
  try {
9618
9672
  consolePatcher.patch();
9619
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
9673
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
9620
9674
  process.stderr.write(
9621
9675
  "[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
9676
  );
9623
9677
  }
9624
9678
  setupStdinCancellation();
9625
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
9679
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
9626
9680
  coreEvents.drainBacklogs();
9627
9681
  process.stdout.on("error", (err) => {
9628
9682
  if (err.code === "EPIPE") {
@@ -9648,7 +9702,7 @@ async function runNonInteractive({
9648
9702
  }
9649
9703
  if (streamFormatter) {
9650
9704
  streamFormatter.emitEvent({
9651
- type: "init" /* INIT */,
9705
+ type: JsonStreamEventType.INIT,
9652
9706
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9653
9707
  session_id: config.getSessionId(),
9654
9708
  model: config.getModel()
@@ -9686,7 +9740,7 @@ async function runNonInteractive({
9686
9740
  }
9687
9741
  if (streamFormatter) {
9688
9742
  streamFormatter.emitEvent({
9689
- type: "message" /* MESSAGE */,
9743
+ type: JsonStreamEventType.MESSAGE,
9690
9744
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9691
9745
  role: "user",
9692
9746
  content: input
@@ -9725,12 +9779,12 @@ async function runNonInteractive({
9725
9779
  const metrics = uiTelemetryService.getMetrics();
9726
9780
  const durationMs = Date.now() - startTime;
9727
9781
  streamFormatter.emitEvent({
9728
- type: "result" /* RESULT */,
9782
+ type: JsonStreamEventType.RESULT,
9729
9783
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9730
9784
  status: "success",
9731
9785
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
9732
9786
  });
9733
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9787
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9734
9788
  const formatter = new JsonFormatter();
9735
9789
  const stats = uiTelemetryService.getMetrics();
9736
9790
  textOutput.write(
@@ -9816,13 +9870,13 @@ async function runNonInteractive({
9816
9870
  const output = isRaw ? part.text : stripAnsi(part.text);
9817
9871
  if (streamFormatter) {
9818
9872
  streamFormatter.emitEvent({
9819
- type: "message" /* MESSAGE */,
9873
+ type: JsonStreamEventType.MESSAGE,
9820
9874
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9821
9875
  role: "assistant",
9822
9876
  content: output,
9823
9877
  delta: true
9824
9878
  });
9825
- } else if (config.getOutputFormat() === "json" /* JSON */) {
9879
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
9826
9880
  responseText += output;
9827
9881
  } else {
9828
9882
  if (part.text) {
@@ -9835,13 +9889,13 @@ async function runNonInteractive({
9835
9889
  break;
9836
9890
  }
9837
9891
  case "tool_request": {
9838
- if (config.getOutputFormat() === "json" /* JSON */) {
9892
+ if (config.getOutputFormat() === OutputFormat.JSON) {
9839
9893
  preToolResponseText = responseText || preToolResponseText;
9840
9894
  responseText = "";
9841
9895
  }
9842
9896
  if (streamFormatter) {
9843
9897
  streamFormatter.emitEvent({
9844
- type: "tool_use" /* TOOL_USE */,
9898
+ type: JsonStreamEventType.TOOL_USE,
9845
9899
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9846
9900
  tool_name: event.name,
9847
9901
  tool_id: event.requestId,
@@ -9857,7 +9911,7 @@ async function runNonInteractive({
9857
9911
  const displayText = displayContentToString(display);
9858
9912
  const errorMsg = getTextContent(event.content) ?? "Tool error";
9859
9913
  streamFormatter.emitEvent({
9860
- type: "tool_result" /* TOOL_RESULT */,
9914
+ type: JsonStreamEventType.TOOL_RESULT,
9861
9915
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9862
9916
  tool_id: event.requestId,
9863
9917
  status: event.isError ? "error" : "success",
@@ -9872,17 +9926,17 @@ async function runNonInteractive({
9872
9926
  const display = event.display?.result;
9873
9927
  const displayText = displayContentToString(display);
9874
9928
  const errorMsg = getTextContent(event.content) ?? "Tool error";
9875
- if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
9876
- if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
9929
+ if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
9930
+ if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
9877
9931
  responseText = preToolResponseText;
9878
9932
  }
9879
9933
  const stopMessage = `Agent execution stopped: ${errorMsg}`;
9880
- if (config.getOutputFormat() === "text" /* TEXT */) {
9934
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
9881
9935
  process.stderr.write(`${stopMessage}
9882
9936
  `);
9883
9937
  }
9884
9938
  }
9885
- if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
9939
+ if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
9886
9940
  throw new FatalToolExecutionError(
9887
9941
  "Error executing tool " + event.name + ": " + (displayText || errorMsg)
9888
9942
  );
@@ -9903,20 +9957,20 @@ async function runNonInteractive({
9903
9957
  }
9904
9958
  const errorCode = event._meta?.["code"];
9905
9959
  if (errorCode === "AGENT_EXECUTION_BLOCKED") {
9906
- if (config.getOutputFormat() === "text" /* TEXT */) {
9960
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
9907
9961
  process.stderr.write(`[WARNING] ${event.message}
9908
9962
  `);
9909
9963
  }
9910
9964
  break;
9911
9965
  }
9912
9966
  const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
9913
- if (config.getOutputFormat() === "text" /* TEXT */) {
9967
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
9914
9968
  process.stderr.write(`[WARNING] ${event.message}
9915
9969
  `);
9916
9970
  }
9917
9971
  if (streamFormatter) {
9918
9972
  streamFormatter.emitEvent({
9919
- type: "error" /* ERROR */,
9973
+ type: JsonStreamEventType.ERROR,
9920
9974
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9921
9975
  severity,
9922
9976
  message: event.message
@@ -9935,7 +9989,7 @@ async function runNonInteractive({
9935
9989
  );
9936
9990
  } else if (streamFormatter) {
9937
9991
  streamFormatter.emitEvent({
9938
- type: "error" /* ERROR */,
9992
+ type: JsonStreamEventType.ERROR,
9939
9993
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9940
9994
  severity: "error",
9941
9995
  message: "Maximum session turns exceeded"
@@ -9943,7 +9997,7 @@ async function runNonInteractive({
9943
9997
  }
9944
9998
  }
9945
9999
  const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
9946
- if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
10000
+ if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
9947
10001
  process.stderr.write(`Agent execution stopped: ${stopMessage}
9948
10002
  `);
9949
10003
  }
@@ -9973,7 +10027,7 @@ async function runNonInteractive({
9973
10027
  abortController.signal.removeEventListener("abort", abortSession);
9974
10028
  scheduler?.dispose();
9975
10029
  consolePatcher.cleanup();
9976
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
10030
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
9977
10031
  }
9978
10032
  if (errorToHandle) {
9979
10033
  handleError(errorToHandle, config);
@@ -9998,7 +10052,7 @@ async function runNonInteractive2(params) {
9998
10052
  }
9999
10053
  });
10000
10054
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
10001
- const { setupInitialActivityLogger } = await import("./devtoolsService-UQCUIXV5.js");
10055
+ const { setupInitialActivityLogger } = await import("./devtoolsService-6GKOMHGW.js");
10002
10056
  await setupInitialActivityLogger(config);
10003
10057
  }
10004
10058
  const { stdout: workingStdout } = createWorkingStdio();
@@ -10014,7 +10068,7 @@ async function runNonInteractive2(params) {
10014
10068
  }
10015
10069
  };
10016
10070
  const startTime = Date.now();
10017
- const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
10071
+ const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
10018
10072
  const abortController = new AbortController();
10019
10073
  let isAborting = false;
10020
10074
  let cancelMessageTimer = null;
@@ -10065,13 +10119,13 @@ async function runNonInteractive2(params) {
10065
10119
  let scheduler;
10066
10120
  try {
10067
10121
  consolePatcher.patch();
10068
- if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
10122
+ if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
10069
10123
  process.stderr.write(
10070
10124
  "[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
10125
  );
10072
10126
  }
10073
10127
  setupStdinCancellation();
10074
- coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
10128
+ coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
10075
10129
  coreEvents.drainBacklogs();
10076
10130
  process.stdout.on("error", (err) => {
10077
10131
  if (err.code === "EPIPE") {
@@ -10095,7 +10149,7 @@ async function runNonInteractive2(params) {
10095
10149
  }
10096
10150
  if (streamFormatter) {
10097
10151
  streamFormatter.emitEvent({
10098
- type: "init" /* INIT */,
10152
+ type: JsonStreamEventType.INIT,
10099
10153
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10100
10154
  session_id: config.getSessionId(),
10101
10155
  model: config.getModel()
@@ -10133,7 +10187,7 @@ async function runNonInteractive2(params) {
10133
10187
  }
10134
10188
  if (streamFormatter) {
10135
10189
  streamFormatter.emitEvent({
10136
- type: "message" /* MESSAGE */,
10190
+ type: JsonStreamEventType.MESSAGE,
10137
10191
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10138
10192
  role: "user",
10139
10193
  content: input
@@ -10160,28 +10214,28 @@ async function runNonInteractive2(params) {
10160
10214
  if (abortController.signal.aborted) {
10161
10215
  handleCancellationError(config);
10162
10216
  }
10163
- if (event.type === "content" /* Content */) {
10217
+ if (event.type === GeminiEventType.Content) {
10164
10218
  const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
10165
10219
  const output = isRaw ? event.value : stripAnsi(event.value);
10166
10220
  if (streamFormatter) {
10167
10221
  streamFormatter.emitEvent({
10168
- type: "message" /* MESSAGE */,
10222
+ type: JsonStreamEventType.MESSAGE,
10169
10223
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10170
10224
  role: "assistant",
10171
10225
  content: output,
10172
10226
  delta: true
10173
10227
  });
10174
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10228
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10175
10229
  responseText += output;
10176
10230
  } else {
10177
10231
  if (event.value) {
10178
10232
  textOutput.write(output);
10179
10233
  }
10180
10234
  }
10181
- } else if (event.type === "tool_call_request" /* ToolCallRequest */) {
10235
+ } else if (event.type === GeminiEventType.ToolCallRequest) {
10182
10236
  if (streamFormatter) {
10183
10237
  streamFormatter.emitEvent({
10184
- type: "tool_use" /* TOOL_USE */,
10238
+ type: JsonStreamEventType.TOOL_USE,
10185
10239
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10186
10240
  tool_name: event.value.name,
10187
10241
  tool_id: event.value.callId,
@@ -10189,29 +10243,29 @@ async function runNonInteractive2(params) {
10189
10243
  });
10190
10244
  }
10191
10245
  toolCallRequests.push(event.value);
10192
- } else if (event.type === "loop_detected" /* LoopDetected */) {
10246
+ } else if (event.type === GeminiEventType.LoopDetected) {
10193
10247
  if (streamFormatter) {
10194
10248
  streamFormatter.emitEvent({
10195
- type: "error" /* ERROR */,
10249
+ type: JsonStreamEventType.ERROR,
10196
10250
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10197
10251
  severity: "warning",
10198
10252
  message: "Loop detected, stopping execution"
10199
10253
  });
10200
10254
  }
10201
- } else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
10255
+ } else if (event.type === GeminiEventType.MaxSessionTurns) {
10202
10256
  if (streamFormatter) {
10203
10257
  streamFormatter.emitEvent({
10204
- type: "error" /* ERROR */,
10258
+ type: JsonStreamEventType.ERROR,
10205
10259
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10206
10260
  severity: "error",
10207
10261
  message: "Maximum session turns exceeded"
10208
10262
  });
10209
10263
  }
10210
- } else if (event.type === "error" /* Error */) {
10264
+ } else if (event.type === GeminiEventType.Error) {
10211
10265
  throw event.value.error;
10212
- } else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
10266
+ } else if (event.type === GeminiEventType.AgentExecutionStopped) {
10213
10267
  const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
10214
- if (config.getOutputFormat() === "text" /* TEXT */) {
10268
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
10215
10269
  process.stderr.write(`${stopMessage}
10216
10270
  `);
10217
10271
  }
@@ -10219,7 +10273,7 @@ async function runNonInteractive2(params) {
10219
10273
  const metrics = uiTelemetryService.getMetrics();
10220
10274
  const durationMs = Date.now() - startTime;
10221
10275
  streamFormatter.emitEvent({
10222
- type: "result" /* RESULT */,
10276
+ type: JsonStreamEventType.RESULT,
10223
10277
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10224
10278
  status: "success",
10225
10279
  stats: streamFormatter.convertToStreamStats(
@@ -10229,9 +10283,9 @@ async function runNonInteractive2(params) {
10229
10283
  });
10230
10284
  }
10231
10285
  return;
10232
- } else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
10286
+ } else if (event.type === GeminiEventType.AgentExecutionBlocked) {
10233
10287
  const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
10234
- if (config.getOutputFormat() === "text" /* TEXT */) {
10288
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
10235
10289
  process.stderr.write(`[WARNING] ${blockMessage}
10236
10290
  `);
10237
10291
  }
@@ -10249,7 +10303,7 @@ async function runNonInteractive2(params) {
10249
10303
  const requestInfo = completedToolCall.request;
10250
10304
  if (streamFormatter) {
10251
10305
  streamFormatter.emitEvent({
10252
- type: "tool_result" /* TOOL_RESULT */,
10306
+ type: JsonStreamEventType.TOOL_RESULT,
10253
10307
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10254
10308
  tool_id: requestInfo.callId,
10255
10309
  status: completedToolCall.status === "error" ? "error" : "success",
@@ -10283,11 +10337,11 @@ async function runNonInteractive2(params) {
10283
10337
  );
10284
10338
  }
10285
10339
  const stopExecutionTool = completedToolCalls.find(
10286
- (tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
10340
+ (tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
10287
10341
  );
10288
10342
  if (stopExecutionTool && stopExecutionTool.response.error) {
10289
10343
  const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
10290
- if (config.getOutputFormat() === "text" /* TEXT */) {
10344
+ if (config.getOutputFormat() === OutputFormat.TEXT) {
10291
10345
  process.stderr.write(`${stopMessage}
10292
10346
  `);
10293
10347
  }
@@ -10295,7 +10349,7 @@ async function runNonInteractive2(params) {
10295
10349
  const metrics = uiTelemetryService.getMetrics();
10296
10350
  const durationMs = Date.now() - startTime;
10297
10351
  streamFormatter.emitEvent({
10298
- type: "result" /* RESULT */,
10352
+ type: JsonStreamEventType.RESULT,
10299
10353
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10300
10354
  status: "success",
10301
10355
  stats: streamFormatter.convertToStreamStats(
@@ -10303,7 +10357,7 @@ async function runNonInteractive2(params) {
10303
10357
  durationMs
10304
10358
  )
10305
10359
  });
10306
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10360
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10307
10361
  const formatter = new JsonFormatter();
10308
10362
  const stats = uiTelemetryService.getMetrics();
10309
10363
  textOutput.write(
@@ -10320,12 +10374,12 @@ async function runNonInteractive2(params) {
10320
10374
  const metrics = uiTelemetryService.getMetrics();
10321
10375
  const durationMs = Date.now() - startTime;
10322
10376
  streamFormatter.emitEvent({
10323
- type: "result" /* RESULT */,
10377
+ type: JsonStreamEventType.RESULT,
10324
10378
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10325
10379
  status: "success",
10326
10380
  stats: streamFormatter.convertToStreamStats(metrics, durationMs)
10327
10381
  });
10328
- } else if (config.getOutputFormat() === "json" /* JSON */) {
10382
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10329
10383
  const formatter = new JsonFormatter();
10330
10384
  const stats = uiTelemetryService.getMetrics();
10331
10385
  textOutput.write(
@@ -10343,7 +10397,7 @@ async function runNonInteractive2(params) {
10343
10397
  cleanupStdinCancellation();
10344
10398
  scheduler?.dispose();
10345
10399
  consolePatcher.cleanup();
10346
- coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
10400
+ coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
10347
10401
  }
10348
10402
  if (errorToHandle) {
10349
10403
  handleError(errorToHandle, config);
@@ -12814,12 +12868,12 @@ var GeminiAgent = class _GeminiAgent {
12814
12868
  this.clientCapabilities = args.clientCapabilities;
12815
12869
  const authMethods = [
12816
12870
  {
12817
- id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
12871
+ id: AuthType.LOGIN_WITH_GOOGLE,
12818
12872
  name: "Log in with Google",
12819
12873
  description: "Log in with your Google account"
12820
12874
  },
12821
12875
  {
12822
- id: "gemini-api-key" /* USE_GEMINI */,
12876
+ id: AuthType.USE_GEMINI,
12823
12877
  name: "Gemini API key",
12824
12878
  description: "Use an API key with Gemini Developer API",
12825
12879
  _meta: {
@@ -12829,12 +12883,12 @@ var GeminiAgent = class _GeminiAgent {
12829
12883
  }
12830
12884
  },
12831
12885
  {
12832
- id: "vertex-ai" /* USE_VERTEX_AI */,
12886
+ id: AuthType.USE_VERTEX_AI,
12833
12887
  name: "Vertex AI",
12834
12888
  description: "Use an API key with Vertex AI GenAI API"
12835
12889
  },
12836
12890
  {
12837
- id: "gateway" /* GATEWAY */,
12891
+ id: AuthType.GATEWAY,
12838
12892
  name: "AI API Gateway",
12839
12893
  description: "Use a custom AI API Gateway",
12840
12894
  _meta: {
@@ -12929,7 +12983,7 @@ var GeminiAgent = class _GeminiAgent {
12929
12983
  mcpServers,
12930
12984
  loadedSettings
12931
12985
  );
12932
- const authType = loadedSettings.merged.security.auth.selectedType || "gemini-api-key" /* USE_GEMINI */;
12986
+ const authType = loadedSettings.merged.security.auth.selectedType || AuthType.USE_GEMINI;
12933
12987
  let isAuthenticated = false;
12934
12988
  let authErrorMessage = "";
12935
12989
  try {
@@ -12941,7 +12995,7 @@ var GeminiAgent = class _GeminiAgent {
12941
12995
  );
12942
12996
  isAuthenticated = true;
12943
12997
  const contentGeneratorConfig = config.getContentGeneratorConfig();
12944
- if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
12998
+ if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
12945
12999
  isAuthenticated = false;
12946
13000
  authErrorMessage = "Gemini API key is missing or not configured.";
12947
13001
  }
@@ -13249,7 +13303,7 @@ ${thought.description}`;
13249
13303
  await this.sendUpdate({
13250
13304
  sessionUpdate: "tool_call",
13251
13305
  toolCallId: toolCall.id,
13252
- status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
13306
+ status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
13253
13307
  title: toolCall.displayName || toolCall.name,
13254
13308
  content: toolCallContent,
13255
13309
  kind: tool ? toAcpToolKind(tool.kind) : "other"
@@ -13302,7 +13356,7 @@ ${thought.description}`;
13302
13356
  while (nextMessage !== null) {
13303
13357
  if (pendingSend.signal.aborted) {
13304
13358
  chat.addHistory(nextMessage);
13305
- return { stopReason: "cancelled" /* Cancelled */ };
13359
+ return { stopReason: CoreToolCallStatus.Cancelled };
13306
13360
  }
13307
13361
  const functionCalls = [];
13308
13362
  try {
@@ -13322,7 +13376,7 @@ ${thought.description}`;
13322
13376
  nextMessage?.parts ?? [],
13323
13377
  promptId,
13324
13378
  pendingSend.signal,
13325
- "main" /* MAIN */
13379
+ LlmRole.MAIN
13326
13380
  );
13327
13381
  nextMessage = null;
13328
13382
  let turnInputTokens = 0;
@@ -13330,16 +13384,16 @@ ${thought.description}`;
13330
13384
  let turnModelId = model;
13331
13385
  for await (const resp of responseStream) {
13332
13386
  if (pendingSend.signal.aborted) {
13333
- return { stopReason: "cancelled" /* Cancelled */ };
13387
+ return { stopReason: CoreToolCallStatus.Cancelled };
13334
13388
  }
13335
- if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
13389
+ if (resp.type === StreamEventType.CHUNK && resp.value.usageMetadata) {
13336
13390
  turnInputTokens = resp.value.usageMetadata.promptTokenCount ?? turnInputTokens;
13337
13391
  turnOutputTokens = resp.value.usageMetadata.candidatesTokenCount ?? turnOutputTokens;
13338
13392
  if (resp.value.modelVersion) {
13339
13393
  turnModelId = resp.value.modelVersion;
13340
13394
  }
13341
13395
  }
13342
- if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
13396
+ if (resp.type === StreamEventType.CHUNK && resp.value.candidates && resp.value.candidates.length > 0) {
13343
13397
  const candidate = resp.value.candidates[0];
13344
13398
  for (const part of candidate.content?.parts ?? []) {
13345
13399
  if (!part.text) {
@@ -13355,7 +13409,7 @@ ${thought.description}`;
13355
13409
  });
13356
13410
  }
13357
13411
  }
13358
- if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
13412
+ if (resp.type === StreamEventType.CHUNK && resp.value.functionCalls) {
13359
13413
  functionCalls.push(...resp.value.functionCalls);
13360
13414
  }
13361
13415
  }
@@ -13371,7 +13425,7 @@ ${thought.description}`;
13371
13425
  modelUsageMap.set(turnModelId, existing);
13372
13426
  }
13373
13427
  if (pendingSend.signal.aborted) {
13374
- return { stopReason: "cancelled" /* Cancelled */ };
13428
+ return { stopReason: CoreToolCallStatus.Cancelled };
13375
13429
  }
13376
13430
  } catch (error) {
13377
13431
  if (getErrorStatus(error) === 429) {
@@ -13381,7 +13435,7 @@ ${thought.description}`;
13381
13435
  );
13382
13436
  }
13383
13437
  if (pendingSend.signal.aborted || error instanceof Error && error.name === "AbortError") {
13384
- return { stopReason: "cancelled" /* Cancelled */ };
13438
+ return { stopReason: CoreToolCallStatus.Cancelled };
13385
13439
  }
13386
13440
  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
13441
  return {
@@ -13545,7 +13599,7 @@ ${thought.description}`;
13545
13599
  const output = RequestPermissionResponseSchema.parse(
13546
13600
  await this.connection.requestPermission(params)
13547
13601
  );
13548
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
13602
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
13549
13603
  await confirmationDetails.onConfirm(outcome);
13550
13604
  await updatePolicy(
13551
13605
  tool,
@@ -13556,16 +13610,16 @@ ${thought.description}`;
13556
13610
  invocation
13557
13611
  );
13558
13612
  switch (outcome) {
13559
- case "cancel" /* Cancel */:
13613
+ case ToolConfirmationOutcome.Cancel:
13560
13614
  return errorResponse(
13561
13615
  new Error(`Tool "${fc.name}" was canceled by the user.`)
13562
13616
  );
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 */:
13617
+ case ToolConfirmationOutcome.ProceedOnce:
13618
+ case ToolConfirmationOutcome.ProceedAlways:
13619
+ case ToolConfirmationOutcome.ProceedAlwaysAndSave:
13620
+ case ToolConfirmationOutcome.ProceedAlwaysServer:
13621
+ case ToolConfirmationOutcome.ProceedAlwaysTool:
13622
+ case ToolConfirmationOutcome.ModifyWithEditor:
13569
13623
  break;
13570
13624
  default: {
13571
13625
  const resultOutcome = outcome;
@@ -13613,7 +13667,7 @@ ${thought.description}`;
13613
13667
  );
13614
13668
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
13615
13669
  {
13616
- status: "success" /* Success */,
13670
+ status: CoreToolCallStatus.Success,
13617
13671
  request: {
13618
13672
  callId,
13619
13673
  name: fc.name,
@@ -13658,7 +13712,7 @@ ${thought.description}`;
13658
13712
  });
13659
13713
  this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
13660
13714
  {
13661
- status: "error" /* Error */,
13715
+ status: CoreToolCallStatus.Error,
13662
13716
  request: {
13663
13717
  callId,
13664
13718
  name: fc.name,
@@ -13773,12 +13827,12 @@ ${thought.description}`;
13773
13827
  sessionId: this.id,
13774
13828
  options: [
13775
13829
  {
13776
- optionId: "proceed_once" /* ProceedOnce */,
13830
+ optionId: ToolConfirmationOutcome.ProceedOnce,
13777
13831
  name: "Allow once",
13778
13832
  kind: "allow_once"
13779
13833
  },
13780
13834
  {
13781
- optionId: "cancel" /* Cancel */,
13835
+ optionId: ToolConfirmationOutcome.Cancel,
13782
13836
  name: "Deny",
13783
13837
  kind: "reject_once"
13784
13838
  }
@@ -13803,8 +13857,8 @@ ${thought.description}`;
13803
13857
  const output = RequestPermissionResponseSchema.parse(
13804
13858
  await this.connection.requestPermission(params)
13805
13859
  );
13806
- const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
13807
- if (outcome === "proceed_once" /* ProceedOnce */) {
13860
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
13861
+ if (outcome === ToolConfirmationOutcome.ProceedOnce) {
13808
13862
  this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
13809
13863
  validationError = null;
13810
13864
  } else {
@@ -14181,12 +14235,12 @@ function toToolCallContent(toolResult) {
14181
14235
  }
14182
14236
  var basicPermissionOptions = [
14183
14237
  {
14184
- optionId: "proceed_once" /* ProceedOnce */,
14238
+ optionId: ToolConfirmationOutcome.ProceedOnce,
14185
14239
  name: "Allow",
14186
14240
  kind: "allow_once"
14187
14241
  },
14188
14242
  {
14189
- optionId: "cancel" /* Cancel */,
14243
+ optionId: ToolConfirmationOutcome.Cancel,
14190
14244
  name: "Reject",
14191
14245
  kind: "reject_once"
14192
14246
  }
@@ -14198,13 +14252,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14198
14252
  switch (confirmation.type) {
14199
14253
  case "edit":
14200
14254
  options.push({
14201
- optionId: "proceed_always" /* ProceedAlways */,
14255
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14202
14256
  name: "Allow for this session",
14203
14257
  kind: "allow_always"
14204
14258
  });
14205
14259
  if (enablePermanentToolApproval) {
14206
14260
  options.push({
14207
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14261
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14208
14262
  name: "Allow for this file in all future sessions",
14209
14263
  kind: "allow_always"
14210
14264
  });
@@ -14212,13 +14266,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14212
14266
  break;
14213
14267
  case "exec":
14214
14268
  options.push({
14215
- optionId: "proceed_always" /* ProceedAlways */,
14269
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14216
14270
  name: "Allow for this session",
14217
14271
  kind: "allow_always"
14218
14272
  });
14219
14273
  if (enablePermanentToolApproval) {
14220
14274
  options.push({
14221
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14275
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14222
14276
  name: "Allow this command for all future sessions",
14223
14277
  kind: "allow_always"
14224
14278
  });
@@ -14227,19 +14281,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14227
14281
  case "mcp":
14228
14282
  options.push(
14229
14283
  {
14230
- optionId: "proceed_always_server" /* ProceedAlwaysServer */,
14284
+ optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
14231
14285
  name: "Allow all server tools for this session",
14232
14286
  kind: "allow_always"
14233
14287
  },
14234
14288
  {
14235
- optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
14289
+ optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
14236
14290
  name: "Allow tool for this session",
14237
14291
  kind: "allow_always"
14238
14292
  }
14239
14293
  );
14240
14294
  if (enablePermanentToolApproval) {
14241
14295
  options.push({
14242
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14296
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14243
14297
  name: "Allow tool for all future sessions",
14244
14298
  kind: "allow_always"
14245
14299
  });
@@ -14247,13 +14301,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14247
14301
  break;
14248
14302
  case "info":
14249
14303
  options.push({
14250
- optionId: "proceed_always" /* ProceedAlways */,
14304
+ optionId: ToolConfirmationOutcome.ProceedAlways,
14251
14305
  name: "Allow for this session",
14252
14306
  kind: "allow_always"
14253
14307
  });
14254
14308
  if (enablePermanentToolApproval) {
14255
14309
  options.push({
14256
- optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
14310
+ optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
14257
14311
  name: "Allow for all future sessions",
14258
14312
  kind: "allow_always"
14259
14313
  });
@@ -14285,21 +14339,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
14285
14339
  }
14286
14340
  function toAcpToolKind(kind) {
14287
14341
  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 */:
14342
+ case Kind.Read:
14343
+ case Kind.Edit:
14344
+ case Kind.Execute:
14345
+ case Kind.Search:
14346
+ case Kind.Delete:
14347
+ case Kind.Move:
14348
+ case Kind.Think:
14349
+ case Kind.Fetch:
14350
+ case Kind.SwitchMode:
14351
+ case Kind.Other:
14298
14352
  return kind;
14299
- case "agent" /* Agent */:
14353
+ case Kind.Agent:
14300
14354
  return "think";
14301
- case "plan" /* Plan */:
14302
- case "communicate" /* Communicate */:
14355
+ case Kind.Plan:
14356
+ case Kind.Communicate:
14303
14357
  default:
14304
14358
  return "other";
14305
14359
  }
@@ -14307,24 +14361,24 @@ function toAcpToolKind(kind) {
14307
14361
  function buildAvailableModes(isPlanEnabled) {
14308
14362
  const modes = [
14309
14363
  {
14310
- id: "default" /* DEFAULT */,
14364
+ id: ApprovalMode.DEFAULT,
14311
14365
  name: "Default",
14312
14366
  description: "Prompts for approval"
14313
14367
  },
14314
14368
  {
14315
- id: "autoEdit" /* AUTO_EDIT */,
14369
+ id: ApprovalMode.AUTO_EDIT,
14316
14370
  name: "Auto Edit",
14317
14371
  description: "Auto-approves edit tools"
14318
14372
  },
14319
14373
  {
14320
- id: "yolo" /* YOLO */,
14374
+ id: ApprovalMode.YOLO,
14321
14375
  name: "YOLO",
14322
14376
  description: "Auto-approves all tools"
14323
14377
  }
14324
14378
  ];
14325
14379
  if (isPlanEnabled) {
14326
14380
  modes.push({
14327
- id: "plan" /* PLAN */,
14381
+ id: ApprovalMode.PLAN,
14328
14382
  name: "Plan",
14329
14383
  description: "Read-only mode"
14330
14384
  });
@@ -14337,7 +14391,7 @@ function buildAvailableModels(config, settings) {
14337
14391
  const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
14338
14392
  const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
14339
14393
  const selectedAuthType = settings.merged.security.auth.selectedType;
14340
- const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
14394
+ const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
14341
14395
  if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
14342
14396
  const options = config.getModelConfigService().getAvailableModelOptions({
14343
14397
  useGemini3_1: useGemini31,
@@ -14435,7 +14489,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
14435
14489
  }
14436
14490
  return authType;
14437
14491
  } catch (error) {
14438
- if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
14492
+ if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
14439
14493
  handleError(
14440
14494
  error instanceof Error ? error : new Error(String(error)),
14441
14495
  nonInteractiveConfig,
@@ -14631,10 +14685,10 @@ var SlashCommandConflictHandler = class {
14631
14685
  this.handleConflicts = this.handleConflicts.bind(this);
14632
14686
  }
14633
14687
  start() {
14634
- coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
14688
+ coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
14635
14689
  }
14636
14690
  stop() {
14637
- coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
14691
+ coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
14638
14692
  if (this.flushTimeout) {
14639
14693
  clearTimeout(this.flushTimeout);
14640
14694
  this.flushTimeout = null;
@@ -14845,7 +14899,7 @@ async function resolveSessionId(resumeArg) {
14845
14899
  }
14846
14900
  }
14847
14901
  async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
14848
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-LXXBYVNU.js");
14902
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-F6YUYJT5.js");
14849
14903
  await doStartUI(
14850
14904
  config,
14851
14905
  settings,
@@ -14944,12 +14998,12 @@ async function main() {
14944
14998
  dns.setDefaultResultOrder(
14945
14999
  validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
14946
15000
  );
14947
- if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
15001
+ if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
14948
15002
  if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
14949
15003
  settings.setValue(
14950
15004
  "User" /* User */,
14951
15005
  "security.auth.selectedType",
14952
- "compute-default-credentials" /* COMPUTE_ADC */
15006
+ AuthType.COMPUTE_ADC
14953
15007
  );
14954
15008
  }
14955
15009
  }
@@ -15047,7 +15101,7 @@ ${finalArgs[promptIndex + 1]}`;
15047
15101
  await config.storage.initialize();
15048
15102
  adminControlsListner.setConfig(config);
15049
15103
  if (config.isInteractive() && settings.merged.general.devtools) {
15050
- const { setupInitialActivityLogger } = await import("./devtoolsService-UQCUIXV5.js");
15104
+ const { setupInitialActivityLogger } = await import("./devtoolsService-6GKOMHGW.js");
15051
15105
  await setupInitialActivityLogger(config);
15052
15106
  }
15053
15107
  registerTelemetryConfig(config);
@@ -15055,7 +15109,7 @@ ${finalArgs[promptIndex + 1]}`;
15055
15109
  const messageBus = config.getMessageBus();
15056
15110
  createPolicyUpdater2(policyEngine, messageBus, config.storage);
15057
15111
  registerCleanup(async () => {
15058
- await config.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
15112
+ await config.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
15059
15113
  });
15060
15114
  cleanupExpiredSessions(config, settings.merged).catch((e) => {
15061
15115
  debugLogger.error("Failed to cleanup expired sessions:", e);
@@ -15103,7 +15157,7 @@ ${finalArgs[promptIndex + 1]}`;
15103
15157
  const initAppHandle = startupProfiler.start("initialize_app");
15104
15158
  const initializationResult = await initializeApp(config, settings);
15105
15159
  initAppHandle?.end();
15106
- if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
15160
+ if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
15107
15161
  await getOauthClient(settings.merged.security.auth.selectedType, config);
15108
15162
  }
15109
15163
  if (config.getAcpMode()) {
@@ -15119,13 +15173,18 @@ ${finalArgs[promptIndex + 1]}`;
15119
15173
  ...rawStartupWarnings.map((message) => ({
15120
15174
  id: `startup-${createHash("sha256").update(message).digest("hex").substring(0, 16)}`,
15121
15175
  message,
15122
- priority: "high" /* High */
15176
+ priority: WarningPriority.High
15123
15177
  })),
15124
15178
  ...await getUserStartupWarnings(settings.merged, void 0, {
15125
15179
  isAlternateBuffer: useAlternateBuffer
15126
15180
  })
15127
15181
  ];
15128
15182
  cliStartupHandle?.end();
15183
+ if (!config.isInteractive()) {
15184
+ for (const warning of startupWarnings) {
15185
+ writeToStderr(warning.message + "\n");
15186
+ }
15187
+ }
15129
15188
  if (config.isInteractive()) {
15130
15189
  if (process.stdin.isTTY) {
15131
15190
  process.stdin.resume();
@@ -15151,7 +15210,7 @@ ${finalArgs[promptIndex + 1]}`;
15151
15210
  ${input}` : stdinData;
15152
15211
  }
15153
15212
  }
15154
- const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
15213
+ const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
15155
15214
  const hookSystem = config?.getHookSystem();
15156
15215
  if (hookSystem) {
15157
15216
  const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
@@ -15208,16 +15267,16 @@ ${input}` : wrappedContext;
15208
15267
  }
15209
15268
  }
15210
15269
  function initializeOutputListenersAndFlush() {
15211
- if (coreEvents.listenerCount("output" /* Output */) === 0) {
15212
- coreEvents.on("output" /* Output */, (payload) => {
15270
+ if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
15271
+ coreEvents.on(CoreEvent.Output, (payload) => {
15213
15272
  if (payload.isStderr) {
15214
15273
  writeToStderr(payload.chunk, payload.encoding);
15215
15274
  } else {
15216
15275
  writeToStdout(payload.chunk, payload.encoding);
15217
15276
  }
15218
15277
  });
15219
- if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
15220
- coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
15278
+ if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
15279
+ coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
15221
15280
  if (payload.type === "error" || payload.type === "warn") {
15222
15281
  writeToStderr(payload.content);
15223
15282
  } else {
@@ -15225,8 +15284,8 @@ function initializeOutputListenersAndFlush() {
15225
15284
  }
15226
15285
  });
15227
15286
  }
15228
- if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
15229
- coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
15287
+ if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
15288
+ coreEvents.on(CoreEvent.UserFeedback, (payload) => {
15230
15289
  if (payload.severity === "error" || payload.severity === "warning") {
15231
15290
  writeToStderr(payload.message);
15232
15291
  } else {