diff options
Diffstat (limited to 'packages/core/src')
22 files changed, 41 insertions, 41 deletions
diff --git a/packages/core/src/code_assist/server.ts b/packages/core/src/code_assist/server.ts index a6cf6af7..7af643f7 100644 --- a/packages/core/src/code_assist/server.ts +++ b/packages/core/src/code_assist/server.ts @@ -9,7 +9,7 @@ import { CodeAssistGlobalUserSettingResponse, LoadCodeAssistRequest, LoadCodeAssistResponse, - LongrunningOperationResponse, + LongRunningOperationResponse, OnboardUserRequest, SetCodeAssistGlobalUserSettingRequest, } from './types.js'; @@ -79,8 +79,8 @@ export class CodeAssistServer implements ContentGenerator { async onboardUser( req: OnboardUserRequest, - ): Promise<LongrunningOperationResponse> { - return await this.requestPost<LongrunningOperationResponse>( + ): Promise<LongRunningOperationResponse> { + return await this.requestPost<LongRunningOperationResponse>( 'onboardUser', req, ); diff --git a/packages/core/src/code_assist/types.ts b/packages/core/src/code_assist/types.ts index 4c395e57..36718685 100644 --- a/packages/core/src/code_assist/types.ts +++ b/packages/core/src/code_assist/types.ts @@ -127,10 +127,10 @@ export interface OnboardUserRequest { } /** - * Represents LongrunningOperation proto + * Represents LongRunningOperation proto * http://google3/google/longrunning/operations.proto;rcl=698857719;l=107 */ -export interface LongrunningOperationResponse { +export interface LongRunningOperationResponse { name: string; done?: boolean; response?: OnboardUserResponse; diff --git a/packages/core/src/config/flashFallback.test.ts b/packages/core/src/config/flashFallback.test.ts index 325cc064..64f0f6fd 100644 --- a/packages/core/src/config/flashFallback.test.ts +++ b/packages/core/src/config/flashFallback.test.ts @@ -72,7 +72,7 @@ describe('Flash Model Fallback Configuration', () => { expect(config.getModel()).toBe(DEFAULT_GEMINI_FLASH_MODEL); }); - it('should fallback to initial model if contentGeneratorConfig is not available', () => { + it('should fall back to initial model if contentGeneratorConfig is not available', () => { // Test with fresh config where contentGeneratorConfig might not be set const newConfig = new Config({ sessionId: 'test-session-2', diff --git a/packages/core/src/core/__snapshots__/prompts.test.ts.snap b/packages/core/src/core/__snapshots__/prompts.test.ts.snap index 07ec166a..a69911cc 100644 --- a/packages/core/src/core/__snapshots__/prompts.test.ts.snap +++ b/packages/core/src/core/__snapshots__/prompts.test.ts.snap @@ -798,8 +798,8 @@ When requested to perform tasks like fixing bugs, adding features, refactoring, - **Feedback:** To report a bug or provide feedback, please use the /bug command. -# MacOS Seatbelt -You are running under macos seatbelt with limited access to files outside the project directory or system temp directory, and with limited access to host system resources such as ports. If you encounter failures that could be due to MacOS Seatbelt (e.g. if a command fails with 'Operation not permitted' or similar error), as you report the error to the user, also explain why you think it could be due to MacOS Seatbelt, and how the user may need to adjust their Seatbelt profile. +# macOS Seatbelt +You are running under macos seatbelt with limited access to files outside the project directory or system temp directory, and with limited access to host system resources such as ports. If you encounter failures that could be due to macOS Seatbelt (e.g. if a command fails with 'Operation not permitted' or similar error), as you report the error to the user, also explain why you think it could be due to macOS Seatbelt, and how the user may need to adjust their Seatbelt profile. diff --git a/packages/core/src/core/client.ts b/packages/core/src/core/client.ts index aadc446c..9a3acae3 100644 --- a/packages/core/src/core/client.ts +++ b/packages/core/src/core/client.ts @@ -665,8 +665,8 @@ export class GeminiClient { } /** - * Handles fallback to Flash model when persistent 429 errors occur for OAuth users. - * Uses a fallback handler if provided by the config, otherwise returns null. + * Handles falling back to Flash model when persistent 429 errors occur for OAuth users. + * Uses a fallback handler if provided by the config; otherwise, returns null. */ private async handleFlashFallback( authType?: string, diff --git a/packages/core/src/core/contentGenerator.ts b/packages/core/src/core/contentGenerator.ts index 721a16d7..44ed7beb 100644 --- a/packages/core/src/core/contentGenerator.ts +++ b/packages/core/src/core/contentGenerator.ts @@ -62,7 +62,7 @@ export function createContentGeneratorConfig( const googleCloudProject = process.env.GOOGLE_CLOUD_PROJECT || undefined; const googleCloudLocation = process.env.GOOGLE_CLOUD_LOCATION || undefined; - // Use runtime model from config if available, otherwise fallback to parameter or default + // Use runtime model from config if available; otherwise, fall back to parameter or default const effectiveModel = config.getModel() || DEFAULT_GEMINI_MODEL; const contentGeneratorConfig: ContentGeneratorConfig = { diff --git a/packages/core/src/core/geminiChat.ts b/packages/core/src/core/geminiChat.ts index f93470dd..e963b781 100644 --- a/packages/core/src/core/geminiChat.ts +++ b/packages/core/src/core/geminiChat.ts @@ -201,8 +201,8 @@ export class GeminiChat { } /** - * Handles fallback to Flash model when persistent 429 errors occur for OAuth users. - * Uses a fallback handler if provided by the config, otherwise returns null. + * Handles falling back to Flash model when persistent 429 errors occur for OAuth users. + * Uses a fallback handler if provided by the config; otherwise, returns null. */ private async handleFlashFallback( authType?: string, diff --git a/packages/core/src/core/logger.test.ts b/packages/core/src/core/logger.test.ts index 848a2ce1..84cc1a0f 100644 --- a/packages/core/src/core/logger.test.ts +++ b/packages/core/src/core/logger.test.ts @@ -453,7 +453,7 @@ describe('Logger', () => { }); it('should return an empty array if a tagged checkpoint file does not exist', async () => { - const loaded = await logger.loadCheckpoint('non-existent-tag'); + const loaded = await logger.loadCheckpoint('nonexistent-tag'); expect(loaded).toEqual([]); }); diff --git a/packages/core/src/core/nonInteractiveToolExecutor.test.ts b/packages/core/src/core/nonInteractiveToolExecutor.test.ts index d52efb06..1bbb9209 100644 --- a/packages/core/src/core/nonInteractiveToolExecutor.test.ts +++ b/packages/core/src/core/nonInteractiveToolExecutor.test.ts @@ -106,7 +106,7 @@ describe('executeToolCall', () => { it('should return an error if tool is not found', async () => { const request: ToolCallRequestInfo = { callId: 'call2', - name: 'nonExistentTool', + name: 'nonexistentTool', args: {}, isClientInitiated: false, prompt_id: 'prompt-id-2', @@ -123,17 +123,17 @@ describe('executeToolCall', () => { expect(response.callId).toBe('call2'); expect(response.error).toBeInstanceOf(Error); expect(response.error?.message).toBe( - 'Tool "nonExistentTool" not found in registry.', + 'Tool "nonexistentTool" not found in registry.', ); expect(response.resultDisplay).toBe( - 'Tool "nonExistentTool" not found in registry.', + 'Tool "nonexistentTool" not found in registry.', ); expect(response.responseParts).toEqual([ { functionResponse: { - name: 'nonExistentTool', + name: 'nonexistentTool', id: 'call2', - response: { error: 'Tool "nonExistentTool" not found in registry.' }, + response: { error: 'Tool "nonexistentTool" not found in registry.' }, }, }, ]); diff --git a/packages/core/src/core/prompts.test.ts b/packages/core/src/core/prompts.test.ts index bb7b0b52..b994de98 100644 --- a/packages/core/src/core/prompts.test.ts +++ b/packages/core/src/core/prompts.test.ts @@ -67,7 +67,7 @@ describe('Core System Prompt (prompts.ts)', () => { vi.stubEnv('SANDBOX', 'true'); // Generic sandbox value const prompt = getCoreSystemPrompt(); expect(prompt).toContain('# Sandbox'); - expect(prompt).not.toContain('# MacOS Seatbelt'); + expect(prompt).not.toContain('# macOS Seatbelt'); expect(prompt).not.toContain('# Outside of Sandbox'); expect(prompt).toMatchSnapshot(); }); @@ -75,7 +75,7 @@ describe('Core System Prompt (prompts.ts)', () => { it('should include seatbelt-specific instructions when SANDBOX env var is "sandbox-exec"', () => { vi.stubEnv('SANDBOX', 'sandbox-exec'); const prompt = getCoreSystemPrompt(); - expect(prompt).toContain('# MacOS Seatbelt'); + expect(prompt).toContain('# macOS Seatbelt'); expect(prompt).not.toContain('# Sandbox'); expect(prompt).not.toContain('# Outside of Sandbox'); expect(prompt).toMatchSnapshot(); @@ -86,7 +86,7 @@ describe('Core System Prompt (prompts.ts)', () => { const prompt = getCoreSystemPrompt(); expect(prompt).toContain('# Outside of Sandbox'); expect(prompt).not.toContain('# Sandbox'); - expect(prompt).not.toContain('# MacOS Seatbelt'); + expect(prompt).not.toContain('# macOS Seatbelt'); expect(prompt).toMatchSnapshot(); }); diff --git a/packages/core/src/core/prompts.ts b/packages/core/src/core/prompts.ts index 3b23f735..08df3ba2 100644 --- a/packages/core/src/core/prompts.ts +++ b/packages/core/src/core/prompts.ts @@ -116,8 +116,8 @@ ${(function () { if (isSandboxExec) { return ` -# MacOS Seatbelt -You are running under macos seatbelt with limited access to files outside the project directory or system temp directory, and with limited access to host system resources such as ports. If you encounter failures that could be due to MacOS Seatbelt (e.g. if a command fails with 'Operation not permitted' or similar error), as you report the error to the user, also explain why you think it could be due to MacOS Seatbelt, and how the user may need to adjust their Seatbelt profile. +# macOS Seatbelt +You are running under macos seatbelt with limited access to files outside the project directory or system temp directory, and with limited access to host system resources such as ports. If you encounter failures that could be due to macOS Seatbelt (e.g. if a command fails with 'Operation not permitted' or similar error), as you report the error to the user, also explain why you think it could be due to macOS Seatbelt, and how the user may need to adjust their Seatbelt profile. `; } else if (isGenericSandbox) { return ` diff --git a/packages/core/src/services/ideContext.ts b/packages/core/src/services/ideContext.ts index 349bff59..f8a50f12 100644 --- a/packages/core/src/services/ideContext.ts +++ b/packages/core/src/services/ideContext.ts @@ -86,7 +86,7 @@ export function createIdeContextStore() { /** * Retrieves the current active file context. - * @returns The `OpenFiles` object if a file is active, otherwise `undefined`. + * @returns The `OpenFiles` object if a file is active; otherwise, `undefined`. */ function getOpenFilesContext(): OpenFiles | undefined { return openFilesContext; diff --git a/packages/core/src/tools/edit.ts b/packages/core/src/tools/edit.ts index 87a2ea44..fd936611 100644 --- a/packages/core/src/tools/edit.ts +++ b/packages/core/src/tools/edit.ts @@ -209,7 +209,7 @@ Expectation for required parameters: // Creating a new file isNewFile = true; } else if (!fileExists) { - // Trying to edit a non-existent file (and old_string is not empty) + // Trying to edit a nonexistent file (and old_string is not empty) error = { display: `File not found. Cannot apply edit. Use an empty old_string to create a new file.`, raw: `File not found: ${params.file_path}`, @@ -239,12 +239,12 @@ Expectation for required parameters: raw: `Failed to edit, 0 occurrences found for old_string in ${params.file_path}. No edits made. The exact text in old_string was not found. Ensure you're not escaping content incorrectly and check whitespace, indentation, and context. Use ${ReadFileTool.Name} tool to verify.`, }; } else if (occurrences !== expectedReplacements) { - const occurenceTerm = + const occurrenceTerm = expectedReplacements === 1 ? 'occurrence' : 'occurrences'; error = { - display: `Failed to edit, expected ${expectedReplacements} ${occurenceTerm} but found ${occurrences}.`, - raw: `Failed to edit, Expected ${expectedReplacements} ${occurenceTerm} but found ${occurrences} for old_string in file: ${params.file_path}`, + display: `Failed to edit, expected ${expectedReplacements} ${occurrenceTerm} but found ${occurrences}.`, + raw: `Failed to edit, Expected ${expectedReplacements} ${occurrenceTerm} but found ${occurrences} for old_string in file: ${params.file_path}`, }; } else if (finalOldString === finalNewString) { error = { diff --git a/packages/core/src/tools/grep.test.ts b/packages/core/src/tools/grep.test.ts index 2e018cce..09dec35f 100644 --- a/packages/core/src/tools/grep.test.ts +++ b/packages/core/src/tools/grep.test.ts @@ -17,7 +17,7 @@ vi.mock('child_process', () => ({ on: (event: string, cb: (...args: unknown[]) => void) => { if (event === 'error' || event === 'close') { // Simulate command not found or error for git grep and system grep - // to force fallback to JS implementation. + // to force it to fall back to JS implementation. setTimeout(() => cb(1), 0); // cb(1) for error/close } }, diff --git a/packages/core/src/tools/read-many-files.test.ts b/packages/core/src/tools/read-many-files.test.ts index adad6efc..641aa705 100644 --- a/packages/core/src/tools/read-many-files.test.ts +++ b/packages/core/src/tools/read-many-files.test.ts @@ -272,7 +272,7 @@ describe('ReadManyFilesTool', () => { ); }); - it('should handle non-existent specific files gracefully', async () => { + it('should handle nonexistent specific files gracefully', async () => { const params = { paths: ['nonexistent-file.txt'] }; const result = await tool.execute(params, new AbortController().signal); expect(result.llmContent).toEqual([ diff --git a/packages/core/src/utils/editCorrector.test.ts b/packages/core/src/utils/editCorrector.test.ts index cf9008ef..cd588312 100644 --- a/packages/core/src/utils/editCorrector.test.ts +++ b/packages/core/src/utils/editCorrector.test.ts @@ -81,7 +81,7 @@ describe('editCorrector', () => { it('should correctly count occurrences when substring is longer', () => { expect(countOccurrences('abc', 'abcdef')).toBe(0); }); - it('should be case sensitive', () => { + it('should be case-sensitive', () => { expect(countOccurrences('abcABC', 'a')).toBe(1); expect(countOccurrences('abcABC', 'A')).toBe(1); }); diff --git a/packages/core/src/utils/editor.test.ts b/packages/core/src/utils/editor.test.ts index 86274be2..a86d6f59 100644 --- a/packages/core/src/utils/editor.test.ts +++ b/packages/core/src/utils/editor.test.ts @@ -202,7 +202,7 @@ describe('editor utils', () => { }); } - it(`should fallback to last command "${commands[commands.length - 1]}" when none exist on non-windows`, () => { + it(`should fall back to last command "${commands[commands.length - 1]}" when none exist on non-windows`, () => { Object.defineProperty(process, 'platform', { value: 'linux' }); (execSync as Mock).mockImplementation(() => { throw new Error(); // all commands not found @@ -247,7 +247,7 @@ describe('editor utils', () => { }); } - it(`should fallback to last command "${win32Commands[win32Commands.length - 1]}" when none exist on windows`, () => { + it(`should fall back to last command "${win32Commands[win32Commands.length - 1]}" when none exist on windows`, () => { Object.defineProperty(process, 'platform', { value: 'win32' }); (execSync as Mock).mockImplementation(() => { throw new Error(); // all commands not found diff --git a/packages/core/src/utils/fileUtils.test.ts b/packages/core/src/utils/fileUtils.test.ts index 34aff79b..b8e75561 100644 --- a/packages/core/src/utils/fileUtils.test.ts +++ b/packages/core/src/utils/fileUtils.test.ts @@ -42,7 +42,7 @@ describe('fileUtils', () => { let testImageFilePath: string; let testPdfFilePath: string; let testBinaryFilePath: string; - let nonExistentFilePath: string; + let nonexistentFilePath: string; let directoryPath: string; beforeEach(() => { @@ -57,7 +57,7 @@ describe('fileUtils', () => { testImageFilePath = path.join(tempRootDir, 'image.png'); testPdfFilePath = path.join(tempRootDir, 'document.pdf'); testBinaryFilePath = path.join(tempRootDir, 'app.exe'); - nonExistentFilePath = path.join(tempRootDir, 'notfound.txt'); + nonexistentFilePath = path.join(tempRootDir, 'nonexistent.txt'); directoryPath = path.join(tempRootDir, 'subdir'); actualNodeFs.mkdirSync(directoryPath, { recursive: true }); // Ensure subdir exists @@ -284,7 +284,7 @@ describe('fileUtils', () => { it('should handle file not found', async () => { const result = await processSingleFileContent( - nonExistentFilePath, + nonexistentFilePath, tempRootDir, ); expect(result.error).toContain('File not found'); diff --git a/packages/core/src/utils/fileUtils.ts b/packages/core/src/utils/fileUtils.ts index 1489c4ee..6b5ce42c 100644 --- a/packages/core/src/utils/fileUtils.ts +++ b/packages/core/src/utils/fileUtils.ts @@ -185,7 +185,7 @@ export async function detectFileType( return 'binary'; } - // Fallback to content-based check if mime type wasn't conclusive for image/pdf + // Fall back to content-based check if mime type wasn't conclusive for image/pdf // and it's not a known binary extension. if (await isBinaryFile(filePath)) { return 'binary'; diff --git a/packages/core/src/utils/getFolderStructure.test.ts b/packages/core/src/utils/getFolderStructure.test.ts index b6354745..b2da4aab 100644 --- a/packages/core/src/utils/getFolderStructure.test.ts +++ b/packages/core/src/utils/getFolderStructure.test.ts @@ -245,7 +245,7 @@ Showing up to 1 items (files + folders). Folders or files indicated with ... con expect(structure.trim()).toBe(expectedRevisedMax1); }); - it('should handle non-existent directory', async () => { + it('should handle nonexistent directory', async () => { // Temporarily make fsPromises.readdir throw ENOENT for this specific path const originalReaddir = fsPromises.readdir; (fsPromises.readdir as Mock).mockImplementation( diff --git a/packages/core/src/utils/paths.ts b/packages/core/src/utils/paths.ts index 16adbee4..3382c588 100644 --- a/packages/core/src/utils/paths.ts +++ b/packages/core/src/utils/paths.ts @@ -44,7 +44,7 @@ export function shortenPath(filePath: string, maxLen: number = 35): string { // Handle cases with no segments after root (e.g., "/", "C:\") or only one segment if (segments.length <= 1) { - // Fallback to simple start/end truncation for very short paths or single segments + // Fall back to simple start/end truncation for very short paths or single segments const keepLen = Math.floor((maxLen - 3) / 2); // Ensure keepLen is not negative if maxLen is very small if (keepLen <= 0) { diff --git a/packages/core/src/utils/retry.ts b/packages/core/src/utils/retry.ts index bf4532bc..b29bf7df 100644 --- a/packages/core/src/utils/retry.ts +++ b/packages/core/src/utils/retry.ts @@ -196,7 +196,7 @@ export async function retryWithBackoff<T>( // Reset currentDelay for next potential non-429 error, or if Retry-After is not present next time currentDelay = initialDelayMs; } else { - // Fallback to exponential backoff with jitter + // Fall back to exponential backoff with jitter logRetryAttempt(attempt, error, errorStatus); // Add jitter: +/- 30% of currentDelay const jitter = currentDelay * 0.3 * (Math.random() * 2 - 1); |
