Documentation
¶
Overview ¶
Package agentview computes, for a workspace path, the access the agent would actually have — "see the tree as the agent sees it". A verdict is produced by running the agent's OWN gates against a hypothetical access, never a parallel reimplementation (which would drift). Two gates, both already server-side:
- Reachability — runtime/vfs View.Resolve (containment + symlink-escape resolution). A path that escapes the workspace root is unreachable.
- Policy verdict — hitlservice.Evaluate for the read and write sub-tools of local_fs, so "what would the policy do if the agent read/wrote path P" is exact: the same engine that gates real calls.
The synthetic path argument is workspace-root-relative — the same form the local_fs tool passes ("relative to the project root") — so verdicts match what the agent would actually get.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator binds a workspace View to a HITL policy evaluator. It holds no per-path state, so a single Evaluator is reused across every listed entry.
The policy the verdicts reflect is the one baked into hitl at construction; policyName records that policy's name (for reference/annotation) — the hitlservice.Service is the authority that actually evaluates.
func NewEvaluator ¶
NewEvaluator binds a workspace view + a HITL service already resolved to the session's active policy (policyName names that policy).
func (*Evaluator) PolicyName ¶
PolicyName returns the name of the policy these verdicts reflect.
func (*Evaluator) Verdict ¶
Verdict evaluates one workspace-root-relative path. Reachability is checked first; an unreachable path short-circuits to {Reachable:false} with empty actions (no policy evaluation). For directories Read is evaluated as local_fs.list_dir; Write is evaluated as local_fs.write_file for both files and directories (the create-inside proxy — the policy globs that gate writes key on the path prefix, which the directory path itself carries).
type Op ¶
type Op string
Op names the access being evaluated. Kept as a small vocabulary so callers can talk about the two dimensions a Verdict reports.
type Verdict ¶
type Verdict struct {
Reachable bool `json:"reachable"`
Read hitlservice.Action `json:"read,omitempty"`
Write hitlservice.Action `json:"write,omitempty"`
ReadReason string `json:"readReason,omitempty"`
WriteReason string `json:"writeReason,omitempty"`
}
Verdict is the agent's access to one path. Read/Write mirror hitlservice.Action ("allow" | "approve" | "deny"); they are empty when the path is not Reachable (no policy is evaluated in that case — the boundary is the answer). ReadReason/WriteReason explain a non-allow verdict (which rule / why) and are omitted for the uninteresting allow case to keep the payload quiet.