feat: add Apply Patch tool with patch input and diff view (#196)

* feat: add Apply Patch tool with patch input and diff view

Introduce Apply Patch tool with a patch input field and diff preview
Display target file path or file count for patch operations in tool UI
Update status label to show applying patch during execution

* fix: include apply_patch in editing tools detection
This commit is contained in:
Bohdan Triapitsyn
2026-01-22 19:09:07 +02:00
committed by GitHub
parent ef4d37df09
commit 87175566b9
6 changed files with 47 additions and 13 deletions
+15
View File
@@ -52,6 +52,14 @@ export const TOOL_METADATA: Record<string, ToolMetadata> = {
{ key: 'edits', label: 'Edits', type: 'code', language: 'json' }
]
},
apply_patch: {
displayName: 'Apply Patch',
category: 'file',
outputLanguage: 'diff',
inputFields: [
{ key: 'patchText', label: 'Patch', type: 'code', language: 'diff' }
]
},
bash: {
displayName: 'Shell Command',
@@ -665,6 +673,13 @@ export function formatToolInput(input: Record<string, unknown>, toolName: string
if (desc) return desc;
}
if (toolName === 'apply_patch' && typeof input === 'object') {
const patchText = getString('patchText') || getString('patch_text') || getString('patch');
if (patchText) {
return patchText;
}
}
if ((toolName === 'edit' || toolName === 'multiedit') && typeof input === 'object') {
const filePath = getString('filePath') || getString('file_path') || getString('path');
if (filePath) {