Compare commits

...

2 Commits

5 changed files with 11 additions and 8 deletions

View File

@ -667,12 +667,12 @@ exports[`coreTools snapshots for specific models > Model: gemini-2.5-pro > snaps
{ {
"description": "Writes content to a specified file in the local filesystem. "description": "Writes content to a specified file in the local filesystem.
The user has the ability to modify \`content\`. If modified, this will be stated in the response.", The user has the ability to modify \`content\`. If modified, this will be stated in the response. WARNING: Do NOT use this tool if the file contains massive literal text sequences (like a 6000+ character string, large arrays, or inline base64 images), as LLMs are prone to corrupting or truncating such sequences during a full file rewrite. Use the 'replace' tool instead.",
"name": "write_file", "name": "write_file",
"parametersJsonSchema": { "parametersJsonSchema": {
"properties": { "properties": {
"content": { "content": {
"description": "The content to write to the file. Do not use omission placeholders like '(rest of methods ...)', '...', or 'unchanged code'; provide complete literal content.", "description": "The content to write to the file. Do not use omission placeholders like '(rest of methods ...)', '...', or 'unchanged code'; provide complete literal content. WARNING: Do not use this tool to rewrite files containing massive literal text blocks (e.g., inline base64 images or >6000 character strings) because you may corrupt them. Use the replace tool instead.",
"type": "string", "type": "string",
}, },
"file_path": { "file_path": {
@ -1439,12 +1439,12 @@ exports[`coreTools snapshots for specific models > Model: gemini-3-pro-preview >
exports[`coreTools snapshots for specific models > Model: gemini-3-pro-preview > snapshot for tool: write_file 1`] = ` exports[`coreTools snapshots for specific models > Model: gemini-3-pro-preview > snapshot for tool: write_file 1`] = `
{ {
"description": "Writes the complete content to a file, automatically creating missing parent directories. Overwrites existing files. The user has the ability to modify 'content' before it is saved. Best for new or small files; use 'replace' for targeted edits to large files to minimize token usage and simplify reviews.", "description": "Writes the complete content to a file, automatically creating missing parent directories. Overwrites existing files. The user has the ability to modify 'content' before it is saved. Best for new or small files; use 'replace' for targeted edits to large files to minimize token usage and simplify reviews. WARNING: Do NOT use this tool if the file contains massive literal text sequences (like a 6000+ character string, large arrays, or inline base64 images), as LLMs are prone to corrupting or truncating such sequences during a full file rewrite. Use the 'replace' tool instead.",
"name": "write_file", "name": "write_file",
"parametersJsonSchema": { "parametersJsonSchema": {
"properties": { "properties": {
"content": { "content": {
"description": "The complete content to write. Provide the full file; do not use placeholders like '// ... rest of code'.", "description": "The complete content to write. Provide the full file; do not use placeholders like '// ... rest of code'. WARNING: Do not use this tool to rewrite files containing massive literal text blocks (e.g., inline base64 images or >6000 character strings) because you may corrupt them. Use the replace tool instead.",
"type": "string", "type": "string",
}, },
"file_path": { "file_path": {

View File

@ -112,7 +112,7 @@ export const DEFAULT_LEGACY_SET: CoreToolSet = {
name: WRITE_FILE_TOOL_NAME, name: WRITE_FILE_TOOL_NAME,
description: `Writes content to a specified file in the local filesystem. description: `Writes content to a specified file in the local filesystem.
The user has the ability to modify \`content\`. If modified, this will be stated in the response.`, The user has the ability to modify \`content\`. If modified, this will be stated in the response. WARNING: Do NOT use this tool if the file contains massive literal text sequences (like a 6000+ character string, large arrays, or inline base64 images), as LLMs are prone to corrupting or truncating such sequences during a full file rewrite. Use the '${EDIT_TOOL_NAME}' tool instead.`,
parametersJsonSchema: { parametersJsonSchema: {
type: 'object', type: 'object',
properties: { properties: {
@ -122,7 +122,7 @@ export const DEFAULT_LEGACY_SET: CoreToolSet = {
}, },
[WRITE_FILE_PARAM_CONTENT]: { [WRITE_FILE_PARAM_CONTENT]: {
description: description:
"The content to write to the file. Do not use omission placeholders like '(rest of methods ...)', '...', or 'unchanged code'; provide complete literal content.", "The content to write to the file. Do not use omission placeholders like '(rest of methods ...)', '...', or 'unchanged code'; provide complete literal content. WARNING: Do not use this tool to rewrite files containing massive literal text blocks (e.g., inline base64 images or >6000 character strings) because you may corrupt them. Use the replace tool instead.",
type: 'string', type: 'string',
}, },
}, },

View File

@ -119,7 +119,7 @@ export const GEMINI_3_SET: CoreToolSet = {
write_file: { write_file: {
name: WRITE_FILE_TOOL_NAME, name: WRITE_FILE_TOOL_NAME,
description: `Writes the complete content to a file, automatically creating missing parent directories. Overwrites existing files. The user has the ability to modify 'content' before it is saved. Best for new or small files; use '${EDIT_TOOL_NAME}' for targeted edits to large files to minimize token usage and simplify reviews.`, description: `Writes the complete content to a file, automatically creating missing parent directories. Overwrites existing files. The user has the ability to modify 'content' before it is saved. Best for new or small files; use '${EDIT_TOOL_NAME}' for targeted edits to large files to minimize token usage and simplify reviews. WARNING: Do NOT use this tool if the file contains massive literal text sequences (like a 6000+ character string, large arrays, or inline base64 images), as LLMs are prone to corrupting or truncating such sequences during a full file rewrite. Use the '${EDIT_TOOL_NAME}' tool instead.`,
parametersJsonSchema: { parametersJsonSchema: {
type: 'object', type: 'object',
properties: { properties: {
@ -129,7 +129,7 @@ export const GEMINI_3_SET: CoreToolSet = {
}, },
[WRITE_FILE_PARAM_CONTENT]: { [WRITE_FILE_PARAM_CONTENT]: {
description: description:
"The complete content to write. Provide the full file; do not use placeholders like '// ... rest of code'.", "The complete content to write. Provide the full file; do not use placeholders like '// ... rest of code'. WARNING: Do not use this tool to rewrite files containing massive literal text blocks (e.g., inline base64 images or >6000 character strings) because you may corrupt them. Use the replace tool instead.",
type: 'string', type: 'string',
}, },
}, },

View File

@ -9,6 +9,8 @@ import { detectOmissionPlaceholders } from './omissionPlaceholderDetector.js';
describe('detectOmissionPlaceholders', () => { describe('detectOmissionPlaceholders', () => {
it('detects standalone placeholder lines', () => { it('detects standalone placeholder lines', () => {
expect(detectOmissionPlaceholders('...')).toEqual([' ...']);
expect(detectOmissionPlaceholders('// ...')).toEqual([' ...']);
expect(detectOmissionPlaceholders('(rest of methods ...)')).toEqual([ expect(detectOmissionPlaceholders('(rest of methods ...)')).toEqual([
'rest of methods ...', 'rest of methods ...',
]); ]);

View File

@ -5,6 +5,7 @@
*/ */
const OMITTED_PREFIXES = new Set([ const OMITTED_PREFIXES = new Set([
'',
'rest of', 'rest of',
'rest of method', 'rest of method',
'rest of methods', 'rest of methods',