@google/gemini-cli 0.68.0-preview.0 → 0.69.0-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/bundle/{chunk-VBHMFLBY.js → chunk-2KKDGWF2.js} +1 -1
  2. package/bundle/{chunk-ODU7Z2RJ.js → chunk-2ONJU4V7.js} +1 -1
  3. package/bundle/chunk-3HEOCQDN.js +65 -0
  4. package/bundle/{chunk-HRM7UWGB.js → chunk-4SOPZCNA.js} +22 -6
  5. package/bundle/{chunk-JMHCFAD6.js → chunk-6KCLIS6W.js} +1 -1
  6. package/bundle/{chunk-CXMHAFLN.js → chunk-BRHBBQC5.js} +2 -2
  7. package/bundle/{chunk-KKKD4FID.js → chunk-C5BED6L6.js} +2 -2
  8. package/bundle/{chunk-OZOUOK43.js → chunk-CGQSFR2I.js} +7 -2
  9. package/bundle/{chunk-RD2EMHV2.js → chunk-CWHEOJXF.js} +7 -2
  10. package/bundle/{chunk-ZZOOHVBL.js → chunk-DWMZSQYG.js} +4479 -1925
  11. package/bundle/{chunk-ZEK4UYYW.js → chunk-GDCMMKZ2.js} +1 -1
  12. package/bundle/{chunk-44PCK4QK.js → chunk-GQ7FZNO2.js} +1 -1
  13. package/bundle/{chunk-XPTXBYQQ.js → chunk-JJWPYMIO.js} +3 -3
  14. package/bundle/{chunk-L57AYV6U.js → chunk-KUXCUQKX.js} +4357 -1897
  15. package/bundle/{chunk-6A5BTTNC.js → chunk-LYKP3S67.js} +22 -6
  16. package/bundle/{chunk-RCF66HCI.js → chunk-MP4TVGOP.js} +4479 -1925
  17. package/bundle/{chunk-XVNEFQR3.js → chunk-PH5XENTH.js} +1 -1
  18. package/bundle/{chunk-B2FKXXUH.js → chunk-RBDD6IBU.js} +617 -228
  19. package/bundle/{chunk-BKVNBJ5C.js → chunk-SYOIMUZI.js} +617 -228
  20. package/bundle/{chunk-VCO4TMD6.js → chunk-U3FFDEKY.js} +22 -6
  21. package/bundle/{chunk-LQDISFTJ.js → chunk-U5FJ6OGB.js} +2 -2
  22. package/bundle/{chunk-WEP47ZZU.js → chunk-UAHZWXSG.js} +7 -2
  23. package/bundle/chunk-UW3ZS3BH.js +65 -0
  24. package/bundle/{chunk-Q76ZDILI.js → chunk-V7L3FMBE.js} +3 -3
  25. package/bundle/chunk-VQTELFV3.js +65 -0
  26. package/bundle/{chunk-YPPJDFYP.js → chunk-YODS6HR2.js} +3 -3
  27. package/bundle/{chunk-G7EMTV2Q.js → chunk-YP5TA33N.js} +617 -228
  28. package/bundle/{cleanup-CCR2EOHA.js → cleanup-3T2KXSP4.js} +2 -2
  29. package/bundle/{cleanup-OQV2G5Y3.js → cleanup-NNQCI4KC.js} +2 -2
  30. package/bundle/{cleanup-T24OFMOA.js → cleanup-TA4VYDXQ.js} +2 -2
  31. package/bundle/{core-NQRKBS47.js → core-6XF5EO7Z.js} +35 -1
  32. package/bundle/{core-UIPNZ5VU.js → core-TUJHM7E7.js} +35 -1
  33. package/bundle/{devtoolsService-3G5ZA3JV.js → devtoolsService-7EMPANTX.js} +2 -2
  34. package/bundle/{devtoolsService-V3OEHE5V.js → devtoolsService-I7WFRUEA.js} +2 -2
  35. package/bundle/{devtoolsService-EWNQDTC7.js → devtoolsService-RCBUZGYD.js} +2 -2
  36. package/bundle/{dist-OYZDNSTI.js → dist-OSQFIX7F.js} +35 -1
  37. package/bundle/docs/changelogs/index.md +18 -0
  38. package/bundle/docs/changelogs/latest.md +89 -84
  39. package/bundle/docs/changelogs/preview.md +106 -92
  40. package/bundle/docs/cli/themes.md +50 -5
  41. package/bundle/docs/cli/trusted-folders.md +13 -0
  42. package/bundle/docs/reference/commands.md +4 -0
  43. package/bundle/docs/reference/configuration.md +8 -0
  44. package/bundle/docs/reference/policy-engine.md +6 -0
  45. package/bundle/formatError-KEQ3HU3Y.js +14 -0
  46. package/bundle/formatError-LJFIC7G3.js +14 -0
  47. package/bundle/formatError-MIUNQEYE.js +14 -0
  48. package/bundle/{gemini-YFCTZ76S.js → gemini-22ON2CZG.js} +493 -132
  49. package/bundle/{gemini-FSHMUCSM.js → gemini-HLS52ZNZ.js} +493 -132
  50. package/bundle/{gemini-2P73372G.js → gemini-ZZZEFPSK.js} +493 -132
  51. package/bundle/gemini.js +14 -13
  52. package/bundle/{interactiveCli-F5RRE2VJ.js → interactiveCli-5HMWVTK2.js} +1641 -1208
  53. package/bundle/{interactiveCli-X54KN2EM.js → interactiveCli-HQBE3C3C.js} +1641 -1208
  54. package/bundle/{interactiveCli-I75IWUIA.js → interactiveCli-NKFQZXB5.js} +1641 -1208
  55. package/bundle/{liteRtServerManager-JTOIS4KU.js → liteRtServerManager-2IOXWO76.js} +4 -4
  56. package/bundle/{liteRtServerManager-UVQ2I6NL.js → liteRtServerManager-AG4Y5JMZ.js} +4 -4
  57. package/bundle/{liteRtServerManager-FLPMMDNM.js → liteRtServerManager-OFNVXXQ4.js} +4 -4
  58. package/bundle/{oauth2-provider-AYO4BU7A.js → oauth2-provider-2DHNJ2S3.js} +1 -1
  59. package/bundle/{oauth2-provider-NCQY7TJE.js → oauth2-provider-OEGXLWIL.js} +1 -1
  60. package/bundle/{oauth2-provider-VMBYZOC7.js → oauth2-provider-YDNSNN32.js} +1 -1
  61. package/bundle/policies/yolo.toml +1 -0
  62. package/bundle/sandbox-macos-permissive-open.sb +8 -0
  63. package/bundle/sandbox-macos-permissive-proxied.sb +8 -0
  64. package/bundle/sandbox-macos-restrictive-open.sb +1 -0
  65. package/bundle/sandbox-macos-restrictive-proxied.sb +1 -0
  66. package/bundle/sandbox-macos-strict-open.sb +1 -0
  67. package/bundle/sandbox-macos-strict-proxied.sb +1 -0
  68. package/bundle/{start-IXQ2E7L6.js → start-7GJH3MKY.js} +6 -6
  69. package/bundle/{start-YEKGRZVH.js → start-JSVKPUTV.js} +6 -6
  70. package/bundle/{start-DFHM4HI4.js → start-N33LF5WK.js} +6 -6
  71. package/package.json +1 -1
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  exitCli,
4
4
  require_source
5
- } from "./chunk-JMHCFAD6.js";
5
+ } from "./chunk-6KCLIS6W.js";
6
6
  import {
7
7
  AppEvent,
8
8
  appEvents
@@ -69,22 +69,25 @@ import {
69
69
  use_stdin_default,
70
70
  use_stdout_default,
71
71
  validateCustomTheme
72
- } from "./chunk-HRM7UWGB.js";
72
+ } from "./chunk-LYKP3S67.js";
73
73
  import {
74
74
  isDevelopment,
75
75
  require_semver
76
- } from "./chunk-CXMHAFLN.js";
76
+ } from "./chunk-U5FJ6OGB.js";
77
77
  import {
78
78
  emptyIcon,
79
79
  mapCoreStatusToDisplayStatus,
80
80
  require_react
81
- } from "./chunk-VBHMFLBY.js";
81
+ } from "./chunk-GDCMMKZ2.js";
82
82
  import {
83
83
  ALL_EDITORS,
84
84
  ApprovalMode,
85
85
  AsyncFzf,
86
86
  Config,
87
87
  CoreEvent,
88
+ DEFAULT_GEMINI_MODEL_AUTO,
89
+ DEFAULT_HEATMAP_WINDOW_DAYS,
90
+ DEFAULT_MODEL_CONFIGS,
88
91
  DiscoveredMCPTool,
89
92
  ExtensionDisableEvent,
90
93
  ExtensionEnableEvent,
@@ -95,12 +98,17 @@ import {
95
98
  ExtensionUpdateEvent,
96
99
  GEMINI_CLI_COMPANION_EXTENSION_NAME,
97
100
  GEMINI_DIR,
101
+ GEMINI_MODEL_ALIAS_AUTO,
102
+ GEMINI_MODEL_ALIAS_FLASH,
103
+ GEMINI_MODEL_ALIAS_FLASH_LITE,
104
+ GEMINI_MODEL_ALIAS_PRO,
98
105
  INITIAL_HISTORY_LENGTH,
99
106
  IdeClient,
100
107
  IdeConnectionEvent,
101
108
  KeychainTokenStorage,
102
109
  MCPOAuthTokenStorage,
103
110
  ModelSlashCommandEvent,
111
+ PREVIEW_GEMINI_MODEL_AUTO,
104
112
  ProjectIdRequiredError,
105
113
  REFERENCE_CONTENT_END,
106
114
  REFERENCE_CONTENT_START,
@@ -112,7 +120,9 @@ import {
112
120
  Storage,
113
121
  UPGRADE_URL_PAGE,
114
122
  UserAccountManager,
123
+ VALID_GEMINI_MODELS,
115
124
  ValidationRequiredError,
125
+ aggregateUsageFromRecordings,
116
126
  appendToLastTextPart,
117
127
  applyAdminAllowlist,
118
128
  applyInboxMemoryPatch,
@@ -149,6 +159,7 @@ import {
149
159
  flatMapTextParts,
150
160
  flushTelemetry,
151
161
  formatCheckpointDisplayList,
162
+ formatLocalDateKey,
152
163
  getAdminBlockedMcpServersMessage,
153
164
  getAdminErrorMessage,
154
165
  getDisplayString,
@@ -207,6 +218,7 @@ import {
207
218
  logRewind,
208
219
  mcpServerRequiresOAuth,
209
220
  moveInboxSkill,
221
+ normalizePath,
210
222
  openBrowserSecurely,
211
223
  open_default,
212
224
  partToString,
@@ -221,10 +233,12 @@ import {
221
233
  require_path_key,
222
234
  require_proper_lockfile,
223
235
  require_pump,
236
+ require_strip_json_comments,
224
237
  require_toml,
225
238
  resetBrowserSession,
226
239
  resolveAtCommandPath,
227
240
  resolveEditorTypeFromCommand,
241
+ resolveHeatmapDateArg,
228
242
  resolveToRealPath,
229
243
  safeLookup,
230
244
  shortenPath,
@@ -234,13 +248,14 @@ import {
234
248
  spawnAsync,
235
249
  startMemoryService,
236
250
  startupProfiler,
251
+ stripExtendedLengthPrefix,
237
252
  stripLineNumberSuffix,
238
253
  tildeifyPath,
239
254
  tokenLimit,
240
255
  uiTelemetryService,
241
256
  unescapePath,
242
257
  validateUrlDestination
243
- } from "./chunk-RCF66HCI.js";
258
+ } from "./chunk-DWMZSQYG.js";
244
259
  import {
245
260
  require_src
246
261
  } from "./chunk-L6PII3GR.js";
@@ -5882,7 +5897,7 @@ var require_yauzl = __commonJS({
5882
5897
  exports.ZipFile = ZipFile;
5883
5898
  exports.Entry = Entry;
5884
5899
  exports.RandomAccessReader = RandomAccessReader;
5885
- function open(path37, options, callback) {
5900
+ function open(path38, options, callback) {
5886
5901
  if (typeof options === "function") {
5887
5902
  callback = options;
5888
5903
  options = null;
@@ -5894,7 +5909,7 @@ var require_yauzl = __commonJS({
5894
5909
  if (options.validateEntrySizes == null) options.validateEntrySizes = true;
5895
5910
  if (options.strictFileNames == null) options.strictFileNames = false;
5896
5911
  if (callback == null) callback = defaultCallback;
5897
- fs33.open(path37, "r", function(err, fd) {
5912
+ fs33.open(path38, "r", function(err, fd) {
5898
5913
  if (err) return callback(err);
5899
5914
  fromFd(fd, options, function(err2, zipfile) {
5900
5915
  if (err2) fs33.close(fd, defaultCallback);
@@ -6496,7 +6511,7 @@ var require_extract_zip = __commonJS({
6496
6511
  var debug = require_src()("extract-zip");
6497
6512
  var { createWriteStream: createWriteStream5, promises: fs33 } = __require("fs");
6498
6513
  var getStream = require_get_stream();
6499
- var path37 = __require("path");
6514
+ var path38 = __require("path");
6500
6515
  var { promisify: promisify5 } = __require("util");
6501
6516
  var stream = __require("stream");
6502
6517
  var yauzl = require_yauzl();
@@ -6533,12 +6548,12 @@ var require_extract_zip = __commonJS({
6533
6548
  this.zipfile.readEntry();
6534
6549
  return;
6535
6550
  }
6536
- const destDir = path37.dirname(path37.join(this.opts.dir, entry.fileName));
6551
+ const destDir = path38.dirname(path38.join(this.opts.dir, entry.fileName));
6537
6552
  try {
6538
6553
  await fs33.mkdir(destDir, { recursive: true });
6539
6554
  const canonicalDestDir = await fs33.realpath(destDir);
6540
- const relativeDestDir = path37.relative(this.opts.dir, canonicalDestDir);
6541
- if (relativeDestDir.split(path37.sep).includes("..")) {
6555
+ const relativeDestDir = path38.relative(this.opts.dir, canonicalDestDir);
6556
+ if (relativeDestDir.split(path38.sep).includes("..")) {
6542
6557
  throw new Error(`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`);
6543
6558
  }
6544
6559
  await this.extractEntry(entry);
@@ -6560,7 +6575,7 @@ var require_extract_zip = __commonJS({
6560
6575
  if (this.opts.onEntry) {
6561
6576
  this.opts.onEntry(entry, this.zipfile);
6562
6577
  }
6563
- const dest = path37.join(this.opts.dir, entry.fileName);
6578
+ const dest = path38.join(this.opts.dir, entry.fileName);
6564
6579
  const mode = entry.externalFileAttributes >> 16 & 65535;
6565
6580
  const IFMT = 61440;
6566
6581
  const IFDIR = 16384;
@@ -6574,7 +6589,7 @@ var require_extract_zip = __commonJS({
6574
6589
  if (!isDir) isDir = madeBy === 0 && entry.externalFileAttributes === 16;
6575
6590
  debug("extracting entry", { filename: entry.fileName, isDir, isSymlink: symlink2 });
6576
6591
  const procMode = this.getExtractedMode(mode, isDir) & 511;
6577
- const destDir = isDir ? dest : path37.dirname(dest);
6592
+ const destDir = isDir ? dest : path38.dirname(dest);
6578
6593
  const mkdirOptions = { recursive: true };
6579
6594
  if (isDir) {
6580
6595
  mkdirOptions.mode = procMode;
@@ -6616,7 +6631,7 @@ var require_extract_zip = __commonJS({
6616
6631
  };
6617
6632
  module.exports = async function(zipPath, opts) {
6618
6633
  debug("creating target directory", opts.dir);
6619
- if (!path37.isAbsolute(opts.dir)) {
6634
+ if (!path38.isAbsolute(opts.dir)) {
6620
6635
  throw new Error("Target directory is expected to be absolute");
6621
6636
  }
6622
6637
  await fs33.mkdir(opts.dir, { recursive: true });
@@ -6648,7 +6663,7 @@ var require_strip_final_newline = __commonJS({
6648
6663
  var require_npm_run_path = __commonJS({
6649
6664
  "node_modules/run-jxa/node_modules/npm-run-path/index.js"(exports, module) {
6650
6665
  "use strict";
6651
- var path37 = __require("path");
6666
+ var path38 = __require("path");
6652
6667
  var pathKey = require_path_key();
6653
6668
  var npmRunPath = (options) => {
6654
6669
  options = {
@@ -6658,16 +6673,16 @@ var require_npm_run_path = __commonJS({
6658
6673
  ...options
6659
6674
  };
6660
6675
  let previous;
6661
- let cwdPath = path37.resolve(options.cwd);
6676
+ let cwdPath = path38.resolve(options.cwd);
6662
6677
  const result = [];
6663
6678
  while (previous !== cwdPath) {
6664
- result.push(path37.join(cwdPath, "node_modules/.bin"));
6679
+ result.push(path38.join(cwdPath, "node_modules/.bin"));
6665
6680
  previous = cwdPath;
6666
- cwdPath = path37.resolve(cwdPath, "..");
6681
+ cwdPath = path38.resolve(cwdPath, "..");
6667
6682
  }
6668
- const execPathDir = path37.resolve(options.cwd, options.execPath, "..");
6683
+ const execPathDir = path38.resolve(options.cwd, options.execPath, "..");
6669
6684
  result.push(execPathDir);
6670
- return result.concat(options.path).join(path37.delimiter);
6685
+ return result.concat(options.path).join(path38.delimiter);
6671
6686
  };
6672
6687
  module.exports = npmRunPath;
6673
6688
  module.exports.default = npmRunPath;
@@ -6677,9 +6692,9 @@ var require_npm_run_path = __commonJS({
6677
6692
  ...options
6678
6693
  };
6679
6694
  const env2 = { ...options.env };
6680
- const path38 = pathKey({ env: env2 });
6681
- options.path = env2[path38];
6682
- env2[path38] = module.exports(options);
6695
+ const path39 = pathKey({ env: env2 });
6696
+ options.path = env2[path39];
6697
+ env2[path39] = module.exports(options);
6683
6698
  return env2;
6684
6699
  };
6685
6700
  }
@@ -7795,7 +7810,7 @@ var require_command = __commonJS({
7795
7810
  var require_execa = __commonJS({
7796
7811
  "node_modules/run-jxa/node_modules/execa/index.js"(exports, module) {
7797
7812
  "use strict";
7798
- var path37 = __require("path");
7813
+ var path38 = __require("path");
7799
7814
  var childProcess3 = __require("child_process");
7800
7815
  var crossSpawn = require_cross_spawn();
7801
7816
  var stripFinalNewline = require_strip_final_newline();
@@ -7837,7 +7852,7 @@ var require_execa = __commonJS({
7837
7852
  };
7838
7853
  options.env = getEnv(options);
7839
7854
  options.stdio = normalizeStdio(options);
7840
- if (process.platform === "win32" && path37.basename(file, ".exe") === "cmd") {
7855
+ if (process.platform === "win32" && path38.basename(file, ".exe") === "cmd") {
7841
7856
  args.unshift("/q");
7842
7857
  }
7843
7858
  return { file, args, options, parsed };
@@ -12119,14 +12134,14 @@ var require_util3 = __commonJS({
12119
12134
  }
12120
12135
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
12121
12136
  let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
12122
- let path37 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
12137
+ let path38 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
12123
12138
  if (origin[origin.length - 1] === "/") {
12124
12139
  origin = origin.slice(0, origin.length - 1);
12125
12140
  }
12126
- if (path37 && path37[0] !== "/") {
12127
- path37 = `/${path37}`;
12141
+ if (path38 && path38[0] !== "/") {
12142
+ path38 = `/${path38}`;
12128
12143
  }
12129
- return new URL(`${origin}${path37}`);
12144
+ return new URL(`${origin}${path38}`);
12130
12145
  }
12131
12146
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
12132
12147
  throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -12688,9 +12703,9 @@ var require_diagnostics = __commonJS({
12688
12703
  "undici:client:sendHeaders",
12689
12704
  (evt) => {
12690
12705
  const {
12691
- request: { method, path: path37, origin }
12706
+ request: { method, path: path38, origin }
12692
12707
  } = evt;
12693
- debugLog("sending request to %s %s/%s", method, origin, path37);
12708
+ debugLog("sending request to %s %s/%s", method, origin, path38);
12694
12709
  }
12695
12710
  );
12696
12711
  }
@@ -12704,14 +12719,14 @@ var require_diagnostics = __commonJS({
12704
12719
  "undici:request:headers",
12705
12720
  (evt) => {
12706
12721
  const {
12707
- request: { method, path: path37, origin },
12722
+ request: { method, path: path38, origin },
12708
12723
  response: { statusCode }
12709
12724
  } = evt;
12710
12725
  debugLog(
12711
12726
  "received response to %s %s/%s - HTTP %d",
12712
12727
  method,
12713
12728
  origin,
12714
- path37,
12729
+ path38,
12715
12730
  statusCode
12716
12731
  );
12717
12732
  }
@@ -12720,23 +12735,23 @@ var require_diagnostics = __commonJS({
12720
12735
  "undici:request:trailers",
12721
12736
  (evt) => {
12722
12737
  const {
12723
- request: { method, path: path37, origin }
12738
+ request: { method, path: path38, origin }
12724
12739
  } = evt;
12725
- debugLog("trailers received from %s %s/%s", method, origin, path37);
12740
+ debugLog("trailers received from %s %s/%s", method, origin, path38);
12726
12741
  }
12727
12742
  );
12728
12743
  diagnosticsChannel.subscribe(
12729
12744
  "undici:request:error",
12730
12745
  (evt) => {
12731
12746
  const {
12732
- request: { method, path: path37, origin },
12747
+ request: { method, path: path38, origin },
12733
12748
  error
12734
12749
  } = evt;
12735
12750
  debugLog(
12736
12751
  "request to %s %s/%s errored - %s",
12737
12752
  method,
12738
12753
  origin,
12739
- path37,
12754
+ path38,
12740
12755
  error.message
12741
12756
  );
12742
12757
  }
@@ -12831,7 +12846,7 @@ var require_request = __commonJS({
12831
12846
  var kHandler = Symbol("handler");
12832
12847
  var Request = class {
12833
12848
  constructor(origin, {
12834
- path: path37,
12849
+ path: path38,
12835
12850
  method,
12836
12851
  body,
12837
12852
  headers,
@@ -12846,11 +12861,11 @@ var require_request = __commonJS({
12846
12861
  servername,
12847
12862
  throwOnError
12848
12863
  }, handler2) {
12849
- if (typeof path37 !== "string") {
12864
+ if (typeof path38 !== "string") {
12850
12865
  throw new InvalidArgumentError("path must be a string");
12851
- } else if (path37[0] !== "/" && !(path37.startsWith("http://") || path37.startsWith("https://")) && method !== "CONNECT") {
12866
+ } else if (path38[0] !== "/" && !(path38.startsWith("http://") || path38.startsWith("https://")) && method !== "CONNECT") {
12852
12867
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
12853
- } else if (invalidPathRegex.test(path37)) {
12868
+ } else if (invalidPathRegex.test(path38)) {
12854
12869
  throw new InvalidArgumentError("invalid request path");
12855
12870
  }
12856
12871
  if (typeof method !== "string") {
@@ -12915,7 +12930,7 @@ var require_request = __commonJS({
12915
12930
  this.completed = false;
12916
12931
  this.aborted = false;
12917
12932
  this.upgrade = upgrade || null;
12918
- this.path = query ? serializePathWithQuery(path37, query) : path37;
12933
+ this.path = query ? serializePathWithQuery(path38, query) : path38;
12919
12934
  this.origin = origin;
12920
12935
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
12921
12936
  this.blocking = blocking ?? this.method !== "HEAD";
@@ -17700,7 +17715,7 @@ var require_client_h1 = __commonJS({
17700
17715
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
17701
17716
  }
17702
17717
  function writeH1(client, request) {
17703
- const { method, path: path37, host, upgrade, blocking, reset } = request;
17718
+ const { method, path: path38, host, upgrade, blocking, reset } = request;
17704
17719
  let { body, headers, contentLength } = request;
17705
17720
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
17706
17721
  if (util2.isFormDataLike(body)) {
@@ -17766,7 +17781,7 @@ var require_client_h1 = __commonJS({
17766
17781
  if (blocking) {
17767
17782
  socket[kBlocking] = true;
17768
17783
  }
17769
- let header = `${method} ${path37} HTTP/1.1\r
17784
+ let header = `${method} ${path38} HTTP/1.1\r
17770
17785
  `;
17771
17786
  if (typeof host === "string") {
17772
17787
  header += `host: ${host}\r
@@ -18323,7 +18338,7 @@ var require_client_h2 = __commonJS({
18323
18338
  function writeH2(client, request) {
18324
18339
  const requestTimeout = request.bodyTimeout ?? client[kBodyTimeout];
18325
18340
  const session = client[kHTTP2Session];
18326
- const { method, path: path37, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
18341
+ const { method, path: path38, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
18327
18342
  let { body } = request;
18328
18343
  if (upgrade) {
18329
18344
  util2.errorRequest(client, request, new Error("Upgrade not supported for H2"));
@@ -18394,7 +18409,7 @@ var require_client_h2 = __commonJS({
18394
18409
  stream.setTimeout(requestTimeout);
18395
18410
  return true;
18396
18411
  }
18397
- headers[HTTP2_HEADER_PATH] = path37;
18412
+ headers[HTTP2_HEADER_PATH] = path38;
18398
18413
  headers[HTTP2_HEADER_SCHEME] = "https";
18399
18414
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
18400
18415
  if (body && typeof body.read === "function") {
@@ -21876,20 +21891,20 @@ var require_mock_utils = __commonJS({
21876
21891
  }
21877
21892
  return normalizedQp;
21878
21893
  }
21879
- function safeUrl(path37) {
21880
- if (typeof path37 !== "string") {
21881
- return path37;
21894
+ function safeUrl(path38) {
21895
+ if (typeof path38 !== "string") {
21896
+ return path38;
21882
21897
  }
21883
- const pathSegments = path37.split("?", 3);
21898
+ const pathSegments = path38.split("?", 3);
21884
21899
  if (pathSegments.length !== 2) {
21885
- return path37;
21900
+ return path38;
21886
21901
  }
21887
21902
  const qp = new URLSearchParams(pathSegments.pop());
21888
21903
  qp.sort();
21889
21904
  return [...pathSegments, qp.toString()].join("?");
21890
21905
  }
21891
- function matchKey(mockDispatch2, { path: path37, method, body, headers }) {
21892
- const pathMatch = matchValue(mockDispatch2.path, path37);
21906
+ function matchKey(mockDispatch2, { path: path38, method, body, headers }) {
21907
+ const pathMatch = matchValue(mockDispatch2.path, path38);
21893
21908
  const methodMatch = matchValue(mockDispatch2.method, method);
21894
21909
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
21895
21910
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -21914,8 +21929,8 @@ var require_mock_utils = __commonJS({
21914
21929
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
21915
21930
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
21916
21931
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
21917
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path37, ignoreTrailingSlash }) => {
21918
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path37)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path37), resolvedPath);
21932
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path38, ignoreTrailingSlash }) => {
21933
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path38)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path38), resolvedPath);
21919
21934
  });
21920
21935
  if (matchedMockDispatches.length === 0) {
21921
21936
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -21953,19 +21968,19 @@ var require_mock_utils = __commonJS({
21953
21968
  mockDispatches.splice(index, 1);
21954
21969
  }
21955
21970
  }
21956
- function removeTrailingSlash(path37) {
21957
- while (path37.endsWith("/")) {
21958
- path37 = path37.slice(0, -1);
21971
+ function removeTrailingSlash(path38) {
21972
+ while (path38.endsWith("/")) {
21973
+ path38 = path38.slice(0, -1);
21959
21974
  }
21960
- if (path37.length === 0) {
21961
- path37 = "/";
21975
+ if (path38.length === 0) {
21976
+ path38 = "/";
21962
21977
  }
21963
- return path37;
21978
+ return path38;
21964
21979
  }
21965
21980
  function buildKey(opts) {
21966
- const { path: path37, method, body, headers, query } = opts;
21981
+ const { path: path38, method, body, headers, query } = opts;
21967
21982
  return {
21968
- path: path37,
21983
+ path: path38,
21969
21984
  method,
21970
21985
  body,
21971
21986
  headers,
@@ -22616,10 +22631,10 @@ var require_pending_interceptors_formatter = __commonJS({
22616
22631
  }
22617
22632
  format(pendingInterceptors) {
22618
22633
  const withPrettyHeaders = pendingInterceptors.map(
22619
- ({ method, path: path37, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
22634
+ ({ method, path: path38, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
22620
22635
  Method: method,
22621
22636
  Origin: origin,
22622
- Path: path37,
22637
+ Path: path38,
22623
22638
  "Status code": statusCode,
22624
22639
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
22625
22640
  Invocations: timesInvoked,
@@ -22696,9 +22711,9 @@ var require_mock_agent = __commonJS({
22696
22711
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
22697
22712
  const dispatchOpts = { ...opts };
22698
22713
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
22699
- const [path37, searchParams] = dispatchOpts.path.split("?");
22714
+ const [path38, searchParams] = dispatchOpts.path.split("?");
22700
22715
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
22701
- dispatchOpts.path = `${path37}?${normalizedSearchParams}`;
22716
+ dispatchOpts.path = `${path38}?${normalizedSearchParams}`;
22702
22717
  }
22703
22718
  return this[kAgent].dispatch(dispatchOpts, handler2);
22704
22719
  }
@@ -22992,9 +23007,9 @@ var require_redirect_handler = __commonJS({
22992
23007
  return;
22993
23008
  }
22994
23009
  const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
22995
- const path37 = search ? `${pathname}${search}` : pathname;
23010
+ const path38 = search ? `${pathname}${search}` : pathname;
22996
23011
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
22997
- this.opts.path = path37;
23012
+ this.opts.path = path38;
22998
23013
  this.opts.origin = origin;
22999
23014
  this.opts.maxRedirections = 0;
23000
23015
  this.opts.query = null;
@@ -28696,9 +28711,9 @@ var require_util6 = __commonJS({
28696
28711
  }
28697
28712
  }
28698
28713
  }
28699
- function validateCookiePath(path37) {
28700
- for (let i = 0; i < path37.length; ++i) {
28701
- const code = path37.charCodeAt(i);
28714
+ function validateCookiePath(path38) {
28715
+ for (let i = 0; i < path38.length; ++i) {
28716
+ const code = path38.charCodeAt(i);
28702
28717
  if (code < 32 || // exclude CTLs (0-31)
28703
28718
  code === 127 || // DEL
28704
28719
  code === 59) {
@@ -31738,11 +31753,11 @@ var require_undici = __commonJS({
31738
31753
  if (typeof opts.path !== "string") {
31739
31754
  throw new InvalidArgumentError("invalid opts.path");
31740
31755
  }
31741
- let path37 = opts.path;
31756
+ let path38 = opts.path;
31742
31757
  if (!opts.path.startsWith("/")) {
31743
- path37 = `/${path37}`;
31758
+ path38 = `/${path38}`;
31744
31759
  }
31745
- url = new URL(util2.parseOrigin(url).origin + path37);
31760
+ url = new URL(util2.parseOrigin(url).origin + path38);
31746
31761
  } else {
31747
31762
  if (!opts) {
31748
31763
  opts = typeof url === "object" ? url : {};
@@ -32414,15 +32429,20 @@ function useKeypress(onKeypress, {
32414
32429
  priority
32415
32430
  }) {
32416
32431
  const { subscribe, unsubscribe } = useKeypressContext();
32432
+ const onKeypressRef = (0, import_react2.useRef)(onKeypress);
32433
+ (0, import_react2.useEffect)(() => {
32434
+ onKeypressRef.current = onKeypress;
32435
+ }, [onKeypress]);
32417
32436
  (0, import_react2.useEffect)(() => {
32418
32437
  if (!isActive) {
32419
32438
  return;
32420
32439
  }
32421
- subscribe(onKeypress, priority);
32440
+ const handler2 = (key) => onKeypressRef.current(key);
32441
+ subscribe(handler2, priority);
32422
32442
  return () => {
32423
- unsubscribe(onKeypress);
32443
+ unsubscribe(handler2);
32424
32444
  };
32425
- }, [isActive, onKeypress, subscribe, unsubscribe, priority]);
32445
+ }, [isActive, subscribe, unsubscribe, priority]);
32426
32446
  }
32427
32447
 
32428
32448
  // packages/cli/src/ui/hooks/useFocus.ts
@@ -36640,13 +36660,47 @@ var NoColorTheme = new Theme(
36640
36660
 
36641
36661
  // packages/cli/src/ui/themes/theme-manager.ts
36642
36662
  import process2 from "node:process";
36663
+ var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
36664
+ var SINGLE_CUSTOM_THEME_KEYS = /* @__PURE__ */ new Set([
36665
+ "type",
36666
+ "name",
36667
+ "text",
36668
+ "background",
36669
+ "border",
36670
+ "ui",
36671
+ "status",
36672
+ "Background",
36673
+ "Foreground",
36674
+ "LightBlue",
36675
+ "AccentBlue",
36676
+ "AccentPurple",
36677
+ "AccentCyan",
36678
+ "AccentGreen",
36679
+ "AccentYellow",
36680
+ "AccentRed",
36681
+ "DiffAdded",
36682
+ "DiffRemoved",
36683
+ "Comment",
36684
+ "Gray",
36685
+ "DarkGray",
36686
+ "GradientColors"
36687
+ ]);
36688
+ function isPlainRecord(value) {
36689
+ return typeof value === "object" && value !== null && !Array.isArray(value);
36690
+ }
36691
+ function isStringValue(value) {
36692
+ return typeof value === "string";
36693
+ }
36643
36694
  var DEFAULT_THEME = DefaultDark;
36644
36695
  var ThemeManager = class {
36645
36696
  availableThemes;
36646
36697
  activeTheme;
36698
+ userThemes = /* @__PURE__ */ new Map();
36699
+ userThemesLoaded = false;
36647
36700
  settingsThemes = /* @__PURE__ */ new Map();
36648
36701
  extensionThemes = /* @__PURE__ */ new Map();
36649
36702
  fileThemes = /* @__PURE__ */ new Map();
36703
+ fileThemesByPath = /* @__PURE__ */ new Map();
36650
36704
  terminalBackground;
36651
36705
  // Cache for dynamic colors
36652
36706
  cachedColors;
@@ -36730,8 +36784,181 @@ var ThemeManager = class {
36730
36784
  debugLogger.warn(`Invalid custom theme "${name}": ${validation.error}`);
36731
36785
  }
36732
36786
  }
36733
- if (this.activeTheme && this.activeTheme.type === "custom" && this.settingsThemes.has(this.activeTheme.name)) {
36734
- this.activeTheme = this.settingsThemes.get(this.activeTheme.name);
36787
+ if (this.activeTheme && this.activeTheme.type === "custom" && !this.userThemes.has(this.activeTheme.name)) {
36788
+ const updatedSettingsTheme = this.settingsThemes.get(
36789
+ this.activeTheme.name
36790
+ );
36791
+ if (updatedSettingsTheme) {
36792
+ this.activeTheme = updatedSettingsTheme;
36793
+ this.clearCache();
36794
+ }
36795
+ }
36796
+ }
36797
+ /**
36798
+ * Returns candidate standalone theme.json paths in ascending precedence order:
36799
+ * 1. ~/.config/gemini/theme.json
36800
+ * 2. $XDG_CONFIG_HOME/gemini/theme.json (if XDG_CONFIG_HOME is set)
36801
+ * 3. ~/.gemini/theme.json (respecting GEMINI_CLI_HOME via homedir())
36802
+ */
36803
+ getUserThemePaths() {
36804
+ const homeDir = this.homedir();
36805
+ if (!homeDir) {
36806
+ return [];
36807
+ }
36808
+ const candidates = [
36809
+ path.join(homeDir, ".config", "gemini", "theme.json")
36810
+ ];
36811
+ const xdgConfigHome = process2.env["XDG_CONFIG_HOME"];
36812
+ if (xdgConfigHome) {
36813
+ candidates.push(path.join(xdgConfigHome, "gemini", "theme.json"));
36814
+ }
36815
+ candidates.push(path.join(homeDir, GEMINI_DIR, "theme.json"));
36816
+ const deduplicatedByKey = /* @__PURE__ */ new Map();
36817
+ for (const candidate of candidates) {
36818
+ const resolved = path.resolve(candidate);
36819
+ const key = normalizePath(resolved);
36820
+ deduplicatedByKey.delete(key);
36821
+ deduplicatedByKey.set(key, resolved);
36822
+ }
36823
+ return Array.from(deduplicatedByKey.values());
36824
+ }
36825
+ parseUserThemeEntries(parsed) {
36826
+ if (!isPlainRecord(parsed)) {
36827
+ return [];
36828
+ }
36829
+ const keys = Object.keys(parsed);
36830
+ if (keys.length === 0) {
36831
+ return [];
36832
+ }
36833
+ if (parsed["type"] !== "custom") {
36834
+ const customThemes = parsed["customThemes"];
36835
+ if (isPlainRecord(customThemes)) {
36836
+ return Object.entries(customThemes).filter(
36837
+ (entry) => isPlainRecord(entry[1])
36838
+ );
36839
+ }
36840
+ const ui2 = parsed["ui"];
36841
+ if (isPlainRecord(ui2)) {
36842
+ const uiCustomThemes = ui2["customThemes"];
36843
+ if (isPlainRecord(uiCustomThemes)) {
36844
+ return Object.entries(uiCustomThemes).filter(
36845
+ (entry) => isPlainRecord(entry[1])
36846
+ );
36847
+ }
36848
+ }
36849
+ }
36850
+ const rawName = parsed["name"];
36851
+ const hasNestedCustomTheme = Object.values(parsed).some(
36852
+ (val) => isPlainRecord(val) && val["type"] === "custom"
36853
+ );
36854
+ const isSingleTheme = !hasNestedCustomTheme && (parsed["type"] === "custom" || isStringValue(rawName) || keys.every((key) => SINGLE_CUSTOM_THEME_KEYS.has(key)));
36855
+ if (isSingleTheme) {
36856
+ const themeName = isStringValue(rawName) && rawName.trim().length > 0 ? rawName : "custom";
36857
+ return [[themeName, parsed]];
36858
+ }
36859
+ return Object.entries(parsed).filter(
36860
+ (entry) => isPlainRecord(entry[1])
36861
+ );
36862
+ }
36863
+ resolveRealPath(targetPath) {
36864
+ return stripExtendedLengthPrefix(this.fs.realpathSync(targetPath));
36865
+ }
36866
+ resolveCanonicalDirectory(dirPath) {
36867
+ const resolvedDir = path.resolve(dirPath);
36868
+ try {
36869
+ const canonical = this.resolveRealPath(resolvedDir);
36870
+ if (isStringValue(canonical) && canonical.length > 0) {
36871
+ return path.resolve(canonical);
36872
+ }
36873
+ } catch {
36874
+ }
36875
+ return resolvedDir;
36876
+ }
36877
+ /**
36878
+ * Loads custom themes from standalone user theme.json files
36879
+ * (~/.gemini/theme.json and XDG fallback ~/.config/gemini/theme.json).
36880
+ */
36881
+ loadUserThemes() {
36882
+ this.userThemes.clear();
36883
+ this.userThemesLoaded = true;
36884
+ const homeDir = this.homedir();
36885
+ if (!homeDir) {
36886
+ return;
36887
+ }
36888
+ const trustedRoots = [this.resolveCanonicalDirectory(homeDir)];
36889
+ const xdgConfigHome = process2.env["XDG_CONFIG_HOME"];
36890
+ if (xdgConfigHome) {
36891
+ trustedRoots.push(this.resolveCanonicalDirectory(xdgConfigHome));
36892
+ }
36893
+ for (const candidatePath of this.getUserThemePaths()) {
36894
+ try {
36895
+ if (!this.fs.existsSync(candidatePath)) {
36896
+ continue;
36897
+ }
36898
+ const canonicalPath = this.resolveRealPath(candidatePath);
36899
+ if (!trustedRoots.some((rootDir) => isSubpath(rootDir, canonicalPath))) {
36900
+ debugLogger.warn(
36901
+ `Theme file at "${candidatePath}" resolves outside trusted configuration directories. Only load themes from trusted sources.`
36902
+ );
36903
+ continue;
36904
+ }
36905
+ const rawContent = this.fs.readFileSync(canonicalPath, "utf-8");
36906
+ const parsed = JSON.parse((0, import_strip_json_comments.default)(rawContent));
36907
+ if (!isPlainRecord(parsed)) {
36908
+ debugLogger.warn(
36909
+ `Invalid theme file "${candidatePath}": expected a JSON object.`
36910
+ );
36911
+ continue;
36912
+ }
36913
+ const entries = this.parseUserThemeEntries(parsed);
36914
+ for (const [entryKey, rawThemeConfig] of entries) {
36915
+ const rawConfigName = rawThemeConfig.name;
36916
+ const resolvedName = isStringValue(rawConfigName) && rawConfigName.trim().length > 0 ? rawConfigName : entryKey;
36917
+ const candidateConfig = {
36918
+ ...rawThemeConfig,
36919
+ name: resolvedName
36920
+ };
36921
+ const validation = validateCustomTheme(candidateConfig);
36922
+ if (!validation.isValid) {
36923
+ debugLogger.warn(
36924
+ `Invalid custom theme "${entryKey}" in "${candidatePath}": ${validation.error}`
36925
+ );
36926
+ continue;
36927
+ }
36928
+ if (validation.warning) {
36929
+ debugLogger.warn(`Theme "${entryKey}": ${validation.warning}`);
36930
+ }
36931
+ const themeWithDefaults = {
36932
+ ...DEFAULT_THEME.colors,
36933
+ ...candidateConfig,
36934
+ name: resolvedName,
36935
+ type: "custom"
36936
+ };
36937
+ try {
36938
+ const theme2 = createCustomTheme(themeWithDefaults);
36939
+ this.userThemes.set(resolvedName, theme2);
36940
+ } catch (error) {
36941
+ debugLogger.warn(
36942
+ `Failed to load custom theme "${entryKey}" from "${candidatePath}":`,
36943
+ error
36944
+ );
36945
+ }
36946
+ }
36947
+ } catch (error) {
36948
+ if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
36949
+ debugLogger.warn(
36950
+ `Could not load themes from "${candidatePath}":`,
36951
+ error
36952
+ );
36953
+ }
36954
+ }
36955
+ }
36956
+ this.clearCache();
36957
+ if (this.activeTheme && this.activeTheme.type === "custom") {
36958
+ const updatedUserTheme = this.userThemes.get(this.activeTheme.name);
36959
+ if (updatedUserTheme) {
36960
+ this.activeTheme = updatedUserTheme;
36961
+ }
36735
36962
  }
36736
36963
  }
36737
36964
  /**
@@ -36809,12 +37036,21 @@ var ThemeManager = class {
36809
37036
  clearExtensionThemes() {
36810
37037
  this.extensionThemes.clear();
36811
37038
  }
37039
+ /**
37040
+ * Clears all standalone user themes loaded from theme.json files.
37041
+ * This is primarily for testing purposes to reset state between tests.
37042
+ */
37043
+ clearUserThemes() {
37044
+ this.userThemes.clear();
37045
+ this.userThemesLoaded = false;
37046
+ }
36812
37047
  /**
36813
37048
  * Clears all themes loaded from files.
36814
37049
  * This is primarily for testing purposes to reset state between tests.
36815
37050
  */
36816
37051
  clearFileThemes() {
36817
37052
  this.fileThemes.clear();
37053
+ this.fileThemesByPath.clear();
36818
37054
  }
36819
37055
  /**
36820
37056
  * Re-initializes the ThemeManager with new dependencies.
@@ -36827,6 +37063,10 @@ var ThemeManager = class {
36827
37063
  if (dependencies.homedir) {
36828
37064
  this.homedir = dependencies.homedir;
36829
37065
  }
37066
+ this.userThemes.clear();
37067
+ this.userThemesLoaded = false;
37068
+ this.fileThemes.clear();
37069
+ this.fileThemesByPath.clear();
36830
37070
  }
36831
37071
  /**
36832
37072
  * Resets the ThemeManager state to defaults.
@@ -36836,9 +37076,12 @@ var ThemeManager = class {
36836
37076
  if (dependencies) {
36837
37077
  this.reinitialize(dependencies);
36838
37078
  }
37079
+ this.userThemes.clear();
37080
+ this.userThemesLoaded = false;
36839
37081
  this.settingsThemes.clear();
36840
37082
  this.extensionThemes.clear();
36841
37083
  this.fileThemes.clear();
37084
+ this.fileThemesByPath.clear();
36842
37085
  this.activeTheme = DEFAULT_THEME;
36843
37086
  this.terminalBackground = void 0;
36844
37087
  this.clearCache();
@@ -36866,7 +37109,7 @@ var ThemeManager = class {
36866
37109
  const isBuiltIn = this.availableThemes.some(
36867
37110
  (t) => t.name === this.activeTheme.name
36868
37111
  );
36869
- const isCustom = [...this.settingsThemes.values()].includes(this.activeTheme) || [...this.extensionThemes.values()].includes(this.activeTheme) || [...this.fileThemes.values()].includes(this.activeTheme);
37112
+ const isCustom = this.userThemes.get(this.activeTheme.name) === this.activeTheme || this.settingsThemes.get(this.activeTheme.name) === this.activeTheme || this.extensionThemes.get(this.activeTheme.name) === this.activeTheme || this.fileThemes.get(this.activeTheme.name) === this.activeTheme;
36870
37113
  if (isBuiltIn || isCustom) {
36871
37114
  return this.activeTheme;
36872
37115
  }
@@ -36973,11 +37216,16 @@ var ThemeManager = class {
36973
37216
  return themeType === backgroundType;
36974
37217
  }
36975
37218
  _getAllCustomThemes() {
36976
- return [
36977
- ...Array.from(this.settingsThemes.values()),
36978
- ...Array.from(this.extensionThemes.values()),
36979
- ...Array.from(this.fileThemes.values())
36980
- ];
37219
+ if (!this.userThemesLoaded) {
37220
+ this.loadUserThemes();
37221
+ }
37222
+ const mergedByName = new Map([
37223
+ ...this.fileThemes,
37224
+ ...this.extensionThemes,
37225
+ ...this.settingsThemes,
37226
+ ...this.userThemes
37227
+ ]);
37228
+ return Array.from(mergedByName.values());
36981
37229
  }
36982
37230
  /**
36983
37231
  * Gets a list of custom theme names.
@@ -36992,7 +37240,10 @@ var ThemeManager = class {
36992
37240
  * @returns True if the theme is custom.
36993
37241
  */
36994
37242
  isCustomTheme(themeName) {
36995
- return this.settingsThemes.has(themeName) || this.extensionThemes.has(themeName) || this.fileThemes.has(themeName);
37243
+ if (!this.userThemesLoaded) {
37244
+ this.loadUserThemes();
37245
+ }
37246
+ return this.userThemes.has(themeName) || this.settingsThemes.has(themeName) || this.extensionThemes.has(themeName) || this.fileThemes.has(themeName);
36996
37247
  }
36997
37248
  /**
36998
37249
  * Returns a list of available theme names.
@@ -37053,19 +37304,25 @@ var ThemeManager = class {
37053
37304
  }
37054
37305
  loadThemeFromFile(themePath) {
37055
37306
  try {
37056
- const canonicalPath = this.fs.realpathSync(path.resolve(themePath));
37057
- if (this.fileThemes.has(canonicalPath)) {
37058
- return this.fileThemes.get(canonicalPath);
37307
+ const canonicalPath = this.resolveRealPath(path.resolve(themePath));
37308
+ if (this.fileThemesByPath.has(canonicalPath)) {
37309
+ return this.fileThemesByPath.get(canonicalPath);
37059
37310
  }
37060
- const homeDir = path.resolve(this.homedir());
37061
- if (!canonicalPath.startsWith(homeDir)) {
37311
+ const rawHome = this.homedir();
37312
+ if (!rawHome) {
37313
+ return void 0;
37314
+ }
37315
+ const canonicalHome = this.resolveCanonicalDirectory(rawHome);
37316
+ if (!isSubpath(canonicalHome, canonicalPath)) {
37062
37317
  debugLogger.warn(
37063
37318
  `Theme file at "${themePath}" is outside your home directory. Only load themes from trusted sources.`
37064
37319
  );
37065
37320
  return void 0;
37066
37321
  }
37067
37322
  const themeContent = this.fs.readFileSync(canonicalPath, "utf-8");
37068
- const customThemeConfig = JSON.parse(themeContent);
37323
+ const customThemeConfig = JSON.parse(
37324
+ (0, import_strip_json_comments.default)(themeContent)
37325
+ );
37069
37326
  const validation = validateCustomTheme(customThemeConfig);
37070
37327
  if (!validation.isValid) {
37071
37328
  debugLogger.warn(
@@ -37083,7 +37340,8 @@ var ThemeManager = class {
37083
37340
  type: "custom"
37084
37341
  };
37085
37342
  const theme2 = createCustomTheme(themeWithDefaults);
37086
- this.fileThemes.set(canonicalPath, theme2);
37343
+ this.fileThemesByPath.set(canonicalPath, theme2);
37344
+ this.fileThemes.set(theme2.name, theme2);
37087
37345
  return theme2;
37088
37346
  } catch (error) {
37089
37347
  if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
@@ -37108,6 +37366,12 @@ var ThemeManager = class {
37108
37366
  if (this.isPath(themeName)) {
37109
37367
  return this.loadThemeFromFile(themeName);
37110
37368
  }
37369
+ if (!this.userThemesLoaded) {
37370
+ this.loadUserThemes();
37371
+ }
37372
+ if (this.userThemes.has(themeName)) {
37373
+ return this.userThemes.get(themeName);
37374
+ }
37111
37375
  if (this.settingsThemes.has(themeName)) {
37112
37376
  return this.settingsThemes.get(themeName);
37113
37377
  }
@@ -38710,8 +38974,8 @@ var Override = class _Override {
38710
38974
  output() {
38711
38975
  return `${this.isDisable ? "!" : ""}${this.baseRule}${this.includeSubdirs ? "*" : ""}`;
38712
38976
  }
38713
- matchesPath(path37) {
38714
- return this.asRegex().test(path37);
38977
+ matchesPath(path38) {
38978
+ return this.asRegex().test(path38);
38715
38979
  }
38716
38980
  };
38717
38981
  var ensureLeadingAndTrailingSlash = function(dirPath) {
@@ -42728,7 +42992,7 @@ async function retryWithBackoff(fn2, options = {}) {
42728
42992
  }
42729
42993
  throw new Error("Unreachable");
42730
42994
  }
42731
- async function removeDirectoryWithRetry(path37, options = {}) {
42995
+ async function removeDirectoryWithRetry(path38, options = {}) {
42732
42996
  const { recursive = true, force = true, ...retryOptions } = options;
42733
42997
  const isRetryableError = (error) => {
42734
42998
  if (isNodeError(error)) {
@@ -42736,7 +43000,7 @@ async function removeDirectoryWithRetry(path37, options = {}) {
42736
43000
  }
42737
43001
  return false;
42738
43002
  };
42739
- await retryWithBackoff(() => fs11.promises.rm(path37, { recursive, force }), {
43003
+ await retryWithBackoff(() => fs11.promises.rm(path38, { recursive, force }), {
42740
43004
  maxRetries: 5,
42741
43005
  initialDelay: 100,
42742
43006
  shouldRetry: isRetryableError,
@@ -44185,9 +44449,9 @@ function isSettingsValue(value) {
44185
44449
  const type = typeof value;
44186
44450
  return type === "string" || type === "number" || type === "boolean" || type === "object";
44187
44451
  }
44188
- function getNestedValue(obj, path37) {
44452
+ function getNestedValue(obj, path38) {
44189
44453
  let current = obj;
44190
- for (const key of path37) {
44454
+ for (const key of path38) {
44191
44455
  if (!isRecord2(current) || !(key in current)) {
44192
44456
  return void 0;
44193
44457
  }
@@ -44200,8 +44464,8 @@ function getEffectiveValue(key, settings) {
44200
44464
  if (!definition) {
44201
44465
  return void 0;
44202
44466
  }
44203
- const path37 = key.split(".");
44204
- const value = getNestedValue(settings, path37);
44467
+ const path38 = key.split(".");
44468
+ const value = getNestedValue(settings, path38);
44205
44469
  if (value !== void 0 && isSettingsValue(value)) {
44206
44470
  return value;
44207
44471
  }
@@ -44211,8 +44475,8 @@ function getDialogSettingKeys() {
44211
44475
  return Object.values(getFlattenedSchema()).filter((definition) => definition.showInDialog !== false).map((definition) => definition.key);
44212
44476
  }
44213
44477
  function isInSettingsScope(key, scopeSettings) {
44214
- const path37 = key.split(".");
44215
- const value = getNestedValue(scopeSettings, path37);
44478
+ const path38 = key.split(".");
44479
+ const value = getNestedValue(scopeSettings, path38);
44216
44480
  return value !== void 0;
44217
44481
  }
44218
44482
  function getDisplayValue(key, scopeSettings, _mergedSettings) {
@@ -44666,7 +44930,7 @@ async function readLocalFiles(resolvedFiles, config, signal, userMessageTimestam
44666
44930
  const match = fileContentRegex.exec(part);
44667
44931
  if (match) {
44668
44932
  const filePathSpecInContent = match[1];
44669
- const fileActualContent = match[2].trim();
44933
+ const fileActualContent = match[2];
44670
44934
  const resolvedFile = filesToRead.find(
44671
44935
  (rf) => rf.absolutePath === filePathSpecInContent || rf.pathSpec === filePathSpecInContent
44672
44936
  );
@@ -44685,7 +44949,9 @@ async function readLocalFiles(resolvedFiles, config, signal, userMessageTimestam
44685
44949
  Content from @${displayPath}:
44686
44950
  `
44687
44951
  });
44688
- parts.push({ text: fileActualContent });
44952
+ if (fileActualContent !== "") {
44953
+ parts.push({ text: fileActualContent });
44954
+ }
44689
44955
  } else {
44690
44956
  parts.push({ text: part });
44691
44957
  }
@@ -45288,7 +45554,7 @@ async function writeClipboardImages(filePaths) {
45288
45554
  if (process5.platform !== "darwin") {
45289
45555
  return;
45290
45556
  }
45291
- const paths = filePaths.map((path37) => path37 instanceof URL ? fileURLToPath(path37) : path37);
45557
+ const paths = filePaths.map((path38) => path38 instanceof URL ? fileURLToPath(path38) : path38);
45292
45558
  await runJxa((...paths2) => {
45293
45559
  ObjC.import("AppKit");
45294
45560
  ObjC.import("Foundation");
@@ -51229,7 +51495,7 @@ var persistentState = new PersistentState();
51229
51495
  // packages/cli/src/ui/utils/terminalSetup.ts
51230
51496
  var VSCODE_SHIFT_ENTER_SEQUENCE = "\\\r\n";
51231
51497
  var execAsync = promisify4(exec);
51232
- function stripJsonComments(content) {
51498
+ function stripJsonComments2(content) {
51233
51499
  return content.replace(/^\s*\/\/.*$/gm, "");
51234
51500
  }
51235
51501
  var TERMINAL_DATA = {
@@ -51333,7 +51599,7 @@ async function configureVSCodeStyle(terminalName, appName) {
51333
51599
  const content = await fs21.readFile(keybindingsFile, "utf8");
51334
51600
  await backupFile(keybindingsFile);
51335
51601
  try {
51336
- const cleanContent = stripJsonComments(content);
51602
+ const cleanContent = stripJsonComments2(content);
51337
51603
  const parsedContent = JSON.parse(cleanContent);
51338
51604
  if (!Array.isArray(parsedContent)) {
51339
51605
  return {
@@ -51465,7 +51731,7 @@ async function shouldPromptForTerminalSetup() {
51465
51731
  const keybindingsFile = path18.join(configDir, "keybindings.json");
51466
51732
  try {
51467
51733
  const content = await fs21.readFile(keybindingsFile, "utf8");
51468
- const cleanContent = stripJsonComments(content);
51734
+ const cleanContent = stripJsonComments2(content);
51469
51735
  const parsedContent = JSON.parse(cleanContent);
51470
51736
  if (!Array.isArray(parsedContent)) {
51471
51737
  return true;
@@ -52109,7 +52375,12 @@ var ShellProcessor = class {
52109
52375
  const userArgsRaw = context.invocation?.args || "";
52110
52376
  if (!prompt.includes(SHELL_INJECTION_TRIGGER)) {
52111
52377
  return [
52112
- { text: prompt.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsRaw) }
52378
+ {
52379
+ text: prompt.replaceAll(
52380
+ SHORTHAND_ARGS_PLACEHOLDER,
52381
+ () => userArgsRaw
52382
+ )
52383
+ }
52113
52384
  ];
52114
52385
  }
52115
52386
  const config = context.services.agentContext?.config;
@@ -52125,7 +52396,12 @@ var ShellProcessor = class {
52125
52396
  );
52126
52397
  if (injections.length === 0) {
52127
52398
  return [
52128
- { text: prompt.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsRaw) }
52399
+ {
52400
+ text: prompt.replaceAll(
52401
+ SHORTHAND_ARGS_PLACEHOLDER,
52402
+ () => userArgsRaw
52403
+ )
52404
+ }
52129
52405
  ];
52130
52406
  }
52131
52407
  const { shell: shell2 } = getShellConfiguration();
@@ -52138,7 +52414,7 @@ var ShellProcessor = class {
52138
52414
  }
52139
52415
  const resolvedCommand = command.replaceAll(
52140
52416
  SHORTHAND_ARGS_PLACEHOLDER,
52141
- userArgsEscaped
52417
+ () => userArgsEscaped
52142
52418
  );
52143
52419
  return { ...injection, resolvedCommand };
52144
52420
  }
@@ -52177,7 +52453,7 @@ var ShellProcessor = class {
52177
52453
  const segment = prompt.substring(lastIndex, injection.startIndex);
52178
52454
  processedPrompt += segment.replaceAll(
52179
52455
  SHORTHAND_ARGS_PLACEHOLDER,
52180
- userArgsRaw
52456
+ () => userArgsRaw
52181
52457
  );
52182
52458
  if (injection.resolvedCommand) {
52183
52459
  const activeTheme = themeManager.getActiveTheme();
@@ -52218,7 +52494,7 @@ var ShellProcessor = class {
52218
52494
  const finalSegment = prompt.substring(lastIndex);
52219
52495
  processedPrompt += finalSegment.replaceAll(
52220
52496
  SHORTHAND_ARGS_PLACEHOLDER,
52221
- userArgsRaw
52497
+ () => userArgsRaw
52222
52498
  );
52223
52499
  return [{ text: processedPrompt }];
52224
52500
  }
@@ -54736,10 +55012,10 @@ function enableFeature(settings, featureName, strategy) {
54736
55012
  };
54737
55013
  }
54738
55014
  const modifiedScopes = [];
54739
- for (const { scope, path: path37 } of foundInDisabledScopes) {
55015
+ for (const { scope, path: path38 } of foundInDisabledScopes) {
54740
55016
  if (isLoadableSettingScope(scope)) {
54741
55017
  strategy.enable(settings, scope, featureName);
54742
- modifiedScopes.push({ scope, path: path37 });
55018
+ modifiedScopes.push({ scope, path: path38 });
54743
55019
  }
54744
55020
  }
54745
55021
  return {
@@ -55230,7 +55506,7 @@ var authCommand = {
55230
55506
  import process12 from "node:process";
55231
55507
 
55232
55508
  // packages/cli/src/generated/git-commit.ts
55233
- var GIT_COMMIT_INFO = "89e9d25d6";
55509
+ var GIT_COMMIT_INFO = "1603e9bab";
55234
55510
 
55235
55511
  // packages/cli/src/ui/utils/historyExportUtils.ts
55236
55512
  import * as fsPromises from "node:fs/promises";
@@ -59981,7 +60257,7 @@ var RewindViewer = ({
59981
60257
  var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
59982
60258
  async function rewindConversation(context, client, recordingService, messageId, newText) {
59983
60259
  try {
59984
- const conversation = recordingService.rewindTo(messageId);
60260
+ const conversation = await (recordingService.rewindToAsync ? recordingService.rewindToAsync(messageId) : recordingService.rewindTo(messageId));
59985
60261
  if (!conversation) {
59986
60262
  const errorMsg = "Could not fetch conversation file";
59987
60263
  debugLogger.error(errorMsg);
@@ -59989,8 +60265,9 @@ async function rewindConversation(context, client, recordingService, messageId,
59989
60265
  coreEvents.emitFeedback("error", errorMsg);
59990
60266
  return;
59991
60267
  }
59992
- const { uiHistory } = convertSessionToHistoryFormats(conversation.messages);
59993
- const clientHistory = convertSessionToClientHistory(conversation.messages);
60268
+ const messages = conversation.messages ?? [];
60269
+ const { uiHistory } = convertSessionToHistoryFormats(messages);
60270
+ const clientHistory = convertSessionToClientHistory(messages);
59994
60271
  client.setHistory(clientHistory);
59995
60272
  client.clearCurrentSequenceModel?.();
59996
60273
  const config = context.services.agentContext?.config;
@@ -60046,75 +60323,80 @@ var rewindCommand = {
60046
60323
  messageType: "error",
60047
60324
  content: "Recording service unavailable"
60048
60325
  };
60049
- const conversation = recordingService.getConversation();
60050
- if (!conversation)
60051
- return {
60052
- type: "message",
60053
- messageType: "info",
60054
- content: "No conversation found."
60055
- };
60056
- const hasUserInteractions = conversation.messages.some(
60057
- (msg) => msg.type === "user"
60058
- );
60059
- if (!hasUserInteractions) {
60326
+ const buildRewindActionReturn = (conversation) => {
60327
+ if (!conversation)
60328
+ return {
60329
+ type: "message",
60330
+ messageType: "info",
60331
+ content: "No conversation found."
60332
+ };
60333
+ const hasUserInteractions = (conversation.messages ?? []).some(
60334
+ (msg) => msg.type === "user"
60335
+ );
60336
+ if (!hasUserInteractions) {
60337
+ return {
60338
+ type: "message",
60339
+ messageType: "info",
60340
+ content: "Nothing to rewind to."
60341
+ };
60342
+ }
60060
60343
  return {
60061
- type: "message",
60062
- messageType: "info",
60063
- content: "Nothing to rewind to."
60064
- };
60065
- }
60066
- return {
60067
- type: "custom_dialog",
60068
- component: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
60069
- RewindViewer,
60070
- {
60071
- conversation,
60072
- onExit: () => {
60073
- context.ui.removeComponent();
60074
- },
60075
- onRewind: async (messageId, newText, outcome) => {
60076
- if (outcome !== "cancel" /* Cancel */) {
60077
- logRewind(config, new RewindEvent(outcome));
60078
- }
60079
- switch (outcome) {
60080
- case "cancel" /* Cancel */:
60081
- context.ui.removeComponent();
60082
- return;
60083
- case "revert_only" /* RevertOnly */:
60084
- if (conversation) {
60085
- await revertFileChanges(conversation, messageId);
60086
- }
60087
- context.ui.removeComponent();
60088
- coreEvents.emitFeedback("info", "File changes reverted.");
60089
- return;
60090
- case "rewind_and_revert" /* RewindAndRevert */:
60091
- if (conversation) {
60092
- await revertFileChanges(conversation, messageId);
60093
- }
60094
- await rewindConversation(
60095
- context,
60096
- client,
60097
- recordingService,
60098
- messageId,
60099
- newText
60100
- );
60101
- return;
60102
- case "rewind_only" /* RewindOnly */:
60103
- await rewindConversation(
60104
- context,
60105
- client,
60106
- recordingService,
60107
- messageId,
60108
- newText
60109
- );
60110
- return;
60111
- default:
60112
- checkExhaustive(outcome);
60344
+ type: "custom_dialog",
60345
+ component: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
60346
+ RewindViewer,
60347
+ {
60348
+ conversation,
60349
+ onExit: () => {
60350
+ context.ui.removeComponent();
60351
+ },
60352
+ onRewind: async (messageId, newText, outcome) => {
60353
+ if (outcome !== "cancel" /* Cancel */) {
60354
+ logRewind(config, new RewindEvent(outcome));
60355
+ }
60356
+ switch (outcome) {
60357
+ case "cancel" /* Cancel */:
60358
+ context.ui.removeComponent();
60359
+ return;
60360
+ case "revert_only" /* RevertOnly */:
60361
+ if (conversation) {
60362
+ await revertFileChanges(conversation, messageId);
60363
+ }
60364
+ context.ui.removeComponent();
60365
+ coreEvents.emitFeedback("info", "File changes reverted.");
60366
+ return;
60367
+ case "rewind_and_revert" /* RewindAndRevert */:
60368
+ if (conversation) {
60369
+ await revertFileChanges(conversation, messageId);
60370
+ }
60371
+ await rewindConversation(
60372
+ context,
60373
+ client,
60374
+ recordingService,
60375
+ messageId,
60376
+ newText
60377
+ );
60378
+ return;
60379
+ case "rewind_only" /* RewindOnly */:
60380
+ await rewindConversation(
60381
+ context,
60382
+ client,
60383
+ recordingService,
60384
+ messageId,
60385
+ newText
60386
+ );
60387
+ return;
60388
+ default:
60389
+ checkExhaustive(outcome);
60390
+ }
60113
60391
  }
60114
60392
  }
60115
- }
60116
- )
60393
+ )
60394
+ };
60117
60395
  };
60396
+ if (recordingService.getConversationAsync) {
60397
+ return recordingService.getConversationAsync().then(buildRewindActionReturn);
60398
+ }
60399
+ return buildRewindActionReturn(recordingService.getConversation());
60118
60400
  }
60119
60401
  };
60120
60402
 
@@ -60148,14 +60430,14 @@ function enableHook(settings, hookName) {
60148
60430
  }
60149
60431
  const modifiedScopes = [];
60150
60432
  try {
60151
- for (const { scope, path: path37 } of foundInDisabledScopes) {
60433
+ for (const { scope, path: path38 } of foundInDisabledScopes) {
60152
60434
  if (isLoadableSettingScope(scope)) {
60153
60435
  const currentScopeDisabled = settings.forScope(scope).settings.hooksConfig?.disabled ?? [];
60154
60436
  const newDisabled = currentScopeDisabled.filter(
60155
60437
  (name) => name !== hookName
60156
60438
  );
60157
60439
  settings.setValue(scope, "hooksConfig.disabled", newDisabled);
60158
- modifiedScopes.push({ scope, path: path37 });
60440
+ modifiedScopes.push({ scope, path: path38 });
60159
60441
  }
60160
60442
  }
60161
60443
  } catch (error) {
@@ -60450,7 +60732,7 @@ async function enableAction3(context, args) {
60450
60732
  }
60451
60733
  const feedback = renderHookActionFeedback(
60452
60734
  result,
60453
- (label, path37) => `${label} (${path37})`
60735
+ (label, path38) => `${label} (${path38})`
60454
60736
  );
60455
60737
  return {
60456
60738
  type: "message",
@@ -60492,7 +60774,7 @@ async function disableAction3(context, args) {
60492
60774
  }
60493
60775
  const feedback = renderHookActionFeedback(
60494
60776
  result,
60495
- (label, path37) => `${label} (${path37})`
60777
+ (label, path38) => `${label} (${path38})`
60496
60778
  );
60497
60779
  return {
60498
60780
  type: "message",
@@ -61046,7 +61328,7 @@ Use /mcp auth <server-name> to authenticate.`
61046
61328
  type: "info",
61047
61329
  text: `Starting OAuth authentication for MCP server '${serverName}'...`
61048
61330
  });
61049
- const { MCPOAuthProvider } = await import("./core-NQRKBS47.js");
61331
+ const { MCPOAuthProvider } = await import("./core-6XF5EO7Z.js");
61050
61332
  let oauthConfig = server.oauth;
61051
61333
  if (!oauthConfig) {
61052
61334
  oauthConfig = { enabled: false };
@@ -76687,6 +76969,37 @@ var memoryCommand = (_config) => {
76687
76969
  };
76688
76970
 
76689
76971
  // packages/cli/src/ui/commands/modelCommand.ts
76972
+ function getValidModelNames(context) {
76973
+ const validModels = /* @__PURE__ */ new Set([
76974
+ ...Array.from(VALID_GEMINI_MODELS).filter((model) => model !== "none"),
76975
+ ...Object.keys(DEFAULT_MODEL_CONFIGS.modelDefinitions ?? {}),
76976
+ GEMINI_MODEL_ALIAS_AUTO,
76977
+ GEMINI_MODEL_ALIAS_PRO,
76978
+ GEMINI_MODEL_ALIAS_FLASH,
76979
+ GEMINI_MODEL_ALIAS_FLASH_LITE,
76980
+ PREVIEW_GEMINI_MODEL_AUTO,
76981
+ DEFAULT_GEMINI_MODEL_AUTO
76982
+ ]);
76983
+ const config = context.services.agentContext?.config;
76984
+ const serviceDefinitions = config?.getModelConfigService?.()?.getModelDefinitions?.();
76985
+ if (serviceDefinitions) {
76986
+ for (const model of Object.keys(serviceDefinitions)) {
76987
+ validModels.add(model);
76988
+ }
76989
+ }
76990
+ const modelConfigs = context.services.settings?.merged?.modelConfigs;
76991
+ if (modelConfigs?.customAliases) {
76992
+ for (const alias of Object.keys(modelConfigs.customAliases)) {
76993
+ validModels.add(alias);
76994
+ }
76995
+ }
76996
+ if (modelConfigs?.modelDefinitions) {
76997
+ for (const model of Object.keys(modelConfigs.modelDefinitions)) {
76998
+ validModels.add(model);
76999
+ }
77000
+ }
77001
+ return validModels;
77002
+ }
76690
77003
  var setModelCommand = {
76691
77004
  name: "set",
76692
77005
  description: "Set the model to use. Usage: /model set <model-name> [--persist]",
@@ -76694,15 +77007,24 @@ var setModelCommand = {
76694
77007
  autoExecute: false,
76695
77008
  action: async (context, args) => {
76696
77009
  const parts = args.trim().split(/\s+/).filter(Boolean);
76697
- if (parts.length === 0) {
77010
+ const persist = parts.includes("--persist");
77011
+ const nonFlagParts = parts.filter((part) => part !== "--persist");
77012
+ if (nonFlagParts.length === 0) {
76698
77013
  context.ui.addItem({
76699
77014
  type: "error" /* ERROR */,
76700
77015
  text: "Usage: /model set <model-name> [--persist]"
76701
77016
  });
76702
77017
  return;
76703
77018
  }
76704
- const modelName = parts[0];
76705
- const persist = parts.includes("--persist");
77019
+ const modelName = nonFlagParts[0];
77020
+ const validModels = getValidModelNames(context);
77021
+ if (!validModels.has(modelName)) {
77022
+ context.ui.addItem({
77023
+ type: "error" /* ERROR */,
77024
+ text: `Invalid model "${modelName}". Run /model to view and select from available models.`
77025
+ });
77026
+ return;
77027
+ }
76706
77028
  if (context.services.agentContext?.config) {
76707
77029
  context.services.agentContext.config.setModel(modelName, !persist);
76708
77030
  const event = new ModelSlashCommandEvent(modelName);
@@ -76712,6 +77034,10 @@ var setModelCommand = {
76712
77034
  text: `Model set to ${modelName}${persist ? " (persisted)" : ""}`
76713
77035
  });
76714
77036
  }
77037
+ },
77038
+ completion: async (context, partialArg) => {
77039
+ const validModels = Array.from(getValidModelNames(context));
77040
+ return validModels.filter((model) => model.startsWith(partialArg));
76715
77041
  }
76716
77042
  };
76717
77043
  var manageModelCommand = {
@@ -76735,7 +77061,12 @@ var modelCommand = {
76735
77061
  kind: "built-in" /* BUILT_IN */,
76736
77062
  autoExecute: false,
76737
77063
  subCommands: [manageModelCommand, setModelCommand],
76738
- action: async (context, args) => manageModelCommand.action(context, args)
77064
+ action: async (context, args) => {
77065
+ if (args.trim().length > 0) {
77066
+ return setModelCommand.action?.(context, args);
77067
+ }
77068
+ return manageModelCommand.action?.(context, args);
77069
+ }
76739
77070
  };
76740
77071
 
76741
77072
  // packages/cli/src/ui/components/triage/TriageDuplicates.tsx
@@ -78657,6 +78988,7 @@ var resumeCommand = {
78657
78988
  };
78658
78989
 
78659
78990
  // packages/cli/src/ui/commands/statsCommand.ts
78991
+ import path35 from "node:path";
78660
78992
  function getUserIdentity(context) {
78661
78993
  const selectedAuthType = context.services.settings.merged.security.auth.selectedType || "";
78662
78994
  const userAccountManager = new UserAccountManager();
@@ -78703,14 +79035,56 @@ async function defaultSessionView(context) {
78703
79035
  }
78704
79036
  context.ui.addItem(statsItem);
78705
79037
  }
79038
+ async function heatmapView(context, rawArgs) {
79039
+ const now = /* @__PURE__ */ new Date();
79040
+ const parsedDate = resolveHeatmapDateArg(rawArgs, now);
79041
+ if (!parsedDate.ok) {
79042
+ context.ui.addItem({
79043
+ type: "error" /* ERROR */,
79044
+ text: parsedDate.error
79045
+ });
79046
+ return;
79047
+ }
79048
+ let chatsDir = "";
79049
+ try {
79050
+ const projectTempDir = context.services.agentContext?.config?.storage?.getProjectTempDir();
79051
+ if (projectTempDir) {
79052
+ chatsDir = path35.join(projectTempDir, "chats");
79053
+ }
79054
+ } catch {
79055
+ chatsDir = "";
79056
+ }
79057
+ const dataset = await aggregateUsageFromRecordings(
79058
+ chatsDir,
79059
+ DEFAULT_HEATMAP_WINDOW_DAYS,
79060
+ now
79061
+ );
79062
+ const heatmapItem = {
79063
+ type: "heatmap_stats" /* HEATMAP_STATS */,
79064
+ dailyUsage: Object.fromEntries(dataset.dailyUsage),
79065
+ totalWindowTokens: dataset.totalWindowTokens,
79066
+ totalWindowSessions: dataset.totalWindowSessions,
79067
+ totalWindowTurns: dataset.totalWindowTurns,
79068
+ currentStreak: dataset.currentStreak,
79069
+ longestStreak: dataset.longestStreak,
79070
+ today: formatLocalDateKey(now),
79071
+ selectedDate: parsedDate.date
79072
+ };
79073
+ context.ui.addItem(heatmapItem);
79074
+ }
78706
79075
  var statsCommand = {
78707
79076
  name: "stats",
78708
79077
  altNames: ["usage"],
78709
- description: "Check session stats. Usage: /stats [session|model|tools]",
79078
+ description: "Check session stats. Usage: /stats [session|model|tools|heatmap]",
78710
79079
  kind: "built-in" /* BUILT_IN */,
78711
79080
  autoExecute: false,
78712
79081
  isSafeConcurrent: true,
78713
- action: async (context) => {
79082
+ action: async (context, args) => {
79083
+ const trimmed = (args ?? "").trim();
79084
+ if (trimmed === "heatmap" || trimmed.startsWith("heatmap ")) {
79085
+ await heatmapView(context, trimmed.slice("heatmap".length));
79086
+ return;
79087
+ }
78714
79088
  await defaultSessionView(context);
78715
79089
  },
78716
79090
  subCommands: [
@@ -78759,6 +79133,21 @@ var statsCommand = {
78759
79133
  type: "tool_stats" /* TOOL_STATS */
78760
79134
  });
78761
79135
  }
79136
+ },
79137
+ {
79138
+ name: "heatmap",
79139
+ description: "Show calendar heatmap of daily token usage. Usage: /stats heatmap [today|yesterday|YYYY-MM-DD]",
79140
+ kind: "built-in" /* BUILT_IN */,
79141
+ autoExecute: true,
79142
+ isSafeConcurrent: true,
79143
+ showCompletionLoading: false,
79144
+ completion: (_context, partialArg) => {
79145
+ const prefix = partialArg.trim().toLowerCase();
79146
+ return ["today", "yesterday"].filter((opt) => opt.startsWith(prefix));
79147
+ },
79148
+ action: async (context, args) => {
79149
+ await heatmapView(context, args);
79150
+ }
78762
79151
  }
78763
79152
  ]
78764
79153
  };
@@ -78876,7 +79265,7 @@ function disableSkill(settings, skillName, scope) {
78876
79265
  // packages/cli/src/utils/skillUtils.ts
78877
79266
  var import_extract_zip2 = __toESM(require_extract_zip(), 1);
78878
79267
  import * as fs31 from "node:fs/promises";
78879
- import * as path35 from "node:path";
79268
+ import * as path36 from "node:path";
78880
79269
  import * as os7 from "node:os";
78881
79270
  function renderSkillActionFeedback(result, formatScope) {
78882
79271
  const { skillName, action, status, error } = result;
@@ -78910,7 +79299,7 @@ function renderSkillActionFeedback(result, formatScope) {
78910
79299
  return `Skill "${skillName}" ${actionVerb} ${preposition} ${s3} settings.`;
78911
79300
  }
78912
79301
  function isPathTraversal(relative3) {
78913
- return relative3 === ".." || relative3.startsWith(".." + path35.sep) || path35.isAbsolute(relative3);
79302
+ return relative3 === ".." || relative3.startsWith(".." + path36.sep) || path36.isAbsolute(relative3);
78914
79303
  }
78915
79304
  function isInvalidSubpath(relative3) {
78916
79305
  return relative3 === "" || isPathTraversal(relative3);
@@ -78923,7 +79312,7 @@ async function installSkill(source2, scope, subpath, onLog, requestConsent = ()
78923
79312
  try {
78924
79313
  if (isGitUrl) {
78925
79314
  tempDirToClean = await fs31.mkdtemp(
78926
- path35.join(os7.tmpdir(), "gemini-skill-")
79315
+ path36.join(os7.tmpdir(), "gemini-skill-")
78927
79316
  );
78928
79317
  sourcePath = tempDirToClean;
78929
79318
  onLog(`Cloning skill from ${source2}...`);
@@ -78936,19 +79325,19 @@ async function installSkill(source2, scope, subpath, onLog, requestConsent = ()
78936
79325
  );
78937
79326
  } else if (isSkillFile) {
78938
79327
  tempDirToClean = await fs31.mkdtemp(
78939
- path35.join(os7.tmpdir(), "gemini-skill-")
79328
+ path36.join(os7.tmpdir(), "gemini-skill-")
78940
79329
  );
78941
79330
  sourcePath = tempDirToClean;
78942
79331
  onLog(`Extracting skill from ${source2}...`);
78943
- await (0, import_extract_zip2.default)(path35.resolve(source2), { dir: tempDirToClean });
79332
+ await (0, import_extract_zip2.default)(path36.resolve(source2), { dir: tempDirToClean });
78944
79333
  }
78945
79334
  if (subpath) {
78946
- sourcePath = path35.join(sourcePath, subpath);
79335
+ sourcePath = path36.join(sourcePath, subpath);
78947
79336
  }
78948
- sourcePath = path35.resolve(sourcePath);
79337
+ sourcePath = path36.resolve(sourcePath);
78949
79338
  if (tempDirToClean) {
78950
- const resolvedTemp = path35.resolve(tempDirToClean);
78951
- const relative3 = path35.relative(resolvedTemp, sourcePath);
79339
+ const resolvedTemp = path36.resolve(tempDirToClean);
79340
+ const relative3 = path36.relative(resolvedTemp, sourcePath);
78952
79341
  if (isPathTraversal(relative3)) {
78953
79342
  throw new Error("Invalid path: Directory traversal not allowed.");
78954
79343
  }
@@ -78966,14 +79355,14 @@ async function installSkill(source2, scope, subpath, onLog, requestConsent = ()
78966
79355
  if (!await requestConsent(skills, targetDir)) {
78967
79356
  throw new Error("Skill installation cancelled by user.");
78968
79357
  }
78969
- const resolvedTarget = path35.resolve(targetDir);
79358
+ const resolvedTarget = path36.resolve(targetDir);
78970
79359
  await fs31.mkdir(resolvedTarget, { recursive: true });
78971
79360
  const installedSkills = [];
78972
79361
  for (const skill of skills) {
78973
79362
  const skillName = skill.name;
78974
- const skillDir = path35.dirname(skill.location);
78975
- const destPath = path35.resolve(resolvedTarget, skillName);
78976
- const relative3 = path35.relative(resolvedTarget, destPath);
79363
+ const skillDir = path36.dirname(skill.location);
79364
+ const destPath = path36.resolve(resolvedTarget, skillName);
79365
+ const relative3 = path36.relative(resolvedTarget, destPath);
78977
79366
  if (isInvalidSubpath(relative3)) {
78978
79367
  throw new Error("Invalid skill name: Path traversal detected.");
78979
79368
  }
@@ -78993,7 +79382,7 @@ async function installSkill(source2, scope, subpath, onLog, requestConsent = ()
78993
79382
  }
78994
79383
  }
78995
79384
  async function linkSkill(source2, scope, onLog, requestConsent = () => Promise.resolve(true)) {
78996
- const sourcePath = path35.resolve(source2);
79385
+ const sourcePath = path36.resolve(source2);
78997
79386
  onLog(`Searching for skills in ${sourcePath}...`);
78998
79387
  const skills = await loadSkillsFromDir(sourcePath);
78999
79388
  if (skills.length === 0) {
@@ -79018,14 +79407,14 @@ async function linkSkill(source2, scope, onLog, requestConsent = () => Promise.r
79018
79407
  if (!await requestConsent(skills, targetDir)) {
79019
79408
  throw new Error("Skill linking cancelled by user.");
79020
79409
  }
79021
- const resolvedTarget = path35.resolve(targetDir);
79410
+ const resolvedTarget = path36.resolve(targetDir);
79022
79411
  await fs31.mkdir(resolvedTarget, { recursive: true });
79023
79412
  const linkedSkills = [];
79024
79413
  for (const skill of skills) {
79025
79414
  const skillName = skill.name;
79026
- const skillSourceDir = path35.dirname(skill.location);
79027
- const destPath = path35.resolve(resolvedTarget, skillName);
79028
- const relative3 = path35.relative(resolvedTarget, destPath);
79415
+ const skillSourceDir = path36.dirname(skill.location);
79416
+ const destPath = path36.resolve(resolvedTarget, skillName);
79417
+ const relative3 = path36.relative(resolvedTarget, destPath);
79029
79418
  if (isInvalidSubpath(relative3)) {
79030
79419
  throw new Error("Invalid skill name: Path traversal detected.");
79031
79420
  }
@@ -79049,12 +79438,12 @@ async function uninstallSkill(name, scope) {
79049
79438
  const workspaceDir = process.cwd();
79050
79439
  const storage = new Storage(workspaceDir);
79051
79440
  const targetDir = scope === "workspace" ? storage.getProjectSkillsDir() : Storage.getUserSkillsDir();
79052
- const resolvedTarget = path35.resolve(targetDir);
79441
+ const resolvedTarget = path36.resolve(targetDir);
79053
79442
  const discoveredSkills = await loadSkillsFromDir(resolvedTarget);
79054
79443
  const skillToUninstall = discoveredSkills.find((s3) => s3.name === name);
79055
79444
  if (!skillToUninstall) {
79056
- const skillPath = path35.resolve(resolvedTarget, name);
79057
- const relative4 = path35.relative(resolvedTarget, skillPath);
79445
+ const skillPath = path36.resolve(resolvedTarget, name);
79446
+ const relative4 = path36.relative(resolvedTarget, skillPath);
79058
79447
  if (isInvalidSubpath(relative4)) {
79059
79448
  return null;
79060
79449
  }
@@ -79065,8 +79454,8 @@ async function uninstallSkill(name, scope) {
79065
79454
  await fs31.rm(skillPath, { recursive: true, force: true });
79066
79455
  return { location: skillPath };
79067
79456
  }
79068
- const skillDir = path35.resolve(path35.dirname(skillToUninstall.location));
79069
- const relative3 = path35.relative(resolvedTarget, skillDir);
79457
+ const skillDir = path36.resolve(path36.dirname(skillToUninstall.location));
79458
+ const relative3 = path36.relative(resolvedTarget, skillDir);
79070
79459
  if (isInvalidSubpath(relative3)) {
79071
79460
  return null;
79072
79461
  }
@@ -79200,7 +79589,7 @@ async function disableAction4(context, args) {
79200
79589
  const result = disableSkill(context.services.settings, skillName, scope);
79201
79590
  let feedback = renderSkillActionFeedback(
79202
79591
  result,
79203
- (label, path37) => `${label} (${path37})`
79592
+ (label, path38) => `${label} (${path38})`
79204
79593
  );
79205
79594
  if (result.status === "success" || result.status === "no-op") {
79206
79595
  feedback += ' You can run "/skills reload" to refresh your current instance.';
@@ -79236,7 +79625,7 @@ async function enableAction4(context, args) {
79236
79625
  const result = enableSkill(context.services.settings, skillName);
79237
79626
  let feedback = renderSkillActionFeedback(
79238
79627
  result,
79239
- (label, path37) => `${label} (${path37})`
79628
+ (label, path38) => `${label} (${path38})`
79240
79629
  );
79241
79630
  if (result.status === "success" || result.status === "no-op") {
79242
79631
  feedback += ' You can run "/skills reload" to refresh your current instance.';
@@ -79427,7 +79816,7 @@ var vimCommand = {
79427
79816
 
79428
79817
  // packages/cli/src/ui/commands/setupGithubCommand.ts
79429
79818
  var import_undici2 = __toESM(require_undici(), 1);
79430
- import path36 from "node:path";
79819
+ import path37 from "node:path";
79431
79820
  import * as fs32 from "node:fs";
79432
79821
  import { Writable } from "node:stream";
79433
79822
 
@@ -79557,7 +79946,7 @@ function getOpenUrlsCommands(readmeUrl) {
79557
79946
  }
79558
79947
  async function updateGitignore(gitRepoRoot) {
79559
79948
  const gitignoreEntries = [".gemini/", "gha-creds-*.json"];
79560
- const gitignorePath = path36.join(gitRepoRoot, ".gitignore");
79949
+ const gitignorePath = path37.join(gitRepoRoot, ".gitignore");
79561
79950
  try {
79562
79951
  let existingContent = "";
79563
79952
  let fileExists2 = true;
@@ -79612,9 +80001,9 @@ async function downloadFiles({
79612
80001
  `Empty body while downloading ${endpoint}: ${response.status} - ${response.statusText}`
79613
80002
  );
79614
80003
  }
79615
- const destination = path36.resolve(
80004
+ const destination = path37.resolve(
79616
80005
  targetDir,
79617
- path36.basename(fileBasename)
80006
+ path37.basename(fileBasename)
79618
80007
  );
79619
80008
  const fileStream = fs32.createWriteStream(destination, {
79620
80009
  mode: 420,
@@ -79687,9 +80076,9 @@ var setupGithubCommand = {
79687
80076
  const proxy = context?.services?.agentContext?.config.getProxy();
79688
80077
  const releaseTag = await getLatestGitHubRelease(proxy);
79689
80078
  const readmeUrl = `https://github.com/google-github-actions/run-gemini-cli/blob/${releaseTag}/README.md#quick-start`;
79690
- const workflowsDir = path36.join(gitRepoRoot, ".github", "workflows");
80079
+ const workflowsDir = path37.join(gitRepoRoot, ".github", "workflows");
79691
80080
  await createDirectory(workflowsDir);
79692
- const commandsDir = path36.join(gitRepoRoot, ".github", "commands");
80081
+ const commandsDir = path37.join(gitRepoRoot, ".github", "commands");
79693
80082
  await createDirectory(commandsDir);
79694
80083
  await downloadSetupFiles({
79695
80084
  configs: [