mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-12 19:10:55 -07:00
fix(core): fix three JIT context bugs in read_file, read_many_files, and memoryDiscovery (#22679)
This commit is contained in:
@@ -20,7 +20,7 @@ import {
|
||||
import { ToolErrorType } from './tool-error.js';
|
||||
import { buildFilePathArgsPattern } from '../policy/utils.js';
|
||||
|
||||
import type { PartUnion } from '@google/genai';
|
||||
import type { PartListUnion } from '@google/genai';
|
||||
import {
|
||||
processSingleFileContent,
|
||||
getSpecificMimeType,
|
||||
@@ -34,7 +34,11 @@ import { READ_FILE_TOOL_NAME, READ_FILE_DISPLAY_NAME } from './tool-names.js';
|
||||
import { FileDiscoveryService } from '../services/fileDiscoveryService.js';
|
||||
import { READ_FILE_DEFINITION } from './definitions/coreTools.js';
|
||||
import { resolveToolDeclaration } from './definitions/resolver.js';
|
||||
import { discoverJitContext, appendJitContext } from './jit-context.js';
|
||||
import {
|
||||
discoverJitContext,
|
||||
appendJitContext,
|
||||
appendJitContextToParts,
|
||||
} from './jit-context.js';
|
||||
|
||||
/**
|
||||
* Parameters for the ReadFile tool
|
||||
@@ -135,7 +139,7 @@ class ReadFileToolInvocation extends BaseToolInvocation<
|
||||
};
|
||||
}
|
||||
|
||||
let llmContent: PartUnion;
|
||||
let llmContent: PartListUnion;
|
||||
if (result.isTruncated) {
|
||||
const [start, end] = result.linesShown!;
|
||||
const total = result.originalLineCount!;
|
||||
@@ -173,8 +177,12 @@ ${result.llmContent}`;
|
||||
|
||||
// Discover JIT subdirectory context for the accessed file path
|
||||
const jitContext = await discoverJitContext(this.config, this.resolvedPath);
|
||||
if (jitContext && typeof llmContent === 'string') {
|
||||
llmContent = appendJitContext(llmContent, jitContext);
|
||||
if (jitContext) {
|
||||
if (typeof llmContent === 'string') {
|
||||
llmContent = appendJitContext(llmContent, jitContext);
|
||||
} else {
|
||||
llmContent = appendJitContextToParts(llmContent, jitContext);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user