(sessionId: string, metadata: ToolInput)
| 97 | } |
| 98 | |
| 99 | private async writeProposedEdit(sessionId: string, metadata: ToolInput) { |
| 100 | const filepath = stringValue(metadata.filepath) |
| 101 | const diff = stringValue(metadata.diff) |
| 102 | if (!filepath || !diff || !this.input.connection.writeTextFile) return |
| 103 | |
| 104 | const content = (await exists(filepath)) ? await readText(filepath) : "" |
| 105 | const next = applyPatch(content, diff) |
| 106 | if (next === false) { |
| 107 | return |
| 108 | } |
| 109 | |
| 110 | void this.input.connection.writeTextFile({ |
| 111 | sessionId, |
| 112 | path: filepath, |
| 113 | content: next, |
| 114 | }) |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | async function permissionToolCall(input: { |
no test coverage detected