Documentation
¶
Overview ¶
Package tools is the allowlisted, read-only tool set an investigator model uses to look at a target.
The model reads the target through these tools and nothing else. There is no shell, no write and no network tool here, so text planted in the target has nothing to drive. Every path a model supplies goes through walk.Resolve, every result is redacted and then sealed in an envelope, and limits (output size, result counts, line windows) are constants in Go that no argument can raise past their caps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶ added in v0.2.0
type Cache struct {
// contains filtered or unexported fields
}
Cache holds what is expensive to compute and the same for every stage of a run: the listing of the target and, per file, the result of the secret scan. It is safe for concurrent use.
type Env ¶
type Env struct {
Root string // absolute path of the target root
Sealer *envelope.Sealer // wraps every result as untrusted data
MaxOutput int // max bytes of content per result; 0 means 24000
Walk walk.Options // configured path exclusions and inclusions
// Cache, when set, is shared by every registry of a run, so the target
// is listed once and a file is scanned for secrets once. A registry
// with no Cache keeps its own.
Cache *Cache
}
Env is what tools may touch.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the tools one investigator may call.
func NewNetworkRegistry ¶
NewNetworkRegistry returns a registry with no file tools, for a target that is a running application rather than a directory. Tools are added with Add (the scope-bound http_request tool). Results are still truncated, redacted and enveloped by Call.
func NewRegistry ¶
NewRegistry returns the read-only code tools for env: read_file, list_dir, grep, find_symbol, find_references, git_log, git_show.
func (*Registry) Add ¶
Add registers an extra tool (used later for http_request). It panics on a duplicate name.
func (*Registry) Call ¶
Call runs one tool call and always returns a result (never an error): unknown tool, invalid JSON arguments, unknown argument fields, and tool failures all become IsError results whose text tells the model what to do differently.