@google/gemini-cli-a2a-server 0.23.0-preview.3 → 0.24.0-nightly.20251227.37be16243
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/dist/a2a-server.mjs +847 -630
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/a2a-server.mjs
CHANGED
|
@@ -8766,15 +8766,15 @@ var require_file = __commonJS({
|
|
|
8766
8766
|
_incFile(callback) {
|
|
8767
8767
|
debug2("_incFile", this.filename);
|
|
8768
8768
|
const ext2 = path75.extname(this._basename);
|
|
8769
|
-
const
|
|
8769
|
+
const basename14 = path75.basename(this._basename, ext2);
|
|
8770
8770
|
const tasks = [];
|
|
8771
8771
|
if (this.zippedArchive) {
|
|
8772
8772
|
tasks.push(
|
|
8773
8773
|
function(cb) {
|
|
8774
8774
|
const num = this._created > 0 && !this.tailable ? this._created : "";
|
|
8775
8775
|
this._compressFile(
|
|
8776
|
-
path75.join(this.dirname, `${
|
|
8777
|
-
path75.join(this.dirname, `${
|
|
8776
|
+
path75.join(this.dirname, `${basename14}${num}${ext2}`),
|
|
8777
|
+
path75.join(this.dirname, `${basename14}${num}${ext2}.gz`),
|
|
8778
8778
|
cb
|
|
8779
8779
|
);
|
|
8780
8780
|
}.bind(this)
|
|
@@ -8784,9 +8784,9 @@ var require_file = __commonJS({
|
|
|
8784
8784
|
function(cb) {
|
|
8785
8785
|
if (!this.tailable) {
|
|
8786
8786
|
this._created += 1;
|
|
8787
|
-
this._checkMaxFilesIncrementing(ext2,
|
|
8787
|
+
this._checkMaxFilesIncrementing(ext2, basename14, cb);
|
|
8788
8788
|
} else {
|
|
8789
|
-
this._checkMaxFilesTailable(ext2,
|
|
8789
|
+
this._checkMaxFilesTailable(ext2, basename14, cb);
|
|
8790
8790
|
}
|
|
8791
8791
|
}.bind(this)
|
|
8792
8792
|
);
|
|
@@ -8800,9 +8800,9 @@ var require_file = __commonJS({
|
|
|
8800
8800
|
*/
|
|
8801
8801
|
_getFile() {
|
|
8802
8802
|
const ext2 = path75.extname(this._basename);
|
|
8803
|
-
const
|
|
8803
|
+
const basename14 = path75.basename(this._basename, ext2);
|
|
8804
8804
|
const isRotation = this.rotationFormat ? this.rotationFormat() : this._created;
|
|
8805
|
-
return !this.tailable && this._created ? `${
|
|
8805
|
+
return !this.tailable && this._created ? `${basename14}${isRotation}${ext2}` : `${basename14}${ext2}`;
|
|
8806
8806
|
}
|
|
8807
8807
|
/**
|
|
8808
8808
|
* Increment the number of files created or checked by this instance.
|
|
@@ -8812,14 +8812,14 @@ var require_file = __commonJS({
|
|
|
8812
8812
|
* @returns {undefined}
|
|
8813
8813
|
* @private
|
|
8814
8814
|
*/
|
|
8815
|
-
_checkMaxFilesIncrementing(ext2,
|
|
8815
|
+
_checkMaxFilesIncrementing(ext2, basename14, callback) {
|
|
8816
8816
|
if (!this.maxFiles || this._created < this.maxFiles) {
|
|
8817
8817
|
return setImmediate(callback);
|
|
8818
8818
|
}
|
|
8819
8819
|
const oldest = this._created - this.maxFiles;
|
|
8820
8820
|
const isOldest = oldest !== 0 ? oldest : "";
|
|
8821
8821
|
const isZipped = this.zippedArchive ? ".gz" : "";
|
|
8822
|
-
const filePath = `${
|
|
8822
|
+
const filePath = `${basename14}${isOldest}${ext2}${isZipped}`;
|
|
8823
8823
|
const target = path75.join(this.dirname, filePath);
|
|
8824
8824
|
fs66.unlink(target, callback);
|
|
8825
8825
|
}
|
|
@@ -8834,7 +8834,7 @@ var require_file = __commonJS({
|
|
|
8834
8834
|
* @returns {undefined}
|
|
8835
8835
|
* @private
|
|
8836
8836
|
*/
|
|
8837
|
-
_checkMaxFilesTailable(ext2,
|
|
8837
|
+
_checkMaxFilesTailable(ext2, basename14, callback) {
|
|
8838
8838
|
const tasks = [];
|
|
8839
8839
|
if (!this.maxFiles) {
|
|
8840
8840
|
return;
|
|
@@ -8842,21 +8842,21 @@ var require_file = __commonJS({
|
|
|
8842
8842
|
const isZipped = this.zippedArchive ? ".gz" : "";
|
|
8843
8843
|
for (let x2 = this.maxFiles - 1; x2 > 1; x2--) {
|
|
8844
8844
|
tasks.push(function(i4, cb) {
|
|
8845
|
-
let fileName = `${
|
|
8845
|
+
let fileName = `${basename14}${i4 - 1}${ext2}${isZipped}`;
|
|
8846
8846
|
const tmppath = path75.join(this.dirname, fileName);
|
|
8847
8847
|
fs66.exists(tmppath, (exists2) => {
|
|
8848
8848
|
if (!exists2) {
|
|
8849
8849
|
return cb(null);
|
|
8850
8850
|
}
|
|
8851
|
-
fileName = `${
|
|
8851
|
+
fileName = `${basename14}${i4}${ext2}${isZipped}`;
|
|
8852
8852
|
fs66.rename(tmppath, path75.join(this.dirname, fileName), cb);
|
|
8853
8853
|
});
|
|
8854
8854
|
}.bind(this, x2));
|
|
8855
8855
|
}
|
|
8856
8856
|
asyncSeries(tasks, () => {
|
|
8857
8857
|
fs66.rename(
|
|
8858
|
-
path75.join(this.dirname, `${
|
|
8859
|
-
path75.join(this.dirname, `${
|
|
8858
|
+
path75.join(this.dirname, `${basename14}${ext2}${isZipped}`),
|
|
8859
|
+
path75.join(this.dirname, `${basename14}1${ext2}${isZipped}`),
|
|
8860
8860
|
callback
|
|
8861
8861
|
);
|
|
8862
8862
|
});
|
|
@@ -33263,8 +33263,8 @@ var require_view = __commonJS({
|
|
|
33263
33263
|
var debug2 = require_src()("express:view");
|
|
33264
33264
|
var path75 = __require("node:path");
|
|
33265
33265
|
var fs66 = __require("node:fs");
|
|
33266
|
-
var
|
|
33267
|
-
var
|
|
33266
|
+
var dirname18 = path75.dirname;
|
|
33267
|
+
var basename14 = path75.basename;
|
|
33268
33268
|
var extname3 = path75.extname;
|
|
33269
33269
|
var join29 = path75.join;
|
|
33270
33270
|
var resolve14 = path75.resolve;
|
|
@@ -33302,8 +33302,8 @@ var require_view = __commonJS({
|
|
|
33302
33302
|
for (var i4 = 0; i4 < roots.length && !path76; i4++) {
|
|
33303
33303
|
var root = roots[i4];
|
|
33304
33304
|
var loc = resolve14(root, name4);
|
|
33305
|
-
var dir =
|
|
33306
|
-
var file =
|
|
33305
|
+
var dir = dirname18(loc);
|
|
33306
|
+
var file = basename14(loc);
|
|
33307
33307
|
path76 = this.resolve(dir, file);
|
|
33308
33308
|
}
|
|
33309
33309
|
return path76;
|
|
@@ -33333,7 +33333,7 @@ var require_view = __commonJS({
|
|
|
33333
33333
|
if (stat3 && stat3.isFile()) {
|
|
33334
33334
|
return path76;
|
|
33335
33335
|
}
|
|
33336
|
-
path76 = join29(dir,
|
|
33336
|
+
path76 = join29(dir, basename14(file, ext2), "index" + ext2);
|
|
33337
33337
|
stat3 = tryStat(path76);
|
|
33338
33338
|
if (stat3 && stat3.isFile()) {
|
|
33339
33339
|
return path76;
|
|
@@ -36625,7 +36625,7 @@ var require_content_disposition = __commonJS({
|
|
|
36625
36625
|
"use strict";
|
|
36626
36626
|
module2.exports = contentDisposition;
|
|
36627
36627
|
module2.exports.parse = parse10;
|
|
36628
|
-
var
|
|
36628
|
+
var basename14 = __require("path").basename;
|
|
36629
36629
|
var Buffer11 = require_safe_buffer().Buffer;
|
|
36630
36630
|
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
|
|
36631
36631
|
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
|
|
@@ -36661,9 +36661,9 @@ var require_content_disposition = __commonJS({
|
|
|
36661
36661
|
if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
|
|
36662
36662
|
throw new TypeError("fallback must be ISO-8859-1 string");
|
|
36663
36663
|
}
|
|
36664
|
-
var name4 =
|
|
36664
|
+
var name4 = basename14(filename);
|
|
36665
36665
|
var isQuotedString = TEXT_REGEXP.test(name4);
|
|
36666
|
-
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name4) :
|
|
36666
|
+
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name4) : basename14(fallback);
|
|
36667
36667
|
var hasFallback = typeof fallbackName === "string" && fallbackName !== name4;
|
|
36668
36668
|
if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name4)) {
|
|
36669
36669
|
params["filename*"] = name4;
|
|
@@ -45813,8 +45813,8 @@ var require_view2 = __commonJS({
|
|
|
45813
45813
|
var debug2 = require_src4()("express:view");
|
|
45814
45814
|
var path75 = __require("path");
|
|
45815
45815
|
var fs66 = __require("fs");
|
|
45816
|
-
var
|
|
45817
|
-
var
|
|
45816
|
+
var dirname18 = path75.dirname;
|
|
45817
|
+
var basename14 = path75.basename;
|
|
45818
45818
|
var extname3 = path75.extname;
|
|
45819
45819
|
var join29 = path75.join;
|
|
45820
45820
|
var resolve14 = path75.resolve;
|
|
@@ -45852,8 +45852,8 @@ var require_view2 = __commonJS({
|
|
|
45852
45852
|
for (var i4 = 0; i4 < roots.length && !path76; i4++) {
|
|
45853
45853
|
var root = roots[i4];
|
|
45854
45854
|
var loc = resolve14(root, name4);
|
|
45855
|
-
var dir =
|
|
45856
|
-
var file =
|
|
45855
|
+
var dir = dirname18(loc);
|
|
45856
|
+
var file = basename14(loc);
|
|
45857
45857
|
path76 = this.resolve(dir, file);
|
|
45858
45858
|
}
|
|
45859
45859
|
return path76;
|
|
@@ -45869,7 +45869,7 @@ var require_view2 = __commonJS({
|
|
|
45869
45869
|
if (stat3 && stat3.isFile()) {
|
|
45870
45870
|
return path76;
|
|
45871
45871
|
}
|
|
45872
|
-
path76 = join29(dir,
|
|
45872
|
+
path76 = join29(dir, basename14(file, ext2), "index" + ext2);
|
|
45873
45873
|
stat3 = tryStat(path76);
|
|
45874
45874
|
if (stat3 && stat3.isFile()) {
|
|
45875
45875
|
return path76;
|
|
@@ -45892,7 +45892,7 @@ var require_content_disposition2 = __commonJS({
|
|
|
45892
45892
|
"use strict";
|
|
45893
45893
|
module2.exports = contentDisposition;
|
|
45894
45894
|
module2.exports.parse = parse10;
|
|
45895
|
-
var
|
|
45895
|
+
var basename14 = __require("path").basename;
|
|
45896
45896
|
var Buffer11 = require_safe_buffer().Buffer;
|
|
45897
45897
|
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
|
|
45898
45898
|
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
|
|
@@ -45928,9 +45928,9 @@ var require_content_disposition2 = __commonJS({
|
|
|
45928
45928
|
if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
|
|
45929
45929
|
throw new TypeError("fallback must be ISO-8859-1 string");
|
|
45930
45930
|
}
|
|
45931
|
-
var name4 =
|
|
45931
|
+
var name4 = basename14(filename);
|
|
45932
45932
|
var isQuotedString = TEXT_REGEXP.test(name4);
|
|
45933
|
-
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name4) :
|
|
45933
|
+
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name4) : basename14(fallback);
|
|
45934
45934
|
var hasFallback = typeof fallbackName === "string" && fallbackName !== name4;
|
|
45935
45935
|
if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name4)) {
|
|
45936
45936
|
params["filename*"] = name4;
|
|
@@ -68416,8 +68416,8 @@ var require_graceful_fs = __commonJS({
|
|
|
68416
68416
|
}
|
|
68417
68417
|
}
|
|
68418
68418
|
var fs$writeFile = fs67.writeFile;
|
|
68419
|
-
fs67.writeFile =
|
|
68420
|
-
function
|
|
68419
|
+
fs67.writeFile = writeFile5;
|
|
68420
|
+
function writeFile5(path75, data, options2, cb) {
|
|
68421
68421
|
if (typeof options2 === "function")
|
|
68422
68422
|
cb = options2, options2 = null;
|
|
68423
68423
|
return go$writeFile(path75, data, options2, cb);
|
|
@@ -69769,7 +69769,7 @@ var require_jsonfile = __commonJS({
|
|
|
69769
69769
|
return obj;
|
|
69770
69770
|
}
|
|
69771
69771
|
var readFile8 = universalify.fromPromise(_readFile);
|
|
69772
|
-
function
|
|
69772
|
+
function readFileSync10(file, options2 = {}) {
|
|
69773
69773
|
if (typeof options2 === "string") {
|
|
69774
69774
|
options2 = { encoding: options2 };
|
|
69775
69775
|
}
|
|
@@ -69793,17 +69793,17 @@ var require_jsonfile = __commonJS({
|
|
|
69793
69793
|
const str = stringify5(obj, options2);
|
|
69794
69794
|
await universalify.fromCallback(fs66.writeFile)(file, str, options2);
|
|
69795
69795
|
}
|
|
69796
|
-
var
|
|
69797
|
-
function
|
|
69796
|
+
var writeFile5 = universalify.fromPromise(_writeFile);
|
|
69797
|
+
function writeFileSync6(file, obj, options2 = {}) {
|
|
69798
69798
|
const fs66 = options2.fs || _fs;
|
|
69799
69799
|
const str = stringify5(obj, options2);
|
|
69800
69800
|
return fs66.writeFileSync(file, str, options2);
|
|
69801
69801
|
}
|
|
69802
69802
|
module2.exports = {
|
|
69803
69803
|
readFile: readFile8,
|
|
69804
|
-
readFileSync:
|
|
69805
|
-
writeFile:
|
|
69806
|
-
writeFileSync:
|
|
69804
|
+
readFileSync: readFileSync10,
|
|
69805
|
+
writeFile: writeFile5,
|
|
69806
|
+
writeFileSync: writeFileSync6
|
|
69807
69807
|
};
|
|
69808
69808
|
}
|
|
69809
69809
|
});
|
|
@@ -153014,8 +153014,8 @@ var require_sync = __commonJS({
|
|
|
153014
153014
|
}
|
|
153015
153015
|
return x2;
|
|
153016
153016
|
};
|
|
153017
|
-
var defaultReadPackageSync = function defaultReadPackageSync2(
|
|
153018
|
-
var body2 =
|
|
153017
|
+
var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync10, pkgfile) {
|
|
153018
|
+
var body2 = readFileSync10(pkgfile);
|
|
153019
153019
|
try {
|
|
153020
153020
|
var pkg2 = JSON.parse(body2);
|
|
153021
153021
|
return pkg2;
|
|
@@ -153035,7 +153035,7 @@ var require_sync = __commonJS({
|
|
|
153035
153035
|
}
|
|
153036
153036
|
var opts = normalizeOptions2(x2, options2);
|
|
153037
153037
|
var isFile3 = opts.isFile || defaultIsFile;
|
|
153038
|
-
var
|
|
153038
|
+
var readFileSync10 = opts.readFileSync || fs66.readFileSync;
|
|
153039
153039
|
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
153040
153040
|
var realpathSync4 = opts.realpathSync || defaultRealpathSync;
|
|
153041
153041
|
var readPackageSync2 = opts.readPackageSync || defaultReadPackageSync;
|
|
@@ -153092,7 +153092,7 @@ var require_sync = __commonJS({
|
|
|
153092
153092
|
if (!isFile3(pkgfile)) {
|
|
153093
153093
|
return loadpkg(path75.dirname(dir));
|
|
153094
153094
|
}
|
|
153095
|
-
var pkg2 = readPackageSync2(
|
|
153095
|
+
var pkg2 = readPackageSync2(readFileSync10, pkgfile);
|
|
153096
153096
|
if (pkg2 && opts.packageFilter) {
|
|
153097
153097
|
pkg2 = opts.packageFilter(
|
|
153098
153098
|
pkg2,
|
|
@@ -153106,7 +153106,7 @@ var require_sync = __commonJS({
|
|
|
153106
153106
|
var pkgfile = path75.join(maybeRealpathSync(realpathSync4, x3, opts), "/package.json");
|
|
153107
153107
|
if (isFile3(pkgfile)) {
|
|
153108
153108
|
try {
|
|
153109
|
-
var pkg2 = readPackageSync2(
|
|
153109
|
+
var pkg2 = readPackageSync2(readFileSync10, pkgfile);
|
|
153110
153110
|
} catch (e3) {
|
|
153111
153111
|
}
|
|
153112
153112
|
if (pkg2 && opts.packageFilter) {
|
|
@@ -249909,8 +249909,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
249909
249909
|
var require_snapshot_recorder = __commonJS({
|
|
249910
249910
|
"node_modules/undici/lib/mock/snapshot-recorder.js"(exports2, module2) {
|
|
249911
249911
|
"use strict";
|
|
249912
|
-
var { writeFile:
|
|
249913
|
-
var { dirname:
|
|
249912
|
+
var { writeFile: writeFile5, readFile: readFile8, mkdir: mkdir7 } = __require("node:fs/promises");
|
|
249913
|
+
var { dirname: dirname18, resolve: resolve14 } = __require("node:path");
|
|
249914
249914
|
var { setTimeout: setTimeout4, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
249915
249915
|
var { InvalidArgumentError, UndiciError } = require_errors7();
|
|
249916
249916
|
var { hashId, isUrlExcludedFactory, normalizeHeaders: normalizeHeaders2, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -250134,12 +250134,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
250134
250134
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
250135
250135
|
}
|
|
250136
250136
|
const resolvedPath = resolve14(path75);
|
|
250137
|
-
await mkdir7(
|
|
250137
|
+
await mkdir7(dirname18(resolvedPath), { recursive: true });
|
|
250138
250138
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
250139
250139
|
hash,
|
|
250140
250140
|
snapshot
|
|
250141
250141
|
}));
|
|
250142
|
-
await
|
|
250142
|
+
await writeFile5(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
|
|
250143
250143
|
}
|
|
250144
250144
|
/**
|
|
250145
250145
|
* Clears all recorded snapshots
|
|
@@ -269000,6 +269000,97 @@ var require_xterm_headless = __commonJS({
|
|
|
269000
269000
|
}
|
|
269001
269001
|
});
|
|
269002
269002
|
|
|
269003
|
+
// node_modules/fast-levenshtein/levenshtein.js
|
|
269004
|
+
var require_levenshtein = __commonJS({
|
|
269005
|
+
"node_modules/fast-levenshtein/levenshtein.js"(exports2, module2) {
|
|
269006
|
+
(function() {
|
|
269007
|
+
"use strict";
|
|
269008
|
+
var collator;
|
|
269009
|
+
try {
|
|
269010
|
+
collator = typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined" ? Intl.Collator("generic", { sensitivity: "base" }) : null;
|
|
269011
|
+
} catch (err2) {
|
|
269012
|
+
console.log("Collator could not be initialized and wouldn't be used");
|
|
269013
|
+
}
|
|
269014
|
+
var prevRow = [], str2Char = [];
|
|
269015
|
+
var Levenshtein = {
|
|
269016
|
+
/**
|
|
269017
|
+
* Calculate levenshtein distance of the two strings.
|
|
269018
|
+
*
|
|
269019
|
+
* @param str1 String the first string.
|
|
269020
|
+
* @param str2 String the second string.
|
|
269021
|
+
* @param [options] Additional options.
|
|
269022
|
+
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
|
269023
|
+
* @return Integer the levenshtein distance (0 and above).
|
|
269024
|
+
*/
|
|
269025
|
+
get: function(str1, str2, options2) {
|
|
269026
|
+
var useCollator = options2 && collator && options2.useCollator;
|
|
269027
|
+
var str1Len = str1.length, str2Len = str2.length;
|
|
269028
|
+
if (str1Len === 0) return str2Len;
|
|
269029
|
+
if (str2Len === 0) return str1Len;
|
|
269030
|
+
var curCol, nextCol, i4, j, tmp;
|
|
269031
|
+
for (i4 = 0; i4 < str2Len; ++i4) {
|
|
269032
|
+
prevRow[i4] = i4;
|
|
269033
|
+
str2Char[i4] = str2.charCodeAt(i4);
|
|
269034
|
+
}
|
|
269035
|
+
prevRow[str2Len] = str2Len;
|
|
269036
|
+
var strCmp;
|
|
269037
|
+
if (useCollator) {
|
|
269038
|
+
for (i4 = 0; i4 < str1Len; ++i4) {
|
|
269039
|
+
nextCol = i4 + 1;
|
|
269040
|
+
for (j = 0; j < str2Len; ++j) {
|
|
269041
|
+
curCol = nextCol;
|
|
269042
|
+
strCmp = 0 === collator.compare(str1.charAt(i4), String.fromCharCode(str2Char[j]));
|
|
269043
|
+
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
|
269044
|
+
tmp = curCol + 1;
|
|
269045
|
+
if (nextCol > tmp) {
|
|
269046
|
+
nextCol = tmp;
|
|
269047
|
+
}
|
|
269048
|
+
tmp = prevRow[j + 1] + 1;
|
|
269049
|
+
if (nextCol > tmp) {
|
|
269050
|
+
nextCol = tmp;
|
|
269051
|
+
}
|
|
269052
|
+
prevRow[j] = curCol;
|
|
269053
|
+
}
|
|
269054
|
+
prevRow[j] = nextCol;
|
|
269055
|
+
}
|
|
269056
|
+
} else {
|
|
269057
|
+
for (i4 = 0; i4 < str1Len; ++i4) {
|
|
269058
|
+
nextCol = i4 + 1;
|
|
269059
|
+
for (j = 0; j < str2Len; ++j) {
|
|
269060
|
+
curCol = nextCol;
|
|
269061
|
+
strCmp = str1.charCodeAt(i4) === str2Char[j];
|
|
269062
|
+
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
|
269063
|
+
tmp = curCol + 1;
|
|
269064
|
+
if (nextCol > tmp) {
|
|
269065
|
+
nextCol = tmp;
|
|
269066
|
+
}
|
|
269067
|
+
tmp = prevRow[j + 1] + 1;
|
|
269068
|
+
if (nextCol > tmp) {
|
|
269069
|
+
nextCol = tmp;
|
|
269070
|
+
}
|
|
269071
|
+
prevRow[j] = curCol;
|
|
269072
|
+
}
|
|
269073
|
+
prevRow[j] = nextCol;
|
|
269074
|
+
}
|
|
269075
|
+
}
|
|
269076
|
+
return nextCol;
|
|
269077
|
+
}
|
|
269078
|
+
};
|
|
269079
|
+
if (typeof define !== "undefined" && define !== null && define.amd) {
|
|
269080
|
+
define(function() {
|
|
269081
|
+
return Levenshtein;
|
|
269082
|
+
});
|
|
269083
|
+
} else if (typeof module2 !== "undefined" && module2 !== null && typeof exports2 !== "undefined" && module2.exports === exports2) {
|
|
269084
|
+
module2.exports = Levenshtein;
|
|
269085
|
+
} else if (typeof self !== "undefined" && typeof self.postMessage === "function" && typeof self.importScripts === "function") {
|
|
269086
|
+
self.Levenshtein = Levenshtein;
|
|
269087
|
+
} else if (typeof window !== "undefined" && window !== null) {
|
|
269088
|
+
window.Levenshtein = Levenshtein;
|
|
269089
|
+
}
|
|
269090
|
+
})();
|
|
269091
|
+
}
|
|
269092
|
+
});
|
|
269093
|
+
|
|
269003
269094
|
// node_modules/deepmerge/dist/cjs.js
|
|
269004
269095
|
var require_cjs2 = __commonJS({
|
|
269005
269096
|
"node_modules/deepmerge/dist/cjs.js"(exports2, module2) {
|
|
@@ -269103,97 +269194,6 @@ var require_cjs2 = __commonJS({
|
|
|
269103
269194
|
}
|
|
269104
269195
|
});
|
|
269105
269196
|
|
|
269106
|
-
// node_modules/fast-levenshtein/levenshtein.js
|
|
269107
|
-
var require_levenshtein = __commonJS({
|
|
269108
|
-
"node_modules/fast-levenshtein/levenshtein.js"(exports2, module2) {
|
|
269109
|
-
(function() {
|
|
269110
|
-
"use strict";
|
|
269111
|
-
var collator;
|
|
269112
|
-
try {
|
|
269113
|
-
collator = typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined" ? Intl.Collator("generic", { sensitivity: "base" }) : null;
|
|
269114
|
-
} catch (err2) {
|
|
269115
|
-
console.log("Collator could not be initialized and wouldn't be used");
|
|
269116
|
-
}
|
|
269117
|
-
var prevRow = [], str2Char = [];
|
|
269118
|
-
var Levenshtein = {
|
|
269119
|
-
/**
|
|
269120
|
-
* Calculate levenshtein distance of the two strings.
|
|
269121
|
-
*
|
|
269122
|
-
* @param str1 String the first string.
|
|
269123
|
-
* @param str2 String the second string.
|
|
269124
|
-
* @param [options] Additional options.
|
|
269125
|
-
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
|
269126
|
-
* @return Integer the levenshtein distance (0 and above).
|
|
269127
|
-
*/
|
|
269128
|
-
get: function(str1, str2, options2) {
|
|
269129
|
-
var useCollator = options2 && collator && options2.useCollator;
|
|
269130
|
-
var str1Len = str1.length, str2Len = str2.length;
|
|
269131
|
-
if (str1Len === 0) return str2Len;
|
|
269132
|
-
if (str2Len === 0) return str1Len;
|
|
269133
|
-
var curCol, nextCol, i4, j, tmp;
|
|
269134
|
-
for (i4 = 0; i4 < str2Len; ++i4) {
|
|
269135
|
-
prevRow[i4] = i4;
|
|
269136
|
-
str2Char[i4] = str2.charCodeAt(i4);
|
|
269137
|
-
}
|
|
269138
|
-
prevRow[str2Len] = str2Len;
|
|
269139
|
-
var strCmp;
|
|
269140
|
-
if (useCollator) {
|
|
269141
|
-
for (i4 = 0; i4 < str1Len; ++i4) {
|
|
269142
|
-
nextCol = i4 + 1;
|
|
269143
|
-
for (j = 0; j < str2Len; ++j) {
|
|
269144
|
-
curCol = nextCol;
|
|
269145
|
-
strCmp = 0 === collator.compare(str1.charAt(i4), String.fromCharCode(str2Char[j]));
|
|
269146
|
-
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
|
269147
|
-
tmp = curCol + 1;
|
|
269148
|
-
if (nextCol > tmp) {
|
|
269149
|
-
nextCol = tmp;
|
|
269150
|
-
}
|
|
269151
|
-
tmp = prevRow[j + 1] + 1;
|
|
269152
|
-
if (nextCol > tmp) {
|
|
269153
|
-
nextCol = tmp;
|
|
269154
|
-
}
|
|
269155
|
-
prevRow[j] = curCol;
|
|
269156
|
-
}
|
|
269157
|
-
prevRow[j] = nextCol;
|
|
269158
|
-
}
|
|
269159
|
-
} else {
|
|
269160
|
-
for (i4 = 0; i4 < str1Len; ++i4) {
|
|
269161
|
-
nextCol = i4 + 1;
|
|
269162
|
-
for (j = 0; j < str2Len; ++j) {
|
|
269163
|
-
curCol = nextCol;
|
|
269164
|
-
strCmp = str1.charCodeAt(i4) === str2Char[j];
|
|
269165
|
-
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
|
269166
|
-
tmp = curCol + 1;
|
|
269167
|
-
if (nextCol > tmp) {
|
|
269168
|
-
nextCol = tmp;
|
|
269169
|
-
}
|
|
269170
|
-
tmp = prevRow[j + 1] + 1;
|
|
269171
|
-
if (nextCol > tmp) {
|
|
269172
|
-
nextCol = tmp;
|
|
269173
|
-
}
|
|
269174
|
-
prevRow[j] = curCol;
|
|
269175
|
-
}
|
|
269176
|
-
prevRow[j] = nextCol;
|
|
269177
|
-
}
|
|
269178
|
-
}
|
|
269179
|
-
return nextCol;
|
|
269180
|
-
}
|
|
269181
|
-
};
|
|
269182
|
-
if (typeof define !== "undefined" && define !== null && define.amd) {
|
|
269183
|
-
define(function() {
|
|
269184
|
-
return Levenshtein;
|
|
269185
|
-
});
|
|
269186
|
-
} else if (typeof module2 !== "undefined" && module2 !== null && typeof exports2 !== "undefined" && module2.exports === exports2) {
|
|
269187
|
-
module2.exports = Levenshtein;
|
|
269188
|
-
} else if (typeof self !== "undefined" && typeof self.postMessage === "function" && typeof self.importScripts === "function") {
|
|
269189
|
-
self.Levenshtein = Levenshtein;
|
|
269190
|
-
} else if (typeof window !== "undefined" && window !== null) {
|
|
269191
|
-
window.Levenshtein = Levenshtein;
|
|
269192
|
-
}
|
|
269193
|
-
})();
|
|
269194
|
-
}
|
|
269195
|
-
});
|
|
269196
|
-
|
|
269197
269197
|
// node_modules/@kwsites/file-exists/dist/src/index.js
|
|
269198
269198
|
var require_src62 = __commonJS({
|
|
269199
269199
|
"node_modules/@kwsites/file-exists/dist/src/index.js"(exports2) {
|
|
@@ -275221,7 +275221,7 @@ var A2AExpressApp = class {
|
|
|
275221
275221
|
}
|
|
275222
275222
|
};
|
|
275223
275223
|
|
|
275224
|
-
// packages/a2a-server/node_modules/uuid/dist/
|
|
275224
|
+
// packages/a2a-server/node_modules/uuid/dist-node/stringify.js
|
|
275225
275225
|
var byteToHex2 = [];
|
|
275226
275226
|
for (let i4 = 0; i4 < 256; ++i4) {
|
|
275227
275227
|
byteToHex2.push((i4 + 256).toString(16).slice(1));
|
|
@@ -275230,8 +275230,8 @@ function unsafeStringify2(arr, offset = 0) {
|
|
|
275230
275230
|
return (byteToHex2[arr[offset + 0]] + byteToHex2[arr[offset + 1]] + byteToHex2[arr[offset + 2]] + byteToHex2[arr[offset + 3]] + "-" + byteToHex2[arr[offset + 4]] + byteToHex2[arr[offset + 5]] + "-" + byteToHex2[arr[offset + 6]] + byteToHex2[arr[offset + 7]] + "-" + byteToHex2[arr[offset + 8]] + byteToHex2[arr[offset + 9]] + "-" + byteToHex2[arr[offset + 10]] + byteToHex2[arr[offset + 11]] + byteToHex2[arr[offset + 12]] + byteToHex2[arr[offset + 13]] + byteToHex2[arr[offset + 14]] + byteToHex2[arr[offset + 15]]).toLowerCase();
|
|
275231
275231
|
}
|
|
275232
275232
|
|
|
275233
|
-
// packages/a2a-server/node_modules/uuid/dist/
|
|
275234
|
-
import { randomFillSync as randomFillSync2 } from "crypto";
|
|
275233
|
+
// packages/a2a-server/node_modules/uuid/dist-node/rng.js
|
|
275234
|
+
import { randomFillSync as randomFillSync2 } from "node:crypto";
|
|
275235
275235
|
var rnds8Pool2 = new Uint8Array(256);
|
|
275236
275236
|
var poolPtr2 = rnds8Pool2.length;
|
|
275237
275237
|
function rng2() {
|
|
@@ -275242,15 +275242,12 @@ function rng2() {
|
|
|
275242
275242
|
return rnds8Pool2.slice(poolPtr2, poolPtr2 += 16);
|
|
275243
275243
|
}
|
|
275244
275244
|
|
|
275245
|
-
// packages/a2a-server/node_modules/uuid/dist/
|
|
275246
|
-
import { randomUUID as randomUUID2 } from "crypto";
|
|
275245
|
+
// packages/a2a-server/node_modules/uuid/dist-node/native.js
|
|
275246
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
275247
275247
|
var native_default2 = { randomUUID: randomUUID2 };
|
|
275248
275248
|
|
|
275249
|
-
// packages/a2a-server/node_modules/uuid/dist/
|
|
275250
|
-
function
|
|
275251
|
-
if (native_default2.randomUUID && !buf && !options2) {
|
|
275252
|
-
return native_default2.randomUUID();
|
|
275253
|
-
}
|
|
275249
|
+
// packages/a2a-server/node_modules/uuid/dist-node/v4.js
|
|
275250
|
+
function _v4(options2, buf, offset) {
|
|
275254
275251
|
options2 = options2 || {};
|
|
275255
275252
|
const rnds = options2.random ?? options2.rng?.() ?? rng2();
|
|
275256
275253
|
if (rnds.length < 16) {
|
|
@@ -275270,6 +275267,12 @@ function v42(options2, buf, offset) {
|
|
|
275270
275267
|
}
|
|
275271
275268
|
return unsafeStringify2(rnds);
|
|
275272
275269
|
}
|
|
275270
|
+
function v42(options2, buf, offset) {
|
|
275271
|
+
if (native_default2.randomUUID && !buf && !options2) {
|
|
275272
|
+
return native_default2.randomUUID();
|
|
275273
|
+
}
|
|
275274
|
+
return _v4(options2, buf, offset);
|
|
275275
|
+
}
|
|
275273
275276
|
var v4_default2 = v42;
|
|
275274
275277
|
|
|
275275
275278
|
// node_modules/@google-cloud/storage/build/esm/src/nodejs-common/service.js
|
|
@@ -309407,7 +309410,142 @@ function getResponseText(response) {
|
|
|
309407
309410
|
return null;
|
|
309408
309411
|
}
|
|
309409
309412
|
|
|
309413
|
+
// packages/core/dist/src/config/models.js
|
|
309414
|
+
var PREVIEW_GEMINI_MODEL = "gemini-3-pro-preview";
|
|
309415
|
+
var PREVIEW_GEMINI_FLASH_MODEL = "gemini-3-flash-preview";
|
|
309416
|
+
var DEFAULT_GEMINI_MODEL = "gemini-2.5-pro";
|
|
309417
|
+
var DEFAULT_GEMINI_FLASH_MODEL = "gemini-2.5-flash";
|
|
309418
|
+
var DEFAULT_GEMINI_FLASH_LITE_MODEL = "gemini-2.5-flash-lite";
|
|
309419
|
+
var PREVIEW_GEMINI_MODEL_AUTO = "auto-gemini-3";
|
|
309420
|
+
var DEFAULT_GEMINI_MODEL_AUTO = "auto-gemini-2.5";
|
|
309421
|
+
var GEMINI_MODEL_ALIAS_AUTO = "auto";
|
|
309422
|
+
var GEMINI_MODEL_ALIAS_PRO = "pro";
|
|
309423
|
+
var GEMINI_MODEL_ALIAS_FLASH = "flash";
|
|
309424
|
+
var GEMINI_MODEL_ALIAS_FLASH_LITE = "flash-lite";
|
|
309425
|
+
var DEFAULT_GEMINI_EMBEDDING_MODEL = "gemini-embedding-001";
|
|
309426
|
+
var DEFAULT_THINKING_MODE = 8192;
|
|
309427
|
+
function resolveModel(requestedModel, previewFeaturesEnabled = false) {
|
|
309428
|
+
switch (requestedModel) {
|
|
309429
|
+
case PREVIEW_GEMINI_MODEL_AUTO: {
|
|
309430
|
+
return PREVIEW_GEMINI_MODEL;
|
|
309431
|
+
}
|
|
309432
|
+
case DEFAULT_GEMINI_MODEL_AUTO: {
|
|
309433
|
+
return DEFAULT_GEMINI_MODEL;
|
|
309434
|
+
}
|
|
309435
|
+
case GEMINI_MODEL_ALIAS_PRO: {
|
|
309436
|
+
return previewFeaturesEnabled ? PREVIEW_GEMINI_MODEL : DEFAULT_GEMINI_MODEL;
|
|
309437
|
+
}
|
|
309438
|
+
case GEMINI_MODEL_ALIAS_FLASH: {
|
|
309439
|
+
return previewFeaturesEnabled ? PREVIEW_GEMINI_FLASH_MODEL : DEFAULT_GEMINI_FLASH_MODEL;
|
|
309440
|
+
}
|
|
309441
|
+
case GEMINI_MODEL_ALIAS_FLASH_LITE: {
|
|
309442
|
+
return DEFAULT_GEMINI_FLASH_LITE_MODEL;
|
|
309443
|
+
}
|
|
309444
|
+
default: {
|
|
309445
|
+
return requestedModel;
|
|
309446
|
+
}
|
|
309447
|
+
}
|
|
309448
|
+
}
|
|
309449
|
+
function resolveClassifierModel(requestedModel, modelAlias, previewFeaturesEnabled = false) {
|
|
309450
|
+
if (modelAlias === GEMINI_MODEL_ALIAS_FLASH) {
|
|
309451
|
+
if (requestedModel === DEFAULT_GEMINI_MODEL_AUTO || requestedModel === DEFAULT_GEMINI_MODEL) {
|
|
309452
|
+
return DEFAULT_GEMINI_FLASH_MODEL;
|
|
309453
|
+
}
|
|
309454
|
+
if (requestedModel === PREVIEW_GEMINI_MODEL_AUTO || requestedModel === PREVIEW_GEMINI_MODEL) {
|
|
309455
|
+
return PREVIEW_GEMINI_FLASH_MODEL;
|
|
309456
|
+
}
|
|
309457
|
+
return resolveModel(GEMINI_MODEL_ALIAS_FLASH, previewFeaturesEnabled);
|
|
309458
|
+
}
|
|
309459
|
+
return resolveModel(requestedModel, previewFeaturesEnabled);
|
|
309460
|
+
}
|
|
309461
|
+
function isPreviewModel(model) {
|
|
309462
|
+
return model === PREVIEW_GEMINI_MODEL || model === PREVIEW_GEMINI_FLASH_MODEL || model === PREVIEW_GEMINI_MODEL_AUTO;
|
|
309463
|
+
}
|
|
309464
|
+
function isGemini2Model(model) {
|
|
309465
|
+
return /^gemini-2(\.|$)/.test(model);
|
|
309466
|
+
}
|
|
309467
|
+
function supportsMultimodalFunctionResponse(model) {
|
|
309468
|
+
return model.startsWith("gemini-3-");
|
|
309469
|
+
}
|
|
309470
|
+
|
|
309410
309471
|
// packages/core/dist/src/utils/generateContentResponseUtilities.js
|
|
309472
|
+
function createFunctionResponsePart(callId, toolName, output) {
|
|
309473
|
+
return {
|
|
309474
|
+
functionResponse: {
|
|
309475
|
+
id: callId,
|
|
309476
|
+
name: toolName,
|
|
309477
|
+
response: { output }
|
|
309478
|
+
}
|
|
309479
|
+
};
|
|
309480
|
+
}
|
|
309481
|
+
function toParts2(input) {
|
|
309482
|
+
const parts2 = [];
|
|
309483
|
+
for (const part of Array.isArray(input) ? input : [input]) {
|
|
309484
|
+
if (typeof part === "string") {
|
|
309485
|
+
parts2.push({ text: part });
|
|
309486
|
+
} else if (part) {
|
|
309487
|
+
parts2.push(part);
|
|
309488
|
+
}
|
|
309489
|
+
}
|
|
309490
|
+
return parts2;
|
|
309491
|
+
}
|
|
309492
|
+
function convertToFunctionResponse(toolName, callId, llmContent, model) {
|
|
309493
|
+
if (typeof llmContent === "string") {
|
|
309494
|
+
return [createFunctionResponsePart(callId, toolName, llmContent)];
|
|
309495
|
+
}
|
|
309496
|
+
const parts2 = toParts2(llmContent);
|
|
309497
|
+
const textParts = [];
|
|
309498
|
+
const inlineDataParts = [];
|
|
309499
|
+
const fileDataParts = [];
|
|
309500
|
+
for (const part2 of parts2) {
|
|
309501
|
+
if (part2.text !== void 0) {
|
|
309502
|
+
textParts.push(part2.text);
|
|
309503
|
+
} else if (part2.inlineData) {
|
|
309504
|
+
inlineDataParts.push(part2);
|
|
309505
|
+
} else if (part2.fileData) {
|
|
309506
|
+
fileDataParts.push(part2);
|
|
309507
|
+
} else if (part2.functionResponse) {
|
|
309508
|
+
if (parts2.length > 1) {
|
|
309509
|
+
debugLogger.warn("convertToFunctionResponse received multiple parts with a functionResponse. Only the functionResponse will be used, other parts will be ignored");
|
|
309510
|
+
}
|
|
309511
|
+
return [
|
|
309512
|
+
{
|
|
309513
|
+
functionResponse: {
|
|
309514
|
+
id: callId,
|
|
309515
|
+
name: toolName,
|
|
309516
|
+
response: part2.functionResponse.response
|
|
309517
|
+
}
|
|
309518
|
+
}
|
|
309519
|
+
];
|
|
309520
|
+
}
|
|
309521
|
+
}
|
|
309522
|
+
const part = {
|
|
309523
|
+
functionResponse: {
|
|
309524
|
+
id: callId,
|
|
309525
|
+
name: toolName,
|
|
309526
|
+
response: textParts.length > 0 ? { output: textParts.join("\n") } : {}
|
|
309527
|
+
}
|
|
309528
|
+
};
|
|
309529
|
+
const isMultimodalFRSupported = supportsMultimodalFunctionResponse(model);
|
|
309530
|
+
const siblingParts = [...fileDataParts];
|
|
309531
|
+
if (inlineDataParts.length > 0) {
|
|
309532
|
+
if (isMultimodalFRSupported) {
|
|
309533
|
+
part.functionResponse.parts = inlineDataParts;
|
|
309534
|
+
} else {
|
|
309535
|
+
siblingParts.push(...inlineDataParts);
|
|
309536
|
+
}
|
|
309537
|
+
}
|
|
309538
|
+
if (textParts.length === 0 && (inlineDataParts.length > 0 || fileDataParts.length > 0)) {
|
|
309539
|
+
const totalBinaryItems = inlineDataParts.length + fileDataParts.length;
|
|
309540
|
+
part.functionResponse.response = {
|
|
309541
|
+
output: `Binary content provided (${totalBinaryItems} item(s)).`
|
|
309542
|
+
};
|
|
309543
|
+
}
|
|
309544
|
+
if (siblingParts.length > 0) {
|
|
309545
|
+
return [part, ...siblingParts];
|
|
309546
|
+
}
|
|
309547
|
+
return [part];
|
|
309548
|
+
}
|
|
309411
309549
|
function getCitations(resp) {
|
|
309412
309550
|
return (resp.candidates?.[0]?.citationMetadata?.citations ?? []).filter((citation) => citation.uri !== void 0).map((citation) => {
|
|
309413
309551
|
if (citation.title) {
|
|
@@ -309781,7 +309919,7 @@ var DeclarativeTool = class {
|
|
|
309781
309919
|
* A convenience method that builds and executes the tool in one step.
|
|
309782
309920
|
* Never throws.
|
|
309783
309921
|
* @param params The raw, untrusted parameters from the model.
|
|
309784
|
-
* @
|
|
309922
|
+
* @param abortSignal a signal to abort.
|
|
309785
309923
|
* @returns The result of the tool execution.
|
|
309786
309924
|
*/
|
|
309787
309925
|
async validateBuildAndExecute(params, abortSignal) {
|
|
@@ -310224,7 +310362,7 @@ var __filename = fileURLToPath4(import.meta.url);
|
|
|
310224
310362
|
var __dirname3 = path20.dirname(__filename);
|
|
310225
310363
|
async function getVersion() {
|
|
310226
310364
|
const pkgJson = await getPackageJson(__dirname3);
|
|
310227
|
-
return "0.
|
|
310365
|
+
return "0.24.0-nightly.20251227.37be16243";
|
|
310228
310366
|
}
|
|
310229
310367
|
|
|
310230
310368
|
// packages/core/dist/src/code_assist/experiments/client_metadata.js
|
|
@@ -310360,7 +310498,7 @@ var CodeAssistServer = class {
|
|
|
310360
310498
|
await this.recordCodeAssistMetrics({
|
|
310361
310499
|
project: this.projectId,
|
|
310362
310500
|
metadata: await getClientMetadata(),
|
|
310363
|
-
metrics: [{ conversationOffered }]
|
|
310501
|
+
metrics: [{ conversationOffered, timestamp: (/* @__PURE__ */ new Date()).toISOString() }]
|
|
310364
310502
|
});
|
|
310365
310503
|
}
|
|
310366
310504
|
async recordConversationInteraction(interaction) {
|
|
@@ -310370,7 +310508,12 @@ var CodeAssistServer = class {
|
|
|
310370
310508
|
await this.recordCodeAssistMetrics({
|
|
310371
310509
|
project: this.projectId,
|
|
310372
310510
|
metadata: await getClientMetadata(),
|
|
310373
|
-
metrics: [
|
|
310511
|
+
metrics: [
|
|
310512
|
+
{
|
|
310513
|
+
conversationInteraction: interaction,
|
|
310514
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
310515
|
+
}
|
|
310516
|
+
]
|
|
310374
310517
|
});
|
|
310375
310518
|
}
|
|
310376
310519
|
async recordCodeAssistMetrics(request3) {
|
|
@@ -310944,8 +311087,8 @@ function sanitizeHookName(hookName) {
|
|
|
310944
311087
|
}
|
|
310945
311088
|
if (command.includes("/") || command.includes("\\")) {
|
|
310946
311089
|
const pathParts = command.split(/[/\\]/);
|
|
310947
|
-
const
|
|
310948
|
-
return
|
|
311090
|
+
const basename14 = pathParts[pathParts.length - 1];
|
|
311091
|
+
return basename14 || "unknown-command";
|
|
310949
311092
|
}
|
|
310950
311093
|
return command;
|
|
310951
311094
|
}
|
|
@@ -312995,8 +313138,8 @@ var Float64Vector = import_vector.default.Float64Vector;
|
|
|
312995
313138
|
var PointerVector = import_vector.default.PointerVector;
|
|
312996
313139
|
|
|
312997
313140
|
// packages/core/dist/src/generated/git-commit.js
|
|
312998
|
-
var GIT_COMMIT_INFO = "
|
|
312999
|
-
var CLI_VERSION = "0.
|
|
313141
|
+
var GIT_COMMIT_INFO = "37be16243";
|
|
313142
|
+
var CLI_VERSION = "0.24.0-nightly.20251227.37be16243";
|
|
313000
313143
|
|
|
313001
313144
|
// packages/core/dist/src/ide/detect-ide.js
|
|
313002
313145
|
var IDE_DEFINITIONS = {
|
|
@@ -316199,7 +316342,7 @@ async function createContentGenerator(config3, gcConfig, sessionId2) {
|
|
|
316199
316342
|
return FakeContentGenerator.fromFile(gcConfig.fakeResponses);
|
|
316200
316343
|
}
|
|
316201
316344
|
const version4 = await getVersion();
|
|
316202
|
-
const model =
|
|
316345
|
+
const model = resolveModel(gcConfig.getModel(), gcConfig.getPreviewFeatures());
|
|
316203
316346
|
const customHeadersEnv = process.env["GEMINI_CLI_CUSTOM_HEADERS"] || void 0;
|
|
316204
316347
|
const userAgent = `GeminiCLI/${version4}/${model} (${process.platform}; ${process.arch})`;
|
|
316205
316348
|
const customHeadersMap = parseCustomHeaders(customHeadersEnv);
|
|
@@ -318948,6 +319091,55 @@ async function fileExists(filePath) {
|
|
|
318948
319091
|
return false;
|
|
318949
319092
|
}
|
|
318950
319093
|
}
|
|
319094
|
+
async function saveTruncatedContent(content, callId, projectTempDir, threshold, truncateLines) {
|
|
319095
|
+
if (content.length <= threshold) {
|
|
319096
|
+
return { content };
|
|
319097
|
+
}
|
|
319098
|
+
let lines = content.split("\n");
|
|
319099
|
+
let fileContent = content;
|
|
319100
|
+
if (lines.length <= truncateLines) {
|
|
319101
|
+
const wrapWidth = 120;
|
|
319102
|
+
const wrappedLines = [];
|
|
319103
|
+
for (const line of lines) {
|
|
319104
|
+
if (line.length > wrapWidth) {
|
|
319105
|
+
for (let i4 = 0; i4 < line.length; i4 += wrapWidth) {
|
|
319106
|
+
wrappedLines.push(line.substring(i4, i4 + wrapWidth));
|
|
319107
|
+
}
|
|
319108
|
+
} else {
|
|
319109
|
+
wrappedLines.push(line);
|
|
319110
|
+
}
|
|
319111
|
+
}
|
|
319112
|
+
lines = wrappedLines;
|
|
319113
|
+
fileContent = lines.join("\n");
|
|
319114
|
+
}
|
|
319115
|
+
const head = Math.floor(truncateLines / 5);
|
|
319116
|
+
const beginning = lines.slice(0, head);
|
|
319117
|
+
const end = lines.slice(-(truncateLines - head));
|
|
319118
|
+
const truncatedContent = beginning.join("\n") + "\n... [CONTENT TRUNCATED] ...\n" + end.join("\n");
|
|
319119
|
+
const safeFileName = `${path26.basename(callId)}.output`;
|
|
319120
|
+
const outputFile = path26.join(projectTempDir, safeFileName);
|
|
319121
|
+
try {
|
|
319122
|
+
await fsPromises3.writeFile(outputFile, fileContent);
|
|
319123
|
+
return {
|
|
319124
|
+
content: `Tool output was too large and has been truncated.
|
|
319125
|
+
The full output has been saved to: ${outputFile}
|
|
319126
|
+
To read the complete output, use the ${READ_FILE_TOOL_NAME} tool with the absolute file path above. For large files, you can use the offset and limit parameters to read specific sections:
|
|
319127
|
+
- ${READ_FILE_TOOL_NAME} tool with offset=0, limit=100 to see the first 100 lines
|
|
319128
|
+
- ${READ_FILE_TOOL_NAME} tool with offset=N to skip N lines from the beginning
|
|
319129
|
+
- ${READ_FILE_TOOL_NAME} tool with limit=M to read only M lines at a time
|
|
319130
|
+
The truncated output below shows the beginning and end of the content. The marker '... [CONTENT TRUNCATED] ...' indicates where content was removed.
|
|
319131
|
+
This allows you to efficiently examine different parts of the output without loading the entire file.
|
|
319132
|
+
Truncated part of the output:
|
|
319133
|
+
${truncatedContent}`,
|
|
319134
|
+
outputFile
|
|
319135
|
+
};
|
|
319136
|
+
} catch (_error) {
|
|
319137
|
+
return {
|
|
319138
|
+
content: truncatedContent + `
|
|
319139
|
+
[Note: Could not save full output to file]`
|
|
319140
|
+
};
|
|
319141
|
+
}
|
|
319142
|
+
}
|
|
318951
319143
|
|
|
318952
319144
|
// packages/core/dist/src/utils/language-detection.js
|
|
318953
319145
|
import * as path27 from "node:path";
|
|
@@ -353021,6 +353213,8 @@ var IdeClient = class _IdeClient {
|
|
|
353021
353213
|
noProxy: [existingNoProxy, "127.0.0.1"].filter(Boolean).join(",")
|
|
353022
353214
|
});
|
|
353023
353215
|
const undiciPromise = Promise.resolve().then(() => __toESM(require_undici(), 1));
|
|
353216
|
+
undiciPromise.catch(() => {
|
|
353217
|
+
});
|
|
353024
353218
|
return async (url5, init3) => {
|
|
353025
353219
|
const { fetch: fetchFn } = await undiciPromise;
|
|
353026
353220
|
const fetchOptions = {
|
|
@@ -354164,67 +354358,6 @@ function classifyFailureKind(error2) {
|
|
|
354164
354358
|
return "unknown";
|
|
354165
354359
|
}
|
|
354166
354360
|
|
|
354167
|
-
// packages/core/dist/src/config/models.js
|
|
354168
|
-
var PREVIEW_GEMINI_MODEL = "gemini-3-pro-preview";
|
|
354169
|
-
var PREVIEW_GEMINI_FLASH_MODEL = "gemini-3-flash-preview";
|
|
354170
|
-
var DEFAULT_GEMINI_MODEL = "gemini-2.5-pro";
|
|
354171
|
-
var DEFAULT_GEMINI_FLASH_MODEL = "gemini-2.5-flash";
|
|
354172
|
-
var DEFAULT_GEMINI_FLASH_LITE_MODEL = "gemini-2.5-flash-lite";
|
|
354173
|
-
var PREVIEW_GEMINI_MODEL_AUTO = "auto-gemini-3";
|
|
354174
|
-
var DEFAULT_GEMINI_MODEL_AUTO = "auto-gemini-2.5";
|
|
354175
|
-
var GEMINI_MODEL_ALIAS_AUTO = "auto";
|
|
354176
|
-
var GEMINI_MODEL_ALIAS_PRO = "pro";
|
|
354177
|
-
var GEMINI_MODEL_ALIAS_FLASH = "flash";
|
|
354178
|
-
var GEMINI_MODEL_ALIAS_FLASH_LITE = "flash-lite";
|
|
354179
|
-
var DEFAULT_GEMINI_EMBEDDING_MODEL = "gemini-embedding-001";
|
|
354180
|
-
var DEFAULT_THINKING_MODE = 8192;
|
|
354181
|
-
function resolveModel(requestedModel, previewFeaturesEnabled = false) {
|
|
354182
|
-
switch (requestedModel) {
|
|
354183
|
-
case PREVIEW_GEMINI_MODEL_AUTO: {
|
|
354184
|
-
return PREVIEW_GEMINI_MODEL;
|
|
354185
|
-
}
|
|
354186
|
-
case DEFAULT_GEMINI_MODEL_AUTO: {
|
|
354187
|
-
return DEFAULT_GEMINI_MODEL;
|
|
354188
|
-
}
|
|
354189
|
-
case GEMINI_MODEL_ALIAS_PRO: {
|
|
354190
|
-
return previewFeaturesEnabled ? PREVIEW_GEMINI_MODEL : DEFAULT_GEMINI_MODEL;
|
|
354191
|
-
}
|
|
354192
|
-
case GEMINI_MODEL_ALIAS_FLASH: {
|
|
354193
|
-
return previewFeaturesEnabled ? PREVIEW_GEMINI_FLASH_MODEL : DEFAULT_GEMINI_FLASH_MODEL;
|
|
354194
|
-
}
|
|
354195
|
-
case GEMINI_MODEL_ALIAS_FLASH_LITE: {
|
|
354196
|
-
return DEFAULT_GEMINI_FLASH_LITE_MODEL;
|
|
354197
|
-
}
|
|
354198
|
-
default: {
|
|
354199
|
-
return requestedModel;
|
|
354200
|
-
}
|
|
354201
|
-
}
|
|
354202
|
-
}
|
|
354203
|
-
function resolveClassifierModel(requestedModel, modelAlias, previewFeaturesEnabled = false) {
|
|
354204
|
-
if (modelAlias === GEMINI_MODEL_ALIAS_FLASH) {
|
|
354205
|
-
if (requestedModel === DEFAULT_GEMINI_MODEL_AUTO || requestedModel === DEFAULT_GEMINI_MODEL) {
|
|
354206
|
-
return DEFAULT_GEMINI_FLASH_MODEL;
|
|
354207
|
-
}
|
|
354208
|
-
if (requestedModel === PREVIEW_GEMINI_MODEL_AUTO || requestedModel === PREVIEW_GEMINI_MODEL) {
|
|
354209
|
-
return PREVIEW_GEMINI_FLASH_MODEL;
|
|
354210
|
-
}
|
|
354211
|
-
return resolveModel(GEMINI_MODEL_ALIAS_FLASH, previewFeaturesEnabled);
|
|
354212
|
-
}
|
|
354213
|
-
return resolveModel(requestedModel, previewFeaturesEnabled);
|
|
354214
|
-
}
|
|
354215
|
-
function getEffectiveModel(requestedModel, previewFeaturesEnabled) {
|
|
354216
|
-
return resolveModel(requestedModel, previewFeaturesEnabled);
|
|
354217
|
-
}
|
|
354218
|
-
function isPreviewModel(model) {
|
|
354219
|
-
return model === PREVIEW_GEMINI_MODEL || model === PREVIEW_GEMINI_FLASH_MODEL || model === PREVIEW_GEMINI_MODEL_AUTO;
|
|
354220
|
-
}
|
|
354221
|
-
function isGemini2Model(model) {
|
|
354222
|
-
return /^gemini-2(\.|$)/.test(model);
|
|
354223
|
-
}
|
|
354224
|
-
function supportsMultimodalFunctionResponse(model) {
|
|
354225
|
-
return model.startsWith("gemini-3-");
|
|
354226
|
-
}
|
|
354227
|
-
|
|
354228
354361
|
// packages/core/dist/src/availability/policyCatalog.js
|
|
354229
354362
|
var DEFAULT_ACTIONS = {
|
|
354230
354363
|
terminal: "prompt",
|
|
@@ -354373,9 +354506,6 @@ function applyAvailabilityTransition(getContext, failureKind) {
|
|
|
354373
354506
|
// packages/core/dist/src/fallback/handler.js
|
|
354374
354507
|
var UPGRADE_URL_PAGE = "https://goo.gle/set-up-gemini-code-assist";
|
|
354375
354508
|
async function handleFallback(config3, failedModel, authType, error2) {
|
|
354376
|
-
return handlePolicyDrivenFallback(config3, failedModel, authType, error2);
|
|
354377
|
-
}
|
|
354378
|
-
async function handlePolicyDrivenFallback(config3, failedModel, authType, error2) {
|
|
354379
354509
|
if (authType !== AuthType2.LOGIN_WITH_GOOGLE) {
|
|
354380
354510
|
return null;
|
|
354381
354511
|
}
|
|
@@ -355099,10 +355229,10 @@ function correctPath(filePath, config3) {
|
|
|
355099
355229
|
}
|
|
355100
355230
|
const workspaceContext = config3.getWorkspaceContext();
|
|
355101
355231
|
const searchPaths = workspaceContext.getDirectories();
|
|
355102
|
-
const
|
|
355232
|
+
const basename14 = path48.basename(filePath);
|
|
355103
355233
|
const normalizedTarget = filePath.replace(/\\/g, "/");
|
|
355104
355234
|
const foundFiles = searchPaths.flatMap((searchPath) => bfsFileSearchSync(searchPath, {
|
|
355105
|
-
fileName:
|
|
355235
|
+
fileName: basename14,
|
|
355106
355236
|
maxDirs: 50,
|
|
355107
355237
|
// Capped to avoid deep hangs
|
|
355108
355238
|
fileService: config3.getFileService(),
|
|
@@ -360686,6 +360816,136 @@ function convertColorToHex(color, colorMode, defaultColor) {
|
|
|
360686
360816
|
return defaultColor;
|
|
360687
360817
|
}
|
|
360688
360818
|
|
|
360819
|
+
// packages/core/dist/src/services/environmentSanitization.js
|
|
360820
|
+
function sanitizeEnvironment(processEnv, config3) {
|
|
360821
|
+
if (!config3.enableEnvironmentVariableRedaction) {
|
|
360822
|
+
return { ...processEnv };
|
|
360823
|
+
}
|
|
360824
|
+
const results = {};
|
|
360825
|
+
const allowedSet = new Set((config3.allowedEnvironmentVariables || []).map((k) => k.toUpperCase()));
|
|
360826
|
+
const blockedSet = new Set((config3.blockedEnvironmentVariables || []).map((k) => k.toUpperCase()));
|
|
360827
|
+
const isStrictSanitization = !!processEnv["GITHUB_SHA"];
|
|
360828
|
+
for (const key in processEnv) {
|
|
360829
|
+
const value = processEnv[key];
|
|
360830
|
+
if (!shouldRedactEnvironmentVariable(key, value, allowedSet, blockedSet, isStrictSanitization)) {
|
|
360831
|
+
results[key] = value;
|
|
360832
|
+
}
|
|
360833
|
+
}
|
|
360834
|
+
return results;
|
|
360835
|
+
}
|
|
360836
|
+
var ALWAYS_ALLOWED_ENVIRONMENT_VARIABLES = /* @__PURE__ */ new Set([
|
|
360837
|
+
// Cross-platform
|
|
360838
|
+
"PATH",
|
|
360839
|
+
// Windows specific
|
|
360840
|
+
"SYSTEMROOT",
|
|
360841
|
+
"COMSPEC",
|
|
360842
|
+
"PATHEXT",
|
|
360843
|
+
"WINDIR",
|
|
360844
|
+
"TEMP",
|
|
360845
|
+
"TMP",
|
|
360846
|
+
"USERPROFILE",
|
|
360847
|
+
"SYSTEMDRIVE",
|
|
360848
|
+
// Unix/Linux/macOS specific
|
|
360849
|
+
"HOME",
|
|
360850
|
+
"LANG",
|
|
360851
|
+
"SHELL",
|
|
360852
|
+
"TMPDIR",
|
|
360853
|
+
"USER",
|
|
360854
|
+
"LOGNAME",
|
|
360855
|
+
// GitHub Action-related variables
|
|
360856
|
+
"ADDITIONAL_CONTEXT",
|
|
360857
|
+
"AVAILABLE_LABELS",
|
|
360858
|
+
"BRANCH_NAME",
|
|
360859
|
+
"DESCRIPTION",
|
|
360860
|
+
"EVENT_NAME",
|
|
360861
|
+
"GITHUB_ENV",
|
|
360862
|
+
"IS_PULL_REQUEST",
|
|
360863
|
+
"ISSUES_TO_TRIAGE",
|
|
360864
|
+
"ISSUE_BODY",
|
|
360865
|
+
"ISSUE_NUMBER",
|
|
360866
|
+
"ISSUE_TITLE",
|
|
360867
|
+
"PULL_REQUEST_NUMBER",
|
|
360868
|
+
"REPOSITORY",
|
|
360869
|
+
"TITLE",
|
|
360870
|
+
"TRIGGERING_ACTOR"
|
|
360871
|
+
]);
|
|
360872
|
+
var NEVER_ALLOWED_ENVIRONMENT_VARIABLES = /* @__PURE__ */ new Set([
|
|
360873
|
+
"CLIENT_ID",
|
|
360874
|
+
"DB_URI",
|
|
360875
|
+
"CONNECTION_STRING",
|
|
360876
|
+
"AWS_DEFAULT_REGION",
|
|
360877
|
+
"AZURE_CLIENT_ID",
|
|
360878
|
+
"AZURE_TENANT_ID",
|
|
360879
|
+
"SLACK_WEBHOOK_URL",
|
|
360880
|
+
"TWILIO_ACCOUNT_SID",
|
|
360881
|
+
"DATABASE_URL",
|
|
360882
|
+
"GOOGLE_CLOUD_PROJECT",
|
|
360883
|
+
"GOOGLE_CLOUD_ACCOUNT",
|
|
360884
|
+
"FIREBASE_PROJECT_ID"
|
|
360885
|
+
]);
|
|
360886
|
+
var NEVER_ALLOWED_NAME_PATTERNS = [
|
|
360887
|
+
/TOKEN/i,
|
|
360888
|
+
/SECRET/i,
|
|
360889
|
+
/PASSWORD/i,
|
|
360890
|
+
/PASSWD/i,
|
|
360891
|
+
/KEY/i,
|
|
360892
|
+
/AUTH/i,
|
|
360893
|
+
/CREDENTIAL/i,
|
|
360894
|
+
/CREDS/i,
|
|
360895
|
+
/PRIVATE/i,
|
|
360896
|
+
/CERT/i
|
|
360897
|
+
];
|
|
360898
|
+
var NEVER_ALLOWED_VALUE_PATTERNS = [
|
|
360899
|
+
/-----BEGIN (RSA|OPENSSH|EC|PGP) PRIVATE KEY-----/i,
|
|
360900
|
+
/-----BEGIN CERTIFICATE-----/i,
|
|
360901
|
+
// Credentials in URL
|
|
360902
|
+
/(https?|ftp|smtp):\/\/[^:]+:[^@]+@/i,
|
|
360903
|
+
// GitHub tokens (classic, fine-grained, OAuth, etc.)
|
|
360904
|
+
/(ghp|gho|ghu|ghs|ghr|github_pat)_[a-zA-Z0-9_]{36,}/i,
|
|
360905
|
+
// Google API keys
|
|
360906
|
+
/AIzaSy[a-zA-Z0-9_\\-]{33}/i,
|
|
360907
|
+
// Amazon AWS Access Key ID
|
|
360908
|
+
/AKIA[A-Z0-9]{16}/i,
|
|
360909
|
+
// Generic OAuth/JWT tokens
|
|
360910
|
+
/eyJ[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*/i,
|
|
360911
|
+
// Stripe API keys
|
|
360912
|
+
/(s|r)k_(live|test)_[0-9a-zA-Z]{24}/i,
|
|
360913
|
+
// Slack tokens (bot, user, etc.)
|
|
360914
|
+
/xox[abpr]-[a-zA-Z0-9-]+/i
|
|
360915
|
+
];
|
|
360916
|
+
function shouldRedactEnvironmentVariable(key, value, allowedSet, blockedSet, isStrictSanitization = false) {
|
|
360917
|
+
key = key.toUpperCase();
|
|
360918
|
+
value = value?.toUpperCase();
|
|
360919
|
+
if (allowedSet?.has(key)) {
|
|
360920
|
+
return false;
|
|
360921
|
+
}
|
|
360922
|
+
if (blockedSet?.has(key)) {
|
|
360923
|
+
return true;
|
|
360924
|
+
}
|
|
360925
|
+
if (ALWAYS_ALLOWED_ENVIRONMENT_VARIABLES.has(key) || key.startsWith("GEMINI_CLI_")) {
|
|
360926
|
+
return false;
|
|
360927
|
+
}
|
|
360928
|
+
if (NEVER_ALLOWED_ENVIRONMENT_VARIABLES.has(key)) {
|
|
360929
|
+
return true;
|
|
360930
|
+
}
|
|
360931
|
+
if (isStrictSanitization) {
|
|
360932
|
+
return true;
|
|
360933
|
+
}
|
|
360934
|
+
for (const pattern of NEVER_ALLOWED_NAME_PATTERNS) {
|
|
360935
|
+
if (pattern.test(key)) {
|
|
360936
|
+
return true;
|
|
360937
|
+
}
|
|
360938
|
+
}
|
|
360939
|
+
if (value) {
|
|
360940
|
+
for (const pattern of NEVER_ALLOWED_VALUE_PATTERNS) {
|
|
360941
|
+
if (pattern.test(value)) {
|
|
360942
|
+
return true;
|
|
360943
|
+
}
|
|
360944
|
+
}
|
|
360945
|
+
}
|
|
360946
|
+
return false;
|
|
360947
|
+
}
|
|
360948
|
+
|
|
360689
360949
|
// packages/core/dist/src/services/shellExecutionService.js
|
|
360690
360950
|
var { Terminal } = import_headless.default;
|
|
360691
360951
|
var SIGKILL_TIMEOUT_MS = 200;
|
|
@@ -360730,64 +360990,6 @@ var getFullBufferText = (terminal) => {
|
|
|
360730
360990
|
}
|
|
360731
360991
|
return lines.join("\n");
|
|
360732
360992
|
};
|
|
360733
|
-
function getSanitizedEnv() {
|
|
360734
|
-
const isRunningInGithub = process.env["GITHUB_SHA"] || process.env["SURFACE"] === "Github";
|
|
360735
|
-
if (!isRunningInGithub) {
|
|
360736
|
-
return { ...process.env };
|
|
360737
|
-
}
|
|
360738
|
-
const env2 = {};
|
|
360739
|
-
const essentialVars = [
|
|
360740
|
-
// Cross-platform
|
|
360741
|
-
"PATH",
|
|
360742
|
-
// Windows specific
|
|
360743
|
-
"Path",
|
|
360744
|
-
"SYSTEMROOT",
|
|
360745
|
-
"SystemRoot",
|
|
360746
|
-
"COMSPEC",
|
|
360747
|
-
"ComSpec",
|
|
360748
|
-
"PATHEXT",
|
|
360749
|
-
"WINDIR",
|
|
360750
|
-
"TEMP",
|
|
360751
|
-
"TMP",
|
|
360752
|
-
"USERPROFILE",
|
|
360753
|
-
"SYSTEMDRIVE",
|
|
360754
|
-
"SystemDrive",
|
|
360755
|
-
// Unix/Linux/macOS specific
|
|
360756
|
-
"HOME",
|
|
360757
|
-
"LANG",
|
|
360758
|
-
"SHELL",
|
|
360759
|
-
"TMPDIR",
|
|
360760
|
-
"USER",
|
|
360761
|
-
"LOGNAME",
|
|
360762
|
-
// GitHub Action-related variables
|
|
360763
|
-
"ADDITIONAL_CONTEXT",
|
|
360764
|
-
"AVAILABLE_LABELS",
|
|
360765
|
-
"BRANCH_NAME",
|
|
360766
|
-
"DESCRIPTION",
|
|
360767
|
-
"EVENT_NAME",
|
|
360768
|
-
"GITHUB_ENV",
|
|
360769
|
-
"IS_PULL_REQUEST",
|
|
360770
|
-
"ISSUES_TO_TRIAGE",
|
|
360771
|
-
"ISSUE_BODY",
|
|
360772
|
-
"ISSUE_NUMBER",
|
|
360773
|
-
"ISSUE_TITLE",
|
|
360774
|
-
"PULL_REQUEST_NUMBER",
|
|
360775
|
-
"REPOSITORY",
|
|
360776
|
-
"TITLE",
|
|
360777
|
-
"TRIGGERING_ACTOR"
|
|
360778
|
-
];
|
|
360779
|
-
for (const key of essentialVars) {
|
|
360780
|
-
if (process.env[key] !== void 0) {
|
|
360781
|
-
env2[key] = process.env[key];
|
|
360782
|
-
}
|
|
360783
|
-
}
|
|
360784
|
-
for (const key in process.env) {
|
|
360785
|
-
if (key.startsWith("GEMINI_CLI_")) {
|
|
360786
|
-
env2[key] = process.env[key];
|
|
360787
|
-
}
|
|
360788
|
-
}
|
|
360789
|
-
return env2;
|
|
360790
|
-
}
|
|
360791
360993
|
var ShellExecutionService = class {
|
|
360792
360994
|
static activePtys = /* @__PURE__ */ new Map();
|
|
360793
360995
|
/**
|
|
@@ -360810,7 +361012,7 @@ var ShellExecutionService = class {
|
|
|
360810
361012
|
}
|
|
360811
361013
|
}
|
|
360812
361014
|
}
|
|
360813
|
-
return this.childProcessFallback(commandToExecute, cwd, onOutputEvent, abortSignal);
|
|
361015
|
+
return this.childProcessFallback(commandToExecute, cwd, onOutputEvent, abortSignal, shellExecutionConfig.sanitizationConfig);
|
|
360814
361016
|
}
|
|
360815
361017
|
static appendAndTruncate(currentBuffer, chunk2, maxSize) {
|
|
360816
361018
|
const chunkLength = chunk2.length;
|
|
@@ -360829,7 +361031,7 @@ var ShellExecutionService = class {
|
|
|
360829
361031
|
const truncatedBuffer = currentBuffer.substring(charsToTrim);
|
|
360830
361032
|
return { newBuffer: truncatedBuffer + chunk2, truncated: true };
|
|
360831
361033
|
}
|
|
360832
|
-
static childProcessFallback(commandToExecute, cwd, onOutputEvent, abortSignal) {
|
|
361034
|
+
static childProcessFallback(commandToExecute, cwd, onOutputEvent, abortSignal, sanitizationConfig) {
|
|
360833
361035
|
try {
|
|
360834
361036
|
const isWindows5 = os16.platform() === "win32";
|
|
360835
361037
|
const { executable, argsPrefix, shell } = getShellConfiguration();
|
|
@@ -360842,7 +361044,7 @@ var ShellExecutionService = class {
|
|
|
360842
361044
|
shell: false,
|
|
360843
361045
|
detached: !isWindows5,
|
|
360844
361046
|
env: {
|
|
360845
|
-
...
|
|
361047
|
+
...sanitizeEnvironment(process.env, sanitizationConfig),
|
|
360846
361048
|
GEMINI_CLI: "1",
|
|
360847
361049
|
TERM: "xterm-256color",
|
|
360848
361050
|
PAGER: "cat",
|
|
@@ -361011,7 +361213,7 @@ var ShellExecutionService = class {
|
|
|
361011
361213
|
cols,
|
|
361012
361214
|
rows,
|
|
361013
361215
|
env: {
|
|
361014
|
-
...
|
|
361216
|
+
...sanitizeEnvironment(process.env, shellExecutionConfig.sanitizationConfig),
|
|
361015
361217
|
GEMINI_CLI: "1",
|
|
361016
361218
|
TERM: "xterm-256color",
|
|
361017
361219
|
PAGER: shellExecutionConfig.pager ?? "cat",
|
|
@@ -361314,6 +361516,24 @@ var ShellExecutionService = class {
|
|
|
361314
361516
|
};
|
|
361315
361517
|
|
|
361316
361518
|
// packages/core/dist/src/utils/tool-utils.js
|
|
361519
|
+
var import_fast_levenshtein = __toESM(require_levenshtein(), 1);
|
|
361520
|
+
function getToolSuggestion(unknownToolName, allToolNames, topN = 3) {
|
|
361521
|
+
const matches = allToolNames.map((toolName) => ({
|
|
361522
|
+
name: toolName,
|
|
361523
|
+
distance: import_fast_levenshtein.default.get(unknownToolName, toolName)
|
|
361524
|
+
}));
|
|
361525
|
+
matches.sort((a2, b) => a2.distance - b.distance);
|
|
361526
|
+
const topNResults = matches.slice(0, topN);
|
|
361527
|
+
if (topNResults.length === 0) {
|
|
361528
|
+
return "";
|
|
361529
|
+
}
|
|
361530
|
+
const suggestedNames = topNResults.map((match2) => `"${match2.name}"`).join(", ");
|
|
361531
|
+
if (topNResults.length > 1) {
|
|
361532
|
+
return ` Did you mean one of: ${suggestedNames}?`;
|
|
361533
|
+
} else {
|
|
361534
|
+
return ` Did you mean ${suggestedNames}?`;
|
|
361535
|
+
}
|
|
361536
|
+
}
|
|
361317
361537
|
function doesToolInvocationMatch(toolOrToolName, invocation, patterns) {
|
|
361318
361538
|
let toolNames;
|
|
361319
361539
|
if (isTool(toolOrToolName)) {
|
|
@@ -361620,7 +361840,11 @@ var ShellToolInvocation = class extends BaseToolInvocation {
|
|
|
361620
361840
|
updateOutput(cumulativeOutput);
|
|
361621
361841
|
lastUpdateTime = Date.now();
|
|
361622
361842
|
}
|
|
361623
|
-
}, combinedController.signal, this.config.getEnableInteractiveShell(), {
|
|
361843
|
+
}, combinedController.signal, this.config.getEnableInteractiveShell(), {
|
|
361844
|
+
...shellExecutionConfig,
|
|
361845
|
+
pager: "cat",
|
|
361846
|
+
sanitizationConfig: shellExecutionConfig?.sanitizationConfig ?? this.config.sanitizationConfig
|
|
361847
|
+
});
|
|
361624
361848
|
if (pid && setPidCallback) {
|
|
361625
361849
|
setPidCallback(pid);
|
|
361626
361850
|
}
|
|
@@ -367699,11 +367923,6 @@ My setup is complete. I will provide my first command in the next turn.
|
|
|
367699
367923
|
];
|
|
367700
367924
|
}
|
|
367701
367925
|
|
|
367702
|
-
// packages/core/dist/src/core/coreToolScheduler.js
|
|
367703
|
-
import * as fs48 from "node:fs/promises";
|
|
367704
|
-
import * as path53 from "node:path";
|
|
367705
|
-
var import_fast_levenshtein = __toESM(require_levenshtein(), 1);
|
|
367706
|
-
|
|
367707
367926
|
// packages/core/dist/src/hooks/hookTranslator.js
|
|
367708
367927
|
var HookTranslator = class {
|
|
367709
367928
|
};
|
|
@@ -367873,6 +368092,13 @@ var HookTranslatorGenAIv1 = class extends HookTranslator {
|
|
|
367873
368092
|
var defaultHookTranslator = new HookTranslatorGenAIv1();
|
|
367874
368093
|
|
|
367875
368094
|
// packages/core/dist/src/hooks/types.js
|
|
368095
|
+
var ConfigSource;
|
|
368096
|
+
(function(ConfigSource2) {
|
|
368097
|
+
ConfigSource2["Project"] = "project";
|
|
368098
|
+
ConfigSource2["User"] = "user";
|
|
368099
|
+
ConfigSource2["System"] = "system";
|
|
368100
|
+
ConfigSource2["Extensions"] = "extensions";
|
|
368101
|
+
})(ConfigSource || (ConfigSource = {}));
|
|
367876
368102
|
var HookEventName;
|
|
367877
368103
|
(function(HookEventName2) {
|
|
367878
368104
|
HookEventName2["BeforeTool"] = "BeforeTool";
|
|
@@ -367891,6 +368117,11 @@ var HookType;
|
|
|
367891
368117
|
(function(HookType2) {
|
|
367892
368118
|
HookType2["Command"] = "command";
|
|
367893
368119
|
})(HookType || (HookType = {}));
|
|
368120
|
+
function getHookKey(hook) {
|
|
368121
|
+
const name4 = hook.name || "";
|
|
368122
|
+
const command = hook.command || "";
|
|
368123
|
+
return `${name4}:${command}`;
|
|
368124
|
+
}
|
|
367894
368125
|
function createHookOutput(eventName, data) {
|
|
367895
368126
|
switch (eventName) {
|
|
367896
368127
|
case "BeforeModel":
|
|
@@ -367974,32 +368205,6 @@ var DefaultHookOutput = class {
|
|
|
367974
368205
|
}
|
|
367975
368206
|
};
|
|
367976
368207
|
var BeforeToolHookOutput = class extends DefaultHookOutput {
|
|
367977
|
-
/**
|
|
367978
|
-
* Get the effective blocking reason, considering compatibility fields
|
|
367979
|
-
*/
|
|
367980
|
-
getEffectiveReason() {
|
|
367981
|
-
if (this.hookSpecificOutput) {
|
|
367982
|
-
if ("permissionDecisionReason" in this.hookSpecificOutput) {
|
|
367983
|
-
const compatReason = this.hookSpecificOutput["permissionDecisionReason"];
|
|
367984
|
-
if (typeof compatReason === "string") {
|
|
367985
|
-
return compatReason;
|
|
367986
|
-
}
|
|
367987
|
-
}
|
|
367988
|
-
}
|
|
367989
|
-
return super.getEffectiveReason();
|
|
367990
|
-
}
|
|
367991
|
-
/**
|
|
367992
|
-
* Check if this output represents a blocking decision, considering compatibility fields
|
|
367993
|
-
*/
|
|
367994
|
-
isBlockingDecision() {
|
|
367995
|
-
if (this.hookSpecificOutput && "permissionDecision" in this.hookSpecificOutput) {
|
|
367996
|
-
const compatDecision = this.hookSpecificOutput["permissionDecision"];
|
|
367997
|
-
if (compatDecision === "block" || compatDecision === "deny") {
|
|
367998
|
-
return true;
|
|
367999
|
-
}
|
|
368000
|
-
}
|
|
368001
|
-
return super.isBlockingDecision();
|
|
368002
|
-
}
|
|
368003
368208
|
};
|
|
368004
368209
|
var BeforeModelHookOutput = class extends DefaultHookOutput {
|
|
368005
368210
|
/**
|
|
@@ -368276,83 +368481,6 @@ async function executeToolWithHooks(invocation, toolName, signal, messageBus, ho
|
|
|
368276
368481
|
}
|
|
368277
368482
|
|
|
368278
368483
|
// packages/core/dist/src/core/coreToolScheduler.js
|
|
368279
|
-
function createFunctionResponsePart(callId, toolName, output) {
|
|
368280
|
-
return {
|
|
368281
|
-
functionResponse: {
|
|
368282
|
-
id: callId,
|
|
368283
|
-
name: toolName,
|
|
368284
|
-
response: { output }
|
|
368285
|
-
}
|
|
368286
|
-
};
|
|
368287
|
-
}
|
|
368288
|
-
function convertToFunctionResponse(toolName, callId, llmContent, model) {
|
|
368289
|
-
if (typeof llmContent === "string") {
|
|
368290
|
-
return [createFunctionResponsePart(callId, toolName, llmContent)];
|
|
368291
|
-
}
|
|
368292
|
-
const parts2 = toParts2(llmContent);
|
|
368293
|
-
const textParts = [];
|
|
368294
|
-
const inlineDataParts = [];
|
|
368295
|
-
const fileDataParts = [];
|
|
368296
|
-
for (const part2 of parts2) {
|
|
368297
|
-
if (part2.text !== void 0) {
|
|
368298
|
-
textParts.push(part2.text);
|
|
368299
|
-
} else if (part2.inlineData) {
|
|
368300
|
-
inlineDataParts.push(part2);
|
|
368301
|
-
} else if (part2.fileData) {
|
|
368302
|
-
fileDataParts.push(part2);
|
|
368303
|
-
} else if (part2.functionResponse) {
|
|
368304
|
-
if (parts2.length > 1) {
|
|
368305
|
-
debugLogger.warn("convertToFunctionResponse received multiple parts with a functionResponse. Only the functionResponse will be used, other parts will be ignored");
|
|
368306
|
-
}
|
|
368307
|
-
return [
|
|
368308
|
-
{
|
|
368309
|
-
functionResponse: {
|
|
368310
|
-
id: callId,
|
|
368311
|
-
name: toolName,
|
|
368312
|
-
response: part2.functionResponse.response
|
|
368313
|
-
}
|
|
368314
|
-
}
|
|
368315
|
-
];
|
|
368316
|
-
}
|
|
368317
|
-
}
|
|
368318
|
-
const part = {
|
|
368319
|
-
functionResponse: {
|
|
368320
|
-
id: callId,
|
|
368321
|
-
name: toolName,
|
|
368322
|
-
response: textParts.length > 0 ? { output: textParts.join("\n") } : {}
|
|
368323
|
-
}
|
|
368324
|
-
};
|
|
368325
|
-
const isMultimodalFRSupported = supportsMultimodalFunctionResponse(model);
|
|
368326
|
-
const siblingParts = [...fileDataParts];
|
|
368327
|
-
if (inlineDataParts.length > 0) {
|
|
368328
|
-
if (isMultimodalFRSupported) {
|
|
368329
|
-
part.functionResponse.parts = inlineDataParts;
|
|
368330
|
-
} else {
|
|
368331
|
-
siblingParts.push(...inlineDataParts);
|
|
368332
|
-
}
|
|
368333
|
-
}
|
|
368334
|
-
if (textParts.length === 0 && (inlineDataParts.length > 0 || fileDataParts.length > 0)) {
|
|
368335
|
-
const totalBinaryItems = inlineDataParts.length + fileDataParts.length;
|
|
368336
|
-
part.functionResponse.response = {
|
|
368337
|
-
output: `Binary content provided (${totalBinaryItems} item(s)).`
|
|
368338
|
-
};
|
|
368339
|
-
}
|
|
368340
|
-
if (siblingParts.length > 0) {
|
|
368341
|
-
return [part, ...siblingParts];
|
|
368342
|
-
}
|
|
368343
|
-
return [part];
|
|
368344
|
-
}
|
|
368345
|
-
function toParts2(input) {
|
|
368346
|
-
const parts2 = [];
|
|
368347
|
-
for (const part of Array.isArray(input) ? input : [input]) {
|
|
368348
|
-
if (typeof part === "string") {
|
|
368349
|
-
parts2.push({ text: part });
|
|
368350
|
-
} else if (part) {
|
|
368351
|
-
parts2.push(part);
|
|
368352
|
-
}
|
|
368353
|
-
}
|
|
368354
|
-
return parts2;
|
|
368355
|
-
}
|
|
368356
368484
|
var createErrorResponse = (request3, error2, errorType) => ({
|
|
368357
368485
|
callId: request3.callId,
|
|
368358
368486
|
error: error2,
|
|
@@ -368369,55 +368497,6 @@ var createErrorResponse = (request3, error2, errorType) => ({
|
|
|
368369
368497
|
errorType,
|
|
368370
368498
|
contentLength: error2.message.length
|
|
368371
368499
|
});
|
|
368372
|
-
async function truncateAndSaveToFile(content, callId, projectTempDir, threshold, truncateLines) {
|
|
368373
|
-
if (content.length <= threshold) {
|
|
368374
|
-
return { content };
|
|
368375
|
-
}
|
|
368376
|
-
let lines = content.split("\n");
|
|
368377
|
-
let fileContent = content;
|
|
368378
|
-
if (lines.length <= truncateLines) {
|
|
368379
|
-
const wrapWidth = 120;
|
|
368380
|
-
const wrappedLines = [];
|
|
368381
|
-
for (const line of lines) {
|
|
368382
|
-
if (line.length > wrapWidth) {
|
|
368383
|
-
for (let i4 = 0; i4 < line.length; i4 += wrapWidth) {
|
|
368384
|
-
wrappedLines.push(line.substring(i4, i4 + wrapWidth));
|
|
368385
|
-
}
|
|
368386
|
-
} else {
|
|
368387
|
-
wrappedLines.push(line);
|
|
368388
|
-
}
|
|
368389
|
-
}
|
|
368390
|
-
lines = wrappedLines;
|
|
368391
|
-
fileContent = lines.join("\n");
|
|
368392
|
-
}
|
|
368393
|
-
const head = Math.floor(truncateLines / 5);
|
|
368394
|
-
const beginning = lines.slice(0, head);
|
|
368395
|
-
const end = lines.slice(-(truncateLines - head));
|
|
368396
|
-
const truncatedContent = beginning.join("\n") + "\n... [CONTENT TRUNCATED] ...\n" + end.join("\n");
|
|
368397
|
-
const safeFileName = `${path53.basename(callId)}.output`;
|
|
368398
|
-
const outputFile = path53.join(projectTempDir, safeFileName);
|
|
368399
|
-
try {
|
|
368400
|
-
await fs48.writeFile(outputFile, fileContent);
|
|
368401
|
-
return {
|
|
368402
|
-
content: `Tool output was too large and has been truncated.
|
|
368403
|
-
The full output has been saved to: ${outputFile}
|
|
368404
|
-
To read the complete output, use the ${READ_FILE_TOOL_NAME} tool with the absolute file path above. For large files, you can use the offset and limit parameters to read specific sections:
|
|
368405
|
-
- ${READ_FILE_TOOL_NAME} tool with offset=0, limit=100 to see the first 100 lines
|
|
368406
|
-
- ${READ_FILE_TOOL_NAME} tool with offset=N to skip N lines from the beginning
|
|
368407
|
-
- ${READ_FILE_TOOL_NAME} tool with limit=M to read only M lines at a time
|
|
368408
|
-
The truncated output below shows the beginning and end of the content. The marker '... [CONTENT TRUNCATED] ...' indicates where content was removed.
|
|
368409
|
-
This allows you to efficiently examine different parts of the output without loading the entire file.
|
|
368410
|
-
Truncated part of the output:
|
|
368411
|
-
${truncatedContent}`,
|
|
368412
|
-
outputFile
|
|
368413
|
-
};
|
|
368414
|
-
} catch (_error) {
|
|
368415
|
-
return {
|
|
368416
|
-
content: truncatedContent + `
|
|
368417
|
-
[Note: Could not save full output to file]`
|
|
368418
|
-
};
|
|
368419
|
-
}
|
|
368420
|
-
}
|
|
368421
368500
|
var CoreToolScheduler = class _CoreToolScheduler {
|
|
368422
368501
|
// Static WeakMap to track which MessageBus instances already have a handler subscribed
|
|
368423
368502
|
// This prevents duplicate subscriptions when multiple CoreToolScheduler instances are created
|
|
@@ -368611,31 +368690,6 @@ var CoreToolScheduler = class _CoreToolScheduler {
|
|
|
368611
368690
|
return new Error(String(e3));
|
|
368612
368691
|
}
|
|
368613
368692
|
}
|
|
368614
|
-
/**
|
|
368615
|
-
* Generates a suggestion string for a tool name that was not found in the registry.
|
|
368616
|
-
* It finds the closest matches based on Levenshtein distance.
|
|
368617
|
-
* @param unknownToolName The tool name that was not found.
|
|
368618
|
-
* @param topN The number of suggestions to return. Defaults to 3.
|
|
368619
|
-
* @returns A suggestion string like " Did you mean 'tool'?" or " Did you mean one of: 'tool1', 'tool2'?", or an empty string if no suggestions are found.
|
|
368620
|
-
*/
|
|
368621
|
-
getToolSuggestion(unknownToolName, topN = 3) {
|
|
368622
|
-
const allToolNames = this.config.getToolRegistry().getAllToolNames();
|
|
368623
|
-
const matches = allToolNames.map((toolName) => ({
|
|
368624
|
-
name: toolName,
|
|
368625
|
-
distance: import_fast_levenshtein.default.get(unknownToolName, toolName)
|
|
368626
|
-
}));
|
|
368627
|
-
matches.sort((a2, b) => a2.distance - b.distance);
|
|
368628
|
-
const topNResults = matches.slice(0, topN);
|
|
368629
|
-
if (topNResults.length === 0) {
|
|
368630
|
-
return "";
|
|
368631
|
-
}
|
|
368632
|
-
const suggestedNames = topNResults.map((match2) => `"${match2.name}"`).join(", ");
|
|
368633
|
-
if (topNResults.length > 1) {
|
|
368634
|
-
return ` Did you mean one of: ${suggestedNames}?`;
|
|
368635
|
-
} else {
|
|
368636
|
-
return ` Did you mean ${suggestedNames}?`;
|
|
368637
|
-
}
|
|
368638
|
-
}
|
|
368639
368693
|
schedule(request3, signal) {
|
|
368640
368694
|
return runInDevTraceSpan({ name: "schedule" }, async ({ metadata: spanMetadata }) => {
|
|
368641
368695
|
spanMetadata.input = request3;
|
|
@@ -368692,7 +368746,7 @@ var CoreToolScheduler = class _CoreToolScheduler {
|
|
|
368692
368746
|
const newToolCalls = requestsToProcess.map((reqInfo) => {
|
|
368693
368747
|
const toolInstance = this.config.getToolRegistry().getTool(reqInfo.name);
|
|
368694
368748
|
if (!toolInstance) {
|
|
368695
|
-
const suggestion =
|
|
368749
|
+
const suggestion = getToolSuggestion(reqInfo.name, this.config.getToolRegistry().getAllToolNames());
|
|
368696
368750
|
const errorMessage = `Tool "${reqInfo.name}" not found in registry. Tools must use the exact names that are registered.${suggestion}`;
|
|
368697
368751
|
return {
|
|
368698
368752
|
status: "error",
|
|
@@ -368907,7 +368961,7 @@ var CoreToolScheduler = class _CoreToolScheduler {
|
|
|
368907
368961
|
const originalContentLength = content.length;
|
|
368908
368962
|
const threshold = this.config.getTruncateToolOutputThreshold();
|
|
368909
368963
|
const lines = this.config.getTruncateToolOutputLines();
|
|
368910
|
-
const truncatedResult = await
|
|
368964
|
+
const truncatedResult = await saveTruncatedContent(content, callId, this.config.storage.getProjectTempDir(), threshold, lines);
|
|
368911
368965
|
content = truncatedResult.content;
|
|
368912
368966
|
outputFile = truncatedResult.outputFile;
|
|
368913
368967
|
if (outputFile) {
|
|
@@ -369076,8 +369130,8 @@ function parseThought(rawText) {
|
|
|
369076
369130
|
}
|
|
369077
369131
|
|
|
369078
369132
|
// packages/core/dist/src/services/chatRecordingService.js
|
|
369079
|
-
import
|
|
369080
|
-
import
|
|
369133
|
+
import path53 from "node:path";
|
|
369134
|
+
import fs48 from "node:fs";
|
|
369081
369135
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
369082
369136
|
var SESSION_FILE_PREFIX = "session-";
|
|
369083
369137
|
var ChatRecordingService = class {
|
|
@@ -369107,11 +369161,11 @@ var ChatRecordingService = class {
|
|
|
369107
369161
|
});
|
|
369108
369162
|
this.cachedLastConvData = null;
|
|
369109
369163
|
} else {
|
|
369110
|
-
const chatsDir =
|
|
369111
|
-
|
|
369164
|
+
const chatsDir = path53.join(this.config.storage.getProjectTempDir(), "chats");
|
|
369165
|
+
fs48.mkdirSync(chatsDir, { recursive: true });
|
|
369112
369166
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 16).replace(/:/g, "-");
|
|
369113
369167
|
const filename = `${SESSION_FILE_PREFIX}${timestamp}-${this.sessionId.slice(0, 8)}.json`;
|
|
369114
|
-
this.conversationFile =
|
|
369168
|
+
this.conversationFile = path53.join(chatsDir, filename);
|
|
369115
369169
|
this.writeConversation({
|
|
369116
369170
|
sessionId: this.sessionId,
|
|
369117
369171
|
projectHash: this.projectHash,
|
|
@@ -369281,7 +369335,7 @@ var ChatRecordingService = class {
|
|
|
369281
369335
|
*/
|
|
369282
369336
|
readConversation() {
|
|
369283
369337
|
try {
|
|
369284
|
-
this.cachedLastConvData =
|
|
369338
|
+
this.cachedLastConvData = fs48.readFileSync(this.conversationFile, "utf8");
|
|
369285
369339
|
return JSON.parse(this.cachedLastConvData);
|
|
369286
369340
|
} catch (error2) {
|
|
369287
369341
|
if (error2.code !== "ENOENT") {
|
|
@@ -369310,7 +369364,7 @@ var ChatRecordingService = class {
|
|
|
369310
369364
|
conversation.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
|
|
369311
369365
|
const newContent = JSON.stringify(conversation, null, 2);
|
|
369312
369366
|
this.cachedLastConvData = newContent;
|
|
369313
|
-
|
|
369367
|
+
fs48.writeFileSync(this.conversationFile, newContent);
|
|
369314
369368
|
}
|
|
369315
369369
|
} catch (error2) {
|
|
369316
369370
|
debugLogger.error("Error writing conversation file.", error2);
|
|
@@ -369365,9 +369419,9 @@ var ChatRecordingService = class {
|
|
|
369365
369419
|
*/
|
|
369366
369420
|
deleteSession(sessionId2) {
|
|
369367
369421
|
try {
|
|
369368
|
-
const chatsDir =
|
|
369369
|
-
const sessionPath =
|
|
369370
|
-
|
|
369422
|
+
const chatsDir = path53.join(this.config.storage.getProjectTempDir(), "chats");
|
|
369423
|
+
const sessionPath = path53.join(chatsDir, `${sessionId2}.json`);
|
|
369424
|
+
fs48.unlinkSync(sessionPath);
|
|
369371
369425
|
} catch (error2) {
|
|
369372
369426
|
debugLogger.error("Error deleting session file.", error2);
|
|
369373
369427
|
throw error2;
|
|
@@ -370207,8 +370261,8 @@ ${[...this.pendingCitations].sort().join("\n")}`
|
|
|
370207
370261
|
};
|
|
370208
370262
|
|
|
370209
370263
|
// packages/core/dist/src/core/prompts.js
|
|
370210
|
-
import
|
|
370211
|
-
import
|
|
370264
|
+
import path54 from "node:path";
|
|
370265
|
+
import fs49 from "node:fs";
|
|
370212
370266
|
import os18 from "node:os";
|
|
370213
370267
|
import process21 from "node:process";
|
|
370214
370268
|
|
|
@@ -370528,7 +370582,7 @@ function resolvePathFromEnv(envVar) {
|
|
|
370528
370582
|
if (customPath === "~") {
|
|
370529
370583
|
customPath = home;
|
|
370530
370584
|
} else {
|
|
370531
|
-
customPath =
|
|
370585
|
+
customPath = path54.join(home, customPath.slice(2));
|
|
370532
370586
|
}
|
|
370533
370587
|
} catch (error2) {
|
|
370534
370588
|
debugLogger.warn(`Could not resolve home directory for path: ${trimmedEnvVar}`, error2);
|
|
@@ -370537,20 +370591,20 @@ function resolvePathFromEnv(envVar) {
|
|
|
370537
370591
|
}
|
|
370538
370592
|
return {
|
|
370539
370593
|
isSwitch: false,
|
|
370540
|
-
value:
|
|
370594
|
+
value: path54.resolve(customPath),
|
|
370541
370595
|
isDisabled: false
|
|
370542
370596
|
};
|
|
370543
370597
|
}
|
|
370544
370598
|
function getCoreSystemPrompt(config3, userMemory) {
|
|
370545
370599
|
let systemMdEnabled = false;
|
|
370546
|
-
let systemMdPath =
|
|
370600
|
+
let systemMdPath = path54.resolve(path54.join(GEMINI_DIR, "system.md"));
|
|
370547
370601
|
const systemMdResolution = resolvePathFromEnv(process21.env["GEMINI_SYSTEM_MD"]);
|
|
370548
370602
|
if (systemMdResolution.value && !systemMdResolution.isDisabled) {
|
|
370549
370603
|
systemMdEnabled = true;
|
|
370550
370604
|
if (!systemMdResolution.isSwitch) {
|
|
370551
370605
|
systemMdPath = systemMdResolution.value;
|
|
370552
370606
|
}
|
|
370553
|
-
if (!
|
|
370607
|
+
if (!fs49.existsSync(systemMdPath)) {
|
|
370554
370608
|
throw new Error(`missing system prompt file '${systemMdPath}'`);
|
|
370555
370609
|
}
|
|
370556
370610
|
}
|
|
@@ -370563,7 +370617,7 @@ function getCoreSystemPrompt(config3, userMemory) {
|
|
|
370563
370617
|
const interactiveMode = config3.isInteractiveShellEnabled();
|
|
370564
370618
|
let basePrompt;
|
|
370565
370619
|
if (systemMdEnabled) {
|
|
370566
|
-
basePrompt =
|
|
370620
|
+
basePrompt = fs49.readFileSync(systemMdPath, "utf8");
|
|
370567
370621
|
} else {
|
|
370568
370622
|
const promptConfig = {
|
|
370569
370623
|
preamble: `You are ${interactiveMode ? "an interactive " : "a non-interactive "}CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.`,
|
|
@@ -370769,8 +370823,8 @@ Your core function is efficient and safe assistance. Balance extreme conciseness
|
|
|
370769
370823
|
const writeSystemMdResolution = resolvePathFromEnv(process21.env["GEMINI_WRITE_SYSTEM_MD"]);
|
|
370770
370824
|
if (writeSystemMdResolution.value && !writeSystemMdResolution.isDisabled) {
|
|
370771
370825
|
const writePath = writeSystemMdResolution.isSwitch ? systemMdPath : writeSystemMdResolution.value;
|
|
370772
|
-
|
|
370773
|
-
|
|
370826
|
+
fs49.mkdirSync(path54.dirname(writePath), { recursive: true });
|
|
370827
|
+
fs49.writeFileSync(writePath, basePrompt);
|
|
370774
370828
|
}
|
|
370775
370829
|
const memorySuffix = userMemory && userMemory.trim().length > 0 ? `
|
|
370776
370830
|
|
|
@@ -371728,7 +371782,7 @@ var GeminiClient = class {
|
|
|
371728
371782
|
};
|
|
371729
371783
|
}
|
|
371730
371784
|
}
|
|
371731
|
-
|
|
371785
|
+
_getActiveModelForCurrentTurn() {
|
|
371732
371786
|
if (this.currentSequenceModel) {
|
|
371733
371787
|
return this.currentSequenceModel;
|
|
371734
371788
|
}
|
|
@@ -371771,7 +371825,7 @@ var GeminiClient = class {
|
|
|
371771
371825
|
if (!boundedTurns) {
|
|
371772
371826
|
return new Turn(this.getChat(), prompt_id);
|
|
371773
371827
|
}
|
|
371774
|
-
const modelForLimitCheck = this.
|
|
371828
|
+
const modelForLimitCheck = this._getActiveModelForCurrentTurn();
|
|
371775
371829
|
const estimatedRequestTokenCount = await calculateRequestTokenCount(request3, this.getContentGeneratorOrFail(), modelForLimitCheck);
|
|
371776
371830
|
const remainingTokenCount = tokenLimit(modelForLimitCheck) - this.getChat().getLastPromptTokenCount();
|
|
371777
371831
|
if (estimatedRequestTokenCount > remainingTokenCount * 0.95) {
|
|
@@ -371938,7 +371992,7 @@ var GeminiClient = class {
|
|
|
371938
371992
|
}
|
|
371939
371993
|
}
|
|
371940
371994
|
async tryCompressChat(prompt_id, force = false) {
|
|
371941
|
-
const model = this.
|
|
371995
|
+
const model = this._getActiveModelForCurrentTurn();
|
|
371942
371996
|
const { newHistory, info: info2 } = await this.compressionService.compress(this.getChat(), prompt_id, force, model, this.config, this.hasFailedCompressionAttempt);
|
|
371943
371997
|
if (info2.compressionStatus === CompressionStatus.COMPRESSION_FAILED_INFLATED_TOKEN_COUNT) {
|
|
371944
371998
|
this.hasFailedCompressionAttempt = this.hasFailedCompressionAttempt || !force;
|
|
@@ -371955,8 +372009,8 @@ var GeminiClient = class {
|
|
|
371955
372009
|
|
|
371956
372010
|
// packages/core/dist/src/utils/gitIgnoreParser.js
|
|
371957
372011
|
var import_ignore4 = __toESM(require_ignore(), 1);
|
|
371958
|
-
import * as
|
|
371959
|
-
import * as
|
|
372012
|
+
import * as fs50 from "node:fs";
|
|
372013
|
+
import * as path55 from "node:path";
|
|
371960
372014
|
var GitIgnoreParser = class {
|
|
371961
372015
|
extraPatterns;
|
|
371962
372016
|
projectRoot;
|
|
@@ -371965,7 +372019,7 @@ var GitIgnoreParser = class {
|
|
|
371965
372019
|
processedExtraPatterns = [];
|
|
371966
372020
|
constructor(projectRoot, extraPatterns) {
|
|
371967
372021
|
this.extraPatterns = extraPatterns;
|
|
371968
|
-
this.projectRoot =
|
|
372022
|
+
this.projectRoot = path55.resolve(projectRoot);
|
|
371969
372023
|
if (this.extraPatterns) {
|
|
371970
372024
|
this.processedExtraPatterns = this.processPatterns(this.extraPatterns, ".");
|
|
371971
372025
|
}
|
|
@@ -371973,12 +372027,12 @@ var GitIgnoreParser = class {
|
|
|
371973
372027
|
loadPatternsForFile(patternsFilePath) {
|
|
371974
372028
|
let content;
|
|
371975
372029
|
try {
|
|
371976
|
-
content =
|
|
372030
|
+
content = fs50.readFileSync(patternsFilePath, "utf-8");
|
|
371977
372031
|
} catch (_error) {
|
|
371978
372032
|
return [];
|
|
371979
372033
|
}
|
|
371980
|
-
const isExcludeFile = patternsFilePath.endsWith(
|
|
371981
|
-
const relativeBaseDir = isExcludeFile ? "." :
|
|
372034
|
+
const isExcludeFile = patternsFilePath.endsWith(path55.join(".git", "info", "exclude"));
|
|
372035
|
+
const relativeBaseDir = isExcludeFile ? "." : path55.dirname(path55.relative(this.projectRoot, patternsFilePath)).split(path55.sep).join(path55.posix.sep);
|
|
371982
372036
|
const rawPatterns = content.split("\n");
|
|
371983
372037
|
return this.processPatterns(rawPatterns, relativeBaseDir);
|
|
371984
372038
|
}
|
|
@@ -371998,9 +372052,9 @@ var GitIgnoreParser = class {
|
|
|
371998
372052
|
let newPattern = p;
|
|
371999
372053
|
if (relativeBaseDir && relativeBaseDir !== ".") {
|
|
372000
372054
|
if (!isAnchoredInFile && !p.includes("/")) {
|
|
372001
|
-
newPattern =
|
|
372055
|
+
newPattern = path55.posix.join("**", p);
|
|
372002
372056
|
}
|
|
372003
|
-
newPattern =
|
|
372057
|
+
newPattern = path55.posix.join(relativeBaseDir, newPattern);
|
|
372004
372058
|
if (!newPattern.startsWith("/")) {
|
|
372005
372059
|
newPattern = "/" + newPattern;
|
|
372006
372060
|
}
|
|
@@ -372018,13 +372072,13 @@ var GitIgnoreParser = class {
|
|
|
372018
372072
|
if (!filePath || typeof filePath !== "string") {
|
|
372019
372073
|
return false;
|
|
372020
372074
|
}
|
|
372021
|
-
const absoluteFilePath =
|
|
372075
|
+
const absoluteFilePath = path55.resolve(this.projectRoot, filePath);
|
|
372022
372076
|
if (!absoluteFilePath.startsWith(this.projectRoot)) {
|
|
372023
372077
|
return false;
|
|
372024
372078
|
}
|
|
372025
372079
|
try {
|
|
372026
|
-
const resolved =
|
|
372027
|
-
const relativePath =
|
|
372080
|
+
const resolved = path55.resolve(this.projectRoot, filePath);
|
|
372081
|
+
const relativePath = path55.relative(this.projectRoot, resolved);
|
|
372028
372082
|
if (relativePath === "" || relativePath.startsWith("..")) {
|
|
372029
372083
|
return false;
|
|
372030
372084
|
}
|
|
@@ -372035,19 +372089,19 @@ var GitIgnoreParser = class {
|
|
|
372035
372089
|
const ig = (0, import_ignore4.default)();
|
|
372036
372090
|
ig.add(".git");
|
|
372037
372091
|
if (this.globalPatterns === void 0) {
|
|
372038
|
-
const excludeFile =
|
|
372039
|
-
this.globalPatterns =
|
|
372092
|
+
const excludeFile = path55.join(this.projectRoot, ".git", "info", "exclude");
|
|
372093
|
+
this.globalPatterns = fs50.existsSync(excludeFile) ? this.loadPatternsForFile(excludeFile) : [];
|
|
372040
372094
|
}
|
|
372041
372095
|
ig.add(this.globalPatterns);
|
|
372042
|
-
const pathParts = relativePath.split(
|
|
372096
|
+
const pathParts = relativePath.split(path55.sep);
|
|
372043
372097
|
const dirsToVisit = [this.projectRoot];
|
|
372044
372098
|
let currentAbsDir = this.projectRoot;
|
|
372045
372099
|
for (let i4 = 0; i4 < pathParts.length - 1; i4++) {
|
|
372046
|
-
currentAbsDir =
|
|
372100
|
+
currentAbsDir = path55.join(currentAbsDir, pathParts[i4]);
|
|
372047
372101
|
dirsToVisit.push(currentAbsDir);
|
|
372048
372102
|
}
|
|
372049
372103
|
for (const dir of dirsToVisit) {
|
|
372050
|
-
const relativeDir =
|
|
372104
|
+
const relativeDir = path55.relative(this.projectRoot, dir);
|
|
372051
372105
|
if (relativeDir) {
|
|
372052
372106
|
const normalizedRelativeDir = relativeDir.replace(/\\/g, "/");
|
|
372053
372107
|
const igPlusExtras = (0, import_ignore4.default)().add(ig).add(this.processedExtraPatterns);
|
|
@@ -372061,8 +372115,8 @@ var GitIgnoreParser = class {
|
|
|
372061
372115
|
ig.add(patterns);
|
|
372062
372116
|
}
|
|
372063
372117
|
} else {
|
|
372064
|
-
const gitignorePath =
|
|
372065
|
-
if (
|
|
372118
|
+
const gitignorePath = path55.join(dir, ".gitignore");
|
|
372119
|
+
if (fs50.existsSync(gitignorePath)) {
|
|
372066
372120
|
const patterns = this.loadPatternsForFile(gitignorePath);
|
|
372067
372121
|
this.cache.set(dir, patterns);
|
|
372068
372122
|
ig.add(patterns);
|
|
@@ -372082,14 +372136,14 @@ var GitIgnoreParser = class {
|
|
|
372082
372136
|
};
|
|
372083
372137
|
|
|
372084
372138
|
// packages/core/dist/src/services/fileDiscoveryService.js
|
|
372085
|
-
import * as
|
|
372139
|
+
import * as path56 from "node:path";
|
|
372086
372140
|
var FileDiscoveryService = class {
|
|
372087
372141
|
gitIgnoreFilter = null;
|
|
372088
372142
|
geminiIgnoreFilter = null;
|
|
372089
372143
|
combinedIgnoreFilter = null;
|
|
372090
372144
|
projectRoot;
|
|
372091
372145
|
constructor(projectRoot) {
|
|
372092
|
-
this.projectRoot =
|
|
372146
|
+
this.projectRoot = path56.resolve(projectRoot);
|
|
372093
372147
|
if (isGitRepository(this.projectRoot)) {
|
|
372094
372148
|
this.gitIgnoreFilter = new GitIgnoreParser(this.projectRoot);
|
|
372095
372149
|
}
|
|
@@ -372141,8 +372195,8 @@ var FileDiscoveryService = class {
|
|
|
372141
372195
|
};
|
|
372142
372196
|
|
|
372143
372197
|
// packages/core/dist/src/services/gitService.js
|
|
372144
|
-
import * as
|
|
372145
|
-
import * as
|
|
372198
|
+
import * as fs51 from "node:fs/promises";
|
|
372199
|
+
import * as path57 from "node:path";
|
|
372146
372200
|
|
|
372147
372201
|
// node_modules/simple-git/dist/esm/index.js
|
|
372148
372202
|
var import_file_exists = __toESM(require_dist8(), 1);
|
|
@@ -376670,7 +376724,7 @@ var GitService = class {
|
|
|
376670
376724
|
projectRoot;
|
|
376671
376725
|
storage;
|
|
376672
376726
|
constructor(projectRoot, storage2) {
|
|
376673
|
-
this.projectRoot =
|
|
376727
|
+
this.projectRoot = path57.resolve(projectRoot);
|
|
376674
376728
|
this.storage = storage2;
|
|
376675
376729
|
}
|
|
376676
376730
|
getHistoryDir() {
|
|
@@ -376701,34 +376755,39 @@ var GitService = class {
|
|
|
376701
376755
|
*/
|
|
376702
376756
|
async setupShadowGitRepository() {
|
|
376703
376757
|
const repoDir = this.getHistoryDir();
|
|
376704
|
-
const gitConfigPath =
|
|
376705
|
-
await
|
|
376758
|
+
const gitConfigPath = path57.join(repoDir, ".gitconfig");
|
|
376759
|
+
await fs51.mkdir(repoDir, { recursive: true });
|
|
376706
376760
|
const gitConfigContent = "[user]\n name = Gemini CLI\n email = gemini-cli@google.com\n[commit]\n gpgsign = false\n";
|
|
376707
|
-
await
|
|
376761
|
+
await fs51.writeFile(gitConfigPath, gitConfigContent);
|
|
376708
376762
|
const repo = simpleGit(repoDir);
|
|
376709
|
-
|
|
376763
|
+
let isRepoDefined = false;
|
|
376764
|
+
try {
|
|
376765
|
+
isRepoDefined = await repo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT);
|
|
376766
|
+
} catch (error2) {
|
|
376767
|
+
debugLogger.debug(`checkIsRepo failed, will initialize repository: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
376768
|
+
}
|
|
376710
376769
|
if (!isRepoDefined) {
|
|
376711
376770
|
await repo.init(false, {
|
|
376712
376771
|
"--initial-branch": "main"
|
|
376713
376772
|
});
|
|
376714
376773
|
await repo.commit("Initial commit", { "--allow-empty": null });
|
|
376715
376774
|
}
|
|
376716
|
-
const userGitIgnorePath =
|
|
376717
|
-
const shadowGitIgnorePath =
|
|
376775
|
+
const userGitIgnorePath = path57.join(this.projectRoot, ".gitignore");
|
|
376776
|
+
const shadowGitIgnorePath = path57.join(repoDir, ".gitignore");
|
|
376718
376777
|
let userGitIgnoreContent = "";
|
|
376719
376778
|
try {
|
|
376720
|
-
userGitIgnoreContent = await
|
|
376779
|
+
userGitIgnoreContent = await fs51.readFile(userGitIgnorePath, "utf-8");
|
|
376721
376780
|
} catch (error2) {
|
|
376722
376781
|
if (isNodeError(error2) && error2.code !== "ENOENT") {
|
|
376723
376782
|
throw error2;
|
|
376724
376783
|
}
|
|
376725
376784
|
}
|
|
376726
|
-
await
|
|
376785
|
+
await fs51.writeFile(shadowGitIgnorePath, userGitIgnoreContent);
|
|
376727
376786
|
}
|
|
376728
376787
|
get shadowGitRepository() {
|
|
376729
376788
|
const repoDir = this.getHistoryDir();
|
|
376730
376789
|
return simpleGit(this.projectRoot).env({
|
|
376731
|
-
GIT_DIR:
|
|
376790
|
+
GIT_DIR: path57.join(repoDir, ".git"),
|
|
376732
376791
|
GIT_WORK_TREE: this.projectRoot,
|
|
376733
376792
|
// Prevent git from using the user's global git config.
|
|
376734
376793
|
HOME: repoDir,
|
|
@@ -376790,13 +376849,13 @@ function shouldAttemptBrowserLaunch() {
|
|
|
376790
376849
|
}
|
|
376791
376850
|
|
|
376792
376851
|
// packages/core/dist/src/services/fileSystemService.js
|
|
376793
|
-
import
|
|
376852
|
+
import fs52 from "node:fs/promises";
|
|
376794
376853
|
var StandardFileSystemService = class {
|
|
376795
376854
|
async readTextFile(filePath) {
|
|
376796
|
-
return
|
|
376855
|
+
return fs52.readFile(filePath, "utf-8");
|
|
376797
376856
|
}
|
|
376798
376857
|
async writeTextFile(filePath, content) {
|
|
376799
|
-
await
|
|
376858
|
+
await fs52.writeFile(filePath, content, "utf-8");
|
|
376800
376859
|
}
|
|
376801
376860
|
};
|
|
376802
376861
|
|
|
@@ -377117,7 +377176,7 @@ var OverrideStrategy = class {
|
|
|
377117
377176
|
if (overrideModel === DEFAULT_GEMINI_MODEL_AUTO || overrideModel === PREVIEW_GEMINI_MODEL_AUTO)
|
|
377118
377177
|
return null;
|
|
377119
377178
|
return {
|
|
377120
|
-
model:
|
|
377179
|
+
model: resolveModel(overrideModel, config3.getPreviewFeatures()),
|
|
377121
377180
|
metadata: {
|
|
377122
377181
|
source: this.name,
|
|
377123
377182
|
latencyMs: 0,
|
|
@@ -377553,14 +377612,14 @@ var DEFAULT_MODEL_CONFIGS = {
|
|
|
377553
377612
|
};
|
|
377554
377613
|
|
|
377555
377614
|
// packages/core/dist/src/utils/memoryDiscovery.js
|
|
377556
|
-
import * as
|
|
377615
|
+
import * as fs54 from "node:fs/promises";
|
|
377557
377616
|
import * as fsSync2 from "node:fs";
|
|
377558
|
-
import * as
|
|
377617
|
+
import * as path59 from "node:path";
|
|
377559
377618
|
import { homedir as homedir4 } from "node:os";
|
|
377560
377619
|
|
|
377561
377620
|
// packages/core/dist/src/utils/memoryImportProcessor.js
|
|
377562
|
-
import * as
|
|
377563
|
-
import * as
|
|
377621
|
+
import * as fs53 from "node:fs/promises";
|
|
377622
|
+
import * as path58 from "node:path";
|
|
377564
377623
|
|
|
377565
377624
|
// node_modules/marked/lib/marked.esm.js
|
|
377566
377625
|
function _getDefaults() {
|
|
@@ -379708,23 +379767,23 @@ var logger4 = {
|
|
|
379708
379767
|
error: (...args2) => debugLogger.error("[ERROR] [ImportProcessor]", ...args2)
|
|
379709
379768
|
};
|
|
379710
379769
|
async function findProjectRoot(startDir) {
|
|
379711
|
-
let currentDir =
|
|
379770
|
+
let currentDir = path58.resolve(startDir);
|
|
379712
379771
|
while (true) {
|
|
379713
|
-
const gitPath =
|
|
379772
|
+
const gitPath = path58.join(currentDir, ".git");
|
|
379714
379773
|
try {
|
|
379715
|
-
const stats = await
|
|
379774
|
+
const stats = await fs53.lstat(gitPath);
|
|
379716
379775
|
if (stats.isDirectory()) {
|
|
379717
379776
|
return currentDir;
|
|
379718
379777
|
}
|
|
379719
379778
|
} catch {
|
|
379720
379779
|
}
|
|
379721
|
-
const parentDir =
|
|
379780
|
+
const parentDir = path58.dirname(currentDir);
|
|
379722
379781
|
if (parentDir === currentDir) {
|
|
379723
379782
|
break;
|
|
379724
379783
|
}
|
|
379725
379784
|
currentDir = parentDir;
|
|
379726
379785
|
}
|
|
379727
|
-
return
|
|
379786
|
+
return path58.resolve(startDir);
|
|
379728
379787
|
}
|
|
379729
379788
|
function hasMessage(err2) {
|
|
379730
379789
|
return typeof err2 === "object" && err2 !== null && "message" in err2 && typeof err2.message === "string";
|
|
@@ -379813,7 +379872,7 @@ async function processImports(content, basePath, debugMode = false, importState
|
|
|
379813
379872
|
const flatFiles = [];
|
|
379814
379873
|
const processedFiles = /* @__PURE__ */ new Set();
|
|
379815
379874
|
async function processFlat(fileContent, fileBasePath, filePath, depth) {
|
|
379816
|
-
const normalizedPath =
|
|
379875
|
+
const normalizedPath = path58.normalize(filePath);
|
|
379817
379876
|
if (processedFiles.has(normalizedPath))
|
|
379818
379877
|
return;
|
|
379819
379878
|
processedFiles.add(normalizedPath);
|
|
@@ -379828,14 +379887,14 @@ async function processImports(content, basePath, debugMode = false, importState
|
|
|
379828
379887
|
if (!validateImportPath(importPath, fileBasePath, [projectRoot || ""])) {
|
|
379829
379888
|
continue;
|
|
379830
379889
|
}
|
|
379831
|
-
const fullPath =
|
|
379832
|
-
const normalizedFullPath =
|
|
379890
|
+
const fullPath = path58.resolve(fileBasePath, importPath);
|
|
379891
|
+
const normalizedFullPath = path58.normalize(fullPath);
|
|
379833
379892
|
if (processedFiles.has(normalizedFullPath))
|
|
379834
379893
|
continue;
|
|
379835
379894
|
try {
|
|
379836
|
-
await
|
|
379837
|
-
const importedContent = await
|
|
379838
|
-
await processFlat(importedContent,
|
|
379895
|
+
await fs53.access(fullPath);
|
|
379896
|
+
const importedContent = await fs53.readFile(fullPath, "utf-8");
|
|
379897
|
+
await processFlat(importedContent, path58.dirname(fullPath), normalizedFullPath, depth + 1);
|
|
379839
379898
|
} catch (error2) {
|
|
379840
379899
|
if (debugMode) {
|
|
379841
379900
|
logger4.warn(`Failed to import ${fullPath}: ${hasMessage(error2) ? error2.message : "Unknown error"}`);
|
|
@@ -379843,7 +379902,7 @@ async function processImports(content, basePath, debugMode = false, importState
|
|
|
379843
379902
|
}
|
|
379844
379903
|
}
|
|
379845
379904
|
}
|
|
379846
|
-
const rootPath =
|
|
379905
|
+
const rootPath = path58.normalize(importState.currentFile || path58.resolve(basePath));
|
|
379847
379906
|
await processFlat(content, basePath, rootPath, 0);
|
|
379848
379907
|
const flatContent = flatFiles.map((f3) => `--- File: ${f3.path} ---
|
|
379849
379908
|
${f3.content.trim()}
|
|
@@ -379870,14 +379929,14 @@ ${f3.content.trim()}
|
|
|
379870
379929
|
result += `<!-- Import failed: ${importPath} - Path traversal attempt -->`;
|
|
379871
379930
|
continue;
|
|
379872
379931
|
}
|
|
379873
|
-
const fullPath =
|
|
379932
|
+
const fullPath = path58.resolve(basePath, importPath);
|
|
379874
379933
|
if (importState.processedFiles.has(fullPath)) {
|
|
379875
379934
|
result += `<!-- File already processed: ${importPath} -->`;
|
|
379876
379935
|
continue;
|
|
379877
379936
|
}
|
|
379878
379937
|
try {
|
|
379879
|
-
await
|
|
379880
|
-
const fileContent = await
|
|
379938
|
+
await fs53.access(fullPath);
|
|
379939
|
+
const fileContent = await fs53.readFile(fullPath, "utf-8");
|
|
379881
379940
|
const newImportState = {
|
|
379882
379941
|
...importState,
|
|
379883
379942
|
processedFiles: new Set(importState.processedFiles),
|
|
@@ -379885,7 +379944,7 @@ ${f3.content.trim()}
|
|
|
379885
379944
|
currentFile: fullPath
|
|
379886
379945
|
};
|
|
379887
379946
|
newImportState.processedFiles.add(fullPath);
|
|
379888
|
-
const imported = await processImports(fileContent,
|
|
379947
|
+
const imported = await processImports(fileContent, path58.dirname(fullPath), debugMode, newImportState, projectRoot, importFormat);
|
|
379889
379948
|
result += `<!-- Imported from: ${importPath} -->
|
|
379890
379949
|
${imported.content}
|
|
379891
379950
|
<!-- End of import from: ${importPath} -->`;
|
|
@@ -379914,7 +379973,7 @@ function validateImportPath(importPath, basePath, allowedDirectories) {
|
|
|
379914
379973
|
if (/^(file|https?):\/\//.test(importPath)) {
|
|
379915
379974
|
return false;
|
|
379916
379975
|
}
|
|
379917
|
-
const resolvedPath =
|
|
379976
|
+
const resolvedPath = path58.resolve(basePath, importPath);
|
|
379918
379977
|
return allowedDirectories.some((allowedDir) => isSubpath(allowedDir, resolvedPath));
|
|
379919
379978
|
}
|
|
379920
379979
|
|
|
@@ -379929,11 +379988,11 @@ var logger5 = {
|
|
|
379929
379988
|
error: (...args2) => console.error("[ERROR] [MemoryDiscovery]", ...args2)
|
|
379930
379989
|
};
|
|
379931
379990
|
async function findProjectRoot2(startDir) {
|
|
379932
|
-
let currentDir =
|
|
379991
|
+
let currentDir = path59.resolve(startDir);
|
|
379933
379992
|
while (true) {
|
|
379934
|
-
const gitPath =
|
|
379993
|
+
const gitPath = path59.join(currentDir, ".git");
|
|
379935
379994
|
try {
|
|
379936
|
-
const stats = await
|
|
379995
|
+
const stats = await fs54.lstat(gitPath);
|
|
379937
379996
|
if (stats.isDirectory()) {
|
|
379938
379997
|
return currentDir;
|
|
379939
379998
|
}
|
|
@@ -379949,7 +380008,7 @@ async function findProjectRoot2(startDir) {
|
|
|
379949
380008
|
}
|
|
379950
380009
|
}
|
|
379951
380010
|
}
|
|
379952
|
-
const parentDir =
|
|
380011
|
+
const parentDir = path59.dirname(currentDir);
|
|
379953
380012
|
if (parentDir === currentDir) {
|
|
379954
380013
|
return null;
|
|
379955
380014
|
}
|
|
@@ -379985,17 +380044,17 @@ async function getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, debugMo
|
|
|
379985
380044
|
const allPaths = /* @__PURE__ */ new Set();
|
|
379986
380045
|
const geminiMdFilenames = getAllGeminiMdFilenames();
|
|
379987
380046
|
for (const geminiMdFilename of geminiMdFilenames) {
|
|
379988
|
-
const resolvedHome =
|
|
379989
|
-
const globalMemoryPath =
|
|
380047
|
+
const resolvedHome = path59.resolve(userHomePath);
|
|
380048
|
+
const globalMemoryPath = path59.join(resolvedHome, GEMINI_DIR, geminiMdFilename);
|
|
379990
380049
|
try {
|
|
379991
|
-
await
|
|
380050
|
+
await fs54.access(globalMemoryPath, fsSync2.constants.R_OK);
|
|
379992
380051
|
allPaths.add(globalMemoryPath);
|
|
379993
380052
|
if (debugMode)
|
|
379994
380053
|
logger5.debug(`Found readable global ${geminiMdFilename}: ${globalMemoryPath}`);
|
|
379995
380054
|
} catch {
|
|
379996
380055
|
}
|
|
379997
380056
|
if (dir && folderTrust) {
|
|
379998
|
-
const resolvedCwd =
|
|
380057
|
+
const resolvedCwd = path59.resolve(dir);
|
|
379999
380058
|
if (debugMode)
|
|
380000
380059
|
logger5.debug(`Searching for ${geminiMdFilename} starting from CWD: ${resolvedCwd}`);
|
|
380001
380060
|
const projectRoot = await findProjectRoot2(resolvedCwd);
|
|
@@ -380003,14 +380062,14 @@ async function getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, debugMo
|
|
|
380003
380062
|
logger5.debug(`Determined project root: ${projectRoot ?? "None"}`);
|
|
380004
380063
|
const upwardPaths = [];
|
|
380005
380064
|
let currentDir = resolvedCwd;
|
|
380006
|
-
const ultimateStopDir = projectRoot ?
|
|
380007
|
-
while (currentDir && currentDir !==
|
|
380008
|
-
if (currentDir ===
|
|
380065
|
+
const ultimateStopDir = projectRoot ? path59.dirname(projectRoot) : path59.dirname(resolvedHome);
|
|
380066
|
+
while (currentDir && currentDir !== path59.dirname(currentDir)) {
|
|
380067
|
+
if (currentDir === path59.join(resolvedHome, GEMINI_DIR)) {
|
|
380009
380068
|
break;
|
|
380010
380069
|
}
|
|
380011
|
-
const potentialPath =
|
|
380070
|
+
const potentialPath = path59.join(currentDir, geminiMdFilename);
|
|
380012
380071
|
try {
|
|
380013
|
-
await
|
|
380072
|
+
await fs54.access(potentialPath, fsSync2.constants.R_OK);
|
|
380014
380073
|
if (potentialPath !== globalMemoryPath) {
|
|
380015
380074
|
upwardPaths.unshift(potentialPath);
|
|
380016
380075
|
}
|
|
@@ -380019,7 +380078,7 @@ async function getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, debugMo
|
|
|
380019
380078
|
if (currentDir === ultimateStopDir) {
|
|
380020
380079
|
break;
|
|
380021
380080
|
}
|
|
380022
|
-
currentDir =
|
|
380081
|
+
currentDir = path59.dirname(currentDir);
|
|
380023
380082
|
}
|
|
380024
380083
|
upwardPaths.forEach((p) => allPaths.add(p));
|
|
380025
380084
|
const mergedOptions = {
|
|
@@ -380051,8 +380110,8 @@ async function readGeminiMdFiles(filePaths, debugMode, importFormat = "tree") {
|
|
|
380051
380110
|
const batch = filePaths.slice(i4, i4 + CONCURRENT_LIMIT);
|
|
380052
380111
|
const batchPromises = batch.map(async (filePath) => {
|
|
380053
380112
|
try {
|
|
380054
|
-
const content = await
|
|
380055
|
-
const processedResult = await processImports(content,
|
|
380113
|
+
const content = await fs54.readFile(filePath, "utf-8");
|
|
380114
|
+
const processedResult = await processImports(content, path59.dirname(filePath), debugMode, void 0, void 0, importFormat);
|
|
380056
380115
|
if (debugMode)
|
|
380057
380116
|
logger5.debug(`Successfully read and processed imports: ${filePath} (Length: ${processedResult.content.length})`);
|
|
380058
380117
|
return { filePath, content: processedResult.content };
|
|
@@ -380086,7 +380145,7 @@ function concatenateInstructions(instructionContents, currentWorkingDirectoryFor
|
|
|
380086
380145
|
if (trimmedContent.length === 0) {
|
|
380087
380146
|
return null;
|
|
380088
380147
|
}
|
|
380089
|
-
const displayPath =
|
|
380148
|
+
const displayPath = path59.isAbsolute(item.filePath) ? path59.relative(currentWorkingDirectoryForDisplay, item.filePath) : item.filePath;
|
|
380090
380149
|
return `--- Context from: ${displayPath} ---
|
|
380091
380150
|
${trimmedContent}
|
|
380092
380151
|
--- End of Context from: ${displayPath} ---`;
|
|
@@ -380096,9 +380155,9 @@ async function loadGlobalMemory(debugMode = false) {
|
|
|
380096
380155
|
const userHome = homedir4();
|
|
380097
380156
|
const geminiMdFilenames = getAllGeminiMdFilenames();
|
|
380098
380157
|
const accessChecks = geminiMdFilenames.map(async (filename) => {
|
|
380099
|
-
const globalPath =
|
|
380158
|
+
const globalPath = path59.join(userHome, GEMINI_DIR, filename);
|
|
380100
380159
|
try {
|
|
380101
|
-
await
|
|
380160
|
+
await fs54.access(globalPath, fsSync2.constants.R_OK);
|
|
380102
380161
|
if (debugMode) {
|
|
380103
380162
|
logger5.debug(`Found global memory file: ${globalPath}`);
|
|
380104
380163
|
}
|
|
@@ -380119,10 +380178,10 @@ async function loadGlobalMemory(debugMode = false) {
|
|
|
380119
380178
|
}
|
|
380120
380179
|
async function findUpwardGeminiFiles(startDir, stopDir, debugMode) {
|
|
380121
380180
|
const upwardPaths = [];
|
|
380122
|
-
let currentDir =
|
|
380123
|
-
const resolvedStopDir =
|
|
380181
|
+
let currentDir = path59.resolve(startDir);
|
|
380182
|
+
const resolvedStopDir = path59.resolve(stopDir);
|
|
380124
380183
|
const geminiMdFilenames = getAllGeminiMdFilenames();
|
|
380125
|
-
const globalGeminiDir =
|
|
380184
|
+
const globalGeminiDir = path59.join(homedir4(), GEMINI_DIR);
|
|
380126
380185
|
if (debugMode) {
|
|
380127
380186
|
logger5.debug(`Starting upward search from ${currentDir} stopping at ${resolvedStopDir}`);
|
|
380128
380187
|
}
|
|
@@ -380131,9 +380190,9 @@ async function findUpwardGeminiFiles(startDir, stopDir, debugMode) {
|
|
|
380131
380190
|
break;
|
|
380132
380191
|
}
|
|
380133
380192
|
const accessChecks = geminiMdFilenames.map(async (filename) => {
|
|
380134
|
-
const potentialPath =
|
|
380193
|
+
const potentialPath = path59.join(currentDir, filename);
|
|
380135
380194
|
try {
|
|
380136
|
-
await
|
|
380195
|
+
await fs54.access(potentialPath, fsSync2.constants.R_OK);
|
|
380137
380196
|
return potentialPath;
|
|
380138
380197
|
} catch {
|
|
380139
380198
|
return null;
|
|
@@ -380141,17 +380200,17 @@ async function findUpwardGeminiFiles(startDir, stopDir, debugMode) {
|
|
|
380141
380200
|
});
|
|
380142
380201
|
const foundPathsInDir = (await Promise.all(accessChecks)).filter((p) => p !== null);
|
|
380143
380202
|
upwardPaths.unshift(...foundPathsInDir);
|
|
380144
|
-
if (currentDir === resolvedStopDir || currentDir ===
|
|
380203
|
+
if (currentDir === resolvedStopDir || currentDir === path59.dirname(currentDir)) {
|
|
380145
380204
|
break;
|
|
380146
380205
|
}
|
|
380147
|
-
currentDir =
|
|
380206
|
+
currentDir = path59.dirname(currentDir);
|
|
380148
380207
|
}
|
|
380149
380208
|
return upwardPaths;
|
|
380150
380209
|
}
|
|
380151
380210
|
async function loadEnvironmentMemory(trustedRoots, extensionLoader, debugMode = false) {
|
|
380152
380211
|
const allPaths = /* @__PURE__ */ new Set();
|
|
380153
380212
|
const traversalPromises = trustedRoots.map(async (root) => {
|
|
380154
|
-
const resolvedRoot =
|
|
380213
|
+
const resolvedRoot = path59.resolve(root);
|
|
380155
380214
|
if (debugMode) {
|
|
380156
380215
|
logger5.debug(`Loading environment memory for trusted root: ${resolvedRoot} (Stopping exactly here)`);
|
|
380157
380216
|
}
|
|
@@ -380171,8 +380230,8 @@ async function loadEnvironmentMemory(trustedRoots, extensionLoader, debugMode =
|
|
|
380171
380230
|
};
|
|
380172
380231
|
}
|
|
380173
380232
|
async function loadServerHierarchicalMemory(currentWorkingDirectory, includeDirectoriesToReadGemini, debugMode, fileService, extensionLoader, folderTrust, importFormat = "tree", fileFilteringOptions, maxDirs = 200) {
|
|
380174
|
-
const realCwd = await
|
|
380175
|
-
const realHome = await
|
|
380233
|
+
const realCwd = await fs54.realpath(path59.resolve(currentWorkingDirectory));
|
|
380234
|
+
const realHome = await fs54.realpath(path59.resolve(homedir4()));
|
|
380176
380235
|
const isHomeDirectory = realCwd === realHome;
|
|
380177
380236
|
currentWorkingDirectory = isHomeDirectory ? "" : currentWorkingDirectory;
|
|
380178
380237
|
if (debugMode)
|
|
@@ -380208,10 +380267,10 @@ async function refreshServerHierarchicalMemory(config3) {
|
|
|
380208
380267
|
return result;
|
|
380209
380268
|
}
|
|
380210
380269
|
async function loadJitSubdirectoryMemory(targetPath, trustedRoots, alreadyLoadedPaths, debugMode = false) {
|
|
380211
|
-
const resolvedTarget =
|
|
380270
|
+
const resolvedTarget = path59.resolve(targetPath);
|
|
380212
380271
|
let bestRoot = null;
|
|
380213
380272
|
for (const root of trustedRoots) {
|
|
380214
|
-
const resolvedRoot =
|
|
380273
|
+
const resolvedRoot = path59.resolve(root);
|
|
380215
380274
|
if (resolvedTarget.startsWith(resolvedRoot) && (!bestRoot || resolvedRoot.length > bestRoot.length)) {
|
|
380216
380275
|
bestRoot = resolvedRoot;
|
|
380217
380276
|
}
|
|
@@ -380307,8 +380366,8 @@ var ContextManager = class {
|
|
|
380307
380366
|
};
|
|
380308
380367
|
|
|
380309
380368
|
// packages/core/dist/src/utils/workspaceContext.js
|
|
380310
|
-
import * as
|
|
380311
|
-
import * as
|
|
380369
|
+
import * as fs55 from "node:fs";
|
|
380370
|
+
import * as path60 from "node:path";
|
|
380312
380371
|
var WorkspaceContext = class {
|
|
380313
380372
|
targetDir;
|
|
380314
380373
|
directories = /* @__PURE__ */ new Set();
|
|
@@ -380365,15 +380424,15 @@ var WorkspaceContext = class {
|
|
|
380365
380424
|
}
|
|
380366
380425
|
}
|
|
380367
380426
|
resolveAndValidateDir(directory) {
|
|
380368
|
-
const absolutePath =
|
|
380369
|
-
if (!
|
|
380427
|
+
const absolutePath = path60.resolve(this.targetDir, directory);
|
|
380428
|
+
if (!fs55.existsSync(absolutePath)) {
|
|
380370
380429
|
throw new Error(`Directory does not exist: ${absolutePath}`);
|
|
380371
380430
|
}
|
|
380372
|
-
const stats =
|
|
380431
|
+
const stats = fs55.statSync(absolutePath);
|
|
380373
380432
|
if (!stats.isDirectory()) {
|
|
380374
380433
|
throw new Error(`Path is not a directory: ${absolutePath}`);
|
|
380375
380434
|
}
|
|
380376
|
-
return
|
|
380435
|
+
return fs55.realpathSync(absolutePath);
|
|
380377
380436
|
}
|
|
380378
380437
|
/**
|
|
380379
380438
|
* Gets a copy of all workspace directories.
|
|
@@ -380420,7 +380479,7 @@ var WorkspaceContext = class {
|
|
|
380420
380479
|
*/
|
|
380421
380480
|
fullyResolvedPath(pathToCheck) {
|
|
380422
380481
|
try {
|
|
380423
|
-
return
|
|
380482
|
+
return fs55.realpathSync(path60.resolve(this.targetDir, pathToCheck));
|
|
380424
380483
|
} catch (e3) {
|
|
380425
380484
|
if (isNodeError(e3) && e3.code === "ENOENT" && e3.path && // realpathSync does not set e.path correctly for symlinks to
|
|
380426
380485
|
// non-existent files.
|
|
@@ -380437,15 +380496,15 @@ var WorkspaceContext = class {
|
|
|
380437
380496
|
* @returns True if the path is within the root directory, false otherwise
|
|
380438
380497
|
*/
|
|
380439
380498
|
isPathWithinRoot(pathToCheck, rootDirectory) {
|
|
380440
|
-
const relative5 =
|
|
380441
|
-
return !relative5.startsWith(`..${
|
|
380499
|
+
const relative5 = path60.relative(rootDirectory, pathToCheck);
|
|
380500
|
+
return !relative5.startsWith(`..${path60.sep}`) && relative5 !== ".." && !path60.isAbsolute(relative5);
|
|
380442
380501
|
}
|
|
380443
380502
|
/**
|
|
380444
380503
|
* Checks if a file path is a symbolic link that points to a file.
|
|
380445
380504
|
*/
|
|
380446
380505
|
isFileSymlink(filePath) {
|
|
380447
380506
|
try {
|
|
380448
|
-
return !
|
|
380507
|
+
return !fs55.readlinkSync(filePath).endsWith("/");
|
|
380449
380508
|
} catch (_error) {
|
|
380450
380509
|
return false;
|
|
380451
380510
|
}
|
|
@@ -380638,7 +380697,12 @@ var SafetyCheckDecision;
|
|
|
380638
380697
|
})(SafetyCheckDecision || (SafetyCheckDecision = {}));
|
|
380639
380698
|
|
|
380640
380699
|
// packages/core/dist/src/policy/policy-engine.js
|
|
380641
|
-
function ruleMatches(rule, toolCall, stringifiedArgs, serverName) {
|
|
380700
|
+
function ruleMatches(rule, toolCall, stringifiedArgs, serverName, currentApprovalMode) {
|
|
380701
|
+
if (rule.modes && rule.modes.length > 0) {
|
|
380702
|
+
if (!rule.modes.includes(currentApprovalMode)) {
|
|
380703
|
+
return false;
|
|
380704
|
+
}
|
|
380705
|
+
}
|
|
380642
380706
|
if (rule.toolName) {
|
|
380643
380707
|
if (rule.toolName.endsWith("__*")) {
|
|
380644
380708
|
const prefix = rule.toolName.slice(0, -3);
|
|
@@ -380681,6 +380745,7 @@ var PolicyEngine = class {
|
|
|
380681
380745
|
nonInteractive;
|
|
380682
380746
|
checkerRunner;
|
|
380683
380747
|
allowHooks;
|
|
380748
|
+
approvalMode;
|
|
380684
380749
|
constructor(config3 = {}, checkerRunner) {
|
|
380685
380750
|
this.rules = (config3.rules ?? []).sort((a2, b) => (b.priority ?? 0) - (a2.priority ?? 0));
|
|
380686
380751
|
this.checkers = (config3.checkers ?? []).sort((a2, b) => (b.priority ?? 0) - (a2.priority ?? 0));
|
|
@@ -380689,6 +380754,19 @@ var PolicyEngine = class {
|
|
|
380689
380754
|
this.nonInteractive = config3.nonInteractive ?? false;
|
|
380690
380755
|
this.checkerRunner = checkerRunner;
|
|
380691
380756
|
this.allowHooks = config3.allowHooks ?? true;
|
|
380757
|
+
this.approvalMode = config3.approvalMode ?? ApprovalMode.DEFAULT;
|
|
380758
|
+
}
|
|
380759
|
+
/**
|
|
380760
|
+
* Update the current approval mode.
|
|
380761
|
+
*/
|
|
380762
|
+
setApprovalMode(mode) {
|
|
380763
|
+
this.approvalMode = mode;
|
|
380764
|
+
}
|
|
380765
|
+
/**
|
|
380766
|
+
* Get the current approval mode.
|
|
380767
|
+
*/
|
|
380768
|
+
getApprovalMode() {
|
|
380769
|
+
return this.approvalMode;
|
|
380692
380770
|
}
|
|
380693
380771
|
/**
|
|
380694
380772
|
* Check if a tool call is allowed based on the configured policies.
|
|
@@ -380703,7 +380781,7 @@ var PolicyEngine = class {
|
|
|
380703
380781
|
let matchedRule;
|
|
380704
380782
|
let decision;
|
|
380705
380783
|
for (const rule of this.rules) {
|
|
380706
|
-
if (ruleMatches(rule, toolCall, stringifiedArgs, serverName)) {
|
|
380784
|
+
if (ruleMatches(rule, toolCall, stringifiedArgs, serverName, this.approvalMode)) {
|
|
380707
380785
|
debugLogger.debug(`[PolicyEngine.check] MATCHED rule: toolName=${rule.toolName}, decision=${rule.decision}, priority=${rule.priority}, argsPattern=${rule.argsPattern?.source || "none"}`);
|
|
380708
380786
|
if (toolCall.name && SHELL_TOOL_NAMES.includes(toolCall.name) && rule.decision === PolicyDecision.ALLOW) {
|
|
380709
380787
|
const command = toolCall.args?.command;
|
|
@@ -380749,7 +380827,7 @@ var PolicyEngine = class {
|
|
|
380749
380827
|
}
|
|
380750
380828
|
if (decision !== PolicyDecision.DENY && this.checkerRunner) {
|
|
380751
380829
|
for (const checkerRule of this.checkers) {
|
|
380752
|
-
if (ruleMatches(checkerRule, toolCall, stringifiedArgs, serverName)) {
|
|
380830
|
+
if (ruleMatches(checkerRule, toolCall, stringifiedArgs, serverName, this.approvalMode)) {
|
|
380753
380831
|
debugLogger.debug(`[PolicyEngine.check] Running safety checker: ${checkerRule.checker.name}`);
|
|
380754
380832
|
try {
|
|
380755
380833
|
const result = await this.checkerRunner.runChecker(toolCall, checkerRule.checker);
|
|
@@ -380870,14 +380948,88 @@ var PolicyEngine = class {
|
|
|
380870
380948
|
}
|
|
380871
380949
|
};
|
|
380872
380950
|
|
|
380951
|
+
// packages/core/dist/src/hooks/trustedHooks.js
|
|
380952
|
+
import * as fs56 from "node:fs";
|
|
380953
|
+
import * as path61 from "node:path";
|
|
380954
|
+
var TrustedHooksManager = class {
|
|
380955
|
+
configPath;
|
|
380956
|
+
trustedHooks = {};
|
|
380957
|
+
constructor() {
|
|
380958
|
+
this.configPath = path61.join(Storage2.getGlobalGeminiDir(), "trusted_hooks.json");
|
|
380959
|
+
this.load();
|
|
380960
|
+
}
|
|
380961
|
+
load() {
|
|
380962
|
+
try {
|
|
380963
|
+
if (fs56.existsSync(this.configPath)) {
|
|
380964
|
+
const content = fs56.readFileSync(this.configPath, "utf-8");
|
|
380965
|
+
this.trustedHooks = JSON.parse(content);
|
|
380966
|
+
}
|
|
380967
|
+
} catch (error2) {
|
|
380968
|
+
debugLogger.warn("Failed to load trusted hooks config", error2);
|
|
380969
|
+
this.trustedHooks = {};
|
|
380970
|
+
}
|
|
380971
|
+
}
|
|
380972
|
+
save() {
|
|
380973
|
+
try {
|
|
380974
|
+
const dir = path61.dirname(this.configPath);
|
|
380975
|
+
if (!fs56.existsSync(dir)) {
|
|
380976
|
+
fs56.mkdirSync(dir, { recursive: true });
|
|
380977
|
+
}
|
|
380978
|
+
fs56.writeFileSync(this.configPath, JSON.stringify(this.trustedHooks, null, 2));
|
|
380979
|
+
} catch (error2) {
|
|
380980
|
+
debugLogger.warn("Failed to save trusted hooks config", error2);
|
|
380981
|
+
}
|
|
380982
|
+
}
|
|
380983
|
+
/**
|
|
380984
|
+
* Get untrusted hooks for a project
|
|
380985
|
+
* @param projectPath Absolute path to the project root
|
|
380986
|
+
* @param hooks The hooks configuration to check
|
|
380987
|
+
* @returns List of untrusted hook commands/names
|
|
380988
|
+
*/
|
|
380989
|
+
getUntrustedHooks(projectPath, hooks) {
|
|
380990
|
+
const trustedKeys = new Set(this.trustedHooks[projectPath] || []);
|
|
380991
|
+
const untrusted = [];
|
|
380992
|
+
for (const eventName of Object.keys(hooks)) {
|
|
380993
|
+
const definitions = hooks[eventName];
|
|
380994
|
+
if (!Array.isArray(definitions))
|
|
380995
|
+
continue;
|
|
380996
|
+
for (const def2 of definitions) {
|
|
380997
|
+
if (!def2 || !Array.isArray(def2.hooks))
|
|
380998
|
+
continue;
|
|
380999
|
+
for (const hook of def2.hooks) {
|
|
381000
|
+
const key = getHookKey(hook);
|
|
381001
|
+
if (!trustedKeys.has(key)) {
|
|
381002
|
+
untrusted.push(hook.name || hook.command || "unknown-hook");
|
|
381003
|
+
}
|
|
381004
|
+
}
|
|
381005
|
+
}
|
|
381006
|
+
}
|
|
381007
|
+
return Array.from(new Set(untrusted));
|
|
381008
|
+
}
|
|
381009
|
+
/**
|
|
381010
|
+
* Trust all provided hooks for a project
|
|
381011
|
+
*/
|
|
381012
|
+
trustHooks(projectPath, hooks) {
|
|
381013
|
+
const currentTrusted = new Set(this.trustedHooks[projectPath] || []);
|
|
381014
|
+
for (const eventName of Object.keys(hooks)) {
|
|
381015
|
+
const definitions = hooks[eventName];
|
|
381016
|
+
if (!Array.isArray(definitions))
|
|
381017
|
+
continue;
|
|
381018
|
+
for (const def2 of definitions) {
|
|
381019
|
+
if (!def2 || !Array.isArray(def2.hooks))
|
|
381020
|
+
continue;
|
|
381021
|
+
for (const hook of def2.hooks) {
|
|
381022
|
+
currentTrusted.add(getHookKey(hook));
|
|
381023
|
+
}
|
|
381024
|
+
}
|
|
381025
|
+
}
|
|
381026
|
+
this.trustedHooks[projectPath] = Array.from(currentTrusted);
|
|
381027
|
+
this.save();
|
|
381028
|
+
}
|
|
381029
|
+
};
|
|
381030
|
+
|
|
380873
381031
|
// packages/core/dist/src/hooks/hookRegistry.js
|
|
380874
|
-
|
|
380875
|
-
(function(ConfigSource2) {
|
|
380876
|
-
ConfigSource2["Project"] = "project";
|
|
380877
|
-
ConfigSource2["User"] = "user";
|
|
380878
|
-
ConfigSource2["System"] = "system";
|
|
380879
|
-
ConfigSource2["Extensions"] = "extensions";
|
|
380880
|
-
})(ConfigSource || (ConfigSource = {}));
|
|
381032
|
+
init_events();
|
|
380881
381033
|
var HookRegistry = class {
|
|
380882
381034
|
config;
|
|
380883
381035
|
entries = [];
|
|
@@ -380928,13 +381080,43 @@ var HookRegistry = class {
|
|
|
380928
381080
|
getHookName(entry) {
|
|
380929
381081
|
return entry.config.name || entry.config.command || "unknown-command";
|
|
380930
381082
|
}
|
|
381083
|
+
/**
|
|
381084
|
+
* Check for untrusted project hooks and warn the user
|
|
381085
|
+
*/
|
|
381086
|
+
checkProjectHooksTrust() {
|
|
381087
|
+
const projectHooks = this.config.getProjectHooks();
|
|
381088
|
+
if (!projectHooks)
|
|
381089
|
+
return;
|
|
381090
|
+
try {
|
|
381091
|
+
const trustedHooksManager = new TrustedHooksManager();
|
|
381092
|
+
const untrusted = trustedHooksManager.getUntrustedHooks(this.config.getProjectRoot(), projectHooks);
|
|
381093
|
+
if (untrusted.length > 0) {
|
|
381094
|
+
const message = `WARNING: The following project-level hooks have been detected in this workspace:
|
|
381095
|
+
${untrusted.map((h3) => ` - ${h3}`).join("\n")}
|
|
381096
|
+
|
|
381097
|
+
These hooks will be executed. If you did not configure these hooks or do not trust this project,
|
|
381098
|
+
please review the project settings (.gemini/settings.json) and remove them.`;
|
|
381099
|
+
coreEvents.emitFeedback("warning", message);
|
|
381100
|
+
trustedHooksManager.trustHooks(this.config.getProjectRoot(), projectHooks);
|
|
381101
|
+
}
|
|
381102
|
+
} catch (error2) {
|
|
381103
|
+
debugLogger.warn("Failed to check project hooks trust", error2);
|
|
381104
|
+
}
|
|
381105
|
+
}
|
|
380931
381106
|
/**
|
|
380932
381107
|
* Process hooks from the config that was already loaded by the CLI
|
|
380933
381108
|
*/
|
|
380934
381109
|
processHooksFromConfig() {
|
|
381110
|
+
if (this.config.isTrustedFolder()) {
|
|
381111
|
+
this.checkProjectHooksTrust();
|
|
381112
|
+
}
|
|
380935
381113
|
const configHooks = this.config.getHooks();
|
|
380936
381114
|
if (configHooks) {
|
|
380937
|
-
this.
|
|
381115
|
+
if (this.config.isTrustedFolder()) {
|
|
381116
|
+
this.processHooksConfiguration(configHooks, ConfigSource.Project);
|
|
381117
|
+
} else {
|
|
381118
|
+
debugLogger.warn("Project hooks disabled because the folder is not trusted.");
|
|
381119
|
+
}
|
|
380938
381120
|
}
|
|
380939
381121
|
const extensions = this.config.getExtensions() || [];
|
|
380940
381122
|
for (const extension of extensions) {
|
|
@@ -380977,6 +381159,7 @@ var HookRegistry = class {
|
|
|
380977
381159
|
config: hookConfig
|
|
380978
381160
|
});
|
|
380979
381161
|
const isDisabled = disabledHooks.includes(hookName);
|
|
381162
|
+
hookConfig.source = source;
|
|
380980
381163
|
this.entries.push({
|
|
380981
381164
|
config: hookConfig,
|
|
380982
381165
|
source,
|
|
@@ -381037,13 +381220,26 @@ var EXIT_CODE_SUCCESS = 0;
|
|
|
381037
381220
|
var EXIT_CODE_BLOCKING_ERROR = 2;
|
|
381038
381221
|
var EXIT_CODE_NON_BLOCKING_ERROR = 1;
|
|
381039
381222
|
var HookRunner = class {
|
|
381040
|
-
|
|
381223
|
+
config;
|
|
381224
|
+
constructor(config3) {
|
|
381225
|
+
this.config = config3;
|
|
381041
381226
|
}
|
|
381042
381227
|
/**
|
|
381043
381228
|
* Execute a single hook
|
|
381044
381229
|
*/
|
|
381045
381230
|
async executeHook(hookConfig, eventName, input) {
|
|
381046
381231
|
const startTime = Date.now();
|
|
381232
|
+
if (hookConfig.source === ConfigSource.Project && !this.config.isTrustedFolder()) {
|
|
381233
|
+
const errorMessage = "Security: Blocked execution of project hook in untrusted folder";
|
|
381234
|
+
debugLogger.warn(errorMessage);
|
|
381235
|
+
return {
|
|
381236
|
+
hookConfig,
|
|
381237
|
+
eventName,
|
|
381238
|
+
success: false,
|
|
381239
|
+
error: new Error(errorMessage),
|
|
381240
|
+
duration: 0
|
|
381241
|
+
};
|
|
381242
|
+
}
|
|
381047
381243
|
try {
|
|
381048
381244
|
return await this.executeCommandHook(hookConfig, eventName, input, startTime);
|
|
381049
381245
|
} catch (error2) {
|
|
@@ -381140,7 +381336,7 @@ var HookRunner = class {
|
|
|
381140
381336
|
const shellConfig = getShellConfiguration();
|
|
381141
381337
|
const command = this.expandCommand(hookConfig.command, input, shellConfig.shell);
|
|
381142
381338
|
const env2 = {
|
|
381143
|
-
...process.env,
|
|
381339
|
+
...sanitizeEnvironment(process.env, this.config.sanitizationConfig),
|
|
381144
381340
|
GEMINI_PROJECT_DIR: input.cwd,
|
|
381145
381341
|
CLAUDE_PROJECT_DIR: input.cwd
|
|
381146
381342
|
// For compatibility
|
|
@@ -381566,7 +381762,7 @@ var HookPlanner = class {
|
|
|
381566
381762
|
const seen = /* @__PURE__ */ new Set();
|
|
381567
381763
|
const deduplicated = [];
|
|
381568
381764
|
for (const entry of entries2) {
|
|
381569
|
-
const key =
|
|
381765
|
+
const key = getHookKey(entry.config);
|
|
381570
381766
|
if (!seen.has(key)) {
|
|
381571
381767
|
seen.add(key);
|
|
381572
381768
|
deduplicated.push(entry);
|
|
@@ -381576,14 +381772,6 @@ var HookPlanner = class {
|
|
|
381576
381772
|
}
|
|
381577
381773
|
return deduplicated;
|
|
381578
381774
|
}
|
|
381579
|
-
/**
|
|
381580
|
-
* Generate a unique key for a hook entry
|
|
381581
|
-
*/
|
|
381582
|
-
getHookKey(entry) {
|
|
381583
|
-
const name4 = entry.config.name || "";
|
|
381584
|
-
const command = entry.config.command || "";
|
|
381585
|
-
return `${name4}:${command}`;
|
|
381586
|
-
}
|
|
381587
381775
|
};
|
|
381588
381776
|
|
|
381589
381777
|
// packages/core/dist/src/hooks/hookEventHandler.js
|
|
@@ -382064,7 +382252,7 @@ var HookSystem = class {
|
|
|
382064
382252
|
const logger6 = import_api_logs2.logs.getLogger(SERVICE_NAME);
|
|
382065
382253
|
const messageBus = config3.getMessageBus();
|
|
382066
382254
|
this.hookRegistry = new HookRegistry(config3);
|
|
382067
|
-
this.hookRunner = new HookRunner();
|
|
382255
|
+
this.hookRunner = new HookRunner(config3);
|
|
382068
382256
|
this.hookAggregator = new HookAggregator();
|
|
382069
382257
|
this.hookPlanner = new HookPlanner(this.hookRegistry);
|
|
382070
382258
|
this.hookEventHandler = new HookEventHandler(config3, logger6, this.hookPlanner, this.hookRunner, this.hookAggregator, messageBus);
|
|
@@ -384719,7 +384907,7 @@ var ServiceAccountImpersonationProvider = class {
|
|
|
384719
384907
|
};
|
|
384720
384908
|
|
|
384721
384909
|
// packages/core/dist/src/tools/mcp-client.js
|
|
384722
|
-
import { basename as
|
|
384910
|
+
import { basename as basename11 } from "node:path";
|
|
384723
384911
|
import { pathToFileURL } from "node:url";
|
|
384724
384912
|
|
|
384725
384913
|
// packages/core/dist/src/mcp/oauth-provider.js
|
|
@@ -385539,7 +385727,7 @@ var McpClient = class {
|
|
|
385539
385727
|
}
|
|
385540
385728
|
this.updateStatus(MCPServerStatus.CONNECTING);
|
|
385541
385729
|
try {
|
|
385542
|
-
this.client = await connectToMcpServer(this.serverName, this.serverConfig, this.debugMode, this.workspaceContext);
|
|
385730
|
+
this.client = await connectToMcpServer(this.serverName, this.serverConfig, this.debugMode, this.workspaceContext, this.cliConfig.sanitizationConfig);
|
|
385543
385731
|
this.registerNotificationHandlers();
|
|
385544
385732
|
const originalOnError = this.client.onerror;
|
|
385545
385733
|
this.client.onerror = (error2) => {
|
|
@@ -386091,7 +386279,7 @@ async function retryWithOAuth(client, serverName, config3, accessToken, httpRetu
|
|
|
386091
386279
|
}
|
|
386092
386280
|
}
|
|
386093
386281
|
}
|
|
386094
|
-
async function connectToMcpServer(mcpServerName, mcpServerConfig, debugMode, workspaceContext) {
|
|
386282
|
+
async function connectToMcpServer(mcpServerName, mcpServerConfig, debugMode, workspaceContext, sanitizationConfig) {
|
|
386095
386283
|
const mcpClient = new Client({
|
|
386096
386284
|
name: "gemini-cli-mcp-client",
|
|
386097
386285
|
version: "0.0.1"
|
|
@@ -386109,7 +386297,7 @@ async function connectToMcpServer(mcpServerName, mcpServerConfig, debugMode, wor
|
|
|
386109
386297
|
for (const dir of workspaceContext.getDirectories()) {
|
|
386110
386298
|
roots.push({
|
|
386111
386299
|
uri: pathToFileURL(dir).toString(),
|
|
386112
|
-
name:
|
|
386300
|
+
name: basename11(dir)
|
|
386113
386301
|
});
|
|
386114
386302
|
}
|
|
386115
386303
|
return {
|
|
@@ -386136,7 +386324,7 @@ async function connectToMcpServer(mcpServerName, mcpServerConfig, debugMode, wor
|
|
|
386136
386324
|
let httpReturned404 = false;
|
|
386137
386325
|
let sseError = null;
|
|
386138
386326
|
try {
|
|
386139
|
-
const transport = await createTransport(mcpServerName, mcpServerConfig, debugMode);
|
|
386327
|
+
const transport = await createTransport(mcpServerName, mcpServerConfig, debugMode, sanitizationConfig);
|
|
386140
386328
|
try {
|
|
386141
386329
|
await mcpClient.connect(transport, {
|
|
386142
386330
|
timeout: mcpServerConfig.timeout ?? MCP_DEFAULT_TIMEOUT_MSEC
|
|
@@ -386291,7 +386479,7 @@ function createUrlTransport(mcpServerName, mcpServerConfig, transportOptions) {
|
|
|
386291
386479
|
}
|
|
386292
386480
|
throw new Error(`No URL configured for MCP server '${mcpServerName}'`);
|
|
386293
386481
|
}
|
|
386294
|
-
async function createTransport(mcpServerName, mcpServerConfig, debugMode) {
|
|
386482
|
+
async function createTransport(mcpServerName, mcpServerConfig, debugMode, sanitizationConfig) {
|
|
386295
386483
|
const noUrl = !mcpServerConfig.url && !mcpServerConfig.httpUrl;
|
|
386296
386484
|
if (noUrl) {
|
|
386297
386485
|
if (mcpServerConfig.authProviderType === AuthProviderType.GOOGLE_CREDENTIALS) {
|
|
@@ -386334,7 +386522,7 @@ async function createTransport(mcpServerName, mcpServerConfig, debugMode) {
|
|
|
386334
386522
|
command: mcpServerConfig.command,
|
|
386335
386523
|
args: mcpServerConfig.args || [],
|
|
386336
386524
|
env: {
|
|
386337
|
-
...process.env,
|
|
386525
|
+
...sanitizeEnvironment(process.env, sanitizationConfig),
|
|
386338
386526
|
...mcpServerConfig.env || {}
|
|
386339
386527
|
},
|
|
386340
386528
|
cwd: mcpServerConfig.cwd,
|
|
@@ -386609,6 +386797,9 @@ var Config = class {
|
|
|
386609
386797
|
mcpClientManager;
|
|
386610
386798
|
allowedMcpServers;
|
|
386611
386799
|
blockedMcpServers;
|
|
386800
|
+
allowedEnvironmentVariables;
|
|
386801
|
+
blockedEnvironmentVariables;
|
|
386802
|
+
enableEnvironmentVariableRedaction;
|
|
386612
386803
|
promptRegistry;
|
|
386613
386804
|
resourceRegistry;
|
|
386614
386805
|
agentRegistry;
|
|
@@ -386633,7 +386824,6 @@ var Config = class {
|
|
|
386633
386824
|
userMemory;
|
|
386634
386825
|
geminiMdFileCount;
|
|
386635
386826
|
geminiMdFilePaths;
|
|
386636
|
-
approvalMode;
|
|
386637
386827
|
showMemoryUsage;
|
|
386638
386828
|
accessibility;
|
|
386639
386829
|
telemetrySettings;
|
|
@@ -386705,10 +386895,12 @@ var Config = class {
|
|
|
386705
386895
|
pendingIncludeDirectories;
|
|
386706
386896
|
enableHooks;
|
|
386707
386897
|
hooks;
|
|
386898
|
+
projectHooks;
|
|
386708
386899
|
disabledHooks;
|
|
386709
386900
|
experiments;
|
|
386710
386901
|
experimentsPromise;
|
|
386711
386902
|
hookSystem;
|
|
386903
|
+
onModelChange;
|
|
386712
386904
|
enableAgents;
|
|
386713
386905
|
experimentalJitContext;
|
|
386714
386906
|
contextManager;
|
|
@@ -386733,10 +386925,12 @@ var Config = class {
|
|
|
386733
386925
|
this.mcpServers = params.mcpServers;
|
|
386734
386926
|
this.allowedMcpServers = params.allowedMcpServers ?? [];
|
|
386735
386927
|
this.blockedMcpServers = params.blockedMcpServers ?? [];
|
|
386928
|
+
this.allowedEnvironmentVariables = params.allowedEnvironmentVariables ?? [];
|
|
386929
|
+
this.blockedEnvironmentVariables = params.blockedEnvironmentVariables ?? [];
|
|
386930
|
+
this.enableEnvironmentVariableRedaction = params.enableEnvironmentVariableRedaction ?? false;
|
|
386736
386931
|
this.userMemory = params.userMemory ?? "";
|
|
386737
386932
|
this.geminiMdFileCount = params.geminiMdFileCount ?? 0;
|
|
386738
386933
|
this.geminiMdFilePaths = params.geminiMdFilePaths ?? [];
|
|
386739
|
-
this.approvalMode = params.approvalMode ?? ApprovalMode.DEFAULT;
|
|
386740
386934
|
this.showMemoryUsage = params.showMemoryUsage ?? false;
|
|
386741
386935
|
this.accessibility = params.accessibility ?? {};
|
|
386742
386936
|
this.telemetrySettings = {
|
|
@@ -386792,7 +386986,8 @@ var Config = class {
|
|
|
386792
386986
|
terminalWidth: params.shellExecutionConfig?.terminalWidth ?? 80,
|
|
386793
386987
|
terminalHeight: params.shellExecutionConfig?.terminalHeight ?? 24,
|
|
386794
386988
|
showColor: params.shellExecutionConfig?.showColor ?? false,
|
|
386795
|
-
pager: params.shellExecutionConfig?.pager ?? "cat"
|
|
386989
|
+
pager: params.shellExecutionConfig?.pager ?? "cat",
|
|
386990
|
+
sanitizationConfig: this.sanitizationConfig
|
|
386796
386991
|
};
|
|
386797
386992
|
this.truncateToolOutputThreshold = params.truncateToolOutputThreshold ?? DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD;
|
|
386798
386993
|
this.truncateToolOutputLines = params.truncateToolOutputLines ?? DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES;
|
|
@@ -386825,7 +387020,10 @@ var Config = class {
|
|
|
386825
387020
|
this.enablePromptCompletion = params.enablePromptCompletion ?? false;
|
|
386826
387021
|
this.fileExclusions = new FileExclusions(this);
|
|
386827
387022
|
this.eventEmitter = params.eventEmitter;
|
|
386828
|
-
this.policyEngine = new PolicyEngine(
|
|
387023
|
+
this.policyEngine = new PolicyEngine({
|
|
387024
|
+
...params.policyEngineConfig,
|
|
387025
|
+
approvalMode: params.approvalMode ?? params.policyEngineConfig?.approvalMode
|
|
387026
|
+
});
|
|
386829
387027
|
this.messageBus = new MessageBus(this.policyEngine, this.debugMode);
|
|
386830
387028
|
this.outputSettings = {
|
|
386831
387029
|
format: params.output?.format ?? OutputFormat.TEXT
|
|
@@ -386833,7 +387031,9 @@ var Config = class {
|
|
|
386833
387031
|
this.retryFetchErrors = params.retryFetchErrors ?? false;
|
|
386834
387032
|
this.disableYoloMode = params.disableYoloMode ?? false;
|
|
386835
387033
|
this.hooks = params.hooks;
|
|
387034
|
+
this.projectHooks = params.projectHooks;
|
|
386836
387035
|
this.experiments = params.experiments;
|
|
387036
|
+
this.onModelChange = params.onModelChange;
|
|
386837
387037
|
if (params.contextFileName) {
|
|
386838
387038
|
setGeminiMdFilename(params.contextFileName);
|
|
386839
387039
|
}
|
|
@@ -386997,11 +387197,14 @@ var Config = class {
|
|
|
386997
387197
|
getModel() {
|
|
386998
387198
|
return this.model;
|
|
386999
387199
|
}
|
|
387000
|
-
setModel(newModel) {
|
|
387200
|
+
setModel(newModel, isFallbackModel = false) {
|
|
387001
387201
|
if (this.model !== newModel || this._activeModel !== newModel) {
|
|
387002
387202
|
this.model = newModel;
|
|
387003
387203
|
this._activeModel = newModel;
|
|
387004
387204
|
coreEvents.emitModelChanged(newModel);
|
|
387205
|
+
if (this.onModelChange && !isFallbackModel) {
|
|
387206
|
+
this.onModelChange(newModel);
|
|
387207
|
+
}
|
|
387005
387208
|
}
|
|
387006
387209
|
this.modelAvailabilityService.reset();
|
|
387007
387210
|
}
|
|
@@ -387157,6 +387360,13 @@ var Config = class {
|
|
|
387157
387360
|
getBlockedMcpServers() {
|
|
387158
387361
|
return this.blockedMcpServers;
|
|
387159
387362
|
}
|
|
387363
|
+
get sanitizationConfig() {
|
|
387364
|
+
return {
|
|
387365
|
+
allowedEnvironmentVariables: this.allowedEnvironmentVariables,
|
|
387366
|
+
blockedEnvironmentVariables: this.blockedEnvironmentVariables,
|
|
387367
|
+
enableEnvironmentVariableRedaction: this.enableEnvironmentVariableRedaction
|
|
387368
|
+
};
|
|
387369
|
+
}
|
|
387160
387370
|
setMcpServers(mcpServers) {
|
|
387161
387371
|
this.mcpServers = mcpServers;
|
|
387162
387372
|
}
|
|
@@ -387203,13 +387413,13 @@ var Config = class {
|
|
|
387203
387413
|
this.geminiMdFilePaths = paths;
|
|
387204
387414
|
}
|
|
387205
387415
|
getApprovalMode() {
|
|
387206
|
-
return this.
|
|
387416
|
+
return this.policyEngine.getApprovalMode();
|
|
387207
387417
|
}
|
|
387208
387418
|
setApprovalMode(mode) {
|
|
387209
387419
|
if (!this.isTrustedFolder() && mode !== ApprovalMode.DEFAULT) {
|
|
387210
387420
|
throw new Error("Cannot enable privileged approval modes in an untrusted folder.");
|
|
387211
387421
|
}
|
|
387212
|
-
this.
|
|
387422
|
+
this.policyEngine.setApprovalMode(mode);
|
|
387213
387423
|
}
|
|
387214
387424
|
isYoloModeDisabled() {
|
|
387215
387425
|
return this.disableYoloMode || !this.isTrustedFolder();
|
|
@@ -387460,7 +387670,8 @@ var Config = class {
|
|
|
387460
387670
|
terminalWidth: config3.terminalWidth ?? this.shellExecutionConfig.terminalWidth,
|
|
387461
387671
|
terminalHeight: config3.terminalHeight ?? this.shellExecutionConfig.terminalHeight,
|
|
387462
387672
|
showColor: config3.showColor ?? this.shellExecutionConfig.showColor,
|
|
387463
|
-
pager: config3.pager ?? this.shellExecutionConfig.pager
|
|
387673
|
+
pager: config3.pager ?? this.shellExecutionConfig.pager,
|
|
387674
|
+
sanitizationConfig: config3.sanitizationConfig ?? this.shellExecutionConfig.sanitizationConfig
|
|
387464
387675
|
};
|
|
387465
387676
|
}
|
|
387466
387677
|
getScreenReader() {
|
|
@@ -387597,6 +387808,12 @@ var Config = class {
|
|
|
387597
387808
|
getHooks() {
|
|
387598
387809
|
return this.hooks;
|
|
387599
387810
|
}
|
|
387811
|
+
/**
|
|
387812
|
+
* Get project-specific hooks configuration
|
|
387813
|
+
*/
|
|
387814
|
+
getProjectHooks() {
|
|
387815
|
+
return this.projectHooks;
|
|
387816
|
+
}
|
|
387600
387817
|
/**
|
|
387601
387818
|
* Get disabled hooks list
|
|
387602
387819
|
*/
|
|
@@ -387673,7 +387890,7 @@ var PolicyRuleSchema = external_exports.object({
|
|
|
387673
387890
|
}).int({ message: "priority must be an integer" }).min(0, { message: "priority must be >= 0" }).max(999, {
|
|
387674
387891
|
message: "priority must be <= 999 to prevent tier overflow. Priorities >= 1000 would jump to the next tier."
|
|
387675
387892
|
}),
|
|
387676
|
-
modes: external_exports.array(external_exports.
|
|
387893
|
+
modes: external_exports.array(external_exports.nativeEnum(ApprovalMode)).optional()
|
|
387677
387894
|
});
|
|
387678
387895
|
var SafetyCheckerRuleSchema = external_exports.object({
|
|
387679
387896
|
toolName: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional(),
|
|
@@ -387682,7 +387899,7 @@ var SafetyCheckerRuleSchema = external_exports.object({
|
|
|
387682
387899
|
commandPrefix: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional(),
|
|
387683
387900
|
commandRegex: external_exports.string().optional(),
|
|
387684
387901
|
priority: external_exports.number().int().default(0),
|
|
387685
|
-
modes: external_exports.array(external_exports.
|
|
387902
|
+
modes: external_exports.array(external_exports.nativeEnum(ApprovalMode)).optional(),
|
|
387686
387903
|
checker: external_exports.discriminatedUnion("type", [
|
|
387687
387904
|
external_exports.object({
|
|
387688
387905
|
type: external_exports.literal("in-process"),
|