mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-03 18:00:48 -07:00
Co-authored-by: Dev Randalpura <devrandalpura@google.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import * as path from 'node:path';
|
||||
import type { FileDiscoveryService } from '../services/fileDiscoveryService.js';
|
||||
import type { FileFilteringOptions } from '../config/constants.js';
|
||||
import { debugLogger } from './debugLogger.js';
|
||||
import { getErrorMessage } from './errors.js';
|
||||
// Simple console logger for now.
|
||||
// TODO: Integrate with a more robust server-side logger.
|
||||
const logger = {
|
||||
@@ -80,10 +81,8 @@ export async function bfsFileSearch(
|
||||
return { currentDir, entries };
|
||||
} catch (error) {
|
||||
// Warn user that a directory could not be read, as this affects search results.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
const message = (error as Error)?.message ?? 'Unknown error';
|
||||
debugLogger.warn(
|
||||
`[WARN] Skipping unreadable directory: ${currentDir} (${message})`,
|
||||
`[WARN] Skipping unreadable directory: ${currentDir} (${getErrorMessage(error)})`,
|
||||
);
|
||||
if (debug) {
|
||||
logger.debug(`Full error for ${currentDir}:`, error);
|
||||
@@ -154,10 +153,8 @@ export function bfsFileSearchSync(
|
||||
foundFiles,
|
||||
);
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
const message = (error as Error)?.message ?? 'Unknown error';
|
||||
debugLogger.warn(
|
||||
`[WARN] Skipping unreadable directory: ${currentDir} (${message})`,
|
||||
`[WARN] Skipping unreadable directory: ${currentDir} (${getErrorMessage(error)})`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,12 +49,12 @@ export function generateCheckpointFileName(
|
||||
toolCall: ToolCallRequestInfo,
|
||||
): string | null {
|
||||
const toolArgs = toolCall.args;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
const toolFilePath = toolArgs['file_path'] as string;
|
||||
const rawFilePath = toolArgs['file_path'];
|
||||
|
||||
if (!toolFilePath) {
|
||||
if (typeof rawFilePath !== 'string' || !rawFilePath) {
|
||||
return null;
|
||||
}
|
||||
const toolFilePath = rawFilePath;
|
||||
|
||||
const timestamp = new Date()
|
||||
.toISOString()
|
||||
@@ -168,11 +168,14 @@ export function getCheckpointInfoList(
|
||||
|
||||
for (const [file, content] of checkpointFiles) {
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
const toolCallData = JSON.parse(content) as ToolCallData;
|
||||
if (toolCallData.messageId) {
|
||||
const parsed: unknown = JSON.parse(content);
|
||||
const result = z
|
||||
.object({ messageId: z.string() })
|
||||
.passthrough()
|
||||
.safeParse(parsed);
|
||||
if (result.success) {
|
||||
checkpointInfoList.push({
|
||||
messageId: toolCallData.messageId,
|
||||
messageId: result.data.messageId,
|
||||
checkpoint: file.replace('.json', ''),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user