(root: string)
| 21 | }; |
| 22 | |
| 23 | function normalizeWorkspaceRoot(root: string): string { |
| 24 | const trimmed = root.trim().replace(/\\/g, "/").replace(/\/+$/, ""); |
| 25 | if (!trimmed) return ""; |
| 26 | // Keep Windows drive roots (`C:` / `C:/repo`) and POSIX absolutes as-is. |
| 27 | if (trimmed.startsWith("/") || /^[A-Za-z]:(\/|$)/.test(trimmed)) { |
| 28 | return trimmed; |
| 29 | } |
| 30 | return `/${trimmed}`; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Convert an agent/chat file path into a workspace-relative path for the Files |