Documentation
¶
Index ¶
- func CommandMatches(cited, ran string) bool
- func PathsProvenInSession(msgs []provider.Message, paths []string, wantWrite bool) bool
- func SessionMessagesFromContext(ctx context.Context) ([]provider.Message, bool)
- func WithLedger(ctx context.Context, ledger *Ledger) context.Context
- func WithSessionMessages(ctx context.Context, msgs []provider.Message) context.Context
- type Ledger
- func (l *Ledger) HasAnySuccessfulReceipt() bool
- func (l *Ledger) HasFailedCommand(command string) bool
- func (l *Ledger) HasSuccessfulBashMentioningPaths(paths []string) bool
- func (l *Ledger) HasSuccessfulCommand(command string) bool
- func (l *Ledger) HasSuccessfulCommandAfter(command string, after int) bool
- func (l *Ledger) HasSuccessfulCompleteStepAfter(after int) bool
- func (l *Ledger) HasSuccessfulReadOrWrite(paths []string) bool
- func (l *Ledger) HasSuccessfulTodoWrite() bool
- func (l *Ledger) HasSuccessfulWrite(paths []string) bool
- func (l *Ledger) IncompleteLatestTodos() ([]TodoStepMatch, bool)
- func (l *Ledger) LatestSuccessfulWriteIndex(paths []string) (int, bool)
- func (l *Ledger) LatestSuccessfulWriterIndex() (int, bool)
- func (l *Ledger) LatestTodos() ([]TodoItem, bool)
- func (l *Ledger) MatchLatestTodoStep(step string) (TodoStepMatch, bool)
- func (l *Ledger) Record(r Receipt)
- func (l *Ledger) Reset()
- func (l *Ledger) SuccessfulCommands(limit int) []string
- func (l *Ledger) TouchedPaths(limit int, writtenOnly bool) []string
- func (l *Ledger) UnverifiedCompletedTodos(current []TodoItem) (missing []TodoStepMatch, hasBaseline bool)
- type ReadinessAudit
- type ReadinessAuditResult
- type Receipt
- type TodoItem
- type TodoStepMatch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandMatches ¶
CommandMatches reports whether a cited verification command is proven by a command that actually ran. Models paraphrase commands when citing them (dropping a `cd` prefix, changing quote style, omitting flags), so byte equality rejects real verifications; instead both sides are split into shell segments and each cited segment must be covered by some ran segment.
func PathsProvenInSession ¶
PathsProvenInSession reports whether every path is covered by a successful (non-errored) tool call somewhere in msgs — the cross-turn fallback for diff and files evidence, mirroring verifyCommandFromSession for the per-turn ledger's path receipts (which reset each turn). wantWrite restricts to writer tools (diff); false accepts a reader or writer (files).
func SessionMessagesFromContext ¶
SessionMessagesFromContext retrieves the conversation history attached by WithSessionMessages.
func WithSessionMessages ¶
WithSessionMessages attaches the full conversation history so verifyStepEvidence can fall back to scanning the transcript when the per-turn ledger misses a command (cross-turn references, non-bash tool calls, truncated command strings).
Types ¶
type Ledger ¶
type Ledger struct {
// contains filtered or unexported fields
}
Ledger stores the receipts available to complete_step for the current turn.
func (*Ledger) HasAnySuccessfulReceipt ¶
HasAnySuccessfulReceipt reports whether any tool succeeded this turn — the signal that the turn did real work, not pure conversation.
func (*Ledger) HasFailedCommand ¶
HasFailedCommand reports whether the cited command ran this turn but exited non-zero — so callers can distinguish "ran and failed" from "never ran".
func (*Ledger) HasSuccessfulBashMentioningPaths ¶
HasSuccessfulBashMentioningPaths reports whether every path appears in some successful bash command this turn — files created or edited through shell redirection (`seq … > file`) leave no reader/writer receipt, so the command text naming the path is the receipt.
func (*Ledger) HasSuccessfulCommand ¶
func (*Ledger) HasSuccessfulCommandAfter ¶
func (*Ledger) HasSuccessfulCompleteStepAfter ¶
func (*Ledger) HasSuccessfulReadOrWrite ¶
func (*Ledger) HasSuccessfulTodoWrite ¶
func (*Ledger) HasSuccessfulWrite ¶
func (*Ledger) IncompleteLatestTodos ¶
func (l *Ledger) IncompleteLatestTodos() ([]TodoStepMatch, bool)
func (*Ledger) LatestSuccessfulWriteIndex ¶
func (*Ledger) LatestSuccessfulWriterIndex ¶
func (*Ledger) LatestTodos ¶
LatestTodos returns the todo list from this turn's latest successful todo_write.
func (*Ledger) MatchLatestTodoStep ¶
func (l *Ledger) MatchLatestTodoStep(step string) (TodoStepMatch, bool)
func (*Ledger) Record ¶
Record appends a receipt. Failed receipts are retained for auditability but are never accepted by the HasSuccessful* matchers.
func (*Ledger) SuccessfulCommands ¶
SuccessfulCommands returns up to limit successful bash commands from this turn, most recent first, for self-correction hints in rejection errors.
func (*Ledger) TouchedPaths ¶
TouchedPaths returns up to limit distinct paths from this turn's successful receipts, most recent first; writtenOnly restricts it to writer receipts.
func (*Ledger) UnverifiedCompletedTodos ¶
func (l *Ledger) UnverifiedCompletedTodos(current []TodoItem) (missing []TodoStepMatch, hasBaseline bool)
UnverifiedCompletedTodos reports current completed todos that transitioned from the latest prior successful todo_write receipt without a matching successful complete_step receipt earlier in the same turn. If this turn has no prior todo_write baseline, hasBaseline is false and callers should preserve the existing loose validation behavior.
type ReadinessAudit ¶
type ReadinessAudit struct {
Result ReadinessAuditResult
Recovered bool
MissingProjectChecks int
IncompleteTodos int
CommandMismatchMissing int
}
ReadinessAudit is a structured, non-rendered receipt for the final-answer readiness gate. It lets metrics sinks count why the host blocked a final answer without scraping Notice text or adding model-visible state.
type ReadinessAuditResult ¶
type ReadinessAuditResult string
ReadinessAuditResult classifies one host final-answer readiness audit receipt.
const ( ReadinessAllowed ReadinessAuditResult = "allowed" ReadinessBlocked ReadinessAuditResult = "blocked" ReadinessErrored ReadinessAuditResult = "errored" )
type Receipt ¶
type Receipt struct {
ToolName string `json:"tool_name"`
Args json.RawMessage `json:"args,omitempty"`
Success bool `json:"success"`
Command string `json:"command,omitempty"`
Step string `json:"step,omitempty"`
TodoStep *TodoStepMatch `json:"todo_step,omitempty"`
Paths []string `json:"paths,omitempty"`
Read bool `json:"read,omitempty"`
Write bool `json:"write,omitempty"`
Todos []TodoItem `json:"todos,omitempty"`
}
Receipt is the host-runtime record of one tool call. It stays in memory for the current agent turn and is not serialized into prompts or session state.
func ReceiptFromToolCall ¶
type TodoItem ¶
type TodoItem struct {
Content string `json:"content"`
Status string `json:"status"`
ActiveForm string `json:"activeForm,omitempty"`
Level int `json:"level,omitempty"`
}
TodoItem mirrors the todo_write item shape the host needs for step matching.
type TodoStepMatch ¶
TodoStepMatch is the result of matching complete_step.step against the latest successful todo_write list in this turn.
func IncompleteTodos ¶
func IncompleteTodos(todos []TodoItem) []TodoStepMatch
IncompleteTodos returns the items of a todo list that are not completed.