@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.
- package/bundle/{chunk-VBHMFLBY.js → chunk-2KKDGWF2.js} +1 -1
- package/bundle/{chunk-ODU7Z2RJ.js → chunk-2ONJU4V7.js} +1 -1
- package/bundle/chunk-3HEOCQDN.js +65 -0
- package/bundle/{chunk-HRM7UWGB.js → chunk-4SOPZCNA.js} +22 -6
- package/bundle/{chunk-JMHCFAD6.js → chunk-6KCLIS6W.js} +1 -1
- package/bundle/{chunk-CXMHAFLN.js → chunk-BRHBBQC5.js} +2 -2
- package/bundle/{chunk-KKKD4FID.js → chunk-C5BED6L6.js} +2 -2
- package/bundle/{chunk-OZOUOK43.js → chunk-CGQSFR2I.js} +7 -2
- package/bundle/{chunk-RD2EMHV2.js → chunk-CWHEOJXF.js} +7 -2
- package/bundle/{chunk-ZZOOHVBL.js → chunk-DWMZSQYG.js} +4479 -1925
- package/bundle/{chunk-ZEK4UYYW.js → chunk-GDCMMKZ2.js} +1 -1
- package/bundle/{chunk-44PCK4QK.js → chunk-GQ7FZNO2.js} +1 -1
- package/bundle/{chunk-XPTXBYQQ.js → chunk-JJWPYMIO.js} +3 -3
- package/bundle/{chunk-L57AYV6U.js → chunk-KUXCUQKX.js} +4357 -1897
- package/bundle/{chunk-6A5BTTNC.js → chunk-LYKP3S67.js} +22 -6
- package/bundle/{chunk-RCF66HCI.js → chunk-MP4TVGOP.js} +4479 -1925
- package/bundle/{chunk-XVNEFQR3.js → chunk-PH5XENTH.js} +1 -1
- package/bundle/{chunk-B2FKXXUH.js → chunk-RBDD6IBU.js} +617 -228
- package/bundle/{chunk-BKVNBJ5C.js → chunk-SYOIMUZI.js} +617 -228
- package/bundle/{chunk-VCO4TMD6.js → chunk-U3FFDEKY.js} +22 -6
- package/bundle/{chunk-LQDISFTJ.js → chunk-U5FJ6OGB.js} +2 -2
- package/bundle/{chunk-WEP47ZZU.js → chunk-UAHZWXSG.js} +7 -2
- package/bundle/chunk-UW3ZS3BH.js +65 -0
- package/bundle/{chunk-Q76ZDILI.js → chunk-V7L3FMBE.js} +3 -3
- package/bundle/chunk-VQTELFV3.js +65 -0
- package/bundle/{chunk-YPPJDFYP.js → chunk-YODS6HR2.js} +3 -3
- package/bundle/{chunk-G7EMTV2Q.js → chunk-YP5TA33N.js} +617 -228
- package/bundle/{cleanup-CCR2EOHA.js → cleanup-3T2KXSP4.js} +2 -2
- package/bundle/{cleanup-OQV2G5Y3.js → cleanup-NNQCI4KC.js} +2 -2
- package/bundle/{cleanup-T24OFMOA.js → cleanup-TA4VYDXQ.js} +2 -2
- package/bundle/{core-NQRKBS47.js → core-6XF5EO7Z.js} +35 -1
- package/bundle/{core-UIPNZ5VU.js → core-TUJHM7E7.js} +35 -1
- package/bundle/{devtoolsService-3G5ZA3JV.js → devtoolsService-7EMPANTX.js} +2 -2
- package/bundle/{devtoolsService-V3OEHE5V.js → devtoolsService-I7WFRUEA.js} +2 -2
- package/bundle/{devtoolsService-EWNQDTC7.js → devtoolsService-RCBUZGYD.js} +2 -2
- package/bundle/{dist-OYZDNSTI.js → dist-OSQFIX7F.js} +35 -1
- package/bundle/docs/changelogs/index.md +18 -0
- package/bundle/docs/changelogs/latest.md +89 -84
- package/bundle/docs/changelogs/preview.md +106 -92
- package/bundle/docs/cli/themes.md +50 -5
- package/bundle/docs/cli/trusted-folders.md +13 -0
- package/bundle/docs/reference/commands.md +4 -0
- package/bundle/docs/reference/configuration.md +8 -0
- package/bundle/docs/reference/policy-engine.md +6 -0
- package/bundle/formatError-KEQ3HU3Y.js +14 -0
- package/bundle/formatError-LJFIC7G3.js +14 -0
- package/bundle/formatError-MIUNQEYE.js +14 -0
- package/bundle/{gemini-YFCTZ76S.js → gemini-22ON2CZG.js} +493 -132
- package/bundle/{gemini-FSHMUCSM.js → gemini-HLS52ZNZ.js} +493 -132
- package/bundle/{gemini-2P73372G.js → gemini-ZZZEFPSK.js} +493 -132
- package/bundle/gemini.js +14 -13
- package/bundle/{interactiveCli-F5RRE2VJ.js → interactiveCli-5HMWVTK2.js} +1641 -1208
- package/bundle/{interactiveCli-X54KN2EM.js → interactiveCli-HQBE3C3C.js} +1641 -1208
- package/bundle/{interactiveCli-I75IWUIA.js → interactiveCli-NKFQZXB5.js} +1641 -1208
- package/bundle/{liteRtServerManager-JTOIS4KU.js → liteRtServerManager-2IOXWO76.js} +4 -4
- package/bundle/{liteRtServerManager-UVQ2I6NL.js → liteRtServerManager-AG4Y5JMZ.js} +4 -4
- package/bundle/{liteRtServerManager-FLPMMDNM.js → liteRtServerManager-OFNVXXQ4.js} +4 -4
- package/bundle/{oauth2-provider-AYO4BU7A.js → oauth2-provider-2DHNJ2S3.js} +1 -1
- package/bundle/{oauth2-provider-NCQY7TJE.js → oauth2-provider-OEGXLWIL.js} +1 -1
- package/bundle/{oauth2-provider-VMBYZOC7.js → oauth2-provider-YDNSNN32.js} +1 -1
- package/bundle/policies/yolo.toml +1 -0
- package/bundle/sandbox-macos-permissive-open.sb +8 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +8 -0
- package/bundle/sandbox-macos-restrictive-open.sb +1 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +1 -0
- package/bundle/sandbox-macos-strict-open.sb +1 -0
- package/bundle/sandbox-macos-strict-proxied.sb +1 -0
- package/bundle/{start-IXQ2E7L6.js → start-7GJH3MKY.js} +6 -6
- package/bundle/{start-YEKGRZVH.js → start-JSVKPUTV.js} +6 -6
- package/bundle/{start-DFHM4HI4.js → start-N33LF5WK.js} +6 -6
- 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-
|
|
5
|
+
} from "./chunk-2ONJU4V7.js";
|
|
6
6
|
import {
|
|
7
7
|
AppEvent,
|
|
8
8
|
appEvents
|
|
@@ -69,16 +69,16 @@ import {
|
|
|
69
69
|
use_stdin_default,
|
|
70
70
|
use_stdout_default,
|
|
71
71
|
validateCustomTheme
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-U3FFDEKY.js";
|
|
73
73
|
import {
|
|
74
74
|
isDevelopment,
|
|
75
75
|
require_semver
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-C5BED6L6.js";
|
|
77
77
|
import {
|
|
78
78
|
emptyIcon,
|
|
79
79
|
mapCoreStatusToDisplayStatus,
|
|
80
80
|
require_react
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-GQ7FZNO2.js";
|
|
82
82
|
import {
|
|
83
83
|
ALL_EDITORS,
|
|
84
84
|
ApprovalMode,
|
|
@@ -87,6 +87,9 @@ import {
|
|
|
87
87
|
Config,
|
|
88
88
|
CoreEvent,
|
|
89
89
|
CoreToolCallStatus,
|
|
90
|
+
DEFAULT_GEMINI_MODEL_AUTO,
|
|
91
|
+
DEFAULT_HEATMAP_WINDOW_DAYS,
|
|
92
|
+
DEFAULT_MODEL_CONFIGS,
|
|
90
93
|
DiscoveredMCPTool,
|
|
91
94
|
ExtensionDisableEvent,
|
|
92
95
|
ExtensionEnableEvent,
|
|
@@ -97,6 +100,10 @@ import {
|
|
|
97
100
|
ExtensionUpdateEvent,
|
|
98
101
|
GEMINI_CLI_COMPANION_EXTENSION_NAME,
|
|
99
102
|
GEMINI_DIR,
|
|
103
|
+
GEMINI_MODEL_ALIAS_AUTO,
|
|
104
|
+
GEMINI_MODEL_ALIAS_FLASH,
|
|
105
|
+
GEMINI_MODEL_ALIAS_FLASH_LITE,
|
|
106
|
+
GEMINI_MODEL_ALIAS_PRO,
|
|
100
107
|
HookType,
|
|
101
108
|
IDEConnectionStatus,
|
|
102
109
|
INITIAL_HISTORY_LENGTH,
|
|
@@ -110,6 +117,7 @@ import {
|
|
|
110
117
|
MCPOAuthTokenStorage,
|
|
111
118
|
MCPServerStatus,
|
|
112
119
|
ModelSlashCommandEvent,
|
|
120
|
+
PREVIEW_GEMINI_MODEL_AUTO,
|
|
113
121
|
PolicyDecision,
|
|
114
122
|
ProjectIdRequiredError,
|
|
115
123
|
REFERENCE_CONTENT_END,
|
|
@@ -125,7 +133,9 @@ import {
|
|
|
125
133
|
TrustLevel,
|
|
126
134
|
UPGRADE_URL_PAGE,
|
|
127
135
|
UserAccountManager,
|
|
136
|
+
VALID_GEMINI_MODELS,
|
|
128
137
|
ValidationRequiredError,
|
|
138
|
+
aggregateUsageFromRecordings,
|
|
129
139
|
appendToLastTextPart,
|
|
130
140
|
applyAdminAllowlist,
|
|
131
141
|
applyInboxMemoryPatch,
|
|
@@ -162,6 +172,7 @@ import {
|
|
|
162
172
|
flatMapTextParts,
|
|
163
173
|
flushTelemetry,
|
|
164
174
|
formatCheckpointDisplayList,
|
|
175
|
+
formatLocalDateKey,
|
|
165
176
|
getAdminBlockedMcpServersMessage,
|
|
166
177
|
getAdminErrorMessage,
|
|
167
178
|
getDisplayString,
|
|
@@ -220,6 +231,7 @@ import {
|
|
|
220
231
|
logRewind,
|
|
221
232
|
mcpServerRequiresOAuth,
|
|
222
233
|
moveInboxSkill,
|
|
234
|
+
normalizePath,
|
|
223
235
|
openBrowserSecurely,
|
|
224
236
|
open_default,
|
|
225
237
|
partToString,
|
|
@@ -234,10 +246,12 @@ import {
|
|
|
234
246
|
require_path_key,
|
|
235
247
|
require_proper_lockfile,
|
|
236
248
|
require_pump,
|
|
249
|
+
require_strip_json_comments,
|
|
237
250
|
require_toml,
|
|
238
251
|
resetBrowserSession,
|
|
239
252
|
resolveAtCommandPath,
|
|
240
253
|
resolveEditorTypeFromCommand,
|
|
254
|
+
resolveHeatmapDateArg,
|
|
241
255
|
resolveToRealPath,
|
|
242
256
|
safeLookup,
|
|
243
257
|
shortenPath,
|
|
@@ -247,13 +261,14 @@ import {
|
|
|
247
261
|
spawnAsync,
|
|
248
262
|
startMemoryService,
|
|
249
263
|
startupProfiler,
|
|
264
|
+
stripExtendedLengthPrefix,
|
|
250
265
|
stripLineNumberSuffix,
|
|
251
266
|
tildeifyPath,
|
|
252
267
|
tokenLimit,
|
|
253
268
|
uiTelemetryService,
|
|
254
269
|
unescapePath,
|
|
255
270
|
validateUrlDestination
|
|
256
|
-
} from "./chunk-
|
|
271
|
+
} from "./chunk-KUXCUQKX.js";
|
|
257
272
|
import {
|
|
258
273
|
require_src
|
|
259
274
|
} from "./chunk-L6PII3GR.js";
|
|
@@ -5895,7 +5910,7 @@ var require_yauzl = __commonJS({
|
|
|
5895
5910
|
exports.ZipFile = ZipFile;
|
|
5896
5911
|
exports.Entry = Entry;
|
|
5897
5912
|
exports.RandomAccessReader = RandomAccessReader;
|
|
5898
|
-
function open(
|
|
5913
|
+
function open(path38, options, callback) {
|
|
5899
5914
|
if (typeof options === "function") {
|
|
5900
5915
|
callback = options;
|
|
5901
5916
|
options = null;
|
|
@@ -5907,7 +5922,7 @@ var require_yauzl = __commonJS({
|
|
|
5907
5922
|
if (options.validateEntrySizes == null) options.validateEntrySizes = true;
|
|
5908
5923
|
if (options.strictFileNames == null) options.strictFileNames = false;
|
|
5909
5924
|
if (callback == null) callback = defaultCallback;
|
|
5910
|
-
fs33.open(
|
|
5925
|
+
fs33.open(path38, "r", function(err, fd) {
|
|
5911
5926
|
if (err) return callback(err);
|
|
5912
5927
|
fromFd(fd, options, function(err2, zipfile) {
|
|
5913
5928
|
if (err2) fs33.close(fd, defaultCallback);
|
|
@@ -6509,7 +6524,7 @@ var require_extract_zip = __commonJS({
|
|
|
6509
6524
|
var debug = require_src()("extract-zip");
|
|
6510
6525
|
var { createWriteStream: createWriteStream5, promises: fs33 } = __require("fs");
|
|
6511
6526
|
var getStream = require_get_stream();
|
|
6512
|
-
var
|
|
6527
|
+
var path38 = __require("path");
|
|
6513
6528
|
var { promisify: promisify5 } = __require("util");
|
|
6514
6529
|
var stream = __require("stream");
|
|
6515
6530
|
var yauzl = require_yauzl();
|
|
@@ -6546,12 +6561,12 @@ var require_extract_zip = __commonJS({
|
|
|
6546
6561
|
this.zipfile.readEntry();
|
|
6547
6562
|
return;
|
|
6548
6563
|
}
|
|
6549
|
-
const destDir =
|
|
6564
|
+
const destDir = path38.dirname(path38.join(this.opts.dir, entry.fileName));
|
|
6550
6565
|
try {
|
|
6551
6566
|
await fs33.mkdir(destDir, { recursive: true });
|
|
6552
6567
|
const canonicalDestDir = await fs33.realpath(destDir);
|
|
6553
|
-
const relativeDestDir =
|
|
6554
|
-
if (relativeDestDir.split(
|
|
6568
|
+
const relativeDestDir = path38.relative(this.opts.dir, canonicalDestDir);
|
|
6569
|
+
if (relativeDestDir.split(path38.sep).includes("..")) {
|
|
6555
6570
|
throw new Error(`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`);
|
|
6556
6571
|
}
|
|
6557
6572
|
await this.extractEntry(entry);
|
|
@@ -6573,7 +6588,7 @@ var require_extract_zip = __commonJS({
|
|
|
6573
6588
|
if (this.opts.onEntry) {
|
|
6574
6589
|
this.opts.onEntry(entry, this.zipfile);
|
|
6575
6590
|
}
|
|
6576
|
-
const dest =
|
|
6591
|
+
const dest = path38.join(this.opts.dir, entry.fileName);
|
|
6577
6592
|
const mode = entry.externalFileAttributes >> 16 & 65535;
|
|
6578
6593
|
const IFMT = 61440;
|
|
6579
6594
|
const IFDIR = 16384;
|
|
@@ -6587,7 +6602,7 @@ var require_extract_zip = __commonJS({
|
|
|
6587
6602
|
if (!isDir) isDir = madeBy === 0 && entry.externalFileAttributes === 16;
|
|
6588
6603
|
debug("extracting entry", { filename: entry.fileName, isDir, isSymlink: symlink2 });
|
|
6589
6604
|
const procMode = this.getExtractedMode(mode, isDir) & 511;
|
|
6590
|
-
const destDir = isDir ? dest :
|
|
6605
|
+
const destDir = isDir ? dest : path38.dirname(dest);
|
|
6591
6606
|
const mkdirOptions = { recursive: true };
|
|
6592
6607
|
if (isDir) {
|
|
6593
6608
|
mkdirOptions.mode = procMode;
|
|
@@ -6629,7 +6644,7 @@ var require_extract_zip = __commonJS({
|
|
|
6629
6644
|
};
|
|
6630
6645
|
module.exports = async function(zipPath, opts) {
|
|
6631
6646
|
debug("creating target directory", opts.dir);
|
|
6632
|
-
if (!
|
|
6647
|
+
if (!path38.isAbsolute(opts.dir)) {
|
|
6633
6648
|
throw new Error("Target directory is expected to be absolute");
|
|
6634
6649
|
}
|
|
6635
6650
|
await fs33.mkdir(opts.dir, { recursive: true });
|
|
@@ -6661,7 +6676,7 @@ var require_strip_final_newline = __commonJS({
|
|
|
6661
6676
|
var require_npm_run_path = __commonJS({
|
|
6662
6677
|
"node_modules/run-jxa/node_modules/npm-run-path/index.js"(exports, module) {
|
|
6663
6678
|
"use strict";
|
|
6664
|
-
var
|
|
6679
|
+
var path38 = __require("path");
|
|
6665
6680
|
var pathKey = require_path_key();
|
|
6666
6681
|
var npmRunPath = (options) => {
|
|
6667
6682
|
options = {
|
|
@@ -6671,16 +6686,16 @@ var require_npm_run_path = __commonJS({
|
|
|
6671
6686
|
...options
|
|
6672
6687
|
};
|
|
6673
6688
|
let previous;
|
|
6674
|
-
let cwdPath =
|
|
6689
|
+
let cwdPath = path38.resolve(options.cwd);
|
|
6675
6690
|
const result = [];
|
|
6676
6691
|
while (previous !== cwdPath) {
|
|
6677
|
-
result.push(
|
|
6692
|
+
result.push(path38.join(cwdPath, "node_modules/.bin"));
|
|
6678
6693
|
previous = cwdPath;
|
|
6679
|
-
cwdPath =
|
|
6694
|
+
cwdPath = path38.resolve(cwdPath, "..");
|
|
6680
6695
|
}
|
|
6681
|
-
const execPathDir =
|
|
6696
|
+
const execPathDir = path38.resolve(options.cwd, options.execPath, "..");
|
|
6682
6697
|
result.push(execPathDir);
|
|
6683
|
-
return result.concat(options.path).join(
|
|
6698
|
+
return result.concat(options.path).join(path38.delimiter);
|
|
6684
6699
|
};
|
|
6685
6700
|
module.exports = npmRunPath;
|
|
6686
6701
|
module.exports.default = npmRunPath;
|
|
@@ -6690,9 +6705,9 @@ var require_npm_run_path = __commonJS({
|
|
|
6690
6705
|
...options
|
|
6691
6706
|
};
|
|
6692
6707
|
const env2 = { ...options.env };
|
|
6693
|
-
const
|
|
6694
|
-
options.path = env2[
|
|
6695
|
-
env2[
|
|
6708
|
+
const path39 = pathKey({ env: env2 });
|
|
6709
|
+
options.path = env2[path39];
|
|
6710
|
+
env2[path39] = module.exports(options);
|
|
6696
6711
|
return env2;
|
|
6697
6712
|
};
|
|
6698
6713
|
}
|
|
@@ -7808,7 +7823,7 @@ var require_command = __commonJS({
|
|
|
7808
7823
|
var require_execa = __commonJS({
|
|
7809
7824
|
"node_modules/run-jxa/node_modules/execa/index.js"(exports, module) {
|
|
7810
7825
|
"use strict";
|
|
7811
|
-
var
|
|
7826
|
+
var path38 = __require("path");
|
|
7812
7827
|
var childProcess3 = __require("child_process");
|
|
7813
7828
|
var crossSpawn = require_cross_spawn();
|
|
7814
7829
|
var stripFinalNewline = require_strip_final_newline();
|
|
@@ -7850,7 +7865,7 @@ var require_execa = __commonJS({
|
|
|
7850
7865
|
};
|
|
7851
7866
|
options.env = getEnv(options);
|
|
7852
7867
|
options.stdio = normalizeStdio(options);
|
|
7853
|
-
if (process.platform === "win32" &&
|
|
7868
|
+
if (process.platform === "win32" && path38.basename(file, ".exe") === "cmd") {
|
|
7854
7869
|
args.unshift("/q");
|
|
7855
7870
|
}
|
|
7856
7871
|
return { file, args, options, parsed };
|
|
@@ -12132,14 +12147,14 @@ var require_util3 = __commonJS({
|
|
|
12132
12147
|
}
|
|
12133
12148
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
12134
12149
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
12135
|
-
let
|
|
12150
|
+
let path38 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
12136
12151
|
if (origin[origin.length - 1] === "/") {
|
|
12137
12152
|
origin = origin.slice(0, origin.length - 1);
|
|
12138
12153
|
}
|
|
12139
|
-
if (
|
|
12140
|
-
|
|
12154
|
+
if (path38 && path38[0] !== "/") {
|
|
12155
|
+
path38 = `/${path38}`;
|
|
12141
12156
|
}
|
|
12142
|
-
return new URL(`${origin}${
|
|
12157
|
+
return new URL(`${origin}${path38}`);
|
|
12143
12158
|
}
|
|
12144
12159
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
12145
12160
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -12701,9 +12716,9 @@ var require_diagnostics = __commonJS({
|
|
|
12701
12716
|
"undici:client:sendHeaders",
|
|
12702
12717
|
(evt) => {
|
|
12703
12718
|
const {
|
|
12704
|
-
request: { method, path:
|
|
12719
|
+
request: { method, path: path38, origin }
|
|
12705
12720
|
} = evt;
|
|
12706
|
-
debugLog("sending request to %s %s/%s", method, origin,
|
|
12721
|
+
debugLog("sending request to %s %s/%s", method, origin, path38);
|
|
12707
12722
|
}
|
|
12708
12723
|
);
|
|
12709
12724
|
}
|
|
@@ -12717,14 +12732,14 @@ var require_diagnostics = __commonJS({
|
|
|
12717
12732
|
"undici:request:headers",
|
|
12718
12733
|
(evt) => {
|
|
12719
12734
|
const {
|
|
12720
|
-
request: { method, path:
|
|
12735
|
+
request: { method, path: path38, origin },
|
|
12721
12736
|
response: { statusCode }
|
|
12722
12737
|
} = evt;
|
|
12723
12738
|
debugLog(
|
|
12724
12739
|
"received response to %s %s/%s - HTTP %d",
|
|
12725
12740
|
method,
|
|
12726
12741
|
origin,
|
|
12727
|
-
|
|
12742
|
+
path38,
|
|
12728
12743
|
statusCode
|
|
12729
12744
|
);
|
|
12730
12745
|
}
|
|
@@ -12733,23 +12748,23 @@ var require_diagnostics = __commonJS({
|
|
|
12733
12748
|
"undici:request:trailers",
|
|
12734
12749
|
(evt) => {
|
|
12735
12750
|
const {
|
|
12736
|
-
request: { method, path:
|
|
12751
|
+
request: { method, path: path38, origin }
|
|
12737
12752
|
} = evt;
|
|
12738
|
-
debugLog("trailers received from %s %s/%s", method, origin,
|
|
12753
|
+
debugLog("trailers received from %s %s/%s", method, origin, path38);
|
|
12739
12754
|
}
|
|
12740
12755
|
);
|
|
12741
12756
|
diagnosticsChannel.subscribe(
|
|
12742
12757
|
"undici:request:error",
|
|
12743
12758
|
(evt) => {
|
|
12744
12759
|
const {
|
|
12745
|
-
request: { method, path:
|
|
12760
|
+
request: { method, path: path38, origin },
|
|
12746
12761
|
error
|
|
12747
12762
|
} = evt;
|
|
12748
12763
|
debugLog(
|
|
12749
12764
|
"request to %s %s/%s errored - %s",
|
|
12750
12765
|
method,
|
|
12751
12766
|
origin,
|
|
12752
|
-
|
|
12767
|
+
path38,
|
|
12753
12768
|
error.message
|
|
12754
12769
|
);
|
|
12755
12770
|
}
|
|
@@ -12844,7 +12859,7 @@ var require_request = __commonJS({
|
|
|
12844
12859
|
var kHandler = Symbol("handler");
|
|
12845
12860
|
var Request = class {
|
|
12846
12861
|
constructor(origin, {
|
|
12847
|
-
path:
|
|
12862
|
+
path: path38,
|
|
12848
12863
|
method,
|
|
12849
12864
|
body,
|
|
12850
12865
|
headers,
|
|
@@ -12859,11 +12874,11 @@ var require_request = __commonJS({
|
|
|
12859
12874
|
servername,
|
|
12860
12875
|
throwOnError
|
|
12861
12876
|
}, handler2) {
|
|
12862
|
-
if (typeof
|
|
12877
|
+
if (typeof path38 !== "string") {
|
|
12863
12878
|
throw new InvalidArgumentError("path must be a string");
|
|
12864
|
-
} else if (
|
|
12879
|
+
} else if (path38[0] !== "/" && !(path38.startsWith("http://") || path38.startsWith("https://")) && method !== "CONNECT") {
|
|
12865
12880
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
12866
|
-
} else if (invalidPathRegex.test(
|
|
12881
|
+
} else if (invalidPathRegex.test(path38)) {
|
|
12867
12882
|
throw new InvalidArgumentError("invalid request path");
|
|
12868
12883
|
}
|
|
12869
12884
|
if (typeof method !== "string") {
|
|
@@ -12928,7 +12943,7 @@ var require_request = __commonJS({
|
|
|
12928
12943
|
this.completed = false;
|
|
12929
12944
|
this.aborted = false;
|
|
12930
12945
|
this.upgrade = upgrade || null;
|
|
12931
|
-
this.path = query ? serializePathWithQuery(
|
|
12946
|
+
this.path = query ? serializePathWithQuery(path38, query) : path38;
|
|
12932
12947
|
this.origin = origin;
|
|
12933
12948
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
12934
12949
|
this.blocking = blocking ?? this.method !== "HEAD";
|
|
@@ -17713,7 +17728,7 @@ var require_client_h1 = __commonJS({
|
|
|
17713
17728
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
17714
17729
|
}
|
|
17715
17730
|
function writeH1(client, request) {
|
|
17716
|
-
const { method, path:
|
|
17731
|
+
const { method, path: path38, host, upgrade, blocking, reset } = request;
|
|
17717
17732
|
let { body, headers, contentLength } = request;
|
|
17718
17733
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
17719
17734
|
if (util2.isFormDataLike(body)) {
|
|
@@ -17779,7 +17794,7 @@ var require_client_h1 = __commonJS({
|
|
|
17779
17794
|
if (blocking) {
|
|
17780
17795
|
socket[kBlocking] = true;
|
|
17781
17796
|
}
|
|
17782
|
-
let header = `${method} ${
|
|
17797
|
+
let header = `${method} ${path38} HTTP/1.1\r
|
|
17783
17798
|
`;
|
|
17784
17799
|
if (typeof host === "string") {
|
|
17785
17800
|
header += `host: ${host}\r
|
|
@@ -18336,7 +18351,7 @@ var require_client_h2 = __commonJS({
|
|
|
18336
18351
|
function writeH2(client, request) {
|
|
18337
18352
|
const requestTimeout = request.bodyTimeout ?? client[kBodyTimeout];
|
|
18338
18353
|
const session = client[kHTTP2Session];
|
|
18339
|
-
const { method, path:
|
|
18354
|
+
const { method, path: path38, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
|
|
18340
18355
|
let { body } = request;
|
|
18341
18356
|
if (upgrade) {
|
|
18342
18357
|
util2.errorRequest(client, request, new Error("Upgrade not supported for H2"));
|
|
@@ -18407,7 +18422,7 @@ var require_client_h2 = __commonJS({
|
|
|
18407
18422
|
stream.setTimeout(requestTimeout);
|
|
18408
18423
|
return true;
|
|
18409
18424
|
}
|
|
18410
|
-
headers[HTTP2_HEADER_PATH] =
|
|
18425
|
+
headers[HTTP2_HEADER_PATH] = path38;
|
|
18411
18426
|
headers[HTTP2_HEADER_SCHEME] = "https";
|
|
18412
18427
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
18413
18428
|
if (body && typeof body.read === "function") {
|
|
@@ -21889,20 +21904,20 @@ var require_mock_utils = __commonJS({
|
|
|
21889
21904
|
}
|
|
21890
21905
|
return normalizedQp;
|
|
21891
21906
|
}
|
|
21892
|
-
function safeUrl(
|
|
21893
|
-
if (typeof
|
|
21894
|
-
return
|
|
21907
|
+
function safeUrl(path38) {
|
|
21908
|
+
if (typeof path38 !== "string") {
|
|
21909
|
+
return path38;
|
|
21895
21910
|
}
|
|
21896
|
-
const pathSegments =
|
|
21911
|
+
const pathSegments = path38.split("?", 3);
|
|
21897
21912
|
if (pathSegments.length !== 2) {
|
|
21898
|
-
return
|
|
21913
|
+
return path38;
|
|
21899
21914
|
}
|
|
21900
21915
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
21901
21916
|
qp.sort();
|
|
21902
21917
|
return [...pathSegments, qp.toString()].join("?");
|
|
21903
21918
|
}
|
|
21904
|
-
function matchKey(mockDispatch2, { path:
|
|
21905
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
21919
|
+
function matchKey(mockDispatch2, { path: path38, method, body, headers }) {
|
|
21920
|
+
const pathMatch = matchValue(mockDispatch2.path, path38);
|
|
21906
21921
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
21907
21922
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
21908
21923
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -21927,8 +21942,8 @@ var require_mock_utils = __commonJS({
|
|
|
21927
21942
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
21928
21943
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
21929
21944
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
21930
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
21931
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
21945
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path38, ignoreTrailingSlash }) => {
|
|
21946
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path38)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path38), resolvedPath);
|
|
21932
21947
|
});
|
|
21933
21948
|
if (matchedMockDispatches.length === 0) {
|
|
21934
21949
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -21966,19 +21981,19 @@ var require_mock_utils = __commonJS({
|
|
|
21966
21981
|
mockDispatches.splice(index, 1);
|
|
21967
21982
|
}
|
|
21968
21983
|
}
|
|
21969
|
-
function removeTrailingSlash(
|
|
21970
|
-
while (
|
|
21971
|
-
|
|
21984
|
+
function removeTrailingSlash(path38) {
|
|
21985
|
+
while (path38.endsWith("/")) {
|
|
21986
|
+
path38 = path38.slice(0, -1);
|
|
21972
21987
|
}
|
|
21973
|
-
if (
|
|
21974
|
-
|
|
21988
|
+
if (path38.length === 0) {
|
|
21989
|
+
path38 = "/";
|
|
21975
21990
|
}
|
|
21976
|
-
return
|
|
21991
|
+
return path38;
|
|
21977
21992
|
}
|
|
21978
21993
|
function buildKey(opts) {
|
|
21979
|
-
const { path:
|
|
21994
|
+
const { path: path38, method, body, headers, query } = opts;
|
|
21980
21995
|
return {
|
|
21981
|
-
path:
|
|
21996
|
+
path: path38,
|
|
21982
21997
|
method,
|
|
21983
21998
|
body,
|
|
21984
21999
|
headers,
|
|
@@ -22629,10 +22644,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
22629
22644
|
}
|
|
22630
22645
|
format(pendingInterceptors) {
|
|
22631
22646
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
22632
|
-
({ method, path:
|
|
22647
|
+
({ method, path: path38, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
22633
22648
|
Method: method,
|
|
22634
22649
|
Origin: origin,
|
|
22635
|
-
Path:
|
|
22650
|
+
Path: path38,
|
|
22636
22651
|
"Status code": statusCode,
|
|
22637
22652
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
22638
22653
|
Invocations: timesInvoked,
|
|
@@ -22709,9 +22724,9 @@ var require_mock_agent = __commonJS({
|
|
|
22709
22724
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
22710
22725
|
const dispatchOpts = { ...opts };
|
|
22711
22726
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
22712
|
-
const [
|
|
22727
|
+
const [path38, searchParams] = dispatchOpts.path.split("?");
|
|
22713
22728
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
22714
|
-
dispatchOpts.path = `${
|
|
22729
|
+
dispatchOpts.path = `${path38}?${normalizedSearchParams}`;
|
|
22715
22730
|
}
|
|
22716
22731
|
return this[kAgent].dispatch(dispatchOpts, handler2);
|
|
22717
22732
|
}
|
|
@@ -23005,9 +23020,9 @@ var require_redirect_handler = __commonJS({
|
|
|
23005
23020
|
return;
|
|
23006
23021
|
}
|
|
23007
23022
|
const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
23008
|
-
const
|
|
23023
|
+
const path38 = search ? `${pathname}${search}` : pathname;
|
|
23009
23024
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
23010
|
-
this.opts.path =
|
|
23025
|
+
this.opts.path = path38;
|
|
23011
23026
|
this.opts.origin = origin;
|
|
23012
23027
|
this.opts.maxRedirections = 0;
|
|
23013
23028
|
this.opts.query = null;
|
|
@@ -28709,9 +28724,9 @@ var require_util6 = __commonJS({
|
|
|
28709
28724
|
}
|
|
28710
28725
|
}
|
|
28711
28726
|
}
|
|
28712
|
-
function validateCookiePath(
|
|
28713
|
-
for (let i = 0; i <
|
|
28714
|
-
const code =
|
|
28727
|
+
function validateCookiePath(path38) {
|
|
28728
|
+
for (let i = 0; i < path38.length; ++i) {
|
|
28729
|
+
const code = path38.charCodeAt(i);
|
|
28715
28730
|
if (code < 32 || // exclude CTLs (0-31)
|
|
28716
28731
|
code === 127 || // DEL
|
|
28717
28732
|
code === 59) {
|
|
@@ -31751,11 +31766,11 @@ var require_undici = __commonJS({
|
|
|
31751
31766
|
if (typeof opts.path !== "string") {
|
|
31752
31767
|
throw new InvalidArgumentError("invalid opts.path");
|
|
31753
31768
|
}
|
|
31754
|
-
let
|
|
31769
|
+
let path38 = opts.path;
|
|
31755
31770
|
if (!opts.path.startsWith("/")) {
|
|
31756
|
-
|
|
31771
|
+
path38 = `/${path38}`;
|
|
31757
31772
|
}
|
|
31758
|
-
url = new URL(util2.parseOrigin(url).origin +
|
|
31773
|
+
url = new URL(util2.parseOrigin(url).origin + path38);
|
|
31759
31774
|
} else {
|
|
31760
31775
|
if (!opts) {
|
|
31761
31776
|
opts = typeof url === "object" ? url : {};
|
|
@@ -32427,15 +32442,20 @@ function useKeypress(onKeypress, {
|
|
|
32427
32442
|
priority
|
|
32428
32443
|
}) {
|
|
32429
32444
|
const { subscribe, unsubscribe } = useKeypressContext();
|
|
32445
|
+
const onKeypressRef = (0, import_react2.useRef)(onKeypress);
|
|
32446
|
+
(0, import_react2.useEffect)(() => {
|
|
32447
|
+
onKeypressRef.current = onKeypress;
|
|
32448
|
+
}, [onKeypress]);
|
|
32430
32449
|
(0, import_react2.useEffect)(() => {
|
|
32431
32450
|
if (!isActive) {
|
|
32432
32451
|
return;
|
|
32433
32452
|
}
|
|
32434
|
-
|
|
32453
|
+
const handler2 = (key) => onKeypressRef.current(key);
|
|
32454
|
+
subscribe(handler2, priority);
|
|
32435
32455
|
return () => {
|
|
32436
|
-
unsubscribe(
|
|
32456
|
+
unsubscribe(handler2);
|
|
32437
32457
|
};
|
|
32438
|
-
}, [isActive,
|
|
32458
|
+
}, [isActive, subscribe, unsubscribe, priority]);
|
|
32439
32459
|
}
|
|
32440
32460
|
|
|
32441
32461
|
// packages/cli/src/ui/hooks/useFocus.ts
|
|
@@ -36653,13 +36673,47 @@ var NoColorTheme = new Theme(
|
|
|
36653
36673
|
|
|
36654
36674
|
// packages/cli/src/ui/themes/theme-manager.ts
|
|
36655
36675
|
import process2 from "node:process";
|
|
36676
|
+
var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
|
|
36677
|
+
var SINGLE_CUSTOM_THEME_KEYS = /* @__PURE__ */ new Set([
|
|
36678
|
+
"type",
|
|
36679
|
+
"name",
|
|
36680
|
+
"text",
|
|
36681
|
+
"background",
|
|
36682
|
+
"border",
|
|
36683
|
+
"ui",
|
|
36684
|
+
"status",
|
|
36685
|
+
"Background",
|
|
36686
|
+
"Foreground",
|
|
36687
|
+
"LightBlue",
|
|
36688
|
+
"AccentBlue",
|
|
36689
|
+
"AccentPurple",
|
|
36690
|
+
"AccentCyan",
|
|
36691
|
+
"AccentGreen",
|
|
36692
|
+
"AccentYellow",
|
|
36693
|
+
"AccentRed",
|
|
36694
|
+
"DiffAdded",
|
|
36695
|
+
"DiffRemoved",
|
|
36696
|
+
"Comment",
|
|
36697
|
+
"Gray",
|
|
36698
|
+
"DarkGray",
|
|
36699
|
+
"GradientColors"
|
|
36700
|
+
]);
|
|
36701
|
+
function isPlainRecord(value) {
|
|
36702
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36703
|
+
}
|
|
36704
|
+
function isStringValue(value) {
|
|
36705
|
+
return typeof value === "string";
|
|
36706
|
+
}
|
|
36656
36707
|
var DEFAULT_THEME = DefaultDark;
|
|
36657
36708
|
var ThemeManager = class {
|
|
36658
36709
|
availableThemes;
|
|
36659
36710
|
activeTheme;
|
|
36711
|
+
userThemes = /* @__PURE__ */ new Map();
|
|
36712
|
+
userThemesLoaded = false;
|
|
36660
36713
|
settingsThemes = /* @__PURE__ */ new Map();
|
|
36661
36714
|
extensionThemes = /* @__PURE__ */ new Map();
|
|
36662
36715
|
fileThemes = /* @__PURE__ */ new Map();
|
|
36716
|
+
fileThemesByPath = /* @__PURE__ */ new Map();
|
|
36663
36717
|
terminalBackground;
|
|
36664
36718
|
// Cache for dynamic colors
|
|
36665
36719
|
cachedColors;
|
|
@@ -36743,8 +36797,181 @@ var ThemeManager = class {
|
|
|
36743
36797
|
debugLogger.warn(`Invalid custom theme "${name}": ${validation.error}`);
|
|
36744
36798
|
}
|
|
36745
36799
|
}
|
|
36746
|
-
if (this.activeTheme && this.activeTheme.type === "custom" && this.
|
|
36747
|
-
|
|
36800
|
+
if (this.activeTheme && this.activeTheme.type === "custom" && !this.userThemes.has(this.activeTheme.name)) {
|
|
36801
|
+
const updatedSettingsTheme = this.settingsThemes.get(
|
|
36802
|
+
this.activeTheme.name
|
|
36803
|
+
);
|
|
36804
|
+
if (updatedSettingsTheme) {
|
|
36805
|
+
this.activeTheme = updatedSettingsTheme;
|
|
36806
|
+
this.clearCache();
|
|
36807
|
+
}
|
|
36808
|
+
}
|
|
36809
|
+
}
|
|
36810
|
+
/**
|
|
36811
|
+
* Returns candidate standalone theme.json paths in ascending precedence order:
|
|
36812
|
+
* 1. ~/.config/gemini/theme.json
|
|
36813
|
+
* 2. $XDG_CONFIG_HOME/gemini/theme.json (if XDG_CONFIG_HOME is set)
|
|
36814
|
+
* 3. ~/.gemini/theme.json (respecting GEMINI_CLI_HOME via homedir())
|
|
36815
|
+
*/
|
|
36816
|
+
getUserThemePaths() {
|
|
36817
|
+
const homeDir = this.homedir();
|
|
36818
|
+
if (!homeDir) {
|
|
36819
|
+
return [];
|
|
36820
|
+
}
|
|
36821
|
+
const candidates = [
|
|
36822
|
+
path.join(homeDir, ".config", "gemini", "theme.json")
|
|
36823
|
+
];
|
|
36824
|
+
const xdgConfigHome = process2.env["XDG_CONFIG_HOME"];
|
|
36825
|
+
if (xdgConfigHome) {
|
|
36826
|
+
candidates.push(path.join(xdgConfigHome, "gemini", "theme.json"));
|
|
36827
|
+
}
|
|
36828
|
+
candidates.push(path.join(homeDir, GEMINI_DIR, "theme.json"));
|
|
36829
|
+
const deduplicatedByKey = /* @__PURE__ */ new Map();
|
|
36830
|
+
for (const candidate of candidates) {
|
|
36831
|
+
const resolved = path.resolve(candidate);
|
|
36832
|
+
const key = normalizePath(resolved);
|
|
36833
|
+
deduplicatedByKey.delete(key);
|
|
36834
|
+
deduplicatedByKey.set(key, resolved);
|
|
36835
|
+
}
|
|
36836
|
+
return Array.from(deduplicatedByKey.values());
|
|
36837
|
+
}
|
|
36838
|
+
parseUserThemeEntries(parsed) {
|
|
36839
|
+
if (!isPlainRecord(parsed)) {
|
|
36840
|
+
return [];
|
|
36841
|
+
}
|
|
36842
|
+
const keys = Object.keys(parsed);
|
|
36843
|
+
if (keys.length === 0) {
|
|
36844
|
+
return [];
|
|
36845
|
+
}
|
|
36846
|
+
if (parsed["type"] !== "custom") {
|
|
36847
|
+
const customThemes = parsed["customThemes"];
|
|
36848
|
+
if (isPlainRecord(customThemes)) {
|
|
36849
|
+
return Object.entries(customThemes).filter(
|
|
36850
|
+
(entry) => isPlainRecord(entry[1])
|
|
36851
|
+
);
|
|
36852
|
+
}
|
|
36853
|
+
const ui2 = parsed["ui"];
|
|
36854
|
+
if (isPlainRecord(ui2)) {
|
|
36855
|
+
const uiCustomThemes = ui2["customThemes"];
|
|
36856
|
+
if (isPlainRecord(uiCustomThemes)) {
|
|
36857
|
+
return Object.entries(uiCustomThemes).filter(
|
|
36858
|
+
(entry) => isPlainRecord(entry[1])
|
|
36859
|
+
);
|
|
36860
|
+
}
|
|
36861
|
+
}
|
|
36862
|
+
}
|
|
36863
|
+
const rawName = parsed["name"];
|
|
36864
|
+
const hasNestedCustomTheme = Object.values(parsed).some(
|
|
36865
|
+
(val) => isPlainRecord(val) && val["type"] === "custom"
|
|
36866
|
+
);
|
|
36867
|
+
const isSingleTheme = !hasNestedCustomTheme && (parsed["type"] === "custom" || isStringValue(rawName) || keys.every((key) => SINGLE_CUSTOM_THEME_KEYS.has(key)));
|
|
36868
|
+
if (isSingleTheme) {
|
|
36869
|
+
const themeName = isStringValue(rawName) && rawName.trim().length > 0 ? rawName : "custom";
|
|
36870
|
+
return [[themeName, parsed]];
|
|
36871
|
+
}
|
|
36872
|
+
return Object.entries(parsed).filter(
|
|
36873
|
+
(entry) => isPlainRecord(entry[1])
|
|
36874
|
+
);
|
|
36875
|
+
}
|
|
36876
|
+
resolveRealPath(targetPath) {
|
|
36877
|
+
return stripExtendedLengthPrefix(this.fs.realpathSync(targetPath));
|
|
36878
|
+
}
|
|
36879
|
+
resolveCanonicalDirectory(dirPath) {
|
|
36880
|
+
const resolvedDir = path.resolve(dirPath);
|
|
36881
|
+
try {
|
|
36882
|
+
const canonical = this.resolveRealPath(resolvedDir);
|
|
36883
|
+
if (isStringValue(canonical) && canonical.length > 0) {
|
|
36884
|
+
return path.resolve(canonical);
|
|
36885
|
+
}
|
|
36886
|
+
} catch {
|
|
36887
|
+
}
|
|
36888
|
+
return resolvedDir;
|
|
36889
|
+
}
|
|
36890
|
+
/**
|
|
36891
|
+
* Loads custom themes from standalone user theme.json files
|
|
36892
|
+
* (~/.gemini/theme.json and XDG fallback ~/.config/gemini/theme.json).
|
|
36893
|
+
*/
|
|
36894
|
+
loadUserThemes() {
|
|
36895
|
+
this.userThemes.clear();
|
|
36896
|
+
this.userThemesLoaded = true;
|
|
36897
|
+
const homeDir = this.homedir();
|
|
36898
|
+
if (!homeDir) {
|
|
36899
|
+
return;
|
|
36900
|
+
}
|
|
36901
|
+
const trustedRoots = [this.resolveCanonicalDirectory(homeDir)];
|
|
36902
|
+
const xdgConfigHome = process2.env["XDG_CONFIG_HOME"];
|
|
36903
|
+
if (xdgConfigHome) {
|
|
36904
|
+
trustedRoots.push(this.resolveCanonicalDirectory(xdgConfigHome));
|
|
36905
|
+
}
|
|
36906
|
+
for (const candidatePath of this.getUserThemePaths()) {
|
|
36907
|
+
try {
|
|
36908
|
+
if (!this.fs.existsSync(candidatePath)) {
|
|
36909
|
+
continue;
|
|
36910
|
+
}
|
|
36911
|
+
const canonicalPath = this.resolveRealPath(candidatePath);
|
|
36912
|
+
if (!trustedRoots.some((rootDir) => isSubpath(rootDir, canonicalPath))) {
|
|
36913
|
+
debugLogger.warn(
|
|
36914
|
+
`Theme file at "${candidatePath}" resolves outside trusted configuration directories. Only load themes from trusted sources.`
|
|
36915
|
+
);
|
|
36916
|
+
continue;
|
|
36917
|
+
}
|
|
36918
|
+
const rawContent = this.fs.readFileSync(canonicalPath, "utf-8");
|
|
36919
|
+
const parsed = JSON.parse((0, import_strip_json_comments.default)(rawContent));
|
|
36920
|
+
if (!isPlainRecord(parsed)) {
|
|
36921
|
+
debugLogger.warn(
|
|
36922
|
+
`Invalid theme file "${candidatePath}": expected a JSON object.`
|
|
36923
|
+
);
|
|
36924
|
+
continue;
|
|
36925
|
+
}
|
|
36926
|
+
const entries = this.parseUserThemeEntries(parsed);
|
|
36927
|
+
for (const [entryKey, rawThemeConfig] of entries) {
|
|
36928
|
+
const rawConfigName = rawThemeConfig.name;
|
|
36929
|
+
const resolvedName = isStringValue(rawConfigName) && rawConfigName.trim().length > 0 ? rawConfigName : entryKey;
|
|
36930
|
+
const candidateConfig = {
|
|
36931
|
+
...rawThemeConfig,
|
|
36932
|
+
name: resolvedName
|
|
36933
|
+
};
|
|
36934
|
+
const validation = validateCustomTheme(candidateConfig);
|
|
36935
|
+
if (!validation.isValid) {
|
|
36936
|
+
debugLogger.warn(
|
|
36937
|
+
`Invalid custom theme "${entryKey}" in "${candidatePath}": ${validation.error}`
|
|
36938
|
+
);
|
|
36939
|
+
continue;
|
|
36940
|
+
}
|
|
36941
|
+
if (validation.warning) {
|
|
36942
|
+
debugLogger.warn(`Theme "${entryKey}": ${validation.warning}`);
|
|
36943
|
+
}
|
|
36944
|
+
const themeWithDefaults = {
|
|
36945
|
+
...DEFAULT_THEME.colors,
|
|
36946
|
+
...candidateConfig,
|
|
36947
|
+
name: resolvedName,
|
|
36948
|
+
type: "custom"
|
|
36949
|
+
};
|
|
36950
|
+
try {
|
|
36951
|
+
const theme2 = createCustomTheme(themeWithDefaults);
|
|
36952
|
+
this.userThemes.set(resolvedName, theme2);
|
|
36953
|
+
} catch (error) {
|
|
36954
|
+
debugLogger.warn(
|
|
36955
|
+
`Failed to load custom theme "${entryKey}" from "${candidatePath}":`,
|
|
36956
|
+
error
|
|
36957
|
+
);
|
|
36958
|
+
}
|
|
36959
|
+
}
|
|
36960
|
+
} catch (error) {
|
|
36961
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
|
|
36962
|
+
debugLogger.warn(
|
|
36963
|
+
`Could not load themes from "${candidatePath}":`,
|
|
36964
|
+
error
|
|
36965
|
+
);
|
|
36966
|
+
}
|
|
36967
|
+
}
|
|
36968
|
+
}
|
|
36969
|
+
this.clearCache();
|
|
36970
|
+
if (this.activeTheme && this.activeTheme.type === "custom") {
|
|
36971
|
+
const updatedUserTheme = this.userThemes.get(this.activeTheme.name);
|
|
36972
|
+
if (updatedUserTheme) {
|
|
36973
|
+
this.activeTheme = updatedUserTheme;
|
|
36974
|
+
}
|
|
36748
36975
|
}
|
|
36749
36976
|
}
|
|
36750
36977
|
/**
|
|
@@ -36822,12 +37049,21 @@ var ThemeManager = class {
|
|
|
36822
37049
|
clearExtensionThemes() {
|
|
36823
37050
|
this.extensionThemes.clear();
|
|
36824
37051
|
}
|
|
37052
|
+
/**
|
|
37053
|
+
* Clears all standalone user themes loaded from theme.json files.
|
|
37054
|
+
* This is primarily for testing purposes to reset state between tests.
|
|
37055
|
+
*/
|
|
37056
|
+
clearUserThemes() {
|
|
37057
|
+
this.userThemes.clear();
|
|
37058
|
+
this.userThemesLoaded = false;
|
|
37059
|
+
}
|
|
36825
37060
|
/**
|
|
36826
37061
|
* Clears all themes loaded from files.
|
|
36827
37062
|
* This is primarily for testing purposes to reset state between tests.
|
|
36828
37063
|
*/
|
|
36829
37064
|
clearFileThemes() {
|
|
36830
37065
|
this.fileThemes.clear();
|
|
37066
|
+
this.fileThemesByPath.clear();
|
|
36831
37067
|
}
|
|
36832
37068
|
/**
|
|
36833
37069
|
* Re-initializes the ThemeManager with new dependencies.
|
|
@@ -36840,6 +37076,10 @@ var ThemeManager = class {
|
|
|
36840
37076
|
if (dependencies.homedir) {
|
|
36841
37077
|
this.homedir = dependencies.homedir;
|
|
36842
37078
|
}
|
|
37079
|
+
this.userThemes.clear();
|
|
37080
|
+
this.userThemesLoaded = false;
|
|
37081
|
+
this.fileThemes.clear();
|
|
37082
|
+
this.fileThemesByPath.clear();
|
|
36843
37083
|
}
|
|
36844
37084
|
/**
|
|
36845
37085
|
* Resets the ThemeManager state to defaults.
|
|
@@ -36849,9 +37089,12 @@ var ThemeManager = class {
|
|
|
36849
37089
|
if (dependencies) {
|
|
36850
37090
|
this.reinitialize(dependencies);
|
|
36851
37091
|
}
|
|
37092
|
+
this.userThemes.clear();
|
|
37093
|
+
this.userThemesLoaded = false;
|
|
36852
37094
|
this.settingsThemes.clear();
|
|
36853
37095
|
this.extensionThemes.clear();
|
|
36854
37096
|
this.fileThemes.clear();
|
|
37097
|
+
this.fileThemesByPath.clear();
|
|
36855
37098
|
this.activeTheme = DEFAULT_THEME;
|
|
36856
37099
|
this.terminalBackground = void 0;
|
|
36857
37100
|
this.clearCache();
|
|
@@ -36879,7 +37122,7 @@ var ThemeManager = class {
|
|
|
36879
37122
|
const isBuiltIn = this.availableThemes.some(
|
|
36880
37123
|
(t) => t.name === this.activeTheme.name
|
|
36881
37124
|
);
|
|
36882
|
-
const isCustom =
|
|
37125
|
+
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;
|
|
36883
37126
|
if (isBuiltIn || isCustom) {
|
|
36884
37127
|
return this.activeTheme;
|
|
36885
37128
|
}
|
|
@@ -36986,11 +37229,16 @@ var ThemeManager = class {
|
|
|
36986
37229
|
return themeType === backgroundType;
|
|
36987
37230
|
}
|
|
36988
37231
|
_getAllCustomThemes() {
|
|
36989
|
-
|
|
36990
|
-
|
|
36991
|
-
|
|
36992
|
-
|
|
36993
|
-
|
|
37232
|
+
if (!this.userThemesLoaded) {
|
|
37233
|
+
this.loadUserThemes();
|
|
37234
|
+
}
|
|
37235
|
+
const mergedByName = new Map([
|
|
37236
|
+
...this.fileThemes,
|
|
37237
|
+
...this.extensionThemes,
|
|
37238
|
+
...this.settingsThemes,
|
|
37239
|
+
...this.userThemes
|
|
37240
|
+
]);
|
|
37241
|
+
return Array.from(mergedByName.values());
|
|
36994
37242
|
}
|
|
36995
37243
|
/**
|
|
36996
37244
|
* Gets a list of custom theme names.
|
|
@@ -37005,7 +37253,10 @@ var ThemeManager = class {
|
|
|
37005
37253
|
* @returns True if the theme is custom.
|
|
37006
37254
|
*/
|
|
37007
37255
|
isCustomTheme(themeName) {
|
|
37008
|
-
|
|
37256
|
+
if (!this.userThemesLoaded) {
|
|
37257
|
+
this.loadUserThemes();
|
|
37258
|
+
}
|
|
37259
|
+
return this.userThemes.has(themeName) || this.settingsThemes.has(themeName) || this.extensionThemes.has(themeName) || this.fileThemes.has(themeName);
|
|
37009
37260
|
}
|
|
37010
37261
|
/**
|
|
37011
37262
|
* Returns a list of available theme names.
|
|
@@ -37066,19 +37317,25 @@ var ThemeManager = class {
|
|
|
37066
37317
|
}
|
|
37067
37318
|
loadThemeFromFile(themePath) {
|
|
37068
37319
|
try {
|
|
37069
|
-
const canonicalPath = this.
|
|
37070
|
-
if (this.
|
|
37071
|
-
return this.
|
|
37320
|
+
const canonicalPath = this.resolveRealPath(path.resolve(themePath));
|
|
37321
|
+
if (this.fileThemesByPath.has(canonicalPath)) {
|
|
37322
|
+
return this.fileThemesByPath.get(canonicalPath);
|
|
37072
37323
|
}
|
|
37073
|
-
const
|
|
37074
|
-
if (!
|
|
37324
|
+
const rawHome = this.homedir();
|
|
37325
|
+
if (!rawHome) {
|
|
37326
|
+
return void 0;
|
|
37327
|
+
}
|
|
37328
|
+
const canonicalHome = this.resolveCanonicalDirectory(rawHome);
|
|
37329
|
+
if (!isSubpath(canonicalHome, canonicalPath)) {
|
|
37075
37330
|
debugLogger.warn(
|
|
37076
37331
|
`Theme file at "${themePath}" is outside your home directory. Only load themes from trusted sources.`
|
|
37077
37332
|
);
|
|
37078
37333
|
return void 0;
|
|
37079
37334
|
}
|
|
37080
37335
|
const themeContent = this.fs.readFileSync(canonicalPath, "utf-8");
|
|
37081
|
-
const customThemeConfig = JSON.parse(
|
|
37336
|
+
const customThemeConfig = JSON.parse(
|
|
37337
|
+
(0, import_strip_json_comments.default)(themeContent)
|
|
37338
|
+
);
|
|
37082
37339
|
const validation = validateCustomTheme(customThemeConfig);
|
|
37083
37340
|
if (!validation.isValid) {
|
|
37084
37341
|
debugLogger.warn(
|
|
@@ -37096,7 +37353,8 @@ var ThemeManager = class {
|
|
|
37096
37353
|
type: "custom"
|
|
37097
37354
|
};
|
|
37098
37355
|
const theme2 = createCustomTheme(themeWithDefaults);
|
|
37099
|
-
this.
|
|
37356
|
+
this.fileThemesByPath.set(canonicalPath, theme2);
|
|
37357
|
+
this.fileThemes.set(theme2.name, theme2);
|
|
37100
37358
|
return theme2;
|
|
37101
37359
|
} catch (error) {
|
|
37102
37360
|
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
|
|
@@ -37121,6 +37379,12 @@ var ThemeManager = class {
|
|
|
37121
37379
|
if (this.isPath(themeName)) {
|
|
37122
37380
|
return this.loadThemeFromFile(themeName);
|
|
37123
37381
|
}
|
|
37382
|
+
if (!this.userThemesLoaded) {
|
|
37383
|
+
this.loadUserThemes();
|
|
37384
|
+
}
|
|
37385
|
+
if (this.userThemes.has(themeName)) {
|
|
37386
|
+
return this.userThemes.get(themeName);
|
|
37387
|
+
}
|
|
37124
37388
|
if (this.settingsThemes.has(themeName)) {
|
|
37125
37389
|
return this.settingsThemes.get(themeName);
|
|
37126
37390
|
}
|
|
@@ -38723,8 +38987,8 @@ var Override = class _Override {
|
|
|
38723
38987
|
output() {
|
|
38724
38988
|
return `${this.isDisable ? "!" : ""}${this.baseRule}${this.includeSubdirs ? "*" : ""}`;
|
|
38725
38989
|
}
|
|
38726
|
-
matchesPath(
|
|
38727
|
-
return this.asRegex().test(
|
|
38990
|
+
matchesPath(path38) {
|
|
38991
|
+
return this.asRegex().test(path38);
|
|
38728
38992
|
}
|
|
38729
38993
|
};
|
|
38730
38994
|
var ensureLeadingAndTrailingSlash = function(dirPath) {
|
|
@@ -42741,7 +43005,7 @@ async function retryWithBackoff(fn2, options = {}) {
|
|
|
42741
43005
|
}
|
|
42742
43006
|
throw new Error("Unreachable");
|
|
42743
43007
|
}
|
|
42744
|
-
async function removeDirectoryWithRetry(
|
|
43008
|
+
async function removeDirectoryWithRetry(path38, options = {}) {
|
|
42745
43009
|
const { recursive = true, force = true, ...retryOptions } = options;
|
|
42746
43010
|
const isRetryableError = (error) => {
|
|
42747
43011
|
if (isNodeError(error)) {
|
|
@@ -42749,7 +43013,7 @@ async function removeDirectoryWithRetry(path37, options = {}) {
|
|
|
42749
43013
|
}
|
|
42750
43014
|
return false;
|
|
42751
43015
|
};
|
|
42752
|
-
await retryWithBackoff(() => fs11.promises.rm(
|
|
43016
|
+
await retryWithBackoff(() => fs11.promises.rm(path38, { recursive, force }), {
|
|
42753
43017
|
maxRetries: 5,
|
|
42754
43018
|
initialDelay: 100,
|
|
42755
43019
|
shouldRetry: isRetryableError,
|
|
@@ -44198,9 +44462,9 @@ function isSettingsValue(value) {
|
|
|
44198
44462
|
const type = typeof value;
|
|
44199
44463
|
return type === "string" || type === "number" || type === "boolean" || type === "object";
|
|
44200
44464
|
}
|
|
44201
|
-
function getNestedValue(obj,
|
|
44465
|
+
function getNestedValue(obj, path38) {
|
|
44202
44466
|
let current = obj;
|
|
44203
|
-
for (const key of
|
|
44467
|
+
for (const key of path38) {
|
|
44204
44468
|
if (!isRecord2(current) || !(key in current)) {
|
|
44205
44469
|
return void 0;
|
|
44206
44470
|
}
|
|
@@ -44213,8 +44477,8 @@ function getEffectiveValue(key, settings) {
|
|
|
44213
44477
|
if (!definition) {
|
|
44214
44478
|
return void 0;
|
|
44215
44479
|
}
|
|
44216
|
-
const
|
|
44217
|
-
const value = getNestedValue(settings,
|
|
44480
|
+
const path38 = key.split(".");
|
|
44481
|
+
const value = getNestedValue(settings, path38);
|
|
44218
44482
|
if (value !== void 0 && isSettingsValue(value)) {
|
|
44219
44483
|
return value;
|
|
44220
44484
|
}
|
|
@@ -44224,8 +44488,8 @@ function getDialogSettingKeys() {
|
|
|
44224
44488
|
return Object.values(getFlattenedSchema()).filter((definition) => definition.showInDialog !== false).map((definition) => definition.key);
|
|
44225
44489
|
}
|
|
44226
44490
|
function isInSettingsScope(key, scopeSettings) {
|
|
44227
|
-
const
|
|
44228
|
-
const value = getNestedValue(scopeSettings,
|
|
44491
|
+
const path38 = key.split(".");
|
|
44492
|
+
const value = getNestedValue(scopeSettings, path38);
|
|
44229
44493
|
return value !== void 0;
|
|
44230
44494
|
}
|
|
44231
44495
|
function getDisplayValue(key, scopeSettings, _mergedSettings) {
|
|
@@ -44679,7 +44943,7 @@ async function readLocalFiles(resolvedFiles, config, signal, userMessageTimestam
|
|
|
44679
44943
|
const match = fileContentRegex.exec(part);
|
|
44680
44944
|
if (match) {
|
|
44681
44945
|
const filePathSpecInContent = match[1];
|
|
44682
|
-
const fileActualContent = match[2]
|
|
44946
|
+
const fileActualContent = match[2];
|
|
44683
44947
|
const resolvedFile = filesToRead.find(
|
|
44684
44948
|
(rf) => rf.absolutePath === filePathSpecInContent || rf.pathSpec === filePathSpecInContent
|
|
44685
44949
|
);
|
|
@@ -44698,7 +44962,9 @@ async function readLocalFiles(resolvedFiles, config, signal, userMessageTimestam
|
|
|
44698
44962
|
Content from @${displayPath}:
|
|
44699
44963
|
`
|
|
44700
44964
|
});
|
|
44701
|
-
|
|
44965
|
+
if (fileActualContent !== "") {
|
|
44966
|
+
parts.push({ text: fileActualContent });
|
|
44967
|
+
}
|
|
44702
44968
|
} else {
|
|
44703
44969
|
parts.push({ text: part });
|
|
44704
44970
|
}
|
|
@@ -45301,7 +45567,7 @@ async function writeClipboardImages(filePaths) {
|
|
|
45301
45567
|
if (process5.platform !== "darwin") {
|
|
45302
45568
|
return;
|
|
45303
45569
|
}
|
|
45304
|
-
const paths = filePaths.map((
|
|
45570
|
+
const paths = filePaths.map((path38) => path38 instanceof URL ? fileURLToPath(path38) : path38);
|
|
45305
45571
|
await runJxa((...paths2) => {
|
|
45306
45572
|
ObjC.import("AppKit");
|
|
45307
45573
|
ObjC.import("Foundation");
|
|
@@ -51242,7 +51508,7 @@ var persistentState = new PersistentState();
|
|
|
51242
51508
|
// packages/cli/src/ui/utils/terminalSetup.ts
|
|
51243
51509
|
var VSCODE_SHIFT_ENTER_SEQUENCE = "\\\r\n";
|
|
51244
51510
|
var execAsync = promisify4(exec);
|
|
51245
|
-
function
|
|
51511
|
+
function stripJsonComments2(content) {
|
|
51246
51512
|
return content.replace(/^\s*\/\/.*$/gm, "");
|
|
51247
51513
|
}
|
|
51248
51514
|
var TERMINAL_DATA = {
|
|
@@ -51346,7 +51612,7 @@ async function configureVSCodeStyle(terminalName, appName) {
|
|
|
51346
51612
|
const content = await fs21.readFile(keybindingsFile, "utf8");
|
|
51347
51613
|
await backupFile(keybindingsFile);
|
|
51348
51614
|
try {
|
|
51349
|
-
const cleanContent =
|
|
51615
|
+
const cleanContent = stripJsonComments2(content);
|
|
51350
51616
|
const parsedContent = JSON.parse(cleanContent);
|
|
51351
51617
|
if (!Array.isArray(parsedContent)) {
|
|
51352
51618
|
return {
|
|
@@ -51478,7 +51744,7 @@ async function shouldPromptForTerminalSetup() {
|
|
|
51478
51744
|
const keybindingsFile = path18.join(configDir, "keybindings.json");
|
|
51479
51745
|
try {
|
|
51480
51746
|
const content = await fs21.readFile(keybindingsFile, "utf8");
|
|
51481
|
-
const cleanContent =
|
|
51747
|
+
const cleanContent = stripJsonComments2(content);
|
|
51482
51748
|
const parsedContent = JSON.parse(cleanContent);
|
|
51483
51749
|
if (!Array.isArray(parsedContent)) {
|
|
51484
51750
|
return true;
|
|
@@ -52122,7 +52388,12 @@ var ShellProcessor = class {
|
|
|
52122
52388
|
const userArgsRaw = context.invocation?.args || "";
|
|
52123
52389
|
if (!prompt.includes(SHELL_INJECTION_TRIGGER)) {
|
|
52124
52390
|
return [
|
|
52125
|
-
{
|
|
52391
|
+
{
|
|
52392
|
+
text: prompt.replaceAll(
|
|
52393
|
+
SHORTHAND_ARGS_PLACEHOLDER,
|
|
52394
|
+
() => userArgsRaw
|
|
52395
|
+
)
|
|
52396
|
+
}
|
|
52126
52397
|
];
|
|
52127
52398
|
}
|
|
52128
52399
|
const config = context.services.agentContext?.config;
|
|
@@ -52138,7 +52409,12 @@ var ShellProcessor = class {
|
|
|
52138
52409
|
);
|
|
52139
52410
|
if (injections.length === 0) {
|
|
52140
52411
|
return [
|
|
52141
|
-
{
|
|
52412
|
+
{
|
|
52413
|
+
text: prompt.replaceAll(
|
|
52414
|
+
SHORTHAND_ARGS_PLACEHOLDER,
|
|
52415
|
+
() => userArgsRaw
|
|
52416
|
+
)
|
|
52417
|
+
}
|
|
52142
52418
|
];
|
|
52143
52419
|
}
|
|
52144
52420
|
const { shell: shell2 } = getShellConfiguration();
|
|
@@ -52151,7 +52427,7 @@ var ShellProcessor = class {
|
|
|
52151
52427
|
}
|
|
52152
52428
|
const resolvedCommand = command.replaceAll(
|
|
52153
52429
|
SHORTHAND_ARGS_PLACEHOLDER,
|
|
52154
|
-
userArgsEscaped
|
|
52430
|
+
() => userArgsEscaped
|
|
52155
52431
|
);
|
|
52156
52432
|
return { ...injection, resolvedCommand };
|
|
52157
52433
|
}
|
|
@@ -52190,7 +52466,7 @@ var ShellProcessor = class {
|
|
|
52190
52466
|
const segment = prompt.substring(lastIndex, injection.startIndex);
|
|
52191
52467
|
processedPrompt += segment.replaceAll(
|
|
52192
52468
|
SHORTHAND_ARGS_PLACEHOLDER,
|
|
52193
|
-
userArgsRaw
|
|
52469
|
+
() => userArgsRaw
|
|
52194
52470
|
);
|
|
52195
52471
|
if (injection.resolvedCommand) {
|
|
52196
52472
|
const activeTheme = themeManager.getActiveTheme();
|
|
@@ -52231,7 +52507,7 @@ var ShellProcessor = class {
|
|
|
52231
52507
|
const finalSegment = prompt.substring(lastIndex);
|
|
52232
52508
|
processedPrompt += finalSegment.replaceAll(
|
|
52233
52509
|
SHORTHAND_ARGS_PLACEHOLDER,
|
|
52234
|
-
userArgsRaw
|
|
52510
|
+
() => userArgsRaw
|
|
52235
52511
|
);
|
|
52236
52512
|
return [{ text: processedPrompt }];
|
|
52237
52513
|
}
|
|
@@ -54749,10 +55025,10 @@ function enableFeature(settings, featureName, strategy) {
|
|
|
54749
55025
|
};
|
|
54750
55026
|
}
|
|
54751
55027
|
const modifiedScopes = [];
|
|
54752
|
-
for (const { scope, path:
|
|
55028
|
+
for (const { scope, path: path38 } of foundInDisabledScopes) {
|
|
54753
55029
|
if (isLoadableSettingScope(scope)) {
|
|
54754
55030
|
strategy.enable(settings, scope, featureName);
|
|
54755
|
-
modifiedScopes.push({ scope, path:
|
|
55031
|
+
modifiedScopes.push({ scope, path: path38 });
|
|
54756
55032
|
}
|
|
54757
55033
|
}
|
|
54758
55034
|
return {
|
|
@@ -55243,7 +55519,7 @@ var authCommand = {
|
|
|
55243
55519
|
import process12 from "node:process";
|
|
55244
55520
|
|
|
55245
55521
|
// packages/cli/src/generated/git-commit.ts
|
|
55246
|
-
var GIT_COMMIT_INFO = "
|
|
55522
|
+
var GIT_COMMIT_INFO = "d8f2b28de";
|
|
55247
55523
|
|
|
55248
55524
|
// packages/cli/src/ui/utils/historyExportUtils.ts
|
|
55249
55525
|
import * as fsPromises from "node:fs/promises";
|
|
@@ -59994,7 +60270,7 @@ var RewindViewer = ({
|
|
|
59994
60270
|
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
|
|
59995
60271
|
async function rewindConversation(context, client, recordingService, messageId, newText) {
|
|
59996
60272
|
try {
|
|
59997
|
-
const conversation = recordingService.rewindTo(messageId);
|
|
60273
|
+
const conversation = await (recordingService.rewindToAsync ? recordingService.rewindToAsync(messageId) : recordingService.rewindTo(messageId));
|
|
59998
60274
|
if (!conversation) {
|
|
59999
60275
|
const errorMsg = "Could not fetch conversation file";
|
|
60000
60276
|
debugLogger.error(errorMsg);
|
|
@@ -60002,8 +60278,9 @@ async function rewindConversation(context, client, recordingService, messageId,
|
|
|
60002
60278
|
coreEvents.emitFeedback("error", errorMsg);
|
|
60003
60279
|
return;
|
|
60004
60280
|
}
|
|
60005
|
-
const
|
|
60006
|
-
const
|
|
60281
|
+
const messages = conversation.messages ?? [];
|
|
60282
|
+
const { uiHistory } = convertSessionToHistoryFormats(messages);
|
|
60283
|
+
const clientHistory = convertSessionToClientHistory(messages);
|
|
60007
60284
|
client.setHistory(clientHistory);
|
|
60008
60285
|
client.clearCurrentSequenceModel?.();
|
|
60009
60286
|
const config = context.services.agentContext?.config;
|
|
@@ -60059,75 +60336,80 @@ var rewindCommand = {
|
|
|
60059
60336
|
messageType: "error",
|
|
60060
60337
|
content: "Recording service unavailable"
|
|
60061
60338
|
};
|
|
60062
|
-
const
|
|
60063
|
-
|
|
60064
|
-
|
|
60065
|
-
|
|
60066
|
-
|
|
60067
|
-
|
|
60068
|
-
|
|
60069
|
-
|
|
60070
|
-
|
|
60071
|
-
|
|
60072
|
-
|
|
60339
|
+
const buildRewindActionReturn = (conversation) => {
|
|
60340
|
+
if (!conversation)
|
|
60341
|
+
return {
|
|
60342
|
+
type: "message",
|
|
60343
|
+
messageType: "info",
|
|
60344
|
+
content: "No conversation found."
|
|
60345
|
+
};
|
|
60346
|
+
const hasUserInteractions = (conversation.messages ?? []).some(
|
|
60347
|
+
(msg) => msg.type === "user"
|
|
60348
|
+
);
|
|
60349
|
+
if (!hasUserInteractions) {
|
|
60350
|
+
return {
|
|
60351
|
+
type: "message",
|
|
60352
|
+
messageType: "info",
|
|
60353
|
+
content: "Nothing to rewind to."
|
|
60354
|
+
};
|
|
60355
|
+
}
|
|
60073
60356
|
return {
|
|
60074
|
-
type: "
|
|
60075
|
-
|
|
60076
|
-
|
|
60077
|
-
|
|
60078
|
-
|
|
60079
|
-
|
|
60080
|
-
|
|
60081
|
-
|
|
60082
|
-
|
|
60083
|
-
|
|
60084
|
-
|
|
60085
|
-
|
|
60086
|
-
|
|
60087
|
-
|
|
60088
|
-
|
|
60089
|
-
|
|
60090
|
-
|
|
60091
|
-
|
|
60092
|
-
|
|
60093
|
-
|
|
60094
|
-
|
|
60095
|
-
|
|
60096
|
-
|
|
60097
|
-
|
|
60098
|
-
|
|
60099
|
-
|
|
60100
|
-
|
|
60101
|
-
|
|
60102
|
-
|
|
60103
|
-
|
|
60104
|
-
|
|
60105
|
-
|
|
60106
|
-
|
|
60107
|
-
|
|
60108
|
-
|
|
60109
|
-
|
|
60110
|
-
|
|
60111
|
-
|
|
60112
|
-
|
|
60113
|
-
|
|
60114
|
-
|
|
60115
|
-
|
|
60116
|
-
|
|
60117
|
-
|
|
60118
|
-
|
|
60119
|
-
|
|
60120
|
-
|
|
60121
|
-
newText
|
|
60122
|
-
);
|
|
60123
|
-
return;
|
|
60124
|
-
default:
|
|
60125
|
-
checkExhaustive(outcome);
|
|
60357
|
+
type: "custom_dialog",
|
|
60358
|
+
component: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
60359
|
+
RewindViewer,
|
|
60360
|
+
{
|
|
60361
|
+
conversation,
|
|
60362
|
+
onExit: () => {
|
|
60363
|
+
context.ui.removeComponent();
|
|
60364
|
+
},
|
|
60365
|
+
onRewind: async (messageId, newText, outcome) => {
|
|
60366
|
+
if (outcome !== "cancel" /* Cancel */) {
|
|
60367
|
+
logRewind(config, new RewindEvent(outcome));
|
|
60368
|
+
}
|
|
60369
|
+
switch (outcome) {
|
|
60370
|
+
case "cancel" /* Cancel */:
|
|
60371
|
+
context.ui.removeComponent();
|
|
60372
|
+
return;
|
|
60373
|
+
case "revert_only" /* RevertOnly */:
|
|
60374
|
+
if (conversation) {
|
|
60375
|
+
await revertFileChanges(conversation, messageId);
|
|
60376
|
+
}
|
|
60377
|
+
context.ui.removeComponent();
|
|
60378
|
+
coreEvents.emitFeedback("info", "File changes reverted.");
|
|
60379
|
+
return;
|
|
60380
|
+
case "rewind_and_revert" /* RewindAndRevert */:
|
|
60381
|
+
if (conversation) {
|
|
60382
|
+
await revertFileChanges(conversation, messageId);
|
|
60383
|
+
}
|
|
60384
|
+
await rewindConversation(
|
|
60385
|
+
context,
|
|
60386
|
+
client,
|
|
60387
|
+
recordingService,
|
|
60388
|
+
messageId,
|
|
60389
|
+
newText
|
|
60390
|
+
);
|
|
60391
|
+
return;
|
|
60392
|
+
case "rewind_only" /* RewindOnly */:
|
|
60393
|
+
await rewindConversation(
|
|
60394
|
+
context,
|
|
60395
|
+
client,
|
|
60396
|
+
recordingService,
|
|
60397
|
+
messageId,
|
|
60398
|
+
newText
|
|
60399
|
+
);
|
|
60400
|
+
return;
|
|
60401
|
+
default:
|
|
60402
|
+
checkExhaustive(outcome);
|
|
60403
|
+
}
|
|
60126
60404
|
}
|
|
60127
60405
|
}
|
|
60128
|
-
|
|
60129
|
-
|
|
60406
|
+
)
|
|
60407
|
+
};
|
|
60130
60408
|
};
|
|
60409
|
+
if (recordingService.getConversationAsync) {
|
|
60410
|
+
return recordingService.getConversationAsync().then(buildRewindActionReturn);
|
|
60411
|
+
}
|
|
60412
|
+
return buildRewindActionReturn(recordingService.getConversation());
|
|
60131
60413
|
}
|
|
60132
60414
|
};
|
|
60133
60415
|
|
|
@@ -60161,14 +60443,14 @@ function enableHook(settings, hookName) {
|
|
|
60161
60443
|
}
|
|
60162
60444
|
const modifiedScopes = [];
|
|
60163
60445
|
try {
|
|
60164
|
-
for (const { scope, path:
|
|
60446
|
+
for (const { scope, path: path38 } of foundInDisabledScopes) {
|
|
60165
60447
|
if (isLoadableSettingScope(scope)) {
|
|
60166
60448
|
const currentScopeDisabled = settings.forScope(scope).settings.hooksConfig?.disabled ?? [];
|
|
60167
60449
|
const newDisabled = currentScopeDisabled.filter(
|
|
60168
60450
|
(name) => name !== hookName
|
|
60169
60451
|
);
|
|
60170
60452
|
settings.setValue(scope, "hooksConfig.disabled", newDisabled);
|
|
60171
|
-
modifiedScopes.push({ scope, path:
|
|
60453
|
+
modifiedScopes.push({ scope, path: path38 });
|
|
60172
60454
|
}
|
|
60173
60455
|
}
|
|
60174
60456
|
} catch (error) {
|
|
@@ -60463,7 +60745,7 @@ async function enableAction3(context, args) {
|
|
|
60463
60745
|
}
|
|
60464
60746
|
const feedback = renderHookActionFeedback(
|
|
60465
60747
|
result,
|
|
60466
|
-
(label,
|
|
60748
|
+
(label, path38) => `${label} (${path38})`
|
|
60467
60749
|
);
|
|
60468
60750
|
return {
|
|
60469
60751
|
type: "message",
|
|
@@ -60505,7 +60787,7 @@ async function disableAction3(context, args) {
|
|
|
60505
60787
|
}
|
|
60506
60788
|
const feedback = renderHookActionFeedback(
|
|
60507
60789
|
result,
|
|
60508
|
-
(label,
|
|
60790
|
+
(label, path38) => `${label} (${path38})`
|
|
60509
60791
|
);
|
|
60510
60792
|
return {
|
|
60511
60793
|
type: "message",
|
|
@@ -61059,7 +61341,7 @@ Use /mcp auth <server-name> to authenticate.`
|
|
|
61059
61341
|
type: "info",
|
|
61060
61342
|
text: `Starting OAuth authentication for MCP server '${serverName}'...`
|
|
61061
61343
|
});
|
|
61062
|
-
const { MCPOAuthProvider } = await import("./dist-
|
|
61344
|
+
const { MCPOAuthProvider } = await import("./dist-OSQFIX7F.js");
|
|
61063
61345
|
let oauthConfig = server.oauth;
|
|
61064
61346
|
if (!oauthConfig) {
|
|
61065
61347
|
oauthConfig = { enabled: false };
|
|
@@ -76700,6 +76982,37 @@ var memoryCommand = (_config) => {
|
|
|
76700
76982
|
};
|
|
76701
76983
|
|
|
76702
76984
|
// packages/cli/src/ui/commands/modelCommand.ts
|
|
76985
|
+
function getValidModelNames(context) {
|
|
76986
|
+
const validModels = /* @__PURE__ */ new Set([
|
|
76987
|
+
...Array.from(VALID_GEMINI_MODELS).filter((model) => model !== "none"),
|
|
76988
|
+
...Object.keys(DEFAULT_MODEL_CONFIGS.modelDefinitions ?? {}),
|
|
76989
|
+
GEMINI_MODEL_ALIAS_AUTO,
|
|
76990
|
+
GEMINI_MODEL_ALIAS_PRO,
|
|
76991
|
+
GEMINI_MODEL_ALIAS_FLASH,
|
|
76992
|
+
GEMINI_MODEL_ALIAS_FLASH_LITE,
|
|
76993
|
+
PREVIEW_GEMINI_MODEL_AUTO,
|
|
76994
|
+
DEFAULT_GEMINI_MODEL_AUTO
|
|
76995
|
+
]);
|
|
76996
|
+
const config = context.services.agentContext?.config;
|
|
76997
|
+
const serviceDefinitions = config?.getModelConfigService?.()?.getModelDefinitions?.();
|
|
76998
|
+
if (serviceDefinitions) {
|
|
76999
|
+
for (const model of Object.keys(serviceDefinitions)) {
|
|
77000
|
+
validModels.add(model);
|
|
77001
|
+
}
|
|
77002
|
+
}
|
|
77003
|
+
const modelConfigs = context.services.settings?.merged?.modelConfigs;
|
|
77004
|
+
if (modelConfigs?.customAliases) {
|
|
77005
|
+
for (const alias of Object.keys(modelConfigs.customAliases)) {
|
|
77006
|
+
validModels.add(alias);
|
|
77007
|
+
}
|
|
77008
|
+
}
|
|
77009
|
+
if (modelConfigs?.modelDefinitions) {
|
|
77010
|
+
for (const model of Object.keys(modelConfigs.modelDefinitions)) {
|
|
77011
|
+
validModels.add(model);
|
|
77012
|
+
}
|
|
77013
|
+
}
|
|
77014
|
+
return validModels;
|
|
77015
|
+
}
|
|
76703
77016
|
var setModelCommand = {
|
|
76704
77017
|
name: "set",
|
|
76705
77018
|
description: "Set the model to use. Usage: /model set <model-name> [--persist]",
|
|
@@ -76707,15 +77020,24 @@ var setModelCommand = {
|
|
|
76707
77020
|
autoExecute: false,
|
|
76708
77021
|
action: async (context, args) => {
|
|
76709
77022
|
const parts = args.trim().split(/\s+/).filter(Boolean);
|
|
76710
|
-
|
|
77023
|
+
const persist = parts.includes("--persist");
|
|
77024
|
+
const nonFlagParts = parts.filter((part) => part !== "--persist");
|
|
77025
|
+
if (nonFlagParts.length === 0) {
|
|
76711
77026
|
context.ui.addItem({
|
|
76712
77027
|
type: "error" /* ERROR */,
|
|
76713
77028
|
text: "Usage: /model set <model-name> [--persist]"
|
|
76714
77029
|
});
|
|
76715
77030
|
return;
|
|
76716
77031
|
}
|
|
76717
|
-
const modelName =
|
|
76718
|
-
const
|
|
77032
|
+
const modelName = nonFlagParts[0];
|
|
77033
|
+
const validModels = getValidModelNames(context);
|
|
77034
|
+
if (!validModels.has(modelName)) {
|
|
77035
|
+
context.ui.addItem({
|
|
77036
|
+
type: "error" /* ERROR */,
|
|
77037
|
+
text: `Invalid model "${modelName}". Run /model to view and select from available models.`
|
|
77038
|
+
});
|
|
77039
|
+
return;
|
|
77040
|
+
}
|
|
76719
77041
|
if (context.services.agentContext?.config) {
|
|
76720
77042
|
context.services.agentContext.config.setModel(modelName, !persist);
|
|
76721
77043
|
const event = new ModelSlashCommandEvent(modelName);
|
|
@@ -76725,6 +77047,10 @@ var setModelCommand = {
|
|
|
76725
77047
|
text: `Model set to ${modelName}${persist ? " (persisted)" : ""}`
|
|
76726
77048
|
});
|
|
76727
77049
|
}
|
|
77050
|
+
},
|
|
77051
|
+
completion: async (context, partialArg) => {
|
|
77052
|
+
const validModels = Array.from(getValidModelNames(context));
|
|
77053
|
+
return validModels.filter((model) => model.startsWith(partialArg));
|
|
76728
77054
|
}
|
|
76729
77055
|
};
|
|
76730
77056
|
var manageModelCommand = {
|
|
@@ -76748,7 +77074,12 @@ var modelCommand = {
|
|
|
76748
77074
|
kind: "built-in" /* BUILT_IN */,
|
|
76749
77075
|
autoExecute: false,
|
|
76750
77076
|
subCommands: [manageModelCommand, setModelCommand],
|
|
76751
|
-
action: async (context, args) =>
|
|
77077
|
+
action: async (context, args) => {
|
|
77078
|
+
if (args.trim().length > 0) {
|
|
77079
|
+
return setModelCommand.action?.(context, args);
|
|
77080
|
+
}
|
|
77081
|
+
return manageModelCommand.action?.(context, args);
|
|
77082
|
+
}
|
|
76752
77083
|
};
|
|
76753
77084
|
|
|
76754
77085
|
// packages/cli/src/ui/components/triage/TriageDuplicates.tsx
|
|
@@ -78670,6 +79001,7 @@ var resumeCommand = {
|
|
|
78670
79001
|
};
|
|
78671
79002
|
|
|
78672
79003
|
// packages/cli/src/ui/commands/statsCommand.ts
|
|
79004
|
+
import path35 from "node:path";
|
|
78673
79005
|
function getUserIdentity(context) {
|
|
78674
79006
|
const selectedAuthType = context.services.settings.merged.security.auth.selectedType || "";
|
|
78675
79007
|
const userAccountManager = new UserAccountManager();
|
|
@@ -78716,14 +79048,56 @@ async function defaultSessionView(context) {
|
|
|
78716
79048
|
}
|
|
78717
79049
|
context.ui.addItem(statsItem);
|
|
78718
79050
|
}
|
|
79051
|
+
async function heatmapView(context, rawArgs) {
|
|
79052
|
+
const now = /* @__PURE__ */ new Date();
|
|
79053
|
+
const parsedDate = resolveHeatmapDateArg(rawArgs, now);
|
|
79054
|
+
if (!parsedDate.ok) {
|
|
79055
|
+
context.ui.addItem({
|
|
79056
|
+
type: "error" /* ERROR */,
|
|
79057
|
+
text: parsedDate.error
|
|
79058
|
+
});
|
|
79059
|
+
return;
|
|
79060
|
+
}
|
|
79061
|
+
let chatsDir = "";
|
|
79062
|
+
try {
|
|
79063
|
+
const projectTempDir = context.services.agentContext?.config?.storage?.getProjectTempDir();
|
|
79064
|
+
if (projectTempDir) {
|
|
79065
|
+
chatsDir = path35.join(projectTempDir, "chats");
|
|
79066
|
+
}
|
|
79067
|
+
} catch {
|
|
79068
|
+
chatsDir = "";
|
|
79069
|
+
}
|
|
79070
|
+
const dataset = await aggregateUsageFromRecordings(
|
|
79071
|
+
chatsDir,
|
|
79072
|
+
DEFAULT_HEATMAP_WINDOW_DAYS,
|
|
79073
|
+
now
|
|
79074
|
+
);
|
|
79075
|
+
const heatmapItem = {
|
|
79076
|
+
type: "heatmap_stats" /* HEATMAP_STATS */,
|
|
79077
|
+
dailyUsage: Object.fromEntries(dataset.dailyUsage),
|
|
79078
|
+
totalWindowTokens: dataset.totalWindowTokens,
|
|
79079
|
+
totalWindowSessions: dataset.totalWindowSessions,
|
|
79080
|
+
totalWindowTurns: dataset.totalWindowTurns,
|
|
79081
|
+
currentStreak: dataset.currentStreak,
|
|
79082
|
+
longestStreak: dataset.longestStreak,
|
|
79083
|
+
today: formatLocalDateKey(now),
|
|
79084
|
+
selectedDate: parsedDate.date
|
|
79085
|
+
};
|
|
79086
|
+
context.ui.addItem(heatmapItem);
|
|
79087
|
+
}
|
|
78719
79088
|
var statsCommand = {
|
|
78720
79089
|
name: "stats",
|
|
78721
79090
|
altNames: ["usage"],
|
|
78722
|
-
description: "Check session stats. Usage: /stats [session|model|tools]",
|
|
79091
|
+
description: "Check session stats. Usage: /stats [session|model|tools|heatmap]",
|
|
78723
79092
|
kind: "built-in" /* BUILT_IN */,
|
|
78724
79093
|
autoExecute: false,
|
|
78725
79094
|
isSafeConcurrent: true,
|
|
78726
|
-
action: async (context) => {
|
|
79095
|
+
action: async (context, args) => {
|
|
79096
|
+
const trimmed = (args ?? "").trim();
|
|
79097
|
+
if (trimmed === "heatmap" || trimmed.startsWith("heatmap ")) {
|
|
79098
|
+
await heatmapView(context, trimmed.slice("heatmap".length));
|
|
79099
|
+
return;
|
|
79100
|
+
}
|
|
78727
79101
|
await defaultSessionView(context);
|
|
78728
79102
|
},
|
|
78729
79103
|
subCommands: [
|
|
@@ -78772,6 +79146,21 @@ var statsCommand = {
|
|
|
78772
79146
|
type: "tool_stats" /* TOOL_STATS */
|
|
78773
79147
|
});
|
|
78774
79148
|
}
|
|
79149
|
+
},
|
|
79150
|
+
{
|
|
79151
|
+
name: "heatmap",
|
|
79152
|
+
description: "Show calendar heatmap of daily token usage. Usage: /stats heatmap [today|yesterday|YYYY-MM-DD]",
|
|
79153
|
+
kind: "built-in" /* BUILT_IN */,
|
|
79154
|
+
autoExecute: true,
|
|
79155
|
+
isSafeConcurrent: true,
|
|
79156
|
+
showCompletionLoading: false,
|
|
79157
|
+
completion: (_context, partialArg) => {
|
|
79158
|
+
const prefix = partialArg.trim().toLowerCase();
|
|
79159
|
+
return ["today", "yesterday"].filter((opt) => opt.startsWith(prefix));
|
|
79160
|
+
},
|
|
79161
|
+
action: async (context, args) => {
|
|
79162
|
+
await heatmapView(context, args);
|
|
79163
|
+
}
|
|
78775
79164
|
}
|
|
78776
79165
|
]
|
|
78777
79166
|
};
|
|
@@ -78889,7 +79278,7 @@ function disableSkill(settings, skillName, scope) {
|
|
|
78889
79278
|
// packages/cli/src/utils/skillUtils.ts
|
|
78890
79279
|
var import_extract_zip2 = __toESM(require_extract_zip(), 1);
|
|
78891
79280
|
import * as fs31 from "node:fs/promises";
|
|
78892
|
-
import * as
|
|
79281
|
+
import * as path36 from "node:path";
|
|
78893
79282
|
import * as os7 from "node:os";
|
|
78894
79283
|
function renderSkillActionFeedback(result, formatScope) {
|
|
78895
79284
|
const { skillName, action, status, error } = result;
|
|
@@ -78923,7 +79312,7 @@ function renderSkillActionFeedback(result, formatScope) {
|
|
|
78923
79312
|
return `Skill "${skillName}" ${actionVerb} ${preposition} ${s3} settings.`;
|
|
78924
79313
|
}
|
|
78925
79314
|
function isPathTraversal(relative3) {
|
|
78926
|
-
return relative3 === ".." || relative3.startsWith(".." +
|
|
79315
|
+
return relative3 === ".." || relative3.startsWith(".." + path36.sep) || path36.isAbsolute(relative3);
|
|
78927
79316
|
}
|
|
78928
79317
|
function isInvalidSubpath(relative3) {
|
|
78929
79318
|
return relative3 === "" || isPathTraversal(relative3);
|
|
@@ -78936,7 +79325,7 @@ async function installSkill(source2, scope, subpath, onLog, requestConsent = ()
|
|
|
78936
79325
|
try {
|
|
78937
79326
|
if (isGitUrl) {
|
|
78938
79327
|
tempDirToClean = await fs31.mkdtemp(
|
|
78939
|
-
|
|
79328
|
+
path36.join(os7.tmpdir(), "gemini-skill-")
|
|
78940
79329
|
);
|
|
78941
79330
|
sourcePath = tempDirToClean;
|
|
78942
79331
|
onLog(`Cloning skill from ${source2}...`);
|
|
@@ -78949,19 +79338,19 @@ async function installSkill(source2, scope, subpath, onLog, requestConsent = ()
|
|
|
78949
79338
|
);
|
|
78950
79339
|
} else if (isSkillFile) {
|
|
78951
79340
|
tempDirToClean = await fs31.mkdtemp(
|
|
78952
|
-
|
|
79341
|
+
path36.join(os7.tmpdir(), "gemini-skill-")
|
|
78953
79342
|
);
|
|
78954
79343
|
sourcePath = tempDirToClean;
|
|
78955
79344
|
onLog(`Extracting skill from ${source2}...`);
|
|
78956
|
-
await (0, import_extract_zip2.default)(
|
|
79345
|
+
await (0, import_extract_zip2.default)(path36.resolve(source2), { dir: tempDirToClean });
|
|
78957
79346
|
}
|
|
78958
79347
|
if (subpath) {
|
|
78959
|
-
sourcePath =
|
|
79348
|
+
sourcePath = path36.join(sourcePath, subpath);
|
|
78960
79349
|
}
|
|
78961
|
-
sourcePath =
|
|
79350
|
+
sourcePath = path36.resolve(sourcePath);
|
|
78962
79351
|
if (tempDirToClean) {
|
|
78963
|
-
const resolvedTemp =
|
|
78964
|
-
const relative3 =
|
|
79352
|
+
const resolvedTemp = path36.resolve(tempDirToClean);
|
|
79353
|
+
const relative3 = path36.relative(resolvedTemp, sourcePath);
|
|
78965
79354
|
if (isPathTraversal(relative3)) {
|
|
78966
79355
|
throw new Error("Invalid path: Directory traversal not allowed.");
|
|
78967
79356
|
}
|
|
@@ -78979,14 +79368,14 @@ async function installSkill(source2, scope, subpath, onLog, requestConsent = ()
|
|
|
78979
79368
|
if (!await requestConsent(skills, targetDir)) {
|
|
78980
79369
|
throw new Error("Skill installation cancelled by user.");
|
|
78981
79370
|
}
|
|
78982
|
-
const resolvedTarget =
|
|
79371
|
+
const resolvedTarget = path36.resolve(targetDir);
|
|
78983
79372
|
await fs31.mkdir(resolvedTarget, { recursive: true });
|
|
78984
79373
|
const installedSkills = [];
|
|
78985
79374
|
for (const skill of skills) {
|
|
78986
79375
|
const skillName = skill.name;
|
|
78987
|
-
const skillDir =
|
|
78988
|
-
const destPath =
|
|
78989
|
-
const relative3 =
|
|
79376
|
+
const skillDir = path36.dirname(skill.location);
|
|
79377
|
+
const destPath = path36.resolve(resolvedTarget, skillName);
|
|
79378
|
+
const relative3 = path36.relative(resolvedTarget, destPath);
|
|
78990
79379
|
if (isInvalidSubpath(relative3)) {
|
|
78991
79380
|
throw new Error("Invalid skill name: Path traversal detected.");
|
|
78992
79381
|
}
|
|
@@ -79006,7 +79395,7 @@ async function installSkill(source2, scope, subpath, onLog, requestConsent = ()
|
|
|
79006
79395
|
}
|
|
79007
79396
|
}
|
|
79008
79397
|
async function linkSkill(source2, scope, onLog, requestConsent = () => Promise.resolve(true)) {
|
|
79009
|
-
const sourcePath =
|
|
79398
|
+
const sourcePath = path36.resolve(source2);
|
|
79010
79399
|
onLog(`Searching for skills in ${sourcePath}...`);
|
|
79011
79400
|
const skills = await loadSkillsFromDir(sourcePath);
|
|
79012
79401
|
if (skills.length === 0) {
|
|
@@ -79031,14 +79420,14 @@ async function linkSkill(source2, scope, onLog, requestConsent = () => Promise.r
|
|
|
79031
79420
|
if (!await requestConsent(skills, targetDir)) {
|
|
79032
79421
|
throw new Error("Skill linking cancelled by user.");
|
|
79033
79422
|
}
|
|
79034
|
-
const resolvedTarget =
|
|
79423
|
+
const resolvedTarget = path36.resolve(targetDir);
|
|
79035
79424
|
await fs31.mkdir(resolvedTarget, { recursive: true });
|
|
79036
79425
|
const linkedSkills = [];
|
|
79037
79426
|
for (const skill of skills) {
|
|
79038
79427
|
const skillName = skill.name;
|
|
79039
|
-
const skillSourceDir =
|
|
79040
|
-
const destPath =
|
|
79041
|
-
const relative3 =
|
|
79428
|
+
const skillSourceDir = path36.dirname(skill.location);
|
|
79429
|
+
const destPath = path36.resolve(resolvedTarget, skillName);
|
|
79430
|
+
const relative3 = path36.relative(resolvedTarget, destPath);
|
|
79042
79431
|
if (isInvalidSubpath(relative3)) {
|
|
79043
79432
|
throw new Error("Invalid skill name: Path traversal detected.");
|
|
79044
79433
|
}
|
|
@@ -79062,12 +79451,12 @@ async function uninstallSkill(name, scope) {
|
|
|
79062
79451
|
const workspaceDir = process.cwd();
|
|
79063
79452
|
const storage = new Storage(workspaceDir);
|
|
79064
79453
|
const targetDir = scope === "workspace" ? storage.getProjectSkillsDir() : Storage.getUserSkillsDir();
|
|
79065
|
-
const resolvedTarget =
|
|
79454
|
+
const resolvedTarget = path36.resolve(targetDir);
|
|
79066
79455
|
const discoveredSkills = await loadSkillsFromDir(resolvedTarget);
|
|
79067
79456
|
const skillToUninstall = discoveredSkills.find((s3) => s3.name === name);
|
|
79068
79457
|
if (!skillToUninstall) {
|
|
79069
|
-
const skillPath =
|
|
79070
|
-
const relative4 =
|
|
79458
|
+
const skillPath = path36.resolve(resolvedTarget, name);
|
|
79459
|
+
const relative4 = path36.relative(resolvedTarget, skillPath);
|
|
79071
79460
|
if (isInvalidSubpath(relative4)) {
|
|
79072
79461
|
return null;
|
|
79073
79462
|
}
|
|
@@ -79078,8 +79467,8 @@ async function uninstallSkill(name, scope) {
|
|
|
79078
79467
|
await fs31.rm(skillPath, { recursive: true, force: true });
|
|
79079
79468
|
return { location: skillPath };
|
|
79080
79469
|
}
|
|
79081
|
-
const skillDir =
|
|
79082
|
-
const relative3 =
|
|
79470
|
+
const skillDir = path36.resolve(path36.dirname(skillToUninstall.location));
|
|
79471
|
+
const relative3 = path36.relative(resolvedTarget, skillDir);
|
|
79083
79472
|
if (isInvalidSubpath(relative3)) {
|
|
79084
79473
|
return null;
|
|
79085
79474
|
}
|
|
@@ -79213,7 +79602,7 @@ async function disableAction4(context, args) {
|
|
|
79213
79602
|
const result = disableSkill(context.services.settings, skillName, scope);
|
|
79214
79603
|
let feedback = renderSkillActionFeedback(
|
|
79215
79604
|
result,
|
|
79216
|
-
(label,
|
|
79605
|
+
(label, path38) => `${label} (${path38})`
|
|
79217
79606
|
);
|
|
79218
79607
|
if (result.status === "success" || result.status === "no-op") {
|
|
79219
79608
|
feedback += ' You can run "/skills reload" to refresh your current instance.';
|
|
@@ -79249,7 +79638,7 @@ async function enableAction4(context, args) {
|
|
|
79249
79638
|
const result = enableSkill(context.services.settings, skillName);
|
|
79250
79639
|
let feedback = renderSkillActionFeedback(
|
|
79251
79640
|
result,
|
|
79252
|
-
(label,
|
|
79641
|
+
(label, path38) => `${label} (${path38})`
|
|
79253
79642
|
);
|
|
79254
79643
|
if (result.status === "success" || result.status === "no-op") {
|
|
79255
79644
|
feedback += ' You can run "/skills reload" to refresh your current instance.';
|
|
@@ -79440,7 +79829,7 @@ var vimCommand = {
|
|
|
79440
79829
|
|
|
79441
79830
|
// packages/cli/src/ui/commands/setupGithubCommand.ts
|
|
79442
79831
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
79443
|
-
import
|
|
79832
|
+
import path37 from "node:path";
|
|
79444
79833
|
import * as fs32 from "node:fs";
|
|
79445
79834
|
import { Writable } from "node:stream";
|
|
79446
79835
|
|
|
@@ -79570,7 +79959,7 @@ function getOpenUrlsCommands(readmeUrl) {
|
|
|
79570
79959
|
}
|
|
79571
79960
|
async function updateGitignore(gitRepoRoot) {
|
|
79572
79961
|
const gitignoreEntries = [".gemini/", "gha-creds-*.json"];
|
|
79573
|
-
const gitignorePath =
|
|
79962
|
+
const gitignorePath = path37.join(gitRepoRoot, ".gitignore");
|
|
79574
79963
|
try {
|
|
79575
79964
|
let existingContent = "";
|
|
79576
79965
|
let fileExists2 = true;
|
|
@@ -79625,9 +80014,9 @@ async function downloadFiles({
|
|
|
79625
80014
|
`Empty body while downloading ${endpoint}: ${response.status} - ${response.statusText}`
|
|
79626
80015
|
);
|
|
79627
80016
|
}
|
|
79628
|
-
const destination =
|
|
80017
|
+
const destination = path37.resolve(
|
|
79629
80018
|
targetDir,
|
|
79630
|
-
|
|
80019
|
+
path37.basename(fileBasename)
|
|
79631
80020
|
);
|
|
79632
80021
|
const fileStream = fs32.createWriteStream(destination, {
|
|
79633
80022
|
mode: 420,
|
|
@@ -79700,9 +80089,9 @@ var setupGithubCommand = {
|
|
|
79700
80089
|
const proxy = context?.services?.agentContext?.config.getProxy();
|
|
79701
80090
|
const releaseTag = await getLatestGitHubRelease(proxy);
|
|
79702
80091
|
const readmeUrl = `https://github.com/google-github-actions/run-gemini-cli/blob/${releaseTag}/README.md#quick-start`;
|
|
79703
|
-
const workflowsDir =
|
|
80092
|
+
const workflowsDir = path37.join(gitRepoRoot, ".github", "workflows");
|
|
79704
80093
|
await createDirectory(workflowsDir);
|
|
79705
|
-
const commandsDir =
|
|
80094
|
+
const commandsDir = path37.join(gitRepoRoot, ".github", "commands");
|
|
79706
80095
|
await createDirectory(commandsDir);
|
|
79707
80096
|
await downloadSetupFiles({
|
|
79708
80097
|
configs: [
|