record

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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
	URLMax         = 500
	LedgerMax      = 50
)
View Source
const SuspectedInjection = "Suspected prompt injection: "

SuspectedInjection opens the headline of a suspicious record.

Variables

View Source
var ArtifactKinds = []string{"review-draft", "triage"}

ArtifactKinds is the table of artifact kinds an intent's rules list from.

View Source
var OutcomeFields = []string{"verdict", "url"}

OutcomeFields are the outcome fields a rule can list or require.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Kind  string `json:"kind"`
	Body  string `json:"body"`
	Items []Item `json:"items,omitempty"`
}

type Item

type Item struct {
	Path string `json:"path"`
	Line int    `json:"line"`
	Body string `json:"body"`
}

type Option

type Option struct {
	ID          string `json:"id"`
	Label       string `json:"label"`
	Consequence string `json:"consequence"`
	Publishes   bool   `json:"publishes,omitempty"`
}

func (Option) Answer

func (o Option) Answer() string

type Outcome

type Outcome struct {
	Verdict     string `json:"verdict"`
	URL         string `json:"url"`
	Blocking    int    `json:"blocking"`
	NonBlocking int    `json:"non_blocking"`
}

type Problems

type Problems []string

func (Problems) Error

func (p Problems) Error() string

type Question

type Question struct {
	Kind      string   `json:"kind"`
	Text      string   `json:"text"`
	Options   []Option `json:"options,omitempty"`
	Recommend string   `json:"recommend,omitempty"`
	Publishes bool     `json:"publishes,omitempty"`
}

func (Question) Endorses

func (q Question) Endorses(optionID string, yes bool) bool

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"`
	// 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 Parse

func Parse(raw []byte) (Record, error)

func Unrecorded

func Unrecorded(message string) Record

Unrecorded is the loop's own record for a turn the agent ended without one, built from the agent's last message.

func (Record) EventData

func (r Record) EventData() string

func (Record) Hash

func (r Record) Hash() string

func (Record) Headline

func (r Record) Headline() string

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

func (r Record) ValidateShape() error

ValidateShape applies the rules that do not depend on the intent.

type State

type State string
const (
	Done            State = "done"
	Settled         State = "settled"
	Asked           State = "asked"
	Failed          State = "failed"
	UnrecordedState State = "unrecorded"
)

func (State) ClosesTurn

func (s State) ClosesTurn() bool

func (State) Stopped

func (s State) Stopped() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL