@vybestack/llxprt-code-core 0.4.1 → 0.4.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.
@@ -1,347 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { EditTool } from '../tools/edit.js';
7
- import { WriteFileTool } from '../tools/write-file.js';
8
- import { ReadFileTool } from '../tools/read-file.js';
9
- import { ReadManyFilesTool } from '../tools/read-many-files.js';
10
- import { GrepTool } from '../tools/grep.js';
11
- import { LruCache } from './LruCache.js';
12
- import { isFunctionResponse, isFunctionCall, } from '../utils/messageInspectors.js';
13
- import { promises as fsPromises } from 'fs';
14
- import { correctOldStringMismatch as deterministicCorrectOldString, correctNewString as deterministicCorrectNewString, correctNewStringEscaping as deterministicCorrectNewStringEscaping, } from './deterministicEditCorrector.js';
15
- const MAX_CACHE_SIZE = 50;
16
- // Cache for ensureCorrectEdit results
17
- const editCorrectionCache = new LruCache(MAX_CACHE_SIZE);
18
- // Cache for ensureCorrectFileContent results
19
- const fileContentCorrectionCache = new LruCache(MAX_CACHE_SIZE);
20
- /**
21
- * Extracts the timestamp from the .id value, which is in format
22
- * <tool.name>-<timestamp>-<uuid>
23
- * @param fcnId the ID value of a functionCall or functionResponse object
24
- * @returns -1 if the timestamp could not be extracted, else the timestamp (as a number)
25
- */
26
- function getTimestampFromFunctionId(fcnId) {
27
- const idParts = fcnId.split('-');
28
- if (idParts.length > 2) {
29
- const timestamp = parseInt(idParts[1], 10);
30
- if (!isNaN(timestamp)) {
31
- return timestamp;
32
- }
33
- }
34
- return -1;
35
- }
36
- /**
37
- * Will look through the gemini client history and determine when the most recent
38
- * edit to a target file occurred. If no edit happened, it will return -1
39
- * @param filePath the path to the file
40
- * @param client the geminiClient, so that we can get the history
41
- * @returns a DateTime (as a number) of when the last edit occurred, or -1 if no edit was found.
42
- */
43
- async function findLastEditTimestamp(filePath, client) {
44
- const history = (await client.getHistory()) ?? [];
45
- // Tools that may reference the file path in their FunctionResponse `output`.
46
- const toolsInResp = new Set([
47
- WriteFileTool.Name,
48
- EditTool.Name,
49
- ReadManyFilesTool.Name,
50
- GrepTool.Name,
51
- ]);
52
- // Tools that may reference the file path in their FunctionCall `args`.
53
- const toolsInCall = new Set([...toolsInResp, ReadFileTool.Name]);
54
- // Iterate backwards to find the most recent relevant action.
55
- for (const entry of history.slice().reverse()) {
56
- if (!entry.parts)
57
- continue;
58
- for (const part of entry.parts) {
59
- let id;
60
- let content;
61
- // Check for a relevant FunctionCall with the file path in its arguments.
62
- if (isFunctionCall(entry) &&
63
- part.functionCall?.name &&
64
- toolsInCall.has(part.functionCall.name)) {
65
- id = part.functionCall.id;
66
- content = part.functionCall.args;
67
- }
68
- // Check for a relevant FunctionResponse with the file path in its output.
69
- else if (isFunctionResponse(entry) &&
70
- part.functionResponse?.name &&
71
- toolsInResp.has(part.functionResponse.name)) {
72
- const { response } = part.functionResponse;
73
- if (response && !('error' in response) && 'output' in response) {
74
- id = part.functionResponse.id;
75
- content = response.output;
76
- }
77
- }
78
- if (!id || content === undefined)
79
- continue;
80
- // Use the "blunt hammer" approach to find the file path in the content.
81
- // Note that the tool response data is inconsistent in their formatting
82
- // with successes and errors - so, we just check for the existence
83
- // as the best guess to if error/failed occurred with the response.
84
- const stringified = JSON.stringify(content);
85
- if (!stringified.includes('Error') && // only applicable for functionResponse
86
- !stringified.includes('Failed') && // only applicable for functionResponse
87
- stringified.includes(filePath)) {
88
- return getTimestampFromFunctionId(id);
89
- }
90
- }
91
- }
92
- return -1;
93
- }
94
- /**
95
- * Attempts to correct edit parameters if the original old_string is not found.
96
- * It tries unescaping, and then LLM-based correction.
97
- * Results are cached to avoid redundant processing.
98
- *
99
- * @param currentContent The current content of the file.
100
- * @param originalParams The original EditToolParams
101
- * @param client The GeminiClient for LLM calls.
102
- * @returns A promise resolving to an object containing the (potentially corrected)
103
- * EditToolParams (as CorrectedEditParams) and the final occurrences count.
104
- */
105
- export async function ensureCorrectEdit(filePath, currentContent, originalParams, // This is the EditToolParams from edit.ts, without \'corrected\'
106
- client, abortSignal) {
107
- const cacheKey = `${currentContent}---${originalParams.old_string}---${originalParams.new_string}`;
108
- const cachedResult = editCorrectionCache.get(cacheKey);
109
- if (cachedResult) {
110
- return cachedResult;
111
- }
112
- let finalNewString = originalParams.new_string;
113
- const newStringPotentiallyEscaped = unescapeStringForGeminiBug(originalParams.new_string) !==
114
- originalParams.new_string;
115
- const expectedReplacements = originalParams.expected_replacements ?? 1;
116
- let finalOldString = originalParams.old_string;
117
- let occurrences = countOccurrences(currentContent, finalOldString);
118
- if (occurrences === expectedReplacements) {
119
- if (newStringPotentiallyEscaped) {
120
- finalNewString = await correctNewStringEscaping(client, finalOldString, originalParams.new_string, abortSignal);
121
- }
122
- }
123
- else if (occurrences > expectedReplacements) {
124
- const expectedReplacements = originalParams.expected_replacements ?? 1;
125
- // If user expects multiple replacements, return as-is
126
- if (occurrences === expectedReplacements) {
127
- const result = {
128
- params: { ...originalParams },
129
- occurrences,
130
- };
131
- editCorrectionCache.set(cacheKey, result);
132
- return result;
133
- }
134
- // If user expects 1 but found multiple, try to correct (existing behavior)
135
- if (expectedReplacements === 1) {
136
- const result = {
137
- params: { ...originalParams },
138
- occurrences,
139
- };
140
- editCorrectionCache.set(cacheKey, result);
141
- return result;
142
- }
143
- // If occurrences don't match expected, return as-is (will fail validation later)
144
- const result = {
145
- params: { ...originalParams },
146
- occurrences,
147
- };
148
- editCorrectionCache.set(cacheKey, result);
149
- return result;
150
- }
151
- else {
152
- // occurrences is 0 or some other unexpected state initially
153
- const unescapedOldStringAttempt = unescapeStringForGeminiBug(originalParams.old_string);
154
- occurrences = countOccurrences(currentContent, unescapedOldStringAttempt);
155
- if (occurrences === expectedReplacements) {
156
- finalOldString = unescapedOldStringAttempt;
157
- if (newStringPotentiallyEscaped) {
158
- finalNewString = await correctNewString(client, originalParams.old_string, // original old
159
- unescapedOldStringAttempt, // corrected old
160
- originalParams.new_string, // original new (which is potentially escaped)
161
- abortSignal);
162
- }
163
- }
164
- else if (occurrences === 0) {
165
- if (filePath) {
166
- // In order to keep from clobbering edits made outside our system,
167
- // let's check if there was a more recent edit to the file than what
168
- // our system has done
169
- const lastEditedByUsTime = await findLastEditTimestamp(filePath, client);
170
- // Add a 1-second buffer to account for timing inaccuracies. If the file
171
- // was modified more than a second after the last edit tool was run, we
172
- // can assume it was modified by something else.
173
- if (lastEditedByUsTime > 0) {
174
- const stats = await fsPromises.stat(filePath);
175
- const diff = stats.mtimeMs - lastEditedByUsTime;
176
- if (diff > 2000) {
177
- // Hard coded for 2 seconds
178
- // This file was edited sooner
179
- const result = {
180
- params: { ...originalParams },
181
- occurrences: 0, // Explicitly 0 as LLM failed
182
- };
183
- editCorrectionCache.set(cacheKey, result);
184
- return result;
185
- }
186
- }
187
- }
188
- const llmCorrectedOldString = await correctOldStringMismatch(client, currentContent, unescapedOldStringAttempt, abortSignal);
189
- const llmOldOccurrences = countOccurrences(currentContent, llmCorrectedOldString);
190
- if (llmOldOccurrences === expectedReplacements) {
191
- finalOldString = llmCorrectedOldString;
192
- occurrences = llmOldOccurrences;
193
- if (newStringPotentiallyEscaped) {
194
- const baseNewStringForLLMCorrection = unescapeStringForGeminiBug(originalParams.new_string);
195
- finalNewString = await correctNewString(client, originalParams.old_string, // original old
196
- llmCorrectedOldString, // corrected old
197
- baseNewStringForLLMCorrection, // base new for correction
198
- abortSignal);
199
- }
200
- }
201
- else {
202
- // LLM correction also failed for old_string
203
- const result = {
204
- params: { ...originalParams },
205
- occurrences: 0, // Explicitly 0 as LLM failed
206
- };
207
- editCorrectionCache.set(cacheKey, result);
208
- return result;
209
- }
210
- }
211
- else {
212
- // Unescaping old_string resulted in > 1 occurrence
213
- const result = {
214
- params: { ...originalParams },
215
- occurrences, // This will be > 1
216
- };
217
- editCorrectionCache.set(cacheKey, result);
218
- return result;
219
- }
220
- }
221
- const { targetString, pair } = trimPairIfPossible(finalOldString, finalNewString, currentContent, expectedReplacements);
222
- finalOldString = targetString;
223
- finalNewString = pair;
224
- // Final result construction
225
- const result = {
226
- params: {
227
- file_path: originalParams.file_path,
228
- old_string: finalOldString,
229
- new_string: finalNewString,
230
- },
231
- occurrences: countOccurrences(currentContent, finalOldString), // Recalculate occurrences with the final old_string
232
- };
233
- editCorrectionCache.set(cacheKey, result);
234
- return result;
235
- }
236
- export async function ensureCorrectFileContent(content, client, abortSignal) {
237
- const cachedResult = fileContentCorrectionCache.get(content);
238
- if (cachedResult) {
239
- return cachedResult;
240
- }
241
- const contentPotentiallyEscaped = unescapeStringForGeminiBug(content) !== content;
242
- if (!contentPotentiallyEscaped) {
243
- fileContentCorrectionCache.set(content, content);
244
- return content;
245
- }
246
- const correctedContent = await correctStringEscaping(content, client, abortSignal);
247
- fileContentCorrectionCache.set(content, correctedContent);
248
- return correctedContent;
249
- }
250
- // JSON schemas removed - using deterministic correction instead of LLM
251
- export async function correctOldStringMismatch(_geminiClient, fileContent, problematicSnippet, _abortSignal) {
252
- // Use deterministic correction instead of LLM
253
- return deterministicCorrectOldString(fileContent, problematicSnippet);
254
- }
255
- /**
256
- * Adjusts the new_string to align with a corrected old_string, maintaining the original intent.
257
- */
258
- export async function correctNewString(_geminiClient, originalOldString, correctedOldString, originalNewString, _abortSignal) {
259
- // Use deterministic correction instead of LLM
260
- return deterministicCorrectNewString(originalOldString, correctedOldString, originalNewString);
261
- }
262
- export async function correctNewStringEscaping(_geminiClient, oldString, potentiallyProblematicNewString, _abortSignal) {
263
- // Use deterministic correction instead of LLM
264
- return deterministicCorrectNewStringEscaping(oldString, potentiallyProblematicNewString);
265
- }
266
- export async function correctStringEscaping(potentiallyProblematicString, _client, _abortSignal) {
267
- // Use deterministic correction instead of LLM
268
- // This is a general string escaping correction without old_string context
269
- return deterministicCorrectNewStringEscaping('', potentiallyProblematicString);
270
- }
271
- function trimPairIfPossible(target, trimIfTargetTrims, currentContent, expectedReplacements) {
272
- const trimmedTargetString = target.trim();
273
- if (target.length !== trimmedTargetString.length) {
274
- const trimmedTargetOccurrences = countOccurrences(currentContent, trimmedTargetString);
275
- if (trimmedTargetOccurrences === expectedReplacements) {
276
- const trimmedReactiveString = trimIfTargetTrims.trim();
277
- return {
278
- targetString: trimmedTargetString,
279
- pair: trimmedReactiveString,
280
- };
281
- }
282
- }
283
- return {
284
- targetString: target,
285
- pair: trimIfTargetTrims,
286
- };
287
- }
288
- /**
289
- * Unescapes a string that might have been overly escaped by an LLM.
290
- */
291
- export function unescapeStringForGeminiBug(inputString) {
292
- // Regex explanation:
293
- // \\ : Matches exactly one literal backslash character.
294
- // (n|t|r|'|"|`|\\|\n) : This is a capturing group. It matches one of the following:
295
- // n, t, r, ', ", ` : These match the literal characters 'n', 't', 'r', single quote, double quote, or backtick.
296
- // This handles cases like "\\n", "\\`", etc.
297
- // \\ : This matches a literal backslash. This handles cases like "\\\\" (escaped backslash).
298
- // \n : This matches an actual newline character. This handles cases where the input
299
- // string might have something like "\\\n" (a literal backslash followed by a newline).
300
- // g : Global flag, to replace all occurrences.
301
- return inputString.replace(/\\+(n|t|r|'|"|`|\\|\n)/g, (match, capturedChar) => {
302
- // 'match' is the entire erroneous sequence, e.g., if the input (in memory) was "\\\\`", match is "\\\\`".
303
- // 'capturedChar' is the character that determines the true meaning, e.g., '`'.
304
- switch (capturedChar) {
305
- case 'n':
306
- return '\n'; // Correctly escaped: \n (newline character)
307
- case 't':
308
- return '\t'; // Correctly escaped: \t (tab character)
309
- case 'r':
310
- return '\r'; // Correctly escaped: \r (carriage return character)
311
- case "'":
312
- return "'"; // Correctly escaped: ' (apostrophe character)
313
- case '"':
314
- return '"'; // Correctly escaped: " (quotation mark character)
315
- case '`':
316
- return '`'; // Correctly escaped: ` (backtick character)
317
- case '\\': // This handles when 'capturedChar' is a literal backslash
318
- return '\\'; // Replace escaped backslash (e.g., "\\\\") with single backslash
319
- case '\n': // This handles when 'capturedChar' is an actual newline
320
- return '\n'; // Replace the whole erroneous sequence (e.g., "\\\n" in memory) with a clean newline
321
- default:
322
- // This fallback should ideally not be reached if the regex captures correctly.
323
- // It would return the original matched sequence if an unexpected character was captured.
324
- return match;
325
- }
326
- });
327
- }
328
- /**
329
- * Counts occurrences of a substring in a string
330
- */
331
- export function countOccurrences(str, substr) {
332
- if (substr === '') {
333
- return 0;
334
- }
335
- let count = 0;
336
- let pos = str.indexOf(substr);
337
- while (pos !== -1) {
338
- count++;
339
- pos = str.indexOf(substr, pos + substr.length); // Start search after the current match
340
- }
341
- return count;
342
- }
343
- export function resetEditCorrectorCaches_TEST_ONLY() {
344
- editCorrectionCache.clear();
345
- fileContentCorrectionCache.clear();
346
- }
347
- //# sourceMappingURL=editCorrector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editCorrector.js","sourceRoot":"","sources":["../../../src/utils/editCorrector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAkB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,kBAAkB,EAClB,cAAc,GACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,IAAI,CAAC;AAC5C,OAAO,EACL,wBAAwB,IAAI,6BAA6B,EACzD,gBAAgB,IAAI,6BAA6B,EACjD,wBAAwB,IAAI,qCAAqC,GAClE,MAAM,iCAAiC,CAAC;AAEzC,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,sCAAsC;AACtC,MAAM,mBAAmB,GAAG,IAAI,QAAQ,CACtC,cAAc,CACf,CAAC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