Documentation
¶
Overview ¶
Package goalflow binds the neutral Goal policy to bounded Coding evidence. It owns neither a work driver nor a scheduler; Runtime supplies both admission and explicit notification delivery.
Index ¶
- Constants
- func Bound(text string, maximum int) string
- func CanonicalArguments(data ai.JSON) ai.JSON
- func DecodeStrict(data ai.JSON, value any) error
- func Digest(text string) string
- func Encode(value any) (ai.JSON, error)
- func PartsText(parts []ai.Part) string
- func ValidUsage(usage ai.Usage) bool
- type Controller
- type Evidence
- type Record
- type State
- type Verdict
- type Verifier
Constants ¶
const ( MaxRecords = 32 MaxResultBytes = 4096 MaxEvidenceBytes = 192 << 10 MaxGaps = 16 )
Evidence payload bounds are independent of provider context limits.
Variables ¶
This section is empty.
Functions ¶
func CanonicalArguments ¶
CanonicalArguments normalizes object ordering for evidence identity.
func DecodeStrict ¶
DecodeStrict rejects unknown fields, trailing values and oversized payloads.
func ValidUsage ¶
ValidUsage rejects impossible observed token counters.
Types ¶
type Controller ¶
type Controller struct {
Evaluator goal.Evaluator
Verifier *Verifier
// FailedUsage journals observed usage of a failed Decision separately. The
// generic runtime intentionally commits usage only on successful Decisions.
FailedUsage func(ai.Usage) error
KnownFailed func() ai.Usage
Invalidated func() bool
Phase func(string) error
}
Controller decorates the SDK Goal policy with Coding's gates, independent evidence audit, and substantive progress classification.
func (*Controller) Decide ¶
func (c *Controller) Decide(ctx context.Context, request continuation.DecisionRequest) (continuation.Decision, error)
Decide preserves Coding gates around the neutral SDK Goal policy.
type Evidence ¶
type Evidence struct {
InteractionID string `json:"interaction_id"`
AttemptID string `json:"attempt_id"`
Records []Record `json:"records"`
Claim string `json:"claim,omitempty"`
Gate string `json:"gate,omitempty"`
Background bool `json:"background,omitempty"`
Stopped bool `json:"stopped,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
Evidence is persisted at the Work/Decision boundary. Claims cannot substitute for Records. Gate and Background defer assessment without invoking a model.
func Merge ¶
Merge retains a bounded latest-result ledger. Evicted essential evidence cannot authorize completion: truncation is sticky until explicit invalidation.
func (Evidence) Fingerprint ¶
Fingerprint deliberately excludes conversation text, identity, and repeated identical calls. Only substantive tool evidence advances this marker.
type Record ¶
type Record struct {
ID string `json:"id"`
RunID string `json:"run_id,omitempty"`
CallID string `json:"call_id"`
EntryID string `json:"entry_id"`
Tool string `json:"tool"`
Arguments ai.JSON `json:"arguments"`
Body string `json:"body"`
Digest string `json:"digest"`
Substance string `json:"substance,omitempty"`
OK bool `json:"ok"`
Truncated bool `json:"truncated"`
}
Record is an actual committed tool result, not an assistant claim. Digest covers the complete result even when the bounded body is truncated.
type State ¶
type State struct {
Version int `json:"version"`
Goal ai.JSON `json:"goal"`
Evidence Evidence `json:"evidence"`
Digest string `json:"digest,omitempty"`
EmptyRounds int `json:"empty_rounds"`
Gaps []string `json:"gaps,omitempty"`
References []string `json:"references,omitempty"`
}
State is the Coding wrapper around the unchanged SDK Goal State V1.
type Verdict ¶
type Verdict struct {
Verified bool `json:"verified"`
Reason string `json:"reason"`
Gaps []string `json:"gaps"`
References []string `json:"references"`
}
Verdict is intentionally not the generic Review result: an empty list of findings can never authorize Goal completion.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier audits captured evidence with a bounded read-only workspace catalog.
func NewVerifier ¶
func NewVerifier(ctx context.Context, model ai.LanguageModel, tree *workspace.Tree) (*Verifier, error)
NewVerifier constructs an isolated verifier without shell, MCP or delegation.
func (*Verifier) Verify ¶
func (v *Verifier) Verify( ctx context.Context, condition string, evidence Evidence, limits continuation.Limits, accounting continuation.Accounting, ) (Verdict, ai.Usage, error)
Verify performs bounded reads followed by one strict completion verdict.