@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
|
@@ -74756,7 +74756,7 @@ var require_util7 = __commonJS({
|
|
|
74756
74756
|
function getFilesInPath(source) {
|
|
74757
74757
|
const lstatSync2 = fs78.lstatSync;
|
|
74758
74758
|
const readdirSync2 = fs78.readdirSync;
|
|
74759
|
-
const
|
|
74759
|
+
const join32 = path95.join;
|
|
74760
74760
|
function isDirectory(source2) {
|
|
74761
74761
|
return lstatSync2(source2).isDirectory();
|
|
74762
74762
|
}
|
|
@@ -74765,12 +74765,12 @@ var require_util7 = __commonJS({
|
|
|
74765
74765
|
}
|
|
74766
74766
|
function getDirectories(source2) {
|
|
74767
74767
|
return readdirSync2(source2).map((name3) => {
|
|
74768
|
-
return
|
|
74768
|
+
return join32(source2, name3);
|
|
74769
74769
|
}).filter(isDirectory);
|
|
74770
74770
|
}
|
|
74771
74771
|
function getFiles(source2) {
|
|
74772
74772
|
return readdirSync2(source2).map((name3) => {
|
|
74773
|
-
return
|
|
74773
|
+
return join32(source2, name3);
|
|
74774
74774
|
}).filter(isFile2);
|
|
74775
74775
|
}
|
|
74776
74776
|
function getFilesRecursively(source2) {
|
|
@@ -104881,7 +104881,7 @@ var require_buffer_list = __commonJS({
|
|
|
104881
104881
|
}
|
|
104882
104882
|
}, {
|
|
104883
104883
|
key: "join",
|
|
104884
|
-
value: function
|
|
104884
|
+
value: function join32(s2) {
|
|
104885
104885
|
if (this.length === 0) return "";
|
|
104886
104886
|
var p = this.head;
|
|
104887
104887
|
var ret = "" + p.data;
|
|
@@ -251823,8 +251823,8 @@ import { createHash } from "node:crypto";
|
|
|
251823
251823
|
import * as os12 from "node:os";
|
|
251824
251824
|
|
|
251825
251825
|
// packages/core/src/generated/git-commit.ts
|
|
251826
|
-
var GIT_COMMIT_INFO = "
|
|
251827
|
-
var CLI_VERSION = "0.39.0-
|
|
251826
|
+
var GIT_COMMIT_INFO = "23f55e0d1";
|
|
251827
|
+
var CLI_VERSION = "0.39.0-preview.1";
|
|
251828
251828
|
|
|
251829
251829
|
// packages/core/src/ide/detect-ide.ts
|
|
251830
251830
|
var IDE_DEFINITIONS = {
|
|
@@ -257664,7 +257664,7 @@ function getLanguageFromFilePath(filePath) {
|
|
|
257664
257664
|
|
|
257665
257665
|
// packages/core/src/tools/edit.ts
|
|
257666
257666
|
import * as fsPromises2 from "node:fs/promises";
|
|
257667
|
-
import * as
|
|
257667
|
+
import * as path28 from "node:path";
|
|
257668
257668
|
import * as os18 from "node:os";
|
|
257669
257669
|
import * as crypto13 from "node:crypto";
|
|
257670
257670
|
|
|
@@ -276878,6 +276878,71 @@ function appendJitContextToParts(llmContent, jitContext) {
|
|
|
276878
276878
|
return [...existingParts, jitPart];
|
|
276879
276879
|
}
|
|
276880
276880
|
|
|
276881
|
+
// packages/core/src/utils/planUtils.ts
|
|
276882
|
+
import path27 from "node:path";
|
|
276883
|
+
var PlanErrorMessages = {
|
|
276884
|
+
PATH_ACCESS_DENIED: (planPath, plansDir) => `Access denied: plan path (${planPath}) must be within the designated plans directory (${plansDir}).`,
|
|
276885
|
+
FILE_NOT_FOUND: (path95) => `Plan file does not exist: ${path95}. You must create the plan file before requesting approval.`,
|
|
276886
|
+
FILE_EMPTY: "Plan file is empty. You must write content to the plan file before requesting approval.",
|
|
276887
|
+
READ_FAILURE: (detail) => `Failed to read plan file: ${detail}`
|
|
276888
|
+
};
|
|
276889
|
+
function resolveAndValidatePlanPath(planPath, plansDir, projectRoot) {
|
|
276890
|
+
const trimmedPath = planPath.trim();
|
|
276891
|
+
if (!trimmedPath) {
|
|
276892
|
+
throw new Error("Plan file path must be non-empty.");
|
|
276893
|
+
}
|
|
276894
|
+
if (path27.isAbsolute(trimmedPath)) {
|
|
276895
|
+
if (isSubpath(resolveToRealPath(plansDir), resolveToRealPath(trimmedPath))) {
|
|
276896
|
+
return trimmedPath;
|
|
276897
|
+
}
|
|
276898
|
+
}
|
|
276899
|
+
const resolvedFromProjectRoot = path27.resolve(projectRoot, trimmedPath);
|
|
276900
|
+
if (isSubpath(
|
|
276901
|
+
resolveToRealPath(plansDir),
|
|
276902
|
+
resolveToRealPath(resolvedFromProjectRoot)
|
|
276903
|
+
)) {
|
|
276904
|
+
return resolvedFromProjectRoot;
|
|
276905
|
+
}
|
|
276906
|
+
const resolvedPath = path27.resolve(plansDir, trimmedPath);
|
|
276907
|
+
const realPath = resolveToRealPath(resolvedPath);
|
|
276908
|
+
const realPlansDir = resolveToRealPath(plansDir);
|
|
276909
|
+
if (!isSubpath(realPlansDir, realPath)) {
|
|
276910
|
+
throw new Error(
|
|
276911
|
+
PlanErrorMessages.PATH_ACCESS_DENIED(trimmedPath, plansDir)
|
|
276912
|
+
);
|
|
276913
|
+
}
|
|
276914
|
+
return resolvedPath;
|
|
276915
|
+
}
|
|
276916
|
+
async function validatePlanPath(planPath, plansDir, projectRoot) {
|
|
276917
|
+
try {
|
|
276918
|
+
const resolvedPath = resolveAndValidatePlanPath(
|
|
276919
|
+
planPath,
|
|
276920
|
+
plansDir,
|
|
276921
|
+
projectRoot
|
|
276922
|
+
);
|
|
276923
|
+
if (!await fileExists(resolvedPath)) {
|
|
276924
|
+
return PlanErrorMessages.FILE_NOT_FOUND(planPath);
|
|
276925
|
+
}
|
|
276926
|
+
return null;
|
|
276927
|
+
} catch {
|
|
276928
|
+
return PlanErrorMessages.PATH_ACCESS_DENIED(
|
|
276929
|
+
planPath,
|
|
276930
|
+
resolveToRealPath(plansDir)
|
|
276931
|
+
);
|
|
276932
|
+
}
|
|
276933
|
+
}
|
|
276934
|
+
async function validatePlanContent(planPath) {
|
|
276935
|
+
try {
|
|
276936
|
+
if (await isEmpty(planPath)) {
|
|
276937
|
+
return PlanErrorMessages.FILE_EMPTY;
|
|
276938
|
+
}
|
|
276939
|
+
return null;
|
|
276940
|
+
} catch (err2) {
|
|
276941
|
+
const message = err2 instanceof Error ? err2.message : String(err2);
|
|
276942
|
+
return PlanErrorMessages.READ_FAILURE(message);
|
|
276943
|
+
}
|
|
276944
|
+
}
|
|
276945
|
+
|
|
276881
276946
|
// packages/core/src/tools/edit.ts
|
|
276882
276947
|
var ENABLE_FUZZY_MATCH_RECOVERY = true;
|
|
276883
276948
|
var FUZZY_MATCH_THRESHOLD = 0.1;
|
|
@@ -277109,17 +277174,25 @@ var EditToolInvocation = class extends BaseToolInvocation {
|
|
|
277109
277174
|
);
|
|
277110
277175
|
this.config = config2;
|
|
277111
277176
|
if (this.config.isPlanMode()) {
|
|
277112
|
-
|
|
277113
|
-
|
|
277114
|
-
|
|
277115
|
-
|
|
277116
|
-
|
|
277117
|
-
|
|
277177
|
+
try {
|
|
277178
|
+
this.resolvedPath = resolveAndValidatePlanPath(
|
|
277179
|
+
this.params.file_path,
|
|
277180
|
+
this.config.storage.getPlansDir(),
|
|
277181
|
+
this.config.getProjectRoot()
|
|
277182
|
+
);
|
|
277183
|
+
} catch (e2) {
|
|
277184
|
+
debugLogger.error(
|
|
277185
|
+
"Failed to resolve plan path during EditTool invocation setup",
|
|
277186
|
+
e2
|
|
277187
|
+
);
|
|
277188
|
+
this.resolvedPath = this.params.file_path;
|
|
277189
|
+
}
|
|
277190
|
+
} else if (!path28.isAbsolute(this.params.file_path)) {
|
|
277118
277191
|
const result2 = correctPath(this.params.file_path, this.config);
|
|
277119
277192
|
if (result2.success) {
|
|
277120
277193
|
this.resolvedPath = result2.correctedPath;
|
|
277121
277194
|
} else {
|
|
277122
|
-
this.resolvedPath =
|
|
277195
|
+
this.resolvedPath = path28.resolve(
|
|
277123
277196
|
this.config.getTargetDir(),
|
|
277124
277197
|
this.params.file_path
|
|
277125
277198
|
);
|
|
@@ -277355,7 +277428,7 @@ var EditToolInvocation = class extends BaseToolInvocation {
|
|
|
277355
277428
|
debugLogger.log(`Error: ${editData.error.display}`);
|
|
277356
277429
|
return false;
|
|
277357
277430
|
}
|
|
277358
|
-
const fileName =
|
|
277431
|
+
const fileName = path28.basename(this.resolvedPath);
|
|
277359
277432
|
const fileDiff = createPatch(
|
|
277360
277433
|
fileName,
|
|
277361
277434
|
editData.currentContent ?? "",
|
|
@@ -277458,7 +277531,7 @@ var EditToolInvocation = class extends BaseToolInvocation {
|
|
|
277458
277531
|
if (editData.isNewFile) {
|
|
277459
277532
|
displayResult = `Created ${shortenPath(makeRelative(this.resolvedPath, this.config.getTargetDir()))}`;
|
|
277460
277533
|
} else {
|
|
277461
|
-
const fileName =
|
|
277534
|
+
const fileName = path28.basename(this.resolvedPath);
|
|
277462
277535
|
const fileDiff = createPatch(
|
|
277463
277536
|
fileName,
|
|
277464
277537
|
editData.currentContent ?? "",
|
|
@@ -277549,7 +277622,7 @@ ${snippet2}`);
|
|
|
277549
277622
|
* Creates parent directories if they don't exist
|
|
277550
277623
|
*/
|
|
277551
277624
|
async ensureParentDirectoriesExistAsync(filePath) {
|
|
277552
|
-
const dirName =
|
|
277625
|
+
const dirName = path28.dirname(filePath);
|
|
277553
277626
|
try {
|
|
277554
277627
|
await fsPromises2.access(dirName);
|
|
277555
277628
|
} catch {
|
|
@@ -277584,12 +277657,22 @@ var EditTool = class _EditTool extends BaseDeclarativeTool {
|
|
|
277584
277657
|
return "The 'file_path' parameter must be non-empty.";
|
|
277585
277658
|
}
|
|
277586
277659
|
let resolvedPath;
|
|
277587
|
-
if (
|
|
277660
|
+
if (this.config.isPlanMode()) {
|
|
277661
|
+
try {
|
|
277662
|
+
resolvedPath = resolveAndValidatePlanPath(
|
|
277663
|
+
params.file_path,
|
|
277664
|
+
this.config.storage.getPlansDir(),
|
|
277665
|
+
this.config.getProjectRoot()
|
|
277666
|
+
);
|
|
277667
|
+
} catch (err2) {
|
|
277668
|
+
return err2 instanceof Error ? err2.message : String(err2);
|
|
277669
|
+
}
|
|
277670
|
+
} else if (!path28.isAbsolute(params.file_path)) {
|
|
277588
277671
|
const result2 = correctPath(params.file_path, this.config);
|
|
277589
277672
|
if (result2.success) {
|
|
277590
277673
|
resolvedPath = result2.correctedPath;
|
|
277591
277674
|
} else {
|
|
277592
|
-
resolvedPath =
|
|
277675
|
+
resolvedPath = path28.resolve(
|
|
277593
277676
|
this.config.getTargetDir(),
|
|
277594
277677
|
params.file_path
|
|
277595
277678
|
);
|
|
@@ -277770,7 +277853,7 @@ async function calculateFuzzyReplacement(config2, context2) {
|
|
|
277770
277853
|
// packages/core/src/tools/write-file.ts
|
|
277771
277854
|
import fs30 from "node:fs";
|
|
277772
277855
|
import fsPromises3 from "node:fs/promises";
|
|
277773
|
-
import
|
|
277856
|
+
import path29 from "node:path";
|
|
277774
277857
|
import os19 from "node:os";
|
|
277775
277858
|
|
|
277776
277859
|
// packages/core/src/utils/editCorrector.ts
|
|
@@ -277957,13 +278040,21 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
277957
278040
|
);
|
|
277958
278041
|
this.config = config2;
|
|
277959
278042
|
if (this.config.isPlanMode()) {
|
|
277960
|
-
|
|
277961
|
-
|
|
277962
|
-
|
|
277963
|
-
|
|
277964
|
-
|
|
278043
|
+
try {
|
|
278044
|
+
this.resolvedPath = resolveAndValidatePlanPath(
|
|
278045
|
+
this.params.file_path,
|
|
278046
|
+
this.config.storage.getPlansDir(),
|
|
278047
|
+
this.config.getProjectRoot()
|
|
278048
|
+
);
|
|
278049
|
+
} catch (e2) {
|
|
278050
|
+
debugLogger.error(
|
|
278051
|
+
"Failed to resolve plan path during WriteFileTool invocation setup",
|
|
278052
|
+
e2
|
|
278053
|
+
);
|
|
278054
|
+
this.resolvedPath = this.params.file_path;
|
|
278055
|
+
}
|
|
277965
278056
|
} else {
|
|
277966
|
-
this.resolvedPath =
|
|
278057
|
+
this.resolvedPath = path29.resolve(
|
|
277967
278058
|
this.config.getTargetDir(),
|
|
277968
278059
|
this.params.file_path
|
|
277969
278060
|
);
|
|
@@ -278000,7 +278091,7 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
278000
278091
|
this.resolvedPath,
|
|
278001
278092
|
this.config.getTargetDir()
|
|
278002
278093
|
);
|
|
278003
|
-
const fileName =
|
|
278094
|
+
const fileName = path29.basename(this.resolvedPath);
|
|
278004
278095
|
const fileDiff = createPatch(
|
|
278005
278096
|
fileName,
|
|
278006
278097
|
originalContent,
|
|
@@ -278073,7 +278164,7 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
278073
278164
|
} = correctedContentResult;
|
|
278074
278165
|
const isNewFile = !fileExists2 || correctedContentResult.error !== void 0 && !correctedContentResult.fileExists;
|
|
278075
278166
|
try {
|
|
278076
|
-
const dirName =
|
|
278167
|
+
const dirName = path29.dirname(this.resolvedPath);
|
|
278077
278168
|
try {
|
|
278078
278169
|
await fsPromises3.access(dirName);
|
|
278079
278170
|
} catch {
|
|
@@ -278085,7 +278176,7 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
278085
278176
|
finalContent = finalContent.replace(/\r?\n/g, "\r\n");
|
|
278086
278177
|
}
|
|
278087
278178
|
await this.config.getFileSystemService().writeTextFile(this.resolvedPath, finalContent);
|
|
278088
|
-
const fileName =
|
|
278179
|
+
const fileName = path29.basename(this.resolvedPath);
|
|
278089
278180
|
const currentContentForDiff = correctedContentResult.error ? "" : originalContent;
|
|
278090
278181
|
const fileDiff = createPatch(
|
|
278091
278182
|
fileName,
|
|
@@ -278119,7 +278210,7 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
278119
278210
|
${snippet2}`);
|
|
278120
278211
|
const mimetype = getSpecificMimeType(this.resolvedPath);
|
|
278121
278212
|
const programmingLanguage = getLanguageFromFilePath(this.resolvedPath);
|
|
278122
|
-
const extension =
|
|
278213
|
+
const extension = path29.extname(this.resolvedPath);
|
|
278123
278214
|
const operation = isNewFile ? "create" /* CREATE */ : "update" /* UPDATE */;
|
|
278124
278215
|
logFileOperation(
|
|
278125
278216
|
this.config,
|
|
@@ -278207,7 +278298,20 @@ var WriteFileTool = class _WriteFileTool extends BaseDeclarativeTool {
|
|
|
278207
278298
|
if (!filePath) {
|
|
278208
278299
|
return `Missing or empty "file_path"`;
|
|
278209
278300
|
}
|
|
278210
|
-
|
|
278301
|
+
let resolvedPath;
|
|
278302
|
+
if (this.config.isPlanMode()) {
|
|
278303
|
+
try {
|
|
278304
|
+
resolvedPath = resolveAndValidatePlanPath(
|
|
278305
|
+
filePath,
|
|
278306
|
+
this.config.storage.getPlansDir(),
|
|
278307
|
+
this.config.getProjectRoot()
|
|
278308
|
+
);
|
|
278309
|
+
} catch (err2) {
|
|
278310
|
+
return err2 instanceof Error ? err2.message : String(err2);
|
|
278311
|
+
}
|
|
278312
|
+
} else {
|
|
278313
|
+
resolvedPath = path29.resolve(this.config.getTargetDir(), filePath);
|
|
278314
|
+
}
|
|
278211
278315
|
const validationError = this.config.validatePathAccess(resolvedPath);
|
|
278212
278316
|
if (validationError) {
|
|
278213
278317
|
return validationError;
|
|
@@ -278433,25 +278537,25 @@ function hasError(response) {
|
|
|
278433
278537
|
}
|
|
278434
278538
|
|
|
278435
278539
|
// node_modules/read-package-up/index.js
|
|
278436
|
-
import
|
|
278540
|
+
import path32 from "node:path";
|
|
278437
278541
|
|
|
278438
278542
|
// node_modules/find-up-simple/index.js
|
|
278439
278543
|
import process11 from "node:process";
|
|
278440
278544
|
import fsPromises4 from "node:fs/promises";
|
|
278441
278545
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
278442
|
-
import
|
|
278546
|
+
import path30 from "node:path";
|
|
278443
278547
|
var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath4(urlOrPath) : urlOrPath;
|
|
278444
278548
|
async function findUp(name3, {
|
|
278445
278549
|
cwd = process11.cwd(),
|
|
278446
278550
|
type: type2 = "file",
|
|
278447
278551
|
stopAt
|
|
278448
278552
|
} = {}) {
|
|
278449
|
-
let directory =
|
|
278450
|
-
const { root } =
|
|
278451
|
-
stopAt =
|
|
278452
|
-
const isAbsoluteName =
|
|
278553
|
+
let directory = path30.resolve(toPath(cwd) ?? "");
|
|
278554
|
+
const { root } = path30.parse(directory);
|
|
278555
|
+
stopAt = path30.resolve(directory, toPath(stopAt ?? root));
|
|
278556
|
+
const isAbsoluteName = path30.isAbsolute(name3);
|
|
278453
278557
|
while (directory) {
|
|
278454
|
-
const filePath = isAbsoluteName ? name3 :
|
|
278558
|
+
const filePath = isAbsoluteName ? name3 : path30.join(directory, name3);
|
|
278455
278559
|
try {
|
|
278456
278560
|
const stats = await fsPromises4.stat(filePath);
|
|
278457
278561
|
if (type2 === "file" && stats.isFile() || type2 === "directory" && stats.isDirectory()) {
|
|
@@ -278462,13 +278566,13 @@ async function findUp(name3, {
|
|
|
278462
278566
|
if (directory === stopAt || directory === root) {
|
|
278463
278567
|
break;
|
|
278464
278568
|
}
|
|
278465
|
-
directory =
|
|
278569
|
+
directory = path30.dirname(directory);
|
|
278466
278570
|
}
|
|
278467
278571
|
}
|
|
278468
278572
|
|
|
278469
278573
|
// node_modules/read-pkg/index.js
|
|
278470
278574
|
import fsPromises5 from "node:fs/promises";
|
|
278471
|
-
import
|
|
278575
|
+
import path31 from "node:path";
|
|
278472
278576
|
|
|
278473
278577
|
// node_modules/parse-json/index.js
|
|
278474
278578
|
var import_code_frame = __toESM(require_lib7(), 1);
|
|
@@ -278597,7 +278701,7 @@ function toPath2(urlOrPath) {
|
|
|
278597
278701
|
}
|
|
278598
278702
|
|
|
278599
278703
|
// node_modules/read-pkg/index.js
|
|
278600
|
-
var getPackagePath = (cwd) =>
|
|
278704
|
+
var getPackagePath = (cwd) => path31.resolve(toPath2(cwd) ?? ".", "package.json");
|
|
278601
278705
|
var _readPackage = (file2, normalize4) => {
|
|
278602
278706
|
const json3 = typeof file2 === "string" ? parseJson(file2) : file2;
|
|
278603
278707
|
if (normalize4) {
|
|
@@ -278617,7 +278721,7 @@ async function readPackageUp(options) {
|
|
|
278617
278721
|
return;
|
|
278618
278722
|
}
|
|
278619
278723
|
return {
|
|
278620
|
-
packageJson: await readPackage({ ...options, cwd:
|
|
278724
|
+
packageJson: await readPackage({ ...options, cwd: path32.dirname(filePath) }),
|
|
278621
278725
|
path: filePath
|
|
278622
278726
|
};
|
|
278623
278727
|
}
|
|
@@ -278676,13 +278780,13 @@ async function isStable(cwd) {
|
|
|
278676
278780
|
|
|
278677
278781
|
// packages/core/src/code_assist/experiments/client_metadata.ts
|
|
278678
278782
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
278679
|
-
import
|
|
278783
|
+
import path34 from "node:path";
|
|
278680
278784
|
|
|
278681
278785
|
// packages/core/src/utils/version.ts
|
|
278682
278786
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
278683
|
-
import
|
|
278787
|
+
import path33 from "node:path";
|
|
278684
278788
|
var __filename3 = fileURLToPath6(import.meta.url);
|
|
278685
|
-
var __dirname4 =
|
|
278789
|
+
var __dirname4 = path33.dirname(__filename3);
|
|
278686
278790
|
var versionPromise;
|
|
278687
278791
|
function getVersion() {
|
|
278688
278792
|
if (versionPromise) {
|
|
@@ -278690,7 +278794,7 @@ function getVersion() {
|
|
|
278690
278794
|
}
|
|
278691
278795
|
versionPromise = (async () => {
|
|
278692
278796
|
const pkgJson = await getPackageJson(__dirname4);
|
|
278693
|
-
return "0.39.0-
|
|
278797
|
+
return "0.39.0-preview.1";
|
|
278694
278798
|
})();
|
|
278695
278799
|
return versionPromise;
|
|
278696
278800
|
}
|
|
@@ -278700,7 +278804,7 @@ function resetVersionCache() {
|
|
|
278700
278804
|
|
|
278701
278805
|
// packages/core/src/code_assist/experiments/client_metadata.ts
|
|
278702
278806
|
var __filename4 = fileURLToPath7(import.meta.url);
|
|
278703
|
-
var __dirname5 =
|
|
278807
|
+
var __dirname5 = path34.dirname(__filename4);
|
|
278704
278808
|
var clientMetadataPromise;
|
|
278705
278809
|
function getPlatform() {
|
|
278706
278810
|
const platform10 = process.platform;
|
|
@@ -281063,7 +281167,7 @@ var ToolRegistry = class _ToolRegistry {
|
|
|
281063
281167
|
|
|
281064
281168
|
// packages/core/src/tools/ls.ts
|
|
281065
281169
|
import fs31 from "node:fs/promises";
|
|
281066
|
-
import
|
|
281170
|
+
import path35 from "node:path";
|
|
281067
281171
|
var LSToolInvocation = class extends BaseToolInvocation {
|
|
281068
281172
|
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
281069
281173
|
super(params, messageBus, _toolName, _toolDisplayName);
|
|
@@ -281120,7 +281224,7 @@ var LSToolInvocation = class extends BaseToolInvocation {
|
|
|
281120
281224
|
* @returns Result of the LS operation
|
|
281121
281225
|
*/
|
|
281122
281226
|
async execute({ abortSignal: _signal }) {
|
|
281123
|
-
const resolvedDirPath =
|
|
281227
|
+
const resolvedDirPath = path35.resolve(
|
|
281124
281228
|
this.config.getTargetDir(),
|
|
281125
281229
|
this.params.dir_path
|
|
281126
281230
|
);
|
|
@@ -281162,9 +281266,9 @@ var LSToolInvocation = class extends BaseToolInvocation {
|
|
|
281162
281266
|
};
|
|
281163
281267
|
}
|
|
281164
281268
|
const relativePaths = files.map(
|
|
281165
|
-
(file2) =>
|
|
281269
|
+
(file2) => path35.relative(
|
|
281166
281270
|
this.config.getTargetDir(),
|
|
281167
|
-
|
|
281271
|
+
path35.join(resolvedDirPath, file2)
|
|
281168
281272
|
)
|
|
281169
281273
|
);
|
|
281170
281274
|
const fileDiscovery = this.config.getFileService();
|
|
@@ -281174,15 +281278,15 @@ var LSToolInvocation = class extends BaseToolInvocation {
|
|
|
281174
281278
|
});
|
|
281175
281279
|
const entries2 = [];
|
|
281176
281280
|
for (const relativePath of filteredPaths) {
|
|
281177
|
-
const fullPath =
|
|
281178
|
-
if (this.shouldIgnore(
|
|
281281
|
+
const fullPath = path35.resolve(this.config.getTargetDir(), relativePath);
|
|
281282
|
+
if (this.shouldIgnore(path35.basename(fullPath), this.params.ignore)) {
|
|
281179
281283
|
continue;
|
|
281180
281284
|
}
|
|
281181
281285
|
try {
|
|
281182
281286
|
const stats2 = await fs31.stat(fullPath);
|
|
281183
281287
|
const isDir = stats2.isDirectory();
|
|
281184
281288
|
entries2.push({
|
|
281185
|
-
name:
|
|
281289
|
+
name: path35.basename(fullPath),
|
|
281186
281290
|
path: fullPath,
|
|
281187
281291
|
isDirectory: isDir,
|
|
281188
281292
|
size: isDir ? 0 : stats2.size,
|
|
@@ -281258,7 +281362,7 @@ var LSTool = class _LSTool extends BaseDeclarativeTool {
|
|
|
281258
281362
|
* @returns An error message string if invalid, null otherwise
|
|
281259
281363
|
*/
|
|
281260
281364
|
validateToolParamValues(params) {
|
|
281261
|
-
const resolvedPath =
|
|
281365
|
+
const resolvedPath = path35.resolve(
|
|
281262
281366
|
this.config.getTargetDir(),
|
|
281263
281367
|
params.dir_path
|
|
281264
281368
|
);
|
|
@@ -281279,7 +281383,7 @@ var LSTool = class _LSTool extends BaseDeclarativeTool {
|
|
|
281279
281383
|
};
|
|
281280
281384
|
|
|
281281
281385
|
// packages/core/src/tools/read-file.ts
|
|
281282
|
-
import
|
|
281386
|
+
import path41 from "node:path";
|
|
281283
281387
|
|
|
281284
281388
|
// packages/core/src/telemetry/telemetry-utils.ts
|
|
281285
281389
|
function getProgrammingLanguage(args2) {
|
|
@@ -281293,19 +281397,19 @@ function getProgrammingLanguage(args2) {
|
|
|
281293
281397
|
// packages/core/src/utils/gitIgnoreParser.ts
|
|
281294
281398
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
281295
281399
|
import * as fs32 from "node:fs";
|
|
281296
|
-
import * as
|
|
281400
|
+
import * as path37 from "node:path";
|
|
281297
281401
|
|
|
281298
281402
|
// packages/core/src/utils/ignorePathUtils.ts
|
|
281299
|
-
import * as
|
|
281403
|
+
import * as path36 from "node:path";
|
|
281300
281404
|
function getNormalizedRelativePath(projectRoot, filePath, isDirectory) {
|
|
281301
281405
|
if (!filePath || typeof filePath !== "string") {
|
|
281302
281406
|
return null;
|
|
281303
281407
|
}
|
|
281304
|
-
const absoluteFilePath =
|
|
281408
|
+
const absoluteFilePath = path36.resolve(projectRoot, filePath);
|
|
281305
281409
|
if (!isWithinRoot(absoluteFilePath, projectRoot)) {
|
|
281306
281410
|
return null;
|
|
281307
281411
|
}
|
|
281308
|
-
const relativePath =
|
|
281412
|
+
const relativePath = path36.relative(projectRoot, absoluteFilePath);
|
|
281309
281413
|
let normalized2 = relativePath.replace(/\\/g, "/");
|
|
281310
281414
|
if (isDirectory && !normalized2.endsWith("/") && normalized2 !== "") {
|
|
281311
281415
|
normalized2 += "/";
|
|
@@ -281323,7 +281427,7 @@ function getNormalizedRelativePath(projectRoot, filePath, isDirectory) {
|
|
|
281323
281427
|
var GitIgnoreParser = class {
|
|
281324
281428
|
constructor(projectRoot, extraPatterns) {
|
|
281325
281429
|
this.extraPatterns = extraPatterns;
|
|
281326
|
-
this.projectRoot =
|
|
281430
|
+
this.projectRoot = path37.resolve(projectRoot);
|
|
281327
281431
|
this.processedExtraPatterns = (0, import_ignore.default)();
|
|
281328
281432
|
if (this.extraPatterns) {
|
|
281329
281433
|
this.processedExtraPatterns.add(
|
|
@@ -281343,9 +281447,9 @@ var GitIgnoreParser = class {
|
|
|
281343
281447
|
return (0, import_ignore.default)();
|
|
281344
281448
|
}
|
|
281345
281449
|
const isExcludeFile = patternsFilePath.endsWith(
|
|
281346
|
-
|
|
281450
|
+
path37.join(".git", "info", "exclude")
|
|
281347
281451
|
);
|
|
281348
|
-
const relativeBaseDir = isExcludeFile ? "." :
|
|
281452
|
+
const relativeBaseDir = isExcludeFile ? "." : path37.dirname(path37.relative(this.projectRoot, patternsFilePath)).split(path37.sep).join(path37.posix.sep);
|
|
281349
281453
|
const rawPatterns = content.split("\n");
|
|
281350
281454
|
return (0, import_ignore.default)().add(this.processPatterns(rawPatterns, relativeBaseDir));
|
|
281351
281455
|
}
|
|
@@ -281365,9 +281469,9 @@ var GitIgnoreParser = class {
|
|
|
281365
281469
|
let newPattern = p;
|
|
281366
281470
|
if (relativeBaseDir && relativeBaseDir !== ".") {
|
|
281367
281471
|
if (!isAnchoredInFile && !p.includes("/")) {
|
|
281368
|
-
newPattern =
|
|
281472
|
+
newPattern = path37.posix.join("**", p);
|
|
281369
281473
|
}
|
|
281370
|
-
newPattern =
|
|
281474
|
+
newPattern = path37.posix.join(relativeBaseDir, newPattern);
|
|
281371
281475
|
if (!newPattern.startsWith("/")) {
|
|
281372
281476
|
newPattern = "/" + newPattern;
|
|
281373
281477
|
}
|
|
@@ -281393,7 +281497,7 @@ var GitIgnoreParser = class {
|
|
|
281393
281497
|
try {
|
|
281394
281498
|
const ig = (0, import_ignore.default)().add(".git");
|
|
281395
281499
|
if (this.globalPatterns === void 0) {
|
|
281396
|
-
const excludeFile =
|
|
281500
|
+
const excludeFile = path37.join(
|
|
281397
281501
|
this.projectRoot,
|
|
281398
281502
|
".git",
|
|
281399
281503
|
"info",
|
|
@@ -281406,11 +281510,11 @@ var GitIgnoreParser = class {
|
|
|
281406
281510
|
let currentAbsDir = this.projectRoot;
|
|
281407
281511
|
const dirsToVisit = [this.projectRoot];
|
|
281408
281512
|
for (let i3 = 0; i3 < pathParts.length - 1; i3++) {
|
|
281409
|
-
currentAbsDir =
|
|
281513
|
+
currentAbsDir = path37.join(currentAbsDir, pathParts[i3]);
|
|
281410
281514
|
dirsToVisit.push(currentAbsDir);
|
|
281411
281515
|
}
|
|
281412
281516
|
for (const dir of dirsToVisit) {
|
|
281413
|
-
const relativeDir =
|
|
281517
|
+
const relativeDir = path37.relative(this.projectRoot, dir);
|
|
281414
281518
|
if (relativeDir) {
|
|
281415
281519
|
const parentDirRelative = getNormalizedRelativePath(
|
|
281416
281520
|
this.projectRoot,
|
|
@@ -281424,7 +281528,7 @@ var GitIgnoreParser = class {
|
|
|
281424
281528
|
}
|
|
281425
281529
|
let patterns = this.cache.get(dir);
|
|
281426
281530
|
if (patterns === void 0) {
|
|
281427
|
-
const gitignorePath =
|
|
281531
|
+
const gitignorePath = path37.join(dir, ".gitignore");
|
|
281428
281532
|
patterns = fs32.existsSync(gitignorePath) ? this.loadPatternsForFile(gitignorePath) : (0, import_ignore.default)();
|
|
281429
281533
|
this.cache.set(dir, patterns);
|
|
281430
281534
|
}
|
|
@@ -281440,14 +281544,14 @@ var GitIgnoreParser = class {
|
|
|
281440
281544
|
// packages/core/src/utils/ignoreFileParser.ts
|
|
281441
281545
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
281442
281546
|
import * as fs33 from "node:fs";
|
|
281443
|
-
import * as
|
|
281547
|
+
import * as path38 from "node:path";
|
|
281444
281548
|
var IgnoreFileParser = class {
|
|
281445
281549
|
projectRoot;
|
|
281446
281550
|
patterns = [];
|
|
281447
281551
|
ig = (0, import_ignore2.default)();
|
|
281448
281552
|
fileNames;
|
|
281449
281553
|
constructor(projectRoot, input, isPatterns = false) {
|
|
281450
|
-
this.projectRoot =
|
|
281554
|
+
this.projectRoot = path38.resolve(projectRoot);
|
|
281451
281555
|
if (isPatterns) {
|
|
281452
281556
|
this.fileNames = [];
|
|
281453
281557
|
const patterns = Array.isArray(input) ? input : [input];
|
|
@@ -281466,7 +281570,7 @@ var IgnoreFileParser = class {
|
|
|
281466
281570
|
}
|
|
281467
281571
|
}
|
|
281468
281572
|
parseIgnoreFile(fileName) {
|
|
281469
|
-
const patternsFilePath =
|
|
281573
|
+
const patternsFilePath = path38.join(this.projectRoot, fileName);
|
|
281470
281574
|
let content;
|
|
281471
281575
|
try {
|
|
281472
281576
|
content = fs33.readFileSync(patternsFilePath, "utf-8");
|
|
@@ -281497,7 +281601,7 @@ var IgnoreFileParser = class {
|
|
|
281497
281601
|
return this.patterns;
|
|
281498
281602
|
}
|
|
281499
281603
|
getIgnoreFilePaths() {
|
|
281500
|
-
return this.fileNames.slice().reverse().map((fileName) =>
|
|
281604
|
+
return this.fileNames.slice().reverse().map((fileName) => path38.join(this.projectRoot, fileName)).filter((filePath) => fs33.existsSync(filePath));
|
|
281501
281605
|
}
|
|
281502
281606
|
/**
|
|
281503
281607
|
* Returns true if at least one ignore file exists and has patterns.
|
|
@@ -281509,16 +281613,16 @@ var IgnoreFileParser = class {
|
|
|
281509
281613
|
|
|
281510
281614
|
// packages/core/src/utils/gitUtils.ts
|
|
281511
281615
|
import * as fs34 from "node:fs";
|
|
281512
|
-
import * as
|
|
281616
|
+
import * as path39 from "node:path";
|
|
281513
281617
|
function isGitRepository(directory) {
|
|
281514
281618
|
try {
|
|
281515
|
-
let currentDir =
|
|
281619
|
+
let currentDir = path39.resolve(directory);
|
|
281516
281620
|
while (true) {
|
|
281517
|
-
const gitDir =
|
|
281621
|
+
const gitDir = path39.join(currentDir, ".git");
|
|
281518
281622
|
if (fs34.existsSync(gitDir)) {
|
|
281519
281623
|
return true;
|
|
281520
281624
|
}
|
|
281521
|
-
const parentDir =
|
|
281625
|
+
const parentDir = path39.dirname(currentDir);
|
|
281522
281626
|
if (parentDir === currentDir) {
|
|
281523
281627
|
break;
|
|
281524
281628
|
}
|
|
@@ -281531,13 +281635,13 @@ function isGitRepository(directory) {
|
|
|
281531
281635
|
}
|
|
281532
281636
|
function findGitRoot(directory) {
|
|
281533
281637
|
try {
|
|
281534
|
-
let currentDir =
|
|
281638
|
+
let currentDir = path39.resolve(directory);
|
|
281535
281639
|
while (true) {
|
|
281536
|
-
const gitDir =
|
|
281640
|
+
const gitDir = path39.join(currentDir, ".git");
|
|
281537
281641
|
if (fs34.existsSync(gitDir)) {
|
|
281538
281642
|
return currentDir;
|
|
281539
281643
|
}
|
|
281540
|
-
const parentDir =
|
|
281644
|
+
const parentDir = path39.dirname(currentDir);
|
|
281541
281645
|
if (parentDir === currentDir) {
|
|
281542
281646
|
break;
|
|
281543
281647
|
}
|
|
@@ -281551,7 +281655,7 @@ function findGitRoot(directory) {
|
|
|
281551
281655
|
|
|
281552
281656
|
// packages/core/src/services/fileDiscoveryService.ts
|
|
281553
281657
|
import fs35 from "node:fs";
|
|
281554
|
-
import * as
|
|
281658
|
+
import * as path40 from "node:path";
|
|
281555
281659
|
var FileDiscoveryService = class {
|
|
281556
281660
|
gitIgnoreFilter = null;
|
|
281557
281661
|
geminiIgnoreFilter = null;
|
|
@@ -281564,7 +281668,7 @@ var FileDiscoveryService = class {
|
|
|
281564
281668
|
};
|
|
281565
281669
|
projectRoot;
|
|
281566
281670
|
constructor(projectRoot, options) {
|
|
281567
|
-
this.projectRoot =
|
|
281671
|
+
this.projectRoot = path40.resolve(projectRoot);
|
|
281568
281672
|
this.applyFilterFilesOptions(options);
|
|
281569
281673
|
if (isGitRepository(this.projectRoot)) {
|
|
281570
281674
|
this.gitIgnoreFilter = new GitIgnoreParser(this.projectRoot);
|
|
@@ -281619,7 +281723,7 @@ var FileDiscoveryService = class {
|
|
|
281619
281723
|
}
|
|
281620
281724
|
await Promise.all(
|
|
281621
281725
|
dirEntries.map(async (entry) => {
|
|
281622
|
-
const fullPath =
|
|
281726
|
+
const fullPath = path40.join(currentDir, entry.name);
|
|
281623
281727
|
if (entry.isDirectory()) {
|
|
281624
281728
|
if (this.shouldIgnoreDirectory(fullPath, options)) {
|
|
281625
281729
|
ignoredPaths.push(fullPath);
|
|
@@ -281729,7 +281833,7 @@ var FileDiscoveryService = class {
|
|
|
281729
281833
|
getAllIgnoreFilePaths() {
|
|
281730
281834
|
const paths = [];
|
|
281731
281835
|
if (this.gitIgnoreFilter && this.defaultFilterFileOptions.respectGitIgnore) {
|
|
281732
|
-
const gitIgnorePath =
|
|
281836
|
+
const gitIgnorePath = path40.join(this.projectRoot, ".gitignore");
|
|
281733
281837
|
if (fs35.existsSync(gitIgnorePath)) {
|
|
281734
281838
|
paths.push(gitIgnorePath);
|
|
281735
281839
|
}
|
|
@@ -281743,7 +281847,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
281743
281847
|
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
281744
281848
|
super(params, messageBus, _toolName, _toolDisplayName);
|
|
281745
281849
|
this.config = config2;
|
|
281746
|
-
this.resolvedPath =
|
|
281850
|
+
this.resolvedPath = path41.resolve(
|
|
281747
281851
|
this.config.getTargetDir(),
|
|
281748
281852
|
this.params.file_path
|
|
281749
281853
|
);
|
|
@@ -281827,7 +281931,7 @@ ${result2.llmContent}`;
|
|
|
281827
281931
|
"read" /* READ */,
|
|
281828
281932
|
lines,
|
|
281829
281933
|
mimetype,
|
|
281830
|
-
|
|
281934
|
+
path41.extname(this.resolvedPath),
|
|
281831
281935
|
programming_language
|
|
281832
281936
|
)
|
|
281833
281937
|
);
|
|
@@ -281869,7 +281973,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
281869
281973
|
if (params.file_path.trim() === "") {
|
|
281870
281974
|
return "The 'file_path' parameter must be non-empty.";
|
|
281871
281975
|
}
|
|
281872
|
-
const resolvedPath =
|
|
281976
|
+
const resolvedPath = path41.resolve(
|
|
281873
281977
|
this.config.getTargetDir(),
|
|
281874
281978
|
params.file_path
|
|
281875
281979
|
);
|
|
@@ -281915,7 +282019,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
281915
282019
|
// packages/core/src/tools/grep.ts
|
|
281916
282020
|
import fs36 from "node:fs";
|
|
281917
282021
|
import fsPromises7 from "node:fs/promises";
|
|
281918
|
-
import
|
|
282022
|
+
import path43 from "node:path";
|
|
281919
282023
|
import { spawn as spawn5 } from "node:child_process";
|
|
281920
282024
|
|
|
281921
282025
|
// node_modules/balanced-match/dist/esm/index.js
|
|
@@ -282976,11 +283080,11 @@ var qmarksTestNoExtDot = ([$0]) => {
|
|
|
282976
283080
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
282977
283081
|
};
|
|
282978
283082
|
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
282979
|
-
var
|
|
283083
|
+
var path42 = {
|
|
282980
283084
|
win32: { sep: "\\" },
|
|
282981
283085
|
posix: { sep: "/" }
|
|
282982
283086
|
};
|
|
282983
|
-
var sep3 = defaultPlatform === "win32" ?
|
|
283087
|
+
var sep3 = defaultPlatform === "win32" ? path42.win32.sep : path42.posix.sep;
|
|
282984
283088
|
minimatch.sep = sep3;
|
|
282985
283089
|
var GLOBSTAR = Symbol("globstar **");
|
|
282986
283090
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -288967,14 +289071,14 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
288967
289071
|
const [, filePathRaw, lineNumberStr, lineContent] = match2;
|
|
288968
289072
|
const lineNumber = parseInt(lineNumberStr, 10);
|
|
288969
289073
|
if (!isNaN(lineNumber)) {
|
|
288970
|
-
const absoluteFilePath =
|
|
288971
|
-
const relativeCheck =
|
|
288972
|
-
if (relativeCheck === ".." || relativeCheck.startsWith(`..${
|
|
289074
|
+
const absoluteFilePath = path43.resolve(basePath, filePathRaw);
|
|
289075
|
+
const relativeCheck = path43.relative(basePath, absoluteFilePath);
|
|
289076
|
+
if (relativeCheck === ".." || relativeCheck.startsWith(`..${path43.sep}`) || path43.isAbsolute(relativeCheck)) {
|
|
288973
289077
|
return null;
|
|
288974
289078
|
}
|
|
288975
|
-
const relativeFilePath =
|
|
289079
|
+
const relativeFilePath = path43.relative(basePath, absoluteFilePath);
|
|
288976
289080
|
return {
|
|
288977
|
-
filePath: relativeFilePath ||
|
|
289081
|
+
filePath: relativeFilePath || path43.basename(absoluteFilePath),
|
|
288978
289082
|
absolutePath: absoluteFilePath,
|
|
288979
289083
|
lineNumber,
|
|
288980
289084
|
line: lineContent
|
|
@@ -288988,7 +289092,7 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
288988
289092
|
const pathParam = this.params.dir_path;
|
|
288989
289093
|
let searchDirAbs = null;
|
|
288990
289094
|
if (pathParam) {
|
|
288991
|
-
searchDirAbs =
|
|
289095
|
+
searchDirAbs = path43.resolve(this.config.getTargetDir(), pathParam);
|
|
288992
289096
|
const validationError = this.config.validatePathAccess(
|
|
288993
289097
|
searchDirAbs,
|
|
288994
289098
|
"read"
|
|
@@ -289072,9 +289176,9 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
289072
289176
|
signal: timeoutController.signal
|
|
289073
289177
|
});
|
|
289074
289178
|
if (searchDirectories.length > 1) {
|
|
289075
|
-
const dirName =
|
|
289179
|
+
const dirName = path43.basename(searchDir);
|
|
289076
289180
|
matches.forEach((match2) => {
|
|
289077
|
-
match2.filePath =
|
|
289181
|
+
match2.filePath = path43.join(dirName, match2.filePath);
|
|
289078
289182
|
});
|
|
289079
289183
|
}
|
|
289080
289184
|
allMatches = allMatches.concat(matches);
|
|
@@ -289329,8 +289433,8 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
289329
289433
|
for await (const filePath of filesStream) {
|
|
289330
289434
|
if (allMatches.length >= maxMatches) break;
|
|
289331
289435
|
const fileAbsolutePath = filePath;
|
|
289332
|
-
const relativePath =
|
|
289333
|
-
if (relativePath === ".." || relativePath.startsWith(`..${
|
|
289436
|
+
const relativePath = path43.relative(absolutePath, fileAbsolutePath);
|
|
289437
|
+
if (relativePath === ".." || relativePath.startsWith(`..${path43.sep}`) || path43.isAbsolute(relativePath))
|
|
289334
289438
|
continue;
|
|
289335
289439
|
try {
|
|
289336
289440
|
const content = await fsPromises7.readFile(fileAbsolutePath, "utf8");
|
|
@@ -289343,7 +289447,7 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
289343
289447
|
continue;
|
|
289344
289448
|
}
|
|
289345
289449
|
allMatches.push({
|
|
289346
|
-
filePath:
|
|
289450
|
+
filePath: path43.relative(absolutePath, fileAbsolutePath) || path43.basename(fileAbsolutePath),
|
|
289347
289451
|
absolutePath: fileAbsolutePath,
|
|
289348
289452
|
lineNumber: index + 1,
|
|
289349
289453
|
line
|
|
@@ -289381,7 +289485,7 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
289381
289485
|
description += ` in ${this.params.include_pattern}`;
|
|
289382
289486
|
}
|
|
289383
289487
|
if (this.params.dir_path) {
|
|
289384
|
-
const resolvedPath =
|
|
289488
|
+
const resolvedPath = path43.resolve(
|
|
289385
289489
|
this.config.getTargetDir(),
|
|
289386
289490
|
this.params.dir_path
|
|
289387
289491
|
);
|
|
@@ -289444,7 +289548,7 @@ var GrepTool = class _GrepTool extends BaseDeclarativeTool {
|
|
|
289444
289548
|
return "total_max_matches must be at least 1.";
|
|
289445
289549
|
}
|
|
289446
289550
|
if (params.dir_path) {
|
|
289447
|
-
const resolvedPath =
|
|
289551
|
+
const resolvedPath = path43.resolve(
|
|
289448
289552
|
this.config.getTargetDir(),
|
|
289449
289553
|
params.dir_path
|
|
289450
289554
|
);
|
|
@@ -289486,10 +289590,10 @@ var GrepTool = class _GrepTool extends BaseDeclarativeTool {
|
|
|
289486
289590
|
// packages/core/src/tools/ripGrep.ts
|
|
289487
289591
|
import fs38 from "node:fs";
|
|
289488
289592
|
import fsPromises9 from "node:fs/promises";
|
|
289489
|
-
import
|
|
289593
|
+
import path51 from "node:path";
|
|
289490
289594
|
|
|
289491
289595
|
// node_modules/@joshua.litt/get-ripgrep/dist/index.js
|
|
289492
|
-
import { dirname as dirname9, join as
|
|
289596
|
+
import { dirname as dirname9, join as join13 } from "node:path";
|
|
289493
289597
|
import { fileURLToPath as fileURLToPath13 } from "node:url";
|
|
289494
289598
|
|
|
289495
289599
|
// node_modules/@lvce-editor/verror/dist/index.js
|
|
@@ -290390,12 +290494,12 @@ var handleCommand = (filePath, rawArguments, rawOptions) => {
|
|
|
290390
290494
|
|
|
290391
290495
|
// node_modules/execa/lib/arguments/options.js
|
|
290392
290496
|
var import_cross_spawn2 = __toESM(require_cross_spawn(), 1);
|
|
290393
|
-
import
|
|
290497
|
+
import path48 from "node:path";
|
|
290394
290498
|
import process16 from "node:process";
|
|
290395
290499
|
|
|
290396
290500
|
// node_modules/npm-run-path/index.js
|
|
290397
290501
|
import process14 from "node:process";
|
|
290398
|
-
import
|
|
290502
|
+
import path45 from "node:path";
|
|
290399
290503
|
|
|
290400
290504
|
// node_modules/npm-run-path/node_modules/path-key/index.js
|
|
290401
290505
|
function pathKey(options = {}) {
|
|
@@ -290412,7 +290516,7 @@ function pathKey(options = {}) {
|
|
|
290412
290516
|
// node_modules/npm-run-path/node_modules/unicorn-magic/node.js
|
|
290413
290517
|
import { promisify as promisify8 } from "node:util";
|
|
290414
290518
|
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
|
|
290415
|
-
import
|
|
290519
|
+
import path44 from "node:path";
|
|
290416
290520
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
290417
290521
|
var execFileOriginal = promisify8(execFileCallback);
|
|
290418
290522
|
function toPath3(urlOrPath) {
|
|
@@ -290421,12 +290525,12 @@ function toPath3(urlOrPath) {
|
|
|
290421
290525
|
function traversePathUp(startPath) {
|
|
290422
290526
|
return {
|
|
290423
290527
|
*[Symbol.iterator]() {
|
|
290424
|
-
let currentPath =
|
|
290528
|
+
let currentPath = path44.resolve(toPath3(startPath));
|
|
290425
290529
|
let previousPath;
|
|
290426
290530
|
while (previousPath !== currentPath) {
|
|
290427
290531
|
yield currentPath;
|
|
290428
290532
|
previousPath = currentPath;
|
|
290429
|
-
currentPath =
|
|
290533
|
+
currentPath = path44.resolve(currentPath, "..");
|
|
290430
290534
|
}
|
|
290431
290535
|
}
|
|
290432
290536
|
};
|
|
@@ -290441,27 +290545,27 @@ var npmRunPath = ({
|
|
|
290441
290545
|
execPath: execPath2 = process14.execPath,
|
|
290442
290546
|
addExecPath = true
|
|
290443
290547
|
} = {}) => {
|
|
290444
|
-
const cwdPath =
|
|
290548
|
+
const cwdPath = path45.resolve(toPath3(cwd));
|
|
290445
290549
|
const result2 = [];
|
|
290446
|
-
const pathParts = pathOption.split(
|
|
290550
|
+
const pathParts = pathOption.split(path45.delimiter);
|
|
290447
290551
|
if (preferLocal) {
|
|
290448
290552
|
applyPreferLocal(result2, pathParts, cwdPath);
|
|
290449
290553
|
}
|
|
290450
290554
|
if (addExecPath) {
|
|
290451
290555
|
applyExecPath(result2, pathParts, execPath2, cwdPath);
|
|
290452
290556
|
}
|
|
290453
|
-
return pathOption === "" || pathOption ===
|
|
290557
|
+
return pathOption === "" || pathOption === path45.delimiter ? `${result2.join(path45.delimiter)}${pathOption}` : [...result2, pathOption].join(path45.delimiter);
|
|
290454
290558
|
};
|
|
290455
290559
|
var applyPreferLocal = (result2, pathParts, cwdPath) => {
|
|
290456
290560
|
for (const directory of traversePathUp(cwdPath)) {
|
|
290457
|
-
const pathPart =
|
|
290561
|
+
const pathPart = path45.join(directory, "node_modules/.bin");
|
|
290458
290562
|
if (!pathParts.includes(pathPart)) {
|
|
290459
290563
|
result2.push(pathPart);
|
|
290460
290564
|
}
|
|
290461
290565
|
}
|
|
290462
290566
|
};
|
|
290463
290567
|
var applyExecPath = (result2, pathParts, execPath2, cwdPath) => {
|
|
290464
|
-
const pathPart =
|
|
290568
|
+
const pathPart = path45.resolve(cwdPath, toPath3(execPath2), "..");
|
|
290465
290569
|
if (!pathParts.includes(pathPart)) {
|
|
290466
290570
|
result2.push(pathPart);
|
|
290467
290571
|
}
|
|
@@ -291616,7 +291720,7 @@ var killAfterTimeout = async (subprocess, timeout, context2, { signal }) => {
|
|
|
291616
291720
|
|
|
291617
291721
|
// node_modules/execa/lib/methods/node.js
|
|
291618
291722
|
import { execPath, execArgv } from "node:process";
|
|
291619
|
-
import
|
|
291723
|
+
import path46 from "node:path";
|
|
291620
291724
|
var mapNode = ({ options }) => {
|
|
291621
291725
|
if (options.node === false) {
|
|
291622
291726
|
throw new TypeError('The "node" option cannot be false with `execaNode()`.');
|
|
@@ -291635,7 +291739,7 @@ var handleNodeOption = (file2, commandArguments, {
|
|
|
291635
291739
|
throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');
|
|
291636
291740
|
}
|
|
291637
291741
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath2, 'The "nodePath" option');
|
|
291638
|
-
const resolvedNodePath =
|
|
291742
|
+
const resolvedNodePath = path46.resolve(cwd, normalizedNodePath);
|
|
291639
291743
|
const newOptions = {
|
|
291640
291744
|
...options,
|
|
291641
291745
|
nodePath: resolvedNodePath,
|
|
@@ -291645,7 +291749,7 @@ var handleNodeOption = (file2, commandArguments, {
|
|
|
291645
291749
|
if (!shouldHandleNode) {
|
|
291646
291750
|
return [file2, commandArguments, newOptions];
|
|
291647
291751
|
}
|
|
291648
|
-
if (
|
|
291752
|
+
if (path46.basename(file2, ".exe") === "node") {
|
|
291649
291753
|
throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');
|
|
291650
291754
|
}
|
|
291651
291755
|
return [
|
|
@@ -291735,11 +291839,11 @@ var serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encodin
|
|
|
291735
291839
|
|
|
291736
291840
|
// node_modules/execa/lib/arguments/cwd.js
|
|
291737
291841
|
import { statSync } from "node:fs";
|
|
291738
|
-
import
|
|
291842
|
+
import path47 from "node:path";
|
|
291739
291843
|
import process15 from "node:process";
|
|
291740
291844
|
var normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
291741
291845
|
const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
|
|
291742
|
-
return
|
|
291846
|
+
return path47.resolve(cwdString);
|
|
291743
291847
|
};
|
|
291744
291848
|
var getDefaultCwd = () => {
|
|
291745
291849
|
try {
|
|
@@ -291786,7 +291890,7 @@ var normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
291786
291890
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
291787
291891
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
291788
291892
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
291789
|
-
if (process16.platform === "win32" &&
|
|
291893
|
+
if (process16.platform === "win32" && path48.basename(file2, ".exe") === "cmd") {
|
|
291790
291894
|
commandArguments.unshift("/q");
|
|
291791
291895
|
}
|
|
291792
291896
|
return { file: file2, commandArguments, options };
|
|
@@ -302310,7 +302414,7 @@ var source_default2 = got;
|
|
|
302310
302414
|
|
|
302311
302415
|
// node_modules/@joshua.litt/get-ripgrep/dist/downloadRipGrep.js
|
|
302312
302416
|
import * as os23 from "node:os";
|
|
302313
|
-
import { dirname as dirname8, join as
|
|
302417
|
+
import { dirname as dirname8, join as join12 } from "node:path";
|
|
302314
302418
|
|
|
302315
302419
|
// node_modules/@joshua.litt/get-ripgrep/node_modules/path-exists/index.js
|
|
302316
302420
|
import fs37, { promises as fsPromises8 } from "node:fs";
|
|
@@ -302329,13 +302433,13 @@ import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
|
302329
302433
|
|
|
302330
302434
|
// node_modules/xdg-basedir/index.js
|
|
302331
302435
|
import os22 from "os";
|
|
302332
|
-
import
|
|
302436
|
+
import path49 from "path";
|
|
302333
302437
|
var homeDirectory = os22.homedir();
|
|
302334
302438
|
var { env } = process;
|
|
302335
|
-
var xdgData = env.XDG_DATA_HOME || (homeDirectory ?
|
|
302336
|
-
var xdgConfig = env.XDG_CONFIG_HOME || (homeDirectory ?
|
|
302337
|
-
var xdgState = env.XDG_STATE_HOME || (homeDirectory ?
|
|
302338
|
-
var xdgCache = env.XDG_CACHE_HOME || (homeDirectory ?
|
|
302439
|
+
var xdgData = env.XDG_DATA_HOME || (homeDirectory ? path49.join(homeDirectory, ".local", "share") : void 0);
|
|
302440
|
+
var xdgConfig = env.XDG_CONFIG_HOME || (homeDirectory ? path49.join(homeDirectory, ".config") : void 0);
|
|
302441
|
+
var xdgState = env.XDG_STATE_HOME || (homeDirectory ? path49.join(homeDirectory, ".local", "state") : void 0);
|
|
302442
|
+
var xdgCache = env.XDG_CACHE_HOME || (homeDirectory ? path49.join(homeDirectory, ".cache") : void 0);
|
|
302339
302443
|
var xdgRuntime = env.XDG_RUNTIME_DIR || void 0;
|
|
302340
302444
|
var xdgDataDirectories = (env.XDG_DATA_DIRS || "/usr/local/share/:/usr/share/").split(":");
|
|
302341
302445
|
if (xdgData) {
|
|
@@ -302347,12 +302451,12 @@ if (xdgConfig) {
|
|
|
302347
302451
|
}
|
|
302348
302452
|
|
|
302349
302453
|
// node_modules/@joshua.litt/get-ripgrep/dist/downloadRipGrep.js
|
|
302350
|
-
import
|
|
302454
|
+
import path50 from "path";
|
|
302351
302455
|
var { mkdir: mkdir2, createWriteStream: createWriteStream3, move } = import_fs_extra.default;
|
|
302352
302456
|
var __dirname6 = dirname8(fileURLToPath12(import.meta.url));
|
|
302353
302457
|
var REPOSITORY = `microsoft/ripgrep-prebuilt`;
|
|
302354
302458
|
var VERSION2 = process.env.RIPGREP_VERSION || "v13.0.0-10";
|
|
302355
|
-
var BIN_PATH =
|
|
302459
|
+
var BIN_PATH = join12(__dirname6, "../bin");
|
|
302356
302460
|
var getTarget = () => {
|
|
302357
302461
|
const arch4 = process.env.npm_config_arch || os23.arch();
|
|
302358
302462
|
const platform10 = process.env.platform || os23.platform();
|
|
@@ -302396,8 +302500,8 @@ var getTarget = () => {
|
|
|
302396
302500
|
var downloadFile = async (url3, outFile) => {
|
|
302397
302501
|
let tmpDir = void 0;
|
|
302398
302502
|
try {
|
|
302399
|
-
tmpDir = await import_fs_extra.default.mkdtemp(
|
|
302400
|
-
const tmpFile =
|
|
302503
|
+
tmpDir = await import_fs_extra.default.mkdtemp(path50.join(os23.tmpdir(), "download-ripgrep"));
|
|
302504
|
+
const tmpFile = path50.join(tmpDir, "tmp-file");
|
|
302401
302505
|
await pipeline(source_default2.stream(url3), createWriteStream3(tmpFile));
|
|
302402
302506
|
await mkdir2(dirname8(outFile), { recursive: true });
|
|
302403
302507
|
await move(tmpFile, outFile);
|
|
@@ -302446,7 +302550,7 @@ var downloadRipGrep = async (overrideBinPath) => {
|
|
|
302446
302550
|
|
|
302447
302551
|
// node_modules/@joshua.litt/get-ripgrep/dist/index.js
|
|
302448
302552
|
var __dirname7 = dirname9(fileURLToPath13(import.meta.url));
|
|
302449
|
-
var rgPath =
|
|
302553
|
+
var rgPath = join13(__dirname7, "..", "bin", `rg${process.platform === "win32" ? ".exe" : ""}`);
|
|
302450
302554
|
|
|
302451
302555
|
// packages/core/src/tools/ripGrep.ts
|
|
302452
302556
|
function getRgCandidateFilenames() {
|
|
@@ -302455,7 +302559,7 @@ function getRgCandidateFilenames() {
|
|
|
302455
302559
|
async function resolveExistingRgPath() {
|
|
302456
302560
|
const binDir = Storage.getGlobalBinDir();
|
|
302457
302561
|
for (const fileName of getRgCandidateFilenames()) {
|
|
302458
|
-
const candidatePath =
|
|
302562
|
+
const candidatePath = path51.join(binDir, fileName);
|
|
302459
302563
|
if (await fileExists(candidatePath)) {
|
|
302460
302564
|
return candidatePath;
|
|
302461
302565
|
}
|
|
@@ -302499,7 +302603,7 @@ var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
|
302499
302603
|
async execute({ abortSignal: signal }) {
|
|
302500
302604
|
try {
|
|
302501
302605
|
const pathParam = this.params.dir_path || ".";
|
|
302502
|
-
const searchDirAbs =
|
|
302606
|
+
const searchDirAbs = path51.resolve(this.config.getTargetDir(), pathParam);
|
|
302503
302607
|
const validationError = this.config.validatePathAccess(
|
|
302504
302608
|
searchDirAbs,
|
|
302505
302609
|
"read"
|
|
@@ -302588,12 +302692,12 @@ var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
|
302588
302692
|
new Set(allMatches.map((m) => m.filePath))
|
|
302589
302693
|
);
|
|
302590
302694
|
const absoluteFilePaths = uniqueFiles.map(
|
|
302591
|
-
(f) =>
|
|
302695
|
+
(f) => path51.resolve(searchDirAbs, f)
|
|
302592
302696
|
);
|
|
302593
302697
|
const allowedFiles = this.fileDiscoveryService.filterFiles(absoluteFilePaths);
|
|
302594
302698
|
const allowedSet = new Set(allowedFiles);
|
|
302595
302699
|
allMatches = allMatches.filter(
|
|
302596
|
-
(m) => allowedSet.has(
|
|
302700
|
+
(m) => allowedSet.has(path51.resolve(searchDirAbs, m.filePath))
|
|
302597
302701
|
);
|
|
302598
302702
|
}
|
|
302599
302703
|
const matchCount = allMatches.filter((m) => !m.isContext).length;
|
|
@@ -302756,15 +302860,15 @@ var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
|
302756
302860
|
if (json3.type === "match" || json3.type === "context") {
|
|
302757
302861
|
const data = json3.data;
|
|
302758
302862
|
if (data.path?.text && data.lines?.text) {
|
|
302759
|
-
const absoluteFilePath =
|
|
302760
|
-
const relativeCheck =
|
|
302761
|
-
if (relativeCheck === ".." || relativeCheck.startsWith(`..${
|
|
302863
|
+
const absoluteFilePath = path51.resolve(basePath, data.path.text);
|
|
302864
|
+
const relativeCheck = path51.relative(basePath, absoluteFilePath);
|
|
302865
|
+
if (relativeCheck === ".." || relativeCheck.startsWith(`..${path51.sep}`) || path51.isAbsolute(relativeCheck)) {
|
|
302762
302866
|
return null;
|
|
302763
302867
|
}
|
|
302764
|
-
const relativeFilePath =
|
|
302868
|
+
const relativeFilePath = path51.relative(basePath, absoluteFilePath);
|
|
302765
302869
|
return {
|
|
302766
302870
|
absolutePath: absoluteFilePath,
|
|
302767
|
-
filePath: relativeFilePath ||
|
|
302871
|
+
filePath: relativeFilePath || path51.basename(absoluteFilePath),
|
|
302768
302872
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
302769
302873
|
lineNumber: data.line_number,
|
|
302770
302874
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -302794,7 +302898,7 @@ var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
|
302794
302898
|
description += ` in ${this.params.include_pattern}`;
|
|
302795
302899
|
}
|
|
302796
302900
|
const pathParam = this.params.dir_path || ".";
|
|
302797
|
-
const resolvedPath =
|
|
302901
|
+
const resolvedPath = path51.resolve(this.config.getTargetDir(), pathParam);
|
|
302798
302902
|
if (resolvedPath === this.config.getTargetDir() || pathParam === ".") {
|
|
302799
302903
|
description += ` within ./`;
|
|
302800
302904
|
} else {
|
|
@@ -302856,7 +302960,7 @@ var RipGrepTool = class _RipGrepTool extends BaseDeclarativeTool {
|
|
|
302856
302960
|
return "total_max_matches must be at least 1.";
|
|
302857
302961
|
}
|
|
302858
302962
|
if (params.dir_path) {
|
|
302859
|
-
const resolvedPath =
|
|
302963
|
+
const resolvedPath = path51.resolve(
|
|
302860
302964
|
this.config.getTargetDir(),
|
|
302861
302965
|
params.dir_path
|
|
302862
302966
|
);
|
|
@@ -302898,7 +303002,7 @@ var RipGrepTool = class _RipGrepTool extends BaseDeclarativeTool {
|
|
|
302898
303002
|
|
|
302899
303003
|
// packages/core/src/tools/glob.ts
|
|
302900
303004
|
import fs39 from "node:fs";
|
|
302901
|
-
import
|
|
303005
|
+
import path52 from "node:path";
|
|
302902
303006
|
function sortFileEntries(entries2, nowTimestamp, recencyThresholdMs) {
|
|
302903
303007
|
const sortedEntries = [...entries2];
|
|
302904
303008
|
sortedEntries.sort((a2, b) => {
|
|
@@ -302926,7 +303030,7 @@ var GlobToolInvocation = class extends BaseToolInvocation {
|
|
|
302926
303030
|
getDescription() {
|
|
302927
303031
|
let description = `'${this.params.pattern}'`;
|
|
302928
303032
|
if (this.params.dir_path) {
|
|
302929
|
-
const searchDir =
|
|
303033
|
+
const searchDir = path52.resolve(
|
|
302930
303034
|
this.config.getTargetDir(),
|
|
302931
303035
|
this.params.dir_path || "."
|
|
302932
303036
|
);
|
|
@@ -302946,7 +303050,7 @@ var GlobToolInvocation = class extends BaseToolInvocation {
|
|
|
302946
303050
|
const workspaceDirectories = workspaceContext.getDirectories();
|
|
302947
303051
|
let searchDirectories;
|
|
302948
303052
|
if (this.params.dir_path) {
|
|
302949
|
-
const searchDirAbsolute =
|
|
303053
|
+
const searchDirAbsolute = path52.resolve(
|
|
302950
303054
|
this.config.getTargetDir(),
|
|
302951
303055
|
this.params.dir_path
|
|
302952
303056
|
);
|
|
@@ -302972,7 +303076,7 @@ var GlobToolInvocation = class extends BaseToolInvocation {
|
|
|
302972
303076
|
const allEntries = [];
|
|
302973
303077
|
for (const searchDir of searchDirectories) {
|
|
302974
303078
|
let pattern = this.params.pattern;
|
|
302975
|
-
const fullPath =
|
|
303079
|
+
const fullPath = path52.join(searchDir, pattern);
|
|
302976
303080
|
if (fs39.existsSync(fullPath)) {
|
|
302977
303081
|
pattern = escape2(pattern);
|
|
302978
303082
|
}
|
|
@@ -302990,14 +303094,14 @@ var GlobToolInvocation = class extends BaseToolInvocation {
|
|
|
302990
303094
|
allEntries.push(...entries2);
|
|
302991
303095
|
}
|
|
302992
303096
|
const relativePaths = allEntries.map(
|
|
302993
|
-
(p) =>
|
|
303097
|
+
(p) => path52.relative(this.config.getTargetDir(), p.fullpath())
|
|
302994
303098
|
);
|
|
302995
303099
|
const { filteredPaths, ignoredCount } = fileDiscovery.filterFilesWithReport(relativePaths, {
|
|
302996
303100
|
respectGitIgnore: this.params?.respect_git_ignore ?? this.config.getFileFilteringOptions().respectGitIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectGitIgnore,
|
|
302997
303101
|
respectGeminiIgnore: this.params?.respect_gemini_ignore ?? this.config.getFileFilteringOptions().respectGeminiIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectGeminiIgnore
|
|
302998
303102
|
});
|
|
302999
303103
|
const filteredAbsolutePaths = new Set(
|
|
303000
|
-
filteredPaths.map((p) =>
|
|
303104
|
+
filteredPaths.map((p) => path52.resolve(this.config.getTargetDir(), p))
|
|
303001
303105
|
);
|
|
303002
303106
|
const filteredEntries = allEntries.filter(
|
|
303003
303107
|
(entry) => filteredAbsolutePaths.has(entry.fullpath())
|
|
@@ -303078,7 +303182,7 @@ var GlobTool = class _GlobTool extends BaseDeclarativeTool {
|
|
|
303078
303182
|
* Validates the parameters for the tool.
|
|
303079
303183
|
*/
|
|
303080
303184
|
validateToolParamValues(params) {
|
|
303081
|
-
const searchDirAbsolute =
|
|
303185
|
+
const searchDirAbsolute = path52.resolve(
|
|
303082
303186
|
this.config.getTargetDir(),
|
|
303083
303187
|
params.dir_path || "."
|
|
303084
303188
|
);
|
|
@@ -303120,11 +303224,11 @@ var GlobTool = class _GlobTool extends BaseDeclarativeTool {
|
|
|
303120
303224
|
};
|
|
303121
303225
|
|
|
303122
303226
|
// packages/core/src/tools/activate-skill.ts
|
|
303123
|
-
import * as
|
|
303227
|
+
import * as path54 from "node:path";
|
|
303124
303228
|
|
|
303125
303229
|
// packages/core/src/utils/getFolderStructure.ts
|
|
303126
303230
|
import * as fs40 from "node:fs/promises";
|
|
303127
|
-
import * as
|
|
303231
|
+
import * as path53 from "node:path";
|
|
303128
303232
|
var MAX_ITEMS = 200;
|
|
303129
303233
|
var TRUNCATION_INDICATOR = "...";
|
|
303130
303234
|
var DEFAULT_IGNORED_FOLDERS = /* @__PURE__ */ new Set([
|
|
@@ -303134,7 +303238,7 @@ var DEFAULT_IGNORED_FOLDERS = /* @__PURE__ */ new Set([
|
|
|
303134
303238
|
"__pycache__"
|
|
303135
303239
|
]);
|
|
303136
303240
|
async function readFullStructure(rootPath, options) {
|
|
303137
|
-
const rootName =
|
|
303241
|
+
const rootName = path53.basename(rootPath);
|
|
303138
303242
|
const rootNode = {
|
|
303139
303243
|
name: rootName,
|
|
303140
303244
|
path: rootPath,
|
|
@@ -303186,7 +303290,7 @@ async function readFullStructure(rootPath, options) {
|
|
|
303186
303290
|
break;
|
|
303187
303291
|
}
|
|
303188
303292
|
const fileName = entry.name;
|
|
303189
|
-
const filePath =
|
|
303293
|
+
const filePath = path53.join(currentPath, fileName);
|
|
303190
303294
|
if (options.fileService?.shouldIgnoreFile(filePath, filterFileOptions)) {
|
|
303191
303295
|
continue;
|
|
303192
303296
|
}
|
|
@@ -303206,7 +303310,7 @@ async function readFullStructure(rootPath, options) {
|
|
|
303206
303310
|
break;
|
|
303207
303311
|
}
|
|
303208
303312
|
const subFolderName = entry.name;
|
|
303209
|
-
const subFolderPath =
|
|
303313
|
+
const subFolderPath = path53.join(currentPath, subFolderName);
|
|
303210
303314
|
const isIgnored = options.fileService?.shouldIgnoreDirectory(
|
|
303211
303315
|
subFolderPath,
|
|
303212
303316
|
filterFileOptions
|
|
@@ -303248,7 +303352,7 @@ function formatStructure(node, currentIndent, isLastChildOfParent, isProcessingR
|
|
|
303248
303352
|
const connector = isLastChildOfParent ? "\u2514\u2500\u2500\u2500" : "\u251C\u2500\u2500\u2500";
|
|
303249
303353
|
if (!isProcessingRootNode || node.isIgnored) {
|
|
303250
303354
|
builder.push(
|
|
303251
|
-
`${currentIndent}${connector}${node.name}${
|
|
303355
|
+
`${currentIndent}${connector}${node.name}${path53.sep}${node.isIgnored ? TRUNCATION_INDICATOR : ""}`
|
|
303252
303356
|
);
|
|
303253
303357
|
}
|
|
303254
303358
|
const indentForChildren = isProcessingRootNode ? "" : currentIndent + (isLastChildOfParent ? " " : "\u2502 ");
|
|
@@ -303279,7 +303383,7 @@ function formatStructure(node, currentIndent, isLastChildOfParent, isProcessingR
|
|
|
303279
303383
|
}
|
|
303280
303384
|
}
|
|
303281
303385
|
async function getFolderStructure(directory, options) {
|
|
303282
|
-
const resolvedPath =
|
|
303386
|
+
const resolvedPath = path53.resolve(directory);
|
|
303283
303387
|
const mergedOptions = {
|
|
303284
303388
|
maxItems: options?.maxItems ?? MAX_ITEMS,
|
|
303285
303389
|
ignoredFolders: options?.ignoredFolders ?? DEFAULT_IGNORED_FOLDERS,
|
|
@@ -303312,7 +303416,7 @@ async function getFolderStructure(directory, options) {
|
|
|
303312
303416
|
}
|
|
303313
303417
|
return `${summary}
|
|
303314
303418
|
|
|
303315
|
-
${resolvedPath}${
|
|
303419
|
+
${resolvedPath}${path53.sep}
|
|
303316
303420
|
${structureLines.join("\n")}`;
|
|
303317
303421
|
} catch (error40) {
|
|
303318
303422
|
debugLogger.warn(
|
|
@@ -303341,7 +303445,7 @@ var ActivateSkillToolInvocation = class extends BaseToolInvocation {
|
|
|
303341
303445
|
async getOrFetchFolderStructure(skillLocation) {
|
|
303342
303446
|
if (this.cachedFolderStructure === void 0) {
|
|
303343
303447
|
this.cachedFolderStructure = await getFolderStructure(
|
|
303344
|
-
|
|
303448
|
+
path54.dirname(skillLocation)
|
|
303345
303449
|
);
|
|
303346
303450
|
}
|
|
303347
303451
|
return this.cachedFolderStructure;
|
|
@@ -303395,7 +303499,7 @@ ${folderStructure}`,
|
|
|
303395
303499
|
};
|
|
303396
303500
|
}
|
|
303397
303501
|
skillManager.activateSkill(skillName);
|
|
303398
|
-
this.config.getWorkspaceContext().addDirectory(
|
|
303502
|
+
this.config.getWorkspaceContext().addDirectory(path54.dirname(skill.location));
|
|
303399
303503
|
const folderStructure = await this.getOrFetchFolderStructure(
|
|
303400
303504
|
skill.location
|
|
303401
303505
|
);
|
|
@@ -303409,7 +303513,7 @@ ${folderStructure}`,
|
|
|
303409
303513
|
${folderStructure}
|
|
303410
303514
|
</available_resources>
|
|
303411
303515
|
</activated_skill>`,
|
|
303412
|
-
returnDisplay: `Skill **${skillName}** activated. Resources loaded from \`${
|
|
303516
|
+
returnDisplay: `Skill **${skillName}** activated. Resources loaded from \`${path54.dirname(skill.location)}\`:
|
|
303413
303517
|
|
|
303414
303518
|
${folderStructure}`
|
|
303415
303519
|
};
|
|
@@ -303455,7 +303559,7 @@ var ActivateSkillTool = class _ActivateSkillTool extends BaseDeclarativeTool {
|
|
|
303455
303559
|
// packages/core/src/tools/shell.ts
|
|
303456
303560
|
import fsPromises10 from "node:fs/promises";
|
|
303457
303561
|
import fs43 from "node:fs";
|
|
303458
|
-
import
|
|
303562
|
+
import path57 from "node:path";
|
|
303459
303563
|
import os28 from "node:os";
|
|
303460
303564
|
import crypto15 from "node:crypto";
|
|
303461
303565
|
|
|
@@ -303540,7 +303644,7 @@ import { spawn as cpSpawn } from "node:child_process";
|
|
|
303540
303644
|
import { TextDecoder as TextDecoder2 } from "node:util";
|
|
303541
303645
|
import os26 from "node:os";
|
|
303542
303646
|
import fs41, { mkdirSync as mkdirSync3 } from "node:fs";
|
|
303543
|
-
import
|
|
303647
|
+
import path55 from "node:path";
|
|
303544
303648
|
|
|
303545
303649
|
// packages/core/src/utils/systemEncoding.ts
|
|
303546
303650
|
var import_chardet = __toESM(require_lib10(), 1);
|
|
@@ -304618,7 +304722,7 @@ var ShellExecutionService = class _ShellExecutionService {
|
|
|
304618
304722
|
static backgroundLogStreams = /* @__PURE__ */ new Map();
|
|
304619
304723
|
static backgroundProcessHistory = /* @__PURE__ */ new Map();
|
|
304620
304724
|
static getLogDir() {
|
|
304621
|
-
return
|
|
304725
|
+
return path55.join(Storage.getGlobalTempDir(), "background-processes");
|
|
304622
304726
|
}
|
|
304623
304727
|
static formatShellBackgroundCompletion(pid, behavior, output, error40) {
|
|
304624
304728
|
const logPath = _ShellExecutionService.getLogFilePath(pid);
|
|
@@ -304632,7 +304736,7 @@ ${truncated}`;
|
|
|
304632
304736
|
return `[Background command completed ${status2}. Output saved to ${logPath}]`;
|
|
304633
304737
|
}
|
|
304634
304738
|
static getLogFilePath(pid) {
|
|
304635
|
-
return
|
|
304739
|
+
return path55.join(this.getLogDir(), `background-${pid}.log`);
|
|
304636
304740
|
}
|
|
304637
304741
|
static syncBackgroundLog(pid, content) {
|
|
304638
304742
|
if (!this.backgroundLogPids.has(pid)) return;
|
|
@@ -305635,7 +305739,7 @@ ${truncated}`;
|
|
|
305635
305739
|
|
|
305636
305740
|
// packages/core/src/sandbox/utils/proactivePermissions.ts
|
|
305637
305741
|
import os27 from "node:os";
|
|
305638
|
-
import
|
|
305742
|
+
import path56 from "node:path";
|
|
305639
305743
|
import fs42 from "node:fs";
|
|
305640
305744
|
var NETWORK_RELIANT_TOOLS = /* @__PURE__ */ new Set([
|
|
305641
305745
|
"npm",
|
|
@@ -305686,42 +305790,42 @@ async function getProactiveToolSuggestions(commandName) {
|
|
|
305686
305790
|
const primaryCachePaths = [];
|
|
305687
305791
|
const optionalCachePaths = [];
|
|
305688
305792
|
if (normalizedCommand === "npm" || normalizedCommand === "npx") {
|
|
305689
|
-
readOnlyPaths.push(
|
|
305690
|
-
primaryCachePaths.push(
|
|
305691
|
-
optionalCachePaths.push(
|
|
305692
|
-
optionalCachePaths.push(
|
|
305793
|
+
readOnlyPaths.push(path56.join(home, ".npmrc"));
|
|
305794
|
+
primaryCachePaths.push(path56.join(home, ".npm"));
|
|
305795
|
+
optionalCachePaths.push(path56.join(home, ".node-gyp"));
|
|
305796
|
+
optionalCachePaths.push(path56.join(home, ".cache"));
|
|
305693
305797
|
} else if (normalizedCommand === "yarn") {
|
|
305694
|
-
readOnlyPaths.push(
|
|
305695
|
-
readOnlyPaths.push(
|
|
305696
|
-
primaryCachePaths.push(
|
|
305697
|
-
primaryCachePaths.push(
|
|
305698
|
-
optionalCachePaths.push(
|
|
305798
|
+
readOnlyPaths.push(path56.join(home, ".yarnrc"));
|
|
305799
|
+
readOnlyPaths.push(path56.join(home, ".yarnrc.yml"));
|
|
305800
|
+
primaryCachePaths.push(path56.join(home, ".yarn"));
|
|
305801
|
+
primaryCachePaths.push(path56.join(home, ".config", "yarn"));
|
|
305802
|
+
optionalCachePaths.push(path56.join(home, ".cache"));
|
|
305699
305803
|
} else if (normalizedCommand === "pnpm") {
|
|
305700
|
-
readOnlyPaths.push(
|
|
305701
|
-
primaryCachePaths.push(
|
|
305702
|
-
primaryCachePaths.push(
|
|
305703
|
-
optionalCachePaths.push(
|
|
305804
|
+
readOnlyPaths.push(path56.join(home, ".npmrc"));
|
|
305805
|
+
primaryCachePaths.push(path56.join(home, ".pnpm-store"));
|
|
305806
|
+
primaryCachePaths.push(path56.join(home, ".config", "pnpm"));
|
|
305807
|
+
optionalCachePaths.push(path56.join(home, ".cache"));
|
|
305704
305808
|
} else if (normalizedCommand === "bun") {
|
|
305705
|
-
readOnlyPaths.push(
|
|
305706
|
-
primaryCachePaths.push(
|
|
305707
|
-
optionalCachePaths.push(
|
|
305809
|
+
readOnlyPaths.push(path56.join(home, ".bunfig.toml"));
|
|
305810
|
+
primaryCachePaths.push(path56.join(home, ".bun"));
|
|
305811
|
+
optionalCachePaths.push(path56.join(home, ".cache"));
|
|
305708
305812
|
} else if (normalizedCommand === "git") {
|
|
305709
|
-
readOnlyPaths.push(
|
|
305710
|
-
readOnlyPaths.push(
|
|
305711
|
-
optionalCachePaths.push(
|
|
305813
|
+
readOnlyPaths.push(path56.join(home, ".ssh"));
|
|
305814
|
+
readOnlyPaths.push(path56.join(home, ".gitconfig"));
|
|
305815
|
+
optionalCachePaths.push(path56.join(home, ".cache"));
|
|
305712
305816
|
} else if (normalizedCommand === "ssh" || normalizedCommand === "scp" || normalizedCommand === "sftp") {
|
|
305713
|
-
readOnlyPaths.push(
|
|
305817
|
+
readOnlyPaths.push(path56.join(home, ".ssh"));
|
|
305714
305818
|
}
|
|
305715
305819
|
if (os27.platform() === "win32") {
|
|
305716
305820
|
const appData = process.env["AppData"];
|
|
305717
305821
|
const localAppData = process.env["LocalAppData"];
|
|
305718
305822
|
if (normalizedCommand === "npm" || normalizedCommand === "npx") {
|
|
305719
305823
|
if (appData) {
|
|
305720
|
-
primaryCachePaths.push(
|
|
305721
|
-
optionalCachePaths.push(
|
|
305824
|
+
primaryCachePaths.push(path56.join(appData, "npm"));
|
|
305825
|
+
optionalCachePaths.push(path56.join(appData, "npm-cache"));
|
|
305722
305826
|
}
|
|
305723
305827
|
if (localAppData) {
|
|
305724
|
-
optionalCachePaths.push(
|
|
305828
|
+
optionalCachePaths.push(path56.join(localAppData, "npm-cache"));
|
|
305725
305829
|
}
|
|
305726
305830
|
}
|
|
305727
305831
|
}
|
|
@@ -305832,7 +305936,7 @@ ${trimmed2}
|
|
|
305832
305936
|
}
|
|
305833
305937
|
const parentCounts = /* @__PURE__ */ new Map();
|
|
305834
305938
|
for (const p of nonRedundant) {
|
|
305835
|
-
const parent =
|
|
305939
|
+
const parent = path57.dirname(p);
|
|
305836
305940
|
if (!parentCounts.has(parent)) {
|
|
305837
305941
|
parentCounts.set(parent, []);
|
|
305838
305942
|
}
|
|
@@ -305841,23 +305945,23 @@ ${trimmed2}
|
|
|
305841
305945
|
const finalPaths = /* @__PURE__ */ new Set();
|
|
305842
305946
|
const sensitiveDirs = /* @__PURE__ */ new Set([
|
|
305843
305947
|
os28.homedir(),
|
|
305844
|
-
|
|
305845
|
-
|
|
305846
|
-
|
|
305847
|
-
|
|
305848
|
-
|
|
305849
|
-
|
|
305850
|
-
|
|
305851
|
-
|
|
305852
|
-
|
|
305853
|
-
|
|
305854
|
-
|
|
305948
|
+
path57.dirname(os28.homedir()),
|
|
305949
|
+
path57.sep,
|
|
305950
|
+
path57.join(path57.sep, "etc"),
|
|
305951
|
+
path57.join(path57.sep, "usr"),
|
|
305952
|
+
path57.join(path57.sep, "var"),
|
|
305953
|
+
path57.join(path57.sep, "bin"),
|
|
305954
|
+
path57.join(path57.sep, "sbin"),
|
|
305955
|
+
path57.join(path57.sep, "lib"),
|
|
305956
|
+
path57.join(path57.sep, "root"),
|
|
305957
|
+
path57.join(path57.sep, "home"),
|
|
305958
|
+
path57.join(path57.sep, "Users")
|
|
305855
305959
|
]);
|
|
305856
305960
|
if (os28.platform() === "win32") {
|
|
305857
305961
|
const systemRoot = process.env["SystemRoot"];
|
|
305858
305962
|
if (systemRoot) {
|
|
305859
305963
|
sensitiveDirs.add(systemRoot);
|
|
305860
|
-
sensitiveDirs.add(
|
|
305964
|
+
sensitiveDirs.add(path57.join(systemRoot, "System32"));
|
|
305861
305965
|
}
|
|
305862
305966
|
const programFiles = process.env["ProgramFiles"];
|
|
305863
305967
|
if (programFiles) sensitiveDirs.add(programFiles);
|
|
@@ -306046,7 +306150,7 @@ ${trimmed2}
|
|
|
306046
306150
|
}
|
|
306047
306151
|
const isWindows2 = os28.platform() === "win32";
|
|
306048
306152
|
const tempFileName = `shell_pgrep_${crypto15.randomBytes(6).toString("hex")}.tmp`;
|
|
306049
|
-
const tempFilePath =
|
|
306153
|
+
const tempFilePath = path57.join(os28.tmpdir(), tempFileName);
|
|
306050
306154
|
const timeoutMs = this.context.config.getShellToolInactivityTimeout();
|
|
306051
306155
|
const timeoutController = new AbortController();
|
|
306052
306156
|
let timeoutTimer;
|
|
@@ -306058,7 +306162,7 @@ ${trimmed2}
|
|
|
306058
306162
|
tempFilePath,
|
|
306059
306163
|
isWindows2
|
|
306060
306164
|
);
|
|
306061
|
-
const cwd = this.params.dir_path ?
|
|
306165
|
+
const cwd = this.params.dir_path ? path57.resolve(this.context.config.getTargetDir(), this.params.dir_path) : this.context.config.getTargetDir();
|
|
306062
306166
|
const validationError = this.context.config.validatePathAccess(cwd);
|
|
306063
306167
|
if (validationError) {
|
|
306064
306168
|
return {
|
|
@@ -306324,11 +306428,11 @@ ${result2.output}`;
|
|
|
306324
306428
|
try {
|
|
306325
306429
|
let currentPath = p;
|
|
306326
306430
|
if (currentPath.startsWith("~")) {
|
|
306327
|
-
currentPath =
|
|
306431
|
+
currentPath = path57.join(os28.homedir(), currentPath.slice(1));
|
|
306328
306432
|
}
|
|
306329
306433
|
try {
|
|
306330
306434
|
if (fs43.existsSync(currentPath) && fs43.statSync(currentPath).isFile()) {
|
|
306331
|
-
currentPath =
|
|
306435
|
+
currentPath = path57.dirname(currentPath);
|
|
306332
306436
|
}
|
|
306333
306437
|
} catch {
|
|
306334
306438
|
}
|
|
@@ -306345,7 +306449,7 @@ ${result2.output}`;
|
|
|
306345
306449
|
}
|
|
306346
306450
|
break;
|
|
306347
306451
|
}
|
|
306348
|
-
currentPath =
|
|
306452
|
+
currentPath = path57.dirname(currentPath);
|
|
306349
306453
|
}
|
|
306350
306454
|
} catch {
|
|
306351
306455
|
}
|
|
@@ -306453,7 +306557,7 @@ var ShellTool = class _ShellTool extends BaseDeclarativeTool {
|
|
|
306453
306557
|
return "Command cannot be empty.";
|
|
306454
306558
|
}
|
|
306455
306559
|
if (params.dir_path) {
|
|
306456
|
-
const resolvedPath =
|
|
306560
|
+
const resolvedPath = path57.resolve(
|
|
306457
306561
|
this.context.config.getTargetDir(),
|
|
306458
306562
|
params.dir_path
|
|
306459
306563
|
);
|
|
@@ -307202,8 +307306,8 @@ function many(p) {
|
|
|
307202
307306
|
function many1(p) {
|
|
307203
307307
|
return ab(p, many(p), (head, tail) => [head, ...tail]);
|
|
307204
307308
|
}
|
|
307205
|
-
function ab(pa, pb,
|
|
307206
|
-
return (data, i3) => mapOuter(pa(data, i3), (ma) => mapInner(pb(data, ma.position), (vb, j) =>
|
|
307309
|
+
function ab(pa, pb, join32) {
|
|
307310
|
+
return (data, i3) => mapOuter(pa(data, i3), (ma) => mapInner(pb(data, ma.position), (vb, j) => join32(ma.value, vb, data, i3, j)));
|
|
307207
307311
|
}
|
|
307208
307312
|
function left(pa, pb) {
|
|
307209
307313
|
return ab(pa, pb, (va) => va);
|
|
@@ -307211,8 +307315,8 @@ function left(pa, pb) {
|
|
|
307211
307315
|
function right(pa, pb) {
|
|
307212
307316
|
return ab(pa, pb, (va, vb) => vb);
|
|
307213
307317
|
}
|
|
307214
|
-
function abc(pa, pb, pc,
|
|
307215
|
-
return (data, i3) => mapOuter(pa(data, i3), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) =>
|
|
307318
|
+
function abc(pa, pb, pc, join32) {
|
|
307319
|
+
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))));
|
|
307216
307320
|
}
|
|
307217
307321
|
function middle(pa, pb, pc) {
|
|
307218
307322
|
return abc(pa, pb, pc, (ra, rb) => rb);
|
|
@@ -313629,7 +313733,7 @@ function tokenLimit(model) {
|
|
|
313629
313733
|
|
|
313630
313734
|
// packages/core/src/prompts/promptProvider.ts
|
|
313631
313735
|
import fs44 from "node:fs";
|
|
313632
|
-
import
|
|
313736
|
+
import path59 from "node:path";
|
|
313633
313737
|
import process24 from "node:process";
|
|
313634
313738
|
|
|
313635
313739
|
// packages/core/src/prompts/snippets.ts
|
|
@@ -314950,7 +315054,7 @@ The structure MUST be as follows:
|
|
|
314950
315054
|
}
|
|
314951
315055
|
|
|
314952
315056
|
// packages/core/src/prompts/utils.ts
|
|
314953
|
-
import
|
|
315057
|
+
import path58 from "node:path";
|
|
314954
315058
|
import process23 from "node:process";
|
|
314955
315059
|
function resolvePathFromEnv(envVar) {
|
|
314956
315060
|
const trimmedEnvVar = envVar?.trim();
|
|
@@ -314969,7 +315073,7 @@ function resolvePathFromEnv(envVar) {
|
|
|
314969
315073
|
if (customPath === "~") {
|
|
314970
315074
|
customPath = home;
|
|
314971
315075
|
} else {
|
|
314972
|
-
customPath =
|
|
315076
|
+
customPath = path58.join(home, customPath.slice(2));
|
|
314973
315077
|
}
|
|
314974
315078
|
} catch (error40) {
|
|
314975
315079
|
debugLogger.warn(
|
|
@@ -314981,7 +315085,7 @@ function resolvePathFromEnv(envVar) {
|
|
|
314981
315085
|
}
|
|
314982
315086
|
return {
|
|
314983
315087
|
isSwitch: false,
|
|
314984
|
-
value:
|
|
315088
|
+
value: path58.resolve(customPath),
|
|
314985
315089
|
isDisabled: false
|
|
314986
315090
|
};
|
|
314987
315091
|
}
|
|
@@ -315198,7 +315302,7 @@ var PromptProvider = class {
|
|
|
315198
315302
|
}
|
|
315199
315303
|
let basePrompt;
|
|
315200
315304
|
if (systemMdResolution.value && !systemMdResolution.isDisabled) {
|
|
315201
|
-
let systemMdPath =
|
|
315305
|
+
let systemMdPath = path59.resolve(path59.join(GEMINI_DIR, "system.md"));
|
|
315202
315306
|
if (!systemMdResolution.isSwitch) {
|
|
315203
315307
|
systemMdPath = systemMdResolution.value;
|
|
315204
315308
|
}
|
|
@@ -315276,8 +315380,17 @@ var PromptProvider = class {
|
|
|
315276
315380
|
() => ({
|
|
315277
315381
|
interactive: interactiveMode,
|
|
315278
315382
|
planModeToolsList,
|
|
315279
|
-
plansDir:
|
|
315280
|
-
|
|
315383
|
+
plansDir: makeRelative(
|
|
315384
|
+
context2.config.storage.getPlansDir(),
|
|
315385
|
+
context2.config.getProjectRoot()
|
|
315386
|
+
).replaceAll("\\", "/"),
|
|
315387
|
+
approvedPlanPath: (() => {
|
|
315388
|
+
const approvedPath = context2.config.getApprovedPlanPath();
|
|
315389
|
+
return approvedPath ? makeRelative(
|
|
315390
|
+
approvedPath,
|
|
315391
|
+
context2.config.getProjectRoot()
|
|
315392
|
+
).replaceAll("\\", "/") : void 0;
|
|
315393
|
+
})()
|
|
315281
315394
|
}),
|
|
315282
315395
|
isPlanMode
|
|
315283
315396
|
),
|
|
@@ -315330,7 +315443,7 @@ var PromptProvider = class {
|
|
|
315330
315443
|
this.maybeWriteSystemMd(
|
|
315331
315444
|
sanitizedPrompt,
|
|
315332
315445
|
systemMdResolution,
|
|
315333
|
-
|
|
315446
|
+
path59.resolve(path59.join(GEMINI_DIR, "system.md"))
|
|
315334
315447
|
);
|
|
315335
315448
|
return sanitizedPrompt;
|
|
315336
315449
|
}
|
|
@@ -315358,7 +315471,7 @@ var PromptProvider = class {
|
|
|
315358
315471
|
);
|
|
315359
315472
|
if (writeSystemMdResolution.value && !writeSystemMdResolution.isDisabled) {
|
|
315360
315473
|
const writePath = writeSystemMdResolution.isSwitch ? defaultPath : writeSystemMdResolution.value;
|
|
315361
|
-
fs44.mkdirSync(
|
|
315474
|
+
fs44.mkdirSync(path59.dirname(writePath), { recursive: true });
|
|
315362
315475
|
fs44.writeFileSync(writePath, basePrompt);
|
|
315363
315476
|
}
|
|
315364
315477
|
}
|
|
@@ -318861,12 +318974,12 @@ var safeDump = renamed("safeDump", "dump");
|
|
|
318861
318974
|
|
|
318862
318975
|
// packages/core/src/agents/agentLoader.ts
|
|
318863
318976
|
import * as fs46 from "node:fs/promises";
|
|
318864
|
-
import * as
|
|
318977
|
+
import * as path61 from "node:path";
|
|
318865
318978
|
import * as crypto16 from "node:crypto";
|
|
318866
318979
|
|
|
318867
318980
|
// packages/core/src/skills/skillLoader.ts
|
|
318868
318981
|
import * as fs45 from "node:fs/promises";
|
|
318869
|
-
import * as
|
|
318982
|
+
import * as path60 from "node:path";
|
|
318870
318983
|
var FRONTMATTER_REGEX = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n([\s\S]*))?/;
|
|
318871
318984
|
function parseFrontmatter(content) {
|
|
318872
318985
|
try {
|
|
@@ -318920,7 +319033,7 @@ function parseSimpleFrontmatter(content) {
|
|
|
318920
319033
|
async function loadSkillsFromDir(dir) {
|
|
318921
319034
|
const discoveredSkills = [];
|
|
318922
319035
|
try {
|
|
318923
|
-
const absoluteSearchPath =
|
|
319036
|
+
const absoluteSearchPath = path60.resolve(dir);
|
|
318924
319037
|
const stats = await fs45.stat(absoluteSearchPath).catch(() => null);
|
|
318925
319038
|
if (!stats || !stats.isDirectory()) {
|
|
318926
319039
|
return [];
|
|
@@ -319438,7 +319551,7 @@ async function loadAgentsFromDirectory(dir) {
|
|
|
319438
319551
|
(entry) => entry.isFile() && !entry.name.startsWith("_") && entry.name.endsWith(".md")
|
|
319439
319552
|
);
|
|
319440
319553
|
for (const entry of files) {
|
|
319441
|
-
const filePath =
|
|
319554
|
+
const filePath = path61.join(dir, entry.name);
|
|
319442
319555
|
try {
|
|
319443
319556
|
const content = await fs46.readFile(filePath, "utf-8");
|
|
319444
319557
|
const hash = crypto16.createHash("sha256").update(content).digest("hex");
|
|
@@ -319465,16 +319578,16 @@ async function loadAgentsFromDirectory(dir) {
|
|
|
319465
319578
|
|
|
319466
319579
|
// packages/core/src/tools/get-internal-docs.ts
|
|
319467
319580
|
import fs47 from "node:fs/promises";
|
|
319468
|
-
import
|
|
319581
|
+
import path62 from "node:path";
|
|
319469
319582
|
import { fileURLToPath as fileURLToPath14 } from "node:url";
|
|
319470
319583
|
async function getDocsRoot() {
|
|
319471
319584
|
const currentFile = fileURLToPath14(import.meta.url);
|
|
319472
|
-
let searchDir =
|
|
319585
|
+
let searchDir = path62.dirname(currentFile);
|
|
319473
319586
|
const isDocsDir = async (dir) => {
|
|
319474
319587
|
try {
|
|
319475
319588
|
const stats = await fs47.stat(dir);
|
|
319476
319589
|
if (stats.isDirectory()) {
|
|
319477
|
-
const marker =
|
|
319590
|
+
const marker = path62.join(dir, "sidebar.json");
|
|
319478
319591
|
await fs47.access(marker);
|
|
319479
319592
|
return true;
|
|
319480
319593
|
}
|
|
@@ -319483,11 +319596,11 @@ async function getDocsRoot() {
|
|
|
319483
319596
|
return false;
|
|
319484
319597
|
};
|
|
319485
319598
|
while (true) {
|
|
319486
|
-
const candidate =
|
|
319599
|
+
const candidate = path62.join(searchDir, "docs");
|
|
319487
319600
|
if (await isDocsDir(candidate)) {
|
|
319488
319601
|
return candidate;
|
|
319489
319602
|
}
|
|
319490
|
-
const parent =
|
|
319603
|
+
const parent = path62.dirname(searchDir);
|
|
319491
319604
|
if (parent === searchDir) {
|
|
319492
319605
|
break;
|
|
319493
319606
|
}
|
|
@@ -319523,7 +319636,7 @@ ${fileList}`;
|
|
|
319523
319636
|
returnDisplay: `Found ${files.length} documentation files.`
|
|
319524
319637
|
};
|
|
319525
319638
|
}
|
|
319526
|
-
const resolvedPath =
|
|
319639
|
+
const resolvedPath = path62.resolve(docsRoot, this.params.path);
|
|
319527
319640
|
if (!resolvedPath.startsWith(docsRoot)) {
|
|
319528
319641
|
throw new Error(
|
|
319529
319642
|
"Access denied: Requested path is outside the documentation directory."
|
|
@@ -320677,7 +320790,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
|
|
|
320677
320790
|
return provider;
|
|
320678
320791
|
}
|
|
320679
320792
|
case "oauth2": {
|
|
320680
|
-
const { OAuth2AuthProvider } = await import("./oauth2-provider-
|
|
320793
|
+
const { OAuth2AuthProvider } = await import("./oauth2-provider-YKYTKUWD.js");
|
|
320681
320794
|
const provider = new OAuth2AuthProvider(
|
|
320682
320795
|
authConfig,
|
|
320683
320796
|
options.agentName ?? "unknown",
|
|
@@ -323804,7 +323917,7 @@ ${summary}
|
|
|
323804
323917
|
};
|
|
323805
323918
|
|
|
323806
323919
|
// packages/core/src/context/toolOutputMaskingService.ts
|
|
323807
|
-
import
|
|
323920
|
+
import path63 from "node:path";
|
|
323808
323921
|
import * as fsPromises11 from "node:fs/promises";
|
|
323809
323922
|
var DEFAULT_TOOL_PROTECTION_THRESHOLD = 5e4;
|
|
323810
323923
|
var DEFAULT_MIN_PRUNABLE_TOKENS_THRESHOLD = 3e4;
|
|
@@ -323878,14 +323991,14 @@ var ToolOutputMaskingService = class {
|
|
|
323878
323991
|
);
|
|
323879
323992
|
const newHistory = [...history];
|
|
323880
323993
|
let actualTokensSaved = 0;
|
|
323881
|
-
let toolOutputsDir =
|
|
323994
|
+
let toolOutputsDir = path63.join(
|
|
323882
323995
|
config2.storage.getProjectTempDir(),
|
|
323883
323996
|
TOOL_OUTPUTS_DIR3
|
|
323884
323997
|
);
|
|
323885
323998
|
const sessionId = config2.getSessionId();
|
|
323886
323999
|
if (sessionId) {
|
|
323887
324000
|
const safeSessionId = sanitizeFilenamePart(sessionId);
|
|
323888
|
-
toolOutputsDir =
|
|
324001
|
+
toolOutputsDir = path63.join(toolOutputsDir, `session-${safeSessionId}`);
|
|
323889
324002
|
}
|
|
323890
324003
|
await fsPromises11.mkdir(toolOutputsDir, { recursive: true });
|
|
323891
324004
|
for (const item of prunableParts) {
|
|
@@ -323898,7 +324011,7 @@ var ToolOutputMaskingService = class {
|
|
|
323898
324011
|
const safeToolName = sanitizeFilenamePart(toolName).toLowerCase();
|
|
323899
324012
|
const safeCallId = sanitizeFilenamePart(callId).toLowerCase();
|
|
323900
324013
|
const fileName = `${safeToolName}_${safeCallId}_${Math.random().toString(36).substring(7)}.txt`;
|
|
323901
|
-
const filePath =
|
|
324014
|
+
const filePath = path63.join(toolOutputsDir, fileName);
|
|
323902
324015
|
await fsPromises11.writeFile(filePath, content, "utf-8");
|
|
323903
324016
|
const originalResponse = (
|
|
323904
324017
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
@@ -326438,11 +326551,11 @@ ${wrapInput(safeInput)}`;
|
|
|
326438
326551
|
|
|
326439
326552
|
// packages/core/src/config/scoped-config.ts
|
|
326440
326553
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
|
|
326441
|
-
import * as
|
|
326554
|
+
import * as path65 from "node:path";
|
|
326442
326555
|
|
|
326443
326556
|
// packages/core/src/utils/workspaceContext.ts
|
|
326444
326557
|
import * as fs48 from "node:fs";
|
|
326445
|
-
import * as
|
|
326558
|
+
import * as path64 from "node:path";
|
|
326446
326559
|
var WorkspaceContext = class {
|
|
326447
326560
|
/**
|
|
326448
326561
|
* Creates a new WorkspaceContext with the given initial directory and optional additional directories.
|
|
@@ -326532,14 +326645,14 @@ var WorkspaceContext = class {
|
|
|
326532
326645
|
if (!fs48.existsSync(pathToAdd)) {
|
|
326533
326646
|
return;
|
|
326534
326647
|
}
|
|
326535
|
-
const resolved = fs48.realpathSync(
|
|
326648
|
+
const resolved = fs48.realpathSync(path64.resolve(this.targetDir, pathToAdd));
|
|
326536
326649
|
this.readOnlyPaths.add(resolved);
|
|
326537
326650
|
} catch (e2) {
|
|
326538
326651
|
debugLogger.warn(`Failed to add read-only path ${pathToAdd}:`, e2);
|
|
326539
326652
|
}
|
|
326540
326653
|
}
|
|
326541
326654
|
resolveAndValidateDir(directory) {
|
|
326542
|
-
const absolutePath =
|
|
326655
|
+
const absolutePath = path64.resolve(this.targetDir, directory);
|
|
326543
326656
|
if (!fs48.existsSync(absolutePath)) {
|
|
326544
326657
|
throw new Error(`Directory does not exist: ${absolutePath}`);
|
|
326545
326658
|
}
|
|
@@ -326615,7 +326728,7 @@ var WorkspaceContext = class {
|
|
|
326615
326728
|
* if it did exist.
|
|
326616
326729
|
*/
|
|
326617
326730
|
fullyResolvedPath(pathToCheck) {
|
|
326618
|
-
return resolveToRealPath(
|
|
326731
|
+
return resolveToRealPath(path64.resolve(this.targetDir, pathToCheck));
|
|
326619
326732
|
}
|
|
326620
326733
|
/**
|
|
326621
326734
|
* Checks if a path is within a given root directory.
|
|
@@ -326624,8 +326737,8 @@ var WorkspaceContext = class {
|
|
|
326624
326737
|
* @returns True if the path is within the root directory, false otherwise
|
|
326625
326738
|
*/
|
|
326626
326739
|
isPathWithinRoot(pathToCheck, rootDirectory) {
|
|
326627
|
-
const relative8 =
|
|
326628
|
-
return !relative8.startsWith(`..${
|
|
326740
|
+
const relative8 = path64.relative(rootDirectory, pathToCheck);
|
|
326741
|
+
return !relative8.startsWith(`..${path64.sep}`) && relative8 !== ".." && !path64.isAbsolute(relative8);
|
|
326629
326742
|
}
|
|
326630
326743
|
};
|
|
326631
326744
|
|
|
@@ -326648,7 +326761,7 @@ function createScopedWorkspaceContext(parentContext, additionalDirectories) {
|
|
|
326648
326761
|
);
|
|
326649
326762
|
}
|
|
326650
326763
|
for (const dir of additionalDirectories) {
|
|
326651
|
-
if (
|
|
326764
|
+
if (path65.resolve(dir) === path65.parse(path65.resolve(dir)).root) {
|
|
326652
326765
|
throw new Error(
|
|
326653
326766
|
`Cannot add filesystem root "${dir}" as a workspace directory`
|
|
326654
326767
|
);
|
|
@@ -328399,6 +328512,7 @@ var A2AResultReassembler = class {
|
|
|
328399
328512
|
}
|
|
328400
328513
|
pushMessage(message) {
|
|
328401
328514
|
if (!message) return;
|
|
328515
|
+
if (message.role === "user") return;
|
|
328402
328516
|
const text = extractPartsText(message.parts, "");
|
|
328403
328517
|
if (text && this.messageLog[this.messageLog.length - 1] !== text) {
|
|
328404
328518
|
this.messageLog.push(text);
|
|
@@ -328409,19 +328523,32 @@ var A2AResultReassembler = class {
|
|
|
328409
328523
|
*/
|
|
328410
328524
|
toActivityItems() {
|
|
328411
328525
|
const isAuthRequired = this.messageLog.includes(AUTH_REQUIRED_MSG);
|
|
328412
|
-
|
|
328413
|
-
|
|
328526
|
+
const items = [];
|
|
328527
|
+
if (isAuthRequired) {
|
|
328528
|
+
items.push({
|
|
328414
328529
|
id: "auth-required",
|
|
328415
328530
|
type: "thought",
|
|
328416
328531
|
content: AUTH_REQUIRED_MSG,
|
|
328417
328532
|
status: "running"
|
|
328418
|
-
}
|
|
328533
|
+
});
|
|
328534
|
+
}
|
|
328535
|
+
this.messageLog.forEach((msg, index) => {
|
|
328536
|
+
items.push({
|
|
328537
|
+
id: `msg-${index}`,
|
|
328538
|
+
type: "thought",
|
|
328539
|
+
content: msg.trim(),
|
|
328540
|
+
status: "completed"
|
|
328541
|
+
});
|
|
328542
|
+
});
|
|
328543
|
+
if (items.length === 0 && !isAuthRequired) {
|
|
328544
|
+
items.push({
|
|
328419
328545
|
id: "pending",
|
|
328420
328546
|
type: "thought",
|
|
328421
328547
|
content: "Working...",
|
|
328422
328548
|
status: "running"
|
|
328423
|
-
}
|
|
328424
|
-
|
|
328549
|
+
});
|
|
328550
|
+
}
|
|
328551
|
+
return items;
|
|
328425
328552
|
}
|
|
328426
328553
|
/**
|
|
328427
328554
|
* Returns a human-readable string representation of the current reassembled state.
|
|
@@ -328739,11 +328866,11 @@ import { randomUUID as randomUUID6 } from "node:crypto";
|
|
|
328739
328866
|
|
|
328740
328867
|
// packages/core/src/utils/browserConsent.ts
|
|
328741
328868
|
import * as fs49 from "node:fs/promises";
|
|
328742
|
-
import * as
|
|
328869
|
+
import * as path66 from "node:path";
|
|
328743
328870
|
var BROWSER_CONSENT_FLAG_FILE = "browser-consent-acknowledged.txt";
|
|
328744
328871
|
var BROWSER_PROFILE_DIR = "cli-browser-profile";
|
|
328745
328872
|
async function getBrowserConsentIfNeeded() {
|
|
328746
|
-
const consentFilePath =
|
|
328873
|
+
const consentFilePath = path66.join(
|
|
328747
328874
|
Storage.getGlobalGeminiDir(),
|
|
328748
328875
|
BROWSER_PROFILE_DIR,
|
|
328749
328876
|
BROWSER_CONSENT_FLAG_FILE
|
|
@@ -328771,7 +328898,7 @@ async function getBrowserConsentIfNeeded() {
|
|
|
328771
328898
|
}
|
|
328772
328899
|
async function markConsentAsAcknowledged(consentFilePath) {
|
|
328773
328900
|
try {
|
|
328774
|
-
await fs49.mkdir(
|
|
328901
|
+
await fs49.mkdir(path66.dirname(consentFilePath), { recursive: true });
|
|
328775
328902
|
await fs49.writeFile(
|
|
328776
328903
|
consentFilePath,
|
|
328777
328904
|
`Browser privacy consent acknowledged at ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
@@ -328970,7 +329097,7 @@ async function resumeInputBlocker(browserManager, signal) {
|
|
|
328970
329097
|
}
|
|
328971
329098
|
|
|
328972
329099
|
// packages/core/src/agents/browser/browserManager.ts
|
|
328973
|
-
import * as
|
|
329100
|
+
import * as path67 from "node:path";
|
|
328974
329101
|
import * as fs50 from "node:fs";
|
|
328975
329102
|
import { fileURLToPath as fileURLToPath15 } from "node:url";
|
|
328976
329103
|
|
|
@@ -329054,7 +329181,7 @@ async function removeAutomationOverlay(browserManager, signal) {
|
|
|
329054
329181
|
|
|
329055
329182
|
// packages/core/src/agents/browser/browserManager.ts
|
|
329056
329183
|
var __filename5 = fileURLToPath15(import.meta.url);
|
|
329057
|
-
var __dirname8 =
|
|
329184
|
+
var __dirname8 = path67.dirname(__filename5);
|
|
329058
329185
|
var BROWSER_PROFILE_DIR2 = "cli-browser-profile";
|
|
329059
329186
|
var DomainNotAllowedError = class extends Error {
|
|
329060
329187
|
constructor(message) {
|
|
@@ -329501,7 +329628,7 @@ var BrowserManager = class _BrowserManager {
|
|
|
329501
329628
|
if (browserConfig.customConfig.profilePath) {
|
|
329502
329629
|
mcpArgs.push("--userDataDir", browserConfig.customConfig.profilePath);
|
|
329503
329630
|
} else if (sessionMode === "persistent") {
|
|
329504
|
-
const defaultProfilePath =
|
|
329631
|
+
const defaultProfilePath = path67.join(
|
|
329505
329632
|
Storage.getGlobalGeminiDir(),
|
|
329506
329633
|
BROWSER_PROFILE_DIR2
|
|
329507
329634
|
);
|
|
@@ -329524,14 +329651,14 @@ var BrowserManager = class _BrowserManager {
|
|
|
329524
329651
|
debugLogger.log(
|
|
329525
329652
|
`Launching bundled chrome-devtools-mcp (${sessionMode} mode) with args: ${mcpArgs.join(" ")}`
|
|
329526
329653
|
);
|
|
329527
|
-
let bundleMcpPath =
|
|
329654
|
+
let bundleMcpPath = path67.resolve(
|
|
329528
329655
|
__dirname8,
|
|
329529
329656
|
"bundled/chrome-devtools-mcp.mjs"
|
|
329530
329657
|
);
|
|
329531
329658
|
if (!fs50.existsSync(bundleMcpPath)) {
|
|
329532
|
-
bundleMcpPath =
|
|
329659
|
+
bundleMcpPath = path67.resolve(
|
|
329533
329660
|
__dirname8,
|
|
329534
|
-
__dirname8.includes(`${
|
|
329661
|
+
__dirname8.includes(`${path67.sep}dist${path67.sep}`) ? "../../../bundled/chrome-devtools-mcp.mjs" : "../../../dist/bundled/chrome-devtools-mcp.mjs"
|
|
329535
329662
|
);
|
|
329536
329663
|
}
|
|
329537
329664
|
this.mcpTransport = new StdioClientTransport({
|
|
@@ -330830,39 +330957,6 @@ ${value}`
|
|
|
330830
330957
|
// packages/core/src/tools/exit-plan-mode.ts
|
|
330831
330958
|
import path68 from "node:path";
|
|
330832
330959
|
|
|
330833
|
-
// packages/core/src/utils/planUtils.ts
|
|
330834
|
-
import path67 from "node:path";
|
|
330835
|
-
var PlanErrorMessages = {
|
|
330836
|
-
PATH_ACCESS_DENIED: (planPath, plansDir) => `Access denied: plan path (${planPath}) must be within the designated plans directory (${plansDir}).`,
|
|
330837
|
-
FILE_NOT_FOUND: (path95) => `Plan file does not exist: ${path95}. You must create the plan file before requesting approval.`,
|
|
330838
|
-
FILE_EMPTY: "Plan file is empty. You must write content to the plan file before requesting approval.",
|
|
330839
|
-
READ_FAILURE: (detail) => `Failed to read plan file: ${detail}`
|
|
330840
|
-
};
|
|
330841
|
-
async function validatePlanPath(planPath, plansDir) {
|
|
330842
|
-
const safeFilename = path67.basename(planPath);
|
|
330843
|
-
const resolvedPath = path67.join(plansDir, safeFilename);
|
|
330844
|
-
const realPath = resolveToRealPath(resolvedPath);
|
|
330845
|
-
const realPlansDir = resolveToRealPath(plansDir);
|
|
330846
|
-
if (!isSubpath(realPlansDir, realPath)) {
|
|
330847
|
-
return PlanErrorMessages.PATH_ACCESS_DENIED(planPath, realPlansDir);
|
|
330848
|
-
}
|
|
330849
|
-
if (!await fileExists(resolvedPath)) {
|
|
330850
|
-
return PlanErrorMessages.FILE_NOT_FOUND(planPath);
|
|
330851
|
-
}
|
|
330852
|
-
return null;
|
|
330853
|
-
}
|
|
330854
|
-
async function validatePlanContent(planPath) {
|
|
330855
|
-
try {
|
|
330856
|
-
if (await isEmpty(planPath)) {
|
|
330857
|
-
return PlanErrorMessages.FILE_EMPTY;
|
|
330858
|
-
}
|
|
330859
|
-
return null;
|
|
330860
|
-
} catch (err2) {
|
|
330861
|
-
const message = err2 instanceof Error ? err2.message : String(err2);
|
|
330862
|
-
return PlanErrorMessages.READ_FAILURE(message);
|
|
330863
|
-
}
|
|
330864
|
-
}
|
|
330865
|
-
|
|
330866
330960
|
// packages/core/src/utils/checks.ts
|
|
330867
330961
|
function assumeExhaustive(_value) {
|
|
330868
330962
|
}
|
|
@@ -330911,15 +331005,14 @@ var ExitPlanModeTool = class _ExitPlanModeTool extends BaseDeclarativeTool {
|
|
|
330911
331005
|
if (!params.plan_filename || params.plan_filename.trim() === "") {
|
|
330912
331006
|
return "plan_filename is required.";
|
|
330913
331007
|
}
|
|
330914
|
-
|
|
330915
|
-
|
|
330916
|
-
|
|
330917
|
-
|
|
330918
|
-
|
|
330919
|
-
|
|
330920
|
-
|
|
330921
|
-
|
|
330922
|
-
return `Access denied: plan path (${resolvedPath}) must be within the designated plans directory (${plansDir}).`;
|
|
331008
|
+
try {
|
|
331009
|
+
resolveAndValidatePlanPath(
|
|
331010
|
+
params.plan_filename,
|
|
331011
|
+
this.config.storage.getPlansDir(),
|
|
331012
|
+
this.config.getProjectRoot()
|
|
331013
|
+
);
|
|
331014
|
+
} catch (e2) {
|
|
331015
|
+
return e2 instanceof Error ? e2.message : String(e2);
|
|
330923
331016
|
}
|
|
330924
331017
|
return null;
|
|
330925
331018
|
}
|
|
@@ -330948,7 +331041,8 @@ var ExitPlanModeInvocation = class extends BaseToolInvocation {
|
|
|
330948
331041
|
const resolvedPlanPath = this.getResolvedPlanPath();
|
|
330949
331042
|
const pathError = await validatePlanPath(
|
|
330950
331043
|
this.params.plan_filename,
|
|
330951
|
-
this.config.storage.getPlansDir()
|
|
331044
|
+
this.config.storage.getPlansDir(),
|
|
331045
|
+
this.config.getProjectRoot()
|
|
330952
331046
|
);
|
|
330953
331047
|
if (pathError) {
|
|
330954
331048
|
this.planValidationError = pathError;
|
|
@@ -330993,8 +331087,11 @@ var ExitPlanModeInvocation = class extends BaseToolInvocation {
|
|
|
330993
331087
|
* Note: Validation is done in validateToolParamValues, so this assumes the path is valid.
|
|
330994
331088
|
*/
|
|
330995
331089
|
getResolvedPlanPath() {
|
|
330996
|
-
|
|
330997
|
-
|
|
331090
|
+
return resolveAndValidatePlanPath(
|
|
331091
|
+
this.params.plan_filename,
|
|
331092
|
+
this.config.storage.getPlansDir(),
|
|
331093
|
+
this.config.getProjectRoot()
|
|
331094
|
+
);
|
|
330998
331095
|
}
|
|
330999
331096
|
async execute({ abortSignal: _signal }) {
|
|
331000
331097
|
const resolvedPlanPath = this.getResolvedPlanPath();
|
|
@@ -357664,7 +357761,6 @@ ${sections.join("\n")}
|
|
|
357664
357761
|
debugLogger.debug("Experiments loaded", summaryString);
|
|
357665
357762
|
}
|
|
357666
357763
|
onAgentsRefreshed = async () => {
|
|
357667
|
-
await this.agentRegistry.initialize();
|
|
357668
357764
|
const client = this.geminiClient;
|
|
357669
357765
|
if (client?.isInitialized()) {
|
|
357670
357766
|
await client.setTools();
|
|
@@ -364813,6 +364909,10 @@ export {
|
|
|
364813
364909
|
BaseLlmClient,
|
|
364814
364910
|
promptIdContext,
|
|
364815
364911
|
getPromptIdWithFallback,
|
|
364912
|
+
PlanErrorMessages,
|
|
364913
|
+
resolveAndValidatePlanPath,
|
|
364914
|
+
validatePlanPath,
|
|
364915
|
+
validatePlanContent,
|
|
364816
364916
|
applyReplacement,
|
|
364817
364917
|
calculateReplacement,
|
|
364818
364918
|
getErrorReplaceResult,
|
|
@@ -365037,9 +365137,6 @@ export {
|
|
|
365037
365137
|
createUnauthorizedToolError,
|
|
365038
365138
|
LocalAgentExecutor,
|
|
365039
365139
|
resetBrowserSession,
|
|
365040
|
-
PlanErrorMessages,
|
|
365041
|
-
validatePlanPath,
|
|
365042
|
-
validatePlanContent,
|
|
365043
365140
|
assumeExhaustive,
|
|
365044
365141
|
checkExhaustive,
|
|
365045
365142
|
getApprovalModeDescription,
|