@google/gemini-cli 0.40.0-preview.2 → 0.40.0-preview.4

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 (66) hide show
  1. package/bundle/{chunk-3GU3LF3I.js → chunk-4XVBQQNJ.js} +181 -16
  2. package/bundle/{chunk-PLUWJHZZ.js → chunk-547AWTTH.js} +238 -61
  3. package/bundle/{chunk-EFCQXWIF.js → chunk-63PTTRTA.js} +3 -3
  4. package/bundle/{chunk-IMEC72NS.js → chunk-ATGIEBEB.js} +1 -1
  5. package/bundle/{chunk-WL5MCPV2.js → chunk-BV2W6YE6.js} +2 -2
  6. package/bundle/{chunk-QK7UWGBN.js → chunk-CIO3GUGQ.js} +1382 -1083
  7. package/bundle/{chunk-HV36F4CL.js → chunk-CJQVVQSH.js} +134 -354
  8. package/bundle/{chunk-VCGILCZV.js → chunk-F73F75XM.js} +16 -0
  9. package/bundle/{chunk-TDW6FM3A.js → chunk-G356GKHH.js} +1 -1
  10. package/bundle/{chunk-4IJPDKI6.js → chunk-H4NQBTXN.js} +146 -364
  11. package/bundle/{chunk-GXRQOXQF.js → chunk-H7F2VOIJ.js} +178 -14
  12. package/bundle/chunk-HF7X35D3.js +80012 -0
  13. package/bundle/{chunk-WHIWQCI5.js → chunk-HGFADN5A.js} +1 -1
  14. package/bundle/{chunk-NO7STVVM.js → chunk-KG7ZFMJL.js} +1413 -1089
  15. package/bundle/{chunk-33ANPP4S.js → chunk-LMVZLINC.js} +3 -3
  16. package/bundle/chunk-LODNDE3S.js +17505 -0
  17. package/bundle/{chunk-IUVLJUOL.js → chunk-LVHUYMBU.js} +2 -2
  18. package/bundle/{chunk-NIVCRM5L.js → chunk-M76FWZ5L.js} +134 -354
  19. package/bundle/{chunk-RM43GNQQ.js → chunk-NV6UCR4K.js} +7711 -12909
  20. package/bundle/{chunk-MUGUV6RZ.js → chunk-PRZIW6SM.js} +2 -2
  21. package/bundle/chunk-RENFZ63F.js +351149 -0
  22. package/bundle/chunk-SYPUOR3U.js +156 -0
  23. package/bundle/{chunk-2RHFUIH4.js → chunk-UHHRGNIO.js} +16 -0
  24. package/bundle/chunk-VQ7N6NVX.js +1571 -0
  25. package/bundle/{chunk-UBXB5AEJ.js → chunk-WSTHO4WR.js} +3 -3
  26. package/bundle/chunk-ZQNX6OWU.js +118 -0
  27. package/bundle/{cleanup-A7WXWAMI.js → cleanup-4EFDM2N7.js} +3 -3
  28. package/bundle/{cleanup-EWPIME2M.js → cleanup-4RRVO4GO.js} +3 -3
  29. package/bundle/{cleanup-IPLJJT5S.js → cleanup-DNS7PXYC.js} +3 -3
  30. package/bundle/cleanup-DXHNV2J6.js +33 -0
  31. package/bundle/{core-VCDK23ZC.js → core-WQSFCPEO.js} +28 -2
  32. package/bundle/{devtoolsService-6Y6YER6T.js → devtoolsService-JWET4G6G.js} +3 -3
  33. package/bundle/{devtoolsService-B5VVZ752.js → devtoolsService-LPEBYJVD.js} +3 -3
  34. package/bundle/{devtoolsService-2JXSALRU.js → devtoolsService-S2LBUUZU.js} +5 -4
  35. package/bundle/devtoolsService-YCRNWWXE.js +852 -0
  36. package/bundle/{dist-UIXQETMC.js → dist-ANTOB3YW.js} +28 -2
  37. package/bundle/{core-BQT6T3CH.js → dist-RIVCP5ZD.js} +28 -2
  38. package/bundle/dist-UH565MTG.js +2046 -0
  39. package/bundle/docs/cli/cli-reference.md +1 -0
  40. package/bundle/docs/cli/trusted-folders.md +28 -0
  41. package/bundle/docs/reference/configuration.md +14 -0
  42. package/bundle/{gemini-ID44Z5SV.js → gemini-27FQ5BI4.js} +66 -22
  43. package/bundle/{gemini-54LH6RUH.js → gemini-57EC2ZF7.js} +241 -182
  44. package/bundle/{gemini-44W2QEZI.js → gemini-JAZVYRDD.js} +64 -21
  45. package/bundle/gemini-TQZRS37Q.js +16087 -0
  46. package/bundle/gemini.js +3 -3
  47. package/bundle/{interactiveCli-5MTJDFYC.js → interactiveCli-E35R6QQC.js} +17 -167
  48. package/bundle/{interactiveCli-JFBPGMNM.js → interactiveCli-FPHSBRV3.js} +30 -179
  49. package/bundle/{interactiveCli-5B3X6RNB.js → interactiveCli-L3EK4XEX.js} +300 -432
  50. package/bundle/interactiveCli-MVHR4VV7.js +34448 -0
  51. package/bundle/{liteRtServerManager-76V63PRJ.js → liteRtServerManager-LXEAYAUP.js} +4 -4
  52. package/bundle/{liteRtServerManager-WQMDPACQ.js → liteRtServerManager-ORSW3R4F.js} +4 -4
  53. package/bundle/{liteRtServerManager-6GJWEP5W.js → liteRtServerManager-PI4ZNFB5.js} +4 -4
  54. package/bundle/liteRtServerManager-YYXO5Q3I.js +65 -0
  55. package/bundle/{memoryDiscovery-RYHYLAPJ.js → memoryDiscovery-CZURD35O.js} +1 -1
  56. package/bundle/{memoryDiscovery-HWEYBJE7.js → memoryDiscovery-GZLXKRGB.js} +1 -1
  57. package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
  58. package/bundle/{oauth2-provider-EX6SQEZP.js → oauth2-provider-B3NTBNAM.js} +2 -2
  59. package/bundle/{oauth2-provider-ZF52AWQY.js → oauth2-provider-ENF2D4Q7.js} +39 -73
  60. package/bundle/{oauth2-provider-JCKLNKRV.js → oauth2-provider-I3G773GE.js} +2 -2
  61. package/bundle/oauth2-provider-WTF7AHQ2.js +237 -0
  62. package/bundle/{start-CYDJTOAP.js → start-CRIFZ3SW.js} +6 -6
  63. package/bundle/{start-SHOUHW3Y.js → start-KVFKS3IT.js} +6 -6
  64. package/bundle/{start-B6EMQCH5.js → start-OTLGMCNH.js} +6 -6
  65. package/bundle/start-S3REI3X2.js +18 -0
  66. package/package.json +1 -1
@@ -1,27 +1,29 @@
1
1
  const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
2
  import {
3
3
  AuthProviderType,
4
+ CoreToolCallStatus,
4
5
  DEFAULT_MODEL_CONFIGS,
5
6
  DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
6
7
  SESSION_FILE_PREFIX,
7
8
  TOOL_OUTPUTS_DIR,
8
9
  ansiRegex,
9
10
  checkExhaustive,
11
+ checkPathTrust,
10
12
  createCache,
11
13
  deleteSessionArtifactsAsync,
12
14
  deleteSubagentSessionDirAndArtifactsAsync,
13
15
  getFsErrorMessage,
14
- ideContextStore,
15
16
  import_lru_cache,
16
17
  isHeadlessMode,
17
- isWithinRoot,
18
18
  loadConversationRecord,
19
+ loadTrustedFolders,
19
20
  partListUnionToString,
20
21
  require_strip_json_comments,
21
22
  sanitizeFilenamePart,
22
23
  stripAnsi
23
- } from "./chunk-RM43GNQQ.js";
24
+ } from "./chunk-CIO3GUGQ.js";
24
25
  import {
26
+ CoreEvent,
25
27
  FatalConfigError,
26
28
  GEMINI_DIR,
27
29
  Storage,
@@ -29,9 +31,8 @@ import {
29
31
  debugLogger,
30
32
  external_exports,
31
33
  getErrorMessage,
32
- homedir,
33
- require_proper_lockfile
34
- } from "./chunk-2RHFUIH4.js";
34
+ homedir
35
+ } from "./chunk-F73F75XM.js";
35
36
  import {
36
37
  __commonJS,
37
38
  __require,
@@ -562,10 +563,10 @@ var require_package = __commonJS({
562
563
  // node_modules/dotenv/lib/main.js
563
564
  var require_main = __commonJS({
564
565
  "node_modules/dotenv/lib/main.js"(exports, module) {
565
- var fs7 = __require("fs");
566
- var path7 = __require("path");
566
+ var fs6 = __require("fs");
567
+ var path6 = __require("path");
567
568
  var os = __require("os");
568
- var crypto2 = __require("crypto");
569
+ var crypto = __require("crypto");
569
570
  var packageJson = require_package();
570
571
  var version = packageJson.version;
571
572
  var TIPS = [
@@ -692,7 +693,7 @@ var require_main = __commonJS({
692
693
  if (options && options.path && options.path.length > 0) {
693
694
  if (Array.isArray(options.path)) {
694
695
  for (const filepath of options.path) {
695
- if (fs7.existsSync(filepath)) {
696
+ if (fs6.existsSync(filepath)) {
696
697
  possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
697
698
  }
698
699
  }
@@ -700,15 +701,15 @@ var require_main = __commonJS({
700
701
  possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
701
702
  }
702
703
  } else {
703
- possibleVaultPath = path7.resolve(process.cwd(), ".env.vault");
704
+ possibleVaultPath = path6.resolve(process.cwd(), ".env.vault");
704
705
  }
705
- if (fs7.existsSync(possibleVaultPath)) {
706
+ if (fs6.existsSync(possibleVaultPath)) {
706
707
  return possibleVaultPath;
707
708
  }
708
709
  return null;
709
710
  }
710
711
  function _resolveHome(envPath) {
711
- return envPath[0] === "~" ? path7.join(os.homedir(), envPath.slice(1)) : envPath;
712
+ return envPath[0] === "~" ? path6.join(os.homedir(), envPath.slice(1)) : envPath;
712
713
  }
713
714
  function _configVault(options) {
714
715
  const debug = Boolean(options && options.debug);
@@ -725,7 +726,7 @@ var require_main = __commonJS({
725
726
  return { parsed };
726
727
  }
727
728
  function configDotenv(options) {
728
- const dotenvPath = path7.resolve(process.cwd(), ".env");
729
+ const dotenvPath = path6.resolve(process.cwd(), ".env");
729
730
  let encoding = "utf8";
730
731
  const debug = Boolean(options && options.debug);
731
732
  const quiet = Boolean(options && options.quiet);
@@ -749,13 +750,13 @@ var require_main = __commonJS({
749
750
  }
750
751
  let lastError;
751
752
  const parsedAll = {};
752
- for (const path8 of optionPaths) {
753
+ for (const path7 of optionPaths) {
753
754
  try {
754
- const parsed = DotenvModule.parse(fs7.readFileSync(path8, { encoding }));
755
+ const parsed = DotenvModule.parse(fs6.readFileSync(path7, { encoding }));
755
756
  DotenvModule.populate(parsedAll, parsed, options);
756
757
  } catch (e) {
757
758
  if (debug) {
758
- _debug(`Failed to load ${path8} ${e.message}`);
759
+ _debug(`Failed to load ${path7} ${e.message}`);
759
760
  }
760
761
  lastError = e;
761
762
  }
@@ -770,7 +771,7 @@ var require_main = __commonJS({
770
771
  const shortPaths = [];
771
772
  for (const filePath of optionPaths) {
772
773
  try {
773
- const relative = path7.relative(process.cwd(), filePath);
774
+ const relative = path6.relative(process.cwd(), filePath);
774
775
  shortPaths.push(relative);
775
776
  } catch (e) {
776
777
  if (debug) {
@@ -805,7 +806,7 @@ var require_main = __commonJS({
805
806
  const authTag = ciphertext.subarray(-16);
806
807
  ciphertext = ciphertext.subarray(12, -16);
807
808
  try {
808
- const aesgcm = crypto2.createDecipheriv("aes-256-gcm", key, nonce);
809
+ const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
809
810
  aesgcm.setAuthTag(authTag);
810
811
  return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
811
812
  } catch (error) {
@@ -9907,10 +9908,10 @@ var require_stringify = __commonJS({
9907
9908
  replacer = null;
9908
9909
  indent = EMPTY;
9909
9910
  };
9910
- var join4 = (one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + LF + gap : two ? two.trimRight() + LF + gap : EMPTY;
9911
+ var join3 = (one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + LF + gap : two ? two.trimRight() + LF + gap : EMPTY;
9911
9912
  var join_content = (inside, value, gap) => {
9912
9913
  const comment = process_comments(value, PREFIX_BEFORE, gap + indent, true);
9913
- return join4(comment, inside, gap);
9914
+ return join3(comment, inside, gap);
9914
9915
  };
9915
9916
  var array_stringify = (value, gap) => {
9916
9917
  const deeper_gap = gap + indent;
@@ -9921,7 +9922,7 @@ var require_stringify = __commonJS({
9921
9922
  if (i !== 0) {
9922
9923
  inside += COMMA;
9923
9924
  }
9924
- const before = join4(
9925
+ const before = join3(
9925
9926
  after_comma,
9926
9927
  process_comments(value, BEFORE(i), deeper_gap),
9927
9928
  deeper_gap
@@ -9931,7 +9932,7 @@ var require_stringify = __commonJS({
9931
9932
  inside += process_comments(value, AFTER_VALUE(i), deeper_gap);
9932
9933
  after_comma = process_comments(value, AFTER(i), deeper_gap);
9933
9934
  }
9934
- inside += join4(
9935
+ inside += join3(
9935
9936
  after_comma,
9936
9937
  process_comments(value, PREFIX_AFTER, deeper_gap),
9937
9938
  deeper_gap
@@ -9956,7 +9957,7 @@ var require_stringify = __commonJS({
9956
9957
  inside += COMMA;
9957
9958
  }
9958
9959
  first = false;
9959
- const before = join4(
9960
+ const before = join3(
9960
9961
  after_comma,
9961
9962
  process_comments(value, BEFORE(key), deeper_gap),
9962
9963
  deeper_gap
@@ -9966,7 +9967,7 @@ var require_stringify = __commonJS({
9966
9967
  after_comma = process_comments(value, AFTER(key), deeper_gap);
9967
9968
  };
9968
9969
  keys.forEach(iteratee);
9969
- inside += join4(
9970
+ inside += join3(
9970
9971
  after_comma,
9971
9972
  process_comments(value, PREFIX_AFTER, deeper_gap),
9972
9973
  deeper_gap
@@ -10046,274 +10047,38 @@ var require_src2 = __commonJS({
10046
10047
  });
10047
10048
 
10048
10049
  // packages/cli/src/config/trustedFolders.ts
10049
- var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
10050
- import * as fs from "node:fs";
10051
- import * as path from "node:path";
10052
- import * as crypto from "node:crypto";
10053
- var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
10054
- var { promises: fsPromises } = fs;
10055
- var TRUSTED_FOLDERS_FILENAME = "trustedFolders.json";
10056
- function getUserSettingsDir() {
10057
- return path.join(homedir(), GEMINI_DIR);
10058
- }
10059
- function getTrustedFoldersPath() {
10060
- if (process.env["GEMINI_CLI_TRUSTED_FOLDERS_PATH"]) {
10061
- return process.env["GEMINI_CLI_TRUSTED_FOLDERS_PATH"];
10062
- }
10063
- return path.join(getUserSettingsDir(), TRUSTED_FOLDERS_FILENAME);
10064
- }
10065
- var TrustLevel = /* @__PURE__ */ ((TrustLevel2) => {
10066
- TrustLevel2["TRUST_FOLDER"] = "TRUST_FOLDER";
10067
- TrustLevel2["TRUST_PARENT"] = "TRUST_PARENT";
10068
- TrustLevel2["DO_NOT_TRUST"] = "DO_NOT_TRUST";
10069
- return TrustLevel2;
10070
- })(TrustLevel || {});
10071
- function isTrustLevel(value) {
10072
- return typeof value === "string" && // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
10073
- Object.values(TrustLevel).includes(value);
10074
- }
10075
- var realPathCache = /* @__PURE__ */ new Map();
10076
- function parseTrustedFoldersJson(content) {
10077
- return JSON.parse((0, import_strip_json_comments.default)(content));
10078
- }
10079
- function getRealPath(location) {
10080
- let realPath = realPathCache.get(location);
10081
- if (realPath !== void 0) {
10082
- return realPath;
10083
- }
10084
- try {
10085
- realPath = fs.existsSync(location) ? fs.realpathSync(location) : location;
10086
- } catch {
10087
- realPath = location;
10088
- }
10089
- realPathCache.set(location, realPath);
10090
- return realPath;
10091
- }
10092
- var LoadedTrustedFolders = class {
10093
- constructor(user, errors) {
10094
- this.user = user;
10095
- this.errors = errors;
10096
- }
10097
- get rules() {
10098
- return Object.entries(this.user.config).map(([path7, trustLevel]) => ({
10099
- path: path7,
10100
- trustLevel
10101
- }));
10102
- }
10103
- /**
10104
- * Returns true or false if the path should be "trusted". This function
10105
- * should only be invoked when the folder trust setting is active.
10106
- *
10107
- * @param location path
10108
- * @returns
10109
- */
10110
- isPathTrusted(location, config, headlessOptions) {
10111
- if (isHeadlessMode(headlessOptions)) {
10112
- return true;
10113
- }
10114
- const configToUse = config ?? this.user.config;
10115
- const realLocation = getRealPath(location);
10116
- let longestMatchLen = -1;
10117
- let longestMatchTrust = void 0;
10118
- for (const [rulePath, trustLevel] of Object.entries(configToUse)) {
10119
- const effectivePath = trustLevel === "TRUST_PARENT" /* TRUST_PARENT */ ? path.dirname(rulePath) : rulePath;
10120
- const realEffectivePath = getRealPath(effectivePath);
10121
- if (isWithinRoot(realLocation, realEffectivePath)) {
10122
- if (rulePath.length > longestMatchLen) {
10123
- longestMatchLen = rulePath.length;
10124
- longestMatchTrust = trustLevel;
10125
- }
10126
- }
10127
- }
10128
- if (longestMatchTrust === "DO_NOT_TRUST" /* DO_NOT_TRUST */) return false;
10129
- if (longestMatchTrust === "TRUST_FOLDER" /* TRUST_FOLDER */ || longestMatchTrust === "TRUST_PARENT" /* TRUST_PARENT */)
10130
- return true;
10131
- return void 0;
10132
- }
10133
- async setValue(folderPath, trustLevel) {
10134
- if (this.errors.length > 0) {
10135
- const errorMessages = this.errors.map(
10136
- (error) => `Error in ${error.path}: ${error.message}`
10137
- );
10138
- throw new FatalConfigError(
10139
- `Cannot update trusted folders because the configuration file is invalid:
10140
- ${errorMessages.join("\n")}
10141
- Please fix the file manually before trying to update it.`
10142
- );
10143
- }
10144
- const dirPath = path.dirname(this.user.path);
10145
- if (!fs.existsSync(dirPath)) {
10146
- await fsPromises.mkdir(dirPath, { recursive: true });
10147
- }
10148
- if (!fs.existsSync(this.user.path)) {
10149
- await fsPromises.writeFile(this.user.path, JSON.stringify({}, null, 2), {
10150
- mode: 384
10151
- });
10152
- }
10153
- const release = await (0, import_proper_lockfile.lock)(this.user.path, {
10154
- retries: {
10155
- retries: 10,
10156
- minTimeout: 100
10157
- }
10158
- });
10159
- try {
10160
- const content = await fsPromises.readFile(this.user.path, "utf-8");
10161
- let config;
10162
- try {
10163
- config = parseTrustedFoldersJson(content);
10164
- } catch (error) {
10165
- coreEvents.emitFeedback(
10166
- "error",
10167
- `Failed to parse trusted folders file at ${this.user.path}. The file may be corrupted.`,
10168
- error
10169
- );
10170
- config = {};
10171
- }
10172
- const originalTrustLevel = config[folderPath];
10173
- config[folderPath] = trustLevel;
10174
- this.user.config[folderPath] = trustLevel;
10175
- try {
10176
- saveTrustedFolders({ ...this.user, config });
10177
- } catch (e) {
10178
- if (originalTrustLevel === void 0) {
10179
- delete this.user.config[folderPath];
10180
- } else {
10181
- this.user.config[folderPath] = originalTrustLevel;
10182
- }
10183
- throw e;
10184
- }
10185
- } finally {
10186
- await release();
10187
- }
10188
- }
10189
- };
10190
- var loadedTrustedFolders;
10191
- function loadTrustedFolders() {
10192
- if (loadedTrustedFolders) {
10193
- return loadedTrustedFolders;
10194
- }
10195
- const errors = [];
10196
- const userConfig = {};
10197
- const userPath = getTrustedFoldersPath();
10198
- try {
10199
- if (fs.existsSync(userPath)) {
10200
- const content = fs.readFileSync(userPath, "utf-8");
10201
- const parsed = parseTrustedFoldersJson(content);
10202
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
10203
- errors.push({
10204
- message: "Trusted folders file is not a valid JSON object.",
10205
- path: userPath
10206
- });
10207
- } else {
10208
- for (const [path7, trustLevel] of Object.entries(parsed)) {
10209
- if (isTrustLevel(trustLevel)) {
10210
- userConfig[path7] = trustLevel;
10211
- } else {
10212
- const possibleValues = Object.values(TrustLevel).join(", ");
10213
- errors.push({
10214
- message: `Invalid trust level "${trustLevel}" for path "${path7}". Possible values are: ${possibleValues}.`,
10215
- path: userPath
10216
- });
10217
- }
10218
- }
10219
- }
10220
- }
10221
- } catch (error) {
10222
- errors.push({
10223
- message: getErrorMessage(error),
10224
- path: userPath
10225
- });
10226
- }
10227
- loadedTrustedFolders = new LoadedTrustedFolders(
10228
- { path: userPath, config: userConfig },
10229
- errors
10230
- );
10231
- return loadedTrustedFolders;
10232
- }
10233
- function saveTrustedFolders(trustedFoldersFile) {
10234
- const dirPath = path.dirname(trustedFoldersFile.path);
10235
- if (!fs.existsSync(dirPath)) {
10236
- fs.mkdirSync(dirPath, { recursive: true });
10237
- }
10238
- const content = JSON.stringify(trustedFoldersFile.config, null, 2);
10239
- const tempPath = `${trustedFoldersFile.path}.tmp.${crypto.randomUUID()}`;
10240
- try {
10241
- fs.writeFileSync(tempPath, content, {
10242
- encoding: "utf-8",
10243
- mode: 384
10244
- });
10245
- fs.renameSync(tempPath, trustedFoldersFile.path);
10246
- } catch (error) {
10247
- if (fs.existsSync(tempPath)) {
10248
- try {
10249
- fs.unlinkSync(tempPath);
10250
- } catch {
10251
- }
10252
- }
10253
- throw error;
10254
- }
10255
- }
10256
10050
  function isFolderTrustEnabled(settings) {
10257
10051
  const folderTrustSetting = settings.security?.folderTrust?.enabled ?? true;
10258
10052
  return folderTrustSetting;
10259
10053
  }
10260
- function getWorkspaceTrustFromLocalConfig(workspaceDir, trustConfig, headlessOptions) {
10261
- const folders = loadTrustedFolders();
10262
- const configToUse = trustConfig ?? folders.user.config;
10263
- if (folders.errors.length > 0) {
10264
- const errorMessages = folders.errors.map(
10265
- (error) => `Error in ${error.path}: ${error.message}`
10266
- );
10267
- throw new FatalConfigError(
10268
- `${errorMessages.join("\n")}
10269
- Please fix the configuration file and try again.`
10270
- );
10271
- }
10272
- const isTrusted = folders.isPathTrusted(
10273
- workspaceDir,
10274
- configToUse,
10275
- headlessOptions
10276
- );
10277
- return {
10278
- isTrusted,
10279
- source: isTrusted !== void 0 ? "file" : void 0
10280
- };
10054
+ function loadTrustedFolders2() {
10055
+ return loadTrustedFolders();
10281
10056
  }
10282
- function isWorkspaceTrusted(settings, workspaceDir = process.cwd(), trustConfig, headlessOptions) {
10283
- if (isHeadlessMode(headlessOptions)) {
10284
- return { isTrusted: true, source: void 0 };
10285
- }
10286
- if (!isFolderTrustEnabled(settings)) {
10287
- return { isTrusted: true, source: void 0 };
10288
- }
10289
- const ideTrust = ideContextStore.get()?.workspaceState?.isTrusted;
10290
- if (ideTrust !== void 0) {
10291
- return { isTrusted: ideTrust, source: "ide" };
10292
- }
10293
- return getWorkspaceTrustFromLocalConfig(
10294
- workspaceDir,
10295
- trustConfig,
10296
- headlessOptions
10297
- );
10057
+ function isWorkspaceTrusted(settings, workspaceDir = process.cwd(), headlessOptions) {
10058
+ return checkPathTrust({
10059
+ path: workspaceDir,
10060
+ isFolderTrustEnabled: isFolderTrustEnabled(settings),
10061
+ isHeadless: isHeadlessMode(headlessOptions)
10062
+ });
10298
10063
  }
10299
10064
 
10300
10065
  // packages/cli/src/ui/types.ts
10301
10066
  var import_react = __toESM(require_react(), 1);
10302
10067
  function mapCoreStatusToDisplayStatus(coreStatus) {
10303
10068
  switch (coreStatus) {
10304
- case "validating" /* Validating */:
10069
+ case CoreToolCallStatus.Validating:
10305
10070
  return "Pending" /* Pending */;
10306
- case "awaiting_approval" /* AwaitingApproval */:
10071
+ case CoreToolCallStatus.AwaitingApproval:
10307
10072
  return "Confirming" /* Confirming */;
10308
- case "executing" /* Executing */:
10073
+ case CoreToolCallStatus.Executing:
10309
10074
  return "Executing" /* Executing */;
10310
- case "success" /* Success */:
10075
+ case CoreToolCallStatus.Success:
10311
10076
  return "Success" /* Success */;
10312
- case "cancelled" /* Cancelled */:
10077
+ case CoreToolCallStatus.Cancelled:
10313
10078
  return "Canceled" /* Canceled */;
10314
- case "error" /* Error */:
10079
+ case CoreToolCallStatus.Error:
10315
10080
  return "Error" /* Error */;
10316
- case "scheduled" /* Scheduled */:
10081
+ case CoreToolCallStatus.Scheduled:
10317
10082
  return "Pending" /* Pending */;
10318
10083
  default:
10319
10084
  return checkExhaustive(coreStatus);
@@ -10323,8 +10088,8 @@ var isTodoList = (res) => typeof res === "object" && res !== null && "todos" in
10323
10088
  var emptyIcon = " ";
10324
10089
 
10325
10090
  // packages/cli/src/utils/sessionUtils.ts
10326
- import * as fs2 from "node:fs/promises";
10327
- import path2 from "node:path";
10091
+ import * as fs from "node:fs/promises";
10092
+ import path from "node:path";
10328
10093
 
10329
10094
  // packages/cli/src/ui/utils/textUtils.ts
10330
10095
  import { stripVTControlCharacters } from "node:util";
@@ -10660,13 +10425,13 @@ var formatRelativeTime = (timestamp, style = "long") => {
10660
10425
  };
10661
10426
  var getAllSessionFiles = async (chatsDir, currentSessionId, options = {}) => {
10662
10427
  try {
10663
- const files = await fs2.readdir(chatsDir);
10428
+ const files = await fs.readdir(chatsDir);
10664
10429
  const sessionFiles = files.filter(
10665
10430
  (f) => f.startsWith(SESSION_FILE_PREFIX) && (f.endsWith(".json") || f.endsWith(".jsonl"))
10666
10431
  ).sort();
10667
10432
  const sessionPromises = sessionFiles.map(
10668
10433
  async (file) => {
10669
- const filePath = path2.join(chatsDir, file);
10434
+ const filePath = path.join(chatsDir, file);
10670
10435
  try {
10671
10436
  const content = await loadConversationRecord(filePath, {
10672
10437
  metadataOnly: !options.includeFullContent
@@ -10756,7 +10521,7 @@ var SessionSelector = class {
10756
10521
  * Lists all available sessions for the current project.
10757
10522
  */
10758
10523
  async listSessions() {
10759
- const chatsDir = path2.join(this.storage.getProjectTempDir(), "chats");
10524
+ const chatsDir = path.join(this.storage.getProjectTempDir(), "chats");
10760
10525
  return getSessionFiles(chatsDir);
10761
10526
  }
10762
10527
  /**
@@ -10785,7 +10550,7 @@ var SessionSelector = class {
10785
10550
  if (!isNaN(index) && index.toString() === trimmedIdentifier && index > 0 && index <= sortedSessions.length) {
10786
10551
  return sortedSessions[index - 1];
10787
10552
  }
10788
- const chatsDir = path2.join(this.storage.getProjectTempDir(), "chats");
10553
+ const chatsDir = path.join(this.storage.getProjectTempDir(), "chats");
10789
10554
  throw SessionError.invalidSessionIdentifier(trimmedIdentifier, chatsDir);
10790
10555
  }
10791
10556
  /**
@@ -10824,8 +10589,8 @@ var SessionSelector = class {
10824
10589
  * Loads session data for a selected session.
10825
10590
  */
10826
10591
  async selectSession(sessionInfo) {
10827
- const chatsDir = path2.join(this.storage.getProjectTempDir(), "chats");
10828
- const sessionPath = path2.join(chatsDir, sessionInfo.fileName);
10592
+ const chatsDir = path.join(this.storage.getProjectTempDir(), "chats");
10593
+ const sessionPath = path.join(chatsDir, sessionInfo.fileName);
10829
10594
  try {
10830
10595
  const sessionData = await loadConversationRecord(sessionPath);
10831
10596
  if (!sessionData) {
@@ -10898,7 +10663,7 @@ function convertSessionToHistoryFormats(messages) {
10898
10663
  args: tool.args,
10899
10664
  description: tool.description || "",
10900
10665
  renderOutputAsMarkdown: tool.renderOutputAsMarkdown ?? true,
10901
- status: tool.status === "success" ? "success" /* Success */ : "error" /* Error */,
10666
+ status: tool.status === "success" ? CoreToolCallStatus.Success : CoreToolCallStatus.Error,
10902
10667
  resultDisplay: tool.resultDisplay,
10903
10668
  confirmationDetails: void 0
10904
10669
  }))
@@ -10911,8 +10676,8 @@ function convertSessionToHistoryFormats(messages) {
10911
10676
  }
10912
10677
 
10913
10678
  // packages/cli/src/utils/sessionCleanup.ts
10914
- import * as fs3 from "node:fs/promises";
10915
- import * as path3 from "node:path";
10679
+ import * as fs2 from "node:fs/promises";
10680
+ import * as path2 from "node:path";
10916
10681
  var DEFAULT_MIN_RETENTION = "1d";
10917
10682
  var MIN_MAX_COUNT = 1;
10918
10683
  var MULTIPLIERS = {
@@ -10935,7 +10700,7 @@ function deriveShortIdFromFileName(fileName) {
10935
10700
  }
10936
10701
  async function cleanupSessionAndSubagentsAsync(sessionId, config) {
10937
10702
  const tempDir = config.storage.getProjectTempDir();
10938
- const chatsDir = path3.join(tempDir, "chats");
10703
+ const chatsDir = path2.join(tempDir, "chats");
10939
10704
  await deleteSessionArtifactsAsync(sessionId, tempDir);
10940
10705
  await deleteSubagentSessionDirAndArtifactsAsync(sessionId, chatsDir, tempDir);
10941
10706
  }
@@ -10952,7 +10717,7 @@ async function cleanupExpiredSessions(config, settings) {
10952
10717
  return { ...result, disabled: true };
10953
10718
  }
10954
10719
  const retentionConfig = settings.general.sessionRetention;
10955
- const chatsDir = path3.join(config.storage.getProjectTempDir(), "chats");
10720
+ const chatsDir = path2.join(config.storage.getProjectTempDir(), "chats");
10956
10721
  const validationErrorMessage = validateRetentionConfig(
10957
10722
  config,
10958
10723
  retentionConfig
@@ -10983,11 +10748,11 @@ async function cleanupExpiredSessions(config, settings) {
10983
10748
  (f) => f.startsWith(SESSION_FILE_PREFIX) && f.endsWith(`-${shortId}.json`)
10984
10749
  );
10985
10750
  for (const file of matchingFiles) {
10986
- const filePath = path3.join(chatsDir, file);
10751
+ const filePath = path2.join(chatsDir, file);
10987
10752
  let fullSessionId;
10988
10753
  try {
10989
10754
  try {
10990
- const fileContent = await fs3.readFile(filePath, "utf8");
10755
+ const fileContent = await fs2.readFile(filePath, "utf8");
10991
10756
  const content = JSON.parse(fileContent);
10992
10757
  if (content && typeof content === "object" && "sessionId" in content) {
10993
10758
  const record = content;
@@ -10999,7 +10764,7 @@ async function cleanupExpiredSessions(config, settings) {
10999
10764
  } catch {
11000
10765
  }
11001
10766
  if (!fullSessionId || fullSessionId !== config.getSessionId()) {
11002
- await fs3.unlink(filePath);
10767
+ await fs2.unlink(filePath);
11003
10768
  if (fullSessionId) {
11004
10769
  await cleanupSessionAndSubagentsAsync(fullSessionId, config);
11005
10770
  }
@@ -11018,8 +10783,8 @@ async function cleanupExpiredSessions(config, settings) {
11018
10783
  }
11019
10784
  }
11020
10785
  } else {
11021
- const sessionPath = path3.join(chatsDir, sessionToDelete.fileName);
11022
- await fs3.unlink(sessionPath);
10786
+ const sessionPath = path2.join(chatsDir, sessionToDelete.fileName);
10787
+ await fs2.unlink(sessionPath);
11023
10788
  const sessionId = sessionToDelete.sessionInfo?.id;
11024
10789
  if (sessionId) {
11025
10790
  await cleanupSessionAndSubagentsAsync(sessionId, config);
@@ -11175,13 +10940,13 @@ async function cleanupToolOutputFiles(settings, debugMode = false, projectTempDi
11175
10940
  await storage.initialize();
11176
10941
  tempDir = storage.getProjectTempDir();
11177
10942
  }
11178
- const toolOutputDir = path3.join(tempDir, TOOL_OUTPUTS_DIR);
10943
+ const toolOutputDir = path2.join(tempDir, TOOL_OUTPUTS_DIR);
11179
10944
  try {
11180
- await fs3.access(toolOutputDir);
10945
+ await fs2.access(toolOutputDir);
11181
10946
  } catch {
11182
10947
  return result;
11183
10948
  }
11184
- const entries = await fs3.readdir(toolOutputDir, { withFileTypes: true });
10949
+ const entries = await fs2.readdir(toolOutputDir, { withFileTypes: true });
11185
10950
  result.scanned = entries.length;
11186
10951
  if (entries.length === 0) {
11187
10952
  return result;
@@ -11190,8 +10955,8 @@ async function cleanupToolOutputFiles(settings, debugMode = false, projectTempDi
11190
10955
  const fileStatsResults = await Promise.all(
11191
10956
  files.map(async (file) => {
11192
10957
  try {
11193
- const filePath = path3.join(toolOutputDir, file.name);
11194
- const stat2 = await fs3.stat(filePath);
10958
+ const filePath = path2.join(toolOutputDir, file.name);
10959
+ const stat2 = await fs2.stat(filePath);
11195
10960
  return { name: file.name, mtime: stat2.mtime };
11196
10961
  } catch (error) {
11197
10962
  debugLogger.debug(
@@ -11244,8 +11009,8 @@ async function cleanupToolOutputFiles(settings, debugMode = false, projectTempDi
11244
11009
  );
11245
11010
  continue;
11246
11011
  }
11247
- const subdirPath = path3.join(toolOutputDir, subdir.name);
11248
- const stat2 = await fs3.stat(subdirPath);
11012
+ const subdirPath = path2.join(toolOutputDir, subdir.name);
11013
+ const stat2 = await fs2.stat(subdirPath);
11249
11014
  let shouldDelete = false;
11250
11015
  if (retentionConfig.maxAge) {
11251
11016
  const maxAgeMs = parseRetentionPeriod(retentionConfig.maxAge);
@@ -11255,7 +11020,7 @@ async function cleanupToolOutputFiles(settings, debugMode = false, projectTempDi
11255
11020
  }
11256
11021
  }
11257
11022
  if (shouldDelete) {
11258
- await fs3.rm(subdirPath, { recursive: true, force: true });
11023
+ await fs2.rm(subdirPath, { recursive: true, force: true });
11259
11024
  result.deleted++;
11260
11025
  }
11261
11026
  } catch (error) {
@@ -11264,8 +11029,8 @@ async function cleanupToolOutputFiles(settings, debugMode = false, projectTempDi
11264
11029
  }
11265
11030
  for (const fileName of filesToDelete) {
11266
11031
  try {
11267
- const filePath = path3.join(toolOutputDir, fileName);
11268
- await fs3.unlink(filePath);
11032
+ const filePath = path2.join(toolOutputDir, fileName);
11033
+ await fs2.unlink(filePath);
11269
11034
  result.deleted++;
11270
11035
  } catch (error) {
11271
11036
  debugLogger.debug(
@@ -11289,11 +11054,11 @@ async function cleanupToolOutputFiles(settings, debugMode = false, projectTempDi
11289
11054
 
11290
11055
  // packages/cli/src/config/settings.ts
11291
11056
  var dotenv = __toESM(require_main(), 1);
11292
- import * as fs5 from "node:fs";
11293
- import * as path4 from "node:path";
11057
+ import * as fs4 from "node:fs";
11058
+ import * as path3 from "node:path";
11294
11059
  import { platform } from "node:os";
11295
11060
  import process2 from "node:process";
11296
- var import_strip_json_comments2 = __toESM(require_strip_json_comments(), 1);
11061
+ var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
11297
11062
 
11298
11063
  // packages/cli/src/ui/themes/theme.ts
11299
11064
  var import_tinygradient = __toESM(require_tinygradient(), 1);
@@ -14463,6 +14228,19 @@ var SETTINGS_SCHEMA = {
14463
14228
  showInDialog: false,
14464
14229
  items: { type: "string" }
14465
14230
  },
14231
+ confirmationRequired: {
14232
+ type: "array",
14233
+ label: "Confirmation Required",
14234
+ category: "Advanced",
14235
+ requiresRestart: true,
14236
+ default: void 0,
14237
+ description: oneLine`
14238
+ Tool names that always require user confirmation.
14239
+ Takes precedence over allowed tools and core tool allowlists.
14240
+ `,
14241
+ showInDialog: false,
14242
+ items: { type: "string" }
14243
+ },
14466
14244
  exclude: {
14467
14245
  type: "array",
14468
14246
  label: "Exclude Tools",
@@ -16187,7 +15965,7 @@ function resolveEnvVarsInObjectInternal(obj, visited, customEnv) {
16187
15965
  function isPlainObject(item) {
16188
15966
  return !!item && typeof item === "object" && !Array.isArray(item);
16189
15967
  }
16190
- function mergeRecursively(target, source, getMergeStrategyForPath2, path7 = []) {
15968
+ function mergeRecursively(target, source, getMergeStrategyForPath2, path6 = []) {
16191
15969
  for (const key of Object.keys(source)) {
16192
15970
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
16193
15971
  continue;
@@ -16196,7 +15974,7 @@ function mergeRecursively(target, source, getMergeStrategyForPath2, path7 = [])
16196
15974
  if (srcValue === void 0) {
16197
15975
  continue;
16198
15976
  }
16199
- const newPath = [...path7, key];
15977
+ const newPath = [...path6, key];
16200
15978
  const objValue = target[key];
16201
15979
  const mergeStrategy = getMergeStrategyForPath2(newPath);
16202
15980
  if (mergeStrategy === "shallow_merge" /* SHALLOW_MERGE */ && objValue && srcValue) {
@@ -16245,13 +16023,13 @@ function customDeepMerge(getMergeStrategyForPath2, ...sources) {
16245
16023
 
16246
16024
  // packages/cli/src/utils/commentJson.ts
16247
16025
  var import_comment_json = __toESM(require_src2(), 1);
16248
- import * as fs4 from "node:fs";
16026
+ import * as fs3 from "node:fs";
16249
16027
  function updateSettingsFilePreservingFormat(filePath, updates) {
16250
- if (!fs4.existsSync(filePath)) {
16251
- fs4.writeFileSync(filePath, JSON.stringify(updates, null, 2), "utf-8");
16028
+ if (!fs3.existsSync(filePath)) {
16029
+ fs3.writeFileSync(filePath, JSON.stringify(updates, null, 2), "utf-8");
16252
16030
  return;
16253
16031
  }
16254
- const originalContent = fs4.readFileSync(filePath, "utf-8");
16032
+ const originalContent = fs3.readFileSync(filePath, "utf-8");
16255
16033
  let parsed;
16256
16034
  try {
16257
16035
  parsed = (0, import_comment_json.parse)(originalContent);
@@ -16265,7 +16043,7 @@ function updateSettingsFilePreservingFormat(filePath, updates) {
16265
16043
  }
16266
16044
  const updatedStructure = applyUpdates(parsed, updates);
16267
16045
  const updatedContent = (0, import_comment_json.stringify)(updatedStructure, null, 2);
16268
- fs4.writeFileSync(filePath, updatedContent, "utf-8");
16046
+ fs3.writeFileSync(filePath, updatedContent, "utf-8");
16269
16047
  }
16270
16048
  function preserveCommentsOnPropertyDeletion(container, propName) {
16271
16049
  const target = container;
@@ -16534,11 +16312,11 @@ function formatValidationError(error, filePath) {
16534
16312
  const MAX_ERRORS_TO_DISPLAY = 5;
16535
16313
  const displayedIssues = error.issues.slice(0, MAX_ERRORS_TO_DISPLAY);
16536
16314
  for (const issue of displayedIssues) {
16537
- const path7 = issue.path.reduce(
16315
+ const path6 = issue.path.reduce(
16538
16316
  (acc, curr) => typeof curr === "number" ? `${acc}[${curr}]` : `${acc ? acc + "." : ""}${curr}`,
16539
16317
  ""
16540
16318
  );
16541
- lines.push(`Error in: ${path7 || "(root)"}`);
16319
+ lines.push(`Error in: ${path6 || "(root)"}`);
16542
16320
  lines.push(` ${issue.message}`);
16543
16321
  if (issue.code === "invalid_type") {
16544
16322
  const expected = issue.expected;
@@ -16559,11 +16337,11 @@ function formatValidationError(error, filePath) {
16559
16337
  }
16560
16338
 
16561
16339
  // packages/cli/src/config/settings.ts
16562
- function getMergeStrategyForPath(path7) {
16340
+ function getMergeStrategyForPath(path6) {
16563
16341
  let current = void 0;
16564
16342
  let currentSchema = getSettingsSchema();
16565
16343
  let parent = void 0;
16566
- for (const key of path7) {
16344
+ for (const key of path6) {
16567
16345
  if (!currentSchema || !currentSchema[key]) {
16568
16346
  if (parent?.additionalProperties?.mergeStrategy) {
16569
16347
  return parent.additionalProperties.mergeStrategy;
@@ -16577,7 +16355,7 @@ function getMergeStrategyForPath(path7) {
16577
16355
  return current?.mergeStrategy;
16578
16356
  }
16579
16357
  var USER_SETTINGS_PATH = Storage.getGlobalSettingsPath();
16580
- var USER_SETTINGS_DIR = path4.dirname(USER_SETTINGS_PATH);
16358
+ var USER_SETTINGS_DIR = path3.dirname(USER_SETTINGS_PATH);
16581
16359
  var DEFAULT_EXCLUDED_ENV_VARS = [
16582
16360
  "DEBUG",
16583
16361
  "DEBUG_MODE",
@@ -16609,8 +16387,8 @@ function getSystemDefaultsPath() {
16609
16387
  if (process2.env["GEMINI_CLI_SYSTEM_DEFAULTS_PATH"]) {
16610
16388
  return process2.env["GEMINI_CLI_SYSTEM_DEFAULTS_PATH"];
16611
16389
  }
16612
- return path4.join(
16613
- path4.dirname(getSystemSettingsPath()),
16390
+ return path3.join(
16391
+ path3.dirname(getSystemSettingsPath()),
16614
16392
  "system-defaults.json"
16615
16393
  );
16616
16394
  }
@@ -16631,8 +16409,8 @@ var _loadableSettingScopes = [
16631
16409
  function isLoadableSettingScope(scope) {
16632
16410
  return _loadableSettingScopes.includes(scope);
16633
16411
  }
16634
- function setNestedProperty(obj, path7, value) {
16635
- const keys = path7.split(".");
16412
+ function setNestedProperty(obj, path6, value) {
16413
+ const keys = path6.split(".");
16636
16414
  const lastKey = keys.pop();
16637
16415
  if (!lastKey) return;
16638
16416
  let current = obj;
@@ -16727,7 +16505,7 @@ var LoadedSettings = class {
16727
16505
  const adminSchema = adminSettingSchema.properties;
16728
16506
  const adminDefaults = getDefaultsFromSchema(adminSchema);
16729
16507
  merged.admin = customDeepMerge(
16730
- (path7) => getMergeStrategyForPath(["admin", ...path7]),
16508
+ (path6) => getMergeStrategyForPath(["admin", ...path6]),
16731
16509
  adminDefaults,
16732
16510
  this._remoteAdminSettings?.admin ?? {}
16733
16511
  );
@@ -16755,8 +16533,8 @@ var LoadedSettings = class {
16755
16533
  // React will pass a listener fn into this subscribe fn
16756
16534
  // that listener fn will perform an object identity check on the snapshot and trigger a React re render if the snapshot has changed
16757
16535
  subscribe(listener) {
16758
- coreEvents.on("settings-changed" /* SettingsChanged */, listener);
16759
- return () => coreEvents.off("settings-changed" /* SettingsChanged */, listener);
16536
+ coreEvents.on(CoreEvent.SettingsChanged, listener);
16537
+ return () => coreEvents.off(CoreEvent.SettingsChanged, listener);
16760
16538
  }
16761
16539
  getSnapshot() {
16762
16540
  return this._snapshot;
@@ -16818,25 +16596,29 @@ var LoadedSettings = class {
16818
16596
  this._merged = this.computeMergedSettings();
16819
16597
  }
16820
16598
  };
16821
- function findEnvFile(startDir) {
16822
- let currentDir = path4.resolve(startDir);
16599
+ function findEnvFile(startDir, isTrusted) {
16600
+ let currentDir = path3.resolve(startDir);
16823
16601
  while (true) {
16824
- const geminiEnvPath = path4.join(currentDir, GEMINI_DIR, ".env");
16825
- if (fs5.existsSync(geminiEnvPath)) {
16826
- return geminiEnvPath;
16602
+ if (isTrusted) {
16603
+ const geminiEnvPath = path3.join(currentDir, GEMINI_DIR, ".env");
16604
+ if (fs4.existsSync(geminiEnvPath)) {
16605
+ return geminiEnvPath;
16606
+ }
16827
16607
  }
16828
- const envPath = path4.join(currentDir, ".env");
16829
- if (fs5.existsSync(envPath)) {
16608
+ const envPath = path3.join(currentDir, ".env");
16609
+ if (fs4.existsSync(envPath)) {
16830
16610
  return envPath;
16831
16611
  }
16832
- const parentDir = path4.dirname(currentDir);
16612
+ const parentDir = path3.dirname(currentDir);
16833
16613
  if (parentDir === currentDir || !parentDir) {
16834
- const homeGeminiEnvPath = path4.join(homedir(), GEMINI_DIR, ".env");
16835
- if (fs5.existsSync(homeGeminiEnvPath)) {
16836
- return homeGeminiEnvPath;
16614
+ if (isTrusted) {
16615
+ const homeGeminiEnvPath = path3.join(homedir(), GEMINI_DIR, ".env");
16616
+ if (fs4.existsSync(homeGeminiEnvPath)) {
16617
+ return homeGeminiEnvPath;
16618
+ }
16837
16619
  }
16838
- const homeEnvPath = path4.join(homedir(), ".env");
16839
- if (fs5.existsSync(homeEnvPath)) {
16620
+ const homeEnvPath = path3.join(homedir(), ".env");
16621
+ if (fs4.existsSync(homeEnvPath)) {
16840
16622
  return homeEnvPath;
16841
16623
  }
16842
16624
  return null;
@@ -16846,8 +16628,8 @@ function findEnvFile(startDir) {
16846
16628
  }
16847
16629
  function setUpCloudShellEnvironment(envFilePath, isTrusted, isSandboxed) {
16848
16630
  let value = "cloudshell-gca";
16849
- if (envFilePath && fs5.existsSync(envFilePath)) {
16850
- const envFileContent = fs5.readFileSync(envFilePath);
16631
+ if (envFilePath && fs4.existsSync(envFilePath)) {
16632
+ const envFileContent = fs4.readFileSync(envFilePath);
16851
16633
  const parsedEnv = dotenv.parse(envFileContent);
16852
16634
  if (parsedEnv["GOOGLE_CLOUD_PROJECT"]) {
16853
16635
  value = parsedEnv["GOOGLE_CLOUD_PROJECT"];
@@ -16859,9 +16641,9 @@ function setUpCloudShellEnvironment(envFilePath, isTrusted, isSandboxed) {
16859
16641
  process2.env["GOOGLE_CLOUD_PROJECT"] = value;
16860
16642
  }
16861
16643
  function loadEnvironment(settings, workspaceDir, isWorkspaceTrustedFn = isWorkspaceTrusted) {
16862
- const envFilePath = findEnvFile(workspaceDir);
16863
16644
  const trustResult = isWorkspaceTrustedFn(settings, workspaceDir);
16864
16645
  const isTrusted = trustResult.isTrusted ?? false;
16646
+ const envFilePath = findEnvFile(workspaceDir, isTrusted);
16865
16647
  const args = process2.argv.slice(2);
16866
16648
  const doubleDashIndex = args.indexOf("--");
16867
16649
  const relevantArgs = doubleDashIndex === -1 ? args : args.slice(0, doubleDashIndex);
@@ -16871,14 +16653,14 @@ function loadEnvironment(settings, workspaceDir, isWorkspaceTrustedFn = isWorksp
16871
16653
  }
16872
16654
  if (envFilePath) {
16873
16655
  try {
16874
- const envFileContent = fs5.readFileSync(envFilePath, "utf-8");
16656
+ const envFileContent = fs4.readFileSync(envFilePath, "utf-8");
16875
16657
  const parsedEnv = dotenv.parse(envFileContent);
16876
16658
  const excludedVars = settings?.advanced?.excludedEnvVars || DEFAULT_EXCLUDED_ENV_VARS;
16877
16659
  const isProjectEnvFile = !envFilePath.includes(GEMINI_DIR);
16878
16660
  for (const key in parsedEnv) {
16879
16661
  if (Object.hasOwn(parsedEnv, key)) {
16880
16662
  let value = parsedEnv[key];
16881
- if (!isTrusted && isSandboxed) {
16663
+ if (!isTrusted) {
16882
16664
  if (!AUTH_ENV_VAR_WHITELIST.includes(key)) {
16883
16665
  continue;
16884
16666
  }
@@ -16905,7 +16687,7 @@ function isWorktreeEnabled(settings) {
16905
16687
  return settings.merged.experimental.worktrees;
16906
16688
  }
16907
16689
  function loadSettings(workspaceDir = process2.cwd()) {
16908
- const normalizedWorkspaceDir = path4.resolve(workspaceDir);
16690
+ const normalizedWorkspaceDir = path3.resolve(workspaceDir);
16909
16691
  return settingsCache.getOrCreate(
16910
16692
  normalizedWorkspaceDir,
16911
16693
  () => _doLoadSettings(normalizedWorkspaceDir)
@@ -16923,9 +16705,9 @@ function _doLoadSettings(workspaceDir) {
16923
16705
  const workspaceSettingsPath = storage.getWorkspaceSettingsPath();
16924
16706
  const load = (filePath) => {
16925
16707
  try {
16926
- if (fs5.existsSync(filePath)) {
16927
- const content = fs5.readFileSync(filePath, "utf-8");
16928
- const rawSettings = JSON.parse((0, import_strip_json_comments2.default)(content));
16708
+ if (fs4.existsSync(filePath)) {
16709
+ const content = fs4.readFileSync(filePath, "utf-8");
16710
+ const rawSettings = JSON.parse((0, import_strip_json_comments.default)(content));
16929
16711
  if (typeof rawSettings !== "object" || rawSettings === null || Array.isArray(rawSettings)) {
16930
16712
  settingsErrors.push({
16931
16713
  message: "Settings file is not a valid JSON object.",
@@ -17214,9 +16996,9 @@ function migrateDeprecatedSettings(loadedSettings, removeDeprecated = true) {
17214
16996
  function saveSettings(settingsFile) {
17215
16997
  settingsCache.clear();
17216
16998
  try {
17217
- const dirPath = path4.dirname(settingsFile.path);
17218
- if (!fs5.existsSync(dirPath)) {
17219
- fs5.mkdirSync(dirPath, { recursive: true });
16999
+ const dirPath = path3.dirname(settingsFile.path);
17000
+ if (!fs4.existsSync(dirPath)) {
17001
+ fs4.mkdirSync(dirPath, { recursive: true });
17220
17002
  }
17221
17003
  const settingsToSave = settingsFile.originalSettings;
17222
17004
  updateSettingsFilePreservingFormat(
@@ -17341,7 +17123,7 @@ function migrateExperimentalSettings(settings, loadedSettings, scope, removeDepr
17341
17123
  }
17342
17124
 
17343
17125
  // packages/cli/src/commands/gemma/constants.ts
17344
- import path5 from "node:path";
17126
+ import path4 from "node:path";
17345
17127
  var LITERT_RELEASE_VERSION = "v0.9.0-alpha03";
17346
17128
  var LITERT_RELEASE_BASE_URL = "https://github.com/google-ai-edge/LiteRT-LM/releases/download";
17347
17129
  var GEMMA_MODEL_NAME = "gemma3-1b-gpu-custom";
@@ -17360,18 +17142,18 @@ var PLATFORM_BINARY_SHA256 = {
17360
17142
  "lit.windows_x86_64.exe": "de82d2829d2fb1cbdb318e2d8a78dc2f9659ff14cb11b2894d1f30e0bfde2bf6"
17361
17143
  };
17362
17144
  function getLiteRtBinDir() {
17363
- return path5.join(Storage.getGlobalGeminiDir(), "bin", "litert");
17145
+ return path4.join(Storage.getGlobalGeminiDir(), "bin", "litert");
17364
17146
  }
17365
17147
  function getPidFilePath() {
17366
- return path5.join(Storage.getGlobalTempDir(), "litert-server.pid");
17148
+ return path4.join(Storage.getGlobalTempDir(), "litert-server.pid");
17367
17149
  }
17368
17150
  function getLogFilePath() {
17369
- return path5.join(Storage.getGlobalTempDir(), "litert-server.log");
17151
+ return path4.join(Storage.getGlobalTempDir(), "litert-server.log");
17370
17152
  }
17371
17153
 
17372
17154
  // packages/cli/src/commands/gemma/platform.ts
17373
- import fs6 from "node:fs";
17374
- import path6 from "node:path";
17155
+ import fs5 from "node:fs";
17156
+ import path5 from "node:path";
17375
17157
  import { execFileSync } from "node:child_process";
17376
17158
  function getUserConfiguredBinaryPath(workspaceDir = process.cwd()) {
17377
17159
  try {
@@ -17431,14 +17213,14 @@ function getBinaryPath(binaryName) {
17431
17213
  }
17432
17214
  const name = binaryName ?? detectPlatform()?.binaryName;
17433
17215
  if (!name) return null;
17434
- return path6.join(getLiteRtBinDir(), name);
17216
+ return path5.join(getLiteRtBinDir(), name);
17435
17217
  }
17436
17218
  function getBinaryDownloadUrl(binaryName) {
17437
17219
  return `${LITERT_RELEASE_BASE_URL}/${LITERT_RELEASE_VERSION}/${binaryName}`;
17438
17220
  }
17439
17221
  function isBinaryInstalled(binaryPath = getBinaryPath()) {
17440
17222
  if (!binaryPath) return false;
17441
- return fs6.existsSync(binaryPath);
17223
+ return fs5.existsSync(binaryPath);
17442
17224
  }
17443
17225
  function isModelDownloaded(binaryPath) {
17444
17226
  try {
@@ -17494,7 +17276,7 @@ function isLiteRtServerProcessInfo(value) {
17494
17276
  function readServerProcessInfo() {
17495
17277
  const pidPath = getPidFilePath();
17496
17278
  try {
17497
- const content = fs6.readFileSync(pidPath, "utf-8").trim();
17279
+ const content = fs5.readFileSync(pidPath, "utf-8").trim();
17498
17280
  if (!content) {
17499
17281
  return null;
17500
17282
  }
@@ -17508,7 +17290,7 @@ function readServerProcessInfo() {
17508
17290
  }
17509
17291
  }
17510
17292
  function writeServerProcessInfo(processInfo) {
17511
- fs6.writeFileSync(getPidFilePath(), JSON.stringify(processInfo), "utf-8");
17293
+ fs5.writeFileSync(getPidFilePath(), JSON.stringify(processInfo), "utf-8");
17512
17294
  }
17513
17295
  function readServerPid() {
17514
17296
  return readServerProcessInfo()?.pid ?? null;
@@ -17523,7 +17305,7 @@ function normalizeProcessValue(value) {
17523
17305
  function readProcessCommandLine(pid) {
17524
17306
  try {
17525
17307
  if (process.platform === "linux") {
17526
- const output2 = fs6.readFileSync(`/proc/${pid}/cmdline`, "utf-8");
17308
+ const output2 = fs5.readFileSync(`/proc/${pid}/cmdline`, "utf-8");
17527
17309
  return output2.trim() ? output2 : null;
17528
17310
  }
17529
17311
  if (process.platform === "win32") {
@@ -17566,7 +17348,7 @@ function isExpectedLiteRtServerCommand(commandLine, options) {
17566
17348
  }
17567
17349
  const normalizedBinaryPath = normalizeProcessValue(options.binaryPath);
17568
17350
  const normalizedBinaryName = normalizeProcessValue(
17569
- path6.basename(options.binaryPath)
17351
+ path5.basename(options.binaryPath)
17570
17352
  );
17571
17353
  return normalizedCommandLine.includes(normalizedBinaryPath) || normalizedCommandLine.includes(normalizedBinaryName);
17572
17354
  }
@@ -17629,8 +17411,8 @@ export {
17629
17411
  pickDefaultThemeName,
17630
17412
  DefaultLight,
17631
17413
  DefaultDark,
17632
- loadTrustedFolders,
17633
17414
  isFolderTrustEnabled,
17415
+ loadTrustedFolders2 as loadTrustedFolders,
17634
17416
  isWorkspaceTrusted,
17635
17417
  isFullWidth,
17636
17418
  isWide,