extractWritePath pulls the path out of a write_file tool input so the approval prompt can name the target file. Returns "" on any parse failure — the caller falls back to a generic prompt.
(rawInput string)
| 204 | // approval prompt can name the target file. Returns "" on any parse |
| 205 | // failure — the caller falls back to a generic prompt. |
| 206 | func extractWritePath(rawInput string) string { |
| 207 | var in struct { |
| 208 | Path string `json:"path"` |
| 209 | } |
| 210 | if err := json.Unmarshal([]byte(rawInput), &in); err != nil { |
| 211 | return "" |
| 212 | } |
| 213 | return in.Path |
| 214 | } |