Documentation
¶
Overview ¶
Package record is how an agent says a turn of the loop ended: the state, a one-line summary, and when it stops on a question, the whole question.
Index ¶
Constants ¶
const ( MaxBytes = 256 << 10 SummaryMax = 200 TextMax = 4000 LabelMax = 60 ConsequenceMax = 300 RecommendMax = 300 BodyMax = 60000 ItemsMax = 100 PathMax = 300 ItemBodyMax = 4000 ResumeMax = 4000 NextMax = 1000 LearnedMax = 1500 URLMax = 500 VerdictMax = 60 LedgerMax = 50 )
const SuspectedInjection = "Suspected prompt injection: "
SuspectedInjection opens the headline of a suspicious record.
Variables ¶
var ArtifactKinds = []string{"review-draft", "triage"}
ArtifactKinds is the table of artifact kinds an intent's rules list from.
var OutcomeFields = []string{"verdict", "url", "draft"}
OutcomeFields are the outcome fields a rule can list or require.
Functions ¶
Types ¶
type DraftRef ¶ added in v0.5.0
DraftRef points to a draft of the turn at the rev its agent stands by.
type Option ¶
type Option struct {
ID string `json:"id"`
Label string `json:"label"`
Consequence string `json:"consequence"`
// Publishes is the endorsement of records that predate Draft, kept so they still decode.
Publishes bool `json:"publishes,omitempty"`
// Draft is the held draft picking the option approves, at its rev; nil for none.
Draft *DraftRef `json:"draft,omitempty"`
}
type Outcome ¶
type Outcome struct {
Verdict string `json:"verdict"`
URL string `json:"url"`
Blocking int `json:"blocking"`
NonBlocking int `json:"non_blocking"`
// Draft is the draft the turn ended on; its send fills URL.
Draft *DraftRef `json:"draft,omitempty"`
// Approved says a person, or a session the user drives, approved Draft, so the user stands behind
// what it posted; a rule's or a window's release never sets it. Only the loop's own record sets it:
// an agent's is refused.
Approved bool `json:"approved,omitempty"`
}
type Question ¶
type Question struct {
Kind string `json:"kind"`
Text string `json:"text"`
Options []Option `json:"options,omitempty"`
Recommend string `json:"recommend,omitempty"`
// Publishes is the endorsement of records that predate Draft, kept so they still decode.
Publishes bool `json:"publishes,omitempty"`
// Draft is the held draft a confirm question's yes approves, at its rev; nil for none.
Draft *DraftRef `json:"draft,omitempty"`
}
type Record ¶
type Record struct {
State State `json:"state"`
Summary string `json:"summary"`
Outcome *Outcome `json:"outcome,omitempty"`
Question *Question `json:"question,omitempty"`
Artifact *Artifact `json:"artifact,omitempty"`
Resume string `json:"resume,omitempty"`
Next string `json:"next,omitempty"`
User string `json:"user,omitempty"`
// Learned is what the turn learned that a later turn on the task needs, beyond the summary.
Learned string `json:"learned,omitempty"`
// Suspicious says the turn stopped on text from someone other than the
// user that looks like an attempt to steer the agent.
Suspicious bool `json:"suspicious,omitempty"`
// Ledger is the items the turn created, assigned, resolved or reopened;
// an op without a unit is on the turn's unit.
Ledger []items.Op `json:"ledger,omitempty"`
}
func Unrecorded ¶
Unrecorded is the loop's own record for a turn the agent ended without one, built from the agent's last message.
func (Record) Headline ¶
Headline is the summary as the user reads it: a suspicious record says so first.
func (Record) Validate ¶
func (r Record) Validate(rules dintent.RecordRules) error
Validate checks the record against the rules of the turn's intent.
func (Record) ValidateShape ¶
ValidateShape applies the rules that do not depend on the intent.