Method TryResolveToHostPath
- Namespace
- Oscova.Agents.Utils
- Assembly
- Oscova.Agents.dll
TryResolveToHostPath(string, IReadOnlyList<AllowedDirectory>, string?, out string)
THE PATH CONTRACT. This method translates agent-facing paths and checks logical workspace authorization. Physical workspace IO must use Oscova.Agents.Workspace.IWorkspaceFileAccess so authorization and filesystem access stay bound to held handles. The agent is only ever shown paths that resolve through this contract:
- sandbox mode:
/workspace/<name>,/self,/mnt/<label>; - host / disabled mode: the real host paths plus stable file-tool aliases.
In sandbox mode those agent-facing roots are bind-mounted into the container at exactly these paths, so a file tool (host IO) and the sandboxed shell see the same bytes. Relative paths resolve against the working directory in every mode. The argument is never mutated, so tool output keeps showing the agent the path it passed.
The invariant that keeps both surfaces consistent: never present the agent a path that does not resolve here / is not mounted into the sandbox. Tools may use this method for translation or validation, but must use Oscova.Agents.Workspace.IWorkspaceFileAccess for physical file access.
public static bool TryResolveToHostPath(string requestedPath, IReadOnlyList<AllowedDirectory> allowedDirectories, string? workingDirectoryHostPath, out string hostFullPath)Parameters
requestedPathstringallowedDirectoriesIReadOnlyList<AllowedDirectory>workingDirectoryHostPathstring?hostFullPathstring