@google/gemini-cli-a2a-server 0.30.0-nightly.20260218.ce84b3cb5 → 0.30.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a2a-server.mjs +123 -276
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/a2a-server.mjs
CHANGED
|
@@ -122445,7 +122445,8 @@ var init_types8 = __esm({
|
|
|
122445
122445
|
secureModeEnabled: external_exports.boolean().optional(),
|
|
122446
122446
|
strictModeDisabled: external_exports.boolean().optional(),
|
|
122447
122447
|
mcpSetting: McpSettingSchema.optional(),
|
|
122448
|
-
cliFeatureSetting: CliFeatureSettingSchema.optional()
|
|
122448
|
+
cliFeatureSetting: CliFeatureSettingSchema.optional(),
|
|
122449
|
+
adminControlsApplicable: external_exports.boolean().optional()
|
|
122449
122450
|
});
|
|
122450
122451
|
}
|
|
122451
122452
|
});
|
|
@@ -131101,7 +131102,7 @@ function getVersion() {
|
|
|
131101
131102
|
}
|
|
131102
131103
|
versionPromise = (async () => {
|
|
131103
131104
|
const pkgJson = await getPackageJson(__dirname3);
|
|
131104
|
-
return "0.30.0-
|
|
131105
|
+
return "0.30.0-preview.1";
|
|
131105
131106
|
})();
|
|
131106
131107
|
return versionPromise;
|
|
131107
131108
|
}
|
|
@@ -208501,8 +208502,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
208501
208502
|
var init_git_commit = __esm({
|
|
208502
208503
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
208503
208504
|
"use strict";
|
|
208504
|
-
GIT_COMMIT_INFO = "
|
|
208505
|
-
CLI_VERSION = "0.30.0-
|
|
208505
|
+
GIT_COMMIT_INFO = "0114b3e58";
|
|
208506
|
+
CLI_VERSION = "0.30.0-preview.1";
|
|
208506
208507
|
}
|
|
208507
208508
|
});
|
|
208508
208509
|
|
|
@@ -281585,12 +281586,7 @@ var init_ls = __esm({
|
|
|
281585
281586
|
return 1;
|
|
281586
281587
|
return a2.name.localeCompare(b.name);
|
|
281587
281588
|
});
|
|
281588
|
-
const directoryContent = entries2.map((entry) => {
|
|
281589
|
-
if (entry.isDirectory) {
|
|
281590
|
-
return `[DIR] ${entry.name}`;
|
|
281591
|
-
}
|
|
281592
|
-
return `${entry.name} (${entry.size} bytes)`;
|
|
281593
|
-
}).join("\n");
|
|
281589
|
+
const directoryContent = entries2.map((entry) => `${entry.isDirectory ? "[DIR] " : ""}${entry.name}`).join("\n");
|
|
281594
281590
|
let resultMessage = `Directory listing for ${resolvedDirPath}:
|
|
281595
281591
|
${directoryContent}`;
|
|
281596
281592
|
if (ignoredCount > 0) {
|
|
@@ -356206,97 +356202,6 @@ var init_pathCorrector = __esm({
|
|
|
356206
356202
|
}
|
|
356207
356203
|
});
|
|
356208
356204
|
|
|
356209
|
-
// node_modules/fast-levenshtein/levenshtein.js
|
|
356210
|
-
var require_levenshtein = __commonJS({
|
|
356211
|
-
"node_modules/fast-levenshtein/levenshtein.js"(exports2, module2) {
|
|
356212
|
-
(function() {
|
|
356213
|
-
"use strict";
|
|
356214
|
-
var collator;
|
|
356215
|
-
try {
|
|
356216
|
-
collator = typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined" ? Intl.Collator("generic", { sensitivity: "base" }) : null;
|
|
356217
|
-
} catch (err2) {
|
|
356218
|
-
console.log("Collator could not be initialized and wouldn't be used");
|
|
356219
|
-
}
|
|
356220
|
-
var prevRow = [], str2Char = [];
|
|
356221
|
-
var Levenshtein = {
|
|
356222
|
-
/**
|
|
356223
|
-
* Calculate levenshtein distance of the two strings.
|
|
356224
|
-
*
|
|
356225
|
-
* @param str1 String the first string.
|
|
356226
|
-
* @param str2 String the second string.
|
|
356227
|
-
* @param [options] Additional options.
|
|
356228
|
-
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
|
356229
|
-
* @return Integer the levenshtein distance (0 and above).
|
|
356230
|
-
*/
|
|
356231
|
-
get: function(str1, str2, options) {
|
|
356232
|
-
var useCollator = options && collator && options.useCollator;
|
|
356233
|
-
var str1Len = str1.length, str2Len = str2.length;
|
|
356234
|
-
if (str1Len === 0) return str2Len;
|
|
356235
|
-
if (str2Len === 0) return str1Len;
|
|
356236
|
-
var curCol, nextCol, i4, j, tmp;
|
|
356237
|
-
for (i4 = 0; i4 < str2Len; ++i4) {
|
|
356238
|
-
prevRow[i4] = i4;
|
|
356239
|
-
str2Char[i4] = str2.charCodeAt(i4);
|
|
356240
|
-
}
|
|
356241
|
-
prevRow[str2Len] = str2Len;
|
|
356242
|
-
var strCmp;
|
|
356243
|
-
if (useCollator) {
|
|
356244
|
-
for (i4 = 0; i4 < str1Len; ++i4) {
|
|
356245
|
-
nextCol = i4 + 1;
|
|
356246
|
-
for (j = 0; j < str2Len; ++j) {
|
|
356247
|
-
curCol = nextCol;
|
|
356248
|
-
strCmp = 0 === collator.compare(str1.charAt(i4), String.fromCharCode(str2Char[j]));
|
|
356249
|
-
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
|
356250
|
-
tmp = curCol + 1;
|
|
356251
|
-
if (nextCol > tmp) {
|
|
356252
|
-
nextCol = tmp;
|
|
356253
|
-
}
|
|
356254
|
-
tmp = prevRow[j + 1] + 1;
|
|
356255
|
-
if (nextCol > tmp) {
|
|
356256
|
-
nextCol = tmp;
|
|
356257
|
-
}
|
|
356258
|
-
prevRow[j] = curCol;
|
|
356259
|
-
}
|
|
356260
|
-
prevRow[j] = nextCol;
|
|
356261
|
-
}
|
|
356262
|
-
} else {
|
|
356263
|
-
for (i4 = 0; i4 < str1Len; ++i4) {
|
|
356264
|
-
nextCol = i4 + 1;
|
|
356265
|
-
for (j = 0; j < str2Len; ++j) {
|
|
356266
|
-
curCol = nextCol;
|
|
356267
|
-
strCmp = str1.charCodeAt(i4) === str2Char[j];
|
|
356268
|
-
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
|
356269
|
-
tmp = curCol + 1;
|
|
356270
|
-
if (nextCol > tmp) {
|
|
356271
|
-
nextCol = tmp;
|
|
356272
|
-
}
|
|
356273
|
-
tmp = prevRow[j + 1] + 1;
|
|
356274
|
-
if (nextCol > tmp) {
|
|
356275
|
-
nextCol = tmp;
|
|
356276
|
-
}
|
|
356277
|
-
prevRow[j] = curCol;
|
|
356278
|
-
}
|
|
356279
|
-
prevRow[j] = nextCol;
|
|
356280
|
-
}
|
|
356281
|
-
}
|
|
356282
|
-
return nextCol;
|
|
356283
|
-
}
|
|
356284
|
-
};
|
|
356285
|
-
if (typeof define !== "undefined" && define !== null && define.amd) {
|
|
356286
|
-
define(function() {
|
|
356287
|
-
return Levenshtein;
|
|
356288
|
-
});
|
|
356289
|
-
} else if (typeof module2 !== "undefined" && module2 !== null && typeof exports2 !== "undefined" && module2.exports === exports2) {
|
|
356290
|
-
module2.exports = Levenshtein;
|
|
356291
|
-
} else if (typeof self !== "undefined" && typeof self.postMessage === "function" && typeof self.importScripts === "function") {
|
|
356292
|
-
self.Levenshtein = Levenshtein;
|
|
356293
|
-
} else if (typeof window !== "undefined" && window !== null) {
|
|
356294
|
-
window.Levenshtein = Levenshtein;
|
|
356295
|
-
}
|
|
356296
|
-
})();
|
|
356297
|
-
}
|
|
356298
|
-
});
|
|
356299
|
-
|
|
356300
356205
|
// packages/core/dist/src/tools/edit.js
|
|
356301
356206
|
import * as fsPromises7 from "node:fs/promises";
|
|
356302
356207
|
import * as path56 from "node:path";
|
|
@@ -356368,7 +356273,7 @@ async function calculateFlexibleReplacement(context2) {
|
|
|
356368
356273
|
const firstLineInMatch = window2[0];
|
|
356369
356274
|
const indentationMatch = firstLineInMatch.match(/^([ \t]*)/);
|
|
356370
356275
|
const indentation = indentationMatch ? indentationMatch[1] : "";
|
|
356371
|
-
const newBlockWithIndent =
|
|
356276
|
+
const newBlockWithIndent = replaceLines.map((line) => `${indentation}${line}`);
|
|
356372
356277
|
sourceLines.splice(i4, searchLinesStripped.length, newBlockWithIndent.join("\n"));
|
|
356373
356278
|
i4 += replaceLines.length;
|
|
356374
356279
|
} else {
|
|
@@ -356411,7 +356316,7 @@ async function calculateRegexReplacement(context2) {
|
|
|
356411
356316
|
}
|
|
356412
356317
|
const indentation = match2[1] || "";
|
|
356413
356318
|
const newLines = normalizedReplace.split("\n");
|
|
356414
|
-
const newBlockWithIndent =
|
|
356319
|
+
const newBlockWithIndent = newLines.map((line) => `${indentation}${line}`).join("\n");
|
|
356415
356320
|
const modifiedCode = currentContent.replace(flexibleRegex, newBlockWithIndent);
|
|
356416
356321
|
return {
|
|
356417
356322
|
newContent: restoreTrailingNewline(currentContent, modifiedCode),
|
|
@@ -356452,10 +356357,6 @@ async function calculateReplacement(config3, context2) {
|
|
|
356452
356357
|
logEditStrategy(config3, event);
|
|
356453
356358
|
return regexResult;
|
|
356454
356359
|
}
|
|
356455
|
-
let fuzzyResult;
|
|
356456
|
-
if (ENABLE_FUZZY_MATCH_RECOVERY && (fuzzyResult = await calculateFuzzyReplacement(config3, context2))) {
|
|
356457
|
-
return fuzzyResult;
|
|
356458
|
-
}
|
|
356459
356360
|
return {
|
|
356460
356361
|
newContent: currentContent,
|
|
356461
356362
|
occurrences: 0,
|
|
@@ -356487,109 +356388,7 @@ function getErrorReplaceResult(params, occurrences, expectedReplacements, finalO
|
|
|
356487
356388
|
}
|
|
356488
356389
|
return error2;
|
|
356489
356390
|
}
|
|
356490
|
-
|
|
356491
|
-
return str2.replace(/\s/g, "");
|
|
356492
|
-
}
|
|
356493
|
-
function applyIndentation(lines, targetIndentation) {
|
|
356494
|
-
if (lines.length === 0)
|
|
356495
|
-
return [];
|
|
356496
|
-
const referenceLine = lines[0];
|
|
356497
|
-
const refIndentMatch = referenceLine.match(/^([ \t]*)/);
|
|
356498
|
-
const refIndent = refIndentMatch ? refIndentMatch[1] : "";
|
|
356499
|
-
return lines.map((line) => {
|
|
356500
|
-
if (line.trim() === "") {
|
|
356501
|
-
return "";
|
|
356502
|
-
}
|
|
356503
|
-
if (line.startsWith(refIndent)) {
|
|
356504
|
-
return targetIndentation + line.slice(refIndent.length);
|
|
356505
|
-
}
|
|
356506
|
-
return targetIndentation + line.trimStart();
|
|
356507
|
-
});
|
|
356508
|
-
}
|
|
356509
|
-
function getFuzzyMatchFeedback(editData) {
|
|
356510
|
-
if (editData.strategy === "fuzzy" && editData.matchRanges && editData.matchRanges.length > 0) {
|
|
356511
|
-
const ranges = editData.matchRanges.map((r3) => r3.start === r3.end ? `${r3.start}` : `${r3.start}-${r3.end}`).join(", ");
|
|
356512
|
-
return `Applied fuzzy match at line${editData.matchRanges.length > 1 ? "s" : ""} ${ranges}.`;
|
|
356513
|
-
}
|
|
356514
|
-
return null;
|
|
356515
|
-
}
|
|
356516
|
-
async function calculateFuzzyReplacement(config3, context2) {
|
|
356517
|
-
const { currentContent, params } = context2;
|
|
356518
|
-
const { old_string, new_string } = params;
|
|
356519
|
-
if (old_string.length < 10) {
|
|
356520
|
-
return null;
|
|
356521
|
-
}
|
|
356522
|
-
const normalizedCode = currentContent.replace(/\r\n/g, "\n");
|
|
356523
|
-
const normalizedSearch = old_string.replace(/\r\n/g, "\n");
|
|
356524
|
-
const normalizedReplace = new_string.replace(/\r\n/g, "\n");
|
|
356525
|
-
const sourceLines = normalizedCode.match(/.*(?:\n|$)/g)?.slice(0, -1) ?? [];
|
|
356526
|
-
const searchLines = normalizedSearch.match(/.*(?:\n|$)/g)?.slice(0, -1).map((l2) => l2.trimEnd());
|
|
356527
|
-
if (sourceLines.length * Math.pow(old_string.length, 2) > 4e8) {
|
|
356528
|
-
return null;
|
|
356529
|
-
}
|
|
356530
|
-
if (!searchLines || searchLines.length === 0) {
|
|
356531
|
-
return null;
|
|
356532
|
-
}
|
|
356533
|
-
const N = searchLines.length;
|
|
356534
|
-
const candidates = [];
|
|
356535
|
-
const searchBlock = searchLines.join("\n");
|
|
356536
|
-
for (let i4 = 0; i4 <= sourceLines.length - N; i4++) {
|
|
356537
|
-
const windowLines = sourceLines.slice(i4, i4 + N);
|
|
356538
|
-
const windowText = windowLines.map((l2) => l2.trimEnd()).join("\n");
|
|
356539
|
-
const lengthDiff = Math.abs(windowText.length - searchBlock.length);
|
|
356540
|
-
if (lengthDiff / searchBlock.length > FUZZY_MATCH_THRESHOLD / WHITESPACE_PENALTY_FACTOR) {
|
|
356541
|
-
continue;
|
|
356542
|
-
}
|
|
356543
|
-
const d_raw = import_fast_levenshtein.default.get(windowText, searchBlock);
|
|
356544
|
-
const d_norm = import_fast_levenshtein.default.get(stripWhitespace(windowText), stripWhitespace(searchBlock));
|
|
356545
|
-
const weightedDist = d_norm + (d_raw - d_norm) * WHITESPACE_PENALTY_FACTOR;
|
|
356546
|
-
const score = weightedDist / searchBlock.length;
|
|
356547
|
-
if (score <= FUZZY_MATCH_THRESHOLD) {
|
|
356548
|
-
candidates.push({ index: i4, score });
|
|
356549
|
-
}
|
|
356550
|
-
}
|
|
356551
|
-
if (candidates.length === 0) {
|
|
356552
|
-
return null;
|
|
356553
|
-
}
|
|
356554
|
-
candidates.sort((a2, b) => a2.score - b.score || a2.index - b.index);
|
|
356555
|
-
const selectedMatches = [];
|
|
356556
|
-
for (const candidate of candidates) {
|
|
356557
|
-
const overlaps = selectedMatches.some((m2) => Math.abs(m2.index - candidate.index) < N);
|
|
356558
|
-
if (!overlaps) {
|
|
356559
|
-
selectedMatches.push(candidate);
|
|
356560
|
-
}
|
|
356561
|
-
}
|
|
356562
|
-
if (selectedMatches.length > 0) {
|
|
356563
|
-
const event = new EditStrategyEvent("fuzzy");
|
|
356564
|
-
logEditStrategy(config3, event);
|
|
356565
|
-
const matchRanges = selectedMatches.map((m2) => ({ start: m2.index + 1, end: m2.index + N })).sort((a2, b) => a2.start - b.start);
|
|
356566
|
-
selectedMatches.sort((a2, b) => b.index - a2.index);
|
|
356567
|
-
const newLines = normalizedReplace.split("\n");
|
|
356568
|
-
for (const match2 of selectedMatches) {
|
|
356569
|
-
const firstLineMatch = sourceLines[match2.index];
|
|
356570
|
-
const indentationMatch = firstLineMatch.match(/^([ \t]*)/);
|
|
356571
|
-
const indentation = indentationMatch ? indentationMatch[1] : "";
|
|
356572
|
-
const indentedReplaceLines = applyIndentation(newLines, indentation);
|
|
356573
|
-
let replacementText = indentedReplaceLines.join("\n");
|
|
356574
|
-
if (sourceLines[match2.index + N - 1].endsWith("\n")) {
|
|
356575
|
-
replacementText += "\n";
|
|
356576
|
-
}
|
|
356577
|
-
sourceLines.splice(match2.index, N, replacementText);
|
|
356578
|
-
}
|
|
356579
|
-
let modifiedCode = sourceLines.join("");
|
|
356580
|
-
modifiedCode = restoreTrailingNewline(currentContent, modifiedCode);
|
|
356581
|
-
return {
|
|
356582
|
-
newContent: modifiedCode,
|
|
356583
|
-
occurrences: selectedMatches.length,
|
|
356584
|
-
finalOldString: normalizedSearch,
|
|
356585
|
-
finalNewString: normalizedReplace,
|
|
356586
|
-
strategy: "fuzzy",
|
|
356587
|
-
matchRanges
|
|
356588
|
-
};
|
|
356589
|
-
}
|
|
356590
|
-
return null;
|
|
356591
|
-
}
|
|
356592
|
-
var import_fast_levenshtein, ENABLE_FUZZY_MATCH_RECOVERY, FUZZY_MATCH_THRESHOLD, WHITESPACE_PENALTY_FACTOR, EditToolInvocation, EditTool;
|
|
356391
|
+
var EditToolInvocation, EditTool;
|
|
356593
356392
|
var init_edit = __esm({
|
|
356594
356393
|
"packages/core/dist/src/tools/edit.js"() {
|
|
356595
356394
|
"use strict";
|
|
@@ -356612,12 +356411,8 @@ var init_edit = __esm({
|
|
|
356612
356411
|
init_pathCorrector();
|
|
356613
356412
|
init_tool_names();
|
|
356614
356413
|
init_debugLogger();
|
|
356615
|
-
import_fast_levenshtein = __toESM(require_levenshtein(), 1);
|
|
356616
356414
|
init_coreTools();
|
|
356617
356415
|
init_resolver();
|
|
356618
|
-
ENABLE_FUZZY_MATCH_RECOVERY = true;
|
|
356619
|
-
FUZZY_MATCH_THRESHOLD = 0.1;
|
|
356620
|
-
WHITESPACE_PENALTY_FACTOR = 0.1;
|
|
356621
356416
|
EditToolInvocation = class extends BaseToolInvocation {
|
|
356622
356417
|
config;
|
|
356623
356418
|
constructor(config3, params, messageBus, toolName, displayName) {
|
|
@@ -356692,9 +356487,7 @@ var init_edit = __esm({
|
|
|
356692
356487
|
occurrences: secondAttemptResult.occurrences,
|
|
356693
356488
|
isNewFile: false,
|
|
356694
356489
|
error: void 0,
|
|
356695
|
-
originalLineEnding
|
|
356696
|
-
strategy: secondAttemptResult.strategy,
|
|
356697
|
-
matchRanges: secondAttemptResult.matchRanges
|
|
356490
|
+
originalLineEnding
|
|
356698
356491
|
};
|
|
356699
356492
|
}
|
|
356700
356493
|
/**
|
|
@@ -356785,9 +356578,7 @@ var init_edit = __esm({
|
|
|
356785
356578
|
occurrences: replacementResult.occurrences,
|
|
356786
356579
|
isNewFile: false,
|
|
356787
356580
|
error: void 0,
|
|
356788
|
-
originalLineEnding
|
|
356789
|
-
strategy: replacementResult.strategy,
|
|
356790
|
-
matchRanges: replacementResult.matchRanges
|
|
356581
|
+
originalLineEnding
|
|
356791
356582
|
};
|
|
356792
356583
|
}
|
|
356793
356584
|
if (this.config.getDisableLLMCorrection()) {
|
|
@@ -356948,10 +356739,6 @@ var init_edit = __esm({
|
|
|
356948
356739
|
const llmSuccessMessageParts = [
|
|
356949
356740
|
editData.isNewFile ? `Created new file: ${this.params.file_path} with provided content.` : `Successfully modified file: ${this.params.file_path} (${editData.occurrences} replacements).`
|
|
356950
356741
|
];
|
|
356951
|
-
const fuzzyFeedback = getFuzzyMatchFeedback(editData);
|
|
356952
|
-
if (fuzzyFeedback) {
|
|
356953
|
-
llmSuccessMessageParts.push(fuzzyFeedback);
|
|
356954
|
-
}
|
|
356955
356742
|
if (this.params.modified_by_user) {
|
|
356956
356743
|
llmSuccessMessageParts.push(`User modified the \`new_string\` content to be: ${this.params.new_string}.`);
|
|
356957
356744
|
}
|
|
@@ -375121,11 +374908,102 @@ var init_tool_modifier = __esm({
|
|
|
375121
374908
|
}
|
|
375122
374909
|
});
|
|
375123
374910
|
|
|
374911
|
+
// node_modules/fast-levenshtein/levenshtein.js
|
|
374912
|
+
var require_levenshtein = __commonJS({
|
|
374913
|
+
"node_modules/fast-levenshtein/levenshtein.js"(exports2, module2) {
|
|
374914
|
+
(function() {
|
|
374915
|
+
"use strict";
|
|
374916
|
+
var collator;
|
|
374917
|
+
try {
|
|
374918
|
+
collator = typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined" ? Intl.Collator("generic", { sensitivity: "base" }) : null;
|
|
374919
|
+
} catch (err2) {
|
|
374920
|
+
console.log("Collator could not be initialized and wouldn't be used");
|
|
374921
|
+
}
|
|
374922
|
+
var prevRow = [], str2Char = [];
|
|
374923
|
+
var Levenshtein = {
|
|
374924
|
+
/**
|
|
374925
|
+
* Calculate levenshtein distance of the two strings.
|
|
374926
|
+
*
|
|
374927
|
+
* @param str1 String the first string.
|
|
374928
|
+
* @param str2 String the second string.
|
|
374929
|
+
* @param [options] Additional options.
|
|
374930
|
+
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
|
374931
|
+
* @return Integer the levenshtein distance (0 and above).
|
|
374932
|
+
*/
|
|
374933
|
+
get: function(str1, str2, options) {
|
|
374934
|
+
var useCollator = options && collator && options.useCollator;
|
|
374935
|
+
var str1Len = str1.length, str2Len = str2.length;
|
|
374936
|
+
if (str1Len === 0) return str2Len;
|
|
374937
|
+
if (str2Len === 0) return str1Len;
|
|
374938
|
+
var curCol, nextCol, i4, j, tmp;
|
|
374939
|
+
for (i4 = 0; i4 < str2Len; ++i4) {
|
|
374940
|
+
prevRow[i4] = i4;
|
|
374941
|
+
str2Char[i4] = str2.charCodeAt(i4);
|
|
374942
|
+
}
|
|
374943
|
+
prevRow[str2Len] = str2Len;
|
|
374944
|
+
var strCmp;
|
|
374945
|
+
if (useCollator) {
|
|
374946
|
+
for (i4 = 0; i4 < str1Len; ++i4) {
|
|
374947
|
+
nextCol = i4 + 1;
|
|
374948
|
+
for (j = 0; j < str2Len; ++j) {
|
|
374949
|
+
curCol = nextCol;
|
|
374950
|
+
strCmp = 0 === collator.compare(str1.charAt(i4), String.fromCharCode(str2Char[j]));
|
|
374951
|
+
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
|
374952
|
+
tmp = curCol + 1;
|
|
374953
|
+
if (nextCol > tmp) {
|
|
374954
|
+
nextCol = tmp;
|
|
374955
|
+
}
|
|
374956
|
+
tmp = prevRow[j + 1] + 1;
|
|
374957
|
+
if (nextCol > tmp) {
|
|
374958
|
+
nextCol = tmp;
|
|
374959
|
+
}
|
|
374960
|
+
prevRow[j] = curCol;
|
|
374961
|
+
}
|
|
374962
|
+
prevRow[j] = nextCol;
|
|
374963
|
+
}
|
|
374964
|
+
} else {
|
|
374965
|
+
for (i4 = 0; i4 < str1Len; ++i4) {
|
|
374966
|
+
nextCol = i4 + 1;
|
|
374967
|
+
for (j = 0; j < str2Len; ++j) {
|
|
374968
|
+
curCol = nextCol;
|
|
374969
|
+
strCmp = str1.charCodeAt(i4) === str2Char[j];
|
|
374970
|
+
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
|
374971
|
+
tmp = curCol + 1;
|
|
374972
|
+
if (nextCol > tmp) {
|
|
374973
|
+
nextCol = tmp;
|
|
374974
|
+
}
|
|
374975
|
+
tmp = prevRow[j + 1] + 1;
|
|
374976
|
+
if (nextCol > tmp) {
|
|
374977
|
+
nextCol = tmp;
|
|
374978
|
+
}
|
|
374979
|
+
prevRow[j] = curCol;
|
|
374980
|
+
}
|
|
374981
|
+
prevRow[j] = nextCol;
|
|
374982
|
+
}
|
|
374983
|
+
}
|
|
374984
|
+
return nextCol;
|
|
374985
|
+
}
|
|
374986
|
+
};
|
|
374987
|
+
if (typeof define !== "undefined" && define !== null && define.amd) {
|
|
374988
|
+
define(function() {
|
|
374989
|
+
return Levenshtein;
|
|
374990
|
+
});
|
|
374991
|
+
} else if (typeof module2 !== "undefined" && module2 !== null && typeof exports2 !== "undefined" && module2.exports === exports2) {
|
|
374992
|
+
module2.exports = Levenshtein;
|
|
374993
|
+
} else if (typeof self !== "undefined" && typeof self.postMessage === "function" && typeof self.importScripts === "function") {
|
|
374994
|
+
self.Levenshtein = Levenshtein;
|
|
374995
|
+
} else if (typeof window !== "undefined" && window !== null) {
|
|
374996
|
+
window.Levenshtein = Levenshtein;
|
|
374997
|
+
}
|
|
374998
|
+
})();
|
|
374999
|
+
}
|
|
375000
|
+
});
|
|
375001
|
+
|
|
375124
375002
|
// packages/core/dist/src/utils/tool-utils.js
|
|
375125
375003
|
function getToolSuggestion(unknownToolName, allToolNames, topN = 3) {
|
|
375126
375004
|
const matches = allToolNames.map((toolName) => ({
|
|
375127
375005
|
name: toolName,
|
|
375128
|
-
distance:
|
|
375006
|
+
distance: import_fast_levenshtein.default.get(unknownToolName, toolName)
|
|
375129
375007
|
}));
|
|
375130
375008
|
matches.sort((a2, b) => a2.distance - b.distance);
|
|
375131
375009
|
const topNResults = matches.slice(0, topN);
|
|
@@ -375139,13 +375017,13 @@ function getToolSuggestion(unknownToolName, allToolNames, topN = 3) {
|
|
|
375139
375017
|
return ` Did you mean ${suggestedNames}?`;
|
|
375140
375018
|
}
|
|
375141
375019
|
}
|
|
375142
|
-
var
|
|
375020
|
+
var import_fast_levenshtein;
|
|
375143
375021
|
var init_tool_utils = __esm({
|
|
375144
375022
|
"packages/core/dist/src/utils/tool-utils.js"() {
|
|
375145
375023
|
"use strict";
|
|
375146
375024
|
init_src2();
|
|
375147
375025
|
init_shell_utils();
|
|
375148
|
-
|
|
375026
|
+
import_fast_levenshtein = __toESM(require_levenshtein(), 1);
|
|
375149
375027
|
init_types2();
|
|
375150
375028
|
init_types3();
|
|
375151
375029
|
init_tool_names();
|
|
@@ -378053,34 +377931,8 @@ function renderCoreMandates(options) {
|
|
|
378053
377931
|
- **Source Control:** Do not stage or commit changes unless specifically requested by the user.
|
|
378054
377932
|
|
|
378055
377933
|
## Context Efficiency:
|
|
378056
|
-
|
|
378057
|
-
|
|
378058
|
-
|
|
378059
|
-
Consider the following when estimating the cost of your approach:
|
|
378060
|
-
<estimating_context_usage>
|
|
378061
|
-
- The agent passes the full history with each subsequent message. The larger context is early in the session, the more expensive each subsequent turn is.
|
|
378062
|
-
- Unnecessary turns are generally more expensive than other types of wasted context.
|
|
378063
|
-
- You can reduce context usage by limiting the outputs of tools but take care not to cause more token consumption via additional turns required to recover from a tool failure or compensate for a misapplied optimization strategy.
|
|
378064
|
-
</estimating_context_usage>
|
|
378065
|
-
|
|
378066
|
-
Use the following guidelines to optimize your search and read patterns.
|
|
378067
|
-
<guidelines>
|
|
378068
|
-
- Combine turns whenever possible by utilizing parallel searching and reading and by requesting enough context by passing context, before, or after to ${GREP_TOOL_NAME}, to enable you to skip using an extra turn reading the file.
|
|
378069
|
-
- Prefer using tools like ${GREP_TOOL_NAME} to identify points of interest instead of reading lots of files individually.
|
|
378070
|
-
- If you need to read multiple ranges in a file, do so parallel, in as few turns as possible.
|
|
378071
|
-
- It is more important to reduce extra turns, but please also try to minimize unnecessarily large file reads and search results, when doing so doesn't result in extra turns. Do this by always providing conservative limits and scopes to tools like ${READ_FILE_TOOL_NAME} and ${GREP_TOOL_NAME}.
|
|
378072
|
-
- ${READ_FILE_TOOL_NAME} fails if old_string is ambiguous, causing extra turns. Take care to read enough with ${READ_FILE_TOOL_NAME} and ${GREP_TOOL_NAME} to make the edit unambiguous.
|
|
378073
|
-
- You can compensate for the risk of missing results with scoped or limited searches by doing multiple searches in parallel.
|
|
378074
|
-
- Your primary goal is still to do your best quality work. Efficiency is an important, but secondary concern.
|
|
378075
|
-
</guidelines>
|
|
378076
|
-
|
|
378077
|
-
<examples>
|
|
378078
|
-
- **Searching:** utilize search tools like ${GREP_TOOL_NAME} and ${GLOB_TOOL_NAME} with a conservative result count (\`total_max_matches\`) and a narrow scope (\`include\` and \`exclude\` parameters).
|
|
378079
|
-
- **Searching and editing:** utilize search tools like ${GREP_TOOL_NAME} with a conservative result count and a narrow scope. Use \`context\`, \`before\`, and/or \`after\` to request enough context to avoid the need to read the file before editing matches.
|
|
378080
|
-
- **Understanding:** minimize turns needed to understand a file. It's most efficient to read small files in their entirety.
|
|
378081
|
-
- **Large files:** utilize search tools like ${GREP_TOOL_NAME} and/or ${READ_FILE_TOOL_NAME} called in parallel with an offset and a limit to reduce the impact on context. Minmize extra turns, unless unavoidable due to the file being too large.
|
|
378082
|
-
- **Navigating:** read the minimum required to not require additional turns spent reading the file.
|
|
378083
|
-
</examples>
|
|
377934
|
+
- Always scope and limit your searches to avoid context window exhaustion and ensure high-signal results. Use include to target relevant files and strictly limit results using total_max_matches and max_matches_per_file, especially during the research phase.
|
|
377935
|
+
- For broad discovery, use names_only=true or max_matches_per_file=1 to identify files without retrieving their context.
|
|
378084
377936
|
|
|
378085
377937
|
## Engineering Standards
|
|
378086
377938
|
- **Contextual Precedence:** Instructions found in ${formattedFilenames} files are foundational mandates. They take absolute precedence over the general workflows and tool defaults described in this system prompt.
|
|
@@ -397435,16 +397287,13 @@ function sanitizeAdminSettings(settings) {
|
|
|
397435
397287
|
}
|
|
397436
397288
|
};
|
|
397437
397289
|
}
|
|
397438
|
-
function isGaxiosError(error2) {
|
|
397439
|
-
return typeof error2 === "object" && error2 !== null && "status" in error2 && typeof error2.status === "number";
|
|
397440
|
-
}
|
|
397441
397290
|
async function fetchAdminControls(server, cachedSettings, adminControlsEnabled, onSettingsChanged) {
|
|
397442
397291
|
if (!server || !server.projectId || !adminControlsEnabled) {
|
|
397443
397292
|
stopAdminControlsPolling();
|
|
397444
397293
|
currentSettings = void 0;
|
|
397445
397294
|
return {};
|
|
397446
397295
|
}
|
|
397447
|
-
if (cachedSettings) {
|
|
397296
|
+
if (cachedSettings && Object.keys(cachedSettings).length !== 0) {
|
|
397448
397297
|
currentSettings = cachedSettings;
|
|
397449
397298
|
startAdminControlsPolling(server, server.projectId, onSettingsChanged);
|
|
397450
397299
|
return cachedSettings;
|
|
@@ -397453,20 +397302,18 @@ async function fetchAdminControls(server, cachedSettings, adminControlsEnabled,
|
|
|
397453
397302
|
const rawSettings = await server.fetchAdminControls({
|
|
397454
397303
|
project: server.projectId
|
|
397455
397304
|
});
|
|
397305
|
+
if (rawSettings.adminControlsApplicable !== true) {
|
|
397306
|
+
stopAdminControlsPolling();
|
|
397307
|
+
currentSettings = void 0;
|
|
397308
|
+
return {};
|
|
397309
|
+
}
|
|
397456
397310
|
const sanitizedSettings = sanitizeAdminSettings(rawSettings);
|
|
397457
397311
|
currentSettings = sanitizedSettings;
|
|
397458
397312
|
startAdminControlsPolling(server, server.projectId, onSettingsChanged);
|
|
397459
397313
|
return sanitizedSettings;
|
|
397460
397314
|
} catch (e3) {
|
|
397461
|
-
if (isGaxiosError(e3) && e3.status === 403) {
|
|
397462
|
-
stopAdminControlsPolling();
|
|
397463
|
-
currentSettings = void 0;
|
|
397464
|
-
return {};
|
|
397465
|
-
}
|
|
397466
397315
|
debugLogger.error("Failed to fetch admin controls: ", e3);
|
|
397467
|
-
|
|
397468
|
-
startAdminControlsPolling(server, server.projectId, onSettingsChanged);
|
|
397469
|
-
return {};
|
|
397316
|
+
throw e3;
|
|
397470
397317
|
}
|
|
397471
397318
|
}
|
|
397472
397319
|
async function fetchAdminControlsOnce(server, adminControlsEnabled) {
|
|
@@ -397477,13 +397324,13 @@ async function fetchAdminControlsOnce(server, adminControlsEnabled) {
|
|
|
397477
397324
|
const rawSettings = await server.fetchAdminControls({
|
|
397478
397325
|
project: server.projectId
|
|
397479
397326
|
});
|
|
397480
|
-
|
|
397481
|
-
} catch (e3) {
|
|
397482
|
-
if (isGaxiosError(e3) && e3.status === 403) {
|
|
397327
|
+
if (rawSettings.adminControlsApplicable !== true) {
|
|
397483
397328
|
return {};
|
|
397484
397329
|
}
|
|
397330
|
+
return sanitizeAdminSettings(rawSettings);
|
|
397331
|
+
} catch (e3) {
|
|
397485
397332
|
debugLogger.error("Failed to fetch admin controls: ", e3 instanceof Error ? e3.message : e3);
|
|
397486
|
-
|
|
397333
|
+
throw e3;
|
|
397487
397334
|
}
|
|
397488
397335
|
}
|
|
397489
397336
|
function startAdminControlsPolling(server, project, onSettingsChanged) {
|
|
@@ -397493,17 +397340,17 @@ function startAdminControlsPolling(server, project, onSettingsChanged) {
|
|
|
397493
397340
|
const rawSettings = await server.fetchAdminControls({
|
|
397494
397341
|
project
|
|
397495
397342
|
});
|
|
397343
|
+
if (rawSettings.adminControlsApplicable !== true) {
|
|
397344
|
+
stopAdminControlsPolling();
|
|
397345
|
+
currentSettings = void 0;
|
|
397346
|
+
return;
|
|
397347
|
+
}
|
|
397496
397348
|
const newSettings = sanitizeAdminSettings(rawSettings);
|
|
397497
397349
|
if (!isDeepStrictEqual(newSettings, currentSettings)) {
|
|
397498
397350
|
currentSettings = newSettings;
|
|
397499
397351
|
onSettingsChanged(newSettings);
|
|
397500
397352
|
}
|
|
397501
397353
|
} catch (e3) {
|
|
397502
|
-
if (isGaxiosError(e3) && e3.status === 403) {
|
|
397503
|
-
stopAdminControlsPolling();
|
|
397504
|
-
currentSettings = void 0;
|
|
397505
|
-
return;
|
|
397506
|
-
}
|
|
397507
397354
|
debugLogger.error("Failed to poll admin controls: ", e3);
|
|
397508
397355
|
}
|
|
397509
397356
|
}, 5 * 60 * 1e3);
|