diff options
Diffstat (limited to 'packages/core/src/tools/write-file.ts')
| -rw-r--r-- | packages/core/src/tools/write-file.ts | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/packages/core/src/tools/write-file.ts b/packages/core/src/tools/write-file.ts index 87f6e21e..2d5e85be 100644 --- a/packages/core/src/tools/write-file.ts +++ b/packages/core/src/tools/write-file.ts @@ -45,6 +45,11 @@ export interface WriteFileToolParams { * The content to write to the file */ content: string; + + /** + * Whether the proposed content was modified by the user. + */ + modified_by_user?: boolean; } interface GetCorrectedFileContentResult { @@ -68,7 +73,9 @@ export class WriteFileTool super( WriteFileTool.Name, 'WriteFile', - 'Writes content to a specified file in the local filesystem.', + `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.`, { properties: { file_path: { @@ -270,9 +277,16 @@ export class WriteFileTool DEFAULT_DIFF_OPTIONS, ); - const llmSuccessMessage = isNewFile - ? `Successfully created and wrote to new file: ${params.file_path}` - : `Successfully overwrote file: ${params.file_path}`; + const llmSuccessMessageParts = [ + isNewFile + ? `Successfully created and wrote to new file: ${params.file_path}.` + : `Successfully overwrote file: ${params.file_path}.`, + ]; + if (params.modified_by_user) { + llmSuccessMessageParts.push( + `User modified the \`content\` to be: ${params.content}`, + ); + } const displayResult: FileDiff = { fileDiff, fileName }; @@ -298,7 +312,7 @@ export class WriteFileTool } return { - llmContent: llmSuccessMessage, + llmContent: llmSuccessMessageParts.join(' '), returnDisplay: displayResult, }; } catch (error) { @@ -395,6 +409,7 @@ export class WriteFileTool ) => ({ ...originalParams, content: modifiedProposedContent, + modified_by_user: true, }), }; } |
