@google/gemini-cli 0.39.0-preview.0 → 0.39.0-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/{chunk-NMO6M2JW.js → chunk-3R2FLB3Z.js} +4 -4
- package/bundle/{chunk-UCJYTRQH.js → chunk-45GIY5RT.js} +1 -1
- package/bundle/{chunk-CB4IHCOV.js → chunk-4UUOHXDW.js} +354 -296
- package/bundle/{chunk-ZFUMNFZD.js → chunk-5J5LWISO.js} +6536 -11870
- package/bundle/{chunk-DY3XSEN6.js → chunk-AZ7QQWNX.js} +2 -2
- package/bundle/{chunk-L5FKR6GE.js → chunk-GX4YOB7T.js} +4 -4
- package/bundle/{chunk-KMWY7IVQ.js → chunk-N3GUGFOL.js} +72 -60
- package/bundle/chunk-OXCH4FS3.js +360288 -0
- package/bundle/{chunk-5ZBBJS2A.js → chunk-QC6EGBZW.js} +1 -1
- package/bundle/chunk-RTX4LTWK.js +101702 -0
- package/bundle/chunk-SS4CWRZ5.js +156 -0
- package/bundle/{chunk-LF246RTE.js → chunk-TKGFTY3B.js} +404 -307
- package/bundle/{cleanup-INA6FKQG.js → cleanup-3EICKDDN.js} +2 -2
- package/bundle/{cleanup-DKDGF4IA.js → cleanup-4SLYOL44.js} +3 -3
- package/bundle/{cleanup-B7STSNY5.js → cleanup-6N6E742H.js} +2 -2
- package/bundle/cleanup-OG2MXKZ7.js +33 -0
- package/bundle/{core-6MCGZ334.js → core-KLYK3V6Z.js} +3 -1
- package/bundle/{devtoolsService-QN4BQSIF.js → devtoolsService-FS7WXGBF.js} +2 -2
- package/bundle/{devtoolsService-BXBCDCC2.js → devtoolsService-K4DENTYF.js} +2 -2
- package/bundle/{devtoolsService-DDDJINQW.js → devtoolsService-RLXZWLDT.js} +5 -4
- package/bundle/devtoolsService-X4577PYZ.js +871 -0
- package/bundle/{dist-2M52ZJGU.js → dist-5ET5G5PC.js} +3 -1
- package/bundle/{core-MYQB6KXT.js → dist-DQVXGLSO.js} +4 -2
- package/bundle/dist-P4XAO4SC.js +2010 -0
- package/bundle/docs/cli/plan-mode.md +1 -2
- package/bundle/{gemini-TS2LMZH4.js → gemini-6GWCDHXK.js} +8 -8
- package/bundle/{gemini-BA3BDBJT.js → gemini-FLGPH5GJ.js} +8 -8
- package/bundle/{gemini-JFTJVXU4.js → gemini-NBKLSVA3.js} +184 -169
- package/bundle/gemini-YOFQ5KF4.js +15321 -0
- package/bundle/gemini.js +3 -3
- package/bundle/{interactiveCli-7ZBDFPFP.js → interactiveCli-AGSLCKNH.js} +6 -5
- package/bundle/{interactiveCli-W43ANBCL.js → interactiveCli-H3NLGP7Z.js} +6 -5
- package/bundle/{interactiveCli-K6QHA2GI.js → interactiveCli-NAPN3E2K.js} +277 -259
- package/bundle/interactiveCli-TCZBSTKU.js +34493 -0
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-53ZABNLX.js → oauth2-provider-CWUR5RGE.js} +1 -1
- package/bundle/{oauth2-provider-T4YYJWZG.js → oauth2-provider-EA452S4C.js} +39 -73
- package/bundle/oauth2-provider-LV6VPYTU.js +237 -0
- package/bundle/{oauth2-provider-3YCIQHIN.js → oauth2-provider-YKYTKUWD.js} +1 -1
- package/package.json +1 -1
|
@@ -74762,7 +74762,7 @@ var require_util7 = __commonJS({
|
|
|
74762
74762
|
function getFilesInPath(source) {
|
|
74763
74763
|
const lstatSync2 = fs78.lstatSync;
|
|
74764
74764
|
const readdirSync2 = fs78.readdirSync;
|
|
74765
|
-
const
|
|
74765
|
+
const join32 = path95.join;
|
|
74766
74766
|
function isDirectory(source2) {
|
|
74767
74767
|
return lstatSync2(source2).isDirectory();
|
|
74768
74768
|
}
|
|
@@ -74771,12 +74771,12 @@ var require_util7 = __commonJS({
|
|
|
74771
74771
|
}
|
|
74772
74772
|
function getDirectories(source2) {
|
|
74773
74773
|
return readdirSync2(source2).map((name3) => {
|
|
74774
|
-
return
|
|
74774
|
+
return join32(source2, name3);
|
|
74775
74775
|
}).filter(isDirectory);
|
|
74776
74776
|
}
|
|
74777
74777
|
function getFiles(source2) {
|
|
74778
74778
|
return readdirSync2(source2).map((name3) => {
|
|
74779
|
-
return
|
|
74779
|
+
return join32(source2, name3);
|
|
74780
74780
|
}).filter(isFile2);
|
|
74781
74781
|
}
|
|
74782
74782
|
function getFilesRecursively(source2) {
|
|
@@ -104887,7 +104887,7 @@ var require_buffer_list = __commonJS({
|
|
|
104887
104887
|
}
|
|
104888
104888
|
}, {
|
|
104889
104889
|
key: "join",
|
|
104890
|
-
value: function
|
|
104890
|
+
value: function join32(s2) {
|
|
104891
104891
|
if (this.length === 0) return "";
|
|
104892
104892
|
var p = this.head;
|
|
104893
104893
|
var ret = "" + p.data;
|
|
@@ -251721,8 +251721,8 @@ var EventMetadataKey;
|
|
|
251721
251721
|
})(EventMetadataKey || (EventMetadataKey = {}));
|
|
251722
251722
|
|
|
251723
251723
|
// packages/core/dist/src/generated/git-commit.js
|
|
251724
|
-
var GIT_COMMIT_INFO = "
|
|
251725
|
-
var CLI_VERSION = "0.39.0-preview.
|
|
251724
|
+
var GIT_COMMIT_INFO = "23f55e0d1";
|
|
251725
|
+
var CLI_VERSION = "0.39.0-preview.1";
|
|
251726
251726
|
|
|
251727
251727
|
// packages/core/dist/src/ide/detect-ide.js
|
|
251728
251728
|
var IDE_DEFINITIONS = {
|
|
@@ -257381,7 +257381,7 @@ function getLanguageFromFilePath(filePath) {
|
|
|
257381
257381
|
|
|
257382
257382
|
// packages/core/dist/src/tools/edit.js
|
|
257383
257383
|
import * as fsPromises2 from "node:fs/promises";
|
|
257384
|
-
import * as
|
|
257384
|
+
import * as path28 from "node:path";
|
|
257385
257385
|
import * as os18 from "node:os";
|
|
257386
257386
|
import * as crypto13 from "node:crypto";
|
|
257387
257387
|
|
|
@@ -276236,6 +276236,59 @@ function appendJitContextToParts(llmContent, jitContext) {
|
|
|
276236
276236
|
return [...existingParts, jitPart];
|
|
276237
276237
|
}
|
|
276238
276238
|
|
|
276239
|
+
// packages/core/dist/src/utils/planUtils.js
|
|
276240
|
+
import path27 from "node:path";
|
|
276241
|
+
var PlanErrorMessages = {
|
|
276242
|
+
PATH_ACCESS_DENIED: (planPath, plansDir) => `Access denied: plan path (${planPath}) must be within the designated plans directory (${plansDir}).`,
|
|
276243
|
+
FILE_NOT_FOUND: (path95) => `Plan file does not exist: ${path95}. You must create the plan file before requesting approval.`,
|
|
276244
|
+
FILE_EMPTY: "Plan file is empty. You must write content to the plan file before requesting approval.",
|
|
276245
|
+
READ_FAILURE: (detail) => `Failed to read plan file: ${detail}`
|
|
276246
|
+
};
|
|
276247
|
+
function resolveAndValidatePlanPath(planPath, plansDir, projectRoot) {
|
|
276248
|
+
const trimmedPath = planPath.trim();
|
|
276249
|
+
if (!trimmedPath) {
|
|
276250
|
+
throw new Error("Plan file path must be non-empty.");
|
|
276251
|
+
}
|
|
276252
|
+
if (path27.isAbsolute(trimmedPath)) {
|
|
276253
|
+
if (isSubpath(resolveToRealPath(plansDir), resolveToRealPath(trimmedPath))) {
|
|
276254
|
+
return trimmedPath;
|
|
276255
|
+
}
|
|
276256
|
+
}
|
|
276257
|
+
const resolvedFromProjectRoot = path27.resolve(projectRoot, trimmedPath);
|
|
276258
|
+
if (isSubpath(resolveToRealPath(plansDir), resolveToRealPath(resolvedFromProjectRoot))) {
|
|
276259
|
+
return resolvedFromProjectRoot;
|
|
276260
|
+
}
|
|
276261
|
+
const resolvedPath = path27.resolve(plansDir, trimmedPath);
|
|
276262
|
+
const realPath = resolveToRealPath(resolvedPath);
|
|
276263
|
+
const realPlansDir = resolveToRealPath(plansDir);
|
|
276264
|
+
if (!isSubpath(realPlansDir, realPath)) {
|
|
276265
|
+
throw new Error(PlanErrorMessages.PATH_ACCESS_DENIED(trimmedPath, plansDir));
|
|
276266
|
+
}
|
|
276267
|
+
return resolvedPath;
|
|
276268
|
+
}
|
|
276269
|
+
async function validatePlanPath(planPath, plansDir, projectRoot) {
|
|
276270
|
+
try {
|
|
276271
|
+
const resolvedPath = resolveAndValidatePlanPath(planPath, plansDir, projectRoot);
|
|
276272
|
+
if (!await fileExists(resolvedPath)) {
|
|
276273
|
+
return PlanErrorMessages.FILE_NOT_FOUND(planPath);
|
|
276274
|
+
}
|
|
276275
|
+
return null;
|
|
276276
|
+
} catch {
|
|
276277
|
+
return PlanErrorMessages.PATH_ACCESS_DENIED(planPath, resolveToRealPath(plansDir));
|
|
276278
|
+
}
|
|
276279
|
+
}
|
|
276280
|
+
async function validatePlanContent(planPath) {
|
|
276281
|
+
try {
|
|
276282
|
+
if (await isEmpty(planPath)) {
|
|
276283
|
+
return PlanErrorMessages.FILE_EMPTY;
|
|
276284
|
+
}
|
|
276285
|
+
return null;
|
|
276286
|
+
} catch (err2) {
|
|
276287
|
+
const message = err2 instanceof Error ? err2.message : String(err2);
|
|
276288
|
+
return PlanErrorMessages.READ_FAILURE(message);
|
|
276289
|
+
}
|
|
276290
|
+
}
|
|
276291
|
+
|
|
276239
276292
|
// packages/core/dist/src/tools/edit.js
|
|
276240
276293
|
var ENABLE_FUZZY_MATCH_RECOVERY = true;
|
|
276241
276294
|
var FUZZY_MATCH_THRESHOLD = 0.1;
|
|
@@ -276444,14 +276497,18 @@ var EditToolInvocation = class extends BaseToolInvocation {
|
|
|
276444
276497
|
super(params, messageBus, toolName, displayName, void 0, void 0, true, () => this.config.getApprovalMode());
|
|
276445
276498
|
this.config = config2;
|
|
276446
276499
|
if (this.config.isPlanMode()) {
|
|
276447
|
-
|
|
276448
|
-
|
|
276449
|
-
|
|
276500
|
+
try {
|
|
276501
|
+
this.resolvedPath = resolveAndValidatePlanPath(this.params.file_path, this.config.storage.getPlansDir(), this.config.getProjectRoot());
|
|
276502
|
+
} catch (e2) {
|
|
276503
|
+
debugLogger.error("Failed to resolve plan path during EditTool invocation setup", e2);
|
|
276504
|
+
this.resolvedPath = this.params.file_path;
|
|
276505
|
+
}
|
|
276506
|
+
} else if (!path28.isAbsolute(this.params.file_path)) {
|
|
276450
276507
|
const result2 = correctPath(this.params.file_path, this.config);
|
|
276451
276508
|
if (result2.success) {
|
|
276452
276509
|
this.resolvedPath = result2.correctedPath;
|
|
276453
276510
|
} else {
|
|
276454
|
-
this.resolvedPath =
|
|
276511
|
+
this.resolvedPath = path28.resolve(this.config.getTargetDir(), this.params.file_path);
|
|
276455
276512
|
}
|
|
276456
276513
|
} else {
|
|
276457
276514
|
this.resolvedPath = this.params.file_path;
|
|
@@ -276659,7 +276716,7 @@ var EditToolInvocation = class extends BaseToolInvocation {
|
|
|
276659
276716
|
debugLogger.log(`Error: ${editData.error.display}`);
|
|
276660
276717
|
return false;
|
|
276661
276718
|
}
|
|
276662
|
-
const fileName =
|
|
276719
|
+
const fileName = path28.basename(this.resolvedPath);
|
|
276663
276720
|
const fileDiff = createPatch(fileName, editData.currentContent ?? "", editData.newContent, "Current", "Proposed", DEFAULT_DIFF_OPTIONS);
|
|
276664
276721
|
const ideClient = await IdeClient.getInstance();
|
|
276665
276722
|
const ideConfirmation = this.config.getIdeMode() && ideClient.isDiffingEnabled() ? ideClient.openDiff(this.resolvedPath, editData.newContent) : void 0;
|
|
@@ -276752,7 +276809,7 @@ var EditToolInvocation = class extends BaseToolInvocation {
|
|
|
276752
276809
|
if (editData.isNewFile) {
|
|
276753
276810
|
displayResult = `Created ${shortenPath(makeRelative(this.resolvedPath, this.config.getTargetDir()))}`;
|
|
276754
276811
|
} else {
|
|
276755
|
-
const fileName =
|
|
276812
|
+
const fileName = path28.basename(this.resolvedPath);
|
|
276756
276813
|
const fileDiff = createPatch(
|
|
276757
276814
|
fileName,
|
|
276758
276815
|
editData.currentContent ?? "",
|
|
@@ -276829,7 +276886,7 @@ ${snippet2}`);
|
|
|
276829
276886
|
* Creates parent directories if they don't exist
|
|
276830
276887
|
*/
|
|
276831
276888
|
async ensureParentDirectoriesExistAsync(filePath) {
|
|
276832
|
-
const dirName =
|
|
276889
|
+
const dirName = path28.dirname(filePath);
|
|
276833
276890
|
try {
|
|
276834
276891
|
await fsPromises2.access(dirName);
|
|
276835
276892
|
} catch {
|
|
@@ -276864,12 +276921,18 @@ var EditTool = class _EditTool extends BaseDeclarativeTool {
|
|
|
276864
276921
|
return "The 'file_path' parameter must be non-empty.";
|
|
276865
276922
|
}
|
|
276866
276923
|
let resolvedPath;
|
|
276867
|
-
if (
|
|
276924
|
+
if (this.config.isPlanMode()) {
|
|
276925
|
+
try {
|
|
276926
|
+
resolvedPath = resolveAndValidatePlanPath(params.file_path, this.config.storage.getPlansDir(), this.config.getProjectRoot());
|
|
276927
|
+
} catch (err2) {
|
|
276928
|
+
return err2 instanceof Error ? err2.message : String(err2);
|
|
276929
|
+
}
|
|
276930
|
+
} else if (!path28.isAbsolute(params.file_path)) {
|
|
276868
276931
|
const result2 = correctPath(params.file_path, this.config);
|
|
276869
276932
|
if (result2.success) {
|
|
276870
276933
|
resolvedPath = result2.correctedPath;
|
|
276871
276934
|
} else {
|
|
276872
|
-
resolvedPath =
|
|
276935
|
+
resolvedPath = path28.resolve(this.config.getTargetDir(), params.file_path);
|
|
276873
276936
|
}
|
|
276874
276937
|
} else {
|
|
276875
276938
|
resolvedPath = params.file_path;
|
|
@@ -277032,7 +277095,7 @@ async function calculateFuzzyReplacement(config2, context2) {
|
|
|
277032
277095
|
// packages/core/dist/src/tools/write-file.js
|
|
277033
277096
|
import fs30 from "node:fs";
|
|
277034
277097
|
import fsPromises3 from "node:fs/promises";
|
|
277035
|
-
import
|
|
277098
|
+
import path29 from "node:path";
|
|
277036
277099
|
import os19 from "node:os";
|
|
277037
277100
|
|
|
277038
277101
|
// packages/core/dist/src/utils/editCorrector.js
|
|
@@ -277196,10 +277259,14 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
277196
277259
|
super(params, messageBus, toolName, displayName, void 0, void 0, true, () => this.config.getApprovalMode());
|
|
277197
277260
|
this.config = config2;
|
|
277198
277261
|
if (this.config.isPlanMode()) {
|
|
277199
|
-
|
|
277200
|
-
|
|
277262
|
+
try {
|
|
277263
|
+
this.resolvedPath = resolveAndValidatePlanPath(this.params.file_path, this.config.storage.getPlansDir(), this.config.getProjectRoot());
|
|
277264
|
+
} catch (e2) {
|
|
277265
|
+
debugLogger.error("Failed to resolve plan path during WriteFileTool invocation setup", e2);
|
|
277266
|
+
this.resolvedPath = this.params.file_path;
|
|
277267
|
+
}
|
|
277201
277268
|
} else {
|
|
277202
|
-
this.resolvedPath =
|
|
277269
|
+
this.resolvedPath = path29.resolve(this.config.getTargetDir(), this.params.file_path);
|
|
277203
277270
|
}
|
|
277204
277271
|
}
|
|
277205
277272
|
toolLocations() {
|
|
@@ -277221,7 +277288,7 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
277221
277288
|
}
|
|
277222
277289
|
const { originalContent, correctedContent } = correctedContentResult;
|
|
277223
277290
|
const relativePath = makeRelative(this.resolvedPath, this.config.getTargetDir());
|
|
277224
|
-
const fileName =
|
|
277291
|
+
const fileName = path29.basename(this.resolvedPath);
|
|
277225
277292
|
const fileDiff = createPatch(
|
|
277226
277293
|
fileName,
|
|
277227
277294
|
originalContent,
|
|
@@ -277283,7 +277350,7 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
277283
277350
|
const { originalContent, correctedContent: fileContent, fileExists: fileExists2 } = correctedContentResult;
|
|
277284
277351
|
const isNewFile = !fileExists2 || correctedContentResult.error !== void 0 && !correctedContentResult.fileExists;
|
|
277285
277352
|
try {
|
|
277286
|
-
const dirName =
|
|
277353
|
+
const dirName = path29.dirname(this.resolvedPath);
|
|
277287
277354
|
try {
|
|
277288
277355
|
await fsPromises3.access(dirName);
|
|
277289
277356
|
} catch {
|
|
@@ -277295,7 +277362,7 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
277295
277362
|
finalContent = finalContent.replace(/\r?\n/g, "\r\n");
|
|
277296
277363
|
}
|
|
277297
277364
|
await this.config.getFileSystemService().writeTextFile(this.resolvedPath, finalContent);
|
|
277298
|
-
const fileName =
|
|
277365
|
+
const fileName = path29.basename(this.resolvedPath);
|
|
277299
277366
|
const currentContentForDiff = correctedContentResult.error ? "" : originalContent;
|
|
277300
277367
|
const fileDiff = createPatch(fileName, currentContentForDiff, fileContent, "Original", "Written", DEFAULT_DIFF_OPTIONS);
|
|
277301
277368
|
const originallyProposedContent = ai_proposed_content || content;
|
|
@@ -277311,7 +277378,7 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
277311
277378
|
${snippet2}`);
|
|
277312
277379
|
const mimetype = getSpecificMimeType(this.resolvedPath);
|
|
277313
277380
|
const programmingLanguage = getLanguageFromFilePath(this.resolvedPath);
|
|
277314
|
-
const extension =
|
|
277381
|
+
const extension = path29.extname(this.resolvedPath);
|
|
277315
277382
|
const operation = isNewFile ? FileOperation.CREATE : FileOperation.UPDATE;
|
|
277316
277383
|
logFileOperation(this.config, new FileOperationEvent(WRITE_FILE_TOOL_NAME, operation, fileContent.split("\n").length, mimetype, extension, programmingLanguage));
|
|
277317
277384
|
const displayResult = {
|
|
@@ -277378,7 +277445,16 @@ var WriteFileTool = class _WriteFileTool extends BaseDeclarativeTool {
|
|
|
277378
277445
|
if (!filePath) {
|
|
277379
277446
|
return `Missing or empty "file_path"`;
|
|
277380
277447
|
}
|
|
277381
|
-
|
|
277448
|
+
let resolvedPath;
|
|
277449
|
+
if (this.config.isPlanMode()) {
|
|
277450
|
+
try {
|
|
277451
|
+
resolvedPath = resolveAndValidatePlanPath(filePath, this.config.storage.getPlansDir(), this.config.getProjectRoot());
|
|
277452
|
+
} catch (err2) {
|
|
277453
|
+
return err2 instanceof Error ? err2.message : String(err2);
|
|
277454
|
+
}
|
|
277455
|
+
} else {
|
|
277456
|
+
resolvedPath = path29.resolve(this.config.getTargetDir(), filePath);
|
|
277457
|
+
}
|
|
277382
277458
|
const validationError = this.config.validatePathAccess(resolvedPath);
|
|
277383
277459
|
if (validationError) {
|
|
277384
277460
|
return validationError;
|
|
@@ -277569,25 +277645,25 @@ function hasError(response) {
|
|
|
277569
277645
|
}
|
|
277570
277646
|
|
|
277571
277647
|
// node_modules/read-package-up/index.js
|
|
277572
|
-
import
|
|
277648
|
+
import path32 from "node:path";
|
|
277573
277649
|
|
|
277574
277650
|
// node_modules/find-up-simple/index.js
|
|
277575
277651
|
import process11 from "node:process";
|
|
277576
277652
|
import fsPromises4 from "node:fs/promises";
|
|
277577
277653
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
277578
|
-
import
|
|
277654
|
+
import path30 from "node:path";
|
|
277579
277655
|
var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath4(urlOrPath) : urlOrPath;
|
|
277580
277656
|
async function findUp(name3, {
|
|
277581
277657
|
cwd = process11.cwd(),
|
|
277582
277658
|
type: type2 = "file",
|
|
277583
277659
|
stopAt
|
|
277584
277660
|
} = {}) {
|
|
277585
|
-
let directory =
|
|
277586
|
-
const { root } =
|
|
277587
|
-
stopAt =
|
|
277588
|
-
const isAbsoluteName =
|
|
277661
|
+
let directory = path30.resolve(toPath(cwd) ?? "");
|
|
277662
|
+
const { root } = path30.parse(directory);
|
|
277663
|
+
stopAt = path30.resolve(directory, toPath(stopAt ?? root));
|
|
277664
|
+
const isAbsoluteName = path30.isAbsolute(name3);
|
|
277589
277665
|
while (directory) {
|
|
277590
|
-
const filePath = isAbsoluteName ? name3 :
|
|
277666
|
+
const filePath = isAbsoluteName ? name3 : path30.join(directory, name3);
|
|
277591
277667
|
try {
|
|
277592
277668
|
const stats = await fsPromises4.stat(filePath);
|
|
277593
277669
|
if (type2 === "file" && stats.isFile() || type2 === "directory" && stats.isDirectory()) {
|
|
@@ -277598,13 +277674,13 @@ async function findUp(name3, {
|
|
|
277598
277674
|
if (directory === stopAt || directory === root) {
|
|
277599
277675
|
break;
|
|
277600
277676
|
}
|
|
277601
|
-
directory =
|
|
277677
|
+
directory = path30.dirname(directory);
|
|
277602
277678
|
}
|
|
277603
277679
|
}
|
|
277604
277680
|
|
|
277605
277681
|
// node_modules/read-pkg/index.js
|
|
277606
277682
|
import fsPromises5 from "node:fs/promises";
|
|
277607
|
-
import
|
|
277683
|
+
import path31 from "node:path";
|
|
277608
277684
|
|
|
277609
277685
|
// node_modules/parse-json/index.js
|
|
277610
277686
|
var import_code_frame = __toESM(require_lib7(), 1);
|
|
@@ -277733,7 +277809,7 @@ function toPath2(urlOrPath) {
|
|
|
277733
277809
|
}
|
|
277734
277810
|
|
|
277735
277811
|
// node_modules/read-pkg/index.js
|
|
277736
|
-
var getPackagePath = (cwd) =>
|
|
277812
|
+
var getPackagePath = (cwd) => path31.resolve(toPath2(cwd) ?? ".", "package.json");
|
|
277737
277813
|
var _readPackage = (file2, normalize4) => {
|
|
277738
277814
|
const json3 = typeof file2 === "string" ? parseJson(file2) : file2;
|
|
277739
277815
|
if (normalize4) {
|
|
@@ -277753,7 +277829,7 @@ async function readPackageUp(options) {
|
|
|
277753
277829
|
return;
|
|
277754
277830
|
}
|
|
277755
277831
|
return {
|
|
277756
|
-
packageJson: await readPackage({ ...options, cwd:
|
|
277832
|
+
packageJson: await readPackage({ ...options, cwd: path32.dirname(filePath) }),
|
|
277757
277833
|
path: filePath
|
|
277758
277834
|
};
|
|
277759
277835
|
}
|
|
@@ -277812,13 +277888,13 @@ async function isStable(cwd) {
|
|
|
277812
277888
|
|
|
277813
277889
|
// packages/core/dist/src/code_assist/experiments/client_metadata.js
|
|
277814
277890
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
277815
|
-
import
|
|
277891
|
+
import path34 from "node:path";
|
|
277816
277892
|
|
|
277817
277893
|
// packages/core/dist/src/utils/version.js
|
|
277818
277894
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
277819
|
-
import
|
|
277895
|
+
import path33 from "node:path";
|
|
277820
277896
|
var __filename3 = fileURLToPath6(import.meta.url);
|
|
277821
|
-
var __dirname4 =
|
|
277897
|
+
var __dirname4 = path33.dirname(__filename3);
|
|
277822
277898
|
var versionPromise;
|
|
277823
277899
|
function getVersion() {
|
|
277824
277900
|
if (versionPromise) {
|
|
@@ -277826,7 +277902,7 @@ function getVersion() {
|
|
|
277826
277902
|
}
|
|
277827
277903
|
versionPromise = (async () => {
|
|
277828
277904
|
const pkgJson = await getPackageJson(__dirname4);
|
|
277829
|
-
return "0.39.0-preview.
|
|
277905
|
+
return "0.39.0-preview.1";
|
|
277830
277906
|
})();
|
|
277831
277907
|
return versionPromise;
|
|
277832
277908
|
}
|
|
@@ -277836,7 +277912,7 @@ function resetVersionCache() {
|
|
|
277836
277912
|
|
|
277837
277913
|
// packages/core/dist/src/code_assist/experiments/client_metadata.js
|
|
277838
277914
|
var __filename4 = fileURLToPath7(import.meta.url);
|
|
277839
|
-
var __dirname5 =
|
|
277915
|
+
var __dirname5 = path34.dirname(__filename4);
|
|
277840
277916
|
var clientMetadataPromise;
|
|
277841
277917
|
function getPlatform() {
|
|
277842
277918
|
const platform10 = process.platform;
|
|
@@ -279879,7 +279955,7 @@ var ToolRegistry = class _ToolRegistry {
|
|
|
279879
279955
|
|
|
279880
279956
|
// packages/core/dist/src/tools/ls.js
|
|
279881
279957
|
import fs31 from "node:fs/promises";
|
|
279882
|
-
import
|
|
279958
|
+
import path35 from "node:path";
|
|
279883
279959
|
var LSToolInvocation = class extends BaseToolInvocation {
|
|
279884
279960
|
config;
|
|
279885
279961
|
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
@@ -279934,7 +280010,7 @@ var LSToolInvocation = class extends BaseToolInvocation {
|
|
|
279934
280010
|
* @returns Result of the LS operation
|
|
279935
280011
|
*/
|
|
279936
280012
|
async execute({ abortSignal: _signal }) {
|
|
279937
|
-
const resolvedDirPath =
|
|
280013
|
+
const resolvedDirPath = path35.resolve(this.config.getTargetDir(), this.params.dir_path);
|
|
279938
280014
|
const validationError = this.config.validatePathAccess(resolvedDirPath, "read");
|
|
279939
280015
|
if (validationError) {
|
|
279940
280016
|
return {
|
|
@@ -279961,7 +280037,7 @@ var LSToolInvocation = class extends BaseToolInvocation {
|
|
|
279961
280037
|
returnDisplay: `Directory is empty.`
|
|
279962
280038
|
};
|
|
279963
280039
|
}
|
|
279964
|
-
const relativePaths = files.map((file2) =>
|
|
280040
|
+
const relativePaths = files.map((file2) => path35.relative(this.config.getTargetDir(), path35.join(resolvedDirPath, file2)));
|
|
279965
280041
|
const fileDiscovery = this.config.getFileService();
|
|
279966
280042
|
const { filteredPaths, ignoredCount } = fileDiscovery.filterFilesWithReport(relativePaths, {
|
|
279967
280043
|
respectGitIgnore: this.params.file_filtering_options?.respect_git_ignore ?? this.config.getFileFilteringOptions().respectGitIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectGitIgnore,
|
|
@@ -279969,15 +280045,15 @@ var LSToolInvocation = class extends BaseToolInvocation {
|
|
|
279969
280045
|
});
|
|
279970
280046
|
const entries2 = [];
|
|
279971
280047
|
for (const relativePath of filteredPaths) {
|
|
279972
|
-
const fullPath =
|
|
279973
|
-
if (this.shouldIgnore(
|
|
280048
|
+
const fullPath = path35.resolve(this.config.getTargetDir(), relativePath);
|
|
280049
|
+
if (this.shouldIgnore(path35.basename(fullPath), this.params.ignore)) {
|
|
279974
280050
|
continue;
|
|
279975
280051
|
}
|
|
279976
280052
|
try {
|
|
279977
280053
|
const stats2 = await fs31.stat(fullPath);
|
|
279978
280054
|
const isDir = stats2.isDirectory();
|
|
279979
280055
|
entries2.push({
|
|
279980
|
-
name:
|
|
280056
|
+
name: path35.basename(fullPath),
|
|
279981
280057
|
path: fullPath,
|
|
279982
280058
|
isDirectory: isDir,
|
|
279983
280059
|
size: isDir ? 0 : stats2.size,
|
|
@@ -280041,7 +280117,7 @@ var LSTool = class _LSTool extends BaseDeclarativeTool {
|
|
|
280041
280117
|
* @returns An error message string if invalid, null otherwise
|
|
280042
280118
|
*/
|
|
280043
280119
|
validateToolParamValues(params) {
|
|
280044
|
-
const resolvedPath =
|
|
280120
|
+
const resolvedPath = path35.resolve(this.config.getTargetDir(), params.dir_path);
|
|
280045
280121
|
return this.config.validatePathAccess(resolvedPath, "read");
|
|
280046
280122
|
}
|
|
280047
280123
|
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
@@ -280053,7 +280129,7 @@ var LSTool = class _LSTool extends BaseDeclarativeTool {
|
|
|
280053
280129
|
};
|
|
280054
280130
|
|
|
280055
280131
|
// packages/core/dist/src/tools/read-file.js
|
|
280056
|
-
import
|
|
280132
|
+
import path41 from "node:path";
|
|
280057
280133
|
|
|
280058
280134
|
// packages/core/dist/src/telemetry/telemetry-utils.js
|
|
280059
280135
|
function getProgrammingLanguage(args2) {
|
|
@@ -280067,19 +280143,19 @@ function getProgrammingLanguage(args2) {
|
|
|
280067
280143
|
// packages/core/dist/src/utils/gitIgnoreParser.js
|
|
280068
280144
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
280069
280145
|
import * as fs32 from "node:fs";
|
|
280070
|
-
import * as
|
|
280146
|
+
import * as path37 from "node:path";
|
|
280071
280147
|
|
|
280072
280148
|
// packages/core/dist/src/utils/ignorePathUtils.js
|
|
280073
|
-
import * as
|
|
280149
|
+
import * as path36 from "node:path";
|
|
280074
280150
|
function getNormalizedRelativePath(projectRoot, filePath, isDirectory) {
|
|
280075
280151
|
if (!filePath || typeof filePath !== "string") {
|
|
280076
280152
|
return null;
|
|
280077
280153
|
}
|
|
280078
|
-
const absoluteFilePath =
|
|
280154
|
+
const absoluteFilePath = path36.resolve(projectRoot, filePath);
|
|
280079
280155
|
if (!isWithinRoot(absoluteFilePath, projectRoot)) {
|
|
280080
280156
|
return null;
|
|
280081
280157
|
}
|
|
280082
|
-
const relativePath =
|
|
280158
|
+
const relativePath = path36.relative(projectRoot, absoluteFilePath);
|
|
280083
280159
|
let normalized2 = relativePath.replace(/\\/g, "/");
|
|
280084
280160
|
if (isDirectory && !normalized2.endsWith("/") && normalized2 !== "") {
|
|
280085
280161
|
normalized2 += "/";
|
|
@@ -280102,7 +280178,7 @@ var GitIgnoreParser = class {
|
|
|
280102
280178
|
processedExtraPatterns;
|
|
280103
280179
|
constructor(projectRoot, extraPatterns) {
|
|
280104
280180
|
this.extraPatterns = extraPatterns;
|
|
280105
|
-
this.projectRoot =
|
|
280181
|
+
this.projectRoot = path37.resolve(projectRoot);
|
|
280106
280182
|
this.processedExtraPatterns = (0, import_ignore.default)();
|
|
280107
280183
|
if (this.extraPatterns) {
|
|
280108
280184
|
this.processedExtraPatterns.add(this.processPatterns(this.extraPatterns, "."));
|
|
@@ -280115,8 +280191,8 @@ var GitIgnoreParser = class {
|
|
|
280115
280191
|
} catch {
|
|
280116
280192
|
return (0, import_ignore.default)();
|
|
280117
280193
|
}
|
|
280118
|
-
const isExcludeFile = patternsFilePath.endsWith(
|
|
280119
|
-
const relativeBaseDir = isExcludeFile ? "." :
|
|
280194
|
+
const isExcludeFile = patternsFilePath.endsWith(path37.join(".git", "info", "exclude"));
|
|
280195
|
+
const relativeBaseDir = isExcludeFile ? "." : path37.dirname(path37.relative(this.projectRoot, patternsFilePath)).split(path37.sep).join(path37.posix.sep);
|
|
280120
280196
|
const rawPatterns = content.split("\n");
|
|
280121
280197
|
return (0, import_ignore.default)().add(this.processPatterns(rawPatterns, relativeBaseDir));
|
|
280122
280198
|
}
|
|
@@ -280136,9 +280212,9 @@ var GitIgnoreParser = class {
|
|
|
280136
280212
|
let newPattern = p;
|
|
280137
280213
|
if (relativeBaseDir && relativeBaseDir !== ".") {
|
|
280138
280214
|
if (!isAnchoredInFile && !p.includes("/")) {
|
|
280139
|
-
newPattern =
|
|
280215
|
+
newPattern = path37.posix.join("**", p);
|
|
280140
280216
|
}
|
|
280141
|
-
newPattern =
|
|
280217
|
+
newPattern = path37.posix.join(relativeBaseDir, newPattern);
|
|
280142
280218
|
if (!newPattern.startsWith("/")) {
|
|
280143
280219
|
newPattern = "/" + newPattern;
|
|
280144
280220
|
}
|
|
@@ -280160,7 +280236,7 @@ var GitIgnoreParser = class {
|
|
|
280160
280236
|
try {
|
|
280161
280237
|
const ig = (0, import_ignore.default)().add(".git");
|
|
280162
280238
|
if (this.globalPatterns === void 0) {
|
|
280163
|
-
const excludeFile =
|
|
280239
|
+
const excludeFile = path37.join(this.projectRoot, ".git", "info", "exclude");
|
|
280164
280240
|
this.globalPatterns = fs32.existsSync(excludeFile) ? this.loadPatternsForFile(excludeFile) : (0, import_ignore.default)();
|
|
280165
280241
|
}
|
|
280166
280242
|
ig.add(this.globalPatterns);
|
|
@@ -280168,11 +280244,11 @@ var GitIgnoreParser = class {
|
|
|
280168
280244
|
let currentAbsDir = this.projectRoot;
|
|
280169
280245
|
const dirsToVisit = [this.projectRoot];
|
|
280170
280246
|
for (let i3 = 0; i3 < pathParts.length - 1; i3++) {
|
|
280171
|
-
currentAbsDir =
|
|
280247
|
+
currentAbsDir = path37.join(currentAbsDir, pathParts[i3]);
|
|
280172
280248
|
dirsToVisit.push(currentAbsDir);
|
|
280173
280249
|
}
|
|
280174
280250
|
for (const dir of dirsToVisit) {
|
|
280175
|
-
const relativeDir =
|
|
280251
|
+
const relativeDir = path37.relative(this.projectRoot, dir);
|
|
280176
280252
|
if (relativeDir) {
|
|
280177
280253
|
const parentDirRelative = getNormalizedRelativePath(this.projectRoot, dir, true);
|
|
280178
280254
|
const currentIg = (0, import_ignore.default)().add(ig).add(this.processedExtraPatterns);
|
|
@@ -280182,7 +280258,7 @@ var GitIgnoreParser = class {
|
|
|
280182
280258
|
}
|
|
280183
280259
|
let patterns = this.cache.get(dir);
|
|
280184
280260
|
if (patterns === void 0) {
|
|
280185
|
-
const gitignorePath =
|
|
280261
|
+
const gitignorePath = path37.join(dir, ".gitignore");
|
|
280186
280262
|
patterns = fs32.existsSync(gitignorePath) ? this.loadPatternsForFile(gitignorePath) : (0, import_ignore.default)();
|
|
280187
280263
|
this.cache.set(dir, patterns);
|
|
280188
280264
|
}
|
|
@@ -280198,14 +280274,14 @@ var GitIgnoreParser = class {
|
|
|
280198
280274
|
// packages/core/dist/src/utils/ignoreFileParser.js
|
|
280199
280275
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
280200
280276
|
import * as fs33 from "node:fs";
|
|
280201
|
-
import * as
|
|
280277
|
+
import * as path38 from "node:path";
|
|
280202
280278
|
var IgnoreFileParser = class {
|
|
280203
280279
|
projectRoot;
|
|
280204
280280
|
patterns = [];
|
|
280205
280281
|
ig = (0, import_ignore2.default)();
|
|
280206
280282
|
fileNames;
|
|
280207
280283
|
constructor(projectRoot, input, isPatterns = false) {
|
|
280208
|
-
this.projectRoot =
|
|
280284
|
+
this.projectRoot = path38.resolve(projectRoot);
|
|
280209
280285
|
if (isPatterns) {
|
|
280210
280286
|
this.fileNames = [];
|
|
280211
280287
|
const patterns = Array.isArray(input) ? input : [input];
|
|
@@ -280224,7 +280300,7 @@ var IgnoreFileParser = class {
|
|
|
280224
280300
|
}
|
|
280225
280301
|
}
|
|
280226
280302
|
parseIgnoreFile(fileName) {
|
|
280227
|
-
const patternsFilePath =
|
|
280303
|
+
const patternsFilePath = path38.join(this.projectRoot, fileName);
|
|
280228
280304
|
let content;
|
|
280229
280305
|
try {
|
|
280230
280306
|
content = fs33.readFileSync(patternsFilePath, "utf-8");
|
|
@@ -280249,7 +280325,7 @@ var IgnoreFileParser = class {
|
|
|
280249
280325
|
return this.patterns;
|
|
280250
280326
|
}
|
|
280251
280327
|
getIgnoreFilePaths() {
|
|
280252
|
-
return this.fileNames.slice().reverse().map((fileName) =>
|
|
280328
|
+
return this.fileNames.slice().reverse().map((fileName) => path38.join(this.projectRoot, fileName)).filter((filePath) => fs33.existsSync(filePath));
|
|
280253
280329
|
}
|
|
280254
280330
|
/**
|
|
280255
280331
|
* Returns true if at least one ignore file exists and has patterns.
|
|
@@ -280261,16 +280337,16 @@ var IgnoreFileParser = class {
|
|
|
280261
280337
|
|
|
280262
280338
|
// packages/core/dist/src/utils/gitUtils.js
|
|
280263
280339
|
import * as fs34 from "node:fs";
|
|
280264
|
-
import * as
|
|
280340
|
+
import * as path39 from "node:path";
|
|
280265
280341
|
function isGitRepository(directory) {
|
|
280266
280342
|
try {
|
|
280267
|
-
let currentDir =
|
|
280343
|
+
let currentDir = path39.resolve(directory);
|
|
280268
280344
|
while (true) {
|
|
280269
|
-
const gitDir =
|
|
280345
|
+
const gitDir = path39.join(currentDir, ".git");
|
|
280270
280346
|
if (fs34.existsSync(gitDir)) {
|
|
280271
280347
|
return true;
|
|
280272
280348
|
}
|
|
280273
|
-
const parentDir =
|
|
280349
|
+
const parentDir = path39.dirname(currentDir);
|
|
280274
280350
|
if (parentDir === currentDir) {
|
|
280275
280351
|
break;
|
|
280276
280352
|
}
|
|
@@ -280283,13 +280359,13 @@ function isGitRepository(directory) {
|
|
|
280283
280359
|
}
|
|
280284
280360
|
function findGitRoot(directory) {
|
|
280285
280361
|
try {
|
|
280286
|
-
let currentDir =
|
|
280362
|
+
let currentDir = path39.resolve(directory);
|
|
280287
280363
|
while (true) {
|
|
280288
|
-
const gitDir =
|
|
280364
|
+
const gitDir = path39.join(currentDir, ".git");
|
|
280289
280365
|
if (fs34.existsSync(gitDir)) {
|
|
280290
280366
|
return currentDir;
|
|
280291
280367
|
}
|
|
280292
|
-
const parentDir =
|
|
280368
|
+
const parentDir = path39.dirname(currentDir);
|
|
280293
280369
|
if (parentDir === currentDir) {
|
|
280294
280370
|
break;
|
|
280295
280371
|
}
|
|
@@ -280303,7 +280379,7 @@ function findGitRoot(directory) {
|
|
|
280303
280379
|
|
|
280304
280380
|
// packages/core/dist/src/services/fileDiscoveryService.js
|
|
280305
280381
|
import fs35 from "node:fs";
|
|
280306
|
-
import * as
|
|
280382
|
+
import * as path40 from "node:path";
|
|
280307
280383
|
var FileDiscoveryService = class {
|
|
280308
280384
|
gitIgnoreFilter = null;
|
|
280309
280385
|
geminiIgnoreFilter = null;
|
|
@@ -280316,7 +280392,7 @@ var FileDiscoveryService = class {
|
|
|
280316
280392
|
};
|
|
280317
280393
|
projectRoot;
|
|
280318
280394
|
constructor(projectRoot, options) {
|
|
280319
|
-
this.projectRoot =
|
|
280395
|
+
this.projectRoot = path40.resolve(projectRoot);
|
|
280320
280396
|
this.applyFilterFilesOptions(options);
|
|
280321
280397
|
if (isGitRepository(this.projectRoot)) {
|
|
280322
280398
|
this.gitIgnoreFilter = new GitIgnoreParser(this.projectRoot);
|
|
@@ -280358,7 +280434,7 @@ var FileDiscoveryService = class {
|
|
|
280358
280434
|
throw error40;
|
|
280359
280435
|
}
|
|
280360
280436
|
await Promise.all(dirEntries.map(async (entry) => {
|
|
280361
|
-
const fullPath =
|
|
280437
|
+
const fullPath = path40.join(currentDir, entry.name);
|
|
280362
280438
|
if (entry.isDirectory()) {
|
|
280363
280439
|
if (this.shouldIgnoreDirectory(fullPath, options)) {
|
|
280364
280440
|
ignoredPaths.push(fullPath);
|
|
@@ -280465,7 +280541,7 @@ var FileDiscoveryService = class {
|
|
|
280465
280541
|
getAllIgnoreFilePaths() {
|
|
280466
280542
|
const paths = [];
|
|
280467
280543
|
if (this.gitIgnoreFilter && this.defaultFilterFileOptions.respectGitIgnore) {
|
|
280468
|
-
const gitIgnorePath =
|
|
280544
|
+
const gitIgnorePath = path40.join(this.projectRoot, ".gitignore");
|
|
280469
280545
|
if (fs35.existsSync(gitIgnorePath)) {
|
|
280470
280546
|
paths.push(gitIgnorePath);
|
|
280471
280547
|
}
|
|
@@ -280481,7 +280557,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
280481
280557
|
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
280482
280558
|
super(params, messageBus, _toolName, _toolDisplayName);
|
|
280483
280559
|
this.config = config2;
|
|
280484
|
-
this.resolvedPath =
|
|
280560
|
+
this.resolvedPath = path41.resolve(this.config.getTargetDir(), this.params.file_path);
|
|
280485
280561
|
}
|
|
280486
280562
|
getDescription() {
|
|
280487
280563
|
const relativePath = makeRelative(this.resolvedPath, this.config.getTargetDir());
|
|
@@ -280542,7 +280618,7 @@ ${result2.llmContent}`;
|
|
|
280542
280618
|
const programming_language = getProgrammingLanguage({
|
|
280543
280619
|
file_path: this.resolvedPath
|
|
280544
280620
|
});
|
|
280545
|
-
logFileOperation(this.config, new FileOperationEvent(READ_FILE_TOOL_NAME, FileOperation.READ, lines, mimetype,
|
|
280621
|
+
logFileOperation(this.config, new FileOperationEvent(READ_FILE_TOOL_NAME, FileOperation.READ, lines, mimetype, path41.extname(this.resolvedPath), programming_language));
|
|
280546
280622
|
const jitContext = await discoverJitContext(this.config, this.resolvedPath);
|
|
280547
280623
|
if (jitContext) {
|
|
280548
280624
|
if (typeof llmContent === "string") {
|
|
@@ -280570,7 +280646,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
280570
280646
|
if (params.file_path.trim() === "") {
|
|
280571
280647
|
return "The 'file_path' parameter must be non-empty.";
|
|
280572
280648
|
}
|
|
280573
|
-
const resolvedPath =
|
|
280649
|
+
const resolvedPath = path41.resolve(this.config.getTargetDir(), params.file_path);
|
|
280574
280650
|
const validationError = this.config.validatePathAccess(resolvedPath, "read");
|
|
280575
280651
|
if (validationError) {
|
|
280576
280652
|
return validationError;
|
|
@@ -280601,7 +280677,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
280601
280677
|
// packages/core/dist/src/tools/grep.js
|
|
280602
280678
|
import fs36 from "node:fs";
|
|
280603
280679
|
import fsPromises7 from "node:fs/promises";
|
|
280604
|
-
import
|
|
280680
|
+
import path43 from "node:path";
|
|
280605
280681
|
import { spawn as spawn5 } from "node:child_process";
|
|
280606
280682
|
|
|
280607
280683
|
// node_modules/balanced-match/dist/esm/index.js
|
|
@@ -281662,11 +281738,11 @@ var qmarksTestNoExtDot = ([$0]) => {
|
|
|
281662
281738
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
281663
281739
|
};
|
|
281664
281740
|
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
281665
|
-
var
|
|
281741
|
+
var path42 = {
|
|
281666
281742
|
win32: { sep: "\\" },
|
|
281667
281743
|
posix: { sep: "/" }
|
|
281668
281744
|
};
|
|
281669
|
-
var sep3 = defaultPlatform === "win32" ?
|
|
281745
|
+
var sep3 = defaultPlatform === "win32" ? path42.win32.sep : path42.posix.sep;
|
|
281670
281746
|
minimatch.sep = sep3;
|
|
281671
281747
|
var GLOBSTAR = Symbol("globstar **");
|
|
281672
281748
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -287650,14 +287726,14 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
287650
287726
|
const [, filePathRaw, lineNumberStr, lineContent] = match2;
|
|
287651
287727
|
const lineNumber = parseInt(lineNumberStr, 10);
|
|
287652
287728
|
if (!isNaN(lineNumber)) {
|
|
287653
|
-
const absoluteFilePath =
|
|
287654
|
-
const relativeCheck =
|
|
287655
|
-
if (relativeCheck === ".." || relativeCheck.startsWith(`..${
|
|
287729
|
+
const absoluteFilePath = path43.resolve(basePath, filePathRaw);
|
|
287730
|
+
const relativeCheck = path43.relative(basePath, absoluteFilePath);
|
|
287731
|
+
if (relativeCheck === ".." || relativeCheck.startsWith(`..${path43.sep}`) || path43.isAbsolute(relativeCheck)) {
|
|
287656
287732
|
return null;
|
|
287657
287733
|
}
|
|
287658
|
-
const relativeFilePath =
|
|
287734
|
+
const relativeFilePath = path43.relative(basePath, absoluteFilePath);
|
|
287659
287735
|
return {
|
|
287660
|
-
filePath: relativeFilePath ||
|
|
287736
|
+
filePath: relativeFilePath || path43.basename(absoluteFilePath),
|
|
287661
287737
|
absolutePath: absoluteFilePath,
|
|
287662
287738
|
lineNumber,
|
|
287663
287739
|
line: lineContent
|
|
@@ -287671,7 +287747,7 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
287671
287747
|
const pathParam = this.params.dir_path;
|
|
287672
287748
|
let searchDirAbs = null;
|
|
287673
287749
|
if (pathParam) {
|
|
287674
|
-
searchDirAbs =
|
|
287750
|
+
searchDirAbs = path43.resolve(this.config.getTargetDir(), pathParam);
|
|
287675
287751
|
const validationError = this.config.validatePathAccess(searchDirAbs, "read");
|
|
287676
287752
|
if (validationError) {
|
|
287677
287753
|
return {
|
|
@@ -287753,9 +287829,9 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
287753
287829
|
signal: timeoutController.signal
|
|
287754
287830
|
});
|
|
287755
287831
|
if (searchDirectories.length > 1) {
|
|
287756
|
-
const dirName =
|
|
287832
|
+
const dirName = path43.basename(searchDir);
|
|
287757
287833
|
matches.forEach((match2) => {
|
|
287758
|
-
match2.filePath =
|
|
287834
|
+
match2.filePath = path43.join(dirName, match2.filePath);
|
|
287759
287835
|
});
|
|
287760
287836
|
}
|
|
287761
287837
|
allMatches = allMatches.concat(matches);
|
|
@@ -287979,8 +288055,8 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
287979
288055
|
if (allMatches.length >= maxMatches)
|
|
287980
288056
|
break;
|
|
287981
288057
|
const fileAbsolutePath = filePath;
|
|
287982
|
-
const relativePath =
|
|
287983
|
-
if (relativePath === ".." || relativePath.startsWith(`..${
|
|
288058
|
+
const relativePath = path43.relative(absolutePath, fileAbsolutePath);
|
|
288059
|
+
if (relativePath === ".." || relativePath.startsWith(`..${path43.sep}`) || path43.isAbsolute(relativePath))
|
|
287984
288060
|
continue;
|
|
287985
288061
|
try {
|
|
287986
288062
|
const content = await fsPromises7.readFile(fileAbsolutePath, "utf8");
|
|
@@ -287993,7 +288069,7 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
287993
288069
|
continue;
|
|
287994
288070
|
}
|
|
287995
288071
|
allMatches.push({
|
|
287996
|
-
filePath:
|
|
288072
|
+
filePath: path43.relative(absolutePath, fileAbsolutePath) || path43.basename(fileAbsolutePath),
|
|
287997
288073
|
absolutePath: fileAbsolutePath,
|
|
287998
288074
|
lineNumber: index + 1,
|
|
287999
288075
|
line
|
|
@@ -288024,7 +288100,7 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
288024
288100
|
description += ` in ${this.params.include_pattern}`;
|
|
288025
288101
|
}
|
|
288026
288102
|
if (this.params.dir_path) {
|
|
288027
|
-
const resolvedPath =
|
|
288103
|
+
const resolvedPath = path43.resolve(this.config.getTargetDir(), this.params.dir_path);
|
|
288028
288104
|
if (resolvedPath === this.config.getTargetDir() || this.params.dir_path === ".") {
|
|
288029
288105
|
description += ` within ./`;
|
|
288030
288106
|
} else {
|
|
@@ -288073,7 +288149,7 @@ var GrepTool = class _GrepTool extends BaseDeclarativeTool {
|
|
|
288073
288149
|
return "total_max_matches must be at least 1.";
|
|
288074
288150
|
}
|
|
288075
288151
|
if (params.dir_path) {
|
|
288076
|
-
const resolvedPath =
|
|
288152
|
+
const resolvedPath = path43.resolve(this.config.getTargetDir(), params.dir_path);
|
|
288077
288153
|
const validationError = this.config.validatePathAccess(resolvedPath, "read");
|
|
288078
288154
|
if (validationError) {
|
|
288079
288155
|
return validationError;
|
|
@@ -288103,10 +288179,10 @@ var GrepTool = class _GrepTool extends BaseDeclarativeTool {
|
|
|
288103
288179
|
// packages/core/dist/src/tools/ripGrep.js
|
|
288104
288180
|
import fs38 from "node:fs";
|
|
288105
288181
|
import fsPromises9 from "node:fs/promises";
|
|
288106
|
-
import
|
|
288182
|
+
import path51 from "node:path";
|
|
288107
288183
|
|
|
288108
288184
|
// node_modules/@joshua.litt/get-ripgrep/dist/index.js
|
|
288109
|
-
import { dirname as dirname9, join as
|
|
288185
|
+
import { dirname as dirname9, join as join13 } from "node:path";
|
|
288110
288186
|
import { fileURLToPath as fileURLToPath13 } from "node:url";
|
|
288111
288187
|
|
|
288112
288188
|
// node_modules/@lvce-editor/verror/dist/index.js
|
|
@@ -289007,12 +289083,12 @@ var handleCommand = (filePath, rawArguments, rawOptions) => {
|
|
|
289007
289083
|
|
|
289008
289084
|
// node_modules/execa/lib/arguments/options.js
|
|
289009
289085
|
var import_cross_spawn2 = __toESM(require_cross_spawn(), 1);
|
|
289010
|
-
import
|
|
289086
|
+
import path48 from "node:path";
|
|
289011
289087
|
import process16 from "node:process";
|
|
289012
289088
|
|
|
289013
289089
|
// node_modules/npm-run-path/index.js
|
|
289014
289090
|
import process14 from "node:process";
|
|
289015
|
-
import
|
|
289091
|
+
import path45 from "node:path";
|
|
289016
289092
|
|
|
289017
289093
|
// node_modules/npm-run-path/node_modules/path-key/index.js
|
|
289018
289094
|
function pathKey(options = {}) {
|
|
@@ -289029,7 +289105,7 @@ function pathKey(options = {}) {
|
|
|
289029
289105
|
// node_modules/npm-run-path/node_modules/unicorn-magic/node.js
|
|
289030
289106
|
import { promisify as promisify8 } from "node:util";
|
|
289031
289107
|
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
|
|
289032
|
-
import
|
|
289108
|
+
import path44 from "node:path";
|
|
289033
289109
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
289034
289110
|
var execFileOriginal = promisify8(execFileCallback);
|
|
289035
289111
|
function toPath3(urlOrPath) {
|
|
@@ -289038,12 +289114,12 @@ function toPath3(urlOrPath) {
|
|
|
289038
289114
|
function traversePathUp(startPath) {
|
|
289039
289115
|
return {
|
|
289040
289116
|
*[Symbol.iterator]() {
|
|
289041
|
-
let currentPath =
|
|
289117
|
+
let currentPath = path44.resolve(toPath3(startPath));
|
|
289042
289118
|
let previousPath;
|
|
289043
289119
|
while (previousPath !== currentPath) {
|
|
289044
289120
|
yield currentPath;
|
|
289045
289121
|
previousPath = currentPath;
|
|
289046
|
-
currentPath =
|
|
289122
|
+
currentPath = path44.resolve(currentPath, "..");
|
|
289047
289123
|
}
|
|
289048
289124
|
}
|
|
289049
289125
|
};
|
|
@@ -289058,27 +289134,27 @@ var npmRunPath = ({
|
|
|
289058
289134
|
execPath: execPath2 = process14.execPath,
|
|
289059
289135
|
addExecPath = true
|
|
289060
289136
|
} = {}) => {
|
|
289061
|
-
const cwdPath =
|
|
289137
|
+
const cwdPath = path45.resolve(toPath3(cwd));
|
|
289062
289138
|
const result2 = [];
|
|
289063
|
-
const pathParts = pathOption.split(
|
|
289139
|
+
const pathParts = pathOption.split(path45.delimiter);
|
|
289064
289140
|
if (preferLocal) {
|
|
289065
289141
|
applyPreferLocal(result2, pathParts, cwdPath);
|
|
289066
289142
|
}
|
|
289067
289143
|
if (addExecPath) {
|
|
289068
289144
|
applyExecPath(result2, pathParts, execPath2, cwdPath);
|
|
289069
289145
|
}
|
|
289070
|
-
return pathOption === "" || pathOption ===
|
|
289146
|
+
return pathOption === "" || pathOption === path45.delimiter ? `${result2.join(path45.delimiter)}${pathOption}` : [...result2, pathOption].join(path45.delimiter);
|
|
289071
289147
|
};
|
|
289072
289148
|
var applyPreferLocal = (result2, pathParts, cwdPath) => {
|
|
289073
289149
|
for (const directory of traversePathUp(cwdPath)) {
|
|
289074
|
-
const pathPart =
|
|
289150
|
+
const pathPart = path45.join(directory, "node_modules/.bin");
|
|
289075
289151
|
if (!pathParts.includes(pathPart)) {
|
|
289076
289152
|
result2.push(pathPart);
|
|
289077
289153
|
}
|
|
289078
289154
|
}
|
|
289079
289155
|
};
|
|
289080
289156
|
var applyExecPath = (result2, pathParts, execPath2, cwdPath) => {
|
|
289081
|
-
const pathPart =
|
|
289157
|
+
const pathPart = path45.resolve(cwdPath, toPath3(execPath2), "..");
|
|
289082
289158
|
if (!pathParts.includes(pathPart)) {
|
|
289083
289159
|
result2.push(pathPart);
|
|
289084
289160
|
}
|
|
@@ -290233,7 +290309,7 @@ var killAfterTimeout = async (subprocess, timeout, context2, { signal }) => {
|
|
|
290233
290309
|
|
|
290234
290310
|
// node_modules/execa/lib/methods/node.js
|
|
290235
290311
|
import { execPath, execArgv } from "node:process";
|
|
290236
|
-
import
|
|
290312
|
+
import path46 from "node:path";
|
|
290237
290313
|
var mapNode = ({ options }) => {
|
|
290238
290314
|
if (options.node === false) {
|
|
290239
290315
|
throw new TypeError('The "node" option cannot be false with `execaNode()`.');
|
|
@@ -290252,7 +290328,7 @@ var handleNodeOption = (file2, commandArguments, {
|
|
|
290252
290328
|
throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');
|
|
290253
290329
|
}
|
|
290254
290330
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath2, 'The "nodePath" option');
|
|
290255
|
-
const resolvedNodePath =
|
|
290331
|
+
const resolvedNodePath = path46.resolve(cwd, normalizedNodePath);
|
|
290256
290332
|
const newOptions = {
|
|
290257
290333
|
...options,
|
|
290258
290334
|
nodePath: resolvedNodePath,
|
|
@@ -290262,7 +290338,7 @@ var handleNodeOption = (file2, commandArguments, {
|
|
|
290262
290338
|
if (!shouldHandleNode) {
|
|
290263
290339
|
return [file2, commandArguments, newOptions];
|
|
290264
290340
|
}
|
|
290265
|
-
if (
|
|
290341
|
+
if (path46.basename(file2, ".exe") === "node") {
|
|
290266
290342
|
throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');
|
|
290267
290343
|
}
|
|
290268
290344
|
return [
|
|
@@ -290352,11 +290428,11 @@ var serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encodin
|
|
|
290352
290428
|
|
|
290353
290429
|
// node_modules/execa/lib/arguments/cwd.js
|
|
290354
290430
|
import { statSync } from "node:fs";
|
|
290355
|
-
import
|
|
290431
|
+
import path47 from "node:path";
|
|
290356
290432
|
import process15 from "node:process";
|
|
290357
290433
|
var normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
290358
290434
|
const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
|
|
290359
|
-
return
|
|
290435
|
+
return path47.resolve(cwdString);
|
|
290360
290436
|
};
|
|
290361
290437
|
var getDefaultCwd = () => {
|
|
290362
290438
|
try {
|
|
@@ -290403,7 +290479,7 @@ var normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
290403
290479
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
290404
290480
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
290405
290481
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
290406
|
-
if (process16.platform === "win32" &&
|
|
290482
|
+
if (process16.platform === "win32" && path48.basename(file2, ".exe") === "cmd") {
|
|
290407
290483
|
commandArguments.unshift("/q");
|
|
290408
290484
|
}
|
|
290409
290485
|
return { file: file2, commandArguments, options };
|
|
@@ -300927,7 +301003,7 @@ var source_default2 = got;
|
|
|
300927
301003
|
|
|
300928
301004
|
// node_modules/@joshua.litt/get-ripgrep/dist/downloadRipGrep.js
|
|
300929
301005
|
import * as os23 from "node:os";
|
|
300930
|
-
import { dirname as dirname8, join as
|
|
301006
|
+
import { dirname as dirname8, join as join12 } from "node:path";
|
|
300931
301007
|
|
|
300932
301008
|
// node_modules/@joshua.litt/get-ripgrep/node_modules/path-exists/index.js
|
|
300933
301009
|
import fs37, { promises as fsPromises8 } from "node:fs";
|
|
@@ -300946,13 +301022,13 @@ import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
|
300946
301022
|
|
|
300947
301023
|
// node_modules/xdg-basedir/index.js
|
|
300948
301024
|
import os22 from "os";
|
|
300949
|
-
import
|
|
301025
|
+
import path49 from "path";
|
|
300950
301026
|
var homeDirectory = os22.homedir();
|
|
300951
301027
|
var { env } = process;
|
|
300952
|
-
var xdgData = env.XDG_DATA_HOME || (homeDirectory ?
|
|
300953
|
-
var xdgConfig = env.XDG_CONFIG_HOME || (homeDirectory ?
|
|
300954
|
-
var xdgState = env.XDG_STATE_HOME || (homeDirectory ?
|
|
300955
|
-
var xdgCache = env.XDG_CACHE_HOME || (homeDirectory ?
|
|
301028
|
+
var xdgData = env.XDG_DATA_HOME || (homeDirectory ? path49.join(homeDirectory, ".local", "share") : void 0);
|
|
301029
|
+
var xdgConfig = env.XDG_CONFIG_HOME || (homeDirectory ? path49.join(homeDirectory, ".config") : void 0);
|
|
301030
|
+
var xdgState = env.XDG_STATE_HOME || (homeDirectory ? path49.join(homeDirectory, ".local", "state") : void 0);
|
|
301031
|
+
var xdgCache = env.XDG_CACHE_HOME || (homeDirectory ? path49.join(homeDirectory, ".cache") : void 0);
|
|
300956
301032
|
var xdgRuntime = env.XDG_RUNTIME_DIR || void 0;
|
|
300957
301033
|
var xdgDataDirectories = (env.XDG_DATA_DIRS || "/usr/local/share/:/usr/share/").split(":");
|
|
300958
301034
|
if (xdgData) {
|
|
@@ -300964,12 +301040,12 @@ if (xdgConfig) {
|
|
|
300964
301040
|
}
|
|
300965
301041
|
|
|
300966
301042
|
// node_modules/@joshua.litt/get-ripgrep/dist/downloadRipGrep.js
|
|
300967
|
-
import
|
|
301043
|
+
import path50 from "path";
|
|
300968
301044
|
var { mkdir: mkdir2, createWriteStream: createWriteStream3, move } = import_fs_extra.default;
|
|
300969
301045
|
var __dirname6 = dirname8(fileURLToPath12(import.meta.url));
|
|
300970
301046
|
var REPOSITORY = `microsoft/ripgrep-prebuilt`;
|
|
300971
301047
|
var VERSION2 = process.env.RIPGREP_VERSION || "v13.0.0-10";
|
|
300972
|
-
var BIN_PATH =
|
|
301048
|
+
var BIN_PATH = join12(__dirname6, "../bin");
|
|
300973
301049
|
var getTarget = () => {
|
|
300974
301050
|
const arch4 = process.env.npm_config_arch || os23.arch();
|
|
300975
301051
|
const platform10 = process.env.platform || os23.platform();
|
|
@@ -301013,8 +301089,8 @@ var getTarget = () => {
|
|
|
301013
301089
|
var downloadFile = async (url3, outFile) => {
|
|
301014
301090
|
let tmpDir = void 0;
|
|
301015
301091
|
try {
|
|
301016
|
-
tmpDir = await import_fs_extra.default.mkdtemp(
|
|
301017
|
-
const tmpFile =
|
|
301092
|
+
tmpDir = await import_fs_extra.default.mkdtemp(path50.join(os23.tmpdir(), "download-ripgrep"));
|
|
301093
|
+
const tmpFile = path50.join(tmpDir, "tmp-file");
|
|
301018
301094
|
await pipeline(source_default2.stream(url3), createWriteStream3(tmpFile));
|
|
301019
301095
|
await mkdir2(dirname8(outFile), { recursive: true });
|
|
301020
301096
|
await move(tmpFile, outFile);
|
|
@@ -301063,7 +301139,7 @@ var downloadRipGrep = async (overrideBinPath) => {
|
|
|
301063
301139
|
|
|
301064
301140
|
// node_modules/@joshua.litt/get-ripgrep/dist/index.js
|
|
301065
301141
|
var __dirname7 = dirname9(fileURLToPath13(import.meta.url));
|
|
301066
|
-
var rgPath =
|
|
301142
|
+
var rgPath = join13(__dirname7, "..", "bin", `rg${process.platform === "win32" ? ".exe" : ""}`);
|
|
301067
301143
|
|
|
301068
301144
|
// packages/core/dist/src/tools/ripGrep.js
|
|
301069
301145
|
function getRgCandidateFilenames() {
|
|
@@ -301072,7 +301148,7 @@ function getRgCandidateFilenames() {
|
|
|
301072
301148
|
async function resolveExistingRgPath() {
|
|
301073
301149
|
const binDir = Storage.getGlobalBinDir();
|
|
301074
301150
|
for (const fileName of getRgCandidateFilenames()) {
|
|
301075
|
-
const candidatePath =
|
|
301151
|
+
const candidatePath = path51.join(binDir, fileName);
|
|
301076
301152
|
if (await fileExists(candidatePath)) {
|
|
301077
301153
|
return candidatePath;
|
|
301078
301154
|
}
|
|
@@ -301118,7 +301194,7 @@ var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
|
301118
301194
|
async execute({ abortSignal: signal }) {
|
|
301119
301195
|
try {
|
|
301120
301196
|
const pathParam = this.params.dir_path || ".";
|
|
301121
|
-
const searchDirAbs =
|
|
301197
|
+
const searchDirAbs = path51.resolve(this.config.getTargetDir(), pathParam);
|
|
301122
301198
|
const validationError = this.config.validatePathAccess(searchDirAbs, "read");
|
|
301123
301199
|
if (validationError) {
|
|
301124
301200
|
return {
|
|
@@ -301199,10 +301275,10 @@ var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
|
301199
301275
|
}
|
|
301200
301276
|
if (!this.params.no_ignore) {
|
|
301201
301277
|
const uniqueFiles = Array.from(new Set(allMatches.map((m) => m.filePath)));
|
|
301202
|
-
const absoluteFilePaths = uniqueFiles.map((f) =>
|
|
301278
|
+
const absoluteFilePaths = uniqueFiles.map((f) => path51.resolve(searchDirAbs, f));
|
|
301203
301279
|
const allowedFiles = this.fileDiscoveryService.filterFiles(absoluteFilePaths);
|
|
301204
301280
|
const allowedSet = new Set(allowedFiles);
|
|
301205
|
-
allMatches = allMatches.filter((m) => allowedSet.has(
|
|
301281
|
+
allMatches = allMatches.filter((m) => allowedSet.has(path51.resolve(searchDirAbs, m.filePath)));
|
|
301206
301282
|
}
|
|
301207
301283
|
const matchCount = allMatches.filter((m) => !m.isContext).length;
|
|
301208
301284
|
allMatches = await this.enrichWithRipgrepAutoContext(allMatches, matchCount, totalMaxMatches, searchDirAbs, timeoutController.signal);
|
|
@@ -301335,15 +301411,15 @@ var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
|
301335
301411
|
if (json3.type === "match" || json3.type === "context") {
|
|
301336
301412
|
const data = json3.data;
|
|
301337
301413
|
if (data.path?.text && data.lines?.text) {
|
|
301338
|
-
const absoluteFilePath =
|
|
301339
|
-
const relativeCheck =
|
|
301340
|
-
if (relativeCheck === ".." || relativeCheck.startsWith(`..${
|
|
301414
|
+
const absoluteFilePath = path51.resolve(basePath, data.path.text);
|
|
301415
|
+
const relativeCheck = path51.relative(basePath, absoluteFilePath);
|
|
301416
|
+
if (relativeCheck === ".." || relativeCheck.startsWith(`..${path51.sep}`) || path51.isAbsolute(relativeCheck)) {
|
|
301341
301417
|
return null;
|
|
301342
301418
|
}
|
|
301343
|
-
const relativeFilePath =
|
|
301419
|
+
const relativeFilePath = path51.relative(basePath, absoluteFilePath);
|
|
301344
301420
|
return {
|
|
301345
301421
|
absolutePath: absoluteFilePath,
|
|
301346
|
-
filePath: relativeFilePath ||
|
|
301422
|
+
filePath: relativeFilePath || path51.basename(absoluteFilePath),
|
|
301347
301423
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
301348
301424
|
lineNumber: data.line_number,
|
|
301349
301425
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -301370,7 +301446,7 @@ var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
|
301370
301446
|
description += ` in ${this.params.include_pattern}`;
|
|
301371
301447
|
}
|
|
301372
301448
|
const pathParam = this.params.dir_path || ".";
|
|
301373
|
-
const resolvedPath =
|
|
301449
|
+
const resolvedPath = path51.resolve(this.config.getTargetDir(), pathParam);
|
|
301374
301450
|
if (resolvedPath === this.config.getTargetDir() || pathParam === ".") {
|
|
301375
301451
|
description += ` within ./`;
|
|
301376
301452
|
} else {
|
|
@@ -301426,7 +301502,7 @@ var RipGrepTool = class _RipGrepTool extends BaseDeclarativeTool {
|
|
|
301426
301502
|
return "total_max_matches must be at least 1.";
|
|
301427
301503
|
}
|
|
301428
301504
|
if (params.dir_path) {
|
|
301429
|
-
const resolvedPath =
|
|
301505
|
+
const resolvedPath = path51.resolve(this.config.getTargetDir(), params.dir_path);
|
|
301430
301506
|
const validationError = this.config.validatePathAccess(resolvedPath, "read");
|
|
301431
301507
|
if (validationError) {
|
|
301432
301508
|
return validationError;
|
|
@@ -301455,7 +301531,7 @@ var RipGrepTool = class _RipGrepTool extends BaseDeclarativeTool {
|
|
|
301455
301531
|
|
|
301456
301532
|
// packages/core/dist/src/tools/glob.js
|
|
301457
301533
|
import fs39 from "node:fs";
|
|
301458
|
-
import
|
|
301534
|
+
import path52 from "node:path";
|
|
301459
301535
|
function sortFileEntries(entries2, nowTimestamp, recencyThresholdMs) {
|
|
301460
301536
|
const sortedEntries = [...entries2];
|
|
301461
301537
|
sortedEntries.sort((a2, b) => {
|
|
@@ -301484,7 +301560,7 @@ var GlobToolInvocation = class extends BaseToolInvocation {
|
|
|
301484
301560
|
getDescription() {
|
|
301485
301561
|
let description = `'${this.params.pattern}'`;
|
|
301486
301562
|
if (this.params.dir_path) {
|
|
301487
|
-
const searchDir =
|
|
301563
|
+
const searchDir = path52.resolve(this.config.getTargetDir(), this.params.dir_path || ".");
|
|
301488
301564
|
const relativePath = makeRelative(searchDir, this.config.getTargetDir());
|
|
301489
301565
|
description += ` within ${shortenPath(relativePath)}`;
|
|
301490
301566
|
}
|
|
@@ -301501,7 +301577,7 @@ var GlobToolInvocation = class extends BaseToolInvocation {
|
|
|
301501
301577
|
const workspaceDirectories = workspaceContext.getDirectories();
|
|
301502
301578
|
let searchDirectories;
|
|
301503
301579
|
if (this.params.dir_path) {
|
|
301504
|
-
const searchDirAbsolute =
|
|
301580
|
+
const searchDirAbsolute = path52.resolve(this.config.getTargetDir(), this.params.dir_path);
|
|
301505
301581
|
const validationError = this.config.validatePathAccess(searchDirAbsolute, "read");
|
|
301506
301582
|
if (validationError) {
|
|
301507
301583
|
return {
|
|
@@ -301521,7 +301597,7 @@ var GlobToolInvocation = class extends BaseToolInvocation {
|
|
|
301521
301597
|
const allEntries = [];
|
|
301522
301598
|
for (const searchDir of searchDirectories) {
|
|
301523
301599
|
let pattern = this.params.pattern;
|
|
301524
|
-
const fullPath =
|
|
301600
|
+
const fullPath = path52.join(searchDir, pattern);
|
|
301525
301601
|
if (fs39.existsSync(fullPath)) {
|
|
301526
301602
|
pattern = escape2(pattern);
|
|
301527
301603
|
}
|
|
@@ -301538,12 +301614,12 @@ var GlobToolInvocation = class extends BaseToolInvocation {
|
|
|
301538
301614
|
});
|
|
301539
301615
|
allEntries.push(...entries2);
|
|
301540
301616
|
}
|
|
301541
|
-
const relativePaths = allEntries.map((p) =>
|
|
301617
|
+
const relativePaths = allEntries.map((p) => path52.relative(this.config.getTargetDir(), p.fullpath()));
|
|
301542
301618
|
const { filteredPaths, ignoredCount } = fileDiscovery.filterFilesWithReport(relativePaths, {
|
|
301543
301619
|
respectGitIgnore: this.params?.respect_git_ignore ?? this.config.getFileFilteringOptions().respectGitIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectGitIgnore,
|
|
301544
301620
|
respectGeminiIgnore: this.params?.respect_gemini_ignore ?? this.config.getFileFilteringOptions().respectGeminiIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectGeminiIgnore
|
|
301545
301621
|
});
|
|
301546
|
-
const filteredAbsolutePaths = new Set(filteredPaths.map((p) =>
|
|
301622
|
+
const filteredAbsolutePaths = new Set(filteredPaths.map((p) => path52.resolve(this.config.getTargetDir(), p)));
|
|
301547
301623
|
const filteredEntries = allEntries.filter((entry) => filteredAbsolutePaths.has(entry.fullpath()));
|
|
301548
301624
|
if (!filteredEntries || filteredEntries.length === 0) {
|
|
301549
301625
|
let message = `No files found matching pattern "${this.params.pattern}"`;
|
|
@@ -301607,7 +301683,7 @@ var GlobTool = class _GlobTool extends BaseDeclarativeTool {
|
|
|
301607
301683
|
* Validates the parameters for the tool.
|
|
301608
301684
|
*/
|
|
301609
301685
|
validateToolParamValues(params) {
|
|
301610
|
-
const searchDirAbsolute =
|
|
301686
|
+
const searchDirAbsolute = path52.resolve(this.config.getTargetDir(), params.dir_path || ".");
|
|
301611
301687
|
const validationError = this.config.validatePathAccess(searchDirAbsolute, "read");
|
|
301612
301688
|
if (validationError) {
|
|
301613
301689
|
return validationError;
|
|
@@ -301637,11 +301713,11 @@ var GlobTool = class _GlobTool extends BaseDeclarativeTool {
|
|
|
301637
301713
|
};
|
|
301638
301714
|
|
|
301639
301715
|
// packages/core/dist/src/tools/activate-skill.js
|
|
301640
|
-
import * as
|
|
301716
|
+
import * as path54 from "node:path";
|
|
301641
301717
|
|
|
301642
301718
|
// packages/core/dist/src/utils/getFolderStructure.js
|
|
301643
301719
|
import * as fs40 from "node:fs/promises";
|
|
301644
|
-
import * as
|
|
301720
|
+
import * as path53 from "node:path";
|
|
301645
301721
|
var MAX_ITEMS = 200;
|
|
301646
301722
|
var TRUNCATION_INDICATOR = "...";
|
|
301647
301723
|
var DEFAULT_IGNORED_FOLDERS = /* @__PURE__ */ new Set([
|
|
@@ -301651,7 +301727,7 @@ var DEFAULT_IGNORED_FOLDERS = /* @__PURE__ */ new Set([
|
|
|
301651
301727
|
"__pycache__"
|
|
301652
301728
|
]);
|
|
301653
301729
|
async function readFullStructure(rootPath, options) {
|
|
301654
|
-
const rootName =
|
|
301730
|
+
const rootName = path53.basename(rootPath);
|
|
301655
301731
|
const rootNode = {
|
|
301656
301732
|
name: rootName,
|
|
301657
301733
|
path: rootPath,
|
|
@@ -301701,7 +301777,7 @@ async function readFullStructure(rootPath, options) {
|
|
|
301701
301777
|
break;
|
|
301702
301778
|
}
|
|
301703
301779
|
const fileName = entry.name;
|
|
301704
|
-
const filePath =
|
|
301780
|
+
const filePath = path53.join(currentPath, fileName);
|
|
301705
301781
|
if (options.fileService?.shouldIgnoreFile(filePath, filterFileOptions)) {
|
|
301706
301782
|
continue;
|
|
301707
301783
|
}
|
|
@@ -301721,7 +301797,7 @@ async function readFullStructure(rootPath, options) {
|
|
|
301721
301797
|
break;
|
|
301722
301798
|
}
|
|
301723
301799
|
const subFolderName = entry.name;
|
|
301724
|
-
const subFolderPath =
|
|
301800
|
+
const subFolderPath = path53.join(currentPath, subFolderName);
|
|
301725
301801
|
const isIgnored = options.fileService?.shouldIgnoreDirectory(subFolderPath, filterFileOptions) ?? false;
|
|
301726
301802
|
if (options.ignoredFolders.has(subFolderName) || isIgnored) {
|
|
301727
301803
|
const ignoredSubFolder = {
|
|
@@ -301759,7 +301835,7 @@ async function readFullStructure(rootPath, options) {
|
|
|
301759
301835
|
function formatStructure(node, currentIndent, isLastChildOfParent, isProcessingRootNode, builder) {
|
|
301760
301836
|
const connector = isLastChildOfParent ? "\u2514\u2500\u2500\u2500" : "\u251C\u2500\u2500\u2500";
|
|
301761
301837
|
if (!isProcessingRootNode || node.isIgnored) {
|
|
301762
|
-
builder.push(`${currentIndent}${connector}${node.name}${
|
|
301838
|
+
builder.push(`${currentIndent}${connector}${node.name}${path53.sep}${node.isIgnored ? TRUNCATION_INDICATOR : ""}`);
|
|
301763
301839
|
}
|
|
301764
301840
|
const indentForChildren = isProcessingRootNode ? "" : currentIndent + (isLastChildOfParent ? " " : "\u2502 ");
|
|
301765
301841
|
const fileCount = node.files.length;
|
|
@@ -301783,7 +301859,7 @@ function formatStructure(node, currentIndent, isLastChildOfParent, isProcessingR
|
|
|
301783
301859
|
}
|
|
301784
301860
|
}
|
|
301785
301861
|
async function getFolderStructure(directory, options) {
|
|
301786
|
-
const resolvedPath =
|
|
301862
|
+
const resolvedPath = path53.resolve(directory);
|
|
301787
301863
|
const mergedOptions = {
|
|
301788
301864
|
maxItems: options?.maxItems ?? MAX_ITEMS,
|
|
301789
301865
|
ignoredFolders: options?.ignoredFolders ?? DEFAULT_IGNORED_FOLDERS,
|
|
@@ -301816,7 +301892,7 @@ async function getFolderStructure(directory, options) {
|
|
|
301816
301892
|
}
|
|
301817
301893
|
return `${summary}
|
|
301818
301894
|
|
|
301819
|
-
${resolvedPath}${
|
|
301895
|
+
${resolvedPath}${path53.sep}
|
|
301820
301896
|
${structureLines.join("\n")}`;
|
|
301821
301897
|
} catch (error40) {
|
|
301822
301898
|
debugLogger.warn(`Error getting folder structure for ${resolvedPath}:`, error40);
|
|
@@ -301842,7 +301918,7 @@ var ActivateSkillToolInvocation = class extends BaseToolInvocation {
|
|
|
301842
301918
|
}
|
|
301843
301919
|
async getOrFetchFolderStructure(skillLocation) {
|
|
301844
301920
|
if (this.cachedFolderStructure === void 0) {
|
|
301845
|
-
this.cachedFolderStructure = await getFolderStructure(
|
|
301921
|
+
this.cachedFolderStructure = await getFolderStructure(path54.dirname(skillLocation));
|
|
301846
301922
|
}
|
|
301847
301923
|
return this.cachedFolderStructure;
|
|
301848
301924
|
}
|
|
@@ -301893,7 +301969,7 @@ ${folderStructure}`,
|
|
|
301893
301969
|
};
|
|
301894
301970
|
}
|
|
301895
301971
|
skillManager.activateSkill(skillName);
|
|
301896
|
-
this.config.getWorkspaceContext().addDirectory(
|
|
301972
|
+
this.config.getWorkspaceContext().addDirectory(path54.dirname(skill.location));
|
|
301897
301973
|
const folderStructure = await this.getOrFetchFolderStructure(skill.location);
|
|
301898
301974
|
return {
|
|
301899
301975
|
llmContent: `<activated_skill name="${skillName}">
|
|
@@ -301905,7 +301981,7 @@ ${folderStructure}`,
|
|
|
301905
301981
|
${folderStructure}
|
|
301906
301982
|
</available_resources>
|
|
301907
301983
|
</activated_skill>`,
|
|
301908
|
-
returnDisplay: `Skill **${skillName}** activated. Resources loaded from \`${
|
|
301984
|
+
returnDisplay: `Skill **${skillName}** activated. Resources loaded from \`${path54.dirname(skill.location)}\`:
|
|
301909
301985
|
|
|
301910
301986
|
${folderStructure}`
|
|
301911
301987
|
};
|
|
@@ -301934,7 +302010,7 @@ var ActivateSkillTool = class _ActivateSkillTool extends BaseDeclarativeTool {
|
|
|
301934
302010
|
// packages/core/dist/src/tools/shell.js
|
|
301935
302011
|
import fsPromises10 from "node:fs/promises";
|
|
301936
302012
|
import fs43 from "node:fs";
|
|
301937
|
-
import
|
|
302013
|
+
import path57 from "node:path";
|
|
301938
302014
|
import os28 from "node:os";
|
|
301939
302015
|
import crypto15 from "node:crypto";
|
|
301940
302016
|
|
|
@@ -302011,7 +302087,7 @@ import { spawn as cpSpawn } from "node:child_process";
|
|
|
302011
302087
|
import { TextDecoder as TextDecoder2 } from "node:util";
|
|
302012
302088
|
import os26 from "node:os";
|
|
302013
302089
|
import fs41, { mkdirSync as mkdirSync3 } from "node:fs";
|
|
302014
|
-
import
|
|
302090
|
+
import path55 from "node:path";
|
|
302015
302091
|
|
|
302016
302092
|
// packages/core/dist/src/utils/systemEncoding.js
|
|
302017
302093
|
var import_chardet = __toESM(require_lib10(), 1);
|
|
@@ -303080,7 +303156,7 @@ var ShellExecutionService = class _ShellExecutionService {
|
|
|
303080
303156
|
static backgroundLogStreams = /* @__PURE__ */ new Map();
|
|
303081
303157
|
static backgroundProcessHistory = /* @__PURE__ */ new Map();
|
|
303082
303158
|
static getLogDir() {
|
|
303083
|
-
return
|
|
303159
|
+
return path55.join(Storage.getGlobalTempDir(), "background-processes");
|
|
303084
303160
|
}
|
|
303085
303161
|
static formatShellBackgroundCompletion(pid, behavior, output, error40) {
|
|
303086
303162
|
const logPath = _ShellExecutionService.getLogFilePath(pid);
|
|
@@ -303094,7 +303170,7 @@ ${truncated}`;
|
|
|
303094
303170
|
return `[Background command completed ${status2}. Output saved to ${logPath}]`;
|
|
303095
303171
|
}
|
|
303096
303172
|
static getLogFilePath(pid) {
|
|
303097
|
-
return
|
|
303173
|
+
return path55.join(this.getLogDir(), `background-${pid}.log`);
|
|
303098
303174
|
}
|
|
303099
303175
|
static syncBackgroundLog(pid, content) {
|
|
303100
303176
|
if (!this.backgroundLogPids.has(pid))
|
|
@@ -304009,7 +304085,7 @@ ${truncated}`;
|
|
|
304009
304085
|
|
|
304010
304086
|
// packages/core/dist/src/sandbox/utils/proactivePermissions.js
|
|
304011
304087
|
import os27 from "node:os";
|
|
304012
|
-
import
|
|
304088
|
+
import path56 from "node:path";
|
|
304013
304089
|
import fs42 from "node:fs";
|
|
304014
304090
|
var NETWORK_RELIANT_TOOLS = /* @__PURE__ */ new Set([
|
|
304015
304091
|
"npm",
|
|
@@ -304060,42 +304136,42 @@ async function getProactiveToolSuggestions(commandName) {
|
|
|
304060
304136
|
const primaryCachePaths = [];
|
|
304061
304137
|
const optionalCachePaths = [];
|
|
304062
304138
|
if (normalizedCommand === "npm" || normalizedCommand === "npx") {
|
|
304063
|
-
readOnlyPaths.push(
|
|
304064
|
-
primaryCachePaths.push(
|
|
304065
|
-
optionalCachePaths.push(
|
|
304066
|
-
optionalCachePaths.push(
|
|
304139
|
+
readOnlyPaths.push(path56.join(home, ".npmrc"));
|
|
304140
|
+
primaryCachePaths.push(path56.join(home, ".npm"));
|
|
304141
|
+
optionalCachePaths.push(path56.join(home, ".node-gyp"));
|
|
304142
|
+
optionalCachePaths.push(path56.join(home, ".cache"));
|
|
304067
304143
|
} else if (normalizedCommand === "yarn") {
|
|
304068
|
-
readOnlyPaths.push(
|
|
304069
|
-
readOnlyPaths.push(
|
|
304070
|
-
primaryCachePaths.push(
|
|
304071
|
-
primaryCachePaths.push(
|
|
304072
|
-
optionalCachePaths.push(
|
|
304144
|
+
readOnlyPaths.push(path56.join(home, ".yarnrc"));
|
|
304145
|
+
readOnlyPaths.push(path56.join(home, ".yarnrc.yml"));
|
|
304146
|
+
primaryCachePaths.push(path56.join(home, ".yarn"));
|
|
304147
|
+
primaryCachePaths.push(path56.join(home, ".config", "yarn"));
|
|
304148
|
+
optionalCachePaths.push(path56.join(home, ".cache"));
|
|
304073
304149
|
} else if (normalizedCommand === "pnpm") {
|
|
304074
|
-
readOnlyPaths.push(
|
|
304075
|
-
primaryCachePaths.push(
|
|
304076
|
-
primaryCachePaths.push(
|
|
304077
|
-
optionalCachePaths.push(
|
|
304150
|
+
readOnlyPaths.push(path56.join(home, ".npmrc"));
|
|
304151
|
+
primaryCachePaths.push(path56.join(home, ".pnpm-store"));
|
|
304152
|
+
primaryCachePaths.push(path56.join(home, ".config", "pnpm"));
|
|
304153
|
+
optionalCachePaths.push(path56.join(home, ".cache"));
|
|
304078
304154
|
} else if (normalizedCommand === "bun") {
|
|
304079
|
-
readOnlyPaths.push(
|
|
304080
|
-
primaryCachePaths.push(
|
|
304081
|
-
optionalCachePaths.push(
|
|
304155
|
+
readOnlyPaths.push(path56.join(home, ".bunfig.toml"));
|
|
304156
|
+
primaryCachePaths.push(path56.join(home, ".bun"));
|
|
304157
|
+
optionalCachePaths.push(path56.join(home, ".cache"));
|
|
304082
304158
|
} else if (normalizedCommand === "git") {
|
|
304083
|
-
readOnlyPaths.push(
|
|
304084
|
-
readOnlyPaths.push(
|
|
304085
|
-
optionalCachePaths.push(
|
|
304159
|
+
readOnlyPaths.push(path56.join(home, ".ssh"));
|
|
304160
|
+
readOnlyPaths.push(path56.join(home, ".gitconfig"));
|
|
304161
|
+
optionalCachePaths.push(path56.join(home, ".cache"));
|
|
304086
304162
|
} else if (normalizedCommand === "ssh" || normalizedCommand === "scp" || normalizedCommand === "sftp") {
|
|
304087
|
-
readOnlyPaths.push(
|
|
304163
|
+
readOnlyPaths.push(path56.join(home, ".ssh"));
|
|
304088
304164
|
}
|
|
304089
304165
|
if (os27.platform() === "win32") {
|
|
304090
304166
|
const appData = process.env["AppData"];
|
|
304091
304167
|
const localAppData = process.env["LocalAppData"];
|
|
304092
304168
|
if (normalizedCommand === "npm" || normalizedCommand === "npx") {
|
|
304093
304169
|
if (appData) {
|
|
304094
|
-
primaryCachePaths.push(
|
|
304095
|
-
optionalCachePaths.push(
|
|
304170
|
+
primaryCachePaths.push(path56.join(appData, "npm"));
|
|
304171
|
+
optionalCachePaths.push(path56.join(appData, "npm-cache"));
|
|
304096
304172
|
}
|
|
304097
304173
|
if (localAppData) {
|
|
304098
|
-
optionalCachePaths.push(
|
|
304174
|
+
optionalCachePaths.push(path56.join(localAppData, "npm-cache"));
|
|
304099
304175
|
}
|
|
304100
304176
|
}
|
|
304101
304177
|
}
|
|
@@ -304204,7 +304280,7 @@ ${trimmed2}
|
|
|
304204
304280
|
}
|
|
304205
304281
|
const parentCounts = /* @__PURE__ */ new Map();
|
|
304206
304282
|
for (const p of nonRedundant) {
|
|
304207
|
-
const parent =
|
|
304283
|
+
const parent = path57.dirname(p);
|
|
304208
304284
|
if (!parentCounts.has(parent)) {
|
|
304209
304285
|
parentCounts.set(parent, []);
|
|
304210
304286
|
}
|
|
@@ -304213,23 +304289,23 @@ ${trimmed2}
|
|
|
304213
304289
|
const finalPaths = /* @__PURE__ */ new Set();
|
|
304214
304290
|
const sensitiveDirs = /* @__PURE__ */ new Set([
|
|
304215
304291
|
os28.homedir(),
|
|
304216
|
-
|
|
304217
|
-
|
|
304218
|
-
|
|
304219
|
-
|
|
304220
|
-
|
|
304221
|
-
|
|
304222
|
-
|
|
304223
|
-
|
|
304224
|
-
|
|
304225
|
-
|
|
304226
|
-
|
|
304292
|
+
path57.dirname(os28.homedir()),
|
|
304293
|
+
path57.sep,
|
|
304294
|
+
path57.join(path57.sep, "etc"),
|
|
304295
|
+
path57.join(path57.sep, "usr"),
|
|
304296
|
+
path57.join(path57.sep, "var"),
|
|
304297
|
+
path57.join(path57.sep, "bin"),
|
|
304298
|
+
path57.join(path57.sep, "sbin"),
|
|
304299
|
+
path57.join(path57.sep, "lib"),
|
|
304300
|
+
path57.join(path57.sep, "root"),
|
|
304301
|
+
path57.join(path57.sep, "home"),
|
|
304302
|
+
path57.join(path57.sep, "Users")
|
|
304227
304303
|
]);
|
|
304228
304304
|
if (os28.platform() === "win32") {
|
|
304229
304305
|
const systemRoot = process.env["SystemRoot"];
|
|
304230
304306
|
if (systemRoot) {
|
|
304231
304307
|
sensitiveDirs.add(systemRoot);
|
|
304232
|
-
sensitiveDirs.add(
|
|
304308
|
+
sensitiveDirs.add(path57.join(systemRoot, "System32"));
|
|
304233
304309
|
}
|
|
304234
304310
|
const programFiles = process.env["ProgramFiles"];
|
|
304235
304311
|
if (programFiles)
|
|
@@ -304397,7 +304473,7 @@ ${trimmed2}
|
|
|
304397
304473
|
}
|
|
304398
304474
|
const isWindows2 = os28.platform() === "win32";
|
|
304399
304475
|
const tempFileName = `shell_pgrep_${crypto15.randomBytes(6).toString("hex")}.tmp`;
|
|
304400
|
-
const tempFilePath =
|
|
304476
|
+
const tempFilePath = path57.join(os28.tmpdir(), tempFileName);
|
|
304401
304477
|
const timeoutMs = this.context.config.getShellToolInactivityTimeout();
|
|
304402
304478
|
const timeoutController = new AbortController();
|
|
304403
304479
|
let timeoutTimer;
|
|
@@ -304405,7 +304481,7 @@ ${trimmed2}
|
|
|
304405
304481
|
const onAbort = () => combinedController.abort();
|
|
304406
304482
|
try {
|
|
304407
304483
|
const commandToExecute = this.wrapCommandForPgrep(strippedCommand, tempFilePath, isWindows2);
|
|
304408
|
-
const cwd = this.params.dir_path ?
|
|
304484
|
+
const cwd = this.params.dir_path ? path57.resolve(this.context.config.getTargetDir(), this.params.dir_path) : this.context.config.getTargetDir();
|
|
304409
304485
|
const validationError = this.context.config.validatePathAccess(cwd);
|
|
304410
304486
|
if (validationError) {
|
|
304411
304487
|
return {
|
|
@@ -304655,11 +304731,11 @@ ${result2.output}`;
|
|
|
304655
304731
|
try {
|
|
304656
304732
|
let currentPath = p;
|
|
304657
304733
|
if (currentPath.startsWith("~")) {
|
|
304658
|
-
currentPath =
|
|
304734
|
+
currentPath = path57.join(os28.homedir(), currentPath.slice(1));
|
|
304659
304735
|
}
|
|
304660
304736
|
try {
|
|
304661
304737
|
if (fs43.existsSync(currentPath) && fs43.statSync(currentPath).isFile()) {
|
|
304662
|
-
currentPath =
|
|
304738
|
+
currentPath = path57.dirname(currentPath);
|
|
304663
304739
|
}
|
|
304664
304740
|
} catch {
|
|
304665
304741
|
}
|
|
@@ -304674,7 +304750,7 @@ ${result2.output}`;
|
|
|
304674
304750
|
}
|
|
304675
304751
|
break;
|
|
304676
304752
|
}
|
|
304677
|
-
currentPath =
|
|
304753
|
+
currentPath = path57.dirname(currentPath);
|
|
304678
304754
|
}
|
|
304679
304755
|
} catch {
|
|
304680
304756
|
}
|
|
@@ -304773,7 +304849,7 @@ var ShellTool = class _ShellTool extends BaseDeclarativeTool {
|
|
|
304773
304849
|
return "Command cannot be empty.";
|
|
304774
304850
|
}
|
|
304775
304851
|
if (params.dir_path) {
|
|
304776
|
-
const resolvedPath =
|
|
304852
|
+
const resolvedPath = path57.resolve(this.context.config.getTargetDir(), params.dir_path);
|
|
304777
304853
|
return this.context.config.validatePathAccess(resolvedPath);
|
|
304778
304854
|
}
|
|
304779
304855
|
return null;
|
|
@@ -305502,8 +305578,8 @@ function many(p) {
|
|
|
305502
305578
|
function many1(p) {
|
|
305503
305579
|
return ab(p, many(p), (head, tail) => [head, ...tail]);
|
|
305504
305580
|
}
|
|
305505
|
-
function ab(pa, pb,
|
|
305506
|
-
return (data, i3) => mapOuter(pa(data, i3), (ma) => mapInner(pb(data, ma.position), (vb, j) =>
|
|
305581
|
+
function ab(pa, pb, join32) {
|
|
305582
|
+
return (data, i3) => mapOuter(pa(data, i3), (ma) => mapInner(pb(data, ma.position), (vb, j) => join32(ma.value, vb, data, i3, j)));
|
|
305507
305583
|
}
|
|
305508
305584
|
function left(pa, pb) {
|
|
305509
305585
|
return ab(pa, pb, (va) => va);
|
|
@@ -305511,8 +305587,8 @@ function left(pa, pb) {
|
|
|
305511
305587
|
function right(pa, pb) {
|
|
305512
305588
|
return ab(pa, pb, (va, vb) => vb);
|
|
305513
305589
|
}
|
|
305514
|
-
function abc(pa, pb, pc,
|
|
305515
|
-
return (data, i3) => mapOuter(pa(data, i3), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) =>
|
|
305590
|
+
function abc(pa, pb, pc, join32) {
|
|
305591
|
+
return (data, i3) => mapOuter(pa(data, i3), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join32(ma.value, mb.value, vc, data, i3, j))));
|
|
305516
305592
|
}
|
|
305517
305593
|
function middle(pa, pb, pc) {
|
|
305518
305594
|
return abc(pa, pb, pc, (ra, rb) => rb);
|
|
@@ -311694,7 +311770,7 @@ function tokenLimit(model) {
|
|
|
311694
311770
|
|
|
311695
311771
|
// packages/core/dist/src/prompts/promptProvider.js
|
|
311696
311772
|
import fs44 from "node:fs";
|
|
311697
|
-
import
|
|
311773
|
+
import path59 from "node:path";
|
|
311698
311774
|
import process24 from "node:process";
|
|
311699
311775
|
|
|
311700
311776
|
// packages/core/dist/src/prompts/snippets.js
|
|
@@ -313026,7 +313102,7 @@ The structure MUST be as follows:
|
|
|
313026
313102
|
}
|
|
313027
313103
|
|
|
313028
313104
|
// packages/core/dist/src/prompts/utils.js
|
|
313029
|
-
import
|
|
313105
|
+
import path58 from "node:path";
|
|
313030
313106
|
import process23 from "node:process";
|
|
313031
313107
|
function resolvePathFromEnv(envVar) {
|
|
313032
313108
|
const trimmedEnvVar = envVar?.trim();
|
|
@@ -313045,7 +313121,7 @@ function resolvePathFromEnv(envVar) {
|
|
|
313045
313121
|
if (customPath === "~") {
|
|
313046
313122
|
customPath = home;
|
|
313047
313123
|
} else {
|
|
313048
|
-
customPath =
|
|
313124
|
+
customPath = path58.join(home, customPath.slice(2));
|
|
313049
313125
|
}
|
|
313050
313126
|
} catch (error40) {
|
|
313051
313127
|
debugLogger.warn(`Could not resolve home directory for path: ${trimmedEnvVar}`, error40);
|
|
@@ -313054,7 +313130,7 @@ function resolvePathFromEnv(envVar) {
|
|
|
313054
313130
|
}
|
|
313055
313131
|
return {
|
|
313056
313132
|
isSwitch: false,
|
|
313057
|
-
value:
|
|
313133
|
+
value: path58.resolve(customPath),
|
|
313058
313134
|
isDisabled: false
|
|
313059
313135
|
};
|
|
313060
313136
|
}
|
|
@@ -313251,7 +313327,7 @@ var PromptProvider = class {
|
|
|
313251
313327
|
}
|
|
313252
313328
|
let basePrompt;
|
|
313253
313329
|
if (systemMdResolution.value && !systemMdResolution.isDisabled) {
|
|
313254
|
-
let systemMdPath =
|
|
313330
|
+
let systemMdPath = path59.resolve(path59.join(GEMINI_DIR, "system.md"));
|
|
313255
313331
|
if (!systemMdResolution.isSwitch) {
|
|
313256
313332
|
systemMdPath = systemMdResolution.value;
|
|
313257
313333
|
}
|
|
@@ -313306,8 +313382,11 @@ var PromptProvider = class {
|
|
|
313306
313382
|
planningWorkflow: this.withSection("planningWorkflow", () => ({
|
|
313307
313383
|
interactive: interactiveMode,
|
|
313308
313384
|
planModeToolsList,
|
|
313309
|
-
plansDir: context2.config.storage.getPlansDir(),
|
|
313310
|
-
approvedPlanPath:
|
|
313385
|
+
plansDir: makeRelative(context2.config.storage.getPlansDir(), context2.config.getProjectRoot()).replaceAll("\\", "/"),
|
|
313386
|
+
approvedPlanPath: (() => {
|
|
313387
|
+
const approvedPath = context2.config.getApprovedPlanPath();
|
|
313388
|
+
return approvedPath ? makeRelative(approvedPath, context2.config.getProjectRoot()).replaceAll("\\", "/") : void 0;
|
|
313389
|
+
})()
|
|
313311
313390
|
}), isPlanMode),
|
|
313312
313391
|
operationalGuidelines: this.withSection("operationalGuidelines", () => ({
|
|
313313
313392
|
interactive: interactiveMode,
|
|
@@ -313340,7 +313419,7 @@ var PromptProvider = class {
|
|
|
313340
313419
|
[Active Topic: ${sanitizedTopic}]`;
|
|
313341
313420
|
}
|
|
313342
313421
|
}
|
|
313343
|
-
this.maybeWriteSystemMd(sanitizedPrompt, systemMdResolution,
|
|
313422
|
+
this.maybeWriteSystemMd(sanitizedPrompt, systemMdResolution, path59.resolve(path59.join(GEMINI_DIR, "system.md")));
|
|
313344
313423
|
return sanitizedPrompt;
|
|
313345
313424
|
}
|
|
313346
313425
|
getCompressionPrompt(context2) {
|
|
@@ -313356,7 +313435,7 @@ var PromptProvider = class {
|
|
|
313356
313435
|
const writeSystemMdResolution = resolvePathFromEnv(process24.env["GEMINI_WRITE_SYSTEM_MD"]);
|
|
313357
313436
|
if (writeSystemMdResolution.value && !writeSystemMdResolution.isDisabled) {
|
|
313358
313437
|
const writePath = writeSystemMdResolution.isSwitch ? defaultPath : writeSystemMdResolution.value;
|
|
313359
|
-
fs44.mkdirSync(
|
|
313438
|
+
fs44.mkdirSync(path59.dirname(writePath), { recursive: true });
|
|
313360
313439
|
fs44.writeFileSync(writePath, basePrompt);
|
|
313361
313440
|
}
|
|
313362
313441
|
}
|
|
@@ -316812,12 +316891,12 @@ var safeDump = renamed("safeDump", "dump");
|
|
|
316812
316891
|
|
|
316813
316892
|
// packages/core/dist/src/agents/agentLoader.js
|
|
316814
316893
|
import * as fs46 from "node:fs/promises";
|
|
316815
|
-
import * as
|
|
316894
|
+
import * as path61 from "node:path";
|
|
316816
316895
|
import * as crypto16 from "node:crypto";
|
|
316817
316896
|
|
|
316818
316897
|
// packages/core/dist/src/skills/skillLoader.js
|
|
316819
316898
|
import * as fs45 from "node:fs/promises";
|
|
316820
|
-
import * as
|
|
316899
|
+
import * as path60 from "node:path";
|
|
316821
316900
|
var FRONTMATTER_REGEX = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n([\s\S]*))?/;
|
|
316822
316901
|
function parseFrontmatter(content) {
|
|
316823
316902
|
try {
|
|
@@ -316868,7 +316947,7 @@ function parseSimpleFrontmatter(content) {
|
|
|
316868
316947
|
async function loadSkillsFromDir(dir) {
|
|
316869
316948
|
const discoveredSkills = [];
|
|
316870
316949
|
try {
|
|
316871
|
-
const absoluteSearchPath =
|
|
316950
|
+
const absoluteSearchPath = path60.resolve(dir);
|
|
316872
316951
|
const stats = await fs45.stat(absoluteSearchPath).catch(() => null);
|
|
316873
316952
|
if (!stats || !stats.isDirectory()) {
|
|
316874
316953
|
return [];
|
|
@@ -317356,7 +317435,7 @@ async function loadAgentsFromDirectory(dir) {
|
|
|
317356
317435
|
}
|
|
317357
317436
|
const files = dirEntries.filter((entry) => entry.isFile() && !entry.name.startsWith("_") && entry.name.endsWith(".md"));
|
|
317358
317437
|
for (const entry of files) {
|
|
317359
|
-
const filePath =
|
|
317438
|
+
const filePath = path61.join(dir, entry.name);
|
|
317360
317439
|
try {
|
|
317361
317440
|
const content = await fs46.readFile(filePath, "utf-8");
|
|
317362
317441
|
const hash = crypto16.createHash("sha256").update(content).digest("hex");
|
|
@@ -317378,16 +317457,16 @@ async function loadAgentsFromDirectory(dir) {
|
|
|
317378
317457
|
|
|
317379
317458
|
// packages/core/dist/src/tools/get-internal-docs.js
|
|
317380
317459
|
import fs47 from "node:fs/promises";
|
|
317381
|
-
import
|
|
317460
|
+
import path62 from "node:path";
|
|
317382
317461
|
import { fileURLToPath as fileURLToPath14 } from "node:url";
|
|
317383
317462
|
async function getDocsRoot() {
|
|
317384
317463
|
const currentFile = fileURLToPath14(import.meta.url);
|
|
317385
|
-
let searchDir =
|
|
317464
|
+
let searchDir = path62.dirname(currentFile);
|
|
317386
317465
|
const isDocsDir = async (dir) => {
|
|
317387
317466
|
try {
|
|
317388
317467
|
const stats = await fs47.stat(dir);
|
|
317389
317468
|
if (stats.isDirectory()) {
|
|
317390
|
-
const marker =
|
|
317469
|
+
const marker = path62.join(dir, "sidebar.json");
|
|
317391
317470
|
await fs47.access(marker);
|
|
317392
317471
|
return true;
|
|
317393
317472
|
}
|
|
@@ -317396,11 +317475,11 @@ async function getDocsRoot() {
|
|
|
317396
317475
|
return false;
|
|
317397
317476
|
};
|
|
317398
317477
|
while (true) {
|
|
317399
|
-
const candidate =
|
|
317478
|
+
const candidate = path62.join(searchDir, "docs");
|
|
317400
317479
|
if (await isDocsDir(candidate)) {
|
|
317401
317480
|
return candidate;
|
|
317402
317481
|
}
|
|
317403
|
-
const parent =
|
|
317482
|
+
const parent = path62.dirname(searchDir);
|
|
317404
317483
|
if (parent === searchDir) {
|
|
317405
317484
|
break;
|
|
317406
317485
|
}
|
|
@@ -317436,7 +317515,7 @@ ${fileList}`;
|
|
|
317436
317515
|
returnDisplay: `Found ${files.length} documentation files.`
|
|
317437
317516
|
};
|
|
317438
317517
|
}
|
|
317439
|
-
const resolvedPath =
|
|
317518
|
+
const resolvedPath = path62.resolve(docsRoot, this.params.path);
|
|
317440
317519
|
if (!resolvedPath.startsWith(docsRoot)) {
|
|
317441
317520
|
throw new Error("Access denied: Requested path is outside the documentation directory.");
|
|
317442
317521
|
}
|
|
@@ -318494,7 +318573,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
|
|
|
318494
318573
|
return provider;
|
|
318495
318574
|
}
|
|
318496
318575
|
case "oauth2": {
|
|
318497
|
-
const { OAuth2AuthProvider } = await import("./oauth2-provider-
|
|
318576
|
+
const { OAuth2AuthProvider } = await import("./oauth2-provider-EA452S4C.js");
|
|
318498
318577
|
const provider = new OAuth2AuthProvider(authConfig, options.agentName ?? "unknown", agentCard, options.agentCardUrl);
|
|
318499
318578
|
await provider.initialize();
|
|
318500
318579
|
return provider;
|
|
@@ -321292,7 +321371,7 @@ ${summary}
|
|
|
321292
321371
|
};
|
|
321293
321372
|
|
|
321294
321373
|
// packages/core/dist/src/context/toolOutputMaskingService.js
|
|
321295
|
-
import
|
|
321374
|
+
import path63 from "node:path";
|
|
321296
321375
|
import * as fsPromises11 from "node:fs/promises";
|
|
321297
321376
|
var DEFAULT_TOOL_PROTECTION_THRESHOLD = 5e4;
|
|
321298
321377
|
var DEFAULT_MIN_PRUNABLE_TOKENS_THRESHOLD = 3e4;
|
|
@@ -321365,11 +321444,11 @@ var ToolOutputMaskingService = class {
|
|
|
321365
321444
|
debugLogger.debug(`[ToolOutputMasking] Triggering masking. Prunable tool tokens: ${totalPrunableTokens.toLocaleString()} (> ${maskingConfig.minPrunableThresholdTokens.toLocaleString()})`);
|
|
321366
321445
|
const newHistory = [...history];
|
|
321367
321446
|
let actualTokensSaved = 0;
|
|
321368
|
-
let toolOutputsDir =
|
|
321447
|
+
let toolOutputsDir = path63.join(config2.storage.getProjectTempDir(), TOOL_OUTPUTS_DIR3);
|
|
321369
321448
|
const sessionId = config2.getSessionId();
|
|
321370
321449
|
if (sessionId) {
|
|
321371
321450
|
const safeSessionId = sanitizeFilenamePart(sessionId);
|
|
321372
|
-
toolOutputsDir =
|
|
321451
|
+
toolOutputsDir = path63.join(toolOutputsDir, `session-${safeSessionId}`);
|
|
321373
321452
|
}
|
|
321374
321453
|
await fsPromises11.mkdir(toolOutputsDir, { recursive: true });
|
|
321375
321454
|
for (const item of prunableParts) {
|
|
@@ -321383,7 +321462,7 @@ var ToolOutputMaskingService = class {
|
|
|
321383
321462
|
const safeToolName = sanitizeFilenamePart(toolName).toLowerCase();
|
|
321384
321463
|
const safeCallId = sanitizeFilenamePart(callId).toLowerCase();
|
|
321385
321464
|
const fileName = `${safeToolName}_${safeCallId}_${Math.random().toString(36).substring(7)}.txt`;
|
|
321386
|
-
const filePath =
|
|
321465
|
+
const filePath = path63.join(toolOutputsDir, fileName);
|
|
321387
321466
|
await fsPromises11.writeFile(filePath, content, "utf-8");
|
|
321388
321467
|
const originalResponse = (
|
|
321389
321468
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
@@ -323464,11 +323543,11 @@ ${wrapInput(safeInput)}`;
|
|
|
323464
323543
|
|
|
323465
323544
|
// packages/core/dist/src/config/scoped-config.js
|
|
323466
323545
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
|
|
323467
|
-
import * as
|
|
323546
|
+
import * as path65 from "node:path";
|
|
323468
323547
|
|
|
323469
323548
|
// packages/core/dist/src/utils/workspaceContext.js
|
|
323470
323549
|
import * as fs48 from "node:fs";
|
|
323471
|
-
import * as
|
|
323550
|
+
import * as path64 from "node:path";
|
|
323472
323551
|
var WorkspaceContext = class {
|
|
323473
323552
|
targetDir;
|
|
323474
323553
|
directories = /* @__PURE__ */ new Set();
|
|
@@ -323555,14 +323634,14 @@ var WorkspaceContext = class {
|
|
|
323555
323634
|
if (!fs48.existsSync(pathToAdd)) {
|
|
323556
323635
|
return;
|
|
323557
323636
|
}
|
|
323558
|
-
const resolved = fs48.realpathSync(
|
|
323637
|
+
const resolved = fs48.realpathSync(path64.resolve(this.targetDir, pathToAdd));
|
|
323559
323638
|
this.readOnlyPaths.add(resolved);
|
|
323560
323639
|
} catch (e2) {
|
|
323561
323640
|
debugLogger.warn(`Failed to add read-only path ${pathToAdd}:`, e2);
|
|
323562
323641
|
}
|
|
323563
323642
|
}
|
|
323564
323643
|
resolveAndValidateDir(directory) {
|
|
323565
|
-
const absolutePath =
|
|
323644
|
+
const absolutePath = path64.resolve(this.targetDir, directory);
|
|
323566
323645
|
if (!fs48.existsSync(absolutePath)) {
|
|
323567
323646
|
throw new Error(`Directory does not exist: ${absolutePath}`);
|
|
323568
323647
|
}
|
|
@@ -323638,7 +323717,7 @@ var WorkspaceContext = class {
|
|
|
323638
323717
|
* if it did exist.
|
|
323639
323718
|
*/
|
|
323640
323719
|
fullyResolvedPath(pathToCheck) {
|
|
323641
|
-
return resolveToRealPath(
|
|
323720
|
+
return resolveToRealPath(path64.resolve(this.targetDir, pathToCheck));
|
|
323642
323721
|
}
|
|
323643
323722
|
/**
|
|
323644
323723
|
* Checks if a path is within a given root directory.
|
|
@@ -323647,8 +323726,8 @@ var WorkspaceContext = class {
|
|
|
323647
323726
|
* @returns True if the path is within the root directory, false otherwise
|
|
323648
323727
|
*/
|
|
323649
323728
|
isPathWithinRoot(pathToCheck, rootDirectory) {
|
|
323650
|
-
const relative8 =
|
|
323651
|
-
return !relative8.startsWith(`..${
|
|
323729
|
+
const relative8 = path64.relative(rootDirectory, pathToCheck);
|
|
323730
|
+
return !relative8.startsWith(`..${path64.sep}`) && relative8 !== ".." && !path64.isAbsolute(relative8);
|
|
323652
323731
|
}
|
|
323653
323732
|
};
|
|
323654
323733
|
|
|
@@ -323669,7 +323748,7 @@ function createScopedWorkspaceContext(parentContext, additionalDirectories) {
|
|
|
323669
323748
|
throw new Error("Cannot create scoped workspace context: parent has no directories");
|
|
323670
323749
|
}
|
|
323671
323750
|
for (const dir of additionalDirectories) {
|
|
323672
|
-
if (
|
|
323751
|
+
if (path65.resolve(dir) === path65.parse(path65.resolve(dir)).root) {
|
|
323673
323752
|
throw new Error(`Cannot add filesystem root "${dir}" as a workspace directory`);
|
|
323674
323753
|
}
|
|
323675
323754
|
}
|
|
@@ -325259,6 +325338,8 @@ var A2AResultReassembler = class {
|
|
|
325259
325338
|
pushMessage(message) {
|
|
325260
325339
|
if (!message)
|
|
325261
325340
|
return;
|
|
325341
|
+
if (message.role === "user")
|
|
325342
|
+
return;
|
|
325262
325343
|
const text = extractPartsText(message.parts, "");
|
|
325263
325344
|
if (text && this.messageLog[this.messageLog.length - 1] !== text) {
|
|
325264
325345
|
this.messageLog.push(text);
|
|
@@ -325269,19 +325350,32 @@ var A2AResultReassembler = class {
|
|
|
325269
325350
|
*/
|
|
325270
325351
|
toActivityItems() {
|
|
325271
325352
|
const isAuthRequired = this.messageLog.includes(AUTH_REQUIRED_MSG);
|
|
325272
|
-
|
|
325273
|
-
|
|
325353
|
+
const items = [];
|
|
325354
|
+
if (isAuthRequired) {
|
|
325355
|
+
items.push({
|
|
325274
325356
|
id: "auth-required",
|
|
325275
325357
|
type: "thought",
|
|
325276
325358
|
content: AUTH_REQUIRED_MSG,
|
|
325277
325359
|
status: "running"
|
|
325278
|
-
}
|
|
325360
|
+
});
|
|
325361
|
+
}
|
|
325362
|
+
this.messageLog.forEach((msg, index) => {
|
|
325363
|
+
items.push({
|
|
325364
|
+
id: `msg-${index}`,
|
|
325365
|
+
type: "thought",
|
|
325366
|
+
content: msg.trim(),
|
|
325367
|
+
status: "completed"
|
|
325368
|
+
});
|
|
325369
|
+
});
|
|
325370
|
+
if (items.length === 0 && !isAuthRequired) {
|
|
325371
|
+
items.push({
|
|
325279
325372
|
id: "pending",
|
|
325280
325373
|
type: "thought",
|
|
325281
325374
|
content: "Working...",
|
|
325282
325375
|
status: "running"
|
|
325283
|
-
}
|
|
325284
|
-
|
|
325376
|
+
});
|
|
325377
|
+
}
|
|
325378
|
+
return items;
|
|
325285
325379
|
}
|
|
325286
325380
|
/**
|
|
325287
325381
|
* Returns a human-readable string representation of the current reassembled state.
|
|
@@ -325576,11 +325670,11 @@ import { randomUUID as randomUUID6 } from "node:crypto";
|
|
|
325576
325670
|
|
|
325577
325671
|
// packages/core/dist/src/utils/browserConsent.js
|
|
325578
325672
|
import * as fs49 from "node:fs/promises";
|
|
325579
|
-
import * as
|
|
325673
|
+
import * as path66 from "node:path";
|
|
325580
325674
|
var BROWSER_CONSENT_FLAG_FILE = "browser-consent-acknowledged.txt";
|
|
325581
325675
|
var BROWSER_PROFILE_DIR = "cli-browser-profile";
|
|
325582
325676
|
async function getBrowserConsentIfNeeded() {
|
|
325583
|
-
const consentFilePath =
|
|
325677
|
+
const consentFilePath = path66.join(Storage.getGlobalGeminiDir(), BROWSER_PROFILE_DIR, BROWSER_CONSENT_FLAG_FILE);
|
|
325584
325678
|
try {
|
|
325585
325679
|
await fs49.access(consentFilePath);
|
|
325586
325680
|
return true;
|
|
@@ -325604,7 +325698,7 @@ async function getBrowserConsentIfNeeded() {
|
|
|
325604
325698
|
}
|
|
325605
325699
|
async function markConsentAsAcknowledged(consentFilePath) {
|
|
325606
325700
|
try {
|
|
325607
|
-
await fs49.mkdir(
|
|
325701
|
+
await fs49.mkdir(path66.dirname(consentFilePath), { recursive: true });
|
|
325608
325702
|
await fs49.writeFile(consentFilePath, `Browser privacy consent acknowledged at ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
325609
325703
|
`);
|
|
325610
325704
|
} catch {
|
|
@@ -325776,7 +325870,7 @@ async function resumeInputBlocker(browserManager, signal) {
|
|
|
325776
325870
|
}
|
|
325777
325871
|
|
|
325778
325872
|
// packages/core/dist/src/agents/browser/browserManager.js
|
|
325779
|
-
import * as
|
|
325873
|
+
import * as path67 from "node:path";
|
|
325780
325874
|
import * as fs50 from "node:fs";
|
|
325781
325875
|
import { fileURLToPath as fileURLToPath15 } from "node:url";
|
|
325782
325876
|
|
|
@@ -325850,7 +325944,7 @@ async function removeAutomationOverlay(browserManager, signal) {
|
|
|
325850
325944
|
|
|
325851
325945
|
// packages/core/dist/src/agents/browser/browserManager.js
|
|
325852
325946
|
var __filename5 = fileURLToPath15(import.meta.url);
|
|
325853
|
-
var __dirname8 =
|
|
325947
|
+
var __dirname8 = path67.dirname(__filename5);
|
|
325854
325948
|
var BROWSER_PROFILE_DIR2 = "cli-browser-profile";
|
|
325855
325949
|
var DomainNotAllowedError = class extends Error {
|
|
325856
325950
|
constructor(message) {
|
|
@@ -326253,7 +326347,7 @@ var BrowserManager = class _BrowserManager {
|
|
|
326253
326347
|
if (browserConfig.customConfig.profilePath) {
|
|
326254
326348
|
mcpArgs.push("--userDataDir", browserConfig.customConfig.profilePath);
|
|
326255
326349
|
} else if (sessionMode === "persistent") {
|
|
326256
|
-
const defaultProfilePath =
|
|
326350
|
+
const defaultProfilePath = path67.join(Storage.getGlobalGeminiDir(), BROWSER_PROFILE_DIR2);
|
|
326257
326351
|
mcpArgs.push("--userDataDir", defaultProfilePath);
|
|
326258
326352
|
}
|
|
326259
326353
|
if (!this.config.getUsageStatisticsEnabled()) {
|
|
@@ -326269,9 +326363,9 @@ var BrowserManager = class _BrowserManager {
|
|
|
326269
326363
|
mcpArgs.push(`--chromeArg="--host-rules=MAP * ~NOTFOUND, ${exclusionRules}"`);
|
|
326270
326364
|
}
|
|
326271
326365
|
debugLogger.log(`Launching bundled chrome-devtools-mcp (${sessionMode} mode) with args: ${mcpArgs.join(" ")}`);
|
|
326272
|
-
let bundleMcpPath =
|
|
326366
|
+
let bundleMcpPath = path67.resolve(__dirname8, "bundled/chrome-devtools-mcp.mjs");
|
|
326273
326367
|
if (!fs50.existsSync(bundleMcpPath)) {
|
|
326274
|
-
bundleMcpPath =
|
|
326368
|
+
bundleMcpPath = path67.resolve(__dirname8, __dirname8.includes(`${path67.sep}dist${path67.sep}`) ? "../../../bundled/chrome-devtools-mcp.mjs" : "../../../dist/bundled/chrome-devtools-mcp.mjs");
|
|
326275
326369
|
}
|
|
326276
326370
|
this.mcpTransport = new StdioClientTransport({
|
|
326277
326371
|
command: "node",
|
|
@@ -327416,39 +327510,6 @@ ${value}`
|
|
|
327416
327510
|
// packages/core/dist/src/tools/exit-plan-mode.js
|
|
327417
327511
|
import path68 from "node:path";
|
|
327418
327512
|
|
|
327419
|
-
// packages/core/dist/src/utils/planUtils.js
|
|
327420
|
-
import path67 from "node:path";
|
|
327421
|
-
var PlanErrorMessages = {
|
|
327422
|
-
PATH_ACCESS_DENIED: (planPath, plansDir) => `Access denied: plan path (${planPath}) must be within the designated plans directory (${plansDir}).`,
|
|
327423
|
-
FILE_NOT_FOUND: (path95) => `Plan file does not exist: ${path95}. You must create the plan file before requesting approval.`,
|
|
327424
|
-
FILE_EMPTY: "Plan file is empty. You must write content to the plan file before requesting approval.",
|
|
327425
|
-
READ_FAILURE: (detail) => `Failed to read plan file: ${detail}`
|
|
327426
|
-
};
|
|
327427
|
-
async function validatePlanPath(planPath, plansDir) {
|
|
327428
|
-
const safeFilename = path67.basename(planPath);
|
|
327429
|
-
const resolvedPath = path67.join(plansDir, safeFilename);
|
|
327430
|
-
const realPath = resolveToRealPath(resolvedPath);
|
|
327431
|
-
const realPlansDir = resolveToRealPath(plansDir);
|
|
327432
|
-
if (!isSubpath(realPlansDir, realPath)) {
|
|
327433
|
-
return PlanErrorMessages.PATH_ACCESS_DENIED(planPath, realPlansDir);
|
|
327434
|
-
}
|
|
327435
|
-
if (!await fileExists(resolvedPath)) {
|
|
327436
|
-
return PlanErrorMessages.FILE_NOT_FOUND(planPath);
|
|
327437
|
-
}
|
|
327438
|
-
return null;
|
|
327439
|
-
}
|
|
327440
|
-
async function validatePlanContent(planPath) {
|
|
327441
|
-
try {
|
|
327442
|
-
if (await isEmpty(planPath)) {
|
|
327443
|
-
return PlanErrorMessages.FILE_EMPTY;
|
|
327444
|
-
}
|
|
327445
|
-
return null;
|
|
327446
|
-
} catch (err2) {
|
|
327447
|
-
const message = err2 instanceof Error ? err2.message : String(err2);
|
|
327448
|
-
return PlanErrorMessages.READ_FAILURE(message);
|
|
327449
|
-
}
|
|
327450
|
-
}
|
|
327451
|
-
|
|
327452
327513
|
// packages/core/dist/src/utils/checks.js
|
|
327453
327514
|
function assumeExhaustive(_value) {
|
|
327454
327515
|
}
|
|
@@ -327491,12 +327552,10 @@ var ExitPlanModeTool = class _ExitPlanModeTool extends BaseDeclarativeTool {
|
|
|
327491
327552
|
if (!params.plan_filename || params.plan_filename.trim() === "") {
|
|
327492
327553
|
return "plan_filename is required.";
|
|
327493
327554
|
}
|
|
327494
|
-
|
|
327495
|
-
|
|
327496
|
-
|
|
327497
|
-
|
|
327498
|
-
if (!isSubpath(plansDir, realPath)) {
|
|
327499
|
-
return `Access denied: plan path (${resolvedPath}) must be within the designated plans directory (${plansDir}).`;
|
|
327555
|
+
try {
|
|
327556
|
+
resolveAndValidatePlanPath(params.plan_filename, this.config.storage.getPlansDir(), this.config.getProjectRoot());
|
|
327557
|
+
} catch (e2) {
|
|
327558
|
+
return e2 instanceof Error ? e2.message : String(e2);
|
|
327500
327559
|
}
|
|
327501
327560
|
return null;
|
|
327502
327561
|
}
|
|
@@ -327518,7 +327577,7 @@ var ExitPlanModeInvocation = class extends BaseToolInvocation {
|
|
|
327518
327577
|
}
|
|
327519
327578
|
async shouldConfirmExecute(abortSignal) {
|
|
327520
327579
|
const resolvedPlanPath = this.getResolvedPlanPath();
|
|
327521
|
-
const pathError = await validatePlanPath(this.params.plan_filename, this.config.storage.getPlansDir());
|
|
327580
|
+
const pathError = await validatePlanPath(this.params.plan_filename, this.config.storage.getPlansDir(), this.config.getProjectRoot());
|
|
327522
327581
|
if (pathError) {
|
|
327523
327582
|
this.planValidationError = pathError;
|
|
327524
327583
|
return false;
|
|
@@ -327560,8 +327619,7 @@ var ExitPlanModeInvocation = class extends BaseToolInvocation {
|
|
|
327560
327619
|
* Note: Validation is done in validateToolParamValues, so this assumes the path is valid.
|
|
327561
327620
|
*/
|
|
327562
327621
|
getResolvedPlanPath() {
|
|
327563
|
-
|
|
327564
|
-
return path68.join(this.config.storage.getPlansDir(), safeFilename);
|
|
327622
|
+
return resolveAndValidatePlanPath(this.params.plan_filename, this.config.storage.getPlansDir(), this.config.getProjectRoot());
|
|
327565
327623
|
}
|
|
327566
327624
|
async execute({ abortSignal: _signal }) {
|
|
327567
327625
|
const resolvedPlanPath = this.getResolvedPlanPath();
|
|
@@ -352724,7 +352782,6 @@ ${sections.join("\n")}
|
|
|
352724
352782
|
debugLogger.debug("Experiments loaded", summaryString);
|
|
352725
352783
|
}
|
|
352726
352784
|
onAgentsRefreshed = async () => {
|
|
352727
|
-
await this.agentRegistry.initialize();
|
|
352728
352785
|
const client = this.geminiClient;
|
|
352729
352786
|
if (client?.isInitialized()) {
|
|
352730
352787
|
await client.setTools();
|
|
@@ -359421,6 +359478,10 @@ export {
|
|
|
359421
359478
|
BaseLlmClient,
|
|
359422
359479
|
promptIdContext,
|
|
359423
359480
|
getPromptIdWithFallback,
|
|
359481
|
+
PlanErrorMessages,
|
|
359482
|
+
resolveAndValidatePlanPath,
|
|
359483
|
+
validatePlanPath,
|
|
359484
|
+
validatePlanContent,
|
|
359424
359485
|
applyReplacement,
|
|
359425
359486
|
calculateReplacement,
|
|
359426
359487
|
getErrorReplaceResult,
|
|
@@ -359645,9 +359706,6 @@ export {
|
|
|
359645
359706
|
createUnauthorizedToolError,
|
|
359646
359707
|
LocalAgentExecutor,
|
|
359647
359708
|
resetBrowserSession,
|
|
359648
|
-
PlanErrorMessages,
|
|
359649
|
-
validatePlanPath,
|
|
359650
|
-
validatePlanContent,
|
|
359651
359709
|
assumeExhaustive,
|
|
359652
359710
|
checkExhaustive,
|
|
359653
359711
|
getApprovalModeDescription,
|