mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Various spelling improvements (#3497)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> Co-authored-by: Sandy Tao <sandytao520@icloud.com>
This commit is contained in:
@@ -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,
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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([]);
|
||||
});
|
||||
|
||||
|
||||
@@ -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.' },
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
@@ -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 `
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user