Sandbox: add shared bind-aware fs path resolver

This commit is contained in:
Vignesh Natarajan
2026-02-14 16:53:43 -08:00
parent f18e3fba79
commit eafda6f526
3 changed files with 344 additions and 1 deletions

View File

@@ -30,11 +30,15 @@ function resolveToCwd(filePath: string, cwd: string): string {
return path.resolve(cwd, expanded);
}
export function resolveSandboxInputPath(filePath: string, cwd: string): string {
return resolveToCwd(filePath, cwd);
}
export function resolveSandboxPath(params: { filePath: string; cwd: string; root: string }): {
resolved: string;
relative: string;
} {
const resolved = resolveToCwd(params.filePath, params.cwd);
const resolved = resolveSandboxInputPath(params.filePath, params.cwd);
const rootResolved = path.resolve(params.root);
const relative = path.relative(rootResolved, resolved);
if (!relative || relative === "") {