Table of Contents

Method TryResolveToHostPath

Namespace
Oscova.Agents.Utils
Assembly
Oscova.Agents.dll

TryResolveToHostPath(string, IReadOnlyList<AllowedDirectory>, string?, out string)

THE PATH CONTRACT. Every filesystem-facing tool (read, write, list, PDF, and any future or plugin tool) resolves an agent-supplied path to a host path through this one method, then does its IO on the host. The agent is only ever shown agent-facing paths:

  • sandbox mode: /workspace/<name>, /data, /mnt/<label>;
  • host / disabled mode: the real host paths of the OS the app runs on.

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. Any new tool must resolve through this method (or Oscova.Agents.Utils.PathHelper.ResolveToHostPath(System.String,System.Func{System.Collections.Generic.IReadOnlyList{Oscova.Agents.Workspace.AllowedDirectory}})) rather than calling System.IO on a raw argument.

public static bool TryResolveToHostPath(string requestedPath, IReadOnlyList<AllowedDirectory> allowedDirectories, string? workingDirectoryHostPath, out string hostFullPath)

Parameters

requestedPath string
allowedDirectories IReadOnlyList<AllowedDirectory>
workingDirectoryHostPath string?
hostFullPath string

Returns

bool