feat(core): Include file content in write_file tool response for immediate verification

This commit is contained in:
Christian Gunderman
2026-02-17 19:31:57 -08:00
parent ce84b3cb5f
commit 047a57dee8
2 changed files with 16 additions and 0 deletions

View File

@@ -831,6 +831,20 @@ describe('WriteFileTool', () => {
}
},
);
it('should include the file content in llmContent', async () => {
const filePath = path.join(rootDir, 'content_check.txt');
const content = 'This is the content that should be returned.';
mockEnsureCorrectFileContent.mockResolvedValue(content);
const params = { file_path: filePath, content };
const invocation = tool.build(params);
const result = await invocation.execute(abortSignal);
expect(result.llmContent).toContain('Here is the updated code:');
expect(result.llmContent).toContain(content);
});
});
describe('workspace boundary validation', () => {

View File

@@ -356,6 +356,8 @@ class WriteFileToolInvocation extends BaseToolInvocation<
);
}
llmSuccessMessageParts.push(`Here is the updated code:\n${finalContent}`);
// Log file operation for telemetry (without diff_stat to avoid double-counting)
const mimetype = getSpecificMimeType(this.resolvedPath);
const programmingLanguage = getLanguageFromFilePath(this.resolvedPath);