Documentation
¶
Overview ¶
Package verify runs the deliverable checkers of harness v3 §4: after a tool call changed a file under /workspace/outputs/, the skill checker that matches its extension runs in the thread's sandbox (≤ 60 s) and its result becomes an agent.CheckResult (appended to the tool result, CUSTOM work.verification, the verification StopGuard and the goal judge).
Index ¶
- Constants
- func DefaultCheckers() map[string]Checker
- type ArtifactSource
- type Checker
- type Options
- type Verifier
- func (v *Verifier) Check(ctx context.Context, run *store.Run, p string) agent.CheckResult
- func (v *Verifier) CheckCommand(p string) string
- func (v *Verifier) CheckerFor(p string) string
- func (v *Verifier) Complete(ctx context.Context, run *store.Run, p string, base agent.CheckResult) agent.CheckResult
- func (v *Verifier) Deliverables(ctx context.Context, run *store.Run) []agent.Deliverable
- func (v *Verifier) Evidence(ctx context.Context, run *store.Run, g *store.Goal) []store.GoalEvidence
Constants ¶
const BaselinesDir = sandbox.ScratchDir + "/baselines"
BaselinesDir receives the originals written for a checker (Checker.Baseline).
const EvidenceChars = 2000
EvidenceChars bounds the text excerpt of a deliverable given to the goal judge.
const ValidatorScript = "/skills/xlsx/scripts/validate_file.py"
ValidatorScript validates the files no other skill covers: Python compiles, JSON and CSV parse (checker contract, check names py_compile / json / csv). It ships with the xlsx skill, so the model can run it itself.
Variables ¶
This section is empty.
Functions ¶
func DefaultCheckers ¶
DefaultCheckers are the built-in skills' checkers (developer D's contract) and the generic validators.
Types ¶
type ArtifactSource ¶
type ArtifactSource interface {
ListArtifacts(ctx context.Context, threadID string) ([]*store.Artifact, error)
ListArtifactVersions(ctx context.Context, artifactID string) ([]store.ArtifactVersion, error)
Content(ctx context.Context, a *store.Artifact, version int) ([]byte, *store.ArtifactVersion, error)
}
ArtifactSource reads a thread's artifacts (artifacts.Service): the originals of deliverables (baselines) and the uploaded PDFs citations refer to.
type Checker ¶
type Checker struct {
Name string
Skill string // installed before the command runs ("" none)
Command string
// Baseline is appended to Command when the deliverable has an original
// (review round 2, N8: the deck the user gave, see Verifier.baseline);
// {baseline} is replaced by the shell-quoted path of that original.
Baseline string
}
Checker is the command checking one file type; {file} in Command is replaced by the shell-quoted path. The command prints the checker contract JSON {ok, file, checks: [{name, ok, detail}], next_step?} and exits 0 (ok), 2 (not ok) or 1 (usage error, missing file, crash: could not run).
func DefaultCitations ¶
func DefaultCitations() *Checker
DefaultCitations is the pdf skill's citation checker (check_citations.py SOURCE.pdf... FILE).
type Options ¶
type Options struct {
// Checkers by lower-case extension (".docx"); nil: DefaultCheckers.
Checkers map[string]Checker
// Timeout bounds one checker run (default 60 s).
Timeout time.Duration
// Sandbox gives the thread's live sandbox (Get: never creates one).
Sandbox sandbox.Manager
// EnsureSkill installs a skill into the sandbox before its checker runs.
EnsureSkill func(ctx context.Context, run *store.Run, sb sandbox.Sandbox, skill string) error
// Messages reads a thread's messages (Deliverables).
Messages interface {
ListMessages(ctx context.Context, threadID string) ([]*store.Message, error)
}
// Artifacts finds originals (Checker.Baseline) and PDF sources (Citations); nil: neither.
Artifacts ArtifactSource
// Citations checks the page citations "(p. N)" of .docx/.pptx/.pdf
// deliverables against the thread's uploaded PDFs ({sources}, {file});
// its result is merged into the format checker's (review round 2, A9).
// nil: DefaultCitations when Checkers is nil too, else none.
Citations *Checker
}
Options configures the verifier.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier implements agent.Checker.
func (*Verifier) Check ¶
Check implements agent.Checker: the file type's checker (with the deliverable's original as baseline when it has one), then, for documents citing pages of an uploaded PDF, the citation checker (one merged result).
func (*Verifier) CheckCommand ¶
CheckCommand implements agent.CheckCommander: the command that checks p ("" when its type has no checker).
func (*Verifier) CheckerFor ¶
CheckerFor implements agent.Checker.
func (*Verifier) Complete ¶
func (v *Verifier) Complete(ctx context.Context, run *store.Run, p string, base agent.CheckResult) agent.CheckResult
Complete implements agent.CheckCompleter (final review of round 3, F1): base is the result of p's checker command (CheckCommand) run by the model on p's final content. It stands for the format check unless p has a baseline (the command did not pass it: the checker runs again with it); the citation check still runs. A file type with neither keeps base (no sandbox call).
func (*Verifier) Deliverables ¶
Deliverables implements agent.DeliverableSource (post-compaction rehydration): the deliverables changed in the run's turn with their last checker result, from the stored tool messages.
func (*Verifier) Evidence ¶
func (v *Verifier) Evidence(ctx context.Context, run *store.Run, g *store.Goal) []store.GoalEvidence
Evidence implements the goal judge's evidence (goals.Hook.Evidence): the deliverables of every turn since the goal was set (g; nil: the run's turn) with their latest checker result and the start of their extracted text (the live sandbox only: none is created for it).