Class PathPolicy
java.lang.Object
io.agentscope.harness.agent.workspace.PathPolicy
Immutable allow-list of host directories that
LocalFsMode.ROOTED accepts for absolute
paths. Each root is stored absolute-normalized so child-of checks are cheap.
The Claude-Code-style two-layer Local FS uses PathPolicy.of(project, workspace,
additionalRoots) to bound the agent's reach without forcing it into a single hard sandbox.
Empty policy (empty()) rejects every absolute path; use it only when the caller
intends to fall back to relative-only access.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PathPolicyempty()Returns a policy that allows no absolute paths.booleaninthashCode()booleantruewhencandidateis equal to or below one of the configured roots.booleanisEmpty()truewhen no roots are configured.static PathPolicyBuilds a policy from one or more roots.static PathPolicyof(Collection<Path> roots) Builds a policy from a collection of roots.roots()Returns the configured roots in insertion order.toString()
-
Method Details
-
empty
Returns a policy that allows no absolute paths. -
of
Builds a policy from one or more roots.nullentries are skipped; remaining roots are absolute-normalized. -
of
Builds a policy from a collection of roots.nullentries are skipped. -
roots
Returns the configured roots in insertion order. -
isEmpty
public boolean isEmpty()truewhen no roots are configured. -
isAllowed
truewhencandidateis equal to or below one of the configured roots. Caller must pass an absolute path; relative paths returnfalse. -
equals
-
hashCode
public int hashCode() -
toString
-